diff mbox series

[FFmpeg-devel,1/2] avcodec/ac3dec: don't export Matrix Encoding side data when no such info is coded

Message ID 20230112222326.22018-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/2] avcodec/ac3dec: don't export Matrix Encoding side data when no such info is coded | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

James Almer Jan. 12, 2023, 10:23 p.m. UTC
No point inserting the side data to all frames just to say there's no
coded matrix encoding.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/ac3dec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Andreas Rheinhardt Jan. 13, 2023, 7:09 a.m. UTC | #1
James Almer:
> No point inserting the side data to all frames just to say there's no
> coded matrix encoding.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/ac3dec.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
> index 0b120e6140..7a84f3c85d 100644
> --- a/libavcodec/ac3dec.c
> +++ b/libavcodec/ac3dec.c
> @@ -1819,7 +1819,8 @@ skip:
>              break;
>          }
>      }
> -    if ((ret = ff_side_data_update_matrix_encoding(frame, matrix_encoding)) < 0)
> +    if (matrix_encoding != AV_MATRIX_ENCODING_NONE &&
> +        (ret = ff_side_data_update_matrix_encoding(frame, matrix_encoding)) < 0)
>          return ret;
>  
>      /* AVDownmixInfo */

If the preceding frame had a nontrivial matrix encoding, will users
think that the matrix encoding from the last frame still persists?

- Andreas
James Almer Jan. 13, 2023, 11:36 a.m. UTC | #2
On 1/13/2023 4:09 AM, Andreas Rheinhardt wrote:
> James Almer:
>> No point inserting the side data to all frames just to say there's no
>> coded matrix encoding.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>   libavcodec/ac3dec.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
>> index 0b120e6140..7a84f3c85d 100644
>> --- a/libavcodec/ac3dec.c
>> +++ b/libavcodec/ac3dec.c
>> @@ -1819,7 +1819,8 @@ skip:
>>               break;
>>           }
>>       }
>> -    if ((ret = ff_side_data_update_matrix_encoding(frame, matrix_encoding)) < 0)
>> +    if (matrix_encoding != AV_MATRIX_ENCODING_NONE &&
>> +        (ret = ff_side_data_update_matrix_encoding(frame, matrix_encoding)) < 0)
>>           return ret;
>>   
>>       /* AVDownmixInfo */
> 
> If the preceding frame had a nontrivial matrix encoding, will users
> think that the matrix encoding from the last frame still persists?

Yeah, i thought about it after i sent this when i was looking into ways 
to use this info in swr, so I'm withdrawing this patch (not the second).

> 
> - Andreas
> 
> _______________________________________________
> 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/ac3dec.c b/libavcodec/ac3dec.c
index 0b120e6140..7a84f3c85d 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1819,7 +1819,8 @@  skip:
             break;
         }
     }
-    if ((ret = ff_side_data_update_matrix_encoding(frame, matrix_encoding)) < 0)
+    if (matrix_encoding != AV_MATRIX_ENCODING_NONE &&
+        (ret = ff_side_data_update_matrix_encoding(frame, matrix_encoding)) < 0)
         return ret;
 
     /* AVDownmixInfo */