diff mbox series

[FFmpeg-devel] avcodec/mips: Fix MMI macro replaces in HEVC Decoder

Message ID 09316e8e931c4f33a5980bb97ae3cca3@360.cn
State New
Headers show
Series [FFmpeg-devel] avcodec/mips: Fix MMI macro replaces in HEVC Decoder | expand

Checks

Context Check Description
yinshiyou/configure_loongarch64 warning Failed to apply patch
andriy/configure_x86 warning Failed to apply patch

Commit Message

戚铁铮 Aug. 18, 2022, 7:15 a.m. UTC
The latest commit of Loongson MMI macro replaces were incorrect.
It makes a mass of green tints on HEVC videos when playing. I've
compared it with the older MMI implementation, and found out that
several lines have been replaced by wrong macros.


Signed-off-by: Qi Tiezheng <qitiezheng@360.cn>
---
 libavcodec/mips/hevcdsp_mmi.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)


--
2.25.1

Comments

陈昊 Aug. 18, 2022, 8:29 a.m. UTC | #1
There are still some bugs unresolved in HEVC decoding. The 
checkasm-hevc-pel test failed. It's suggested to repair together.

在 2022/8/18 下午3:15, 戚铁铮 写道:
> The latest commit of Loongson MMI macro replaces were incorrect.
> It makes a mass of green tints on HEVC videos when playing. I've
> compared it with the older MMI implementation, and found out that
> several lines have been replaced by wrong macros.
>
>
> Signed-off-by: Qi Tiezheng <qitiezheng@360.cn>
> ---
>   libavcodec/mips/hevcdsp_mmi.c | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
>
>
> diff --git a/libavcodec/mips/hevcdsp_mmi.c b/libavcodec/mips/hevcdsp_mmi.c
> index 0ea88a7c08..2ded3fc0bb 100644
> --- a/libavcodec/mips/hevcdsp_mmi.c
> +++ b/libavcodec/mips/hevcdsp_mmi.c
> @@ -80,7 +80,7 @@ void ff_hevc_put_hevc_qpel_h##w##_8_mmi(int16_t *dst, const uint8_t *_src, \
>           "paddh        %[ftmp3],      %[ftmp3],      %[ftmp4]    \n\t"    \
>           "paddh        %[ftmp5],      %[ftmp5],      %[ftmp6]    \n\t"    \
>           "paddh        %[ftmp3],      %[ftmp3],      %[ftmp5]    \n\t"    \
> -        MMI_ULDC1(%[ftmp3], %[dst], 0x00)                                \
> +        MMI_USDC1(%[ftmp3], %[dst], 0x00)                                \
>                                                                            \
>           "daddi        %[x],          %[x],         -0x01        \n\t"    \
>           PTR_ADDIU    "%[src],        %[src],        0x04        \n\t"    \
> @@ -178,7 +178,7 @@ void ff_hevc_put_hevc_qpel_hv##w##_8_mmi(int16_t *dst, const uint8_t *_src,\
>           "paddh        %[ftmp3],      %[ftmp3],      %[ftmp4]    \n\t"    \
>           "paddh        %[ftmp5],      %[ftmp5],      %[ftmp6]    \n\t"    \
>           "paddh        %[ftmp3],      %[ftmp3],      %[ftmp5]    \n\t"    \
> -        MMI_ULDC1(%[ftmp3], %[tmp], 0x00)                                \
> +        MMI_USDC1(%[ftmp3], %[tmp], 0x00)                                \
>                                                                            \
>           "daddi        %[x],          %[x],         -0x01        \n\t"    \
>           PTR_ADDIU    "%[src],        %[src],        0x04        \n\t"    \
> @@ -690,10 +690,10 @@ void ff_hevc_put_hevc_epel_bi_hv##w##_8_mmi(uint8_t *_dst,              \
>                                                                           \
>           "1:                                                     \n\t"   \
>           "2:                                                     \n\t"   \
> -        MMI_ULDC1(%[ftmp3], %[src], 0x00)                               \
> -        MMI_ULDC1(%[ftmp4], %[src], 0x01)                               \
> -        MMI_ULDC1(%[ftmp5], %[src], 0x02)                               \
> -        MMI_ULDC1(%[ftmp6], %[src], 0x03)                               \
> +        MMI_ULWC1(%[ftmp2], %[src], 0x00)                               \
> +        MMI_ULWC1(%[ftmp3], %[src], 0x01)                               \
> +        MMI_ULWC1(%[ftmp4], %[src], 0x02)                               \
> +        MMI_ULWC1(%[ftmp5], %[src], 0x03)                               \
>           "punpcklbh    %[ftmp2],      %[ftmp2],      %[ftmp0]    \n\t"   \
>           "pmullh       %[ftmp2],      %[ftmp2],      %[ftmp1]    \n\t"   \
>           "punpcklbh    %[ftmp3],      %[ftmp3],      %[ftmp0]    \n\t"   \
> @@ -707,7 +707,7 @@ void ff_hevc_put_hevc_epel_bi_hv##w##_8_mmi(uint8_t *_dst,              \
>           "paddh        %[ftmp2],      %[ftmp2],      %[ftmp3]    \n\t"   \
>           "paddh        %[ftmp4],      %[ftmp4],      %[ftmp5]    \n\t"   \
>           "paddh        %[ftmp2],      %[ftmp2],      %[ftmp4]    \n\t"   \
> -        MMI_ULDC1(%[ftmp2], %[tmp], 0x00)                               \
> +        MMI_USDC1(%[ftmp2], %[tmp], 0x00)                               \
>                                                                           \
>           "daddi        %[x],          %[x],         -0x01        \n\t"   \
>           PTR_ADDIU    "%[src],        %[src],        0x04        \n\t"   \
> @@ -773,7 +773,7 @@ void ff_hevc_put_hevc_epel_bi_hv##w##_8_mmi(uint8_t *_dst,              \
>           "paddw        %[ftmp5],      %[ftmp5],      %[ftmp6]    \n\t"   \
>           "psraw        %[ftmp5],      %[ftmp5],      %[ftmp0]    \n\t"   \
>           "packsswh     %[ftmp3],      %[ftmp3],      %[ftmp5]    \n\t"   \
> -        MMI_ULDC1(%[ftmp4], %[tmp], 0x02)                               \
> +        MMI_ULDC1(%[ftmp4], %[tmp], 0x00)                               \
>           "li           %[rtmp0],      0x10                       \n\t"   \
>           "dmtc1        %[rtmp0],      %[ftmp8]                   \n\t"   \
>           "punpcklhw    %[ftmp5],      %[ftmp2],      %[ftmp3]    \n\t"   \
> --
> 2.25.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".
Shiyou Yin Aug. 18, 2022, 9:17 a.m. UTC | #2
> 2022年8月18日 16:29,Hao Chen <chenhao@loongson.cn> 写道:
> 
> There are still some bugs unresolved in HEVC decoding. The checkasm-hevc-pel test failed. It's suggested to repair together.
> 
> 在 2022/8/18 下午3:15, 戚铁铮 写道:
>> The latest commit of Loongson MMI macro replaces were incorrect.
>> It makes a mass of green tints on HEVC videos when playing. I've
>> compared it with the older MMI implementation, and found out that
>> several lines have been replaced by wrong macros.
>> 
>> 
>> Signed-off-by: Qi Tiezheng <qitiezheng@360.cn>
>> ---
>>  libavcodec/mips/hevcdsp_mmi.c | 16 ++++++++--------
>>  1 file changed, 8 insertions(+), 8 deletions(-)
>> 
>> 
>> diff --git a/libavcodec/mips/hevcdsp_mmi.c b/libavcodec/mips/hevcdsp_mmi.c
>> index 0ea88a7c08..2ded3fc0bb 100644
>> --- a/libavcodec/mips/hevcdsp_mmi.c
>> +++ b/libavcodec/mips/hevcdsp_mmi.c
>> @@ -80,7 +80,7 @@ void ff_hevc_put_hevc_qpel_h##w##_8_mmi(int16_t *dst, const uint8_t *_src, \
>>          "paddh        %[ftmp3],      %[ftmp3],      %[ftmp4]    \n\t"    \
>>          "paddh        %[ftmp5],      %[ftmp5],      %[ftmp6]    \n\t"    \
>>          "paddh        %[ftmp3],      %[ftmp3],      %[ftmp5]    \n\t"    \
>> -        MMI_ULDC1(%[ftmp3], %[dst], 0x00)                                \
>> +        MMI_USDC1(%[ftmp3], %[dst], 0x00)                                \
>>                                                                           \
>>          "daddi        %[x],          %[x],         -0x01        \n\t"    \
>>          PTR_ADDIU    "%[src],        %[src],        0x04        \n\t"    \
>> @@ -178,7 +178,7 @@ void ff_hevc_put_hevc_qpel_hv##w##_8_mmi(int16_t *dst, const uint8_t *_src,\
>>          "paddh        %[ftmp3],      %[ftmp3],      %[ftmp4]    \n\t"    \
>>          "paddh        %[ftmp5],      %[ftmp5],      %[ftmp6]    \n\t"    \
>>          "paddh        %[ftmp3],      %[ftmp3],      %[ftmp5]    \n\t"    \
>> -        MMI_ULDC1(%[ftmp3], %[tmp], 0x00)                                \
>> +        MMI_USDC1(%[ftmp3], %[tmp], 0x00)                                \
>>                                                                           \
>>          "daddi        %[x],          %[x],         -0x01        \n\t"    \
>>          PTR_ADDIU    "%[src],        %[src],        0x04        \n\t"    \
>> @@ -690,10 +690,10 @@ void ff_hevc_put_hevc_epel_bi_hv##w##_8_mmi(uint8_t *_dst,              \
>>                                                                          \
>>          "1:                                                     \n\t"   \
>>          "2:                                                     \n\t"   \
>> -        MMI_ULDC1(%[ftmp3], %[src], 0x00)                               \
>> -        MMI_ULDC1(%[ftmp4], %[src], 0x01)                               \
>> -        MMI_ULDC1(%[ftmp5], %[src], 0x02)                               \
>> -        MMI_ULDC1(%[ftmp6], %[src], 0x03)                               \
>> +        MMI_ULWC1(%[ftmp2], %[src], 0x00)                               \
>> +        MMI_ULWC1(%[ftmp3], %[src], 0x01)                               \
>> +        MMI_ULWC1(%[ftmp4], %[src], 0x02)                               \
>> +        MMI_ULWC1(%[ftmp5], %[src], 0x03)                               \
>>          "punpcklbh    %[ftmp2],      %[ftmp2],      %[ftmp0]    \n\t"   \
>>          "pmullh       %[ftmp2],      %[ftmp2],      %[ftmp1]    \n\t"   \
>>          "punpcklbh    %[ftmp3],      %[ftmp3],      %[ftmp0]    \n\t"   \
>> @@ -707,7 +707,7 @@ void ff_hevc_put_hevc_epel_bi_hv##w##_8_mmi(uint8_t *_dst,              \
>>          "paddh        %[ftmp2],      %[ftmp2],      %[ftmp3]    \n\t"   \
>>          "paddh        %[ftmp4],      %[ftmp4],      %[ftmp5]    \n\t"   \
>>          "paddh        %[ftmp2],      %[ftmp2],      %[ftmp4]    \n\t"   \
>> -        MMI_ULDC1(%[ftmp2], %[tmp], 0x00)                               \
>> +        MMI_USDC1(%[ftmp2], %[tmp], 0x00)                               \
>>                                                                          \
>>          "daddi        %[x],          %[x],         -0x01        \n\t"   \
>>          PTR_ADDIU    "%[src],        %[src],        0x04        \n\t"   \
>> @@ -773,7 +773,7 @@ void ff_hevc_put_hevc_epel_bi_hv##w##_8_mmi(uint8_t *_dst,              \
>>          "paddw        %[ftmp5],      %[ftmp5],      %[ftmp6]    \n\t"   \
>>          "psraw        %[ftmp5],      %[ftmp5],      %[ftmp0]    \n\t"   \
>>          "packsswh     %[ftmp3],      %[ftmp3],      %[ftmp5]    \n\t"   \
>> -        MMI_ULDC1(%[ftmp4], %[tmp], 0x02)                               \
>> +        MMI_ULDC1(%[ftmp4], %[tmp], 0x00)                               \

Here should be ‘src2'
MMI_ULDC1(%[FTMP4], %[src2], 0x00)



>>          "li           %[rtmp0],      0x10                       \n\t"   \
>>          "dmtc1        %[rtmp0],      %[ftmp8]                   \n\t"   \
>>          "punpcklhw    %[ftmp5],      %[ftmp2],      %[ftmp3]    \n\t"   \
>> --
>> 2.25.1
>> 
>>
diff mbox series

Patch

diff --git a/libavcodec/mips/hevcdsp_mmi.c b/libavcodec/mips/hevcdsp_mmi.c
index 0ea88a7c08..2ded3fc0bb 100644
--- a/libavcodec/mips/hevcdsp_mmi.c
+++ b/libavcodec/mips/hevcdsp_mmi.c
@@ -80,7 +80,7 @@  void ff_hevc_put_hevc_qpel_h##w##_8_mmi(int16_t *dst, const uint8_t *_src, \
         "paddh        %[ftmp3],      %[ftmp3],      %[ftmp4]    \n\t"    \
         "paddh        %[ftmp5],      %[ftmp5],      %[ftmp6]    \n\t"    \
         "paddh        %[ftmp3],      %[ftmp3],      %[ftmp5]    \n\t"    \
-        MMI_ULDC1(%[ftmp3], %[dst], 0x00)                                \
+        MMI_USDC1(%[ftmp3], %[dst], 0x00)                                \
                                                                          \
         "daddi        %[x],          %[x],         -0x01        \n\t"    \
         PTR_ADDIU    "%[src],        %[src],        0x04        \n\t"    \
@@ -178,7 +178,7 @@  void ff_hevc_put_hevc_qpel_hv##w##_8_mmi(int16_t *dst, const uint8_t *_src,\
         "paddh        %[ftmp3],      %[ftmp3],      %[ftmp4]    \n\t"    \
         "paddh        %[ftmp5],      %[ftmp5],      %[ftmp6]    \n\t"    \
         "paddh        %[ftmp3],      %[ftmp3],      %[ftmp5]    \n\t"    \
-        MMI_ULDC1(%[ftmp3], %[tmp], 0x00)                                \
+        MMI_USDC1(%[ftmp3], %[tmp], 0x00)                                \
                                                                          \
         "daddi        %[x],          %[x],         -0x01        \n\t"    \
         PTR_ADDIU    "%[src],        %[src],        0x04        \n\t"    \
@@ -690,10 +690,10 @@  void ff_hevc_put_hevc_epel_bi_hv##w##_8_mmi(uint8_t *_dst,              \
                                                                         \
         "1:                                                     \n\t"   \
         "2:                                                     \n\t"   \
-        MMI_ULDC1(%[ftmp3], %[src], 0x00)                               \
-        MMI_ULDC1(%[ftmp4], %[src], 0x01)                               \
-        MMI_ULDC1(%[ftmp5], %[src], 0x02)                               \
-        MMI_ULDC1(%[ftmp6], %[src], 0x03)                               \
+        MMI_ULWC1(%[ftmp2], %[src], 0x00)                               \
+        MMI_ULWC1(%[ftmp3], %[src], 0x01)                               \
+        MMI_ULWC1(%[ftmp4], %[src], 0x02)                               \
+        MMI_ULWC1(%[ftmp5], %[src], 0x03)                               \
         "punpcklbh    %[ftmp2],      %[ftmp2],      %[ftmp0]    \n\t"   \
         "pmullh       %[ftmp2],      %[ftmp2],      %[ftmp1]    \n\t"   \
         "punpcklbh    %[ftmp3],      %[ftmp3],      %[ftmp0]    \n\t"   \
@@ -707,7 +707,7 @@  void ff_hevc_put_hevc_epel_bi_hv##w##_8_mmi(uint8_t *_dst,              \
         "paddh        %[ftmp2],      %[ftmp2],      %[ftmp3]    \n\t"   \
         "paddh        %[ftmp4],      %[ftmp4],      %[ftmp5]    \n\t"   \
         "paddh        %[ftmp2],      %[ftmp2],      %[ftmp4]    \n\t"   \
-        MMI_ULDC1(%[ftmp2], %[tmp], 0x00)                               \
+        MMI_USDC1(%[ftmp2], %[tmp], 0x00)                               \
                                                                         \
         "daddi        %[x],          %[x],         -0x01        \n\t"   \
         PTR_ADDIU    "%[src],        %[src],        0x04        \n\t"   \
@@ -773,7 +773,7 @@  void ff_hevc_put_hevc_epel_bi_hv##w##_8_mmi(uint8_t *_dst,              \
         "paddw        %[ftmp5],      %[ftmp5],      %[ftmp6]    \n\t"   \
         "psraw        %[ftmp5],      %[ftmp5],      %[ftmp0]    \n\t"   \
         "packsswh     %[ftmp3],      %[ftmp3],      %[ftmp5]    \n\t"   \
-        MMI_ULDC1(%[ftmp4], %[tmp], 0x02)                               \
+        MMI_ULDC1(%[ftmp4], %[tmp], 0x00)                               \
         "li           %[rtmp0],      0x10                       \n\t"   \
         "dmtc1        %[rtmp0],      %[ftmp8]                   \n\t"   \
         "punpcklhw    %[ftmp5],      %[ftmp2],      %[ftmp3]    \n\t"   \