---
libavcodec/hevc.c | 2 ++
libavcodec/hevcdsp.c | 4 ++++
libavcodec/hevcdsp.h | 1 +
libavcodec/hevcdsp_template.c | 40 ++++++++++++++++++++++++++++++++++++++++
4 files changed, 47 insertions(+)
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index d9c9c71..1634185 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -1228,6 +1228,8 @@ static void hls_residual_coding(HEVCContext *s, int x0,
int y0,
else if (lc->cu.pred_mode == MODE_INTRA && c_idx == 0 &&
log2_trafo_size == 2)
s->hevcdsp.transform_4x4_luma_add(dst, coeffs, stride);
+ else if (!last_significant_coeff_x && !last_significant_coeff_y)
+ s->hevcdsp.transform_dc_add[log2_trafo_size - 2](dst, coeffs[0],
stride);
else
s->hevcdsp.transform_add[log2_trafo_size - 2](dst, coeffs, stride);
}
diff --git a/libavcodec/hevcdsp.c b/libavcodec/hevcdsp.c
index 0abee9b..969c11c 100644
--- a/libavcodec/hevcdsp.c
+++ b/libavcodec/hevcdsp.c
@@ -128,6 +128,10 @@ void ff_hevc_dsp_init(HEVCDSPContext *hevcdsp, int
bit_depth)
hevcdsp->transform_add[1] = FUNC(transform_8x8_add, depth); \
hevcdsp->transform_add[2] = FUNC(transform_16x16_add, depth); \
hevcdsp->transform_add[3] = FUNC(transform_32x32_add, depth); \
+ hevcdsp->transform_dc_add[0] = FUNC(transform_4x4_dc_add, depth); \
+ hevcdsp->transform_dc_add[1] = FUNC(transform_8x8_dc_add, depth); \
+ hevcdsp->transform_dc_add[2] = FUNC(transform_16x16_dc_add, depth); \
+ hevcdsp->transform_dc_add[3] = FUNC(transform_32x32_dc_add, depth); \
\
hevcdsp->sao_band_filter[0] = FUNC(sao_band_filter_0, depth); \
hevcdsp->sao_band_filter[1] = FUNC(sao_band_filter_1, depth); \
diff --git a/libavcodec/hevcdsp.h b/libavcodec/hevcdsp.h
index aad96db..1665ad6 100644
--- a/libavcodec/hevcdsp.h
+++ b/libavcodec/hevcdsp.h
@@ -49,6 +49,7 @@ typedef struct HEVCDSPContext {
void (*transform_4x4_luma_add)(uint8_t *dst, int16_t *coeffs,
ptrdiff_t stride);
void (*transform_add[4])(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride);
+ void (*transform_dc_add[4])(uint8_t *dst, int coeff, ptrdiff_t stride);
void (*sao_band_filter[4])(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
struct SAOParams *sao, int *borders,
diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c
index f1b52ae..277de2d 100644
--- a/libavcodec/hevcdsp_template.c
+++ b/libavcodec/hevcdsp_template.c
@@ -296,6 +296,46 @@ static void FUNC(transform_32x32_add)(uint8_t *dst,
int16_t *coeffs,
FUNC(transform_add)(dst, coeffs, stride, 32);
}
+static av_always_inline void FUNC(transform_dc_add)(uint8_t *dst_, int coeff,
+ ptrdiff_t stride, int size)
+{
+ pixel *dst = (pixel *)dst_;
+ int shift = 14 - BIT_DEPTH;
+ int add = 1 << (shift - 1);
+ int i, j;
+
+ stride /= sizeof(pixel);
+ coeff = (((coeff + 1) >> 1) + add) >> shift;
+
+ for (i = 0; i < size; i++)
+ for (j = 0; j < size; j++)
+ dst[i + j * stride] = av_clip_pixel(dst[i + j * stride] + coeff);
+}
+
+static void FUNC(transform_4x4_dc_add)(uint8_t *dst, int coeff,
+ ptrdiff_t stride)
+{
+ FUNC(transform_dc_add)(dst, coeff, stride, 4);
+}
+
+static void FUNC(transform_8x8_dc_add)(uint8_t *dst, int coeff,
+ ptrdiff_t stride)
+{
+ FUNC(transform_dc_add)(dst, coeff, stride, 8);
+}
+
+static void FUNC(transform_16x16_dc_add)(uint8_t *dst, int coeff,
+ ptrdiff_t stride)
+{
+ FUNC(transform_dc_add)(dst, coeff, stride, 16);
+}
+
+static void FUNC(transform_32x32_dc_add)(uint8_t *dst, int coeff,
+ ptrdiff_t stride)
+{
+ FUNC(transform_dc_add)(dst, coeff, stride, 32);
+}
+
static void FUNC(sao_band_filter)(uint8_t *_dst, uint8_t *_src,
ptrdiff_t stride, SAOParams *sao,
int *borders, int width, int height,
--
2.0.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel