This feature is complex, of questionable utility, and slows down normal decoding.
Unified · Split
| @@ -3527,12 +3527,6 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) · 3526 unmodified lines | ||
| 3527 | 3527 | |
| 3528 | 3528 | switch (dec->codec_type) { |
| 3529 | 3529 | case AVMEDIA_TYPE_VIDEO: |
| 3530 | − if (dec->lowres) { | |
| 3531 | − dec->flags |= CODEC_FLAG_EMU_EDGE; | |
| 3532 | − dec->height >>= dec->lowres; | |
| 3533 | − dec->width >>= dec->lowres; | |
| 3534 | − } | |
| 3535 | − | |
| 3536 | 3530 | ist->resample_height = dec->height; |
| 3537 | 3531 | ist->resample_width = dec->width; |
| 3538 | 3532 | ist->resample_pix_fmt = dec->pix_fmt; |
| @@ -244,7 +244,6 @@ static int step = 0; · 243 unmodified lines | ||
| 244 | 244 | static int workaround_bugs = 1; |
| 245 | 245 | static int fast = 0; |
| 246 | 246 | static int genpts = 0; |
| 247 | −static int lowres = 0; | |
| 248 | 247 | static int idct = FF_IDCT_AUTO; |
| 249 | 248 | static enum AVDiscard skip_frame = AVDISCARD_DEFAULT; |
| 250 | 249 | static enum AVDiscard skip_idct = AVDISCARD_DEFAULT; |
| @@ -1298,7 +1297,7 @@ static void alloc_picture(void *opaque) · 1047 unmodified lines | ||
| 1298 | 1297 | /* SDL allocates a buffer smaller than requested if the video |
| 1299 | 1298 | * overlay hardware is unable to support the requested size. */ |
| 1300 | 1299 | fprintf(stderr, "Error: the video system does not support an image\n" |
| 1301 | − "size of %dx%d pixels. Try using -lowres or -vf \"scale=w:h\"\n" | |
| 1300 | + "size of %dx%d pixels. Try using -vf \"scale=w:h\"\n" | |
| 1302 | 1301 | "to reduce the image size.\n", vp->width, vp->height ); |
| 1303 | 1302 | do_exit(); |
| 1304 | 1303 | } |
| @@ -2185,14 +2184,12 @@ static int stream_component_open(VideoState *is, int stream_index) · 880 unmodified lines | ||
| 2185 | 2184 | avctx->debug_mv = debug_mv; |
| 2186 | 2185 | avctx->debug = debug; |
| 2187 | 2186 | avctx->workaround_bugs = workaround_bugs; |
| 2188 | − avctx->lowres = lowres; | |
| 2189 | 2187 | avctx->idct_algo = idct; |
| 2190 | 2188 | avctx->skip_frame = skip_frame; |
| 2191 | 2189 | avctx->skip_idct = skip_idct; |
| 2192 | 2190 | avctx->skip_loop_filter = skip_loop_filter; |
| 2193 | 2191 | avctx->error_concealment = error_concealment; |
| 2194 | 2192 | |
| 2195 | − if (lowres) avctx->flags |= CODEC_FLAG_EMU_EDGE; | |
| 2196 | 2193 | if (fast) avctx->flags2 |= CODEC_FLAG2_FAST; |
| 2197 | 2194 | |
| 2198 | 2195 | if (!av_dict_get(opts, "threads", NULL, 0)) |
| @@ -2979,7 +2976,6 @@ static const OptionDef options[] = { · 780 unmodified lines | ||
| 2979 | 2976 | { "fast", OPT_BOOL | OPT_EXPERT, { (void*)&fast }, "non spec compliant optimizations", "" }, |
| 2980 | 2977 | { "genpts", OPT_BOOL | OPT_EXPERT, { (void*)&genpts }, "generate pts", "" }, |
| 2981 | 2978 | { "drp", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&decoder_reorder_pts }, "let decoder reorder pts 0=off 1=on -1=auto", ""}, |
| 2982 | − { "lowres", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&lowres }, "", "" }, | |
| 2983 | 2979 | { "skiploop", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&skip_loop_filter }, "", "" }, |
| 2984 | 2980 | { "skipframe", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&skip_frame }, "", "" }, |
| 2985 | 2981 | { "skipidct", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&skip_idct }, "", "" }, |
| @@ -336,7 +336,7 @@ void ff_dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx) · 335 unmodified lines | ||
| 336 | 336 | put_pixels_clamped_axp_p = c->put_pixels_clamped; |
| 337 | 337 | add_pixels_clamped_axp_p = c->add_pixels_clamped; |
| 338 | 338 | |
| 339 | − if (!avctx->lowres && avctx->bits_per_raw_sample <= 8 && | |
| 339 | + if (avctx->bits_per_raw_sample <= 8 && | |
| 340 | 340 | (avctx->idct_algo == FF_IDCT_AUTO || |
| 341 | 341 | avctx->idct_algo == FF_IDCT_SIMPLEALPHA)) { |
| 342 | 342 | c->idct_put = ff_simple_idct_put_axp; |
| @@ -80,7 +80,7 @@ void ff_dsputil_init_arm(DSPContext* c, AVCodecContext *avctx) · 79 unmodified lines | ||
| 80 | 80 | ff_put_pixels_clamped = c->put_pixels_clamped; |
| 81 | 81 | ff_add_pixels_clamped = c->add_pixels_clamped; |
| 82 | 82 | |
| 83 | − if (!avctx->lowres && avctx->bits_per_raw_sample <= 8) { | |
| 83 | + if (avctx->bits_per_raw_sample <= 8) { | |
| 84 | 84 | if(avctx->idct_algo == FF_IDCT_AUTO || |
| 85 | 85 | avctx->idct_algo == FF_IDCT_ARM){ |
| 86 | 86 | c->idct_put = j_rev_dct_arm_put; |
| @@ -29,7 +29,7 @@ void ff_prefetch_arm(void *mem, int stride, int h); · 28 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | av_cold void ff_dsputil_init_armv5te(DSPContext *c, AVCodecContext *avctx) |
| 31 | 31 | { |
| 32 | − if (!avctx->lowres && avctx->bits_per_raw_sample <= 8 && | |
| 32 | + if (avctx->bits_per_raw_sample <= 8 && | |
| 33 | 33 | (avctx->idct_algo == FF_IDCT_AUTO || |
| 34 | 34 | avctx->idct_algo == FF_IDCT_SIMPLEARMV5TE)) { |
| 35 | 35 | c->idct_put = ff_simple_idct_put_armv5te; |
| @@ -74,7 +74,7 @@ av_cold void ff_dsputil_init_armv6(DSPContext *c, AVCodecContext *avctx) · 73 unmodified lines | ||
| 74 | 74 | { |
| 75 | 75 | const int high_bit_depth = avctx->bits_per_raw_sample > 8; |
| 76 | 76 | |
| 77 | − if (!avctx->lowres && avctx->bits_per_raw_sample <= 8 && | |
| 77 | + if (avctx->bits_per_raw_sample <= 8 && | |
| 78 | 78 | (avctx->idct_algo == FF_IDCT_AUTO || |
| 79 | 79 | avctx->idct_algo == FF_IDCT_SIMPLEARMV6)) { |
| 80 | 80 | c->idct_put = ff_simple_idct_put_armv6; |
| @@ -182,7 +182,7 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx) · 181 unmodified lines | ||
| 182 | 182 | { |
| 183 | 183 | const int high_bit_depth = avctx->bits_per_raw_sample > 8; |
| 184 | 184 | |
| 185 | − if (!avctx->lowres && avctx->bits_per_raw_sample <= 8) { | |
| 185 | + if (avctx->bits_per_raw_sample <= 8) { | |
| 186 | 186 | if (avctx->idct_algo == FF_IDCT_AUTO || |
| 187 | 187 | avctx->idct_algo == FF_IDCT_SIMPLENEON) { |
| 188 | 188 | c->idct_put = ff_simple_idct_put_neon; |
| @@ -1394,7 +1394,7 @@ typedef struct AVCodecContext { · 1393 unmodified lines | ||
| 1394 | 1394 | int width, height; |
| 1395 | 1395 | |
| 1396 | 1396 | /** |
| 1397 | − * Bitstream width / height, may be different from width/height if lowres enabled. | |
| 1397 | + * Bitstream width / height, may be different from width/height. | |
| 1398 | 1398 | * - encoding: unused |
| 1399 | 1399 | * - decoding: Set by user before init if known. Codec should override / dynamically change if needed. |
| 1400 | 1400 | */ |
| @@ -2586,7 +2586,7 @@ typedef struct AVCodecContext { · 1185 unmodified lines | ||
| 2586 | 2586 | * - encoding: unused |
| 2587 | 2587 | * - decoding: Set by user. |
| 2588 | 2588 | */ |
| 2589 | − int lowres; | |
| 2589 | + attribute_deprecated int lowres; | |
| 2590 | 2590 | |
| 2591 | 2591 | /** |
| 2592 | 2592 | * the picture in the bitstream |
| @@ -2847,7 +2847,7 @@ typedef struct AVCodec { · 254 unmodified lines | ||
| 2847 | 2847 | const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 |
| 2848 | 2848 | const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 |
| 2849 | 2849 | const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 |
| 2850 | − uint8_t max_lowres; ///< maximum value for lowres supported by the decoder | |
| 2850 | + attribute_deprecated uint8_t max_lowres; ///< maximum value for lowres supported by the decoder | |
| 2851 | 2851 | const AVClass *priv_class; ///< AVClass for the private context |
| 2852 | 2852 | const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} |
| 2853 | 2853 | |
| @@ -2700,37 +2700,6 @@ static void ff_jref_idct_add(uint8_t *dest, int line_size, DCTELEM *block) · 2699 unmodified lines | ||
| 2700 | 2700 | ff_add_pixels_clamped_c(block, dest, line_size); |
| 2701 | 2701 | } |
| 2702 | 2702 | |
| 2703 | −static void ff_jref_idct4_put(uint8_t *dest, int line_size, DCTELEM *block) | |
| 2704 | −{ | |
| 2705 | − ff_j_rev_dct4 (block); | |
| 2706 | − put_pixels_clamped4_c(block, dest, line_size); | |
| 2707 | −} | |
| 2708 | −static void ff_jref_idct4_add(uint8_t *dest, int line_size, DCTELEM *block) | |
| 2709 | −{ | |
| 2710 | − ff_j_rev_dct4 (block); | |
| 2711 | − add_pixels_clamped4_c(block, dest, line_size); | |
| 2712 | −} | |
| 2713 | − | |
| 2714 | −static void ff_jref_idct2_put(uint8_t *dest, int line_size, DCTELEM *block) | |
| 2715 | −{ | |
| 2716 | − ff_j_rev_dct2 (block); | |
| 2717 | − put_pixels_clamped2_c(block, dest, line_size); | |
| 2718 | −} | |
| 2719 | −static void ff_jref_idct2_add(uint8_t *dest, int line_size, DCTELEM *block) | |
| 2720 | −{ | |
| 2721 | − ff_j_rev_dct2 (block); | |
| 2722 | − add_pixels_clamped2_c(block, dest, line_size); | |
| 2723 | −} | |
| 2724 | − | |
| 2725 | −static void ff_jref_idct1_put(uint8_t *dest, int line_size, DCTELEM *block) | |
| 2726 | −{ | |
| 2727 | − dest[0] = av_clip_uint8((block[0] + 4)>>3); | |
| 2728 | −} | |
| 2729 | −static void ff_jref_idct1_add(uint8_t *dest, int line_size, DCTELEM *block) | |
| 2730 | −{ | |
| 2731 | − dest[0] = av_clip_uint8(dest[0] + ((block[0] + 4)>>3)); | |
| 2732 | −} | |
| 2733 | − | |
| 2734 | 2703 | static void just_return(void *mem av_unused, int stride av_unused, int h av_unused) { return; } |
| 2735 | 2704 | |
| 2736 | 2705 | /* init static data */ |
| @@ -2797,28 +2766,12 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx) · 60 unmodified lines | ||
| 2797 | 2766 | } |
| 2798 | 2767 | #endif //CONFIG_ENCODERS |
| 2799 | 2768 | |
| 2800 | − if(avctx->lowres==1){ | |
| 2801 | − c->idct_put= ff_jref_idct4_put; | |
| 2802 | − c->idct_add= ff_jref_idct4_add; | |
| 2803 | − c->idct = ff_j_rev_dct4; | |
| 2804 | − c->idct_permutation_type= FF_NO_IDCT_PERM; | |
| 2805 | − }else if(avctx->lowres==2){ | |
| 2806 | − c->idct_put= ff_jref_idct2_put; | |
| 2807 | − c->idct_add= ff_jref_idct2_add; | |
| 2808 | − c->idct = ff_j_rev_dct2; | |
| 2809 | − c->idct_permutation_type= FF_NO_IDCT_PERM; | |
| 2810 | − }else if(avctx->lowres==3){ | |
| 2811 | − c->idct_put= ff_jref_idct1_put; | |
| 2812 | − c->idct_add= ff_jref_idct1_add; | |
| 2813 | − c->idct = ff_j_rev_dct1; | |
| 2814 | − c->idct_permutation_type= FF_NO_IDCT_PERM; | |
| 2815 | − }else{ | |
| 2816 | − if (avctx->bits_per_raw_sample == 10) { | |
| 2817 | − c->idct_put = ff_simple_idct_put_10; | |
| 2818 | − c->idct_add = ff_simple_idct_add_10; | |
| 2819 | − c->idct = ff_simple_idct_10; | |
| 2820 | − c->idct_permutation_type = FF_NO_IDCT_PERM; | |
| 2821 | − } else { | |
| 2769 | + if (avctx->bits_per_raw_sample == 10) { | |
| 2770 | + c->idct_put = ff_simple_idct_put_10; | |
| 2771 | + c->idct_add = ff_simple_idct_add_10; | |
| 2772 | + c->idct = ff_simple_idct_10; | |
| 2773 | + c->idct_permutation_type = FF_NO_IDCT_PERM; | |
| 2774 | + } else { | |
| 2822 | 2775 | if(avctx->idct_algo==FF_IDCT_INT){ |
| 2823 | 2776 | c->idct_put= ff_jref_idct_put; |
| 2824 | 2777 | c->idct_add= ff_jref_idct_add; |
| @@ -2849,7 +2802,6 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx) · 24 unmodified lines | ||
| 2849 | 2802 | c->idct = ff_simple_idct_8; |
| 2850 | 2803 | c->idct_permutation_type= FF_NO_IDCT_PERM; |
| 2851 | 2804 | } |
| 2852 | − } | |
| 2853 | 2805 | } |
| 2854 | 2806 | |
| 2855 | 2807 | c->diff_pixels = diff_pixels_c; |
| @@ -46,9 +46,6 @@ void ff_fdct248_islow_8(DCTELEM *data); · 45 unmodified lines | ||
| 46 | 46 | void ff_fdct248_islow_10(DCTELEM *data); |
| 47 | 47 | |
| 48 | 48 | void ff_j_rev_dct (DCTELEM *data); |
| 49 | −void ff_j_rev_dct4 (DCTELEM *data); | |
| 50 | −void ff_j_rev_dct2 (DCTELEM *data); | |
| 51 | −void ff_j_rev_dct1 (DCTELEM *data); | |
| 52 | 49 | void ff_wmv2_idct_c(DCTELEM *data); |
| 53 | 50 | |
| 54 | 51 | void ff_fdct_mmx(DCTELEM *block); |
| @@ -311,13 +311,7 @@ av_cold int ff_dvvideo_init(AVCodecContext *avctx) · 310 unmodified lines | ||
| 311 | 311 | /* 248DCT setup */ |
| 312 | 312 | s->fdct[1] = dsp.fdct248; |
| 313 | 313 | s->idct_put[1] = ff_simple_idct248_put; // FIXME: need to add it to DSP |
| 314 | − if (avctx->lowres){ | |
| 315 | − for (i = 0; i < 64; i++){ | |
| 316 | − int j = ff_zigzag248_direct[i]; | |
| 317 | − s->dv_zigzag[1][i] = dsp.idct_permutation[(j & 7) + (j & 8) * 4 + (j & 48) / 2]; | |
| 318 | − } | |
| 319 | − }else | |
| 320 | − memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64); | |
| 314 | + memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64); | |
| 321 | 315 | |
| 322 | 316 | avctx->coded_frame = &s->picture; |
| 323 | 317 | s->avctx = avctx; |
| @@ -144,7 +144,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg) · 143 unmodified lines | ||
| 144 | 144 | LOCAL_ALIGNED_16(DCTELEM, sblock, [5*DV_MAX_BPM], [64]); |
| 145 | 145 | LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [ 80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */ |
| 146 | 146 | LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [5*80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */ |
| 147 | − const int log2_blocksize = 3-s->avctx->lowres; | |
| 147 | + const int log2_blocksize = 3; | |
| 148 | 148 | int is_field_mode[5]; |
| 149 | 149 | |
| 150 | 150 | assert((((int)mb_bit_buffer) & 7) == 0); |
| @@ -381,6 +381,5 @@ AVCodec ff_dvvideo_decoder = { · 230 unmodified lines | ||
| 381 | 381 | .close = dvvideo_close, |
| 382 | 382 | .decode = dvvideo_decode_frame, |
| 383 | 383 | .capabilities = CODEC_CAP_DR1 | CODEC_CAP_SLICE_THREADS, |
| 384 | − .max_lowres = 3, | |
| 385 | 384 | .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"), |
| 386 | 385 | }; |
| @@ -891,7 +891,7 @@ void ff_er_frame_end(MpegEncContext *s) · 890 unmodified lines | ||
| 891 | 891 | |
| 892 | 892 | /* We do not support ER of field pictures yet, |
| 893 | 893 | * though it should not crash if enabled. */ |
| 894 | − if (!s->err_recognition || s->error_count == 0 || s->avctx->lowres || | |
| 894 | + if (!s->err_recognition || s->error_count == 0 || | |
| 895 | 895 | s->avctx->hwaccel || |
| 896 | 896 | s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU || |
| 897 | 897 | s->picture_structure != PICT_FRAME || |
| @@ -127,7 +127,6 @@ AVCodec ff_flv_decoder = { · 126 unmodified lines | ||
| 127 | 127 | .close = ff_h263_decode_end, |
| 128 | 128 | .decode = ff_h263_decode_frame, |
| 129 | 129 | .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
| 130 | − .max_lowres = 3, | |
| 131 | 130 | .long_name = NULL_IF_CONFIG_SMALL("Flash Video (FLV) / Sorenson Spark / Sorenson H.263"), |
| 132 | 131 | .pix_fmts = ff_pixfmt_list_420, |
| 133 | 132 | }; |
| @@ -651,6 +651,5 @@ AVCodec ff_h261_decoder = { · 650 unmodified lines | ||
| 651 | 651 | .close = h261_decode_end, |
| 652 | 652 | .decode = h261_decode_frame, |
| 653 | 653 | .capabilities = CODEC_CAP_DR1, |
| 654 | − .max_lowres = 3, | |
| 655 | 654 | .long_name = NULL_IF_CONFIG_SMALL("H.261"), |
| 656 | 655 | }; |
| @@ -149,7 +149,7 @@ static int get_consumed_bytes(MpegEncContext *s, int buf_size){ · 148 unmodified lines | ||
| 149 | 149 | |
| 150 | 150 | static int decode_slice(MpegEncContext *s){ |
| 151 | 151 | const int part_mask= s->partitioned_frame ? (ER_AC_END|ER_AC_ERROR) : 0x7F; |
| 152 | − const int mb_size= 16>>s->avctx->lowres; | |
| 152 | + const int mb_size = 16; | |
| 153 | 153 | s->last_resync_gb= s->gb; |
| 154 | 154 | s->first_slice_line= 1; |
| 155 | 155 | |
| @@ -745,7 +745,6 @@ AVCodec ff_h263_decoder = { · 589 unmodified lines | ||
| 745 | 745 | .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | |
| 746 | 746 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY, |
| 747 | 747 | .flush = ff_mpeg_flush, |
| 748 | − .max_lowres = 3, | |
| 749 | 748 | .long_name = NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"), |
| 750 | 749 | .pix_fmts = ff_hwaccel_pixfmt_list_420, |
| 751 | 750 | }; |
| @@ -716,7 +716,6 @@ av_cold void ff_intrax8_common_end(IntraX8Context * w) · 715 unmodified lines | ||
| 716 | 716 | * The parent codec must call MPV_frame_start(), ff_er_frame_start() before calling this function. |
| 717 | 717 | * The parent codec must call ff_er_frame_end(), MPV_frame_end() after calling this function. |
| 718 | 718 | * This function does not use MPV_decode_mb(). |
| 719 | − * lowres decoding is theoretically impossible. | |
| 720 | 719 | * @param w pointer to IntraX8Context |
| 721 | 720 | * @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1. |
| 722 | 721 | * @param quant_offset offset away from zero |
| @@ -940,216 +940,3 @@ void ff_j_rev_dct(DCTBLOCK data) · 939 unmodified lines | ||
| 940 | 940 | dataptr++; /* advance pointer to next column */ |
| 941 | 941 | } |
| 942 | 942 | } |
| 943 | − | |
| 944 | −#undef DCTSIZE | |
| 945 | −#define DCTSIZE 4 | |
| 946 | −#define DCTSTRIDE 8 | |
| 947 | − | |
| 948 | −void ff_j_rev_dct4(DCTBLOCK data) | |
| 949 | −{ | |
| 950 | − int32_t tmp0, tmp1, tmp2, tmp3; | |
| 951 | − int32_t tmp10, tmp11, tmp12, tmp13; | |
| 952 | − int32_t z1; | |
| 953 | − int32_t d0, d2, d4, d6; | |
| 954 | − register DCTELEM *dataptr; | |
| 955 | − int rowctr; | |
| 956 | − | |
| 957 | − /* Pass 1: process rows. */ | |
| 958 | − /* Note results are scaled up by sqrt(8) compared to a true IDCT; */ | |
| 959 | − /* furthermore, we scale the results by 2**PASS1_BITS. */ | |
| 960 | − | |
| 961 | − data[0] += 4; | |
| 962 | − | |
| 963 | − dataptr = data; | |
| 964 | − | |
| 965 | − for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) { | |
| 966 | − /* Due to quantization, we will usually find that many of the input | |
| 967 | − * coefficients are zero, especially the AC terms. We can exploit this | |
| 968 | − * by short-circuiting the IDCT calculation for any row in which all | |
| 969 | − * the AC terms are zero. In that case each output is equal to the | |
| 970 | − * DC coefficient (with scale factor as needed). | |
| 971 | − * With typical images and quantization tables, half or more of the | |
| 972 | − * row DCT calculations can be simplified this way. | |
| 973 | − */ | |
| 974 | − | |
| 975 | − register int *idataptr = (int*)dataptr; | |
| 976 | − | |
| 977 | − d0 = dataptr[0]; | |
| 978 | − d2 = dataptr[1]; | |
| 979 | − d4 = dataptr[2]; | |
| 980 | − d6 = dataptr[3]; | |
| 981 | − | |
| 982 | − if ((d2 | d4 | d6) == 0) { | |
| 983 | − /* AC terms all zero */ | |
| 984 | − if (d0) { | |
| 985 | − /* Compute a 32 bit value to assign. */ | |
| 986 | − DCTELEM dcval = (DCTELEM) (d0 << PASS1_BITS); | |
| 987 | − register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000); | |
| 988 | − | |
| 989 | − idataptr[0] = v; | |
| 990 | − idataptr[1] = v; | |
| 991 | − } | |
| 992 | − | |
| 993 | − dataptr += DCTSTRIDE; /* advance pointer to next row */ | |
| 994 | − continue; | |
| 995 | − } | |
| 996 | − | |
| 997 | − /* Even part: reverse the even part of the forward DCT. */ | |
| 998 | − /* The rotator is sqrt(2)*c(-6). */ | |
| 999 | − if (d6) { | |
| 1000 | − if (d2) { | |
| 1001 | − /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */ | |
| 1002 | − z1 = MULTIPLY(d2 + d6, FIX_0_541196100); | |
| 1003 | − tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); | |
| 1004 | − tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); | |
| 1005 | − | |
| 1006 | − tmp0 = (d0 + d4) << CONST_BITS; | |
| 1007 | − tmp1 = (d0 - d4) << CONST_BITS; | |
| 1008 | − | |
| 1009 | − tmp10 = tmp0 + tmp3; | |
| 1010 | − tmp13 = tmp0 - tmp3; | |
| 1011 | − tmp11 = tmp1 + tmp2; | |
| 1012 | − tmp12 = tmp1 - tmp2; | |
| 1013 | − } else { | |
| 1014 | − /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */ | |
| 1015 | − tmp2 = MULTIPLY(-d6, FIX_1_306562965); | |
| 1016 | − tmp3 = MULTIPLY(d6, FIX_0_541196100); | |
| 1017 | − | |
| 1018 | − tmp0 = (d0 + d4) << CONST_BITS; | |
| 1019 | − tmp1 = (d0 - d4) << CONST_BITS; | |
| 1020 | − | |
| 1021 | − tmp10 = tmp0 + tmp3; | |
| 1022 | − tmp13 = tmp0 - tmp3; | |
| 1023 | − tmp11 = tmp1 + tmp2; | |
| 1024 | − tmp12 = tmp1 - tmp2; | |
| 1025 | − } | |
| 1026 | − } else { | |
| 1027 | − if (d2) { | |
| 1028 | − /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */ | |
| 1029 | − tmp2 = MULTIPLY(d2, FIX_0_541196100); | |
| 1030 | − tmp3 = MULTIPLY(d2, FIX_1_306562965); | |
| 1031 | − | |
| 1032 | − tmp0 = (d0 + d4) << CONST_BITS; | |
| 1033 | − tmp1 = (d0 - d4) << CONST_BITS; | |
| 1034 | − | |
| 1035 | − tmp10 = tmp0 + tmp3; | |
| 1036 | − tmp13 = tmp0 - tmp3; | |
| 1037 | − tmp11 = tmp1 + tmp2; | |
| 1038 | − tmp12 = tmp1 - tmp2; | |
| 1039 | − } else { | |
| 1040 | − /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */ | |
| 1041 | − tmp10 = tmp13 = (d0 + d4) << CONST_BITS; | |
| 1042 | − tmp11 = tmp12 = (d0 - d4) << CONST_BITS; | |
| 1043 | − } | |
| 1044 | − } | |
| 1045 | − | |
| 1046 | − /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ | |
| 1047 | − | |
| 1048 | − dataptr[0] = (DCTELEM) DESCALE(tmp10, CONST_BITS-PASS1_BITS); | |
| 1049 | − dataptr[1] = (DCTELEM) DESCALE(tmp11, CONST_BITS-PASS1_BITS); | |
| 1050 | − dataptr[2] = (DCTELEM) DESCALE(tmp12, CONST_BITS-PASS1_BITS); | |
| 1051 | − dataptr[3] = (DCTELEM) DESCALE(tmp13, CONST_BITS-PASS1_BITS); | |
| 1052 | − | |
| 1053 | − dataptr += DCTSTRIDE; /* advance pointer to next row */ | |
| 1054 | − } | |
| 1055 | − | |
| 1056 | − /* Pass 2: process columns. */ | |
| 1057 | − /* Note that we must descale the results by a factor of 8 == 2**3, */ | |
| 1058 | − /* and also undo the PASS1_BITS scaling. */ | |
| 1059 | − | |
| 1060 | − dataptr = data; | |
| 1061 | − for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) { | |
| 1062 | − /* Columns of zeroes can be exploited in the same way as we did with rows. | |
| 1063 | − * However, the row calculation has created many nonzero AC terms, so the | |
| 1064 | − * simplification applies less often (typically 5% to 10% of the time). | |
| 1065 | − * On machines with very fast multiplication, it's possible that the | |
| 1066 | − * test takes more time than it's worth. In that case this section | |
| 1067 | − * may be commented out. | |
| 1068 | − */ | |
| 1069 | − | |
| 1070 | − d0 = dataptr[DCTSTRIDE*0]; | |
| 1071 | − d2 = dataptr[DCTSTRIDE*1]; | |
| 1072 | − d4 = dataptr[DCTSTRIDE*2]; | |
| 1073 | − d6 = dataptr[DCTSTRIDE*3]; | |
| 1074 | − | |
| 1075 | − /* Even part: reverse the even part of the forward DCT. */ | |
| 1076 | − /* The rotator is sqrt(2)*c(-6). */ | |
| 1077 | − if (d6) { | |
| 1078 | − if (d2) { | |
| 1079 | − /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */ | |
| 1080 | − z1 = MULTIPLY(d2 + d6, FIX_0_541196100); | |
| 1081 | − tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); | |
| 1082 | − tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); | |
| 1083 | − | |
| 1084 | − tmp0 = (d0 + d4) << CONST_BITS; | |
| 1085 | − tmp1 = (d0 - d4) << CONST_BITS; | |
| 1086 | − | |
| 1087 | − tmp10 = tmp0 + tmp3; | |
| 1088 | − tmp13 = tmp0 - tmp3; | |
| 1089 | − tmp11 = tmp1 + tmp2; | |
| 1090 | − tmp12 = tmp1 - tmp2; | |
| 1091 | − } else { | |
| 1092 | − /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */ | |
| 1093 | − tmp2 = MULTIPLY(-d6, FIX_1_306562965); | |
| 1094 | − tmp3 = MULTIPLY(d6, FIX_0_541196100); | |
| 1095 | − | |
| 1096 | − tmp0 = (d0 + d4) << CONST_BITS; | |
| 1097 | − tmp1 = (d0 - d4) << CONST_BITS; | |
| 1098 | − | |
| 1099 | − tmp10 = tmp0 + tmp3; | |
| 1100 | − tmp13 = tmp0 - tmp3; | |
| 1101 | − tmp11 = tmp1 + tmp2; | |
| 1102 | − tmp12 = tmp1 - tmp2; | |
| 1103 | − } | |
| 1104 | − } else { | |
| 1105 | − if (d2) { | |
| 1106 | − /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */ | |
| 1107 | − tmp2 = MULTIPLY(d2, FIX_0_541196100); | |
| 1108 | − tmp3 = MULTIPLY(d2, FIX_1_306562965); | |
| 1109 | − | |
| 1110 | − tmp0 = (d0 + d4) << CONST_BITS; | |
| 1111 | − tmp1 = (d0 - d4) << CONST_BITS; | |
| 1112 | − | |
| 1113 | − tmp10 = tmp0 + tmp3; | |
| 1114 | − tmp13 = tmp0 - tmp3; | |
| 1115 | − tmp11 = tmp1 + tmp2; | |
| 1116 | − tmp12 = tmp1 - tmp2; | |
| 1117 | − } else { | |
| 1118 | − /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */ | |
| 1119 | − tmp10 = tmp13 = (d0 + d4) << CONST_BITS; | |
| 1120 | − tmp11 = tmp12 = (d0 - d4) << CONST_BITS; | |
| 1121 | − } | |
| 1122 | − } | |
| 1123 | − | |
| 1124 | − /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ | |
| 1125 | − | |
| 1126 | − dataptr[DCTSTRIDE*0] = tmp10 >> (CONST_BITS+PASS1_BITS+3); | |
| 1127 | − dataptr[DCTSTRIDE*1] = tmp11 >> (CONST_BITS+PASS1_BITS+3); | |
| 1128 | − dataptr[DCTSTRIDE*2] = tmp12 >> (CONST_BITS+PASS1_BITS+3); | |
| 1129 | − dataptr[DCTSTRIDE*3] = tmp13 >> (CONST_BITS+PASS1_BITS+3); | |
| 1130 | − | |
| 1131 | − dataptr++; /* advance pointer to next column */ | |
| 1132 | − } | |
| 1133 | −} | |
| 1134 | − | |
| 1135 | −void ff_j_rev_dct2(DCTBLOCK data){ | |
| 1136 | − int d00, d01, d10, d11; | |
| 1137 | − | |
| 1138 | − data[0] += 4; | |
| 1139 | − d00 = data[0+0*DCTSTRIDE] + data[1+0*DCTSTRIDE]; | |
| 1140 | − d01 = data[0+0*DCTSTRIDE] - data[1+0*DCTSTRIDE]; | |
| 1141 | − d10 = data[0+1*DCTSTRIDE] + data[1+1*DCTSTRIDE]; | |
| 1142 | − d11 = data[0+1*DCTSTRIDE] - data[1+1*DCTSTRIDE]; | |
| 1143 | − | |
| 1144 | − data[0+0*DCTSTRIDE]= (d00 + d10)>>3; | |
| 1145 | − data[1+0*DCTSTRIDE]= (d01 + d11)>>3; | |
| 1146 | − data[0+1*DCTSTRIDE]= (d00 - d10)>>3; | |
| 1147 | − data[1+1*DCTSTRIDE]= (d01 - d11)>>3; | |
| 1148 | −} | |
| 1149 | − | |
| 1150 | −void ff_j_rev_dct1(DCTBLOCK data){ | |
| 1151 | − data[0] = (data[0] + 4)>>3; | |
| 1152 | −} | |
| 1153 | − | |
| 1154 | −#undef FIX | |
| 1155 | −#undef CONST_BITS | |
| @@ -158,7 +158,6 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, · 157 unmodified lines | ||
| 158 | 158 | ff_thread_finish_setup(avctx); |
| 159 | 159 | |
| 160 | 160 | ctx->dec_params.cp_limit_decoding = NO_LIMITATION; |
| 161 | − ctx->dec_params.cp_reduce = avctx->lowres; | |
| 162 | 161 | // Tie decoder with decoding parameters |
| 163 | 162 | opj_setup_decoder(dec, &ctx->dec_params); |
| 164 | 163 | stream = opj_cio_open((opj_common_ptr)dec, buf, buf_size); |
| @@ -219,7 +218,6 @@ AVCodec ff_libopenjpeg_decoder = { · 54 unmodified lines | ||
| 219 | 218 | .close = libopenjpeg_decode_close, |
| 220 | 219 | .decode = libopenjpeg_decode_frame, |
| 221 | 220 | .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS, |
| 222 | − .max_lowres = 5, | |
| 223 | 221 | .long_name = NULL_IF_CONFIG_SMALL("OpenJPEG based JPEG 2000 decoder"), |
| 224 | 222 | .init_thread_copy = ONLY_IF_THREADS_ENABLED(libopenjpeg_decode_init_thread_copy), |
| 225 | 223 | }; |
| @@ -161,6 +161,5 @@ AVCodec ff_mjpegb_decoder = { · 160 unmodified lines | ||
| 161 | 161 | .close = ff_mjpeg_decode_end, |
| 162 | 162 | .decode = mjpegb_decode_frame, |
| 163 | 163 | .capabilities = CODEC_CAP_DR1, |
| 164 | − .max_lowres = 3, | |
| 165 | 164 | .long_name = NULL_IF_CONFIG_SMALL("Apple MJPEG-B"), |
| 166 | 165 | }; |
| @@ -796,21 +796,6 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, · 795 unmodified lines | ||
| 796 | 796 | return 0; |
| 797 | 797 | } |
| 798 | 798 | |
| 799 | −static av_always_inline void mjpeg_copy_block(uint8_t *dst, const uint8_t *src, | |
| 800 | − int linesize, int lowres) | |
| 801 | −{ | |
| 802 | − switch (lowres) { | |
| 803 | − case 0: copy_block8(dst, src, linesize, linesize, 8); | |
| 804 | − break; | |
| 805 | − case 1: copy_block4(dst, src, linesize, linesize, 4); | |
| 806 | − break; | |
| 807 | − case 2: copy_block2(dst, src, linesize, linesize, 2); | |
| 808 | − break; | |
| 809 | − case 3: *dst = *src; | |
| 810 | − break; | |
| 811 | − } | |
| 812 | −} | |
| 813 | − | |
| 814 | 799 | static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, |
| 815 | 800 | int Al, const uint8_t *mb_bitmask, |
| 816 | 801 | const AVFrame *reference) |
| @@ -869,16 +854,16 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, · 52 unmodified lines | ||
| 869 | 854 | x = 0; |
| 870 | 855 | y = 0; |
| 871 | 856 | for (j = 0; j < n; j++) { |
| 872 | − block_offset = (((linesize[c] * (v * mb_y + y) * 8) + | |
| 873 | − (h * mb_x + x) * 8) >> s->avctx->lowres); | |
| 857 | + block_offset = ((linesize[c] * (v * mb_y + y) * 8) + | |
| 858 | + (h * mb_x + x) * 8); | |
| 874 | 859 | |
| 875 | 860 | if (s->interlaced && s->bottom_field) |
| 876 | 861 | block_offset += linesize[c] >> 1; |
| 877 | 862 | ptr = data[c] + block_offset; |
| 878 | 863 | if (!s->progressive) { |
| 879 | 864 | if (copy_mb) |
| 880 | − mjpeg_copy_block(ptr, reference_data[c] + block_offset, | |
| 881 | − linesize[c], s->avctx->lowres); | |
| 865 | + copy_block8(ptr, reference_data[c] + block_offset, | |
| 866 | + linesize[c], linesize[c], 8); | |
| 882 | 867 | else { |
| 883 | 868 | s->dsp.clear_block(s->block); |
| 884 | 869 | if (decode_block(s, s->block, i, |
| @@ -968,7 +953,7 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, · 83 unmodified lines | ||
| 968 | 953 | } |
| 969 | 954 | |
| 970 | 955 | for (mb_y = 0; mb_y < s->mb_height; mb_y++) { |
| 971 | − int block_offset = (mb_y * linesize * 8 >> s->avctx->lowres); | |
| 956 | + int block_offset = mb_y * linesize * 8; | |
| 972 | 957 | uint8_t *ptr = data + block_offset; |
| 973 | 958 | int block_idx = mb_y * s->block_stride[c]; |
| 974 | 959 | DCTELEM (*block)[64] = &s->blocks[c][block_idx]; |
| @@ -993,11 +978,11 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, · 18 unmodified lines | ||
| 993 | 978 | |
| 994 | 979 | if (last_scan) { |
| 995 | 980 | if (copy_mb) { |
| 996 | − mjpeg_copy_block(ptr, reference_data + block_offset, | |
| 997 | − linesize, s->avctx->lowres); | |
| 981 | + copy_block8(ptr, reference_data + block_offset, | |
| 982 | + linesize, linesize, 8); | |
| 998 | 983 | } else { |
| 999 | 984 | s->dsp.idct_put(ptr, linesize, *block); |
| 1000 | − ptr += 8 >> s->avctx->lowres; | |
| 985 | + ptr += 8; | |
| 1001 | 986 | } |
| 1002 | 987 | } |
| 1003 | 988 | } |
| @@ -1667,7 +1652,6 @@ AVCodec ff_mjpeg_decoder = { · 663 unmodified lines | ||
| 1667 | 1652 | .close = ff_mjpeg_decode_end, |
| 1668 | 1653 | .decode = ff_mjpeg_decode_frame, |
| 1669 | 1654 | .capabilities = CODEC_CAP_DR1, |
| 1670 | − .max_lowres = 3, | |
| 1671 | 1655 | .long_name = NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"), |
| 1672 | 1656 | .priv_class = &mjpegdec_class, |
| 1673 | 1657 | }; |
| @@ -1681,6 +1665,5 @@ AVCodec ff_thp_decoder = { · 7 unmodified lines | ||
| 1681 | 1665 | .close = ff_mjpeg_decode_end, |
| 1682 | 1666 | .decode = ff_mjpeg_decode_frame, |
| 1683 | 1667 | .capabilities = CODEC_CAP_DR1, |
| 1684 | − .max_lowres = 3, | |
| 1685 | 1668 | .long_name = NULL_IF_CONFIG_SMALL("Nintendo Gamecube THP video"), |
| 1686 | 1669 | }; |
| @@ -1631,7 +1631,6 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y, · 1630 unmodified lines | ||
| 1631 | 1631 | const uint8_t **buf, int buf_size) |
| 1632 | 1632 | { |
| 1633 | 1633 | AVCodecContext *avctx = s->avctx; |
| 1634 | − const int lowres = s->avctx->lowres; | |
| 1635 | 1634 | const int field_pic = s->picture_structure != PICT_FRAME; |
| 1636 | 1635 | |
| 1637 | 1636 | s->resync_mb_x = |
| @@ -1752,14 +1751,14 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y, · 114 unmodified lines | ||
| 1752 | 1751 | } |
| 1753 | 1752 | } |
| 1754 | 1753 | |
| 1755 | − s->dest[0] += 16 >> lowres; | |
| 1756 | − s->dest[1] +=(16 >> lowres) >> s->chroma_x_shift; | |
| 1757 | − s->dest[2] +=(16 >> lowres) >> s->chroma_x_shift; | |
| 1754 | + s->dest[0] += 16; | |
| 1755 | + s->dest[1] += 16 >> s->chroma_x_shift; | |
| 1756 | + s->dest[2] += 16 >> s->chroma_x_shift; | |
| 1758 | 1757 | |
| 1759 | 1758 | ff_MPV_decode_mb(s, s->block); |
| 1760 | 1759 | |
| 1761 | 1760 | if (++s->mb_x >= s->mb_width) { |
| 1762 | − const int mb_size = 16 >> s->avctx->lowres; | |
| 1761 | + const int mb_size = 16; | |
| 1763 | 1762 | |
| 1764 | 1763 | ff_draw_horiz_band(s, mb_size*(s->mb_y >> field_pic), mb_size); |
| 1765 | 1764 | ff_MPV_report_decode_progress(s); |
| @@ -2508,7 +2507,6 @@ AVCodec ff_mpeg1video_decoder = { · 742 unmodified lines | ||
| 2508 | 2507 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | |
| 2509 | 2508 | CODEC_CAP_SLICE_THREADS, |
| 2510 | 2509 | .flush = flush, |
| 2511 | − .max_lowres = 3, | |
| 2512 | 2510 | .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"), |
| 2513 | 2511 | .update_thread_context = ONLY_IF_THREADS_ENABLED(mpeg_decode_update_thread_context) |
| 2514 | 2512 | }; |
| @@ -2525,7 +2523,6 @@ AVCodec ff_mpeg2video_decoder = { · 10 unmodified lines | ||
| 2525 | 2523 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | |
| 2526 | 2524 | CODEC_CAP_SLICE_THREADS, |
| 2527 | 2525 | .flush = flush, |
| 2528 | − .max_lowres = 3, | |
| 2529 | 2526 | .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"), |
| 2530 | 2527 | .profiles = NULL_IF_CONFIG_SMALL(mpeg2_video_profiles), |
| 2531 | 2528 | }; |
| @@ -2266,7 +2266,6 @@ AVCodec ff_mpeg4_decoder = { · 2265 unmodified lines | ||
| 2266 | 2266 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | |
| 2267 | 2267 | CODEC_CAP_FRAME_THREADS, |
| 2268 | 2268 | .flush = ff_mpeg_flush, |
| 2269 | − .max_lowres = 3, | |
| 2270 | 2269 | .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"), |
| 2271 | 2270 | .pix_fmts = ff_hwaccel_pixfmt_list_420, |
| 2272 | 2271 | .profiles = NULL_IF_CONFIG_SMALL(mpeg4_video_profiles), |
| @@ -1815,364 +1815,6 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict) · 1814 unmodified lines | ||
| 1815 | 1815 | } |
| 1816 | 1816 | } |
| 1817 | 1817 | |
| 1818 | −static inline int hpel_motion_lowres(MpegEncContext *s, | |
| 1819 | − uint8_t *dest, uint8_t *src, | |
| 1820 | − int field_based, int field_select, | |
| 1821 | − int src_x, int src_y, | |
| 1822 | − int width, int height, int stride, | |
| 1823 | − int h_edge_pos, int v_edge_pos, | |
| 1824 | − int w, int h, h264_chroma_mc_func *pix_op, | |
| 1825 | − int motion_x, int motion_y) | |
| 1826 | −{ | |
| 1827 | − const int lowres = s->avctx->lowres; | |
| 1828 | − const int op_index = FFMIN(lowres, 2); | |
| 1829 | − const int s_mask = (2 << lowres) - 1; | |
| 1830 | − int emu = 0; | |
| 1831 | − int sx, sy; | |
| 1832 | − | |
| 1833 | − if (s->quarter_sample) { | |
| 1834 | − motion_x /= 2; | |
| 1835 | − motion_y /= 2; | |
| 1836 | − } | |
| 1837 | − | |
| 1838 | − sx = motion_x & s_mask; | |
| 1839 | − sy = motion_y & s_mask; | |
| 1840 | − src_x += motion_x >> lowres + 1; | |
| 1841 | − src_y += motion_y >> lowres + 1; | |
| 1842 | − | |
| 1843 | − src += src_y * stride + src_x; | |
| 1844 | − | |
| 1845 | − if ((unsigned)src_x > FFMAX( h_edge_pos - (!!sx) - w, 0) || | |
| 1846 | − (unsigned)src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) { | |
| 1847 | − s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w + 1, | |
| 1848 | − (h + 1) << field_based, src_x, | |
| 1849 | − src_y << field_based, | |
| 1850 | − h_edge_pos, | |
| 1851 | − v_edge_pos); | |
| 1852 | − src = s->edge_emu_buffer; | |
| 1853 | − emu = 1; | |
| 1854 | − } | |
| 1855 | − | |
| 1856 | − sx = (sx << 2) >> lowres; | |
| 1857 | − sy = (sy << 2) >> lowres; | |
| 1858 | − if (field_select) | |
| 1859 | − src += s->linesize; | |
| 1860 | − pix_op[op_index](dest, src, stride, h, sx, sy); | |
| 1861 | − return emu; | |
| 1862 | −} | |
| 1863 | − | |
| 1864 | −/* apply one mpeg motion vector to the three components */ | |
| 1865 | −static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, | |
| 1866 | − uint8_t *dest_y, | |
| 1867 | − uint8_t *dest_cb, | |
| 1868 | − uint8_t *dest_cr, | |
| 1869 | − int field_based, | |
| 1870 | − int bottom_field, | |
| 1871 | − int field_select, | |
| 1872 | − uint8_t **ref_picture, | |
| 1873 | − h264_chroma_mc_func *pix_op, | |
| 1874 | − int motion_x, int motion_y, | |
| 1875 | − int h, int mb_y) | |
| 1876 | −{ | |
| 1877 | − uint8_t *ptr_y, *ptr_cb, *ptr_cr; | |
| 1878 | − int mx, my, src_x, src_y, uvsrc_x, uvsrc_y, uvlinesize, linesize, sx, sy, | |
| 1879 | − uvsx, uvsy; | |
| 1880 | − const int lowres = s->avctx->lowres; | |
| 1881 | − const int op_index = FFMIN(lowres, 2); | |
| 1882 | − const int block_s = 8>>lowres; | |
| 1883 | − const int s_mask = (2 << lowres) - 1; | |
| 1884 | − const int h_edge_pos = s->h_edge_pos >> lowres; | |
| 1885 | − const int v_edge_pos = s->v_edge_pos >> lowres; | |
| 1886 | − linesize = s->current_picture.f.linesize[0] << field_based; | |
| 1887 | − uvlinesize = s->current_picture.f.linesize[1] << field_based; | |
| 1888 | − | |
| 1889 | − // FIXME obviously not perfect but qpel will not work in lowres anyway | |
| 1890 | − if (s->quarter_sample) { | |
| 1891 | − motion_x /= 2; | |
| 1892 | − motion_y /= 2; | |
| 1893 | − } | |
| 1894 | − | |
| 1895 | − if (field_based) { | |
| 1896 | − motion_y += (bottom_field - field_select) * (1 << lowres - 1); | |
| 1897 | − } | |
| 1898 | − | |
| 1899 | − sx = motion_x & s_mask; | |
| 1900 | − sy = motion_y & s_mask; | |
| 1901 | − src_x = s->mb_x * 2 * block_s + (motion_x >> lowres + 1); | |
| 1902 | − src_y = (mb_y * 2 * block_s >> field_based) + (motion_y >> lowres + 1); | |
| 1903 | − | |
| 1904 | − if (s->out_format == FMT_H263) { | |
| 1905 | − uvsx = ((motion_x >> 1) & s_mask) | (sx & 1); | |
| 1906 | − uvsy = ((motion_y >> 1) & s_mask) | (sy & 1); | |
| 1907 | − uvsrc_x = src_x >> 1; | |
| 1908 | − uvsrc_y = src_y >> 1; | |
| 1909 | − } else if (s->out_format == FMT_H261) { | |
| 1910 | − // even chroma mv's are full pel in H261 | |
| 1911 | − mx = motion_x / 4; | |
| 1912 | − my = motion_y / 4; | |
| 1913 | − uvsx = (2 * mx) & s_mask; | |
| 1914 | − uvsy = (2 * my) & s_mask; | |
| 1915 | − uvsrc_x = s->mb_x * block_s + (mx >> lowres); | |
| 1916 | − uvsrc_y = mb_y * block_s + (my >> lowres); | |
| 1917 | − } else { | |
| 1918 | − mx = motion_x / 2; | |
| 1919 | − my = motion_y / 2; | |
| 1920 | − uvsx = mx & s_mask; | |
| 1921 | − uvsy = my & s_mask; | |
| 1922 | − uvsrc_x = s->mb_x * block_s + (mx >> lowres + 1); | |
| 1923 | − uvsrc_y = (mb_y * block_s >> field_based) + (my >> lowres + 1); | |
| 1924 | − } | |
| 1925 | − | |
| 1926 | − ptr_y = ref_picture[0] + src_y * linesize + src_x; | |
| 1927 | − ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x; | |
| 1928 | − ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x; | |
| 1929 | − | |
| 1930 | − if ((unsigned) src_x > FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) || | |
| 1931 | − (unsigned) src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) { | |
| 1932 | − s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, | |
| 1933 | − s->linesize, 17, 17 + field_based, | |
| 1934 | − src_x, src_y << field_based, h_edge_pos, | |
| 1935 | − v_edge_pos); | |
| 1936 | − ptr_y = s->edge_emu_buffer; | |
| 1937 | − if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { | |
| 1938 | − uint8_t *uvbuf = s->edge_emu_buffer + 18 * s->linesize; | |
| 1939 | − s->dsp.emulated_edge_mc(uvbuf , ptr_cb, s->uvlinesize, 9, | |
| 1940 | − 9 + field_based, | |
| 1941 | − uvsrc_x, uvsrc_y << field_based, | |
| 1942 | − h_edge_pos >> 1, v_edge_pos >> 1); | |
| 1943 | − s->dsp.emulated_edge_mc(uvbuf + 16, ptr_cr, s->uvlinesize, 9, | |
| 1944 | − 9 + field_based, | |
| 1945 | − uvsrc_x, uvsrc_y << field_based, | |
| 1946 | − h_edge_pos >> 1, v_edge_pos >> 1); | |
| 1947 | − ptr_cb = uvbuf; | |
| 1948 | − ptr_cr = uvbuf + 16; | |
| 1949 | − } | |
| 1950 | − } | |
| 1951 | − | |
| 1952 | − // FIXME use this for field pix too instead of the obnoxious hack which changes picture.f.data | |
| 1953 | − if (bottom_field) { | |
| 1954 | − dest_y += s->linesize; | |
| 1955 | − dest_cb += s->uvlinesize; | |
| 1956 | − dest_cr += s->uvlinesize; | |
| 1957 | − } | |
| 1958 | − | |
| 1959 | − if (field_select) { | |
| 1960 | − ptr_y += s->linesize; | |
| 1961 | − ptr_cb += s->uvlinesize; | |
| 1962 | − ptr_cr += s->uvlinesize; | |
| 1963 | − } | |
| 1964 | − | |
| 1965 | − sx = (sx << 2) >> lowres; | |
| 1966 | − sy = (sy << 2) >> lowres; | |
| 1967 | − pix_op[lowres - 1](dest_y, ptr_y, linesize, h, sx, sy); | |
| 1968 | − | |
| 1969 | − if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { | |
| 1970 | − uvsx = (uvsx << 2) >> lowres; | |
| 1971 | − uvsy = (uvsy << 2) >> lowres; | |
| 1972 | − pix_op[op_index](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift, | |
| 1973 | − uvsx, uvsy); | |
| 1974 | − pix_op[op_index](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift, | |
| 1975 | − uvsx, uvsy); | |
| 1976 | − } | |
| 1977 | − // FIXME h261 lowres loop filter | |
| 1978 | −} | |
| 1979 | − | |
| 1980 | −static inline void chroma_4mv_motion_lowres(MpegEncContext *s, | |
| 1981 | − uint8_t *dest_cb, uint8_t *dest_cr, | |
| 1982 | − uint8_t **ref_picture, | |
| 1983 | − h264_chroma_mc_func * pix_op, | |
| 1984 | − int mx, int my) | |
| 1985 | −{ | |
| 1986 | − const int lowres = s->avctx->lowres; | |
| 1987 | − const int op_index = FFMIN(lowres, 2); | |
| 1988 | − const int block_s = 8 >> lowres; | |
| 1989 | − const int s_mask = (2 << lowres) - 1; | |
| 1990 | − const int h_edge_pos = s->h_edge_pos >> lowres + 1; | |
| 1991 | − const int v_edge_pos = s->v_edge_pos >> lowres + 1; | |
| 1992 | − int emu = 0, src_x, src_y, offset, sx, sy; | |
| 1993 | − uint8_t *ptr; | |
| 1994 | − | |
| 1995 | − if (s->quarter_sample) { | |
| 1996 | − mx /= 2; | |
| 1997 | − my /= 2; | |
| 1998 | − } | |
| 1999 | − | |
| 2000 | − /* In case of 8X8, we construct a single chroma motion vector | |
| 2001 | − with a special rounding */ | |
| 2002 | − mx = ff_h263_round_chroma(mx); | |
| 2003 | − my = ff_h263_round_chroma(my); | |
| 2004 | − | |
| 2005 | − sx = mx & s_mask; | |
| 2006 | − sy = my & s_mask; | |
| 2007 | − src_x = s->mb_x * block_s + (mx >> lowres + 1); | |
| 2008 | − src_y = s->mb_y * block_s + (my >> lowres + 1); | |
| 2009 | − | |
| 2010 | − offset = src_y * s->uvlinesize + src_x; | |
| 2011 | − ptr = ref_picture[1] + offset; | |
| 2012 | − if (s->flags & CODEC_FLAG_EMU_EDGE) { | |
| 2013 | − if ((unsigned) src_x > FFMAX(h_edge_pos - (!!sx) - block_s, 0) || | |
| 2014 | − (unsigned) src_y > FFMAX(v_edge_pos - (!!sy) - block_s, 0)) { | |
| 2015 | − s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, | |
| 2016 | − 9, 9, src_x, src_y, h_edge_pos, v_edge_pos); | |
| 2017 | − ptr = s->edge_emu_buffer; | |
| 2018 | − emu = 1; | |
| 2019 | − } | |
| 2020 | − } | |
| 2021 | − sx = (sx << 2) >> lowres; | |
| 2022 | − sy = (sy << 2) >> lowres; | |
| 2023 | − pix_op[op_index](dest_cb, ptr, s->uvlinesize, block_s, sx, sy); | |
| 2024 | − | |
| 2025 | − ptr = ref_picture[2] + offset; | |
| 2026 | − if (emu) { | |
| 2027 | − s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, | |
| 2028 | − src_x, src_y, h_edge_pos, v_edge_pos); | |
| 2029 | − ptr = s->edge_emu_buffer; | |
| 2030 | − } | |
| 2031 | − pix_op[op_index](dest_cr, ptr, s->uvlinesize, block_s, sx, sy); | |
| 2032 | −} | |
| 2033 | − | |
| 2034 | −/** | |
| 2035 | − * motion compensation of a single macroblock | |
| 2036 | − * @param s context | |
| 2037 | − * @param dest_y luma destination pointer | |
| 2038 | − * @param dest_cb chroma cb/u destination pointer | |
| 2039 | − * @param dest_cr chroma cr/v destination pointer | |
| 2040 | − * @param dir direction (0->forward, 1->backward) | |
| 2041 | − * @param ref_picture array[3] of pointers to the 3 planes of the reference picture | |
| 2042 | − * @param pix_op halfpel motion compensation function (average or put normally) | |
| 2043 | − * the motion vectors are taken from s->mv and the MV type from s->mv_type | |
| 2044 | − */ | |
| 2045 | −static inline void MPV_motion_lowres(MpegEncContext *s, | |
| 2046 | − uint8_t *dest_y, uint8_t *dest_cb, | |
| 2047 | − uint8_t *dest_cr, | |
| 2048 | − int dir, uint8_t **ref_picture, | |
| 2049 | − h264_chroma_mc_func *pix_op) | |
| 2050 | −{ | |
| 2051 | − int mx, my; | |
| 2052 | − int mb_x, mb_y, i; | |
| 2053 | − const int lowres = s->avctx->lowres; | |
| 2054 | − const int block_s = 8 >>lowres; | |
| 2055 | − | |
| 2056 | − mb_x = s->mb_x; | |
| 2057 | − mb_y = s->mb_y; | |
| 2058 | − | |
| 2059 | − switch (s->mv_type) { | |
| 2060 | − case MV_TYPE_16X16: | |
| 2061 | − mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, | |
| 2062 | − 0, 0, 0, | |
| 2063 | − ref_picture, pix_op, | |
| 2064 | − s->mv[dir][0][0], s->mv[dir][0][1], | |
| 2065 | − 2 * block_s, mb_y); | |
| 2066 | − break; | |
| 2067 | − case MV_TYPE_8X8: | |
| 2068 | − mx = 0; | |
| 2069 | − my = 0; | |
| 2070 | − for (i = 0; i < 4; i++) { | |
| 2071 | − hpel_motion_lowres(s, dest_y + ((i & 1) + (i >> 1) * | |
| 2072 | − s->linesize) * block_s, | |
| 2073 | − ref_picture[0], 0, 0, | |
| 2074 | − (2 * mb_x + (i & 1)) * block_s, | |
| 2075 | − (2 * mb_y + (i >> 1)) * block_s, | |
| 2076 | − s->width, s->height, s->linesize, | |
| 2077 | − s->h_edge_pos >> lowres, s->v_edge_pos >> lowres, | |
| 2078 | − block_s, block_s, pix_op, | |
| 2079 | − s->mv[dir][i][0], s->mv[dir][i][1]); | |
| 2080 | − | |
| 2081 | − mx += s->mv[dir][i][0]; | |
| 2082 | − my += s->mv[dir][i][1]; | |
| 2083 | − } | |
| 2084 | − | |
| 2085 | − if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) | |
| 2086 | − chroma_4mv_motion_lowres(s, dest_cb, dest_cr, ref_picture, | |
| 2087 | − pix_op, mx, my); | |
| 2088 | − break; | |
| 2089 | − case MV_TYPE_FIELD: | |
| 2090 | − if (s->picture_structure == PICT_FRAME) { | |
| 2091 | − /* top field */ | |
| 2092 | − mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, | |
| 2093 | − 1, 0, s->field_select[dir][0], | |
| 2094 | − ref_picture, pix_op, | |
| 2095 | − s->mv[dir][0][0], s->mv[dir][0][1], | |
| 2096 | − block_s, mb_y); | |
| 2097 | − /* bottom field */ | |
| 2098 | − mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, | |
| 2099 | − 1, 1, s->field_select[dir][1], | |
| 2100 | − ref_picture, pix_op, | |
| 2101 | − s->mv[dir][1][0], s->mv[dir][1][1], | |
| 2102 | − block_s, mb_y); | |
| 2103 | − } else { | |
| 2104 | − if (s->picture_structure != s->field_select[dir][0] + 1 && | |
| 2105 | − s->pict_type != AV_PICTURE_TYPE_B && !s->first_field) { | |
| 2106 | − ref_picture = s->current_picture_ptr->f.data; | |
| 2107 | − | |
| 2108 | − } | |
| 2109 | − mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, | |
| 2110 | − 0, 0, s->field_select[dir][0], | |
| 2111 | − ref_picture, pix_op, | |
| 2112 | − s->mv[dir][0][0], | |
| 2113 | − s->mv[dir][0][1], 2 * block_s, mb_y >> 1); | |
| 2114 | − } | |
| 2115 | − break; | |
| 2116 | − case MV_TYPE_16X8: | |
| 2117 | − for (i = 0; i < 2; i++) { | |
| 2118 | − uint8_t **ref2picture; | |
| 2119 | − | |
| 2120 | − if (s->picture_structure == s->field_select[dir][i] + 1 || | |
| 2121 | − s->pict_type == AV_PICTURE_TYPE_B || s->first_field) { | |
| 2122 | − ref2picture = ref_picture; | |
| 2123 | − } else { | |
| 2124 | − ref2picture = s->current_picture_ptr->f.data; | |
| 2125 | − } | |
| 2126 | − | |
| 2127 | − mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, | |
| 2128 | − 0, 0, s->field_select[dir][i], | |
| 2129 | − ref2picture, pix_op, | |
| 2130 | − s->mv[dir][i][0], s->mv[dir][i][1] + | |
| 2131 | − 2 * block_s * i, block_s, mb_y >> 1); | |
| 2132 | − | |
| 2133 | − dest_y += 2 * block_s * s->linesize; | |
| 2134 | − dest_cb += (2 * block_s >> s->chroma_y_shift) * s->uvlinesize; | |
| 2135 | − dest_cr += (2 * block_s >> s->chroma_y_shift) * s->uvlinesize; | |
| 2136 | − } | |
| 2137 | − break; | |
| 2138 | − case MV_TYPE_DMV: | |
| 2139 | − if (s->picture_structure == PICT_FRAME) { | |
| 2140 | − for (i = 0; i < 2; i++) { | |
| 2141 | − int j; | |
| 2142 | − for (j = 0; j < 2; j++) { | |
| 2143 | − mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, | |
| 2144 | − 1, j, j ^ i, | |
| 2145 | − ref_picture, pix_op, | |
| 2146 | − s->mv[dir][2 * i + j][0], | |
| 2147 | − s->mv[dir][2 * i + j][1], | |
| 2148 | − block_s, mb_y); | |
| 2149 | − } | |
| 2150 | − pix_op = s->dsp.avg_h264_chroma_pixels_tab; | |
| 2151 | − } | |
| 2152 | − } else { | |
| 2153 | − for (i = 0; i < 2; i++) { | |
| 2154 | − mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, | |
| 2155 | − 0, 0, s->picture_structure != i + 1, | |
| 2156 | − ref_picture, pix_op, | |
| 2157 | − s->mv[dir][2 * i][0],s->mv[dir][2 * i][1], | |
| 2158 | − 2 * block_s, mb_y >> 1); | |
| 2159 | − | |
| 2160 | − // after put we make avg of the same block | |
| 2161 | − pix_op = s->dsp.avg_h264_chroma_pixels_tab; | |
| 2162 | − | |
| 2163 | − // opposite parity is always in the same | |
| 2164 | − // frame if this is second field | |
| 2165 | − if (!s->first_field) { | |
| 2166 | − ref_picture = s->current_picture_ptr->f.data; | |
| 2167 | − } | |
| 2168 | − } | |
| 2169 | − } | |
| 2170 | − break; | |
| 2171 | − default: | |
| 2172 | − assert(0); | |
| 2173 | − } | |
| 2174 | −} | |
| 2175 | − | |
| 2176 | 1818 | /** |
| 2177 | 1819 | * find the lowest MB row referenced in the MVs |
| 2178 | 1820 | */ |
| @@ -2282,7 +1924,7 @@ void ff_clean_intra_table_entries(MpegEncContext *s) · 103 unmodified lines | ||
| 2282 | 1924 | */ |
| 2283 | 1925 | static av_always_inline |
| 2284 | 1926 | void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64], |
| 2285 | − int lowres_flag, int is_mpeg12) | |
| 1927 | + int is_mpeg12) | |
| 2286 | 1928 | { |
| 2287 | 1929 | const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; |
| 2288 | 1930 | if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){ |
| @@ -2327,8 +1969,8 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64], · 38 unmodified lines | ||
| 2327 | 1969 | qpel_mc_func (*op_qpix)[16]; |
| 2328 | 1970 | const int linesize = s->current_picture.f.linesize[0]; //not s->linesize as this would be wrong for field pics |
| 2329 | 1971 | const int uvlinesize = s->current_picture.f.linesize[1]; |
| 2330 | − const int readable= s->pict_type != AV_PICTURE_TYPE_B || s->encoding || s->avctx->draw_horiz_band || lowres_flag; | |
| 2331 | − const int block_size= lowres_flag ? 8>>s->avctx->lowres : 8; | |
| 1972 | + const int readable= s->pict_type != AV_PICTURE_TYPE_B || s->encoding || s->avctx->draw_horiz_band; | |
| 1973 | + const int block_size = 8; | |
| 2332 | 1974 | |
| 2333 | 1975 | /* avoid copy if macroblock skipped in last frame too */ |
| 2334 | 1976 | /* skip only during decoding as we might trash the buffers during encoding a bit */ |
| @@ -2377,31 +2019,19 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64], · 42 unmodified lines | ||
| 2377 | 2019 | } |
| 2378 | 2020 | } |
| 2379 | 2021 | |
| 2380 | − if(lowres_flag){ | |
| 2381 | − h264_chroma_mc_func *op_pix = s->dsp.put_h264_chroma_pixels_tab; | |
| 2382 | − | |
| 2383 | − if (s->mv_dir & MV_DIR_FORWARD) { | |
| 2384 | − MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix); | |
| 2385 | − op_pix = s->dsp.avg_h264_chroma_pixels_tab; | |
| 2386 | − } | |
| 2387 | − if (s->mv_dir & MV_DIR_BACKWARD) { | |
| 2388 | − MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f.data, op_pix); | |
| 2389 | − } | |
| 2022 | + op_qpix= s->me.qpel_put; | |
| 2023 | + if ((!s->no_rounding) || s->pict_type==AV_PICTURE_TYPE_B){ | |
| 2024 | + op_pix = s->dsp.put_pixels_tab; | |
| 2390 | 2025 | }else{ |
| 2391 | − op_qpix= s->me.qpel_put; | |
| 2392 | − if ((!s->no_rounding) || s->pict_type==AV_PICTURE_TYPE_B){ | |
| 2393 | − op_pix = s->dsp.put_pixels_tab; | |
| 2394 | − }else{ | |
| 2395 | − op_pix = s->dsp.put_no_rnd_pixels_tab; | |
| 2396 | − } | |
| 2397 | − if (s->mv_dir & MV_DIR_FORWARD) { | |
| 2398 | − MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix, op_qpix); | |
| 2399 | − op_pix = s->dsp.avg_pixels_tab; | |
| 2400 | − op_qpix= s->me.qpel_avg; | |
| 2401 | − } | |
| 2402 | − if (s->mv_dir & MV_DIR_BACKWARD) { | |
| 2403 | − MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f.data, op_pix, op_qpix); | |
| 2404 | − } | |
| 2026 | + op_pix = s->dsp.put_no_rnd_pixels_tab; | |
| 2027 | + } | |
| 2028 | + if (s->mv_dir & MV_DIR_FORWARD) { | |
| 2029 | + MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix, op_qpix); | |
| 2030 | + op_pix = s->dsp.avg_pixels_tab; | |
| 2031 | + op_qpix= s->me.qpel_avg; | |
| 2032 | + } | |
| 2033 | + if (s->mv_dir & MV_DIR_BACKWARD) { | |
| 2034 | + MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f.data, op_pix, op_qpix); | |
| 2405 | 2035 | } |
| 2406 | 2036 | } |
| 2407 | 2037 | |
| @@ -2527,12 +2157,10 @@ skip_idct: · 119 unmodified lines | ||
| 2527 | 2157 | void ff_MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]){ |
| 2528 | 2158 | #if !CONFIG_SMALL |
| 2529 | 2159 | if(s->out_format == FMT_MPEG1) { |
| 2530 | − if(s->avctx->lowres) MPV_decode_mb_internal(s, block, 1, 1); | |
| 2531 | − else MPV_decode_mb_internal(s, block, 0, 1); | |
| 2160 | + MPV_decode_mb_internal(s, block, 1); | |
| 2532 | 2161 | } else |
| 2533 | 2162 | #endif |
| 2534 | − if(s->avctx->lowres) MPV_decode_mb_internal(s, block, 1, 0); | |
| 2535 | − else MPV_decode_mb_internal(s, block, 0, 0); | |
| 2163 | + MPV_decode_mb_internal(s, block, 0); | |
| 2536 | 2164 | } |
| 2537 | 2165 | |
| 2538 | 2166 | /** |
| @@ -2607,7 +2235,7 @@ void ff_draw_horiz_band(MpegEncContext *s, int y, int h){ · 68 unmodified lines | ||
| 2607 | 2235 | void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename |
| 2608 | 2236 | const int linesize = s->current_picture.f.linesize[0]; //not s->linesize as this would be wrong for field pics |
| 2609 | 2237 | const int uvlinesize = s->current_picture.f.linesize[1]; |
| 2610 | − const int mb_size= 4 - s->avctx->lowres; | |
| 2238 | + const int mb_size= 4; | |
| 2611 | 2239 | |
| 2612 | 2240 | s->block_index[0]= s->b8_stride*(s->mb_y*2 ) - 2 + s->mb_x*2; |
| 2613 | 2241 | s->block_index[1]= s->b8_stride*(s->mb_y*2 ) - 1 + s->mb_x*2; |
| @@ -785,7 +785,7 @@ extern const enum PixelFormat ff_pixfmt_list_420[]; · 784 unmodified lines | ||
| 785 | 785 | extern const enum PixelFormat ff_hwaccel_pixfmt_list_420[]; |
| 786 | 786 | |
| 787 | 787 | static inline void ff_update_block_index(MpegEncContext *s){ |
| 788 | − const int block_size= 8>>s->avctx->lowres; | |
| 788 | + const int block_size = 8; | |
| 789 | 789 | |
| 790 | 790 | s->block_index[0]+=2; |
| 791 | 791 | s->block_index[1]+=2; |
| @@ -1216,7 +1216,6 @@ AVCodec ff_msmpeg4v1_decoder = { · 1215 unmodified lines | ||
| 1216 | 1216 | .close = ff_h263_decode_end, |
| 1217 | 1217 | .decode = ff_h263_decode_frame, |
| 1218 | 1218 | .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
| 1219 | − .max_lowres = 3, | |
| 1220 | 1219 | .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"), |
| 1221 | 1220 | .pix_fmts = ff_pixfmt_list_420, |
| 1222 | 1221 | }; |
| @@ -1230,7 +1229,6 @@ AVCodec ff_msmpeg4v2_decoder = { · 7 unmodified lines | ||
| 1230 | 1229 | .close = ff_h263_decode_end, |
| 1231 | 1230 | .decode = ff_h263_decode_frame, |
| 1232 | 1231 | .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
| 1233 | − .max_lowres = 3, | |
| 1234 | 1232 | .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"), |
| 1235 | 1233 | .pix_fmts = ff_pixfmt_list_420, |
| 1236 | 1234 | }; |
| @@ -1244,7 +1242,6 @@ AVCodec ff_msmpeg4v3_decoder = { · 7 unmodified lines | ||
| 1244 | 1242 | .close = ff_h263_decode_end, |
| 1245 | 1243 | .decode = ff_h263_decode_frame, |
| 1246 | 1244 | .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
| 1247 | − .max_lowres = 3, | |
| 1248 | 1245 | .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"), |
| 1249 | 1246 | .pix_fmts = ff_pixfmt_list_420, |
| 1250 | 1247 | }; |
| @@ -1258,7 +1255,6 @@ AVCodec ff_wmv1_decoder = { · 7 unmodified lines | ||
| 1258 | 1255 | .close = ff_h263_decode_end, |
| 1259 | 1256 | .decode = ff_h263_decode_frame, |
| 1260 | 1257 | .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
| 1261 | − .max_lowres = 3, | |
| 1262 | 1258 | .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 7"), |
| 1263 | 1259 | .pix_fmts = ff_pixfmt_list_420, |
| 1264 | 1260 | }; |
| @@ -338,5 +338,4 @@ AVCodec ff_mxpeg_decoder = { · 337 unmodified lines | ||
| 338 | 338 | .close = mxpeg_decode_end, |
| 339 | 339 | .decode = mxpeg_decode_frame, |
| 340 | 340 | .capabilities = CODEC_CAP_DR1, |
| 341 | − .max_lowres = 3, | |
| 342 | 341 | }; |
| @@ -318,7 +318,6 @@ static const AVOption options[]={ · 317 unmodified lines | ||
| 318 | 318 | {"dts_hd_ma", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_PROFILE_DTS_HD_MA }, INT_MIN, INT_MAX, A|E, "profile"}, |
| 319 | 319 | {"level", NULL, OFFSET(level), AV_OPT_TYPE_INT, {.dbl = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"}, |
| 320 | 320 | {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"}, |
| 321 | −{"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, V|A|D}, | |
| 322 | 321 | {"skip_threshold", "frame skip threshold", OFFSET(frame_skip_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, |
| 323 | 322 | {"skip_factor", "frame skip factor", OFFSET(frame_skip_factor), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, |
| 324 | 323 | {"skip_exp", "frame skip exponent", OFFSET(frame_skip_exp), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, |
| @@ -179,7 +179,7 @@ void ff_dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx) · 178 unmodified lines | ||
| 179 | 179 | } |
| 180 | 180 | #endif //CONFIG_ENCODERS |
| 181 | 181 | |
| 182 | − if (avctx->lowres == 0 && avctx->bits_per_raw_sample <= 8) { | |
| 182 | + if (avctx->bits_per_raw_sample <= 8) { | |
| 183 | 183 | if ((avctx->idct_algo == FF_IDCT_AUTO) || |
| 184 | 184 | (avctx->idct_algo == FF_IDCT_ALTIVEC)) { |
| 185 | 185 | c->idct_put = ff_idct_put_altivec; |
| @@ -409,8 +409,7 @@ av_log(s->avctx, AV_LOG_DEBUG, "\n");*/ · 408 unmodified lines | ||
| 409 | 409 | // s->obmc=1; |
| 410 | 410 | // s->umvplus=1; |
| 411 | 411 | s->modified_quant=1; |
| 412 | − if(!s->avctx->lowres) | |
| 413 | − s->loop_filter=1; | |
| 412 | + s->loop_filter=1; | |
| 414 | 413 | |
| 415 | 414 | if(s->avctx->debug & FF_DEBUG_PICT_INFO){ |
| 416 | 415 | av_log(s->avctx, AV_LOG_INFO, "num:%5d x:%2d y:%2d type:%d qscale:%2d rnd:%d\n", |
| @@ -727,7 +726,6 @@ AVCodec ff_rv10_decoder = { · 310 unmodified lines | ||
| 727 | 726 | .close = rv10_decode_end, |
| 728 | 727 | .decode = rv10_decode_frame, |
| 729 | 728 | .capabilities = CODEC_CAP_DR1, |
| 730 | − .max_lowres = 3, | |
| 731 | 729 | .long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"), |
| 732 | 730 | .pix_fmts = ff_pixfmt_list_420, |
| 733 | 731 | }; |
| @@ -742,7 +740,6 @@ AVCodec ff_rv20_decoder = { · 8 unmodified lines | ||
| 742 | 740 | .decode = rv10_decode_frame, |
| 743 | 741 | .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY, |
| 744 | 742 | .flush = ff_mpeg_flush, |
| 745 | − .max_lowres = 3, | |
| 746 | 743 | .long_name = NULL_IF_CONFIG_SMALL("RealVideo 2.0"), |
| 747 | 744 | .pix_fmts = ff_pixfmt_list_420, |
| 748 | 745 | }; |
| @@ -102,7 +102,6 @@ AVCodec ff_sp5x_decoder = { · 101 unmodified lines | ||
| 102 | 102 | .close = ff_mjpeg_decode_end, |
| 103 | 103 | .decode = sp5x_decode_frame, |
| 104 | 104 | .capabilities = CODEC_CAP_DR1, |
| 105 | − .max_lowres = 3, | |
| 106 | 105 | .long_name = NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"), |
| 107 | 106 | }; |
| 108 | 107 | |
| @@ -143,8 +143,8 @@ unsigned avcodec_get_edge_width(void) · 142 unmodified lines | ||
| 143 | 143 | void avcodec_set_dimensions(AVCodecContext *s, int width, int height){ |
| 144 | 144 | s->coded_width = width; |
| 145 | 145 | s->coded_height= height; |
| 146 | − s->width = -((-width )>>s->lowres); | |
| 147 | − s->height= -((-height)>>s->lowres); | |
| 146 | + s->width = width; | |
| 147 | + s->height = height; | |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | #define INTERNAL_BUFFER_SIZE (32+1) |
| @@ -228,9 +228,8 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, · 77 unmodified lines | ||
| 228 | 228 | |
| 229 | 229 | *width = FFALIGN(*width , w_align); |
| 230 | 230 | *height= FFALIGN(*height, h_align); |
| 231 | − if(s->codec_id == CODEC_ID_H264 || s->lowres) | |
| 231 | + if (s->codec_id == CODEC_ID_H264) | |
| 232 | 232 | *height+=2; // some of the optimized chroma MC reads one line too much |
| 233 | − // which is also done in mpeg decoders with lowres > 0 | |
| 234 | 233 | |
| 235 | 234 | for (i = 0; i < 4; i++) |
| 236 | 235 | linesize_align[i] = STRIDE_ALIGN; |
| @@ -741,12 +740,6 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD · 504 unmodified lines | ||
| 741 | 740 | if (!HAVE_THREADS && !(codec->capabilities & CODEC_CAP_AUTO_THREADS)) |
| 742 | 741 | avctx->thread_count = 1; |
| 743 | 742 | |
| 744 | − if (avctx->codec->max_lowres < avctx->lowres) { | |
| 745 | − av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", | |
| 746 | − avctx->codec->max_lowres); | |
| 747 | − ret = AVERROR(EINVAL); | |
| 748 | − goto free_and_end; | |
| 749 | − } | |
| 750 | 743 | if (av_codec_is_encoder(avctx->codec)) { |
| 751 | 744 | int i; |
| 752 | 745 | if (avctx->codec->sample_fmts) { |
| @@ -479,7 +479,6 @@ AVCodec ff_wmv2_decoder = { · 478 unmodified lines | ||
| 479 | 479 | .close = wmv2_decode_end, |
| 480 | 480 | .decode = ff_h263_decode_frame, |
| 481 | 481 | .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
| 482 | − .max_lowres = 3, | |
| 483 | 482 | .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 8"), |
| 484 | 483 | .pix_fmts = ff_pixfmt_list_420, |
| 485 | 484 | }; |
| @@ -3121,7 +3121,7 @@ void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx) · 3120 unmodified lines | ||
| 3121 | 3121 | if (mm_flags & AV_CPU_FLAG_MMX) { |
| 3122 | 3122 | const int idct_algo = avctx->idct_algo; |
| 3123 | 3123 | |
| 3124 | − if (avctx->lowres == 0 && avctx->bits_per_raw_sample <= 8) { | |
| 3124 | + if (avctx->bits_per_raw_sample <= 8) { | |
| 3125 | 3125 | if (idct_algo == FF_IDCT_AUTO || idct_algo == FF_IDCT_SIMPLEMMX) { |
| 3126 | 3126 | c->idct_put = ff_simple_idct_put_mmx; |
| 3127 | 3127 | c->idct_add = ff_simple_idct_add_mmx; |