Wan-Teh Chang
unread,May 19, 2022, 7:01:51 PM5/19/22Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message as abuse
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to av1-d...@aomedia.org
Hi Eyal,
If you are comfortable with reading libaom source code and using a
debugger, you can create a debug build of libaom (pass
-DCMAKE_BUILD_TYPE=Debug to the cmake command) and run aomdec in gdb.
Set a breakpoint at aom_internal_error(). Many (but not all) decoding
errors are reported by calling aom_internal_error().
In addition, set a breakpoint at the following line inside the
aom_decode_frame_from_obus() function in av1/decoder/obu.c:
switch (obu_header.type) {
That switch statement is responsible for decoding the AV1 OBUs. You
will see temporal delimiter, sequence header, frame, temporal
delimiter, frame, frame, and then the decoding error.
Then run the command "run bad.av1 -o /dev/null" in gdb.
By doing this, I found that the first coding error comes from the
byte_alignment() call. I attach a patch (patch.txt) that will print a
more informative error message when that byte_alignment() call fails.
The patch also suppresses the byte_alignment() check (which you can
undo by changing #if 0 to #if 1).
After I suppressed the byte_alignment() failure, the decoding still
failed, this time in the decode_tiles() function in
av1/decoder/decodeframe.c.
// decode tile
decode_tile(pbi, td, row, col);
aom_merge_corrupted_flag(&pbi->dcb.corrupted, td->dcb.corrupted);
if (pbi->dcb.corrupted)
aom_internal_error(&pbi->error, AOM_CODEC_CORRUPT_FRAME,
"Failed to decode tile data");
This decoding error is reported by aom_internal_error(), so I caught
it with the first breakpoint.
The next thing to try is to track down where libaom sets the
td->dcb.corrupted flag to 1. I searched for "corrupted" in
av1/decoder/decodeframe.c and set a breakpoint at every place where we
set the 'corrupted' struct member to 1. I hit a breakpoint at the end
of decode_tile():
int corrupted =
(check_trailing_bits_after_symbol_coder(td->bit_reader)) ? 1 : 0;
aom_merge_corrupted_flag(&dcb->corrupted, corrupted);
Now I applied the second attached patch (patch2.txt) to suppress the
errors in check_trailing_bits_after_symbol_coder(), and that finally
allowed me to decode bad.av1 successfully. So both decoding errors
have to do with trailing bits. Please consult the AV1 specification
for the requirements on the byte_alignment() and trailing_bits()
functions.
Note: You can also try libgav1 as James Zern suggested. libgav1
generally has better error reporting.
Wan-Teh