[FFmpeg-cvslog] avcodec/mpegvideo: Move partitioned_frame to {H263Dec,MPVEnc}Context
Andreas Rheinhardt
git at videolan.org
Thu Jul 3 21:56:37 EEST 2025
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Jun 22 14:54:43 2025 +0200| [60f51bdaac29121fca429274dfa2d8431999d571] | committer: Andreas Rheinhardt
avcodec/mpegvideo: Move partitioned_frame to {H263Dec,MPVEnc}Context
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=60f51bdaac29121fca429274dfa2d8431999d571
---
libavcodec/h263dec.c | 16 ++++++++--------
libavcodec/h263dec.h | 1 +
libavcodec/mpeg4videodec.c | 10 +++++-----
libavcodec/mpeg4videoenc.c | 2 +-
libavcodec/mpegvideo.h | 1 -
libavcodec/mpegvideo_enc.c | 10 +++++-----
libavcodec/mpegvideoenc.h | 1 +
7 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index c303cce194..baa793de7e 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -181,15 +181,15 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
return 0;
}
-static void report_decode_progress(MpegEncContext *s)
+static void report_decode_progress(H263DecContext *const h)
{
- if (s->pict_type != AV_PICTURE_TYPE_B && !s->partitioned_frame && !s->er.error_occurred)
- ff_thread_progress_report(&s->cur_pic.ptr->progress, s->mb_y);
+ if (h->c.pict_type != AV_PICTURE_TYPE_B && !h->partitioned_frame && !h->c.er.error_occurred)
+ ff_thread_progress_report(&h->c.cur_pic.ptr->progress, h->c.mb_y);
}
static int decode_slice(H263DecContext *const h)
{
- const int part_mask = h->c.partitioned_frame
+ const int part_mask = h->partitioned_frame
? (ER_AC_END | ER_AC_ERROR) : 0x7F;
const int mb_size = 16 >> h->c.avctx->lowres;
int ret;
@@ -214,7 +214,7 @@ static int decode_slice(H263DecContext *const h)
return ret;
}
- if (h->c.partitioned_frame) {
+ if (h->partitioned_frame) {
const int qscale = h->c.qscale;
if (CONFIG_MPEG4_DECODER && h->c.codec_id == AV_CODEC_ID_MPEG4)
@@ -290,7 +290,7 @@ static int decode_slice(H263DecContext *const h)
if (++h->c.mb_x >= h->c.mb_width) {
h->c.mb_x = 0;
- report_decode_progress(&h->c);
+ report_decode_progress(h);
ff_mpeg_draw_horiz_band(&h->c, h->c.mb_y * mb_size, mb_size);
h->c.mb_y++;
}
@@ -317,7 +317,7 @@ static int decode_slice(H263DecContext *const h)
ff_h263_loop_filter(&h->c);
}
- report_decode_progress(&h->c);
+ report_decode_progress(h);
ff_mpeg_draw_horiz_band(&h->c, h->c.mb_y * mb_size, mb_size);
h->c.mb_x = 0;
@@ -551,7 +551,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict,
return ret;
}
- ff_mpv_er_frame_start_ext(s, s->partitioned_frame,
+ ff_mpv_er_frame_start_ext(s, h->partitioned_frame,
s->pp_time, s->pb_time);
/* the second part of the wmv2 header contains the MB skip bits which
diff --git a/libavcodec/h263dec.h b/libavcodec/h263dec.h
index a7b5e54ae7..c2cca57dea 100644
--- a/libavcodec/h263dec.h
+++ b/libavcodec/h263dec.h
@@ -73,6 +73,7 @@ typedef struct H263DecContext {
int skipped_last_frame;
int divx_packed; ///< divx specific, used to workaround (many) bugs in divx5
int data_partitioning; ///< data partitioning flag from header
+ int partitioned_frame; ///< is current frame partitioned
/* MSMPEG4 specific */
int slice_height; ///< in macroblocks
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index aaf2ecf7c4..df6cfff04b 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -391,7 +391,7 @@ static inline int mpeg4_is_resync(Mpeg4DecContext *ctx)
while (v <= 0xFF) {
if (h->c.pict_type == AV_PICTURE_TYPE_B ||
- (v >> (8 - h->c.pict_type) != 1) || h->c.partitioned_frame)
+ (v >> (8 - h->c.pict_type) != 1) || h->partitioned_frame)
break;
skip_bits(&h->gb, 8 + h->c.pict_type);
bits_count += 8 + h->c.pict_type;
@@ -1395,7 +1395,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block,
// FIXME add short header support
if (use_intra_dc_vlc) {
/* DC coef */
- if (h->c.partitioned_frame) {
+ if (h->partitioned_frame) {
level = h->c.dc_val[h->c.block_index[n]];
if (n < 4)
level = FASTDIV((level + (h->c.y_dc_scale >> 1)), h->c.y_dc_scale);
@@ -3222,8 +3222,8 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb,
h->c.low_delay = 0;
}
- h->c.partitioned_frame = h->data_partitioning && h->c.pict_type != AV_PICTURE_TYPE_B;
- if (h->c.partitioned_frame)
+ h->partitioned_frame = h->data_partitioning && h->c.pict_type != AV_PICTURE_TYPE_B;
+ if (h->partitioned_frame)
h->decode_mb = mpeg4_decode_partitioned_mb;
else
h->decode_mb = mpeg4_decode_mb;
@@ -3513,7 +3513,7 @@ static int decode_studio_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
if (get_bits_left(gb) <= 32)
return 0;
- h->c.partitioned_frame = 0;
+ h->partitioned_frame = 0;
h->c.interlaced_dct = 0;
h->decode_mb = mpeg4_decode_studio_mb;
diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index 7432c1f9bd..ced4ad24e7 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -1033,7 +1033,7 @@ static int mpeg4_encode_picture_header(MPVMainEncContext *const m)
mpeg4_encode_gop_header(m);
}
- s->c.partitioned_frame = s->data_partitioning && s->c.pict_type != AV_PICTURE_TYPE_B;
+ s->partitioned_frame = s->data_partitioning && s->c.pict_type != AV_PICTURE_TYPE_B;
put_bits32(&s->pb, VOP_STARTCODE); /* vop header */
put_bits(&s->pb, 2, s->c.pict_type - 1); /* pict type: I = 0 , P = 1 */
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 3b47a02ae1..eb8739014b 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -229,7 +229,6 @@ typedef struct MpegEncContext {
uint16_t pb_field_time; ///< like above, just for interlaced
int mcsel;
int quarter_sample; ///< 1->qpel, 0->half pel ME/MC
- int partitioned_frame; ///< is current frame partitioned
int low_delay; ///< no reordering needed / has no B-frames
/* MSMPEG4 specific */
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index ff6d6a8cd7..e7f40f5d60 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -265,7 +265,7 @@ static void update_duplicate_context_after_me(MPVEncContext *const dst,
COPY(lambda2);
COPY(c.frame_pred_frame_dct); // FIXME don't set in encode_header
COPY(c.progressive_frame); // FIXME don't set in encode_header
- COPY(c.partitioned_frame); // FIXME don't set in encode_header
+ COPY(partitioned_frame); // FIXME don't set in encode_header
#undef COPY
}
@@ -2894,7 +2894,7 @@ static int mb_var_thread(AVCodecContext *c, void *arg){
static void write_slice_end(MPVEncContext *const s)
{
if (CONFIG_MPEG4_ENCODER && s->c.codec_id == AV_CODEC_ID_MPEG4) {
- if (s->c.partitioned_frame)
+ if (s->partitioned_frame)
ff_mpeg4_merge_partitions(s);
ff_mpeg4_stuffing(&s->pb);
@@ -2907,7 +2907,7 @@ static void write_slice_end(MPVEncContext *const s)
flush_put_bits(&s->pb);
- if ((s->c.avctx->flags & AV_CODEC_FLAG_PASS1) && !s->c.partitioned_frame)
+ if ((s->c.avctx->flags & AV_CODEC_FLAG_PASS1) && !s->partitioned_frame)
s->misc_bits+= get_bits_diff(s);
}
@@ -3024,7 +3024,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
s->c.last_dc[1] = 128 * 8 / 14;
s->c.last_dc[2] = 128 * 8 / 14;
#if CONFIG_MPEG4_ENCODER
- } else if (s->c.partitioned_frame) {
+ } else if (s->partitioned_frame) {
av_assert1(s->c.codec_id == AV_CODEC_ID_MPEG4);
ff_mpeg4_init_partitions(s);
#endif
@@ -3120,7 +3120,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
if (s->c.start_mb_y != mb_y || mb_x != 0) {
write_slice_end(s);
- if (CONFIG_MPEG4_ENCODER && s->c.codec_id == AV_CODEC_ID_MPEG4 && s->c.partitioned_frame)
+ if (CONFIG_MPEG4_ENCODER && s->c.codec_id == AV_CODEC_ID_MPEG4 && s->partitioned_frame)
ff_mpeg4_init_partitions(s);
}
diff --git a/libavcodec/mpegvideoenc.h b/libavcodec/mpegvideoenc.h
index ad48ce6df3..0ad1561851 100644
--- a/libavcodec/mpegvideoenc.h
+++ b/libavcodec/mpegvideoenc.h
@@ -162,6 +162,7 @@ typedef struct MPVEncContext {
/* MPEG-4 specific */
int data_partitioning; ///< data partitioning flag, set via option
+ int partitioned_frame; ///< is current frame partitioned
int mpeg_quant;
PutBitContext tex_pb; ///< used for data partitioned VOPs
PutBitContext pb2; ///< used for data partitioned VOPs
More information about the ffmpeg-cvslog
mailing list