FFmpeg icon indicating copy to clipboard operation
FFmpeg copied to clipboard

Support PALETTE and Adaptive Color Transform

Open QSXW opened this issue 1 year ago • 23 comments

QSXW avatar May 14 '24 18:05 QSXW

thank you @QSXW , will check it this week end.

nuomi2021 avatar May 15 '24 13:05 nuomi2021

linux is not build able. 16 files in conformance/failed/v1/PAL/ will fail. Could you help make it all passed? thank you

+++++++++ report +++++++++ passed files: PALETTE_A_Alibaba_2.bit PALETTE_B_Alibaba_2.bit PALETTE_C_Alibaba_2.bit PALETTE_D_Alibaba_2.bit PALETTE_E_Alibaba_2.bit mismatch files: 8b444_A_Kwai_2.bit 10b422_J_Sony_5.bit 8b422_J_Sony_5.bit 10b422_L_Sony_5.bit 8b422_L_Sony_5.bit ACT_A_Kwai_3.bit 10b422_H_Sony_5.bit 8b422_H_Sony_5.bit 8b422_I_Sony_5.bit 10b422_I_Sony_5.bit 10b422_K_Sony_5.bit 8b422_K_Sony_5.bit 10b422_G_Sony_5.bit 8b422_G_Sony_5.bit 8b444_B_Kwai_2.bit decode_err files: ACT_B_Kwai_3.bit

total = 21, passed = 5, skipped = 0, failed = 16

nuomi2021 avatar May 19 '24 15:05 nuomi2021

Sure. It's funny that I didn't test Alibaba_2.bit samples but they passed and other failed.

QSXW avatar May 19 '24 17:05 QSXW

I've checked all the pixels decoded by palette prediction are the same. The yellow rect on the right is the only difference that our first frame will decode twice and other pixels are identical.

The difference may occur in the stage of intra-prediction or IBC prediction. Can you help verify that? image

I compare the whole frame by YUVViewer and found that the Y is almost the same, but there are some differences between the u and v components. image

QSXW avatar May 19 '24 19:05 QSXW

sure, I will check it

nuomi2021 avatar May 20 '24 13:05 nuomi2021

@QSXW , I know why other clips are failed. the Deblock, SAO, and ALF codes need to be added.

nuomi2021 avatar May 26 '24 13:05 nuomi2021

@QSXW , I know why other clips are failed. the Deblock, SAO, and ALF codes need to be added.

Yes, it is. Do we have an interface to get the cu by x0,y0? We need to get cu_q and cu_p for getting the pred_mode?

QSXW avatar May 28 '24 18:05 QSXW

you can use fc->tab.cpm

nuomi2021 avatar May 29 '24 13:05 nuomi2021

I think I've filtered out all the flaky fuzz failures now so these appear to be legitimate.

AddressSanitizer report for ID 14. ID 56 is similar.
=================================================================
==18052==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x00016fcfccfa at pc 0x000102090e28 bp 0x00016fcfcb50 sp 0x00016fcfc300
WRITE of size 130 at 0x00016fcfccfa thread T5
[vvc @ 0x105a01c80] frame     1, P(  1,   1) failed with -1094995529
[vist#0:0/vvc @ 0x105602a40] [dec:vvc @ 0x105002ec0] Decoding error: Invalid data found when processing input
    #0 0x102090e24 in __asan_memcpy+0x440 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x50e24)
    #1 0x10099c90c in derive_predictor_palette_entries ctu.c:991
    #2 0x10097f4cc in set_cu_tabs ctu.c:1314
    #3 0x100973650 in hls_coding_unit ctu.c:2164
    #4 0x10096ff70 in hls_coding_tree ctu.c:2420
    #5 0x100974f14 in coding_tree_qt ctu.c:2346
    #6 0x10096fe44 in hls_coding_tree ctu.c:2409
    #7 0x10096f27c in dual_tree_implicit_qt_split ctu.c:2471
    #8 0x10096f1d4 in dual_tree_implicit_qt_split ctu.c:2461
    #9 0x100968828 in hls_coding_tree_unit ctu.c:2630
    #10 0x100965f88 in ff_vvc_coding_tree_unit ctu.c:2758
    #11 0x100b2bcc0 in run_parse thread.c:428
    #12 0x100b2b168 in task_run_stage thread.c:581
    #13 0x100b263b8 in task_run thread.c:608
    #14 0x100fd775c in run_one_task executor.c:86
    #15 0x100fd6ce4 in executor_worker_task executor.c:104
    #16 0x1904daf90 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x6f90)
    #17 0x1904d5d30 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1d30)

Address 0x00016fcfccfa is located in stack of thread T5 at offset 410 in frame
    #0 0x10099c220 in derive_predictor_palette_entries ctu.c:963

  This frame has 1 object(s):
    [32, 410) 'new_predictor_palette_entries' (line 966) <== Memory access at offset 410 overflows this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
Thread T5 created by T0 here:
    #0 0x10208bd6c in wrap_pthread_create+0x54 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x4bd6c)
    #1 0x100fd69b8 in av_executor_alloc executor.c:166
    #2 0x100b24ee0 in ff_vvc_executor_alloc thread.c:629
    #3 0x101149354 in vvc_decode_init dec.c:1103
    #4 0x1006ce1b4 in avcodec_open2 avcodec.c:326
    #5 0x10032f2dc in dec_open ffmpeg_dec.c:1228
    #6 0x10032d358 in dec_init ffmpeg_dec.c:1286
    #7 0x100341a10 in ist_use ffmpeg_demux.c:949
    #8 0x1003422b8 in ist_filter_add ffmpeg_demux.c:992
    #9 0x10037f6d0 in ifilter_bind_ist ffmpeg_filter.c:701
    #10 0x10037ea8c in init_simple_filtergraph ffmpeg_filter.c:1230
    #11 0x1003cc9e0 in ost_add ffmpeg_mux_init.c:1433
    #12 0x1003b97f8 in map_auto_video ffmpeg_mux_init.c:1539
    #13 0x1003af7b4 in create_streams ffmpeg_mux_init.c:1855
    #14 0x1003ad7f8 in of_open ffmpeg_mux_init.c:3265
    #15 0x1003f73b4 in open_files ffmpeg_opt.c:1206
    #16 0x1003f6d18 in ffmpeg_parse_options ffmpeg_opt.c:1253
    #17 0x1004477c4 in main ffmpeg.c:941
    #18 0x1901520dc  (<unknown module>)

SUMMARY: AddressSanitizer: stack-buffer-overflow (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x50e24) in __asan_memcpy+0x440
Shadow bytes around the buggy address:
  0x00016fcfca00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x00016fcfca80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x00016fcfcb00: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
  0x00016fcfcb80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x00016fcfcc00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x00016fcfcc80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00[02]
  0x00016fcfcd00: f3 f3 f3 f3 f3 f3 f3 f3 00 00 00 00 00 00 00 00
  0x00016fcfcd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x00016fcfce00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x00016fcfce80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x00016fcfcf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==18052==ABORTING
AddressSanitizer report for ID 256. All other bitstreams are similar.
=================================================================
==18083==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x00019050ae90 bp 0x00016defc5b0 sp 0x00016defbd70 T12)
==18083==The signal is caused by a WRITE memory access.
==18083==Hint: address points to the zero page.
    Last message repeated 2 times
[vvc @ 0x107c01c80] frame    41, P(  1,   1) failed with -1094995529
    #0 0x19050ae90 in __bzero+0x20 (libsystem_platform.dylib:arm64e+0x3e90)5e+06x
    #1 0x102b78f70 in tl_create dec.c:90
    #2 0x102b78880 in frame_context_for_each_tl dec.c:371
    #3 0x102b773c0 in pic_arrays_init dec.c:406
    #4 0x102b760b4 in frame_context_setup dec.c:707
    #5 0x102b74ad4 in frame_setup dec.c:804
    #6 0x102b742bc in decode_slice dec.c:826
    #7 0x102b73f60 in decode_nal_unit dec.c:869
    #8 0x102b730a0 in decode_nal_units dec.c:910
    #9 0x102b723dc in vvc_decode_frame dec.c:1014
    #10 0x102acf82c in decode_simple_internal decode.c:412
    #11 0x102acec68 in decode_simple_receive_frame decode.c:583
    #12 0x102ab8154 in decode_receive_frame_internal decode.c:612
    #13 0x102ab7b18 in avcodec_send_packet decode.c:703
    #14 0x102508278 in packet_decode ffmpeg_dec.c:687
    #15 0x102506184 in decoder_thread ffmpeg_dec.c:897
    #16 0x1025eb424 in task_wrapper ffmpeg_sched.c:2467
    #17 0x1904daf90 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x6f90)
    #18 0x1904d5d30 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1d30)

==18083==Register values:
 x[0] = 0x0000000000000000   x[1] = 0x0000000000000000   x[2] = 0x0000000000060000   x[3] = 0x0000000000000000
 x[4] = 0x000000702dbff940   x[5] = 0x0000000000000001   x[6] = 0x000000016de7c000   x[7] = 0x0000000000000001
 x[8] = 0x000000700002c000   x[9] = 0x000000700002c000  x[10] = 0x000000700002c020  x[11] = 0x0000000000000000
x[12] = 0x000000700002c000  x[13] = 0x0000000000001800  x[14] = 0x0000000000001800  x[15] = 0x0000000000000006
x[16] = 0x000000019050aed0  x[17] = 0x00000001042b85e8  x[18] = 0x0000000000000000  x[19] = 0x0000000000060000
x[20] = 0x0000000000000000  x[21] = 0x0000000000000000  x[22] = 0x0000000000000000  x[23] = 0x0000000000000000
x[24] = 0x0000000000000000  x[25] = 0x0000000000000000  x[26] = 0x0000000000000000  x[27] = 0x0000000000000000
x[28] = 0x0000000000000000     fp = 0x000000016defc5b0     lr = 0x0000000104264ee4     sp = 0x000000016defbd70
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (libsystem_platform.dylib:arm64e+0x3e90) in __bzero+0x20
Thread T12 created by T0 here:
    #0 0x10425fd6c in wrap_pthread_create+0x54 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x4bd6c)
    #1 0x1025e0218 in task_start ffmpeg_sched.c:416
    #2 0x1025de124 in sch_start ffmpeg_sched.c:1570
    #3 0x10261be78 in transcode ffmpeg.c:831
    #4 0x10261b920 in main ffmpeg.c:959
    #5 0x1901520dc  (<unknown module>)

==18083==ABORTING

frankplow avatar Jun 03 '24 13:06 frankplow