[FFmpeg-devel] [PATCH] libavcodec/hevcdec: detect non-conformant missing refs

Xiaolei Yu dreifachstein at gmail.com
Sat Apr 16 11:30:28 EEST 2022


On 4/5/22 17:10, Anton Khirnov wrote:
> Quoting Xiaolei Yu (2022-04-05 08:49:24)
>>
>> For cases which prefer rejecting broken bitstreams.
>> ---
>>  libavcodec/hevc_refs.c | 15 ++++++++++++---
>>  1 file changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
>> index fe18ca2b1d..7ea70e301b 100644
>> --- a/libavcodec/hevc_refs.c
>> +++ b/libavcodec/hevc_refs.cfind_ref_idx(
>> @@ -426,7 +426,7 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc)
>>
>>  /* add a reference with the given poc to the list and mark it as used in DPB */
>>  static int add_candidate_ref(HEVCContext *s, RefPicList *list,
>> -                             int poc, int ref_flag, uint8_t use_msb)
>> +                             int poc, int ref_flag, uint8_t use_msb, int maybe_missing)
>
> allow_missing would be clearer IMO
>

done

>>  {
>>      HEVCFrame *ref = find_ref_idx(s, poc, use_msb);
>>
>> @@ -434,6 +434,9 @@ static int add_candidate_ref(HEVCContext *s, RefPicList *list,
>>          return AVERROR_INVALIDDATA;
>>
>>      if (!ref) {
>> +        if ((s->avctx->err_recognition & AV_EF_COMPLIANT) && !maybe_missing)
>
> a log message would be nice, so one can easily tell where exactly the
> error comes from
>

Moved the log message from find_ref_idx to where the missing refs are to be generated.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x22AEF7EFBDCEFF03.asc
Type: application/pgp-keys
Size: 656 bytes
Desc: OpenPGP public key
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20220416/0d2cc777/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20220416/0d2cc777/attachment.sig>


More information about the ffmpeg-devel mailing list