prepare for adaptive color transform
Unified · Split
| @@ -106,7 +106,7 @@ struct VVCLocalContext; · 105 unmodified lines | |||
| 106 | 106 | ||
| 107 | typedef struct VVCIntraDSPContext { | 107 | typedef struct VVCIntraDSPContext { |
| 108 | void (*intra_cclm_pred)(const struct VVCLocalContext *lc, int x0, int y0, int w, int h); | 108 | void (*intra_cclm_pred)(const struct VVCLocalContext *lc, int x0, int y0, int w, int h); |
| 109 | void (*lmcs_scale_chroma)(struct VVCLocalContext *lc, int *dst, const int *coeff, int w, int h, int x0_cu, int y0_cu); | 109 | void (*lmcs_scale_chroma)(struct VVCLocalContext *lc, int *coeff, int w, int h, int x0_cu, int y0_cu); |
| 110 | void (*intra_pred)(const struct VVCLocalContext *lc, int x0, int y0, int w, int h, int c_idx); | 110 | void (*intra_pred)(const struct VVCLocalContext *lc, int x0, int y0, int w, int h, int c_idx); |
| 111 | void (*pred_planar)(uint8_t *src, const uint8_t *top, const uint8_t *left, int w, int h, ptrdiff_t stride); | 111 | void (*pred_planar)(uint8_t *src, const uint8_t *top, const uint8_t *left, int w, int h, ptrdiff_t stride); |
| 112 | void (*pred_mip)(uint8_t *src, const uint8_t *top, const uint8_t *left, int w, int h, ptrdiff_t stride, | 112 | void (*pred_mip)(uint8_t *src, const uint8_t *top, const uint8_t *left, int w, int h, ptrdiff_t stride, |
| @@ -495,7 +495,6 @@ static void itransform(VVCLocalContext *lc, TransformUnit *tu, const int tu_idx, · 494 unmodified lines | |||
| 495 | const VVCSH *sh = &lc->sc->sh; | 495 | const VVCSH *sh = &lc->sc->sh; |
| 496 | const CodingUnit *cu = lc->cu; | 496 | const CodingUnit *cu = lc->cu; |
| 497 | const int ps = fc->ps.sps->pixel_shift; | 497 | const int ps = fc->ps.sps->pixel_shift; |
| 498 | DECLARE_ALIGNED(32, int, temp)[MAX_TB_SIZE * MAX_TB_SIZE]; | ||
| 499 | 498 | ||
| 500 | for (int i = 0; i < tu->nb_tbs; i++) { | 499 | for (int i = 0; i < tu->nb_tbs; i++) { |
| 501 | TransformBlock *tb = &tu->tbs[i]; | 500 | TransformBlock *tb = &tu->tbs[i]; |
| @@ -540,10 +539,10 @@ static void itransform(VVCLocalContext *lc, TransformUnit *tu, const int tu_idx, · 38 unmodified lines | |||
| 540 | fc->vvcdsp.itx.pred_residual_joint(jcbcr->coeffs, tb->coeffs, tb->tb_width, tb->tb_height, c_sign, shift); | 539 | fc->vvcdsp.itx.pred_residual_joint(jcbcr->coeffs, tb->coeffs, tb->tb_width, tb->tb_height, c_sign, shift); |
| 541 | } | 540 | } |
| 542 | if (chroma_scale) | 541 | if (chroma_scale) |
| 543 | fc->vvcdsp.intra.lmcs_scale_chroma(lc, temp, coeffs, w, h, cu->x0, cu->y0); | 542 | fc->vvcdsp.intra.lmcs_scale_chroma(lc, coeffs, w, h, cu->x0, cu->y0); |
| 544 | // TODO: Address performance issue here by combining transform, lmcs_scale_chroma, and add_residual into one function. | 543 | // TODO: Address performance issue here by combining transform, lmcs_scale_chroma, and add_residual into one function. |
| 545 | // Complete this task before implementing ASM code. | 544 | // Complete this task before implementing ASM code. |
| 546 | fc->vvcdsp.itx.add_residual(dst, chroma_scale ? temp : coeffs, w, h, stride); | 545 | fc->vvcdsp.itx.add_residual(dst, coeffs, w, h, stride); |
| 547 | } | 546 | } |
| 548 | } | 547 | } |
| 549 | } | 548 | } |
| @@ -428,7 +428,7 @@ static int FUNC(lmcs_derive_chroma_scale)(VVCLocalContext *lc, const int x0, con · 427 unmodified lines | |||
| 428 | } | 428 | } |
| 429 | 429 | ||
| 430 | // 8.7.5.3 Picture reconstruction with luma dependent chroma residual scaling process for chroma samples | 430 | // 8.7.5.3 Picture reconstruction with luma dependent chroma residual scaling process for chroma samples |
| 431 | static void FUNC(lmcs_scale_chroma)(VVCLocalContext *lc, int *dst, const int *coeff, | 431 | static void FUNC(lmcs_scale_chroma)(VVCLocalContext *lc, int *coeff, |
| 432 | const int width, const int height, const int x0_cu, const int y0_cu) | 432 | const int width, const int height, const int x0_cu, const int y0_cu) |
| 433 | { | 433 | { |
| 434 | const int chroma_scale = FUNC(lmcs_derive_chroma_scale)(lc, x0_cu, y0_cu); | 434 | 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 · 3 unmodified lines | |||
| 438 | const int c = av_clip_intp2(*coeff, BIT_DEPTH); | 438 | const int c = av_clip_intp2(*coeff, BIT_DEPTH); |
| 439 | 439 | ||
| 440 | if (c > 0) | 440 | if (c > 0) |
| 441 | *dst = (c * chroma_scale + (1 << 10)) >> 11; | 441 | *coeff = (c * chroma_scale + (1 << 10)) >> 11; |
| 442 | else | 442 | else |
| 443 | *dst = -((-c * chroma_scale + (1 << 10)) >> 11); | 443 | *coeff = -((-c * chroma_scale + (1 << 10)) >> 11); |
| 444 | coeff++; | 444 | coeff++; |
| 445 | dst++; | ||
| 446 | } | 445 | } |
| 447 | } | 446 | } |
| 448 | } | 447 | } |