[FFmpeg-cvslog] avcodec/mpegvideo: Move fields only used by H.263 decoders to H263DecCtx
Andreas Rheinhardt
git at videolan.org
Thu Jul 3 21:56:13 EEST 2025
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Fri Jun 20 00:44:04 2025 +0200| [7db6267b30b2d1403dd0b34399753db1bdc8cf46] | committer: Andreas Rheinhardt
avcodec/mpegvideo: Move fields only used by H.263 decoders to H263DecCtx
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7db6267b30b2d1403dd0b34399753db1bdc8cf46
---
libavcodec/flvdec.c | 4 ++--
libavcodec/h263dec.c | 28 ++++++++++++++--------------
libavcodec/h263dec.h | 20 ++++++++++++++++++++
libavcodec/intelh263dec.c | 8 ++++----
libavcodec/ituh263dec.c | 40 ++++++++++++++++++++--------------------
libavcodec/mpeg4videodec.c | 36 +++++++++++++++++++-----------------
libavcodec/mpegvideo.h | 15 ---------------
libavcodec/mpegvideo_dec.c | 1 -
libavcodec/nvdec_mpeg4.c | 2 +-
libavcodec/rv10.c | 12 ++++++------
10 files changed, 86 insertions(+), 80 deletions(-)
diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c
index f2d0b642b7..c70d79f483 100644
--- a/libavcodec/flvdec.c
+++ b/libavcodec/flvdec.c
@@ -89,13 +89,13 @@ int ff_flv_decode_picture_header(H263DecContext *const h)
skip_bits1(&h->gb); /* deblocking flag */
h->c.chroma_qscale = h->c.qscale = get_bits(&h->gb, 5);
- h->c.h263_long_vectors = 0;
+ h->h263_long_vectors = 0;
/* PEI */
if (skip_1stop_8data_bits(&h->gb) < 0)
return AVERROR_INVALIDDATA;
- if (h->c.ehc_mode)
+ if (h->ehc_mode)
h->c.avctx->sample_aspect_ratio= (AVRational){1,2};
if (h->c.avctx->debug & FF_DEBUG_PICT_INFO) {
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 4e5a17b1a2..7de75895b2 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -157,7 +157,7 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
if (avctx->codec_tag == AV_RL32("L263") || avctx->codec_tag == AV_RL32("S263"))
if (avctx->extradata_size == 56 && avctx->extradata[0] == 1)
- s->ehc_mode = 1;
+ h->ehc_mode = 1;
/* for H.263, we allocate the images after having read the header */
if (avctx->codec->id != AV_CODEC_ID_H263 &&
@@ -279,7 +279,7 @@ static int decode_slice(H263DecContext *const h)
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, ER_MB_END & part_mask);
- h->c.padding_bug_score--;
+ h->padding_bug_score--;
if (++h->c.mb_x >= h->c.mb_width) {
h->c.mb_x = 0;
@@ -324,7 +324,7 @@ static int decode_slice(H263DecContext *const h)
get_bits_left(&h->gb) >= 48 &&
show_bits(&h->gb, 24) == 0x4010 &&
!h->c.data_partitioning)
- h->c.padding_bug_score += 32;
+ h->padding_bug_score += 32;
/* try to detect the padding bug */
if (h->c.codec_id == AV_CODEC_ID_MPEG4 &&
@@ -336,18 +336,18 @@ static int decode_slice(H263DecContext *const h)
const int bits_left = h->gb.size_in_bits - bits_count;
if (bits_left == 0) {
- h->c.padding_bug_score += 16;
+ h->padding_bug_score += 16;
} else if (bits_left != 1) {
int v = show_bits(&h->gb, 8);
v |= 0x7F >> (7 - (bits_count & 7));
if (v == 0x7F && bits_left <= 8)
- h->c.padding_bug_score--;
+ h->padding_bug_score--;
else if (v == 0x7F && ((get_bits_count(&h->gb) + 8) & 8) &&
bits_left <= 16)
- h->c.padding_bug_score += 4;
+ h->padding_bug_score += 4;
else
- h->c.padding_bug_score++;
+ h->padding_bug_score++;
}
}
@@ -359,7 +359,7 @@ static int decode_slice(H263DecContext *const h)
show_bits(&h->gb, 8) == 0 &&
!h->c.data_partitioning) {
- h->c.padding_bug_score += 32;
+ h->padding_bug_score += 32;
}
if (h->c.codec_id == AV_CODEC_ID_H263 &&
@@ -367,12 +367,12 @@ static int decode_slice(H263DecContext *const h)
get_bits_left(&h->gb) >= 64 &&
AV_RB64(h->gb.buffer_end - 8) == 0xCDCDCDCDFC7F0000) {
- h->c.padding_bug_score += 32;
+ h->padding_bug_score += 32;
}
if (h->c.workaround_bugs & FF_BUG_AUTODETECT) {
if (
- (h->c.padding_bug_score > -2 && !h->c.data_partitioning))
+ (h->padding_bug_score > -2 && !h->c.data_partitioning))
h->c.workaround_bugs |= FF_BUG_NO_PADDING;
else
h->c.workaround_bugs &= ~FF_BUG_NO_PADDING;
@@ -410,7 +410,7 @@ static int decode_slice(H263DecContext *const h)
av_log(h->c.avctx, AV_LOG_ERROR,
"slice end not reached but screenspace end (%d left %06X, score= %d)\n",
- get_bits_left(&h->gb), show_bits(&h->gb, 24), h->c.padding_bug_score);
+ get_bits_left(&h->gb), show_bits(&h->gb, 24), h->padding_bug_score);
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,
ER_MB_END & part_mask);
@@ -432,10 +432,10 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict,
/* no supplementary picture */
if (buf_size == 0) {
/* special case for last picture */
- if ((!h->c.low_delay || h->c.skipped_last_frame) && h->c.next_pic.ptr) {
+ if ((!h->c.low_delay || h->skipped_last_frame) && h->c.next_pic.ptr) {
if ((ret = av_frame_ref(pict, h->c.next_pic.ptr->f)) < 0)
return ret;
- if (h->c.skipped_last_frame) {
+ if (h->skipped_last_frame) {
/* If the stream ended with an NVOP, we output the last frame
* in display order, but with the props from the last input
* packet so that the stream's end time is correct. */
@@ -549,7 +549,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict,
if ((ret = ff_mpv_frame_start(s, avctx)) < 0)
return ret;
- if (!h->c.divx_packed)
+ if (!h->divx_packed)
ff_thread_finish_setup(avctx);
if (avctx->hwaccel) {
diff --git a/libavcodec/h263dec.h b/libavcodec/h263dec.h
index dfa056f08e..dd63eca5be 100644
--- a/libavcodec/h263dec.h
+++ b/libavcodec/h263dec.h
@@ -50,6 +50,26 @@ typedef struct H263DecContext {
GetBitContext gb;
+ int pb_frame; ///< PB-frame mode (0 = none, 1 = base, 2 = improved)
+
+ /* motion compensation */
+ int h263_long_vectors; ///< use horrible H.263v1 long vector mode
+
+ /* H.263 specific */
+ int ehc_mode;
+
+ /* H.263+ specific */
+ int custom_pcf;
+
+ /* MPEG-4 specific */
+ int padding_bug_score; ///< used to detect the VERY common padding bug in MPEG-4
+ int skipped_last_frame;
+ int divx_packed; ///< divx specific, used to workaround (many) bugs in divx5
+
+ /* RV10 specific */
+ int rv10_version; ///< RV10 version: 0 or 3
+ int rv10_first_dc_coded[3];
+
int (*decode_mb)(struct H263DecContext *h);
GetBitContext last_resync_gb; ///< used to search for the next resync marker
diff --git a/libavcodec/intelh263dec.c b/libavcodec/intelh263dec.c
index 3800e6f1cc..1640defaab 100644
--- a/libavcodec/intelh263dec.c
+++ b/libavcodec/intelh263dec.c
@@ -60,14 +60,14 @@ int ff_intel_h263_decode_picture_header(H263DecContext *const h)
h->c.pict_type = AV_PICTURE_TYPE_I + get_bits1(&h->gb);
- h->c.h263_long_vectors = get_bits1(&h->gb);
+ h->h263_long_vectors = get_bits1(&h->gb);
if (get_bits1(&h->gb) != 0) {
av_log(h->c.avctx, AV_LOG_ERROR, "SAC not supported\n");
return -1; /* SAC: off */
}
h->c.obmc = get_bits1(&h->gb);
- h->c.pb_frame = get_bits1(&h->gb);
+ h->pb_frame = get_bits1(&h->gb);
if (format < 6) {
h->c.width = ff_h263_format[format][0];
@@ -86,7 +86,7 @@ int ff_intel_h263_decode_picture_header(H263DecContext *const h)
if (get_bits1(&h->gb))
av_log(h->c.avctx, AV_LOG_ERROR, "Bad value for reserved field\n");
if (get_bits1(&h->gb))
- h->c.pb_frame = 2;
+ h->pb_frame = 2;
if (get_bits(&h->gb, 5))
av_log(h->c.avctx, AV_LOG_ERROR, "Bad value for reserved field\n");
if (get_bits(&h->gb, 5) != 1)
@@ -110,7 +110,7 @@ int ff_intel_h263_decode_picture_header(H263DecContext *const h)
h->c.chroma_qscale = h->c.qscale = get_bits(&h->gb, 5);
skip_bits1(&h->gb); /* Continuous Presence Multipoint mode: off */
- if (h->c.pb_frame) {
+ if (h->pb_frame) {
skip_bits(&h->gb, 3); //temporal reference for B-frame
skip_bits(&h->gb, 2); //dbquant
}
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index c19134b0d4..11be8189a6 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -85,7 +85,7 @@ void ff_h263_show_pict_info(H263DecContext *const h, int h263_plus)
h->gb.size_in_bits, 1-h->c.no_rounding,
h->c.obmc ? " AP" : "",
h->c.umvplus ? " UMV" : "",
- h->c.h263_long_vectors ? " LONG" : "",
+ h->h263_long_vectors ? " LONG" : "",
h263_plus ? " +" : "",
h->c.h263_aic ? " AIC" : "",
h->c.alt_inter_vlc ? " AIV" : "",
@@ -295,7 +295,7 @@ int ff_h263_decode_motion(H263DecContext *const h, int pred, int f_code)
val += pred;
/* modulo decoding */
- if (!h->c.h263_long_vectors) {
+ if (!h->h263_long_vectors) {
val = sign_extend(val, 5 + f_code);
} else {
/* horrible H.263 long vector mode */
@@ -545,10 +545,10 @@ static int h263_decode_block(H263DecContext *const h, int16_t block[64],
} else if (h->c.mb_intra) {
/* DC coef */
if (CONFIG_RV10_DECODER && h->c.codec_id == AV_CODEC_ID_RV10) {
- if (h->c.rv10_version == 3 && h->c.pict_type == AV_PICTURE_TYPE_I) {
+ if (h->rv10_version == 3 && h->c.pict_type == AV_PICTURE_TYPE_I) {
int component = (n <= 3 ? 0 : n - 4 + 1);
level = h->c.last_dc[component];
- if (h->c.rv10_first_dc_coded[component]) {
+ if (h->rv10_first_dc_coded[component]) {
int diff = ff_rv_decode_dc(h, n);
if (diff < 0)
return -1;
@@ -556,7 +556,7 @@ static int h263_decode_block(H263DecContext *const h, int16_t block[64],
level = level & 0xff; /* handle wrap round */
h->c.last_dc[component] = level;
} else {
- h->c.rv10_first_dc_coded[component] = 1;
+ h->rv10_first_dc_coded[component] = 1;
}
} else {
level = get_bits(&h->gb, 8);
@@ -816,8 +816,8 @@ int ff_h263_decode_mb(H263DecContext *const h)
if (h->c.mb_intra)
goto intra;
- if (h->c.pb_frame && get_bits1(&h->gb))
- pb_mv_count = h263_get_modb(&h->gb, h->c.pb_frame, &cbpb);
+ if (h->pb_frame && get_bits1(&h->gb))
+ pb_mv_count = h263_get_modb(&h->gb, h->pb_frame, &cbpb);
cbpy = get_vlc2(&h->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1);
if (cbpy < 0) {
@@ -1029,8 +1029,8 @@ intra:
}else
h->c.ac_pred = 0;
- if (h->c.pb_frame && get_bits1(&h->gb))
- pb_mv_count = h263_get_modb(&h->gb, h->c.pb_frame, &cbpb);
+ if (h->pb_frame && get_bits1(&h->gb))
+ pb_mv_count = h263_get_modb(&h->gb, h->pb_frame, &cbpb);
cbpy = get_vlc2(&h->gb, ff_h263_cbpy_vlc, CBPY_VLC_BITS, 1);
if(cbpy<0){
av_log(h->c.avctx, AV_LOG_ERROR, "I cbpy damaged at %d %d\n",
@@ -1042,7 +1042,7 @@ intra:
h263_decode_dquant(h);
}
- pb_mv_count += !!h->c.pb_frame;
+ pb_mv_count += !!h->pb_frame;
}
while(pb_mv_count--){
@@ -1057,7 +1057,7 @@ intra:
cbp+=cbp;
}
- if (h->c.pb_frame && h263_skip_b_part(h, cbpb) < 0)
+ if (h->pb_frame && h263_skip_b_part(h, cbpb) < 0)
return -1;
if (h->c.obmc && !h->c.mb_intra) {
if (h->c.pict_type == AV_PICTURE_TYPE_P &&
@@ -1146,7 +1146,7 @@ int ff_h263_decode_picture_header(H263DecContext *const h)
h->c.pict_type = AV_PICTURE_TYPE_I + get_bits1(&h->gb);
- h->c.h263_long_vectors = get_bits1(&h->gb);
+ h->h263_long_vectors = get_bits1(&h->gb);
if (get_bits1(&h->gb) != 0) {
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)
}
h->c.obmc = get_bits1(&h->gb); /* Advanced prediction mode */
- h->c.pb_frame = get_bits1(&h->gb);
+ h->pb_frame = get_bits1(&h->gb);
h->c.chroma_qscale = h->c.qscale = get_bits(&h->gb, 5);
skip_bits1(&h->gb); /* Continuous Presence Multipoint mode: off */
@@ -1174,7 +1174,7 @@ int ff_h263_decode_picture_header(H263DecContext *const h)
/* OPPTYPE */
format = get_bits(&h->gb, 3);
ff_dlog(h->c.avctx, "ufep=1, format: %d\n", format);
- h->c.custom_pcf = get_bits1(&h->gb);
+ h->custom_pcf = get_bits1(&h->gb);
h->c.umvplus = get_bits1(&h->gb); /* Unrestricted Motion Vector */
if (get_bits1(&h->gb) != 0) {
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)
switch (h->c.pict_type) {
case 0: h->c.pict_type = AV_PICTURE_TYPE_I; break;
case 1: h->c.pict_type = AV_PICTURE_TYPE_P; break;
- case 2: h->c.pict_type = AV_PICTURE_TYPE_P; h->c.pb_frame = 3; break;
+ case 2: h->c.pict_type = AV_PICTURE_TYPE_P; h->pb_frame = 3; break;
case 3: h->c.pict_type = AV_PICTURE_TYPE_B; break;
case 7: h->c.pict_type = AV_PICTURE_TYPE_I; break; //ZYGO
default:
@@ -1251,13 +1251,13 @@ int ff_h263_decode_picture_header(H263DecContext *const h)
height = ff_h263_format[format][1];
h->c.avctx->sample_aspect_ratio = (AVRational){12,11};
}
- h->c.avctx->sample_aspect_ratio.den <<= h->c.ehc_mode;
+ h->c.avctx->sample_aspect_ratio.den <<= h->ehc_mode;
if ((width == 0) || (height == 0))
return -1;
h->c.width = width;
h->c.height = height;
- if (h->c.custom_pcf) {
+ if (h->custom_pcf) {
h->c.avctx->framerate.num = 1800000;
h->c.avctx->framerate.den = 1000 + get_bits1(&h->gb);
h->c.avctx->framerate.den *= get_bits(&h->gb, 7);
@@ -1273,7 +1273,7 @@ int ff_h263_decode_picture_header(H263DecContext *const h)
}
}
- if (h->c.custom_pcf)
+ if (h->custom_pcf)
skip_bits(&h->gb, 2); //extended Temporal reference
if (ufep) {
@@ -1315,9 +1315,9 @@ int ff_h263_decode_picture_header(H263DecContext *const h)
h->c.gob_index = H263_GOB_HEIGHT(h->c.height);
- if (h->c.pb_frame) {
+ if (h->pb_frame) {
skip_bits(&h->gb, 3); /* Temporal reference for B-pictures */
- if (h->c.custom_pcf)
+ if (h->custom_pcf)
skip_bits(&h->gb, 2); //extended Temporal reference
skip_bits(&h->gb, 2); /* Quantization information for B-pictures */
}
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index ee78e7119f..f3af523b7c 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -3031,7 +3031,7 @@ static int decode_user_data(Mpeg4DecContext *ctx, GetBitContext *gb)
if (e >= 2) {
ctx->divx_version = ver;
ctx->divx_build = build;
- h->c.divx_packed = e == 3 && last == 'p';
+ h->divx_packed = e == 3 && last == 'p';
}
/* libavcodec detection */
@@ -3132,7 +3132,7 @@ void ff_mpeg4_workaround_bugs(AVCodecContext *avctx)
h->c.workaround_bugs |= FF_BUG_QPEL_CHROMA2;
if (ctx->xvid_build <= 3U)
- h->c.padding_bug_score = 256 * 256 * 256 * 64;
+ h->padding_bug_score = 256 * 256 * 256 * 64;
if (ctx->xvid_build <= 1U)
h->c.workaround_bugs |= FF_BUG_QPEL_CHROMA;
@@ -3170,7 +3170,7 @@ void ff_mpeg4_workaround_bugs(AVCodecContext *avctx)
if (ctx->divx_version >= 0)
h->c.workaround_bugs |= FF_BUG_DIRECT_BLOCKSIZE;
if (ctx->divx_version == 501 && ctx->divx_build == 20020416)
- h->c.padding_bug_score = 256 * 256 * 256 * 64;
+ h->padding_bug_score = 256 * 256 * 256 * 64;
if (ctx->divx_version < 500U)
h->c.workaround_bugs |= FF_BUG_EDGE;
@@ -3199,7 +3199,7 @@ void ff_mpeg4_workaround_bugs(AVCodecContext *avctx)
av_log(h->c.avctx, AV_LOG_DEBUG,
"bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s\n",
h->c.workaround_bugs, ctx->lavc_build, ctx->xvid_build,
- ctx->divx_version, ctx->divx_build, h->c.divx_packed ? "p" : "");
+ ctx->divx_version, ctx->divx_build, h->divx_packed ? "p" : "");
if (CONFIG_MPEG4_DECODER && ctx->xvid_build >= 0 &&
avctx->idct_algo == FF_IDCT_AUTO && !h->c.studio_profile) {
@@ -3313,7 +3313,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb,
if (get_bits1(gb) != 1) {
if (h->c.avctx->debug & FF_DEBUG_PICT_INFO)
av_log(h->c.avctx, AV_LOG_ERROR, "vop not coded\n");
- h->c.skipped_last_frame = 1;
+ h->skipped_last_frame = 1;
return FRAME_SKIPPED;
}
if (ctx->new_pred)
@@ -3740,14 +3740,14 @@ int ff_mpeg4_decode_picture_header(H263DecContext *const h)
{
Mpeg4DecContext *const ctx = h263_to_mpeg4(h);
- h->c.skipped_last_frame = 0;
+ h->skipped_last_frame = 0;
if (ctx->bitstream_buffer) {
int buf_size = get_bits_left(&h->gb) / 8U;
int bitstream_buffer_size = ctx->bitstream_buffer->size;
const uint8_t *buf = h->gb.buffer;
- if (h->c.divx_packed) {
+ if (h->divx_packed) {
for (int i = 0; i < buf_size - 3; i++) {
if (buf[i] == 0 && buf[i+1] == 0 && buf[i+2] == 1) {
if (buf[i+3] == 0xB0) {
@@ -3759,7 +3759,7 @@ int ff_mpeg4_decode_picture_header(H263DecContext *const h)
}
}
ctx->bitstream_buffer->size = 0;
- if (bitstream_buffer_size && (h->c.divx_packed || buf_size <= MAX_NVOP_SIZE)) {// divx 5.01+/xvid frame reorder
+ if (bitstream_buffer_size && (h->divx_packed || buf_size <= MAX_NVOP_SIZE)) {// divx 5.01+/xvid frame reorder
int ret = init_get_bits8(&h->gb, ctx->bitstream_buffer->data,
bitstream_buffer_size);
if (ret < 0)
@@ -3780,7 +3780,7 @@ int ff_mpeg4_frame_end(AVCodecContext *avctx, const AVPacket *pkt)
av_assert1(!ctx->bitstream_buffer || !ctx->bitstream_buffer->size);
/* divx 5.01+ bitstream reorder stuff */
- if (h->c.divx_packed) {
+ if (h->divx_packed) {
int current_pos = ctx->bitstream_buffer && h->gb.buffer == ctx->bitstream_buffer->data ? 0 : (get_bits_count(&h->gb) >> 3);
int startcode_found = 0;
uint8_t *buf = pkt->data;
@@ -3907,7 +3907,7 @@ static int mpeg4_update_thread_context(AVCodecContext *dst,
s->enhancement_type = s1->enhancement_type;
s->scalability = s1->scalability;
s->intra_dc_threshold = s1->intra_dc_threshold;
- s->h.c.divx_packed = s1->h.c.divx_packed;
+ s->h.divx_packed = s1->h.divx_packed;
s->divx_version = s1->divx_version;
s->divx_build = s1->divx_build;
s->xvid_build = s1->xvid_build;
@@ -3919,7 +3919,9 @@ static int mpeg4_update_thread_context(AVCodecContext *dst,
s->cplx_estimation_trash_p = s1->cplx_estimation_trash_p;
s->cplx_estimation_trash_b = s1->cplx_estimation_trash_b;
s->rgb = s1->rgb;
- s->h.c.skipped_last_frame = s1->h.c.skipped_last_frame;
+
+ s->h.skipped_last_frame = s1->h.skipped_last_frame;
+ s->h.padding_bug_score = s1->h.padding_bug_score; // FIXME: racy
memcpy(s->sprite_shift, s1->sprite_shift, sizeof(s1->sprite_shift));
memcpy(s->sprite_traj, s1->sprite_traj, sizeof(s1->sprite_traj));
@@ -3930,11 +3932,11 @@ static int mpeg4_update_thread_context(AVCodecContext *dst,
static int mpeg4_update_thread_context_for_user(AVCodecContext *dst,
const AVCodecContext *src)
{
- MpegEncContext *m = dst->priv_data;
- const MpegEncContext *m1 = src->priv_data;
+ H263DecContext *const h = dst->priv_data;
+ const H263DecContext *const h1 = src->priv_data;
- m->quarter_sample = m1->quarter_sample;
- m->divx_packed = m1->divx_packed;
+ h->c.quarter_sample = h1->c.quarter_sample;
+ h->divx_packed = h1->divx_packed;
return 0;
}
@@ -4054,10 +4056,10 @@ static av_cold int mpeg4_close(AVCodecContext *avctx)
return ff_mpv_decode_close(avctx);
}
-#define OFFSET(x) offsetof(MpegEncContext, x)
+#define OFFSET(x) offsetof(H263DecContext, x)
#define FLAGS AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY
static const AVOption mpeg4_options[] = {
- {"quarter_sample", "1/4 subpel MC", OFFSET(quarter_sample), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS},
+ {"quarter_sample", "1/4 subpel MC", OFFSET(c.quarter_sample), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS},
{"divx_packed", "divx style packed b frames", OFFSET(divx_packed), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS},
{NULL}
};
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 4b215bf65f..ff3a249512 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -86,7 +86,6 @@ typedef struct MpegEncContext {
int width, height;///< picture size. must be a multiple of 16
enum OutputFormat out_format; ///< output format
int h263_pred; ///< use MPEG-4/H.263 ac/dc predictions
- int pb_frame; ///< PB-frame mode (0 = none, 1 = base, 2 = improved)
/* the following codec id fields are deprecated in favor of codec_id */
int h263_flv; ///< use flv H.263 header
@@ -138,7 +137,6 @@ typedef struct MpegEncContext {
*/
MPVWorkPicture cur_pic;
- int skipped_last_frame;
int last_dc[3]; ///< last DC values for MPEG-1
int16_t *dc_val_base;
const uint8_t *y_dc_scale_table; ///< qscale -> y_dc_scale table
@@ -163,9 +161,6 @@ typedef struct MpegEncContext {
int pict_type; ///< AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
int droppable;
- /* motion compensation */
- int h263_long_vectors; ///< use horrible H.263v1 long vector mode
-
BlockDSPContext bdsp;
H264ChromaContext h264chroma;
HpelDSPContext hdsp;
@@ -224,7 +219,6 @@ typedef struct MpegEncContext {
/* H.263 specific */
int gob_index;
int obmc; ///< overlapped block motion compensation
- int ehc_mode;
/* H.263+ specific */
int umvplus; ///< == H.263+ && unrestricted_mv
@@ -233,7 +227,6 @@ typedef struct MpegEncContext {
int alt_inter_vlc; ///< alternative inter vlc
int modified_quant;
int loop_filter;
- int custom_pcf;
/* MPEG-4 specific */
int studio_profile;
@@ -250,14 +243,6 @@ typedef struct MpegEncContext {
int data_partitioning; ///< data partitioning flag from header
int partitioned_frame; ///< is current frame partitioned
int low_delay; ///< no reordering needed / has no B-frames
- int padding_bug_score; ///< used to detect the VERY common padding bug in MPEG-4
-
- /* divx specific, used to workaround (many) bugs in divx5 */
- int divx_packed;
-
- /* RV10 specific */
- int rv10_version; ///< RV10 version: 0 or 3
- int rv10_first_dc_coded[3];
/* MSMPEG4 specific */
int slice_height; ///< in macroblocks
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index c4831bf85b..1ae36dc751 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -108,7 +108,6 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
// Error/bug resilience
s->workaround_bugs = s1->workaround_bugs;
- s->padding_bug_score = s1->padding_bug_score;
// MPEG-4 timing info
memcpy(&s->last_time_base, &s1->last_time_base,
diff --git a/libavcodec/nvdec_mpeg4.c b/libavcodec/nvdec_mpeg4.c
index 0351ee169e..369bd5b997 100644
--- a/libavcodec/nvdec_mpeg4.c
+++ b/libavcodec/nvdec_mpeg4.c
@@ -73,7 +73,7 @@ static int nvdec_mpeg4_start_frame(AVCodecContext *avctx,
.quant_type = m->mpeg_quant,
.quarter_sample = s->quarter_sample,
.short_video_header = avctx->codec->id == AV_CODEC_ID_H263,
- .divx_flags = s->divx_packed ? 5 : 0,
+ .divx_flags = m->h.divx_packed ? 5 : 0,
.vop_coding_type = s->pict_type - AV_PICTURE_TYPE_I,
.vop_coded = 1,
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index 01cdd1a9dc..bbd0482d59 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -127,7 +127,7 @@ static int rv10_decode_picture_header(H263DecContext *const h)
}
if (h->c.pict_type == AV_PICTURE_TYPE_I) {
- if (h->c.rv10_version == 3) {
+ if (h->rv10_version == 3) {
/* specific MPEG like DC coding not used */
h->c.last_dc[0] = get_bits(&h->gb, 8);
h->c.last_dc[1] = get_bits(&h->gb, 8);
@@ -369,7 +369,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx)
rv->orig_width = avctx->coded_width;
rv->orig_height = avctx->coded_height;
- h->c.h263_long_vectors = avctx->extradata[3] & 1;
+ h->h263_long_vectors = avctx->extradata[3] & 1;
rv->sub_id = AV_RB32A(avctx->extradata + 4);
if (avctx->codec_id == AV_CODEC_ID_RV20) {
h->c.modified_quant = 1;
@@ -382,7 +382,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx)
switch (major_ver) {
case 1:
- h->c.rv10_version = micro_ver ? 3 : 1;
+ h->rv10_version = micro_ver ? 3 : 1;
h->c.obmc = micro_ver == 2;
break;
case 2:
@@ -475,9 +475,9 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf,
ff_set_qscale(&h->c, h->c.qscale);
- h->c.rv10_first_dc_coded[0] = 0;
- h->c.rv10_first_dc_coded[1] = 0;
- h->c.rv10_first_dc_coded[2] = 0;
+ h->rv10_first_dc_coded[0] = 0;
+ h->rv10_first_dc_coded[1] = 0;
+ h->rv10_first_dc_coded[2] = 0;
ff_init_block_index(&h->c);
/* decode each macroblock */
More information about the ffmpeg-cvslog
mailing list