[FFmpeg-devel] [RFC] [PATCH 1/4] lavc/h264_loopfilter: expose tc0_table (for checkasm)

Rémi Denis-Courmont remi at remlab.net
Mon Jul 1 20:08:04 EEST 2024


---
 libavcodec/h264_loopfilter.c | 50 ++++++++++++++++++------------------
 libavcodec/h264dsp.h         |  2 ++
 2 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c
index c164a289b7..9481882dd0 100644
--- a/libavcodec/h264_loopfilter.c
+++ b/libavcodec/h264_loopfilter.c
@@ -66,7 +66,7 @@ static const uint8_t beta_table[52*3] = {
     18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
     18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
 };
-static const uint8_t tc0_table[52*3][4] = {
+const int8_t ff_h264_tc0_table[52*3][4] = {
     {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
     {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
     {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
@@ -109,10 +109,10 @@ static av_always_inline void filter_mb_edgev(uint8_t *pix, int stride,
 
     if( bS[0] < 4 || !intra ) {
         int8_t tc[4];
-        tc[0] = tc0_table[index_a][bS[0]];
-        tc[1] = tc0_table[index_a][bS[1]];
-        tc[2] = tc0_table[index_a][bS[2]];
-        tc[3] = tc0_table[index_a][bS[3]];
+        tc[0] = ff_h264_tc0_table[index_a][bS[0]];
+        tc[1] = ff_h264_tc0_table[index_a][bS[1]];
+        tc[2] = ff_h264_tc0_table[index_a][bS[2]];
+        tc[3] = ff_h264_tc0_table[index_a][bS[3]];
         h->h264dsp.h264_h_loop_filter_luma(pix, stride, alpha, beta, tc);
     } else {
         h->h264dsp.h264_h_loop_filter_luma_intra(pix, stride, alpha, beta);
@@ -131,10 +131,10 @@ static av_always_inline void filter_mb_edgecv(uint8_t *pix, int stride,
 
     if( bS[0] < 4 || !intra ) {
         int8_t tc[4];
-        tc[0] = tc0_table[index_a][bS[0]]+1;
-        tc[1] = tc0_table[index_a][bS[1]]+1;
-        tc[2] = tc0_table[index_a][bS[2]]+1;
-        tc[3] = tc0_table[index_a][bS[3]]+1;
+        tc[0] = ff_h264_tc0_table[index_a][bS[0]]+1;
+        tc[1] = ff_h264_tc0_table[index_a][bS[1]]+1;
+        tc[2] = ff_h264_tc0_table[index_a][bS[2]]+1;
+        tc[3] = ff_h264_tc0_table[index_a][bS[3]]+1;
         h->h264dsp.h264_h_loop_filter_chroma(pix, stride, alpha, beta, tc);
     } else {
         h->h264dsp.h264_h_loop_filter_chroma_intra(pix, stride, alpha, beta);
@@ -154,10 +154,10 @@ static av_always_inline void filter_mb_mbaff_edgev(const H264Context *h, uint8_t
 
     if( bS[0] < 4 || !intra ) {
         int8_t tc[4];
-        tc[0] = tc0_table[index_a][bS[0*bsi]];
-        tc[1] = tc0_table[index_a][bS[1*bsi]];
-        tc[2] = tc0_table[index_a][bS[2*bsi]];
-        tc[3] = tc0_table[index_a][bS[3*bsi]];
+        tc[0] = ff_h264_tc0_table[index_a][bS[0*bsi]];
+        tc[1] = ff_h264_tc0_table[index_a][bS[1*bsi]];
+        tc[2] = ff_h264_tc0_table[index_a][bS[2*bsi]];
+        tc[3] = ff_h264_tc0_table[index_a][bS[3*bsi]];
         h->h264dsp.h264_h_loop_filter_luma_mbaff(pix, stride, alpha, beta, tc);
     } else {
         h->h264dsp.h264_h_loop_filter_luma_mbaff_intra(pix, stride, alpha, beta);
@@ -177,10 +177,10 @@ static av_always_inline void filter_mb_mbaff_edgecv(const H264Context *h,
 
     if( bS[0] < 4 || !intra ) {
         int8_t tc[4];
-        tc[0] = tc0_table[index_a][bS[0*bsi]] + 1;
-        tc[1] = tc0_table[index_a][bS[1*bsi]] + 1;
-        tc[2] = tc0_table[index_a][bS[2*bsi]] + 1;
-        tc[3] = tc0_table[index_a][bS[3*bsi]] + 1;
+        tc[0] = ff_h264_tc0_table[index_a][bS[0*bsi]] + 1;
+        tc[1] = ff_h264_tc0_table[index_a][bS[1*bsi]] + 1;
+        tc[2] = ff_h264_tc0_table[index_a][bS[2*bsi]] + 1;
+        tc[3] = ff_h264_tc0_table[index_a][bS[3*bsi]] + 1;
         h->h264dsp.h264_h_loop_filter_chroma_mbaff(pix, stride, alpha, beta, tc);
     } else {
         h->h264dsp.h264_h_loop_filter_chroma_mbaff_intra(pix, stride, alpha, beta);
@@ -199,10 +199,10 @@ static av_always_inline void filter_mb_edgeh(uint8_t *pix, int stride,
 
     if( bS[0] < 4 || !intra ) {
         int8_t tc[4];
-        tc[0] = tc0_table[index_a][bS[0]];
-        tc[1] = tc0_table[index_a][bS[1]];
-        tc[2] = tc0_table[index_a][bS[2]];
-        tc[3] = tc0_table[index_a][bS[3]];
+        tc[0] = ff_h264_tc0_table[index_a][bS[0]];
+        tc[1] = ff_h264_tc0_table[index_a][bS[1]];
+        tc[2] = ff_h264_tc0_table[index_a][bS[2]];
+        tc[3] = ff_h264_tc0_table[index_a][bS[3]];
         h->h264dsp.h264_v_loop_filter_luma(pix, stride, alpha, beta, tc);
     } else {
         h->h264dsp.h264_v_loop_filter_luma_intra(pix, stride, alpha, beta);
@@ -221,10 +221,10 @@ static av_always_inline void filter_mb_edgech(uint8_t *pix, int stride,
 
     if( bS[0] < 4 || !intra ) {
         int8_t tc[4];
-        tc[0] = tc0_table[index_a][bS[0]]+1;
-        tc[1] = tc0_table[index_a][bS[1]]+1;
-        tc[2] = tc0_table[index_a][bS[2]]+1;
-        tc[3] = tc0_table[index_a][bS[3]]+1;
+        tc[0] = ff_h264_tc0_table[index_a][bS[0]]+1;
+        tc[1] = ff_h264_tc0_table[index_a][bS[1]]+1;
+        tc[2] = ff_h264_tc0_table[index_a][bS[2]]+1;
+        tc[3] = ff_h264_tc0_table[index_a][bS[3]]+1;
         h->h264dsp.h264_v_loop_filter_chroma(pix, stride, alpha, beta, tc);
     } else {
         h->h264dsp.h264_v_loop_filter_chroma_intra(pix, stride, alpha, beta);
diff --git a/libavcodec/h264dsp.h b/libavcodec/h264dsp.h
index 4a9cb1568d..13371c59ea 100644
--- a/libavcodec/h264dsp.h
+++ b/libavcodec/h264dsp.h
@@ -117,6 +117,8 @@ typedef struct H264DSPContext {
     int (*startcode_find_candidate)(const uint8_t *buf, int size);
 } H264DSPContext;
 
+extern const int8_t ff_h264_tc0_table[][4];
+
 void ff_h264dsp_init(H264DSPContext *c, const int bit_depth,
                      const int chroma_format_idc);
 void ff_h264dsp_init_aarch64(H264DSPContext *c, const int bit_depth,
-- 
2.45.2



More information about the ffmpeg-devel mailing list