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 D44CA4F7EF for ; Mon, 23 Jun 2025 13:41:27 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 5BACB68E25E; Mon, 23 Jun 2025 16:38:57 +0300 (EEST) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 6B37F68E254 for ; Mon, 23 Jun 2025 16:38:54 +0300 (EEST) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-2349f096605so62576185ad.3 for ; Mon, 23 Jun 2025 06:38:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750685932; x=1751290732; 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=OUeTKBxvK1uVunNhb1MlXW9QA9jhmAjhtd9rBsV6Mpw=; b=NLJXPIu6rq73F0D8/e94DKrljXnmoxJy9t2ve+02iiwgIKXMGxP3EcvTYuiGWs+/c1 V5sUqyYIupvau9hq7AEHSZyRE7hWly7aB3BptMLDxKmCHe9rQlKWp+k/MEp5ESG32ShH 083V735DqW1bLztt4CjJu/xPaKys4GZQBEmSQ9p5akplTHvromoN9Ugr1JC5UHIPqYAD DksSjaogIdfhjp7QvXh2uMgbaWlozE54Q4LsKcIx6N8hrgZBRuRaKogy2Wdnu4GM9zJU nxpKOSmCrGV06B9n0nuRQz5FKvxZ1llTk3JJHEhIu+veTa0g8VLtIF0Pzwj98Mi2dPRd +I3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750685932; x=1751290732; 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=OUeTKBxvK1uVunNhb1MlXW9QA9jhmAjhtd9rBsV6Mpw=; b=Imx4jKF8q3org73DBn3rhvYsC9gGBsNCaa6Lkx+mEVImeW0/Z5hhjikbTTo2YNcZ0L DQOTakgXhAPownqQeSi9vjT+Bsd2AxZkPV4oqE9HPurWcQiuIilIbEodCNyM19AXCxzL VQ9yNO7wgiuCcJUP7hmEs7y58l82P7kNJgYDwrK79RRJcDBrl/DJVrwKcHCZU1/SjWTM ydJdEcYJ8jbo89sqseQ5oP70EXQSxxgze7Ro3bI6W//k/cFh1iTXhEyzP3B92yUGjzUB RWPnauVHEvja53encZQEzO6N0tPSdniPt7SxNaJeXW9Umx9om8gTOm9ELBKDG5mDI69z 8m2g== X-Gm-Message-State: AOJu0YxQJkw4nbeZhq041gcCyer+aG3Jca2MObpU/f6wcOkMkLID+eIh 6ahYpFszCUQxoWGTJXj2ghLwfwT6azuCh67xXV7M7+sCVnoixwBOfTQeB0PtGA== X-Gm-Gg: ASbGncvMi+PE9PKBCsyiJifaAl1y8ckrIgmususjA2RflW0VRZy1FR79lYE0t/Vfuzk KKGqOSkuw3l4SMQ1PU5aJZf9wUddu6JFbJefxxcBoCN6f9lYKpoQ6mk0OSQrq2gHMLFButXQoPI c/u4D0QDhaaOpaXqXfyPr43qG8lEnKAVj9yswVluIEG5aER3KEkME/aAxFugzdM1lm/okTPq0E/ G4HnvPClJp1YDol8xCvRVqjMTUhRyoc3hSnOCQB8gHoO3HUiWVMiHeivnyInQfyPkb9slHA8/WW utMfV0FQi5Tw2GtwPJcA+/ZtdpV9Qfa9ChDP5GJoj6oAS8apJKp5PVDSHth0lT2Ex1jtlO2j5ZL jaxipP6K7G6Jr0zaR X-Google-Smtp-Source: AGHT+IGiXR/YvZDvgn9V3E/XAf9ybAqHEiuAwn6YfjqZnn/7fXhRL/xBcngf+m/tqS9In4Q/vM5Z8g== X-Received: by 2002:a17:902:e5c9:b0:235:1b91:9079 with SMTP id d9443c01a7336-237d991ec7fmr218890785ad.32.1750685932456; Mon, 23 Jun 2025 06:38:52 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-237d8610789sm86564645ad.112.2025.06.23.06.38.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jun 2025 06:38:52 -0700 (PDT) From: Andreas Rheinhardt X-Google-Original-From: Andreas Rheinhardt Message-Id: In-Reply-To: References: Date: Mon, 23 Jun 2025 13:36:21 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 21/48] avcodec/mpegvideo: Move flipflop_rounding to {MSMPEG4Dec, 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 Forgotten in 9964212545554d9ae1afaabd23a7f9a361997d01. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo.h | 1 - libavcodec/mpegvideo_enc.c | 14 +++++++------- libavcodec/mpegvideoenc.h | 1 + libavcodec/msmpeg4dec.c | 8 ++++---- libavcodec/msmpeg4dec.h | 1 + libavcodec/msmpeg4enc.c | 4 ++-- libavcodec/wmv2enc.c | 2 +- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index fe3ae97f5d..a439c1878b 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -265,7 +265,6 @@ typedef struct MpegEncContext { /* MSMPEG4 specific */ int slice_height; ///< in macroblocks int first_slice_line; ///< used in MPEG-4 too to handle resync markers - int flipflop_rounding; enum { MSMP4_UNUSED, MSMP4_V1, diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 1ceb6296c4..8a38e54982 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -927,7 +927,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) s->c.modified_quant = s->c.h263_aic; s->c.loop_filter = (avctx->flags & AV_CODEC_FLAG_LOOP_FILTER) ? 1 : 0; s->c.unrestricted_mv = s->c.obmc || s->c.loop_filter || s->c.umvplus; - s->c.flipflop_rounding = 1; + s->flipflop_rounding = 1; /* /Fx */ /* These are just to be sure */ @@ -968,7 +968,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) s->c.out_format = FMT_H263; s->c.h263_pred = 1; s->c.unrestricted_mv = 1; - s->c.flipflop_rounding = 1; + s->flipflop_rounding = 1; s->c.low_delay = m->max_b_frames ? 0 : 1; avctx->delay = s->c.low_delay ? 0 : (m->max_b_frames + 1); break; @@ -985,7 +985,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) s->c.h263_pred = 1; s->c.unrestricted_mv = 1; s->c.msmpeg4_version = MSMP4_V3; - s->c.flipflop_rounding = 1; + s->flipflop_rounding = 1; avctx->delay = 0; s->c.low_delay = 1; break; @@ -994,7 +994,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) s->c.h263_pred = 1; s->c.unrestricted_mv = 1; s->c.msmpeg4_version = MSMP4_WMV1; - s->c.flipflop_rounding = 1; + s->flipflop_rounding = 1; avctx->delay = 0; s->c.low_delay = 1; break; @@ -1003,7 +1003,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) s->c.h263_pred = 1; s->c.unrestricted_mv = 1; s->c.msmpeg4_version = MSMP4_WMV2; - s->c.flipflop_rounding = 1; + s->flipflop_rounding = 1; avctx->delay = 0; s->c.low_delay = 1; break; @@ -2022,7 +2022,7 @@ vbv_retry: s->c.mb_skipped = 0; // done in frame_start() // done in encode_picture() so we must undo it if (s->c.pict_type == AV_PICTURE_TYPE_P) { - s->c.no_rounding ^= s->c.flipflop_rounding; + s->c.no_rounding ^= s->flipflop_rounding; } if (s->c.pict_type != AV_PICTURE_TYPE_B) { s->c.time_base = s->c.last_time_base; @@ -3734,7 +3734,7 @@ static int encode_picture(MPVMainEncContext *const m, const AVPacket *pkt) if (s->c.pict_type == AV_PICTURE_TYPE_I) { s->c.no_rounding = s->c.msmpeg4_version >= MSMP4_V3; } else if (s->c.pict_type != AV_PICTURE_TYPE_B) { - s->c.no_rounding ^= s->c.flipflop_rounding; + s->c.no_rounding ^= s->flipflop_rounding; } if (s->c.avctx->flags & AV_CODEC_FLAG_PASS2) { diff --git a/libavcodec/mpegvideoenc.h b/libavcodec/mpegvideoenc.h index 8ad2fe2e8a..2a04abab26 100644 --- a/libavcodec/mpegvideoenc.h +++ b/libavcodec/mpegvideoenc.h @@ -155,6 +155,7 @@ typedef struct MPVEncContext { PutBitContext pb2; ///< used for data partitioned VOPs /* MSMPEG4 specific */ + int flipflop_rounding; ///< also used for MPEG-4, H.263+ int esc3_level_length; /* RTP specific */ diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c index df5ab5186e..55e51aff3c 100644 --- a/libavcodec/msmpeg4dec.c +++ b/libavcodec/msmpeg4dec.c @@ -544,7 +544,7 @@ int ff_msmpeg4_decode_picture_header(MpegEncContext * s) ms->per_mb_rl_table, s->qscale); - if(s->flipflop_rounding){ + if (ms->flipflop_rounding) { s->no_rounding ^= 1; }else{ s->no_rounding = 0; @@ -570,13 +570,13 @@ int ff_msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size) skip_bits(&s->gb, 5); /* fps */ ms->bit_rate = get_bits(&s->gb, 11) * 1024; if (s->msmpeg4_version >= MSMP4_V3) - s->flipflop_rounding= get_bits1(&s->gb); + ms->flipflop_rounding = get_bits1(&s->gb); else - s->flipflop_rounding= 0; + ms->flipflop_rounding = 0; } else if(leftflipflop_rounding= 0; + ms->flipflop_rounding = 0; if (s->msmpeg4_version != MSMP4_V2) av_log(s->avctx, AV_LOG_ERROR, "ext header missing, %d left\n", left); } diff --git a/libavcodec/msmpeg4dec.h b/libavcodec/msmpeg4dec.h index b04331fd47..862c50b3f0 100644 --- a/libavcodec/msmpeg4dec.h +++ b/libavcodec/msmpeg4dec.h @@ -31,6 +31,7 @@ typedef struct MSMP4DecContext { MpegEncContext m; int bit_rate; + int flipflop_rounding; int mv_table_index; int rl_table_index; int rl_chroma_table_index; diff --git a/libavcodec/msmpeg4enc.c b/libavcodec/msmpeg4enc.c index 3449328b3c..bcb4af23e9 100644 --- a/libavcodec/msmpeg4enc.c +++ b/libavcodec/msmpeg4enc.c @@ -298,9 +298,9 @@ void ff_msmpeg4_encode_ext_header(MPVEncContext *const s) put_bits(&s->pb, 11, FFMIN(m->bit_rate / 1024, 2047)); if (s->c.msmpeg4_version >= MSMP4_V3) - put_bits(&s->pb, 1, s->c.flipflop_rounding); + put_bits(&s->pb, 1, s->flipflop_rounding); else - av_assert0(!s->c.flipflop_rounding); + av_assert0(!s->flipflop_rounding); } void ff_msmpeg4_encode_motion(MSMPEG4EncContext *const ms, diff --git a/libavcodec/wmv2enc.c b/libavcodec/wmv2enc.c index 592d1060d3..0eef5b7cfb 100644 --- a/libavcodec/wmv2enc.c +++ b/libavcodec/wmv2enc.c @@ -94,7 +94,7 @@ static int wmv2_encode_picture_header(MPVMainEncContext *const m) w->abt_type = 0; w->j_type = 0; - av_assert0(s->c.flipflop_rounding); + av_assert0(s->flipflop_rounding); if (s->c.pict_type == AV_PICTURE_TYPE_I) { av_assert0(s->c.no_rounding == 1); -- 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".