From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id A78574F887 for ; Mon, 23 Jun 2025 13:46:44 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 4DDA268E35D; Mon, 23 Jun 2025 16:41:10 +0300 (EEST) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id AE1FF68E347 for ; Mon, 23 Jun 2025 16:41:08 +0300 (EEST) Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-234c5b57557so43245285ad.3 for ; Mon, 23 Jun 2025 06:41:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750686066; x=1751290866; darn=ffmpeg.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date :references:in-reply-to:message-id:from:from:to:cc:subject:date :message-id:reply-to; bh=kNYWOekgwz50ZnBUmh7NtLtFG9WdWPYDdzWC9ghw1qU=; b=P2WoG7hPA6PrQskK/Lg0XIxePNGnxAKqbvFZiv7/9KUd9Pbk5A8QrEZ1CFg8fM76Ny QPnpvXFtKnT6W3uY6y19Nf27lCEaDoe/Y+iz3v2ROPUhcBW3QeueP2ctGIVTks5jPPuO I4BCtCE+ywiWkTVg2fwcZK9hmzSw6JJIcuiG9GC8SfgzrpN5JoXbPjdfLkG+hGQJTbVi Ig3TfPVK40iBfc8KxKsMSBOgufWVTAWdf52bPtGgeBuRtXvDX8TzjSO6EIR+7HPzM+w+ f+Iu2nJuu5JUJghHg1/jjNce1Tsv7z7TSA5NJ/5AqieTi9e1xdqrV9o08jCvVp0ZgNbw x14Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750686066; x=1751290866; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date :references:in-reply-to:message-id:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=kNYWOekgwz50ZnBUmh7NtLtFG9WdWPYDdzWC9ghw1qU=; b=DB7/7m5cia0F/mitcZ81Ul3fVbislyqK3IJ8lduQv1t40wBBNdaRjz0gE5SPqfCOtD YobeznJahOTSTJgvUlYtR0+gLZajdqdJw3CbqWQbJuPl0gwYfgGOQDf8OwPVJJ2wlwBU 6SM76l9cCdrvo8zOf5CyP2tU14p2wGiwo1sWcRk+caY5ZUygnc+SGCd1fAzOxAEPrBk6 7FfgV6cbWmqPpvvkjoUu98+8Zr9MnsmLTlxDFcbmtvZtYazMLyox9t1EFjw9dGiuWuxz yXj2hgg3ewHDyrPKovITzhPKw1lN8F1evVKbA/JHWlCxrdVXGn8Uz/PcAyNhu/vBCZ8v qbEQ== X-Gm-Message-State: AOJu0YwRzLbWGVfPqdtHb8JQpCBGxy0TvHkZzKfk0uYfzVWI/sceeBBz I2ccpcHVJKOuplmzQJkLkJxn3EeGauDZ2u5/dPedUSjV06FeE2KZY4xDQMBaQw== X-Gm-Gg: ASbGncun+ePICpTwtti6lB4gcVhSRvoM4cFaRqW+8tY0Bt96PnoZtIIDVpmjlFRjcLM WH2Au5JQuKQb0KOIdGo+menPAzMHidhz/jWW4Xlvzq4wR2GizLvpZafn4C8T+zcNCBlKZVrFqx3 zYeYJ+KokweNrYGAYJQOeHDrAINqsPZMMaiW8uDbDqmWr53mkbXNFDmCsxw+/KJGG2hHP/aq4Eu 5Qsx6AXdfxMYy2DphB8AYuHwr/5NIqH04vzO88XT9bTSlQq36Ci2g30/pDvqKrOx2qfQAYq2zmV TbB0iQx3nVJQBzBKIVK0y2hKj6DYbHCVmO9wyCBCgfRec6uFmJMMir1NJQ0jvFwndBwJ6FAzhCZ 0wAabx49kCpyyb9iI X-Google-Smtp-Source: AGHT+IEhhtPXCqf1/sk+JZL2PYbjbZ7vyg5fXdEDZwQxt6QwlKr3fGL+cfL0LPwZ7lbLiPbhqUgYzw== X-Received: by 2002:a17:903:3bc4:b0:224:10a2:cae7 with SMTP id d9443c01a7336-237d9981dc9mr208133385ad.40.1750686065649; Mon, 23 Jun 2025 06:41:05 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-237d8393249sm83322955ad.14.2025.06.23.06.41.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jun 2025 06:41:05 -0700 (PDT) From: Andreas Rheinhardt X-Google-Original-From: Andreas Rheinhardt Message-Id: In-Reply-To: References: Date: Mon, 23 Jun 2025 13:36:45 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 45/48] avcodec/mpegvideo: Move partitioned_frame to {H263Dec, MPVEnc}Context X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Andreas Rheinhardt Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- 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".