diff mbox series

[FFmpeg-devel] avcodec/cbs_av1: infer ref_order_hint when not coded in the bitstream

Message ID 20201031144006.1888-1-jamrial@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] avcodec/cbs_av1: infer ref_order_hint when not coded in the bitstream
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

James Almer Oct. 31, 2020, 2:40 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/cbs_av1_syntax_template.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

James Almer Nov. 10, 2020, 1:04 p.m. UTC | #1
On 10/31/2020 11:40 AM, James Almer wrote:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   libavcodec/cbs_av1_syntax_template.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c
> index f351b1de24..dc3d8d1048 100644
> --- a/libavcodec/cbs_av1_syntax_template.c
> +++ b/libavcodec/cbs_av1_syntax_template.c
> @@ -1490,13 +1490,19 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
>           fb(8, refresh_frame_flags);
>   
>       if (!frame_is_intra || current->refresh_frame_flags != all_frames) {
> -        if (current->error_resilient_mode && seq->enable_order_hint) {
> +        if (seq->enable_order_hint) {
>               for (i = 0; i < AV1_NUM_REF_FRAMES; i++) {
> -                fbs(order_hint_bits, ref_order_hint[i], 1, i);
> +                if (current->error_resilient_mode)
> +                    fbs(order_hint_bits, ref_order_hint[i], 1, i);
> +                else
> +                    infer(ref_order_hint[i], priv->ref[i].order_hint);
>                   if (current->ref_order_hint[i] != priv->ref[i].order_hint)
>                       priv->ref[i].valid = 0;
>               }
>           }
> +    } else if (seq->enable_order_hint) {
> +        for (i = 0; i < AV1_NUM_REF_FRAMES; i++)
> +            infer(ref_order_hint[i], priv->ref[i].order_hint);
>       }
>   
>       if (current->frame_type == AV1_FRAME_KEY ||

Ping.
Mark Thompson Nov. 10, 2020, 10:50 p.m. UTC | #2
On 31/10/2020 14:40, James Almer wrote:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   libavcodec/cbs_av1_syntax_template.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c
> index f351b1de24..dc3d8d1048 100644
> --- a/libavcodec/cbs_av1_syntax_template.c
> +++ b/libavcodec/cbs_av1_syntax_template.c
> @@ -1490,13 +1490,19 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
>           fb(8, refresh_frame_flags);
>   
>       if (!frame_is_intra || current->refresh_frame_flags != all_frames) {
> -        if (current->error_resilient_mode && seq->enable_order_hint) {
> +        if (seq->enable_order_hint) {
>               for (i = 0; i < AV1_NUM_REF_FRAMES; i++) {
> -                fbs(order_hint_bits, ref_order_hint[i], 1, i);
> +                if (current->error_resilient_mode)
> +                    fbs(order_hint_bits, ref_order_hint[i], 1, i);
> +                else
> +                    infer(ref_order_hint[i], priv->ref[i].order_hint);
>                   if (current->ref_order_hint[i] != priv->ref[i].order_hint)
>                       priv->ref[i].valid = 0;
>               }
>           }
> +    } else if (seq->enable_order_hint) {
> +        for (i = 0; i < AV1_NUM_REF_FRAMES; i++)
> +            infer(ref_order_hint[i], priv->ref[i].order_hint);

Is filling these on a key frame meaningful in any way?  The slots need not be valid at all, such as at the first frame in a stream.

>       }
>   
>       if (current->frame_type == AV1_FRAME_KEY ||
> 

Probably good anyway.

Thanks,

- Mark
James Almer Nov. 11, 2020, 1:04 p.m. UTC | #3
On 11/10/2020 7:50 PM, Mark Thompson wrote:
> On 31/10/2020 14:40, James Almer wrote:
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>   libavcodec/cbs_av1_syntax_template.c | 10 ++++++++--
>>   1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavcodec/cbs_av1_syntax_template.c 
>> b/libavcodec/cbs_av1_syntax_template.c
>> index f351b1de24..dc3d8d1048 100644
>> --- a/libavcodec/cbs_av1_syntax_template.c
>> +++ b/libavcodec/cbs_av1_syntax_template.c
>> @@ -1490,13 +1490,19 @@ static int 
>> FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
>>           fb(8, refresh_frame_flags);
>>       if (!frame_is_intra || current->refresh_frame_flags != 
>> all_frames) {
>> -        if (current->error_resilient_mode && seq->enable_order_hint) {
>> +        if (seq->enable_order_hint) {
>>               for (i = 0; i < AV1_NUM_REF_FRAMES; i++) {
>> -                fbs(order_hint_bits, ref_order_hint[i], 1, i);
>> +                if (current->error_resilient_mode)
>> +                    fbs(order_hint_bits, ref_order_hint[i], 1, i);
>> +                else
>> +                    infer(ref_order_hint[i], priv->ref[i].order_hint);
>>                   if (current->ref_order_hint[i] != 
>> priv->ref[i].order_hint)
>>                       priv->ref[i].valid = 0;
>>               }
>>           }
>> +    } else if (seq->enable_order_hint) {
>> +        for (i = 0; i < AV1_NUM_REF_FRAMES; i++)
>> +            infer(ref_order_hint[i], priv->ref[i].order_hint);
> 
> Is filling these on a key frame meaningful in any way?  The slots need 
> not be valid at all, such as at the first frame in a stream.
> 
>>       }
>>       if (current->frame_type == AV1_FRAME_KEY ||
>>
> 
> Probably good anyway.

Will change the above and push, thanks.

> 
> Thanks,
> 
> - Mark
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c
index f351b1de24..dc3d8d1048 100644
--- a/libavcodec/cbs_av1_syntax_template.c
+++ b/libavcodec/cbs_av1_syntax_template.c
@@ -1490,13 +1490,19 @@  static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
         fb(8, refresh_frame_flags);
 
     if (!frame_is_intra || current->refresh_frame_flags != all_frames) {
-        if (current->error_resilient_mode && seq->enable_order_hint) {
+        if (seq->enable_order_hint) {
             for (i = 0; i < AV1_NUM_REF_FRAMES; i++) {
-                fbs(order_hint_bits, ref_order_hint[i], 1, i);
+                if (current->error_resilient_mode)
+                    fbs(order_hint_bits, ref_order_hint[i], 1, i);
+                else
+                    infer(ref_order_hint[i], priv->ref[i].order_hint);
                 if (current->ref_order_hint[i] != priv->ref[i].order_hint)
                     priv->ref[i].valid = 0;
             }
         }
+    } else if (seq->enable_order_hint) {
+        for (i = 0; i < AV1_NUM_REF_FRAMES; i++)
+            infer(ref_order_hint[i], priv->ref[i].order_hint);
     }
 
     if (current->frame_type == AV1_FRAME_KEY ||