From: "Clément Bœsch" <u@pkh.me> To: ffmpeg-devel@ffmpeg.org Cc: "Clément Bœsch" <u@pkh.me> Subject: [FFmpeg-devel] [PATCH 02/35] avcodec/proresenc_kostya: remove unused plane factor variables Date: Mon, 11 Dec 2023 02:35:03 +0100 Message-ID: <20231211014429.1841681-3-u@pkh.me> (raw) In-Reply-To: <20231211014429.1841681-1-u@pkh.me> --- 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".
next prev parent reply other threads:[~2023-12-11 1:45 UTC|newest] Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-12-11 1:35 [FFmpeg-devel] Initial tickering at unifying ProRes encoder Clément Bœsch 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 01/35] avcodec/proresenc_kostya: remove an unnecessary parenthesis level in MAKE_CODE() macro Clément Bœsch 2023-12-12 6:53 ` Stefano Sabatini 2023-12-11 1:35 ` Clément Bœsch [this message] 2023-12-12 6:56 ` [FFmpeg-devel] [PATCH 02/35] avcodec/proresenc_kostya: remove unused plane factor variables Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 03/35] avcodec/proresenc_kostya: remove redundant codebook assignments Clément Bœsch 2023-12-12 7:00 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 04/35] avcodec/proresenc_anatoliy: move run/lev to codebook LUT to shared proresdata Clément Bœsch 2023-12-12 7:02 ` Stefano Sabatini 2023-12-12 8:02 ` Stefano Sabatini 2024-01-08 17:06 ` Clément Bœsch 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 05/35] avcodec/proresenc_kostya: remove one LUT indirection for run/level to codebook mapping Clément Bœsch 2023-12-12 8:16 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 06/35] avcodec/proresenc_anatoliy: remove duplicated define Clément Bœsch 2023-12-16 16:32 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 07/35] avcodec/proresenc_anatoliy: move DC codebook LUT to shared proresdata Clément Bœsch 2023-12-16 16:33 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 08/35] avcodec/proresenc_kostya: save a few operations in DC encoding Clément Bœsch 2023-12-16 16:54 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 09/35] avcodec/proresenc_kostya: fix chroma quantisation matrix in frame header Clément Bœsch 2023-12-16 17:12 ` Stefano Sabatini 2024-01-06 17:12 ` Clément Bœsch 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 10/35] avcodec/proresenc_kostya: simplify quantization matrix bytestream writing Clément Bœsch 2023-12-17 18:18 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 11/35] avcodec/proresenc_anatoliy: use FRAME_ID defined in proresdata.h Clément Bœsch 2023-12-17 18:19 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 12/35] avcodec/proresenc_anatoliy: shuffle encode_codeword() code to match Kostya encoder Clément Bœsch 2023-12-18 0:07 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 13/35] avcodec/proresenc_anatoliy: rework encode_codeword() prototype Clément Bœsch 2023-12-18 0:09 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 14/35] avcodec/proresenc_anatoliy: inline QSCALE() Clément Bœsch 2023-12-18 0:13 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 15/35] avcodec/proresenc_anatoliy: rename new_code/code to code/codebook Clément Bœsch 2023-12-18 0:18 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 16/35] avcodec/proresenc_anatoliy: execute codebook FFMIN() at assignment Clément Bœsch 2023-12-18 0:24 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 17/35] avcodec/proresenc_anatoliy: reduce DC encoding function prototype differences with Kostya encoder Clément Bœsch 2023-12-18 0:26 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 18/35] avcodec/proresenc_anatoliy: directly work with blocks in encode_dcs() Clément Bœsch 2023-12-18 0:30 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 19/35] avcodec/proresenc_anatoliy: import GET_SIGN() macro from Kostya encoder and use it Clément Bœsch 2023-12-18 0:30 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 20/35] avcodec/proresenc_anatoliy: compute sign only once Clément Bœsch 2023-12-18 0:37 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 21/35] avcodec/proresenc_anatoliy: rename new_dc to dc Clément Bœsch 2023-12-18 0:38 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 22/35] avcodec/proresenc_anatoliy: remove IS_NEGATIVE() macro Clément Bœsch 2023-12-18 22:29 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 23/35] avcodec/proresenc_kostya: add Anatoliy copyright Clément Bœsch 2023-12-18 22:30 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 24/35] avcodec/proresenc_anatoliy: rename TO_GOLOMB() to MAKE_CODE() Clément Bœsch 2023-12-18 22:32 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 25/35] avcodec/proresenc_anatoliy: shuffle declarations around in encode_dcs() Clément Bœsch 2023-12-18 22:35 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 26/35] avcodec/proresenc_anatoliy: only pass down the first scale to encode_dcs() Clément Bœsch 2023-12-18 22:36 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 27/35] avcodec/proresenc_anatoliy: remove TO_GOLOMB2() Clément Bœsch 2023-12-23 23:43 ` Stefano Sabatini 2024-01-07 23:00 ` Clément Bœsch 2024-01-09 23:08 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 28/35] avcodec/proresenc_anatoliy: cosmetics to make encode_dcs() identical to the one in Kostya encoder Clément Bœsch 2023-12-23 23:46 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 29/35] avcodec/proresenc_anatoliy: replace get_level() with FFABS() Clément Bœsch 2023-12-24 10:25 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 30/35] avcodec/proresenc_anatoliy: rework encode_ac_coeffs() prototype Clément Bœsch 2023-12-24 10:26 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 31/35] avcodec/proresenc_anatoliy: avoid using ff_ prefix in function arguments Clément Bœsch 2023-12-24 10:27 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 32/35] avcodec/proresenc_anatoliy: rework inner loop in encode_acs() Clément Bœsch 2023-12-24 10:36 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 33/35] avcodec/proresenc_anatoliy: execute AC run/level FFMIN() at assignment Clément Bœsch 2023-12-24 10:40 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 34/35] avcodec/proresenc_anatoliy: make a few cosmetics in encode_acs() Clément Bœsch 2023-12-24 10:45 ` Stefano Sabatini 2023-12-11 1:35 ` [FFmpeg-devel] [PATCH 35/35] avcodec/proresenc_kostya: " Clément Bœsch 2023-12-24 10:46 ` Stefano Sabatini 2023-12-11 9:15 ` [FFmpeg-devel] Initial tickering at unifying ProRes encoder Anton Khirnov 2023-12-11 9:36 ` Clément Bœsch 2023-12-24 10:56 ` Stefano Sabatini 2024-01-10 13:22 ` Clément Bœsch
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20231211014429.1841681-3-u@pkh.me \ --to=u@pkh.me \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git