History

avcodec/mpegvideo: Move fields only used by H.263 decoders to H263DecCtx

Andreas Rheinhardt committed 1 year ago

Commit 7db62671 parent f1c56c010 files · +86 −80Browse files

Unified · Split

10 files
  1. libavcodec/flvdec.c +2 −2
  2. libavcodec/h263dec.c +14 −14
  3. libavcodec/h263dec.h +20 −0
  4. libavcodec/intelh263dec.c +4 −4
  5. libavcodec/ituh263dec.c +20 −20
  6. libavcodec/mpeg4videodec.c +19 −17
  7. libavcodec/mpegvideo.h +0 −15
  8. libavcodec/mpegvideo_dec.c +0 −1
  9. libavcodec/nvdec_mpeg4.c +1 −1
  10. libavcodec/rv10.c +6 −6
libavcodec/flvdec.c+2−2
@@ -89,13 +89,13 @@ int ff_flv_decode_picture_header(H263DecContext *const h) · 88 unmodified lines
8989 skip_bits1(&h->gb); /* deblocking flag */
9090 h->c.chroma_qscale = h->c.qscale = get_bits(&h->gb, 5);
9191
92− h->c.h263_long_vectors = 0;
92+ h->h263_long_vectors = 0;
9393
9494 /* PEI */
9595 if (skip_1stop_8data_bits(&h->gb) < 0)
9696 return AVERROR_INVALIDDATA;
9797
98− if (h->c.ehc_mode)
98+ if (h->ehc_mode)
9999 h->c.avctx->sample_aspect_ratio= (AVRational){1,2};
100100
101101 if (h->c.avctx->debug & FF_DEBUG_PICT_INFO) {
libavcodec/h263dec.c+14−14
@@ -157,7 +157,7 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx) · 156 unmodified lines
157157
158158 if (avctx->codec_tag == AV_RL32("L263") || avctx->codec_tag == AV_RL32("S263"))
159159 if (avctx->extradata_size == 56 && avctx->extradata[0] == 1)
160− s->ehc_mode = 1;
160+ h->ehc_mode = 1;
161161
162162 /* for H.263, we allocate the images after having read the header */
163163 if (avctx->codec->id != AV_CODEC_ID_H263 &&
@@ -279,7 +279,7 @@ static int decode_slice(H263DecContext *const h) · 115 unmodified lines
279279 ff_er_add_slice(&h->c.er, h->c.resync_mb_x, h->c.resync_mb_y,
280280 h->c.mb_x, h->c.mb_y, ER_MB_END & part_mask);
281281
282− h->c.padding_bug_score--;
282+ h->padding_bug_score--;
283283
284284 if (++h->c.mb_x >= h->c.mb_width) {
285285 h->c.mb_x = 0;
@@ -324,7 +324,7 @@ static int decode_slice(H263DecContext *const h) · 38 unmodified lines
324324 get_bits_left(&h->gb) >= 48 &&
325325 show_bits(&h->gb, 24) == 0x4010 &&
326326 !h->c.data_partitioning)
327− h->c.padding_bug_score += 32;
327+ h->padding_bug_score += 32;
328328
329329 /* try to detect the padding bug */
330330 if (h->c.codec_id == AV_CODEC_ID_MPEG4 &&
@@ -336,18 +336,18 @@ static int decode_slice(H263DecContext *const h) · 5 unmodified lines
336336 const int bits_left = h->gb.size_in_bits - bits_count;
337337
338338 if (bits_left == 0) {
339− h->c.padding_bug_score += 16;
339+ h->padding_bug_score += 16;
340340 } else if (bits_left != 1) {
341341 int v = show_bits(&h->gb, 8);
342342 v |= 0x7F >> (7 - (bits_count & 7));
343343
344344 if (v == 0x7F && bits_left <= 8)
345− h->c.padding_bug_score--;
345+ h->padding_bug_score--;
346346 else if (v == 0x7F && ((get_bits_count(&h->gb) + 8) & 8) &&
347347 bits_left <= 16)
348− h->c.padding_bug_score += 4;
348+ h->padding_bug_score += 4;
349349 else
350− h->c.padding_bug_score++;
350+ h->padding_bug_score++;
351351 }
352352 }
353353
@@ -359,7 +359,7 @@ static int decode_slice(H263DecContext *const h) · 5 unmodified lines
359359 show_bits(&h->gb, 8) == 0 &&
360360 !h->c.data_partitioning) {
361361
362− h->c.padding_bug_score += 32;
362+ h->padding_bug_score += 32;
363363 }
364364
365365 if (h->c.codec_id == AV_CODEC_ID_H263 &&
@@ -367,12 +367,12 @@ static int decode_slice(H263DecContext *const h) · 1 unmodified line
367367 get_bits_left(&h->gb) >= 64 &&
368368 AV_RB64(h->gb.buffer_end - 8) == 0xCDCDCDCDFC7F0000) {
369369
370− h->c.padding_bug_score += 32;
370+ h->padding_bug_score += 32;
371371 }
372372
373373 if (h->c.workaround_bugs & FF_BUG_AUTODETECT) {
374374 if (
375− (h->c.padding_bug_score > -2 && !h->c.data_partitioning))
375+ (h->padding_bug_score > -2 && !h->c.data_partitioning))
376376 h->c.workaround_bugs |= FF_BUG_NO_PADDING;
377377 else
378378 h->c.workaround_bugs &= ~FF_BUG_NO_PADDING;
@@ -410,7 +410,7 @@ static int decode_slice(H263DecContext *const h) · 31 unmodified lines
410410
411411 av_log(h->c.avctx, AV_LOG_ERROR,
412412 "slice end not reached but screenspace end (%d left %06X, score= %d)\n",
413− get_bits_left(&h->gb), show_bits(&h->gb, 24), h->c.padding_bug_score);
413+ get_bits_left(&h->gb), show_bits(&h->gb, 24), h->padding_bug_score);
414414
415415 ff_er_add_slice(&h->c.er, h->c.resync_mb_x, h->c.resync_mb_y, h->c.mb_x, h->c.mb_y,
416416 ER_MB_END & part_mask);
@@ -432,10 +432,10 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 15 unmodified lines
432432 /* no supplementary picture */
433433 if (buf_size == 0) {
434434 /* special case for last picture */
435− if ((!h->c.low_delay || h->c.skipped_last_frame) && h->c.next_pic.ptr) {
435+ if ((!h->c.low_delay || h->skipped_last_frame) && h->c.next_pic.ptr) {
436436 if ((ret = av_frame_ref(pict, h->c.next_pic.ptr->f)) < 0)
437437 return ret;
438− if (h->c.skipped_last_frame) {
438+ if (h->skipped_last_frame) {
439439 /* If the stream ended with an NVOP, we output the last frame
440440 * in display order, but with the props from the last input
441441 * packet so that the stream's end time is correct. */
@@ -549,7 +549,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 107 unmodified lines
549549 if ((ret = ff_mpv_frame_start(s, avctx)) < 0)
550550 return ret;
551551
552− if (!h->c.divx_packed)
552+ if (!h->divx_packed)
553553 ff_thread_finish_setup(avctx);
554554
555555 if (avctx->hwaccel) {
libavcodec/h263dec.h+20−0
@@ -50,6 +50,26 @@ typedef struct H263DecContext { · 49 unmodified lines
5050
5151 GetBitContext gb;
5252
53+ int pb_frame; ///< PB-frame mode (0 = none, 1 = base, 2 = improved)
54+
55+ /* motion compensation */
56+ int h263_long_vectors; ///< use horrible H.263v1 long vector mode
57+
58+ /* H.263 specific */
59+ int ehc_mode;
60+
61+ /* H.263+ specific */
62+ int custom_pcf;
63+
64+ /* MPEG-4 specific */
65+ int padding_bug_score; ///< used to detect the VERY common padding bug in MPEG-4
66+ int skipped_last_frame;
67+ int divx_packed; ///< divx specific, used to workaround (many) bugs in divx5
68+
69+ /* RV10 specific */
70+ int rv10_version; ///< RV10 version: 0 or 3
71+ int rv10_first_dc_coded[3];
72+
5373 int (*decode_mb)(struct H263DecContext *h);
5474
5575 GetBitContext last_resync_gb; ///< used to search for the next resync marker
libavcodec/intelh263dec.c+4−4
@@ -60,14 +60,14 @@ int ff_intel_h263_decode_picture_header(H263DecContext *const h) · 59 unmodified lines
6060
6161 h->c.pict_type = AV_PICTURE_TYPE_I + get_bits1(&h->gb);
6262
63− h->c.h263_long_vectors = get_bits1(&h->gb);
63+ h->h263_long_vectors = get_bits1(&h->gb);
6464
6565 if (get_bits1(&h->gb) != 0) {
6666 av_log(h->c.avctx, AV_LOG_ERROR, "SAC not supported\n");
6767 return -1; /* SAC: off */
6868 }
6969 h->c.obmc = get_bits1(&h->gb);
70− h->c.pb_frame = get_bits1(&h->gb);
70+ h->pb_frame = get_bits1(&h->gb);
7171
7272 if (format < 6) {
7373 h->c.width = ff_h263_format[format][0];
@@ -86,7 +86,7 @@ int ff_intel_h263_decode_picture_header(H263DecContext *const h) · 12 unmodified lines
8686 if (get_bits1(&h->gb))
8787 av_log(h->c.avctx, AV_LOG_ERROR, "Bad value for reserved field\n");
8888 if (get_bits1(&h->gb))
89− h->c.pb_frame = 2;
89+ h->pb_frame = 2;
9090 if (get_bits(&h->gb, 5))
9191 av_log(h->c.avctx, AV_LOG_ERROR, "Bad value for reserved field\n");
9292 if (get_bits(&h->gb, 5) != 1)
@@ -110,7 +110,7 @@ int ff_intel_h263_decode_picture_header(H263DecContext *const h) · 17 unmodified lines
110110 h->c.chroma_qscale = h->c.qscale = get_bits(&h->gb, 5);
111111 skip_bits1(&h->gb); /* Continuous Presence Multipoint mode: off */
112112
113− if (h->c.pb_frame) {
113+ if (h->pb_frame) {
114114 skip_bits(&h->gb, 3); //temporal reference for B-frame
115115 skip_bits(&h->gb, 2); //dbquant
116116 }
libavcodec/ituh263dec.c+20−20
@@ -85,7 +85,7 @@ void ff_h263_show_pict_info(H263DecContext *const h, int h263_plus) · 84 unmodified lines
8585 h->gb.size_in_bits, 1-h->c.no_rounding,
8686 h->c.obmc ? " AP" : "",
8787 h->c.umvplus ? " UMV" : "",
88− h->c.h263_long_vectors ? " LONG" : "",
88+ h->h263_long_vectors ? " LONG" : "",
8989 h263_plus ? " +" : "",
9090 h->c.h263_aic ? " AIC" : "",
9191 h->c.alt_inter_vlc ? " AIV" : "",
@@ -295,7 +295,7 @@ int ff_h263_decode_motion(H263DecContext *const h, int pred, int f_code) · 203 unmodified lines
295295 val += pred;
296296
297297 /* modulo decoding */
298− if (!h->c.h263_long_vectors) {
298+ if (!h->h263_long_vectors) {
299299 val = sign_extend(val, 5 + f_code);
300300 } else {
301301 /* horrible H.263 long vector mode */
@@ -545,10 +545,10 @@ static int h263_decode_block(H263DecContext *const h, int16_t block[64], · 243 unmodified lines
545545 } else if (h->c.mb_intra) {
546546 /* DC coef */
547547 if (CONFIG_RV10_DECODER && h->c.codec_id == AV_CODEC_ID_RV10) {
548− if (h->c.rv10_version == 3 && h->c.pict_type == AV_PICTURE_TYPE_I) {
548+ if (h->rv10_version == 3 && h->c.pict_type == AV_PICTURE_TYPE_I) {
549549 int component = (n <= 3 ? 0 : n - 4 + 1);
550550 level = h->c.last_dc[component];
551− if (h->c.rv10_first_dc_coded[component]) {
551+ if (h->rv10_first_dc_coded[component]) {
552552 int diff = ff_rv_decode_dc(h, n);
553553 if (diff < 0)
554554 return -1;
@@ -556,7 +556,7 @@ static int h263_decode_block(H263DecContext *const h, int16_t block[64], · 1 unmodified line
556556 level = level & 0xff; /* handle wrap round */
557557 h->c.last_dc[component] = level;
558558 } else {
559− h->c.rv10_first_dc_coded[component] = 1;
559+ h->rv10_first_dc_coded[component] = 1;
560560 }
561561 } else {
562562 level = get_bits(&h->gb, 8);
@@ -816,8 +816,8 @@ int ff_h263_decode_mb(H263DecContext *const h) · 253 unmodified lines
816816 if (h->c.mb_intra)
817817 goto intra;
818818
819− if (h->c.pb_frame && get_bits1(&h->gb))
820− pb_mv_count = h263_get_modb(&h->gb, h->c.pb_frame, &cbpb);
819+ if (h->pb_frame && get_bits1(&h->gb))
820+ pb_mv_count = h263_get_modb(&h->gb, h->pb_frame, &cbpb);
821821 cbpy = get_vlc2(&h->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1);
822822
823823 if (cbpy < 0) {
@@ -1029,8 +1029,8 @@ intra: · 205 unmodified lines
10291029 }else
10301030 h->c.ac_pred = 0;
10311031
1032− if (h->c.pb_frame && get_bits1(&h->gb))
1033− pb_mv_count = h263_get_modb(&h->gb, h->c.pb_frame, &cbpb);
1032+ if (h->pb_frame && get_bits1(&h->gb))
1033+ pb_mv_count = h263_get_modb(&h->gb, h->pb_frame, &cbpb);
10341034 cbpy = get_vlc2(&h->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1);
10351035 if(cbpy<0){
10361036 av_log(h->c.avctx, AV_LOG_ERROR, "I cbpy damaged at %d %d\n",
@@ -1042,7 +1042,7 @@ intra: · 5 unmodified lines
10421042 h263_decode_dquant(h);
10431043 }
10441044
1045− pb_mv_count += !!h->c.pb_frame;
1045+ pb_mv_count += !!h->pb_frame;
10461046 }
10471047
10481048 while(pb_mv_count--){
@@ -1057,7 +1057,7 @@ intra: · 8 unmodified lines
10571057 cbp+=cbp;
10581058 }
10591059
1060− if (h->c.pb_frame && h263_skip_b_part(h, cbpb) < 0)
1060+ if (h->pb_frame && h263_skip_b_part(h, cbpb) < 0)
10611061 return -1;
10621062 if (h->c.obmc && !h->c.mb_intra) {
10631063 if (h->c.pict_type == AV_PICTURE_TYPE_P &&
@@ -1146,7 +1146,7 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 82 unmodified lines
11461146
11471147 h->c.pict_type = AV_PICTURE_TYPE_I + get_bits1(&h->gb);
11481148
1149− h->c.h263_long_vectors = get_bits1(&h->gb);
1149+ h->h263_long_vectors = get_bits1(&h->gb);
11501150
11511151 if (get_bits1(&h->gb) != 0) {
11521152 av_log(h->c.avctx, AV_LOG_ERROR, "H.263 SAC not supported\n");
@@ -1154,7 +1154,7 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 1 unmodified line
11541154 }
11551155 h->c.obmc = get_bits1(&h->gb); /* Advanced prediction mode */
11561156
1157− h->c.pb_frame = get_bits1(&h->gb);
1157+ h->pb_frame = get_bits1(&h->gb);
11581158 h->c.chroma_qscale = h->c.qscale = get_bits(&h->gb, 5);
11591159 skip_bits1(&h->gb); /* Continuous Presence Multipoint mode: off */
11601160
@@ -1174,7 +1174,7 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 13 unmodified lines
11741174 /* OPPTYPE */
11751175 format = get_bits(&h->gb, 3);
11761176 ff_dlog(h->c.avctx, "ufep=1, format: %d\n", format);
1177− h->c.custom_pcf = get_bits1(&h->gb);
1177+ h->custom_pcf = get_bits1(&h->gb);
11781178 h->c.umvplus = get_bits1(&h->gb); /* Unrestricted Motion Vector */
11791179 if (get_bits1(&h->gb) != 0) {
11801180 av_log(h->c.avctx, AV_LOG_ERROR, "Syntax-based Arithmetic Coding (SAC) not supported\n");
@@ -1210,7 +1210,7 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 29 unmodified lines
12101210 switch (h->c.pict_type) {
12111211 case 0: h->c.pict_type = AV_PICTURE_TYPE_I; break;
12121212 case 1: h->c.pict_type = AV_PICTURE_TYPE_P; break;
1213− case 2: h->c.pict_type = AV_PICTURE_TYPE_P; h->c.pb_frame = 3; break;
1213+ case 2: h->c.pict_type = AV_PICTURE_TYPE_P; h->pb_frame = 3; break;
12141214 case 3: h->c.pict_type = AV_PICTURE_TYPE_B; break;
12151215 case 7: h->c.pict_type = AV_PICTURE_TYPE_I; break; //ZYGO
12161216 default:
@@ -1251,13 +1251,13 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 34 unmodified lines
12511251 height = ff_h263_format[format][1];
12521252 h->c.avctx->sample_aspect_ratio = (AVRational){12,11};
12531253 }
1254− h->c.avctx->sample_aspect_ratio.den <<= h->c.ehc_mode;
1254+ h->c.avctx->sample_aspect_ratio.den <<= h->ehc_mode;
12551255 if ((width == 0) || (height == 0))
12561256 return -1;
12571257 h->c.width = width;
12581258 h->c.height = height;
12591259
1260− if (h->c.custom_pcf) {
1260+ if (h->custom_pcf) {
12611261 h->c.avctx->framerate.num = 1800000;
12621262 h->c.avctx->framerate.den = 1000 + get_bits1(&h->gb);
12631263 h->c.avctx->framerate.den *= get_bits(&h->gb, 7);
@@ -1273,7 +1273,7 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 9 unmodified lines
12731273 }
12741274 }
12751275
1276− if (h->c.custom_pcf)
1276+ if (h->custom_pcf)
12771277 skip_bits(&h->gb, 2); //extended Temporal reference
12781278
12791279 if (ufep) {
@@ -1315,9 +1315,9 @@ int ff_h263_decode_picture_header(H263DecContext *const h) · 35 unmodified lines
13151315
13161316 h->c.gob_index = H263_GOB_HEIGHT(h->c.height);
13171317
1318− if (h->c.pb_frame) {
1318+ if (h->pb_frame) {
13191319 skip_bits(&h->gb, 3); /* Temporal reference for B-pictures */
1320− if (h->c.custom_pcf)
1320+ if (h->custom_pcf)
13211321 skip_bits(&h->gb, 2); //extended Temporal reference
13221322 skip_bits(&h->gb, 2); /* Quantization information for B-pictures */
13231323 }
libavcodec/mpeg4videodec.c+19−17
@@ -3031,7 +3031,7 @@ static int decode_user_data(Mpeg4DecContext *ctx, GetBitContext *gb) · 3030 unmodified lines
30313031 if (e >= 2) {
30323032 ctx->divx_version = ver;
30333033 ctx->divx_build = build;
3034− h->c.divx_packed = e == 3 && last == 'p';
3034+ h->divx_packed = e == 3 && last == 'p';
30353035 }
30363036
30373037 /* libavcodec detection */
@@ -3132,7 +3132,7 @@ void ff_mpeg4_workaround_bugs(AVCodecContext *avctx) · 94 unmodified lines
31323132 h->c.workaround_bugs |= FF_BUG_QPEL_CHROMA2;
31333133
31343134 if (ctx->xvid_build <= 3U)
3135− h->c.padding_bug_score = 256 * 256 * 256 * 64;
3135+ h->padding_bug_score = 256 * 256 * 256 * 64;
31363136
31373137 if (ctx->xvid_build <= 1U)
31383138 h->c.workaround_bugs |= FF_BUG_QPEL_CHROMA;
@@ -3170,7 +3170,7 @@ void ff_mpeg4_workaround_bugs(AVCodecContext *avctx) · 31 unmodified lines
31703170 if (ctx->divx_version >= 0)
31713171 h->c.workaround_bugs |= FF_BUG_DIRECT_BLOCKSIZE;
31723172 if (ctx->divx_version == 501 && ctx->divx_build == 20020416)
3173− h->c.padding_bug_score = 256 * 256 * 256 * 64;
3173+ h->padding_bug_score = 256 * 256 * 256 * 64;
31743174
31753175 if (ctx->divx_version < 500U)
31763176 h->c.workaround_bugs |= FF_BUG_EDGE;
@@ -3199,7 +3199,7 @@ void ff_mpeg4_workaround_bugs(AVCodecContext *avctx) · 22 unmodified lines
31993199 av_log(h->c.avctx, AV_LOG_DEBUG,
32003200 "bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s\n",
32013201 h->c.workaround_bugs, ctx->lavc_build, ctx->xvid_build,
3202− ctx->divx_version, ctx->divx_build, h->c.divx_packed ? "p" : "");
3202+ ctx->divx_version, ctx->divx_build, h->divx_packed ? "p" : "");
32033203
32043204 if (CONFIG_MPEG4_DECODER && ctx->xvid_build >= 0 &&
32053205 avctx->idct_algo == FF_IDCT_AUTO && !h->c.studio_profile) {
@@ -3313,7 +3313,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb, · 107 unmodified lines
33133313 if (get_bits1(gb) != 1) {
33143314 if (h->c.avctx->debug & FF_DEBUG_PICT_INFO)
33153315 av_log(h->c.avctx, AV_LOG_ERROR, "vop not coded\n");
3316− h->c.skipped_last_frame = 1;
3316+ h->skipped_last_frame = 1;
33173317 return FRAME_SKIPPED;
33183318 }
33193319 if (ctx->new_pred)
@@ -3740,14 +3740,14 @@ int ff_mpeg4_decode_picture_header(H263DecContext *const h) · 420 unmodified lines
37403740 {
37413741 Mpeg4DecContext *const ctx = h263_to_mpeg4(h);
37423742
3743− h->c.skipped_last_frame = 0;
3743+ h->skipped_last_frame = 0;
37443744
37453745 if (ctx->bitstream_buffer) {
37463746 int buf_size = get_bits_left(&h->gb) / 8U;
37473747 int bitstream_buffer_size = ctx->bitstream_buffer->size;
37483748 const uint8_t *buf = h->gb.buffer;
37493749
3750− if (h->c.divx_packed) {
3750+ if (h->divx_packed) {
37513751 for (int i = 0; i < buf_size - 3; i++) {
37523752 if (buf[i] == 0 && buf[i+1] == 0 && buf[i+2] == 1) {
37533753 if (buf[i+3] == 0xB0) {
@@ -3759,7 +3759,7 @@ int ff_mpeg4_decode_picture_header(H263DecContext *const h) · 5 unmodified lines
37593759 }
37603760 }
37613761 ctx->bitstream_buffer->size = 0;
3762− if (bitstream_buffer_size && (h->c.divx_packed || buf_size <= MAX_NVOP_SIZE)) {// divx 5.01+/xvid frame reorder
3762+ if (bitstream_buffer_size && (h->divx_packed || buf_size <= MAX_NVOP_SIZE)) {// divx 5.01+/xvid frame reorder
37633763 int ret = init_get_bits8(&h->gb, ctx->bitstream_buffer->data,
37643764 bitstream_buffer_size);
37653765 if (ret < 0)
@@ -3780,7 +3780,7 @@ int ff_mpeg4_frame_end(AVCodecContext *avctx, const AVPacket *pkt) · 14 unmodified lines
37803780 av_assert1(!ctx->bitstream_buffer || !ctx->bitstream_buffer->size);
37813781
37823782 /* divx 5.01+ bitstream reorder stuff */
3783− if (h->c.divx_packed) {
3783+ if (h->divx_packed) {
37843784 int current_pos = ctx->bitstream_buffer && h->gb.buffer == ctx->bitstream_buffer->data ? 0 : (get_bits_count(&h->gb) >> 3);
37853785 int startcode_found = 0;
37863786 uint8_t *buf = pkt->data;
@@ -3907,7 +3907,7 @@ static int mpeg4_update_thread_context(AVCodecContext *dst, · 120 unmodified lines
39073907 s->enhancement_type = s1->enhancement_type;
39083908 s->scalability = s1->scalability;
39093909 s->intra_dc_threshold = s1->intra_dc_threshold;
3910− s->h.c.divx_packed = s1->h.c.divx_packed;
3910+ s->h.divx_packed = s1->h.divx_packed;
39113911 s->divx_version = s1->divx_version;
39123912 s->divx_build = s1->divx_build;
39133913 s->xvid_build = s1->xvid_build;
@@ -3919,7 +3919,9 @@ static int mpeg4_update_thread_context(AVCodecContext *dst, · 5 unmodified lines
39193919 s->cplx_estimation_trash_p = s1->cplx_estimation_trash_p;
39203920 s->cplx_estimation_trash_b = s1->cplx_estimation_trash_b;
39213921 s->rgb = s1->rgb;
3922− s->h.c.skipped_last_frame = s1->h.c.skipped_last_frame;
3922+
3923+ s->h.skipped_last_frame = s1->h.skipped_last_frame;
3924+ s->h.padding_bug_score = s1->h.padding_bug_score; // FIXME: racy
39233925
39243926 memcpy(s->sprite_shift, s1->sprite_shift, sizeof(s1->sprite_shift));
39253927 memcpy(s->sprite_traj, s1->sprite_traj, sizeof(s1->sprite_traj));
@@ -3930,11 +3932,11 @@ static int mpeg4_update_thread_context(AVCodecContext *dst, · 4 unmodified lines
39303932 static int mpeg4_update_thread_context_for_user(AVCodecContext *dst,
39313933 const AVCodecContext *src)
39323934 {
3933− MpegEncContext *m = dst->priv_data;
3934− const MpegEncContext *m1 = src->priv_data;
3935+ H263DecContext *const h = dst->priv_data;
3936+ const H263DecContext *const h1 = src->priv_data;
39353937
3936− m->quarter_sample = m1->quarter_sample;
3937− m->divx_packed = m1->divx_packed;
3938+ h->c.quarter_sample = h1->c.quarter_sample;
3939+ h->divx_packed = h1->divx_packed;
39383940
39393941 return 0;
39403942 }
@@ -4054,10 +4056,10 @@ static av_cold int mpeg4_close(AVCodecContext *avctx) · 113 unmodified lines
40544056 return ff_mpv_decode_close(avctx);
40554057 }
40564058
4057−#define OFFSET(x) offsetof(MpegEncContext, x)
4059+#define OFFSET(x) offsetof(H263DecContext, x)
40584060 #define FLAGS AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY
40594061 static const AVOption mpeg4_options[] = {
4060− {"quarter_sample", "1/4 subpel MC", OFFSET(quarter_sample), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS},
4062+ {"quarter_sample", "1/4 subpel MC", OFFSET(c.quarter_sample), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS},
40614063 {"divx_packed", "divx style packed b frames", OFFSET(divx_packed), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS},
40624064 {NULL}
40634065 };
libavcodec/mpegvideo.h+0−15
@@ -86,7 +86,6 @@ typedef struct MpegEncContext { · 85 unmodified lines
8686 int width, height;///< picture size. must be a multiple of 16
8787 enum OutputFormat out_format; ///< output format
8888 int h263_pred; ///< use MPEG-4/H.263 ac/dc predictions
89− int pb_frame; ///< PB-frame mode (0 = none, 1 = base, 2 = improved)
9089
9190 /* the following codec id fields are deprecated in favor of codec_id */
9291 int h263_flv; ///< use flv H.263 header
@@ -138,7 +137,6 @@ typedef struct MpegEncContext { · 45 unmodified lines
138137 */
139138 MPVWorkPicture cur_pic;
140139
141− int skipped_last_frame;
142140 int last_dc[3]; ///< last DC values for MPEG-1
143141 int16_t *dc_val_base;
144142 const uint8_t *y_dc_scale_table; ///< qscale -> y_dc_scale table
@@ -163,9 +161,6 @@ typedef struct MpegEncContext { · 18 unmodified lines
163161 int pict_type; ///< AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
164162 int droppable;
165163
166− /* motion compensation */
167− int h263_long_vectors; ///< use horrible H.263v1 long vector mode
168−
169164 BlockDSPContext bdsp;
170165 H264ChromaContext h264chroma;
171166 HpelDSPContext hdsp;
@@ -224,7 +219,6 @@ typedef struct MpegEncContext { · 52 unmodified lines
224219 /* H.263 specific */
225220 int gob_index;
226221 int obmc; ///< overlapped block motion compensation
227− int ehc_mode;
228222
229223 /* H.263+ specific */
230224 int umvplus; ///< == H.263+ && unrestricted_mv
@@ -233,7 +227,6 @@ typedef struct MpegEncContext { · 2 unmodified lines
233227 int alt_inter_vlc; ///< alternative inter vlc
234228 int modified_quant;
235229 int loop_filter;
236− int custom_pcf;
237230
238231 /* MPEG-4 specific */
239232 int studio_profile;
@@ -250,14 +243,6 @@ typedef struct MpegEncContext { · 10 unmodified lines
250243 int data_partitioning; ///< data partitioning flag from header
251244 int partitioned_frame; ///< is current frame partitioned
252245 int low_delay; ///< no reordering needed / has no B-frames
253− int padding_bug_score; ///< used to detect the VERY common padding bug in MPEG-4
254−
255− /* divx specific, used to workaround (many) bugs in divx5 */
256− int divx_packed;
257−
258− /* RV10 specific */
259− int rv10_version; ///< RV10 version: 0 or 3
260− int rv10_first_dc_coded[3];
261246
262247 /* MSMPEG4 specific */
263248 int slice_height; ///< in macroblocks
libavcodec/mpegvideo_dec.c+0−1
@@ -108,7 +108,6 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, · 107 unmodified lines
108108
109109 // Error/bug resilience
110110 s->workaround_bugs = s1->workaround_bugs;
111− s->padding_bug_score = s1->padding_bug_score;
112111
113112 // MPEG-4 timing info
114113 memcpy(&s->last_time_base, &s1->last_time_base,
libavcodec/nvdec_mpeg4.c+1−1
@@ -73,7 +73,7 @@ static int nvdec_mpeg4_start_frame(AVCodecContext *avctx, · 72 unmodified lines
7373 .quant_type = m->mpeg_quant,
7474 .quarter_sample = s->quarter_sample,
7575 .short_video_header = avctx->codec->id == AV_CODEC_ID_H263,
76− .divx_flags = s->divx_packed ? 5 : 0,
76+ .divx_flags = m->h.divx_packed ? 5 : 0,
7777
7878 .vop_coding_type = s->pict_type - AV_PICTURE_TYPE_I,
7979 .vop_coded = 1,
libavcodec/rv10.c+6−6
@@ -127,7 +127,7 @@ static int rv10_decode_picture_header(H263DecContext *const h) · 126 unmodified lines
127127 }
128128
129129 if (h->c.pict_type == AV_PICTURE_TYPE_I) {
130− if (h->c.rv10_version == 3) {
130+ if (h->rv10_version == 3) {
131131 /* specific MPEG like DC coding not used */
132132 h->c.last_dc[0] = get_bits(&h->gb, 8);
133133 h->c.last_dc[1] = get_bits(&h->gb, 8);
@@ -369,7 +369,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx) · 235 unmodified lines
369369 rv->orig_width = avctx->coded_width;
370370 rv->orig_height = avctx->coded_height;
371371
372− h->c.h263_long_vectors = avctx->extradata[3] & 1;
372+ h->h263_long_vectors = avctx->extradata[3] & 1;
373373 rv->sub_id = AV_RB32A(avctx->extradata + 4);
374374 if (avctx->codec_id == AV_CODEC_ID_RV20) {
375375 h->c.modified_quant = 1;
@@ -382,7 +382,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx) · 6 unmodified lines
382382
383383 switch (major_ver) {
384384 case 1:
385− h->c.rv10_version = micro_ver ? 3 : 1;
385+ h->rv10_version = micro_ver ? 3 : 1;
386386 h->c.obmc = micro_ver == 2;
387387 break;
388388 case 2:
@@ -475,9 +475,9 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, · 86 unmodified lines
475475
476476 ff_set_qscale(&h->c, h->c.qscale);
477477
478− h->c.rv10_first_dc_coded[0] = 0;
479− h->c.rv10_first_dc_coded[1] = 0;
480− h->c.rv10_first_dc_coded[2] = 0;
478+ h->rv10_first_dc_coded[0] = 0;
479+ h->rv10_first_dc_coded[1] = 0;
480+ h->rv10_first_dc_coded[2] = 0;
481481 ff_init_block_index(&h->c);
482482
483483 /* decode each macroblock */

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