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
549549 for (y = y0; y < y_end; y += 8) {
550550 // vertical filtering luma
551551 for (x = x0 ? x0 : 8; x < x_end; x += 8) {
552− const int bs0 = s->vertical_bs[(x + y * l->bs_width) >> 2];
553− const int bs1 = s->vertical_bs[(x + (y + 4) * l->bs_width) >> 2];
552+ const int bs0 = l->vertical_bs[(x + y * l->bs_width) >> 2];
553+ const int bs1 = l->vertical_bs[(x + (y + 4) * l->bs_width) >> 2];
554554 if (bs0 || bs1) {
555555 const int qp = (get_qPy(sps, l->qp_y_tab, x - 1, y) +
556556 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
578578
579579 // horizontal filtering luma
580580 for (x = x0 ? x0 - 8 : 0; x < x_end2; x += 8) {
581− const int bs0 = s->horizontal_bs[( x + y * l->bs_width) >> 2];
582− const int bs1 = s->horizontal_bs[((x + 4) + y * l->bs_width) >> 2];
581+ const int bs0 = l->horizontal_bs[( x + y * l->bs_width) >> 2];
582+ const int bs1 = l->horizontal_bs[((x + 4) + y * l->bs_width) >> 2];
583583 if (bs0 || bs1) {
584584 const int qp = (get_qPy(sps, l->qp_y_tab, x, y - 1) +
585585 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
613613 // vertical filtering chroma
614614 for (y = y0; y < y_end; y += (8 * v)) {
615615 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];
617− const int bs1 = s->vertical_bs[(x + (y + (4 * v)) * l->bs_width) >> 2];
616+ const int bs0 = l->vertical_bs[(x + y * l->bs_width) >> 2];
617+ const int bs1 = l->vertical_bs[(x + (y + (4 * v)) * l->bs_width) >> 2];
618618
619619 if ((bs0 == 2) || (bs1 == 2)) {
620620 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
647647 if (x_end != sps->width)
648648 x_end2 = x_end - 8 * h;
649649 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];
651− const int bs1 = s->horizontal_bs[((x + 4 * h) + y * l->bs_width) >> 2];
650+ const int bs0 = l->horizontal_bs[( x + y * l->bs_width) >> 2];
651+ const int bs1 = l->horizontal_bs[((x + 4 * h) + y * l->bs_width) >> 2];
652652 if ((bs0 == 2) || (bs1 == 2)) {
653653 const int qp0 = bs0 == 2 ? (get_qPy(sps, l->qp_y_tab, x, y - 1) +
654654 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
788788 bs = 1;
789789 else
790790 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;
792792 }
793793 }
794794
@@ -826,7 +826,7 @@ void ff_hevc_deblocking_boundary_strengths(HEVCLocalContext *lc, const HEVCLayer · 31 unmodified lines
826826 bs = 1;
827827 else
828828 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;
830830 }
831831 }
832832
@@ -844,7 +844,7 @@ void ff_hevc_deblocking_boundary_strengths(HEVCLocalContext *lc, const HEVCLayer · 11 unmodified lines
844844 const MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
845845
846846 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;
848848 }
849849 }
850850
@@ -859,7 +859,7 @@ void ff_hevc_deblocking_boundary_strengths(HEVCLocalContext *lc, const HEVCLayer · 8 unmodified lines
859859 const MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
860860
861861 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;
863863 }
864864 }
865865 }
libavcodec/hevc/hevcdec.c+7−7
@@ -82,8 +82,8 @@ static void pic_arrays_free(HEVCContext *s, HEVCLayerContext *l) · 81 unmodified lines
8282 av_freep(&l->tab_slice_address);
8383 av_freep(&l->filter_slice_edges);
8484
85− av_freep(&s->horizontal_bs);
86− av_freep(&s->vertical_bs);
85+ av_freep(&l->horizontal_bs);
86+ av_freep(&l->vertical_bs);
8787
8888 ff_refstruct_pool_uninit(&s->tab_mvf_pool);
8989 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
127127 if (!l->qp_y_tab || !l->filter_slice_edges || !l->tab_slice_address)
128128 goto fail;
129129
130− s->horizontal_bs = av_calloc(l->bs_width, l->bs_height);
131− s->vertical_bs = av_calloc(l->bs_width, l->bs_height);
132− if (!s->horizontal_bs || !s->vertical_bs)
130+ l->horizontal_bs = av_calloc(l->bs_width, l->bs_height);
131+ l->vertical_bs = av_calloc(l->bs_width, l->bs_height);
132+ if (!l->horizontal_bs || !l->vertical_bs)
133133 goto fail;
134134
135135 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
29562956 new_sequence = 1;
29572957 }
29582958
2959− memset(s->horizontal_bs, 0, l->bs_width * l->bs_height);
2960− memset(s->vertical_bs, 0, l->bs_width * l->bs_height);
2959+ memset(l->horizontal_bs, 0, l->bs_width * l->bs_height);
2960+ memset(l->vertical_bs, 0, l->bs_width * l->bs_height);
29612961 memset(l->cbf_luma, 0, sps->min_tb_width * sps->min_tb_height);
29622962 memset(l->is_pcm, 0, (sps->min_pu_width + 1) * (sps->min_pu_height + 1));
29632963 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
462462 int32_t *tab_slice_address;
463463
464464 int8_t *qp_y_tab;
465+
466+ uint8_t *horizontal_bs;
467+ uint8_t *vertical_bs;
465468 } HEVCLayerContext;
466469
467470 typedef struct HEVCContext {
@@ -513,8 +516,6 @@ typedef struct HEVCContext { · 45 unmodified lines
513516 VideoDSPContext vdsp;
514517 BswapDSPContext bdsp;
515518 H274FilmGrainDatabase h274db;
516− uint8_t *horizontal_bs;
517− uint8_t *vertical_bs;
518519
519520 /** used on BE to byteswap the lines for checksumming */
520521 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