On 11/02/18 20:13, wm4 wrote:
> On Sun, 11 Feb 2018 18:14:34 +0000
> Mark Thompson <s...@jkqxz.net> wrote:
> 
>> ---
>>  libavcodec/cbs.c                       | 168 +++++++++++++---
>>  libavcodec/cbs.h                       |  51 ++++-
>>  libavcodec/cbs_h264.h                  |   4 +
>>  libavcodec/cbs_h2645.c                 | 341 
>> +++++++++++++++------------------
>>  libavcodec/cbs_h265.h                  |   2 +
>>  libavcodec/cbs_internal.h              |   3 -
>>  libavcodec/cbs_mpeg2.c                 |  91 ++++-----
>>  libavcodec/cbs_mpeg2.h                 |   5 +
>>  libavcodec/cbs_mpeg2_syntax_template.c |   5 +-
>>  libavcodec/h264_metadata_bsf.c         |   6 +-
>>  libavcodec/h265_metadata_bsf.c         |   2 +-
>>  libavcodec/mpeg2_metadata_bsf.c        |   3 +-
>>  libavcodec/vaapi_encode_h264.c         |   2 +-
>>  libavcodec/vaapi_encode_h265.c         |   2 +-
>>  libavcodec/vaapi_encode_mpeg2.c        |   2 +-
>>  15 files changed, 408 insertions(+), 279 deletions(-)
>>
> 
> What does it do, and does it help with anything? I'm find it a bit
> suspicious, because our refcount stuff has a lot of overhead (multiple
> mallocs...).

The immediate intent is to make it easier to get alloc/free right - all 
subelements use the buffer API so that it's clear how to free them.  That is 
particularly helpful for stream-editing cases when you add or remove elements; 
VAAPI mostly doesn't mind because it points to the same fixed structures 
repeatedly.

It also elides some redundant copies, which are a much greater overhead than 
the additional small reference allocations.  The packet -> fragment copy is 
removed here if the input packet is refcounted.  The fragment -> unit copy can 
be elided for MPEG-2, but I haven't yet done that because the details are 
slightly subtle.  H.26[45] is trickier because it also undoes the emulation 
prevention, but there is a redundant copy NAL RBSP -> unit which should be 
removable with suitable changes to ff_h2645_packet_split() as well.

It also lets me move the slice_group_id element out of the PPS structure - 
having a >100k array there that was ~never used was kindof stupid.

- Mark
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to