Re: [libav-devel] [PATCH] pthread_frame: use better memory orders for frame progress

2016-12-09 Thread Wan-Teh Chang
On Fri, Dec 9, 2016 at 10:22 AM, Sean McGovern  wrote:
> Hi Wan-Teh,
>
[...]
> Does this by any chance fix https://bugzilla.libav.org/show_bug.cgi?id=930 ?

Hi Sean,

No. My patch is completely unrelated to that bug.

That bug is a crash caused by a null pointer dereference. The crash
occurs when preparing the first argument for
ff_thread_report_progress(). I believe the process didn't enter the
ff_thread_report_progress() function, even though
ff_thread_report_progress() is in the callback.

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


Re: [libav-devel] [PATCH 04/13] configure: Disentangle vfw32 and user32 lib handling

2016-12-09 Thread Diego Biurrun
On Fri, Dec 09, 2016 at 05:25:21PM +0100, Diego Biurrun wrote:
> On Fri, Dec 09, 2016 at 04:25:31PM +0100, Hendrik Leppkes wrote:
> > On Fri, Dec 9, 2016 at 3:52 PM, Diego Biurrun  wrote:
> > > On Mon, Dec 05, 2016 at 05:39:57PM +0100, Hendrik Leppkes wrote:
> > >> On Tue, Nov 29, 2016 at 7:34 PM, Diego Biurrun  wrote:
> > >> > --- a/configure
> > >> > +++ b/configure
> > >> > @@ -2382,7 +2382,6 @@ sndio_indev_deps="sndio_h"
> > >> >  vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
> > >> > -vfwcap_indev_extralibs="-lavicap32"
> > >> >  xcbgrab_indev_deps="libxcb"
> > >> >
> > >> > @@ -3041,7 +3040,6 @@ msvc_common_flags(){
> > >> >  -march=*) ;;
> > >> >  -lz)  echo zlib.lib ;;
> > >> > --lavicap32)   echo vfw32.lib user32.lib ;;
> > >> >  -lx264)   echo libx264.lib ;;
> > >> >  -l*)  echo ${flag#-l}.lib ;;
> > >> > @@ -4752,7 +4750,7 @@ check_header AVFoundation/AVFoundation.h &&
> > >> >
> > >> >  check_header sys/videoio.h
> > >> >
> > >> > -check_func_headers "windows.h vfw.h" capCreateCaptureWindow 
> > >> > "$vfwcap_indev_extralibs"
> > >> > +check_lib "windows.h vfw.h" capCreateCaptureWindow -lvfw32
> > >> >  # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
> > >> >  # w32api 3.12 had it defined wrong
> > >> > @@ -4804,6 +4802,10 @@ if enabled libxcb; then
> > >> >
> > >> >  enabled dxva2 &&
> > >> > +check_lib "windows.h winuser.h" GetShellWindow -luser32 ||
> > >> > +disable dxva2
> > >> > +
> > >> > +enabled dxva2 &&
> > >> >  check_lib windows.h CoTaskMemFree -lole32 &&
> > >> >  enable dxva2_lib
> > >>
> > >> This entirely takes out linking against avicap32, and replaces it with
> > >> vfw32, presumably this was once required (except for msvc). That does
> > >> introduce a distinct change in linking, so it would need testing on
> > >> all supported versions of mingw.
> > >
> > > I suspect this was cargo-culted around. I tested building with dxva2
> > > disabled and vfwcap enabled on Cygwin, Msys 2, and Mingw32. No problems.
> > >
> > >> Also does vfwcap indev not require user32 anymore, like it apparently 
> > >> used to?
> > >
> > > The only use of GetShellWindow is in libavutil/hwcontext_dxva2.c.
> > 
> > On a quick check, vfwcap uses GetWindowLongPtr, which is from user32.dll.
> > There might be other functions in there as well. I am not sure however
> > if user32.dll is part of the default link libraries these days, and
> > maybe was not at some earlier point.
> 
> It certainly worked without linking against user32.dll at all, so our
> best guess is that your theory is right. I'm assuming that means that
> linking against user32.dll at all is pointless nowadays?

user32.dll seems to be necessary for MSVC still.

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


Re: [libav-devel] [PATCH] pthread_frame: use better memory orders for frame progress

2016-12-09 Thread Sean McGovern
Hi Wan-Teh,

On Dec 9, 2016 12:55, "Wan-Teh Chang"  wrote:

This improves commit 59c70227405c214b29971e6272f3a3ff6fcce3d0.

In ff_thread_report_progress(), the fast code path can load
progress[field] with the relaxed memory order, and the slow code path
can store progress[field] with the release memory order. These changes
are mainly intended to avoid confusion when one inspects the source code.
They are unlikely to have measurable performance improvement.

ff_thread_report_progress() and ff_thread_await_progress() form a pair.
ff_thread_await_progress() reads progress[field] with the acquire memory
order (in the fast code path). Therefore, one expects to see
ff_thread_report_progress() write progress[field] with the matching
release memory order.

In the fast code path in ff_thread_report_progress(), the atomic load of
progress[field] doesn't need the acquire memory order because the
calling thread is trying to make the data it just decoded visible to the
other threads, rather than trying to read the data decoded by other
threads.

In ff_thread_get_buffer(), initialize progress[0] and progress[1] using
atomic_init().

Signed-off-by: Wan-Teh Chang 
---
 libavcodec/pthread_frame.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 2736a81..142eaa5 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -458,7 +458,7 @@ void ff_thread_report_progress(ThreadFrame *f, int n,
int field)
 atomic_int *progress = f->progress ? (atomic_int*)f->progress->data :
NULL;

 if (!progress ||
-atomic_load_explicit(&progress[field], memory_order_acquire) >= n)
+atomic_load_explicit(&progress[field], memory_order_relaxed) >= n)
 return;

 p = f->owner->internal->thread_ctx;
@@ -468,7 +468,7 @@ void ff_thread_report_progress(ThreadFrame *f, int n,
int field)

 pthread_mutex_lock(&p->progress_mutex);

-atomic_store(&progress[field], n);
+atomic_store_explicit(&progress[field], n, memory_order_release);

 pthread_cond_broadcast(&p->progress_cond);
 pthread_mutex_unlock(&p->progress_mutex);
@@ -745,8 +745,8 @@ int ff_thread_get_buffer(AVCodecContext *avctx,
ThreadFrame *f, int flags)
 }
 progress = (atomic_int*)f->progress->data;

-atomic_store(&progress[0], -1);
-atomic_store(&progress[1], -1);
+atomic_init(&progress[0], -1);
+atomic_init(&progress[1], -1);
 }

 pthread_mutex_lock(&p->parent->buffer_mutex);
--
2.8.0.rc3.226.g39d4020

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


Does this by any chance fix https://bugzilla.libav.org/show_bug.cgi?id=930 ?

Sean McGovern -  +1 613 862 6507
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] build: Add extralibs entries for tools and testprogs that need them

2016-12-09 Thread Diego Biurrun
---

Sent from the wrong branch, grmbl..

 Makefile|  4 +---
 configure   | 18 +++---
 library.mak |  2 +-
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 5d5438c..2a99105 100644
--- a/Makefile
+++ b/Makefile
@@ -119,9 +119,7 @@ FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS)
 all: $(AVPROGS) alltools checkheaders examples testprogs
 
 $(TOOLS): %$(EXESUF): %.o
-   $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(EXTRALIBS) $(ELIBS)
-
-tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
+   $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(EXTRALIBS-$(@F)) 
$(EXTRALIBS) $(ELIBS)
 
 CONFIGURABLE_COMPONENTS =   \
 $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \
diff --git a/configure b/configure
index 206223d..336f423 100755
--- a/configure
+++ b/configure
@@ -1238,6 +1238,12 @@ EXAMPLE_LIST="
 transcode_aac_example
 "
 
+# catchall list of things that require external libs to link
+EXTRALIBS_LIST="
+cpu_init
+cws2fws
+"
+
 HWACCEL_LIBRARY_NONFREE_LIST="
 cuda
 libnpp
@@ -2618,6 +2624,10 @@ output_example_deps="avcodec avformat avresample avutil 
swscale"
 qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder"
 transcode_aac_example_deps="avcodec avformat avresample"
 
+# EXTRALIBS_LIST
+cpu_init_extralibs="pthreads_extralibs"
+cws2fws_extralibs="zlib_extralibs"
+
 # libraries, in linking order
 avcodec_deps="avutil"
 avdevice_deps="avformat avcodec avutil"
@@ -2698,6 +2708,9 @@ enable valgrind_backtrace
 # By default, enable only those hwaccels that have no external dependencies.
 enable d3d11va dxva2 vda vdpau
 
+# internal components are enabled by default
+enable $EXTRALIBS_LIST
+
 # build settings
 SHFLAGS='-shared -Wl,-soname,$$(@F)'
 LIBPREF="lib"
@@ -5214,7 +5227,7 @@ check_deps $CONFIG_LIST   \
$HAVE_LIST \
$ALL_COMPONENTS\
 
-for linkunit in $LIBRARY_LIST $PROGRAM_LIST; do
+for linkunit in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do
 unset dep_lbs
 set_component_extralibs $linkunit $linkunit
 eval components=\$$(toupper ${linkunit})_COMPONENTS}
@@ -5466,7 +5479,6 @@ TARGET_PATH=$target_path
 TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
 CFLAGS-avplay=$sdl_cflags
 CFLAGS_HEADERS=$CFLAGS_HEADERS
-ZLIB=$($ldflags_filter -lz)
 LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
 EXTRALIBS=$extralibs
 COMPAT_OBJS=$compat_objs
@@ -5500,7 +5512,7 @@ map 'get_version $v' $LIBRARY_LIST
 
 map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> config.mak' $LIBRARY_LIST
 
-for entry in $LIBRARY_LIST $PROGRAM_LIST; do
+for entry in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do
 eval echo "EXTRALIBS-${entry}=\$extralibs_${entry}" >> config.mak
 done
 
diff --git a/library.mak b/library.mak
index bf1853f..2b05b4b 100644
--- a/library.mak
+++ b/library.mak
@@ -28,7 +28,7 @@ $(TOOLS): THISLIB = $(NAME:%=$(LD_LIB))
 $(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME)
 
 $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o
-   $$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) 
$(FFEXTRALIBS) $$(ELIBS)
+   $$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) 
$(FFEXTRALIBS) $$(EXTRALIBS-$$(@F)) $$(ELIBS)
 
 $(SUBDIR)lib$(NAME).ver: $(SUBDIR)lib$(NAME).v $(OBJS)
$$(M)sed 's/MAJOR/$(lib$(NAME)_VERSION_MAJOR)/' $$< | 
$(VERSION_SCRIPT_POSTPROCESS_CMD) > $$@
-- 
2.1.4

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


[libav-devel] [PATCH] build: Add extralibs entries for tools and testprogs that need them

2016-12-09 Thread Diego Biurrun
---

This is to be squashed into the fine-grained linker deps patch, required
to build libavutil/tests/cpu_init, which depends on pthreads.

 Makefile|  4 +---
 configure   | 18 +++---
 library.mak |  2 +-
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 4e44fe9..c4df103 100644
--- a/Makefile
+++ b/Makefile
@@ -119,9 +119,7 @@ FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS)
 all: $(AVPROGS) alltools checkheaders examples testprogs
 
 $(TOOLS): %$(EXESUF): %.o
-   $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(EXTRALIBS) $(ELIBS)
-
-tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
+   $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(EXTRALIBS-$(@F)) 
$(EXTRALIBS) $(ELIBS)
 
 CONFIGURABLE_COMPONENTS =   \
 $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \
diff --git a/configure b/configure
index 2c56096..3c5a236 100755
--- a/configure
+++ b/configure
@@ -1238,6 +1238,12 @@ EXAMPLE_LIST="
 transcode_aac_example
 "
 
+# catchall list of things that require external libs to link
+EXTRALIBS_LIST="
+cpu_init
+cws2fws
+"
+
 HWACCEL_LIBRARY_NONFREE_LIST="
 cuda
 libnpp
@@ -2618,6 +2624,10 @@ output_example_deps="avcodec avformat avresample avutil 
swscale"
 qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder"
 transcode_aac_example_deps="avcodec avformat avresample"
 
+# EXTRALIBS_LIST
+cpu_init_extralibs="pthreads_extralibs"
+cws2fws_extralibs="zlib_extralibs"
+
 # libraries, in linking order
 avcodec_deps="avutil"
 avdevice_deps="avformat avcodec avutil"
@@ -2698,6 +2708,9 @@ enable valgrind_backtrace
 # By default, enable only those hwaccels that have no external dependencies.
 enable d3d11va dxva2 vda vdpau
 
+# internal components are enabled by default
+enable $EXTRALIBS_LIST
+
 # build settings
 SHFLAGS='-shared -Wl,-soname,$$(@F)'
 LIBPREF="lib"
@@ -5214,7 +5227,7 @@ check_deps $CONFIG_LIST   \
$HAVE_LIST \
$ALL_COMPONENTS\
 
-for linkunit in $LIBRARY_LIST $PROGRAM_LIST; do
+for linkunit in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do
 unset dep_lbs
 set_component_extralibs $linkunit $linkunit
 eval components=\$$(toupper ${linkunit})_COMPONENTS}
@@ -5466,7 +5479,6 @@ TARGET_PATH=$target_path
 TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
 CFLAGS-avplay=$sdl_cflags
 CFLAGS_HEADERS=$CFLAGS_HEADERS
-ZLIB=$($ldflags_filter -lz)
 LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
 EXTRALIBS=$extralibs
 COMPAT_OBJS=$compat_objs
@@ -5504,7 +5516,7 @@ map 'get_version $v' $LIBRARY_LIST
 
 map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> config.mak' $LIBRARY_LIST
 
-for entry in $LIBRARY_LIST $PROGRAM_LIST; do
+for entry in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do
 eval echo "EXTRALIBS-${entry}=\$extralibs_${entry}" >> config.mak
 done
 
diff --git a/library.mak b/library.mak
index 7554f81..34ee78a 100644
--- a/library.mak
+++ b/library.mak
@@ -28,7 +28,7 @@ $(TOOLS): THISLIB = $(NAME:%=$(LD_LIB))
 $(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME)
 
 $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o
-   $$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) 
$(FFEXTRALIBS) $$(ELIBS)
+   $$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) 
$(FFEXTRALIBS) $$(EXTRALIBS-$(?))) $$(ELIBS)
 
 $(SUBDIR)lib$(NAME).ver: $(SUBDIR)lib$(NAME).v $(OBJS)
$$(M)sed 's/MAJOR/$(lib$(NAME)_VERSION_MAJOR)/' $$< | 
$(VERSION_SCRIPT_POSTPROCESS_CMD) > $$@
-- 
2.1.4

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


Re: [libav-devel] [PATCH 2/7] configure: Simplify some library checks via check_lib()

2016-12-09 Thread Diego Biurrun
On Thu, Dec 08, 2016 at 09:02:09PM +0100, Diego Biurrun wrote:
> ---
>  configure | 12 +---
>  1 file changed, 5 insertions(+), 7 deletions(-)

OKed by Janne on IRC.

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


Re: [libav-devel] [PATCH 04/13] configure: Disentangle vfw32 and user32 lib handling

2016-12-09 Thread Diego Biurrun
On Fri, Dec 09, 2016 at 04:25:31PM +0100, Hendrik Leppkes wrote:
> On Fri, Dec 9, 2016 at 3:52 PM, Diego Biurrun  wrote:
> > On Mon, Dec 05, 2016 at 05:39:57PM +0100, Hendrik Leppkes wrote:
> >> On Tue, Nov 29, 2016 at 7:34 PM, Diego Biurrun  wrote:
> >> > --- a/configure
> >> > +++ b/configure
> >> > @@ -2382,7 +2382,6 @@ sndio_indev_deps="sndio_h"
> >> >  vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
> >> > -vfwcap_indev_extralibs="-lavicap32"
> >> >  xcbgrab_indev_deps="libxcb"
> >> >
> >> > @@ -3041,7 +3040,6 @@ msvc_common_flags(){
> >> >  -march=*) ;;
> >> >  -lz)  echo zlib.lib ;;
> >> > --lavicap32)   echo vfw32.lib user32.lib ;;
> >> >  -lx264)   echo libx264.lib ;;
> >> >  -l*)  echo ${flag#-l}.lib ;;
> >> > @@ -4752,7 +4750,7 @@ check_header AVFoundation/AVFoundation.h &&
> >> >
> >> >  check_header sys/videoio.h
> >> >
> >> > -check_func_headers "windows.h vfw.h" capCreateCaptureWindow 
> >> > "$vfwcap_indev_extralibs"
> >> > +check_lib "windows.h vfw.h" capCreateCaptureWindow -lvfw32
> >> >  # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
> >> >  # w32api 3.12 had it defined wrong
> >> > @@ -4804,6 +4802,10 @@ if enabled libxcb; then
> >> >
> >> >  enabled dxva2 &&
> >> > +check_lib "windows.h winuser.h" GetShellWindow -luser32 ||
> >> > +disable dxva2
> >> > +
> >> > +enabled dxva2 &&
> >> >  check_lib windows.h CoTaskMemFree -lole32 &&
> >> >  enable dxva2_lib
> >>
> >> This entirely takes out linking against avicap32, and replaces it with
> >> vfw32, presumably this was once required (except for msvc). That does
> >> introduce a distinct change in linking, so it would need testing on
> >> all supported versions of mingw.
> >
> > I suspect this was cargo-culted around. I tested building with dxva2
> > disabled and vfwcap enabled on Cygwin, Msys 2, and Mingw32. No problems.
> >
> >> Also does vfwcap indev not require user32 anymore, like it apparently used 
> >> to?
> >
> > The only use of GetShellWindow is in libavutil/hwcontext_dxva2.c.
> 
> On a quick check, vfwcap uses GetWindowLongPtr, which is from user32.dll.
> There might be other functions in there as well. I am not sure however
> if user32.dll is part of the default link libraries these days, and
> maybe was not at some earlier point.

It certainly worked without linking against user32.dll at all, so our
best guess is that your theory is right. I'm assuming that means that
linking against user32.dll at all is pointless nowadays?

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


[libav-devel] [PATCH] vaapi: Support PAL8

2016-12-09 Thread Luca Barbato
It is used to allocate scratch buffers by the qsv hwaccel.
---
 libavutil/hwcontext_vaapi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index b2e212c..e955add 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -111,6 +111,8 @@ static struct {
   //MAP(XBGR, RGB32,   0BGR),
 MAP(ARGB, RGB32,   ARGB),
   //MAP(XRGB, RGB32,   0RGB),
+// Special scratch buffer format
+{ VA_FOURCC_P208, VA_FOURCC_P208, AV_PIX_FMT_PAL8 },
 };
 #undef MAP
 
-- 
2.9.2

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


Re: [libav-devel] [PATCH 04/13] configure: Disentangle vfw32 and user32 lib handling

2016-12-09 Thread Hendrik Leppkes
On Fri, Dec 9, 2016 at 3:52 PM, Diego Biurrun  wrote:
> On Mon, Dec 05, 2016 at 05:39:57PM +0100, Hendrik Leppkes wrote:
>> On Tue, Nov 29, 2016 at 7:34 PM, Diego Biurrun  wrote:
>> > --- a/configure
>> > +++ b/configure
>> > @@ -2382,7 +2382,6 @@ sndio_indev_deps="sndio_h"
>> >  vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
>> > -vfwcap_indev_extralibs="-lavicap32"
>> >  xcbgrab_indev_deps="libxcb"
>> >
>> > @@ -3041,7 +3040,6 @@ msvc_common_flags(){
>> >  -march=*) ;;
>> >  -lz)  echo zlib.lib ;;
>> > --lavicap32)   echo vfw32.lib user32.lib ;;
>> >  -lx264)   echo libx264.lib ;;
>> >  -l*)  echo ${flag#-l}.lib ;;
>> > @@ -4752,7 +4750,7 @@ check_header AVFoundation/AVFoundation.h &&
>> >
>> >  check_header sys/videoio.h
>> >
>> > -check_func_headers "windows.h vfw.h" capCreateCaptureWindow 
>> > "$vfwcap_indev_extralibs"
>> > +check_lib "windows.h vfw.h" capCreateCaptureWindow -lvfw32
>> >  # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
>> >  # w32api 3.12 had it defined wrong
>> > @@ -4804,6 +4802,10 @@ if enabled libxcb; then
>> >
>> >  enabled dxva2 &&
>> > +check_lib "windows.h winuser.h" GetShellWindow -luser32 ||
>> > +disable dxva2
>> > +
>> > +enabled dxva2 &&
>> >  check_lib windows.h CoTaskMemFree -lole32 &&
>> >  enable dxva2_lib
>>
>> This entirely takes out linking against avicap32, and replaces it with
>> vfw32, presumably this was once required (except for msvc). That does
>> introduce a distinct change in linking, so it would need testing on
>> all supported versions of mingw.
>
> I suspect this was cargo-culted around. I tested building with dxva2
> disabled and vfwcap enabled on Cygwin, Msys 2, and Mingw32. No problems.
>
>> Also does vfwcap indev not require user32 anymore, like it apparently used 
>> to?
>
> The only use of GetShellWindow is in libavutil/hwcontext_dxva2.c.
>

On a quick check, vfwcap uses GetWindowLongPtr, which is from user32.dll.
There might be other functions in there as well. I am not sure however
if user32.dll is part of the default link libraries these days, and
maybe was not at some earlier point.

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


Re: [libav-devel] [PATCH] build: Add -D_XOPEN_SOURCE=600 to CPPFLAGS on Cygwin

2016-12-09 Thread Luca Barbato
On 09/12/2016 15:47, Diego Biurrun wrote:
> This is required to make certain math defines visible on modern Cygwin.
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 0ba4dd7..2c56096 100755
> --- a/configure
> +++ b/configure
> @@ -4177,7 +4177,7 @@ probe_libc(){
>  # MinGW headers can be installed on Cygwin, so check for newlib first.
>  elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
>  eval ${pfx}libc_type=newlib
> -add_${pfx}cppflags -U__STRICT_ANSI__
> +add_${pfx}cppflags -U__STRICT_ANSI__ -D_XOPEN_SOURCE=600
>  # MinGW64 is backwards compatible with MinGW32, so check for it first.
>  elif check_${pfx}cpp_condition _mingw.h "defined 
> __MINGW64_VERSION_MAJOR"; then
>  eval ${pfx}libc_type=mingw64
> 

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


Re: [libav-devel] [PATCH 04/13] configure: Disentangle vfw32 and user32 lib handling

2016-12-09 Thread Diego Biurrun
On Mon, Dec 05, 2016 at 05:39:57PM +0100, Hendrik Leppkes wrote:
> On Tue, Nov 29, 2016 at 7:34 PM, Diego Biurrun  wrote:
> > --- a/configure
> > +++ b/configure
> > @@ -2382,7 +2382,6 @@ sndio_indev_deps="sndio_h"
> >  vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
> > -vfwcap_indev_extralibs="-lavicap32"
> >  xcbgrab_indev_deps="libxcb"
> >
> > @@ -3041,7 +3040,6 @@ msvc_common_flags(){
> >  -march=*) ;;
> >  -lz)  echo zlib.lib ;;
> > --lavicap32)   echo vfw32.lib user32.lib ;;
> >  -lx264)   echo libx264.lib ;;
> >  -l*)  echo ${flag#-l}.lib ;;
> > @@ -4752,7 +4750,7 @@ check_header AVFoundation/AVFoundation.h &&
> >
> >  check_header sys/videoio.h
> >
> > -check_func_headers "windows.h vfw.h" capCreateCaptureWindow 
> > "$vfwcap_indev_extralibs"
> > +check_lib "windows.h vfw.h" capCreateCaptureWindow -lvfw32
> >  # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
> >  # w32api 3.12 had it defined wrong
> > @@ -4804,6 +4802,10 @@ if enabled libxcb; then
> >
> >  enabled dxva2 &&
> > +check_lib "windows.h winuser.h" GetShellWindow -luser32 ||
> > +disable dxva2
> > +
> > +enabled dxva2 &&
> >  check_lib windows.h CoTaskMemFree -lole32 &&
> >  enable dxva2_lib
> 
> This entirely takes out linking against avicap32, and replaces it with
> vfw32, presumably this was once required (except for msvc). That does
> introduce a distinct change in linking, so it would need testing on
> all supported versions of mingw.

I suspect this was cargo-culted around. I tested building with dxva2
disabled and vfwcap enabled on Cygwin, Msys 2, and Mingw32. No problems.

> Also does vfwcap indev not require user32 anymore, like it apparently used to?

The only use of GetShellWindow is in libavutil/hwcontext_dxva2.c.

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


[libav-devel] [PATCH] build: Add -D_XOPEN_SOURCE=600 to CPPFLAGS on Cygwin

2016-12-09 Thread Diego Biurrun
This is required to make certain math defines visible on modern Cygwin.
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 0ba4dd7..2c56096 100755
--- a/configure
+++ b/configure
@@ -4177,7 +4177,7 @@ probe_libc(){
 # MinGW headers can be installed on Cygwin, so check for newlib first.
 elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
 eval ${pfx}libc_type=newlib
-add_${pfx}cppflags -U__STRICT_ANSI__
+add_${pfx}cppflags -U__STRICT_ANSI__ -D_XOPEN_SOURCE=600
 # MinGW64 is backwards compatible with MinGW32, so check for it first.
 elif check_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; 
then
 eval ${pfx}libc_type=mingw64
-- 
2.1.4

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


Re: [libav-devel] [PATCH] unary: Convert to the new bitstream reader

2016-12-09 Thread Luca Barbato
On 09/12/2016 09:42, Diego Biurrun wrote:
> From: Alexandra Hájková 
> 
> ---
> 
> Sending now because it is a prerequisite for the already approved tta patch.
> 

Should not hurt.

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

Re: [libav-devel] [PATCH] avfilter/vf_hwupload_cuda: Add min/max limits for device option

2016-12-09 Thread Luca Barbato
On 09/12/2016 08:59, Ruta Gadkari wrote:
> If the device index is over the actual maximum, cuDeviceGet in
> hwcontext_cuda.c fails and error is returned.

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


Re: [libav-devel] [PATCH 7/7] build: Fine-grained link-time dependency settings

2016-12-09 Thread Diego Biurrun
On Thu, Dec 08, 2016 at 09:02:14PM +0100, Diego Biurrun wrote:
> Previously, all link-time dependencies were added for all libraries,
> resulting in bogus link-time dependencies since not all dependencies
> are shared across libraries. Also, in some cases like libavutil, not
> all dependencies were taken into account, resulting in some cases of
> underlinking.
> 
> To address all this mess a machinery is added for tracking which
> dependency belongs to which library component and then leveraged
> to determine correct dependencies for all individual libraries.
> ---
> Still open for discussion:
> - Vittorio mentioned that I have to add a lot of boilerplate for all those
>   zlib and whatnot dependencies. He has a point. There's probably a way to
>   write this more succinctly with a smarter resolver. However, I need to
>   finish this in the not-too-distant future. I'll try to find a moment to
>   test an idea I had.

It's far from as simple as I hoped (isn't it always?), so unless somebody
has a great suggestion, I'm not pursuing that path further.

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


[libav-devel] [PATCH] unary: Convert to the new bitstream reader

2016-12-09 Thread Diego Biurrun
From: Alexandra Hájková 

---

Sending now because it is a prerequisite for the already approved tta patch.

 libavcodec/aic.c   |  2 +-
 libavcodec/alac.c  |  2 +-
 libavcodec/alsdec.c|  3 ++-
 libavcodec/apedec.c|  2 +-
 libavcodec/dca_xll.c   |  2 +-
 libavcodec/dxtory.c|  2 +-
 libavcodec/ituh263dec.c|  2 +-
 libavcodec/mss4.c  |  2 +-
 libavcodec/ralf.c  |  2 +-
 libavcodec/takdec.c|  2 +-
 libavcodec/tta.c   |  2 +-
 libavcodec/unary.h | 19 ++-
 libavcodec/{unary.h => unary_legacy.h} |  0
 libavcodec/vc1.c   |  2 +-
 libavcodec/vc1_block.c |  2 +-
 libavcodec/wavpack.c   |  2 +-
 libavformat/mpc8.c |  3 ++-
 17 files changed, 27 insertions(+), 24 deletions(-)
 copy libavcodec/{unary.h => unary_legacy.h} (100%)

diff --git a/libavcodec/aic.c b/libavcodec/aic.c
index 7c6..2c9b6f8 100644
--- a/libavcodec/aic.c
+++ b/libavcodec/aic.c
@@ -29,7 +29,7 @@
 #include "golomb.h"
 #include "idctdsp.h"
 #include "thread.h"
-#include "unary.h"
+#include "unary_legacy.h"
 
 #define AIC_HDR_SIZE24
 #define AIC_BAND_COEFFS (64 + 32 + 192 + 96)
diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index 83d777c..aef68e7 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -52,8 +52,8 @@
 #include "get_bits.h"
 #include "bytestream.h"
 #include "internal.h"
-#include "unary.h"
 #include "mathops.h"
+#include "unary_legacy.h"
 #include "alac_data.h"
 
 #define ALAC_EXTRADATA_SIZE 36
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index af51487..9fd2827 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -29,12 +29,13 @@
 
 #include "avcodec.h"
 #include "get_bits.h"
-#include "unary.h"
 #include "mpeg4audio.h"
 #include "bytestream.h"
 #include "bgmc.h"
 #include "bswapdsp.h"
 #include "internal.h"
+#include "unary_legacy.h"
+
 #include "libavutil/samplefmt.h"
 #include "libavutil/crc.h"
 
diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 2f64488..69ded9a 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -31,7 +31,7 @@
 #include "bytestream.h"
 #include "internal.h"
 #include "get_bits.h"
-#include "unary.h"
+#include "unary_legacy.h"
 
 /**
  * @file
diff --git a/libavcodec/dca_xll.c b/libavcodec/dca_xll.c
index 5a558b8..5d76793 100644
--- a/libavcodec/dca_xll.c
+++ b/libavcodec/dca_xll.c
@@ -29,7 +29,7 @@
 #include "dca.h"
 #include "dcadata.h"
 #include "get_bits.h"
-#include "unary.h"
+#include "unary_legacy.h"
 
 /* Sign as bit 0 */
 static inline int get_bits_sm(GetBitContext *s, unsigned n)
diff --git a/libavcodec/dxtory.c b/libavcodec/dxtory.c
index e2b875b..b0fae2f 100644
--- a/libavcodec/dxtory.c
+++ b/libavcodec/dxtory.c
@@ -30,7 +30,7 @@
 #include "bytestream.h"
 #include "get_bits.h"
 #include "internal.h"
-#include "unary.h"
+#include "unary_legacy.h"
 
 static int dxtory_decode_v1_rgb(AVCodecContext *avctx, AVFrame *pic,
 const uint8_t *src, int src_size,
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index 9199f5c..ca0dd2c 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -40,7 +40,7 @@
 #include "internal.h"
 #include "mathops.h"
 #include "mpegutils.h"
-#include "unary.h"
+#include "unary_legacy.h"
 #include "flv.h"
 #include "rv10.h"
 #include "mpeg4video.h"
diff --git a/libavcodec/mss4.c b/libavcodec/mss4.c
index 073e0e2..0acdb99 100644
--- a/libavcodec/mss4.c
+++ b/libavcodec/mss4.c
@@ -30,7 +30,7 @@
 #include "get_bits.h"
 #include "internal.h"
 #include "mss34dsp.h"
-#include "unary.h"
+#include "unary_legacy.h"
 
 #define HEADER_SIZE 8
 
diff --git a/libavcodec/ralf.c b/libavcodec/ralf.c
index bed5adf..9812837 100644
--- a/libavcodec/ralf.c
+++ b/libavcodec/ralf.c
@@ -32,7 +32,7 @@
 #include "get_bits.h"
 #include "golomb.h"
 #include "internal.h"
-#include "unary.h"
+#include "unary_legacy.h"
 #include "ralfdata.h"
 
 #define FILTER_NONE 0
diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c
index 394567b..e7320c6 100644
--- a/libavcodec/takdec.c
+++ b/libavcodec/takdec.c
@@ -32,7 +32,7 @@
 #include "audiodsp.h"
 #include "avcodec.h"
 #include "internal.h"
-#include "unary.h"
+#include "unary_legacy.h"
 #include "tak.h"
 
 #define MAX_SUBFRAMES 8 // max number of subframes 
per channel
diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index 5532580..0f67a05 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -35,7 +35,7 @@
 #include "avcodec.h"
 #include "get_bits.h"
 #include "internal.h"
-#include "unary.h"
+#include "unary_legacy.h"
 
 #define FORMAT_SIMPLE1
 #define FORMAT_ENCRYPTED 2
diff --git a/libavcodec/unary.h b/libavcodec/unary.h
index d14929f..2992017 100644
--- a/libavcodec/unary.h
+++ b/libavcodec/unary.h
@@ -21,36