mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-26 09:12:33 +00:00
lavc/hevcdec: move HEVCContext.{horizontal,vertical}_bs to HEVCLayerContext
This commit is contained in:
parent
e8baf2fb97
commit
4f87ff7666
@ -549,8 +549,8 @@ static void deblocking_filter_CTB(const HEVCContext *s, const HEVCLayerContext *
|
|||||||
for (y = y0; y < y_end; y += 8) {
|
for (y = y0; y < y_end; y += 8) {
|
||||||
// vertical filtering luma
|
// vertical filtering luma
|
||||||
for (x = x0 ? x0 : 8; x < x_end; x += 8) {
|
for (x = x0 ? x0 : 8; x < x_end; x += 8) {
|
||||||
const int bs0 = s->vertical_bs[(x + y * l->bs_width) >> 2];
|
const int bs0 = l->vertical_bs[(x + y * l->bs_width) >> 2];
|
||||||
const int bs1 = s->vertical_bs[(x + (y + 4) * l->bs_width) >> 2];
|
const int bs1 = l->vertical_bs[(x + (y + 4) * l->bs_width) >> 2];
|
||||||
if (bs0 || bs1) {
|
if (bs0 || bs1) {
|
||||||
const int qp = (get_qPy(sps, l->qp_y_tab, x - 1, y) +
|
const int qp = (get_qPy(sps, l->qp_y_tab, x - 1, y) +
|
||||||
get_qPy(sps, l->qp_y_tab, x, y) + 1) >> 1;
|
get_qPy(sps, l->qp_y_tab, x, y) + 1) >> 1;
|
||||||
@ -578,8 +578,8 @@ static void deblocking_filter_CTB(const HEVCContext *s, const HEVCLayerContext *
|
|||||||
|
|
||||||
// horizontal filtering luma
|
// horizontal filtering luma
|
||||||
for (x = x0 ? x0 - 8 : 0; x < x_end2; x += 8) {
|
for (x = x0 ? x0 - 8 : 0; x < x_end2; x += 8) {
|
||||||
const int bs0 = s->horizontal_bs[( x + y * l->bs_width) >> 2];
|
const int bs0 = l->horizontal_bs[( x + y * l->bs_width) >> 2];
|
||||||
const int bs1 = s->horizontal_bs[((x + 4) + y * l->bs_width) >> 2];
|
const int bs1 = l->horizontal_bs[((x + 4) + y * l->bs_width) >> 2];
|
||||||
if (bs0 || bs1) {
|
if (bs0 || bs1) {
|
||||||
const int qp = (get_qPy(sps, l->qp_y_tab, x, y - 1) +
|
const int qp = (get_qPy(sps, l->qp_y_tab, x, y - 1) +
|
||||||
get_qPy(sps, l->qp_y_tab, x, y) + 1) >> 1;
|
get_qPy(sps, l->qp_y_tab, x, y) + 1) >> 1;
|
||||||
@ -613,8 +613,8 @@ static void deblocking_filter_CTB(const HEVCContext *s, const HEVCLayerContext *
|
|||||||
// vertical filtering chroma
|
// vertical filtering chroma
|
||||||
for (y = y0; y < y_end; y += (8 * v)) {
|
for (y = y0; y < y_end; y += (8 * v)) {
|
||||||
for (x = x0 ? x0 : 8 * h; x < x_end; x += (8 * h)) {
|
for (x = x0 ? x0 : 8 * h; x < x_end; x += (8 * h)) {
|
||||||
const int bs0 = s->vertical_bs[(x + y * l->bs_width) >> 2];
|
const int bs0 = l->vertical_bs[(x + y * l->bs_width) >> 2];
|
||||||
const int bs1 = s->vertical_bs[(x + (y + (4 * v)) * l->bs_width) >> 2];
|
const int bs1 = l->vertical_bs[(x + (y + (4 * v)) * l->bs_width) >> 2];
|
||||||
|
|
||||||
if ((bs0 == 2) || (bs1 == 2)) {
|
if ((bs0 == 2) || (bs1 == 2)) {
|
||||||
const int qp0 = (get_qPy(sps, l->qp_y_tab, x - 1, y) +
|
const int qp0 = (get_qPy(sps, l->qp_y_tab, x - 1, y) +
|
||||||
@ -647,8 +647,8 @@ static void deblocking_filter_CTB(const HEVCContext *s, const HEVCLayerContext *
|
|||||||
if (x_end != sps->width)
|
if (x_end != sps->width)
|
||||||
x_end2 = x_end - 8 * h;
|
x_end2 = x_end - 8 * h;
|
||||||
for (x = x0 ? x0 - 8 * h : 0; x < x_end2; x += (8 * h)) {
|
for (x = x0 ? x0 - 8 * h : 0; x < x_end2; x += (8 * h)) {
|
||||||
const int bs0 = s->horizontal_bs[( x + y * l->bs_width) >> 2];
|
const int bs0 = l->horizontal_bs[( x + y * l->bs_width) >> 2];
|
||||||
const int bs1 = s->horizontal_bs[((x + 4 * h) + y * l->bs_width) >> 2];
|
const int bs1 = l->horizontal_bs[((x + 4 * h) + y * l->bs_width) >> 2];
|
||||||
if ((bs0 == 2) || (bs1 == 2)) {
|
if ((bs0 == 2) || (bs1 == 2)) {
|
||||||
const int qp0 = bs0 == 2 ? (get_qPy(sps, l->qp_y_tab, x, y - 1) +
|
const int qp0 = bs0 == 2 ? (get_qPy(sps, l->qp_y_tab, x, y - 1) +
|
||||||
get_qPy(sps, l->qp_y_tab, x, y) + 1) >> 1 : 0;
|
get_qPy(sps, l->qp_y_tab, x, y) + 1) >> 1 : 0;
|
||||||
@ -788,7 +788,7 @@ void ff_hevc_deblocking_boundary_strengths(HEVCLocalContext *lc, const HEVCLayer
|
|||||||
bs = 1;
|
bs = 1;
|
||||||
else
|
else
|
||||||
bs = boundary_strength(s, curr, top, rpl_top);
|
bs = boundary_strength(s, curr, top, rpl_top);
|
||||||
s->horizontal_bs[((x0 + i) + y0 * l->bs_width) >> 2] = bs;
|
l->horizontal_bs[((x0 + i) + y0 * l->bs_width) >> 2] = bs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -826,7 +826,7 @@ void ff_hevc_deblocking_boundary_strengths(HEVCLocalContext *lc, const HEVCLayer
|
|||||||
bs = 1;
|
bs = 1;
|
||||||
else
|
else
|
||||||
bs = boundary_strength(s, curr, left, rpl_left);
|
bs = boundary_strength(s, curr, left, rpl_left);
|
||||||
s->vertical_bs[(x0 + (y0 + i) * l->bs_width) >> 2] = bs;
|
l->vertical_bs[(x0 + (y0 + i) * l->bs_width) >> 2] = bs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -844,7 +844,7 @@ void ff_hevc_deblocking_boundary_strengths(HEVCLocalContext *lc, const HEVCLayer
|
|||||||
const MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
|
const MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
|
||||||
|
|
||||||
bs = boundary_strength(s, curr, top, rpl);
|
bs = boundary_strength(s, curr, top, rpl);
|
||||||
s->horizontal_bs[((x0 + i) + (y0 + j) * l->bs_width) >> 2] = bs;
|
l->horizontal_bs[((x0 + i) + (y0 + j) * l->bs_width) >> 2] = bs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -859,7 +859,7 @@ void ff_hevc_deblocking_boundary_strengths(HEVCLocalContext *lc, const HEVCLayer
|
|||||||
const MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
|
const MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
|
||||||
|
|
||||||
bs = boundary_strength(s, curr, left, rpl);
|
bs = boundary_strength(s, curr, left, rpl);
|
||||||
s->vertical_bs[((x0 + i) + (y0 + j) * l->bs_width) >> 2] = bs;
|
l->vertical_bs[((x0 + i) + (y0 + j) * l->bs_width) >> 2] = bs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,8 +82,8 @@ static void pic_arrays_free(HEVCContext *s, HEVCLayerContext *l)
|
|||||||
av_freep(&l->tab_slice_address);
|
av_freep(&l->tab_slice_address);
|
||||||
av_freep(&l->filter_slice_edges);
|
av_freep(&l->filter_slice_edges);
|
||||||
|
|
||||||
av_freep(&s->horizontal_bs);
|
av_freep(&l->horizontal_bs);
|
||||||
av_freep(&s->vertical_bs);
|
av_freep(&l->vertical_bs);
|
||||||
|
|
||||||
ff_refstruct_pool_uninit(&s->tab_mvf_pool);
|
ff_refstruct_pool_uninit(&s->tab_mvf_pool);
|
||||||
ff_refstruct_pool_uninit(&s->rpl_tab_pool);
|
ff_refstruct_pool_uninit(&s->rpl_tab_pool);
|
||||||
@ -127,9 +127,9 @@ static int pic_arrays_init(HEVCContext *s, HEVCLayerContext *l, const HEVCSPS *s
|
|||||||
if (!l->qp_y_tab || !l->filter_slice_edges || !l->tab_slice_address)
|
if (!l->qp_y_tab || !l->filter_slice_edges || !l->tab_slice_address)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
s->horizontal_bs = av_calloc(l->bs_width, l->bs_height);
|
l->horizontal_bs = av_calloc(l->bs_width, l->bs_height);
|
||||||
s->vertical_bs = av_calloc(l->bs_width, l->bs_height);
|
l->vertical_bs = av_calloc(l->bs_width, l->bs_height);
|
||||||
if (!s->horizontal_bs || !s->vertical_bs)
|
if (!l->horizontal_bs || !l->vertical_bs)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
s->tab_mvf_pool = ff_refstruct_pool_alloc(min_pu_size * sizeof(MvField), 0);
|
s->tab_mvf_pool = ff_refstruct_pool_alloc(min_pu_size * sizeof(MvField), 0);
|
||||||
@ -2956,8 +2956,8 @@ static int hevc_frame_start(HEVCContext *s, HEVCLayerContext *l)
|
|||||||
new_sequence = 1;
|
new_sequence = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(s->horizontal_bs, 0, l->bs_width * l->bs_height);
|
memset(l->horizontal_bs, 0, l->bs_width * l->bs_height);
|
||||||
memset(s->vertical_bs, 0, l->bs_width * l->bs_height);
|
memset(l->vertical_bs, 0, l->bs_width * l->bs_height);
|
||||||
memset(l->cbf_luma, 0, sps->min_tb_width * sps->min_tb_height);
|
memset(l->cbf_luma, 0, sps->min_tb_width * sps->min_tb_height);
|
||||||
memset(l->is_pcm, 0, (sps->min_pu_width + 1) * (sps->min_pu_height + 1));
|
memset(l->is_pcm, 0, (sps->min_pu_width + 1) * (sps->min_pu_height + 1));
|
||||||
memset(l->tab_slice_address, -1, pic_size_in_ctb * sizeof(*l->tab_slice_address));
|
memset(l->tab_slice_address, -1, pic_size_in_ctb * sizeof(*l->tab_slice_address));
|
||||||
|
@ -462,6 +462,9 @@ typedef struct HEVCLayerContext {
|
|||||||
int32_t *tab_slice_address;
|
int32_t *tab_slice_address;
|
||||||
|
|
||||||
int8_t *qp_y_tab;
|
int8_t *qp_y_tab;
|
||||||
|
|
||||||
|
uint8_t *horizontal_bs;
|
||||||
|
uint8_t *vertical_bs;
|
||||||
} HEVCLayerContext;
|
} HEVCLayerContext;
|
||||||
|
|
||||||
typedef struct HEVCContext {
|
typedef struct HEVCContext {
|
||||||
@ -513,8 +516,6 @@ typedef struct HEVCContext {
|
|||||||
VideoDSPContext vdsp;
|
VideoDSPContext vdsp;
|
||||||
BswapDSPContext bdsp;
|
BswapDSPContext bdsp;
|
||||||
H274FilmGrainDatabase h274db;
|
H274FilmGrainDatabase h274db;
|
||||||
uint8_t *horizontal_bs;
|
|
||||||
uint8_t *vertical_bs;
|
|
||||||
|
|
||||||
/** used on BE to byteswap the lines for checksumming */
|
/** used on BE to byteswap the lines for checksumming */
|
||||||
uint8_t *checksum_buf;
|
uint8_t *checksum_buf;
|
||||||
|
Loading…
Reference in New Issue
Block a user