Re: [libav-devel] [PATCH 38/48] af_resample: convert to AVFrame.

2013-02-27 Thread Anton Khirnov

On Tue, 26 Feb 2013 11:33:51 -0500, Justin Ruggles  
wrote:
> On 01/08/2013 09:40 AM, Anton Khirnov wrote:
> > +out= ff_get_audio_buffer(outlink, nb_samples);
> 
> space before =
> 
> > +if (!out) {
> >  ret = AVERROR(ENOMEM);
> >  goto fail;
> >  }
> >  
> > -ret = avresample_convert(s->avr, buf_out->extended_data,
> > - buf_out->linesize[0], nb_samples,
> > - buf->extended_data, buf->linesize[0],
> > - buf->audio->nb_samples);
> > +ret = avresample_convert(s->avr, out->extended_data,
> > + out->linesize[0], nb_samples,
> > + in->extended_data, in->linesize[0],
> > + in->nb_samples);
> 
> can you go ahead and fix the spacing while you're at it?
> 

Sure, both done locally.

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


Re: [libav-devel] [PATCH] Intel Media SDK, Quick Sync Video/QSV: Initial add of H.264 decoder infrastructure

2013-02-27 Thread Luca Barbato
On 27/02/13 23:46, Maxym Dmytrychenko wrote:
> ok, if to move into qsv.c - will it be fine ?
> if so, next patch will move lines:
> 
> #ifdef HAVE_AV_CONFIG_H
> #include "config.h"
> #endif
> 
> #if HAVE_THREADS
> #if defined (__GNUC__)
> #include 
> #define ff_qsv_atomic_inc(ptr) __sync_add_and_fetch(ptr,1)
> #define ff_qsv_atomic_dec(ptr) __sync_sub_and_fetch (ptr,1)
> #elif HAVE_WINDOWS_H// MSVC case
> #include 
> #if HAVE_PTHREADS
> #include 
> #elif HAVE_W32THREADS
> #include "w32pthreads.h"
> #endif
> #define ff_qsv_atomic_inc(ptr) InterlockedIncrement(ptr)
> #define ff_qsv_atomic_dec(ptr) InterlockedDecrement (ptr)
> #else
> // targeting only for MinGW or MSVC
> #endif
> 
> #else
> #define ff_qsv_atomic_inc(ptr) ((*ptr)++)
> #define ff_qsv_atomic_dec(ptr) ((*ptr)--)
> #endif
> 
> into qsv.c

Yes, once the evil plan lands it could be simplified btw.

lu

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


Re: [libav-devel] [PATCH] Intel Media SDK, Quick Sync Video/QSV: Initial add of H.264 decoder infrastructure

2013-02-27 Thread Maxym Dmytrychenko
On 13-02-27 19:50:51, Diego Biurrun wrote:
> On Wed, Feb 27, 2013 at 06:39:57PM +0100, maxd wrote:
> > On 13-02-21 16:03:30, Diego Biurrun wrote:
> > > On Mon, Feb 04, 2013 at 08:49:35PM +0100, Maxym Dmytrychenko wrote:
> > > > From: Maxym Dmytrychenko 
> > > > 
> > > Does your patch pass "make check"?  I suspect at least the checkheaders
> > > target will not pass.
> > 
> > my latest patch from
> > http://lists.libav.org/pipermail/libav-devel/2013-February/043882.html
> > should be fine, 
> > including make checkheaders on MinGW and MSVC
> 
> It only passes checkheaders if the mxf headers are available.
> Fixed in the changes I sent you.

got it and appriciated!

> > > > --- /dev/null
> > > > +++ b/libavcodec/qsv.c
> > > > @@ -0,0 +1,556 @@
> > > > +void av_qsv_stage_clean(av_qsv_stage ** stage)
> > > > +{
> > > > +
> > > > +if ((*stage)->out.p_sync) {
> > > > +*(*stage)->out.p_sync = 0;
> > > > +(*stage)->out.p_sync = 0;
> > > > +}
> > > > +av_freep(stage);
> > > 
> > > Here a variable indirection would make things more readable.
> > 
> > if you have any sample that you can show to follow, I can change it.
> 
> av_qsv_stage *stage_ptr = *stage;
> 
> Maybe use a better variable name.

ok, will change in the next patch

> > > > +av_qsv_stage *av_qsv_get_by_mask(av_qsv_list * list, int mask, 
> > > > av_qsv_stage ** prev,
> > > > +   av_qsv_list ** this_pipe)
> > > > +{
> > > > +av_qsv_list *item = 0;
> > > > +av_qsv_stage *stage = 0;
> > > > +av_qsv_stage *prev_stage = 0;
> > > > +int i = 0;
> > > > +int a = 0;
> > > > +*this_pipe = 0;
> > > > +*prev = 0;
> > > > +for (i = 0; i < av_qsv_list_count(list); i++) {
> > > > +item = av_qsv_list_item(list, i);
> > > > +for (a = 0; a < av_qsv_list_count(item); a++) {
> > > > +stage = av_qsv_list_item(item, a);
> > > > +if (!stage)
> > > > +return stage;
> > > > +if (stage->type & mask) {
> > > > +*prev = prev_stage;
> > > > +*this_pipe = item;
> > > > +return stage;
> > > > +}
> > > > +prev_stage = stage;
> > > > +}
> > > > +}
> > > > +return 0;
> > > > +}
> > > 
> > > prev and this_pipe are only used dereferenced, so why not pass them as
> > > simple pointers?
> >
> > this way looks to be better for the final application that would use it 
> 
> Why?

ok , let's make it easy - I've removed this function completely.

> > > > --- /dev/null
> > > > +++ b/libavcodec/qsv.h
> > > > @@ -0,0 +1,469 @@
> > > You start the sentence with "As ..." but then you do not say what follows
> > > from the ability to use hw acceleration.
> > > 
> > > > +#ifdef HAVE_AV_CONFIG_H
> > > > +#include "config.h"
> > > > +#endif
> > > 
> > > No such inclusion guard is necessary.
> > it looks that might help to the final application ( dependency point as
> > it was last time )
> > I can check more here if needed.
> > If I will remove it from this file - will be a transparent change
> > for QSV implementation inside libav and final application.
> 
> You cannot include config.h in an installed header, with or without the
> inclusion guards.

ok, if to move into qsv.c - will it be fine ?
if so, next patch will move lines:

#ifdef HAVE_AV_CONFIG_H
#include "config.h"
#endif

#if HAVE_THREADS
#if defined (__GNUC__)
#include 
#define ff_qsv_atomic_inc(ptr) __sync_add_and_fetch(ptr,1)
#define ff_qsv_atomic_dec(ptr) __sync_sub_and_fetch (ptr,1)
#elif HAVE_WINDOWS_H// MSVC case
#include 
#if HAVE_PTHREADS
#include 
#elif HAVE_W32THREADS
#include "w32pthreads.h"
#endif
#define ff_qsv_atomic_inc(ptr) InterlockedIncrement(ptr)
#define ff_qsv_atomic_dec(ptr) InterlockedDecrement (ptr)
#else
// targeting only for MinGW or MSVC
#endif

#else
#define ff_qsv_atomic_inc(ptr) ((*ptr)++)
#define ff_qsv_atomic_dec(ptr) ((*ptr)--)
#endif

into qsv.c


> > > > +#define AV_QSV_ZERO_MEMORY(VAR){memset(&VAR, 0, 
> > > > sizeof(VAR));}
> > > > +#define AV_QSV_ALIGN32(X)  (((mfxU32)((X)+31)) & 
> > > > (~ (mfxU32)31))
> > > > +#define AV_QSV_ALIGN16(value)  (((value + 15) >> 4) << 
> > > > 4)
> > > > +#ifndef AV_QSV_PRINT_RET_MSG
> > > > +#define AV_QSV_PRINT_RET_MSG(ERR)  { av_log(NULL, 
> > > > AV_LOG_FATAL,"Error code %d,\t%s\t%d\n", ERR, __FUNCTION__, __LINE__); }
> > > > +#endif
> > > > +
> > > > +#ifndef AV_QSV_DEBUG_ASSERT
> > > > +#define AV_QSV_DEBUG_ASSERT(x,y)   {if ((x)) {av_log(NULL, 
> > > > AV_LOG_FATAL,"\nASSERT: %s\n",y);};}
> > > > +#endif
> > > > +
> > > > +#define AV_QSV_CHECK_RESULT(P, X, ERR) {if ((X) > (P)) 
> > > > {AV_QSV_PRINT_RET_MSG(ERR); return ERR;}}
> > > > +#define AV_QSV_CHECK_POINTER(P, ERR)   {if (!(P)) 
> > > > {AV_QSV_PRINT_RET_MSG(ERR); return ERR;}}
> > > > +#define AV_QSV_IGNORE_MFX_STS(P, X){if ((X) == (P)) {P 
> >

Re: [libav-devel] [PATCH] Intel Media SDK, Quick Sync Video/QSV: Initial add of H.264 decoder infrastructure

2013-02-27 Thread Diego Biurrun
On Wed, Feb 27, 2013 at 06:39:57PM +0100, maxd wrote:
> On 13-02-21 16:03:30, Diego Biurrun wrote:
> > On Mon, Feb 04, 2013 at 08:49:35PM +0100, Maxym Dmytrychenko wrote:
> > > From: Maxym Dmytrychenko 
> > > 
> > Does your patch pass "make check"?  I suspect at least the checkheaders
> > target will not pass.
> 
> my latest patch from
> http://lists.libav.org/pipermail/libav-devel/2013-February/043882.html
> should be fine, 
> including make checkheaders on MinGW and MSVC

It only passes checkheaders if the mxf headers are available.
Fixed in the changes I sent you.

> > > --- /dev/null
> > > +++ b/libavcodec/qsv.c
> > > @@ -0,0 +1,556 @@
> > > +void av_qsv_stage_clean(av_qsv_stage ** stage)
> > > +{
> > > +
> > > +if ((*stage)->out.p_sync) {
> > > +*(*stage)->out.p_sync = 0;
> > > +(*stage)->out.p_sync = 0;
> > > +}
> > > +av_freep(stage);
> > 
> > Here a variable indirection would make things more readable.
> 
> if you have any sample that you can show to follow, I can change it.

av_qsv_stage *stage_ptr = *stage;

Maybe use a better variable name.

> > > +av_qsv_stage *av_qsv_get_by_mask(av_qsv_list * list, int mask, 
> > > av_qsv_stage ** prev,
> > > +   av_qsv_list ** this_pipe)
> > > +{
> > > +av_qsv_list *item = 0;
> > > +av_qsv_stage *stage = 0;
> > > +av_qsv_stage *prev_stage = 0;
> > > +int i = 0;
> > > +int a = 0;
> > > +*this_pipe = 0;
> > > +*prev = 0;
> > > +for (i = 0; i < av_qsv_list_count(list); i++) {
> > > +item = av_qsv_list_item(list, i);
> > > +for (a = 0; a < av_qsv_list_count(item); a++) {
> > > +stage = av_qsv_list_item(item, a);
> > > +if (!stage)
> > > +return stage;
> > > +if (stage->type & mask) {
> > > +*prev = prev_stage;
> > > +*this_pipe = item;
> > > +return stage;
> > > +}
> > > +prev_stage = stage;
> > > +}
> > > +}
> > > +return 0;
> > > +}
> > 
> > prev and this_pipe are only used dereferenced, so why not pass them as
> > simple pointers?
>
> this way looks to be better for the final application that would use it 

Why?

> > > --- /dev/null
> > > +++ b/libavcodec/qsv.h
> > > @@ -0,0 +1,469 @@
> > You start the sentence with "As ..." but then you do not say what follows
> > from the ability to use hw acceleration.
> > 
> > > +#ifdef HAVE_AV_CONFIG_H
> > > +#include "config.h"
> > > +#endif
> > 
> > No such inclusion guard is necessary.
> it looks that might help to the final application ( dependency point as
> it was last time )
> I can check more here if needed.
> If I will remove it from this file - will be a transparent change
> for QSV implementation inside libav and final application.

You cannot include config.h in an installed header, with or without the
inclusion guards.

> > > +#define AV_QSV_ZERO_MEMORY(VAR){memset(&VAR, 0, 
> > > sizeof(VAR));}
> > > +#define AV_QSV_ALIGN32(X)  (((mfxU32)((X)+31)) & (~ 
> > > (mfxU32)31))
> > > +#define AV_QSV_ALIGN16(value)  (((value + 15) >> 4) << 4)
> > > +#ifndef AV_QSV_PRINT_RET_MSG
> > > +#define AV_QSV_PRINT_RET_MSG(ERR)  { av_log(NULL, 
> > > AV_LOG_FATAL,"Error code %d,\t%s\t%d\n", ERR, __FUNCTION__, __LINE__); }
> > > +#endif
> > > +
> > > +#ifndef AV_QSV_DEBUG_ASSERT
> > > +#define AV_QSV_DEBUG_ASSERT(x,y)   {if ((x)) {av_log(NULL, 
> > > AV_LOG_FATAL,"\nASSERT: %s\n",y);};}
> > > +#endif
> > > +
> > > +#define AV_QSV_CHECK_RESULT(P, X, ERR) {if ((X) > (P)) 
> > > {AV_QSV_PRINT_RET_MSG(ERR); return ERR;}}
> > > +#define AV_QSV_CHECK_POINTER(P, ERR)   {if (!(P)) 
> > > {AV_QSV_PRINT_RET_MSG(ERR); return ERR;}}
> > > +#define AV_QSV_IGNORE_MFX_STS(P, X){if ((X) == (P)) {P = 
> > > MFX_ERR_NONE;}}
> > > +
> > > +#define AV_QSV_ID_BUFFER MFX_MAKEFOURCC('B','U','F','F')
> > > +#define AV_QSV_ID_FRAME  MFX_MAKEFOURCC('F','R','M','E')
> > > +
> > > +#define AV_QSV_SURFACE_NUM  80
> > > +#define AV_QSV_SYNC_NUM AV_QSV_SURFACE_NUM*3/4
> > > +#define AV_QSV_BUF_SIZE_DEFAULT 4096*2160*10
> > > +#define AV_QSV_JOB_SIZE_DEFAULT 10
> > > +#define AV_QSV_SYNC_TIME_DEFAULT1
> > > +// see av_qsv_get_free_sync, av_qsv_get_free_surface , 100 if 
> > > usleep(10*1000)(10ms) == 1 sec
> > > +#define AV_QSV_REPEAT_NUM_DEFAULT  100
> > > +#define AV_QSV_ASYNC_DEPTH_DEFAULT 4
> > > +
> > > +// version of MSDK/QSV API currently used
> > > +#define AV_QSV_MSDK_VERSION_MAJOR  1
> > > +#define AV_QSV_MSDK_VERSION_MINOR  3
> > 
> > How much of all this needs to be in an installed header?
> > It looks mostly like internal stuff that needs not be part of externally
> > visible API to me.  The same applies to the rest of this header.
> very much yes, 
> as for the final application that will use libav and QSV,
> just remember that

Re: [libav-devel] [PATCH] LICENSE: Move (L)GPLv3 explanation block to a more suitable place

2013-02-27 Thread Luca Barbato
On 27/02/13 19:37, Diego Biurrun wrote:
> ---
>  LICENSE |   10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 

Ok.

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


[libav-devel] [PATCH] LICENSE: Move (L)GPLv3 explanation block to a more suitable place

2013-02-27 Thread Diego Biurrun
---
 LICENSE |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/LICENSE b/LICENSE
index 1266627..1074989 100644
--- a/LICENSE
+++ b/LICENSE
@@ -23,6 +23,11 @@ Specifically, the GPL parts of Libav are
 - vf_hqdn3d.c
 - vf_yadif.c
 
+Should you, for whatever reason, prefer to use version 3 of the (L)GPL, then
+the configure parameter --enable-version3 will activate this licensing option
+for you. Read the file COPYING.LGPLv3 or, if you have enabled GPL parts,
+COPYING.GPLv3 to learn the exact legal terms that apply in this case.
+
 There are a handful of files under other licensing terms, namely:
 
 * The files libavcodec/jfdctfst.c, libavcodec/jfdctint_template.c and
@@ -32,11 +37,6 @@ There are a handful of files under other licensing terms, 
namely:
   You must also indicate any changes including additions and deletions to
   those three files in the documentation.
 
-Should you, for whatever reason, prefer to use version 3 of the (L)GPL, then
-the configure parameter --enable-version3 will activate this licensing option
-for you. Read the file COPYING.LGPLv3 or, if you have enabled GPL parts,
-COPYING.GPLv3 to learn the exact legal terms that apply in this case.
-
 
 external libraries
 ==
-- 
1.7.9.5

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


Re: [libav-devel] [PATCH] Intel Media SDK, Quick Sync Video/QSV: Initial add of H.264 decoder infrastructure

2013-02-27 Thread maxd
On 13-02-21 16:03:30, Diego Biurrun wrote:
> On Mon, Feb 04, 2013 at 08:49:35PM +0100, Maxym Dmytrychenko wrote:
> > From: Maxym Dmytrychenko 
> > 
> > Provided feedback from Diego Biurrun, Thu Jan 31 14:38:45 CET 2013 and IRC 
> > disussion included
> > as much as it is possible.
> > 
> > For now: MinGW and MSVC compilers and targeting Windows OS.
> > 
> > For compilation - expected structure from Intel Media SDK:
> > lib/
> > libmfx.lib (or .a for MinGW case)
> > msdk/
> > mfxdefs.h
> > mfxjpeg.h
> > mfxmvc.h
> > mfxplugin.h
> > mfxplugin++.h
> > mfxstructures.h
> > mfxvideo.h
> > mfxvideo++.h
> > 
> > Media SDK provides libmfx.lib,
> > you can also build one from the provided at Media SDK 2013 sources.
> > 
> > Intel Media SDK available at 
> > http://software.intel.com/en-us/vcsource/tools/media-sdk
> > 
> > Usage example:
> > MSVC case:
> > ./configure --toolchain=msvc --extra-cflags="-I/d/hb/libav/msinttypes-r26 
> > -I/d/hb/libav/MediaSDK_2013" 
> > --extra-ldflags="-libpath:d:/hb/libav/MediaSDK_2013/lib/" 
> > --extra-libs="libmfx.lib" --disable-shared --prefix=/d/hb/libav/libav_build 
> > --enable-qsv
> > 
> > 
> > Note: 
> > Current c99wrap/c99conv(1.0.1) limitation with MSVC (WIP to fix):
> > 
> > - header mfxstructures.h might look like:
> >#define MFX_MAKEFOURCC(ch0, ch1, ch2, ch3) ((DWORD)(BYTE)(ch0) | 
> > ((DWORD)(BYTE)(ch1) << 8) | \
> >   ((DWORD)(BYTE)(ch2) << 16) | 
> > ((DWORD)(BYTE)(ch3) << 24 ))
> > instead of 
> >#define MFX_MAKEFOURCC(A,B,C,D)
> > int)A))+(((int)B)<<8)+(((int)C)<<16)+(((int)D)<<24))
> >
> > ---
> 
> Most of this should not be part of the log message, but rather be an
> annotation, see the --annotate option of git-send-email or add notes
> below the "---" if you use git-format-patch.
ok, will consider it for the next patch
Wanted to keep this info at some place

> 
> Does your patch pass "make check"?  I suspect at least the checkheaders
> target will not pass.

my latest patch from
http://lists.libav.org/pipermail/libav-devel/2013-February/043882.html
should be fine, 
including make checkheaders on MinGW and MSVC

> > --- a/Changelog
> > +++ b/Changelog
> > @@ -3,7 +3,7 @@ releases are sorted from youngest to oldest.
> >  
> >  version 10:
> >  - av_strnstr
> > -
> > +- QSV decoder hardware acceleration
> >  
> >  version 9:
> >  - av_basename and av_dirname
> 
> The empty line was there on purpose.

please see my latest patch, as above

> > --- a/configure
> > +++ b/configure
> > @@ -129,6 +129,7 @@ Component options:
> >--disable-rdft   disable RDFT code
> >--disable-fftdisable FFT code
> >--enable-dxva2   enable DXVA2 code
> > +  --enable-qsv enable QSV code
> >--enable-vaapi   enable VAAPI code
> >--enable-vda enable VDA code
> >--enable-vdpau   enable VDPAU code
> > @@ -1062,6 +1063,7 @@ CONFIG_LIST="
> >  nonfree
> >  openssl
> >  pic
> > +qsv
> >  rdft
> >  runtime_cpudetect
> >  safe_bitstream_reader
> 
> This needs to be rebased on top of current master.

please see my latest patch

> > @@ -1608,6 +1611,7 @@ h263_vaapi_hwaccel_select="vaapi h263_decoder"
> >  h263_vdpau_hwaccel_select="vdpau h263_decoder"
> >  h264_dxva2_hwaccel_deps="dxva2api_h"
> >  h264_dxva2_hwaccel_select="dxva2 h264_decoder"
> > +h264_qsv_decoder_select="qsv h264_decoder"
> >  h264_vaapi_hwaccel_select="vaapi h264_decoder"
> >  h264_vda_hwaccel_select="vda h264_decoder"
> >  h264_vdpau_decoder_select="vdpau h264_decoder"
> 
> This is wrong, but all surrounding lines are wrong as well.  It should
> depend on qsv and select the h264 decoder.  I have a patch locally to
> fix this block.  Rebase your patch on top once this is in master.

please see my latest patch

> > @@ -3578,6 +3582,11 @@ if ! disabled vdpau && enabled vdpau_vdpau_h; then
> >  
> > +# check for MSDK headers
> > +if ! disabled qsv && check_header msdk/mfxvideo.h; then
> > +enable qsv
> > +fi 
> 
> This is not how it's done, just check for the header, the dependency
> system will take care of the rest.
 >
see my latest patch
> --- a/libavcodec/Makefile
> > +++ b/libavcodec/Makefile
> > @@ -306,6 +307,7 @@ OBJS-$(CONFIG_QCELP_DECODER)   += qcelpdec.o
> >  \
> >  OBJS-$(CONFIG_QDRAW_DECODER)   += qdrw.o
> >  OBJS-$(CONFIG_QPEG_DECODER)+= qpeg.o
> > +OBJS-$(CONFIG_H264_QSV_DECODER)+= qsv_h264.o qsv.o
> >  OBJS-$(CONFIG_QTRLE_DECODER)   += qtrle.o
> >  OBJS-$(CONFIG_QTRLE_ENCODER)   += qtrleenc.o
> > --- a/libavcodec/allcodecs.c
> > +++ b/libavcodec/allcodecs.c
> > @@ -150,6 +150,7 @@ void avcodec_register_all(void)
> >  REGISTER_ENCODER(H263P, h263p);
> >  REGISTER_DECODER(H264,  h264);
> > +REGISTER_DECODER(H264_QSV,  h264_qsv);
> >  REGISTER_DECODER(H264_VDPAU,h264_vdpau);
> 

[libav-devel] [PATCH 2/2] Intel Media SDK, Quick Sync Video/QSV: Initial add of H.264 decoder infrastructure

2013-02-27 Thread maxim . d33
From: Maxym Dmytrychenko 

---
 Changelog  |1 +
 configure  |7 +++
 libavcodec/Makefile|2 ++
 libavcodec/allcodecs.c |1 +
 libavcodec/qsv.h   |2 +-
 libavcodec/qsv_h264.c  |9 -
 libavcodec/version.h   |2 +-
 libavutil/pixfmt.h |1 +
 8 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/Changelog b/Changelog
index f56c112..765b87f 100644
--- a/Changelog
+++ b/Changelog
@@ -4,6 +4,7 @@ releases are sorted from youngest to oldest.
 version 10:
 - av_strnstr
 - support ID3v2 tags in ASF files
+- QSV decoder hardware acceleration
 
 
 version 9:
diff --git a/configure b/configure
index 1aae93b..dcd0c37 100755
--- a/configure
+++ b/configure
@@ -130,6 +130,7 @@ Component options:
 
 Hardware accelerators:
   --enable-dxva2   enable DXVA2 code
+  --enable-qsv enable QSV code
   --enable-vaapi   enable VAAPI code
   --enable-vda enable VDA code
   --enable-vdpau   enable VDPAU code
@@ -1048,6 +1049,7 @@ EXTERNAL_LIBRARY_LIST="
 
 HWACCEL_LIST="
 dxva2
+qsv
 vaapi
 vda
 vdpau
@@ -1624,6 +1626,8 @@ zmbv_encoder_select="zlib"
 
 # hardware accelerators
 dxva2_deps="dxva2api_h"
+qsv_deps="mfx_mfxvideo_h"
+qsv_extralibs="-lmfx -lstdc++"
 vaapi_deps="va_va_h"
 vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
 vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration 
-framework QuartzCore"
@@ -1635,6 +1639,8 @@ h263_vdpau_hwaccel_deps="vdpau"
 h263_vdpau_hwaccel_select="h263_decoder"
 h264_dxva2_hwaccel_deps="dxva2"
 h264_dxva2_hwaccel_select="h264_decoder"
+h264_qsv_decoder_deps="qsv"
+h264_qsv_decoder_select="h264_decoder"
 h264_vaapi_hwaccel_deps="vaapi"
 h264_vaapi_hwaccel_select="h264_decoder"
 h264_vda_hwaccel_deps="vda"
@@ -3468,6 +3474,7 @@ check_header sys/resource.h
 check_header sys/select.h
 check_header sys/time.h
 check_header unistd.h
+check_header mfx/mfxvideo.h
 check_header vdpau/vdpau.h
 check_header vdpau/vdpau_x11.h
 check_header VideoDecodeAcceleration/VDADecoder.h
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 262d2eb..d0b6166 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -5,6 +5,7 @@ HEADERS = avcodec.h 
\
   avfft.h   \
   dxva2.h   \
   old_codec_ids.h   \
+  qsv.h \
   vaapi.h   \
   vda.h \
   vdpau.h   \
@@ -199,6 +200,7 @@ OBJS-$(CONFIG_H264_DECODER)+= h264.o
   \
   cabac.o h264_sei.o h264_ps.o 
\
   h264_refs.o h264_cavlc.o h264_cabac.o
 OBJS-$(CONFIG_H264_DXVA2_HWACCEL)  += dxva2_h264.o
+OBJS-$(CONFIG_H264_QSV_DECODER)+= qsv.o qsv_h264.o
 OBJS-$(CONFIG_H264_VAAPI_HWACCEL)  += vaapi_h264.o
 OBJS-$(CONFIG_H264_VDA_HWACCEL)+= vda_h264.o
 OBJS-$(CONFIG_H264_VDPAU_HWACCEL)  += vdpau_h264.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 8bfa603..a4f8643 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -150,6 +150,7 @@ void avcodec_register_all(void)
 REGISTER_DECODER(H263I, h263i);
 REGISTER_ENCODER(H263P, h263p);
 REGISTER_DECODER(H264,  h264);
+REGISTER_DECODER(H264_QSV,  h264_qsv);
 REGISTER_DECODER(H264_VDPAU,h264_vdpau);
 REGISTER_ENCDEC (HUFFYUV,   huffyuv);
 REGISTER_DECODER(IDCIN, idcin);
diff --git a/libavcodec/qsv.h b/libavcodec/qsv.h
index cfbf75c..fc16fea 100644
--- a/libavcodec/qsv.h
+++ b/libavcodec/qsv.h
@@ -335,7 +335,7 @@ typedef struct av_qsv_config {
 
 /**
  * Distance between I- or P- key frames; if it is zero, the GOP structure 
is unspecified.
- * Note: If GopRefDist = 1, there are no B-frames used.
+ * Note: If GopRefDist = 1 no B-frames are used.
  *
  * - encoding: Set by user.
  * - decoding: unused
diff --git a/libavcodec/qsv_h264.c b/libavcodec/qsv_h264.c
index fbd3aa7..51122c2 100644
--- a/libavcodec/qsv_h264.c
+++ b/libavcodec/qsv_h264.c
@@ -267,8 +267,8 @@ int ff_qsv_decode_init(AVCodecContext *avctx)
"Using default config for QSV decode\n");
 avctx->hwaccel_context = &av_qsv_default_config;
 } else {
-if ((*qsv_config_context)->io_pattern != 
MFX_IOPATTERN_OUT_OPAQUE_MEMORY
-&& (*qsv_config_context)->io_pattern != 
MFX_IOPATTERN_OUT_SYSTEM_MEMORY) {
+if ((*qsv_config_context)->io_pattern != 
MFX_IOPATTERN_OUT_OPAQUE_

[libav-devel] [PATCH 2/2] Intel Media SDK, Quick Sync Video/QSV: Initial add of H.264 decoder infrastructure

2013-02-27 Thread Maxym Dmytrychenko
From: Maxym Dmytrychenko 

---
 Changelog  |1 +
 configure  |7 +++
 libavcodec/Makefile|2 ++
 libavcodec/allcodecs.c |1 +
 libavcodec/qsv.h   |2 +-
 libavcodec/qsv_h264.c  |9 -
 libavcodec/version.h   |2 +-
 libavutil/pixfmt.h |1 +
 8 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/Changelog b/Changelog
index f56c112..765b87f 100644
--- a/Changelog
+++ b/Changelog
@@ -4,6 +4,7 @@ releases are sorted from youngest to oldest.
 version 10:
 - av_strnstr
 - support ID3v2 tags in ASF files
+- QSV decoder hardware acceleration
 
 
 version 9:
diff --git a/configure b/configure
index 1aae93b..dcd0c37 100755
--- a/configure
+++ b/configure
@@ -130,6 +130,7 @@ Component options:
 
 Hardware accelerators:
   --enable-dxva2   enable DXVA2 code
+  --enable-qsv enable QSV code
   --enable-vaapi   enable VAAPI code
   --enable-vda enable VDA code
   --enable-vdpau   enable VDPAU code
@@ -1048,6 +1049,7 @@ EXTERNAL_LIBRARY_LIST="
 
 HWACCEL_LIST="
 dxva2
+qsv
 vaapi
 vda
 vdpau
@@ -1624,6 +1626,8 @@ zmbv_encoder_select="zlib"
 
 # hardware accelerators
 dxva2_deps="dxva2api_h"
+qsv_deps="mfx_mfxvideo_h"
+qsv_extralibs="-lmfx -lstdc++"
 vaapi_deps="va_va_h"
 vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
 vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration 
-framework QuartzCore"
@@ -1635,6 +1639,8 @@ h263_vdpau_hwaccel_deps="vdpau"
 h263_vdpau_hwaccel_select="h263_decoder"
 h264_dxva2_hwaccel_deps="dxva2"
 h264_dxva2_hwaccel_select="h264_decoder"
+h264_qsv_decoder_deps="qsv"
+h264_qsv_decoder_select="h264_decoder"
 h264_vaapi_hwaccel_deps="vaapi"
 h264_vaapi_hwaccel_select="h264_decoder"
 h264_vda_hwaccel_deps="vda"
@@ -3468,6 +3474,7 @@ check_header sys/resource.h
 check_header sys/select.h
 check_header sys/time.h
 check_header unistd.h
+check_header mfx/mfxvideo.h
 check_header vdpau/vdpau.h
 check_header vdpau/vdpau_x11.h
 check_header VideoDecodeAcceleration/VDADecoder.h
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 262d2eb..d0b6166 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -5,6 +5,7 @@ HEADERS = avcodec.h 
\
   avfft.h   \
   dxva2.h   \
   old_codec_ids.h   \
+  qsv.h \
   vaapi.h   \
   vda.h \
   vdpau.h   \
@@ -199,6 +200,7 @@ OBJS-$(CONFIG_H264_DECODER)+= h264.o
   \
   cabac.o h264_sei.o h264_ps.o 
\
   h264_refs.o h264_cavlc.o h264_cabac.o
 OBJS-$(CONFIG_H264_DXVA2_HWACCEL)  += dxva2_h264.o
+OBJS-$(CONFIG_H264_QSV_DECODER)+= qsv.o qsv_h264.o
 OBJS-$(CONFIG_H264_VAAPI_HWACCEL)  += vaapi_h264.o
 OBJS-$(CONFIG_H264_VDA_HWACCEL)+= vda_h264.o
 OBJS-$(CONFIG_H264_VDPAU_HWACCEL)  += vdpau_h264.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 8bfa603..a4f8643 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -150,6 +150,7 @@ void avcodec_register_all(void)
 REGISTER_DECODER(H263I, h263i);
 REGISTER_ENCODER(H263P, h263p);
 REGISTER_DECODER(H264,  h264);
+REGISTER_DECODER(H264_QSV,  h264_qsv);
 REGISTER_DECODER(H264_VDPAU,h264_vdpau);
 REGISTER_ENCDEC (HUFFYUV,   huffyuv);
 REGISTER_DECODER(IDCIN, idcin);
diff --git a/libavcodec/qsv.h b/libavcodec/qsv.h
index cfbf75c..fc16fea 100644
--- a/libavcodec/qsv.h
+++ b/libavcodec/qsv.h
@@ -335,7 +335,7 @@ typedef struct av_qsv_config {
 
 /**
  * Distance between I- or P- key frames; if it is zero, the GOP structure 
is unspecified.
- * Note: If GopRefDist = 1, there are no B-frames used.
+ * Note: If GopRefDist = 1 no B-frames are used.
  *
  * - encoding: Set by user.
  * - decoding: unused
diff --git a/libavcodec/qsv_h264.c b/libavcodec/qsv_h264.c
index fbd3aa7..51122c2 100644
--- a/libavcodec/qsv_h264.c
+++ b/libavcodec/qsv_h264.c
@@ -267,8 +267,8 @@ int ff_qsv_decode_init(AVCodecContext *avctx)
"Using default config for QSV decode\n");
 avctx->hwaccel_context = &av_qsv_default_config;
 } else {
-if ((*qsv_config_context)->io_pattern != 
MFX_IOPATTERN_OUT_OPAQUE_MEMORY
-&& (*qsv_config_context)->io_pattern != 
MFX_IOPATTERN_OUT_SYSTEM_MEMORY) {
+if ((*qsv_config_context)->io_pattern != 
MFX_IOPATTERN_OUT_OPAQUE_

[libav-devel] [PATCH 2/2] Intel Media SDK, Quick Sync Video/QSV: Initial add of H.264 decoder infrastructure

2013-02-27 Thread Maxym Dmytrychenko
---
 Changelog  |1 +
 configure  |7 +++
 libavcodec/Makefile|2 ++
 libavcodec/allcodecs.c |1 +
 libavcodec/qsv.h   |2 +-
 libavcodec/qsv_h264.c  |9 -
 libavcodec/version.h   |2 +-
 libavutil/pixfmt.h |1 +
 8 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/Changelog b/Changelog
index f56c112..765b87f 100644
--- a/Changelog
+++ b/Changelog
@@ -4,6 +4,7 @@ releases are sorted from youngest to oldest.
 version 10:
 - av_strnstr
 - support ID3v2 tags in ASF files
+- QSV decoder hardware acceleration
 
 
 version 9:
diff --git a/configure b/configure
index 1aae93b..dcd0c37 100755
--- a/configure
+++ b/configure
@@ -130,6 +130,7 @@ Component options:
 
 Hardware accelerators:
   --enable-dxva2   enable DXVA2 code
+  --enable-qsv enable QSV code
   --enable-vaapi   enable VAAPI code
   --enable-vda enable VDA code
   --enable-vdpau   enable VDPAU code
@@ -1048,6 +1049,7 @@ EXTERNAL_LIBRARY_LIST="
 
 HWACCEL_LIST="
 dxva2
+qsv
 vaapi
 vda
 vdpau
@@ -1624,6 +1626,8 @@ zmbv_encoder_select="zlib"
 
 # hardware accelerators
 dxva2_deps="dxva2api_h"
+qsv_deps="mfx_mfxvideo_h"
+qsv_extralibs="-lmfx -lstdc++"
 vaapi_deps="va_va_h"
 vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
 vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration 
-framework QuartzCore"
@@ -1635,6 +1639,8 @@ h263_vdpau_hwaccel_deps="vdpau"
 h263_vdpau_hwaccel_select="h263_decoder"
 h264_dxva2_hwaccel_deps="dxva2"
 h264_dxva2_hwaccel_select="h264_decoder"
+h264_qsv_decoder_deps="qsv"
+h264_qsv_decoder_select="h264_decoder"
 h264_vaapi_hwaccel_deps="vaapi"
 h264_vaapi_hwaccel_select="h264_decoder"
 h264_vda_hwaccel_deps="vda"
@@ -3468,6 +3474,7 @@ check_header sys/resource.h
 check_header sys/select.h
 check_header sys/time.h
 check_header unistd.h
+check_header mfx/mfxvideo.h
 check_header vdpau/vdpau.h
 check_header vdpau/vdpau_x11.h
 check_header VideoDecodeAcceleration/VDADecoder.h
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 262d2eb..d0b6166 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -5,6 +5,7 @@ HEADERS = avcodec.h 
\
   avfft.h   \
   dxva2.h   \
   old_codec_ids.h   \
+  qsv.h \
   vaapi.h   \
   vda.h \
   vdpau.h   \
@@ -199,6 +200,7 @@ OBJS-$(CONFIG_H264_DECODER)+= h264.o
   \
   cabac.o h264_sei.o h264_ps.o 
\
   h264_refs.o h264_cavlc.o h264_cabac.o
 OBJS-$(CONFIG_H264_DXVA2_HWACCEL)  += dxva2_h264.o
+OBJS-$(CONFIG_H264_QSV_DECODER)+= qsv.o qsv_h264.o
 OBJS-$(CONFIG_H264_VAAPI_HWACCEL)  += vaapi_h264.o
 OBJS-$(CONFIG_H264_VDA_HWACCEL)+= vda_h264.o
 OBJS-$(CONFIG_H264_VDPAU_HWACCEL)  += vdpau_h264.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 8bfa603..a4f8643 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -150,6 +150,7 @@ void avcodec_register_all(void)
 REGISTER_DECODER(H263I, h263i);
 REGISTER_ENCODER(H263P, h263p);
 REGISTER_DECODER(H264,  h264);
+REGISTER_DECODER(H264_QSV,  h264_qsv);
 REGISTER_DECODER(H264_VDPAU,h264_vdpau);
 REGISTER_ENCDEC (HUFFYUV,   huffyuv);
 REGISTER_DECODER(IDCIN, idcin);
diff --git a/libavcodec/qsv.h b/libavcodec/qsv.h
index cfbf75c..fc16fea 100644
--- a/libavcodec/qsv.h
+++ b/libavcodec/qsv.h
@@ -335,7 +335,7 @@ typedef struct av_qsv_config {
 
 /**
  * Distance between I- or P- key frames; if it is zero, the GOP structure 
is unspecified.
- * Note: If GopRefDist = 1, there are no B-frames used.
+ * Note: If GopRefDist = 1 no B-frames are used.
  *
  * - encoding: Set by user.
  * - decoding: unused
diff --git a/libavcodec/qsv_h264.c b/libavcodec/qsv_h264.c
index fbd3aa7..51122c2 100644
--- a/libavcodec/qsv_h264.c
+++ b/libavcodec/qsv_h264.c
@@ -267,8 +267,8 @@ int ff_qsv_decode_init(AVCodecContext *avctx)
"Using default config for QSV decode\n");
 avctx->hwaccel_context = &av_qsv_default_config;
 } else {
-if ((*qsv_config_context)->io_pattern != 
MFX_IOPATTERN_OUT_OPAQUE_MEMORY
-&& (*qsv_config_context)->io_pattern != 
MFX_IOPATTERN_OUT_SYSTEM_MEMORY) {
+if ((*qsv_config_context)->io_pattern != 
MFX_IOPATTERN_OUT_OPAQUE_MEMORY &&
+(*qs

Re: [libav-devel] [PATCH v5] swscale: Add support for unscaled 8-bit Packed RGB -> Planar RGB

2013-02-27 Thread Kostya Shishkov
On Wed, Feb 27, 2013 at 09:53:45AM -0500, Derek Buitenhuis wrote:
> Signed-off-by: Derek Buitenhuis 
> ---
> Changes since v4:
> 
> * Dropped impossibleto-betrue check at the beginning of rgbToPlanarRgbWrapper.
> * Properly used av_pix_fmt_desc_get().
> * Aligned the function declaration of packedtogbr24p().
> 
> Purposely not changed:
> 
> * The "unsupported planar RGB conversion %s -> %s\n" error.
> 
> Lord, this better be the last revision...
> ---
>  libswscale/swscale_unscaled.c |   78 
> +
>  1 file changed, 78 insertions(+)

Looks like it can still be improved but it's good enough.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH v5] swscale: Add support for unscaled 8-bit Packed RGB -> Planar RGB

2013-02-27 Thread Derek Buitenhuis
Signed-off-by: Derek Buitenhuis 
---
Changes since v4:

* Dropped impossibleto-betrue check at the beginning of rgbToPlanarRgbWrapper.
* Properly used av_pix_fmt_desc_get().
* Aligned the function declaration of packedtogbr24p().

Purposely not changed:

* The "unsupported planar RGB conversion %s -> %s\n" error.

Lord, this better be the last revision...
---
 libswscale/swscale_unscaled.c |   78 +
 1 file changed, 78 insertions(+)

diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 78090f1..db79cbf 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -468,6 +468,80 @@ static int planarRgbToRgbWrapper(SwsContext *c, const 
uint8_t *src[],
 return srcSliceH;
 }
 
+static void packedtogbr24p(const uint8_t *src, int srcStride,
+   uint8_t *dst[], int dstStride[], int srcSliceH,
+   int alpha_first, int inc_size, int width)
+{
+uint8_t *dest[3];
+int x, h;
+
+dest[0] = dst[0];
+dest[1] = dst[1];
+dest[2] = dst[2];
+
+if (alpha_first)
+src++;
+
+for (h = 0; h < srcSliceH; h++) {
+for (x = 0; x < width; x++) {
+dest[0][x] = src[0];
+dest[1][x] = src[1];
+dest[2][x] = src[2];
+
+src += inc_size;
+}
+src += srcStride - width * inc_size;
+dest[0] += dstStride[0];
+dest[1] += dstStride[1];
+dest[2] += dstStride[2];
+}
+}
+
+static int rgbToPlanarRgbWrapper(SwsContext *c, const uint8_t *src[],
+ int srcStride[], int srcSliceY, int srcSliceH,
+ uint8_t *dst[], int dstStride[])
+{
+int alpha_first = 0;
+int stride102[] = { dstStride[1], dstStride[0], dstStride[2] };
+int stride201[] = { dstStride[2], dstStride[0], dstStride[1] };
+uint8_t *dst102[] = { dst[1] + srcSliceY * dstStride[1],
+  dst[0] + srcSliceY * dstStride[0],
+  dst[2] + srcSliceY * dstStride[2] };
+uint8_t *dst201[] = { dst[2] + srcSliceY * dstStride[2],
+  dst[0] + srcSliceY * dstStride[0],
+  dst[1] + srcSliceY * dstStride[1] };
+
+switch (c->srcFormat) {
+case PIX_FMT_RGB24:
+packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst201,
+   stride201, srcSliceH, alpha_first, 3, c->srcW);
+break;
+case PIX_FMT_BGR24:
+packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst102,
+   stride102, srcSliceH, alpha_first, 3, c->srcW);
+break;
+case PIX_FMT_ARGB:
+alpha_first = 1;
+case PIX_FMT_RGBA:
+packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst201,
+   stride201, srcSliceH, alpha_first, 4, c->srcW);
+break;
+case PIX_FMT_ABGR:
+alpha_first = 1;
+case PIX_FMT_BGRA:
+packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst102,
+   stride102, srcSliceH, alpha_first, 4, c->srcW);
+break;
+default:
+av_log(c, AV_LOG_ERROR,
+   "unsupported planar RGB conversion %s -> %s\n",
+   av_get_pix_fmt_name(c->srcFormat),
+   av_get_pix_fmt_name(c->dstFormat));
+}
+
+return srcSliceH;
+}
+
 #define isRGBA32(x) (\
(x) == AV_PIX_FMT_ARGB   \
 || (x) == AV_PIX_FMT_RGBA   \
@@ -943,6 +1017,10 @@ void ff_get_unscaled_swscale(SwsContext *c)
 if (srcFormat == AV_PIX_FMT_GBRP && isPlanar(srcFormat) && 
isByteRGB(dstFormat))
 c->swScale = planarRgbToRgbWrapper;
 
+if (av_pix_fmt_desc_get(srcFormat)->comp[0].depth_minus1 == 7 &&
+isPackedRGB(srcFormat) && dstFormat == AV_PIX_FMT_GBRP)
+c->swScale = rgbToPlanarRgbWrapper;
+
 /* bswap 16 bits per pixel/component packed formats */
 if (IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR444) ||
 IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR48)  ||
-- 
1.7.10.4

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


Re: [libav-devel] [PATCH] lls: move to the private namespace

2013-02-27 Thread Luca Barbato
On 27/02/13 14:01, Martin Storsjö wrote:
> On Wed, 27 Feb 2013, Luca Barbato wrote:
> 
>> The functions are private.
>> ---
>>
>> Now with aliases.
>>
>> libavcodec/lpc.c|  8 
>> libavutil/lls.c | 35 +++
>> libavutil/lls.h |  8 +++-
>> libavutil/version.h |  4 
>> 4 files changed, 42 insertions(+), 13 deletions(-)
> 
> This looks correct to me.
> 

I'd push the set in 6 hours then =)

lu

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

Re: [libav-devel] [PATCH] lls: move to the private namespace

2013-02-27 Thread Martin Storsjö

On Wed, 27 Feb 2013, Luca Barbato wrote:


The functions are private.
---

Now with aliases.

libavcodec/lpc.c|  8 
libavutil/lls.c | 35 +++
libavutil/lls.h |  8 +++-
libavutil/version.h |  4 
4 files changed, 42 insertions(+), 13 deletions(-)


This looks correct to me.

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


Re: [libav-devel] [PATCH 1/2] lavf: Handle the environment variable no_proxy more properly

2013-02-27 Thread Luca Barbato
On 27/02/13 13:15, Martin Storsjö wrote:
> The handling of the environment variable no_proxy, present since
> one of the initial commits (de6d9b6404), is inconsistent with
> how many other applications and libraries interpret this
> variable. Its bare presence does not indicate that the use of
> proxies should be skipped, but it is some sort of pattern for
> hosts that does not need using a proxy (e.g. for a local network).
> 
> As investigated by Rudolf Polzer, different libraries handle this
> in different ways, some supporting IP address masks, some supporting
> arbitrary globbing using *, some just checking that the pattern matches
> the end of the hostname without regard for whether it actually is
> the right domain or a domain that ends in the same string.
> 
> This simple logic should be pretty similar to the logic used by
> lynx and curl.
> ---
>  libavformat/http.c |8 +++
>  libavformat/internal.h |2 ++
>  libavformat/tls.c  |8 +++
>  libavformat/utils.c|   54 
> 
>  libavformat/version.h  |2 +-
>  5 files changed, 65 insertions(+), 9 deletions(-)
> 

Ok.

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

Re: [libav-devel] [PATCH 2/2] lavf: Add a fate test for the noproxy pattern matching

2013-02-27 Thread Luca Barbato
On 27/02/13 13:15, Martin Storsjö wrote:
> ---
>  libavformat/Makefile   |3 ++-
>  libavformat/noproxy-test.c |   43 +++
>  tests/fate/libavformat.mak |4 
>  tests/ref/fate/noproxy |9 +
>  4 files changed, 58 insertions(+), 1 deletion(-)
>  create mode 100644 libavformat/noproxy-test.c
>  create mode 100644 tests/ref/fate/noproxy
> 

Seems fine.

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

[libav-devel] [PATCH] lls: move to the private namespace

2013-02-27 Thread Luca Barbato
The functions are private.
---

Now with aliases.

 libavcodec/lpc.c|  8 
 libavutil/lls.c | 35 +++
 libavutil/lls.h |  8 +++-
 libavutil/version.h |  4 
 4 files changed, 42 insertions(+), 13 deletions(-)

diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
index 2093e7e..bada368 100644
--- a/libavcodec/lpc.c
+++ b/libavcodec/lpc.c
@@ -203,7 +203,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
 double var[MAX_LPC_ORDER+1], av_uninit(weight);
 
 for(pass=0; pass>pass) + fabs(eval - var[0]);
 inv = 1/eval;
 rinv = sqrt(inv);
@@ -222,9 +222,9 @@ int ff_lpc_calc_coefs(LPCContext *s,
 }else
 weight++;
 
-av_update_lls(&m[pass&1], var, 1.0);
+avpriv_update_lls(&m[pass&1], var, 1.0);
 }
-av_solve_lls(&m[pass&1], 0.001, 0);
+avpriv_solve_lls(&m[pass&1], 0.001, 0);
 }
 
 for(i=0; iindep_count = indep_count;
 }
 
-void av_update_lls(LLSModel *m, double *var, double decay)
+void avpriv_update_lls(LLSModel *m, double *var, double decay)
 {
 int i, j;
 
@@ -48,7 +48,7 @@ void av_update_lls(LLSModel *m, double *var, double decay)
 }
 }
 
-void av_solve_lls(LLSModel *m, double threshold, int min_order)
+void avpriv_solve_lls(LLSModel *m, double threshold, int min_order)
 {
 int i, j, k;
 double (*factor)[MAX_VARS + 1] = (void *) &m->covariance[1][0];
@@ -105,7 +105,7 @@ void av_solve_lls(LLSModel *m, double threshold, int 
min_order)
 }
 }
 
-double av_evaluate_lls(LLSModel *m, double *param, int order)
+double avpriv_evaluate_lls(LLSModel *m, double *param, int order)
 {
 int i;
 double out = 0;
@@ -116,6 +116,25 @@ double av_evaluate_lls(LLSModel *m, double *param, int 
order)
 return out;
 }
 
+#ifndef FF_API_LLS_PRIVATE
+void av_init_lls(LLSModel *m, int indep_count)
+{
+return avpriv_init_lls(m, indep_count);
+}
+void av_update_lls(LLSModel *m, double *param, double decay)
+{
+return avpriv_update_lls(m, param, decay);
+}
+void av_solve_lls(LLSModel *m, double threshold, int min_order)
+{
+return avpriv_solve_lls(m, threshold, min_order);
+}
+double av_evaluate_lls(LLSModel *m, double *param, int order)
+{
+return avpriv_evaluate_lls(m, param, order);
+}
+#endif
+
 #ifdef TEST
 
 #include 
@@ -129,7 +148,7 @@ int main(void)
 AVLFG lfg;
 
 av_lfg_init(&lfg, 1);
-av_init_lls(&m, 3);
+avpriv_init_lls(&m, 3);
 
 for (i = 0; i < 100; i++) {
 double var[4];
@@ -139,10 +158,10 @@ int main(void)
 var[1] = var[0] + av_lfg_get(&lfg) / (double) UINT_MAX - 0.5;
 var[2] = var[1] + av_lfg_get(&lfg) / (double) UINT_MAX - 0.5;
 var[3] = var[2] + av_lfg_get(&lfg) / (double) UINT_MAX - 0.5;
-av_update_lls(&m, var, 0.99);
-av_solve_lls(&m, 0.001, 0);
+avpriv_update_lls(&m, var, 0.99);
+avpriv_solve_lls(&m, 0.001, 0);
 for (order = 0; order < 3; order++) {
-eval = av_evaluate_lls(&m, var + 1, order);
+eval = avpriv_evaluate_lls(&m, var + 1, order);
 printf("real:%9f order:%d pred:%9f var:%f coeffs:%f %9f %9f\n",
var[0], order, eval, sqrt(m.variance[order] / (i + 1)),
m.coeff[order][0], m.coeff[order][1],
diff --git a/libavutil/lls.h b/libavutil/lls.h
index 5c51b74..4b19798 100644
--- a/libavutil/lls.h
+++ b/libavutil/lls.h
@@ -37,9 +37,15 @@ typedef struct LLSModel {
 int indep_count;
 } LLSModel;
 
+void avpriv_init_lls(LLSModel *m, int indep_count);
+void avpriv_update_lls(LLSModel *m, double *param, double decay);
+void avpriv_solve_lls(LLSModel *m, double threshold, int min_order);
+double avpriv_evaluate_lls(LLSModel *m, double *param, int order);
+
+#ifndef FF_API_LLS_PRIVATE
 void av_init_lls(LLSModel *m, int indep_count);
 void av_update_lls(LLSModel *m, double *param, double decay);
 void av_solve_lls(LLSModel *m, double threshold, int min_order);
 double av_evaluate_lls(LLSModel *m, double *param, int order);
-
+#endif
 #endif /* AVUTIL_LLS_H */
diff --git a/libavutil/version.h b/libavutil/version.h
index a23fdd2..8d7e378 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,6 +79,10 @@
 #ifndef FF_API_CPU_FLAG_MMX2
 #define FF_API_CPU_FLAG_MMX2(LIBAVUTIL_VERSION_MAJOR < 53)
 #endif
+#ifndef FF_API_LLS_PRIVATE
+#define FF_API_LLS_PRIVATE  (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+
 
 /**
  * @}
-- 
1.8.1.2

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


[libav-devel] [PATCH 2/2] lavf: Add a fate test for the noproxy pattern matching

2013-02-27 Thread Martin Storsjö
---
 libavformat/Makefile   |3 ++-
 libavformat/noproxy-test.c |   43 +++
 tests/fate/libavformat.mak |4 
 tests/ref/fate/noproxy |9 +
 4 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/noproxy-test.c
 create mode 100644 tests/ref/fate/noproxy

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 25b8157..110e683 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -380,7 +380,8 @@ SKIPHEADERS-$(CONFIG_NETWORK)+= network.h rtsp.h
 EXAMPLES  = metadata\
 output  \
 
-TESTPROGS = seek\
+TESTPROGS = noproxy \
+seek\
 srtp\
 url \
 
diff --git a/libavformat/noproxy-test.c b/libavformat/noproxy-test.c
new file mode 100644
index 000..59a435e
--- /dev/null
+++ b/libavformat/noproxy-test.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2013 Martin Storsjo
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "internal.h"
+
+static void test(const char *pattern, const char *host)
+{
+int res = ff_http_match_no_proxy(pattern, host);
+printf("The pattern \"%s\" %s the hostname %s\n",
+   pattern ? pattern : "(null)", res ? "matches" : "does not match",
+   host);
+}
+
+int main(void)
+{
+test(NULL, "domain.com");
+test("example.com domain.com", "domain.com");
+test("example.com other.com", "domain.com");
+test("example.com,domain.com", "domain.com");
+test("example.com,domain.com", "otherdomain.com");
+test("example.com, *.domain.com", "sub.domain.com");
+test("example.com, *.domain.com", "domain.com");
+test("example.com, .domain.com", "domain.com");
+test("*", "domain.com");
+return 0;
+}
diff --git a/tests/fate/libavformat.mak b/tests/fate/libavformat.mak
index 20bc319..8332246 100644
--- a/tests/fate/libavformat.mak
+++ b/tests/fate/libavformat.mak
@@ -1,3 +1,7 @@
+FATE_LIBAVFORMAT += fate-noproxy
+fate-noproxy: libavformat/noproxy-test$(EXESUF)
+fate-noproxy: CMD = run libavformat/noproxy-test
+
 FATE_LIBAVFORMAT += fate-srtp
 fate-srtp: libavformat/srtp-test$(EXESUF)
 fate-srtp: CMD = run libavformat/srtp-test
diff --git a/tests/ref/fate/noproxy b/tests/ref/fate/noproxy
new file mode 100644
index 000..7707609
--- /dev/null
+++ b/tests/ref/fate/noproxy
@@ -0,0 +1,9 @@
+The pattern "(null)" does not match the hostname domain.com
+The pattern "example.com domain.com" matches the hostname domain.com
+The pattern "example.com other.com" does not match the hostname domain.com
+The pattern "example.com,domain.com" matches the hostname domain.com
+The pattern "example.com,domain.com" does not match the hostname 
otherdomain.com
+The pattern "example.com, *.domain.com" matches the hostname sub.domain.com
+The pattern "example.com, *.domain.com" matches the hostname domain.com
+The pattern "example.com, .domain.com" matches the hostname domain.com
+The pattern "*" matches the hostname domain.com
-- 
1.7.9.4

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


[libav-devel] [PATCH 1/2] lavf: Handle the environment variable no_proxy more properly

2013-02-27 Thread Martin Storsjö
The handling of the environment variable no_proxy, present since
one of the initial commits (de6d9b6404), is inconsistent with
how many other applications and libraries interpret this
variable. Its bare presence does not indicate that the use of
proxies should be skipped, but it is some sort of pattern for
hosts that does not need using a proxy (e.g. for a local network).

As investigated by Rudolf Polzer, different libraries handle this
in different ways, some supporting IP address masks, some supporting
arbitrary globbing using *, some just checking that the pattern matches
the end of the hostname without regard for whether it actually is
the right domain or a domain that ends in the same string.

This simple logic should be pretty similar to the logic used by
lynx and curl.
---
 libavformat/http.c |8 +++
 libavformat/internal.h |2 ++
 libavformat/tls.c  |8 +++
 libavformat/utils.c|   54 
 libavformat/version.h  |2 +-
 5 files changed, 65 insertions(+), 9 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 9666ca3..9645bd1 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -106,10 +106,6 @@ static int http_open_cnx(URLContext *h)
 HTTPAuthType cur_auth_type, cur_proxy_auth_type;
 HTTPContext *s = h->priv_data;
 
-proxy_path = getenv("http_proxy");
-use_proxy = (proxy_path != NULL) && !getenv("no_proxy") &&
-av_strstart(proxy_path, "http://";, NULL);
-
 /* fill the dest addr */
  redo:
 /* needed in any case to build the host string */
@@ -118,6 +114,10 @@ static int http_open_cnx(URLContext *h)
  path1, sizeof(path1), s->location);
 ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL);
 
+proxy_path = getenv("http_proxy");
+use_proxy = !ff_http_match_no_proxy(getenv("no_proxy"), hostname) &&
+proxy_path != NULL && av_strstart(proxy_path, "http://";, NULL);
+
 if (!strcmp(proto, "https")) {
 lower_proto = "tls";
 use_proxy = 0;
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 3ca2d8f..7367369 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -375,4 +375,6 @@ enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, 
unsigned int tag);
  */
 enum AVCodecID ff_get_pcm_codec_id(int bps, int flt, int be, int sflags);
 
+int ff_http_match_no_proxy(const char *no_proxy, const char *hostname);
+
 #endif /* AVFORMAT_INTERNAL_H */
diff --git a/libavformat/tls.c b/libavformat/tls.c
index 866e55f..fecf096 100644
--- a/libavformat/tls.c
+++ b/libavformat/tls.c
@@ -116,10 +116,6 @@ static int tls_open(URLContext *h, const char *uri, int 
flags)
 
 ff_tls_init();
 
-proxy_path = getenv("http_proxy");
-use_proxy = (proxy_path != NULL) && !getenv("no_proxy") &&
-av_strstart(proxy_path, "http://";, NULL);
-
 av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &port, NULL, 0, uri);
 ff_url_join(buf, sizeof(buf), "tcp", NULL, host, port, NULL);
 
@@ -129,6 +125,10 @@ static int tls_open(URLContext *h, const char *uri, int 
flags)
 freeaddrinfo(ai);
 }
 
+proxy_path = getenv("http_proxy");
+use_proxy = !ff_http_match_no_proxy(getenv("no_proxy"), host) &&
+proxy_path != NULL && av_strstart(proxy_path, "http://";, NULL);
+
 if (use_proxy) {
 char proxy_host[200], proxy_auth[200], dest[200];
 int proxy_port;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index cd46caf..be5a5ca 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3589,3 +3589,57 @@ const struct AVCodecTag 
*avformat_get_riff_audio_tags(void)
 {
 return ff_codec_wav_tags;
 }
+
+static int match_host_pattern(const char *pattern, const char *hostname)
+{
+int len_p, len_h;
+if (!strcmp(pattern, "*"))
+return 1;
+// Skip a possible *. at the start of the pattern
+if (pattern[0] == '*')
+pattern++;
+if (pattern[0] == '.')
+pattern++;
+len_p = strlen(pattern);
+len_h = strlen(hostname);
+if (len_p > len_h)
+return 0;
+// Simply check if the end of hostname is equal to 'pattern'
+if (!strcmp(pattern, &hostname[len_h - len_p])) {
+if (len_h == len_p)
+return 1; // Exact match
+if (hostname[len_h - len_p - 1] == '.')
+return 1; // The matched substring is a domain and not just a 
substring of a domain
+}
+return 0;
+}
+
+int ff_http_match_no_proxy(const char *no_proxy, const char *hostname)
+{
+char *buf, *start;
+int ret = 0;
+if (!no_proxy)
+return 0;
+if (!hostname)
+return 0;
+buf = av_strdup(no_proxy);
+if (!buf)
+return 0;
+start = buf;
+while (start) {
+char *sep, *next = NULL;
+start += strspn(start, " ,");
+sep = start + strcspn(start, " ,");
+if (*sep) {
+next = sep + 1;
+*

Re: [libav-devel] [PATCH 42/48] buffersrc: convert to AVFrame

2013-02-27 Thread Luca Barbato
On 08/01/13 15:40, Anton Khirnov wrote:
> ---
>  libavfilter/buffersrc.c |  197 
> ---
>  libavfilter/buffersrc.h |   29 ++-
>  2 files changed, 162 insertions(+), 64 deletions(-)
> 

Seems ok.

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


Re: [libav-devel] [PATCH 41/48] buffersink: convert to AVFrame

2013-02-27 Thread Luca Barbato
On 08/01/13 15:40, Anton Khirnov wrote:
> ---
>  libavfilter/buffersink.c |  128 
> +++---
>  libavfilter/buffersink.h |   32 
>  2 files changed, 129 insertions(+), 31 deletions(-)
> 

Seems ok.

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


Re: [libav-devel] [PATCH 40/48] split: convert to AVFrame

2013-02-27 Thread Luca Barbato
On 08/01/13 15:40, Anton Khirnov wrote:
> ---
>  libavfilter/split.c |6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
OK.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 39/48] fifo: convert to AVFrame.

2013-02-27 Thread Luca Barbato
On 08/01/13 15:40, Anton Khirnov wrote:
> ---
>  libavfilter/fifo.c |  112 
> ++--
>  1 file changed, 55 insertions(+), 57 deletions(-)

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


Re: [libav-devel] [PATCH 37/48] af_join: convert to AVFrame.

2013-02-27 Thread Luca Barbato
On 08/01/13 15:40, Anton Khirnov wrote:
> + for (i = 0; i < FFMIN(FF_ARRAY_ELEMS(frame->buf), nb_buffers); i++) {
> + frame->buf[i] = av_buffer_ref(s->buffers[i]);
> + if (!frame->buf[i]) {
> + ret = AVERROR(ENOMEM);
> + goto fail;
> + }
> + }
> + for (i = 0; i < frame->nb_extended_buf; i++) {
> + frame->extended_buf[i] = av_buffer_ref(s->buffers[i +
> + FF_ARRAY_ELEMS(frame->buf)]);
> + if (!frame->extended_buf[i]) {
> + ret = AVERROR(ENOMEM);
> + goto fail;
> + }
> + }

Looks a little strange having double references to the buffers just in
certain cases. Is that on purpose?

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