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 7AD634F806 for ; Mon, 23 Jun 2025 13:42:03 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 91E6D68E283; Mon, 23 Jun 2025 16:39:13 +0300 (EEST) Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 08D2B68E27E for ; Mon, 23 Jun 2025 16:39:10 +0300 (EEST) Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-3141b84bf65so3848934a91.1 for ; Mon, 23 Jun 2025 06:39:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750685949; x=1751290749; 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=tes9uINvnr4Gp8Vdzj1Po8fE1rEw+IBTazJr8Nxu+l0=; b=HDe0XthqDeNwuLE8EugJUmNHovPDAAu3zcLQMamVTF8Mmayjc3ozuFhTylDBddNXCk 1iarAx9Wz6oExpU+6fzYF8a19jjhE0Cso/JtOlFWXqaBOr0T8SQ2fShy13QaqMKSxmU4 mbs2UwaxcRP4BPxvwAs0e2wcjnTTyX5/QgU9ajrBcPIMLNn5HMjtuwbpyLsf+ET35Awc BNSyKqqjgmcxZqn9sJnqMgrHCnQqUBNX/IH0WpBzCzCDlfyv0mMkIQgPxnJqaL/pQoAi wSo9+s8NdO7TAGIZ0Y+jZguZoh0tvn2uyPo0IgIe/A6PS9OMckZK8TqmRybiWwRAfH/R AM5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750685949; x=1751290749; 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=tes9uINvnr4Gp8Vdzj1Po8fE1rEw+IBTazJr8Nxu+l0=; b=uAdE5FoXIqE45M9OGB8tr7bir7hEaHw7ab7IDkHd9o+E+oOX3PbSAIkQy+ku47C15R 0v+sohOjr6vfhwXf3wp4TVVi7ngC6fwi5IWPsf3Xb7GUuylu9Weeqdc5KMLSV6DLrkPY /sgVAVGsfPh78d4GC+CQNrdWIgDLbQt7H0d58/sqv9Tc2PuprhdlCB+VSHah3D8FVhMs ZHtEDKOUavTTZl7qQplAUBFNU8tg0Qk/cF+vOQN65bwYPUoGI16Ie8eL2Ria7PrtdYac dwpZeZAi4F6ot0Bm/cstSbzIH0K5M+2zgo58kKbQTgCh+vNrm8fM0HpNTAYa5dTQn1Q9 6CWQ== X-Gm-Message-State: AOJu0YzBgN+//ejOVVpr3/bs65tbrhZn8Ov16UrOKfogTd6WGkamhK01 LW2xfOtLIC5HQm7ofJfiuG1nHU1y0WHFtZEkcJAk+MbDBkeXbv0VfZHvKBnx/g== X-Gm-Gg: ASbGncvqt2bDMpmEnWdc7LcY4hwJt4L5eubrvsQ/zRK0/T4F0KdmCZoovB1mD2eaQ8m ma9uecfwtIH4tPEqxErFsl2fn1TQhP8GW+ajMjHnRDWfDiWN+0ILtnHmJ6LmHj8QjC0EE89muLi 6Xg+QtO3ijDuNevYXLKJbEKfkzQQ/hFt1rh86oFI+DMQR77g/aK+7VAckWu6IV/IRCGb48kS4jY ipg4c+cGjG1RZsx39o7sqbAfDaXarMFFzKtGb3ROiczlgwC8OiKIj29564l3elYfDCfrLbH5LVV y5colbT/zatnT6KmWLXvZU/0fK2Qe9R7r57ufm8N0bYndW+L/lUO2br86iaLpnZq0E46yJ7wUnk NtN0gB7GP2TQ65hWy X-Google-Smtp-Source: AGHT+IGtwz3H8WLiHM0BGnO88Ffc6xZUb+SOTudCGPIEPFu1JTrKWR6E2fz8kNzjNYtUkZT7MDX5Sg== X-Received: by 2002:a17:90b:3f8c:b0:308:7270:d6ea with SMTP id 98e67ed59e1d1-3159d8df995mr16550671a91.30.1750685949080; Mon, 23 Jun 2025 06:39:09 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3159df8354bsm9001932a91.18.2025.06.23.06.39.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jun 2025 06:39:08 -0700 (PDT) From: Andreas Rheinhardt X-Google-Original-From: Andreas Rheinhardt Message-Id: <935c4f77b38c6c6bf26456c6f341e4a69d582a6d.1750685809.git.ffmpegagent@gmail.com> In-Reply-To: References: Date: Mon, 23 Jun 2025 13:36:24 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 24/48] avcodec/{h263, mpeg4video}dec: Pass MPVContext*, not Mpeg4DecContext* 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 The code in h263dec.c is not supposed to know that the MPEG-4 decoder uses an Mpeg4DecContext as private context at all (said context is only exposed in a header so that hardware accelerations can access it and for the parser to use). Passing an MPVContext* directly also allows to remove the indirection via AVCodecContext.priv_data. Signed-off-by: Andreas Rheinhardt --- libavcodec/h263dec.c | 4 ++-- libavcodec/ituh263dec.c | 4 ++-- libavcodec/mpeg4videodec.c | 12 ++++++------ libavcodec/mpeg4videodec.h | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 52b17663db..7e454e3406 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -194,7 +194,7 @@ static int decode_slice(MpegEncContext *s) ff_set_qscale(s, s->qscale); if (s->studio_profile) { - if ((ret = ff_mpeg4_decode_studio_slice_header(s->avctx->priv_data)) < 0) + if ((ret = ff_mpeg4_decode_studio_slice_header(s)) < 0) return ret; } @@ -210,7 +210,7 @@ static int decode_slice(MpegEncContext *s) const int qscale = s->qscale; if (CONFIG_MPEG4_DECODER && s->codec_id == AV_CODEC_ID_MPEG4) - if ((ret = ff_mpeg4_decode_partitions(s->avctx->priv_data)) < 0) + if ((ret = ff_mpeg4_decode_partitions(s)) < 0) return ret; /* restore variables which were modified */ diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index fa09ebb84b..f5001200fe 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -240,7 +240,7 @@ int ff_h263_resync(MpegEncContext *s){ if(show_bits(&s->gb, 16)==0){ pos= get_bits_count(&s->gb); if(CONFIG_MPEG4_DECODER && s->codec_id==AV_CODEC_ID_MPEG4) - ret= ff_mpeg4_decode_video_packet_header(s->avctx->priv_data); + ret = ff_mpeg4_decode_video_packet_header(s); else ret= h263_decode_gob_header(s); if(ret>=0) @@ -257,7 +257,7 @@ int ff_h263_resync(MpegEncContext *s){ pos= get_bits_count(&s->gb); if(CONFIG_MPEG4_DECODER && s->codec_id==AV_CODEC_ID_MPEG4) - ret= ff_mpeg4_decode_video_packet_header(s->avctx->priv_data); + ret = ff_mpeg4_decode_video_packet_header(s); else ret= h263_decode_gob_header(s); if(ret>=0) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index c61fd23c48..91b1687884 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -700,9 +700,9 @@ static int decode_new_pred(Mpeg4DecContext *ctx, GetBitContext *gb) { * Decode the next video packet. * @return <0 if something went wrong */ -int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx) +int ff_mpeg4_decode_video_packet_header(MPVContext *const s) { - MpegEncContext *s = &ctx->m; + Mpeg4DecContext *const ctx = (Mpeg4DecContext*)s; int mb_num_bits = av_log2(s->mb_num - 1) + 1; int header_extension = 0, mb_num, len; @@ -799,9 +799,9 @@ static void reset_studio_dc_predictors(MpegEncContext *s) * Decode the next video packet. * @return <0 if something went wrong */ -int ff_mpeg4_decode_studio_slice_header(Mpeg4DecContext *ctx) +int ff_mpeg4_decode_studio_slice_header(MPVContext *const s) { - MpegEncContext *s = &ctx->m; + Mpeg4DecContext *const ctx = (Mpeg4DecContext*)s; GetBitContext *gb = &s->gb; unsigned vlc_len; uint16_t mb_num; @@ -1307,9 +1307,9 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count) * Decode the first and second partition. * @return <0 if error (and sets error type in the error_status_table) */ -int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx) +int ff_mpeg4_decode_partitions(MPVContext *const s) { - MpegEncContext *s = &ctx->m; + Mpeg4DecContext *const ctx = (Mpeg4DecContext*)s; int mb_num; int ret; const int part_a_error = s->pict_type == AV_PICTURE_TYPE_I ? (ER_DC_ERROR | ER_MV_ERROR) : ER_MV_ERROR; diff --git a/libavcodec/mpeg4videodec.h b/libavcodec/mpeg4videodec.h index ae8428fd2b..32ad081df3 100644 --- a/libavcodec/mpeg4videodec.h +++ b/libavcodec/mpeg4videodec.h @@ -116,9 +116,9 @@ void ff_mpeg4_decode_studio(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb void ff_mpeg4_mcsel_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t *const *ref_picture); -int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx); -int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx); -int ff_mpeg4_decode_studio_slice_header(Mpeg4DecContext *ctx); +int ff_mpeg4_decode_partitions(MPVContext *const s); +int ff_mpeg4_decode_video_packet_header(MPVContext *const s); +int ff_mpeg4_decode_studio_slice_header(MPVContext *const s); void ff_mpeg4_workaround_bugs(AVCodecContext *avctx); void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n, int dir); -- 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".