diff mbox series

[FFmpeg-devel,2/2] avcodec/libdav1d: export frame sample aspect ratio

Message ID 20200511142756.1868-2-jamrial@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,1/2] avcodec/libdav1d: try to set decoder context parameters during init()
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

James Almer May 11, 2020, 2:27 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/libdav1d.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Anton Khirnov May 18, 2020, 3:16 p.m. UTC | #1
Quoting James Almer (2020-05-11 16:27:56)
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/libdav1d.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
> index 72f06c550e..a265a487d8 100644
> --- a/libavcodec/libdav1d.c
> +++ b/libavcodec/libdav1d.c
> @@ -335,6 +335,12 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
>              goto fail;
>      }
>  
> +    av_reduce(&frame->sample_aspect_ratio.num,
> +              &frame->sample_aspect_ratio.den,
> +              frame->height * (int64_t)p->frame_hdr->render_width,
> +              frame->width  * (int64_t)p->frame_hdr->render_height,
> +              INT_MAX);

Wondered whether av_div_q might make it look better, but probably not by
much.

Patch looks ok.
James Almer May 18, 2020, 4:28 p.m. UTC | #2
On 5/18/2020 12:16 PM, Anton Khirnov wrote:
> Quoting James Almer (2020-05-11 16:27:56)
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  libavcodec/libdav1d.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
>> index 72f06c550e..a265a487d8 100644
>> --- a/libavcodec/libdav1d.c
>> +++ b/libavcodec/libdav1d.c
>> @@ -335,6 +335,12 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
>>              goto fail;
>>      }
>>  
>> +    av_reduce(&frame->sample_aspect_ratio.num,
>> +              &frame->sample_aspect_ratio.den,
>> +              frame->height * (int64_t)p->frame_hdr->render_width,
>> +              frame->width  * (int64_t)p->frame_hdr->render_height,
>> +              INT_MAX);
> 
> Wondered whether av_div_q might make it look better, but probably not by
> much.
> 
> Patch looks ok.

Pushed, thanks.
diff mbox series

Patch

diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 72f06c550e..a265a487d8 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -335,6 +335,12 @@  static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
             goto fail;
     }
 
+    av_reduce(&frame->sample_aspect_ratio.num,
+              &frame->sample_aspect_ratio.den,
+              frame->height * (int64_t)p->frame_hdr->render_width,
+              frame->width  * (int64_t)p->frame_hdr->render_height,
+              INT_MAX);
+
     if (p->m.user_data.data)
         memcpy(&frame->reordered_opaque, p->m.user_data.data, sizeof(frame->reordered_opaque));
     else