[FFmpeg-devel] [PATCH v1 16/23] avcodec/vvc/dsp: update the interface of pred_residual_joint for joint cbcr residual functionality
toqsxw at gmail.com
toqsxw at gmail.com
Wed May 14 16:40:23 EEST 2025
From: Wu Jianhua <toqsxw at outlook.com>
Signed-off-by: Wu Jianhua <toqsxw at outlook.com>
---
libavcodec/vvc/dsp.h | 2 +-
libavcodec/vvc/dsp_template.c | 11 ++++-------
libavcodec/vvc/intra.c | 2 +-
3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/libavcodec/vvc/dsp.h b/libavcodec/vvc/dsp.h
index fc4c3a6799..25b7755109 100644
--- a/libavcodec/vvc/dsp.h
+++ b/libavcodec/vvc/dsp.h
@@ -123,7 +123,7 @@ typedef struct VVCIntraDSPContext {
typedef struct VVCItxDSPContext {
void (*add_residual)(uint8_t *dst, const int *res, int width, int height, ptrdiff_t stride);
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 (*pred_residual_joint)(int *dst, const int *src, int width, int height, int c_sign, int shift);
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);
diff --git a/libavcodec/vvc/dsp_template.c b/libavcodec/vvc/dsp_template.c
index 1aa1e027bd..c6dc6e22a7 100644
--- a/libavcodec/vvc/dsp_template.c
+++ b/libavcodec/vvc/dsp_template.c
@@ -62,15 +62,12 @@ static void FUNC(add_residual_joint)(uint8_t *_dst, const int *res,
}
}
-static void FUNC(pred_residual_joint)(int *buf, const int w, const int h,
+static void FUNC(pred_residual_joint)(int *dst, const int *src, const int w, const int h,
const int c_sign, const int shift)
{
- for (int y = 0; y < h; y++) {
- for (int x = 0; x < w; x++) {
- *buf = ((*buf) * c_sign) >> shift;
- buf++;
- }
- }
+ const int size = w * h;
+ for (int i = 0; i < size; i++)
+ dst[i] = (src[i] * c_sign) >> shift;
}
static void FUNC(transform_bdpcm)(int *coeffs, const int width, const int height,
diff --git a/libavcodec/vvc/intra.c b/libavcodec/vvc/intra.c
index 7f772fa4ae..bdcb193077 100644
--- a/libavcodec/vvc/intra.c
+++ b/libavcodec/vvc/intra.c
@@ -178,7 +178,7 @@ static void add_residual_for_joint_coding_chroma(VVCLocalContext *lc,
uint8_t *dst = &fc->frame->data[c_idx][(tb->y0 >> vs) * stride +
((tb->x0 >> hs) << fc->ps.sps->pixel_shift)];
if (chroma_scale) {
- fc->vvcdsp.itx.pred_residual_joint(tb->coeffs, tb->tb_width, tb->tb_height, c_sign, shift);
+ fc->vvcdsp.itx.pred_residual_joint(tb->coeffs, tb->coeffs, tb->tb_width, tb->tb_height, c_sign, shift);
fc->vvcdsp.intra.lmcs_scale_chroma(lc, tb->coeffs, tb->coeffs, tb->tb_width, tb->tb_height, cu->x0, cu->y0);
fc->vvcdsp.itx.add_residual(dst, tb->coeffs, tb->tb_width, tb->tb_height, stride);
} else {
--
2.44.0.windows.1
More information about the ffmpeg-devel
mailing list