History

avcodec/vvc/intra: make lmcs_scale_chroma inplace

prepare for adaptive color transform

Wu Jianhua committed 1 year ago

Commit ff1ecc71 parent d2e7ca63 files · +6 −8Browse files

Showing the changes to libavcodec (3 of 3 files). Show all

Unified · Split

3 files
  1. libavcodec/vvc/dsp.h +1 −1
  2. libavcodec/vvc/intra.c +2 −3
  3. libavcodec/vvc/intra_template.c +3 −4
libavcodec/vvc/dsp.h+1−1
@@ -106,7 +106,7 @@ struct VVCLocalContext; · 105 unmodified lines
106106
107107 typedef struct VVCIntraDSPContext {
108108 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);
110110 void (*intra_pred)(const struct VVCLocalContext *lc, int x0, int y0, int w, int h, int c_idx);
111111 void (*pred_planar)(uint8_t *src, const uint8_t *top, const uint8_t *left, int w, int h, ptrdiff_t stride);
112112 void (*pred_mip)(uint8_t *src, const uint8_t *top, const uint8_t *left, int w, int h, ptrdiff_t stride,
libavcodec/vvc/intra.c+2−3
@@ -495,7 +495,6 @@ static void itransform(VVCLocalContext *lc, TransformUnit *tu, const int tu_idx, · 494 unmodified lines
495495 const VVCSH *sh = &lc->sc->sh;
496496 const CodingUnit *cu = lc->cu;
497497 const int ps = fc->ps.sps->pixel_shift;
498− DECLARE_ALIGNED(32, int, temp)[MAX_TB_SIZE * MAX_TB_SIZE];
499498
500499 for (int i = 0; i < tu->nb_tbs; i++) {
501500 TransformBlock *tb = &tu->tbs[i];
@@ -540,10 +539,10 @@ static void itransform(VVCLocalContext *lc, TransformUnit *tu, const int tu_idx, · 38 unmodified lines
540539 fc->vvcdsp.itx.pred_residual_joint(jcbcr->coeffs, tb->coeffs, tb->tb_width, tb->tb_height, c_sign, shift);
541540 }
542541 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);
544543 // TODO: Address performance issue here by combining transform, lmcs_scale_chroma, and add_residual into one function.
545544 // 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);
547546 }
548547 }
549548 }
libavcodec/vvc/intra_template.c+3−4
@@ -428,7 +428,7 @@ static int FUNC(lmcs_derive_chroma_scale)(VVCLocalContext *lc, const int x0, con · 427 unmodified lines
428428 }
429429
430430 // 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,
432432 const int width, const int height, const int x0_cu, const int y0_cu)
433433 {
434434 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
438438 const int c = av_clip_intp2(*coeff, BIT_DEPTH);
439439
440440 if (c > 0)
441− *dst = (c * chroma_scale + (1 << 10)) >> 11;
441+ *coeff = (c * chroma_scale + (1 << 10)) >> 11;
442442 else
443− *dst = -((-c * chroma_scale + (1 << 10)) >> 11);
443+ *coeff = -((-c * chroma_scale + (1 << 10)) >> 11);
444444 coeff++;
445− dst++;
446445 }
447446 }
448447 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t