Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <ffmpegagent-at-gmail.com@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 45/48] avcodec/mpegvideo: Move partitioned_frame to {H263Dec, MPVEnc}Context
Date: Mon, 23 Jun 2025 13:36:45 +0000
Message-ID: <ab7ec0f679928668dff05be91eb94d8245e2278c.1750685809.git.ffmpegagent@gmail.com> (raw)
In-Reply-To: <pull.102.ffstaging.FFmpeg.1750685808.ffmpegagent@gmail.com>

From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 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 aee52dd2b2..7cd8be850b 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;
@@ -553,7 +553,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
-- 
ffmpeg-codebot

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2025-06-23 13:46 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-23 13:36 [FFmpeg-devel] [PATCH 00/48] H263DecContext ffmpegagent
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 01/48] avcodec/ituh263dec: Use correct logcontext Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 02/48] avcodec/rl: Avoid branch in index lookup Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 03/48] avcodec/ituh263enc: Simplify creating LUT Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 04/48] avcodec/ituh263dec: Only initialize ff_h263_rl_inter when needed Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 05/48] avcodec/mpegvideoenc: Allocate blocks as part of MPVEncContext Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 06/48] avcodec/mpegvideo: Add MPVContext typedef Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 07/48] avcodec/mpegvideo_dec: Factor debugging dct coefficients out Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 08/48] avcodec/mpegvideo_dec: Reindent after the previous commit Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 09/48] avcodec/mpeg_er: Don't use MpegEncContext.block Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 10/48] avcodec/mpegvideodec: Remove size expectation from ff_mpv_reconstruct_mb Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 11/48] avcodec/h261dec: Stop using MpegEncContext.gb Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 12/48] avcodec/h261dec: Don't use MpegEncContext.block Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 13/48] avcodec/mpeg12dec: Put GetBitContext on the stack where advantageous Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 14/48] avcodec/mpeg12dec: Remove unused function parameter Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 15/48] avcodec/rv34: Don't use MpegEncContext.gb Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 16/48] avcodec/rv34: Don't use MpegEncContext.block Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 17/48] avcodec/intrax8: Don't pretend to need more than one int16_t[64] Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 18/48] avcodec/vc1: Stop using MpegEncContext.gb Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 19/48] avcodec/vc1: Don't use MpegEncContext.block Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 20/48] avcodec/mpeg12dec: Deduplicate variables Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 21/48] avcodec/mpegvideo: Move flipflop_rounding to {MSMPEG4Dec, MPVEnc}Context Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 22/48] avcodec/mpegvideo: Move unrestricted_mv to MotionEstContext Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 23/48] avcodec/mpeg4videodec: Avoid unnecessary indirections Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 24/48] avcodec/{h263, mpeg4video}dec: Pass MPVContext*, not Mpeg4DecContext* Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 25/48] avcodec/mpegvideo: Move dct_precision to Mpeg4DecContext Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 26/48] avcodec/h263dec: Add H263DecContext Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 27/48] avcodec/h263dec: Remove redundant block parameter from decode_mb Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 28/48] avcodec/h263dec: Don't use MpegEncContext.block Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 29/48] avcodec/h263dec: Stop using MpegEncContext.gb Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 30/48] avcodec/mpeg12dec: Add Mpeg12SliceContext Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 31/48] avcodec/mpegvideo: Add missing headers Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 32/48] avcodec/mpeg12dec: Move MpegEncContext.gb to Mpeg12SliceContext Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 33/48] avcodec/mpeg12dec: Don't use MPVContext.block Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 34/48] avcodec/mpegvideo: Move fields only used by H.263 decoders to H263DecCtx Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 35/48] avcodec/mpegvideo: Move mb_num_left to {H263, RV34}DecContext Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 36/48] avcodec/mpeg12dec: Put mb_skip_run on the stack Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 37/48] avcodec/mpegvideo: Move mb_skip_run to {RV34Dec, MPVEnc}Context Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 38/48] avcodec/mpegvideo: Move SLICE_* defs to h263dec.h, h261dec.c Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 39/48] avcodec/msmpeg4dec: Move ff_msmpeg4_decode_init() down Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 40/48] avcodec/h263dec: Use function ptr for decode_picture_header Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 41/48] avcodec/ituh263enc: Inline value of h263_flv Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 42/48] avcodec/flvdec: Binarize h263_flv Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 43/48] avcodec/mpegvideo: Move fields to {H263Dec, MPVEnc}Context when possible Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 44/48] avcodec/mpeg_er: Allow to skip setting partitioned_frame, p[pb]_time Andreas Rheinhardt
2025-06-23 13:36 ` Andreas Rheinhardt [this message]
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 46/48] avcodec/mpegvideo: Move loop_filter to {H263Dec, MPVEnc, VC1}Context Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 47/48] avcodec/rv34: Don't report progress unnecessarily Andreas Rheinhardt
2025-06-23 13:36 ` [FFmpeg-devel] [PATCH 48/48] avcodec/rv34: Fix spelling mistake Andreas Rheinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ab7ec0f679928668dff05be91eb94d8245e2278c.1750685809.git.ffmpegagent@gmail.com \
    --to=ffmpegagent-at-gmail.com@ffmpeg.org \
    --cc=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git