Re: [FFmpeg-devel] [PATCHv2] lavu/libm: add erf hack and make dynaudnorm available everywhere

2015-12-22 Thread Hendrik Leppkes
Am 21.12.2015 18:18 schrieb "James Almer" :
>
> On 12/21/2015 2:08 PM, Ganesh Ajjanagadde wrote:
> > Pushed with slight modifications.
> >
> > This is a request to any running MSVC/other platform lacking erf: can
> > you please test to make sure this works?
>
> Check http://fate.ffmpeg.org/ for new failures later today. Look for
VS2012
> and VS2013.

erf is actually supported since 2013, so only 2012 would be of note.

> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH]ffserver: Cast time_t value when using it in a format string.

2015-12-22 Thread Carl Eugen Hoyos
Hi!

Attached patch should fix ticket #5103.

Please comment, Carl Eugen
diff --git a/ffserver.c b/ffserver.c
index c7dbb16..788ee6e 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -3853,7 +3853,7 @@ static void handle_child_exit(int sig)
 fprintf(stderr,
 "%s: Pid %"PRId64" exited with status %d after %"PRId64" "
 "seconds\n",
-feed->filename, (int64_t) pid, status, uptime);
+feed->filename, (int64_t) pid, status, (int64_t)uptime);
 
 if (uptime < 30)
 /* Turn off any more restarts */
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavfi/af_aemphasis: remove unnecessary complex number usage

2015-12-22 Thread Paul B Mahol
On 12/22/15, Ganesh Ajjanagadde  wrote:
> complex is not available on all platforms. Furthermore, it is trivial to
> rewrite complex number expressions to real arithmetic, and in fact
> sometimes advantageous for performance reasons: by wrapping as a complex,
> one forces a particular Cartesian representation that is not necessarily
> optimal for the purpose.
>
> Configure tests are also removed, and aemphasis is now available across
> all platforms.
>
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  configure  | 26 --
>  libavfilter/af_aemphasis.c | 13 ++---
>  2 files changed, 6 insertions(+), 33 deletions(-)
>
> diff --git a/configure b/configure
> index 0227540..46021c4 100755
> --- a/configure
> +++ b/configure
> @@ -1070,21 +1070,6 @@ int main(void){ $func(); }
>  EOF
>  }
>
> -check_complexfunc(){
> -log check_complexfunc "$@"
> -func=$1
> -narg=$2
> -shift 2
> -test $narg = 2 && args="f, g" || args="f * I"
> -disable $func
> -check_ld "cc" "$@" < -#include 
> -#include 
> -float foo(complex float f, complex float g) { return $func($args); }
> -int main(void){ return (int) foo; }
> -EOF
> -}
> -
>  check_mathfunc(){
>  log check_mathfunc "$@"
>  func=$1
> @@ -1803,11 +1788,6 @@ INTRINSICS_LIST="
>  intrinsics_neon
>  "
>
> -COMPLEX_FUNCS="
> -cabs
> -cexp
> -"
> -
>  MATH_FUNCS="
>  atanf
>  atan2f
> @@ -1944,7 +1924,6 @@ HAVE_LIST="
>  $ARCH_FEATURES
>  $ATOMICS_LIST
>  $BUILTIN_LIST
> -$COMPLEX_FUNCS
>  $HAVE_LIST_CMDLINE
>  $HAVE_LIST_PUB
>  $HEADERS_LIST
> @@ -2835,7 +2814,6 @@ unix_protocol_deps="sys_un_h"
>  unix_protocol_select="network"
>
>  # filters
> -aemphasis_filter_deps="cabs cexp"
>  amovie_filter_deps="avcodec avformat"
>  aresample_filter_deps="swresample"
>  ass_filter_deps="libass"
> @@ -5379,10 +5357,6 @@ for func in $MATH_FUNCS; do
>  eval check_mathfunc $func \${${func}_args:-1}
>  done
>
> -for func in $COMPLEX_FUNCS; do
> -eval check_complexfunc $func \${${func}_args:-1}
> -done
> -
>  # these are off by default, so fail if requested and not available
>  enabled avfoundation_indev && { check_header_objcc
> AVFoundation/AVFoundation.h || disable avfoundation_indev; }
>  enabled avfoundation_indev && { check_lib2 CoreGraphics/CoreGraphics.h
> CGGetActiveDisplayList -framework CoreGraphics ||
> diff --git a/libavfilter/af_aemphasis.c b/libavfilter/af_aemphasis.c
> index 2966f77..a5b8e30 100644
> --- a/libavfilter/af_aemphasis.c
> +++ b/libavfilter/af_aemphasis.c
> @@ -18,8 +18,6 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
> USA
>   */
>
> -#include 
> -
>  #include "libavutil/opt.h"
>  #include "avfilter.h"
>  #include "internal.h"
> @@ -189,14 +187,15 @@ static inline void set_lp_rbj(BiquadD2 *bq, double fc,
> double q, double sr, doub
>
>  static double freq_gain(BiquadCoeffs *c, double freq, double sr)
>  {
> -double complex z, w;
> +double zr, zi;
>
>  freq *= 2.0 * M_PI / sr;
> -w = 0 + I * freq;
> -z = 1.0 / cexp(w);
> +zr = cos(freq);
> +zi = -sin(freq);
>
> -return cabs(((double complex)c->a0 + c->a1 * z + c->a2 * z*z) /
> -((double complex)1.0 + c->b1 * z + c->b2 * z*z));
> +/* |(a0 + a1*z + a2*z^2)/(1 + b1*z + b2*z^2)| */
> +return hypot(c->a0 + c->a1*zr + c->a2*(zr*zr-zi*zi), c->a1*zi +
> 2*c->a2*zr*zi) /
> +   hypot(1 + c->b1*zr + c->b2*(zr*zr-zi*zi), c->b1*zi +
> 2*c->b2*zr*zi);
>  }
>
>  static int config_input(AVFilterLink *inlink)
> --
> 2.6.4
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

ok
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavformat: palettized QuickTime in Matroska, round 2

2015-12-22 Thread Mats Peterson

On 12/22/2015 03:55 AM, Mats Peterson wrote:

Alright, this is take two of my fix for palettized QuickTime video in
Matroska. I have reset the lower limit of V_QUICKTIME private data to 21
in matroskadec.c, in order to make that broken file pass, Michael. The
minimum size of a video sample description in QuickTime is really 86,
for the record.

Also, I've added copyright notices of the former authors of mov.c to the
new file qtpalette.c, since the code in that file is borrowed from mov.c
to a major extent, albeit with some modifications.

Original explanation of the patch follows:

Palettized QuickTime video in Matroska has hitherto not been recognized
whatsoever, and the "palette" used has been completely random.

The patch for matroskadec.c fixes this issue by adding a palette side
data packet in matroska_deliver_packet(), much in the same way as it's
done in mov.c.

The change to mov.c consists mainly of moving the palette handling from
the mov_parse_stsd_video() function to a new get_qtpalette() function in
the new file qtpalette.c, which is shared by both matroskadec.c and mov.c.

In matroskadec.c, I'm also putting the palette in 'extradata', like it's
done for V_MS/VFW/FOURCC; this is a requirement in order for MPlayer to
recognize the palette.



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



Once again, samples for testing are available at 
https://drive.google.com/open?id=0B3_pEBoLs0faWElmM2FnLTZYNlk . The file 
smoothie.mov doesn't render correctly for some reason, but that's a 
different issue. Perhaps someone could investigate further.


Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] phasing out asyntcs, resample

2015-12-22 Thread Rostislav Pehlivanov
On Mon, 2015-12-21 at 14:32 -0800, Ganesh Ajjanagadde wrote:
> Hi,
> 
> While hunting through configure for some easy to remove filter
> dependencies, I came across asyncts which depends on avresample. So I
> started some work to port it over to swresample, and get rid of this
> unnecessary dependency.
> 
> But then I saw the docs:
> https://www.ffmpeg.org/ffmpeg-filters.html#asyncts which effectively
> claims that aresample subsumes it. What I don't understand is the
> following:
> 
> 1. swresample dates to 2012, and was utilized for aresample around
> then. If aresample indeed subsumes asyncts, why not mark asyncts
> deprecated, issue a warning telling users to switch to aresample, and
> phase it out after some time. If it is indeed obsolete, it is useless
> maintainence burden (with even some recent activity that is wasted
> energy).
> 2. The craziness of having 3 filters for essentially the same task:
> aresample, resample, asyncts. Seems like resample is the avresample
> equivalent of the swresample based aresample. Same remark above
> applies to resample.
> 
> This is a request for resolution on this topic.
> 


Yes, I agree with you. It's not a problem that they are a maintenence
burden (as if someone actively maintains them) but rather that they
overlap in use and some are missing features. I'd rather have a single
filter which has more options and does its job well than having 3 of
them. Same with libavresample.

Also, I think that it's better to just send a patch which removes them
instead of only warning and then let the discussion go on there.

Just because there are sillier things out there in the code (e.g.
prores) doesn't mean that this should get a free pass until that is
sorted out.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] phasing out asyntcs, resample

2015-12-22 Thread Carl Eugen Hoyos
Rostislav Pehlivanov  gmail.com> writes:

> Also, I think that it's better to just send a patch which 
> removes them instead of only warning and then let the 
> discussion go on there.

+1

Carl Eugen

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH][RFC] lavu/libm: add exp10 support

2015-12-22 Thread Michael Niedermayer
On Mon, Dec 21, 2015 at 07:19:50PM -0800, Ganesh Ajjanagadde wrote:
> exp10 is a function available in GNU libm. Looks like no other common
> libm has it. As such, I am mostly neutral about its inclusion, with a
> very slight bias in favor since I am actually posting this.
> 
> pros:
> 1. It is faster than pow, and has less of a chance of going into one of
> the terribly slow paths:
> https://github.com/andikleen/glibc/blob/rtm-devel9/sysdeps/ieee754/dbl-64/e_exp10.c
> vs
> https://github.com/andikleen/glibc/blob/rtm-devel9/sysdeps/ieee754/dbl-64/e_pow.c.
> Speedup is roughly 30% of the original execution time for an "average"
> benchmark over 1e8 arguments uniformly spaced from -1 to 1
> (similar results for other intervals):
> ./test  4.07s user 0.00s system 100% cpu 4.068 total (exp10)
> ./test  5.71s user 0.00s system 100% cpu 5.711 total (pow)
> 
> cons:
> 1. It is GNU libm only, and requires -D_GNU_SOURCE.
> 2. Speedup is not that impressive.

> 3. pow(10, x) is not terribly common in the code, and still cheaper
> approximation (not as accurate, but often reasonable) exp(ln(10)*x) is
> much faster:
> ./test  2.55s user 0.00s system 99% cpu 2.548 total (exp(ln(10)*x))

IMHO a exp10 fallback should be implemented using exp2() if that is faster
and available.

Code requiring absolute accuracy must be written using integers as C
does not gurantee accuracy for float and double.
A single libc or fallback providing more accuracy does not really help
as our code must function correctly in the absence of such accuracy
also the accuracy difference between exp2() and pow() should be
negligible


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] can't build the ffmpeg for iOS using the newest gas-preprocessor.pl

2015-12-22 Thread zhuhb
I download the newest gas-preprocessor.pl from 
https://github.com/ffmpeg/gas-preprocessor and install it to the path.

Then I try to build the ffmpeg v2.7.1 and failed.

 

The build .sh is as follows:

SDKVERSION=""

MIN_IPHONE_VERSION="5.1"

 

ARCHS="armv7 arm64"

 

DEVELOPER=`xcode-select -print-path`

 

REPOROOT=$(pwd)

 

BUILDDIR="${REPOROOT}/build"

mkdir -p $BUILDDIR

 

# where we will store intermediary builds

INTERDIR="${BUILDDIR}/ios-all"

mkdir -p $INTERDIR

 

source ./ffmpeg-config-macro-all

FFMPEG_FLAGS="$FFMPEG_FLAGS_IOS"

for ARCH in ${ARCHS}

do

if [ "${ARCH}" == "i386" ];

then

PLATFORM="iPhoneSimulator"

EXTRA_CONFIG=" --arch=i386 --enable-cross-compile --target-os=darwin 
--cpu=i386 "

EXTRA_CFLAGS=" -arch i386 "

EXTRA_LDFLAGS="-arch i386 "

elif [ "${ARCH}" == "arm64" ];

then

PLATFORM="iPhoneOS"

EXTRA_CONFIG="--arch=arm64 --target-os=darwin --enable-cross-compile 
--disable-armv5te"

EXTRA_CFLAGS="-w -arch ${ARCH} -mfpu=neon"

EXTRA_LDFLAGS="-mfpu=neon"

else

PLATFORM="iPhoneOS"

EXTRA_CONFIG="--arch=arm --target-os=darwin --enable-cross-compile 
--cpu=cortex-a9 --disable-armv5te"

EXTRA_CFLAGS="-w -arch ${ARCH} -mfpu=neon"

EXTRA_LDFLAGS="-mfpu=neon"

fi

 

mkdir -p "${INTERDIR}/${ARCH}"

 

  if [ "${ARCH}" == "i386" ];

  then

./configure $FFMPEG_FLAGS --prefix="${INTERDIR}/${ARCH}" --disable-armv6 
--disable-armv6t2 --extra-cflags="${EXTRA_CFLAGS} -I $SOURCE/include/ios" 
--extra-ldflags="${EXTRA_LDFLAGS} -L $SOURCE/lib/ios" ${EXTRA_CONFIG} 
--enable-pic 
--extra-cflags="-I/Users/iqiyi/local/opencore-amr/ios/${ARCH}/include" 
--extra-ldflags="-L/Users/iqiyi/local/opencore-amr/ios/${ARCH}/lib" 
--extra-cflags="-fembed-bitcode"

  else

./configure $FFMPEG_FLAGS --prefix="${INTERDIR}/${ARCH}" --disable-armv6 
--disable-armv6t2 
--sysroot="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk"
 --cc="${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" 
--as='gas-preprocessor.pl 
/Applications/XCode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang'
 --extra-cflags="${EXTRA_CFLAGS} -miphoneos-version-min=${MIN_IPHONE_VERSION} 
-I${OUTPUTDIR}/include -I $SOURCE/include/ios" --extra-ldflags="-arch ${ARCH} 
${EXTRA_LDFLAGS} -isysroot 
/Applications/Xcode.app/Contents/Developer/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk
 -miphoneos-version-min=${MIN_IPHONE_VERSION} -L${OUTPUTDIR}/lib -L 
$SOURCE/lib/ios" ${EXTRA_CONFIG} --enable-pic --extra-cxxflags="$CPPFLAGS 
-I${OUTPUTDIR}/include -isysroot 
${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk"
 --extra-cflags="-I/Users/iqiyi/local/opencore-amr/ios/${ARCH}/include" 
--extra-ldflags="-L/Users/iqiyi/local/opencore-amr/ios/${ARCH}/lib" 
--extra-cflags="-fembed-bitcode"

  fi

 

  make clean

  make && make install && make clean

 

done

 

UNIVERSAL_DIR=`pwd`/../ffmpeg_player/libs/all/ios && rm -rf ${UNIVERSAL_DIR}

mkdir -p "${UNIVERSAL_DIR}/lib"

 

cd "${INTERDIR}/armv7/lib"

for file in *.a

do

 

cd ${INTERDIR}

#xcrun -sdk iphoneos lipo -output ${UNIVERSAL_DIR}/lib/$file  -create -arch 
armv7 armv7/lib/$file -arch armv7s armv7s/lib/$file -arch arm64 arm64/lib/$file 
-arch i386 i386/lib/$file

xcrun -sdk iphoneos lipo -output ${UNIVERSAL_DIR}/lib/$file  -create -arch 
armv7 armv7/lib/$file -arch arm64 arm64/lib/$file

echo "Universal $file created."

 

done

cp -r ${INTERDIR}/armv7/include ${UNIVERSAL_DIR}/

 

echo "Done."

 

The error for arm32 build is:

./ffmpeg-ios-all.sh 

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr 
--with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr 
--with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1

install prefix
/Users/liuweiwei/player/ffmpeg/h265_decoder/build/ios-all/armv7

source path   .

C compiler
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang

C library 

host C compiler   gcc

host C library

ARCH  arm (cortex-a9)

big-endianno

runtime cpu detection yes

ARMv5TE enabled   no

ARMv6 enabled no

ARMv6T2 enabled   no

VFP enabled   yes

NEON enabled  yes

THUMB enabled yes

debug symbols no

strip symbols yes

optimize for size yes

optimizations yes

staticyes

sharedno

postprocessing supportyes

new filter support   

Re: [FFmpeg-devel] support for reading / writing encrypted MP4 files

2015-12-22 Thread Michael Niedermayer
On Tue, Dec 22, 2015 at 07:36:41AM +, Eran Kornblau wrote:
> > > You're right, didn't know that.
> > > Please let me know if there are any changes you want me to apply in order 
> > > to push the third one (decryption support).
> > 
> > sounds like you missed:
> > http://ffmpeg.org/pipermail/ffmpeg-devel/2015-December/185235.html
> > http://ffmpeg.org/pipermail/ffmpeg-devel/2015-December/185238.html
> > 
> Correct, I missed it. It's just that I'm not getting any emails from this 
> mailing list 
> (verified they are not getting to the junk folder...). 

you are not subscribed (with this email address you used here at least
it seems)


> So I've been polling the page of the last message of this thread in 
> ffmpeg.org,
> and guess these posts were added to a different leaf of the message tree...
> Would really appreciate it if this could be resolved, either add my work 
> email -
> eran dot kornblau at kaltura dot com or my personal email - 
> erankor at gmail dot com.
> 
> > if you want to maintain the code in the future then please send a
> > patch that adds you to the maintainers file
> > 
> Attached

applied


> > 
> > > +id = mov_codec_id(st, format);
> > > +st->codec->codec_id = id;
> > 
> > doesnt this allow changing the codec id to anything from anything ?
> > this seems potentially risky
> > 
> I see options to address this:
> 1. overwrite the codec_id only when it's AV_CODEC_ID_NONE
> 2. (stricter) save the format 4cc (that is loaded in 
> ff_mov_read_stsd_entries) to some member of 
> MOVStreamContext, and overwrite the codec id only when the format is 'encv' 
> or 'enca'
> 
> please let me know which one you prefer, and I will update the patch.

i think the strcter variant sounds more robust

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

DNS cache poisoning attacks, popular search engine, Google internet authority
dont be evil, please


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] can't build the ffmpeg for iOS using the newest gas-preprocessor.pl

2015-12-22 Thread Michael Niedermayer
On Tue, Dec 22, 2015 at 08:38:29PM +0800, zhuhb wrote:
> I download the newest gas-preprocessor.pl from 
> https://github.com/ffmpeg/gas-preprocessor and install it to the path.
> 
> Then I try to build the ffmpeg v2.7.1 and failed.
> 
>  
> 
> The build .sh is as follows:
> 
> SDKVERSION=""
> 
> MIN_IPHONE_VERSION="5.1"
> 
>  
> 
> ARCHS="armv7 arm64"
> 
>  
> 
> DEVELOPER=`xcode-select -print-path`
> 
>  
> 
> REPOROOT=$(pwd)
> 
>  
> 
> BUILDDIR="${REPOROOT}/build"
> 
> mkdir -p $BUILDDIR
> 
>  
> 
> # where we will store intermediary builds
> 
> INTERDIR="${BUILDDIR}/ios-all"
> 
> mkdir -p $INTERDIR
> 
>  
> 
> source ./ffmpeg-config-macro-all
> 
> FFMPEG_FLAGS="$FFMPEG_FLAGS_IOS"
> 
> for ARCH in ${ARCHS}
> 
> do
> 
> if [ "${ARCH}" == "i386" ];
> 
> then
> 
> PLATFORM="iPhoneSimulator"
> 
> EXTRA_CONFIG=" --arch=i386 --enable-cross-compile --target-os=darwin 
> --cpu=i386 "
> 
> EXTRA_CFLAGS=" -arch i386 "
> 
> EXTRA_LDFLAGS="-arch i386 "
> 
> elif [ "${ARCH}" == "arm64" ];
> 
> then
> 
> PLATFORM="iPhoneOS"
> 
> EXTRA_CONFIG="--arch=arm64 --target-os=darwin --enable-cross-compile 
> --disable-armv5te"
> 
> EXTRA_CFLAGS="-w -arch ${ARCH} -mfpu=neon"
> 
> EXTRA_LDFLAGS="-mfpu=neon"
> 
> else
> 
> PLATFORM="iPhoneOS"
> 
> EXTRA_CONFIG="--arch=arm --target-os=darwin --enable-cross-compile 
> --cpu=cortex-a9 --disable-armv5te"
> 
> EXTRA_CFLAGS="-w -arch ${ARCH} -mfpu=neon"
> 
> EXTRA_LDFLAGS="-mfpu=neon"
> 
> fi
> 
>  
> 
> mkdir -p "${INTERDIR}/${ARCH}"
> 
>  
> 
>   if [ "${ARCH}" == "i386" ];
> 
>   then
> 
> ./configure $FFMPEG_FLAGS --prefix="${INTERDIR}/${ARCH}" --disable-armv6 
> --disable-armv6t2 --extra-cflags="${EXTRA_CFLAGS} -I $SOURCE/include/ios" 
> --extra-ldflags="${EXTRA_LDFLAGS} -L $SOURCE/lib/ios" ${EXTRA_CONFIG} 
> --enable-pic 
> --extra-cflags="-I/Users/iqiyi/local/opencore-amr/ios/${ARCH}/include" 
> --extra-ldflags="-L/Users/iqiyi/local/opencore-amr/ios/${ARCH}/lib" 
> --extra-cflags="-fembed-bitcode"
> 
>   else
> 
> ./configure $FFMPEG_FLAGS --prefix="${INTERDIR}/${ARCH}" --disable-armv6 
> --disable-armv6t2 
> --sysroot="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk"
>  --cc="${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" 
> --as='gas-preprocessor.pl 
> /Applications/XCode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang'
>  --extra-cflags="${EXTRA_CFLAGS} -miphoneos-version-min=${MIN_IPHONE_VERSION} 
> -I${OUTPUTDIR}/include -I $SOURCE/include/ios" --extra-ldflags="-arch ${ARCH} 
> ${EXTRA_LDFLAGS} -isysroot 
> /Applications/Xcode.app/Contents/Developer/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk
>  -miphoneos-version-min=${MIN_IPHONE_VERSION} -L${OUTPUTDIR}/lib -L 
> $SOURCE/lib/ios" ${EXTRA_CONFIG} --enable-pic --extra-cxxflags="$CPPFLAGS 
> -I${OUTPUTDIR}/include -isysroot 
> ${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk"
>  --extra-cflags="-I/Users/iqiyi/local/opencore-amr/ios/${ARCH}/include" --
extra-ldflags="-L/Users/iqiyi/local/opencore-amr/ios/${ARCH}/lib" 
--extra-cflags="-fembed-bitcode"

aarch64 2.7.2+ build on osx should work with the options listed at:
http://fate.ffmpeg.org/report.cgi?time=20151221193018&slot=arm64-osx10.9-apple-clang-n2.7

arm:
http://fate.ffmpeg.org/report.cgi?time=20151221184824&slot=arm-osx10.9-apple-clang-n2.7

maybe you can figure out which differences cause the failure ?


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

You can kill me, but you cannot change the truth.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/5] lavfi: deprecate avfilter_link_set_closed().

2015-12-22 Thread Nicolas George
Le tridi 13 frimaire, an CCXXIV, Nicolas George a écrit :
> Will push the series soon if nobody objects and start working on the next
> step.
> 
> Thanks everybody for the reviews.

Series pushed. Thanks again.

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavfi/decimate: Do not drop first frame

2015-12-22 Thread Nicolas George
Le decadi 30 frimaire, an CCXXIV, Carl Eugen Hoyos a écrit :
> > Can you explain?
> The first frame still gets dropped with your patch 
> attached.
> 
> > It worked when I submitted it, I think.
> You think?

Yes, I think so. And I just checked.

Command-line:

./ffmpeg_g -lavfi testsrc2=r=4:d=5,fps=5,showinfo,decimate=cycle=5,showinfo -f 
null -

Selected output with the current Git head:

checksum:3744B3ED
checksum:8EBF9CAA
checksum:8EBF9CAA
checksum:7DE48EED
checksum:7F94A8D3

checksum:8EBF9CAA
checksum:8EBF9CAA
checksum:7DE48EED
checksum:7F94A8D3

Selected output with the patch:

checksum:3744B3ED
checksum:8EBF9CAA
checksum:8EBF9CAA
checksum:7DE48EED
checksum:7F94A8D3

checksum:3744B3ED
checksum:8EBF9CAA
checksum:7DE48EED
checksum:7F94A8D3

As you can see, without the patch, it discards the first frame, the one with
checksum 3744B3ED, and keeps the second and third frames, the ones that fps
duplicated. With the patch, each frame, including the first one, is
selected.

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] phasing out asyntcs, resample

2015-12-22 Thread Nicolas George
Le duodi 2 nivôse, an CCXXIV, Rostislav Pehlivanov a écrit :
> Also, I think that it's better to just send a patch which removes them
> instead of only warning and then let the discussion go on there.

Agreed, but such a patch would need to have a documentation side, to explain
to users of the removed filters how to achieve the same results with the
preferred filters.

And of course, that requires checking that this is possible: checking that
all features of the removed filters are somehow available in the preferred
ones. If some are not, they need to be ported first.

This is not trivial work. But it would be useful, of course.

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH][RFC] lavu/libm: add exp10 support

2015-12-22 Thread Ganesh Ajjanagadde
On Tue, Dec 22, 2015 at 3:35 AM, Michael Niedermayer
 wrote:
> On Mon, Dec 21, 2015 at 07:19:50PM -0800, Ganesh Ajjanagadde wrote:
>> exp10 is a function available in GNU libm. Looks like no other common
>> libm has it. As such, I am mostly neutral about its inclusion, with a
>> very slight bias in favor since I am actually posting this.
>>
>> pros:
>> 1. It is faster than pow, and has less of a chance of going into one of
>> the terribly slow paths:
>> https://github.com/andikleen/glibc/blob/rtm-devel9/sysdeps/ieee754/dbl-64/e_exp10.c
>> vs
>> https://github.com/andikleen/glibc/blob/rtm-devel9/sysdeps/ieee754/dbl-64/e_pow.c.
>> Speedup is roughly 30% of the original execution time for an "average"
>> benchmark over 1e8 arguments uniformly spaced from -1 to 1
>> (similar results for other intervals):
>> ./test  4.07s user 0.00s system 100% cpu 4.068 total (exp10)
>> ./test  5.71s user 0.00s system 100% cpu 5.711 total (pow)
>>
>> cons:
>> 1. It is GNU libm only, and requires -D_GNU_SOURCE.
>> 2. Speedup is not that impressive.
>
>> 3. pow(10, x) is not terribly common in the code, and still cheaper
>> approximation (not as accurate, but often reasonable) exp(ln(10)*x) is
>> much faster:
>> ./test  2.55s user 0.00s system 99% cpu 2.548 total (exp(ln(10)*x))
>
> IMHO a exp10 fallback should be implemented using exp2() if that is faster
> and available.

I don't know whether the fallback should use exp or exp2, need to
check which is faster. And if we fallback to exp or exp2, it will turn
out that the fallback is significantly faster than the actual libm
function (as demonstrated above, like erf), nothing wrong with that,
just is somewhat strange.

>
> Code requiring absolute accuracy must be written using integers as C
> does not gurantee accuracy for float and double.
> A single libc or fallback providing more accuracy does not really help
> as our code must function correctly in the absence of such accuracy
> also the accuracy difference between exp2() and pow() should be
> negligible

A lot of our floating point code assumes IEEE-754, which has
reasonably well defined semantics. Anyway, as a general statement, I
agree.

For a proper libm, exp2(x) and pow(2, x) should be identical. I guess
what you are referring to is exp2(log2(10)*x) vs pow(10, x). In this
case, I don't know how bad the difference is; I suspect it to be more
than 1 ulp in some cases.

However, I am quite sure many implementations of pow are broken wrt
precise rounding anyway: it is a very difficult function to get right.
Nevertheless, we should ensure that the fallbacks are reasonably
correct, and are not completely off.

For me, the RFC was really whether it is all worth the trouble of
extra checks in configure. Seems like at least you have some interest,
so will post v2 soon, thanks.

>
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> In fact, the RIAA has been known to suggest that students drop out
> of college or go to community college in order to be able to afford
> settlements. -- The RIAA
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCHv2] lavu/libm: add erf hack and make dynaudnorm available everywhere

2015-12-22 Thread Ganesh Ajjanagadde
On Tue, Dec 22, 2015 at 12:15 AM, Hendrik Leppkes  wrote:
> Am 21.12.2015 18:18 schrieb "James Almer" :
>>
>> On 12/21/2015 2:08 PM, Ganesh Ajjanagadde wrote:
>> > Pushed with slight modifications.
>> >
>> > This is a request to any running MSVC/other platform lacking erf: can
>> > you please test to make sure this works?
>>
>> Check http://fate.ffmpeg.org/ for new failures later today. Look for
> VS2012
>> and VS2013.
>
> erf is actually supported since 2013, so only 2012 would be of note.

This was why I posted the MSVC 2012 FATE link, I was a bit surprised
myself. Anyway, seems to be working. Only remaining question is
whether or not to post a Changelog modification: really up to others
(especially Paul).

>
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavfi/af_aemphasis: remove unnecessary complex number usage

2015-12-22 Thread Ganesh Ajjanagadde
On Tue, Dec 22, 2015 at 12:46 AM, Paul B Mahol  wrote:
> On 12/22/15, Ganesh Ajjanagadde  wrote:
>> complex is not available on all platforms. Furthermore, it is trivial to
>> rewrite complex number expressions to real arithmetic, and in fact
>> sometimes advantageous for performance reasons: by wrapping as a complex,
>> one forces a particular Cartesian representation that is not necessarily
>> optimal for the purpose.
>>
>> Configure tests are also removed, and aemphasis is now available across
>> all platforms.
>>
>> Signed-off-by: Ganesh Ajjanagadde 
>> ---
>>  configure  | 26 --
>>  libavfilter/af_aemphasis.c | 13 ++---
>>  2 files changed, 6 insertions(+), 33 deletions(-)
>>
>> diff --git a/configure b/configure
>> index 0227540..46021c4 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1070,21 +1070,6 @@ int main(void){ $func(); }
>>  EOF
>>  }
>>
>> -check_complexfunc(){
>> -log check_complexfunc "$@"
>> -func=$1
>> -narg=$2
>> -shift 2
>> -test $narg = 2 && args="f, g" || args="f * I"
>> -disable $func
>> -check_ld "cc" "$@" <> -#include 
>> -#include 
>> -float foo(complex float f, complex float g) { return $func($args); }
>> -int main(void){ return (int) foo; }
>> -EOF
>> -}
>> -
>>  check_mathfunc(){
>>  log check_mathfunc "$@"
>>  func=$1
>> @@ -1803,11 +1788,6 @@ INTRINSICS_LIST="
>>  intrinsics_neon
>>  "
>>
>> -COMPLEX_FUNCS="
>> -cabs
>> -cexp
>> -"
>> -
>>  MATH_FUNCS="
>>  atanf
>>  atan2f
>> @@ -1944,7 +1924,6 @@ HAVE_LIST="
>>  $ARCH_FEATURES
>>  $ATOMICS_LIST
>>  $BUILTIN_LIST
>> -$COMPLEX_FUNCS
>>  $HAVE_LIST_CMDLINE
>>  $HAVE_LIST_PUB
>>  $HEADERS_LIST
>> @@ -2835,7 +2814,6 @@ unix_protocol_deps="sys_un_h"
>>  unix_protocol_select="network"
>>
>>  # filters
>> -aemphasis_filter_deps="cabs cexp"
>>  amovie_filter_deps="avcodec avformat"
>>  aresample_filter_deps="swresample"
>>  ass_filter_deps="libass"
>> @@ -5379,10 +5357,6 @@ for func in $MATH_FUNCS; do
>>  eval check_mathfunc $func \${${func}_args:-1}
>>  done
>>
>> -for func in $COMPLEX_FUNCS; do
>> -eval check_complexfunc $func \${${func}_args:-1}
>> -done
>> -
>>  # these are off by default, so fail if requested and not available
>>  enabled avfoundation_indev && { check_header_objcc
>> AVFoundation/AVFoundation.h || disable avfoundation_indev; }
>>  enabled avfoundation_indev && { check_lib2 CoreGraphics/CoreGraphics.h
>> CGGetActiveDisplayList -framework CoreGraphics ||
>> diff --git a/libavfilter/af_aemphasis.c b/libavfilter/af_aemphasis.c
>> index 2966f77..a5b8e30 100644
>> --- a/libavfilter/af_aemphasis.c
>> +++ b/libavfilter/af_aemphasis.c
>> @@ -18,8 +18,6 @@
>>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
>> USA
>>   */
>>
>> -#include 
>> -
>>  #include "libavutil/opt.h"
>>  #include "avfilter.h"
>>  #include "internal.h"
>> @@ -189,14 +187,15 @@ static inline void set_lp_rbj(BiquadD2 *bq, double fc,
>> double q, double sr, doub
>>
>>  static double freq_gain(BiquadCoeffs *c, double freq, double sr)
>>  {
>> -double complex z, w;
>> +double zr, zi;
>>
>>  freq *= 2.0 * M_PI / sr;
>> -w = 0 + I * freq;
>> -z = 1.0 / cexp(w);
>> +zr = cos(freq);
>> +zi = -sin(freq);
>>
>> -return cabs(((double complex)c->a0 + c->a1 * z + c->a2 * z*z) /
>> -((double complex)1.0 + c->b1 * z + c->b2 * z*z));
>> +/* |(a0 + a1*z + a2*z^2)/(1 + b1*z + b2*z^2)| */
>> +return hypot(c->a0 + c->a1*zr + c->a2*(zr*zr-zi*zi), c->a1*zi +
>> 2*c->a2*zr*zi) /
>> +   hypot(1 + c->b1*zr + c->b2*(zr*zr-zi*zi), c->b1*zi +
>> 2*c->b2*zr*zi);
>>  }
>>
>>  static int config_input(AVFilterLink *inlink)
>> --
>> 2.6.4
>>
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
> ok

I assume by this you are ok with the configure change as well.
Personally, I think the effort needed for writing the configure hacks
is higher than using real arithmetic, and hence I removed it to help
ensure it is not added back again.

This filter was added during the next version work, so does not need a
Changelog update. Thanks, will push later.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavformat: palettized QuickTime in Matroska, round 2

2015-12-22 Thread Michael Niedermayer
On Tue, Dec 22, 2015 at 03:55:48AM +0100, Mats Peterson wrote:
> Alright, this is take two of my fix for palettized QuickTime video
> in Matroska. I have reset the lower limit of V_QUICKTIME private
> data to 21 in matroskadec.c, in order to make that broken file pass,
> Michael. The minimum size of a video sample description in QuickTime
> is really 86, for the record.
> 
> Also, I've added copyright notices of the former authors of mov.c to
> the new file qtpalette.c, since the code in that file is borrowed
> from mov.c to a major extent, albeit with some modifications.
> 
> Original explanation of the patch follows:
> 
> Palettized QuickTime video in Matroska has hitherto not been
> recognized whatsoever, and the "palette" used has been completely
> random.
> 
> The patch for matroskadec.c fixes this issue by adding a palette
> side data packet in matroska_deliver_packet(), much in the same way
> as it's done in mov.c.
> 
> The change to mov.c consists mainly of moving the palette handling
> from the mov_parse_stsd_video() function to a new get_qtpalette()
> function in the new file qtpalette.c, which is shared by both
> matroskadec.c and mov.c.
> 
> In matroskadec.c, I'm also putting the palette in 'extradata', like
> it's done for V_MS/VFW/FOURCC; this is a requirement in order for
> MPlayer to recognize the palette.
> 
> -- 
> Mats Peterson
> http://matsp888.no-ip.org/~mats/

[...]

> +int get_qtpalette(int codec_id, uint8_t *stsd, uint32_t *palette)

non static functions need a prefix (ff_ in this case)

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCHv2] lavu/libm: add erf hack and make dynaudnorm available everywhere

2015-12-22 Thread Ganesh Ajjanagadde
On Mon, Dec 21, 2015 at 10:54 PM, Clément Bœsch  wrote:
> On Mon, Dec 21, 2015 at 08:31:47PM -0800, Ganesh Ajjanagadde wrote:
> [...]
>> I unfortunately do not see an easy solution to avfilter testing in
>> general: Paul [...]
>
> The problem with testing filters is not even remotely close to Paul; the
> main issue is that many filters are actually using floats, which causes
> different accuracy problems across platforms. Someone needs to add some
> code in FATE to handle visually approximate sound or image.

Don't we have some approximation metrics in place: e.g swresample
tests already use them, and successfully test the double formats as
well? Please shoot me a private email/start a thread; I will add this
to my todo list.

>
> --
> Clément B.
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/s302menc: set supported channel layouts by codec

2015-12-22 Thread Kieran Kunhya
On 20 December 2015 at 00:14, Michael Niedermayer
 wrote:
> On Sat, Dec 19, 2015 at 09:35:19PM +0100, Paul B Mahol wrote:
>> Signed-off-by: Paul B Mahol 
>> ---
>>  libavcodec/s302menc.c | 5 +
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/libavcodec/s302menc.c b/libavcodec/s302menc.c
>> index fbaa845..3706eba 100644
>> --- a/libavcodec/s302menc.c
>> +++ b/libavcodec/s302menc.c
>> @@ -175,4 +175,9 @@ AVCodec ff_s302m_encoder = {
>>  
>> AV_SAMPLE_FMT_NONE },
>>  .capabilities  = AV_CODEC_CAP_VARIABLE_FRAME_SIZE | 
>> AV_CODEC_CAP_EXPERIMENTAL,
>>  .supported_samplerates = (const int[]) { 48000, 0 },
>> +.channel_layouts   = (const uint64_t[]) { AV_CH_LAYOUT_STEREO,
>> +  AV_CH_LAYOUT_QUAD,
>> +  AV_CH_LAYOUT_5POINT1_BACK,
>> +  AV_CH_LAYOUT_5POINT1_BACK 
>> | AV_CH_LAYOUT_STEREO_DOWNMIX,
>> +  0 },
>
> assuming the list is correct, the patch LGTM

This list is incorrect, please revert the patch.

Kieran
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [libav-commits] checkasm: add fmtconvert tests

2015-12-22 Thread Janne Grunau
On 2015-12-21 19:06:15 +0100, Janne Grunau  wrote:
> Module: libav
> Branch: master
> Commit: 489e6add4478b0f5717dbf644234c6f3a3baf02c
> 
> Author:Janne Grunau 
> Committer: Janne Grunau 
> Date:  Tue Dec  8 16:24:57 2015 +0100
> 
> checkasm: add fmtconvert tests

This test fails unfortunately under valgrind but only under valgrind.  
Besides all the fate configs which are probably recent Intel CPUs I 
tested it also on a Core 2 Duo and an AMD K8 (the two oldest CPU I have 
available). My checkasm emms check is triggered under valgrind by 
'cvtpi2ps xmm1 mem64'. Valgrind does a x87 FPU to MMX state transition 
which all tested CPUs don't do. According to the current "Intel® 64 and 
IA-32 Architectures Software Developer's Manual Volume 2" from September 
2015 valgrinds behaviour is correct. But I think it is actually a bug in 
the documentation.

I found HTML copy from 1999 of Intel's manual(1) which says that 
cvtpi2ps with a memory location as source doesn't cause a transition to 
MMX state. The current documentation for cvtpi2pd (packed int to packed 
double conversion) says the same. Valgrind wasn't following that that 
until Vitor reported it as #210264(2) in 2009 and it was fixed in (3).  
As Julian Seward says in the commit message the situation is a little 
bit fishy.

I don't see a reason why the instruction should clobber mmx/fpu 
registers so I think it's probably a bug in the documentation (and 
valgrind). Since it will take a while to get fixed valgrind binaries on 
all fate hosts, I'd like to hide this failure temporarily by annotating 
the SSE versions of int32_to_float_fmul_scalar and 
int32_to_float_fmul_array8 as requiring an emms.

Janne

(1):
http://www.c-jump.com/CIS77/reference/Intel/CIS77_24319102/pg_0162.htm
(2): https://bugs.kde.org/show_bug.cgi?id=210264
(3): http://sourceforge.net/p/valgrind/mailman/message/24606437/

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavformat: palettized QuickTime in Matroska, round 2

2015-12-22 Thread Mats Peterson

On 12/22/2015 05:15 PM, Michael Niedermayer wrote:

On Tue, Dec 22, 2015 at 03:55:48AM +0100, Mats Peterson wrote:

Alright, this is take two of my fix for palettized QuickTime video
in Matroska. I have reset the lower limit of V_QUICKTIME private
data to 21 in matroskadec.c, in order to make that broken file pass,
Michael. The minimum size of a video sample description in QuickTime
is really 86, for the record.

Also, I've added copyright notices of the former authors of mov.c to
the new file qtpalette.c, since the code in that file is borrowed
from mov.c to a major extent, albeit with some modifications.

Original explanation of the patch follows:

Palettized QuickTime video in Matroska has hitherto not been
recognized whatsoever, and the "palette" used has been completely
random.

The patch for matroskadec.c fixes this issue by adding a palette
side data packet in matroska_deliver_packet(), much in the same way
as it's done in mov.c.

The change to mov.c consists mainly of moving the palette handling
from the mov_parse_stsd_video() function to a new get_qtpalette()
function in the new file qtpalette.c, which is shared by both
matroskadec.c and mov.c.

In matroskadec.c, I'm also putting the palette in 'extradata', like
it's done for V_MS/VFW/FOURCC; this is a requirement in order for
MPlayer to recognize the palette.

--
Mats Peterson
http://matsp888.no-ip.org/~mats/


[...]


+int get_qtpalette(int codec_id, uint8_t *stsd, uint32_t *palette)


non static functions need a prefix (ff_ in this case)

[...]



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



Thank you for notifying me. I'll change that. I have other issues to 
solve here as well.


Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH][RFC] lavu/libm: add exp10 support

2015-12-22 Thread Ganesh Ajjanagadde
On Tue, Dec 22, 2015 at 8:04 AM, Ganesh Ajjanagadde  wrote:
> On Tue, Dec 22, 2015 at 3:35 AM, Michael Niedermayer
>  wrote:
[...]
>>
>> IMHO a exp10 fallback should be implemented using exp2() if that is faster
>> and available.
>
> I don't know whether the fallback should use exp or exp2, need to
> check which is faster. And if we fallback to exp or exp2, it will turn
> out that the fallback is significantly faster than the actual libm
> function (as demonstrated above, like erf), nothing wrong with that,
> just is somewhat strange.
>
>>
>> Code requiring absolute accuracy must be written using integers as C
>> does not gurantee accuracy for float and double.
>> A single libc or fallback providing more accuracy does not really help
>> as our code must function correctly in the absence of such accuracy
>> also the accuracy difference between exp2() and pow() should be
>> negligible
>
> A lot of our floating point code assumes IEEE-754, which has
> reasonably well defined semantics. Anyway, as a general statement, I
> agree.
>
> For a proper libm, exp2(x) and pow(2, x) should be identical. I guess
> what you are referring to is exp2(log2(10)*x) vs pow(10, x). In this
> case, I don't know how bad the difference is; I suspect it to be more
> than 1 ulp in some cases.

Definitely way more than 1 ulp. Looks like exp2 fallback is the way to go:
1. speed: it is approximately 25% faster on GNU libm, even faster on
BSD/Mac OS X and other libm's due to a table lookup approach.
2. accuracy: it is marginally better. Measurement was via 3e8 points
spaced evenly from -310 to 310, maximum relative error is 1.7e-13 vs
1.8e-13. For values in the 64 bit range (roughly 10^0 to 10^20), error
is around 7.5e-15. Basically errors are amplified at very small and
very large values which is intuitively clear. In fact, that is exactly
what GNU libm does: splits the exponent into a main term and a
correction term, computes exp twice, and then multiplies the two
together.

Really, I guess the question is:
are people ok with this accuracy loss on non GNU/Linux? If yes, then
will post with an exp2 based fallback, if not, will post with a pow
based fallback.
Summary:
Current patch
1. Accuracy: identical to old behavior on all platforms.
2. Speed: improve slightly (~30%) on GNU/Linux, identical to before on
all other platforms.
Thus a Pareto improvement.

exp2 fallback
1. Accuracy: identical on GNU/Linux, regression on all other platforms
(assuming their pow is correct), to the tune of relative error of
1e-13.
2. Speed: improve slightly (~30%) on GNU/Linux, improve drastically on
platforms with exp2 (2-3x).
Trades off significant speed gains for slight reduction in accuracy on
most platforms.

I favor the exp2 fallback, but decision left to others here.

[...]
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/3] mlvdec: validate bits_per_coded_sample

2015-12-22 Thread Andreas Cadhalpun
On 21.12.2015 02:18, Michael Niedermayer wrote:
> On Sun, Dec 20, 2015 at 12:15:17PM +0100, Andreas Cadhalpun wrote:
>>  mlvdec.c |   12 
>>  1 file changed, 12 insertions(+)
>> 9870daae0ba6a9c826563645319ee38c694025e8  
>> 0002-mlvdec-validate-bits_per_coded_sample.patch
>> From 66a3af0c54f0db6b96b0bad7ae7b9bbbd980b830 Mon Sep 17 00:00:00 2001
>> From: Andreas Cadhalpun 
>> Date: Sat, 19 Dec 2015 23:45:00 +0100
>> Subject: [PATCH 2/3] mlvdec: validate bits_per_coded_sample
>>
>> A negative bits_per_coded_sample doesn't make sense.
>> If it is too large, the size calculation for av_get_packet overflows,
>> resulting in allocation of a too small buffer.
>>
>> Also make sure width and height are sane.
> 
> no more objections from me

Pushed.

Best regards,
Andreas

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 06/11] diracdec: Add 10-bits to pix_fmt table

2015-12-22 Thread Andreas Cadhalpun
On 16.12.2015 22:59, Kieran Kunhya wrote:
>> this is maybe missing a < 2 check
>> i see a > 4 check but didnt find a < 2 check from a quick look
> 
> The check already exists.

And where exactly can it be found?

Spoiler: There is no such check...

Best regards,
Andreas

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] diracdec: add missing check for pixel_range_index

2015-12-22 Thread Andreas Cadhalpun
This fixes an out-of-bounds read introduced in commit 0379603.

Signed-off-by: Andreas Cadhalpun 
---
 libavcodec/dirac.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
index 33cc960..faf5534 100644
--- a/libavcodec/dirac.c
+++ b/libavcodec/dirac.c
@@ -262,6 +262,9 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, 
GetBitContext *gb,
 
 dsh->bit_depth = luma_depth;
 
+if (dsh->pixel_range_index < 2U)
+return AVERROR_INVALIDDATA;
+
 dsh->pix_fmt = dirac_pix_fmt[dsh->chroma_format][dsh->pixel_range_index-2];
 avcodec_get_chroma_sub_sample(dsh->pix_fmt, &chroma_x_shift, 
&chroma_y_shift);
 if ((dsh->width % (1

Re: [FFmpeg-devel] [PATCH] diracdec: add missing check for pixel_range_index

2015-12-22 Thread Kieran Kunhya
On 22 December 2015 at 19:04, Andreas Cadhalpun
 wrote:
> This fixes an out-of-bounds read introduced in commit 0379603.
>
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavcodec/dirac.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
> index 33cc960..faf5534 100644
> --- a/libavcodec/dirac.c
> +++ b/libavcodec/dirac.c
> @@ -262,6 +262,9 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, 
> GetBitContext *gb,
>
>  dsh->bit_depth = luma_depth;
>
> +if (dsh->pixel_range_index < 2U)
> +return AVERROR_INVALIDDATA;
> +
>  dsh->pix_fmt = 
> dirac_pix_fmt[dsh->chroma_format][dsh->pixel_range_index-2];
>  avcodec_get_chroma_sub_sample(dsh->pix_fmt, &chroma_x_shift, 
> &chroma_y_shift);
>  if ((dsh->width % (1 (1

Re: [FFmpeg-devel] [PATCH 06/11] diracdec: Add 10-bits to pix_fmt table

2015-12-22 Thread Kieran Kunhya
On 22 December 2015 at 19:04, Andreas Cadhalpun
 wrote:
> On 16.12.2015 22:59, Kieran Kunhya wrote:
>>> this is maybe missing a < 2 check
>>> i see a > 4 check but didnt find a < 2 check from a quick look
>>
>> The check already exists.
>
> And where exactly can it be found?
>
> Spoiler: There is no such check...

Oh Michael meant pixel_range_index, I thought he meant chroma_format.

Kieran
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] diracdec: add missing check for pixel_range_index

2015-12-22 Thread Andreas Cadhalpun
On 22.12.2015 20:12, Kieran Kunhya wrote:
> On 22 December 2015 at 19:04, Andreas Cadhalpun
>  wrote:
>> This fixes an out-of-bounds read introduced in commit 0379603.
>>
>> Signed-off-by: Andreas Cadhalpun 
>> ---
>>  libavcodec/dirac.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
>> index 33cc960..faf5534 100644
>> --- a/libavcodec/dirac.c
>> +++ b/libavcodec/dirac.c
>> @@ -262,6 +262,9 @@ static int parse_source_parameters(AVDiracSeqHeader 
>> *dsh, GetBitContext *gb,
>>
>>  dsh->bit_depth = luma_depth;
>>
>> +if (dsh->pixel_range_index < 2U)
>> +return AVERROR_INVALIDDATA;
>> +
>>  dsh->pix_fmt = 
>> dirac_pix_fmt[dsh->chroma_format][dsh->pixel_range_index-2];
>>  avcodec_get_chroma_sub_sample(dsh->pix_fmt, &chroma_x_shift, 
>> &chroma_y_shift);
>>  if ((dsh->width % (1> (1< 
> Ok

Pushed.

Best regards,
Andreas

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH][RFC] lavu/libm: add exp10 support

2015-12-22 Thread Ronald S. Bultje
Hi,

On Tue, Dec 22, 2015 at 12:48 PM, Ganesh Ajjanagadde 
wrote:

> On Tue, Dec 22, 2015 at 8:04 AM, Ganesh Ajjanagadde 
> wrote:
> > On Tue, Dec 22, 2015 at 3:35 AM, Michael Niedermayer
> >  wrote:
> [...]
> >>
> >> IMHO a exp10 fallback should be implemented using exp2() if that is
> faster
> >> and available.
> >
> > I don't know whether the fallback should use exp or exp2, need to
> > check which is faster. And if we fallback to exp or exp2, it will turn
> > out that the fallback is significantly faster than the actual libm
> > function (as demonstrated above, like erf), nothing wrong with that,
> > just is somewhat strange.
> >
> >>
> >> Code requiring absolute accuracy must be written using integers as C
> >> does not gurantee accuracy for float and double.
> >> A single libc or fallback providing more accuracy does not really help
> >> as our code must function correctly in the absence of such accuracy
> >> also the accuracy difference between exp2() and pow() should be
> >> negligible
> >
> > A lot of our floating point code assumes IEEE-754, which has
> > reasonably well defined semantics. Anyway, as a general statement, I
> > agree.
> >
> > For a proper libm, exp2(x) and pow(2, x) should be identical. I guess
> > what you are referring to is exp2(log2(10)*x) vs pow(10, x). In this
> > case, I don't know how bad the difference is; I suspect it to be more
> > than 1 ulp in some cases.
>
> Definitely way more than 1 ulp. Looks like exp2 fallback is the way to go:
> 1. speed: it is approximately 25% faster on GNU libm, even faster on
> BSD/Mac OS X and other libm's due to a table lookup approach.
> 2. accuracy: it is marginally better. Measurement was via 3e8 points
> spaced evenly from -310 to 310, maximum relative error is 1.7e-13 vs
> 1.8e-13. For values in the 64 bit range (roughly 10^0 to 10^20), error
> is around 7.5e-15. Basically errors are amplified at very small and
> very large values which is intuitively clear. In fact, that is exactly
> what GNU libm does: splits the exponent into a main term and a
> correction term, computes exp twice, and then multiplies the two
> together.
>
> Really, I guess the question is:
> are people ok with this accuracy loss on non GNU/Linux?


I think "yes".

You'd use M_LOG2_10 instead of log2(10), right?

Ronald
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH][RFC] lavu/libm: add exp10 support

2015-12-22 Thread Ganesh Ajjanagadde
On Tue, Dec 22, 2015 at 11:34 AM, Ronald S. Bultje  wrote:
> Hi,
>
> On Tue, Dec 22, 2015 at 12:48 PM, Ganesh Ajjanagadde 
> wrote:
>>
>> On Tue, Dec 22, 2015 at 8:04 AM, Ganesh Ajjanagadde 
>> wrote:
>> > On Tue, Dec 22, 2015 at 3:35 AM, Michael Niedermayer
>> >  wrote:
>> [...]
>> >>
>> >> IMHO a exp10 fallback should be implemented using exp2() if that is
>> >> faster
>> >> and available.
>> >
>> > I don't know whether the fallback should use exp or exp2, need to
>> > check which is faster. And if we fallback to exp or exp2, it will turn
>> > out that the fallback is significantly faster than the actual libm
>> > function (as demonstrated above, like erf), nothing wrong with that,
>> > just is somewhat strange.
>> >
>> >>
>> >> Code requiring absolute accuracy must be written using integers as C
>> >> does not gurantee accuracy for float and double.
>> >> A single libc or fallback providing more accuracy does not really help
>> >> as our code must function correctly in the absence of such accuracy
>> >> also the accuracy difference between exp2() and pow() should be
>> >> negligible
>> >
>> > A lot of our floating point code assumes IEEE-754, which has
>> > reasonably well defined semantics. Anyway, as a general statement, I
>> > agree.
>> >
>> > For a proper libm, exp2(x) and pow(2, x) should be identical. I guess
>> > what you are referring to is exp2(log2(10)*x) vs pow(10, x). In this
>> > case, I don't know how bad the difference is; I suspect it to be more
>> > than 1 ulp in some cases.
>>
>> Definitely way more than 1 ulp. Looks like exp2 fallback is the way to go:
>> 1. speed: it is approximately 25% faster on GNU libm, even faster on
>> BSD/Mac OS X and other libm's due to a table lookup approach.
>> 2. accuracy: it is marginally better. Measurement was via 3e8 points
>> spaced evenly from -310 to 310, maximum relative error is 1.7e-13 vs
>> 1.8e-13. For values in the 64 bit range (roughly 10^0 to 10^20), error
>> is around 7.5e-15. Basically errors are amplified at very small and
>> very large values which is intuitively clear. In fact, that is exactly
>> what GNU libm does: splits the exponent into a main term and a
>> correction term, computes exp twice, and then multiplies the two
>> together.
>>
>> Really, I guess the question is:
>> are people ok with this accuracy loss on non GNU/Linux?
>
>
> I think "yes".

Thanks, will post later today.

>
> You'd use M_LOG2_10 instead of log2(10), right?

Of course, I just gave it as I forgot the actual constant name :).

>
> Ronald
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavu: add pthread asserts if ASSERT_LEVEL>1

2015-12-22 Thread Clément Bœsch
---
 libavutil/thread.h | 96 ++
 1 file changed, 96 insertions(+)

diff --git a/libavutil/thread.h b/libavutil/thread.h
index 3d15737..0bb745e 100644
--- a/libavutil/thread.h
+++ b/libavutil/thread.h
@@ -30,6 +30,102 @@
 
 #if HAVE_PTHREADS
 #include 
+
+#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0
+
+#include "log.h"
+
+#define ASSERT_PTHREAD_NORET(func, ...) do {\
+int ret = func(__VA_ARGS__);\
+if (ret) {  \
+av_log(NULL, AV_LOG_FATAL, AV_STRINGIFY(func)   \
+   " failed with error: %s\n", av_err2str(AVERROR(ret)));   \
+abort();\
+}   \
+} while (0)
+
+#define ASSERT_PTHREAD(func, ...) do {  \
+ASSERT_PTHREAD_NORET(func, __VA_ARGS__);\
+return 0;   \
+} while (0)
+
+static inline int strict_pthread_join(pthread_t thread, void **value_ptr)
+{
+ASSERT_PTHREAD(pthread_join, thread, value_ptr);
+}
+
+static inline int strict_pthread_mutex_init(pthread_mutex_t *mutex, const 
pthread_mutexattr_t *attr)
+{
+if (attr) {
+ASSERT_PTHREAD_NORET(pthread_mutex_init, mutex, attr);
+} else {
+pthread_mutexattr_t local_attr;
+ASSERT_PTHREAD_NORET(pthread_mutexattr_init, &local_attr);
+ASSERT_PTHREAD_NORET(pthread_mutexattr_settype, &local_attr, 
PTHREAD_MUTEX_ERRORCHECK);
+ASSERT_PTHREAD_NORET(pthread_mutex_init, mutex, &local_attr);
+ASSERT_PTHREAD_NORET(pthread_mutexattr_destroy, &local_attr);
+}
+return 0;
+}
+
+static inline int strict_pthread_mutex_destroy(pthread_mutex_t *mutex)
+{
+ASSERT_PTHREAD(pthread_mutex_destroy, mutex);
+}
+
+static inline int strict_pthread_mutex_lock(pthread_mutex_t *mutex)
+{
+ASSERT_PTHREAD(pthread_mutex_lock, mutex);
+}
+
+static inline int strict_pthread_mutex_unlock(pthread_mutex_t *mutex)
+{
+ASSERT_PTHREAD(pthread_mutex_unlock, mutex);
+}
+
+static inline int strict_pthread_cond_init(pthread_cond_t *cond, const 
pthread_condattr_t *attr)
+{
+ASSERT_PTHREAD(pthread_cond_init, cond, attr);
+}
+
+static inline int strict_pthread_cond_destroy(pthread_cond_t *cond)
+{
+ASSERT_PTHREAD(pthread_cond_destroy, cond);
+}
+
+static inline int strict_pthread_cond_signal(pthread_cond_t *cond)
+{
+ASSERT_PTHREAD(pthread_cond_signal, cond);
+}
+
+static inline int strict_pthread_cond_broadcast(pthread_cond_t *cond)
+{
+ASSERT_PTHREAD(pthread_cond_broadcast, cond);
+}
+
+static inline int strict_pthread_cond_wait(pthread_cond_t *cond, 
pthread_mutex_t *mutex)
+{
+ASSERT_PTHREAD(pthread_cond_wait, cond, mutex);
+}
+
+static inline int strict_pthread_once(pthread_once_t *once_control, void 
(*init_routine)(void))
+{
+ASSERT_PTHREAD(pthread_once, once_control, init_routine);
+}
+
+#define pthread_join   strict_pthread_join
+#define pthread_mutex_init strict_pthread_mutex_init
+#define pthread_mutex_destroy  strict_pthread_mutex_destroy
+#define pthread_mutex_lock strict_pthread_mutex_lock
+#define pthread_mutex_unlock   strict_pthread_mutex_unlock
+#define pthread_cond_init  strict_pthread_cond_init
+#define pthread_cond_destroy   strict_pthread_cond_destroy
+#define pthread_cond_signalstrict_pthread_cond_signal
+#define pthread_cond_broadcast strict_pthread_cond_broadcast
+#define pthread_cond_wait  strict_pthread_cond_wait
+#define pthread_once   strict_pthread_once
+#endif
+
 #elif HAVE_OS2THREADS
 #include "compat/os2threads.h"
 #else
-- 
2.6.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/s302menc: set supported channel layouts by codec

2015-12-22 Thread Paul B Mahol
On 12/22/15, Kieran Kunhya  wrote:
> On 20 December 2015 at 00:14, Michael Niedermayer
>  wrote:
>> On Sat, Dec 19, 2015 at 09:35:19PM +0100, Paul B Mahol wrote:
>>> Signed-off-by: Paul B Mahol 
>>> ---
>>>  libavcodec/s302menc.c | 5 +
>>>  1 file changed, 5 insertions(+)
>>>
>>> diff --git a/libavcodec/s302menc.c b/libavcodec/s302menc.c
>>> index fbaa845..3706eba 100644
>>> --- a/libavcodec/s302menc.c
>>> +++ b/libavcodec/s302menc.c
>>> @@ -175,4 +175,9 @@ AVCodec ff_s302m_encoder = {
>>>
>>> AV_SAMPLE_FMT_NONE },
>>>  .capabilities  = AV_CODEC_CAP_VARIABLE_FRAME_SIZE |
>>> AV_CODEC_CAP_EXPERIMENTAL,
>>>  .supported_samplerates = (const int[]) { 48000, 0 },
>>> +.channel_layouts   = (const uint64_t[]) { AV_CH_LAYOUT_STEREO,
>>> +  AV_CH_LAYOUT_QUAD,
>>> +
>>> AV_CH_LAYOUT_5POINT1_BACK,
>>> +
>>> AV_CH_LAYOUT_5POINT1_BACK | AV_CH_LAYOUT_STEREO_DOWNMIX,
>>> +  0 },
>>
>> assuming the list is correct, the patch LGTM
>
> This list is incorrect, please revert the patch.

This is what decoder sets. What it should be instead?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] palettized QuickTime video in Matroska, round 3

2015-12-22 Thread Mats Peterson
OK, Michael (among others), I have changed the name from get_qtpalette() 
to ff_get_qtpalette(). I've also added a *pb (AVIOContext) parameter to 
the ff_get_qtpalette() function, since one has to consume the full 
sample description when called from mov.c. This wasn't done before. In 
matroskadec.c, the sample description is already in the in-memory 
private data. It's beginning to get a bit kludgy, but I still think it's 
nice with a common palette handling function that is shared by both 
matroskadec.c and mov.c.


Original description of issue follows:

Palettized QuickTime video in Matroska has hitherto not been recognized 
whatsoever, and the "palette" used has been completely random.


The patch for matroskadec.c fixes this issue by adding a palette side 
data packet in matroska_deliver_packet(), much in the same way as it's 
done in mov.c.


The change to mov.c consists mainly of moving the palette handling from 
the mov_parse_stsd_video() function to a new get_qtpalette() function in 
the new file qtpalette.c, which is shared by both matroskadec.c and mov.c.


In matroskadec.c, I'm also putting the palette in 'extradata', like it's 
done for V_MS/VFW/FOURCC; this is a requirement in order for MPlayer to 
recognize the palette.


--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From dfa5e2504aae5fa8294c74166e0b102b96555d3b Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Tue, 22 Dec 2015 21:40:13 +0100
Subject: [PATCH] libavformat: palettized QuickTime in Matroska, round 3

---
 libavformat/Makefile  |1 +
 libavformat/matroskadec.c |   30 ++-
 libavformat/mov.c |   96 +--
 libavformat/qtpalette.c   |  124 +
 libavformat/qtpalette.h   |4 ++
 5 files changed, 181 insertions(+), 74 deletions(-)
 create mode 100644 libavformat/qtpalette.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 110e9e3..e03c73e 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -18,6 +18,7 @@ OBJS = allformats.o \
mux.o\
options.o\
os_support.o \
+   qtpalette.o  \
riff.o   \
sdp.o\
url.o\
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index c574749..28bc44f 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -64,6 +64,8 @@
 #include 
 #endif
 
+#include "qtpalette.h"
+
 typedef enum {
 EBML_NONE,
 EBML_UINT,
@@ -312,6 +314,9 @@ typedef struct MatroskaDemuxContext {
 
 /* WebM DASH Manifest live flag/ */
 int is_live;
+
+uint32_t palette[256];
+int has_palette;
 } MatroskaDemuxContext;
 
 typedef struct MatroskaBlock {
@@ -1856,7 +1861,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
 fourcc   = st->codec->codec_tag;
 extradata_offset = FFMIN(track->codec_priv.size, 18);
 } else if (!strcmp(track->codec_id, "A_QUICKTIME")
-   && (track->codec_priv.size >= 86)
+   && (track->codec_priv.size >= 36)
&& (track->codec_priv.data)) {
 fourcc = AV_RL32(track->codec_priv.data + 4);
 codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc);
@@ -1881,6 +1886,20 @@ static int matroska_parse_tracks(AVFormatContext *s)
 av_log(matroska->ctx, AV_LOG_ERROR,
"mov FourCC not found %s.\n", buf);
 }
+if (track->codec_priv.size >= 86) {
+bit_depth = AV_RB16(track->codec_priv.data + 82);
+if (ff_get_qtpalette(codec_id, track->codec_priv.data + 16,
+NULL, matroska->palette)) {
+bit_depth &= 0x1F;
+/* Behave like V_MS/VFW/FOURCC; copy the palette to
+ * extradata */
+if (! (extradata = av_malloc(AVPALETTE_SIZE)))
+return AVERROR(ENOMEM);
+memcpy(extradata, matroska->palette, AVPALETTE_SIZE);
+extradata_size = AVPALETTE_SIZE;
+matroska->has_palette = 1;
+}
+}
 } else if (codec_id == AV_CODEC_ID_PCM_S16BE) {
 switch (track->audio.bitdepth) {
 case  8:
@@ -2326,6 +2345,15 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska,
 if (matroska->num_packets > 0) {
 memcpy(pkt, matroska->packets[0], sizeof(AVPacket));
 av_freep(&matroska->packets[0]);
+if (matroska->has_palette) {
+uint8_t *pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
+if (!pal) {
+av_log(matroska->ctx, AV_LOG_ERROR, "Cannot append palette to packet\n");
+} else {
+memcpy(pal, matroska->palette, AVPALETTE_SIZE);
+}
+matroska->

Re: [FFmpeg-devel] [PATCH] palettized QuickTime video in Matroska, round 3

2015-12-22 Thread Mats Peterson

On 12/22/2015 09:50 PM, Mats Peterson wrote:

OK, Michael (among others), I have changed the name from get_qtpalette()
to ff_get_qtpalette(). I've also added a *pb (AVIOContext) parameter to
the ff_get_qtpalette() function, since one has to consume the full
sample description when called from mov.c. This wasn't done before. In
matroskadec.c, the sample description is already in the in-memory
private data. It's beginning to get a bit kludgy, but I still think it's
nice with a common palette handling function that is shared by both
matroskadec.c and mov.c.

Original description of issue follows:

Palettized QuickTime video in Matroska has hitherto not been recognized
whatsoever, and the "palette" used has been completely random.

The patch for matroskadec.c fixes this issue by adding a palette side
data packet in matroska_deliver_packet(), much in the same way as it's
done in mov.c.

The change to mov.c consists mainly of moving the palette handling from
the mov_parse_stsd_video() function to a new get_qtpalette() function in
the new file qtpalette.c, which is shared by both matroskadec.c and mov.c.

In matroskadec.c, I'm also putting the palette in 'extradata', like it's
done for V_MS/VFW/FOURCC; this is a requirement in order for MPlayer to
recognize the palette.



Forgot to remove a fprintf() line in mov.c. New patch attached.

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From 756e9c74db212904f9523dc816f7003f1b30a5b4 Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Tue, 22 Dec 2015 22:00:09 +0100
Subject: [PATCH] libavformat: palettized QuickTime video in Matroska, round 3

---
 libavformat/Makefile  |1 +
 libavformat/matroskadec.c |   30 ++-
 libavformat/mov.c |   95 --
 libavformat/qtpalette.c   |  124 +
 libavformat/qtpalette.h   |4 ++
 5 files changed, 180 insertions(+), 74 deletions(-)
 create mode 100644 libavformat/qtpalette.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 110e9e3..e03c73e 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -18,6 +18,7 @@ OBJS = allformats.o \
mux.o\
options.o\
os_support.o \
+   qtpalette.o  \
riff.o   \
sdp.o\
url.o\
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index c574749..28bc44f 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -64,6 +64,8 @@
 #include 
 #endif
 
+#include "qtpalette.h"
+
 typedef enum {
 EBML_NONE,
 EBML_UINT,
@@ -312,6 +314,9 @@ typedef struct MatroskaDemuxContext {
 
 /* WebM DASH Manifest live flag/ */
 int is_live;
+
+uint32_t palette[256];
+int has_palette;
 } MatroskaDemuxContext;
 
 typedef struct MatroskaBlock {
@@ -1856,7 +1861,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
 fourcc   = st->codec->codec_tag;
 extradata_offset = FFMIN(track->codec_priv.size, 18);
 } else if (!strcmp(track->codec_id, "A_QUICKTIME")
-   && (track->codec_priv.size >= 86)
+   && (track->codec_priv.size >= 36)
&& (track->codec_priv.data)) {
 fourcc = AV_RL32(track->codec_priv.data + 4);
 codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc);
@@ -1881,6 +1886,20 @@ static int matroska_parse_tracks(AVFormatContext *s)
 av_log(matroska->ctx, AV_LOG_ERROR,
"mov FourCC not found %s.\n", buf);
 }
+if (track->codec_priv.size >= 86) {
+bit_depth = AV_RB16(track->codec_priv.data + 82);
+if (ff_get_qtpalette(codec_id, track->codec_priv.data + 16,
+NULL, matroska->palette)) {
+bit_depth &= 0x1F;
+/* Behave like V_MS/VFW/FOURCC; copy the palette to
+ * extradata */
+if (! (extradata = av_malloc(AVPALETTE_SIZE)))
+return AVERROR(ENOMEM);
+memcpy(extradata, matroska->palette, AVPALETTE_SIZE);
+extradata_size = AVPALETTE_SIZE;
+matroska->has_palette = 1;
+}
+}
 } else if (codec_id == AV_CODEC_ID_PCM_S16BE) {
 switch (track->audio.bitdepth) {
 case  8:
@@ -2326,6 +2345,15 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska,
 if (matroska->num_packets > 0) {
 memcpy(pkt, matroska->packets[0], sizeof(AVPacket));
 av_freep(&matroska->packets[0]);
+if (matroska->has_palette) {
+uint8_t *pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
+if (!pal) {
+av_log(matroska->ctx, AV_LOG_ERROR, "Cannot append palette to packet\n");
+} else {
+  

Re: [FFmpeg-devel] support for reading / writing encrypted MP4 files

2015-12-22 Thread Eran Kornblau
> you are not subscribed (with this email address you used here at least
> it seems)
>
Right, apparently the subscription confirmation message went to the junk 
folder...
Anyway, glad this one is now resolved :-) and sorry for the trouble.

> > > 
> > > > +id = mov_codec_id(st, format);
> > > > +st->codec->codec_id = id;
> > > 
> > > doesnt this allow changing the codec id to anything from anything ?
> > > this seems potentially risky
> > > 
> > I see options to address this:
> > 1. overwrite the codec_id only when it's AV_CODEC_ID_NONE
> > 2. (stricter) save the format 4cc (that is loaded in 
> > ff_mov_read_stsd_entries) to some member of 
> > MOVStreamContext, and overwrite the codec id only when the format is 'encv' 
> > or 'enca'
> > 
> > please let me know which one you prefer, and I will update the patch.
> 
> i think the strcter variant sounds more robust
>

Fixed, updated patch attached.
Also added a warning in case the frma atom is ignored because of this.

Pasting here the diff between this new patch and the previous one (if it helps):

diff --git a/libavformat/isom.h b/libavformat/isom.h
index 3b0230a..a5ca21b 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -170,6 +170,7 @@ typedef struct MOVStreamContext {
 int64_t duration_for_fps;

 int32_t *display_matrix;
+uint32_t format;

 struct {
 int use_subsamples;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 728d8b0..94005cb 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2227,6 +2227,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext 
*pb, int entries)

 sc->pseudo_stream_id = st->codec->codec_tag ? -1 : pseudo_stream_id;
 sc->dref_id= dref_id;
+sc->format = format;

 id = mov_codec_id(st, format);

@@ -4011,15 +4012,30 @@ static int mov_read_free(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 static int mov_read_frma(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
 uint32_t format = avio_rl32(pb);
+MOVStreamContext *sc;
 enum AVCodecID id;
 AVStream *st;

 if (c->fc->nb_streams < 1)
 return 0;
 st = c->fc->streams[c->fc->nb_streams - 1];
+sc = st->priv_data;
+
+switch (sc->format)
+{
+case MKTAG('e','n','c','v'):// encrypted video
+case MKTAG('e','n','c','a'):// encrypted audio
+id = mov_codec_id(st, format);
+st->codec->codec_id = id;
+sc->format = format;
+break;

-id = mov_codec_id(st, format);
-st->codec->codec_id = id;
+default:
+av_log(c->fc, AV_LOG_WARNING,
+   "ignoring 'frma' atom of '%.4s', stream format is '%.4s'\n",
+   (char*)&format, (char*)&sc->format);
+break;

 return 0;
 }

Thanks

Eran


0001-mov-support-cenc-common-encryption.patch
Description: 0001-mov-support-cenc-common-encryption.patch
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavfi/af_aemphasis: remove unnecessary complex number usage

2015-12-22 Thread Paul B Mahol
On 12/22/15, Ganesh Ajjanagadde  wrote:
> On Tue, Dec 22, 2015 at 12:46 AM, Paul B Mahol  wrote:
>> On 12/22/15, Ganesh Ajjanagadde  wrote:
>>> complex is not available on all platforms. Furthermore, it is trivial to
>>> rewrite complex number expressions to real arithmetic, and in fact
>>> sometimes advantageous for performance reasons: by wrapping as a
>>> complex,
>>> one forces a particular Cartesian representation that is not necessarily
>>> optimal for the purpose.
>>>
>>> Configure tests are also removed, and aemphasis is now available across
>>> all platforms.
>>>
>>> Signed-off-by: Ganesh Ajjanagadde 
>>> ---
>>>  configure  | 26 --
>>>  libavfilter/af_aemphasis.c | 13 ++---
>>>  2 files changed, 6 insertions(+), 33 deletions(-)
>>>
>>> diff --git a/configure b/configure
>>> index 0227540..46021c4 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -1070,21 +1070,6 @@ int main(void){ $func(); }
>>>  EOF
>>>  }
>>>
>>> -check_complexfunc(){
>>> -log check_complexfunc "$@"
>>> -func=$1
>>> -narg=$2
>>> -shift 2
>>> -test $narg = 2 && args="f, g" || args="f * I"
>>> -disable $func
>>> -check_ld "cc" "$@" <>> -#include 
>>> -#include 
>>> -float foo(complex float f, complex float g) { return $func($args); }
>>> -int main(void){ return (int) foo; }
>>> -EOF
>>> -}
>>> -
>>>  check_mathfunc(){
>>>  log check_mathfunc "$@"
>>>  func=$1
>>> @@ -1803,11 +1788,6 @@ INTRINSICS_LIST="
>>>  intrinsics_neon
>>>  "
>>>
>>> -COMPLEX_FUNCS="
>>> -cabs
>>> -cexp
>>> -"
>>> -
>>>  MATH_FUNCS="
>>>  atanf
>>>  atan2f
>>> @@ -1944,7 +1924,6 @@ HAVE_LIST="
>>>  $ARCH_FEATURES
>>>  $ATOMICS_LIST
>>>  $BUILTIN_LIST
>>> -$COMPLEX_FUNCS
>>>  $HAVE_LIST_CMDLINE
>>>  $HAVE_LIST_PUB
>>>  $HEADERS_LIST
>>> @@ -2835,7 +2814,6 @@ unix_protocol_deps="sys_un_h"
>>>  unix_protocol_select="network"
>>>
>>>  # filters
>>> -aemphasis_filter_deps="cabs cexp"
>>>  amovie_filter_deps="avcodec avformat"
>>>  aresample_filter_deps="swresample"
>>>  ass_filter_deps="libass"
>>> @@ -5379,10 +5357,6 @@ for func in $MATH_FUNCS; do
>>>  eval check_mathfunc $func \${${func}_args:-1}
>>>  done
>>>
>>> -for func in $COMPLEX_FUNCS; do
>>> -eval check_complexfunc $func \${${func}_args:-1}
>>> -done
>>> -
>>>  # these are off by default, so fail if requested and not available
>>>  enabled avfoundation_indev && { check_header_objcc
>>> AVFoundation/AVFoundation.h || disable avfoundation_indev; }
>>>  enabled avfoundation_indev && { check_lib2 CoreGraphics/CoreGraphics.h
>>> CGGetActiveDisplayList -framework CoreGraphics ||
>>> diff --git a/libavfilter/af_aemphasis.c b/libavfilter/af_aemphasis.c
>>> index 2966f77..a5b8e30 100644
>>> --- a/libavfilter/af_aemphasis.c
>>> +++ b/libavfilter/af_aemphasis.c
>>> @@ -18,8 +18,6 @@
>>>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
>>> 02110-1301
>>> USA
>>>   */
>>>
>>> -#include 
>>> -
>>>  #include "libavutil/opt.h"
>>>  #include "avfilter.h"
>>>  #include "internal.h"
>>> @@ -189,14 +187,15 @@ static inline void set_lp_rbj(BiquadD2 *bq, double
>>> fc,
>>> double q, double sr, doub
>>>
>>>  static double freq_gain(BiquadCoeffs *c, double freq, double sr)
>>>  {
>>> -double complex z, w;
>>> +double zr, zi;
>>>
>>>  freq *= 2.0 * M_PI / sr;
>>> -w = 0 + I * freq;
>>> -z = 1.0 / cexp(w);
>>> +zr = cos(freq);
>>> +zi = -sin(freq);
>>>
>>> -return cabs(((double complex)c->a0 + c->a1 * z + c->a2 * z*z) /
>>> -((double complex)1.0 + c->b1 * z + c->b2 * z*z));
>>> +/* |(a0 + a1*z + a2*z^2)/(1 + b1*z + b2*z^2)| */
>>> +return hypot(c->a0 + c->a1*zr + c->a2*(zr*zr-zi*zi), c->a1*zi +
>>> 2*c->a2*zr*zi) /
>>> +   hypot(1 + c->b1*zr + c->b2*(zr*zr-zi*zi), c->b1*zi +
>>> 2*c->b2*zr*zi);
>>>  }
>>>
>>>  static int config_input(AVFilterLink *inlink)
>>> --
>>> 2.6.4
>>>
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>
>>
>> ok
>
> I assume by this you are ok with the configure change as well.
> Personally, I think the effort needed for writing the configure hacks
> is higher than using real arithmetic, and hence I removed it to help
> ensure it is not added back again.
>
> This filter was added during the next version work, so does not need a
> Changelog update. Thanks, will push later.
>

Please leave configure check alone, I'm writting some code that uses
complex again.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavfi/af_aemphasis: remove unnecessary complex number usage

2015-12-22 Thread Ganesh Ajjanagadde
On Tue, Dec 22, 2015 at 2:10 PM, Paul B Mahol  wrote:
> On 12/22/15, Ganesh Ajjanagadde  wrote:
>> On Tue, Dec 22, 2015 at 12:46 AM, Paul B Mahol  wrote:
>>> On 12/22/15, Ganesh Ajjanagadde  wrote:
 complex is not available on all platforms. Furthermore, it is trivial to
 rewrite complex number expressions to real arithmetic, and in fact
 sometimes advantageous for performance reasons: by wrapping as a
 complex,
 one forces a particular Cartesian representation that is not necessarily
 optimal for the purpose.

 Configure tests are also removed, and aemphasis is now available across
 all platforms.

 Signed-off-by: Ganesh Ajjanagadde 
 ---
  configure  | 26 --
  libavfilter/af_aemphasis.c | 13 ++---
  2 files changed, 6 insertions(+), 33 deletions(-)

 diff --git a/configure b/configure
 index 0227540..46021c4 100755
 --- a/configure
 +++ b/configure
 @@ -1070,21 +1070,6 @@ int main(void){ $func(); }
  EOF
  }

 -check_complexfunc(){
 -log check_complexfunc "$@"
 -func=$1
 -narg=$2
 -shift 2
 -test $narg = 2 && args="f, g" || args="f * I"
 -disable $func
 -check_ld "cc" "$@" <>>> -#include 
 -#include 
 -float foo(complex float f, complex float g) { return $func($args); }
 -int main(void){ return (int) foo; }
 -EOF
 -}
 -
  check_mathfunc(){
  log check_mathfunc "$@"
  func=$1
 @@ -1803,11 +1788,6 @@ INTRINSICS_LIST="
  intrinsics_neon
  "

 -COMPLEX_FUNCS="
 -cabs
 -cexp
 -"
 -
  MATH_FUNCS="
  atanf
  atan2f
 @@ -1944,7 +1924,6 @@ HAVE_LIST="
  $ARCH_FEATURES
  $ATOMICS_LIST
  $BUILTIN_LIST
 -$COMPLEX_FUNCS
  $HAVE_LIST_CMDLINE
  $HAVE_LIST_PUB
  $HEADERS_LIST
 @@ -2835,7 +2814,6 @@ unix_protocol_deps="sys_un_h"
  unix_protocol_select="network"

  # filters
 -aemphasis_filter_deps="cabs cexp"
  amovie_filter_deps="avcodec avformat"
  aresample_filter_deps="swresample"
  ass_filter_deps="libass"
 @@ -5379,10 +5357,6 @@ for func in $MATH_FUNCS; do
  eval check_mathfunc $func \${${func}_args:-1}
  done

 -for func in $COMPLEX_FUNCS; do
 -eval check_complexfunc $func \${${func}_args:-1}
 -done
 -
  # these are off by default, so fail if requested and not available
  enabled avfoundation_indev && { check_header_objcc
 AVFoundation/AVFoundation.h || disable avfoundation_indev; }
  enabled avfoundation_indev && { check_lib2 CoreGraphics/CoreGraphics.h
 CGGetActiveDisplayList -framework CoreGraphics ||
 diff --git a/libavfilter/af_aemphasis.c b/libavfilter/af_aemphasis.c
 index 2966f77..a5b8e30 100644
 --- a/libavfilter/af_aemphasis.c
 +++ b/libavfilter/af_aemphasis.c
 @@ -18,8 +18,6 @@
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 02110-1301
 USA
   */

 -#include 
 -
  #include "libavutil/opt.h"
  #include "avfilter.h"
  #include "internal.h"
 @@ -189,14 +187,15 @@ static inline void set_lp_rbj(BiquadD2 *bq, double
 fc,
 double q, double sr, doub

  static double freq_gain(BiquadCoeffs *c, double freq, double sr)
  {
 -double complex z, w;
 +double zr, zi;

  freq *= 2.0 * M_PI / sr;
 -w = 0 + I * freq;
 -z = 1.0 / cexp(w);
 +zr = cos(freq);
 +zi = -sin(freq);

 -return cabs(((double complex)c->a0 + c->a1 * z + c->a2 * z*z) /
 -((double complex)1.0 + c->b1 * z + c->b2 * z*z));
 +/* |(a0 + a1*z + a2*z^2)/(1 + b1*z + b2*z^2)| */
 +return hypot(c->a0 + c->a1*zr + c->a2*(zr*zr-zi*zi), c->a1*zi +
 2*c->a2*zr*zi) /
 +   hypot(1 + c->b1*zr + c->b2*(zr*zr-zi*zi), c->b1*zi +
 2*c->b2*zr*zi);
  }

  static int config_input(AVFilterLink *inlink)
 --
 2.6.4

 ___
 ffmpeg-devel mailing list
 ffmpeg-devel@ffmpeg.org
 http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

>>>
>>> ok
>>
>> I assume by this you are ok with the configure change as well.
>> Personally, I think the effort needed for writing the configure hacks
>> is higher than using real arithmetic, and hence I removed it to help
>> ensure it is not added back again.
>>
>> This filter was added during the next version work, so does not need a
>> Changelog update. Thanks, will push later.
>>
>
> Please leave configure check alone, I'm writting some code that uses
> complex again.

and how hard is it to use real numbers? It does not take > 5 min to
come up real number expressions...
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.or

[FFmpeg-devel] [RFC] [PATCH] mp3: keep gapless information on stream-copy

2015-12-22 Thread Andreas Cadhalpun
Fixes Debian bug #797965, https://bugs.debian.org/797965
---

This can't be used as is, because it requires copying private stream fields
in ffmpeg.c.
Also the duplication between codec->initial_padding and st->start_skip_samples
is less than ideal.
Does someone have a better idea how to fix this?

---
 ffmpeg.c |  3 +++
 libavformat/mp3enc.c | 23 +++
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 10d0f25..a2a0bd7 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3012,6 +3012,9 @@ static int transcode_init(void)
 enc_ctx->block_align= 0;
 if(enc_ctx->codec_id == AV_CODEC_ID_AC3)
 enc_ctx->block_align= 0;
+ost->st->start_skip_samples   = ist->st->start_skip_samples;
+ost->st->first_discard_sample = ist->st->first_discard_sample;
+ost->st->last_discard_sample  = ist->st->last_discard_sample;
 break;
 case AVMEDIA_TYPE_VIDEO:
 enc_ctx->pix_fmt= dec_ctx->pix_fmt;
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index 40f0672..364442e 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -129,8 +129,9 @@ static const uint8_t xing_offtbl[2][2] = {{32, 17}, {17, 
9}};
 static int mp3_write_xing(AVFormatContext *s)
 {
 MP3Context   *mp3 = s->priv_data;
-AVCodecContext *codec = s->streams[mp3->audio_stream_idx]->codec;
-AVDictionaryEntry *enc = 
av_dict_get(s->streams[mp3->audio_stream_idx]->metadata, "encoder", NULL, 0);
+AVStream  *st  = s->streams[mp3->audio_stream_idx];
+AVCodecContext *codec  = st->codec;
+AVDictionaryEntry *enc = av_dict_get(st->metadata, "encoder", NULL, 0);
 AVIOContext *dyn_ctx;
 int32_theader;
 MPADecodeHeader  mpah;
@@ -141,6 +142,7 @@ static int mp3_write_xing(AVFormatContext *s)
 int ret;
 int ver = 0;
 int bytes_needed;
+int start_pad, end_pad;
 
 if (!s->pb->seekable || !mp3->write_xing)
 return 0;
@@ -248,10 +250,23 @@ static int mp3_write_xing(AVFormatContext *s)
 avio_w8(dyn_ctx, 0);  // unknown abr/minimal bitrate
 
 // encoder delay
-if (codec->initial_padding - 528 - 1 >= 1 << 12) {
+if (codec->initial_padding)
+start_pad = FFMAX(codec->initial_padding - 528 - 1, 0); // from the 
encoder
+else
+start_pad = FFMAX(st->start_skip_samples - 528 - 1, 0); // from the 
demuxer
+
+if (start_pad >= 1 << 12) {
 av_log(s, AV_LOG_WARNING, "Too many samples of initial padding.\n");
+start_pad = (1 << 12) - 1;
+}
+
+end_pad = FFMAX(st->last_discard_sample - st->first_discard_sample + 528 + 
1, 0);
+if (end_pad >= 1 << 12) {
+av_log(s, AV_LOG_WARNING, "Too many samples of final padding.\n");
+end_pad = (1 << 12) - 1;
 }
-avio_wb24(dyn_ctx, FFMAX(codec->initial_padding - 528 - 1, 0)<<12);
+
+avio_wb24(dyn_ctx, start_pad<<12 | end_pad);
 
 avio_w8(dyn_ctx,   0); // misc
 avio_w8(dyn_ctx,   0); // mp3gain
-- 
2.6.2
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] decklink: support all valid numbers of audio channels

2015-12-22 Thread Dave Rice

> On Dec 20, 2015, at 9:28 AM, Matthias Hunstock  wrote:
> 
> Am 20.12.2015 um 15:11 schrieb Nicolas George:
>> Le decadi 30 frimaire, an CCXXIV, Matthias Hunstock a écrit :
>>> Decklink cards actually do just some bitbanging: take digital input in
>>> "raw" format (AFAIK UYVY422 10 bit, PCM 16bit) and copy that into your RAM.
>> 
>> Take digital input... from where?
> 
> Ok, the bigger picture:
> 
> The BlackMagic DeckLink series are capture (and sometimes playout)
> cards, mostly having SDI in-/outputs, sometimes also HDMI; some older
> models have analog inputs (RGB component, YUV component and so on) and
> do ADC themselves.
> 
> So the digital input is in most cases (HD-)SDI or HDMI, which also
> includes audio. Since there are well-known "pix_fmts" on the wire, there
> is only little conversion available in the cards. AFAIK only 10bit/8bit
> conversion on the video data.
> 
> So using these cards means you get blasted with raw UYVY422 data and
> either 2, 8 or 16 PCM 16bit audio channels. Reverse logic applies for
> playout.
> 
> 
>>> Another possibility is to demux each channel as a mono track. Would this
>>> make more sense?
>> 
>> It depends on the use case, and therefore on where the channels come from.
> 
> Yes. IMHO a channel mapping is needed in 95% of the use cases, so if it
> is valid to have an unspecified channel layout than it should be used.

I consider the unspecified arrangement of the 8 and 16 channels to be 
consistent in most cases with the source material being recorded by Decklink. 
For videotapes there is no metadata to say which channel is for what. There’s 
some tradition to say that the first channel is left and second channel is 
right, but there is no machine-readible clarity about the application of this 
in video tapes. Ideally the user would interpret the unspecified source 
material and arrange the audio into the proper channels and tracks. Without the 
user clarifying the arrangement I think an unspecified arrangement should be 
used.

In using bmdcapture piping 8 channels to ffmpeg, I’ve used this logic to handle 
channel arrangement based on a user selection: 
https://github.com/amiaopensource/vrecord/blob/f5b9f2147763adffd58dc53421bc221419f2bdd1/vrecord#L275-L303.
 However in Media Express (the free utility that comes with Decklink products) 
it only places all channels in a single track with unspecified arrangement. I 
think mimicking Media Express is appropriate and avoid presuming too much about 
the audio. If needed the user could further arrange that audio for clarity, if 
the input channel option is added, I could add documentation examples on how to 
arrange it.

Dave Rice
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavu/libm: add exp10 support

2015-12-22 Thread Ganesh Ajjanagadde
exp10 is a function available in GNU libm. Looks like no other common
libm has it. This adds support for it to FFmpeg.

There are essentially 2 ways of handling the fallback:
1. Using pow(10, x)
2. Using exp2(M_LOG2_10 * x).

First one represents a Pareto improvement, with no speed or accuracy
regression anywhere, but speed improvement limited to GNU libm.

Second one represents a slight accuracy loss (relative error ~ 1e-13)
for non GNU libm. Speedup of > 2x is obtained on non GNU libm platforms,
~30% on GNU libm. These are "average case numbers", another benefit is
the lack of triggering of the well-known terrible worst case paths
through pow.

Based on reviews, second one chosen. Comment added accordingly.

Reviewed-by: Michael Niedermayer 
Reviewed-by: Ronald S. Bultje 
Signed-off-by: Ganesh Ajjanagadde 
---
 configure|  2 ++
 libavutil/libm.h | 24 
 2 files changed, 26 insertions(+)

diff --git a/configure b/configure
index 54c9789..ea717a5 100755
--- a/configure
+++ b/configure
@@ -1815,6 +1815,8 @@ MATH_FUNCS="
 copysign
 cosf
 erf
+exp10
+exp10f
 exp2
 exp2f
 expf
diff --git a/libavutil/libm.h b/libavutil/libm.h
index 146768a..9705755 100644
--- a/libavutil/libm.h
+++ b/libavutil/libm.h
@@ -292,6 +292,30 @@ static inline double erf(double z)
 #define exp2f(x) ((float)exp2(x))
 #endif /* HAVE_EXP2F */
 
+/* Somewhat inaccurate fallbacks, relative error ~ 1e-13 concentrated on very
+small and very large values. For perfection accuracy-wise, should use pow.
+Speed benefits (>2x average, with no super slow paths) deemed to be worth the
+accuracy tradeoff */
+#if !HAVE_EXP10
+static av_always_inline double exp10(double x)
+{
+#ifndef M_LOG2_10
+#define M_LOG2_10  3.32192809488736234787  /* log_2 10 */
+#endif
+return exp2(M_LOG2_10 * x);
+}
+#endif /* HAVE_EXP10 */
+
+#if !HAVE_EXP10F
+static av_always_inline float exp10f(float x)
+{
+#ifndef M_LOG2_10
+#define M_LOG2_10  3.32192809488736234787  /* log_2 10 */
+#endif
+return exp2f(M_LOG2_10 * x);
+}
+#endif /* HAVE_EXP10F */
+
 #if !HAVE_ISINF
 #undef isinf
 /* Note: these do not follow the BSD/Apple/GNU convention of returning -1 for
-- 
2.6.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavu/libm: add exp10 support

2015-12-22 Thread Hendrik Leppkes
On Wed, Dec 23, 2015 at 12:29 AM, Ganesh Ajjanagadde
 wrote:
> exp10 is a function available in GNU libm. Looks like no other common
> libm has it. This adds support for it to FFmpeg.
>
> There are essentially 2 ways of handling the fallback:
> 1. Using pow(10, x)
> 2. Using exp2(M_LOG2_10 * x).
>
> First one represents a Pareto improvement, with no speed or accuracy
> regression anywhere, but speed improvement limited to GNU libm.
>
> Second one represents a slight accuracy loss (relative error ~ 1e-13)
> for non GNU libm. Speedup of > 2x is obtained on non GNU libm platforms,
> ~30% on GNU libm. These are "average case numbers", another benefit is
> the lack of triggering of the well-known terrible worst case paths
> through pow.
>
> Based on reviews, second one chosen. Comment added accordingly.
>
> Reviewed-by: Michael Niedermayer 
> Reviewed-by: Ronald S. Bultje 
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  configure|  2 ++
>  libavutil/libm.h | 24 
>  2 files changed, 26 insertions(+)
>
> diff --git a/configure b/configure
> index 54c9789..ea717a5 100755
> --- a/configure
> +++ b/configure
> @@ -1815,6 +1815,8 @@ MATH_FUNCS="
>  copysign
>  cosf
>  erf
> +exp10
> +exp10f
>  exp2
>  exp2f
>  expf
> diff --git a/libavutil/libm.h b/libavutil/libm.h
> index 146768a..9705755 100644
> --- a/libavutil/libm.h
> +++ b/libavutil/libm.h
> @@ -292,6 +292,30 @@ static inline double erf(double z)
>  #define exp2f(x) ((float)exp2(x))
>  #endif /* HAVE_EXP2F */
>
> +/* Somewhat inaccurate fallbacks, relative error ~ 1e-13 concentrated on very
> +small and very large values. For perfection accuracy-wise, should use pow.
> +Speed benefits (>2x average, with no super slow paths) deemed to be worth the
> +accuracy tradeoff */
> +#if !HAVE_EXP10
> +static av_always_inline double exp10(double x)
> +{
> +#ifndef M_LOG2_10
> +#define M_LOG2_10  3.32192809488736234787  /* log_2 10 */
> +#endif

Should include mathematic.h for this constant, it already defines
common constants if not present.

> +return exp2(M_LOG2_10 * x);
> +}
> +#endif /* HAVE_EXP10 */
> +
> +#if !HAVE_EXP10F
> +static av_always_inline float exp10f(float x)
> +{
> +#ifndef M_LOG2_10
> +#define M_LOG2_10  3.32192809488736234787  /* log_2 10 */
> +#endif
> +return exp2f(M_LOG2_10 * x);
> +}
> +#endif /* HAVE_EXP10F */
> +
>  #if !HAVE_ISINF
>  #undef isinf
>  /* Note: these do not follow the BSD/Apple/GNU convention of returning -1 for
> --
> 2.6.4
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavu/libm: add exp10 support

2015-12-22 Thread Ganesh Ajjanagadde
On Tue, Dec 22, 2015 at 4:17 PM, Hendrik Leppkes  wrote:
> On Wed, Dec 23, 2015 at 12:29 AM, Ganesh Ajjanagadde
>  wrote:
>> exp10 is a function available in GNU libm. Looks like no other common
>> libm has it. This adds support for it to FFmpeg.
>>
>> There are essentially 2 ways of handling the fallback:
>> 1. Using pow(10, x)
>> 2. Using exp2(M_LOG2_10 * x).
>>
>> First one represents a Pareto improvement, with no speed or accuracy
>> regression anywhere, but speed improvement limited to GNU libm.
>>
>> Second one represents a slight accuracy loss (relative error ~ 1e-13)
>> for non GNU libm. Speedup of > 2x is obtained on non GNU libm platforms,
>> ~30% on GNU libm. These are "average case numbers", another benefit is
>> the lack of triggering of the well-known terrible worst case paths
>> through pow.
>>
>> Based on reviews, second one chosen. Comment added accordingly.
>>
>> Reviewed-by: Michael Niedermayer 
>> Reviewed-by: Ronald S. Bultje 
>> Signed-off-by: Ganesh Ajjanagadde 
>> ---
>>  configure|  2 ++
>>  libavutil/libm.h | 24 
>>  2 files changed, 26 insertions(+)
>>
>> diff --git a/configure b/configure
>> index 54c9789..ea717a5 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1815,6 +1815,8 @@ MATH_FUNCS="
>>  copysign
>>  cosf
>>  erf
>> +exp10
>> +exp10f
>>  exp2
>>  exp2f
>>  expf
>> diff --git a/libavutil/libm.h b/libavutil/libm.h
>> index 146768a..9705755 100644
>> --- a/libavutil/libm.h
>> +++ b/libavutil/libm.h
>> @@ -292,6 +292,30 @@ static inline double erf(double z)
>>  #define exp2f(x) ((float)exp2(x))
>>  #endif /* HAVE_EXP2F */
>>
>> +/* Somewhat inaccurate fallbacks, relative error ~ 1e-13 concentrated on 
>> very
>> +small and very large values. For perfection accuracy-wise, should use pow.
>> +Speed benefits (>2x average, with no super slow paths) deemed to be worth 
>> the
>> +accuracy tradeoff */
>> +#if !HAVE_EXP10
>> +static av_always_inline double exp10(double x)
>> +{
>> +#ifndef M_LOG2_10
>> +#define M_LOG2_10  3.32192809488736234787  /* log_2 10 */
>> +#endif
>
> Should include mathematic.h for this constant, it already defines
> common constants if not present.

Did not know if it was safe or not. Changed locally, thanks.

[...]
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavfi/af_aemphasis: remove unnecessary complex number usage

2015-12-22 Thread Paul B Mahol
On 12/22/15, Ganesh Ajjanagadde  wrote:
> On Tue, Dec 22, 2015 at 2:10 PM, Paul B Mahol  wrote:
>> On 12/22/15, Ganesh Ajjanagadde  wrote:
>>> On Tue, Dec 22, 2015 at 12:46 AM, Paul B Mahol  wrote:
 On 12/22/15, Ganesh Ajjanagadde  wrote:
> complex is not available on all platforms. Furthermore, it is trivial
> to
> rewrite complex number expressions to real arithmetic, and in fact
> sometimes advantageous for performance reasons: by wrapping as a
> complex,
> one forces a particular Cartesian representation that is not
> necessarily
> optimal for the purpose.
>
> Configure tests are also removed, and aemphasis is now available
> across
> all platforms.
>
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  configure  | 26 --
>  libavfilter/af_aemphasis.c | 13 ++---
>  2 files changed, 6 insertions(+), 33 deletions(-)
>
> diff --git a/configure b/configure
> index 0227540..46021c4 100755
> --- a/configure
> +++ b/configure
> @@ -1070,21 +1070,6 @@ int main(void){ $func(); }
>  EOF
>  }
>
> -check_complexfunc(){
> -log check_complexfunc "$@"
> -func=$1
> -narg=$2
> -shift 2
> -test $narg = 2 && args="f, g" || args="f * I"
> -disable $func
> -check_ld "cc" "$@" < -#include 
> -#include 
> -float foo(complex float f, complex float g) { return $func($args); }
> -int main(void){ return (int) foo; }
> -EOF
> -}
> -
>  check_mathfunc(){
>  log check_mathfunc "$@"
>  func=$1
> @@ -1803,11 +1788,6 @@ INTRINSICS_LIST="
>  intrinsics_neon
>  "
>
> -COMPLEX_FUNCS="
> -cabs
> -cexp
> -"
> -
>  MATH_FUNCS="
>  atanf
>  atan2f
> @@ -1944,7 +1924,6 @@ HAVE_LIST="
>  $ARCH_FEATURES
>  $ATOMICS_LIST
>  $BUILTIN_LIST
> -$COMPLEX_FUNCS
>  $HAVE_LIST_CMDLINE
>  $HAVE_LIST_PUB
>  $HEADERS_LIST
> @@ -2835,7 +2814,6 @@ unix_protocol_deps="sys_un_h"
>  unix_protocol_select="network"
>
>  # filters
> -aemphasis_filter_deps="cabs cexp"
>  amovie_filter_deps="avcodec avformat"
>  aresample_filter_deps="swresample"
>  ass_filter_deps="libass"
> @@ -5379,10 +5357,6 @@ for func in $MATH_FUNCS; do
>  eval check_mathfunc $func \${${func}_args:-1}
>  done
>
> -for func in $COMPLEX_FUNCS; do
> -eval check_complexfunc $func \${${func}_args:-1}
> -done
> -
>  # these are off by default, so fail if requested and not available
>  enabled avfoundation_indev && { check_header_objcc
> AVFoundation/AVFoundation.h || disable avfoundation_indev; }
>  enabled avfoundation_indev && { check_lib2
> CoreGraphics/CoreGraphics.h
> CGGetActiveDisplayList -framework CoreGraphics ||
> diff --git a/libavfilter/af_aemphasis.c b/libavfilter/af_aemphasis.c
> index 2966f77..a5b8e30 100644
> --- a/libavfilter/af_aemphasis.c
> +++ b/libavfilter/af_aemphasis.c
> @@ -18,8 +18,6 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301
> USA
>   */
>
> -#include 
> -
>  #include "libavutil/opt.h"
>  #include "avfilter.h"
>  #include "internal.h"
> @@ -189,14 +187,15 @@ static inline void set_lp_rbj(BiquadD2 *bq,
> double
> fc,
> double q, double sr, doub
>
>  static double freq_gain(BiquadCoeffs *c, double freq, double sr)
>  {
> -double complex z, w;
> +double zr, zi;
>
>  freq *= 2.0 * M_PI / sr;
> -w = 0 + I * freq;
> -z = 1.0 / cexp(w);
> +zr = cos(freq);
> +zi = -sin(freq);
>
> -return cabs(((double complex)c->a0 + c->a1 * z + c->a2 * z*z) /
> -((double complex)1.0 + c->b1 * z + c->b2 * z*z));
> +/* |(a0 + a1*z + a2*z^2)/(1 + b1*z + b2*z^2)| */
> +return hypot(c->a0 + c->a1*zr + c->a2*(zr*zr-zi*zi), c->a1*zi +
> 2*c->a2*zr*zi) /
> +   hypot(1 + c->b1*zr + c->b2*(zr*zr-zi*zi), c->b1*zi +
> 2*c->b2*zr*zi);
>  }
>
>  static int config_input(AVFilterLink *inlink)
> --
> 2.6.4
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

 ok
>>>
>>> I assume by this you are ok with the configure change as well.
>>> Personally, I think the effort needed for writing the configure hacks
>>> is higher than using real arithmetic, and hence I removed it to help
>>> ensure it is not added back again.
>>>
>>> This filter was added during the next version work, so does not need a
>>> Changelog update. Thanks, will push later.
>>>
>>
>> Please leave configure check alone, I'm writting some code that uses
>> complex again