Re: [libav-devel] [PATCH 2/2] h264: convert 8-bit qpel inlined assembly to yasm

2012-08-01 Thread Ronald S. Bultje
Hi,

On Wed, Aug 1, 2012 at 10:29 PM, Daniel Kang  wrote:
> On Wed, Aug 1, 2012 at 5:22 AM, Måns Rullgård  wrote:
>>
>> Daniel Kang  writes:
>>
>> > Can I have access to a setup that doesn't have inlined assembly?
>>
>> --extra-cflags=-D__asm__=error should make it fail nicely.
>
>
> This gives me bizarre errors like:
>
> /usr/include/x86_64-linux-gnu/asm/posix_types_64.h:25:14: error: storage
> class specified for parameter ‘__kernel_clockid_t’
>
> Is there a way to just disable inlined assembly in libav?

I had that too. I used a sed script to replace __asm__ with
DONTCOMPILEME for testing (see sed -i).

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


Re: [libav-devel] [PATCH 2/2] H.264: Convert 8-bit qpel inlined assembly to yasm

2012-08-01 Thread Daniel Kang
On Thu, Aug 2, 2012 at 1:30 AM,  wrote:

> From: Daniel Kang 
>
> ---
>  libavcodec/x86/Makefile |3 +-
>  libavcodec/x86/dsputil_mmx.c|   81 +---
>  libavcodec/x86/dsputil_yasm.asm |   42 ++
>  libavcodec/x86/h264_qpel.asm|  850 +++
>  libavcodec/x86/h264_qpel_mmx.c  |  946
> ---
>  5 files changed, 984 insertions(+), 938 deletions(-)
>  create mode 100644 libavcodec/x86/h264_qpel.asm
>

Compiles and passes fate-h264 for me with --disable-yasm and with yasm.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/2] H264: Remove 3dnow qpel code.

2012-08-01 Thread daniel . d . kang
From: Daniel Kang 

The only CPUs that have 3dnow and don't have mmxext are 12 years old.
---
 libavcodec/x86/dsputil_mmx.c  |   11 ++-
 libavcodec/x86/dsputil_mmx_avg_template.c |8 ++--
 libavcodec/x86/h264_qpel_mmx.c|4 
 3 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
index afbb531..0adc6d4 100644
--- a/libavcodec/x86/dsputil_mmx.c
+++ b/libavcodec/x86/dsputil_mmx.c
@@ -198,12 +198,14 @@ DECLARE_ALIGNED(16, const double, ff_pd_2)[2] = { 2.0, 
2.0 };
 #define DEF(x) x ## _3dnow
 #define PAVGB "pavgusb"
 #define OP_AVG PAVGB
+#define IS_3DNOW
 
 #include "dsputil_mmx_avg_template.c"
 
 #undef DEF
 #undef PAVGB
 #undef OP_AVG
+#undef IS_3DNOW
 
 /***/
 /* MMX2 specific */
@@ -2807,15 +2809,6 @@ static void dsputil_init_3dnow(DSPContext *c, 
AVCodecContext *avctx,
 SET_QPEL_FUNCS(avg_qpel,0, 16, 3dnow, );
 SET_QPEL_FUNCS(avg_qpel,1,  8, 3dnow, );
 
-if (!high_bit_depth) {
-SET_QPEL_FUNCS(put_h264_qpel, 0, 16, 3dnow, );
-SET_QPEL_FUNCS(put_h264_qpel, 1,  8, 3dnow, );
-SET_QPEL_FUNCS(put_h264_qpel, 2,  4, 3dnow, );
-SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, 3dnow, );
-SET_QPEL_FUNCS(avg_h264_qpel, 1,  8, 3dnow, );
-SET_QPEL_FUNCS(avg_h264_qpel, 2,  4, 3dnow, );
-}
-
 SET_QPEL_FUNCS(put_2tap_qpel, 0, 16, 3dnow, );
 SET_QPEL_FUNCS(put_2tap_qpel, 1,  8, 3dnow, );
 SET_QPEL_FUNCS(avg_2tap_qpel, 0, 16, 3dnow, );
diff --git a/libavcodec/x86/dsputil_mmx_avg_template.c 
b/libavcodec/x86/dsputil_mmx_avg_template.c
index 8b116b7..29d0e51 100644
--- a/libavcodec/x86/dsputil_mmx_avg_template.c
+++ b/libavcodec/x86/dsputil_mmx_avg_template.c
@@ -55,6 +55,7 @@ static void DEF(put_pixels8_x2)(uint8_t *block, const uint8_t 
*pixels, int line_
 :"%"REG_a, "memory");
 }
 
+#ifndef IS_3DNOW
 static void DEF(put_pixels4_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, 
int dstStride, int src1Stride, int h)
 {
 __asm__ volatile(
@@ -104,7 +105,7 @@ static void DEF(put_pixels4_l2)(uint8_t *dst, uint8_t 
*src1, uint8_t *src2, int
 :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
 :"memory");
 }
-
+#endif
 
 static void DEF(put_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, 
int dstStride, int src1Stride, int h)
 {
@@ -226,6 +227,7 @@ static void DEF(put_no_rnd_pixels8_l2)(uint8_t *dst, 
uint8_t *src1, uint8_t *src
 :"memory");*/
 }
 
+#ifndef IS_3DNOW
 static void DEF(avg_pixels4_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, 
int dstStride, int src1Stride, int h)
 {
 __asm__ volatile(
@@ -276,7 +278,7 @@ static void DEF(avg_pixels4_l2)(uint8_t *dst, uint8_t 
*src1, uint8_t *src2, int
 :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
 :"memory");
 }
-
+#endif
 
 static void DEF(avg_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, 
int dstStride, int src1Stride, int h)
 {
@@ -872,6 +874,7 @@ static void DEF(avg_pixels8_xy2)(uint8_t *block, const 
uint8_t *pixels, int line
 :"%"REG_a,  "memory");
 }
 
+#ifndef IS_3DNOW
 static void DEF(avg_pixels4)(uint8_t *block, const uint8_t *pixels, int 
line_size, int h)
 {
 do {
@@ -896,6 +899,7 @@ static void DEF(avg_pixels4)(uint8_t *block, const uint8_t 
*pixels, int line_siz
 h -= 4;
 } while(h > 0);
 }
+#endif
 
 //FIXME the following could be optimized too ...
 static void DEF(put_no_rnd_pixels16_x2)(uint8_t *block, const uint8_t *pixels, 
int line_size, int h){
diff --git a/libavcodec/x86/h264_qpel_mmx.c b/libavcodec/x86/h264_qpel_mmx.c
index fc1635d..e84e5a5 100644
--- a/libavcodec/x86/h264_qpel_mmx.c
+++ b/libavcodec/x86/h264_qpel_mmx.c
@@ -1163,9 +1163,6 @@ QPEL(put_, 16,XMM, 16)\
 QPEL(avg_, 8, XMM, 16)\
 QPEL(avg_, 16,XMM, 16)\
 
-#define PAVGB "pavgusb"
-QPEL_H264(put_,   PUT_OP, 3dnow)
-QPEL_H264(avg_, AVG_3DNOW_OP, 3dnow)
 #undef PAVGB
 #define PAVGB "pavgb"
 QPEL_H264(put_,   PUT_OP, mmx2)
@@ -1184,7 +1181,6 @@ QPEL_H264_HV_XMM(avg_,  AVG_MMX2_OP, ssse3)
 #endif
 #undef PAVGB
 
-H264_MC_4816(3dnow)
 H264_MC_4816(mmx2)
 H264_MC_816(H264_MC_V, sse2)
 H264_MC_816(H264_MC_HV, sse2)
-- 
1.7.9.5

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


Re: [libav-devel] [PATCH 2/2] h264: convert 8-bit qpel inlined assembly to yasm

2012-08-01 Thread Daniel Kang
On Wed, Aug 1, 2012 at 5:22 AM, Måns Rullgård  wrote:

> Daniel Kang  writes:
>
> > Can I have access to a setup that doesn't have inlined assembly?
>
> --extra-cflags=-D__asm__=error should make it fail nicely.


This gives me bizarre errors like:

/usr/include/x86_64-linux-gnu/asm/posix_types_64.h:25:14: error: storage
class specified for parameter ‘__kernel_clockid_t’

Is there a way to just disable inlined assembly in libav?
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] wmapro: prevent division by zero when sample rate is unspecified

2012-08-01 Thread Kostya Shishkov
On Wed, Aug 01, 2012 at 11:23:52PM -0400, Sean McGovern wrote:
> This fixes Bugzilla #327:
> ---
>  libavcodec/wmaprodec.c |5 +
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
> index 30a43c8..88c33c3 100644
> --- a/libavcodec/wmaprodec.c
> +++ b/libavcodec/wmaprodec.c
> @@ -335,6 +335,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
>  return AVERROR_INVALIDDATA;
>  }
>  
> +if (!s->avctx->sample_rate) {
> +av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n");
> +return AVERROR_INVALIDDATA;
> +}
> +
>  s->num_channels = avctx->channels;
>  
>  if (s->num_channels < 0) {
> -- 

Is sample_rate still signed? If yes then the check should be amended to <= 0,
otherwise patch looks fine.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] wmapro: prevent division by zero when sample rate is unspecified

2012-08-01 Thread Sean McGovern
This fixes Bugzilla #327:
---
 libavcodec/wmaprodec.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 30a43c8..88c33c3 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -335,6 +335,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
 return AVERROR_INVALIDDATA;
 }
 
+if (!s->avctx->sample_rate) {
+av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n");
+return AVERROR_INVALIDDATA;
+}
+
 s->num_channels = avctx->channels;
 
 if (s->num_channels < 0) {
-- 
1.7.8.6

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


Re: [libav-devel] [PATCH 2/2] rtmp: Prevent handling of an incorrect invoke packet

2012-08-01 Thread Luca Barbato
On 01/08/12 22:44, Luca Barbato wrote:
> On 01/08/12 12:13, Samuel Pitoiset wrote:
>> ---
>>  libavformat/rtmpproto.c | 6 +-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
>> index 6044425..8c0ecb2 100644
>> --- a/libavformat/rtmpproto.c
>> +++ b/libavformat/rtmpproto.c
>> @@ -1038,7 +1038,11 @@ static int handle_invoke(URLContext *s, RTMPPacket 
>> *pkt)
>>  const uint8_t *data_end = pkt->data + pkt->data_size;
>>  int ret;
>>  
>> -//TODO: check for the messages sent for wrong state?
>> +if (pkt->data[0] != 0x02) {
>> +av_log(s, AV_LOG_ERROR, "No string method found in invoke 
>> packet\n");
>> +return AVERROR_INVALIDDATA;
>> +}
>> +
>>  if (!memcmp(pkt->data, "\002\000\006_error", 9)) {
>>  uint8_t tmpstr[256];
> 
> Do we have an AMF_DATA_STRING or similar macro?
> 

(the answer is that yes we do, and you should use it.)

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


Re: [libav-devel] [PATCH] fate: Only test enabled filters

2012-08-01 Thread Måns Rullgård
Diego Biurrun  writes:

> This fixes running FATE without --enable-gpl.
> ---
>  tests/Makefile|3 ++-
>  tests/fate/filter.mak |   18 +-
>  2 files changed, 11 insertions(+), 10 deletions(-)

Your patch makes me notice that that file needs a rather different
overhaul.  I'll look at it closer tomorrow.

-- 
Måns Rullgård
m...@mansr.com
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] x86: Refactor PSWAPD fallback implementations and port to cpuflags

2012-08-01 Thread Ronald S. Bultje
Hi,

On Wed, Aug 1, 2012 at 5:38 PM, Loren Merritt  wrote:
> On Thu, 2 Aug 2012, Diego Biurrun wrote:
>> On Wed, Aug 01, 2012 at 07:41:01AM -0700, Ronald S. Bultje wrote:
>>> On Wed, Aug 1, 2012 at 5:30 AM, Diego Biurrun  wrote:
 --- a/libavcodec/x86/fft_mmx.asm
 +++ b/libavcodec/x86/fft_mmx.asm
 @@ -105,7 +105,8 @@ SECTION_TEXT
  pxor %3, [ps_m1p1] ; {t8,t7}
  mova %6, %1
 -pswapd   %3, %3
 +movd [r0+12], %3
 +punpckhdq %3, [r0+8]
>>>
>>> Needs rebase?
>>
>> No, it's the only caller with two identical arguments, so I moved the
>> macro branch for identical arguments out of the macro and into the caller.
>
> But then it doesn't generate pswapd in the 3dnow2 instantiation.
>
> Or you could make it not have two identical arguments; there's a spare
> mmreg (%4) at that point.

Earlier, I recommended using a separate macro for in-place PSWAPD, can
you do that Diego?

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


Re: [libav-devel] [PATCH] x86: Refactor PSWAPD fallback implementations and port to cpuflags

2012-08-01 Thread Loren Merritt
On Thu, 2 Aug 2012, Diego Biurrun wrote:
> On Wed, Aug 01, 2012 at 07:41:01AM -0700, Ronald S. Bultje wrote:
>> On Wed, Aug 1, 2012 at 5:30 AM, Diego Biurrun  wrote:
>>> --- a/libavcodec/x86/fft_mmx.asm
>>> +++ b/libavcodec/x86/fft_mmx.asm
>>> @@ -105,7 +105,8 @@ SECTION_TEXT
>>>  pxor %3, [ps_m1p1] ; {t8,t7}
>>>  mova %6, %1
>>> -pswapd   %3, %3
>>> +movd [r0+12], %3
>>> +punpckhdq %3, [r0+8]
>>
>> Needs rebase?
>
> No, it's the only caller with two identical arguments, so I moved the
> macro branch for identical arguments out of the macro and into the caller.

But then it doesn't generate pswapd in the 3dnow2 instantiation.

Or you could make it not have two identical arguments; there's a spare
mmreg (%4) at that point.

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


Re: [libav-devel] [PATCH 04/10] idcin: set channel_layout

2012-08-01 Thread Alex Converse
On Wed, Aug 1, 2012 at 2:36 PM, Justin Ruggles  wrote:
> ---
>  libavformat/idcin.c |3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/libavformat/idcin.c b/libavformat/idcin.c
> index 113c66e..c8b8225 100644
> --- a/libavformat/idcin.c
> +++ b/libavformat/idcin.c
> @@ -68,6 +68,7 @@
>   *   transmitting them to the video decoder
>   */
>
> +#include "libavutil/audioconvert.h"
>  #include "libavutil/imgutils.h"
>  #include "libavutil/intreadwrite.h"
>  #include "avformat.h"
> @@ -204,6 +205,8 @@ static int idcin_read_header(AVFormatContext *s)
>  st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
>  st->codec->codec_tag = 1;
>  st->codec->channels = channels;
> +st->codec->channel_layout = channels > 1 ? AV_CH_LAYOUT_STEREO :
> +   AV_CH_LAYOUT_MONO;
>  st->codec->sample_rate = sample_rate;
>  st->codec->bits_per_coded_sample = bytes_per_sample * 8;
>  st->codec->bit_rate = sample_rate * bytes_per_sample * 8 * channels;
> --
> 1.7.1

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


Re: [libav-devel] [PATCH 01/10] idcinvideo: correctly set AVFrame defaults

2012-08-01 Thread Luca Barbato
On 01/08/12 23:36, Justin Ruggles wrote:
> ---
>  libavcodec/idcinvideo.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/libavcodec/idcinvideo.c b/libavcodec/idcinvideo.c
> index c936ebb..65414ee 100644
> --- a/libavcodec/idcinvideo.c
> +++ b/libavcodec/idcinvideo.c
> @@ -166,7 +166,7 @@ static av_cold int idcin_decode_init(AVCodecContext 
> *avctx)
>  huff_build_tree(s, i);
>  }
>  
> -s->frame.data[0] = NULL;
> +avcodec_get_frame_defaults(&s->frame);
>  
>  return 0;
>  }
> 

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


Re: [libav-devel] [PATCH] fate: Only test enabled filters

2012-08-01 Thread Luca Barbato
On 02/08/12 00:39, Diego Biurrun wrote:
> This fixes running FATE without --enable-gpl.
> ---
>  tests/Makefile|3 ++-
>  tests/fate/filter.mak |   18 +-
>  2 files changed, 11 insertions(+), 10 deletions(-)

Looks ok.



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


Re: [libav-devel] [PATCH] x86: Refactor PSWAPD fallback implementations and port to cpuflags

2012-08-01 Thread Ronald S. Bultje
Hi,

On Wed, Aug 1, 2012 at 3:55 PM, Diego Biurrun  wrote:
> +%macro PSWAPD 2
> +%if cpuflag(mmxext)
> +pshufw %1, %2, 0x4e

If you change 0x4e to q1032, patch is OK with me.

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


[libav-devel] [PATCH] x86: Refactor PSWAPD fallback implementations and port to cpuflags

2012-08-01 Thread Diego Biurrun
---
 libavcodec/x86/fft_mmx.asm|   16 ++--
 libavcodec/x86/fmtconvert.asm |   17 ++---
 libavutil/x86/x86util.asm |   12 
 3 files changed, 16 insertions(+), 29 deletions(-)

diff --git a/libavcodec/x86/fft_mmx.asm b/libavcodec/x86/fft_mmx.asm
index 7746cdd..8961098 100644
--- a/libavcodec/x86/fft_mmx.asm
+++ b/libavcodec/x86/fft_mmx.asm
@@ -105,7 +105,8 @@ SECTION_TEXT
 pfadd%5, %4 ; {t6,t5}
 pxor %3, [ps_m1p1] ; {t8,t7}
 mova %6, %1
-PSWAPD   %3, %3
+movd [r0+12], %3
+punpckhdq %3, [r0+8]
 pfadd%1, %5 ; {r0,i0}
 pfsub%6, %5 ; {r2,i2}
 mova %4, %2
@@ -498,19 +499,6 @@ fft8 %+ SUFFIX:
 %endmacro
 
 %if ARCH_X86_32
-%macro PSWAPD 2
-%if cpuflag(3dnowext)
-pswapd %1, %2
-%elifidn %1, %2
-movd [r0+12], %1
-punpckhdq %1, [r0+8]
-%else
-movq  %1, %2
-psrlq %1, 32
-punpckldq %1, %2
-%endif
-%endmacro
-
 INIT_MMX 3dnowext
 FFT48_3DNOW
 
diff --git a/libavcodec/x86/fmtconvert.asm b/libavcodec/x86/fmtconvert.asm
index 68616f2..1782624 100644
--- a/libavcodec/x86/fmtconvert.asm
+++ b/libavcodec/x86/fmtconvert.asm
@@ -247,16 +247,6 @@ FLOAT_TO_INT16_INTERLEAVE2
 INIT_XMM sse2
 FLOAT_TO_INT16_INTERLEAVE2
 
-
-%macro PSWAPD_SSE 2
-pshufw %1, %2, 0x4e
-%endmacro
-%macro PSWAPD_3DNOW 2
-movq  %1, %2
-psrlq %1, 32
-punpckldq %1, %2
-%endmacro
-
 %macro FLOAT_TO_INT16_INTERLEAVE6 0
 ; void float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len)
 cglobal float_to_int16_interleave6, 2, 8, 0, dst, src, src1, src2, src3, src4, 
src5, len
@@ -286,11 +276,11 @@ cglobal float_to_int16_interleave6, 2, 8, 0, dst, src, 
src1, src2, src3, src4, s
 packssdw   mm0, mm3
 packssdw   mm1, mm4
 packssdw   mm2, mm5
-pswapd mm3, mm0
+PSWAPD mm3, mm0
 punpcklwd  mm0, mm1
 punpckhwd  mm1, mm2
 punpcklwd  mm2, mm3
-pswapd mm3, mm0
+PSWAPD mm3, mm0
 punpckldq  mm0, mm2
 punpckhdq  mm2, mm1
 punpckldq  mm1, mm3
@@ -306,12 +296,9 @@ cglobal float_to_int16_interleave6, 2, 8, 0, dst, src, 
src1, src2, src3, src4, s
 %endmacro ; FLOAT_TO_INT16_INTERLEAVE6
 
 INIT_MMX sse
-%define pswapd PSWAPD_SSE
 FLOAT_TO_INT16_INTERLEAVE6
 INIT_MMX 3dnow
-%define pswapd PSWAPD_3DNOW
 FLOAT_TO_INT16_INTERLEAVE6
-%undef pswapd
 INIT_MMX 3dnowext
 FLOAT_TO_INT16_INTERLEAVE6
 
diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm
index b98efbc..6142a7c 100644
--- a/libavutil/x86/x86util.asm
+++ b/libavutil/x86/x86util.asm
@@ -306,6 +306,18 @@
 %endif
 %endmacro
 
+%macro PSWAPD 2
+%if cpuflag(mmxext)
+pshufw %1, %2, 0x4e
+%elif cpuflag(3dnowext)
+pswapd %1, %2
+%elif cpuflag(3dnow)
+movq  %1, %2
+psrlq %1, 32
+punpckldq %1, %2
+%endif
+%endmacro
+
 %macro DEINTB 5 ; mask, reg1, mask, reg2, optional src to fill masks from
 %ifnum %5
 pand   m%3, m%5, m%4 ; src .. y6 .. y4
-- 
1.7.2.5

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


Re: [libav-devel] [PATCH] x86: Refactor PSWAPD fallback implementations and port to cpuflags

2012-08-01 Thread Diego Biurrun
On Wed, Aug 01, 2012 at 10:57:47AM -0700, Ronald S. Bultje wrote:
> On Wed, Aug 1, 2012 at 10:53 AM, Diego Biurrun  wrote:
> > +%macro PSWAPD 2
> > +%if cpuflag(sse)
> > +pshufw %1, %2, 0x4e
> 
> As Loren said earlier, this is mmx2, not sse.

Rebase screwup, I had this fixed at some point...

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


Re: [libav-devel] [PATCH] x86: Refactor PSWAPD fallback implementations and port to cpuflags

2012-08-01 Thread Diego Biurrun
On Wed, Aug 01, 2012 at 07:41:01AM -0700, Ronald S. Bultje wrote:
> On Wed, Aug 1, 2012 at 5:30 AM, Diego Biurrun  wrote:
> > --- a/libavcodec/x86/fft_mmx.asm
> > +++ b/libavcodec/x86/fft_mmx.asm
> > @@ -105,7 +105,8 @@ SECTION_TEXT
> >  pxor %3, [ps_m1p1] ; {t8,t7}
> >  mova %6, %1
> > -pswapd   %3, %3
> > +movd [r0+12], %3
> > +punpckhdq %3, [r0+8]
> 
> Needs rebase?

No, it's the only caller with two identical arguments, so I moved the
macro branch for identical arguments out of the macro and into the caller.

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


[libav-devel] [PATCH] fate: Only test enabled filters

2012-08-01 Thread Diego Biurrun
This fixes running FATE without --enable-gpl.
---
 tests/Makefile|3 ++-
 tests/fate/filter.mak |   18 +-
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/tests/Makefile b/tests/Makefile
index 0b11102..2ab529e 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -81,7 +81,8 @@ FATE-$(CONFIG_AVCONV) += $(FATE_AVCONV)
 
 FATE-$(CONFIG_AVCODEC)  += $(FATE_LIBAVCODEC)
 
-FATE_SAMPLES-$(CONFIG_AVCONV) += $(FATE_SAMPLES_AVCONV)
+FATE_SAMPLES-$(CONFIG_AVCONV) += $(FATE_SAMPLES_AVCONV) \
+ $(FATE_SAMPLES_AVCONV-yes)
 FATE_SAMPLES += $(FATE_SAMPLES-yes)
 
 FATE += $(FATE-yes)
diff --git a/tests/fate/filter.mak b/tests/fate/filter.mak
index 35b6558..911a0ba 100644
--- a/tests/fate/filter.mak
+++ b/tests/fate/filter.mak
@@ -18,8 +18,8 @@ $(FATE_AMIX): SRC1 = 
$(TARGET_PATH)/tests/data/asynth-44100-2-2.wav
 $(FATE_AMIX): CMP  = oneoff
 $(FATE_AMIX): CMP_UNIT = f32
 
-FATE_FILTER += $(FATE_AMIX)
-FATE_SAMPLES_AVCONV += $(FATE_AMIX)
+FATE_FILTER-$(CONFIG_AMIX_FILTER) += $(FATE_AMIX)
+FATE_SAMPLES_AVCONV-$(CONFIG_AMIX_FILTER) += $(FATE_AMIX)
 
 FATE_ASYNCTS += fate-filter-asyncts
 fate-filter-asyncts: SRC = $(SAMPLES)/nellymoser/nellymoser-discont.flv
@@ -27,13 +27,13 @@ fate-filter-asyncts: CMD = pcm -analyzeduration 1000 -i 
$(SRC) -af asyncts
 fate-filter-asyncts: CMP = oneoff
 fate-filter-asyncts: REF = $(SAMPLES)/nellymoser/nellymoser-discont.pcm
 
-FATE_FILTER += $(FATE_ASYNCTS)
-FATE_SAMPLES_AVCONV += $(FATE_ASYNCTS)
+FATE_FILTER-$(CONFIG_ASYNCTS_FILTER) += $(FATE_ASYNCTS)
+FATE_SAMPLES_AVCONV-$(CONFIG_ASYNCTS_FILTER) += $(FATE_ASYNCTS)
 
 fate-filter-delogo: CMD = framecrc -i $(SAMPLES)/real/rv30.rm -vf 
delogo=show=0:x=290:y=25:w=26:h=16 -an
 
-FATE_FILTER += fate-filter-delogo
-FATE_SAMPLES_AVCONV += fate-filter-delogo
+FATE_FILTER-$(CONFIG_DELOGO_FILTER) += fate-filter-delogo
+FATE_SAMPLES_AVCONV-$(CONFIG_DELOGO_FILTER) += fate-filter-delogo
 
 FATE_YADIF += fate-filter-yadif-mode0
 fate-filter-yadif-mode0: CMD = framecrc -flags bitexact -idct simple -i 
$(SAMPLES)/mpeg2/mpeg2_field_encoding.ts -vf yadif=0
@@ -41,7 +41,7 @@ fate-filter-yadif-mode0: CMD = framecrc -flags bitexact -idct 
simple -i $(SAMPLE
 FATE_YADIF += fate-filter-yadif-mode1
 fate-filter-yadif-mode1: CMD = framecrc -flags bitexact -idct simple -i 
$(SAMPLES)/mpeg2/mpeg2_field_encoding.ts -vf yadif=1
 
-FATE_FILTER += $(FATE_YADIF)
-FATE_SAMPLES_AVCONV += $(FATE_YADIF)
+FATE_FILTER-$(CONFIG_YADIF_FILTER) += $(FATE_YADIF)
+FATE_SAMPLES_AVCONV-$(CONFIG_YADIF_FILTER) += $(FATE_YADIF)
 
-fate-filter: $(FATE_FILTER)
+fate-filter: $(FATE_FILTER-yes)
-- 
1.7.1

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


Re: [libav-devel] [PATCH] msvc: check for snprintf

2012-08-01 Thread Uoti Urpala
On Wed, 2012-08-01 at 14:36 -0700, Ronald S. Bultje wrote:
> On Wed, Aug 1, 2012 at 2:31 PM, Uoti Urpala  wrote:
> > On Wed, 2012-08-01 at 21:55 +0100, Måns Rullgård wrote:
> >> If you insist on arguing, I politely request that you at least be right.
> >
> > If you get to that level of completely literal nitpicking, you could as
> > well say that it's possible to "get those semantics using the regular
> > Windows functions" by writing your own snprintf from scratch, while
> > using the regular Windows functions for something other than doing the
> > main formatting. I don't think that's a meaningful discussion any more
> > though.

> And this discussion is so utterly useful as-is, right?

Pointing out that the semantics of the posted patch do not match the
intended semantics of the function in a case that is very much intended
to be standard use does count as useful. Some of the following
discussion with Måns is not practically "useful", but I don't consider
that synonymous with meaningless.


> I've asked this a few times now: please stay out of discussions on
> MSVC support. You're not interested in it, you're not intending to
> contribute to it or help out in any way, and you're not commonly a
> Libav contributor who would provide constructive reviews, so to the
> best of my definitions, you're just here to troll. Let's not. Leave it
> to the people that care.

I do consider my mail pointing out the problems to be a constructive
review. It wasn't even really specific to MSVC. You'd apparently prefer
sweeping any problems related to MSVC support under the carpet, but I
don't think that justifies calling it unconstructive to point out such
problems.

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


Re: [libav-devel] [PATCH] msvc: check for snprintf

2012-08-01 Thread Måns Rullgård
Uoti Urpala  writes:

> On Wed, 2012-08-01 at 21:49 +0100, Måns Rullgård wrote:
>> Uoti Urpala  writes:
>> 
>> > On Wed, 2012-08-01 at 21:22 +0100, Måns Rullgård wrote:
>> >> >>> +int snprintf(char *buffer, size_t bufsize, const char *fmt, ...)
>> >
>> >> >>> +if ((int)bufsize <= 0) return -1;
>> >
>> >> If bufsize > INT_MAX, that cast has unspecified behaviour.
>> >
>> > No, it's implementation-defined (you're probably confusing it with
>> > arithmetic, but casts are not he same).
>> 
>> I am not confused, you are.
>> 
>>   3.4.4
>>   unspecified behavior
>>   use of an unspecified value, or other behavior where this
>>   International Standard provides two or more possibilities and imposes
>>   no further requirements on which is chosen in any instance
>
> OK, I guess "unspecified" does in principle also include the more
> specific class of "implementation-defined". Let's just say that your
> terminology was misleading then ("unspecified" was not a good
> description of the case, even if the word technically does apply).

There is nothing misleading about it.  In this context, saying simply
unspecified is sufficient to make the point.  There is no need to
further specify the kind of unspecified behaviour.

>> > BTW I wonder what perfectly standard-conforming snprintf is supposed to
>> > do with huge sizes. The size limit has type size_t, but the return value
>
>> EOVERFLOW
>
> That's what I'd expect a practical implementation to return, but is
> there something in the standard that actually makes this
> standard-conforming?

POSIX has this:

  The snprintf() function shall fail if:

  [EOVERFLOW]
[CX] The value of n is greater than {INT_MAX} or the number of bytes
needed to hold the output excluding the terminating null is greater
than {INT_MAX}.

Plain C99 doesn't say anything that I can find at a glance.

-- 
Måns Rullgård
m...@mansr.com
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] msvc: check for snprintf

2012-08-01 Thread Ronald S. Bultje
Hi,

On Wed, Aug 1, 2012 at 2:31 PM, Uoti Urpala  wrote:
> On Wed, 2012-08-01 at 21:55 +0100, Måns Rullgård wrote:
>> Uoti Urpala  writes:
>> > On Wed, 2012-08-01 at 21:34 +0100, Måns Rullgård wrote:
>> >> It is not possible to get those semantics using the regular Windows
>> >> functions.
>> >
>> > Of course it is, with enough workarounds (this is already an attempt at
>> > a workaround, getting it right would just require more code). I think
>> > there are rather obvious ways to fix both issues (besides the most
>> > obvious but more work-requiring alternative of writing correct snprintf
>> > from scratch): rewrite the format string with different modifiers for
>> > the first, try printing the string into temporary storage and double its
>> > size until you succeed for the second.
>>
>> Of course writing your own, correct snprintf() is possible.  You are
>> then, however, not using the Windows-provided functions.
>>
>> Writing into temp buffers is not exactly equivalent to the standard
>> behaviour.  The standard function can succeed in calculating the size
>> that *would* be required even actually allocating it fails.
>
> Yes, it can have more failure cases. However, I meant that from a more
> practical perspective. You can do that to get a correctly working
> snprintf for practical use.
>
>> If you insist on arguing, I politely request that you at least be right.
>
> If you get to that level of completely literal nitpicking, you could as
> well say that it's possible to "get those semantics using the regular
> Windows functions" by writing your own snprintf from scratch, while
> using the regular Windows functions for something other than doing the
> main formatting. I don't think that's a meaningful discussion any more
> though.

And this discussion is so utterly useful as-is, right?

I've asked this a few times now: please stay out of discussions on
MSVC support. You're not interested in it, you're not intending to
contribute to it or help out in any way, and you're not commonly a
Libav contributor who would provide constructive reviews, so to the
best of my definitions, you're just here to troll. Let's not. Leave it
to the people that care.

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


[libav-devel] [PATCH 10/10] idcin: return 0 from idcin_read_packet() on success.

2012-08-01 Thread Justin Ruggles
This matches the AVInputFormat.read_packet() API.
---
 libavformat/idcin.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index bffa2f4..dea4f91 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -321,7 +321,7 @@ static int idcin_read_packet(AVFormatContext *s,
 if (idcin->audio_present)
 idcin->next_chunk_is_video ^= 1;
 
-return ret;
+return 0;
 }
 
 static int idcin_read_seek(AVFormatContext *s, int stream_index,
-- 
1.7.1

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


[libav-devel] [PATCH 09/10] idcin: check for EOF before reading video chunk size

2012-08-01 Thread Justin Ruggles
---
 libavformat/idcin.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index 2d506ff..bffa2f4 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -278,6 +278,8 @@ static int idcin_read_packet(AVFormatContext *s,
 }
 }
 
+if (s->pb->eof_reached)
+return AVERROR(EIO);
 chunk_size = avio_rl32(pb);
 /* skip the number of decoded bytes (always equal to width * height) */
 avio_skip(pb, 4);
-- 
1.7.1

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


[libav-devel] [PATCH 08/10] idcin: check for integer overflow when calling av_get_packet()

2012-08-01 Thread Justin Ruggles
chunk_size is unsigned 32-bit, but av_get_packet() takes a signed int as the
packet size.
---
 libavformat/idcin.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index 67915e6..2d506ff 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -282,6 +282,10 @@ static int idcin_read_packet(AVFormatContext *s,
 /* skip the number of decoded bytes (always equal to width * height) */
 avio_skip(pb, 4);
 chunk_size -= 4;
+if (chunk_size > INT_MAX) {
+av_log(s, AV_LOG_ERROR, "chunk size is too large: %u\n", 
chunk_size);
+return AVERROR_INVALIDDATA;
+}
 ret= av_get_packet(pb, pkt, chunk_size);
 if (ret < 0)
 return ret;
-- 
1.7.1

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


[libav-devel] [PATCH 07/10] idcin: allow seeking back to the first packet

2012-08-01 Thread Justin Ruggles
---
 libavformat/idcin.c |   21 -
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index 638377c..67915e6 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -89,7 +89,7 @@ typedef struct IdcinDemuxContext {
 int next_chunk_is_video;
 int audio_present;
 
-int64_t pts;
+int64_t first_pkt_pos;
 } IdcinDemuxContext;
 
 static int idcin_probe(AVProbeData *p)
@@ -232,6 +232,7 @@ static int idcin_read_header(AVFormatContext *s)
 }
 
 idcin->next_chunk_is_video = 1;
+idcin->first_pkt_pos = avio_tell(s->pb);
 
 return 0;
 }
@@ -317,6 +318,23 @@ static int idcin_read_packet(AVFormatContext *s,
 return ret;
 }
 
+static int idcin_read_seek(AVFormatContext *s, int stream_index,
+   int64_t timestamp, int flags)
+{
+IdcinDemuxContext *idcin = s->priv_data;
+
+if (idcin->first_pkt_pos > 0) {
+int ret = avio_seek(s->pb, idcin->first_pkt_pos, SEEK_SET);
+if (ret < 0)
+return ret;
+ff_update_cur_dts(s, s->streams[idcin->video_stream_index], 0);
+idcin->next_chunk_is_video = 1;
+idcin->current_audio_chunk = 0;
+return 0;
+}
+return -1;
+}
+
 AVInputFormat ff_idcin_demuxer = {
 .name   = "idcin",
 .long_name  = NULL_IF_CONFIG_SMALL("id Cinematic"),
@@ -324,4 +342,5 @@ AVInputFormat ff_idcin_demuxer = {
 .read_probe = idcin_probe,
 .read_header= idcin_read_header,
 .read_packet= idcin_read_packet,
+.read_seek  = idcin_read_seek,
 };
-- 
1.7.1

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


[libav-devel] [PATCH 06/10] idcin: set AV_PKT_FLAG_KEY for video packets with a palette

2012-08-01 Thread Justin Ruggles
---
 libavformat/idcin.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index 0e93a59..638377c 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -292,6 +292,7 @@ static int idcin_read_packet(AVFormatContext *s,
 if (ret < 0)
 return ret;
 memcpy(pal, palette, AVPALETTE_SIZE);
+pkt->flags |= AV_PKT_FLAG_KEY;
 }
 pkt->stream_index = idcin->video_stream_index;
 pkt->duration = 1;
-- 
1.7.1

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


[libav-devel] [PATCH 05/10] idcin: set start_time and packet duration instead of manually tracking pts.

2012-08-01 Thread Justin Ruggles
Also, use 1 / sample_rate for audio stream time_base.
---
 libavformat/idcin.c |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index c8b8225..0e93a59 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -82,6 +82,7 @@ typedef struct IdcinDemuxContext {
 int audio_stream_index;
 int audio_chunk_size1;
 int audio_chunk_size2;
+int block_align;
 
 /* demux state variables */
 int current_audio_chunk;
@@ -181,6 +182,7 @@ static int idcin_read_header(AVFormatContext *s)
 if (!st)
 return AVERROR(ENOMEM);
 avpriv_set_pts_info(st, 33, 1, IDCIN_FPS);
+st->start_time = 0;
 idcin->video_stream_index = st->index;
 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
 st->codec->codec_id = CODEC_ID_IDCIN;
@@ -200,7 +202,8 @@ static int idcin_read_header(AVFormatContext *s)
 st = avformat_new_stream(s, NULL);
 if (!st)
 return AVERROR(ENOMEM);
-avpriv_set_pts_info(st, 33, 1, IDCIN_FPS);
+avpriv_set_pts_info(st, 63, 1, sample_rate);
+st->start_time = 0;
 idcin->audio_stream_index = st->index;
 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
 st->codec->codec_tag = 1;
@@ -210,7 +213,7 @@ static int idcin_read_header(AVFormatContext *s)
 st->codec->sample_rate = sample_rate;
 st->codec->bits_per_coded_sample = bytes_per_sample * 8;
 st->codec->bit_rate = sample_rate * bytes_per_sample * 8 * channels;
-st->codec->block_align = bytes_per_sample * channels;
+st->codec->block_align = idcin->block_align = bytes_per_sample * 
channels;
 if (bytes_per_sample == 1)
 st->codec->codec_id = CODEC_ID_PCM_U8;
 else
@@ -229,7 +232,6 @@ static int idcin_read_header(AVFormatContext *s)
 }
 
 idcin->next_chunk_is_video = 1;
-idcin->pts = 0;
 
 return 0;
 }
@@ -292,7 +294,7 @@ static int idcin_read_packet(AVFormatContext *s,
 memcpy(pal, palette, AVPALETTE_SIZE);
 }
 pkt->stream_index = idcin->video_stream_index;
-pkt->pts = idcin->pts;
+pkt->duration = 1;
 } else {
 /* send out the audio chunk */
 if (idcin->current_audio_chunk)
@@ -303,10 +305,9 @@ static int idcin_read_packet(AVFormatContext *s,
 if (ret < 0)
 return ret;
 pkt->stream_index = idcin->audio_stream_index;
-pkt->pts = idcin->pts;
+pkt->duration = chunk_size / idcin->block_align;
 
 idcin->current_audio_chunk ^= 1;
-idcin->pts++;
 }
 
 if (idcin->audio_present)
-- 
1.7.1

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


[libav-devel] [PATCH 04/10] idcin: set channel_layout

2012-08-01 Thread Justin Ruggles
---
 libavformat/idcin.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index 113c66e..c8b8225 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -68,6 +68,7 @@
  *   transmitting them to the video decoder
  */
 
+#include "libavutil/audioconvert.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
@@ -204,6 +205,8 @@ static int idcin_read_header(AVFormatContext *s)
 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
 st->codec->codec_tag = 1;
 st->codec->channels = channels;
+st->codec->channel_layout = channels > 1 ? AV_CH_LAYOUT_STEREO :
+   AV_CH_LAYOUT_MONO;
 st->codec->sample_rate = sample_rate;
 st->codec->bits_per_coded_sample = bytes_per_sample * 8;
 st->codec->bit_rate = sample_rate * bytes_per_sample * 8 * channels;
-- 
1.7.1

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


[libav-devel] [PATCH 03/10] idcin: fix check for presence of an audio stream

2012-08-01 Thread Justin Ruggles
---
 libavformat/idcin.c |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index f278f42..113c66e 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -170,6 +170,10 @@ static int idcin_read_header(AVFormatContext *s)
 av_log(s, AV_LOG_ERROR, "invalid channels: %u\n", channels);
 return AVERROR_INVALIDDATA;
 }
+idcin->audio_present = 1;
+} else {
+/* if sample rate is 0, assume no audio */
+idcin->audio_present = 0;
 }
 
 st = avformat_new_stream(s, NULL);
@@ -190,8 +194,7 @@ static int idcin_read_header(AVFormatContext *s)
 HUFFMAN_TABLE_SIZE)
 return AVERROR(EIO);
 
-/* if sample rate is 0, assume no audio */
-if (sample_rate) {
+if (idcin->audio_present) {
 idcin->audio_present = 1;
 st = avformat_new_stream(s, NULL);
 if (!st)
@@ -220,8 +223,7 @@ static int idcin_read_header(AVFormatContext *s)
 (sample_rate / 14) * bytes_per_sample * channels;
 }
 idcin->current_audio_chunk = 0;
-} else
-idcin->audio_present = 1;
+}
 
 idcin->next_chunk_is_video = 1;
 idcin->pts = 0;
-- 
1.7.1

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


[libav-devel] [PATCH 02/10] idcin: validate header parameters

2012-08-01 Thread Justin Ruggles
Avoids using unsupported parameters and signed integer overflows.
---
 libavformat/idcin.c |   19 +++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index 6a9b0ca..f278f42 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -68,6 +68,7 @@
  *   transmitting them to the video decoder
  */
 
+#include "libavutil/imgutils.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "internal.h"
@@ -153,6 +154,24 @@ static int idcin_read_header(AVFormatContext *s)
 bytes_per_sample = avio_rl32(pb);
 channels = avio_rl32(pb);
 
+if (av_image_check_size(width, height, 0, s) < 0)
+return AVERROR_INVALIDDATA;
+if (sample_rate > 0) {
+if (sample_rate < 14 || sample_rate > INT_MAX) {
+av_log(s, AV_LOG_ERROR, "invalid sample rate: %u\n", sample_rate);
+return AVERROR_INVALIDDATA;
+}
+if (bytes_per_sample < 1 || bytes_per_sample > 2) {
+av_log(s, AV_LOG_ERROR, "invalid bytes per sample: %u\n",
+   bytes_per_sample);
+return AVERROR_INVALIDDATA;
+}
+if (channels < 1 || channels > 2) {
+av_log(s, AV_LOG_ERROR, "invalid channels: %u\n", channels);
+return AVERROR_INVALIDDATA;
+}
+}
+
 st = avformat_new_stream(s, NULL);
 if (!st)
 return AVERROR(ENOMEM);
-- 
1.7.1

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


[libav-devel] [PATCH 01/10] idcinvideo: correctly set AVFrame defaults

2012-08-01 Thread Justin Ruggles
---
 libavcodec/idcinvideo.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/idcinvideo.c b/libavcodec/idcinvideo.c
index c936ebb..65414ee 100644
--- a/libavcodec/idcinvideo.c
+++ b/libavcodec/idcinvideo.c
@@ -166,7 +166,7 @@ static av_cold int idcin_decode_init(AVCodecContext *avctx)
 huff_build_tree(s, i);
 }
 
-s->frame.data[0] = NULL;
+avcodec_get_frame_defaults(&s->frame);
 
 return 0;
 }
-- 
1.7.1

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


Re: [libav-devel] [PATCH] msvc: check for snprintf

2012-08-01 Thread Uoti Urpala
On Wed, 2012-08-01 at 21:55 +0100, Måns Rullgård wrote:
> Uoti Urpala  writes:
> > On Wed, 2012-08-01 at 21:34 +0100, Måns Rullgård wrote:
> >> It is not possible to get those semantics using the regular Windows
> >> functions.
> >
> > Of course it is, with enough workarounds (this is already an attempt at
> > a workaround, getting it right would just require more code). I think
> > there are rather obvious ways to fix both issues (besides the most
> > obvious but more work-requiring alternative of writing correct snprintf
> > from scratch): rewrite the format string with different modifiers for
> > the first, try printing the string into temporary storage and double its
> > size until you succeed for the second.
> 
> Of course writing your own, correct snprintf() is possible.  You are
> then, however, not using the Windows-provided functions.
> 
> Writing into temp buffers is not exactly equivalent to the standard
> behaviour.  The standard function can succeed in calculating the size
> that *would* be required even actually allocating it fails.

Yes, it can have more failure cases. However, I meant that from a more
practical perspective. You can do that to get a correctly working
snprintf for practical use.

> If you insist on arguing, I politely request that you at least be right.

If you get to that level of completely literal nitpicking, you could as
well say that it's possible to "get those semantics using the regular
Windows functions" by writing your own snprintf from scratch, while
using the regular Windows functions for something other than doing the
main formatting. I don't think that's a meaningful discussion any more
though.

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


Re: [libav-devel] [PATCH] eamad: Use dsputils instead of its own bswap16_buf

2012-08-01 Thread Justin Ruggles
On 08/01/2012 04:22 PM, Derek Buitenhuis wrote:
> Signed-off-by: Derek Buitenhuis 
> ---
>  libavcodec/eamad.c |9 +
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c
> index ca74393..d7e65db 100644
> --- a/libavcodec/eamad.c
> +++ b/libavcodec/eamad.c
> @@ -57,13 +57,6 @@ typedef struct MadContext {
>  int mb_y;
>  } MadContext;
>  
> -static void bswap16_buf(uint16_t *dst, const uint16_t *src, int count)
> -{
> -int i;
> -for (i=0; i -dst[i] = av_bswap16(src[i]);
> -}
> -
>  static av_cold int decode_init(AVCodecContext *avctx)
>  {
>  MadContext *s = avctx->priv_data;
> @@ -273,7 +266,7 @@ static int decode_frame(AVCodecContext *avctx,
>  av_fast_malloc(&s->bitstream_buf, &s->bitstream_buf_size, (buf_end-buf) 
> + FF_INPUT_BUFFER_PADDING_SIZE);
>  if (!s->bitstream_buf)
>  return AVERROR(ENOMEM);
> -bswap16_buf(s->bitstream_buf, (const uint16_t*)buf, (buf_end-buf)/2);
> +s->dsp.bswap16_buf(s->bitstream_buf, (const uint16_t*)buf, 
> (buf_end-buf)/2);
>  init_get_bits(&s->gb, s->bitstream_buf, 8*(buf_end-buf));
>  
>  for (s->mb_y=0; s->mb_y < (avctx->height+15)/16; s->mb_y++)

LGTM

-Justin

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


Re: [libav-devel] [PATCH] msvc: check for snprintf

2012-08-01 Thread Uoti Urpala
On Wed, 2012-08-01 at 21:49 +0100, Måns Rullgård wrote:
> Uoti Urpala  writes:
> 
> > On Wed, 2012-08-01 at 21:22 +0100, Måns Rullgård wrote:
> >> >>> +int snprintf(char *buffer, size_t bufsize, const char *fmt, ...)
> >
> >> >>> +if ((int)bufsize <= 0) return -1;
> >
> >> If bufsize > INT_MAX, that cast has unspecified behaviour.
> >
> > No, it's implementation-defined (you're probably confusing it with
> > arithmetic, but casts are not he same).
> 
> I am not confused, you are.
> 
>   3.4.4
>   unspecified behavior
>   use of an unspecified value, or other behavior where this
>   International Standard provides two or more possibilities and imposes
>   no further requirements on which is chosen in any instance


OK, I guess "unspecified" does in principle also include the more
specific class of "implementation-defined". Let's just say that your
terminology was misleading then ("unspecified" was not a good
description of the case, even if the word technically does apply).


> > BTW I wonder what perfectly standard-conforming snprintf is supposed to
> > do with huge sizes. The size limit has type size_t, but the return value

> EOVERFLOW

That's what I'd expect a practical implementation to return, but is
there something in the standard that actually makes this
standard-conforming?

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


Re: [libav-devel] [PATCH] rtmp: add functions for reading AMF values

2012-08-01 Thread Luca Barbato
On 01/08/12 11:25, Jordi Ortiz wrote:
> ---
>  libavformat/rtmppkt.c |   45 +
>  libavformat/rtmppkt.h |   42 ++
>  2 files changed, 87 insertions(+)
> 

Seems fine to me. I'd commit it tomorrow.

lu

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


Re: [libav-devel] [PATCH 1/2] (WIP) rtmp: Add message tracking

2012-08-01 Thread Luca Barbato
On 01/08/12 12:12, Samuel Pitoiset wrote:
> ---
>  libavformat/rtmpproto.c | 278 
> 
>  1 file changed, 161 insertions(+), 117 deletions(-)

Seems better. Let me try it.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] msvc: check for snprintf

2012-08-01 Thread Måns Rullgård
Uoti Urpala  writes:

> On Wed, 2012-08-01 at 21:34 +0100, Måns Rullgård wrote:
>> Uoti Urpala  writes:
>> >> +ret = vsnprintf(buffer, bufsize-1, fmt, ap);
>> >
>> > IIRC MSVC (or the C library) does not support all standard format
>> > modifiers, so unless this vsnprintf comes from elsewhere, you need more
>> > to get fully working printf formatting.
>> >
>> > I'm not sure if this is working in current MinGW-compiled Libav either -
>> > you need to set __USE_MINGW_ANSI_STDIO at least; the problem cases
>> > probably occur rarely enough that problems may go unnoticed.
>> >
>> >> +if (ret < 0) {
>> >> +buffer[bufsize - 1] = '\0';
>> >> +ret = bufsize - 1;
>> >
>> > Wrong return value. It's supposed to be the number of bytes the output
>> > would take without restriction. The following pattern is supposed to
>> > work:
>> >
>> > int r = snprintf(NULL, 0, ...);
>> > if (r < 0) return -1;
>> > char *p = malloc(r + 1);
>> > snprintf(p, r, ...);
>> 
>> It is not possible to get those semantics using the regular Windows
>> functions.
>
> Of course it is, with enough workarounds (this is already an attempt at
> a workaround, getting it right would just require more code). I think
> there are rather obvious ways to fix both issues (besides the most
> obvious but more work-requiring alternative of writing correct snprintf
> from scratch): rewrite the format string with different modifiers for
> the first, try printing the string into temporary storage and double its
> size until you succeed for the second.

Of course writing your own, correct snprintf() is possible.  You are
then, however, not using the Windows-provided functions.

Writing into temp buffers is not exactly equivalent to the standard
behaviour.  The standard function can succeed in calculating the size
that *would* be required even actually allocating it fails.

If you insist on arguing, I politely request that you at least be right.

-- 
Måns Rullgård
m...@mansr.com
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/3] api-example: update to new audio encoding API.

2012-08-01 Thread Anton Khirnov

On Wed, 1 Aug 2012 20:39:36 +0100, Kieran Kunhya  wrote:
> > +/* the codec gives us the frame size, in samples,
> > + * we calculate the size of the samples buffer in bytes */
> > +buffer_size = av_samples_get_buffer_size(NULL, c->channels, 
> > c->frame_size,
> > + c->sample_fmt, 0);
> > +samples = av_malloc(buffer_size);
> > +if (!samples) {
> > +fprintf(stderr, "could not allocate %d bytes for samples buffer\n",
> > +buffer_size);
> > +exit(1);
> > +}
> > +/* setup the data pointers in the AVFrame */
> > +ret = avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt,
> > +   (const uint8_t*)samples, buffer_size, 
> > 0);
> > +if (ret < 0) {
> > +fprintf(stderr, "could not setup audio frame\n");
> > +exit(1);
> > +}
> 
> Is this hunk not the same as av_samples_alloc?

In this case it is, but it wouldn't be for nontrivial extended_data,
i.e. for planar audio with > 8 channels. Since this is an example, I
think we should be more generic than necessary.

note to self and Justin: we still need a function for freeing an
AVFrame.

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


Re: [libav-devel] [PATCH] msvc: check for snprintf

2012-08-01 Thread Måns Rullgård
Uoti Urpala  writes:

> On Wed, 2012-08-01 at 21:22 +0100, Måns Rullgård wrote:
>> >>> +int snprintf(char *buffer, size_t bufsize, const char *fmt, ...)
>
>> >>> +if ((int)bufsize <= 0) return -1;
>
>> If bufsize > INT_MAX, that cast has unspecified behaviour.
>
> No, it's implementation-defined (you're probably confusing it with
> arithmetic, but casts are not he same).

I am not confused, you are.

  3.4.4
  unspecified behavior
  use of an unspecified value, or other behavior where this
  International Standard provides two or more possibilities and imposes
  no further requirements on which is chosen in any instance

  [...]

  6.3.1.3 Signed and unsigned integers
  When a value with integer type is converted to another integer type
  [...]
  Otherwise, the new type is signed and the value cannot be represented
  in it; either the result is implementation-defined or an
  implementation-defined signal is raised.

Two or more alternatives are offered with no further requirement, hence
it is unspecified behaviour.

> BTW I wonder what perfectly standard-conforming snprintf is supposed to
> do with huge sizes. The size limit has type size_t, but the return value
> has type int, and is documented as "the number of characters that would
> have been written had n been sufficiently large, not counting the
> terminating null character, or a negative value if an encoding error
> occurred". What if there was no encoding error, but the number of
> characters was more than INT_MAX?

EOVERFLOW

-- 
Måns Rullgård
m...@mansr.com
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] msvc: check for snprintf

2012-08-01 Thread Uoti Urpala
On Wed, 2012-08-01 at 21:34 +0100, Måns Rullgård wrote:
> Uoti Urpala  writes:
> >> +ret = vsnprintf(buffer, bufsize-1, fmt, ap);
> >
> > IIRC MSVC (or the C library) does not support all standard format
> > modifiers, so unless this vsnprintf comes from elsewhere, you need more
> > to get fully working printf formatting.
> >
> > I'm not sure if this is working in current MinGW-compiled Libav either -
> > you need to set __USE_MINGW_ANSI_STDIO at least; the problem cases
> > probably occur rarely enough that problems may go unnoticed.
> >
> >> +if (ret < 0) {
> >> +buffer[bufsize - 1] = '\0';
> >> +ret = bufsize - 1;
> >
> > Wrong return value. It's supposed to be the number of bytes the output
> > would take without restriction. The following pattern is supposed to
> > work:
> >
> > int r = snprintf(NULL, 0, ...);
> > if (r < 0) return -1;
> > char *p = malloc(r + 1);
> > snprintf(p, r, ...);
> 
> It is not possible to get those semantics using the regular Windows
> functions.

Of course it is, with enough workarounds (this is already an attempt at
a workaround, getting it right would just require more code). I think
there are rather obvious ways to fix both issues (besides the most
obvious but more work-requiring alternative of writing correct snprintf
from scratch): rewrite the format string with different modifiers for
the first, try printing the string into temporary storage and double its
size until you succeed for the second.


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


Re: [libav-devel] [PATCH 2/2] rtmp: Prevent handling of an incorrect invoke packet

2012-08-01 Thread Luca Barbato
On 01/08/12 12:13, Samuel Pitoiset wrote:
> ---
>  libavformat/rtmpproto.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
> index 6044425..8c0ecb2 100644
> --- a/libavformat/rtmpproto.c
> +++ b/libavformat/rtmpproto.c
> @@ -1038,7 +1038,11 @@ static int handle_invoke(URLContext *s, RTMPPacket 
> *pkt)
>  const uint8_t *data_end = pkt->data + pkt->data_size;
>  int ret;
>  
> -//TODO: check for the messages sent for wrong state?
> +if (pkt->data[0] != 0x02) {
> +av_log(s, AV_LOG_ERROR, "No string method found in invoke packet\n");
> +return AVERROR_INVALIDDATA;
> +}
> +
>  if (!memcmp(pkt->data, "\002\000\006_error", 9)) {
>  uint8_t tmpstr[256];

Do we have an AMF_DATA_STRING or similar macro?

The patch seems fine beside that and we should go all over it later.

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


Re: [libav-devel] [PATCH] msvc: check for snprintf

2012-08-01 Thread Uoti Urpala
On Wed, 2012-08-01 at 21:22 +0100, Måns Rullgård wrote:
> >>> +int snprintf(char *buffer, size_t bufsize, const char *fmt, ...)

> >>> +if ((int)bufsize <= 0) return -1;

> If bufsize > INT_MAX, that cast has unspecified behaviour.

No, it's implementation-defined (you're probably confusing it with
arithmetic, but casts are not he same).

BTW I wonder what perfectly standard-conforming snprintf is supposed to
do with huge sizes. The size limit has type size_t, but the return value
has type int, and is documented as "the number of characters that would
have been written had n been sufficiently large, not counting the
terminating null character, or a negative value if an encoding error
occurred". What if there was no encoding error, but the number of
characters was more than INT_MAX?


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


Re: [libav-devel] [PATCH] msvc: check for snprintf

2012-08-01 Thread Måns Rullgård
Uoti Urpala  writes:

> On Thu, 2012-07-26 at 07:32 +0200, Luca Barbato wrote:
>> +int snprintf(char *buffer, size_t bufsize, const char *fmt, ...)
>> +{
>> +va_list ap;
>> +int ret;
>> +
>> +if ((int)bufsize <= 0) return -1;
>
> bufsize == 0 is valid.

Of course zero is a perfectly valid value to pass to standard snprintf()...
size > INT_MAX causes EOVERFLOW on POSIX and probably does something
nasty on windows, so catching that here might be a good idea.  No sane
code would intentionally pass such a large value anyway.

>> +ret = vsnprintf(buffer, bufsize-1, fmt, ap);
>
> IIRC MSVC (or the C library) does not support all standard format
> modifiers, so unless this vsnprintf comes from elsewhere, you need more
> to get fully working printf formatting.
>
> I'm not sure if this is working in current MinGW-compiled Libav either -
> you need to set __USE_MINGW_ANSI_STDIO at least; the problem cases
> probably occur rarely enough that problems may go unnoticed.
>
>> +if (ret < 0) {
>> +buffer[bufsize - 1] = '\0';
>> +ret = bufsize - 1;
>
> Wrong return value. It's supposed to be the number of bytes the output
> would take without restriction. The following pattern is supposed to
> work:
>
> int r = snprintf(NULL, 0, ...);
> if (r < 0) return -1;
> char *p = malloc(r + 1);
> snprintf(p, r, ...);

It is not possible to get those semantics using the regular Windows
functions.

-- 
Måns Rullgård
m...@mansr.com
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] msvc: check for snprintf

2012-08-01 Thread Måns Rullgård
"Ronald S. Bultje"  writes:

> Hi,
>
> On Wed, Aug 1, 2012 at 11:58 AM, Måns Rullgård  wrote:
>> Luca Barbato  writes:
>>
>>> +#if !HAVE_SNPRINTF
>>> +#ifdef _MSC_VER
>>> +#define vsnprintf _vsnprintf
>>> +#endif
>>> +
>>> +int snprintf(char *buffer, size_t bufsize, const char *fmt, ...)
>>> +{
>>> +va_list ap;
>>> +int ret;
>>> +
>>> +if ((int)bufsize <= 0) return -1;
>>> +va_start(ap, fmt);
>>> +ret = vsnprintf(buffer, bufsize-1, fmt, ap);
>>> +if (ret < 0) {
>>> +buffer[bufsize - 1] = '\0';
>>> +ret = bufsize - 1;
>>> +}
>>> +va_end(ap);
>>> +return ret;
>>> +}
>>
>> This assumes that any system without snprintf will have vsnprintf with
>> microsoft semantics.  That's a pretty bold assumption.
>
> Well, it is harmless in the sense that non-MS vsnprintf() never
> returns <0, right? But we can put this under #ifdef _MSC_VER if you
> prefer that.

I forgot to say, system/compiler-specific #ifdefs should only be used in
the most exceptional of circumstances.  This does not qualify by a long
shot.

-- 
Måns Rullgård
m...@mansr.com
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] eamad: Use dsputils instead of its own bswap16_buf

2012-08-01 Thread Derek Buitenhuis
Signed-off-by: Derek Buitenhuis 
---
 libavcodec/eamad.c |9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c
index ca74393..d7e65db 100644
--- a/libavcodec/eamad.c
+++ b/libavcodec/eamad.c
@@ -57,13 +57,6 @@ typedef struct MadContext {
 int mb_y;
 } MadContext;
 
-static void bswap16_buf(uint16_t *dst, const uint16_t *src, int count)
-{
-int i;
-for (i=0; ipriv_data;
@@ -273,7 +266,7 @@ static int decode_frame(AVCodecContext *avctx,
 av_fast_malloc(&s->bitstream_buf, &s->bitstream_buf_size, (buf_end-buf) + 
FF_INPUT_BUFFER_PADDING_SIZE);
 if (!s->bitstream_buf)
 return AVERROR(ENOMEM);
-bswap16_buf(s->bitstream_buf, (const uint16_t*)buf, (buf_end-buf)/2);
+s->dsp.bswap16_buf(s->bitstream_buf, (const uint16_t*)buf, 
(buf_end-buf)/2);
 init_get_bits(&s->gb, s->bitstream_buf, 8*(buf_end-buf));
 
 for (s->mb_y=0; s->mb_y < (avctx->height+15)/16; s->mb_y++)
-- 
1.7.10.4

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


Re: [libav-devel] [PATCH] msvc: check for snprintf

2012-08-01 Thread Måns Rullgård
"Ronald S. Bultje"  writes:

> Hi,
>
> On Wed, Aug 1, 2012 at 11:58 AM, Måns Rullgård  wrote:
>> Luca Barbato  writes:
>>
>>> +#if !HAVE_SNPRINTF
>>> +#ifdef _MSC_VER
>>> +#define vsnprintf _vsnprintf
>>> +#endif
>>> +
>>> +int snprintf(char *buffer, size_t bufsize, const char *fmt, ...)
>>> +{
>>> +va_list ap;
>>> +int ret;
>>> +
>>> +if ((int)bufsize <= 0) return -1;

If bufsize > INT_MAX, that cast has unspecified behaviour.

>>> +va_start(ap, fmt);
>>> +ret = vsnprintf(buffer, bufsize-1, fmt, ap);
>>> +if (ret < 0) {
>>> +buffer[bufsize - 1] = '\0';
>>> +ret = bufsize - 1;
>>> +}

This fails to null-terminate the output if the formatted length is
exactly bufsize-1.

>>> +va_end(ap);
>>> +return ret;
>>> +}
>>
>> This assumes that any system without snprintf will have vsnprintf with
>> microsoft semantics.  That's a pretty bold assumption.
>
> Well, it is harmless in the sense that non-MS vsnprintf() never
> returns <0, right?

Standard vsnprintf() returns a negative value if an error occurred, in
which case the code above leaves the contents of the buffer undefined.
The microsoft manual does not say what the functions do on error.
God knows what some random vsnprintf() on a system without snprintf()
might do, such a system by definition being non-standard.

> But we can put this under #ifdef _MSC_VER if you prefer that.
>
>>> +#if !HAVE_SNPRINTF
>>> +int ff_snprintf(char *buffer, size_t bufsize, const char *fmt, ...);
>>> +#define snprintf(...) ff_snprintf(__VA_ARGS__)
>>> +#endif
>>
>> WTF?
>
> The idea here (quoting Luca) is to not cause symbol collisions with
> other libs or apps providing their own snprintf replacement. Clearly
> the above implementation should have been called ff_snprintf() also,
> or maybe actually avpriv_snprintf() (as suggested by Alex), since
> lavf/lavfi/lavc/lavr/sws may want to use it also. But the idea is to
> prevent symbol collisions.

I know what the idea is.  The code does something else entirely.

-- 
Måns Rullgård
m...@mansr.com
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] msvc: check for snprintf

2012-08-01 Thread Uoti Urpala
On Thu, 2012-07-26 at 07:32 +0200, Luca Barbato wrote:
> +int snprintf(char *buffer, size_t bufsize, const char *fmt, ...)
> +{
> +va_list ap;
> +int ret;
> +
> +if ((int)bufsize <= 0) return -1;

bufsize == 0 is valid.

> +ret = vsnprintf(buffer, bufsize-1, fmt, ap);

IIRC MSVC (or the C library) does not support all standard format
modifiers, so unless this vsnprintf comes from elsewhere, you need more
to get fully working printf formatting.

I'm not sure if this is working in current MinGW-compiled Libav either -
you need to set __USE_MINGW_ANSI_STDIO at least; the problem cases
probably occur rarely enough that problems may go unnoticed.

> +if (ret < 0) {
> +buffer[bufsize - 1] = '\0';
> +ret = bufsize - 1;

Wrong return value. It's supposed to be the number of bytes the output
would take without restriction. The following pattern is supposed to
work:

int r = snprintf(NULL, 0, ...);
if (r < 0) return -1;
char *p = malloc(r + 1);
snprintf(p, r, ...);


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


Re: [libav-devel] [PATCH 1/3] api-example: update to new audio encoding API.

2012-08-01 Thread Kieran Kunhya
> +/* the codec gives us the frame size, in samples,
> + * we calculate the size of the samples buffer in bytes */
> +buffer_size = av_samples_get_buffer_size(NULL, c->channels, 
> c->frame_size,
> + c->sample_fmt, 0);
> +samples = av_malloc(buffer_size);
> +if (!samples) {
> +fprintf(stderr, "could not allocate %d bytes for samples buffer\n",
> +buffer_size);
> +exit(1);
> +}
> +/* setup the data pointers in the AVFrame */
> +ret = avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt,
> +   (const uint8_t*)samples, buffer_size, 0);
> +if (ret < 0) {
> +fprintf(stderr, "could not setup audio frame\n");
> +exit(1);
> +}

Is this hunk not the same as av_samples_alloc?
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] msvc: check for snprintf

2012-08-01 Thread Ronald S. Bultje
Hi,

On Wed, Aug 1, 2012 at 11:58 AM, Måns Rullgård  wrote:
> Luca Barbato  writes:
>
>> +#if !HAVE_SNPRINTF
>> +#ifdef _MSC_VER
>> +#define vsnprintf _vsnprintf
>> +#endif
>> +
>> +int snprintf(char *buffer, size_t bufsize, const char *fmt, ...)
>> +{
>> +va_list ap;
>> +int ret;
>> +
>> +if ((int)bufsize <= 0) return -1;
>> +va_start(ap, fmt);
>> +ret = vsnprintf(buffer, bufsize-1, fmt, ap);
>> +if (ret < 0) {
>> +buffer[bufsize - 1] = '\0';
>> +ret = bufsize - 1;
>> +}
>> +va_end(ap);
>> +return ret;
>> +}
>
> This assumes that any system without snprintf will have vsnprintf with
> microsoft semantics.  That's a pretty bold assumption.

Well, it is harmless in the sense that non-MS vsnprintf() never
returns <0, right? But we can put this under #ifdef _MSC_VER if you
prefer that.

>> +#if !HAVE_SNPRINTF
>> +int ff_snprintf(char *buffer, size_t bufsize, const char *fmt, ...);
>> +#define snprintf(...) ff_snprintf(__VA_ARGS__)
>> +#endif
>
> WTF?

The idea here (quoting Luca) is to not cause symbol collisions with
other libs or apps providing their own snprintf replacement. Clearly
the above implementation should have been called ff_snprintf() also,
or maybe actually avpriv_snprintf() (as suggested by Alex), since
lavf/lavfi/lavc/lavr/sws may want to use it also. But the idea is to
prevent symbol collisions.

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


Re: [libav-devel] [PATCH v4] Canopus Lossless decoder

2012-08-01 Thread Kostya Shishkov
On Wed, Aug 01, 2012 at 02:46:53PM -0400, Derek Buitenhuis wrote:
> At the moment it only does BGR24, but I plan to add the rest after.
> 
> Signed-off-by: Derek Buitenhuis 
> ---
>  Changelog  |1 +
>  doc/general.texi   |1 +
>  libavcodec/Makefile|1 +
>  libavcodec/allcodecs.c |1 +
>  libavcodec/avcodec.h   |1 +
>  libavcodec/cllc.c  |  274 
> 
>  libavcodec/version.h   |4 +-
>  libavformat/riff.c |1 +
>  8 files changed, 282 insertions(+), 2 deletions(-)
>  create mode 100644 libavcodec/cllc.c

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


Re: [libav-devel] [PATCH] msvc: check for snprintf

2012-08-01 Thread Måns Rullgård
Luca Barbato  writes:

> +#if !HAVE_SNPRINTF
> +#ifdef _MSC_VER
> +#define vsnprintf _vsnprintf
> +#endif
> +
> +int snprintf(char *buffer, size_t bufsize, const char *fmt, ...)
> +{
> +va_list ap;
> +int ret;
> +
> +if ((int)bufsize <= 0) return -1;
> +va_start(ap, fmt);
> +ret = vsnprintf(buffer, bufsize-1, fmt, ap);
> +if (ret < 0) {
> +buffer[bufsize - 1] = '\0';
> +ret = bufsize - 1;
> +}
> +va_end(ap);
> +return ret;
> +}

This assumes that any system without snprintf will have vsnprintf with
microsoft semantics.  That's a pretty bold assumption.

> +#define snprintf(...) ff_snprintf(__VA_ARGS__)
> +#endif

[...]

> diff --git a/libavutil/os_support.h b/libavutil/os_support.h
> new file mode 100644
> index 000..efecfe6
> --- /dev/null
> +++ b/libavutil/os_support.h

[...]

> +#if !HAVE_SNPRINTF
> +int ff_snprintf(char *buffer, size_t bufsize, const char *fmt, ...);
> +#define snprintf(...) ff_snprintf(__VA_ARGS__)
> +#endif

WTF?

-- 
Måns Rullgård
m...@mansr.com
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH v4] Canopus Lossless decoder

2012-08-01 Thread Derek Buitenhuis
At the moment it only does BGR24, but I plan to add the rest after.

Signed-off-by: Derek Buitenhuis 
---
 Changelog  |1 +
 doc/general.texi   |1 +
 libavcodec/Makefile|1 +
 libavcodec/allcodecs.c |1 +
 libavcodec/avcodec.h   |1 +
 libavcodec/cllc.c  |  274 
 libavcodec/version.h   |4 +-
 libavformat/riff.c |1 +
 8 files changed, 282 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/cllc.c

diff --git a/Changelog b/Changelog
index ea2c353..64c23d3 100644
--- a/Changelog
+++ b/Changelog
@@ -41,6 +41,7 @@ version :
 - G.723.1 demuxer and decoder
 - RTMPE protocol support
 - RTMPTE protocol support
+- Canopus Lossless Codec decoder
 
 
 version 0.8:
diff --git a/doc/general.texi b/doc/general.texi
index 0585554..a14e888 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -468,6 +468,7 @@ following image formats are supported:
 @item Delphine Software International CIN video  @tab @tab  X
 @tab Codec used in Delphine Software International games.
 @item Discworld II BMV Video @tab @tab  X
+@item Canopus Lossless Codec @tab @tab  X
 @item Cinepak@tab @tab  X
 @item Cirrus Logic AccuPak   @tab  X  @tab  X
 @tab fourcc: CLJR
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 7fc5059..17bc364 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -116,6 +116,7 @@ OBJS-$(CONFIG_CDXL_DECODER)+= cdxl.o
 OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
 OBJS-$(CONFIG_CLJR_DECODER)+= cljr.o
 OBJS-$(CONFIG_CLJR_ENCODER)+= cljr.o
+OBJS-$(CONFIG_CLLC_DECODER)+= cllc.o
 OBJS-$(CONFIG_COOK_DECODER)+= cook.o
 OBJS-$(CONFIG_CSCD_DECODER)+= cscd.o
 OBJS-$(CONFIG_CYUV_DECODER)+= cyuv.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 7e7cee6..f85892b 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -89,6 +89,7 @@ void avcodec_register_all(void)
 REGISTER_DECODER (CDXL, cdxl);
 REGISTER_DECODER (CINEPAK, cinepak);
 REGISTER_ENCDEC  (CLJR, cljr);
+REGISTER_DECODER (CLLC, cllc);
 REGISTER_DECODER (CSCD, cscd);
 REGISTER_DECODER (CYUV, cyuv);
 REGISTER_DECODER (DFA, dfa);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 71f2e70..450a9ca 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -259,6 +259,7 @@ enum CodecID {
 CODEC_ID_MSA1,
 CODEC_ID_TSCC2,
 CODEC_ID_MTS2,
+CODEC_ID_CLLC,
 
 /* various PCM "codecs" */
 CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the start 
of audio codecs
diff --git a/libavcodec/cllc.c b/libavcodec/cllc.c
new file mode 100644
index 000..9da906f
--- /dev/null
+++ b/libavcodec/cllc.c
@@ -0,0 +1,274 @@
+/*
+ * Canopus Lossless Codec decoder
+ *
+ * Copyright (c) 2012 Derek Buitenhuis
+ *
+ * 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 "dsputil.h"
+#include "get_bits.h"
+#include "avcodec.h"
+
+typedef struct CLLCContext {
+DSPContext dsp;
+AVCodecContext *avctx;
+
+uint8_t *swapped_buf;
+int  swapped_buf_size;
+} CLLCContext;
+
+static int read_code_table(CLLCContext *ctx, GetBitContext *gb, VLC *vlc)
+{
+uint8_t symbols[256];
+uint8_t bits[256];
+uint16_t codes[256];
+int num_lens, num_codes, prefix;
+int i, j, count;
+
+prefix = 0;
+count  = 0;
+
+num_lens = get_bits(gb, 5);
+
+for (i = 0; i < num_lens; i++) {
+num_codes = get_bits(gb, 9);
+
+for (j = 0; j < num_codes; j++) {
+symbols[count] = get_bits(gb, 8);
+bits[count]= i + 1;
+codes[count]   = prefix++;
+
+count++;
+}
+
+prefix <<= 1;
+}
+
+return ff_init_vlc_sparse(vlc, 7, count, bits, 1, 1,
+  codes, 2, 2, symbols, 1, 1, 0);
+}
+
+static int read_line(CLLCContext *ctx, GetBitContext *gb, int *top_left,
+ VLC *vlc, uint8_t *outbuf)
+{
+uint8_t *dst;
+int pred, code;
+int i;
+
+OPEN_READER(bits, gb);
+
+dst  = outbuf;
+pred = *top_left;
+
+/* Simultaneously read and restore the 

Re: [libav-devel] [PATCH v3] Canopus Lossless decoder

2012-08-01 Thread Johan Andersson
On Wed, Aug 01, 2012 at 01:50:32PM -0400, Derek Buitenhuis wrote:
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index acad4d4..a74b0ad 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -27,7 +27,7 @@
>   */
>  
>  #define LIBAVCODEC_VERSION_MAJOR 54
> -#define LIBAVCODEC_VERSION_MINOR 23
> +#define LIBAVCODEC_VERSION_MINOR 24
>  #define LIBAVCODEC_VERSION_MICRO  1
>  

Reset micro version to zero?

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


Re: [libav-devel] [PATCH v3] Canopus Lossless decoder

2012-08-01 Thread Kostya Shishkov
On Wed, Aug 01, 2012 at 01:50:32PM -0400, Derek Buitenhuis wrote:
> At the moment it only does BGR24, but I plan to add the rest after.
> 
> Signed-off-by: Derek Buitenhuis 
> ---
>  Changelog  |1 +
>  doc/general.texi   |1 +
>  libavcodec/Makefile|1 +
>  libavcodec/allcodecs.c |1 +
>  libavcodec/avcodec.h   |1 +
>  libavcodec/cllc.c  |  279 
> 
>  libavcodec/version.h   |2 +-
>  libavformat/riff.c |1 +
>  8 files changed, 286 insertions(+), 1 deletion(-)
>  create mode 100644 libavcodec/cllc.c
> 
> diff --git a/Changelog b/Changelog
> index ea2c353..64c23d3 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -41,6 +41,7 @@ version :
>  - G.723.1 demuxer and decoder
>  - RTMPE protocol support
>  - RTMPTE protocol support
> +- Canopus Lossless Codec decoder
>  
>  
>  version 0.8:
> diff --git a/doc/general.texi b/doc/general.texi
> index 0585554..a14e888 100644
> --- a/doc/general.texi
> +++ b/doc/general.texi
> @@ -468,6 +468,7 @@ following image formats are supported:
>  @item Delphine Software International CIN video  @tab @tab  X
>  @tab Codec used in Delphine Software International games.
>  @item Discworld II BMV Video @tab @tab  X
> +@item Canopus Lossless Codec @tab @tab  X
>  @item Cinepak@tab @tab  X
>  @item Cirrus Logic AccuPak   @tab  X  @tab  X
>  @tab fourcc: CLJR
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 7fc5059..17bc364 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -116,6 +116,7 @@ OBJS-$(CONFIG_CDXL_DECODER)+= cdxl.o
>  OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
>  OBJS-$(CONFIG_CLJR_DECODER)+= cljr.o
>  OBJS-$(CONFIG_CLJR_ENCODER)+= cljr.o
> +OBJS-$(CONFIG_CLLC_DECODER)+= cllc.o
>  OBJS-$(CONFIG_COOK_DECODER)+= cook.o
>  OBJS-$(CONFIG_CSCD_DECODER)+= cscd.o
>  OBJS-$(CONFIG_CYUV_DECODER)+= cyuv.o
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index 7e7cee6..f85892b 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -89,6 +89,7 @@ void avcodec_register_all(void)
>  REGISTER_DECODER (CDXL, cdxl);
>  REGISTER_DECODER (CINEPAK, cinepak);
>  REGISTER_ENCDEC  (CLJR, cljr);
> +REGISTER_DECODER (CLLC, cllc);
>  REGISTER_DECODER (CSCD, cscd);
>  REGISTER_DECODER (CYUV, cyuv);
>  REGISTER_DECODER (DFA, dfa);
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 71f2e70..450a9ca 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -259,6 +259,7 @@ enum CodecID {
>  CODEC_ID_MSA1,
>  CODEC_ID_TSCC2,
>  CODEC_ID_MTS2,
> +CODEC_ID_CLLC,
>  
>  /* various PCM "codecs" */
>  CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
> start of audio codecs
> diff --git a/libavcodec/cllc.c b/libavcodec/cllc.c
> new file mode 100644
> index 000..b00c9fc
> --- /dev/null
> +++ b/libavcodec/cllc.c
> @@ -0,0 +1,279 @@
> +/*
> + * Canopus Lossless Codec decoder
> + *
> + * Copyright (c) 2012 Derek Buitenhuis
> + *
> + * 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 "dsputil.h"
> +#include "get_bits.h"
> +#include "avcodec.h"
> +
> +typedef struct CLLCContext {
> +DSPContext dsp;
> +AVCodecContext *avctx;
> +
> +uint8_t *swapped_buf;
> +int  swapped_buf_size;
> +} CLLCContext;
> +
> +static int read_code_table(CLLCContext *ctx, GetBitContext *gb, VLC *vlc)
> +{
> +uint8_t symbols[256];
> +uint8_t bits[256];
> +uint16_t codes[256];
> +int num_lens, num_codes, prefix;
> +int i, j, count;
> +
> +prefix = 0;
> +count  = 0;
> +
> +num_lens = get_bits(gb, 5);
> +
> +for (i = 0; i < num_lens; i++) {
> +num_codes = get_bits(gb, 9);
> +
> +for (j = 0; j < num_codes; j++) {
> +symbols[count] = get_bits(gb, 8);
> +bits[count]= i + 1;
> +codes[count]   = prefix++;
> +
> +count++;
> +}
> +
> +prefix <<= 1;
> +}
> +
> +return ff_init_vlc_sparse(vlc, 7, count, bits, 1, 1,
> +   

Re: [libav-devel] [PATCH] msvc: check for snprintf

2012-08-01 Thread Ronald S. Bultje
Hi,

On Wed, Jul 25, 2012 at 10:35 PM, Måns Rullgård  wrote:
> Luca Barbato  writes:
>
>> From: "Ronald S. Bultje" 
>>
>> ---
>>
>> Here my initial twist about it, ideally I'd consider moving os_support
>> in libavu and include it automagically from config.h
>>
>>  configure  |2 ++
>>  libavutil/avstring.c   |   24 
>>  libavutil/os_support.h |   30 ++
>>  3 files changed, 56 insertions(+), 0 deletions(-)
>>  create mode 100644 libavutil/os_support.h
>
> This definitely needs a cleaner solution.  I'm about to head out the
> door, so I don't have time for a more elaborate reply right now.

Can you elaborate now?

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


Re: [libav-devel] [PATCH] x86: Refactor PSWAPD fallback implementations and port to cpuflags

2012-08-01 Thread Ronald S. Bultje
Hi,

On Wed, Aug 1, 2012 at 10:53 AM, Diego Biurrun  wrote:
> --- a/libavcodec/x86/fft_mmx.asm
[..]
> -%elifidn %1, %2
> -movd [r0+12], %1
> -punpckhdq %1, [r0+8]
> -%else

If you remove this macro from this file, the callers with %1==%2 need
to use the code directly, or call a different macro (e.g.
PSWAPD_INPLACE)

> +%macro PSWAPD 2
> +%if cpuflag(sse)
> +pshufw %1, %2, 0x4e

As Loren said earlier, this is mmx2, not sse.

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


[libav-devel] [PATCH] x86: Refactor PSWAPD fallback implementations and port to cpuflags

2012-08-01 Thread Diego Biurrun
---
 libavcodec/x86/fft_mmx.asm|   13 -
 libavcodec/x86/fmtconvert.asm |   17 ++---
 libavutil/x86/x86util.asm |   12 
 3 files changed, 14 insertions(+), 28 deletions(-)

diff --git a/libavcodec/x86/fft_mmx.asm b/libavcodec/x86/fft_mmx.asm
index 7746cdd..71691ef 100644
--- a/libavcodec/x86/fft_mmx.asm
+++ b/libavcodec/x86/fft_mmx.asm
@@ -498,19 +498,6 @@ fft8 %+ SUFFIX:
 %endmacro
 
 %if ARCH_X86_32
-%macro PSWAPD 2
-%if cpuflag(3dnowext)
-pswapd %1, %2
-%elifidn %1, %2
-movd [r0+12], %1
-punpckhdq %1, [r0+8]
-%else
-movq  %1, %2
-psrlq %1, 32
-punpckldq %1, %2
-%endif
-%endmacro
-
 INIT_MMX 3dnowext
 FFT48_3DNOW
 
diff --git a/libavcodec/x86/fmtconvert.asm b/libavcodec/x86/fmtconvert.asm
index 68616f2..1782624 100644
--- a/libavcodec/x86/fmtconvert.asm
+++ b/libavcodec/x86/fmtconvert.asm
@@ -247,16 +247,6 @@ FLOAT_TO_INT16_INTERLEAVE2
 INIT_XMM sse2
 FLOAT_TO_INT16_INTERLEAVE2
 
-
-%macro PSWAPD_SSE 2
-pshufw %1, %2, 0x4e
-%endmacro
-%macro PSWAPD_3DNOW 2
-movq  %1, %2
-psrlq %1, 32
-punpckldq %1, %2
-%endmacro
-
 %macro FLOAT_TO_INT16_INTERLEAVE6 0
 ; void float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len)
 cglobal float_to_int16_interleave6, 2, 8, 0, dst, src, src1, src2, src3, src4, 
src5, len
@@ -286,11 +276,11 @@ cglobal float_to_int16_interleave6, 2, 8, 0, dst, src, 
src1, src2, src3, src4, s
 packssdw   mm0, mm3
 packssdw   mm1, mm4
 packssdw   mm2, mm5
-pswapd mm3, mm0
+PSWAPD mm3, mm0
 punpcklwd  mm0, mm1
 punpckhwd  mm1, mm2
 punpcklwd  mm2, mm3
-pswapd mm3, mm0
+PSWAPD mm3, mm0
 punpckldq  mm0, mm2
 punpckhdq  mm2, mm1
 punpckldq  mm1, mm3
@@ -306,12 +296,9 @@ cglobal float_to_int16_interleave6, 2, 8, 0, dst, src, 
src1, src2, src3, src4, s
 %endmacro ; FLOAT_TO_INT16_INTERLEAVE6
 
 INIT_MMX sse
-%define pswapd PSWAPD_SSE
 FLOAT_TO_INT16_INTERLEAVE6
 INIT_MMX 3dnow
-%define pswapd PSWAPD_3DNOW
 FLOAT_TO_INT16_INTERLEAVE6
-%undef pswapd
 INIT_MMX 3dnowext
 FLOAT_TO_INT16_INTERLEAVE6
 
diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm
index b98efbc..c6b1f39 100644
--- a/libavutil/x86/x86util.asm
+++ b/libavutil/x86/x86util.asm
@@ -306,6 +306,18 @@
 %endif
 %endmacro
 
+%macro PSWAPD 2
+%if cpuflag(sse)
+pshufw %1, %2, 0x4e
+%elif cpuflag(3dnowext)
+pswapd %1, %2
+%elif cpuflag(3dnow)
+movq  %1, %2
+psrlq %1, 32
+punpckldq %1, %2
+%endif
+%endmacro
+
 %macro DEINTB 5 ; mask, reg1, mask, reg2, optional src to fill masks from
 %ifnum %5
 pand   m%3, m%5, m%4 ; src .. y6 .. y4
-- 
1.7.2.5

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


[libav-devel] [PATCH v3] Canopus Lossless decoder

2012-08-01 Thread Derek Buitenhuis
At the moment it only does BGR24, but I plan to add the rest after.

Signed-off-by: Derek Buitenhuis 
---
 Changelog  |1 +
 doc/general.texi   |1 +
 libavcodec/Makefile|1 +
 libavcodec/allcodecs.c |1 +
 libavcodec/avcodec.h   |1 +
 libavcodec/cllc.c  |  279 
 libavcodec/version.h   |2 +-
 libavformat/riff.c |1 +
 8 files changed, 286 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/cllc.c

diff --git a/Changelog b/Changelog
index ea2c353..64c23d3 100644
--- a/Changelog
+++ b/Changelog
@@ -41,6 +41,7 @@ version :
 - G.723.1 demuxer and decoder
 - RTMPE protocol support
 - RTMPTE protocol support
+- Canopus Lossless Codec decoder
 
 
 version 0.8:
diff --git a/doc/general.texi b/doc/general.texi
index 0585554..a14e888 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -468,6 +468,7 @@ following image formats are supported:
 @item Delphine Software International CIN video  @tab @tab  X
 @tab Codec used in Delphine Software International games.
 @item Discworld II BMV Video @tab @tab  X
+@item Canopus Lossless Codec @tab @tab  X
 @item Cinepak@tab @tab  X
 @item Cirrus Logic AccuPak   @tab  X  @tab  X
 @tab fourcc: CLJR
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 7fc5059..17bc364 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -116,6 +116,7 @@ OBJS-$(CONFIG_CDXL_DECODER)+= cdxl.o
 OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
 OBJS-$(CONFIG_CLJR_DECODER)+= cljr.o
 OBJS-$(CONFIG_CLJR_ENCODER)+= cljr.o
+OBJS-$(CONFIG_CLLC_DECODER)+= cllc.o
 OBJS-$(CONFIG_COOK_DECODER)+= cook.o
 OBJS-$(CONFIG_CSCD_DECODER)+= cscd.o
 OBJS-$(CONFIG_CYUV_DECODER)+= cyuv.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 7e7cee6..f85892b 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -89,6 +89,7 @@ void avcodec_register_all(void)
 REGISTER_DECODER (CDXL, cdxl);
 REGISTER_DECODER (CINEPAK, cinepak);
 REGISTER_ENCDEC  (CLJR, cljr);
+REGISTER_DECODER (CLLC, cllc);
 REGISTER_DECODER (CSCD, cscd);
 REGISTER_DECODER (CYUV, cyuv);
 REGISTER_DECODER (DFA, dfa);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 71f2e70..450a9ca 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -259,6 +259,7 @@ enum CodecID {
 CODEC_ID_MSA1,
 CODEC_ID_TSCC2,
 CODEC_ID_MTS2,
+CODEC_ID_CLLC,
 
 /* various PCM "codecs" */
 CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the start 
of audio codecs
diff --git a/libavcodec/cllc.c b/libavcodec/cllc.c
new file mode 100644
index 000..b00c9fc
--- /dev/null
+++ b/libavcodec/cllc.c
@@ -0,0 +1,279 @@
+/*
+ * Canopus Lossless Codec decoder
+ *
+ * Copyright (c) 2012 Derek Buitenhuis
+ *
+ * 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 "dsputil.h"
+#include "get_bits.h"
+#include "avcodec.h"
+
+typedef struct CLLCContext {
+DSPContext dsp;
+AVCodecContext *avctx;
+
+uint8_t *swapped_buf;
+int  swapped_buf_size;
+} CLLCContext;
+
+static int read_code_table(CLLCContext *ctx, GetBitContext *gb, VLC *vlc)
+{
+uint8_t symbols[256];
+uint8_t bits[256];
+uint16_t codes[256];
+int num_lens, num_codes, prefix;
+int i, j, count;
+
+prefix = 0;
+count  = 0;
+
+num_lens = get_bits(gb, 5);
+
+for (i = 0; i < num_lens; i++) {
+num_codes = get_bits(gb, 9);
+
+for (j = 0; j < num_codes; j++) {
+symbols[count] = get_bits(gb, 8);
+bits[count]= i + 1;
+codes[count]   = prefix++;
+
+count++;
+}
+
+prefix <<= 1;
+}
+
+return ff_init_vlc_sparse(vlc, 7, count, bits, 1, 1,
+  codes, 2, 2, symbols, 1, 1, 0);
+}
+
+static int read_line(CLLCContext *ctx, GetBitContext *gb, int *top_left,
+ VLC *vlc, uint8_t *outbuf)
+{
+uint8_t *dst;
+int pred, code;
+int i;
+
+OPEN_READER(bits, gb);
+
+dst  = outbuf;
+pred = *top_left;
+
+/* Simultaniously read and restore the l

Re: [libav-devel] [PATCH 2/2] rtmp: Prevent handling of an incorrect invoke packet

2012-08-01 Thread Derek Buitenhuis
On 01/08/2012 12:27 PM, Samuel Pitoiset wrote:
> 0x02 is a magic number defined in the rtmp specification which
> indicates that data is string.
> I don't think a comment is needed here because it's already specified
> in the error message.

OK.

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


Re: [libav-devel] [PATCH] x86: PALIGNR: port to cpuflags

2012-08-01 Thread Justin Ruggles
On 08/01/2012 12:18 PM, Diego Biurrun wrote:
> ---
>  libavcodec/x86/h264_intrapred.asm   |   27 ---
>  libavcodec/x86/h264_intrapred_10bit.asm |   16 
>  libavcodec/x86/h264_qpel_10bit.asm  |4 
>  libavutil/x86/x86util.asm   |   16 
>  libswscale/x86/output.asm   |4 +---
>  5 files changed, 9 insertions(+), 58 deletions(-)

LGTM

-Justin

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


Re: [libav-devel] [PATCH] api-example: update to new audio encoding API.

2012-08-01 Thread Justin Ruggles
On 08/01/2012 02:35 AM, Anton Khirnov wrote:
> ---
>  libavcodec/api-example.c |  137 
> --
>  1 file changed, 120 insertions(+), 17 deletions(-)

LGTM

-Justin

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


Re: [libav-devel] [PATCH] Revert "dct-test: allow to compile without HAVE_INLINE_ASM."

2012-08-01 Thread Diego Biurrun
On Wed, Aug 01, 2012 at 07:15:13PM +0200, Kostya Shishkov wrote:
> On Wed, Aug 01, 2012 at 09:30:33AM -0700, Ronald S. Bultje wrote:
> > From: "Ronald S. Bultje" 
> > 
> > This reverts commit ddbe71b44fc810cc39b576bf0047f89090cfabcb.
> > I forgot to remove it from my tree before pushing another patch.
> > --- a/libavcodec/dct-test.c
> > +++ b/libavcodec/dct-test.c
> > @@ -85,7 +85,7 @@ static const struct algo fdct_tab[] = {
> >  
> > -#if HAVE_MMX && HAVE_INLINE_ASM
> > +#if HAVE_MMX
> >  { "MMX",ff_fdct_mmx,   NO_PERM,   AV_CPU_FLAG_MMX  
> >},
> >  { "MMX2",   ff_fdct_mmx2,  NO_PERM,   AV_CPU_FLAG_MMX2 
> >},
> 
> OK

Reverting this is probably not worth the trouble as Mans appears to be
steaming ahead on a better alternative solution.  I suggest grudgingly
keeping it for now.

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


[libav-devel] [PATCH] x86: dct32: port to cpuflags

2012-08-01 Thread Diego Biurrun
---
 libavcodec/x86/dct32_sse.asm |   74 ++---
 1 files changed, 25 insertions(+), 49 deletions(-)

diff --git a/libavcodec/x86/dct32_sse.asm b/libavcodec/x86/dct32_sse.asm
index 20a5c7b..65fac09 100644
--- a/libavcodec/x86/dct32_sse.asm
+++ b/libavcodec/x86/dct32_sse.asm
@@ -41,39 +41,24 @@ ps_cos_vec: dd   0.500603,  0.505471,  0.515447,  0.531043
 align 32
 ps_p1p1m1m1: dd 0, 0, 0x8000, 0x8000, 0, 0, 0x8000, 0x8000
 
-%macro BUTTERFLY_SSE 4
-movaps %4, %1
-subps  %1, %2
-addps  %2, %4
-mulps  %1, %3
-%endmacro
-
-%macro BUTTERFLY_AVX 4
-vsubps  %4, %1, %2
-vaddps  %2, %2, %1
-vmulps  %1, %4, %3
-%endmacro
-
-%macro BUTTERFLY0_SSE 5
-movaps %4, %1
-shufps %1, %1, %5
-xorps  %4, %2
-addps  %1, %4
-mulps  %1, %3
+%macro BUTTERFLY 4
+subps  %4, %1, %2
+addps  %2, %2, %1
+mulps  %1, %4, %3
 %endmacro
 
-%macro BUTTERFLY0_SSE2 5
+%macro BUTTERFLY0 5
+%if cpuflag(sse2) && notcpuflag(avx)
 pshufd %4, %1, %5
 xorps  %1, %2
 addps  %1, %4
 mulps  %1, %3
-%endmacro
-
-%macro BUTTERFLY0_AVX 5
-vshufps %4, %1, %1, %5
-vxorps  %1, %1, %2
-vaddps  %4, %4, %1
-vmulps  %1, %4, %3
+%else
+shufps %4, %1, %1, %5
+xorps  %1, %1, %2
+addps  %4, %4, %1
+mulps  %1, %4, %3
+%endif
 %endmacro
 
 %macro BUTTERFLY2 4
@@ -205,14 +190,11 @@ ps_p1p1m1m1: dd 0, 0, 0x8000, 0x8000, 0, 0, 
0x8000, 0x8000
 movss [outq+116], m6
 %endmacro
 
-%define BUTTERFLY  BUTTERFLY_AVX
-%define BUTTERFLY0 BUTTERFLY0_AVX
-
-INIT_YMM
+INIT_YMM avx
 SECTION_TEXT
 %if HAVE_AVX
 ; void ff_dct32_float_avx(FFTSample *out, const FFTSample *in)
-cglobal dct32_float_avx, 2,3,8, out, in, tmp
+cglobal dct32_float, 2,3,8, out, in, tmp
 ; pass 1
 vmovaps m4, [inq+0]
 vinsertf128 m5, m5, [inq+96], 1
@@ -285,9 +267,6 @@ INIT_XMM
 RET
 %endif
 
-%define BUTTERFLY  BUTTERFLY_SSE
-%define BUTTERFLY0 BUTTERFLY0_SSE
-
 %if ARCH_X86_64
 %define SPILL SWAP
 %define UNSPILL SWAP
@@ -410,10 +389,9 @@ INIT_XMM
 %endif
 
 
-INIT_XMM
-%macro DCT32_FUNC 1
 ; void ff_dct32_float_sse(FFTSample *out, const FFTSample *in)
-cglobal dct32_float_%1, 2,3,16, out, in, tmp
+%macro DCT32_FUNC 0
+cglobal dct32_float, 2, 3, 16, out, in, tmp
 ; pass 1
 
 movaps  m0, [inq+0]
@@ -497,18 +475,16 @@ cglobal dct32_float_%1, 2,3,16, out, in, tmp
 RET
 %endmacro
 
-%macro LOAD_INV_SSE 2
+%macro LOAD_INV 2
+%if cpuflag(sse2)
+pshufd  %1, %2, 0x1b
+%elif cpuflag(sse)
 movaps  %1, %2
 shufps  %1, %1, 0x1b
+%endif
 %endmacro
 
-%define LOAD_INV LOAD_INV_SSE
-DCT32_FUNC sse
-
-%macro LOAD_INV_SSE2 2
-pshufd  %1, %2, 0x1b
-%endmacro
-
-%define LOAD_INV LOAD_INV_SSE2
-%define BUTTERFLY0 BUTTERFLY0_SSE2
-DCT32_FUNC sse2
+INIT_XMM sse
+DCT32_FUNC
+INIT_XMM sse2
+DCT32_FUNC
-- 
1.7.1

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


Re: [libav-devel] [PATCH] Revert "dct-test: allow to compile without HAVE_INLINE_ASM."

2012-08-01 Thread Kostya Shishkov
On Wed, Aug 01, 2012 at 09:30:33AM -0700, Ronald S. Bultje wrote:
> From: "Ronald S. Bultje" 
> 
> This reverts commit ddbe71b44fc810cc39b576bf0047f89090cfabcb.
> I forgot to remove it from my tree before pushing another patch.
> ---
>  libavcodec/dct-test.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/dct-test.c b/libavcodec/dct-test.c
> index 9e19e0c..5046544 100644
> --- a/libavcodec/dct-test.c
> +++ b/libavcodec/dct-test.c
> @@ -85,7 +85,7 @@ static const struct algo fdct_tab[] = {
>  { "IJG-AAN-INT",ff_fdct_ifast, SCALE_PERM },
>  { "IJG-LLM-INT",ff_jpeg_fdct_islow_8,  NO_PERM},
>  
> -#if HAVE_MMX && HAVE_INLINE_ASM
> +#if HAVE_MMX
>  { "MMX",ff_fdct_mmx,   NO_PERM,   AV_CPU_FLAG_MMX
>  },
>  { "MMX2",   ff_fdct_mmx2,  NO_PERM,   AV_CPU_FLAG_MMX2   
>  },
>  { "SSE2",   ff_fdct_sse2,  NO_PERM,   AV_CPU_FLAG_SSE2   
>  },
> -- 

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


[libav-devel] [PATCH] Revert "dct-test: allow to compile without HAVE_INLINE_ASM."

2012-08-01 Thread Ronald S. Bultje
From: "Ronald S. Bultje" 

This reverts commit ddbe71b44fc810cc39b576bf0047f89090cfabcb.
I forgot to remove it from my tree before pushing another patch.
---
 libavcodec/dct-test.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/dct-test.c b/libavcodec/dct-test.c
index 9e19e0c..5046544 100644
--- a/libavcodec/dct-test.c
+++ b/libavcodec/dct-test.c
@@ -85,7 +85,7 @@ static const struct algo fdct_tab[] = {
 { "IJG-AAN-INT",ff_fdct_ifast, SCALE_PERM },
 { "IJG-LLM-INT",ff_jpeg_fdct_islow_8,  NO_PERM},
 
-#if HAVE_MMX && HAVE_INLINE_ASM
+#if HAVE_MMX
 { "MMX",ff_fdct_mmx,   NO_PERM,   AV_CPU_FLAG_MMX 
},
 { "MMX2",   ff_fdct_mmx2,  NO_PERM,   AV_CPU_FLAG_MMX2
},
 { "SSE2",   ff_fdct_sse2,  NO_PERM,   AV_CPU_FLAG_SSE2
},
-- 
1.7.9.2

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


Re: [libav-devel] [PATCH] vc1dec: remove useless #include simple_idct.h

2012-08-01 Thread Kostya Shishkov
On Wed, Aug 01, 2012 at 05:15:47PM +0100, Mans Rullgard wrote:
> Signed-off-by: Mans Rullgard 
> ---
>  libavcodec/vc1dec.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
> index c6cbfc1..e36cc0d 100644
> --- a/libavcodec/vc1dec.c
> +++ b/libavcodec/vc1dec.c
> @@ -36,7 +36,6 @@
>  #include "vc1acdata.h"
>  #include "msmpeg4data.h"
>  #include "unary.h"
> -#include "simple_idct.h"
>  #include "mathops.h"
>  #include "vdpau_internal.h"
>  
> -- 

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


Re: [libav-devel] [PATCH] vc1dec: remove useless #include simple_idct.h

2012-08-01 Thread Diego Biurrun
On Wed, Aug 01, 2012 at 05:15:47PM +0100, Mans Rullgard wrote:
> Signed-off-by: Mans Rullgard 
> ---
>  libavcodec/vc1dec.c | 1 -
>  1 file changed, 1 deletion(-)

OK

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


Re: [libav-devel] [PATCH 2/2] rtmp: Prevent handling of an incorrect invoke packet

2012-08-01 Thread Samuel Pitoiset
On Wed, Aug 1, 2012 at 6:09 PM, Derek Buitenhuis
 wrote:
> On 01/08/2012 6:13 AM, Samuel Pitoiset wrote:
>> ---
>>  libavformat/rtmpproto.c | 6 +-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> Looks OK, but I have no idea where the magic numbers come from
> for this or the lines following it. Perhaps you can add comments
> in a separate patch?

0x02 is a magic number defined in the rtmp specification which
indicates that data is string.
I don't think a comment is needed here because it's already specified
in the error message.


-- 
Best regards,
Samuel Pitoiset.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] idcin: check for integer overflow when calling av_get_packet()

2012-08-01 Thread Kostya Shishkov
On Wed, Aug 01, 2012 at 11:31:23AM -0400, Justin Ruggles wrote:
> chunk_size is unsigned 32-bit, but av_get_packet() takes a signed int as the
> packet size.
> ---
>  libavformat/idcin.c |5 +
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/libavformat/idcin.c b/libavformat/idcin.c
> index 6a9b0ca..3acbc92 100644
> --- a/libavformat/idcin.c
> +++ b/libavformat/idcin.c
> @@ -255,6 +255,11 @@ static int idcin_read_packet(AVFormatContext *s,
>  /* skip the number of decoded bytes (always equal to width * height) 
> */
>  avio_skip(pb, 4);
>  chunk_size -= 4;
> +if (chunk_size > INT_MAX) {
> +av_log(s, AV_LOG_ERROR, "chunk size is too large: %u\n", 
> chunk_size);
> +avio_skip(pb, chunk_size);
> +return 0;
> +}
>  ret= av_get_packet(pb, pkt, chunk_size);
>  if (ret < 0)
>  return ret;
> -- 

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


[libav-devel] [PATCH] x86: PALIGNR: port to cpuflags

2012-08-01 Thread Diego Biurrun
---
 libavcodec/x86/h264_intrapred.asm   |   27 ---
 libavcodec/x86/h264_intrapred_10bit.asm |   16 
 libavcodec/x86/h264_qpel_10bit.asm  |4 
 libavutil/x86/x86util.asm   |   16 
 libswscale/x86/output.asm   |4 +---
 5 files changed, 9 insertions(+), 58 deletions(-)

diff --git a/libavcodec/x86/h264_intrapred.asm 
b/libavcodec/x86/h264_intrapred.asm
index 928734e..5a587d0 100644
--- a/libavcodec/x86/h264_intrapred.asm
+++ b/libavcodec/x86/h264_intrapred.asm
@@ -1064,10 +1064,8 @@ cglobal pred8x8l_top_dc, 4, 4
 %endmacro
 
 INIT_MMX mmxext
-%define PALIGNR PALIGNR_MMX
 PRED8x8L_TOP_DC
 INIT_MMX ssse3
-%define PALIGNR PALIGNR_SSSE3
 PRED8x8L_TOP_DC
 
 ;-
@@ -1169,10 +1167,8 @@ cglobal pred8x8l_dc, 4, 5
 %endmacro
 
 INIT_MMX mmxext
-%define PALIGNR PALIGNR_MMX
 PRED8x8L_DC
 INIT_MMX ssse3
-%define PALIGNR PALIGNR_SSSE3
 PRED8x8L_DC
 
 ;-
@@ -1242,10 +1238,8 @@ cglobal pred8x8l_horizontal, 4, 4
 %endmacro
 
 INIT_MMX mmxext
-%define PALIGNR PALIGNR_MMX
 PRED8x8L_HORIZONTAL
 INIT_MMX ssse3
-%define PALIGNR PALIGNR_SSSE3
 PRED8x8L_HORIZONTAL
 
 ;-
@@ -1294,10 +1288,8 @@ cglobal pred8x8l_vertical, 4, 4
 %endmacro
 
 INIT_MMX mmxext
-%define PALIGNR PALIGNR_MMX
 PRED8x8L_VERTICAL
 INIT_MMX ssse3
-%define PALIGNR PALIGNR_SSSE3
 PRED8x8L_VERTICAL
 
 ;-
@@ -1305,7 +1297,6 @@ PRED8x8L_VERTICAL
 ;-
 
 INIT_MMX mmxext
-%define PALIGNR PALIGNR_MMX
 cglobal pred8x8l_down_left, 4, 5
 sub  r0, r3
 movqmm0, [r0-8]
@@ -1497,10 +1488,8 @@ INIT_XMM cpuname
 %endmacro
 
 INIT_MMX sse2
-%define PALIGNR PALIGNR_MMX
 PRED8x8L_DOWN_LEFT
 INIT_MMX ssse3
-%define PALIGNR PALIGNR_SSSE3
 PRED8x8L_DOWN_LEFT
 
 ;-
@@ -1508,7 +1497,6 @@ PRED8x8L_DOWN_LEFT
 ;-
 
 INIT_MMX mmxext
-%define PALIGNR PALIGNR_MMX
 cglobal pred8x8l_down_right, 4, 5
 sub  r0, r3
 lea  r4, [r0+r3*2]
@@ -1751,10 +1739,8 @@ INIT_XMM cpuname
 %endmacro
 
 INIT_MMX sse2
-%define PALIGNR PALIGNR_MMX
 PRED8x8L_DOWN_RIGHT
 INIT_MMX ssse3
-%define PALIGNR PALIGNR_SSSE3
 PRED8x8L_DOWN_RIGHT
 
 ;-
@@ -1762,7 +1748,6 @@ PRED8x8L_DOWN_RIGHT
 ;-
 
 INIT_MMX mmxext
-%define PALIGNR PALIGNR_MMX
 cglobal pred8x8l_vertical_right, 4, 5
 sub  r0, r3
 lea  r4, [r0+r3*2]
@@ -1981,10 +1966,8 @@ INIT_XMM cpuname
 %endmacro
 
 INIT_MMX sse2
-%define PALIGNR PALIGNR_MMX
 PRED8x8L_VERTICAL_RIGHT
 INIT_MMX ssse3
-%define PALIGNR PALIGNR_SSSE3
 PRED8x8L_VERTICAL_RIGHT
 
 ;-
@@ -2072,10 +2055,8 @@ INIT_XMM cpuname
 %endmacro
 
 INIT_MMX sse2
-%define PALIGNR PALIGNR_MMX
 PRED8x8L_VERTICAL_LEFT
 INIT_MMX ssse3
-%define PALIGNR PALIGNR_SSSE3
 PRED8x8L_VERTICAL_LEFT
 
 ;-
@@ -2161,10 +2142,8 @@ cglobal pred8x8l_horizontal_up, 4, 4
 %endmacro
 
 INIT_MMX mmxext
-%define PALIGNR PALIGNR_MMX
 PRED8x8L_HORIZONTAL_UP
 INIT_MMX ssse3
-%define PALIGNR PALIGNR_SSSE3
 PRED8x8L_HORIZONTAL_UP
 
 ;-
@@ -2172,7 +2151,6 @@ PRED8x8L_HORIZONTAL_UP
 ;-
 
 INIT_MMX mmxext
-%define PALIGNR PALIGNR_MMX
 cglobal pred8x8l_horizontal_down, 4, 5
 sub  r0, r3
 lea  r4, [r0+r3*2]
@@ -2412,10 +2390,8 @@ INIT_XMM cpuname
 %endmacro
 
 INIT_MMX sse2
-%define PALIGNR PALIGNR_MMX
 PRED8x8L_HORIZONTAL_DOWN
 INIT_MMX ssse3
-%define PALIGNR PALIGNR_SSSE3
 PRED8x8L_HORIZONTAL_DOWN
 
 ;-
@@ -2638,7 +2614,6 @@ cglobal pred4x4_horizontal_up, 3, 3
 ;-
 
 INIT_MMX mmxext
-%define PALIGNR PALIGNR_MMX
 cglobal pred4x4_horizontal_down, 3, 3
 sub   r0, r2
 lea   r1, [r0+r2*2]
@@ -2674,7 +2649,6 @@ cglobal pred4x4_horizontal_down, 3, 3
 ;-
 
 INIT_MMX mmxext
-%define PALIGNR PALIGNR_MMX
 cglobal pred4x4_vertical_right, 3, 3
 sub r0, r2
 lea r1, [r0+r2*2]
@@ -2705,7 +2679,6 @@ cglobal pred4x4_vertical_right, 3, 3
 ;--

[libav-devel] [PATCH] vc1dec: remove useless #include simple_idct.h

2012-08-01 Thread Mans Rullgard
Signed-off-by: Mans Rullgard 
---
 libavcodec/vc1dec.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index c6cbfc1..e36cc0d 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -36,7 +36,6 @@
 #include "vc1acdata.h"
 #include "msmpeg4data.h"
 #include "unary.h"
-#include "simple_idct.h"
 #include "mathops.h"
 #include "vdpau_internal.h"
 
-- 
1.7.11.1

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


Re: [libav-devel] [PATCH 02/45] x86: build: replace mmx2 by mmxext

2012-08-01 Thread Diego Biurrun
On Wed, Aug 01, 2012 at 07:36:09AM -0700, Ronald S. Bultje wrote:
> On Wed, Aug 1, 2012 at 6:24 AM, Diego Biurrun  wrote:
> > On Wed, Aug 01, 2012 at 02:46:36PM +0200, Janne Grunau wrote:
> >> On 2012-08-01 01:33:47 +0200, Diego Biurrun wrote:
> >> > On Wed, Aug 01, 2012 at 12:00:58AM +0100, Måns Rullgård wrote:
> >> > > "Ronald S. Bultje"  writes:
> >> > > > On Tue, Jul 31, 2012 at 3:17 PM, Diego Biurrun  
> >> > > > wrote:
> >> > > > [..]
> >> > > >
> >> > > > The most important thing is missing: why?
> >> > >
> >> > > mmxext is a somewhat more official name.
> >> >
> >> > Yes, see my introductory email for the series.  I had to unify in one
> >> > direction or the other, so I picked the one that appeared more
> >> > sensible, i.e. the more official names.
> >>
> >> That's all well but it is still missing from the commit message. That's
> >> how I uderstood Ronald comment. Please amend the commit.
> >
> > How about:
> >
> >   x86: build: replace mmx2 by mmxext
> >
> >   Refactoring mmx2/mmxext YASM code with cpuflags will force renames.
> >   So switching to a consistent naming scheme beforehand in sensible.
> 
> in sensible?

Fixed locally.

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


Re: [libav-devel] [PATCH 2/2] rtmp: Prevent handling of an incorrect invoke packet

2012-08-01 Thread Derek Buitenhuis
On 01/08/2012 6:13 AM, Samuel Pitoiset wrote:
> ---
>  libavformat/rtmpproto.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Looks OK, but I have no idea where the magic numbers come from
for this or the lines following it. Perhaps you can add comments
in a separate patch?

- Derek

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


[libav-devel] [PATCH 2/2] rtmp: Add a new option 'rtmp_subscribe'

2012-08-01 Thread Samuel Pitoiset
This option specifies the name of live stream to subscribe.
Defaults to rtmp_playpath.
---
 doc/protocols.texi  | 3 +++
 libavformat/rtmpproto.c | 9 +++--
 libavformat/version.h   | 2 +-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index ff872fc..9821904 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -237,6 +237,9 @@ value will be sent.
 Stream identifier to play or to publish. This option overrides the
 parameter specified in the URI.
 
+@item rtmp_subscribe
+Name of live stream to subscribe to. Defaults to rtmp_playpath.
+
 @item rtmp_swfurl
 URL of the SWF player for the media. By default no value will be sent.
 
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index c6d327f..d4e9dc4 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -91,6 +91,7 @@ typedef struct RTMPContext {
 char* flashver;   ///< version of the flash plugin
 char* swfurl; ///< url of the swf player
 char* pageurl;///< url of the web page
+char* subscribe;  ///< name of live stream to 
subscribe
 int   server_bw;  ///< server bandwidth
 int   client_buffer_time; ///< client buffer time in ms
 int   flush_interval; ///< number of packets flushed 
in the same request (RTMPT only)
@@ -607,18 +608,21 @@ static int gen_bytes_read(URLContext *s, RTMPContext *rt, 
uint32_t ts)
 static int gen_fcsubscribe_stream(URLContext *s, RTMPContext *rt)
 {
 RTMPPacket pkt;
+char *subscribe;
 uint8_t *p;
 int ret;
 
+subscribe = rt->subscribe ? rt->subscribe : rt->playpath;
+
 if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE,
- 0, 27 + strlen(rt->playpath))) < 0)
+ 0, 27 + strlen(subscribe))) < 0)
 return ret;
 
 p = pkt.data;
 ff_amf_write_string(&p, "FCSubscribe");
 ff_amf_write_number(&p, rt->nb_invokes);
 ff_amf_write_null(&p);
-ff_amf_write_string(&p, rt->playpath);
+ff_amf_write_string(&p, subscribe);
 
 ret = ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size,
rt->prev_pkt[1]);
@@ -1621,6 +1625,7 @@ static const AVOption rtmp_options[] = {
 {"recorded", "recorded stream", 0, AV_OPT_TYPE_CONST, {0}, 0, 0, DEC, 
"rtmp_live"},
 {"rtmp_pageurl", "URL of the web page in which the media was embedded. By 
default no value will be sent.", OFFSET(pageurl), AV_OPT_TYPE_STRING, {.str = 
NULL }, 0, 0, DEC},
 {"rtmp_playpath", "Stream identifier to play or to publish", 
OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
+{"rtmp_subscribe", "Name of live stream to subscribe to. Defaults to 
rtmp_playpath.", OFFSET(subscribe), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, 
DEC},
 {"rtmp_swfurl", "URL of the SWF player. By default no value will be sent", 
OFFSET(swfurl), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
 {"rtmp_tcurl", "URL of the target stream. Defaults to 
proto://host[:port]/app.", OFFSET(tcurl), AV_OPT_TYPE_STRING, {.str = NULL }, 
0, 0, DEC|ENC},
 { NULL },
diff --git a/libavformat/version.h b/libavformat/version.h
index 6a11bf9..55026e8 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
 
 #define LIBAVFORMAT_VERSION_MAJOR 54
 #define LIBAVFORMAT_VERSION_MINOR 13
-#define LIBAVFORMAT_VERSION_MICRO  0
+#define LIBAVFORMAT_VERSION_MICRO  1
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
-- 
1.7.11.1

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


[libav-devel] [PATCH 1/2] rtmp: Add support for subscribing live streams

2012-08-01 Thread Samuel Pitoiset
When streaming live streams using the Akamai, Edgecast or Limelight CDN,
players cannot simply connect to the live stream. Instead, they have to
subscribe to it, by sending an FC Subscribe call to the server.
---
 libavformat/rtmpproto.c | 28 
 1 file changed, 28 insertions(+)

diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 4a35319..c6d327f 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -604,6 +604,29 @@ static int gen_bytes_read(URLContext *s, RTMPContext *rt, 
uint32_t ts)
 return ret;
 }
 
+static int gen_fcsubscribe_stream(URLContext *s, RTMPContext *rt)
+{
+RTMPPacket pkt;
+uint8_t *p;
+int ret;
+
+if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE,
+ 0, 27 + strlen(rt->playpath))) < 0)
+return ret;
+
+p = pkt.data;
+ff_amf_write_string(&p, "FCSubscribe");
+ff_amf_write_number(&p, rt->nb_invokes);
+ff_amf_write_null(&p);
+ff_amf_write_string(&p, rt->playpath);
+
+ret = ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size,
+   rt->prev_pkt[1]);
+ff_rtmp_packet_destroy(&pkt);
+
+return ret;
+}
+
 int ff_rtmp_calc_digest(const uint8_t *src, int len, int gap,
 const uint8_t *key, int keylen, uint8_t *dst)
 {
@@ -1011,6 +1034,11 @@ static int handle_invoke(URLContext *s, RTMPPacket *pkt)
 }
 if ((ret = gen_create_stream(s, rt)) < 0)
 return ret;
+
+if (rt->is_input) {
+if ((ret = gen_fcsubscribe_stream(s, rt)) < 0)
+return ret;
+}
 break;
 case STATE_FCPUBLISH:
 rt->state = STATE_CONNECTING;
-- 
1.7.11.1

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


[libav-devel] [PATCH] idcin: check for integer overflow when calling av_get_packet()

2012-08-01 Thread Justin Ruggles
chunk_size is unsigned 32-bit, but av_get_packet() takes a signed int as the
packet size.
---
 libavformat/idcin.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index 6a9b0ca..3acbc92 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -255,6 +255,11 @@ static int idcin_read_packet(AVFormatContext *s,
 /* skip the number of decoded bytes (always equal to width * height) */
 avio_skip(pb, 4);
 chunk_size -= 4;
+if (chunk_size > INT_MAX) {
+av_log(s, AV_LOG_ERROR, "chunk size is too large: %u\n", 
chunk_size);
+avio_skip(pb, chunk_size);
+return 0;
+}
 ret= av_get_packet(pb, pkt, chunk_size);
 if (ret < 0)
 return ret;
-- 
1.7.1

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


[libav-devel] [PATCH 14/15] lavr: x86: optimized 2-channel flt to fltp conversion

2012-08-01 Thread Justin Ruggles
---
 libavresample/x86/audio_convert.asm|   33 
 libavresample/x86/audio_convert_init.c |9 
 2 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/libavresample/x86/audio_convert.asm 
b/libavresample/x86/audio_convert.asm
index bc79f65..16cfcff 100644
--- a/libavresample/x86/audio_convert.asm
+++ b/libavresample/x86/audio_convert.asm
@@ -1172,3 +1172,36 @@ CONV_FLT_TO_S16P_6CH
 INIT_XMM avx
 CONV_FLT_TO_S16P_6CH
 %endif
+
+;--
+; void ff_conv_flt_to_fltp_2ch(float *const *dst, float *src, int len,
+;  int channels);
+;--
+
+%macro CONV_FLT_TO_FLTP_2CH 0
+cglobal conv_flt_to_fltp_2ch, 3,4,3, dst0, src, len, dst1
+lealenq, [4*lend]
+mov   dst1q, [dst0q+gprsize]
+mov   dst0q, [dst0q]
+leasrcq, [srcq+2*lenq]
+add   dst0q, lenq
+add   dst1q, lenq
+neglenq
+ALIGN 16
+.loop:
+mova m0, [srcq+2*lenq   ]
+mova m1, [srcq+2*lenq+mmsize]
+DEINT2_PS 0, 1, 2
+mova  [dst0q+lenq], m0
+mova  [dst1q+lenq], m1
+addlenq, mmsize
+jl .loop
+REP_RET
+%endmacro
+
+INIT_XMM sse
+CONV_FLT_TO_FLTP_2CH
+%if HAVE_AVX
+INIT_XMM avx
+CONV_FLT_TO_FLTP_2CH
+%endif
diff --git a/libavresample/x86/audio_convert_init.c 
b/libavresample/x86/audio_convert_init.c
index 66a5056..5ac12dc 100644
--- a/libavresample/x86/audio_convert_init.c
+++ b/libavresample/x86/audio_convert_init.c
@@ -128,6 +128,11 @@ extern void ff_conv_flt_to_s16p_6ch_sse2(int16_t *const 
*dst, float *src,
 extern void ff_conv_flt_to_s16p_6ch_avx (int16_t *const *dst, float *src,
  int len, int channels);
 
+extern void ff_conv_flt_to_fltp_2ch_sse(float *const *dst, float *src, int len,
+int channels);
+extern void ff_conv_flt_to_fltp_2ch_avx(float *const *dst, float *src, int len,
+int channels);
+
 av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
 {
 #if HAVE_YASM
@@ -144,6 +149,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
   6, 1, 2, "SSE", ff_conv_fltp_to_s16_6ch_sse);
 ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
   2, 16, 8, "SSE", 
ff_conv_fltp_to_flt_2ch_sse);
+ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT,
+  2, 16, 4, "SSE", 
ff_conv_flt_to_fltp_2ch_sse);
 }
 if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE) {
 if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW)) {
@@ -235,6 +242,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
   2, 16, 8, "AVX", 
ff_conv_flt_to_s16p_2ch_avx);
 ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT,
   6, 16, 4, "AVX", 
ff_conv_flt_to_s16p_6ch_avx);
+ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT,
+  2, 16, 4, "AVX", 
ff_conv_flt_to_fltp_2ch_avx);
 }
 #endif
 }
-- 
1.7.1

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


[libav-devel] [PATCH 12/15] lavr: x86: optimized 2-channel flt to s16p conversion

2012-08-01 Thread Justin Ruggles
---
 libavresample/x86/audio_convert.asm|   47 
 libavresample/x86/audio_convert_init.c |9 ++
 2 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/libavresample/x86/audio_convert.asm 
b/libavresample/x86/audio_convert.asm
index e1a4cc9..ac6e325 100644
--- a/libavresample/x86/audio_convert.asm
+++ b/libavresample/x86/audio_convert.asm
@@ -1051,3 +1051,50 @@ CONV_S16_TO_FLTP_6CH
 INIT_XMM avx
 CONV_S16_TO_FLTP_6CH
 %endif
+
+;--
+; void ff_conv_flt_to_s16p_2ch(int16_t *const *dst, float *src, int len,
+;  int channels);
+;--
+
+%macro CONV_FLT_TO_S16P_2CH 0
+cglobal conv_flt_to_s16p_2ch, 3,4,6, dst0, src, len, dst1
+lea   lenq, [2*lend]
+mov  dst1q, [dst0q+gprsize]
+mov  dst0q, [dst0q]
+lea   srcq, [srcq+4*lenq]
+add  dst0q, lenq
+add  dst1q, lenq
+neg   lenq
+movam5, [pf_s16_scale]
+ALIGN 16
+.loop:
+mova   m0, [srcq+4*lenq ]
+mova   m1, [srcq+4*lenq+  mmsize]
+mova   m2, [srcq+4*lenq+2*mmsize]
+mova   m3, [srcq+4*lenq+3*mmsize]
+DEINT2_PS   0, 1, 4
+DEINT2_PS   2, 3, 4
+mulps  m0, m0, m5
+mulps  m1, m1, m5
+mulps  m2, m2, m5
+mulps  m3, m3, m5
+cvtps2dq   m0, m0
+cvtps2dq   m1, m1
+cvtps2dq   m2, m2
+cvtps2dq   m3, m3
+packssdw   m0, m2
+packssdw   m1, m3
+mova  [dst0q+lenq], m0
+mova  [dst1q+lenq], m1
+add  lenq, mmsize
+jl .loop
+REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_FLT_TO_S16P_2CH
+%if HAVE_AVX
+INIT_XMM avx
+CONV_FLT_TO_S16P_2CH
+%endif
diff --git a/libavresample/x86/audio_convert_init.c 
b/libavresample/x86/audio_convert_init.c
index 8331497..5c799f4 100644
--- a/libavresample/x86/audio_convert_init.c
+++ b/libavresample/x86/audio_convert_init.c
@@ -118,6 +118,11 @@ extern void ff_conv_s16_to_fltp_6ch_sse4(float *const 
*dst, int16_t *src,
 extern void ff_conv_s16_to_fltp_6ch_avx (float *const *dst, int16_t *src,
  int len, int channels);
 
+extern void ff_conv_flt_to_s16p_2ch_sse2(int16_t *const *dst, float *src,
+ int len, int channels);
+extern void ff_conv_flt_to_s16p_2ch_avx (int16_t *const *dst, float *src,
+ int len, int channels);
+
 av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
 {
 #if HAVE_YASM
@@ -173,6 +178,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
   2, 16, 8, "SSE2", 
ff_conv_s16_to_fltp_2ch_sse2);
 ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16,
   6, 16, 4, "SSE2", 
ff_conv_s16_to_fltp_6ch_sse2);
+ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT,
+  2, 16, 8, "SSE2", 
ff_conv_flt_to_s16p_2ch_sse2);
 }
 if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSE) {
 ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P,
@@ -217,6 +224,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
   2, 16, 8, "AVX", 
ff_conv_s16_to_fltp_2ch_avx);
 ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16,
   6, 16, 4, "AVX", 
ff_conv_s16_to_fltp_6ch_avx);
+ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT,
+  2, 16, 8, "AVX", 
ff_conv_flt_to_s16p_2ch_avx);
 }
 #endif
 }
-- 
1.7.1

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


[libav-devel] [PATCH 10/15] lavr: x86: optimized 2-channel s16 to fltp conversion

2012-08-01 Thread Justin Ruggles
---
 libavresample/x86/audio_convert.asm|   40 
 libavresample/x86/audio_convert_init.c |   13 ++
 2 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/libavresample/x86/audio_convert.asm 
b/libavresample/x86/audio_convert.asm
index 8be2f3c..319898a 100644
--- a/libavresample/x86/audio_convert.asm
+++ b/libavresample/x86/audio_convert.asm
@@ -928,3 +928,43 @@ CONV_S16_TO_S16P_6CH
 INIT_XMM avx
 CONV_S16_TO_S16P_6CH
 %endif
+
+;--
+; void ff_conv_s16_to_fltp_2ch(float *const *dst, int16_t *src, int len,
+;  int channels);
+;--
+
+%macro CONV_S16_TO_FLTP_2CH 0
+cglobal conv_s16_to_fltp_2ch, 3,4,4, dst0, src, len, dst1
+lea   lenq, [4*lend]
+mov  dst1q, [dst0q+gprsize]
+mov  dst0q, [dst0q]
+add   srcq, lenq
+add  dst0q, lenq
+add  dst1q, lenq
+neg   lenq
+movam3, [pf_s16_inv_scale]
+ALIGN 16
+.loop:
+mova   m0, [srcq+lenq]
+S16_TO_S32_SX 0, 1
+cvtdq2ps   m0, m0
+cvtdq2ps   m1, m1
+mulps  m0, m0, m3
+mulps  m1, m1, m3
+DEINT2_PS   0, 1, 2
+mova  [dst0q+lenq], m0
+mova  [dst1q+lenq], m1
+add  lenq, mmsize
+jl .loop
+REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_S16_TO_FLTP_2CH
+INIT_XMM sse4
+CONV_S16_TO_FLTP_2CH
+%if HAVE_AVX
+INIT_XMM avx
+CONV_S16_TO_FLTP_2CH
+%endif
diff --git a/libavresample/x86/audio_convert_init.c 
b/libavresample/x86/audio_convert_init.c
index 1d68aca..72c8f19 100644
--- a/libavresample/x86/audio_convert_init.c
+++ b/libavresample/x86/audio_convert_init.c
@@ -104,6 +104,13 @@ extern void ff_conv_s16_to_s16p_6ch_sse2(int16_t *const 
*dst, int16_t *src,
 extern void ff_conv_s16_to_s16p_6ch_avx (int16_t *const *dst, int16_t *src,
  int len, int channels);
 
+extern void ff_conv_s16_to_fltp_2ch_sse2(float *const *dst, int16_t *src,
+ int len, int channels);
+extern void ff_conv_s16_to_fltp_2ch_sse4(float *const *dst, int16_t *src,
+ int len, int channels);
+extern void ff_conv_s16_to_fltp_2ch_avx (float *const *dst, int16_t *src,
+ int len, int channels);
+
 av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
 {
 #if HAVE_YASM
@@ -155,6 +162,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
   2, 16, 8, "SSE2", 
ff_conv_s16_to_s16p_2ch_sse2);
 ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16,
   6, 16, 4, "SSE2", 
ff_conv_s16_to_s16p_6ch_sse2);
+ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16,
+  2, 16, 8, "SSE2", 
ff_conv_s16_to_fltp_2ch_sse2);
 }
 if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSE) {
 ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P,
@@ -169,6 +178,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
   0, 16, 8, "SSE4", ff_conv_s16_to_flt_sse4);
 ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
   6, 16, 4, "SSE4", 
ff_conv_fltp_to_flt_6ch_sse4);
+ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16,
+  2, 16, 8, "SSE4", 
ff_conv_s16_to_fltp_2ch_sse4);
 }
 if (mm_flags & AV_CPU_FLAG_AVX && HAVE_AVX) {
 ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32,
@@ -191,6 +202,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
   2, 16, 8, "AVX", 
ff_conv_s16_to_s16p_2ch_avx);
 ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16,
   6, 16, 4, "AVX", 
ff_conv_s16_to_s16p_6ch_avx);
+ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16,
+  2, 16, 8, "AVX", 
ff_conv_s16_to_fltp_2ch_avx);
 }
 #endif
 }
-- 
1.7.1

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


[libav-devel] [PATCH 08/15] lavr: x86: optimized 2-channel s16 to s16p conversion

2012-08-01 Thread Justin Ruggles
---
 libavresample/x86/audio_convert.asm|   51 
 libavresample/x86/audio_convert_init.c |   15 +
 libavresample/x86/util.asm |6 
 3 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/libavresample/x86/audio_convert.asm 
b/libavresample/x86/audio_convert.asm
index beffecf..4d07033 100644
--- a/libavresample/x86/audio_convert.asm
+++ b/libavresample/x86/audio_convert.asm
@@ -33,6 +33,7 @@ pf_s16_scale: times 4 dd 0x4700
 pb_shuf_unpack_even:  db -1, -1,  0,  1, -1, -1,  2,  3, -1, -1,  8,  9, 
-1, -1, 10, 11
 pb_shuf_unpack_odd:   db -1, -1,  4,  5, -1, -1,  6,  7, -1, -1, 12, 13, 
-1, -1, 14, 15
 pb_interleave_words: SHUFFLE_MASK_W  0,  4,  1,  5,  2,  6,  3,  7
+pb_deinterleave_words: SHUFFLE_MASK_W  0,  2,  4,  6,  1,  3,  5,  7
 
 SECTION_TEXT
 
@@ -817,3 +818,53 @@ CONV_FLTP_TO_FLT_6CH
 INIT_XMM avx
 CONV_FLTP_TO_FLT_6CH
 %endif
+
+;--
+; void ff_conv_s16_to_s16p_2ch(int16_t *const *dst, int16_t *src, int len,
+;  int channels);
+;--
+
+%macro CONV_S16_TO_S16P_2CH 0
+cglobal conv_s16_to_s16p_2ch, 3,4,4, dst0, src, len, dst1
+lea   lenq, [2*lend]
+mov  dst1q, [dst0q+gprsize]
+mov  dst0q, [dst0q]
+lea   srcq, [srcq+2*lenq]
+add  dst0q, lenq
+add  dst1q, lenq
+neg   lenq
+%if cpuflag(ssse3)
+movam3, [pb_deinterleave_words]
+%endif
+ALIGN 16
+.loop:
+movam0, [srcq+2*lenq   ]  ; m0 =  0,  1,  2,  3,  4,  5,  6,  7
+movam1, [srcq+2*lenq+mmsize]  ; m1 =  8,  9, 10, 11, 12, 13, 14, 15
+%if cpuflag(ssse3)
+pshufb  m0, m3; m0 =  0,  2,  4,  6,  1,  3,  5,  7
+pshufb  m1, m3; m1 =  8, 10, 12, 14,  9, 11, 13, 15
+SBUTTERFLY2 qdq, 0, 1, 2  ; m0 =  0,  2,  4,  6,  8, 10, 12, 14
+  ; m1 =  1,  3,  5,  7,  9, 11, 13, 15
+%else ; sse2
+pshuflw m0, m0, q3120 ; m0 =  0,  2,  1,  3,  4,  5,  6,  7
+pshufhw m0, m0, q3120 ; m0 =  0,  2,  1,  3,  4,  6,  5,  7
+pshuflw m1, m1, q3120 ; m1 =  8, 10,  9, 11, 12, 13, 14, 15
+pshufhw m1, m1, q3120 ; m1 =  8, 10,  9, 11, 12, 14, 13, 15
+DEINT2_PS0, 1, 2  ; m0 =  0,  2,  4,  6,  8, 10, 12, 14
+  ; m1 =  1,  3,  5,  7,  9, 11, 13, 15
+%endif
+mova  [dst0q+lenq], m0
+mova  [dst1q+lenq], m1
+add   lenq, mmsize
+jl .loop
+REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_S16_TO_S16P_2CH
+INIT_XMM ssse3
+CONV_S16_TO_S16P_2CH
+%if HAVE_AVX
+INIT_XMM avx
+CONV_S16_TO_S16P_2CH
+%endif
diff --git a/libavresample/x86/audio_convert_init.c 
b/libavresample/x86/audio_convert_init.c
index c41d9a8..a1b83bb 100644
--- a/libavresample/x86/audio_convert_init.c
+++ b/libavresample/x86/audio_convert_init.c
@@ -90,6 +90,15 @@ extern void ff_conv_fltp_to_flt_6ch_sse4(float *dst, float 
*const *src, int len,
 extern void ff_conv_fltp_to_flt_6ch_avx (float *dst, float *const *src, int 
len,
  int channels);
 
+/* deinterleave conversions */
+
+extern void ff_conv_s16_to_s16p_2ch_sse2(int16_t *const *dst, int16_t *src,
+ int len, int channels);
+extern void ff_conv_s16_to_s16p_2ch_ssse3(int16_t *const *dst, int16_t *src,
+  int len, int channels);
+extern void ff_conv_s16_to_s16p_2ch_avx (int16_t *const *dst, int16_t *src,
+ int len, int channels);
+
 av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
 {
 #if HAVE_YASM
@@ -137,12 +146,16 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
   2, 16, 4, "SSE2", 
ff_conv_fltp_to_s16_2ch_sse2);
 ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP,
   6, 16, 4, "SSE2", 
ff_conv_fltp_to_s16_6ch_sse2);
+ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16,
+  2, 16, 8, "SSE2", 
ff_conv_s16_to_s16p_2ch_sse2);
 }
 if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSE) {
 ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P,
   6, 16, 4, "SSSE3", 
ff_conv_s16p_to_flt_6ch_ssse3);
 ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP,
   2, 16, 4, "SSSE3", 
ff_conv_fltp_to_s16_2ch_ssse3);
+ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16,
+  2, 16, 8, "SSSE3", 
ff_conv_s16_to_s16p_2ch_ssse3);
 }
 if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE) {

Re: [libav-devel] [PATCH] x86: Refactor PSWAPD fallback implementations and port to cpuflags

2012-08-01 Thread Ronald S. Bultje
Hi,

On Wed, Aug 1, 2012 at 5:30 AM, Diego Biurrun  wrote:
> ---
>  libavcodec/x86/fft_mmx.asm|   19 ---
>  libavcodec/x86/fmtconvert.asm |   17 ++---
>  libavutil/x86/x86util.asm |   12 
>  3 files changed, 18 insertions(+), 30 deletions(-)
>
> diff --git a/libavcodec/x86/fft_mmx.asm b/libavcodec/x86/fft_mmx.asm
> index cf38716..a409850 100644
> --- a/libavcodec/x86/fft_mmx.asm
> +++ b/libavcodec/x86/fft_mmx.asm
> @@ -105,7 +105,8 @@ SECTION_TEXT
>  pfadd%5, %4 ; {t6,t5}
>  pxor %3, [ps_m1p1] ; {t8,t7}
>  mova %6, %1
> -pswapd   %3, %3
> +movd [r0+12], %3
> +punpckhdq %3, [r0+8]

Needs rebase?

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


Re: [libav-devel] [PATCH] x86: vp8dsp: port FILTER_BILINEAR macro to cpuflags

2012-08-01 Thread Ronald S. Bultje
Hi,

On Wed, Aug 1, 2012 at 5:08 AM, Diego Biurrun  wrote:
> +FILTER_BILINEAR 8, 7, m2
>  INIT_MMX ssse3
> -FILTER_BILINEAR_SSSE3 4
> +FILTER_BILINEAR 4, 7, m2
>  INIT_XMM ssse3
> -FILTER_BILINEAR_SSSE3 8
> +FILTER_BILINEAR 8, 5, m1

So, uhm, we should probably discuss this on IRC before you send more
patches. When using as an inline replacement for a direct instruction,
we indeed give register arguments to macros, but in the common case of
full-function macros, which is what you have here, I don't think we
ever use direct registers as an argument, because then the macro'ed
function code itself becomes a lot less logical, since some of the
logic of the operation is outside the scope of the macro.

There's some easier ways to accomplish the same kind of thing, let's
go over this on IRC later.

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


Re: [libav-devel] [PATCH 34/45] x86: PABSW: port to cpuflags

2012-08-01 Thread Justin Ruggles
On 07/31/2012 06:17 PM, Diego Biurrun wrote:
> ---
>  libavcodec/x86/vc1dsp_yasm.asm |3 ---
>  libavutil/x86/x86util.asm  |   22 ++
>  2 files changed, 10 insertions(+), 15 deletions(-)

patch looks fine.

But I think ideally PABSW should be merged with ABS1. It's quite simple
to check if src and dst are the same, and temp reg arguments can be
optional. The PABSW macro should basically do the same thing as the
instruction of the same name.

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


Re: [libav-devel] [PATCH 02/45] x86: build: replace mmx2 by mmxext

2012-08-01 Thread Ronald S. Bultje
Hi,

On Wed, Aug 1, 2012 at 6:24 AM, Diego Biurrun  wrote:
> On Wed, Aug 01, 2012 at 02:46:36PM +0200, Janne Grunau wrote:
>> On 2012-08-01 01:33:47 +0200, Diego Biurrun wrote:
>> > On Wed, Aug 01, 2012 at 12:00:58AM +0100, Måns Rullgård wrote:
>> > > "Ronald S. Bultje"  writes:
>> > > > On Tue, Jul 31, 2012 at 3:17 PM, Diego Biurrun  
>> > > > wrote:
>> > > > [..]
>> > > >
>> > > > The most important thing is missing: why?
>> > >
>> > > mmxext is a somewhat more official name.
>> >
>> > Yes, see my introductory email for the series.  I had to unify in one
>> > direction or the other, so I picked the one that appeared more
>> > sensible, i.e. the more official names.
>>
>> That's all well but it is still missing from the commit message. That's
>> how I uderstood Ronald comment. Please amend the commit.
>
> How about:
>
>   x86: build: replace mmx2 by mmxext
>
>   Refactoring mmx2/mmxext YASM code with cpuflags will force renames.
>   So switching to a consistent naming scheme beforehand in sensible.

in sensible?

>   The name "mmxext" is more official and widespread and also the name
>   of the CPU flag, as reported e.g. by the Linux kernel.

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


Re: [libav-devel] [PATCH 33/45] x86: PALIGNR: port to cpuflags

2012-08-01 Thread Justin Ruggles
On 07/31/2012 06:17 PM, Diego Biurrun wrote:
> ---
>  libavcodec/x86/h264_intrapred.asm   |   27 ---
>  libavcodec/x86/h264_intrapred_10bit.asm |   16 
>  libavcodec/x86/h264_qpel_10bit.asm  |4 
>  libavutil/x86/x86util.asm   |   16 
>  libswscale/x86/output.asm   |4 +---
>  5 files changed, 9 insertions(+), 58 deletions(-)
> 
[...]
> diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm
> index 27eca3a..18c804c 100644
> --- a/libavutil/x86/x86util.asm
> +++ b/libavutil/x86/x86util.asm
> @@ -280,7 +280,14 @@
>  %endif
>  %endmacro
>  
> -%macro PALIGNR_MMX 4-5 ; [dst,] src1, src2, imm, tmp
> +%macro PALIGNR 4-5
> +%if cpuflag(ssse3)
> +%if %0==5
> +palignr %1, %2, %3, %4
> +%else
> +palignr %1, %2, %3
> +%endif
> +%elif cpuflag(mmx) ; [dst,] src1, src2, imm, tmp
>  %define %%dst %1
>  %if %0==5
>  %ifnidn %1, %2
> @@ -299,13 +306,6 @@
>  psrldq  %4, %3
>  %endif
>  por %%dst, %4
> -%endmacro
> -
> -%macro PALIGNR_SSSE3 4-5
> -%if %0==5
> -palignr %1, %2, %3, %4
> -%else
> -palignr %1, %2, %3
>  %endif
>  %endmacro

Please put the comment with macro arguments on the same line as the
macro definition. Also, cpuflag(mmx) is not necessary. This macro cannot
be called from a non-SIMD function because it operates on mm registers.

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


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

2012-08-01 Thread Justin Ruggles
On 08/01/2012 07:48 AM, an...@khirnov.net wrote:
> 
> Hi,
> I have a disagreement with Diego about generating doxygen docs.
> 
> Currently we generate doxygen for all files in Libav, which IMO leads to
> horribly cluttered output.
> See e.g.
> https://libav.org/doxygen/master/files.html
> https://libav.org/doxygen/master/annotated.html
> https://libav.org/doxygen/master/classes.html
> https://libav.org/doxygen/master/globals_func.html
> A mountain of stuff that's absolutely useless to people who want public
> API documentation. It just makes searching for what they need much
> harder.
> 
> For this reason I think we should only generate doxy for installed
> headers, so the output contains only public API documentation.
> At least that should be the default, we can have a second alternative
> doxy config file that would generate docs for everything.
> 
> OTOH Diego claims we should keep generating doxy for all files. I'm sure
> he'll present his reasons and arguments himself.
> 
> If there indeed are people who read generated doxy for non-public API,
> I'd like them to speak up and prove their existence.
> Everyone else with an opinion is of course welcome to comment as well.

+1 on public API doxy by default, internal doxy with option.

-Justin

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


Re: [libav-devel] [PATCH 02/45] x86: build: replace mmx2 by mmxext

2012-08-01 Thread Diego Biurrun
On Wed, Aug 01, 2012 at 04:04:50PM +0200, Janne Grunau wrote:
> On 2012-08-01 15:24:37 +0200, Diego Biurrun wrote:
> > On Wed, Aug 01, 2012 at 02:46:36PM +0200, Janne Grunau wrote:
> > > On 2012-08-01 01:33:47 +0200, Diego Biurrun wrote:
> > > > On Wed, Aug 01, 2012 at 12:00:58AM +0100, Måns Rullgård wrote:
> > > > > "Ronald S. Bultje"  writes:
> > > > > > On Tue, Jul 31, 2012 at 3:17 PM, Diego Biurrun  
> > > > > > wrote:
> > > > > > [..]
> > > > > >
> > > > > > The most important thing is missing: why?
> > > > > 
> > > > > mmxext is a somewhat more official name.
> > > > 
> > > > Yes, see my introductory email for the series.  I had to unify in one
> > > > direction or the other, so I picked the one that appeared more
> > > > sensible, i.e. the more official names.
> > > 
> > > That's all well but it is still missing from the commit message. That's
> > > how I uderstood Ronald comment. Please amend the commit.
> > 
> > How about:
> > 
> >   x86: build: replace mmx2 by mmxext
> > 
> >   Refactoring mmx2/mmxext YASM code with cpuflags will force renames.
> >   So switching to a consistent naming scheme beforehand in sensible.
> >   The name "mmxext" is more official and widespread and also the name
> >   of the CPU flag, as reported e.g. by the Linux kernel.
> > 
> > I'd add the paragraph to all the other rename commits as well.
> 
> please do

Done locally.

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


Re: [libav-devel] [PATCH 02/45] x86: build: replace mmx2 by mmxext

2012-08-01 Thread Janne Grunau
On 2012-08-01 15:24:37 +0200, Diego Biurrun wrote:
> On Wed, Aug 01, 2012 at 02:46:36PM +0200, Janne Grunau wrote:
> > On 2012-08-01 01:33:47 +0200, Diego Biurrun wrote:
> > > On Wed, Aug 01, 2012 at 12:00:58AM +0100, Måns Rullgård wrote:
> > > > "Ronald S. Bultje"  writes:
> > > > > On Tue, Jul 31, 2012 at 3:17 PM, Diego Biurrun  
> > > > > wrote:
> > > > > [..]
> > > > >
> > > > > The most important thing is missing: why?
> > > > 
> > > > mmxext is a somewhat more official name.
> > > 
> > > Yes, see my introductory email for the series.  I had to unify in one
> > > direction or the other, so I picked the one that appeared more
> > > sensible, i.e. the more official names.
> > 
> > That's all well but it is still missing from the commit message. That's
> > how I uderstood Ronald comment. Please amend the commit.
> 
> How about:
> 
>   x86: build: replace mmx2 by mmxext
> 
>   Refactoring mmx2/mmxext YASM code with cpuflags will force renames.
>   So switching to a consistent naming scheme beforehand in sensible.
>   The name "mmxext" is more official and widespread and also the name
>   of the CPU flag, as reported e.g. by the Linux kernel.
> 
> I'd add the paragraph to all the other rename commits as well.

please do

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


Re: [libav-devel] [PATCH] dct-test: always link with aandcttab.o

2012-08-01 Thread Diego Biurrun
On Wed, Aug 01, 2012 at 02:32:24PM +0100, Mans Rullgard wrote:
> This allows building dct-test even if aandcttab.o is not pulled in
> by any enabled codec.  The DCT with which these tables are used does
> not use them directly, so building it without the tables is possible.
> ---
>  libavcodec/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

OK

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


Re: [libav-devel] [PATCH] dct-test: always link with aandcttab.o

2012-08-01 Thread Kostya Shishkov
On Wed, Aug 01, 2012 at 02:32:24PM +0100, Mans Rullgard wrote:
> This allows building dct-test even if aandcttab.o is not pulled in
> by any enabled codec.  The DCT with which these tables are used does
> not use them directly, so building it without the tables is possible.
> 
> Signed-off-by: Mans Rullgard 
> ---
>  libavcodec/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 7fc5059..1848fef 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -747,7 +747,7 @@ HOSTPROGS = aac_tablegen  
>   \
>  
>  CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF)
>  
> -$(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o
> +$(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o $(SUBDIR)aandcttab.o
>  
>  TRIG_TABLES  = cos cos_fixed sin
>  TRIG_TABLES := $(TRIG_TABLES:%=$(SUBDIR)%_tables.c)
> -- 

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


[libav-devel] [PATCH] dct-test: always link with aandcttab.o

2012-08-01 Thread Mans Rullgard
This allows building dct-test even if aandcttab.o is not pulled in
by any enabled codec.  The DCT with which these tables are used does
not use them directly, so building it without the tables is possible.

Signed-off-by: Mans Rullgard 
---
 libavcodec/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 7fc5059..1848fef 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -747,7 +747,7 @@ HOSTPROGS = aac_tablegen
\
 
 CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF)
 
-$(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o
+$(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o $(SUBDIR)aandcttab.o
 
 TRIG_TABLES  = cos cos_fixed sin
 TRIG_TABLES := $(TRIG_TABLES:%=$(SUBDIR)%_tables.c)
-- 
1.7.11.1

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


[libav-devel] [PATCH] x86: Use consistent 3dnowext function and macro name suffixes

2012-08-01 Thread Diego Biurrun
Currently there is a wild mix of 3dn2/3dnow2/3dnowext.  Switching to
"3dnowext", which is a more common name of the CPU flag, as reported
e.g. by the Linux kernel, unifies this.
---
 libavcodec/x86/dsputil_mmx.c|   14 ++--
 libavcodec/x86/fft.c|6 ++--
 libavcodec/x86/fft.h|6 ++--
 libavcodec/x86/fft_mmx.asm  |   46 +++---
 libavcodec/x86/fmtconvert.asm   |6 ++--
 libavcodec/x86/fmtconvert_mmx.c |   10 +---
 libavutil/x86/x86inc.asm|2 +-
 7 files changed, 46 insertions(+), 44 deletions(-)

diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
index afbb531..2663c39 100644
--- a/libavcodec/x86/dsputil_mmx.c
+++ b/libavcodec/x86/dsputil_mmx.c
@@ -2387,9 +2387,9 @@ static void ac3_downmix_sse(float (*samples)[256], float 
(*matrix)[2],
 }
 
 #if HAVE_6REGS
-static void vector_fmul_window_3dnow2(float *dst, const float *src0,
-  const float *src1, const float *win,
-  int len)
+static void vector_fmul_window_3dnowext(float *dst, const float *src0,
+const float *src1, const float *win,
+int len)
 {
 x86_reg i = -len * 4;
 x86_reg j =  len * 4 - 8;
@@ -2838,11 +2838,11 @@ static void dsputil_init_3dnow(DSPContext *c, 
AVCodecContext *avctx,
 #endif
 }
 
-static void dsputil_init_3dnow2(DSPContext *c, AVCodecContext *avctx,
-int mm_flags)
+static void dsputil_init_3dnowext(DSPContext *c, AVCodecContext *avctx,
+  int mm_flags)
 {
 #if HAVE_6REGS && HAVE_INLINE_ASM
-c->vector_fmul_window  = vector_fmul_window_3dnow2;
+c->vector_fmul_window  = vector_fmul_window_3dnowext;
 #endif
 }
 
@@ -3093,7 +3093,7 @@ void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext 
*avctx)
 dsputil_init_3dnow(c, avctx, mm_flags);
 
 if (mm_flags & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT)
-dsputil_init_3dnow2(c, avctx, mm_flags);
+dsputil_init_3dnowext(c, avctx, mm_flags);
 
 if (mm_flags & AV_CPU_FLAG_SSE && HAVE_SSE)
 dsputil_init_sse(c, avctx, mm_flags);
diff --git a/libavcodec/x86/fft.c b/libavcodec/x86/fft.c
index f1c1c9d..fcde3fa 100644
--- a/libavcodec/x86/fft.c
+++ b/libavcodec/x86/fft.c
@@ -34,9 +34,9 @@ av_cold void ff_fft_init_mmx(FFTContext *s)
 }
 if (has_vectors & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT) {
 /* 3DNowEx for K7 */
-s->imdct_calc = ff_imdct_calc_3dnow2;
-s->imdct_half = ff_imdct_half_3dnow2;
-s->fft_calc   = ff_fft_calc_3dnow2;
+s->imdct_calc = ff_imdct_calc_3dnowext;
+s->imdct_half = ff_imdct_half_3dnowext;
+s->fft_calc   = ff_fft_calc_3dnowext;
 }
 #endif
 if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) {
diff --git a/libavcodec/x86/fft.h b/libavcodec/x86/fft.h
index 1cefe7a..6e80b95 100644
--- a/libavcodec/x86/fft.h
+++ b/libavcodec/x86/fft.h
@@ -25,12 +25,12 @@ void ff_fft_permute_sse(FFTContext *s, FFTComplex *z);
 void ff_fft_calc_avx(FFTContext *s, FFTComplex *z);
 void ff_fft_calc_sse(FFTContext *s, FFTComplex *z);
 void ff_fft_calc_3dnow(FFTContext *s, FFTComplex *z);
-void ff_fft_calc_3dnow2(FFTContext *s, FFTComplex *z);
+void ff_fft_calc_3dnowext(FFTContext *s, FFTComplex *z);
 
 void ff_imdct_calc_3dnow(FFTContext *s, FFTSample *output, const FFTSample 
*input);
 void ff_imdct_half_3dnow(FFTContext *s, FFTSample *output, const FFTSample 
*input);
-void ff_imdct_calc_3dnow2(FFTContext *s, FFTSample *output, const FFTSample 
*input);
-void ff_imdct_half_3dnow2(FFTContext *s, FFTSample *output, const FFTSample 
*input);
+void ff_imdct_calc_3dnowext(FFTContext *s, FFTSample *output, const FFTSample 
*input);
+void ff_imdct_half_3dnowext(FFTContext *s, FFTSample *output, const FFTSample 
*input);
 void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample 
*input);
 void ff_imdct_half_sse(FFTContext *s, FFTSample *output, const FFTSample 
*input);
 void ff_imdct_half_avx(FFTContext *s, FFTSample *output, const FFTSample 
*input);
diff --git a/libavcodec/x86/fft_mmx.asm b/libavcodec/x86/fft_mmx.asm
index 81e4411..155cb0f 100644
--- a/libavcodec/x86/fft_mmx.asm
+++ b/libavcodec/x86/fft_mmx.asm
@@ -93,14 +93,14 @@ cextern cos_ %+ i
 
 SECTION_TEXT
 
-%macro T2_3DN 4 ; z0, z1, mem0, mem1
+%macro T2_3DNOW 4 ; z0, z1, mem0, mem1
 mova %1, %3
 mova %2, %1
 pfadd%1, %4
 pfsub%2, %4
 %endmacro
 
-%macro T4_3DN 6 ; z0, z1, z2, z3, tmp0, tmp1
+%macro T4_3DNOW 6 ; z0, z1, z2, z3, tmp0, tmp1
 mova %5, %3
 pfsub%3, %4
 pfadd%5, %4 ; {t6,t5}
@@ -444,13 +444,13 @@ fft16_sse:
 ret
 
 
-%macro FFT48_3DN 0
+%macro FFT48_3DNOW 0
 align 16
 fft4 %+ SUFFIX:
-T2_3DN   m0, m1, Z(0), Z(1)
+T2_3DNOW m0, m1, Z(0), Z(1)
 mova m2, Z(2)
 mova m3, Z(3)
-T4_3DN   m0, m1, m2, m3, 

Re: [libav-devel] [PATCH 02/45] x86: build: replace mmx2 by mmxext

2012-08-01 Thread Diego Biurrun
On Wed, Aug 01, 2012 at 02:46:36PM +0200, Janne Grunau wrote:
> On 2012-08-01 01:33:47 +0200, Diego Biurrun wrote:
> > On Wed, Aug 01, 2012 at 12:00:58AM +0100, Måns Rullgård wrote:
> > > "Ronald S. Bultje"  writes:
> > > > On Tue, Jul 31, 2012 at 3:17 PM, Diego Biurrun  wrote:
> > > > [..]
> > > >
> > > > The most important thing is missing: why?
> > > 
> > > mmxext is a somewhat more official name.
> > 
> > Yes, see my introductory email for the series.  I had to unify in one
> > direction or the other, so I picked the one that appeared more
> > sensible, i.e. the more official names.
> 
> That's all well but it is still missing from the commit message. That's
> how I uderstood Ronald comment. Please amend the commit.

How about:

  x86: build: replace mmx2 by mmxext

  Refactoring mmx2/mmxext YASM code with cpuflags will force renames.
  So switching to a consistent naming scheme beforehand in sensible.
  The name "mmxext" is more official and widespread and also the name
  of the CPU flag, as reported e.g. by the Linux kernel.

I'd add the paragraph to all the other rename commits as well.

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


Re: [libav-devel] [PATCH] vp8: pack struct VP8ThreadData more efficiently

2012-08-01 Thread Janne Grunau
On 2012-08-01 14:01:11 +0100, Måns Rullgård wrote:
> Reordering the members in this struct reduces the holes required
> to maintain alignment.  With this order, the only remaining, and
> unavoidable, hole is 3 bytes following left_nnz.
> 
> Signed-off-by: Mans Rullgard 
> ---
>  libavcodec/vp8.h | 34 +-
>  1 file changed, 17 insertions(+), 17 deletions(-)

ok

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


Re: [libav-devel] [PATCH] vp8: pack struct VP8ThreadData more efficiently

2012-08-01 Thread Kostya Shishkov
On Wed, Aug 01, 2012 at 02:01:11PM +0100, Mans Rullgard wrote:
> Reordering the members in this struct reduces the holes required
> to maintain alignment.  With this order, the only remaining, and
> unavoidable, hole is 3 bytes following left_nnz.
> 
> Signed-off-by: Mans Rullgard 
> ---
>  libavcodec/vp8.h | 34 +-
>  1 file changed, 17 insertions(+), 17 deletions(-)

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


Re: [libav-devel] [PATCH 01/45] x86: Use consistent 3dnowext file/function/macro name suffixes

2012-08-01 Thread Janne Grunau
On 2012-08-01 00:17:25 +0200, Diego Biurrun wrote:
> Currently there is a wild mix of 3dn2/3dnow2/3dnowext.  Switching to
> "3dnowext", which is the actual name of the CPU flag unifies this.

define "actual name" it is the same name as the linux kernel reports
in /proc/cpuinfo which is also just a name somebody used. Using the
same name as the linux kernel is not a bad idea. Only downside is
that it so long.

> ---
>  libavcodec/x86/Makefile   |4 +-
>  libavcodec/x86/dsputil_mmx.c  |   14 ++--
>  libavcodec/x86/fft.c  |6 ++--
>  libavcodec/x86/fft.h  |6 ++--
>  libavcodec/x86/{fft_3dn.c => fft_3dnow.c} |2 +-
>  libavcodec/x86/{fft_3dn2.c => fft_3dnowext.c} |   26 
>  libavcodec/x86/fft_mmx.asm|8 +++---
>  libavcodec/x86/fmtconvert.asm |6 ++--
>  libavcodec/x86/fmtconvert_mmx.c   |   10 +---
>  libavutil/x86/x86inc.asm  |2 +-
>  10 files changed, 43 insertions(+), 41 deletions(-)
>  rename libavcodec/x86/{fft_3dn.c => fft_3dnow.c} (97%)
>  rename libavcodec/x86/{fft_3dn2.c => fft_3dnowext.c} (85%)

patch ok

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


[libav-devel] [PATCH] vp8: pack struct VP8ThreadData more efficiently

2012-08-01 Thread Mans Rullgard
Reordering the members in this struct reduces the holes required
to maintain alignment.  With this order, the only remaining, and
unavoidable, hole is 3 bytes following left_nnz.

Signed-off-by: Mans Rullgard 
---
 libavcodec/vp8.h | 34 +-
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/libavcodec/vp8.h b/libavcodec/vp8.h
index 6b3caa2..a337173 100644
--- a/libavcodec/vp8.h
+++ b/libavcodec/vp8.h
@@ -94,21 +94,8 @@ typedef struct {
 } VP8Macroblock;
 
 typedef struct {
-#if HAVE_THREADS
-pthread_mutex_t lock;
-pthread_cond_t  cond;
-#endif
-int thread_nr;
-int thread_mb_pos; // (mb_y << 16) | (mb_x & 0x)
-int wait_mb_pos; // What the current thread is waiting on.
-uint8_t *edge_emu_buffer;
-/**
- * For coeff decode, we need to know whether the above block had non-zero
- * coefficients. This means for each macroblock, we need data for 4 luma
- * blocks, 2 u blocks, 2 v blocks, and the luma dc block, for a total of 9
- * per macroblock. We keep the last row in top_nnz.
- */
-DECLARE_ALIGNED(8, uint8_t, left_nnz)[9];
+DECLARE_ALIGNED(16, DCTELEM, block)[6][4][16];
+DECLARE_ALIGNED(16, DCTELEM, block_dc)[16];
 /**
  * This is the index plus one of the last non-zero coeff
  * for each of the blocks in the current macroblock.
@@ -117,8 +104,21 @@ typedef struct {
  * 2+-> full transform
  */
 DECLARE_ALIGNED(16, uint8_t, non_zero_count_cache)[6][4];
-DECLARE_ALIGNED(16, DCTELEM, block)[6][4][16];
-DECLARE_ALIGNED(16, DCTELEM, block_dc)[16];
+/**
+ * For coeff decode, we need to know whether the above block had non-zero
+ * coefficients. This means for each macroblock, we need data for 4 luma
+ * blocks, 2 u blocks, 2 v blocks, and the luma dc block, for a total of 9
+ * per macroblock. We keep the last row in top_nnz.
+ */
+DECLARE_ALIGNED(8, uint8_t, left_nnz)[9];
+int thread_nr;
+#if HAVE_THREADS
+pthread_mutex_t lock;
+pthread_cond_t  cond;
+#endif
+int thread_mb_pos; // (mb_y << 16) | (mb_x & 0x)
+int wait_mb_pos; // What the current thread is waiting on.
+uint8_t *edge_emu_buffer;
 VP8FilterStrength *filter_strength;
 } VP8ThreadData;
 
-- 
1.7.11.1

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


Re: [libav-devel] [PATCH 02/45] x86: build: replace mmx2 by mmxext

2012-08-01 Thread Janne Grunau
On 2012-08-01 01:33:47 +0200, Diego Biurrun wrote:
> On Wed, Aug 01, 2012 at 12:00:58AM +0100, Måns Rullgård wrote:
> > "Ronald S. Bultje"  writes:
> > > On Tue, Jul 31, 2012 at 3:17 PM, Diego Biurrun  wrote:
> > > [..]
> > >
> > > The most important thing is missing: why?
> > 
> > mmxext is a somewhat more official name.
> 
> Yes, see my introductory email for the series.  I had to unify in one
> direction or the other, so I picked the one that appeared more
> sensible, i.e. the more official names.

That's all well but it is still missing from the commit message. That's
how I uderstood Ronald comment. Please amend the commit.

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


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

2012-08-01 Thread Mashiat Sarker Shakkhar

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

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


s/ for non-public API// ;P


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


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


Just my 1.63208 BDT.

-Shakkhar

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


[libav-devel] [PATCH] x86: Refactor PSWAPD fallback implementations and port to cpuflags

2012-08-01 Thread Diego Biurrun
---
 libavcodec/x86/fft_mmx.asm|   19 ---
 libavcodec/x86/fmtconvert.asm |   17 ++---
 libavutil/x86/x86util.asm |   12 
 3 files changed, 18 insertions(+), 30 deletions(-)

diff --git a/libavcodec/x86/fft_mmx.asm b/libavcodec/x86/fft_mmx.asm
index cf38716..a409850 100644
--- a/libavcodec/x86/fft_mmx.asm
+++ b/libavcodec/x86/fft_mmx.asm
@@ -105,7 +105,8 @@ SECTION_TEXT
 pfadd%5, %4 ; {t6,t5}
 pxor %3, [ps_m1p1] ; {t8,t7}
 mova %6, %1
-pswapd   %3, %3
+movd [r0+12], %3
+punpckhdq %3, [r0+8]
 pfadd%1, %5 ; {r0,i0}
 pfsub%6, %5 ; {r2,i2}
 mova %4, %2
@@ -469,8 +470,8 @@ fft8 %+ SUFFIX:
 mova   Z(2), m2
 T2_3DNOW m4, m5,  Z(4),  Z(5)
 T2_3DNOW m6, m7, Z2(6), Z2(7)
-pswapd   m0, m5
-pswapd   m2, m7
+PSWAPD   m0, m5
+PSWAPD   m2, m7
 pxor m0, [ps_m1p1]
 pxor m2, [ps_m1p1]
 pfsubm5, m0
@@ -500,18 +501,6 @@ fft8 %+ SUFFIX:
 
 INIT_MMX 3dnowext
 FFT48_3DNOW
-
-%macro pswapd 2
-%ifidn %1, %2
-movd [r0+12], %1
-punpckhdq %1, [r0+8]
-%else
-movq  %1, %2
-psrlq %1, 32
-punpckldq %1, %2
-%endif
-%endmacro
-
 INIT_MMX 3dnow
 FFT48_3DNOW
 
diff --git a/libavcodec/x86/fmtconvert.asm b/libavcodec/x86/fmtconvert.asm
index 68616f2..1782624 100644
--- a/libavcodec/x86/fmtconvert.asm
+++ b/libavcodec/x86/fmtconvert.asm
@@ -247,16 +247,6 @@ FLOAT_TO_INT16_INTERLEAVE2
 INIT_XMM sse2
 FLOAT_TO_INT16_INTERLEAVE2
 
-
-%macro PSWAPD_SSE 2
-pshufw %1, %2, 0x4e
-%endmacro
-%macro PSWAPD_3DNOW 2
-movq  %1, %2
-psrlq %1, 32
-punpckldq %1, %2
-%endmacro
-
 %macro FLOAT_TO_INT16_INTERLEAVE6 0
 ; void float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len)
 cglobal float_to_int16_interleave6, 2, 8, 0, dst, src, src1, src2, src3, src4, 
src5, len
@@ -286,11 +276,11 @@ cglobal float_to_int16_interleave6, 2, 8, 0, dst, src, 
src1, src2, src3, src4, s
 packssdw   mm0, mm3
 packssdw   mm1, mm4
 packssdw   mm2, mm5
-pswapd mm3, mm0
+PSWAPD mm3, mm0
 punpcklwd  mm0, mm1
 punpckhwd  mm1, mm2
 punpcklwd  mm2, mm3
-pswapd mm3, mm0
+PSWAPD mm3, mm0
 punpckldq  mm0, mm2
 punpckhdq  mm2, mm1
 punpckldq  mm1, mm3
@@ -306,12 +296,9 @@ cglobal float_to_int16_interleave6, 2, 8, 0, dst, src, 
src1, src2, src3, src4, s
 %endmacro ; FLOAT_TO_INT16_INTERLEAVE6
 
 INIT_MMX sse
-%define pswapd PSWAPD_SSE
 FLOAT_TO_INT16_INTERLEAVE6
 INIT_MMX 3dnow
-%define pswapd PSWAPD_3DNOW
 FLOAT_TO_INT16_INTERLEAVE6
-%undef pswapd
 INIT_MMX 3dnowext
 FLOAT_TO_INT16_INTERLEAVE6
 
diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm
index 6911a9c..71593a3 100644
--- a/libavutil/x86/x86util.asm
+++ b/libavutil/x86/x86util.asm
@@ -306,6 +306,18 @@
 %endif
 %endmacro
 
+%macro PSWAPD 2
+%if cpuflag(sse)
+pshufw %1, %2, 0x4e
+%elif cpuflag(3dnowext)
+pswapd %1, %2
+%elif cpuflag(3dnow)
+movq  %1, %2
+psrlq %1, 32
+punpckldq %1, %2
+%endif
+%endmacro
+
 %macro DEINTB 5 ; mask, reg1, mask, reg2, optional src to fill masks from
 %ifnum %5
 pand   m%3, m%5, m%4 ; src .. y6 .. y4
-- 
1.7.2.5

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


  1   2   >