[libav-devel] [PATCH] avresample: use valid log context in mixing functions

2012-12-16 Thread Hendrik Leppkes
---
 libavresample/audio_mix.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavresample/audio_mix.c b/libavresample/audio_mix.c
index 62f8bd6..acddb31 100644
--- a/libavresample/audio_mix.c
+++ b/libavresample/audio_mix.c
@@ -467,13 +467,13 @@ int ff_audio_mix_get_matrix(AudioMix *am, double *matrix, 
int stride)
 
 if ( am-in_channels = 0 ||  am-in_channels  AVRESAMPLE_MAX_CHANNELS ||
 am-out_channels = 0 || am-out_channels  AVRESAMPLE_MAX_CHANNELS) {
-av_log(am, AV_LOG_ERROR, Invalid channel counts\n);
+av_log(am-avr, AV_LOG_ERROR, Invalid channel counts\n);
 return AVERROR(EINVAL);
 }
 
 #define GET_MATRIX_CONVERT(suffix, scale)   \
 if (!am-matrix_ ## suffix[0]) {\
-av_log(am, AV_LOG_ERROR, matrix is not set\n);\
+av_log(am-avr, AV_LOG_ERROR, matrix is not set\n);  
  \
 return AVERROR(EINVAL); \
 }   \
 for (o = 0; o  am-out_channels; o++)  \
@@ -491,7 +491,7 @@ int ff_audio_mix_get_matrix(AudioMix *am, double *matrix, 
int stride)
 GET_MATRIX_CONVERT(flt, 1.0);
 break;
 default:
-av_log(am, AV_LOG_ERROR, Invalid mix coeff type\n);
+av_log(am-avr, AV_LOG_ERROR, Invalid mix coeff type\n);
 return AVERROR(EINVAL);
 }
 
@@ -504,7 +504,7 @@ int ff_audio_mix_set_matrix(AudioMix *am, const double 
*matrix, int stride)
 
 if ( am-in_channels = 0 ||  am-in_channels  AVRESAMPLE_MAX_CHANNELS ||
 am-out_channels = 0 || am-out_channels  AVRESAMPLE_MAX_CHANNELS) {
-av_log(am, AV_LOG_ERROR, Invalid channel counts\n);
+av_log(am-avr, AV_LOG_ERROR, Invalid channel counts\n);
 return AVERROR(EINVAL);
 }
 
@@ -540,7 +540,7 @@ int ff_audio_mix_set_matrix(AudioMix *am, const double 
*matrix, int stride)
 CONVERT_MATRIX(flt, v)
 break;
 default:
-av_log(am, AV_LOG_ERROR, Invalid mix coeff type\n);
+av_log(am-avr, AV_LOG_ERROR, Invalid mix coeff type\n);
 return AVERROR(EINVAL);
 }
 
-- 
1.8.0.msysgit.0

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


Re: [libav-devel] [PATCH 2/4] lavr: x86: add SSE2 and FMA4 quantization for non-filtering dither methods

2012-12-16 Thread Loren Merritt
On Sat, 15 Dec 2012, Justin Ruggles wrote:

 +;--
 +; void ff_quantize_int_rectangular/triangular(int16_t *dst, float *src,
 +; int *dither, int len);
 +;--
 +
 +%macro QUANTIZE_INT 1
 +cglobal quantize_int_%1, 4,5,6, dst, src, dither0, len, dither1
 +lea lenq, [2*lend]
 +add dstq, lenq
 +lea srcq, [srcq+2*lenq]
 +%ifidn %1, triangular
 +lea dither1q, [dither0q+4*lenq]
 +%endif
 +lea dither0q, [dither0q+2*lenq]
 +neg lenq
 +mova  m4, [pf_dither_scale]
 +mova  m5, [pf_s16_scale]
 +.loop:
 +cvtdq2ps  m0, [dither0q+2*lenq]
 +cvtdq2ps  m1, [dither0q+2*lenq+mmsize]

Do you have to store dither in a format different than the asm works with?

 +%ifidn %1, triangular
 +cvtdq2ps  m2, [dither1q+2*lenq]
 +cvtdq2ps  m3, [dither1q+2*lenq+mmsize]
 +addps m0, m2
 +addps m1, m3

Can you add before converting, or does that overflow?

 +%endif
 +mulps m2, m5, [srcq+2*lenq]
 +mulps m3, m5, [srcq+2*lenq+mmsize]
 +fmaddps   m0, m0, m4, m2, m3
 +fmaddps   m1, m1, m4, m3, m2
 +cvtps2dq  m0, m0
 +cvtps2dq  m1, m1
 +packssdw  m0, m1
 +mova [dstq+lenq], m0
 +add lenq, mmsize
 +jl .loop
 +REP_RET
 +%endmacro

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


Re: [libav-devel] [PATCH 1/1] x86inc: remove wrong assert in X86_32 PROLOGUE macro

2012-12-16 Thread Janne Grunau
On 2012-12-14 17:12:05 -0800, Ronald S. Bultje wrote:
 Hi,
 
 On Fri, Dec 14, 2012 at 8:56 AM, Janne Grunau janne-li...@jannau.net wrote:
  On 2012-12-14 08:32:14 -0800, Ronald S. Bultje wrote:
  Hi,
 
  On Dec 14, 2012 3:30 AM, Janne Grunau janne-li...@jannau.net wrote:
  
   Arguments on the stack are handled properly and functions can use more
   than arguments than the 7 registers available on x86_32.
   Fixes nasm build, yasm would fail too if it would error out on %error
   instead of just emitting a warning.
   ---
libavutil/x86/x86inc.asm | 1 -
1 file changed, 1 deletion(-)
  
   diff --git a/libavutil/x86/x86inc.asm b/libavutil/x86/x86inc.asm
   index 60d05f4..40705e0 100644
   --- a/libavutil/x86/x86inc.asm
   +++ b/libavutil/x86/x86inc.asm
   @@ -554,7 +554,6 @@ DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
%endif
SETUP_STACK_POINTER %4
ASSERT regs_used = 7
   -ASSERT regs_used = num_args
PUSH_IF_USED 3, 4, 5, 6
ALLOC_STACK %4
LOAD_IF_USED 0, 1, 2, 3, 4, 5, 6
 
  Please submit to x264 first.
 
  Where does this trigger? This shouldn't happen, an assert is the right
  thing to do.
 
  It is? make fate passes on x86_32 instances and yasm is affected too
  except that it emits just a warning on %error.
 
  It triggers on h264_loop_filter_strength_mmxext in h264_deblock.asm
  with 9 arguments.
 
 But we have code above that clips both num_regs and regs_used to 7, so
 both should be 7?

if you mean num_args with num_regs then you removed the code to clamp it
to 7 in 6f40e9f070f7 'x86inc: support stack mem allocation and
re-alignment in PROLOGUE'. Re-adding that breaks several fate-h264
tests.

Nasm also fails on '%1 %+ SUFFIX' with empty SUFFIX in cpuid.asm. It was
previously working since it was always followed by ', %2'. Easiest
solution I've found was adding parameters to cpu_cpuid_test in
cpuid.asm.

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


Re: [libav-devel] [PATCH 2/4] lavr: x86: add SSE2 and FMA4 quantization for non-filtering dither methods

2012-12-16 Thread Justin Ruggles
Hi,

On 12/16/2012 06:27 AM, Loren Merritt wrote:
 On Sat, 15 Dec 2012, Justin Ruggles wrote:
 
 +;--
 +; void ff_quantize_int_rectangular/triangular(int16_t *dst, float *src,
 +; int *dither, int len);
 +;--
 +
 +%macro QUANTIZE_INT 1
 +cglobal quantize_int_%1, 4,5,6, dst, src, dither0, len, dither1
 +lea lenq, [2*lend]
 +add dstq, lenq
 +lea srcq, [srcq+2*lenq]
 +%ifidn %1, triangular
 +lea dither1q, [dither0q+4*lenq]
 +%endif
 +lea dither0q, [dither0q+2*lenq]
 +neg lenq
 +mova  m4, [pf_dither_scale]
 +mova  m5, [pf_s16_scale]
 +.loop:
 +cvtdq2ps  m0, [dither0q+2*lenq]
 +cvtdq2ps  m1, [dither0q+2*lenq+mmsize]
 
 Do you have to store dither in a format different than the asm works with?

That's the whole point of these functions. av_get_lfg() returns an
unsigned int, so instead of converting each value to float and scaling
individually, we can use SSE2 to do the conversion/scaling of multiple
values along with adding the noise to the samples.

For the triangular dither with high-pass it actually does convert/scale
the dither noise separately, filters it, then adds it into the samples.
But for the dither methods that don't require filtering, we can do it
all at once.

 +%ifidn %1, triangular
 +cvtdq2ps  m2, [dither1q+2*lenq]
 +cvtdq2ps  m3, [dither1q+2*lenq+mmsize]
 +addps m0, m2
 +addps m1, m3
 
 Can you add before converting, or does that overflow?

That overflows. The range on the dither noise is INT_MIN to INT_MAX.

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


[libav-devel] [PATCH] flac: only set channel layout if not previously set or on channel count change

2012-12-16 Thread Justin Ruggles
Fixes Bug 402
---
 libavcodec/flac_parser.c |5 -
 libavcodec/flacdec.c |3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index f0a37f3..eae0d8d 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -457,9 +457,12 @@ static int get_best_header(FLACParseContext* fpc, const 
uint8_t **poutbuf,
 check_header_mismatch(fpc, header, child, 0);
 }
 
+if (header-fi.channels != fpc-avctx-channels ||
+(!fpc-avctx-channel_layout  header-fi.channels = 6)) {
+ff_flac_set_channel_layout(fpc-avctx);
+}
 fpc-avctx-sample_rate = header-fi.samplerate;
 fpc-avctx-channels= header-fi.channels;
-ff_flac_set_channel_layout(fpc-avctx);
 fpc-pc-duration   = header-fi.blocksize;
 *poutbuf = flac_fifo_read_wrap(fpc, header-offset, *poutbuf_size,
 fpc-wrap_buf,
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index fd47929..51fd196 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -426,7 +426,8 @@ static int decode_frame(FLACContext *s)
 return ret;
 }
 s-channels = s-avctx-channels = fi.channels;
-ff_flac_set_channel_layout(s-avctx);
+if (!s-avctx-channel_layout  s-channels = 6)
+ff_flac_set_channel_layout(s-avctx);
 s-ch_mode = fi.ch_mode;
 
 if (!s-bps  !fi.bps) {
-- 
1.7.1

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


Re: [libav-devel] [PATCH] avresample: use valid log context in mixing functions

2012-12-16 Thread Justin Ruggles
On 12/16/2012 03:52 AM, Hendrik Leppkes wrote:
 ---
  libavresample/audio_mix.c | 10 +-
  1 file changed, 5 insertions(+), 5 deletions(-)
 
 diff --git a/libavresample/audio_mix.c b/libavresample/audio_mix.c
 index 62f8bd6..acddb31 100644
 --- a/libavresample/audio_mix.c
 +++ b/libavresample/audio_mix.c
 @@ -467,13 +467,13 @@ int ff_audio_mix_get_matrix(AudioMix *am, double 
 *matrix, int stride)

LGTM. will push later today.

Thanks,
Justin

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


[libav-devel] [PATCH] flac: only set channel layout if not previously set or on channel count change

2012-12-16 Thread Justin Ruggles
Fixes Bug 402
---
Forgot to set avctx-channels before calling ff_flac_set_channel_layout()
in the parser.

 libavcodec/flac_parser.c |6 +-
 libavcodec/flacdec.c |3 ++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index f0a37f3..003fb47 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -457,9 +457,13 @@ static int get_best_header(FLACParseContext* fpc, const 
uint8_t **poutbuf,
 check_header_mismatch(fpc, header, child, 0);
 }
 
+if (header-fi.channels != fpc-avctx-channels ||
+(!fpc-avctx-channel_layout  header-fi.channels = 6)) {
+fpc-avctx-channels = header-fi.channels;
+ff_flac_set_channel_layout(fpc-avctx);
+}
 fpc-avctx-sample_rate = header-fi.samplerate;
 fpc-avctx-channels= header-fi.channels;
-ff_flac_set_channel_layout(fpc-avctx);
 fpc-pc-duration   = header-fi.blocksize;
 *poutbuf = flac_fifo_read_wrap(fpc, header-offset, *poutbuf_size,
 fpc-wrap_buf,
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index fd47929..51fd196 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -426,7 +426,8 @@ static int decode_frame(FLACContext *s)
 return ret;
 }
 s-channels = s-avctx-channels = fi.channels;
-ff_flac_set_channel_layout(s-avctx);
+if (!s-avctx-channel_layout  s-channels = 6)
+ff_flac_set_channel_layout(s-avctx);
 s-ch_mode = fi.ch_mode;
 
 if (!s-bps  !fi.bps) {
-- 
1.7.1

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


Re: [libav-devel] [PATCH 2/4] lavr: x86: add SSE2 and FMA4 quantization for non-filtering dither methods

2012-12-16 Thread Loren Merritt
On Sun, 16 Dec 2012, Justin Ruggles wrote:
 On 12/16/2012 06:27 AM, Loren Merritt wrote:

 Do you have to store dither in a format different than the asm works with?

 That's the whole point of these functions. av_get_lfg() returns an
 unsigned int, so instead of converting each value to float and scaling
 individually, we can use SSE2 to do the conversion/scaling of multiple
 values along with adding the noise to the samples.

 For the triangular dither with high-pass it actually does convert/scale
 the dither noise separately, filters it, then adds it into the samples.
 But for the dither methods that don't require filtering, we can do it
 all at once.

Why is av_get_lfg in the inner loop? Is there an audible difference
between that and repeating a constant array?

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


Re: [libav-devel] [PATCH 2/4] lavr: x86: add SSE2 and FMA4 quantization for non-filtering dither methods

2012-12-16 Thread Justin Ruggles
On 12/16/2012 11:15 AM, Loren Merritt wrote:
 On Sun, 16 Dec 2012, Justin Ruggles wrote:
 On 12/16/2012 06:27 AM, Loren Merritt wrote:

 Do you have to store dither in a format different than the asm works with?

 That's the whole point of these functions. av_get_lfg() returns an
 unsigned int, so instead of converting each value to float and scaling
 individually, we can use SSE2 to do the conversion/scaling of multiple
 values along with adding the noise to the samples.

 For the triangular dither with high-pass it actually does convert/scale
 the dither noise separately, filters it, then adds it into the samples.
 But for the dither methods that don't require filtering, we can do it
 all at once.
 
 Why is av_get_lfg in the inner loop? Is there an audible difference
 between that and repeating a constant array?

Hmm, well that gets more complicated. The frame size is controlled by
the user and can change with each call. So it could work, but it would
have to either dynamically increase the size of the noise array or
process frames in pieces if they're too large.

I can certainly give it a try though.

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


Re: [libav-devel] [PATCH] flac: only set channel layout if not previously set or on channel count change

2012-12-16 Thread Tim W.
On Dec 16, 2012, at 5:13 PM, Justin Ruggles justin.rugg...@gmail.com wrote:

 @@ -457,9 +457,13 @@ static int get_best_header(FLACParseContext* fpc, const 
 uint8_t **poutbuf,
 check_header_mismatch(fpc, header, child, 0);
 }
 
 +if (header-fi.channels != fpc-avctx-channels ||
 +(!fpc-avctx-channel_layout  header-fi.channels = 6)) {
 +fpc-avctx-channels = header-fi.channels;
 +ff_flac_set_channel_layout(fpc-avctx);
 +}
 fpc-avctx-sample_rate = header-fi.samplerate;
 fpc-avctx-channels= header-fi.channels;



fpc-avctx-channels = header-fi.channels;

…is being called twice. The second line could be removed?

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


Re: [libav-devel] [PATCH] Add a VideoDSPContext with core video DSP functions.

2012-12-16 Thread Justin Ruggles
On 12/15/2012 12:46 PM, Ronald S. Bultje wrote:
 -
 -#define PREFETCH(name, op)  \
 -static void name(void *mem, int stride, int h)  \
 -{   \
 -const uint8_t *p = mem; \
 -do {\
 -__asm__ volatile (#op %0 :: m(*p)); \
 -p += stride;\
 -} while (--h);  \
 -}
 -
 -PREFETCH(prefetch_mmxext, prefetcht0)
 -PREFETCH(prefetch_3dnow, prefetch)
 -#undef PREFETCH
 -
[...]
 +%macro PREFETCH_FN 1
 +cglobal prefetch, 3, 3, 0, buf, stride, h
 +.loop:
 +%1  [bufq]
 +add  bufq, strideq
 +dechd
 +jg .loop
 +REP_RET
 +%endmacro
 +
 +INIT_MMX mmxext
 +PREFETCH_FN prefetcht0
 +%if ARCH_X86_32
 +INIT_MMX 3dnow
 +PREFETCH_FN prefetch
 +%endif

x86 prefetch() looks ok.

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


Re: [libav-devel] [PATCH] flac: only set channel layout if not previously set or on channel count change

2012-12-16 Thread Justin Ruggles
On 12/16/2012 11:50 AM, Tim W. wrote:
 On Dec 16, 2012, at 5:13 PM, Justin Ruggles justin.rugg...@gmail.com wrote:
 
 @@ -457,9 +457,13 @@ static int get_best_header(FLACParseContext* fpc, const 
 uint8_t **poutbuf,
 check_header_mismatch(fpc, header, child, 0);
 }

 +if (header-fi.channels != fpc-avctx-channels ||
 +(!fpc-avctx-channel_layout  header-fi.channels = 6)) {
 +fpc-avctx-channels = header-fi.channels;
 +ff_flac_set_channel_layout(fpc-avctx);
 +}
 fpc-avctx-sample_rate = header-fi.samplerate;
 fpc-avctx-channels= header-fi.channels;
 
 
 
 fpc-avctx-channels = header-fi.channels;
 
 …is being called twice. The second line could be removed?

yeah, it can be removed without changing behavior. fixed locally.

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


Re: [libav-devel] [PATCH 13/15] h264: break after error if enough NALs were seen in decode_nal_units

2012-12-16 Thread aviad rozenhek
does this patch also fix the issue where decode_slice_header error
message appear when probing a .ts file [or ts udp stream] which does not
start with an SPS/PPS ?


On Wed, Dec 12, 2012 at 10:30 PM, Janne Grunau janne-li...@jannau.netwrote:

 ---
  libavcodec/h264.c | 15 +++
  1 file changed, 7 insertions(+), 8 deletions(-)

 diff --git a/libavcodec/h264.c b/libavcodec/h264.c
 index 8847f1f..35cc800 100644
 --- a/libavcodec/h264.c
 +++ b/libavcodec/h264.c
 @@ -4070,17 +4070,16 @@ again:
 hx-nal_unit_type, bit_length);
  }

 -if (context_count == h-max_contexts) {
 -execute_decode_slices(h, context_count);
 +if (!err  context_count == h-max_contexts) {
 +err = execute_decode_slices(h, context_count);
  context_count = 0;
  }

 -if (err  0) {
 -av_log(h-s.avctx, AV_LOG_ERROR, decode_slice_header
 error\n);
 -if (h-context_reinitialized) {
 -buf_index = err;
 -goto end;
 -}
 +if (err  0  (h-setup_finished ||
 h-context_reinitialized)) {
 +av_log(h-s.avctx, AV_LOG_ERROR, failed to decode NAL
 %d\n,
 +   nal_index);
 +buf_index = err;
 +goto end;
  }
  else if (err == 1) {
  /* Slice could not be decoded in parallel mode, copy down
 --
 1.7.12.4

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




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


Re: [libav-devel] [PATCH 4/5] rtpdec: Pass the sequence number to depacketizers

2012-12-16 Thread Martin Storsjö

On Sun, 16 Dec 2012, Luca Barbato wrote:


On 12/12/12 4:05 PM, Martin Storsjö wrote:

+  const uint8_t *buf, int len, uint16_t s, int flags)


Ok, not sure if this s should be expanded to seq as well.


There's a separate (unrelated) variable named 'seq' within the function as 
well. It is only called from within ff_rdt_parse_packet anyway, where I 
just call it with seq==0. Perhaps I could name this one 'rtp_seq' or 
something instead.


I'll hold-off this one still until 5/5 which uses it gets reviewed, that 
one kinda requires someone who is familiar with the VP8 internals.


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


Re: [libav-devel] [PATCH 1/5] rtpenc_vp8: Include the picture number in VP8 packets

2012-12-16 Thread Martin Storsjö

On Sun, 16 Dec 2012, Luca Barbato wrote:


On 12/12/12 4:05 PM, Martin Storsjö wrote:

This makes it easier for receivers to decide what to do if data
is lost.

Refactor calculating the max payload size, to avoid hardcoding the
header size in too many places, reducing the number of lines that
have to be touched if the header is adjusted further.
---
  libavformat/rtpenc.h |2 ++
  libavformat/rtpenc_vp8.c |   17 +++--
  2 files changed, 13 insertions(+), 6 deletions(-)


Might be clearer have a variable for the header size, the rest looks fine.


Will push with this refactored to use a variable name.

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


Re: [libav-devel] [PATCH 5/5] rtpdec_vp8: Don't return known-broken packets

2012-12-16 Thread Martin Storsjö

On Wed, 12 Dec 2012, Martin Storsjö wrote:


This is built on the assumption that the first partition of each
VP8 packet is essential for decoding any later packet - if this
partition is broken/missed, the arithmetic coder gets out of sync
and decoding the bitstream in further packet ends up with total
garbage. If packets of a frame are lost, make sure the first
partition is intact (return only this part of the packet, nothing
else), otherwise stop returning data until the next keyframe is
received.


Got these basic assumptions validated by Ronald on irc, so the general 
idea of the patch shouldn't be too far off at least.


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


Re: [libav-devel] [PATCH 1/1] x86inc: remove wrong assert in X86_32 PROLOGUE macro

2012-12-16 Thread Ronald S. Bultje
Hi,

On Sun, Dec 16, 2012 at 5:52 AM, Janne Grunau janne-li...@jannau.net wrote:
 On 2012-12-14 17:12:05 -0800, Ronald S. Bultje wrote:
 Hi,

 On Fri, Dec 14, 2012 at 8:56 AM, Janne Grunau janne-li...@jannau.net wrote:
  On 2012-12-14 08:32:14 -0800, Ronald S. Bultje wrote:
  Hi,
 
  On Dec 14, 2012 3:30 AM, Janne Grunau janne-li...@jannau.net wrote:
  
   Arguments on the stack are handled properly and functions can use more
   than arguments than the 7 registers available on x86_32.
   Fixes nasm build, yasm would fail too if it would error out on %error
   instead of just emitting a warning.
   ---
libavutil/x86/x86inc.asm | 1 -
1 file changed, 1 deletion(-)
  
   diff --git a/libavutil/x86/x86inc.asm b/libavutil/x86/x86inc.asm
   index 60d05f4..40705e0 100644
   --- a/libavutil/x86/x86inc.asm
   +++ b/libavutil/x86/x86inc.asm
   @@ -554,7 +554,6 @@ DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
%endif
SETUP_STACK_POINTER %4
ASSERT regs_used = 7
   -ASSERT regs_used = num_args
PUSH_IF_USED 3, 4, 5, 6
ALLOC_STACK %4
LOAD_IF_USED 0, 1, 2, 3, 4, 5, 6
 
  Please submit to x264 first.
 
  Where does this trigger? This shouldn't happen, an assert is the right
  thing to do.
 
  It is? make fate passes on x86_32 instances and yasm is affected too
  except that it emits just a warning on %error.
 
  It triggers on h264_loop_filter_strength_mmxext in h264_deblock.asm
  with 9 arguments.

 But we have code above that clips both num_regs and regs_used to 7, so
 both should be 7?

 if you mean num_args with num_regs then you removed the code to clamp it
 to 7 in 6f40e9f070f7 'x86inc: support stack mem allocation and
 re-alignment in PROLOGUE'. Re-adding that breaks several fate-h264
 tests.

 Nasm also fails on '%1 %+ SUFFIX' with empty SUFFIX in cpuid.asm. It was
 previously working since it was always followed by ', %2'. Easiest
 solution I've found was adding parameters to cpu_cpuid_test in
 cpuid.asm.

Does it work if you add a comma behind it (but no arguments)? Or does
cglobal_internal then think %0 == 2?

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


[libav-devel] [PATCH] doxy: Clarify what avpriv_set_pts_info does

2012-12-16 Thread Derek Buitenhuis
The pts for a given stream was nonsensical.

Signed-off-by: Derek Buitenhuis derek.buitenh...@gmail.com
---
 libavformat/internal.h |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavformat/internal.h b/libavformat/internal.h
index ac4a5d0..57b293f 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -293,14 +293,15 @@ int64_t ff_gen_search(AVFormatContext *s, int 
stream_index,
   int64_t (*read_timestamp)(struct AVFormatContext *, int 
, int64_t *, int64_t ));
 
 /**
- * Set the pts for a given stream. If the new values would be invalid
- * (= 0), it leaves the AVStream unchanged.
+ * Set the time base for a given stream. If the new time base is invalid
+ * (numerator or denominator are, or are less than zero), it leaves the stream
+ * unchanged.
  *
  * @param s stream
  * @param pts_wrap_bits number of bits effectively used by the pts
  *(used for wrap control, 33 is the value for MPEG)
- * @param pts_num numerator to convert to seconds (MPEG: 1)
- * @param pts_den denominator to convert to seconds (MPEG: 9)
+ * @param pts_num time base numerator (MPEG: 1)
+ * @param pts_den time base denominator (MPEG: 9)
  */
 void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits,
  unsigned int pts_num, unsigned int pts_den);
-- 
1.7.10.4

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


Re: [libav-devel] [PATCH] doxy: Clarify what avpriv_set_pts_info does

2012-12-16 Thread Anton Khirnov

On Sun, 16 Dec 2012 15:40:07 -0500, Derek Buitenhuis 
derek.buitenh...@gmail.com wrote:
 The pts for a given stream was nonsensical.
 
 Signed-off-by: Derek Buitenhuis derek.buitenh...@gmail.com
 ---
  libavformat/internal.h |9 +
  1 file changed, 5 insertions(+), 4 deletions(-)
 
 diff --git a/libavformat/internal.h b/libavformat/internal.h
 index ac4a5d0..57b293f 100644
 --- a/libavformat/internal.h
 +++ b/libavformat/internal.h
 @@ -293,14 +293,15 @@ int64_t ff_gen_search(AVFormatContext *s, int 
 stream_index,
int64_t (*read_timestamp)(struct AVFormatContext *, 
 int , int64_t *, int64_t ));
  
  /**
 - * Set the pts for a given stream. If the new values would be invalid
 - * (= 0), it leaves the AVStream unchanged.
 + * Set the time base for a given stream. If the new time base is invalid
 + * (numerator or denominator are, or are less than zero), it leaves the 
 stream

This wording looks werid to me. I think the proper term here is
'nonpositive', or just leave = 0 as is.

Unrelated to the patch -- invalid values probably mean that the demuxer
messed up. I wonder if we should make it an assert instead.

 + * unchanged.
   *
   * @param s stream
   * @param pts_wrap_bits number of bits effectively used by the pts
   *(used for wrap control, 33 is the value for MPEG)
 - * @param pts_num numerator to convert to seconds (MPEG: 1)
 - * @param pts_den denominator to convert to seconds (MPEG: 9)
 + * @param pts_num time base numerator (MPEG: 1)
 + * @param pts_den time base denominator (MPEG: 9)

I'd drop the MPEG parts while you're at it.

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


Re: [libav-devel] [PATCH] doxy: Clarify what avpriv_set_pts_info does

2012-12-16 Thread Derek Buitenhuis
On 16/12/2012 3:55 PM, Anton Khirnov wrote:
 - * Set the pts for a given stream. If the new values would be invalid
 - * (= 0), it leaves the AVStream unchanged.
 + * Set the time base for a given stream. If the new time base is invalid
 + * (numerator or denominator are, or are less than zero), it leaves the 
 stream
 
 This wording looks werid to me. I think the proper term here is
 'nonpositive', or just leave = 0 as is.

You're not the only one to point that out. Will fix.

 Unrelated to the patch -- invalid values probably mean that the demuxer
 messed up. I wonder if we should make it an assert instead.

Demuxer doesn't have to mess up. It can be read directly from the file,
and passed into this function. It makes more sense to check here than to
scatter time base checks all over various demuxers.

 
 + * unchanged.
   *
   * @param s stream
   * @param pts_wrap_bits number of bits effectively used by the pts
   *(used for wrap control, 33 is the value for MPEG)
 - * @param pts_num numerator to convert to seconds (MPEG: 1)
 - * @param pts_den denominator to convert to seconds (MPEG: 9)
 + * @param pts_num time base numerator (MPEG: 1)
 + * @param pts_den time base denominator (MPEG: 9)
 
 I'd drop the MPEG parts while you're at it.

+1

Will re-send in a bit,

- Derek

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


[libav-devel] [PATCH 0/3] lavr: dithering (ver 6)

2012-12-16 Thread Justin Ruggles
This patch set now pre-generates at least 1/2 sec of dither noise
and recycles it instead of generating new noise for each frame.
Now all dither methods except noise shaping can use the same
optimized quantization function.

Thanks,
Justin

Justin Ruggles (3):
  lavr: add option for dithering during sample format conversion to s16
  lavr: x86: add SSE2 quantize() for dithering
  lavr: x86: add SSE2/AVX dither_int_to_float()

 libavresample/Makefile  |1 +
 libavresample/audio_convert.c   |   33 +++-
 libavresample/audio_convert.h   |   22 ++-
 libavresample/avresample.h  |9 +
 libavresample/dither.c  |  431 +++
 libavresample/dither.h  |   93 +
 libavresample/internal.h|1 +
 libavresample/options.c |6 +
 libavresample/utils.c   |   10 +-
 libavresample/version.h |2 +-
 libavresample/x86/Makefile  |2 +
 libavresample/x86/dither.asm|  117 +++
 libavresample/x86/dither_init.c |   61 ++
 13 files changed, 776 insertions(+), 12 deletions(-)
 create mode 100644 libavresample/dither.c
 create mode 100644 libavresample/dither.h
 create mode 100644 libavresample/x86/dither.asm
 create mode 100644 libavresample/x86/dither_init.c

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


[libav-devel] [PATCH 2/3] lavr: x86: add SSE2 quantize() for dithering

2012-12-16 Thread Justin Ruggles
---
 libavresample/dither.c  |3 ++
 libavresample/dither.h  |5 +++
 libavresample/x86/Makefile  |2 +
 libavresample/x86/dither.asm|   53 +++
 libavresample/x86/dither_init.c |   39 
 5 files changed, 102 insertions(+), 0 deletions(-)
 create mode 100644 libavresample/x86/dither.asm
 create mode 100644 libavresample/x86/dither_init.c

diff --git a/libavresample/dither.c b/libavresample/dither.c
index 32dfdca..8015bcc 100644
--- a/libavresample/dither.c
+++ b/libavresample/dither.c
@@ -329,6 +329,9 @@ static void dither_init(DitherDSPContext *ddsp,
 ddsp-dither_int_to_float = dither_int_to_float_rectangular_c;
 else
 ddsp-dither_int_to_float = dither_int_to_float_triangular_c;
+
+if (ARCH_X86)
+ff_dither_init_x86(ddsp, method);
 }
 
 DitherContext *ff_dither_alloc(AVAudioResampleContext *avr,
diff --git a/libavresample/dither.h b/libavresample/dither.h
index 8b30dd2..2f653c0 100644
--- a/libavresample/dither.h
+++ b/libavresample/dither.h
@@ -85,4 +85,9 @@ void ff_dither_free(DitherContext **c);
  */
 int ff_convert_dither(DitherContext *c, AudioData *dst, AudioData *src);
 
+/* arch-specific initialization functions */
+
+void ff_dither_init_x86(DitherDSPContext *ddsp,
+enum AVResampleDitherMethod method);
+
 #endif /* AVRESAMPLE_DITHER_H */
diff --git a/libavresample/x86/Makefile b/libavresample/x86/Makefile
index 65bed89..2e8786f 100644
--- a/libavresample/x86/Makefile
+++ b/libavresample/x86/Makefile
@@ -1,5 +1,7 @@
 OBJS  += x86/audio_convert_init.o   \
  x86/audio_mix_init.o   \
+ x86/dither_init.o  \
 
 YASM-OBJS += x86/audio_convert.o\
  x86/audio_mix.o\
+ x86/dither.o   \
diff --git a/libavresample/x86/dither.asm b/libavresample/x86/dither.asm
new file mode 100644
index 000..34e7924
--- /dev/null
+++ b/libavresample/x86/dither.asm
@@ -0,0 +1,53 @@
+;**
+;* x86 optimized dithering format conversion
+;* Copyright (c) 2012 Justin Ruggles justin.rugg...@gmail.com
+;*
+;* 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/x86/x86util.asm
+
+SECTION_RODATA 32
+
+pf_s16_scale: times 4 dd 32753.0
+
+SECTION_TEXT
+
+;--
+; void ff_quantize(int16_t *dst, float *src, float *dither, int len);
+;--
+
+INIT_XMM sse2
+cglobal quantize, 4,4,3, dst, src, dither, len
+lea lenq, [2*lend]
+add dstq, lenq
+lea srcq, [srcq+2*lenq]
+lea  ditherq, [ditherq+2*lenq]
+neg lenq
+mova  m2, [pf_s16_scale]
+.loop:
+mulps m0, m2, [srcq+2*lenq]
+mulps m1, m2, [srcq+2*lenq+mmsize]
+addps m0, [ditherq+2*lenq]
+addps m1, [ditherq+2*lenq+mmsize]
+cvtps2dq  m0, m0
+cvtps2dq  m1, m1
+packssdw  m0, m1
+mova [dstq+lenq], m0
+add lenq, mmsize
+jl .loop
+REP_RET
diff --git a/libavresample/x86/dither_init.c b/libavresample/x86/dither_init.c
new file mode 100644
index 000..1e20c11
--- /dev/null
+++ b/libavresample/x86/dither_init.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles justin.rugg...@gmail.com
+ *
+ * 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
+ * 

[libav-devel] [PATCH 1/3] lavr: add option for dithering during sample format conversion to s16

2012-12-16 Thread Justin Ruggles
---
 libavresample/Makefile|1 +
 libavresample/audio_convert.c |   33 +++-
 libavresample/audio_convert.h |   22 ++-
 libavresample/avresample.h|9 +
 libavresample/dither.c|  428 +
 libavresample/dither.h|   88 +
 libavresample/internal.h  |1 +
 libavresample/options.c   |6 +
 libavresample/utils.c |   10 +-
 libavresample/version.h   |2 +-
 10 files changed, 588 insertions(+), 12 deletions(-)
 create mode 100644 libavresample/dither.c
 create mode 100644 libavresample/dither.h

diff --git a/libavresample/Makefile b/libavresample/Makefile
index c0c20a9..6805280 100644
--- a/libavresample/Makefile
+++ b/libavresample/Makefile
@@ -8,6 +8,7 @@ OBJS = audio_convert.o  
\
audio_data.o \
audio_mix.o  \
audio_mix_matrix.o   \
+   dither.o \
options.o\
resample.o   \
utils.o  \
diff --git a/libavresample/audio_convert.c b/libavresample/audio_convert.c
index dcf8a39..eb3bc1f 100644
--- a/libavresample/audio_convert.c
+++ b/libavresample/audio_convert.c
@@ -29,6 +29,8 @@
 #include libavutil/samplefmt.h
 #include audio_convert.h
 #include audio_data.h
+#include dither.h
+#include internal.h
 
 enum ConvFuncType {
 CONV_FUNC_TYPE_FLAT,
@@ -46,6 +48,7 @@ typedef void (conv_func_deinterleave)(uint8_t **out, const 
uint8_t *in, int len,
 
 struct AudioConvert {
 AVAudioResampleContext *avr;
+DitherContext *dc;
 enum AVSampleFormat in_fmt;
 enum AVSampleFormat out_fmt;
 int channels;
@@ -246,10 +249,18 @@ static void set_generic_function(AudioConvert *ac)
 SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL)
 }
 
+void ff_audio_convert_free(AudioConvert **ac)
+{
+if (!*ac)
+return;
+ff_dither_free((*ac)-dc);
+av_freep(ac);
+}
+
 AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr,
  enum AVSampleFormat out_fmt,
  enum AVSampleFormat in_fmt,
- int channels)
+ int channels, int sample_rate)
 {
 AudioConvert *ac;
 int in_planar, out_planar;
@@ -263,6 +274,17 @@ AudioConvert 
*ff_audio_convert_alloc(AVAudioResampleContext *avr,
 ac-in_fmt   = in_fmt;
 ac-channels = channels;
 
+if (avr-dither_method != AV_RESAMPLE_DITHER_NONE  
+av_get_packed_sample_fmt(out_fmt) == AV_SAMPLE_FMT_S16 
+av_get_bytes_per_sample(in_fmt)  2) {
+ac-dc = ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate);
+if (!ac-dc) {
+av_free(ac);
+return NULL;
+}
+return ac;
+}
+
 in_planar  = av_sample_fmt_is_planar(in_fmt);
 out_planar = av_sample_fmt_is_planar(out_fmt);
 
@@ -289,6 +311,15 @@ int ff_audio_convert(AudioConvert *ac, AudioData *out, 
AudioData *in)
 int use_generic = 1;
 int len = in-nb_samples;
 
+if (ac-dc) {
+/* dithered conversion */
+av_dlog(ac-avr, %d samples - audio_convert: %s to %s (dithered)\n,
+len, av_get_sample_fmt_name(ac-in_fmt),
+av_get_sample_fmt_name(ac-out_fmt));
+
+return ff_convert_dither(ac-dc, out, in);
+}
+
 /* determine whether to use the optimized function based on pointer and
samples alignment in both the input and output */
 if (ac-has_optimized_func) {
diff --git a/libavresample/audio_convert.h b/libavresample/audio_convert.h
index bc27223..b8808f1 100644
--- a/libavresample/audio_convert.h
+++ b/libavresample/audio_convert.h
@@ -54,16 +54,26 @@ void ff_audio_convert_set_func(AudioConvert *ac, enum 
AVSampleFormat out_fmt,
 /**
  * Allocate and initialize AudioConvert context for sample format conversion.
  *
- * @param avr  AVAudioResampleContext
- * @param out_fmt  output sample format
- * @param in_fmt   input sample format
- * @param channels number of channels
- * @return newly-allocated AudioConvert context
+ * @param avr AVAudioResampleContext
+ * @param out_fmt output sample format
+ * @param in_fmt  input sample format
+ * @param channelsnumber of channels
+ * @param sample_rate sample rate (used for dithering)
+ * @returnnewly-allocated AudioConvert context
  */
 AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr,
  enum AVSampleFormat out_fmt,
  enum AVSampleFormat in_fmt,
-

[libav-devel] [PATCH 3/3] lavr: x86: add SSE2/AVX dither_int_to_float()

2012-12-16 Thread Justin Ruggles
---
 libavresample/x86/dither.asm|   64 +++
 libavresample/x86/dither_init.c |   22 +
 2 files changed, 86 insertions(+), 0 deletions(-)

diff --git a/libavresample/x86/dither.asm b/libavresample/x86/dither.asm
index 34e7924..2192e98 100644
--- a/libavresample/x86/dither.asm
+++ b/libavresample/x86/dither.asm
@@ -23,6 +23,9 @@
 
 SECTION_RODATA 32
 
+; 1.0f / (2.0f * INT32_MAX)
+pf_dither_scale: times 8 dd 2.32830643762e-10
+
 pf_s16_scale: times 4 dd 32753.0
 
 SECTION_TEXT
@@ -51,3 +54,64 @@ cglobal quantize, 4,4,3, dst, src, dither, len
 add lenq, mmsize
 jl .loop
 REP_RET
+
+;--
+; void ff_dither_int_to_float_rectangular(float *dst, int *src, int len)
+;--
+
+%macro DITHER_INT_TO_FLOAT_RECTANGULAR 0
+cglobal dither_int_to_float_rectangular, 3,3,3, dst, src, len
+lea lenq, [4*lend]
+add srcq, lenq
+add dstq, lenq
+neg lenq
+mova  m0, [pf_dither_scale]
+.loop:
+cvtdq2ps  m1, [srcq+lenq]
+cvtdq2ps  m2, [srcq+lenq+mmsize]
+mulps m1, m1, m0
+mulps m2, m2, m0
+mova  [dstq+lenq], m1
+mova  [dstq+lenq+mmsize], m2
+add lenq, 2*mmsize
+jl .loop
+REP_RET
+%endmacro
+
+INIT_XMM sse2
+DITHER_INT_TO_FLOAT_RECTANGULAR
+INIT_YMM avx
+DITHER_INT_TO_FLOAT_RECTANGULAR
+
+;--
+; void ff_dither_int_to_float_triangular(float *dst, int *src0, int len)
+;--
+
+%macro DITHER_INT_TO_FLOAT_TRIANGULAR 0
+cglobal dither_int_to_float_triangular, 3,4,5, dst, src0, len, src1
+lea lenq, [4*lend]
+leasrc1q, [src0q+2*lenq]
+addsrc0q, lenq
+add dstq, lenq
+neg lenq
+mova  m0, [pf_dither_scale]
+.loop:
+cvtdq2ps  m1, [src0q+lenq]
+cvtdq2ps  m2, [src0q+lenq+mmsize]
+cvtdq2ps  m3, [src1q+lenq]
+cvtdq2ps  m4, [src1q+lenq+mmsize]
+addps m1, m1, m3
+addps m2, m2, m4
+mulps m1, m1, m0
+mulps m2, m2, m0
+mova  [dstq+lenq], m1
+mova  [dstq+lenq+mmsize], m2
+add lenq, 2*mmsize
+jl .loop
+REP_RET
+%endmacro
+
+INIT_XMM sse2
+DITHER_INT_TO_FLOAT_TRIANGULAR
+INIT_YMM avx
+DITHER_INT_TO_FLOAT_TRIANGULAR
diff --git a/libavresample/x86/dither_init.c b/libavresample/x86/dither_init.c
index 1e20c11..de38398 100644
--- a/libavresample/x86/dither_init.c
+++ b/libavresample/x86/dither_init.c
@@ -26,6 +26,12 @@
 extern void ff_quantize_sse2(int16_t *dst, const float *src, float *dither,
  int len);
 
+extern void ff_dither_int_to_float_rectangular_sse2(float *dst, int *src, int 
len);
+extern void ff_dither_int_to_float_rectangular_avx(float *dst, int *src, int 
len);
+
+extern void ff_dither_int_to_float_triangular_sse2(float *dst, int *src0, int 
len);
+extern void ff_dither_int_to_float_triangular_avx(float *dst, int *src0, int 
len);
+
 av_cold void ff_dither_init_x86(DitherDSPContext *ddsp,
 enum AVResampleDitherMethod method)
 {
@@ -36,4 +42,20 @@ av_cold void ff_dither_init_x86(DitherDSPContext *ddsp,
 ddsp-ptr_align = 16;
 ddsp-samples_align = 8;
 }
+
+if (method == AV_RESAMPLE_DITHER_RECTANGULAR) {
+if (EXTERNAL_SSE2(mm_flags)) {
+ddsp-dither_int_to_float = 
ff_dither_int_to_float_rectangular_sse2;
+}
+if (EXTERNAL_AVX(mm_flags)) {
+ddsp-dither_int_to_float = ff_dither_int_to_float_rectangular_avx;
+}
+} else {
+if (EXTERNAL_SSE2(mm_flags)) {
+ddsp-dither_int_to_float = ff_dither_int_to_float_triangular_sse2;
+}
+if (EXTERNAL_AVX(mm_flags)) {
+ddsp-dither_int_to_float = ff_dither_int_to_float_triangular_avx;
+}
+}
 }
-- 
1.7.1

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


Re: [libav-devel] [PATCH 1/1] x86inc: remove wrong assert in X86_32 PROLOGUE macro

2012-12-16 Thread Janne Grunau
On 2012-12-16 12:36:56 -0800, Ronald S. Bultje wrote:
 
 On Sun, Dec 16, 2012 at 5:52 AM, Janne Grunau janne-li...@jannau.net wrote:
 
  Nasm also fails on '%1 %+ SUFFIX' with empty SUFFIX in cpuid.asm. It was
  previously working since it was always followed by ', %2'. Easiest
  solution I've found was adding parameters to cpu_cpuid_test in
  cpuid.asm.
 
 Does it work if you add a comma behind it (but no arguments)? Or does
 cglobal_internal then think %0 == 2?

It already failes earlier with:
libavutil/x86/cpuid.asm:70: error: (cglobal_internal:1) `%ifndef'
expects macro identifiers

presumeably failing on cglobaled_cpu_cpuid_test,

Adding a unused parameter to both cglobal_internal calls works ugly
as it is.

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


Re: [libav-devel] FATE dependencies

2012-12-16 Thread Diego Biurrun
On Fri, Oct 19, 2012 at 07:26:02PM +0200, Diego Biurrun wrote:
 [...]

I'm mostly done with FATE dependencies and have some 50 patches in
need of cleaning locally.

There are a bunch of parts required by most or a large number of FATE
tests.  I'm not quite sure how to handle them, here's a list

rawvideo:

decoder
demuxer
encoder

filters:

afifo
anull
fifo
null
resample

muxers:

crc
framecrc
framemd5
md5
rawvideo

protocols:

file
md5
pipe

Plus PCM_S16LE muxer and decoder, which is required by a large number of
audio tests.

There are multiple ways to handle these more general components:

- have avconv directly depend on some or all of them
- just add all these components to individual deps
- have a group of FATE deps that get enabled automatically
- have a group of FATE deps that get enabled via a configure switch
- ...

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


Re: [libav-devel] [PATCH 1/1] x86inc: remove wrong assert in X86_32 PROLOGUE macro

2012-12-16 Thread Ronald S. Bultje
Hi,

On Sun, Dec 16, 2012 at 1:49 PM, Janne Grunau janne-li...@jannau.net wrote:
 On 2012-12-16 12:36:56 -0800, Ronald S. Bultje wrote:

 On Sun, Dec 16, 2012 at 5:52 AM, Janne Grunau janne-li...@jannau.net wrote:
 
  Nasm also fails on '%1 %+ SUFFIX' with empty SUFFIX in cpuid.asm. It was
  previously working since it was always followed by ', %2'. Easiest
  solution I've found was adding parameters to cpu_cpuid_test in
  cpuid.asm.

 Does it work if you add a comma behind it (but no arguments)? Or does
 cglobal_internal then think %0 == 2?

 It already failes earlier with:
 libavutil/x86/cpuid.asm:70: error: (cglobal_internal:1) `%ifndef'
 expects macro identifiers

 presumeably failing on cglobaled_cpu_cpuid_test,

 Adding a unused parameter to both cglobal_internal calls works ugly
 as it is.

The old one used this:

diff --git a/libavutil/x86/x86inc.asm b/libavutil/x86/x86inc.asm
index 483ae7b..564ba50 100644
--- a/libavutil/x86/x86inc.asm
+++ b/libavutil/x86/x86inc.asm
@@ -614,12 +614,8 @@ DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
 ; Applies any symbol mangling needed for C linkage, and sets up a define such t
 ; subsequent uses of the function name automatically refer to the mangled versi
 ; Appends cpuflags to the function name if cpuflags has been specified.
-%macro cglobal 1-2+ ; name, [PROLOGUE args]
-%if %0 == 1
-cglobal_internal %1 %+ SUFFIX
-%else
+%macro cglobal 1-2+  ; name, [PROLOGUE args]
 cglobal_internal %1 %+ SUFFIX, %2
-%endif
 %endmacro
 %macro cglobal_internal 1-2+
 %ifndef cglobaled_%1
@@ -640,7 +636,7 @@ DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
 %assign stack_offset 0
 %assign stack_size 0
 %assign stack_size_padded 0
-%if %0  1
+%ifnidn %2, 
 PROLOGUE %2
 %endif
 %endmacro

Does that work?

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


Re: [libav-devel] [PATCH] Add a VideoDSPContext with core video DSP functions.

2012-12-16 Thread Ronald S. Bultje
Hi,

On Sun, Dec 16, 2012 at 9:33 AM, Luca Barbato lu_z...@gentoo.org wrote:
 +void ff_videodsp_init_x86(VideoDSPContext *ctx, int bpc)
[..]
 +{
 +#if HAVE_YASM
 +int mm_flags = av_get_cpu_flags();
 +
 +#if ARCH_X86_32
 +if (bpc = 8  mm_flags  AV_CPU_FLAG_MMX) {
 +c-emulated_edge_mc = emulated_edge_mc_mmx;

s/c/ctx/.

 +}
 +if (mm_flags  AV_CPU_FLAG_AMD3DNOW) {

AV_CPU_FLAG_3DNOW.

Then it compiles on x86-32 also. I haven't tested on ppc or arm.

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


[libav-devel] [PATCH v2] doxy: Clarify what avpriv_set_pts_info does

2012-12-16 Thread Derek Buitenhuis
The pts for a given stream was nonsensical.

Signed-off-by: Derek Buitenhuis derek.buitenh...@gmail.com
---
 libavformat/internal.h |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavformat/internal.h b/libavformat/internal.h
index ac4a5d0..1859d32 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -293,14 +293,16 @@ int64_t ff_gen_search(AVFormatContext *s, int 
stream_index,
   int64_t (*read_timestamp)(struct AVFormatContext *, int 
, int64_t *, int64_t ));
 
 /**
- * Set the pts for a given stream. If the new values would be invalid
- * (= 0), it leaves the AVStream unchanged.
+ * Set the time base and wrapping info for a given stream. This will be used
+ * to interpret the stream's timestamps. If the new time base is invalid
+ * (numerator or denominator are non-positive), it leaves the stream
+ * unchanged.
  *
  * @param s stream
  * @param pts_wrap_bits number of bits effectively used by the pts
- *(used for wrap control, 33 is the value for MPEG)
- * @param pts_num numerator to convert to seconds (MPEG: 1)
- * @param pts_den denominator to convert to seconds (MPEG: 9)
+ *(used for wrap control)
+ * @param pts_num time base numeratort
+ * @param pts_den time base denominator
  */
 void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits,
  unsigned int pts_num, unsigned int pts_den);
-- 
1.7.10.4

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


Re: [libav-devel] [PATCH v2] doxy: Clarify what avpriv_set_pts_info does

2012-12-16 Thread Derek Buitenhuis
On 16/12/2012 5:54 PM, Derek Buitenhuis wrote:
 + * @param pts_num time base numeratort

Fixed locally, before anyone says anything.

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


Re: [libav-devel] FATE dependencies

2012-12-16 Thread Janne Grunau
On 2012-12-16 23:45:06 +0100, Diego Biurrun wrote:
 On Fri, Oct 19, 2012 at 07:26:02PM +0200, Diego Biurrun wrote:
  [...]
 
 I'm mostly done with FATE dependencies and have some 50 patches in
 need of cleaning locally.
 
 There are a bunch of parts required by most or a large number of FATE
 tests.  I'm not quite sure how to handle them, here's a list
 
 rawvideo:
 
 decoder, demuxer, encoder
 
 filters:
 
 afifo, anull, fifo, null, resample

not format? we have quite a few video sample tests which require it,
tests of rgb codecs for example. Ah, I see, avconv depends already on it
inconfigure. afifo, anull, fifo, null might be candidates to always
enable in libavfilter.

 muxers:
 
 crc, framecrc, framemd5, md5, rawvideo
 
 protocols:
 
 file, md5, pipe
 
 Plus PCM_S16LE muxer and decoder, which is required by a large number of
 audio tests.
 
 There are multiple ways to handle these more general components:
 
 - have avconv directly depend on some or all of them

In configure or just for FATE_AVCONV? The second sounds reasonable

 - just add all these components to individual deps

that sounds insane

 - have a group of FATE deps that get enabled automatically

what does that mean? making it impossible to disable the file protocol
for example?

 - have a group of FATE deps that get enabled via a configure switch

That is a good idea regardlessly. using something like

.../configure --disable-everything --enable-decoder=h264 \
--enable-demuxer=h264 --enable-fate-minimal

and being able to run make fate-h264 would be nice. Having a good test
coverage for a --disable-random is probably also a good idea.

 - ...

Then there are obvious groups of tests which share dependency then just
adding the dependency for that group.

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


Re: [libav-devel] [PATCH v2] doxy: Clarify what avpriv_set_pts_info does

2012-12-16 Thread Anton Khirnov

On Sun, 16 Dec 2012 17:54:36 -0500, Derek Buitenhuis 
derek.buitenh...@gmail.com wrote:
 The pts for a given stream was nonsensical.
 
 Signed-off-by: Derek Buitenhuis derek.buitenh...@gmail.com
 ---
  libavformat/internal.h |   12 +++-
  1 file changed, 7 insertions(+), 5 deletions(-)
 
 diff --git a/libavformat/internal.h b/libavformat/internal.h
 index ac4a5d0..1859d32 100644
 --- a/libavformat/internal.h
 +++ b/libavformat/internal.h
 @@ -293,14 +293,16 @@ int64_t ff_gen_search(AVFormatContext *s, int 
 stream_index,
int64_t (*read_timestamp)(struct AVFormatContext *, 
 int , int64_t *, int64_t ));
  
  /**
 - * Set the pts for a given stream. If the new values would be invalid
 - * (= 0), it leaves the AVStream unchanged.
 + * Set the time base and wrapping info for a given stream. This will be used
 + * to interpret the stream's timestamps. If the new time base is invalid
 + * (numerator or denominator are non-positive), it leaves the stream
 + * unchanged.
   *
   * @param s stream
   * @param pts_wrap_bits number of bits effectively used by the pts
 - *(used for wrap control, 33 is the value for MPEG)
 - * @param pts_num numerator to convert to seconds (MPEG: 1)
 - * @param pts_den denominator to convert to seconds (MPEG: 9)
 + *(used for wrap control)
 + * @param pts_num time base numeratort
 + * @param pts_den time base denominator
   */
  void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits,
   unsigned int pts_num, unsigned int pts_den);
 -- 
 1.7.10.4
 

Ok.

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