1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/vvc/intra: make lmcs_scale_chroma inplace

prepare for adaptive color transform

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
This commit is contained in:
Wu Jianhua
2025-05-14 21:40:27 +08:00
committed by Nuo Mi
parent d2e7ca684c
commit ff1ecc7eb3
3 changed files with 6 additions and 8 deletions

View File

@ -106,7 +106,7 @@ struct VVCLocalContext;
typedef struct VVCIntraDSPContext { typedef struct VVCIntraDSPContext {
void (*intra_cclm_pred)(const struct VVCLocalContext *lc, int x0, int y0, int w, int h); void (*intra_cclm_pred)(const struct VVCLocalContext *lc, int x0, int y0, int w, int h);
void (*lmcs_scale_chroma)(struct VVCLocalContext *lc, int *dst, const int *coeff, int w, int h, int x0_cu, int y0_cu); void (*lmcs_scale_chroma)(struct VVCLocalContext *lc, int *coeff, int w, int h, int x0_cu, int y0_cu);
void (*intra_pred)(const struct VVCLocalContext *lc, int x0, int y0, int w, int h, int c_idx); void (*intra_pred)(const struct VVCLocalContext *lc, int x0, int y0, int w, int h, int c_idx);
void (*pred_planar)(uint8_t *src, const uint8_t *top, const uint8_t *left, int w, int h, ptrdiff_t stride); void (*pred_planar)(uint8_t *src, const uint8_t *top, const uint8_t *left, int w, int h, ptrdiff_t stride);
void (*pred_mip)(uint8_t *src, const uint8_t *top, const uint8_t *left, int w, int h, ptrdiff_t stride, void (*pred_mip)(uint8_t *src, const uint8_t *top, const uint8_t *left, int w, int h, ptrdiff_t stride,

View File

@ -495,7 +495,6 @@ static void itransform(VVCLocalContext *lc, TransformUnit *tu, const int tu_idx,
const VVCSH *sh = &lc->sc->sh; const VVCSH *sh = &lc->sc->sh;
const CodingUnit *cu = lc->cu; const CodingUnit *cu = lc->cu;
const int ps = fc->ps.sps->pixel_shift; const int ps = fc->ps.sps->pixel_shift;
DECLARE_ALIGNED(32, int, temp)[MAX_TB_SIZE * MAX_TB_SIZE];
for (int i = 0; i < tu->nb_tbs; i++) { for (int i = 0; i < tu->nb_tbs; i++) {
TransformBlock *tb = &tu->tbs[i]; TransformBlock *tb = &tu->tbs[i];
@ -540,10 +539,10 @@ static void itransform(VVCLocalContext *lc, TransformUnit *tu, const int tu_idx,
fc->vvcdsp.itx.pred_residual_joint(jcbcr->coeffs, tb->coeffs, tb->tb_width, tb->tb_height, c_sign, shift); fc->vvcdsp.itx.pred_residual_joint(jcbcr->coeffs, tb->coeffs, tb->tb_width, tb->tb_height, c_sign, shift);
} }
if (chroma_scale) if (chroma_scale)
fc->vvcdsp.intra.lmcs_scale_chroma(lc, temp, coeffs, w, h, cu->x0, cu->y0); fc->vvcdsp.intra.lmcs_scale_chroma(lc, coeffs, w, h, cu->x0, cu->y0);
// TODO: Address performance issue here by combining transform, lmcs_scale_chroma, and add_residual into one function. // TODO: Address performance issue here by combining transform, lmcs_scale_chroma, and add_residual into one function.
// Complete this task before implementing ASM code. // Complete this task before implementing ASM code.
fc->vvcdsp.itx.add_residual(dst, chroma_scale ? temp : coeffs, w, h, stride); fc->vvcdsp.itx.add_residual(dst, coeffs, w, h, stride);
} }
} }
} }

View File

@ -428,7 +428,7 @@ static int FUNC(lmcs_derive_chroma_scale)(VVCLocalContext *lc, const int x0, con
} }
// 8.7.5.3 Picture reconstruction with luma dependent chroma residual scaling process for chroma samples // 8.7.5.3 Picture reconstruction with luma dependent chroma residual scaling process for chroma samples
static void FUNC(lmcs_scale_chroma)(VVCLocalContext *lc, int *dst, const int *coeff, static void FUNC(lmcs_scale_chroma)(VVCLocalContext *lc, int *coeff,
const int width, const int height, const int x0_cu, const int y0_cu) const int width, const int height, const int x0_cu, const int y0_cu)
{ {
const int chroma_scale = FUNC(lmcs_derive_chroma_scale)(lc, x0_cu, y0_cu); const int chroma_scale = FUNC(lmcs_derive_chroma_scale)(lc, x0_cu, y0_cu);
@ -438,11 +438,10 @@ static void FUNC(lmcs_scale_chroma)(VVCLocalContext *lc, int *dst, const int *co
const int c = av_clip_intp2(*coeff, BIT_DEPTH); const int c = av_clip_intp2(*coeff, BIT_DEPTH);
if (c > 0) if (c > 0)
*dst = (c * chroma_scale + (1 << 10)) >> 11; *coeff = (c * chroma_scale + (1 << 10)) >> 11;
else else
*dst = -((-c * chroma_scale + (1 << 10)) >> 11); *coeff = -((-c * chroma_scale + (1 << 10)) >> 11);
coeff++; coeff++;
dst++;
} }
} }
} }