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 ED0C04F886 for ; Mon, 23 Jun 2025 13:44:26 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 6373D68E2FE; Mon, 23 Jun 2025 16:40:13 +0300 (EEST) Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 6F92868E2F5 for ; Mon, 23 Jun 2025 16:40:12 +0300 (EEST) Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-7424ccbef4eso3216373b3a.2 for ; Mon, 23 Jun 2025 06:40:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750686011; x=1751290811; 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=DtKnMQzRUs7BPINRHqzlDLyVkGpRHLtxWVeiiNsUJ64=; b=cGY4t4gXZ5dWj7yFlI+hdKEB8ooOGRkGFBcATTrP47bZ6CRwXYk42XkXSOAc7ktSrs aLy2d7UWzKLne10gByyvyGsZKGE1q2/omHVcGYMG4Jr2uj4ZbtqZ1+jNwdpvr663lxnA ms5clp0swdoMJTrQoD/MneR/RZue9ZlOjJaFtmnbaOE7FEau5Gycxnau7zgaEGY8Eb6A UVatCDjWWGTsh+cFk608CLIEi6D1NgsrACcxlO23MC9Bhv0nHMTxsf88NTHpxJu+7A0p 1fNJAoQ5IgPFBzIPsckEnq9gx543c6MCOnEpsfYygXl5pBf7Ebt8QSg/Zpx+b4I6u0kj LEXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750686011; x=1751290811; 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=DtKnMQzRUs7BPINRHqzlDLyVkGpRHLtxWVeiiNsUJ64=; b=nEV/P8dqIEejSKrQCIyUkLuf2bu7NaF4TgjSZMydjjBbH4Se3CGMeBcznZGXDeWEnT BHgeXqdMi7LZCzPSe/aU9kAzemVkzgzzsWLL4QRi7IOixfYifwKm7eIgOF0j3pGQIEST dUTWcI4J5Yx/d2Fxn3vsnuMb6725JR36p8XXapGExx3sFP4agrEwvOmOqqh9zQzuMNe/ AxvQCLuIOYTYP9MjSV7y0nTDzQchhhFImbjqN88xKpNz3YZe9S/chGZ88PT/pyr/VxQI Q99Gx7XgObxl7nuSYOgWAP1vhrxRTxCkoSrILAx+nZFzwO8uuOvdxrGpuDAOA+4JHUqU jGZw== X-Gm-Message-State: AOJu0YyefuZ0deYsTQaZE15aiN0JzfHNvf9dr1BzfH+exWy3hemeBZ0v 9e+XZAP83iGSbsvNFxHyTBQNj0jYSFhNZKWO/H6IxlcykVRy1L/su2TjbpK7EA== X-Gm-Gg: ASbGncsnrwAMpK/DBrHyalyrj2buZ5pbO7G+9nJ0qiVLh7ayk3doszeYQzNqPqK6f25 6ysNhYgp5opwBsDfs6U6iSfrMTYakf1yBzyh48A/PK3rJ/oKi4B8qDHTLl6jO93Wa1gw/efwhS7 Qm9Jt+Dj2dy7PN9JVqJXwVVY/AGHGb8fkwH618a52YQ9dpplaSYYMOs62GOr8NU5ZMpGReSRJg8 /9appQmh6EeXWAusyAHBtXDRgg+auo014SOGE39z/+pT+/ePL5zDFuFtlZ9r2KTvwJXXqphyhv2 1YYuxfsR7KS0EFPObN8LXpxJ/V+fAfRtbCjSfpWHSkXghL0xbZ6e9T5QXCIVwU8QD6ZL3se3hcm DfStclBYPY9BuVkZd X-Google-Smtp-Source: AGHT+IGdzFRtLTcsvCQlcvS1s57VNSnLFW3OAiGAH2YtWhmE8yMAQYw4Fb+Jn8H5GLnCr13yKeDoMQ== X-Received: by 2002:a05:6a20:430d:b0:215:d4be:b0b2 with SMTP id adf61e73a8af0-22026fe9e4amr22992929637.34.1750686010643; Mon, 23 Jun 2025 06:40:10 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7490a46b5fesm8506213b3a.36.2025.06.23.06.40.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jun 2025 06:40:10 -0700 (PDT) From: Andreas Rheinhardt X-Google-Original-From: Andreas Rheinhardt Message-Id: <6ac3d3e3af5f63320824f4eba373d2cf6840b407.1750685809.git.ffmpegagent@gmail.com> In-Reply-To: References: Date: Mon, 23 Jun 2025 13:36:35 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 35/48] avcodec/mpegvideo: Move mb_num_left to {H263, RV34}DecContext 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.h | 2 ++ libavcodec/ituh263dec.c | 2 +- libavcodec/mpeg4videodec.c | 4 ++-- libavcodec/mpegvideo.h | 1 - libavcodec/rv10.c | 2 +- libavcodec/rv34.c | 16 ++++++++-------- libavcodec/rv34.h | 2 ++ 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/libavcodec/h263dec.h b/libavcodec/h263dec.h index dd63eca5be..90340a59bd 100644 --- a/libavcodec/h263dec.h +++ b/libavcodec/h263dec.h @@ -50,6 +50,8 @@ typedef struct H263DecContext { GetBitContext gb; + int mb_num_left; ///< number of MBs left in this video packet (for partitioned slices only) + int pb_frame; ///< PB-frame mode (0 = none, 1 = base, 2 = improved) /* motion compensation */ diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index 11be8189a6..94cde850b5 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -1061,7 +1061,7 @@ intra: return -1; if (h->c.obmc && !h->c.mb_intra) { if (h->c.pict_type == AV_PICTURE_TYPE_P && - h->c.mb_x + 1 < h->c.mb_width && h->c.mb_num_left != 1) + h->c.mb_x + 1 < h->c.mb_width && h->mb_num_left != 1) preview_obmc(h); } end: diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index f3af523b7c..c53f5c103a 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -1335,7 +1335,7 @@ int ff_mpeg4_decode_partitions(H263DecContext *const h) return AVERROR_INVALIDDATA; } - h->c.mb_num_left = mb_num; + h->mb_num_left = mb_num; if (h->c.pict_type == AV_PICTURE_TYPE_I) { while (show_bits(&h->gb, 9) == 1) @@ -1723,7 +1723,7 @@ static int mpeg4_decode_partitioned_mb(H263DecContext *const h) } /* per-MB end of slice check */ - if (--h->c.mb_num_left <= 0) { + if (--h->mb_num_left <= 0) { if (mpeg4_is_resync(ctx)) return SLICE_END; else diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index ff3a249512..7e92ac8be9 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -214,7 +214,6 @@ typedef struct MpegEncContext { /* error concealment / resync */ int resync_mb_x; ///< x position of last resync marker int resync_mb_y; ///< y position of last resync marker - int mb_num_left; ///< number of MBs left in this video packet (for partitioned Slices only) /* H.263 specific */ int gob_index; diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index bbd0482d59..c104efc212 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -481,7 +481,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, ff_init_block_index(&h->c); /* decode each macroblock */ - for (h->c.mb_num_left = mb_count; h->c.mb_num_left > 0; h->c.mb_num_left--) { + for (h->mb_num_left = mb_count; h->mb_num_left > 0; h->mb_num_left--) { int ret; ff_update_block_index(&h->c, 8, h->c.avctx->lowres, 1); ff_tlog(avctx, "**mb x=%d y=%d\n", h->c.mb_x, h->c.mb_y); diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index 9f8a0f12b8..bb08c9bc5c 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -1362,7 +1362,7 @@ static int check_slice_end(RV34DecContext *r, MpegEncContext *s) int bits; if(s->mb_y >= s->mb_height) return 1; - if(!s->mb_num_left) + if (!r->mb_num_left) return 1; if(r->s.mb_skip_run > 1) return 0; @@ -1446,7 +1446,7 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int r->si.end = end; s->qscale = r->si.quant; - s->mb_num_left = r->si.end - r->si.start; + r->mb_num_left = r->si.end - r->si.start; r->s.mb_skip_run = 0; mb_pos = s->mb_x + s->mb_y * s->mb_width; @@ -1492,7 +1492,7 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int } if(s->mb_x == s->resync_mb_x) s->first_slice_line=0; - s->mb_num_left--; + r->mb_num_left--; } ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END); @@ -1579,7 +1579,7 @@ static int finish_frame(AVCodecContext *avctx, AVFrame *pict) ff_er_frame_end(&s->er, NULL); ff_mpv_frame_end(s); - s->mb_num_left = 0; + r->mb_num_left = 0; if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) ff_thread_progress_report(&s->cur_pic.ptr->progress, INT_MAX); @@ -1667,9 +1667,9 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, /* first slice */ if (si.start == 0) { - if (s->mb_num_left > 0 && s->cur_pic.ptr) { + if (r->mb_num_left > 0 && s->cur_pic.ptr) { av_log(avctx, AV_LOG_ERROR, "New frame but still %d MB left.\n", - s->mb_num_left); + r->mb_num_left); if (!s->context_reinit) ff_er_frame_end(&s->er, NULL); ff_mpv_frame_end(s); @@ -1772,7 +1772,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, size = offset1 - offset; r->si.end = s->mb_width * s->mb_height; - s->mb_num_left = r->s.mb_x + r->s.mb_y*r->s.mb_width - r->si.start; + r->mb_num_left = r->s.mb_x + r->s.mb_y*r->s.mb_width - r->si.start; if(i+1 < slice_count){ int offset2 = get_slice_offset(avctx, slices_hdr, i+2, slice_count, buf_size); @@ -1808,7 +1808,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, * only complete frames */ ff_er_frame_end(&s->er, NULL); ff_mpv_frame_end(s); - s->mb_num_left = 0; + r->mb_num_left = 0; ff_thread_progress_report(&s->cur_pic.ptr->progress, INT_MAX); return AVERROR_INVALIDDATA; } diff --git a/libavcodec/rv34.h b/libavcodec/rv34.h index 5bed46ea4f..92bcbba933 100644 --- a/libavcodec/rv34.h +++ b/libavcodec/rv34.h @@ -98,6 +98,8 @@ typedef struct RV34DecContext{ H264PredContext h; ///< functions for 4x4 and 16x16 intra block prediction SliceInfo si; ///< current slice information + int mb_num_left; ///< number of MBs left in this video packet + int *mb_type; ///< internal macroblock types int block_type; ///< current block type int luma_vlc; ///< which VLC set will be used for decoding of luma blocks -- 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".