From kierank at ob-encoder.com Tue May 1 01:13:56 2012 From: kierank at ob-encoder.com (Kieran Kunhya) Date: Tue, 1 May 2012 00:13:56 +0100 Subject: [libav-devel] [PATCH] Fix compilation with YASM/NASM without AVX support. In-Reply-To: References: <1335818250-28473-1-git-send-email-justin.ruggles@gmail.com> Message-ID: Is this necessary around all AVX float code? From rsbultje at gmail.com Tue May 1 02:21:41 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Mon, 30 Apr 2012 17:21:41 -0700 Subject: [libav-devel] [PATCH] Fix compilation with YASM/NASM without AVX support. In-Reply-To: References: <1335818250-28473-1-git-send-email-justin.ruggles@gmail.com> Message-ID: Hi, On Mon, Apr 30, 2012 at 4:13 PM, Kieran Kunhya wrote: > Is this necessary around all AVX float code? Some older versions of nasm don't support AVX, so in order to support that, yes. Ronald From rsbultje at gmail.com Tue May 1 18:32:44 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Tue, 1 May 2012 09:32:44 -0700 Subject: [libav-devel] [PATCH] snowdsp: explicitely state instruction size. Message-ID: <1335889964-92669-1-git-send-email-rsbultje@gmail.com> From: "Ronald S. Bultje" Fixes a compile error with clang at -O0. --- libavcodec/x86/snowdsp_mmx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/x86/snowdsp_mmx.c b/libavcodec/x86/snowdsp_mmx.c index 3e6bc99..00b6261 100644 --- a/libavcodec/x86/snowdsp_mmx.c +++ b/libavcodec/x86/snowdsp_mmx.c @@ -675,14 +675,14 @@ static void ff_snow_vertical_compose97i_mmx(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM #define snow_inner_add_yblock_sse2_end_8\ "sal $1, %%"REG_c" \n\t"\ - "add $"PTR_SIZE"*2, %1 \n\t"\ + "addl $"PTR_SIZE"*2, %1 \n\t"\ snow_inner_add_yblock_sse2_end_common1\ "sar $1, %%"REG_c" \n\t"\ "sub $2, %2 \n\t"\ snow_inner_add_yblock_sse2_end_common2 #define snow_inner_add_yblock_sse2_end_16\ - "add $"PTR_SIZE"*1, %1 \n\t"\ + "addl $"PTR_SIZE"*1, %1 \n\t"\ snow_inner_add_yblock_sse2_end_common1\ "dec %2 \n\t"\ snow_inner_add_yblock_sse2_end_common2 -- 1.7.9.2 From rsbultje at gmail.com Tue May 1 18:33:10 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Tue, 1 May 2012 09:33:10 -0700 Subject: [libav-devel] [PATCH] configure: remove malloc_aligned. In-Reply-To: <1335721237-25739-1-git-send-email-rsbultje@gmail.com> References: <1335721237-25739-1-git-send-email-rsbultje@gmail.com> Message-ID: Hi, On Sun, Apr 29, 2012 at 10:40 AM, Ronald S. Bultje wrote: > From: "Ronald S. Bultje" > > It was to signal that allocations are 16-byte aligned, but AVX requires > 32-byte alignment, thus the check is no longer useful (and causes > crashes). > --- > ?configure | ? ?7 +------ > ?1 file changed, 1 insertion(+), 6 deletions(-) Mans wanted to look at this - ping? Ronald From mans at mansr.com Tue May 1 18:40:34 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Tue, 01 May 2012 17:40:34 +0100 Subject: [libav-devel] [PATCH] configure: remove malloc_aligned. In-Reply-To: <1335721237-25739-1-git-send-email-rsbultje@gmail.com> (Ronald S. Bultje's message of "Sun, 29 Apr 2012 10:40:37 -0700") References: <1335721237-25739-1-git-send-email-rsbultje@gmail.com> Message-ID: "Ronald S. Bultje" writes: > From: "Ronald S. Bultje" > > It was to signal that allocations are 16-byte aligned, but AVX requires > 32-byte alignment, thus the check is no longer useful (and causes > crashes). > --- > configure | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/configure b/configure > index bc12f33..c8bb63f 100755 > --- a/configure > +++ b/configure > @@ -2465,7 +2465,6 @@ case $target_os in > oss_outdev_extralibs="-lossaudio" > ;; > openbsd) > - enable malloc_aligned > # On OpenBSD 4.5. the compiler does not use PIC unless > # explicitly using -fPIC. Libav builds fine without PIC, > # however the generated executable will not do anything > @@ -2478,17 +2477,14 @@ case $target_os in > oss_outdev_extralibs="-lossaudio" > ;; > dragonfly) > - enable malloc_aligned > disable symver > ;; > freebsd) > - enable malloc_aligned > ;; > bsd/os) > add_extralibs -lpoll -lgnugetopt > ;; > darwin) > - enable malloc_aligned > gas="gas-preprocessor.pl $cc" > enabled ppc && add_asflags -force_cpusubtype_ALL > SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)' > @@ -2511,7 +2507,6 @@ case $target_os in > fi > LIBTARGET=i386 > if enabled x86_64; then > - enable malloc_aligned > LIBTARGET="i386:x86-64" > elif enabled arm; then > LIBTARGET=arm-wince > @@ -3191,7 +3186,7 @@ check_deps $CONFIG_LIST \ > > enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; } > > -! enabled_any memalign posix_memalign malloc_aligned && > +! enabled_any memalign posix_memalign && > enabled_any $need_memalign && enable memalign_hack > > echo "install prefix $prefix" > -- Which of those systems lack both memalign() and posix_memalign()? Do any of these support AVX at all? -- M?ns Rullg?rd mans at mansr.com From rsbultje at gmail.com Tue May 1 18:43:33 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Tue, 1 May 2012 09:43:33 -0700 Subject: [libav-devel] [PATCH] configure: remove malloc_aligned. In-Reply-To: References: <1335721237-25739-1-git-send-email-rsbultje@gmail.com> Message-ID: Hi, On Tue, May 1, 2012 at 9:40 AM, M?ns Rullg?rd wrote: > "Ronald S. Bultje" writes: > >> From: "Ronald S. Bultje" >> >> It was to signal that allocations are 16-byte aligned, but AVX requires >> 32-byte alignment, thus the check is no longer useful (and causes >> crashes). >> --- >> ?configure | ? ?7 +------ >> ?1 file changed, 1 insertion(+), 6 deletions(-) >> >> diff --git a/configure b/configure >> index bc12f33..c8bb63f 100755 >> --- a/configure >> +++ b/configure >> @@ -2465,7 +2465,6 @@ case $target_os in >> ? ? ? ? ?oss_outdev_extralibs="-lossaudio" >> ? ? ? ? ?;; >> ? ? ?openbsd) >> - ? ? ? ?enable malloc_aligned >> ? ? ? ? ?# On OpenBSD 4.5. the compiler does not use PIC unless >> ? ? ? ? ?# explicitly using -fPIC. Libav builds fine without PIC, >> ? ? ? ? ?# however the generated executable will not do anything >> @@ -2478,17 +2477,14 @@ case $target_os in >> ? ? ? ? ?oss_outdev_extralibs="-lossaudio" >> ? ? ? ? ?;; >> ? ? ?dragonfly) >> - ? ? ? ?enable malloc_aligned >> ? ? ? ? ?disable symver >> ? ? ? ? ?;; >> ? ? ?freebsd) >> - ? ? ? ?enable malloc_aligned >> ? ? ? ? ?;; >> ? ? ?bsd/os) >> ? ? ? ? ?add_extralibs -lpoll -lgnugetopt >> ? ? ? ? ?;; >> ? ? ?darwin) >> - ? ? ? ?enable malloc_aligned >> ? ? ? ? ?gas="gas-preprocessor.pl $cc" >> ? ? ? ? ?enabled ppc && add_asflags -force_cpusubtype_ALL >> ? ? ? ? ?SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)' >> @@ -2511,7 +2507,6 @@ case $target_os in >> ? ? ? ? ?fi >> ? ? ? ? ?LIBTARGET=i386 >> ? ? ? ? ?if enabled x86_64; then >> - ? ? ? ? ? ?enable malloc_aligned >> ? ? ? ? ? ? ?LIBTARGET="i386:x86-64" >> ? ? ? ? ?elif enabled arm; then >> ? ? ? ? ? ? ?LIBTARGET=arm-wince >> @@ -3191,7 +3186,7 @@ check_deps $CONFIG_LIST ? ? ? \ >> >> ?enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; } >> >> -! enabled_any memalign posix_memalign malloc_aligned && >> +! enabled_any memalign posix_memalign && >> ? ? ?enabled_any $need_memalign && enable memalign_hack >> >> ?echo "install prefix ? ? ? ? ? ?$prefix" >> -- > > Which of those systems lack both memalign() and posix_memalign()? ?Do > any of these support AVX at all? osx has posix_memalign. Mingw lacks both. Rest don't know. Ronald From rsbultje at gmail.com Tue May 1 18:59:29 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Tue, 1 May 2012 09:59:29 -0700 Subject: [libav-devel] [PATCH] vp8: update frame size changes on thread context switches. Message-ID: <1335891569-835-1-git-send-email-rsbultje@gmail.com> From: "Ronald S. Bultje" This properly synchronizes frame size changes between threads if subsequent threads abort decoding before frame size is initialized, i.e. it prevents the thread after that from ping-ponging back to the original value. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind --- libavcodec/vp8.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 1c973d5..d9fdd4d 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -1833,6 +1833,8 @@ static int vp8_decode_update_thread_context(AVCodecContext *dst, const AVCodecCo (s_src->mb_width != s->mb_width || s_src->mb_height != s->mb_height)) { free_buffers(s); s->maps_are_invalid = 1; + s->mb_width = s_src->mb_width; + s->mb_height = s_src->mb_height; } s->prob[0] = s_src->prob[!s_src->update_probabilities]; -- 1.7.9.2 From mans at mansr.com Tue May 1 19:27:27 2012 From: mans at mansr.com (Mans Rullgard) Date: Tue, 1 May 2012 18:27:27 +0100 Subject: [libav-devel] [PATCH] twinvq: fix out of bounds array access Message-ID: <1335893247-7290-1-git-send-email-mans@mansr.com> ModeTab.fmode has only 3 elements, so indexing it with ftype in the initialier for 'size' is invalid when ftype == FT_PPC. This fixes crashes with gcc 4.8. Signed-off-by: Mans Rullgard --- libavcodec/twinvq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c index 1577d77..67bc160 100644 --- a/libavcodec/twinvq.c +++ b/libavcodec/twinvq.c @@ -1000,14 +1000,16 @@ static av_cold void construct_perm_table(TwinContext *tctx,enum FrameType ftype) { int block_size; const ModeTab *mtab = tctx->mtab; - int size = tctx->avctx->channels*mtab->fmode[ftype].sub; + int size; int16_t *tmp_perm = (int16_t *) tctx->tmp_buf; if (ftype == FT_PPC) { size = tctx->avctx->channels; block_size = mtab->ppc_shape_len; - } else + } else { + size = tctx->avctx->channels * mtab->fmode[ftype].sub; block_size = mtab->size / mtab->fmode[ftype].sub; + } permutate_in_line(tmp_perm, tctx->n_div[ftype], size, block_size, tctx->length[ftype], -- 1.7.10 From rsbultje at gmail.com Tue May 1 19:28:23 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Tue, 1 May 2012 10:28:23 -0700 Subject: [libav-devel] [PATCH] twinvq: fix out of bounds array access In-Reply-To: <1335893247-7290-1-git-send-email-mans@mansr.com> References: <1335893247-7290-1-git-send-email-mans@mansr.com> Message-ID: Hi, On Tue, May 1, 2012 at 10:27 AM, Mans Rullgard wrote: > ModeTab.fmode has only 3 elements, so indexing it with ftype > in the initialier for 'size' is invalid when ftype == FT_PPC. > > This fixes crashes with gcc 4.8. > > Signed-off-by: Mans Rullgard > --- > ?libavcodec/twinvq.c | ? ?6 ++++-- > ?1 file changed, 4 insertions(+), 2 deletions(-) LGTM. Ronald From justin.ruggles at gmail.com Tue May 1 19:58:30 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Tue, 1 May 2012 13:58:30 -0400 Subject: [libav-devel] [PATCH 1/3] lavr: add C functions for mixing 2 to 1 channels with s16p format Message-ID: <1335895112-12455-1-git-send-email-justin.ruggles@gmail.com> --- libavresample/audio_mix.c | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-) diff --git a/libavresample/audio_mix.c b/libavresample/audio_mix.c index 76f10ea..7ab11b0 100644 --- a/libavresample/audio_mix.c +++ b/libavresample/audio_mix.c @@ -115,6 +115,50 @@ static void mix_2_to_1_fltp_flt_c(float **samples, float **matrix, int len, } } +static void mix_2_to_1_s16p_flt_c(int16_t **samples, float **matrix, int len, + int out_ch, int in_ch) +{ + int16_t *src0 = samples[0]; + int16_t *src1 = samples[1]; + int16_t *dst = src0; + float m0 = matrix[0][0]; + float m1 = matrix[0][1]; + + while (len > 4) { + *dst++ = av_clip_int16(lrintf(*src0++ * m0 + *src1++ * m1)); + *dst++ = av_clip_int16(lrintf(*src0++ * m0 + *src1++ * m1)); + *dst++ = av_clip_int16(lrintf(*src0++ * m0 + *src1++ * m1)); + *dst++ = av_clip_int16(lrintf(*src0++ * m0 + *src1++ * m1)); + len -= 4; + } + while (len > 0) { + *dst++ = av_clip_int16(lrintf(*src0++ * m0 + *src1++ * m1)); + len--; + } +} + +static void mix_2_to_1_s16p_q8_c(int16_t **samples, int16_t **matrix, int len, + int out_ch, int in_ch) +{ + int16_t *src0 = samples[0]; + int16_t *src1 = samples[1]; + int16_t *dst = src0; + int16_t m0 = matrix[0][0]; + int16_t m1 = matrix[0][1]; + + while (len > 4) { + *dst++ = (*src0++ * m0 + *src1++ * m1) >> 8; + *dst++ = (*src0++ * m0 + *src1++ * m1) >> 8; + *dst++ = (*src0++ * m0 + *src1++ * m1) >> 8; + *dst++ = (*src0++ * m0 + *src1++ * m1) >> 8; + len -= 4; + } + while (len > 0) { + *dst++ = (*src0++ * m0 + *src1++ * m1) >> 8; + len--; + } +} + static void mix_1_to_2_fltp_flt_c(float **samples, float **matrix, int len, int out_ch, int in_ch) { @@ -229,6 +273,12 @@ static int mix_function_init(AudioMix *am) ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT, 2, 1, 1, 1, "C", mix_2_to_1_fltp_flt_c); + ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT, + 2, 1, 1, 1, "C", mix_2_to_1_s16p_flt_c); + + ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_Q8, + 2, 1, 1, 1, "C", mix_2_to_1_s16p_q8_c); + ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT, 1, 2, 1, 1, "C", mix_1_to_2_fltp_flt_c); -- 1.7.1 From justin.ruggles at gmail.com Tue May 1 19:58:31 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Tue, 1 May 2012 13:58:31 -0400 Subject: [libav-devel] [PATCH 2/3] lavr: add x86-optimized functions for mixing 2 to 1 s16p with float coeffs In-Reply-To: <1335895112-12455-1-git-send-email-justin.ruggles@gmail.com> References: <1335895112-12455-1-git-send-email-justin.ruggles@gmail.com> Message-ID: <1335895112-12455-2-git-send-email-justin.ruggles@gmail.com> --- libavresample/x86/audio_mix.asm | 55 ++++++++++++++++++++++++++++++++++++ libavresample/x86/audio_mix_init.c | 13 ++++++++ 2 files changed, 68 insertions(+), 0 deletions(-) diff --git a/libavresample/x86/audio_mix.asm b/libavresample/x86/audio_mix.asm index dbc79e5..961f7c3 100644 --- a/libavresample/x86/audio_mix.asm +++ b/libavresample/x86/audio_mix.asm @@ -64,3 +64,58 @@ MIX_2_TO_1_FLTP_FLT INIT_YMM avx MIX_2_TO_1_FLTP_FLT %endif + +;----------------------------------------------------------------------------- +; void ff_mix_2_to_1_s16p_flt(int16_t **src, float **matrix, int len, +; int out_ch, int in_ch); +;----------------------------------------------------------------------------- + +%macro MIX_2_TO_1_S16P_FLT 0 +cglobal mix_2_to_1_s16p_flt, 3,4,6, src, matrix, len, src1 + mov src1q, [srcq+gprsize] + mov srcq, [srcq] + sub src1q, srcq + mov matrixq, [matrixq ] + VBROADCASTSS m4, [matrixq ] + VBROADCASTSS m5, [matrixq+4] + ALIGN 16 +.loop: +%if cpuflag(sse4) + pmovsxwd m0, [srcq ] + pmovsxwd m1, [srcq+ mmsize/2] + pmovsxwd m2, [srcq+src1q ] + pmovsxwd m3, [srcq+src1q+mmsize/2] +%else + mova m0, [srcq ] + mova m2, [srcq+src1q] + punpckhwd m1, m0 + punpcklwd m0, m0 + psrad m1, 16 + psrad m0, 16 + punpckhwd m3, m2 + punpcklwd m2, m2 + psrad m3, 16 + psrad m2, 16 +%endif + cvtdq2ps m0, m0 + cvtdq2ps m1, m1 + cvtdq2ps m2, m2 + cvtdq2ps m3, m3 + addps m0, m2 + addps m1, m3 + mulps m0, m4 + mulps m1, m5 + cvtps2dq m0, m0 + cvtps2dq m1, m1 + packssdw m0, m1 + mova [srcq], m0 + add srcq, mmsize + sub lend, mmsize/2 + jg .loop + REP_RET +%endmacro + +INIT_XMM sse2 +MIX_2_TO_1_S16P_FLT +INIT_XMM sse4 +MIX_2_TO_1_S16P_FLT diff --git a/libavresample/x86/audio_mix_init.c b/libavresample/x86/audio_mix_init.c index 8f8930f..947c314 100644 --- a/libavresample/x86/audio_mix_init.c +++ b/libavresample/x86/audio_mix_init.c @@ -27,6 +27,11 @@ extern void ff_mix_2_to_1_fltp_flt_sse(float **src, float **matrix, int len, extern void ff_mix_2_to_1_fltp_flt_avx(float **src, float **matrix, int len, int out_ch, int in_ch); +extern void ff_mix_2_to_1_s16p_flt_sse2(int16_t **src, float **matrix, int len, + int out_ch, int in_ch); +extern void ff_mix_2_to_1_s16p_flt_sse4(int16_t **src, float **matrix, int len, + int out_ch, int in_ch); + av_cold void ff_audio_mix_init_x86(AudioMix *am) { #if HAVE_YASM @@ -36,6 +41,14 @@ av_cold void ff_audio_mix_init_x86(AudioMix *am) ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT, 2, 1, 16, 8, "SSE", ff_mix_2_to_1_fltp_flt_sse); } + if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE) { + ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT, + 2, 1, 16, 8, "SSE2", ff_mix_2_to_1_s16p_flt_sse2); + } + if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE) { + ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT, + 2, 1, 16, 8, "SSE4", ff_mix_2_to_1_s16p_flt_sse4); + } if (mm_flags & AV_CPU_FLAG_AVX && HAVE_AVX) { ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT, 2, 1, 32, 16, "AVX", ff_mix_2_to_1_fltp_flt_avx); -- 1.7.1 From justin.ruggles at gmail.com Tue May 1 19:58:32 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Tue, 1 May 2012 13:58:32 -0400 Subject: [libav-devel] [PATCH 3/3] lavr: add x86-optimized function for mixing 2 to 1 s16p with q8 coeffs In-Reply-To: <1335895112-12455-1-git-send-email-justin.ruggles@gmail.com> References: <1335895112-12455-1-git-send-email-justin.ruggles@gmail.com> Message-ID: <1335895112-12455-3-git-send-email-justin.ruggles@gmail.com> --- libavresample/x86/audio_mix.asm | 43 ++++++++++++++++++++++++++++++++++++ libavresample/x86/audio_mix_init.c | 5 ++++ 2 files changed, 48 insertions(+), 0 deletions(-) diff --git a/libavresample/x86/audio_mix.asm b/libavresample/x86/audio_mix.asm index 961f7c3..58c8f46 100644 --- a/libavresample/x86/audio_mix.asm +++ b/libavresample/x86/audio_mix.asm @@ -119,3 +119,46 @@ INIT_XMM sse2 MIX_2_TO_1_S16P_FLT INIT_XMM sse4 MIX_2_TO_1_S16P_FLT + +;----------------------------------------------------------------------------- +; void ff_mix_2_to_1_s16p_q8(int16_t **src, int16_t **matrix, int len, +; int out_ch, int in_ch); +;----------------------------------------------------------------------------- + +INIT_XMM sse2 +cglobal mix_2_to_1_s16p_q8, 3,4,6, src, matrix, len, src1 + mov src1q, [srcq+gprsize] + mov srcq, [srcq] + sub src1q, srcq + mov matrixq, [matrixq] + movd m4, [matrixq] + movd m5, [matrixq] + SPLATW m4, m4, 0 + SPLATW m5, m5, 1 + pxor m0, m0 + punpcklwd m4, m0 + punpcklwd m5, m0 + ALIGN 16 +.loop: + mova m0, [srcq ] + mova m2, [srcq+src1q] + mova m1, m0 + punpckhwd m1, m1 + punpcklwd m0, m0 + mova m3, m2 + punpckhwd m3, m3 + punpcklwd m2, m2 + pmaddwd m0, m4 + pmaddwd m1, m4 + pmaddwd m2, m5 + pmaddwd m3, m5 + paddd m0, m2 + paddd m1, m3 + psrad m0, 8 + psrad m1, 8 + packssdw m0, m1 + mova [srcq], m0 + add srcq, mmsize + sub lend, mmsize/2 + jg .loop + REP_RET diff --git a/libavresample/x86/audio_mix_init.c b/libavresample/x86/audio_mix_init.c index 947c314..fa204d6 100644 --- a/libavresample/x86/audio_mix_init.c +++ b/libavresample/x86/audio_mix_init.c @@ -32,6 +32,9 @@ extern void ff_mix_2_to_1_s16p_flt_sse2(int16_t **src, float **matrix, int len, extern void ff_mix_2_to_1_s16p_flt_sse4(int16_t **src, float **matrix, int len, int out_ch, int in_ch); +extern void ff_mix_2_to_1_s16p_q8_sse2(int16_t **src, int16_t **matrix, + int len, int out_ch, int in_ch); + av_cold void ff_audio_mix_init_x86(AudioMix *am) { #if HAVE_YASM @@ -44,6 +47,8 @@ av_cold void ff_audio_mix_init_x86(AudioMix *am) if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE) { ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT, 2, 1, 16, 8, "SSE2", ff_mix_2_to_1_s16p_flt_sse2); + ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_Q8, + 2, 1, 16, 8, "SSE2", ff_mix_2_to_1_s16p_q8_sse2); } if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE) { ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT, -- 1.7.1 From vitor1001 at gmail.com Tue May 1 19:59:09 2012 From: vitor1001 at gmail.com (Vitor Sessak) Date: Tue, 01 May 2012 19:59:09 +0200 Subject: [libav-devel] [PATCH] twinvq: fix out of bounds array access In-Reply-To: <1335893247-7290-1-git-send-email-mans@mansr.com> References: <1335893247-7290-1-git-send-email-mans@mansr.com> Message-ID: <4FA0246D.5060307@gmail.com> On 05/01/2012 07:27 PM, Mans Rullgard wrote: > ModeTab.fmode has only 3 elements, so indexing it with ftype > in the initialier for 'size' is invalid when ftype == FT_PPC. > > This fixes crashes with gcc 4.8. > > Signed-off-by: Mans Rullgard > --- > libavcodec/twinvq.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c > index 1577d77..67bc160 100644 > --- a/libavcodec/twinvq.c > +++ b/libavcodec/twinvq.c > @@ -1000,14 +1000,16 @@ static av_cold void construct_perm_table(TwinContext *tctx,enum FrameType ftype) > { > int block_size; > const ModeTab *mtab = tctx->mtab; > - int size = tctx->avctx->channels*mtab->fmode[ftype].sub; > + int size; > int16_t *tmp_perm = (int16_t *) tctx->tmp_buf; > > if (ftype == FT_PPC) { > size = tctx->avctx->channels; > block_size = mtab->ppc_shape_len; > - } else > + } else { > + size = tctx->avctx->channels * mtab->fmode[ftype].subt > block_size = mtab->size / mtab->fmode[ftype].sub; > + } > > permutate_in_line(tmp_perm, tctx->n_div[ftype], size, > block_size, tctx->length[ftype], Patch ok, thanks. -Vitor From kostya.shishkov at gmail.com Tue May 1 20:02:55 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Tue, 1 May 2012 20:02:55 +0200 Subject: [libav-devel] [PATCH] snowdsp: explicitely state instruction size. In-Reply-To: <1335889964-92669-1-git-send-email-rsbultje@gmail.com> References: <1335889964-92669-1-git-send-email-rsbultje@gmail.com> Message-ID: <20120501180254.GA18965@kst-acer> On Tue, May 01, 2012 at 09:32:44AM -0700, Ronald S. Bultje wrote: > From: "Ronald S. Bultje" > > Fixes a compile error with clang at -O0. > --- > libavcodec/x86/snowdsp_mmx.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/x86/snowdsp_mmx.c b/libavcodec/x86/snowdsp_mmx.c > index 3e6bc99..00b6261 100644 > --- a/libavcodec/x86/snowdsp_mmx.c > +++ b/libavcodec/x86/snowdsp_mmx.c > @@ -675,14 +675,14 @@ static void ff_snow_vertical_compose97i_mmx(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM > > #define snow_inner_add_yblock_sse2_end_8\ > "sal $1, %%"REG_c" \n\t"\ > - "add $"PTR_SIZE"*2, %1 \n\t"\ > + "addl $"PTR_SIZE"*2, %1 \n\t"\ > snow_inner_add_yblock_sse2_end_common1\ > "sar $1, %%"REG_c" \n\t"\ > "sub $2, %2 \n\t"\ > snow_inner_add_yblock_sse2_end_common2 > > #define snow_inner_add_yblock_sse2_end_16\ > - "add $"PTR_SIZE"*1, %1 \n\t"\ > + "addl $"PTR_SIZE"*1, %1 \n\t"\ > snow_inner_add_yblock_sse2_end_common1\ > "dec %2 \n\t"\ > snow_inner_add_yblock_sse2_end_common2 > -- looks fine From lu_zero at gentoo.org Tue May 1 20:16:12 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Tue, 01 May 2012 11:16:12 -0700 Subject: [libav-devel] [PATCH] configure: remove malloc_aligned. In-Reply-To: References: <1335721237-25739-1-git-send-email-rsbultje@gmail.com> Message-ID: <4FA0286C.2040701@gentoo.org> On 01/05/12 09:43, Ronald S. Bultje wrote: > Hi, > > On Tue, May 1, 2012 at 9:40 AM, M?ns Rullg?rd wrote: >> "Ronald S. Bultje" writes: >> >>> From: "Ronald S. Bultje" >>> >>> It was to signal that allocations are 16-byte aligned, but AVX requires >>> 32-byte alignment, thus the check is no longer useful (and causes >>> crashes). >>> --- >>> configure | 7 +------ >>> 1 file changed, 1 insertion(+), 6 deletions(-) >>> >>> diff --git a/configure b/configure >>> index bc12f33..c8bb63f 100755 >>> --- a/configure >>> +++ b/configure >>> @@ -2465,7 +2465,6 @@ case $target_os in >>> oss_outdev_extralibs="-lossaudio" >>> ;; >>> openbsd) >>> - enable malloc_aligned >>> # On OpenBSD 4.5. the compiler does not use PIC unless >>> # explicitly using -fPIC. Libav builds fine without PIC, >>> # however the generated executable will not do anything >>> @@ -2478,17 +2477,14 @@ case $target_os in >>> oss_outdev_extralibs="-lossaudio" >>> ;; >>> dragonfly) >>> - enable malloc_aligned >>> disable symver >>> ;; >>> freebsd) >>> - enable malloc_aligned >>> ;; >>> bsd/os) >>> add_extralibs -lpoll -lgnugetopt >>> ;; >>> darwin) >>> - enable malloc_aligned >>> gas="gas-preprocessor.pl $cc" >>> enabled ppc && add_asflags -force_cpusubtype_ALL >>> SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)' >>> @@ -2511,7 +2507,6 @@ case $target_os in >>> fi >>> LIBTARGET=i386 >>> if enabled x86_64; then >>> - enable malloc_aligned >>> LIBTARGET="i386:x86-64" >>> elif enabled arm; then >>> LIBTARGET=arm-wince >>> @@ -3191,7 +3186,7 @@ check_deps $CONFIG_LIST \ >>> >>> enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; } >>> >>> -! enabled_any memalign posix_memalign malloc_aligned && >>> +! enabled_any memalign posix_memalign && >>> enabled_any $need_memalign && enable memalign_hack >>> >>> echo "install prefix $prefix" >>> -- >> >> Which of those systems lack both memalign() and posix_memalign()? Do >> any of these support AVX at all? > > osx has posix_memalign. Mingw lacks both. Rest don't know. bsds should have memalign and posix_memalign. The posix_memalign() function first appeared in FreeBSD 7.0. lu -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From alex.converse at gmail.com Tue May 1 20:16:17 2012 From: alex.converse at gmail.com (Alex Converse) Date: Tue, 1 May 2012 11:16:17 -0700 Subject: [libav-devel] [PATCH 1/3] lavr: add C functions for mixing 2 to 1 channels with s16p format In-Reply-To: <1335895112-12455-1-git-send-email-justin.ruggles@gmail.com> References: <1335895112-12455-1-git-send-email-justin.ruggles@gmail.com> Message-ID: On Tue, May 1, 2012 at 10:58 AM, Justin Ruggles wrote: > --- > ?libavresample/audio_mix.c | ? 50 +++++++++++++++++++++++++++++++++++++++++++++ > ?1 files changed, 50 insertions(+), 0 deletions(-) > Looks Good To Me From mans at mansr.com Tue May 1 21:06:42 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Tue, 01 May 2012 20:06:42 +0100 Subject: [libav-devel] [PATCH] configure: remove malloc_aligned. In-Reply-To: <4FA0286C.2040701@gentoo.org> (Luca Barbato's message of "Tue, 01 May 2012 11:16:12 -0700") References: <1335721237-25739-1-git-send-email-rsbultje@gmail.com> <4FA0286C.2040701@gentoo.org> Message-ID: Luca Barbato writes: > On 01/05/12 09:43, Ronald S. Bultje wrote: >> Hi, >> >> On Tue, May 1, 2012 at 9:40 AM, M?ns Rullg?rd wrote: >>> "Ronald S. Bultje" writes: >>> >>>> From: "Ronald S. Bultje" >>>> >>>> It was to signal that allocations are 16-byte aligned, but AVX requires >>>> 32-byte alignment, thus the check is no longer useful (and causes >>>> crashes). >>>> --- >>>> configure | 7 +------ >>>> 1 file changed, 1 insertion(+), 6 deletions(-) >>>> >>>> diff --git a/configure b/configure >>>> index bc12f33..c8bb63f 100755 >>>> --- a/configure >>>> +++ b/configure >>>> @@ -2465,7 +2465,6 @@ case $target_os in >>>> oss_outdev_extralibs="-lossaudio" >>>> ;; >>>> openbsd) >>>> - enable malloc_aligned >>>> # On OpenBSD 4.5. the compiler does not use PIC unless >>>> # explicitly using -fPIC. Libav builds fine without PIC, >>>> # however the generated executable will not do anything >>>> @@ -2478,17 +2477,14 @@ case $target_os in >>>> oss_outdev_extralibs="-lossaudio" >>>> ;; >>>> dragonfly) >>>> - enable malloc_aligned >>>> disable symver >>>> ;; >>>> freebsd) >>>> - enable malloc_aligned >>>> ;; >>>> bsd/os) >>>> add_extralibs -lpoll -lgnugetopt >>>> ;; >>>> darwin) >>>> - enable malloc_aligned >>>> gas="gas-preprocessor.pl $cc" >>>> enabled ppc && add_asflags -force_cpusubtype_ALL >>>> SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)' >>>> @@ -2511,7 +2507,6 @@ case $target_os in >>>> fi >>>> LIBTARGET=i386 >>>> if enabled x86_64; then >>>> - enable malloc_aligned >>>> LIBTARGET="i386:x86-64" >>>> elif enabled arm; then >>>> LIBTARGET=arm-wince >>>> @@ -3191,7 +3186,7 @@ check_deps $CONFIG_LIST \ >>>> >>>> enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; } >>>> >>>> -! enabled_any memalign posix_memalign malloc_aligned && >>>> +! enabled_any memalign posix_memalign && >>>> enabled_any $need_memalign && enable memalign_hack >>>> >>>> echo "install prefix $prefix" >>>> -- >>> >>> Which of those systems lack both memalign() and posix_memalign()? Do >>> any of these support AVX at all? >> >> osx has posix_memalign. Mingw lacks both. Rest don't know. > > bsds should have memalign and posix_memalign. > > The posix_memalign() function first appeared in FreeBSD 7.0. What alignment is provided by malloc() on 64-bit mingw, and does anyone care if the manual alignment gets needlessly enabled there in some case? Since all the other systems appear to have [posix_]memalign, this should be fine on those. -- M?ns Rullg?rd mans at mansr.com From kostya.shishkov at gmail.com Tue May 1 21:12:55 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Tue, 1 May 2012 21:12:55 +0200 Subject: [libav-devel] [PATCH] wmall: fix reconstructing audio with uncoded channels Message-ID: <20120501191255.GA19152@kst-acer> --- not that I care, just for the reference --- libavcodec/wmalosslessdec.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c index 1520a06..1f6581e 100644 --- a/libavcodec/wmalosslessdec.c +++ b/libavcodec/wmalosslessdec.c @@ -654,8 +654,6 @@ static void mclms_predict(WmallDecodeCtx *s, int icoef, int *pred) int num_channels = s->num_channels; for (ich = 0; ich < num_channels; ich++) { - if (!s->is_channel_coded[ich]) - continue; pred[ich] = 0; for (i = 0; i < order * num_channels; i++) pred[ich] += s->mclms_prevvalues[i + s->mclms_recent] * @@ -789,7 +787,7 @@ static void revert_inter_ch_decorr(WmallDecodeCtx *s, int tile_size) { if (s->num_channels != 2) return; - else if (s->is_channel_coded[0] && s->is_channel_coded[1]) { + else if (s->is_channel_coded[0] || s->is_channel_coded[1]) { int icoef; for (icoef = 0; icoef < tile_size; icoef++) { s->channel_residues[0][icoef] -= s->channel_residues[1][icoef] >> 1; @@ -955,6 +953,8 @@ static int decode_subframe(WmallDecodeCtx *s) else use_normal_update_speed(s, i); revert_cdlms(s, i, 0, subframe_len); + } else { + memset(s->channel_residues[i], 0, sizeof(**s->channel_residues) * subframe_len); } } if (s->do_mclms) -- 1.7.0.4 From mashiat.sarker at gmail.com Tue May 1 21:19:41 2012 From: mashiat.sarker at gmail.com (Mashiat Sarker Shakkhar) Date: Wed, 02 May 2012 01:19:41 +0600 Subject: [libav-devel] [PATCH] wmall: fix reconstructing audio with uncoded channels In-Reply-To: <20120501191255.GA19152@kst-acer> References: <20120501191255.GA19152@kst-acer> Message-ID: <4FA0374D.9000604@gmail.com> On 5/2/2012 1:12 AM, Kostya Shishkov wrote: > --- > not that I care, just for the reference > --- > libavcodec/wmalosslessdec.c | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c > index 1520a06..1f6581e 100644 > --- a/libavcodec/wmalosslessdec.c > +++ b/libavcodec/wmalosslessdec.c > @@ -654,8 +654,6 @@ static void mclms_predict(WmallDecodeCtx *s, int icoef, int *pred) > int num_channels = s->num_channels; > > for (ich = 0; ich< num_channels; ich++) { > - if (!s->is_channel_coded[ich]) > - continue; > pred[ich] = 0; > for (i = 0; i< order * num_channels; i++) > pred[ich] += s->mclms_prevvalues[i + s->mclms_recent] * > @@ -789,7 +787,7 @@ static void revert_inter_ch_decorr(WmallDecodeCtx *s, int tile_size) > { > if (s->num_channels != 2) > return; > - else if (s->is_channel_coded[0]&& s->is_channel_coded[1]) { > + else if (s->is_channel_coded[0] || s->is_channel_coded[1]) { > int icoef; > for (icoef = 0; icoef< tile_size; icoef++) { > s->channel_residues[0][icoef] -= s->channel_residues[1][icoef]>> 1; > @@ -955,6 +953,8 @@ static int decode_subframe(WmallDecodeCtx *s) > else > use_normal_update_speed(s, i); > revert_cdlms(s, i, 0, subframe_len); > + } else { > + memset(s->channel_residues[i], 0, sizeof(**s->channel_residues) * subframe_len); > } > } > if (s->do_mclms) I'll clean it up a bit and resubmit. From lu_zero at gentoo.org Tue May 1 21:53:59 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Tue, 01 May 2012 12:53:59 -0700 Subject: [libav-devel] [PATCH] configure: remove malloc_aligned. In-Reply-To: References: <1335721237-25739-1-git-send-email-rsbultje@gmail.com> <4FA0286C.2040701@gentoo.org> Message-ID: <4FA03F57.4050305@gentoo.org> On 01/05/12 12:06, M?ns Rullg?rd wrote: > Luca Barbato writes: >>> osx has posix_memalign. Mingw lacks both. Rest don't know. >> >> bsds should have memalign and posix_memalign. >> >> The posix_memalign() function first appeared in FreeBSD 7.0. > > What alignment is provided by malloc() on 64-bit mingw, and does anyone > care if the manual alignment gets needlessly enabled there in some case? > Since all the other systems appear to have [posix_]memalign, this should > be fine on those. It should be just a fringe case so I guess we are fine. If it gets compelling we can rework it. lu -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From samuel.pitoiset at gmail.com Tue May 1 22:01:56 2012 From: samuel.pitoiset at gmail.com (Samuel Pitoiset) Date: Tue, 1 May 2012 22:01:56 +0200 Subject: [libav-devel] [PATCH] rtmp: Support 'rtmp_live', an option which specifies if the media is a live stream. Message-ID: <1335902516-21310-1-git-send-email-samuel.pitoiset@gmail.com> --- libavformat/rtmpproto.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 9cdb639..209d108 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -66,6 +66,7 @@ typedef struct RTMPContext { int chunk_size; ///< size of the chunks RTMP packets are divided into int is_input; ///< input/output flag char *playpath; ///< stream identifier to play (with possible "mp4:" prefix) + int live; ///< live stream char *app; ///< name of application ClientState state; ///< current state int main_channel_id; ///< an additional channel ID which is used for some invocations @@ -287,7 +288,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", rt->playpath); ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, - 20 + strlen(rt->playpath)); + 32 + strlen(rt->playpath)); pkt.extra = rt->main_channel_id; p = pkt.data; @@ -295,6 +296,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) ff_amf_write_number(&p, ++rt->nb_invokes); ff_amf_write_null(&p); ff_amf_write_string(&p, rt->playpath); + ff_amf_write_number(&p, rt->live); ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]); ff_rtmp_packet_destroy(&pkt); @@ -908,6 +910,11 @@ static int rtmp_open(URLContext *s, const char *uri, int flags) strncat(rt->playpath, fname, PLAYPATH_MAX_LENGTH - 5); } + /* If you pass -1 in the Start field (ie. the live field), + * only the live stream is played. If you pass 0, a + * recorded stream is played. */ + rt->live = (rt->live) ? -1 : 0; + rt->client_report_size = 1048576; rt->bytes_read = 0; rt->last_bytes_read = 0; @@ -1050,6 +1057,7 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size) static const AVOption rtmp_options[] = { {"rtmp_app", "Name of application to connect to on the RTMP server", OFFSET(app), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, + {"rtmp_live", "Specify that the media is a live stream.", OFFSET(live), AV_OPT_TYPE_INT, {0}, 0, 1, DEC}, {"rtmp_playpath", "Stream identifier to play or to publish", OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, { NULL }, }; -- 1.7.7.5 (Apple Git-26) From mans at mansr.com Tue May 1 22:03:00 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Tue, 01 May 2012 21:03:00 +0100 Subject: [libav-devel] [PATCH] configure: remove malloc_aligned. In-Reply-To: <4FA03F57.4050305@gentoo.org> (Luca Barbato's message of "Tue, 01 May 2012 12:53:59 -0700") References: <1335721237-25739-1-git-send-email-rsbultje@gmail.com> <4FA0286C.2040701@gentoo.org> <4FA03F57.4050305@gentoo.org> Message-ID: Luca Barbato writes: > On 01/05/12 12:06, M?ns Rullg?rd wrote: >> Luca Barbato writes: >>>> osx has posix_memalign. Mingw lacks both. Rest don't know. >>> >>> bsds should have memalign and posix_memalign. >>> >>> The posix_memalign() function first appeared in FreeBSD 7.0. >> >> What alignment is provided by malloc() on 64-bit mingw, and does anyone >> care if the manual alignment gets needlessly enabled there in some case? >> Since all the other systems appear to have [posix_]memalign, this should >> be fine on those. > > It should be just a fringe case so I guess we are fine. If it gets > compelling we can rework it. Then the patch is OK with me. -- M?ns Rullg?rd mans at mansr.com From lu_zero at gentoo.org Tue May 1 22:25:02 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Tue, 01 May 2012 13:25:02 -0700 Subject: [libav-devel] =?utf-8?q?=5BPATCH=5D_rtmp=3A_Support_=27rtmp=5Fliv?= =?utf-8?q?e=27=2C=09an_option_which_specifies_if_the_media_is_a_li?= =?utf-8?q?ve_stream=2E?= In-Reply-To: <1335902516-21310-1-git-send-email-samuel.pitoiset@gmail.com> References: <1335902516-21310-1-git-send-email-samuel.pitoiset@gmail.com> Message-ID: Samuel Pitoiset wrote: >--- > libavformat/rtmpproto.c | 10 +++++++++- > 1 files changed, 9 insertions(+), 1 deletions(-) > >diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c >index 9cdb639..209d108 100644 >--- a/libavformat/rtmpproto.c >+++ b/libavformat/rtmpproto.c >@@ -66,6 +66,7 @@ typedef struct RTMPContext { >int chunk_size; ///< size of the chunks RTMP >packets are divided into > int is_input; ///< input/output flag >char *playpath; ///< stream identifier to >play (with possible "mp4:" prefix) >+ int live; ///< live stream > char *app; ///< name of application > ClientState state; ///< current state >int main_channel_id; ///< an additional channel ID >which is used for some invocations >@@ -287,7 +288,7 @@ static void gen_play(URLContext *s, RTMPContext >*rt) > >av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", >rt->playpath); > ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, >- 20 + strlen(rt->playpath)); >+ 32 + strlen(rt->playpath)); > pkt.extra = rt->main_channel_id; > > p = pkt.data; >@@ -295,6 +296,7 @@ static void gen_play(URLContext *s, RTMPContext >*rt) > ff_amf_write_number(&p, ++rt->nb_invokes); > ff_amf_write_null(&p); > ff_amf_write_string(&p, rt->playpath); >+ ff_amf_write_number(&p, rt->live); > >ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, >rt->prev_pkt[1]); > ff_rtmp_packet_destroy(&pkt); >@@ -908,6 +910,11 @@ static int rtmp_open(URLContext *s, const char >*uri, int flags) > strncat(rt->playpath, fname, PLAYPATH_MAX_LENGTH - 5); > } > >+ /* If you pass -1 in the Start field (ie. the live field), >+ * only the live stream is played. If you pass 0, a >+ * recorded stream is played. */ >+ rt->live = (rt->live) ? -1 : 0; -2 should be "try both". Please doublecheck. > rt->client_report_size = 1048576; > rt->bytes_read = 0; > rt->last_bytes_read = 0; >@@ -1050,6 +1057,7 @@ static int rtmp_write(URLContext *s, const >uint8_t *buf, int size) > > static const AVOption rtmp_options[] = { >{"rtmp_app", "Name of application to connect to on the RTMP server", >OFFSET(app), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, >+ {"rtmp_live", "Specify that the media is a live stream.", >OFFSET(live), AV_OPT_TYPE_INT, {0}, 0, 1, DEC}, >{"rtmp_playpath", "Stream identifier to play or to publish", >OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, > { NULL }, > }; >-- >1.7.7.5 (Apple Git-26) > >_______________________________________________ >libav-devel mailing list >libav-devel at libav.org >https://lists.libav.org/mailman/listinfo/libav-devel -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. From justin.ruggles at gmail.com Tue May 1 22:49:39 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Tue, 1 May 2012 16:49:39 -0400 Subject: [libav-devel] [PATCH 1/6] lavr: Add x86-optimized function for s16 to s32 conversion Message-ID: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> --- Athlon64 C - 6217 SSE2 - 1742 SandyBridge C - 4728 SSE2 - 892 libavresample/x86/audio_convert.asm | 23 +++++++++++++++++++++++ libavresample/x86/audio_convert_init.c | 6 ++++++ 2 files changed, 29 insertions(+), 0 deletions(-) diff --git a/libavresample/x86/audio_convert.asm b/libavresample/x86/audio_convert.asm index 809c5d1..cd99f94 100644 --- a/libavresample/x86/audio_convert.asm +++ b/libavresample/x86/audio_convert.asm @@ -1,6 +1,7 @@ ;****************************************************************************** ;* x86 optimized Format Conversion Utils ;* Copyright (c) 2008 Loren Merritt +;* Copyright (c) 2012 Justin Ruggles ;* ;* This file is part of Libav. ;* @@ -24,6 +25,28 @@ SECTION_TEXT +;------------------------------------------------------------------------------ +; void ff_conv_s16_to_s32(int32_t *dst, const int16_t *src, int len); +;------------------------------------------------------------------------------ + +INIT_XMM sse2 +cglobal conv_s16_to_s32, 3,3,3, dst, src, len + lea lenq, [2*lend] + lea dstq, [dstq+2*lenq] + add srcq, lenq + neg lenq +.loop: + mova m2, [srcq+lenq] + pxor m0, m0 + pxor m1, m1 + punpcklwd m0, m2 + punpckhwd m1, m2 + mova [dstq+2*lenq ], m0 + mova [dstq+2*lenq+mmsize], m1 + add lenq, mmsize + jl .loop + REP_RET + ;----------------------------------------------------------------------------- ; void ff_conv_fltp_to_flt_6ch(float *dst, float *const *src, int len, ; int channels); diff --git a/libavresample/x86/audio_convert_init.c b/libavresample/x86/audio_convert_init.c index 6883f10..caaae78 100644 --- a/libavresample/x86/audio_convert_init.c +++ b/libavresample/x86/audio_convert_init.c @@ -22,6 +22,8 @@ #include "libavutil/cpu.h" #include "libavresample/audio_convert.h" +extern void ff_conv_s16_to_s32_sse2(int16_t *dst, const int32_t *src, int len); + extern void ff_conv_fltp_to_flt_6ch_mmx(float *dst, float *const *src, int len); extern void ff_conv_fltp_to_flt_6ch_sse(float *dst, float *const *src, int len); @@ -38,5 +40,9 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac) ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, 6, 16, 4, "SSE", ff_conv_fltp_to_flt_6ch_sse); } + if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE) { + ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16, + 0, 16, 8, "SSE2", ff_conv_s16_to_s32_sse2); + } #endif } -- 1.7.1 From justin.ruggles at gmail.com Tue May 1 22:49:40 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Tue, 1 May 2012 16:49:40 -0400 Subject: [libav-devel] [PATCH 2/6] lavr: Add x86-optimized functions for s16 to flt conversion In-Reply-To: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> References: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> Message-ID: <1335905384-19715-2-git-send-email-justin.ruggles@gmail.com> --- Athlon64 C - 12412 SSE2 - 3706 SandyBridge C - 16440 SSE2 - 3116 SSE4 - 1002 libavresample/x86/audio_convert.asm | 43 ++++++++++++++++++++++++++++++++ libavresample/x86/audio_convert_init.c | 9 ++++++ 2 files changed, 52 insertions(+), 0 deletions(-) diff --git a/libavresample/x86/audio_convert.asm b/libavresample/x86/audio_convert.asm index cd99f94..4d4c798 100644 --- a/libavresample/x86/audio_convert.asm +++ b/libavresample/x86/audio_convert.asm @@ -23,6 +23,10 @@ %include "x86inc.asm" %include "x86util.asm" +SECTION_RODATA 32 + +pf_s16_inv_scale: times 4 dd 0x38000000 + SECTION_TEXT ;------------------------------------------------------------------------------ @@ -47,6 +51,45 @@ cglobal conv_s16_to_s32, 3,3,3, dst, src, len jl .loop REP_RET +;------------------------------------------------------------------------------ +; void ff_conv_s16_to_flt(float *dst, const int16_t *src, int len); +;------------------------------------------------------------------------------ + +%macro CONV_S16_TO_FLT 0 +cglobal conv_s16_to_flt, 3,3,3, dst, src, len + lea lenq, [2*lend] + add srcq, lenq + lea dstq, [dstq + 2*lenq] + neg lenq + mova m2, [pf_s16_inv_scale] + ALIGN 16 +.loop: +%if cpuflag(sse4) + pmovsxwd m0, [srcq+lenq ] + pmovsxwd m1, [srcq+lenq+mmsize/2] +%else + mova m1, [srcq+lenq] + punpcklwd m0, m1 + punpckhwd m1, m1 + psrad m0, 16 + psrad m1, 16 +%endif + cvtdq2ps m0, m0 + cvtdq2ps m1, m1 + mulps m0, m0, m2 + mulps m1, m1, m2 + mova [dstq+2*lenq ], m0 + mova [dstq+2*lenq+mmsize], m1 + add lenq, mmsize + jl .loop + REP_RET +%endmacro + +INIT_XMM sse2 +CONV_S16_TO_FLT +INIT_XMM sse4 +CONV_S16_TO_FLT + ;----------------------------------------------------------------------------- ; void ff_conv_fltp_to_flt_6ch(float *dst, float *const *src, int len, ; int channels); diff --git a/libavresample/x86/audio_convert_init.c b/libavresample/x86/audio_convert_init.c index caaae78..fad26a7 100644 --- a/libavresample/x86/audio_convert_init.c +++ b/libavresample/x86/audio_convert_init.c @@ -24,6 +24,9 @@ extern void ff_conv_s16_to_s32_sse2(int16_t *dst, const int32_t *src, int len); +extern void ff_conv_s16_to_flt_sse2(float *dst, const int16_t *src, int len); +extern void ff_conv_s16_to_flt_sse4(float *dst, const int16_t *src, int len); + extern void ff_conv_fltp_to_flt_6ch_mmx(float *dst, float *const *src, int len); extern void ff_conv_fltp_to_flt_6ch_sse(float *dst, float *const *src, int len); @@ -43,6 +46,12 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac) if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16, 0, 16, 8, "SSE2", ff_conv_s16_to_s32_sse2); + ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, + 0, 16, 8, "SSE2", ff_conv_s16_to_flt_sse2); + } + if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE) { + ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, + 0, 16, 8, "SSE4", ff_conv_s16_to_flt_sse4); } #endif } -- 1.7.1 From justin.ruggles at gmail.com Tue May 1 22:49:41 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Tue, 1 May 2012 16:49:41 -0400 Subject: [libav-devel] [PATCH 3/6] lavr: Add x86-optimized functions for s32 to s16 conversion In-Reply-To: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> References: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> Message-ID: <1335905384-19715-3-git-send-email-justin.ruggles@gmail.com> --- Athlon64 C - 3127 MMX - 861 SSE2 - 924 SandyBridge C - 2950 MMX - 837 SSE2 - 366 libavresample/x86/audio_convert.asm | 38 ++++++++++++++++++++++++++++++++ libavresample/x86/audio_convert_init.c | 9 +++++++ 2 files changed, 47 insertions(+), 0 deletions(-) diff --git a/libavresample/x86/audio_convert.asm b/libavresample/x86/audio_convert.asm index 4d4c798..3e3c781 100644 --- a/libavresample/x86/audio_convert.asm +++ b/libavresample/x86/audio_convert.asm @@ -90,6 +90,44 @@ CONV_S16_TO_FLT INIT_XMM sse4 CONV_S16_TO_FLT +;------------------------------------------------------------------------------ +; void ff_conv_s32_to_s16(int16_t *dst, const int32_t *src, int len); +;------------------------------------------------------------------------------ + +%macro CONV_S32_TO_S16 0 +cglobal conv_s32_to_s16, 3,3,4, dst, src, len + lea lenq, [2*lend] + lea srcq, [srcq+2*lenq] + add dstq, lenq + neg lenq +.loop: + mova m0, [srcq+2*lenq ] + mova m1, [srcq+2*lenq+ mmsize] + mova m2, [srcq+2*lenq+2*mmsize] + mova m3, [srcq+2*lenq+3*mmsize] + psrad m0, 16 + psrad m1, 16 + psrad m2, 16 + psrad m3, 16 + packssdw m0, m1 + packssdw m2, m3 + mova [dstq+lenq ], m0 + mova [dstq+lenq+mmsize], m2 + add lenq, mmsize*2 + jl .loop +%if mmsize == 8 + emms + RET +%else + REP_RET +%endif +%endmacro + +INIT_MMX mmx +CONV_S32_TO_S16 +INIT_XMM sse2 +CONV_S32_TO_S16 + ;----------------------------------------------------------------------------- ; void ff_conv_fltp_to_flt_6ch(float *dst, float *const *src, int len, ; int channels); diff --git a/libavresample/x86/audio_convert_init.c b/libavresample/x86/audio_convert_init.c index fad26a7..e236626 100644 --- a/libavresample/x86/audio_convert_init.c +++ b/libavresample/x86/audio_convert_init.c @@ -27,6 +27,9 @@ extern void ff_conv_s16_to_s32_sse2(int16_t *dst, const int32_t *src, int len); extern void ff_conv_s16_to_flt_sse2(float *dst, const int16_t *src, int len); extern void ff_conv_s16_to_flt_sse4(float *dst, const int16_t *src, int len); +extern void ff_conv_s32_to_s16_mmx (int16_t *dst, const int32_t *src, int len); +extern void ff_conv_s32_to_s16_sse2(int16_t *dst, const int32_t *src, int len); + extern void ff_conv_fltp_to_flt_6ch_mmx(float *dst, float *const *src, int len); extern void ff_conv_fltp_to_flt_6ch_sse(float *dst, float *const *src, int len); @@ -36,6 +39,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac) int mm_flags = av_get_cpu_flags(); if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) { + ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32, + 0, 1, 8, "MMX", ff_conv_s32_to_s16_mmx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, 6, 1, 4, "MMX", ff_conv_fltp_to_flt_6ch_mmx); } @@ -44,6 +49,10 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac) 6, 16, 4, "SSE", ff_conv_fltp_to_flt_6ch_sse); } if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE) { + if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW)) { + ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32, + 0, 16, 16, "SSE2", ff_conv_s32_to_s16_sse2); + } ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16, 0, 16, 8, "SSE2", ff_conv_s16_to_s32_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, -- 1.7.1 From justin.ruggles at gmail.com Tue May 1 22:49:42 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Tue, 1 May 2012 16:49:42 -0400 Subject: [libav-devel] [PATCH 4/6] lavr: Add x86-optimized functions for s32 to flt conversion In-Reply-To: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> References: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> Message-ID: <1335905384-19715-4-git-send-email-justin.ruggles@gmail.com> --- Athlon64 C - 6216 SSE2 - 1333 SandyBridge C - 8209 SSE2 - 470 AVX - 385 libavresample/x86/audio_convert.asm | 38 +++++++++++++++++++++++++++++++- libavresample/x86/audio_convert_init.c | 9 +++++++ 2 files changed, 46 insertions(+), 1 deletions(-) diff --git a/libavresample/x86/audio_convert.asm b/libavresample/x86/audio_convert.asm index 3e3c781..ee71d42 100644 --- a/libavresample/x86/audio_convert.asm +++ b/libavresample/x86/audio_convert.asm @@ -25,6 +25,7 @@ SECTION_RODATA 32 +pf_s32_inv_scale: times 8 dd 0x30000000 pf_s16_inv_scale: times 4 dd 0x38000000 SECTION_TEXT @@ -54,7 +55,6 @@ cglobal conv_s16_to_s32, 3,3,3, dst, src, len ;------------------------------------------------------------------------------ ; void ff_conv_s16_to_flt(float *dst, const int16_t *src, int len); ;------------------------------------------------------------------------------ - %macro CONV_S16_TO_FLT 0 cglobal conv_s16_to_flt, 3,3,3, dst, src, len lea lenq, [2*lend] @@ -128,6 +128,42 @@ CONV_S32_TO_S16 INIT_XMM sse2 CONV_S32_TO_S16 +;------------------------------------------------------------------------------ +; void ff_conv_s32_to_flt(float *dst, const int32_t *src, int len); +;------------------------------------------------------------------------------ + +%macro CONV_S32_TO_FLT 0 +cglobal conv_s32_to_flt, 3,3,3, dst, src, len + lea lenq, [4*lend] + add srcq, lenq + add dstq, lenq + neg lenq + mova m0, [pf_s32_inv_scale] + ALIGN 16 +.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, mmsize*2 + jl .loop +%if mmsize == 32 + vzeroupper + RET +%else + REP_RET +%endif +%endmacro + +INIT_XMM sse2 +CONV_S32_TO_FLT +%if HAVE_AVX +INIT_YMM avx +CONV_S32_TO_FLT +%endif + ;----------------------------------------------------------------------------- ; void ff_conv_fltp_to_flt_6ch(float *dst, float *const *src, int len, ; int channels); diff --git a/libavresample/x86/audio_convert_init.c b/libavresample/x86/audio_convert_init.c index e236626..2ef8e08 100644 --- a/libavresample/x86/audio_convert_init.c +++ b/libavresample/x86/audio_convert_init.c @@ -30,6 +30,9 @@ extern void ff_conv_s16_to_flt_sse4(float *dst, const int16_t *src, int len); extern void ff_conv_s32_to_s16_mmx (int16_t *dst, const int32_t *src, int len); extern void ff_conv_s32_to_s16_sse2(int16_t *dst, const int32_t *src, int len); +extern void ff_conv_s32_to_flt_sse2(float *dst, const int32_t *src, int len); +extern void ff_conv_s32_to_flt_avx (float *dst, const int32_t *src, int len); + extern void ff_conv_fltp_to_flt_6ch_mmx(float *dst, float *const *src, int len); extern void ff_conv_fltp_to_flt_6ch_sse(float *dst, float *const *src, int len); @@ -57,10 +60,16 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac) 0, 16, 8, "SSE2", ff_conv_s16_to_s32_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, 0, 16, 8, "SSE2", ff_conv_s16_to_flt_sse2); + ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32, + 0, 16, 8, "SSE2", ff_conv_s32_to_flt_sse2); } if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, 0, 16, 8, "SSE4", ff_conv_s16_to_flt_sse4); } + if (mm_flags & AV_CPU_FLAG_AVX && HAVE_AVX) { + ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32, + 0, 32, 16, "AVX", ff_conv_s32_to_flt_avx); + } #endif } -- 1.7.1 From justin.ruggles at gmail.com Tue May 1 22:49:43 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Tue, 1 May 2012 16:49:43 -0400 Subject: [libav-devel] [PATCH 5/6] lavr: Add x86-optimized function for flt to s16 conversion In-Reply-To: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> References: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> Message-ID: <1335905384-19715-5-git-send-email-justin.ruggles@gmail.com> --- Athlon64 C - 8085 SSE2 - 1477 SandyBridge C - 5032 SSE2 - 428 libavresample/x86/audio_convert.asm | 30 ++++++++++++++++++++++++++++++ libavresample/x86/audio_convert_init.c | 4 ++++ 2 files changed, 34 insertions(+), 0 deletions(-) diff --git a/libavresample/x86/audio_convert.asm b/libavresample/x86/audio_convert.asm index ee71d42..4811056 100644 --- a/libavresample/x86/audio_convert.asm +++ b/libavresample/x86/audio_convert.asm @@ -27,6 +27,7 @@ SECTION_RODATA 32 pf_s32_inv_scale: times 8 dd 0x30000000 pf_s16_inv_scale: times 4 dd 0x38000000 +pf_s16_scale: times 4 dd 0x47000000 SECTION_TEXT @@ -164,6 +165,35 @@ INIT_YMM avx CONV_S32_TO_FLT %endif +;------------------------------------------------------------------------------ +; void ff_conv_flt_to_s16(int16_t *dst, const float *src, int len); +;------------------------------------------------------------------------------ + +INIT_XMM sse2 +cglobal conv_flt_to_s16, 3,3,5, dst, src, len + lea lenq, [2*lend] + lea srcq, [srcq+2*lenq] + add dstq, lenq + neg lenq + mova m4, [pf_s16_scale] + ALIGN 16 +.loop: + mulps m0, m4, [srcq+2*lenq ] + mulps m1, m4, [srcq+2*lenq+1*mmsize] + mulps m2, m4, [srcq+2*lenq+2*mmsize] + mulps m3, m4, [srcq+2*lenq+3*mmsize] + cvtps2dq m0, m0 + cvtps2dq m1, m1 + cvtps2dq m2, m2 + cvtps2dq m3, m3 + packssdw m0, m1 + packssdw m2, m3 + mova [dstq+lenq ], m0 + mova [dstq+lenq+mmsize], m2 + add lenq, mmsize*2 + jl .loop + REP_RET + ;----------------------------------------------------------------------------- ; void ff_conv_fltp_to_flt_6ch(float *dst, float *const *src, int len, ; int channels); diff --git a/libavresample/x86/audio_convert_init.c b/libavresample/x86/audio_convert_init.c index 2ef8e08..fe95217 100644 --- a/libavresample/x86/audio_convert_init.c +++ b/libavresample/x86/audio_convert_init.c @@ -33,6 +33,8 @@ extern void ff_conv_s32_to_s16_sse2(int16_t *dst, const int32_t *src, int len); extern void ff_conv_s32_to_flt_sse2(float *dst, const int32_t *src, int len); extern void ff_conv_s32_to_flt_avx (float *dst, const int32_t *src, int len); +extern void ff_conv_flt_to_s16_sse2(int16_t *dst, const float *src, int len); + extern void ff_conv_fltp_to_flt_6ch_mmx(float *dst, float *const *src, int len); extern void ff_conv_fltp_to_flt_6ch_sse(float *dst, float *const *src, int len); @@ -62,6 +64,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac) 0, 16, 8, "SSE2", ff_conv_s16_to_flt_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32, 0, 16, 8, "SSE2", ff_conv_s32_to_flt_sse2); + ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT, + 0, 16, 16, "SSE2", ff_conv_flt_to_s16_sse2); } if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, -- 1.7.1 From justin.ruggles at gmail.com Tue May 1 22:49:44 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Tue, 1 May 2012 16:49:44 -0400 Subject: [libav-devel] [PATCH 6/6] lavr: Add x86-optimized function for flt to s32 conversion In-Reply-To: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> References: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> Message-ID: <1335905384-19715-6-git-send-email-justin.ruggles@gmail.com> --- Athlon64 C - 8176 SSE2 - 1784 SandyBridge C - 5578 SSE2 - 418 libavresample/x86/audio_convert.asm | 29 +++++++++++++++++++++++++++++ libavresample/x86/audio_convert_init.c | 4 ++++ 2 files changed, 33 insertions(+), 0 deletions(-) diff --git a/libavresample/x86/audio_convert.asm b/libavresample/x86/audio_convert.asm index 4811056..8f90cfa 100644 --- a/libavresample/x86/audio_convert.asm +++ b/libavresample/x86/audio_convert.asm @@ -26,6 +26,7 @@ SECTION_RODATA 32 pf_s32_inv_scale: times 8 dd 0x30000000 +pf_s32_scale: times 8 dd 0x4f000000 pf_s16_inv_scale: times 4 dd 0x38000000 pf_s16_scale: times 4 dd 0x47000000 @@ -194,6 +195,34 @@ cglobal conv_flt_to_s16, 3,3,5, dst, src, len jl .loop REP_RET +;------------------------------------------------------------------------------ +; void ff_conv_flt_to_s32(int32_t *dst, const float *src, int len); +;------------------------------------------------------------------------------ + +INIT_XMM sse2 +cglobal conv_flt_to_s32, 3,3,5, dst, src, len + lea lenq, [lend*4] + add srcq, lenq + add dstq, lenq + neg lenq + mova m4, [pf_s32_scale] +.loop: + mulps m0, m4, [srcq+lenq ] + mulps m1, m4, [srcq+lenq+1*mmsize] + mulps m2, m4, [srcq+lenq+2*mmsize] + mulps m3, m4, [srcq+lenq+3*mmsize] + cvtps2dq m0, m0 + cvtps2dq m1, m1 + cvtps2dq m2, m2 + cvtps2dq m3, m3 + mova [dstq+lenq ], m0 + mova [dstq+lenq+1*mmsize], m1 + mova [dstq+lenq+2*mmsize], m2 + mova [dstq+lenq+3*mmsize], m3 + add lenq, mmsize*4 + jl .loop + REP_RET + ;----------------------------------------------------------------------------- ; void ff_conv_fltp_to_flt_6ch(float *dst, float *const *src, int len, ; int channels); diff --git a/libavresample/x86/audio_convert_init.c b/libavresample/x86/audio_convert_init.c index fe95217..201682c 100644 --- a/libavresample/x86/audio_convert_init.c +++ b/libavresample/x86/audio_convert_init.c @@ -35,6 +35,8 @@ extern void ff_conv_s32_to_flt_avx (float *dst, const int32_t *src, int len); extern void ff_conv_flt_to_s16_sse2(int16_t *dst, const float *src, int len); +extern void ff_conv_flt_to_s32_sse2(int32_t *dst, const float *src, int len); + extern void ff_conv_fltp_to_flt_6ch_mmx(float *dst, float *const *src, int len); extern void ff_conv_fltp_to_flt_6ch_sse(float *dst, float *const *src, int len); @@ -66,6 +68,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac) 0, 16, 8, "SSE2", ff_conv_s32_to_flt_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT, 0, 16, 16, "SSE2", ff_conv_flt_to_s16_sse2); + ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT, + 0, 16, 16, "SSE2", ff_conv_flt_to_s32_sse2); } if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, -- 1.7.1 From jason at x264.com Tue May 1 23:21:08 2012 From: jason at x264.com (Jason Garrett-Glaser) Date: Tue, 1 May 2012 14:21:08 -0700 Subject: [libav-devel] [PATCH 2/6] lavr: Add x86-optimized functions for s16 to flt conversion In-Reply-To: <1335905384-19715-2-git-send-email-justin.ruggles@gmail.com> References: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> <1335905384-19715-2-git-send-email-justin.ruggles@gmail.com> Message-ID: +%if cpuflag(sse4) + pmovsxwd m0, [srcq+lenq ] + pmovsxwd m1, [srcq+lenq+mmsize/2] +%else + mova m1, [srcq+lenq] Did you forget to load m0 in the non-sse4 version? Jason From mashiat.sarker at gmail.com Tue May 1 23:27:23 2012 From: mashiat.sarker at gmail.com (Mashiat Sarker Shakkhar) Date: Tue, 1 May 2012 14:27:23 -0700 Subject: [libav-devel] [PATCH] WMAL: Fix reconstruction of audio with uncoded channel(s) In-Reply-To: <20120501191255.GA19152@kst-acer> References: <20120501191255.GA19152@kst-acer> Message-ID: <1335907643-13405-1-git-send-email-mashiat.sarker@gmail.com> From: Kostya Shishkov Signed-off-by: Mashiat Sarker Shakkhar --- libavcodec/wmalosslessdec.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c index 913271e..25599c4 100644 --- a/libavcodec/wmalosslessdec.c +++ b/libavcodec/wmalosslessdec.c @@ -654,8 +654,6 @@ static void mclms_predict(WmallDecodeCtx *s, int icoef, int *pred) int num_channels = s->num_channels; for (ich = 0; ich < num_channels; ich++) { - if (!s->is_channel_coded[ich]) - continue; pred[ich] = 0; for (i = 0; i < order * num_channels; i++) pred[ich] += s->mclms_prevvalues[i + s->mclms_recent] * @@ -789,7 +787,7 @@ static void revert_inter_ch_decorr(WmallDecodeCtx *s, int tile_size) { if (s->num_channels != 2) return; - else if (s->is_channel_coded[0] && s->is_channel_coded[1]) { + else if (s->is_channel_coded[0] || s->is_channel_coded[1]) { int icoef; for (icoef = 0; icoef < tile_size; icoef++) { s->channel_residues[0][icoef] -= s->channel_residues[1][icoef] >> 1; @@ -955,7 +953,8 @@ static int decode_subframe(WmallDecodeCtx *s) else use_normal_update_speed(s, i); revert_cdlms(s, i, 0, subframe_len); - } + } else + memset(s->channel_residues[i], 0, sizeof(**s->channel_residues) * subframe_len); } if (s->do_mclms) revert_mclms(s, subframe_len); -- 1.7.5.4 From mashiat.sarker at gmail.com Tue May 1 23:28:09 2012 From: mashiat.sarker at gmail.com (Mashiat Sarker Shakkhar) Date: Wed, 02 May 2012 03:28:09 +0600 Subject: [libav-devel] [PATCH] WMAL: Fix reconstruction of audio with uncoded channel(s) In-Reply-To: <4FA054F4.3070909@gmail.com> References: <4FA054F4.3070909@gmail.com> Message-ID: <4FA05569.5080700@gmail.com> On 5/2/2012 3:27 AM, Mashiat Sarker Shakkhar wrote: > From: Kostya Shishkov > > Signed-off-by: Mashiat Sarker Shakkhar > --- > libavcodec/wmalosslessdec.c | 7 +++---- > 1 files changed, 3 insertions(+), 4 deletions(-) [...] For the record, fixes decoding of a sample for me. (There are other broken mono samples though, which still need fixing.) Long live kshishkov. - Shakkhar From rsbultje at gmail.com Wed May 2 00:04:05 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Tue, 1 May 2012 15:04:05 -0700 Subject: [libav-devel] [PATCH 2/6] lavr: Add x86-optimized functions for s16 to flt conversion In-Reply-To: References: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> <1335905384-19715-2-git-send-email-justin.ruggles@gmail.com> Message-ID: Hi, On Tue, May 1, 2012 at 2:21 PM, Jason Garrett-Glaser wrote: > +%if cpuflag(sse4) > + ? ?pmovsxwd ? m0, [srcq+lenq ? ? ? ? ] > + ? ?pmovsxwd ? m1, [srcq+lenq+mmsize/2] > +%else > + ? ?mova ? ? ? m1, [srcq+lenq] > > Did you forget to load m0 in the non-sse4 version? punpcklwd m0, m1 Justin may have meant punpcklwd m0, m1, m1, which is AVX and thus already covered by the SSE4 one. It's just one of those days... :-). Ronald From christophe.gisquet at gmail.com Wed May 2 00:41:08 2012 From: christophe.gisquet at gmail.com (Christophe Gisquet) Date: Wed, 2 May 2012 00:41:08 +0200 Subject: [libav-devel] [PATCH 1/6] lavr: Add x86-optimized function for s16 to s32 conversion In-Reply-To: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> References: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> Message-ID: 2012/5/1 Justin Ruggles : > + ? ?mova ? ? ? m2, [srcq+lenq] > + ? ?pxor ? ? ? m0, m0 > + ? ?pxor ? ? ? m1, m1 > + ? ?punpcklwd ?m0, m2 > + ? ?punpckhwd ?m1, m2 This does not perform sign extension. Is that intended? If no: mova m0, [srcq+lenq] mova m1, m0 punpcklwd m0, m0 punpckhwd m1, m1 psrad m0, 16 psrad m1, 16 -- Christophe From jason at x264.com Wed May 2 00:53:49 2012 From: jason at x264.com (Jason Garrett-Glaser) Date: Tue, 1 May 2012 15:53:49 -0700 Subject: [libav-devel] [PATCH 1/6] lavr: Add x86-optimized function for s16 to s32 conversion In-Reply-To: References: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> Message-ID: On Tue, May 1, 2012 at 3:41 PM, Christophe Gisquet wrote: > 2012/5/1 Justin Ruggles : >> + ? ?mova ? ? ? m2, [srcq+lenq] >> + ? ?pxor ? ? ? m0, m0 >> + ? ?pxor ? ? ? m1, m1 >> + ? ?punpcklwd ?m0, m2 >> + ? ?punpckhwd ?m1, m2 > > This does not perform sign extension. Is that intended? If no: > mova m0, [srcq+lenq] > mova m1, m0 > punpcklwd ?m0, m0 > punpckhwd ?m1, m1 > psrad m0, 16 > psrad m1, 16 I believe the idea here is out = in << 16, not out = (int32_t)in. Jasson From christophe.gisquet at gmail.com Wed May 2 01:00:46 2012 From: christophe.gisquet at gmail.com (Christophe Gisquet) Date: Wed, 2 May 2012 01:00:46 +0200 Subject: [libav-devel] [PATCH 1/6] lavr: Add x86-optimized function for s16 to s32 conversion In-Reply-To: References: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> Message-ID: 2012/5/2 Jason Garrett-Glaser : > I believe the idea here is out = in << 16, not out = (int32_t)in. Seems so, after seeing the opposite operation. From lu_zero at gentoo.org Wed May 2 01:59:37 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Tue, 01 May 2012 16:59:37 -0700 Subject: [libav-devel] [PATCH] vp8: update frame size changes on thread context switches. In-Reply-To: <1335891569-835-1-git-send-email-rsbultje@gmail.com> References: <1335891569-835-1-git-send-email-rsbultje@gmail.com> Message-ID: <4FA078E9.2020004@gentoo.org> On 01/05/12 09:59, Ronald S. Bultje wrote: > From: "Ronald S. Bultje" > > This properly synchronizes frame size changes between threads if > subsequent threads abort decoding before frame size is initialized, i.e. > it prevents the thread after that from ping-ponging back to the original > value. > > Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind > --- > libavcodec/vp8.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c > index 1c973d5..d9fdd4d 100644 > --- a/libavcodec/vp8.c > +++ b/libavcodec/vp8.c > @@ -1833,6 +1833,8 @@ static int vp8_decode_update_thread_context(AVCodecContext *dst, const AVCodecCo > (s_src->mb_width != s->mb_width || s_src->mb_height != s->mb_height)) { > free_buffers(s); > s->maps_are_invalid = 1; > + s->mb_width = s_src->mb_width; > + s->mb_height = s_src->mb_height; > } > > s->prob[0] = s_src->prob[!s_src->update_probabilities]; Seems fine, I guess. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From derek.buitenhuis at gmail.com Wed May 2 03:31:44 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Tue, 1 May 2012 21:31:44 -0400 Subject: [libav-devel] [PATCH 12/14 v3] mlpdec: Fix MLP channel ordering In-Reply-To: <1335720821-3233-13-git-send-email-derek.buitenhuis@gmail.com> References: <1335720821-3233-13-git-send-email-derek.buitenhuis@gmail.com> Message-ID: <1335922304-31208-1-git-send-email-derek.buitenhuis@gmail.com> From: Carl Eugen Hoyos This is a squash of the following commits from FFmpeg: 939a12e25d956850613f9c6c416e12de305f444b Fix channel order for some MLP samples. 0aac0403c54eb7f47d5d707e1368e52763043a69 Map mlp surround channels to FFmpeg rear channels. 6daf513cf24a99ddddb7e748fc150f37bcd323f3 Fix channel order for 7.1 TrueHD samples. b9d8af03270223202c9a991655d3f75b5a8b56b5 mlpdec: fix channel order for wide 7.1 truehd layouts 1af0ace3a4b8aa8c6240a99de3c40f495ab279e9 Fix channel order for some less common TrueHD layouts. One fix by Hendrik Leppkes. Signed-off-by: Derek Buitenhuis --- libavcodec/mlp_parser.c | 18 +++++++++--------- libavcodec/mlpdec.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c index 1879e00..351908f 100644 --- a/libavcodec/mlp_parser.c +++ b/libavcodec/mlp_parser.c @@ -47,24 +47,24 @@ static const uint64_t mlp_layout[32] = { AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO, AV_CH_LAYOUT_2_1, - AV_CH_LAYOUT_2_2, + AV_CH_LAYOUT_QUAD, AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY, AV_CH_LAYOUT_2_1|AV_CH_LOW_FREQUENCY, - AV_CH_LAYOUT_2_2|AV_CH_LOW_FREQUENCY, + AV_CH_LAYOUT_QUAD|AV_CH_LOW_FREQUENCY, AV_CH_LAYOUT_SURROUND, AV_CH_LAYOUT_4POINT0, - AV_CH_LAYOUT_5POINT0, + AV_CH_LAYOUT_5POINT0_BACK, AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY, AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY, - AV_CH_LAYOUT_5POINT1, + AV_CH_LAYOUT_5POINT1_BACK, AV_CH_LAYOUT_4POINT0, - AV_CH_LAYOUT_5POINT0, + AV_CH_LAYOUT_5POINT0_BACK, AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY, AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY, - AV_CH_LAYOUT_5POINT1, - AV_CH_LAYOUT_2_2|AV_CH_LOW_FREQUENCY, - AV_CH_LAYOUT_5POINT0, - AV_CH_LAYOUT_5POINT1, + AV_CH_LAYOUT_5POINT1_BACK, + AV_CH_LAYOUT_QUAD|AV_CH_LOW_FREQUENCY, + AV_CH_LAYOUT_5POINT0_BACK, + AV_CH_LAYOUT_5POINT1_BACK, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index 30310db..89ce0a3 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -29,6 +29,7 @@ #include "avcodec.h" #include "dsputil.h" #include "libavutil/intreadwrite.h" +#include "libavutil/audioconvert.h" #include "get_bits.h" #include "libavutil/crc.h" #include "parser.h" @@ -128,6 +129,9 @@ typedef struct MLPDecodeContext { /// Index of the last substream to decode - further substreams are skipped. uint8_t max_decoded_substream; + /// Stream needs channel reordering to comply with Libav's channel order + uint8_t needs_reordering; + /// number of PCM samples contained in each frame int access_unit_size; /// next power of two above the number of samples in each frame @@ -324,6 +328,8 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb) for (substr = 0; substr < MAX_SUBSTREAMS; substr++) m->substream[substr].restart_seen = 0; + m->needs_reordering = mh.channels_mlp >= 18 && mh.channels_mlp <= 20; + return 0; } @@ -434,6 +440,33 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp, s->ch_assign[ch_assign] = ch; } + if (m->avctx->codec_id == CODEC_ID_MLP && m->needs_reordering) { + if (m->avctx->channel_layout == (AV_CH_LAYOUT_QUAD|AV_CH_LOW_FREQUENCY) || + m->avctx->channel_layout == AV_CH_LAYOUT_5POINT0_BACK) { + int i = s->ch_assign[4]; + s->ch_assign[4] = s->ch_assign[3]; + s->ch_assign[3] = s->ch_assign[2]; + s->ch_assign[2] = i; + } else if (m->avctx->channel_layout == AV_CH_LAYOUT_5POINT1_BACK) { + FFSWAP(int, s->ch_assign[2], s->ch_assign[4]); + FFSWAP(int, s->ch_assign[3], s->ch_assign[5]); + } + } + if (m->avctx->codec_id == CODEC_ID_TRUEHD) { + if (m->avctx->channel_layout == AV_CH_LAYOUT_7POINT1 || + m->avctx->channel_layout == AV_CH_LAYOUT_7POINT1_WIDE) { + FFSWAP(int, s->ch_assign[4], s->ch_assign[6]); + FFSWAP(int, s->ch_assign[5], s->ch_assign[7]); + } else if (m->avctx->channel_layout == AV_CH_LAYOUT_6POINT1 || + m->avctx->channel_layout == (AV_CH_LAYOUT_6POINT1 | AV_CH_TOP_CENTER) || + m->avctx->channel_layout == (AV_CH_LAYOUT_6POINT1 | AV_CH_TOP_FRONT_CENTER)) { + int i = s->ch_assign[6]; + s->ch_assign[6] = s->ch_assign[5]; + s->ch_assign[5] = s->ch_assign[4]; + s->ch_assign[4] = i; + } + } + checksum = ff_mlp_restart_checksum(buf, get_bits_count(gbp) - start_count); if (checksum != get_bits(gbp, 8)) -- 1.7.10 From derek.buitenhuis at gmail.com Wed May 2 03:32:10 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Tue, 01 May 2012 21:32:10 -0400 Subject: [libav-devel] [PATCH 12/14 v2] mlpdec: Fix MLP channel ordering In-Reply-To: <4F9D8A25.1070707@gmail.com> References: <4F9D8148.9010606@gmail.com> <1335723403-32154-1-git-send-email-derek.buitenhuis@gmail.com> <4F9D8932.8030903@gmail.com> <4F9D8A25.1070707@gmail.com> Message-ID: <4FA08E9A.9050404@gmail.com> On 29/04/2012 2:36 PM, Derek Buitenhuis wrote: > Fixed locally. Looks like I forgot some stuff. v3 patch sent. - Derek From derek.buitenhuis at gmail.com Wed May 2 03:51:41 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Tue, 1 May 2012 21:51:41 -0400 Subject: [libav-devel] [PATCH] gitignore: add Win32 library suffixes In-Reply-To: <20120429205749.GC9797@pool.informatik.rwth-aachen.de> References: <20120429205749.GC9797@pool.informatik.rwth-aachen.de> Message-ID: <1335923501-19596-1-git-send-email-derek.buitenhuis@gmail.com> From: Joakim Plate Signed-off-by: Michael Niedermayer --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 31a02c0..7450234 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,11 @@ *.a *.o *.d +*.def +*.dll *.exe *.ho +*.lib *.pc *.so *.so.* -- 1.7.10 From lu_zero at gentoo.org Wed May 2 06:23:17 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Tue, 01 May 2012 21:23:17 -0700 Subject: [libav-devel] [PATCH] gitignore: add Win32 library suffixes In-Reply-To: <1335923501-19596-1-git-send-email-derek.buitenhuis@gmail.com> References: <20120429205749.GC9797@pool.informatik.rwth-aachen.de> <1335923501-19596-1-git-send-email-derek.buitenhuis@gmail.com> Message-ID: <4FA0B6B5.1030202@gentoo.org> On 01/05/12 18:51, Derek Buitenhuis wrote: > From: Joakim Plate > Perfect =) lu -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From samuel.pitoiset at gmail.com Wed May 2 10:41:32 2012 From: samuel.pitoiset at gmail.com (Samuel Pitoiset) Date: Wed, 2 May 2012 10:41:32 +0200 Subject: [libav-devel] [PATCH] rtmp: Support 'rtmp_live', an option which specifies if the media is a live stream. In-Reply-To: References: Message-ID: <1335948092-760-1-git-send-email-samuel.pitoiset@gmail.com> --- libavformat/rtmpproto.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 9cdb639..9a02db2 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -66,6 +66,7 @@ typedef struct RTMPContext { int chunk_size; ///< size of the chunks RTMP packets are divided into int is_input; ///< input/output flag char *playpath; ///< stream identifier to play (with possible "mp4:" prefix) + int live; ///< 0: recorded, -1: live, -2: both char *app; ///< name of application ClientState state; ///< current state int main_channel_id; ///< an additional channel ID which is used for some invocations @@ -287,7 +288,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", rt->playpath); ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, - 20 + strlen(rt->playpath)); + 32 + strlen(rt->playpath)); pkt.extra = rt->main_channel_id; p = pkt.data; @@ -295,6 +296,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) ff_amf_write_number(&p, ++rt->nb_invokes); ff_amf_write_null(&p); ff_amf_write_string(&p, rt->playpath); + ff_amf_write_number(&p, rt->live); ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]); ff_rtmp_packet_destroy(&pkt); @@ -1050,6 +1052,7 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size) static const AVOption rtmp_options[] = { {"rtmp_app", "Name of application to connect to on the RTMP server", OFFSET(app), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, + {"rtmp_live", "Specify that the media is a live stream.", OFFSET(live), AV_OPT_TYPE_INT, {-2}, -2, 0, DEC}, {"rtmp_playpath", "Stream identifier to play or to publish", OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, { NULL }, }; -- 1.7.7.5 (Apple Git-26) From martin at martin.st Wed May 2 11:09:40 2012 From: martin at martin.st (=?ISO-8859-15?Q?Martin_Storsj=F6?=) Date: Wed, 2 May 2012 12:09:40 +0300 (EEST) Subject: [libav-devel] [PATCH] rtmp: Support 'rtmp_live', an option which specifies if the media is a live stream. In-Reply-To: <1335948092-760-1-git-send-email-samuel.pitoiset@gmail.com> References: <1335948092-760-1-git-send-email-samuel.pitoiset@gmail.com> Message-ID: On Wed, 2 May 2012, Samuel Pitoiset wrote: > --- > libavformat/rtmpproto.c | 5 ++++- > 1 files changed, 4 insertions(+), 1 deletions(-) > > diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c > index 9cdb639..9a02db2 100644 > --- a/libavformat/rtmpproto.c > +++ b/libavformat/rtmpproto.c > @@ -66,6 +66,7 @@ typedef struct RTMPContext { > int chunk_size; ///< size of the chunks RTMP packets are divided into > int is_input; ///< input/output flag > char *playpath; ///< stream identifier to play (with possible "mp4:" prefix) > + int live; ///< 0: recorded, -1: live, -2: both > char *app; ///< name of application > ClientState state; ///< current state > int main_channel_id; ///< an additional channel ID which is used for some invocations > @@ -287,7 +288,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) > > av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", rt->playpath); > ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, > - 20 + strlen(rt->playpath)); > + 32 + strlen(rt->playpath)); > pkt.extra = rt->main_channel_id; > > p = pkt.data; > @@ -295,6 +296,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) > ff_amf_write_number(&p, ++rt->nb_invokes); > ff_amf_write_null(&p); > ff_amf_write_string(&p, rt->playpath); > + ff_amf_write_number(&p, rt->live); So, passing -2 here is equivalent to leaving it out, as we did before? (I haven't read the spec about this.) > > ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]); > ff_rtmp_packet_destroy(&pkt); > @@ -1050,6 +1052,7 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size) > > static const AVOption rtmp_options[] = { > {"rtmp_app", "Name of application to connect to on the RTMP server", OFFSET(app), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, > + {"rtmp_live", "Specify that the media is a live stream.", OFFSET(live), AV_OPT_TYPE_INT, {-2}, -2, 0, DEC}, > {"rtmp_playpath", "Stream identifier to play or to publish", OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, > { NULL }, I'd like to have info about the parameter values here in the description too - users of the protocol code are more likely to read it there than from the code comment above. // Martin From samuel.pitoiset at gmail.com Wed May 2 11:19:36 2012 From: samuel.pitoiset at gmail.com (Samuel Pitoiset) Date: Wed, 2 May 2012 11:19:36 +0200 Subject: [libav-devel] [PATCH] rtmp: Support 'rtmp_live', an option which specifies if the media is a live stream. In-Reply-To: References: <1335948092-760-1-git-send-email-samuel.pitoiset@gmail.com> Message-ID: On Wed, May 2, 2012 at 11:09 AM, Martin Storsj? wrote: > On Wed, 2 May 2012, Samuel Pitoiset wrote: > > --- >> libavformat/rtmpproto.c | 5 ++++- >> 1 files changed, 4 insertions(+), 1 deletions(-) >> >> diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c >> index 9cdb639..9a02db2 100644 >> --- a/libavformat/rtmpproto.c >> +++ b/libavformat/rtmpproto.c >> @@ -66,6 +66,7 @@ typedef struct RTMPContext { >> int chunk_size; ///< size of the chunks RTMP >> packets are divided into >> int is_input; ///< input/output flag >> char *playpath; ///< stream identifier to >> play (with possible "mp4:" prefix) >> + int live; ///< 0: recorded, -1: >> live, -2: both >> char *app; ///< name of application >> ClientState state; ///< current state >> int main_channel_id; ///< an additional channel >> ID which is used for some invocations >> @@ -287,7 +288,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) >> >> av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", >> rt->playpath); >> ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, >> - 20 + strlen(rt->playpath)); >> + 32 + strlen(rt->playpath)); >> pkt.extra = rt->main_channel_id; >> >> p = pkt.data; >> @@ -295,6 +296,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) >> ff_amf_write_number(&p, ++rt->nb_invokes); >> ff_amf_write_null(&p); >> ff_amf_write_string(&p, rt->playpath); >> + ff_amf_write_number(&p, rt->live); >> > > So, passing -2 here is equivalent to leaving it out, as we did before? (I > haven't read the spec about this.) Indeed, -2 is the default value of that parameter. In this case, the subscriber first tries to play the live stream and if it's not found it tries to play the recorded stream. If you pass -1, only the live stream is played. And if you pass 0, only the recorded stream is played. > > >> ff_rtmp_packet_write(rt->**stream, &pkt, rt->chunk_size, >> rt->prev_pkt[1]); >> ff_rtmp_packet_destroy(&pkt); >> @@ -1050,6 +1052,7 @@ static int rtmp_write(URLContext *s, const uint8_t >> *buf, int size) >> >> static const AVOption rtmp_options[] = { >> {"rtmp_app", "Name of application to connect to on the RTMP server", >> OFFSET(app), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, >> + {"rtmp_live", "Specify that the media is a live stream.", >> OFFSET(live), AV_OPT_TYPE_INT, {-2}, -2, 0, DEC}, >> {"rtmp_playpath", "Stream identifier to play or to publish", >> OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, >> { NULL }, >> > > I'd like to have info about the parameter values here in the description > too - users of the protocol code are more likely to read it there than from > the code comment above. > > "Specify that the media is a live stream (0: recorded stream, -1: live stream, -2: both)." It's better ? // Martin > > ______________________________**_________________ > libav-devel mailing list > libav-devel at libav.org > https://lists.libav.org/**mailman/listinfo/libav-devel > -- Best regards, Samuel Pitoiset. -------------- next part -------------- An HTML attachment was scrubbed... URL: From martin at martin.st Wed May 2 11:23:47 2012 From: martin at martin.st (=?ISO-8859-15?Q?Martin_Storsj=F6?=) Date: Wed, 2 May 2012 12:23:47 +0300 (EEST) Subject: [libav-devel] [PATCH] rtmp: Support 'rtmp_live', an option which specifies if the media is a live stream. In-Reply-To: References: <1335948092-760-1-git-send-email-samuel.pitoiset@gmail.com> Message-ID: On Wed, 2 May 2012, Samuel Pitoiset wrote: > > > On Wed, May 2, 2012 at 11:09 AM, Martin Storsj? wrote: > On Wed, 2 May 2012, Samuel Pitoiset wrote: > > --- > libavformat/rtmpproto.c | ? ?5 ++++- > 1 files changed, 4 insertions(+), 1 deletions(-) > > diff --git a/libavformat/rtmpproto.c > b/libavformat/rtmpproto.c > index 9cdb639..9a02db2 100644 > --- a/libavformat/rtmpproto.c > +++ b/libavformat/rtmpproto.c > @@ -66,6 +66,7 @@ typedef struct RTMPContext { > ? ?int ? ? ? ? ? chunk_size; ? ? ? ? ? ? ? ? ///< > size of the chunks RTMP packets are divided into > ? ?int ? ? ? ? ? is_input; ? ? ? ? ? ? ? ? ? ///< > input/output flag > ? ?char ? ? ? ? ?*playpath; ? ? ? ? ? ? ? ? ?///< > stream identifier to play (with possible "mp4:" > prefix) > + ? ?int ? ? ? ? ? live; ? ? ? ? ? ? ? ? ? ? ? ///< > 0: recorded, -1: live, -2: both > ? ?char ? ? ? ? ?*app; ? ? ? ? ? ? ? ? ? ? ? ///< > name of application > ? ?ClientState ? state; ? ? ? ? ? ? ? ? ? ? ?///< > current state > ? ?int ? ? ? ? ? main_channel_id; ? ? ? ? ? ?///< an > additional channel ID which is used for some > invocations > @@ -287,7 +288,7 @@ static void gen_play(URLContext > *s, RTMPContext *rt) > > ? ?av_log(s, AV_LOG_DEBUG, "Sending play command for > '%s'\n", rt->playpath); > ? ?ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, > RTMP_PT_INVOKE, 0, > - ? ? ? ? ? ? ? ? ? ? ? ? ?20 + > strlen(rt->playpath)); > + ? ? ? ? ? ? ? ? ? ? ? ? ?32 + > strlen(rt->playpath)); > ? ?pkt.extra = rt->main_channel_id; > > ? ?p = pkt.data; > @@ -295,6 +296,7 @@ static void gen_play(URLContext > *s, RTMPContext *rt) > ? ?ff_amf_write_number(&p, ++rt->nb_invokes); > ? ?ff_amf_write_null(&p); > ? ?ff_amf_write_string(&p, rt->playpath); > + ? ?ff_amf_write_number(&p, rt->live); > > > So, passing -2 here is equivalent to leaving it out, as we did before? > (I haven't read the spec about this.) > > > Indeed, -2 is the default value of that parameter. In this case, the > subscriber first tries to play the live stream and if it's not found it > tries to play the recorded stream. If you pass -1, only the live stream is > played. And if you pass 0, only the recorded stream is played. > > > > > ? ?ff_rtmp_packet_write(rt->stream, &pkt, > rt->chunk_size, rt->prev_pkt[1]); > ? ?ff_rtmp_packet_destroy(&pkt); > @@ -1050,6 +1052,7 @@ static int > rtmp_write(URLContext *s, const uint8_t *buf, int > size) > > static const AVOption rtmp_options[] = { > ? ?{"rtmp_app", "Name of application to connect to > on the RTMP server", OFFSET(app), > AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, > + ? ?{"rtmp_live", "Specify that the media is a live > stream.", OFFSET(live), AV_OPT_TYPE_INT, {-2}, -2, > 0, DEC}, > ? ?{"rtmp_playpath", "Stream identifier to play or > to publish", OFFSET(playpath), AV_OPT_TYPE_STRING, > {.str = NULL }, 0, 0, DEC|ENC}, > ? ?{ NULL }, > > > I'd like to have info about the parameter values here in the > description too - users of the protocol code are more likely to read > it there than from the code comment above. > > "Specify that the media is a live stream (0: recorded stream, -1: live > stream, -2: both)." It's better ? Yes, that sounds ok to me. // Martin From samuel.pitoiset at gmail.com Wed May 2 12:18:40 2012 From: samuel.pitoiset at gmail.com (Samuel Pitoiset) Date: Wed, 2 May 2012 12:18:40 +0200 Subject: [libav-devel] [PATCH] rtmp: Support 'rtmp_live', an option which specifies if the media is a live stream. In-Reply-To: References: Message-ID: <1335953920-794-1-git-send-email-samuel.pitoiset@gmail.com> --- libavformat/rtmpproto.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 9cdb639..297186c 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -66,6 +66,7 @@ typedef struct RTMPContext { int chunk_size; ///< size of the chunks RTMP packets are divided into int is_input; ///< input/output flag char *playpath; ///< stream identifier to play (with possible "mp4:" prefix) + int live; ///< 0: recorded, -1: live, -2: both char *app; ///< name of application ClientState state; ///< current state int main_channel_id; ///< an additional channel ID which is used for some invocations @@ -287,7 +288,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", rt->playpath); ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, - 20 + strlen(rt->playpath)); + 32 + strlen(rt->playpath)); pkt.extra = rt->main_channel_id; p = pkt.data; @@ -295,6 +296,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) ff_amf_write_number(&p, ++rt->nb_invokes); ff_amf_write_null(&p); ff_amf_write_string(&p, rt->playpath); + ff_amf_write_number(&p, rt->live); ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]); ff_rtmp_packet_destroy(&pkt); @@ -1050,6 +1052,7 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size) static const AVOption rtmp_options[] = { {"rtmp_app", "Name of application to connect to on the RTMP server", OFFSET(app), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, + {"rtmp_live", "Specify that the media is a live stream (0: recorded stream, -1: live stream, -2: both).", OFFSET(live), AV_OPT_TYPE_INT, {-2}, -2, 0, DEC}, {"rtmp_playpath", "Stream identifier to play or to publish", OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, { NULL }, }; -- 1.7.7.5 (Apple Git-26) From mans at mansr.com Wed May 2 14:34:47 2012 From: mans at mansr.com (Mans Rullgard) Date: Wed, 2 May 2012 13:34:47 +0100 Subject: [libav-devel] [PATCH] arm: intreadwrite: fix inline asm constraints for gcc 4.6 and later Message-ID: <1335962087-25862-1-git-send-email-mans@mansr.com> With a dereferenced type-cast pointer as memory operand, gcc 4.6 and later will sometimes copy the data to a temporary location, the address of which is used as the operand value, if it thinks the target address might be misaligned. Using a pointer to a packed struct type instead does the right thing. The 16-bit case is special since the ldrh instruction addressing modes are limited compared to ldr. The "Uq" constraint produces a memory reference suitable for an ldrsb instruction, which supports the same addressing modes as ldrh. However, the restrictions appear to apply only when the operand addresses a single byte. The memory reference must thus be split into two operands each targeting one byte. Finally, the "Uq" constraint is only available in ARM mode. The Thumb-2 ldrh instruction supports most addressing modes so the normal "m" constraint can be used there. Signed-off-by: Mans Rullgard --- libavutil/arm/intreadwrite.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavutil/arm/intreadwrite.h b/libavutil/arm/intreadwrite.h index 613abe5..ec92d4d 100644 --- a/libavutil/arm/intreadwrite.h +++ b/libavutil/arm/intreadwrite.h @@ -27,8 +27,13 @@ #define AV_RN16 AV_RN16 static av_always_inline unsigned AV_RN16(const void *p) { + const uint8_t *q = p; unsigned v; - __asm__ ("ldrh %0, %1" : "=r"(v) : "m"(*(const uint16_t *)p)); +#ifdef __thumb__ + __asm__ ("ldrh %0, %1" : "=r"(v) : "m"(q[0]), "m"(q[1])); +#else + __asm__ ("ldrh %0, %1" : "=r"(v) : "Uq"(q[0]), "m"(q[1])); +#endif return v; } @@ -41,8 +46,9 @@ static av_always_inline void AV_WN16(void *p, uint16_t v) #define AV_RN32 AV_RN32 static av_always_inline uint32_t AV_RN32(const void *p) { + const struct __attribute__((packed)) { uint32_t v; } *q = p; uint32_t v; - __asm__ ("ldr %0, %1" : "=r"(v) : "m"(*(const uint32_t *)p)); + __asm__ ("ldr %0, %1" : "=r"(v) : "m"(*q)); return v; } @@ -55,11 +61,12 @@ static av_always_inline void AV_WN32(void *p, uint32_t v) #define AV_RN64 AV_RN64 static av_always_inline uint64_t AV_RN64(const void *p) { + const struct __attribute__((packed)) { uint32_t v; } *q = p; uint64_t v; __asm__ ("ldr %Q0, %1 \n\t" "ldr %R0, %2 \n\t" : "=&r"(v) - : "m"(*(const uint32_t*)p), "m"(*((const uint32_t*)p+1))); + : "m"(q[0]), "m"(q[1])); return v; } -- 1.7.10 From kostya.shishkov at gmail.com Wed May 2 14:38:49 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Wed, 2 May 2012 14:38:49 +0200 Subject: [libav-devel] [PATCH] arm: intreadwrite: fix inline asm constraints for gcc 4.6 and later In-Reply-To: <1335962087-25862-1-git-send-email-mans@mansr.com> References: <1335962087-25862-1-git-send-email-mans@mansr.com> Message-ID: <20120502123849.GA20423@kst-acer> On Wed, May 02, 2012 at 01:34:47PM +0100, Mans Rullgard wrote: > With a dereferenced type-cast pointer as memory operand, gcc 4.6 > and later will sometimes copy the data to a temporary location, > the address of which is used as the operand value, if it thinks > the target address might be misaligned. Using a pointer to a > packed struct type instead does the right thing. > > The 16-bit case is special since the ldrh instruction addressing > modes are limited compared to ldr. The "Uq" constraint produces a > memory reference suitable for an ldrsb instruction, which supports > the same addressing modes as ldrh. However, the restrictions appear > to apply only when the operand addresses a single byte. The memory > reference must thus be split into two operands each targeting one > byte. Finally, the "Uq" constraint is only available in ARM mode. > The Thumb-2 ldrh instruction supports most addressing modes so the > normal "m" constraint can be used there. > > Signed-off-by: Mans Rullgard > --- > libavutil/arm/intreadwrite.h | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) LGTM From diego at biurrun.de Wed May 2 15:29:24 2012 From: diego at biurrun.de (Diego Biurrun) Date: Wed, 02 May 2012 15:29:24 +0200 Subject: [libav-devel] [PATCH] snowdsp: explicitely state instruction size. In-Reply-To: <1335889964-92669-1-git-send-email-rsbultje@gmail.com> References: <1335889964-92669-1-git-send-email-rsbultje@gmail.com> Message-ID: <20120502132924.GA18174@pool.informatik.rwth-aachen.de> On Tue, May 01, 2012 at 09:32:44AM -0700, Ronald S. Bultje wrote: > From: "Ronald S. Bultje" expliciTLy Diego From diego at biurrun.de Wed May 2 15:34:23 2012 From: diego at biurrun.de (Diego Biurrun) Date: Wed, 02 May 2012 15:34:23 +0200 Subject: [libav-devel] [PATCH] WMAL: Do not start decoding if frame does not end in current packet In-Reply-To: <1335801395-11480-1-git-send-email-mashiat.sarker@gmail.com> References: <1335637459-29418-1-git-send-email-mashiat.sarker@gmail.com> <1335801395-11480-1-git-send-email-mashiat.sarker@gmail.com> Message-ID: <20120502133423.GB18174@pool.informatik.rwth-aachen.de> On Mon, Apr 30, 2012 at 08:56:35AM -0700, Mashiat Sarker Shakkhar wrote: > This fixes decoding of frames which span more than two packets. Tested with > > --- a/libavcodec/wmalosslessdec.c > +++ b/libavcodec/wmalosslessdec.c > @@ -1209,8 +1209,8 @@ static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr, > > /* decode the cross packet frame if it is valid */ > - if (!s->packet_loss) > - decode_frame(s); > + if (num_bits_prev_frame < remaining_packet_bits && !s->packet_loss) > + decode_frame(s); Indentation is off. It seems you coalesced the two if-statements without fixing the indentation of the statement following the second if. Diego From mans at mansr.com Wed May 2 16:10:07 2012 From: mans at mansr.com (Mans Rullgard) Date: Wed, 2 May 2012 15:10:07 +0100 Subject: [libav-devel] [PATCH] arm: intreadwrite: disable inline asm for gcc 4.7 and later Message-ID: <1335967807-6544-1-git-send-email-mans@mansr.com> Starting with version 4.7, gcc properly supports unaligned memory accesses on ARM. Not using the inline asm with these compilers results in better code. Signed-off-by: Mans Rullgard --- libavutil/arm/intreadwrite.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavutil/arm/intreadwrite.h b/libavutil/arm/intreadwrite.h index ec92d4d..86b93c9 100644 --- a/libavutil/arm/intreadwrite.h +++ b/libavutil/arm/intreadwrite.h @@ -21,8 +21,9 @@ #include #include "config.h" +#include "libavutil/attributes.h" -#if HAVE_FAST_UNALIGNED && HAVE_INLINE_ASM +#if HAVE_FAST_UNALIGNED && HAVE_INLINE_ASM && !AV_GCC_VERSION_AT_LEAST(4,7) #define AV_RN16 AV_RN16 static av_always_inline unsigned AV_RN16(const void *p) -- 1.7.10 From lu_zero at gentoo.org Wed May 2 17:00:51 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Wed, 02 May 2012 08:00:51 -0700 Subject: [libav-devel] [PATCH] rtmp: Support 'rtmp_live', an option which specifies if the media is a live stream. In-Reply-To: References: <1335948092-760-1-git-send-email-samuel.pitoiset@gmail.com> Message-ID: <4FA14C23.5020700@gentoo.org> On 02/05/12 02:19, Samuel Pitoiset wrote: > On Wed, May 2, 2012 at 11:09 AM, Martin Storsj? wrote: > >> On Wed, 2 May 2012, Samuel Pitoiset wrote: >> >> --- >>> libavformat/rtmpproto.c | 5 ++++- >>> 1 files changed, 4 insertions(+), 1 deletions(-) >>> >>> diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c >>> index 9cdb639..9a02db2 100644 >>> --- a/libavformat/rtmpproto.c >>> +++ b/libavformat/rtmpproto.c >>> @@ -66,6 +66,7 @@ typedef struct RTMPContext { >>> int chunk_size; ///< size of the chunks RTMP >>> packets are divided into >>> int is_input; ///< input/output flag >>> char *playpath; ///< stream identifier to >>> play (with possible "mp4:" prefix) >>> + int live; ///< 0: recorded, -1: >>> live, -2: both >>> char *app; ///< name of application >>> ClientState state; ///< current state >>> int main_channel_id; ///< an additional channel >>> ID which is used for some invocations >>> @@ -287,7 +288,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) >>> >>> av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", >>> rt->playpath); >>> ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, >>> - 20 + strlen(rt->playpath)); >>> + 32 + strlen(rt->playpath)); >>> pkt.extra = rt->main_channel_id; >>> >>> p = pkt.data; >>> @@ -295,6 +296,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) >>> ff_amf_write_number(&p, ++rt->nb_invokes); >>> ff_amf_write_null(&p); >>> ff_amf_write_string(&p, rt->playpath); >>> + ff_amf_write_number(&p, rt->live); >>> >> >> So, passing -2 here is equivalent to leaving it out, as we did before? (I >> haven't read the spec about this.) > > > Indeed, -2 is the default value of that parameter. In this case, the > subscriber first tries to play the live stream and if it's not found it > tries to play the recorded stream. If you pass -1, only the live stream is > played. And if you pass 0, only the recorded stream is played. > > >> >> >>> ff_rtmp_packet_write(rt->**stream, &pkt, rt->chunk_size, >>> rt->prev_pkt[1]); >>> ff_rtmp_packet_destroy(&pkt); >>> @@ -1050,6 +1052,7 @@ static int rtmp_write(URLContext *s, const uint8_t >>> *buf, int size) >>> >>> static const AVOption rtmp_options[] = { >>> {"rtmp_app", "Name of application to connect to on the RTMP server", >>> OFFSET(app), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, >>> + {"rtmp_live", "Specify that the media is a live stream.", >>> OFFSET(live), AV_OPT_TYPE_INT, {-2}, -2, 0, DEC}, >>> {"rtmp_playpath", "Stream identifier to play or to publish", >>> OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, >>> { NULL }, >>> >> >> I'd like to have info about the parameter values here in the description >> too - users of the protocol code are more likely to read it there than from >> the code comment above. >> >> "Specify that the media is a live stream (0: recorded stream, -1: live > stream, -2: both)." It's better ? > Make AV_OPT_TYPE_CONST options so people can use mnemonics. Beside that, did you test it? I hadn't compared its output to the librtmp one but seems that at least certain rtmp servers aren't responding as expected. I'll get you a bunch of test places soon. lu -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Wed May 2 17:01:48 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Wed, 02 May 2012 08:01:48 -0700 Subject: [libav-devel] [PATCH] arm: intreadwrite: disable inline asm for gcc 4.7 and later In-Reply-To: <1335967807-6544-1-git-send-email-mans@mansr.com> References: <1335967807-6544-1-git-send-email-mans@mansr.com> Message-ID: <4FA14C5C.5080403@gentoo.org> On 02/05/12 07:10, Mans Rullgard wrote: > Starting with version 4.7, gcc properly supports unaligned > memory accesses on ARM. Not using the inline asm with these > compilers results in better code. Ok. lu -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From martin at martin.st Wed May 2 17:12:41 2012 From: martin at martin.st (=?ISO-8859-15?Q?Martin_Storsj=F6?=) Date: Wed, 2 May 2012 18:12:41 +0300 (EEST) Subject: [libav-devel] [PATCH] rtmp: Support 'rtmp_live', an option which specifies if the media is a live stream. In-Reply-To: <4FA14C23.5020700@gentoo.org> References: <1335948092-760-1-git-send-email-samuel.pitoiset@gmail.com> <4FA14C23.5020700@gentoo.org> Message-ID: On Wed, 2 May 2012, Luca Barbato wrote: > On 02/05/12 02:19, Samuel Pitoiset wrote: >> On Wed, May 2, 2012 at 11:09 AM, Martin Storsj? wrote: >> >>> On Wed, 2 May 2012, Samuel Pitoiset wrote: >>> >>> --- >>>> libavformat/rtmpproto.c | 5 ++++- >>>> 1 files changed, 4 insertions(+), 1 deletions(-) >>>> >>>> diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c >>>> index 9cdb639..9a02db2 100644 >>>> --- a/libavformat/rtmpproto.c >>>> +++ b/libavformat/rtmpproto.c >>>> @@ -66,6 +66,7 @@ typedef struct RTMPContext { >>>> int chunk_size; ///< size of the chunks RTMP >>>> packets are divided into >>>> int is_input; ///< input/output flag >>>> char *playpath; ///< stream identifier to >>>> play (with possible "mp4:" prefix) >>>> + int live; ///< 0: recorded, -1: >>>> live, -2: both >>>> char *app; ///< name of application >>>> ClientState state; ///< current state >>>> int main_channel_id; ///< an additional channel >>>> ID which is used for some invocations >>>> @@ -287,7 +288,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) >>>> >>>> av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", >>>> rt->playpath); >>>> ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, >>>> - 20 + strlen(rt->playpath)); >>>> + 32 + strlen(rt->playpath)); >>>> pkt.extra = rt->main_channel_id; >>>> >>>> p = pkt.data; >>>> @@ -295,6 +296,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) >>>> ff_amf_write_number(&p, ++rt->nb_invokes); >>>> ff_amf_write_null(&p); >>>> ff_amf_write_string(&p, rt->playpath); >>>> + ff_amf_write_number(&p, rt->live); >>>> >>> >>> So, passing -2 here is equivalent to leaving it out, as we did before? (I >>> haven't read the spec about this.) >> >> >> Indeed, -2 is the default value of that parameter. In this case, the >> subscriber first tries to play the live stream and if it's not found it >> tries to play the recorded stream. If you pass -1, only the live stream is >> played. And if you pass 0, only the recorded stream is played. >> >> >>> >>> >>>> ff_rtmp_packet_write(rt->**stream, &pkt, rt->chunk_size, >>>> rt->prev_pkt[1]); >>>> ff_rtmp_packet_destroy(&pkt); >>>> @@ -1050,6 +1052,7 @@ static int rtmp_write(URLContext *s, const uint8_t >>>> *buf, int size) >>>> >>>> static const AVOption rtmp_options[] = { >>>> {"rtmp_app", "Name of application to connect to on the RTMP server", >>>> OFFSET(app), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, >>>> + {"rtmp_live", "Specify that the media is a live stream.", >>>> OFFSET(live), AV_OPT_TYPE_INT, {-2}, -2, 0, DEC}, >>>> {"rtmp_playpath", "Stream identifier to play or to publish", >>>> OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, >>>> { NULL }, >>>> >>> >>> I'd like to have info about the parameter values here in the description >>> too - users of the protocol code are more likely to read it there than from >>> the code comment above. >>> >>> "Specify that the media is a live stream (0: recorded stream, -1: live >> stream, -2: both)." It's better ? >> > > Make AV_OPT_TYPE_CONST options so people can use mnemonics. > > Beside that, did you test it? I hadn't compared its output to the > librtmp one but seems that at least certain rtmp servers aren't > responding as expected. I'll get you a bunch of test places soon. Btw, according to the librtmp sources, the same parameter is used as time for seeking to, in recorded files, and librtmp seems to send -1000 as value for live streams? Or is it just a different scaling used for the values? // Martin From samuel.pitoiset at gmail.com Wed May 2 17:24:24 2012 From: samuel.pitoiset at gmail.com (Samuel Pitoiset) Date: Wed, 2 May 2012 17:24:24 +0200 Subject: [libav-devel] [PATCH] rtmp: Support 'rtmp_live', an option which specifies if the media is a live stream. In-Reply-To: <4FA14C23.5020700@gentoo.org> References: <1335948092-760-1-git-send-email-samuel.pitoiset@gmail.com> <4FA14C23.5020700@gentoo.org> Message-ID: On Wed, May 2, 2012 at 5:00 PM, Luca Barbato wrote: > On 02/05/12 02:19, Samuel Pitoiset wrote: > > On Wed, May 2, 2012 at 11:09 AM, Martin Storsj? > wrote: > > > >> On Wed, 2 May 2012, Samuel Pitoiset wrote: > >> > >> --- > >>> libavformat/rtmpproto.c | 5 ++++- > >>> 1 files changed, 4 insertions(+), 1 deletions(-) > >>> > >>> diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c > >>> index 9cdb639..9a02db2 100644 > >>> --- a/libavformat/rtmpproto.c > >>> +++ b/libavformat/rtmpproto.c > >>> @@ -66,6 +66,7 @@ typedef struct RTMPContext { > >>> int chunk_size; ///< size of the chunks > RTMP > >>> packets are divided into > >>> int is_input; ///< input/output flag > >>> char *playpath; ///< stream identifier to > >>> play (with possible "mp4:" prefix) > >>> + int live; ///< 0: recorded, -1: > >>> live, -2: both > >>> char *app; ///< name of application > >>> ClientState state; ///< current state > >>> int main_channel_id; ///< an additional channel > >>> ID which is used for some invocations > >>> @@ -287,7 +288,7 @@ static void gen_play(URLContext *s, RTMPContext > *rt) > >>> > >>> av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", > >>> rt->playpath); > >>> ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, > >>> - 20 + strlen(rt->playpath)); > >>> + 32 + strlen(rt->playpath)); > >>> pkt.extra = rt->main_channel_id; > >>> > >>> p = pkt.data; > >>> @@ -295,6 +296,7 @@ static void gen_play(URLContext *s, RTMPContext > *rt) > >>> ff_amf_write_number(&p, ++rt->nb_invokes); > >>> ff_amf_write_null(&p); > >>> ff_amf_write_string(&p, rt->playpath); > >>> + ff_amf_write_number(&p, rt->live); > >>> > >> > >> So, passing -2 here is equivalent to leaving it out, as we did before? > (I > >> haven't read the spec about this.) > > > > > > Indeed, -2 is the default value of that parameter. In this case, the > > subscriber first tries to play the live stream and if it's not found it > > tries to play the recorded stream. If you pass -1, only the live stream > is > > played. And if you pass 0, only the recorded stream is played. > > > > > >> > >> > >>> ff_rtmp_packet_write(rt->**stream, &pkt, rt->chunk_size, > >>> rt->prev_pkt[1]); > >>> ff_rtmp_packet_destroy(&pkt); > >>> @@ -1050,6 +1052,7 @@ static int rtmp_write(URLContext *s, const > uint8_t > >>> *buf, int size) > >>> > >>> static const AVOption rtmp_options[] = { > >>> {"rtmp_app", "Name of application to connect to on the RTMP server", > >>> OFFSET(app), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, > >>> + {"rtmp_live", "Specify that the media is a live stream.", > >>> OFFSET(live), AV_OPT_TYPE_INT, {-2}, -2, 0, DEC}, > >>> {"rtmp_playpath", "Stream identifier to play or to publish", > >>> OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, > >>> { NULL }, > >>> > >> > >> I'd like to have info about the parameter values here in the description > >> too - users of the protocol code are more likely to read it there than > from > >> the code comment above. > >> > >> "Specify that the media is a live stream (0: recorded stream, -1: live > > stream, -2: both)." It's better ? > > > > Make AV_OPT_TYPE_CONST options so people can use mnemonics. > Okay. > > Beside that, did you test it? I hadn't compared its output to the > librtmp one but seems that at least certain rtmp servers aren't > responding as expected. I'll get you a bunch of test places soon. > Yes, I tested it a lot and it seems to works fine. Anyway, a bunch of test would be very appreciable. > > lu > > -- > > Luca Barbato > Gentoo/linux > http://dev.gentoo.org/~lu_zero > > _______________________________________________ > libav-devel mailing list > libav-devel at libav.org > https://lists.libav.org/mailman/listinfo/libav-devel > -- Best regards, Samuel Pitoiset. -------------- next part -------------- An HTML attachment was scrubbed... URL: From samuel.pitoiset at gmail.com Wed May 2 17:26:27 2012 From: samuel.pitoiset at gmail.com (Samuel Pitoiset) Date: Wed, 2 May 2012 17:26:27 +0200 Subject: [libav-devel] [PATCH] rtmp: Support 'rtmp_live', an option which specifies if the media is a live stream. In-Reply-To: References: <1335948092-760-1-git-send-email-samuel.pitoiset@gmail.com> <4FA14C23.5020700@gentoo.org> Message-ID: On Wed, May 2, 2012 at 5:12 PM, Martin Storsj? wrote: > On Wed, 2 May 2012, Luca Barbato wrote: > > On 02/05/12 02:19, Samuel Pitoiset wrote: >> >>> On Wed, May 2, 2012 at 11:09 AM, Martin Storsj? >>> wrote: >>> >>> On Wed, 2 May 2012, Samuel Pitoiset wrote: >>>> >>>> --- >>>> >>>>> libavformat/rtmpproto.c | 5 ++++- >>>>> 1 files changed, 4 insertions(+), 1 deletions(-) >>>>> >>>>> diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c >>>>> index 9cdb639..9a02db2 100644 >>>>> --- a/libavformat/rtmpproto.c >>>>> +++ b/libavformat/rtmpproto.c >>>>> @@ -66,6 +66,7 @@ typedef struct RTMPContext { >>>>> int chunk_size; ///< size of the chunks >>>>> RTMP >>>>> packets are divided into >>>>> int is_input; ///< input/output flag >>>>> char *playpath; ///< stream identifier to >>>>> play (with possible "mp4:" prefix) >>>>> + int live; ///< 0: recorded, -1: >>>>> live, -2: both >>>>> char *app; ///< name of application >>>>> ClientState state; ///< current state >>>>> int main_channel_id; ///< an additional channel >>>>> ID which is used for some invocations >>>>> @@ -287,7 +288,7 @@ static void gen_play(URLContext *s, RTMPContext >>>>> *rt) >>>>> >>>>> av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", >>>>> rt->playpath); >>>>> ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, >>>>> - 20 + strlen(rt->playpath)); >>>>> + 32 + strlen(rt->playpath)); >>>>> pkt.extra = rt->main_channel_id; >>>>> >>>>> p = pkt.data; >>>>> @@ -295,6 +296,7 @@ static void gen_play(URLContext *s, RTMPContext >>>>> *rt) >>>>> ff_amf_write_number(&p, ++rt->nb_invokes); >>>>> ff_amf_write_null(&p); >>>>> ff_amf_write_string(&p, rt->playpath); >>>>> + ff_amf_write_number(&p, rt->live); >>>>> >>>>> >>>> So, passing -2 here is equivalent to leaving it out, as we did before? >>>> (I >>>> haven't read the spec about this.) >>>> >>> >>> >>> Indeed, -2 is the default value of that parameter. In this case, the >>> subscriber first tries to play the live stream and if it's not found it >>> tries to play the recorded stream. If you pass -1, only the live stream >>> is >>> played. And if you pass 0, only the recorded stream is played. >>> >>> >>> >>>> >>>> ff_rtmp_packet_write(rt->****stream, &pkt, rt->chunk_size, >>>>> rt->prev_pkt[1]); >>>>> ff_rtmp_packet_destroy(&pkt); >>>>> @@ -1050,6 +1052,7 @@ static int rtmp_write(URLContext *s, const >>>>> uint8_t >>>>> *buf, int size) >>>>> >>>>> static const AVOption rtmp_options[] = { >>>>> {"rtmp_app", "Name of application to connect to on the RTMP server", >>>>> OFFSET(app), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, >>>>> + {"rtmp_live", "Specify that the media is a live stream.", >>>>> OFFSET(live), AV_OPT_TYPE_INT, {-2}, -2, 0, DEC}, >>>>> {"rtmp_playpath", "Stream identifier to play or to publish", >>>>> OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, >>>>> { NULL }, >>>>> >>>>> >>>> I'd like to have info about the parameter values here in the description >>>> too - users of the protocol code are more likely to read it there than >>>> from >>>> the code comment above. >>>> >>>> "Specify that the media is a live stream (0: recorded stream, -1: live >>>> >>> stream, -2: both)." It's better ? >>> >>> >> Make AV_OPT_TYPE_CONST options so people can use mnemonics. >> >> Beside that, did you test it? I hadn't compared its output to the >> librtmp one but seems that at least certain rtmp servers aren't >> responding as expected. I'll get you a bunch of test places soon. >> > > Btw, according to the librtmp sources, the same parameter is used as time > for seeking to, in recorded files, and librtmp seems to send -1000 as value > for live streams? Or is it just a different scaling used for the values? > I didn't read that part of code in librtmp. However, I read the RTMP specification and the value for live streams is -1. http://www.adobe.com/devnet/rtmp.html (page 55) So, I guess it's just a different scaling, yes. > // Martin > _______________________________________________ > libav-devel mailing list > libav-devel at libav.org > https://lists.libav.org/mailman/listinfo/libav-devel > > -- Best regards, Samuel Pitoiset. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mashiat.sarker at gmail.com Wed May 2 17:43:36 2012 From: mashiat.sarker at gmail.com (Mashiat Sarker Shakkhar) Date: Wed, 2 May 2012 08:43:36 -0700 Subject: [libav-devel] [PATCH] WMAL Cosmetics: Fix indentation Message-ID: <1335973416-6425-1-git-send-email-mashiat.sarker@gmail.com> --- libavcodec/wmalosslessdec.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c index 13b706e..81b5cc5 100644 --- a/libavcodec/wmalosslessdec.c +++ b/libavcodec/wmalosslessdec.c @@ -1227,7 +1227,7 @@ static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr, /* decode the cross packet frame if it is valid */ if (num_bits_prev_frame < remaining_packet_bits && !s->packet_loss) - decode_frame(s); + decode_frame(s); } else if (s->num_saved_bits - s->frame_offset) { av_dlog(avctx, "ignoring %x previously saved bits\n", s->num_saved_bits - s->frame_offset); -- 1.7.5.4 From justin.ruggles at gmail.com Wed May 2 17:47:56 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Wed, 02 May 2012 11:47:56 -0400 Subject: [libav-devel] [PATCH 2/6] lavr: Add x86-optimized functions for s16 to flt conversion In-Reply-To: References: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> <1335905384-19715-2-git-send-email-justin.ruggles@gmail.com> Message-ID: <4FA1572C.80606@gmail.com> On 05/01/2012 05:21 PM, Jason Garrett-Glaser wrote: > +%if cpuflag(sse4) > + pmovsxwd m0, [srcq+lenq ] > + pmovsxwd m1, [srcq+lenq+mmsize/2] > +%else > + mova m1, [srcq+lenq] > > Did you forget to load m0 in the non-sse4 version? No, it doesn't matter what's in m0. It gets shifted away. This just gets the m1 words into the high bytes. -Justin From justin.ruggles at gmail.com Wed May 2 18:23:37 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Wed, 02 May 2012 12:23:37 -0400 Subject: [libav-devel] [PATCH 12/14 v3] mlpdec: Fix MLP channel ordering In-Reply-To: <1335922304-31208-1-git-send-email-derek.buitenhuis@gmail.com> References: <1335720821-3233-13-git-send-email-derek.buitenhuis@gmail.com> <1335922304-31208-1-git-send-email-derek.buitenhuis@gmail.com> Message-ID: <4FA15F89.6020808@gmail.com> On 05/01/2012 09:31 PM, Derek Buitenhuis wrote: > diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c > index 1879e00..351908f 100644 > --- a/libavcodec/mlp_parser.c > +++ b/libavcodec/mlp_parser.c > @@ -47,24 +47,24 @@ static const uint64_t mlp_layout[32] = { > AV_CH_LAYOUT_MONO, > AV_CH_LAYOUT_STEREO, > AV_CH_LAYOUT_2_1, > - AV_CH_LAYOUT_2_2, > + AV_CH_LAYOUT_QUAD, > AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY, > AV_CH_LAYOUT_2_1|AV_CH_LOW_FREQUENCY, > - AV_CH_LAYOUT_2_2|AV_CH_LOW_FREQUENCY, > + AV_CH_LAYOUT_QUAD|AV_CH_LOW_FREQUENCY, > AV_CH_LAYOUT_SURROUND, > AV_CH_LAYOUT_4POINT0, > - AV_CH_LAYOUT_5POINT0, > + AV_CH_LAYOUT_5POINT0_BACK, > AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY, > AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY, > - AV_CH_LAYOUT_5POINT1, > + AV_CH_LAYOUT_5POINT1_BACK, > AV_CH_LAYOUT_4POINT0, > - AV_CH_LAYOUT_5POINT0, > + AV_CH_LAYOUT_5POINT0_BACK, > AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY, > AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY, > - AV_CH_LAYOUT_5POINT1, > - AV_CH_LAYOUT_2_2|AV_CH_LOW_FREQUENCY, > - AV_CH_LAYOUT_5POINT0, > - AV_CH_LAYOUT_5POINT1, > + AV_CH_LAYOUT_5POINT1_BACK, > + AV_CH_LAYOUT_QUAD|AV_CH_LOW_FREQUENCY, > + AV_CH_LAYOUT_5POINT0_BACK, > + AV_CH_LAYOUT_5POINT1_BACK, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 > }; All this does is change side surround speakers to rear surround. Do you know where this information comes from? -Justin From tomas.hardin at codemill.se Wed May 2 13:38:23 2012 From: tomas.hardin at codemill.se (Tomas =?ISO-8859-1?Q?H=E4rdin?=) Date: Wed, 02 May 2012 13:38:23 +0200 Subject: [libav-devel] [PATCH 04/14] avcodec: add YCgCo color space. In-Reply-To: <1335720821-3233-5-git-send-email-derek.buitenhuis@gmail.com> References: <1335720821-3233-1-git-send-email-derek.buitenhuis@gmail.com> <1335720821-3233-5-git-send-email-derek.buitenhuis@gmail.com> Message-ID: <1335958703.2094.6.camel@Aspire-5820TG> On Sun, 2012-04-29 at 13:33 -0400, Derek Buitenhuis wrote: > From: Hendrik Leppkes > > Signed-off-by: Michael Niedermayer > --- > libavcodec/avcodec.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index 0fda1cb..2bd8ed2 100644 > --- a/libavcodec/avcodec.h > +++ b/libavcodec/avcodec.h > @@ -500,6 +500,7 @@ enum AVColorSpace{ > AVCOL_SPC_BT470BG =5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 > AVCOL_SPC_SMPTE170M =6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above > AVCOL_SPC_SMPTE240M =7, > + AVCOL_SPC_YCGCO =8, AVCOL_SPC_YCOCG perhaps? /Tomas From kostya.shishkov at gmail.com Wed May 2 18:39:58 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Wed, 2 May 2012 18:39:58 +0200 Subject: [libav-devel] [PATCH] WMAL Cosmetics: Fix indentation In-Reply-To: <1335973416-6425-1-git-send-email-mashiat.sarker@gmail.com> References: <1335973416-6425-1-git-send-email-mashiat.sarker@gmail.com> Message-ID: <20120502163958.GA21505@kst-acer> On Wed, May 02, 2012 at 08:43:36AM -0700, Mashiat Sarker Shakkhar wrote: > --- > libavcodec/wmalosslessdec.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c > index 13b706e..81b5cc5 100644 > --- a/libavcodec/wmalosslessdec.c > +++ b/libavcodec/wmalosslessdec.c > @@ -1227,7 +1227,7 @@ static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr, > > /* decode the cross packet frame if it is valid */ > if (num_bits_prev_frame < remaining_packet_bits && !s->packet_loss) > - decode_frame(s); > + decode_frame(s); > } else if (s->num_saved_bits - s->frame_offset) { > av_dlog(avctx, "ignoring %x previously saved bits\n", > s->num_saved_bits - s->frame_offset); > -- OK From kostya.shishkov at gmail.com Wed May 2 18:50:07 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Wed, 2 May 2012 18:50:07 +0200 Subject: [libav-devel] [PATCH] wmall: fix reconstructing audio with uncoded channels In-Reply-To: <20120501191255.GA19152@kst-acer> References: <20120501191255.GA19152@kst-acer> Message-ID: <20120502165007.GA21970@kst-acer> On Tue, May 01, 2012 at 09:12:55PM +0200, Kostya Shishkov wrote: > --- > not that I care, just for the reference > --- > libavcodec/wmalosslessdec.c | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) Mashiat said he OK'ed it and asked to commit it (on IRC), doing it. From rsbultje at gmail.com Wed May 2 19:12:46 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Wed, 2 May 2012 10:12:46 -0700 Subject: [libav-devel] [PATCH] qdm2: clip array indices returned by qdm2_get_vlc(). In-Reply-To: <1333047654-49291-1-git-send-email-rsbultje@gmail.com> References: <1333047654-49291-1-git-send-email-rsbultje@gmail.com> Message-ID: <1335978766-85523-1-git-send-email-rsbultje@gmail.com> From: "Ronald S. Bultje" Prevents subsequent overreads when these numbers are used as indices in arrays. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable at libav.org --- libavcodec/qdm2.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c index 54782a2..64a821a 100644 --- a/libavcodec/qdm2.c +++ b/libavcodec/qdm2.c @@ -879,9 +879,13 @@ static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int l break; case 30: - if (get_bits_left(gb) >= 4) - samples[0] = type30_dequant[qdm2_get_vlc(gb, &vlc_tab_type30, 0, 1)]; - else + if (get_bits_left(gb) >= 4) { + unsigned index = qdm2_get_vlc(gb, &vlc_tab_type30, 0, 1); + if (index < FF_ARRAY_ELEMS(type30_dequant)) { + samples[0] = type30_dequant[index]; + } else + samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); + } else samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); run = 1; @@ -895,8 +899,12 @@ static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int l type34_predictor = samples[0]; type34_first = 0; } else { - samples[0] = type34_delta[qdm2_get_vlc(gb, &vlc_tab_type34, 0, 1)] / type34_div + type34_predictor; - type34_predictor = samples[0]; + unsigned index = qdm2_get_vlc(gb, &vlc_tab_type34, 0, 1); + if (index < FF_ARRAY_ELEMS(type34_delta)) { + samples[0] = type34_delta[index] / type34_div + type34_predictor; + type34_predictor = samples[0]; + } else + samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); } } else { samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); -- 1.7.9.2 From derek.buitenhuis at gmail.com Wed May 2 19:23:54 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Wed, 02 May 2012 13:23:54 -0400 Subject: [libav-devel] [PATCH 04/14] avcodec: add YCgCo color space. In-Reply-To: <1335958703.2094.6.camel@Aspire-5820TG> References: <1335720821-3233-1-git-send-email-derek.buitenhuis@gmail.com> <1335720821-3233-5-git-send-email-derek.buitenhuis@gmail.com> <1335958703.2094.6.camel@Aspire-5820TG> Message-ID: <4FA16DAA.3070905@gmail.com> On 02/05/2012 7:38 AM, Tomas H?rdin wrote: > AVCOL_SPC_YCOCG perhaps? Indeed it was added as this in 85395ba73f9cc1b3cece3e85ae12f491ad7c1dd2. ;) - Derek From h.leppkes at gmail.com Wed May 2 19:51:25 2012 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Wed, 2 May 2012 19:51:25 +0200 Subject: [libav-devel] [PATCH 04/14] avcodec: add YCgCo color space. In-Reply-To: <1335958703.2094.6.camel@Aspire-5820TG> References: <1335720821-3233-1-git-send-email-derek.buitenhuis@gmail.com> <1335720821-3233-5-git-send-email-derek.buitenhuis@gmail.com> <1335958703.2094.6.camel@Aspire-5820TG> Message-ID: On Wed, May 2, 2012 at 1:38 PM, Tomas H?rdin wrote: > > > AVCOL_SPC_YCOCG perhaps? > > /Tomas > > The H.264 Spec names it YCgCo, which is where the name was based on. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rsbultje at gmail.com Wed May 2 19:59:13 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Wed, 2 May 2012 10:59:13 -0700 Subject: [libav-devel] [PATCH] png: check bit depth for PAL8/Y400A pixel formats. Message-ID: <1335981553-98399-1-git-send-email-rsbultje@gmail.com> From: "Ronald S. Bultje" Wrong bit depth can lead to invalid rowsize values, which crashes the decoder further down. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable at libav.org --- libavcodec/pngdec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 087abae..871f2b2 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -479,9 +479,11 @@ static int decode_frame(AVCodecContext *avctx, } else if (s->bit_depth == 1 && s->color_type == PNG_COLOR_TYPE_GRAY) { avctx->pix_fmt = PIX_FMT_MONOBLACK; - } else if (s->color_type == PNG_COLOR_TYPE_PALETTE) { + } else if (s->bit_depth == 8 && + s->color_type == PNG_COLOR_TYPE_PALETTE) { avctx->pix_fmt = PIX_FMT_PAL8; - } else if (s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { + } else if (s->bit_depth == 8 && + s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { avctx->pix_fmt = PIX_FMT_Y400A; } else { goto fail; -- 1.7.9.2 From rsbultje at gmail.com Wed May 2 20:04:03 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Wed, 2 May 2012 11:04:03 -0700 Subject: [libav-devel] [PATCH] ea: check chunk_size for validity. Message-ID: <1335981843-99163-1-git-send-email-rsbultje@gmail.com> From: "Ronald S. Bultje" Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable at libav.org --- libavformat/electronicarts.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index 47ef40f..9a21072 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -487,12 +487,17 @@ static int ea_read_packet(AVFormatContext *s, while (!packet_read) { chunk_type = avio_rl32(pb); - chunk_size = (ea->big_endian ? avio_rb32(pb) : avio_rl32(pb)) - 8; + chunk_size = (ea->big_endian ? avio_rb32(pb) : avio_rl32(pb)); + if (chunk_size <= 8) + return AVERROR_INVALIDDATA; + chunk_size -= 8; switch (chunk_type) { /* audio data */ case ISNh_TAG: /* header chunk also contains data; skip over the header portion*/ + if (chunk_size < 32) + return AVERROR_INVALIDDATA; avio_skip(pb, 32); chunk_size -= 32; case ISNd_TAG: -- 1.7.9.2 From martin at martin.st Wed May 2 20:08:58 2012 From: martin at martin.st (=?ISO-8859-15?Q?Martin_Storsj=F6?=) Date: Wed, 2 May 2012 21:08:58 +0300 (EEST) Subject: [libav-devel] [PATCH] ea: check chunk_size for validity. In-Reply-To: <1335981843-99163-1-git-send-email-rsbultje@gmail.com> References: <1335981843-99163-1-git-send-email-rsbultje@gmail.com> Message-ID: On Wed, 2 May 2012, Ronald S. Bultje wrote: > From: "Ronald S. Bultje" > > Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind > CC: libav-stable at libav.org > --- > libavformat/electronicarts.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c > index 47ef40f..9a21072 100644 > --- a/libavformat/electronicarts.c > +++ b/libavformat/electronicarts.c > @@ -487,12 +487,17 @@ static int ea_read_packet(AVFormatContext *s, > > while (!packet_read) { > chunk_type = avio_rl32(pb); > - chunk_size = (ea->big_endian ? avio_rb32(pb) : avio_rl32(pb)) - 8; > + chunk_size = (ea->big_endian ? avio_rb32(pb) : avio_rl32(pb)); The parentheses can be removed now. Other than that, looks ok to me. // Martin From martin at martin.st Wed May 2 20:09:45 2012 From: martin at martin.st (=?ISO-8859-15?Q?Martin_Storsj=F6?=) Date: Wed, 2 May 2012 21:09:45 +0300 (EEST) Subject: [libav-devel] [PATCH] png: check bit depth for PAL8/Y400A pixel formats. In-Reply-To: <1335981553-98399-1-git-send-email-rsbultje@gmail.com> References: <1335981553-98399-1-git-send-email-rsbultje@gmail.com> Message-ID: On Wed, 2 May 2012, Ronald S. Bultje wrote: > From: "Ronald S. Bultje" > > Wrong bit depth can lead to invalid rowsize values, which crashes the > decoder further down. > > Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind > CC: libav-stable at libav.org > --- > libavcodec/pngdec.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c > index 087abae..871f2b2 100644 > --- a/libavcodec/pngdec.c > +++ b/libavcodec/pngdec.c > @@ -479,9 +479,11 @@ static int decode_frame(AVCodecContext *avctx, > } else if (s->bit_depth == 1 && > s->color_type == PNG_COLOR_TYPE_GRAY) { > avctx->pix_fmt = PIX_FMT_MONOBLACK; > - } else if (s->color_type == PNG_COLOR_TYPE_PALETTE) { > + } else if (s->bit_depth == 8 && > + s->color_type == PNG_COLOR_TYPE_PALETTE) { > avctx->pix_fmt = PIX_FMT_PAL8; > - } else if (s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { > + } else if (s->bit_depth == 8 && > + s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { > avctx->pix_fmt = PIX_FMT_Y400A; > } else { > goto fail; > -- > 1.7.9.2 Seems ok to me. // Martin From kostya.shishkov at gmail.com Wed May 2 20:26:29 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Wed, 2 May 2012 20:26:29 +0200 Subject: [libav-devel] [PATCH] ea: check chunk_size for validity. In-Reply-To: References: <1335981843-99163-1-git-send-email-rsbultje@gmail.com> Message-ID: <20120502182629.GA22529@kst-acer> On Wed, May 02, 2012 at 09:08:58PM +0300, Martin Storsj? wrote: > On Wed, 2 May 2012, Ronald S. Bultje wrote: > > >From: "Ronald S. Bultje" > > > >Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind > >CC: libav-stable at libav.org > >--- > >libavformat/electronicarts.c | 7 ++++++- > >1 file changed, 6 insertions(+), 1 deletion(-) > > > >diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c > >index 47ef40f..9a21072 100644 > >--- a/libavformat/electronicarts.c > >+++ b/libavformat/electronicarts.c > >@@ -487,12 +487,17 @@ static int ea_read_packet(AVFormatContext *s, > > > > while (!packet_read) { > > chunk_type = avio_rl32(pb); > >- chunk_size = (ea->big_endian ? avio_rb32(pb) : avio_rl32(pb)) - 8; > >+ chunk_size = (ea->big_endian ? avio_rb32(pb) : avio_rl32(pb)); > > The parentheses can be removed now. > > Other than that, looks ok to me. agreed From gseanmcg at gmail.com Wed May 2 20:30:35 2012 From: gseanmcg at gmail.com (Sean McGovern) Date: Wed, 2 May 2012 18:30:35 +0000 Subject: [libav-devel] OpenSSH 6.0 bug report Message-ID: <2095947284-1335983436-cardhu_decombobulator_blackberry.rim.net-1754043257-@b15.c6.bise6.blackberry> Hi Luca and other Gentoo users, I just filed Gentoo bug # 414401 with regards to being unable to submit to FATE after upgrading from OpenSSH 5.9 to 6.0 which was just released a few days ago. Feel free to add yourselves as CC -- the report is at https://bugs.gentoo.org/show_bug.cgi?id=414401 -- Sean McG. From vitor1001 at gmail.com Wed May 2 20:46:51 2012 From: vitor1001 at gmail.com (Vitor Sessak) Date: Wed, 02 May 2012 20:46:51 +0200 Subject: [libav-devel] [PATCH 6/6] lavr: Add x86-optimized function for flt to s32 conversion In-Reply-To: <1335905384-19715-6-git-send-email-justin.ruggles@gmail.com> References: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> <1335905384-19715-6-git-send-email-justin.ruggles@gmail.com> Message-ID: <4FA1811B.5020106@gmail.com> On 05/01/2012 10:49 PM, Justin Ruggles wrote: > --- > Athlon64 > C - 8176 > SSE2 - 1784 > > SandyBridge > C - 5578 > SSE2 - 418 Is there any reason why not to do an AVX (YMM) version? -Vitor From justin.ruggles at gmail.com Wed May 2 20:53:21 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Wed, 02 May 2012 14:53:21 -0400 Subject: [libav-devel] [PATCH 6/6] lavr: Add x86-optimized function for flt to s32 conversion In-Reply-To: <4FA1811B.5020106@gmail.com> References: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> <1335905384-19715-6-git-send-email-justin.ruggles@gmail.com> <4FA1811B.5020106@gmail.com> Message-ID: <4FA182A1.7000404@gmail.com> On 05/02/2012 02:46 PM, Vitor Sessak wrote: > On 05/01/2012 10:49 PM, Justin Ruggles wrote: >> --- >> Athlon64 >> C - 8176 >> SSE2 - 1784 >> >> SandyBridge >> C - 5578 >> SSE2 - 418 > > Is there any reason why not to do an AVX (YMM) version? It was actually slower when I tested it on sandy bridge. If some other system runs it faster it's easy to add. -Justin From alex.converse at gmail.com Wed May 2 21:11:43 2012 From: alex.converse at gmail.com (Alex Converse) Date: Wed, 2 May 2012 12:11:43 -0700 Subject: [libav-devel] [PATCH] motionpixels: Clip YUV values after applying a gradient. Message-ID: <1335985903-30467-1-git-send-email-alex.converse@gmail.com> Prevents illegal reads on truncated and malformed input. --- libavcodec/motionpixels.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c index 6151e6a..8a3c870 100644 --- a/libavcodec/motionpixels.c +++ b/libavcodec/motionpixels.c @@ -190,10 +190,13 @@ static void mp_decode_line(MotionPixelsContext *mp, GetBitContext *gb, int y) p = mp_get_yuv_from_rgb(mp, x - 1, y); } else { p.y += mp_gradient(mp, 0, mp_get_vlc(mp, gb)); + p.y = av_clip(p.y, 0, 31); if ((x & 3) == 0) { if ((y & 3) == 0) { p.v += mp_gradient(mp, 1, mp_get_vlc(mp, gb)); + p.v = av_clip(p.v, -32, 31); p.u += mp_gradient(mp, 2, mp_get_vlc(mp, gb)); + p.u = av_clip(p.u, -32, 31); mp->hpt[((y / 4) * mp->avctx->width + x) / 4] = p; } else { p.v = mp->hpt[((y / 4) * mp->avctx->width + x) / 4].v; @@ -217,9 +220,12 @@ static void mp_decode_frame_helper(MotionPixelsContext *mp, GetBitContext *gb) p = mp_get_yuv_from_rgb(mp, 0, y); } else { p.y += mp_gradient(mp, 0, mp_get_vlc(mp, gb)); + p.y = av_clip(p.y, 0, 31); if ((y & 3) == 0) { p.v += mp_gradient(mp, 1, mp_get_vlc(mp, gb)); + p.v = av_clip(p.v, -32, 31); p.u += mp_gradient(mp, 2, mp_get_vlc(mp, gb)); + p.u = av_clip(p.u, -32, 31); } mp->vpt[y] = p; mp_set_rgb_from_yuv(mp, 0, y, &p); -- 1.7.7.3 From rsbultje at gmail.com Wed May 2 21:13:43 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Wed, 2 May 2012 12:13:43 -0700 Subject: [libav-devel] [PATCH] motionpixels: Clip YUV values after applying a gradient. In-Reply-To: <1335985903-30467-1-git-send-email-alex.converse@gmail.com> References: <1335985903-30467-1-git-send-email-alex.converse@gmail.com> Message-ID: Hi, On Wed, May 2, 2012 at 12:11 PM, Alex Converse wrote: > Prevents illegal reads on truncated and malformed input. > --- > ?libavcodec/motionpixels.c | ? ?6 ++++++ > ?1 files changed, 6 insertions(+), 0 deletions(-) OK. Ronald From mans at mansr.com Wed May 2 21:37:55 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Wed, 02 May 2012 20:37:55 +0100 Subject: [libav-devel] OpenSSH 6.0 bug report In-Reply-To: <2095947284-1335983436-cardhu_decombobulator_blackberry.rim.net-1754043257-@b15.c6.bise6.blackberry> (Sean McGovern's message of "Wed, 2 May 2012 18:30:35 +0000") References: <2095947284-1335983436-cardhu_decombobulator_blackberry.rim.net-1754043257-@b15.c6.bise6.blackberry> Message-ID: "Sean McGovern" writes: > Hi Luca and other Gentoo users, > > I just filed Gentoo bug # 414401 with regards to being unable to > submit to FATE after upgrading from OpenSSH 5.9 to 6.0 which was just > released a few days ago. > > Feel free to add yourselves as CC -- the report is at > https://bugs.gentoo.org/show_bug.cgi?id=414401 FWIW, the server is running openssh 5.9. -- M?ns Rullg?rd mans at mansr.com From lu_zero at gentoo.org Wed May 2 21:39:07 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Wed, 02 May 2012 12:39:07 -0700 Subject: [libav-devel] [PATCH 04/14] avcodec: add YCgCo color space. In-Reply-To: References: <1335720821-3233-1-git-send-email-derek.buitenhuis@gmail.com> <1335720821-3233-5-git-send-email-derek.buitenhuis@gmail.com> <1335958703.2094.6.camel@Aspire-5820TG> Message-ID: <4FA18D5B.9070401@gentoo.org> On 02/05/12 10:51, Hendrik Leppkes wrote: > On Wed, May 2, 2012 at 1:38 PM, Tomas H?rdin wrote: >> >> >> AVCOL_SPC_YCOCG perhaps? >> >> /Tomas >> >> > The H.264 Spec names it YCgCo, which is where the name was based on. > I'm confused between dirac and h264 then... Which comes first orange or green =) ? -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From vitor1001 at gmail.com Wed May 2 23:01:54 2012 From: vitor1001 at gmail.com (Vitor Sessak) Date: Wed, 02 May 2012 23:01:54 +0200 Subject: [libav-devel] [PATCH 6/6] lavr: Add x86-optimized function for flt to s32 conversion In-Reply-To: <4FA182A1.7000404@gmail.com> References: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> <1335905384-19715-6-git-send-email-justin.ruggles@gmail.com> <4FA1811B.5020106@gmail.com> <4FA182A1.7000404@gmail.com> Message-ID: <4FA1A0C2.9080104@gmail.com> On 05/02/2012 08:53 PM, Justin Ruggles wrote: > On 05/02/2012 02:46 PM, Vitor Sessak wrote: > >> On 05/01/2012 10:49 PM, Justin Ruggles wrote: >>> --- >>> Athlon64 >>> C - 8176 >>> SSE2 - 1784 >>> >>> SandyBridge >>> C - 5578 >>> SSE2 - 418 >> >> Is there any reason why not to do an AVX (YMM) version? > > > It was actually slower when I tested it on sandy bridge. If some other > system runs it faster it's easy to add. Strange. And what about 128-bit 3-op? -Vitor From justin.ruggles at gmail.com Wed May 2 23:18:58 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Wed, 02 May 2012 17:18:58 -0400 Subject: [libav-devel] [PATCH 6/6] lavr: Add x86-optimized function for flt to s32 conversion In-Reply-To: <4FA1A0C2.9080104@gmail.com> References: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> <1335905384-19715-6-git-send-email-justin.ruggles@gmail.com> <4FA1811B.5020106@gmail.com> <4FA182A1.7000404@gmail.com> <4FA1A0C2.9080104@gmail.com> Message-ID: <4FA1A4C2.1050305@gmail.com> On 05/02/2012 05:01 PM, Vitor Sessak wrote: > On 05/02/2012 08:53 PM, Justin Ruggles wrote: >> On 05/02/2012 02:46 PM, Vitor Sessak wrote: >> >>> On 05/01/2012 10:49 PM, Justin Ruggles wrote: >>>> --- >>>> Athlon64 >>>> C - 8176 >>>> SSE2 - 1784 >>>> >>>> SandyBridge >>>> C - 5578 >>>> SSE2 - 418 >>> >>> Is there any reason why not to do an AVX (YMM) version? >> >> >> It was actually slower when I tested it on sandy bridge. If some other >> system runs it faster it's easy to add. > > Strange. And what about 128-bit 3-op? slower also. -Justin From rsbultje at gmail.com Thu May 3 01:06:55 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Wed, 2 May 2012 16:06:55 -0700 Subject: [libav-devel] [PATCH] mp3/ac3 probe: search for PES headers to prevent probing MPEG-PS as MP3. Message-ID: <1336000015-35770-1-git-send-email-rsbultje@gmail.com> From: "Ronald S. Bultje" --- libavformat/ac3dec.c | 29 ++++++++++++++++++++++++----- libavformat/mp3dec.c | 29 ++++++++++++++++++++++++----- 2 files changed, 48 insertions(+), 10 deletions(-) diff --git a/libavformat/ac3dec.c b/libavformat/ac3dec.c index 60c3cf9..0fc2ff3 100644 --- a/libavformat/ac3dec.c +++ b/libavformat/ac3dec.c @@ -57,11 +57,30 @@ static int ac3_eac3_probe(AVProbeData *p, enum CodecID expected_codec_id) if(codec_id != expected_codec_id) return 0; // keep this in sync with mp3 probe, both need to avoid // issues with MPEG-files! - if (first_frames>=4) return AVPROBE_SCORE_MAX/2+1; - else if(max_frames>500)return AVPROBE_SCORE_MAX/2; - else if(max_frames>=4) return AVPROBE_SCORE_MAX/4; - else if(max_frames>=1) return 1; - else return 0; + if (first_frames >= 4) return AVPROBE_SCORE_MAX / 2 + 1; + + if (max_frames < 10) { + int pes = 0, i; + unsigned int code = -1; + +#define VIDEO_ID 0x000001e0 +#define AUDIO_ID 0x000001c0 + /* do a search for mpegps headers to be able to properly bias + * towards mpegps if we detect this stream as both. */ + for (i = 0; ibuf_size; i++) { + code = (code << 8) + p->buf[i]; + if ((code & 0xffffff00) == 0x100) { + if ((code & 0x1f0) == VIDEO_ID) pes++; + else if((code & 0x1e0) == AUDIO_ID) pes++; + } + } + if (pes) + max_frames = (max_frames + pes - 1) / pes; + } + if (max_frames > 500) return AVPROBE_SCORE_MAX / 2; + else if (max_frames >= 4) return AVPROBE_SCORE_MAX / 4; + else if (max_frames >= 1) return 1; + else return 0; } #if CONFIG_AC3_DEMUXER diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index d233209..c608c60 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -63,11 +63,30 @@ static int mp3_read_probe(AVProbeData *p) } // keep this in sync with ac3 probe, both need to avoid // issues with MPEG-files! - if (first_frames>=4) return AVPROBE_SCORE_MAX/2+1; - else if(max_frames>500)return AVPROBE_SCORE_MAX/2; - else if(max_frames>=4) return AVPROBE_SCORE_MAX/4; - else if(max_frames>=1) return 1; - else return 0; + if (first_frames >= 4) return AVPROBE_SCORE_MAX / 2 + 1; + + if (max_frames < 10) { + int pes = 0, i; + unsigned int code = -1; + +#define VIDEO_ID 0x000001e0 +#define AUDIO_ID 0x000001c0 + /* do a search for mpegps headers to be able to properly bias + * towards mpegps if we detect this stream as both. */ + for (i = 0; ibuf_size; i++) { + code = (code << 8) + p->buf[i]; + if ((code & 0xffffff00) == 0x100) { + if ((code & 0x1f0) == VIDEO_ID) pes++; + else if((code & 0x1e0) == AUDIO_ID) pes++; + } + } + if (pes) + max_frames = (max_frames + pes - 1) / pes; + } + if (max_frames > 500) return AVPROBE_SCORE_MAX / 2; + else if (max_frames >= 4) return AVPROBE_SCORE_MAX / 4; + else if (max_frames >= 1) return 1; + else return 0; //mpegps_mp3_unrecognized_format.mpg has max_frames=3 } -- 1.7.9.2 From rsbultje at gmail.com Thu May 3 01:09:29 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Wed, 2 May 2012 16:09:29 -0700 Subject: [libav-devel] [PATCH] mp3/ac3 probe: search for PES headers to prevent probing MPEG-PS as MP3. In-Reply-To: <1336000015-35770-1-git-send-email-rsbultje@gmail.com> References: <1336000015-35770-1-git-send-email-rsbultje@gmail.com> Message-ID: Hi guys, On Wed, May 2, 2012 at 4:06 PM, Ronald S. Bultje wrote: > From: "Ronald S. Bultje" > > --- > ?libavformat/ac3dec.c | ? 29 ++++++++++++++++++++++++----- > ?libavformat/mp3dec.c | ? 29 ++++++++++++++++++++++++----- > ?2 files changed, 48 insertions(+), 10 deletions(-) Please consider this a RFC, I'm interested in ideas here. What happens for a significant amount of content is that it's detected as mp3 and mpegps at equal score, and then this code: http://git.libav.org/?p=libav.git;a=blob;f=libavformat/utils.c;h=b167e96854f57346c4eba40de598259e7aec0dd9;hb=HEAD#l339 will cause it to not be detected as anything at all. The above is a symptom, the high score for mp3 is a bug. My idea is to detect mpegps in mp3 and bias negatively if found. Anyone have better ideas? This works for problem files I have found. Ronald From alex.converse at gmail.com Thu May 3 01:21:15 2012 From: alex.converse at gmail.com (Alex Converse) Date: Wed, 2 May 2012 16:21:15 -0700 Subject: [libav-devel] [PATCH] mp3/ac3 probe: search for PES headers to prevent probing MPEG-PS as MP3. In-Reply-To: References: <1336000015-35770-1-git-send-email-rsbultje@gmail.com> Message-ID: On Wed, May 2, 2012 at 4:09 PM, Ronald S. Bultje wrote: > Hi guys, > > On Wed, May 2, 2012 at 4:06 PM, Ronald S. Bultje wrote: >> From: "Ronald S. Bultje" >> >> --- >> ?libavformat/ac3dec.c | ? 29 ++++++++++++++++++++++++----- >> ?libavformat/mp3dec.c | ? 29 ++++++++++++++++++++++++----- >> ?2 files changed, 48 insertions(+), 10 deletions(-) > > Please consider this a RFC, I'm interested in ideas here. What happens > for a significant amount of content is that it's detected as mp3 and > mpegps at equal score, and then this code: > http://git.libav.org/?p=libav.git;a=blob;f=libavformat/utils.c;h=b167e96854f57346c4eba40de598259e7aec0dd9;hb=HEAD#l339 > will cause it to not be detected as anything at all. The above is a > symptom, the high score for mp3 is a bug. My idea is to detect mpegps > in mp3 and bias negatively if found. Anyone have better ideas? This > works for problem files I have found. > I think it's time for a probe test. Every time these functions get tweaked to balance each other out, a new file is added to the test. Future tweaks should not break existing files. From rsbultje at gmail.com Thu May 3 04:39:17 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Wed, 2 May 2012 19:39:17 -0700 Subject: [libav-devel] [PATCH 13/14] mpeg12: fixed parsing in some mpeg2 streams In-Reply-To: <1335720821-3233-14-git-send-email-derek.buitenhuis@gmail.com> References: <1335720821-3233-1-git-send-email-derek.buitenhuis@gmail.com> <1335720821-3233-14-git-send-email-derek.buitenhuis@gmail.com> Message-ID: Hi, On Sun, Apr 29, 2012 at 10:33 AM, Derek Buitenhuis wrote: > From: Hendrik Leppkes > > Signed-off-by: Michael Niedermayer > --- > ?libavcodec/mpeg12.c | ? ?1 + > ?1 file changed, 1 insertion(+) > > diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c > index 40ba97b..c40649d 100644 > --- a/libavcodec/mpeg12.c > +++ b/libavcodec/mpeg12.c > @@ -2161,6 +2161,7 @@ int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, > ? ? ? ? ? ? ? ? pc->frame_start_found = 4; > ? ? ? ? ? ? } > ? ? ? ? ? ? if (state == SEQ_END_CODE) { > + ? ? ? ? ? ? ? ?pc->frame_start_found = 0; > ? ? ? ? ? ? ? ? pc->state=-1; > ? ? ? ? ? ? ? ? return i+1; > ? ? ? ? ? ? } OK. Ronald From rsbultje at gmail.com Thu May 3 04:39:59 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Wed, 2 May 2012 19:39:59 -0700 Subject: [libav-devel] [PATCH 07/14] Add SMPTE240M transfer characteristics flag. In-Reply-To: <1335720821-3233-8-git-send-email-derek.buitenhuis@gmail.com> References: <1335720821-3233-1-git-send-email-derek.buitenhuis@gmail.com> <1335720821-3233-8-git-send-email-derek.buitenhuis@gmail.com> Message-ID: Hi, On Sun, Apr 29, 2012 at 10:33 AM, Derek Buitenhuis wrote: > From: Hendrik Leppkes > > Signed-off-by: Michael Niedermayer > --- > ?libavcodec/avcodec.h | ? ?1 + > ?1 file changed, 1 insertion(+) > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index 2bd8ed2..345dfe0 100644 > --- a/libavcodec/avcodec.h > +++ b/libavcodec/avcodec.h > @@ -489,6 +489,7 @@ enum AVColorTransferCharacteristic{ > ? ? AVCOL_TRC_UNSPECIFIED=2, > ? ? AVCOL_TRC_GAMMA22 ? ?=4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM > ? ? AVCOL_TRC_GAMMA28 ? ?=5, ///< also ITU-R BT470BG > + ? ?AVCOL_TRC_SMPTE240M ?=7, > ? ? AVCOL_TRC_NB ? ? ? ? ? , ///< Not part of ABI > ?}; OK (didn't Luca change the indenting of these files?). Ronald From rsbultje at gmail.com Thu May 3 04:40:27 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Wed, 2 May 2012 19:40:27 -0700 Subject: [libav-devel] [PATCH 05/14] mpegts: Some additional HDMV types and reg descriptors for mpegts In-Reply-To: <1335720821-3233-6-git-send-email-derek.buitenhuis@gmail.com> References: <1335720821-3233-1-git-send-email-derek.buitenhuis@gmail.com> <1335720821-3233-6-git-send-email-derek.buitenhuis@gmail.com> Message-ID: Hi, On Sun, Apr 29, 2012 at 10:33 AM, Derek Buitenhuis wrote: > From: Joakim Plate > > Signed-off-by: Michael Niedermayer > --- > ?libavformat/mpegts.c | ? ?6 ++++++ > ?1 file changed, 6 insertions(+) > > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c > index 2222f25..1b3eb8b 100644 > --- a/libavformat/mpegts.c > +++ b/libavformat/mpegts.c > @@ -534,6 +534,8 @@ static const StreamType HDMV_types[] = { > ? ? { 0x82, AVMEDIA_TYPE_AUDIO, CODEC_ID_DTS }, > ? ? { 0x83, AVMEDIA_TYPE_AUDIO, CODEC_ID_TRUEHD }, > ? ? { 0x84, AVMEDIA_TYPE_AUDIO, CODEC_ID_EAC3 }, > + ? ?{ 0x85, AVMEDIA_TYPE_AUDIO, CODEC_ID_DTS }, /* DTS HD */ > + ? ?{ 0x86, AVMEDIA_TYPE_AUDIO, CODEC_ID_DTS }, /* DTS HD MASTER*/ > ? ? { 0x90, AVMEDIA_TYPE_SUBTITLE, CODEC_ID_HDMV_PGS_SUBTITLE }, > ? ? { 0 }, > ?}; > @@ -549,6 +551,10 @@ static const StreamType REGD_types[] = { > ? ? { MKTAG('d','r','a','c'), AVMEDIA_TYPE_VIDEO, CODEC_ID_DIRAC }, > ? ? { MKTAG('A','C','-','3'), AVMEDIA_TYPE_AUDIO, ? CODEC_ID_AC3 }, > ? ? { MKTAG('B','S','S','D'), AVMEDIA_TYPE_AUDIO, CODEC_ID_S302M }, > + ? ?{ MKTAG('D','T','S','1'), AVMEDIA_TYPE_AUDIO, ? CODEC_ID_DTS }, > + ? ?{ MKTAG('D','T','S','2'), AVMEDIA_TYPE_AUDIO, ? CODEC_ID_DTS }, > + ? ?{ MKTAG('D','T','S','3'), AVMEDIA_TYPE_AUDIO, ? CODEC_ID_DTS }, > + ? ?{ MKTAG('V','C','-','1'), AVMEDIA_TYPE_VIDEO, ? CODEC_ID_VC1 }, > ? ? { 0 }, > ?}; OK. Ronald From lu_zero at gentoo.org Thu May 3 08:43:16 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Wed, 02 May 2012 23:43:16 -0700 Subject: [libav-devel] [PATCH 07/14] Add SMPTE240M transfer characteristics flag. In-Reply-To: References: <1335720821-3233-1-git-send-email-derek.buitenhuis@gmail.com> <1335720821-3233-8-git-send-email-derek.buitenhuis@gmail.com> Message-ID: <4FA22904.8060402@gentoo.org> On 02/05/12 19:39, Ronald S. Bultje wrote: > Hi, > > On Sun, Apr 29, 2012 at 10:33 AM, Derek Buitenhuis > wrote: >> From: Hendrik Leppkes >> >> Signed-off-by: Michael Niedermayer >> --- >> libavcodec/avcodec.h | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h >> index 2bd8ed2..345dfe0 100644 >> --- a/libavcodec/avcodec.h >> +++ b/libavcodec/avcodec.h >> @@ -489,6 +489,7 @@ enum AVColorTransferCharacteristic{ >> AVCOL_TRC_UNSPECIFIED=2, >> AVCOL_TRC_GAMMA22 =4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM >> AVCOL_TRC_GAMMA28 =5, ///< also ITU-R BT470BG >> + AVCOL_TRC_SMPTE240M =7, >> AVCOL_TRC_NB , ///< Not part of ABI >> }; > > OK (didn't Luca change the indenting of these files?). Yes I did. > > Ronald > _______________________________________________ > libav-devel mailing list > libav-devel at libav.org > https://lists.libav.org/mailman/listinfo/libav-devel -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From vladoman at gmail.com Thu May 3 10:18:41 2012 From: vladoman at gmail.com (Vladimir Pantelic) Date: Thu, 03 May 2012 10:18:41 +0200 Subject: [libav-devel] [PATCH] mp3/ac3 probe: search for PES headers to prevent probing MPEG-PS as MP3. In-Reply-To: References: <1336000015-35770-1-git-send-email-rsbultje@gmail.com> Message-ID: <4FA23F61.7080601@gmail.com> Ronald S. Bultje wrote: > Hi guys, > > On Wed, May 2, 2012 at 4:06 PM, Ronald S. Bultje wrote: >> From: "Ronald S. Bultje" >> >> --- >> libavformat/ac3dec.c | 29 ++++++++++++++++++++++++----- >> libavformat/mp3dec.c | 29 ++++++++++++++++++++++++----- >> 2 files changed, 48 insertions(+), 10 deletions(-) > > Please consider this a RFC, I'm interested in ideas here. What happens > for a significant amount of content is that it's detected as mp3 and > mpegps at equal score, and then this code: > http://git.libav.org/?p=libav.git;a=blob;f=libavformat/utils.c;h=b167e96854f57346c4eba40de598259e7aec0dd9;hb=HEAD#l339 > will cause it to not be detected as anything at all. The above is a > symptom, the high score for mp3 is a bug. My idea is to detect mpegps > in mp3 and bias negatively if found. Anyone have better ideas? This > works for problem files I have found. we already probe for PES headers in the PS probe, so why do it again in MP3 and AC3? Since MP3/AC3 in PS is likely and PES inside MP3/AC3 is not, why not just return a higher max score for PES vs MP3/AC3? From samuel.pitoiset at gmail.com Thu May 3 11:29:28 2012 From: samuel.pitoiset at gmail.com (Samuel Pitoiset) Date: Thu, 3 May 2012 11:29:28 +0200 Subject: [libav-devel] [PATCH] rtmp: Support 'rtmp_live', an option which specifies if the media is a live stream. In-Reply-To: References: Message-ID: <1336037368-1650-1-git-send-email-samuel.pitoiset@gmail.com> --- libavformat/rtmpproto.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 9cdb639..d6be546 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -66,6 +66,7 @@ typedef struct RTMPContext { int chunk_size; ///< size of the chunks RTMP packets are divided into int is_input; ///< input/output flag char *playpath; ///< stream identifier to play (with possible "mp4:" prefix) + int live; ///< 0: recorded, -1: live, -2: both char *app; ///< name of application ClientState state; ///< current state int main_channel_id; ///< an additional channel ID which is used for some invocations @@ -287,7 +288,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", rt->playpath); ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, - 20 + strlen(rt->playpath)); + 32 + strlen(rt->playpath)); pkt.extra = rt->main_channel_id; p = pkt.data; @@ -295,6 +296,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) ff_amf_write_number(&p, ++rt->nb_invokes); ff_amf_write_null(&p); ff_amf_write_string(&p, rt->playpath); + ff_amf_write_number(&p, rt->live); ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]); ff_rtmp_packet_destroy(&pkt); @@ -1050,6 +1052,10 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size) static const AVOption rtmp_options[] = { {"rtmp_app", "Name of application to connect to on the RTMP server", OFFSET(app), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, + {"rtmp_live", "Specify that the media is a live stream.", OFFSET(live), AV_OPT_TYPE_FLAGS, {-2}, INT_MIN, INT_MAX, DEC, "rtmp_live"}, + {"any", "both", 0, AV_OPT_TYPE_CONST, {-2}, 0, 0, DEC, "rtmp_live"}, + {"live", "live stream", 0, AV_OPT_TYPE_CONST, {-1}, 0, 0, DEC, "rtmp_live"}, + {"recorded", "recorded stream", 0, AV_OPT_TYPE_CONST, {0}, 0, 0, DEC, "rtmp_live"}, {"rtmp_playpath", "Stream identifier to play or to publish", OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, { NULL }, }; -- 1.7.7.5 (Apple Git-26) From mans at mansr.com Thu May 3 14:53:17 2012 From: mans at mansr.com (Mans Rullgard) Date: Thu, 3 May 2012 13:53:17 +0100 Subject: [libav-devel] [PATCH] vqavideo: return error if image size is not a multiple of block size Message-ID: <1336049597-32587-1-git-send-email-mans@mansr.com> The decoder assumes in various places that the image size is a multiple of the block size, and there is no obvious way to support odd sizes. Bailing out early if the header specifies a bad size avoids various errors later on. Fixes CVE-2012-0947. Signed-off-by: Mans Rullgard --- libavcodec/vqavideo.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c index 3c9fbed..1bad226 100644 --- a/libavcodec/vqavideo.c +++ b/libavcodec/vqavideo.c @@ -151,6 +151,12 @@ static av_cold int vqa_decode_init(AVCodecContext *avctx) return -1; } + if (s->width & (s->vector_width - 1) || + s->height & (s->vector_height - 1)) { + av_log(avctx, AV_LOG_ERROR, "Image size not multiple of block size\n"); + return AVERROR_INVALIDDATA; + } + /* allocate codebooks */ s->codebook_size = MAX_CODEBOOK_SIZE; s->codebook = av_malloc(s->codebook_size); -- 1.7.10 From kostya.shishkov at gmail.com Thu May 3 15:13:09 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Thu, 3 May 2012 15:13:09 +0200 Subject: [libav-devel] [PATCH] vqavideo: return error if image size is not a multiple of block size In-Reply-To: <1336049597-32587-1-git-send-email-mans@mansr.com> References: <1336049597-32587-1-git-send-email-mans@mansr.com> Message-ID: <20120503131309.GA23941@kst-acer> On Thu, May 03, 2012 at 01:53:17PM +0100, Mans Rullgard wrote: > The decoder assumes in various places that the image size > is a multiple of the block size, and there is no obvious > way to support odd sizes. Bailing out early if the header > specifies a bad size avoids various errors later on. > > Fixes CVE-2012-0947. > > Signed-off-by: Mans Rullgard > --- > libavcodec/vqavideo.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c > index 3c9fbed..1bad226 100644 > --- a/libavcodec/vqavideo.c > +++ b/libavcodec/vqavideo.c > @@ -151,6 +151,12 @@ static av_cold int vqa_decode_init(AVCodecContext *avctx) > return -1; > } > > + if (s->width & (s->vector_width - 1) || > + s->height & (s->vector_height - 1)) { > + av_log(avctx, AV_LOG_ERROR, "Image size not multiple of block size\n"); > + return AVERROR_INVALIDDATA; > + } > + > /* allocate codebooks */ > s->codebook_size = MAX_CODEBOOK_SIZE; > s->codebook = av_malloc(s->codebook_size); > -- looks OK From derek.buitenhuis at gmail.com Thu May 3 18:12:35 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Thu, 03 May 2012 12:12:35 -0400 Subject: [libav-devel] [PATCH 07/14] Add SMPTE240M transfer characteristics flag. In-Reply-To: <4FA22904.8060402@gentoo.org> References: <1335720821-3233-1-git-send-email-derek.buitenhuis@gmail.com> <1335720821-3233-8-git-send-email-derek.buitenhuis@gmail.com> <4FA22904.8060402@gentoo.org> Message-ID: <4FA2AE73.6040500@gmail.com> On 03/05/2012 2:43 AM, Luca Barbato wrote: >> OK (didn't Luca change the indenting of these files?). > Yes I did. I fixed this locally already. - Derek From rsbultje at gmail.com Thu May 3 18:16:28 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Thu, 3 May 2012 09:16:28 -0700 Subject: [libav-devel] [PATCH] mp3/ac3 probe: search for PES headers to prevent probing MPEG-PS as MP3. In-Reply-To: <4FA23F61.7080601@gmail.com> References: <1336000015-35770-1-git-send-email-rsbultje@gmail.com> <4FA23F61.7080601@gmail.com> Message-ID: Hi, On Thu, May 3, 2012 at 1:18 AM, Vladimir Pantelic wrote: > Ronald S. Bultje wrote: >> >> Hi guys, >> >> On Wed, May 2, 2012 at 4:06 PM, Ronald S. Bultje >> ?wrote: >>> >>> ?From: "Ronald S. Bultje" >>> >>> ?--- >>> ? libavformat/ac3dec.c | ? 29 ++++++++++++++++++++++++----- >>> ? libavformat/mp3dec.c | ? 29 ++++++++++++++++++++++++----- >>> ? 2 files changed, 48 insertions(+), 10 deletions(-) >> >> >> Please consider this a RFC, I'm interested in ideas here. What happens >> for a significant amount of content is that it's detected as mp3 and >> mpegps at equal score, and then this code: >> >> http://git.libav.org/?p=libav.git;a=blob;f=libavformat/utils.c;h=b167e96854f57346c4eba40de598259e7aec0dd9;hb=HEAD#l339 >> will cause it to not be detected as anything at all. The above is a >> symptom, the high score for mp3 is a bug. My idea is to detect mpegps >> in mp3 and bias negatively if found. Anyone have better ideas? This >> works for problem files I have found. > > > we already probe for PES headers in the PS probe, so why do it again > in MP3 and AC3? Since MP3/AC3 in PS is likely and PES inside MP3/AC3 > is not, why not just return a higher max score for PES vs MP3/AC3? All these scores are tightly correlated, so doing that breaks other things again. I'm trying to write a testsuite for that, but sloppy bookkeeping back then doesn't help. Ronald From mashiat.sarker at gmail.com Thu May 3 19:14:46 2012 From: mashiat.sarker at gmail.com (Mashiat Sarker Shakkhar) Date: Thu, 3 May 2012 10:14:46 -0700 Subject: [libav-devel] (no subject) Message-ID: <1336065287-6320-1-git-send-email-mashiat.sarker@gmail.com> This restores code that was removed in 0e23b508214611659fc459ed6e5d6704b907694b Fixes this sample: http://stream1.criteriamx.com:8080/part.wma From mashiat.sarker at gmail.com Thu May 3 19:14:47 2012 From: mashiat.sarker at gmail.com (Mashiat Sarker Shakkhar) Date: Thu, 3 May 2012 10:14:47 -0700 Subject: [libav-devel] [PATCH] WMAL: Restore removed code in mclms_predict() In-Reply-To: <1336065287-6320-1-git-send-email-mashiat.sarker@gmail.com> References: <1336065287-6320-1-git-send-email-mashiat.sarker@gmail.com> Message-ID: <1336065287-6320-2-git-send-email-mashiat.sarker@gmail.com> Based on observations made by Jakub Stachowski --- libavcodec/wmalosslessdec.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c index ff63083..7510b12 100644 --- a/libavcodec/wmalosslessdec.c +++ b/libavcodec/wmalosslessdec.c @@ -655,6 +655,8 @@ static void mclms_predict(WmallDecodeCtx *s, int icoef, int *pred) for (ich = 0; ich < num_channels; ich++) { pred[ich] = 0; + if (!s->is_channel_coded[ich]) + continue; for (i = 0; i < order * num_channels; i++) pred[ich] += s->mclms_prevvalues[i + s->mclms_recent] * s->mclms_coeffs[i + order * num_channels * ich]; -- 1.7.5.4 From qbast at go2.pl Thu May 3 19:36:48 2012 From: qbast at go2.pl (Jakub Stachowski) Date: Thu, 3 May 2012 19:36:48 +0200 Subject: [libav-devel] [PATCH] Shift output samples by specified number of padding zeroes. Message-ID: <1336066608-23162-1-git-send-email-qbast@go2.pl> --- libavcodec/wmalosslessdec.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c index 913271e..5427024 100644 --- a/libavcodec/wmalosslessdec.c +++ b/libavcodec/wmalosslessdec.c @@ -977,10 +977,10 @@ static int decode_subframe(WmallDecodeCtx *s) for (j = 0; j < subframe_len; j++) { if (s->bits_per_sample == 16) { - *s->samples_16[c] = (int16_t) s->channel_residues[c][j]; + *s->samples_16[c] = (int16_t) s->channel_residues[c][j] << padding_zeroes; s->samples_16[c] += s->num_channels; } else { - *s->samples_32[c] = s->channel_residues[c][j]; + *s->samples_32[c] = s->channel_residues[c][j] << padding_zeroes; s->samples_32[c] += s->num_channels; } } -- 1.7.7 From kostya.shishkov at gmail.com Thu May 3 19:45:22 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Thu, 3 May 2012 19:45:22 +0200 Subject: [libav-devel] [PATCH] WMAL: Restore removed code in mclms_predict() In-Reply-To: <1336065287-6320-2-git-send-email-mashiat.sarker@gmail.com> References: <1336065287-6320-1-git-send-email-mashiat.sarker@gmail.com> <1336065287-6320-2-git-send-email-mashiat.sarker@gmail.com> Message-ID: <20120503174522.GA31294@kst-acer> On Thu, May 03, 2012 at 10:14:47AM -0700, Mashiat Sarker Shakkhar wrote: > Based on observations made by Jakub Stachowski > --- > libavcodec/wmalosslessdec.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c > index ff63083..7510b12 100644 > --- a/libavcodec/wmalosslessdec.c > +++ b/libavcodec/wmalosslessdec.c > @@ -655,6 +655,8 @@ static void mclms_predict(WmallDecodeCtx *s, int icoef, int *pred) > > for (ich = 0; ich < num_channels; ich++) { > pred[ich] = 0; > + if (!s->is_channel_coded[ich]) > + continue; > for (i = 0; i < order * num_channels; i++) > pred[ich] += s->mclms_prevvalues[i + s->mclms_recent] * > s->mclms_coeffs[i + order * num_channels * ich]; > -- Hmm, the reference decoder performs MCLMS on empty channels. It has special case to update filter state only, so quite probably the patch is correct. From kostya.shishkov at gmail.com Thu May 3 19:45:39 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Thu, 3 May 2012 19:45:39 +0200 Subject: [libav-devel] [PATCH] Shift output samples by specified number of padding zeroes. In-Reply-To: <1336066608-23162-1-git-send-email-qbast@go2.pl> References: <1336066608-23162-1-git-send-email-qbast@go2.pl> Message-ID: <20120503174539.GB31294@kst-acer> On Thu, May 03, 2012 at 07:36:48PM +0200, Jakub Stachowski wrote: > --- > libavcodec/wmalosslessdec.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c > index 913271e..5427024 100644 > --- a/libavcodec/wmalosslessdec.c > +++ b/libavcodec/wmalosslessdec.c > @@ -977,10 +977,10 @@ static int decode_subframe(WmallDecodeCtx *s) > > for (j = 0; j < subframe_len; j++) { > if (s->bits_per_sample == 16) { > - *s->samples_16[c] = (int16_t) s->channel_residues[c][j]; > + *s->samples_16[c] = (int16_t) s->channel_residues[c][j] << padding_zeroes; > s->samples_16[c] += s->num_channels; > } else { > - *s->samples_32[c] = s->channel_residues[c][j]; > + *s->samples_32[c] = s->channel_residues[c][j] << padding_zeroes; > s->samples_32[c] += s->num_channels; > } > } > -- LGTM From rsbultje at gmail.com Thu May 3 20:00:58 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Thu, 3 May 2012 11:00:58 -0700 Subject: [libav-devel] [PATCH 1/3] mp3/ac3 probe: search for PES headers to prevent probing MPEG-PS as MP3. Message-ID: <1336068060-71190-1-git-send-email-rsbultje@gmail.com> From: "Ronald S. Bultje" --- libavformat/ac3dec.c | 30 +++++++++++++++++++++++++----- libavformat/mp3dec.c | 30 +++++++++++++++++++++++++----- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/libavformat/ac3dec.c b/libavformat/ac3dec.c index 60c3cf9..c2e3301 100644 --- a/libavformat/ac3dec.c +++ b/libavformat/ac3dec.c @@ -57,11 +57,31 @@ static int ac3_eac3_probe(AVProbeData *p, enum CodecID expected_codec_id) if(codec_id != expected_codec_id) return 0; // keep this in sync with mp3 probe, both need to avoid // issues with MPEG-files! - if (first_frames>=4) return AVPROBE_SCORE_MAX/2+1; - else if(max_frames>500)return AVPROBE_SCORE_MAX/2; - else if(max_frames>=4) return AVPROBE_SCORE_MAX/4; - else if(max_frames>=1) return 1; - else return 0; + if (first_frames >= 4) return AVPROBE_SCORE_MAX / 2 + 1; + + if (max_frames) { + int pes = 0, i; + unsigned int code = -1; + +#define VIDEO_ID 0x000001e0 +#define AUDIO_ID 0x000001c0 + /* do a search for mpegps headers to be able to properly bias + * towards mpegps if we detect this stream as both. */ + for (i = 0; ibuf_size; i++) { + code = (code << 8) + p->buf[i]; + if ((code & 0xffffff00) == 0x100) { + if ((code & 0x1f0) == VIDEO_ID) pes++; + else if((code & 0x1e0) == AUDIO_ID) pes++; + } + } + + if (pes) + max_frames = (max_frames + pes - 1) / pes; + } + if (max_frames > 500) return AVPROBE_SCORE_MAX / 2; + else if (max_frames >= 4) return AVPROBE_SCORE_MAX / 4; + else if (max_frames >= 1) return 1; + else return 0; } #if CONFIG_AC3_DEMUXER diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index d233209..3987520 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -63,11 +63,31 @@ static int mp3_read_probe(AVProbeData *p) } // keep this in sync with ac3 probe, both need to avoid // issues with MPEG-files! - if (first_frames>=4) return AVPROBE_SCORE_MAX/2+1; - else if(max_frames>500)return AVPROBE_SCORE_MAX/2; - else if(max_frames>=4) return AVPROBE_SCORE_MAX/4; - else if(max_frames>=1) return 1; - else return 0; + if (first_frames >= 4) return AVPROBE_SCORE_MAX / 2 + 1; + + if (max_frames) { + int pes = 0, i; + unsigned int code = -1; + +#define VIDEO_ID 0x000001e0 +#define AUDIO_ID 0x000001c0 + /* do a search for mpegps headers to be able to properly bias + * towards mpegps if we detect this stream as both. */ + for (i = 0; ibuf_size; i++) { + code = (code << 8) + p->buf[i]; + if ((code & 0xffffff00) == 0x100) { + if ((code & 0x1f0) == VIDEO_ID) pes++; + else if((code & 0x1e0) == AUDIO_ID) pes++; + } + } + + if (pes) + max_frames = (max_frames + pes - 1) / pes; + } + if (max_frames > 500) return AVPROBE_SCORE_MAX / 2; + else if (max_frames >= 4) return AVPROBE_SCORE_MAX / 4; + else if (max_frames >= 1) return 1; + else return 0; //mpegps_mp3_unrecognized_format.mpg has max_frames=3 } -- 1.7.9.2 From rsbultje at gmail.com Thu May 3 20:00:59 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Thu, 3 May 2012 11:00:59 -0700 Subject: [libav-devel] [PATCH 2/3] avprobe: allow showing only one container/stream property. In-Reply-To: <1336068060-71190-1-git-send-email-rsbultje@gmail.com> References: <1336068060-71190-1-git-send-email-rsbultje@gmail.com> Message-ID: <1336068060-71190-2-git-send-email-rsbultje@gmail.com> From: "Ronald S. Bultje" This is useful for writing unit tests. --- avprobe.c | 67 +++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 20 deletions(-) diff --git a/avprobe.c b/avprobe.c index fe2b6e2..55dbc2a 100644 --- a/avprobe.c +++ b/avprobe.c @@ -33,6 +33,7 @@ const char program_name[] = "avprobe"; const int program_birth_year = 2007; static int do_show_format = 0; +static const char *show_format_entry = NULL; static int do_show_packets = 0; static int do_show_streams = 0; @@ -257,36 +258,53 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx) printf("[/STREAM]\n"); } +static void print_format_entry(const char *tag, + const char *val) +{ + if (!show_format_entry) { + if (tag) { + printf("%s=%s\n", tag, val); + } else { + printf("%s\n", val); + } + } else if (tag && !strcmp(tag, show_format_entry)) { + printf("%s\n", val); + } +} + static void show_format(AVFormatContext *fmt_ctx) { AVDictionaryEntry *tag = NULL; char val_str[128]; int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1; - printf("[FORMAT]\n"); - - printf("filename=%s\n", fmt_ctx->filename); - printf("nb_streams=%d\n", fmt_ctx->nb_streams); - printf("format_name=%s\n", fmt_ctx->iformat->name); - printf("format_long_name=%s\n", fmt_ctx->iformat->long_name); - printf("start_time=%s\n", - time_value_string(val_str, sizeof(val_str), - fmt_ctx->start_time, &AV_TIME_BASE_Q)); - printf("duration=%s\n", - time_value_string(val_str, sizeof(val_str), - fmt_ctx->duration, &AV_TIME_BASE_Q)); - printf("size=%s\n", size >= 0 ? value_string(val_str, sizeof(val_str), - size, unit_byte_str) + print_format_entry(NULL, "[FORMAT]"); + print_format_entry("filename", fmt_ctx->filename); + snprintf(val_str, sizeof(val_str) - 1, "%d", fmt_ctx->nb_streams); + print_format_entry("nb_streams", val_str); + print_format_entry("format_name", fmt_ctx->iformat->name); + print_format_entry("format_long_name", fmt_ctx->iformat->long_name); + print_format_entry("start_time", + time_value_string(val_str, sizeof(val_str), + fmt_ctx->start_time, &AV_TIME_BASE_Q)); + print_format_entry("duration", + time_value_string(val_str, sizeof(val_str), + fmt_ctx->duration, &AV_TIME_BASE_Q)); + print_format_entry("size", + size >= 0 ? value_string(val_str, sizeof(val_str), + size, unit_byte_str) : "unknown"); - printf("bit_rate=%s\n", - value_string(val_str, sizeof(val_str), - fmt_ctx->bit_rate, unit_bit_per_second_str)); + print_format_entry("bit_rate", + value_string(val_str, sizeof(val_str), + fmt_ctx->bit_rate, unit_bit_per_second_str)); while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, - AV_DICT_IGNORE_SUFFIX))) - printf("TAG:%s=%s\n", tag->key, tag->value); + AV_DICT_IGNORE_SUFFIX))) { + snprintf(val_str, sizeof(val_str) - 1, "TAG:%s", tag->key); + print_format_entry(val_str, tag->value); + } - printf("[/FORMAT]\n"); + print_format_entry(NULL, "[/FORMAT]"); } static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename) @@ -372,6 +390,13 @@ static int opt_format(const char *opt, const char *arg) return 0; } +static int opt_show_format_entry(const char *opt, const char *arg) +{ + do_show_format = 1; + show_format_entry = arg; + return 0; +} + static void opt_input_file(void *optctx, const char *arg) { if (input_filename) { @@ -416,6 +441,8 @@ static const OptionDef options[] = { { "pretty", 0, {(void*)&opt_pretty}, "prettify the format of displayed values, make it more human readable" }, { "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" }, + { "show_format_entry", HAS_ARG, {(void*)opt_show_format_entry}, + "show a particular entry from the format/container info" }, { "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" }, { "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" }, { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, -- 1.7.9.2 From rsbultje at gmail.com Thu May 3 20:01:00 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Thu, 3 May 2012 11:01:00 -0700 Subject: [libav-devel] [PATCH 3/3] Add probe fate tests to test for regressions in detecting media types. In-Reply-To: <1336068060-71190-1-git-send-email-rsbultje@gmail.com> References: <1336068060-71190-1-git-send-email-rsbultje@gmail.com> Message-ID: <1336068060-71190-3-git-send-email-rsbultje@gmail.com> From: "Ronald S. Bultje" --- tests/Makefile | 1 + tests/fate-run.sh | 4 ++++ tests/fate/probe.mak | 11 +++++++++++ tests/ref/fate/probe-roundup1383 | 1 + tests/ref/fate/probe-roundup1414 | 1 + tests/ref/fate/probe-roundup2015 | 1 + tests/ref/fate/probe-roundup997 | 1 + 7 files changed, 20 insertions(+) create mode 100644 tests/fate/probe.mak create mode 100644 tests/ref/fate/probe-roundup1383 create mode 100644 tests/ref/fate/probe-roundup1414 create mode 100644 tests/ref/fate/probe-roundup2015 create mode 100644 tests/ref/fate/probe-roundup997 diff --git a/tests/Makefile b/tests/Makefile index 19fbe11..a8db07f 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -48,6 +48,7 @@ include $(SRC_PATH)/tests/fate/microsoft.mak include $(SRC_PATH)/tests/fate/mp3.mak include $(SRC_PATH)/tests/fate/mpc.mak include $(SRC_PATH)/tests/fate/pcm.mak +include $(SRC_PATH)/tests/fate/probe.mak include $(SRC_PATH)/tests/fate/prores.mak include $(SRC_PATH)/tests/fate/qt.mak include $(SRC_PATH)/tests/fate/qtrle.mak diff --git a/tests/fate-run.sh b/tests/fate-run.sh index f7a7aba..10f0dd2 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -65,6 +65,10 @@ run(){ $target_exec $target_path/"$@" } +probe(){ + run avprobe -show_format_entry format_name -v 0 "$@" +} + avconv(){ run avconv -nostats -threads $threads -thread_type $thread_type -cpuflags $cpuflags "$@" } diff --git a/tests/fate/probe.mak b/tests/fate/probe.mak new file mode 100644 index 0000000..e3cc9ff --- /dev/null +++ b/tests/fate/probe.mak @@ -0,0 +1,11 @@ +fate-probe-roundup1383: CMD = probe $(SAMPLES)/probe/roundup1383 +fate-probe-roundup2015: CMD = probe $(SAMPLES)/probe/roundup2015 +fate-probe-roundup997: CMD = probe $(SAMPLES)/probe/roundup997 +fate-probe-roundup1414: CMD = probe $(SAMPLES)/probe/roundup1414 + +FATE_PROBE = fate-probe-roundup1383 \ + fate-probe-roundup2015 \ + fate-probe-roundup997 \ + fate-probe-roundup1414 +FATE_TESTS += $(FATE_PROBE) +fate-probe: $(FATE_PROBE) diff --git a/tests/ref/fate/probe-roundup1383 b/tests/ref/fate/probe-roundup1383 new file mode 100644 index 0000000..663e668 --- /dev/null +++ b/tests/ref/fate/probe-roundup1383 @@ -0,0 +1 @@ +mp3 diff --git a/tests/ref/fate/probe-roundup1414 b/tests/ref/fate/probe-roundup1414 new file mode 100644 index 0000000..9d6b481 --- /dev/null +++ b/tests/ref/fate/probe-roundup1414 @@ -0,0 +1 @@ +mpeg diff --git a/tests/ref/fate/probe-roundup2015 b/tests/ref/fate/probe-roundup2015 new file mode 100644 index 0000000..bc33ba3 --- /dev/null +++ b/tests/ref/fate/probe-roundup2015 @@ -0,0 +1 @@ +dv diff --git a/tests/ref/fate/probe-roundup997 b/tests/ref/fate/probe-roundup997 new file mode 100644 index 0000000..9d6b481 --- /dev/null +++ b/tests/ref/fate/probe-roundup997 @@ -0,0 +1 @@ +mpeg -- 1.7.9.2 From rsbultje at gmail.com Thu May 3 20:02:16 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Thu, 3 May 2012 11:02:16 -0700 Subject: [libav-devel] [PATCH 3/3] Add probe fate tests to test for regressions in detecting media types. In-Reply-To: <1336068060-71190-3-git-send-email-rsbultje@gmail.com> References: <1336068060-71190-1-git-send-email-rsbultje@gmail.com> <1336068060-71190-3-git-send-email-rsbultje@gmail.com> Message-ID: Hi, On Thu, May 3, 2012 at 11:01 AM, Ronald S. Bultje wrote: [..] FYI, files are small cuts of roundup samples that reproduced the described issues for me. I will upload to the fate server once the patch is OK'ed. Ronald From anton at khirnov.net Thu May 3 20:05:07 2012 From: anton at khirnov.net (Anton Khirnov) Date: Thu, 3 May 2012 20:05:07 +0200 Subject: [libav-devel] [PATCH 3/4] lavfi: add a function for copying properties from AVFilterBufferRef->AVFrame In-Reply-To: <1336068308-16353-1-git-send-email-anton@khirnov.net> References: <1336068308-16353-1-git-send-email-anton@khirnov.net> Message-ID: <1336068308-16353-3-git-send-email-anton@khirnov.net> Based on a commit by Stefano Sabatini --- I'm not sure if I should make this function copy the data pointers as well. Can anyone imagine a situation where the user might want to use this function but keep the data pointers in target AVFrame preserved? --- libavfilter/avfilter.c | 19 +++++++++++++++++++ libavfilter/avfilter.h | 8 ++++++++ 2 files changed, 27 insertions(+) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index d426591..e3920de 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -700,3 +700,22 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) return 0; } + +int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src) +{ + if (src->type != AVMEDIA_TYPE_VIDEO) + return AVERROR(EINVAL); + + dst->pts = src->pts; + dst->format = src->format; + + dst->width = src->video->w; + dst->height = src->video->h; + dst->sample_aspect_ratio = src->video->pixel_aspect; + dst->interlaced_frame = src->video->interlaced; + dst->top_field_first = src->video->top_field_first; + dst->key_frame = src->video->key_frame; + dst->pict_type = src->video->pict_type; + + return 0; +} diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 068c50b..e8a94b5 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -862,4 +862,12 @@ static inline void avfilter_insert_outpad(AVFilterContext *f, unsigned index, */ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src); +/** + * Copy the frame properties of src to dst, without copying the actual + * data. + * + * @return 0 on success, a negative number on error. + */ +int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src); + #endif /* AVFILTER_AVFILTER_H */ -- 1.7.9.5 From anton at khirnov.net Thu May 3 20:05:06 2012 From: anton at khirnov.net (Anton Khirnov) Date: Thu, 3 May 2012 20:05:06 +0200 Subject: [libav-devel] [PATCH 2/4] vf_split: support user-specifiable number of outputs. In-Reply-To: <1336068308-16353-1-git-send-email-anton@khirnov.net> References: <1336068308-16353-1-git-send-email-anton@khirnov.net> Message-ID: <1336068308-16353-2-git-send-email-anton@khirnov.net> --- doc/filters.texi | 13 +++++++++ libavfilter/vf_split.c | 68 +++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 68 insertions(+), 13 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index b012dc7..c5a56f4 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -1666,6 +1666,19 @@ not specified it will use the default value of 16. Adding this in the beginning of filter chains should make filtering faster due to better use of the memory cache. + at section split + +Split input video into several identical outputs. + +The filter accepts a single parameter which specifies the number of outputs. If +unspecified, it defaults to 2. + +For example + at example +avconv -i INPUT -filter_complex split=5 OUTPUT + at end example +will create 5 copies of the input video. + @section transpose Transpose rows with columns in the input video and optionally flip it. diff --git a/libavfilter/vf_split.c b/libavfilter/vf_split.c index 54fdd21..da6b3ff 100644 --- a/libavfilter/vf_split.c +++ b/libavfilter/vf_split.c @@ -25,24 +25,67 @@ #include "avfilter.h" +static int split_init(AVFilterContext *ctx, const char *args, void *opaque) +{ + int i, nb_outputs = 2; + + if (args) { + nb_outputs = strtol(args, NULL, 0); + if (nb_outputs <= 0) { + av_log(ctx, AV_LOG_ERROR, "Invalid number of outputs specified: %d.\n", + nb_outputs); + return AVERROR(EINVAL); + } + } + + for (i = 0; i < nb_outputs; i++) { + char name[32]; + AVFilterPad pad = { 0 }; + + snprintf(name, sizeof(name), "output%d", i); + pad.type = AVMEDIA_TYPE_VIDEO; + pad.name = av_strdup(name); + + avfilter_insert_outpad(ctx, i, &pad); + } + + return 0; +} + +static void split_uninit(AVFilterContext *ctx) +{ + int i; + + for (i = 0; i < ctx->output_count; i++) + av_freep(&ctx->output_pads[i].name); +} + static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) { - avfilter_start_frame(inlink->dst->outputs[0], - avfilter_ref_buffer(picref, ~AV_PERM_WRITE)); - avfilter_start_frame(inlink->dst->outputs[1], - avfilter_ref_buffer(picref, ~AV_PERM_WRITE)); + AVFilterContext *ctx = inlink->dst; + int i; + + for (i = 0; i < ctx->output_count; i++) + avfilter_start_frame(ctx->outputs[i], + avfilter_ref_buffer(picref, ~AV_PERM_WRITE)); } static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { - avfilter_draw_slice(inlink->dst->outputs[0], y, h, slice_dir); - avfilter_draw_slice(inlink->dst->outputs[1], y, h, slice_dir); + AVFilterContext *ctx = inlink->dst; + int i; + + for (i = 0; i < ctx->output_count; i++) + avfilter_draw_slice(ctx->outputs[i], y, h, slice_dir); } static void end_frame(AVFilterLink *inlink) { - avfilter_end_frame(inlink->dst->outputs[0]); - avfilter_end_frame(inlink->dst->outputs[1]); + AVFilterContext *ctx = inlink->dst; + int i; + + for (i = 0; i < ctx->output_count; i++) + avfilter_end_frame(ctx->outputs[i]); avfilter_unref_buffer(inlink->cur_buf); } @@ -51,6 +94,9 @@ AVFilter avfilter_vf_split = { .name = "split", .description = NULL_IF_CONFIG_SMALL("Pass on the input to two outputs."), + .init = split_init, + .uninit = split_uninit, + .inputs = (AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, .get_video_buffer= avfilter_null_get_video_buffer, @@ -58,9 +104,5 @@ AVFilter avfilter_vf_split = { .draw_slice = draw_slice, .end_frame = end_frame, }, { .name = NULL}}, - .outputs = (AVFilterPad[]) {{ .name = "output1", - .type = AVMEDIA_TYPE_VIDEO, }, - { .name = "output2", - .type = AVMEDIA_TYPE_VIDEO, }, - { .name = NULL}}, + .outputs = (AVFilterPad[]) {{ .name = NULL}}, }; -- 1.7.9.5 From anton at khirnov.net Thu May 3 20:05:05 2012 From: anton at khirnov.net (Anton Khirnov) Date: Thu, 3 May 2012 20:05:05 +0200 Subject: [libav-devel] [PATCH 1/4] vsrc_buffer: return EAGAIN if no frame is available. Message-ID: <1336068308-16353-1-git-send-email-anton@khirnov.net> From: Nicolas George This is not an erroneous condition, do not print a warning. --- libavfilter/vsrc_buffer.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavfilter/vsrc_buffer.c b/libavfilter/vsrc_buffer.c index 742943a..1ace368 100644 --- a/libavfilter/vsrc_buffer.c +++ b/libavfilter/vsrc_buffer.c @@ -175,9 +175,7 @@ static int request_frame(AVFilterLink *link) if (!av_fifo_size(c->fifo)) { if (c->eof) return AVERROR_EOF; - av_log(link->src, AV_LOG_ERROR, - "request_frame() called with no available frame!\n"); - return AVERROR(EINVAL); + return AVERROR(EAGAIN); } av_fifo_generic_read(c->fifo, &buf, sizeof(buf), NULL); -- 1.7.9.5 From anton at khirnov.net Thu May 3 20:05:08 2012 From: anton at khirnov.net (Anton Khirnov) Date: Thu, 3 May 2012 20:05:08 +0200 Subject: [libav-devel] [PATCH 4/4] lavfi: add vsink_buffer, and use it in avtools In-Reply-To: <1336068308-16353-1-git-send-email-anton@khirnov.net> References: <1336068308-16353-1-git-send-email-anton@khirnov.net> Message-ID: <1336068308-16353-4-git-send-email-anton@khirnov.net> Also add the public interface libavfilter/buffersink.h. --- avconv.c | 106 ++++++++++++++++++++++++++++++------------ avplay.c | 31 +++++++++---- cmdutils.c | 68 --------------------------- cmdutils.h | 15 ------ doc/APIchanges | 5 ++ doc/filters.texi | 8 ++++ libavfilter/Makefile | 3 +- libavfilter/allfilters.c | 6 ++- libavfilter/buffersink.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++ libavfilter/buffersink.h | 43 +++++++++++++++++ libavfilter/version.h | 2 +- 11 files changed, 277 insertions(+), 124 deletions(-) create mode 100644 libavfilter/buffersink.c create mode 100644 libavfilter/buffersink.h diff --git a/avconv.c b/avconv.c index f702d9d..720e7bf 100644 --- a/avconv.c +++ b/avconv.c @@ -50,6 +50,7 @@ # include "libavfilter/avfilter.h" # include "libavfilter/avfiltergraph.h" # include "libavfilter/buffersrc.h" +# include "libavfilter/buffersink.h" # include "libavfilter/vsrc_buffer.h" #if HAVE_SYS_RESOURCE_H @@ -582,14 +583,25 @@ static void filter_release_buffer(AVFilterBuffer *fb) unref_buffer(buf->ist, buf); } -static const enum PixelFormat *choose_pixel_fmts(OutputStream *ost) +static char *choose_pixel_fmts(OutputStream *ost) { if (ost->st->codec->pix_fmt != PIX_FMT_NONE) { - ost->pix_fmts[0] = ost->st->codec->pix_fmt; - return ost->pix_fmts; - } else if (ost->enc->pix_fmts) - return ost->enc->pix_fmts; - else + return av_strdup(av_get_pix_fmt_name(ost->st->codec->pix_fmt)); + } else if (ost->enc->pix_fmts) { + const enum PixelFormat *p; + AVIOContext *s = NULL; + uint8_t *ret; + int len; + + if (avio_open_dyn_buf(&s) < 0) + exit_program(1); + + for (p = ost->enc->pix_fmts; *p != PIX_FMT_NONE; p++) + avio_printf(s, "%s:", av_get_pix_fmt_name(*p)); + len = avio_close_dyn_buf(s, &ret); + ret[len - 1] = 0; + return ret; + } else return NULL; } @@ -597,10 +609,10 @@ static int configure_video_filters(FilterGraph *fg) { InputStream *ist = fg->inputs[0]->ist; OutputStream *ost = fg->outputs[0]->ost; - AVFilterContext *last_filter, *filter; + AVFilterContext *in_filter, *out_filter, *filter; /** filter graph containing all filters including input & output */ AVCodecContext *codec = ost->st->codec; - SinkContext sink_ctx = { .pix_fmts = choose_pixel_fmts(ost) }; + char *pix_fmts; AVRational sample_aspect_ratio; char args[255]; int ret; @@ -622,11 +634,13 @@ static int configure_video_filters(FilterGraph *fg) "src", args, NULL, fg->graph); if (ret < 0) return ret; - ret = avfilter_graph_create_filter(&fg->outputs[0]->filter, &sink, - "out", NULL, &sink_ctx, fg->graph); + ret = avfilter_graph_create_filter(&fg->outputs[0]->filter, + avfilter_get_by_name("buffersink"), + "out", NULL, NULL, fg->graph); if (ret < 0) return ret; - last_filter = fg->inputs[0]->filter; + in_filter = fg->inputs[0]->filter; + out_filter = fg->outputs[0]->filter; if (codec->width || codec->height) { snprintf(args, 255, "%d:%d:flags=0x%X", @@ -636,9 +650,22 @@ static int configure_video_filters(FilterGraph *fg) if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"), NULL, args, NULL, fg->graph)) < 0) return ret; - if ((ret = avfilter_link(last_filter, 0, filter, 0)) < 0) + if ((ret = avfilter_link(in_filter, 0, filter, 0)) < 0) return ret; - last_filter = filter; + in_filter = filter; + } + + if ((pix_fmts = choose_pixel_fmts(ost))) { + if ((ret = avfilter_graph_create_filter(&filter, + avfilter_get_by_name("format"), + "format", pix_fmts, NULL, + fg->graph)) < 0) + return ret; + if ((ret = avfilter_link(filter, 0, out_filter, 0)) < 0) + return ret; + + out_filter = filter; + av_freep(&pix_fmts); } snprintf(args, sizeof(args), "flags=0x%X", (unsigned)ost->sws_flags); @@ -649,19 +676,19 @@ static int configure_video_filters(FilterGraph *fg) AVFilterInOut *inputs = avfilter_inout_alloc(); outputs->name = av_strdup("in"); - outputs->filter_ctx = last_filter; + outputs->filter_ctx = in_filter; outputs->pad_idx = 0; outputs->next = NULL; inputs->name = av_strdup("out"); - inputs->filter_ctx = fg->outputs[0]->filter; + inputs->filter_ctx = out_filter; inputs->pad_idx = 0; inputs->next = NULL; if ((ret = avfilter_graph_parse(fg->graph, ost->avfilter, inputs, outputs, NULL)) < 0) return ret; } else { - if ((ret = avfilter_link(last_filter, 0, fg->outputs[0]->filter, 0)) < 0) + if ((ret = avfilter_link(in_filter, 0, out_filter, 0)) < 0) return ret; } @@ -777,33 +804,52 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in) static int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out) { - SinkContext sink_ctx; + char *pix_fmts; AVCodecContext *codec = ofilter->ost->st->codec; AVFilterContext *last_filter = out->filter_ctx; int pad_idx = out->pad_idx; int ret; - sink_ctx.pix_fmts = choose_pixel_fmts(ofilter->ost); - ret = avfilter_graph_create_filter(&ofilter->filter, &sink, - "out", NULL, &sink_ctx, fg->graph); + ret = avfilter_graph_create_filter(&ofilter->filter, + avfilter_get_by_name("buffersink"), + "out", NULL, pix_fmts, fg->graph); if (ret < 0) return ret; if (codec->width || codec->height) { char args[255]; + AVFilterContext *filter; + snprintf(args, sizeof(args), "%d:%d:flags=0x%X", codec->width, codec->height, (unsigned)ofilter->ost->sws_flags); - if ((ret = avfilter_graph_create_filter(&last_filter, avfilter_get_by_name("scale"), + if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"), NULL, args, NULL, fg->graph)) < 0) return ret; - if ((ret = avfilter_link(out->filter_ctx, out->pad_idx, last_filter, 0)) < 0) + if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0) return ret; + + last_filter = filter; pad_idx = 0; } + if ((pix_fmts = choose_pixel_fmts(ofilter->ost))) { + AVFilterContext *filter; + if ((ret = avfilter_graph_create_filter(&filter, + avfilter_get_by_name("format"), + "format", pix_fmts, NULL, + fg->graph)) < 0) + return ret; + if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0) + return ret; + + last_filter = filter; + pad_idx = 0; + av_freep(&pix_fmts); + } + if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0) return ret; @@ -1802,7 +1848,7 @@ static int poll_filters(void) { AVFilterBufferRef *picref; AVFrame *filtered_frame = NULL; - int i, frame_size, ret; + int i, frame_size; for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; @@ -1817,13 +1863,13 @@ static int poll_filters(void) avcodec_get_frame_defaults(ost->filtered_frame); filtered_frame = ost->filtered_frame; - while (avfilter_poll_frame(ost->filter->filter->inputs[0])) { - AVRational ist_pts_tb; - if ((ret = get_filtered_video_frame(ost->filter->filter, - filtered_frame, &picref, - &ist_pts_tb)) < 0) - return ret; - filtered_frame->pts = av_rescale_q(picref->pts, ist_pts_tb, AV_TIME_BASE_Q); + while (av_buffersink_get_buf(ost->filter->filter, &picref) >= 0) { + avfilter_copy_buf_props(filtered_frame, picref); + filtered_frame->pts = av_rescale_q(picref->pts, + ost->filter->filter->inputs[0]->time_base, + AV_TIME_BASE_Q); + memcpy(filtered_frame->data, picref->data, sizeof(filtered_frame->data)); + memcpy(filtered_frame->linesize, picref->linesize, sizeof(filtered_frame->linesize)); if (of->start_time && filtered_frame->pts < of->start_time) return 0; diff --git a/avplay.c b/avplay.c index 0d72f46..68d05b4 100644 --- a/avplay.c +++ b/avplay.c @@ -41,6 +41,7 @@ #if CONFIG_AVFILTER # include "libavfilter/avfilter.h" # include "libavfilter/avfiltergraph.h" +# include "libavfilter/buffersink.h" #endif #include "cmdutils.h" @@ -1704,21 +1705,28 @@ static AVFilter input_filter = static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const char *vfilters) { - static const enum PixelFormat pix_fmts[] = { PIX_FMT_YUV420P, PIX_FMT_NONE }; char sws_flags_str[128]; int ret; - SinkContext sink_ctx = { .pix_fmts = pix_fmts }; - AVFilterContext *filt_src = NULL, *filt_out = NULL; + AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_format; snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%d", sws_flags); graph->scale_sws_opts = av_strdup(sws_flags_str); if ((ret = avfilter_graph_create_filter(&filt_src, &input_filter, "src", NULL, is, graph)) < 0) return ret; - if ((ret = avfilter_graph_create_filter(&filt_out, &sink, "out", - NULL, &sink_ctx, graph)) < 0) + if ((ret = avfilter_graph_create_filter(&filt_out, + avfilter_get_by_name("buffersink"), + "out", NULL, NULL, graph)) < 0) return ret; + if ((ret = avfilter_graph_create_filter(&filt_format, + avfilter_get_by_name("format"), + "format", "yuv420p", NULL, graph)) < 0) + return ret; + if ((ret = avfilter_link(filt_format, 0, filt_out, 0)) < 0) + return ret; + + if (vfilters) { AVFilterInOut *outputs = avfilter_inout_alloc(); AVFilterInOut *inputs = avfilter_inout_alloc(); @@ -1729,14 +1737,14 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c outputs->next = NULL; inputs->name = av_strdup("out"); - inputs->filter_ctx = filt_out; + inputs->filter_ctx = filt_format; inputs->pad_idx = 0; inputs->next = NULL; if ((ret = avfilter_graph_parse(graph, vfilters, inputs, outputs, NULL)) < 0) return ret; } else { - if ((ret = avfilter_link(filt_src, 0, filt_out, 0)) < 0) + if ((ret = avfilter_link(filt_src, 0, filt_format, 0)) < 0) return ret; } @@ -1792,11 +1800,18 @@ static int video_thread(void *arg) last_w = is->video_st->codec->width; last_h = is->video_st->codec->height; } - ret = get_filtered_video_frame(filt_out, frame, &picref, &tb); + ret = av_buffersink_get_buf(filt_out, &picref); if (picref) { + avfilter_copy_buf_props(frame, picref); + memcpy(frame->data, picref->data, sizeof(frame->data)); + memcpy(frame->linesize, picref->linesize, sizeof(frame->linesize)); + pts_int = picref->pts; + tb = filt_out->inputs[0]->time_base; pos = picref->pos; frame->opaque = picref; + + ret = 1; } if (ret >= 0 && av_cmp_q(tb, is->video_st->time_base)) { diff --git a/cmdutils.c b/cmdutils.c index 6d2e97f..3cd11ca 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -1021,74 +1021,6 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, return opts; } -#if CONFIG_AVFILTER - -static int sink_init(AVFilterContext *ctx, const char *args, void *opaque) -{ - SinkContext *priv = ctx->priv; - - if (!opaque) - return AVERROR(EINVAL); - *priv = *(SinkContext *)opaque; - - return 0; -} - -static void null_end_frame(AVFilterLink *inlink) { } - -static int sink_query_formats(AVFilterContext *ctx) -{ - SinkContext *priv = ctx->priv; - - if (priv->pix_fmts) - avfilter_set_common_formats(ctx, avfilter_make_format_list(priv->pix_fmts)); - else - avfilter_default_query_formats(ctx); - return 0; -} - -AVFilter sink = { - .name = "sink", - .priv_size = sizeof(SinkContext), - .init = sink_init, - - .query_formats = sink_query_formats, - - .inputs = (AVFilterPad[]) {{ .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - .end_frame = null_end_frame, - .min_perms = AV_PERM_READ, }, - { .name = NULL }}, - .outputs = (AVFilterPad[]) {{ .name = NULL }}, -}; - -int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame, - AVFilterBufferRef **picref_ptr, AVRational *tb) -{ - int ret; - AVFilterBufferRef *picref; - - if ((ret = avfilter_request_frame(ctx->inputs[0])) < 0) - return ret; - if (!(picref = ctx->inputs[0]->cur_buf)) - return AVERROR(ENOENT); - *picref_ptr = picref; - ctx->inputs[0]->cur_buf = NULL; - *tb = ctx->inputs[0]->time_base; - - memcpy(frame->data, picref->data, sizeof(frame->data)); - memcpy(frame->linesize, picref->linesize, sizeof(frame->linesize)); - frame->interlaced_frame = picref->video->interlaced; - frame->top_field_first = picref->video->top_field_first; - frame->key_frame = picref->video->key_frame; - frame->pict_type = picref->video->pict_type; - frame->sample_aspect_ratio = picref->video->pixel_aspect; - - return 1; -} - -#endif /* CONFIG_AVFILTER */ - void *grow_array(void *array, int elem_size, int *size, int new_size) { if (new_size >= INT_MAX / elem_size) { diff --git a/cmdutils.h b/cmdutils.h index 792254c..6fff47d 100644 --- a/cmdutils.h +++ b/cmdutils.h @@ -367,21 +367,6 @@ int64_t guess_correct_pts(PtsCorrectionContext *ctx, int64_t pts, int64_t dts); FILE *get_preset_file(char *filename, size_t filename_size, const char *preset_name, int is_path, const char *codec_name); -typedef struct { - const enum PixelFormat *pix_fmts; -} SinkContext; - -extern AVFilter sink; - -/** - * Extract a frame from sink. - * - * @return a negative error in case of failure, 1 if one frame has - * been extracted successfully. - */ -int get_filtered_video_frame(AVFilterContext *sink, AVFrame *frame, - AVFilterBufferRef **picref, AVRational *pts_tb); - /** * Do all the necessary cleanup and abort. * This function is implemented in the avtools, not cmdutils. diff --git a/doc/APIchanges b/doc/APIchanges index 4d3810a..2bdee90 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,11 @@ libavutil: 2011-04-18 API changes, most recent first: +2012-05-xx - lavfi 2.17.0 + xxxxxxx - Add avfilter_copy_buf_props() for copying AVFilterBufferRef + properties to an AVFrame. + xxxxxxx - Add video sink buffer and buffersink.h public header. + 2012-04-25 - xxxxxxx - lavu 51.29.0 - cpu.h Add av_parse_cpu_flags() diff --git a/doc/filters.texi b/doc/filters.texi index c5a56f4..dbcc86a 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -2078,6 +2078,14 @@ will generate a video with a duration of 5.3 seconds, with size Below is a description of the currently available video sinks. + at section buffersink + +Buffer video frames, and make them available to the end of the filter +graph. + +This sink is intended for a programmatic use through the interface defined in + at file{libavfilter/buffersink.h}. + @section nullsink Null video sink, do absolutely nothing with the input video. It is diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 6ee94e9..f159257 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -3,11 +3,12 @@ FFLIBS = avutil FFLIBS-$(CONFIG_MOVIE_FILTER) += avformat avcodec FFLIBS-$(CONFIG_SCALE_FILTER) += swscale -HEADERS = avfilter.h avfiltergraph.h buffersrc.h version.h vsrc_buffer.h +HEADERS = avfilter.h avfiltergraph.h buffersink.h buffersrc.h version.h vsrc_buffer.h OBJS = allfilters.o \ avfilter.o \ avfiltergraph.o \ + buffersink.o \ defaults.o \ drawutils.o \ formats.o \ diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index ba66941..26cdcc8 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -89,9 +89,13 @@ void avfilter_register_all(void) REGISTER_FILTER (NULLSINK, nullsink, vsink); - /* vsrc_buffer is a part of public API => registered unconditionally */ + /* vsrc/sink_buffer are parts of public API => registered unconditionally */ { extern AVFilter avfilter_vsrc_buffer; avfilter_register(&avfilter_vsrc_buffer); } + { + extern AVFilter avfilter_vsink_buffer; + avfilter_register(&avfilter_vsink_buffer); + } } diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c new file mode 100644 index 0000000..19fbbb2 --- /dev/null +++ b/libavfilter/buffersink.c @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2011 Stefano Sabatini + * + * 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 + */ + +/** + * @file + * buffer sink + */ + +#include "libavutil/fifo.h" + +#include "avfilter.h" +#include "buffersink.h" + +typedef struct { + AVFifoBuffer *fifo; ///< FIFO buffer of video frame references +} BufferSinkContext; + +#define FIFO_INIT_SIZE 8 + +static av_cold void uninit(AVFilterContext *ctx) +{ + BufferSinkContext *sink = ctx->priv; + + while (sink->fifo && av_fifo_size(sink->fifo)) { + AVFilterBufferRef *buf; + av_fifo_generic_read(sink->fifo, &buf, sizeof(buf), NULL); + avfilter_unref_buffer(buf); + } + av_fifo_free(sink->fifo); +} + +static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) +{ + BufferSinkContext *sink = ctx->priv; + + if (!(sink->fifo = av_fifo_alloc(FIFO_INIT_SIZE*sizeof(AVFilterBufferRef*)))) { + av_log(ctx, AV_LOG_ERROR, "Failed to allocate fifo\n"); + return AVERROR(ENOMEM); + } + + return 0; +} + +static void end_frame(AVFilterLink *link) +{ + AVFilterContext *ctx = link->dst; + BufferSinkContext *sink = ctx->priv; + + if (av_fifo_space(sink->fifo) < sizeof(AVFilterBufferRef *) && + (av_fifo_realloc2(sink->fifo, av_fifo_size(sink->fifo) * 2) < 0)) { + av_log(ctx, AV_LOG_ERROR, "Error reallocating the FIFO.\n"); + return; + } + + av_fifo_generic_write(sink->fifo, &link->cur_buf, sizeof(link->cur_buf), NULL); + link->cur_buf = NULL; +} + +int av_buffersink_get_buf(AVFilterContext *ctx, AVFilterBufferRef **buf) +{ + BufferSinkContext *sink = ctx->priv; + AVFilterLink *link = ctx->inputs[0]; + int ret; + + if (!buf) { + if (av_fifo_size(sink->fifo)) + return av_fifo_size(sink->fifo)/sizeof(*buf); + else + return avfilter_poll_frame(ctx->inputs[0]); + } + + if (!av_fifo_size(sink->fifo) && + (ret = avfilter_request_frame(link)) < 0) + return ret; + + if (!av_fifo_size(sink->fifo)) + return AVERROR(EINVAL); + + av_fifo_generic_read(sink->fifo, buf, sizeof(*buf), NULL); + + return 0; +} + +AVFilter avfilter_vsink_buffer = { + .name = "buffersink", + .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."), + .priv_size = sizeof(BufferSinkContext), + .init = init, + .uninit = uninit, + + .inputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .end_frame = end_frame, + .min_perms = AV_PERM_READ, }, + { .name = NULL }}, + .outputs = (AVFilterPad[]) {{ .name = NULL }}, +}; diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h new file mode 100644 index 0000000..381ca6f --- /dev/null +++ b/libavfilter/buffersink.h @@ -0,0 +1,43 @@ +/* + * 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 + */ + +#ifndef AVFILTER_BUFFERSINK_H +#define AVFILTER_BUFFERSINK_H + +/** + * @file + * memory buffer sink API + */ + +#include "avfilter.h" + +/** + * Get a buffer with filtered data from sink and put it in buf. + * + * @param sink pointer to a context of a buffersink AVFilter. + * @param buf pointer to the buffer will be written here if buf is non-NULL. buf + * must be freed by the caller using avfilter_unref_buffer(). + * Buf may also be NULL to query whether a buffer is ready to be + * output. + * + * @return >= 0 in case of success, a negative AVERROR code in case of + * failure. + */ +int av_buffersink_get_buf(AVFilterContext *sink, AVFilterBufferRef **buf); + +#endif /* AVFILTER_BUFFERSINK_H */ diff --git a/libavfilter/version.h b/libavfilter/version.h index 5d646e4..7156eae 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -29,7 +29,7 @@ #include "libavutil/avutil.h" #define LIBAVFILTER_VERSION_MAJOR 2 -#define LIBAVFILTER_VERSION_MINOR 16 +#define LIBAVFILTER_VERSION_MINOR 17 #define LIBAVFILTER_VERSION_MICRO 0 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ -- 1.7.9.5 From mans at mansr.com Thu May 3 20:14:24 2012 From: mans at mansr.com (Mans Rullgard) Date: Thu, 3 May 2012 19:14:24 +0100 Subject: [libav-devel] [PATCH] arm: intreadwrite: revert 16-bit load asm to old version for gcc < 4.6 Message-ID: <1336068864-21755-1-git-send-email-mans@mansr.com> Commit adebad0 "arm: intreadwrite: fix inline asm constraints for gcc 4.6 and later" caused some older gcc versions to miscompile code. This reverts to the old version of the code for these compilers. Signed-off-by: Mans Rullgard --- libavutil/arm/intreadwrite.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavutil/arm/intreadwrite.h b/libavutil/arm/intreadwrite.h index 86b93c9..ed53330 100644 --- a/libavutil/arm/intreadwrite.h +++ b/libavutil/arm/intreadwrite.h @@ -30,7 +30,9 @@ static av_always_inline unsigned AV_RN16(const void *p) { const uint8_t *q = p; unsigned v; -#ifdef __thumb__ +#if !AV_GCC_VERSION_AT_LEAST(4,6) + __asm__ ("ldrh %0, %1" : "=r"(v) : "m"(*(const uint16_t *)q)); +#elif defined __thumb__ __asm__ ("ldrh %0, %1" : "=r"(v) : "m"(q[0]), "m"(q[1])); #else __asm__ ("ldrh %0, %1" : "=r"(v) : "Uq"(q[0]), "m"(q[1])); -- 1.7.10 From anton at khirnov.net Thu May 3 20:14:41 2012 From: anton at khirnov.net (Anton Khirnov) Date: Thu, 03 May 2012 20:14:41 +0200 Subject: [libav-devel] [PATCH 2/3] avprobe: allow showing only one container/stream property. In-Reply-To: <1336068060-71190-2-git-send-email-rsbultje@gmail.com> References: <1336068060-71190-1-git-send-email-rsbultje@gmail.com> <1336068060-71190-2-git-send-email-rsbultje@gmail.com> Message-ID: <20120503181441.4214.12779@daenerys.khirnov.net> On Thu, 3 May 2012 11:00:59 -0700, "Ronald S. Bultje" wrote: > From: "Ronald S. Bultje" > > This is useful for writing unit tests. > --- Documentation where? -- Anton Khirnov From alex.converse at gmail.com Thu May 3 20:14:44 2012 From: alex.converse at gmail.com (Alex Converse) Date: Thu, 3 May 2012 11:14:44 -0700 Subject: [libav-devel] [PATCH 3/3] Add probe fate tests to test for regressions in detecting media types. In-Reply-To: <1336068060-71190-3-git-send-email-rsbultje@gmail.com> References: <1336068060-71190-1-git-send-email-rsbultje@gmail.com> <1336068060-71190-3-git-send-email-rsbultje@gmail.com> Message-ID: On Thu, May 3, 2012 at 11:01 AM, Ronald S. Bultje wrote: > From: "Ronald S. Bultje" > Thank you so much > --- > ?tests/Makefile ? ? ? ? ? ? ? ? ? | ? ?1 + > ?tests/fate-run.sh ? ? ? ? ? ? ? ?| ? ?4 ++++ > ?tests/fate/probe.mak ? ? ? ? ? ? | ? 11 +++++++++++ > ?tests/ref/fate/probe-roundup1383 | ? ?1 + > ?tests/ref/fate/probe-roundup1414 | ? ?1 + > ?tests/ref/fate/probe-roundup2015 | ? ?1 + > ?tests/ref/fate/probe-roundup997 ?| ? ?1 + > ?7 files changed, 20 insertions(+) > ?create mode 100644 tests/fate/probe.mak > ?create mode 100644 tests/ref/fate/probe-roundup1383 > ?create mode 100644 tests/ref/fate/probe-roundup1414 > ?create mode 100644 tests/ref/fate/probe-roundup2015 > ?create mode 100644 tests/ref/fate/probe-roundup997 > > diff --git a/tests/Makefile b/tests/Makefile > index 19fbe11..a8db07f 100644 > --- a/tests/Makefile > +++ b/tests/Makefile > @@ -48,6 +48,7 @@ include $(SRC_PATH)/tests/fate/microsoft.mak > ?include $(SRC_PATH)/tests/fate/mp3.mak > ?include $(SRC_PATH)/tests/fate/mpc.mak > ?include $(SRC_PATH)/tests/fate/pcm.mak > +include $(SRC_PATH)/tests/fate/probe.mak > ?include $(SRC_PATH)/tests/fate/prores.mak > ?include $(SRC_PATH)/tests/fate/qt.mak > ?include $(SRC_PATH)/tests/fate/qtrle.mak > diff --git a/tests/fate-run.sh b/tests/fate-run.sh > index f7a7aba..10f0dd2 100755 > --- a/tests/fate-run.sh > +++ b/tests/fate-run.sh > @@ -65,6 +65,10 @@ run(){ > ? ? $target_exec $target_path/"$@" > ?} > > +probe(){ > + ? ?run avprobe -show_format_entry format_name -v 0 "$@" > +} > + > ?avconv(){ > ? ? run avconv -nostats -threads $threads -thread_type $thread_type -cpuflags $cpuflags "$@" > ?} > diff --git a/tests/fate/probe.mak b/tests/fate/probe.mak > new file mode 100644 > index 0000000..e3cc9ff > --- /dev/null > +++ b/tests/fate/probe.mak > @@ -0,0 +1,11 @@ > +fate-probe-roundup1383: CMD = probe $(SAMPLES)/probe/roundup1383 > +fate-probe-roundup2015: CMD = probe $(SAMPLES)/probe/roundup2015 > +fate-probe-roundup997: ?CMD = probe $(SAMPLES)/probe/roundup997 > +fate-probe-roundup1414: CMD = probe $(SAMPLES)/probe/roundup1414 > + > +FATE_PROBE = fate-probe-roundup1383 \ > + ? ? ? ? ? ? fate-probe-roundup2015 \ > + ? ? ? ? ? ? fate-probe-roundup997 ?\ > + ? ? ? ? ? ? fate-probe-roundup1414 > +FATE_TESTS += $(FATE_PROBE) > +fate-probe: $(FATE_PROBE) > diff --git a/tests/ref/fate/probe-roundup1383 b/tests/ref/fate/probe-roundup1383 > new file mode 100644 > index 0000000..663e668 > --- /dev/null > +++ b/tests/ref/fate/probe-roundup1383 > @@ -0,0 +1 @@ > +mp3 These individual files seem a bit heavyweight. Is there a clean way to keep the format names in probe.mak From rsbultje at gmail.com Thu May 3 20:15:50 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Thu, 3 May 2012 11:15:50 -0700 Subject: [libav-devel] [PATCH 3/3] Add probe fate tests to test for regressions in detecting media types. In-Reply-To: References: <1336068060-71190-1-git-send-email-rsbultje@gmail.com> <1336068060-71190-3-git-send-email-rsbultje@gmail.com> Message-ID: Hi, On Thu, May 3, 2012 at 11:14 AM, Alex Converse wrote: > On Thu, May 3, 2012 at 11:01 AM, Ronald S. Bultje wrote: >> From: "Ronald S. Bultje" >> > > Thank you so much > >> --- >> ?tests/Makefile ? ? ? ? ? ? ? ? ? | ? ?1 + >> ?tests/fate-run.sh ? ? ? ? ? ? ? ?| ? ?4 ++++ >> ?tests/fate/probe.mak ? ? ? ? ? ? | ? 11 +++++++++++ >> ?tests/ref/fate/probe-roundup1383 | ? ?1 + >> ?tests/ref/fate/probe-roundup1414 | ? ?1 + >> ?tests/ref/fate/probe-roundup2015 | ? ?1 + >> ?tests/ref/fate/probe-roundup997 ?| ? ?1 + >> ?7 files changed, 20 insertions(+) >> ?create mode 100644 tests/fate/probe.mak >> ?create mode 100644 tests/ref/fate/probe-roundup1383 >> ?create mode 100644 tests/ref/fate/probe-roundup1414 >> ?create mode 100644 tests/ref/fate/probe-roundup2015 >> ?create mode 100644 tests/ref/fate/probe-roundup997 >> >> diff --git a/tests/Makefile b/tests/Makefile >> index 19fbe11..a8db07f 100644 >> --- a/tests/Makefile >> +++ b/tests/Makefile >> @@ -48,6 +48,7 @@ include $(SRC_PATH)/tests/fate/microsoft.mak >> ?include $(SRC_PATH)/tests/fate/mp3.mak >> ?include $(SRC_PATH)/tests/fate/mpc.mak >> ?include $(SRC_PATH)/tests/fate/pcm.mak >> +include $(SRC_PATH)/tests/fate/probe.mak >> ?include $(SRC_PATH)/tests/fate/prores.mak >> ?include $(SRC_PATH)/tests/fate/qt.mak >> ?include $(SRC_PATH)/tests/fate/qtrle.mak >> diff --git a/tests/fate-run.sh b/tests/fate-run.sh >> index f7a7aba..10f0dd2 100755 >> --- a/tests/fate-run.sh >> +++ b/tests/fate-run.sh >> @@ -65,6 +65,10 @@ run(){ >> ? ? $target_exec $target_path/"$@" >> ?} >> >> +probe(){ >> + ? ?run avprobe -show_format_entry format_name -v 0 "$@" >> +} >> + >> ?avconv(){ >> ? ? run avconv -nostats -threads $threads -thread_type $thread_type -cpuflags $cpuflags "$@" >> ?} >> diff --git a/tests/fate/probe.mak b/tests/fate/probe.mak >> new file mode 100644 >> index 0000000..e3cc9ff >> --- /dev/null >> +++ b/tests/fate/probe.mak >> @@ -0,0 +1,11 @@ >> +fate-probe-roundup1383: CMD = probe $(SAMPLES)/probe/roundup1383 >> +fate-probe-roundup2015: CMD = probe $(SAMPLES)/probe/roundup2015 >> +fate-probe-roundup997: ?CMD = probe $(SAMPLES)/probe/roundup997 >> +fate-probe-roundup1414: CMD = probe $(SAMPLES)/probe/roundup1414 >> + >> +FATE_PROBE = fate-probe-roundup1383 \ >> + ? ? ? ? ? ? fate-probe-roundup2015 \ >> + ? ? ? ? ? ? fate-probe-roundup997 ?\ >> + ? ? ? ? ? ? fate-probe-roundup1414 >> +FATE_TESTS += $(FATE_PROBE) >> +fate-probe: $(FATE_PROBE) > >> diff --git a/tests/ref/fate/probe-roundup1383 b/tests/ref/fate/probe-roundup1383 >> new file mode 100644 >> index 0000000..663e668 >> --- /dev/null >> +++ b/tests/ref/fate/probe-roundup1383 >> @@ -0,0 +1 @@ >> +mp3 > > These individual files seem a bit heavyweight. Is there a clean way to > keep the format names in probe.mak Not without affecting make -j12 fate-probe, afaik... Mans/Diego? Ronald From rsbultje at gmail.com Thu May 3 20:19:00 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Thu, 3 May 2012 11:19:00 -0700 Subject: [libav-devel] [PATCH] avprobe: allow showing only one container/stream property. In-Reply-To: <1336068060-71190-2-git-send-email-rsbultje@gmail.com> References: <1336068060-71190-2-git-send-email-rsbultje@gmail.com> Message-ID: <1336069140-73294-1-git-send-email-rsbultje@gmail.com> From: "Ronald S. Bultje" This is useful for writing unit tests. --- avprobe.c | 67 ++++++++++++++++++++++++++++++++++++++---------------- doc/avprobe.texi | 4 ++++ 2 files changed, 51 insertions(+), 20 deletions(-) diff --git a/avprobe.c b/avprobe.c index fe2b6e2..55dbc2a 100644 --- a/avprobe.c +++ b/avprobe.c @@ -33,6 +33,7 @@ const char program_name[] = "avprobe"; const int program_birth_year = 2007; static int do_show_format = 0; +static const char *show_format_entry = NULL; static int do_show_packets = 0; static int do_show_streams = 0; @@ -257,36 +258,53 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx) printf("[/STREAM]\n"); } +static void print_format_entry(const char *tag, + const char *val) +{ + if (!show_format_entry) { + if (tag) { + printf("%s=%s\n", tag, val); + } else { + printf("%s\n", val); + } + } else if (tag && !strcmp(tag, show_format_entry)) { + printf("%s\n", val); + } +} + static void show_format(AVFormatContext *fmt_ctx) { AVDictionaryEntry *tag = NULL; char val_str[128]; int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1; - printf("[FORMAT]\n"); - - printf("filename=%s\n", fmt_ctx->filename); - printf("nb_streams=%d\n", fmt_ctx->nb_streams); - printf("format_name=%s\n", fmt_ctx->iformat->name); - printf("format_long_name=%s\n", fmt_ctx->iformat->long_name); - printf("start_time=%s\n", - time_value_string(val_str, sizeof(val_str), - fmt_ctx->start_time, &AV_TIME_BASE_Q)); - printf("duration=%s\n", - time_value_string(val_str, sizeof(val_str), - fmt_ctx->duration, &AV_TIME_BASE_Q)); - printf("size=%s\n", size >= 0 ? value_string(val_str, sizeof(val_str), - size, unit_byte_str) + print_format_entry(NULL, "[FORMAT]"); + print_format_entry("filename", fmt_ctx->filename); + snprintf(val_str, sizeof(val_str) - 1, "%d", fmt_ctx->nb_streams); + print_format_entry("nb_streams", val_str); + print_format_entry("format_name", fmt_ctx->iformat->name); + print_format_entry("format_long_name", fmt_ctx->iformat->long_name); + print_format_entry("start_time", + time_value_string(val_str, sizeof(val_str), + fmt_ctx->start_time, &AV_TIME_BASE_Q)); + print_format_entry("duration", + time_value_string(val_str, sizeof(val_str), + fmt_ctx->duration, &AV_TIME_BASE_Q)); + print_format_entry("size", + size >= 0 ? value_string(val_str, sizeof(val_str), + size, unit_byte_str) : "unknown"); - printf("bit_rate=%s\n", - value_string(val_str, sizeof(val_str), - fmt_ctx->bit_rate, unit_bit_per_second_str)); + print_format_entry("bit_rate", + value_string(val_str, sizeof(val_str), + fmt_ctx->bit_rate, unit_bit_per_second_str)); while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, - AV_DICT_IGNORE_SUFFIX))) - printf("TAG:%s=%s\n", tag->key, tag->value); + AV_DICT_IGNORE_SUFFIX))) { + snprintf(val_str, sizeof(val_str) - 1, "TAG:%s", tag->key); + print_format_entry(val_str, tag->value); + } - printf("[/FORMAT]\n"); + print_format_entry(NULL, "[/FORMAT]"); } static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename) @@ -372,6 +390,13 @@ static int opt_format(const char *opt, const char *arg) return 0; } +static int opt_show_format_entry(const char *opt, const char *arg) +{ + do_show_format = 1; + show_format_entry = arg; + return 0; +} + static void opt_input_file(void *optctx, const char *arg) { if (input_filename) { @@ -416,6 +441,8 @@ static const OptionDef options[] = { { "pretty", 0, {(void*)&opt_pretty}, "prettify the format of displayed values, make it more human readable" }, { "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" }, + { "show_format_entry", HAS_ARG, {(void*)opt_show_format_entry}, + "show a particular entry from the format/container info" }, { "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" }, { "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" }, { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, diff --git a/doc/avprobe.texi b/doc/avprobe.texi index 6b2c800..e9eab1f 100644 --- a/doc/avprobe.texi +++ b/doc/avprobe.texi @@ -94,6 +94,10 @@ stream. All the container format information is printed within a section with name "FORMAT". + at item -show_format_entry @var{name} +Like "-show_format", but only prints one specific entry of the +container format information, rather than all. + @item -show_packets Show information about each packet contained in the input multimedia stream. -- 1.7.9.2 From kostya.shishkov at gmail.com Thu May 3 20:42:54 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Thu, 3 May 2012 20:42:54 +0200 Subject: [libav-devel] [PATCH] arm: intreadwrite: revert 16-bit load asm to old version for gcc < 4.6 In-Reply-To: <1336068864-21755-1-git-send-email-mans@mansr.com> References: <1336068864-21755-1-git-send-email-mans@mansr.com> Message-ID: <20120503184254.GA31460@kst-acer> On Thu, May 03, 2012 at 07:14:24PM +0100, Mans Rullgard wrote: > Commit adebad0 "arm: intreadwrite: fix inline asm constraints for gcc > 4.6 and later" caused some older gcc versions to miscompile code. > This reverts to the old version of the code for these compilers. > > Signed-off-by: Mans Rullgard > --- > libavutil/arm/intreadwrite.h | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/libavutil/arm/intreadwrite.h b/libavutil/arm/intreadwrite.h > index 86b93c9..ed53330 100644 > --- a/libavutil/arm/intreadwrite.h > +++ b/libavutil/arm/intreadwrite.h > @@ -30,7 +30,9 @@ static av_always_inline unsigned AV_RN16(const void *p) > { > const uint8_t *q = p; > unsigned v; > -#ifdef __thumb__ > +#if !AV_GCC_VERSION_AT_LEAST(4,6) > + __asm__ ("ldrh %0, %1" : "=r"(v) : "m"(*(const uint16_t *)q)); > +#elif defined __thumb__ > __asm__ ("ldrh %0, %1" : "=r"(v) : "m"(q[0]), "m"(q[1])); > #else > __asm__ ("ldrh %0, %1" : "=r"(v) : "Uq"(q[0]), "m"(q[1])); > -- looks OK From lu_zero at gentoo.org Thu May 3 21:11:20 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Thu, 03 May 2012 12:11:20 -0700 Subject: [libav-devel] [PATCH 1/4] vsrc_buffer: return EAGAIN if no frame is available. In-Reply-To: <1336068308-16353-1-git-send-email-anton@khirnov.net> References: <1336068308-16353-1-git-send-email-anton@khirnov.net> Message-ID: <4FA2D858.8060705@gentoo.org> On 03/05/12 11:05, Anton Khirnov wrote: > From: Nicolas George > > This is not an erroneous condition, do not print a warning. > --- Looks ok. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From mans at mansr.com Thu May 3 21:21:25 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Thu, 03 May 2012 20:21:25 +0100 Subject: [libav-devel] [PATCH 3/3] Add probe fate tests to test for regressions in detecting media types. In-Reply-To: <1336068060-71190-3-git-send-email-rsbultje@gmail.com> (Ronald S. Bultje's message of "Thu, 3 May 2012 11:01:00 -0700") References: <1336068060-71190-1-git-send-email-rsbultje@gmail.com> <1336068060-71190-3-git-send-email-rsbultje@gmail.com> Message-ID: "Ronald S. Bultje" writes: > From: "Ronald S. Bultje" > > --- > tests/Makefile | 1 + > tests/fate-run.sh | 4 ++++ > tests/fate/probe.mak | 11 +++++++++++ > tests/ref/fate/probe-roundup1383 | 1 + > tests/ref/fate/probe-roundup1414 | 1 + > tests/ref/fate/probe-roundup2015 | 1 + > tests/ref/fate/probe-roundup997 | 1 + > 7 files changed, 20 insertions(+) > create mode 100644 tests/fate/probe.mak > create mode 100644 tests/ref/fate/probe-roundup1383 > create mode 100644 tests/ref/fate/probe-roundup1414 > create mode 100644 tests/ref/fate/probe-roundup2015 > create mode 100644 tests/ref/fate/probe-roundup997 > > diff --git a/tests/Makefile b/tests/Makefile > index 19fbe11..a8db07f 100644 > --- a/tests/Makefile > +++ b/tests/Makefile > @@ -48,6 +48,7 @@ include $(SRC_PATH)/tests/fate/microsoft.mak > include $(SRC_PATH)/tests/fate/mp3.mak > include $(SRC_PATH)/tests/fate/mpc.mak > include $(SRC_PATH)/tests/fate/pcm.mak > +include $(SRC_PATH)/tests/fate/probe.mak > include $(SRC_PATH)/tests/fate/prores.mak > include $(SRC_PATH)/tests/fate/qt.mak > include $(SRC_PATH)/tests/fate/qtrle.mak > diff --git a/tests/fate-run.sh b/tests/fate-run.sh > index f7a7aba..10f0dd2 100755 > --- a/tests/fate-run.sh > +++ b/tests/fate-run.sh > @@ -65,6 +65,10 @@ run(){ > $target_exec $target_path/"$@" > } > > +probe(){ > + run avprobe -show_format_entry format_name -v 0 "$@" > +} Maybe give this a less generic name, just in case we ever want to probe other things. I suggest "probe_format". > avconv(){ > run avconv -nostats -threads $threads -thread_type $thread_type -cpuflags $cpuflags "$@" > } > diff --git a/tests/fate/probe.mak b/tests/fate/probe.mak > new file mode 100644 > index 0000000..e3cc9ff > --- /dev/null > +++ b/tests/fate/probe.mak > @@ -0,0 +1,11 @@ > +fate-probe-roundup1383: CMD = probe $(SAMPLES)/probe/roundup1383 > +fate-probe-roundup2015: CMD = probe $(SAMPLES)/probe/roundup2015 > +fate-probe-roundup997: CMD = probe $(SAMPLES)/probe/roundup997 > +fate-probe-roundup1414: CMD = probe $(SAMPLES)/probe/roundup1414 Diego will insist that you sort these. > +FATE_PROBE = fate-probe-roundup1383 \ > + fate-probe-roundup2015 \ > + fate-probe-roundup997 \ > + fate-probe-roundup1414 This could probably be made less repetitive using make patterns. > +FATE_TESTS += $(FATE_PROBE) > +fate-probe: $(FATE_PROBE) > diff --git a/tests/ref/fate/probe-roundup1383 b/tests/ref/fate/probe-roundup1383 > new file mode 100644 > index 0000000..663e668 > --- /dev/null > +++ b/tests/ref/fate/probe-roundup1383 > @@ -0,0 +1 @@ > +mp3 To avoid lots of tiny little files like this, the idea occurred to me to add new CMP method for one-line references. Not sure how much it matters. -- M?ns Rullg?rd mans at mansr.com From vitor1001 at gmail.com Thu May 3 21:29:44 2012 From: vitor1001 at gmail.com (Vitor Sessak) Date: Thu, 03 May 2012 21:29:44 +0200 Subject: [libav-devel] [PATCH 6/6] lavr: Add x86-optimized function for flt to s32 conversion In-Reply-To: <4FA1A4C2.1050305@gmail.com> References: <1335905384-19715-1-git-send-email-justin.ruggles@gmail.com> <1335905384-19715-6-git-send-email-justin.ruggles@gmail.com> <4FA1811B.5020106@gmail.com> <4FA182A1.7000404@gmail.com> <4FA1A0C2.9080104@gmail.com> <4FA1A4C2.1050305@gmail.com> Message-ID: <4FA2DCA8.4000703@gmail.com> On 05/02/2012 11:18 PM, Justin Ruggles wrote: > On 05/02/2012 05:01 PM, Vitor Sessak wrote: > >> On 05/02/2012 08:53 PM, Justin Ruggles wrote: >>> On 05/02/2012 02:46 PM, Vitor Sessak wrote: >>> >>>> On 05/01/2012 10:49 PM, Justin Ruggles wrote: >>>>> --- >>>>> Athlon64 >>>>> C - 8176 >>>>> SSE2 - 1784 >>>>> >>>>> SandyBridge >>>>> C - 5578 >>>>> SSE2 - 418 >>>> >>>> Is there any reason why not to do an AVX (YMM) version? >>> >>> >>> It was actually slower when I tested it on sandy bridge. If some other >>> system runs it faster it's easy to add. >> >> Strange. And what about 128-bit 3-op? > > > slower also. Then patch ok to me. -Vitor From justin.ruggles at gmail.com Thu May 3 21:39:21 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Thu, 3 May 2012 15:39:21 -0400 Subject: [libav-devel] [PATCH] lavr: replace the SSE version of ff_conv_fltp_to_flt_6ch() with AVX Message-ID: <1336073961-20905-1-git-send-email-justin.ruggles@gmail.com> The SSE version is slower than the MMX version on Athlon64 and Sandy Bridge, but the 3-arg AVX version is faster on Sandy Bridge. --- Athlon64 C - 26322 MMX - 7997 SSE - 8662 Sandy Bridge C - 13011 MMX - 4262 SSE - 4680 AVX - 3960 Note that although the new code is simpler, using it as SSE is not any faster than the existing SSE version. The AVX version is only faster because of the 3-arg ops in SBUTTERFLYPS2. libavresample/x86/audio_convert.asm | 40 ++++++++++++++++---------------- libavresample/x86/audio_convert_init.c | 6 ++-- libavutil/x86/x86util.asm | 6 ++++ 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/libavresample/x86/audio_convert.asm b/libavresample/x86/audio_convert.asm index 809c5d1..c9ba2b0 100644 --- a/libavresample/x86/audio_convert.asm +++ b/libavresample/x86/audio_convert.asm @@ -55,25 +55,23 @@ cglobal conv_fltp_to_flt_6ch, 2,8,7, dst, src, src1, src2, src3, src4, src5, len mova m4, [srcq+src4q] mova m5, [srcq+src5q] %if cpuflag(sse) - SBUTTERFLYPS 0, 1, 6 - SBUTTERFLYPS 2, 3, 6 - SBUTTERFLYPS 4, 5, 6 - - movaps m6, m4 - shufps m4, m0, q3210 - movlhps m0, m2 - movhlps m6, m2 - movaps [dstq ], m0 - movaps [dstq+16], m4 - movaps [dstq+32], m6 - - movaps m6, m5 - shufps m5, m1, q3210 - movlhps m1, m3 - movhlps m6, m3 - movaps [dstq+48], m1 - movaps [dstq+64], m5 - movaps [dstq+80], m6 + SBUTTERFLYPS2 0, 1, 6 + SBUTTERFLYPS2 2, 3, 6 + SBUTTERFLYPS2 4, 5, 6 + movhlps m6, m0 + unpcklpd m0, m2 + unpckhpd m2, m4 + unpcklpd m4, m6 + movhlps m6, m1 + unpcklpd m1, m3 + unpckhpd m3, m5 + unpcklpd m5, m6 + movaps [dstq ], m0 + movaps [dstq+1*mmsize], m4 + movaps [dstq+2*mmsize], m2 + movaps [dstq+3*mmsize], m1 + movaps [dstq+4*mmsize], m5 + movaps [dstq+5*mmsize], m3 %else ; mmx SBUTTERFLY dq, 0, 1, 6 SBUTTERFLY dq, 2, 3, 6 @@ -100,5 +98,7 @@ cglobal conv_fltp_to_flt_6ch, 2,8,7, dst, src, src1, src2, src3, src4, src5, len INIT_MMX mmx CONV_FLTP_TO_FLT_6CH -INIT_XMM sse +%if HAVE_AVX +INIT_XMM avx CONV_FLTP_TO_FLT_6CH +%endif diff --git a/libavresample/x86/audio_convert_init.c b/libavresample/x86/audio_convert_init.c index 6883f10..b9d9d1f 100644 --- a/libavresample/x86/audio_convert_init.c +++ b/libavresample/x86/audio_convert_init.c @@ -23,7 +23,7 @@ #include "libavresample/audio_convert.h" extern void ff_conv_fltp_to_flt_6ch_mmx(float *dst, float *const *src, int len); -extern void ff_conv_fltp_to_flt_6ch_sse(float *dst, float *const *src, int len); +extern void ff_conv_fltp_to_flt_6ch_avx(float *dst, float *const *src, int len); av_cold void ff_audio_convert_init_x86(AudioConvert *ac) { @@ -34,9 +34,9 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac) ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, 6, 1, 4, "MMX", ff_conv_fltp_to_flt_6ch_mmx); } - if (mm_flags & AV_CPU_FLAG_SSE && HAVE_SSE) { + if (mm_flags & AV_CPU_FLAG_AVX && HAVE_AVX) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, - 6, 16, 4, "SSE", ff_conv_fltp_to_flt_6ch_sse); + 6, 16, 4, "AVX", ff_conv_fltp_to_flt_6ch_avx); } #endif } diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm index 55f4a93..a3baf6a 100644 --- a/libavutil/x86/x86util.asm +++ b/libavutil/x86/x86util.asm @@ -48,6 +48,12 @@ SWAP %2, %3 %endmacro +%macro SBUTTERFLYPS2 3 + unpcklps m%3, m%1, m%2 + unpckhps m%1, m%1, m%2 + SWAP %1, %3, %2 +%endmacro + %macro TRANSPOSE4x4B 5 SBUTTERFLY bw, %1, %2, %5 SBUTTERFLY bw, %3, %4, %5 -- 1.7.1 From mans at mansr.com Thu May 3 21:42:54 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Thu, 03 May 2012 20:42:54 +0100 Subject: [libav-devel] [PATCH 3/3] Add probe fate tests to test for regressions in detecting media types. In-Reply-To: (Ronald S. Bultje's message of "Thu, 3 May 2012 11:15:50 -0700") References: <1336068060-71190-1-git-send-email-rsbultje@gmail.com> <1336068060-71190-3-git-send-email-rsbultje@gmail.com> Message-ID: "Ronald S. Bultje" writes: > Hi, > > On Thu, May 3, 2012 at 11:14 AM, Alex Converse wrote: >> On Thu, May 3, 2012 at 11:01 AM, Ronald S. Bultje wrote: >>> diff --git a/tests/ref/fate/probe-roundup1383 b/tests/ref/fate/probe-roundup1383 >>> new file mode 100644 >>> index 0000000..663e668 >>> --- /dev/null >>> +++ b/tests/ref/fate/probe-roundup1383 >>> @@ -0,0 +1 @@ >>> +mp3 >> >> These individual files seem a bit heavyweight. Is there a clean way to >> keep the format names in probe.mak > > Not without affecting make -j12 fate-probe, afaik... Mans/Diego? Something like this should do it: diff --git a/tests/fate-run.sh b/tests/fate-run.sh index f7a7aba..8abc456 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -60,6 +60,12 @@ stddev(){ do_tiny_psnr "$1" "$2" stddev } +oneline(){ + val=$(cat "$2") + test x"$val" = x"$1" || { r=$?; printf '-%s\n+%s\n' "$ref" "$val"; } + return ${r:-0} +} + run(){ test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3 $target_exec $target_path/"$@" @@ -152,6 +158,7 @@ if test -e "$ref"; then diff) diff -u -w "$ref" "$outfile" >$cmpfile ;; oneoff) oneoff "$ref" "$outfile" >$cmpfile ;; stddev) stddev "$ref" "$outfile" >$cmpfile ;; + oneline)oneline "$ref" "$outfile" >$cmpfile ;; null) cat "$outfile" >$cmpfile ;; esac cmperr=$? To use it, set CMP=oneline and REF=whatever in the makefile. -- M?ns Rullg?rd mans at mansr.com From justin.ruggles at gmail.com Thu May 3 21:51:37 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Thu, 03 May 2012 15:51:37 -0400 Subject: [libav-devel] [PATCH] lavr: replace the SSE version of ff_conv_fltp_to_flt_6ch() with AVX In-Reply-To: <1336073961-20905-1-git-send-email-justin.ruggles@gmail.com> References: <1336073961-20905-1-git-send-email-justin.ruggles@gmail.com> Message-ID: <4FA2E1C9.4020009@gmail.com> On 05/03/2012 03:39 PM, Justin Ruggles wrote: > The SSE version is slower than the MMX version on Athlon64 and Sandy Bridge, > but the 3-arg AVX version is faster on Sandy Bridge. > --- > Athlon64 > C - 26322 > MMX - 7997 > SSE - 8662 > > Sandy Bridge > C - 13011 > MMX - 4262 > SSE - 4680 > AVX - 3960 It would be nice to get some confirmation of these numbers. Apparently the Sandy Bridge system I was testing on also had other processes running, so the benchmarks might not be accurate. -Justin From lu_zero at gentoo.org Thu May 3 22:56:27 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Thu, 03 May 2012 13:56:27 -0700 Subject: [libav-devel] [PATCH 3/3] Add probe fate tests to test for regressions in detecting media types. In-Reply-To: References: <1336068060-71190-1-git-send-email-rsbultje@gmail.com> <1336068060-71190-3-git-send-email-rsbultje@gmail.com> Message-ID: <4FA2F0FB.6070900@gentoo.org> On 03/05/12 12:42, M?ns Rullg?rd wrote: > "Ronald S. Bultje" writes: > >> Hi, >> >> On Thu, May 3, 2012 at 11:14 AM, Alex Converse wrote: >>> On Thu, May 3, 2012 at 11:01 AM, Ronald S. Bultje wrote: >>>> diff --git a/tests/ref/fate/probe-roundup1383 b/tests/ref/fate/probe-roundup1383 >>>> new file mode 100644 >>>> index 0000000..663e668 >>>> --- /dev/null >>>> +++ b/tests/ref/fate/probe-roundup1383 >>>> @@ -0,0 +1 @@ >>>> +mp3 >>> >>> These individual files seem a bit heavyweight. Is there a clean way to >>> keep the format names in probe.mak >> >> Not without affecting make -j12 fate-probe, afaik... Mans/Diego? > > Something like this should do it: > > diff --git a/tests/fate-run.sh b/tests/fate-run.sh > index f7a7aba..8abc456 100755 > --- a/tests/fate-run.sh > +++ b/tests/fate-run.sh > @@ -60,6 +60,12 @@ stddev(){ > do_tiny_psnr "$1" "$2" stddev > } > > +oneline(){ > + val=$(cat "$2") > + test x"$val" = x"$1" || { r=$?; printf '-%s\n+%s\n' "$ref" "$val"; } > + return ${r:-0} > +} > + > run(){ > test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3 > $target_exec $target_path/"$@" > @@ -152,6 +158,7 @@ if test -e "$ref"; then > diff) diff -u -w "$ref" "$outfile" >$cmpfile ;; > oneoff) oneoff "$ref" "$outfile" >$cmpfile ;; > stddev) stddev "$ref" "$outfile" >$cmpfile ;; > + oneline)oneline "$ref" "$outfile" >$cmpfile ;; > null) cat "$outfile" >$cmpfile ;; > esac > cmperr=$? > > To use it, set CMP=oneline and REF=whatever in the makefile. > Looks cute. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Thu May 3 22:58:10 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Thu, 03 May 2012 13:58:10 -0700 Subject: [libav-devel] [PATCH 3/4] lavfi: add a function for copying properties from AVFilterBufferRef->AVFrame In-Reply-To: <1336068308-16353-3-git-send-email-anton@khirnov.net> References: <1336068308-16353-1-git-send-email-anton@khirnov.net> <1336068308-16353-3-git-send-email-anton@khirnov.net> Message-ID: <4FA2F162.7030601@gentoo.org> On 03/05/12 11:05, Anton Khirnov wrote: > Can > anyone imagine a situation where the user might want to use this function but > keep the data pointers in target AVFrame preserved? I guess not. lu -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Thu May 3 22:59:16 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Thu, 03 May 2012 13:59:16 -0700 Subject: [libav-devel] [PATCH 4/4] lavfi: add vsink_buffer, and use it in avtools In-Reply-To: <1336068308-16353-4-git-send-email-anton@khirnov.net> References: <1336068308-16353-1-git-send-email-anton@khirnov.net> <1336068308-16353-4-git-send-email-anton@khirnov.net> Message-ID: <4FA2F1A4.6060006@gentoo.org> On 03/05/12 11:05, Anton Khirnov wrote: > Also add the public interface libavfilter/buffersink.h. > --- > avconv.c | 106 ++++++++++++++++++++++++++++++------------ > avplay.c | 31 +++++++++---- > cmdutils.c | 68 --------------------------- > cmdutils.h | 15 ------ > doc/APIchanges | 5 ++ > doc/filters.texi | 8 ++++ > libavfilter/Makefile | 3 +- > libavfilter/allfilters.c | 6 ++- > libavfilter/buffersink.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++ > libavfilter/buffersink.h | 43 +++++++++++++++++ > libavfilter/version.h | 2 +- > 11 files changed, 277 insertions(+), 124 deletions(-) > create mode 100644 libavfilter/buffersink.c > create mode 100644 libavfilter/buffersink.h > Ok. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From justin.ruggles at gmail.com Fri May 4 01:04:38 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Thu, 3 May 2012 19:04:38 -0400 Subject: [libav-devel] [PATCH] avplay: properly close/reopen AVAudioResampleContext on channel layout change Message-ID: <1336086278-14698-1-git-send-email-justin.ruggles@gmail.com> fixes Bug#280 --- avplay.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/avplay.c b/avplay.c index e18b2e4..9bd83f3 100644 --- a/avplay.c +++ b/avplay.c @@ -2060,15 +2060,17 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr) dec->channel_layout != is->resample_channel_layout; if ((!is->avr && audio_resample) || resample_changed) { + int ret; if (is->avr) avresample_close(is->avr); else if (audio_resample) { - int ret; is->avr = avresample_alloc_context(); if (!is->avr) { fprintf(stderr, "error allocating AVAudioResampleContext\n"); break; } + } + if (audio_resample) { av_opt_set_int(is->avr, "in_channel_layout", dec->channel_layout, 0); av_opt_set_int(is->avr, "in_sample_fmt", dec->sample_fmt, 0); av_opt_set_int(is->avr, "in_sample_rate", dec->sample_rate, 0); -- 1.7.1 From alex.converse at gmail.com Fri May 4 01:33:15 2012 From: alex.converse at gmail.com (Alex Converse) Date: Thu, 3 May 2012 16:33:15 -0700 Subject: [libav-devel] [PATCH 1/3] fate: Add oneline comparison method Message-ID: <1336087997-31192-1-git-send-email-alex.converse@gmail.com> From: Mans Rullgard Signed-off-by: Alex Converse --- tests/fate-run.sh | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/tests/fate-run.sh b/tests/fate-run.sh index f7a7aba..92d6dad 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -60,6 +60,12 @@ stddev(){ do_tiny_psnr "$1" "$2" stddev } +oneline(){ + val=$(cat "$2") + test x"$val" = x"$1" || { r=$?; printf -- '\-%s\n+%s\n' "$ref" "$val"; } + return ${r:-0} +} + run(){ test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3 $target_exec $target_path/"$@" @@ -147,11 +153,12 @@ if [ $err -gt 128 ]; then test "${sig}" = "${sig%[!A-Za-z]*}" || unset sig fi -if test -e "$ref"; then +if test -e "$ref" || test $cmp = "oneline" ; then case $cmp in diff) diff -u -w "$ref" "$outfile" >$cmpfile ;; oneoff) oneoff "$ref" "$outfile" >$cmpfile ;; stddev) stddev "$ref" "$outfile" >$cmpfile ;; + oneline)oneline "$ref" "$outfile" >$cmpfile ;; null) cat "$outfile" >$cmpfile ;; esac cmperr=$? -- 1.7.7.3 From alex.converse at gmail.com Fri May 4 01:33:16 2012 From: alex.converse at gmail.com (Alex Converse) Date: Thu, 3 May 2012 16:33:16 -0700 Subject: [libav-devel] [PATCH 2/3] avprobe: allow showing only one container/stream property. In-Reply-To: <1336087997-31192-1-git-send-email-alex.converse@gmail.com> References: <1336087997-31192-1-git-send-email-alex.converse@gmail.com> Message-ID: <1336087997-31192-2-git-send-email-alex.converse@gmail.com> From: "Ronald S. Bultje" This is useful for writing unit tests. Signed-off-by: Alex Converse --- avprobe.c | 67 +++++++++++++++++++++++++++++++++++++---------------- doc/avprobe.texi | 4 +++ 2 files changed, 51 insertions(+), 20 deletions(-) diff --git a/avprobe.c b/avprobe.c index fe2b6e2..55dbc2a 100644 --- a/avprobe.c +++ b/avprobe.c @@ -33,6 +33,7 @@ const char program_name[] = "avprobe"; const int program_birth_year = 2007; static int do_show_format = 0; +static const char *show_format_entry = NULL; static int do_show_packets = 0; static int do_show_streams = 0; @@ -257,36 +258,53 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx) printf("[/STREAM]\n"); } +static void print_format_entry(const char *tag, + const char *val) +{ + if (!show_format_entry) { + if (tag) { + printf("%s=%s\n", tag, val); + } else { + printf("%s\n", val); + } + } else if (tag && !strcmp(tag, show_format_entry)) { + printf("%s\n", val); + } +} + static void show_format(AVFormatContext *fmt_ctx) { AVDictionaryEntry *tag = NULL; char val_str[128]; int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1; - printf("[FORMAT]\n"); - - printf("filename=%s\n", fmt_ctx->filename); - printf("nb_streams=%d\n", fmt_ctx->nb_streams); - printf("format_name=%s\n", fmt_ctx->iformat->name); - printf("format_long_name=%s\n", fmt_ctx->iformat->long_name); - printf("start_time=%s\n", - time_value_string(val_str, sizeof(val_str), - fmt_ctx->start_time, &AV_TIME_BASE_Q)); - printf("duration=%s\n", - time_value_string(val_str, sizeof(val_str), - fmt_ctx->duration, &AV_TIME_BASE_Q)); - printf("size=%s\n", size >= 0 ? value_string(val_str, sizeof(val_str), - size, unit_byte_str) + print_format_entry(NULL, "[FORMAT]"); + print_format_entry("filename", fmt_ctx->filename); + snprintf(val_str, sizeof(val_str) - 1, "%d", fmt_ctx->nb_streams); + print_format_entry("nb_streams", val_str); + print_format_entry("format_name", fmt_ctx->iformat->name); + print_format_entry("format_long_name", fmt_ctx->iformat->long_name); + print_format_entry("start_time", + time_value_string(val_str, sizeof(val_str), + fmt_ctx->start_time, &AV_TIME_BASE_Q)); + print_format_entry("duration", + time_value_string(val_str, sizeof(val_str), + fmt_ctx->duration, &AV_TIME_BASE_Q)); + print_format_entry("size", + size >= 0 ? value_string(val_str, sizeof(val_str), + size, unit_byte_str) : "unknown"); - printf("bit_rate=%s\n", - value_string(val_str, sizeof(val_str), - fmt_ctx->bit_rate, unit_bit_per_second_str)); + print_format_entry("bit_rate", + value_string(val_str, sizeof(val_str), + fmt_ctx->bit_rate, unit_bit_per_second_str)); while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, - AV_DICT_IGNORE_SUFFIX))) - printf("TAG:%s=%s\n", tag->key, tag->value); + AV_DICT_IGNORE_SUFFIX))) { + snprintf(val_str, sizeof(val_str) - 1, "TAG:%s", tag->key); + print_format_entry(val_str, tag->value); + } - printf("[/FORMAT]\n"); + print_format_entry(NULL, "[/FORMAT]"); } static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename) @@ -372,6 +390,13 @@ static int opt_format(const char *opt, const char *arg) return 0; } +static int opt_show_format_entry(const char *opt, const char *arg) +{ + do_show_format = 1; + show_format_entry = arg; + return 0; +} + static void opt_input_file(void *optctx, const char *arg) { if (input_filename) { @@ -416,6 +441,8 @@ static const OptionDef options[] = { { "pretty", 0, {(void*)&opt_pretty}, "prettify the format of displayed values, make it more human readable" }, { "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" }, + { "show_format_entry", HAS_ARG, {(void*)opt_show_format_entry}, + "show a particular entry from the format/container info" }, { "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" }, { "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" }, { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, diff --git a/doc/avprobe.texi b/doc/avprobe.texi index 6b2c800..e9eab1f 100644 --- a/doc/avprobe.texi +++ b/doc/avprobe.texi @@ -94,6 +94,10 @@ stream. All the container format information is printed within a section with name "FORMAT". + at item -show_format_entry @var{name} +Like "-show_format", but only prints one specific entry of the +container format information, rather than all. + @item -show_packets Show information about each packet contained in the input multimedia stream. -- 1.7.7.3 From alex.converse at gmail.com Fri May 4 01:33:17 2012 From: alex.converse at gmail.com (Alex Converse) Date: Thu, 3 May 2012 16:33:17 -0700 Subject: [libav-devel] [PATCH 3/3] Add probe fate tests to test for regressions in detecting media types. In-Reply-To: <1336087997-31192-1-git-send-email-alex.converse@gmail.com> References: <1336087997-31192-1-git-send-email-alex.converse@gmail.com> Message-ID: <1336087997-31192-3-git-send-email-alex.converse@gmail.com> From: "Ronald S. Bultje" Signed-off-by: Alex Converse --- tests/Makefile | 1 + tests/fate-run.sh | 4 ++++ tests/fate/probe.mak | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+), 0 deletions(-) create mode 100644 tests/fate/probe.mak diff --git a/tests/Makefile b/tests/Makefile index 19fbe11..a8db07f 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -48,6 +48,7 @@ include $(SRC_PATH)/tests/fate/microsoft.mak include $(SRC_PATH)/tests/fate/mp3.mak include $(SRC_PATH)/tests/fate/mpc.mak include $(SRC_PATH)/tests/fate/pcm.mak +include $(SRC_PATH)/tests/fate/probe.mak include $(SRC_PATH)/tests/fate/prores.mak include $(SRC_PATH)/tests/fate/qt.mak include $(SRC_PATH)/tests/fate/qtrle.mak diff --git a/tests/fate-run.sh b/tests/fate-run.sh index 92d6dad..e1a91c7 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -71,6 +71,10 @@ run(){ $target_exec $target_path/"$@" } +probe(){ + run avprobe -show_format_entry format_name -v 0 "$@" +} + avconv(){ run avconv -nostats -threads $threads -thread_type $thread_type -cpuflags $cpuflags "$@" } diff --git a/tests/fate/probe.mak b/tests/fate/probe.mak new file mode 100644 index 0000000..5583d39 --- /dev/null +++ b/tests/fate/probe.mak @@ -0,0 +1,20 @@ +FATE_PROBE_FORMAT += fate-probe-format-roundup997 +fate-probe-format-roundup997: CMD = probe $(SAMPLES)/probe-format/roundup997 +fate-probe-format-roundup997: REF = mpeg + +FATE_PROBE_FORMAT += fate-probe-format-roundup1383 +fate-probe-format-roundup1383: CMD = probe $(SAMPLES)/probe-format/roundup1383 +fate-probe-format-roundup1383: REF = mp3 + +FATE_PROBE_FORMAT += fate-probe-format-roundup1414 +fate-probe-format-roundup1414: CMD = probe $(SAMPLES)/probe-format/roundup1414 +fate-probe-format-roundup1414: REF = mpeg + +FATE_PROBE_FORMAT += fate-probe-format-roundup2015 +fate-probe-format-roundup2015: CMD = probe $(SAMPLES)/probe-format/roundup2015 +fate-probe-format-roundup2015: REF = dv + +FATE_TESTS += $(FATE_PROBE_FORMAT) +fate-probe-format: $(FATE_PROBE_FORMAT) + +$(FATE_PROBE_FORMAT): CMP = oneline -- 1.7.7.3 From dalecurtis at chromium.org Fri May 4 01:33:26 2012 From: dalecurtis at chromium.org (Dale Curtis) Date: Thu, 3 May 2012 16:33:26 -0700 Subject: [libav-devel] ogg: Seek on video stream sometimes results decreased timestamps. Message-ID: All, We're running into an issue where audio timestamps in ogg containers are not monotonically increasing after a seek using an associated video stream: ... pts: 51264 pts: 52288 pts: 53312 pts: 45632 last pts bad!!! pts: 46656 pts: 47680 pts: 48704 pts: 49728 pts: 50752 ... Steps to reproduce are simply open file, seek to 0 using index -1 or the video stream index, then display timestamps. Here's a sample test program: http://commondatastorage.googleapis.com/dalecurtis-shared/ogg-ts-test.tar.bz2 The test program can be compiled with: gcc -o ogg-ts ogg-ts.c -lstdc++ libavformat/libavformat.a libavcodec/libavcodec.a libavutil/libavutil.a -lz -lbz2 -lpthread The behavior appears to have started with http://git.libav.org/?p=libav.git;a=commit;h=f63412fc741e9936b71141e7f15ab8aa39ad72f9(which greatly improves timestamps on OGG files in all other regards). Per discussion with Ronald, this seems to be incorrect behavior. Any idea on what's going wrong here? - dale -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex.converse at gmail.com Fri May 4 01:35:10 2012 From: alex.converse at gmail.com (Alex Converse) Date: Thu, 3 May 2012 16:35:10 -0700 Subject: [libav-devel] [PATCH] avplay: properly close/reopen AVAudioResampleContext on channel layout change In-Reply-To: <1336086278-14698-1-git-send-email-justin.ruggles@gmail.com> References: <1336086278-14698-1-git-send-email-justin.ruggles@gmail.com> Message-ID: On Thu, May 3, 2012 at 4:04 PM, Justin Ruggles wrote: > fixes Bug#280 > --- > ?avplay.c | ? ?4 +++- > ?1 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/avplay.c b/avplay.c > index e18b2e4..9bd83f3 100644 > --- a/avplay.c > +++ b/avplay.c > @@ -2060,15 +2060,17 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?dec->channel_layout != is->resample_channel_layout; > > ? ? ? ? ? ? if ((!is->avr && audio_resample) || resample_changed) { > + ? ? ? ? ? ? ? ?int ret; > ? ? ? ? ? ? ? ? if (is->avr) > ? ? ? ? ? ? ? ? ? ? avresample_close(is->avr); > ? ? ? ? ? ? ? ? else if (audio_resample) { > - ? ? ? ? ? ? ? ? ? ?int ret; > ? ? ? ? ? ? ? ? ? ? is->avr = avresample_alloc_context(); > ? ? ? ? ? ? ? ? ? ? if (!is->avr) { > ? ? ? ? ? ? ? ? ? ? ? ? fprintf(stderr, "error allocating AVAudioResampleContext\n"); > ? ? ? ? ? ? ? ? ? ? ? ? break; > ? ? ? ? ? ? ? ? ? ? } > + ? ? ? ? ? ? ? ?} > + ? ? ? ? ? ? ? ?if (audio_resample) { > ? ? ? ? ? ? ? ? ? ? av_opt_set_int(is->avr, "in_channel_layout", ?dec->channel_layout, ? ?0); > ? ? ? ? ? ? ? ? ? ? av_opt_set_int(is->avr, "in_sample_fmt", ? ? ?dec->sample_fmt, ? ? ? ?0); > ? ? ? ? ? ? ? ? ? ? av_opt_set_int(is->avr, "in_sample_rate", ? ? dec->sample_rate, ? ? ? 0); > -- Looks good to me From mans at mansr.com Fri May 4 01:39:35 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Fri, 04 May 2012 00:39:35 +0100 Subject: [libav-devel] [PATCH 1/3] fate: Add oneline comparison method In-Reply-To: <1336087997-31192-1-git-send-email-alex.converse@gmail.com> (Alex Converse's message of "Thu, 3 May 2012 16:33:15 -0700") References: <1336087997-31192-1-git-send-email-alex.converse@gmail.com> Message-ID: Alex Converse writes: > From: Mans Rullgard > > Signed-off-by: Alex Converse > --- > tests/fate-run.sh | 9 ++++++++- > 1 files changed, 8 insertions(+), 1 deletions(-) > > diff --git a/tests/fate-run.sh b/tests/fate-run.sh > index f7a7aba..92d6dad 100755 > --- a/tests/fate-run.sh > +++ b/tests/fate-run.sh > @@ -60,6 +60,12 @@ stddev(){ > do_tiny_psnr "$1" "$2" stddev > } > > +oneline(){ > + val=$(cat "$2") > + test x"$val" = x"$1" || { r=$?; printf -- '\-%s\n+%s\n' "$ref" "$val"; } The \ before - should not be needed. > + return ${r:-0} > +} Did you check that this works properly for both success and error? > run(){ > test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3 > $target_exec $target_path/"$@" > @@ -147,11 +153,12 @@ if [ $err -gt 128 ]; then > test "${sig}" = "${sig%[!A-Za-z]*}" || unset sig > fi > > -if test -e "$ref"; then > +if test -e "$ref" || test $cmp = "oneline" ; then Didn't think of that one... I'm not too happy with special cases like that, but I guess we can live with it for now. > case $cmp in > diff) diff -u -w "$ref" "$outfile" >$cmpfile ;; > oneoff) oneoff "$ref" "$outfile" >$cmpfile ;; > stddev) stddev "$ref" "$outfile" >$cmpfile ;; > + oneline)oneline "$ref" "$outfile" >$cmpfile ;; > null) cat "$outfile" >$cmpfile ;; > esac > cmperr=$? > -- > 1.7.7.3 > -- M?ns Rullg?rd mans at mansr.com From mans at mansr.com Fri May 4 01:46:57 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Fri, 04 May 2012 00:46:57 +0100 Subject: [libav-devel] [PATCH 3/3] Add probe fate tests to test for regressions in detecting media types. In-Reply-To: <1336087997-31192-3-git-send-email-alex.converse@gmail.com> (Alex Converse's message of "Thu, 3 May 2012 16:33:17 -0700") References: <1336087997-31192-1-git-send-email-alex.converse@gmail.com> <1336087997-31192-3-git-send-email-alex.converse@gmail.com> Message-ID: Alex Converse writes: > From: "Ronald S. Bultje" > > Signed-off-by: Alex Converse > --- > tests/Makefile | 1 + > tests/fate-run.sh | 4 ++++ > tests/fate/probe.mak | 20 ++++++++++++++++++++ > 3 files changed, 25 insertions(+), 0 deletions(-) > create mode 100644 tests/fate/probe.mak > > diff --git a/tests/Makefile b/tests/Makefile > index 19fbe11..a8db07f 100644 > --- a/tests/Makefile > +++ b/tests/Makefile > @@ -48,6 +48,7 @@ include $(SRC_PATH)/tests/fate/microsoft.mak > include $(SRC_PATH)/tests/fate/mp3.mak > include $(SRC_PATH)/tests/fate/mpc.mak > include $(SRC_PATH)/tests/fate/pcm.mak > +include $(SRC_PATH)/tests/fate/probe.mak > include $(SRC_PATH)/tests/fate/prores.mak > include $(SRC_PATH)/tests/fate/qt.mak > include $(SRC_PATH)/tests/fate/qtrle.mak > diff --git a/tests/fate-run.sh b/tests/fate-run.sh > index 92d6dad..e1a91c7 100755 > --- a/tests/fate-run.sh > +++ b/tests/fate-run.sh > @@ -71,6 +71,10 @@ run(){ > $target_exec $target_path/"$@" > } > > +probe(){ > + run avprobe -show_format_entry format_name -v 0 "$@" > +} I still think this should have a less generic name to avoid future conflicts with tests probing other things. > avconv(){ > run avconv -nostats -threads $threads -thread_type $thread_type -cpuflags $cpuflags "$@" > } > diff --git a/tests/fate/probe.mak b/tests/fate/probe.mak > new file mode 100644 > index 0000000..5583d39 > --- /dev/null > +++ b/tests/fate/probe.mak > @@ -0,0 +1,20 @@ > +FATE_PROBE_FORMAT += fate-probe-format-roundup997 > +fate-probe-format-roundup997: CMD = probe $(SAMPLES)/probe-format/roundup997 > +fate-probe-format-roundup997: REF = mpeg > + > +FATE_PROBE_FORMAT += fate-probe-format-roundup1383 > +fate-probe-format-roundup1383: CMD = probe $(SAMPLES)/probe-format/roundup1383 > +fate-probe-format-roundup1383: REF = mp3 > + > +FATE_PROBE_FORMAT += fate-probe-format-roundup1414 > +fate-probe-format-roundup1414: CMD = probe $(SAMPLES)/probe-format/roundup1414 > +fate-probe-format-roundup1414: REF = mpeg > + > +FATE_PROBE_FORMAT += fate-probe-format-roundup2015 > +fate-probe-format-roundup2015: CMD = probe $(SAMPLES)/probe-format/roundup2015 > +fate-probe-format-roundup2015: REF = dv This can be simplified a bit with make patterns: fate-probe-format-%: CMD = probe $(SAMPLES)/probe-format/$* -- M?ns Rullg?rd mans at mansr.com From lu_zero at gentoo.org Fri May 4 02:03:15 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Thu, 03 May 2012 17:03:15 -0700 Subject: [libav-devel] ogg: Seek on video stream sometimes results decreased timestamps. In-Reply-To: References: Message-ID: <4FA31CC3.7080200@gentoo.org> On 03/05/12 16:33, Dale Curtis wrote: > gcc -o ogg-ts ogg-ts.c -lstdc++ libavformat/libavformat.a > libavcodec/libavcodec.a libavutil/libavutil.a -lz -lbz2 -lpthread For those that have libavformat also system installed gcc -std=c99 -o ogg-ts ogg-ts.c `pkg-config --libs libavformat` is shorter. ./ogg-ts test.ogv pts: 0 pts: 576 pts: 1152 pts: 2176 pts: 3200 pts: 4224 pts: 5248 pts: 6272 pts: 7296 pts: 8320 pts: 9344 pts: 10368 pts: 11392 pts: 12416 pts: 13440 pts: 14464 pts: 15488 pts: 16512 pts: 17536 pts: 18560 pts: 19584 pts: 20608 pts: 21632 pts: 22080 pts: 23104 pts: 24128 pts: 25152 pts: 26176 pts: 27200 pts: 28224 pts: 29248 pts: 30272 pts: 31296 pts: 32320 pts: 33344 pts: 34368 pts: 35392 pts: 36416 pts: 37440 pts: 38464 pts: 39488 pts: 40512 On the current libav though. lu -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From dalecurtis at chromium.org Fri May 4 02:10:08 2012 From: dalecurtis at chromium.org (Dale Curtis) Date: Thu, 3 May 2012 17:10:08 -0700 Subject: [libav-devel] ogg: Seek on video stream sometimes results decreased timestamps. In-Reply-To: <4FA31CC3.7080200@gentoo.org> References: <4FA31CC3.7080200@gentoo.org> Message-ID: On Thu, May 3, 2012 at 5:03 PM, Luca Barbato wrote: > On 03/05/12 16:33, Dale Curtis wrote: > > gcc -o ogg-ts ogg-ts.c -lstdc++ libavformat/libavformat.a > > libavcodec/libavcodec.a libavutil/libavutil.a -lz -lbz2 -lpthread > I use the other way so I can rapidly git bisect / clean build without an install step :) > > For those that have libavformat also system installed > > gcc -std=c99 -o ogg-ts ogg-ts.c `pkg-config --libs libavformat` > > is shorter. > > ./ogg-ts test.ogv > pts: 0 > pts: 576 > pts: 1152 > pts: 2176 > pts: 3200 > pts: 4224 > pts: 5248 > pts: 6272 > pts: 7296 > pts: 8320 > pts: 9344 > pts: 10368 > pts: 11392 > pts: 12416 > pts: 13440 > pts: 14464 > pts: 15488 > pts: 16512 > pts: 17536 > pts: 18560 > pts: 19584 > pts: 20608 > pts: 21632 > pts: 22080 > pts: 23104 > pts: 24128 > pts: 25152 > pts: 26176 > pts: 27200 > pts: 28224 > pts: 29248 > pts: 30272 > pts: 31296 > pts: 32320 > pts: 33344 > pts: 34368 > pts: 35392 > pts: 36416 > pts: 37440 > pts: 38464 > pts: 39488 > pts: 40512 > > On the current libav though. > > lu > > That's not what I'm getting on a clean ToT at all. I just sync'd, cleaned and built: $ git clean -fdx && ./configure --enable-gpl && make -j 64 $ clang -o ogg-ts ../ogg-ts.c -lstdc++ libav/libavformat/libavformat.a libav/libavcodec/libavcodec.a libav/libavutil/libavutil.a -lz -lbz2 -lpthread $ ./ogg-ts test.ogv pts: 30784 pts: 31808 pts: 32832 pts: 33856 pts: 34880 pts: 35904 pts: 36928 pts: 37952 pts: 38976 pts: 40000 pts: 41024 pts: 42048 pts: 43072 pts: 44096 pts: 45120 pts: 46144 pts: 47168 pts: 48192 pts: 49216 pts: 50240 pts: 51264 pts: 52288 pts: 53312 pts: 45632 last pts bad!!! pts: 46656 pts: 47680 pts: 48704 pts: 49728 pts: 50752 -------------- next part -------------- An HTML attachment was scrubbed... URL: From lu_zero at gentoo.org Fri May 4 02:23:05 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Thu, 03 May 2012 17:23:05 -0700 Subject: [libav-devel] ogg: Seek on video stream sometimes results decreased timestamps. In-Reply-To: References: <4FA31CC3.7080200@gentoo.org> Message-ID: <4FA32169.9090105@gentoo.org> On 03/05/12 17:10, Dale Curtis wrote: > On Thu, May 3, 2012 at 5:03 PM, Luca Barbato wrote: > >> On 03/05/12 16:33, Dale Curtis wrote: >>> gcc -o ogg-ts ogg-ts.c -lstdc++ libavformat/libavformat.a >>> libavcodec/libavcodec.a libavutil/libavutil.a -lz -lbz2 -lpthread >> > > I use the other way so I can rapidly git bisect / clean build without an > install step :) > > >> >> For those that have libavformat also system installed >> >> gcc -std=c99 -o ogg-ts ogg-ts.c `pkg-config --libs libavformat` >> >> is shorter. >> >> ./ogg-ts test.ogv >> pts: 0 >> pts: 576 >> pts: 1152 >> pts: 2176 >> pts: 3200 >> pts: 4224 >> pts: 5248 >> pts: 6272 >> pts: 7296 >> pts: 8320 >> pts: 9344 >> pts: 10368 >> pts: 11392 >> pts: 12416 >> pts: 13440 >> pts: 14464 >> pts: 15488 >> pts: 16512 >> pts: 17536 >> pts: 18560 >> pts: 19584 >> pts: 20608 >> pts: 21632 >> pts: 22080 >> pts: 23104 >> pts: 24128 >> pts: 25152 >> pts: 26176 >> pts: 27200 >> pts: 28224 >> pts: 29248 >> pts: 30272 >> pts: 31296 >> pts: 32320 >> pts: 33344 >> pts: 34368 >> pts: 35392 >> pts: 36416 >> pts: 37440 >> pts: 38464 >> pts: 39488 >> pts: 40512 >> >> On the current libav though. >> >> lu >> >> > That's not what I'm getting on a clean ToT at all. I just sync'd, cleaned > and built: > ToT? I'm at v0.8-1578-gc02efac. I'm really wondering why we are getting such results, I'm using gcc-4.6.2, which compiler are you using? lu -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From justin.ruggles at gmail.com Fri May 4 02:24:49 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Thu, 03 May 2012 20:24:49 -0400 Subject: [libav-devel] ogg: Seek on video stream sometimes results decreased timestamps. In-Reply-To: References: <4FA31CC3.7080200@gentoo.org> Message-ID: <4FA321D1.4060006@gmail.com> On 05/03/2012 08:10 PM, Dale Curtis wrote: > On Thu, May 3, 2012 at 5:03 PM, Luca Barbato > wrote: > > On 03/05/12 16:33, Dale Curtis wrote: > > gcc -o ogg-ts ogg-ts.c -lstdc++ libavformat/libavformat.a > > libavcodec/libavcodec.a libavutil/libavutil.a -lz -lbz2 -lpthread > > > I use the other way so I can rapidly git bisect / clean build without an > install step :) > > > > For those that have libavformat also system installed > > gcc -std=c99 -o ogg-ts ogg-ts.c `pkg-config --libs libavformat` > > is shorter. > > ./ogg-ts test.ogv > pts: 0 > pts: 576 > pts: 1152 > pts: 2176 > pts: 3200 > pts: 4224 > pts: 5248 > pts: 6272 > pts: 7296 > pts: 8320 > pts: 9344 > pts: 10368 > pts: 11392 > pts: 12416 > pts: 13440 > pts: 14464 > pts: 15488 > pts: 16512 > pts: 17536 > pts: 18560 > pts: 19584 > pts: 20608 > pts: 21632 > pts: 22080 > pts: 23104 > pts: 24128 > pts: 25152 > pts: 26176 > pts: 27200 > pts: 28224 > pts: 29248 > pts: 30272 > pts: 31296 > pts: 32320 > pts: 33344 > pts: 34368 > pts: 35392 > pts: 36416 > pts: 37440 > pts: 38464 > pts: 39488 > pts: 40512 > > On the current libav though. > > lu > > > That's not what I'm getting on a clean ToT at all. I just sync'd, > cleaned and built: I'm getting the same output as Luca. -Justin From dalecurtis at chromium.org Fri May 4 02:48:03 2012 From: dalecurtis at chromium.org (Dale Curtis) Date: Thu, 3 May 2012 17:48:03 -0700 Subject: [libav-devel] ogg: Seek on video stream sometimes results decreased timestamps. In-Reply-To: <4FA32169.9090105@gentoo.org> References: <4FA31CC3.7080200@gentoo.org> <4FA32169.9090105@gentoo.org> Message-ID: On Thu, May 3, 2012 at 5:23 PM, Luca Barbato wrote: > > ToT? I'm at v0.8-1578-gc02efac. I'm really wondering why we are getting > such results, I'm using gcc-4.6.2, which compiler are you using? > > Sorry, I forgot ToT is probably a Chrome term, Tip-of-Tree. Which avplay tells me is v0.8-1578-gc02efac. I get the same results with gcc 4.4.3 and clang 3.2. Ah, I was able to reproduce your results now. I pasted the the wrong configure option above. With: ./configure --enable-gpl I'm able to reproduce your results. However if I use /configure --disable-everything --enable-decoder=theora,vorbis --enable-demuxer=ogg --enable-protocol=file I end up with the results I've shown. On Ronald's advice I tried --enable-parser=vorbis without success either. Is there one I'm missing? - dale -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex.converse at gmail.com Fri May 4 02:55:39 2012 From: alex.converse at gmail.com (Alex Converse) Date: Thu, 3 May 2012 17:55:39 -0700 Subject: [libav-devel] [PATCH 1/3] fate: Add oneline comparison method In-Reply-To: References: Message-ID: <1336092939-6565-1-git-send-email-alex.converse@gmail.com> From: Mans Rullgard Signed-off-by: Alex Converse --- tests/fate-run.sh | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/tests/fate-run.sh b/tests/fate-run.sh index f7a7aba..8097eec 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -60,6 +60,12 @@ stddev(){ do_tiny_psnr "$1" "$2" stddev } +oneline(){ + val=$(cat "$2") + test x"$val" = x"$1" || { r=$?; printf -- '-%s\n+%s\n' "$ref" "$val"; } + return ${r:-0} +} + run(){ test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3 $target_exec $target_path/"$@" @@ -147,11 +153,12 @@ if [ $err -gt 128 ]; then test "${sig}" = "${sig%[!A-Za-z]*}" || unset sig fi -if test -e "$ref"; then +if test -e "$ref" || test $cmp = "oneline" ; then case $cmp in diff) diff -u -w "$ref" "$outfile" >$cmpfile ;; oneoff) oneoff "$ref" "$outfile" >$cmpfile ;; stddev) stddev "$ref" "$outfile" >$cmpfile ;; + oneline)oneline "$ref" "$outfile" >$cmpfile ;; null) cat "$outfile" >$cmpfile ;; esac cmperr=$? -- 1.7.7.3 Tested with success and failure From alex.converse at gmail.com Fri May 4 02:56:54 2012 From: alex.converse at gmail.com (Alex Converse) Date: Thu, 3 May 2012 17:56:54 -0700 Subject: [libav-devel] [PATCH 3/3] Add probe fate tests to test for regressions in detecting media types. In-Reply-To: References: Message-ID: <1336093014-6669-1-git-send-email-alex.converse@gmail.com> From: "Ronald S. Bultje" Signed-off-by: Alex Converse --- tests/Makefile | 1 + tests/fate-run.sh | 4 ++++ tests/fate/probe.mak | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 0 deletions(-) create mode 100644 tests/fate/probe.mak diff --git a/tests/Makefile b/tests/Makefile index 19fbe11..a8db07f 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -48,6 +48,7 @@ include $(SRC_PATH)/tests/fate/microsoft.mak include $(SRC_PATH)/tests/fate/mp3.mak include $(SRC_PATH)/tests/fate/mpc.mak include $(SRC_PATH)/tests/fate/pcm.mak +include $(SRC_PATH)/tests/fate/probe.mak include $(SRC_PATH)/tests/fate/prores.mak include $(SRC_PATH)/tests/fate/qt.mak include $(SRC_PATH)/tests/fate/qtrle.mak diff --git a/tests/fate-run.sh b/tests/fate-run.sh index 8097eec..ee4c28b 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -71,6 +71,10 @@ run(){ $target_exec $target_path/"$@" } +probe(){ + run avprobe -show_format_entry format_name -v 0 "$@" +} + avconv(){ run avconv -nostats -threads $threads -thread_type $thread_type -cpuflags $cpuflags "$@" } diff --git a/tests/fate/probe.mak b/tests/fate/probe.mak new file mode 100644 index 0000000..0381617 --- /dev/null +++ b/tests/fate/probe.mak @@ -0,0 +1,17 @@ +FATE_PROBE_FORMAT += fate-probe-format-roundup997 +fate-probe-format-roundup997: REF = mpeg + +FATE_PROBE_FORMAT += fate-probe-format-roundup1383 +fate-probe-format-roundup1383: REF = mp3 + +FATE_PROBE_FORMAT += fate-probe-format-roundup1414 +fate-probe-format-roundup1414: REF = mpeg + +FATE_PROBE_FORMAT += fate-probe-format-roundup2015 +fate-probe-format-roundup2015: REF = dv + +FATE_TESTS += $(FATE_PROBE_FORMAT) +fate-probe-format: $(FATE_PROBE_FORMAT) + +$(FATE_PROBE_FORMAT): CMP = oneline +fate-probe-format-%: CMD = probe $(SAMPLES)/probe-format/$(subst fate-probe-format-,,$@) -- 1.7.7.3 I couldn't get $* to work, even with secondary expansion. From mans at mansr.com Fri May 4 03:02:17 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Fri, 04 May 2012 02:02:17 +0100 Subject: [libav-devel] [PATCH 3/3] Add probe fate tests to test for regressions in detecting media types. In-Reply-To: <1336093014-6669-1-git-send-email-alex.converse@gmail.com> (Alex Converse's message of "Thu, 3 May 2012 17:56:54 -0700") References: <1336093014-6669-1-git-send-email-alex.converse@gmail.com> Message-ID: Alex Converse writes: > From: "Ronald S. Bultje" > > Signed-off-by: Alex Converse > --- > tests/Makefile | 1 + > tests/fate-run.sh | 4 ++++ > tests/fate/probe.mak | 17 +++++++++++++++++ > 3 files changed, 22 insertions(+), 0 deletions(-) > create mode 100644 tests/fate/probe.mak > > diff --git a/tests/Makefile b/tests/Makefile > index 19fbe11..a8db07f 100644 > --- a/tests/Makefile > +++ b/tests/Makefile > @@ -48,6 +48,7 @@ include $(SRC_PATH)/tests/fate/microsoft.mak > include $(SRC_PATH)/tests/fate/mp3.mak > include $(SRC_PATH)/tests/fate/mpc.mak > include $(SRC_PATH)/tests/fate/pcm.mak > +include $(SRC_PATH)/tests/fate/probe.mak > include $(SRC_PATH)/tests/fate/prores.mak > include $(SRC_PATH)/tests/fate/qt.mak > include $(SRC_PATH)/tests/fate/qtrle.mak > diff --git a/tests/fate-run.sh b/tests/fate-run.sh > index 8097eec..ee4c28b 100755 > --- a/tests/fate-run.sh > +++ b/tests/fate-run.sh > @@ -71,6 +71,10 @@ run(){ > $target_exec $target_path/"$@" > } > > +probe(){ > + run avprobe -show_format_entry format_name -v 0 "$@" > +} I *still* think this should have a less generic name. > avconv(){ > run avconv -nostats -threads $threads -thread_type $thread_type -cpuflags $cpuflags "$@" > } > diff --git a/tests/fate/probe.mak b/tests/fate/probe.mak > new file mode 100644 > index 0000000..0381617 > --- /dev/null > +++ b/tests/fate/probe.mak > @@ -0,0 +1,17 @@ > +FATE_PROBE_FORMAT += fate-probe-format-roundup997 > +fate-probe-format-roundup997: REF = mpeg > + > +FATE_PROBE_FORMAT += fate-probe-format-roundup1383 > +fate-probe-format-roundup1383: REF = mp3 > + > +FATE_PROBE_FORMAT += fate-probe-format-roundup1414 > +fate-probe-format-roundup1414: REF = mpeg > + > +FATE_PROBE_FORMAT += fate-probe-format-roundup2015 > +fate-probe-format-roundup2015: REF = dv > + > +FATE_TESTS += $(FATE_PROBE_FORMAT) > +fate-probe-format: $(FATE_PROBE_FORMAT) > + > +$(FATE_PROBE_FORMAT): CMP = oneline > +fate-probe-format-%: CMD = probe $(SAMPLES)/probe-format/$(subst fate-probe-format-,,$@) > -- > 1.7.7.3 > > I couldn't get $* to work, even with secondary expansion. $(@:fate-probe-format-%=%) then. No need for $(subst) for simple things like this. -- M?ns Rullg?rd mans at mansr.com From rsbultje at gmail.com Fri May 4 03:16:21 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Thu, 3 May 2012 18:16:21 -0700 Subject: [libav-devel] [PATCH 1/3] mp3/ac3 probe: search for PES headers to prevent probing MPEG-PS as MP3. In-Reply-To: <1336068060-71190-1-git-send-email-rsbultje@gmail.com> References: <1336068060-71190-1-git-send-email-rsbultje@gmail.com> Message-ID: Hi, On Thu, May 3, 2012 at 11:00 AM, Ronald S. Bultje wrote: > From: "Ronald S. Bultje" > > --- > ?libavformat/ac3dec.c | ? 30 +++++++++++++++++++++++++----- > ?libavformat/mp3dec.c | ? 30 +++++++++++++++++++++++++----- > ?2 files changed, 50 insertions(+), 10 deletions(-) Ping, this is the original patch that triggered all this weirdness with fate probe tests, anyone in favour? Ronald From alex.converse at gmail.com Fri May 4 03:28:35 2012 From: alex.converse at gmail.com (Alex Converse) Date: Thu, 3 May 2012 18:28:35 -0700 Subject: [libav-devel] [PATCH] Add probe fate tests to test for regressions in detecting media types. In-Reply-To: References: Message-ID: <1336094915-9512-1-git-send-email-alex.converse@gmail.com> From: "Ronald S. Bultje" Signed-off-by: Alex Converse --- tests/Makefile | 1 + tests/fate-run.sh | 4 ++++ tests/fate/probe.mak | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 0 deletions(-) create mode 100644 tests/fate/probe.mak diff --git a/tests/Makefile b/tests/Makefile index 19fbe11..a8db07f 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -48,6 +48,7 @@ include $(SRC_PATH)/tests/fate/microsoft.mak include $(SRC_PATH)/tests/fate/mp3.mak include $(SRC_PATH)/tests/fate/mpc.mak include $(SRC_PATH)/tests/fate/pcm.mak +include $(SRC_PATH)/tests/fate/probe.mak include $(SRC_PATH)/tests/fate/prores.mak include $(SRC_PATH)/tests/fate/qt.mak include $(SRC_PATH)/tests/fate/qtrle.mak diff --git a/tests/fate-run.sh b/tests/fate-run.sh index 8097eec..a45e9a9 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -71,6 +71,10 @@ run(){ $target_exec $target_path/"$@" } +probefmt(){ + run avprobe -show_format_entry format_name -v 0 "$@" +} + avconv(){ run avconv -nostats -threads $threads -thread_type $thread_type -cpuflags $cpuflags "$@" } diff --git a/tests/fate/probe.mak b/tests/fate/probe.mak new file mode 100644 index 0000000..8a1fd9a --- /dev/null +++ b/tests/fate/probe.mak @@ -0,0 +1,17 @@ +FATE_PROBE_FORMAT += fate-probe-format-roundup997 +fate-probe-format-roundup997: REF = mpeg + +FATE_PROBE_FORMAT += fate-probe-format-roundup1383 +fate-probe-format-roundup1383: REF = mp3 + +FATE_PROBE_FORMAT += fate-probe-format-roundup1414 +fate-probe-format-roundup1414: REF = mpeg + +FATE_PROBE_FORMAT += fate-probe-format-roundup2015 +fate-probe-format-roundup2015: REF = dv + +FATE_TESTS += $(FATE_PROBE_FORMAT) +fate-probe-format: $(FATE_PROBE_FORMAT) + +$(FATE_PROBE_FORMAT): CMP = oneline +fate-probe-format-%: CMD = probefmt $(SAMPLES)/probe-format/$(@:fate-probe-format-%=%) -- 1.7.7.3 From dalecurtis at chromium.org Fri May 4 03:57:01 2012 From: dalecurtis at chromium.org (Dale Curtis) Date: Thu, 3 May 2012 18:57:01 -0700 Subject: [libav-devel] ogg: Seek on video stream sometimes results decreased timestamps. In-Reply-To: References: <4FA31CC3.7080200@gentoo.org> <4FA32169.9090105@gentoo.org> Message-ID: On Thu, May 3, 2012 at 5:48 PM, Dale Curtis wrote: > On Thu, May 3, 2012 at 5:23 PM, Luca Barbato wrote: >> >> ToT? I'm at v0.8-1578-gc02efac. I'm really wondering why we are getting >> such results, I'm using gcc-4.6.2, which compiler are you using? >> >> > Sorry, I forgot ToT is probably a Chrome term, Tip-of-Tree. Which avplay > tells me is v0.8-1578-gc02efac. I get the same results with gcc 4.4.3 and > clang 3.2. > > Ah, I was able to reproduce your results now. I pasted the the wrong > configure option above. With: > > ./configure --enable-gpl > > I'm able to reproduce your results. However if I use > > /configure --disable-everything --enable-decoder=theora,vorbis > --enable-demuxer=ogg --enable-protocol=file > > I end up with the results I've shown. On Ronald's advice I tried > --enable-parser=vorbis without success either. Is there one I'm missing? > > - dale > After discussion on IRC it looked like the issue was --enable-parser=vp3, however that's not the case. I've updated the test case to reproduce the issue: http://commondatastorage.googleapis.com/dalecurtis-shared/ogg-ts-test-2.tar.bz2 ... pts: 144642 pts: 145666 pts: 139840 last pts bad!!! pts: 140864 pts: 141888 pts: 142912 pts: 143936 pts: 144960 pts: 145984 pts: 147008 pts: 148032 pts: 149056 The only difference is printing 60 frames and instead of seeking to 0, seek to 5 seconds. I'm also using a full libav build with --enable-gpl and nothing disabled this time :) - dale -------------- next part -------------- An HTML attachment was scrubbed... URL: From mans at mansr.com Fri May 4 04:06:13 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Fri, 04 May 2012 03:06:13 +0100 Subject: [libav-devel] [PATCH] Add probe fate tests to test for regressions in detecting media types. In-Reply-To: <1336094915-9512-1-git-send-email-alex.converse@gmail.com> (Alex Converse's message of "Thu, 3 May 2012 18:28:35 -0700") References: <1336094915-9512-1-git-send-email-alex.converse@gmail.com> Message-ID: Alex Converse writes: > From: "Ronald S. Bultje" > > Signed-off-by: Alex Converse > --- > tests/Makefile | 1 + > tests/fate-run.sh | 4 ++++ > tests/fate/probe.mak | 17 +++++++++++++++++ > 3 files changed, 22 insertions(+), 0 deletions(-) > create mode 100644 tests/fate/probe.mak > > diff --git a/tests/Makefile b/tests/Makefile > index 19fbe11..a8db07f 100644 > --- a/tests/Makefile > +++ b/tests/Makefile > @@ -48,6 +48,7 @@ include $(SRC_PATH)/tests/fate/microsoft.mak > include $(SRC_PATH)/tests/fate/mp3.mak > include $(SRC_PATH)/tests/fate/mpc.mak > include $(SRC_PATH)/tests/fate/pcm.mak > +include $(SRC_PATH)/tests/fate/probe.mak > include $(SRC_PATH)/tests/fate/prores.mak > include $(SRC_PATH)/tests/fate/qt.mak > include $(SRC_PATH)/tests/fate/qtrle.mak > diff --git a/tests/fate-run.sh b/tests/fate-run.sh > index 8097eec..a45e9a9 100755 > --- a/tests/fate-run.sh > +++ b/tests/fate-run.sh > @@ -71,6 +71,10 @@ run(){ > $target_exec $target_path/"$@" > } > > +probefmt(){ > + run avprobe -show_format_entry format_name -v 0 "$@" > +} > + > avconv(){ > run avconv -nostats -threads $threads -thread_type $thread_type -cpuflags $cpuflags "$@" > } > diff --git a/tests/fate/probe.mak b/tests/fate/probe.mak > new file mode 100644 > index 0000000..8a1fd9a > --- /dev/null > +++ b/tests/fate/probe.mak > @@ -0,0 +1,17 @@ > +FATE_PROBE_FORMAT += fate-probe-format-roundup997 > +fate-probe-format-roundup997: REF = mpeg > + > +FATE_PROBE_FORMAT += fate-probe-format-roundup1383 > +fate-probe-format-roundup1383: REF = mp3 > + > +FATE_PROBE_FORMAT += fate-probe-format-roundup1414 > +fate-probe-format-roundup1414: REF = mpeg > + > +FATE_PROBE_FORMAT += fate-probe-format-roundup2015 > +fate-probe-format-roundup2015: REF = dv > + > +FATE_TESTS += $(FATE_PROBE_FORMAT) > +fate-probe-format: $(FATE_PROBE_FORMAT) > + > +$(FATE_PROBE_FORMAT): CMP = oneline > +fate-probe-format-%: CMD = probefmt $(SAMPLES)/probe-format/$(@:fate-probe-format-%=%) > -- LGTM, pending whatever this depends on. -- M?ns Rullg?rd mans at mansr.com From gseanmcg at gmail.com Fri May 4 05:32:24 2012 From: gseanmcg at gmail.com (Sean McGovern) Date: Thu, 3 May 2012 23:32:24 -0400 Subject: [libav-devel] [PATCH] test programs: don't ignore the return value of fwrite() In-Reply-To: <1335466584-7087-1-git-send-email-gseanmcg@gmail.com> References: <1335395027-16446-1-git-send-email-gseanmcg@gmail.com> <1335466584-7087-1-git-send-email-gseanmcg@gmail.com> Message-ID: On 4/26/12, Sean McGovern wrote: > --- > tests/rotozoom.c | 15 ++++++++++++--- > tests/videogen.c | 15 ++++++++++++--- > 2 files changed, 24 insertions(+), 6 deletions(-) > > diff --git a/tests/rotozoom.c b/tests/rotozoom.c > index 9ce45cd..d9cfb42 100644 > --- a/tests/rotozoom.c > +++ b/tests/rotozoom.c Ping. From gseanmcg at gmail.com Fri May 4 05:44:56 2012 From: gseanmcg at gmail.com (Sean McGovern) Date: Thu, 3 May 2012 23:44:56 -0400 Subject: [libav-devel] [PATCH] configure: add POWER[5-7] support In-Reply-To: <1335534478-14547-2-git-send-email-gseanmcg@gmail.com> References: <1335498710-9210-1-git-send-email-gseanmcg@gmail.com> <1335534478-14547-1-git-send-email-gseanmcg@gmail.com> <1335534478-14547-2-git-send-email-gseanmcg@gmail.com> Message-ID: On 4/27/12, Sean McGovern wrote: > Also merge POWER3 and POWER4 configuration together with the additions. > --- > configure | 5 ++++- > 1 files changed, 4 insertions(+), 1 deletions(-) > > diff --git a/configure b/configure > index 1dc2e3e..ed1624e 100755 > --- a/configure > +++ b/configure > @@ -2279,9 +2279,12 @@ elif enabled ppc; then > 74*|ppc74*|powerpc74*) > cpuflags="-mcpu=7400 -mpowerpc-gfxopt" > ;; > - g5|970|ppc970|powerpc970|power4*) > + g5|970|ppc970|powerpc970) > cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64" > ;; > + power[3-7]*) > + cpuflags="-mcpu=$(tolower $cpu) -mpowerpc-gfxopt -mpowerpc64" > + ;; > cell) > cpuflags="-mcpu=cell" > enable ldbrx Ping. From anton at khirnov.net Fri May 4 07:29:46 2012 From: anton at khirnov.net (Anton Khirnov) Date: Fri, 4 May 2012 07:29:46 +0200 Subject: [libav-devel] [PATCH] lavfi: add a function for copying properties from AVFilterBufferRef->AVFrame In-Reply-To: <4FA2F162.7030601@gentoo.org> References: <4FA2F162.7030601@gentoo.org> Message-ID: <1336109386-5514-1-git-send-email-anton@khirnov.net> Based on a commit by Stefano Sabatini --- libavfilter/avfilter.c | 23 +++++++++++++++++++++++ libavfilter/avfilter.h | 8 ++++++++ 2 files changed, 31 insertions(+) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index d426591..3b1fd95 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -700,3 +700,26 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) return 0; } + +int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src) +{ + if (src->type != AVMEDIA_TYPE_VIDEO) + return AVERROR(EINVAL); + + memcpy(dst->data, src->data, sizeof(dst->data)); + memcpy(dst->linesize, src->linesize, sizeof(dst->linesize)); + dst->extended_data = dst->data; + + dst->pts = src->pts; + dst->format = src->format; + + dst->width = src->video->w; + dst->height = src->video->h; + dst->sample_aspect_ratio = src->video->pixel_aspect; + dst->interlaced_frame = src->video->interlaced; + dst->top_field_first = src->video->top_field_first; + dst->key_frame = src->video->key_frame; + dst->pict_type = src->video->pict_type; + + return 0; +} diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 068c50b..2b1bb55 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -862,4 +862,12 @@ static inline void avfilter_insert_outpad(AVFilterContext *f, unsigned index, */ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src); +/** + * Copy the frame properties and data pointers of src to dst, without copying + * the actual data. + * + * @return 0 on success, a negative number on error. + */ +int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src); + #endif /* AVFILTER_AVFILTER_H */ -- 1.7.9.5 From anton at khirnov.net Fri May 4 07:38:46 2012 From: anton at khirnov.net (Anton Khirnov) Date: Fri, 4 May 2012 07:38:46 +0200 Subject: [libav-devel] [PATCH] avprobe: allow showing only one container/stream property. In-Reply-To: <1336087997-31192-2-git-send-email-alex.converse@gmail.com> References: <1336087997-31192-2-git-send-email-alex.converse@gmail.com> Message-ID: <1336109926-6645-1-git-send-email-anton@khirnov.net> From: "Ronald S. Bultje" This is useful for writing unit tests. Signed-off-by: Anton Khirnov --- avprobe.c | 68 ++++++++++++++++++++++++++++++++++++++---------------- doc/avprobe.texi | 5 ++++ 2 files changed, 53 insertions(+), 20 deletions(-) diff --git a/avprobe.c b/avprobe.c index fe2b6e2..607212e 100644 --- a/avprobe.c +++ b/avprobe.c @@ -33,6 +33,7 @@ const char program_name[] = "avprobe"; const int program_birth_year = 2007; static int do_show_format = 0; +static AVDictionary *fmt_entries_to_show = NULL; static int do_show_packets = 0; static int do_show_streams = 0; @@ -58,6 +59,7 @@ static const char unit_bit_per_second_str[] = "bit/s"; void exit_program(int ret) { + av_dict_free(&fmt_entries_to_show); exit(ret); } @@ -257,36 +259,53 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx) printf("[/STREAM]\n"); } +static void print_format_entry(const char *tag, + const char *val) +{ + if (!fmt_entries_to_show) { + if (tag) { + printf("%s=%s\n", tag, val); + } else { + printf("%s\n", val); + } + } else if (tag && av_dict_get(fmt_entries_to_show, tag, NULL, 0)) { + printf("%s=%s\n", tag, val); + } +} + static void show_format(AVFormatContext *fmt_ctx) { AVDictionaryEntry *tag = NULL; char val_str[128]; int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1; - printf("[FORMAT]\n"); - - printf("filename=%s\n", fmt_ctx->filename); - printf("nb_streams=%d\n", fmt_ctx->nb_streams); - printf("format_name=%s\n", fmt_ctx->iformat->name); - printf("format_long_name=%s\n", fmt_ctx->iformat->long_name); - printf("start_time=%s\n", - time_value_string(val_str, sizeof(val_str), - fmt_ctx->start_time, &AV_TIME_BASE_Q)); - printf("duration=%s\n", - time_value_string(val_str, sizeof(val_str), - fmt_ctx->duration, &AV_TIME_BASE_Q)); - printf("size=%s\n", size >= 0 ? value_string(val_str, sizeof(val_str), - size, unit_byte_str) + print_format_entry(NULL, "[FORMAT]"); + print_format_entry("filename", fmt_ctx->filename); + snprintf(val_str, sizeof(val_str) - 1, "%d", fmt_ctx->nb_streams); + print_format_entry("nb_streams", val_str); + print_format_entry("format_name", fmt_ctx->iformat->name); + print_format_entry("format_long_name", fmt_ctx->iformat->long_name); + print_format_entry("start_time", + time_value_string(val_str, sizeof(val_str), + fmt_ctx->start_time, &AV_TIME_BASE_Q)); + print_format_entry("duration", + time_value_string(val_str, sizeof(val_str), + fmt_ctx->duration, &AV_TIME_BASE_Q)); + print_format_entry("size", + size >= 0 ? value_string(val_str, sizeof(val_str), + size, unit_byte_str) : "unknown"); - printf("bit_rate=%s\n", - value_string(val_str, sizeof(val_str), - fmt_ctx->bit_rate, unit_bit_per_second_str)); + print_format_entry("bit_rate", + value_string(val_str, sizeof(val_str), + fmt_ctx->bit_rate, unit_bit_per_second_str)); while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, - AV_DICT_IGNORE_SUFFIX))) - printf("TAG:%s=%s\n", tag->key, tag->value); + AV_DICT_IGNORE_SUFFIX))) { + snprintf(val_str, sizeof(val_str) - 1, "TAG:%s", tag->key); + print_format_entry(val_str, tag->value); + } - printf("[/FORMAT]\n"); + print_format_entry(NULL, "[/FORMAT]"); } static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename) @@ -372,6 +391,13 @@ static int opt_format(const char *opt, const char *arg) return 0; } +static int opt_show_format_entry(const char *opt, const char *arg) +{ + do_show_format = 1; + av_dict_set(&fmt_entries_to_show, arg, "", 0); + return 0; +} + static void opt_input_file(void *optctx, const char *arg) { if (input_filename) { @@ -416,6 +442,8 @@ static const OptionDef options[] = { { "pretty", 0, {(void*)&opt_pretty}, "prettify the format of displayed values, make it more human readable" }, { "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" }, + { "show_format_entry", HAS_ARG, {(void*)opt_show_format_entry}, + "show a particular entry from the format/container info" }, { "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" }, { "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" }, { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, diff --git a/doc/avprobe.texi b/doc/avprobe.texi index 6b2c800..67c5e20 100644 --- a/doc/avprobe.texi +++ b/doc/avprobe.texi @@ -94,6 +94,11 @@ stream. All the container format information is printed within a section with name "FORMAT". + at item -show_format_entry @var{name} +Like @option{-show_format}, but only prints the specified entry of the +container format information, rather than all. This option may be given more +than once, then all specified entries will be shown. + @item -show_packets Show information about each packet contained in the input multimedia stream. -- 1.7.9.5 From mans at mansr.com Fri May 4 13:57:38 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Fri, 04 May 2012 12:57:38 +0100 Subject: [libav-devel] [PATCH] configure: add POWER[5-7] support In-Reply-To: <1335534478-14547-2-git-send-email-gseanmcg@gmail.com> (Sean McGovern's message of "Fri, 27 Apr 2012 09:47:58 -0400") References: <1335498710-9210-1-git-send-email-gseanmcg@gmail.com> <1335534478-14547-1-git-send-email-gseanmcg@gmail.com> <1335534478-14547-2-git-send-email-gseanmcg@gmail.com> Message-ID: Sean McGovern writes: > Also merge POWER3 and POWER4 configuration together with the additions. > --- > configure | 5 ++++- > 1 files changed, 4 insertions(+), 1 deletions(-) > > diff --git a/configure b/configure > index 1dc2e3e..ed1624e 100755 > --- a/configure > +++ b/configure > @@ -2279,9 +2279,12 @@ elif enabled ppc; then > 74*|ppc74*|powerpc74*) > cpuflags="-mcpu=7400 -mpowerpc-gfxopt" > ;; > - g5|970|ppc970|powerpc970|power4*) > + g5|970|ppc970|powerpc970) > cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64" > ;; > + power[3-7]*) > + cpuflags="-mcpu=$(tolower $cpu) -mpowerpc-gfxopt -mpowerpc64" What's with the tolower? I think it's fair to expect of people to type the name in lowercase. The case-insensitive matching was mainly added for the Gx names, which I can more easily see being entered in uppercase. Not that it's important, I just like to keep things uncluttered. -- M?ns Rullg?rd mans at mansr.com From mans at mansr.com Fri May 4 13:58:02 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Fri, 04 May 2012 12:58:02 +0100 Subject: [libav-devel] [PATCH] lavfi: add a function for copying properties from AVFilterBufferRef->AVFrame In-Reply-To: <1336109386-5514-1-git-send-email-anton@khirnov.net> (Anton Khirnov's message of "Fri, 4 May 2012 07:29:46 +0200") References: <4FA2F162.7030601@gentoo.org> <1336109386-5514-1-git-send-email-anton@khirnov.net> Message-ID: Anton Khirnov writes: > Based on a commit by Stefano Sabatini > --- > libavfilter/avfilter.c | 23 +++++++++++++++++++++++ > libavfilter/avfilter.h | 8 ++++++++ > 2 files changed, 31 insertions(+) What is it good for? -- M?ns Rullg?rd mans at mansr.com From anton at khirnov.net Fri May 4 14:14:13 2012 From: anton at khirnov.net (Anton Khirnov) Date: Fri, 04 May 2012 14:14:13 +0200 Subject: [libav-devel] [PATCH] lavfi: add a function for copying properties from AVFilterBufferRef->AVFrame In-Reply-To: References: <4FA2F162.7030601@gentoo.org> <1336109386-5514-1-git-send-email-anton@khirnov.net> Message-ID: <20120504121413.4214.26838@daenerys.khirnov.net> On Fri, 04 May 2012 12:58:02 +0100, M?ns Rullg?rd wrote: > Anton Khirnov writes: > > > Based on a commit by Stefano Sabatini > > --- > > libavfilter/avfilter.c | 23 +++++++++++++++++++++++ > > libavfilter/avfilter.h | 8 ++++++++ > > 2 files changed, 31 insertions(+) > > What is it good for? > See next commit. You get an AVFilterBufferRef from lavfi, you typically want to convert it to an AVFrame so you can feed it to encoder. -- Anton Khirnov From mans at mansr.com Fri May 4 14:15:54 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Fri, 04 May 2012 13:15:54 +0100 Subject: [libav-devel] [PATCH 3/3] aacps: NEON optimisations In-Reply-To: (=?iso-8859-1?Q?=22M=E5n?= =?iso-8859-1?Q?s_Rullg=E5rd=22's?= message of "Wed, 25 Apr 2012 14:10:23 +0100") References: <1331644927-3409-1-git-send-email-mans@mansr.com> <1331644927-3409-3-git-send-email-mans@mansr.com> Message-ID: M?ns Rullg?rd writes: > Mans Rullgard writes: > >> Signed-off-by: Mans Rullgard >> --- >> libavcodec/aacpsdsp.c | 3 + >> libavcodec/aacpsdsp.h | 1 + >> libavcodec/arm/Makefile | 6 +- >> libavcodec/arm/aacpsdsp_init_arm.c | 53 +++++++ >> libavcodec/arm/aacpsdsp_neon.S | 272 ++++++++++++++++++++++++++++++++++++ >> 5 files changed, 333 insertions(+), 2 deletions(-) >> create mode 100644 libavcodec/arm/aacpsdsp_init_arm.c >> create mode 100644 libavcodec/arm/aacpsdsp_neon.S > > ping ping -- M?ns Rullg?rd mans at mansr.com From mans at mansr.com Fri May 4 14:18:25 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Fri, 04 May 2012 13:18:25 +0100 Subject: [libav-devel] [PATCH] lavfi: add a function for copying properties from AVFilterBufferRef->AVFrame In-Reply-To: <20120504121413.4214.26838@daenerys.khirnov.net> (Anton Khirnov's message of "Fri, 04 May 2012 14:14:13 +0200") References: <4FA2F162.7030601@gentoo.org> <1336109386-5514-1-git-send-email-anton@khirnov.net> <20120504121413.4214.26838@daenerys.khirnov.net> Message-ID: Anton Khirnov writes: > On Fri, 04 May 2012 12:58:02 +0100, M?ns Rullg?rd wrote: >> Anton Khirnov writes: >> >> > Based on a commit by Stefano Sabatini >> > --- >> > libavfilter/avfilter.c | 23 +++++++++++++++++++++++ >> > libavfilter/avfilter.h | 8 ++++++++ >> > 2 files changed, 31 insertions(+) >> >> What is it good for? >> > > See next commit. > > You get an AVFilterBufferRef from lavfi, you typically want to convert > it to an AVFrame so you can feed it to encoder. Time to move AVFrame to lavu and have lavfi return those directly? -- M?ns Rullg?rd mans at mansr.com From anton at khirnov.net Fri May 4 14:26:22 2012 From: anton at khirnov.net (Anton Khirnov) Date: Fri, 04 May 2012 14:26:22 +0200 Subject: [libav-devel] [PATCH] lavfi: add a function for copying properties from AVFilterBufferRef->AVFrame In-Reply-To: References: <4FA2F162.7030601@gentoo.org> <1336109386-5514-1-git-send-email-anton@khirnov.net> <20120504121413.4214.26838@daenerys.khirnov.net> Message-ID: <20120504122622.4214.34370@daenerys.khirnov.net> On Fri, 04 May 2012 13:18:25 +0100, M?ns Rullg?rd wrote: > Anton Khirnov writes: > > > On Fri, 04 May 2012 12:58:02 +0100, M?ns Rullg?rd wrote: > >> Anton Khirnov writes: > >> > >> > Based on a commit by Stefano Sabatini > >> > --- > >> > libavfilter/avfilter.c | 23 +++++++++++++++++++++++ > >> > libavfilter/avfilter.h | 8 ++++++++ > >> > 2 files changed, 31 insertions(+) > >> > >> What is it good for? > >> > > > > See next commit. > > > > You get an AVFilterBufferRef from lavfi, you typically want to convert > > it to an AVFrame so you can feed it to encoder. > > Time to move AVFrame to lavu and have lavfi return those directly? > Yes, but that's a lot of effort. I'm planning to do this some time, but not right now. -- Anton Khirnov From jb at videolan.org Fri May 4 14:38:48 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Fri, 4 May 2012 14:38:48 +0200 Subject: [libav-devel] VideoLAN Dev Days 2012 Message-ID: <20120504123848.GA14161@videolan.org> Hello fellow-geeks and friends, Like last year, I plan to organize a small technical conference, at the end of the summer, in Paris, for us to gather, discuss and/or code. Like last year, this is a technical conference, not a blabla one. Like last year, all geeks of important projects on the multimedia field are invited. I would suggest to invite Xiph people too, compared to last year. And VideoLAN will pay travel, hotels and food to active contributors that do not have a corporate sponsorship (Although reimbursement will be faster than last year). So far, the plan is to do it on the first week-end of September 2012 in Paris, France. This should not conflict with IBC. For lack of a better name (av500con? falcon? whatevercon), I will keep, for now, the VDD name. Interested? Thoughts? Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From gseanmcg at gmail.com Fri May 4 14:48:20 2012 From: gseanmcg at gmail.com (Sean McGovern) Date: Fri, 4 May 2012 08:48:20 -0400 Subject: [libav-devel] [PATCH] configure: add POWER[5-7] support In-Reply-To: References: <1335498710-9210-1-git-send-email-gseanmcg@gmail.com> <1335534478-14547-1-git-send-email-gseanmcg@gmail.com> <1335534478-14547-2-git-send-email-gseanmcg@gmail.com> Message-ID: On Friday, May 4, 2012, M?ns Rullg?rd wrote: > Sean McGovern writes: > >> Also merge POWER3 and POWER4 configuration together with the additions. >> --- >> configure | 5 ++++- >> 1 files changed, 4 insertions(+), 1 deletions(-) >> >> diff --git a/configure b/configure >> index 1dc2e3e..ed1624e 100755 >> --- a/configure >> +++ b/configure >> @@ -2279,9 +2279,12 @@ elif enabled ppc; then >> 74*|ppc74*|powerpc74*) >> cpuflags="-mcpu=7400 -mpowerpc-gfxopt" >> ;; >> - g5|970|ppc970|powerpc970|power4*) >> + g5|970|ppc970|powerpc970) >> cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64" >> ;; >> + power[3-7]*) >> + cpuflags="-mcpu=$(tolower $cpu) -mpowerpc-gfxopt -mpowerpc64" > > What's with the tolower? I think it's fair to expect of people to type > the name in lowercase. The case-insensitive matching was mainly added > for the Gx names, which I can more easily see being entered in uppercase. > Fair enough -- I was just copying the case statement above it (not visible in the patch). Want I fix that too? -- Sean -------------- next part -------------- An HTML attachment was scrubbed... URL: From mans at mansr.com Fri May 4 14:51:15 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Fri, 04 May 2012 13:51:15 +0100 Subject: [libav-devel] [PATCH] configure: add POWER[5-7] support In-Reply-To: (Sean McGovern's message of "Fri, 4 May 2012 08:48:20 -0400") References: <1335498710-9210-1-git-send-email-gseanmcg@gmail.com> <1335534478-14547-1-git-send-email-gseanmcg@gmail.com> <1335534478-14547-2-git-send-email-gseanmcg@gmail.com> Message-ID: Sean McGovern writes: > On Friday, May 4, 2012, M?ns Rullg?rd wrote: >> Sean McGovern writes: >> >>> Also merge POWER3 and POWER4 configuration together with the additions. >>> --- >>> configure | 5 ++++- >>> 1 files changed, 4 insertions(+), 1 deletions(-) >>> >>> diff --git a/configure b/configure >>> index 1dc2e3e..ed1624e 100755 >>> --- a/configure >>> +++ b/configure >>> @@ -2279,9 +2279,12 @@ elif enabled ppc; then >>> 74*|ppc74*|powerpc74*) >>> cpuflags="-mcpu=7400 -mpowerpc-gfxopt" >>> ;; >>> - g5|970|ppc970|powerpc970|power4*) >>> + g5|970|ppc970|powerpc970) >>> cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64" >>> ;; >>> + power[3-7]*) >>> + cpuflags="-mcpu=$(tolower $cpu) -mpowerpc-gfxopt > -mpowerpc64" >> >> What's with the tolower? I think it's fair to expect of people to type >> the name in lowercase. The case-insensitive matching was mainly added >> for the Gx names, which I can more easily see being entered in uppercase. >> > > Fair enough -- I was just copying the case statement above it (not visible > in the patch). Want I fix that too? I can do that. No need to resend. -- M?ns Rullg?rd mans at mansr.com From jpsaman at videolan.org Fri May 4 15:17:40 2012 From: jpsaman at videolan.org (Jean-Paul Saman) Date: Fri, 4 May 2012 15:17:40 +0200 Subject: [libav-devel] [dvblast-devel] VideoLAN Dev Days 2012 In-Reply-To: <20120504123848.GA14161@videolan.org> References: <20120504123848.GA14161@videolan.org> Message-ID: On Fri, May 4, 2012 at 2:38 PM, Jean-Baptiste Kempf wrote: > Hello fellow-geeks and friends, > > Like last year, I plan to organize a small technical conference, at the > end of the summer, in Paris, for us to gather, discuss and/or code. > > Like last year, this is a technical conference, not a blabla one. > > Like last year, all geeks of important projects on the multimedia > field are invited. I would suggest to invite Xiph people too, compared > to last year. good idea > And VideoLAN will pay travel, hotels and food to active contributors that > do not have a corporate sponsorship (Although reimbursement will be > faster than last year). > > So far, the plan is to do it on the first week-end of September 2012 in > Paris, France. This should not conflict with IBC. The IBC is from 6 till 11 september. So no conflict for sure. > For lack of a better name (av500con? falcon? whatevercon), I will keep, > for now, the VDD name. VDD is a good name. > Interested? Thoughts? Maybe invite some v4l2 kernel and pulseaudio devs? Kind regards, Jean-Paul Saman From remi at remlab.net Fri May 4 15:27:18 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Fri, 04 May 2012 15:27:18 +0200 Subject: [libav-devel] [vlc-devel] [dvblast-devel] VideoLAN Dev Days 2012 In-Reply-To: References: <20120504123848.GA14161@videolan.org> Message-ID: <4c3d52336fef8ee15e8c2d4fec485ae8@chewa.net> On Fri, 4 May 2012 15:17:40 +0200, Jean-Paul Saman wrote: > Maybe invite some v4l2 kernel and pulseaudio devs? LinuxCon and LPC will follow the Linux Kernel Summit in San Diego and end on August 31st. That is the previous day... I understand the gesture, but that most probably won't work out for them. -- R?mi Denis-Courmont Sent from my collocated server From of at flatfrog.com Fri May 4 15:41:49 2012 From: of at flatfrog.com (Orjan Friberg) Date: Fri, 4 May 2012 15:41:49 +0200 Subject: [libav-devel] NEON: performance comparison of fixed-point and float FFT Message-ID: <4FA3DC9D.8040708@flatfrog.com> Hi, Comparing the performance of fft-test and fft-fixed-test on a Cortex-A8 (with Neon support enabled) I only see a very small performance increase with the 16-bit fixed point version compared to the float version, regardless of the FFT size (64, 256, 4096). I didn't see any performance numbers in M?ns' original patch post. The obvious question is what limits the performance of the fixed-point implementation? My assumption being that for many of the operations involved, it should be possible to process twice the amount of elements in the same amount of time. (The underlying data type isn't changed for the fixed-point test (i.e. the data is not 16-bit packed), but for small sizes the L1 data cache should be pretty warm anyway so I don't suspect that the implementation is throttled by memory.) Thanks, Orjan -- Orjan Friberg FlatFrog Laboratories AB From mans at mansr.com Fri May 4 15:50:55 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Fri, 04 May 2012 14:50:55 +0100 Subject: [libav-devel] NEON: performance comparison of fixed-point and float FFT In-Reply-To: <4FA3DC9D.8040708@flatfrog.com> (Orjan Friberg's message of "Fri, 4 May 2012 15:41:49 +0200") References: <4FA3DC9D.8040708@flatfrog.com> Message-ID: Orjan Friberg writes: > Hi, > > Comparing the performance of fft-test and fft-fixed-test on a > Cortex-A8 (with Neon support enabled) I only see a very small > performance increase with the 16-bit fixed point version compared to > the float version, regardless of the FFT size (64, 256, 4096). I > didn't see any performance numbers in M?ns' original patch post. > > The obvious question is what limits the performance of the fixed-point > implementation? My assumption being that for many of the operations > involved, it should be possible to process twice the amount of > elements in the same amount of time. The 16-bit FFT uses 32-bit intermediate values in many places, so it does not process twice as much per instruction. It also has to do a few shifts that the float version does not. It seems reasonable to me that these implementations are roughly the same speed on this hardware. -- M?ns Rullg?rd mans at mansr.com From of at flatfrog.com Fri May 4 15:59:19 2012 From: of at flatfrog.com (Orjan Friberg) Date: Fri, 4 May 2012 15:59:19 +0200 Subject: [libav-devel] NEON: performance comparison of fixed-point and float FFT In-Reply-To: References: <4FA3DC9D.8040708@flatfrog.com> Message-ID: <4FA3E0B7.4010300@flatfrog.com> On 05/04/2012 03:50 PM, M?ns Rullg?rd wrote: > The 16-bit FFT uses 32-bit intermediate values in many places, so it > does not process twice as much per instruction. It also has to do a few > shifts that the float version does not. It seems reasonable to me that > these implementations are roughly the same speed on this hardware. All right, thanks. -- Orjan Friberg FlatFrog Laboratories AB From diego at biurrun.de Fri May 4 16:18:09 2012 From: diego at biurrun.de (Diego Biurrun) Date: Fri, 04 May 2012 16:18:09 +0200 Subject: [libav-devel] VideoLAN Dev Days 2012 In-Reply-To: <20120504123848.GA14161@videolan.org> References: <20120504123848.GA14161@videolan.org> Message-ID: <20120504141808.GA1847@pool.informatik.rwth-aachen.de> On Fri, May 04, 2012 at 02:38:48PM +0200, Jean-Baptiste Kempf wrote: > Hello fellow-geeks and friends, > > Like last year, I plan to organize a small technical conference, at the > end of the summer, in Paris, for us to gather, discuss and/or code. > > Like last year, this is a technical conference, not a blabla one. > > Like last year, all geeks of important projects on the multimedia > field are invited. I would suggest to invite Xiph people too, compared > to last year. > And VideoLAN will pay travel, hotels and food to active contributors that > do not have a corporate sponsorship (Although reimbursement will be > faster than last year). > > So far, the plan is to do it on the first week-end of September 2012 in > Paris, France. This should not conflict with IBC. > > For lack of a better name (av500con? falcon? whatevercon), I will keep, > for now, the VDD name. > > Interested? Thoughts? ?Yay, count me in! Thanks for taking the initiative to organize it again, I'm looking forward to it already. Diego From derek.buitenhuis at gmail.com Fri May 4 16:41:47 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Fri, 4 May 2012 10:41:47 -0400 Subject: [libav-devel] [PATCH] zerocodec: check if there is previous frame Message-ID: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> From: Paul B Mahol Fixes crash in bug #1219. Signed-off-by: Paul B Mahol --- libavcodec/zerocodec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c index 6c57e05..54a7e06 100644 --- a/libavcodec/zerocodec.c +++ b/libavcodec/zerocodec.c @@ -65,6 +65,10 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, pic->key_frame = 1; pic->pict_type = AV_PICTURE_TYPE_I; } else { + if (prev == NULL) { + av_log(avctx, AV_LOG_ERROR, "No previous frame!\n"); + return AVERROR_INVALIDDATA; + } pic->key_frame = 0; pic->pict_type = AV_PICTURE_TYPE_P; } -- 1.7.10 From kostya.shishkov at gmail.com Fri May 4 16:44:46 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Fri, 4 May 2012 16:44:46 +0200 Subject: [libav-devel] [PATCH] zerocodec: check if there is previous frame In-Reply-To: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> References: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> Message-ID: <20120504144446.GA692@kst-acer> On Fri, May 04, 2012 at 10:41:47AM -0400, Derek Buitenhuis wrote: > From: Paul B Mahol > > Fixes crash in bug #1219. > > Signed-off-by: Paul B Mahol > --- > libavcodec/zerocodec.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c > index 6c57e05..54a7e06 100644 > --- a/libavcodec/zerocodec.c > +++ b/libavcodec/zerocodec.c > @@ -65,6 +65,10 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, > pic->key_frame = 1; > pic->pict_type = AV_PICTURE_TYPE_I; > } else { > + if (prev == NULL) { > + av_log(avctx, AV_LOG_ERROR, "No previous frame!\n"); > + return AVERROR_INVALIDDATA; > + } > pic->key_frame = 0; > pic->pict_type = AV_PICTURE_TYPE_P; > } > -- nit: if (!prev) looks better to me in any case patch looks OK From derek.buitenhuis at gmail.com Fri May 4 16:47:04 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Fri, 04 May 2012 10:47:04 -0400 Subject: [libav-devel] [PATCH] zerocodec: check if there is previous frame In-Reply-To: <20120504144446.GA692@kst-acer> References: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> <20120504144446.GA692@kst-acer> Message-ID: <4FA3EBE8.1000601@gmail.com> On 04/05/2012 10:44 AM, Kostya Shishkov wrote: > nit: if (!prev) looks better to me > in any case patch looks OK I agree, but I elected to leave the patch untouched. - Derek From mans at mansr.com Fri May 4 16:48:12 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Fri, 04 May 2012 15:48:12 +0100 Subject: [libav-devel] [PATCH] zerocodec: check if there is previous frame In-Reply-To: <4FA3EBE8.1000601@gmail.com> (Derek Buitenhuis's message of "Fri, 04 May 2012 10:47:04 -0400") References: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> <20120504144446.GA692@kst-acer> <4FA3EBE8.1000601@gmail.com> Message-ID: Derek Buitenhuis writes: > On 04/05/2012 10:44 AM, Kostya Shishkov wrote: >> nit: if (!prev) looks better to me >> in any case patch looks OK > > I agree, but I elected to leave the patch untouched. Why? -- M?ns Rullg?rd mans at mansr.com From derek.buitenhuis at gmail.com Fri May 4 17:17:53 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Fri, 04 May 2012 11:17:53 -0400 Subject: [libav-devel] [PATCH] zerocodec: check if there is previous frame In-Reply-To: References: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> <20120504144446.GA692@kst-acer> <4FA3EBE8.1000601@gmail.com> Message-ID: <4FA3F321.8090309@gmail.com> On 04/05/2012 10:48 AM, M?ns Rullg?rd wrote: >> I agree, but I elected to leave the patch untouched. > Why? Modifying others'/existing patches for personal preferences is silly, in my opinion, is all. - Derek From mans at mansr.com Fri May 4 17:19:17 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Fri, 04 May 2012 16:19:17 +0100 Subject: [libav-devel] [PATCH] zerocodec: check if there is previous frame In-Reply-To: <4FA3F321.8090309@gmail.com> (Derek Buitenhuis's message of "Fri, 04 May 2012 11:17:53 -0400") References: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> <20120504144446.GA692@kst-acer> <4FA3EBE8.1000601@gmail.com> <4FA3F321.8090309@gmail.com> Message-ID: Derek Buitenhuis writes: > On 04/05/2012 10:48 AM, M?ns Rullg?rd wrote: >>> I agree, but I elected to leave the patch untouched. >> Why? > > Modifying others'/existing patches for personal preferences > is silly, in my opinion, is all. We have style rules which should be adhered to, even if someone submits a patch in violation. -- M?ns Rullg?rd mans at mansr.com From derek.buitenhuis at gmail.com Fri May 4 17:21:45 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Fri, 04 May 2012 11:21:45 -0400 Subject: [libav-devel] [PATCH] zerocodec: check if there is previous frame In-Reply-To: References: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> <20120504144446.GA692@kst-acer> <4FA3EBE8.1000601@gmail.com> <4FA3F321.8090309@gmail.com> Message-ID: <4FA3F409.1050601@gmail.com> On 04/05/2012 11:19 AM, M?ns Rullg?rd wrote: > We have style rules which should be adhered to, even if someone submits > a patch in violation. There is no violation here. Such a case is not documented by our style rules. - Derek From mans at mansr.com Fri May 4 17:29:21 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Fri, 04 May 2012 16:29:21 +0100 Subject: [libav-devel] [PATCH] zerocodec: check if there is previous frame In-Reply-To: <4FA3F409.1050601@gmail.com> (Derek Buitenhuis's message of "Fri, 04 May 2012 11:21:45 -0400") References: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> <20120504144446.GA692@kst-acer> <4FA3EBE8.1000601@gmail.com> <4FA3F321.8090309@gmail.com> <4FA3F409.1050601@gmail.com> Message-ID: Derek Buitenhuis writes: > On 04/05/2012 11:19 AM, M?ns Rullg?rd wrote: >> We have style rules which should be adhered to, even if someone submits >> a patch in violation. > > There is no violation here. > Such a case is not documented by our style rules. You were asked to change it. Please comply. -- M?ns Rullg?rd mans at mansr.com From nenjordi at gmail.com Fri May 4 17:50:31 2012 From: nenjordi at gmail.com (Jordi Ortiz) Date: Fri, 4 May 2012 17:50:31 +0200 Subject: [libav-devel] [PATCH] rtsp: Add content-type message header parsing Message-ID: <1336146631-6353-1-git-send-email-nenjordi@gmail.com> --- libavformat/rtsp.c | 3 +++ libavformat/rtsp.h | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 01fe350..a4a89bf 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -870,6 +870,9 @@ void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf, } else if (av_stristart(p, "x-Accept-Dynamic-Rate:", &p) && rt) { p += strspn(p, SPACE_CHARS); rt->accept_dynamic_rate = atoi(p); + } else if (av_stristart(p, "Content-Type:", &p)) { + p += strspn(p, SPACE_CHARS); + av_strlcpy(reply->content_type, p, sizeof(reply->content_type)); } } diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index 6890d4e..594c57d 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -171,6 +171,11 @@ typedef struct RTSPMessageHeader { * returned */ char reason[256]; + + /** + * Content type header + */ + char content_type[64]; } RTSPMessageHeader; /** -- 1.7.10 From kostya.shishkov at gmail.com Fri May 4 17:59:34 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Fri, 4 May 2012 17:59:34 +0200 Subject: [libav-devel] [PATCH] zerocodec: check if there is previous frame In-Reply-To: References: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> <20120504144446.GA692@kst-acer> <4FA3EBE8.1000601@gmail.com> <4FA3F321.8090309@gmail.com> <4FA3F409.1050601@gmail.com> Message-ID: <20120504155934.GA1065@kst-acer> On Fri, May 04, 2012 at 04:29:21PM +0100, M?ns Rullg?rd wrote: > Derek Buitenhuis writes: > > > On 04/05/2012 11:19 AM, M?ns Rullg?rd wrote: > >> We have style rules which should be adhered to, even if someone submits > >> a patch in violation. > > > > There is no violation here. > > Such a case is not documented by our style rules. There's nothing bad with making patch slightly more beautiful even if it's not yours. So, Derek, next time think of better reasons why the patch should be left as is. > > You were asked to change it. Please comply. It was merely a nit. From derek.buitenhuis at gmail.com Fri May 4 18:16:13 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Fri, 04 May 2012 12:16:13 -0400 Subject: [libav-devel] [PATCH] zerocodec: check if there is previous frame In-Reply-To: <20120504155934.GA1065@kst-acer> References: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> <20120504144446.GA692@kst-acer> <4FA3EBE8.1000601@gmail.com> <4FA3F321.8090309@gmail.com> <4FA3F409.1050601@gmail.com> <20120504155934.GA1065@kst-acer> Message-ID: <4FA400CD.3010509@gmail.com> On 04/05/2012 11:59 AM, Kostya Shishkov wrote: >>> > > There is no violation here. >>> > > Such a case is not documented by our style rules. > There's nothing bad with making patch slightly more beautiful even if it's not > yours. So, Derek, next time think of better reasons why the patch should be > left as is. My point was, in this case, it's entirely opinion. It's neither documented nor standarduzed. I'll change it, but this seems to be a case of "X's opinion on how this should look is more valid than Y's". >> > You were asked to change it. Please comply. > It was merely a nit. Exactly. - Derek From diego at biurrun.de Fri May 4 18:21:03 2012 From: diego at biurrun.de (Diego Biurrun) Date: Fri, 04 May 2012 18:21:03 +0200 Subject: [libav-devel] [PATCH] zerocodec: check if there is previous frame In-Reply-To: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> References: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> Message-ID: <20120504162103.GB1847@pool.informatik.rwth-aachen.de> On Fri, May 04, 2012 at 10:41:47AM -0400, Derek Buitenhuis wrote: > Fixes crash in bug #1219. No such bug number. Please take care of such things when porting patches. Diego From derek.buitenhuis at gmail.com Fri May 4 18:22:15 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Fri, 04 May 2012 12:22:15 -0400 Subject: [libav-devel] [PATCH] zerocodec: check if there is previous frame In-Reply-To: <20120504162103.GB1847@pool.informatik.rwth-aachen.de> References: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> <20120504162103.GB1847@pool.informatik.rwth-aachen.de> Message-ID: <4FA40237.3070200@gmail.com> I realized that as soon as I sent it. It's been fixed locally. - Derek On 04/05/2012 12:21 PM, Diego Biurrun wrote: > No such bug number. > > Please take care of such things when porting patches. From diego at biurrun.de Fri May 4 18:23:16 2012 From: diego at biurrun.de (Diego Biurrun) Date: Fri, 04 May 2012 18:23:16 +0200 Subject: [libav-devel] [PATCH] zerocodec: check if there is previous frame In-Reply-To: <4FA3F409.1050601@gmail.com> References: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> <20120504144446.GA692@kst-acer> <4FA3EBE8.1000601@gmail.com> <4FA3F321.8090309@gmail.com> <4FA3F409.1050601@gmail.com> Message-ID: <20120504162316.GC1847@pool.informatik.rwth-aachen.de> On Fri, May 04, 2012 at 11:21:45AM -0400, Derek Buitenhuis wrote: > On 04/05/2012 11:19 AM, M?ns Rullg?rd wrote: > > We have style rules which should be adhered to, even if someone submits > > a patch in violation. > > There is no violation here. > Such a case is not documented by our style rules. We do have style rules, traditions might be the more appropriate term, which are not fixed in writing, but passed down orally through the generations. Patches welcome :) Derek From lu_zero at gentoo.org Fri May 4 18:24:09 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Fri, 04 May 2012 09:24:09 -0700 Subject: [libav-devel] [PATCH] rtsp: Add content-type message header parsing In-Reply-To: <1336146631-6353-1-git-send-email-nenjordi@gmail.com> References: <1336146631-6353-1-git-send-email-nenjordi@gmail.com> Message-ID: <4FA402A9.4070601@gentoo.org> On 04/05/12 08:50, Jordi Ortiz wrote: > --- > libavformat/rtsp.c | 3 +++ > libavformat/rtsp.h | 5 +++++ > 2 files changed, 8 insertions(+) > Looks fine. lu -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From diego at biurrun.de Fri May 4 18:25:03 2012 From: diego at biurrun.de (Diego Biurrun) Date: Fri, 04 May 2012 18:25:03 +0200 Subject: [libav-devel] [PATCH 1/2] tests: Mark some file-internal symbols as static. Message-ID: <1336148704-11479-1-git-send-email-diego@biurrun.de> --- tests/rotozoom.c | 14 +++++++------- tests/videogen.c | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/rotozoom.c b/tests/rotozoom.c index 9ce45cd..9bba6e3 100644 --- a/tests/rotozoom.c +++ b/tests/rotozoom.c @@ -160,8 +160,8 @@ static void pgmyuv_save(const char *filename, int w, int h, free(cr_tab); } -unsigned char *rgb_tab; -int width, height, wrap; +static unsigned char *rgb_tab; +static int width, height, wrap; static void put_pixel(int x, int y, int r, int g, int b) { @@ -177,12 +177,12 @@ static void put_pixel(int x, int y, int r, int g, int b) p[2] = b; } -unsigned char tab_r[256 * 256]; -unsigned char tab_g[256 * 256]; -unsigned char tab_b[256 * 256]; +static unsigned char tab_r[256 * 256]; +static unsigned char tab_g[256 * 256]; +static unsigned char tab_b[256 * 256]; -int h_cos[360]; -int h_sin[360]; +static int h_cos[360]; +static int h_sin[360]; static int ipol(uint8_t *src, int x, int y) { diff --git a/tests/videogen.c b/tests/videogen.c index 1aad700..14996da 100644 --- a/tests/videogen.c +++ b/tests/videogen.c @@ -137,8 +137,8 @@ static void pgmyuv_save(const char *filename, int w, int h, free(cr_tab); } -unsigned char *rgb_tab; -int width, height, wrap; +static unsigned char *rgb_tab; +static int width, height, wrap; static void put_pixel(int x, int y, int r, int g, int b) { @@ -200,9 +200,9 @@ typedef struct VObj { int r, g, b; } VObj; -VObj objs[NB_OBJS]; +static VObj objs[NB_OBJS]; -unsigned int seed = 1; +static unsigned int seed = 1; static void gen_image(int num, int w, int h) { -- 1.7.1 From diego at biurrun.de Fri May 4 18:25:04 2012 From: diego at biurrun.de (Diego Biurrun) Date: Fri, 04 May 2012 18:25:04 +0200 Subject: [libav-devel] [PATCH 2/2] tests: Refactor rotozoom/videogen common code into a separate file. In-Reply-To: <1336148704-11479-1-git-send-email-diego@biurrun.de> References: <1336148704-11479-1-git-send-email-diego@biurrun.de> Message-ID: <1336148704-11479-2-git-send-email-diego@biurrun.de> --- tests/rotozoom.c | 126 +---------------------------------------------- tests/utils.c | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/videogen.c | 129 +------------------------------------------------ 3 files changed, 147 insertions(+), 252 deletions(-) create mode 100644 tests/utils.c diff --git a/tests/rotozoom.c b/tests/rotozoom.c index 9bba6e3..48c06b0 100644 --- a/tests/rotozoom.c +++ b/tests/rotozoom.c @@ -24,6 +24,8 @@ #include #include +#include "utils.c" + #define FIXP (1 << 16) #define MY_PI 205887 // (M_PI * FIX) @@ -53,130 +55,6 @@ static int64_t int_sin(int64_t a) return a - int_pow(a, 3) / 6 + int_pow(a, 5) / 120 - int_pow(a, 7) / 5040; } -#define SCALEBITS 8 -#define ONE_HALF (1 << (SCALEBITS - 1)) -#define FIX(x) ((int) ((x) * (1L << SCALEBITS) + 0.5)) - -static void rgb24_to_yuv420p(unsigned char *lum, unsigned char *cb, - unsigned char *cr, unsigned char *src, - int width, int height) -{ - int wrap, wrap3, x, y; - int r, g, b, r1, g1, b1; - unsigned char *p; - - wrap = width; - wrap3 = width * 3; - p = src; - for (y = 0; y < height; y += 2) { - for (x = 0; x < width; x += 2) { - r = p[0]; - g = p[1]; - b = p[2]; - r1 = r; - g1 = g; - b1 = b; - lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g + - FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; - r = p[3]; - g = p[4]; - b = p[5]; - r1 += r; - g1 += g; - b1 += b; - lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g + - FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; - p += wrap3; - lum += wrap; - - r = p[0]; - g = p[1]; - b = p[2]; - r1 += r; - g1 += g; - b1 += b; - lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g + - FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; - r = p[3]; - g = p[4]; - b = p[5]; - r1 += r; - g1 += g; - b1 += b; - lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g + - FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; - - cb[0] = ((- FIX(0.16874) * r1 - FIX(0.33126) * g1 + - FIX(0.50000) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128; - cr[0] = ((FIX(0.50000) * r1 - FIX(0.41869) * g1 - - FIX(0.08131) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128; - - cb++; - cr++; - p += -wrap3 + 2 * 3; - lum += -wrap + 2; - } - p += wrap3; - lum += wrap; - } -} - -/* cif format */ -#define DEFAULT_WIDTH 352 -#define DEFAULT_HEIGHT 288 -#define DEFAULT_NB_PICT 50 - -static void pgmyuv_save(const char *filename, int w, int h, - unsigned char *rgb_tab) -{ - FILE *f; - int i, h2, w2; - unsigned char *cb, *cr; - unsigned char *lum_tab, *cb_tab, *cr_tab; - - lum_tab = malloc(w * h); - cb_tab = malloc(w * h / 4); - cr_tab = malloc(w * h / 4); - - rgb24_to_yuv420p(lum_tab, cb_tab, cr_tab, rgb_tab, w, h); - - f = fopen(filename, "wb"); - fprintf(f, "P5\n%d %d\n%d\n", w, h * 3 / 2, 255); - fwrite(lum_tab, 1, w * h, f); - h2 = h / 2; - w2 = w / 2; - cb = cb_tab; - cr = cr_tab; - for (i = 0; i < h2; i++) { - fwrite(cb, 1, w2, f); - fwrite(cr, 1, w2, f); - cb += w2; - cr += w2; - } - fclose(f); - - free(lum_tab); - free(cb_tab); - free(cr_tab); -} - -static unsigned char *rgb_tab; -static int width, height, wrap; - -static void put_pixel(int x, int y, int r, int g, int b) -{ - unsigned char *p; - - if (x < 0 || x >= width || - y < 0 || y >= height) - return; - - p = rgb_tab + y * wrap + x * 3; - p[0] = r; - p[1] = g; - p[2] = b; -} - static unsigned char tab_r[256 * 256]; static unsigned char tab_g[256 * 256]; static unsigned char tab_b[256 * 256]; diff --git a/tests/utils.c b/tests/utils.c new file mode 100644 index 0000000..2a85bd8 --- /dev/null +++ b/tests/utils.c @@ -0,0 +1,144 @@ +/* + * 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 +#include + +#define SCALEBITS 8 +#define ONE_HALF (1 << (SCALEBITS - 1)) +#define FIX(x) ((int) ((x) * (1L << SCALEBITS) + 0.5)) + +static void rgb24_to_yuv420p(unsigned char *lum, unsigned char *cb, + unsigned char *cr, unsigned char *src, + int width, int height) +{ + int wrap, wrap3, x, y; + int r, g, b, r1, g1, b1; + unsigned char *p; + + wrap = width; + wrap3 = width * 3; + p = src; + for (y = 0; y < height; y += 2) { + for (x = 0; x < width; x += 2) { + r = p[0]; + g = p[1]; + b = p[2]; + r1 = r; + g1 = g; + b1 = b; + lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g + + FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; + r = p[3]; + g = p[4]; + b = p[5]; + r1 += r; + g1 += g; + b1 += b; + lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g + + FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; + p += wrap3; + lum += wrap; + + r = p[0]; + g = p[1]; + b = p[2]; + r1 += r; + g1 += g; + b1 += b; + lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g + + FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; + r = p[3]; + g = p[4]; + b = p[5]; + r1 += r; + g1 += g; + b1 += b; + lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g + + FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; + + cb[0] = ((- FIX(0.16874) * r1 - FIX(0.33126) * g1 + + FIX(0.50000) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128; + cr[0] = ((FIX(0.50000) * r1 - FIX(0.41869) * g1 - + FIX(0.08131) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128; + + cb++; + cr++; + p += -wrap3 + 2 * 3; + lum += -wrap + 2; + } + p += wrap3; + lum += wrap; + } +} + +/* cif format */ +#define DEFAULT_WIDTH 352 +#define DEFAULT_HEIGHT 288 +#define DEFAULT_NB_PICT 50 + +static void pgmyuv_save(const char *filename, int w, int h, + unsigned char *rgb_tab) +{ + FILE *f; + int i, h2, w2; + unsigned char *cb, *cr; + unsigned char *lum_tab, *cb_tab, *cr_tab; + + lum_tab = malloc(w * h); + cb_tab = malloc(w * h / 4); + cr_tab = malloc(w * h / 4); + + rgb24_to_yuv420p(lum_tab, cb_tab, cr_tab, rgb_tab, w, h); + + f = fopen(filename, "wb"); + fprintf(f, "P5\n%d %d\n%d\n", w, h * 3 / 2, 255); + fwrite(lum_tab, 1, w * h, f); + h2 = h / 2; + w2 = w / 2; + cb = cb_tab; + cr = cr_tab; + for (i = 0; i < h2; i++) { + fwrite(cb, 1, w2, f); + fwrite(cr, 1, w2, f); + cb += w2; + cr += w2; + } + fclose(f); + + free(lum_tab); + free(cb_tab); + free(cr_tab); +} + +static unsigned char *rgb_tab; +static int width, height, wrap; + +static void put_pixel(int x, int y, int r, int g, int b) +{ + unsigned char *p; + + if (x < 0 || x >= width || + y < 0 || y >= height) + return; + + p = rgb_tab + y * wrap + x * 3; + p[0] = r; + p[1] = g; + p[2] = b; +} diff --git a/tests/videogen.c b/tests/videogen.c index 14996da..8c3d539 100644 --- a/tests/videogen.c +++ b/tests/videogen.c @@ -25,134 +25,7 @@ #include #include -#define SCALEBITS 8 -#define ONE_HALF (1 << (SCALEBITS - 1)) -#define FIX(x) ((int) ((x) * (1L << SCALEBITS) + 0.5)) - -static void rgb24_to_yuv420p(uint8_t *lum, uint8_t *cb, uint8_t *cr, - uint8_t *src, int width, int height) -{ - int wrap, wrap3, x, y; - int r, g, b, r1, g1, b1; - uint8_t *p; - - wrap = width; - wrap3 = width * 3; - p = src; - for (y = 0; y < height; y += 2) { - for (x = 0; x < width; x += 2) { - r = p[0]; - g = p[1]; - b = p[2]; - r1 = r; - g1 = g; - b1 = b; - lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g + - FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; - r = p[3]; - g = p[4]; - b = p[5]; - r1 += r; - g1 += g; - b1 += b; - lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g + - FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; - p += wrap3; - lum += wrap; - - r = p[0]; - g = p[1]; - b = p[2]; - r1 += r; - g1 += g; - b1 += b; - lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g + - FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; - r = p[3]; - g = p[4]; - b = p[5]; - r1 += r; - g1 += g; - b1 += b; - lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g + - FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; - - cb[0] = 128 + ((- FIX(0.16874) * r1 - - FIX(0.33126) * g1 + - FIX(0.50000) * b1 + - 4 * ONE_HALF - 1) - >> (SCALEBITS + 2)); - cr[0] = 128 + ((FIX(0.50000) * r1 - - FIX(0.41869) * g1 - - FIX(0.08131) * b1 + - 4 * ONE_HALF - 1) - >> (SCALEBITS + 2)); - - cb++; - cr++; - p += -wrap3 + 2 * 3; - lum += -wrap + 2; - } - p += wrap3; - lum += wrap; - } -} - -/* cif format */ -#define DEFAULT_WIDTH 352 -#define DEFAULT_HEIGHT 288 -#define DEFAULT_NB_PICT 50 /* 2 seconds */ - -static void pgmyuv_save(const char *filename, int w, int h, - unsigned char *rgb_tab) -{ - FILE *f; - int i, h2, w2; - unsigned char *cb, *cr; - unsigned char *lum_tab, *cb_tab, *cr_tab; - - lum_tab = malloc(w * h); - cb_tab = malloc((w * h) / 4); - cr_tab = malloc((w * h) / 4); - - rgb24_to_yuv420p(lum_tab, cb_tab, cr_tab, rgb_tab, w, h); - - f = fopen(filename, "wb"); - fprintf(f, "P5\n%d %d\n%d\n", w, (h * 3) / 2, 255); - fwrite(lum_tab, 1, w * h, f); - h2 = h / 2; - w2 = w / 2; - cb = cb_tab; - cr = cr_tab; - for (i = 0; i < h2; i++) { - fwrite(cb, 1, w2, f); - fwrite(cr, 1, w2, f); - cb += w2; - cr += w2; - } - fclose(f); - - free(lum_tab); - free(cb_tab); - free(cr_tab); -} - -static unsigned char *rgb_tab; -static int width, height, wrap; - -static void put_pixel(int x, int y, int r, int g, int b) -{ - unsigned char *p; - - if (x < 0 || x >= width || - y < 0 || y >= height) - return; - - p = rgb_tab + y * wrap + x * 3; - p[0] = r; - p[1] = g; - p[2] = b; -} +#include "utils.c" static unsigned int myrnd(unsigned int *seed_ptr, int n) { -- 1.7.1 From diego at biurrun.de Fri May 4 18:27:50 2012 From: diego at biurrun.de (Diego Biurrun) Date: Fri, 04 May 2012 18:27:50 +0200 Subject: [libav-devel] [PATCH] test programs: don't ignore the return value of fwrite() In-Reply-To: References: <1335395027-16446-1-git-send-email-gseanmcg@gmail.com> <1335466584-7087-1-git-send-email-gseanmcg@gmail.com> Message-ID: <20120504162750.GD1847@pool.informatik.rwth-aachen.de> On Thu, May 03, 2012 at 11:32:24PM -0400, Sean McGovern wrote: > On 4/26/12, Sean McGovern wrote: > > --- > > tests/rotozoom.c | 15 ++++++++++++--- > > tests/videogen.c | 15 ++++++++++++--- > > 2 files changed, 24 insertions(+), 6 deletions(-) > > > > diff --git a/tests/rotozoom.c b/tests/rotozoom.c > > index 9ce45cd..d9cfb42 100644 > > --- a/tests/rotozoom.c > > +++ b/tests/rotozoom.c > > Ping. The patch is good, I could queue it tomorrow. It does, however, conflict with the code duplication refactoring patch I just sent for these programs. Applying your patch on top of mine would be somewhat more elegant and simple. Diego From derek.buitenhuis at gmail.com Fri May 4 18:32:43 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Fri, 4 May 2012 12:32:43 -0400 Subject: [libav-devel] [PATCH v2] zerocodec: check if there is previous frame In-Reply-To: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> References: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> Message-ID: <1336149164-2516-1-git-send-email-derek.buitenhuis@gmail.com> From: Paul B Mahol Signed-off-by: Paul B Mahol --- libavcodec/zerocodec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c index 6c57e05..7a0ba34 100644 --- a/libavcodec/zerocodec.c +++ b/libavcodec/zerocodec.c @@ -65,6 +65,10 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, pic->key_frame = 1; pic->pict_type = AV_PICTURE_TYPE_I; } else { + if (!prev) { + av_log(avctx, AV_LOG_ERROR, "No previous frame!\n"); + return AVERROR_INVALIDDATA; + } pic->key_frame = 0; pic->pict_type = AV_PICTURE_TYPE_P; } -- 1.7.10 From lu_zero at gentoo.org Fri May 4 18:33:50 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Fri, 04 May 2012 09:33:50 -0700 Subject: [libav-devel] [PATCH 3/3] aacps: NEON optimisations In-Reply-To: References: <1331644927-3409-1-git-send-email-mans@mansr.com> <1331644927-3409-3-git-send-email-mans@mansr.com> Message-ID: <4FA404EE.8050209@gentoo.org> On 04/05/12 05:15, M?ns Rullg?rd wrote: > M?ns Rullg?rd writes: > >> Mans Rullgard writes: >> >>> Signed-off-by: Mans Rullgard >>> --- >>> libavcodec/aacpsdsp.c | 3 + >>> libavcodec/aacpsdsp.h | 1 + >>> libavcodec/arm/Makefile | 6 +- >>> libavcodec/arm/aacpsdsp_init_arm.c | 53 +++++++ >>> libavcodec/arm/aacpsdsp_neon.S | 272 ++++++++++++++++++++++++++++++++++++ >>> 5 files changed, 333 insertions(+), 2 deletions(-) >>> create mode 100644 libavcodec/arm/aacpsdsp_init_arm.c >>> create mode 100644 libavcodec/arm/aacpsdsp_neon.S >> >> ping > > ping > Seems ok to me. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From mans at mansr.com Fri May 4 18:35:08 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Fri, 04 May 2012 17:35:08 +0100 Subject: [libav-devel] [PATCH 1/2] tests: Mark some file-internal symbols as static. In-Reply-To: <1336148704-11479-1-git-send-email-diego@biurrun.de> (Diego Biurrun's message of "Fri, 04 May 2012 18:25:03 +0200") References: <1336148704-11479-1-git-send-email-diego@biurrun.de> Message-ID: Diego Biurrun writes: > --- > tests/rotozoom.c | 14 +++++++------- > tests/videogen.c | 8 ++++---- > 2 files changed, 11 insertions(+), 11 deletions(-) LGTM, not that it matters much for internal-only tools like these. -- M?ns Rullg?rd mans at mansr.com From kostya.shishkov at gmail.com Fri May 4 18:37:00 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Fri, 4 May 2012 18:37:00 +0200 Subject: [libav-devel] [PATCH v2] zerocodec: check if there is previous frame In-Reply-To: <1336149164-2516-1-git-send-email-derek.buitenhuis@gmail.com> References: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> <1336149164-2516-1-git-send-email-derek.buitenhuis@gmail.com> Message-ID: <20120504163700.GA1173@kst-acer> On Fri, May 04, 2012 at 12:32:43PM -0400, Derek Buitenhuis wrote: > From: Paul B Mahol > > Signed-off-by: Paul B Mahol > --- > libavcodec/zerocodec.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c > index 6c57e05..7a0ba34 100644 > --- a/libavcodec/zerocodec.c > +++ b/libavcodec/zerocodec.c > @@ -65,6 +65,10 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, > pic->key_frame = 1; > pic->pict_type = AV_PICTURE_TYPE_I; > } else { > + if (!prev) { > + av_log(avctx, AV_LOG_ERROR, "No previous frame!\n"); > + return AVERROR_INVALIDDATA; > + } > pic->key_frame = 0; > pic->pict_type = AV_PICTURE_TYPE_P; > } > -- OK From mans at mansr.com Fri May 4 18:38:31 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Fri, 04 May 2012 17:38:31 +0100 Subject: [libav-devel] [PATCH 2/2] tests: Refactor rotozoom/videogen common code into a separate file. In-Reply-To: <1336148704-11479-2-git-send-email-diego@biurrun.de> (Diego Biurrun's message of "Fri, 04 May 2012 18:25:04 +0200") References: <1336148704-11479-1-git-send-email-diego@biurrun.de> <1336148704-11479-2-git-send-email-diego@biurrun.de> Message-ID: Diego Biurrun writes: > --- > tests/rotozoom.c | 126 +---------------------------------------------- > tests/utils.c | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/videogen.c | 129 +------------------------------------------------ > 3 files changed, 147 insertions(+), 252 deletions(-) > create mode 100644 tests/utils.c > > diff --git a/tests/rotozoom.c b/tests/rotozoom.c > index 9bba6e3..48c06b0 100644 > --- a/tests/rotozoom.c > +++ b/tests/rotozoom.c > @@ -24,6 +24,8 @@ > #include > #include > > +#include "utils.c" The build system doesn't pick up dependencies like this for host tools, so you have to manually declare this in the makefile. Fixing this properly takes a fair amount of effort, and until we have more than a couple of cases where it's needed, it doesn't seem worthwhile. -- M?ns Rullg?rd mans at mansr.com From diego at biurrun.de Fri May 4 18:48:02 2012 From: diego at biurrun.de (Diego Biurrun) Date: Fri, 04 May 2012 18:48:02 +0200 Subject: [libav-devel] [PATCH v2] zerocodec: check if there is previous frame In-Reply-To: <1336149164-2516-1-git-send-email-derek.buitenhuis@gmail.com> References: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> <1336149164-2516-1-git-send-email-derek.buitenhuis@gmail.com> Message-ID: <20120504164801.GE1847@pool.informatik.rwth-aachen.de> On Fri, May 04, 2012 at 12:32:43PM -0400, Derek Buitenhuis wrote: > From: Paul B Mahol .. if there is _a_ previous .. > --- a/libavcodec/zerocodec.c > +++ b/libavcodec/zerocodec.c > @@ -65,6 +65,10 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, > pic->key_frame = 1; > pic->pict_type = AV_PICTURE_TYPE_I; > } else { > + if (!prev) { > + av_log(avctx, AV_LOG_ERROR, "No previous frame!\n"); > + return AVERROR_INVALIDDATA; I admittedly don't know the surrounding code, but the error message does not make much sense to me. Why is the lack of a previous frame an error condition? And when does this happen except on the first frame? Diego From derek.buitenhuis at gmail.com Fri May 4 18:54:30 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Fri, 04 May 2012 12:54:30 -0400 Subject: [libav-devel] [PATCH v2] zerocodec: check if there is previous frame In-Reply-To: <20120504164801.GE1847@pool.informatik.rwth-aachen.de> References: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> <1336149164-2516-1-git-send-email-derek.buitenhuis@gmail.com> <20120504164801.GE1847@pool.informatik.rwth-aachen.de> Message-ID: <4FA409C6.2060003@gmail.com> On 04/05/2012 12:48 PM, Diego Biurrun wrote: > I admittedly don't know the surrounding code, but the error message does > not make much sense to me. Why is the lack of a previous frame an error > condition? And when does this happen except on the first frame? ZeroCodec relies on the keyframe flag being set in the container, and prev is the previously decoded frame. So, e.g., if you have a file with incorrect or missing keyframe flags, this can happen. - Derek From mashiat.sarker at gmail.com Fri May 4 19:02:22 2012 From: mashiat.sarker at gmail.com (Mashiat Sarker Shakkhar) Date: Fri, 04 May 2012 23:02:22 +0600 Subject: [libav-devel] [PATCH v2] zerocodec: check if there is previous frame In-Reply-To: <4FA409C6.2060003@gmail.com> References: <1336142507-1841-1-git-send-email-derek.buitenhuis@gmail.com> <1336149164-2516-1-git-send-email-derek.buitenhuis@gmail.com> <20120504164801.GE1847@pool.informatik.rwth-aachen.de> <4FA409C6.2060003@gmail.com> Message-ID: <4FA40B9E.5070700@gmail.com> On 5/4/2012 10:54 PM, Derek Buitenhuis wrote: > On 04/05/2012 12:48 PM, Diego Biurrun wrote: >> I admittedly don't know the surrounding code, but the error message does >> not make much sense to me. Why is the lack of a previous frame an error >> condition? And when does this happen except on the first frame? > > ZeroCodec relies on the keyframe flag being set in the container, and prev > is the previously decoded frame. So, e.g., if you have a file with incorrect > or missing keyframe flags, this can happen. [...] I am in favor of using a more comprehensive error message here. Just saying ... Shakkhar From gseanmcg at gmail.com Fri May 4 19:03:22 2012 From: gseanmcg at gmail.com (Sean McGovern) Date: Fri, 4 May 2012 13:03:22 -0400 Subject: [libav-devel] [PATCH] test programs: don't ignore the return value of fwrite() In-Reply-To: <20120504162750.GD1847@pool.informatik.rwth-aachen.de> References: <1335395027-16446-1-git-send-email-gseanmcg@gmail.com> <1335466584-7087-1-git-send-email-gseanmcg@gmail.com> <20120504162750.GD1847@pool.informatik.rwth-aachen.de> Message-ID: On Friday, May 4, 2012, Diego Biurrun wrote: > On Thu, May 03, 2012 at 11:32:24PM -0400, Sean McGovern wrote: >> On 4/26/12, Sean McGovern wrote: >> > --- >> > tests/rotozoom.c | 15 ++++++++++++--- >> > tests/videogen.c | 15 ++++++++++++--- >> > 2 files changed, 24 insertions(+), 6 deletions(-) >> > >> > diff --git a/tests/rotozoom.c b/tests/rotozoom.c >> > index 9ce45cd..d9cfb42 100644 >> > --- a/tests/rotozoom.c >> > +++ b/tests/rotozoom.c >> >> Ping. > > The patch is good, I could queue it tomorrow. It does, however, conflict > with the code duplication refactoring patch I just sent for these programs. > > Applying your patch on top of mine would be somewhat more elegant and > simple. Hi Diego, I have no problem with depending on your patch. Do you need me to rebase or can you do that? -- Sean McG. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lu_zero at gentoo.org Fri May 4 19:04:36 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Fri, 4 May 2012 10:04:36 -0700 Subject: [libav-devel] [PATCH] doc: clarify check for NULL pointer style Message-ID: <1336151076-4103-1-git-send-email-lu_zero@gentoo.org> Our code should be terse and clear. --- doc/developer.texi | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/doc/developer.texi b/doc/developer.texi index de64239..5b5e29f 100644 --- a/doc/developer.texi +++ b/doc/developer.texi @@ -73,6 +73,10 @@ const char *avfilter_configuration(void) @} @end example @item +Do not check for NULL values by comparison, @samp{if (p)} and + at samp{if (!p)} is correct; @samp{if (p == NULL)} and @samp{if (p != NULL)} +not. + at item In case of a single-statement if, no curly braces are required: @example if (!pic || !picref) -- 1.7.8.rc1 From alex.converse at gmail.com Fri May 4 19:29:54 2012 From: alex.converse at gmail.com (Alex Converse) Date: Fri, 4 May 2012 10:29:54 -0700 Subject: [libav-devel] [PATCH] celp filters: Do not read earlier than the start of the 'out' vector. Message-ID: <1336152594-29104-1-git-send-email-alex.converse@gmail.com> --- libavcodec/celp_filters.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/libavcodec/celp_filters.c b/libavcodec/celp_filters.c index 25a6744..849cda4 100644 --- a/libavcodec/celp_filters.c +++ b/libavcodec/celp_filters.c @@ -133,9 +133,8 @@ void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs, out2 -= val * old_out2; out3 -= val * old_out3; - old_out3 = out[-5]; - for (i = 5; i <= filter_length; i += 2) { + old_out3 = out[-i]; val = filter_coeffs[i-1]; out0 -= val * old_out3; @@ -154,7 +153,6 @@ void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs, FFSWAP(float, old_out0, old_out2); old_out1 = old_out3; - old_out3 = out[-i-2]; } tmp0 = out0; -- 1.7.7.3 From derek.buitenhuis at gmail.com Fri May 4 19:32:53 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Fri, 04 May 2012 13:32:53 -0400 Subject: [libav-devel] [PATCH] doc: clarify check for NULL pointer style In-Reply-To: <1336151076-4103-1-git-send-email-lu_zero@gentoo.org> References: <1336151076-4103-1-git-send-email-lu_zero@gentoo.org> Message-ID: <4FA412C5.2080100@gmail.com> On 04/05/2012 1:04 PM, Luca Barbato wrote: > + at samp{if (!p)} is correct; @samp{if (p == NULL)} and @samp{if (p != NULL)} s/is/are/ > +not. Missing an 'are' in front? From lu_zero at gentoo.org Fri May 4 19:46:10 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Fri, 04 May 2012 10:46:10 -0700 Subject: [libav-devel] [PATCH] celp filters: Do not read earlier than the start of the 'out' vector. In-Reply-To: <1336152594-29104-1-git-send-email-alex.converse@gmail.com> References: <1336152594-29104-1-git-send-email-alex.converse@gmail.com> Message-ID: <4FA415E2.405@gentoo.org> On 04/05/12 10:29, Alex Converse wrote: > --- Seems fine lu -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Fri May 4 19:54:27 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Fri, 4 May 2012 10:54:27 -0700 Subject: [libav-devel] [PATCH] zerocodec: check if the previous frame is missing In-Reply-To: <4FA409C6.2060003@gmail.com> References: <4FA409C6.2060003@gmail.com> Message-ID: <1336154067-4399-1-git-send-email-lu_zero@gentoo.org> From: Paul B Mahol ZeroCodec relies on the keyframe flag being set in the container, and prev is the previously decoded frame. A keyframe flags incorrectly set will lead to this condition. Signed-off-by: Paul B Mahol Signed-off-by: Luca Barbato --- libavcodec/zerocodec.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c index 6c57e05..7a0ba34 100644 --- a/libavcodec/zerocodec.c +++ b/libavcodec/zerocodec.c @@ -65,6 +65,10 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, pic->key_frame = 1; pic->pict_type = AV_PICTURE_TYPE_I; } else { + if (!prev) { + av_log(avctx, AV_LOG_ERROR, "No previous frame!\n"); + return AVERROR_INVALIDDATA; + } pic->key_frame = 0; pic->pict_type = AV_PICTURE_TYPE_P; } -- 1.7.8.rc1 From mans at mansr.com Fri May 4 19:57:08 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Fri, 04 May 2012 18:57:08 +0100 Subject: [libav-devel] [PATCH] celp filters: Do not read earlier than the start of the 'out' vector. In-Reply-To: <1336152594-29104-1-git-send-email-alex.converse@gmail.com> (Alex Converse's message of "Fri, 4 May 2012 10:29:54 -0700") References: <1336152594-29104-1-git-send-email-alex.converse@gmail.com> Message-ID: Alex Converse writes: > --- > libavcodec/celp_filters.c | 4 +--- > 1 files changed, 1 insertions(+), 3 deletions(-) > > diff --git a/libavcodec/celp_filters.c b/libavcodec/celp_filters.c > index 25a6744..849cda4 100644 > --- a/libavcodec/celp_filters.c > +++ b/libavcodec/celp_filters.c > @@ -133,9 +133,8 @@ void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs, > out2 -= val * old_out2; > out3 -= val * old_out3; > > - old_out3 = out[-5]; > - > for (i = 5; i <= filter_length; i += 2) { > + old_out3 = out[-i]; > val = filter_coeffs[i-1]; > > out0 -= val * old_out3; > @@ -154,7 +153,6 @@ void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs, > > FFSWAP(float, old_out0, old_out2); > old_out1 = old_out3; > - old_out3 = out[-i-2]; > } > > tmp0 = out0; > -- LGTM -- M?ns Rullg?rd mans at mansr.com From lu_zero at gentoo.org Fri May 4 19:59:18 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Fri, 04 May 2012 10:59:18 -0700 Subject: [libav-devel] [PATCH] doc: clarify check for NULL pointer style In-Reply-To: <4FA412C5.2080100@gmail.com> References: <1336151076-4103-1-git-send-email-lu_zero@gentoo.org> <4FA412C5.2080100@gmail.com> Message-ID: <4FA418F6.2010405@gentoo.org> On 04/05/12 10:32, Derek Buitenhuis wrote: > On 04/05/2012 1:04 PM, Luca Barbato wrote: >> + at samp{if (!p)} is correct; @samp{if (p == NULL)} and @samp{if (p != NULL)} > > s/is/are/ > >> +not. > > Missing an 'are' in front? Willing to amend it? lu - still sleepy today apparently... -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From alex.converse at gmail.com Fri May 4 20:00:54 2012 From: alex.converse at gmail.com (Alex Converse) Date: Fri, 4 May 2012 11:00:54 -0700 Subject: [libav-devel] [PATCH] avprobe: allow showing only one container/stream property. In-Reply-To: <1336109926-6645-1-git-send-email-anton@khirnov.net> References: <1336087997-31192-2-git-send-email-alex.converse@gmail.com> <1336109926-6645-1-git-send-email-anton@khirnov.net> Message-ID: On Thu, May 3, 2012 at 10:38 PM, Anton Khirnov wrote: > From: "Ronald S. Bultje" > > This is useful for writing unit tests. > > Signed-off-by: Anton Khirnov > --- > ?avprobe.c ? ? ? ?| ? 68 ++++++++++++++++++++++++++++++++++++++---------------- > ?doc/avprobe.texi | ? ?5 ++++ > ?2 files changed, 53 insertions(+), 20 deletions(-) > LGTM From gseanmcg at gmail.com Fri May 4 20:12:00 2012 From: gseanmcg at gmail.com (Sean McGovern) Date: Fri, 4 May 2012 14:12:00 -0400 Subject: [libav-devel] [PATCH] configure: add POWER[5-7] support In-Reply-To: References: <1335498710-9210-1-git-send-email-gseanmcg@gmail.com> <1335534478-14547-1-git-send-email-gseanmcg@gmail.com> <1335534478-14547-2-git-send-email-gseanmcg@gmail.com> Message-ID: On Friday, May 4, 2012, M?ns Rullg?rd wrote: > Sean McGovern writes: > >> On Friday, May 4, 2012, M?ns Rullg?rd wrote: >>> Sean McGovern writes: >>> >>>> Also merge POWER3 and POWER4 configuration together with the additions. >>>> --- Hi Michael and fellow LibAV developers, It looks like this exposed an internal compiler error in GCC 4.5.3 -- I have opened GCC bug #53233 to track it. The bug report is available at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53233 -- Sean McG. -------------- next part -------------- An HTML attachment was scrubbed... URL: From siretart at gmail.com Fri May 4 21:24:16 2012 From: siretart at gmail.com (Reinhard Tartler) Date: Fri, 4 May 2012 21:24:16 +0200 Subject: [libav-devel] [libav-commits] rv34: set mb_num_left to 0 after finishing a frame In-Reply-To: References: <20120326233928.2C45D5E07B@aruru.libav.org> Message-ID: On Mon, Apr 30, 2012 at 1:22 AM, Ronald S. Bultje wrote: > Hi Reinhard, > > On Sun, Apr 29, 2012 at 12:00 PM, Reinhard Tartler wrote: >> Hi Ronald, >> >> unfortunately, this patch does not apply cleanly to the 0.8 branch. In >> order to have it for 0.8.2, I'd therefore require your assistance with >> this backport. > > Does 0.8 have -mt for rv34? If not, we can ignore this. Yes, 0.8 does have -mt: commit 9472d37d8e137df1e78e973b8b0e0d5607a799d5 Author: Janne Grunau Date: Fri Sep 9 14:26:32 2011 +0200 rv34: frame-level multi-threading Statistics for bourne.rmvb -an -f null 1 thread: 37.12s user 0.03s system 99% cpu 37.174 total 2 threads: 47.63s user 0.24s system 185% cpu 25.807 total 4 threads: 41.21s user 0.30s system 327% cpu 12.674 total >> git contains 9472d37 master release/0.8 -- regards, ? ? Reinhard From rsbultje at gmail.com Fri May 4 21:48:10 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Fri, 4 May 2012 12:48:10 -0700 Subject: [libav-devel] [libav-commits] rv34: set mb_num_left to 0 after finishing a frame In-Reply-To: References: <20120326233928.2C45D5E07B@aruru.libav.org> Message-ID: Hi Reinhard, On Fri, May 4, 2012 at 12:24 PM, Reinhard Tartler wrote: > On Mon, Apr 30, 2012 at 1:22 AM, Ronald S. Bultje wrote: >> Hi Reinhard, >> >> On Sun, Apr 29, 2012 at 12:00 PM, Reinhard Tartler wrote: >>> Hi Ronald, >>> >>> unfortunately, this patch does not apply cleanly to the 0.8 branch. In >>> order to have it for 0.8.2, I'd therefore require your assistance with >>> this backport. >> >> Does 0.8 have -mt for rv34? If not, we can ignore this. > > Yes, 0.8 does have -mt: > > commit 9472d37d8e137df1e78e973b8b0e0d5607a799d5 > Author: Janne Grunau > Date: ? Fri Sep 9 14:26:32 2011 +0200 > > ? ?rv34: frame-level multi-threading > > ? ?Statistics for bourne.rmvb -an -f null > > ? ?1 thread: ?37.12s user 0.03s system ?99% cpu 37.174 total > ? ?2 threads: 47.63s user 0.24s system 185% cpu 25.807 total > ? ?4 threads: 41.21s user 0.30s system 327% cpu 12.674 total > >>> git contains 9472d37 > ?master > ?release/0.8 Eek. OK, poke me over the weekend and I'll backport it. Sorry for that, Ronald From martin at martin.st Fri May 4 21:48:22 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Fri, 4 May 2012 22:48:22 +0300 Subject: [libav-devel] [PATCH 1/2] rtpdec_h264: Add input size checks Message-ID: <1336160903-50388-1-git-send-email-martin@martin.st> From: Ivan Kovtunov This fixes crashes if given too short data packets. --- libavformat/rtpdec_h264.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 32a57d3..9a8f12c 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -173,11 +173,18 @@ static int h264_handle_packet(AVFormatContext *ctx, const uint8_t * buf, int len, int flags) { - uint8_t nal = buf[0]; - uint8_t type = (nal & 0x1f); + uint8_t nal; + uint8_t type; int result= 0; uint8_t start_sequence[] = { 0, 0, 0, 1 }; + if (!len) { + av_log(ctx, AV_LOG_ERROR, "Empty H264 RTP packet\n"); + return -1; + } + nal = buf[0]; + type = nal & 0x1f; + #ifdef DEBUG assert(data); assert(data->cookie == MAGIC_COOKIE); @@ -271,7 +278,7 @@ static int h264_handle_packet(AVFormatContext *ctx, case 28: // FU-A (fragmented nal) buf++; len--; // skip the fu_indicator - { + if (len > 1) { // these are the same as above, we just redo them here for clarity... uint8_t fu_indicator = nal; uint8_t fu_header = *buf; // read the fu_header. @@ -302,6 +309,9 @@ static int h264_handle_packet(AVFormatContext *ctx, av_new_packet(pkt, len); memcpy(pkt->data, buf, len); } + } else { + av_log(ctx, AV_LOG_ERROR, "Too short data for FU-A H264 RTP packet\n"); + result = -1; } break; -- 1.7.9.4 From martin at martin.st Fri May 4 21:48:23 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Fri, 4 May 2012 22:48:23 +0300 Subject: [libav-devel] [PATCH 2/2] rtpdec_h264: Check the available data length before reading In-Reply-To: <1336160903-50388-1-git-send-email-martin@martin.st> References: <1336160903-50388-1-git-send-email-martin@martin.st> Message-ID: <1336160903-50388-2-git-send-email-martin@martin.st> This makes sure the length is checked for STAP-A type packets. --- libavformat/rtpdec_h264.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 9a8f12c..2f17768 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -218,7 +218,7 @@ static int h264_handle_packet(AVFormatContext *ctx, const uint8_t *src= buf; int src_len= len; - do { + while (src_len > 2) { uint16_t nal_size = AV_RB16(src); // this going to be a problem if unaligned (can it be?) // consume the length of the aggregate... @@ -252,7 +252,7 @@ static int h264_handle_packet(AVFormatContext *ctx, if (src_len < 0) av_log(ctx, AV_LOG_ERROR, "Consumed more bytes than we got! (%d)\n", src_len); - } while (src_len > 2); // because there could be rtp padding.. + } if(pass==0) { // now we know the total size of the packet (with the start sequences added) -- 1.7.9.4 From lu_zero at gentoo.org Fri May 4 22:32:30 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Fri, 04 May 2012 13:32:30 -0700 Subject: [libav-devel] [PATCH 1/2] rtpdec_h264: Add input size checks In-Reply-To: <1336160903-50388-1-git-send-email-martin@martin.st> References: <1336160903-50388-1-git-send-email-martin@martin.st> Message-ID: <690f2a29-abfc-4966-8b50-65bc212affed@email.android.com> "Martin Storsj?" wrote: >From: Ivan Kovtunov > >This fixes crashes if given too short data packets. >--- > libavformat/rtpdec_h264.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > >diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c >index 32a57d3..9a8f12c 100644 >--- a/libavformat/rtpdec_h264.c >+++ b/libavformat/rtpdec_h264.c >@@ -173,11 +173,18 @@ static int h264_handle_packet(AVFormatContext >*ctx, > const uint8_t * buf, > int len, int flags) > { >- uint8_t nal = buf[0]; >- uint8_t type = (nal & 0x1f); >+ uint8_t nal; >+ uint8_t type; > int result= 0; > uint8_t start_sequence[] = { 0, 0, 0, 1 }; > >+ if (!len) { >+ av_log(ctx, AV_LOG_ERROR, "Empty H264 RTP packet\n"); >+ return -1; AVERROR >+ } >+ nal = buf[0]; >+ type = nal & 0x1f; >+ > #ifdef DEBUG > assert(data); > assert(data->cookie == MAGIC_COOKIE); >@@ -271,7 +278,7 @@ static int h264_handle_packet(AVFormatContext *ctx, > case 28: // FU-A (fragmented nal) > buf++; > len--; // skip the fu_indicator >- { >+ if (len > 1) { > // these are the same as above, we just redo them here for clarity... > uint8_t fu_indicator = nal; > uint8_t fu_header = *buf; // read the fu_header. >@@ -302,6 +309,9 @@ static int h264_handle_packet(AVFormatContext *ctx, > av_new_packet(pkt, len); > memcpy(pkt->data, buf, len); > } >+ } else { >+ av_log(ctx, AV_LOG_ERROR, "Too short data for FU-A H264 >RTP packet\n"); >+ result = -1; Again The rest is fine. -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. From martin at martin.st Fri May 4 22:40:37 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Fri, 4 May 2012 23:40:37 +0300 Subject: [libav-devel] [PATCH 1/2] rtpdec_h264: Add input size checks In-Reply-To: <690f2a29-abfc-4966-8b50-65bc212affed@email.android.com> References: <690f2a29-abfc-4966-8b50-65bc212affed@email.android.com> Message-ID: <1336164037-50988-1-git-send-email-martin@martin.st> From: Ivan Kovtunov This fixes crashes if given too short data packets. --- libavformat/rtpdec_h264.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 32a57d3..51447f9 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -173,11 +173,18 @@ static int h264_handle_packet(AVFormatContext *ctx, const uint8_t * buf, int len, int flags) { - uint8_t nal = buf[0]; - uint8_t type = (nal & 0x1f); + uint8_t nal; + uint8_t type; int result= 0; uint8_t start_sequence[] = { 0, 0, 0, 1 }; + if (!len) { + av_log(ctx, AV_LOG_ERROR, "Empty H264 RTP packet\n"); + return AVERROR_INVALIDDATA; + } + nal = buf[0]; + type = nal & 0x1f; + #ifdef DEBUG assert(data); assert(data->cookie == MAGIC_COOKIE); @@ -271,7 +278,7 @@ static int h264_handle_packet(AVFormatContext *ctx, case 28: // FU-A (fragmented nal) buf++; len--; // skip the fu_indicator - { + if (len > 1) { // these are the same as above, we just redo them here for clarity... uint8_t fu_indicator = nal; uint8_t fu_header = *buf; // read the fu_header. @@ -302,6 +309,9 @@ static int h264_handle_packet(AVFormatContext *ctx, av_new_packet(pkt, len); memcpy(pkt->data, buf, len); } + } else { + av_log(ctx, AV_LOG_ERROR, "Too short data for FU-A H264 RTP packet\n"); + result = AVERROR_INVALIDDATA; } break; -- 1.7.9.4 From alex.converse at gmail.com Fri May 4 23:01:16 2012 From: alex.converse at gmail.com (Alex Converse) Date: Fri, 4 May 2012 14:01:16 -0700 Subject: [libav-devel] [libav-commits] aacsbr: Add a debug check to sbr_mapping. In-Reply-To: References: <20120323215737.BB6C25E0B0@aruru.libav.org> Message-ID: On Sun, Apr 29, 2012 at 11:58 AM, Reinhard Tartler wrote: > Hi Alex, > > unfortunately, this patch does not apply cleanly to the 0.8 branch. In > order to have it for 0.8.2, I'd therefore require your assistance with > this backport. > This isn't applying cleanly because the reset module for SBR error handling is missing. Since this change is just preventative, we don't actually *need* it on the stable branches. From lu_zero at gentoo.org Fri May 4 23:03:05 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Fri, 04 May 2012 14:03:05 -0700 Subject: [libav-devel] [PATCH 1/2] rtpdec_h264: Add input size checks In-Reply-To: <1336164037-50988-1-git-send-email-martin@martin.st> References: <690f2a29-abfc-4966-8b50-65bc212affed@email.android.com> <1336164037-50988-1-git-send-email-martin@martin.st> Message-ID: <4FA44409.8000703@gentoo.org> On 04/05/12 13:40, Martin Storsj? wrote: > From: Ivan Kovtunov > > This fixes crashes if given too short data packets. > --- Looks fine. lu -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From martin at martin.st Sat May 5 00:06:45 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 01:06:45 +0300 Subject: [libav-devel] [PATCH 01/11] rtpdec_h264: Return proper error codes Message-ID: <1336169215-59789-1-git-send-email-martin@martin.st> --- libavformat/rtpdec_h264.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 8b56ada..f3793f5 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -272,7 +272,7 @@ static int h264_handle_packet(AVFormatContext *ctx, av_log(ctx, AV_LOG_ERROR, "Unhandled type (%d) (See RFC for implementation details\n", type); - result= -1; + result = AVERROR(ENOSYS); break; case 28: // FU-A (fragmented nal) @@ -319,7 +319,7 @@ static int h264_handle_packet(AVFormatContext *ctx, case 31: // undefined default: av_log(ctx, AV_LOG_ERROR, "Undefined type (%d)", type); - result= -1; + result = AVERROR_INVALIDDATA; break; } -- 1.7.9.4 From martin at martin.st Sat May 5 00:06:46 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 01:06:46 +0300 Subject: [libav-devel] [PATCH 02/11] rtpdec_h264: Remove useless memory corruption checks In-Reply-To: <1336169215-59789-1-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> Message-ID: <1336169215-59789-2-git-send-email-martin@martin.st> --- libavformat/rtpdec_h264.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index f3793f5..eb20397 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -53,8 +53,6 @@ RTP/H264 specific private data. */ struct PayloadContext { - unsigned long cookie; ///< sanity check, to make sure we get the pointer we're expecting. - //sdp setup parameters uint8_t profile_idc; ///< from the sdp setup parameters. uint8_t profile_iop; ///< from the sdp setup parameters. @@ -65,9 +63,6 @@ struct PayloadContext { #endif }; -#define MAGIC_COOKIE (0xdeadbeef) ///< Cookie for the extradata; to verify we are what we think we are, and that we haven't been freed. -#define DEAD_COOKIE (0xdeaddead) ///< Cookie for the extradata; once it is freed. - /* ---------------- private code */ static int sdp_parse_fmtp_config_h264(AVStream * stream, PayloadContext * h264_data, @@ -187,7 +182,6 @@ static int h264_handle_packet(AVFormatContext *ctx, #ifdef DEBUG assert(data); - assert(data->cookie == MAGIC_COOKIE); #endif assert(buf); @@ -331,15 +325,7 @@ static int h264_handle_packet(AVFormatContext *ctx, /* ---------------- public code */ static PayloadContext *h264_new_context(void) { - PayloadContext *data = - av_mallocz(sizeof(PayloadContext) + - FF_INPUT_BUFFER_PADDING_SIZE); - - if (data) { - data->cookie = MAGIC_COOKIE; - } - - return data; + return av_mallocz(sizeof(PayloadContext) + FF_INPUT_BUFFER_PADDING_SIZE); } static void h264_free_context(PayloadContext *data) @@ -354,13 +340,6 @@ static void h264_free_context(PayloadContext *data) } #endif - assert(data); - assert(data->cookie == MAGIC_COOKIE); - - // avoid stale pointers (assert) - data->cookie = DEAD_COOKIE; - - // and clear out this... av_free(data); } @@ -376,7 +355,6 @@ static int parse_h264_sdp_line(AVFormatContext *s, int st_index, stream = s->streams[st_index]; codec = stream->codec; - assert(h264_data->cookie == MAGIC_COOKIE); if (av_strstart(p, "framesize:", &p)) { char buf1[50]; -- 1.7.9.4 From martin at martin.st Sat May 5 00:06:47 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 01:06:47 +0300 Subject: [libav-devel] [PATCH 03/11] rtpdec_h264: Remove outdated/useless/incorrect comments In-Reply-To: <1336169215-59789-1-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> Message-ID: <1336169215-59789-3-git-send-email-martin@martin.st> RTCP is handled elsewhere, not in the depacketizer for an individual format. --- libavformat/rtpdec_h264.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index eb20397..d98be07 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -30,10 +30,6 @@ * Single Nal Unit Mode (0), or * Non-Interleaved Mode (1). It currently does not support * Interleaved Mode (2). (This requires implementing STAP-B, MTAP16, MTAP24, FU-B packet types) - * - * @note TODO: - * 1) RTCP sender reports for udp streams are required.. - * */ #include "libavutil/base64.h" @@ -49,21 +45,17 @@ #include "rtpdec.h" #include "rtpdec_formats.h" -/** - RTP/H264 specific private data. -*/ struct PayloadContext { //sdp setup parameters - uint8_t profile_idc; ///< from the sdp setup parameters. - uint8_t profile_iop; ///< from the sdp setup parameters. - uint8_t level_idc; ///< from the sdp setup parameters. - int packetization_mode; ///< from the sdp setup parameters. + uint8_t profile_idc; + uint8_t profile_iop; + uint8_t level_idc; + int packetization_mode; #ifdef DEBUG int packet_types_received[32]; #endif }; -/* ---------------- private code */ static int sdp_parse_fmtp_config_h264(AVStream * stream, PayloadContext * h264_data, char *attr, char *value) @@ -99,7 +91,6 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, buffer[0] = value[4]; buffer[1] = value[5]; level_idc = strtol(buffer, NULL, 16); - // set the parameters... av_log(codec, AV_LOG_DEBUG, "RTP Profile IDC: %x Profile IOP: %x Level: %x\n", profile_idc, profile_iop, level_idc); @@ -136,7 +127,6 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, { if(codec->extradata_size) { - // av_realloc? memcpy(dest, codec->extradata, codec->extradata_size); av_free(codec->extradata); } @@ -213,7 +203,7 @@ static int h264_handle_packet(AVFormatContext *ctx, int src_len= len; while (src_len > 2) { - uint16_t nal_size = AV_RB16(src); // this going to be a problem if unaligned (can it be?) + uint16_t nal_size = AV_RB16(src); // consume the length of the aggregate... src += 2; @@ -275,7 +265,7 @@ static int h264_handle_packet(AVFormatContext *ctx, if (len > 1) { // these are the same as above, we just redo them here for clarity... uint8_t fu_indicator = nal; - uint8_t fu_header = *buf; // read the fu_header. + uint8_t fu_header = *buf; uint8_t start_bit = fu_header >> 7; // uint8_t end_bit = (fu_header & 0x40) >> 6; uint8_t nal_type = (fu_header & 0x1f); @@ -322,7 +312,6 @@ static int h264_handle_packet(AVFormatContext *ctx, return result; } -/* ---------------- public code */ static PayloadContext *h264_new_context(void) { return av_mallocz(sizeof(PayloadContext) + FF_INPUT_BUFFER_PADDING_SIZE); @@ -380,12 +369,9 @@ static int parse_h264_sdp_line(AVFormatContext *s, int st_index, // could use this if we wanted. } - return 0; // keep processing it the normal way... + return 0; } -/** -This is the structure for expanding on the dynamic rtp protocols (makes everything static. yay!) -*/ RTPDynamicProtocolHandler ff_h264_dynamic_handler = { .enc_name = "H264", .codec_type = AVMEDIA_TYPE_VIDEO, -- 1.7.9.4 From martin at martin.st Sat May 5 00:06:48 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 01:06:48 +0300 Subject: [libav-devel] [PATCH 04/11] rtpdec_h264: Remove a useless ifdef In-Reply-To: <1336169215-59789-1-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> Message-ID: <1336169215-59789-4-git-send-email-martin@martin.st> assert is a no-op if DEBUG isn't defined. --- libavformat/rtpdec_h264.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index d98be07..399ca47 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -170,9 +170,7 @@ static int h264_handle_packet(AVFormatContext *ctx, nal = buf[0]; type = nal & 0x1f; -#ifdef DEBUG assert(data); -#endif assert(buf); if (type >= 1 && type <= 23) -- 1.7.9.4 From martin at martin.st Sat May 5 00:06:49 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 01:06:49 +0300 Subject: [libav-devel] [PATCH 05/11] rtpdec_h264: Convert commented out code into setting an unused variable In-Reply-To: <1336169215-59789-1-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> Message-ID: <1336169215-59789-5-git-send-email-martin@martin.st> It is worth keeping instead of removing, in case reading this bit becomes necessary at some later point. --- libavformat/rtpdec_h264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 399ca47..505bc81 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -265,7 +265,7 @@ static int h264_handle_packet(AVFormatContext *ctx, uint8_t fu_indicator = nal; uint8_t fu_header = *buf; uint8_t start_bit = fu_header >> 7; -// uint8_t end_bit = (fu_header & 0x40) >> 6; + uint8_t av_unused end_bit = (fu_header & 0x40) >> 6; uint8_t nal_type = (fu_header & 0x1f); uint8_t reconstructed_nal; -- 1.7.9.4 From martin at martin.st Sat May 5 00:06:50 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 01:06:50 +0300 Subject: [libav-devel] [PATCH 06/11] rtpdec_h264: Clean up comments In-Reply-To: <1336169215-59789-1-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> Message-ID: <1336169215-59789-6-git-send-email-martin@martin.st> Convert C++ comments into C comments, clean up the comment content (remove trailing periods). --- libavformat/rtpdec_h264.c | 87 ++++++++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 40 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 505bc81..a567d3d 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -20,7 +20,7 @@ */ /** -* @file + * @file * @brief H.264 / RTP Code (RFC3984) * @author Ryan Martell * @@ -29,7 +29,8 @@ * This currently supports packetization mode: * Single Nal Unit Mode (0), or * Non-Interleaved Mode (1). It currently does not support - * Interleaved Mode (2). (This requires implementing STAP-B, MTAP16, MTAP24, FU-B packet types) + * Interleaved Mode (2). (This requires implementing STAP-B, MTAP16, MTAP24, + * FU-B packet types) */ #include "libavutil/base64.h" @@ -46,7 +47,7 @@ #include "rtpdec_formats.h" struct PayloadContext { - //sdp setup parameters + /* sdp setup parameters */ uint8_t profile_idc; uint8_t profile_iop; uint8_t level_idc; @@ -68,10 +69,11 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, av_log(codec, AV_LOG_DEBUG, "RTP Packetization Mode: %d\n", atoi(value)); h264_data->packetization_mode = atoi(value); /* - Packetization Mode: - 0 or not present: Single NAL mode (Only nals from 1-23 are allowed) - 1: Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed. - 2: Interleaved Mode: 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A), and 29 (FU-B) are allowed. + * Packetization Mode: + * 0 or not present: Single NAL mode (Only nals from 1-23 are allowed) + * 1: Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed. + * 2: Interleaved Mode: 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A), + * and 29 (FU-B) are allowed. */ if (h264_data->packetization_mode > 1) av_log(codec, AV_LOG_ERROR, @@ -79,7 +81,7 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, } else if (!strcmp(attr, "profile-level-id")) { if (strlen(value) == 6) { char buffer[3]; - // 6 characters=3 bytes, in hex. + /* 6 characters=3 bytes, in hex. */ uint8_t profile_idc; uint8_t profile_iop; uint8_t level_idc; @@ -149,7 +151,7 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, return 0; } -// return 0 on packet, no more left, 1 on packet, 1 on partial packet... +/* return 0 on packet, no more left, 1 on packet, 1 on partial packet */ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, AVStream *st, @@ -173,10 +175,12 @@ static int h264_handle_packet(AVFormatContext *ctx, assert(data); assert(buf); + /* Simplify the case (these are all the nal types used internally by + * the h264 codec). */ if (type >= 1 && type <= 23) - type = 1; // simplify the case. (these are all the nal types used internally by the h264 codec) + type = 1; switch (type) { - case 0: // undefined, but pass them through + case 0: /* undefined, but pass them through */ case 1: av_new_packet(pkt, len+sizeof(start_sequence)); memcpy(pkt->data, start_sequence, sizeof(start_sequence)); @@ -186,11 +190,11 @@ static int h264_handle_packet(AVFormatContext *ctx, #endif break; - case 24: // STAP-A (one packet, multiple nals) - // consume the STAP-A NAL + case 24: /* STAP-A (one packet, multiple nals) */ + /* consume the STAP-A NAL */ buf++; len--; - // first we are going to figure out the total size.... + /* first we are going to figure out the total size */ { int pass= 0; int total_length= 0; @@ -203,16 +207,16 @@ static int h264_handle_packet(AVFormatContext *ctx, while (src_len > 2) { uint16_t nal_size = AV_RB16(src); - // consume the length of the aggregate... + /* consume the length of the aggregate */ src += 2; src_len -= 2; if (nal_size <= src_len) { if(pass==0) { - // counting... + /* counting */ total_length+= sizeof(start_sequence)+nal_size; } else { - // copying + /* copying */ assert(dst); memcpy(dst, start_sequence, sizeof(start_sequence)); dst+= sizeof(start_sequence); @@ -227,7 +231,7 @@ static int h264_handle_packet(AVFormatContext *ctx, "nal size exceeds length: %d %d\n", nal_size, src_len); } - // eat what we handled... + /* eat what we handled */ src += nal_size; src_len -= nal_size; @@ -237,7 +241,8 @@ static int h264_handle_packet(AVFormatContext *ctx, } if(pass==0) { - // now we know the total size of the packet (with the start sequences added) + /* now we know the total size of the packet (with the + * start sequences added) */ av_new_packet(pkt, total_length); dst= pkt->data; } else { @@ -247,21 +252,21 @@ static int h264_handle_packet(AVFormatContext *ctx, } break; - case 25: // STAP-B - case 26: // MTAP-16 - case 27: // MTAP-24 - case 29: // FU-B + case 25: /* STAP-B */ + case 26: /* MTAP-16 */ + case 27: /* MTAP-24 */ + case 29: /* FU-B */ av_log(ctx, AV_LOG_ERROR, "Unhandled type (%d) (See RFC for implementation details\n", type); result = AVERROR(ENOSYS); break; - case 28: // FU-A (fragmented nal) + case 28: /* FU-A (fragmented nal) */ buf++; - len--; // skip the fu_indicator + len--; /* skip the fu_indicator */ if (len > 1) { - // these are the same as above, we just redo them here for clarity... + /* these are the same as above, we just redo them here for clarity */ uint8_t fu_indicator = nal; uint8_t fu_header = *buf; uint8_t start_bit = fu_header >> 7; @@ -269,11 +274,13 @@ static int h264_handle_packet(AVFormatContext *ctx, uint8_t nal_type = (fu_header & 0x1f); uint8_t reconstructed_nal; - // reconstruct this packet's true nal; only the data follows.. - reconstructed_nal = fu_indicator & (0xe0); // the original nal forbidden bit and NRI are stored in this packet's nal; + /* Reconstruct this packet's true nal; only the data follows. */ + /* The original nal forbidden bit and NRI are stored in this + * packet's nal. */ + reconstructed_nal = fu_indicator & (0xe0); reconstructed_nal |= nal_type; - // skip the fu_header... + /* skip the fu_header */ buf++; len--; @@ -282,7 +289,7 @@ static int h264_handle_packet(AVFormatContext *ctx, data->packet_types_received[nal_type]++; #endif if(start_bit) { - // copy in the start sequence, and the reconstructed nal.... + /* copy in the start sequence, and the reconstructed nal */ av_new_packet(pkt, sizeof(start_sequence)+sizeof(nal)+len); memcpy(pkt->data, start_sequence, sizeof(start_sequence)); pkt->data[sizeof(start_sequence)]= reconstructed_nal; @@ -297,8 +304,8 @@ static int h264_handle_packet(AVFormatContext *ctx, } break; - case 30: // undefined - case 31: // undefined + case 30: /* undefined */ + case 31: /* undefined */ default: av_log(ctx, AV_LOG_ERROR, "Undefined type (%d)", type); result = AVERROR_INVALIDDATA; @@ -347,24 +354,24 @@ static int parse_h264_sdp_line(AVFormatContext *s, int st_index, char buf1[50]; char *dst = buf1; - // remove the protocol identifier.. - while (*p && *p == ' ') p++; // strip spaces. - while (*p && *p != ' ') p++; // eat protocol identifier - while (*p && *p == ' ') p++; // strip trailing spaces. + /* remove the protocol identifier */ + while (*p && *p == ' ') p++; /* strip spaces */ + while (*p && *p != ' ') p++; /* eat protocol identifier */ + while (*p && *p == ' ') p++; /* strip trailing spaces. */ while (*p && *p != '-' && (dst - buf1) < sizeof(buf1) - 1) { *dst++ = *p++; } *dst = '\0'; - // a='framesize:96 320-240' - // set our parameters.. + /* a='framesize:96 320-240' */ + /* set our parameters */ codec->width = atoi(buf1); - codec->height = atoi(p + 1); // skip the - + codec->height = atoi(p + 1); /* skip the - */ codec->pix_fmt = PIX_FMT_YUV420P; } else if (av_strstart(p, "fmtp:", &p)) { return ff_parse_fmtp(stream, h264_data, p, sdp_parse_fmtp_config_h264); } else if (av_strstart(p, "cliprect:", &p)) { - // could use this if we wanted. + /* could use this if we wanted. */ } return 0; -- 1.7.9.4 From martin at martin.st Sat May 5 00:06:51 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 01:06:51 +0300 Subject: [libav-devel] [PATCH 07/11] rtpdec_h264: Cosmetic cleanup In-Reply-To: <1336169215-59789-1-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> Message-ID: <1336169215-59789-7-git-send-email-martin@martin.st> Add/fix spacing, split long lines, align assignments where suitable. --- libavformat/rtpdec_h264.c | 105 ++++++++++++++++++++++----------------------- 1 file changed, 52 insertions(+), 53 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index a567d3d..8ce5516 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -57,8 +57,8 @@ struct PayloadContext { #endif }; -static int sdp_parse_fmtp_config_h264(AVStream * stream, - PayloadContext * h264_data, +static int sdp_parse_fmtp_config_h264(AVStream *stream, + PayloadContext *h264_data, char *attr, char *value) { AVCodecContext *codec = stream->codec; @@ -98,12 +98,12 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, profile_idc, profile_iop, level_idc); h264_data->profile_idc = profile_idc; h264_data->profile_iop = profile_iop; - h264_data->level_idc = level_idc; + h264_data->level_idc = level_idc; } - } else if (!strcmp(attr, "sprop-parameter-sets")) { + } else if (!strcmp(attr, "sprop-parameter-sets")) { uint8_t start_sequence[] = { 0, 0, 0, 1 }; - codec->extradata_size= 0; - codec->extradata= NULL; + codec->extradata_size = 0; + codec->extradata = NULL; while (*value) { char base64packet[1024]; @@ -120,49 +120,48 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, if (*value == ',') value++; - packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet)); + packet_size = av_base64_decode(decoded_packet, base64packet, + sizeof(decoded_packet)); if (packet_size > 0) { uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) + - codec->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); - if(dest) - { - if(codec->extradata_size) - { + codec->extradata_size + + FF_INPUT_BUFFER_PADDING_SIZE); + if (dest) { + if (codec->extradata_size) { memcpy(dest, codec->extradata, codec->extradata_size); av_free(codec->extradata); } - memcpy(dest+codec->extradata_size, start_sequence, sizeof(start_sequence)); - memcpy(dest+codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size); - memset(dest+codec->extradata_size+sizeof(start_sequence)+ + memcpy(dest + codec->extradata_size, start_sequence, + sizeof(start_sequence)); + memcpy(dest + codec->extradata_size + sizeof(start_sequence), + decoded_packet, packet_size); + memset(dest + codec->extradata_size + sizeof(start_sequence) + packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); - codec->extradata= dest; - codec->extradata_size+= sizeof(start_sequence)+packet_size; + codec->extradata = dest; + codec->extradata_size += sizeof(start_sequence) + packet_size; } else { - av_log(codec, AV_LOG_ERROR, "Unable to allocate memory for extradata!"); + av_log(codec, AV_LOG_ERROR, + "Unable to allocate memory for extradata!"); return AVERROR(ENOMEM); } } } - av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!", codec->extradata, codec->extradata_size); + av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!", + codec->extradata, codec->extradata_size); } return 0; } /* return 0 on packet, no more left, 1 on packet, 1 on partial packet */ -static int h264_handle_packet(AVFormatContext *ctx, - PayloadContext *data, - AVStream *st, - AVPacket * pkt, - uint32_t * timestamp, - const uint8_t * buf, - int len, int flags) +static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, + AVStream *st, AVPacket *pkt, uint32_t *timestamp, + const uint8_t *buf, int len, int flags) { uint8_t nal; uint8_t type; - int result= 0; + int result = 0; uint8_t start_sequence[] = { 0, 0, 0, 1 }; if (!len) { @@ -182,9 +181,9 @@ static int h264_handle_packet(AVFormatContext *ctx, switch (type) { case 0: /* undefined, but pass them through */ case 1: - av_new_packet(pkt, len+sizeof(start_sequence)); + av_new_packet(pkt, len + sizeof(start_sequence)); memcpy(pkt->data, start_sequence, sizeof(start_sequence)); - memcpy(pkt->data+sizeof(start_sequence), buf, len); + memcpy(pkt->data + sizeof(start_sequence), buf, len); #ifdef DEBUG data->packet_types_received[nal & 0x1f]++; #endif @@ -196,35 +195,35 @@ static int h264_handle_packet(AVFormatContext *ctx, len--; /* first we are going to figure out the total size */ { - int pass= 0; - int total_length= 0; - uint8_t *dst= NULL; + int pass = 0; + int total_length = 0; + uint8_t *dst = NULL; - for(pass= 0; pass<2; pass++) { - const uint8_t *src= buf; - int src_len= len; + for (pass = 0; pass < 2; pass++) { + const uint8_t *src = buf; + int src_len = len; while (src_len > 2) { uint16_t nal_size = AV_RB16(src); /* consume the length of the aggregate */ - src += 2; + src += 2; src_len -= 2; if (nal_size <= src_len) { - if(pass==0) { + if (pass == 0) { /* counting */ - total_length+= sizeof(start_sequence)+nal_size; + total_length += sizeof(start_sequence) + nal_size; } else { /* copying */ assert(dst); memcpy(dst, start_sequence, sizeof(start_sequence)); - dst+= sizeof(start_sequence); + dst += sizeof(start_sequence); memcpy(dst, src, nal_size); #ifdef DEBUG data->packet_types_received[*src & 0x1f]++; #endif - dst+= nal_size; + dst += nal_size; } } else { av_log(ctx, AV_LOG_ERROR, @@ -232,7 +231,7 @@ static int h264_handle_packet(AVFormatContext *ctx, } /* eat what we handled */ - src += nal_size; + src += nal_size; src_len -= nal_size; if (src_len < 0) @@ -240,13 +239,13 @@ static int h264_handle_packet(AVFormatContext *ctx, "Consumed more bytes than we got! (%d)\n", src_len); } - if(pass==0) { + if (pass == 0) { /* now we know the total size of the packet (with the * start sequences added) */ av_new_packet(pkt, total_length); - dst= pkt->data; + dst = pkt->data; } else { - assert(dst-pkt->data==total_length); + assert(dst-pkt->data == total_length); } } } @@ -271,13 +270,13 @@ static int h264_handle_packet(AVFormatContext *ctx, uint8_t fu_header = *buf; uint8_t start_bit = fu_header >> 7; uint8_t av_unused end_bit = (fu_header & 0x40) >> 6; - uint8_t nal_type = (fu_header & 0x1f); + uint8_t nal_type = fu_header & 0x1f; uint8_t reconstructed_nal; /* Reconstruct this packet's true nal; only the data follows. */ /* The original nal forbidden bit and NRI are stored in this * packet's nal. */ - reconstructed_nal = fu_indicator & (0xe0); + reconstructed_nal = fu_indicator & 0xe0; reconstructed_nal |= nal_type; /* skip the fu_header */ @@ -288,12 +287,12 @@ static int h264_handle_packet(AVFormatContext *ctx, if (start_bit) data->packet_types_received[nal_type]++; #endif - if(start_bit) { + if (start_bit) { /* copy in the start sequence, and the reconstructed nal */ - av_new_packet(pkt, sizeof(start_sequence)+sizeof(nal)+len); + av_new_packet(pkt, sizeof(start_sequence) + sizeof(nal) + len); memcpy(pkt->data, start_sequence, sizeof(start_sequence)); - pkt->data[sizeof(start_sequence)]= reconstructed_nal; - memcpy(pkt->data+sizeof(start_sequence)+sizeof(nal), buf, len); + pkt->data[sizeof(start_sequence)] = reconstructed_nal; + memcpy(pkt->data + sizeof(start_sequence) + sizeof(nal), buf, len); } else { av_new_packet(pkt, len); memcpy(pkt->data, buf, len); @@ -365,8 +364,8 @@ static int parse_h264_sdp_line(AVFormatContext *s, int st_index, /* a='framesize:96 320-240' */ /* set our parameters */ - codec->width = atoi(buf1); - codec->height = atoi(p + 1); /* skip the - */ + codec->width = atoi(buf1); + codec->height = atoi(p + 1); /* skip the - */ codec->pix_fmt = PIX_FMT_YUV420P; } else if (av_strstart(p, "fmtp:", &p)) { return ff_parse_fmtp(stream, h264_data, p, sdp_parse_fmtp_config_h264); -- 1.7.9.4 From martin at martin.st Sat May 5 00:06:52 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 01:06:52 +0300 Subject: [libav-devel] [PATCH 08/11] rtpdec_h264: Cleanup debug packet type counting In-Reply-To: <1336169215-59789-1-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> Message-ID: <1336169215-59789-8-git-send-email-martin@martin.st> --- libavformat/rtpdec_h264.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 8ce5516..5abab79 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -57,6 +57,12 @@ struct PayloadContext { #endif }; +#ifdef DEBUG +#define COUNT_NAL_TYPE(data, nal) data->packet_types_received[(nal) & 0x1f]++ +#else +#define COUNT_NAL_TYPE(data, nal) do { } while (0) +#endif + static int sdp_parse_fmtp_config_h264(AVStream *stream, PayloadContext *h264_data, char *attr, char *value) @@ -184,9 +190,7 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, av_new_packet(pkt, len + sizeof(start_sequence)); memcpy(pkt->data, start_sequence, sizeof(start_sequence)); memcpy(pkt->data + sizeof(start_sequence), buf, len); -#ifdef DEBUG - data->packet_types_received[nal & 0x1f]++; -#endif + COUNT_NAL_TYPE(data, nal); break; case 24: /* STAP-A (one packet, multiple nals) */ @@ -220,9 +224,7 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, memcpy(dst, start_sequence, sizeof(start_sequence)); dst += sizeof(start_sequence); memcpy(dst, src, nal_size); -#ifdef DEBUG - data->packet_types_received[*src & 0x1f]++; -#endif + COUNT_NAL_TYPE(data, *src); dst += nal_size; } } else { @@ -283,10 +285,8 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, buf++; len--; -#ifdef DEBUG if (start_bit) - data->packet_types_received[nal_type]++; -#endif + COUNT_NAL_TYPE(data, nal_type); if (start_bit) { /* copy in the start sequence, and the reconstructed nal */ av_new_packet(pkt, sizeof(start_sequence) + sizeof(nal) + len); -- 1.7.9.4 From martin at martin.st Sat May 5 00:06:53 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 01:06:53 +0300 Subject: [libav-devel] [PATCH 09/11] rtpdec_h264: Make start_sequence a static const array In-Reply-To: <1336169215-59789-1-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> Message-ID: <1336169215-59789-9-git-send-email-martin@martin.st> --- libavformat/rtpdec_h264.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 5abab79..1021d02 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -63,6 +63,8 @@ struct PayloadContext { #define COUNT_NAL_TYPE(data, nal) do { } while (0) #endif +static const uint8_t start_sequence[] = { 0, 0, 0, 1 }; + static int sdp_parse_fmtp_config_h264(AVStream *stream, PayloadContext *h264_data, char *attr, char *value) @@ -107,7 +109,6 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream, h264_data->level_idc = level_idc; } } else if (!strcmp(attr, "sprop-parameter-sets")) { - uint8_t start_sequence[] = { 0, 0, 0, 1 }; codec->extradata_size = 0; codec->extradata = NULL; @@ -168,7 +169,6 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, uint8_t nal; uint8_t type; int result = 0; - uint8_t start_sequence[] = { 0, 0, 0, 1 }; if (!len) { av_log(ctx, AV_LOG_ERROR, "Empty H264 RTP packet\n"); -- 1.7.9.4 From martin at martin.st Sat May 5 00:06:54 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 01:06:54 +0300 Subject: [libav-devel] [PATCH 10/11] rtpdec_h264: Replace sizeof(start_sequence) with a macro In-Reply-To: <1336169215-59789-1-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> Message-ID: <1336169215-59789-10-git-send-email-martin@martin.st> This makes the code slightly more readable at places where this is used a lot, although I guess this is very subjective. --- libavformat/rtpdec_h264.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 1021d02..5ff03ee 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -64,6 +64,7 @@ struct PayloadContext { #endif static const uint8_t start_sequence[] = { 0, 0, 0, 1 }; +#define START_SEQ_SIZE sizeof(start_sequence) static int sdp_parse_fmtp_config_h264(AVStream *stream, PayloadContext *h264_data, @@ -130,7 +131,7 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream, packet_size = av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet)); if (packet_size > 0) { - uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) + + uint8_t *dest = av_malloc(packet_size + START_SEQ_SIZE + codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (dest) { @@ -140,14 +141,14 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream, } memcpy(dest + codec->extradata_size, start_sequence, - sizeof(start_sequence)); - memcpy(dest + codec->extradata_size + sizeof(start_sequence), + START_SEQ_SIZE); + memcpy(dest + codec->extradata_size + START_SEQ_SIZE, decoded_packet, packet_size); - memset(dest + codec->extradata_size + sizeof(start_sequence) + + memset(dest + codec->extradata_size + START_SEQ_SIZE + packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); codec->extradata = dest; - codec->extradata_size += sizeof(start_sequence) + packet_size; + codec->extradata_size += START_SEQ_SIZE + packet_size; } else { av_log(codec, AV_LOG_ERROR, "Unable to allocate memory for extradata!"); @@ -187,9 +188,9 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, switch (type) { case 0: /* undefined, but pass them through */ case 1: - av_new_packet(pkt, len + sizeof(start_sequence)); - memcpy(pkt->data, start_sequence, sizeof(start_sequence)); - memcpy(pkt->data + sizeof(start_sequence), buf, len); + av_new_packet(pkt, len + START_SEQ_SIZE); + memcpy(pkt->data, start_sequence, START_SEQ_SIZE); + memcpy(pkt->data + START_SEQ_SIZE, buf, len); COUNT_NAL_TYPE(data, nal); break; @@ -217,12 +218,12 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, if (nal_size <= src_len) { if (pass == 0) { /* counting */ - total_length += sizeof(start_sequence) + nal_size; + total_length += START_SEQ_SIZE + nal_size; } else { /* copying */ assert(dst); - memcpy(dst, start_sequence, sizeof(start_sequence)); - dst += sizeof(start_sequence); + memcpy(dst, start_sequence, START_SEQ_SIZE); + dst += START_SEQ_SIZE; memcpy(dst, src, nal_size); COUNT_NAL_TYPE(data, *src); dst += nal_size; @@ -289,10 +290,10 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, COUNT_NAL_TYPE(data, nal_type); if (start_bit) { /* copy in the start sequence, and the reconstructed nal */ - av_new_packet(pkt, sizeof(start_sequence) + sizeof(nal) + len); - memcpy(pkt->data, start_sequence, sizeof(start_sequence)); - pkt->data[sizeof(start_sequence)] = reconstructed_nal; - memcpy(pkt->data + sizeof(start_sequence) + sizeof(nal), buf, len); + av_new_packet(pkt, START_SEQ_SIZE + sizeof(nal) + len); + memcpy(pkt->data, start_sequence, START_SEQ_SIZE); + pkt->data[START_SEQ_SIZE] = reconstructed_nal; + memcpy(pkt->data + START_SEQ_SIZE + sizeof(nal), buf, len); } else { av_new_packet(pkt, len); memcpy(pkt->data, buf, len); -- 1.7.9.4 From martin at martin.st Sat May 5 00:06:55 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 01:06:55 +0300 Subject: [libav-devel] [PATCH 11/11] rtpdec_h264: Reorder code blocks In-Reply-To: <1336169215-59789-1-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> Message-ID: <1336169215-59789-11-git-send-email-martin@martin.st> This removes one level of indentation. --- libavformat/rtpdec_h264.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 5ff03ee..f2dd06c 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -134,26 +134,25 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream, uint8_t *dest = av_malloc(packet_size + START_SEQ_SIZE + codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - if (dest) { - if (codec->extradata_size) { - memcpy(dest, codec->extradata, codec->extradata_size); - av_free(codec->extradata); - } - - memcpy(dest + codec->extradata_size, start_sequence, - START_SEQ_SIZE); - memcpy(dest + codec->extradata_size + START_SEQ_SIZE, - decoded_packet, packet_size); - memset(dest + codec->extradata_size + START_SEQ_SIZE + - packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); - - codec->extradata = dest; - codec->extradata_size += START_SEQ_SIZE + packet_size; - } else { + if (!dest) { av_log(codec, AV_LOG_ERROR, "Unable to allocate memory for extradata!"); return AVERROR(ENOMEM); } + if (codec->extradata_size) { + memcpy(dest, codec->extradata, codec->extradata_size); + av_free(codec->extradata); + } + + memcpy(dest + codec->extradata_size, start_sequence, + START_SEQ_SIZE); + memcpy(dest + codec->extradata_size + START_SEQ_SIZE, + decoded_packet, packet_size); + memset(dest + codec->extradata_size + START_SEQ_SIZE + + packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + + codec->extradata = dest; + codec->extradata_size += START_SEQ_SIZE + packet_size; } } av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!", -- 1.7.9.4 From alex.converse at gmail.com Sat May 5 00:15:13 2012 From: alex.converse at gmail.com (Alex Converse) Date: Fri, 4 May 2012 15:15:13 -0700 Subject: [libav-devel] [PATCH 06/11] rtpdec_h264: Clean up comments In-Reply-To: <1336169215-59789-6-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> <1336169215-59789-6-git-send-email-martin@martin.st> Message-ID: On Fri, May 4, 2012 at 3:06 PM, Martin Storsj? wrote: > Convert C++ comments into C comments, clean up the comment > content (remove trailing periods). Whats wrong with c99 comments? > --- > ?libavformat/rtpdec_h264.c | ? 87 ++++++++++++++++++++++++--------------------- > ?1 file changed, 47 insertions(+), 40 deletions(-) > > diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c > index 505bc81..a567d3d 100644 > --- a/libavformat/rtpdec_h264.c > +++ b/libavformat/rtpdec_h264.c > @@ -20,7 +20,7 @@ > ?*/ > > ?/** > -* @file > + * @file > ?* @brief H.264 / RTP Code (RFC3984) > ?* @author Ryan Martell > ?* > @@ -29,7 +29,8 @@ > ?* This currently supports packetization mode: > ?* Single Nal Unit Mode (0), or > ?* Non-Interleaved Mode (1). ?It currently does not support > - * Interleaved Mode (2). (This requires implementing STAP-B, MTAP16, MTAP24, FU-B packet types) > + * Interleaved Mode (2). (This requires implementing STAP-B, MTAP16, MTAP24, > + * ? ? ? ? ? ? ? ? ? ? ? ?FU-B packet types) > ?*/ > > ?#include "libavutil/base64.h" > @@ -46,7 +47,7 @@ > ?#include "rtpdec_formats.h" > > ?struct PayloadContext { > - ? ?//sdp setup parameters > + ? ?/* sdp setup parameters */ > ? ? uint8_t profile_idc; > ? ? uint8_t profile_iop; > ? ? uint8_t level_idc; > @@ -68,10 +69,11 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, > ? ? ? ? av_log(codec, AV_LOG_DEBUG, "RTP Packetization Mode: %d\n", atoi(value)); > ? ? ? ? h264_data->packetization_mode = atoi(value); > ? ? ? ? /* > - ? ? ? ? ? Packetization Mode: > - ? ? ? ? ? 0 or not present: Single NAL mode (Only nals from 1-23 are allowed) > - ? ? ? ? ? 1: Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed. > - ? ? ? ? ? 2: Interleaved Mode: 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A), and 29 (FU-B) are allowed. > + ? ? ? ? * Packetization Mode: > + ? ? ? ? * 0 or not present: Single NAL mode (Only nals from 1-23 are allowed) > + ? ? ? ? * 1: Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed. > + ? ? ? ? * 2: Interleaved Mode: 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A), > + ? ? ? ? * ? ? ? ? ? ? ? ? ? ? ?and 29 (FU-B) are allowed. > ? ? ? ? ?*/ This isn't doxy, why the extra *s? > ? ? ? ? if (h264_data->packetization_mode > 1) > ? ? ? ? ? ? av_log(codec, AV_LOG_ERROR, > @@ -79,7 +81,7 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, > ? ? } else if (!strcmp(attr, "profile-level-id")) { > ? ? ? ? if (strlen(value) == 6) { > ? ? ? ? ? ? char buffer[3]; > - ? ? ? ? ? ?// 6 characters=3 bytes, in hex. > + ? ? ? ? ? ?/* 6 characters=3 bytes, in hex. */ > ? ? ? ? ? ? uint8_t profile_idc; > ? ? ? ? ? ? uint8_t profile_iop; > ? ? ? ? ? ? uint8_t level_idc; > @@ -149,7 +151,7 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, > ? ? return 0; > ?} > > -// return 0 on packet, no more left, 1 on packet, 1 on partial packet... > +/* return 0 on packet, no more left, 1 on packet, 1 on partial packet */ > ?static int h264_handle_packet(AVFormatContext *ctx, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? PayloadContext *data, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? AVStream *st, > @@ -173,10 +175,12 @@ static int h264_handle_packet(AVFormatContext *ctx, > ? ? assert(data); > ? ? assert(buf); > > + ? ?/* Simplify the case (these are all the nal types used internally by > + ? ? * the h264 codec). */ > ? ? if (type >= 1 && type <= 23) > - ? ? ? ?type = 1; ? ? ? ? ? ? ?// simplify the case. (these are all the nal types used internally by the h264 codec) > + ? ? ? ?type = 1; > ? ? switch (type) { > - ? ?case 0: ? ? ? ? ? ? ? ? ? ?// undefined, but pass them through > + ? ?case 0: ? ? ? ? ? ? ? ? ? ?/* undefined, but pass them through */ > ? ? case 1: > ? ? ? ? av_new_packet(pkt, len+sizeof(start_sequence)); > ? ? ? ? memcpy(pkt->data, start_sequence, sizeof(start_sequence)); > @@ -186,11 +190,11 @@ static int h264_handle_packet(AVFormatContext *ctx, > ?#endif > ? ? ? ? break; > > - ? ?case 24: ? ? ? ? ? ? ? ? ? // STAP-A (one packet, multiple nals) > - ? ? ? ?// consume the STAP-A NAL > + ? ?case 24: ? ? ? ? ? ? ? ? ? /* STAP-A (one packet, multiple nals) */ > + ? ? ? ?/* consume the STAP-A NAL */ > ? ? ? ? buf++; > ? ? ? ? len--; > - ? ? ? ?// first we are going to figure out the total size.... > + ? ? ? ?/* first we are going to figure out the total size */ > ? ? ? ? { > ? ? ? ? ? ? int pass= 0; > ? ? ? ? ? ? int total_length= 0; > @@ -203,16 +207,16 @@ static int h264_handle_packet(AVFormatContext *ctx, > ? ? ? ? ? ? ? ? while (src_len > 2) { > ? ? ? ? ? ? ? ? ? ? uint16_t nal_size = AV_RB16(src); > > - ? ? ? ? ? ? ? ? ? ?// consume the length of the aggregate... > + ? ? ? ? ? ? ? ? ? ?/* consume the length of the aggregate */ > ? ? ? ? ? ? ? ? ? ? src += 2; > ? ? ? ? ? ? ? ? ? ? src_len -= 2; > > ? ? ? ? ? ? ? ? ? ? if (nal_size <= src_len) { > ? ? ? ? ? ? ? ? ? ? ? ? if(pass==0) { > - ? ? ? ? ? ? ? ? ? ? ? ? ? ?// counting... > + ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* counting */ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? total_length+= sizeof(start_sequence)+nal_size; > ? ? ? ? ? ? ? ? ? ? ? ? } else { > - ? ? ? ? ? ? ? ? ? ? ? ? ? ?// copying > + ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* copying */ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? assert(dst); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? memcpy(dst, start_sequence, sizeof(start_sequence)); > ? ? ? ? ? ? ? ? ? ? ? ? ? ? dst+= sizeof(start_sequence); > @@ -227,7 +231,7 @@ static int h264_handle_packet(AVFormatContext *ctx, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"nal size exceeds length: %d %d\n", nal_size, src_len); > ? ? ? ? ? ? ? ? ? ? } > > - ? ? ? ? ? ? ? ? ? ?// eat what we handled... > + ? ? ? ? ? ? ? ? ? ?/* eat what we handled */ > ? ? ? ? ? ? ? ? ? ? src += nal_size; > ? ? ? ? ? ? ? ? ? ? src_len -= nal_size; > > @@ -237,7 +241,8 @@ static int h264_handle_packet(AVFormatContext *ctx, > ? ? ? ? ? ? ? ? } > > ? ? ? ? ? ? ? ? if(pass==0) { > - ? ? ? ? ? ? ? ? ? ?// now we know the total size of the packet (with the start sequences added) > + ? ? ? ? ? ? ? ? ? ?/* now we know the total size of the packet (with the > + ? ? ? ? ? ? ? ? ? ? * start sequences added) */ > ? ? ? ? ? ? ? ? ? ? av_new_packet(pkt, total_length); > ? ? ? ? ? ? ? ? ? ? dst= pkt->data; > ? ? ? ? ? ? ? ? } else { > @@ -247,21 +252,21 @@ static int h264_handle_packet(AVFormatContext *ctx, > ? ? ? ? } > ? ? ? ? break; > > - ? ?case 25: ? ? ? ? ? ? ? ? ? // STAP-B > - ? ?case 26: ? ? ? ? ? ? ? ? ? // MTAP-16 > - ? ?case 27: ? ? ? ? ? ? ? ? ? // MTAP-24 > - ? ?case 29: ? ? ? ? ? ? ? ? ? // FU-B > + ? ?case 25: ? ? ? ? ? ? ? ? ? /* STAP-B ?*/ > + ? ?case 26: ? ? ? ? ? ? ? ? ? /* MTAP-16 */ > + ? ?case 27: ? ? ? ? ? ? ? ? ? /* MTAP-24 */ > + ? ?case 29: ? ? ? ? ? ? ? ? ? /* FU-B ? ?*/ > ? ? ? ? av_log(ctx, AV_LOG_ERROR, > ? ? ? ? ? ? ? ?"Unhandled type (%d) (See RFC for implementation details\n", > ? ? ? ? ? ? ? ?type); > ? ? ? ? result = AVERROR(ENOSYS); > ? ? ? ? break; > > - ? ?case 28: ? ? ? ? ? ? ? ? ? // FU-A (fragmented nal) > + ? ?case 28: ? ? ? ? ? ? ? ? ? /* FU-A (fragmented nal) */ > ? ? ? ? buf++; > - ? ? ? ?len--; ? ? ? ? ? ? ? ? ?// skip the fu_indicator > + ? ? ? ?len--; ? ? ? ? ? ? ? ? /* skip the fu_indicator */ > ? ? ? ? if (len > 1) { > - ? ? ? ? ? ?// these are the same as above, we just redo them here for clarity... > + ? ? ? ? ? ?/* these are the same as above, we just redo them here for clarity */ > ? ? ? ? ? ? uint8_t fu_indicator = nal; > ? ? ? ? ? ? uint8_t fu_header = *buf; > ? ? ? ? ? ? uint8_t start_bit = fu_header >> 7; > @@ -269,11 +274,13 @@ static int h264_handle_packet(AVFormatContext *ctx, > ? ? ? ? ? ? uint8_t nal_type = (fu_header & 0x1f); > ? ? ? ? ? ? uint8_t reconstructed_nal; > > - ? ? ? ? ? ?// reconstruct this packet's true nal; only the data follows.. > - ? ? ? ? ? ?reconstructed_nal = fu_indicator & (0xe0); ?// the original nal forbidden bit and NRI are stored in this packet's nal; > + ? ? ? ? ? ?/* Reconstruct this packet's true nal; only the data follows. */ > + ? ? ? ? ? ?/* The original nal forbidden bit and NRI are stored in this > + ? ? ? ? ? ? * packet's nal. */ > + ? ? ? ? ? ?reconstructed_nal = fu_indicator & (0xe0); > ? ? ? ? ? ? reconstructed_nal |= nal_type; > > - ? ? ? ? ? ?// skip the fu_header... > + ? ? ? ? ? ?/* skip the fu_header */ > ? ? ? ? ? ? buf++; > ? ? ? ? ? ? len--; > > @@ -282,7 +289,7 @@ static int h264_handle_packet(AVFormatContext *ctx, > ? ? ? ? ? ? ? ? data->packet_types_received[nal_type]++; > ?#endif > ? ? ? ? ? ? if(start_bit) { > - ? ? ? ? ? ? ? ?// copy in the start sequence, and the reconstructed nal.... > + ? ? ? ? ? ? ? ?/* copy in the start sequence, and the reconstructed nal */ > ? ? ? ? ? ? ? ? av_new_packet(pkt, sizeof(start_sequence)+sizeof(nal)+len); > ? ? ? ? ? ? ? ? memcpy(pkt->data, start_sequence, sizeof(start_sequence)); > ? ? ? ? ? ? ? ? pkt->data[sizeof(start_sequence)]= reconstructed_nal; > @@ -297,8 +304,8 @@ static int h264_handle_packet(AVFormatContext *ctx, > ? ? ? ? } > ? ? ? ? break; > > - ? ?case 30: ? ? ? ? ? ? ? ? ? // undefined > - ? ?case 31: ? ? ? ? ? ? ? ? ? // undefined > + ? ?case 30: ? ? ? ? ? ? ? ? ? /* undefined */ > + ? ?case 31: ? ? ? ? ? ? ? ? ? /* undefined */ > ? ? default: > ? ? ? ? av_log(ctx, AV_LOG_ERROR, "Undefined type (%d)", type); > ? ? ? ? result = AVERROR_INVALIDDATA; > @@ -347,24 +354,24 @@ static int parse_h264_sdp_line(AVFormatContext *s, int st_index, > ? ? ? ? char buf1[50]; > ? ? ? ? char *dst = buf1; > > - ? ? ? ?// remove the protocol identifier.. > - ? ? ? ?while (*p && *p == ' ') p++; // strip spaces. > - ? ? ? ?while (*p && *p != ' ') p++; // eat protocol identifier > - ? ? ? ?while (*p && *p == ' ') p++; // strip trailing spaces. > + ? ? ? ?/* remove the protocol identifier */ > + ? ? ? ?while (*p && *p == ' ') p++; /* strip spaces */ > + ? ? ? ?while (*p && *p != ' ') p++; /* eat protocol identifier */ > + ? ? ? ?while (*p && *p == ' ') p++; /* strip trailing spaces. */ > ? ? ? ? while (*p && *p != '-' && (dst - buf1) < sizeof(buf1) - 1) { > ? ? ? ? ? ? *dst++ = *p++; > ? ? ? ? } > ? ? ? ? *dst = '\0'; > > - ? ? ? ?// a='framesize:96 320-240' > - ? ? ? ?// set our parameters.. > + ? ? ? ?/* a='framesize:96 320-240' */ > + ? ? ? ?/* set our parameters */ > ? ? ? ? codec->width = atoi(buf1); > - ? ? ? ?codec->height = atoi(p + 1); // skip the - > + ? ? ? ?codec->height = atoi(p + 1); /* skip the - */ > ? ? ? ? codec->pix_fmt = PIX_FMT_YUV420P; > ? ? } else if (av_strstart(p, "fmtp:", &p)) { > ? ? ? ? return ff_parse_fmtp(stream, h264_data, p, sdp_parse_fmtp_config_h264); > ? ? } else if (av_strstart(p, "cliprect:", &p)) { > - ? ? ? ?// could use this if we wanted. > + ? ? ? ?/* could use this if we wanted. */ > ? ? } > > ? ? return 0; > -- > 1.7.9.4 > From martin at martin.st Sat May 5 00:21:28 2012 From: martin at martin.st (=?ISO-8859-15?Q?Martin_Storsj=F6?=) Date: Sat, 5 May 2012 01:21:28 +0300 (EEST) Subject: [libav-devel] [PATCH 06/11] rtpdec_h264: Clean up comments In-Reply-To: References: <1336169215-59789-1-git-send-email-martin@martin.st> <1336169215-59789-6-git-send-email-martin@martin.st> Message-ID: On Fri, 4 May 2012, Alex Converse wrote: > On Fri, May 4, 2012 at 3:06 PM, Martin Storsj? wrote: >> Convert C++ comments into C comments, clean up the comment >> content (remove trailing periods). > > Whats wrong with c99 comments? Hmm, I thought some of our coding style guidelines preferred C style comments, but after looking at other common code, there's quite a bit of C99/C++ style comments around too, so I guess I can keep it in that style here, too. >> --- >> ?libavformat/rtpdec_h264.c | ? 87 ++++++++++++++++++++++++--------------------- >> ?1 file changed, 47 insertions(+), 40 deletions(-) >> >> diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c >> index 505bc81..a567d3d 100644 >> --- a/libavformat/rtpdec_h264.c >> +++ b/libavformat/rtpdec_h264.c >> @@ -20,7 +20,7 @@ >> ?*/ >> >> ?/** >> -* @file >> + * @file >> ?* @brief H.264 / RTP Code (RFC3984) >> ?* @author Ryan Martell >> ?* >> @@ -29,7 +29,8 @@ >> ?* This currently supports packetization mode: >> ?* Single Nal Unit Mode (0), or >> ?* Non-Interleaved Mode (1). ?It currently does not support >> - * Interleaved Mode (2). (This requires implementing STAP-B, MTAP16, MTAP24, FU-B packet types) >> + * Interleaved Mode (2). (This requires implementing STAP-B, MTAP16, MTAP24, >> + * ? ? ? ? ? ? ? ? ? ? ? ?FU-B packet types) >> ?*/ >> >> ?#include "libavutil/base64.h" >> @@ -46,7 +47,7 @@ >> ?#include "rtpdec_formats.h" >> >> ?struct PayloadContext { >> - ? ?//sdp setup parameters >> + ? ?/* sdp setup parameters */ >> ? ? uint8_t profile_idc; >> ? ? uint8_t profile_iop; >> ? ? uint8_t level_idc; >> @@ -68,10 +69,11 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, >> ? ? ? ? av_log(codec, AV_LOG_DEBUG, "RTP Packetization Mode: %d\n", atoi(value)); >> ? ? ? ? h264_data->packetization_mode = atoi(value); >> ? ? ? ? /* >> - ? ? ? ? ? Packetization Mode: >> - ? ? ? ? ? 0 or not present: Single NAL mode (Only nals from 1-23 are allowed) >> - ? ? ? ? ? 1: Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed. >> - ? ? ? ? ? 2: Interleaved Mode: 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A), and 29 (FU-B) are allowed. >> + ? ? ? ? * Packetization Mode: >> + ? ? ? ? * 0 or not present: Single NAL mode (Only nals from 1-23 are allowed) >> + ? ? ? ? * 1: Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed. >> + ? ? ? ? * 2: Interleaved Mode: 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A), >> + ? ? ? ? * ? ? ? ? ? ? ? ? ? ? ?and 29 (FU-B) are allowed. >> ? ? ? ? ?*/ > > This isn't doxy, why the extra *s? I prefer it this way, and I think this is the common style. // Martin From rsbultje at gmail.com Sat May 5 01:07:29 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Fri, 4 May 2012 16:07:29 -0700 Subject: [libav-devel] [PATCH] qdm2: clip array indices returned by qdm2_get_vlc(). In-Reply-To: <1335978766-85523-1-git-send-email-rsbultje@gmail.com> References: <1333047654-49291-1-git-send-email-rsbultje@gmail.com> <1335978766-85523-1-git-send-email-rsbultje@gmail.com> Message-ID: Hi, On Wed, May 2, 2012 at 10:12 AM, Ronald S. Bultje wrote: > From: "Ronald S. Bultje" > > Prevents subsequent overreads when these numbers are used as indices > in arrays. > > Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind > CC: libav-stable at libav.org > --- > ?libavcodec/qdm2.c | ? 18 +++++++++++++----- > ?1 file changed, 13 insertions(+), 5 deletions(-) Ping, Benjamin? Ronald From lu_zero at gentoo.org Sat May 5 01:57:09 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Fri, 04 May 2012 16:57:09 -0700 Subject: [libav-devel] [PATCH 01/11] rtpdec_h264: Return proper error codes In-Reply-To: <1336169215-59789-1-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> Message-ID: <4FA46CD5.3000303@gentoo.org> On 04/05/12 15:06, Martin Storsj? wrote: > --- > libavformat/rtpdec_h264.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > Ok -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sat May 5 01:57:34 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Fri, 04 May 2012 16:57:34 -0700 Subject: [libav-devel] [PATCH 02/11] rtpdec_h264: Remove useless memory corruption checks In-Reply-To: <1336169215-59789-2-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> <1336169215-59789-2-git-send-email-martin@martin.st> Message-ID: <4FA46CEE.90505@gentoo.org> On 04/05/12 15:06, Martin Storsj? wrote: > --- > libavformat/rtpdec_h264.c | 24 +----------------------- > 1 file changed, 1 insertion(+), 23 deletions(-) > Ok. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sat May 5 01:58:13 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Fri, 04 May 2012 16:58:13 -0700 Subject: [libav-devel] [PATCH 03/11] rtpdec_h264: Remove outdated/useless/incorrect comments In-Reply-To: <1336169215-59789-3-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> <1336169215-59789-3-git-send-email-martin@martin.st> Message-ID: <4FA46D15.6060000@gentoo.org> On 04/05/12 15:06, Martin Storsj? wrote: > RTCP is handled elsewhere, not in the depacketizer for an > individual format. > --- > libavformat/rtpdec_h264.c | 28 +++++++--------------------- > 1 file changed, 7 insertions(+), 21 deletions(-) > Ok -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sat May 5 01:58:37 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Fri, 04 May 2012 16:58:37 -0700 Subject: [libav-devel] [PATCH 04/11] rtpdec_h264: Remove a useless ifdef In-Reply-To: <1336169215-59789-4-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> <1336169215-59789-4-git-send-email-martin@martin.st> Message-ID: <4FA46D2D.9000305@gentoo.org> On 04/05/12 15:06, Martin Storsj? wrote: > assert is a no-op if DEBUG isn't defined. > --- > libavformat/rtpdec_h264.c | 2 -- > 1 file changed, 2 deletions(-) > Ok. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sat May 5 02:00:05 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Fri, 04 May 2012 17:00:05 -0700 Subject: [libav-devel] [PATCH 07/11] rtpdec_h264: Cosmetic cleanup In-Reply-To: <1336169215-59789-7-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> <1336169215-59789-7-git-send-email-martin@martin.st> Message-ID: <4FA46D85.2030500@gentoo.org> On 04/05/12 15:06, Martin Storsj? wrote: > Add/fix spacing, split long lines, align assignments where > suitable. > --- > libavformat/rtpdec_h264.c | 105 ++++++++++++++++++++++----------------------- > 1 file changed, 52 insertions(+), 53 deletions(-) > Ok. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sat May 5 02:00:37 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Fri, 04 May 2012 17:00:37 -0700 Subject: [libav-devel] [PATCH 08/11] rtpdec_h264: Cleanup debug packet type counting In-Reply-To: <1336169215-59789-8-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> <1336169215-59789-8-git-send-email-martin@martin.st> Message-ID: <4FA46DA5.1070405@gentoo.org> On 04/05/12 15:06, Martin Storsj? wrote: > --- > libavformat/rtpdec_h264.c | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > Ok. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sat May 5 02:00:58 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Fri, 04 May 2012 17:00:58 -0700 Subject: [libav-devel] [PATCH 09/11] rtpdec_h264: Make start_sequence a static const array In-Reply-To: <1336169215-59789-9-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> <1336169215-59789-9-git-send-email-martin@martin.st> Message-ID: <4FA46DBA.5020403@gentoo.org> On 04/05/12 15:06, Martin Storsj? wrote: > --- > libavformat/rtpdec_h264.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > Ok. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sat May 5 02:01:39 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Fri, 04 May 2012 17:01:39 -0700 Subject: [libav-devel] [PATCH 10/11] rtpdec_h264: Replace sizeof(start_sequence) with a macro In-Reply-To: <1336169215-59789-10-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> <1336169215-59789-10-git-send-email-martin@martin.st> Message-ID: <4FA46DE3.7040104@gentoo.org> On 04/05/12 15:06, Martin Storsj? wrote: > This makes the code slightly more readable at places where this > is used a lot, although I guess this is very subjective. fine for me. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sat May 5 02:02:25 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Fri, 04 May 2012 17:02:25 -0700 Subject: [libav-devel] [PATCH 11/11] rtpdec_h264: Reorder code blocks In-Reply-To: <1336169215-59789-11-git-send-email-martin@martin.st> References: <1336169215-59789-1-git-send-email-martin@martin.st> <1336169215-59789-11-git-send-email-martin@martin.st> Message-ID: <4FA46E11.7040304@gentoo.org> On 04/05/12 15:06, Martin Storsj? wrote: > This removes one level of indentation. > --- > libavformat/rtpdec_h264.c | 31 +++++++++++++++---------------- > 1 file changed, 15 insertions(+), 16 deletions(-) Ok. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sat May 5 02:09:14 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Fri, 04 May 2012 17:09:14 -0700 Subject: [libav-devel] [PATCH 2/2] rtpdec_h264: Check the available data length before reading In-Reply-To: <1336160903-50388-2-git-send-email-martin@martin.st> References: <1336160903-50388-1-git-send-email-martin@martin.st> <1336160903-50388-2-git-send-email-martin@martin.st> Message-ID: <4FA46FAA.2040305@gentoo.org> On 04/05/12 12:48, Martin Storsj? wrote: > This makes sure the length is checked for STAP-A type packets. > --- > libavformat/rtpdec_h264.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Ok. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From martin at martin.st Sat May 5 02:15:04 2012 From: martin at martin.st (=?ISO-8859-15?Q?Martin_Storsj=F6?=) Date: Sat, 5 May 2012 03:15:04 +0300 (EEST) Subject: [libav-devel] [PATCH 2/2] rtpdec_h264: Check the available data length before reading In-Reply-To: <4FA46FAA.2040305@gentoo.org> References: <1336160903-50388-1-git-send-email-martin@martin.st> <1336160903-50388-2-git-send-email-martin@martin.st> <4FA46FAA.2040305@gentoo.org> Message-ID: On Fri, 4 May 2012, Luca Barbato wrote: > On 04/05/12 12:48, Martin Storsj? wrote: >> This makes sure the length is checked for STAP-A type packets. >> --- >> libavformat/rtpdec_h264.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) > > Ok. Thanks, pushed these two crash fixes. // Martin From martin at martin.st Sat May 5 02:16:48 2012 From: martin at martin.st (=?ISO-8859-15?Q?Martin_Storsj=F6?=) Date: Sat, 5 May 2012 03:16:48 +0300 (EEST) Subject: [libav-devel] [PATCH 04/11] rtpdec_h264: Remove a useless ifdef In-Reply-To: <4FA46D2D.9000305@gentoo.org> References: <1336169215-59789-1-git-send-email-martin@martin.st> <1336169215-59789-4-git-send-email-martin@martin.st> <4FA46D2D.9000305@gentoo.org> Message-ID: On Fri, 4 May 2012, Luca Barbato wrote: > On 04/05/12 15:06, Martin Storsj? wrote: >> assert is a no-op if DEBUG isn't defined. >> --- >> libavformat/rtpdec_h264.c | 2 -- >> 1 file changed, 2 deletions(-) >> > > Ok. Pushed the cleanup patches up to this one, I'll do another version of the comment cleanup and/or awaiting more opinions on it. // Martin From mashiat.sarker at gmail.com Sat May 5 10:56:49 2012 From: mashiat.sarker at gmail.com (Mashiat Sarker Shakkhar) Date: Sat, 05 May 2012 14:56:49 +0600 Subject: [libav-devel] [PATCH] WMAL: Restore removed code in mclms_predict() Message-ID: <4FA4EB51.3000304@gmail.com> Kostya Shishkov writes: > > On Thu, May 03, 2012 at 10:14:47AM -0700, Mashiat Sarker Shakkhar wrote: > > Based on observations made by Jakub Stachowski > > --- > > libavcodec/wmalosslessdec.c | 2 ++ > > 1 files changed, 2 insertions(+), 0 deletions(-) [...] > Hmm, the reference decoder performs MCLMS on empty channels. > It has special case to update filter state only, so quite probably the patch > is correct. PING From siretart at gmail.com Sat May 5 11:37:56 2012 From: siretart at gmail.com (Reinhard Tartler) Date: Sat, 5 May 2012 11:37:56 +0200 Subject: [libav-devel] [libav-commits] rv34: set mb_num_left to 0 after finishing a frame In-Reply-To: References: <20120326233928.2C45D5E07B@aruru.libav.org> Message-ID: No need to be sorry, thanks for taking care of this. IOW: poke :-) Cheers, Reinhard On Fri, May 4, 2012 at 9:48 PM, Ronald S. Bultje wrote: > Hi Reinhard, > > On Fri, May 4, 2012 at 12:24 PM, Reinhard Tartler wrote: >> On Mon, Apr 30, 2012 at 1:22 AM, Ronald S. Bultje wrote: >>> Hi Reinhard, >>> >>> On Sun, Apr 29, 2012 at 12:00 PM, Reinhard Tartler wrote: >>>> Hi Ronald, >>>> >>>> unfortunately, this patch does not apply cleanly to the 0.8 branch. In >>>> order to have it for 0.8.2, I'd therefore require your assistance with >>>> this backport. >>> >>> Does 0.8 have -mt for rv34? If not, we can ignore this. >> >> Yes, 0.8 does have -mt: >> >> commit 9472d37d8e137df1e78e973b8b0e0d5607a799d5 >> Author: Janne Grunau >> Date: ? Fri Sep 9 14:26:32 2011 +0200 >> >> ? ?rv34: frame-level multi-threading >> >> ? ?Statistics for bourne.rmvb -an -f null >> >> ? ?1 thread: ?37.12s user 0.03s system ?99% cpu 37.174 total >> ? ?2 threads: 47.63s user 0.24s system 185% cpu 25.807 total >> ? ?4 threads: 41.21s user 0.30s system 327% cpu 12.674 total >> >>>> git contains 9472d37 >> ?master >> ?release/0.8 > > Eek. OK, poke me over the weekend and I'll backport it. > > Sorry for that, > Ronald -- regards, ? ? Reinhard From kostya.shishkov at gmail.com Sat May 5 12:40:17 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Sat, 5 May 2012 12:40:17 +0200 Subject: [libav-devel] [PATCH] WMAL: Restore removed code in mclms_predict() In-Reply-To: <4FA4EB51.3000304@gmail.com> References: <4FA4EB51.3000304@gmail.com> Message-ID: <20120505104017.GA2920@kst-acer> On Sat, May 05, 2012 at 02:56:49PM +0600, Mashiat Sarker Shakkhar wrote: > Kostya Shishkov writes: > > > > > On Thu, May 03, 2012 at 10:14:47AM -0700, Mashiat Sarker Shakkhar wrote: > > > Based on observations made by Jakub Stachowski > > > --- > > > libavcodec/wmalosslessdec.c | 2 ++ > > > 1 files changed, 2 insertions(+), 0 deletions(-) > [...] > > Hmm, the reference decoder performs MCLMS on empty channels. > > It has special case to update filter state only, so quite probably > the patch > > is correct. > > PING POOOOONNNNG (i.e. applied) From martin at martin.st Sat May 5 13:33:40 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 14:33:40 +0300 Subject: [libav-devel] [PATCH 1/7] rtpdec_h264: Convert commented out code into setting an unused variable Message-ID: <1336217626-67994-1-git-send-email-martin@martin.st> It is worth keeping instead of removing, in case reading this bit becomes necessary at some later point. --- libavformat/rtpdec_h264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 399ca47..505bc81 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -265,7 +265,7 @@ static int h264_handle_packet(AVFormatContext *ctx, uint8_t fu_indicator = nal; uint8_t fu_header = *buf; uint8_t start_bit = fu_header >> 7; -// uint8_t end_bit = (fu_header & 0x40) >> 6; + uint8_t av_unused end_bit = (fu_header & 0x40) >> 6; uint8_t nal_type = (fu_header & 0x1f); uint8_t reconstructed_nal; -- 1.7.9.4 From martin at martin.st Sat May 5 13:33:41 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 14:33:41 +0300 Subject: [libav-devel] [PATCH 2/7] rtpdec_h264: Clean up comments In-Reply-To: <1336217626-67994-1-git-send-email-martin@martin.st> References: <1336217626-67994-1-git-send-email-martin@martin.st> Message-ID: <1336217626-67994-2-git-send-email-martin@martin.st> Split long comments, move long comments at the end of lines to separate lines above, fix vertical alignment, fix up comment style (unify trailing dots - comments had a mix of 2, 3 or 4 dots, where it would be just as good without them at all). --- libavformat/rtpdec_h264.c | 51 ++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 505bc81..228bab0 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -20,7 +20,7 @@ */ /** -* @file + * @file * @brief H.264 / RTP Code (RFC3984) * @author Ryan Martell * @@ -29,7 +29,8 @@ * This currently supports packetization mode: * Single Nal Unit Mode (0), or * Non-Interleaved Mode (1). It currently does not support - * Interleaved Mode (2). (This requires implementing STAP-B, MTAP16, MTAP24, FU-B packet types) + * Interleaved Mode (2). (This requires implementing STAP-B, MTAP16, MTAP24, + * FU-B packet types) */ #include "libavutil/base64.h" @@ -46,7 +47,7 @@ #include "rtpdec_formats.h" struct PayloadContext { - //sdp setup parameters + // sdp setup parameters uint8_t profile_idc; uint8_t profile_iop; uint8_t level_idc; @@ -68,10 +69,11 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, av_log(codec, AV_LOG_DEBUG, "RTP Packetization Mode: %d\n", atoi(value)); h264_data->packetization_mode = atoi(value); /* - Packetization Mode: - 0 or not present: Single NAL mode (Only nals from 1-23 are allowed) - 1: Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed. - 2: Interleaved Mode: 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A), and 29 (FU-B) are allowed. + * Packetization Mode: + * 0 or not present: Single NAL mode (Only nals from 1-23 are allowed) + * 1: Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed. + * 2: Interleaved Mode: 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A), + * and 29 (FU-B) are allowed. */ if (h264_data->packetization_mode > 1) av_log(codec, AV_LOG_ERROR, @@ -149,7 +151,7 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, return 0; } -// return 0 on packet, no more left, 1 on packet, 1 on partial packet... +// return 0 on packet, no more left, 1 on packet, 1 on partial packet static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, AVStream *st, @@ -173,8 +175,10 @@ static int h264_handle_packet(AVFormatContext *ctx, assert(data); assert(buf); + /* Simplify the case (these are all the nal types used internally by + * the h264 codec). */ if (type >= 1 && type <= 23) - type = 1; // simplify the case. (these are all the nal types used internally by the h264 codec) + type = 1; switch (type) { case 0: // undefined, but pass them through case 1: @@ -190,7 +194,7 @@ static int h264_handle_packet(AVFormatContext *ctx, // consume the STAP-A NAL buf++; len--; - // first we are going to figure out the total size.... + // first we are going to figure out the total size { int pass= 0; int total_length= 0; @@ -203,13 +207,13 @@ static int h264_handle_packet(AVFormatContext *ctx, while (src_len > 2) { uint16_t nal_size = AV_RB16(src); - // consume the length of the aggregate... + // consume the length of the aggregate src += 2; src_len -= 2; if (nal_size <= src_len) { if(pass==0) { - // counting... + // counting total_length+= sizeof(start_sequence)+nal_size; } else { // copying @@ -227,7 +231,7 @@ static int h264_handle_packet(AVFormatContext *ctx, "nal size exceeds length: %d %d\n", nal_size, src_len); } - // eat what we handled... + // eat what we handled src += nal_size; src_len -= nal_size; @@ -237,7 +241,8 @@ static int h264_handle_packet(AVFormatContext *ctx, } if(pass==0) { - // now we know the total size of the packet (with the start sequences added) + /* now we know the total size of the packet (with the + * start sequences added) */ av_new_packet(pkt, total_length); dst= pkt->data; } else { @@ -259,9 +264,9 @@ static int h264_handle_packet(AVFormatContext *ctx, case 28: // FU-A (fragmented nal) buf++; - len--; // skip the fu_indicator + len--; // skip the fu_indicator if (len > 1) { - // these are the same as above, we just redo them here for clarity... + // these are the same as above, we just redo them here for clarity uint8_t fu_indicator = nal; uint8_t fu_header = *buf; uint8_t start_bit = fu_header >> 7; @@ -269,11 +274,13 @@ static int h264_handle_packet(AVFormatContext *ctx, uint8_t nal_type = (fu_header & 0x1f); uint8_t reconstructed_nal; - // reconstruct this packet's true nal; only the data follows.. - reconstructed_nal = fu_indicator & (0xe0); // the original nal forbidden bit and NRI are stored in this packet's nal; + // Reconstruct this packet's true nal; only the data follows. + /* The original nal forbidden bit and NRI are stored in this + * packet's nal. */ + reconstructed_nal = fu_indicator & (0xe0); reconstructed_nal |= nal_type; - // skip the fu_header... + // skip the fu_header buf++; len--; @@ -282,7 +289,7 @@ static int h264_handle_packet(AVFormatContext *ctx, data->packet_types_received[nal_type]++; #endif if(start_bit) { - // copy in the start sequence, and the reconstructed nal.... + /* copy in the start sequence, and the reconstructed nal */ av_new_packet(pkt, sizeof(start_sequence)+sizeof(nal)+len); memcpy(pkt->data, start_sequence, sizeof(start_sequence)); pkt->data[sizeof(start_sequence)]= reconstructed_nal; @@ -347,7 +354,7 @@ static int parse_h264_sdp_line(AVFormatContext *s, int st_index, char buf1[50]; char *dst = buf1; - // remove the protocol identifier.. + // remove the protocol identifier while (*p && *p == ' ') p++; // strip spaces. while (*p && *p != ' ') p++; // eat protocol identifier while (*p && *p == ' ') p++; // strip trailing spaces. @@ -357,7 +364,7 @@ static int parse_h264_sdp_line(AVFormatContext *s, int st_index, *dst = '\0'; // a='framesize:96 320-240' - // set our parameters.. + // set our parameters codec->width = atoi(buf1); codec->height = atoi(p + 1); // skip the - codec->pix_fmt = PIX_FMT_YUV420P; -- 1.7.9.4 From martin at martin.st Sat May 5 13:33:42 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 14:33:42 +0300 Subject: [libav-devel] [PATCH 3/7] rtpdec_h264: Cosmetic cleanup In-Reply-To: <1336217626-67994-1-git-send-email-martin@martin.st> References: <1336217626-67994-1-git-send-email-martin@martin.st> Message-ID: <1336217626-67994-3-git-send-email-martin@martin.st> Add/fix spacing, split long lines, align assignments where suitable. --- Already OK'd by Luca. libavformat/rtpdec_h264.c | 105 ++++++++++++++++++++++----------------------- 1 file changed, 52 insertions(+), 53 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 228bab0..dfc0b59 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -57,8 +57,8 @@ struct PayloadContext { #endif }; -static int sdp_parse_fmtp_config_h264(AVStream * stream, - PayloadContext * h264_data, +static int sdp_parse_fmtp_config_h264(AVStream *stream, + PayloadContext *h264_data, char *attr, char *value) { AVCodecContext *codec = stream->codec; @@ -98,12 +98,12 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, profile_idc, profile_iop, level_idc); h264_data->profile_idc = profile_idc; h264_data->profile_iop = profile_iop; - h264_data->level_idc = level_idc; + h264_data->level_idc = level_idc; } - } else if (!strcmp(attr, "sprop-parameter-sets")) { + } else if (!strcmp(attr, "sprop-parameter-sets")) { uint8_t start_sequence[] = { 0, 0, 0, 1 }; - codec->extradata_size= 0; - codec->extradata= NULL; + codec->extradata_size = 0; + codec->extradata = NULL; while (*value) { char base64packet[1024]; @@ -120,49 +120,48 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, if (*value == ',') value++; - packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet)); + packet_size = av_base64_decode(decoded_packet, base64packet, + sizeof(decoded_packet)); if (packet_size > 0) { uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) + - codec->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); - if(dest) - { - if(codec->extradata_size) - { + codec->extradata_size + + FF_INPUT_BUFFER_PADDING_SIZE); + if (dest) { + if (codec->extradata_size) { memcpy(dest, codec->extradata, codec->extradata_size); av_free(codec->extradata); } - memcpy(dest+codec->extradata_size, start_sequence, sizeof(start_sequence)); - memcpy(dest+codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size); - memset(dest+codec->extradata_size+sizeof(start_sequence)+ + memcpy(dest + codec->extradata_size, start_sequence, + sizeof(start_sequence)); + memcpy(dest + codec->extradata_size + sizeof(start_sequence), + decoded_packet, packet_size); + memset(dest + codec->extradata_size + sizeof(start_sequence) + packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); - codec->extradata= dest; - codec->extradata_size+= sizeof(start_sequence)+packet_size; + codec->extradata = dest; + codec->extradata_size += sizeof(start_sequence) + packet_size; } else { - av_log(codec, AV_LOG_ERROR, "Unable to allocate memory for extradata!"); + av_log(codec, AV_LOG_ERROR, + "Unable to allocate memory for extradata!"); return AVERROR(ENOMEM); } } } - av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!", codec->extradata, codec->extradata_size); + av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!", + codec->extradata, codec->extradata_size); } return 0; } // return 0 on packet, no more left, 1 on packet, 1 on partial packet -static int h264_handle_packet(AVFormatContext *ctx, - PayloadContext *data, - AVStream *st, - AVPacket * pkt, - uint32_t * timestamp, - const uint8_t * buf, - int len, int flags) +static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, + AVStream *st, AVPacket *pkt, uint32_t *timestamp, + const uint8_t *buf, int len, int flags) { uint8_t nal; uint8_t type; - int result= 0; + int result = 0; uint8_t start_sequence[] = { 0, 0, 0, 1 }; if (!len) { @@ -182,9 +181,9 @@ static int h264_handle_packet(AVFormatContext *ctx, switch (type) { case 0: // undefined, but pass them through case 1: - av_new_packet(pkt, len+sizeof(start_sequence)); + av_new_packet(pkt, len + sizeof(start_sequence)); memcpy(pkt->data, start_sequence, sizeof(start_sequence)); - memcpy(pkt->data+sizeof(start_sequence), buf, len); + memcpy(pkt->data + sizeof(start_sequence), buf, len); #ifdef DEBUG data->packet_types_received[nal & 0x1f]++; #endif @@ -196,35 +195,35 @@ static int h264_handle_packet(AVFormatContext *ctx, len--; // first we are going to figure out the total size { - int pass= 0; - int total_length= 0; - uint8_t *dst= NULL; + int pass = 0; + int total_length = 0; + uint8_t *dst = NULL; - for(pass= 0; pass<2; pass++) { - const uint8_t *src= buf; - int src_len= len; + for (pass = 0; pass < 2; pass++) { + const uint8_t *src = buf; + int src_len = len; while (src_len > 2) { uint16_t nal_size = AV_RB16(src); // consume the length of the aggregate - src += 2; + src += 2; src_len -= 2; if (nal_size <= src_len) { - if(pass==0) { + if (pass == 0) { // counting - total_length+= sizeof(start_sequence)+nal_size; + total_length += sizeof(start_sequence) + nal_size; } else { // copying assert(dst); memcpy(dst, start_sequence, sizeof(start_sequence)); - dst+= sizeof(start_sequence); + dst += sizeof(start_sequence); memcpy(dst, src, nal_size); #ifdef DEBUG data->packet_types_received[*src & 0x1f]++; #endif - dst+= nal_size; + dst += nal_size; } } else { av_log(ctx, AV_LOG_ERROR, @@ -232,7 +231,7 @@ static int h264_handle_packet(AVFormatContext *ctx, } // eat what we handled - src += nal_size; + src += nal_size; src_len -= nal_size; if (src_len < 0) @@ -240,13 +239,13 @@ static int h264_handle_packet(AVFormatContext *ctx, "Consumed more bytes than we got! (%d)\n", src_len); } - if(pass==0) { + if (pass == 0) { /* now we know the total size of the packet (with the * start sequences added) */ av_new_packet(pkt, total_length); - dst= pkt->data; + dst = pkt->data; } else { - assert(dst-pkt->data==total_length); + assert(dst-pkt->data == total_length); } } } @@ -271,13 +270,13 @@ static int h264_handle_packet(AVFormatContext *ctx, uint8_t fu_header = *buf; uint8_t start_bit = fu_header >> 7; uint8_t av_unused end_bit = (fu_header & 0x40) >> 6; - uint8_t nal_type = (fu_header & 0x1f); + uint8_t nal_type = fu_header & 0x1f; uint8_t reconstructed_nal; // Reconstruct this packet's true nal; only the data follows. /* The original nal forbidden bit and NRI are stored in this * packet's nal. */ - reconstructed_nal = fu_indicator & (0xe0); + reconstructed_nal = fu_indicator & 0xe0; reconstructed_nal |= nal_type; // skip the fu_header @@ -288,12 +287,12 @@ static int h264_handle_packet(AVFormatContext *ctx, if (start_bit) data->packet_types_received[nal_type]++; #endif - if(start_bit) { + if (start_bit) { /* copy in the start sequence, and the reconstructed nal */ - av_new_packet(pkt, sizeof(start_sequence)+sizeof(nal)+len); + av_new_packet(pkt, sizeof(start_sequence) + sizeof(nal) + len); memcpy(pkt->data, start_sequence, sizeof(start_sequence)); - pkt->data[sizeof(start_sequence)]= reconstructed_nal; - memcpy(pkt->data+sizeof(start_sequence)+sizeof(nal), buf, len); + pkt->data[sizeof(start_sequence)] = reconstructed_nal; + memcpy(pkt->data + sizeof(start_sequence) + sizeof(nal), buf, len); } else { av_new_packet(pkt, len); memcpy(pkt->data, buf, len); @@ -365,8 +364,8 @@ static int parse_h264_sdp_line(AVFormatContext *s, int st_index, // a='framesize:96 320-240' // set our parameters - codec->width = atoi(buf1); - codec->height = atoi(p + 1); // skip the - + codec->width = atoi(buf1); + codec->height = atoi(p + 1); // skip the - codec->pix_fmt = PIX_FMT_YUV420P; } else if (av_strstart(p, "fmtp:", &p)) { return ff_parse_fmtp(stream, h264_data, p, sdp_parse_fmtp_config_h264); -- 1.7.9.4 From martin at martin.st Sat May 5 13:33:43 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 14:33:43 +0300 Subject: [libav-devel] [PATCH 4/7] rtpdec_h264: Cleanup debug packet type counting In-Reply-To: <1336217626-67994-1-git-send-email-martin@martin.st> References: <1336217626-67994-1-git-send-email-martin@martin.st> Message-ID: <1336217626-67994-4-git-send-email-martin@martin.st> --- Already OK'd by Luca. libavformat/rtpdec_h264.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index dfc0b59..e7c359c 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -57,6 +57,12 @@ struct PayloadContext { #endif }; +#ifdef DEBUG +#define COUNT_NAL_TYPE(data, nal) data->packet_types_received[(nal) & 0x1f]++ +#else +#define COUNT_NAL_TYPE(data, nal) do { } while (0) +#endif + static int sdp_parse_fmtp_config_h264(AVStream *stream, PayloadContext *h264_data, char *attr, char *value) @@ -184,9 +190,7 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, av_new_packet(pkt, len + sizeof(start_sequence)); memcpy(pkt->data, start_sequence, sizeof(start_sequence)); memcpy(pkt->data + sizeof(start_sequence), buf, len); -#ifdef DEBUG - data->packet_types_received[nal & 0x1f]++; -#endif + COUNT_NAL_TYPE(data, nal); break; case 24: // STAP-A (one packet, multiple nals) @@ -220,9 +224,7 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, memcpy(dst, start_sequence, sizeof(start_sequence)); dst += sizeof(start_sequence); memcpy(dst, src, nal_size); -#ifdef DEBUG - data->packet_types_received[*src & 0x1f]++; -#endif + COUNT_NAL_TYPE(data, *src); dst += nal_size; } } else { @@ -283,10 +285,8 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, buf++; len--; -#ifdef DEBUG if (start_bit) - data->packet_types_received[nal_type]++; -#endif + COUNT_NAL_TYPE(data, nal_type); if (start_bit) { /* copy in the start sequence, and the reconstructed nal */ av_new_packet(pkt, sizeof(start_sequence) + sizeof(nal) + len); -- 1.7.9.4 From martin at martin.st Sat May 5 13:33:44 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 14:33:44 +0300 Subject: [libav-devel] [PATCH 5/7] rtpdec_h264: Make start_sequence a static const array In-Reply-To: <1336217626-67994-1-git-send-email-martin@martin.st> References: <1336217626-67994-1-git-send-email-martin@martin.st> Message-ID: <1336217626-67994-5-git-send-email-martin@martin.st> --- Already OK'd by Luca. libavformat/rtpdec_h264.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index e7c359c..ae6104f 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -63,6 +63,8 @@ struct PayloadContext { #define COUNT_NAL_TYPE(data, nal) do { } while (0) #endif +static const uint8_t start_sequence[] = { 0, 0, 0, 1 }; + static int sdp_parse_fmtp_config_h264(AVStream *stream, PayloadContext *h264_data, char *attr, char *value) @@ -107,7 +109,6 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream, h264_data->level_idc = level_idc; } } else if (!strcmp(attr, "sprop-parameter-sets")) { - uint8_t start_sequence[] = { 0, 0, 0, 1 }; codec->extradata_size = 0; codec->extradata = NULL; @@ -168,7 +169,6 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, uint8_t nal; uint8_t type; int result = 0; - uint8_t start_sequence[] = { 0, 0, 0, 1 }; if (!len) { av_log(ctx, AV_LOG_ERROR, "Empty H264 RTP packet\n"); -- 1.7.9.4 From martin at martin.st Sat May 5 13:33:45 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 14:33:45 +0300 Subject: [libav-devel] [PATCH 6/7] rtpdec_h264: Replace sizeof(start_sequence) with a macro In-Reply-To: <1336217626-67994-1-git-send-email-martin@martin.st> References: <1336217626-67994-1-git-send-email-martin@martin.st> Message-ID: <1336217626-67994-6-git-send-email-martin@martin.st> This makes the code slightly more readable at places where this is used a lot, although I guess this is very subjective. --- Already OK'd by Luca. libavformat/rtpdec_h264.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index ae6104f..4e47cf9 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -64,6 +64,7 @@ struct PayloadContext { #endif static const uint8_t start_sequence[] = { 0, 0, 0, 1 }; +#define START_SEQ_SIZE sizeof(start_sequence) static int sdp_parse_fmtp_config_h264(AVStream *stream, PayloadContext *h264_data, @@ -130,7 +131,7 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream, packet_size = av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet)); if (packet_size > 0) { - uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) + + uint8_t *dest = av_malloc(packet_size + START_SEQ_SIZE + codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (dest) { @@ -140,14 +141,14 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream, } memcpy(dest + codec->extradata_size, start_sequence, - sizeof(start_sequence)); - memcpy(dest + codec->extradata_size + sizeof(start_sequence), + START_SEQ_SIZE); + memcpy(dest + codec->extradata_size + START_SEQ_SIZE, decoded_packet, packet_size); - memset(dest + codec->extradata_size + sizeof(start_sequence) + + memset(dest + codec->extradata_size + START_SEQ_SIZE + packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); codec->extradata = dest; - codec->extradata_size += sizeof(start_sequence) + packet_size; + codec->extradata_size += START_SEQ_SIZE + packet_size; } else { av_log(codec, AV_LOG_ERROR, "Unable to allocate memory for extradata!"); @@ -187,9 +188,9 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, switch (type) { case 0: // undefined, but pass them through case 1: - av_new_packet(pkt, len + sizeof(start_sequence)); - memcpy(pkt->data, start_sequence, sizeof(start_sequence)); - memcpy(pkt->data + sizeof(start_sequence), buf, len); + av_new_packet(pkt, len + START_SEQ_SIZE); + memcpy(pkt->data, start_sequence, START_SEQ_SIZE); + memcpy(pkt->data + START_SEQ_SIZE, buf, len); COUNT_NAL_TYPE(data, nal); break; @@ -217,12 +218,12 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, if (nal_size <= src_len) { if (pass == 0) { // counting - total_length += sizeof(start_sequence) + nal_size; + total_length += START_SEQ_SIZE + nal_size; } else { // copying assert(dst); - memcpy(dst, start_sequence, sizeof(start_sequence)); - dst += sizeof(start_sequence); + memcpy(dst, start_sequence, START_SEQ_SIZE); + dst += START_SEQ_SIZE; memcpy(dst, src, nal_size); COUNT_NAL_TYPE(data, *src); dst += nal_size; @@ -289,10 +290,10 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, COUNT_NAL_TYPE(data, nal_type); if (start_bit) { /* copy in the start sequence, and the reconstructed nal */ - av_new_packet(pkt, sizeof(start_sequence) + sizeof(nal) + len); - memcpy(pkt->data, start_sequence, sizeof(start_sequence)); - pkt->data[sizeof(start_sequence)] = reconstructed_nal; - memcpy(pkt->data + sizeof(start_sequence) + sizeof(nal), buf, len); + av_new_packet(pkt, START_SEQ_SIZE + sizeof(nal) + len); + memcpy(pkt->data, start_sequence, START_SEQ_SIZE); + pkt->data[START_SEQ_SIZE] = reconstructed_nal; + memcpy(pkt->data + START_SEQ_SIZE + sizeof(nal), buf, len); } else { av_new_packet(pkt, len); memcpy(pkt->data, buf, len); -- 1.7.9.4 From martin at martin.st Sat May 5 13:33:46 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 14:33:46 +0300 Subject: [libav-devel] [PATCH 7/7] rtpdec_h264: Reorder code blocks In-Reply-To: <1336217626-67994-1-git-send-email-martin@martin.st> References: <1336217626-67994-1-git-send-email-martin@martin.st> Message-ID: <1336217626-67994-7-git-send-email-martin@martin.st> This removes one level of indentation. --- Already OK'd by Luca. libavformat/rtpdec_h264.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 4e47cf9..ee1395b 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -134,26 +134,25 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream, uint8_t *dest = av_malloc(packet_size + START_SEQ_SIZE + codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - if (dest) { - if (codec->extradata_size) { - memcpy(dest, codec->extradata, codec->extradata_size); - av_free(codec->extradata); - } - - memcpy(dest + codec->extradata_size, start_sequence, - START_SEQ_SIZE); - memcpy(dest + codec->extradata_size + START_SEQ_SIZE, - decoded_packet, packet_size); - memset(dest + codec->extradata_size + START_SEQ_SIZE + - packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); - - codec->extradata = dest; - codec->extradata_size += START_SEQ_SIZE + packet_size; - } else { + if (!dest) { av_log(codec, AV_LOG_ERROR, "Unable to allocate memory for extradata!"); return AVERROR(ENOMEM); } + if (codec->extradata_size) { + memcpy(dest, codec->extradata, codec->extradata_size); + av_free(codec->extradata); + } + + memcpy(dest + codec->extradata_size, start_sequence, + START_SEQ_SIZE); + memcpy(dest + codec->extradata_size + START_SEQ_SIZE, + decoded_packet, packet_size); + memset(dest + codec->extradata_size + START_SEQ_SIZE + + packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + + codec->extradata = dest; + codec->extradata_size += START_SEQ_SIZE + packet_size; } } av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!", -- 1.7.9.4 From kostya.shishkov at gmail.com Sat May 5 15:08:36 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Sat, 5 May 2012 15:08:36 +0200 Subject: [libav-devel] [PATCH 1/4] dfa: add some checks to ensure that decoder won't write past frame end Message-ID: <20120505130836.GA3295@kst-acer> --- libavcodec/dfa.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c index 788e9ca..f791cc6 100644 --- a/libavcodec/dfa.c +++ b/libavcodec/dfa.c @@ -164,6 +164,8 @@ static int decode_dds1(GetByteContext *gb, uint8_t *frame, int width, int height } else if (bitbuf & (mask << 1)) { frame += bytestream2_get_le16(gb) * 2; } else { + if (frame_end - frame < width + 2) + return -1; frame[0] = frame[1] = frame[width] = frame[width + 1] = bytestream2_get_byte(gb); frame += 2; @@ -224,6 +226,7 @@ static int decode_wdlt(GetByteContext *gb, uint8_t *frame, int width, int height const uint8_t *frame_end = frame + width * height; uint8_t *line_ptr; int count, i, v, lines, segments; + int y = 0; lines = bytestream2_get_le16(gb); if (lines > height) @@ -234,10 +237,12 @@ static int decode_wdlt(GetByteContext *gb, uint8_t *frame, int width, int height return -1; segments = bytestream2_get_le16u(gb); while ((segments & 0xC000) == 0xC000) { + unsigned skip_lines = -(int16_t)segments; unsigned delta = -((int16_t)segments * width); - if (frame_end - frame <= delta) + if (frame_end - frame <= delta || y + lines + skip_lines > height) return -1; frame += delta; + y += skip_lines; segments = bytestream2_get_le16(gb); } if (segments & 0x8000) { @@ -246,6 +251,7 @@ static int decode_wdlt(GetByteContext *gb, uint8_t *frame, int width, int height } line_ptr = frame; frame += width; + y++; while (segments--) { if (frame - line_ptr <= bytestream2_peek_byte(gb)) return -1; -- 1.7.0.4 From kostya.shishkov at gmail.com Sat May 5 15:08:50 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Sat, 5 May 2012 15:08:50 +0200 Subject: [libav-devel] [PATCH 2/4] lagarith: make offset array type unsigned Message-ID: <20120505130850.GA3331@kst-acer> This is logical and also fixes checking for the fourth plane offset. --- libavcodec/lagarith.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c index d6921ea..b27e755 100644 --- a/libavcodec/lagarith.c +++ b/libavcodec/lagarith.c @@ -457,7 +457,7 @@ static int lag_decode_frame(AVCodecContext *avctx, AVFrame *const p = &l->picture; uint8_t frametype = 0; uint32_t offset_gu = 0, offset_bv = 0, offset_ry = 9; - int offs[4]; + uint32_t offs[4]; uint8_t *srcs[4], *dst; int i, j, planes = 3; -- 1.7.0.4 From kostya.shishkov at gmail.com Sat May 5 15:09:17 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Sat, 5 May 2012 15:09:17 +0200 Subject: [libav-devel] [PATCH 3/4] eatgv: check motion vectors Message-ID: <20120505130917.GA3367@kst-acer> --- libavcodec/eatgv.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c index 34b79af..04b254b 100644 --- a/libavcodec/eatgv.c +++ b/libavcodec/eatgv.c @@ -136,7 +136,6 @@ static int unpack(const uint8_t *src, const uint8_t *src_end, unsigned char *dst * @return 0 on success, -1 on critical buffer underflow */ static int tgv_decode_inter(TgvContext * s, const uint8_t *buf, const uint8_t *buf_end){ - unsigned char *frame0_end = s->last_frame.data[0] + s->avctx->width*s->last_frame.linesize[0]; int num_mvs; int num_blocks_raw; int num_blocks_packed; @@ -205,12 +204,15 @@ static int tgv_decode_inter(TgvContext * s, const uint8_t *buf, const uint8_t *b int src_stride; if (vector < num_mvs) { - src = s->last_frame.data[0] + - (y*4 + s->mv_codebook[vector][1])*s->last_frame.linesize[0] + - x*4 + s->mv_codebook[vector][0]; - src_stride = s->last_frame.linesize[0]; - if (src+3*src_stride+3>=frame0_end) + int mx = x * 4 + s->mv_codebook[vector][0]; + int my = y * 4 + s->mv_codebook[vector][1]; + + if ( mx < 0 || mx + 4 >= s->avctx->width + || my < 0 || my + 4 >= s->avctx->height) continue; + + src = s->last_frame.data[0] + mx + my * s->last_frame.linesize[0]; + src_stride = s->last_frame.linesize[0]; }else{ int offset = vector - num_mvs; if (offset Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer Signed-off-by: Kostya Shishkov --- libavcodec/eatgv.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c index 04b254b..53d87c0 100644 --- a/libavcodec/eatgv.c +++ b/libavcodec/eatgv.c @@ -154,6 +154,11 @@ static int tgv_decode_inter(TgvContext * s, const uint8_t *buf, const uint8_t *b vector_bits = AV_RL16(&buf[6]); buf += 12; + if (vector_bits > MIN_CACHE_BITS || !vector_bits) { + av_log(s->avctx, AV_LOG_ERROR, "vector_bits %d invalid\n", vector_bits); + return AVERROR_INVALIDDATA; + } + /* allocate codebook buffers as necessary */ if (num_mvs > s->num_mvs) { s->mv_codebook = av_realloc(s->mv_codebook, num_mvs*2*sizeof(int)); -- 1.7.0.4 From diego at biurrun.de Sat May 5 15:30:54 2012 From: diego at biurrun.de (Diego Biurrun) Date: Sat, 05 May 2012 15:30:54 +0200 Subject: [libav-devel] [PATCH 3/7] rtpdec_h264: Cosmetic cleanup In-Reply-To: <1336217626-67994-3-git-send-email-martin@martin.st> References: <1336217626-67994-1-git-send-email-martin@martin.st> <1336217626-67994-3-git-send-email-martin@martin.st> Message-ID: <20120505133054.GA13934@pool.informatik.rwth-aachen.de> On Sat, May 05, 2012 at 02:33:42PM +0300, Martin Storsj? wrote: > > --- a/libavformat/rtpdec_h264.c > +++ b/libavformat/rtpdec_h264.c > @@ -98,12 +98,12 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, > - } else if (!strcmp(attr, "sprop-parameter-sets")) { > + } else if (!strcmp(attr, "sprop-parameter-sets")) { > uint8_t start_sequence[] = { 0, 0, 0, 1 }; > - codec->extradata_size= 0; > - codec->extradata= NULL; > + codec->extradata_size = 0; > + codec->extradata = NULL; You could align here while you're at it. > @@ -120,49 +120,48 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, > > - codec->extradata= dest; > - codec->extradata_size+= sizeof(start_sequence)+packet_size; > + codec->extradata = dest; > + codec->extradata_size += sizeof(start_sequence) + packet_size; and here > - av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!", codec->extradata, codec->extradata_size); > + av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!", > + codec->extradata, codec->extradata_size); Indentation is off. Diego From martin at martin.st Sat May 5 15:52:11 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 16:52:11 +0300 Subject: [libav-devel] [PATCH 3/7] rtpdec_h264: Cosmetic cleanup In-Reply-To: <20120505133054.GA13934@pool.informatik.rwth-aachen.de> References: <20120505133054.GA13934@pool.informatik.rwth-aachen.de> Message-ID: <1336225931-69056-1-git-send-email-martin@martin.st> Add/fix spacing, split long lines, align assignments where suitable. --- libavformat/rtpdec_h264.c | 105 ++++++++++++++++++++++----------------------- 1 file changed, 52 insertions(+), 53 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 228bab0..3f155a3 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -57,8 +57,8 @@ struct PayloadContext { #endif }; -static int sdp_parse_fmtp_config_h264(AVStream * stream, - PayloadContext * h264_data, +static int sdp_parse_fmtp_config_h264(AVStream *stream, + PayloadContext *h264_data, char *attr, char *value) { AVCodecContext *codec = stream->codec; @@ -98,12 +98,12 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, profile_idc, profile_iop, level_idc); h264_data->profile_idc = profile_idc; h264_data->profile_iop = profile_iop; - h264_data->level_idc = level_idc; + h264_data->level_idc = level_idc; } - } else if (!strcmp(attr, "sprop-parameter-sets")) { + } else if (!strcmp(attr, "sprop-parameter-sets")) { uint8_t start_sequence[] = { 0, 0, 0, 1 }; - codec->extradata_size= 0; - codec->extradata= NULL; + codec->extradata_size = 0; + codec->extradata = NULL; while (*value) { char base64packet[1024]; @@ -120,49 +120,48 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, if (*value == ',') value++; - packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet)); + packet_size = av_base64_decode(decoded_packet, base64packet, + sizeof(decoded_packet)); if (packet_size > 0) { uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) + - codec->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); - if(dest) - { - if(codec->extradata_size) - { + codec->extradata_size + + FF_INPUT_BUFFER_PADDING_SIZE); + if (dest) { + if (codec->extradata_size) { memcpy(dest, codec->extradata, codec->extradata_size); av_free(codec->extradata); } - memcpy(dest+codec->extradata_size, start_sequence, sizeof(start_sequence)); - memcpy(dest+codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size); - memset(dest+codec->extradata_size+sizeof(start_sequence)+ + memcpy(dest + codec->extradata_size, start_sequence, + sizeof(start_sequence)); + memcpy(dest + codec->extradata_size + sizeof(start_sequence), + decoded_packet, packet_size); + memset(dest + codec->extradata_size + sizeof(start_sequence) + packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); - codec->extradata= dest; - codec->extradata_size+= sizeof(start_sequence)+packet_size; + codec->extradata = dest; + codec->extradata_size += sizeof(start_sequence) + packet_size; } else { - av_log(codec, AV_LOG_ERROR, "Unable to allocate memory for extradata!"); + av_log(codec, AV_LOG_ERROR, + "Unable to allocate memory for extradata!"); return AVERROR(ENOMEM); } } } - av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!", codec->extradata, codec->extradata_size); + av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!", + codec->extradata, codec->extradata_size); } return 0; } // return 0 on packet, no more left, 1 on packet, 1 on partial packet -static int h264_handle_packet(AVFormatContext *ctx, - PayloadContext *data, - AVStream *st, - AVPacket * pkt, - uint32_t * timestamp, - const uint8_t * buf, - int len, int flags) +static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, + AVStream *st, AVPacket *pkt, uint32_t *timestamp, + const uint8_t *buf, int len, int flags) { uint8_t nal; uint8_t type; - int result= 0; + int result = 0; uint8_t start_sequence[] = { 0, 0, 0, 1 }; if (!len) { @@ -182,9 +181,9 @@ static int h264_handle_packet(AVFormatContext *ctx, switch (type) { case 0: // undefined, but pass them through case 1: - av_new_packet(pkt, len+sizeof(start_sequence)); + av_new_packet(pkt, len + sizeof(start_sequence)); memcpy(pkt->data, start_sequence, sizeof(start_sequence)); - memcpy(pkt->data+sizeof(start_sequence), buf, len); + memcpy(pkt->data + sizeof(start_sequence), buf, len); #ifdef DEBUG data->packet_types_received[nal & 0x1f]++; #endif @@ -196,35 +195,35 @@ static int h264_handle_packet(AVFormatContext *ctx, len--; // first we are going to figure out the total size { - int pass= 0; - int total_length= 0; - uint8_t *dst= NULL; + int pass = 0; + int total_length = 0; + uint8_t *dst = NULL; - for(pass= 0; pass<2; pass++) { - const uint8_t *src= buf; - int src_len= len; + for (pass = 0; pass < 2; pass++) { + const uint8_t *src = buf; + int src_len = len; while (src_len > 2) { uint16_t nal_size = AV_RB16(src); // consume the length of the aggregate - src += 2; + src += 2; src_len -= 2; if (nal_size <= src_len) { - if(pass==0) { + if (pass == 0) { // counting - total_length+= sizeof(start_sequence)+nal_size; + total_length += sizeof(start_sequence) + nal_size; } else { // copying assert(dst); memcpy(dst, start_sequence, sizeof(start_sequence)); - dst+= sizeof(start_sequence); + dst += sizeof(start_sequence); memcpy(dst, src, nal_size); #ifdef DEBUG data->packet_types_received[*src & 0x1f]++; #endif - dst+= nal_size; + dst += nal_size; } } else { av_log(ctx, AV_LOG_ERROR, @@ -232,7 +231,7 @@ static int h264_handle_packet(AVFormatContext *ctx, } // eat what we handled - src += nal_size; + src += nal_size; src_len -= nal_size; if (src_len < 0) @@ -240,13 +239,13 @@ static int h264_handle_packet(AVFormatContext *ctx, "Consumed more bytes than we got! (%d)\n", src_len); } - if(pass==0) { + if (pass == 0) { /* now we know the total size of the packet (with the * start sequences added) */ av_new_packet(pkt, total_length); - dst= pkt->data; + dst = pkt->data; } else { - assert(dst-pkt->data==total_length); + assert(dst-pkt->data == total_length); } } } @@ -271,13 +270,13 @@ static int h264_handle_packet(AVFormatContext *ctx, uint8_t fu_header = *buf; uint8_t start_bit = fu_header >> 7; uint8_t av_unused end_bit = (fu_header & 0x40) >> 6; - uint8_t nal_type = (fu_header & 0x1f); + uint8_t nal_type = fu_header & 0x1f; uint8_t reconstructed_nal; // Reconstruct this packet's true nal; only the data follows. /* The original nal forbidden bit and NRI are stored in this * packet's nal. */ - reconstructed_nal = fu_indicator & (0xe0); + reconstructed_nal = fu_indicator & 0xe0; reconstructed_nal |= nal_type; // skip the fu_header @@ -288,12 +287,12 @@ static int h264_handle_packet(AVFormatContext *ctx, if (start_bit) data->packet_types_received[nal_type]++; #endif - if(start_bit) { + if (start_bit) { /* copy in the start sequence, and the reconstructed nal */ - av_new_packet(pkt, sizeof(start_sequence)+sizeof(nal)+len); + av_new_packet(pkt, sizeof(start_sequence) + sizeof(nal) + len); memcpy(pkt->data, start_sequence, sizeof(start_sequence)); - pkt->data[sizeof(start_sequence)]= reconstructed_nal; - memcpy(pkt->data+sizeof(start_sequence)+sizeof(nal), buf, len); + pkt->data[sizeof(start_sequence)] = reconstructed_nal; + memcpy(pkt->data + sizeof(start_sequence) + sizeof(nal), buf, len); } else { av_new_packet(pkt, len); memcpy(pkt->data, buf, len); @@ -365,8 +364,8 @@ static int parse_h264_sdp_line(AVFormatContext *s, int st_index, // a='framesize:96 320-240' // set our parameters - codec->width = atoi(buf1); - codec->height = atoi(p + 1); // skip the - + codec->width = atoi(buf1); + codec->height = atoi(p + 1); // skip the - codec->pix_fmt = PIX_FMT_YUV420P; } else if (av_strstart(p, "fmtp:", &p)) { return ff_parse_fmtp(stream, h264_data, p, sdp_parse_fmtp_config_h264); -- 1.7.9.4 From diego at biurrun.de Sat May 5 16:10:30 2012 From: diego at biurrun.de (Diego Biurrun) Date: Sat, 05 May 2012 16:10:30 +0200 Subject: [libav-devel] [PATCH 2/7] rtpdec_h264: Clean up comments In-Reply-To: <1336217626-67994-2-git-send-email-martin@martin.st> References: <1336217626-67994-1-git-send-email-martin@martin.st> <1336217626-67994-2-git-send-email-martin@martin.st> Message-ID: <20120505141030.GB13934@pool.informatik.rwth-aachen.de> On Sat, May 05, 2012 at 02:33:41PM +0300, Martin Storsj? wrote: > Split long comments, move long comments at the end of lines to > separate lines above, fix vertical alignment, fix up comment style > (unify trailing dots - comments had a mix of 2, 3 or 4 dots, where > it would be just as good without them at all). > --- > libavformat/rtpdec_h264.c | 51 ++++++++++++++++++++++++++------------------- > 1 file changed, 29 insertions(+), 22 deletions(-) OK Diego From saintdev at gmail.com Sat May 5 16:20:24 2012 From: saintdev at gmail.com (Nathan Caldwell) Date: Sat, 5 May 2012 08:20:24 -0600 Subject: [libav-devel] [PATCH 2/4] lagarith: make offset array type unsigned In-Reply-To: <20120505130850.GA3331@kst-acer> References: <20120505130850.GA3331@kst-acer> Message-ID: On May 5, 2012 7:09 AM, "Kostya Shishkov" wrote: > > This is logical and also fixes checking for the fourth plane offset. > --- > libavcodec/lagarith.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c > index d6921ea..b27e755 100644 > --- a/libavcodec/lagarith.c > +++ b/libavcodec/lagarith.c > @@ -457,7 +457,7 @@ static int lag_decode_frame(AVCodecContext *avctx, > AVFrame *const p = &l->picture; > uint8_t frametype = 0; > uint32_t offset_gu = 0, offset_bv = 0, offset_ry = 9; > - int offs[4]; > + uint32_t offs[4]; > uint8_t *srcs[4], *dst; > int i, j, planes = 3; Ok. -Nathan Caldwell -------------- next part -------------- An HTML attachment was scrubbed... URL: From diego at biurrun.de Sat May 5 16:31:15 2012 From: diego at biurrun.de (Diego Biurrun) Date: Sat, 05 May 2012 16:31:15 +0200 Subject: [libav-devel] [PATCH] tests: Refactor rotozoom/videogen common code into a separate file. In-Reply-To: References: Message-ID: <1336228275-15459-1-git-send-email-diego@biurrun.de> --- tests/Makefile | 3 + tests/rotozoom.c | 126 +---------------------------------------------- tests/utils.c | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/videogen.c | 129 +------------------------------------------------ 4 files changed, 150 insertions(+), 252 deletions(-) create mode 100644 tests/utils.c diff --git a/tests/Makefile b/tests/Makefile index 19fbe11..cbd3fd2 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -7,6 +7,9 @@ $(AREF): avconv$(EXESUF) tests/data/asynth1.sw OBJDIRS += tests/data tests/vsynth1 tests/vsynth2 +# Required due to missing automatic dependency tracking for HOSTOBJS. +tests/rotozoom.o tests/videogen.o: tests/utils.c + tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF) | tests/vsynth1 $(M)./$< 'tests/vsynth1/' diff --git a/tests/rotozoom.c b/tests/rotozoom.c index 9bba6e3..48c06b0 100644 --- a/tests/rotozoom.c +++ b/tests/rotozoom.c @@ -24,6 +24,8 @@ #include #include +#include "utils.c" + #define FIXP (1 << 16) #define MY_PI 205887 // (M_PI * FIX) @@ -53,130 +55,6 @@ static int64_t int_sin(int64_t a) return a - int_pow(a, 3) / 6 + int_pow(a, 5) / 120 - int_pow(a, 7) / 5040; } -#define SCALEBITS 8 -#define ONE_HALF (1 << (SCALEBITS - 1)) -#define FIX(x) ((int) ((x) * (1L << SCALEBITS) + 0.5)) - -static void rgb24_to_yuv420p(unsigned char *lum, unsigned char *cb, - unsigned char *cr, unsigned char *src, - int width, int height) -{ - int wrap, wrap3, x, y; - int r, g, b, r1, g1, b1; - unsigned char *p; - - wrap = width; - wrap3 = width * 3; - p = src; - for (y = 0; y < height; y += 2) { - for (x = 0; x < width; x += 2) { - r = p[0]; - g = p[1]; - b = p[2]; - r1 = r; - g1 = g; - b1 = b; - lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g + - FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; - r = p[3]; - g = p[4]; - b = p[5]; - r1 += r; - g1 += g; - b1 += b; - lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g + - FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; - p += wrap3; - lum += wrap; - - r = p[0]; - g = p[1]; - b = p[2]; - r1 += r; - g1 += g; - b1 += b; - lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g + - FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; - r = p[3]; - g = p[4]; - b = p[5]; - r1 += r; - g1 += g; - b1 += b; - lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g + - FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; - - cb[0] = ((- FIX(0.16874) * r1 - FIX(0.33126) * g1 + - FIX(0.50000) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128; - cr[0] = ((FIX(0.50000) * r1 - FIX(0.41869) * g1 - - FIX(0.08131) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128; - - cb++; - cr++; - p += -wrap3 + 2 * 3; - lum += -wrap + 2; - } - p += wrap3; - lum += wrap; - } -} - -/* cif format */ -#define DEFAULT_WIDTH 352 -#define DEFAULT_HEIGHT 288 -#define DEFAULT_NB_PICT 50 - -static void pgmyuv_save(const char *filename, int w, int h, - unsigned char *rgb_tab) -{ - FILE *f; - int i, h2, w2; - unsigned char *cb, *cr; - unsigned char *lum_tab, *cb_tab, *cr_tab; - - lum_tab = malloc(w * h); - cb_tab = malloc(w * h / 4); - cr_tab = malloc(w * h / 4); - - rgb24_to_yuv420p(lum_tab, cb_tab, cr_tab, rgb_tab, w, h); - - f = fopen(filename, "wb"); - fprintf(f, "P5\n%d %d\n%d\n", w, h * 3 / 2, 255); - fwrite(lum_tab, 1, w * h, f); - h2 = h / 2; - w2 = w / 2; - cb = cb_tab; - cr = cr_tab; - for (i = 0; i < h2; i++) { - fwrite(cb, 1, w2, f); - fwrite(cr, 1, w2, f); - cb += w2; - cr += w2; - } - fclose(f); - - free(lum_tab); - free(cb_tab); - free(cr_tab); -} - -static unsigned char *rgb_tab; -static int width, height, wrap; - -static void put_pixel(int x, int y, int r, int g, int b) -{ - unsigned char *p; - - if (x < 0 || x >= width || - y < 0 || y >= height) - return; - - p = rgb_tab + y * wrap + x * 3; - p[0] = r; - p[1] = g; - p[2] = b; -} - static unsigned char tab_r[256 * 256]; static unsigned char tab_g[256 * 256]; static unsigned char tab_b[256 * 256]; diff --git a/tests/utils.c b/tests/utils.c new file mode 100644 index 0000000..2a85bd8 --- /dev/null +++ b/tests/utils.c @@ -0,0 +1,144 @@ +/* + * 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 +#include + +#define SCALEBITS 8 +#define ONE_HALF (1 << (SCALEBITS - 1)) +#define FIX(x) ((int) ((x) * (1L << SCALEBITS) + 0.5)) + +static void rgb24_to_yuv420p(unsigned char *lum, unsigned char *cb, + unsigned char *cr, unsigned char *src, + int width, int height) +{ + int wrap, wrap3, x, y; + int r, g, b, r1, g1, b1; + unsigned char *p; + + wrap = width; + wrap3 = width * 3; + p = src; + for (y = 0; y < height; y += 2) { + for (x = 0; x < width; x += 2) { + r = p[0]; + g = p[1]; + b = p[2]; + r1 = r; + g1 = g; + b1 = b; + lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g + + FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; + r = p[3]; + g = p[4]; + b = p[5]; + r1 += r; + g1 += g; + b1 += b; + lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g + + FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; + p += wrap3; + lum += wrap; + + r = p[0]; + g = p[1]; + b = p[2]; + r1 += r; + g1 += g; + b1 += b; + lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g + + FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; + r = p[3]; + g = p[4]; + b = p[5]; + r1 += r; + g1 += g; + b1 += b; + lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g + + FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; + + cb[0] = ((- FIX(0.16874) * r1 - FIX(0.33126) * g1 + + FIX(0.50000) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128; + cr[0] = ((FIX(0.50000) * r1 - FIX(0.41869) * g1 - + FIX(0.08131) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128; + + cb++; + cr++; + p += -wrap3 + 2 * 3; + lum += -wrap + 2; + } + p += wrap3; + lum += wrap; + } +} + +/* cif format */ +#define DEFAULT_WIDTH 352 +#define DEFAULT_HEIGHT 288 +#define DEFAULT_NB_PICT 50 + +static void pgmyuv_save(const char *filename, int w, int h, + unsigned char *rgb_tab) +{ + FILE *f; + int i, h2, w2; + unsigned char *cb, *cr; + unsigned char *lum_tab, *cb_tab, *cr_tab; + + lum_tab = malloc(w * h); + cb_tab = malloc(w * h / 4); + cr_tab = malloc(w * h / 4); + + rgb24_to_yuv420p(lum_tab, cb_tab, cr_tab, rgb_tab, w, h); + + f = fopen(filename, "wb"); + fprintf(f, "P5\n%d %d\n%d\n", w, h * 3 / 2, 255); + fwrite(lum_tab, 1, w * h, f); + h2 = h / 2; + w2 = w / 2; + cb = cb_tab; + cr = cr_tab; + for (i = 0; i < h2; i++) { + fwrite(cb, 1, w2, f); + fwrite(cr, 1, w2, f); + cb += w2; + cr += w2; + } + fclose(f); + + free(lum_tab); + free(cb_tab); + free(cr_tab); +} + +static unsigned char *rgb_tab; +static int width, height, wrap; + +static void put_pixel(int x, int y, int r, int g, int b) +{ + unsigned char *p; + + if (x < 0 || x >= width || + y < 0 || y >= height) + return; + + p = rgb_tab + y * wrap + x * 3; + p[0] = r; + p[1] = g; + p[2] = b; +} diff --git a/tests/videogen.c b/tests/videogen.c index 14996da..8c3d539 100644 --- a/tests/videogen.c +++ b/tests/videogen.c @@ -25,134 +25,7 @@ #include #include -#define SCALEBITS 8 -#define ONE_HALF (1 << (SCALEBITS - 1)) -#define FIX(x) ((int) ((x) * (1L << SCALEBITS) + 0.5)) - -static void rgb24_to_yuv420p(uint8_t *lum, uint8_t *cb, uint8_t *cr, - uint8_t *src, int width, int height) -{ - int wrap, wrap3, x, y; - int r, g, b, r1, g1, b1; - uint8_t *p; - - wrap = width; - wrap3 = width * 3; - p = src; - for (y = 0; y < height; y += 2) { - for (x = 0; x < width; x += 2) { - r = p[0]; - g = p[1]; - b = p[2]; - r1 = r; - g1 = g; - b1 = b; - lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g + - FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; - r = p[3]; - g = p[4]; - b = p[5]; - r1 += r; - g1 += g; - b1 += b; - lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g + - FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; - p += wrap3; - lum += wrap; - - r = p[0]; - g = p[1]; - b = p[2]; - r1 += r; - g1 += g; - b1 += b; - lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g + - FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; - r = p[3]; - g = p[4]; - b = p[5]; - r1 += r; - g1 += g; - b1 += b; - lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g + - FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; - - cb[0] = 128 + ((- FIX(0.16874) * r1 - - FIX(0.33126) * g1 + - FIX(0.50000) * b1 + - 4 * ONE_HALF - 1) - >> (SCALEBITS + 2)); - cr[0] = 128 + ((FIX(0.50000) * r1 - - FIX(0.41869) * g1 - - FIX(0.08131) * b1 + - 4 * ONE_HALF - 1) - >> (SCALEBITS + 2)); - - cb++; - cr++; - p += -wrap3 + 2 * 3; - lum += -wrap + 2; - } - p += wrap3; - lum += wrap; - } -} - -/* cif format */ -#define DEFAULT_WIDTH 352 -#define DEFAULT_HEIGHT 288 -#define DEFAULT_NB_PICT 50 /* 2 seconds */ - -static void pgmyuv_save(const char *filename, int w, int h, - unsigned char *rgb_tab) -{ - FILE *f; - int i, h2, w2; - unsigned char *cb, *cr; - unsigned char *lum_tab, *cb_tab, *cr_tab; - - lum_tab = malloc(w * h); - cb_tab = malloc((w * h) / 4); - cr_tab = malloc((w * h) / 4); - - rgb24_to_yuv420p(lum_tab, cb_tab, cr_tab, rgb_tab, w, h); - - f = fopen(filename, "wb"); - fprintf(f, "P5\n%d %d\n%d\n", w, (h * 3) / 2, 255); - fwrite(lum_tab, 1, w * h, f); - h2 = h / 2; - w2 = w / 2; - cb = cb_tab; - cr = cr_tab; - for (i = 0; i < h2; i++) { - fwrite(cb, 1, w2, f); - fwrite(cr, 1, w2, f); - cb += w2; - cr += w2; - } - fclose(f); - - free(lum_tab); - free(cb_tab); - free(cr_tab); -} - -static unsigned char *rgb_tab; -static int width, height, wrap; - -static void put_pixel(int x, int y, int r, int g, int b) -{ - unsigned char *p; - - if (x < 0 || x >= width || - y < 0 || y >= height) - return; - - p = rgb_tab + y * wrap + x * 3; - p[0] = r; - p[1] = g; - p[2] = b; -} +#include "utils.c" static unsigned int myrnd(unsigned int *seed_ptr, int n) { -- 1.7.1 From diego at biurrun.de Sat May 5 16:42:15 2012 From: diego at biurrun.de (Diego Biurrun) Date: Sat, 05 May 2012 16:42:15 +0200 Subject: [libav-devel] [PATCH] rtpdec_h264: cosmetic cleanup In-Reply-To: <1336225931-69056-1-git-send-email-martin@martin.st> References: <1336225931-69056-1-git-send-email-martin@martin.st> Message-ID: <1336228935-16970-1-git-send-email-diego@biurrun.de> From: Martin Storsj? Add/fix spacing, split long lines, align assignments where suitable. Signed-off-by: Diego Biurrun --- libavformat/rtpdec_h264.c | 137 +++++++++++++++++++++++---------------------- 1 files changed, 71 insertions(+), 66 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 228bab0..27ab7be 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -57,8 +57,8 @@ struct PayloadContext { #endif }; -static int sdp_parse_fmtp_config_h264(AVStream * stream, - PayloadContext * h264_data, +static int sdp_parse_fmtp_config_h264(AVStream *stream, + PayloadContext *h264_data, char *attr, char *value) { AVCodecContext *codec = stream->codec; @@ -86,24 +86,28 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, uint8_t profile_iop; uint8_t level_idc; - buffer[0] = value[0]; buffer[1] = value[1]; buffer[2] = '\0'; + buffer[0] = value[0]; + buffer[1] = value[1]; + buffer[2] = '\0'; profile_idc = strtol(buffer, NULL, 16); - buffer[0] = value[2]; buffer[1] = value[3]; + buffer[0] = value[2]; + buffer[1] = value[3]; profile_iop = strtol(buffer, NULL, 16); - buffer[0] = value[4]; buffer[1] = value[5]; - level_idc = strtol(buffer, NULL, 16); + buffer[0] = value[4]; + buffer[1] = value[5]; + level_idc = strtol(buffer, NULL, 16); av_log(codec, AV_LOG_DEBUG, "RTP Profile IDC: %x Profile IOP: %x Level: %x\n", profile_idc, profile_iop, level_idc); h264_data->profile_idc = profile_idc; h264_data->profile_iop = profile_iop; - h264_data->level_idc = level_idc; + h264_data->level_idc = level_idc; } - } else if (!strcmp(attr, "sprop-parameter-sets")) { + } else if (!strcmp(attr, "sprop-parameter-sets")) { uint8_t start_sequence[] = { 0, 0, 0, 1 }; - codec->extradata_size= 0; - codec->extradata= NULL; + codec->extradata_size = 0; + codec->extradata = NULL; while (*value) { char base64packet[1024]; @@ -120,49 +124,48 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, if (*value == ',') value++; - packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet)); + packet_size = av_base64_decode(decoded_packet, base64packet, + sizeof(decoded_packet)); if (packet_size > 0) { uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) + - codec->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); - if(dest) - { - if(codec->extradata_size) - { + codec->extradata_size + + FF_INPUT_BUFFER_PADDING_SIZE); + if (dest) { + if (codec->extradata_size) { memcpy(dest, codec->extradata, codec->extradata_size); av_free(codec->extradata); } - memcpy(dest+codec->extradata_size, start_sequence, sizeof(start_sequence)); - memcpy(dest+codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size); - memset(dest+codec->extradata_size+sizeof(start_sequence)+ + memcpy(dest + codec->extradata_size, start_sequence, + sizeof(start_sequence)); + memcpy(dest + codec->extradata_size + sizeof(start_sequence), + decoded_packet, packet_size); + memset(dest + codec->extradata_size + sizeof(start_sequence) + packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); - codec->extradata= dest; - codec->extradata_size+= sizeof(start_sequence)+packet_size; + codec->extradata = dest; + codec->extradata_size += sizeof(start_sequence) + packet_size; } else { - av_log(codec, AV_LOG_ERROR, "Unable to allocate memory for extradata!"); + av_log(codec, AV_LOG_ERROR, + "Unable to allocate memory for extradata!"); return AVERROR(ENOMEM); } } } - av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!", codec->extradata, codec->extradata_size); + av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!", + codec->extradata, codec->extradata_size); } return 0; } // return 0 on packet, no more left, 1 on packet, 1 on partial packet -static int h264_handle_packet(AVFormatContext *ctx, - PayloadContext *data, - AVStream *st, - AVPacket * pkt, - uint32_t * timestamp, - const uint8_t * buf, - int len, int flags) +static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, + AVStream *st, AVPacket *pkt, uint32_t *timestamp, + const uint8_t *buf, int len, int flags) { uint8_t nal; uint8_t type; - int result= 0; + int result = 0; uint8_t start_sequence[] = { 0, 0, 0, 1 }; if (!len) { @@ -182,9 +185,9 @@ static int h264_handle_packet(AVFormatContext *ctx, switch (type) { case 0: // undefined, but pass them through case 1: - av_new_packet(pkt, len+sizeof(start_sequence)); + av_new_packet(pkt, len + sizeof(start_sequence)); memcpy(pkt->data, start_sequence, sizeof(start_sequence)); - memcpy(pkt->data+sizeof(start_sequence), buf, len); + memcpy(pkt->data + sizeof(start_sequence), buf, len); #ifdef DEBUG data->packet_types_received[nal & 0x1f]++; #endif @@ -196,35 +199,35 @@ static int h264_handle_packet(AVFormatContext *ctx, len--; // first we are going to figure out the total size { - int pass= 0; - int total_length= 0; - uint8_t *dst= NULL; + int pass = 0; + int total_length = 0; + uint8_t *dst = NULL; - for(pass= 0; pass<2; pass++) { - const uint8_t *src= buf; - int src_len= len; + for (pass = 0; pass < 2; pass++) { + const uint8_t *src = buf; + int src_len = len; while (src_len > 2) { uint16_t nal_size = AV_RB16(src); // consume the length of the aggregate - src += 2; + src += 2; src_len -= 2; if (nal_size <= src_len) { - if(pass==0) { + if (pass == 0) { // counting - total_length+= sizeof(start_sequence)+nal_size; + total_length += sizeof(start_sequence) + nal_size; } else { // copying assert(dst); memcpy(dst, start_sequence, sizeof(start_sequence)); - dst+= sizeof(start_sequence); + dst += sizeof(start_sequence); memcpy(dst, src, nal_size); #ifdef DEBUG data->packet_types_received[*src & 0x1f]++; #endif - dst+= nal_size; + dst += nal_size; } } else { av_log(ctx, AV_LOG_ERROR, @@ -232,7 +235,7 @@ static int h264_handle_packet(AVFormatContext *ctx, } // eat what we handled - src += nal_size; + src += nal_size; src_len -= nal_size; if (src_len < 0) @@ -240,13 +243,13 @@ static int h264_handle_packet(AVFormatContext *ctx, "Consumed more bytes than we got! (%d)\n", src_len); } - if(pass==0) { + if (pass == 0) { /* now we know the total size of the packet (with the * start sequences added) */ av_new_packet(pkt, total_length); - dst= pkt->data; + dst = pkt->data; } else { - assert(dst-pkt->data==total_length); + assert(dst - pkt->data == total_length); } } } @@ -267,17 +270,17 @@ static int h264_handle_packet(AVFormatContext *ctx, len--; // skip the fu_indicator if (len > 1) { // these are the same as above, we just redo them here for clarity - uint8_t fu_indicator = nal; - uint8_t fu_header = *buf; - uint8_t start_bit = fu_header >> 7; + uint8_t fu_indicator = nal; + uint8_t fu_header = *buf; + uint8_t start_bit = fu_header >> 7; uint8_t av_unused end_bit = (fu_header & 0x40) >> 6; - uint8_t nal_type = (fu_header & 0x1f); + uint8_t nal_type = fu_header & 0x1f; uint8_t reconstructed_nal; // Reconstruct this packet's true nal; only the data follows. /* The original nal forbidden bit and NRI are stored in this * packet's nal. */ - reconstructed_nal = fu_indicator & (0xe0); + reconstructed_nal = fu_indicator & 0xe0; reconstructed_nal |= nal_type; // skip the fu_header @@ -288,12 +291,12 @@ static int h264_handle_packet(AVFormatContext *ctx, if (start_bit) data->packet_types_received[nal_type]++; #endif - if(start_bit) { + if (start_bit) { /* copy in the start sequence, and the reconstructed nal */ - av_new_packet(pkt, sizeof(start_sequence)+sizeof(nal)+len); + av_new_packet(pkt, sizeof(start_sequence) + sizeof(nal) + len); memcpy(pkt->data, start_sequence, sizeof(start_sequence)); - pkt->data[sizeof(start_sequence)]= reconstructed_nal; - memcpy(pkt->data+sizeof(start_sequence)+sizeof(nal), buf, len); + pkt->data[sizeof(start_sequence)] = reconstructed_nal; + memcpy(pkt->data + sizeof(start_sequence) + sizeof(nal), buf, len); } else { av_new_packet(pkt, len); memcpy(pkt->data, buf, len); @@ -348,25 +351,27 @@ static int parse_h264_sdp_line(AVFormatContext *s, int st_index, return 0; stream = s->streams[st_index]; - codec = stream->codec; + codec = stream->codec; if (av_strstart(p, "framesize:", &p)) { char buf1[50]; char *dst = buf1; // remove the protocol identifier - while (*p && *p == ' ') p++; // strip spaces. - while (*p && *p != ' ') p++; // eat protocol identifier - while (*p && *p == ' ') p++; // strip trailing spaces. - while (*p && *p != '-' && (dst - buf1) < sizeof(buf1) - 1) { + while (*p && *p == ' ') + p++; // strip spaces. + while (*p && *p != ' ') + p++; // eat protocol identifier + while (*p && *p == ' ') + p++; // strip trailing spaces. + while (*p && *p != '-' && (dst - buf1) < sizeof(buf1) - 1) *dst++ = *p++; - } *dst = '\0'; // a='framesize:96 320-240' // set our parameters - codec->width = atoi(buf1); - codec->height = atoi(p + 1); // skip the - + codec->width = atoi(buf1); + codec->height = atoi(p + 1); // skip the - codec->pix_fmt = PIX_FMT_YUV420P; } else if (av_strstart(p, "fmtp:", &p)) { return ff_parse_fmtp(stream, h264_data, p, sdp_parse_fmtp_config_h264); -- 1.7.1 From diego at biurrun.de Sat May 5 16:43:40 2012 From: diego at biurrun.de (Diego Biurrun) Date: Sat, 05 May 2012 16:43:40 +0200 Subject: [libav-devel] [PATCH 5/7] rtpdec_h264: Make start_sequence a static const array In-Reply-To: <1336217626-67994-5-git-send-email-martin@martin.st> References: <1336217626-67994-1-git-send-email-martin@martin.st> <1336217626-67994-5-git-send-email-martin@martin.st> Message-ID: <20120505144340.GC13934@pool.informatik.rwth-aachen.de> On Sat, May 05, 2012 at 02:33:44PM +0300, Martin Storsj? wrote: > --- > Already OK'd by Luca. LGTM as well... Diego From diego at biurrun.de Sat May 5 16:44:13 2012 From: diego at biurrun.de (Diego Biurrun) Date: Sat, 05 May 2012 16:44:13 +0200 Subject: [libav-devel] [PATCH 4/7] rtpdec_h264: Cleanup debug packet type counting In-Reply-To: <1336217626-67994-4-git-send-email-martin@martin.st> References: <1336217626-67994-1-git-send-email-martin@martin.st> <1336217626-67994-4-git-send-email-martin@martin.st> Message-ID: <20120505144413.GD13934@pool.informatik.rwth-aachen.de> On Sat, May 05, 2012 at 02:33:43PM +0300, Martin Storsj? wrote: > --- > Already OK'd by Luca. LGTM as well. Diego From diego at biurrun.de Sat May 5 16:44:58 2012 From: diego at biurrun.de (Diego Biurrun) Date: Sat, 05 May 2012 16:44:58 +0200 Subject: [libav-devel] [PATCH 7/7] rtpdec_h264: Reorder code blocks In-Reply-To: <1336217626-67994-7-git-send-email-martin@martin.st> References: <1336217626-67994-1-git-send-email-martin@martin.st> <1336217626-67994-7-git-send-email-martin@martin.st> Message-ID: <20120505144458.GE13934@pool.informatik.rwth-aachen.de> On Sat, May 05, 2012 at 02:33:46PM +0300, Martin Storsj? wrote: > This removes one level of indentation. > --- > Already OK'd by Luca. LGTM as well. Diego From diego at biurrun.de Sat May 5 16:45:44 2012 From: diego at biurrun.de (Diego Biurrun) Date: Sat, 05 May 2012 16:45:44 +0200 Subject: [libav-devel] [PATCH 6/7] rtpdec_h264: Replace sizeof(start_sequence) with a macro In-Reply-To: <1336217626-67994-6-git-send-email-martin@martin.st> References: <1336217626-67994-1-git-send-email-martin@martin.st> <1336217626-67994-6-git-send-email-martin@martin.st> Message-ID: <20120505144544.GF13934@pool.informatik.rwth-aachen.de> On Sat, May 05, 2012 at 02:33:45PM +0300, Martin Storsj? wrote: > This makes the code slightly more readable at places where this > is used a lot, although I guess this is very subjective. > --- > Already OK'd by Luca. This does admittedly feel a bit silly to me, but if you prefer it.. Diego From mans at mansr.com Sat May 5 16:56:58 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Sat, 05 May 2012 15:56:58 +0100 Subject: [libav-devel] [PATCH] tests: Refactor rotozoom/videogen common code into a separate file. In-Reply-To: <1336228275-15459-1-git-send-email-diego@biurrun.de> (Diego Biurrun's message of "Sat, 05 May 2012 16:31:15 +0200") References: <1336228275-15459-1-git-send-email-diego@biurrun.de> Message-ID: Diego Biurrun writes: > --- > tests/Makefile | 3 + > tests/rotozoom.c | 126 +---------------------------------------------- > tests/utils.c | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/videogen.c | 129 +------------------------------------------------ > 4 files changed, 150 insertions(+), 252 deletions(-) > create mode 100644 tests/utils.c LGTM -- M?ns Rullg?rd mans at mansr.com From martin at martin.st Sat May 5 17:10:25 2012 From: martin at martin.st (=?ISO-8859-15?Q?Martin_Storsj=F6?=) Date: Sat, 5 May 2012 18:10:25 +0300 (EEST) Subject: [libav-devel] [PATCH] rtpdec_h264: cosmetic cleanup In-Reply-To: <1336228935-16970-1-git-send-email-diego@biurrun.de> References: <1336225931-69056-1-git-send-email-martin@martin.st> <1336228935-16970-1-git-send-email-diego@biurrun.de> Message-ID: On Sat, 5 May 2012, Diego Biurrun wrote: > From: Martin Storsj? > > Add/fix spacing, split long lines, align assignments where suitable. > > Signed-off-by: Diego Biurrun > --- > libavformat/rtpdec_h264.c | 137 +++++++++++++++++++++++---------------------- > 1 files changed, 71 insertions(+), 66 deletions(-) LGTM // Martin From diego at biurrun.de Sat May 5 17:12:13 2012 From: diego at biurrun.de (Diego Biurrun) Date: Sat, 05 May 2012 17:12:13 +0200 Subject: [libav-devel] [PATCH] test programs: don't ignore the return value of fwrite() In-Reply-To: References: <1335395027-16446-1-git-send-email-gseanmcg@gmail.com> <1335466584-7087-1-git-send-email-gseanmcg@gmail.com> <20120504162750.GD1847@pool.informatik.rwth-aachen.de> Message-ID: <20120505151213.GG13934@pool.informatik.rwth-aachen.de> On Fri, May 04, 2012 at 01:03:22PM -0400, Sean McGovern wrote: > On Friday, May 4, 2012, Diego Biurrun wrote: > > On Thu, May 03, 2012 at 11:32:24PM -0400, Sean McGovern wrote: > >> On 4/26/12, Sean McGovern wrote: > >> > --- > >> > tests/rotozoom.c | 15 ++++++++++++--- > >> > tests/videogen.c | 15 ++++++++++++--- > >> > 2 files changed, 24 insertions(+), 6 deletions(-) > >> > > >> > diff --git a/tests/rotozoom.c b/tests/rotozoom.c > >> > index 9ce45cd..d9cfb42 100644 > >> > --- a/tests/rotozoom.c > >> > +++ b/tests/rotozoom.c > >> > >> Ping. > > > > The patch is good, I could queue it tomorrow. It does, however, conflict > > with the code duplication refactoring patch I just sent for these > programs. > > > > Applying your patch on top of mine would be somewhat more elegant and > > simple. > > I have no problem with depending on your patch. Do you need me to rebase or > can you do that? I'll push my patch in a moment and then try to rebase yours on top of mine in the next days. If you want to beat me to it, feel free... Diego From derek.buitenhuis at gmail.com Sat May 5 18:36:11 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Sat, 05 May 2012 12:36:11 -0400 Subject: [libav-devel] [PATCH 4/4] eatgv: check vector_bits In-Reply-To: <20120505130940.GA3403@kst-acer> References: <20120505130940.GA3403@kst-acer> Message-ID: <4FA556FB.9060307@gmail.com> On 05/05/2012 9:09 AM, Michael Niedermayer wrote: > + av_log(s->avctx, AV_LOG_ERROR, "vector_bits %d invalid\n", vector_bits); Could certainly use a better messages, but LGTM in general. Also, whoever pushes this: please make sure to amend the author to not be: "Michael Niedermayer ". - Derek From kostya.shishkov at gmail.com Sat May 5 18:45:37 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Sat, 5 May 2012 18:45:37 +0200 Subject: [libav-devel] [PATCH 4/4] eatgv: check vector_bits In-Reply-To: <4FA556FB.9060307@gmail.com> References: <20120505130940.GA3403@kst-acer> <4FA556FB.9060307@gmail.com> Message-ID: <20120505164537.GA23507@kst-acer> On Sat, May 05, 2012 at 12:36:11PM -0400, Derek Buitenhuis wrote: > On 05/05/2012 9:09 AM, Michael Niedermayer wrote: > > + av_log(s->avctx, AV_LOG_ERROR, "vector_bits %d invalid\n", vector_bits); > > Could certainly use a better messages, but LGTM in general. Feel free to propose one, I can amend it. > Also, whoever pushes this: please make sure to amend the author to not > be: "Michael Niedermayer ". It's just my mailer changed the address. Also since it's probably me who would commit it, no problem. From martin at martin.st Sat May 5 19:09:37 2012 From: martin at martin.st (=?ISO-8859-15?Q?Martin_Storsj=F6?=) Date: Sat, 5 May 2012 20:09:37 +0300 (EEST) Subject: [libav-devel] [PATCH] rtmp: Support 'rtmp_live', an option which specifies if the media is a live stream. In-Reply-To: <1336037368-1650-1-git-send-email-samuel.pitoiset@gmail.com> References: <1336037368-1650-1-git-send-email-samuel.pitoiset@gmail.com> Message-ID: On Thu, 3 May 2012, Samuel Pitoiset wrote: > --- > libavformat/rtmpproto.c | 8 +++++++- > 1 files changed, 7 insertions(+), 1 deletions(-) > > diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c > index 9cdb639..d6be546 100644 > --- a/libavformat/rtmpproto.c > +++ b/libavformat/rtmpproto.c > @@ -66,6 +66,7 @@ typedef struct RTMPContext { > int chunk_size; ///< size of the chunks RTMP packets are divided into > int is_input; ///< input/output flag > char *playpath; ///< stream identifier to play (with possible "mp4:" prefix) > + int live; ///< 0: recorded, -1: live, -2: both > char *app; ///< name of application > ClientState state; ///< current state > int main_channel_id; ///< an additional channel ID which is used for some invocations > @@ -287,7 +288,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) > > av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", rt->playpath); > ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, > - 20 + strlen(rt->playpath)); > + 32 + strlen(rt->playpath)); This should be 29, otherwise we send 3 undefined bytes giving weird issues (it took me a while to realize what was wrong)... Other than that, looks good to me, tested it to work as intended. // Martin From martin at martin.st Sat May 5 19:15:54 2012 From: martin at martin.st (=?ISO-8859-15?Q?Martin_Storsj=F6?=) Date: Sat, 5 May 2012 20:15:54 +0300 (EEST) Subject: [libav-devel] [PATCH] rtmp: Support 'rtmp_live', an option which specifies if the media is a live stream. In-Reply-To: <1336037368-1650-1-git-send-email-samuel.pitoiset@gmail.com> References: <1336037368-1650-1-git-send-email-samuel.pitoiset@gmail.com> Message-ID: On Thu, 3 May 2012, Samuel Pitoiset wrote: > --- > libavformat/rtmpproto.c | 8 +++++++- > 1 files changed, 7 insertions(+), 1 deletions(-) > > diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c > index 9cdb639..d6be546 100644 > --- a/libavformat/rtmpproto.c > +++ b/libavformat/rtmpproto.c > @@ -66,6 +66,7 @@ typedef struct RTMPContext { > int chunk_size; ///< size of the chunks RTMP packets are divided into > int is_input; ///< input/output flag > char *playpath; ///< stream identifier to play (with possible "mp4:" prefix) > + int live; ///< 0: recorded, -1: live, -2: both > char *app; ///< name of application > ClientState state; ///< current state > int main_channel_id; ///< an additional channel ID which is used for some invocations > @@ -287,7 +288,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) > > av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", rt->playpath); > ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, > - 20 + strlen(rt->playpath)); > + 32 + strlen(rt->playpath)); > pkt.extra = rt->main_channel_id; > > p = pkt.data; > @@ -295,6 +296,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) > ff_amf_write_number(&p, ++rt->nb_invokes); > ff_amf_write_null(&p); > ff_amf_write_string(&p, rt->playpath); > + ff_amf_write_number(&p, rt->live); > > ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]); > ff_rtmp_packet_destroy(&pkt); > @@ -1050,6 +1052,10 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size) > > static const AVOption rtmp_options[] = { > {"rtmp_app", "Name of application to connect to on the RTMP server", OFFSET(app), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, > + {"rtmp_live", "Specify that the media is a live stream.", OFFSET(live), AV_OPT_TYPE_FLAGS, {-2}, INT_MIN, INT_MAX, DEC, "rtmp_live"}, Almost forgot - I think rather should be AV_OPT_TYPE_INT - you can still use the named constants, but I think it changes the behaviour slightly to better match this case. // Martin From martin at martin.st Sat May 5 19:30:57 2012 From: martin at martin.st (=?ISO-8859-15?Q?Martin_Storsj=F6?=) Date: Sat, 5 May 2012 20:30:57 +0300 (EEST) Subject: [libav-devel] [PATCH 1/7] rtpdec_h264: Convert commented out code into setting an unused variable In-Reply-To: <1336217626-67994-1-git-send-email-martin@martin.st> References: <1336217626-67994-1-git-send-email-martin@martin.st> Message-ID: On Sat, 5 May 2012, Martin Storsj? wrote: > It is worth keeping instead of removing, in case reading this > bit becomes necessary at some later point. > --- > libavformat/rtpdec_h264.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c > index 399ca47..505bc81 100644 > --- a/libavformat/rtpdec_h264.c > +++ b/libavformat/rtpdec_h264.c > @@ -265,7 +265,7 @@ static int h264_handle_packet(AVFormatContext *ctx, > uint8_t fu_indicator = nal; > uint8_t fu_header = *buf; > uint8_t start_bit = fu_header >> 7; > -// uint8_t end_bit = (fu_header & 0x40) >> 6; > + uint8_t av_unused end_bit = (fu_header & 0x40) >> 6; > uint8_t nal_type = (fu_header & 0x1f); > uint8_t reconstructed_nal; > > -- > 1.7.9.4 OKd by Anton and Kostya on irc. // Martin From samuel.pitoiset at gmail.com Sat May 5 19:33:26 2012 From: samuel.pitoiset at gmail.com (Samuel Pitoiset) Date: Sat, 5 May 2012 19:33:26 +0200 Subject: [libav-devel] [PATCH] rtmp: Support 'rtmp_live', an option which specifies if the media is a live stream. In-Reply-To: References: Message-ID: <1336239206-1481-1-git-send-email-samuel.pitoiset@gmail.com> --- libavformat/rtmpproto.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 9cdb639..9c82b46 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -66,6 +66,7 @@ typedef struct RTMPContext { int chunk_size; ///< size of the chunks RTMP packets are divided into int is_input; ///< input/output flag char *playpath; ///< stream identifier to play (with possible "mp4:" prefix) + int live; ///< 0: recorded, -1: live, -2: both char *app; ///< name of application ClientState state; ///< current state int main_channel_id; ///< an additional channel ID which is used for some invocations @@ -287,7 +288,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", rt->playpath); ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, - 20 + strlen(rt->playpath)); + 29 + strlen(rt->playpath)); pkt.extra = rt->main_channel_id; p = pkt.data; @@ -295,6 +296,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) ff_amf_write_number(&p, ++rt->nb_invokes); ff_amf_write_null(&p); ff_amf_write_string(&p, rt->playpath); + ff_amf_write_number(&p, rt->live); ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]); ff_rtmp_packet_destroy(&pkt); @@ -1050,6 +1052,10 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size) static const AVOption rtmp_options[] = { {"rtmp_app", "Name of application to connect to on the RTMP server", OFFSET(app), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, + {"rtmp_live", "Specify that the media is a live stream.", OFFSET(live), AV_OPT_TYPE_INT, {-2}, INT_MIN, INT_MAX, DEC, "rtmp_live"}, + {"any", "both", 0, AV_OPT_TYPE_CONST, {-2}, 0, 0, DEC, "rtmp_live"}, + {"live", "live stream", 0, AV_OPT_TYPE_CONST, {-1}, 0, 0, DEC, "rtmp_live"}, + {"recorded", "recorded stream", 0, AV_OPT_TYPE_CONST, {0}, 0, 0, DEC, "rtmp_live"}, {"rtmp_playpath", "Stream identifier to play or to publish", OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, { NULL }, }; -- 1.7.7.5 (Apple Git-26) From martin at martin.st Sat May 5 19:44:15 2012 From: martin at martin.st (=?ISO-8859-15?Q?Martin_Storsj=F6?=) Date: Sat, 5 May 2012 20:44:15 +0300 (EEST) Subject: [libav-devel] [PATCH 6/7] rtpdec_h264: Replace sizeof(start_sequence) with a macro In-Reply-To: <20120505144544.GF13934@pool.informatik.rwth-aachen.de> References: <1336217626-67994-1-git-send-email-martin@martin.st> <1336217626-67994-6-git-send-email-martin@martin.st> <20120505144544.GF13934@pool.informatik.rwth-aachen.de> Message-ID: On Sat, 5 May 2012, Diego Biurrun wrote: > On Sat, May 05, 2012 at 02:33:45PM +0300, Martin Storsj? wrote: >> This makes the code slightly more readable at places where this >> is used a lot, although I guess this is very subjective. >> --- >> Already OK'd by Luca. > > This does admittedly feel a bit silly to me, but if you prefer it.. Pushed the other ones (including your version of the cosmetic cleanup), leaving out this one for now since I'm not sure it's really any better, and the unreadable code blocks probably can be fixed in other ways instead. // Martin From martin at martin.st Sat May 5 19:50:08 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 20:50:08 +0300 Subject: [libav-devel] [PATCH 1/2] rtpdec_h264: Free old extradata before clearing the pointer Message-ID: <1336240209-85030-1-git-send-email-martin@martin.st> This avoids memory leaks if there actually was some extradata set before. --- libavformat/rtpdec_h264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 784c5ec..6efab54 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -114,7 +114,7 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream, } } else if (!strcmp(attr, "sprop-parameter-sets")) { codec->extradata_size = 0; - codec->extradata = NULL; + av_freep(&codec->extradata); while (*value) { char base64packet[1024]; -- 1.7.9.4 From martin at martin.st Sat May 5 19:50:09 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sat, 5 May 2012 20:50:09 +0300 Subject: [libav-devel] [PATCH 2/2] rtpdec_h264: Add missing newlines to av_log calls In-Reply-To: <1336240209-85030-1-git-send-email-martin@martin.st> References: <1336240209-85030-1-git-send-email-martin@martin.st> Message-ID: <1336240209-85030-2-git-send-email-martin@martin.st> --- libavformat/rtpdec_h264.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 6efab54..829053a 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -85,7 +85,7 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream, */ if (h264_data->packetization_mode > 1) av_log(codec, AV_LOG_ERROR, - "Interleaved RTP mode is not supported yet."); + "Interleaved RTP mode is not supported yet.\n"); } else if (!strcmp(attr, "profile-level-id")) { if (strlen(value) == 6) { char buffer[3]; @@ -139,7 +139,7 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream, FF_INPUT_BUFFER_PADDING_SIZE); if (!dest) { av_log(codec, AV_LOG_ERROR, - "Unable to allocate memory for extradata!"); + "Unable to allocate memory for extradata!\n"); return AVERROR(ENOMEM); } if (codec->extradata_size) { @@ -158,7 +158,7 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream, codec->extradata_size += sizeof(start_sequence) + packet_size; } } - av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!", + av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!\n", codec->extradata, codec->extradata_size); } return 0; @@ -309,7 +309,7 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, case 30: // undefined case 31: // undefined default: - av_log(ctx, AV_LOG_ERROR, "Undefined type (%d)", type); + av_log(ctx, AV_LOG_ERROR, "Undefined type (%d)\n", type); result = AVERROR_INVALIDDATA; break; } -- 1.7.9.4 From lu_zero at gentoo.org Sat May 5 20:21:33 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Sat, 05 May 2012 11:21:33 -0700 Subject: [libav-devel] [PATCH 1/4] dfa: add some checks to ensure that decoder won't write past frame end In-Reply-To: <20120505130836.GA3295@kst-acer> References: <20120505130836.GA3295@kst-acer> Message-ID: <4FA56FAD.6060605@gentoo.org> On 05/05/12 06:08, Kostya Shishkov wrote: > --- > libavcodec/dfa.c | 8 +++++++- > 1 files changed, 7 insertions(+), 1 deletions(-) > While you are it could you please use AVERROR? Beside that patch ok. lu -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sat May 5 20:21:54 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Sat, 05 May 2012 11:21:54 -0700 Subject: [libav-devel] [PATCH 3/4] eatgv: check motion vectors In-Reply-To: <20120505130917.GA3367@kst-acer> References: <20120505130917.GA3367@kst-acer> Message-ID: <4FA56FC2.5010809@gentoo.org> On 05/05/12 06:09, Kostya Shishkov wrote: > --- > libavcodec/eatgv.c | 14 ++++++++------ > 1 files changed, 8 insertions(+), 6 deletions(-) Ok. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sat May 5 20:25:14 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Sat, 05 May 2012 11:25:14 -0700 Subject: [libav-devel] [PATCH 1/2] rtpdec_h264: Free old extradata before clearing the pointer In-Reply-To: <1336240209-85030-1-git-send-email-martin@martin.st> References: <1336240209-85030-1-git-send-email-martin@martin.st> Message-ID: <4FA5708A.5000106@gentoo.org> On 05/05/12 10:50, Martin Storsj? wrote: > This avoids memory leaks if there actually was some extradata > set before. > --- Ok. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sat May 5 20:25:24 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Sat, 05 May 2012 11:25:24 -0700 Subject: [libav-devel] [PATCH 2/2] rtpdec_h264: Add missing newlines to av_log calls In-Reply-To: <1336240209-85030-2-git-send-email-martin@martin.st> References: <1336240209-85030-1-git-send-email-martin@martin.st> <1336240209-85030-2-git-send-email-martin@martin.st> Message-ID: <4FA57094.1080809@gentoo.org> On 05/05/12 10:50, Martin Storsj? wrote: > --- > libavformat/rtpdec_h264.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) Ok. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From mans at mansr.com Sun May 6 00:38:26 2012 From: mans at mansr.com (Mans Rullgard) Date: Sat, 5 May 2012 23:38:26 +0100 Subject: [libav-devel] [PATCH 1/2] mips: intreadwrite: remove unnecessary inline asm Message-ID: <1336257507-14627-1-git-send-email-mans@mansr.com> GCC actually handles unaligned accesses correctly in all cases except, absurdly, 32-bit loads on mips64. The remaining asm is thus not needed, and removing it results in better code. Signed-off-by: Mans Rullgard --- libavutil/mips/intreadwrite.h | 59 ++--------------------------------------- 1 file changed, 2 insertions(+), 57 deletions(-) diff --git a/libavutil/mips/intreadwrite.h b/libavutil/mips/intreadwrite.h index 0e0cc06..d0c558f 100644 --- a/libavutil/mips/intreadwrite.h +++ b/libavutil/mips/intreadwrite.h @@ -24,7 +24,7 @@ #include #include "config.h" -#if HAVE_INLINE_ASM +#if ARCH_MIPS64 && HAVE_INLINE_ASM #define AV_RN32 AV_RN32 static av_always_inline uint32_t AV_RN32(const void *p) @@ -38,61 +38,6 @@ static av_always_inline uint32_t AV_RN32(const void *p) return v; } -#define AV_WN32 AV_WN32 -static av_always_inline void AV_WN32(void *p, uint32_t v) -{ - __asm__ ("swl %2, %0 \n\t" - "swr %2, %1 \n\t" - : "=m"(*(uint32_t *)((uint8_t *)p+3*!HAVE_BIGENDIAN)), - "=m"(*(uint32_t *)((uint8_t *)p+3*HAVE_BIGENDIAN)) - : "r"(v)); -} - -#if ARCH_MIPS64 - -#define AV_RN64 AV_RN64 -static av_always_inline uint64_t AV_RN64(const void *p) -{ - uint64_t v; - __asm__ ("ldl %0, %1 \n\t" - "ldr %0, %2 \n\t" - : "=&r"(v) - : "m"(*(const uint64_t *)((const uint8_t *)p+7*!HAVE_BIGENDIAN)), - "m"(*(const uint64_t *)((const uint8_t *)p+7*HAVE_BIGENDIAN))); - return v; -} - -#define AV_WN64 AV_WN64 -static av_always_inline void AV_WN64(void *p, uint64_t v) -{ - __asm__ ("sdl %2, %0 \n\t" - "sdr %2, %1 \n\t" - : "=m"(*(uint64_t *)((uint8_t *)p+7*!HAVE_BIGENDIAN)), - "=m"(*(uint64_t *)((uint8_t *)p+7*HAVE_BIGENDIAN)) - : "r"(v)); -} - -#else - -#define AV_RN64 AV_RN64 -static av_always_inline uint64_t AV_RN64(const void *p) -{ - union { uint64_t v; uint32_t hl[2]; } v; - v.hl[0] = AV_RN32(p); - v.hl[1] = AV_RN32((const uint8_t *)p + 4); - return v.v; -} - -#define AV_WN64 AV_WN64 -static av_always_inline void AV_WN64(void *p, uint64_t v) -{ - union { uint64_t v; uint32_t hl[2]; } vv = { v }; - AV_WN32(p, vv.hl[0]); - AV_WN32((uint8_t *)p + 4, vv.hl[1]); -} - -#endif /* ARCH_MIPS64 */ - -#endif /* HAVE_INLINE_ASM */ +#endif /* ARCH_MIPS64 && HAVE_INLINE_ASM */ #endif /* AVUTIL_MIPS_INTREADWRITE_H */ -- 1.7.10 From mans at mansr.com Sun May 6 00:38:27 2012 From: mans at mansr.com (Mans Rullgard) Date: Sat, 5 May 2012 23:38:27 +0100 Subject: [libav-devel] [PATCH 2/2] mips: intreadwrite: fix inline asm for gcc 4.8 In-Reply-To: <1336257507-14627-1-git-send-email-mans@mansr.com> References: <1336257507-14627-1-git-send-email-mans@mansr.com> Message-ID: <1336257507-14627-2-git-send-email-mans@mansr.com> Just like gcc 4.6 and later on ARM, gcc 4.8 on MIPS generates inefficient code when a known-unaligned location is used as a memory input operand. This applies the same fix as has been previously done to the ARM version of the code. Signed-off-by: Mans Rullgard --- libavutil/mips/intreadwrite.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavutil/mips/intreadwrite.h b/libavutil/mips/intreadwrite.h index d0c558f..4dabbe6 100644 --- a/libavutil/mips/intreadwrite.h +++ b/libavutil/mips/intreadwrite.h @@ -29,12 +29,15 @@ #define AV_RN32 AV_RN32 static av_always_inline uint32_t AV_RN32(const void *p) { + struct __attribute__((packed)) u32 { uint32_t v; }; + const uint8_t *q = p; + const struct u32 *pl = (const struct u32 *)(q + 3 * !HAVE_BIGENDIAN); + const struct u32 *pr = (const struct u32 *)(q + 3 * HAVE_BIGENDIAN); uint32_t v; __asm__ ("lwl %0, %1 \n\t" "lwr %0, %2 \n\t" : "=&r"(v) - : "m"(*(const uint32_t *)((const uint8_t *)p+3*!HAVE_BIGENDIAN)), - "m"(*(const uint32_t *)((const uint8_t *)p+3*HAVE_BIGENDIAN))); + : "m"(*pl), "m"(*pr)); return v; } -- 1.7.10 From derek.buitenhuis at gmail.com Sun May 6 01:45:11 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Sat, 05 May 2012 19:45:11 -0400 Subject: [libav-devel] [PATCH 4/4] eatgv: check vector_bits In-Reply-To: <20120505164537.GA23507@kst-acer> References: <20120505130940.GA3403@kst-acer> <4FA556FB.9060307@gmail.com> <20120505164537.GA23507@kst-acer> Message-ID: <4FA5BB87.4040809@gmail.com> On 05/05/2012 12:45 PM, Kostya Shishkov wrote: >>> + av_log(s->avctx, AV_LOG_ERROR, "vector_bits %d invalid\n", vector_bits); >> > >> > Could certainly use a better messages, but LGTM in general. > Feel free to propose one, I can amend it. How does "Out of range value for vector_bits: %d\n" or "Invalid value for vector_bits: %\n" sound? I'm not familiar with the code, so don't know exactly what vector_bits is, so you could probably replace "vector_bits" with what it actually is. - Derek From derek.buitenhuis at gmail.com Sun May 6 01:46:50 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Sat, 05 May 2012 19:46:50 -0400 Subject: [libav-devel] [PATCH 1/2] mips: intreadwrite: remove unnecessary inline asm In-Reply-To: <1336257507-14627-1-git-send-email-mans@mansr.com> References: <1336257507-14627-1-git-send-email-mans@mansr.com> Message-ID: <4FA5BBEA.5040501@gmail.com> On 05/05/2012 6:38 PM, Mans Rullgard wrote: > GCC actually handles unaligned accesses correctly in all cases > except, absurdly, 32-bit loads on mips64. The remaining asm is > thus not needed, and removing it results in better code. Do we care about any other compilers than GCC for mips? - Derek From mans at mansr.com Sun May 6 02:02:01 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Sun, 06 May 2012 01:02:01 +0100 Subject: [libav-devel] [PATCH 1/2] mips: intreadwrite: remove unnecessary inline asm In-Reply-To: <4FA5BBEA.5040501@gmail.com> (Derek Buitenhuis's message of "Sat, 05 May 2012 19:46:50 -0400") References: <1336257507-14627-1-git-send-email-mans@mansr.com> <4FA5BBEA.5040501@gmail.com> Message-ID: Derek Buitenhuis writes: > On 05/05/2012 6:38 PM, Mans Rullgard wrote: >> GCC actually handles unaligned accesses correctly in all cases >> except, absurdly, 32-bit loads on mips64. The remaining asm is >> thus not needed, and removing it results in better code. > > Do we care about any other compilers than GCC for mips? Other compilers don't support gcc inline asm. -- M?ns Rullg?rd mans at mansr.com From derek.buitenhuis at gmail.com Sun May 6 02:07:39 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Sat, 05 May 2012 20:07:39 -0400 Subject: [libav-devel] [PATCH 1/2] mips: intreadwrite: remove unnecessary inline asm In-Reply-To: References: <1336257507-14627-1-git-send-email-mans@mansr.com> <4FA5BBEA.5040501@gmail.com> Message-ID: <4FA5C0CB.50107@gmail.com> On 05/05/2012 8:02 PM, M?ns Rullg?rd wrote: > Other compilers don't support gcc inline asm. Well that's... true. :facepalm: I think it's coffee time. (Also, we might want to care about some embedded gcc forks, but im sure they will support it just fine.) LGTM then. - Derek From mans at mansr.com Sun May 6 02:25:45 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Sun, 06 May 2012 01:25:45 +0100 Subject: [libav-devel] [PATCH 1/2] mips: intreadwrite: remove unnecessary inline asm In-Reply-To: <4FA5C0CB.50107@gmail.com> (Derek Buitenhuis's message of "Sat, 05 May 2012 20:07:39 -0400") References: <1336257507-14627-1-git-send-email-mans@mansr.com> <4FA5BBEA.5040501@gmail.com> <4FA5C0CB.50107@gmail.com> Message-ID: Derek Buitenhuis writes: > On 05/05/2012 8:02 PM, M?ns Rullg?rd wrote: >> Other compilers don't support gcc inline asm. > > Well that's... true. :facepalm: Actually, some non-gcc compilers do try to support gcc inline asm, sometimes even with partial success. I checked clang, and it does the right thing (insofar it works at all for 64-bit) without any extra help. > I think it's coffee time. (Also, we might want to care about > some embedded gcc forks, but im sure they will support it just > fine.) Embedded gcc forks? Note that we don't really care much about MIPS at all. We support it mainly because we can with little extra effort. -- M?ns Rullg?rd mans at mansr.com From derek.buitenhuis at gmail.com Sun May 6 03:56:06 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Sat, 05 May 2012 21:56:06 -0400 Subject: [libav-devel] [PATCH 1/2] mips: intreadwrite: remove unnecessary inline asm In-Reply-To: References: <1336257507-14627-1-git-send-email-mans@mansr.com> <4FA5BBEA.5040501@gmail.com> <4FA5C0CB.50107@gmail.com> Message-ID: <4FA5DA36.9010800@gmail.com> On 05/05/2012 8:25 PM, M?ns Rullg?rd wrote: > Actually, some non-gcc compilers do try to support gcc inline asm, > sometimes even with partial success. I checked clang, and it does the > right thing (insofar it works at all for 64-bit) without any extra help. Interesting. I thought clang's mips stuff was still kinda... bad. >> I think it's coffee time. (Also, we might want to care about >> some embedded gcc forks, but im sure they will support it just >> fine.) > > Embedded gcc forks? I was thinking of CodeSourcery. - Derek From derek.buitenhuis at gmail.com Sun May 6 04:19:34 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Sat, 05 May 2012 22:19:34 -0400 Subject: [libav-devel] [PATCH] zerocodec: check if the previous frame is missing In-Reply-To: <1336154067-4399-1-git-send-email-lu_zero@gentoo.org> References: <4FA409C6.2060003@gmail.com> <1336154067-4399-1-git-send-email-lu_zero@gentoo.org> Message-ID: <4FA5DFB6.2010205@gmail.com> On 04/05/2012 1:54 PM, Luca Barbato wrote: > From: Paul B Mahol > > ZeroCodec relies on the keyframe flag being set in the container, and > prev is the previously decoded frame. A keyframe flags incorrectly set > will lead to this condition. > > Signed-off-by: Paul B Mahol > Signed-off-by: Luca Barbato > --- LGTM. - Derek From kostya.shishkov at gmail.com Sun May 6 09:54:08 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Sun, 6 May 2012 09:54:08 +0200 Subject: [libav-devel] [PATCH 1/4] dfa: add some checks to ensure that decoder won't write past frame end In-Reply-To: <4FA56FAD.6060605@gentoo.org> References: <20120505130836.GA3295@kst-acer> <4FA56FAD.6060605@gentoo.org> Message-ID: <20120506075408.GA25318@kst-acer> On Sat, May 05, 2012 at 11:21:33AM -0700, Luca Barbato wrote: > On 05/05/12 06:08, Kostya Shishkov wrote: > > --- > > libavcodec/dfa.c | 8 +++++++- > > 1 files changed, 7 insertions(+), 1 deletions(-) > > > > While you are it could you please use AVERROR? > > Beside that patch ok. Changed and applied. I'll also send a global change patch in a minute. From kostya.shishkov at gmail.com Sun May 6 09:54:38 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Sun, 6 May 2012 09:54:38 +0200 Subject: [libav-devel] [PATCH] dfa: use more meaningful return codes Message-ID: <20120506075438.GA25469@kst-acer> --- libavcodec/dfa.c | 54 +++++++++++++++++++++++++++--------------------------- 1 files changed, 27 insertions(+), 27 deletions(-) diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c index 4fe6519..7b6c5d5 100644 --- a/libavcodec/dfa.c +++ b/libavcodec/dfa.c @@ -49,7 +49,7 @@ static int decode_copy(GetByteContext *gb, uint8_t *frame, int width, int height const int size = width * height; if (bytestream2_get_buffer(gb, frame, size) != size) - return -1; + return AVERROR_INVALIDDATA; return 0; } @@ -64,23 +64,23 @@ static int decode_tsw1(GetByteContext *gb, uint8_t *frame, int width, int height segments = bytestream2_get_le32(gb); offset = bytestream2_get_le32(gb); if (frame_end - frame <= offset) - return -1; + return AVERROR_INVALIDDATA; frame += offset; while (segments--) { if (bytestream2_get_bytes_left(gb) < 2) - return -1; + return AVERROR_INVALIDDATA; if (mask == 0x10000) { bitbuf = bytestream2_get_le16u(gb); mask = 1; } if (frame_end - frame < 2) - return -1; + return AVERROR_INVALIDDATA; if (bitbuf & mask) { v = bytestream2_get_le16(gb); offset = (v & 0x1FFF) << 1; count = ((v >> 13) + 2) << 1; if (frame - frame_start < offset || frame_end - frame < count) - return -1; + return AVERROR_INVALIDDATA; av_memcpy_backptr(frame, offset, count); frame += count; } else { @@ -103,19 +103,19 @@ static int decode_dsw1(GetByteContext *gb, uint8_t *frame, int width, int height segments = bytestream2_get_le16(gb); while (segments--) { if (bytestream2_get_bytes_left(gb) < 2) - return -1; + return AVERROR_INVALIDDATA; if (mask == 0x10000) { bitbuf = bytestream2_get_le16u(gb); mask = 1; } if (frame_end - frame < 2) - return -1; + return AVERROR_INVALIDDATA; if (bitbuf & mask) { v = bytestream2_get_le16(gb); offset = (v & 0x1FFF) << 1; count = ((v >> 13) + 2) << 1; if (frame - frame_start < offset || frame_end - frame < count) - return -1; + return AVERROR_INVALIDDATA; // can't use av_memcpy_backptr() since it can overwrite following pixels for (v = 0; v < count; v++) frame[v] = frame[v - offset]; @@ -142,19 +142,19 @@ static int decode_dds1(GetByteContext *gb, uint8_t *frame, int width, int height segments = bytestream2_get_le16(gb); while (segments--) { if (bytestream2_get_bytes_left(gb) < 2) - return -1; + return AVERROR_INVALIDDATA; if (mask == 0x10000) { bitbuf = bytestream2_get_le16u(gb); mask = 1; } if (frame_end - frame < 2) - return -1; + return AVERROR_INVALIDDATA; if (bitbuf & mask) { v = bytestream2_get_le16(gb); offset = (v & 0x1FFF) << 2; count = ((v >> 13) + 2) << 1; if (frame - frame_start < offset || frame_end - frame < count*2 + width) - return -1; + return AVERROR_INVALIDDATA; for (i = 0; i < count; i++) { frame[0] = frame[1] = frame[width] = frame[width + 1] = frame[-offset]; @@ -186,32 +186,32 @@ static int decode_bdlt(GetByteContext *gb, uint8_t *frame, int width, int height count = bytestream2_get_le16(gb); if (count >= height) - return -1; + return AVERROR_INVALIDDATA; frame += width * count; lines = bytestream2_get_le16(gb); if (count + lines > height) - return -1; + return AVERROR_INVALIDDATA; while (lines--) { if (bytestream2_get_bytes_left(gb) < 1) - return -1; + return AVERROR_INVALIDDATA; line_ptr = frame; frame += width; segments = bytestream2_get_byteu(gb); while (segments--) { if (frame - line_ptr <= bytestream2_peek_byte(gb)) - return -1; + return AVERROR_INVALIDDATA; line_ptr += bytestream2_get_byte(gb); count = (int8_t)bytestream2_get_byte(gb); if (count >= 0) { if (frame - line_ptr < count) - return -1; + return AVERROR_INVALIDDATA; if (bytestream2_get_buffer(gb, line_ptr, count) != count) - return -1; + return AVERROR_INVALIDDATA; } else { count = -count; if (frame - line_ptr < count) - return -1; + return AVERROR_INVALIDDATA; memset(line_ptr, bytestream2_get_byte(gb), count); } line_ptr += count; @@ -230,17 +230,17 @@ static int decode_wdlt(GetByteContext *gb, uint8_t *frame, int width, int height lines = bytestream2_get_le16(gb); if (lines > height) - return -1; + return AVERROR_INVALIDDATA; while (lines--) { if (bytestream2_get_bytes_left(gb) < 2) - return -1; + return AVERROR_INVALIDDATA; segments = bytestream2_get_le16u(gb); while ((segments & 0xC000) == 0xC000) { unsigned skip_lines = -(int16_t)segments; unsigned delta = -((int16_t)segments * width); if (frame_end - frame <= delta || y + lines + skip_lines > height) - return -1; + return AVERROR_INVALIDDATA; frame += delta; y += skip_lines; segments = bytestream2_get_le16(gb); @@ -254,19 +254,19 @@ static int decode_wdlt(GetByteContext *gb, uint8_t *frame, int width, int height y++; while (segments--) { if (frame - line_ptr <= bytestream2_peek_byte(gb)) - return -1; + return AVERROR_INVALIDDATA; line_ptr += bytestream2_get_byte(gb); count = (int8_t)bytestream2_get_byte(gb); if (count >= 0) { if (frame - line_ptr < count * 2) - return -1; + return AVERROR_INVALIDDATA; if (bytestream2_get_buffer(gb, line_ptr, count * 2) != count * 2) - return -1; + return AVERROR_INVALIDDATA; line_ptr += count * 2; } else { count = -count; if (frame - line_ptr < count * 2) - return -1; + return AVERROR_INVALIDDATA; v = bytestream2_get_le16(gb); for (i = 0; i < count; i++) bytestream_put_le16(&line_ptr, v); @@ -279,7 +279,7 @@ static int decode_wdlt(GetByteContext *gb, uint8_t *frame, int width, int height static int decode_unk6(GetByteContext *gb, uint8_t *frame, int width, int height) { - return -1; + return AVERROR_PATCHWELCOME; } static int decode_blck(GetByteContext *gb, uint8_t *frame, int width, int height) @@ -338,7 +338,7 @@ static int dfa_decode_frame(AVCodecContext *avctx, if (decoder[chunk_type - 2](&gb, s->frame_buf, avctx->width, avctx->height)) { av_log(avctx, AV_LOG_ERROR, "Error decoding %s chunk\n", chunk_name[chunk_type - 2]); - return -1; + return AVERROR_INVALIDDATA; } } else { av_log(avctx, AV_LOG_WARNING, "Ignoring unknown chunk type %d\n", -- 1.7.0.4 From kostya.shishkov at gmail.com Sun May 6 09:59:18 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Sun, 6 May 2012 09:59:18 +0200 Subject: [libav-devel] [PATCH 4/4] eatgv: check vector_bits In-Reply-To: <4FA5BB87.4040809@gmail.com> References: <20120505130940.GA3403@kst-acer> <4FA556FB.9060307@gmail.com> <20120505164537.GA23507@kst-acer> <4FA5BB87.4040809@gmail.com> Message-ID: <20120506075918.GA25505@kst-acer> On Sat, May 05, 2012 at 07:45:11PM -0400, Derek Buitenhuis wrote: > On 05/05/2012 12:45 PM, Kostya Shishkov wrote: > >>> + av_log(s->avctx, AV_LOG_ERROR, "vector_bits %d invalid\n", vector_bits); > >> > > >> > Could certainly use a better messages, but LGTM in general. > > Feel free to propose one, I can amend it. > > How does "Out of range value for vector_bits: %d\n" or > "Invalid value for vector_bits: %\n" sound? I'm not familiar > with the code, so don't know exactly what vector_bits is, so > you could probably replace "vector_bits" with what it actually > is. How about this? -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-eatgv-check-vector_bits.patch Type: text/x-diff Size: 1147 bytes Desc: not available URL: From kostya.shishkov at gmail.com Sun May 6 10:00:37 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Sun, 6 May 2012 10:00:37 +0200 Subject: [libav-devel] [PATCH 3/4] eatgv: check motion vectors In-Reply-To: <4FA56FC2.5010809@gentoo.org> References: <20120505130917.GA3367@kst-acer> <4FA56FC2.5010809@gentoo.org> Message-ID: <20120506080037.GB25505@kst-acer> On Sat, May 05, 2012 at 11:21:54AM -0700, Luca Barbato wrote: > On 05/05/12 06:09, Kostya Shishkov wrote: > > --- > > libavcodec/eatgv.c | 14 ++++++++------ > > 1 files changed, 8 insertions(+), 6 deletions(-) > > Ok. Found out that I've wronly used m[xy] + 4 >= {width,height} instead of m[xy] + 4 > {width,height}. Fixed locally. From anton at khirnov.net Sun May 6 10:24:19 2012 From: anton at khirnov.net (Anton Khirnov) Date: Sun, 6 May 2012 10:24:19 +0200 Subject: [libav-devel] [PATCH 5/8] lavfi: always enable the scale filter and depend on sws. In-Reply-To: <1336292662-5422-1-git-send-email-anton@khirnov.net> References: <1336292662-5422-1-git-send-email-anton@khirnov.net> Message-ID: <1336292662-5422-5-git-send-email-anton@khirnov.net> The scale filter is used for internal colorspace conversions, so it must always be present. --- configure | 2 +- libavfilter/Makefile | 7 +++---- libavfilter/allfilters.c | 8 ++++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/configure b/configure index b571a94..f2b0bc3 100755 --- a/configure +++ b/configure @@ -1530,12 +1530,12 @@ frei0r_src_filter_deps="frei0r dlopen strtok_r" frei0r_src_filter_extralibs='$ldl' hqdn3d_filter_deps="gpl" ocv_filter_deps="libopencv" -scale_filter_deps="swscale" yadif_filter_deps="gpl" # libraries avdevice_deps="avcodec avformat" avformat_deps="avcodec" +avfilter_deps="swscale" # programs avconv_deps="avcodec avfilter avformat avresample swscale" diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 6ee94e9..725c0b6 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -1,7 +1,6 @@ NAME = avfilter -FFLIBS = avutil +FFLIBS = avutil swscale FFLIBS-$(CONFIG_MOVIE_FILTER) += avformat avcodec -FFLIBS-$(CONFIG_SCALE_FILTER) += swscale HEADERS = avfilter.h avfiltergraph.h buffersrc.h version.h vsrc_buffer.h @@ -12,7 +11,8 @@ OBJS = allfilters.o \ drawutils.o \ formats.o \ graphparser.o \ - vsrc_buffer.o + vsrc_buffer.o \ + vf_scale.o OBJS-$(CONFIG_ANULL_FILTER) += af_anull.o @@ -46,7 +46,6 @@ OBJS-$(CONFIG_OCV_FILTER) += vf_libopencv.o OBJS-$(CONFIG_OVERLAY_FILTER) += vf_overlay.o OBJS-$(CONFIG_PAD_FILTER) += vf_pad.o OBJS-$(CONFIG_PIXDESCTEST_FILTER) += vf_pixdesctest.o -OBJS-$(CONFIG_SCALE_FILTER) += vf_scale.o OBJS-$(CONFIG_SELECT_FILTER) += vf_select.o OBJS-$(CONFIG_SETDAR_FILTER) += vf_aspect.o OBJS-$(CONFIG_SETPTS_FILTER) += vf_setpts.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index ba66941..198e152 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -66,7 +66,6 @@ void avfilter_register_all(void) REGISTER_FILTER (OVERLAY, overlay, vf); REGISTER_FILTER (PAD, pad, vf); REGISTER_FILTER (PIXDESCTEST, pixdesctest, vf); - REGISTER_FILTER (SCALE, scale, vf); REGISTER_FILTER (SELECT, select, vf); REGISTER_FILTER (SETDAR, setdar, vf); REGISTER_FILTER (SETPTS, setpts, vf); @@ -89,9 +88,14 @@ void avfilter_register_all(void) REGISTER_FILTER (NULLSINK, nullsink, vsink); - /* vsrc_buffer is a part of public API => registered unconditionally */ + /* those filters are part of public or internal API => registered + * unconditionally */ { extern AVFilter avfilter_vsrc_buffer; avfilter_register(&avfilter_vsrc_buffer); } + { + extern AVFilter avfilter_vf_scale; + avfilter_register(&avfilter_vf_scale); + } } -- 1.7.9.5 From anton at khirnov.net Sun May 6 10:24:18 2012 From: anton at khirnov.net (Anton Khirnov) Date: Sun, 6 May 2012 10:24:18 +0200 Subject: [libav-devel] [PATCH 4/8] vf_split: support user-specifiable number of outputs. In-Reply-To: <1336292662-5422-1-git-send-email-anton@khirnov.net> References: <1336292662-5422-1-git-send-email-anton@khirnov.net> Message-ID: <1336292662-5422-4-git-send-email-anton@khirnov.net> --- doc/filters.texi | 13 +++++++++ libavfilter/vf_split.c | 68 +++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 68 insertions(+), 13 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index b012dc7..c5a56f4 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -1666,6 +1666,19 @@ not specified it will use the default value of 16. Adding this in the beginning of filter chains should make filtering faster due to better use of the memory cache. + at section split + +Split input video into several identical outputs. + +The filter accepts a single parameter which specifies the number of outputs. If +unspecified, it defaults to 2. + +For example + at example +avconv -i INPUT -filter_complex split=5 OUTPUT + at end example +will create 5 copies of the input video. + @section transpose Transpose rows with columns in the input video and optionally flip it. diff --git a/libavfilter/vf_split.c b/libavfilter/vf_split.c index 54fdd21..da6b3ff 100644 --- a/libavfilter/vf_split.c +++ b/libavfilter/vf_split.c @@ -25,24 +25,67 @@ #include "avfilter.h" +static int split_init(AVFilterContext *ctx, const char *args, void *opaque) +{ + int i, nb_outputs = 2; + + if (args) { + nb_outputs = strtol(args, NULL, 0); + if (nb_outputs <= 0) { + av_log(ctx, AV_LOG_ERROR, "Invalid number of outputs specified: %d.\n", + nb_outputs); + return AVERROR(EINVAL); + } + } + + for (i = 0; i < nb_outputs; i++) { + char name[32]; + AVFilterPad pad = { 0 }; + + snprintf(name, sizeof(name), "output%d", i); + pad.type = AVMEDIA_TYPE_VIDEO; + pad.name = av_strdup(name); + + avfilter_insert_outpad(ctx, i, &pad); + } + + return 0; +} + +static void split_uninit(AVFilterContext *ctx) +{ + int i; + + for (i = 0; i < ctx->output_count; i++) + av_freep(&ctx->output_pads[i].name); +} + static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) { - avfilter_start_frame(inlink->dst->outputs[0], - avfilter_ref_buffer(picref, ~AV_PERM_WRITE)); - avfilter_start_frame(inlink->dst->outputs[1], - avfilter_ref_buffer(picref, ~AV_PERM_WRITE)); + AVFilterContext *ctx = inlink->dst; + int i; + + for (i = 0; i < ctx->output_count; i++) + avfilter_start_frame(ctx->outputs[i], + avfilter_ref_buffer(picref, ~AV_PERM_WRITE)); } static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { - avfilter_draw_slice(inlink->dst->outputs[0], y, h, slice_dir); - avfilter_draw_slice(inlink->dst->outputs[1], y, h, slice_dir); + AVFilterContext *ctx = inlink->dst; + int i; + + for (i = 0; i < ctx->output_count; i++) + avfilter_draw_slice(ctx->outputs[i], y, h, slice_dir); } static void end_frame(AVFilterLink *inlink) { - avfilter_end_frame(inlink->dst->outputs[0]); - avfilter_end_frame(inlink->dst->outputs[1]); + AVFilterContext *ctx = inlink->dst; + int i; + + for (i = 0; i < ctx->output_count; i++) + avfilter_end_frame(ctx->outputs[i]); avfilter_unref_buffer(inlink->cur_buf); } @@ -51,6 +94,9 @@ AVFilter avfilter_vf_split = { .name = "split", .description = NULL_IF_CONFIG_SMALL("Pass on the input to two outputs."), + .init = split_init, + .uninit = split_uninit, + .inputs = (AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, .get_video_buffer= avfilter_null_get_video_buffer, @@ -58,9 +104,5 @@ AVFilter avfilter_vf_split = { .draw_slice = draw_slice, .end_frame = end_frame, }, { .name = NULL}}, - .outputs = (AVFilterPad[]) {{ .name = "output1", - .type = AVMEDIA_TYPE_VIDEO, }, - { .name = "output2", - .type = AVMEDIA_TYPE_VIDEO, }, - { .name = NULL}}, + .outputs = (AVFilterPad[]) {{ .name = NULL}}, }; -- 1.7.9.5 From anton at khirnov.net Sun May 6 10:24:16 2012 From: anton at khirnov.net (Anton Khirnov) Date: Sun, 6 May 2012 10:24:16 +0200 Subject: [libav-devel] [PATCH 2/8] avconv: remove stray useless comment. In-Reply-To: <1336292662-5422-1-git-send-email-anton@khirnov.net> References: <1336292662-5422-1-git-send-email-anton@khirnov.net> Message-ID: <1336292662-5422-2-git-send-email-anton@khirnov.net> --- avconv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/avconv.c b/avconv.c index f702d9d..73f3bc3 100644 --- a/avconv.c +++ b/avconv.c @@ -598,7 +598,6 @@ static int configure_video_filters(FilterGraph *fg) InputStream *ist = fg->inputs[0]->ist; OutputStream *ost = fg->outputs[0]->ost; AVFilterContext *last_filter, *filter; - /** filter graph containing all filters including input & output */ AVCodecContext *codec = ost->st->codec; SinkContext sink_ctx = { .pix_fmts = choose_pixel_fmts(ost) }; AVRational sample_aspect_ratio; -- 1.7.9.5 From anton at khirnov.net Sun May 6 10:24:15 2012 From: anton at khirnov.net (Anton Khirnov) Date: Sun, 6 May 2012 10:24:15 +0200 Subject: [libav-devel] [PATCH 1/8] lavc: add sample rate and channel layout to AVFrame. Message-ID: <1336292662-5422-1-git-send-email-anton@khirnov.net> Rationale is the same as for video width/height etc. --- doc/APIchanges | 3 +++ libavcodec/avcodec.h | 16 ++++++++++++++++ libavcodec/utils.c | 4 ++++ libavcodec/version.h | 2 +- 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index fd834f1..66a0786 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2011-04-18 API changes, most recent first: +2012-xx-xx - xxxxxxx - lavc 54.13.0 - avcodec.h + Add sample_rate and channel_layout fields to AVFrame. + 2012-xx-xx - xxxxxxx - lavr 0.0.1 Change AV_MIX_COEFF_TYPE_Q6 to AV_MIX_COEFF_TYPE_Q8. diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 8ae8992..69ee6b6 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1207,6 +1207,22 @@ typedef struct AVFrame { * - decoding: Set by libavcodec. */ uint8_t motion_subsample_log2; + + /** + * Sample rate of the audio data. + * + * - encoding: unused + * - decoding: set by get_buffer() + */ + int sample_rate; + + /** + * Channel layout of the audio data. + * + * - encoding: unused + * - decoding: set by get_buffer() + */ + uint64_t channel_layout; } AVFrame; struct AVCodecInternal; diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 4492486..2e8a86c 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -356,6 +356,10 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame) else frame->pkt_pts = AV_NOPTS_VALUE; frame->reordered_opaque = avctx->reordered_opaque; + frame->sample_rate = avctx->sample_rate; + frame->format = avctx->sample_fmt; + frame->channel_layout = avctx->channel_layout; + if (avctx->debug & FF_DEBUG_BUFFERS) av_log(avctx, AV_LOG_DEBUG, "default_get_buffer called on frame %p, " "internal audio buffer used\n", frame); diff --git a/libavcodec/version.h b/libavcodec/version.h index 5119874..be39f4f 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -27,7 +27,7 @@ */ #define LIBAVCODEC_VERSION_MAJOR 54 -#define LIBAVCODEC_VERSION_MINOR 12 +#define LIBAVCODEC_VERSION_MINOR 13 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ -- 1.7.9.5 From anton at khirnov.net Sun May 6 10:24:17 2012 From: anton at khirnov.net (Anton Khirnov) Date: Sun, 6 May 2012 10:24:17 +0200 Subject: [libav-devel] [PATCH 3/8] lavfi: avfilter_merge_formats: handle case where inputs are same In-Reply-To: <1336292662-5422-1-git-send-email-anton@khirnov.net> References: <1336292662-5422-1-git-send-email-anton@khirnov.net> Message-ID: <1336292662-5422-3-git-send-email-anton@khirnov.net> From: Mina Nagy Zaki This fixes a double-free crash if lists are the same due to the two merge_ref() calls at the end of the (useless) merging that happens. Signed-off-by: Anton Khirnov --- libavfilter/formats.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 78b0277..53458e6 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -45,6 +45,8 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b) AVFilterFormats *ret; unsigned i, j, k = 0, m_count; + if (a == b) return a; + ret = av_mallocz(sizeof(AVFilterFormats)); /* merge list of formats */ -- 1.7.9.5 From anton at khirnov.net Sun May 6 10:24:22 2012 From: anton at khirnov.net (Anton Khirnov) Date: Sun, 6 May 2012 10:24:22 +0200 Subject: [libav-devel] [PATCH 8/8] lavfi: remove avfilter_default_config_input_link() declaration In-Reply-To: <1336292662-5422-1-git-send-email-anton@khirnov.net> References: <1336292662-5422-1-git-send-email-anton@khirnov.net> Message-ID: <1336292662-5422-8-git-send-email-anton@khirnov.net> From: Stefano Sabatini The function is not implemented (and possibly useless). --- libavfilter/avfilter.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 2b1bb55..f7c3cf1 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -447,9 +447,6 @@ void avfilter_default_filter_samples(AVFilterLink *link, AVFilterBufferRef *samp /** default handler for config_props() for audio/video outputs */ int avfilter_default_config_output_link(AVFilterLink *link); -/** default handler for config_props() for audio/video inputs */ -int avfilter_default_config_input_link (AVFilterLink *link); - /** default handler for get_video_buffer() for video inputs */ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms, int w, int h); -- 1.7.9.5 From anton at khirnov.net Sun May 6 10:24:21 2012 From: anton at khirnov.net (Anton Khirnov) Date: Sun, 6 May 2012 10:24:21 +0200 Subject: [libav-devel] [PATCH 7/8] lavfi: support audio in avfilter_copy_frame_props(). In-Reply-To: <1336292662-5422-1-git-send-email-anton@khirnov.net> References: <1336292662-5422-1-git-send-email-anton@khirnov.net> Message-ID: <1336292662-5422-7-git-send-email-anton@khirnov.net> --- libavfilter/avfilter.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index e89c476..8f30b0c 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -690,13 +690,23 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) dst->pts = src->pts; dst->format = src->format; - dst->video->w = src->width; - dst->video->h = src->height; - dst->video->pixel_aspect = src->sample_aspect_ratio; - dst->video->interlaced = src->interlaced_frame; - dst->video->top_field_first = src->top_field_first; - dst->video->key_frame = src->key_frame; - dst->video->pict_type = src->pict_type; + switch (dst->type) { + case AVMEDIA_TYPE_VIDEO: + dst->video->w = src->width; + dst->video->h = src->height; + dst->video->pixel_aspect = src->sample_aspect_ratio; + dst->video->interlaced = src->interlaced_frame; + dst->video->top_field_first = src->top_field_first; + dst->video->key_frame = src->key_frame; + dst->video->pict_type = src->pict_type; + break; + case AVMEDIA_TYPE_AUDIO: + dst->audio->sample_rate = src->sample_rate; + dst->audio->channel_layout = src->channel_layout; + break; + default: + return AVERROR(EINVAL); + } return 0; } -- 1.7.9.5 From anton at khirnov.net Sun May 6 10:24:20 2012 From: anton at khirnov.net (Anton Khirnov) Date: Sun, 6 May 2012 10:24:20 +0200 Subject: [libav-devel] [PATCH 6/8] lavfi: add a function for copying properties from AVFilterBufferRef->AVFrame In-Reply-To: <1336292662-5422-1-git-send-email-anton@khirnov.net> References: <1336292662-5422-1-git-send-email-anton@khirnov.net> Message-ID: <1336292662-5422-6-git-send-email-anton@khirnov.net> Based on a commit by Stefano Sabatini --- libavfilter/avfilter.c | 30 ++++++++++++++++++++++++++++++ libavfilter/avfilter.h | 8 ++++++++ 2 files changed, 38 insertions(+) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index d426591..e89c476 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -700,3 +700,33 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) return 0; } + +int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src) +{ + memcpy(dst->data, src->data, sizeof(dst->data)); + memcpy(dst->linesize, src->linesize, sizeof(dst->linesize)); + + dst->pts = src->pts; + dst->format = src->format; + + switch (src->type) { + case AVMEDIA_TYPE_VIDEO: + dst->width = src->video->w; + dst->height = src->video->h; + dst->sample_aspect_ratio = src->video->pixel_aspect; + dst->interlaced_frame = src->video->interlaced; + dst->top_field_first = src->video->top_field_first; + dst->key_frame = src->video->key_frame; + dst->pict_type = src->video->pict_type; + break; + case AVMEDIA_TYPE_AUDIO: + dst->sample_rate = src->audio->sample_rate; + dst->channel_layout = src->audio->channel_layout; + dst->nb_samples = src->audio->nb_samples; + break; + default: + return AVERROR(EINVAL); + } + + return 0; +} diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 068c50b..2b1bb55 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -862,4 +862,12 @@ static inline void avfilter_insert_outpad(AVFilterContext *f, unsigned index, */ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src); +/** + * Copy the frame properties and data pointers of src to dst, without copying + * the actual data. + * + * @return 0 on success, a negative number on error. + */ +int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src); + #endif /* AVFILTER_AVFILTER_H */ -- 1.7.9.5 From anton at khirnov.net Sun May 6 10:32:15 2012 From: anton at khirnov.net (Anton Khirnov) Date: Sun, 6 May 2012 10:32:15 +0200 Subject: [libav-devel] [PATCH] lavfi/formats: use sizeof(var) instead of sizeof(type). In-Reply-To: <1336292662-5422-1-git-send-email-anton@khirnov.net> References: <1336292662-5422-1-git-send-email-anton@khirnov.net> Message-ID: <1336293135-26260-1-git-send-email-anton@khirnov.net> --- libavfilter/formats.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 53458e6..bd87427 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -47,7 +47,7 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b) if (a == b) return a; - ret = av_mallocz(sizeof(AVFilterFormats)); + ret = av_mallocz(sizeof(*ret)); /* merge list of formats */ m_count = FFMIN(a->format_count, b->format_count); @@ -67,7 +67,7 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b) return NULL; } - ret->refs = av_malloc(sizeof(AVFilterFormats**)*(a->refcount+b->refcount)); + ret->refs = av_malloc(sizeof(*ret->refs)*(a->refcount+b->refcount)); merge_ref(ret, a); merge_ref(ret, b); @@ -94,7 +94,7 @@ AVFilterFormats *avfilter_make_format_list(const int *fmts) for (count = 0; fmts[count] != -1; count++) ; - formats = av_mallocz(sizeof(AVFilterFormats)); + formats = av_mallocz(sizeof(*formats)); if (count) formats->formats = av_malloc(sizeof(*formats->formats) * count); formats->format_count = count; @@ -107,7 +107,7 @@ int avfilter_add_format(AVFilterFormats **avff, int fmt) { int *fmts; - if (!(*avff) && !(*avff = av_mallocz(sizeof(AVFilterFormats)))) + if (!(*avff) && !(*avff = av_mallocz(sizeof(**avff)))) return AVERROR(ENOMEM); fmts = av_realloc((*avff)->formats, @@ -138,7 +138,7 @@ AVFilterFormats *avfilter_all_formats(enum AVMediaType type) void avfilter_formats_ref(AVFilterFormats *f, AVFilterFormats **ref) { *ref = f; - f->refs = av_realloc(f->refs, sizeof(AVFilterFormats**) * ++f->refcount); + f->refs = av_realloc(f->refs, sizeof(*f->refs) * ++f->refcount); f->refs[f->refcount-1] = ref; } @@ -162,7 +162,7 @@ void avfilter_formats_unref(AVFilterFormats **ref) if(idx >= 0) memmove((*ref)->refs + idx, (*ref)->refs + idx+1, - sizeof(AVFilterFormats**) * ((*ref)->refcount-idx-1)); + sizeof(*(*ref)->refs) * ((*ref)->refcount-idx-1)); if(!--(*ref)->refcount) { av_free((*ref)->formats); -- 1.7.9.5 From anton at khirnov.net Sun May 6 10:35:55 2012 From: anton at khirnov.net (Anton Khirnov) Date: Sun, 6 May 2012 10:35:55 +0200 Subject: [libav-devel] [PATCH] lavfi: support audio in avfilter_copy_frame_props(). In-Reply-To: <1336292662-5422-7-git-send-email-anton@khirnov.net> References: <1336292662-5422-7-git-send-email-anton@khirnov.net> Message-ID: <1336293355-28023-1-git-send-email-anton@khirnov.net> --- libavfilter/avfilter.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index e89c476..78acda2 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -684,19 +684,26 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) { - if (dst->type != AVMEDIA_TYPE_VIDEO) - return AVERROR(EINVAL); - dst->pts = src->pts; dst->format = src->format; - dst->video->w = src->width; - dst->video->h = src->height; - dst->video->pixel_aspect = src->sample_aspect_ratio; - dst->video->interlaced = src->interlaced_frame; - dst->video->top_field_first = src->top_field_first; - dst->video->key_frame = src->key_frame; - dst->video->pict_type = src->pict_type; + switch (dst->type) { + case AVMEDIA_TYPE_VIDEO: + dst->video->w = src->width; + dst->video->h = src->height; + dst->video->pixel_aspect = src->sample_aspect_ratio; + dst->video->interlaced = src->interlaced_frame; + dst->video->top_field_first = src->top_field_first; + dst->video->key_frame = src->key_frame; + dst->video->pict_type = src->pict_type; + break; + case AVMEDIA_TYPE_AUDIO: + dst->audio->sample_rate = src->sample_rate; + dst->audio->channel_layout = src->channel_layout; + break; + default: + return AVERROR(EINVAL); + } return 0; } -- 1.7.9.5 From mans at mansr.com Sun May 6 12:38:58 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Sun, 06 May 2012 11:38:58 +0100 Subject: [libav-devel] [PATCH 1/2] mips: intreadwrite: remove unnecessary inline asm In-Reply-To: <4FA5DA36.9010800@gmail.com> (Derek Buitenhuis's message of "Sat, 05 May 2012 21:56:06 -0400") References: <1336257507-14627-1-git-send-email-mans@mansr.com> <4FA5BBEA.5040501@gmail.com> <4FA5C0CB.50107@gmail.com> <4FA5DA36.9010800@gmail.com> Message-ID: Derek Buitenhuis writes: > On 05/05/2012 8:25 PM, M?ns Rullg?rd wrote: >> Actually, some non-gcc compilers do try to support gcc inline asm, >> sometimes even with partial success. I checked clang, and it does the >> right thing (insofar it works at all for 64-bit) without any extra help. > > Interesting. I thought clang's mips stuff was still kinda... bad. Check fate. The 32-bit one passes without errors (I had to fix a few bugs to make that happen), which is better than it does on ARM, though I haven't done any benchmarking. 64-bit is very broken, however. >>> I think it's coffee time. (Also, we might want to care about >>> some embedded gcc forks, but im sure they will support it just >>> fine.) >> >> Embedded gcc forks? > > I was thinking of CodeSourcery. I don't think fork is an accurate term for that. They actually do much of the development on gcc for some targets. The versions they distribute simply have their patches applied before they've made it all the way upstream. As far as we're concerned, they are just another gcc build, treated no differently from vanilla gcc. -- M?ns Rullg?rd mans at mansr.com From lu_zero at gentoo.org Sun May 6 12:44:37 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Sun, 06 May 2012 03:44:37 -0700 Subject: [libav-devel] [PATCH] dfa: use more meaningful return codes In-Reply-To: <20120506075438.GA25469@kst-acer> References: <20120506075438.GA25469@kst-acer> Message-ID: <4FA65615.4050208@gentoo.org> On 06/05/12 00:54, Kostya Shishkov wrote: > --- > libavcodec/dfa.c | 54 +++++++++++++++++++++++++++--------------------------- > 1 files changed, 27 insertions(+), 27 deletions(-) > Thank you, patch ok. lu -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sun May 6 12:46:08 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Sun, 06 May 2012 03:46:08 -0700 Subject: [libav-devel] [PATCH 4/8] vf_split: support user-specifiable number of outputs. In-Reply-To: <1336292662-5422-4-git-send-email-anton@khirnov.net> References: <1336292662-5422-1-git-send-email-anton@khirnov.net> <1336292662-5422-4-git-send-email-anton@khirnov.net> Message-ID: <4FA65670.8060401@gentoo.org> On 06/05/12 01:24, Anton Khirnov wrote: > --- > doc/filters.texi | 13 +++++++++ > libavfilter/vf_split.c | 68 +++++++++++++++++++++++++++++++++++++++--------- > 2 files changed, 68 insertions(+), 13 deletions(-) > Great =) thank you. lu -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sun May 6 12:46:32 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Sun, 06 May 2012 03:46:32 -0700 Subject: [libav-devel] [PATCH 5/8] lavfi: always enable the scale filter and depend on sws. In-Reply-To: <1336292662-5422-5-git-send-email-anton@khirnov.net> References: <1336292662-5422-1-git-send-email-anton@khirnov.net> <1336292662-5422-5-git-send-email-anton@khirnov.net> Message-ID: <4FA65688.7090009@gentoo.org> On 06/05/12 01:24, Anton Khirnov wrote: > The scale filter is used for internal colorspace conversions, so it must > always be present. > --- Ok. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sun May 6 12:46:49 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Sun, 06 May 2012 03:46:49 -0700 Subject: [libav-devel] [PATCH 2/8] avconv: remove stray useless comment. In-Reply-To: <1336292662-5422-2-git-send-email-anton@khirnov.net> References: <1336292662-5422-1-git-send-email-anton@khirnov.net> <1336292662-5422-2-git-send-email-anton@khirnov.net> Message-ID: <4FA65699.8020700@gentoo.org> On 06/05/12 01:24, Anton Khirnov wrote: > --- > avconv.c | 1 - > 1 file changed, 1 deletion(-) Ok. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sun May 6 12:47:16 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Sun, 06 May 2012 03:47:16 -0700 Subject: [libav-devel] [PATCH] lavfi: support audio in avfilter_copy_frame_props(). In-Reply-To: <1336293355-28023-1-git-send-email-anton@khirnov.net> References: <1336292662-5422-7-git-send-email-anton@khirnov.net> <1336293355-28023-1-git-send-email-anton@khirnov.net> Message-ID: <4FA656B4.8050704@gentoo.org> On 06/05/12 01:35, Anton Khirnov wrote: > --- > libavfilter/avfilter.c | 27 +++++++++++++++++---------- > 1 file changed, 17 insertions(+), 10 deletions(-) > Seems ok. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sun May 6 12:47:39 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Sun, 06 May 2012 03:47:39 -0700 Subject: [libav-devel] [PATCH 8/8] lavfi: remove avfilter_default_config_input_link() declaration In-Reply-To: <1336292662-5422-8-git-send-email-anton@khirnov.net> References: <1336292662-5422-1-git-send-email-anton@khirnov.net> <1336292662-5422-8-git-send-email-anton@khirnov.net> Message-ID: <4FA656CB.1060109@gentoo.org> On 06/05/12 01:24, Anton Khirnov wrote: > From: Stefano Sabatini > > The function is not implemented (and possibly useless). > --- > libavfilter/avfilter.h | 3 --- > 1 file changed, 3 deletions(-) OK. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sun May 6 12:48:27 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Sun, 06 May 2012 03:48:27 -0700 Subject: [libav-devel] [PATCH 6/8] lavfi: add a function for copying properties from AVFilterBufferRef->AVFrame In-Reply-To: <1336292662-5422-6-git-send-email-anton@khirnov.net> References: <1336292662-5422-1-git-send-email-anton@khirnov.net> <1336292662-5422-6-git-send-email-anton@khirnov.net> Message-ID: <4FA656FB.9090907@gentoo.org> On 06/05/12 01:24, Anton Khirnov wrote: > Based on a commit by Stefano Sabatini > --- > libavfilter/avfilter.c | 30 ++++++++++++++++++++++++++++++ > libavfilter/avfilter.h | 8 ++++++++ > 2 files changed, 38 insertions(+) > Ok. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From lu_zero at gentoo.org Sun May 6 12:49:01 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Sun, 06 May 2012 03:49:01 -0700 Subject: [libav-devel] [PATCH 1/8] lavc: add sample rate and channel layout to AVFrame. In-Reply-To: <1336292662-5422-1-git-send-email-anton@khirnov.net> References: <1336292662-5422-1-git-send-email-anton@khirnov.net> Message-ID: <4FA6571D.7010204@gentoo.org> On 06/05/12 01:24, Anton Khirnov wrote: > Rationale is the same as for video width/height etc. > --- > doc/APIchanges | 3 +++ > libavcodec/avcodec.h | 16 ++++++++++++++++ > libavcodec/utils.c | 4 ++++ > libavcodec/version.h | 2 +- > 4 files changed, 24 insertions(+), 1 deletion(-) > Ok, I think. -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From diego at biurrun.de Sun May 6 13:47:00 2012 From: diego at biurrun.de (Diego Biurrun) Date: Sun, 06 May 2012 13:47:00 +0200 Subject: [libav-devel] [PATCH 3/8] lavfi: avfilter_merge_formats: handle case where inputs are same In-Reply-To: <1336292662-5422-3-git-send-email-anton@khirnov.net> References: <1336292662-5422-1-git-send-email-anton@khirnov.net> <1336292662-5422-3-git-send-email-anton@khirnov.net> Message-ID: <20120506114700.GA16530@pool.informatik.rwth-aachen.de> On Sun, May 06, 2012 at 10:24:17AM +0200, Anton Khirnov wrote: > --- a/libavfilter/formats.c > +++ b/libavfilter/formats.c > @@ -45,6 +45,8 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b) > AVFilterFormats *ret; > unsigned i, j, k = 0, m_count; > > + if (a == b) return a; Please break the line. > ret = av_mallocz(sizeof(AVFilterFormats)); One of three unchecked mallocs in that function alone ... Diego From diego at biurrun.de Sun May 6 13:49:13 2012 From: diego at biurrun.de (Diego Biurrun) Date: Sun, 06 May 2012 13:49:13 +0200 Subject: [libav-devel] [PATCH 5/8] lavfi: always enable the scale filter and depend on sws. In-Reply-To: <1336292662-5422-5-git-send-email-anton@khirnov.net> References: <1336292662-5422-1-git-send-email-anton@khirnov.net> <1336292662-5422-5-git-send-email-anton@khirnov.net> Message-ID: <20120506114913.GB16530@pool.informatik.rwth-aachen.de> On Sun, May 06, 2012 at 10:24:19AM +0200, Anton Khirnov wrote: > > --- a/configure > +++ b/configure > @@ -1530,12 +1530,12 @@ frei0r_src_filter_deps="frei0r dlopen strtok_r" > > # libraries > avdevice_deps="avcodec avformat" > avformat_deps="avcodec" > +avfilter_deps="swscale" order > --- a/libavfilter/Makefile > +++ b/libavfilter/Makefile > @@ -12,7 +11,8 @@ OBJS = allfilters.o \ > formats.o \ > graphparser.o \ > - vsrc_buffer.o > + vsrc_buffer.o \ > + vf_scale.o order LGTM otherwise Diego From diego at biurrun.de Sun May 6 13:52:15 2012 From: diego at biurrun.de (Diego Biurrun) Date: Sun, 06 May 2012 13:52:15 +0200 Subject: [libav-devel] [PATCH] lavfi/formats: use sizeof(var) instead of sizeof(type). In-Reply-To: <1336293135-26260-1-git-send-email-anton@khirnov.net> References: <1336292662-5422-1-git-send-email-anton@khirnov.net> <1336293135-26260-1-git-send-email-anton@khirnov.net> Message-ID: <20120506115215.GC16530@pool.informatik.rwth-aachen.de> On Sun, May 06, 2012 at 10:32:15AM +0200, Anton Khirnov wrote: > > --- a/libavfilter/formats.c > +++ b/libavfilter/formats.c > @@ -67,7 +67,7 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b) > > - ret->refs = av_malloc(sizeof(AVFilterFormats**)*(a->refcount+b->refcount)); > + ret->refs = av_malloc(sizeof(*ret->refs)*(a->refcount+b->refcount)); Please add spaces around operators while you're at it, this is quite unreadable. > @@ -162,7 +162,7 @@ void avfilter_formats_unref(AVFilterFormats **ref) > > if(idx >= 0) > memmove((*ref)->refs + idx, (*ref)->refs + idx+1, > - sizeof(AVFilterFormats**) * ((*ref)->refcount-idx-1)); > + sizeof(*(*ref)->refs) * ((*ref)->refcount-idx-1)); ditto LGTM otherwise Diego From kostya.shishkov at gmail.com Sun May 6 17:49:27 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Sun, 6 May 2012 17:49:27 +0200 Subject: [libav-devel] [PATCH] Mark a number of variables only used in av_dlog() calls as av_unused. In-Reply-To: <1335107190-23352-1-git-send-email-diego@biurrun.de> References: <20120422144934.GC29921@pool.informatik.rwth-aachen.de> <1335107190-23352-1-git-send-email-diego@biurrun.de> Message-ID: <20120506154927.GA27083@kst-acer> On Sun, Apr 22, 2012 at 05:06:30PM +0200, Diego Biurrun wrote: > This fixes a number of unused-but-set gcc warnings. > --- > libavcodec/wmalosslessdec.c | 3 ++- > libavformat/mov.c | 6 ++++-- > libavformat/nsvdec.c | 5 +++-- > 3 files changed, 9 insertions(+), 5 deletions(-) > > diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c > index 1520a06..054f0f8 100644 > --- a/libavcodec/wmalosslessdec.c > +++ b/libavcodec/wmalosslessdec.c > @@ -22,6 +22,7 @@ > * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA > */ > > +#include "libavutil/attributes.h" > #include "avcodec.h" > #include "internal.h" > #include "get_bits.h" > @@ -1039,7 +1040,7 @@ static int decode_frame(WmallDecodeCtx *s) > /* no idea what these are for, might be the number of samples > that need to be skipped at the beginning or end of a stream */ > if (get_bits1(gb)) { > - int skip; > + int av_unused skip; > > /* usually true for the first frame */ > if (get_bits1(gb)) { > diff --git a/libavformat/mov.c b/libavformat/mov.c > index f7ba125..7579ec8 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -25,6 +25,7 @@ > //#define DEBUG > //#define MOV_EXPORT_ALL_METADATA > > +#include "libavutil/attributes.h" > #include "libavutil/audioconvert.h" > #include "libavutil/intreadwrite.h" > #include "libavutil/intfloat.h" > @@ -568,8 +569,9 @@ static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom) > static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom) > { > AVStream *st; > - uint8_t version; > - uint32_t flags, layout_tag, bitmap, num_descr, label_mask; > + uint8_t av_unused version; > + uint32_t av_unused flags; > + uint32_t layout_tag, bitmap, num_descr, label_mask; > int i; > > if (c->fc->nb_streams < 1) > diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c > index 1a160c5..24e823e 100644 > --- a/libavformat/nsvdec.c > +++ b/libavformat/nsvdec.c > @@ -19,6 +19,7 @@ > * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA > */ > > +#include "libavutil/attributes.h" > #include "libavutil/mathematics.h" > #include "avformat.h" > #include "internal.h" > @@ -273,7 +274,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s) > { > NSVContext *nsv = s->priv_data; > AVIOContext *pb = s->pb; > - unsigned int file_size; > + unsigned int av_unused file_size; > unsigned int size; > int64_t duration; > int strings_size; > @@ -595,7 +596,7 @@ null_chunk_retry: > av_dlog(s, "NSV CHUNK %d aux, %u bytes video, %d bytes audio\n", auxcount, vsize, asize); > /* skip aux stuff */ > for (i = 0; i < auxcount; i++) { > - uint32_t auxtag; > + uint32_t av_unused auxtag; > auxsize = avio_rl16(pb); > auxtag = avio_rl32(pb); > av_dlog(s, "NSV aux data: '%c%c%c%c', %d bytes\n", > -- LGTM From kostya.shishkov at gmail.com Sun May 6 17:51:22 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Sun, 6 May 2012 17:51:22 +0200 Subject: [libav-devel] [PATCH 06/12] dvdec: drop const qualifier from variable to eliminate a warning In-Reply-To: <1334840823-22614-6-git-send-email-diego@biurrun.de> References: <1334840823-22614-1-git-send-email-diego@biurrun.de> <1334840823-22614-6-git-send-email-diego@biurrun.de> Message-ID: <20120506155122.GB27083@kst-acer> On Thu, Apr 19, 2012 at 03:06:57PM +0200, Diego Biurrun wrote: > libavcodec/dvdec.c:344:12: warning: assignment discards ?const? qualifier from pointer target type > --- > libavcodec/dvdec.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c > index 6b77a40..0decd5f 100644 > --- a/libavcodec/dvdec.c > +++ b/libavcodec/dvdec.c > @@ -313,7 +313,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, > void *data, int *data_size, > AVPacket *avpkt) > { > - const uint8_t *buf = avpkt->data; > + uint8_t *buf = avpkt->data; > int buf_size = avpkt->size; > DVVideoContext *s = avctx->priv_data; > const uint8_t* vsc_pack; > -- LGTM From diego at biurrun.de Sun May 6 18:13:57 2012 From: diego at biurrun.de (Diego Biurrun) Date: Sun, 06 May 2012 18:13:57 +0200 Subject: [libav-devel] [PATCH] pthread: warn on high thread counts In-Reply-To: References: <1332133694-12495-1-git-send-email-gseanmcg@gmail.com> Message-ID: <20120506161357.GA21075@pool.informatik.rwth-aachen.de> On Mon, Mar 19, 2012 at 09:45:08AM -0700, Ronald S. Bultje wrote: > On Mon, Mar 19, 2012 at 7:10 AM, Sean McGovern wrote: > > On 3/19/12, Ronald S. Bultje wrote: > >> On Sun, Mar 18, 2012 at 10:08 PM, Sean McGovern wrote: > >>> --- > >>> ?libavcodec/pthread.c | ? ?4 ++++ > >>> ?1 files changed, 4 insertions(+), 0 deletions(-) > >>> > >>> diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c > >>> index 2e4c6a8..4000d6b 100644 > >>> --- a/libavcodec/pthread.c > >>> +++ b/libavcodec/pthread.c > >>> @@ -1011,6 +1011,10 @@ static void > >>> validate_thread_parameters(AVCodecContext *avctx) > >>> ? ? ? ? avctx->thread_count ? ? ? = 1; > >>> ? ? ? ? avctx->active_thread_type = 0; > >>> ? ? } > >>> + > >>> + ? ?if(avctx->thread_count > MAX_AUTO_THREADS) { > >>> + ? ? ? ?av_log(avctx, AV_LOG_WARNING, "Application has requested %d > >>> threads. Using a thread count greater than %d is not recommended.\n", > >>> avctx->thread_count, MAX_AUTO_THREADS); > >>> + ? ?} > >> > >> Why? > > > > I wrote this after: > > a) running FATE with 24 threads (on a 64-way ppc64 box, no less!) and > > observing some failures > > b) a brief comment from Justin on IRC about -threads auto being 16 > > "for a reason" > > > > Please see the comment before the definition of MAX_AUTO_THREADS in > > that same file. > > Hm, so your ppc64-behaviour (fate failing) is semi-reproducible at > threads>16? I suppose it's just a warning, so I don't mind... So shall I queue this? Diego From diego at biurrun.de Sun May 6 18:18:49 2012 From: diego at biurrun.de (Diego Biurrun) Date: Sun, 06 May 2012 18:18:49 +0200 Subject: [libav-devel] [PATCH] vf_yadif: fix missing error handling for avfilter_poll_frame() In-Reply-To: <20120428134321.GB9797@pool.informatik.rwth-aachen.de> References: <20120428134321.GB9797@pool.informatik.rwth-aachen.de> Message-ID: <1336321129-21170-1-git-send-email-diego@biurrun.de> From: Robert Nagy --- libavfilter/vf_yadif.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c index 12b3783..790dda5 100644 --- a/libavfilter/vf_yadif.c +++ b/libavfilter/vf_yadif.c @@ -316,11 +316,15 @@ static int poll_frame(AVFilterLink *link) return 1; val = avfilter_poll_frame(link->src->inputs[0]); + if (val <= 0) + return val; if (val==1 && !yadif->next) { //FIXME change API to not requre this red tape if ((ret = avfilter_request_frame(link->src->inputs[0])) < 0) return ret; val = avfilter_poll_frame(link->src->inputs[0]); + if (val <= 0) + return val; } assert(yadif->next || !val); -- 1.7.1 From diego at biurrun.de Sun May 6 18:21:30 2012 From: diego at biurrun.de (Diego Biurrun) Date: Sun, 06 May 2012 18:21:30 +0200 Subject: [libav-devel] [PATCH] vf_yadif: fix missing error handling for avfilter_poll_frame() In-Reply-To: <1336321129-21170-1-git-send-email-diego@biurrun.de> References: <20120428134321.GB9797@pool.informatik.rwth-aachen.de> <1336321129-21170-1-git-send-email-diego@biurrun.de> Message-ID: <20120506162130.GB21075@pool.informatik.rwth-aachen.de> On Sun, May 06, 2012 at 06:18:49PM +0200, Diego Biurrun wrote: > From: Robert Nagy > > --- > libavfilter/vf_yadif.c | 4 ++++ > 1 files changed, 4 insertions(+), 0 deletions(-) LGTM, queueing. Diego From derek.buitenhuis at gmail.com Sun May 6 18:43:04 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Sun, 06 May 2012 12:43:04 -0400 Subject: [libav-devel] [PATCH 4/4] eatgv: check vector_bits In-Reply-To: <20120506075918.GA25505@kst-acer> References: <20120505130940.GA3403@kst-acer> <4FA556FB.9060307@gmail.com> <20120505164537.GA23507@kst-acer> <4FA5BB87.4040809@gmail.com> <20120506075918.GA25505@kst-acer> Message-ID: <4FA6AA18.1000304@gmail.com> On 06/05/2012 3:59 AM, Kostya Shishkov wrote: > How about this? Looks good. - Derek From kostya.shishkov at gmail.com Sun May 6 19:19:36 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Sun, 6 May 2012 19:19:36 +0200 Subject: [libav-devel] [PATCH 4/4] eatgv: check vector_bits In-Reply-To: <4FA6AA18.1000304@gmail.com> References: <20120505130940.GA3403@kst-acer> <4FA556FB.9060307@gmail.com> <20120505164537.GA23507@kst-acer> <4FA5BB87.4040809@gmail.com> <20120506075918.GA25505@kst-acer> <4FA6AA18.1000304@gmail.com> Message-ID: <20120506171936.GA27725@kst-acer> On Sun, May 06, 2012 at 12:43:04PM -0400, Derek Buitenhuis wrote: > On 06/05/2012 3:59 AM, Kostya Shishkov wrote: > > How about this? > > Looks good. applied From nenjordi at gmail.com Sun May 6 20:31:37 2012 From: nenjordi at gmail.com (Jordi Ortiz) Date: Sun, 6 May 2012 18:31:37 +0000 (UTC) Subject: [libav-devel] =?utf-8?q?=5BPATCH_2/4=5D_Move_code_shared_between_?= =?utf-8?q?libdirac_and=09libschroedinger_to_libschroedinger=2E?= References: <1334410860-5890-1-git-send-email-diego@biurrun.de> <1334410860-5890-2-git-send-email-diego@biurrun.de> Message-ID: Diego Biurrun writes: > -void ff_dirac_schro_queue_init(DiracSchroQueue *queue) > -{ > - queue->p_head = queue->p_tail = NULL; > - queue->size = 0; align = > - if (top) { > - void *data = top->data; > - queue->p_head = queue->p_head->next; align = > + /** key frame flag. 1 : is key frame , 0 : in not key frame */ > + uint16_t key_frame; > +} FFSchroEncodedFrame; Why not AVSchroEncodedFrame? just to know for I'll have to name some structures for sure in the future =) > + struct FFSchroQueueElement *next; > +} FFSchroQueueElement; Same here > + int size; > +} FFSchroQueue; Same here Apart from that it looks good to me From nenjordi at gmail.com Sun May 6 20:48:01 2012 From: nenjordi at gmail.com (Jordi Ortiz) Date: Sun, 6 May 2012 18:48:01 +0000 (UTC) Subject: [libav-devel] =?utf-8?q?=5BPATCH_3/4=5D_libschroedinger=3A_Move_a?= =?utf-8?q?_function_to_avoid=09a_forward_declaration=2E?= References: <1334410860-5890-1-git-send-email-diego@biurrun.de> <1334410860-5890-3-git-send-email-diego@biurrun.de> Message-ID: Looks good to me From nenjordi at gmail.com Sun May 6 20:59:59 2012 From: nenjordi at gmail.com (Jordi Ortiz) Date: Sun, 6 May 2012 18:59:59 +0000 (UTC) Subject: [libav-devel] =?utf-8?q?=5BPATCH_4/4=5D_libschroedinger=3A_Switch?= =?utf-8?q?_to_function_names=09more_in_line_with_Libav_style=2E?= References: <1334410860-5890-1-git-send-email-diego@biurrun.de> <1334410860-5890-4-git-send-email-diego@biurrun.de> Message-ID: Looks good to me From ronag89 at gmail.com Sun May 6 21:50:02 2012 From: ronag89 at gmail.com (Robert Nagy) Date: Sun, 6 May 2012 21:50:02 +0200 Subject: [libav-devel] fps filter Message-ID: Not finalized. Ported (by hand) some code I register as an fps filter inside a third party application. If anyone wants to implement a fps filter this is could maybe be something to start from. Note, does not take poll_frame into account. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-lavfi-Add-fps-filter.patch Type: application/octet-stream Size: 3778 bytes Desc: not available URL: From rsbultje at gmail.com Sun May 6 22:04:46 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Sun, 6 May 2012 13:04:46 -0700 Subject: [libav-devel] [PATCH] pthread: warn on high thread counts In-Reply-To: <20120506161357.GA21075@pool.informatik.rwth-aachen.de> References: <1332133694-12495-1-git-send-email-gseanmcg@gmail.com> <20120506161357.GA21075@pool.informatik.rwth-aachen.de> Message-ID: Hi, On Sun, May 6, 2012 at 9:13 AM, Diego Biurrun wrote: > On Mon, Mar 19, 2012 at 09:45:08AM -0700, Ronald S. Bultje wrote: >> On Mon, Mar 19, 2012 at 7:10 AM, Sean McGovern wrote: >> > On 3/19/12, Ronald S. Bultje wrote: >> >> On Sun, Mar 18, 2012 at 10:08 PM, Sean McGovern wrote: >> >>> --- >> >>> ?libavcodec/pthread.c | ? ?4 ++++ >> >>> ?1 files changed, 4 insertions(+), 0 deletions(-) >> >>> >> >>> diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c >> >>> index 2e4c6a8..4000d6b 100644 >> >>> --- a/libavcodec/pthread.c >> >>> +++ b/libavcodec/pthread.c >> >>> @@ -1011,6 +1011,10 @@ static void >> >>> validate_thread_parameters(AVCodecContext *avctx) >> >>> ? ? ? ? avctx->thread_count ? ? ? = 1; >> >>> ? ? ? ? avctx->active_thread_type = 0; >> >>> ? ? } >> >>> + >> >>> + ? ?if(avctx->thread_count > MAX_AUTO_THREADS) { >> >>> + ? ? ? ?av_log(avctx, AV_LOG_WARNING, "Application has requested %d >> >>> threads. Using a thread count greater than %d is not recommended.\n", >> >>> avctx->thread_count, MAX_AUTO_THREADS); >> >>> + ? ?} >> >> >> >> Why? >> > >> > I wrote this after: >> > a) running FATE with 24 threads (on a 64-way ppc64 box, no less!) and >> > observing some failures >> > b) a brief comment from Justin on IRC about -threads auto being 16 >> > "for a reason" >> > >> > Please see the comment before the definition of MAX_AUTO_THREADS in >> > that same file. >> >> Hm, so your ppc64-behaviour (fate failing) is semi-reproducible at >> threads>16? I suppose it's just a warning, so I don't mind... > > So shall I queue this? Yeah, sorry, sort of lost track. Ronald From lu_zero at gentoo.org Sun May 6 22:44:26 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Sun, 6 May 2012 13:44:26 -0700 Subject: [libav-devel] [PATCH] zerocodec: check if the previous frame is missing In-Reply-To: <1336154067-4399-1-git-send-email-lu_zero@gentoo.org> References: <1336154067-4399-1-git-send-email-lu_zero@gentoo.org> Message-ID: <1336337066-15433-1-git-send-email-lu_zero@gentoo.org> From: Paul B Mahol ZeroCodec relies on the keyframe flag being set in the container, and prev is the previously decoded frame. A keyframe flags incorrectly set will lead to this condition. Signed-off-by: Paul B Mahol Signed-off-by: Luca Barbato --- libavcodec/zerocodec.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c index 6c57e05..487cb32 100644 --- a/libavcodec/zerocodec.c +++ b/libavcodec/zerocodec.c @@ -65,6 +65,10 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, pic->key_frame = 1; pic->pict_type = AV_PICTURE_TYPE_I; } else { + if (!prev) { + av_log(avctx, AV_LOG_ERROR, "Missing reference frame!\n"); + return AVERROR_INVALIDDATA; + } pic->key_frame = 0; pic->pict_type = AV_PICTURE_TYPE_P; } -- 1.7.8.rc1 From justin.ruggles at gmail.com Sun May 6 23:00:16 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Sun, 06 May 2012 17:00:16 -0400 Subject: [libav-devel] [PATCH] lavr: replace the SSE version of ff_conv_fltp_to_flt_6ch() with AVX In-Reply-To: <1336073961-20905-1-git-send-email-justin.ruggles@gmail.com> References: <1336073961-20905-1-git-send-email-justin.ruggles@gmail.com> Message-ID: <4FA6E660.4050709@gmail.com> On 05/03/2012 03:39 PM, Justin Ruggles wrote: > The SSE version is slower than the MMX version on Athlon64 and Sandy Bridge, > but the 3-arg AVX version is faster on Sandy Bridge. > --- > Athlon64 > C - 26322 > MMX - 7997 > SSE - 8662 > > Sandy Bridge > C - 13011 > MMX - 4262 > SSE - 4680 > AVX - 3960 > > Note that although the new code is simpler, using it as SSE is not any > faster than the existing SSE version. The AVX version is only faster > because of the 3-arg ops in SBUTTERFLYPS2. > > libavresample/x86/audio_convert.asm | 40 ++++++++++++++++---------------- > libavresample/x86/audio_convert_init.c | 6 ++-- > libavutil/x86/x86util.asm | 6 ++++ > 3 files changed, 29 insertions(+), 23 deletions(-) ping. -Justin From holger at layer-acht.org Sat May 5 22:51:09 2012 From: holger at layer-acht.org (Holger Levsen) Date: Sat, 5 May 2012 14:51:09 -0600 Subject: [libav-devel] video september in paris (Re: [foms] VideoLAN Dev Days 2012 In-Reply-To: <20120504123848.GA14161@videolan.org> References: <20120504123848.GA14161@videolan.org> Message-ID: <201205051451.13528.holger@layer-acht.org> Hi Jean-Baptiste, I'm adding cc:s to the debconf-video and dvswitch-devel mailinglists, as those groups might be interested to join a video/multimedia meeting in Paris... (the DebConf/Debian videoteam stores its hardware in Paris..) so fullquote for their benefit: On Freitag, 4. Mai 2012, Jean-Baptiste Kempf wrote: > Hello fellow-geeks and friends, > > Like last year, I plan to organize a small technical conference, at the > end of the summer, in Paris, for us to gather, discuss and/or code. > > Like last year, this is a technical conference, not a blabla one. how many devs do you expect? > Like last year, all geeks of important projects on the multimedia > field are invited. I would suggest to invite Xiph people too, compared > to last year. > And VideoLAN will pay travel, hotels and food to active contributors that > do not have a corporate sponsorship (Although reimbursement will be > faster than last year). > > So far, the plan is to do it on the first week-end of September 2012 in > Paris, France. This should not conflict with IBC. > > For lack of a better name (av500con? falcon? whatevercon), I will keep, > for now, the VDD name. maybe keep VDD but replace the acronym with "video dev days"? :) > Interested? yup! > Thoughts? cheers, Holger From diego at biurrun.de Sun May 6 23:50:40 2012 From: diego at biurrun.de (Diego Biurrun) Date: Sun, 06 May 2012 23:50:40 +0200 Subject: [libav-devel] [PATCH 2/4] Move code shared between libdirac and?libschroedinger to libschroedinger. In-Reply-To: References: <1334410860-5890-1-git-send-email-diego@biurrun.de> <1334410860-5890-2-git-send-email-diego@biurrun.de> Message-ID: <20120506215038.GA31444@pool.informatik.rwth-aachen.de> On Sun, May 06, 2012 at 06:31:37PM +0000, Jordi Ortiz wrote: > Diego Biurrun writes: > > > -void ff_dirac_schro_queue_init(DiracSchroQueue *queue) > > -{ > > - queue->p_head = queue->p_tail = NULL; > > - queue->size = 0; > align = > > - if (top) { > > - void *data = top->data; > > - queue->p_head = queue->p_head->next; > align = What you quote is the code I removed. In the code I added I kept the original formatting even though it could be improved so as not to throw off the Git content move detection logic. > > + /** key frame flag. 1 : is key frame , 0 : in not key frame */ > > + uint16_t key_frame; > > +} FFSchroEncodedFrame; > Why not AVSchroEncodedFrame? just to know for I'll have to name some structures > for sure in the future =) The AV prefix is for externally visible structures, FF for internal ones. Diego P.S.: Please leave empty lines between your reply and the quoted text, it makes your mails much easier to read. From derek.buitenhuis at gmail.com Mon May 7 00:31:56 2012 From: derek.buitenhuis at gmail.com (Derek Buitenhuis) Date: Sun, 06 May 2012 18:31:56 -0400 Subject: [libav-devel] [PATCH] zerocodec: check if the previous frame is missing In-Reply-To: <1336337066-15433-1-git-send-email-lu_zero@gentoo.org> References: <1336154067-4399-1-git-send-email-lu_zero@gentoo.org> <1336337066-15433-1-git-send-email-lu_zero@gentoo.org> Message-ID: <4FA6FBDC.4080800@gmail.com> On 06/05/2012 4:44 PM, Luca Barbato wrote: > From: Paul B Mahol > > ZeroCodec relies on the keyframe flag being set in the container, and > prev is the previously decoded frame. A keyframe flags incorrectly set > will lead to this condition. As per discussion on IRC, OK. - Derek From anton at khirnov.net Mon May 7 07:16:55 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 7 May 2012 07:16:55 +0200 Subject: [libav-devel] [PATCH] lavfi: uninline avfilter_copy_buffer_ref_props(). Message-ID: <1336367815-24770-1-git-send-email-anton@khirnov.net> A nontrivial public function such as this should most certainly NOT be inline. --- libavfilter/avfilter.c | 13 +++++++++++++ libavfilter/avfilter.h | 13 +------------ libavfilter/version.h | 2 +- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 78acda2..f12ca3a 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -737,3 +737,16 @@ int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src) return 0; } + +void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src) +{ + // copy common properties + dst->pts = src->pts; + dst->pos = src->pos; + + switch (src->type) { + case AVMEDIA_TYPE_VIDEO: *dst->video = *src->video; break; + case AVMEDIA_TYPE_AUDIO: *dst->audio = *src->audio; break; + default: break; + } +} diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index f7c3cf1..ef61a5d 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -145,18 +145,7 @@ typedef struct AVFilterBufferRef { /** * Copy properties of src to dst, without copying the actual data */ -static inline void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src) -{ - // copy common properties - dst->pts = src->pts; - dst->pos = src->pos; - - switch (src->type) { - case AVMEDIA_TYPE_VIDEO: *dst->video = *src->video; break; - case AVMEDIA_TYPE_AUDIO: *dst->audio = *src->audio; break; - default: break; - } -} +void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src); /** * Add a new reference to a buffer. diff --git a/libavfilter/version.h b/libavfilter/version.h index 5d646e4..718ed78 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -30,7 +30,7 @@ #define LIBAVFILTER_VERSION_MAJOR 2 #define LIBAVFILTER_VERSION_MINOR 16 -#define LIBAVFILTER_VERSION_MICRO 0 +#define LIBAVFILTER_VERSION_MICRO 1 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ LIBAVFILTER_VERSION_MINOR, \ -- 1.7.9.5 From ronag89 at gmail.com Mon May 7 07:31:17 2012 From: ronag89 at gmail.com (Robert Nagy) Date: Mon, 7 May 2012 07:31:17 +0200 Subject: [libav-devel] [PATCH] yadif: Improve pts calculations. Message-ID: Note, NOT tested. This should solve the problem where the pts for "next" is less than "cur" giving bogus pts values for "is_second", e.g. when seeking or looping. > From 0dec658687d959239da9fa90c78ca3f54e6ab47c Mon Sep 17 00:00:00 2001 > From: Robert Nagy > Date: Mon, 7 May 2012 07:27:46 +0200 > Subject: [PATCH] yadif: Improve pts calculations. > > --- > libavfilter/vf_yadif.c | 28 +++++++++++++++++----------- > 1 files changed, 17 insertions(+), 11 deletions(-) > > diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c > index 12b3783..88f4593 100644 > --- a/libavfilter/vf_yadif.c > +++ b/libavfilter/vf_yadif.c > @@ -208,6 +208,8 @@ static void return_frame(AVFilterContext *ctx, int is_second) > AV_PERM_REUSE, link->w, link->h); > avfilter_copy_buffer_ref_props(yadif->out, yadif->cur); > yadif->out->video->interlaced = 0; > + if(yadif->out->pts != AV_NOPTS_VALUE) > + yadif->out->pts += 1; > } > > if (!yadif->csp) > @@ -217,17 +219,9 @@ static void return_frame(AVFilterContext *ctx, int is_second) > > filter(ctx, yadif->out, tff ^ !is_second, tff); > > - if (is_second) { > - if (yadif->next->pts != AV_NOPTS_VALUE && > - yadif->cur->pts != AV_NOPTS_VALUE) { > - yadif->out->pts = > - (yadif->next->pts&yadif->cur->pts) + > - ((yadif->next->pts^yadif->cur->pts)>>1); > - } else { > - yadif->out->pts = AV_NOPTS_VALUE; > - } > + if (is_second) > avfilter_start_frame(ctx->outputs[0], yadif->out); > - } > + > avfilter_draw_slice(ctx->outputs[0], 0, link->h, 1); > avfilter_end_frame(ctx->outputs[0]); > > @@ -255,6 +249,8 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref) > yadif->out = avfilter_ref_buffer(yadif->cur, AV_PERM_READ); > avfilter_unref_buffer(yadif->prev); > yadif->prev = NULL; > + if(yadif->out->pts != AV_NOPTS_VALUE) > + yadif->out->pts *= 2; > avfilter_start_frame(ctx->outputs[0], yadif->out); > return; > } > @@ -267,6 +263,8 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref) > > avfilter_copy_buffer_ref_props(yadif->out, yadif->cur); > yadif->out->video->interlaced = 0; > + if(yadif->out->pts != AV_NOPTS_VALUE) > + yadif->out->pts *= 2; > avfilter_start_frame(ctx->outputs[0], yadif->out); > } > > @@ -396,6 +394,13 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) > > static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { } > > +static int out_config_props(AVFilterLink* link) > +{ > + link->time_base.den *= 2; > + > + return 0; > +} > + > AVFilter avfilter_vf_yadif = { > .name = "yadif", > .description = NULL_IF_CONFIG_SMALL("Deinterlace the input image"), > @@ -416,6 +421,7 @@ AVFilter avfilter_vf_yadif = { > .outputs = (AVFilterPad[]) {{ .name = "default", > .type = AVMEDIA_TYPE_VIDEO, > .poll_frame = poll_frame, > - .request_frame = request_frame, }, > + .request_frame = request_frame, > + .config_props = out_config_props, }, > { .name = NULL}}, > }; > -- > 1.7.6.msysgit.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: From diego at biurrun.de Mon May 7 11:11:04 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 11:11:04 +0200 Subject: [libav-devel] [PATCH 2/5] dv: Split profile handling code into a separate file. In-Reply-To: <1334768437-23290-2-git-send-email-diego@biurrun.de> References: <1334768437-23290-2-git-send-email-diego@biurrun.de> Message-ID: <20120507091104.GA15241@pool.informatik.rwth-aachen.de> On Wed, Apr 18, 2012 at 07:00:34PM +0200, Diego Biurrun wrote: > --- > libavcodec/Makefile | 8 +- > libavcodec/dv_profile.c | 331 +++++++++++++++++++++++++++++++++++++++++++++++ > libavcodec/dv_profile.h | 72 ++++++++++ > libavcodec/dvdata.c | 307 ------------------------------------------- > libavcodec/dvdata.h | 46 +------- > libavformat/dv.c | 1 + > libavformat/dvenc.c | 1 + > 7 files changed, 410 insertions(+), 356 deletions(-) > create mode 100644 libavcodec/dv_profile.c > create mode 100644 libavcodec/dv_profile.h ping Diego From diego at biurrun.de Mon May 7 11:16:28 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 11:16:28 +0200 Subject: [libav-devel] [PATCH] libxvid: Separate libxvid encoder from libxvid rate control code. In-Reply-To: <1334099672-26971-1-git-send-email-diego@biurrun.de> References: <20120410210641.GI2405@pool.informatik.rwth-aachen.de> <1334099672-26971-1-git-send-email-diego@biurrun.de> Message-ID: <20120507091628.GB15241@pool.informatik.rwth-aachen.de> On Wed, Apr 11, 2012 at 01:14:32AM +0200, Diego Biurrun wrote: > This allows compiling the Xvid rate control code without the encoder. > --- > libavcodec/Makefile | 3 ++- > libavcodec/libxvid_rc.c | 41 +++++++++++++++++++++++++++++++++++++++++ > libavcodec/libxvidff.c | 43 ------------------------------------------- > 3 files changed, 43 insertions(+), 44 deletions(-) ping Diego From nenjordi at gmail.com Mon May 7 11:42:33 2012 From: nenjordi at gmail.com (Jordi Ortiz) Date: Mon, 7 May 2012 11:42:33 +0200 Subject: [libav-devel] [PATCH 2/4] Move code shared between libdirac and?libschroedinger to libschroedinger. In-Reply-To: <20120506215038.GA31444@pool.informatik.rwth-aachen.de> References: <1334410860-5890-1-git-send-email-diego@biurrun.de> <1334410860-5890-2-git-send-email-diego@biurrun.de> <20120506215038.GA31444@pool.informatik.rwth-aachen.de> Message-ID: > > What you quote is the code I removed. In the code I added I kept the > original formatting even though it could be improved so as not to throw > off the Git content move detection logic. > You are right. I answered from gmane and it was a bit 'tricky'. Sorry. The AV prefix is for externally visible structures, FF for internal ones. > ok, thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From diego at biurrun.de Mon May 7 12:12:12 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 12:12:12 +0200 Subject: [libav-devel] [PATCH 1/4] build: cosmetics: Split HEADERS/OBJS/PROGS lists into one entry per line. In-Reply-To: References: Message-ID: <1336385535-4048-1-git-send-email-diego@biurrun.de> --- libavcodec/Makefile | 31 ++++++++++++++++++++++++++----- libavdevice/Makefile | 3 ++- libavfilter/Makefile | 9 +++++++-- libavformat/Makefile | 14 +++++++++++--- libavutil/Makefile | 25 +++++++++++++++++++++---- libswscale/Makefile | 3 ++- 6 files changed, 69 insertions(+), 16 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 0b6d0bb..ba9f610 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1,7 +1,14 @@ NAME = avcodec FFLIBS = avutil -HEADERS = avcodec.h avfft.h dxva2.h vaapi.h vda.h vdpau.h version.h xvmc.h +HEADERS = avcodec.h \ + avfft.h \ + dxva2.h \ + vaapi.h \ + vda.h \ + vdpau.h \ + version.h \ + xvmc.h \ OBJS = allcodecs.o \ audioconvert.o \ @@ -701,13 +708,27 @@ SKIPHEADERS-$(HAVE_W32THREADS) += w32pthreads.h EXAMPLES = api -TESTPROGS = cabac dct fft fft-fixed golomb iirfilter rangecoder +TESTPROGS = cabac \ + dct \ + fft \ + fft-fixed \ + golomb \ + iirfilter \ + rangecoder \ + TESTPROGS-$(HAVE_MMX) += motion TESTOBJS = dctref.o -HOSTPROGS = aac_tablegen aacps_tablegen cbrt_tablegen cos_tablegen \ - dv_tablegen motionpixels_tablegen mpegaudio_tablegen \ - pcm_tablegen qdm2_tablegen sinewin_tablegen +HOSTPROGS = aac_tablegen \ + aacps_tablegen \ + cbrt_tablegen \ + cos_tablegen \ + dv_tablegen \ + motionpixels_tablegen \ + mpegaudio_tablegen \ + pcm_tablegen \ + qdm2_tablegen \ + sinewin_tablegen \ CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF) diff --git a/libavdevice/Makefile b/libavdevice/Makefile index 8226817..bc55405 100644 --- a/libavdevice/Makefile +++ b/libavdevice/Makefile @@ -3,7 +3,8 @@ FFLIBS = avformat avcodec avutil HEADERS = avdevice.h -OBJS = alldevices.o avdevice.o +OBJS = alldevices.o \ + avdevice.o \ # input/output devices OBJS-$(CONFIG_ALSA_INDEV) += alsa-audio-common.o \ diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 46fa93d..619cef7 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -2,7 +2,11 @@ NAME = avfilter FFLIBS = avutil swscale FFLIBS-$(CONFIG_MOVIE_FILTER) += avformat avcodec -HEADERS = avfilter.h avfiltergraph.h buffersrc.h version.h vsrc_buffer.h +HEADERS = avfilter.h \ + avfiltergraph.h \ + buffersrc.h \ + version.h \ + vsrc_buffer.h \ OBJS = allfilters.o \ avfilter.o \ @@ -68,4 +72,5 @@ OBJS-$(CONFIG_TESTSRC_FILTER) += vsrc_testsrc.o OBJS-$(CONFIG_NULLSINK_FILTER) += vsink_nullsink.o -TOOLS = graph2dot lavfi-showfiltfmts +TOOLS = graph2dot \ + lavfi-showfiltfmts \ diff --git a/libavformat/Makefile b/libavformat/Makefile index 681ea1b..9a6cb55 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -1,7 +1,9 @@ NAME = avformat FFLIBS = avcodec avutil -HEADERS = avformat.h avio.h version.h +HEADERS = avformat.h \ + avio.h \ + version.h \ OBJS = allformats.o \ avio.o \ @@ -352,8 +354,14 @@ OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o SKIPHEADERS-$(CONFIG_NETWORK) += network.h rtsp.h -EXAMPLES = metadata output +EXAMPLES = metadata \ + output \ + TESTPROGS = seek -TOOLS = aviocat ismindex pktdumper probetest + +TOOLS = aviocat \ + ismindex \ + pktdumper \ + probetest \ $(SUBDIR)output-example$(EXESUF): ELIBS = -lswscale diff --git a/libavutil/Makefile b/libavutil/Makefile index 69f2acd..fb19ebf 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -37,6 +37,11 @@ HEADERS = adler32.h \ samplefmt.h \ sha.h \ +ARCH_HEADERS = bswap.h \ + intmath.h \ + intreadwrite.h \ + timer.h \ + BUILT_HEADERS = avconfig.h OBJS = adler32.o \ @@ -74,7 +79,19 @@ OBJS = adler32.o \ tree.o \ utils.o \ -TESTPROGS = adler32 aes avstring base64 cpu crc des eval fifo lfg lls \ - md5 opt parseutils sha tree - -ARCH_HEADERS = bswap.h intmath.h intreadwrite.h timer.h +TESTPROGS = adler32 \ + aes \ + avstring \ + base64 \ + cpu \ + crc \ + des \ + eval \ + fifo \ + lfg \ + lls \ + md5 \ + opt \ + parseutils \ + sha \ + tree \ diff --git a/libswscale/Makefile b/libswscale/Makefile index 29f3f12..349dd99 100644 --- a/libswscale/Makefile +++ b/libswscale/Makefile @@ -12,4 +12,5 @@ OBJS = input.o \ utils.o \ yuv2rgb.o \ -TESTPROGS = colorspace swscale +TESTPROGS = colorspace \ + swscale \ -- 1.7.1 From diego at biurrun.de Mon May 7 12:12:14 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 12:12:14 +0200 Subject: [libav-devel] [PATCH 3/4] build: cosmetics: Add missing end-of-line backslashes from item lists. In-Reply-To: References: Message-ID: <1336385535-4048-3-git-send-email-diego@biurrun.de> --- libavcodec/Makefile | 3 ++- libavfilter/Makefile | 2 +- libavresample/Makefile | 4 ++-- libavresample/x86/Makefile | 4 ++-- libavutil/arm/Makefile | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index db38f2f..5f9183f 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -723,7 +723,8 @@ SKIPHEADERS += %_tablegen.h \ aac_tablegen_decl.h \ fft-internal.h \ tableprint.h \ - $(ARCH)/vp56_arith.h + $(ARCH)/vp56_arith.h \ + SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h SKIPHEADERS-$(CONFIG_MPEG_XVMC_DECODER) += xvmc.h diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 619cef7..ae85839 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -16,7 +16,7 @@ OBJS = allfilters.o \ formats.o \ graphparser.o \ vf_scale.o \ - vsrc_buffer.o + vsrc_buffer.o \ OBJS-$(CONFIG_ANULL_FILTER) += af_anull.o diff --git a/libavresample/Makefile b/libavresample/Makefile index ce3fe81..c0c20a9 100644 --- a/libavresample/Makefile +++ b/libavresample/Makefile @@ -2,7 +2,7 @@ NAME = avresample FFLIBS = avutil HEADERS = avresample.h \ - version.h + version.h \ OBJS = audio_convert.o \ audio_data.o \ @@ -10,6 +10,6 @@ OBJS = audio_convert.o \ audio_mix_matrix.o \ options.o \ resample.o \ - utils.o + utils.o \ TESTPROGS = avresample diff --git a/libavresample/x86/Makefile b/libavresample/x86/Makefile index 63697fa..65bed89 100644 --- a/libavresample/x86/Makefile +++ b/libavresample/x86/Makefile @@ -1,5 +1,5 @@ OBJS += x86/audio_convert_init.o \ - x86/audio_mix_init.o + x86/audio_mix_init.o \ YASM-OBJS += x86/audio_convert.o \ - x86/audio_mix.o + x86/audio_mix.o \ diff --git a/libavutil/arm/Makefile b/libavutil/arm/Makefile index 246f73a..e600383 100644 --- a/libavutil/arm/Makefile +++ b/libavutil/arm/Makefile @@ -1 +1 @@ -OBJS += arm/cpu.o +OBJS += arm/cpu.o \ -- 1.7.1 From diego at biurrun.de Mon May 7 12:12:13 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 12:12:13 +0200 Subject: [libav-devel] [PATCH 2/4] build: cosmetics: Align all backslashes on column 72. In-Reply-To: References: Message-ID: <1336385535-4048-2-git-send-email-diego@biurrun.de> --- Makefile | 10 +- libavcodec/Makefile | 336 +++++++++++++++++++++++++++----------------------- libavdevice/Makefile | 4 +- libavformat/Makefile | 129 ++++++++++---------- library.mak | 7 +- libswscale/Makefile | 16 ++-- 6 files changed, 265 insertions(+), 237 deletions(-) diff --git a/Makefile b/Makefile index 5da4d51..8972521 100644 --- a/Makefile +++ b/Makefile @@ -99,11 +99,11 @@ config.h: .config @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n' @-tput sgr0 2>/dev/null -SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \ - ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \ - ALTIVEC-OBJS ARMV5TE-OBJS ARMV6-OBJS ARMVFP-OBJS MMI-OBJS \ - MMX-OBJS NEON-OBJS VIS-OBJS YASM-OBJS \ - OBJS TESTOBJS +SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \ + ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \ + ALTIVEC-OBJS ARMV5TE-OBJS ARMV6-OBJS ARMVFP-OBJS \ + MMI-OBJS MMX-OBJS NEON-OBJS VIS-OBJS YASM-OBJS \ + OBJS TESTOBJS \ define RESET $(1) := diff --git a/libavcodec/Makefile b/libavcodec/Makefile index ba9f610..db38f2f 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -59,29 +59,30 @@ OBJS-$(CONFIG_VDPAU) += vdpau.o # decoders/encoders/hardware accelerators OBJS-$(CONFIG_A64MULTI_ENCODER) += a64multienc.o elbg.o OBJS-$(CONFIG_A64MULTI5_ENCODER) += a64multienc.o elbg.o -OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o aacps.o \ - aacadtsdec.o mpeg4audio.o kbdwin.o \ +OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o \ + aacps.o aacadtsdec.o \ + mpeg4audio.o kbdwin.o \ sbrdsp.o aacpsdsp.o -OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o \ - aacpsy.o aactab.o \ - psymodel.o iirfilter.o \ - mpeg4audio.o kbdwin.o \ +OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o \ + aacpsy.o aactab.o \ + psymodel.o iirfilter.o \ + mpeg4audio.o kbdwin.o \ audio_frame_queue.o OBJS-$(CONFIG_AASC_DECODER) += aasc.o msrledec.o OBJS-$(CONFIG_AC3_DECODER) += ac3dec.o ac3dec_data.o ac3.o kbdwin.o -OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3enc.o ac3tab.o \ - ac3.o kbdwin.o +OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3enc.o \ + ac3tab.o ac3.o kbdwin.o OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3enc.o ac3tab.o ac3.o OBJS-$(CONFIG_ALAC_DECODER) += alac.o OBJS-$(CONFIG_ALAC_ENCODER) += alacenc.o OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mpeg4audio.o -OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o celp_filters.o \ - celp_math.o acelp_filters.o \ - acelp_vectors.o \ +OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o celp_filters.o \ + celp_math.o acelp_filters.o \ + acelp_vectors.o \ acelp_pitch_delay.o -OBJS-$(CONFIG_AMRWB_DECODER) += amrwbdec.o celp_filters.o \ - celp_math.o acelp_filters.o \ - acelp_vectors.o \ +OBJS-$(CONFIG_AMRWB_DECODER) += amrwbdec.o celp_filters.o \ + celp_math.o acelp_filters.o \ + acelp_vectors.o \ acelp_pitch_delay.o lsp.o OBJS-$(CONFIG_AMV_DECODER) += sp5xdec.o mjpegdec.o mjpeg.o OBJS-$(CONFIG_ANM_DECODER) += anm.o @@ -108,7 +109,7 @@ OBJS-$(CONFIG_BMP_ENCODER) += bmpenc.o OBJS-$(CONFIG_BMV_VIDEO_DECODER) += bmv.o OBJS-$(CONFIG_BMV_AUDIO_DECODER) += bmv.o OBJS-$(CONFIG_C93_DECODER) += c93.o -OBJS-$(CONFIG_CAVS_DECODER) += cavs.o cavsdec.o cavsdsp.o \ +OBJS-$(CONFIG_CAVS_DECODER) += cavs.o cavsdec.o cavsdsp.o \ mpeg12data.o mpegvideo.o OBJS-$(CONFIG_CDGRAPHICS_DECODER) += cdgraphics.o OBJS-$(CONFIG_CDXL_DECODER) += cdxl.o @@ -122,9 +123,9 @@ OBJS-$(CONFIG_DCA_DECODER) += dca.o synth_filter.o dcadsp.o \ dca_parser.o OBJS-$(CONFIG_DFA_DECODER) += dfa.o OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o -OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o \ - mpegvideo_enc.o motion_est.o \ - ratecontrol.o mpeg12data.o \ +OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o \ + mpegvideo_enc.o motion_est.o \ + ratecontrol.o mpeg12data.o \ mpegvideo.o OBJS-$(CONFIG_DPX_DECODER) += dpx.o OBJS-$(CONFIG_DPX_ENCODER) += dpxenc.o @@ -139,16 +140,17 @@ OBJS-$(CONFIG_DVVIDEO_ENCODER) += dv.o dvdata.o dv_profile.o OBJS-$(CONFIG_DXA_DECODER) += dxa.o OBJS-$(CONFIG_DXTORY_DECODER) += dxtory.o OBJS-$(CONFIG_EAC3_DECODER) += eac3dec.o eac3_data.o -OBJS-$(CONFIG_EAC3_ENCODER) += eac3enc.o ac3enc.o ac3enc_float.o \ - ac3tab.o ac3.o kbdwin.o eac3_data.o +OBJS-$(CONFIG_EAC3_ENCODER) += eac3enc.o ac3enc.o \ + ac3enc_float.o ac3tab.o ac3.o \ + kbdwin.o eac3_data.o OBJS-$(CONFIG_EACMV_DECODER) += eacmv.o -OBJS-$(CONFIG_EAMAD_DECODER) += eamad.o eaidct.o mpeg12.o \ - mpeg12data.o mpegvideo.o \ +OBJS-$(CONFIG_EAMAD_DECODER) += eamad.o eaidct.o mpeg12.o \ + mpeg12data.o mpegvideo.o \ error_resilience.o OBJS-$(CONFIG_EATGQ_DECODER) += eatgq.o eaidct.o OBJS-$(CONFIG_EATGV_DECODER) += eatgv.o -OBJS-$(CONFIG_EATQI_DECODER) += eatqi.o eaidct.o mpeg12.o \ - mpeg12data.o mpegvideo.o \ +OBJS-$(CONFIG_EATQI_DECODER) += eatqi.o eaidct.o mpeg12.o \ + mpeg12data.o mpegvideo.o \ error_resilience.o OBJS-$(CONFIG_EIGHTBPS_DECODER) += 8bps.o OBJS-$(CONFIG_EIGHTSVX_EXP_DECODER) += 8svx.o @@ -171,27 +173,29 @@ OBJS-$(CONFIG_GIF_DECODER) += gifdec.o lzw.o OBJS-$(CONFIG_GIF_ENCODER) += gif.o lzwenc.o OBJS-$(CONFIG_GSM_DECODER) += gsmdec.o gsmdec_data.o msgsmdec.o OBJS-$(CONFIG_GSM_MS_DECODER) += gsmdec.o gsmdec_data.o msgsmdec.o -OBJS-$(CONFIG_H261_DECODER) += h261dec.o h261.o \ - mpegvideo.o error_resilience.o -OBJS-$(CONFIG_H261_ENCODER) += h261enc.o h261.o \ - mpegvideo_enc.o motion_est.o \ - ratecontrol.o mpeg12data.o \ - mpegvideo.o -OBJS-$(CONFIG_H263_DECODER) += h263dec.o h263.o ituh263dec.o \ - mpeg4video.o mpeg4videodec.o flvdec.o\ - intelh263dec.o mpegvideo.o \ +OBJS-$(CONFIG_H261_DECODER) += h261dec.o h261.o mpegvideo.o \ error_resilience.o -OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o -OBJS-$(CONFIG_H263_ENCODER) += mpegvideo_enc.o mpeg4video.o \ - mpeg4videoenc.o motion_est.o \ - ratecontrol.o h263.o ituh263enc.o \ - flvenc.o mpeg12data.o \ - mpegvideo.o error_resilience.o -OBJS-$(CONFIG_H264_DECODER) += h264.o \ - h264_loopfilter.o h264_direct.o \ - cabac.o h264_sei.o h264_ps.o \ - h264_refs.o h264_cavlc.o h264_cabac.o\ +OBJS-$(CONFIG_H261_ENCODER) += h261enc.o h261.o \ + mpegvideo_enc.o motion_est.o \ + ratecontrol.o mpeg12data.o \ + mpegvideo.o +OBJS-$(CONFIG_H263_DECODER) += h263dec.o h263.o ituh263dec.o \ + mpeg4video.o mpeg4videodec.o \ + flvdec.o intelh263dec.o \ mpegvideo.o error_resilience.o +OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o +OBJS-$(CONFIG_H263_ENCODER) += mpegvideo_enc.o mpeg4video.o \ + mpeg4videoenc.o motion_est.o \ + ratecontrol.o h263.o \ + ituh263enc.o flvenc.o \ + mpeg12data.o mpegvideo.o \ + error_resilience.o +OBJS-$(CONFIG_H264_DECODER) += h264.o h264_direct.o \ + h264_loopfilter.o h264_ps.o \ + h264_refs.o h264_sei.o \ + h264_cabac.o h264_cavlc.o \ + cabac.o mpegvideo.o \ + error_resilience.o OBJS-$(CONFIG_H264_DXVA2_HWACCEL) += dxva2_h264.o OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o OBJS-$(CONFIG_H264_VDA_HWACCEL) += vda_h264.o @@ -207,7 +211,7 @@ OBJS-$(CONFIG_INDEO4_DECODER) += indeo4.o ivi_common.o ivi_dsp.o OBJS-$(CONFIG_INDEO5_DECODER) += indeo5.o ivi_common.o ivi_dsp.o OBJS-$(CONFIG_INTERPLAY_DPCM_DECODER) += dpcm.o OBJS-$(CONFIG_INTERPLAY_VIDEO_DECODER) += interplayvideo.o -OBJS-$(CONFIG_JPEGLS_DECODER) += jpeglsdec.o jpegls.o \ +OBJS-$(CONFIG_JPEGLS_DECODER) += jpeglsdec.o jpegls.o \ mjpegdec.o mjpeg.o OBJS-$(CONFIG_JPEGLS_ENCODER) += jpeglsenc.o jpegls.o OBJS-$(CONFIG_JV_DECODER) += jvdec.o @@ -221,81 +225,95 @@ OBJS-$(CONFIG_LJPEG_ENCODER) += ljpegenc.o mjpegenc.o mjpeg.o \ OBJS-$(CONFIG_LOCO_DECODER) += loco.o OBJS-$(CONFIG_MACE3_DECODER) += mace.o OBJS-$(CONFIG_MACE6_DECODER) += mace.o -OBJS-$(CONFIG_MDEC_DECODER) += mdec.o mpeg12.o mpeg12data.o \ +OBJS-$(CONFIG_MDEC_DECODER) += mdec.o mpeg12.o mpeg12data.o \ mpegvideo.o error_resilience.o OBJS-$(CONFIG_MIMIC_DECODER) += mimic.o OBJS-$(CONFIG_MJPEG_DECODER) += mjpegdec.o mjpeg.o -OBJS-$(CONFIG_MJPEG_ENCODER) += mjpegenc.o mjpeg.o \ - mpegvideo_enc.o motion_est.o \ - ratecontrol.o mpeg12data.o \ +OBJS-$(CONFIG_MJPEG_ENCODER) += mjpegenc.o mjpeg.o \ + mpegvideo_enc.o motion_est.o \ + ratecontrol.o mpeg12data.o \ mpegvideo.o OBJS-$(CONFIG_MJPEGB_DECODER) += mjpegbdec.o mjpegdec.o mjpeg.o OBJS-$(CONFIG_MLP_DECODER) += mlpdec.o mlpdsp.o OBJS-$(CONFIG_MMVIDEO_DECODER) += mmvideo.o OBJS-$(CONFIG_MOTIONPIXELS_DECODER) += motionpixels.o -OBJS-$(CONFIG_MP1_DECODER) += mpegaudiodec.o mpegaudiodecheader.o \ +OBJS-$(CONFIG_MP1_DECODER) += mpegaudiodec.o \ + mpegaudiodecheader.o \ mpegaudio.o mpegaudiodata.o -OBJS-$(CONFIG_MP1FLOAT_DECODER) += mpegaudiodec_float.o mpegaudiodecheader.o \ +OBJS-$(CONFIG_MP1FLOAT_DECODER) += mpegaudiodec_float.o \ + mpegaudiodecheader.o \ mpegaudio.o mpegaudiodata.o -OBJS-$(CONFIG_MP2_DECODER) += mpegaudiodec.o mpegaudiodecheader.o \ +OBJS-$(CONFIG_MP2_DECODER) += mpegaudiodec.o \ + mpegaudiodecheader.o \ mpegaudio.o mpegaudiodata.o -OBJS-$(CONFIG_MP2_ENCODER) += mpegaudioenc.o mpegaudio.o \ +OBJS-$(CONFIG_MP2_ENCODER) += mpegaudioenc.o mpegaudio.o \ mpegaudiodata.o -OBJS-$(CONFIG_MP2FLOAT_DECODER) += mpegaudiodec_float.o mpegaudiodecheader.o \ +OBJS-$(CONFIG_MP2FLOAT_DECODER) += mpegaudiodec_float.o \ + mpegaudiodecheader.o \ mpegaudio.o mpegaudiodata.o -OBJS-$(CONFIG_MP3ADU_DECODER) += mpegaudiodec.o mpegaudiodecheader.o \ +OBJS-$(CONFIG_MP3ADU_DECODER) += mpegaudiodec.o \ + mpegaudiodecheader.o \ mpegaudio.o mpegaudiodata.o -OBJS-$(CONFIG_MP3ADUFLOAT_DECODER) += mpegaudiodec_float.o mpegaudiodecheader.o \ +OBJS-$(CONFIG_MP3ADUFLOAT_DECODER) += mpegaudiodec_float.o \ + mpegaudiodecheader.o \ mpegaudio.o mpegaudiodata.o -OBJS-$(CONFIG_MP3ON4_DECODER) += mpegaudiodec.o mpegaudiodecheader.o \ - mpegaudio.o mpegaudiodata.o \ +OBJS-$(CONFIG_MP3ON4_DECODER) += mpegaudiodec.o \ + mpegaudiodecheader.o \ + mpegaudio.o mpegaudiodata.o \ mpeg4audio.o -OBJS-$(CONFIG_MP3ON4FLOAT_DECODER) += mpegaudiodec_float.o mpegaudiodecheader.o \ - mpegaudio.o mpegaudiodata.o \ +OBJS-$(CONFIG_MP3ON4FLOAT_DECODER) += mpegaudiodec_float.o \ + mpegaudiodecheader.o \ + mpegaudio.o mpegaudiodata.o \ mpeg4audio.o -OBJS-$(CONFIG_MP3_DECODER) += mpegaudiodec.o mpegaudiodecheader.o \ +OBJS-$(CONFIG_MP3_DECODER) += mpegaudiodec.o \ + mpegaudiodecheader.o \ mpegaudio.o mpegaudiodata.o -OBJS-$(CONFIG_MP3FLOAT_DECODER) += mpegaudiodec_float.o mpegaudiodecheader.o \ +OBJS-$(CONFIG_MP3FLOAT_DECODER) += mpegaudiodec_float.o \ + mpegaudiodecheader.o \ + mpegaudio.o mpegaudiodata.o +OBJS-$(CONFIG_MPC7_DECODER) += mpc7.o mpc.o mpegaudiodec.o \ + mpegaudiodecheader.o \ + mpegaudio.o mpegaudiodata.o +OBJS-$(CONFIG_MPC8_DECODER) += mpc8.o mpc.o mpegaudiodec.o \ + mpegaudiodecheader.o \ mpegaudio.o mpegaudiodata.o -OBJS-$(CONFIG_MPC7_DECODER) += mpc7.o mpc.o mpegaudiodec.o \ - mpegaudiodecheader.o mpegaudio.o \ - mpegaudiodata.o -OBJS-$(CONFIG_MPC8_DECODER) += mpc8.o mpc.o mpegaudiodec.o \ - mpegaudiodecheader.o mpegaudio.o \ - mpegaudiodata.o OBJS-$(CONFIG_MPEG_XVMC_DECODER) += mpegvideo_xvmc.o -OBJS-$(CONFIG_MPEG1VIDEO_DECODER) += mpeg12.o mpeg12data.o \ +OBJS-$(CONFIG_MPEG1VIDEO_DECODER) += mpeg12.o mpeg12data.o \ mpegvideo.o error_resilience.o -OBJS-$(CONFIG_MPEG1VIDEO_ENCODER) += mpeg12enc.o mpegvideo_enc.o \ - motion_est.o ratecontrol.o \ - mpeg12.o mpeg12data.o \ +OBJS-$(CONFIG_MPEG1VIDEO_ENCODER) += mpeg12enc.o mpegvideo_enc.o \ + motion_est.o ratecontrol.o \ + mpeg12.o mpeg12data.o \ mpegvideo.o error_resilience.o OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL) += dxva2_mpeg2.o OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL) += vaapi_mpeg2.o -OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12.o mpeg12data.o \ +OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12.o mpeg12data.o \ mpegvideo.o error_resilience.o -OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpegvideo_enc.o \ - motion_est.o ratecontrol.o \ - mpeg12.o mpeg12data.o \ +OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpegvideo_enc.o \ + motion_est.o ratecontrol.o \ + mpeg12.o mpeg12data.o \ mpegvideo.o error_resilience.o OBJS-$(CONFIG_MPEG4_VAAPI_HWACCEL) += vaapi_mpeg4.o OBJS-$(CONFIG_MSMPEG4V1_DECODER) += msmpeg4.o msmpeg4data.o -OBJS-$(CONFIG_MSMPEG4V2_DECODER) += msmpeg4.o msmpeg4data.o h263dec.o \ - h263.o ituh263dec.o mpeg4videodec.o -OBJS-$(CONFIG_MSMPEG4V2_ENCODER) += msmpeg4.o msmpeg4enc.o msmpeg4data.o \ - h263dec.o h263.o ituh263dec.o \ +OBJS-$(CONFIG_MSMPEG4V2_DECODER) += msmpeg4.o msmpeg4data.o \ + h263dec.o h263.o ituh263dec.o \ + mpeg4videodec.o +OBJS-$(CONFIG_MSMPEG4V2_ENCODER) += msmpeg4.o msmpeg4enc.o \ + msmpeg4data.o \ + h263dec.o h263.o ituh263dec.o \ mpeg4videodec.o -OBJS-$(CONFIG_MSMPEG4V3_DECODER) += msmpeg4.o msmpeg4data.o h263dec.o \ - h263.o ituh263dec.o mpeg4videodec.o -OBJS-$(CONFIG_MSMPEG4V3_ENCODER) += msmpeg4.o msmpeg4enc.o msmpeg4data.o \ - h263dec.o h263.o ituh263dec.o \ +OBJS-$(CONFIG_MSMPEG4V3_DECODER) += msmpeg4.o msmpeg4data.o \ + h263dec.o h263.o ituh263dec.o \ + mpeg4videodec.o +OBJS-$(CONFIG_MSMPEG4V3_ENCODER) += msmpeg4.o msmpeg4enc.o \ + msmpeg4data.o \ + h263dec.o h263.o ituh263dec.o \ mpeg4videodec.o OBJS-$(CONFIG_MSRLE_DECODER) += msrle.o msrledec.o OBJS-$(CONFIG_MSVIDEO1_DECODER) += msvideo1.o OBJS-$(CONFIG_MSZH_DECODER) += lcldec.o OBJS-$(CONFIG_MXPEG_DECODER) += mxpegdec.o mjpegdec.o mjpeg.o OBJS-$(CONFIG_NELLYMOSER_DECODER) += nellymoserdec.o nellymoser.o -OBJS-$(CONFIG_NELLYMOSER_ENCODER) += nellymoserenc.o nellymoser.o \ +OBJS-$(CONFIG_NELLYMOSER_ENCODER) += nellymoserenc.o nellymoser.o \ audio_frame_queue.o OBJS-$(CONFIG_NUV_DECODER) += nuv.o rtjpeg.o OBJS-$(CONFIG_PAM_DECODER) += pnmdec.o pnm.o @@ -317,12 +335,12 @@ OBJS-$(CONFIG_PPM_ENCODER) += pnmenc.o pnm.o OBJS-$(CONFIG_PRORES_DECODER) += proresdec.o proresdata.o proresdsp.o OBJS-$(CONFIG_PRORES_ENCODER) += proresenc.o proresdata.o proresdsp.o OBJS-$(CONFIG_PTX_DECODER) += ptx.o -OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o celp_math.o \ - celp_filters.o acelp_vectors.o \ - acelp_filters.o -OBJS-$(CONFIG_QDM2_DECODER) += qdm2.o mpegaudiodec.o \ - mpegaudiodecheader.o mpegaudio.o \ - mpegaudiodata.o +OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o celp_math.o \ + celp_filters.o \ + acelp_vectors.o acelp_filters.o +OBJS-$(CONFIG_QDM2_DECODER) += qdm2.o mpegaudiodec.o \ + mpegaudiodecheader.o \ + mpegaudio.o mpegaudiodata.o OBJS-$(CONFIG_QDRAW_DECODER) += qdrw.o OBJS-$(CONFIG_QPEG_DECODER) += qpeg.o OBJS-$(CONFIG_QTRLE_DECODER) += qtrle.o @@ -330,8 +348,8 @@ OBJS-$(CONFIG_QTRLE_ENCODER) += qtrleenc.o OBJS-$(CONFIG_R10K_DECODER) += r210dec.o OBJS-$(CONFIG_R210_DECODER) += r210dec.o OBJS-$(CONFIG_RA_144_DECODER) += ra144dec.o ra144.o celp_filters.o -OBJS-$(CONFIG_RA_144_ENCODER) += ra144enc.o ra144.o celp_filters.o \ - audio_frame_queue.o +OBJS-$(CONFIG_RA_144_ENCODER) += ra144enc.o ra144.o \ + celp_filters.o audio_frame_queue.o OBJS-$(CONFIG_RA_288_DECODER) += ra288.o celp_math.o celp_filters.o OBJS-$(CONFIG_RALF_DECODER) += ralf.o OBJS-$(CONFIG_RAWVIDEO_DECODER) += rawdec.o @@ -354,36 +372,37 @@ OBJS-$(CONFIG_S302M_DECODER) += s302m.o OBJS-$(CONFIG_SGI_DECODER) += sgidec.o OBJS-$(CONFIG_SGI_ENCODER) += sgienc.o rle.o OBJS-$(CONFIG_SHORTEN_DECODER) += shorten.o -OBJS-$(CONFIG_SIPR_DECODER) += sipr.o acelp_pitch_delay.o \ - celp_math.o acelp_vectors.o \ - acelp_filters.o celp_filters.o \ - sipr16k.o +OBJS-$(CONFIG_SIPR_DECODER) += sipr.o acelp_pitch_delay.o \ + celp_math.o acelp_vectors.o \ + acelp_filters.o \ + celp_filters.o sipr16k.o OBJS-$(CONFIG_SMACKAUD_DECODER) += smacker.o OBJS-$(CONFIG_SMACKER_DECODER) += smacker.o OBJS-$(CONFIG_SMC_DECODER) += smc.o OBJS-$(CONFIG_SNOW_DECODER) += snowdec.o snow.o rangecoder.o -OBJS-$(CONFIG_SNOW_ENCODER) += snowenc.o snow.o rangecoder.o \ - motion_est.o ratecontrol.o \ - h263.o mpegvideo.o \ - error_resilience.o ituh263enc.o \ - mpegvideo_enc.o mpeg12data.o +OBJS-$(CONFIG_SNOW_ENCODER) += snowenc.o snow.o rangecoder.o \ + motion_est.o ratecontrol.o \ + h263.o ituh263enc.o \ + mpegvideo_enc.o mpeg12data.o \ + mpegvideo.o error_resilience.o OBJS-$(CONFIG_SOL_DPCM_DECODER) += dpcm.o OBJS-$(CONFIG_SP5X_DECODER) += sp5xdec.o mjpegdec.o mjpeg.o OBJS-$(CONFIG_SRT_DECODER) += srtdec.o ass.o OBJS-$(CONFIG_SUNRAST_DECODER) += sunrast.o OBJS-$(CONFIG_SUNRAST_ENCODER) += sunrastenc.o -OBJS-$(CONFIG_SVQ1_DECODER) += svq1dec.o svq1.o h263.o \ +OBJS-$(CONFIG_SVQ1_DECODER) += svq1dec.o svq1.o h263.o \ + mpegvideo.o error_resilience.o +OBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o svq1.o \ + motion_est.o h263.o \ + ituh263enc.o mpegvideo_enc.o \ + ratecontrol.o mpeg12data.o \ mpegvideo.o error_resilience.o -OBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o svq1.o \ - motion_est.o h263.o \ - mpegvideo.o error_resilience.o \ - ituh263enc.o mpegvideo_enc.o \ - ratecontrol.o mpeg12data.o -OBJS-$(CONFIG_SVQ3_DECODER) += h264.o svq3.o \ - h264_loopfilter.o h264_direct.o \ - h264_sei.o h264_ps.o h264_refs.o \ - h264_cavlc.o h264_cabac.o cabac.o \ - mpegvideo.o error_resilience.o \ +OBJS-$(CONFIG_SVQ3_DECODER) += svq3.o h264.o h264_direct.o \ + h264_loopfilter.o h264_ps.o \ + h264_refs.o h264_sei.o \ + h264_cabac.o h264_cavlc.o \ + cabac.o mpegvideo.o \ + error_resilience.o \ svq1dec.o svq1.o h263.o OBJS-$(CONFIG_TARGA_DECODER) += targa.o OBJS-$(CONFIG_TARGA_ENCODER) += targaenc.o rle.o @@ -409,8 +428,9 @@ OBJS-$(CONFIG_V410_ENCODER) += v410enc.o OBJS-$(CONFIG_V210X_DECODER) += v210x.o OBJS-$(CONFIG_VB_DECODER) += vb.o OBJS-$(CONFIG_VBLE_DECODER) += vble.o -OBJS-$(CONFIG_VC1_DECODER) += vc1dec.o vc1.o vc1data.o vc1dsp.o \ - msmpeg4.o msmpeg4data.o \ +OBJS-$(CONFIG_VC1_DECODER) += vc1dec.o vc1.o vc1data.o \ + vc1dsp.o \ + msmpeg4.o msmpeg4data.o \ intrax8.o intrax8dsp.o OBJS-$(CONFIG_VC1_DXVA2_HWACCEL) += dxva2_vc1.o OBJS-$(CONFIG_VC1_VAAPI_HWACCEL) += vaapi_vc1.o @@ -419,15 +439,16 @@ OBJS-$(CONFIG_VCR1_ENCODER) += vcr1.o OBJS-$(CONFIG_VMDAUDIO_DECODER) += vmdav.o OBJS-$(CONFIG_VMDVIDEO_DECODER) += vmdav.o OBJS-$(CONFIG_VMNC_DECODER) += vmnc.o -OBJS-$(CONFIG_VORBIS_DECODER) += vorbisdec.o vorbis.o \ +OBJS-$(CONFIG_VORBIS_DECODER) += vorbisdec.o vorbis.o \ vorbis_data.o xiph.o -OBJS-$(CONFIG_VORBIS_ENCODER) += vorbisenc.o vorbis.o \ +OBJS-$(CONFIG_VORBIS_ENCODER) += vorbisenc.o vorbis.o \ vorbis_data.o OBJS-$(CONFIG_VP3_DECODER) += vp3.o vp3dsp.o -OBJS-$(CONFIG_VP5_DECODER) += vp5.o vp56.o vp56data.o vp56dsp.o \ - vp3dsp.o vp56rac.o -OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o vp56dsp.o \ - vp3dsp.o vp6dsp.o vp56rac.o +OBJS-$(CONFIG_VP5_DECODER) += vp5.o vp56.o vp56data.o \ + vp56dsp.o vp3dsp.o vp56rac.o +OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o \ + vp56dsp.o vp3dsp.o vp56rac.o \ + vp6dsp.o OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp8dsp.o vp56rac.o OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o @@ -437,16 +458,17 @@ OBJS-$(CONFIG_WMAV1_DECODER) += wmadec.o wma.o wma_common.o aactab.o OBJS-$(CONFIG_WMAV1_ENCODER) += wmaenc.o wma.o wma_common.o aactab.o OBJS-$(CONFIG_WMAV2_DECODER) += wmadec.o wma.o wma_common.o aactab.o OBJS-$(CONFIG_WMAV2_ENCODER) += wmaenc.o wma.o wma_common.o aactab.o -OBJS-$(CONFIG_WMAVOICE_DECODER) += wmavoice.o \ - celp_math.o celp_filters.o \ +OBJS-$(CONFIG_WMAVOICE_DECODER) += wmavoice.o \ + celp_math.o celp_filters.o \ acelp_vectors.o acelp_filters.o OBJS-$(CONFIG_WMV1_DECODER) += msmpeg4.o msmpeg4data.o -OBJS-$(CONFIG_WMV2_DECODER) += wmv2dec.o wmv2.o \ - msmpeg4.o msmpeg4data.o \ +OBJS-$(CONFIG_WMV2_DECODER) += wmv2dec.o wmv2.o \ + msmpeg4.o msmpeg4data.o \ intrax8.o intrax8dsp.o -OBJS-$(CONFIG_WMV2_ENCODER) += wmv2enc.o wmv2.o \ - msmpeg4.o msmpeg4enc.o msmpeg4data.o \ - mpeg4videodec.o ituh263dec.o h263dec.o +OBJS-$(CONFIG_WMV2_ENCODER) += wmv2enc.o wmv2.o \ + msmpeg4.o msmpeg4enc.o \ + msmpeg4data.o mpeg4videodec.o \ + h263dec.o ituh263dec.o OBJS-$(CONFIG_WNV1_DECODER) += wnv1.o OBJS-$(CONFIG_WS_SND1_DECODER) += ws-snd1.o OBJS-$(CONFIG_XAN_DPCM_DECODER) += dpcm.o @@ -567,11 +589,11 @@ OBJS-$(CONFIG_FLV_DEMUXER) += mpeg4audio.o OBJS-$(CONFIG_GXF_DEMUXER) += mpeg12data.o OBJS-$(CONFIG_IFF_DEMUXER) += iff.o OBJS-$(CONFIG_LATM_MUXER) += mpeg4audio.o -OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) += xiph.o mpeg4audio.o \ +OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) += xiph.o mpeg4audio.o \ flacdec.o flacdata.o flac.o OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o mpegaudiodata.o -OBJS-$(CONFIG_MATROSKA_MUXER) += xiph.o mpeg4audio.o \ - flacdec.o flacdata.o flac.o \ +OBJS-$(CONFIG_MATROSKA_MUXER) += xiph.o mpeg4audio.o \ + flacdec.o flacdata.o flac.o \ mpegaudiodata.o OBJS-$(CONFIG_MP3_MUXER) += mpegaudiodata.o mpegaudiodecheader.o OBJS-$(CONFIG_MOV_DEMUXER) += mpeg4audio.o mpegaudiodata.o ac3tab.o @@ -579,13 +601,13 @@ OBJS-$(CONFIG_MOV_MUXER) += mpeg4audio.o mpegaudiodata.o OBJS-$(CONFIG_MPEGTS_MUXER) += mpegvideo.o mpeg4audio.o OBJS-$(CONFIG_MPEGTS_DEMUXER) += mpeg4audio.o mpegaudiodata.o OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o -OBJS-$(CONFIG_OGG_DEMUXER) += flacdec.o flacdata.o flac.o \ +OBJS-$(CONFIG_OGG_DEMUXER) += flacdec.o flacdata.o flac.o \ dirac.o mpeg12data.o vorbis_parser.o OBJS-$(CONFIG_OGG_MUXER) += xiph.o flacdec.o flacdata.o flac.o OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o mpegvideo.o xiph.o OBJS-$(CONFIG_SPDIF_DEMUXER) += aacadtsdec.o mpeg4audio.o -OBJS-$(CONFIG_WEBM_MUXER) += xiph.o mpeg4audio.o \ - flacdec.o flacdata.o flac.o \ +OBJS-$(CONFIG_WEBM_MUXER) += xiph.o mpeg4audio.o \ + flacdec.o flacdata.o flac.o \ mpegaudiodata.o OBJS-$(CONFIG_WTV_DEMUXER) += mpeg4audio.o mpegaudiodata.o @@ -595,24 +617,26 @@ OBJS-$(CONFIG_LIBGSM_DECODER) += libgsm.o OBJS-$(CONFIG_LIBGSM_ENCODER) += libgsm.o OBJS-$(CONFIG_LIBGSM_MS_DECODER) += libgsm.o OBJS-$(CONFIG_LIBGSM_MS_ENCODER) += libgsm.o -OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o mpegaudiodecheader.o \ +OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o \ + mpegaudiodecheader.o \ audio_frame_queue.o OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER) += libopencore-amr.o OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpeg.o -OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o \ - libschroedinger.o \ +OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o \ + libschroedinger.o \ libdirac_libschro.o -OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER) += libschroedingerenc.o \ - libschroedinger.o \ +OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER) += libschroedingerenc.o \ + libschroedinger.o \ libdirac_libschro.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o audio_frame_queue.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBVO_AACENC_ENCODER) += libvo-aacenc.o mpeg4audio.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o -OBJS-$(CONFIG_LIBVORBIS_ENCODER) += libvorbis.o audio_frame_queue.o \ +OBJS-$(CONFIG_LIBVORBIS_ENCODER) += libvorbis.o \ + audio_frame_queue.o \ vorbis_data.o vorbis_parser.o OBJS-$(CONFIG_LIBVPX_DECODER) += libvpxdec.o OBJS-$(CONFIG_LIBVPX_ENCODER) += libvpxenc.o @@ -623,7 +647,7 @@ OBJS-$(CONFIG_LIBXVID) += libxvidff.o libxvid_rc.o # parsers OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \ aacadtsdec.o mpeg4audio.o -OBJS-$(CONFIG_AC3_PARSER) += ac3_parser.o ac3tab.o \ +OBJS-$(CONFIG_AC3_PARSER) += ac3_parser.o ac3tab.o \ aac_ac3_parser.o OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o @@ -637,28 +661,29 @@ OBJS-$(CONFIG_FLAC_PARSER) += flac_parser.o flacdata.o flac.o OBJS-$(CONFIG_GSM_PARSER) += gsm_parser.o OBJS-$(CONFIG_H261_PARSER) += h261_parser.o OBJS-$(CONFIG_H263_PARSER) += h263_parser.o -OBJS-$(CONFIG_H264_PARSER) += h264_parser.o h264.o \ - cabac.o \ - h264_refs.o h264_sei.o h264_direct.o \ - h264_loopfilter.o h264_cabac.o \ - h264_cavlc.o h264_ps.o \ - mpegvideo.o error_resilience.o +OBJS-$(CONFIG_H264_PARSER) += h264_parser.o h264.o \ + h264_direct.o \ + h264_loopfilter.o h264_ps.o \ + h264_refs.o h264_sei.o \ + h264_cabac.o h264_cavlc.o \ + cabac.o mpegvideo.o \ + error_resilience.o OBJS-$(CONFIG_AAC_LATM_PARSER) += latm_parser.o OBJS-$(CONFIG_MJPEG_PARSER) += mjpeg_parser.o OBJS-$(CONFIG_MLP_PARSER) += mlp_parser.o mlp.o -OBJS-$(CONFIG_MPEG4VIDEO_PARSER) += mpeg4video_parser.o h263.o \ - mpegvideo.o error_resilience.o \ - mpeg4videodec.o mpeg4video.o \ - ituh263dec.o h263dec.o -OBJS-$(CONFIG_MPEGAUDIO_PARSER) += mpegaudio_parser.o \ +OBJS-$(CONFIG_MPEG4VIDEO_PARSER) += mpeg4video_parser.o h263.o \ + mpeg4videodec.o mpeg4video.o \ + ituh263dec.o h263dec.o \ + mpegvideo.o error_resilience.o +OBJS-$(CONFIG_MPEGAUDIO_PARSER) += mpegaudio_parser.o \ mpegaudiodecheader.o mpegaudiodata.o -OBJS-$(CONFIG_MPEGVIDEO_PARSER) += mpegvideo_parser.o \ - mpeg12.o mpeg12data.o \ +OBJS-$(CONFIG_MPEGVIDEO_PARSER) += mpegvideo_parser.o \ + mpeg12.o mpeg12data.o \ mpegvideo.o error_resilience.o OBJS-$(CONFIG_PNM_PARSER) += pnm_parser.o pnm.o OBJS-$(CONFIG_RV30_PARSER) += rv34_parser.o OBJS-$(CONFIG_RV40_PARSER) += rv34_parser.o -OBJS-$(CONFIG_VC1_PARSER) += vc1_parser.o vc1.o vc1data.o \ +OBJS-$(CONFIG_VC1_PARSER) += vc1_parser.o vc1.o vc1data.o \ msmpeg4.o msmpeg4data.o mpeg4video.o \ h263.o mpegvideo.o error_resilience.o OBJS-$(CONFIG_VORBIS_PARSER) += vorbis_parser.o xiph.o @@ -666,7 +691,8 @@ OBJS-$(CONFIG_VP3_PARSER) += vp3_parser.o OBJS-$(CONFIG_VP8_PARSER) += vp8_parser.o # bitstream filters -OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o aacadtsdec.o \ +OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o \ + aacadtsdec.o \ mpeg4audio.o OBJS-$(CONFIG_CHOMP_BSF) += chomp_bsf.o OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o diff --git a/libavdevice/Makefile b/libavdevice/Makefile index bc55405..8d76483 100644 --- a/libavdevice/Makefile +++ b/libavdevice/Makefile @@ -7,9 +7,9 @@ OBJS = alldevices.o \ avdevice.o \ # input/output devices -OBJS-$(CONFIG_ALSA_INDEV) += alsa-audio-common.o \ +OBJS-$(CONFIG_ALSA_INDEV) += alsa-audio-common.o \ alsa-audio-dec.o -OBJS-$(CONFIG_ALSA_OUTDEV) += alsa-audio-common.o \ +OBJS-$(CONFIG_ALSA_OUTDEV) += alsa-audio-common.o \ alsa-audio-enc.o OBJS-$(CONFIG_BKTR_INDEV) += bktr.o OBJS-$(CONFIG_DV1394_INDEV) += dv1394.o diff --git a/libavformat/Makefile b/libavformat/Makefile index 9a6cb55..62b35cf 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -5,19 +5,19 @@ HEADERS = avformat.h \ avio.h \ version.h \ -OBJS = allformats.o \ - avio.o \ - aviobuf.o \ - cutils.o \ - id3v1.o \ - id3v2.o \ - metadata.o \ - options.o \ - os_support.o \ - riff.o \ - sdp.o \ - seek.o \ - utils.o \ +OBJS = allformats.o \ + avio.o \ + aviobuf.o \ + cutils.o \ + id3v1.o \ + id3v2.o \ + metadata.o \ + options.o \ + os_support.o \ + riff.o \ + sdp.o \ + seek.o \ + utils.o \ OBJS-$(CONFIG_NETWORK) += network.o @@ -37,7 +37,7 @@ OBJS-$(CONFIG_AMR_MUXER) += amr.o OBJS-$(CONFIG_ANM_DEMUXER) += anm.o OBJS-$(CONFIG_APC_DEMUXER) += apc.o OBJS-$(CONFIG_APE_DEMUXER) += ape.o apetag.o -OBJS-$(CONFIG_ASF_DEMUXER) += asfdec.o asf.o asfcrypt.o \ +OBJS-$(CONFIG_ASF_DEMUXER) += asfdec.o asf.o asfcrypt.o \ avlanguage.o OBJS-$(CONFIG_ASF_MUXER) += asfenc.o asf.o OBJS-$(CONFIG_ASS_DEMUXER) += assdec.o @@ -54,8 +54,8 @@ OBJS-$(CONFIG_BFI_DEMUXER) += bfi.o OBJS-$(CONFIG_BINK_DEMUXER) += bink.o OBJS-$(CONFIG_BMV_DEMUXER) += bmv.o OBJS-$(CONFIG_C93_DEMUXER) += c93.o vocdec.o voc.o -OBJS-$(CONFIG_CAF_DEMUXER) += cafdec.o caf.o mov.o mov_chan.o \ - isom.o +OBJS-$(CONFIG_CAF_DEMUXER) += cafdec.o caf.o mov.o \ + mov_chan.o isom.o OBJS-$(CONFIG_CAVSVIDEO_DEMUXER) += cavsvideodec.o rawdec.o OBJS-$(CONFIG_CAVSVIDEO_MUXER) += rawenc.o OBJS-$(CONFIG_CDG_DEMUXER) += cdg.o @@ -84,10 +84,10 @@ OBJS-$(CONFIG_FFMETADATA_DEMUXER) += ffmetadec.o OBJS-$(CONFIG_FFMETADATA_MUXER) += ffmetaenc.o OBJS-$(CONFIG_FILMSTRIP_DEMUXER) += filmstripdec.o OBJS-$(CONFIG_FILMSTRIP_MUXER) += filmstripenc.o -OBJS-$(CONFIG_FLAC_DEMUXER) += flacdec.o rawdec.o \ - oggparsevorbis.o \ +OBJS-$(CONFIG_FLAC_DEMUXER) += flacdec.o rawdec.o \ + oggparsevorbis.o \ vorbiscomment.o -OBJS-$(CONFIG_FLAC_MUXER) += flacenc.o flacenc_header.o \ +OBJS-$(CONFIG_FLAC_MUXER) += flacenc.o flacenc_header.o \ vorbiscomment.o OBJS-$(CONFIG_FLIC_DEMUXER) += flic.o OBJS-$(CONFIG_FLV_DEMUXER) += flvdec.o @@ -127,10 +127,10 @@ OBJS-$(CONFIG_LMLM4_DEMUXER) += lmlm4.o OBJS-$(CONFIG_LXF_DEMUXER) += lxfdec.o OBJS-$(CONFIG_M4V_DEMUXER) += m4vdec.o rawdec.o OBJS-$(CONFIG_M4V_MUXER) += rawenc.o -OBJS-$(CONFIG_MATROSKA_DEMUXER) += matroskadec.o matroska.o \ +OBJS-$(CONFIG_MATROSKA_DEMUXER) += matroskadec.o matroska.o \ isom.o rmdec.o rm.o -OBJS-$(CONFIG_MATROSKA_MUXER) += matroskaenc.o matroska.o \ - isom.o avc.o \ +OBJS-$(CONFIG_MATROSKA_MUXER) += matroskaenc.o matroska.o \ + isom.o avc.o \ flacenc_header.o avlanguage.o OBJS-$(CONFIG_MD5_MUXER) += md5enc.o OBJS-$(CONFIG_MJPEG_DEMUXER) += rawdec.o @@ -141,7 +141,7 @@ OBJS-$(CONFIG_MM_DEMUXER) += mm.o OBJS-$(CONFIG_MMF_DEMUXER) += mmf.o pcm.o OBJS-$(CONFIG_MMF_MUXER) += mmf.o OBJS-$(CONFIG_MOV_DEMUXER) += mov.o isom.o mov_chan.o -OBJS-$(CONFIG_MOV_MUXER) += movenc.o isom.o avc.o \ +OBJS-$(CONFIG_MOV_MUXER) += movenc.o isom.o avc.o \ movenchint.o rtpenc_chain.o \ mov_chan.o OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o rawenc.o @@ -173,17 +173,17 @@ OBJS-$(CONFIG_NULL_MUXER) += nullenc.o OBJS-$(CONFIG_NUT_DEMUXER) += nutdec.o nut.o OBJS-$(CONFIG_NUT_MUXER) += nutenc.o nut.o OBJS-$(CONFIG_NUV_DEMUXER) += nuv.o -OBJS-$(CONFIG_OGG_DEMUXER) += oggdec.o \ - oggparsecelt.o \ - oggparsedirac.o \ - oggparseflac.o \ - oggparseogm.o \ - oggparseskeleton.o \ - oggparsespeex.o \ - oggparsetheora.o \ - oggparsevorbis.o \ +OBJS-$(CONFIG_OGG_DEMUXER) += oggdec.o \ + oggparsecelt.o \ + oggparsedirac.o \ + oggparseflac.o \ + oggparseogm.o \ + oggparseskeleton.o \ + oggparsespeex.o \ + oggparsetheora.o \ + oggparsevorbis.o \ vorbiscomment.o -OBJS-$(CONFIG_OGG_MUXER) += oggenc.o \ +OBJS-$(CONFIG_OGG_MUXER) += oggenc.o \ vorbiscomment.o OBJS-$(CONFIG_OMA_DEMUXER) += omadec.o pcm.o oma.o OBJS-$(CONFIG_OMA_MUXER) += omaenc.o rawenc.o oma.o id3v2enc.o @@ -241,34 +241,34 @@ OBJS-$(CONFIG_ROQ_MUXER) += idroqenc.o rawenc.o OBJS-$(CONFIG_RSO_DEMUXER) += rsodec.o rso.o pcm.o OBJS-$(CONFIG_RSO_MUXER) += rsoenc.o rso.o OBJS-$(CONFIG_RPL_DEMUXER) += rpl.o -OBJS-$(CONFIG_RTP_MUXER) += rtp.o \ - rtpenc_aac.o \ - rtpenc_latm.o \ - rtpenc_amr.o \ - rtpenc_h263.o \ - rtpenc_h263_rfc2190.o \ - rtpenc_mpv.o \ - rtpenc.o \ - rtpenc_h264.o \ - rtpenc_vp8.o \ - rtpenc_xiph.o \ +OBJS-$(CONFIG_RTP_MUXER) += rtp.o \ + rtpenc_aac.o \ + rtpenc_latm.o \ + rtpenc_amr.o \ + rtpenc_h263.o \ + rtpenc_h263_rfc2190.o \ + rtpenc_mpv.o \ + rtpenc.o \ + rtpenc_h264.o \ + rtpenc_vp8.o \ + rtpenc_xiph.o \ avc.o -OBJS-$(CONFIG_RTPDEC) += rdt.o \ - rtp.o \ - rtpdec.o \ - rtpdec_amr.o \ - rtpdec_asf.o \ - rtpdec_g726.o \ - rtpdec_h263.o \ - rtpdec_h263_rfc2190.o \ - rtpdec_h264.o \ - rtpdec_latm.o \ - rtpdec_mpeg4.o \ - rtpdec_qcelp.o \ - rtpdec_qdm2.o \ - rtpdec_qt.o \ - rtpdec_svq3.o \ - rtpdec_vp8.o \ +OBJS-$(CONFIG_RTPDEC) += rdt.o \ + rtp.o \ + rtpdec.o \ + rtpdec_amr.o \ + rtpdec_asf.o \ + rtpdec_g726.o \ + rtpdec_h263.o \ + rtpdec_h263_rfc2190.o \ + rtpdec_h264.o \ + rtpdec_latm.o \ + rtpdec_mpeg4.o \ + rtpdec_qcelp.o \ + rtpdec_qdm2.o \ + rtpdec_qt.o \ + rtpdec_svq3.o \ + rtpdec_vp8.o \ rtpdec_xiph.o OBJS-$(CONFIG_RTSP_DEMUXER) += rtsp.o rtspdec.o httpauth.o OBJS-$(CONFIG_RTSP_MUXER) += rtsp.o rtspenc.o httpauth.o \ @@ -312,13 +312,14 @@ OBJS-$(CONFIG_W64_DEMUXER) += wav.o pcm.o OBJS-$(CONFIG_WAV_DEMUXER) += wav.o pcm.o OBJS-$(CONFIG_WAV_MUXER) += wav.o OBJS-$(CONFIG_WC3_DEMUXER) += wc3movie.o -OBJS-$(CONFIG_WEBM_MUXER) += matroskaenc.o matroska.o \ - isom.o avc.o \ +OBJS-$(CONFIG_WEBM_MUXER) += matroskaenc.o matroska.o \ + isom.o avc.o \ flacenc_header.o avlanguage.o OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood_aud.o OBJS-$(CONFIG_WSVQA_DEMUXER) += westwood_vqa.o -OBJS-$(CONFIG_WTV_DEMUXER) += wtv.o asfdec.o asf.o asfcrypt.o \ - avlanguage.o mpegts.o isom.o +OBJS-$(CONFIG_WTV_DEMUXER) += wtv.o asfdec.o asf.o \ + asfcrypt.o avlanguage.o \ + mpegts.o isom.o OBJS-$(CONFIG_WV_DEMUXER) += wv.o apetag.o OBJS-$(CONFIG_XA_DEMUXER) += xa.o OBJS-$(CONFIG_XMV_DEMUXER) += xmv.o diff --git a/library.mak b/library.mak index 6159799..b01b32d 100644 --- a/library.mak +++ b/library.mak @@ -46,7 +46,8 @@ $(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver $(DEP_LIBS) $(SLIB_EXTRA_CMD) clean:: - $(RM) $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \ + $(RM) $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) \ + $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \ $(CLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%) $(HOSTOBJS) $(HOSTPROGS) distclean:: clean @@ -74,8 +75,8 @@ install-lib$(NAME)-pkgconfig: $(SUBDIR)lib$(NAME).pc $$(INSTALL) -m 644 $$^ "$(LIBDIR)/pkgconfig" uninstall-libs:: - -$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \ - "$(SHLIBDIR)/$(SLIBNAME)" \ + -$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \ + "$(SHLIBDIR)/$(SLIBNAME)" \ "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)" -$(RM) $(SLIB_INSTALL_EXTRA_SHLIB:%="$(SHLIBDIR)"%) -$(RM) $(SLIB_INSTALL_EXTRA_LIB:%="$(LIBDIR)"%) diff --git a/libswscale/Makefile b/libswscale/Makefile index 349dd99..4ebe19c 100644 --- a/libswscale/Makefile +++ b/libswscale/Makefile @@ -3,14 +3,14 @@ FFLIBS = avutil HEADERS = swscale.h -OBJS = input.o \ - options.o \ - output.o \ - rgb2rgb.o \ - swscale.o \ - swscale_unscaled.o \ - utils.o \ - yuv2rgb.o \ +OBJS = input.o \ + options.o \ + output.o \ + rgb2rgb.o \ + swscale.o \ + swscale_unscaled.o \ + utils.o \ + yuv2rgb.o \ TESTPROGS = colorspace \ swscale \ -- 1.7.1 From diego at biurrun.de Mon May 7 12:12:15 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 12:12:15 +0200 Subject: [libav-devel] [PATCH 4/4] build: cosmetics: Reorder some entries for improved consistency. In-Reply-To: References: Message-ID: <1336385535-4048-4-git-send-email-diego@biurrun.de> --- libavcodec/arm/Makefile | 74 +++++++++++++++++---------------------------- libavcodec/x86/Makefile | 18 +++++----- libavfilter/x86/Makefile | 2 +- 3 files changed, 38 insertions(+), 56 deletions(-) diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile index d2bdd50..0c315cf 100644 --- a/libavcodec/arm/Makefile +++ b/libavcodec/arm/Makefile @@ -1,25 +1,14 @@ +OBJS-$(CONFIG_AAC_DECODER) += arm/aacpsdsp_init_arm.o \ + arm/sbrdsp_init_arm.o OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_init_arm.o \ arm/ac3dsp_arm.o - -OBJS-$(CONFIG_AAC_DECODER) += arm/sbrdsp_init_arm.o \ - arm/aacpsdsp_init_arm.o - -OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_init_arm.o \ - -ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o - +OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_init_arm.o +OBJS-$(CONFIG_H264DSP) += arm/h264dsp_init_arm.o +OBJS-$(CONFIG_H264PRED) += arm/h264pred_init_arm.o OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_init_arm.o -ARMV6-OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_fixed_armv6.o - OBJS-$(CONFIG_VP5_DECODER) += arm/vp56dsp_init_arm.o OBJS-$(CONFIG_VP6_DECODER) += arm/vp56dsp_init_arm.o OBJS-$(CONFIG_VP8_DECODER) += arm/vp8dsp_init_arm.o -ARMV6-OBJS-$(CONFIG_VP8_DECODER) += arm/vp8_armv6.o \ - arm/vp8dsp_init_armv6.o \ - arm/vp8dsp_armv6.o - -OBJS-$(CONFIG_H264DSP) += arm/h264dsp_init_arm.o -OBJS-$(CONFIG_H264PRED) += arm/h264pred_init_arm.o OBJS += arm/dsputil_init_arm.o \ arm/dsputil_arm.o \ @@ -35,54 +24,47 @@ ARMV5TE-OBJS += arm/dsputil_init_armv5te.o \ arm/mpegvideo_armv5te_s.o \ arm/simple_idct_armv5te.o \ +ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o +ARMV6-OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_fixed_armv6.o +ARMV6-OBJS-$(CONFIG_VP8_DECODER) += arm/vp8_armv6.o \ + arm/vp8dsp_armv6.o \ + arm/vp8dsp_init_armv6.o + ARMV6-OBJS += arm/dsputil_init_armv6.o \ arm/dsputil_armv6.o \ arm/simple_idct_armv6.o \ ARMVFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o -ARMVFP-OBJS += arm/dsputil_vfp.o \ - arm/dsputil_init_vfp.o \ +ARMVFP-OBJS += arm/dsputil_init_vfp.o \ + arm/dsputil_vfp.o \ +NEON-OBJS-$(CONFIG_AAC_DECODER) += arm/aacpsdsp_neon.o \ + arm/sbrdsp_neon.o +NEON-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_neon.o +NEON-OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_neon.o \ + arm/synth_filter_neon.o NEON-OBJS-$(CONFIG_FFT) += arm/fft_neon.o \ - arm/fft_fixed_neon.o \ - -NEON-OBJS-$(CONFIG_MDCT) += arm/mdct_neon.o \ - arm/mdct_fixed_neon.o \ - -NEON-OBJS-$(CONFIG_RDFT) += arm/rdft_neon.o \ - + arm/fft_fixed_neon.o NEON-OBJS-$(CONFIG_H264DSP) += arm/h264dsp_neon.o \ arm/h264idct_neon.o \ - arm/h264cmc_neon.o \ - -NEON-OBJS-$(CONFIG_H264PRED) += arm/h264pred_neon.o \ - -NEON-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_neon.o - -NEON-OBJS-$(CONFIG_AAC_DECODER) += arm/sbrdsp_neon.o \ - arm/aacpsdsp_neon.o - -NEON-OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_neon.o \ - arm/synth_filter_neon.o \ - + arm/h264cmc_neon.o +NEON-OBJS-$(CONFIG_H264PRED) += arm/h264pred_neon.o +NEON-OBJS-$(CONFIG_MDCT) += arm/mdct_neon.o \ + arm/mdct_fixed_neon.o +NEON-OBJS-$(CONFIG_RDFT) += arm/rdft_neon.o NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_init_neon.o \ - arm/rv34dsp_neon.o \ - + arm/rv34dsp_neon.o NEON-OBJS-$(CONFIG_RV40_DECODER) += arm/rv34dsp_init_neon.o \ arm/rv34dsp_neon.o \ arm/rv40dsp_init_neon.o \ arm/rv40dsp_neon.o \ - arm/h264cmc_neon.o \ - + arm/h264cmc_neon.o NEON-OBJS-$(CONFIG_VP3_DECODER) += arm/vp3dsp_neon.o - NEON-OBJS-$(CONFIG_VP5_DECODER) += arm/vp56dsp_neon.o \ - arm/vp3dsp_neon.o \ - + arm/vp3dsp_neon.o NEON-OBJS-$(CONFIG_VP6_DECODER) += arm/vp56dsp_neon.o \ - arm/vp3dsp_neon.o \ - + arm/vp3dsp_neon.o NEON-OBJS-$(CONFIG_VP8_DECODER) += arm/vp8dsp_init_neon.o \ arm/vp8dsp_neon.o diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile index 6602cce..2ebe3d5 100644 --- a/libavcodec/x86/Makefile +++ b/libavcodec/x86/Makefile @@ -2,15 +2,6 @@ OBJS-$(CONFIG_MLP_DECODER) += x86/mlpdsp.o OBJS-$(CONFIG_TRUEHD_DECODER) += x86/mlpdsp.o OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o -MMX-OBJS += x86/dsputil_mmx.o \ - x86/fdct_mmx.o \ - x86/fmtconvert_mmx.o \ - x86/idct_mmx_xvid.o \ - x86/idct_sse2_xvid.o \ - x86/motion_est_mmx.o \ - x86/mpegvideo_mmx.o \ - x86/simple_idct_mmx.o \ - MMX-OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp_init.o MMX-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp_mmx.o MMX-OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsdsp_mmx.o @@ -33,6 +24,15 @@ MMX-OBJS-$(CONFIG_VP5_DECODER) += x86/vp56dsp_init.o MMX-OBJS-$(CONFIG_VP6_DECODER) += x86/vp56dsp_init.o MMX-OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp-init.o +MMX-OBJS += x86/dsputil_mmx.o \ + x86/fdct_mmx.o \ + x86/fmtconvert_mmx.o \ + x86/idct_mmx_xvid.o \ + x86/idct_sse2_xvid.o \ + x86/motion_est_mmx.o \ + x86/mpegvideo_mmx.o \ + x86/simple_idct_mmx.o \ + YASM-OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp.o YASM-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp.o YASM-OBJS-$(CONFIG_DCT) += x86/dct32_sse.o diff --git a/libavfilter/x86/Makefile b/libavfilter/x86/Makefile index e98693d..923caf9 100644 --- a/libavfilter/x86/Makefile +++ b/libavfilter/x86/Makefile @@ -1,2 +1,2 @@ -MMX-OBJS-$(CONFIG_YADIF_FILTER) += x86/yadif.o MMX-OBJS-$(CONFIG_GRADFUN_FILTER) += x86/gradfun.o +MMX-OBJS-$(CONFIG_YADIF_FILTER) += x86/yadif.o -- 1.7.1 From diego at biurrun.de Mon May 7 12:13:25 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 12:13:25 +0200 Subject: [libav-devel] [PATCH 2/4] Move code shared between libdirac and?libschroedinger to libschroedinger. In-Reply-To: References: <1334410860-5890-1-git-send-email-diego@biurrun.de> <1334410860-5890-2-git-send-email-diego@biurrun.de> <20120506215038.GA31444@pool.informatik.rwth-aachen.de> Message-ID: <20120507101325.GC15241@pool.informatik.rwth-aachen.de> On Mon, May 07, 2012 at 11:42:33AM +0200, Jordi Ortiz wrote: > > > > What you quote is the code I removed. In the code I added I kept the > > original formatting even though it could be improved so as not to throw > > off the Git content move detection logic. > > You are right. I answered from gmane and it was a bit 'tricky'. Sorry. > > > The AV prefix is for externally visible structures, FF for internal ones. > > ok, thanks So what about the patch? Diego From anton at khirnov.net Mon May 7 12:21:41 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 7 May 2012 12:21:41 +0200 Subject: [libav-devel] [PATCH] lavf: add missing '*' in a doxy. Message-ID: <1336386101-4384-1-git-send-email-anton@khirnov.net> --- libavformat/avformat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 087b0b4..33e9098 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -817,7 +817,7 @@ typedef struct AVFormatContext { */ void *priv_data; - /* + /** * I/O context. * * decoding: either set by the user before avformat_open_input() (then -- 1.7.9.5 From diego at biurrun.de Mon May 7 12:21:59 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 12:21:59 +0200 Subject: [libav-devel] [PATCH 04/12] cmdutils: Add fallback case to switch in check_stream_specifier(). In-Reply-To: <1334840823-22614-4-git-send-email-diego@biurrun.de> References: <1334840823-22614-1-git-send-email-diego@biurrun.de> <1334840823-22614-4-git-send-email-diego@biurrun.de> Message-ID: <20120507102159.GD15241@pool.informatik.rwth-aachen.de> On Thu, Apr 19, 2012 at 03:06:55PM +0200, Diego Biurrun wrote: > This fixes the warning: > cmdutils.c:897: warning: ?type? may be used uninitialized in this function > --- > cmdutils.c | 1 + > 1 files changed, 1 insertions(+), 0 deletions(-) ping Diego From diego at biurrun.de Mon May 7 12:22:11 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 12:22:11 +0200 Subject: [libav-devel] [PATCH 05/12] av_samples_fill_array: Mark unmodified function argument as const. In-Reply-To: <1334840823-22614-5-git-send-email-diego@biurrun.de> References: <1334840823-22614-1-git-send-email-diego@biurrun.de> <1334840823-22614-5-git-send-email-diego@biurrun.de> Message-ID: <20120507102211.GE15241@pool.informatik.rwth-aachen.de> On Thu, Apr 19, 2012 at 03:06:56PM +0200, Diego Biurrun wrote: > libavcodec/utils.c:274: warning: passing argument 3 of ?av_samples_fill_arrays? discards qualifiers from pointer target type > ./libavutil/samplefmt.h:151: note: expected ?uint8_t *? but argument is of type ?const uint8_t *? > --- > libavutil/samplefmt.c | 2 +- > libavutil/samplefmt.h | 3 ++- > 2 files changed, 3 insertions(+), 2 deletions(-) ping Diego From diego at biurrun.de Mon May 7 12:22:34 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 12:22:34 +0200 Subject: [libav-devel] [PATCH 08/12] mmvideo.c: Remove unused variable in mm_decode_pal(). In-Reply-To: <1334840823-22614-8-git-send-email-diego@biurrun.de> References: <1334840823-22614-1-git-send-email-diego@biurrun.de> <1334840823-22614-8-git-send-email-diego@biurrun.de> Message-ID: <20120507102234.GF15241@pool.informatik.rwth-aachen.de> On Thu, Apr 19, 2012 at 03:06:59PM +0200, Diego Biurrun wrote: > libavcodec/mmvideo.c:87:9: warning: variable ?i? set but not used > --- > libavcodec/mmvideo.c | 3 +-- > 1 files changed, 1 insertions(+), 2 deletions(-) ping Diego From diego at biurrun.de Mon May 7 12:22:55 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 12:22:55 +0200 Subject: [libav-devel] [PATCH 10/12] mov: Remove write-only variable in mov_read_chan(). In-Reply-To: <1334840823-22614-10-git-send-email-diego@biurrun.de> References: <1334840823-22614-1-git-send-email-diego@biurrun.de> <1334840823-22614-10-git-send-email-diego@biurrun.de> Message-ID: <20120507102255.GG15241@pool.informatik.rwth-aachen.de> On Thu, Apr 19, 2012 at 03:07:01PM +0200, Diego Biurrun wrote: > libavformat/mov.c:597:25: warning: variable ?cflags? set but not used > --- > libavformat/mov.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) ping Diego From diego at biurrun.de Mon May 7 12:23:06 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 12:23:06 +0200 Subject: [libav-devel] [PATCH 11/12] txd: Remove write-only variable in txd_decode_frame(). In-Reply-To: <1334840823-22614-11-git-send-email-diego@biurrun.de> References: <1334840823-22614-1-git-send-email-diego@biurrun.de> <1334840823-22614-11-git-send-email-diego@biurrun.de> Message-ID: <20120507102306.GH15241@pool.informatik.rwth-aachen.de> On Thu, Apr 19, 2012 at 03:07:02PM +0200, Diego Biurrun wrote: > libavcodec/txd.c:49:60: warning: variable ?mipmap_count? set but not used > --- > libavcodec/txd.c | 5 ++--- > 1 files changed, 2 insertions(+), 3 deletions(-) ping Diego From diego at biurrun.de Mon May 7 12:23:18 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 12:23:18 +0200 Subject: [libav-devel] [PATCH 12/12] jpeglsdec: Remove write-only variable in ff_jpegls_decode_lse(). In-Reply-To: <1334840823-22614-12-git-send-email-diego@biurrun.de> References: <1334840823-22614-1-git-send-email-diego@biurrun.de> <1334840823-22614-12-git-send-email-diego@biurrun.de> Message-ID: <20120507102318.GI15241@pool.informatik.rwth-aachen.de> On Thu, Apr 19, 2012 at 03:07:03PM +0200, Diego Biurrun wrote: > libavcodec/jpeglsdec.c:54:9: warning: variable ?len? set but not used > --- > libavcodec/jpeglsdec.c | 5 ++--- > 1 files changed, 2 insertions(+), 3 deletions(-) ping Diego From kostya.shishkov at gmail.com Mon May 7 12:34:22 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Mon, 7 May 2012 12:34:22 +0200 Subject: [libav-devel] [PATCH 08/12] mmvideo.c: Remove unused variable in mm_decode_pal(). In-Reply-To: <20120507102234.GF15241@pool.informatik.rwth-aachen.de> References: <1334840823-22614-1-git-send-email-diego@biurrun.de> <1334840823-22614-8-git-send-email-diego@biurrun.de> <20120507102234.GF15241@pool.informatik.rwth-aachen.de> Message-ID: <20120507103421.GA29734@kst-acer> On Mon, May 07, 2012 at 12:22:34PM +0200, Diego Biurrun wrote: > On Thu, Apr 19, 2012 at 03:06:59PM +0200, Diego Biurrun wrote: > > libavcodec/mmvideo.c:87:9: warning: variable ?i? set but not used > > --- > > libavcodec/mmvideo.c | 3 +-- > > 1 files changed, 1 insertions(+), 2 deletions(-) > > ping probably OK From kostya.shishkov at gmail.com Mon May 7 12:36:00 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Mon, 7 May 2012 12:36:00 +0200 Subject: [libav-devel] [PATCH 12/12] jpeglsdec: Remove write-only variable in ff_jpegls_decode_lse(). In-Reply-To: <20120507102318.GI15241@pool.informatik.rwth-aachen.de> References: <1334840823-22614-1-git-send-email-diego@biurrun.de> <1334840823-22614-12-git-send-email-diego@biurrun.de> <20120507102318.GI15241@pool.informatik.rwth-aachen.de> Message-ID: <20120507103600.GB29734@kst-acer> On Mon, May 07, 2012 at 12:23:18PM +0200, Diego Biurrun wrote: > On Thu, Apr 19, 2012 at 03:07:03PM +0200, Diego Biurrun wrote: > > libavcodec/jpeglsdec.c:54:9: warning: variable ?len? set but not used > > --- > > libavcodec/jpeglsdec.c | 5 ++--- > > 1 files changed, 2 insertions(+), 3 deletions(-) > > ping line 53 is: /* XXX: verify len field validity */ so let it stand there till someone fixes it for real by checking that value instead of simply ignoring it. From kostya.shishkov at gmail.com Mon May 7 12:37:03 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Mon, 7 May 2012 12:37:03 +0200 Subject: [libav-devel] [PATCH 11/12] txd: Remove write-only variable in txd_decode_frame(). In-Reply-To: <20120507102306.GH15241@pool.informatik.rwth-aachen.de> References: <1334840823-22614-1-git-send-email-diego@biurrun.de> <1334840823-22614-11-git-send-email-diego@biurrun.de> <20120507102306.GH15241@pool.informatik.rwth-aachen.de> Message-ID: <20120507103703.GA29793@kst-acer> On Mon, May 07, 2012 at 12:23:06PM +0200, Diego Biurrun wrote: > On Thu, Apr 19, 2012 at 03:07:02PM +0200, Diego Biurrun wrote: > > libavcodec/txd.c:49:60: warning: variable ?mipmap_count? set but not used > > --- > > libavcodec/txd.c | 5 ++--- > > 1 files changed, 2 insertions(+), 3 deletions(-) > > ping looks OK From diego at biurrun.de Mon May 7 13:00:31 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 13:00:31 +0200 Subject: [libav-devel] [PATCH] lavf: add missing '*' in a doxy. In-Reply-To: <1336386101-4384-1-git-send-email-anton@khirnov.net> References: <1336386101-4384-1-git-send-email-anton@khirnov.net> Message-ID: <20120507110030.GJ15241@pool.informatik.rwth-aachen.de> On Mon, May 07, 2012 at 12:21:41PM +0200, Anton Khirnov wrote: > --- > libavformat/avformat.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) OK Diego From benjamin at southpole.se Mon May 7 13:01:56 2012 From: benjamin at southpole.se (Benjamin Larsson) Date: Mon, 07 May 2012 13:01:56 +0200 Subject: [libav-devel] [PATCH] qdm2: clip array indices returned by qdm2_get_vlc(). In-Reply-To: <1335978766-85523-1-git-send-email-rsbultje@gmail.com> References: <1333047654-49291-1-git-send-email-rsbultje@gmail.com> <1335978766-85523-1-git-send-email-rsbultje@gmail.com> Message-ID: <4FA7ABA4.7020306@southpole.se> OK From mans at mansr.com Mon May 7 13:03:24 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Mon, 07 May 2012 12:03:24 +0100 Subject: [libav-devel] [PATCH] lavfi: uninline avfilter_copy_buffer_ref_props(). In-Reply-To: <1336367815-24770-1-git-send-email-anton@khirnov.net> (Anton Khirnov's message of "Mon, 7 May 2012 07:16:55 +0200") References: <1336367815-24770-1-git-send-email-anton@khirnov.net> Message-ID: Anton Khirnov writes: > A nontrivial public function such as this should most certainly NOT be > inline. > --- > libavfilter/avfilter.c | 13 +++++++++++++ > libavfilter/avfilter.h | 13 +------------ > libavfilter/version.h | 2 +- > 3 files changed, 15 insertions(+), 13 deletions(-) LGTM -- M?ns Rullg?rd mans at mansr.com From mans at mansr.com Mon May 7 13:05:58 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Mon, 07 May 2012 12:05:58 +0100 Subject: [libav-devel] [PATCH 3/4] build: cosmetics: Add missing end-of-line backslashes from item lists. In-Reply-To: <1336385535-4048-3-git-send-email-diego@biurrun.de> (Diego Biurrun's message of "Mon, 07 May 2012 12:12:14 +0200") References: <1336385535-4048-3-git-send-email-diego@biurrun.de> Message-ID: Diego Biurrun writes: > --- > libavcodec/Makefile | 3 ++- > libavfilter/Makefile | 2 +- > libavresample/Makefile | 4 ++-- > libavresample/x86/Makefile | 4 ++-- > libavutil/arm/Makefile | 2 +- > 5 files changed, 8 insertions(+), 7 deletions(-) OK -- M?ns Rullg?rd mans at mansr.com From mans at mansr.com Mon May 7 13:08:54 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Mon, 07 May 2012 12:08:54 +0100 Subject: [libav-devel] [PATCH 1/4] build: cosmetics: Split HEADERS/OBJS/PROGS lists into one entry per line. In-Reply-To: <1336385535-4048-1-git-send-email-diego@biurrun.de> (Diego Biurrun's message of "Mon, 07 May 2012 12:12:12 +0200") References: <1336385535-4048-1-git-send-email-diego@biurrun.de> Message-ID: Diego Biurrun writes: > --- > libavcodec/Makefile | 31 ++++++++++++++++++++++++++----- > libavdevice/Makefile | 3 ++- > libavfilter/Makefile | 9 +++++++-- > libavformat/Makefile | 14 +++++++++++--- > libavutil/Makefile | 25 +++++++++++++++++++++---- > libswscale/Makefile | 3 ++- > 6 files changed, 69 insertions(+), 16 deletions(-) OK -- M?ns Rullg?rd mans at mansr.com From mans at mansr.com Mon May 7 13:06:24 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Mon, 07 May 2012 12:06:24 +0100 Subject: [libav-devel] [PATCH 4/4] build: cosmetics: Reorder some entries for improved consistency. In-Reply-To: <1336385535-4048-4-git-send-email-diego@biurrun.de> (Diego Biurrun's message of "Mon, 07 May 2012 12:12:15 +0200") References: <1336385535-4048-4-git-send-email-diego@biurrun.de> Message-ID: Diego Biurrun writes: > --- > libavcodec/arm/Makefile | 74 +++++++++++++++++---------------------------- > libavcodec/x86/Makefile | 18 +++++----- > libavfilter/x86/Makefile | 2 +- > 3 files changed, 38 insertions(+), 56 deletions(-) NAK We've been over this already. Sending the patch again won't change my mind. -- M?ns Rullg?rd mans at mansr.com From nenjordi at gmail.com Mon May 7 13:32:40 2012 From: nenjordi at gmail.com (Jordi Ortiz) Date: Mon, 7 May 2012 13:32:40 +0200 Subject: [libav-devel] [PATCH 2/4] Move code shared between libdirac and?libschroedinger to libschroedinger. In-Reply-To: <20120507101325.GC15241@pool.informatik.rwth-aachen.de> References: <1334410860-5890-1-git-send-email-diego@biurrun.de> <1334410860-5890-2-git-send-email-diego@biurrun.de> <20120506215038.GA31444@pool.informatik.rwth-aachen.de> <20120507101325.GC15241@pool.informatik.rwth-aachen.de> Message-ID: > So what about the patch? > > It is ok, off course. Libdirac isn't recommended (afaik it is obsoleted) thus removing it from libav is a good idea as libschroedinger is already supported. The patch from my point of view is ok and needed. -------------- next part -------------- An HTML attachment was scrubbed... URL: From diego at biurrun.de Mon May 7 13:57:39 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 13:57:39 +0200 Subject: [libav-devel] [PATCH 1/2] h264: Remove a commented-out function pointer declaration. Message-ID: <1336391860-18930-1-git-send-email-diego@biurrun.de> --- libavcodec/h264dsp.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/libavcodec/h264dsp.h b/libavcodec/h264dsp.h index 7cae215..08a25a5 100644 --- a/libavcodec/h264dsp.h +++ b/libavcodec/h264dsp.h @@ -30,7 +30,6 @@ #include #include "dsputil.h" -//typedef void (*h264_chroma_mc_func)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x, int y); typedef void (*h264_weight_func)(uint8_t *block, int stride, int height, int log2_denom, int weight, int offset); typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src, int stride, int height, -- 1.7.1 From mans at mansr.com Mon May 7 14:12:23 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Mon, 07 May 2012 13:12:23 +0100 Subject: [libav-devel] [PATCH 1/2] h264: Remove a commented-out function pointer declaration. In-Reply-To: <1336391860-18930-1-git-send-email-diego@biurrun.de> (Diego Biurrun's message of "Mon, 07 May 2012 13:57:39 +0200") References: <1336391860-18930-1-git-send-email-diego@biurrun.de> Message-ID: Diego Biurrun writes: > --- > libavcodec/h264dsp.h | 1 - > 1 files changed, 0 insertions(+), 1 deletions(-) > > diff --git a/libavcodec/h264dsp.h b/libavcodec/h264dsp.h > index 7cae215..08a25a5 100644 > --- a/libavcodec/h264dsp.h > +++ b/libavcodec/h264dsp.h > @@ -30,7 +30,6 @@ > #include > #include "dsputil.h" > > -//typedef void (*h264_chroma_mc_func)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x, int y); > typedef void (*h264_weight_func)(uint8_t *block, int stride, int height, > int log2_denom, int weight, int offset); > typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src, int stride, int height, > -- It's a function pointer typedef, but OK. -- M?ns Rullg?rd mans at mansr.com From diego at biurrun.de Mon May 7 14:14:33 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 14:14:33 +0200 Subject: [libav-devel] [PATCH 1/2] h264: K&R formatting cosmetics for header files (part I/II) Message-ID: <1336392874-29247-1-git-send-email-diego@biurrun.de> --- libavcodec/h264.h | 499 +++++++++++++++++++++++++----------------------- libavcodec/h264data.h | 369 ++++++++++++++++++------------------ libavcodec/h264pred.h | 81 +++++---- 3 files changed, 491 insertions(+), 458 deletions(-) diff --git a/libavcodec/h264.h b/libavcodec/h264.h index ce06f61..ed432a1 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -37,14 +37,14 @@ #include "rectangle.h" #define interlaced_dct interlaced_dct_is_a_bad_name -#define mb_intra mb_intra_is_not_initialized_see_mb_type +#define mb_intra mb_intra_is_not_initialized_see_mb_type -#define MAX_SPS_COUNT 32 -#define MAX_PPS_COUNT 256 +#define MAX_SPS_COUNT 32 +#define MAX_PPS_COUNT 256 -#define MAX_MMCO_COUNT 66 +#define MAX_MMCO_COUNT 66 -#define MAX_DELAYED_PIC_COUNT 16 +#define MAX_DELAYED_PIC_COUNT 16 /* Compiling in interlaced support reduces the speed * of progressive decoding by about 2%. */ @@ -59,25 +59,25 @@ #define MAX_SLICES 16 #ifdef ALLOW_INTERLACE -#define MB_MBAFF h->mb_mbaff -#define MB_FIELD h->mb_field_decoding_flag +#define MB_MBAFF h->mb_mbaff +#define MB_FIELD h->mb_field_decoding_flag #define FRAME_MBAFF h->mb_aff_frame #define FIELD_PICTURE (s->picture_structure != PICT_FRAME) #define LEFT_MBS 2 -#define LTOP 0 -#define LBOT 1 -#define LEFT(i) (i) +#define LTOP 0 +#define LBOT 1 +#define LEFT(i) (i) #else -#define MB_MBAFF 0 -#define MB_FIELD 0 -#define FRAME_MBAFF 0 +#define MB_MBAFF 0 +#define MB_FIELD 0 +#define FRAME_MBAFF 0 #define FIELD_PICTURE 0 #undef IS_INTERLACED #define IS_INTERLACED(mb_type) 0 #define LEFT_MBS 1 -#define LTOP 0 -#define LBOT 0 -#define LEFT(i) 0 +#define LTOP 0 +#define LBOT 0 +#define LEFT(i) 0 #endif #define FIELD_OR_MBAFF_PICTURE (FRAME_MBAFF || FIELD_PICTURE) @@ -88,9 +88,9 @@ #define CHROMA422 (h->sps.chroma_format_idc == 2) #define CHROMA444 (h->sps.chroma_format_idc == 3) -#define EXTENDED_SAR 255 +#define EXTENDED_SAR 255 -#define MB_TYPE_REF0 MB_TYPE_ACPRED //dirty but it fits in 16 bit +#define MB_TYPE_REF0 MB_TYPE_ACPRED // dirty but it fits in 16 bit #define MB_TYPE_8x8DCT 0x01000000 #define IS_REF0(a) ((a) & MB_TYPE_REF0) #define IS_8x8DCT(a) ((a) & MB_TYPE_8x8DCT) @@ -101,11 +101,11 @@ */ #define DELAYED_PIC_REF 4 -#define QP_MAX_NUM (51 + 2*6) // The maximum supported qp +#define QP_MAX_NUM (51 + 2 * 6) // The maximum supported qp /* NAL unit types */ enum { - NAL_SLICE=1, + NAL_SLICE = 1, NAL_DPA, NAL_DPB, NAL_DPC, @@ -118,17 +118,17 @@ enum { NAL_END_STREAM, NAL_FILLER_DATA, NAL_SPS_EXT, - NAL_AUXILIARY_SLICE=19 + NAL_AUXILIARY_SLICE = 19 }; /** * SEI message types */ typedef enum { - SEI_BUFFERING_PERIOD = 0, ///< buffering period (H.264, D.1.1) - SEI_TYPE_PIC_TIMING = 1, ///< picture timing - SEI_TYPE_USER_DATA_UNREGISTERED = 5, ///< unregistered user data - SEI_TYPE_RECOVERY_POINT = 6 ///< recovery point (frame # to decoder sync) + SEI_BUFFERING_PERIOD = 0, ///< buffering period (H.264, D.1.1) + SEI_TYPE_PIC_TIMING = 1, ///< picture timing + SEI_TYPE_USER_DATA_UNREGISTERED = 5, ///< unregistered user data + SEI_TYPE_RECOVERY_POINT = 6 ///< recovery point (frame # to decoder sync) } SEI_Type; /** @@ -149,8 +149,7 @@ typedef enum { /** * Sequence parameter set */ -typedef struct SPS{ - +typedef struct SPS { int profile_idc; int level_idc; int chroma_format_idc; @@ -167,9 +166,9 @@ typedef struct SPS{ int mb_width; ///< pic_width_in_mbs_minus1 + 1 int mb_height; ///< pic_height_in_map_units_minus1 + 1 int frame_mbs_only_flag; - int mb_aff; ///b4_stride + int b_stride; // FIXME use s->b4_stride - int mb_linesize; ///< may be equal to s->linesize or s->linesize*2, for mbaff + int mb_linesize; ///< may be equal to s->linesize or s->linesize * 2, for mbaff int mb_uvlinesize; int emu_edge_width; @@ -335,32 +334,32 @@ typedef struct H264Context{ /** * current pps */ - PPS pps; //FIXME move to Picture perhaps? (->no) do we need that? + PPS pps; // FIXME move to Picture perhaps? (->no) do we need that? - uint32_t dequant4_buffer[6][QP_MAX_NUM+1][16]; //FIXME should these be moved down? - uint32_t dequant8_buffer[6][QP_MAX_NUM+1][64]; - uint32_t (*dequant4_coeff[6])[16]; - uint32_t (*dequant8_coeff[6])[64]; + uint32_t dequant4_buffer[6][QP_MAX_NUM + 1][16]; // FIXME should these be moved down? + uint32_t dequant8_buffer[6][QP_MAX_NUM + 1][64]; + uint32_t(*dequant4_coeff[6])[16]; + uint32_t(*dequant8_coeff[6])[64]; int slice_num; - uint16_t *slice_table; ///< slice_table_base + 2*mb_stride + 1 + uint16_t *slice_table; ///< slice_table_base + 2*mb_stride + 1 int slice_type; - int slice_type_nos; ///< S free slice type (SI/SP are remapped to I/P) + int slice_type_nos; ///< S free slice type (SI/SP are remapped to I/P) int slice_type_fixed; - //interlacing specific flags + // interlacing specific flags int mb_aff_frame; int mb_field_decoding_flag; - int mb_mbaff; ///< mb_aff_frame && mb_field_decoding_flag + int mb_mbaff; ///< mb_aff_frame && mb_field_decoding_flag DECLARE_ALIGNED(8, uint16_t, sub_mb_type)[4]; - //Weighted pred stuff + // Weighted pred stuff int use_weight; int use_weight_chroma; int luma_log2_weight_denom; int chroma_log2_weight_denom; - //The following 2 can be changed to int8_t but that causes 10cpu cycles speedloss + // The following 2 can be changed to int8_t but that causes 10cpu cycles speedloss int luma_weight[48][2][2]; int chroma_weight[48][2][2][2]; int implicit_weight[48][48][2]; @@ -370,48 +369,48 @@ typedef struct H264Context{ int col_fieldoff; int dist_scale_factor[16]; int dist_scale_factor_field[2][32]; - int map_col_to_list0[2][16+32]; - int map_col_to_list0_field[2][2][16+32]; + int map_col_to_list0[2][16 + 32]; + int map_col_to_list0_field[2][2][16 + 32]; /** * num_ref_idx_l0/1_active_minus1 + 1 */ - unsigned int ref_count[2]; ///< counts frames or fields, depending on current mb mode + unsigned int ref_count[2]; ///< counts frames or fields, depending on current mb mode unsigned int list_count; - uint8_t *list_counts; ///< Array of list_count per MB specifying the slice type - Picture ref_list[2][48]; /**< 0..15: frame refs, 16..47: mbaff field refs. - Reordered version of default_ref_list - according to picture reordering in slice header */ - int ref2frm[MAX_SLICES][2][64]; ///< reference to frame number lists, used in the loop filter, the first 2 are for -2,-1 + uint8_t *list_counts; ///< Array of list_count per MB specifying the slice type + Picture ref_list[2][48]; /**< 0..15: frame refs, 16..47: mbaff field refs. + * Reordered version of default_ref_list + * according to picture reordering in slice header */ + int ref2frm[MAX_SLICES][2][64]; ///< reference to frame number lists, used in the loop filter, the first 2 are for -2,-1 - //data partitioning + // data partitioning GetBitContext intra_gb; GetBitContext inter_gb; GetBitContext *intra_gb_ptr; GetBitContext *inter_gb_ptr; - DECLARE_ALIGNED(16, DCTELEM, mb)[16*48*2]; ///< as a dct coeffecient is int32_t in high depth, we need to reserve twice the space. - DECLARE_ALIGNED(16, DCTELEM, mb_luma_dc)[3][16*2]; - DCTELEM mb_padding[256*2]; ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either check that i is not too large or ensure that there is some unused stuff after mb + DECLARE_ALIGNED(16, DCTELEM, mb)[16 * 48 * 2]; ///< as a dct coeffecient is int32_t in high depth, we need to reserve twice the space. + DECLARE_ALIGNED(16, DCTELEM, mb_luma_dc)[3][16 * 2]; + DCTELEM mb_padding[256 * 2]; ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either check that i is not too large or ensure that there is some unused stuff after mb /** * Cabac */ CABACContext cabac; - uint8_t cabac_state[1024]; + uint8_t cabac_state[1024]; - /* 0x100 -> non null luma_dc, 0x80/0x40 -> non null chroma_dc (cb/cr), 0x?0 -> chroma_cbp(0,1,2), 0x0? luma_cbp */ - uint16_t *cbp_table; + /* 0x100 -> non null luma_dc, 0x80/0x40 -> non null chroma_dc (cb/cr), 0x?0 -> chroma_cbp(0, 1, 2), 0x0? luma_cbp */ + uint16_t *cbp_table; int cbp; int top_cbp; int left_cbp; /* chroma_pred_mode for i4x4 or i16x16, else 0 */ - uint8_t *chroma_pred_mode_table; - int last_qscale_diff; - uint8_t (*mvd_table[2])[2]; - DECLARE_ALIGNED(16, uint8_t, mvd_cache)[2][5*8][2]; - uint8_t *direct_table; - uint8_t direct_cache[5*8]; + uint8_t *chroma_pred_mode_table; + int last_qscale_diff; + uint8_t (*mvd_table[2])[2]; + DECLARE_ALIGNED(16, uint8_t, mvd_cache)[2][5 * 8][2]; + uint8_t *direct_table; + uint8_t direct_cache[5 * 8]; uint8_t zigzag_scan[16]; uint8_t zigzag_scan8x8[64]; @@ -432,13 +431,13 @@ typedef struct H264Context{ int is_complex; - //deblock - int deblocking_filter; ///< disable_deblocking_filter_idc with 1<->0 + // deblock + int deblocking_filter; ///< disable_deblocking_filter_idc with 1 <-> 0 int slice_alpha_c0_offset; int slice_beta_offset; -//============================================================= - //Things below are not used in the MB or more inner code + // ============================================================= + // Things below are not used in the MB or more inner code int nal_ref_idc; int nal_unit_type; @@ -448,37 +447,36 @@ typedef struct H264Context{ /** * Used to parse AVC variant of h264 */ - int is_avc; ///< this flag is != 0 if codec is avc1 - int nal_length_size; ///< Number of bytes used for nal length (1, 2 or 4) - int got_first; ///< this flag is != 0 if we've parsed a frame + int is_avc; ///< this flag is != 0 if codec is avc1 + int nal_length_size; ///< Number of bytes used for nal length (1, 2 or 4) + int got_first; ///< this flag is != 0 if we've parsed a frame SPS *sps_buffers[MAX_SPS_COUNT]; PPS *pps_buffers[MAX_PPS_COUNT]; - int dequant_coeff_pps; ///< reinit tables when pps changes + int dequant_coeff_pps; ///< reinit tables when pps changes uint16_t *slice_table_base; - - //POC stuff + // POC stuff int poc_lsb; int poc_msb; int delta_poc_bottom; int delta_poc[2]; int frame_num; - int prev_poc_msb; ///< poc_msb of the last reference pic for POC type 0 - int prev_poc_lsb; ///< poc_lsb of the last reference pic for POC type 0 - int frame_num_offset; ///< for POC type 2 - int prev_frame_num_offset; ///< for POC type 2 - int prev_frame_num; ///< frame_num of the last pic for POC type 1/2 + int prev_poc_msb; ///< poc_msb of the last reference pic for POC type 0 + int prev_poc_lsb; ///< poc_lsb of the last reference pic for POC type 0 + int frame_num_offset; ///< for POC type 2 + int prev_frame_num_offset; ///< for POC type 2 + int prev_frame_num; ///< frame_num of the last pic for POC type 1/2 /** - * frame_num for frames or 2*frame_num+1 for field pics. + * frame_num for frames or 2 * frame_num + 1 for field pics. */ int curr_pic_num; /** - * max_frame_num or 2*max_frame_num for field pics. + * max_frame_num or 2 * max_frame_num for field pics. */ int max_pic_num; @@ -487,7 +485,7 @@ typedef struct H264Context{ Picture *short_ref[32]; Picture *long_ref[32]; Picture default_ref_list[2][32]; ///< base reference list for all slices of a coded picture - Picture *delayed_pic[MAX_DELAYED_PIC_COUNT+2]; //FIXME size? + Picture *delayed_pic[MAX_DELAYED_PIC_COUNT + 2]; // FIXME size? int last_pocs[MAX_DELAYED_PIC_COUNT]; Picture *next_output_pic; int outputed_poc; @@ -500,10 +498,10 @@ typedef struct H264Context{ int mmco_index; int mmco_reset; - int long_ref_count; ///< number of actual long term references - int short_ref_count; ///< number of actual short term references + int long_ref_count; ///< number of actual long term references + int short_ref_count; ///< number of actual short term references - int cabac_init_idc; + int cabac_init_idc; /** * @name Members for slice based multithreading @@ -572,18 +570,17 @@ typedef struct H264Context{ */ int sei_recovery_frame_cnt; - int luma_weight_flag[2]; ///< 7.4.3.2 luma_weight_lX_flag - int chroma_weight_flag[2]; ///< 7.4.3.2 chroma_weight_lX_flag + int luma_weight_flag[2]; ///< 7.4.3.2 luma_weight_lX_flag + int chroma_weight_flag[2]; ///< 7.4.3.2 chroma_weight_lX_flag // Timestamp stuff - int sei_buffering_period_present; ///< Buffering period SEI flag - int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs + int sei_buffering_period_present; ///< Buffering period SEI flag + int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs int cur_chroma_format_idc; -}H264Context; +} H264Context; - -extern const uint8_t ff_h264_chroma_qp[3][QP_MAX_NUM+1]; ///< One chroma qp table for each supported bit depth (8, 9, 10). +extern const uint8_t ff_h264_chroma_qp[3][QP_MAX_NUM + 1]; ///< One chroma qp table for each supported bit depth (8, 9, 10). extern const uint16_t ff_h264_mb_sizes[4]; /** @@ -610,13 +607,16 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length); * Decode a network abstraction layer unit. * @param consumed is the number of bytes used as input * @param length is the length of the array - * @param dst_length is the number of decoded bytes FIXME here or a decode rbsp tailing? + * @param dst_length is the number of decoded bytes FIXME here + * or a decode rbsp tailing? * @return decoded bytes, might be src+1 if no escapes */ -const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length); +const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, + int *dst_length, int *consumed, int length); /** - * Free any data that may have been allocated in the H264 context like SPS, PPS etc. + * Free any data that may have been allocated in the H264 context + * like SPS, PPS etc. */ av_cold void ff_h264_free_context(H264Context *h); @@ -649,14 +649,15 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb); void ff_generate_sliding_window_mmcos(H264Context *h); - /** - * Check if the top & left blocks are available if needed & change the dc mode so it only uses the available blocks. + * Check if the top & left blocks are available if needed & change the + * dc mode so it only uses the available blocks. */ int ff_h264_check_intra4x4_pred_mode(H264Context *h); /** - * Check if the top & left blocks are available if needed & change the dc mode so it only uses the available blocks. + * Check if the top & left blocks are available if needed & change the + * dc mode so it only uses the available blocks. */ int ff_h264_check_intra_pred_mode(H264Context *h, int mode, int is_chroma); @@ -668,24 +669,28 @@ av_cold void ff_h264_decode_init_vlc(void); /** * Decode a macroblock - * @return 0 if OK, ER_AC_ERROR / ER_DC_ERROR / ER_MV_ERROR if an error is noticed + * @return 0 if OK, ER_AC_ERROR / ER_DC_ERROR / ER_MV_ERROR on error */ int ff_h264_decode_mb_cavlc(H264Context *h); /** * Decode a CABAC coded macroblock - * @return 0 if OK, ER_AC_ERROR / ER_DC_ERROR / ER_MV_ERROR if an error is noticed + * @return 0 if OK, ER_AC_ERROR / ER_DC_ERROR / ER_MV_ERROR on error */ int ff_h264_decode_mb_cabac(H264Context *h); void ff_h264_init_cabac_states(H264Context *h); -void ff_h264_direct_dist_scale_factor(H264Context * const h); -void ff_h264_direct_ref_list_init(H264Context * const h); -void ff_h264_pred_direct_motion(H264Context * const h, int *mb_type); +void ff_h264_direct_dist_scale_factor(H264Context *const h); +void ff_h264_direct_ref_list_init(H264Context *const h); +void ff_h264_pred_direct_motion(H264Context *const h, int *mb_type); -void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize); -void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize); +void ff_h264_filter_mb_fast(H264Context *h, int mb_x, int mb_y, + uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, + unsigned int linesize, unsigned int uvlinesize); +void ff_h264_filter_mb(H264Context *h, int mb_x, int mb_y, + uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, + unsigned int linesize, unsigned int uvlinesize); /** * Reset SEI values at the beginning of the frame. @@ -694,16 +699,15 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint */ void ff_h264_reset_sei(H264Context *h); - /* -o-o o-o - / / / -o-o o-o - ,---' -o-o o-o - / / / -o-o o-o -*/ + * o-o o-o + * / / / + * o-o o-o + * ,---' + * o-o o-o + * / / / + * o-o o-o + */ /* Scan8 organization: * 0 1 2 3 4 5 6 7 @@ -728,156 +732,173 @@ o-o o-o #define LUMA_DC_BLOCK_INDEX 48 #define CHROMA_DC_BLOCK_INDEX 49 -//This table must be here because scan8[constant] must be known at compiletime -static const uint8_t scan8[16*3 + 3]={ - 4+ 1*8, 5+ 1*8, 4+ 2*8, 5+ 2*8, - 6+ 1*8, 7+ 1*8, 6+ 2*8, 7+ 2*8, - 4+ 3*8, 5+ 3*8, 4+ 4*8, 5+ 4*8, - 6+ 3*8, 7+ 3*8, 6+ 4*8, 7+ 4*8, - 4+ 6*8, 5+ 6*8, 4+ 7*8, 5+ 7*8, - 6+ 6*8, 7+ 6*8, 6+ 7*8, 7+ 7*8, - 4+ 8*8, 5+ 8*8, 4+ 9*8, 5+ 9*8, - 6+ 8*8, 7+ 8*8, 6+ 9*8, 7+ 9*8, - 4+11*8, 5+11*8, 4+12*8, 5+12*8, - 6+11*8, 7+11*8, 6+12*8, 7+12*8, - 4+13*8, 5+13*8, 4+14*8, 5+14*8, - 6+13*8, 7+13*8, 6+14*8, 7+14*8, - 0+ 0*8, 0+ 5*8, 0+10*8 +// This table must be here because scan8[constant] must be known at compiletime +static const uint8_t scan8[16 * 3 + 3] = { + 4 + 1 * 8, 5 + 1 * 8, 4 + 2 * 8, 5 + 2 * 8, + 6 + 1 * 8, 7 + 1 * 8, 6 + 2 * 8, 7 + 2 * 8, + 4 + 3 * 8, 5 + 3 * 8, 4 + 4 * 8, 5 + 4 * 8, + 6 + 3 * 8, 7 + 3 * 8, 6 + 4 * 8, 7 + 4 * 8, + 4 + 6 * 8, 5 + 6 * 8, 4 + 7 * 8, 5 + 7 * 8, + 6 + 6 * 8, 7 + 6 * 8, 6 + 7 * 8, 7 + 7 * 8, + 4 + 8 * 8, 5 + 8 * 8, 4 + 9 * 8, 5 + 9 * 8, + 6 + 8 * 8, 7 + 8 * 8, 6 + 9 * 8, 7 + 9 * 8, + 4 + 11 * 8, 5 + 11 * 8, 4 + 12 * 8, 5 + 12 * 8, + 6 + 11 * 8, 7 + 11 * 8, 6 + 12 * 8, 7 + 12 * 8, + 4 + 13 * 8, 5 + 13 * 8, 4 + 14 * 8, 5 + 14 * 8, + 6 + 13 * 8, 7 + 13 * 8, 6 + 14 * 8, 7 + 14 * 8, + 0 + 0 * 8, 0 + 5 * 8, 0 + 10 * 8 }; -static av_always_inline uint32_t pack16to32(int a, int b){ +static av_always_inline uint32_t pack16to32(int a, int b) +{ #if HAVE_BIGENDIAN - return (b&0xFFFF) + (a<<16); + return (b & 0xFFFF) + (a << 16); #else - return (a&0xFFFF) + (b<<16); + return (a & 0xFFFF) + (b << 16); #endif } -static av_always_inline uint16_t pack8to16(int a, int b){ +static av_always_inline uint16_t pack8to16(int a, int b) +{ #if HAVE_BIGENDIAN - return (b&0xFF) + (a<<8); + return (b & 0xFF) + (a << 8); #else - return (a&0xFF) + (b<<8); + return (a & 0xFF) + (b << 8); #endif } /** * Get the chroma qp. */ -static av_always_inline int get_chroma_qp(H264Context *h, int t, int qscale){ +static av_always_inline int get_chroma_qp(H264Context *h, int t, int qscale) +{ return h->pps.chroma_qp_table[t][qscale]; } /** * Get the predicted intra4x4 prediction mode. */ -static av_always_inline int pred_intra_mode(H264Context *h, int n){ - const int index8= scan8[n]; - const int left= h->intra4x4_pred_mode_cache[index8 - 1]; - const int top = h->intra4x4_pred_mode_cache[index8 - 8]; - const int min= FFMIN(left, top); +static av_always_inline int pred_intra_mode(H264Context *h, int n) +{ + const int index8 = scan8[n]; + const int left = h->intra4x4_pred_mode_cache[index8 - 1]; + const int top = h->intra4x4_pred_mode_cache[index8 - 8]; + const int min = FFMIN(left, top); - tprintf(h->s.avctx, "mode:%d %d min:%d\n", left ,top, min); + tprintf(h->s.avctx, "mode:%d %d min:%d\n", left, top, min); - if(min<0) return DC_PRED; - else return min; + if (min < 0) + return DC_PRED; + else + return min; } -static av_always_inline void write_back_intra_pred_mode(H264Context *h){ - int8_t *i4x4= h->intra4x4_pred_mode + h->mb2br_xy[h->mb_xy]; - int8_t *i4x4_cache= h->intra4x4_pred_mode_cache; +static av_always_inline void write_back_intra_pred_mode(H264Context *h) +{ + int8_t *i4x4 = h->intra4x4_pred_mode + h->mb2br_xy[h->mb_xy]; + int8_t *i4x4_cache = h->intra4x4_pred_mode_cache; - AV_COPY32(i4x4, i4x4_cache + 4 + 8*4); - i4x4[4]= i4x4_cache[7+8*3]; - i4x4[5]= i4x4_cache[7+8*2]; - i4x4[6]= i4x4_cache[7+8*1]; + AV_COPY32(i4x4, i4x4_cache + 4 + 8 * 4); + i4x4[4] = i4x4_cache[7 + 8 * 3]; + i4x4[5] = i4x4_cache[7 + 8 * 2]; + i4x4[6] = i4x4_cache[7 + 8 * 1]; } -static av_always_inline void write_back_non_zero_count(H264Context *h){ - const int mb_xy= h->mb_xy; - uint8_t *nnz = h->non_zero_count[mb_xy]; +static av_always_inline void write_back_non_zero_count(H264Context *h) +{ + const int mb_xy = h->mb_xy; + uint8_t *nnz = h->non_zero_count[mb_xy]; uint8_t *nnz_cache = h->non_zero_count_cache; - AV_COPY32(&nnz[ 0], &nnz_cache[4+8* 1]); - AV_COPY32(&nnz[ 4], &nnz_cache[4+8* 2]); - AV_COPY32(&nnz[ 8], &nnz_cache[4+8* 3]); - AV_COPY32(&nnz[12], &nnz_cache[4+8* 4]); - AV_COPY32(&nnz[16], &nnz_cache[4+8* 6]); - AV_COPY32(&nnz[20], &nnz_cache[4+8* 7]); - AV_COPY32(&nnz[32], &nnz_cache[4+8*11]); - AV_COPY32(&nnz[36], &nnz_cache[4+8*12]); - - if(!h->s.chroma_y_shift){ - AV_COPY32(&nnz[24], &nnz_cache[4+8* 8]); - AV_COPY32(&nnz[28], &nnz_cache[4+8* 9]); - AV_COPY32(&nnz[40], &nnz_cache[4+8*13]); - AV_COPY32(&nnz[44], &nnz_cache[4+8*14]); + AV_COPY32(&nnz[ 0], &nnz_cache[4 + 8 * 1]); + AV_COPY32(&nnz[ 4], &nnz_cache[4 + 8 * 2]); + AV_COPY32(&nnz[ 8], &nnz_cache[4 + 8 * 3]); + AV_COPY32(&nnz[12], &nnz_cache[4 + 8 * 4]); + AV_COPY32(&nnz[16], &nnz_cache[4 + 8 * 6]); + AV_COPY32(&nnz[20], &nnz_cache[4 + 8 * 7]); + AV_COPY32(&nnz[32], &nnz_cache[4 + 8 * 11]); + AV_COPY32(&nnz[36], &nnz_cache[4 + 8 * 12]); + + if (!h->s.chroma_y_shift) { + AV_COPY32(&nnz[24], &nnz_cache[4 + 8 * 8]); + AV_COPY32(&nnz[28], &nnz_cache[4 + 8 * 9]); + AV_COPY32(&nnz[40], &nnz_cache[4 + 8 * 13]); + AV_COPY32(&nnz[44], &nnz_cache[4 + 8 * 14]); } } -static av_always_inline void write_back_motion_list(H264Context *h, MpegEncContext * const s, int b_stride, - int b_xy, int b8_xy, int mb_type, int list ) +static av_always_inline void write_back_motion_list(H264Context *h, + MpegEncContext *const s, + int b_stride, + int b_xy, int b8_xy, + int mb_type, int list) { - int16_t (*mv_dst)[2] = &s->current_picture.f.motion_val[list][b_xy]; - int16_t (*mv_src)[2] = &h->mv_cache[list][scan8[0]]; - AV_COPY128(mv_dst + 0*b_stride, mv_src + 8*0); - AV_COPY128(mv_dst + 1*b_stride, mv_src + 8*1); - AV_COPY128(mv_dst + 2*b_stride, mv_src + 8*2); - AV_COPY128(mv_dst + 3*b_stride, mv_src + 8*3); - if( CABAC ) { - uint8_t (*mvd_dst)[2] = &h->mvd_table[list][FMO ? 8*h->mb_xy : h->mb2br_xy[h->mb_xy]]; - uint8_t (*mvd_src)[2] = &h->mvd_cache[list][scan8[0]]; - if(IS_SKIP(mb_type)) + int16_t(*mv_dst)[2] = &s->current_picture.f.motion_val[list][b_xy]; + int16_t(*mv_src)[2] = &h->mv_cache[list][scan8[0]]; + AV_COPY128(mv_dst + 0 * b_stride, mv_src + 8 * 0); + AV_COPY128(mv_dst + 1 * b_stride, mv_src + 8 * 1); + AV_COPY128(mv_dst + 2 * b_stride, mv_src + 8 * 2); + AV_COPY128(mv_dst + 3 * b_stride, mv_src + 8 * 3); + if (CABAC) { + uint8_t (*mvd_dst)[2] = &h->mvd_table[list][FMO ? 8 * h->mb_xy + : h->mb2br_xy[h->mb_xy]]; + uint8_t(*mvd_src)[2] = &h->mvd_cache[list][scan8[0]]; + if (IS_SKIP(mb_type)) { AV_ZERO128(mvd_dst); - else{ - AV_COPY64(mvd_dst, mvd_src + 8*3); - AV_COPY16(mvd_dst + 3 + 3, mvd_src + 3 + 8*0); - AV_COPY16(mvd_dst + 3 + 2, mvd_src + 3 + 8*1); - AV_COPY16(mvd_dst + 3 + 1, mvd_src + 3 + 8*2); + } else { + AV_COPY64(mvd_dst, mvd_src + 8 * 3); + AV_COPY16(mvd_dst + 3 + 3, mvd_src + 3 + 8 * 0); + AV_COPY16(mvd_dst + 3 + 2, mvd_src + 3 + 8 * 1); + AV_COPY16(mvd_dst + 3 + 1, mvd_src + 3 + 8 * 2); } } { int8_t *ref_index = &s->current_picture.f.ref_index[list][b8_xy]; int8_t *ref_cache = h->ref_cache[list]; - ref_index[0+0*2]= ref_cache[scan8[0]]; - ref_index[1+0*2]= ref_cache[scan8[4]]; - ref_index[0+1*2]= ref_cache[scan8[8]]; - ref_index[1+1*2]= ref_cache[scan8[12]]; + ref_index[0 + 0 * 2] = ref_cache[scan8[0]]; + ref_index[1 + 0 * 2] = ref_cache[scan8[4]]; + ref_index[0 + 1 * 2] = ref_cache[scan8[8]]; + ref_index[1 + 1 * 2] = ref_cache[scan8[12]]; } } -static av_always_inline void write_back_motion(H264Context *h, int mb_type){ - MpegEncContext * const s = &h->s; - const int b_stride = h->b_stride; - const int b_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride; //try mb2b(8)_xy - const int b8_xy= 4*h->mb_xy; +static av_always_inline void write_back_motion(H264Context *h, int mb_type) +{ + MpegEncContext *const s = &h->s; + const int b_stride = h->b_stride; + const int b_xy = 4 * s->mb_x + 4 * s->mb_y * h->b_stride; // try mb2b(8)_xy + const int b8_xy = 4 * h->mb_xy; - if(USES_LIST(mb_type, 0)){ + if (USES_LIST(mb_type, 0)) { write_back_motion_list(h, s, b_stride, b_xy, b8_xy, mb_type, 0); - }else{ + } else { fill_rectangle(&s->current_picture.f.ref_index[0][b8_xy], 2, 2, 2, (uint8_t)LIST_NOT_USED, 1); } - if(USES_LIST(mb_type, 1)){ + if (USES_LIST(mb_type, 1)) write_back_motion_list(h, s, b_stride, b_xy, b8_xy, mb_type, 1); - } - if(h->slice_type_nos == AV_PICTURE_TYPE_B && CABAC){ - if(IS_8X8(mb_type)){ - uint8_t *direct_table = &h->direct_table[4*h->mb_xy]; - direct_table[1] = h->sub_mb_type[1]>>1; - direct_table[2] = h->sub_mb_type[2]>>1; - direct_table[3] = h->sub_mb_type[3]>>1; + if (h->slice_type_nos == AV_PICTURE_TYPE_B && CABAC) { + if (IS_8X8(mb_type)) { + uint8_t *direct_table = &h->direct_table[4 * h->mb_xy]; + direct_table[1] = h->sub_mb_type[1] >> 1; + direct_table[2] = h->sub_mb_type[2] >> 1; + direct_table[3] = h->sub_mb_type[3] >> 1; } } } -static av_always_inline int get_dct8x8_allowed(H264Context *h){ - if(h->sps.direct_8x8_inference_flag) - return !(AV_RN64A(h->sub_mb_type) & ((MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8 )*0x0001000100010001ULL)); +static av_always_inline int get_dct8x8_allowed(H264Context *h) +{ + if (h->sps.direct_8x8_inference_flag) + return !(AV_RN64A(h->sub_mb_type) & + ((MB_TYPE_16x8 | MB_TYPE_8x16 | MB_TYPE_8x8) * + 0x0001000100010001ULL)); else - return !(AV_RN64A(h->sub_mb_type) & ((MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8|MB_TYPE_DIRECT2)*0x0001000100010001ULL)); + return !(AV_RN64A(h->sub_mb_type) & + ((MB_TYPE_16x8 | MB_TYPE_8x16 | MB_TYPE_8x8 | MB_TYPE_DIRECT2) * + 0x0001000100010001ULL)); } #endif /* AVCODEC_H264_H */ diff --git a/libavcodec/h264data.h b/libavcodec/h264data.h index 2cfa548..5311c21 100644 --- a/libavcodec/h264data.h +++ b/libavcodec/h264data.h @@ -30,240 +30,243 @@ #define AVCODEC_H264DATA_H #include + #include "libavutil/rational.h" #include "mpegvideo.h" #include "h264.h" +static const uint8_t golomb_to_pict_type[5] = { + AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, AV_PICTURE_TYPE_I, + AV_PICTURE_TYPE_SP, AV_PICTURE_TYPE_SI +}; -static const uint8_t golomb_to_pict_type[5]= -{AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_SP, AV_PICTURE_TYPE_SI}; - -static const uint8_t golomb_to_intra4x4_cbp[48]={ - 47, 31, 15, 0, 23, 27, 29, 30, 7, 11, 13, 14, 39, 43, 45, 46, - 16, 3, 5, 10, 12, 19, 21, 26, 28, 35, 37, 42, 44, 1, 2, 4, - 8, 17, 18, 20, 24, 6, 9, 22, 25, 32, 33, 34, 36, 40, 38, 41 +static const uint8_t golomb_to_intra4x4_cbp[48] = { + 47, 31, 15, 0, 23, 27, 29, 30, 7, 11, 13, 14, 39, 43, 45, 46, + 16, 3, 5, 10, 12, 19, 21, 26, 28, 35, 37, 42, 44, 1, 2, 4, + 8, 17, 18, 20, 24, 6, 9, 22, 25, 32, 33, 34, 36, 40, 38, 41 }; -static const uint8_t golomb_to_inter_cbp[48]={ - 0, 16, 1, 2, 4, 8, 32, 3, 5, 10, 12, 15, 47, 7, 11, 13, - 14, 6, 9, 31, 35, 37, 42, 44, 33, 34, 36, 40, 39, 43, 45, 46, - 17, 18, 20, 24, 19, 21, 26, 28, 23, 27, 29, 30, 22, 25, 38, 41 +static const uint8_t golomb_to_inter_cbp[48] = { + 0, 16, 1, 2, 4, 8, 32, 3, 5, 10, 12, 15, 47, 7, 11, 13, + 14, 6, 9, 31, 35, 37, 42, 44, 33, 34, 36, 40, 39, 43, 45, 46, + 17, 18, 20, 24, 19, 21, 26, 28, 23, 27, 29, 30, 22, 25, 38, 41 }; -static const uint8_t zigzag_scan[16]={ - 0+0*4, 1+0*4, 0+1*4, 0+2*4, - 1+1*4, 2+0*4, 3+0*4, 2+1*4, - 1+2*4, 0+3*4, 1+3*4, 2+2*4, - 3+1*4, 3+2*4, 2+3*4, 3+3*4, +static const uint8_t zigzag_scan[16] = { + 0 + 0 * 4, 1 + 0 * 4, 0 + 1 * 4, 0 + 2 * 4, + 1 + 1 * 4, 2 + 0 * 4, 3 + 0 * 4, 2 + 1 * 4, + 1 + 2 * 4, 0 + 3 * 4, 1 + 3 * 4, 2 + 2 * 4, + 3 + 1 * 4, 3 + 2 * 4, 2 + 3 * 4, 3 + 3 * 4, }; -static const uint8_t field_scan[16]={ - 0+0*4, 0+1*4, 1+0*4, 0+2*4, - 0+3*4, 1+1*4, 1+2*4, 1+3*4, - 2+0*4, 2+1*4, 2+2*4, 2+3*4, - 3+0*4, 3+1*4, 3+2*4, 3+3*4, +static const uint8_t field_scan[16] = { + 0 + 0 * 4, 0 + 1 * 4, 1 + 0 * 4, 0 + 2 * 4, + 0 + 3 * 4, 1 + 1 * 4, 1 + 2 * 4, 1 + 3 * 4, + 2 + 0 * 4, 2 + 1 * 4, 2 + 2 * 4, 2 + 3 * 4, + 3 + 0 * 4, 3 + 1 * 4, 3 + 2 * 4, 3 + 3 * 4, }; -static const uint8_t luma_dc_zigzag_scan[16]={ - 0*16 + 0*64, 1*16 + 0*64, 2*16 + 0*64, 0*16 + 2*64, - 3*16 + 0*64, 0*16 + 1*64, 1*16 + 1*64, 2*16 + 1*64, - 1*16 + 2*64, 2*16 + 2*64, 3*16 + 2*64, 0*16 + 3*64, - 3*16 + 1*64, 1*16 + 3*64, 2*16 + 3*64, 3*16 + 3*64, +static const uint8_t luma_dc_zigzag_scan[16] = { + 0 * 16 + 0 * 64, 1 * 16 + 0 * 64, 2 * 16 + 0 * 64, 0 * 16 + 2 * 64, + 3 * 16 + 0 * 64, 0 * 16 + 1 * 64, 1 * 16 + 1 * 64, 2 * 16 + 1 * 64, + 1 * 16 + 2 * 64, 2 * 16 + 2 * 64, 3 * 16 + 2 * 64, 0 * 16 + 3 * 64, + 3 * 16 + 1 * 64, 1 * 16 + 3 * 64, 2 * 16 + 3 * 64, 3 * 16 + 3 * 64, }; -static const uint8_t luma_dc_field_scan[16]={ - 0*16 + 0*64, 2*16 + 0*64, 1*16 + 0*64, 0*16 + 2*64, - 2*16 + 2*64, 3*16 + 0*64, 1*16 + 2*64, 3*16 + 2*64, - 0*16 + 1*64, 2*16 + 1*64, 0*16 + 3*64, 2*16 + 3*64, - 1*16 + 1*64, 3*16 + 1*64, 1*16 + 3*64, 3*16 + 3*64, +static const uint8_t luma_dc_field_scan[16] = { + 0 * 16 + 0 * 64, 2 * 16 + 0 * 64, 1 * 16 + 0 * 64, 0 * 16 + 2 * 64, + 2 * 16 + 2 * 64, 3 * 16 + 0 * 64, 1 * 16 + 2 * 64, 3 * 16 + 2 * 64, + 0 * 16 + 1 * 64, 2 * 16 + 1 * 64, 0 * 16 + 3 * 64, 2 * 16 + 3 * 64, + 1 * 16 + 1 * 64, 3 * 16 + 1 * 64, 1 * 16 + 3 * 64, 3 * 16 + 3 * 64, }; -static const uint8_t chroma_dc_scan[4]={ - (0+0*2)*16, (1+0*2)*16, - (0+1*2)*16, (1+1*2)*16, +static const uint8_t chroma_dc_scan[4] = { + (0 + 0 * 2) * 16, (1 + 0 * 2) * 16, + (0 + 1 * 2) * 16, (1 + 1 * 2) * 16, }; -static const uint8_t chroma422_dc_scan[8]={ - (0+0*2)*16, (0+1*2)*16, - (1+0*2)*16, (0+2*2)*16, - (0+3*2)*16, (1+1*2)*16, - (1+2*2)*16, (1+3*2)*16, +static const uint8_t chroma422_dc_scan[8] = { + (0 + 0 * 2) * 16, (0 + 1 * 2) * 16, + (1 + 0 * 2) * 16, (0 + 2 * 2) * 16, + (0 + 3 * 2) * 16, (1 + 1 * 2) * 16, + (1 + 2 * 2) * 16, (1 + 3 * 2) * 16, }; // zigzag_scan8x8_cavlc[i] = zigzag_scan8x8[(i/4) + 16*(i%4)] -static const uint8_t zigzag_scan8x8_cavlc[64]={ - 0+0*8, 1+1*8, 1+2*8, 2+2*8, - 4+1*8, 0+5*8, 3+3*8, 7+0*8, - 3+4*8, 1+7*8, 5+3*8, 6+3*8, - 2+7*8, 6+4*8, 5+6*8, 7+5*8, - 1+0*8, 2+0*8, 0+3*8, 3+1*8, - 3+2*8, 0+6*8, 4+2*8, 6+1*8, - 2+5*8, 2+6*8, 6+2*8, 5+4*8, - 3+7*8, 7+3*8, 4+7*8, 7+6*8, - 0+1*8, 3+0*8, 0+4*8, 4+0*8, - 2+3*8, 1+5*8, 5+1*8, 5+2*8, - 1+6*8, 3+5*8, 7+1*8, 4+5*8, - 4+6*8, 7+4*8, 5+7*8, 6+7*8, - 0+2*8, 2+1*8, 1+3*8, 5+0*8, - 1+4*8, 2+4*8, 6+0*8, 4+3*8, - 0+7*8, 4+4*8, 7+2*8, 3+6*8, - 5+5*8, 6+5*8, 6+6*8, 7+7*8, +static const uint8_t zigzag_scan8x8_cavlc[64] = { + 0 + 0 * 8, 1 + 1 * 8, 1 + 2 * 8, 2 + 2 * 8, + 4 + 1 * 8, 0 + 5 * 8, 3 + 3 * 8, 7 + 0 * 8, + 3 + 4 * 8, 1 + 7 * 8, 5 + 3 * 8, 6 + 3 * 8, + 2 + 7 * 8, 6 + 4 * 8, 5 + 6 * 8, 7 + 5 * 8, + 1 + 0 * 8, 2 + 0 * 8, 0 + 3 * 8, 3 + 1 * 8, + 3 + 2 * 8, 0 + 6 * 8, 4 + 2 * 8, 6 + 1 * 8, + 2 + 5 * 8, 2 + 6 * 8, 6 + 2 * 8, 5 + 4 * 8, + 3 + 7 * 8, 7 + 3 * 8, 4 + 7 * 8, 7 + 6 * 8, + 0 + 1 * 8, 3 + 0 * 8, 0 + 4 * 8, 4 + 0 * 8, + 2 + 3 * 8, 1 + 5 * 8, 5 + 1 * 8, 5 + 2 * 8, + 1 + 6 * 8, 3 + 5 * 8, 7 + 1 * 8, 4 + 5 * 8, + 4 + 6 * 8, 7 + 4 * 8, 5 + 7 * 8, 6 + 7 * 8, + 0 + 2 * 8, 2 + 1 * 8, 1 + 3 * 8, 5 + 0 * 8, + 1 + 4 * 8, 2 + 4 * 8, 6 + 0 * 8, 4 + 3 * 8, + 0 + 7 * 8, 4 + 4 * 8, 7 + 2 * 8, 3 + 6 * 8, + 5 + 5 * 8, 6 + 5 * 8, 6 + 6 * 8, 7 + 7 * 8, }; -static const uint8_t field_scan8x8[64]={ - 0+0*8, 0+1*8, 0+2*8, 1+0*8, - 1+1*8, 0+3*8, 0+4*8, 1+2*8, - 2+0*8, 1+3*8, 0+5*8, 0+6*8, - 0+7*8, 1+4*8, 2+1*8, 3+0*8, - 2+2*8, 1+5*8, 1+6*8, 1+7*8, - 2+3*8, 3+1*8, 4+0*8, 3+2*8, - 2+4*8, 2+5*8, 2+6*8, 2+7*8, - 3+3*8, 4+1*8, 5+0*8, 4+2*8, - 3+4*8, 3+5*8, 3+6*8, 3+7*8, - 4+3*8, 5+1*8, 6+0*8, 5+2*8, - 4+4*8, 4+5*8, 4+6*8, 4+7*8, - 5+3*8, 6+1*8, 6+2*8, 5+4*8, - 5+5*8, 5+6*8, 5+7*8, 6+3*8, - 7+0*8, 7+1*8, 6+4*8, 6+5*8, - 6+6*8, 6+7*8, 7+2*8, 7+3*8, - 7+4*8, 7+5*8, 7+6*8, 7+7*8, +static const uint8_t field_scan8x8[64] = { + 0 + 0 * 8, 0 + 1 * 8, 0 + 2 * 8, 1 + 0 * 8, + 1 + 1 * 8, 0 + 3 * 8, 0 + 4 * 8, 1 + 2 * 8, + 2 + 0 * 8, 1 + 3 * 8, 0 + 5 * 8, 0 + 6 * 8, + 0 + 7 * 8, 1 + 4 * 8, 2 + 1 * 8, 3 + 0 * 8, + 2 + 2 * 8, 1 + 5 * 8, 1 + 6 * 8, 1 + 7 * 8, + 2 + 3 * 8, 3 + 1 * 8, 4 + 0 * 8, 3 + 2 * 8, + 2 + 4 * 8, 2 + 5 * 8, 2 + 6 * 8, 2 + 7 * 8, + 3 + 3 * 8, 4 + 1 * 8, 5 + 0 * 8, 4 + 2 * 8, + 3 + 4 * 8, 3 + 5 * 8, 3 + 6 * 8, 3 + 7 * 8, + 4 + 3 * 8, 5 + 1 * 8, 6 + 0 * 8, 5 + 2 * 8, + 4 + 4 * 8, 4 + 5 * 8, 4 + 6 * 8, 4 + 7 * 8, + 5 + 3 * 8, 6 + 1 * 8, 6 + 2 * 8, 5 + 4 * 8, + 5 + 5 * 8, 5 + 6 * 8, 5 + 7 * 8, 6 + 3 * 8, + 7 + 0 * 8, 7 + 1 * 8, 6 + 4 * 8, 6 + 5 * 8, + 6 + 6 * 8, 6 + 7 * 8, 7 + 2 * 8, 7 + 3 * 8, + 7 + 4 * 8, 7 + 5 * 8, 7 + 6 * 8, 7 + 7 * 8, }; -static const uint8_t field_scan8x8_cavlc[64]={ - 0+0*8, 1+1*8, 2+0*8, 0+7*8, - 2+2*8, 2+3*8, 2+4*8, 3+3*8, - 3+4*8, 4+3*8, 4+4*8, 5+3*8, - 5+5*8, 7+0*8, 6+6*8, 7+4*8, - 0+1*8, 0+3*8, 1+3*8, 1+4*8, - 1+5*8, 3+1*8, 2+5*8, 4+1*8, - 3+5*8, 5+1*8, 4+5*8, 6+1*8, - 5+6*8, 7+1*8, 6+7*8, 7+5*8, - 0+2*8, 0+4*8, 0+5*8, 2+1*8, - 1+6*8, 4+0*8, 2+6*8, 5+0*8, - 3+6*8, 6+0*8, 4+6*8, 6+2*8, - 5+7*8, 6+4*8, 7+2*8, 7+6*8, - 1+0*8, 1+2*8, 0+6*8, 3+0*8, - 1+7*8, 3+2*8, 2+7*8, 4+2*8, - 3+7*8, 5+2*8, 4+7*8, 5+4*8, - 6+3*8, 6+5*8, 7+3*8, 7+7*8, +static const uint8_t field_scan8x8_cavlc[64] = { + 0 + 0 * 8, 1 + 1 * 8, 2 + 0 * 8, 0 + 7 * 8, + 2 + 2 * 8, 2 + 3 * 8, 2 + 4 * 8, 3 + 3 * 8, + 3 + 4 * 8, 4 + 3 * 8, 4 + 4 * 8, 5 + 3 * 8, + 5 + 5 * 8, 7 + 0 * 8, 6 + 6 * 8, 7 + 4 * 8, + 0 + 1 * 8, 0 + 3 * 8, 1 + 3 * 8, 1 + 4 * 8, + 1 + 5 * 8, 3 + 1 * 8, 2 + 5 * 8, 4 + 1 * 8, + 3 + 5 * 8, 5 + 1 * 8, 4 + 5 * 8, 6 + 1 * 8, + 5 + 6 * 8, 7 + 1 * 8, 6 + 7 * 8, 7 + 5 * 8, + 0 + 2 * 8, 0 + 4 * 8, 0 + 5 * 8, 2 + 1 * 8, + 1 + 6 * 8, 4 + 0 * 8, 2 + 6 * 8, 5 + 0 * 8, + 3 + 6 * 8, 6 + 0 * 8, 4 + 6 * 8, 6 + 2 * 8, + 5 + 7 * 8, 6 + 4 * 8, 7 + 2 * 8, 7 + 6 * 8, + 1 + 0 * 8, 1 + 2 * 8, 0 + 6 * 8, 3 + 0 * 8, + 1 + 7 * 8, 3 + 2 * 8, 2 + 7 * 8, 4 + 2 * 8, + 3 + 7 * 8, 5 + 2 * 8, 4 + 7 * 8, 5 + 4 * 8, + 6 + 3 * 8, 6 + 5 * 8, 7 + 3 * 8, 7 + 7 * 8, }; -typedef struct IMbInfo{ +typedef struct IMbInfo { uint16_t type; uint8_t pred_mode; uint8_t cbp; } IMbInfo; -static const IMbInfo i_mb_type_info[26]={ -{MB_TYPE_INTRA4x4 , -1, -1}, -{MB_TYPE_INTRA16x16, 2, 0}, -{MB_TYPE_INTRA16x16, 1, 0}, -{MB_TYPE_INTRA16x16, 0, 0}, -{MB_TYPE_INTRA16x16, 3, 0}, -{MB_TYPE_INTRA16x16, 2, 16}, -{MB_TYPE_INTRA16x16, 1, 16}, -{MB_TYPE_INTRA16x16, 0, 16}, -{MB_TYPE_INTRA16x16, 3, 16}, -{MB_TYPE_INTRA16x16, 2, 32}, -{MB_TYPE_INTRA16x16, 1, 32}, -{MB_TYPE_INTRA16x16, 0, 32}, -{MB_TYPE_INTRA16x16, 3, 32}, -{MB_TYPE_INTRA16x16, 2, 15+0}, -{MB_TYPE_INTRA16x16, 1, 15+0}, -{MB_TYPE_INTRA16x16, 0, 15+0}, -{MB_TYPE_INTRA16x16, 3, 15+0}, -{MB_TYPE_INTRA16x16, 2, 15+16}, -{MB_TYPE_INTRA16x16, 1, 15+16}, -{MB_TYPE_INTRA16x16, 0, 15+16}, -{MB_TYPE_INTRA16x16, 3, 15+16}, -{MB_TYPE_INTRA16x16, 2, 15+32}, -{MB_TYPE_INTRA16x16, 1, 15+32}, -{MB_TYPE_INTRA16x16, 0, 15+32}, -{MB_TYPE_INTRA16x16, 3, 15+32}, -{MB_TYPE_INTRA_PCM , -1, -1}, +static const IMbInfo i_mb_type_info[26] = { + { MB_TYPE_INTRA4x4, -1, -1 }, + { MB_TYPE_INTRA16x16, 2, 0 }, + { MB_TYPE_INTRA16x16, 1, 0 }, + { MB_TYPE_INTRA16x16, 0, 0 }, + { MB_TYPE_INTRA16x16, 3, 0 }, + { MB_TYPE_INTRA16x16, 2, 16 }, + { MB_TYPE_INTRA16x16, 1, 16 }, + { MB_TYPE_INTRA16x16, 0, 16 }, + { MB_TYPE_INTRA16x16, 3, 16 }, + { MB_TYPE_INTRA16x16, 2, 32 }, + { MB_TYPE_INTRA16x16, 1, 32 }, + { MB_TYPE_INTRA16x16, 0, 32 }, + { MB_TYPE_INTRA16x16, 3, 32 }, + { MB_TYPE_INTRA16x16, 2, 15 + 0 }, + { MB_TYPE_INTRA16x16, 1, 15 + 0 }, + { MB_TYPE_INTRA16x16, 0, 15 + 0 }, + { MB_TYPE_INTRA16x16, 3, 15 + 0 }, + { MB_TYPE_INTRA16x16, 2, 15 + 16 }, + { MB_TYPE_INTRA16x16, 1, 15 + 16 }, + { MB_TYPE_INTRA16x16, 0, 15 + 16 }, + { MB_TYPE_INTRA16x16, 3, 15 + 16 }, + { MB_TYPE_INTRA16x16, 2, 15 + 32 }, + { MB_TYPE_INTRA16x16, 1, 15 + 32 }, + { MB_TYPE_INTRA16x16, 0, 15 + 32 }, + { MB_TYPE_INTRA16x16, 3, 15 + 32 }, + { MB_TYPE_INTRA_PCM, -1, -1 }, }; -typedef struct PMbInfo{ +typedef struct PMbInfo { uint16_t type; uint8_t partition_count; } PMbInfo; -static const PMbInfo p_mb_type_info[5]={ -{MB_TYPE_16x16|MB_TYPE_P0L0 , 1}, -{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P1L0, 2}, -{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P1L0, 2}, -{MB_TYPE_8x8 |MB_TYPE_P0L0|MB_TYPE_P1L0, 4}, -{MB_TYPE_8x8 |MB_TYPE_P0L0|MB_TYPE_P1L0|MB_TYPE_REF0, 4}, +static const PMbInfo p_mb_type_info[5] = { + { MB_TYPE_16x16 | MB_TYPE_P0L0, 1 }, + { MB_TYPE_16x8 | MB_TYPE_P0L0 | MB_TYPE_P1L0, 2 }, + { MB_TYPE_8x16 | MB_TYPE_P0L0 | MB_TYPE_P1L0, 2 }, + { MB_TYPE_8x8 | MB_TYPE_P0L0 | MB_TYPE_P1L0, 4 }, + { MB_TYPE_8x8 | MB_TYPE_P0L0 | MB_TYPE_P1L0 | MB_TYPE_REF0, 4 }, }; -static const PMbInfo p_sub_mb_type_info[4]={ -{MB_TYPE_16x16|MB_TYPE_P0L0 , 1}, -{MB_TYPE_16x8 |MB_TYPE_P0L0 , 2}, -{MB_TYPE_8x16 |MB_TYPE_P0L0 , 2}, -{MB_TYPE_8x8 |MB_TYPE_P0L0 , 4}, +static const PMbInfo p_sub_mb_type_info[4] = { + { MB_TYPE_16x16 | MB_TYPE_P0L0, 1 }, + { MB_TYPE_16x8 | MB_TYPE_P0L0, 2 }, + { MB_TYPE_8x16 | MB_TYPE_P0L0, 2 }, + { MB_TYPE_8x8 | MB_TYPE_P0L0, 4 }, }; -static const PMbInfo b_mb_type_info[23]={ -{MB_TYPE_DIRECT2|MB_TYPE_L0L1 , 1, }, -{MB_TYPE_16x16|MB_TYPE_P0L0 , 1, }, -{MB_TYPE_16x16 |MB_TYPE_P0L1 , 1, }, -{MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1 , 1, }, -{MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, }, -{MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, }, -{MB_TYPE_16x8 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, }, -{MB_TYPE_8x16 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, }, -{MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L1, 2, }, -{MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L1, 2, }, -{MB_TYPE_16x8 |MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, }, -{MB_TYPE_8x16 |MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, }, -{MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0|MB_TYPE_P1L1, 2, }, -{MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L0|MB_TYPE_P1L1, 2, }, -{MB_TYPE_16x8 |MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, }, -{MB_TYPE_8x16 |MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, }, -{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, }, -{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, }, -{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, }, -{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, }, -{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, }, -{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, }, -{MB_TYPE_8x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 4, }, +static const PMbInfo b_mb_type_info[23] = { + { MB_TYPE_DIRECT2 | MB_TYPE_L0L1, 1, }, + { MB_TYPE_16x16 | MB_TYPE_P0L0, 1, }, + { MB_TYPE_16x16 | MB_TYPE_P0L1, 1, }, + { MB_TYPE_16x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1, 1, }, + { MB_TYPE_16x8 | MB_TYPE_P0L0 | MB_TYPE_P1L0, 2, }, + { MB_TYPE_8x16 | MB_TYPE_P0L0 | MB_TYPE_P1L0, 2, }, + { MB_TYPE_16x8 | MB_TYPE_P0L1 | MB_TYPE_P1L1, 2, }, + { MB_TYPE_8x16 | MB_TYPE_P0L1 | MB_TYPE_P1L1, 2, }, + { MB_TYPE_16x8 | MB_TYPE_P0L0 | MB_TYPE_P1L1, 2, }, + { MB_TYPE_8x16 | MB_TYPE_P0L0 | MB_TYPE_P1L1, 2, }, + { MB_TYPE_16x8 | MB_TYPE_P0L1 | MB_TYPE_P1L0, 2, }, + { MB_TYPE_8x16 | MB_TYPE_P0L1 | MB_TYPE_P1L0, 2, }, + { MB_TYPE_16x8 | MB_TYPE_P0L0 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 2, }, + { MB_TYPE_8x16 | MB_TYPE_P0L0 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 2, }, + { MB_TYPE_16x8 | MB_TYPE_P0L1 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 2, }, + { MB_TYPE_8x16 | MB_TYPE_P0L1 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 2, }, + { MB_TYPE_16x8 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L0, 2, }, + { MB_TYPE_8x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L0, 2, }, + { MB_TYPE_16x8 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L1, 2, }, + { MB_TYPE_8x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L1, 2, }, + { MB_TYPE_16x8 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 2, }, + { MB_TYPE_8x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 2, }, + { MB_TYPE_8x8 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 4, }, }; -static const PMbInfo b_sub_mb_type_info[13]={ -{MB_TYPE_DIRECT2 , 1, }, -{MB_TYPE_16x16|MB_TYPE_P0L0 , 1, }, -{MB_TYPE_16x16 |MB_TYPE_P0L1 , 1, }, -{MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1 , 1, }, -{MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, }, -{MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, }, -{MB_TYPE_16x8 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, }, -{MB_TYPE_8x16 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, }, -{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, }, -{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, }, -{MB_TYPE_8x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 4, }, -{MB_TYPE_8x8 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 4, }, -{MB_TYPE_8x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 4, }, +static const PMbInfo b_sub_mb_type_info[13] = { + { MB_TYPE_DIRECT2, 1, }, + { MB_TYPE_16x16 | MB_TYPE_P0L0, 1, }, + { MB_TYPE_16x16 | MB_TYPE_P0L1, 1, }, + { MB_TYPE_16x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1, 1, }, + { MB_TYPE_16x8 | MB_TYPE_P0L0 | MB_TYPE_P1L0, 2, }, + { MB_TYPE_8x16 | MB_TYPE_P0L0 | MB_TYPE_P1L0, 2, }, + { MB_TYPE_16x8 | MB_TYPE_P0L1 | MB_TYPE_P1L1, 2, }, + { MB_TYPE_8x16 | MB_TYPE_P0L1 | MB_TYPE_P1L1, 2, }, + { MB_TYPE_16x8 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 2, }, + { MB_TYPE_8x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 2, }, + { MB_TYPE_8x8 | MB_TYPE_P0L0 | MB_TYPE_P1L0, 4, }, + { MB_TYPE_8x8 | MB_TYPE_P0L1 | MB_TYPE_P1L1, 4, }, + { MB_TYPE_8x8 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 4, }, }; -static const uint8_t dequant4_coeff_init[6][3]={ - {10,13,16}, - {11,14,18}, - {13,16,20}, - {14,18,23}, - {16,20,25}, - {18,23,29}, +static const uint8_t dequant4_coeff_init[6][3] = { + { 10, 13, 16 }, + { 11, 14, 18 }, + { 13, 16, 20 }, + { 14, 18, 23 }, + { 16, 20, 25 }, + { 18, 23, 29 }, }; static const uint8_t dequant8_coeff_init_scan[16] = { - 0,3,4,3, 3,1,5,1, 4,5,2,5, 3,1,5,1 + 0, 3, 4, 3, 3, 1, 5, 1, 4, 5, 2, 5, 3, 1, 5, 1 }; -static const uint8_t dequant8_coeff_init[6][6]={ - {20,18,32,19,25,24}, - {22,19,35,21,28,26}, - {26,23,42,24,33,31}, - {28,25,45,26,35,33}, - {32,28,51,30,40,38}, - {36,32,58,34,46,43}, + +static const uint8_t dequant8_coeff_init[6][6] = { + { 20, 18, 32, 19, 25, 24 }, + { 22, 19, 35, 21, 28, 26 }, + { 26, 23, 42, 24, 33, 31 }, + { 28, 25, 45, 26, 35, 33 }, + { 32, 28, 51, 30, 40, 38 }, + { 36, 32, 58, 34, 46, 43 }, }; #endif /* AVCODEC_H264DATA_H */ diff --git a/libavcodec/h264pred.h b/libavcodec/h264pred.h index b880446..a964ae3 100644 --- a/libavcodec/h264pred.h +++ b/libavcodec/h264pred.h @@ -35,18 +35,18 @@ * Prediction types */ //@{ -#define VERT_PRED 0 -#define HOR_PRED 1 -#define DC_PRED 2 -#define DIAG_DOWN_LEFT_PRED 3 -#define DIAG_DOWN_RIGHT_PRED 4 -#define VERT_RIGHT_PRED 5 -#define HOR_DOWN_PRED 6 -#define VERT_LEFT_PRED 7 -#define HOR_UP_PRED 8 +#define VERT_PRED 0 +#define HOR_PRED 1 +#define DC_PRED 2 +#define DIAG_DOWN_LEFT_PRED 3 +#define DIAG_DOWN_RIGHT_PRED 4 +#define VERT_RIGHT_PRED 5 +#define HOR_DOWN_PRED 6 +#define VERT_LEFT_PRED 7 +#define HOR_UP_PRED 8 // DC edge (not for VP8) -#define LEFT_DC_PRED 9 +#define LEFT_DC_PRED 9 #define TOP_DC_PRED 10 #define DC_128_PRED 11 @@ -56,7 +56,7 @@ #define VERT_LEFT_PRED_RV40_NODOWN 14 // VP8 specific -#define TM_VP8_PRED 9 ///< "True Motion", used instead of plane +#define TM_VP8_PRED 9 ///< "True Motion", used instead of plane #define VERT_VP8_PRED 10 ///< for VP8, #VERT_PRED is the average of ///< (left col+cur col x2+right col) / 4; ///< this is the "unaveraged" one @@ -65,44 +65,53 @@ #define DC_127_PRED 12 #define DC_129_PRED 13 -#define DC_PRED8x8 0 -#define HOR_PRED8x8 1 -#define VERT_PRED8x8 2 -#define PLANE_PRED8x8 3 +#define DC_PRED8x8 0 +#define HOR_PRED8x8 1 +#define VERT_PRED8x8 2 +#define PLANE_PRED8x8 3 // DC edge -#define LEFT_DC_PRED8x8 4 -#define TOP_DC_PRED8x8 5 -#define DC_128_PRED8x8 6 +#define LEFT_DC_PRED8x8 4 +#define TOP_DC_PRED8x8 5 +#define DC_128_PRED8x8 6 // H264/SVQ3 (8x8) specific -#define ALZHEIMER_DC_L0T_PRED8x8 7 -#define ALZHEIMER_DC_0LT_PRED8x8 8 -#define ALZHEIMER_DC_L00_PRED8x8 9 +#define ALZHEIMER_DC_L0T_PRED8x8 7 +#define ALZHEIMER_DC_0LT_PRED8x8 8 +#define ALZHEIMER_DC_L00_PRED8x8 9 #define ALZHEIMER_DC_0L0_PRED8x8 10 // VP8 specific -#define DC_127_PRED8x8 7 -#define DC_129_PRED8x8 8 +#define DC_127_PRED8x8 7 +#define DC_129_PRED8x8 8 //@} /** * Context for storing H.264 prediction functions */ -typedef struct H264PredContext{ - void (*pred4x4 [9+3+3])(uint8_t *src, const uint8_t *topright, int stride);//FIXME move to dsp? - void (*pred8x8l [9+3])(uint8_t *src, int topleft, int topright, int stride); - void (*pred8x8 [4+3+4])(uint8_t *src, int stride); - void (*pred16x16[4+3+2])(uint8_t *src, int stride); +typedef struct H264PredContext { + void(*pred4x4[9 + 3 + 3])(uint8_t *src, const uint8_t *topright, int stride); //FIXME move to dsp? + void(*pred8x8l[9 + 3])(uint8_t *src, int topleft, int topright, int stride); + void(*pred8x8[4 + 3 + 4])(uint8_t *src, int stride); + void(*pred16x16[4 + 3 + 2])(uint8_t *src, int stride); - void (*pred4x4_add [2])(uint8_t *pix/*align 4*/, const DCTELEM *block/*align 16*/, int stride); - void (*pred8x8l_add [2])(uint8_t *pix/*align 8*/, const DCTELEM *block/*align 16*/, int stride); - void (*pred8x8_add [3])(uint8_t *pix/*align 8*/, const int *block_offset, const DCTELEM *block/*align 16*/, int stride); - void (*pred16x16_add[3])(uint8_t *pix/*align 16*/, const int *block_offset, const DCTELEM *block/*align 16*/, int stride); -}H264PredContext; + void(*pred4x4_add[2])(uint8_t *pix /*align 4*/, + const DCTELEM *block /*align 16*/, int stride); + void(*pred8x8l_add[2])(uint8_t *pix /*align 8*/, + const DCTELEM *block /*align 16*/, int stride); + void(*pred8x8_add[3])(uint8_t *pix /*align 8*/, + const int *block_offset, + const DCTELEM *block /*align 16*/, int stride); + void(*pred16x16_add[3])(uint8_t *pix /*align 16*/, + const int *block_offset, + const DCTELEM *block /*align 16*/, int stride); +} H264PredContext; -void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc); -void ff_h264_pred_init_arm(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc); -void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc); +void ff_h264_pred_init(H264PredContext *h, int codec_id, + const int bit_depth, const int chroma_format_idc); +void ff_h264_pred_init_arm(H264PredContext *h, int codec_id, + const int bit_depth, const int chroma_format_idc); +void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, + const int bit_depth, const int chroma_format_idc); #endif /* AVCODEC_H264PRED_H */ -- 1.7.1 From diego at biurrun.de Mon May 7 14:14:34 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 14:14:34 +0200 Subject: [libav-devel] [PATCH 2/2] h264: K&R formatting cosmetics for header files (part II/II) In-Reply-To: <1336392874-29247-1-git-send-email-diego@biurrun.de> References: <1336392874-29247-1-git-send-email-diego@biurrun.de> Message-ID: <1336392874-29247-2-git-send-email-diego@biurrun.de> --- libavcodec/h264_mvpred.h | 1013 ++++++++++++++++++++++++---------------------- libavcodec/h264dsp.h | 96 +++-- 2 files changed, 593 insertions(+), 516 deletions(-) diff --git a/libavcodec/h264_mvpred.h b/libavcodec/h264_mvpred.h index 2bd4458..15403d2 100644 --- a/libavcodec/h264_mvpred.h +++ b/libavcodec/h264_mvpred.h @@ -35,53 +35,53 @@ //#undef NDEBUG #include -static av_always_inline int fetch_diagonal_mv(H264Context *h, const int16_t **C, int i, int list, int part_width){ - const int topright_ref= h->ref_cache[list][ i - 8 + part_width ]; - MpegEncContext *s = &h->s; +static av_always_inline int fetch_diagonal_mv(H264Context *h, const int16_t **C, + int i, int list, int part_width) +{ + const int topright_ref = h->ref_cache[list][i - 8 + part_width]; + MpegEncContext *s = &h->s; /* there is no consistent mapping of mvs to neighboring locations that will * make mbaff happy, so we can't move all this logic to fill_caches */ - if(FRAME_MBAFF){ - -#define SET_DIAG_MV(MV_OP, REF_OP, XY, Y4)\ - const int xy = XY, y4 = Y4;\ - const int mb_type = mb_types[xy+(y4>>2)*s->mb_stride];\ - if(!USES_LIST(mb_type,list))\ - return LIST_NOT_USED;\ - mv = s->current_picture_ptr->f.motion_val[list][h->mb2b_xy[xy] + 3 + y4*h->b_stride];\ - h->mv_cache[list][scan8[0]-2][0] = mv[0];\ - h->mv_cache[list][scan8[0]-2][1] = mv[1] MV_OP;\ - return s->current_picture_ptr->f.ref_index[list][4*xy + 1 + (y4 & ~1)] REF_OP; - - if(topright_ref == PART_NOT_AVAILABLE - && i >= scan8[0]+8 && (i&7)==4 - && h->ref_cache[list][scan8[0]-1] != PART_NOT_AVAILABLE){ + if (FRAME_MBAFF) { +#define SET_DIAG_MV(MV_OP, REF_OP, XY, Y4) \ + const int xy = XY, y4 = Y4; \ + const int mb_type = mb_types[xy + (y4 >> 2) * s->mb_stride]; \ + if (!USES_LIST(mb_type, list)) \ + return LIST_NOT_USED; \ + mv = s->current_picture_ptr->f.motion_val[list][h->mb2b_xy[xy] + 3 + y4 * h->b_stride]; \ + h->mv_cache[list][scan8[0] - 2][0] = mv[0]; \ + h->mv_cache[list][scan8[0] - 2][1] = mv[1] MV_OP; \ + return s->current_picture_ptr->f.ref_index[list][4 * xy + 1 + (y4 & ~1)] REF_OP; + + if (topright_ref == PART_NOT_AVAILABLE + && i >= scan8[0] + 8 && (i & 7) == 4 + && h->ref_cache[list][scan8[0] - 1] != PART_NOT_AVAILABLE) { const uint32_t *mb_types = s->current_picture_ptr->f.mb_type; const int16_t *mv; - AV_ZERO32(h->mv_cache[list][scan8[0]-2]); - *C = h->mv_cache[list][scan8[0]-2]; - - if(!MB_FIELD - && IS_INTERLACED(h->left_type[0])){ - SET_DIAG_MV(*2, >>1, h->left_mb_xy[0]+s->mb_stride, (s->mb_y&1)*2+(i>>5)); - } - if(MB_FIELD - && !IS_INTERLACED(h->left_type[0])){ + AV_ZERO32(h->mv_cache[list][scan8[0] - 2]); + *C = h->mv_cache[list][scan8[0] - 2]; + + if (!MB_FIELD && IS_INTERLACED(h->left_type[0])) { + SET_DIAG_MV(* 2, >> 1, h->left_mb_xy[0] + s->mb_stride, + (s->mb_y & 1) * 2 + (i >> 5)); + } + if (MB_FIELD && !IS_INTERLACED(h->left_type[0])) { // left shift will turn LIST_NOT_USED into PART_NOT_AVAILABLE, but that's OK. - SET_DIAG_MV(/2, <<1, h->left_mb_xy[i>=36], ((i>>2))&3); - } + SET_DIAG_MV(/ 2, << 1, h->left_mb_xy[i >= 36], ((i >> 2)) & 3); + } } #undef SET_DIAG_MV } - if(topright_ref != PART_NOT_AVAILABLE){ - *C= h->mv_cache[list][ i - 8 + part_width ]; + if (topright_ref != PART_NOT_AVAILABLE) { + *C = h->mv_cache[list][i - 8 + part_width]; return topright_ref; - }else{ + } else { tprintf(s->avctx, "topright MV not available\n"); - *C= h->mv_cache[list][ i - 8 - 1 ]; - return h->ref_cache[list][ i - 8 - 1 ]; + *C = h->mv_cache[list][i - 8 - 1]; + return h->ref_cache[list][i - 8 - 1]; } } @@ -92,53 +92,61 @@ static av_always_inline int fetch_diagonal_mv(H264Context *h, const int16_t **C, * @param mx the x component of the predicted motion vector * @param my the y component of the predicted motion vector */ -static av_always_inline void pred_motion(H264Context * const h, int n, int part_width, int list, int ref, int * const mx, int * const my){ - const int index8= scan8[n]; - const int top_ref= h->ref_cache[list][ index8 - 8 ]; - const int left_ref= h->ref_cache[list][ index8 - 1 ]; - const int16_t * const A= h->mv_cache[list][ index8 - 1 ]; - const int16_t * const B= h->mv_cache[list][ index8 - 8 ]; - const int16_t * C; +static av_always_inline void pred_motion(H264Context *const h, int n, + int part_width, int list, int ref, + int *const mx, int *const my) +{ + const int index8 = scan8[n]; + const int top_ref = h->ref_cache[list][index8 - 8]; + const int left_ref = h->ref_cache[list][index8 - 1]; + const int16_t *const A = h->mv_cache[list][index8 - 1]; + const int16_t *const B = h->mv_cache[list][index8 - 8]; + const int16_t *C; int diagonal_ref, match_count; - assert(part_width==1 || part_width==2 || part_width==4); + assert(part_width == 1 || part_width == 2 || part_width == 4); /* mv_cache - B . . A T T T T - U . . L . . , . - U . . L . . . . - U . . L . . , . - . . . L . . . . -*/ - - diagonal_ref= fetch_diagonal_mv(h, &C, index8, list, part_width); - match_count= (diagonal_ref==ref) + (top_ref==ref) + (left_ref==ref); + * B . . A T T T T + * U . . L . . , . + * U . . L . . . . + * U . . L . . , . + * . . . L . . . . + */ + + diagonal_ref = fetch_diagonal_mv(h, &C, index8, list, part_width); + match_count = (diagonal_ref == ref) + (top_ref == ref) + (left_ref == ref); tprintf(h->s.avctx, "pred_motion match_count=%d\n", match_count); - if(match_count > 1){ //most common - *mx= mid_pred(A[0], B[0], C[0]); - *my= mid_pred(A[1], B[1], C[1]); - }else if(match_count==1){ - if(left_ref==ref){ - *mx= A[0]; - *my= A[1]; - }else if(top_ref==ref){ - *mx= B[0]; - *my= B[1]; - }else{ - *mx= C[0]; - *my= C[1]; + if (match_count > 1) { //most common + *mx = mid_pred(A[0], B[0], C[0]); + *my = mid_pred(A[1], B[1], C[1]); + } else if (match_count == 1) { + if (left_ref == ref) { + *mx = A[0]; + *my = A[1]; + } else if (top_ref == ref) { + *mx = B[0]; + *my = B[1]; + } else { + *mx = C[0]; + *my = C[1]; } - }else{ - if(top_ref == PART_NOT_AVAILABLE && diagonal_ref == PART_NOT_AVAILABLE && left_ref != PART_NOT_AVAILABLE){ - *mx= A[0]; - *my= A[1]; - }else{ - *mx= mid_pred(A[0], B[0], C[0]); - *my= mid_pred(A[1], B[1], C[1]); + } else { + if (top_ref == PART_NOT_AVAILABLE && + diagonal_ref == PART_NOT_AVAILABLE && + left_ref != PART_NOT_AVAILABLE) { + *mx = A[0]; + *my = A[1]; + } else { + *mx = mid_pred(A[0], B[0], C[0]); + *my = mid_pred(A[1], B[1], C[1]); } } - tprintf(h->s.avctx, "pred_motion (%2d %2d %2d) (%2d %2d %2d) (%2d %2d %2d) -> (%2d %2d %2d) at %2d %2d %d list %d\n", top_ref, B[0], B[1], diagonal_ref, C[0], C[1], left_ref, A[0], A[1], ref, *mx, *my, h->s.mb_x, h->s.mb_y, n, list); + tprintf(h->s.avctx, + "pred_motion (%2d %2d %2d) (%2d %2d %2d) (%2d %2d %2d) -> (%2d %2d %2d) at %2d %2d %d list %d\n", + top_ref, B[0], B[1], diagonal_ref, C[0], C[1], left_ref, + A[0], A[1], ref, *mx, *my, h->s.mb_x, h->s.mb_y, n, list); } /** @@ -147,27 +155,32 @@ static av_always_inline void pred_motion(H264Context * const h, int n, int part_ * @param mx the x component of the predicted motion vector * @param my the y component of the predicted motion vector */ -static av_always_inline void pred_16x8_motion(H264Context * const h, int n, int list, int ref, int * const mx, int * const my){ - if(n==0){ - const int top_ref= h->ref_cache[list][ scan8[0] - 8 ]; - const int16_t * const B= h->mv_cache[list][ scan8[0] - 8 ]; - - tprintf(h->s.avctx, "pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d\n", top_ref, B[0], B[1], h->s.mb_x, h->s.mb_y, n, list); - - if(top_ref == ref){ - *mx= B[0]; - *my= B[1]; +static av_always_inline void pred_16x8_motion(H264Context *const h, + int n, int list, int ref, + int *const mx, int *const my) +{ + if (n == 0) { + const int top_ref = h->ref_cache[list][scan8[0] - 8]; + const int16_t *const B = h->mv_cache[list][scan8[0] - 8]; + + tprintf(h->s.avctx, "pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d\n", + top_ref, B[0], B[1], h->s.mb_x, h->s.mb_y, n, list); + + if (top_ref == ref) { + *mx = B[0]; + *my = B[1]; return; } - }else{ - const int left_ref= h->ref_cache[list][ scan8[8] - 1 ]; - const int16_t * const A= h->mv_cache[list][ scan8[8] - 1 ]; + } else { + const int left_ref = h->ref_cache[list][scan8[8] - 1]; + const int16_t *const A = h->mv_cache[list][scan8[8] - 1]; - tprintf(h->s.avctx, "pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d\n", left_ref, A[0], A[1], h->s.mb_x, h->s.mb_y, n, list); + tprintf(h->s.avctx, "pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d\n", + left_ref, A[0], A[1], h->s.mb_x, h->s.mb_y, n, list); - if(left_ref == ref){ - *mx= A[0]; - *my= A[1]; + if (left_ref == ref) { + *mx = A[0]; + *my = A[1]; return; } } @@ -182,29 +195,34 @@ static av_always_inline void pred_16x8_motion(H264Context * const h, int n, int * @param mx the x component of the predicted motion vector * @param my the y component of the predicted motion vector */ -static av_always_inline void pred_8x16_motion(H264Context * const h, int n, int list, int ref, int * const mx, int * const my){ - if(n==0){ - const int left_ref= h->ref_cache[list][ scan8[0] - 1 ]; - const int16_t * const A= h->mv_cache[list][ scan8[0] - 1 ]; - - tprintf(h->s.avctx, "pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d\n", left_ref, A[0], A[1], h->s.mb_x, h->s.mb_y, n, list); - - if(left_ref == ref){ - *mx= A[0]; - *my= A[1]; +static av_always_inline void pred_8x16_motion(H264Context *const h, + int n, int list, int ref, + int *const mx, int *const my) +{ + if (n == 0) { + const int left_ref = h->ref_cache[list][scan8[0] - 1]; + const int16_t *const A = h->mv_cache[list][scan8[0] - 1]; + + tprintf(h->s.avctx, "pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d\n", + left_ref, A[0], A[1], h->s.mb_x, h->s.mb_y, n, list); + + if (left_ref == ref) { + *mx = A[0]; + *my = A[1]; return; } - }else{ - const int16_t * C; + } else { + const int16_t *C; int diagonal_ref; - diagonal_ref= fetch_diagonal_mv(h, &C, scan8[4], list, 2); + diagonal_ref = fetch_diagonal_mv(h, &C, scan8[4], list, 2); - tprintf(h->s.avctx, "pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d\n", diagonal_ref, C[0], C[1], h->s.mb_x, h->s.mb_y, n, list); + tprintf(h->s.avctx, "pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d\n", + diagonal_ref, C[0], C[1], h->s.mb_x, h->s.mb_y, n, list); - if(diagonal_ref == ref){ - *mx= C[0]; - *my= C[1]; + if (diagonal_ref == ref) { + *mx = C[0]; + *my = C[1]; return; } } @@ -213,168 +231,174 @@ static av_always_inline void pred_8x16_motion(H264Context * const h, int n, int pred_motion(h, n, 2, list, ref, mx, my); } -#define FIX_MV_MBAFF(type, refn, mvn, idx)\ - if(FRAME_MBAFF){\ - if(MB_FIELD){\ - if(!IS_INTERLACED(type)){\ - refn <<= 1;\ - AV_COPY32(mvbuf[idx], mvn);\ - mvbuf[idx][1] /= 2;\ - mvn = mvbuf[idx];\ - }\ - }else{\ - if(IS_INTERLACED(type)){\ - refn >>= 1;\ - AV_COPY32(mvbuf[idx], mvn);\ - mvbuf[idx][1] <<= 1;\ - mvn = mvbuf[idx];\ - }\ - }\ +#define FIX_MV_MBAFF(type, refn, mvn, idx) \ + if (FRAME_MBAFF) { \ + if (MB_FIELD) { \ + if (!IS_INTERLACED(type)) { \ + refn <<= 1; \ + AV_COPY32(mvbuf[idx], mvn); \ + mvbuf[idx][1] /= 2; \ + mvn = mvbuf[idx]; \ + } \ + } else { \ + if (IS_INTERLACED(type)) { \ + refn >>= 1; \ + AV_COPY32(mvbuf[idx], mvn); \ + mvbuf[idx][1] <<= 1; \ + mvn = mvbuf[idx]; \ + } \ + } \ } -static av_always_inline void pred_pskip_motion(H264Context * const h){ - DECLARE_ALIGNED(4, static const int16_t, zeromv)[2] = {0}; +static av_always_inline void pred_pskip_motion(H264Context *const h) +{ + DECLARE_ALIGNED(4, static const int16_t, zeromv)[2] = { 0 }; DECLARE_ALIGNED(4, int16_t, mvbuf)[3][2]; - MpegEncContext * const s = &h->s; - int8_t *ref = s->current_picture.f.ref_index[0]; - int16_t (*mv)[2] = s->current_picture.f.motion_val[0]; + MpegEncContext *const s = &h->s; + int8_t *ref = s->current_picture.f.ref_index[0]; + int16_t(*mv)[2] = s->current_picture.f.motion_val[0]; int top_ref, left_ref, diagonal_ref, match_count, mx, my; const int16_t *A, *B, *C; int b_stride = h->b_stride; fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, 0, 1); - /* To avoid doing an entire fill_decode_caches, we inline the relevant parts here. - * FIXME: this is a partial duplicate of the logic in fill_decode_caches, but it's - * faster this way. Is there a way to avoid this duplication? + /* To avoid doing an entire fill_decode_caches, we inline the relevant + * parts here. + * FIXME: this is a partial duplicate of the logic in fill_decode_caches, + * but it's faster this way. Is there a way to avoid this duplication? */ - if(USES_LIST(h->left_type[LTOP], 0)){ - left_ref = ref[4*h->left_mb_xy[LTOP] + 1 + (h->left_block[0]&~1)]; - A = mv[h->mb2b_xy[h->left_mb_xy[LTOP]] + 3 + b_stride*h->left_block[0]]; + if (USES_LIST(h->left_type[LTOP], 0)) { + left_ref = ref[4 * h->left_mb_xy[LTOP] + 1 + (h->left_block[0] & ~1)]; + A = mv[h->mb2b_xy[h->left_mb_xy[LTOP]] + 3 + b_stride * h->left_block[0]]; FIX_MV_MBAFF(h->left_type[LTOP], left_ref, A, 0); - if(!(left_ref | AV_RN32A(A))){ + if (!(left_ref | AV_RN32A(A))) goto zeromv; - } - }else if(h->left_type[LTOP]){ + } else if (h->left_type[LTOP]) { left_ref = LIST_NOT_USED; - A = zeromv; - }else{ + A = zeromv; + } else { goto zeromv; } - if(USES_LIST(h->top_type, 0)){ - top_ref = ref[4*h->top_mb_xy + 2]; - B = mv[h->mb2b_xy[h->top_mb_xy] + 3*b_stride]; + if (USES_LIST(h->top_type, 0)) { + top_ref = ref[4 * h->top_mb_xy + 2]; + B = mv[h->mb2b_xy[h->top_mb_xy] + 3 * b_stride]; FIX_MV_MBAFF(h->top_type, top_ref, B, 1); - if(!(top_ref | AV_RN32A(B))){ + if (!(top_ref | AV_RN32A(B))) goto zeromv; - } - }else if(h->top_type){ + } else if (h->top_type) { top_ref = LIST_NOT_USED; - B = zeromv; - }else{ + B = zeromv; + } else { goto zeromv; } - tprintf(h->s.avctx, "pred_pskip: (%d) (%d) at %2d %2d\n", top_ref, left_ref, h->s.mb_x, h->s.mb_y); + tprintf(h->s.avctx, "pred_pskip: (%d) (%d) at %2d %2d\n", + top_ref, left_ref, h->s.mb_x, h->s.mb_y); - if(USES_LIST(h->topright_type, 0)){ - diagonal_ref = ref[4*h->topright_mb_xy + 2]; - C = mv[h->mb2b_xy[h->topright_mb_xy] + 3*b_stride]; + if (USES_LIST(h->topright_type, 0)) { + diagonal_ref = ref[4 * h->topright_mb_xy + 2]; + C = mv[h->mb2b_xy[h->topright_mb_xy] + 3 * b_stride]; FIX_MV_MBAFF(h->topright_type, diagonal_ref, C, 2); - }else if(h->topright_type){ + } else if (h->topright_type) { diagonal_ref = LIST_NOT_USED; C = zeromv; - }else{ - if(USES_LIST(h->topleft_type, 0)){ - diagonal_ref = ref[4*h->topleft_mb_xy + 1 + (h->topleft_partition & 2)]; - C = mv[h->mb2b_xy[h->topleft_mb_xy] + 3 + b_stride + (h->topleft_partition & 2*b_stride)]; + } else { + if (USES_LIST(h->topleft_type, 0)) { + diagonal_ref = ref[4 * h->topleft_mb_xy + 1 + + (h->topleft_partition & 2)]; + C = mv[h->mb2b_xy[h->topleft_mb_xy] + 3 + b_stride + + (h->topleft_partition & 2 * b_stride)]; FIX_MV_MBAFF(h->topleft_type, diagonal_ref, C, 2); - }else if(h->topleft_type){ + } else if (h->topleft_type) { diagonal_ref = LIST_NOT_USED; - C = zeromv; - }else{ + C = zeromv; + } else { diagonal_ref = PART_NOT_AVAILABLE; - C = zeromv; + C = zeromv; } } - match_count= !diagonal_ref + !top_ref + !left_ref; + match_count = !diagonal_ref + !top_ref + !left_ref; tprintf(h->s.avctx, "pred_pskip_motion match_count=%d\n", match_count); - if(match_count > 1){ + if (match_count > 1) { mx = mid_pred(A[0], B[0], C[0]); my = mid_pred(A[1], B[1], C[1]); - }else if(match_count==1){ - if(!left_ref){ + } else if (match_count == 1) { + if (!left_ref) { mx = A[0]; my = A[1]; - }else if(!top_ref){ + } else if (!top_ref) { mx = B[0]; my = B[1]; - }else{ + } else { mx = C[0]; my = C[1]; } - }else{ + } else { mx = mid_pred(A[0], B[0], C[0]); my = mid_pred(A[1], B[1], C[1]); } - fill_rectangle( h->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mx,my), 4); + fill_rectangle(h->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mx, my), 4); return; + zeromv: - fill_rectangle( h->mv_cache[0][scan8[0]], 4, 4, 8, 0, 4); + fill_rectangle(h->mv_cache[0][scan8[0]], 4, 4, 8, 0, 4); return; } -static void fill_decode_neighbors(H264Context *h, int mb_type){ - MpegEncContext * const s = &h->s; - const int mb_xy= h->mb_xy; +static void fill_decode_neighbors(H264Context *h, int mb_type) +{ + MpegEncContext *const s = &h->s; + const int mb_xy = h->mb_xy; int topleft_xy, top_xy, topright_xy, left_xy[LEFT_MBS]; - static const uint8_t left_block_options[4][32]={ - {0,1,2,3,7,10,8,11,3+0*4, 3+1*4, 3+2*4, 3+3*4, 1+4*4, 1+8*4, 1+5*4, 1+9*4}, - {2,2,3,3,8,11,8,11,3+2*4, 3+2*4, 3+3*4, 3+3*4, 1+5*4, 1+9*4, 1+5*4, 1+9*4}, - {0,0,1,1,7,10,7,10,3+0*4, 3+0*4, 3+1*4, 3+1*4, 1+4*4, 1+8*4, 1+4*4, 1+8*4}, - {0,2,0,2,7,10,7,10,3+0*4, 3+2*4, 3+0*4, 3+2*4, 1+4*4, 1+8*4, 1+4*4, 1+8*4} + static const uint8_t left_block_options[4][32] = { + { 0, 1, 2, 3, 7, 10, 8, 11, 3 + 0 * 4, 3 + 1 * 4, 3 + 2 * 4, 3 + 3 * 4, 1 + 4 * 4, 1 + 8 * 4, 1 + 5 * 4, 1 + 9 * 4 }, + { 2, 2, 3, 3, 8, 11, 8, 11, 3 + 2 * 4, 3 + 2 * 4, 3 + 3 * 4, 3 + 3 * 4, 1 + 5 * 4, 1 + 9 * 4, 1 + 5 * 4, 1 + 9 * 4 }, + { 0, 0, 1, 1, 7, 10, 7, 10, 3 + 0 * 4, 3 + 0 * 4, 3 + 1 * 4, 3 + 1 * 4, 1 + 4 * 4, 1 + 8 * 4, 1 + 4 * 4, 1 + 8 * 4 }, + { 0, 2, 0, 2, 7, 10, 7, 10, 3 + 0 * 4, 3 + 2 * 4, 3 + 0 * 4, 3 + 2 * 4, 1 + 4 * 4, 1 + 8 * 4, 1 + 4 * 4, 1 + 8 * 4 } }; - h->topleft_partition= -1; + h->topleft_partition = -1; - top_xy = mb_xy - (s->mb_stride << MB_FIELD); + top_xy = mb_xy - (s->mb_stride << MB_FIELD); /* Wow, what a mess, why didn't they simplify the interlacing & intra * stuff, I can't imagine that these complex rules are worth it. */ - topleft_xy = top_xy - 1; - topright_xy= top_xy + 1; - left_xy[LBOT] = left_xy[LTOP] = mb_xy-1; + topleft_xy = top_xy - 1; + topright_xy = top_xy + 1; + left_xy[LBOT] = left_xy[LTOP] = mb_xy - 1; h->left_block = left_block_options[0]; - if(FRAME_MBAFF){ + if (FRAME_MBAFF) { const int left_mb_field_flag = IS_INTERLACED(s->current_picture.f.mb_type[mb_xy - 1]); const int curr_mb_field_flag = IS_INTERLACED(mb_type); - if(s->mb_y&1){ + if (s->mb_y & 1) { if (left_mb_field_flag != curr_mb_field_flag) { left_xy[LBOT] = left_xy[LTOP] = mb_xy - s->mb_stride - 1; if (curr_mb_field_flag) { left_xy[LBOT] += s->mb_stride; - h->left_block = left_block_options[3]; + h->left_block = left_block_options[3]; } else { topleft_xy += s->mb_stride; - // take top left mv from the middle of the mb, as opposed to all other modes which use the bottom right partition + /* take top left mv from the middle of the mb, as opposed + * to all other modes which use the bottom right partition */ h->topleft_partition = 0; - h->left_block = left_block_options[1]; + h->left_block = left_block_options[1]; } } - }else{ - if(curr_mb_field_flag){ + } else { + if (curr_mb_field_flag) { topleft_xy += s->mb_stride & (((s->current_picture.f.mb_type[top_xy - 1] >> 7) & 1) - 1); topright_xy += s->mb_stride & (((s->current_picture.f.mb_type[top_xy + 1] >> 7) & 1) - 1); - top_xy += s->mb_stride & (((s->current_picture.f.mb_type[top_xy ] >> 7) & 1) - 1); + top_xy += s->mb_stride & (((s->current_picture.f.mb_type[top_xy] >> 7) & 1) - 1); } if (left_mb_field_flag != curr_mb_field_flag) { if (curr_mb_field_flag) { left_xy[LBOT] += s->mb_stride; - h->left_block = left_block_options[3]; + h->left_block = left_block_options[3]; } else { h->left_block = left_block_options[2]; } @@ -382,9 +406,9 @@ static void fill_decode_neighbors(H264Context *h, int mb_type){ } } - h->topleft_mb_xy = topleft_xy; - h->top_mb_xy = top_xy; - h->topright_mb_xy= topright_xy; + h->topleft_mb_xy = topleft_xy; + h->top_mb_xy = top_xy; + h->topright_mb_xy = topright_xy; h->left_mb_xy[LTOP] = left_xy[LTOP]; h->left_mb_xy[LBOT] = left_xy[LBOT]; //FIXME do we need all in the context? @@ -395,351 +419,372 @@ static void fill_decode_neighbors(H264Context *h, int mb_type){ h->left_type[LTOP] = s->current_picture.f.mb_type[left_xy[LTOP]]; h->left_type[LBOT] = s->current_picture.f.mb_type[left_xy[LBOT]]; - if(FMO){ - if(h->slice_table[topleft_xy ] != h->slice_num) h->topleft_type = 0; - if(h->slice_table[top_xy ] != h->slice_num) h->top_type = 0; - if(h->slice_table[left_xy[LTOP] ] != h->slice_num) h->left_type[LTOP] = h->left_type[LBOT] = 0; - }else{ - if(h->slice_table[topleft_xy ] != h->slice_num){ + if (FMO) { + if (h->slice_table[topleft_xy] != h->slice_num) + h->topleft_type = 0; + if (h->slice_table[top_xy] != h->slice_num) + h->top_type = 0; + if (h->slice_table[left_xy[LTOP]] != h->slice_num) + h->left_type[LTOP] = h->left_type[LBOT] = 0; + } else { + if (h->slice_table[topleft_xy] != h->slice_num) { h->topleft_type = 0; - if(h->slice_table[top_xy ] != h->slice_num) h->top_type = 0; - if(h->slice_table[left_xy[LTOP] ] != h->slice_num) h->left_type[LTOP] = h->left_type[LBOT] = 0; + if (h->slice_table[top_xy] != h->slice_num) + h->top_type = 0; + if (h->slice_table[left_xy[LTOP]] != h->slice_num) + h->left_type[LTOP] = h->left_type[LBOT] = 0; } } - if(h->slice_table[topright_xy] != h->slice_num) h->topright_type= 0; + if (h->slice_table[topright_xy] != h->slice_num) + h->topright_type = 0; } -static void fill_decode_caches(H264Context *h, int mb_type){ - MpegEncContext * const s = &h->s; +static void fill_decode_caches(H264Context *h, int mb_type) +{ + MpegEncContext *const s = &h->s; int topleft_xy, top_xy, topright_xy, left_xy[LEFT_MBS]; int topleft_type, top_type, topright_type, left_type[LEFT_MBS]; - const uint8_t * left_block= h->left_block; + const uint8_t *left_block = h->left_block; int i; uint8_t *nnz; uint8_t *nnz_cache; - topleft_xy = h->topleft_mb_xy; - top_xy = h->top_mb_xy; - topright_xy = h->topright_mb_xy; - left_xy[LTOP] = h->left_mb_xy[LTOP]; - left_xy[LBOT] = h->left_mb_xy[LBOT]; - topleft_type = h->topleft_type; - top_type = h->top_type; - topright_type = h->topright_type; - left_type[LTOP]= h->left_type[LTOP]; - left_type[LBOT]= h->left_type[LBOT]; - - if(!IS_SKIP(mb_type)){ - if(IS_INTRA(mb_type)){ - int type_mask= h->pps.constrained_intra_pred ? IS_INTRA(-1) : -1; - h->topleft_samples_available= - h->top_samples_available= - h->left_samples_available= 0xFFFF; - h->topright_samples_available= 0xEEEA; - - if(!(top_type & type_mask)){ - h->topleft_samples_available= 0xB3FF; - h->top_samples_available= 0x33FF; - h->topright_samples_available= 0x26EA; + topleft_xy = h->topleft_mb_xy; + top_xy = h->top_mb_xy; + topright_xy = h->topright_mb_xy; + left_xy[LTOP] = h->left_mb_xy[LTOP]; + left_xy[LBOT] = h->left_mb_xy[LBOT]; + topleft_type = h->topleft_type; + top_type = h->top_type; + topright_type = h->topright_type; + left_type[LTOP] = h->left_type[LTOP]; + left_type[LBOT] = h->left_type[LBOT]; + + if (!IS_SKIP(mb_type)) { + if (IS_INTRA(mb_type)) { + int type_mask = h->pps.constrained_intra_pred ? IS_INTRA(-1) : -1; + h->topleft_samples_available = + h->top_samples_available = + h->left_samples_available = 0xFFFF; + h->topright_samples_available = 0xEEEA; + + if (!(top_type & type_mask)) { + h->topleft_samples_available = 0xB3FF; + h->top_samples_available = 0x33FF; + h->topright_samples_available = 0x26EA; } - if(IS_INTERLACED(mb_type) != IS_INTERLACED(left_type[LTOP])){ - if(IS_INTERLACED(mb_type)){ - if(!(left_type[LTOP] & type_mask)){ - h->topleft_samples_available&= 0xDFFF; - h->left_samples_available&= 0x5FFF; + if (IS_INTERLACED(mb_type) != IS_INTERLACED(left_type[LTOP])) { + if (IS_INTERLACED(mb_type)) { + if (!(left_type[LTOP] & type_mask)) { + h->topleft_samples_available &= 0xDFFF; + h->left_samples_available &= 0x5FFF; } - if(!(left_type[LBOT] & type_mask)){ - h->topleft_samples_available&= 0xFF5F; - h->left_samples_available&= 0xFF5F; + if (!(left_type[LBOT] & type_mask)) { + h->topleft_samples_available &= 0xFF5F; + h->left_samples_available &= 0xFF5F; } - }else{ + } else { int left_typei = s->current_picture.f.mb_type[left_xy[LTOP] + s->mb_stride]; assert(left_xy[LTOP] == left_xy[LBOT]); - if(!((left_typei & type_mask) && (left_type[LTOP] & type_mask))){ - h->topleft_samples_available&= 0xDF5F; - h->left_samples_available&= 0x5F5F; + if (!((left_typei & type_mask) && (left_type[LTOP] & type_mask))) { + h->topleft_samples_available &= 0xDF5F; + h->left_samples_available &= 0x5F5F; } } - }else{ - if(!(left_type[LTOP] & type_mask)){ - h->topleft_samples_available&= 0xDF5F; - h->left_samples_available&= 0x5F5F; + } else { + if (!(left_type[LTOP] & type_mask)) { + h->topleft_samples_available &= 0xDF5F; + h->left_samples_available &= 0x5F5F; } } - if(!(topleft_type & type_mask)) - h->topleft_samples_available&= 0x7FFF; + if (!(topleft_type & type_mask)) + h->topleft_samples_available &= 0x7FFF; - if(!(topright_type & type_mask)) - h->topright_samples_available&= 0xFBFF; + if (!(topright_type & type_mask)) + h->topright_samples_available &= 0xFBFF; - if(IS_INTRA4x4(mb_type)){ - if(IS_INTRA4x4(top_type)){ - AV_COPY32(h->intra4x4_pred_mode_cache+4+8*0, h->intra4x4_pred_mode + h->mb2br_xy[top_xy]); - }else{ - h->intra4x4_pred_mode_cache[4+8*0]= - h->intra4x4_pred_mode_cache[5+8*0]= - h->intra4x4_pred_mode_cache[6+8*0]= - h->intra4x4_pred_mode_cache[7+8*0]= 2 - 3*!(top_type & type_mask); + if (IS_INTRA4x4(mb_type)) { + if (IS_INTRA4x4(top_type)) { + AV_COPY32(h->intra4x4_pred_mode_cache + 4 + 8 * 0, h->intra4x4_pred_mode + h->mb2br_xy[top_xy]); + } else { + h->intra4x4_pred_mode_cache[4 + 8 * 0] = + h->intra4x4_pred_mode_cache[5 + 8 * 0] = + h->intra4x4_pred_mode_cache[6 + 8 * 0] = + h->intra4x4_pred_mode_cache[7 + 8 * 0] = 2 - 3 * !(top_type & type_mask); } - for(i=0; i<2; i++){ - if(IS_INTRA4x4(left_type[LEFT(i)])){ - int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[left_xy[LEFT(i)]]; - h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= mode[6-left_block[0+2*i]]; - h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= mode[6-left_block[1+2*i]]; - }else{ - h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= - h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= 2 - 3*!(left_type[LEFT(i)] & type_mask); + for (i = 0; i < 2; i++) { + if (IS_INTRA4x4(left_type[LEFT(i)])) { + int8_t *mode = h->intra4x4_pred_mode + h->mb2br_xy[left_xy[LEFT(i)]]; + h->intra4x4_pred_mode_cache[3 + 8 * 1 + 2 * 8 * i] = mode[6 - left_block[0 + 2 * i]]; + h->intra4x4_pred_mode_cache[3 + 8 * 2 + 2 * 8 * i] = mode[6 - left_block[1 + 2 * i]]; + } else { + h->intra4x4_pred_mode_cache[3 + 8 * 1 + 2 * 8 * i] = + h->intra4x4_pred_mode_cache[3 + 8 * 2 + 2 * 8 * i] = 2 - 3 * !(left_type[LEFT(i)] & type_mask); } } } } - -/* -0 . T T. T T T T -1 L . .L . . . . -2 L . .L . . . . -3 . T TL . . . . -4 L . .L . . . . -5 L . .. . . . . -*/ -//FIXME constraint_intra_pred & partitioning & nnz (let us hope this is just a typo in the spec) - nnz_cache = h->non_zero_count_cache; - if(top_type){ - nnz = h->non_zero_count[top_xy]; - AV_COPY32(&nnz_cache[4+8* 0], &nnz[4*3]); - if(!s->chroma_y_shift){ - AV_COPY32(&nnz_cache[4+8* 5], &nnz[4* 7]); - AV_COPY32(&nnz_cache[4+8*10], &nnz[4*11]); - }else{ - AV_COPY32(&nnz_cache[4+8* 5], &nnz[4* 5]); - AV_COPY32(&nnz_cache[4+8*10], &nnz[4* 9]); + /* + * 0 . T T. T T T T + * 1 L . .L . . . . + * 2 L . .L . . . . + * 3 . T TL . . . . + * 4 L . .L . . . . + * 5 L . .. . . . . + */ + /* FIXME: constraint_intra_pred & partitioning & nnz + * (let us hope this is just a typo in the spec) */ + nnz_cache = h->non_zero_count_cache; + if (top_type) { + nnz = h->non_zero_count[top_xy]; + AV_COPY32(&nnz_cache[4 + 8 * 0], &nnz[4 * 3]); + if (!s->chroma_y_shift) { + AV_COPY32(&nnz_cache[4 + 8 * 5], &nnz[4 * 7]); + AV_COPY32(&nnz_cache[4 + 8 * 10], &nnz[4 * 11]); + } else { + AV_COPY32(&nnz_cache[4 + 8 * 5], &nnz[4 * 5]); + AV_COPY32(&nnz_cache[4 + 8 * 10], &nnz[4 * 9]); + } + } else { + uint32_t top_empty = CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040; + AV_WN32A(&nnz_cache[4 + 8 * 0], top_empty); + AV_WN32A(&nnz_cache[4 + 8 * 5], top_empty); + AV_WN32A(&nnz_cache[4 + 8 * 10], top_empty); } - }else{ - uint32_t top_empty = CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040; - AV_WN32A(&nnz_cache[4+8* 0], top_empty); - AV_WN32A(&nnz_cache[4+8* 5], top_empty); - AV_WN32A(&nnz_cache[4+8*10], top_empty); - } - for (i=0; i<2; i++) { - if(left_type[LEFT(i)]){ - nnz = h->non_zero_count[left_xy[LEFT(i)]]; - nnz_cache[3+8* 1 + 2*8*i]= nnz[left_block[8+0+2*i]]; - nnz_cache[3+8* 2 + 2*8*i]= nnz[left_block[8+1+2*i]]; - if(CHROMA444){ - nnz_cache[3+8* 6 + 2*8*i]= nnz[left_block[8+0+2*i]+4*4]; - nnz_cache[3+8* 7 + 2*8*i]= nnz[left_block[8+1+2*i]+4*4]; - nnz_cache[3+8*11 + 2*8*i]= nnz[left_block[8+0+2*i]+8*4]; - nnz_cache[3+8*12 + 2*8*i]= nnz[left_block[8+1+2*i]+8*4]; - }else if(CHROMA422) { - nnz_cache[3+8* 6 + 2*8*i]= nnz[left_block[8+0+2*i]-2+4*4]; - nnz_cache[3+8* 7 + 2*8*i]= nnz[left_block[8+1+2*i]-2+4*4]; - nnz_cache[3+8*11 + 2*8*i]= nnz[left_block[8+0+2*i]-2+8*4]; - nnz_cache[3+8*12 + 2*8*i]= nnz[left_block[8+1+2*i]-2+8*4]; - }else{ - nnz_cache[3+8* 6 + 8*i]= nnz[left_block[8+4+2*i]]; - nnz_cache[3+8*11 + 8*i]= nnz[left_block[8+5+2*i]]; + for (i = 0; i < 2; i++) { + if (left_type[LEFT(i)]) { + nnz = h->non_zero_count[left_xy[LEFT(i)]]; + nnz_cache[3 + 8 * 1 + 2 * 8 * i] = nnz[left_block[8 + 0 + 2 * i]]; + nnz_cache[3 + 8 * 2 + 2 * 8 * i] = nnz[left_block[8 + 1 + 2 * i]]; + if (CHROMA444) { + nnz_cache[3 + 8 * 6 + 2 * 8 * i] = nnz[left_block[8 + 0 + 2 * i] + 4 * 4]; + nnz_cache[3 + 8 * 7 + 2 * 8 * i] = nnz[left_block[8 + 1 + 2 * i] + 4 * 4]; + nnz_cache[3 + 8 * 11 + 2 * 8 * i] = nnz[left_block[8 + 0 + 2 * i] + 8 * 4]; + nnz_cache[3 + 8 * 12 + 2 * 8 * i] = nnz[left_block[8 + 1 + 2 * i] + 8 * 4]; + } else if (CHROMA422) { + nnz_cache[3 + 8 * 6 + 2 * 8 * i] = nnz[left_block[8 + 0 + 2 * i] - 2 + 4 * 4]; + nnz_cache[3 + 8 * 7 + 2 * 8 * i] = nnz[left_block[8 + 1 + 2 * i] - 2 + 4 * 4]; + nnz_cache[3 + 8 * 11 + 2 * 8 * i] = nnz[left_block[8 + 0 + 2 * i] - 2 + 8 * 4]; + nnz_cache[3 + 8 * 12 + 2 * 8 * i] = nnz[left_block[8 + 1 + 2 * i] - 2 + 8 * 4]; + } else { + nnz_cache[3 + 8 * 6 + 8 * i] = nnz[left_block[8 + 4 + 2 * i]]; + nnz_cache[3 + 8 * 11 + 8 * i] = nnz[left_block[8 + 5 + 2 * i]]; + } + } else { + nnz_cache[3 + 8 * 1 + 2 * 8 * i] = + nnz_cache[3 + 8 * 2 + 2 * 8 * i] = + nnz_cache[3 + 8 * 6 + 2 * 8 * i] = + nnz_cache[3 + 8 * 7 + 2 * 8 * i] = + nnz_cache[3 + 8 * 11 + 2 * 8 * i] = + nnz_cache[3 + 8 * 12 + 2 * 8 * i] = CABAC && !IS_INTRA(mb_type) ? 0 : 64; } - }else{ - nnz_cache[3+8* 1 + 2*8*i]= - nnz_cache[3+8* 2 + 2*8*i]= - nnz_cache[3+8* 6 + 2*8*i]= - nnz_cache[3+8* 7 + 2*8*i]= - nnz_cache[3+8*11 + 2*8*i]= - nnz_cache[3+8*12 + 2*8*i]= CABAC && !IS_INTRA(mb_type) ? 0 : 64; } - } - if( CABAC ) { - // top_cbp - if(top_type) { - h->top_cbp = h->cbp_table[top_xy]; - } else { - h->top_cbp = IS_INTRA(mb_type) ? 0x7CF : 0x00F; - } - // left_cbp - if (left_type[LTOP]) { - h->left_cbp = (h->cbp_table[left_xy[LTOP]] & 0x7F0) - | ((h->cbp_table[left_xy[LTOP]]>>(left_block[0]&(~1)))&2) - | (((h->cbp_table[left_xy[LBOT]]>>(left_block[2]&(~1)))&2) << 2); - } else { - h->left_cbp = IS_INTRA(mb_type) ? 0x7CF : 0x00F; + if (CABAC) { + // top_cbp + if (top_type) + h->top_cbp = h->cbp_table[top_xy]; + else + h->top_cbp = IS_INTRA(mb_type) ? 0x7CF : 0x00F; + // left_cbp + if (left_type[LTOP]) { + h->left_cbp = (h->cbp_table[left_xy[LTOP]] & 0x7F0) | + ((h->cbp_table[left_xy[LTOP]] >> (left_block[0] & (~1))) & 2) | + (((h->cbp_table[left_xy[LBOT]] >> (left_block[2] & (~1))) & 2) << 2); + } else { + h->left_cbp = IS_INTRA(mb_type) ? 0x7CF : 0x00F; + } } } - } - if(IS_INTER(mb_type) || (IS_DIRECT(mb_type) && h->direct_spatial_mv_pred)){ + if (IS_INTER(mb_type) || (IS_DIRECT(mb_type) && h->direct_spatial_mv_pred)) { int list; int b_stride = h->b_stride; - for(list=0; listlist_count; list++){ + for (list = 0; list < h->list_count; list++) { int8_t *ref_cache = &h->ref_cache[list][scan8[0]]; int8_t *ref = s->current_picture.f.ref_index[list]; - int16_t (*mv_cache)[2] = &h->mv_cache[list][scan8[0]]; - int16_t (*mv)[2] = s->current_picture.f.motion_val[list]; - if(!USES_LIST(mb_type, list)){ + int16_t(*mv_cache)[2] = &h->mv_cache[list][scan8[0]]; + int16_t(*mv)[2] = s->current_picture.f.motion_val[list]; + if (!USES_LIST(mb_type, list)) continue; - } assert(!(IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred)); - if(USES_LIST(top_type, list)){ - const int b_xy= h->mb2b_xy[top_xy] + 3*b_stride; - AV_COPY128(mv_cache[0 - 1*8], mv[b_xy + 0]); - ref_cache[0 - 1*8]= - ref_cache[1 - 1*8]= ref[4*top_xy + 2]; - ref_cache[2 - 1*8]= - ref_cache[3 - 1*8]= ref[4*top_xy + 3]; - }else{ - AV_ZERO128(mv_cache[0 - 1*8]); - AV_WN32A(&ref_cache[0 - 1*8], ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101u); + if (USES_LIST(top_type, list)) { + const int b_xy = h->mb2b_xy[top_xy] + 3 * b_stride; + AV_COPY128(mv_cache[0 - 1 * 8], mv[b_xy + 0]); + ref_cache[0 - 1 * 8] = + ref_cache[1 - 1 * 8] = ref[4 * top_xy + 2]; + ref_cache[2 - 1 * 8] = + ref_cache[3 - 1 * 8] = ref[4 * top_xy + 3]; + } else { + AV_ZERO128(mv_cache[0 - 1 * 8]); + AV_WN32A(&ref_cache[0 - 1 * 8], + ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE) & 0xFF) * 0x01010101u); } - if(mb_type & (MB_TYPE_16x8|MB_TYPE_8x8)){ - for(i=0; i<2; i++){ - int cache_idx = -1 + i*2*8; - if(USES_LIST(left_type[LEFT(i)], list)){ - const int b_xy= h->mb2b_xy[left_xy[LEFT(i)]] + 3; - const int b8_xy= 4*left_xy[LEFT(i)] + 1; - AV_COPY32(mv_cache[cache_idx ], mv[b_xy + b_stride*left_block[0+i*2]]); - AV_COPY32(mv_cache[cache_idx+8], mv[b_xy + b_stride*left_block[1+i*2]]); - ref_cache[cache_idx ]= ref[b8_xy + (left_block[0+i*2]&~1)]; - ref_cache[cache_idx+8]= ref[b8_xy + (left_block[1+i*2]&~1)]; - }else{ - AV_ZERO32(mv_cache[cache_idx ]); - AV_ZERO32(mv_cache[cache_idx+8]); - ref_cache[cache_idx ]= - ref_cache[cache_idx+8]= (left_type[LEFT(i)]) ? LIST_NOT_USED : PART_NOT_AVAILABLE; + if (mb_type & (MB_TYPE_16x8 | MB_TYPE_8x8)) { + for (i = 0; i < 2; i++) { + int cache_idx = -1 + i * 2 * 8; + if (USES_LIST(left_type[LEFT(i)], list)) { + const int b_xy = h->mb2b_xy[left_xy[LEFT(i)]] + 3; + const int b8_xy = 4 * left_xy[LEFT(i)] + 1; + AV_COPY32(mv_cache[cache_idx], + mv[b_xy + b_stride * left_block[0 + i * 2]]); + AV_COPY32(mv_cache[cache_idx + 8], + mv[b_xy + b_stride * left_block[1 + i * 2]]); + ref_cache[cache_idx] = ref[b8_xy + (left_block[0 + i * 2] & ~1)]; + ref_cache[cache_idx + 8] = ref[b8_xy + (left_block[1 + i * 2] & ~1)]; + } else { + AV_ZERO32(mv_cache[cache_idx]); + AV_ZERO32(mv_cache[cache_idx + 8]); + ref_cache[cache_idx] = + ref_cache[cache_idx + 8] = (left_type[LEFT(i)]) ? LIST_NOT_USED + : PART_NOT_AVAILABLE; + } } - } - }else{ - if(USES_LIST(left_type[LTOP], list)){ - const int b_xy= h->mb2b_xy[left_xy[LTOP]] + 3; - const int b8_xy= 4*left_xy[LTOP] + 1; - AV_COPY32(mv_cache[-1], mv[b_xy + b_stride*left_block[0]]); - ref_cache[-1]= ref[b8_xy + (left_block[0]&~1)]; - }else{ + } else { + if (USES_LIST(left_type[LTOP], list)) { + const int b_xy = h->mb2b_xy[left_xy[LTOP]] + 3; + const int b8_xy = 4 * left_xy[LTOP] + 1; + AV_COPY32(mv_cache[-1], mv[b_xy + b_stride * left_block[0]]); + ref_cache[-1] = ref[b8_xy + (left_block[0] & ~1)]; + } else { AV_ZERO32(mv_cache[-1]); - ref_cache[-1]= left_type[LTOP] ? LIST_NOT_USED : PART_NOT_AVAILABLE; + ref_cache[-1] = left_type[LTOP] ? LIST_NOT_USED + : PART_NOT_AVAILABLE; } } - if(USES_LIST(topright_type, list)){ - const int b_xy= h->mb2b_xy[topright_xy] + 3*b_stride; - AV_COPY32(mv_cache[4 - 1*8], mv[b_xy]); - ref_cache[4 - 1*8]= ref[4*topright_xy + 2]; - }else{ - AV_ZERO32(mv_cache[4 - 1*8]); - ref_cache[4 - 1*8]= topright_type ? LIST_NOT_USED : PART_NOT_AVAILABLE; + if (USES_LIST(topright_type, list)) { + const int b_xy = h->mb2b_xy[topright_xy] + 3 * b_stride; + AV_COPY32(mv_cache[4 - 1 * 8], mv[b_xy]); + ref_cache[4 - 1 * 8] = ref[4 * topright_xy + 2]; + } else { + AV_ZERO32(mv_cache[4 - 1 * 8]); + ref_cache[4 - 1 * 8] = topright_type ? LIST_NOT_USED + : PART_NOT_AVAILABLE; } - if(ref_cache[4 - 1*8] < 0){ - if(USES_LIST(topleft_type, list)){ - const int b_xy = h->mb2b_xy[topleft_xy] + 3 + b_stride + (h->topleft_partition & 2*b_stride); - const int b8_xy= 4*topleft_xy + 1 + (h->topleft_partition & 2); - AV_COPY32(mv_cache[-1 - 1*8], mv[b_xy]); - ref_cache[-1 - 1*8]= ref[b8_xy]; - }else{ - AV_ZERO32(mv_cache[-1 - 1*8]); - ref_cache[-1 - 1*8]= topleft_type ? LIST_NOT_USED : PART_NOT_AVAILABLE; + if (ref_cache[4 - 1 * 8] < 0) { + if (USES_LIST(topleft_type, list)) { + const int b_xy = h->mb2b_xy[topleft_xy] + 3 + b_stride + + (h->topleft_partition & 2 * b_stride); + const int b8_xy = 4 * topleft_xy + 1 + (h->topleft_partition & 2); + AV_COPY32(mv_cache[-1 - 1 * 8], mv[b_xy]); + ref_cache[-1 - 1 * 8] = ref[b8_xy]; + } else { + AV_ZERO32(mv_cache[-1 - 1 * 8]); + ref_cache[-1 - 1 * 8] = topleft_type ? LIST_NOT_USED + : PART_NOT_AVAILABLE; } } - if((mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2)) && !FRAME_MBAFF) + if ((mb_type & (MB_TYPE_SKIP | MB_TYPE_DIRECT2)) && !FRAME_MBAFF) continue; - if(!(mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2))){ - uint8_t (*mvd_cache)[2] = &h->mvd_cache[list][scan8[0]]; - uint8_t (*mvd)[2] = h->mvd_table[list]; - ref_cache[2+8*0] = - ref_cache[2+8*2] = PART_NOT_AVAILABLE; - AV_ZERO32(mv_cache[2+8*0]); - AV_ZERO32(mv_cache[2+8*2]); - - if( CABAC ) { - if(USES_LIST(top_type, list)){ - const int b_xy= h->mb2br_xy[top_xy]; - AV_COPY64(mvd_cache[0 - 1*8], mvd[b_xy + 0]); - }else{ - AV_ZERO64(mvd_cache[0 - 1*8]); + if (!(mb_type & (MB_TYPE_SKIP | MB_TYPE_DIRECT2))) { + uint8_t(*mvd_cache)[2] = &h->mvd_cache[list][scan8[0]]; + uint8_t(*mvd)[2] = h->mvd_table[list]; + ref_cache[2 + 8 * 0] = + ref_cache[2 + 8 * 2] = PART_NOT_AVAILABLE; + AV_ZERO32(mv_cache[2 + 8 * 0]); + AV_ZERO32(mv_cache[2 + 8 * 2]); + + if (CABAC) { + if (USES_LIST(top_type, list)) { + const int b_xy = h->mb2br_xy[top_xy]; + AV_COPY64(mvd_cache[0 - 1 * 8], mvd[b_xy + 0]); + } else { + AV_ZERO64(mvd_cache[0 - 1 * 8]); } - if(USES_LIST(left_type[LTOP], list)){ - const int b_xy= h->mb2br_xy[left_xy[LTOP]] + 6; - AV_COPY16(mvd_cache[-1 + 0*8], mvd[b_xy - left_block[0]]); - AV_COPY16(mvd_cache[-1 + 1*8], mvd[b_xy - left_block[1]]); - }else{ - AV_ZERO16(mvd_cache[-1 + 0*8]); - AV_ZERO16(mvd_cache[-1 + 1*8]); + if (USES_LIST(left_type[LTOP], list)) { + const int b_xy = h->mb2br_xy[left_xy[LTOP]] + 6; + AV_COPY16(mvd_cache[-1 + 0 * 8], mvd[b_xy - left_block[0]]); + AV_COPY16(mvd_cache[-1 + 1 * 8], mvd[b_xy - left_block[1]]); + } else { + AV_ZERO16(mvd_cache[-1 + 0 * 8]); + AV_ZERO16(mvd_cache[-1 + 1 * 8]); } - if(USES_LIST(left_type[LBOT], list)){ - const int b_xy= h->mb2br_xy[left_xy[LBOT]] + 6; - AV_COPY16(mvd_cache[-1 + 2*8], mvd[b_xy - left_block[2]]); - AV_COPY16(mvd_cache[-1 + 3*8], mvd[b_xy - left_block[3]]); - }else{ - AV_ZERO16(mvd_cache[-1 + 2*8]); - AV_ZERO16(mvd_cache[-1 + 3*8]); + if (USES_LIST(left_type[LBOT], list)) { + const int b_xy = h->mb2br_xy[left_xy[LBOT]] + 6; + AV_COPY16(mvd_cache[-1 + 2 * 8], mvd[b_xy - left_block[2]]); + AV_COPY16(mvd_cache[-1 + 3 * 8], mvd[b_xy - left_block[3]]); + } else { + AV_ZERO16(mvd_cache[-1 + 2 * 8]); + AV_ZERO16(mvd_cache[-1 + 3 * 8]); } - AV_ZERO16(mvd_cache[2+8*0]); - AV_ZERO16(mvd_cache[2+8*2]); - if(h->slice_type_nos == AV_PICTURE_TYPE_B){ + AV_ZERO16(mvd_cache[2 + 8 * 0]); + AV_ZERO16(mvd_cache[2 + 8 * 2]); + if (h->slice_type_nos == AV_PICTURE_TYPE_B) { uint8_t *direct_cache = &h->direct_cache[scan8[0]]; uint8_t *direct_table = h->direct_table; - fill_rectangle(direct_cache, 4, 4, 8, MB_TYPE_16x16>>1, 1); - - if(IS_DIRECT(top_type)){ - AV_WN32A(&direct_cache[-1*8], 0x01010101u*(MB_TYPE_DIRECT2>>1)); - }else if(IS_8X8(top_type)){ - int b8_xy = 4*top_xy; - direct_cache[0 - 1*8]= direct_table[b8_xy + 2]; - direct_cache[2 - 1*8]= direct_table[b8_xy + 3]; - }else{ - AV_WN32A(&direct_cache[-1*8], 0x01010101*(MB_TYPE_16x16>>1)); + fill_rectangle(direct_cache, 4, 4, 8, MB_TYPE_16x16 >> 1, 1); + + if (IS_DIRECT(top_type)) { + AV_WN32A(&direct_cache[-1 * 8], + 0x01010101u * (MB_TYPE_DIRECT2 >> 1)); + } else if (IS_8X8(top_type)) { + int b8_xy = 4 * top_xy; + direct_cache[0 - 1 * 8] = direct_table[b8_xy + 2]; + direct_cache[2 - 1 * 8] = direct_table[b8_xy + 3]; + } else { + AV_WN32A(&direct_cache[-1 * 8], + 0x01010101 * (MB_TYPE_16x16 >> 1)); } - if(IS_DIRECT(left_type[LTOP])) - direct_cache[-1 + 0*8]= MB_TYPE_DIRECT2>>1; - else if(IS_8X8(left_type[LTOP])) - direct_cache[-1 + 0*8]= direct_table[4*left_xy[LTOP] + 1 + (left_block[0]&~1)]; + if (IS_DIRECT(left_type[LTOP])) + direct_cache[-1 + 0 * 8] = MB_TYPE_DIRECT2 >> 1; + else if (IS_8X8(left_type[LTOP])) + direct_cache[-1 + 0 * 8] = direct_table[4 * left_xy[LTOP] + 1 + (left_block[0] & ~1)]; else - direct_cache[-1 + 0*8]= MB_TYPE_16x16>>1; + direct_cache[-1 + 0 * 8] = MB_TYPE_16x16 >> 1; - if(IS_DIRECT(left_type[LBOT])) - direct_cache[-1 + 2*8]= MB_TYPE_DIRECT2>>1; - else if(IS_8X8(left_type[LBOT])) - direct_cache[-1 + 2*8]= direct_table[4*left_xy[LBOT] + 1 + (left_block[2]&~1)]; + if (IS_DIRECT(left_type[LBOT])) + direct_cache[-1 + 2 * 8] = MB_TYPE_DIRECT2 >> 1; + else if (IS_8X8(left_type[LBOT])) + direct_cache[-1 + 2 * 8] = direct_table[4 * left_xy[LBOT] + 1 + (left_block[2] & ~1)]; else - direct_cache[-1 + 2*8]= MB_TYPE_16x16>>1; + direct_cache[-1 + 2 * 8] = MB_TYPE_16x16 >> 1; } } } - if(FRAME_MBAFF){ -#define MAP_MVS\ - MAP_F2F(scan8[0] - 1 - 1*8, topleft_type)\ - MAP_F2F(scan8[0] + 0 - 1*8, top_type)\ - MAP_F2F(scan8[0] + 1 - 1*8, top_type)\ - MAP_F2F(scan8[0] + 2 - 1*8, top_type)\ - MAP_F2F(scan8[0] + 3 - 1*8, top_type)\ - MAP_F2F(scan8[0] + 4 - 1*8, topright_type)\ - MAP_F2F(scan8[0] - 1 + 0*8, left_type[LTOP])\ - MAP_F2F(scan8[0] - 1 + 1*8, left_type[LTOP])\ - MAP_F2F(scan8[0] - 1 + 2*8, left_type[LBOT])\ - MAP_F2F(scan8[0] - 1 + 3*8, left_type[LBOT]) - if(MB_FIELD){ -#define MAP_F2F(idx, mb_type)\ - if(!IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\ - h->ref_cache[list][idx] <<= 1;\ - h->mv_cache[list][idx][1] /= 2;\ - h->mvd_cache[list][idx][1] >>=1;\ - } + +#define MAP_MVS \ + MAP_F2F(scan8[0] - 1 - 1 * 8, topleft_type) \ + MAP_F2F(scan8[0] + 0 - 1 * 8, top_type) \ + MAP_F2F(scan8[0] + 1 - 1 * 8, top_type) \ + MAP_F2F(scan8[0] + 2 - 1 * 8, top_type) \ + MAP_F2F(scan8[0] + 3 - 1 * 8, top_type) \ + MAP_F2F(scan8[0] + 4 - 1 * 8, topright_type) \ + MAP_F2F(scan8[0] - 1 + 0 * 8, left_type[LTOP]) \ + MAP_F2F(scan8[0] - 1 + 1 * 8, left_type[LTOP]) \ + MAP_F2F(scan8[0] - 1 + 2 * 8, left_type[LBOT]) \ + MAP_F2F(scan8[0] - 1 + 3 * 8, left_type[LBOT]) + + if (FRAME_MBAFF) { + if (MB_FIELD) { + +#define MAP_F2F(idx, mb_type) \ + if (!IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0) { \ + h->ref_cache[list][idx] <<= 1; \ + h->mv_cache[list][idx][1] /= 2; \ + h->mvd_cache[list][idx][1] >>= 1; \ + } + MAP_MVS + } else { + #undef MAP_F2F - }else{ -#define MAP_F2F(idx, mb_type)\ - if(IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\ - h->ref_cache[list][idx] >>= 1;\ - h->mv_cache[list][idx][1] <<= 1;\ - h->mvd_cache[list][idx][1] <<= 1;\ - } +#define MAP_F2F(idx, mb_type) \ + if (IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0) { \ + h->ref_cache[list][idx] >>= 1; \ + h->mv_cache[list][idx][1] <<= 1; \ + h->mvd_cache[list][idx][1] <<= 1; \ + } + MAP_MVS #undef MAP_F2F } @@ -747,36 +792,34 @@ static void fill_decode_caches(H264Context *h, int mb_type){ } } - h->neighbor_transform_size= !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[LTOP]); + h->neighbor_transform_size = !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[LTOP]); } /** * decodes a P_SKIP or B_SKIP macroblock */ -static void av_unused decode_mb_skip(H264Context *h){ - MpegEncContext * const s = &h->s; - const int mb_xy= h->mb_xy; - int mb_type=0; +static void av_unused decode_mb_skip(H264Context *h) +{ + MpegEncContext *const s = &h->s; + const int mb_xy = h->mb_xy; + int mb_type = 0; memset(h->non_zero_count[mb_xy], 0, 48); - if(MB_FIELD) - mb_type|= MB_TYPE_INTERLACED; + if (MB_FIELD) + mb_type |= MB_TYPE_INTERLACED; - if( h->slice_type_nos == AV_PICTURE_TYPE_B ) - { + if (h->slice_type_nos == AV_PICTURE_TYPE_B) { // just for fill_caches. pred_direct_motion will set the real mb_type - mb_type|= MB_TYPE_L0L1|MB_TYPE_DIRECT2|MB_TYPE_SKIP; - if(h->direct_spatial_mv_pred){ + mb_type |= MB_TYPE_L0L1 | MB_TYPE_DIRECT2 | MB_TYPE_SKIP; + if (h->direct_spatial_mv_pred) { fill_decode_neighbors(h, mb_type); - fill_decode_caches(h, mb_type); //FIXME check what is needed and what not ... + fill_decode_caches(h, mb_type); //FIXME check what is needed and what not ... } ff_h264_pred_direct_motion(h, &mb_type); - mb_type|= MB_TYPE_SKIP; - } - else - { - mb_type|= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P1L0|MB_TYPE_SKIP; + mb_type |= MB_TYPE_SKIP; + } else { + mb_type |= MB_TYPE_16x16 | MB_TYPE_P0L0 | MB_TYPE_P1L0 | MB_TYPE_SKIP; fill_decode_neighbors(h, mb_type); pred_pskip_motion(h); @@ -785,8 +828,8 @@ static void av_unused decode_mb_skip(H264Context *h){ write_back_motion(h, mb_type); s->current_picture.f.mb_type[mb_xy] = mb_type; s->current_picture.f.qscale_table[mb_xy] = s->qscale; - h->slice_table[ mb_xy ]= h->slice_num; - h->prev_mb_skipped= 1; + h->slice_table[mb_xy] = h->slice_num; + h->prev_mb_skipped = 1; } #endif /* AVCODEC_H264_MVPRED_H */ diff --git a/libavcodec/h264dsp.h b/libavcodec/h264dsp.h index 08a25a5..248c7d0 100644 --- a/libavcodec/h264dsp.h +++ b/libavcodec/h264dsp.h @@ -28,56 +28,90 @@ #define AVCODEC_H264DSP_H #include + #include "dsputil.h" typedef void (*h264_weight_func)(uint8_t *block, int stride, int height, int log2_denom, int weight, int offset); -typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src, int stride, int height, - int log2_denom, int weightd, int weights, int offset); +typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src, + int stride, int height, int log2_denom, + int weightd, int weights, int offset); /** * Context for storing H.264 DSP functions */ -typedef struct H264DSPContext{ +typedef struct H264DSPContext { /* weighted MC */ h264_weight_func weight_h264_pixels_tab[4]; h264_biweight_func biweight_h264_pixels_tab[4]; /* loop filter */ - void (*h264_v_loop_filter_luma)(uint8_t *pix/*align 16*/, int stride, int alpha, int beta, int8_t *tc0); - void (*h264_h_loop_filter_luma)(uint8_t *pix/*align 4 */, int stride, int alpha, int beta, int8_t *tc0); - void (*h264_h_loop_filter_luma_mbaff)(uint8_t *pix/*align 16*/, int stride, int alpha, int beta, int8_t *tc0); + void (*h264_v_loop_filter_luma)(uint8_t *pix /*align 16*/, int stride, + int alpha, int beta, int8_t *tc0); + void (*h264_h_loop_filter_luma)(uint8_t *pix /*align 4 */, int stride, + int alpha, int beta, int8_t *tc0); + void (*h264_h_loop_filter_luma_mbaff)(uint8_t *pix /*align 16*/, int stride, + int alpha, int beta, int8_t *tc0); /* v/h_loop_filter_luma_intra: align 16 */ - void (*h264_v_loop_filter_luma_intra)(uint8_t *pix, int stride, int alpha, int beta); - void (*h264_h_loop_filter_luma_intra)(uint8_t *pix, int stride, int alpha, int beta); - void (*h264_h_loop_filter_luma_mbaff_intra)(uint8_t *pix/*align 16*/, int stride, int alpha, int beta); - void (*h264_v_loop_filter_chroma)(uint8_t *pix/*align 8*/, int stride, int alpha, int beta, int8_t *tc0); - void (*h264_h_loop_filter_chroma)(uint8_t *pix/*align 4*/, int stride, int alpha, int beta, int8_t *tc0); - void (*h264_h_loop_filter_chroma_mbaff)(uint8_t *pix/*align 8*/, int stride, int alpha, int beta, int8_t *tc0); - void (*h264_v_loop_filter_chroma_intra)(uint8_t *pix/*align 8*/, int stride, int alpha, int beta); - void (*h264_h_loop_filter_chroma_intra)(uint8_t *pix/*align 8*/, int stride, int alpha, int beta); - void (*h264_h_loop_filter_chroma_mbaff_intra)(uint8_t *pix/*align 8*/, int stride, int alpha, int beta); + void (*h264_v_loop_filter_luma_intra)(uint8_t *pix, int stride, + int alpha, int beta); + void (*h264_h_loop_filter_luma_intra)(uint8_t *pix, int stride, + int alpha, int beta); + void (*h264_h_loop_filter_luma_mbaff_intra)(uint8_t *pix /*align 16*/, + int stride, int alpha, int beta); + void (*h264_v_loop_filter_chroma)(uint8_t *pix /*align 8*/, int stride, + int alpha, int beta, int8_t *tc0); + void (*h264_h_loop_filter_chroma)(uint8_t *pix /*align 4*/, int stride, + int alpha, int beta, int8_t *tc0); + void (*h264_h_loop_filter_chroma_mbaff)(uint8_t *pix /*align 8*/, + int stride, int alpha, int beta, + int8_t *tc0); + void (*h264_v_loop_filter_chroma_intra)(uint8_t *pix /*align 8*/, + int stride, int alpha, int beta); + void (*h264_h_loop_filter_chroma_intra)(uint8_t *pix /*align 8*/, + int stride, int alpha, int beta); + void (*h264_h_loop_filter_chroma_mbaff_intra)(uint8_t *pix /*align 8*/, + int stride, int alpha, int beta); // h264_loop_filter_strength: simd only. the C version is inlined in h264.c - void (*h264_loop_filter_strength)(int16_t bS[2][4][4], uint8_t nnz[40], int8_t ref[2][40], int16_t mv[2][40][2], - int bidir, int edges, int step, int mask_mv0, int mask_mv1, int field); + void (*h264_loop_filter_strength)(int16_t bS[2][4][4], uint8_t nnz[40], + int8_t ref[2][40], int16_t mv[2][40][2], + int bidir, int edges, int step, + int mask_mv0, int mask_mv1, int field); /* IDCT */ - void (*h264_idct_add)(uint8_t *dst/*align 4*/, DCTELEM *block/*align 16*/, int stride); - void (*h264_idct8_add)(uint8_t *dst/*align 8*/, DCTELEM *block/*align 16*/, int stride); - void (*h264_idct_dc_add)(uint8_t *dst/*align 4*/, DCTELEM *block/*align 16*/, int stride); - void (*h264_idct8_dc_add)(uint8_t *dst/*align 8*/, DCTELEM *block/*align 16*/, int stride); + void (*h264_idct_add)(uint8_t *dst /*align 4*/, + DCTELEM *block /*align 16*/, int stride); + void (*h264_idct8_add)(uint8_t *dst /*align 8*/, + DCTELEM *block /*align 16*/, int stride); + void (*h264_idct_dc_add)(uint8_t *dst /*align 4*/, + DCTELEM *block /*align 16*/, int stride); + void (*h264_idct8_dc_add)(uint8_t *dst /*align 8*/, + DCTELEM *block /*align 16*/, int stride); - void (*h264_idct_add16)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[15*8]); - void (*h264_idct8_add4)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[15*8]); - void (*h264_idct_add8)(uint8_t **dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[15*8]); - void (*h264_idct_add16intra)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[15*8]); - void (*h264_luma_dc_dequant_idct)(DCTELEM *output, DCTELEM *input/*align 16*/, int qmul); + void (*h264_idct_add16)(uint8_t *dst /*align 16*/, const int *blockoffset, + DCTELEM *block /*align 16*/, int stride, + const uint8_t nnzc[15 * 8]); + void (*h264_idct8_add4)(uint8_t *dst /*align 16*/, const int *blockoffset, + DCTELEM *block /*align 16*/, int stride, + const uint8_t nnzc[15 * 8]); + void (*h264_idct_add8)(uint8_t **dst /*align 16*/, const int *blockoffset, + DCTELEM *block /*align 16*/, int stride, + const uint8_t nnzc[15 * 8]); + void (*h264_idct_add16intra)(uint8_t *dst /*align 16*/, const int *blockoffset, + DCTELEM *block /*align 16*/, + int stride, const uint8_t nnzc[15 * 8]); + void (*h264_luma_dc_dequant_idct)(DCTELEM *output, + DCTELEM *input /*align 16*/, int qmul); void (*h264_chroma_dc_dequant_idct)(DCTELEM *block, int qmul); -}H264DSPContext; +} H264DSPContext; -void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, const int chroma_format_idc); -void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth, const int chroma_format_idc); -void ff_h264dsp_init_ppc(H264DSPContext *c, const int bit_depth, const int chroma_format_idc); -void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth, const int chroma_format_idc); +void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, + const int chroma_format_idc); +void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth, + const int chroma_format_idc); +void ff_h264dsp_init_ppc(H264DSPContext *c, const int bit_depth, + const int chroma_format_idc); +void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth, + const int chroma_format_idc); #endif /* AVCODEC_H264DSP_H */ -- 1.7.1 From diego at biurrun.de Mon May 7 14:15:46 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 14:15:46 +0200 Subject: [libav-devel] [PATCH 1/2] h264: Remove a commented-out function pointer declaration. In-Reply-To: References: <1336391860-18930-1-git-send-email-diego@biurrun.de> Message-ID: <20120507121546.GK15241@pool.informatik.rwth-aachen.de> On Mon, May 07, 2012 at 01:12:23PM +0100, M?ns Rullg?rd wrote: > Diego Biurrun writes: > > > > --- a/libavcodec/h264dsp.h > > +++ b/libavcodec/h264dsp.h > > @@ -30,7 +30,6 @@ > > > > -//typedef void (*h264_chroma_mc_func)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x, int y); > > typedef void (*h264_weight_func)(uint8_t *block, int stride, int height, > > int log2_denom, int weight, int offset); > > typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src, int stride, int height, > > -- > > It's a function pointer typedef, but OK. Will push with amended log message later today. Diego From vitor1001 at gmail.com Mon May 7 14:18:15 2012 From: vitor1001 at gmail.com (Vitor Sessak) Date: Mon, 07 May 2012 14:18:15 +0200 Subject: [libav-devel] [PATCH] lavr: replace the SSE version of ff_conv_fltp_to_flt_6ch() with AVX In-Reply-To: <1336073961-20905-1-git-send-email-justin.ruggles@gmail.com> References: <1336073961-20905-1-git-send-email-justin.ruggles@gmail.com> Message-ID: <4FA7BD87.1050709@gmail.com> On 05/03/2012 09:39 PM, Justin Ruggles wrote: > The SSE version is slower than the MMX version on Athlon64 and Sandy Bridge, > but the 3-arg AVX version is faster on Sandy Bridge. > --- > Athlon64 > C - 26322 > MMX - 7997 > SSE - 8662 > > Sandy Bridge > C - 13011 > MMX - 4262 > SSE - 4680 > AVX - 3960 > > Note that although the new code is simpler, using it as SSE is not any > faster than the existing SSE version. The AVX version is only faster > because of the 3-arg ops in SBUTTERFLYPS2. > > libavresample/x86/audio_convert.asm | 40 ++++++++++++++++---------------- > libavresample/x86/audio_convert_init.c | 6 ++-- > libavutil/x86/x86util.asm | 6 ++++ > 3 files changed, 29 insertions(+), 23 deletions(-) > > diff --git a/libavresample/x86/audio_convert.asm b/libavresample/x86/audio_convert.asm > index 809c5d1..c9ba2b0 100644 > --- a/libavresample/x86/audio_convert.asm > +++ b/libavresample/x86/audio_convert.asm > @@ -55,25 +55,23 @@ cglobal conv_fltp_to_flt_6ch, 2,8,7, dst, src, src1, src2, src3, src4, src5, len > mova m4, [srcq+src4q] > mova m5, [srcq+src5q] > %if cpuflag(sse) > - SBUTTERFLYPS 0, 1, 6 > - SBUTTERFLYPS 2, 3, 6 > - SBUTTERFLYPS 4, 5, 6 > - > - movaps m6, m4 > - shufps m4, m0, q3210 > - movlhps m0, m2 > - movhlps m6, m2 > - movaps [dstq ], m0 > - movaps [dstq+16], m4 > - movaps [dstq+32], m6 > - > - movaps m6, m5 > - shufps m5, m1, q3210 > - movlhps m1, m3 > - movhlps m6, m3 > - movaps [dstq+48], m1 > - movaps [dstq+64], m5 > - movaps [dstq+80], m6 > + SBUTTERFLYPS2 0, 1, 6 > + SBUTTERFLYPS2 2, 3, 6 > + SBUTTERFLYPS2 4, 5, 6 > + movhlps m6, m0 > + unpcklpd m0, m2 > + unpckhpd m2, m4 > + unpcklpd m4, m6 > + movhlps m6, m1 > + unpcklpd m1, m3 > + unpckhpd m3, m5 > + unpcklpd m5, m6 > + movaps [dstq ], m0 > + movaps [dstq+1*mmsize], m4 > + movaps [dstq+2*mmsize], m2 > + movaps [dstq+3*mmsize], m1 > + movaps [dstq+4*mmsize], m5 > + movaps [dstq+5*mmsize], m3 Does replacing 6 shuffles by 8 makes it faster? movhlps/movlhps have also 3-op versions... -Vitor From anton at khirnov.net Mon May 7 14:22:12 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 7 May 2012 14:22:12 +0200 Subject: [libav-devel] [PATCH] lavc: pad last audio frame with silence when needed. Message-ID: <1336393332-14427-1-git-send-email-anton@khirnov.net> --- avconv.c | 8 ------ doc/APIchanges | 5 ++++ libavcodec/avcodec.h | 10 +++----- libavcodec/internal.h | 6 +++++ libavcodec/utils.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ libavcodec/version.h | 2 +- 6 files changed, 83 insertions(+), 16 deletions(-) diff --git a/avconv.c b/avconv.c index 73f3bc3..6f7774e 100644 --- a/avconv.c +++ b/avconv.c @@ -2004,14 +2004,6 @@ static void flush_encoders(void) av_fifo_generic_read(ost->fifo, audio_buf, fifo_bytes, NULL); - /* pad last frame with silence if needed */ - if (!(enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME)) { - frame_bytes = enc->frame_size * enc->channels * - av_get_bytes_per_sample(enc->sample_fmt); - if (allocated_audio_buf_size < frame_bytes) - exit_program(1); - generate_silence(audio_buf+fifo_bytes, enc->sample_fmt, frame_bytes - fifo_bytes); - } encode_audio_frame(os, ost, audio_buf, frame_bytes); } else { /* flush encoder with NULL frames until it is done diff --git a/doc/APIchanges b/doc/APIchanges index 66a0786..5027871 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,11 @@ libavutil: 2011-04-18 API changes, most recent first: +2012-xx-xx - xxxxxxx - lavc 54.13.1 + For audio formats with fixed frame size, the last frame + no longer needs to be padded with silence, libavcodec + will handle this internally. + 2012-xx-xx - xxxxxxx - lavc 54.13.0 - avcodec.h Add sample_rate and channel_layout fields to AVFrame. diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index bec13e7..102df3a 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3860,15 +3860,11 @@ int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx, * @param[in] frame AVFrame containing the raw audio data to be encoded. * May be NULL when flushing an encoder that has the * CODEC_CAP_DELAY capability set. - * There are 2 codec capabilities that affect the allowed - * values of frame->nb_samples. - * If CODEC_CAP_SMALL_LAST_FRAME is set, then only the final - * frame may be smaller than avctx->frame_size, and all other - * frames must be equal to avctx->frame_size. * If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame * can have any number of samples. - * If neither is set, frame->nb_samples must be equal to - * avctx->frame_size for all frames. + * If it is not set, frame->nb_samples must be equal to + * avctx->frame_size for all frames except the last. + * The final frame may be smaller than avctx->frame_size. * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the * output packet is non-empty, and to 0 if it is * empty. If the function returns an error, the diff --git a/libavcodec/internal.h b/libavcodec/internal.h index bedb2ed..57d551d 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -70,6 +70,12 @@ typedef struct AVCodecInternal { */ int sample_count; #endif + + /** + * An audio frame with less than required samples has been submitted and + * padded with silence. Reject all subsequent frames. + */ + int last_audio_frame; } AVCodecInternal; struct AVCodecDefault { diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 2e8a86c..a9747e5 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -857,11 +857,61 @@ int ff_alloc_packet(AVPacket *avpkt, int size) } } +static int pad_last_frame(AVCodecContext *s, AVFrame **dst, const AVFrame *src) +{ + AVFrame *frame; + int planar = av_sample_fmt_is_planar(s->sample_fmt); + int planes = planar ? s->channels : 1; + int fill_char = (s->sample_fmt == AV_SAMPLE_FMT_U8 || + s->sample_fmt == AV_SAMPLE_FMT_U8P) ? 0x80 : 0x00; + int data_size = src->nb_samples * av_get_bytes_per_sample(s->sample_fmt) * + (planar ? 1 : s->channels); + int ret, i; + + frame = avcodec_alloc_frame(); + if (!frame) + return AVERROR(ENOMEM); + *frame = *src; + + if (planes > AV_NUM_DATA_POINTERS) { + frame->extended_data = av_mallocz(planes * sizeof(*frame->extended_data)); + if (!frame->extended_data) { + ret = AVERROR(ENOMEM); + goto fail; + } + } else + frame->extended_data = frame->data; + + ret = av_samples_alloc(frame->extended_data, &frame->linesize[0], s->channels, + s->frame_size, s->sample_fmt, 0); + if (ret < 0) + goto fail; + + for (i = 0; i < planes; i++) { + memcpy(frame->extended_data[i], src->extended_data[i], + data_size); + memset(frame->extended_data[i] + data_size, fill_char, + frame->linesize[0] - data_size); + } + + frame->nb_samples = s->frame_size; + *dst = frame; + + return 0; + +fail: + if (frame->extended_data != frame->data) + av_freep(&frame->extended_data); + av_freep(&frame); + return ret; +} + int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { + AVFrame *tmp_frame = NULL; int ret; int user_packet = !!avpkt->data; int nb_samples; @@ -882,6 +932,17 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, if (nb_samples > avctx->frame_size) return AVERROR(EINVAL); } else if (!(avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) { + if (nb_samples < avctx->frame_size && + !avctx->internal->last_audio_frame) { + ret = pad_last_frame(avctx, &tmp_frame, frame); + if (ret < 0) + return AVERROR(EINVAL); + + frame = tmp_frame; + nb_samples = frame->nb_samples; + avctx->internal->last_audio_frame = 1; + } + if (nb_samples != avctx->frame_size) return AVERROR(EINVAL); } @@ -983,6 +1044,13 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, here to simplify things */ avpkt->flags |= AV_PKT_FLAG_KEY; + if (tmp_frame) { + av_freep(&tmp_frame->data[0]); + if (tmp_frame->extended_data != tmp_frame->data) + av_freep(&tmp_frame->extended_data); + av_freep(&tmp_frame); + } + return ret; } diff --git a/libavcodec/version.h b/libavcodec/version.h index be39f4f..da7796a 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #define LIBAVCODEC_VERSION_MAJOR 54 #define LIBAVCODEC_VERSION_MINOR 13 -#define LIBAVCODEC_VERSION_MICRO 0 +#define LIBAVCODEC_VERSION_MICRO 1 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ -- 1.7.9.5 From ubitux at gmail.com Mon May 7 14:32:05 2012 From: ubitux at gmail.com (=?utf-8?B?Q2zDqW1lbnQgQsWTc2No?=) Date: Mon, 7 May 2012 14:32:05 +0200 Subject: [libav-devel] [PATCH 1/2] h264: K&R formatting cosmetics for header files (part I/II) In-Reply-To: <1336392874-29247-1-git-send-email-diego@biurrun.de> References: <1336392874-29247-1-git-send-email-diego@biurrun.de> Message-ID: <20120507123205.GP2784@leki> On Mon, May 07, 2012 at 02:14:33PM +0200, Diego Biurrun wrote: > --- > libavcodec/h264.h | 499 +++++++++++++++++++++++++----------------------- > libavcodec/h264data.h | 369 ++++++++++++++++++------------------ > libavcodec/h264pred.h | 81 +++++---- > 3 files changed, 491 insertions(+), 458 deletions(-) > [...] > void ff_h264_reset_sei(H264Context *h); > > - > /* > -o-o o-o > - / / / > -o-o o-o > - ,---' > -o-o o-o > - / / / > -o-o o-o > -*/ > + * o-o o-o > + * / / / > + * o-o o-o > + * ,---' > + * o-o o-o > + * / / / > + * o-o o-o > + */ > I think you broke the diagram here. [...] -- Cl?ment B. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 490 bytes Desc: not available URL: From anton at khirnov.net Mon May 7 14:33:05 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 07 May 2012 14:33:05 +0200 Subject: [libav-devel] [PATCH] lavc: pad last audio frame with silence when needed. In-Reply-To: <1336393332-14427-1-git-send-email-anton@khirnov.net> References: <1336393332-14427-1-git-send-email-anton@khirnov.net> Message-ID: <20120507123305.4214.98841@daenerys.khirnov.net> On Mon, 7 May 2012 14:22:12 +0200, Anton Khirnov wrote: > @@ -882,6 +932,17 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, > if (nb_samples > avctx->frame_size) > return AVERROR(EINVAL); > } else if (!(avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) { > + if (nb_samples < avctx->frame_size && > + !avctx->internal->last_audio_frame) { > + ret = pad_last_frame(avctx, &tmp_frame, frame); > + if (ret < 0) > + return AVERROR(EINVAL); Oops, noticed this after sending. Fixed locally. -- Anton Khirnov From diego at biurrun.de Mon May 7 14:38:51 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 14:38:51 +0200 Subject: [libav-devel] [PATCH 1/2] h264: K&R formatting cosmetics for header files (part I/II) In-Reply-To: <20120507123205.GP2784@leki> References: <1336392874-29247-1-git-send-email-diego@biurrun.de> <20120507123205.GP2784@leki> Message-ID: <20120507123851.GL15241@pool.informatik.rwth-aachen.de> On Mon, May 07, 2012 at 02:32:05PM +0200, Cl?ment B?sch wrote: > On Mon, May 07, 2012 at 02:14:33PM +0200, Diego Biurrun wrote: > > --- > > libavcodec/h264.h | 499 +++++++++++++++++++++++++----------------------- > [...] > > void ff_h264_reset_sei(H264Context *h); > > > > - > > /* > > -o-o o-o > > - / / / > > -o-o o-o > > - ,---' > > -o-o o-o > > - / / / > > -o-o o-o > > -*/ > > + * o-o o-o > > + * / / / > > + * o-o o-o > > + * ,---' > > + * o-o o-o > > + * / / / > > + * o-o o-o > > + */ > > I think you broke the diagram here. Thanks, fixed locally. Diego From kostya.shishkov at gmail.com Mon May 7 14:43:14 2012 From: kostya.shishkov at gmail.com (Kostya Shishkov) Date: Mon, 7 May 2012 14:43:14 +0200 Subject: [libav-devel] [PATCH 1/2] h264: K&R formatting cosmetics for header files (part I/II) In-Reply-To: <1336392874-29247-1-git-send-email-diego@biurrun.de> References: <1336392874-29247-1-git-send-email-diego@biurrun.de> Message-ID: <20120507124314.GA30184@kst-acer> On Mon, May 07, 2012 at 02:14:33PM +0200, Diego Biurrun wrote: > --- > libavcodec/h264.h | 499 +++++++++++++++++++++++++----------------------- > libavcodec/h264data.h | 369 ++++++++++++++++++------------------ > libavcodec/h264pred.h | 81 +++++---- > 3 files changed, 491 insertions(+), 458 deletions(-) > [...] > @@ -694,16 +699,15 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint > */ > void ff_h264_reset_sei(H264Context *h); > > - > /* > -o-o o-o > - / / / > -o-o o-o > - ,---' > -o-o o-o > - / / / > -o-o o-o > -*/ > + * o-o o-o > + * / / / > + * o-o o-o > + * ,---' > + * o-o o-o > + * / / / > + * o-o o-o > + */ one guy on IRC asked to tell you this scheme is slightly broken now From justin.ruggles at gmail.com Mon May 7 15:51:48 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Mon, 07 May 2012 09:51:48 -0400 Subject: [libav-devel] [PATCH] lavc: pad last audio frame with silence when needed. In-Reply-To: <1336393332-14427-1-git-send-email-anton@khirnov.net> References: <1336393332-14427-1-git-send-email-anton@khirnov.net> Message-ID: <4FA7D374.7000506@gmail.com> On 05/07/2012 08:22 AM, Anton Khirnov wrote: > --- > avconv.c | 8 ------ > doc/APIchanges | 5 ++++ > libavcodec/avcodec.h | 10 +++----- > libavcodec/internal.h | 6 +++++ > libavcodec/utils.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ > libavcodec/version.h | 2 +- > 6 files changed, 83 insertions(+), 16 deletions(-) [...] > diff --git a/libavcodec/utils.c b/libavcodec/utils.c > index 2e8a86c..a9747e5 100644 > --- a/libavcodec/utils.c > +++ b/libavcodec/utils.c > @@ -857,11 +857,61 @@ int ff_alloc_packet(AVPacket *avpkt, int size) > } > } > > +static int pad_last_frame(AVCodecContext *s, AVFrame **dst, const AVFrame *src) > +{ > + AVFrame *frame; > + int planar = av_sample_fmt_is_planar(s->sample_fmt); > + int planes = planar ? s->channels : 1; > + int fill_char = (s->sample_fmt == AV_SAMPLE_FMT_U8 || > + s->sample_fmt == AV_SAMPLE_FMT_U8P) ? 0x80 : 0x00; > + int data_size = src->nb_samples * av_get_bytes_per_sample(s->sample_fmt) * > + (planar ? 1 : s->channels); > + int ret, i; > + > + frame = avcodec_alloc_frame(); > + if (!frame) > + return AVERROR(ENOMEM); > + *frame = *src; > + > + if (planes > AV_NUM_DATA_POINTERS) { > + frame->extended_data = av_mallocz(planes * sizeof(*frame->extended_data)); > + if (!frame->extended_data) { > + ret = AVERROR(ENOMEM); > + goto fail; > + } > + } else > + frame->extended_data = frame->data; > + > + ret = av_samples_alloc(frame->extended_data, &frame->linesize[0], s->channels, > + s->frame_size, s->sample_fmt, 0); > + if (ret < 0) > + goto fail; The simpler way to do this with AVFrame is: int new_size = av_samples_get_buffer_size(...); uint8_t *new_buf = av_malloc(buf); avcodec_fill_audio_frame(..., new_buf, new_buf_size); > + > + for (i = 0; i < planes; i++) { > + memcpy(frame->extended_data[i], src->extended_data[i], > + data_size); > + memset(frame->extended_data[i] + data_size, fill_char, > + frame->linesize[0] - data_size); > + } It might be useful to have a function in libavutil for zeroing audio samples in a packed or planar buffer at a given sample offset. Thanks, Justin From anton at khirnov.net Mon May 7 16:11:49 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 7 May 2012 16:11:49 +0200 Subject: [libav-devel] [PATCH] flvenc: use AVFormatContext, not AVCodecContext for logging. Message-ID: <1336399909-3874-1-git-send-email-anton@khirnov.net> Encoder tag being used for muxer messages is confusing. --- libavformat/flvenc.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 42ecde1..19169ad 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -64,18 +64,19 @@ typedef struct FLVStreamContext { int64_t last_ts; ///< last timestamp for each stream } FLVStreamContext; -static int get_audio_flags(AVCodecContext *enc){ +static int get_audio_flags(AVFormatContext *s, AVCodecContext *enc) +{ int flags = (enc->bits_per_coded_sample == 16) ? FLV_SAMPLESSIZE_16BIT : FLV_SAMPLESSIZE_8BIT; if (enc->codec_id == CODEC_ID_AAC) // specs force these parameters return FLV_CODECID_AAC | FLV_SAMPLERATE_44100HZ | FLV_SAMPLESSIZE_16BIT | FLV_STEREO; else if (enc->codec_id == CODEC_ID_SPEEX) { if (enc->sample_rate != 16000) { - av_log(enc, AV_LOG_ERROR, "flv only supports wideband (16kHz) Speex audio\n"); + av_log(s, AV_LOG_ERROR, "flv only supports wideband (16kHz) Speex audio\n"); return -1; } if (enc->channels != 1) { - av_log(enc, AV_LOG_ERROR, "flv only supports mono Speex audio\n"); + av_log(s, AV_LOG_ERROR, "flv only supports mono Speex audio\n"); return -1; } return FLV_CODECID_SPEEX | FLV_SAMPLERATE_11025HZ | FLV_SAMPLESSIZE_16BIT; @@ -98,7 +99,7 @@ static int get_audio_flags(AVCodecContext *enc){ break; } default: - av_log(enc, AV_LOG_ERROR, "flv does not support that sample rate, choose from (44100, 22050, 11025).\n"); + av_log(s, AV_LOG_ERROR, "flv does not support that sample rate, choose from (44100, 22050, 11025).\n"); return -1; } } @@ -136,7 +137,7 @@ static int get_audio_flags(AVCodecContext *enc){ flags |= enc->codec_tag<<4; break; default: - av_log(enc, AV_LOG_ERROR, "codec not compatible with flv\n"); + av_log(s, AV_LOG_ERROR, "codec not compatible with flv\n"); return -1; } @@ -194,12 +195,12 @@ static int flv_write_header(AVFormatContext *s) } video_enc = enc; if(enc->codec_tag == 0) { - av_log(enc, AV_LOG_ERROR, "video codec not compatible with flv\n"); + av_log(s, AV_LOG_ERROR, "video codec not compatible with flv\n"); return -1; } } else { audio_enc = enc; - if(get_audio_flags(enc)<0) + if (get_audio_flags(s, enc) < 0) return -1; } avpriv_set_pts_info(s->streams[i], 32, 1, 1000); /* 32 bit pts in ms */ @@ -324,7 +325,7 @@ static int flv_write_header(AVFormatContext *s) avio_wb24(pb, 0); // streamid pos = avio_tell(pb); if (enc->codec_id == CODEC_ID_AAC) { - avio_w8(pb, get_audio_flags(enc)); + avio_w8(pb, get_audio_flags(s, enc)); avio_w8(pb, 0); // AAC sequence header avio_write(pb, enc->extradata, enc->extradata_size); } else { @@ -400,14 +401,14 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) flags = enc->codec_tag; if(flags == 0) { - av_log(enc, AV_LOG_ERROR, "video codec %X not compatible with flv\n",enc->codec_id); + av_log(s, AV_LOG_ERROR, "video codec %X not compatible with flv\n",enc->codec_id); return -1; } flags |= pkt->flags & AV_PKT_FLAG_KEY ? FLV_FRAME_KEY : FLV_FRAME_INTER; } else { assert(enc->codec_type == AVMEDIA_TYPE_AUDIO); - flags = get_audio_flags(enc); + flags = get_audio_flags(s, enc); assert(size); -- 1.7.9.5 From andrey.krieger.utkin at gmail.com Mon May 7 16:20:34 2012 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Mon, 7 May 2012 17:20:34 +0300 Subject: [libav-devel] [RFC] lockmgr callback inclusion into libs sources Message-ID: I'd like to offer inclusion of suitable lockmgr callback functions into libraries code. (To make it clear for non-familiar people: i mean the function we register with lavc av_lockmgr_register() when we work multithreadingly with {de,en}coders. Currently every app maker who needs it must copy&paste it from web, while there seem not to be much deviations in implementation of this routine for different case. E.g. for pthreads-enabled compilations, it should be what is at bottom of the letter. We can include such standard implementations for major platforms (posix, winapi), and embrace it with ifdefs. So app makers can just av_lockmgr_register() it with functions which are already there in libs. Comments, and help on patch forming are appreciated. int lockmgr(void **mutex, enum AVLockOp op) { int r; switch (op) { case AV_LOCK_CREATE: { pthread_mutex_t *mtx_ptr; mtx_ptr = calloc(1, sizeof(*mtx_ptr)); if (!mtx_ptr) { av_log(NULL, AV_LOG_ERROR, "mutex alloc fail\n"); return 1; } r = pthread_mutex_init(mtx_ptr, NULL); if (r) { av_log(NULL, AV_LOG_ERROR, "mutex create fail\n"); free(mtx_ptr); return 1; } *mutex = mtx_ptr; return 0; } case AV_LOCK_DESTROY: pthread_mutex_destroy(*mutex); free(*mutex); return 0; case AV_LOCK_OBTAIN: return pthread_mutex_lock(*mutex); case AV_LOCK_RELEASE: return pthread_mutex_unlock(*mutex); } return 1; } -- Andrey Utkin From justin.ruggles at gmail.com Mon May 7 16:23:04 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Mon, 07 May 2012 10:23:04 -0400 Subject: [libav-devel] [PATCH] flvenc: use AVFormatContext, not AVCodecContext for logging. In-Reply-To: <1336399909-3874-1-git-send-email-anton@khirnov.net> References: <1336399909-3874-1-git-send-email-anton@khirnov.net> Message-ID: <4FA7DAC8.4010707@gmail.com> On 05/07/2012 10:11 AM, Anton Khirnov wrote: > Encoder tag being used for muxer messages is confusing. > --- > libavformat/flvenc.c | 21 +++++++++++---------- > 1 file changed, 11 insertions(+), 10 deletions(-) LGTM. -Justin From justin.ruggles at gmail.com Mon May 7 16:29:41 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Mon, 07 May 2012 10:29:41 -0400 Subject: [libav-devel] [PATCH] lavr: replace the SSE version of ff_conv_fltp_to_flt_6ch() with AVX In-Reply-To: <4FA7BD87.1050709@gmail.com> References: <1336073961-20905-1-git-send-email-justin.ruggles@gmail.com> <4FA7BD87.1050709@gmail.com> Message-ID: <4FA7DC55.70909@gmail.com> On 05/07/2012 08:18 AM, Vitor Sessak wrote: > On 05/03/2012 09:39 PM, Justin Ruggles wrote: >> The SSE version is slower than the MMX version on Athlon64 and Sandy >> Bridge, >> but the 3-arg AVX version is faster on Sandy Bridge. >> --- >> Athlon64 >> C - 26322 >> MMX - 7997 >> SSE - 8662 >> >> Sandy Bridge >> C - 13011 >> MMX - 4262 >> SSE - 4680 >> AVX - 3960 >> >> Note that although the new code is simpler, using it as SSE is not any >> faster than the existing SSE version. The AVX version is only faster >> because of the 3-arg ops in SBUTTERFLYPS2. >> >> libavresample/x86/audio_convert.asm | 40 >> ++++++++++++++++---------------- >> libavresample/x86/audio_convert_init.c | 6 ++-- >> libavutil/x86/x86util.asm | 6 ++++ >> 3 files changed, 29 insertions(+), 23 deletions(-) >> >> diff --git a/libavresample/x86/audio_convert.asm >> b/libavresample/x86/audio_convert.asm >> index 809c5d1..c9ba2b0 100644 >> --- a/libavresample/x86/audio_convert.asm >> +++ b/libavresample/x86/audio_convert.asm >> @@ -55,25 +55,23 @@ cglobal conv_fltp_to_flt_6ch, 2,8,7, dst, src, >> src1, src2, src3, src4, src5, len >> mova m4, [srcq+src4q] >> mova m5, [srcq+src5q] >> %if cpuflag(sse) >> - SBUTTERFLYPS 0, 1, 6 >> - SBUTTERFLYPS 2, 3, 6 >> - SBUTTERFLYPS 4, 5, 6 >> - >> - movaps m6, m4 >> - shufps m4, m0, q3210 >> - movlhps m0, m2 >> - movhlps m6, m2 >> - movaps [dstq ], m0 >> - movaps [dstq+16], m4 >> - movaps [dstq+32], m6 >> - >> - movaps m6, m5 >> - shufps m5, m1, q3210 >> - movlhps m1, m3 >> - movhlps m6, m3 >> - movaps [dstq+48], m1 >> - movaps [dstq+64], m5 >> - movaps [dstq+80], m6 >> + SBUTTERFLYPS2 0, 1, 6 >> + SBUTTERFLYPS2 2, 3, 6 >> + SBUTTERFLYPS2 4, 5, 6 >> + movhlps m6, m0 >> + unpcklpd m0, m2 >> + unpckhpd m2, m4 >> + unpcklpd m4, m6 >> + movhlps m6, m1 >> + unpcklpd m1, m3 >> + unpckhpd m3, m5 >> + unpcklpd m5, m6 >> + movaps [dstq ], m0 >> + movaps [dstq+1*mmsize], m4 >> + movaps [dstq+2*mmsize], m2 >> + movaps [dstq+3*mmsize], m1 >> + movaps [dstq+4*mmsize], m5 >> + movaps [dstq+5*mmsize], m3 > > Does replacing 6 shuffles by 8 makes it faster? movhlps/movlhps have > also 3-op versions... 2 moves + 6 shuffles doesn't seem to be any slower than the 8 shuffles. At least I didn't get any measurable difference in benchmarks. I don't see how using 3-arg movhlps/movlhps can help in this situation, but I suppose 4-arg shufps could be used to avoid the 2 movaps in an AVX version of the current code. I'll try it out. Thanks, Justin From justin.ruggles at gmail.com Mon May 7 16:34:03 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Mon, 07 May 2012 10:34:03 -0400 Subject: [libav-devel] [PATCH 05/12] av_samples_fill_array: Mark unmodified function argument as const. In-Reply-To: <1334840823-22614-5-git-send-email-diego@biurrun.de> References: <1334840823-22614-1-git-send-email-diego@biurrun.de> <1334840823-22614-5-git-send-email-diego@biurrun.de> Message-ID: <4FA7DD5B.5050602@gmail.com> On 04/19/2012 09:06 AM, Diego Biurrun wrote: > libavcodec/utils.c:274: warning: passing argument 3 of ?av_samples_fill_arrays? discards qualifiers from pointer target type > ./libavutil/samplefmt.h:151: note: expected ?uint8_t *? but argument is of type ?const uint8_t *? > --- > libavutil/samplefmt.c | 2 +- > libavutil/samplefmt.h | 3 ++- > 2 files changed, 3 insertions(+), 2 deletions(-) looks fine. -Justin From justin.ruggles at gmail.com Mon May 7 16:35:57 2012 From: justin.ruggles at gmail.com (Justin Ruggles) Date: Mon, 07 May 2012 10:35:57 -0400 Subject: [libav-devel] [PATCH 10/12] mov: Remove write-only variable in mov_read_chan(). In-Reply-To: <1334840823-22614-10-git-send-email-diego@biurrun.de> References: <1334840823-22614-1-git-send-email-diego@biurrun.de> <1334840823-22614-10-git-send-email-diego@biurrun.de> Message-ID: <4FA7DDCD.1010407@gmail.com> On 04/19/2012 09:07 AM, Diego Biurrun wrote: > libavformat/mov.c:597:25: warning: variable ?cflags? set but not used > --- > libavformat/mov.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavformat/mov.c b/libavformat/mov.c > index e1468ce..eb92703 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -595,9 +595,9 @@ static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom) > > label_mask = 0; > for (i = 0; i < num_descr; i++) { > - uint32_t label, cflags; > + uint32_t label; > label = avio_rb32(pb); // mChannelLabel > - cflags = avio_rb32(pb); // mChannelFlags > + avio_rb32(pb); // mChannelFlags > avio_rl32(pb); // mCoordinates[0] > avio_rl32(pb); // mCoordinates[1] > avio_rl32(pb); // mCoordinates[2] ok. -Justin From lu_zero at gentoo.org Mon May 7 16:47:23 2012 From: lu_zero at gentoo.org (Luca Barbato) Date: Mon, 07 May 2012 07:47:23 -0700 Subject: [libav-devel] [RFC] lockmgr callback inclusion into libs sources In-Reply-To: References: Message-ID: <4FA7E07B.30803@gentoo.org> On 07/05/12 07:20, Andrey Utkin wrote: > I'd like to offer inclusion of suitable lockmgr callback functions > into libraries code. > (To make it clear for non-familiar people: i mean the function we > register with lavc av_lockmgr_register() when we work multithreadingly > with {de,en}coders. > Currently every app maker who needs it must copy&paste it from web, > while there seem not to be much deviations in implementation of this > routine for different case. > E.g. for pthreads-enabled compilations, it should be what is at bottom > of the letter. > We can include such standard implementations for major platforms > (posix, winapi), and embrace it with ifdefs. So app makers can just > av_lockmgr_register() it with functions which are already there in > libs. > Comments, and help on patch forming are appreciated. I like the idea. shall we call it av_default_lockmgr? lu -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero From andrey.krieger.utkin at gmail.com Mon May 7 17:09:30 2012 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Mon, 7 May 2012 18:09:30 +0300 Subject: [libav-devel] [RFC] lockmgr callback inclusion into libs sources In-Reply-To: <4FA7E07B.30803@gentoo.org> References: <4FA7E07B.30803@gentoo.org> Message-ID: 2012/5/7 Luca Barbato : > I like the idea. shall we call it av_default_lockmgr? I think we may have av_default_lockmgr_{posix,winapi} etc. that hold separate implementations, and conditionally-set av_default_lockmgr function that calls them, or just points to them. -- Andrey Utkin From anton at khirnov.net Mon May 7 17:05:02 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 7 May 2012 17:05:02 +0200 Subject: [libav-devel] [PATCH 2/2] lavc: check that extended_data is properly set in avcodec_encode_audio2(). In-Reply-To: <1336403102-14012-1-git-send-email-anton@khirnov.net> References: <4FA7D374.7000506@gmail.com> <1336403102-14012-1-git-send-email-anton@khirnov.net> Message-ID: <1336403102-14012-2-git-send-email-anton@khirnov.net> --- libavcodec/utils.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 4d1b1c2..74df9ec 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -911,6 +911,7 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, const AVFrame *frame, int *got_packet_ptr) { + AVFrame tmp; AVFrame *padded_frame = NULL; int ret; int user_packet = !!avpkt->data; @@ -925,6 +926,22 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, return 0; } + /* ensure that extended_data is properly set */ + if (frame && !frame->extended_data) { + if (av_sample_fmt_is_planar(avctx->sample_fmt) && + avctx->channels > AV_NUM_DATA_POINTERS) { + av_log(avctx, AV_LOG_ERROR, "Encoding to a planar sample format, " + "with more than %d channels, but extended_data is not set.\n", + AV_NUM_DATA_POINTERS); + return AVERROR(EINVAL); + } + av_log(avctx, AV_LOG_WARNING, "extended_data is not set.\n"); + + tmp = *frame; + tmp.extended_data = tmp.data; + frame = &tmp; + } + /* check for valid frame size */ if (frame) { nb_samples = frame->nb_samples; -- 1.7.9.5 From anton at khirnov.net Mon May 7 17:05:01 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 7 May 2012 17:05:01 +0200 Subject: [libav-devel] [PATCH 1/2] lavc: pad last audio frame with silence when needed. In-Reply-To: <4FA7D374.7000506@gmail.com> References: <4FA7D374.7000506@gmail.com> Message-ID: <1336403102-14012-1-git-send-email-anton@khirnov.net> --- avconv.c | 8 ------ doc/APIchanges | 5 ++++ libavcodec/avcodec.h | 10 +++----- libavcodec/internal.h | 6 +++++ libavcodec/utils.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ libavcodec/version.h | 2 +- 6 files changed, 83 insertions(+), 16 deletions(-) diff --git a/avconv.c b/avconv.c index 73f3bc3..6f7774e 100644 --- a/avconv.c +++ b/avconv.c @@ -2004,14 +2004,6 @@ static void flush_encoders(void) av_fifo_generic_read(ost->fifo, audio_buf, fifo_bytes, NULL); - /* pad last frame with silence if needed */ - if (!(enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME)) { - frame_bytes = enc->frame_size * enc->channels * - av_get_bytes_per_sample(enc->sample_fmt); - if (allocated_audio_buf_size < frame_bytes) - exit_program(1); - generate_silence(audio_buf+fifo_bytes, enc->sample_fmt, frame_bytes - fifo_bytes); - } encode_audio_frame(os, ost, audio_buf, frame_bytes); } else { /* flush encoder with NULL frames until it is done diff --git a/doc/APIchanges b/doc/APIchanges index 66a0786..5027871 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,11 @@ libavutil: 2011-04-18 API changes, most recent first: +2012-xx-xx - xxxxxxx - lavc 54.13.1 + For audio formats with fixed frame size, the last frame + no longer needs to be padded with silence, libavcodec + will handle this internally. + 2012-xx-xx - xxxxxxx - lavc 54.13.0 - avcodec.h Add sample_rate and channel_layout fields to AVFrame. diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index bec13e7..102df3a 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3860,15 +3860,11 @@ int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx, * @param[in] frame AVFrame containing the raw audio data to be encoded. * May be NULL when flushing an encoder that has the * CODEC_CAP_DELAY capability set. - * There are 2 codec capabilities that affect the allowed - * values of frame->nb_samples. - * If CODEC_CAP_SMALL_LAST_FRAME is set, then only the final - * frame may be smaller than avctx->frame_size, and all other - * frames must be equal to avctx->frame_size. * If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame * can have any number of samples. - * If neither is set, frame->nb_samples must be equal to - * avctx->frame_size for all frames. + * If it is not set, frame->nb_samples must be equal to + * avctx->frame_size for all frames except the last. + * The final frame may be smaller than avctx->frame_size. * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the * output packet is non-empty, and to 0 if it is * empty. If the function returns an error, the diff --git a/libavcodec/internal.h b/libavcodec/internal.h index bedb2ed..57d551d 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -70,6 +70,12 @@ typedef struct AVCodecInternal { */ int sample_count; #endif + + /** + * An audio frame with less than required samples has been submitted and + * padded with silence. Reject all subsequent frames. + */ + int last_audio_frame; } AVCodecInternal; struct AVCodecDefault { diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 2e8a86c..4d1b1c2 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -857,11 +857,61 @@ int ff_alloc_packet(AVPacket *avpkt, int size) } } +static int pad_last_frame(AVCodecContext *s, AVFrame **dst, const AVFrame *src) +{ + AVFrame *frame = NULL; + uint8_t *buf = NULL; + int planar = av_sample_fmt_is_planar(s->sample_fmt); + int planes = planar ? s->channels : 1; + int fill_char = (s->sample_fmt == AV_SAMPLE_FMT_U8 || + s->sample_fmt == AV_SAMPLE_FMT_U8P) ? 0x80 : 0x00; + int data_size = src->nb_samples * av_get_bytes_per_sample(s->sample_fmt) * + (planar ? 1 : s->channels); + int ret, i; + + if (!(frame = avcodec_alloc_frame())) + return AVERROR(ENOMEM); + *frame = *src; + + if ((ret = av_samples_get_buffer_size(&frame->linesize[0], s->channels, + s->frame_size, s->sample_fmt, 0)) < 0) + goto fail; + + if (!(buf = av_malloc(ret))) { + ret = AVERROR(ENOMEM); + goto fail; + } + + frame->nb_samples = s->frame_size; + if ((ret = avcodec_fill_audio_frame(frame, s->channels, s->sample_fmt, + buf, ret, 0)) < 0) + goto fail; + + for (i = 0; i < planes; i++) { + memcpy(frame->extended_data[i], src->extended_data[i], + data_size); + memset(frame->extended_data[i] + data_size, fill_char, + frame->linesize[0] - data_size); + } + + *dst = frame; + + return 0; + +fail: + if (frame->extended_data != frame->data) + av_freep(&frame->extended_data); + av_freep(&buf); + av_freep(&frame); + return ret; +} + int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { + AVFrame *padded_frame = NULL; int ret; int user_packet = !!avpkt->data; int nb_samples; @@ -882,6 +932,17 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, if (nb_samples > avctx->frame_size) return AVERROR(EINVAL); } else if (!(avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) { + if (nb_samples < avctx->frame_size && + !avctx->internal->last_audio_frame) { + ret = pad_last_frame(avctx, &padded_frame, frame); + if (ret < 0) + return ret; + + frame = padded_frame; + nb_samples = frame->nb_samples; + avctx->internal->last_audio_frame = 1; + } + if (nb_samples != avctx->frame_size) return AVERROR(EINVAL); } @@ -983,6 +1044,13 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, here to simplify things */ avpkt->flags |= AV_PKT_FLAG_KEY; + if (padded_frame) { + av_freep(&padded_frame->data[0]); + if (padded_frame->extended_data != padded_frame->data) + av_freep(&padded_frame->extended_data); + av_freep(&padded_frame); + } + return ret; } diff --git a/libavcodec/version.h b/libavcodec/version.h index be39f4f..da7796a 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #define LIBAVCODEC_VERSION_MAJOR 54 #define LIBAVCODEC_VERSION_MINOR 13 -#define LIBAVCODEC_VERSION_MICRO 0 +#define LIBAVCODEC_VERSION_MICRO 1 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ -- 1.7.9.5 From anton at khirnov.net Mon May 7 17:04:16 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 07 May 2012 17:04:16 +0200 Subject: [libav-devel] [PATCH 2/4] avcodec: refactor avcodec_encode_audio2() to merge common branches In-Reply-To: <1332359735-8163-2-git-send-email-justin.ruggles@gmail.com> References: <1332359735-8163-1-git-send-email-justin.ruggles@gmail.com> <1332359735-8163-2-git-send-email-justin.ruggles@gmail.com> Message-ID: <20120507150416.4214.58344@daenerys.khirnov.net> On Wed, 21 Mar 2012 15:55:33 -0400, Justin Ruggles wrote: > --- > libavcodec/utils.c | 9 ++++----- > 1 files changed, 4 insertions(+), 5 deletions(-) > > diff --git a/libavcodec/utils.c b/libavcodec/utils.c > index f66295a..6494499 100644 > --- a/libavcodec/utils.c > +++ b/libavcodec/utils.c > @@ -880,8 +880,9 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, > } > } > > - ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); > - if (!ret && *got_packet_ptr) { > + ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); > + if (!ret) { > + if (*got_packet_ptr) { > if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) { > if (avpkt->pts == AV_NOPTS_VALUE) > avpkt->pts = frame->pts; > @@ -890,11 +891,9 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, > frame->nb_samples); > } > avpkt->dts = avpkt->pts; > - } else { > + } else > avpkt->size = 0; > - } > > - if (!ret) { > if (!user_packet && avpkt->data) { > uint8_t *new_data = av_realloc(avpkt->data, avpkt->size); > if (new_data) > -- > 1.7.1 > Looks fine. -- Anton Khirnov From vitor1001 at gmail.com Mon May 7 17:40:29 2012 From: vitor1001 at gmail.com (Vitor Sessak) Date: Mon, 07 May 2012 17:40:29 +0200 Subject: [libav-devel] [PATCH] lavr: replace the SSE version of ff_conv_fltp_to_flt_6ch() with AVX In-Reply-To: <4FA7DC55.70909@gmail.com> References: <1336073961-20905-1-git-send-email-justin.ruggles@gmail.com> <4FA7BD87.1050709@gmail.com> <4FA7DC55.70909@gmail.com> Message-ID: <4FA7ECED.5050402@gmail.com> On 05/07/2012 04:29 PM, Justin Ruggles wrote: > On 05/07/2012 08:18 AM, Vitor Sessak wrote: >> On 05/03/2012 09:39 PM, Justin Ruggles wrote: >>> The SSE version is slower than the MMX version on Athlon64 and Sandy >>> Bridge, >>> but the 3-arg AVX version is faster on Sandy Bridge. >>> --- >>> Athlon64 >>> C - 26322 >>> MMX - 7997 >>> SSE - 8662 >>> >>> Sandy Bridge >>> C - 13011 >>> MMX - 4262 >>> SSE - 4680 >>> AVX - 3960 >>> >>> Note that although the new code is simpler, using it as SSE is not any >>> faster than the existing SSE version. The AVX version is only faster >>> because of the 3-arg ops in SBUTTERFLYPS2. >>> >>> libavresample/x86/audio_convert.asm | 40 >>> ++++++++++++++++---------------- >>> libavresample/x86/audio_convert_init.c | 6 ++-- >>> libavutil/x86/x86util.asm | 6 ++++ >>> 3 files changed, 29 insertions(+), 23 deletions(-) >>> >>> diff --git a/libavresample/x86/audio_convert.asm >>> b/libavresample/x86/audio_convert.asm >>> index 809c5d1..c9ba2b0 100644 >>> --- a/libavresample/x86/audio_convert.asm >>> +++ b/libavresample/x86/audio_convert.asm >>> @@ -55,25 +55,23 @@ cglobal conv_fltp_to_flt_6ch, 2,8,7, dst, src, >>> src1, src2, src3, src4, src5, len >>> mova m4, [srcq+src4q] >>> mova m5, [srcq+src5q] >>> %if cpuflag(sse) >>> - SBUTTERFLYPS 0, 1, 6 >>> - SBUTTERFLYPS 2, 3, 6 >>> - SBUTTERFLYPS 4, 5, 6 >>> - >>> - movaps m6, m4 >>> - shufps m4, m0, q3210 >>> - movlhps m0, m2 >>> - movhlps m6, m2 >>> - movaps [dstq ], m0 >>> - movaps [dstq+16], m4 >>> - movaps [dstq+32], m6 >>> - >>> - movaps m6, m5 >>> - shufps m5, m1, q3210 >>> - movlhps m1, m3 >>> - movhlps m6, m3 >>> - movaps [dstq+48], m1 >>> - movaps [dstq+64], m5 >>> - movaps [dstq+80], m6 >>> + SBUTTERFLYPS2 0, 1, 6 >>> + SBUTTERFLYPS2 2, 3, 6 >>> + SBUTTERFLYPS2 4, 5, 6 >>> + movhlps m6, m0 >>> + unpcklpd m0, m2 >>> + unpckhpd m2, m4 >>> + unpcklpd m4, m6 >>> + movhlps m6, m1 >>> + unpcklpd m1, m3 >>> + unpckhpd m3, m5 >>> + unpcklpd m5, m6 >>> + movaps [dstq ], m0 >>> + movaps [dstq+1*mmsize], m4 >>> + movaps [dstq+2*mmsize], m2 >>> + movaps [dstq+3*mmsize], m1 >>> + movaps [dstq+4*mmsize], m5 >>> + movaps [dstq+5*mmsize], m3 >> >> Does replacing 6 shuffles by 8 makes it faster? movhlps/movlhps have >> also 3-op versions... > > 2 moves + 6 shuffles doesn't seem to be any slower than the 8 shuffles. > At least I didn't get any measurable difference in benchmarks. > > I don't see how using 3-arg movhlps/movlhps can help in this situation, > but I suppose 4-arg shufps could be used to avoid the 2 movaps in an AVX > version of the current code. I'll try it out. It might also be interesting to try to replace the two shufps by two blendps instructions for the AVX case. In SB, blendps is supposed to have a higher throughput than shufps. -Vitor From alex.converse at gmail.com Mon May 7 19:18:49 2012 From: alex.converse at gmail.com (Alex Converse) Date: Mon, 7 May 2012 10:18:49 -0700 Subject: [libav-devel] [PATCH 1/3] fate: Add oneline comparison method In-Reply-To: <1336092939-6565-1-git-send-email-alex.converse@gmail.com> References: <1336092939-6565-1-git-send-email-alex.converse@gmail.com> Message-ID: On Thu, May 3, 2012 at 5:55 PM, Alex Converse wrote: > From: Mans Rullgard > > Signed-off-by: Alex Converse > --- > ?tests/fate-run.sh | ? ?9 ++++++++- > ?1 files changed, 8 insertions(+), 1 deletions(-) > > diff --git a/tests/fate-run.sh b/tests/fate-run.sh > index f7a7aba..8097eec 100755 > --- a/tests/fate-run.sh > +++ b/tests/fate-run.sh > @@ -60,6 +60,12 @@ stddev(){ > ? ? do_tiny_psnr "$1" "$2" stddev > ?} > > +oneline(){ > + ? ?val=$(cat "$2") > + ? ?test x"$val" = x"$1" || { r=$?; printf -- '-%s\n+%s\n' "$ref" "$val"; } > + ? ?return ${r:-0} > +} > + > ?run(){ > ? ? test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3 > ? ? $target_exec $target_path/"$@" > @@ -147,11 +153,12 @@ if [ $err -gt 128 ]; then > ? ? test "${sig}" = "${sig%[!A-Za-z]*}" || unset sig > ?fi > > -if test -e "$ref"; then > +if test -e "$ref" || test $cmp = "oneline" ; then > ? ? case $cmp in > ? ? ? ? diff) ? diff -u -w "$ref" "$outfile" ? ? ? ? ? ?>$cmpfile ;; > ? ? ? ? oneoff) oneoff ? ? "$ref" "$outfile" ? ? ? ? ? ?>$cmpfile ;; > ? ? ? ? stddev) stddev ? ? "$ref" "$outfile" ? ? ? ? ? ?>$cmpfile ;; > + ? ? ? ?oneline)oneline ? ?"$ref" "$outfile" ? ? ? ? ? ?>$cmpfile ;; > ? ? ? ? null) ? cat ? ? ? ? ? ? ? "$outfile" ? ? ? ? ? ?>$cmpfile ;; > ? ? esac > ? ? cmperr=$? > -- > 1.7.7.3 > > Tested with success and failure ping? From rsbultje at gmail.com Mon May 7 19:20:49 2012 From: rsbultje at gmail.com (Ronald S. Bultje) Date: Mon, 7 May 2012 10:20:49 -0700 Subject: [libav-devel] [PATCH 1/3] mp3/ac3 probe: search for PES headers to prevent probing MPEG-PS as MP3. In-Reply-To: References: <1336068060-71190-1-git-send-email-rsbultje@gmail.com> Message-ID: Hi, On Thu, May 3, 2012 at 6:16 PM, Ronald S. Bultje wrote: > Hi, > > On Thu, May 3, 2012 at 11:00 AM, Ronald S. Bultje wrote: >> From: "Ronald S. Bultje" >> >> --- >> ?libavformat/ac3dec.c | ? 30 +++++++++++++++++++++++++----- >> ?libavformat/mp3dec.c | ? 30 +++++++++++++++++++++++++----- >> ?2 files changed, 50 insertions(+), 10 deletions(-) > > Ping, this is the original patch that triggered all this weirdness > with fate probe tests, anyone in favour? Ping2. Ronald From diego at biurrun.de Mon May 7 19:27:05 2012 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 07 May 2012 19:27:05 +0200 Subject: [libav-devel] [PATCH 1/3] fate: Add oneline comparison method In-Reply-To: References: <1336092939-6565-1-git-send-email-alex.converse@gmail.com> Message-ID: <20120507172705.GM15241@pool.informatik.rwth-aachen.de> On Mon, May 07, 2012 at 10:18:49AM -0700, Alex Converse wrote: > On Thu, May 3, 2012 at 5:55 PM, Alex Converse wrote: > > --- a/tests/fate-run.sh > > +++ b/tests/fate-run.sh > > > > Tested with success and failure > > ping? You fixed all the issues Mans mentioned, if this is tested and works, push. Diego From anton at khirnov.net Mon May 7 19:33:56 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 7 May 2012 19:33:56 +0200 Subject: [libav-devel] [RFC] Audio filters Message-ID: <1336412058-14902-1-git-send-email-anton@khirnov.net> Hi, here is the my current work on audio filters. It's still not complete, but I'm throwing it out here to get some comments. FATE passes, the stuff that's missing is: - polishing and docs - turn async stuff from avconv into a filter - more testing - more filters (we have only source, sink and resample now) - complex filtergraphs in avconv I'd appreciate some comments on API and general design. Anton Khirnov (18): lavfi: add a function for copying properties from AVFilterBufferRef->AVFrame samplefmt: add a function for copying audio samples. lavfi: add vsink_buffer, and use it in avtools lavfi: add extended_data to AVFilterBuffer. lavfi: change AVFilterBufferRefAudioProps.sample_rate from uint32_t to int lavfi: remove some audio-related function from public API. lavfi: move audio-related functions to a separate file. lavfi: add lavr-based audio resampling filter. lavfi: autoinsert resample filter when necessary. lavfi: add types and functions for channel layout/samplerate negotiation lavfi: add channel layout/sample rate negotiation. lavfi: rename vsrc_buffer.c to buffersrc.c buffersrc: fix invalid read in uninit if the fifo hasn't been allocated buffersrc: add av_buffersrc_write_frame(). lavfi: add an audio buffer source. lavfi: add an audio buffer sink. lavfi: add aformat filter avconv: add support for audio filters. Stefano Sabatini (4): lavfi: add avfilter_get_audio_buffer_ref_from_arrays(). lavfi: cleanup avfilter_get_audio_buffer() and pals. lavfi: use avfilter_get_audio_buffer_ref_from_arrays() in avfilter_default_get_audio_buffer lavfi: simplify signature for avfilter_get_audio_buffer() and friends avconv.c | 685 +++++++++++++++++++++++------------------ avplay.c | 29 +- cmdutils.c | 68 ---- cmdutils.h | 15 - configure | 4 +- doc/filters.texi | 23 ++ libavfilter/Makefile | 11 +- libavfilter/af_aformat.c | 148 +++++++++ libavfilter/af_anull.c | 5 +- libavfilter/af_resample.c | 199 ++++++++++++ libavfilter/allfilters.c | 17 + libavfilter/audio.c | 208 +++++++++++++ libavfilter/audio.h | 61 ++++ libavfilter/avfilter.c | 146 +++++---- libavfilter/avfilter.h | 109 ++++--- libavfilter/avfiltergraph.c | 200 +++++++++--- libavfilter/buffersink.c | 208 +++++++++++++ libavfilter/buffersink.h | 62 ++++ libavfilter/buffersrc.c | 402 ++++++++++++++++++++++++ libavfilter/buffersrc.h | 11 + libavfilter/defaults.c | 189 +++--------- libavfilter/formats.c | 280 ++++++++++++----- libavfilter/formats.h | 78 +++++ libavfilter/internal.h | 4 + libavfilter/version.h | 3 + libavfilter/vsrc_buffer.c | 215 ------------- libavutil/samplefmt.c | 12 + libavutil/samplefmt.h | 12 + tests/ref/fate/amv | 20 +- tests/ref/fate/smjpeg | 16 +- tests/ref/fate/truemotion1-15 | 2 +- 31 files changed, 2434 insertions(+), 1008 deletions(-) -- Anton Khirnov From anton at khirnov.net Mon May 7 19:33:58 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 7 May 2012 19:33:58 +0200 Subject: [libav-devel] [PATCH 02/22] samplefmt: add a function for copying audio samples. In-Reply-To: <1336412058-14902-1-git-send-email-anton@khirnov.net> References: <1336412058-14902-1-git-send-email-anton@khirnov.net> Message-ID: <1336412058-14902-3-git-send-email-anton@khirnov.net> --- libavutil/samplefmt.c | 12 ++++++++++++ libavutil/samplefmt.h | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c index 0a2ffa0..fb6a78f 100644 --- a/libavutil/samplefmt.c +++ b/libavutil/samplefmt.c @@ -185,3 +185,15 @@ int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, } return 0; } + +int av_samples_copy(uint8_t **dst, uint8_t **src, int linesize, int nb_channels, + enum AVSampleFormat sample_fmt) +{ + int planes = av_sample_fmt_is_planar(sample_fmt) ? nb_channels : 1; + int i; + + for (i = 0; i < planes; i++) + memcpy(dst[i], src[i], linesize); + + return 0; +} diff --git a/libavutil/samplefmt.h b/libavutil/samplefmt.h index bb5ba59..d9d4e6a 100644 --- a/libavutil/samplefmt.h +++ b/libavutil/samplefmt.h @@ -193,4 +193,16 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, uint8_t *buf, int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align); +/** + * Copy samples from src to dst. + * + * @param dst destination array of pointers to data planes + * @param src source array of pointers to data planes + * @param linesize size of each plane in bytes + * @param nb_channels number of audio channel + * @param sample_fmt audio sample format + */ +int av_samples_copy(uint8_t **dst, uint8_t **src, int linesize, int nb_channels, + enum AVSampleFormat sample_fmt); + #endif /* AVUTIL_SAMPLEFMT_H */ -- 1.7.9.5 From anton at khirnov.net Mon May 7 19:33:57 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 7 May 2012 19:33:57 +0200 Subject: [libav-devel] [PATCH 01/22] lavfi: add a function for copying properties from AVFilterBufferRef->AVFrame In-Reply-To: <1336412058-14902-1-git-send-email-anton@khirnov.net> References: <1336412058-14902-1-git-send-email-anton@khirnov.net> Message-ID: <1336412058-14902-2-git-send-email-anton@khirnov.net> Based on a commit by Stefano Sabatini --- libavfilter/avfilter.c | 30 ++++++++++++++++++++++++++++++ libavfilter/avfilter.h | 8 ++++++++ 2 files changed, 38 insertions(+) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index d1c82ce..f12ca3a 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -708,6 +708,36 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) return 0; } +int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src) +{ + memcpy(dst->data, src->data, sizeof(dst->data)); + memcpy(dst->linesize, src->linesize, sizeof(dst->linesize)); + + dst->pts = src->pts; + dst->format = src->format; + + switch (src->type) { + case AVMEDIA_TYPE_VIDEO: + dst->width = src->video->w; + dst->height = src->video->h; + dst->sample_aspect_ratio = src->video->pixel_aspect; + dst->interlaced_frame = src->video->interlaced; + dst->top_field_first = src->video->top_field_first; + dst->key_frame = src->video->key_frame; + dst->pict_type = src->video->pict_type; + break; + case AVMEDIA_TYPE_AUDIO: + dst->sample_rate = src->audio->sample_rate; + dst->channel_layout = src->audio->channel_layout; + dst->nb_samples = src->audio->nb_samples; + break; + default: + return AVERROR(EINVAL); + } + + return 0; +} + void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src) { // copy common properties diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index c2049f9..ef61a5d 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -848,4 +848,12 @@ static inline void avfilter_insert_outpad(AVFilterContext *f, unsigned index, */ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src); +/** + * Copy the frame properties and data pointers of src to dst, without copying + * the actual data. + * + * @return 0 on success, a negative number on error. + */ +int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src); + #endif /* AVFILTER_AVFILTER_H */ -- 1.7.9.5 From anton at khirnov.net Mon May 7 19:34:00 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 7 May 2012 19:34:00 +0200 Subject: [libav-devel] [PATCH 04/22] lavfi: add extended_data to AVFilterBuffer. In-Reply-To: <1336412058-14902-1-git-send-email-anton@khirnov.net> References: <1336412058-14902-1-git-send-email-anton@khirnov.net> Message-ID: <1336412058-14902-5-git-send-email-anton@khirnov.net> This is similar to what has previously been done in AVFrame to allow dealing with more than 8 channels. --- libavfilter/avfilter.c | 33 +++++++++++++++++++++++++++++++++ libavfilter/avfilter.h | 32 ++++++++++++++++++++++++++++++++ libavfilter/defaults.c | 2 ++ 3 files changed, 67 insertions(+) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index f12ca3a..5973e6b 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -57,6 +57,7 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask) return NULL; } *ret->video = *ref->video; + ret->extended_data = ret->data; } else if (ref->type == AVMEDIA_TYPE_AUDIO) { ret->audio = av_malloc(sizeof(AVFilterBufferRefAudioProps)); if (!ret->audio) { @@ -64,6 +65,19 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask) return NULL; } *ret->audio = *ref->audio; + + if (ref->extended_data != ref->data) { + int nb_channels = av_get_channel_layout_nb_channels(ref->audio->channel_layout); + if (!(ret->extended_data = av_malloc(sizeof(*ret->extended_data) * + nb_channels))) { + av_freep(&ret->audio); + av_freep(&ret); + return NULL; + } + memcpy(ret->extended_data, ref->extended_data, + sizeof(*ret->extended_data) * nb_channels); + } else + ret->extended_data = ret->data; } ret->perms &= pmask; ret->buf->refcount ++; @@ -76,6 +90,8 @@ void avfilter_unref_buffer(AVFilterBufferRef *ref) return; if (!(--ref->buf->refcount)) ref->buf->free(ref->buf); + if (ref->extended_data != ref->data) + av_freep(&ref->extended_data); av_free(ref->video); av_free(ref->audio); av_free(ref); @@ -338,6 +354,9 @@ avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int memcpy(picref->data, pic->data, sizeof(picref->data)); memcpy(picref->linesize, pic->linesize, sizeof(picref->linesize)); + pic-> extended_data = pic->data; + picref->extended_data = picref->data; + return picref; fail: @@ -710,6 +729,8 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src) { + int planes, nb_channels; + memcpy(dst->data, src->data, sizeof(dst->data)); memcpy(dst->linesize, src->linesize, sizeof(dst->linesize)); @@ -727,6 +748,18 @@ int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src) dst->pict_type = src->video->pict_type; break; case AVMEDIA_TYPE_AUDIO: + nb_channels = av_get_channel_layout_nb_channels(src->audio->channel_layout); + planes = av_sample_fmt_is_planar(src->format) ? nb_channels : 1; + + if (planes > FF_ARRAY_ELEMS(dst->data)) { + dst->extended_data = av_mallocz(planes * sizeof(*dst->extended_data)); + if (!dst->extended_data) + return AVERROR(ENOMEM); + memcpy(dst->extended_data, src->extended_data, + planes * sizeof(dst->extended_data)); + } else + dst->extended_data = dst->data; + dst->sample_rate = src->audio->sample_rate; dst->channel_layout = src->audio->channel_layout; dst->nb_samples = src->audio->nb_samples; diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index ef61a5d..8965094 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -76,6 +76,22 @@ typedef struct AVFilterBuffer { int format; ///< media format int w, h; ///< width and height of the allocated buffer + + /** + * pointers to the data planes/channels. + * + * For video, this should simply point to data[]. + * + * For planar audio, each channel has a separate data pointer, and + * linesize[0] contains the size of each channel buffer. + * For packed audio, there is just one data pointer, and linesize[0] + * contains the total size of the buffer for all channels. + * + * Note: Both data and extended_data will always be set, but for planar + * audio with more channels that can fit in data, extended_data must be used + * in order to access all channels. + */ + uint8_t **extended_data; } AVFilterBuffer; #define AV_PERM_READ 0x01 ///< can read from the buffer @@ -140,6 +156,22 @@ typedef struct AVFilterBufferRef { enum AVMediaType type; ///< media type of buffer data AVFilterBufferRefVideoProps *video; ///< video buffer specific properties AVFilterBufferRefAudioProps *audio; ///< audio buffer specific properties + + /** + * pointers to the data planes/channels. + * + * For video, this should simply point to data[]. + * + * For planar audio, each channel has a separate data pointer, and + * linesize[0] contains the size of each channel buffer. + * For packed audio, there is just one data pointer, and linesize[0] + * contains the total size of the buffer for all channels. + * + * Note: Both data and extended_data will always be set, but for planar + * audio with more channels that can fit in data, extended_data must be used + * in order to access all channels. + */ + uint8_t **extended_data; } AVFilterBufferRef; /** diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c index 6d9003d..086fcc0 100644 --- a/libavfilter/defaults.c +++ b/libavfilter/defaults.c @@ -28,6 +28,8 @@ /* TODO: buffer pool. see comment for avfilter_default_get_video_buffer() */ void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr) { + if (ptr->extended_data != ptr->data) + av_freep(&ptr->extended_data); av_free(ptr->data[0]); av_free(ptr); } -- 1.7.9.5 From anton at khirnov.net Mon May 7 19:33:59 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 7 May 2012 19:33:59 +0200 Subject: [libav-devel] [PATCH 03/22] lavfi: add vsink_buffer, and use it in avtools In-Reply-To: <1336412058-14902-1-git-send-email-anton@khirnov.net> References: <1336412058-14902-1-git-send-email-anton@khirnov.net> Message-ID: <1336412058-14902-4-git-send-email-anton@khirnov.net> Also add the public interface libavfilter/buffersink.h. --- avconv.c | 104 ++++++++++++++++++++++++++++++------------ avplay.c | 29 ++++++++---- cmdutils.c | 68 --------------------------- cmdutils.h | 15 ------ configure | 2 +- doc/filters.texi | 8 ++++ libavfilter/Makefile | 2 + libavfilter/allfilters.c | 4 ++ libavfilter/buffersink.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++ libavfilter/buffersink.h | 43 +++++++++++++++++ 10 files changed, 267 insertions(+), 122 deletions(-) create mode 100644 libavfilter/buffersink.c create mode 100644 libavfilter/buffersink.h diff --git a/avconv.c b/avconv.c index 6f7774e..1aed704 100644 --- a/avconv.c +++ b/avconv.c @@ -50,6 +50,7 @@ # include "libavfilter/avfilter.h" # include "libavfilter/avfiltergraph.h" # include "libavfilter/buffersrc.h" +# include "libavfilter/buffersink.h" # include "libavfilter/vsrc_buffer.h" #if HAVE_SYS_RESOURCE_H @@ -582,14 +583,25 @@ static void filter_release_buffer(AVFilterBuffer *fb) unref_buffer(buf->ist, buf); } -static const enum PixelFormat *choose_pixel_fmts(OutputStream *ost) +static char *choose_pixel_fmts(OutputStream *ost) { if (ost->st->codec->pix_fmt != PIX_FMT_NONE) { - ost->pix_fmts[0] = ost->st->codec->pix_fmt; - return ost->pix_fmts; - } else if (ost->enc->pix_fmts) - return ost->enc->pix_fmts; - else + return av_strdup(av_get_pix_fmt_name(ost->st->codec->pix_fmt)); + } else if (ost->enc->pix_fmts) { + const enum PixelFormat *p; + AVIOContext *s = NULL; + uint8_t *ret; + int len; + + if (avio_open_dyn_buf(&s) < 0) + exit_program(1); + + for (p = ost->enc->pix_fmts; *p != PIX_FMT_NONE; p++) + avio_printf(s, "%s:", av_get_pix_fmt_name(*p)); + len = avio_close_dyn_buf(s, &ret); + ret[len - 1] = 0; + return ret; + } else return NULL; } @@ -597,9 +609,9 @@ static int configure_video_filters(FilterGraph *fg) { InputStream *ist = fg->inputs[0]->ist; OutputStream *ost = fg->outputs[0]->ost; - AVFilterContext *last_filter, *filter; + AVFilterContext *in_filter, *out_filter, *filter; AVCodecContext *codec = ost->st->codec; - SinkContext sink_ctx = { .pix_fmts = choose_pixel_fmts(ost) }; + char *pix_fmts; AVRational sample_aspect_ratio; char args[255]; int ret; @@ -621,11 +633,13 @@ static int configure_video_filters(FilterGraph *fg) "src", args, NULL, fg->graph); if (ret < 0) return ret; - ret = avfilter_graph_create_filter(&fg->outputs[0]->filter, &sink, - "out", NULL, &sink_ctx, fg->graph); + ret = avfilter_graph_create_filter(&fg->outputs[0]->filter, + avfilter_get_by_name("buffersink"), + "out", NULL, NULL, fg->graph); if (ret < 0) return ret; - last_filter = fg->inputs[0]->filter; + in_filter = fg->inputs[0]->filter; + out_filter = fg->outputs[0]->filter; if (codec->width || codec->height) { snprintf(args, 255, "%d:%d:flags=0x%X", @@ -635,9 +649,22 @@ static int configure_video_filters(FilterGraph *fg) if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"), NULL, args, NULL, fg->graph)) < 0) return ret; - if ((ret = avfilter_link(last_filter, 0, filter, 0)) < 0) + if ((ret = avfilter_link(in_filter, 0, filter, 0)) < 0) return ret; - last_filter = filter; + in_filter = filter; + } + + if ((pix_fmts = choose_pixel_fmts(ost))) { + if ((ret = avfilter_graph_create_filter(&filter, + avfilter_get_by_name("format"), + "format", pix_fmts, NULL, + fg->graph)) < 0) + return ret; + if ((ret = avfilter_link(filter, 0, out_filter, 0)) < 0) + return ret; + + out_filter = filter; + av_freep(&pix_fmts); } snprintf(args, sizeof(args), "flags=0x%X", (unsigned)ost->sws_flags); @@ -648,19 +675,19 @@ static int configure_video_filters(FilterGraph *fg) AVFilterInOut *inputs = avfilter_inout_alloc(); outputs->name = av_strdup("in"); - outputs->filter_ctx = last_filter; + outputs->filter_ctx = in_filter; outputs->pad_idx = 0; outputs->next = NULL; inputs->name = av_strdup("out"); - inputs->filter_ctx = fg->outputs[0]->filter; + inputs->filter_ctx = out_filter; inputs->pad_idx = 0; inputs->next = NULL; if ((ret = avfilter_graph_parse(fg->graph, ost->avfilter, inputs, outputs, NULL)) < 0) return ret; } else { - if ((ret = avfilter_link(last_filter, 0, fg->outputs[0]->filter, 0)) < 0) + if ((ret = avfilter_link(in_filter, 0, out_filter, 0)) < 0) return ret; } @@ -776,33 +803,52 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in) static int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out) { - SinkContext sink_ctx; + char *pix_fmts; AVCodecContext *codec = ofilter->ost->st->codec; AVFilterContext *last_filter = out->filter_ctx; int pad_idx = out->pad_idx; int ret; - sink_ctx.pix_fmts = choose_pixel_fmts(ofilter->ost); - ret = avfilter_graph_create_filter(&ofilter->filter, &sink, - "out", NULL, &sink_ctx, fg->graph); + ret = avfilter_graph_create_filter(&ofilter->filter, + avfilter_get_by_name("buffersink"), + "out", NULL, pix_fmts, fg->graph); if (ret < 0) return ret; if (codec->width || codec->height) { char args[255]; + AVFilterContext *filter; + snprintf(args, sizeof(args), "%d:%d:flags=0x%X", codec->width, codec->height, (unsigned)ofilter->ost->sws_flags); - if ((ret = avfilter_graph_create_filter(&last_filter, avfilter_get_by_name("scale"), + if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"), NULL, args, NULL, fg->graph)) < 0) return ret; - if ((ret = avfilter_link(out->filter_ctx, out->pad_idx, last_filter, 0)) < 0) + if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0) return ret; + + last_filter = filter; pad_idx = 0; } + if ((pix_fmts = choose_pixel_fmts(ofilter->ost))) { + AVFilterContext *filter; + if ((ret = avfilter_graph_create_filter(&filter, + avfilter_get_by_name("format"), + "format", pix_fmts, NULL, + fg->graph)) < 0) + return ret; + if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0) + return ret; + + last_filter = filter; + pad_idx = 0; + av_freep(&pix_fmts); + } + if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0) return ret; @@ -1801,7 +1847,7 @@ static int poll_filters(void) { AVFilterBufferRef *picref; AVFrame *filtered_frame = NULL; - int i, frame_size, ret; + int i, frame_size; for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; @@ -1816,13 +1862,11 @@ static int poll_filters(void) avcodec_get_frame_defaults(ost->filtered_frame); filtered_frame = ost->filtered_frame; - while (avfilter_poll_frame(ost->filter->filter->inputs[0])) { - AVRational ist_pts_tb; - if ((ret = get_filtered_video_frame(ost->filter->filter, - filtered_frame, &picref, - &ist_pts_tb)) < 0) - return ret; - filtered_frame->pts = av_rescale_q(picref->pts, ist_pts_tb, AV_TIME_BASE_Q); + while (av_buffersink_read(ost->filter->filter, &picref) >= 0) { + avfilter_copy_buf_props(filtered_frame, picref); + filtered_frame->pts = av_rescale_q(picref->pts, + ost->filter->filter->inputs[0]->time_base, + AV_TIME_BASE_Q); if (of->start_time && filtered_frame->pts < of->start_time) return 0; diff --git a/avplay.c b/avplay.c index e18b2e4..a671f38 100644 --- a/avplay.c +++ b/avplay.c @@ -41,6 +41,7 @@ #if CONFIG_AVFILTER # include "libavfilter/avfilter.h" # include "libavfilter/avfiltergraph.h" +# include "libavfilter/buffersink.h" #endif #include "cmdutils.h" @@ -1708,21 +1709,28 @@ static AVFilter input_filter = static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const char *vfilters) { - static const enum PixelFormat pix_fmts[] = { PIX_FMT_YUV420P, PIX_FMT_NONE }; char sws_flags_str[128]; int ret; - SinkContext sink_ctx = { .pix_fmts = pix_fmts }; - AVFilterContext *filt_src = NULL, *filt_out = NULL; + AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_format; snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%d", sws_flags); graph->scale_sws_opts = av_strdup(sws_flags_str); if ((ret = avfilter_graph_create_filter(&filt_src, &input_filter, "src", NULL, is, graph)) < 0) return ret; - if ((ret = avfilter_graph_create_filter(&filt_out, &sink, "out", - NULL, &sink_ctx, graph)) < 0) + if ((ret = avfilter_graph_create_filter(&filt_out, + avfilter_get_by_name("buffersink"), + "out", NULL, NULL, graph)) < 0) return ret; + if ((ret = avfilter_graph_create_filter(&filt_format, + avfilter_get_by_name("format"), + "format", "yuv420p", NULL, graph)) < 0) + return ret; + if ((ret = avfilter_link(filt_format, 0, filt_out, 0)) < 0) + return ret; + + if (vfilters) { AVFilterInOut *outputs = avfilter_inout_alloc(); AVFilterInOut *inputs = avfilter_inout_alloc(); @@ -1733,14 +1741,14 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c outputs->next = NULL; inputs->name = av_strdup("out"); - inputs->filter_ctx = filt_out; + inputs->filter_ctx = filt_format; inputs->pad_idx = 0; inputs->next = NULL; if ((ret = avfilter_graph_parse(graph, vfilters, inputs, outputs, NULL)) < 0) return ret; } else { - if ((ret = avfilter_link(filt_src, 0, filt_out, 0)) < 0) + if ((ret = avfilter_link(filt_src, 0, filt_format, 0)) < 0) return ret; } @@ -1796,11 +1804,16 @@ static int video_thread(void *arg) last_w = is->video_st->codec->width; last_h = is->video_st->codec->height; } - ret = get_filtered_video_frame(filt_out, frame, &picref, &tb); + ret = av_buffersink_read(filt_out, &picref); if (picref) { + avfilter_copy_buf_props(frame, picref); + pts_int = picref->pts; + tb = filt_out->inputs[0]->time_base; pos = picref->pos; frame->opaque = picref; + + ret = 1; } if (ret >= 0 && av_cmp_q(tb, is->video_st->time_base)) { diff --git a/cmdutils.c b/cmdutils.c index 6d2e97f..3cd11ca 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -1021,74 +1021,6 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, return opts; } -#if CONFIG_AVFILTER - -static int sink_init(AVFilterContext *ctx, const char *args, void *opaque) -{ - SinkContext *priv = ctx->priv; - - if (!opaque) - return AVERROR(EINVAL); - *priv = *(SinkContext *)opaque; - - return 0; -} - -static void null_end_frame(AVFilterLink *inlink) { } - -static int sink_query_formats(AVFilterContext *ctx) -{ - SinkContext *priv = ctx->priv; - - if (priv->pix_fmts) - avfilter_set_common_formats(ctx, avfilter_make_format_list(priv->pix_fmts)); - else - avfilter_default_query_formats(ctx); - return 0; -} - -AVFilter sink = { - .name = "sink", - .priv_size = sizeof(SinkContext), - .init = sink_init, - - .query_formats = sink_query_formats, - - .inputs = (AVFilterPad[]) {{ .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - .end_frame = null_end_frame, - .min_perms = AV_PERM_READ, }, - { .name = NULL }}, - .outputs = (AVFilterPad[]) {{ .name = NULL }}, -}; - -int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame, - AVFilterBufferRef **picref_ptr, AVRational *tb) -{ - int ret; - AVFilterBufferRef *picref; - - if ((ret = avfilter_request_frame(ctx->inputs[0])) < 0) - return ret; - if (!(picref = ctx->inputs[0]->cur_buf)) - return AVERROR(ENOENT); - *picref_ptr = picref; - ctx->inputs[0]->cur_buf = NULL; - *tb = ctx->inputs[0]->time_base; - - memcpy(frame->data, picref->data, sizeof(frame->data)); - memcpy(frame->linesize, picref->linesize, sizeof(frame->linesize)); - frame->interlaced_frame = picref->video->interlaced; - frame->top_field_first = picref->video->top_field_first; - frame->key_frame = picref->video->key_frame; - frame->pict_type = picref->video->pict_type; - frame->sample_aspect_ratio = picref->video->pixel_aspect; - - return 1; -} - -#endif /* CONFIG_AVFILTER */ - void *grow_array(void *array, int elem_size, int *size, int new_size) { if (new_size >= INT_MAX / elem_size) { diff --git a/cmdutils.h b/cmdutils.h index 792254c..6fff47d 100644 --- a/cmdutils.h +++ b/cmdutils.h @@ -367,21 +367,6 @@ int64_t guess_correct_pts(PtsCorrectionContext *ctx, int64_t pts, int64_t dts); FILE *get_preset_file(char *filename, size_t filename_size, const char *preset_name, int is_path, const char *codec_name); -typedef struct { - const enum PixelFormat *pix_fmts; -} SinkContext; - -extern AVFilter sink; - -/** - * Extract a frame from sink. - * - * @return a negative error in case of failure, 1 if one frame has - * been extracted successfully. - */ -int get_filtered_video_frame(AVFilterContext *sink, AVFrame *frame, - AVFilterBufferRef **picref, AVRational *pts_tb); - /** * Do all the necessary cleanup and abort. * This function is implemented in the avtools, not cmdutils. diff --git a/configure b/configure index 837e296..3afac95 100755 --- a/configure +++ b/configure @@ -1538,7 +1538,7 @@ avfilter_deps="swscale" avformat_deps="avcodec" # programs -avconv_deps="avcodec avfilter avformat avresample swscale" +avconv_deps="avcodec avfilter avformat avresample swscale format_filter" avplay_deps="avcodec avformat swscale sdl" avplay_select="rdft" avprobe_deps="avcodec avformat" diff --git a/doc/filters.texi b/doc/filters.texi index c5a56f4..dbcc86a 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -2078,6 +2078,14 @@ will generate a video with a duration of 5.3 seconds, with size Below is a description of the currently available video sinks. + at section buffersink + +Buffer video frames, and make them available to the end of the filter +graph. + +This sink is intended for a programmatic use through the interface defined in + at file{libavfilter/buffersink.h}. + @section nullsink Null video sink, do absolutely nothing with the input video. It is diff --git a/libavfilter/Makefile b/libavfilter/Makefile index ae85839..e786b6d 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -4,6 +4,7 @@ FFLIBS-$(CONFIG_MOVIE_FILTER) += avformat avcodec HEADERS = avfilter.h \ avfiltergraph.h \ + buffersink.h \ buffersrc.h \ version.h \ vsrc_buffer.h \ @@ -11,6 +12,7 @@ HEADERS = avfilter.h \ OBJS = allfilters.o \ avfilter.o \ avfiltergraph.o \ + buffersink.o \ defaults.o \ drawutils.o \ formats.o \ diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 198e152..f887002 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -95,6 +95,10 @@ void avfilter_register_all(void) avfilter_register(&avfilter_vsrc_buffer); } { + extern AVFilter avfilter_vsink_buffer; + avfilter_register(&avfilter_vsink_buffer); + } + { extern AVFilter avfilter_vf_scale; avfilter_register(&avfilter_vf_scale); } diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c new file mode 100644 index 0000000..e4cbe3b --- /dev/null +++ b/libavfilter/buffersink.c @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2011 Stefano Sabatini + * + * 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 + */ + +/** + * @file + * buffer sink + */ + +#include "libavutil/fifo.h" + +#include "avfilter.h" +#include "buffersink.h" + +typedef struct { + AVFifoBuffer *fifo; ///< FIFO buffer of video frame references +} BufferSinkContext; + +#define FIFO_INIT_SIZE 8 + +static av_cold void uninit(AVFilterContext *ctx) +{ + BufferSinkContext *sink = ctx->priv; + + while (sink->fifo && av_fifo_size(sink->fifo)) { + AVFilterBufferRef *buf; + av_fifo_generic_read(sink->fifo, &buf, sizeof(buf), NULL); + avfilter_unref_buffer(buf); + } + av_fifo_free(sink->fifo); +} + +static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) +{ + BufferSinkContext *sink = ctx->priv; + + if (!(sink->fifo = av_fifo_alloc(FIFO_INIT_SIZE*sizeof(AVFilterBufferRef*)))) { + av_log(ctx, AV_LOG_ERROR, "Failed to allocate fifo\n"); + return AVERROR(ENOMEM); + } + + return 0; +} + +static void end_frame(AVFilterLink *link) +{ + AVFilterContext *ctx = link->dst; + BufferSinkContext *sink = ctx->priv; + + if (av_fifo_space(sink->fifo) < sizeof(AVFilterBufferRef *) && + (av_fifo_realloc2(sink->fifo, av_fifo_size(sink->fifo) * 2) < 0)) { + av_log(ctx, AV_LOG_ERROR, "Error reallocating the FIFO.\n"); + return; + } + + av_fifo_generic_write(sink->fifo, &link->cur_buf, sizeof(link->cur_buf), NULL); + link->cur_buf = NULL; +} + +int av_buffersink_read(AVFilterContext *ctx, AVFilterBufferRef **buf) +{ + BufferSinkContext *sink = ctx->priv; + AVFilterLink *link = ctx->inputs[0]; + int ret; + + if (!buf) { + if (av_fifo_size(sink->fifo)) + return av_fifo_size(sink->fifo)/sizeof(*buf); + else + return avfilter_poll_frame(ctx->inputs[0]); + } + + if (!av_fifo_size(sink->fifo) && + (ret = avfilter_request_frame(link)) < 0) + return ret; + + if (!av_fifo_size(sink->fifo)) + return AVERROR(EINVAL); + + av_fifo_generic_read(sink->fifo, buf, sizeof(*buf), NULL); + + return 0; +} + +AVFilter avfilter_vsink_buffer = { + .name = "buffersink", + .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."), + .priv_size = sizeof(BufferSinkContext), + .init = init, + .uninit = uninit, + + .inputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .end_frame = end_frame, + .min_perms = AV_PERM_READ, }, + { .name = NULL }}, + .outputs = (AVFilterPad[]) {{ .name = NULL }}, +}; diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h new file mode 100644 index 0000000..e579b9a --- /dev/null +++ b/libavfilter/buffersink.h @@ -0,0 +1,43 @@ +/* + * 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 + */ + +#ifndef AVFILTER_BUFFERSINK_H +#define AVFILTER_BUFFERSINK_H + +/** + * @file + * memory buffer sink API + */ + +#include "avfilter.h" + +/** + * Get a buffer with filtered data from sink and put it in buf. + * + * @param sink pointer to a context of a buffersink AVFilter. + * @param buf pointer to the buffer will be written here if buf is non-NULL. buf + * must be freed by the caller using avfilter_unref_buffer(). + * Buf may also be NULL to query whether a buffer is ready to be + * output. + * + * @return >= 0 in case of success, a negative AVERROR code in case of + * failure. + */ +int av_buffersink_read(AVFilterContext *sink, AVFilterBufferRef **buf); + +#endif /* AVFILTER_BUFFERSINK_H */ -- 1.7.9.5 From anton at khirnov.net Mon May 7 19:34:04 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 7 May 2012 19:34:04 +0200 Subject: [libav-devel] [PATCH 08/22] lavfi: simplify signature for avfilter_get_audio_buffer() and friends In-Reply-To: <1336412058-14902-1-git-send-email-anton@khirnov.net> References: <1336412058-14902-1-git-send-email-anton@khirnov.net> Message-ID: <1336412058-14902-9-git-send-email-anton@khirnov.net> From: Stefano Sabatini The additional parameters are just complicating the function interface. Assume that a requested samples buffer will *always* have the format specified in the requested link. This breaks audio filtering API and ABI in theory, but since it's unusable right now this shouldn't be a problem. Signed-off-by: Anton Khirnov --- libavfilter/avfilter.c | 11 ++++------- libavfilter/avfilter.h | 16 ++++------------ libavfilter/defaults.c | 24 ++++++++++-------------- 3 files changed, 18 insertions(+), 33 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index a0cb7db..802c262 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -367,16 +367,15 @@ fail: } AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms, - enum AVSampleFormat sample_fmt, int nb_samples, - uint64_t channel_layout) + int nb_samples) { AVFilterBufferRef *ret = NULL; if (link->dstpad->get_audio_buffer) - ret = link->dstpad->get_audio_buffer(link, perms, sample_fmt, nb_samples, channel_layout); + ret = link->dstpad->get_audio_buffer(link, perms, nb_samples); if (!ret) - ret = avfilter_default_get_audio_buffer(link, perms, sample_fmt, nb_samples, channel_layout); + ret = avfilter_default_get_audio_buffer(link, perms, nb_samples); if (ret) ret->type = AVMEDIA_TYPE_AUDIO; @@ -592,9 +591,7 @@ void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) samplesref->perms, link->dstpad->min_perms, link->dstpad->rej_perms); link->cur_buf = avfilter_default_get_audio_buffer(link, dst->min_perms, - samplesref->format, - samplesref->audio->nb_samples, - samplesref->audio->channel_layout); + samplesref->audio->nb_samples); link->cur_buf->pts = samplesref->pts; link->cur_buf->audio->sample_rate = samplesref->audio->sample_rate; diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 46c3963..f114a5e 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -387,8 +387,7 @@ struct AVFilterPad { * Input audio pads only. */ AVFilterBufferRef *(*get_audio_buffer)(AVFilterLink *link, int perms, - enum AVSampleFormat sample_fmt, int nb_samples, - uint64_t channel_layout); + int nb_samples); /** * Callback called after the slices of a frame are completely sent. If @@ -473,9 +472,7 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, /** default handler for get_audio_buffer() for audio inputs */ AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms, - enum AVSampleFormat sample_fmt, - int nb_samples, - uint64_t channel_layout); + int nb_samples); /** * A helper for query_formats() which sets all links to the same list of @@ -505,8 +502,7 @@ AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link, /** get_audio_buffer() handler for filters which simply pass audio along */ AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms, - enum AVSampleFormat sample_fmt, int nb_samples, - uint64_t channel_layout); + int nb_samples); /** * Filter definition. This defines the pads a filter contains, and all the @@ -689,16 +685,12 @@ avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int * @param link the output link to the filter from which the buffer will * be requested * @param perms the required access permissions - * @param sample_fmt the format of each sample in the buffer to allocate * @param nb_samples the number of samples per channel - * @param channel_layout the number and type of channels per sample in the buffer to allocate - * @param planar audio data layout - planar or packed * @return A reference to the samples. This must be unreferenced with * avfilter_unref_buffer when you are finished with it. */ AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms, - enum AVSampleFormat sample_fmt, int nb_samples, - uint64_t channel_layout); + int nb_samples); /** * Create an audio buffer reference wrapped around an already diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c index 7c75ab9..df05c06 100644 --- a/libavfilter/defaults.c +++ b/libavfilter/defaults.c @@ -58,25 +58,24 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int per } AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms, - enum AVSampleFormat sample_fmt, int nb_samples, - uint64_t channel_layout) + int nb_samples) { AVFilterBufferRef *samplesref = NULL; uint8_t **data; - int planar = av_sample_fmt_is_planar(sample_fmt); - int nb_channels = av_get_channel_layout_nb_channels(channel_layout); + int planar = av_sample_fmt_is_planar(link->format); + int nb_channels = av_get_channel_layout_nb_channels(link->channel_layout); int planes = planar ? nb_channels : 1; int linesize; if (!(data = av_mallocz(sizeof(*data) * planes))) goto fail; - if (av_samples_alloc(data, &linesize, nb_channels, nb_samples, sample_fmt, 0) < 0) + if (av_samples_alloc(data, &linesize, nb_channels, nb_samples, link->format, 0) < 0) goto fail; samplesref = avfilter_get_audio_buffer_ref_from_arrays(data, linesize, perms, - nb_samples, sample_fmt, - channel_layout); + nb_samples, link->format, + link->channel_layout); if (!samplesref) goto fail; @@ -142,9 +141,8 @@ void avfilter_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *sa outlink = inlink->dst->outputs[0]; if (outlink) { - outlink->out_buf = avfilter_default_get_audio_buffer(inlink, AV_PERM_WRITE, samplesref->format, - samplesref->audio->nb_samples, - samplesref->audio->channel_layout); + outlink->out_buf = avfilter_default_get_audio_buffer(inlink, AV_PERM_WRITE, + samplesref->audio->nb_samples); outlink->out_buf->pts = samplesref->pts; outlink->out_buf->audio->sample_rate = samplesref->audio->sample_rate; avfilter_filter_samples(outlink, avfilter_ref_buffer(outlink->out_buf, ~0)); @@ -246,9 +244,7 @@ AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link, int perms, } AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms, - enum AVSampleFormat sample_fmt, int nb_samples, - uint64_t channel_layout) + int nb_samples) { - return avfilter_get_audio_buffer(link->dst->outputs[0], perms, sample_fmt, - nb_samples, channel_layout); + return avfilter_get_audio_buffer(link->dst->outputs[0], perms, nb_samples); } -- 1.7.9.5 From anton at khirnov.net Mon May 7 19:34:05 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 7 May 2012 19:34:05 +0200 Subject: [libav-devel] [PATCH 09/22] lavfi: change AVFilterBufferRefAudioProps.sample_rate from uint32_t to int In-Reply-To: <1336412058-14902-1-git-send-email-anton@khirnov.net> References: <1336412058-14902-1-git-send-email-anton@khirnov.net> Message-ID: <1336412058-14902-10-git-send-email-anton@khirnov.net> There's no reason for it to be explicitly 32 bits. It's declared as a plain int in all other places in Libav. This breaks audio filtering API and ABI in theory, but since it's unusable right now this shouldn't be a problem. --- libavfilter/avfilter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index f114a5e..6db143b 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -109,7 +109,7 @@ typedef struct AVFilterBuffer { typedef struct AVFilterBufferRefAudioProps { uint64_t channel_layout; ///< channel layout of audio buffer int nb_samples; ///< number of audio samples - uint32_t sample_rate; ///< audio buffer sample rate + int sample_rate; ///< audio buffer sample rate int planar; ///< audio buffer - planar or packed } AVFilterBufferRefAudioProps; -- 1.7.9.5 From anton at khirnov.net Mon May 7 19:34:13 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 7 May 2012 19:34:13 +0200 Subject: [libav-devel] [PATCH 17/22] buffersrc: fix invalid read in uninit if the fifo hasn't been allocated In-Reply-To: <1336412058-14902-1-git-send-email-anton@khirnov.net> References: <1336412058-14902-1-git-send-email-anton@khirnov.net> Message-ID: <1336412058-14902-18-git-send-email-anton@khirnov.net> --- libavfilter/buffersrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index 1ace368..c7284c1 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -137,7 +137,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) static av_cold void uninit(AVFilterContext *ctx) { BufferSourceContext *s = ctx->priv; - while (av_fifo_size(s->fifo)) { + while (s->fifo && av_fifo_size(s->fifo)) { AVFilterBufferRef *buf; av_fifo_generic_read(s->fifo, &buf, sizeof(buf), NULL); avfilter_unref_buffer(buf); -- 1.7.9.5 From anton at khirnov.net Mon May 7 19:34:02 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 7 May 2012 19:34:02 +0200 Subject: [libav-devel] [PATCH 06/22] lavfi: cleanup avfilter_get_audio_buffer() and pals. In-Reply-To: <1336412058-14902-1-git-send-email-anton@khirnov.net> References: <1336412058-14902-1-git-send-email-anton@khirnov.net> Message-ID: <1336412058-14902-7-git-send-email-anton@khirnov.net> From: Stefano Sabatini Remove AVFilterBufferRefAudioProps.size, and use nb_samples in its place everywhere. This is required as the size in the audio buffer may be aligned, so it may not contain a well defined number of samples. Also remove the useless planar parameter, which can be deduced from the sample format. This is technically an API and ABI break, but since the audio part of lavfi is not usable now, this should not be a problem in practice. Signed-off-by: Anton Khirnov --- libavfilter/avfilter.c | 22 ++++++++++++---------- libavfilter/avfilter.h | 20 ++++++++++---------- libavfilter/defaults.c | 23 +++++++++++------------ 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index a14669a..a0cb7db 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -265,10 +265,9 @@ static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end) av_get_picture_type_char(ref->video->pict_type)); } if (ref->audio) { - av_dlog(ctx, " cl:%"PRId64"d sn:%d s:%d sr:%d p:%d", + av_dlog(ctx, " cl:%"PRId64"d n:%d r:%d p:%d", ref->audio->channel_layout, ref->audio->nb_samples, - ref->audio->size, ref->audio->sample_rate, ref->audio->planar); } @@ -368,16 +367,16 @@ fail: } AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms, - enum AVSampleFormat sample_fmt, int size, - uint64_t channel_layout, int planar) + enum AVSampleFormat sample_fmt, int nb_samples, + uint64_t channel_layout) { AVFilterBufferRef *ret = NULL; if (link->dstpad->get_audio_buffer) - ret = link->dstpad->get_audio_buffer(link, perms, sample_fmt, size, channel_layout, planar); + ret = link->dstpad->get_audio_buffer(link, perms, sample_fmt, nb_samples, channel_layout); if (!ret) - ret = avfilter_default_get_audio_buffer(link, perms, sample_fmt, size, channel_layout, planar); + ret = avfilter_default_get_audio_buffer(link, perms, sample_fmt, nb_samples, channel_layout); if (ret) ret->type = AVMEDIA_TYPE_AUDIO; @@ -584,6 +583,9 @@ void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) /* prepare to copy the samples if the buffer has insufficient permissions */ if ((dst->min_perms & samplesref->perms) != dst->min_perms || dst->rej_perms & samplesref->perms) { + int i, planar = av_sample_fmt_is_planar(samplesref->format); + int planes = !planar ? 1: + av_get_channel_layout_nb_channels(samplesref->audio->channel_layout); av_log(link->dst, AV_LOG_DEBUG, "Copying audio data in avfilter (have perms %x, need %x, reject %x)\n", @@ -591,14 +593,14 @@ void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) link->cur_buf = avfilter_default_get_audio_buffer(link, dst->min_perms, samplesref->format, - samplesref->audio->size, - samplesref->audio->channel_layout, - samplesref->audio->planar); + samplesref->audio->nb_samples, + samplesref->audio->channel_layout); link->cur_buf->pts = samplesref->pts; link->cur_buf->audio->sample_rate = samplesref->audio->sample_rate; /* Copy actual data into new samples buffer */ - memcpy(link->cur_buf->data[0], samplesref->data[0], samplesref->audio->size); + for (i = 0; i < planes; i++) + memcpy(link->cur_buf->extended_data[i], samplesref->extended_data[i], samplesref->linesize[0]); avfilter_unref_buffer(samplesref); } else diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 5f5284a..46c3963 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -109,7 +109,6 @@ typedef struct AVFilterBuffer { typedef struct AVFilterBufferRefAudioProps { uint64_t channel_layout; ///< channel layout of audio buffer int nb_samples; ///< number of audio samples - int size; ///< audio buffer size uint32_t sample_rate; ///< audio buffer sample rate int planar; ///< audio buffer - planar or packed } AVFilterBufferRefAudioProps; @@ -388,8 +387,8 @@ struct AVFilterPad { * Input audio pads only. */ AVFilterBufferRef *(*get_audio_buffer)(AVFilterLink *link, int perms, - enum AVSampleFormat sample_fmt, int size, - uint64_t channel_layout, int planar); + enum AVSampleFormat sample_fmt, int nb_samples, + uint64_t channel_layout); /** * Callback called after the slices of a frame are completely sent. If @@ -474,8 +473,9 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, /** default handler for get_audio_buffer() for audio inputs */ AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms, - enum AVSampleFormat sample_fmt, int size, - uint64_t channel_layout, int planar); + enum AVSampleFormat sample_fmt, + int nb_samples, + uint64_t channel_layout); /** * A helper for query_formats() which sets all links to the same list of @@ -505,8 +505,8 @@ AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link, /** get_audio_buffer() handler for filters which simply pass audio along */ AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms, - enum AVSampleFormat sample_fmt, int size, - uint64_t channel_layout, int planar); + enum AVSampleFormat sample_fmt, int nb_samples, + uint64_t channel_layout); /** * Filter definition. This defines the pads a filter contains, and all the @@ -690,15 +690,15 @@ avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int * be requested * @param perms the required access permissions * @param sample_fmt the format of each sample in the buffer to allocate - * @param size the buffer size in bytes + * @param nb_samples the number of samples per channel * @param channel_layout the number and type of channels per sample in the buffer to allocate * @param planar audio data layout - planar or packed * @return A reference to the samples. This must be unreferenced with * avfilter_unref_buffer when you are finished with it. */ AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms, - enum AVSampleFormat sample_fmt, int size, - uint64_t channel_layout, int planar); + enum AVSampleFormat sample_fmt, int nb_samples, + uint64_t channel_layout); /** * Create an audio buffer reference wrapped around an already diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c index 086fcc0..fcb29e3 100644 --- a/libavfilter/defaults.c +++ b/libavfilter/defaults.c @@ -58,12 +58,13 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int per } AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms, - enum AVSampleFormat sample_fmt, int size, - uint64_t channel_layout, int planar) + enum AVSampleFormat sample_fmt, int nb_samples, + uint64_t channel_layout) { AVFilterBuffer *samples = av_mallocz(sizeof(AVFilterBuffer)); AVFilterBufferRef *ref = NULL; int i, sample_size, chans_nb, bufsize, per_channel_size, step_size = 0; + int planar = av_sample_fmt_is_planar(sample_fmt); char *buf; if (!samples || !(ref = av_mallocz(sizeof(AVFilterBufferRef)))) @@ -77,7 +78,7 @@ AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int per goto fail; ref->audio->channel_layout = channel_layout; - ref->audio->size = size; + ref->audio->nb_samples = nb_samples; ref->audio->planar = planar; /* make sure the buffer gets read permission or it's useless for output */ @@ -89,8 +90,7 @@ AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int per sample_size = av_get_bytes_per_sample(sample_fmt); chans_nb = av_get_channel_layout_nb_channels(channel_layout); - per_channel_size = size/chans_nb; - ref->audio->nb_samples = per_channel_size/sample_size; + per_channel_size = nb_samples * sample_size; /* Set the number of bytes to traverse to reach next sample of a particular channel: * For planar, this is simply the sample size. @@ -101,7 +101,7 @@ AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int per memset(&samples->linesize[chans_nb], 0, (8-chans_nb) * sizeof(samples->linesize[0])); /* Calculate total buffer size, round to multiple of 16 to be SIMD friendly */ - bufsize = (size + 15)&~15; + bufsize = (nb_samples * chans_nb * sample_size + 15)&~15; buf = av_malloc(bufsize); if (!buf) goto fail; @@ -189,9 +189,8 @@ void avfilter_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *sa if (outlink) { outlink->out_buf = avfilter_default_get_audio_buffer(inlink, AV_PERM_WRITE, samplesref->format, - samplesref->audio->size, - samplesref->audio->channel_layout, - samplesref->audio->planar); + samplesref->audio->nb_samples, + samplesref->audio->channel_layout); outlink->out_buf->pts = samplesref->pts; outlink->out_buf->audio->sample_rate = samplesref->audio->sample_rate; avfilter_filter_samples(outlink, avfilter_ref_buffer(outlink->out_buf, ~0)); @@ -293,9 +292,9 @@ AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link, int perms, } AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms, - enum AVSampleFormat sample_fmt, int size, - uint64_t channel_layout, int packed) + enum AVSampleFormat sample_fmt, int nb_samples, + uint64_t channel_layout) { return avfilter_get_audio_buffer(link->dst->outputs[0], perms, sample_fmt, - size, channel_layout, packed); + nb_samples, channel_layout); } -- 1.7.9.5 From anton at khirnov.net Mon May 7 19:34:11 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 7 May 2012 19:34:11 +0200 Subject: [libav-devel] [PATCH 15/22] lavfi: add channel layout/sample rate negotiation. In-Reply-To: <1336412058-14902-1-git-send-email-anton@khirnov.net> References: <1336412058-14902-1-git-send-email-anton@khirnov.net> Message-ID: <1336412058-14902-16-git-send-email-anton@khirnov.net> --- libavfilter/af_resample.c | 11 ++++ libavfilter/avfilter.c | 21 ++++-- libavfilter/avfiltergraph.c | 151 ++++++++++++++++++++++++++++++++----------- libavfilter/defaults.c | 72 +++++++++++++-------- 4 files changed, 187 insertions(+), 68 deletions(-) diff --git a/libavfilter/af_resample.c b/libavfilter/af_resample.c index 2d78f14..b12e861 100644 --- a/libavfilter/af_resample.c +++ b/libavfilter/af_resample.c @@ -31,6 +31,7 @@ #include "audio.h" #include "avfilter.h" +#include "formats.h" #include "internal.h" typedef struct ResampleContext { @@ -56,10 +57,20 @@ static int query_formats(AVFilterContext *ctx) AVFilterFormats *in_formats = avfilter_all_formats(AVMEDIA_TYPE_AUDIO); AVFilterFormats *out_formats = avfilter_all_formats(AVMEDIA_TYPE_AUDIO); + AVFilterFormats *in_samplerates = ff_all_samplerates(); + AVFilterFormats *out_samplerates = ff_all_samplerates(); + AVFilterChannelLayouts *in_layouts = ff_all_channel_layouts(); + AVFilterChannelLayouts *out_layouts = ff_all_channel_layouts(); avfilter_formats_ref(in_formats, &inlink->out_formats); avfilter_formats_ref(out_formats, &outlink->in_formats); + avfilter_formats_ref(in_samplerates, &inlink->out_samplerates); + avfilter_formats_ref(out_samplerates, &outlink->in_samplerates); + + ff_channel_layouts_ref(in_layouts, &inlink->out_channel_layouts); + ff_channel_layouts_ref(out_layouts, &outlink->in_channel_layouts); + return 0; } diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index bd898e3..57108b1 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -28,6 +28,7 @@ #include "libavcodec/avcodec.h" #include "avfilter.h" +#include "formats.h" #include "internal.h" unsigned avfilter_version(void) { @@ -176,6 +177,12 @@ int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, if (link->out_formats) avfilter_formats_changeref(&link->out_formats, &filt->outputs[filt_dstpad_idx]->out_formats); + if (link->out_samplerates) + avfilter_formats_changeref(&link->out_samplerates, + &filt->outputs[filt_dstpad_idx]->out_samplerates); + if (link->out_channel_layouts) + ff_channel_layouts_changeref(&link->out_channel_layouts, + &filt->outputs[filt_dstpad_idx]->out_channel_layouts); return 0; } @@ -216,12 +223,6 @@ int avfilter_config_links(AVFilterContext *filter) link->sample_aspect_ratio = link->src->input_count ? link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1}; - if (link->sample_rate == 0 && link->src && link->src->input_count) - link->sample_rate = link->src->inputs[0]->sample_rate; - - if (link->channel_layout == 0 && link->src && link->src->input_count) - link->channel_layout = link->src->inputs[0]->channel_layout; - if ((config_link = link->dstpad->config_props)) if ((ret = config_link(link)) < 0) return ret; @@ -614,6 +615,10 @@ void avfilter_free(AVFilterContext *filter) link->src->outputs[link->srcpad - link->src->output_pads] = NULL; avfilter_formats_unref(&link->in_formats); avfilter_formats_unref(&link->out_formats); + avfilter_formats_unref(&link->in_samplerates); + avfilter_formats_unref(&link->out_samplerates); + ff_channel_layouts_unref(&link->in_channel_layouts); + ff_channel_layouts_unref(&link->out_channel_layouts); } av_freep(&link); } @@ -623,6 +628,10 @@ void avfilter_free(AVFilterContext *filter) link->dst->inputs[link->dstpad - link->dst->input_pads] = NULL; avfilter_formats_unref(&link->in_formats); avfilter_formats_unref(&link->out_formats); + avfilter_formats_unref(&link->in_samplerates); + avfilter_formats_unref(&link->out_samplerates); + ff_channel_layouts_unref(&link->in_channel_layouts); + ff_channel_layouts_unref(&link->out_channel_layouts); } av_freep(&link); } diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 2ac1bc3..dbd5e0e 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -25,6 +25,7 @@ #include "avfilter.h" #include "avfiltergraph.h" +#include "formats.h" #include "internal.h" #include "libavutil/log.h" @@ -168,9 +169,27 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) for (j = 0; j < filter->input_count; j++) { AVFilterLink *link = filter->inputs[j]; - if (link && link->in_formats != link->out_formats) { - if (!avfilter_merge_formats(link->in_formats, - link->out_formats)) { + int convert_needed = 0; + + if (!link) + continue; + + if (link->in_formats != link->out_formats && + !avfilter_merge_formats(link->in_formats, + link->out_formats)) + convert_needed = 1; + if (link->type == AVMEDIA_TYPE_AUDIO) { + if (link->in_channel_layouts != link->out_channel_layouts && + !ff_merge_channel_layouts(link->in_channel_layouts, + link->out_channel_layouts)) + convert_needed = 1; + if (link->in_samplerates != link->out_samplerates && + !ff_merge_samplerates(link->in_samplerates, + link->out_samplerates)) + convert_needed = 1; + } + + if (convert_needed) { AVFilterContext *convert; AVFilterLink *inlink, *outlink; char scale_args[256]; @@ -207,13 +226,27 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) inlink = convert->inputs[0]; outlink = convert->outputs[0]; if (!avfilter_merge_formats( inlink->in_formats, inlink->out_formats) || - !avfilter_merge_formats(outlink->in_formats, outlink->out_formats)) { + !avfilter_merge_formats(outlink->in_formats, outlink->out_formats)) + ret |= AVERROR(ENOSYS); + if (inlink->type == AVMEDIA_TYPE_AUDIO && + (!ff_merge_samplerates(inlink->in_samplerates, + inlink->out_samplerates) || + !ff_merge_channel_layouts(inlink->in_channel_layouts, + inlink->out_channel_layouts))) + ret |= AVERROR(ENOSYS); + if (outlink->type == AVMEDIA_TYPE_AUDIO && + (!ff_merge_samplerates(outlink->in_samplerates, + outlink->out_samplerates) || + !ff_merge_channel_layouts(outlink->in_channel_layouts, + outlink->out_channel_layouts))) + ret |= AVERROR(ENOSYS); + + if (ret < 0) { av_log(log_ctx, AV_LOG_ERROR, "Impossible to convert between the formats supported by the filter " "'%s' and the filter '%s'\n", link->src->name, link->dst->name); - return AVERROR(EINVAL); + return ret; } - } } } } @@ -221,46 +254,88 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) return 0; } -static void pick_format(AVFilterLink *link) +static int pick_format(AVFilterLink *link) { if (!link || !link->in_formats) - return; + return 0; link->in_formats->format_count = 1; link->format = link->in_formats->formats[0]; + if (link->type == AVMEDIA_TYPE_AUDIO) { + if (!link->in_samplerates->format_count) { + av_log(link->src, AV_LOG_ERROR, "Cannot select sample rate for" + " the link between filters %s and %s.\n", link->src->name, + link->dst->name); + return AVERROR(EINVAL); + } + link->in_samplerates->format_count = 1; + link->sample_rate = link->in_samplerates->formats[0]; + + if (!link->in_channel_layouts->nb_channel_layouts) { + av_log(link->src, AV_LOG_ERROR, "Cannot select channel layout for" + "the link between filters %s and %s.\n", link->src->name, + link->dst->name); + return AVERROR(EINVAL); + } + link->in_channel_layouts->nb_channel_layouts = 1; + link->channel_layout = link->in_channel_layouts->channel_layouts[0]; + } + avfilter_formats_unref(&link->in_formats); avfilter_formats_unref(&link->out_formats); + avfilter_formats_unref(&link->in_samplerates); + avfilter_formats_unref(&link->out_samplerates); + ff_channel_layouts_unref(&link->in_channel_layouts); + ff_channel_layouts_unref(&link->out_channel_layouts); + + return 0; } +#define REDUCE_FORMATS(fmt_type, list_type, list, var, nb, add_format) \ + for (i = 0; i < filter->input_count; i++) { \ + AVFilterLink *link = filter->inputs[i]; \ + fmt_type fmt; \ + \ + if (!link->out_ ## list || link->out_ ## list->nb != 1) \ + continue; \ + fmt = link->out_ ## list->var[0]; \ + \ + for (j = 0; j < filter->output_count; j++) { \ + AVFilterLink *out_link = filter->outputs[j]; \ + list_type *fmts; \ + \ + if (link->type != out_link->type || \ + out_link->in_ ## list->nb == 1) \ + continue; \ + fmts = out_link->in_ ## list; \ + \ + if (!out_link->in_ ## list->nb) { \ + add_format(&out_link->in_ ##list, fmt); \ + break; \ + } \ + \ + for (k = 0; k < out_link->in_ ## list->nb; k++) \ + if (fmts->var[k] == fmt) { \ + fmts->var[0] = fmt; \ + fmts->nb = 1; \ + ret = 1; \ + break; \ + } \ + } \ + } + static int reduce_formats_on_filter(AVFilterContext *filter) { int i, j, k, ret = 0; - for (i = 0; i < filter->input_count; i++) { - AVFilterLink *link = filter->inputs[i]; - int format = link->out_formats->formats[0]; - - if (link->out_formats->format_count != 1) - continue; - - for (j = 0; j < filter->output_count; j++) { - AVFilterLink *out_link = filter->outputs[j]; - AVFilterFormats *fmts = out_link->in_formats; + REDUCE_FORMATS(int, AVFilterFormats, formats, formats, + format_count, avfilter_add_format); + REDUCE_FORMATS(int, AVFilterFormats, samplerates, formats, + format_count, avfilter_add_format); + REDUCE_FORMATS(uint64_t, AVFilterChannelLayouts, channel_layouts, + channel_layouts, nb_channel_layouts, ff_add_channel_layout); - if (link->type != out_link->type || - out_link->in_formats->format_count == 1) - continue; - - for (k = 0; k < out_link->in_formats->format_count; k++) - if (fmts->formats[k] == format) { - fmts->formats[0] = format; - fmts->format_count = 1; - ret = 1; - break; - } - } - } return ret; } @@ -276,18 +351,21 @@ static void reduce_formats(AVFilterGraph *graph) } while (reduced); } -static void pick_formats(AVFilterGraph *graph) +static int pick_formats(AVFilterGraph *graph) { - int i, j; + int i, j, ret; for (i = 0; i < graph->filter_count; i++) { AVFilterContext *filter = graph->filters[i]; for (j = 0; j < filter->input_count; j++) - pick_format(filter->inputs[j]); + if ((ret = pick_format(filter->inputs[j])) < 0) + return ret; for (j = 0; j < filter->output_count; j++) - pick_format(filter->outputs[j]); + if ((ret = pick_format(filter->outputs[j])) < 0) + return ret; } + return 0; } int ff_avfilter_graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx) @@ -303,7 +381,8 @@ int ff_avfilter_graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx) * of format conversion inside filters */ reduce_formats(graph); - pick_formats(graph); + if ((ret = pick_formats(graph)) < 0) + return ret; return 0; } diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c index caf6442..cb7bf1c 100644 --- a/libavfilter/defaults.c +++ b/libavfilter/defaults.c @@ -25,6 +25,7 @@ #include "avfilter.h" #include "internal.h" +#include "formats.h" /* TODO: buffer pool. see comment for avfilter_default_get_video_buffer() */ void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr) @@ -112,9 +113,6 @@ int avfilter_default_config_output_link(AVFilterLink *link) link->w = link->src->inputs[0]->w; link->h = link->src->inputs[0]->h; link->time_base = link->src->inputs[0]->time_base; - } else if (link->type == AVMEDIA_TYPE_AUDIO) { - link->channel_layout = link->src->inputs[0]->channel_layout; - link->sample_rate = link->src->inputs[0]->sample_rate; } } else { /* XXX: any non-simple filter which would cause this branch to be taken @@ -125,36 +123,53 @@ int avfilter_default_config_output_link(AVFilterLink *link) return 0; } +#define SET_COMMON_FORMATS(ctx, fmts, in_fmts, out_fmts, ref, list) \ +{ \ + int count = 0, i; \ + \ + for (i = 0; i < ctx->input_count; i++) { \ + if (ctx->inputs[i]) { \ + ref(fmts, &ctx->inputs[i]->out_fmts); \ + count++; \ + } \ + } \ + for (i = 0; i < ctx->output_count; i++) { \ + if (ctx->outputs[i]) { \ + ref(fmts, &ctx->outputs[i]->in_fmts); \ + count++; \ + } \ + } \ + \ + if (!count) { \ + av_freep(&fmts->list); \ + av_freep(&fmts->refs); \ + av_freep(&fmts); \ + } \ +} + +void ff_set_common_channel_layouts(AVFilterContext *ctx, + AVFilterChannelLayouts *layouts) +{ + SET_COMMON_FORMATS(ctx, layouts, in_channel_layouts, out_channel_layouts, + ff_channel_layouts_ref, channel_layouts); +} + +void ff_set_common_samplerates(AVFilterContext *ctx, + AVFilterFormats *samplerates) +{ + SET_COMMON_FORMATS(ctx, samplerates, in_samplerates, out_samplerates, + avfilter_formats_ref, formats); +} + /** * A helper for query_formats() which sets all links to the same list of * formats. If there are no links hooked to this filter, the list of formats is * freed. - * - * FIXME: this will need changed for filters with a mix of pad types - * (video + audio, etc) */ void avfilter_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats) { - int count = 0, i; - - for (i = 0; i < ctx->input_count; i++) { - if (ctx->inputs[i]) { - avfilter_formats_ref(formats, &ctx->inputs[i]->out_formats); - count++; - } - } - for (i = 0; i < ctx->output_count; i++) { - if (ctx->outputs[i]) { - avfilter_formats_ref(formats, &ctx->outputs[i]->in_formats); - count++; - } - } - - if (!count) { - av_free(formats->formats); - av_free(formats->refs); - av_free(formats); - } + SET_COMMON_FORMATS(ctx, formats, in_formats, out_formats, + avfilter_formats_ref, formats); } int avfilter_default_query_formats(AVFilterContext *ctx) @@ -164,6 +179,11 @@ int avfilter_default_query_formats(AVFilterContext *ctx) AVMEDIA_TYPE_VIDEO; avfilter_set_common_formats(ctx, avfilter_all_formats(type)); + if (type == AVMEDIA_TYPE_AUDIO) { + ff_set_common_channel_layouts(ctx, ff_all_channel_layouts()); + ff_set_common_samplerates(ctx, ff_all_samplerates()); + } + return 0; } -- 1.7.9.5 From anton at khirnov.net Mon May 7 19:34:12 2012 From: anton at khirnov.net (Anton Khirnov) Date: Mon, 7 May 2012 19:34:12 +0200 Subject: [libav-devel] [PATCH 16/22] lavfi: rename vsrc_buffer.c to buffersrc.c In-Reply-To: <1336412058-14902-1-git-send-email-anton@khirnov.net> References: <1336412058-14902-1-git-send-email-anton@khirnov.net> Message-ID: <1336412058-14902-17-git-send-email-anton@khirnov.net> Most of the code will be shared for both audio and video version. --- libavfilter/Makefile | 2 +- libavfilter/buffersrc.c | 215 +++++++++++++++++++++++++++++++++++++++++++++ libavfilter/vsrc_buffer.c | 215 --------------------------------------------- 3 files changed, 216 insertions(+), 216 deletions(-) create mode 100644 libavfilter/buffersrc.c delete mode 100644 libavfilter/vsrc_buffer.c diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 342f4a9..2836d32 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -15,12 +15,12 @@ OBJS = af_resample.o \ avfilter.o \ avfiltergraph.o \ buffersink.o \ + buffersrc.o \ defaults.o \ drawutils.o \ formats.o \ graphparser.o \ vf_scale.o \ - vsrc_buffer.o \ OBJS-$(CONFIG_ANULL_FILTER) += af_anull.o diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c new file mode 100644 index 0000000..1ace368 --- /dev/null +++ b/libavfilter/buffersrc.c @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2008 Vitor Sessak + * + * 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 + */ + +/** + * @file + * memory buffer source filter + */ + +#include "avfilter.h" +#include "buffersrc.h" +#include "vsrc_buffer.h" +#include "libavutil/fifo.h" +#include "libavutil/imgutils.h" + +typedef struct { + AVFifoBuffer *fifo; + int h, w; + enum PixelFormat pix_fmt; + AVRational time_base; ///< time_base to set in the output link + AVRational pixel_aspect; + int eof; +} BufferSourceContext; + +#define CHECK_PARAM_CHANGE(s, c, width, height, format)\ + if (c->w != width || c->h != height || c->pix_fmt != format) {\ + av_log(s, AV_LOG_ERROR, "Changing frame properties on the fly is not supported.\n");\ + return AVERROR(EINVAL);\ + } + +int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, + int64_t pts, AVRational pixel_aspect) +{ + BufferSourceContext *c = buffer_filter->priv; + AVFilterBufferRef *buf; + int ret; + + if (!frame) { + c->eof = 1; + return 0; + } else if (c->eof) + return AVERROR(EINVAL); + + if (!av_fifo_space(c->fifo) && + (ret = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) + + sizeof(buf))) < 0) + return ret; + + CHECK_PARAM_CHANGE(buffer_filter, c, frame->width, frame->height, frame->format); + + buf = avfilter_get_video_buffer(buffer_filter->outputs[0], AV_PERM_WRITE, + c->w, c->h); + av_image_copy(buf->data, buf->linesize, frame->data, frame->linesize, + c->pix_fmt, c->w, c->h); + + avfilter_copy_frame_props(buf, frame); + buf->pts = pts; + buf->video->pixel_aspect = pixel_aspect; + + if ((ret = av_fifo_generic_write(c->fifo, &buf, sizeof(buf), NULL)) < 0) { + avfilter_unref_buffer(buf); + return ret; + } + + return 0; +} + +int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf) +{ + BufferSourceContext *c = s->priv; + int ret; + + if (!buf) { + c->eof = 1; + return 0; + } else if (c->eof) + return AVERROR(EINVAL); + + if (!av_fifo_space(c->fifo) && + (ret = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) + + sizeof(buf))) < 0) + return ret; + + CHECK_PARAM_CHANGE(s, c, buf->video->w, buf->video->h, buf->format); + + if ((ret = av_fifo_generic_write(c->fifo, &buf, sizeof(buf), NULL)) < 0) + return ret; + + return 0; +} + +static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) +{ + BufferSourceContext *c = ctx->priv; + char pix_fmt_str[128]; + int n = 0; + + if (!args || + (n = sscanf(args, "%d:%d:%127[^:]:%d:%d:%d:%d", &c->w, &c->h, pix_fmt_str, + &c->time_base.num, &c->time_base.den, + &c->pixel_aspect.num, &c->pixel_aspect.den)) != 7) { + av_log(ctx, AV_LOG_ERROR, "Expected 7 arguments, but %d found in '%s'\n", n, args); + return AVERROR(EINVAL); + } + if ((c->pix_fmt = av_get_pix_fmt(pix_fmt_str)) == PIX_FMT_NONE) { + char *tail; + c->pix_fmt = strtol(pix_fmt_str, &tail, 10); + if (*tail || c->pix_fmt < 0 || c->pix_fmt >= PIX_FMT_NB) { + av_log(ctx, AV_LOG_ERROR, "Invalid pixel format string '%s'\n", pix_fmt_str); + return AVERROR(EINVAL); + } + } + + if (!(c->fifo = av_fifo_alloc(sizeof(AVFilterBufferRef*)))) + return AVERROR(ENOMEM); + + av_log(ctx, AV_LOG_INFO, "w:%d h:%d pixfmt:%s\n", c->w, c->h, av_pix_fmt_descriptors[c->pix_fmt].name); + return 0; +} + +static av_cold void uninit(AVFilterContext *ctx) +{ + BufferSourceContext *s = ctx->priv; + while (av_fifo_size(s->fifo)) { + AVFilterBufferRef *buf; + av_fifo_generic_read(s->fifo, &buf, sizeof(buf), NULL); + avfilter_unref_buffer(buf); + } + av_fifo_free(s->fifo); + s->fifo = NULL; +} + +static int query_formats(AVFilterContext *ctx) +{ + BufferSourceContext *c = ctx->priv; + enum PixelFormat pix_fmts[] = { c->pix_fmt, PIX_FMT_NONE }; + + avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); + return 0; +} + +static int config_props(AVFilterLink *link) +{ + BufferSourceContext *c = link->src->priv; + + link->w = c->w; + link->h = c->h; + link->sample_aspect_ratio = c->pixel_aspect; + link->time_base = c->time_base; + + return 0; +} + +static int request_frame(AVFilterLink *link) +{ + BufferSourceContext *c = link->src->priv; + AVFilterBufferRef *buf; + + if (!av_fifo_size(c->fifo)) { + if (c->eof) + return AVERROR_EOF; + return AVERROR(EAGAIN); + } + av_fifo_generic_read(c->fifo, &buf, sizeof(buf), NULL); + + avfilter_start_frame(link, avfilter_ref_buffer(buf, ~0)); + avfilter_draw_slice(link, 0, link->h, 1); + avfilter_end_frame(link); + avfilter_unref_buffer(buf); + + return 0; +} + +static int poll_frame(AVFilterLink *link) +{ + BufferSourceContext *c = link->src->priv; + int size = av_fifo_size(c->fifo); + if (!size && c->eof) + return AVERROR_EOF; + return size/sizeof(AVFilterBufferRef*); +} + +AVFilter avfilter_vsrc_buffer = { + .name = "buffer", + .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them accessible to the filterchain."), + .priv_size = sizeof(BufferSourceContext), + .query_formats = query_formats, + + .init = init, + .uninit = uninit, + + .inputs = (AVFilterPad[]) {{ .name = NULL }}, + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .request_frame = request_frame, + .poll_frame = poll_frame, + .config_props = config_props, }, + { .name = NULL}}, +}; diff --git a/libavfilter/vsrc_buffer.c b/libavfilter/vsrc_buffer.c deleted file mode 100644 index 1ace368..0000000 --- a/libavfilter/vsrc_buffer.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (c) 2008 Vitor Sessak - * - * 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 - */ - -/** - * @file - * memory buffer source filter - */ - -#include "avfilter.h" -#include "buffersrc.h" -#include "vsrc_buffer.h" -#include "libavutil/fifo.h" -#include "libavutil/imgutils.h" - -typedef struct { - AVFifoBuffer *fifo; - int h, w; - enum PixelFormat pix_fmt; - AVRational time_base; ///< time_base to set in the output link - AVRational pixel_aspect; - int eof; -} BufferSourceContext; - -#define CHECK_PARAM_CHANGE(s, c, width, height, format)\ - if (c->w != width || c->h != height || c->pix_fmt != format) {\ - av_log(s, AV_LOG_ERROR, "Changing frame properties on the fly is not supported.\n");\ - return AVERROR(EINVAL);\ - } - -int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, - int64_t pts, AVRational pixel_aspect) -{ - BufferSourceContext *c = buffer_filter->priv; - AVFilterBufferRef *buf; - int ret; - - if (!frame) { - c->eof = 1; - return 0; - } else if (c->eof) - return AVERROR(EINVAL); - - if (!av_fifo_space(c->fifo) && - (ret = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) + - sizeof(buf))) < 0) - return ret; - - CHECK_PARAM_CHANGE(buffer_filter, c, frame->width, frame->height, frame->format); - - buf = avfilter_get_video_buffer(buffer_filter->outputs[0], AV_PERM_WRITE, - c->w, c->h); - av_image_copy(buf->data, buf->linesize, frame->data, frame->linesize, - c->pix_fmt, c->w, c->h); - - avfilter_copy_frame_props(buf, frame); - buf->pts = pts; - buf->video->pixel_aspect = pixel_aspect; - - if ((ret = av_fifo_generic_write(c->fifo, &buf, sizeof(buf), NULL)) < 0) { - avfilter_unref_buffer(buf); - return ret; - } - - return 0; -} - -int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf) -{ - BufferSourceContext *c = s->priv; - int ret; - - if (!buf) { - c->eof = 1; - return 0; - } else if (c->eof) - return AVERROR(EINVAL); - - if (!av_fifo_space(c->fifo) && - (ret = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) + - sizeof(buf))) < 0) - return ret; - - CHECK_PARAM_CHANGE(s, c, buf->video->w, buf->video->h, buf->format); - - if ((ret = av_fifo_generic_write(c->fifo, &buf, sizeof(buf), NULL)) < 0) - return ret; - - return 0; -} - -static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) -{ - BufferSourceContext *c = ctx->priv; - char pix_fmt_str[128]; - int n = 0; - - if (!args || - (n = sscanf(args, "%d:%d:%127[^:]:%d:%d:%d:%d", &c->w, &c->h, pix_fmt_str, - &c->time_base.num, &c->time_base.den, - &c->pixel_aspect.num, &c->pixel_aspect.den)) != 7) { - av_log(ctx, AV_LOG_ERROR, "Expected 7 arguments, but %d found in '%s'\n", n, args); - return AVERROR(EINVAL); - } - if ((c->pix_fmt = av_get_pix_fmt(pix_fmt_str)) == PIX_FMT_NONE) { - char *tail; - c->pix_fmt = strtol(pix_fmt_str, &tail, 10); - if (*tail || c->pix_fmt < 0 || c->pix_fmt >= PIX_FMT_NB) { - av_log(ctx, AV_LOG_ERROR, "Invalid pixel format string '%s'\n", pix_fmt_str); - return AVERROR(EINVAL); - } - } - - if (!(c->fifo = av_fifo_alloc(sizeof(AVFilterBufferRef*)))) - return AVERROR(ENOMEM); - - av_log(ctx, AV_LOG_INFO, "w:%d h:%d pixfmt:%s\n", c->w, c->h, av_pix_fmt_descriptors[c->pix_fmt].name); - return 0; -} - -static av_cold void uninit(AVFilterContext *ctx) -{ - BufferSourceContext *s = ctx->priv; - while (av_fifo_size(s->fifo)) { - AVFilterBufferRef *buf; - av_fifo_generic_read(s->fifo, &buf, sizeof(buf), NULL); - avfilter_unref_buffer(buf); - } - av_fifo_free(s->fifo); - s->fifo = NULL; -} - -static int query_formats(AVFilterContext *ctx) -{ - BufferSourceContext *c = ctx->priv; - enum PixelFormat pix_fmts[] = { c->pix_fmt, PIX_FMT_NONE }; - - avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); - return 0; -} - -static int config_props(AVFilterLink *link) -{ - BufferSourceContext *c = link->src->priv; - - link->w = c->w; - link->h = c->h; - link->sample_aspect_ratio = c->pixel_aspect; - link->time_base = c->time_base; - - return 0; -} - -static int request_frame(AVFilterLink *link) -{ - BufferSourceContext *c = link->src->priv; - AVFilterBufferRef *buf; - - if (!av_fifo_size(c->fifo)) { - if (c->eof) - return AVERROR_EOF; - return AVERROR(EAGAIN); - } - av_fifo_generic_read(c->fifo, &buf, sizeof(buf), NULL); - - avfilter_start_frame(link, avfilter_ref_buffer(buf, ~0)); - avfilter_draw_slice(link, 0, link->h, 1); - avfilter_end_frame(link