FFmpeg icon indicating copy to clipboard operation
FFmpeg copied to clipboard

Support 16 Bits

Open QSXW opened this issue 9 months ago • 13 comments

QSXW avatar Apr 06 '25 21:04 QSXW

Current Progress

+++++++++ report +++++++++
passed files:
    12b444SPwpp_A_OPPO_1.bit
    16b400P16_A_Sony_2.bit
    16b400P16_B_Sony_2.bit
    16b400P16_C_Sony_2.bit
    16b400P16_D_Sony_2.bit
    16b400P16_E_Sony_2.bit
    16b420P16_A_Sony_2.bit
    16b420P16_B_Sony_2.bit
    16b420P16_C_Sony_2.bit
    16b420P16_D_Sony_2.bit
    16b420P16_E_Sony_2.bit
    16b422P16_A_Sony_2.bit
    16b422P16_B_Sony_2.bit
    16b422P16_C_Sony_2.bit
    16b422P16_D_Sony_2.bit
    16b422P16_E_Sony_2.bit
    16b444Iepp_A_Sharp_3.bit
    16b444Ierrc_A_Qualcomm_2.bit
    16b444Ietsrc_A_Kwai_2.bit
    16b444Iprrc_A_Qualcomm_2.bit
    16b444Irlscp_A_OPPO_2.bit
    16b444Ivvc1_A_Alibaba_2.bit
    16b444Iwpp_A_OPPO_1.bit
    16b444SPepp_A_Sharp_3.bit
    16b444SPerrc_A_Qualcomm_2.bit
    16b444SPetsrc_A_Kwai_2.bit
    16b444SPetsrc_B_Kwai_2.bit
    16b444SPetsrc_C_Kwai_2.bit
    16b444SPetsrc_D_Kwai_2.bit
    16b444SPetsrc_E_Kwai_2.bit
    16b444SPetsrc_F_Kwai_2.bit
    16b444SPetsrc_G_Kwai_2.bit
    16b444SPetsrc_H_Kwai_2.bit
    16b444SPprrc_A_Qualcomm_2.bit
    16b444SPrlscp_A_OPPO_2.bit
    16b444SPvvc1_A_Alibaba_2.bit
    16b444SPwpp_A_OPPO_1.bit
    16b444epp_A_Sharp_3.bit
    16b444errc_A_Qualcomm_2.bit
    16b444errc_B_Qualcomm_2.bit
    16b444errc_C_Qualcomm_2.bit
    16b444etsrc_A_Kwai_2.bit
    16b444prrc_A_Qualcomm_2.bit
    16b444rlscp_A_OPPO_2.bit
    16b444vvc1_A_Alibaba_2.bit
    16b444wpp_A_OPPO_1.bit

total = 46, passed = 46, skipped = 0, failed = 0
----------

QSXW avatar Apr 06 '25 21:04 QSXW

Hi @nuomi2021,

All 16 bits clips have passed the conformance test with my work. I'll update the commit soon.

And it looks like there are a lot of md5 are different from the output of the lastest VTM. I regenerated a new md5.txt for 16 bits clips using the VTM DecoderApp.exe.

919390752070fa8336bbf58f1667e2f3  12b444SPwpp_A_OPPO_1.bit
42b7b2991be767a25afe5cbae9dd4e8d  16b400P16_A_Sony_2.bit
b5c82e0df75c557560ef1081526b78e2  16b400P16_B_Sony_2.bit
d4e4d329736c703c09ac76120bb1ce70  16b400P16_C_Sony_2.bit
385d13f359c3224dbbc2ed3e9577949a  16b400P16_D_Sony_2.bit
1a7defbd5fbba309701de1ad54fd6c6e  16b400P16_E_Sony_2.bit
1849bc4a9792133ff6fb8c76d4d851e1  16b420P16_A_Sony_2.bit
c1809287ea51e972d9fad9fc1076ba91  16b420P16_B_Sony_2.bit
193b6df8049063b01e97d2c7a990aa97  16b420P16_C_Sony_2.bit
d643675f7f356f35e1225f62d34f7801  16b420P16_D_Sony_2.bit
0c4a6a7c9836ca79546594a71ee77c37  16b420P16_E_Sony_2.bit
db9d5cc717523a323f8d4086cff096eb  16b422P16_A_Sony_2.bit
e029846ccf9a97baf35e48e6807740f8  16b422P16_B_Sony_2.bit
474108fa8a32c268f7fec11aa804d2c5  16b422P16_C_Sony_2.bit
db3b2608cc5f0dd563ff081260dc1945  16b422P16_D_Sony_2.bit
e78b3122c6178a8a4b9ba726348a1765  16b422P16_E_Sony_2.bit
b8a3e2833999875af3f3ca742f34eee0  16b444epp_A_Sharp_3.bit
32a43d658bc07731966cee49a6dedfeb  16b444errc_A_Qualcomm_2.bit
50d603566185d648d13aef461d6a178d  16b444errc_B_Qualcomm_2.bit
b913fe94feaa06dfb927f2fd0757ae48  16b444errc_C_Qualcomm_2.bit
53e0a2bef4279958c0c840769dc07f0f  16b444etsrc_A_Kwai_2.bit
8d0b62c7e2975639233e2557e949f13b  16b444Iepp_A_Sharp_3.bit
3042e52aadfceb6466b5648084f5e585  16b444Ierrc_A_Qualcomm_2.bit
70a8bcfc5503025bd5af7b9cdb51cda6  16b444Ietsrc_A_Kwai_2.bit
f871e788d05c2c835e61df3101055cf8  16b444Iprrc_A_Qualcomm_2.bit
429cef641d9056fa54144ddb4caa6e9b  16b444Irlscp_A_OPPO_2.bit
dd468bfebf43a1b070dc83f153d9bfe5  16b444Ivvc1_A_Alibaba_2.bit
9e6daf42ba2452ea49b6858d9addcc0d  16b444Iwpp_A_OPPO_1.bit
6b6f9c5f0bbe7bc4dd1e450523af932c  16b444prrc_A_Qualcomm_2.bit
577454220ab030066f8a0e38932e75e5  16b444rlscp_A_OPPO_2.bit
b92925e3f4c91b03928a11e9cda5ee7b  16b444SPepp_A_Sharp_3.bit
8b996da8e023d57a9e4a4b154f67b7b8  16b444SPerrc_A_Qualcomm_2.bit
8ef7eb0a10492be8d5919278340b3b76  16b444SPetsrc_A_Kwai_2.bit
c6b63af27b130d976a48bda224a6d6d6  16b444SPetsrc_B_Kwai_2.bit
6bb9195ff424ee2ef314d5df65b65f6e  16b444SPetsrc_C_Kwai_2.bit
730dd9b350c908fe6d90d4d1c4fe7401  16b444SPetsrc_D_Kwai_2.bit
c7de5b2e92aa0cbd2d8e253770905e39  16b444SPetsrc_E_Kwai_2.bit
74b943117a3393e6323e10d870655db6  16b444SPetsrc_F_Kwai_2.bit
0f9fa19d772d5ef9b802ba8439581763  16b444SPetsrc_G_Kwai_2.bit
fc5eb8d84e16de9a9d4026251cb2371c  16b444SPetsrc_H_Kwai_2.bit
5f49aedb923cb97eaade3ecdf993e250  16b444SPprrc_A_Qualcomm_2.bit
364f190f0cde49ce82c02126d284a2b5  16b444SPrlscp_A_OPPO_2.bit
dcdd6fc022a56a9f6329c432aa92f82a  16b444SPvvc1_A_Alibaba_2.bit
0ac7c1412207ec2978f9c00f3c1f63d7  16b444SPwpp_A_OPPO_1.bit
1fc040dd023cd452658730985ff3dfa8  16b444vvc1_A_Alibaba_2.bit
b430c873fb453b36d1dcde19e051716f  16b444wpp_A_OPPO_1.bit

You can try ./DecoderApp.exe -i 16b400P16_B_Sony_2.bit -o 16b400P16_B_Sony_2.yuv and generate the md5, and you will find it is different from the md5 downloaded from VTM test. image

After my change, our result will match the latest VTM.

QSXW avatar Apr 13 '25 19:04 QSXW

is the vtm conformance set updated?

nuomi2021 avatar Apr 14 '25 12:04 nuomi2021

is the vtm conformance set updated?

Yeah. I manually downloaded the clips for each version and found that they doesn't match the md5 of latest DecderApp.exe.

QSXW avatar Apr 14 '25 14:04 QSXW

@nuomi2021 Is it necessary to add support for 13/15 bit depth? We can support decoding by simply adding VVC_DSP(15), but it may not be used by any user. Maybe we can just support 14 and 16 bits, which is enough.

QSXW avatar May 02 '25 07:05 QSXW

Even though 14-bit support isn't needed right now, we can make the code flexible in case someone wants to add it in the future

nuomi2021 avatar May 02 '25 07:05 nuomi2021

Even though 14-bit support isn't needed right now, we can make the code flexible in case someone wants to add it in the future

Updated!

QSXW avatar May 02 '25 13:05 QSXW

@QSXW, could you please help update the MD5 checksums in the tests? Thank you

nuomi2021 avatar May 04 '25 00:05 nuomi2021

@QSXW, could you please help update the MD5 checksums in the tests? Thank you

Sure. See https://github.com/ffvvc/tests/pull/53

QSXW avatar May 29 '25 17:05 QSXW

@nuomi2021 Fixed all comments and updated the MD5 checksum in the tests. Please help review the latest changes.

QSXW avatar May 29 '25 19:05 QSXW

Hi @nuomi2021. Check with valgrind memcheck. Everthing works well.

frame= 50 fps=0.2 q=-0.0 Lsize=N/A time=00:00:01.96 bitrate=N/A speed=0.00879x elapsed=0:03:42.94
==23288== ==23288== HEAP SUMMARY: ==23288== in use at exit: 0 bytes in 0 blocks ==23288== total heap usage: 1,302,832 allocs, 1,302,832 frees, 2,136,539,120 bytes allocated ==23288== ==23288== All heap blocks were freed -- no leaks are possible ==23288== ==23288== For lists of detected and suppressed errors, rerun with: -s ==23288== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

and the usan found a issue. libavcodec/vvc/ps.c:127:36: runtime error: index 111 out of bounds for type 'int8_t [111]'

The qp_bd_offset of 16bits is 48.

        for (int k = qp_in[num_points_in_qp_table] + 1 + off; k <= 63 + off; k++)

When k equals 63 + off, it will be 111, but simply changing <= to < won't work. Could you have a quick check?

QSXW avatar Jun 08 '25 16:06 QSXW

and the usan found a issue. libavcodec/vvc/ps.c:127:36: runtime error: index 111 out of bounds for type 'int8_t [111]'

Sure. CI includes a uscan test. Did you use a different testing method? Could you share with me

nuomi2021 avatar Jun 09 '25 12:06 nuomi2021

and the usan found a issue. libavcodec/vvc/ps.c:127:36: runtime error: index 111 out of bounds for type 'int8_t [111]'

Sure. CI includes a uscan test. Did you use a different testing method? Could you share with me

Sure. --prefix=/home/fate/workdirs/x86_64-archlinux-gcc-ubsan/install --samples=/home/fate/fate-suite --enable-gpl --enable-memory-poisoning --extra-cflags='-fno-sanitize-recover=undefined' --toolchain=gcc-usan --disable-stripping

See https://fatebeta.ffmpeg.org/report/x86_64-archlinux-gcc-ubsan/20250609081836#info

QSXW avatar Jun 09 '25 13:06 QSXW