summaryrefslogtreecommitdiffstats
path: root/libavcodec/cbs_av1.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/cbs_av1: Make overread check more robustAndreas Rheinhardt2019-09-291-2/+2
| | | | | | | | | | | When performing a comparison of a signed int and an unsigned int, the signed int is first converted to an unsigned int, so that negative values are being treated as big, positive values. This can become a problem in an overread check, namely when an overread already happened. So change the type of the variable containing the amount of bits that need to be left to signed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* cbs: Don't set AVBuffer's opaqueAndreas Rheinhardt2019-07-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | cbs is currently inconsistent regarding the opaque field that can be used as a special argument to av_buffer_create in order to be used during freeing the buffer: ff_cbs_alloc_unit_content and all the free functions used name this parameter as if it should contain a pointer to the unit whose content is about to be created; but both ff_cbs_alloc_unit_content as well as ff_cbs_h264_add_sei_message actually use a pointer to the CodedBitstreamContext as opaque. It should actually be neither, because it is unneeded (as is evidenced by the fact that none of the free functions use this pointer at all) and because it ties the unit's content to the lifetime of other objects, although a refcounted buffer is supposed to have its own lifetime that only ends when its reference count reaches zero. This problem manifests itself in the pointer becoming dangling. The pointer to the unit can become dangling if another unit is added to the fragment later as happens in the bitstream filters; in this case, the pointer can point to the wrong unit (if the fragment's unit array needn't be relocated) or it can point to where the array was earlier. It can also become dangling if the unit's content is meant to survive the resetting of the fragment it was originally read with. This applies to the extradata of H.264 and HEVC. The pointer to the context can become dangling if the context is closed before the content is freed. Although this doesn't seem to happen right now, it could happen, in particular if one uses different CodedBitstreamContexts for in- and output. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* cbs: Remove useless initializationsAndreas Rheinhardt2019-07-271-7/+7
| | | | | | | | | | | Up until now, a temporary variable was used and initialized every time a value was read in CBS; if reading turned out to be successfull, this value was overwritten (without having ever been looked at) with the value read if reading was successfull; on failure the variable wasn't touched either. Therefore these initializations can be and have been removed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* cbs_av1, cbs_jpeg, cbs_mpeg2, cbs_vp9: Fix undefAndreas Rheinhardt2019-06-071-3/+2
| | | | | | | | | READ has already been undefined at this point; it is obviously intended to undef WRITE. Furthermore, leb128 (in cbs_av1) was undefined too often and inconsistently. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/cbs_av1: use the new signed value read/write functionsJames Almer2019-04-161-60/+8
| | | | | Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cbs_av1: add support for Padding OBUsJames Almer2019-04-141-0/+20
| | | | | | | Based on itut_t35 Matadata OBU parsing code. Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cbs_av1: add a function to strip trailing zeroes from a buffer sizeJames Almer2019-04-141-0/+11
| | | | | | | Factor it out from cbs_av1_read_metadata_itut_t35() Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cbs_av1: fix parsing spatial_idJames Almer2019-04-021-1/+1
| | | | | Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cbs_av1: don't call cbs_av1_read_trailing_bits() when no bits remain ↵James Almer2019-02-101-2/+6
| | | | | | | in the OBU Reviewed-by: jkqxz Signed-off-by: James Almer <jamrial@gmail.com>
* cbs_av1: Fix reading of overlong uvlc codesMark Thompson2018-12-221-18/+40
| | | | | | | | | | | | | | | | The specification allows 2^32-1 to be encoded as any number of zeroes greater than 31, followed by a one. This previously failed because the trace code would overflow the array containing the string representation of the bits if there were more than 63 zeroes. Fix that by splitting the trace output into batches, and at the same time move it out of the default path. (While this seems likely to be a specification error, libaom does support it so we probably should as well.) From a test case by keval shah <skeval65@gmail.com>. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/cbs: Do not use format specifier "z" on Windows.Carl Eugen Hoyos2018-12-171-5/+5
|
* avcodec/cbs_av1: don't abort when splitting Temporal Units containing OBUs ↵James Almer2018-11-181-10/+6
| | | | | | | | | | with no obu_size field The ISOBMFF and Matroska specs allow the last OBU in a Sample/Block to have obu_has_size_field equal to 0. Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cbs_av1: fix parsing signed integer valuesJames Almer2018-11-141-21/+9
| | | | | Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: James Almer <jamrial@gmail.com>
* cbs_av1: Support redundant frame headersMark Thompson2018-11-051-4/+12
|
* cbs_av1: Fix header writing when already alignedMark Thompson2018-11-051-1/+1
|
* lavc: Add coded bitstream read/write support for AV1Mark Thompson2018-09-261-0/+1320
OpenPOWER on IntegriCloud