History

lavc/hevcdec: move HEVCContext.{horizontal,vertical}_bs to HEVCLayerContext

Anton Khirnov committed 2 years ago

Commit 4f87ff71 parent e8baf2f3 files · +22 −21Browse files

Unified · Split

3 files
  1. libavcodec/hevc/filter.c +12 −12
  2. libavcodec/hevc/hevcdec.c +7 −7
  3. libavcodec/hevc/hevcdec.h +3 −2
libavcodec/hevc/filter.c+12−12
@@ -549,8 +549,8 @@ static void deblocking_filter_CTB(const HEVCContext *s, const HEVCLayerContext * · 548 unmodified lines
549 for (y = y0; y < y_end; y += 8) {549 for (y = y0; y < y_end; y += 8) {
550 // vertical filtering luma550 // vertical filtering luma
551 for (x = x0 ? x0 : 8; x < x_end; x += 8) {551 for (x = x0 ? x0 : 8; x < x_end; x += 8) {
552 const int bs0 = s->vertical_bs[(x + y * l->bs_width) >> 2];552 const int bs0 = l->vertical_bs[(x + y * l->bs_width) >> 2];
553 const int bs1 = s->vertical_bs[(x + (y + 4) * l->bs_width) >> 2];553 const int bs1 = l->vertical_bs[(x + (y + 4) * l->bs_width) >> 2];
554 if (bs0 || bs1) {554 if (bs0 || bs1) {
555 const int qp = (get_qPy(sps, l->qp_y_tab, x - 1, y) +555 const int qp = (get_qPy(sps, l->qp_y_tab, x - 1, y) +
556 get_qPy(sps, l->qp_y_tab, x, y) + 1) >> 1;556 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 * · 21 unmodified lines
578 578
579 // horizontal filtering luma579 // horizontal filtering luma
580 for (x = x0 ? x0 - 8 : 0; x < x_end2; x += 8) {580 for (x = x0 ? x0 - 8 : 0; x < x_end2; x += 8) {
581 const int bs0 = s->horizontal_bs[( x + y * l->bs_width) >> 2];581 const int bs0 = l->horizontal_bs[( x + y * l->bs_width) >> 2];
582 const int bs1 = s->horizontal_bs[((x + 4) + y * l->bs_width) >> 2];582 const int bs1 = l->horizontal_bs[((x + 4) + y * l->bs_width) >> 2];
583 if (bs0 || bs1) {583 if (bs0 || bs1) {
584 const int qp = (get_qPy(sps, l->qp_y_tab, x, y - 1) +584 const int qp = (get_qPy(sps, l->qp_y_tab, x, y - 1) +
585 get_qPy(sps, l->qp_y_tab, x, y) + 1) >> 1;585 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 * · 27 unmodified lines
613 // vertical filtering chroma613 // vertical filtering chroma
614 for (y = y0; y < y_end; y += (8 * v)) {614 for (y = y0; y < y_end; y += (8 * v)) {
615 for (x = x0 ? x0 : 8 * h; x < x_end; x += (8 * h)) {615 for (x = x0 ? x0 : 8 * h; x < x_end; x += (8 * h)) {
616 const int bs0 = s->vertical_bs[(x + y * l->bs_width) >> 2];616 const int bs0 = l->vertical_bs[(x + y * l->bs_width) >> 2];
617 const int bs1 = s->vertical_bs[(x + (y + (4 * v)) * l->bs_width) >> 2];617 const int bs1 = l->vertical_bs[(x + (y + (4 * v)) * l->bs_width) >> 2];
618 618
619 if ((bs0 == 2) || (bs1 == 2)) {619 if ((bs0 == 2) || (bs1 == 2)) {
620 const int qp0 = (get_qPy(sps, l->qp_y_tab, x - 1, y) +620 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 * · 26 unmodified lines
647 if (x_end != sps->width)647 if (x_end != sps->width)
648 x_end2 = x_end - 8 * h;648 x_end2 = x_end - 8 * h;
649 for (x = x0 ? x0 - 8 * h : 0; x < x_end2; x += (8 * h)) {649 for (x = x0 ? x0 - 8 * h : 0; x < x_end2; x += (8 * h)) {
650 const int bs0 = s->horizontal_bs[( x + y * l->bs_width) >> 2];650 const int bs0 = l->horizontal_bs[( x + y * l->bs_width) >> 2];
651 const int bs1 = s->horizontal_bs[((x + 4 * h) + y * l->bs_width) >> 2];651 const int bs1 = l->horizontal_bs[((x + 4 * h) + y * l->bs_width) >> 2];
652 if ((bs0 == 2) || (bs1 == 2)) {652 if ((bs0 == 2) || (bs1 == 2)) {
653 const int qp0 = bs0 == 2 ? (get_qPy(sps, l->qp_y_tab, x, y - 1) +653 const int qp0 = bs0 == 2 ? (get_qPy(sps, l->qp_y_tab, x, y - 1) +
654 get_qPy(sps, l->qp_y_tab, x, y) + 1) >> 1 : 0;654 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 · 133 unmodified lines
788 bs = 1;788 bs = 1;
789 else789 else
790 bs = boundary_strength(s, curr, top, rpl_top);790 bs = boundary_strength(s, curr, top, rpl_top);
791 s->horizontal_bs[((x0 + i) + y0 * l->bs_width) >> 2] = bs;791 l->horizontal_bs[((x0 + i) + y0 * l->bs_width) >> 2] = bs;
792 }792 }
793 }793 }
794 794
@@ -826,7 +826,7 @@ void ff_hevc_deblocking_boundary_strengths(HEVCLocalContext *lc, const HEVCLayer · 31 unmodified lines
826 bs = 1;826 bs = 1;
827 else827 else
828 bs = boundary_strength(s, curr, left, rpl_left);828 bs = boundary_strength(s, curr, left, rpl_left);
829 s->vertical_bs[(x0 + (y0 + i) * l->bs_width) >> 2] = bs;829 l->vertical_bs[(x0 + (y0 + i) * l->bs_width) >> 2] = bs;
830 }830 }
831 }831 }
832 832
@@ -844,7 +844,7 @@ void ff_hevc_deblocking_boundary_strengths(HEVCLocalContext *lc, const HEVCLayer · 11 unmodified lines
844 const MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];844 const MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
845 845
846 bs = boundary_strength(s, curr, top, rpl);846 bs = boundary_strength(s, curr, top, rpl);
847 s->horizontal_bs[((x0 + i) + (y0 + j) * l->bs_width) >> 2] = bs;847 l->horizontal_bs[((x0 + i) + (y0 + j) * l->bs_width) >> 2] = bs;
848 }848 }
849 }849 }
850 850
@@ -859,7 +859,7 @@ void ff_hevc_deblocking_boundary_strengths(HEVCLocalContext *lc, const HEVCLayer · 8 unmodified lines
859 const MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];859 const MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
860 860
861 bs = boundary_strength(s, curr, left, rpl);861 bs = boundary_strength(s, curr, left, rpl);
862 s->vertical_bs[((x0 + i) + (y0 + j) * l->bs_width) >> 2] = bs;862 l->vertical_bs[((x0 + i) + (y0 + j) * l->bs_width) >> 2] = bs;
863 }863 }
864 }864 }
865 }865 }
libavcodec/hevc/hevcdec.c+7−7
@@ -82,8 +82,8 @@ static void pic_arrays_free(HEVCContext *s, HEVCLayerContext *l) · 81 unmodified lines
82 av_freep(&l->tab_slice_address);82 av_freep(&l->tab_slice_address);
83 av_freep(&l->filter_slice_edges);83 av_freep(&l->filter_slice_edges);
84 84
85 av_freep(&s->horizontal_bs);85 av_freep(&l->horizontal_bs);
86 av_freep(&s->vertical_bs);86 av_freep(&l->vertical_bs);
87 87
88 ff_refstruct_pool_uninit(&s->tab_mvf_pool);88 ff_refstruct_pool_uninit(&s->tab_mvf_pool);
89 ff_refstruct_pool_uninit(&s->rpl_tab_pool);89 ff_refstruct_pool_uninit(&s->rpl_tab_pool);
@@ -127,9 +127,9 @@ static int pic_arrays_init(HEVCContext *s, HEVCLayerContext *l, const HEVCSPS *s · 37 unmodified lines
127 if (!l->qp_y_tab || !l->filter_slice_edges || !l->tab_slice_address)127 if (!l->qp_y_tab || !l->filter_slice_edges || !l->tab_slice_address)
128 goto fail;128 goto fail;
129 129
130 s->horizontal_bs = av_calloc(l->bs_width, l->bs_height);130 l->horizontal_bs = av_calloc(l->bs_width, l->bs_height);
131 s->vertical_bs = av_calloc(l->bs_width, l->bs_height);131 l->vertical_bs = av_calloc(l->bs_width, l->bs_height);
132 if (!s->horizontal_bs || !s->vertical_bs)132 if (!l->horizontal_bs || !l->vertical_bs)
133 goto fail;133 goto fail;
134 134
135 s->tab_mvf_pool = ff_refstruct_pool_alloc(min_pu_size * sizeof(MvField), 0);135 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) · 2820 unmodified lines
2956 new_sequence = 1;2956 new_sequence = 1;
2957 }2957 }
2958 2958
2959 memset(s->horizontal_bs, 0, l->bs_width * l->bs_height);2959 memset(l->horizontal_bs, 0, l->bs_width * l->bs_height);
2960 memset(s->vertical_bs, 0, l->bs_width * l->bs_height);2960 memset(l->vertical_bs, 0, l->bs_width * l->bs_height);
2961 memset(l->cbf_luma, 0, sps->min_tb_width * sps->min_tb_height);2961 memset(l->cbf_luma, 0, sps->min_tb_width * sps->min_tb_height);
2962 memset(l->is_pcm, 0, (sps->min_pu_width + 1) * (sps->min_pu_height + 1));2962 memset(l->is_pcm, 0, (sps->min_pu_width + 1) * (sps->min_pu_height + 1));
2963 memset(l->tab_slice_address, -1, pic_size_in_ctb * sizeof(*l->tab_slice_address));2963 memset(l->tab_slice_address, -1, pic_size_in_ctb * sizeof(*l->tab_slice_address));
libavcodec/hevc/hevcdec.h+3−2
@@ -462,6 +462,9 @@ typedef struct HEVCLayerContext { · 461 unmodified lines
462 int32_t *tab_slice_address;462 int32_t *tab_slice_address;
463 463
464 int8_t *qp_y_tab;464 int8_t *qp_y_tab;
465
466 uint8_t *horizontal_bs;
467 uint8_t *vertical_bs;
465} HEVCLayerContext;468} HEVCLayerContext;
466 469
467typedef struct HEVCContext {470typedef struct HEVCContext {
@@ -513,8 +516,6 @@ typedef struct HEVCContext { · 45 unmodified lines
513 VideoDSPContext vdsp;516 VideoDSPContext vdsp;
514 BswapDSPContext bdsp;517 BswapDSPContext bdsp;
515 H274FilmGrainDatabase h274db;518 H274FilmGrainDatabase h274db;
516 uint8_t *horizontal_bs;
517 uint8_t *vertical_bs;
518 519
519 /** used on BE to byteswap the lines for checksumming */520 /** used on BE to byteswap the lines for checksumming */
520 uint8_t *checksum_buf;521 uint8_t *checksum_buf;

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