Giter VIP home page Giter VIP logo

libavif's People

Contributors

1480c1 avatar amdmi3 avatar aurelc2g avatar biswa96 avatar bnason-nf avatar cryptomilk avatar dependabot[bot] avatar ewouth avatar fdintino avatar jamaika1 avatar jbeich avatar joedrago avatar jzern avatar kmilos avatar kornelski avatar ledyba-z avatar linkmauve avatar louquillio avatar maryla-uc avatar novomesk avatar paskal avatar pnacht avatar sorairolake avatar tongyuantongyu avatar vigneshvg avatar vrabaud avatar wantehchang avatar wizzxu avatar y-guyon avatar ytoku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libavif's Issues

Example apps don't compress enough

Compressing
wollerau-B
with "-q 63" gives a file that's 55700 bytes (larger than 50% quality JPEG). It would be nice to be able compress to smaller file sizes.

crash when encoding large image with AOM codec at speed 9 and 10

Hello Joe,
I develop plug-in for GIMP to support AVIF format. I use libavif.

I encountered weird issue.
When encoding 4252x2835 picture at 10bit depth with AOM codec and set speed to 9 or 10 (fastest), the application will crash.
When I select speed 7 or lower, there is no problem.
There is no problem with 8bit depth, no problem with rav1e.
Only with AOM + high depth and high speed at the same time.

I am not sure whether it is a bug in my code or in libaom. Stack trace:

26      ../sysdeps/unix/sysv/linux/read.c: Adresár alebo súbor neexistuje.

# Stack traces obtained from PID 19512 - Thread 19512 #

[New LWP 19513]
[New LWP 19514]
[New LWP 19515]
[New LWP 19516]
[New LWP 19517]
[New LWP 19518]
[New LWP 19519]
[New LWP 19520]
[New LWP 19522]
[New LWP 19523]
[New LWP 19526]
[New LWP 19527]
[New LWP 19528]
[New LWP 19529]
[New LWP 19530]
[New LWP 19531]
[New LWP 19532]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
0x00007f38991a1790 in __GI___libc_read () at ../sysdeps/unix/sysv/linux/read.c:26
  Id   Target Id                                          Frame 
* 1    Thread 0x7f389593eec0 (LWP 19512) "file-avif"      0x00007f38991a1790 in __GI___libc_read () at ../sysdeps/unix/sysv/linux/read.c:26
  2    Thread 0x7f389527a700 (LWP 19513) "worker"         syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
  3    Thread 0x7f3894a79700 (LWP 19514) "worker"         syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
  4    Thread 0x7f388ffff700 (LWP 19515) "worker"         syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
  5    Thread 0x7f388f7fe700 (LWP 19516) "worker"         syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
  6    Thread 0x7f388effd700 (LWP 19517) "worker"         syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
  7    Thread 0x7f388e7fc700 (LWP 19518) "worker"         syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
  8    Thread 0x7f388dffb700 (LWP 19519) "worker"         syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
  9    Thread 0x7f38761a6700 (LWP 19520) "gmain"          0x00007f38991a5e93 in __GI___poll () at ../sysdeps/unix/sysv/linux/poll.c:29
  10   Thread 0x7f3874842700 (LWP 19522) "gdbus"          0x00007f38991a5e93 in __GI___poll () at ../sysdeps/unix/sysv/linux/poll.c:29
  11   Thread 0x7f385fbd5700 (LWP 19523) "threaded-ml"    0x00007f38991a5e93 in __GI___poll () at ../sysdeps/unix/sysv/linux/poll.c:29
  12   Thread 0x7f3776d1d700 (LWP 19526) "aom enc worker" 0x00007f3898b17e57 in futex_wait_cancelable () at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  13   Thread 0x7f3773b6d700 (LWP 19527) "aom enc worker" 0x00007f3898b17e57 in futex_wait_cancelable () at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  14   Thread 0x7f3770617700 (LWP 19528) "aom enc worker" 0x00007f3898b17e57 in futex_wait_cancelable () at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  15   Thread 0x7f376ceed700 (LWP 19529) "aom enc worker" 0x00007f3898b17e57 in futex_wait_cancelable () at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  16   Thread 0x7f376940e700 (LWP 19530) "aom enc worker" 0x00007f3898b17e57 in futex_wait_cancelable () at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  17   Thread 0x7f37532c5700 (LWP 19531) "aom enc worker" 0x00007f3898b17e57 in futex_wait_cancelable () at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  18   Thread 0x7f374f2e2700 (LWP 19532) "aom enc worker" 0x00007f38991a1790 in __GI___libc_read () at ../sysdeps/unix/sysv/linux/read.c:26

Thread 18 (Thread 0x7f374f2e2700 (LWP 19532)):
#0  0x00007f38991a1790 in __GI___libc_read () at ../sysdeps/unix/sysv/linux/read.c:26
#1  0x00007f38991a1790 in __GI___libc_read () at ../sysdeps/unix/sysv/linux/read.c:24
#2  0x00007f389912f8a9 in _IO_new_file_underflow () at fileops.c:524
#3  0x00007f3899130c02 in __GI__IO_default_uflow () at genops.c:362
#4  0x00007f389912191e in __GI__IO_getline_info () at iogetline.c:60
#5  0x00007f38991205e5 in _IO_fgets () at iofgets.c:53
#6  0x00007f389a01bf57 in fgets () at /usr/include/bits/stdio2.h:265
#7  0x00007f389a01bf57 in gimp_stack_trace_query () at ../libgimpbase/gimputils.c:1499
#8  0x00007f389a06d0df in gimp_plugin_sigfatal_handler () at ../libgimp/gimp.c:1093
#9  0x00007f38990e5eb0 in <signal handler called> () at /lib64/libc.so.6
#10 0x00007f3898d67ebc in aom_subtract_block_sse2 () at /usr/lib64/libaom.so.0
#11 0x00007f3898ed674d in block_yrd () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/nonrd_pickmode.c:798
#12 0x00007f3898ed6d0a in estimate_block_intra () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/nonrd_pickmode.c:1159
#13 0x00007f3898e5550f in av1_foreach_transformed_block_in_plane () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodemb.c:553
#14 0x00007f3898ed7c57 in av1_pick_intra_mode () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/nonrd_pickmode.c:1432
#15 0x00007f3898e43f2f in hybrid_intra_mode_search () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:725
#16 0x00007f3898e43f2f in pick_sb_modes () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:848
#17 0x00007f3898e46108 in nonrd_use_partition () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:2284
#18 0x00007f3898e45602 in nonrd_use_partition () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:2393
#19 0x00007f3898e45602 in nonrd_use_partition () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:2393
#20 0x00007f3898e51855 in encode_nonrd_sb () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:4273
#21 0x00007f3898e51855 in encode_sb_row () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:4666
#22 0x00007f3898e51855 in av1_encode_sb_row () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:4766
#23 0x00007f3898e778e6 in enc_row_mt_worker_hook () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/ethread.c:355
#24 0x00007f3898da2e53 in execute () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/aom_util/aom_thread.c:163
#25 0x00007f3898da2e53 in thread_loop () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/aom_util/aom_thread.c:72
#26 0x00007f3898b113a7 in start_thread () at pthread_create.c:486
#27 0x00007f38991b1aff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 17 (Thread 0x7f37532c5700 (LWP 19531)):
#0  0x00007f3898b17e57 in futex_wait_cancelable () at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  0x00007f3898b17e57 in __pthread_cond_wait_common () at pthread_cond_wait.c:502
#2  0x00007f3898b17e57 in __pthread_cond_wait () at pthread_cond_wait.c:655
#3  0x00007f3898e77a1f in av1_row_mt_sync_read () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/ethread.c:110
#4  0x00007f3898e51125 in encode_sb_row () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:4623
#5  0x00007f3898e51125 in av1_encode_sb_row () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:4766
#6  0x00007f3898e778e6 in enc_row_mt_worker_hook () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/ethread.c:355
#7  0x00007f3898da2e53 in execute () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/aom_util/aom_thread.c:163
#8  0x00007f3898da2e53 in thread_loop () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/aom_util/aom_thread.c:72
#9  0x00007f3898b113a7 in start_thread () at pthread_create.c:486
#10 0x00007f38991b1aff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 16 (Thread 0x7f376940e700 (LWP 19530)):
#0  0x00007f3898b17e57 in futex_wait_cancelable () at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  0x00007f3898b17e57 in __pthread_cond_wait_common () at pthread_cond_wait.c:502
#2  0x00007f3898b17e57 in __pthread_cond_wait () at pthread_cond_wait.c:655
#3  0x00007f3898e77a1f in av1_row_mt_sync_read () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/ethread.c:110
#4  0x00007f3898e51125 in encode_sb_row () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:4623
#5  0x00007f3898e51125 in av1_encode_sb_row () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:4766
#6  0x00007f3898e778e6 in enc_row_mt_worker_hook () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/ethread.c:355
#7  0x00007f3898da2e53 in execute () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/aom_util/aom_thread.c:163
#8  0x00007f3898da2e53 in thread_loop () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/aom_util/aom_thread.c:72
#9  0x00007f3898b113a7 in start_thread () at pthread_create.c:486
#10 0x00007f38991b1aff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 15 (Thread 0x7f376ceed700 (LWP 19529)):
#0  0x00007f3898b17e57 in futex_wait_cancelable () at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  0x00007f3898b17e57 in __pthread_cond_wait_common () at pthread_cond_wait.c:502
#2  0x00007f3898b17e57 in __pthread_cond_wait () at pthread_cond_wait.c:655
#3  0x00007f3898e77a1f in av1_row_mt_sync_read () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/ethread.c:110
#4  0x00007f3898e51125 in encode_sb_row () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:4623
#5  0x00007f3898e51125 in av1_encode_sb_row () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:4766
#6  0x00007f3898e778e6 in enc_row_mt_worker_hook () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/ethread.c:355
#7  0x00007f3898da2e53 in execute () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/aom_util/aom_thread.c:163
#8  0x00007f3898da2e53 in thread_loop () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/aom_util/aom_thread.c:72
#9  0x00007f3898b113a7 in start_thread () at pthread_create.c:486
#10 0x00007f38991b1aff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 14 (Thread 0x7f3770617700 (LWP 19528)):
#0  0x00007f3898b17e57 in futex_wait_cancelable () at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  0x00007f3898b17e57 in __pthread_cond_wait_common () at pthread_cond_wait.c:502
#2  0x00007f3898b17e57 in __pthread_cond_wait () at pthread_cond_wait.c:655
#3  0x00007f3898e77a1f in av1_row_mt_sync_read () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/ethread.c:110
#4  0x00007f3898e51125 in encode_sb_row () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:4623
#5  0x00007f3898e51125 in av1_encode_sb_row () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:4766
#6  0x00007f3898e778e6 in enc_row_mt_worker_hook () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/ethread.c:355
#7  0x00007f3898da2e53 in execute () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/aom_util/aom_thread.c:163
#8  0x00007f3898da2e53 in thread_loop () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/aom_util/aom_thread.c:72
#9  0x00007f3898b113a7 in start_thread () at pthread_create.c:486
#10 0x00007f38991b1aff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 13 (Thread 0x7f3773b6d700 (LWP 19527)):
#0  0x00007f3898b17e57 in futex_wait_cancelable () at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  0x00007f3898b17e57 in __pthread_cond_wait_common () at pthread_cond_wait.c:502
#2  0x00007f3898b17e57 in __pthread_cond_wait () at pthread_cond_wait.c:655
#3  0x00007f3898e77a1f in av1_row_mt_sync_read () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/ethread.c:110
#4  0x00007f3898e51125 in encode_sb_row () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:4623
#5  0x00007f3898e51125 in av1_encode_sb_row () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:4766
#6  0x00007f3898e778e6 in enc_row_mt_worker_hook () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/ethread.c:355
#7  0x00007f3898da2e53 in execute () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/aom_util/aom_thread.c:163
#8  0x00007f3898da2e53 in thread_loop () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/aom_util/aom_thread.c:72
#9  0x00007f3898b113a7 in start_thread () at pthread_create.c:486
#10 0x00007f38991b1aff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 12 (Thread 0x7f3776d1d700 (LWP 19526)):
#0  0x00007f3898b17e57 in futex_wait_cancelable () at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  0x00007f3898b17e57 in __pthread_cond_wait_common () at pthread_cond_wait.c:502
#2  0x00007f3898b17e57 in __pthread_cond_wait () at pthread_cond_wait.c:655
#3  0x00007f3898e77a1f in av1_row_mt_sync_read () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/ethread.c:110
#4  0x00007f3898e51125 in encode_sb_row () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:4623
#5  0x00007f3898e51125 in av1_encode_sb_row () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:4766
#6  0x00007f3898e778e6 in enc_row_mt_worker_hook () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/ethread.c:355
#7  0x00007f3898da2e53 in execute () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/aom_util/aom_thread.c:163
#8  0x00007f3898da2e53 in thread_loop () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/aom_util/aom_thread.c:72
#9  0x00007f3898b113a7 in start_thread () at pthread_create.c:486
#10 0x00007f38991b1aff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 11 (Thread 0x7f385fbd5700 (LWP 19523)):
#0  0x00007f38991a5e93 in __GI___poll () at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f38941104c2 in poll () at /usr/include/bits/poll2.h:46
#2  0x00007f38941104c2 in poll_func () at /var/tmp/portage/media-sound/pulseaudio-13.0/work/pulseaudio-13.0/src/pulse/thread-mainloop.c:70
#3  0x00007f3894101e59 in pa_mainloop_poll () at /var/tmp/portage/media-sound/pulseaudio-13.0/work/pulseaudio-13.0/src/pulse/mainloop.c:844
#4  0x00007f38941024df in pa_mainloop_iterate () at /var/tmp/portage/media-sound/pulseaudio-13.0/work/pulseaudio-13.0/src/pulse/mainloop.c:926
#5  0x00007f3894102590 in pa_mainloop_run () at /var/tmp/portage/media-sound/pulseaudio-13.0/work/pulseaudio-13.0/src/pulse/mainloop.c:944
#6  0x00007f3894110409 in thread () at /var/tmp/portage/media-sound/pulseaudio-13.0/work/pulseaudio-13.0/src/pulse/thread-mainloop.c:101
#7  0x00007f38940abdf8 in internal_thread_func () at /var/tmp/portage/media-sound/pulseaudio-13.0/work/pulseaudio-13.0/src/pulsecore/thread-posix.c:81
#8  0x00007f3898b113a7 in start_thread () at pthread_create.c:486
#9  0x00007f38991b1aff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 10 (Thread 0x7f3874842700 (LWP 19522)):
#0  0x00007f38991a5e93 in __GI___poll () at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f389a1ba73e in g_main_context_poll () at ../glib-2.60.7/glib/gmain.c:4228
#2  0x00007f389a1ba73e in g_main_context_iterate () at ../glib-2.60.7/glib/gmain.c:3922
#3  0x00007f389a1baaf3 in g_main_loop_run () at ../glib-2.60.7/glib/gmain.c:4123
#4  0x00007f389a3eba26 in gdbus_shared_thread_func () at ../glib-2.60.7/gio/gdbusprivate.c:275
#5  0x00007f389a1e2f9d in g_thread_proxy () at ../glib-2.60.7/glib/gthread.c:805
#6  0x00007f3898b113a7 in start_thread () at pthread_create.c:486
#7  0x00007f38991b1aff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 9 (Thread 0x7f38761a6700 (LWP 19520)):
#0  0x00007f38991a5e93 in __GI___poll () at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f389a1ba73e in g_main_context_poll () at ../glib-2.60.7/glib/gmain.c:4228
#2  0x00007f389a1ba73e in g_main_context_iterate () at ../glib-2.60.7/glib/gmain.c:3922
#3  0x00007f389a1ba85f in g_main_context_iteration () at ../glib-2.60.7/glib/gmain.c:3988
#4  0x00007f389a1ba8b1 in glib_worker_main () at ../glib-2.60.7/glib/gmain.c:5868
#5  0x00007f389a1e2f9d in g_thread_proxy () at ../glib-2.60.7/glib/gthread.c:805
#6  0x00007f3898b113a7 in start_thread () at pthread_create.c:486
#7  0x00007f38991b1aff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 8 (Thread 0x7f388dffb700 (LWP 19519)):
#0  0x00007f38991ac129 in syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007f389a2054bf in g_cond_wait () at ../glib-2.60.7/glib/gthread-posix.c:1413
#2  0x00007f3899f6bbb3 in gegl_parallel_distribute_thread_func () at ../gegl-9999/gegl/gegl-parallel.c:508
#3  0x00007f389a1e2f9d in g_thread_proxy () at ../glib-2.60.7/glib/gthread.c:805
#4  0x00007f3898b113a7 in start_thread () at pthread_create.c:486
#5  0x00007f38991b1aff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 7 (Thread 0x7f388e7fc700 (LWP 19518)):
#0  0x00007f38991ac129 in syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007f389a2054bf in g_cond_wait () at ../glib-2.60.7/glib/gthread-posix.c:1413
#2  0x00007f3899f6bbb3 in gegl_parallel_distribute_thread_func () at ../gegl-9999/gegl/gegl-parallel.c:508
#3  0x00007f389a1e2f9d in g_thread_proxy () at ../glib-2.60.7/glib/gthread.c:805
#4  0x00007f3898b113a7 in start_thread () at pthread_create.c:486
#5  0x00007f38991b1aff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 6 (Thread 0x7f388effd700 (LWP 19517)):
#0  0x00007f38991ac129 in syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007f389a2054bf in g_cond_wait () at ../glib-2.60.7/glib/gthread-posix.c:1413
#2  0x00007f3899f6bbb3 in gegl_parallel_distribute_thread_func () at ../gegl-9999/gegl/gegl-parallel.c:508
#3  0x00007f389a1e2f9d in g_thread_proxy () at ../glib-2.60.7/glib/gthread.c:805
#4  0x00007f3898b113a7 in start_thread () at pthread_create.c:486
#5  0x00007f38991b1aff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 5 (Thread 0x7f388f7fe700 (LWP 19516)):
#0  0x00007f38991ac129 in syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007f389a2054bf in g_cond_wait () at ../glib-2.60.7/glib/gthread-posix.c:1413
#2  0x00007f3899f6bbb3 in gegl_parallel_distribute_thread_func () at ../gegl-9999/gegl/gegl-parallel.c:508
#3  0x00007f389a1e2f9d in g_thread_proxy () at ../glib-2.60.7/glib/gthread.c:805
#4  0x00007f3898b113a7 in start_thread () at pthread_create.c:486
#5  0x00007f38991b1aff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 4 (Thread 0x7f388ffff700 (LWP 19515)):
#0  0x00007f38991ac129 in syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007f389a2054bf in g_cond_wait () at ../glib-2.60.7/glib/gthread-posix.c:1413
#2  0x00007f3899f6bbb3 in gegl_parallel_distribute_thread_func () at ../gegl-9999/gegl/gegl-parallel.c:508
#3  0x00007f389a1e2f9d in g_thread_proxy () at ../glib-2.60.7/glib/gthread.c:805
#4  0x00007f3898b113a7 in start_thread () at pthread_create.c:486
#5  0x00007f38991b1aff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 3 (Thread 0x7f3894a79700 (LWP 19514)):
#0  0x00007f38991ac129 in syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007f389a2054bf in g_cond_wait () at ../glib-2.60.7/glib/gthread-posix.c:1413
#2  0x00007f3899f6bbb3 in gegl_parallel_distribute_thread_func () at ../gegl-9999/gegl/gegl-parallel.c:508
#3  0x00007f389a1e2f9d in g_thread_proxy () at ../glib-2.60.7/glib/gthread.c:805
#4  0x00007f3898b113a7 in start_thread () at pthread_create.c:486
#5  0x00007f38991b1aff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7f389527a700 (LWP 19513)):
#0  0x00007f38991ac129 in syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007f389a2054bf in g_cond_wait () at ../glib-2.60.7/glib/gthread-posix.c:1413
#2  0x00007f3899f6bbb3 in gegl_parallel_distribute_thread_func () at ../gegl-9999/gegl/gegl-parallel.c:508
#3  0x00007f389a1e2f9d in g_thread_proxy () at ../glib-2.60.7/glib/gthread.c:805
#4  0x00007f3898b113a7 in start_thread () at pthread_create.c:486
#5  0x00007f38991b1aff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7f389593eec0 (LWP 19512)):
#0  0x00007f38991a1790 in __GI___libc_read () at ../sysdeps/unix/sysv/linux/read.c:26
#1  0x00007f38991a1790 in __GI___libc_read () at ../sysdeps/unix/sysv/linux/read.c:24
#2  0x00007f389a01ba65 in read () at /usr/include/bits/unistd.h:44
#3  0x00007f389a01ba65 in gimp_stack_trace_print () at ../libgimpbase/gimputils.c:1342
#4  0x00007f389a01bf10 in gimp_stack_trace_query () at ../libgimpbase/gimputils.c:1512
#5  0x00007f389a06d0df in gimp_plugin_sigfatal_handler () at ../libgimp/gimp.c:1093
#6  0x00007f38990e5eb0 in <signal handler called> () at /lib64/libc.so.6
#7  0x00007f3898d67ebc in aom_subtract_block_sse2 () at /usr/lib64/libaom.so.0
#8  0x00007f3898ed674d in block_yrd () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/nonrd_pickmode.c:798
#9  0x00007f3898ed6d0a in estimate_block_intra () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/nonrd_pickmode.c:1159
#10 0x00007f3898e5550f in av1_foreach_transformed_block_in_plane () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodemb.c:553
#11 0x00007f3898ed7c57 in av1_pick_intra_mode () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/nonrd_pickmode.c:1432
#12 0x00007f3898e43f2f in hybrid_intra_mode_search () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:725
#13 0x00007f3898e43f2f in pick_sb_modes () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:848
#14 0x00007f3898e46108 in nonrd_use_partition () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:2284
#15 0x00007f3898e45602 in nonrd_use_partition () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:2393
#16 0x00007f3898e45602 in nonrd_use_partition () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:2393
#17 0x00007f3898e51855 in encode_nonrd_sb () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:4273
#18 0x00007f3898e51855 in encode_sb_row () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:4666
#19 0x00007f3898e51855 in av1_encode_sb_row () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:4766
#20 0x00007f3898e778e6 in enc_row_mt_worker_hook () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/ethread.c:355
#21 0x00007f3898da2b47 in execute () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/aom_util/aom_thread.c:163
#22 0x00007f3898e789c7 in launch_enc_workers () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/ethread.c:518
#23 0x00007f3898e789c7 in av1_encode_tiles_row_mt () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/ethread.c:723
#24 0x00007f3898e52b9f in encode_frame_internal () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encodeframe.c:5569
#25 0x00007f3898e66c00 in encode_with_recode_loop () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encoder.c:5288
#26 0x00007f3898e66c00 in encode_with_recode_loop_and_filter () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encoder.c:5372
#27 0x00007f3898e696bf in encode_with_and_without_superres () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encoder.c:5645
#28 0x00007f3898e696bf in encode_frame_to_data_rate () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encoder.c:6190
#29 0x00007f3898e696bf in av1_encode () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encoder.c:6354
#30 0x00007f3898e59198 in denoise_and_encode () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encode_strategy.c:949
#31 0x00007f3898e59198 in av1_encode_strategy () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encode_strategy.c:1301
#32 0x00007f3898e6ac34 in av1_get_compressed_data () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/encoder/encoder.c:6607
#33 0x00007f3898e077da in encoder_encode () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/av1/av1_cx_iface.c:2126
#34 0x00007f3898f7d158 in aom_codec_encode () at /var/tmp/portage/media-libs/libaom-9999/work/libaom-9999/aom/src/aom_encoder.c:240
#35 0x00007f389a81c676 in aomCodecEncodeImage (codec=0x556d946ef690, image=0x556d946f0e10, encoder=0x556d94454840, obu=0x7fff9131d270, alpha=0) at /home/daniel/Devel/libavif-0.5.4/src/codec_aom.c:367
        success = 0
        encoder_interface = 0x7f3899065840 <aom_codec_av1_cx_algo>
        aomEncoder = {name = 0x7f3898fd5e48 "AOMedia Project AV1 Encoder 1.0.0-errata1-avif-271-g1b5732a4e", iface = 0x7f3899065840 <aom_codec_av1_cx_algo>, err = AOM_CODEC_OK, err_detail = 0x0, init_flags = 262144, config = {dec = 0x556d9471b8e8, enc = 0x556d9471b8e8, raw = 0x556d9471b8e8}, priv = 0x556d9471b810}
        aomUsage = 1
        aomCpuUsed = 8
        yShift = 1
        aomFormat = AOM_IMG_FMT_I42016
        formatInfo = {chromaShiftX = 1, chromaShiftY = 1, aomIndexU = 1, aomIndexV = 2}
        cfg = {g_usage = 1, g_threads = 8, g_profile = 0, g_w = 4252, g_h = 2835, g_limit = 0, g_forced_max_frame_width = 0, g_forced_max_frame_height = 0, g_bit_depth = AOM_BITS_10, g_input_bit_depth = 10, g_timebase = {num = 1, den = 30}, g_error_resilient = 0, g_pass = AOM_RC_ONE_PASS, g_lag_in_frames = 1, rc_dropframe_thresh = 0, rc_resize_mode = 0, rc_resize_denominator = 8, rc_resize_kf_denominator = 8, rc_superres_mode = 0, rc_superres_denominator = 8, rc_superres_kf_denominator = 8, rc_superres_qthresh = 63, rc_superres_kf_qthresh = 32, rc_end_usage = AOM_CBR, rc_twopass_stats_in = {buf = 0x0, sz = 0}, rc_firstpass_mb_stats_in = {buf = 0x0, sz = 0}, rc_target_bitrate = 256, rc_min_quantizer = 0, rc_max_quantizer = 40, rc_undershoot_pct = 25, rc_overshoot_pct = 25, rc_buf_sz = 6000, rc_buf_initial_sz = 4000, rc_buf_optimal_sz = 5000, rc_2pass_vbr_bias_pct = 50, rc_2pass_vbr_minsection_pct = 0, rc_2pass_vbr_maxsection_pct = 2000, fwd_kf_enabled = 0, kf_mode = AOM_KF_AUTO, kf_min_dist = 0, kf_max_dist = 9999, sframe_dist = 0, sframe_mode = 1, large_scale_tile = 0, monochrome = 0, full_still_picture_hdr = 0, save_as_annexb = 0, tile_width_count = 0, tile_height_count = 0, tile_widths = {0 <repeats 64 times>}, tile_heights = {0 <repeats 64 times>}, fixed_qp_offsets = {-1, -1, -1, -1, -1}, encoder_cfg = {init_by_cfg_file = 0, super_block_size = 0, max_partition_size = 128, min_partition_size = 4, disable_ab_partition_type = 0, disable_rect_partition_type = 0, disable_1to4_partition_type = 0, disable_flip_idtx = 0, disable_cdef = 0, disable_lr = 0, disable_obmc = 0, disable_warp_motion = 0, disable_global_motion = 0, disable_dist_wtd_comp = 0, disable_diff_wtd_comp = 0, disable_inter_intra_comp = 0, disable_masked_comp = 0, disable_one_sided_comp = 0, disable_palette = 0, disable_intrabc = 0, disable_cfl = 0, disable_smooth_intra = 0, disable_filter_intra = 0, disable_dual_filter = 0, disable_intra_angle_delta = 0, disable_intra_edge_filter = 0, disable_tx_64x64 = 0, disable_smooth_inter_intra = 0, disable_inter_inter_wedge = 0, disable_inter_intra_wedge = 0, disable_paeth_intra = 0, disable_trellis_quant = 3, disable_ref_frame_mv = 0, reduced_reference_set = 0, reduced_tx_type_set = 0}}
        minQuantizer = 0
        maxQuantizer = 40
        lossless = 0
        encoderFlags = 262144
        uvHeight = 1417
        aomImage = 0x556d94ea8a80
        flushed = 1098149481
        iter = 0xdddddddddddddddd
#36 0x00007f389a817b85 in avifEncoderWrite (encoder=0x556d94454840, image=0x556d946f0e10, output=0x7fff9131d470) at /home/daniel/Devel/libavif-0.5.4/src/write.c:142
        result = AVIF_RESULT_UNKNOWN_ERROR
        colorOBU = {data = 0x0, size = 0}
        alphaOBU = {data = 0x0, size = 0}
        codec = {0x556d946ef690, 0x0}
        imageIsOpaque = 1
        exifTiffHeaderOffset = 0
        s = {raw = 0x7fff9131d470, offset = 0}
        hasAlpha = 32568
        hasExif = -1807965832
        hasXMP = 21869
        ftyp = 0
        meta = 0
        hdlr = 0
        itemCount = 21869
        colorItemID = 0
        nextItemID = 0
        alphaItemID = 4
        exifItemID = 0
        xmpItemID = 0
        colorOBUOffsetOffset = 0
        alphaOBUOffsetOffset = 2
        exifOffsetOffset = 0
        xmpOffsetOffset = 0
        iloc = 0
        offsetSizeAndLengthSize = 60 '<'
        iinf = 0
        infeImage = 0
        iprp = 0
        mdat = 0
        colorOBUOffset = 0
        alphaOBUOffset = 0
        exifOffset = 2485227392
        xmpOffset = 21869
        prevOffset = 0
#37 0x0000556d9230b596 in save_layer (file=0x556d94222540, image=0x556d942286d0, drawable=0x556d941f48f0, config=0x556d9426a260, metadata=0x556d9422f090, error=0x7fff9131d590) at ../file-avif-save.c:808

Accessing image metadata without decoding

Right now, it is necessary to call avifDecoderRead prior to reading anything from the avifImage. However, there are cases when we may want to read some of the image's metadata without actually decoding the image data itself (pixel values). Such metadata includes:

  • image dimensions
  • depth
  • color profile
  • exif / xmp metadata
  • potentially, whether there is an alpha plane

Could we add an api to make this possible? Ideally we would expose as much as we can without requiring anything from the codec.

CMakeLists.txt uses DAV1D_INCLUDEDIR but Finddav1d.cmake defines DAV1D_INCLUDE_DIR

Release tag: v0.5.6

Note: I wrote this bug report using DAV1D as an example, but the bug also applies to AOM and RAV1E.

I am not very familiar with CMake, so I may have misunderstood how Finddav1d.cmake is used. While reading CMakeLists.txt and Finddav1d.cmake I spotted three things that seem wrong.

  1. CMakeLists.txt uses DAV1D_INCLUDEDIR but Finddav1d.cmake defines DAV1D_INCLUDE_DIR. Should CMakeLists.txt use DAV1D_INCLUDE_DIR instead?

  2. Finddav1d.cmake defines both DAV1D_LIBRARY and DAV1D_LIBRARIES, but the comment at the top of the file does not mention DAV1D_LIBRARY:

  # - Try to find dav1d
  # Once done this will define
  #
  #  DAV1D_FOUND - system has dav1d
  #  DAV1D_INCLUDE_DIR - the dav1d include directory
  #  DAV1D_LIBRARIES - Link these to use dav1d
  1. The comment I quoted above suggests DAV1D_LIBRARIES should be used, but CMakeLists.txt uses DAV1D_LIBRARY:

     set(AVIF_CODEC_LIBRARIES ${AVIF_CODEC_LIBRARIES} ${DAV1D_LIBRARY})
    

Should CMakeLists.txt use DAV1D_LIBRARIES instead?

Build is broken with external dependencies

The CMake infrastructure currently picks up the header paths when building with external copies of the dependent libraries but not the library paths thus the build fails.

Warnings in avifjpeg.c

ninja
[2/28] Building C object CMakeFiles/avifenc.dir/apps/shared/avifjpeg.c.o
FAILED: CMakeFiles/avifenc.dir/apps/shared/avifjpeg.c.o 
/usr/bin/cc  -I../apps/shared -I../include -O2 -pipe -march=native   -std=gnu99 -Werror -Wall -Wextra -pthread -MD -MT CMakeFiles/avifenc.dir/apps/shared/avifjpeg.c.o -MF CMakeFiles/avifenc.dir/apps/shared/avifjpeg.c.o.d -o CMakeFiles/avifenc.dir/apps/shared/avifjpeg.c.o   -c ../apps/shared/avifjpeg.c
../apps/shared/avifjpeg.c: In function ‘avifJPEGRead’:
../apps/shared/avifjpeg.c:32:14: error: variable ‘ret’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
   32 |     avifBool ret = AVIF_FALSE;
      |              ^~~
../apps/shared/avifjpeg.c:34:15: error: variable ‘iccData’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
   34 |     uint8_t * iccData = NULL;
      |               ^~~~~~~
cc1: all warnings being treated as errors
[7/28] Building C object CMakeFiles/avifenc.dir/apps/avifenc.c.o
ninja: build stopped: subcommand failed.

My gentoo ebuild script is building libavif in this way, it was OK with libavif 0.6.3
Configure command used to reproduce:
CFLAGS="-O2 -pipe -march=native" cmake -G Ninja -DAVIF_CODEC_AOM=ON -DAVIF_BUILD_APPS=ON ..

Plan to support for custom encoder like rav1e instead of aom ?

Hi. I'm a user who previouslly use the libavif 0.1.x version.

Recently I found that this library supports two decoder codec, aom and dav1d, and the test performance of the dav1d is better than the aom.

Is there any plan to support another AVIF encoder implementation rav1e ?

Just a little curious about the plan for the massive AV1 codec...

Static build of libavif and position-independent code

I create a library (libqavif.so) which is a QT imageformats plug-in.
I want to make the libqavif.so stand-alone, without dynamic linking to libavif.so
I can do it when I compile everything as position independent code.
libaom has option to enable it: -DCONFIG_PIC=1
I can build libavif as PIC by running:
CFLAGS="-fPIC" cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DAVIF_CODEC_AOM=ON -DAVIF_LOCAL_AOM=ON ..
-fPIC is for gcc. llc uses -relocation-model=pic

I think CONFIG_PIC option would be useful for libavif too.

crash when passing in a png as input to avifenc

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007feb30f5155d in __GI_abort () at abort.c:79
#2  0x00007feb30fab45f in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7feb310b9f49 "%s\n") at ../sysdeps/posix/libc_fatal.c:181
#3  0x00007feb30fb28fc in malloc_printerr (str=str@entry=0x7feb310bbb80 "free(): double free detected in tcache 2") at malloc.c:5332
#4  0x00007feb30fb472d in _int_free (av=0x7feb310ec9e0 <main_arena>, p=0x555794e21290, have_lock=0) at malloc.c:4201
#5  0x00005557934da7a8 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/libavif-0.5.2-1.1.x86_64/apps/avifenc.c:214

Wire speed setting into avifenc

Hello, here's a little patch to do what the title says:

diff --git a/apps/avifenc.c b/apps/avifenc.c
index f03f9ac..de527f3 100644
--- a/apps/avifenc.c
+++ b/apps/avifenc.c
@@ -24,6 +24,9 @@ static int syntax(void)
     printf("    -h,--help         : Show syntax help\n");
     printf("    -j,--jobs J       : Number of jobs (worker threads, default: 1)\n");
     printf("    -n,--nclx P/T/M/R : Set nclx colr box values (4 raw numbers)\n");
+    printf("    -s,--speed S      : Encoder speed (%d-%d, slow to fast)\n",
+           AVIF_SPEED_SLOWEST,
+           AVIF_SPEED_FASTEST);
     printf("                        P = enum avifNclxColourPrimaries\n");
     printf("                        T = enum avifNclxTransferCharacteristics\n");
     printf("                        M = enum avifNclxMatrixCoefficients\n");
@@ -97,7 +100,7 @@ int main(int argc, char * argv[])
         return syntax();
     }
 
-    int jobs = 1;
+    int jobs = 1, speed = AVIF_SPEED_DEFAULT;
     int minQuantizer = AVIF_QUANTIZER_BEST_QUALITY;
     int maxQuantizer = AVIF_QUANTIZER_BEST_QUALITY;
     avifBool nclxSet = AVIF_FALSE;
@@ -118,6 +121,15 @@ int main(int argc, char * argv[])
             if (jobs < 1) {
                 jobs = 1;
             }
+        } else if (!strcmp(arg, "-s") || !strcmp(arg, "--speed")) {
+            NEXTARG();
+            speed = atoi(arg);
+            if (speed > AVIF_SPEED_FASTEST) {
+                speed = AVIF_SPEED_FASTEST;
+            }
+            if (speed < AVIF_SPEED_SLOWEST) {
+                speed = AVIF_SPEED_SLOWEST;
+            }
         } else if (!strcmp(arg, "--min")) {
             NEXTARG();
             minQuantizer = atoi(arg);
@@ -187,6 +199,7 @@ int main(int argc, char * argv[])
            jobs);
     encoder = avifEncoderCreate();
     encoder->maxThreads = jobs;
+    encoder->speed = speed;
     encoder->minQuantizer = minQuantizer;
     encoder->maxQuantizer = maxQuantizer;
     avifResult encodeResult = avifEncoderWrite(encoder, avif, &raw);

And a few questions:

  • I suppose I can't encode pictures with alpha with avifenc, since it takes y4m, right?
  • A way to dynamically choose the encoding/decoding backend would be very nice to do comparisons. Guess it won't be easy to do if you choose to.

Why not use the release version of libaom?

I'm on Arch Linux, and pacman -S aom gives me libaom v1.0.0-errata1, which is the newest release of libaom.

However, libavif seems to be requiring a specific commit of libaom.

git clone -n https://aomedia.googlesource.com/aom && cd aom && git checkout 38711e7fe1eff68296b0324a9809804aec359fa5 && cd ..

Building with libaom v1.0.0-errata1 will result in compile error in src/codec_aom.c. So I have to run ext/aom.cmd and build libaom as well.

Is there a reason for not using the release version of libaom? At least in the release version of libavif?

Attempting to run tests on encoder that does not exist

It doesn't make sense to try and run a test for an encoder that does not necessarily exist.

$ doas -u _pbuild ../build-amd64/aviftest tests/data/
Codec Versions: dav1d:0.5.1, aom:v1.0.0
Test Data Dir : tests/data/
AVIF Test Suite: Running Tests...
OK[cosmos1650_yuv444_10bpc_p3pq_aom_to_aom_qp0_0_speed-1]
OK[cosmos1650_yuv444_10bpc_p3pq_aom_to_aom_qp0_0_speed10]
OK[cosmos1650_yuv444_10bpc_p3pq_aom_to_aom_qp4_40_speed-1]
OK[cosmos1650_yuv444_10bpc_p3pq_aom_to_aom_qp4_40_speed10]
OK[cosmos1650_yuv444_10bpc_p3pq_aom_to_aom_qp24_60_speed-1]
OK[cosmos1650_yuv444_10bpc_p3pq_aom_to_aom_qp24_60_speed10]
OK[cosmos1650_yuv444_10bpc_p3pq_aom_to_dav1d_qp0_0_speed-1]
OK[cosmos1650_yuv444_10bpc_p3pq_aom_to_dav1d_qp0_0_speed10]
OK[cosmos1650_yuv444_10bpc_p3pq_aom_to_dav1d_qp4_40_speed-1]
OK[cosmos1650_yuv444_10bpc_p3pq_aom_to_dav1d_qp4_40_speed10]
OK[cosmos1650_yuv444_10bpc_p3pq_aom_to_dav1d_qp24_60_speed-1]
OK[cosmos1650_yuv444_10bpc_p3pq_aom_to_dav1d_qp24_60_speed10]
ERROR[cosmos1650_yuv444_10bpc_p3pq_rav1e_to_aom_qp0_0_speed-1]: Encode failed
ERROR[cosmos1650_yuv444_10bpc_p3pq_rav1e_to_aom_qp0_0_speed10]: Encode failed
ERROR[cosmos1650_yuv444_10bpc_p3pq_rav1e_to_aom_qp4_40_speed-1]: Encode failed
ERROR[cosmos1650_yuv444_10bpc_p3pq_rav1e_to_aom_qp4_40_speed10]: Encode failed
ERROR[cosmos1650_yuv444_10bpc_p3pq_rav1e_to_aom_qp24_60_speed-1]: Encode failed
ERROR[cosmos1650_yuv444_10bpc_p3pq_rav1e_to_aom_qp24_60_speed10]: Encode failed
ERROR[cosmos1650_yuv444_10bpc_p3pq_rav1e_to_dav1d_qp0_0_speed-1]: Encode failed
ERROR[cosmos1650_yuv444_10bpc_p3pq_rav1e_to_dav1d_qp0_0_speed10]: Encode failed
ERROR[cosmos1650_yuv444_10bpc_p3pq_rav1e_to_dav1d_qp4_40_speed-1]: Encode failed
ERROR[cosmos1650_yuv444_10bpc_p3pq_rav1e_to_dav1d_qp4_40_speed10]: Encode failed
ERROR[cosmos1650_yuv444_10bpc_p3pq_rav1e_to_dav1d_qp24_60_speed-1]: Encode failed
ERROR[cosmos1650_yuv444_10bpc_p3pq_rav1e_to_dav1d_qp24_60_speed10]: Encode failed
OK[kodim03_yuv420_8bpc_aom_to_aom_qp0_0_speed-1]
OK[kodim03_yuv420_8bpc_aom_to_aom_qp0_0_speed10]
OK[kodim03_yuv420_8bpc_aom_to_aom_qp4_40_speed-1]
OK[kodim03_yuv420_8bpc_aom_to_aom_qp4_40_speed10]
OK[kodim03_yuv420_8bpc_aom_to_aom_qp24_60_speed-1]
OK[kodim03_yuv420_8bpc_aom_to_aom_qp24_60_speed10]
OK[kodim03_yuv420_8bpc_aom_to_dav1d_qp0_0_speed-1]
OK[kodim03_yuv420_8bpc_aom_to_dav1d_qp0_0_speed10]
OK[kodim03_yuv420_8bpc_aom_to_dav1d_qp4_40_speed-1]
OK[kodim03_yuv420_8bpc_aom_to_dav1d_qp4_40_speed10]
OK[kodim03_yuv420_8bpc_aom_to_dav1d_qp24_60_speed-1]
OK[kodim03_yuv420_8bpc_aom_to_dav1d_qp24_60_speed10]
ERROR[kodim03_yuv420_8bpc_rav1e_to_aom_qp0_0_speed-1]: Encode failed
ERROR[kodim03_yuv420_8bpc_rav1e_to_aom_qp0_0_speed10]: Encode failed
ERROR[kodim03_yuv420_8bpc_rav1e_to_aom_qp4_40_speed-1]: Encode failed
ERROR[kodim03_yuv420_8bpc_rav1e_to_aom_qp4_40_speed10]: Encode failed
ERROR[kodim03_yuv420_8bpc_rav1e_to_aom_qp24_60_speed-1]: Encode failed
ERROR[kodim03_yuv420_8bpc_rav1e_to_aom_qp24_60_speed10]: Encode failed
ERROR[kodim03_yuv420_8bpc_rav1e_to_dav1d_qp0_0_speed-1]: Encode failed
ERROR[kodim03_yuv420_8bpc_rav1e_to_dav1d_qp0_0_speed10]: Encode failed
ERROR[kodim03_yuv420_8bpc_rav1e_to_dav1d_qp4_40_speed-1]: Encode failed
ERROR[kodim03_yuv420_8bpc_rav1e_to_dav1d_qp4_40_speed10]: Encode failed
ERROR[kodim03_yuv420_8bpc_rav1e_to_dav1d_qp24_60_speed-1]: Encode failed
ERROR[kodim03_yuv420_8bpc_rav1e_to_dav1d_qp24_60_speed10]: Encode failed
OK[kodim23_yuv420_8bpc_aom_to_aom_qp0_0_speed-1]
OK[kodim23_yuv420_8bpc_aom_to_aom_qp0_0_speed10]
OK[kodim23_yuv420_8bpc_aom_to_aom_qp4_40_speed-1]
OK[kodim23_yuv420_8bpc_aom_to_aom_qp4_40_speed10]
OK[kodim23_yuv420_8bpc_aom_to_aom_qp24_60_speed-1]
OK[kodim23_yuv420_8bpc_aom_to_aom_qp24_60_speed10]
OK[kodim23_yuv420_8bpc_aom_to_dav1d_qp0_0_speed-1]
OK[kodim23_yuv420_8bpc_aom_to_dav1d_qp0_0_speed10]
OK[kodim23_yuv420_8bpc_aom_to_dav1d_qp4_40_speed-1]
OK[kodim23_yuv420_8bpc_aom_to_dav1d_qp4_40_speed10]
OK[kodim23_yuv420_8bpc_aom_to_dav1d_qp24_60_speed-1]
OK[kodim23_yuv420_8bpc_aom_to_dav1d_qp24_60_speed10]
ERROR[kodim23_yuv420_8bpc_rav1e_to_aom_qp0_0_speed-1]: Encode failed
ERROR[kodim23_yuv420_8bpc_rav1e_to_aom_qp0_0_speed10]: Encode failed
ERROR[kodim23_yuv420_8bpc_rav1e_to_aom_qp4_40_speed-1]: Encode failed
ERROR[kodim23_yuv420_8bpc_rav1e_to_aom_qp4_40_speed10]: Encode failed
ERROR[kodim23_yuv420_8bpc_rav1e_to_aom_qp24_60_speed-1]: Encode failed
ERROR[kodim23_yuv420_8bpc_rav1e_to_aom_qp24_60_speed10]: Encode failed
ERROR[kodim23_yuv420_8bpc_rav1e_to_dav1d_qp0_0_speed-1]: Encode failed
ERROR[kodim23_yuv420_8bpc_rav1e_to_dav1d_qp0_0_speed10]: Encode failed
ERROR[kodim23_yuv420_8bpc_rav1e_to_dav1d_qp4_40_speed-1]: Encode failed
ERROR[kodim23_yuv420_8bpc_rav1e_to_dav1d_qp4_40_speed10]: Encode failed
ERROR[kodim23_yuv420_8bpc_rav1e_to_dav1d_qp24_60_speed-1]: Encode failed
ERROR[kodim23_yuv420_8bpc_rav1e_to_dav1d_qp24_60_speed10]: Encode failed
Complete. 72 tests ran, 0 skipped, 36 failed.
AVIF Test Suite: Failed.

AVIF_BUILD_APPS fails to build on 32-bit architectures due to -Werror

Regressed by 21bc4df. See error logs: i386, armv7.

apps/avifdump.c:66:24: error: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
                       decoder->timescale,
                       ^~~~~~~~~~~~~~~~~~
apps/avifdump.c:68:24: error: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
                       decoder->durationInTimescales,
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
apps/avifdump.c:77:20: error: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
                   decoder->imageTiming.ptsInTimescales,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
apps/avifdump.c:79:20: error: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
                   decoder->imageTiming.durationInTimescales);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Conversion of comparison results to avifBool

libavif uses the ternary operator ? : to convert a comparison result to avifBool. Here is an example in src/avif.c:

avifBool avifImageUsesU16(avifImage * image)
{
return (image->depth > 8) ? AVIF_TRUE : AVIF_FALSE;
}

In C, the result of a comparison expression has the type 'int' and is equal to 1 or 0. Since avifBool is a type alias for 'int' and the AVIF_TRUE and AVIF_FALSE macros are defined as 1 and 0, the use of the ternary operator is not necessary. The example above could be written more concisely as follows:

avifBool avifImageUsesU16(avifImage * image)
{
return image->depth > 8;
}

So far I have been following this style in the pull requests I wrote, but I have been wondering if there is a reason to write it this way.

Note: I believe that compilers will optimize away the ternary operator, so this issue is just a coding style issue.

Fails to build with Clang 10

Regressed by e2c3c87.

$ CC=clang10 CXX=clang++10 cmake -GNinja -DAVIF_CODEC_AOM=on -DAVIF_BUILD_APPS=on .
$ ninja
[...]
src/alpha.c:169:44: error: implicit conversion from 'int' to 'float' may lose precision [-Werror,-Wimplicit-int-float-conversion]
                            float alphaF = srcAlpha / srcMaxChannelF;
                                           ^~~~~~~~ ~
src/alpha.c:183:44: error: implicit conversion from 'int' to 'float' may lose precision [-Werror,-Wimplicit-int-float-conversion]
                            float alphaF = srcAlpha / srcMaxChannelF;
                                           ^~~~~~~~ ~
src/alpha.c:198:40: error: implicit conversion from 'int' to 'float' may lose precision [-Werror,-Wimplicit-int-float-conversion]
                        float alphaF = srcAlpha / srcMaxChannelF;
                                       ^~~~~~~~ ~
src/alpha.c:221:44: error: implicit conversion from 'int' to 'float' may lose precision [-Werror,-Wimplicit-int-float-conversion]
                            float alphaF = srcAlpha / srcMaxChannelF;
                                           ^~~~~~~~ ~
src/alpha.c:236:44: error: implicit conversion from 'int' to 'float' may lose precision [-Werror,-Wimplicit-int-float-conversion]
                            float alphaF = srcAlpha / srcMaxChannelF;
                                           ^~~~~~~~ ~
src/alpha.c:252:40: error: implicit conversion from 'int' to 'float' may lose precision [-Werror,-Wimplicit-int-float-conversion]
                        float alphaF = srcAlpha / srcMaxChannelF;
                                       ^~~~~~~~ ~
src/alpha.c:274:44: error: implicit conversion from 'int' to 'float' may lose precision [-Werror,-Wimplicit-int-float-conversion]
                            float alphaF = srcAlpha / srcMaxChannelF;
                                           ^~~~~~~~ ~
src/alpha.c:289:44: error: implicit conversion from 'int' to 'float' may lose precision [-Werror,-Wimplicit-int-float-conversion]
                            float alphaF = srcAlpha / srcMaxChannelF;
                                           ^~~~~~~~ ~
src/alpha.c:305:40: error: implicit conversion from 'int' to 'float' may lose precision [-Werror,-Wimplicit-int-float-conversion]
                        float alphaF = srcAlpha / srcMaxChannelF;
                                       ^~~~~~~~ ~
src/alpha.c:329:44: error: implicit conversion from 'int' to 'float' may lose precision [-Werror,-Wimplicit-int-float-conversion]
                            float alphaF = srcAlpha / srcMaxChannelF;
                                           ^~~~~~~~ ~
src/alpha.c:345:44: error: implicit conversion from 'int' to 'float' may lose precision [-Werror,-Wimplicit-int-float-conversion]
                            float alphaF = srcAlpha / srcMaxChannelF;
                                           ^~~~~~~~ ~
src/alpha.c:362:40: error: implicit conversion from 'int' to 'float' may lose precision [-Werror,-Wimplicit-int-float-conversion]
                        float alphaF = srcAlpha / srcMaxChannelF;
                                       ^~~~~~~~ ~
12 errors generated.

How to create .avifs (image/avif-sequence) files?

I started to work with AVIF sequences & animations. So far I have only the testfiles I found and I can read them via libavif.
However, how can I create the AVIFS files by myself? I need to be able to create such files to test my programs better.

Provide a way to avoid conversion from a studio-ranged alpha channel to a full-ranged

Split from #86 .

In current implementation, a limited-ranged alpha plane is converted to a full-ranged alpha plane internally (in here), but this double loop written in C may cause performance issues.

And also, in some cases, these alpha values should be scaled from 0 to 65535 (16bit RGBA) or 0.0f to 1.0f (Float RGBA) again to display on screen or to store to another image format. In general, it is better to avoid rounding integers twice for better precision.

Memory allocation failures are not checked and handled.

Libavif does not check and handle memory allocation failures. Here is an example in src/avif.c:

avifImage * avifImageCreate(int width, int height, int depth, avifPixelFormat yuvFormat)
{
avifImage * image = (avifImage *)avifAlloc(sizeof(avifImage));
avifImageSetDefaults(image);
image->width = width;
image->height = height;
image->depth = depth;
image->yuvFormat = yuvFormat;
return image;
}

Note that 'image' is dereferenced without a null pointer check.

This policy is acceptable to some clients. For example, in Chromium any memory allocation failure aborts the process. On the other hand, this policy would be a dealbreaker to clients that try to handle memory allocation failures.

If this policy is deliberate, it should be documented. Otherwise, we should add code to check for and report out-of-memory errors. Some functions such as avifImageAllocatePlanes() that allocate memory and return void will need to return avifBool instead.

Provide key frame list.

To save memory, some clients will want to evict things that are not part of the currently displayed set of frames. So having a list of which frames are required to decode a frame at index i is helpful.

Keyframe status can be found in stss, trun, or the OBU header.

Can a read API be created instead of using avifRawData?

I.e., instead of providing a avifRawData which contains a pointer to the data, we'd instead provide a function which allows for reading x bytes at position y. This is a fairly common API design for streaming demuxer libraries.

It avoids multiple copies of the media data in memory at once and allows for it to be evicted when not needed.

Findaom.cmake and Findrav1e.cmake mention dav1d

Release tag: v0.5.6

Findaom.cmake and Findrav1e.cmake mention dav1d in the following code snippet:

find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
pkg_check_modules(_DAV1D dav1d)
endif (PKG_CONFIG_FOUND)

It looks like copy-and-paste errors. If it is correct, it would be good to add a comment to explain why we need to call pkg_check_modules(_DAV1D dav1d) when trying to discover the aom or rav1e package on the system.

Doesn't compile on raspberry pi

Hi,

Not sure how much of an issue this is, but thought to tell you. I tried to compile this on latest raspbian buster, which has libaom etc.

Really looking forward to a basic way to convert avifs to jpeg/png and back etc. Hope this is the project!

Cheers,

Alex

pi@raspberrypi-zero:~/src/libavif-master/libavif_build $ make
Scanning dependencies of target avif
[ 9%] Building C object CMakeFiles/avif.dir/src/avif.c.o
[ 18%] Building C object CMakeFiles/avif.dir/src/colr.c.o
[ 27%] Building C object CMakeFiles/avif.dir/src/mem.c.o
[ 36%] Building C object CMakeFiles/avif.dir/src/rawdata.c.o
[ 45%] Building C object CMakeFiles/avif.dir/src/read.c.o
[ 54%] Building C object CMakeFiles/avif.dir/src/reformat.c.o
[ 63%] Building C object CMakeFiles/avif.dir/src/stream.c.o
[ 72%] Building C object CMakeFiles/avif.dir/src/utils.c.o
[ 81%] Building C object CMakeFiles/avif.dir/src/write.c.o
[ 90%] Building C object CMakeFiles/avif.dir/src/codec_aom.c.o
/home/pi/src/libavif-master/libavif_src/src/codec_aom.c: In function ‘aomCodecGetNextImage’:
/home/pi/src/libavif-master/libavif_src/src/codec_aom.c:133:18: error: ‘AOM_IMG_FMT_YV1216’ undeclared (first use in this function); did you mean ‘AOM_IMG_FMT_YV12’?
case AOM_IMG_FMT_YV1216:
^~~~~~~~~~~~~~~~~~
AOM_IMG_FMT_YV12
/home/pi/src/libavif-master/libavif_src/src/codec_aom.c:133:18: note: each undeclared identifier is reported only once for each function it appears in
In file included from /usr/include/aom/aom_decoder.h:33,
from /home/pi/src/libavif-master/libavif_src/src/codec_aom.c:14:
/home/pi/src/libavif-master/libavif_src/src/codec_aom.c: In function ‘encodeOBU’:
/home/pi/src/libavif-master/libavif_src/src/codec_aom.c:342:40: error: ‘AV1E_SET_ROW_MT’ undeclared (first use in this function); did you mean ‘AV1E_SET_MTU’?
aom_codec_control(&aomEncoder, AV1E_SET_ROW_MT, 1);
^~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/avif.dir/build.make:180: CMakeFiles/avif.dir/src/codec_aom.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/avif.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

Support clap, imir, irot property in ItemPropertyContainerBox

Hi!

@dreampiggy says that he or she wants to support rotation/mirroring/cropping in SDImageAVIFCoder, but I found that imr, irot, clap box (defined in HEIF) is not recognized:

libavif/src/read.c

Lines 653 to 679 in f9bba7d

static avifBool avifParseItemPropertyContainerBox(avifData * data, const uint8_t * raw, size_t rawLen)
{
BEGIN_STREAM(s, raw, rawLen);
while (avifROStreamHasBytesLeft(&s, 1)) {
avifBoxHeader header;
CHECK(avifROStreamReadBoxHeader(&s, &header));
int propertyIndex = avifArrayPushIndex(&data->properties);
memcpy(data->properties.prop[propertyIndex].type, header.type, 4);
if (!memcmp(header.type, "ispe", 4)) {
CHECK(avifParseImageSpatialExtentsProperty(data, avifROStreamCurrent(&s), header.size, propertyIndex));
}
if (!memcmp(header.type, "auxC", 4)) {
CHECK(avifParseAuxiliaryTypeProperty(data, avifROStreamCurrent(&s), header.size, propertyIndex));
}
if (!memcmp(header.type, "colr", 4)) {
CHECK(avifParseColourInformationBox(data, avifROStreamCurrent(&s), header.size, propertyIndex));
}
if (!memcmp(header.type, "av1C", 4)) {
CHECK(avifParseAV1CodecConfigurationBoxProperty(data, avifROStreamCurrent(&s), header.size, propertyIndex));
}
CHECK(avifROStreamSkip(&s, header.size));
}
return AVIF_TRUE;
}

MIAF specification says that there are no transformation information in EXIF metadata in MIAF, so libavif might have to parse those boxes to handle transformation correctly.

There is no need for a reader to understand the details of the metadata.
There should be no image transformations expressed by Exif (rotation, mirroring, etc.) indicated in the Exif metadata, in files encoded according to this document.
MIAF, p16

Our avif parser implementation, libavif-container parses them, so please refer if you need.

https://github.com/link-u/libavif-container/blob/371ca8f421d1622065cd1f34e8d0abe0886cf259/src/avif/Parser.cpp#L231-L321

[rav1e] Expose the speed setting

The rav1e encoder has a speed setting (an integer between 0 and 10, defaults to 6) that significantly impacts encoding speed and quality. Right now there is no way to set this when using rav1e via libavif, it just uses the default value. We should expose a new speed parameter (similar to how we expose the maxThreads).

Cleanup related to repo import

Attention should be given to links needing updates, WRT importing joedrago/avif -> AOMediaCodec/libavif -- specifically WRT Windows static builds and CI.

Should also verify that the license requires no changes.

Expose frame resolution from container.

If present it'd be nice to have the resolution information as known by the container so the image doesn't need to be decoded until necessary. On the web we are frequently in need of just the size.

Is it possible to provide the bit depth before decoding the image?

stsd would have this information, it would also be present in the obu if one is provided for a still image. Possibly elsewhere? I'm unsure after looking over the avif spec.

This would allow us to properly configure the pipeline for half float decoding during the metadata retrieval step instead of having to decode the first frame proactively.

Is it okay to ignore TransferCharacteristics and MatrixCoefficients?

Hi!

I found that TransferCharacteristics and MatrixCoefficients are retrieved from Sequence Header OBU, but not used for transformation from YUV to RGB or RGB to YUV.
https://github.com/AOMediaCodec/libavif/search?q=transferCharacteristics&unscoped_q=transferCharacteristics
https://github.com/AOMediaCodec/libavif/search?q=matrixCoefficients&unscoped_q=matrixCoefficients

However, according to H.273 (that is refered by AV1 Spec, 6.4.2. Color config semantics), it seems TransferCharacteristics parameters are required to calculate YUV values (See equation 11~13). And also, there are multiple different conversion equations from RGB to YUV for each MatrixCoefficients (See equation 20-74).

In current implementation, only ColorPrimaries parameters are used for conversion.
https://github.com/AOMediaCodec/libavif/blob/master/src/colr.c#L142-L155
But, for example, the color primaries for SMPTE ST 2085 is not defined in ColorPrimaries. I wonder what happens SMPTE ST 2085 (11), Rec. ITU-R BT.2020-2 (constant luminance) (10) or Rec. ITU-R BT.2100-0 ICtCp(14) is specified for MatrixCoefficients... Can current implementation convert YUV between RGB correctly?

Is it really okay to ignore TransferCharacteristics and MatrixCoefficients?

I am not very familiar with color management....Please tell me!

Fails to build with Clang 10

$ CC=clang10 CXX=clang++10 cmake -GNinja -DAVIF_CODEC_AOM=on -DAVIF_BUILD_APPS=on .
$ ninja
[...]
apps/shared/y4m.c:186:13: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
            default:
            ^
apps/shared/y4m.c:186:13: note: insert 'break;' to avoid fall-through
            default:
            ^
            break;

when the tools link the static library they also need to link the AVIF_CODEC_LIBARIES

I used the following patch to fix the build with the current release

Index: libavif-0.4.7/CMakeLists.txt
===================================================================
--- libavif-0.4.7.orig/CMakeLists.txt
+++ libavif-0.4.7/CMakeLists.txt
@@ -119,6 +119,7 @@ if(AVIF_CODEC_DAV1D)
             endif()
             message(STATUS "LIBDAV1D_INCLUDE_PATH: ${LIBDAV1D_INCLUDE_PATH}")
             include_directories(${LIBDAV1D_INCLUDE_PATH})
+            set(AVIF_CODEC_LIBARIES ${LIBDAV1D_LIBRARY_PATH})
         endif()
     endif()
 endif()
@@ -216,7 +217,7 @@ endif()
 option(AVIF_BUILD_EXAMPLES "Build avif Examples." OFF)
 if(AVIF_BUILD_EXAMPLES)
     add_executable(avif_example1 examples/avif_example1.c)
-    target_link_libraries(avif_example1 avif ${AVIF_MATH_LIBRARY})
+    target_link_libraries(avif_example1 avif ${AVIF_MATH_LIBRARY} ${AVIF_CODEC_LIBARIES})
 endif()
 
 option(AVIF_BUILD_APPS "Build avif apps." OFF)
@@ -227,13 +228,13 @@ if(AVIF_BUILD_APPS)
         apps/shared/y4m.c
         apps/shared/avifutil.c
     )
-    target_link_libraries(avifenc avif ${AVIF_MATH_LIBRARY})
+    target_link_libraries(avifenc avif ${AVIF_MATH_LIBRARY} ${AVIF_CODEC_LIBARIES})
     add_executable(avifdec
         apps/avifdec.c
         apps/shared/y4m.c
         apps/shared/avifutil.c
     )
-    target_link_libraries(avifdec avif ${AVIF_MATH_LIBRARY})
+    target_link_libraries(avifdec avif ${AVIF_MATH_LIBRARY} ${AVIF_CODEC_LIBARIES})
 endif()
 
 option(AVIF_BUILD_TESTS "Build avif tests (fuzzing)." OFF)
@@ -241,7 +242,7 @@ if(AVIF_BUILD_TESTS)
     add_executable(aviffuzz
         tests/aviffuzz.c
     )
-    target_link_libraries(aviffuzz avif ${AVIF_MATH_LIBRARY})
+    target_link_libraries(aviffuzz avif ${AVIF_MATH_LIBRARY}  ${AVIF_CODEC_LIBARIES})
 endif()
 
 macro(avif_set_folder_safe target folder)

the code for rav1e support is more or less a copy of the dav1d code and not adapted in all branches. I didnt fix that.

and while we are at it:

building with libaom 1.0.0 fails with

/usr/bin/cc -DAVIF_CODEC_AOM=1 -I/home/abuild/rpmbuild/BUILD/libavif-0.4.7/include -I/home/abuild/rpmbuild/BUILD/libavif-0.4.7/apps/shared  -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type  -g -DNDEBUG -O2 -g -DNDEBUG   -std=c99 -std=c99 -Werror -Wall -Wextra -o CMakeFiles/avif.dir/src/codec_aom.c.o   -c /home/abuild/rpmbuild/BUILD/libavif-0.4.7/src/codec_aom.c
/home/abuild/rpmbuild/BUILD/libavif-0.4.7/src/codec_aom.c: In function 'aomCodecGetNextImage':
/home/abuild/rpmbuild/BUILD/libavif-0.4.7/src/codec_aom.c:129:18: error: 'AOM_IMG_FMT_YV1216' undeclared (first use in this function); did you mean 'AOM_IMG_FMT_YV12'?
  129 |             case AOM_IMG_FMT_YV1216:
      |                  ^~~~~~~~~~~~~~~~~~
      |                  AOM_IMG_FMT_YV12
/home/abuild/rpmbuild/BUILD/libavif-0.4.7/src/codec_aom.c:129:18: note: each undeclared identifier is reported only once for each function it appears in
In file included from /usr/include/aom/aom_decoder.h:33,
                 from /home/abuild/rpmbuild/BUILD/libavif-0.4.7/src/codec_aom.c:14:
/home/abuild/rpmbuild/BUILD/libavif-0.4.7/src/codec_aom.c: In function 'aomCodecEncodeImage':
/home/abuild/rpmbuild/BUILD/libavif-0.4.7/src/codec_aom.c:280:40: error: 'AV1E_SET_ROW_MT' undeclared (first use in this function); did you mean 'AV1E_SET_MTU'?
  280 |         aom_codec_control(&aomEncoder, AV1E_SET_ROW_MT, 1);
      |                                        ^~~~~~~~~~~~~~~

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.