From patchwork Mon Dec 11 01:35:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgQsWTc2No?= X-Patchwork-Id: 45029 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1225:b0:181:818d:5e7f with SMTP id v37csp2651569pzf; Sun, 10 Dec 2023 17:45:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IHhALi0s5Xwokz+27SC2c+igTjyYLOgaWmA1uV+wFsbSmEYGkJCqmGqAjSZao/Fhu/g/Uo9 X-Received: by 2002:a50:a6d8:0:b0:550:4412:5f with SMTP id f24-20020a50a6d8000000b005504412005fmr1772833edc.57.1702259104999; Sun, 10 Dec 2023 17:45:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702259104; cv=none; d=google.com; s=arc-20160816; b=rx5b0/n+W8rKt3hraAwZesYm4LRX9OOSV9jwGKiIyJCTJrPgOHGOvNdf0U2QnPI10w UHQBAJuz13tt+tv5lbzJgfFSfqBIQrrvpJyzSZtomZsLt3Xn3ZCb1n9o9OmG7shuctJS fxQvFW6omXmcUpSyel7R7rwio6Tapzzx0TJEHCP1tOF4Aa3GK49jjdXhjRRlJp77fjAy /vIiX1+hdg2f5e7EAJSj/acSnw04u+j4KrSdDCHiEzFarccUCfpRxCVtJyqoqXp0F1Z5 P/kGZ+7mcEsCTRE2GBkaHI4r+8qQmtpapK+l7tkEArxK+0DW7TxmekEERX4+QA6kgD7w tmQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=R245r0N42U2elr3OIJ9IFDCZlB7vGR7qcQQSX1j+GM0=; fh=Jgo3TCyoG8OdFLqA8BuM7Wbf1w27210JU6p+E8x39/M=; b=Uh9g/9dqCfZPbanx76nhYYPwRRQdey3LxUlyz1FTNbOOhkWQPZkgmcOcVQs7rru0Lm pCBtxWlI/lVgBuLzMTfew5Rc7Sb35NVbHO/3hXIuMQ2IUUkBGmLPHF8OVvkknzv0S6mv RQY3NqkIpAma3No664ijOZGTW18msqVYLBvynz4eQDqzM7A/s8vqXiytpiwR9cVCvwiW GxUh6auGm3ksIoDHhgwQEIrO7c9Sb18dF/ae/kwXaEwdGx+X+92YBENNWt+beH2IUjq9 wmdTXxI0SA1g/BW5VGpUu3T4+TSJqGW83iIAYZPRwD4EyyMwDtwIQiM2Xxsy4f3iKtH+ UQ/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@pkh.me header.s=selector1 header.b=otk1ao54; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=pkh.me Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id e24-20020a50a698000000b0054c6709d2d6si3036546edc.260.2023.12.10.17.45.04; Sun, 10 Dec 2023 17:45:04 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@pkh.me header.s=selector1 header.b=otk1ao54; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=pkh.me Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DCA8468D151; Mon, 11 Dec 2023 03:44:51 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ssq0.pkh.me (laubervilliers-656-1-228-164.w92-154.abo.wanadoo.fr [92.154.28.164]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4CF7D68D141 for ; Mon, 11 Dec 2023 03:44:45 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pkh.me; s=selector1; t=1702259074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QTIofhEjTJNRjzJg4R87Cqw8PB9KQuhiEzjsr90ThEI=; b=otk1ao54ax+ucQDY6ek/GR8UGfKzfdLJ6rkVri2xt4ADgu5ZiURkpSehqAZUnMwDEa6JPZ SHv1vbcqcL/cIMDDENAOPuVXU7H3+6ZJsbjeJu2l7cWw3JZkGGqX/aFqRF1hYmh3VWPbxt H1rGQaAwLQHEhTBAk0EW/KwpnFgeSu8= Received: from localhost (ssq0.pkh.me [local]) by ssq0.pkh.me (OpenSMTPD) with ESMTPA id 7ef20322; Mon, 11 Dec 2023 01:44:34 +0000 (UTC) From: =?utf-8?b?Q2zDqW1lbnQgQsWTc2No?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 11 Dec 2023 02:35:03 +0100 Message-ID: <20231211014429.1841681-3-u@pkh.me> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231211014429.1841681-1-u@pkh.me> References: <20231211014429.1841681-1-u@pkh.me> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 02/35] avcodec/proresenc_kostya: remove unused plane factor variables 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: =?utf-8?b?Q2zDqW1lbnQgQsWTc2No?= Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: AmDmkccdPRqU --- libavcodec/proresenc_kostya.c | 36 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c index 58fc340879..7aed3974c3 100644 --- a/libavcodec/proresenc_kostya.c +++ b/libavcodec/proresenc_kostya.c @@ -459,7 +459,6 @@ static void encode_dcs(PutBitContext *pb, int16_t *blocks, static void encode_acs(PutBitContext *pb, int16_t *blocks, int blocks_per_slice, - int plane_size_factor, const uint8_t *scan, const int16_t *qmat) { int idx, i; @@ -494,14 +493,13 @@ static void encode_acs(PutBitContext *pb, int16_t *blocks, static void encode_slice_plane(ProresContext *ctx, PutBitContext *pb, const uint16_t *src, ptrdiff_t linesize, int mbs_per_slice, int16_t *blocks, - int blocks_per_mb, int plane_size_factor, + int blocks_per_mb, const int16_t *qmat) { int blocks_per_slice = mbs_per_slice * blocks_per_mb; encode_dcs(pb, blocks, blocks_per_slice, qmat[0]); - encode_acs(pb, blocks, blocks_per_slice, plane_size_factor, - ctx->scantable, qmat); + encode_acs(pb, blocks, blocks_per_slice, ctx->scantable, qmat); } static void put_alpha_diff(PutBitContext *pb, int cur, int prev, int abits) @@ -575,10 +573,9 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, int i, xp, yp; int total_size = 0; const uint16_t *src; - int slice_width_factor = av_log2(mbs_per_slice); int num_cblocks, pwidth, line_add; ptrdiff_t linesize; - int plane_factor, is_chroma; + int is_chroma; uint16_t *qmat; uint16_t *qmat_chroma; @@ -604,9 +601,6 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, for (i = 0; i < ctx->num_planes; i++) { is_chroma = (i == 1 || i == 2); - plane_factor = slice_width_factor + 2; - if (is_chroma) - plane_factor += ctx->chroma_factor - 3; if (!is_chroma || ctx->chroma_factor == CFACTOR_Y444) { xp = x << 4; yp = y << 4; @@ -631,11 +625,11 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, if (!is_chroma) {/* luma quant */ encode_slice_plane(ctx, pb, src, linesize, mbs_per_slice, ctx->blocks[0], - num_cblocks, plane_factor, qmat); + num_cblocks, qmat); } else { /* chroma plane */ encode_slice_plane(ctx, pb, src, linesize, mbs_per_slice, ctx->blocks[0], - num_cblocks, plane_factor, qmat_chroma); + num_cblocks, qmat_chroma); } } else { get_alpha_data(ctx, src, linesize, xp, yp, @@ -704,7 +698,6 @@ static int estimate_dcs(int *error, int16_t *blocks, int blocks_per_slice, } static int estimate_acs(int *error, int16_t *blocks, int blocks_per_slice, - int plane_size_factor, const uint8_t *scan, const int16_t *qmat) { int idx, i; @@ -742,7 +735,7 @@ static int estimate_acs(int *error, int16_t *blocks, int blocks_per_slice, static int estimate_slice_plane(ProresContext *ctx, int *error, int plane, const uint16_t *src, ptrdiff_t linesize, int mbs_per_slice, - int blocks_per_mb, int plane_size_factor, + int blocks_per_mb, const int16_t *qmat, ProresThreadData *td) { int blocks_per_slice; @@ -751,8 +744,7 @@ static int estimate_slice_plane(ProresContext *ctx, int *error, int plane, blocks_per_slice = mbs_per_slice * blocks_per_mb; bits = estimate_dcs(error, td->blocks[plane], blocks_per_slice, qmat[0]); - bits += estimate_acs(error, td->blocks[plane], blocks_per_slice, - plane_size_factor, ctx->scantable, qmat); + bits += estimate_acs(error, td->blocks[plane], blocks_per_slice, ctx->scantable, qmat); return FFALIGN(bits, 8); } @@ -821,9 +813,8 @@ static int find_slice_quant(AVCodecContext *avctx, ProresContext *ctx = avctx->priv_data; int i, q, pq, xp, yp; const uint16_t *src; - int slice_width_factor = av_log2(mbs_per_slice); int num_cblocks[MAX_PLANES], pwidth; - int plane_factor[MAX_PLANES], is_chroma[MAX_PLANES]; + int is_chroma[MAX_PLANES]; const int min_quant = ctx->profile_info->min_quant; const int max_quant = ctx->profile_info->max_quant; int error, bits, bits_limit; @@ -843,9 +834,6 @@ static int find_slice_quant(AVCodecContext *avctx, for (i = 0; i < ctx->num_planes; i++) { is_chroma[i] = (i == 1 || i == 2); - plane_factor[i] = slice_width_factor + 2; - if (is_chroma[i]) - plane_factor[i] += ctx->chroma_factor - 3; if (!is_chroma[i] || ctx->chroma_factor == CFACTOR_Y444) { xp = x << 4; yp = y << 4; @@ -889,13 +877,13 @@ static int find_slice_quant(AVCodecContext *avctx, bits += estimate_slice_plane(ctx, &error, 0, src, linesize[0], mbs_per_slice, - num_cblocks[0], plane_factor[0], + num_cblocks[0], ctx->quants[q], td); /* estimate luma plane */ for (i = 1; i < ctx->num_planes - !!ctx->alpha_bits; i++) { /* estimate chroma plane */ bits += estimate_slice_plane(ctx, &error, i, src, linesize[i], mbs_per_slice, - num_cblocks[i], plane_factor[i], + num_cblocks[i], ctx->quants_chroma[q], td); } if (bits > 65000 * 8) @@ -926,13 +914,13 @@ static int find_slice_quant(AVCodecContext *avctx, bits += estimate_slice_plane(ctx, &error, 0, src, linesize[0], mbs_per_slice, - num_cblocks[0], plane_factor[0], + num_cblocks[0], qmat, td);/* estimate luma plane */ for (i = 1; i < ctx->num_planes - !!ctx->alpha_bits; i++) { /* estimate chroma plane */ bits += estimate_slice_plane(ctx, &error, i, src, linesize[i], mbs_per_slice, - num_cblocks[i], plane_factor[i], + num_cblocks[i], qmat_chroma, td); } if (bits <= ctx->bits_per_mb * mbs_per_slice)