You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/vvc/dsp: add adaptive_color_transform
See 8.7.4.6 Residual modification process for blocks using colour space conversion Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
This commit is contained in:
@ -127,6 +127,8 @@ typedef struct VVCItxDSPContext {
|
||||
|
||||
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);
|
||||
|
||||
void (*adaptive_color_transform)(int *y, int *u, int *v, int width, int height);
|
||||
} VVCItxDSPContext;
|
||||
|
||||
typedef struct VVCLMCSDSPContext {
|
||||
|
@ -91,6 +91,24 @@ static void FUNC(transform_bdpcm)(int *coeffs, const int width, const int height
|
||||
}
|
||||
}
|
||||
|
||||
// 8.7.4.6 Residual modification process for blocks using colour space conversion
|
||||
static void FUNC(adaptive_color_transform)(int *y, int *u, int *v, const int width, const int height)
|
||||
{
|
||||
const int size = width * height;
|
||||
const int bits = BIT_DEPTH + 1;
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
const int y0 = av_clip_intp2(y[i], bits);
|
||||
const int cg = av_clip_intp2(u[i], bits);
|
||||
const int co = av_clip_intp2(v[i], bits);
|
||||
const int t = y0 - (cg >> 1);
|
||||
|
||||
y[i] = cg + t;
|
||||
u[i] = t - (co >> 1);
|
||||
v[i] = co + u[i];
|
||||
}
|
||||
}
|
||||
|
||||
static void FUNC(ff_vvc_itx_dsp_init)(VVCItxDSPContext *const itx)
|
||||
{
|
||||
#define VVC_ITX(TYPE, type, s) \
|
||||
@ -112,6 +130,8 @@ static void FUNC(ff_vvc_itx_dsp_init)(VVCItxDSPContext *const itx)
|
||||
VVC_ITX_COMMON(DCT8, dct8)
|
||||
VVC_ITX_COMMON(DST7, dst7)
|
||||
|
||||
itx->adaptive_color_transform = FUNC(adaptive_color_transform);
|
||||
|
||||
#undef VVC_ITX
|
||||
#undef VVC_ITX_COMMON
|
||||
}
|
||||
|
Reference in New Issue
Block a user