1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

8 Commits

Author SHA1 Message Date
Andreas Rheinhardt
93b7f9312d avcodec/av1dec: Check tiles sizes, fix assert, don't read bytes bitwise
Tiles have a size field with a length from one to four bytes. As such it
is not possible to read it all at once with a call to get_bits() as this
only allows to read up to 25 bits; this is guarded by an av_assert2. Yet
this is done by the AV1 decoder in get_tiles_info(). It has been done
despite said size fields being byte-aligned. This commit fixes this by
using the bytestream2 API instead.

Furthermore, it is now explicitly checked whether the data is
consistent, i.e. whether the data that is supposed to be there extends
beyond the end of the data actually present.

Reviewed-by: Wang, Fei W <fei.w.wang@intel.com>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-18 02:34:55 +02:00
Andreas Rheinhardt
3e057dd8b1 avcodec/av1dec: Remove redundant second free
The AV1 decoder has the FF_CODEC_CAP_INIT_CLEANUP flag set and yet
the decoder's close function is called manually on some error paths.
This is unnecessary and has been removed in this commit.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-17 05:47:06 +02:00
Andreas Rheinhardt
92b578e1d6 avcodec/av1dec: Fix segfault upon allocation error
Up until now, the AV1 decoder always checks before calling its wrapper
around ff_thread_release_buffer() whether the ThreadFrame was used at
all, i.e. it checked whether the first data buffer of the AVFrame
contained therein is NULL or not. Yet this presumes that the AVFrame has
been successfully allocated, even though this can of course fail; and if
it did, one would encounter a segfault.
Fix this by removing the checks altogether: ff_thread_release_buffer()
can handle both unallocated as well as empty frames (since commit
f6774f905f).

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-17 05:46:24 +02:00
James Almer
e46f34e85b avcodec/av1dec: fix setting pix_fmt
Fill the array with the software pix_fmt and move the avctx->hwaccel
check back to the proper place.
Also remove the avoid probing flag to ensure an external av1 decoder
will not set a pix_fmt we don't want during format probing.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-12 17:39:45 -03:00
James Almer
9c6026bc72 avcodec/av1dec: update reference frame state on show_existing_frame
As defined in Section 7.4

Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-12 13:10:16 -03:00
James Almer
b80c66bb6b avcodec/av1dec: set chroma_sample_location
Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-12 13:10:16 -03:00
James Almer
b7a06885f1 avcodec/av1dec: use av_cmp_q() to compare aspect ratio
Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-12 13:10:16 -03:00
Fei Wang
47be5a5056 avcodec: add AV1 hardware accelerated decoder
This AV1 decoder is currently only used for hardware accelerated decoding.
It can be extended into a native decoder in the future, so set its name to
"av1" and temporarily give it the lowest priority in the codec list.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-12 13:08:34 -03:00