From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 8E13846DDE for ; Mon, 11 Dec 2023 01:45:01 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9DFB568D150; Mon, 11 Dec 2023 03:44:51 +0200 (EET) 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?q?Cl=C3=A9ment=20B=C5=93sch?= 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?q?Cl=C3=A9ment=20B=C5=93sch?= 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: --- 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) -- 2.43.0 _______________________________________________ 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".