Re: [libav-devel] [PATCH] vc1: skip motion compensation when data for last picture is invalid

2018-01-29 Thread Luca Barbato

On 28/01/2018 17:46, Sean McGovern wrote:

Bug-Id: 1101
Cc: libav-sta...@libav.org
---
  libavcodec/vc1_mc.c | 5 +
  1 file changed, 5 insertions(+)

diff --git a/libavcodec/vc1_mc.c b/libavcodec/vc1_mc.c
index f4632d6..abdc9e3 100644
--- a/libavcodec/vc1_mc.c
+++ b/libavcodec/vc1_mc.c
@@ -689,6 +689,11 @@ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int
dir, int dir2, int avg)
  if (s->avctx->flags & AV_CODEC_FLAG_GRAY)
  return;

+if (s->last_picture.f 


This should be unnecessary.

&& !s->last_picture.f->data[1]) {

+  av_log(s->avctx, AV_LOG_ERROR, "Bad data in last picture frame.\n");
+  return;
+}
+
  for (i = 0; i < 4; i++) {
  int d = i < 2 ? dir: dir2;
  tx = s->mv[d][i][0];



Patch ok to me.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] vc1: skip motion compensation when data for last picture is invalid

2018-01-28 Thread Sean McGovern
Bug-Id: 1101
Cc: libav-sta...@libav.org
---
 libavcodec/vc1_mc.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/vc1_mc.c b/libavcodec/vc1_mc.c
index f4632d6..abdc9e3 100644
--- a/libavcodec/vc1_mc.c
+++ b/libavcodec/vc1_mc.c
@@ -689,6 +689,11 @@ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int
dir, int dir2, int avg)
 if (s->avctx->flags & AV_CODEC_FLAG_GRAY)
 return;

+if (s->last_picture.f && !s->last_picture.f->data[1]) {
+  av_log(s->avctx, AV_LOG_ERROR, "Bad data in last picture frame.\n");
+  return;
+}
+
 for (i = 0; i < 4; i++) {
 int d = i < 2 ? dir: dir2;
 tx = s->mv[d][i][0];
-- 
2.7.4
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] vc1: skip motion compensation when data for last picture is invalid

2018-01-28 Thread Sean McGovern
Hi Luca,

On Sun, Jan 28, 2018 at 4:59 AM, Luca Barbato  wrote:
> On 28/01/2018 03:24, Sean McGovern wrote:
>>
>> Bug-Id: 1101
>> Cc: libav-sta...@libav.org
>> ---
>>   libavcodec/vc1_mc.c | 5 +
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/libavcodec/vc1_mc.c b/libavcodec/vc1_mc.c
>> index f4632d6..fb5ca75 100644
>> --- a/libavcodec/vc1_mc.c
>> +++ b/libavcodec/vc1_mc.c
>> @@ -713,6 +713,11 @@ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int dir,
>> int dir2, int avg)
>>   lutuv  = v->next_lutuv;
>>   use_ic = v->next_use_ic;
>>   } else {
>> +if (!s->last_picture.f->data[1]) {
>> +  av_log(s->avctx, AV_LOG_WARNING, "Bad data in last picture
>> frame.\n");
>> +  return;
>> +}
>> +
>>   srcU = s->last_picture.f->data[1] + uvsrc_y * s->uvlinesize
>> + uvsrc_x;
>>   srcV = s->last_picture.f->data[2] + uvsrc_y * s->uvlinesize
>> + uvsrc_x;
>>   lutuv  = v->last_lutuv;
>>
>
> You should check for s->last_picture.f->data[0] outside the loop.

OK, will fix and post shortly.

>
> Look at ff_vc1_mc_4mv_chroma(), probably the same check does apply.

It's already effectively done there, see around line 595.

>
> lu
> ___
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] vc1: skip motion compensation when data for last picture is invalid

2018-01-28 Thread Luca Barbato

On 28/01/2018 03:24, Sean McGovern wrote:

Bug-Id: 1101
Cc: libav-sta...@libav.org
---
  libavcodec/vc1_mc.c | 5 +
  1 file changed, 5 insertions(+)

diff --git a/libavcodec/vc1_mc.c b/libavcodec/vc1_mc.c
index f4632d6..fb5ca75 100644
--- a/libavcodec/vc1_mc.c
+++ b/libavcodec/vc1_mc.c
@@ -713,6 +713,11 @@ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int dir, int 
dir2, int avg)
  lutuv  = v->next_lutuv;
  use_ic = v->next_use_ic;
  } else {
+if (!s->last_picture.f->data[1]) {
+  av_log(s->avctx, AV_LOG_WARNING, "Bad data in last picture 
frame.\n");
+  return;
+}
+
  srcU = s->last_picture.f->data[1] + uvsrc_y * s->uvlinesize + 
uvsrc_x;
  srcV = s->last_picture.f->data[2] + uvsrc_y * s->uvlinesize + 
uvsrc_x;
  lutuv  = v->last_lutuv;



You should check for s->last_picture.f->data[0] outside the loop.

Look at ff_vc1_mc_4mv_chroma(), probably the same check does apply.

lu
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] vc1: skip motion compensation when data for last picture is invalid

2018-01-27 Thread Sean McGovern
Bug-Id: 1101
Cc: libav-sta...@libav.org
---
 libavcodec/vc1_mc.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/vc1_mc.c b/libavcodec/vc1_mc.c
index f4632d6..fb5ca75 100644
--- a/libavcodec/vc1_mc.c
+++ b/libavcodec/vc1_mc.c
@@ -713,6 +713,11 @@ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int dir, int 
dir2, int avg)
 lutuv  = v->next_lutuv;
 use_ic = v->next_use_ic;
 } else {
+if (!s->last_picture.f->data[1]) {
+  av_log(s->avctx, AV_LOG_WARNING, "Bad data in last picture 
frame.\n");
+  return;
+}
+
 srcU = s->last_picture.f->data[1] + uvsrc_y * s->uvlinesize + 
uvsrc_x;
 srcV = s->last_picture.f->data[2] + uvsrc_y * s->uvlinesize + 
uvsrc_x;
 lutuv  = v->last_lutuv;
-- 
2.7.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel