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 26D724F7F5 for ; Mon, 23 Jun 2025 13:42:55 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 9893968E2AE; Mon, 23 Jun 2025 16:39:35 +0300 (EEST) Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 777B568CD15 for ; Mon, 23 Jun 2025 16:39:33 +0300 (EEST) Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-234fcadde3eso57087395ad.0 for ; Mon, 23 Jun 2025 06:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750685972; x=1751290772; 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=BYmz5JuAIJq2j5tWsaBSKaOfHI+9awjJnuEVXdwhKbs=; b=HVHHJgkF6YNG6hyqi832UH1ZzwUw33fAsSjW20ZhQml5zgbkx0ZSDdKg4BwETB07HP +U9gcOeByfxg5PxPidNi/A6dLSU4wPZqSrhVLGHpPdBDkmCDJHAA235AUd78jF+66ipL 6BuiPRU0t8xph8Vy3jgBH7GSB1ta9t2VEpkq4sMsMcKkD+5ziXe/pvN7uMCRwy76xFdp VqJz3Vfgh5/mKzwKBLSHdOSUmM5hJvNiKWG/vbU0ZNtrtwsA09IDTHkUNS3kaU2s8hG4 cvnD54CeOqIRJR2Nuxy0gTvLuvhrEVVNI6CsEKTO8Q5J8eN6K10sFVFxtCPb9ShZNAyR dBlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750685972; x=1751290772; 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=BYmz5JuAIJq2j5tWsaBSKaOfHI+9awjJnuEVXdwhKbs=; b=lWehpEnwyr0B1gdiHEnU5tkJTTocrN4d5eUI0BDyJiVEEw6GKkbMEqjemJA3IlyV/j eLh1gV0PYJ0dVM5s3CXER+9zz9rkI2tLaxSwOJQU+uKfRjRmGMz8jvdaGbfWt8GaY5tD JyYTj7AWHQvXIBJqdpROOL9AILIXSPz9yjnDzCGl/kLsI7r3fx0HXom3zlQxZf2YVQ5A OqRYxr4V7nWfj9JHJ2cpiOxqjJTcQVG43rdprpE/mjVXQbP3za2EDM74p9xHBVgKK0CW 51ZUwON3M5FmQC60uDgkM2sC0PZnC5Dr46IqVr9jSsHbHkh1Y/vzuWGwqkXigIsT5i2z ws7Q== X-Gm-Message-State: AOJu0YxIlx+SqWIOy7YtUKs2ds6kTP+VLOs08tfw4x5QOsSxV3lsB2f6 9n230cUvNZcSJyx72LS7ByEhxEDG7l+ey//DsBkSOc2dUfvcoIAaSNHDx5CzBA== X-Gm-Gg: ASbGncvj4n7Bsbjl2eo2Fuusd6yDwPi+hY5iLW3oVCv5iKm3SQkEOUUfH/9lmAGYXaT /LzHphlNj9UFqEF94NEh7kz4/QtbUPjzQL+dTQ4e36MbrtaqG617p8JZoqt2LyS21Q26D6ED7/f XyZXrqt2bmUNNsbQxHUwDeZQr1PJk8csQl8zfFXTpT0D3vFuw8PtOQkBS7H92f6jm16DSx95IK0 3alMWg3pjIVb6wDSPDqOuuBXEKP6wYRureyxQdjVEZZipRViPH7z73Hhg4uepLZukYPbChShk6E uw43A2mVnVzHZcukZxCtqvWBgp+k7erzFKoNmS+pv2yUm/3TpeV56Q9vecDd7VJESQMJmjdgNii 7eLO+epFCjw4PbE7P X-Google-Smtp-Source: AGHT+IGpbFEw3s1ffzX8JxQZQNDZJstDYpcvGYgOcW5KcgE16v8UKETqm51pkco3vJOlFEq8W77kCA== X-Received: by 2002:a17:902:ce8c:b0:235:ea0d:ae10 with SMTP id d9443c01a7336-237d97ce44cmr214113795ad.12.1750685971642; Mon, 23 Jun 2025 06:39:31 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-237d8607c96sm83575075ad.138.2025.06.23.06.39.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jun 2025 06:39:31 -0700 (PDT) From: Andreas Rheinhardt X-Google-Original-From: Andreas Rheinhardt Message-Id: <5855c1c65ab5cdebf3ba1cbfc62586275c99c458.1750685809.git.ffmpegagent@gmail.com> In-Reply-To: References: Date: Mon, 23 Jun 2025 13:36:28 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 28/48] avcodec/h263dec: Don't use MpegEncContext.block 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 Instead add the necessary blocks directly to H263DecContext (only six are needed, not 12 as ff_mpv_common_init() currently allocates). Signed-off-by: Andreas Rheinhardt --- libavcodec/h263dec.c | 4 ++-- libavcodec/h263dec.h | 3 +++ libavcodec/ituh263dec.c | 8 ++++---- libavcodec/mpeg4videodec.c | 14 +++++++------- libavcodec/msmpeg4dec.c | 8 ++++---- libavcodec/rv10.c | 2 +- libavcodec/wmv2dec.c | 10 +++++----- 7 files changed, 26 insertions(+), 23 deletions(-) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 5a5a91e675..161f13b1e1 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -272,7 +272,7 @@ static int decode_slice(H263DecContext *const h) if (ret < 0) { const int xy = h->c.mb_x + h->c.mb_y * h->c.mb_stride; if (ret == SLICE_END) { - ff_mpv_reconstruct_mb(&h->c, h->c.block); + ff_mpv_reconstruct_mb(&h->c, h->block); if (h->c.loop_filter) ff_h263_loop_filter(&h->c); @@ -305,7 +305,7 @@ static int decode_slice(H263DecContext *const h) return AVERROR_INVALIDDATA; } - ff_mpv_reconstruct_mb(&h->c, h->c.block); + ff_mpv_reconstruct_mb(&h->c, h->block); if (h->c.loop_filter) ff_h263_loop_filter(&h->c); } diff --git a/libavcodec/h263dec.h b/libavcodec/h263dec.h index f414da16b1..dd5e37a719 100644 --- a/libavcodec/h263dec.h +++ b/libavcodec/h263dec.h @@ -22,6 +22,7 @@ #include "mpegvideo.h" #include "vlc.h" +#include "libavutil/mem_internal.h" /** * Return value for header parsers if frame is not coded. @@ -47,6 +48,8 @@ typedef struct H263DecContext { MPVContext c; int (*decode_mb)(struct H263DecContext *h); + + DECLARE_ALIGNED_32(int16_t, block)[6][64]; } H263DecContext; int ff_h263_decode_motion(H263DecContext *const h, int pred, int f_code); diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index 25a0781024..0c8531dea9 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -808,7 +808,7 @@ int ff_h263_decode_mb(H263DecContext *const h) } }while(cbpc == 20); - h->c.bdsp.clear_blocks(h->c.block[0]); + h->c.bdsp.clear_blocks(h->block[0]); dquant = cbpc & 8; h->c.mb_intra = ((cbpc & 4) != 0); @@ -910,7 +910,7 @@ int ff_h263_decode_mb(H263DecContext *const h) h->c.mb_intra = IS_INTRA(mb_type); if(HAS_CBP(mb_type)){ - h->c.bdsp.clear_blocks(h->c.block[0]); + h->c.bdsp.clear_blocks(h->block[0]); cbpc = get_vlc2(&h->c.gb, cbpc_b_vlc, CBPC_B_VLC_BITS, 1); if (h->c.mb_intra) { dquant = IS_QUANT(mb_type); @@ -1012,7 +1012,7 @@ int ff_h263_decode_mb(H263DecContext *const h) } }while(cbpc == 8); - h->c.bdsp.clear_blocks(h->c.block[0]); + h->c.bdsp.clear_blocks(h->block[0]); dquant = cbpc & 4; h->c.mb_intra = 1; @@ -1051,7 +1051,7 @@ intra: /* decode each block */ for (i = 0; i < 6; i++) { - if (h263_decode_block(h, h->c.block[i], i, cbp&32) < 0) + if (h263_decode_block(h, h->block[i], i, cbp&32) < 0) return -1; cbp+=cbp; } diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index b2f675b9bc..88ddacc87f 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -1708,10 +1708,10 @@ static int mpeg4_decode_partitioned_mb(H263DecContext *const h) if (!IS_SKIP(mb_type)) { int i; - h->c.bdsp.clear_blocks(h->c.block[0]); + h->c.bdsp.clear_blocks(h->block[0]); /* decode each block */ for (i = 0; i < 6; i++) { - if (mpeg4_decode_block(ctx, h->c.block[i], i, cbp & 32, h->c.mb_intra, + if (mpeg4_decode_block(ctx, h->block[i], i, cbp & 32, h->c.mb_intra, use_intra_dc_vlc, ctx->rvlc) < 0) { av_log(h->c.avctx, AV_LOG_ERROR, "texture corrupted at %d %d %d\n", @@ -1792,7 +1792,7 @@ static int mpeg4_decode_mb(H263DecContext *const h) h->c.mb_intra = ((cbpc & 4) != 0); if (h->c.mb_intra) goto intra; - h->c.bdsp.clear_blocks(h->c.block[0]); + h->c.bdsp.clear_blocks(h->block[0]); if (h->c.pict_type == AV_PICTURE_TYPE_S && ctx->vol_sprite_usage == GMC_SPRITE && (cbpc & 16) == 0) @@ -1936,7 +1936,7 @@ static int mpeg4_decode_mb(H263DecContext *const h) if (modb2) { cbp = 0; } else { - h->c.bdsp.clear_blocks(h->c.block[0]); + h->c.bdsp.clear_blocks(h->block[0]); cbp = get_bits(&h->c.gb, 6); } @@ -2073,10 +2073,10 @@ intra: if (!h->c.progressive_sequence) h->c.interlaced_dct = get_bits1(&h->c.gb); - h->c.bdsp.clear_blocks(h->c.block[0]); + h->c.bdsp.clear_blocks(h->block[0]); /* decode each block */ for (i = 0; i < 6; i++) { - if (mpeg4_decode_block(ctx, h->c.block[i], i, cbp & 32, + if (mpeg4_decode_block(ctx, h->block[i], i, cbp & 32, 1, use_intra_dc_vlc, 0) < 0) return AVERROR_INVALIDDATA; cbp += cbp; @@ -2086,7 +2086,7 @@ intra: /* decode each block */ for (i = 0; i < 6; i++) { - if (mpeg4_decode_block(ctx, h->c.block[i], i, cbp & 32, 0, 0, 0) < 0) + if (mpeg4_decode_block(ctx, h->block[i], i, cbp & 32, 0, 0, 0) < 0) return AVERROR_INVALIDDATA; cbp += cbp; } diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c index 9d6fddf89a..06f6367a38 100644 --- a/libavcodec/msmpeg4dec.c +++ b/libavcodec/msmpeg4dec.c @@ -201,9 +201,9 @@ static int msmpeg4v12_decode_mb(H263DecContext *const h) *mb_type_ptr = MB_TYPE_INTRA; } - h->c.bdsp.clear_blocks(h->c.block[0]); + h->c.bdsp.clear_blocks(h->block[0]); for (i = 0; i < 6; i++) { - if (ff_msmpeg4_decode_block(ms, h->c.block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) + if (ff_msmpeg4_decode_block(ms, h->block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) { av_log(h->c.avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", h->c.mb_x, h->c.mb_y, i); @@ -292,9 +292,9 @@ static int msmpeg4v34_decode_mb(H263DecContext *const h) } } - h->c.bdsp.clear_blocks(h->c.block[0]); + h->c.bdsp.clear_blocks(h->block[0]); for (i = 0; i < 6; i++) { - if (ff_msmpeg4_decode_block(ms, h->c.block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) + if (ff_msmpeg4_decode_block(ms, h->block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) { av_log(h->c.avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", h->c.mb_x, h->c.mb_y, i); diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index e6e3c4adc0..c678851ded 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -516,7 +516,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, } if (h->c.pict_type != AV_PICTURE_TYPE_B) ff_h263_update_motion_val(&h->c); - ff_mpv_reconstruct_mb(&h->c, h->c.block); + ff_mpv_reconstruct_mb(&h->c, h->block); if (h->c.loop_filter) ff_h263_loop_filter(&h->c); diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c index e0f0826159..4eb4d00383 100644 --- a/libavcodec/wmv2dec.c +++ b/libavcodec/wmv2dec.c @@ -500,7 +500,7 @@ static int wmv2_decode_mb(H263DecContext *const h) wmv2_pred_motion(w, &mx, &my); if (cbp) { - h->c.bdsp.clear_blocks(h->c.block[0]); + h->c.bdsp.clear_blocks(h->block[0]); if (ms->per_mb_rl_table) { ms->rl_table_index = decode012(&h->c.gb); ms->rl_chroma_table_index = ms->rl_table_index; @@ -522,7 +522,7 @@ static int wmv2_decode_mb(H263DecContext *const h) h->c.mv[0][0][1] = my; for (i = 0; i < 6; i++) { - if ((ret = wmv2_decode_inter_block(w, h->c.block[i], i, (cbp >> (5 - i)) & 1)) < 0) { + if ((ret = wmv2_decode_inter_block(w, h->block[i], i, (cbp >> (5 - i)) & 1)) < 0) { av_log(h->c.avctx, AV_LOG_ERROR, "\nerror while decoding inter block: %d x %d (%d)\n", h->c.mb_x, h->c.mb_y, i); @@ -547,9 +547,9 @@ static int wmv2_decode_mb(H263DecContext *const h) ms->rl_chroma_table_index = ms->rl_table_index; } - h->c.bdsp.clear_blocks(h->c.block[0]); + h->c.bdsp.clear_blocks(h->block[0]); for (i = 0; i < 6; i++) { - ret = ff_msmpeg4_decode_block(ms, h->c.block[i], i, (cbp >> (5 - i)) & 1, NULL); + ret = ff_msmpeg4_decode_block(ms, h->block[i], i, (cbp >> (5 - i)) & 1, NULL); if (ret < 0) { av_log(h->c.avctx, AV_LOG_ERROR, "\nerror while decoding intra block: %d x %d (%d)\n", @@ -580,7 +580,7 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx) decode_ext_header(w); - return ff_intrax8_common_init(avctx, &w->x8, h->c.block[0], + return ff_intrax8_common_init(avctx, &w->x8, h->block[0], s->mb_width, s->mb_height); } -- 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".