diff mbox

[FFmpeg-devel] avcodec/dvdec: correctly set interlaced and tff

Message ID 20190911193048.34851-1-baptiste.coudurier@gmail.com
State Accepted
Commit 33203a08e0a26598cb103508327a1dc184b27bc6
Headers show

Commit Message

Baptiste Coudurier Sept. 11, 2019, 7:30 p.m. UTC
---
 libavcodec/dvdec.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Comments

Carl Eugen Hoyos Sept. 11, 2019, 7:38 p.m. UTC | #1
Am Mi., 11. Sept. 2019 um 21:31 Uhr schrieb Baptiste Coudurier
<baptiste.coudurier@gmail.com>:
>
> ---
>  libavcodec/dvdec.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
> index 4345cd9e29..cfa0fb9905 100644
> --- a/libavcodec/dvdec.c
> +++ b/libavcodec/dvdec.c
> @@ -592,12 +592,19 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, void *data,
>
>      if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
>          return ret;
> -    frame.f->interlaced_frame = 1;
> -    frame.f->top_field_first  = 0;
>
>      /* Determine the codec's field order from the packet */
>      if ( *vsc_pack == dv_video_control ) {
> -        frame.f->top_field_first = !(vsc_pack[3] & 0x40);
> +        if (avctx->height == 720) {
> +            frame.f->interlaced_frame = 0;
> +            frame.f->top_field_first = 0;
> +        } else if (avctx->height == 1080) {
> +            frame.f->interlaced_frame = 1;
> +            frame.f->top_field_first = (vsc_pack[3] & 0x40) == 0x40;
> +        } else {
> +            frame.f->interlaced_frame = (vsc_pack[3] & 0x10) == 0x10;
> +            frame.f->top_field_first = !(vsc_pack[3] & 0x40);

Does this fix ticket #5092?

Carl Eugen
Baptiste Coudurier Sept. 11, 2019, 8:29 p.m. UTC | #2
Hey Carl,

> On Sep 11, 2019, at 12:38 PM, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> 
> Am Mi., 11. Sept. 2019 um 21:31 Uhr schrieb Baptiste Coudurier
> <baptiste.coudurier@gmail.com>:
>> 
>> ---
>> libavcodec/dvdec.c | 13 ++++++++++---
>> 1 file changed, 10 insertions(+), 3 deletions(-)
>> 
>> diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
>> index 4345cd9e29..cfa0fb9905 100644
>> --- a/libavcodec/dvdec.c
>> +++ b/libavcodec/dvdec.c
>> @@ -592,12 +592,19 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, void *data,
>> 
>>     if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
>>         return ret;
>> -    frame.f->interlaced_frame = 1;
>> -    frame.f->top_field_first  = 0;
>> 
>>     /* Determine the codec's field order from the packet */
>>     if ( *vsc_pack == dv_video_control ) {
>> -        frame.f->top_field_first = !(vsc_pack[3] & 0x40);
>> +        if (avctx->height == 720) {
>> +            frame.f->interlaced_frame = 0;
>> +            frame.f->top_field_first = 0;
>> +        } else if (avctx->height == 1080) {
>> +            frame.f->interlaced_frame = 1;
>> +            frame.f->top_field_first = (vsc_pack[3] & 0x40) == 0x40;
>> +        } else {
>> +            frame.f->interlaced_frame = (vsc_pack[3] & 0x10) == 0x10;
>> +            frame.f->top_field_first = !(vsc_pack[3] & 0x40);
> 
> Does this fix ticket #5092?

Yes, I think it does

— 
Baptiste Coudurier
Baptiste Coudurier Nov. 2, 2019, 7 p.m. UTC | #3
On Wed, Sep 11, 2019 at 1:29 PM Baptiste Coudurier <
baptiste.coudurier@gmail.com> wrote:

> Hey Carl,
>
> On Sep 11, 2019, at 12:38 PM, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>
> Am Mi., 11. Sept. 2019 um 21:31 Uhr schrieb Baptiste Coudurier
> <baptiste.coudurier@gmail.com>:
>
>
> ---
> libavcodec/dvdec.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
> index 4345cd9e29..cfa0fb9905 100644
> --- a/libavcodec/dvdec.c
> +++ b/libavcodec/dvdec.c
> @@ -592,12 +592,19 @@ static int dvvideo_decode_frame(AVCodecContext
> *avctx, void *data,
>
>     if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
>         return ret;
> -    frame.f->interlaced_frame = 1;
> -    frame.f->top_field_first  = 0;
>
>     /* Determine the codec's field order from the packet */
>     if ( *vsc_pack == dv_video_control ) {
> -        frame.f->top_field_first = !(vsc_pack[3] & 0x40);
> +        if (avctx->height == 720) {
> +            frame.f->interlaced_frame = 0;
> +            frame.f->top_field_first = 0;
> +        } else if (avctx->height == 1080) {
> +            frame.f->interlaced_frame = 1;
> +            frame.f->top_field_first = (vsc_pack[3] & 0x40) == 0x40;
> +        } else {
> +            frame.f->interlaced_frame = (vsc_pack[3] & 0x10) == 0x10;
> +            frame.f->top_field_first = !(vsc_pack[3] & 0x40);
>
>
> Does this fix ticket #5092?
>
> Will apply
>
> —
> Baptiste Coudurier
>
Baptiste Coudurier Nov. 6, 2019, 4:50 p.m. UTC | #4
> On Nov 2, 2019, at 12:00 PM, Baptiste Coudurier <baptiste.coudurier@gmail.com> wrote:
> 
> On Wed, Sep 11, 2019 at 1:29 PM Baptiste Coudurier <baptiste.coudurier@gmail.com <mailto:baptiste.coudurier@gmail.com>> wrote:
> Hey Carl,
> 
>> On Sep 11, 2019, at 12:38 PM, Carl Eugen Hoyos <ceffmpeg@gmail.com <mailto:ceffmpeg@gmail.com>> wrote:
>> 
>> Am Mi., 11. Sept. 2019 um 21:31 Uhr schrieb Baptiste Coudurier
>> <baptiste.coudurier@gmail.com <mailto:baptiste.coudurier@gmail.com>>:
>>> 
>>> ---
>>> libavcodec/dvdec.c | 13 ++++++++++---
>>> 1 file changed, 10 insertions(+), 3 deletions(-)
>>> 
>>> diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
>>> index 4345cd9e29..cfa0fb9905 100644
>>> --- a/libavcodec/dvdec.c
>>> +++ b/libavcodec/dvdec.c
>>> @@ -592,12 +592,19 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, void *data,
>>> 
>>>     if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
>>>         return ret;
>>> -    frame.f->interlaced_frame = 1;
>>> -    frame.f->top_field_first  = 0;
>>> 
>>>     /* Determine the codec's field order from the packet */
>>>     if ( *vsc_pack == dv_video_control ) {
>>> -        frame.f->top_field_first = !(vsc_pack[3] & 0x40);
>>> +        if (avctx->height == 720) {
>>> +            frame.f->interlaced_frame = 0;
>>> +            frame.f->top_field_first = 0;
>>> +        } else if (avctx->height == 1080) {
>>> +            frame.f->interlaced_frame = 1;
>>> +            frame.f->top_field_first = (vsc_pack[3] & 0x40) == 0x40;
>>> +        } else {
>>> +            frame.f->interlaced_frame = (vsc_pack[3] & 0x10) == 0x10;
>>> +            frame.f->top_field_first = !(vsc_pack[3] & 0x40);
>> 
>> Does this fix ticket #5092?
> Will apply

Applied

— 
Baptiste
diff mbox

Patch

diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index 4345cd9e29..cfa0fb9905 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -592,12 +592,19 @@  static int dvvideo_decode_frame(AVCodecContext *avctx, void *data,
 
     if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
         return ret;
-    frame.f->interlaced_frame = 1;
-    frame.f->top_field_first  = 0;
 
     /* Determine the codec's field order from the packet */
     if ( *vsc_pack == dv_video_control ) {
-        frame.f->top_field_first = !(vsc_pack[3] & 0x40);
+        if (avctx->height == 720) {
+            frame.f->interlaced_frame = 0;
+            frame.f->top_field_first = 0;
+        } else if (avctx->height == 1080) {
+            frame.f->interlaced_frame = 1;
+            frame.f->top_field_first = (vsc_pack[3] & 0x40) == 0x40;
+        } else {
+            frame.f->interlaced_frame = (vsc_pack[3] & 0x10) == 0x10;
+            frame.f->top_field_first = !(vsc_pack[3] & 0x40);
+        }
     }
 
     s->buf = buf;