summaryrefslogtreecommitdiff
path: root/libavcodec/cbs_internal.h
Commit message (Collapse)AuthorAgeFilesLines
* avocdec/cbs_internal: Rename CBS_MAX_UNIT_TYPES->CBS_MAX_LIST_UNIT_TYPESAndreas Rheinhardt2022-10-221-4/+4
| | | | | | | This makes it clearer that this limit does not apply to CBS_UNIT_TYPE_RANGE units. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cbs: Remove CBS_CONTENT_TYPE_PODAndreas Rheinhardt2022-10-221-9/+12
| | | | | | | It is equivalent to CBS_CONTENT_TYPE_INTERNAL_REFS with nb_offsets equal to zero. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cbs_jpeg: Use table-based alloc/freeAndreas Rheinhardt2022-08-081-0/+7
| | | | | | | cbs_jpeg was the last user of CBS that didn't use CodedBitstreamUnitTypeDescriptors. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cbs_internal: Use unions to shrink size of descriptorsAndreas Rheinhardt2022-08-081-30/+39
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cbs_internal, cbs_h2645: Add and use new descriptor macrosAndreas Rheinhardt2022-08-081-7/+24
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/cbs_internal: clean up headersAnton Khirnov2021-06-101-1/+6
| | | | Include all required headers explicitly, avoid avcodec.h dependency.
* avcodec/cbs: add an AVClass to CodedBitstreamType for option handlingJames Almer2021-01-041-0/+6
| | | | | | So unit parsing may be configured with caller set options. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cbs: add a flush callback to CodedBitstreamTypeJames Almer2020-09-291-0/+3
| | | | | | Used to reset the codec's private internal state. Signed-off-by: James Almer <jamrial@gmail.com>
* cbs: Add support functions for handling unit content referencesMark Thompson2020-09-021-0/+1
| | | | | | | | | | | | Use the unit type table to determine what we need to do to clone the internals of the unit content when making copies for refcounting or writeability. (This will still fail for units with complex content if they do not have a defined clone function.) Setup and naming from a patch by Andreas Rheinhardt <andreas.rheinhardt@gmail.com>, but with the implementation changed to use the unit type information if possible rather than requiring a codec-specific function.
* cbs: Add macros to support defining unit type tablesMark Thompson2020-09-021-0/+24
|
* cbs: Describe allocate/free methods in tabular formMark Thompson2020-09-021-0/+61
| | | | | | | | | | | | | | | | Unit types are split into three categories, depending on how their content is managed: * POD structure - these require no special treatment. * Structure containing references to refcounted buffers - these can use a common free function when the offsets of all the internal references are known. * More complex structures - these still require ad-hoc treatment. For each codec we can then maintain a table of descriptors for each set of equivalent unit types, defining the mechanism needed to allocate/free that unit content. This is not required to be used immediately - a new alloc function supports this, but does not replace the old one which works without referring to these tables.
* avcodec/cbs: Factor out common code for writing unitsAndreas Rheinhardt2019-11-171-2/+4
| | | | | | | | | | | | | | | | | All cbs-functions to write units share a common pattern: 1. They check whether they have a write buffer (that is used to store the unit's data until the needed size becomes known after writing the unit when a dedicated buffer will be allocated). 2. They use this buffer for a PutBitContext. 3. The (codec-specific) writing takes place through the PutBitContext. 4. The return value is checked. AVERROR(ENOSPC) here always indicates that the buffer was too small and leads to a reallocation of said buffer. 5. The final buffer will be allocated and the data copied. This commit factors this common code out in a single function in cbs.c. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/cbs: add helper functions and macros to read and write signed valuesJames Almer2019-04-161-1/+19
| | | | | Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: James Almer <jamrial@gmail.com>
* lavc: Add coded bitstream read/write support for AV1Mark Thompson2018-09-261-0/+1
|
* lavc/cbs: Add JPEG supportMark Thompson2018-09-231-0/+1
|
* lavc: Add coded bitstream read/write support for VP9Mark Thompson2018-05-021-0/+1
|
* cbs: Add support for array subscripts in trace outputMark Thompson2018-05-021-4/+6
| | | | This makes the trace output for arrays significantly nicer.
* cbs_h264: Fix overflow in shiftsMark Thompson2018-03-181-0/+4
| | | | | | | | | The type of the result of a shift operation is unaffected by the type of the right operand, so some existing code overflows with undefined behaviour when the element length is 32. Add a helper macro to calculate the maximum value correctly and then use it everywhere this pattern appears. Found-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com>
* Merge commit 'ce5870a3a8f2b10668ee4f04c2ae0287f66f31b2'Mark Thompson2018-02-211-3/+0
|\ | | | | | | | | | | | | | | | | * commit 'ce5870a3a8f2b10668ee4f04c2ae0287f66f31b2': cbs: Refcount all the things! Some changes for bitstream API. Merged-by: Mark Thompson <sw@jkqxz.net>
| * cbs: Refcount all the things!Mark Thompson2018-02-201-3/+0
| | | | | | | | | | | | | | | | This makes it easier for users of the CBS API to get alloc/free right - all subelements use the buffer API so that it's clear how to free them. It also allows eliding some redundant copies: the packet -> fragment copy disappears after this change if the input packet is refcounted, and more codec-specific cases are now possible (but not included in this patch).
* | Merge commit '254e728d207c173a3714e6a01c9d68fcb3af8b73'Mark Thompson2018-02-211-3/+3
|\ \ | |/ | | | | | | | | | | | | | | * commit '254e728d207c173a3714e6a01c9d68fcb3af8b73': cbs: Minor comment fixes / cosmetics Mostly already present, one small fix. Merged-by: Mark Thompson <sw@jkqxz.net>
| * cbs: Minor comment fixes / cosmeticsMark Thompson2018-02-201-0/+3
| |
| * lavc: Add coded bitstream read/write support for MPEG-2Mark Thompson2017-08-201-0/+1
| | | | | | | | Also enable MPEG-2 support in the trace_headers filter.
| * lavc: Add coded bitstream read/write support for H.265Mark Thompson2017-08-121-0/+1
| |
| * lavc: Add coded bitstream read/write support for H.264Mark Thompson2017-08-121-0/+3
| |
| * lavc: Add coded bitstream read/write APIMark Thompson2017-08-121-0/+83
|
* lavc: Add coded bitstream read/write support for MPEG-2Mark Thompson2017-10-171-0/+1
| | | | | (cherry picked from commit 2bc9ba8d3c41f3a8e56484bd67b05040c7909a01) (cherry picked from commit a41b69b5eb950c10d8ede472bcc4e88ce4246db9)
* lavc: Add coded bitstream read/write support for H.265Mark Thompson2017-10-171-0/+1
| | | | | | (cherry picked from commit 867381b8b51fa21fa2b8f071f508f3d39cc9c1f0) (cherry picked from commit f763489364416bb6866adc4f4a96012dd2ca1bd0) (cherry picked from commit 067a9ddeb8feff1f724856f0054930c55219f76b)
* lavc: Add coded bitstream read/write support for H.264Mark Thompson2017-10-171-0/+3
| | | | | | (cherry picked from commit acf06f45441be24c5cbae0920579cd69427326a1) (cherry picked from commit 768eb9182e94a94bc2ef46f565a0dac7afef3b57) (cherry picked from commit e7f64191b27bcf37cbf7006606f0f439c6cdc24f)
* lavc: Add coded bitstream read/write APIMark Thompson2017-10-171-0/+86
(cherry picked from commit 18f1706f331bf5dd565774eae680508c8d3a97ad) (cherry picked from commit 44cde38c8acbef7d5250e6d1b52b1020871e093b)