[libav-devel] [PATCH] vaapi_h264: Fix HRD bit_rate/cpb_size scaling

2016-09-12 Thread Mark Thompson
There should be an extra offset of 6 on bit_rate_scale and of 4 on
cpb_size_scale which were not accounted for here (see H.264 E.2.2).
---
 libavcodec/vaapi_encode_h264.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index 5bd5605..9d6ff27 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -861,14 +861,14 @@ static int 
vaapi_encode_h264_init_sequence_params(AVCodecContext *avctx)
 // Try to scale these to a sensible range so that the
 // golomb encode of the value is not overlong.
 mseq->bit_rate_scale =
-av_clip(av_log2(avctx->bit_rate) - 15, 0, 15);
+av_clip_uintp2(av_log2(avctx->bit_rate) - 15 - 6, 4);
 mseq->bit_rate_value_minus1[0] =
-(avctx->bit_rate >> mseq->bit_rate_scale) - 1;
+(avctx->bit_rate >> mseq->bit_rate_scale + 6) - 1;

 mseq->cpb_size_scale =
-av_clip(av_log2(priv->hrd_params.hrd.buffer_size) - 15, 0, 15);
+av_clip_uintp2(av_log2(priv->hrd_params.hrd.buffer_size) - 15 
- 4, 4);
 mseq->cpb_size_value_minus1[0] =
-(priv->hrd_params.hrd.buffer_size >> mseq->cpb_size_scale) - 1;
+(priv->hrd_params.hrd.buffer_size >> mseq->cpb_size_scale + 4) 
- 1;

 // CBR mode isn't actually available here, despite naming.
 mseq->cbr_flag[0] = 0;
-- 
2.9.3

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


[libav-devel] [PATCH] hwcontext_vdpau: Fix warning and typo

2016-09-12 Thread Mark Thompson
---
Warning: GET_CALLBACK is redefined with a subtle difference; just make them the 
same and remove the second definition.

Typo: linesize should be linesize[i], but the error is hidden by the explicit 
cast.  Probably invisible because AVFrame has to be heap-allocated and is 
small, so it will always be sbrked and hence at a low address.

 libavutil/hwcontext_vdpau.c | 39 ++-
 1 file changed, 14 insertions(+), 25 deletions(-)

diff --git a/libavutil/hwcontext_vdpau.c b/libavutil/hwcontext_vdpau.c
index 9722c10..0975771 100644
--- a/libavutil/hwcontext_vdpau.c
+++ b/libavutil/hwcontext_vdpau.c
@@ -127,13 +127,6 @@ static int vdpau_init_pixmfts(AVHWDeviceContext *ctx)
 return 0;
 }

-static int vdpau_device_init(AVHWDeviceContext *ctx)
-{
-AVVDPAUDeviceContext *hwctx = ctx->hwctx;
-VDPAUDeviceContext   *priv  = ctx->internal->priv;
-VdpStatus err;
-int   ret;
-
 #define GET_CALLBACK(id, result)   
 \
 do {   
 \
 void *tmp; 
 \
@@ -142,15 +135,22 @@ do {
 av_log(ctx, AV_LOG_ERROR, "Error getting the " #id " callback.\n");
 \
 return AVERROR_UNKNOWN;
 \
 }  
 \
-priv->result = tmp;
 \
+result = tmp;  
 \
 } while (0)

+static int vdpau_device_init(AVHWDeviceContext *ctx)
+{
+AVVDPAUDeviceContext *hwctx = ctx->hwctx;
+VDPAUDeviceContext   *priv  = ctx->internal->priv;
+VdpStatus err;
+int   ret;
+
 
GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES,
- get_transfer_caps);
-GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR, get_data);
-GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR, put_data);
-GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_CREATE,   surf_create);
-GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_DESTROY,  surf_destroy);
+ priv->get_transfer_caps);
+GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR, priv->get_data);
+GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR, priv->put_data);
+GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_CREATE,   
priv->surf_create);
+GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_DESTROY,  
priv->surf_destroy);

 ret = vdpau_init_pixmfts(ctx);
 if (ret < 0) {
@@ -304,7 +304,7 @@ static int vdpau_transfer_data_from(AVHWFramesContext *ctx, 
AVFrame *dst,

 for (i = 0; i< FF_ARRAY_ELEMS(data) && dst->data[i]; i++) {
 data[i] = dst->data[i];
-if (dst->linesize[i] < 0 || (uint64_t)dst->linesize > UINT32_MAX) {
+if (dst->linesize[i] < 0 || (uint64_t)dst->linesize[i] > UINT32_MAX) {
 av_log(ctx, AV_LOG_ERROR,
"The linesize %d cannot be represented as uint32\n",
dst->linesize[i]);
@@ -444,17 +444,6 @@ static int vdpau_device_create(AVHWDeviceContext *ctx, 
const char *device,
 return AVERROR_UNKNOWN;
 }

-#define GET_CALLBACK(id, result)   
 \
-do {   
 \
-void *tmp; 
 \
-err = hwctx->get_proc_address(hwctx->device, id, );
 \
-if (err != VDP_STATUS_OK) {
 \
-av_log(ctx, AV_LOG_ERROR, "Error getting the " #id " callback.\n");
 \
-return AVERROR_UNKNOWN;
 \
-}  
 \
-result = tmp;  
 \
-} while (0)
-
 GET_CALLBACK(VDP_FUNC_ID_GET_INFORMATION_STRING, get_information_string);
 GET_CALLBACK(VDP_FUNC_ID_DEVICE_DESTROY, priv->device_destroy);

-- 
2.9.3

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


Re: [libav-devel] [PATCH 1/1] build: use the output file for reading the old version

2016-09-12 Thread Luca Barbato
On 12/09/16 21:55, Janne Grunau wrote:
> Fixes an oversight in 1316df7aa98c4.
> ---
>  version.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/version.sh b/version.sh
> index 6f72b2c..4689627 100755
> --- a/version.sh
> +++ b/version.sh
> @@ -18,7 +18,7 @@ if [ -z "$2" ]; then
>  fi
>  
>  NEW_REVISION="#define LIBAV_VERSION \"$version\""
> -OLD_REVISION=$(cat version.h 2> /dev/null)
> +OLD_REVISION=$(cat "$2" 2> /dev/null)
>  
>  # Update version.h only on revision changes to avoid spurious rebuilds
>  if test "$NEW_REVISION" != "$OLD_REVISION"; then
> 

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


Re: [libav-devel] [0.8] [PATCH 2/2] ac3_parser: add required padding for GetBitContext buffer

2016-09-12 Thread Luca Barbato
On 12/09/16 20:02, Diego Biurrun wrote:
> From: Janne Grunau 
> 
> Fixes stack buffer overflow errors detected by address sanitizer in
> various fate tests.
> 
> CC: libav-sta...@libav.org
> ---
>  libavcodec/ac3_parser.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
> index d9ba1fd..d71bab9 100644
> --- a/libavcodec/ac3_parser.c
> +++ b/libavcodec/ac3_parser.c
> @@ -147,7 +147,7 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext 
> *hdr_info,
>  int err;
>  union {
>  uint64_t u64;
> -uint8_t  u8[8];
> +uint8_t  u8[8 + FF_INPUT_BUFFER_PADDING_SIZE];
>  } tmp = { av_be2ne64(state) };
>  AC3HeaderInfo hdr;
>  GetBitContext gbc;
> 

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


Re: [libav-devel] [0.8] [PATCH 1/2] aac_parser: add required padding for GetBitContext buffer

2016-09-12 Thread Luca Barbato
On 12/09/16 19:57, Diego Biurrun wrote:
> From: Janne Grunau 
> 
> Fixes stack buffer overflow errors detected by address sanitizer in
> various fate tests.
> 
> CC: libav-sta...@libav.org
> (cherry picked from commit 02477323b92aacdabe0a2d129eeb0c15fbd1ec9e)
> Signed-off-by: Diego Biurrun 
> ---
>  libavcodec/aac_parser.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/aac_parser.c b/libavcodec/aac_parser.c
> index f0914e6..3708418 100644
> --- a/libavcodec/aac_parser.c
> +++ b/libavcodec/aac_parser.c
> @@ -34,7 +34,7 @@ static int aac_sync(uint64_t state, AACAC3ParseContext 
> *hdr_info,
>  int size;
>  union {
>  uint64_t u64;
> -uint8_t  u8[8];
> +uint8_t  u8[8 + FF_INPUT_BUFFER_PADDING_SIZE];
>  } tmp;
>  
>  tmp.u64 = av_be2ne64(state);
> 

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


[libav-devel] [PATCH 1/1] build: use the output file for reading the old version

2016-09-12 Thread Janne Grunau
Fixes an oversight in 1316df7aa98c4.
---
 version.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/version.sh b/version.sh
index 6f72b2c..4689627 100755
--- a/version.sh
+++ b/version.sh
@@ -18,7 +18,7 @@ if [ -z "$2" ]; then
 fi
 
 NEW_REVISION="#define LIBAV_VERSION \"$version\""
-OLD_REVISION=$(cat version.h 2> /dev/null)
+OLD_REVISION=$(cat "$2" 2> /dev/null)
 
 # Update version.h only on revision changes to avoid spurious rebuilds
 if test "$NEW_REVISION" != "$OLD_REVISION"; then
-- 
2.10.0

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


Re: [libav-devel] Libav Sprint Pelhřimov

2016-09-12 Thread Alexandra Hájková
The sprint was set to 29.9 - 30.10.2016 in the wilds around Pelhřimov.
There're 5 attendees so far.
The topics are:
* the new bitstream reader
* SIMD - x86, ppc, arm - playing with odroid and beagle bone
* cooking
* enjoying countryside
* evenutally others.
More people still welcome, feel free to reply here.

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

[libav-devel] [0.8] [PATCH 2/2] ac3_parser: add required padding for GetBitContext buffer

2016-09-12 Thread Diego Biurrun
From: Janne Grunau 

Fixes stack buffer overflow errors detected by address sanitizer in
various fate tests.

CC: libav-sta...@libav.org
---
 libavcodec/ac3_parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
index d9ba1fd..d71bab9 100644
--- a/libavcodec/ac3_parser.c
+++ b/libavcodec/ac3_parser.c
@@ -147,7 +147,7 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext 
*hdr_info,
 int err;
 union {
 uint64_t u64;
-uint8_t  u8[8];
+uint8_t  u8[8 + FF_INPUT_BUFFER_PADDING_SIZE];
 } tmp = { av_be2ne64(state) };
 AC3HeaderInfo hdr;
 GetBitContext gbc;
-- 
2.7.3

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


[libav-devel] [0.8] [PATCH 1/2] aac_parser: add required padding for GetBitContext buffer

2016-09-12 Thread Diego Biurrun
From: Janne Grunau 

Fixes stack buffer overflow errors detected by address sanitizer in
various fate tests.

CC: libav-sta...@libav.org
(cherry picked from commit 02477323b92aacdabe0a2d129eeb0c15fbd1ec9e)
Signed-off-by: Diego Biurrun 
---
 libavcodec/aac_parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/aac_parser.c b/libavcodec/aac_parser.c
index f0914e6..3708418 100644
--- a/libavcodec/aac_parser.c
+++ b/libavcodec/aac_parser.c
@@ -34,7 +34,7 @@ static int aac_sync(uint64_t state, AACAC3ParseContext 
*hdr_info,
 int size;
 union {
 uint64_t u64;
-uint8_t  u8[8];
+uint8_t  u8[8 + FF_INPUT_BUFFER_PADDING_SIZE];
 } tmp;
 
 tmp.u64 = av_be2ne64(state);
-- 
2.7.3

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


Re: [libav-devel] [PATCH] build: doc: more fine-grained dependencies for generated texi files

2016-09-12 Thread Janne Grunau
On 2016-09-12 17:43:37 +0200, Diego Biurrun wrote:
> ---
>  doc/Makefile | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/Makefile b/doc/Makefile
> index 2f6a5fb..e127132 100644
> --- a/doc/Makefile
> +++ b/doc/Makefile
> @@ -39,17 +39,19 @@ TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 
> }' <$< >$(@:%=%.d)
>  GENTEXI  = format codec
>  GENTEXI := $(GENTEXI:%=doc/avoptions_%.texi)
>  
> +$(MANPAGES) $(PODPAGES): $(GENTEXI)
> +

doesn't this misses
$(AVPROGS-yes:%=doc/%.html): $(GENTEXI)

>  $(GENTEXI): TAG = GENTEXI
>  $(GENTEXI): doc/avoptions_%.texi: doc/print_options$(HOSTEXESUF)
>   $(M)doc/print_options $* > $@
>  
>  doc/%.html: TAG = HTML
> -doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
> +doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init
>   $(Q)$(TEXIDEP)
>   $(M)texi2html -I doc -monolithic --init-file $(SRC_PATH)/doc/t2h.init 
> --output $@ $<
>  
>  doc/%.pod: TAG = POD
> -doc/%.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl $(GENTEXI)
> +doc/%.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl
>   $(Q)$(TEXIDEP)
>   $(M)$(SRC_PATH)/doc/texi2pod.pl -Idoc $< $@
>  

you missed a $(GENTEXT) dep for doc/%.pod but I might have a better 
solution for this.

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


Re: [libav-devel] Libav Sprint Pelhřimov

2016-09-12 Thread Luca Barbato
On 05/09/16 20:20, Alexandra Hájková wrote:
> I would like to organise Libav sprint in a month, there's just one
> date selected, 30/9(Fri) - 2(3)/10, please follow the link and add
> yourself to the poll if you're interested in participating:
> http://doodle.com/poll/52vfbx6ct3hy6vif
> 

For those attending, I can bring the odroid so we can play with arm64
(if Janne comes I'll ask him to teach me a bit about neon).

Alexandra wanted to know a bit more about Altivec/VSX so possibly some
more patches will appear on the subject =)

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


Re: [libav-devel] [PATCH] configure: Drop check_lib()/require() in favor of check_lib2()/require2()

2016-09-12 Thread Janne Grunau
On 2016-09-12 17:53:54 +0200, Diego Biurrun wrote:
> The latter can do everything the former can do, but also handle conditions
> the former cannot like multiple header #includes and checking for headers
> and functions in a single test program, which is necessary for certain
> library tests.
> ---
> 
> Squashed 1/3 and 2/3 together as Janne preferred.
> 
>  configure | 52 ++--
>  1 file changed, 18 insertions(+), 34 deletions(-)
> 
> diff --git a/configure b/configure
> index 520f07c..356dbc1 100755
> --- a/configure
> +++ b/configure
> @@ -988,14 +988,6 @@ EOF
>  
>  check_lib(){
>  log check_lib "$@"
> -header="$1"
> -func="$2"
> -shift 2
> -check_header $header && check_func $func "$@" && add_extralibs "$@"
> -}
> -
> -check_lib2(){
> -log check_lib2 "$@"
>  headers="$1"
>  funcs="$2"
>  shift 2
> @@ -1092,18 +1084,10 @@ check_compile_assert(){
>  
>  require(){
>  name="$1"
> -header="$2"
> -func="$3"
> -shift 3
> -check_lib $header $func "$@" || die "ERROR: $name not found"
> -}
> -
> -require2(){
> -name="$1"
>  headers="$2"
>  func="$3"
>  shift 3
> -check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
> +check_lib "$headers" $func "$@" || die "ERROR: $name not found"
>  }
>  
>  require_pkg_config(){
> @@ -4536,9 +4520,9 @@ check_header VideoDecodeAcceleration/VDADecoder.h
>  check_header windows.h
>  check_header X11/extensions/XvMClib.h
>  
> -check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
> -check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
> -check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
> +check_lib "windows.h shellapi.h" CommandLineToArgvW   -lshell32
> +check_lib "windows.h wincrypt.h" CryptGenRandom   -ladvapi32
> +check_lib "windows.h psapi.h"GetProcessMemoryInfo -lpsapi
>  
>  check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
>  
> @@ -4581,8 +4565,8 @@ fi
>  enabled pthreads &&
>  check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); 
> sem_timedwait(s,0); sem_destroy(s)"
>  
> -disabled  zlib || check_lib   zlib.h  zlibVersion -lz   || disable  zlib
> -disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
> +disabled  zlib || check_lib  zlib.h  zlibVersion -lz   || disable  zlib
> +disabled bzlib || check_lib bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
>  
>  check_lib math.h sin -lm && LIBM="-lm"
>  
> @@ -4595,15 +4579,15 @@ for func in $MATH_FUNCS; do
>  done
>  
>  # these are off by default, so fail if requested and not available
> -enabled avisynth  && { check_lib2 "avisynth/avisynth_c.h windows.h" 
> LoadLibrary ||
> -   check_lib2 "avxsynth/avxsynth_c.h dlfcn.h" 
> dlopen -ldl   ||
> +enabled avisynth  && { check_lib "avisynth/avisynth_c.h windows.h" 
> LoadLibrary ||
> +   check_lib "avxsynth/avxsynth_c.h dlfcn.h" 
> dlopen -ldl   ||
> die "ERROR: LoadLibrary/dlopen not found, or 
> avisynth header not found"; }
>  enabled cuda  && check_lib cuda.h cuInit -lcuda
>  enabled frei0r&& { check_header frei0r.h || die "ERROR: frei0r.h 
> header not found"; }
>  enabled gnutls&& require_pkg_config gnutls gnutls/gnutls.h 
> gnutls_global_init
>  enabled libbs2b   && require_pkg_config libbs2b bs2b.h bs2b_open
>  enabled libdcadec && require libdcadec libdcadec/dca_context.h 
> dcadec_context_create -ldcadec
> -enabled libfaac   && require2 libfaac "stdint.h faac.h" 
> faacEncGetVersion -lfaac
> +enabled libfaac   && require libfaac "stdint.h faac.h" 
> faacEncGetVersion -lfaac
>  enabled libfdk_aac&& require_pkg_config fdk-aac 
> "fdk-aac/aacenc_lib.h" aacEncOpen
>  enabled libfontconfig && require_pkg_config fontconfig 
> "fontconfig/fontconfig.h" FcInit
>  enabled libfreetype   && require_pkg_config freetype2 "ft2build.h 
> FT_FREETYPE_H" FT_Init_FreeType
> @@ -4620,7 +4604,7 @@ enabled libopencore_amrnb && require libopencore_amrnb 
> opencore-amrnb/interf_dec
>  enabled libopencore_amrwb && require libopencore_amrwb 
> opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
>  enabled libopencv && require_pkg_config opencv opencv/cv.h 
> cvCreateImageHeader
>  enabled libopenh264   && require_pkg_config openh264 wels/codec_api.h 
> WelsGetCodecVersion
> -enabled libopenjpeg   && { check_lib2 openjpeg.h opj_version -lopenjpeg 
> -DOPJ_STATIC ||
> +enabled libopenjpeg   && { check_lib openjpeg.h opj_version -lopenjpeg 
> -DOPJ_STATIC ||
> require_pkg_config libopenjpeg1 openjpeg.h 
> opj_version -DOPJ_STATIC; }
>  enabled libopus   && require_pkg_config opus opus_multistream.h 
> opus_multistream_decoder_create
>  enabled libpulse  && require_pkg_config libpulse-simple 
> 

[libav-devel] [PATCH] configure: Drop check_lib()/require() in favor of check_lib2()/require2()

2016-09-12 Thread Diego Biurrun
The latter can do everything the former can do, but also handle conditions
the former cannot like multiple header #includes and checking for headers
and functions in a single test program, which is necessary for certain
library tests.
---

Squashed 1/3 and 2/3 together as Janne preferred.

 configure | 52 ++--
 1 file changed, 18 insertions(+), 34 deletions(-)

diff --git a/configure b/configure
index 520f07c..356dbc1 100755
--- a/configure
+++ b/configure
@@ -988,14 +988,6 @@ EOF
 
 check_lib(){
 log check_lib "$@"
-header="$1"
-func="$2"
-shift 2
-check_header $header && check_func $func "$@" && add_extralibs "$@"
-}
-
-check_lib2(){
-log check_lib2 "$@"
 headers="$1"
 funcs="$2"
 shift 2
@@ -1092,18 +1084,10 @@ check_compile_assert(){
 
 require(){
 name="$1"
-header="$2"
-func="$3"
-shift 3
-check_lib $header $func "$@" || die "ERROR: $name not found"
-}
-
-require2(){
-name="$1"
 headers="$2"
 func="$3"
 shift 3
-check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
+check_lib "$headers" $func "$@" || die "ERROR: $name not found"
 }
 
 require_pkg_config(){
@@ -4536,9 +4520,9 @@ check_header VideoDecodeAcceleration/VDADecoder.h
 check_header windows.h
 check_header X11/extensions/XvMClib.h
 
-check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
-check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
-check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
+check_lib "windows.h shellapi.h" CommandLineToArgvW   -lshell32
+check_lib "windows.h wincrypt.h" CryptGenRandom   -ladvapi32
+check_lib "windows.h psapi.h"GetProcessMemoryInfo -lpsapi
 
 check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
 
@@ -4581,8 +4565,8 @@ fi
 enabled pthreads &&
 check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); 
sem_timedwait(s,0); sem_destroy(s)"
 
-disabled  zlib || check_lib   zlib.h  zlibVersion -lz   || disable  zlib
-disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
+disabled  zlib || check_lib  zlib.h  zlibVersion -lz   || disable  zlib
+disabled bzlib || check_lib bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
 
 check_lib math.h sin -lm && LIBM="-lm"
 
@@ -4595,15 +4579,15 @@ for func in $MATH_FUNCS; do
 done
 
 # these are off by default, so fail if requested and not available
-enabled avisynth  && { check_lib2 "avisynth/avisynth_c.h windows.h" 
LoadLibrary ||
-   check_lib2 "avxsynth/avxsynth_c.h dlfcn.h" 
dlopen -ldl   ||
+enabled avisynth  && { check_lib "avisynth/avisynth_c.h windows.h" 
LoadLibrary ||
+   check_lib "avxsynth/avxsynth_c.h dlfcn.h" 
dlopen -ldl   ||
die "ERROR: LoadLibrary/dlopen not found, or 
avisynth header not found"; }
 enabled cuda  && check_lib cuda.h cuInit -lcuda
 enabled frei0r&& { check_header frei0r.h || die "ERROR: frei0r.h 
header not found"; }
 enabled gnutls&& require_pkg_config gnutls gnutls/gnutls.h 
gnutls_global_init
 enabled libbs2b   && require_pkg_config libbs2b bs2b.h bs2b_open
 enabled libdcadec && require libdcadec libdcadec/dca_context.h 
dcadec_context_create -ldcadec
-enabled libfaac   && require2 libfaac "stdint.h faac.h" 
faacEncGetVersion -lfaac
+enabled libfaac   && require libfaac "stdint.h faac.h" 
faacEncGetVersion -lfaac
 enabled libfdk_aac&& require_pkg_config fdk-aac "fdk-aac/aacenc_lib.h" 
aacEncOpen
 enabled libfontconfig && require_pkg_config fontconfig 
"fontconfig/fontconfig.h" FcInit
 enabled libfreetype   && require_pkg_config freetype2 "ft2build.h 
FT_FREETYPE_H" FT_Init_FreeType
@@ -4620,7 +4604,7 @@ enabled libopencore_amrnb && require libopencore_amrnb 
opencore-amrnb/interf_dec
 enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h 
D_IF_init -lopencore-amrwb
 enabled libopencv && require_pkg_config opencv opencv/cv.h 
cvCreateImageHeader
 enabled libopenh264   && require_pkg_config openh264 wels/codec_api.h 
WelsGetCodecVersion
-enabled libopenjpeg   && { check_lib2 openjpeg.h opj_version -lopenjpeg 
-DOPJ_STATIC ||
+enabled libopenjpeg   && { check_lib openjpeg.h opj_version -lopenjpeg 
-DOPJ_STATIC ||
require_pkg_config libopenjpeg1 openjpeg.h 
opj_version -DOPJ_STATIC; }
 enabled libopus   && require_pkg_config opus opus_multistream.h 
opus_multistream_decoder_create
 enabled libpulse  && require_pkg_config libpulse-simple pulse/simple.h 
pa_simple_new
@@ -4746,16 +4730,16 @@ check_header sys/soundcard.h
 check_header soundcard.h
 
 enabled_any alsa_indev alsa_outdev &&
-check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
+check_lib alsa/asoundlib.h snd_pcm_htimestamp -lasound
 
-enabled jack_indev && check_lib2 

Re: [libav-devel] [PATCH] configure: more fine-grained link-time dependency settings

2016-09-12 Thread Diego Biurrun
On Sun, Sep 11, 2016 at 07:12:47PM +0200, Diego Biurrun wrote:
> Previously all external library dependencies were added as link-time
> dependencies to all components. This adds bogus dependencies to some
> components, so only add dependencies to components if said components
> actually make use of a dependency.
> ---
> 
> Squashed 1/3 and 2/3 together as Janne preferred.
> 
>  Makefile  |   2 +-
>  configure | 247 
> +++---
>  2 files changed, 141 insertions(+), 108 deletions(-)

Ignore this one, I resent the wrong patch..

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


[libav-devel] [PATCH] build: doc: more fine-grained dependencies for generated texi files

2016-09-12 Thread Diego Biurrun
---
 doc/Makefile | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/doc/Makefile b/doc/Makefile
index 2f6a5fb..e127132 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -39,17 +39,19 @@ TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 
}' <$< >$(@:%=%.d)
 GENTEXI  = format codec
 GENTEXI := $(GENTEXI:%=doc/avoptions_%.texi)
 
+$(MANPAGES) $(PODPAGES): $(GENTEXI)
+
 $(GENTEXI): TAG = GENTEXI
 $(GENTEXI): doc/avoptions_%.texi: doc/print_options$(HOSTEXESUF)
$(M)doc/print_options $* > $@
 
 doc/%.html: TAG = HTML
-doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
+doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init
$(Q)$(TEXIDEP)
$(M)texi2html -I doc -monolithic --init-file $(SRC_PATH)/doc/t2h.init 
--output $@ $<
 
 doc/%.pod: TAG = POD
-doc/%.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl $(GENTEXI)
+doc/%.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl
$(Q)$(TEXIDEP)
$(M)$(SRC_PATH)/doc/texi2pod.pl -Idoc $< $@
 
-- 
2.7.3

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


Re: [libav-devel] [PATCH] avisynth: support pix_fmts added to AviSynth+

2016-09-12 Thread Stephen Hutchinson

On 9/12/2016 5:58 AM, Luca Barbato wrote:

So the patch can land as-is or shall we wait?



It needs to wait and an updated version sent.

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


Re: [libav-devel] [PATCH] libvpx: Support additional pixel format

2016-09-12 Thread Vittorio Giovara
On Mon, Sep 5, 2016 at 2:33 PM, Luca Barbato  wrote:
> As discussed in the ml, the high bitdept support in vpx allows to
> specify the number of bits used.
>
> Reported-by: Harfe Leier 
> ---
>
>  libavcodec/libvpx.c| 28 +++-
>  libavcodec/libvpx.h|  2 +-
>  libavcodec/libvpxdec.c |  2 +-
>  3 files changed, 25 insertions(+), 7 deletions(-)
>
> diff --git a/libavcodec/libvpx.c b/libavcodec/libvpx.c
> index 49f966d..c65f80d 100644
> --- a/libavcodec/libvpx.c
> +++ b/libavcodec/libvpx.c
> @@ -22,9 +22,9 @@
>
>  #include "libvpx.h"
>
> -enum AVPixelFormat ff_vpx_imgfmt_to_pixfmt(vpx_img_fmt_t img)
> +enum AVPixelFormat ff_vpx_image_to_pixfmt(vpx_image_t *img)
>  {
> -switch (img) {
> +switch (img->fmt) {
>  case VPX_IMG_FMT_RGB24: return AV_PIX_FMT_RGB24;
>  case VPX_IMG_FMT_RGB565:return AV_PIX_FMT_RGB565BE;
>  case VPX_IMG_FMT_RGB555:return AV_PIX_FMT_RGB555BE;
> @@ -42,9 +42,27 @@ enum AVPixelFormat ff_vpx_imgfmt_to_pixfmt(vpx_img_fmt_t 
> img)
>  case VPX_IMG_FMT_444A:  return AV_PIX_FMT_YUVA444P;
>  #if VPX_IMAGE_ABI_VERSION >= 3
>  case VPX_IMG_FMT_I440:  return AV_PIX_FMT_YUV440P;
> -case VPX_IMG_FMT_I42016:return AV_PIX_FMT_YUV420P16BE;
> -case VPX_IMG_FMT_I42216:return AV_PIX_FMT_YUV422P16BE;
> -case VPX_IMG_FMT_I44416:return AV_PIX_FMT_YUV444P16BE;
> +case VPX_IMG_FMT_I42016:
> +switch (img->bit_depth) {
> +case  9: return AV_PIX_FMT_YUV420P9;
> +case 10: return AV_PIX_FMT_YUV420P10;
> +case 16: return AV_PIX_FMT_YUV420P16BE;
> +default: return AV_PIX_FMT_NONE;
> +}
> +case VPX_IMG_FMT_I42216:
> +switch (img->bit_depth) {
> +case  9: return AV_PIX_FMT_YUV422P9;
> +case 10: return AV_PIX_FMT_YUV422P10;
> +case 16: return AV_PIX_FMT_YUV422P16BE;
> +default: return AV_PIX_FMT_NONE;
> +}
> +case VPX_IMG_FMT_I44416:
> +switch (img->bit_depth) {
> +case  9: return AV_PIX_FMT_YUV444P9;
> +case 10: return AV_PIX_FMT_YUV444P10;
> +case 16: return AV_PIX_FMT_YUV444P16BE;
> +default: return AV_PIX_FMT_NONE;
> +}
>  #endif
>  default:return AV_PIX_FMT_NONE;
>  }
> diff --git a/libavcodec/libvpx.h b/libavcodec/libvpx.h
> index b437f37..2b58ed4 100644
> --- a/libavcodec/libvpx.h
> +++ b/libavcodec/libvpx.h
> @@ -25,7 +25,7 @@
>
>  #include "avcodec.h"
>
> -enum AVPixelFormat ff_vpx_imgfmt_to_pixfmt(vpx_img_fmt_t img);
> +enum AVPixelFormat ff_vpx_image_to_pixfmt(vpx_image_t *img);
>  vpx_img_fmt_t ff_vpx_pixfmt_to_imgfmt(enum AVPixelFormat pix);
>
>  #endif /* AVCODEC_LIBVPX_H */
> diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
> index 6d3b29f..214e1c5 100644
> --- a/libavcodec/libvpxdec.c
> +++ b/libavcodec/libvpxdec.c
> @@ -81,7 +81,7 @@ static int vp8_decode(AVCodecContext *avctx,
>  }
>
>  if ((img = vpx_codec_get_frame(>decoder, ))) {
> -avctx->pix_fmt = ff_vpx_imgfmt_to_pixfmt(img->fmt);
> +avctx->pix_fmt = ff_vpx_image_to_pixfmt(img);
>  if (avctx->pix_fmt == AV_PIX_FMT_NONE) {
>  av_log(avctx, AV_LOG_ERROR, "Unsupported output colorspace 
> (%d)\n",
> img->fmt);
> --

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


Re: [libav-devel] [PATCH] vpx: Support high bitdepth encoding

2016-09-12 Thread Vittorio Giovara
On Mon, Sep 5, 2016 at 2:54 PM, Luca Barbato  wrote:
> ---
>
> Consider that tentative since I have a plane to take, testing welcome :)
>
>  libavcodec/libvpx.c|  6 ++
>  libavcodec/libvpxenc.c | 12 
>  2 files changed, 18 insertions(+)
>
> diff --git a/libavcodec/libvpx.c b/libavcodec/libvpx.c
> index c65f80d..98cae0b 100644
> --- a/libavcodec/libvpx.c
> +++ b/libavcodec/libvpx.c
> @@ -88,8 +88,14 @@ vpx_img_fmt_t ff_vpx_pixfmt_to_imgfmt(enum AVPixelFormat 
> pix)
>  case AV_PIX_FMT_YUVA444P: return VPX_IMG_FMT_444A;
>  #if VPX_IMAGE_ABI_VERSION >= 3
>  case AV_PIX_FMT_YUV440P:  return VPX_IMG_FMT_I440;
> +case AV_PIX_FMT_YUV420P9:
> +case AV_PIX_FMT_YUV420P10:
>  case AV_PIX_FMT_YUV420P16BE:  return VPX_IMG_FMT_I42016;
> +case AV_PIX_FMT_YUV422P9:
> +case AV_PIX_FMT_YUV422P10:
>  case AV_PIX_FMT_YUV422P16BE:  return VPX_IMG_FMT_I42216;
> +case AV_PIX_FMT_YUV444P9:
> +case AV_PIX_FMT_YUV444P10:
>  case AV_PIX_FMT_YUV444P16BE:  return VPX_IMG_FMT_I44416;
>  #endif
>  default:  return VPX_IMG_FMT_NONE;
> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> index bb4c98f..541be5d 100644
> --- a/libavcodec/libvpxenc.c
> +++ b/libavcodec/libvpxenc.c
> @@ -35,6 +35,7 @@
>  #include "libavutil/common.h"
>  #include "libavutil/mathematics.h"
>  #include "libavutil/opt.h"
> +#include "libavutil/pixdesc.h"
>
>  /**
>   * Portion of struct vpx_codec_cx_pkt from vpx_encoder.h.
> @@ -561,6 +562,12 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket 
> *pkt,
>  rawimg->range = VPX_CR_FULL_RANGE;
>  break;
>  }
> +{
> +const AVPixFmtDescriptor *desc = 
> av_pix_fmt_desc_get(frame->format);
> +if (desc) {
> +rawimg->bit_depth = av_get_bits_per_pixel(desc);

i'd fail with _BUG if !desc

seems ok if tested

> +}
> +}
>  #endif
>  if (frame->pict_type == AV_PICTURE_TYPE_I)
>  flags |= VPX_EFLAG_FORCE_KF;
> @@ -699,6 +706,11 @@ AVCodec ff_libvpx_vp9_encoder = {
>  AV_PIX_FMT_YUV444P,
>  AV_PIX_FMT_YUV440P,
>  #endif
> +#if VPX_IMAGE_ABI_VERSION >= 4
> +AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV422P16BE,
> +AV_PIX_FMT_YUV422P9, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV422P16BE,
> +AV_PIX_FMT_YUV444P9, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV444P16BE,
> +#endif
>  AV_PIX_FMT_NONE,
>  },
>  .profiles   = NULL_IF_CONFIG_SMALL(profiles),
> --
> 2.9.2
>
> ___
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel



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


Re: [libav-devel] [PATCH] mpegvideo_motion: Handle edge emulation even without unrestricted_mv

2016-09-12 Thread Luca Barbato
On 12/09/16 16:33, Vittorio Giovara wrote:
> From: Michael Niedermayer 
> 
> Fix out of bounds read.
> Found by: F4B3CD@STARLAB.
> 
> Signed-off-by: Vittorio Giovara 
> ---
>  libavcodec/mpegvideo_motion.c | 19 ---
>  1 file changed, 8 insertions(+), 11 deletions(-)
> 


Sounds good, I guess it is too optimistic to think something claiming to
not have mv outside the picture doesn't have them :)

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


[libav-devel] [PATCH] mpegvideo_motion: Handle edge emulation even without unrestricted_mv

2016-09-12 Thread Vittorio Giovara
From: Michael Niedermayer 

Fix out of bounds read.
Found by: F4B3CD@STARLAB.

Signed-off-by: Vittorio Giovara 
---
 libavcodec/mpegvideo_motion.c | 19 ---
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c
index 8074dba..f6d9613 100644
--- a/libavcodec/mpegvideo_motion.c
+++ b/libavcodec/mpegvideo_motion.c
@@ -210,17 +210,14 @@ static inline int hpel_motion(MpegEncContext *s,
 dxy |= (motion_y & 1) << 1;
 src += src_y * s->linesize + src_x;
 
-if (s->unrestricted_mv) {
-if ((unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x & 1) - 8, 0) ||
-(unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y & 1) - 8, 0)) {
-s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, src,
- s->linesize, s->linesize,
- 9, 9,
- src_x, src_y, s->h_edge_pos,
- s->v_edge_pos);
-src = s->sc.edge_emu_buffer;
-emu = 1;
-}
+if ((unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x & 1) - 8, 0) ||
+(unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y & 1) - 8, 0)) {
+s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, src,
+ s->linesize, s->linesize,
+ 9, 9, src_x, src_y,
+ s->h_edge_pos, s->v_edge_pos);
+src = s->sc.edge_emu_buffer;
+emu = 1;
 }
 pix_op[dxy](dest, src, s->linesize, 8);
 return emu;
-- 
2.9.3

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


Re: [libav-devel] [PATCH] avisynth: support pix_fmts added to AviSynth+

2016-09-12 Thread Luca Barbato
On 12/09/16 01:24, Stephen Hutchinson wrote:
> On 8/21/2016 12:45 AM, Luca Barbato wrote:
>> On 21/08/16 06:09, Stephen Hutchinson wrote:
>>> A number of new pix_fmts* have been added to AviSynth+:
>>> 16-bit packed RGB and RGBA
>>> 10-, 12-, 14, and 16-bit YUV 4:2:0, 4:2:2, and 4:4:4
>>> 8-, 10-, 12-, 14-, and 16-bit Planar RGB
>>> 8-, 10-, 12-, 14-, and 16-bit Planar YUVA and Planar RGBA
>>> 10-, 12-, 14-, and 16-bit GRAY variants
>>> 32-bit floating point Planar YUV(A), Planar RGB(A), and GRAY
>>>
>>> *some of which are not currently available pix_fmts here and were
>>>  not added to the demuxer due to this
>>> ---
>>>  libavformat/avisynth.c | 142
>>> -
>>>  1 file changed, 141 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
>>
>> Looks straightforward, what's the best way to test it though?
>>
>> lu
>>
>> ___
>> libav-devel mailing list
>> libav-devel@libav.org
>> https://lists.libav.org/mailman/listinfo/libav-devel
>>
> 
> My previous follow-up email about this is already outdated, as
> there's been more development for the Planar RGB and Alpha
> formats, making them easier to test than I explained before.
> It also happened to expose an issue with the Planar RGB flipping
> block in the original patch, so a newer version will need to be
> sent.
> 
> Unfortunately, there was an inadvertent breakage in the upstream
> avs/capi.h header as regards MinGW support, which needs to be
> resolved in avsplus before the patch will work correctly again.
> A short-term workaround is installing the headers from git hash
> b4f292b4dbfad149697fb65c6a037bb3810813f9, but this lacks the Planar
> RGB fixes in pull request #101
> (github.com/AviSynth/AviSynthPlus/pull/101), so GBR(A)P will
> only output in greyscale.


So the patch can land as-is or shall we wait?

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


Re: [libav-devel] [PATCH 3/3] ppc: mpegvideo: Add proper runtime AltiVec detection

2016-09-12 Thread Diego Biurrun
On Mon, Sep 12, 2016 at 12:30:31AM +0200, Luca Barbato wrote:
> On 11/09/16 19:29, Diego Biurrun wrote:
> > --- a/libavcodec/ppc/mpegvideodsp.c
> > +++ b/libavcodec/ppc/mpegvideodsp.c
> > @@ -128,6 +128,9 @@ static void gmc1_altivec(uint8_t *dst /* align 8 */, 
> > uint8_t *src /* align1 */,
> >  av_cold void ff_mpegvideodsp_init_ppc(MpegVideoDSPContext *c)
> >  {
> >  #if HAVE_ALTIVEC && HAVE_BIGENDIAN
> > +if (!PPC_ALTIVEC(av_get_cpu_flags()))
> > +return;
> > +
> >  c->gmc1 = gmc1_altivec;
> >  #endif /* HAVE_ALTIVEC && HAVE_BIGENDIAN */
> >  }
> 
> Make sure you included the definition of PPC_ALTIVEC

The version on Oracle does.

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