[libav-devel] [PATCH] vp8: remove pointless goto

2014-03-26 Thread Vittorio Giovara
---
 libavcodec/vp8.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 30e24cc..5d41704 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -1428,7 +1428,7 @@ static av_always_inline void idct_mb(VP8Context *s, 
VP8ThreadData *td,
 s->vp8dsp.vp8_idct_add(ch_dst+4*x, 
td->block[4+ch][(y<<1)+x], s->uvlinesize);
 nnz4 >>= 8;
 if (!nnz4)
-goto chroma_idct_end;
+return;
 }
 ch_dst += 4*s->uvlinesize;
 }
@@ -1436,7 +1436,6 @@ static av_always_inline void idct_mb(VP8Context *s, 
VP8ThreadData *td,
 s->vp8dsp.vp8_idct_dc_add4uv(ch_dst, td->block[4+ch], 
s->uvlinesize);
 }
 }
-chroma_idct_end: ;
 }
 }
 
-- 
1.8.3.4 (Apple Git-47)

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


Re: [libav-devel] [PATCH 2/3] On2 VP7 decoder

2014-03-26 Thread Vittorio Giovara
On Wed, Mar 26, 2014 at 7:26 PM, Diego Biurrun  wrote:
> On Wed, Mar 26, 2014 at 05:48:53PM +0100, Vittorio Giovara wrote:
>> --- a/configure
>> +++ b/configure
>> @@ -1846,6 +1846,7 @@ vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp"
>>  vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp"
>>  vp6a_decoder_select="vp6_decoder"
>>  vp6f_decoder_select="vp6_decoder"
>> +vp7_decoder_select="h264pred videodsp"
>>  vp8_decoder_select="h264pred videodsp"
>
> How much code is actually shared?  It might make sense to have one decoder
> select the other.

A lot, VP7 is basically a subset of VP8 and some bug^Wfeatures

>> --- a/libavcodec/vp8dsp.c
>> +++ b/libavcodec/vp8dsp.c
>> @@ -348,7 +482,7 @@ PUT_PIXELS(4)
>>  cm[(F[2] * src[x + 0 * stride] - F[1] * src[x - 1 * stride] +   
>>   \
>>  F[3] * src[x + 1 * stride] - F[4] * src[x + 2 * stride] + 64) >> 7]
>>
>> -#define VP8_EPEL_H(SIZE, TAPS)  
>>   \
>> +#define VP8_EPEL_H(SIZE, TAPS) \
>>  static void put_vp8_epel ## SIZE ## _h ## TAPS ## _c(uint8_t *dst,  
>>   \
>>   ptrdiff_t 
>> dststride, \
>>   uint8_t *src,  
>>   \
>> @@ -397,7 +531,6 @@ PUT_PIXELS(4)
>>  uint8_t tmp_array[(2 * SIZE + VTAPS - 1) * SIZE];   
>>   \
>>  uint8_t *tmp = tmp_array;   
>>   \
>>  src -= (2 - (VTAPS == 4)) * srcstride;  
>>   \
>> -
>>   \
>>  for (y = 0; y < h + VTAPS - 1; y++) {   
>>   \
>>  for (x = 0; x < SIZE; x++)  
>>   \
>>  tmp[x] = FILTER_ ## HTAPS ## TAP(src, filter, 1);   
>>   \
>> @@ -406,7 +539,6 @@ PUT_PIXELS(4)
>>  }   
>>   \
>>  tmp= tmp_array + (2 - (VTAPS == 4)) * SIZE; 
>>   \
>>  filter = subpel_filters[my - 1];
>>   \
>> -
>>   \
>>  for (y = 0; y < h; y++) {   
>>   \
>>  for (x = 0; x < SIZE; x++)  
>>   \
>>  dst[x] = FILTER_ ## VTAPS ## TAP(tmp, filter, SIZE);
>>   \
>> @@ -441,7 +573,7 @@ VP8_EPEL_HV(16, 6, 6)
>>  VP8_EPEL_HV( 8, 6, 6)
>>  VP8_EPEL_HV( 4, 6, 6)
>>
>> -#define VP8_BILINEAR(SIZE)  
>>   \
>> +#define VP8_BILINEAR(SIZE) \
>>  static void put_vp8_bilinear ## SIZE ## _h_c(uint8_t *dst, ptrdiff_t 
>> dstride, \
>>   uint8_t *src, ptrdiff_t 
>> sstride, \
>>   int h, int mx, int my) 
>>   \
>> @@ -496,7 +628,7 @@ VP8_BILINEAR(16)
>>  VP8_BILINEAR(8)
>>  VP8_BILINEAR(4)
>>
>> -#define VP8_MC_FUNC(IDX, SIZE) \
>> +#define VP8_MC_FUNC(IDX, SIZE)  
>>   \
>>  dsp->put_vp8_epel_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; 
>>   \
>>  dsp->put_vp8_epel_pixels_tab[IDX][0][1] = put_vp8_epel ## SIZE ## 
>> _h4_c;  \
>>  dsp->put_vp8_epel_pixels_tab[IDX][0][2] = put_vp8_epel ## SIZE ## 
>> _h6_c;  \
>> @@ -507,7 +639,7 @@ VP8_BILINEAR(4)
>>  dsp->put_vp8_epel_pixels_tab[IDX][2][1] = put_vp8_epel ## SIZE ## 
>> _h4v6_c; \
>>  dsp->put_vp8_epel_pixels_tab[IDX][2][2] = put_vp8_epel ## SIZE ## 
>> _h6v6_c
>>
>> -#define VP8_BILINEAR_MC_FUNC(IDX, SIZE) \
>> +#define VP8_BILINEAR_MC_FUNC(IDX, SIZE) 
>>   \
>>  dsp->put_vp8_bilinear_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## 
>> _c; \
>>  dsp->put_vp8_bilinear_pixels_tab[IDX][0][1] = put_vp8_bilinear ## SIZE 
>> ## _h_c; \
>>  dsp->put_vp8_bilinear_pixels_tab[IDX][0][2] = put_vp8_bilinear ## SIZE 
>> ## _h_c; \
>
> Please self-review for stray changes.

This is a result of a bad fixup sorry.

>
>> @@ -518,27 +650,35 @@ VP8_BILINEAR(4)
>>
>> -av_cold void ff_vp8dsp_init(VP8DSPContext *dsp)
>> +av_cold void ff_vp8dsp_init(VP8DSPContext *dsp, int vp7)
>
> Why don't you split the dsp stuff in two and call just one or both of
> ff_vp8dsp_init() and ff_vp8dsp_init()?

I'm not sure I understand. You'd prefer a single separate
ff_vp7dsp_init() and ff_vp8dsp_init() or a single ff_vp78dsp_init()
that calls the relevant parts of the dsp?
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/3] On2 VP7 decoder

2014-03-26 Thread Vittorio Giovara
On Wed, Mar 26, 2014 at 7:00 PM, Luca Barbato  wrote:
> On 26/03/14 17:48, Vittorio Giovara wrote:
>
> Test on arm and fix the two typos ^^;

Locally amended, thanks

>
> Beside that
>
>> -#define HOR_VP8_PRED  11///< unaveraged version of #HOR_PRED, 
>> see
>> +#define HOR_VP8_PRED  14///< unaveraged version of #HOR_PRED, 
>> see
>
> Is a little strange.

Indeed, my interpretation of
http://ffmpeg.org/pipermail/ffmpeg-devel/2014-February/154100.html is
that it increases the size of the function pointer array to fit the
additional vp7 calls.
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/3] vp8: K&R formatting cosmetics

2014-03-26 Thread Vittorio Giovara
On Wed, Mar 26, 2014 at 8:39 PM, Diego Biurrun  wrote:
> On Wed, Mar 26, 2014 at 05:48:52PM +0100, Vittorio Giovara wrote:
>> --- a/libavcodec/vp8.c
>> +++ b/libavcodec/vp8.c
>> @@ -437,7 +451,8 @@ static int decode_frame_header(VP8Context *s, const 
>> uint8_t *buf, int buf_size)
>>
>> -static av_always_inline void clamp_mv(VP8Context *s, VP56mv *dst, const 
>> VP56mv *src)
>> +static av_always_inline
>> +void clamp_mv(VP8Context *s, VP56mv *dst, const VP56mv *src)
>
> We mostly break this at the comma.

well the "style" of the file seemed to prefer having attributes on a
separate line, and this helps in not breaking arguments of the
function.

>> @@ -1411,36 +1457,41 @@ static av_always_inline void idct_mb(VP8Context *s, 
>> VP8ThreadData *td,
>>  }
>>  }
>> -chroma_idct_end: ;
>> +chroma_idct_end:;
>
> WTH?
>
> I suggest (separately) dropping this empty statement.
>

Will do.

>> @@ -299,184 +312,198 @@ static void vp8_h_loop_filter_simple_c(uint8_t *dst, 
>> ptrdiff_t stride, int flim)
>>  #define VP8_MC_FUNC(IDX, SIZE) \
>> -dsp->put_vp8_epel_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; 
>> \
>> -dsp->put_vp8_epel_pixels_tab[IDX][0][1] = put_vp8_epel ## SIZE ## 
>> _h4_c; \
>> -dsp->put_vp8_epel_pixels_tab[IDX][0][2] = put_vp8_epel ## SIZE ## 
>> _h6_c; \
>> -dsp->put_vp8_epel_pixels_tab[IDX][1][0] = put_vp8_epel ## SIZE ## 
>> _v4_c; \
>> +dsp->put_vp8_epel_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; 
>>   \
>> +dsp->put_vp8_epel_pixels_tab[IDX][0][1] = put_vp8_epel ## SIZE ## 
>> _h4_c;  \
>> +dsp->put_vp8_epel_pixels_tab[IDX][0][2] = put_vp8_epel ## SIZE ## 
>> _h6_c;  \
>> +dsp->put_vp8_epel_pixels_tab[IDX][1][0] = put_vp8_epel ## SIZE ## 
>> _v4_c;  \
>>  dsp->put_vp8_epel_pixels_tab[IDX][1][1] = put_vp8_epel ## SIZE ## 
>> _h4v4_c; \
>>  dsp->put_vp8_epel_pixels_tab[IDX][1][2] = put_vp8_epel ## SIZE ## 
>> _h6v4_c; \
>> -dsp->put_vp8_epel_pixels_tab[IDX][2][0] = put_vp8_epel ## SIZE ## 
>> _v6_c; \
>> +dsp->put_vp8_epel_pixels_tab[IDX][2][0] = put_vp8_epel ## SIZE ## 
>> _v6_c;  \
>>  dsp->put_vp8_epel_pixels_tab[IDX][2][1] = put_vp8_epel ## SIZE ## 
>> _h4v6_c; \
>>  dsp->put_vp8_epel_pixels_tab[IDX][2][2] = put_vp8_epel ## SIZE ## 
>> _h6v6_c
>
> Either align the \ or don't change it.

The \ are now aligned on the 79th column or the closest possible
location, and this is valid for the whole file.

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


Re: [libav-devel] [PATCH 3/3] fate: add a VP7 test

2014-03-26 Thread Vittorio Giovara
On Wed, Mar 26, 2014 at 7:06 PM, Diego Biurrun  wrote:
> On Wed, Mar 26, 2014 at 05:48:54PM +0100, Vittorio Giovara wrote:
>> --- a/tests/fate/vpx.mak
>> +++ b/tests/fate/vpx.mak
>> @@ -25,6 +25,9 @@ fate-vp6f: CMD = framecrc -flags +bitexact -i 
>> $(TARGET_SAMPLES)/flash-vp6/clip10
>>
>> +FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, VP7) += fate-vp7
>> +fate-vp7: CMD = framecrc -flags +bitexact -i 
>> $(TARGET_SAMPLES)/vp7/potter-40.vp7 -frames 300 -an
>
> .vp7 is avi?

Yes it is. Maybe 300 frames is slightly high for this kind of test,
i'll shorten it.

If anyone has suggestions on adding test files please feel free to do so.
Vittorio

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



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


[libav-devel] [PATCH] fate: add BRender PIX tests

2014-03-26 Thread Vittorio Giovara
---
 tests/fate/image.mak | 19 +++
 tests/ref/fate/brenderpix-24 |  2 ++
 tests/ref/fate/brenderpix-565|  2 ++
 tests/ref/fate/brenderpix-defpal |  2 ++
 tests/ref/fate/brenderpix-intpal |  2 ++
 tests/ref/fate/brenderpix-y400a  |  2 ++
 6 files changed, 29 insertions(+)
 create mode 100644 tests/ref/fate/brenderpix-24
 create mode 100644 tests/ref/fate/brenderpix-565
 create mode 100644 tests/ref/fate/brenderpix-defpal
 create mode 100644 tests/ref/fate/brenderpix-intpal
 create mode 100644 tests/ref/fate/brenderpix-y400a

diff --git a/tests/fate/image.mak b/tests/fate/image.mak
index d035978..7bc5161 100644
--- a/tests/fate/image.mak
+++ b/tests/fate/image.mak
@@ -8,6 +8,25 @@ FATE_ALIASPIX-$(call DEMDEC, IMAGE2, ALIAS_PIX) += 
$(FATE_ALIASPIX)
 FATE_SAMPLES_AVCONV += $(FATE_ALIASPIX-yes)
 fate-aliaspix: $(FATE_ALIASPIX-yes)
 
+FATE_BRENDERPIX += fate-brenderpix-24
+fate-brenderpix-24: CMD = framecrc -c:v brender_pix -i 
$(TARGET_SAMPLES)/brenderpix/sbwheel.pix
+
+FATE_BRENDERPIX += fate-brenderpix-565
+fate-brenderpix-565: CMD = framecrc -c:v brender_pix -i 
$(TARGET_SAMPLES)/brenderpix/maximafront.pix
+
+FATE_BRENDERPIX += fate-brenderpix-defpal
+fate-brenderpix-defpal: CMD = framecrc -c:v brender_pix -i 
$(TARGET_SAMPLES)/brenderpix/rivrock1.pix
+
+FATE_BRENDERPIX += fate-brenderpix-intpal
+fate-brenderpix-intpal: CMD = framecrc -c:v brender_pix -i 
$(TARGET_SAMPLES)/brenderpix/testtex.pix
+
+FATE_BRENDERPIX += fate-brenderpix-y400a
+fate-brenderpix-y400a: CMD = framecrc -c:v brender_pix -i 
$(TARGET_SAMPLES)/brenderpix/gears.pix
+
+FATE_BRENDERPIX-$(call DEMDEC, IMAGE2, BRENDER_PIX) += $(FATE_BRENDERPIX)
+FATE_SAMPLES_AVCONV += $(FATE_BRENDERPIX-yes)
+fate-brenderpix: $(FATE_BRENDERPIX-yes)
+
 FATE_SAMPLES_AVCONV-$(call DEMDEC, IMAGE2, DPX) += fate-dpx
 fate-dpx: CMD = framecrc -i $(TARGET_SAMPLES)/dpx/lighthouse_rgb48.dpx
 
diff --git a/tests/ref/fate/brenderpix-24 b/tests/ref/fate/brenderpix-24
new file mode 100644
index 000..32b29a0
--- /dev/null
+++ b/tests/ref/fate/brenderpix-24
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0,  0,  0,1,32768, 0x18bc6caa
diff --git a/tests/ref/fate/brenderpix-565 b/tests/ref/fate/brenderpix-565
new file mode 100644
index 000..c243a4c
--- /dev/null
+++ b/tests/ref/fate/brenderpix-565
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0,  0,  0,1,32768, 0xfd855dda
diff --git a/tests/ref/fate/brenderpix-defpal b/tests/ref/fate/brenderpix-defpal
new file mode 100644
index 000..b80d23d
--- /dev/null
+++ b/tests/ref/fate/brenderpix-defpal
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0,  0,  0,1,66560, 0xee71bd50
diff --git a/tests/ref/fate/brenderpix-intpal b/tests/ref/fate/brenderpix-intpal
new file mode 100644
index 000..776b74b
--- /dev/null
+++ b/tests/ref/fate/brenderpix-intpal
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0,  0,  0,1,66560, 0x51a30b0d
diff --git a/tests/ref/fate/brenderpix-y400a b/tests/ref/fate/brenderpix-y400a
new file mode 100644
index 000..00e1540
--- /dev/null
+++ b/tests/ref/fate/brenderpix-y400a
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0,  0,  0,1, 3072, 0x48280456
-- 
1.8.3.4 (Apple Git-47)

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


Re: [libav-devel] [PATCH] fate: add Alias PIX tests

2014-03-26 Thread Vittorio Giovara
On Tue, Mar 25, 2014 at 11:24 AM, Diego Biurrun  wrote:
> On Fri, Mar 21, 2014 at 03:59:29AM +0100, Vittorio Giovara wrote:
>> --- a/tests/fate/image.mak
>> +++ b/tests/fate/image.mak
>> @@ -1,3 +1,9 @@
>> +FATE_SAMPLES_AVCONV-$(call DEMDEC, IMAGE2, ALIAS_PIX) += fate-aliaspix-bgr
>> +fate-aliaspix-bgr: CMD = framecrc -i $(TARGET_SAMPLES)/aliaspix/first.pix 
>> -pix_fmt bgr24
>> +
>> +FATE_SAMPLES_AVCONV-$(call DEMDEC, IMAGE2, ALIAS_PIX) += fate-aliaspix-gray
>> +fate-aliaspix-gray: CMD = framecrc -i 
>> $(TARGET_SAMPLES)/aliaspix/firstgray.pix -pix_fmt gray
>
> I suggest factoring out the dependency declaration.
>

Locally amended as suggested, adding a general fate-aliaspix target while at it.
I probably should do this for the other image decoders too, shouldn't I?
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Alias PIX image encoder and decoder

2014-03-26 Thread Vittorio Giovara
On Wed, Mar 26, 2014 at 7:28 PM, Kostya Shishkov
 wrote:
> On Wed, Mar 26, 2014 at 07:19:54PM +0100, Vittorio Giovara wrote:
>> ---

>> +x = avctx->width;
>
> x = 0;
> out_buf = f->data[0];
>
>> +while (bytestream2_get_bytes_left(&gb) > 0) {
>> +int i;
>> +
>> +/* set buffer at the right position at every new line */
>> +if (x == avctx->width) {
>> +x = 0;
>> +out_buf = f->data[0] + f->linesize[0] * y++;
>> +if (y > avctx->height) {

OK I'll also ad a y = 1 so that i don't have to put a -1 in the check below

>> +av_log(avctx, AV_LOG_ERROR,
>> +   "Ended frame decoding with %d bytes left.\n",
>> +   bytestream2_get_bytes_left(&gb));
>> +return AVERROR_INVALIDDATA;
>> +}
>> +}
>> +
>> +/* read packet and copy data */
>> +count = bytestream2_get_byteu(&gb);
>> +if (!count || x + count > avctx->width) {
>> +av_log(avctx, AV_LOG_ERROR, "Invalid run length %d.\n", count);
>> +return AVERROR_INVALIDDATA;
>> +}
>> +
>> +if (avctx->pix_fmt == AV_PIX_FMT_BGR24) {
>> +pixel = bytestream2_get_be24u(&gb);
>
> u?
> Are you sure it doesn't need to be checked?
>
>> +for (i = 0; i < count; i++) {
>> +AV_WB24(out_buf, pixel);
>> +out_buf += 3;
>> +}
>> +} else { // AV_PIX_FMT_GRAY8
>> +pixel = bytestream2_get_byteu(&gb);
>
> ditto

Well, yes, it need to be checked.

>
> the rest (including encoder) LGTM

yay, thanks.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/2] Add AVDisplayOrientation type as AVPacket and AVFrame side data.

2014-03-26 Thread Matthias Keiser
> On Tue, Mar 25, 2014 at 3:48 PM, wm4  wrote:
> > On Tue, 25 Mar 2014 15:31:49 +0100
> > Vittorio Giovara  wrote:
> >
> >
> >> +
> >> +/**
> >> + * An AV_PKT_DATA_ROTATION side data packet contains further spatial 
> >> information
> >> + * to be applied to the decoded video.
> >> + */
> >> +AV_PKT_DATA_DISPLAYORIENTATION,
> >>  };
> >
> > Completely lacks documentation in what format the data is. It can be
> > easily inferred from the rest of the patch, but an API user reading
> > avcodec.h can't.
> >
> >
> 
> True, I'll amend that.
> 
> >> +/**
> >> + * Spatial transformation information that should be applied to video
> >> + * after decoding.
> >> + *
> >> + * Note that these values are not mutually exclusive.
> >> + *
> >> + * The size of this struct is a part of the public ABI.
> >> + */
> >> +typedef struct AVDisplayOrientation {
> >> +/**
> >> + * Video should be orizontally flipped.
> >> + */
> >> +int hflip;
> >> +/**
> >> + * Video should be vertically flipped.
> >> + */
> >> +int vflip;
> >> +/**
> >> + * Rotation angle to be applied in degrees.
> >> + */
> >> +int32_t rotation;
> >> +} AVDisplayOrientation;
> >
> > So, why not just export the full matrix?
> 
> Overkill and HardMath imho.
If you do it like that, you need to document the order in which to process the 
struct fields.

Also, when only exposing a reduced set of transform operations, why not be 
consequent and reduce it as much as possible? A hflip can be expressed as a 
vflip+180 rotation.

I still think something like this would be nicer:

enum {

transform_vflip,
transform_hflip,
transform_transpose, //obscure
transform_anti_transpose, //obscure
transform_rotate  //use angle field

} transform_t;


typedef struct AVDisplayOrientation {

transform_t transform;
int32_t angle;
} AVDisplayOrientation; 
 
> Vittorio

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


Re: [libav-devel] [PATCH 2/3] On2 VP7 decoder

2014-03-26 Thread Luca Barbato
On 26/03/14 20:40, Diego Biurrun wrote:
> On Wed, Mar 26, 2014 at 08:19:11PM +0100, Luca Barbato wrote:
>> On 26/03/14 19:26, Diego Biurrun wrote:
>>> On Wed, Mar 26, 2014 at 05:48:53PM +0100, Vittorio Giovara wrote:
 --- a/configure
 +++ b/configure
 @@ -1846,6 +1846,7 @@ vp5_decoder_select="h264chroma hpeldsp videodsp 
 vp3dsp"
  vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp"
  vp6a_decoder_select="vp6_decoder"
  vp6f_decoder_select="vp6_decoder"
 +vp7_decoder_select="h264pred videodsp"
  vp8_decoder_select="h264pred videodsp"
>>>
>>> How much code is actually shared?
>>
>> Plenty
>>
>>> It might make sense to have one decoder select the other.
>>
>> Not necessary and I purposefully made so you can build vp8 w/out any vp7.
> 
> How about the other way around?  Does it make sense to build VP7 w/o VP8?

Not really, we could do that even if I don't see a large gain on it.

lu

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


Re: [libav-devel] [PATCH 2/3] On2 VP7 decoder

2014-03-26 Thread Jason Garrett-Glaser
+/* preserve the golden frame */
+if (s->framep[VP56_FRAME_GOLDEN] == prev_frame) {
+s->framep[VP56_FRAME_GOLDEN] = vp8_find_free_buffer(s);
+if ((ret = vp8_alloc_frame(s,
s->framep[VP56_FRAME_GOLDEN], 1)) < 0)
+   return ret;
+copy_frame(s->framep[VP56_
FRAME_GOLDEN]->tf.f,
+   prev_frame->tf.f, s->mb_width * 16,
+   s->mb_height * 16);
+}
+
+for (j = 0; j < s->mb_height * 16; j++)
+for (i = 0; i < s->mb_width * 16; i++) {
+uint8_t y = dst[j*linesize + i];
+dst[j*linesize + i] = av_clip_uint8(y + ((y *
beta) >> 8) + alpha);
+}

Wouldn't it make more sense to combine the copy and weight into a
single operation?  This hits the same memory twice.

It also seems more natural for this to be split out into a DSP
function of some sort.

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


Re: [libav-devel] [PATCH] Update the instructions for configuring a build for iOS

2014-03-26 Thread Janne Grunau
On 2014-03-26 21:57:08 +0200, Martin Storsjö wrote:
> The previous instructions were woefully outdated.
> ---
> Using xcrun to find the currently installed SDK path, mentioning
> iOS instead of explicitly saying e.g. iPhone 3gs.
> ---
>  README | 9 ++---
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/README b/README
> index d903ba1..9057332 100644
> --- a/README
> +++ b/README
> @@ -1,13 +1,8 @@
> -To configure ffmpeg for the iPhone 3gs and iPod touch 3g:
> +To configure Libav for iOS:
>  
> -./configure --enable-cross-compile --arch=arm --target-os=darwin 
> --cc='/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch 
> armv7' 
> --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk
>  --cpu=cortex-a8 --enable-pic
> -
> -To configure ffmpeg for all other iPhones and iPods:
> -
> -./configure --enable-cross-compile --arch=arm --target-os=darwin 
> --cc='/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch 
> armv6' 
> --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk
>  --cpu=arm1176jzf-s
> +./configure --enable-cross-compile --arch=arm --target-os=darwin --cc='clang 
> -arch armv7' --sysroot=$(xcrun -sdk iphoneos --show-sdk-path) --cpu=cortex-a8 
> --enable-pic

missing one dash for --sdk in '$(xcrun -sdk iphoneos --show-sdk-path)',
probably safer to enclose it in quotes in the case someone install Xcode
in a path with spaces

Otherwise ok

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


[libav-devel] [PATCH] Update the instructions for configuring a build for iOS

2014-03-26 Thread Martin Storsjo
The previous instructions were woefully outdated.
---
Using xcrun to find the currently installed SDK path, mentioning
iOS instead of explicitly saying e.g. iPhone 3gs.
---
 README | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/README b/README
index d903ba1..9057332 100644
--- a/README
+++ b/README
@@ -1,13 +1,8 @@
-To configure ffmpeg for the iPhone 3gs and iPod touch 3g:
+To configure Libav for iOS:
 
-./configure --enable-cross-compile --arch=arm --target-os=darwin 
--cc='/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7' 
--sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk 
--cpu=cortex-a8 --enable-pic
-
-To configure ffmpeg for all other iPhones and iPods:
-
-./configure --enable-cross-compile --arch=arm --target-os=darwin 
--cc='/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv6' 
--sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk 
--cpu=arm1176jzf-s
+./configure --enable-cross-compile --arch=arm --target-os=darwin --cc='clang 
-arch armv7' --sysroot=$(xcrun -sdk iphoneos --show-sdk-path) --cpu=cortex-a8 
--enable-pic
 
 Make sure to replace the iPhone SDK version with the version that you're using.
-Pre-3.0 versions aren't supported and probably won't work.
 
 If deploying to all generations, it's recommended to do separate out-of-tree
 builds for each architecture, then lipo together the resulting libs. For
-- 
1.8.5.2 (Apple Git-48)

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


Re: [libav-devel] [PATCH 2/3] On2 VP7 decoder

2014-03-26 Thread Diego Biurrun
On Wed, Mar 26, 2014 at 08:19:11PM +0100, Luca Barbato wrote:
> On 26/03/14 19:26, Diego Biurrun wrote:
> > On Wed, Mar 26, 2014 at 05:48:53PM +0100, Vittorio Giovara wrote:
> >> --- a/configure
> >> +++ b/configure
> >> @@ -1846,6 +1846,7 @@ vp5_decoder_select="h264chroma hpeldsp videodsp 
> >> vp3dsp"
> >>  vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp"
> >>  vp6a_decoder_select="vp6_decoder"
> >>  vp6f_decoder_select="vp6_decoder"
> >> +vp7_decoder_select="h264pred videodsp"
> >>  vp8_decoder_select="h264pred videodsp"
> > 
> > How much code is actually shared?
> 
> Plenty
> 
> > It might make sense to have one decoder select the other.
> 
> Not necessary and I purposefully made so you can build vp8 w/out any vp7.

How about the other way around?  Does it make sense to build VP7 w/o VP8?

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


Re: [libav-devel] [PATCH 1/3] vp8: K&R formatting cosmetics

2014-03-26 Thread Diego Biurrun
On Wed, Mar 26, 2014 at 05:48:52PM +0100, Vittorio Giovara wrote:
> --- a/libavcodec/vp8.c
> +++ b/libavcodec/vp8.c
> @@ -124,22 +124,25 @@ static int update_dimensions(VP8Context *s, int width, 
> int height)
>  
> -s->mb_width  = (s->avctx->coded_width +15) / 16;
> -s->mb_height = (s->avctx->coded_height+15) / 16;
> +s->mb_width  = (s->avctx->coded_width + 15) / 16;
> +s->mb_height = (s->avctx->coded_height + 15) / 16;

nit: maintain alignment

> @@ -246,13 +249,13 @@ static void get_quants(VP8Context *s)
>  
> -s->qmat[i].luma_qmul[0]=   
> vp8_dc_qlookup[av_clip_uintp2(base_qi + ydc_delta , 7)];
> +s->qmat[i].luma_qmul[0]= vp8_dc_qlookup[av_clip_uintp2(base_qi + 
> ydc_delta , 7)];

space before comma

> @@ -317,24 +320,29 @@ static int decode_frame_header(VP8Context *s, const 
> uint8_t *buf, int buf_size)
>  if (!s->profile)
> -memcpy(s->put_pixels_tab, s->vp8dsp.put_vp8_epel_pixels_tab, 
> sizeof(s->put_pixels_tab));
> +memcpy(s->put_pixels_tab,
> +   s->vp8dsp.put_vp8_epel_pixels_tab,
> +   sizeof(s->put_pixels_tab));
>  else// profile 1-3 use bilinear, 4+ aren't defined so whatever
> -memcpy(s->put_pixels_tab, s->vp8dsp.put_vp8_bilinear_pixels_tab, 
> sizeof(s->put_pixels_tab));
> +memcpy(s->put_pixels_tab,
> +   s->vp8dsp.put_vp8_bilinear_pixels_tab,
> +   sizeof(s->put_pixels_tab));
> @@ -344,11 +352,18 @@ static int decode_frame_header(VP8Context *s, const 
> uint8_t *buf, int buf_size)
> -memcpy(s->prob->pred16x16, vp8_pred16x16_prob_inter, 
> sizeof(s->prob->pred16x16));
> -memcpy(s->prob->pred8x8c , vp8_pred8x8c_prob_inter , 
> sizeof(s->prob->pred8x8c));
> -memcpy(s->prob->mvc  , vp8_mv_default_prob , 
> sizeof(s->prob->mvc));
> +memcpy(s->prob->pred16x16,
> +   vp8_pred16x16_prob_inter,
> +   sizeof(s->prob->pred16x16));
> +memcpy(s->prob->pred8x8c,
> +   vp8_pred8x8c_prob_inter,
> +   sizeof(s->prob->pred8x8c));
> +memcpy(s->prob->mvc,
> +   vp8_mv_default_prob,
> +   sizeof(s->prob->mvc));

two lines would suffice and look better IMO

> @@ -437,7 +451,8 @@ static int decode_frame_header(VP8Context *s, const 
> uint8_t *buf, int buf_size)
>  
> -static av_always_inline void clamp_mv(VP8Context *s, VP56mv *dst, const 
> VP56mv *src)
> +static av_always_inline
> +void clamp_mv(VP8Context *s, VP56mv *dst, const VP56mv *src)

We mostly break this at the comma.

> @@ -505,23 +519,21 @@ int decode_splitmvs(VP8Context *s, VP56RangeCoder *c, 
> VP8Macroblock *mb, int lay
>  
> -if (vp56_rac_get_prob_branchy(c, vp8_mbsplit_prob[0])) {
> -if (vp56_rac_get_prob_branchy(c, vp8_mbsplit_prob[1])) {
> +if (vp56_rac_get_prob_branchy(c, vp8_mbsplit_prob[0]))
> +if (vp56_rac_get_prob_branchy(c, vp8_mbsplit_prob[1]))
>  part_idx = VP8_SPLITMVMODE_16x8 + vp56_rac_get_prob(c, 
> vp8_mbsplit_prob[2]);
> -} else {
> +else
>  part_idx = VP8_SPLITMVMODE_8x8;
> -}
> -} else {
> +else
>  part_idx = VP8_SPLITMVMODE_4x4;
> -}

Most people seem to prefer to maintain the outer {}.

> @@ -562,25 +574,24 @@ int decode_splitmvs(VP8Context *s, VP56RangeCoder *c, 
> VP8Macroblock *mb, int lay
>  enum { CNT_ZERO, CNT_NEAREST, CNT_NEAR, CNT_SPLITMV };
>  enum { VP8_EDGE_TOP, VP8_EDGE_LEFT, VP8_EDGE_TOPLEFT };
> -int idx = CNT_ZERO;
> +int idx   = CNT_ZERO;
>  int cur_sign_bias = s->sign_bias[mb->ref_frame];
>  int8_t *sign_bias = s->sign_bias;
>  VP56mv near_mv[4];
> -uint8_t cnt[4] = { 0 };
> +uint8_t cnt[4]= { 0 };
>  VP56RangeCoder *c = &s->c;

IMO excessive alignment, these assignments are not related.

> @@ -588,24 +599,24 @@ void decode_mvs(VP8Context *s, VP8Macroblock *mb, int 
> mb_x, int mb_y, int layout
> +#define MV_EDGE_CHECK(n) 
>  \
> +{
>  \
> +VP8Macroblock *edge = mb_edge[n];
>  \
> +int edge_ref= edge->ref_frame;   
>  \

same

> @@ -777,8 +795,8 @@ skip_eob:
>  
>  if (!vp56_rac_get_prob_branchy(&c, token_prob[2])) { // DCT_1
> -coeff = 1;
> -token_prob = probs[i+1][1];
> +coeff  = 1;
> +token_prob = probs[i + 1][1];

same

> @@ -811,22 +829,24 @@ skip_eob:
>  *r = c;
>  return i;
>  }
> +
>  #endif

stray change

> @@ -1036,7 +1064,7 @@ void intra_predict(VP8Context *s, VP8ThreadData *td, 
> uint8_t *dst[3],
>  } else {
> -uint8_t *ptr = dst[0];
> +uint8_t *ptr  = dst[0];
>  uint8_t *intra4x4 = mb->intra4x4_pred_mode_mb;
>  uint8_t tr_top[4] = { 127, 127, 127, 127 };

excessive alignm

Re: [libav-devel] [PATCH 2/3] On2 VP7 decoder

2014-03-26 Thread Luca Barbato
On 26/03/14 19:26, Diego Biurrun wrote:
> On Wed, Mar 26, 2014 at 05:48:53PM +0100, Vittorio Giovara wrote:
>> --- a/configure
>> +++ b/configure
>> @@ -1846,6 +1846,7 @@ vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp"
>>  vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp"
>>  vp6a_decoder_select="vp6_decoder"
>>  vp6f_decoder_select="vp6_decoder"
>> +vp7_decoder_select="h264pred videodsp"
>>  vp8_decoder_select="h264pred videodsp"
> 
> How much code is actually shared?

Plenty

> It might make sense to have one decoder
> select the other.

Not necessary and I purposefully made so you can build vp8 w/out any vp7.

lu

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


Re: [libav-devel] [PATCH 22/22] Replace macro parameters without a leading backslash in altmacro mode

2014-03-26 Thread Martin Storsjö

On Wed, 26 Mar 2014, Janne Grunau wrote:


On 2014-03-24 19:38:03 +0200, Martin Storsjö wrote:

---
 gas-preprocessor.pl |  5 +
 test.S  | 11 +++
 2 files changed, 16 insertions(+)

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index d875d76..6dd9cc6 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -600,6 +600,11 @@ sub expand_macros {
 foreach (reverse sort {length $a <=> length $b} keys 
%replacements) {
 $macro_line =~ s/\\$_/$replacements{$_}/g;
 }
+if ($altmacro) {
+foreach (reverse sort {length $a <=> length $b} keys 
%replacements) {
+$macro_line =~ s/\b$_\b/$replacements{$_}/g;
+}
+}
 $macro_line =~ s/\\\@/$count/g;
 $macro_line =~ s/\\\(\)//g; # remove \()
 parse_line($macro_line);
diff --git a/test.S b/test.S
index ec0b861..47d39c2 100644
--- a/test.S
+++ b/test.S
@@ -72,3 +72,14 @@ argtest2 1 2 < 1 3
 mov r\i, #\j
 .endr
 .endr
+
+.macro alttest param
+.if param < 10
+mov r0, #param
+.endif
+.endm
+
+.altmacro
+alttest 5
+alttest 15
+.noaltmacro


unrelated, it's fucking insane that altmacro state at macro instantiation
time counts and not during macro definition. Sure it's easier to
implement but it makes no sense.


Yes, luckily we don't have many instances that requires altmacro.

The pushed version of the truehd patches were changed not to require this 
feature in gas-pp, but we might as well implement it now that we know 
about it.


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


Re: [libav-devel] [PATCH 22/22] Replace macro parameters without a leading backslash in altmacro mode

2014-03-26 Thread Janne Grunau
On 2014-03-24 19:38:03 +0200, Martin Storsjö wrote:
> ---
>  gas-preprocessor.pl |  5 +
>  test.S  | 11 +++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
> index d875d76..6dd9cc6 100755
> --- a/gas-preprocessor.pl
> +++ b/gas-preprocessor.pl
> @@ -600,6 +600,11 @@ sub expand_macros {
>  foreach (reverse sort {length $a <=> length $b} keys 
> %replacements) {
>  $macro_line =~ s/\\$_/$replacements{$_}/g;
>  }
> +if ($altmacro) {
> +foreach (reverse sort {length $a <=> length $b} keys 
> %replacements) {
> +$macro_line =~ s/\b$_\b/$replacements{$_}/g;
> +}
> +}
>  $macro_line =~ s/\\\@/$count/g;
>  $macro_line =~ s/\\\(\)//g; # remove \()
>  parse_line($macro_line);
> diff --git a/test.S b/test.S
> index ec0b861..47d39c2 100644
> --- a/test.S
> +++ b/test.S
> @@ -72,3 +72,14 @@ argtest2 1 2 < 1 3
>  mov r\i, #\j
>  .endr
>  .endr
> +
> +.macro alttest param
> +.if param < 10
> +mov r0, #param
> +.endif
> +.endm
> +
> +.altmacro
> +alttest 5
> +alttest 15
> +.noaltmacro

unrelated, it's fucking insane that altmacro state at macro instantiation
time counts and not during macro definition. Sure it's easier to
implement but it makes no sense.

patch ok

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


Re: [libav-devel] [PATCH 21/21] Handle nested repetitions

2014-03-26 Thread Janne Grunau
On 2014-03-24 14:46:10 +0200, Martin Storsjö wrote:
> ---
>  gas-preprocessor.pl | 11 ++-
>  test.S  |  6 ++
>  2 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
> index 16e91ab..6d8e57b 100755
> --- a/gas-preprocessor.pl
> +++ b/gas-preprocessor.pl
> @@ -221,6 +221,7 @@ if ($ENV{GASPP_DEBUG}) {
>  
>  my $current_macro = '';
>  my $macro_level = 0;
> +my $rept_level = 0;
>  my %macro_lines;
>  my %macro_args;
>  my %macro_args_default;
> @@ -384,9 +385,17 @@ sub parse_line {
>  }
>  }
>  
> +if ($macro_level == 0) {
> +if ($line =~ /\.(rept|irp)/) {
> +$rept_level++;
> +} elsif ($line =~ /.endr/) {
> +$rept_level--;
> +}
> +}
> +
>  if ($macro_level > 1) {
>  push(@{$macro_lines{$current_macro}}, $line);
> -} elsif (scalar(@rept_lines) and $line !~ /\.endr/) {
> +} elsif (scalar(@rept_lines) and $rept_level >= 1) {
>  push(@rept_lines, $line);
>  } elsif ($macro_level == 0) {
>  expand_macros($line);
> diff --git a/test.S b/test.S
> index f6ec894..ec0b861 100644
> --- a/test.S
> +++ b/test.S
> @@ -66,3 +66,9 @@ argtest2 1, 2, 3
>  argtest2 1 2 3
>  argtest1 1 2 3 + 1
>  argtest2 1 2 < 1 3
> +
> +.irpc i, 0123
> +.irpc j, 0123
> +mov r\i, #\j
> +.endr
> +.endr

ok

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


Re: [libav-devel] [PATCH 0/6] truehd: ARM optimisations

2014-03-26 Thread Martin Storsjö

On Wed, 26 Mar 2014, Martin Storsjö wrote:


On Tue, 25 Mar 2014, Ben Avison wrote:

On Tue, 25 Mar 2014 16:28:47 -, Martin Storsjö  
wrote:

All in all the series looks ok - any objections to me pushing this any
day soon, with "it ne" added before the conditional branches to C
functions, and with the altmacro parameter changed to use normal
parameter syntax (offset vs \offset in patch 1/6)?


Go for it. I didn't want to keep spamming the list with more and more
reposts of the series with only relatively minor and cosmetic changes,
so I was waiting for things to die down, but I'm also happy for you to
make the changes at the time you commit them.


I found a few more details, but I can fix them up before pushing as well.

mlpdsp_arm.S uses ldrd, which is only available in armv5te (we've got one 
armv4t and one armv5t setup on fate). Renaming the file to _armv5te.S and 
building it conditionally within that setup is easy though.


The checks in mlpdsp_init_arm.c shouldn't just check cpu_flags, they also 
need to take into account the fact that the optimizations might not be built 
at all - which is handled by the have_armv5te() or have_armv6() macros.


I've done these fixes locally and will include them when pushing.


... and pushed. Thanks for your contribution!

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


Re: [libav-devel] [PATCH 2/3] On2 VP7 decoder

2014-03-26 Thread Diego Biurrun
On Wed, Mar 26, 2014 at 05:48:53PM +0100, Vittorio Giovara wrote:
> --- a/configure
> +++ b/configure
> @@ -1846,6 +1846,7 @@ vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp"
>  vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp"
>  vp6a_decoder_select="vp6_decoder"
>  vp6f_decoder_select="vp6_decoder"
> +vp7_decoder_select="h264pred videodsp"
>  vp8_decoder_select="h264pred videodsp"

How much code is actually shared?  It might make sense to have one decoder
select the other.

> --- a/libavcodec/arm/vp8dsp_init_neon.c
> +++ b/libavcodec/arm/vp8dsp_init_neon.c
> @@ -39,9 +39,65 @@ VP8_BILIN(16, neon);
>  
>  av_cold void ff_vp8dsp_init_neon(VP8DSPContext *dsp)
>  {
> -dsp->vp8_luma_dc_wht= ff_vp8_luma_dc_wht_neon;
> +dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_neon;

stray change

> --- a/libavcodec/vp8.c
> +++ b/libavcodec/vp8.c
> @@ -291,6 +338,54 @@ static VP56Frame ref_to_update(VP8Context *s, int 
> update, VP56Frame ref)
> @@ -302,10 +397,188 @@ static void update_refs(VP8Context *s)
> +static int vp7_decode_frame_header(VP8Context *s, const uint8_t *buf, int 
> buf_size)
> +{
> +VP56RangeCoder *c = &s->c;
> +int part1_size, hscale, vscale, i, j, ret;
> +int width  = s->avctx->width;
> +int height = s->avctx->height;
> +
> +s->profile   =  (buf[0]>>1) & 7;

spaces around >>

> +s->update_golden = s->update_altref = VP56_FRAME_CURRENT;
> +vp78_reset_probability_tables(s);
> +memcpy(s->prob->pred16x16, vp8_pred16x16_prob_inter, 
> sizeof(s->prob->pred16x16));
> +memcpy(s->prob->pred8x8c , vp8_pred8x8c_prob_inter , 
> sizeof(s->prob->pred8x8c));

spaces before ,

> +s->segmentation.enabled = 0;
> +s->segmentation.update_map = 0;
> +s->lf_delta.enabled = 0;

align

> +/* D. Golden frame update flag (a Flag) for interframes only */
> +if (!s->keyframe) {
> +s->update_golden = vp8_rac_get(c) ? VP56_FRAME_CURRENT : 
> VP56_FRAME_NONE;
> +s->sign_bias[VP56_FRAME_GOLDEN] = 0;
> +}
> +
> +s->update_last = 1;
> +s->update_probabilities = 1;
> +s->fade_present = 1;

ditto

> +dst = prev_frame->tf.f->data[0];
> +linesize = prev_frame->tf.f->linesize[0];

again

> @@ -904,14 +1331,12 @@ void decode_mb_coeffs(VP8Context *s, VP8ThreadData 
> *td, VP56RangeCoder *c,
> -nnz_pred = l_nnz[i + 2 * y] + t_nnz[i + 2 * x];
> -nnz  = decode_block_coeffs(c, td->block[i][(y << 1) + x],
> -   s->prob->token[2],
> -   0, nnz_pred,
> -   s->qmat[segment].chroma_qmul);
> -td->non_zero_count_cache[i][(y << 1) + x] = nnz;
> -t_nnz[i + 2 * x] = l_nnz[i + 2 * y] = !!nnz;
> -nnz_total   += nnz;
> +nnz_pred = l_nnz[i+2*y] + t_nnz[i+2*x];
> +nnz = decode_block_coeffs(c, td->block[i][(y<<1)+x], 
> s->prob->token[2], 0,
> +  nnz_pred, 
> s->qmat[segment].chroma_qmul, s->prob[0].scan, is_vp7);
> +td->non_zero_count_cache[i][(y<<1)+x] = nnz;
> +t_nnz[i+2*x] = l_nnz[i+2*y] = !!nnz;

lots of missing spaces around operators

> @@ -1094,19 +1522,18 @@ void intra_predict(VP8Context *s, VP8ThreadData *td, 
> uint8_t *dst[3],
> -copy_dst[3] = 127U;
> -AV_WN32A(copy_dst + 4, 127U * 0x01010101U);
> +copy_dst[3] = lo;
> +AV_WN32A(copy_dst+4, lo * 0x01010101U);

again

> @@ -1578,20 +2022,22 @@ void filter_mb(VP8Context *s, uint8_t *dst[3], 
> VP8FilterStrength *f,
>  }
>  
>  if (inner_filter) {
> -s->vp8dsp.vp8_v_loop_filter16y_inner(dst[0] + 4 * linesize,
> - linesize, bedge_lim,
> +s->vp8dsp.vp8_v_loop_filter16y_inner(dst[0]+ 4*linesize,
> + linesize,bedge_lim_y,
>   inner_limit, hev_thresh);
> -s->vp8dsp.vp8_v_loop_filter16y_inner(dst[0] + 8 * linesize,
> - linesize, bedge_lim,
> +s->vp8dsp.vp8_v_loop_filter16y_inner(dst[0]+ 8*linesize,
> + linesize,bedge_lim_y,
>   inner_limit, hev_thresh);
> -s->vp8dsp.vp8_v_loop_filter16y_inner(dst[0] + 12 * linesize,
> - linesize, bedge_lim,
> +s->vp8dsp.vp8_v_loop_filter16y_inner(dst[0]+12*linesize,
> + linesize,bedge_lim_y,

same

Also, these look like half stray changes.

> @@ -1888,12 +2339,11 @@ static int vp8_decode_mb_row_sliced(AVCodecContext 
> *avctx, void *tdata,
>  td->thread_nr = threadnr;
>  for (mb_y =

Re: [libav-devel] [PATCH 090/132] x86: dsputil: Move ff_apply_window_int16_* bits to ac3dsp, where they belong

2014-03-26 Thread Diego Biurrun
On Wed, Mar 26, 2014 at 06:29:13PM +0100, Luca Barbato wrote:
> On 26/03/14 12:41, Diego Biurrun wrote:
> > ---
> >  libavcodec/x86/ac3dsp.asm  | 131 
> > +
> >  libavcodec/x86/dsputil.asm | 130 
> > 
> >  2 files changed, 131 insertions(+), 130 deletions(-)
> 
> Sounds correct (the patch just moves the code from one side to the other
> by cut&paste right?).

Yes.

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


Re: [libav-devel] [PATCH] Alias PIX image encoder and decoder

2014-03-26 Thread Kostya Shishkov
On Wed, Mar 26, 2014 at 07:19:54PM +0100, Vittorio Giovara wrote:
> ---
> Variable name change and two possible out of bounds reads spotted by Kostya.
> Vittorio
> 
>  Changelog|   1 +
>  doc/general.texi |   2 +
>  libavcodec/Makefile  |   2 +
>  libavcodec/aliaspixdec.c | 126 
>  libavcodec/aliaspixenc.c | 134 
> +++
>  libavcodec/allcodecs.c   |   1 +
>  libavcodec/avcodec.h |   1 +
>  libavcodec/codec_desc.c  |   7 +++
>  libavcodec/version.h |   2 +-
>  libavformat/img2.c   |   1 +
>  libavformat/img2enc.c|   2 +-
>  11 files changed, 277 insertions(+), 2 deletions(-)
>  create mode 100644 libavcodec/aliaspixdec.c
>  create mode 100644 libavcodec/aliaspixenc.c
> 
> diff --git a/Changelog b/Changelog
> index 76eca07..ed182bb 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -5,6 +5,7 @@ version :
>  - libx265 encoder
>  - shuffleplanes filter
>  - replaygain data export
> +- Alias PIX image encoder and decoder
>  
>  
>  version 10:
> diff --git a/doc/general.texi b/doc/general.texi
> index 8c0cb1b..dce4c0a 100644
> --- a/doc/general.texi
> +++ b/doc/general.texi
> @@ -424,6 +424,8 @@ following image formats are supported:
>  @item Name @tab Encoding @tab Decoding @tab Comments
>  @item .Y.U.V   @tab X @tab X
>  @tab one raw file per component
> +@item Alias PIX@tab X @tab X
> +@tab Alias/Wavefront PIX image format
>  @item animated GIF @tab X @tab X
>  @tab Only uncompressed GIFs are generated.
>  @item BMP  @tab X @tab X
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index c13d5e5..f4dfa85 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -90,6 +90,8 @@ OBJS-$(CONFIG_AC3_FIXED_ENCODER)   += ac3enc_fixed.o 
> ac3enc.o ac3tab.o ac3.o
>  OBJS-$(CONFIG_AIC_DECODER) += aic.o
>  OBJS-$(CONFIG_ALAC_DECODER)+= alac.o alac_data.o
>  OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o
> +OBJS-$(CONFIG_ALIAS_PIX_DECODER)   += aliaspixdec.o
> +OBJS-$(CONFIG_ALIAS_PIX_ENCODER)   += aliaspixenc.o
>  OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mpeg4audio.o
>  OBJS-$(CONFIG_AMRNB_DECODER)   += amrnbdec.o celp_filters.o   \
>celp_math.o acelp_filters.o \
> diff --git a/libavcodec/aliaspixdec.c b/libavcodec/aliaspixdec.c
> new file mode 100644
> index 000..6872004
> --- /dev/null
> +++ b/libavcodec/aliaspixdec.c
> @@ -0,0 +1,126 @@
> +/*
> + * Alias PIX image decoder
> + * Copyright (C) 2014 Vittorio Giovara 
> + *
> + * This file is part of Libav.
> + *
> + * Libav is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * Libav is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with Libav; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +#include "libavutil/intreadwrite.h"
> +
> +#include "avcodec.h"
> +#include "bytestream.h"
> +#include "internal.h"
> +
> +#define ALIAS_HEADER_SIZE 10
> +
> +static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
> +AVPacket *avpkt)
> +{
> +AVFrame *f = data;
> +GetByteContext gb;
> +int width, height, ret, bits_pixel, pixel;
> +uint8_t *out_buf;
> +uint8_t count;
> +int x, y = 0;
> +
> +bytestream2_init(&gb, avpkt->data, avpkt->size);
> +
> +if (bytestream2_get_bytes_left(&gb) < ALIAS_HEADER_SIZE) {
> +av_log(avctx, AV_LOG_ERROR, "Header too small %d.\n", avpkt->size);
> +return AVERROR_INVALIDDATA;
> +}
> +
> +width  = bytestream2_get_be16u(&gb);
> +height = bytestream2_get_be16u(&gb);
> +bytestream2_skipu(&gb, 4); // obsolete X, Y offset
> +bits_pixel = bytestream2_get_be16u(&gb);
> +
> +if (bits_pixel == 24)
> +avctx->pix_fmt = AV_PIX_FMT_BGR24;
> +else if (bits_pixel == 8)
> +avctx->pix_fmt = AV_PIX_FMT_GRAY8;
> +else {
> +av_log(avctx, AV_LOG_ERROR, "Invalid pixel format.\n");
> +return AVERROR_INVALIDDATA;
> +}
> +
> +ret = ff_set_dimensions(avctx, width, height);
> +if (ret < 0)
> +return ret;
> +
> +ret = ff_get_buffer(avctx, f, 0);
> +if (ret < 0)
> +return ret;
> +
> +f->pict_type = AV_PICTURE_TYPE_I;
> +f->key_frame = 1;
> +
> +x = avctx->width;

x = 0;
out_buf = f->data[0];

> +while (bytest

[libav-devel] [PATCH] Alias PIX image encoder and decoder

2014-03-26 Thread Vittorio Giovara
---
Variable name change and two possible out of bounds reads spotted by Kostya.
Vittorio

 Changelog|   1 +
 doc/general.texi |   2 +
 libavcodec/Makefile  |   2 +
 libavcodec/aliaspixdec.c | 126 
 libavcodec/aliaspixenc.c | 134 +++
 libavcodec/allcodecs.c   |   1 +
 libavcodec/avcodec.h |   1 +
 libavcodec/codec_desc.c  |   7 +++
 libavcodec/version.h |   2 +-
 libavformat/img2.c   |   1 +
 libavformat/img2enc.c|   2 +-
 11 files changed, 277 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/aliaspixdec.c
 create mode 100644 libavcodec/aliaspixenc.c

diff --git a/Changelog b/Changelog
index 76eca07..ed182bb 100644
--- a/Changelog
+++ b/Changelog
@@ -5,6 +5,7 @@ version :
 - libx265 encoder
 - shuffleplanes filter
 - replaygain data export
+- Alias PIX image encoder and decoder
 
 
 version 10:
diff --git a/doc/general.texi b/doc/general.texi
index 8c0cb1b..dce4c0a 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -424,6 +424,8 @@ following image formats are supported:
 @item Name @tab Encoding @tab Decoding @tab Comments
 @item .Y.U.V   @tab X @tab X
 @tab one raw file per component
+@item Alias PIX@tab X @tab X
+@tab Alias/Wavefront PIX image format
 @item animated GIF @tab X @tab X
 @tab Only uncompressed GIFs are generated.
 @item BMP  @tab X @tab X
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index c13d5e5..f4dfa85 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -90,6 +90,8 @@ OBJS-$(CONFIG_AC3_FIXED_ENCODER)   += ac3enc_fixed.o 
ac3enc.o ac3tab.o ac3.o
 OBJS-$(CONFIG_AIC_DECODER) += aic.o
 OBJS-$(CONFIG_ALAC_DECODER)+= alac.o alac_data.o
 OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o
+OBJS-$(CONFIG_ALIAS_PIX_DECODER)   += aliaspixdec.o
+OBJS-$(CONFIG_ALIAS_PIX_ENCODER)   += aliaspixenc.o
 OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mpeg4audio.o
 OBJS-$(CONFIG_AMRNB_DECODER)   += amrnbdec.o celp_filters.o   \
   celp_math.o acelp_filters.o \
diff --git a/libavcodec/aliaspixdec.c b/libavcodec/aliaspixdec.c
new file mode 100644
index 000..6872004
--- /dev/null
+++ b/libavcodec/aliaspixdec.c
@@ -0,0 +1,126 @@
+/*
+ * Alias PIX image decoder
+ * Copyright (C) 2014 Vittorio Giovara 
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/intreadwrite.h"
+
+#include "avcodec.h"
+#include "bytestream.h"
+#include "internal.h"
+
+#define ALIAS_HEADER_SIZE 10
+
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+AVPacket *avpkt)
+{
+AVFrame *f = data;
+GetByteContext gb;
+int width, height, ret, bits_pixel, pixel;
+uint8_t *out_buf;
+uint8_t count;
+int x, y = 0;
+
+bytestream2_init(&gb, avpkt->data, avpkt->size);
+
+if (bytestream2_get_bytes_left(&gb) < ALIAS_HEADER_SIZE) {
+av_log(avctx, AV_LOG_ERROR, "Header too small %d.\n", avpkt->size);
+return AVERROR_INVALIDDATA;
+}
+
+width  = bytestream2_get_be16u(&gb);
+height = bytestream2_get_be16u(&gb);
+bytestream2_skipu(&gb, 4); // obsolete X, Y offset
+bits_pixel = bytestream2_get_be16u(&gb);
+
+if (bits_pixel == 24)
+avctx->pix_fmt = AV_PIX_FMT_BGR24;
+else if (bits_pixel == 8)
+avctx->pix_fmt = AV_PIX_FMT_GRAY8;
+else {
+av_log(avctx, AV_LOG_ERROR, "Invalid pixel format.\n");
+return AVERROR_INVALIDDATA;
+}
+
+ret = ff_set_dimensions(avctx, width, height);
+if (ret < 0)
+return ret;
+
+ret = ff_get_buffer(avctx, f, 0);
+if (ret < 0)
+return ret;
+
+f->pict_type = AV_PICTURE_TYPE_I;
+f->key_frame = 1;
+
+x = avctx->width;
+while (bytestream2_get_bytes_left(&gb) > 0) {
+int i;
+
+/* set buffer at the right position at every new line */
+if (x == avctx->width) {
+x = 0;
+out_buf = f->data[0] + f->linesize[0] * y++;
+if (y > avctx->height) {
+av_log(avctx, AV_LOG_ERROR,
+   "Ended frame decoding with %d bytes left.

Re: [libav-devel] [PATCH 2/3] On2 VP7 decoder

2014-03-26 Thread Kostya Shishkov
On Wed, Mar 26, 2014 at 07:00:49PM +0100, Luca Barbato wrote:
> On 26/03/14 17:48, Vittorio Giovara wrote:
> 
> Test on arm and fix the two typos ^^;
> 
> Beside that
> 
> > -#define HOR_VP8_PRED  11///< unaveraged version of #HOR_PRED, 
> > see
> > +#define HOR_VP8_PRED  14///< unaveraged version of #HOR_PRED, 
> > see
> 
> Is a little strange.

Might be related to that deconfuse H.264 prediction modes patch.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 3/3] fate: add a VP7 test

2014-03-26 Thread Diego Biurrun
On Wed, Mar 26, 2014 at 05:48:54PM +0100, Vittorio Giovara wrote:
> --- a/tests/fate/vpx.mak
> +++ b/tests/fate/vpx.mak
> @@ -25,6 +25,9 @@ fate-vp6f: CMD = framecrc -flags +bitexact -i 
> $(TARGET_SAMPLES)/flash-vp6/clip10
>  
> +FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, VP7) += fate-vp7
> +fate-vp7: CMD = framecrc -flags +bitexact -i 
> $(TARGET_SAMPLES)/vp7/potter-40.vp7 -frames 300 -an

.vp7 is avi?  OK then.

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


Re: [libav-devel] [PATCH 2/3] On2 VP7 decoder

2014-03-26 Thread Luca Barbato
On 26/03/14 17:48, Vittorio Giovara wrote:

Test on arm and fix the two typos ^^;

Beside that

> -#define HOR_VP8_PRED  11///< unaveraged version of #HOR_PRED, see
> +#define HOR_VP8_PRED  14///< unaveraged version of #HOR_PRED, see

Is a little strange.

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


Re: [libav-devel] [PATCH 1/2] lavu: add all color-related enums to AVFrame

2014-03-26 Thread Vittorio Giovara
On Wed, Mar 26, 2014 at 6:35 PM, Tim Walker  wrote:
> On 25 Mar 2014, at 15:37, Vittorio Giovara  wrote:
>
>> On Tue, Mar 25, 2014 at 1:12 PM, wm4  wrote:
>>> ---
>>> doc/APIchanges   |  5 
>>> libavcodec/avcodec.h | 67 
>>> 
>>> libavutil/frame.c| 10 
>>> libavutil/frame.h| 30 +++
>>> libavutil/pixfmt.h   | 62 
>>> libavutil/version.h  |  2 +-
>>> 6 files changed, 108 insertions(+), 68 deletions(-)
>>
>> I think this is fine, I'll wait for some more feedback and then apply
>> it in the next days.
>> Thanks for the contribution.
>> Vittorio
>
> I think so too. Did you intend to push the whole patchset, or just 1/2?
>

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


Re: [libav-devel] [PATCH 1/2] lavu: add all color-related enums to AVFrame

2014-03-26 Thread Tim Walker
On 25 Mar 2014, at 15:37, Vittorio Giovara  wrote:

> On Tue, Mar 25, 2014 at 1:12 PM, wm4  wrote:
>> ---
>> doc/APIchanges   |  5 
>> libavcodec/avcodec.h | 67 
>> 
>> libavutil/frame.c| 10 
>> libavutil/frame.h| 30 +++
>> libavutil/pixfmt.h   | 62 
>> libavutil/version.h  |  2 +-
>> 6 files changed, 108 insertions(+), 68 deletions(-)
> 
> I think this is fine, I'll wait for some more feedback and then apply
> it in the next days.
> Thanks for the contribution.
> Vittorio

I think so too. Did you intend to push the whole patchset, or just 1/2?

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


Re: [libav-devel] [PATCH] {v,a}f_showinfo: print frame side data

2014-03-26 Thread Tim Walker
On 24 Mar 2014, at 06:03, Anton Khirnov  wrote:

> ---
> Switched replaygain printing to the new API with the struct instead of binary 
> data
> ---
> libavfilter/af_ashowinfo.c |  110 
> libavfilter/vf_showinfo.c  |   55 ++
> 2 files changed, 165 insertions(+)
> 
> diff --git a/libavfilter/af_ashowinfo.c b/libavfilter/af_ashowinfo.c
> index 99d9dde..e9649d9 100644
> --- a/libavfilter/af_ashowinfo.c
> +++ b/libavfilter/af_ashowinfo.c
> @@ -30,7 +30,10 @@
> #include "libavutil/attributes.h"
> #include "libavutil/channel_layout.h"
> #include "libavutil/common.h"
> +#include "libavutil/downmix_info.h"
> +#include "libavutil/intreadwrite.h"
> #include "libavutil/mem.h"
> +#include "libavutil/replaygain.h"
> #include "libavutil/samplefmt.h"
> 
> #include "audio.h"
> @@ -66,6 +69,99 @@ static av_cold void uninit(AVFilterContext *ctx)
> av_freep(&s->plane_checksums);
> }
> 
> +static void dump_matrixenc(AVFilterContext *ctx, AVFrameSideData *sd)
> +{
> +enum AVMatrixEncoding enc;
> +
> +av_log(ctx, AV_LOG_INFO, "matrix encoding: ");
> +
> +if (sd->size < sizeof(enum AVMatrixEncoding)) {
> +av_log(ctx, AV_LOG_INFO, "invalid data");
> +return;
> +}
> +
> +enc = *(enum AVMatrixEncoding *)sd->data;
> +switch (enc) {
> +case AV_MATRIX_ENCODING_NONE:   av_log(ctx, AV_LOG_INFO, 
> "none");break;
> +case AV_MATRIX_ENCODING_DOLBY:  av_log(ctx, AV_LOG_INFO, 
> "Dolby");   break;

Sorry for not catching this earlier, this should say "Dolby Surround", IMO. I 
suppose "Dolby Pro Logic" would also do.

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


Re: [libav-devel] [PATCH 091/132] dsputil: Move DV-specific ff_zigzag248_direct table to dvdata

2014-03-26 Thread Luca Barbato
On 26/03/14 12:41, Diego Biurrun wrote:
> ---
>  libavcodec/dsputil.c | 13 -
>  libavcodec/dsputil.h |  1 -
>  libavcodec/dv.c  |  2 +-
>  libavcodec/dvdata.c  | 13 +
>  libavcodec/dvdata.h  |  2 ++
>  libavcodec/dvenc.c   |  2 +-
>  6 files changed, 17 insertions(+), 16 deletions(-)
> 

Ok.

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


Re: [libav-devel] [PATCH 090/132] x86: dsputil: Move ff_apply_window_int16_* bits to ac3dsp, where they belong

2014-03-26 Thread Luca Barbato
On 26/03/14 12:41, Diego Biurrun wrote:
> ---
>  libavcodec/x86/ac3dsp.asm  | 131 
> +
>  libavcodec/x86/dsputil.asm | 130 
>  2 files changed, 131 insertions(+), 130 deletions(-)
> 

Sounds correct (the patch just moves the code from one side to the other
by cut&paste right?).

lu

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


Re: [libav-devel] [PATCH 089/132] dsputil: Initialize static dsputil data from within dsputil itself

2014-03-26 Thread Luca Barbato
On 26/03/14 12:41, Diego Biurrun wrote:
> ---
>  libavcodec/dsputil.c | 10 --
>  libavcodec/dsputil.h |  1 -
>  libavcodec/utils.c   | 13 -
>  3 files changed, 8 insertions(+), 16 deletions(-)
> 

The code seems more wrong than it was before.

Would be better to keep a function and call it from the init_static_data
callback of the codecs that use it.

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


Re: [libav-devel] [PATCH 088/132] x86: h264_qpel: Simplify an #if conditional

2014-03-26 Thread Vittorio Giovara
On Wed, Mar 26, 2014 at 12:41 PM, Diego Biurrun  wrote:
> The extra conditions are covered by previous #ifs and conditional compilation.
> ---
>  libavcodec/x86/h264_qpel.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
OK
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 086/132] ppc: Drop a bunch of unnecessary dsputil_altivec.h #includes

2014-03-26 Thread Vittorio Giovara
On Wed, Mar 26, 2014 at 12:41 PM, Diego Biurrun  wrote:
> ---
>  libavcodec/ppc/fmtconvert_altivec.c   | 1 -
>  libavcodec/ppc/h264chroma_init.c  | 1 -
>  libavcodec/ppc/mpegaudiodsp_altivec.c | 1 -
>  libavcodec/ppc/mpegvideo_altivec.c| 1 -
>  libavcodec/ppc/vp3dsp_altivec.c   | 1 -
>  5 files changed, 5 deletions(-)
>

squashable, but ok

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


Re: [libav-devel] [PATCH 085/132] x86: dsputil: Eliminate some unnecessary dsputil_x86.h #includes

2014-03-26 Thread Vittorio Giovara
On Wed, Mar 26, 2014 at 12:41 PM, Diego Biurrun  wrote:
> ---
>  libavcodec/x86/ac3dsp_init.c  | 1 -
>  libavcodec/x86/h264dsp_init.c | 1 -
>  libavcodec/x86/mpegvideo.c| 1 -
>  libavcodec/x86/mpegvideoenc.c | 1 -
>  4 files changed, 4 deletions(-)
>
so small it could be squashed, but ok
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 084/132] Remove a number of unnecessary dsputil.h #includes

2014-03-26 Thread Vittorio Giovara
On Wed, Mar 26, 2014 at 12:41 PM, Diego Biurrun  wrote:
> ---
>  libavcodec/arm/vp3dsp_init_arm.c | 1 -
>  libavcodec/binkdsp.c | 1 -
>  libavcodec/dvbsubdec.c   | 2 +-
>  libavcodec/dvdsubdec.c   | 2 +-
>  libavcodec/h264pred.c| 3 ++-
>  libavcodec/indeo5.c  | 1 -
>  libavcodec/mpeg12.c  | 1 -
>  libavcodec/msmpeg4dec.c  | 1 -
>  libavcodec/mss4.c| 1 -
>  libavcodec/vc1dsp.c  | 1 +
>  libavcodec/vc1dsp.h  | 1 -
>  libavcodec/vp3dsp.c  | 2 +-
>  libavcodec/vp56.h| 1 -
>  libavcodec/x86/vp3dsp_init.c | 1 -
>  14 files changed, 6 insertions(+), 13 deletions(-)
>
OK I suppose
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 3/3] fate: add a VP7 test

2014-03-26 Thread Vittorio Giovara
---
 tests/fate/vpx.mak |   3 +
 tests/ref/fate/vp7 | 301 +
 2 files changed, 304 insertions(+)
 create mode 100644 tests/ref/fate/vp7

diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak
index f9e99ee..535f712 100644
--- a/tests/fate/vpx.mak
+++ b/tests/fate/vpx.mak
@@ -25,6 +25,9 @@ fate-vp6f: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/flash-vp6/clip10
 FATE_SAMPLES_AVCONV += $(FATE_VP6-yes)
 fate-vp6: $(FATE_VP6-yes)
 
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, VP7) += fate-vp7
+fate-vp7: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/vp7/potter-40.vp7 -frames 300 -an
+
 VP8_SUITE = 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017
 
 define FATE_VP8_SUITE
diff --git a/tests/ref/fate/vp7 b/tests/ref/fate/vp7
new file mode 100644
index 000..95a40c2
--- /dev/null
+++ b/tests/ref/fate/vp7
@@ -0,0 +1,301 @@
+#tb 0: 1001/12000
+0,  0,  0,1,84480, 0xa7776101
+0,  1,  1,1,84480, 0xeb1560ca
+0,  2,  2,1,84480, 0x7a4e6123
+0,  3,  3,1,84480, 0x7a4e6123
+0,  4,  4,1,84480, 0x8ee36111
+0,  5,  5,1,84480, 0x3c2a6110
+0,  6,  6,1,84480, 0x3c2a6110
+0,  7,  7,1,84480, 0x961e607d
+0,  8,  8,1,84480, 0xb7b5615d
+0,  9,  9,1,84480, 0x636d6011
+0, 10, 10,1,84480, 0x69fd6111
+0, 11, 11,1,84480, 0x636d6011
+0, 12, 12,1,84480, 0x69fd6111
+0, 13, 13,1,84480, 0x636d6011
+0, 14, 14,1,84480, 0x69fd6111
+0, 15, 15,1,84480, 0x636d6011
+0, 16, 16,1,84480, 0x2d1a610a
+0, 17, 17,1,84480, 0x268a600a
+0, 18, 18,1,84480, 0x2d1a610a
+0, 19, 19,1,84480, 0x268a600a
+0, 20, 20,1,84480, 0x2d1a610a
+0, 21, 21,1,84480, 0x268a600a
+0, 22, 22,1,84480, 0x2d1a610a
+0, 23, 23,1,84480, 0x268a600a
+0, 24, 24,1,84480, 0xa88261c9
+0, 25, 25,1,84480, 0x98e95fc6
+0, 26, 26,1,84480, 0x9f7960c6
+0, 27, 27,1,84480, 0x98e95fc6
+0, 28, 28,1,84480, 0x9f7960c6
+0, 29, 29,1,84480, 0x98e95fc6
+0, 30, 30,1,84480, 0x9f7960c6
+0, 31, 31,1,84480, 0x98e95fc6
+0, 32, 32,1,84480, 0x9e796202
+0, 33, 33,1,84480, 0xf3b16002
+0, 34, 34,1,84480, 0xfa416102
+0, 35, 35,1,84480, 0xf3b16002
+0, 36, 36,1,84480, 0xfa416102
+0, 37, 37,1,84480, 0x97e96102
+0, 38, 38,1,84480, 0xfa416102
+0, 39, 39,1,84480, 0xf3b16002
+0, 40, 40,1,84480, 0x5f4a6c03
+0, 41, 41,1,84480, 0x7e4960df
+0, 42, 42,1,84480, 0x7e4960df
+0, 43, 43,1,84480, 0x7e4960df
+0, 44, 44,1,84480, 0x7e4960df
+0, 45, 45,1,84480, 0x7e4960df
+0, 46, 46,1,84480, 0x7e4960df
+0, 47, 47,1,84480, 0x7e4960df
+0, 48, 48,1,84480, 0x7e4960df
+0, 49, 49,1,84480, 0x7e4960df
+0, 50, 50,1,84480, 0x7e4960df
+0, 51, 51,1,84480, 0x7e4960df
+0, 52, 52,1,84480, 0x7e4960df
+0, 53, 53,1,84480, 0xd1bcadbe
+0, 54, 54,1,84480, 0xdb3a0f37
+0, 55, 55,1,84480, 0x79cfaed7
+0, 56, 56,1,84480, 0xd5468265
+0, 57, 57,1,84480, 0x2177a020
+0, 58, 58,1,84480, 0x88c6412e
+0, 59, 59,1,84480, 0x5710feee
+0, 60, 60,1,84480, 0x7ffe7f6c
+0, 61, 61,1,84480, 0x55a50bee
+0, 62, 62,1,84480, 0xdb9ca924
+0, 63, 63,1,84480, 0xa3307f1f
+0, 64, 64,1,84480, 0x501437a6
+0, 65, 65,1,84480, 0x60f0c1fc
+0, 66, 66,1,84480, 0x8ad65ac1
+0, 67, 67,1,84480, 0xf4d6f7d1
+0, 68, 68,1,84480, 0x00179ef1

[libav-devel] [PATCH 0/3] Announcing the world's fastest VP7 decoder

2014-03-26 Thread Vittorio Giovara
...and VP8 too!

Working on the good VP7 decoder that Peter wrote, Luca and I were able to
bring the impact on VP8 decoding down to zero, and actually slightly improve
VP8 in the first place.

Also a NULL pointer dereference has been fixed and both decoders compile
standalone.

Some average numbers, using A_4K_Video_Reel_by_Bright_Side_Network_Inc..webm
as VP8 reference and potter-40.vp7 as VP7 reference, decoding 300 frames,
repeted 30 times, no limits on threading. v1 is the the plain
decoder, v2 is with our modifications.

VP8 ORIGINAL: 10.346567s
VP8 W/ VP7v1: 10.381467s
VP8 W/ VP7v2: 10.301567s

VP8 no VP7v1: 10.393633s
VP8 no VP7v2: 10.301900s

VP7v1: 0.289167
VP7v2: 0.288367

Full raw data: https://www.dropbox.com/s/vekq4qbka3ep5mj/testing%20is%20fun.txt

I got some early feedback on this test, suggesting to disable multithreading
and having the full file decode. This is currently being done and new results
will be posted when they are ready.

Cheers,
Vittorio

Peter Ross (1):
  On2 VP7 decoder

Vittorio Giovara (2):
  vp8: K&R formatting cosmetics
  fate: add a VP7 test

 Changelog|1 +
 configure|1 +
 doc/general.texi |2 +
 libavcodec/Makefile  |1 +
 libavcodec/allcodecs.c   |1 +
 libavcodec/arm/h264pred_init_arm.c   |8 +-
 libavcodec/arm/vp8dsp.h  |2 +
 libavcodec/arm/vp8dsp_init_arm.c |   12 +-
 libavcodec/arm/vp8dsp_init_armv6.c   |   58 ++
 libavcodec/arm/vp8dsp_init_neon.c|   58 +-
 libavcodec/avcodec.h |1 +
 libavcodec/codec_desc.c  |7 +
 libavcodec/h264pred.c|   17 +-
 libavcodec/h264pred.h|2 +-
 libavcodec/version.h |2 +-
 libavcodec/vp8.c | 1688 +++---
 libavcodec/vp8.h |   42 +-
 libavcodec/vp8_parser.c  |   15 +-
 libavcodec/vp8data.h |  339 +--
 libavcodec/vp8dsp.c  |  837 ++---
 libavcodec/vp8dsp.h  |8 +-
 libavcodec/x86/Makefile  |3 +
 libavcodec/x86/h264_intrapred_init.c |   11 +-
 libavcodec/x86/vp8dsp_init.c |  109 ++-
 libavformat/riff.c   |2 +
 tests/fate/vpx.mak   |3 +
 tests/ref/fate/vp7   |  301 ++
 27 files changed, 2486 insertions(+), 1045 deletions(-)
 create mode 100644 tests/ref/fate/vp7

-- 
1.8.3.4 (Apple Git-47)

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


Re: [libav-devel] [PATCH 089/132] dsputil: Initialize static dsputil data from within dsputil itself

2014-03-26 Thread wm4
On Wed, 26 Mar 2014 04:41:27 -0700
Diego Biurrun  wrote:

> ---
>  libavcodec/dsputil.c | 10 --
>  libavcodec/dsputil.h |  1 -
>  libavcodec/utils.c   | 13 -
>  3 files changed, 8 insertions(+), 16 deletions(-)
> 
> diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
> index 534bc92..b29e959 100644
> --- a/libavcodec/dsputil.c
> +++ b/libavcodec/dsputil.c
> @@ -2440,11 +2440,15 @@ static void clear_blocks_8_c(int16_t *blocks)
>  memset(blocks, 0, sizeof(int16_t) * 6 * 64);
>  }
>  
> -/* init static data */
> -av_cold void ff_dsputil_static_init(void)
> +static av_cold void square_tab_init(void)
>  {
> +static int initialized = 0;
>  int i;
>  
> +if (initialized != 0)
> +return;
> +initialized = 1;
> +
>  for (i = 0; i < 512; i++)
>  ff_square_tab[i] = (i - 256) * (i - 256);
>  }
> @@ -2453,6 +2457,8 @@ av_cold void ff_dsputil_init(DSPContext *c, 
> AVCodecContext *avctx)
>  {
>  const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8;
>  
> +square_tab_init();
> +
>  #if CONFIG_ENCODERS
>  if (avctx->bits_per_raw_sample == 10) {
>  c->fdct= ff_jpeg_fdct_islow_10;
> diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
> index 7f467d1..2bc1aec 100644
> --- a/libavcodec/dsputil.h
> +++ b/libavcodec/dsputil.h
> @@ -314,7 +314,6 @@ typedef struct DSPContext {
>  op_fill_func fill_block_tab[2];
>  } DSPContext;
>  
> -void ff_dsputil_static_init(void);
>  void ff_dsputil_init(DSPContext *p, AVCodecContext *avctx);
>  
>  void ff_set_cmp(DSPContext *c, me_cmp_func *cmp, int type);
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index c88b346..738e247 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -91,18 +91,6 @@ AVCodec *av_codec_next(const AVCodec *c)
>  return first_avcodec;
>  }
>  
> -static av_cold void avcodec_init(void)
> -{
> -static int initialized = 0;
> -
> -if (initialized != 0)
> -return;
> -initialized = 1;
> -
> -if (CONFIG_DSPUTIL)
> -ff_dsputil_static_init();
> -}
> -
>  int av_codec_is_encoder(const AVCodec *codec)
>  {
>  return codec && (codec->encode_sub || codec->encode2);
> @@ -116,7 +104,6 @@ int av_codec_is_decoder(const AVCodec *codec)
>  av_cold void avcodec_register(AVCodec *codec)
>  {
>  AVCodec **p;
> -avcodec_init();
>  p = &first_avcodec;
>  while (*p != NULL)
>  p = &(*p)->next;

It looks like dsputil stuff is now initialized from every decoder,
instead of avcodec_register(). Doesn't this cause additional issues
with thread-safety?

Or does it not matter that 2 threads might call ff_dsputil_static_init
at the same time?
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 089/132] dsputil: Initialize static dsputil data from within dsputil itself

2014-03-26 Thread Diego Biurrun
---
 libavcodec/dsputil.c | 10 --
 libavcodec/dsputil.h |  1 -
 libavcodec/utils.c   | 13 -
 3 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 534bc92..b29e959 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -2440,11 +2440,15 @@ static void clear_blocks_8_c(int16_t *blocks)
 memset(blocks, 0, sizeof(int16_t) * 6 * 64);
 }
 
-/* init static data */
-av_cold void ff_dsputil_static_init(void)
+static av_cold void square_tab_init(void)
 {
+static int initialized = 0;
 int i;
 
+if (initialized != 0)
+return;
+initialized = 1;
+
 for (i = 0; i < 512; i++)
 ff_square_tab[i] = (i - 256) * (i - 256);
 }
@@ -2453,6 +2457,8 @@ av_cold void ff_dsputil_init(DSPContext *c, 
AVCodecContext *avctx)
 {
 const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8;
 
+square_tab_init();
+
 #if CONFIG_ENCODERS
 if (avctx->bits_per_raw_sample == 10) {
 c->fdct= ff_jpeg_fdct_islow_10;
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index 7f467d1..2bc1aec 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -314,7 +314,6 @@ typedef struct DSPContext {
 op_fill_func fill_block_tab[2];
 } DSPContext;
 
-void ff_dsputil_static_init(void);
 void ff_dsputil_init(DSPContext *p, AVCodecContext *avctx);
 
 void ff_set_cmp(DSPContext *c, me_cmp_func *cmp, int type);
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index c88b346..738e247 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -91,18 +91,6 @@ AVCodec *av_codec_next(const AVCodec *c)
 return first_avcodec;
 }
 
-static av_cold void avcodec_init(void)
-{
-static int initialized = 0;
-
-if (initialized != 0)
-return;
-initialized = 1;
-
-if (CONFIG_DSPUTIL)
-ff_dsputil_static_init();
-}
-
 int av_codec_is_encoder(const AVCodec *codec)
 {
 return codec && (codec->encode_sub || codec->encode2);
@@ -116,7 +104,6 @@ int av_codec_is_decoder(const AVCodec *codec)
 av_cold void avcodec_register(AVCodec *codec)
 {
 AVCodec **p;
-avcodec_init();
 p = &first_avcodec;
 while (*p != NULL)
 p = &(*p)->next;
-- 
1.8.3.2

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


[libav-devel] THE GRAND DSPUTIL REFACTORING (act VIII)

2014-03-26 Thread Diego Biurrun
Today's set of dsputil patches eliminates unnecessary #includes,
does some general cleanup, and then splits off HuffYUV bits from
the dsputil monster.

[PATCH 084/132] Remove a number of unnecessary dsputil.h #includes
[PATCH 085/132] x86: dsputil: Eliminate some unnecessary
[PATCH 086/132] ppc: Drop a bunch of unnecessary dsputil_altivec.h
[PATCH 087/132] x86: Drop some unnecessary YASM ifdefs
[PATCH 088/132] x86: h264_qpel: Simplify an #if conditional
[PATCH 089/132] dsputil: Initialize static dsputil data from within
[PATCH 090/132] x86: dsputil: Move ff_apply_window_int16_* bits to
[PATCH 091/132] dsputil: Move DV-specific ff_zigzag248_direct table
[PATCH 092/132] dsputil: Split off HuffYUV decoding bits into their
[PATCH 093/132] dsputil: Split off HuffYUV encoding bits into their
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 085/132] x86: dsputil: Eliminate some unnecessary dsputil_x86.h #includes

2014-03-26 Thread Diego Biurrun
---
 libavcodec/x86/ac3dsp_init.c  | 1 -
 libavcodec/x86/h264dsp_init.c | 1 -
 libavcodec/x86/mpegvideo.c| 1 -
 libavcodec/x86/mpegvideoenc.c | 1 -
 4 files changed, 4 deletions(-)

diff --git a/libavcodec/x86/ac3dsp_init.c b/libavcodec/x86/ac3dsp_init.c
index a82c249..cd638b9 100644
--- a/libavcodec/x86/ac3dsp_init.c
+++ b/libavcodec/x86/ac3dsp_init.c
@@ -23,7 +23,6 @@
 #include "libavutil/mem.h"
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
-#include "dsputil_x86.h"
 #include "libavcodec/ac3.h"
 #include "libavcodec/ac3dsp.h"
 
diff --git a/libavcodec/x86/h264dsp_init.c b/libavcodec/x86/h264dsp_init.c
index e9d93e0..427662f 100644
--- a/libavcodec/x86/h264dsp_init.c
+++ b/libavcodec/x86/h264dsp_init.c
@@ -23,7 +23,6 @@
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
 #include "libavcodec/h264dsp.h"
-#include "dsputil_x86.h"
 
 /***/
 /* IDCT */
diff --git a/libavcodec/x86/mpegvideo.c b/libavcodec/x86/mpegvideo.c
index 25b44e6..db94ffa 100644
--- a/libavcodec/x86/mpegvideo.c
+++ b/libavcodec/x86/mpegvideo.c
@@ -25,7 +25,6 @@
 #include "libavutil/x86/cpu.h"
 #include "libavcodec/avcodec.h"
 #include "libavcodec/mpegvideo.h"
-#include "dsputil_x86.h"
 
 #if HAVE_INLINE_ASM
 
diff --git a/libavcodec/x86/mpegvideoenc.c b/libavcodec/x86/mpegvideoenc.c
index 19ab83a..78313f4 100644
--- a/libavcodec/x86/mpegvideoenc.c
+++ b/libavcodec/x86/mpegvideoenc.c
@@ -26,7 +26,6 @@
 #include "libavcodec/avcodec.h"
 #include "libavcodec/dct.h"
 #include "libavcodec/mpegvideo.h"
-#include "dsputil_x86.h"
 
 /* not permutated inverse zigzag_direct + 1 for MMX quantizer */
 DECLARE_ALIGNED(16, static uint16_t, inv_zigzag_direct16)[64];
-- 
1.8.3.2

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


[libav-devel] [PATCH 090/132] x86: dsputil: Move ff_apply_window_int16_* bits to ac3dsp, where they belong

2014-03-26 Thread Diego Biurrun
---
 libavcodec/x86/ac3dsp.asm  | 131 +
 libavcodec/x86/dsputil.asm | 130 
 2 files changed, 131 insertions(+), 130 deletions(-)

diff --git a/libavcodec/x86/ac3dsp.asm b/libavcodec/x86/ac3dsp.asm
index d0ab3e7..817d5a3 100644
--- a/libavcodec/x86/ac3dsp.asm
+++ b/libavcodec/x86/ac3dsp.asm
@@ -35,6 +35,10 @@ pw_bap_mul2: dw 5, 7, 0, 7, 5, 7, 0, 7
 pd_1:   times 4 dd 1
 pd_151: times 4 dd 151
 
+; used in ff_apply_window_int16()
+pb_revwords: SHUFFLE_MASK_W 7, 6, 5, 4, 3, 2, 1, 0
+pd_16384: times 4 dd 16384
+
 SECTION .text
 
 ;-
@@ -419,3 +423,130 @@ AC3_EXTRACT_EXPONENTS
 INIT_XMM ssse3
 AC3_EXTRACT_EXPONENTS
 %endif
+
+;-
+; void ff_apply_window_int16(int16_t *output, const int16_t *input,
+;const int16_t *window, unsigned int len)
+;-
+
+%macro REVERSE_WORDS 1-2
+%if cpuflag(ssse3) && notcpuflag(atom)
+pshufb  %1, %2
+%elif cpuflag(sse2)
+pshuflw  %1, %1, 0x1B
+pshufhw  %1, %1, 0x1B
+pshufd   %1, %1, 0x4E
+%elif cpuflag(mmxext)
+pshufw   %1, %1, 0x1B
+%endif
+%endmacro
+
+%macro MUL16FIXED 3
+%if cpuflag(ssse3) ; dst, src, unused
+; dst = ((dst * src) + (1<<14)) >> 15
+pmulhrsw   %1, %2
+%elif cpuflag(mmxext) ; dst, src, temp
+; dst = (dst * src) >> 15
+; pmulhw cuts off the bottom bit, so we have to lshift by 1 and add it back
+; in from the pmullw result.
+mova%3, %1
+pmulhw  %1, %2
+pmullw  %3, %2
+psrlw   %3, 15
+psllw   %1, 1
+por %1, %3
+%endif
+%endmacro
+
+%macro APPLY_WINDOW_INT16 1 ; %1 bitexact version
+%if %1
+cglobal apply_window_int16, 4,5,6, output, input, window, offset, offset2
+%else
+cglobal apply_window_int16_round, 4,5,6, output, input, window, offset, offset2
+%endif
+lea offset2q, [offsetq-mmsize]
+%if cpuflag(ssse3) && notcpuflag(atom)
+mova  m5, [pb_revwords]
+ALIGN 16
+%elif %1
+mova  m5, [pd_16384]
+%endif
+.loop:
+%if cpuflag(ssse3)
+; This version does the 16x16->16 multiplication in-place without expanding
+; to 32-bit. The ssse3 version is bit-identical.
+mova  m0, [windowq+offset2q]
+mova  m1, [ inputq+offset2q]
+pmulhrsw  m1, m0
+REVERSE_WORDS m0, m5
+pmulhrsw  m0, [ inputq+offsetq ]
+mova  [outputq+offset2q], m1
+mova  [outputq+offsetq ], m0
+%elif %1
+; This version expands 16-bit to 32-bit, multiplies by the window,
+; adds 16384 for rounding, right shifts 15, then repacks back to words to
+; save to the output. The window is reversed for the second half.
+mova  m3, [windowq+offset2q]
+mova  m4, [ inputq+offset2q]
+pxor  m0, m0
+punpcklwd m0, m3
+punpcklwd m1, m4
+pmaddwd   m0, m1
+paddd m0, m5
+psrad m0, 15
+pxor  m2, m2
+punpckhwd m2, m3
+punpckhwd m1, m4
+pmaddwd   m2, m1
+paddd m2, m5
+psrad m2, 15
+packssdw  m0, m2
+mova  [outputq+offset2q], m0
+REVERSE_WORDS m3
+mova  m4, [ inputq+offsetq]
+pxor  m0, m0
+punpcklwd m0, m3
+punpcklwd m1, m4
+pmaddwd   m0, m1
+paddd m0, m5
+psrad m0, 15
+pxor  m2, m2
+punpckhwd m2, m3
+punpckhwd m1, m4
+pmaddwd   m2, m1
+paddd m2, m5
+psrad m2, 15
+packssdw  m0, m2
+mova  [outputq+offsetq], m0
+%else
+; This version does the 16x16->16 multiplication in-place without expanding
+; to 32-bit. The mmxext and sse2 versions do not use rounding, and
+; therefore are not bit-identical to the C version.
+mova  m0, [windowq+offset2q]
+mova  m1, [ inputq+offset2q]
+mova  m2, [ inputq+offsetq ]
+MUL16FIXEDm1, m0, m3
+REVERSE_WORDS m0
+MUL16FIXEDm2, m0, m3
+mova  [outputq+offset2q], m1
+mova  [outputq+offsetq ], m2
+%endif
+add  offsetd, mmsize
+sub offset2d, mmsize
+jae .loop
+REP_RET
+%endmacro
+
+INIT_MMX mmxext
+APPLY_WINDOW_INT16 0
+INIT_XMM sse2
+APPLY_WINDOW_INT16 0
+
+INIT_MMX mmxext
+APPLY_WINDOW_INT16 1
+INIT_XMM sse2
+APPLY_WINDOW_INT16 1
+INIT_XMM ssse3
+APPLY_WINDOW_INT16 1
+INIT_XMM ssse3, atom
+APPLY_WINDOW_INT16 1
diff --git a/libavcodec/x86/dsputil.asm b/libavcodec/x86/dsputil.asm
index 414d212..a8c8fda 100644
--- a/libavcodec/x86/dsputil.asm
+++ b/libavcodec/x86/dsputil.asm
@@ -27,8 +27,6 @@ pb_: times 8 db -1
 pb_7: times 8 db 7
 pb_: db -1,-1,-1,-1,3,3,3,3,-1,-1,-1,-1,11,11,11,11
 pb_zz11zz55zz99zzdd: db -1,-1,1,1,-1,-1,5,5,-1,-1,9,9,-1,-1,13,13
-pb_revwords: SHUFFLE_MASK_W 7, 6, 5, 4, 3, 2, 1, 0
-p

[libav-devel] [PATCH 087/132] x86: Drop some unnecessary YASM ifdefs

2014-03-26 Thread Diego Biurrun
Dead code elimination is enough to avoid undefined references in these cases.
---
 libavcodec/x86/dsputilenc_mmx.c| 2 --
 libavcodec/x86/h264chroma_init.c   | 2 --
 libavcodec/x86/vorbisdsp_init.c| 2 --
 libavfilter/x86/vf_yadif_init.c| 2 --
 libavresample/x86/audio_mix_init.c | 2 --
 5 files changed, 10 deletions(-)

diff --git a/libavcodec/x86/dsputilenc_mmx.c b/libavcodec/x86/dsputilenc_mmx.c
index 705a7d1..dc57c69 100644
--- a/libavcodec/x86/dsputilenc_mmx.c
+++ b/libavcodec/x86/dsputilenc_mmx.c
@@ -992,7 +992,6 @@ av_cold void ff_dsputilenc_init_mmx(DSPContext *c, 
AVCodecContext *avctx,
 int cpu_flags = av_get_cpu_flags();
 const int dct_algo = avctx->dct_algo;
 
-#if HAVE_YASM
 if (EXTERNAL_MMX(cpu_flags)) {
 if (!high_bit_depth)
 c->get_pixels = ff_get_pixels_mmx;
@@ -1004,7 +1003,6 @@ av_cold void ff_dsputilenc_init_mmx(DSPContext *c, 
AVCodecContext *avctx,
 if (EXTERNAL_SSE2(cpu_flags))
 if (!high_bit_depth)
 c->get_pixels = ff_get_pixels_sse2;
-#endif /* HAVE_YASM */
 
 #if HAVE_INLINE_ASM
 if (INLINE_MMX(cpu_flags)) {
diff --git a/libavcodec/x86/h264chroma_init.c b/libavcodec/x86/h264chroma_init.c
index eec1653..8ec8a79 100644
--- a/libavcodec/x86/h264chroma_init.c
+++ b/libavcodec/x86/h264chroma_init.c
@@ -69,7 +69,6 @@ CHROMA_MC(avg, 8, 10, avx)
 
 av_cold void ff_h264chroma_init_x86(H264ChromaContext *c, int bit_depth)
 {
-#if HAVE_YASM
 int high_bit_depth = bit_depth > 8;
 int cpu_flags  = av_get_cpu_flags();
 
@@ -115,5 +114,4 @@ av_cold void ff_h264chroma_init_x86(H264ChromaContext *c, 
int bit_depth)
 c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_10_avx;
 c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_10_avx;
 }
-#endif
 }
diff --git a/libavcodec/x86/vorbisdsp_init.c b/libavcodec/x86/vorbisdsp_init.c
index 2a978b6..bbd8319 100644
--- a/libavcodec/x86/vorbisdsp_init.c
+++ b/libavcodec/x86/vorbisdsp_init.c
@@ -31,7 +31,6 @@ void ff_vorbis_inverse_coupling_sse(float *mag, float *ang,
 
 av_cold void ff_vorbisdsp_init_x86(VorbisDSPContext *dsp)
 {
-#if HAVE_YASM
 int cpu_flags = av_get_cpu_flags();
 
 #if ARCH_X86_32
@@ -40,5 +39,4 @@ av_cold void ff_vorbisdsp_init_x86(VorbisDSPContext *dsp)
 #endif /* ARCH_X86_32 */
 if (EXTERNAL_SSE(cpu_flags))
 dsp->vorbis_inverse_coupling = ff_vorbis_inverse_coupling_sse;
-#endif /* HAVE_YASM */
 }
diff --git a/libavfilter/x86/vf_yadif_init.c b/libavfilter/x86/vf_yadif_init.c
index 995bdab..510a023 100644
--- a/libavfilter/x86/vf_yadif_init.c
+++ b/libavfilter/x86/vf_yadif_init.c
@@ -38,7 +38,6 @@ void ff_yadif_filter_line_ssse3(void *dst, void *prev, void 
*cur,
 
 av_cold void ff_yadif_init_x86(YADIFContext *yadif)
 {
-#if HAVE_YASM
 int cpu_flags = av_get_cpu_flags();
 
 #if ARCH_X86_32
@@ -49,5 +48,4 @@ av_cold void ff_yadif_init_x86(YADIFContext *yadif)
 yadif->filter_line = ff_yadif_filter_line_sse2;
 if (EXTERNAL_SSSE3(cpu_flags))
 yadif->filter_line = ff_yadif_filter_line_ssse3;
-#endif /* HAVE_YASM */
 }
diff --git a/libavresample/x86/audio_mix_init.c 
b/libavresample/x86/audio_mix_init.c
index 932f6f2..7fc530e 100644
--- a/libavresample/x86/audio_mix_init.c
+++ b/libavresample/x86/audio_mix_init.c
@@ -173,7 +173,6 @@ DEFINE_MIX_3_8_TO_1_2(8)
 
 av_cold void ff_audio_mix_init_x86(AudioMix *am)
 {
-#if HAVE_YASM
 int cpu_flags = av_get_cpu_flags();
 
 if (EXTERNAL_SSE(cpu_flags)) {
@@ -211,5 +210,4 @@ av_cold void ff_audio_mix_init_x86(AudioMix *am)
 SET_MIX_3_8_TO_1_2(6)
 SET_MIX_3_8_TO_1_2(7)
 SET_MIX_3_8_TO_1_2(8)
-#endif /* HAVE_YASM */
 }
-- 
1.8.3.2

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


[libav-devel] [PATCH 086/132] ppc: Drop a bunch of unnecessary dsputil_altivec.h #includes

2014-03-26 Thread Diego Biurrun
---
 libavcodec/ppc/fmtconvert_altivec.c   | 1 -
 libavcodec/ppc/h264chroma_init.c  | 1 -
 libavcodec/ppc/mpegaudiodsp_altivec.c | 1 -
 libavcodec/ppc/mpegvideo_altivec.c| 1 -
 libavcodec/ppc/vp3dsp_altivec.c   | 1 -
 5 files changed, 5 deletions(-)

diff --git a/libavcodec/ppc/fmtconvert_altivec.c 
b/libavcodec/ppc/fmtconvert_altivec.c
index 1359259..fddeba6 100644
--- a/libavcodec/ppc/fmtconvert_altivec.c
+++ b/libavcodec/ppc/fmtconvert_altivec.c
@@ -24,7 +24,6 @@
 #include "libavutil/mem.h"
 #include "libavutil/ppc/util_altivec.h"
 #include "libavcodec/fmtconvert.h"
-#include "dsputil_altivec.h"
 
 #if HAVE_ALTIVEC
 
diff --git a/libavcodec/ppc/h264chroma_init.c b/libavcodec/ppc/h264chroma_init.c
index 415a8df..08980a8 100644
--- a/libavcodec/ppc/h264chroma_init.c
+++ b/libavcodec/ppc/h264chroma_init.c
@@ -25,7 +25,6 @@
 #include "libavutil/ppc/types_altivec.h"
 #include "libavutil/ppc/util_altivec.h"
 #include "libavcodec/h264chroma.h"
-#include "dsputil_altivec.h"
 
 #if HAVE_ALTIVEC
 #define PUT_OP_U8_ALTIVEC(d, s, dst) d = s
diff --git a/libavcodec/ppc/mpegaudiodsp_altivec.c 
b/libavcodec/ppc/mpegaudiodsp_altivec.c
index 6855c0b..6a23cf5 100644
--- a/libavcodec/ppc/mpegaudiodsp_altivec.c
+++ b/libavcodec/ppc/mpegaudiodsp_altivec.c
@@ -25,7 +25,6 @@
 #include "libavutil/internal.h"
 #include "libavutil/ppc/util_altivec.h"
 #include "libavcodec/mpegaudiodsp.h"
-#include "dsputil_altivec.h"
 
 #if HAVE_ALTIVEC
 
diff --git a/libavcodec/ppc/mpegvideo_altivec.c 
b/libavcodec/ppc/mpegvideo_altivec.c
index 3d74029..eb1663d 100644
--- a/libavcodec/ppc/mpegvideo_altivec.c
+++ b/libavcodec/ppc/mpegvideo_altivec.c
@@ -30,7 +30,6 @@
 #include "libavutil/ppc/types_altivec.h"
 #include "libavutil/ppc/util_altivec.h"
 #include "libavcodec/mpegvideo.h"
-#include "dsputil_altivec.h"
 
 #if HAVE_ALTIVEC
 
diff --git a/libavcodec/ppc/vp3dsp_altivec.c b/libavcodec/ppc/vp3dsp_altivec.c
index bf50c02..612e6e4 100644
--- a/libavcodec/ppc/vp3dsp_altivec.c
+++ b/libavcodec/ppc/vp3dsp_altivec.c
@@ -26,7 +26,6 @@
 #include "libavutil/ppc/types_altivec.h"
 #include "libavutil/ppc/util_altivec.h"
 #include "libavcodec/vp3dsp.h"
-#include "dsputil_altivec.h"
 
 #if HAVE_ALTIVEC
 
-- 
1.8.3.2

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


[libav-devel] [PATCH 091/132] dsputil: Move DV-specific ff_zigzag248_direct table to dvdata

2014-03-26 Thread Diego Biurrun
---
 libavcodec/dsputil.c | 13 -
 libavcodec/dsputil.h |  1 -
 libavcodec/dv.c  |  2 +-
 libavcodec/dvdata.c  | 13 +
 libavcodec/dvdata.h  |  2 ++
 libavcodec/dvenc.c   |  2 +-
 6 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index b29e959..f81f693 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -57,19 +57,6 @@ uint32_t ff_square_tab[512] = { 0, };
 #define pb_7f (~0UL / 255 * 0x7f)
 #define pb_80 (~0UL / 255 * 0x80)
 
-/* Specific zigzag scan for 248 idct. NOTE that unlike the
- * specification, we interleave the fields */
-const uint8_t ff_zigzag248_direct[64] = {
- 0,  8,  1,  9, 16, 24,  2, 10,
-17, 25, 32, 40, 48, 56, 33, 41,
-18, 26,  3, 11,  4, 12, 19, 27,
-34, 42, 49, 57, 50, 58, 35, 43,
-20, 28,  5, 13,  6, 14, 21, 29,
-36, 44, 51, 59, 52, 60, 37, 45,
-22, 30,  7, 15, 23, 31, 38, 46,
-53, 61, 54, 62, 39, 47, 55, 63,
-};
-
 const uint8_t ff_alternate_horizontal_scan[64] = {
  0,  1,  2,  3,  8,  9, 16, 17,
 10, 11,  4,  5,  6,  7, 15, 14,
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index 2bc1aec..8e74e6e 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -35,7 +35,6 @@
 /* encoding scans */
 extern const uint8_t ff_alternate_horizontal_scan[64];
 extern const uint8_t ff_alternate_vertical_scan[64];
-extern const uint8_t ff_zigzag248_direct[64];
 
 extern uint32_t ff_square_tab[512];
 
diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index a6f614a..1a54c4e 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -311,7 +311,7 @@ av_cold int ff_dvvideo_init(AVCodecContext *avctx)
 /* 248DCT setup */
 s->fdct[1] = dsp.fdct248;
 s->idct_put[1] = ff_simple_idct248_put;  // FIXME: need to add it to DSP
-memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64);
+memcpy(s->dv_zigzag[1], ff_dv_zigzag248_direct, 64);
 
 s->avctx = avctx;
 avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT;
diff --git a/libavcodec/dvdata.c b/libavcodec/dvdata.c
index f9c22ac..ad41a1b 100644
--- a/libavcodec/dvdata.c
+++ b/libavcodec/dvdata.c
@@ -28,6 +28,19 @@
 
 #include "dvdata.h"
 
+/* Specific zigzag scan for 248 idct. NOTE that unlike the
+ * specification, we interleave the fields */
+const uint8_t ff_dv_zigzag248_direct[64] = {
+ 0,  8,  1,  9, 16, 24,  2, 10,
+17, 25, 32, 40, 48, 56, 33, 41,
+18, 26,  3, 11,  4, 12, 19, 27,
+34, 42, 49, 57, 50, 58, 35, 43,
+20, 28,  5, 13,  6, 14, 21, 29,
+36, 44, 51, 59, 52, 60, 37, 45,
+22, 30,  7, 15, 23, 31, 38, 46,
+53, 61, 54, 62, 39, 47, 55, 63,
+};
+
 /* unquant tables (not used directly) */
 const uint8_t ff_dv_quant_shifts[22][4] = {
   { 3,3,4,4 },
diff --git a/libavcodec/dvdata.h b/libavcodec/dvdata.h
index 164ef1b..8e7c0fb 100644
--- a/libavcodec/dvdata.h
+++ b/libavcodec/dvdata.h
@@ -21,6 +21,8 @@
 
 #include 
 
+extern const uint8_t ff_dv_zigzag248_direct[64];
+
 extern const uint8_t ff_dv_quant_shifts[22][4];
 extern const uint8_t ff_dv_quant_offset[4];
 
diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
index 590a2a9..6338dee 100644
--- a/libavcodec/dvenc.c
+++ b/libavcodec/dvenc.c
@@ -245,7 +245,7 @@ static av_always_inline int dv_init_enc_block(EncBlockInfo* 
bi, uint8_t *data, i
 }
 bi->mb[0] = blk[0];
 
-zigzag_scan = bi->dct_mode ? ff_zigzag248_direct : ff_zigzag_direct;
+zigzag_scan = bi->dct_mode ? ff_dv_zigzag248_direct : ff_zigzag_direct;
 weight = bi->dct_mode ? dv_weight_248 : dv_weight_88;
 
 for (area = 0; area < 4; area++) {
-- 
1.8.3.2

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


[libav-devel] [PATCH 088/132] x86: h264_qpel: Simplify an #if conditional

2014-03-26 Thread Diego Biurrun
The extra conditions are covered by previous #ifs and conditional compilation.
---
 libavcodec/x86/h264_qpel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/x86/h264_qpel.c b/libavcodec/x86/h264_qpel.c
index aa6e9d5..e971db6 100644
--- a/libavcodec/x86/h264_qpel.c
+++ b/libavcodec/x86/h264_qpel.c
@@ -497,7 +497,7 @@ QPEL16_OP(mc31, MMX)\
 QPEL16_OP(mc32, MMX)\
 QPEL16_OP(mc33, MMX)
 
-#if ARCH_X86_32 && HAVE_YASM && CONFIG_H264QPEL // ARCH_X86_64 implies SSE2+
+#if ARCH_X86_32 // ARCH_X86_64 implies SSE2+
 QPEL16(mmxext)
 #endif
 
-- 
1.8.3.2

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


[libav-devel] [PATCH 093/132] dsputil: Split off HuffYUV encoding bits into their own context

2014-03-26 Thread Diego Biurrun
---
 configure  |   7 ++-
 libavcodec/Makefile|   1 +
 libavcodec/dsputil.c   |  56 --
 libavcodec/dsputil.h   |  13 -
 libavcodec/huffyuv.h   |   2 +
 libavcodec/huffyuvenc.c|  34 +--
 libavcodec/huffyuvencdsp.c |  84 +++
 libavcodec/huffyuvencdsp.h |  41 ++
 libavcodec/pngenc.c|  16 +++---
 libavcodec/utvideo.h   |   4 +-
 libavcodec/utvideoenc.c|   4 +-
 libavcodec/x86/Makefile|   1 +
 libavcodec/x86/dsputilenc_mmx.c|  68 --
 libavcodec/x86/huffyuvencdsp_mmx.c | 113 +
 14 files changed, 278 insertions(+), 166 deletions(-)
 create mode 100644 libavcodec/huffyuvencdsp.c
 create mode 100644 libavcodec/huffyuvencdsp.h
 create mode 100644 libavcodec/x86/huffyuvencdsp_mmx.c

diff --git a/configure b/configure
index 417f0b8..2aadb22 100755
--- a/configure
+++ b/configure
@@ -1484,6 +1484,7 @@ CONFIG_EXTRA="
 hpeldsp
 huffman
 huffyuvdsp
+huffyuvencdsp
 intrax8
 lgplv3
 lpc
@@ -1713,7 +1714,7 @@ h264_decoder_select="golomb h264chroma h264dsp h264pred 
h264qpel videodsp"
 h264_decoder_suggest="error_resilience"
 hevc_decoder_select="dsputil golomb videodsp"
 huffyuv_decoder_select="dsputil huffyuvdsp"
-huffyuv_encoder_select="dsputil huffman"
+huffyuv_encoder_select="dsputil huffman huffyuvencdsp"
 iac_decoder_select="imc_decoder"
 imc_decoder_select="dsputil fft mdct sinewin"
 indeo3_decoder_select="hpeldsp"
@@ -1764,7 +1765,7 @@ nellymoser_encoder_select="audio_frame_queue mdct sinewin"
 nuv_decoder_select="dsputil lzo"
 png_decoder_deps="zlib"
 png_encoder_deps="zlib"
-png_encoder_select="dsputil"
+png_encoder_select="huffyuvencdsp"
 prores_decoder_select="dsputil"
 prores_encoder_select="dsputil"
 qcelp_decoder_select="lsp"
@@ -1795,7 +1796,7 @@ truespeech_decoder_select="dsputil"
 tscc_decoder_deps="zlib"
 twinvq_decoder_select="mdct lsp sinewin"
 utvideo_decoder_select="dsputil"
-utvideo_encoder_select="dsputil huffman"
+utvideo_encoder_select="dsputil huffman huffyuvencdsp"
 vble_decoder_select="huffyuvdsp"
 vc1_decoder_select="error_resilience h263_decoder h264chroma h264qpel intrax8"
 vc1image_decoder_select="vc1_decoder"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 0436d51..367a219 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -47,6 +47,7 @@ OBJS-$(CONFIG_H264QPEL)+= h264qpel.o
 OBJS-$(CONFIG_HPELDSP) += hpeldsp.o
 OBJS-$(CONFIG_HUFFMAN) += huffman.o
 OBJS-$(CONFIG_HUFFYUVDSP)  += huffyuvdsp.o
+OBJS-$(CONFIG_HUFFYUVENCDSP)   += huffyuvencdsp.o
 OBJS-$(CONFIG_INTRAX8) += intrax8.o intrax8dsp.o
 OBJS-$(CONFIG_LIBXVID) += libxvid_rc.o
 OBJS-$(CONFIG_LPC) += lpc.o
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 0613b57..83bf501 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -53,10 +53,6 @@ uint32_t ff_square_tab[512] = { 0, };
 #include "dsputil_template.c"
 #include "dsputilenc_template.c"
 
-// 0x7f7f7f7f or 0x7f7f7f7f7f7f7f7f or whatever, depending on the cpu's native 
arithmetic size
-#define pb_7f (~0UL / 255 * 0x7f)
-#define pb_80 (~0UL / 255 * 0x80)
-
 const uint8_t ff_alternate_horizontal_scan[64] = {
  0,  1,  2,  3,  8,  9, 16, 17,
 10, 11,  4,  5,  6,  7, 15, 14,
@@ -1663,55 +1659,6 @@ void ff_set_cmp(DSPContext *c, me_cmp_func *cmp, int 
type)
 }
 }
 
-static void diff_bytes_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w)
-{
-long i;
-
-#if !HAVE_FAST_UNALIGNED
-if ((long) src2 & (sizeof(long) - 1)) {
-for (i = 0; i + 7 < w; i += 8) {
-dst[i + 0] = src1[i + 0] - src2[i + 0];
-dst[i + 1] = src1[i + 1] - src2[i + 1];
-dst[i + 2] = src1[i + 2] - src2[i + 2];
-dst[i + 3] = src1[i + 3] - src2[i + 3];
-dst[i + 4] = src1[i + 4] - src2[i + 4];
-dst[i + 5] = src1[i + 5] - src2[i + 5];
-dst[i + 6] = src1[i + 6] - src2[i + 6];
-dst[i + 7] = src1[i + 7] - src2[i + 7];
-}
-} else
-#endif
-for (i = 0; i <= w - (int) sizeof(long); i += sizeof(long)) {
-long a = *(long *) (src1 + i);
-long b = *(long *) (src2 + i);
-*(long *) (dst + i) = ((a | pb_80) - (b & pb_7f)) ^
-  ((a ^ b ^ pb_80) & pb_80);
-}
-for (; i < w; i++)
-dst[i + 0] = src1[i + 0] - src2[i + 0];
-}
-
-static void sub_hfyu_median_prediction_c(uint8_t *dst, const uint8_t *src1,
- const uint8_t *src2, int w,
- int *left, int *left_top)
-{
-int i;
-uint8_t l, lt;
-
-l  = *left;
-lt = *left_top;
-
-for (i = 0; i < w; i++) {
-const int pred = mid_pred(l, 

[libav-devel] [PATCH 084/132] Remove a number of unnecessary dsputil.h #includes

2014-03-26 Thread Diego Biurrun
---
 libavcodec/arm/vp3dsp_init_arm.c | 1 -
 libavcodec/binkdsp.c | 1 -
 libavcodec/dvbsubdec.c   | 2 +-
 libavcodec/dvdsubdec.c   | 2 +-
 libavcodec/h264pred.c| 3 ++-
 libavcodec/indeo5.c  | 1 -
 libavcodec/mpeg12.c  | 1 -
 libavcodec/msmpeg4dec.c  | 1 -
 libavcodec/mss4.c| 1 -
 libavcodec/vc1dsp.c  | 1 +
 libavcodec/vc1dsp.h  | 1 -
 libavcodec/vp3dsp.c  | 2 +-
 libavcodec/vp56.h| 1 -
 libavcodec/x86/vp3dsp_init.c | 1 -
 14 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/libavcodec/arm/vp3dsp_init_arm.c b/libavcodec/arm/vp3dsp_init_arm.c
index 1ab0852..11e1f1c 100644
--- a/libavcodec/arm/vp3dsp_init_arm.c
+++ b/libavcodec/arm/vp3dsp_init_arm.c
@@ -21,7 +21,6 @@
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
 #include "libavutil/arm/cpu.h"
-#include "libavcodec/dsputil.h"
 #include "libavcodec/vp3dsp.h"
 
 void ff_vp3_idct_put_neon(uint8_t *dest, int line_size, int16_t *data);
diff --git a/libavcodec/binkdsp.c b/libavcodec/binkdsp.c
index a0ac2a8..1fb03b2 100644
--- a/libavcodec/binkdsp.c
+++ b/libavcodec/binkdsp.c
@@ -25,7 +25,6 @@
  */
 
 #include "libavutil/attributes.h"
-#include "dsputil.h"
 #include "binkdsp.h"
 
 #define A1  2896 /* (1/sqrt(2))<<12 */
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 4782022..1dcefae 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -18,8 +18,8 @@
  * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
+
 #include "avcodec.h"
-#include "dsputil.h"
 #include "get_bits.h"
 #include "bytestream.h"
 #include "libavutil/colorspace.h"
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index b4cb30d..02f70be 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -18,9 +18,9 @@
  * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
+
 #include "avcodec.h"
 #include "get_bits.h"
-#include "dsputil.h"
 #include "internal.h"
 
 #include "libavutil/attributes.h"
diff --git a/libavcodec/h264pred.c b/libavcodec/h264pred.c
index 531760c..94323f9 100644
--- a/libavcodec/h264pred.c
+++ b/libavcodec/h264pred.c
@@ -26,7 +26,8 @@
  */
 
 #include "libavutil/attributes.h"
-#include "dsputil.h"
+#include "libavutil/intreadwrite.h"
+#include "avcodec.h"
 #include "h264pred.h"
 
 #define BIT_DEPTH 8
diff --git a/libavcodec/indeo5.c b/libavcodec/indeo5.c
index 83bbcbb..476355b 100644
--- a/libavcodec/indeo5.c
+++ b/libavcodec/indeo5.c
@@ -30,7 +30,6 @@
 #define BITSTREAM_READER_LE
 #include "avcodec.h"
 #include "get_bits.h"
-#include "dsputil.h"
 #include "ivi_dsp.h"
 #include "ivi_common.h"
 #include "indeo5data.h"
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 5797d27..be5227f 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -28,7 +28,6 @@
 #include "libavutil/attributes.h"
 #include "internal.h"
 #include "avcodec.h"
-#include "dsputil.h"
 #include "mpegvideo.h"
 #include "error_resilience.h"
 #include "mpeg12.h"
diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c
index 9a12633..b1e3209 100644
--- a/libavcodec/msmpeg4dec.c
+++ b/libavcodec/msmpeg4dec.c
@@ -23,7 +23,6 @@
  */
 
 #include "avcodec.h"
-#include "dsputil.h"
 #include "mpegvideo.h"
 #include "msmpeg4.h"
 #include "libavutil/x86/asm.h"
diff --git a/libavcodec/mss4.c b/libavcodec/mss4.c
index fa85258..9198acc 100644
--- a/libavcodec/mss4.c
+++ b/libavcodec/mss4.c
@@ -27,7 +27,6 @@
 
 #include "avcodec.h"
 #include "bytestream.h"
-#include "dsputil.h"
 #include "get_bits.h"
 #include "internal.h"
 #include "mss34dsp.h"
diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c
index e47bd5a..e112c7c 100644
--- a/libavcodec/vc1dsp.c
+++ b/libavcodec/vc1dsp.c
@@ -26,6 +26,7 @@
  */
 
 #include "libavutil/common.h"
+#include "dsputil.h"
 #include "h264chroma.h"
 #include "vc1dsp.h"
 
diff --git a/libavcodec/vc1dsp.h b/libavcodec/vc1dsp.h
index 30be508..7de6a3d 100644
--- a/libavcodec/vc1dsp.h
+++ b/libavcodec/vc1dsp.h
@@ -28,7 +28,6 @@
 #ifndef AVCODEC_VC1DSP_H
 #define AVCODEC_VC1DSP_H
 
-#include "dsputil.h"
 #include "hpeldsp.h"
 #include "h264chroma.h"
 
diff --git a/libavcodec/vp3dsp.c b/libavcodec/vp3dsp.c
index 703fe38..f3505e3 100644
--- a/libavcodec/vp3dsp.c
+++ b/libavcodec/vp3dsp.c
@@ -25,10 +25,10 @@
  */
 
 #include "libavutil/attributes.h"
+#include "libavutil/intreadwrite.h"
 #include "libavutil/common.h"
 #include "libavutil/intreadwrite.h"
 #include "avcodec.h"
-#include "dsputil.h"
 #include "rnd_avg.h"
 #include "vp3dsp.h"
 
diff --git a/libavcodec/vp56.h b/libavcodec/vp56.h
index f71b9a8..a852ff8 100644
--- a/libavcodec/vp56.h
+++ b/libavcodec/vp56.h
@@ -26,7 +26,6 @@
 #ifndef AVCODEC_VP56_H
 #define AVCODEC_VP56_H
 
-#include "dsputil.h"
 #include "get_bits.h"
 

Re: [libav-devel] [PATCH] x86: h264_qpel: Fix typo in CALL_2X_PIXELS macro invocation

2014-03-26 Thread Janne Grunau
On 2014-03-26 12:04:28 +0100, Diego Biurrun wrote:
> This fixes FATE with mmxext CPUFLAGS set.
> ---
>  libavcodec/x86/h264_qpel.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/x86/h264_qpel.c b/libavcodec/x86/h264_qpel.c
> index aa6e9d5..b285c1f 100644
> --- a/libavcodec/x86/h264_qpel.c
> +++ b/libavcodec/x86/h264_qpel.c
> @@ -51,7 +51,7 @@ void ff_avg_pixels16_l2_mmxext(uint8_t *dst, uint8_t *src1, 
> uint8_t *src2,
>  #define ff_avg_pixels16_l2_sse2 ff_avg_pixels16_l2_mmxext
>  
>  CALL_2X_PIXELS(ff_avg_pixels16_mmxext, ff_avg_pixels8_mmxext, 8)
> -CALL_2X_PIXELS(ff_put_pixels16_mmxext, ff_avg_pixels8_mmxext, 8)
> +CALL_2X_PIXELS(ff_put_pixels16_mmxext, ff_put_pixels8_mmxext, 8)
>  
>  #define DEF_QPEL(OPNAME)\
>  void ff_ ## OPNAME ## _h264_qpel4_h_lowpass_mmxext(uint8_t *dst, uint8_t 
> *src, int dstStride, int srcStride);\

ok

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


[libav-devel] [PATCH] x86: h264_qpel: Fix typo in CALL_2X_PIXELS macro invocation

2014-03-26 Thread Diego Biurrun
This fixes FATE with mmxext CPUFLAGS set.
---
 libavcodec/x86/h264_qpel.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/x86/h264_qpel.c b/libavcodec/x86/h264_qpel.c
index aa6e9d5..b285c1f 100644
--- a/libavcodec/x86/h264_qpel.c
+++ b/libavcodec/x86/h264_qpel.c
@@ -51,7 +51,7 @@ void ff_avg_pixels16_l2_mmxext(uint8_t *dst, uint8_t *src1, 
uint8_t *src2,
 #define ff_avg_pixels16_l2_sse2 ff_avg_pixels16_l2_mmxext
 
 CALL_2X_PIXELS(ff_avg_pixels16_mmxext, ff_avg_pixels8_mmxext, 8)
-CALL_2X_PIXELS(ff_put_pixels16_mmxext, ff_avg_pixels8_mmxext, 8)
+CALL_2X_PIXELS(ff_put_pixels16_mmxext, ff_put_pixels8_mmxext, 8)
 
 #define DEF_QPEL(OPNAME)\
 void ff_ ## OPNAME ## _h264_qpel4_h_lowpass_mmxext(uint8_t *dst, uint8_t *src, 
int dstStride, int srcStride);\
-- 
1.7.9.5

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


[libav-devel] [PATCH v2 3/5] oggparsevorbis: export replaygain tags from Vorbis comments

2014-03-26 Thread Alessandro Ghedini
---
 libavformat/oggparsevorbis.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
index c19b545..3eac0ba 100644
--- a/libavformat/oggparsevorbis.c
+++ b/libavformat/oggparsevorbis.c
@@ -36,6 +36,7 @@
 #include "internal.h"
 #include "oggdec.h"
 #include "vorbiscomment.h"
+#include "replaygain.h"
 
 static int ogm_chapter(AVFormatContext *as, uint8_t *key, uint8_t *val)
 {
@@ -305,8 +306,14 @@ static int vorbis_header(AVFormatContext *s, int idx)
 if (os->psize > 8 &&
 ff_vorbis_comment(s, &st->metadata, os->buf + os->pstart + 7,
   os->psize - 8) >= 0) {
+unsigned new_len;
+
+int ret = ff_replaygain_export(st, st->metadata);
+if (ret < 0)
+return ret;
+
 // drop all metadata we parsed and which is not required by 
libvorbis
-unsigned new_len = 7 + 4 + AV_RL32(priv->packet[1] + 7) + 4 + 1;
+new_len = 7 + 4 + AV_RL32(priv->packet[1] + 7) + 4 + 1;
 if (new_len >= 16 && new_len < os->psize) {
 AV_WL32(priv->packet[1] + new_len - 5, 0);
 priv->packet[1][new_len - 1] = 1;
-- 
1.9.1

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


[libav-devel] [PATCH v2 5/5] af_volume: implement replaygain clipping prevention

2014-03-26 Thread Alessandro Ghedini
---
 libavfilter/af_volume.c | 27 +++
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c
index 393c4e7..0371aa4 100644
--- a/libavfilter/af_volume.c
+++ b/libavfilter/af_volume.c
@@ -247,24 +247,35 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*buf)
 if (vol->replaygain != REPLAYGAIN_DROP) {
 AVReplayGain *replaygain = (AVReplayGain*)sd->data;
 int32_t gain;
-float g;
-
-if (vol->replaygain == REPLAYGAIN_TRACK &&
-replaygain->track_gain != INT32_MIN)
-gain = replaygain->track_gain;
-else if (replaygain->album_gain != INT32_MIN)
-gain = replaygain->album_gain;
-else {
+uint32_t peak;
+float g, p;
+
+if (vol->replaygain == REPLAYGAIN_TRACK) {
+if (replaygain->track_gain != INT32_MIN)
+gain = replaygain->track_gain;
+
+if (replaygain->track_peak != 0)
+peak = replaygain->track_peak;
+} else if (vol->replaygain == REPLAYGAIN_ALBUM) {
+if (replaygain->album_gain != INT32_MIN)
+gain = replaygain->album_gain;
+
+if (replaygain->album_peak != 0)
+peak = replaygain->album_peak;
+} else {
 av_log(inlink->dst, AV_LOG_WARNING, "Both ReplayGain gain "
"values are unknown.\n");
 gain = 10;
+peak = 10;
 }
 g = gain / 10.0f;
+p = peak / 10.0f;
 
 av_log(inlink->dst, AV_LOG_VERBOSE,
"Using gain %f dB from replaygain side data.\n", g);
 
 vol->volume   = pow(10, (g + vol->replaygain_preamp) / 20);
+vol->volume   = FFMIN(vol->volume, 1.0 / p);
 vol->volume_i = (int)(vol->volume * 256 + 0.5);
 
 volume_init(vol);
-- 
1.9.1

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


[libav-devel] [PATCH v2 2/5] flacdec: export replaygain tags from Vorbis comments

2014-03-26 Thread Alessandro Ghedini
---
 libavformat/flacdec.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index ecbb7ec..11360a9 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -26,6 +26,7 @@
 #include "rawdec.h"
 #include "oggdec.h"
 #include "vorbiscomment.h"
+#include "replaygain.h"
 #include "libavcodec/bytestream.h"
 
 static int flac_read_header(AVFormatContext *s)
@@ -146,6 +147,10 @@ static int flac_read_header(AVFormatContext *s)
 }
 }
 
+ret = ff_replaygain_export(st, s->metadata);
+if (ret < 0)
+return ret;
+
 return 0;
 }
 
-- 
1.9.1

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


[libav-devel] [PATCH v2 1/5] replaygain: correctly parse peak values

2014-03-26 Thread Alessandro Ghedini
According to the ReplayGain spec, the peak amplitude may overflow and may result
in peak amplitude values greater than 1.0 with psychoacoustically coded audio,
such as MP3. Fully compliant decoders must allow peak overflows.

Additionally, having peak values in the 0<->UINT32_MAX scale makes it more
difficult for applications to actually use the peak values (e.g. when
implementing clipping prevention) since values have to be rescaled down.

This patch corrects the peak parsing by removing the rescaling of the decoded
values between 0 and UINT32_MAX and the 1.0 upper limit.
---
 libavformat/replaygain.c | 35 +++
 libavutil/replaygain.h   |  3 +--
 2 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/libavformat/replaygain.c b/libavformat/replaygain.c
index cf4dbf8..d4d3d1a 100644
--- a/libavformat/replaygain.c
+++ b/libavformat/replaygain.c
@@ -64,34 +64,29 @@ static int32_t parse_gain(const char *gain)
 
 static uint32_t parse_peak(const uint8_t *peak)
 {
-int64_t val = 0;
-int64_t scale = 1;
+char *fraction;
+unsigned int  scale = 1;
+uint32_t mb = 0;
+unsigned int db;
 
 if (!peak)
 return 0;
 
 peak += strspn(peak, " \t");
 
-if (peak[0] == '1' && peak[1] == '.')
-return UINT32_MAX;
-else if (!(peak[0] == '0' && peak[1] == '.'))
-return 0;
-
-peak += 2;
-
-while (av_isdigit(*peak)) {
-int digit = *peak - '0';
-
-if (scale > INT64_MAX / 10)
-break;
-
-val= 10 * val + digit;
-scale *= 10;
-
-peak++;
+db = strtol(peak, &fraction, 0);
+if (*fraction++ == '.') {
+while (av_isdigit(*fraction) && scale) {
+mb += scale * (*fraction - '0');
+scale /= 10;
+fraction++;
+}
 }
 
-return av_rescale(val, UINT32_MAX, scale);
+if (db > (UINT32_MAX - mb) / 10)
+return 0;
+
+return db * 10 + mb;
 }
 
 static int replaygain_export(AVStream *st,
diff --git a/libavutil/replaygain.h b/libavutil/replaygain.h
index 8447703..00d2873 100644
--- a/libavutil/replaygain.h
+++ b/libavutil/replaygain.h
@@ -34,8 +34,7 @@ typedef struct AVReplayGain {
  */
 int32_t track_gain;
 /**
- * Peak track amplitude, with UINT32_MAX representing full scale. 0 when
- * unknown.
+ * Peak track amplitude. 0 when unknown.
  */
 uint32_t track_peak;
 /**
-- 
1.9.1

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


[libav-devel] [PATCH v2 0/5] More ReplayGain

2014-03-26 Thread Alessandro Ghedini
Fixed the min/max values for replaygain-preamp (I used the example values in
the replaygain spec, but they can be changed if needed) and added the
oggparsevorbis patch.

Alessandro Ghedini (5):
  replaygain: correctly parse peak values
  flacdec: export replaygain tags from Vorbis comments
  oggparsevorbis: export replaygain tags from Vorbis comments
  af_volume: implement replaygain pre-amplification
  af_volume: implement replaygain clipping prevention

 doc/filters.texi |  6 ++
 libavfilter/af_volume.c  | 31 ++-
 libavfilter/af_volume.h  |  1 +
 libavformat/flacdec.c|  5 +
 libavformat/oggparsevorbis.c |  9 -
 libavformat/replaygain.c | 35 +++
 libavutil/replaygain.h   |  3 +--
 7 files changed, 58 insertions(+), 32 deletions(-)

-- 
1.9.1

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


[libav-devel] [PATCH v2 4/5] af_volume: implement replaygain pre-amplification

2014-03-26 Thread Alessandro Ghedini
This adds a new "replaygain-preamp" option to the filter, and simply adds its
value to the replaygain gain value.
---
 doc/filters.texi| 6 ++
 libavfilter/af_volume.c | 4 +++-
 libavfilter/af_volume.h | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 93625c6..4a737ef 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -633,6 +633,12 @@ Prefer track gain, if present.
 @item album
 Prefer album gain, if present.
 @end table
+
+@item replaygain-preamp
+Pre-amplification gain in dB to apply to the selected replaygain gain.
+
+Default value for @var{replaygain-preamp} is 0.0.
+
 @end table
 
 @subsection Examples
diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c
index 165624e..393c4e7 100644
--- a/libavfilter/af_volume.c
+++ b/libavfilter/af_volume.c
@@ -59,6 +59,8 @@ static const AVOption options[] = {
 { "ignore", "replaygain side data is ignored", 0, AV_OPT_TYPE_CONST, { 
.i64 = REPLAYGAIN_IGNORE }, 0, 0, A, "replaygain" },
 { "track",  "track gain is preferred", 0, AV_OPT_TYPE_CONST, { 
.i64 = REPLAYGAIN_TRACK  }, 0, 0, A, "replaygain" },
 { "album",  "album gain is preferred", 0, AV_OPT_TYPE_CONST, { 
.i64 = REPLAYGAIN_ALBUM  }, 0, 0, A, "replaygain" },
+{ "replaygain-preamp", "Apply replaygain pre-amplification",
+OFFSET(replaygain_preamp), AV_OPT_TYPE_DOUBLE, { .dbl = 0.0 }, 
-15.0, 15.0, A },
 { NULL },
 };
 
@@ -262,7 +264,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
 av_log(inlink->dst, AV_LOG_VERBOSE,
"Using gain %f dB from replaygain side data.\n", g);
 
-vol->volume   = pow(10, g / 20);
+vol->volume   = pow(10, (g + vol->replaygain_preamp) / 20);
 vol->volume_i = (int)(vol->volume * 256 + 0.5);
 
 volume_init(vol);
diff --git a/libavfilter/af_volume.h b/libavfilter/af_volume.h
index ec13e80..d831ec4 100644
--- a/libavfilter/af_volume.h
+++ b/libavfilter/af_volume.h
@@ -47,6 +47,7 @@ typedef struct VolumeContext {
 AVFloatDSPContext fdsp;
 enum PrecisionType precision;
 enum ReplayGainType replaygain;
+double replaygain_preamp;
 double volume;
 intvolume_i;
 intchannels;
-- 
1.9.1

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


Re: [libav-devel] [PATCH 1/2] srtp.c: K&R formatting cosmetics; added note for printf

2014-03-26 Thread Martin Storsjö

On Tue, 25 Mar 2014, Tanja Batchelor wrote:


---
libavformat/srtp.c | 11 +++
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavformat/srtp.c b/libavformat/srtp.c
index 6659bfc..9f4aa36 100644
--- a/libavformat/srtp.c
+++ b/libavformat/srtp.c
@@ -17,7 +17,7 @@
 * You should have received a copy of the GNU Lesser General Public
 * License along with Libav; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
+ */



This adds a trailing whitespace, which is forbidden. What was the purpose 
of this part of the change?



#include "libavutil/base64.h"
#include "libavutil/aes.h"
@@ -28,6 +28,9 @@
#include "rtpdec.h"
#include "srtp.h"

+// printf is used purposefully in this file
+// for printing to stdout instead of stderr
+
void ff_srtp_free(struct SRTPContext *s)
{
if (!s)
@@ -400,7 +403,7 @@ static void print_data(const uint8_t *buf, int len)
{
int i;
for (i = 0; i < len; i++)
-printf("%02x", buf[i]);
+ printf("%02x", buf[i]);


This was previously correctly indented with 8 spaces, now it's changed to 
9 which is wrong. Why did you think this had to be changed?



printf("\n");
}

@@ -430,8 +433,8 @@ static void test_encrypt(const uint8_t *data, int in_len, 
const char *suite,
else
printf("Decrypted content doesn't match input\n");
} else {
-printf("Decryption failed\n");
-}
+  printf("Decryption failed\n");
+  }


This was previously indented correctly, with the brace at 4 spaces and the 
printf at 8 spaces indentation - why should this be changed?


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


Re: [libav-devel] [PATCH 1/2] srtp.c: K&R formatting cosmetics; added note for printf

2014-03-26 Thread Luca Barbato
On 26/03/14 04:36, Tanja Batchelor wrote:

https://wiki.libav.org/GitCommit gives you some information about how a
commit is formed.

srtp.c: K&R formatting cosmetics

Added note for printf

> ---
>  libavformat/srtp.c | 11 +++
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/libavformat/srtp.c b/libavformat/srtp.c
> index 6659bfc..9f4aa36 100644
> --- a/libavformat/srtp.c
> +++ b/libavformat/srtp.c
> @@ -17,7 +17,7 @@
>   * You should have received a copy of the GNU Lesser General Public
>   * License along with Libav; if not, write to the Free Software
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> - */
> + */ 

Introducing trailing spaces is wrong.

>  #include "libavutil/base64.h"
>  #include "libavutil/aes.h"
> @@ -28,6 +28,9 @@
>  #include "rtpdec.h"
>  #include "srtp.h"
>  
> +// printf is used purposefully in this file  
> +// for printing to stdout instead of stderr
> +
>  void ff_srtp_free(struct SRTPContext *s)
>  {
>  if (!s)
> @@ -400,7 +403,7 @@ static void print_data(const uint8_t *buf, int len)
>  {
>  int i;
>  for (i = 0; i < len; i++)
> -printf("%02x", buf[i]);
> + printf("%02x", buf[i]);
>  printf("\n");
>  }
>  
> @@ -430,8 +433,8 @@ static void test_encrypt(const uint8_t *data, int in_len, 
> const char *suite,
>  else
>  printf("Decrypted content doesn't match input\n");
>  } else {
> -printf("Decryption failed\n");
> -}
> +  printf("Decryption failed\n");
> +  }

This look unaligned, why this ?

>  ff_srtp_free(&enc);
>  ff_srtp_free(&dec);
>  }
> 

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


Re: [libav-devel] [PATCH 3/4] af_volume: implement replaygain pre-amplification

2014-03-26 Thread Alessandro Ghedini
On Tue, Mar 25, 2014 at 11:40:48PM -0400, Justin Ruggles wrote:
> On 03/25/2014 09:55 AM, Alessandro Ghedini wrote:
> > This adds a new "replaygain-preamp" option to the filter, and simply adds 
> > its
> > value to the replaygain gain value.
> > ---
> >  doc/filters.texi| 6 ++
> >  libavfilter/af_volume.c | 4 +++-
> >  libavfilter/af_volume.h | 1 +
> >  3 files changed, 10 insertions(+), 1 deletion(-)
> > 
> > diff --git a/doc/filters.texi b/doc/filters.texi
> > index 93625c6..4a737ef 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -633,6 +633,12 @@ Prefer track gain, if present.
> >  @item album
> >  Prefer album gain, if present.
> >  @end table
> > +
> > +@item replaygain-preamp
> > +Pre-amplification gain in dB to apply to the selected replaygain gain.
> > +
> > +Default value for @var{replaygain-preamp} is 0.0.
> > +
> >  @end table
> >  
> >  @subsection Examples
> > diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c
> > index 165624e..3ad1850 100644
> > --- a/libavfilter/af_volume.c
> > +++ b/libavfilter/af_volume.c
> > @@ -59,6 +59,8 @@ static const AVOption options[] = {
> >  { "ignore", "replaygain side data is ignored", 0, 
> > AV_OPT_TYPE_CONST, { .i64 = REPLAYGAIN_IGNORE }, 0, 0, A, "replaygain" },
> >  { "track",  "track gain is preferred", 0, 
> > AV_OPT_TYPE_CONST, { .i64 = REPLAYGAIN_TRACK  }, 0, 0, A, "replaygain" },
> >  { "album",  "album gain is preferred", 0, 
> > AV_OPT_TYPE_CONST, { .i64 = REPLAYGAIN_ALBUM  }, 0, 0, A, "replaygain" },
> > +{ "replaygain-preamp", "Apply replaygain pre-amplification",
> > +OFFSET(replaygain_preamp), AV_OPT_TYPE_DOUBLE, { .dbl = 0.0 }, 
> > 0, 0x7f, A },
> 
> That's an odd-looking maximum. Any particular reason for that value?

Nope. It should be -15..+15, but I forgot to change it. Thanks.

-- 
perl -E '$_=q;$/= @{[@_]};and s;\S+;;eg;say~~reverse'
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] dsputil: Move hpel_template #include out of dsputil_template

2014-03-26 Thread Luca Barbato
On 26/03/14 10:05, Diego Biurrun wrote:
> Multiple inclusion makes no sense as it is only used in the 8-bit case.
> ---
> 
> The previous iteration was missing the bit_depth_template #include
> addition and therefore breaking a few tests with --disable-asm.
> 

Good that had been catched.

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


[libav-devel] [PATCH 1/2] srtp.c: K&R formatting cosmetics; added note for printf

2014-03-26 Thread Tanja Batchelor
---
 libavformat/srtp.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavformat/srtp.c b/libavformat/srtp.c
index 6659bfc..9f4aa36 100644
--- a/libavformat/srtp.c
+++ b/libavformat/srtp.c
@@ -17,7 +17,7 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
+ */ 
 
 #include "libavutil/base64.h"
 #include "libavutil/aes.h"
@@ -28,6 +28,9 @@
 #include "rtpdec.h"
 #include "srtp.h"
 
+// printf is used purposefully in this file  
+// for printing to stdout instead of stderr
+
 void ff_srtp_free(struct SRTPContext *s)
 {
 if (!s)
@@ -400,7 +403,7 @@ static void print_data(const uint8_t *buf, int len)
 {
 int i;
 for (i = 0; i < len; i++)
-printf("%02x", buf[i]);
+ printf("%02x", buf[i]);
 printf("\n");
 }
 
@@ -430,8 +433,8 @@ static void test_encrypt(const uint8_t *data, int in_len, 
const char *suite,
 else
 printf("Decrypted content doesn't match input\n");
 } else {
-printf("Decryption failed\n");
-}
+  printf("Decryption failed\n");
+  }
 ff_srtp_free(&enc);
 ff_srtp_free(&dec);
 }
-- 
1.9.0

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


[libav-devel] [PATCH] dsputil: Move hpel_template #include out of dsputil_template

2014-03-26 Thread Diego Biurrun
Multiple inclusion makes no sense as it is only used in the 8-bit case.
---

The previous iteration was missing the bit_depth_template #include
addition and therefore breaking a few tests with --disable-asm.

 libavcodec/dsputil.c  | 1 +
 libavcodec/dsputil_template.c | 4 
 libavcodec/hpel_template.c| 2 ++
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index b81ba47..e41ea86 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -48,6 +48,7 @@ uint32_t ff_square_tab[512] = { 0, };
 #undef BIT_DEPTH
 
 #define BIT_DEPTH 8
+#include "hpel_template.c"
 #include "tpel_template.c"
 #include "dsputil_template.c"
 
diff --git a/libavcodec/dsputil_template.c b/libavcodec/dsputil_template.c
index 56f41ad..c2b30d2 100644
--- a/libavcodec/dsputil_template.c
+++ b/libavcodec/dsputil_template.c
@@ -97,10 +97,6 @@ static void FUNCC(clear_blocks)(int16_t *blocks)
 }
 #endif
 
-#if BIT_DEPTH == 8
-#include "hpel_template.c"
-#endif
-
 #define PIXOP2(OPNAME, OP)  \
 static inline void FUNC(OPNAME ## _no_rnd_pixels8_l2)(uint8_t *dst, \
   const uint8_t *src1, \
diff --git a/libavcodec/hpel_template.c b/libavcodec/hpel_template.c
index 0a8550a..fa7a614 100644
--- a/libavcodec/hpel_template.c
+++ b/libavcodec/hpel_template.c
@@ -21,6 +21,8 @@
 
 #include "pixels.h"
 
+#include "bit_depth_template.c"
+
 #define DEF_HPEL(OPNAME, OP)\
 static inline void FUNC(OPNAME ## _pixels8_l2)(uint8_t *dst,\
const uint8_t *src1, \
-- 
1.8.3.2

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


Re: [libav-devel] [PATCH 0/6] truehd: ARM optimisations

2014-03-26 Thread Martin Storsjö

On Tue, 25 Mar 2014, Ben Avison wrote:


On Tue, 25 Mar 2014 16:28:47 -, Martin Storsjö  wrote:

All in all the series looks ok - any objections to me pushing this any
day soon, with "it ne" added before the conditional branches to C
functions, and with the altmacro parameter changed to use normal
parameter syntax (offset vs \offset in patch 1/6)?


Go for it. I didn't want to keep spamming the list with more and more
reposts of the series with only relatively minor and cosmetic changes,
so I was waiting for things to die down, but I'm also happy for you to
make the changes at the time you commit them.


I found a few more details, but I can fix them up before pushing as well.

mlpdsp_arm.S uses ldrd, which is only available in armv5te (we've got one 
armv4t and one armv5t setup on fate). Renaming the file to _armv5te.S and 
building it conditionally within that setup is easy though.


The checks in mlpdsp_init_arm.c shouldn't just check cpu_flags, they also 
need to take into account the fact that the optimizations might not be 
built at all - which is handled by the have_armv5te() or have_armv6() 
macros.


I've done these fixes locally and will include them when pushing.

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