[libav-devel] [PATCH] opt: Do not clip numerator / denominator arbitrarily in write_number

2014-02-18 Thread Mashiat Sarker Shakkhar
It is not clear why this has to be `1 << 24` and can't be INT_MAX.
---
 libavutil/opt.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index ede4a49..d50e631 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -76,7 +76,7 @@ static int write_number(void *obj, const AVOption *o, void 
*dst, double num, int
 case AV_OPT_TYPE_DOUBLE:*(double*)dst= num*intnum/den; break;
 case AV_OPT_TYPE_RATIONAL:
 if ((int)num == num) *(AVRational*)dst= (AVRational){num*intnum, den};
-else *(AVRational*)dst= av_d2q(num*intnum/den, 1<<24);
+else *(AVRational*)dst= av_d2q(num*intnum/den, 
INT_MAX);
 break;
 default:
 return AVERROR(EINVAL);
-- 
1.7.9.5

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


Re: [libav-devel] [PATCH] vc1: Use codec ID from AVCodecContext while parsing frame header

2012-10-12 Thread Mashiat Sarker Shakkhar

On 10/11/2012 1:23 PM, Kostya Shishkov wrote:

On Thu, Oct 11, 2012 at 01:13:56PM -0400, Mashiat Sarker Shakkhar wrote:

This fixes a segfault with samples that I have (both of them MPEG-TS). Looks 
like
avctx->codec is not being set during parsing.
---
  libavcodec/vc1.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index c7edc25..a8dd38a 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -576,7 +576,7 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* 
gb)

  if (v->finterpflag)
  v->interpfrm = get_bits1(gb);
-if (v->s.avctx->codec->id == AV_CODEC_ID_MSS2)
+if (v->s.avctx->codec_id == AV_CODEC_ID_MSS2)
  v->respic   =
  v->rangered =
  v->multires = get_bits(gb, 2) == 1;
--


probably OK


Someone's gotta push it. It's been OK'd and it's trivial.

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


[libav-devel] [PATCH] vc1: Use codec ID from AVCodecContext while parsing frame header

2012-10-11 Thread Mashiat Sarker Shakkhar
This fixes a segfault with samples that I have (both of them MPEG-TS). Looks 
like
avctx->codec is not being set during parsing.
---
 libavcodec/vc1.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index c7edc25..a8dd38a 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -576,7 +576,7 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* 
gb)
 
 if (v->finterpflag)
 v->interpfrm = get_bits1(gb);
-if (v->s.avctx->codec->id == AV_CODEC_ID_MSS2)
+if (v->s.avctx->codec_id == AV_CODEC_ID_MSS2)
 v->respic   =
 v->rangered =
 v->multires = get_bits(gb, 2) == 1;
-- 
1.7.9.5

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


Re: [libav-devel] [PATCH 2/5] vc1dec: Invoke edge emulation regardless of MV precision for 1-MV chroma

2012-10-09 Thread Mashiat Sarker Shakkhar

On 10/9/2012 7:37 PM, Ronald S. Bultje wrote:

Hi,

On Tue, Oct 9, 2012 at 1:38 PM, Mashiat Sarker Shakkhar
 wrote:

This is required due to the way VC-1 handles chroma pull-back which may end
up causing negative chroma MV for zero luma MV. Edge emulation needs to be
invoked in such cases.

This problem only affects chroma Y motion vector.
---
  libavcodec/vc1dec.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 42eb4a5..2683c86 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -430,7 +430,7 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
  if (v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
  || s->h_edge_pos < 22 || v_edge_pos < 22
  || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 16 - 
s->mspel * 3
-|| (unsigned)(src_y - s->mspel) > v_edge_pos- (my&3) - 16 - 
s->mspel * 3) {
+|| (unsigned)(src_y - 1)> v_edge_pos- (my&3) - 16 - 3) {


I'm slightly curious why this is only the case for the vertical
dimension, but not the horizontal. Is that intentional, or an
oversight?


This thread contains my earlier discussion on a rejected patch which 
tried to fix the same bug:


http://patches.libav.org/patch/26240/

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


[libav-devel] [PATCH 5/5] Double motion vector range for HPEL interlaced picture in proper place

2012-10-09 Thread Mashiat Sarker Shakkhar
The existing code is not in the right place and it should cover both
interlaced frame and field pictures.
---
 libavcodec/vc1.c|5 +
 libavcodec/vc1dec.c |4 
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index b04d570..c7edc25 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -1223,6 +1223,11 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, 
GetBitContext* gb)
 break;
 }
 
+if (v->fcm != PROGRESSIVE && !v->s.quarter_sample) {
+v->range_x <<= 1;
+v->range_y <<= 1;
+}
+
 /* AC Syntax */
 v->c_ac_table_index = decode012(gb);
 if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == 
AV_PICTURE_TYPE_BI) {
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 40164cc..6bfba68 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1573,10 +1573,6 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int 
dmv_x, int dmv_y,
 }
 }
 
-if (v->field_mode && !s->quarter_sample) {
-r_x <<= 1;
-r_y <<= 1;
-}
 if (v->field_mode && v->numref)
 r_y >>= 1;
 if (v->field_mode && v->cur_field_type && v->ref_field_type[dir] == 0)
-- 
1.7.9.5

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


[libav-devel] [PATCH 4/5] vc1dec: Set opposite to the correct value for 1REF field pictures

2012-10-09 Thread Mashiat Sarker Shakkhar
---
 libavcodec/vc1dec.c |   14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 491e200..40164cc 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1458,10 +1458,16 @@ static inline void vc1_pred_mv(VC1Context *v, int n, 
int dmv_x, int dmv_y,
 }
 
 if (v->field_mode) {
-if (num_samefield <= num_oppfield)
-opposite = 1 - pred_flag;
-else
-opposite = pred_flag;
+if (!v->numref)
+// REFFIELD determines if the last field or the second-last field 
is
+// to be used as reference
+opposite = 1 - v->reffield;
+else {
+if (num_samefield <= num_oppfield)
+opposite = 1 - pred_flag;
+else
+opposite = pred_flag;
+}
 } else
 opposite = 0;
 if (opposite) {
-- 
1.7.9.5

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


[libav-devel] [PATCH 3/5] vc1dec: Use correct spelling of "opposite"

2012-10-09 Thread Mashiat Sarker Shakkhar
---
 libavcodec/vc1dec.c |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 2683c86..491e200 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1350,7 +1350,7 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int 
dmv_x, int dmv_y,
 int px, py;
 int sum;
 int mixedmv_pic, num_samefield = 0, num_oppfield = 0;
-int opposit, a_f, b_f, c_f;
+int opposite, a_f, b_f, c_f;
 int16_t field_predA[2];
 int16_t field_predB[2];
 int16_t field_predC[2];
@@ -1459,12 +1459,12 @@ static inline void vc1_pred_mv(VC1Context *v, int n, 
int dmv_x, int dmv_y,
 
 if (v->field_mode) {
 if (num_samefield <= num_oppfield)
-opposit = 1 - pred_flag;
+opposite = 1 - pred_flag;
 else
-opposit = pred_flag;
+opposite = pred_flag;
 } else
-opposit = 0;
-if (opposit) {
+opposite = 0;
+if (opposite) {
 if (a_valid && !a_f) {
 field_predA[0] = scaleforopp(v, field_predA[0], 0, dir);
 field_predA[1] = scaleforopp(v, field_predA[1], 1, dir);
-- 
1.7.9.5

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


[libav-devel] [PATCH 2/5] vc1dec: Invoke edge emulation regardless of MV precision for 1-MV chroma

2012-10-09 Thread Mashiat Sarker Shakkhar
This is required due to the way VC-1 handles chroma pull-back which may end
up causing negative chroma MV for zero luma MV. Edge emulation needs to be
invoked in such cases.

This problem only affects chroma Y motion vector.
---
 libavcodec/vc1dec.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 42eb4a5..2683c86 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -430,7 +430,7 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
 if (v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
 || s->h_edge_pos < 22 || v_edge_pos < 22
 || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 16 - 
s->mspel * 3
-|| (unsigned)(src_y - s->mspel) > v_edge_pos- (my&3) - 16 - 
s->mspel * 3) {
+|| (unsigned)(src_y - 1)> v_edge_pos- (my&3) - 16 - 3) {
 uint8_t *uvbuf = s->edge_emu_buffer + 19 * s->linesize;
 
 srcY -= s->mspel * (1 + s->linesize);
-- 
1.7.9.5

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


[libav-devel] [PATCH 1/5] vc1dec: Set chroma reference field from REFFIELD for 1REF field pictures

2012-10-09 Thread Mashiat Sarker Shakkhar
Interlaced field pictures can have one or two reference pictures, signaled
by NUMREF syntax element. For single reference pictures, reference picture
is determined by REFFIELD syntax element.
---
 libavcodec/vc1dec.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index d410875..42eb4a5 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -794,6 +794,7 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir)
 /* calculate chroma MV vector from four luma MVs */
 if (!v->field_mode || (v->field_mode && !v->numref)) {
 valid_count = get_chroma_mv(mvx, mvy, intra, 0, &tx, &ty);
+chroma_ref_type = v->reffield;
 if (!valid_count) {
 s->current_picture.f.motion_val[1][s->block_index[0] + 
v->blocks_off][0] = 0;
 s->current_picture.f.motion_val[1][s->block_index[0] + 
v->blocks_off][1] = 0;
-- 
1.7.9.5

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


[libav-devel] Libav stickers for GSoC mentor summit

2012-09-30 Thread Mashiat Sarker Shakkhar

Hi guys

Since I might be the only one going to the GSoC mentor summit from 
Libav, I take the responsibility of getting some Libav stickers printed 
(time permitting). For those of you who don't know, at mentor summit 
they have this thing where all orgs exchange stickers; and I wouldn't 
want Libav to miss out.


So whoever has a good (preferably vector) soft-copy of our logo, please 
send it to me and I will try to get it printed. If you know a good place 
to get stickers printed in NYC, do recommend.


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


Re: [libav-devel] [PATCH 1/2] wmalosslessdec: increase WMALL_BLOCK_MAX_BITS to 14.

2012-09-29 Thread Mashiat Sarker Shakkhar

On 9/29/2012 3:13 AM, Anton Khirnov wrote:

---
  libavcodec/wmalosslessdec.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 56e9aad..8300b17 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -38,7 +38,7 @@
  #define MAX_ORDER 256

  #define WMALL_BLOCK_MIN_BITS6   ///< log2 of min 
block size
-#define WMALL_BLOCK_MAX_BITS   12   ///< log2 of max block 
size
+#define WMALL_BLOCK_MAX_BITS   14   ///< log2 of max block 
size
  #define WMALL_BLOCK_MAX_SIZE (1 << WMALL_BLOCK_MAX_BITS)///< maximum 
block size
  #define WMALL_BLOCK_SIZES(WMALL_BLOCK_MAX_BITS - WMALL_BLOCK_MIN_BITS + 1) 
///< possible block sizes


Why? (If I may ask.) That reason should be a part of the commit message.

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


Re: [libav-devel] [PATCH] riff: Add SVQ3 fourcc

2012-09-14 Thread Mashiat Sarker Shakkhar

On 9/14/2012 9:16 PM, Måns Rullgård wrote:

Derek Buitenhuis  writes:


On 14/09/2012 11:12 AM, Kostya Shishkov wrote:

probably OK, do you have working samples?


I do. I don't know if I am allowed to distribute it though.


We all know that's just newspeak for "I don't want you to see my porn
habits."


More like "I don't want everyone to know that I handle Chinese samples 
from time to time."

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


Re: [libav-devel] Optimization of decoders for MIPS.

2012-08-24 Thread Mashiat Sarker Shakkhar

On 8/24/2012 11:07 PM, Diego Biurrun wrote:

On Fri, Aug 24, 2012 at 04:55:25PM +, Babic, Nedeljko wrote:


We were asked (from our customers) to optimized some codecs from
FFmpeg and are in process of submitting patches to FFmpeg maintainers
(some of them are already integrated).


That will only help you in certain configurations as FFmpeg is not
used by all distributions, especially embedded ones, which you are
probably targetting...


Diego, Mans, Luca and others objecting to the patchset, please be 
reasonable.


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


Re: [libav-devel] [PATCH 1/4] vc1dec: Fix motion vector scaling for field pictures

2012-08-19 Thread Mashiat Sarker Shakkhar
Patch dropped for now. Some concerns have been raised by Kostya and 
Diego; I will try to address them when I have time.

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


Re: [libav-devel] [PATCH 4/4] vc1dec: Invoke edge emulation regardless of MV precision for 1-MV blocks

2012-08-19 Thread Mashiat Sarker Shakkhar

On 8/19/2012 12:07 AM, Kostya Shishkov wrote:

On Sat, Aug 18, 2012 at 11:25:54PM +0600, Mashiat Sarker Shakkhar wrote:

On 8/18/2012 11:13 PM, Kostya Shishkov wrote:
[...]

Maybe the same thing (chroma MV pullback) happens? Please investigate and
update the log message. "I just apply some magic and it works" sounds wrong in
commit.


It's not magic. We have already discussed this. Sometimes chroma MVs
require edge emulation while luma MVs don't. I don't know under what
exact circumstances it happens, but so far I have only seen HPEL
pictures trigger this issue. Can you elaborate what do you want me
to investigate here? Because I can see that the motion vectors (both
chroma and luma) are fine.


It hapened because luma MV=0,0, chroma MV was the same too but after pullback
it became -1,0. So luma does not need MC in this case but chroma does. With
bicubic interpolation that issue was masked (s->mspel = 1 triggered edge
emulation for such cases). So please check if it's similar (chroma needing
edge emu but luma not).


In short, yes. It's not similar, it's just more of the same. Let me try 
to explain with an example. The following log messages come directly 
from avconv output (in my dev branch):


[vc1 @ 0x439d0a0] mv_x = 26, mv_y = 2, f = 1
[vc1 @ 0x439d0a0] Bits may have been read. (0 bits)
[vc1 @ 0x439d0a0] * UVMX = 26, UVMY = 2
[vc1 @ 0x439d0a0] FDMV MV_X = 26, MV_Y = 0, UVMX = 13, UVMY = -1
[vc1 @ 0x439d0a0] setting ref to last picture ...
[vc1 @ 0x439d0a0] src_x = 1574, src_y = 0, uvsrc_x = 787, uvsrc_y = -1
[vc1 @ 0x439d0a0] selecting bottom field as source ...
==11303== Invalid read of size 8
==11303==at 0x84B4A9A: ??? (h264_chromamc.asm:658)
==11303==  Address 0x495d853 is 13 bytes before a block of size 40 free'd

The macroblock in question belongs to top field. Note that the motion 
vector points to bottom field (f == 1). Hence the chroma MV, calculated 
from luma, does the same. During motion compensation, both are 
"pulled-up" (not sure if that's the right phrase). Post-PullBk MVs are 
the ones on line 4 (FDMV ...).


I think it has something to do with the way chroma MVs are calculated 
from luma MVs with a strange rounding, i.e.


uvmx = (mx + ((mx & 3) == 3)) >> 1;
uvmy = (my + ((my & 3) == 3)) >> 1;

I for one would expect a proper rounding to look like:
uvmx = (mx + ((mx & 3) >= 2)) >> 1;

Point out if I am wrong.

On top of that, the only sample I have which triggers this situation is 
an HPEL sample (MVs are signaled with half-pel precision). All three of 
these factors probably added up to cause the above segfault.


It makes me feel that the change in horizontal condition may be 
superfluous. Only vertical may be enough. Let me know what you think.

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


[libav-devel] [PATCH 2/2] vc1dec: Set opposite to the correct value for 1REF field pictures

2012-08-18 Thread Mashiat Sarker Shakkhar
---
 libavcodec/vc1dec.c |   14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index a9043a5..58e106a 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1458,10 +1458,16 @@ static inline void vc1_pred_mv(VC1Context *v, int n, 
int dmv_x, int dmv_y,
 }
 
 if (v->field_mode) {
-if (num_samefield <= num_oppfield)
-opposite = 1 - pred_flag;
-else
-opposite = pred_flag;
+if (!v->numref)
+// REFFIELD determines if the last field or the second-last field 
is
+// to be used as reference
+opposite = 1 - v->reffield;
+else {
+if (num_samefield <= num_oppfield)
+opposite = 1 - pred_flag;
+else
+opposite = pred_flag;
+}
 } else
 opposite = 0;
 if (opposite) {
-- 
1.7.9.5

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


[libav-devel] [PATCH 1/2] vc1dec: Use correct spelling of "opposite"

2012-08-18 Thread Mashiat Sarker Shakkhar
---
 libavcodec/vc1dec.c |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 6951072..a9043a5 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1350,7 +1350,7 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int 
dmv_x, int dmv_y,
 int px, py;
 int sum;
 int mixedmv_pic, num_samefield = 0, num_oppfield = 0;
-int opposit, a_f, b_f, c_f;
+int opposite, a_f, b_f, c_f;
 int16_t field_predA[2];
 int16_t field_predB[2];
 int16_t field_predC[2];
@@ -1459,12 +1459,12 @@ static inline void vc1_pred_mv(VC1Context *v, int n, 
int dmv_x, int dmv_y,
 
 if (v->field_mode) {
 if (num_samefield <= num_oppfield)
-opposit = 1 - pred_flag;
+opposite = 1 - pred_flag;
 else
-opposit = pred_flag;
+opposite = pred_flag;
 } else
-opposit = 0;
-if (opposit) {
+opposite = 0;
+if (opposite) {
 if (a_valid && !a_f) {
 field_predA[0] = scaleforopp(v, field_predA[0], 0, dir);
 field_predA[1] = scaleforopp(v, field_predA[1], 1, dir);
-- 
1.7.9.5

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


Re: [libav-devel] [PATCH 4/4] vc1dec: Invoke edge emulation regardless of MV precision for 1-MV blocks

2012-08-18 Thread Mashiat Sarker Shakkhar

On 8/18/2012 11:13 PM, Kostya Shishkov wrote:
[...]

Maybe the same thing (chroma MV pullback) happens? Please investigate and
update the log message. "I just apply some magic and it works" sounds wrong in
commit.


It's not magic. We have already discussed this. Sometimes chroma MVs 
require edge emulation while luma MVs don't. I don't know under what 
exact circumstances it happens, but so far I have only seen HPEL 
pictures trigger this issue. Can you elaborate what do you want me to 
investigate here? Because I can see that the motion vectors (both chroma 
and luma) are fine.

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


Re: [libav-devel] [PATCH 1/4] vc1dec: Fix motion vector scaling for field pictures

2012-08-18 Thread Mashiat Sarker Shakkhar

On 8/18/2012 11:06 PM, Kostya Shishkov wrote:

On Sat, Aug 18, 2012 at 10:57:12PM +0600, Mashiat Sarker Shakkhar wrote:

Current scaling code is buggy and twisted. This patch re-implements it.
This fixes visible artifacts in a number of samples.

The code in scale_field_mv follows corresponding code from reference
decoder. I do not take credit for the code itself.


Too bad, one should have an idea what he's doing.


Agreed.

[...]

+frfd = get_bits(gb, 2);
+if (frfd == 3)
+frfd += get_unary(gb, 0, 16);
+if (frfd > 3)
+frfd = 3;


lolwut? Read an escape value and ignore it immediately?


Yes FRFD is clipped at 3. It is in the current code too, in case you did 
not notice. I don't know why they designed it this way.


[...]

in general - please redo till you understand what you're doing besides pasting
reference decoder pieces


It's a good advice; but technically speaking, what's wrong with pasting 
reference code? Is it license conflict or non-optimal code or missing 
copyright or something else?


If you insist on it, I might go and give it another try sometime later.

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


[libav-devel] [PATCH 4/4] vc1dec: Invoke edge emulation regardless of MV precision for 1-MV blocks

2012-08-18 Thread Mashiat Sarker Shakkhar
This is very close to 8379ea5e9f6bf3d50663ffb655ba5dd6a11652b4 and same
description applies. The issue probably warrants further investigation,
but for now this fix seems to work without breaking anything else.
---
 libavcodec/vc1dec.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 5f709ed..871c033 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -429,8 +429,8 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
 
 if (v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
 || s->h_edge_pos < 22 || v_edge_pos < 22
-|| (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 16 - 
s->mspel * 3
-|| (unsigned)(src_y - s->mspel) > v_edge_pos- (my&3) - 16 - 
s->mspel * 3) {
+|| (unsigned)(src_x - 1) > s->h_edge_pos - (mx&3) - 16 - 3
+|| (unsigned)(src_y - 1) > v_edge_pos- (my&3) - 16 - 3) {
 uint8_t *uvbuf = s->edge_emu_buffer + 19 * s->linesize;
 
 srcY -= s->mspel * (1 + s->linesize);
-- 
1.7.4

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


[libav-devel] [PATCH 3/4] vc1dec: Set chroma reference field from REFFIELD for 1REF field pictures

2012-08-18 Thread Mashiat Sarker Shakkhar
Interlaced field pictures can have one or two reference pictures, signaled
by NUMREF syntax element. For single reference pictures, reference picture
is determined by REFFIELD syntax element.
---
 libavcodec/vc1dec.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 3e73a1c..5f709ed 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -794,6 +794,7 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir)
 /* calculate chroma MV vector from four luma MVs */
 if (!v->field_mode || (v->field_mode && !v->numref)) {
 valid_count = get_chroma_mv(mvx, mvy, intra, 0, &tx, &ty);
+chroma_ref_type = v->reffield;
 if (!valid_count) {
 s->current_picture.f.motion_val[1][s->block_index[0] + 
v->blocks_off][0] = 0;
 s->current_picture.f.motion_val[1][s->block_index[0] + 
v->blocks_off][1] = 0;
-- 
1.7.4

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


[libav-devel] [PATCH 2/4] vc1dec: Set opposite to the correct value for 1REF field pictures

2012-08-18 Thread Mashiat Sarker Shakkhar
---
 libavcodec/vc1dec.c |   18 +++---
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 22ad325..3e73a1c 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1229,7 +1229,7 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int 
dmv_x, int dmv_y,
 int px, py;
 int sum;
 int mixedmv_pic, num_samefield = 0, num_oppfield = 0;
-int opposit, a_f, b_f, c_f;
+int opposite, a_f, b_f, c_f;
 int16_t field_predA[2];
 int16_t field_predB[2];
 int16_t field_predC[2];
@@ -1337,13 +1337,17 @@ static inline void vc1_pred_mv(VC1Context *v, int n, 
int dmv_x, int dmv_y,
 }
 
 if (v->field_mode) {
-if (num_samefield <= num_oppfield)
-opposit = 1 - pred_flag;
-else
-opposit = pred_flag;
+if (!v->numref)
+opposite = 1 - v->reffield;
+else {
+if (num_samefield <= num_oppfield)
+opposite = 1 - pred_flag;
+else
+opposite = pred_flag;
+}
 } else
-opposit = 0;
-if (opposit) {
+opposite = 0;
+if (opposite) {
 if (a_valid && !a_f)
 scale_field_mv(v, field_predA, 1, dir);
 if (b_valid && !b_f)
-- 
1.7.4

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


[libav-devel] [PATCH 1/4] vc1dec: Fix motion vector scaling for field pictures

2012-08-18 Thread Mashiat Sarker Shakkhar
Current scaling code is buggy and twisted. This patch re-implements it.
This fixes visible artifacts in a number of samples.

The code in scale_field_mv follows corresponding code from reference
decoder. I do not take credit for the code itself.
---
 libavcodec/vc1.c |   34 +--
 libavcodec/vc1.h |9 ++-
 libavcodec/vc1data.c |   55 ---
 libavcodec/vc1data.h |6 +-
 libavcodec/vc1dec.c  |  250 --
 5 files changed, 114 insertions(+), 240 deletions(-)

diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index 0e218af..37c9922 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -892,20 +892,27 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, 
GetBitContext* gb)
 if (v->interlace)
 v->uvsamp = get_bits1(gb);
 if (v->field_mode) {
+int brfd, frfd;
+VC1FieldMVScalingContext *scalectx = &v->scalectx;
 if (!v->refdist_flag)
-v->refdist = 0;
+scalectx->p_refdist = 0;
 else if ((v->s.pict_type != AV_PICTURE_TYPE_B) && (v->s.pict_type != 
AV_PICTURE_TYPE_BI)) {
-v->refdist = get_bits(gb, 2);
-if (v->refdist == 3)
-v->refdist += get_unary(gb, 0, 16);
+frfd = get_bits(gb, 2);
+if (frfd == 3)
+frfd += get_unary(gb, 0, 16);
+if (frfd > 3)
+frfd = 3;
+scalectx->p_refdist = frfd;
 }
 if ((v->s.pict_type == AV_PICTURE_TYPE_B) || (v->s.pict_type == 
AV_PICTURE_TYPE_BI)) {
 v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, 
VC1_BFRACTION_VLC_BITS, 1);
 v->bfraction   = 
ff_vc1_bfraction_lut[v->bfraction_lut_index];
-v->frfd = (v->bfraction * v->refdist) >> 8;
-v->brfd = v->refdist - v->frfd - 1;
-if (v->brfd < 0)
-v->brfd = 0;
+frfd = (v->bfraction * scalectx->p_refdist) >> 8;
+brfd = av_clip(scalectx->p_refdist - frfd - 1, 0, 3);
+if (frfd > 3)
+frfd = 3;
+scalectx->b_refdist[0] = frfd;
+scalectx->b_refdist[1] = brfd;
 }
 goto parse_common_info;
 }
@@ -988,6 +995,9 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, 
GetBitContext* gb)
 v->reffield  = get_bits1(gb);
 v->ref_field_type[0] = v->reffield ^ !v->cur_field_type;
 }
+v->scalectx.field_mv_scales_tab[0] =
+
vc1_field_mvpred_scales[v->second_field][v->scalectx.p_refdist];
+v->scalectx.field_mv_scales_tab[1] = NULL;
 }
 if (v->extended_mv)
 v->mvrange = get_unary(gb, 0, 3);
@@ -1182,6 +1192,14 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, 
GetBitContext* gb)
 v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[fourmvbptab];
 }
 v->numref = 1; // interlaced field B pictures are always 2-ref
+v->scalectx.field_mv_scales_tab[0] =
+
vc1_field_mvpred_scales[v->second_field][v->scalectx.b_refdist[0]];
+if (v->second_field)
+v->scalectx.field_mv_scales_tab[1] =
+vc1_field_mvpred_scales[0][v->scalectx.b_refdist[1]];
+else
+v->scalectx.field_mv_scales_tab[1] =
+vc1_field_mvpred_scales[2][v->scalectx.b_refdist[1]];
 } else {
 v->mv_mode  = get_bits1(gb) ? MV_PMODE_1MV : 
MV_PMODE_1MV_HPEL_BILIN;
 v->qs_last  = v->s.quarter_sample;
diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h
index 5806b80..da48218 100644
--- a/libavcodec/vc1.h
+++ b/libavcodec/vc1.h
@@ -174,6 +174,12 @@ enum FrameCodingMode {
 ILACE_FIELD ///<  in the bitstream is reported as 11b
 };
 
+typedef struct VC1FieldMVScalingContext {
+const uint16_t *field_mv_scales_tab[2];
+int p_refdist;
+int b_refdist[2];
+} VC1FieldMVScalingContext;
+
 /** The VC1 Context
  * @todo Change size wherever another size is more efficient
  * Many members are only used for Advanced Profile
@@ -182,6 +188,7 @@ typedef struct VC1Context{
 MpegEncContext s;
 IntraX8Context x8;
 VC1DSPContext vc1dsp;
+VC1FieldMVScalingContext scalectx;
 
 int bits;
 
@@ -357,7 +364,6 @@ typedef struct VC1Context{
 int field_mode; ///< 1 for interlaced field pictures
 int fptype;
 int second_field;
-int refdist;///< distance of the current picture from reference
 int numref; ///< number of past field pictures used as 
reference
 // 0 corresponds to 1 and 1 corresponds to 2 
references
 int reffield;   ///< if numref = 0 (1 reference) then reffield 
decides which
@@ -369,7 +375,6 @@ typedef struct VC1Context{
 int blocks_off, mb_off;
 int qs_last;///< if qpel has been used in the previous (tr.) 
picture

Re: [libav-devel] VDD and FOMS 2012

2012-08-04 Thread Mashiat Sarker Shakkhar

On 8/4/2012 11:58 PM, Diego Biurrun wrote:

So who else is going to attend the VideoLAN Dev Days?  I know that Luca,
Mans, Kostya and myself will be there.  Register and come to Paris :)


I know Ronald will be there. Derek should be there too. I will be there 
if I can get a visa.


I will attend FOMS too.

Shakkhar

[...]

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


[libav-devel] [PATCH 2/2] vc1dec: Remove separate scaling function for interlaced field MVs

2012-08-03 Thread Mashiat Sarker Shakkhar
The scaling process for obtaining direct MVs from co-located field MVs
are same for interlaced field and progressive pictures.
---
 libavcodec/vc1dec.c |   30 --
 1 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index fcb25db..cb15dee 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1977,20 +1977,6 @@ static av_always_inline int scale_mv(int value, int 
bfrac, int inv, int qs)
 #endif
 }
 
-static av_always_inline int scale_mv_intfi(int value, int bfrac, int inv,
-   int qs, int qs_last)
-{
-int n = bfrac;
-
-if (inv)
-n -= 256;
-n <<= !qs_last;
-if (!qs)
-return (value * n + 255) >> 9;
-else
-return (value * n + 128) >> 8;
-}
-
 /** Reconstruct motion vector for B-frame and do motion compensation
  */
 static inline void vc1_b_mc(VC1Context *v, int dmv_x[2], int dmv_y[2],
@@ -2244,14 +2230,14 @@ static inline void vc1_pred_b_mv_intfi(VC1Context *v, 
int n, int *dmv_x, int *dm
 if (v->bmvtype == BMV_TYPE_DIRECT) {
 int total_opp, k, f;
 if (s->next_picture.f.mb_type[mb_pos + v->mb_off] != MB_TYPE_INTRA) {
-s->mv[0][0][0] = 
scale_mv_intfi(s->next_picture.f.motion_val[1][s->block_index[0] + 
v->blocks_off][0],
-v->bfraction, 0, 
s->quarter_sample, v->qs_last);
-s->mv[0][0][1] = 
scale_mv_intfi(s->next_picture.f.motion_val[1][s->block_index[0] + 
v->blocks_off][1],
-v->bfraction, 0, 
s->quarter_sample, v->qs_last);
-s->mv[1][0][0] = 
scale_mv_intfi(s->next_picture.f.motion_val[1][s->block_index[0] + 
v->blocks_off][0],
-v->bfraction, 1, 
s->quarter_sample, v->qs_last);
-s->mv[1][0][1] = 
scale_mv_intfi(s->next_picture.f.motion_val[1][s->block_index[0] + 
v->blocks_off][1],
-v->bfraction, 1, 
s->quarter_sample, v->qs_last);
+s->mv[0][0][0] = 
scale_mv(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0],
+  v->bfraction, 0, s->quarter_sample);
+s->mv[0][0][1] = 
scale_mv(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1],
+  v->bfraction, 0, s->quarter_sample);
+s->mv[1][0][0] = 
scale_mv(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0],
+  v->bfraction, 1, s->quarter_sample);
+s->mv[1][0][1] = 
scale_mv(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1],
+  v->bfraction, 1, s->quarter_sample);
 
 total_opp = v->mv_f_next[0][s->block_index[0] + v->blocks_off]
   + v->mv_f_next[0][s->block_index[1] + v->blocks_off]
-- 
1.7.4

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


[libav-devel] [PATCH 1/2] vc1dec: Invoke edge_emulation regardless of MV precision

2012-08-03 Thread Mashiat Sarker Shakkhar
In VC-1 interlaced field pictures, chroma motion vectors can extend beyond
picture boundary even if luma vectors are bounded. The problem shows up
only for hpel interpolated MVs, and may be due to the way motion vectors
are scaled / cropped.

Thanks to Konstantin Shishkov for suggesting the fix. This fixes
long-known segfaults in MC-VC1.ts from videolan streams archive.
---
 libavcodec/vc1dec.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index e36cc0d..fcb25db 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1880,8 +1880,8 @@ static void vc1_interp_mc(VC1Context *v)
 }
 
 if (v->rangeredfrm || s->h_edge_pos < 22 || v_edge_pos < 22
-|| (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx & 3) - 16 - 
s->mspel * 3
-|| (unsigned)(src_y - s->mspel) > v_edge_pos- (my & 3) - 16 - 
s->mspel * 3) {
+|| (unsigned)(src_x - 1) > s->h_edge_pos - (mx & 3) - 16 - 3
+|| (unsigned)(src_y - 1) > v_edge_pos- (my & 3) - 16 - 3) {
 uint8_t *uvbuf = s->edge_emu_buffer + 19 * s->linesize;
 
 srcY -= s->mspel * (1 + s->linesize);
-- 
1.7.4

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


Re: [libav-devel] [PATCH 1/2] vc1dec: Invoke edge_emulation regardless of MV precision

2012-08-03 Thread Mashiat Sarker Shakkhar

On 8/3/2012 8:04 PM, Kostya Shishkov wrote:
[...]

  if (v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
  || s->h_edge_pos < 22 || v_edge_pos < 22
-|| (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 16 - 
s->mspel * 3
-|| (unsigned)(src_y - s->mspel) > v_edge_pos- (my&3) - 16 - 
s->mspel * 3) {
+|| (unsigned)(src_x - 1) > s->h_edge_pos - (mx&3) - 16 - s->mspel * 3
+|| (unsigned)(src_y - 1) > v_edge_pos- (my&3) - 16 - s->mspel * 3) 
{


Is that really needed in this function?


Probably not. Will revise and resend.

[...]

  if (v->rangeredfrm || s->h_edge_pos < 22 || v_edge_pos < 22
-|| (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx & 3) - 16 - 
s->mspel * 3
-|| (unsigned)(src_y - s->mspel) > v_edge_pos- (my & 3) - 16 - 
s->mspel * 3) {
+|| (unsigned)(src_x - 1) > s->h_edge_pos - (mx & 3) - 16 - s->mspel * 3
+|| (unsigned)(src_y - 1) > v_edge_pos- (my & 3) - 16 - s->mspel * 
3) {


I'd replace s->mspel in this condition with 1.


Will do.

Regards
Shakkhar

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


[libav-devel] [PATCH 2/2] vc1dec: Remove separate scaling function for interlaced field MVs

2012-08-03 Thread Mashiat Sarker Shakkhar
The scaling process for obtaining direct MVs from co-located field MVs
are same for interlaced field and progressive pictures.
---
 libavcodec/vc1dec.c |   30 --
 1 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 05cd0ea..07b03df 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1977,20 +1977,6 @@ static av_always_inline int scale_mv(int value, int 
bfrac, int inv, int qs)
 #endif
 }
 
-static av_always_inline int scale_mv_intfi(int value, int bfrac, int inv,
-   int qs, int qs_last)
-{
-int n = bfrac;
-
-if (inv)
-n -= 256;
-n <<= !qs_last;
-if (!qs)
-return (value * n + 255) >> 9;
-else
-return (value * n + 128) >> 8;
-}
-
 /** Reconstruct motion vector for B-frame and do motion compensation
  */
 static inline void vc1_b_mc(VC1Context *v, int dmv_x[2], int dmv_y[2],
@@ -2244,14 +2230,14 @@ static inline void vc1_pred_b_mv_intfi(VC1Context *v, 
int n, int *dmv_x, int *dm
 if (v->bmvtype == BMV_TYPE_DIRECT) {
 int total_opp, k, f;
 if (s->next_picture.f.mb_type[mb_pos + v->mb_off] != MB_TYPE_INTRA) {
-s->mv[0][0][0] = 
scale_mv_intfi(s->next_picture.f.motion_val[1][s->block_index[0] + 
v->blocks_off][0],
-v->bfraction, 0, 
s->quarter_sample, v->qs_last);
-s->mv[0][0][1] = 
scale_mv_intfi(s->next_picture.f.motion_val[1][s->block_index[0] + 
v->blocks_off][1],
-v->bfraction, 0, 
s->quarter_sample, v->qs_last);
-s->mv[1][0][0] = 
scale_mv_intfi(s->next_picture.f.motion_val[1][s->block_index[0] + 
v->blocks_off][0],
-v->bfraction, 1, 
s->quarter_sample, v->qs_last);
-s->mv[1][0][1] = 
scale_mv_intfi(s->next_picture.f.motion_val[1][s->block_index[0] + 
v->blocks_off][1],
-v->bfraction, 1, 
s->quarter_sample, v->qs_last);
+s->mv[0][0][0] = 
scale_mv(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0],
+v->bfraction, 0, 
s->quarter_sample);
+s->mv[0][0][1] = 
scale_mv(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1],
+v->bfraction, 0, 
s->quarter_sample);
+s->mv[1][0][0] = 
scale_mv(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0],
+v->bfraction, 1, 
s->quarter_sample);
+s->mv[1][0][1] = 
scale_mv(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1],
+v->bfraction, 1, 
s->quarter_sample);
 
 total_opp = v->mv_f_next[0][s->block_index[0] + v->blocks_off]
   + v->mv_f_next[0][s->block_index[1] + v->blocks_off]
-- 
1.7.4

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


[libav-devel] [PATCH 1/2] vc1dec: Invoke edge_emulation regardless of MV precision

2012-08-03 Thread Mashiat Sarker Shakkhar
In VC-1 interlaced field pictures, chroma motion vectors can extend beyond
picture boundary even if luma vectors are bounded. The problem shows up
only for hpel MVs, and may be due to the way motion vectors are scaled /
cropped.

Thanks to Konstantin Shishkov for suggesting the fix. This fixes
long-known segfaults in MC-VC1.ts from videolan streams archive.
---
 libavcodec/vc1dec.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index e36cc0d..05cd0ea 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -429,8 +429,8 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
 
 if (v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
 || s->h_edge_pos < 22 || v_edge_pos < 22
-|| (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 16 - 
s->mspel * 3
-|| (unsigned)(src_y - s->mspel) > v_edge_pos- (my&3) - 16 - 
s->mspel * 3) {
+|| (unsigned)(src_x - 1) > s->h_edge_pos - (mx&3) - 16 - s->mspel * 3
+|| (unsigned)(src_y - 1) > v_edge_pos- (my&3) - 16 - s->mspel * 3) 
{
 uint8_t *uvbuf = s->edge_emu_buffer + 19 * s->linesize;
 
 srcY -= s->mspel * (1 + s->linesize);
@@ -663,8 +663,8 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir)
 src_y--;
 if (v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
 || s->h_edge_pos < 13 || v_edge_pos < 23
-|| (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx & 3) - 8 - 
s->mspel * 2
-|| (unsigned)(src_y - (s->mspel << fieldmv)) > v_edge_pos - (my & 3) - 
((8 + s->mspel * 2) << fieldmv)) {
+|| (unsigned)(src_x - 1) > s->h_edge_pos - (mx & 3) - 8 - s->mspel * 2
+|| (unsigned)(src_y - 2) > v_edge_pos - (my & 3) - ((8 + s->mspel * 2) 
<< fieldmv)) {
 srcY -= s->mspel * (1 + (s->linesize << fieldmv));
 /* check emulate edge stride and offset */
 s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize,
@@ -1880,8 +1880,8 @@ static void vc1_interp_mc(VC1Context *v)
 }
 
 if (v->rangeredfrm || s->h_edge_pos < 22 || v_edge_pos < 22
-|| (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx & 3) - 16 - 
s->mspel * 3
-|| (unsigned)(src_y - s->mspel) > v_edge_pos- (my & 3) - 16 - 
s->mspel * 3) {
+|| (unsigned)(src_x - 1) > s->h_edge_pos - (mx & 3) - 16 - s->mspel * 3
+|| (unsigned)(src_y - 1) > v_edge_pos- (my & 3) - 16 - s->mspel * 
3) {
 uint8_t *uvbuf = s->edge_emu_buffer + 19 * s->linesize;
 
 srcY -= s->mspel * (1 + s->linesize);
-- 
1.7.4

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


Re: [libav-devel] [RFC] doxy for internal API

2012-08-01 Thread Mashiat Sarker Shakkhar

On 8/1/2012 5:48 PM, an...@khirnov.net wrote:
[...]

If there indeed are people who read generated doxy for non-public API,


s/ for non-public API// ;P


I'd like them to speak up and prove their existence.


Speaking as a user, I just open the header file and read the relevant 
part. (Also from time-to-time I troll Anton into answering my questions 
about API, but that is not advisable ;)


Just my 1.63208 BDT.

-Shakkhar

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


[libav-devel] [PATCH] vc1dec: Override invalid macroblock quantizer

2012-07-28 Thread Mashiat Sarker Shakkhar
From: Michael Niedermayer 

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1dec.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index fd515c7..c6cbfc1 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1048,6 +1048,11 @@ static void vc1_mc_4mv_chroma4(VC1Context *v)
 mquant = v->altpq; \
 if ((edges&8) && s->mb_y == (s->mb_height - 1))\
 mquant = v->altpq; \
+if (!mquant || mquant > 31) {  \
+av_log(v->s.avctx, AV_LOG_ERROR,   \
+   "Overriding invalid mquant %d\n", mquant);  \
+mquant = 1;\
+}  \
 }
 
 /**
-- 
1.7.9.5

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


[libav-devel] [PATCH] vc1dec: Override invalid macroblock quantizer

2012-07-28 Thread Mashiat Sarker Shakkhar
From: Michael Niedermayer 

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1dec.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index f49fff8..0c031b7 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1048,6 +1048,11 @@ static void vc1_mc_4mv_chroma4(VC1Context *v)
 mquant = v->altpq; \
 if ((edges&8) && s->mb_y == (s->mb_height - 1))\
 mquant = v->altpq; \
+if (!mquant || mquant > 31) {  \
+av_log(v->s.avctx, AV_LOG_ERROR, "Overriding " \
+   invalid mquant %d\n", mquant);  \
+mquant = 1;\
+}  \
 }
 
 /**
-- 
1.7.9.5

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


[libav-devel] [PATCH 4/4] vc1dec: check that coded slice positions and interlacing match.

2012-07-28 Thread Mashiat Sarker Shakkhar
From: Michael Niedermayer 

This fixes out of array writes

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1dec.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 0c031b7..0027b49 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -5574,6 +5574,12 @@ static int vc1_decode_frame(AVCodecContext *avctx, void 
*data,
 mb_height = s->mb_height >> v->field_mode;
 for (i = 0; i <= n_slices; i++) {
 if (i > 0 &&  slices[i - 1].mby_start >= mb_height) {
+if (v->field_mode <= 0) {
+av_log(v->s.avctx, AV_LOG_ERROR, "Slice %d starts beyond "
+   "picture boundary (%d >= %d)\n", i,
+   slices[i - 1].mby_start, mb_height);
+continue;
+}
 v->second_field = 1;
 v->blocks_off   = s->mb_width  * s->mb_height << 1;
 v->mb_off   = s->mb_stride * s->mb_height >> 1;
-- 
1.7.9.5

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


[libav-devel] [PATCH 3/4] vc1dec: Override invalid macroblock quantizer

2012-07-28 Thread Mashiat Sarker Shakkhar
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1dec.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index f49fff8..0c031b7 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1048,6 +1048,11 @@ static void vc1_mc_4mv_chroma4(VC1Context *v)
 mquant = v->altpq; \
 if ((edges&8) && s->mb_y == (s->mb_height - 1))\
 mquant = v->altpq; \
+if (!mquant || mquant > 31) {  \
+av_log(v->s.avctx, AV_LOG_ERROR, "Overriding " \
+   invalid mquant %d\n", mquant);  \
+mquant = 1;\
+}  \
 }
 
 /**
-- 
1.7.9.5

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


[libav-devel] [PATCH 2/4] vc1dec: Do not ignore ff_vc1_parse_frame_header_adv return value

2012-07-28 Thread Mashiat Sarker Shakkhar
From: Michael Niedermayer 

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1dec.c |   14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 51124cf..f49fff8 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -5579,11 +5579,17 @@ static int vc1_decode_frame(AVCodecContext *avctx, void 
*data,
 }
 if (i) {
 v->pic_header_flag = 0;
-if (v->field_mode && i == n_slices1 + 2)
-ff_vc1_parse_frame_header_adv(v, &s->gb);
-else if (get_bits1(&s->gb)) {
+if (v->field_mode && i == n_slices1 + 2) {
+if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) {
+av_log(v->s.avctx, AV_LOG_ERROR, "Field header 
damaged\n");
+continue;
+}
+} else if (get_bits1(&s->gb)) {
 v->pic_header_flag = 1;
-ff_vc1_parse_frame_header_adv(v, &s->gb);
+if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) {
+av_log(v->s.avctx, AV_LOG_ERROR, "Slice header 
damaged\n");
+continue;
+}
 }
 }
 s->start_mb_y = (i == 0) ? 0 : FFMAX(0, slices[i-1].mby_start % 
mb_height);
-- 
1.7.9.5

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


[libav-devel] [PATCH 1/4] vc1: avoid reading beyond the last line in vc1_draw_sprites()

2012-07-28 Thread Mashiat Sarker Shakkhar
From: Michael Niedermayer 

Fixes overread

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1dec.c |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 51124cf..3feb312 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -4938,15 +4938,17 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* 
sd)
 int  iline  = s->current_picture.f.linesize[plane];
 int  ycoord = yoff[sprite] + yadv[sprite] * row;
 int  yline  = ycoord >> 16;
+int  next_line;
 ysub[sprite] = ycoord & 0x;
 if (sprite) {
 iplane = s->last_picture.f.data[plane];
 iline  = s->last_picture.f.linesize[plane];
 }
+next_line = FFMIN(yline + 1, (v->sprite_height >> !!plane) - 
1) * iline;
 if (!(xoff[sprite] & 0x) && xadv[sprite] == 1 << 16) {
 src_h[sprite][0] = iplane + (xoff[sprite] >> 16) +  
yline  * iline;
 if (ysub[sprite])
-src_h[sprite][1] = iplane + (xoff[sprite] >> 16) + 
(yline + 1) * iline;
+src_h[sprite][1] = iplane + (xoff[sprite] >> 16) + 
next_line;
 } else {
 if (sr_cache[sprite][0] != yline) {
 if (sr_cache[sprite][1] == yline) {
@@ -4958,7 +4960,9 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* 
sd)
 }
 }
 if (ysub[sprite] && sr_cache[sprite][1] != yline + 1) {
-v->vc1dsp.sprite_h(v->sr_rows[sprite][1], iplane + 
(yline + 1) * iline, xoff[sprite], xadv[sprite], width);
+v->vc1dsp.sprite_h(v->sr_rows[sprite][1],
+   iplane + next_line, xoff[sprite],
+   xadv[sprite], width);
 sr_cache[sprite][1] = yline + 1;
 }
 src_h[sprite][0] = v->sr_rows[sprite][0];
-- 
1.7.4

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


Re: [libav-devel] [PATCH 3/6] vc1dec: Sanity-check macroblock quantizer

2012-07-27 Thread Mashiat Sarker Shakkhar

On 7/28/2012 1:15 AM, Luca Barbato wrote:

On 07/27/2012 02:49 PM, Mashiat Sarker Shakkhar wrote:

From: Michael Niedermayer 

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
  libavcodec/vc1dec.c |3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index ac5bfe5..e34e8d2 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1048,6 +1048,9 @@ static void vc1_mc_4mv_chroma4(VC1Context *v)
  mquant = v->altpq; \
  if ((edges&8) && s->mb_y == (s->mb_height - 1))\
  mquant = v->altpq; \
+if (!mquant || mquant > 31) {  \
+av_log(v->s.avctx, AV_LOG_ERROR, "invalid mquant %d\n", mquant);   
\
+mquant = 1; \
  }


Why setting it to 1 and not erroring out?


I think erroring out here will be over-protective. Just my opinion.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/4] vc1: avoid reading beyond the last line in vc1_draw_sprites()

2012-07-27 Thread Mashiat Sarker Shakkhar

On 7/27/2012 9:23 PM, Derek Buitenhuis wrote:

On 27/07/2012 11:10 AM, Mashiat Sarker Shakkhar wrote:

Fixes overread

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
  libavcodec/vc1dec.c |8 ++--
  1 files changed, 6 insertions(+), 2 deletions(-)


Shouldn't some (or most?) of these be "From:" Michael?


Really sorry for the author name f***-up. I will revise it.

Regards
Shakkhar

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


[libav-devel] [PATCH 4/4] vc1dec: check that coded slice positions and interlacing match.

2012-07-27 Thread Mashiat Sarker Shakkhar
This fixes out of array writes

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1dec.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 5b0fe46..851485c 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -5577,6 +5577,10 @@ static int vc1_decode_frame(AVCodecContext *avctx, void 
*data,
 mb_height = s->mb_height >> v->field_mode;
 for (i = 0; i <= n_slices; i++) {
 if (i > 0 &&  slices[i - 1].mby_start >= mb_height) {
+if (v->field_mode <= 0) {
+av_log(v->s.avctx, AV_LOG_ERROR, "invalid end_mb_y %d\n", 
slices[i - 1].mby_start);
+continue;
+}
 v->second_field = 1;
 v->blocks_off   = s->mb_width  * s->mb_height << 1;
 v->mb_off   = s->mb_stride * s->mb_height >> 1;
-- 
1.7.4

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


[libav-devel] [PATCH 3/4] vc1dec: Sanity-check macroblock quantizer

2012-07-27 Thread Mashiat Sarker Shakkhar
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1dec.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 2ff1315..5b0fe46 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1048,6 +1048,10 @@ static void vc1_mc_4mv_chroma4(VC1Context *v)
 mquant = v->altpq; \
 if ((edges&8) && s->mb_y == (s->mb_height - 1))\
 mquant = v->altpq; \
+if (!mquant || mquant > 31) {  \
+av_log(v->s.avctx, AV_LOG_ERROR, "invalid mquant %d\n", mquant);   
\
+mquant = 1;\
+}  \
 }
 
 /**
-- 
1.7.4

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


[libav-devel] [PATCH 2/4] vc1dec: Do not ignore ff_vc1_parse_frame_header_adv return value

2012-07-27 Thread Mashiat Sarker Shakkhar
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1dec.c |   14 ++
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 3feb312..2ff1315 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -5583,11 +5583,17 @@ static int vc1_decode_frame(AVCodecContext *avctx, void 
*data,
 }
 if (i) {
 v->pic_header_flag = 0;
-if (v->field_mode && i == n_slices1 + 2)
-ff_vc1_parse_frame_header_adv(v, &s->gb);
-else if (get_bits1(&s->gb)) {
+if (v->field_mode && i == n_slices1 + 2) {
+if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) {
+av_log(v->s.avctx, AV_LOG_ERROR, "slice header 
damaged\n");
+continue;
+}
+} else if (get_bits1(&s->gb)) {
 v->pic_header_flag = 1;
-ff_vc1_parse_frame_header_adv(v, &s->gb);
+if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) {
+av_log(v->s.avctx, AV_LOG_ERROR, "slice header 
damaged\n");
+continue;
+}
 }
 }
 s->start_mb_y = (i == 0) ? 0 : FFMAX(0, slices[i-1].mby_start % 
mb_height);
-- 
1.7.4

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


[libav-devel] [PATCH 1/4] vc1: avoid reading beyond the last line in vc1_draw_sprites()

2012-07-27 Thread Mashiat Sarker Shakkhar
Fixes overread

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1dec.c |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 51124cf..3feb312 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -4938,15 +4938,17 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* 
sd)
 int  iline  = s->current_picture.f.linesize[plane];
 int  ycoord = yoff[sprite] + yadv[sprite] * row;
 int  yline  = ycoord >> 16;
+int  next_line;
 ysub[sprite] = ycoord & 0x;
 if (sprite) {
 iplane = s->last_picture.f.data[plane];
 iline  = s->last_picture.f.linesize[plane];
 }
+next_line = FFMIN(yline + 1, (v->sprite_height >> !!plane) - 
1) * iline;
 if (!(xoff[sprite] & 0x) && xadv[sprite] == 1 << 16) {
 src_h[sprite][0] = iplane + (xoff[sprite] >> 16) +  
yline  * iline;
 if (ysub[sprite])
-src_h[sprite][1] = iplane + (xoff[sprite] >> 16) + 
(yline + 1) * iline;
+src_h[sprite][1] = iplane + (xoff[sprite] >> 16) + 
next_line;
 } else {
 if (sr_cache[sprite][0] != yline) {
 if (sr_cache[sprite][1] == yline) {
@@ -4958,7 +4960,9 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* 
sd)
 }
 }
 if (ysub[sprite] && sr_cache[sprite][1] != yline + 1) {
-v->vc1dsp.sprite_h(v->sr_rows[sprite][1], iplane + 
(yline + 1) * iline, xoff[sprite], xadv[sprite], width);
+v->vc1dsp.sprite_h(v->sr_rows[sprite][1],
+   iplane + next_line, xoff[sprite],
+   xadv[sprite], width);
 sr_cache[sprite][1] = yline + 1;
 }
 src_h[sprite][0] = v->sr_rows[sprite][0];
-- 
1.7.4

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


Re: [libav-devel] [PATCH 4/6] vc1dec: check end_mb_y / start_mb_y validity

2012-07-27 Thread Mashiat Sarker Shakkhar

On 7/27/2012 7:01 PM, Kostya Shishkov wrote:

On Fri, Jul 27, 2012 at 06:49:42PM +0600, Mashiat Sarker Shakkhar wrote:

From: Michael Niedermayer 

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
  libavcodec/vc1dec.c |4 
  1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index e34e8d2..c63ccf1 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -5600,6 +5600,10 @@ static int vc1_decode_frame(AVCodecContext *avctx, void 
*data,
  s->end_mb_y = (i == n_slices ) ? mb_height : 
FFMIN(mb_height, slices[i].mby_start % mb_height);
  else
  s->end_mb_y = (i <= n_slices1 + 1) ? mb_height : 
FFMIN(mb_height, slices[i].mby_start % mb_height);
+if (s->end_mb_y <= s->start_mb_y) {
+av_log(v->s.avctx, AV_LOG_ERROR, "end mb y %d %d invalid\n", 
s->end_mb_y, s->start_mb_y);
+continue;
+}
  vc1_decode_blocks(v);
  if (i != n_slices)
  s->gb = slices[i].gb;
--


looks OK except for cryptic message


I will consider this dropped unless someone improves it to take one MB 
high pictures (possible in theory) into account.

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


Re: [libav-devel] [PATCH 6/6] vc1dec: dont apply the loop filter on fields

2012-07-27 Thread Mashiat Sarker Shakkhar

On 7/27/2012 7:04 PM, Kostya Shishkov wrote:

On Fri, Jul 27, 2012 at 06:49:44PM +0600, Mashiat Sarker Shakkhar wrote:

From: Michael Niedermayer 

Fixes read of uninitialized memory

Signed-off-by: Michael Niedermayer 
---
  libavcodec/vc1dec.c|2 +-
  tests/ref/fate/vc1_sa10143 |   58 ++--
  2 files changed, 30 insertions(+), 30 deletions(-)


Are you sure it's proper way to go or is it just a hack to get rid of some
warning?


I am not really sure. For interlaced field P blocks, the filtering 
should be same as progressive - so this patch does not apply. On the 
other hand, for interlaced frame blocks, the progressive filtering is 
probably not right (we need to take fieldtx into account).


I would say, stick to what we know is right - hence filtering only 
progressive blocks.

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


[libav-devel] [PATCH 6/6] vc1dec: dont apply the loop filter on fields

2012-07-27 Thread Mashiat Sarker Shakkhar
From: Michael Niedermayer 

Fixes read of uninitialized memory

Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1dec.c|2 +-
 tests/ref/fate/vc1_sa10143 |   58 ++--
 2 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 689c3b9..910642a 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -4651,7 +4651,7 @@ static void vc1_decode_p_blocks(VC1Context *v)
 if (s->mb_y != s->start_mb_y) ff_draw_horiz_band(s, (s->mb_y - 1) * 
16, 16);
 s->first_slice_line = 0;
 }
-if (apply_loop_filter) {
+if (apply_loop_filter && v->fcm == PROGRESSIVE) {
 s->mb_x = 0;
 ff_init_block_index(s);
 for (; s->mb_x < s->mb_width; s->mb_x++) {
diff --git a/tests/ref/fate/vc1_sa10143 b/tests/ref/fate/vc1_sa10143
index a008356..0d2e697 100644
--- a/tests/ref/fate/vc1_sa10143
+++ b/tests/ref/fate/vc1_sa10143
@@ -1,31 +1,31 @@
 #tb 0: 1/25
 0,  0,  0,1,   518400, 0x89407f55
-0,  2,  2,1,   518400, 0xeb8d84a1
-0,  3,  3,1,   518400, 0x2121ff57
-0,  4,  4,1,   518400, 0xd81adb3d
-0,  5,  5,1,   518400, 0x01e36aa2
-0,  6,  6,1,   518400, 0x6b802361
-0,  7,  7,1,   518400, 0xc8403c77
-0,  8,  8,1,   518400, 0xdd342b5d
-0,  9,  9,1,   518400, 0x2100eea5
-0, 10, 10,1,   518400, 0x92a22da6
-0, 11, 11,1,   518400, 0x6bacdef7
-0, 12, 12,1,   518400, 0x4a00715f
-0, 13, 13,1,   518400, 0x59b98727
-0, 14, 14,1,   518400, 0xbf912ee1
-0, 15, 15,1,   518400, 0x8c966cd6
-0, 16, 16,1,   518400, 0x2c9a2535
-0, 17, 17,1,   518400, 0x29085c06
-0, 18, 18,1,   518400, 0x46ae6b7d
-0, 19, 19,1,   518400, 0x283100f4
-0, 20, 20,1,   518400, 0x2731b5ff
-0, 21, 21,1,   518400, 0x1132ea54
-0, 22, 22,1,   518400, 0x37cbe539
-0, 23, 23,1,   518400, 0x08ff75cf
-0, 24, 24,1,   518400, 0xafb6bc45
-0, 25, 25,1,   518400, 0x19d3873d
-0, 26, 26,1,   518400, 0xd494a8be
-0, 27, 27,1,   518400, 0x285f41ef
-0, 28, 28,1,   518400, 0xd4b1ffa1
-0, 29, 29,1,   518400, 0xc3876c3a
-0, 30, 30,1,   518400, 0xb73dbb62
+0,  2,  2,1,   518400, 0x1480849d
+0,  3,  3,1,   518400, 0x0e69ff59
+0,  4,  4,1,   518400, 0x00d6db06
+0,  5,  5,1,   518400, 0x1a5b6a69
+0,  6,  6,1,   518400, 0xc1a1232e
+0,  7,  7,1,   518400, 0x9a4e3c54
+0,  8,  8,1,   518400, 0x04122b44
+0,  9,  9,1,   518400, 0x0fcfeebc
+0, 10, 10,1,   518400, 0xc7882dc1
+0, 11, 11,1,   518400, 0x9d79df09
+0, 12, 12,1,   518400, 0xff6b716f
+0, 13, 13,1,   518400, 0x638a8746
+0, 14, 14,1,   518400, 0x07572efb
+0, 15, 15,1,   518400, 0x306f6cef
+0, 16, 16,1,   518400, 0xd7602518
+0, 17, 17,1,   518400, 0x49ab5bf5
+0, 18, 18,1,   518400, 0x3c736b6c
+0, 19, 19,1,   518400, 0x95ae00c9
+0, 20, 20,1,   518400, 0x7b9ab64e
+0, 21, 21,1,   518400, 0x5205ea68
+0, 22, 22,1,   518400, 0xb486e618
+0, 23, 23,1,   518400, 0xa3217616
+0, 24, 24,1,   518400, 0xc66bbc56
+0, 25, 25,1,   518400, 0xf024872a
+0, 26, 26,1,   518400, 0x97d2a8ba
+0, 27, 27,1,   518400, 0xa3a2418e
+0, 28, 28,1,   518400, 0x08460005
+0, 29, 29,1,   518400, 0x50fb6c94
+0, 30, 30,1,   518400, 0x5584bb40
-- 
1.7.4

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


[libav-devel] [PATCH 5/6] vc1dec: check that coded slice positions and interlacing match.

2012-07-27 Thread Mashiat Sarker Shakkhar
From: Michael Niedermayer 

This fixes out of array writes

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1dec.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index c63ccf1..689c3b9 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -5572,6 +5572,10 @@ static int vc1_decode_frame(AVCodecContext *avctx, void 
*data,
 mb_height = s->mb_height >> v->field_mode;
 for (i = 0; i <= n_slices; i++) {
 if (i > 0 &&  slices[i - 1].mby_start >= mb_height) {
+if(v->field_mode <= 0) {
+av_log(v->s.avctx, AV_LOG_ERROR, "invalid end_mb_y %d\n", 
slices[i - 1].mby_start);
+continue;
+}
 v->second_field = 1;
 v->blocks_off   = s->mb_width  * s->mb_height << 1;
 v->mb_off   = s->mb_stride * s->mb_height >> 1;
-- 
1.7.4

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


[libav-devel] [PATCH 4/6] vc1dec: check end_mb_y / start_mb_y validity

2012-07-27 Thread Mashiat Sarker Shakkhar
From: Michael Niedermayer 

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1dec.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index e34e8d2..c63ccf1 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -5600,6 +5600,10 @@ static int vc1_decode_frame(AVCodecContext *avctx, void 
*data,
 s->end_mb_y = (i == n_slices ) ? mb_height : 
FFMIN(mb_height, slices[i].mby_start % mb_height);
 else
 s->end_mb_y = (i <= n_slices1 + 1) ? mb_height : 
FFMIN(mb_height, slices[i].mby_start % mb_height);
+if (s->end_mb_y <= s->start_mb_y) {
+av_log(v->s.avctx, AV_LOG_ERROR, "end mb y %d %d invalid\n", 
s->end_mb_y, s->start_mb_y);
+continue;
+}
 vc1_decode_blocks(v);
 if (i != n_slices)
 s->gb = slices[i].gb;
-- 
1.7.4

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


[libav-devel] [PATCH 3/6] vc1dec: Sanity-check macroblock quantizer

2012-07-27 Thread Mashiat Sarker Shakkhar
From: Michael Niedermayer 

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1dec.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index ac5bfe5..e34e8d2 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1048,6 +1048,9 @@ static void vc1_mc_4mv_chroma4(VC1Context *v)
 mquant = v->altpq; \
 if ((edges&8) && s->mb_y == (s->mb_height - 1))\
 mquant = v->altpq; \
+if (!mquant || mquant > 31) {  \
+av_log(v->s.avctx, AV_LOG_ERROR, "invalid mquant %d\n", mquant);   
\
+mquant = 1; \
 }
 
 /**
-- 
1.7.4

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


[libav-devel] [PATCH 2/6] vc1dec: dont ignore ff_vc1_parse_frame_header_advs return value

2012-07-27 Thread Mashiat Sarker Shakkhar
From: Michael Niedermayer 

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1dec.c |   14 ++
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index b76fc76..ac5bfe5 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -5579,11 +5579,17 @@ static int vc1_decode_frame(AVCodecContext *avctx, void 
*data,
 }
 if (i) {
 v->pic_header_flag = 0;
-if (v->field_mode && i == n_slices1 + 2)
-ff_vc1_parse_frame_header_adv(v, &s->gb);
-else if (get_bits1(&s->gb)) {
+if (v->field_mode && i == n_slices1 + 2) {
+if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) {
+av_log(v->s.avctx, AV_LOG_ERROR, "slice header 
damaged\n");
+continue;
+}
+} else if (get_bits1(&s->gb)) {
 v->pic_header_flag = 1;
-ff_vc1_parse_frame_header_adv(v, &s->gb);
+if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) {
+av_log(v->s.avctx, AV_LOG_ERROR, "slice header 
damaged\n");
+continue;
+}
 }
 }
 s->start_mb_y = (i == 0) ? 0 : FFMAX(0, slices[i-1].mby_start % 
mb_height);
-- 
1.7.4

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


[libav-devel] [PATCH 1/6] vc1: avoid reading beyond the last line in vc1_draw_sprites()

2012-07-27 Thread Mashiat Sarker Shakkhar
From: Michael Niedermayer 

Fixes overread

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1dec.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 51124cf..b76fc76 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -4946,7 +4946,7 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* 
sd)
 if (!(xoff[sprite] & 0x) && xadv[sprite] == 1 << 16) {
 src_h[sprite][0] = iplane + (xoff[sprite] >> 16) +  
yline  * iline;
 if (ysub[sprite])
-src_h[sprite][1] = iplane + (xoff[sprite] >> 16) + 
(yline + 1) * iline;
+src_h[sprite][1] = iplane + (xoff[sprite] >> 16) + 
FFMIN(yline + 1, (v->sprite_height>>!!plane)-1) * iline;
 } else {
 if (sr_cache[sprite][0] != yline) {
 if (sr_cache[sprite][1] == yline) {
@@ -4958,7 +4958,7 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* 
sd)
 }
 }
 if (ysub[sprite] && sr_cache[sprite][1] != yline + 1) {
-v->vc1dsp.sprite_h(v->sr_rows[sprite][1], iplane + 
(yline + 1) * iline, xoff[sprite], xadv[sprite], width);
+v->vc1dsp.sprite_h(v->sr_rows[sprite][1], iplane + 
FFMIN(yline + 1, (v->sprite_height>>!!plane)-1) * iline, xoff[sprite], 
xadv[sprite], width);
 sr_cache[sprite][1] = yline + 1;
 }
 src_h[sprite][0] = v->sr_rows[sprite][0];
-- 
1.7.4

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


[libav-devel] VC-1 security fixes cherry-picked from FFmpeg git

2012-07-27 Thread Mashiat Sarker Shakkhar
These patches won't probably improve anything in terms of decoded picture.

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


Re: [libav-devel] [PATCH] vc1: Add a test for interlaced field pictures

2012-07-23 Thread Mashiat Sarker Shakkhar

On 7/23/2012 8:39 AM, Derek Buitenhuis wrote:

On 22/07/2012 10:22 PM, Mashiat Sarker Shakkhar wrote:

OK


PING

Thanks to Anton, the sample is in FATE now.


Ran through FATE locally and pushed. It's been on the fate-suite
servers for ~2 days now, so it should be synched everywhere.


Thanks a lot, but you could have changed the subject to "FATE: ...". I'd 
somewhat carelessly titled it "vc1: ...". Apologies for that.


Regards
Shakkhar

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


Re: [libav-devel] [PATCH] vc1: Add a test for interlaced field pictures

2012-07-22 Thread Mashiat Sarker Shakkhar
Benjamin Larsson  writes:

> 
> OK
> 

PING

Thanks to Anton, the sample is in FATE now.

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


Re: [libav-devel] [PATCH] libopenjpeg: introduce lowres and lowqual private options

2012-07-19 Thread Mashiat Sarker Shakkhar

On 7/20/2012 2:36 AM, Johan Andersson wrote:

On Thu, Jul 19, 2012 at 08:59:45PM +0200, Luca Barbato wrote:

OpenJPEG can decode in lower resolution or decode only a number
of enhancement layers.


Didnt we remove lowres couple of month ago for some reason?


This one is a private option. The previous one was afaict global.

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


Re: [libav-devel] VC-1 interlaced FATE tests

2012-07-16 Thread Mashiat Sarker Shakkhar

On 7/16/2012 7:34 PM, Diego Biurrun wrote:

On Mon, Jul 16, 2012 at 02:45:22PM +0600, Mashiat Sarker Shakkhar wrote:


These framecrcs are not bitexact with reference decoder.


Why?


Because of the unimplemented loop filter and deblocking filter as far as 
I remember.

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


Re: [libav-devel] [PATCH] vc1: Add a test for interlaced field pictures

2012-07-16 Thread Mashiat Sarker Shakkhar
Sample uploaded to ftp://upload.libav.org/incoming/fate-vc1/

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


[libav-devel] [PATCH] vc1: Add a test for interlaced field pictures

2012-07-16 Thread Mashiat Sarker Shakkhar
---
 tests/fate/microsoft.mak   |3 +++
 tests/ref/fate/vc1_sa10143 |   31 +++
 2 files changed, 34 insertions(+), 0 deletions(-)
 create mode 100644 tests/ref/fate/vc1_sa10143

diff --git a/tests/fate/microsoft.mak b/tests/fate/microsoft.mak
index 515f6ab..48bdb95 100644
--- a/tests/fate/microsoft.mak
+++ b/tests/fate/microsoft.mak
@@ -32,6 +32,9 @@ fate-vc1_sa10091: CMD = framecrc -i $(SAMPLES)/vc1/SA10091.vc1
 FATE_VC1 += fate-vc1_sa20021
 fate-vc1_sa20021: CMD = framecrc -i $(SAMPLES)/vc1/SA20021.vc1
 
+FATE_VC1 += fate-vc1_sa10143
+fate-vc1_sa10143: CMD = framecrc -i $(SAMPLES)/vc1/SA10143.vc1
+
 FATE_VC1 += fate-vc1-ism
 fate-vc1-ism: CMD = framecrc -i $(SAMPLES)/isom/vc1-wmapro.ism -an
 
diff --git a/tests/ref/fate/vc1_sa10143 b/tests/ref/fate/vc1_sa10143
new file mode 100644
index 000..a008356
--- /dev/null
+++ b/tests/ref/fate/vc1_sa10143
@@ -0,0 +1,31 @@
+#tb 0: 1/25
+0,  0,  0,1,   518400, 0x89407f55
+0,  2,  2,1,   518400, 0xeb8d84a1
+0,  3,  3,1,   518400, 0x2121ff57
+0,  4,  4,1,   518400, 0xd81adb3d
+0,  5,  5,1,   518400, 0x01e36aa2
+0,  6,  6,1,   518400, 0x6b802361
+0,  7,  7,1,   518400, 0xc8403c77
+0,  8,  8,1,   518400, 0xdd342b5d
+0,  9,  9,1,   518400, 0x2100eea5
+0, 10, 10,1,   518400, 0x92a22da6
+0, 11, 11,1,   518400, 0x6bacdef7
+0, 12, 12,1,   518400, 0x4a00715f
+0, 13, 13,1,   518400, 0x59b98727
+0, 14, 14,1,   518400, 0xbf912ee1
+0, 15, 15,1,   518400, 0x8c966cd6
+0, 16, 16,1,   518400, 0x2c9a2535
+0, 17, 17,1,   518400, 0x29085c06
+0, 18, 18,1,   518400, 0x46ae6b7d
+0, 19, 19,1,   518400, 0x283100f4
+0, 20, 20,1,   518400, 0x2731b5ff
+0, 21, 21,1,   518400, 0x1132ea54
+0, 22, 22,1,   518400, 0x37cbe539
+0, 23, 23,1,   518400, 0x08ff75cf
+0, 24, 24,1,   518400, 0xafb6bc45
+0, 25, 25,1,   518400, 0x19d3873d
+0, 26, 26,1,   518400, 0xd494a8be
+0, 27, 27,1,   518400, 0x285f41ef
+0, 28, 28,1,   518400, 0xd4b1ffa1
+0, 29, 29,1,   518400, 0xc3876c3a
+0, 30, 30,1,   518400, 0xb73dbb62
-- 
1.7.4

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


[libav-devel] (no subject)

2012-07-16 Thread Mashiat Sarker Shakkhar

These framecrcs are not bitexact with reference decoder. But currently we have
no test whatsoever for VC1 interlaced. So having one seemed useful to me. I
would like to add some more in the future.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] vc1dec: Do not use random pred_flag if motion vector data is skipped

2012-07-14 Thread Mashiat Sarker Shakkhar
This fixes SA10143.vc1 from test-suite. Also partially fixes MC-VC1.ts
from videolan streams archive.
---
 libavcodec/vc1dec.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 0f56e22..51124cf 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -3950,7 +3950,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v)
 s->current_picture.f.mb_type[mb_pos + v->mb_off] = MB_TYPE_16x16;
 for (i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = 0;
 if (idx_mbmode <= 5) { // 1-MV
-dmv_x = dmv_y = 0;
+dmv_x = dmv_y = pred_flag = 0;
 if (idx_mbmode & 1) {
 get_mvdata_interlaced(v, &dmv_x, &dmv_y, &pred_flag);
 }
-- 
1.7.4

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


[libav-devel] [PATCH 2/2] image2: Add "start_number" private option to the demuxer

2012-06-22 Thread Mashiat Sarker Shakkhar
Currently if a pattern is given we look for up to the fifth file name in
the sequence. This option sets that limit to an arbitrary number.
---
 libavformat/img2dec.c |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index b4b9723..ee4161d 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -40,6 +40,7 @@ typedef struct {
 char *video_size;   /**< Set by a private option. */
 char *framerate;/**< Set by a private option. */
 int loop;
+int start_number;
 } VideoDemuxData;
 
 static const int sizes[][2] = {
@@ -70,13 +71,13 @@ static int infer_size(int *width_ptr, int *height_ptr, int 
size)
 
 /* return -1 if no image found */
 static int find_image_range(int *pfirst_index, int *plast_index,
-const char *path)
+const char *path, int max_start)
 {
 char buf[1024];
 int range, last_index, range1, first_index;
 
 /* find the first image */
-for(first_index = 0; first_index < 5; first_index++) {
+for(first_index = 0; first_index < max_start; first_index++) {
 if (av_get_frame_filename(buf, sizeof(buf), path, first_index) < 0){
 *pfirst_index =
 *plast_index = 1;
@@ -182,7 +183,8 @@ static int read_header(AVFormatContext *s1)
 }
 
 if (!s->is_pipe) {
-if (find_image_range(&first_index, &last_index, s->path) < 0)
+if (find_image_range(&first_index, &last_index, s->path,
+ FFMAX(s->start_number, 5)) < 0)
 return AVERROR(ENOENT);
 s->img_first = first_index;
 s->img_last = last_index;
@@ -283,6 +285,7 @@ static const AVOption options[] = {
 { "video_size",   "", OFFSET(video_size),   AV_OPT_TYPE_STRING, {.str = 
NULL}, 0, 0, DEC },
 { "framerate","", OFFSET(framerate),AV_OPT_TYPE_STRING, {.str = 
"25"}, 0, 0, DEC },
 { "loop", "", OFFSET(loop), AV_OPT_TYPE_INT,{.dbl = 
0},0, 1, DEC },
+{ "start_number", "first number in the sequence", OFFSET(start_number), 
AV_OPT_TYPE_INT, {.dbl = 1}, 1, INT_MAX, DEC },
 { NULL },
 };
 
-- 
1.7.9.5

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


[libav-devel] [PATCH 1/2] image2: Add "start_number" private option to the muxer

2012-06-22 Thread Mashiat Sarker Shakkhar
This adds the capability to start counting file number from an arbitrary
integer.

This includes a few lines of trivial code from FFmpeg codebase.
---
 libavformat/img2enc.c |   20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index c825c2b..77f72ff 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -26,8 +26,10 @@
 #include "avformat.h"
 #include "avio_internal.h"
 #include "internal.h"
+#include "libavutil/opt.h"
 
 typedef struct {
+const AVClass *class;  /**< Class for private options. */
 int img_number;
 int is_pipe;
 char path[1024];
@@ -37,7 +39,6 @@ static int write_header(AVFormatContext *s)
 {
 VideoMuxData *img = s->priv_data;
 
-img->img_number = 1;
 av_strlcpy(img->path, s->filename, sizeof(img->path));
 
 /* find format */
@@ -124,7 +125,21 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
 return 0;
 }
 
+#define OFFSET(x) offsetof(VideoMuxData, x)
+#define ENC AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption muxoptions[] = {
+{ "start_number", "first number in the sequence", OFFSET(img_number), 
AV_OPT_TYPE_INT, {.dbl = 1}, 1, INT_MAX, ENC },
+{ NULL },
+};
+
 #if CONFIG_IMAGE2_MUXER
+static const AVClass img2mux_class = {
+.class_name = "image2 muxer",
+.item_name  = av_default_item_name,
+.option = muxoptions,
+.version= LIBAVUTIL_VERSION_INT,
+};
+
 AVOutputFormat ff_image2_muxer = {
 .name   = "image2",
 .long_name  = NULL_IF_CONFIG_SMALL("image2 sequence"),
@@ -135,7 +150,8 @@ AVOutputFormat ff_image2_muxer = {
 .video_codec= CODEC_ID_MJPEG,
 .write_header   = write_header,
 .write_packet   = write_packet,
-.flags  = AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS | AVFMT_NOFILE
+.flags  = AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS | AVFMT_NOFILE,
+.priv_class = &img2mux_class
 };
 #endif
 #if CONFIG_IMAGE2PIPE_MUXER
-- 
1.7.9.5

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


[libav-devel] [PATCH 2/2] image2: Add "startat" private option to the demuxer

2012-06-22 Thread Mashiat Sarker Shakkhar
Currently if a pattern is given we look for up to the fifth file name in
the sequence. This option sets that limit to an arbitrary number.
---
 libavformat/img2dec.c |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index b4b9723..2c14e01 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -40,6 +40,7 @@ typedef struct {
 char *video_size;   /**< Set by a private option. */
 char *framerate;/**< Set by a private option. */
 int loop;
+int startat;
 } VideoDemuxData;
 
 static const int sizes[][2] = {
@@ -70,13 +71,13 @@ static int infer_size(int *width_ptr, int *height_ptr, int 
size)
 
 /* return -1 if no image found */
 static int find_image_range(int *pfirst_index, int *plast_index,
-const char *path)
+const char *path, int max_start)
 {
 char buf[1024];
 int range, last_index, range1, first_index;
 
 /* find the first image */
-for(first_index = 0; first_index < 5; first_index++) {
+for(first_index = 0; first_index < max_start; first_index++) {
 if (av_get_frame_filename(buf, sizeof(buf), path, first_index) < 0){
 *pfirst_index =
 *plast_index = 1;
@@ -182,7 +183,8 @@ static int read_header(AVFormatContext *s1)
 }
 
 if (!s->is_pipe) {
-if (find_image_range(&first_index, &last_index, s->path) < 0)
+if (find_image_range(&first_index, &last_index, s->path,
+ FFMAX(s->startat, 5)) < 0)
 return AVERROR(ENOENT);
 s->img_first = first_index;
 s->img_last = last_index;
@@ -283,6 +285,7 @@ static const AVOption options[] = {
 { "video_size",   "", OFFSET(video_size),   AV_OPT_TYPE_STRING, {.str = 
NULL}, 0, 0, DEC },
 { "framerate","", OFFSET(framerate),AV_OPT_TYPE_STRING, {.str = 
"25"}, 0, 0, DEC },
 { "loop", "", OFFSET(loop), AV_OPT_TYPE_INT,{.dbl = 
0},0, 1, DEC },
+{ "startat", "first number in the sequence", OFFSET(startat), 
AV_OPT_TYPE_INT, {.dbl = 1}, 1, INT_MAX, DEC },
 { NULL },
 };
 
-- 
1.7.9.5

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


[libav-devel] [PATCH 1/2] image2: Add "startat" private option to the muxer

2012-06-22 Thread Mashiat Sarker Shakkhar
This adds the capability to start counting file number from an arbitrary
integer.

This includes a few lines of trivial code from FFmpeg codebase.
---
 libavformat/img2enc.c |   20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index c825c2b..0d30a44 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -26,8 +26,10 @@
 #include "avformat.h"
 #include "avio_internal.h"
 #include "internal.h"
+#include "libavutil/opt.h"
 
 typedef struct {
+const AVClass *class;  /**< Class for private options. */
 int img_number;
 int is_pipe;
 char path[1024];
@@ -37,7 +39,6 @@ static int write_header(AVFormatContext *s)
 {
 VideoMuxData *img = s->priv_data;
 
-img->img_number = 1;
 av_strlcpy(img->path, s->filename, sizeof(img->path));
 
 /* find format */
@@ -124,7 +125,21 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
 return 0;
 }
 
+#define OFFSET(x) offsetof(VideoMuxData, x)
+#define ENC AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption muxoptions[] = {
+{ "startat", "first number in the sequence", OFFSET(img_number), 
AV_OPT_TYPE_INT, {.dbl = 1}, 1, INT_MAX, ENC },
+{ NULL },
+};
+
 #if CONFIG_IMAGE2_MUXER
+static const AVClass img2mux_class = {
+.class_name = "image2 muxer",
+.item_name  = av_default_item_name,
+.option = muxoptions,
+.version= LIBAVUTIL_VERSION_INT,
+};
+
 AVOutputFormat ff_image2_muxer = {
 .name   = "image2",
 .long_name  = NULL_IF_CONFIG_SMALL("image2 sequence"),
@@ -135,7 +150,8 @@ AVOutputFormat ff_image2_muxer = {
 .video_codec= CODEC_ID_MJPEG,
 .write_header   = write_header,
 .write_packet   = write_packet,
-.flags  = AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS | AVFMT_NOFILE
+.flags  = AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS | AVFMT_NOFILE,
+.priv_class = &img2mux_class
 };
 #endif
 #if CONFIG_IMAGE2PIPE_MUXER
-- 
1.7.9.5

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


Re: [libav-devel] LinuxTag

2012-05-17 Thread Mashiat Sarker Shakkhar

On 5/18/2012 4:47 AM, Diego Biurrun wrote:

On Sun, May 13, 2012 at 05:30:22PM +0200, Diego Biurrun wrote:

So who is coming?

I expect to be there from start to finish.  Janne will be away from
Friday noon, Mans Saturday noon.

Do we have posters or so to decorate the booth?  We'll need a small
switch and a few network cables; Club Mate can be bought locally.

I'll suggest that we try our sample fixing service again.  People can
bring along samples on their USB sticks or whatever and we work on
fixing the issues on site.  Should be good fun and keep everybody
occupied.


+1 for the idea. Would have loved to be there.

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


Re: [libav-devel] [PATCH] WMAL: Restore removed code in mclms_predict()

2012-05-05 Thread Mashiat Sarker Shakkhar

Kostya Shishkov  writes:

>
> On Thu, May 03, 2012 at 10:14:47AM -0700, Mashiat Sarker Shakkhar wrote:
> > Based on observations made by Jakub Stachowski 
> > ---
> >  libavcodec/wmalosslessdec.c |2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
[...]
> Hmm, the reference decoder performs MCLMS on empty channels.
> It has special case to update filter state only, so quite probably 
the patch

> is correct.

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


Re: [libav-devel] [PATCH v2] zerocodec: check if there is previous frame

2012-05-04 Thread Mashiat Sarker Shakkhar

On 5/4/2012 10:54 PM, Derek Buitenhuis wrote:

On 04/05/2012 12:48 PM, Diego Biurrun wrote:

I admittedly don't know the surrounding code, but the error message does
not make much sense to me.  Why is the lack of a previous frame an error
condition?  And when does this happen except on the first frame?


ZeroCodec relies on the keyframe flag being set in the container, and prev
is the previously decoded frame. So, e.g., if you have a file with incorrect
or missing keyframe flags, this can happen.

[...]

I am in favor of using a more comprehensive error message here. Just 
saying ...


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


[libav-devel] [PATCH] WMAL: Restore removed code in mclms_predict()

2012-05-03 Thread Mashiat Sarker Shakkhar
Based on observations made by Jakub Stachowski 
---
 libavcodec/wmalosslessdec.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index ff63083..7510b12 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -655,6 +655,8 @@ static void mclms_predict(WmallDecodeCtx *s, int icoef, int 
*pred)
 
 for (ich = 0; ich < num_channels; ich++) {
 pred[ich] = 0;
+if (!s->is_channel_coded[ich])
+continue;
 for (i = 0; i < order * num_channels; i++)
 pred[ich] += s->mclms_prevvalues[i + s->mclms_recent] *
  s->mclms_coeffs[i + order * num_channels * ich];
-- 
1.7.5.4

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


[libav-devel] (no subject)

2012-05-03 Thread Mashiat Sarker Shakkhar

This restores code that was removed in 0e23b508214611659fc459ed6e5d6704b907694b
Fixes this sample: http://stream1.criteriamx.com:8080/part.wma
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] WMAL Cosmetics: Fix indentation

2012-05-02 Thread Mashiat Sarker Shakkhar
---
 libavcodec/wmalosslessdec.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 13b706e..81b5cc5 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -1227,7 +1227,7 @@ static int decode_packet(AVCodecContext *avctx, void 
*data, int *got_frame_ptr,
 
 /* decode the cross packet frame if it is valid */
 if (num_bits_prev_frame < remaining_packet_bits && !s->packet_loss)
-decode_frame(s);
+decode_frame(s);
 } else if (s->num_saved_bits - s->frame_offset) {
 av_dlog(avctx, "ignoring %x previously saved bits\n",
 s->num_saved_bits - s->frame_offset);
-- 
1.7.5.4

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


Re: [libav-devel] [PATCH] WMAL: Fix reconstruction of audio with uncoded channel(s)

2012-05-01 Thread Mashiat Sarker Shakkhar

On 5/2/2012 3:27 AM, Mashiat Sarker Shakkhar wrote:

From: Kostya Shishkov

Signed-off-by: Mashiat Sarker Shakkhar
---
  libavcodec/wmalosslessdec.c |7 +++
  1 files changed, 3 insertions(+), 4 deletions(-)

[...]

For the record, fixes decoding of a sample for me. (There are other
broken mono samples though, which still need fixing.) Long live kshishkov.

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


[libav-devel] [PATCH] WMAL: Fix reconstruction of audio with uncoded channel(s)

2012-05-01 Thread Mashiat Sarker Shakkhar
From: Kostya Shishkov 

Signed-off-by: Mashiat Sarker Shakkhar 
---
 libavcodec/wmalosslessdec.c |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 913271e..25599c4 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -654,8 +654,6 @@ static void mclms_predict(WmallDecodeCtx *s, int icoef, int 
*pred)
 int num_channels = s->num_channels;
 
 for (ich = 0; ich < num_channels; ich++) {
-if (!s->is_channel_coded[ich])
-continue;
 pred[ich] = 0;
 for (i = 0; i < order * num_channels; i++)
 pred[ich] += s->mclms_prevvalues[i + s->mclms_recent] *
@@ -789,7 +787,7 @@ static void revert_inter_ch_decorr(WmallDecodeCtx *s, int 
tile_size)
 {
 if (s->num_channels != 2)
 return;
-else if (s->is_channel_coded[0] && s->is_channel_coded[1]) {
+else if (s->is_channel_coded[0] || s->is_channel_coded[1]) {
 int icoef;
 for (icoef = 0; icoef < tile_size; icoef++) {
 s->channel_residues[0][icoef] -= s->channel_residues[1][icoef] >> 
1;
@@ -955,7 +953,8 @@ static int decode_subframe(WmallDecodeCtx *s)
 else
 use_normal_update_speed(s, i);
 revert_cdlms(s, i, 0, subframe_len);
-}
+} else
+memset(s->channel_residues[i], 0, 
sizeof(**s->channel_residues) * subframe_len);
 }
 if (s->do_mclms)
 revert_mclms(s, subframe_len);
-- 
1.7.5.4

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


Re: [libav-devel] [PATCH] wmall: fix reconstructing audio with uncoded channels

2012-05-01 Thread Mashiat Sarker Shakkhar

On 5/2/2012 1:12 AM, Kostya Shishkov wrote:

---
not that I care, just for the reference
---
  libavcodec/wmalosslessdec.c |6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 1520a06..1f6581e 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -654,8 +654,6 @@ static void mclms_predict(WmallDecodeCtx *s, int icoef, int 
*pred)
  int num_channels = s->num_channels;

  for (ich = 0; ich<  num_channels; ich++) {
-if (!s->is_channel_coded[ich])
-continue;
  pred[ich] = 0;
  for (i = 0; i<  order * num_channels; i++)
  pred[ich] += s->mclms_prevvalues[i + s->mclms_recent] *
@@ -789,7 +787,7 @@ static void revert_inter_ch_decorr(WmallDecodeCtx *s, int 
tile_size)
  {
  if (s->num_channels != 2)
  return;
-else if (s->is_channel_coded[0]&&  s->is_channel_coded[1]) {
+else if (s->is_channel_coded[0] || s->is_channel_coded[1]) {
  int icoef;
  for (icoef = 0; icoef<  tile_size; icoef++) {
  s->channel_residues[0][icoef] -= s->channel_residues[1][icoef]>>  
1;
@@ -955,6 +953,8 @@ static int decode_subframe(WmallDecodeCtx *s)
  else
  use_normal_update_speed(s, i);
  revert_cdlms(s, i, 0, subframe_len);
+} else {
+memset(s->channel_residues[i], 0, 
sizeof(**s->channel_residues) * subframe_len);
  }
  }
  if (s->do_mclms)



I'll clean it up a bit and resubmit.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] WMAL: Do not start decoding if frame does not end in current packet

2012-04-30 Thread Mashiat Sarker Shakkhar
This fixes decoding of frames which span more than two packets. Tested with
recit24.wma.
---
 libavcodec/wmalosslessdec.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 1520a06..e86645e 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -1209,8 +1209,8 @@ static int decode_packet(AVCodecContext *avctx, void 
*data, int *got_frame_ptr,
 save_bits(s, gb, num_bits_prev_frame, 1);
 
 /* decode the cross packet frame if it is valid */
-if (!s->packet_loss)
-decode_frame(s);
+if (num_bits_prev_frame < remaining_packet_bits && !s->packet_loss)
+decode_frame(s);
 } else if (s->num_saved_bits - s->frame_offset) {
 av_dlog(avctx, "ignoring %x previously saved bits\n",
 s->num_saved_bits - s->frame_offset);
-- 
1.7.5.4

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


Re: [libav-devel] [PATCH 1/2] WMAL: Do not start decoding if frame does not end in current packet

2012-04-28 Thread Mashiat Sarker Shakkhar

On 4/29/2012 1:09 AM, Kostya Shishkov wrote:
[...]

approach seems OK but please add braces
it's not Python and it will compile to
if(num_bits){
  if(!s->packet_loss)
   ...
  else
   ...
}


I have no excuse :( I don't know what I was thinking. Curiously, I am 
actually learning python these days :P


Shakkhar

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


[libav-devel] [PATCH 2/2] wmalossless: Ensure that last frame is not written again if nothing was decoded in current packet.

2012-04-28 Thread Mashiat Sarker Shakkhar
From: Jakub Stachowski 

Reviewed-by: Mashiat Sarker Shakkhar 
Signed-off-by: Michael Niedermayer 
---
 libavcodec/wmalosslessdec.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index bc1a19c..59bebad 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -1166,6 +1166,8 @@ static int decode_packet(AVCodecContext *avctx, void 
*data, int *got_frame_ptr,
 int buf_size   = avpkt->size;
 int num_bits_prev_frame, packet_sequence_number, spliced_packet;
 
+s->frame.nb_samples = 0;
+
 if (s->packet_done || s->packet_loss) {
 s->packet_done = 0;
 
-- 
1.7.5.4

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


[libav-devel] [PATCH 1/2] WMAL: Do not start decoding if frame does not end in current packet

2012-04-28 Thread Mashiat Sarker Shakkhar
This fixes decoding of frames which span more than two packets. Tested with
recit24.wma.
---
 libavcodec/wmalosslessdec.c |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 1520a06..bc1a19c 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -1209,8 +1209,11 @@ static int decode_packet(AVCodecContext *avctx, void 
*data, int *got_frame_ptr,
 save_bits(s, gb, num_bits_prev_frame, 1);
 
 /* decode the cross packet frame if it is valid */
-if (!s->packet_loss)
-decode_frame(s);
+if (num_bits_prev_frame < remaining_packet_bits)
+if (!s->packet_loss)
+decode_frame(s);
+else
+s->packet_done = 1;
 } else if (s->num_saved_bits - s->frame_offset) {
 av_dlog(avctx, "ignoring %x previously saved bits\n",
 s->num_saved_bits - s->frame_offset);
-- 
1.7.5.4

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


[libav-devel] [PATCH] segment: fix null pointer dereference

2012-04-27 Thread Mashiat Sarker Shakkhar
From: Paul B Mahol 

Signed-off-by: Paul B Mahol 
Signed-off-by: Michael Niedermayer 
---
 libavformat/segment.c |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/segment.c b/libavformat/segment.c
index 1af412a..05f76a7 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -174,11 +174,13 @@ static int seg_write_header(AVFormatContext *s)
 
 fail:
 if (ret) {
-oc->streams = NULL;
-oc->nb_streams = 0;
+if (oc) {
+oc->streams = NULL;
+oc->nb_streams = 0;
+avformat_free_context(oc);
+}
 if (seg->list)
 avio_close(seg->pb);
-avformat_free_context(oc);
 }
 return ret;
 }
-- 
1.7.5.4

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


Re: [libav-devel] [PATCH] ARM: allow runtime masking of CPU features

2012-04-21 Thread Mashiat Sarker Shakkhar

On 4/21/2012 8:32 PM, Mans Rullgard wrote:

This allows masking CPU features with the -cpuflags avconv option
which is useful for testing different optimisations without rebuilding.

Signed-off-by: Mans Rullgard


What happened to the umlaut?

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


Re: [libav-devel] [PATCH 4/4] dwt: Cosmetic changes

2012-04-15 Thread Mashiat Sarker Shakkhar

On 4/16/2012 12:48 AM, Måns Rullgård wrote:

Diego Biurrun  writes:


Please read the developer guidelines about K&R style again.  This is
not worth reviewing until it has less obvious mistakes.


This is a good illustration of the difference between less and fewer.
You should have said "fewer obvious mistakes."  What you said is
equivalent to "it has mistakes less obvious than these ones," which is
hopefully not what you meant.

The general rule is to use "fewer" with countable quantities, "less" in
other situations.

Ministry of English Composition out.


Since when are we reviewing reviews?


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


Re: [libav-devel] [2/2] libschroedingerdec: Use SchroTag to store pts

2012-04-15 Thread Mashiat Sarker Shakkhar

On 4/13/2012 11:42 PM, Jordi Ortiz wrote:

---
  libavcodec/libschroedingerdec.c |  117 +--
  1 file changed, 50 insertions(+), 67 deletions(-)


diff --git a/libavcodec/libschroedingerdec.c b/libavcodec/libschroedingerdec.c
index 5911d8a..60b7f8e 100644
--- a/libavcodec/libschroedingerdec.c
+++ b/libavcodec/libschroedingerdec.c
@@ -40,12 +40,11 @@
  #include
  #include

-
  /** SchroFrame and Pts relation*/
-typedef struct SchroFrameWithPts {
-SchroFrame *frame;
-uint64_t pts;
-} SchroFrameWithPts;
+typedef struct SchroFrameWithPts{
+ SchroFrame *frame;
+ uint64_t pts;
+}SchroFrameWithPts;


Why?



  /** libschroedinger decoder private data */
  typedef struct SchroDecoderParams {
@@ -70,9 +69,7 @@ typedef struct SchroDecoderParams {
  /** decoded picture */
  AVFrame dec_frame;

-/** SchroFrame Pts relation*/
-SchroFrameWithPts framewithptslst[3];
-


You added it in 1/2. If you don't need it, why not remove it from 1/2 in 
the first place? You cannot add code just to remove it in a later patch 
in the patch-series.



+/** stores the last positive pts*/
  int64_t lastPTS;
  } SchroDecoderParams;

@@ -146,7 +143,7 @@ static enum PixelFormat get_chroma_format(SchroChromaFormat 
schro_pix_fmt)

  static av_cold int libschroedinger_decode_init(AVCodecContext *avccontext)
  {
-
+int idx;


Cosmetic change mixed with functional change.


  SchroDecoderParams *p_schro_params = avccontext->priv_data;
  /* First of all, initialize our supporting libraries. */
  schro_init();
@@ -158,11 +155,6 @@ static av_cold int 
libschroedinger_decode_init(AVCodecContext *avccontext)
  if (!p_schro_params->decoder)
  return -1;

-p_schro_params->framewithptslst[0].frame = NULL;
-p_schro_params->framewithptslst[1].frame = NULL;
-p_schro_params->framewithptslst[2].frame = NULL;
-
-


Again, you just added them in 1/2.


  /* Initialize the decoded frame queue. */
  ff_dirac_schro_queue_init(&p_schro_params->dec_frame_queue);
  return 0;
@@ -210,9 +202,8 @@ static void 
libschroedinger_handle_first_access_unit(AVCodecContext *avccontext)
  avccontext->time_base.den = p_schro_params->format->frame_rate_numerator;
  avccontext->time_base.num = 
p_schro_params->format->frame_rate_denominator;

-if (!p_schro_params->dec_frame.data[0]) {
+if (!p_schro_params->dec_frame.data[0])
  avccontext->get_buffer(avccontext,&p_schro_params->dec_frame);
-}


Cosmetics. Does not belong in this patch.


  }

  static int libschroedinger_decode_frame(AVCodecContext *avccontext,
@@ -220,22 +211,22 @@ static int libschroedinger_decode_frame(AVCodecContext 
*avccontext,
  AVPacket *avpkt)
  {
  const uint8_t *buf = avpkt->data;
-int buf_size = avpkt->size;
-int64_t pts = avpkt->pts;
+int buf_size   = avpkt->size;
+int64_t pts= avpkt->pts;


Same as above.


+
+SchroTag *tag;

  SchroDecoderParams *p_schro_params = avccontext->priv_data;
  SchroDecoder *decoder = p_schro_params->decoder;
-// REMOVE AVPicture *picture = data;


Remove the corresponding addition from 1/2 instead.


  SchroBuffer *enc_buf;
  SchroFrame* frame;
  int state;
  int go = 1;
  int outer = 1;
  SchroParseUnitContext parse_ctx;
-int framewithpts_idx = 0;


I don't understand why do you insist on adding code in 1/2 and removing 
them in 2/2. Has it been recommended to you by someone. As far as I 
know, Libav does not allow code to be added just to be removed again in 
the same patch series. Please clarify any confusion on IRC.



-/ avccontext->coded_frame->pkt_pts = pts;
-av_log(avccontext,AV_LOG_DEBUG,"PTS: %ld Size: %d\n",pts,buf_size);
-if (pts>= 0)
+SchroFrameWithPts *framewithpts = NULL;
+
+if(pts>= 0)
  p_schro_params->lastPTS = pts;



The above lines has all the issues that I have pointed earlier. So I 
won't reiterate.



  *data_size = 0;
@@ -251,6 +242,12 @@ static int libschroedinger_decode_frame(AVCodecContext 
*avccontext,
  /* Loop through all the individual parse units in the input buffer */
  do {
  if ((enc_buf = FindNextSchroParseUnit(&parse_ctx))) {
+
+/* Set Schrotag with the pts to be recovered after decoding*/
+enc_buf->tag =
+schro_tag_new((uint64_t)av_malloc(sizeof(uint64_t)),av_free);
+*((uint64_t*)enc_buf->tag->value) = p_schro_params->lastPTS;


It should probably be (uint64_t *).


+
  /* Push buffer into decoder. */
  if (SCHRO_PARSE_CODE_IS_PICTURE(enc_buf->data[4])&&
  SCHRO_PARSE_CODE_NUM_REFS(enc_buf->data[4])>  0)
@@ -280,26 +277,23 @@ static int libschroedinger_decode_frame(AVCodecContext 
*avccontext,
  frame = ff_create_schro_frame(avccontext,
p_schro_params->frame_for

Re: [libav-devel] [1/2] libschroedingerdec: Change AVPicture to AVFrame

2012-04-15 Thread Mashiat Sarker Shakkhar

Hi

Please note that my review is mostly non-technical.

On 4/13/2012 11:42 PM, Jordi Ortiz wrote:

---
  libavcodec/libschroedingerdec.c |   93 +++
  1 file changed, 74 insertions(+), 19 deletions(-)


diff --git a/libavcodec/libschroedingerdec.c b/libavcodec/libschroedingerdec.c
index 184e8cb..5911d8a 100644
--- a/libavcodec/libschroedingerdec.c
+++ b/libavcodec/libschroedingerdec.c
@@ -40,6 +40,13 @@
  #include
  #include

+
+/** SchroFrame and Pts relation*/


There should be a space after relation.


+typedef struct SchroFrameWithPts {
+SchroFrame *frame;
+uint64_t pts;
+} SchroFrameWithPts;
+
  /** libschroedinger decoder private data */
  typedef struct SchroDecoderParams {
  /** Schroedinger video format */
@@ -61,7 +68,12 @@ typedef struct SchroDecoderParams {
  int eos_pulled;

  /** decoded picture */
-AVPicture dec_pic;
+AVFrame dec_frame;
+
+/** SchroFrame Pts relation*/


Same as above.


+SchroFrameWithPts framewithptslst[3];
+
+int64_t lastPTS;
  } SchroDecoderParams;

  typedef struct SchroParseUnitContext {
@@ -146,6 +158,11 @@ static av_cold int 
libschroedinger_decode_init(AVCodecContext *avccontext)
  if (!p_schro_params->decoder)
  return -1;

+p_schro_params->framewithptslst[0].frame = NULL;
+p_schro_params->framewithptslst[1].frame = NULL;
+p_schro_params->framewithptslst[2].frame = NULL;
+
+
  /* Initialize the decoded frame queue. */
  ff_dirac_schro_queue_init(&p_schro_params->dec_frame_queue);
  return 0;
@@ -170,7 +187,8 @@ static void 
libschroedinger_handle_first_access_unit(AVCodecContext *avccontext)
  p_schro_params->format = schro_decoder_get_video_format(decoder);

  /* Tell Libav about sequence details. */


Do you mean s/Libav/libavcodec/ ?


-if (av_image_check_size(p_schro_params->format->width, 
p_schro_params->format->height,
+if (av_image_check_size(p_schro_params->format->width,
+p_schro_params->format->height,
  0, avccontext)<  0) {


This one is cosmetic change. Does not belong in this patch.


  av_log(avccontext, AV_LOG_ERROR, "invalid dimensions (%dx%d)\n",
 p_schro_params->format->width, p_schro_params->format->height);
@@ -192,11 +210,9 @@ static void 
libschroedinger_handle_first_access_unit(AVCodecContext *avccontext)
  avccontext->time_base.den = p_schro_params->format->frame_rate_numerator;
  avccontext->time_base.num = 
p_schro_params->format->frame_rate_denominator;

-if (!p_schro_params->dec_pic.data[0])
-avpicture_alloc(&p_schro_params->dec_pic,
-avccontext->pix_fmt,
-avccontext->width,
-avccontext->height);
+if (!p_schro_params->dec_frame.data[0]) {
+avccontext->get_buffer(avccontext,&p_schro_params->dec_frame);
+}
  }



One question - why don't you use "avctx" (instead of "avccontext") like 
the rest of the decoders?



  static int libschroedinger_decode_frame(AVCodecContext *avccontext,
@@ -205,16 +221,22 @@ static int libschroedinger_decode_frame(AVCodecContext 
*avccontext,
  {
  const uint8_t *buf = avpkt->data;
  int buf_size = avpkt->size;
+int64_t pts = avpkt->pts;

  SchroDecoderParams *p_schro_params = avccontext->priv_data;
  SchroDecoder *decoder = p_schro_params->decoder;
-AVPicture *picture = data;
+// REMOVE AVPicture *picture = data;


What does this mean? Please don't leave note to self in submitted 
patches. Commented out code is not allowed either.



  SchroBuffer *enc_buf;
  SchroFrame* frame;


Nit: since you are making some cosmetic changes, please fix the above 
and make it a part of your cosmetic patch.



  int state;
  int go = 1;
  int outer = 1;
  SchroParseUnitContext parse_ctx;
+int framewithpts_idx = 0;
+/ avccontext->coded_frame->pkt_pts = pts;


Again, commented out code is not allowed.


+av_log(avccontext,AV_LOG_DEBUG,"PTS: %ld Size: %d\n",pts,buf_size);


Do we use %ld for int64_t? avplay.c uses PRId64 for pts and dts. Please 
discuss this with someone who can give definite answer.


The above line also has cosmetic issues.


+if (pts>= 0)
+p_schro_params->lastPTS = pts;


You need a space _before_ and after an operator.



  *data_size = 0;

@@ -258,15 +280,26 @@ static int libschroedinger_decode_frame(AVCodecContext 
*avccontext,
  frame = ff_create_schro_frame(avccontext,
p_schro_params->frame_format);
  schro_decoder_add_output_picture(decoder, frame);
+//Add relation between schroframe and pts


Need a space after //.


+av_log(avccontext,AV_LOG_DEBUG,
+   "PUSH PTS: %ld lastPTS: %ld Frame: %d\n",
+   pts,p_schro_params->lastPTS,frame);


See above regarding %l

[libav-devel] [PATCH 4/4] WMAL: Cosmetics

2012-04-13 Thread Mashiat Sarker Shakkhar
The alignment does not look good after dropping seekable_frame_in_packet.
---
 libavcodec/wmalosslessdec.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index f2e1c70..aaf71c8 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -1174,9 +1174,9 @@ static int decode_packet(AVCodecContext *avctx, void 
*data, int *got_frame_ptr,
 
 /* parse packet header */
 init_get_bits(gb, buf, s->buf_bit_size);
-packet_sequence_number   = get_bits(gb, 4);
+packet_sequence_number = get_bits(gb, 4);
 skip_bits(gb, 1);   // Skip seekable_frame_in_packet, currently 
ununused
-spliced_packet   = get_bits1(gb);
+spliced_packet = get_bits1(gb);
 if (spliced_packet)
 av_log_missing_feature(avctx, "Bitstream splicing", 1);
 
-- 
1.7.5.4

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


[libav-devel] [PATCH 3/4] WMAL: Warn about missing bitstream splicing feature and ask for sample

2012-04-13 Thread Mashiat Sarker Shakkhar
---
 libavcodec/wmalosslessdec.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 2103f88..f2e1c70 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -1177,6 +1177,8 @@ static int decode_packet(AVCodecContext *avctx, void 
*data, int *got_frame_ptr,
 packet_sequence_number   = get_bits(gb, 4);
 skip_bits(gb, 1);   // Skip seekable_frame_in_packet, currently 
ununused
 spliced_packet   = get_bits1(gb);
+if (spliced_packet)
+av_log_missing_feature(avctx, "Bitstream splicing", 1);
 
 /* get number of bits that need to be added to the previous frame */
 num_bits_prev_frame = get_bits(gb, s->log2_frame_size);
-- 
1.7.5.4

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


[libav-devel] [PATCH 2/4] Skip seekable_frame_in_packet

2012-04-13 Thread Mashiat Sarker Shakkhar
There is no point in storing it in a variable, since it is not used
anywhere else in the decoder.
---
 libavcodec/wmalosslessdec.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 4e2d28b..2103f88 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -1159,8 +1159,7 @@ static int decode_packet(AVCodecContext *avctx, void 
*data, int *got_frame_ptr,
 GetBitContext* gb  = &s->pgb;
 const uint8_t* buf = avpkt->data;
 int buf_size   = avpkt->size;
-int num_bits_prev_frame, packet_sequence_number,
-seekable_frame_in_packet, spliced_packet;
+int num_bits_prev_frame, packet_sequence_number, spliced_packet;
 
 if (s->packet_done || s->packet_loss) {
 s->packet_done = 0;
@@ -1176,7 +1175,7 @@ static int decode_packet(AVCodecContext *avctx, void 
*data, int *got_frame_ptr,
 /* parse packet header */
 init_get_bits(gb, buf, s->buf_bit_size);
 packet_sequence_number   = get_bits(gb, 4);
-seekable_frame_in_packet = get_bits1(gb);
+skip_bits(gb, 1);   // Skip seekable_frame_in_packet, currently 
ununused
 spliced_packet   = get_bits1(gb);
 
 /* get number of bits that need to be added to the previous frame */
-- 
1.7.5.4

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


[libav-devel] [PATCH 1/4] WMAL: Drop unused variable num_possible_block_size

2012-04-13 Thread Mashiat Sarker Shakkhar
This is probably a leftover from WMAP.
---
 libavcodec/wmalosslessdec.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 4eb9ebe..4e2d28b 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -173,7 +173,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 WmallDecodeCtx *s  = avctx->priv_data;
 uint8_t *edata_ptr = avctx->extradata;
 unsigned int channel_mask;
-int i, log2_max_num_subframes, num_possible_block_sizes;
+int i, log2_max_num_subframes;
 
 s->avctx = avctx;
 init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
@@ -225,7 +225,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
 s->max_subframe_len_bit = 0;
 s->subframe_len_bits= av_log2(log2_max_num_subframes) + 1;
 
-num_possible_block_sizes = log2_max_num_subframes + 1;
 s->min_samples_per_subframe  = s->samples_per_frame / s->max_num_subframes;
 s->dynamic_range_compression = s->decode_flags & 0x80;
 s->bV3RTM= s->decode_flags & 0x100;
-- 
1.7.5.4

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


[libav-devel] WMA Lossless cleanup

2012-04-13 Thread Mashiat Sarker Shakkhar
The following patch-series silences some gcc warnings about unused variables.

[PATCH 1/4] WMAL: Drop unused variable num_possible_block_size
[PATCH 2/4] Skip seekable_frame_in_packet
[PATCH 3/4] WMAL: Warn about missing bitstream splicing feature and
[PATCH 4/4] WMAL: Cosmetics
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] WMAL: Do not try to read rawpcm coefficients if bits is invalid

2012-04-13 Thread Mashiat Sarker Shakkhar
From: Michael Niedermayer 

---
 libavcodec/wmalosslessdec.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 4eb9ebe..feea6ef 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -936,6 +936,11 @@ static int decode_subframe(WmallDecodeCtx *s)
 
 if (rawpcm_tile) {
 int bits = s->bits_per_sample - padding_zeroes;
+if (bits <= 0) {
+av_log(s->avctx, AV_LOG_ERROR,
+   "Invalid number of padding bits in raw PCM tile\n");
+return AVERROR_INVALIDDATA;
+}
 av_dlog(s->avctx, "RAWPCM %d bits per sample. "
 "total %d bits, remain=%d\n", bits,
 bits * s->num_channels * subframe_len, get_bits_count(&s->gb));
-- 
1.7.5.4

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


[libav-devel] [PATCH] WMAL: Do not try to read rawpcm coefficients if bits is invalid

2012-04-13 Thread Mashiat Sarker Shakkhar
From: Michael Niedermayer 

---
 libavcodec/wmalosslessdec.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 4eb9ebe..3682d05 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -936,6 +936,10 @@ static int decode_subframe(WmallDecodeCtx *s)
 
 if (rawpcm_tile) {
 int bits = s->bits_per_sample - padding_zeroes;
+if (bits <= 0) {
+av_log(s->avctx, AV_LOG_ERROR, "rawpcm_tile bits invalid\n");
+return AVERROR_INVALIDDATA;
+}
 av_dlog(s->avctx, "RAWPCM %d bits per sample. "
 "total %d bits, remain=%d\n", bits,
 bits * s->num_channels * subframe_len, get_bits_count(&s->gb));
-- 
1.7.5.4

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


Re: [libav-devel] [PATCH] build: Remove the trailing backslash of the last line of Makefiles

2012-04-12 Thread Mashiat Sarker Shakkhar

On 4/12/2012 6:27 PM, Martin Storsjö wrote:

The trailing backslash at the last line allegedly causes
issues for make on msys.
---
  libavcodec/arm/Makefile   |2 +-
  libavcodec/mips/Makefile  |2 +-
  libavcodec/ppc/Makefile   |2 +-
  libavcodec/sparc/Makefile |2 +-
  libavcodec/x86/Makefile   |2 +-
  5 files changed, 5 insertions(+), 5 deletions(-)

[...]

Fixes compilation under msysgit for me.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] avconv: allow '-async -1' to disable timestamp sync for audio encoding

2012-04-08 Thread Mashiat Sarker Shakkhar

On 4/9/2012 1:08 AM, Justin Ruggles wrote:

This will allow a workaround for cases where input timestamps are invalid or
when decoder delay of 1 packet or more confuses avconv into using the wrong
timestamps as a sync reference.
---
  avconv.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

[...]

Fixes decoding of luckynight.wma for me, but I hope this is just 
temporary and a real fix (which won't require -async -1) is on the way too.


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


Re: [libav-devel] Interested in GSoC with libav!

2012-03-30 Thread Mashiat Sarker Shakkhar

On 3/31/2012 3:07 AM, Mike Melanson wrote:
[...]

I'm reading for a Bachelor's Degree in Computer Science. I'm interested
in taking part in this year's Google Summer of Code and your project has
especially caught my attention (specifically the HEVC/H265 decoder with
Mr. Bultje). I apologise for not sending an e-mail earlier but I was
abroad and I did not have any internet access.


I'm somewhat opposed to the HEVC decoder effort (as a GSoC project), but I
still appreciate the ambition.


Why? Do you think it's not appropriate as a GSoC project? Or is it 
because the standard is a bit premature?


[...]

Review this list and find a task that looks fun/interesting:

http://wiki.multimedia.cx/index.php?title=Small_FFmpeg_Tasks

Tell us which one you would like to work on so we can avoid overlap with
other people. The qualification task is what we care most about at this
phase (Google will care about your proper documents and information).

[...]

That's not the qualification task for HEVC set by Ronald for the rest of 
the students.

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


Re: [libav-devel] [PATCH] WMAL: Remove inaccurate and unnecessary doxy

2012-03-29 Thread Mashiat Sarker Shakkhar

On 3/29/2012 2:04 PM, Kostya Shishkov wrote:

On Thu, Mar 29, 2012 at 10:35:25AM +0300, Martin Storsjö wrote:

On Thu, 29 Mar 2012, Diego Biurrun wrote:


On Wed, Mar 28, 2012 at 11:12:13AM -0700, Mashiat Sarker Shakkhar wrote:

A call to decode_packet() does not always decode
a complete WMA packet. Moreover, this is not the
correct place to document calls that are part of
the public API.


Please don't limit yourself to 48 characters of line length in log
messages, use the full 80.  This saves lines, which keeps the log
manageable.


Many actually argue for keeping the body of the commit message below
72 instead of 80 chars. One of the reasons is that git show/log and
a number of other commands show the message indented.


Or we can switch to East Asian way and write in columns.


I use git gui to commit stuffs, does anyone know how to automagically 
limit the number of characters in a line using git gui? At least if it 
showed me a marker or column number, it would have been very helpful. 
Right now I have to break lines manually without any hint about the 
length of the line. So I tend to do it randomly ...

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


[libav-devel] [PATCH] WMAL: Remove inaccurate and unnecessary doxy

2012-03-28 Thread Mashiat Sarker Shakkhar
A call to decode_packet() does not always decode
a complete WMA packet. Moreover, this is not the
correct place to document calls that are part of
the public API.
---
 libavcodec/wmalosslessdec.c |8 
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 3ee6285..4eb9ebe 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -1153,14 +1153,6 @@ static void save_bits(WmallDecodeCtx *s, GetBitContext* 
gb, int len,
 skip_bits(&s->gb, s->frame_offset);
 }
 
-/**
- * @brief Decode a single WMA packet.
- * @param avctx codec context
- * @param data  the output buffer
- * @param data_size number of bytes that were written to the output buffer
- * @param avpkt input packet
- * @return number of bytes that were read from the input buffer
- */
 static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr,
  AVPacket* avpkt)
 {
-- 
1.7.5.4

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


Re: [libav-devel] [PATCH] asf: only set index_read if the index contained entries.

2012-03-28 Thread Mashiat Sarker Shakkhar

On 3/28/2012 11:36 PM, Ronald S. Bultje wrote:

From: "Ronald S. Bultje"

This allows falling back to a binary search if the file contains no
index, thus fixing seeking in such files (e.g. luckynight.wma).
---
  libavformat/asfdec.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index d3869b4..f094647 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -1235,7 +1235,7 @@ static void asf_build_simple_index(AVFormatContext *s, 
int stream_index)
  last_pos=pos;
  }
  }
-asf->index_read= 1;
+asf->index_read= ict>  0;
  }
  avio_seek(s->pb, current_pos, SEEK_SET);
  }


+1.

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


Re: [libav-devel] [PATCH] wmall: fix seeking.

2012-03-28 Thread Mashiat Sarker Shakkhar

On 3/28/2012 11:21 PM, Ronald S. Bultje wrote:

Hi,

On Wed, Mar 28, 2012 at 8:51 AM, Mashiat Sarker Shakkhar
  wrote:

On 3/28/2012 8:06 PM, Ronald S. Bultje wrote:


---
  libavcodec/wmalosslessdec.c |   13 +
  1 files changed, 13 insertions(+), 0 deletions(-)


[...]

This does not fix seeking for me, at least not with avplay. I thought I had
already reported the issue. Benjamin and Kostya, can you seek to anywhere in
the stream after this patch? I can seek to only 1 or 2 places - even that is
inaccurate.


That's a bug in the asf demuxer, this patch fixes it:

diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index d3869b4..f094647 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -1235,7 +1235,7 @@ static void
asf_build_simple_index(AVFormatContext *s, int stream_index)
  last_pos=pos;
  }
  }
-asf->index_read= 1;
+asf->index_read= ict>  0;
  }
  avio_seek(s->pb, current_pos, SEEK_SET);
  }

Ronald


Great fix! Finally a solution. Much appreciated.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] wmall: fix seeking.

2012-03-28 Thread Mashiat Sarker Shakkhar

On 3/28/2012 8:06 PM, Ronald S. Bultje wrote:

---
  libavcodec/wmalosslessdec.c |   13 +
  1 files changed, 13 insertions(+), 0 deletions(-)


[...]

This does not fix seeking for me, at least not with avplay. I thought I 
had already reported the issue. Benjamin and Kostya, can you seek to 
anywhere in the stream after this patch? I can seek to only 1 or 2 
places - even that is inaccurate.


I object to committing this unless a report comes from someone claiming 
that he has actually tested this patch with avplay and seeking is accurate.

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


Re: [libav-devel] [PATCH] wmalossless: error out on invalid values for order.

2012-03-21 Thread Mashiat Sarker Shakkhar

On 3/22/2012 1:41 AM, Ronald S. Bultje wrote:

From: "Ronald S. Bultje"

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-sta...@libav.org
---
  libavcodec/wmalosslessdec.c |   34 +-
  1 file changed, 25 insertions(+), 9 deletions(-)

[...]

  reset_codec(s);
+} else if (!s->cdlms[0][0].order) {
+av_log(s->avctx, AV_LOG_DEBUG,
+   "Waiting for seekable tile\n");
+return -1;


What has the order of CDLMS filter got anything to do with seekable tile?

[...]

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


Re: [libav-devel] [PATCH] VC1: Do not read from array if index is invalid

2012-03-19 Thread Mashiat Sarker Shakkhar

On 3/20/2012 5:52 AM, Ronald S. Bultje wrote:

From: Mashiat Sarker Shakkhar

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-sta...@libav.org
Signed-off-by: Ronald S. Bultje
---
  libavcodec/vc1.c|2 +-
  libavcodec/vc1dec.c |   36 +---
  2 files changed, 30 insertions(+), 8 deletions(-)


[...]

Patch author doesn't look correct to me, otherwise looks OK.

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


Re: [libav-devel] [PATCH 2/2] dxva2_vc1: pass the overlap flag to the decoder

2012-03-12 Thread Mashiat Sarker Shakkhar

On 3/12/2012 4:51 PM, Anton Khirnov wrote:

From: Hendrik Leppkes

Signed-off-by: Anton Khirnov
---
  libavcodec/dxva2_vc1.c |3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c
index 53c205e..2b0480b 100644
--- a/libavcodec/dxva2_vc1.c
+++ b/libavcodec/dxva2_vc1.c
@@ -101,7 +101,8 @@ static void fill_picture_parameters(AVCodecContext *avctx,
(v->rangered<<  3) |
(s->max_b_frames   );
  pp->bPicExtrapolation   = (!v->interlace || v->fcm == PROGRESSIVE) ? 
1 : 2;
-pp->bPicDeblocked   = ((v->profile != PROFILE_ADVANCED&&  
v->rangeredfrm)<<  5) |
+pp->bPicDeblocked   = ((!pp->bPicBackwardPrediction&&  
v->overlap)<<  6) |
+  ((v->profile != PROFILE_ADVANCED&&  
v->rangeredfrm)<<  5) |
(s->loop_filter<<  1);
  pp->bPicDeblockConfined = (v->postprocflag<<  7) |
(v->broadcast<<  6) |


Checked the dxva WMV documentation, patch looks good to me.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/2] dxva2_vc1: fix decoding of BI frames

2012-03-12 Thread Mashiat Sarker Shakkhar

On 3/12/2012 4:51 PM, Anton Khirnov wrote:

From: Hendrik Leppkes

Signed-off-by: Anton Khirnov
---
  libavcodec/dxva2_vc1.c |8 
  1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c
index 64447ad..53c205e 100644
--- a/libavcodec/dxva2_vc1.c
+++ b/libavcodec/dxva2_vc1.c
@@ -42,11 +42,11 @@ static void fill_picture_parameters(AVCodecContext *avctx,
  memset(pp, 0, sizeof(*pp));
  pp->wDecodedPictureIndex=
  pp->wDeblockedPictureIndex  = ff_dxva2_get_surface_index(ctx, 
current_picture);
-if (s->pict_type != AV_PICTURE_TYPE_I)
+if (s->pict_type != AV_PICTURE_TYPE_I&&  !v->bi_type)
  pp->wForwardRefPictureIndex = 
ff_dxva2_get_surface_index(ctx,&s->last_picture);
  else
  pp->wForwardRefPictureIndex = 0x;
-if (s->pict_type == AV_PICTURE_TYPE_B)
+if (s->pict_type == AV_PICTURE_TYPE_B&&  !v->bi_type)
  pp->wBackwardRefPictureIndex = 
ff_dxva2_get_surface_index(ctx,&s->next_picture);
  else
  pp->wBackwardRefPictureIndex = 0x;
@@ -69,8 +69,8 @@ static void fill_picture_parameters(AVCodecContext *avctx,
  if (s->picture_structure&  PICT_BOTTOM_FIELD)
  pp->bPicStructure  |= 0x02;
  pp->bSecondField= v->interlace&&  v->fcm != ILACE_FIELD&&  
!s->first_field;
-pp->bPicIntra   = s->pict_type == AV_PICTURE_TYPE_I;
-pp->bPicBackwardPrediction  = s->pict_type == AV_PICTURE_TYPE_B;
+pp->bPicIntra   = s->pict_type == AV_PICTURE_TYPE_I || 
v->bi_type;
+pp->bPicBackwardPrediction  = s->pict_type == AV_PICTURE_TYPE_B&&  
!v->bi_type;
  pp->bBidirectionalAveragingMode = (1<<  7) |
((ctx->cfg->ConfigIntraResidUnsigned != 
0)<<  6) |
((ctx->cfg->ConfigResidDiffAccelerator != 
0)<<  5) |


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


  1   2   >