History

Remove lowres video decoding

This feature is complex, of questionable utility, and slows down normal decoding.

Mans Rullgard committed 14 years ago

Commit 2bcbd981 parent 95510be34 files · +56 −755Browse files

Unified · Split

34 files
  1. avconv.c +0 −6
  2. avplay.c +1 −5
  3. libavcodec/alpha/dsputil_alpha.c +1 −1
  4. libavcodec/arm/dsputil_init_arm.c +1 −1
  5. libavcodec/arm/dsputil_init_armv5te.c +1 −1
  6. libavcodec/arm/dsputil_init_armv6.c +1 −1
  7. libavcodec/arm/dsputil_init_neon.c +1 −1
  8. libavcodec/avcodec.h +3 −3
  9. libavcodec/dsputil.c +6 −54
  10. libavcodec/dsputil.h +0 −3
  11. libavcodec/dv.c +1 −7
  12. libavcodec/dvdec.c +1 −2
  13. libavcodec/error_resilience.c +1 −1
  14. libavcodec/flvdec.c +0 −1
  15. libavcodec/h261dec.c +0 −1
  16. libavcodec/h263dec.c +1 −2
  17. libavcodec/intrax8.c +0 −1
  18. libavcodec/jrevdct.c +0 −213
  19. libavcodec/libopenjpeg.c +0 −2
  20. libavcodec/mjpegbdec.c +0 −1
  21. libavcodec/mjpegdec.c +8 −25
  22. libavcodec/mpeg12.c +4 −7
  23. libavcodec/mpeg4videodec.c +0 −1
  24. libavcodec/mpegvideo.c +18 −390
  25. libavcodec/mpegvideo.h +1 −1
  26. libavcodec/msmpeg4.c +0 −4
  27. libavcodec/mxpegdec.c +0 −1
  28. libavcodec/options_table.h +0 −1
  29. libavcodec/ppc/dsputil_ppc.c +1 −1
  30. libavcodec/rv10.c +1 −4
  31. libavcodec/sp5xdec.c +0 −1
  32. libavcodec/utils.c +3 −10
  33. libavcodec/wmv2dec.c +0 −1
  34. libavcodec/x86/dsputil_mmx.c +1 −1
avconv.c+0−6
@@ -3527,12 +3527,6 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) · 3526 unmodified lines
3527 3527
3528 switch (dec->codec_type) {3528 switch (dec->codec_type) {
3529 case AVMEDIA_TYPE_VIDEO: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 ist->resample_height = dec->height;3530 ist->resample_height = dec->height;
3537 ist->resample_width = dec->width;3531 ist->resample_width = dec->width;
3538 ist->resample_pix_fmt = dec->pix_fmt;3532 ist->resample_pix_fmt = dec->pix_fmt;
avplay.c+1−5
@@ -244,7 +244,6 @@ static int step = 0; · 243 unmodified lines
244static int workaround_bugs = 1;244static int workaround_bugs = 1;
245static int fast = 0;245static int fast = 0;
246static int genpts = 0;246static int genpts = 0;
247static int lowres = 0;
248static int idct = FF_IDCT_AUTO;247static int idct = FF_IDCT_AUTO;
249static enum AVDiscard skip_frame = AVDISCARD_DEFAULT;248static enum AVDiscard skip_frame = AVDISCARD_DEFAULT;
250static enum AVDiscard skip_idct = AVDISCARD_DEFAULT;249static enum AVDiscard skip_idct = AVDISCARD_DEFAULT;
@@ -1298,7 +1297,7 @@ static void alloc_picture(void *opaque) · 1047 unmodified lines
1298 /* SDL allocates a buffer smaller than requested if the video1297 /* SDL allocates a buffer smaller than requested if the video
1299 * overlay hardware is unable to support the requested size. */1298 * overlay hardware is unable to support the requested size. */
1300 fprintf(stderr, "Error: the video system does not support an image\n"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 "to reduce the image size.\n", vp->width, vp->height );1301 "to reduce the image size.\n", vp->width, vp->height );
1303 do_exit();1302 do_exit();
1304 }1303 }
@@ -2185,14 +2184,12 @@ static int stream_component_open(VideoState *is, int stream_index) · 880 unmodified lines
2185 avctx->debug_mv = debug_mv;2184 avctx->debug_mv = debug_mv;
2186 avctx->debug = debug;2185 avctx->debug = debug;
2187 avctx->workaround_bugs = workaround_bugs;2186 avctx->workaround_bugs = workaround_bugs;
2188 avctx->lowres = lowres;
2189 avctx->idct_algo = idct;2187 avctx->idct_algo = idct;
2190 avctx->skip_frame = skip_frame;2188 avctx->skip_frame = skip_frame;
2191 avctx->skip_idct = skip_idct;2189 avctx->skip_idct = skip_idct;
2192 avctx->skip_loop_filter = skip_loop_filter;2190 avctx->skip_loop_filter = skip_loop_filter;
2193 avctx->error_concealment = error_concealment;2191 avctx->error_concealment = error_concealment;
2194 2192
2195 if (lowres) avctx->flags |= CODEC_FLAG_EMU_EDGE;
2196 if (fast) avctx->flags2 |= CODEC_FLAG2_FAST;2193 if (fast) avctx->flags2 |= CODEC_FLAG2_FAST;
2197 2194
2198 if (!av_dict_get(opts, "threads", NULL, 0))2195 if (!av_dict_get(opts, "threads", NULL, 0))
@@ -2979,7 +2976,6 @@ static const OptionDef options[] = { · 780 unmodified lines
2979 { "fast", OPT_BOOL | OPT_EXPERT, { (void*)&fast }, "non spec compliant optimizations", "" },2976 { "fast", OPT_BOOL | OPT_EXPERT, { (void*)&fast }, "non spec compliant optimizations", "" },
2980 { "genpts", OPT_BOOL | OPT_EXPERT, { (void*)&genpts }, "generate pts", "" },2977 { "genpts", OPT_BOOL | OPT_EXPERT, { (void*)&genpts }, "generate pts", "" },
2981 { "drp", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&decoder_reorder_pts }, "let decoder reorder pts 0=off 1=on -1=auto", ""},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 { "skiploop", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&skip_loop_filter }, "", "" },2979 { "skiploop", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&skip_loop_filter }, "", "" },
2984 { "skipframe", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&skip_frame }, "", "" },2980 { "skipframe", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&skip_frame }, "", "" },
2985 { "skipidct", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&skip_idct }, "", "" },2981 { "skipidct", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&skip_idct }, "", "" },
libavcodec/alpha/dsputil_alpha.c+1−1
@@ -336,7 +336,7 @@ void ff_dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx) · 335 unmodified lines
336 put_pixels_clamped_axp_p = c->put_pixels_clamped;336 put_pixels_clamped_axp_p = c->put_pixels_clamped;
337 add_pixels_clamped_axp_p = c->add_pixels_clamped;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 (avctx->idct_algo == FF_IDCT_AUTO ||340 (avctx->idct_algo == FF_IDCT_AUTO ||
341 avctx->idct_algo == FF_IDCT_SIMPLEALPHA)) {341 avctx->idct_algo == FF_IDCT_SIMPLEALPHA)) {
342 c->idct_put = ff_simple_idct_put_axp;342 c->idct_put = ff_simple_idct_put_axp;
libavcodec/arm/dsputil_init_arm.c+1−1
@@ -80,7 +80,7 @@ void ff_dsputil_init_arm(DSPContext* c, AVCodecContext *avctx) · 79 unmodified lines
80 ff_put_pixels_clamped = c->put_pixels_clamped;80 ff_put_pixels_clamped = c->put_pixels_clamped;
81 ff_add_pixels_clamped = c->add_pixels_clamped;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 if(avctx->idct_algo == FF_IDCT_AUTO ||84 if(avctx->idct_algo == FF_IDCT_AUTO ||
85 avctx->idct_algo == FF_IDCT_ARM){85 avctx->idct_algo == FF_IDCT_ARM){
86 c->idct_put = j_rev_dct_arm_put;86 c->idct_put = j_rev_dct_arm_put;
libavcodec/arm/dsputil_init_armv5te.c+1−1
@@ -29,7 +29,7 @@ void ff_prefetch_arm(void *mem, int stride, int h); · 28 unmodified lines
29 29
30av_cold void ff_dsputil_init_armv5te(DSPContext *c, AVCodecContext *avctx)30av_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 (avctx->idct_algo == FF_IDCT_AUTO ||33 (avctx->idct_algo == FF_IDCT_AUTO ||
34 avctx->idct_algo == FF_IDCT_SIMPLEARMV5TE)) {34 avctx->idct_algo == FF_IDCT_SIMPLEARMV5TE)) {
35 c->idct_put = ff_simple_idct_put_armv5te;35 c->idct_put = ff_simple_idct_put_armv5te;
libavcodec/arm/dsputil_init_armv6.c+1−1
@@ -74,7 +74,7 @@ av_cold void ff_dsputil_init_armv6(DSPContext *c, AVCodecContext *avctx) · 73 unmodified lines
74{74{
75 const int high_bit_depth = avctx->bits_per_raw_sample > 8;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 (avctx->idct_algo == FF_IDCT_AUTO ||78 (avctx->idct_algo == FF_IDCT_AUTO ||
79 avctx->idct_algo == FF_IDCT_SIMPLEARMV6)) {79 avctx->idct_algo == FF_IDCT_SIMPLEARMV6)) {
80 c->idct_put = ff_simple_idct_put_armv6;80 c->idct_put = ff_simple_idct_put_armv6;
libavcodec/arm/dsputil_init_neon.c+1−1
@@ -182,7 +182,7 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx) · 181 unmodified lines
182{182{
183 const int high_bit_depth = avctx->bits_per_raw_sample > 8;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 if (avctx->idct_algo == FF_IDCT_AUTO ||186 if (avctx->idct_algo == FF_IDCT_AUTO ||
187 avctx->idct_algo == FF_IDCT_SIMPLENEON) {187 avctx->idct_algo == FF_IDCT_SIMPLENEON) {
188 c->idct_put = ff_simple_idct_put_neon;188 c->idct_put = ff_simple_idct_put_neon;
libavcodec/avcodec.h+3−3
@@ -1394,7 +1394,7 @@ typedef struct AVCodecContext { · 1393 unmodified lines
1394 int width, height;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 * - encoding: unused1398 * - encoding: unused
1399 * - decoding: Set by user before init if known. Codec should override / dynamically change if needed.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 * - encoding: unused2586 * - encoding: unused
2587 * - decoding: Set by user.2587 * - decoding: Set by user.
2588 */2588 */
2589 int lowres;2589 attribute_deprecated int lowres;
2590 2590
2591 /**2591 /**
2592 * the picture in the bitstream2592 * the picture in the bitstream
@@ -2847,7 +2847,7 @@ typedef struct AVCodec { · 254 unmodified lines
2847 const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 02847 const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
2848 const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -12848 const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
2849 const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 02849 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 decoder2850 attribute_deprecated uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
2851 const AVClass *priv_class; ///< AVClass for the private context2851 const AVClass *priv_class; ///< AVClass for the private context
2852 const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}2852 const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
2853 2853
libavcodec/dsputil.c+6−54
@@ -2700,37 +2700,6 @@ static void ff_jref_idct_add(uint8_t *dest, int line_size, DCTELEM *block) · 2699 unmodified lines
2700 ff_add_pixels_clamped_c(block, dest, line_size);2700 ff_add_pixels_clamped_c(block, dest, line_size);
2701}2701}
2702 2702
2703static 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}
2708static 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
2714static 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}
2719static 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
2725static 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}
2729static 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
2734static void just_return(void *mem av_unused, int stride av_unused, int h av_unused) { return; }2703static void just_return(void *mem av_unused, int stride av_unused, int h av_unused) { return; }
2735 2704
2736/* init static data */2705/* init static data */
@@ -2797,28 +2766,12 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx) · 60 unmodified lines
2797 }2766 }
2798#endif //CONFIG_ENCODERS2767#endif //CONFIG_ENCODERS
2799 2768
2800 if(avctx->lowres==1){2769 if (avctx->bits_per_raw_sample == 10) {
2801 c->idct_put= ff_jref_idct4_put;2770 c->idct_put = ff_simple_idct_put_10;
2802 c->idct_add= ff_jref_idct4_add;2771 c->idct_add = ff_simple_idct_add_10;
2803 c->idct = ff_j_rev_dct4;2772 c->idct = ff_simple_idct_10;
2804 c->idct_permutation_type= FF_NO_IDCT_PERM;2773 c->idct_permutation_type = FF_NO_IDCT_PERM;
2805 }else if(avctx->lowres==2){2774 } else {
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 {
2822 if(avctx->idct_algo==FF_IDCT_INT){2775 if(avctx->idct_algo==FF_IDCT_INT){
2823 c->idct_put= ff_jref_idct_put;2776 c->idct_put= ff_jref_idct_put;
2824 c->idct_add= ff_jref_idct_add;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 c->idct = ff_simple_idct_8;2802 c->idct = ff_simple_idct_8;
2850 c->idct_permutation_type= FF_NO_IDCT_PERM;2803 c->idct_permutation_type= FF_NO_IDCT_PERM;
2851 }2804 }
2852 }
2853 }2805 }
2854 2806
2855 c->diff_pixels = diff_pixels_c;2807 c->diff_pixels = diff_pixels_c;
libavcodec/dsputil.h+0−3
@@ -46,9 +46,6 @@ void ff_fdct248_islow_8(DCTELEM *data); · 45 unmodified lines
46void ff_fdct248_islow_10(DCTELEM *data);46void ff_fdct248_islow_10(DCTELEM *data);
47 47
48void ff_j_rev_dct (DCTELEM *data);48void ff_j_rev_dct (DCTELEM *data);
49void ff_j_rev_dct4 (DCTELEM *data);
50void ff_j_rev_dct2 (DCTELEM *data);
51void ff_j_rev_dct1 (DCTELEM *data);
52void ff_wmv2_idct_c(DCTELEM *data);49void ff_wmv2_idct_c(DCTELEM *data);
53 50
54void ff_fdct_mmx(DCTELEM *block);51void ff_fdct_mmx(DCTELEM *block);
libavcodec/dv.c+1−7
@@ -311,13 +311,7 @@ av_cold int ff_dvvideo_init(AVCodecContext *avctx) · 310 unmodified lines
311 /* 248DCT setup */311 /* 248DCT setup */
312 s->fdct[1] = dsp.fdct248;312 s->fdct[1] = dsp.fdct248;
313 s->idct_put[1] = ff_simple_idct248_put; // FIXME: need to add it to DSP313 s->idct_put[1] = ff_simple_idct248_put; // FIXME: need to add it to DSP
314 if (avctx->lowres){314 memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64);
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);
321 315
322 avctx->coded_frame = &s->picture;316 avctx->coded_frame = &s->picture;
323 s->avctx = avctx;317 s->avctx = avctx;
libavcodec/dvdec.c+1−2
@@ -144,7 +144,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg) · 143 unmodified lines
144 LOCAL_ALIGNED_16(DCTELEM, sblock, [5*DV_MAX_BPM], [64]);144 LOCAL_ALIGNED_16(DCTELEM, sblock, [5*DV_MAX_BPM], [64]);
145 LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [ 80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */145 LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [ 80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */
146 LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [5*80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */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 int is_field_mode[5];148 int is_field_mode[5];
149 149
150 assert((((int)mb_bit_buffer) & 7) == 0);150 assert((((int)mb_bit_buffer) & 7) == 0);
@@ -381,6 +381,5 @@ AVCodec ff_dvvideo_decoder = { · 230 unmodified lines
381 .close = dvvideo_close,381 .close = dvvideo_close,
382 .decode = dvvideo_decode_frame,382 .decode = dvvideo_decode_frame,
383 .capabilities = CODEC_CAP_DR1 | CODEC_CAP_SLICE_THREADS,383 .capabilities = CODEC_CAP_DR1 | CODEC_CAP_SLICE_THREADS,
384 .max_lowres = 3,
385 .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),384 .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
386};385};
libavcodec/error_resilience.c+1−1
@@ -891,7 +891,7 @@ void ff_er_frame_end(MpegEncContext *s) · 890 unmodified lines
891 891
892 /* We do not support ER of field pictures yet,892 /* We do not support ER of field pictures yet,
893 * though it should not crash if enabled. */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 s->avctx->hwaccel ||895 s->avctx->hwaccel ||
896 s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU ||896 s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU ||
897 s->picture_structure != PICT_FRAME ||897 s->picture_structure != PICT_FRAME ||
libavcodec/flvdec.c+0−1
@@ -127,7 +127,6 @@ AVCodec ff_flv_decoder = { · 126 unmodified lines
127 .close = ff_h263_decode_end,127 .close = ff_h263_decode_end,
128 .decode = ff_h263_decode_frame,128 .decode = ff_h263_decode_frame,
129 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,129 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
130 .max_lowres = 3,
131 .long_name = NULL_IF_CONFIG_SMALL("Flash Video (FLV) / Sorenson Spark / Sorenson H.263"),130 .long_name = NULL_IF_CONFIG_SMALL("Flash Video (FLV) / Sorenson Spark / Sorenson H.263"),
132 .pix_fmts = ff_pixfmt_list_420,131 .pix_fmts = ff_pixfmt_list_420,
133};132};
libavcodec/h261dec.c+0−1
@@ -651,6 +651,5 @@ AVCodec ff_h261_decoder = { · 650 unmodified lines
651 .close = h261_decode_end,651 .close = h261_decode_end,
652 .decode = h261_decode_frame,652 .decode = h261_decode_frame,
653 .capabilities = CODEC_CAP_DR1,653 .capabilities = CODEC_CAP_DR1,
654 .max_lowres = 3,
655 .long_name = NULL_IF_CONFIG_SMALL("H.261"),654 .long_name = NULL_IF_CONFIG_SMALL("H.261"),
656};655};
libavcodec/h263dec.c+1−2
@@ -149,7 +149,7 @@ static int get_consumed_bytes(MpegEncContext *s, int buf_size){ · 148 unmodified lines
149 149
150static int decode_slice(MpegEncContext *s){150static int decode_slice(MpegEncContext *s){
151 const int part_mask= s->partitioned_frame ? (ER_AC_END|ER_AC_ERROR) : 0x7F;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 s->last_resync_gb= s->gb;153 s->last_resync_gb= s->gb;
154 s->first_slice_line= 1;154 s->first_slice_line= 1;
155 155
@@ -745,7 +745,6 @@ AVCodec ff_h263_decoder = { · 589 unmodified lines
745 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 |745 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 |
746 CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,746 CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
747 .flush = ff_mpeg_flush,747 .flush = ff_mpeg_flush,
748 .max_lowres = 3,
749 .long_name = NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"),748 .long_name = NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"),
750 .pix_fmts = ff_hwaccel_pixfmt_list_420,749 .pix_fmts = ff_hwaccel_pixfmt_list_420,
751};750};
libavcodec/intrax8.c+0−1
@@ -716,7 +716,6 @@ av_cold void ff_intrax8_common_end(IntraX8Context * w) · 715 unmodified lines
716 * The parent codec must call MPV_frame_start(), ff_er_frame_start() before calling this function.716 * The parent codec must call MPV_frame_start(), ff_er_frame_start() before calling this function.
717 * The parent codec must call ff_er_frame_end(), MPV_frame_end() after calling this function.717 * The parent codec must call ff_er_frame_end(), MPV_frame_end() after calling this function.
718 * This function does not use MPV_decode_mb().718 * This function does not use MPV_decode_mb().
719 * lowres decoding is theoretically impossible.
720 * @param w pointer to IntraX8Context719 * @param w pointer to IntraX8Context
721 * @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.720 * @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.
722 * @param quant_offset offset away from zero721 * @param quant_offset offset away from zero
libavcodec/jrevdct.c+0−213
@@ -940,216 +940,3 @@ void ff_j_rev_dct(DCTBLOCK data) · 939 unmodified lines
940 dataptr++; /* advance pointer to next column */940 dataptr++; /* advance pointer to next column */
941 }941 }
942}942}
943
944#undef DCTSIZE
945#define DCTSIZE 4
946#define DCTSTRIDE 8
947
948void 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
1135void 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
1150void ff_j_rev_dct1(DCTBLOCK data){
1151 data[0] = (data[0] + 4)>>3;
1152}
1153
1154#undef FIX
1155#undef CONST_BITS
libavcodec/libopenjpeg.c+0−2
@@ -158,7 +158,6 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, · 157 unmodified lines
158 ff_thread_finish_setup(avctx);158 ff_thread_finish_setup(avctx);
159 159
160 ctx->dec_params.cp_limit_decoding = NO_LIMITATION;160 ctx->dec_params.cp_limit_decoding = NO_LIMITATION;
161 ctx->dec_params.cp_reduce = avctx->lowres;
162 // Tie decoder with decoding parameters161 // Tie decoder with decoding parameters
163 opj_setup_decoder(dec, &ctx->dec_params);162 opj_setup_decoder(dec, &ctx->dec_params);
164 stream = opj_cio_open((opj_common_ptr)dec, buf, buf_size);163 stream = opj_cio_open((opj_common_ptr)dec, buf, buf_size);
@@ -219,7 +218,6 @@ AVCodec ff_libopenjpeg_decoder = { · 54 unmodified lines
219 .close = libopenjpeg_decode_close,218 .close = libopenjpeg_decode_close,
220 .decode = libopenjpeg_decode_frame,219 .decode = libopenjpeg_decode_frame,
221 .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,220 .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
222 .max_lowres = 5,
223 .long_name = NULL_IF_CONFIG_SMALL("OpenJPEG based JPEG 2000 decoder"),221 .long_name = NULL_IF_CONFIG_SMALL("OpenJPEG based JPEG 2000 decoder"),
224 .init_thread_copy = ONLY_IF_THREADS_ENABLED(libopenjpeg_decode_init_thread_copy),222 .init_thread_copy = ONLY_IF_THREADS_ENABLED(libopenjpeg_decode_init_thread_copy),
225};223};
libavcodec/mjpegbdec.c+0−1
@@ -161,6 +161,5 @@ AVCodec ff_mjpegb_decoder = { · 160 unmodified lines
161 .close = ff_mjpeg_decode_end,161 .close = ff_mjpeg_decode_end,
162 .decode = mjpegb_decode_frame,162 .decode = mjpegb_decode_frame,
163 .capabilities = CODEC_CAP_DR1,163 .capabilities = CODEC_CAP_DR1,
164 .max_lowres = 3,
165 .long_name = NULL_IF_CONFIG_SMALL("Apple MJPEG-B"),164 .long_name = NULL_IF_CONFIG_SMALL("Apple MJPEG-B"),
166};165};
libavcodec/mjpegdec.c+8−25
@@ -796,21 +796,6 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, · 795 unmodified lines
796 return 0;796 return 0;
797}797}
798 798
799static 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
814static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,799static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
815 int Al, const uint8_t *mb_bitmask,800 int Al, const uint8_t *mb_bitmask,
816 const AVFrame *reference)801 const AVFrame *reference)
@@ -869,16 +854,16 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, · 52 unmodified lines
869 x = 0;854 x = 0;
870 y = 0;855 y = 0;
871 for (j = 0; j < n; j++) {856 for (j = 0; j < n; j++) {
872 block_offset = (((linesize[c] * (v * mb_y + y) * 8) +857 block_offset = ((linesize[c] * (v * mb_y + y) * 8) +
873 (h * mb_x + x) * 8) >> s->avctx->lowres);858 (h * mb_x + x) * 8);
874 859
875 if (s->interlaced && s->bottom_field)860 if (s->interlaced && s->bottom_field)
876 block_offset += linesize[c] >> 1;861 block_offset += linesize[c] >> 1;
877 ptr = data[c] + block_offset;862 ptr = data[c] + block_offset;
878 if (!s->progressive) {863 if (!s->progressive) {
879 if (copy_mb)864 if (copy_mb)
880 mjpeg_copy_block(ptr, reference_data[c] + block_offset,865 copy_block8(ptr, reference_data[c] + block_offset,
881 linesize[c], s->avctx->lowres);866 linesize[c], linesize[c], 8);
882 else {867 else {
883 s->dsp.clear_block(s->block);868 s->dsp.clear_block(s->block);
884 if (decode_block(s, s->block, i,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 for (mb_y = 0; mb_y < s->mb_height; mb_y++) {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 uint8_t *ptr = data + block_offset;957 uint8_t *ptr = data + block_offset;
973 int block_idx = mb_y * s->block_stride[c];958 int block_idx = mb_y * s->block_stride[c];
974 DCTELEM (*block)[64] = &s->blocks[c][block_idx];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 if (last_scan) {979 if (last_scan) {
995 if (copy_mb) {980 if (copy_mb) {
996 mjpeg_copy_block(ptr, reference_data + block_offset,981 copy_block8(ptr, reference_data + block_offset,
997 linesize, s->avctx->lowres);982 linesize, linesize, 8);
998 } else {983 } else {
999 s->dsp.idct_put(ptr, linesize, *block);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 .close = ff_mjpeg_decode_end,1652 .close = ff_mjpeg_decode_end,
1668 .decode = ff_mjpeg_decode_frame,1653 .decode = ff_mjpeg_decode_frame,
1669 .capabilities = CODEC_CAP_DR1,1654 .capabilities = CODEC_CAP_DR1,
1670 .max_lowres = 3,
1671 .long_name = NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"),1655 .long_name = NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"),
1672 .priv_class = &mjpegdec_class,1656 .priv_class = &mjpegdec_class,
1673};1657};
@@ -1681,6 +1665,5 @@ AVCodec ff_thp_decoder = { · 7 unmodified lines
1681 .close = ff_mjpeg_decode_end,1665 .close = ff_mjpeg_decode_end,
1682 .decode = ff_mjpeg_decode_frame,1666 .decode = ff_mjpeg_decode_frame,
1683 .capabilities = CODEC_CAP_DR1,1667 .capabilities = CODEC_CAP_DR1,
1684 .max_lowres = 3,
1685 .long_name = NULL_IF_CONFIG_SMALL("Nintendo Gamecube THP video"),1668 .long_name = NULL_IF_CONFIG_SMALL("Nintendo Gamecube THP video"),
1686};1669};
libavcodec/mpeg12.c+4−7
@@ -1631,7 +1631,6 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y, · 1630 unmodified lines
1631 const uint8_t **buf, int buf_size)1631 const uint8_t **buf, int buf_size)
1632{1632{
1633 AVCodecContext *avctx = s->avctx;1633 AVCodecContext *avctx = s->avctx;
1634 const int lowres = s->avctx->lowres;
1635 const int field_pic = s->picture_structure != PICT_FRAME;1634 const int field_pic = s->picture_structure != PICT_FRAME;
1636 1635
1637 s->resync_mb_x =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;1754 s->dest[0] += 16;
1756 s->dest[1] +=(16 >> lowres) >> s->chroma_x_shift;1755 s->dest[1] += 16 >> s->chroma_x_shift;
1757 s->dest[2] +=(16 >> lowres) >> s->chroma_x_shift;1756 s->dest[2] += 16 >> s->chroma_x_shift;
1758 1757
1759 ff_MPV_decode_mb(s, s->block);1758 ff_MPV_decode_mb(s, s->block);
1760 1759
1761 if (++s->mb_x >= s->mb_width) {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 ff_draw_horiz_band(s, mb_size*(s->mb_y >> field_pic), mb_size);1763 ff_draw_horiz_band(s, mb_size*(s->mb_y >> field_pic), mb_size);
1765 ff_MPV_report_decode_progress(s);1764 ff_MPV_report_decode_progress(s);
@@ -2508,7 +2507,6 @@ AVCodec ff_mpeg1video_decoder = { · 742 unmodified lines
2508 CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY |2507 CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY |
2509 CODEC_CAP_SLICE_THREADS,2508 CODEC_CAP_SLICE_THREADS,
2510 .flush = flush,2509 .flush = flush,
2511 .max_lowres = 3,
2512 .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"),2510 .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"),
2513 .update_thread_context = ONLY_IF_THREADS_ENABLED(mpeg_decode_update_thread_context)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 CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY |2523 CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY |
2526 CODEC_CAP_SLICE_THREADS,2524 CODEC_CAP_SLICE_THREADS,
2527 .flush = flush,2525 .flush = flush,
2528 .max_lowres = 3,
2529 .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"),2526 .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"),
2530 .profiles = NULL_IF_CONFIG_SMALL(mpeg2_video_profiles),2527 .profiles = NULL_IF_CONFIG_SMALL(mpeg2_video_profiles),
2531};2528};
libavcodec/mpeg4videodec.c+0−1
@@ -2266,7 +2266,6 @@ AVCodec ff_mpeg4_decoder = { · 2265 unmodified lines
2266 CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY |2266 CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY |
2267 CODEC_CAP_FRAME_THREADS,2267 CODEC_CAP_FRAME_THREADS,
2268 .flush = ff_mpeg_flush,2268 .flush = ff_mpeg_flush,
2269 .max_lowres = 3,
2270 .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),2269 .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
2271 .pix_fmts = ff_hwaccel_pixfmt_list_420,2270 .pix_fmts = ff_hwaccel_pixfmt_list_420,
2272 .profiles = NULL_IF_CONFIG_SMALL(mpeg4_video_profiles),2271 .profiles = NULL_IF_CONFIG_SMALL(mpeg4_video_profiles),
libavcodec/mpegvideo.c+18−390
@@ -1815,364 +1815,6 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict) · 1814 unmodified lines
1815 }1815 }
1816}1816}
1817 1817
1818static 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 */
1865static 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
1980static 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 */
2045static 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 * find the lowest MB row referenced in the MVs1819 * 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 */
2283static av_always_inline1925static av_always_inline
2284void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],1926void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
2285 int lowres_flag, int is_mpeg12)1927 int is_mpeg12)
2286{1928{
2287 const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;1929 const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
2288 if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){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 qpel_mc_func (*op_qpix)[16];1969 qpel_mc_func (*op_qpix)[16];
2328 const int linesize = s->current_picture.f.linesize[0]; //not s->linesize as this would be wrong for field pics1970 const int linesize = s->current_picture.f.linesize[0]; //not s->linesize as this would be wrong for field pics
2329 const int uvlinesize = s->current_picture.f.linesize[1];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;1972 const int readable= s->pict_type != AV_PICTURE_TYPE_B || s->encoding || s->avctx->draw_horiz_band;
2331 const int block_size= lowres_flag ? 8>>s->avctx->lowres : 8;1973 const int block_size = 8;
2332 1974
2333 /* avoid copy if macroblock skipped in last frame too */1975 /* avoid copy if macroblock skipped in last frame too */
2334 /* skip only during decoding as we might trash the buffers during encoding a bit */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){2022 op_qpix= s->me.qpel_put;
2381 h264_chroma_mc_func *op_pix = s->dsp.put_h264_chroma_pixels_tab;2023 if ((!s->no_rounding) || s->pict_type==AV_PICTURE_TYPE_B){
2382 2024 op_pix = s->dsp.put_pixels_tab;
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 }
2390 }else{2025 }else{
2391 op_qpix= s->me.qpel_put;2026 op_pix = s->dsp.put_no_rnd_pixels_tab;
2392 if ((!s->no_rounding) || s->pict_type==AV_PICTURE_TYPE_B){2027 }
2393 op_pix = s->dsp.put_pixels_tab;2028 if (s->mv_dir & MV_DIR_FORWARD) {
2394 }else{2029 MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix, op_qpix);
2395 op_pix = s->dsp.put_no_rnd_pixels_tab;2030 op_pix = s->dsp.avg_pixels_tab;
2396 }2031 op_qpix= s->me.qpel_avg;
2397 if (s->mv_dir & MV_DIR_FORWARD) {2032 }
2398 MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix, op_qpix);2033 if (s->mv_dir & MV_DIR_BACKWARD) {
2399 op_pix = s->dsp.avg_pixels_tab;2034 MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f.data, op_pix, op_qpix);
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 }
2405 }2035 }
2406 }2036 }
2407 2037
@@ -2527,12 +2157,10 @@ skip_idct: · 119 unmodified lines
2527void ff_MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]){2157void ff_MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]){
2528#if !CONFIG_SMALL2158#if !CONFIG_SMALL
2529 if(s->out_format == FMT_MPEG1) {2159 if(s->out_format == FMT_MPEG1) {
2530 if(s->avctx->lowres) MPV_decode_mb_internal(s, block, 1, 1);2160 MPV_decode_mb_internal(s, block, 1);
2531 else MPV_decode_mb_internal(s, block, 0, 1);
2532 } else2161 } else
2533#endif2162#endif
2534 if(s->avctx->lowres) MPV_decode_mb_internal(s, block, 1, 0);2163 MPV_decode_mb_internal(s, block, 0);
2535 else MPV_decode_mb_internal(s, block, 0, 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
2607void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename2235void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename
2608 const int linesize = s->current_picture.f.linesize[0]; //not s->linesize as this would be wrong for field pics2236 const int linesize = s->current_picture.f.linesize[0]; //not s->linesize as this would be wrong for field pics
2609 const int uvlinesize = s->current_picture.f.linesize[1];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 s->block_index[0]= s->b8_stride*(s->mb_y*2 ) - 2 + s->mb_x*2;2240 s->block_index[0]= s->b8_stride*(s->mb_y*2 ) - 2 + s->mb_x*2;
2613 s->block_index[1]= s->b8_stride*(s->mb_y*2 ) - 1 + s->mb_x*2;2241 s->block_index[1]= s->b8_stride*(s->mb_y*2 ) - 1 + s->mb_x*2;
libavcodec/mpegvideo.h+1−1
@@ -785,7 +785,7 @@ extern const enum PixelFormat ff_pixfmt_list_420[]; · 784 unmodified lines
785extern const enum PixelFormat ff_hwaccel_pixfmt_list_420[];785extern const enum PixelFormat ff_hwaccel_pixfmt_list_420[];
786 786
787static inline void ff_update_block_index(MpegEncContext *s){787static 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 s->block_index[0]+=2;790 s->block_index[0]+=2;
791 s->block_index[1]+=2;791 s->block_index[1]+=2;
libavcodec/msmpeg4.c+0−4
@@ -1216,7 +1216,6 @@ AVCodec ff_msmpeg4v1_decoder = { · 1215 unmodified lines
1216 .close = ff_h263_decode_end,1216 .close = ff_h263_decode_end,
1217 .decode = ff_h263_decode_frame,1217 .decode = ff_h263_decode_frame,
1218 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,1218 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
1219 .max_lowres = 3,
1220 .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"),1219 .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"),
1221 .pix_fmts = ff_pixfmt_list_420,1220 .pix_fmts = ff_pixfmt_list_420,
1222};1221};
@@ -1230,7 +1229,6 @@ AVCodec ff_msmpeg4v2_decoder = { · 7 unmodified lines
1230 .close = ff_h263_decode_end,1229 .close = ff_h263_decode_end,
1231 .decode = ff_h263_decode_frame,1230 .decode = ff_h263_decode_frame,
1232 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,1231 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
1233 .max_lowres = 3,
1234 .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"),1232 .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"),
1235 .pix_fmts = ff_pixfmt_list_420,1233 .pix_fmts = ff_pixfmt_list_420,
1236};1234};
@@ -1244,7 +1242,6 @@ AVCodec ff_msmpeg4v3_decoder = { · 7 unmodified lines
1244 .close = ff_h263_decode_end,1242 .close = ff_h263_decode_end,
1245 .decode = ff_h263_decode_frame,1243 .decode = ff_h263_decode_frame,
1246 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,1244 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
1247 .max_lowres = 3,
1248 .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"),1245 .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"),
1249 .pix_fmts = ff_pixfmt_list_420,1246 .pix_fmts = ff_pixfmt_list_420,
1250};1247};
@@ -1258,7 +1255,6 @@ AVCodec ff_wmv1_decoder = { · 7 unmodified lines
1258 .close = ff_h263_decode_end,1255 .close = ff_h263_decode_end,
1259 .decode = ff_h263_decode_frame,1256 .decode = ff_h263_decode_frame,
1260 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,1257 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
1261 .max_lowres = 3,
1262 .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 7"),1258 .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
1263 .pix_fmts = ff_pixfmt_list_420,1259 .pix_fmts = ff_pixfmt_list_420,
1264};1260};
libavcodec/mxpegdec.c+0−1
@@ -338,5 +338,4 @@ AVCodec ff_mxpeg_decoder = { · 337 unmodified lines
338 .close = mxpeg_decode_end,338 .close = mxpeg_decode_end,
339 .decode = mxpeg_decode_frame,339 .decode = mxpeg_decode_frame,
340 .capabilities = CODEC_CAP_DR1,340 .capabilities = CODEC_CAP_DR1,
341 .max_lowres = 3,
342};341};
libavcodec/options_table.h+0−1
@@ -318,7 +318,6 @@ static const AVOption options[]={ · 317 unmodified lines
318{"dts_hd_ma", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_PROFILE_DTS_HD_MA }, INT_MIN, INT_MAX, A|E, "profile"},318{"dts_hd_ma", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_PROFILE_DTS_HD_MA }, INT_MIN, INT_MAX, A|E, "profile"},
319{"level", NULL, OFFSET(level), AV_OPT_TYPE_INT, {.dbl = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"},319{"level", NULL, OFFSET(level), AV_OPT_TYPE_INT, {.dbl = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"},
320{"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"},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{"skip_threshold", "frame skip threshold", OFFSET(frame_skip_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},321{"skip_threshold", "frame skip threshold", OFFSET(frame_skip_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
323{"skip_factor", "frame skip factor", OFFSET(frame_skip_factor), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},322{"skip_factor", "frame skip factor", OFFSET(frame_skip_factor), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
324{"skip_exp", "frame skip exponent", OFFSET(frame_skip_exp), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},323{"skip_exp", "frame skip exponent", OFFSET(frame_skip_exp), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
libavcodec/ppc/dsputil_ppc.c+1−1
@@ -179,7 +179,7 @@ void ff_dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx) · 178 unmodified lines
179 }179 }
180#endif //CONFIG_ENCODERS180#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 if ((avctx->idct_algo == FF_IDCT_AUTO) ||183 if ((avctx->idct_algo == FF_IDCT_AUTO) ||
184 (avctx->idct_algo == FF_IDCT_ALTIVEC)) {184 (avctx->idct_algo == FF_IDCT_ALTIVEC)) {
185 c->idct_put = ff_idct_put_altivec;185 c->idct_put = ff_idct_put_altivec;
libavcodec/rv10.c+1−4
@@ -409,8 +409,7 @@ av_log(s->avctx, AV_LOG_DEBUG, "\n");*/ · 408 unmodified lines
409// s->obmc=1;409// s->obmc=1;
410// s->umvplus=1;410// s->umvplus=1;
411 s->modified_quant=1;411 s->modified_quant=1;
412 if(!s->avctx->lowres)412 s->loop_filter=1;
413 s->loop_filter=1;
414 413
415 if(s->avctx->debug & FF_DEBUG_PICT_INFO){414 if(s->avctx->debug & FF_DEBUG_PICT_INFO){
416 av_log(s->avctx, AV_LOG_INFO, "num:%5d x:%2d y:%2d type:%d qscale:%2d rnd:%d\n",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 .close = rv10_decode_end,726 .close = rv10_decode_end,
728 .decode = rv10_decode_frame,727 .decode = rv10_decode_frame,
729 .capabilities = CODEC_CAP_DR1,728 .capabilities = CODEC_CAP_DR1,
730 .max_lowres = 3,
731 .long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"),729 .long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"),
732 .pix_fmts = ff_pixfmt_list_420,730 .pix_fmts = ff_pixfmt_list_420,
733};731};
@@ -742,7 +740,6 @@ AVCodec ff_rv20_decoder = { · 8 unmodified lines
742 .decode = rv10_decode_frame,740 .decode = rv10_decode_frame,
743 .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY,741 .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY,
744 .flush = ff_mpeg_flush,742 .flush = ff_mpeg_flush,
745 .max_lowres = 3,
746 .long_name = NULL_IF_CONFIG_SMALL("RealVideo 2.0"),743 .long_name = NULL_IF_CONFIG_SMALL("RealVideo 2.0"),
747 .pix_fmts = ff_pixfmt_list_420,744 .pix_fmts = ff_pixfmt_list_420,
748};745};
libavcodec/sp5xdec.c+0−1
@@ -102,7 +102,6 @@ AVCodec ff_sp5x_decoder = { · 101 unmodified lines
102 .close = ff_mjpeg_decode_end,102 .close = ff_mjpeg_decode_end,
103 .decode = sp5x_decode_frame,103 .decode = sp5x_decode_frame,
104 .capabilities = CODEC_CAP_DR1,104 .capabilities = CODEC_CAP_DR1,
105 .max_lowres = 3,
106 .long_name = NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"),105 .long_name = NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"),
107};106};
108 107
libavcodec/utils.c+3−10
@@ -143,8 +143,8 @@ unsigned avcodec_get_edge_width(void) · 142 unmodified lines
143void avcodec_set_dimensions(AVCodecContext *s, int width, int height){143void avcodec_set_dimensions(AVCodecContext *s, int width, int height){
144 s->coded_width = width;144 s->coded_width = width;
145 s->coded_height= height;145 s->coded_height= height;
146 s->width = -((-width )>>s->lowres);146 s->width = width;
147 s->height= -((-height)>>s->lowres);147 s->height = height;
148}148}
149 149
150#define INTERNAL_BUFFER_SIZE (32+1)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 *width = FFALIGN(*width , w_align);229 *width = FFALIGN(*width , w_align);
230 *height= FFALIGN(*height, h_align);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 *height+=2; // some of the optimized chroma MC reads one line too much232 *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 for (i = 0; i < 4; i++)234 for (i = 0; i < 4; i++)
236 linesize_align[i] = STRIDE_ALIGN;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 if (!HAVE_THREADS && !(codec->capabilities & CODEC_CAP_AUTO_THREADS))740 if (!HAVE_THREADS && !(codec->capabilities & CODEC_CAP_AUTO_THREADS))
742 avctx->thread_count = 1;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 if (av_codec_is_encoder(avctx->codec)) {743 if (av_codec_is_encoder(avctx->codec)) {
751 int i;744 int i;
752 if (avctx->codec->sample_fmts) {745 if (avctx->codec->sample_fmts) {
libavcodec/wmv2dec.c+0−1
@@ -479,7 +479,6 @@ AVCodec ff_wmv2_decoder = { · 478 unmodified lines
479 .close = wmv2_decode_end,479 .close = wmv2_decode_end,
480 .decode = ff_h263_decode_frame,480 .decode = ff_h263_decode_frame,
481 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,481 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
482 .max_lowres = 3,
483 .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 8"),482 .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 8"),
484 .pix_fmts = ff_pixfmt_list_420,483 .pix_fmts = ff_pixfmt_list_420,
485};484};
libavcodec/x86/dsputil_mmx.c+1−1
@@ -3121,7 +3121,7 @@ void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx) · 3120 unmodified lines
3121 if (mm_flags & AV_CPU_FLAG_MMX) {3121 if (mm_flags & AV_CPU_FLAG_MMX) {
3122 const int idct_algo = avctx->idct_algo;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 if (idct_algo == FF_IDCT_AUTO || idct_algo == FF_IDCT_SIMPLEMMX) {3125 if (idct_algo == FF_IDCT_AUTO || idct_algo == FF_IDCT_SIMPLEMMX) {
3126 c->idct_put = ff_simple_idct_put_mmx;3126 c->idct_put = ff_simple_idct_put_mmx;
3127 c->idct_add = ff_simple_idct_add_mmx;3127 c->idct_add = ff_simple_idct_add_mmx;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t