mirror of https://git.ffmpeg.org/ffmpeg.git
hevc: move restore_tqb where it should be.
(cherry picked from commit 8fafc96a9805d11bfe32537c8f78a294a5844065) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
1241eb8870
commit
f5beda3bfd
|
@ -2286,33 +2286,6 @@ static int hls_nal_unit(HEVCContext *s)
|
||||||
return nuh_layer_id == 0;
|
return nuh_layer_id == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void restore_tqb_pixels(HEVCContext *s)
|
|
||||||
{
|
|
||||||
int min_pu_size = 1 << s->sps->log2_min_pu_size;
|
|
||||||
int x, y, c_idx;
|
|
||||||
|
|
||||||
for (c_idx = 0; c_idx < 3; c_idx++) {
|
|
||||||
ptrdiff_t stride = s->frame->linesize[c_idx];
|
|
||||||
int hshift = s->sps->hshift[c_idx];
|
|
||||||
int vshift = s->sps->vshift[c_idx];
|
|
||||||
for (y = 0; y < s->sps->min_pu_height; y++) {
|
|
||||||
for (x = 0; x < s->sps->min_pu_width; x++) {
|
|
||||||
if (s->is_pcm[y * s->sps->min_pu_width + x]) {
|
|
||||||
int n;
|
|
||||||
int len = min_pu_size >> hshift;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int set_side_data(HEVCContext *s)
|
static int set_side_data(HEVCContext *s)
|
||||||
{
|
{
|
||||||
AVFrame *out = s->ref->frame;
|
AVFrame *out = s->ref->frame;
|
||||||
|
@ -2528,10 +2501,6 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length)
|
||||||
ctb_addr_ts = hls_slice_data(s);
|
ctb_addr_ts = hls_slice_data(s);
|
||||||
if (ctb_addr_ts >= (s->sps->ctb_width * s->sps->ctb_height)) {
|
if (ctb_addr_ts >= (s->sps->ctb_width * s->sps->ctb_height)) {
|
||||||
s->is_decoded = 1;
|
s->is_decoded = 1;
|
||||||
if ((s->pps->transquant_bypass_enable_flag ||
|
|
||||||
(s->sps->pcm.loop_filter_disable_flag && s->sps->pcm_enabled_flag)) &&
|
|
||||||
s->sps->sao_enabled)
|
|
||||||
restore_tqb_pixels(s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctb_addr_ts < 0) {
|
if (ctb_addr_ts < 0) {
|
||||||
|
|
|
@ -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)])
|
#define CTB(tab, x, y) ((tab)[(y) * s->sps->ctb_width + (x)])
|
||||||
|
|
||||||
static void sao_filter_CTB(HEVCContext *s, int x, int y)
|
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,
|
sao,
|
||||||
edges, width,
|
edges, width,
|
||||||
height, c_idx);
|
height, c_idx);
|
||||||
|
restore_tqb_pixels(s, x, y, width, height, c_idx);
|
||||||
break;
|
break;
|
||||||
case SAO_EDGE:
|
case SAO_EDGE:
|
||||||
s->hevcdsp.sao_edge_filter[restore](dst, src,
|
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,
|
vert_edge,
|
||||||
horiz_edge,
|
horiz_edge,
|
||||||
diag_edge);
|
diag_edge);
|
||||||
|
restore_tqb_pixels(s, x, y, width, height, c_idx);
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
copy_CTB(dst, src, width << s->sps->pixel_shift, height, stride);
|
copy_CTB(dst, src, width << s->sps->pixel_shift, height, stride);
|
||||||
|
|
Loading…
Reference in New Issue