diff mbox series

[FFmpeg-devel,1/2] lavc/h264dsp: remove MMI 8-bit chroma DC dequant

Message ID 20240707114448.32270-1-remi@remlab.net
State New
Headers show
Series [FFmpeg-devel,1/2] lavc/h264dsp: remove MMI 8-bit chroma DC dequant | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 fail Make fate failed
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Rémi Denis-Courmont July 7, 2024, 11:44 a.m. UTC
The function is exactly identical to the C reference, only with the
constant propagated manually. It does not optimise anything.
---
 libavcodec/mips/h264dsp_init_mips.c |  5 +----
 libavcodec/mips/h264dsp_mips.h      |  1 -
 libavcodec/mips/h264dsp_mmi.c       | 14 --------------
 3 files changed, 1 insertion(+), 19 deletions(-)

Comments

Rémi Denis-Courmont July 7, 2024, 11:58 a.m. UTC | #1
Le sunnuntaina 7. heinäkuuta 2024, 14.44.47 EEST Rémi Denis-Courmont a écrit :
> The function is exactly identical to the C reference, only with the
> constant propagated manually. It does not optimise anything.

There are presently no (other) implementations for 
`H264DSPContext.h264_chroma_dc_dequant_idct`, which is used by H.264 and SVQ3 
decoders. I don't know if we should keep the pointers anyway or just hard-code 
the calls to the C implementation.

I am not sure if it would be possible to marginally optimise the functions 
with scalar product or matrix extensions... at least those extensions that do 
support widening 16x16 multiplications. (This is unfortunately not a given. 
With the AI/ML hype,16-bit floats, 8-bit and/or 4-bit integers are the more 
commonly supported types.)
diff mbox series

Patch

diff --git a/libavcodec/mips/h264dsp_init_mips.c b/libavcodec/mips/h264dsp_init_mips.c
index e33df32c71..615b00d142 100644
--- a/libavcodec/mips/h264dsp_init_mips.c
+++ b/libavcodec/mips/h264dsp_init_mips.c
@@ -46,10 +46,7 @@  av_cold void ff_h264dsp_init_mips(H264DSPContext *c, const int bit_depth,
 
             c->h264_luma_dc_dequant_idct = ff_h264_luma_dc_dequant_idct_8_mmi;
 
-            if (chroma_format_idc <= 1)
-                c->h264_chroma_dc_dequant_idct =
-                    ff_h264_chroma_dc_dequant_idct_8_mmi;
-            else
+            if (chroma_format_idc > 1)
                 c->h264_chroma_dc_dequant_idct =
                     ff_h264_chroma422_dc_dequant_idct_8_mmi;
 
diff --git a/libavcodec/mips/h264dsp_mips.h b/libavcodec/mips/h264dsp_mips.h
index 93a201c66a..7e1dcdd013 100644
--- a/libavcodec/mips/h264dsp_mips.h
+++ b/libavcodec/mips/h264dsp_mips.h
@@ -340,7 +340,6 @@  void ff_h264_idct_add8_422_8_mmi(uint8_t **dest, const int *block_offset,
         int16_t *block, int stride, const uint8_t nnzc[15*8]);
 void ff_h264_luma_dc_dequant_idct_8_mmi(int16_t *output, int16_t *input,
         int qmul);
-void ff_h264_chroma_dc_dequant_idct_8_mmi(int16_t *block, int qmul);
 void ff_h264_chroma422_dc_dequant_idct_8_mmi(int16_t *block, int qmul);
 
 void ff_h264_weight_pixels16_8_mmi(uint8_t *block, ptrdiff_t stride, int height,
diff --git a/libavcodec/mips/h264dsp_mmi.c b/libavcodec/mips/h264dsp_mmi.c
index dff3d331b1..1ee8ca2f1c 100644
--- a/libavcodec/mips/h264dsp_mmi.c
+++ b/libavcodec/mips/h264dsp_mmi.c
@@ -1117,20 +1117,6 @@  void ff_h264_chroma422_dc_dequant_idct_8_mmi(int16_t *block, int qmul)
     block[112]= (t[7]*qmul + 128) >> 8;
 }
 
-void ff_h264_chroma_dc_dequant_idct_8_mmi(int16_t *block, int qmul)
-{
-    int a,b,c,d;
-
-    d = block[0] - block[16];
-    a = block[0] + block[16];
-    b = block[32] - block[48];
-    c = block[32] + block[48];
-    block[0] = ((a+c)*qmul) >> 7;
-    block[16]= ((d+b)*qmul) >> 7;
-    block[32]= ((a-c)*qmul) >> 7;
-    block[48]= ((d-b)*qmul) >> 7;
-}
-
 void ff_h264_weight_pixels16_8_mmi(uint8_t *block, ptrdiff_t stride, int height,
         int log2_denom, int weight, int offset)
 {