summaryrefslogtreecommitdiff
path: root/libavcodec/hevc_filter.c
diff options
context:
space:
mode:
authorMickaƫl Raulet <mraulet@insa-rennes.fr>2014-07-14 16:57:45 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-07-15 13:25:55 +0200
commitf5beda3bfd753d1fc9488583eb8be7510a333ea0 (patch)
tree505295a4493478808cc21deb43e511d34f625ea3 /libavcodec/hevc_filter.c
parent1241eb88704f75fe9e7d1de3663aa24d4318cdab (diff)
hevc: move restore_tqb where it should be.
(cherry picked from commit 8fafc96a9805d11bfe32537c8f78a294a5844065) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/hevc_filter.c')
-rw-r--r--libavcodec/hevc_filter.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c
index f1ba1a3997..d18e04f90c 100644
--- a/libavcodec/hevc_filter.c
+++ b/libavcodec/hevc_filter.c
@@ -149,6 +149,37 @@ static void copy_CTB(uint8_t *dst, uint8_t *src,
}
}
+static void restore_tqb_pixels(HEVCContext *s, int x0, int y0, int width, int height, int c_idx)
+{
+ if ( s->pps->transquant_bypass_enable_flag ||
+ (s->sps->pcm.loop_filter_disable_flag && s->sps->pcm_enabled_flag)) {
+ int x, y;
+ ptrdiff_t stride = s->frame->linesize[c_idx];
+ int min_pu_size = 1 << s->sps->log2_min_pu_size;
+ int hshift = s->sps->hshift[c_idx];
+ int vshift = s->sps->vshift[c_idx];
+ int x_min = ((x0 ) >> s->sps->log2_min_pu_size);
+ int y_min = ((y0 ) >> s->sps->log2_min_pu_size);
+ int x_max = ((x0 + width ) >> s->sps->log2_min_pu_size);
+ int y_max = ((y0 + height) >> s->sps->log2_min_pu_size);
+ int len = min_pu_size >> hshift;
+ for (y = y_min; y < y_max; y++) {
+ for (x = x_min; x < x_max; x++) {
+ if (s->is_pcm[y * s->sps->min_pu_width + x]) {
+ int n;
+ uint8_t *src = &s->frame->data[c_idx][ ((y << s->sps->log2_min_pu_size) >> vshift) * stride + (((x << s->sps->log2_min_pu_size) >> hshift) << s->sps->pixel_shift)];
+ uint8_t *dst = &s->sao_frame->data[c_idx][((y << s->sps->log2_min_pu_size) >> vshift) * stride + (((x << s->sps->log2_min_pu_size) >> hshift) << s->sps->pixel_shift)];
+ for (n = 0; n < (min_pu_size >> vshift); n++) {
+ memcpy(dst, src, len);
+ src += stride;
+ dst += stride;
+ }
+ }
+ }
+ }
+ }
+}
+
#define CTB(tab, x, y) ((tab)[(y) * s->sps->ctb_width + (x)])
static void sao_filter_CTB(HEVCContext *s, int x, int y)
@@ -230,6 +261,7 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y)
sao,
edges, width,
height, c_idx);
+ restore_tqb_pixels(s, x, y, width, height, c_idx);
break;
case SAO_EDGE:
s->hevcdsp.sao_edge_filter[restore](dst, src,
@@ -240,6 +272,7 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y)
vert_edge,
horiz_edge,
diag_edge);
+ restore_tqb_pixels(s, x, y, width, height, c_idx);
break;
default :
copy_CTB(dst, src, width << s->sps->pixel_shift, height, stride);