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
35273527
35283528 switch (dec->codec_type) {
35293529 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−
35363530 ist->resample_height = dec->height;
35373531 ist->resample_width = dec->width;
35383532 ist->resample_pix_fmt = dec->pix_fmt;
avplay.c+1−5
@@ -244,7 +244,6 @@ static int step = 0; · 243 unmodified lines
244244 static int workaround_bugs = 1;
245245 static int fast = 0;
246246 static int genpts = 0;
247−static int lowres = 0;
248247 static int idct = FF_IDCT_AUTO;
249248 static enum AVDiscard skip_frame = AVDISCARD_DEFAULT;
250249 static enum AVDiscard skip_idct = AVDISCARD_DEFAULT;
@@ -1298,7 +1297,7 @@ static void alloc_picture(void *opaque) · 1047 unmodified lines
12981297 /* SDL allocates a buffer smaller than requested if the video
12991298 * overlay hardware is unable to support the requested size. */
13001299 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"
13021301 "to reduce the image size.\n", vp->width, vp->height );
13031302 do_exit();
13041303 }
@@ -2185,14 +2184,12 @@ static int stream_component_open(VideoState *is, int stream_index) · 880 unmodified lines
21852184 avctx->debug_mv = debug_mv;
21862185 avctx->debug = debug;
21872186 avctx->workaround_bugs = workaround_bugs;
2188− avctx->lowres = lowres;
21892187 avctx->idct_algo = idct;
21902188 avctx->skip_frame = skip_frame;
21912189 avctx->skip_idct = skip_idct;
21922190 avctx->skip_loop_filter = skip_loop_filter;
21932191 avctx->error_concealment = error_concealment;
21942192
2195− if (lowres) avctx->flags |= CODEC_FLAG_EMU_EDGE;
21962193 if (fast) avctx->flags2 |= CODEC_FLAG2_FAST;
21972194
21982195 if (!av_dict_get(opts, "threads", NULL, 0))
@@ -2979,7 +2976,6 @@ static const OptionDef options[] = { · 780 unmodified lines
29792976 { "fast", OPT_BOOL | OPT_EXPERT, { (void*)&fast }, "non spec compliant optimizations", "" },
29802977 { "genpts", OPT_BOOL | OPT_EXPERT, { (void*)&genpts }, "generate pts", "" },
29812978 { "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 }, "", "" },
29832979 { "skiploop", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&skip_loop_filter }, "", "" },
29842980 { "skipframe", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&skip_frame }, "", "" },
29852981 { "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
336336 put_pixels_clamped_axp_p = c->put_pixels_clamped;
337337 add_pixels_clamped_axp_p = c->add_pixels_clamped;
338338
339− if (!avctx->lowres && avctx->bits_per_raw_sample <= 8 &&
339+ if (avctx->bits_per_raw_sample <= 8 &&
340340 (avctx->idct_algo == FF_IDCT_AUTO ||
341341 avctx->idct_algo == FF_IDCT_SIMPLEALPHA)) {
342342 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
8080 ff_put_pixels_clamped = c->put_pixels_clamped;
8181 ff_add_pixels_clamped = c->add_pixels_clamped;
8282
83− if (!avctx->lowres && avctx->bits_per_raw_sample <= 8) {
83+ if (avctx->bits_per_raw_sample <= 8) {
8484 if(avctx->idct_algo == FF_IDCT_AUTO ||
8585 avctx->idct_algo == FF_IDCT_ARM){
8686 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
2929
3030 av_cold void ff_dsputil_init_armv5te(DSPContext *c, AVCodecContext *avctx)
3131 {
32− if (!avctx->lowres && avctx->bits_per_raw_sample <= 8 &&
32+ if (avctx->bits_per_raw_sample <= 8 &&
3333 (avctx->idct_algo == FF_IDCT_AUTO ||
3434 avctx->idct_algo == FF_IDCT_SIMPLEARMV5TE)) {
3535 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
7474 {
7575 const int high_bit_depth = avctx->bits_per_raw_sample > 8;
7676
77− if (!avctx->lowres && avctx->bits_per_raw_sample <= 8 &&
77+ if (avctx->bits_per_raw_sample <= 8 &&
7878 (avctx->idct_algo == FF_IDCT_AUTO ||
7979 avctx->idct_algo == FF_IDCT_SIMPLEARMV6)) {
8080 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
182182 {
183183 const int high_bit_depth = avctx->bits_per_raw_sample > 8;
184184
185− if (!avctx->lowres && avctx->bits_per_raw_sample <= 8) {
185+ if (avctx->bits_per_raw_sample <= 8) {
186186 if (avctx->idct_algo == FF_IDCT_AUTO ||
187187 avctx->idct_algo == FF_IDCT_SIMPLENEON) {
188188 c->idct_put = ff_simple_idct_put_neon;
libavcodec/avcodec.h+3−3
@@ -1394,7 +1394,7 @@ typedef struct AVCodecContext { · 1393 unmodified lines
13941394 int width, height;
13951395
13961396 /**
1397− * Bitstream width / height, may be different from width/height if lowres enabled.
1397+ * Bitstream width / height, may be different from width/height.
13981398 * - encoding: unused
13991399 * - decoding: Set by user before init if known. Codec should override / dynamically change if needed.
14001400 */
@@ -2586,7 +2586,7 @@ typedef struct AVCodecContext { · 1185 unmodified lines
25862586 * - encoding: unused
25872587 * - decoding: Set by user.
25882588 */
2589− int lowres;
2589+ attribute_deprecated int lowres;
25902590
25912591 /**
25922592 * the picture in the bitstream
@@ -2847,7 +2847,7 @@ typedef struct AVCodec { · 254 unmodified lines
28472847 const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
28482848 const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
28492849 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
28512851 const AVClass *priv_class; ///< AVClass for the private context
28522852 const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
28532853
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
27002700 ff_add_pixels_clamped_c(block, dest, line_size);
27012701 }
27022702
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−
27342703 static void just_return(void *mem av_unused, int stride av_unused, int h av_unused) { return; }
27352704
27362705 /* init static data */
@@ -2797,28 +2766,12 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx) · 60 unmodified lines
27972766 }
27982767 #endif //CONFIG_ENCODERS
27992768
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 {
28222775 if(avctx->idct_algo==FF_IDCT_INT){
28232776 c->idct_put= ff_jref_idct_put;
28242777 c->idct_add= ff_jref_idct_add;
@@ -2849,7 +2802,6 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx) · 24 unmodified lines
28492802 c->idct = ff_simple_idct_8;
28502803 c->idct_permutation_type= FF_NO_IDCT_PERM;
28512804 }
2852− }
28532805 }
28542806
28552807 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
4646 void ff_fdct248_islow_10(DCTELEM *data);
4747
4848 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);
5249 void ff_wmv2_idct_c(DCTELEM *data);
5350
5451 void 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
311311 /* 248DCT setup */
312312 s->fdct[1] = dsp.fdct248;
313313 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);
321315
322316 avctx->coded_frame = &s->picture;
323317 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
144144 LOCAL_ALIGNED_16(DCTELEM, sblock, [5*DV_MAX_BPM], [64]);
145145 LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [ 80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */
146146 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;
148148 int is_field_mode[5];
149149
150150 assert((((int)mb_bit_buffer) & 7) == 0);
@@ -381,6 +381,5 @@ AVCodec ff_dvvideo_decoder = { · 230 unmodified lines
381381 .close = dvvideo_close,
382382 .decode = dvvideo_decode_frame,
383383 .capabilities = CODEC_CAP_DR1 | CODEC_CAP_SLICE_THREADS,
384− .max_lowres = 3,
385384 .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
386385 };
libavcodec/error_resilience.c+1−1
@@ -891,7 +891,7 @@ void ff_er_frame_end(MpegEncContext *s) · 890 unmodified lines
891891
892892 /* We do not support ER of field pictures yet,
893893 * 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 ||
895895 s->avctx->hwaccel ||
896896 s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU ||
897897 s->picture_structure != PICT_FRAME ||
libavcodec/flvdec.c+0−1
@@ -127,7 +127,6 @@ AVCodec ff_flv_decoder = { · 126 unmodified lines
127127 .close = ff_h263_decode_end,
128128 .decode = ff_h263_decode_frame,
129129 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
130− .max_lowres = 3,
131130 .long_name = NULL_IF_CONFIG_SMALL("Flash Video (FLV) / Sorenson Spark / Sorenson H.263"),
132131 .pix_fmts = ff_pixfmt_list_420,
133132 };
libavcodec/h261dec.c+0−1
@@ -651,6 +651,5 @@ AVCodec ff_h261_decoder = { · 650 unmodified lines
651651 .close = h261_decode_end,
652652 .decode = h261_decode_frame,
653653 .capabilities = CODEC_CAP_DR1,
654− .max_lowres = 3,
655654 .long_name = NULL_IF_CONFIG_SMALL("H.261"),
656655 };
libavcodec/h263dec.c+1−2
@@ -149,7 +149,7 @@ static int get_consumed_bytes(MpegEncContext *s, int buf_size){ · 148 unmodified lines
149149
150150 static int decode_slice(MpegEncContext *s){
151151 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;
153153 s->last_resync_gb= s->gb;
154154 s->first_slice_line= 1;
155155
@@ -745,7 +745,6 @@ AVCodec ff_h263_decoder = { · 589 unmodified lines
745745 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 |
746746 CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
747747 .flush = ff_mpeg_flush,
748− .max_lowres = 3,
749748 .long_name = NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"),
750749 .pix_fmts = ff_hwaccel_pixfmt_list_420,
751750 };
libavcodec/intrax8.c+0−1
@@ -716,7 +716,6 @@ av_cold void ff_intrax8_common_end(IntraX8Context * w) · 715 unmodified lines
716716 * The parent codec must call MPV_frame_start(), ff_er_frame_start() before calling this function.
717717 * The parent codec must call ff_er_frame_end(), MPV_frame_end() after calling this function.
718718 * This function does not use MPV_decode_mb().
719− * lowres decoding is theoretically impossible.
720719 * @param w pointer to IntraX8Context
721720 * @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.
722721 * @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
940940 dataptr++; /* advance pointer to next column */
941941 }
942942 }
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
libavcodec/libopenjpeg.c+0−2
@@ -158,7 +158,6 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, · 157 unmodified lines
158158 ff_thread_finish_setup(avctx);
159159
160160 ctx->dec_params.cp_limit_decoding = NO_LIMITATION;
161− ctx->dec_params.cp_reduce = avctx->lowres;
162161 // Tie decoder with decoding parameters
163162 opj_setup_decoder(dec, &ctx->dec_params);
164163 stream = opj_cio_open((opj_common_ptr)dec, buf, buf_size);
@@ -219,7 +218,6 @@ AVCodec ff_libopenjpeg_decoder = { · 54 unmodified lines
219218 .close = libopenjpeg_decode_close,
220219 .decode = libopenjpeg_decode_frame,
221220 .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
222− .max_lowres = 5,
223221 .long_name = NULL_IF_CONFIG_SMALL("OpenJPEG based JPEG 2000 decoder"),
224222 .init_thread_copy = ONLY_IF_THREADS_ENABLED(libopenjpeg_decode_init_thread_copy),
225223 };
libavcodec/mjpegbdec.c+0−1
@@ -161,6 +161,5 @@ AVCodec ff_mjpegb_decoder = { · 160 unmodified lines
161161 .close = ff_mjpeg_decode_end,
162162 .decode = mjpegb_decode_frame,
163163 .capabilities = CODEC_CAP_DR1,
164− .max_lowres = 3,
165164 .long_name = NULL_IF_CONFIG_SMALL("Apple MJPEG-B"),
166165 };
libavcodec/mjpegdec.c+8−25
@@ -796,21 +796,6 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, · 795 unmodified lines
796796 return 0;
797797 }
798798
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−
814799 static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
815800 int Al, const uint8_t *mb_bitmask,
816801 const AVFrame *reference)
@@ -869,16 +854,16 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, · 52 unmodified lines
869854 x = 0;
870855 y = 0;
871856 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);
874859
875860 if (s->interlaced && s->bottom_field)
876861 block_offset += linesize[c] >> 1;
877862 ptr = data[c] + block_offset;
878863 if (!s->progressive) {
879864 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);
882867 else {
883868 s->dsp.clear_block(s->block);
884869 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
968953 }
969954
970955 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;
972957 uint8_t *ptr = data + block_offset;
973958 int block_idx = mb_y * s->block_stride[c];
974959 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
993978
994979 if (last_scan) {
995980 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);
998983 } else {
999984 s->dsp.idct_put(ptr, linesize, *block);
1000− ptr += 8 >> s->avctx->lowres;
985+ ptr += 8;
1001986 }
1002987 }
1003988 }
@@ -1667,7 +1652,6 @@ AVCodec ff_mjpeg_decoder = { · 663 unmodified lines
16671652 .close = ff_mjpeg_decode_end,
16681653 .decode = ff_mjpeg_decode_frame,
16691654 .capabilities = CODEC_CAP_DR1,
1670− .max_lowres = 3,
16711655 .long_name = NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"),
16721656 .priv_class = &mjpegdec_class,
16731657 };
@@ -1681,6 +1665,5 @@ AVCodec ff_thp_decoder = { · 7 unmodified lines
16811665 .close = ff_mjpeg_decode_end,
16821666 .decode = ff_mjpeg_decode_frame,
16831667 .capabilities = CODEC_CAP_DR1,
1684− .max_lowres = 3,
16851668 .long_name = NULL_IF_CONFIG_SMALL("Nintendo Gamecube THP video"),
16861669 };
libavcodec/mpeg12.c+4−7
@@ -1631,7 +1631,6 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y, · 1630 unmodified lines
16311631 const uint8_t **buf, int buf_size)
16321632 {
16331633 AVCodecContext *avctx = s->avctx;
1634− const int lowres = s->avctx->lowres;
16351634 const int field_pic = s->picture_structure != PICT_FRAME;
16361635
16371636 s->resync_mb_x =
@@ -1752,14 +1751,14 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y, · 114 unmodified lines
17521751 }
17531752 }
17541753
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;
17581757
17591758 ff_MPV_decode_mb(s, s->block);
17601759
17611760 if (++s->mb_x >= s->mb_width) {
1762− const int mb_size = 16 >> s->avctx->lowres;
1761+ const int mb_size = 16;
17631762
17641763 ff_draw_horiz_band(s, mb_size*(s->mb_y >> field_pic), mb_size);
17651764 ff_MPV_report_decode_progress(s);
@@ -2508,7 +2507,6 @@ AVCodec ff_mpeg1video_decoder = { · 742 unmodified lines
25082507 CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY |
25092508 CODEC_CAP_SLICE_THREADS,
25102509 .flush = flush,
2511− .max_lowres = 3,
25122510 .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"),
25132511 .update_thread_context = ONLY_IF_THREADS_ENABLED(mpeg_decode_update_thread_context)
25142512 };
@@ -2525,7 +2523,6 @@ AVCodec ff_mpeg2video_decoder = { · 10 unmodified lines
25252523 CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY |
25262524 CODEC_CAP_SLICE_THREADS,
25272525 .flush = flush,
2528− .max_lowres = 3,
25292526 .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"),
25302527 .profiles = NULL_IF_CONFIG_SMALL(mpeg2_video_profiles),
25312528 };
libavcodec/mpeg4videodec.c+0−1
@@ -2266,7 +2266,6 @@ AVCodec ff_mpeg4_decoder = { · 2265 unmodified lines
22662266 CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY |
22672267 CODEC_CAP_FRAME_THREADS,
22682268 .flush = ff_mpeg_flush,
2269− .max_lowres = 3,
22702269 .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
22712270 .pix_fmts = ff_hwaccel_pixfmt_list_420,
22722271 .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
18151815 }
18161816 }
18171817
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−
21761818 /**
21771819 * find the lowest MB row referenced in the MVs
21781820 */
@@ -2282,7 +1924,7 @@ void ff_clean_intra_table_entries(MpegEncContext *s) · 103 unmodified lines
22821924 */
22831925 static av_always_inline
22841926 void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
2285− int lowres_flag, int is_mpeg12)
1927+ int is_mpeg12)
22861928 {
22871929 const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
22881930 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
23271969 qpel_mc_func (*op_qpix)[16];
23281970 const int linesize = s->current_picture.f.linesize[0]; //not s->linesize as this would be wrong for field pics
23291971 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;
23321974
23331975 /* avoid copy if macroblock skipped in last frame too */
23341976 /* 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
23772019 }
23782020 }
23792021
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;
23902025 }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);
24052035 }
24062036 }
24072037
@@ -2527,12 +2157,10 @@ skip_idct: · 119 unmodified lines
25272157 void ff_MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]){
25282158 #if !CONFIG_SMALL
25292159 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);
25322161 } else
25332162 #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);
25362164 }
25372165
25382166 /**
@@ -2607,7 +2235,7 @@ void ff_draw_horiz_band(MpegEncContext *s, int y, int h){ · 68 unmodified lines
26072235 void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename
26082236 const int linesize = s->current_picture.f.linesize[0]; //not s->linesize as this would be wrong for field pics
26092237 const int uvlinesize = s->current_picture.f.linesize[1];
2610− const int mb_size= 4 - s->avctx->lowres;
2238+ const int mb_size= 4;
26112239
26122240 s->block_index[0]= s->b8_stride*(s->mb_y*2 ) - 2 + s->mb_x*2;
26132241 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
785785 extern const enum PixelFormat ff_hwaccel_pixfmt_list_420[];
786786
787787 static inline void ff_update_block_index(MpegEncContext *s){
788− const int block_size= 8>>s->avctx->lowres;
788+ const int block_size = 8;
789789
790790 s->block_index[0]+=2;
791791 s->block_index[1]+=2;
libavcodec/msmpeg4.c+0−4
@@ -1216,7 +1216,6 @@ AVCodec ff_msmpeg4v1_decoder = { · 1215 unmodified lines
12161216 .close = ff_h263_decode_end,
12171217 .decode = ff_h263_decode_frame,
12181218 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
1219− .max_lowres = 3,
12201219 .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"),
12211220 .pix_fmts = ff_pixfmt_list_420,
12221221 };
@@ -1230,7 +1229,6 @@ AVCodec ff_msmpeg4v2_decoder = { · 7 unmodified lines
12301229 .close = ff_h263_decode_end,
12311230 .decode = ff_h263_decode_frame,
12321231 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
1233− .max_lowres = 3,
12341232 .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"),
12351233 .pix_fmts = ff_pixfmt_list_420,
12361234 };
@@ -1244,7 +1242,6 @@ AVCodec ff_msmpeg4v3_decoder = { · 7 unmodified lines
12441242 .close = ff_h263_decode_end,
12451243 .decode = ff_h263_decode_frame,
12461244 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
1247− .max_lowres = 3,
12481245 .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"),
12491246 .pix_fmts = ff_pixfmt_list_420,
12501247 };
@@ -1258,7 +1255,6 @@ AVCodec ff_wmv1_decoder = { · 7 unmodified lines
12581255 .close = ff_h263_decode_end,
12591256 .decode = ff_h263_decode_frame,
12601257 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
1261− .max_lowres = 3,
12621258 .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
12631259 .pix_fmts = ff_pixfmt_list_420,
12641260 };
libavcodec/mxpegdec.c+0−1
@@ -338,5 +338,4 @@ AVCodec ff_mxpeg_decoder = { · 337 unmodified lines
338338 .close = mxpeg_decode_end,
339339 .decode = mxpeg_decode_frame,
340340 .capabilities = CODEC_CAP_DR1,
341− .max_lowres = 3,
342341 };
libavcodec/options_table.h+0−1
@@ -318,7 +318,6 @@ static const AVOption options[]={ · 317 unmodified lines
318318 {"dts_hd_ma", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_PROFILE_DTS_HD_MA }, INT_MIN, INT_MAX, A|E, "profile"},
319319 {"level", NULL, OFFSET(level), AV_OPT_TYPE_INT, {.dbl = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"},
320320 {"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},
322321 {"skip_threshold", "frame skip threshold", OFFSET(frame_skip_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
323322 {"skip_factor", "frame skip factor", OFFSET(frame_skip_factor), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
324323 {"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
179179 }
180180 #endif //CONFIG_ENCODERS
181181
182− if (avctx->lowres == 0 && avctx->bits_per_raw_sample <= 8) {
182+ if (avctx->bits_per_raw_sample <= 8) {
183183 if ((avctx->idct_algo == FF_IDCT_AUTO) ||
184184 (avctx->idct_algo == FF_IDCT_ALTIVEC)) {
185185 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
409409 // s->obmc=1;
410410 // s->umvplus=1;
411411 s->modified_quant=1;
412− if(!s->avctx->lowres)
413− s->loop_filter=1;
412+ s->loop_filter=1;
414413
415414 if(s->avctx->debug & FF_DEBUG_PICT_INFO){
416415 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
727726 .close = rv10_decode_end,
728727 .decode = rv10_decode_frame,
729728 .capabilities = CODEC_CAP_DR1,
730− .max_lowres = 3,
731729 .long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"),
732730 .pix_fmts = ff_pixfmt_list_420,
733731 };
@@ -742,7 +740,6 @@ AVCodec ff_rv20_decoder = { · 8 unmodified lines
742740 .decode = rv10_decode_frame,
743741 .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY,
744742 .flush = ff_mpeg_flush,
745− .max_lowres = 3,
746743 .long_name = NULL_IF_CONFIG_SMALL("RealVideo 2.0"),
747744 .pix_fmts = ff_pixfmt_list_420,
748745 };
libavcodec/sp5xdec.c+0−1
@@ -102,7 +102,6 @@ AVCodec ff_sp5x_decoder = { · 101 unmodified lines
102102 .close = ff_mjpeg_decode_end,
103103 .decode = sp5x_decode_frame,
104104 .capabilities = CODEC_CAP_DR1,
105− .max_lowres = 3,
106105 .long_name = NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"),
107106 };
108107
libavcodec/utils.c+3−10
@@ -143,8 +143,8 @@ unsigned avcodec_get_edge_width(void) · 142 unmodified lines
143143 void avcodec_set_dimensions(AVCodecContext *s, int width, int height){
144144 s->coded_width = width;
145145 s->coded_height= height;
146− s->width = -((-width )>>s->lowres);
147− s->height= -((-height)>>s->lowres);
146+ s->width = width;
147+ s->height = height;
148148 }
149149
150150 #define INTERNAL_BUFFER_SIZE (32+1)
@@ -228,9 +228,8 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, · 77 unmodified lines
228228
229229 *width = FFALIGN(*width , w_align);
230230 *height= FFALIGN(*height, h_align);
231− if(s->codec_id == CODEC_ID_H264 || s->lowres)
231+ if (s->codec_id == CODEC_ID_H264)
232232 *height+=2; // some of the optimized chroma MC reads one line too much
233− // which is also done in mpeg decoders with lowres > 0
234233
235234 for (i = 0; i < 4; i++)
236235 linesize_align[i] = STRIDE_ALIGN;
@@ -741,12 +740,6 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD · 504 unmodified lines
741740 if (!HAVE_THREADS && !(codec->capabilities & CODEC_CAP_AUTO_THREADS))
742741 avctx->thread_count = 1;
743742
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− }
750743 if (av_codec_is_encoder(avctx->codec)) {
751744 int i;
752745 if (avctx->codec->sample_fmts) {
libavcodec/wmv2dec.c+0−1
@@ -479,7 +479,6 @@ AVCodec ff_wmv2_decoder = { · 478 unmodified lines
479479 .close = wmv2_decode_end,
480480 .decode = ff_h263_decode_frame,
481481 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
482− .max_lowres = 3,
483482 .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 8"),
484483 .pix_fmts = ff_pixfmt_list_420,
485484 };
libavcodec/x86/dsputil_mmx.c+1−1
@@ -3121,7 +3121,7 @@ void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx) · 3120 unmodified lines
31213121 if (mm_flags & AV_CPU_FLAG_MMX) {
31223122 const int idct_algo = avctx->idct_algo;
31233123
3124− if (avctx->lowres == 0 && avctx->bits_per_raw_sample <= 8) {
3124+ if (avctx->bits_per_raw_sample <= 8) {
31253125 if (idct_algo == FF_IDCT_AUTO || idct_algo == FF_IDCT_SIMPLEMMX) {
31263126 c->idct_put = ff_simple_idct_put_mmx;
31273127 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