* [FFmpeg-devel] [PATCH v2 2/3] avcodec/vvc/cabac: remove vvc_refill2 [not found] <20240808191344.1017-1-toqsxw@outlook.com> @ 2024-08-08 19:13 ` toqsxw 2024-08-08 20:19 ` Andreas Rheinhardt 2024-08-08 19:13 ` [FFmpeg-devel] [PATCH v2 3/3] avcodec/vvc/dsp: prefix TxType and TxSize with VVC toqsxw 1 sibling, 1 reply; 4+ messages in thread From: toqsxw @ 2024-08-08 19:13 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Wu Jianhua From: Wu Jianhua <toqsxw@outlook.com> See https://github.com/ffvvc/FFmpeg/issues/178 Signed-off-by: Wu Jianhua <toqsxw@outlook.com> --- libavcodec/cabac_functions.h | 2 +- libavcodec/vvc/cabac.c | 28 +--------------------------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/libavcodec/cabac_functions.h b/libavcodec/cabac_functions.h index c3f08d3410..9bee401f2c 100644 --- a/libavcodec/cabac_functions.h +++ b/libavcodec/cabac_functions.h @@ -85,7 +85,7 @@ static inline void renorm_cabac_decoder_once(CABACContext *c){ } #endif -#ifndef get_cabac_inline +#if !defined(get_cabac_inline) || !defined(refill2) static void refill2(CABACContext *c){ int i; unsigned x; diff --git a/libavcodec/vvc/cabac.c b/libavcodec/vvc/cabac.c index 0d45eec751..c9b6f9bf3e 100644 --- a/libavcodec/vvc/cabac.c +++ b/libavcodec/vvc/cabac.c @@ -856,32 +856,6 @@ int ff_vvc_cabac_init(VVCLocalContext *lc, return ret; } -//fixme -static void vvc_refill2(CABACContext* c) { - int i; - unsigned x; -#if !HAVE_FAST_CLZ - x = c->low ^ (c->low - 1); - i = 7 - ff_h264_norm_shift[x >> (CABAC_BITS - 1)]; -#else - i = ff_ctz(c->low) - CABAC_BITS; -#endif - - x = -CABAC_MASK; - -#if CABAC_BITS == 16 - x += (c->bytestream[0] << 9) + (c->bytestream[1] << 1); -#else - x += c->bytestream[0] << 1; -#endif - - c->low += x << i; -#if !UNCHECKED_BITSTREAM_READER - if (c->bytestream < c->bytestream_end) -#endif - c->bytestream += CABAC_BITS / 8; -} - static int inline vvc_get_cabac(CABACContext *c, VVCCabacState* base, const int ctx) { VVCCabacState *s = base + ctx; @@ -904,7 +878,7 @@ static int inline vvc_get_cabac(CABACContext *c, VVCCabacState* base, const int c->low <<= lps_mask; if (!(c->low & CABAC_MASK)) - vvc_refill2(c); + refill2(c); s->state[0] = s->state[0] - (s->state[0] >> s->shift[0]) + (1023 * bit >> s->shift[0]); s->state[1] = s->state[1] - (s->state[1] >> s->shift[1]) + (16383 * bit >> s->shift[1]); return bit; -- 2.44.0.windows.1 _______________________________________________ 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". ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 2/3] avcodec/vvc/cabac: remove vvc_refill2 2024-08-08 19:13 ` [FFmpeg-devel] [PATCH v2 2/3] avcodec/vvc/cabac: remove vvc_refill2 toqsxw @ 2024-08-08 20:19 ` Andreas Rheinhardt 2024-08-10 20:20 ` [FFmpeg-devel] 回复: " Wu Jianhua 0 siblings, 1 reply; 4+ messages in thread From: Andreas Rheinhardt @ 2024-08-08 20:19 UTC (permalink / raw) To: ffmpeg-devel toqsxw@outlook.com: > From: Wu Jianhua <toqsxw@outlook.com> > > See https://github.com/ffvvc/FFmpeg/issues/178 This link only sends one to a patchwork thread to read. The commit message should instead explain why this is done on its own (and may refer to the mailing list thread for a more detailed explanation). Same for the next patch. > > Signed-off-by: Wu Jianhua <toqsxw@outlook.com> > --- > libavcodec/cabac_functions.h | 2 +- > libavcodec/vvc/cabac.c | 28 +--------------------------- > 2 files changed, 2 insertions(+), 28 deletions(-) > > diff --git a/libavcodec/cabac_functions.h b/libavcodec/cabac_functions.h > index c3f08d3410..9bee401f2c 100644 > --- a/libavcodec/cabac_functions.h > +++ b/libavcodec/cabac_functions.h > @@ -85,7 +85,7 @@ static inline void renorm_cabac_decoder_once(CABACContext *c){ > } > #endif > > -#ifndef get_cabac_inline > +#if !defined(get_cabac_inline) || !defined(refill2) > static void refill2(CABACContext *c){ > int i; > unsigned x; > diff --git a/libavcodec/vvc/cabac.c b/libavcodec/vvc/cabac.c > index 0d45eec751..c9b6f9bf3e 100644 > --- a/libavcodec/vvc/cabac.c > +++ b/libavcodec/vvc/cabac.c > @@ -856,32 +856,6 @@ int ff_vvc_cabac_init(VVCLocalContext *lc, > return ret; > } > > -//fixme > -static void vvc_refill2(CABACContext* c) { > - int i; > - unsigned x; > -#if !HAVE_FAST_CLZ > - x = c->low ^ (c->low - 1); > - i = 7 - ff_h264_norm_shift[x >> (CABAC_BITS - 1)]; > -#else > - i = ff_ctz(c->low) - CABAC_BITS; > -#endif > - > - x = -CABAC_MASK; > - > -#if CABAC_BITS == 16 > - x += (c->bytestream[0] << 9) + (c->bytestream[1] << 1); > -#else > - x += c->bytestream[0] << 1; > -#endif > - > - c->low += x << i; > -#if !UNCHECKED_BITSTREAM_READER > - if (c->bytestream < c->bytestream_end) > -#endif > - c->bytestream += CABAC_BITS / 8; > -} > - > static int inline vvc_get_cabac(CABACContext *c, VVCCabacState* base, const int ctx) > { > VVCCabacState *s = base + ctx; > @@ -904,7 +878,7 @@ static int inline vvc_get_cabac(CABACContext *c, VVCCabacState* base, const int > c->low <<= lps_mask; > > if (!(c->low & CABAC_MASK)) > - vvc_refill2(c); > + refill2(c); > s->state[0] = s->state[0] - (s->state[0] >> s->shift[0]) + (1023 * bit >> s->shift[0]); > s->state[1] = s->state[1] - (s->state[1] >> s->shift[1]) + (16383 * bit >> s->shift[1]); > return bit; _______________________________________________ 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". ^ permalink raw reply [flat|nested] 4+ messages in thread
* [FFmpeg-devel] 回复: [PATCH v2 2/3] avcodec/vvc/cabac: remove vvc_refill2 2024-08-08 20:19 ` Andreas Rheinhardt @ 2024-08-10 20:20 ` Wu Jianhua 0 siblings, 0 replies; 4+ messages in thread From: Wu Jianhua @ 2024-08-10 20:20 UTC (permalink / raw) To: ffmpeg-devel From Andreas Rheinhardt: > 发件人: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> 代表 Andreas Rheinhardt <andreas.rheinhardt@outlook.com> > 发送时间: 2024年8月8日 13:19 > 收件人: ffmpeg-devel@ffmpeg.org > 主题: Re: [FFmpeg-devel] [PATCH v2 2/3] avcodec/vvc/cabac: remove vvc_refill2 > > toqsxw@outlook.com: >> From: Wu Jianhua <toqsxw@outlook.com> >> >> See https://github.com/ffvvc/FFmpeg/issues/178 > > This link only sends one to a patchwork thread to read. The commit > message should instead explain why this is done on its own (and may > refer to the mailing list thread for a more detailed explanation). > > Same for the next patch. > > No problem. I will send a new patchset. Thanks, Jianhua _______________________________________________ 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". ^ permalink raw reply [flat|nested] 4+ messages in thread
* [FFmpeg-devel] [PATCH v2 3/3] avcodec/vvc/dsp: prefix TxType and TxSize with VVC [not found] <20240808191344.1017-1-toqsxw@outlook.com> 2024-08-08 19:13 ` [FFmpeg-devel] [PATCH v2 2/3] avcodec/vvc/cabac: remove vvc_refill2 toqsxw @ 2024-08-08 19:13 ` toqsxw 1 sibling, 0 replies; 4+ messages in thread From: toqsxw @ 2024-08-08 19:13 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Wu Jianhua From: Wu Jianhua <toqsxw@outlook.com> See https://github.com/ffvvc/FFmpeg/issues/180 Signed-off-by: Wu Jianhua <toqsxw@outlook.com> --- libavcodec/vvc/dsp.h | 28 ++++++++++++++-------------- libavcodec/vvc/dsp_template.c | 2 +- libavcodec/vvc/intra.c | 26 +++++++++++++------------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/libavcodec/vvc/dsp.h b/libavcodec/vvc/dsp.h index 0b49b97021..38ff492a23 100644 --- a/libavcodec/vvc/dsp.h +++ b/libavcodec/vvc/dsp.h @@ -27,21 +27,21 @@ #include <stdint.h> #include <stddef.h> -enum TxType { - DCT2, - DST7, - DCT8, - N_TX_TYPE, +enum VVCTxType { + VVC_DCT2, + VVC_DST7, + VVC_DCT8, + VVC_N_TX_TYPE, }; -enum TxSize { - TX_SIZE_2, - TX_SIZE_4, - TX_SIZE_8, - TX_SIZE_16, - TX_SIZE_32, - TX_SIZE_64, - N_TX_SIZE, +enum VVCTxSize { + VVC_TX_SIZE_2, + VVC_TX_SIZE_4, + VVC_TX_SIZE_8, + VVC_TX_SIZE_16, + VVC_TX_SIZE_32, + VVC_TX_SIZE_64, + VVC_N_TX_SIZE, }; typedef struct VVCInterDSPContext { @@ -127,7 +127,7 @@ typedef struct VVCItxDSPContext { void (*add_residual_joint)(uint8_t *dst, const int *res, int width, int height, ptrdiff_t stride, int c_sign, int shift); void (*pred_residual_joint)(int *buf, int width, int height, int c_sign, int shift); - void (*itx[N_TX_TYPE][N_TX_SIZE])(int *coeffs, ptrdiff_t step, size_t nz); + void (*itx[VVC_N_TX_TYPE][VVC_N_TX_SIZE])(int *coeffs, ptrdiff_t step, size_t nz); void (*transform_bdpcm)(int *coeffs, int width, int height, int vertical, int log2_transform_range); } VVCItxDSPContext; diff --git a/libavcodec/vvc/dsp_template.c b/libavcodec/vvc/dsp_template.c index 8130abbccf..1aa1e027bd 100644 --- a/libavcodec/vvc/dsp_template.c +++ b/libavcodec/vvc/dsp_template.c @@ -97,7 +97,7 @@ static void FUNC(transform_bdpcm)(int *coeffs, const int width, const int height static void FUNC(ff_vvc_itx_dsp_init)(VVCItxDSPContext *const itx) { #define VVC_ITX(TYPE, type, s) \ - itx->itx[TYPE][TX_SIZE_##s] = ff_vvc_inv_##type##_##s; \ + itx->itx[VVC_##TYPE][VVC_##TX_SIZE_##s] = ff_vvc_inv_##type##_##s; \ #define VVC_ITX_COMMON(TYPE, type) \ VVC_ITX(TYPE, type, 4); \ diff --git a/libavcodec/vvc/intra.c b/libavcodec/vvc/intra.c index f77a012f09..73dca6dc85 100644 --- a/libavcodec/vvc/intra.c +++ b/libavcodec/vvc/intra.c @@ -128,15 +128,15 @@ static void ilfnst_transform(const VVCLocalContext *lc, TransformBlock *tb) } //part of 8.7.4 Transformation process for scaled transform coefficients -static void derive_transform_type(const VVCFrameContext *fc, const VVCLocalContext *lc, const TransformBlock *tb, enum TxType *trh, enum TxType *trv) +static void derive_transform_type(const VVCFrameContext *fc, const VVCLocalContext *lc, const TransformBlock *tb, enum VVCTxType *trh, enum VVCTxType *trv) { const CodingUnit *cu = lc->cu; - static const enum TxType mts_to_trh[] = {DCT2, DST7, DCT8, DST7, DCT8}; - static const enum TxType mts_to_trv[] = {DCT2, DST7, DST7, DCT8, DCT8}; + static const enum VVCTxType mts_to_trh[] = { VVC_DCT2, VVC_DST7, VVC_DCT8, VVC_DST7, VVC_DCT8 }; + static const enum VVCTxType mts_to_trv[] = { VVC_DCT2, VVC_DST7, VVC_DST7, VVC_DCT8, VVC_DCT8 }; const VVCSPS *sps = fc->ps.sps; int implicit_mts_enabled = 0; if (tb->c_idx || (cu->isp_split_type != ISP_NO_SPLIT && cu->lfnst_idx)) { - *trh = *trv = DCT2; + *trh = *trv = VVC_DCT2; return; } @@ -152,11 +152,11 @@ static void derive_transform_type(const VVCFrameContext *fc, const VVCLocalConte const int w = tb->tb_width; const int h = tb->tb_height; if (cu->sbt_flag) { - *trh = (cu->sbt_horizontal_flag || cu->sbt_pos_flag) ? DST7 : DCT8; - *trv = (!cu->sbt_horizontal_flag || cu->sbt_pos_flag) ? DST7 : DCT8; + *trh = (cu->sbt_horizontal_flag || cu->sbt_pos_flag) ? VVC_DST7 : VVC_DCT8; + *trv = (!cu->sbt_horizontal_flag || cu->sbt_pos_flag) ? VVC_DST7 : VVC_DCT8; } else { - *trh = (w >= 4 && w <= 16) ? DST7 : DCT2; - *trv = (h >= 4 && h <= 16) ? DST7 : DCT2; + *trh = (w >= 4 && w <= 16) ? VVC_DST7 : VVC_DCT2; + *trv = (h >= 4 && h <= 16) ? VVC_DST7 : VVC_DCT2; } return; } @@ -447,7 +447,7 @@ static void dequant(const VVCLocalContext *lc, const TransformUnit *tu, Transfor //transmatrix[0][0] #define DCT_A 64 -static void itx_2d(const VVCFrameContext *fc, TransformBlock *tb, const enum TxType trh, const enum TxType trv) +static void itx_2d(const VVCFrameContext *fc, TransformBlock *tb, const enum VVCTxType trh, const enum VVCTxType trv) { const VVCSPS *sps = fc->ps.sps; const int w = tb->tb_width; @@ -456,7 +456,7 @@ static void itx_2d(const VVCFrameContext *fc, TransformBlock *tb, const enum TxT const size_t nzh = tb->max_scan_y + 1; const int shift[] = { 7, 5 + sps->log2_transform_range - sps->bit_depth }; - if (w == h && nzw == 1 && nzh == 1 && trh == DCT2 && trv == DCT2) { + if (w == h && nzw == 1 && nzh == 1 && trh == VVC_DCT2 && trv == VVC_DCT2) { const int add[] = { 1 << (shift[0] - 1), 1 << (shift[1] - 1) }; const int t = (tb->coeffs[0] * DCT_A + add[0]) >> shift[0]; const int dc = (t * DCT_A + add[1]) >> shift[1]; @@ -476,7 +476,7 @@ static void itx_2d(const VVCFrameContext *fc, TransformBlock *tb, const enum TxT scale(tb->coeffs, tb->coeffs, w, h, shift[1]); } -static void itx_1d(const VVCFrameContext *fc, TransformBlock *tb, const enum TxType trh, const enum TxType trv) +static void itx_1d(const VVCFrameContext *fc, TransformBlock *tb, const enum VVCTxType trh, const enum VVCTxType trv) { const VVCSPS *sps = fc->ps.sps; const int w = tb->tb_width; @@ -484,7 +484,7 @@ static void itx_1d(const VVCFrameContext *fc, TransformBlock *tb, const enum TxT const size_t nzw = tb->max_scan_x + 1; const size_t nzh = tb->max_scan_y + 1; - if ((w > 1 && nzw == 1 && trh == DCT2) || (h > 1 && nzh == 1 && trv == DCT2)) { + if ((w > 1 && nzw == 1 && trh == VVC_DCT2) || (h > 1 && nzh == 1 && trv == VVC_DCT2)) { const int shift = 6 + sps->log2_transform_range - sps->bit_depth; const int add = 1 << (shift - 1); const int dc = (tb->coeffs[0] * DCT_A + add) >> shift; @@ -542,7 +542,7 @@ static void itransform(VVCLocalContext *lc, TransformUnit *tu, const int tu_idx, transform_bdpcm(tb, lc, cu); dequant(lc, tu, tb); if (!tb->ts) { - enum TxType trh, trv; + enum VVCTxType trh, trv; if (cu->apply_lfnst_flag[c_idx]) ilfnst_transform(lc, tb); -- 2.44.0.windows.1 _______________________________________________ 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". ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-10 20:20 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20240808191344.1017-1-toqsxw@outlook.com> 2024-08-08 19:13 ` [FFmpeg-devel] [PATCH v2 2/3] avcodec/vvc/cabac: remove vvc_refill2 toqsxw 2024-08-08 20:19 ` Andreas Rheinhardt 2024-08-10 20:20 ` [FFmpeg-devel] 回复: " Wu Jianhua 2024-08-08 19:13 ` [FFmpeg-devel] [PATCH v2 3/3] avcodec/vvc/dsp: prefix TxType and TxSize with VVC toqsxw
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