From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 11/18] avcodec/hevcpred: Pass HEVCLocalContext when slice-threading
Date: Fri, 1 Jul 2022 00:29:42 +0200
Message-ID: <DB6PR0101MB2214C64C673ACA70E17FDBF08FBA9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> (raw)
In-Reply-To: <DB6PR0101MB2214B28F90001024D646E62B8FBA9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com>
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>
---
libavcodec/hevcdec.c | 28 ++++++++++++++--------------
libavcodec/hevcpred.h | 4 ++--
libavcodec/hevcpred_template.c | 8 ++++----
libavcodec/mips/hevcpred_mips.h | 4 ++--
libavcodec/mips/hevcpred_msa.c | 8 ++++----
5 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index b3965932e9..2fd0f3acd3 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -1108,7 +1108,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] ||
@@ -1194,7 +1194,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),
@@ -1224,7 +1224,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),
@@ -1253,7 +1253,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),
@@ -1263,7 +1263,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),
@@ -1275,26 +1275,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];
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-06-30 22:31 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-30 21:48 [FFmpeg-devel] [PATCH v2 01/18] avcodec/pthread_slice: Don't reinitialise initialised mutex Andreas Rheinhardt
2022-06-30 22:29 ` [FFmpeg-devel] [PATCH 02/18] fate/hevc: add clip for persistent_rice_adaptation_enabled_flag Andreas Rheinhardt
2022-06-30 22:29 ` [FFmpeg-devel] [PATCH 03/18] avcodec/hevcdec: Don't initialize HEVCContexts twice Andreas Rheinhardt
2022-06-30 22:29 ` [FFmpeg-devel] [PATCH 04/18] avcodec/hevcdec: Add pointers to logctx and parent ctx to HEVCLocalCtx Andreas Rheinhardt
2022-06-30 22:29 ` [FFmpeg-devel] [PATCH 05/18] avcodec/hevc_refs: Constify ff_hevc_get_ref_list() Andreas Rheinhardt
2022-06-30 22:29 ` [FFmpeg-devel] [PATCH 06/18] avcodec/hevc_cabac: Don't cast const away unnecessarily Andreas Rheinhardt
2022-06-30 22:29 ` [FFmpeg-devel] [PATCH 07/18] avcodec/hevc_mvs: Pass HEVCLocalContext when slice-threading Andreas Rheinhardt
2022-06-30 22:29 ` [FFmpeg-devel] [PATCH 08/18] avcodec/hevc_filter: " Andreas Rheinhardt
2022-06-30 22:29 ` [FFmpeg-devel] [PATCH 09/18] avcodec/hevcdec: Add stat_coeffs to HEVCABACState Andreas Rheinhardt
2022-07-02 8:34 ` Anton Khirnov
2022-07-02 10:40 ` Andreas Rheinhardt
2022-07-02 11:31 ` Andreas Rheinhardt
2022-07-02 11:43 ` Andreas Rheinhardt
2022-06-30 22:29 ` [FFmpeg-devel] [PATCH 10/18] avcodec/hevc_cabac: Pass HEVCLocalContext when slice-threading Andreas Rheinhardt
2022-06-30 22:29 ` Andreas Rheinhardt [this message]
2022-06-30 22:29 ` [FFmpeg-devel] [PATCH 12/18] avcodec/hevcdec: " Andreas Rheinhardt
2022-06-30 22:29 ` [FFmpeg-devel] [PATCH 13/18] avcodec/hevcdec: Pass HEVCLocalContext** via execute2 Andreas Rheinhardt
2022-06-30 22:29 ` [FFmpeg-devel] [PATCH 14/18] avcodec/hevcdec: Don't allocate redundant HEVCContexts Andreas Rheinhardt
2022-07-01 21:25 ` Michael Niedermayer
2022-07-02 6:32 ` Andreas Rheinhardt
2022-07-05 22:24 ` Michael Niedermayer
2022-07-06 8:21 ` Andreas Rheinhardt
2022-07-23 5:44 ` Andreas Rheinhardt
2022-07-23 14:38 ` Michael Niedermayer
2022-07-23 21:42 ` Andreas Rheinhardt
2022-07-24 21:23 ` Michael Niedermayer
2022-07-24 21:26 ` Andreas Rheinhardt
2022-07-25 19:44 ` Michael Niedermayer
2022-07-25 19:58 ` Andreas Rheinhardt
2022-06-30 22:29 ` [FFmpeg-devel] [PATCH 15/18] avcodec/hevcdec: Check allocation Andreas Rheinhardt
2022-06-30 22:29 ` [FFmpeg-devel] [PATCH 16/18] avcodec/pthread_slice: Combine allocating and zeroing entries Andreas Rheinhardt
2022-06-30 22:29 ` [FFmpeg-devel] [PATCH 17/18] avcodec/pthread_slice: Reuse buffer if possible Andreas Rheinhardt
2022-07-01 11:33 ` Paul B Mahol
2022-07-01 13:21 ` Tomas Härdin
2022-07-22 20:04 ` Andreas Rheinhardt
2022-06-30 22:29 ` [FFmpeg-devel] [PATCH 18/18] avcodec/hevcdec: Move allocation after error checks Andreas Rheinhardt
2022-07-01 13:30 ` [FFmpeg-devel] [PATCH v2 01/18] avcodec/pthread_slice: Don't reinitialise initialised mutex Tomas Härdin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DB6PR0101MB2214C64C673ACA70E17FDBF08FBA9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com \
--to=andreas.rheinhardt@outlook.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git