diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-06-30 17:57:35 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-07-25 23:32:08 +0200 |
commit | 6265b155bc6dfa9d327273b060af767cc391a3f1 (patch) | |
tree | a14720d5fb21722d2531ad6b50e6071e982bd1b5 | |
parent | 13b3e84a4fc9cf2ecfeaa7a9ed148eda496419a6 (diff) | |
download | ffmpeg-6265b155bc6dfa9d327273b060af767cc391a3f1.tar.gz |
avcodec/hevcpred: Pass HEVCLocalContext when slice-threading
The HEVC decoder has both HEVCContext and HEVCLocalContext
structures. The latter is supposed to be the structure
containing the per-slicethread state.
Yet that is not how it is handled in practice: Each HEVCLocalContext
has a unique HEVCContext allocated for it and each of these
coincides except in exactly one field: The corresponding
HEVCLocalContext. This makes it possible to pass the HEVCContext
everywhere where logically a HEVCLocalContext should be used.
This commit stops doing this for lavc/hevcpred as well as
the corresponding mips code; the latter is untested.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavcodec/hevcdec.c | 28 | ||||
-rw-r--r-- | libavcodec/hevcpred.h | 4 | ||||
-rw-r--r-- | libavcodec/hevcpred_template.c | 8 | ||||
-rw-r--r-- | libavcodec/mips/hevcpred_mips.h | 4 | ||||
-rw-r--r-- | libavcodec/mips/hevcpred_msa.c | 8 |
5 files changed, 26 insertions, 26 deletions
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 4879eaca42..943a956b56 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -1109,7 +1109,7 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, int trafo_size = 1 << log2_trafo_size; ff_hevc_set_neighbour_available(lc, x0, y0, trafo_size, trafo_size); - s->hpc.intra_pred[log2_trafo_size - 2](s, x0, y0, 0); + s->hpc.intra_pred[log2_trafo_size - 2](lc, x0, y0, 0); } if (cbf_luma || cbf_cb[0] || cbf_cr[0] || @@ -1195,7 +1195,7 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { if (lc->cu.pred_mode == MODE_INTRA) { ff_hevc_set_neighbour_available(lc, x0, y0 + (i << log2_trafo_size_c), trafo_size_h, trafo_size_v); - s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (i << log2_trafo_size_c), 1); + s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0 + (i << log2_trafo_size_c), 1); } if (cbf_cb[i]) ff_hevc_hls_residual_coding(lc, x0, y0 + (i << log2_trafo_size_c), @@ -1225,7 +1225,7 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, if (lc->cu.pred_mode == MODE_INTRA) { ff_hevc_set_neighbour_available(lc, x0, y0 + (i << log2_trafo_size_c), trafo_size_h, trafo_size_v); - s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (i << log2_trafo_size_c), 2); + s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0 + (i << log2_trafo_size_c), 2); } if (cbf_cr[i]) ff_hevc_hls_residual_coding(lc, x0, y0 + (i << log2_trafo_size_c), @@ -1254,7 +1254,7 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, if (lc->cu.pred_mode == MODE_INTRA) { ff_hevc_set_neighbour_available(lc, xBase, yBase + (i << log2_trafo_size), trafo_size_h, trafo_size_v); - s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (i << log2_trafo_size), 1); + s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase + (i << log2_trafo_size), 1); } if (cbf_cb[i]) ff_hevc_hls_residual_coding(lc, xBase, yBase + (i << log2_trafo_size), @@ -1264,7 +1264,7 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, if (lc->cu.pred_mode == MODE_INTRA) { ff_hevc_set_neighbour_available(lc, xBase, yBase + (i << log2_trafo_size), trafo_size_h, trafo_size_v); - s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (i << log2_trafo_size), 2); + s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase + (i << log2_trafo_size), 2); } if (cbf_cr[i]) ff_hevc_hls_residual_coding(lc, xBase, yBase + (i << log2_trafo_size), @@ -1276,26 +1276,26 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, int trafo_size_h = 1 << (log2_trafo_size_c + s->ps.sps->hshift[1]); int trafo_size_v = 1 << (log2_trafo_size_c + s->ps.sps->vshift[1]); ff_hevc_set_neighbour_available(lc, x0, y0, trafo_size_h, trafo_size_v); - s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0, 1); - s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0, 2); + s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0, 1); + s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0, 2); if (s->ps.sps->chroma_format_idc == 2) { ff_hevc_set_neighbour_available(lc, x0, y0 + (1 << log2_trafo_size_c), trafo_size_h, trafo_size_v); - s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (1 << log2_trafo_size_c), 1); - s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (1 << log2_trafo_size_c), 2); + s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0 + (1 << log2_trafo_size_c), 1); + s->hpc.intra_pred[log2_trafo_size_c - 2](lc, x0, y0 + (1 << log2_trafo_size_c), 2); } } else if (blk_idx == 3) { int trafo_size_h = 1 << (log2_trafo_size + 1); int trafo_size_v = 1 << (log2_trafo_size + s->ps.sps->vshift[1]); ff_hevc_set_neighbour_available(lc, xBase, yBase, trafo_size_h, trafo_size_v); - s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase, 1); - s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase, 2); + s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase, 1); + s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase, 2); if (s->ps.sps->chroma_format_idc == 2) { - ff_hevc_set_neighbour_available(lc, xBase, yBase + (1 << (log2_trafo_size)), + ff_hevc_set_neighbour_available(lc, xBase, yBase + (1 << log2_trafo_size), trafo_size_h, trafo_size_v); - s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (1 << (log2_trafo_size)), 1); - s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (1 << (log2_trafo_size)), 2); + s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase + (1 << log2_trafo_size), 1); + s->hpc.intra_pred[log2_trafo_size - 2](lc, xBase, yBase + (1 << log2_trafo_size), 2); } } } diff --git a/libavcodec/hevcpred.h b/libavcodec/hevcpred.h index eb17663683..b1b1dc4f3a 100644 --- a/libavcodec/hevcpred.h +++ b/libavcodec/hevcpred.h @@ -26,10 +26,10 @@ #include <stddef.h> #include <stdint.h> -struct HEVCContext; +struct HEVCLocalContext; typedef struct HEVCPredContext { - void (*intra_pred[4])(struct HEVCContext *s, int x0, int y0, int c_idx); + void (*intra_pred[4])(struct HEVCLocalContext *lc, int x0, int y0, int c_idx); void (*pred_planar[4])(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c index ca75ec1128..16d1c7f35f 100644 --- a/libavcodec/hevcpred_template.c +++ b/libavcodec/hevcpred_template.c @@ -27,7 +27,7 @@ #define POS(x, y) src[(x) + stride * (y)] -static av_always_inline void FUNC(intra_pred)(HEVCContext *s, int x0, int y0, +static av_always_inline void FUNC(intra_pred)(HEVCLocalContext *lc, int x0, int y0, int log2_size, int c_idx) { #define PU(x) \ @@ -70,7 +70,7 @@ do { \ else \ a = PIXEL_SPLAT_X4(ptr[i + 3]) - HEVCLocalContext *lc = s->HEVClc; + const HEVCContext *const s = lc->parent; int i; int hshift = s->ps.sps->hshift[c_idx]; int vshift = s->ps.sps->vshift[c_idx]; @@ -346,9 +346,9 @@ do { \ } #define INTRA_PRED(size) \ -static void FUNC(intra_pred_ ## size)(HEVCContext *s, int x0, int y0, int c_idx) \ +static void FUNC(intra_pred_ ## size)(HEVCLocalContext *lc, int x0, int y0, int c_idx) \ { \ - FUNC(intra_pred)(s, x0, y0, size, c_idx); \ + FUNC(intra_pred)(lc, x0, y0, size, c_idx); \ } INTRA_PRED(2) diff --git a/libavcodec/mips/hevcpred_mips.h b/libavcodec/mips/hevcpred_mips.h index f22feff85e..6848700010 100644 --- a/libavcodec/mips/hevcpred_mips.h +++ b/libavcodec/mips/hevcpred_mips.h @@ -67,7 +67,7 @@ void ff_pred_intra_pred_angular_3_msa(uint8_t *dst, const uint8_t *src_left, ptrdiff_t stride, int c_idx, int mode); -void ff_intra_pred_8_16x16_msa(struct HEVCContext *s, int x0, int y0, int c_idx); -void ff_intra_pred_8_32x32_msa(struct HEVCContext *s, int x0, int y0, int c_idx); +void ff_intra_pred_8_16x16_msa(struct HEVCLocalContext *s, int x0, int y0, int c_idx); +void ff_intra_pred_8_32x32_msa(struct HEVCLocalContext *s, int x0, int y0, int c_idx); #endif // #ifndef AVCODEC_MIPS_HEVCPRED_MIPS_H diff --git a/libavcodec/mips/hevcpred_msa.c b/libavcodec/mips/hevcpred_msa.c index f53276d34e..b056ee986b 100644 --- a/libavcodec/mips/hevcpred_msa.c +++ b/libavcodec/mips/hevcpred_msa.c @@ -1903,10 +1903,10 @@ void ff_pred_intra_pred_angular_3_msa(uint8_t *dst, } } -void ff_intra_pred_8_16x16_msa(HEVCContext *s, int x0, int y0, int c_idx) +void ff_intra_pred_8_16x16_msa(HEVCLocalContext *lc, int x0, int y0, int c_idx) { v16u8 vec0; - HEVCLocalContext *lc = s->HEVClc; + const HEVCContext *const s = lc->parent; int i; int hshift = s->ps.sps->hshift[c_idx]; int vshift = s->ps.sps->vshift[c_idx]; @@ -2416,14 +2416,14 @@ void ff_intra_pred_8_16x16_msa(HEVCContext *s, int x0, int y0, int c_idx) } } -void ff_intra_pred_8_32x32_msa(HEVCContext *s, int x0, int y0, int c_idx) +void ff_intra_pred_8_32x32_msa(HEVCLocalContext *lc, int x0, int y0, int c_idx) { v16u8 vec0, vec1; v8i16 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; v8i16 res0, res1, res2, res3; v8i16 mul_val0 = { 63, 62, 61, 60, 59, 58, 57, 56 }; v8i16 mul_val1 = { 1, 2, 3, 4, 5, 6, 7, 8 }; - HEVCLocalContext *lc = s->HEVClc; + const HEVCContext *const s = lc->parent; int i; int hshift = s->ps.sps->hshift[c_idx]; int vshift = s->ps.sps->vshift[c_idx]; |