Re: [libav-devel] [PATCH] d3d11va: Check WINAPI_FAMILY instead of HAVE_LOADLIBRARY
On Tue, Jul 04, 2017 at 10:18:21PM +0300, Martin Storsjö wrote: > --- a/configure > +++ b/configure > @@ -4894,7 +4894,14 @@ fi > > # d3d11va requires linking directly to dxgi and d3d11 if not building for > # the desktop api partition > -enabled LoadLibrary || d3d11va_extralibs="-ldxgi -ld3d11" > +check_cpp < +#ifdef WINAPI_FAMILY > +#include > +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) > +#error not desktop > +#endif > +#endif > +EOF Add "uwp" or whatever to HAVE_LIST, test for and enable it here, then > --- a/libavutil/hwcontext_d3d11va.c > +++ b/libavutil/hwcontext_d3d11va.c > @@ -47,6 +47,13 @@ > #include "pixdesc.h" > #include "pixfmt.h" > > +#ifdef WINAPI_FAMILY > +#include > +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) > +#define UWP > +#endif > +#endif you don't need to do this dance here and instead > @@ -56,7 +63,7 @@ static PFN_D3D11_CREATE_DEVICE mD3D11CreateDevice; > > static av_cold void load_functions(void) > { > -#if HAVE_LOADLIBRARY > +#ifndef UWP check for HAVE_UWP or whatever at this point. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] d3d11va: Check WINAPI_FAMILY instead of HAVE_LOADLIBRARY
On Tue, Jul 04, 2017 at 10:57:41PM +0300, Martin Storsjö wrote: > On Tue, 4 Jul 2017, wm4 wrote: > >On Tue, 4 Jul 2017 22:18:21 +0300 Martin Storsjöwrote: > >>--- a/libavutil/hwcontext_d3d11va.c > >>+++ b/libavutil/hwcontext_d3d11va.c > >>@@ -47,6 +47,13 @@ > >> > >>+#ifdef WINAPI_FAMILY > >>+#include > >>+#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) > >>+#define UWP > >>+#endif > >>+#endif > >>+ > >>@@ -56,7 +63,7 @@ static PFN_D3D11_CREATE_DEVICE mD3D11CreateDevice; > >> > >> static av_cold void load_functions(void) > >> { > >>-#if HAVE_LOADLIBRARY > >>+#ifndef UWP > >> // We let these "leak" - this is fine, as unloading has no great > >> benefit, and > > > >LGTM... though isn't "UWP" a bit too generic as an identifier? > > It's a little terse yeah, but it's at least only visible within this file > (for now). Any better suggestions? WINAPI_FAMILY_DESKTOP WINAPI_DESKTOP or something along those lines? Maybe with an FF_ prefix? Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] d3d11va: Check WINAPI_FAMILY instead of HAVE_LOADLIBRARY
On Tue, 4 Jul 2017 22:57:41 +0300 (EEST) Martin Storsjöwrote: > On Tue, 4 Jul 2017, wm4 wrote: > > > On Tue, 4 Jul 2017 22:18:21 +0300 > > Martin Storsjö wrote: > > > >> If using the winstore compat library, a fallback LoadLibrary > >> function does exist, that only calls LoadPackagedLibrary though > >> (which doesn't work for dynamically loading d3d11 DLLs). > >> > >> Therefore explicitly check the targeted API family instead. > >> --- > >> configure | 9 - > >> libavutil/hwcontext_d3d11va.c | 13 ++--- > >> 2 files changed, 18 insertions(+), 4 deletions(-) > >> > >> diff --git a/configure b/configure > >> index 96bc5ab..ce81d3b 100755 > >> --- a/configure > >> +++ b/configure > >> @@ -4894,7 +4894,14 @@ fi > >> > >> # d3d11va requires linking directly to dxgi and d3d11 if not building for > >> # the desktop api partition > >> -enabled LoadLibrary || d3d11va_extralibs="-ldxgi -ld3d11" > >> +check_cpp < >> +#ifdef WINAPI_FAMILY > >> +#include > >> +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) > >> +#error not desktop > >> +#endif > >> +#endif > >> +EOF > >> > >> enabled vaapi && require vaapi va/va.h vaInitialize -lva > >> > >> diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c > >> index 75f78d8..4d21b57 100644 > >> --- a/libavutil/hwcontext_d3d11va.c > >> +++ b/libavutil/hwcontext_d3d11va.c > >> @@ -47,6 +47,13 @@ > >> #include "pixdesc.h" > >> #include "pixfmt.h" > >> > >> +#ifdef WINAPI_FAMILY > >> +#include > >> +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) > >> +#define UWP > >> +#endif > >> +#endif > >> + > >> typedef HRESULT(WINAPI *PFN_CREATE_DXGI_FACTORY)(REFIID riid, void > >> **ppFactory); > >> > >> static AVOnce functions_loaded = AV_ONCE_INIT; > >> @@ -56,7 +63,7 @@ static PFN_D3D11_CREATE_DEVICE mD3D11CreateDevice; > >> > >> static av_cold void load_functions(void) > >> { > >> -#if HAVE_LOADLIBRARY > >> +#ifndef UWP > >> // We let these "leak" - this is fine, as unloading has no great > >> benefit, and > >> // Windows will mark a DLL as loaded forever if its internal refcount > >> overflows > >> // from too many LoadLibrary calls. > >> @@ -486,7 +493,7 @@ static int d3d11va_device_create(AVHWDeviceContext > >> *ctx, const char *device, > >> int ret; > >> > >> // (On UWP we can't check this.) > >> -#if HAVE_LOADLIBRARY > >> +#ifndef UWP > >> if (!LoadLibrary("d3d11_1sdklayers.dll")) > >> is_debug = 0; > >> #endif > >> @@ -527,7 +534,7 @@ static int d3d11va_device_create(AVHWDeviceContext > >> *ctx, const char *device, > >> ID3D10Multithread_Release(pMultithread); > >> } > >> > >> -#if HAVE_LOADLIBRARY && HAVE_DXGIDEBUG_H > >> +#if !defined(UWP) && HAVE_DXGIDEBUG_H > >> if (is_debug) { > >> HANDLE dxgidebug_dll = LoadLibrary("dxgidebug.dll"); > >> if (dxgidebug_dll) { > > > > LGTM... though isn't "UWP" a bit too generic as an identifier? > > It's a little terse yeah, but it's at least only visible within this file > (for now). Any better suggestions? Maybe FF_UWP? UWP alone is awfully generic and I'd be slightly worried about potential collisions. Could also be that I'm overthinking this. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] d3d11va: Check WINAPI_FAMILY instead of HAVE_LOADLIBRARY
On Tue, 4 Jul 2017, wm4 wrote: On Tue, 4 Jul 2017 22:18:21 +0300 Martin Storsjöwrote: If using the winstore compat library, a fallback LoadLibrary function does exist, that only calls LoadPackagedLibrary though (which doesn't work for dynamically loading d3d11 DLLs). Therefore explicitly check the targeted API family instead. --- configure | 9 - libavutil/hwcontext_d3d11va.c | 13 ++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 96bc5ab..ce81d3b 100755 --- a/configure +++ b/configure @@ -4894,7 +4894,14 @@ fi # d3d11va requires linking directly to dxgi and d3d11 if not building for # the desktop api partition -enabled LoadLibrary || d3d11va_extralibs="-ldxgi -ld3d11" +check_cpp < +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +#error not desktop +#endif +#endif +EOF enabled vaapi && require vaapi va/va.h vaInitialize -lva diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 75f78d8..4d21b57 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -47,6 +47,13 @@ #include "pixdesc.h" #include "pixfmt.h" +#ifdef WINAPI_FAMILY +#include +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +#define UWP +#endif +#endif + typedef HRESULT(WINAPI *PFN_CREATE_DXGI_FACTORY)(REFIID riid, void **ppFactory); static AVOnce functions_loaded = AV_ONCE_INIT; @@ -56,7 +63,7 @@ static PFN_D3D11_CREATE_DEVICE mD3D11CreateDevice; static av_cold void load_functions(void) { -#if HAVE_LOADLIBRARY +#ifndef UWP // We let these "leak" - this is fine, as unloading has no great benefit, and // Windows will mark a DLL as loaded forever if its internal refcount overflows // from too many LoadLibrary calls. @@ -486,7 +493,7 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, const char *device, int ret; // (On UWP we can't check this.) -#if HAVE_LOADLIBRARY +#ifndef UWP if (!LoadLibrary("d3d11_1sdklayers.dll")) is_debug = 0; #endif @@ -527,7 +534,7 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, const char *device, ID3D10Multithread_Release(pMultithread); } -#if HAVE_LOADLIBRARY && HAVE_DXGIDEBUG_H +#if !defined(UWP) && HAVE_DXGIDEBUG_H if (is_debug) { HANDLE dxgidebug_dll = LoadLibrary("dxgidebug.dll"); if (dxgidebug_dll) { LGTM... though isn't "UWP" a bit too generic as an identifier? It's a little terse yeah, but it's at least only visible within this file (for now). Any better suggestions? // Martin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] d3d11va: Check WINAPI_FAMILY instead of HAVE_LOADLIBRARY
On Tue, 4 Jul 2017 22:18:21 +0300 Martin Storsjöwrote: > If using the winstore compat library, a fallback LoadLibrary > function does exist, that only calls LoadPackagedLibrary though > (which doesn't work for dynamically loading d3d11 DLLs). > > Therefore explicitly check the targeted API family instead. > --- > configure | 9 - > libavutil/hwcontext_d3d11va.c | 13 ++--- > 2 files changed, 18 insertions(+), 4 deletions(-) > > diff --git a/configure b/configure > index 96bc5ab..ce81d3b 100755 > --- a/configure > +++ b/configure > @@ -4894,7 +4894,14 @@ fi > > # d3d11va requires linking directly to dxgi and d3d11 if not building for > # the desktop api partition > -enabled LoadLibrary || d3d11va_extralibs="-ldxgi -ld3d11" > +check_cpp < +#ifdef WINAPI_FAMILY > +#include > +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) > +#error not desktop > +#endif > +#endif > +EOF > > enabled vaapi && require vaapi va/va.h vaInitialize -lva > > diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c > index 75f78d8..4d21b57 100644 > --- a/libavutil/hwcontext_d3d11va.c > +++ b/libavutil/hwcontext_d3d11va.c > @@ -47,6 +47,13 @@ > #include "pixdesc.h" > #include "pixfmt.h" > > +#ifdef WINAPI_FAMILY > +#include > +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) > +#define UWP > +#endif > +#endif > + > typedef HRESULT(WINAPI *PFN_CREATE_DXGI_FACTORY)(REFIID riid, void > **ppFactory); > > static AVOnce functions_loaded = AV_ONCE_INIT; > @@ -56,7 +63,7 @@ static PFN_D3D11_CREATE_DEVICE mD3D11CreateDevice; > > static av_cold void load_functions(void) > { > -#if HAVE_LOADLIBRARY > +#ifndef UWP > // We let these "leak" - this is fine, as unloading has no great > benefit, and > // Windows will mark a DLL as loaded forever if its internal refcount > overflows > // from too many LoadLibrary calls. > @@ -486,7 +493,7 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, > const char *device, > int ret; > > // (On UWP we can't check this.) > -#if HAVE_LOADLIBRARY > +#ifndef UWP > if (!LoadLibrary("d3d11_1sdklayers.dll")) > is_debug = 0; > #endif > @@ -527,7 +534,7 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, > const char *device, > ID3D10Multithread_Release(pMultithread); > } > > -#if HAVE_LOADLIBRARY && HAVE_DXGIDEBUG_H > +#if !defined(UWP) && HAVE_DXGIDEBUG_H > if (is_debug) { > HANDLE dxgidebug_dll = LoadLibrary("dxgidebug.dll"); > if (dxgidebug_dll) { LGTM... though isn't "UWP" a bit too generic as an identifier? ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] d3d11va: Check WINAPI_FAMILY instead of HAVE_LOADLIBRARY
On 7/4/17 9:18 PM, Martin Storsjö wrote: > If using the winstore compat library, a fallback LoadLibrary > function does exist, that only calls LoadPackagedLibrary though > (which doesn't work for dynamically loading d3d11 DLLs). > > Therefore explicitly check the targeted API family instead. > --- > configure | 9 - > libavutil/hwcontext_d3d11va.c | 13 ++--- > 2 files changed, 18 insertions(+), 4 deletions(-) > Seems ok. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] d3d11va: Check WINAPI_FAMILY instead of HAVE_LOADLIBRARY
If using the winstore compat library, a fallback LoadLibrary function does exist, that only calls LoadPackagedLibrary though (which doesn't work for dynamically loading d3d11 DLLs). Therefore explicitly check the targeted API family instead. --- configure | 9 - libavutil/hwcontext_d3d11va.c | 13 ++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 96bc5ab..ce81d3b 100755 --- a/configure +++ b/configure @@ -4894,7 +4894,14 @@ fi # d3d11va requires linking directly to dxgi and d3d11 if not building for # the desktop api partition -enabled LoadLibrary || d3d11va_extralibs="-ldxgi -ld3d11" +check_cpp < +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +#error not desktop +#endif +#endif +EOF enabled vaapi && require vaapi va/va.h vaInitialize -lva diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 75f78d8..4d21b57 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -47,6 +47,13 @@ #include "pixdesc.h" #include "pixfmt.h" +#ifdef WINAPI_FAMILY +#include +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +#define UWP +#endif +#endif + typedef HRESULT(WINAPI *PFN_CREATE_DXGI_FACTORY)(REFIID riid, void **ppFactory); static AVOnce functions_loaded = AV_ONCE_INIT; @@ -56,7 +63,7 @@ static PFN_D3D11_CREATE_DEVICE mD3D11CreateDevice; static av_cold void load_functions(void) { -#if HAVE_LOADLIBRARY +#ifndef UWP // We let these "leak" - this is fine, as unloading has no great benefit, and // Windows will mark a DLL as loaded forever if its internal refcount overflows // from too many LoadLibrary calls. @@ -486,7 +493,7 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, const char *device, int ret; // (On UWP we can't check this.) -#if HAVE_LOADLIBRARY +#ifndef UWP if (!LoadLibrary("d3d11_1sdklayers.dll")) is_debug = 0; #endif @@ -527,7 +534,7 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, const char *device, ID3D10Multithread_Release(pMultithread); } -#if HAVE_LOADLIBRARY && HAVE_DXGIDEBUG_H +#if !defined(UWP) && HAVE_DXGIDEBUG_H if (is_debug) { HANDLE dxgidebug_dll = LoadLibrary("dxgidebug.dll"); if (dxgidebug_dll) { -- 2.7.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 05/25] avtools: Use the new channel layout API in AVFrame
On 7/4/17 6:18 PM, Vittorio Giovara wrote: > On Tue, Jul 4, 2017 at 6:50 AM, Luca Barbatowrote: >> On 6/29/17 12:10 AM, Vittorio Giovara wrote: >>> --- >>> avtools/avconv.c| 2 +- >>> avtools/avconv_filter.c | 2 +- >>> avtools/avplay.c| 4 ++-- >>> 3 files changed, 4 insertions(+), 4 deletions(-) >>> >>> diff --git a/avtools/avconv.c b/avtools/avconv.c >>> index 8dd11bb5fc..42cbfef592 100644 >>> --- a/avtools/avconv.c >>> +++ b/avtools/avconv.c >>> @@ -1209,7 +1209,7 @@ static int ifilter_send_frame(InputFilter *ifilter, >>> AVFrame *frame) >>> switch (ifilter->ist->st->codecpar->codec_type) { >>> case AVMEDIA_TYPE_AUDIO: >>> need_reinit |= ifilter->sample_rate!= frame->sample_rate || >>> - ifilter->channel_layout != frame->channel_layout; >>> + ifilter->channel_layout != frame->ch_layout.u.mask; >>> break; >>> case AVMEDIA_TYPE_VIDEO: >>> need_reinit |= ifilter->width != frame->width || >>> diff --git a/avtools/avconv_filter.c b/avtools/avconv_filter.c >>> index 884478da27..e719c06658 100644 >>> --- a/avtools/avconv_filter.c >>> +++ b/avtools/avconv_filter.c >>> @@ -798,7 +798,7 @@ int ifilter_parameters_from_frame(InputFilter *ifilter, >>> const AVFrame *frame) >>> ifilter->sample_aspect_ratio = frame->sample_aspect_ratio; >>> >>> ifilter->sample_rate = frame->sample_rate; >>> -ifilter->channel_layout = frame->channel_layout; >>> +ifilter->channel_layout = frame->ch_layout.u.mask; >>> >>> if (frame->hw_frames_ctx) { >>> ifilter->hw_frames_ctx = av_buffer_ref(frame->hw_frames_ctx); >>> diff --git a/avtools/avplay.c b/avtools/avplay.c >>> index b6dbc52cf7..6cc63258fc 100644 >>> --- a/avtools/avplay.c >>> +++ b/avtools/avplay.c >>> @@ -1837,11 +1837,11 @@ static int audio_decode_frame(PlayerState *is, >>> double *pts_ptr) >>> is->frame->format, 1); >>> >>> audio_resample = is->frame->format != >>> is->sdl_sample_fmt || >>> - is->frame->channel_layout != >>> is->sdl_channel_layout || >>> + is->frame->ch_layout.u.mask != >>> is->sdl_channel_layout || >>> is->frame->sample_rate!= >>> is->sdl_sample_rate; >>> >>> resample_changed = is->frame->format != >>> is->resample_sample_fmt || >>> - is->frame->channel_layout != >>> is->resample_channel_layout || >>> + is->frame->ch_layout.u.mask != >>> is->resample_channel_layout || >>> is->frame->sample_rate!= >>> is->resample_sample_rate; >>> >>> if ((!is->avr && audio_resample) || resample_changed) { >>> >> >> Doesn't hurt, but might be folded with patch 16. > > patch 16 is for supplementary parts, such as examples or tests, I'd > rather keep the main tools patches separated > As you prefer, I do not have strong opinions about it. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] [RFC] Add Cinepak encoder
On Tue, Jul 4, 2017 at 11:59 AM, Diego Biurrunwrote: > From: Tomas Härdin > > Signed-off-by: Diego Biurrun > --- > > The whole set squashed together, to ease Luca's review. IMO that's also how the set should be squashed and pushed, with a clear commit message about who changed what. -- Vittorio ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 05/25] avtools: Use the new channel layout API in AVFrame
On Tue, Jul 4, 2017 at 6:50 AM, Luca Barbatowrote: > On 6/29/17 12:10 AM, Vittorio Giovara wrote: >> --- >> avtools/avconv.c| 2 +- >> avtools/avconv_filter.c | 2 +- >> avtools/avplay.c| 4 ++-- >> 3 files changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/avtools/avconv.c b/avtools/avconv.c >> index 8dd11bb5fc..42cbfef592 100644 >> --- a/avtools/avconv.c >> +++ b/avtools/avconv.c >> @@ -1209,7 +1209,7 @@ static int ifilter_send_frame(InputFilter *ifilter, >> AVFrame *frame) >> switch (ifilter->ist->st->codecpar->codec_type) { >> case AVMEDIA_TYPE_AUDIO: >> need_reinit |= ifilter->sample_rate!= frame->sample_rate || >> - ifilter->channel_layout != frame->channel_layout; >> + ifilter->channel_layout != frame->ch_layout.u.mask; >> break; >> case AVMEDIA_TYPE_VIDEO: >> need_reinit |= ifilter->width != frame->width || >> diff --git a/avtools/avconv_filter.c b/avtools/avconv_filter.c >> index 884478da27..e719c06658 100644 >> --- a/avtools/avconv_filter.c >> +++ b/avtools/avconv_filter.c >> @@ -798,7 +798,7 @@ int ifilter_parameters_from_frame(InputFilter *ifilter, >> const AVFrame *frame) >> ifilter->sample_aspect_ratio = frame->sample_aspect_ratio; >> >> ifilter->sample_rate = frame->sample_rate; >> -ifilter->channel_layout = frame->channel_layout; >> +ifilter->channel_layout = frame->ch_layout.u.mask; >> >> if (frame->hw_frames_ctx) { >> ifilter->hw_frames_ctx = av_buffer_ref(frame->hw_frames_ctx); >> diff --git a/avtools/avplay.c b/avtools/avplay.c >> index b6dbc52cf7..6cc63258fc 100644 >> --- a/avtools/avplay.c >> +++ b/avtools/avplay.c >> @@ -1837,11 +1837,11 @@ static int audio_decode_frame(PlayerState *is, >> double *pts_ptr) >> is->frame->format, 1); >> >> audio_resample = is->frame->format != >> is->sdl_sample_fmt || >> - is->frame->channel_layout != >> is->sdl_channel_layout || >> + is->frame->ch_layout.u.mask != >> is->sdl_channel_layout || >> is->frame->sample_rate!= >> is->sdl_sample_rate; >> >> resample_changed = is->frame->format != >> is->resample_sample_fmt || >> - is->frame->channel_layout != >> is->resample_channel_layout || >> + is->frame->ch_layout.u.mask != >> is->resample_channel_layout || >> is->frame->sample_rate!= >> is->resample_sample_rate; >> >> if ((!is->avr && audio_resample) || resample_changed) { >> > > Doesn't hurt, but might be folded with patch 16. patch 16 is for supplementary parts, such as examples or tests, I'd rather keep the main tools patches separated -- Vittorio ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] [RFC] Add Cinepak encoder
From: Tomas Härdin Signed-off-by: Diego Biurrun--- The whole set squashed together, to ease Luca's review. Changelog|1 + doc/general.texi |2 +- libavcodec/Makefile |1 + libavcodec/allcodecs.c |2 +- libavcodec/cinepakenc.c | 1238 ++ tests/fate/vcodec.mak|4 + tests/ref/vsynth/vsynth1-cinepak |4 + tests/ref/vsynth/vsynth2-cinepak |4 + 8 files changed, 1254 insertions(+), 2 deletions(-) create mode 100644 libavcodec/cinepakenc.c create mode 100644 tests/ref/vsynth/vsynth1-cinepak create mode 100644 tests/ref/vsynth/vsynth2-cinepak diff --git a/Changelog b/Changelog index e44df54..adcca3f 100644 --- a/Changelog +++ b/Changelog @@ -16,6 +16,7 @@ version : - FM Screen Capture Codec decoder - ClearVideo decoder (I-frames only) - support for decoding through D3D11VA in avconv +- Cinepak encoder version 12: diff --git a/doc/general.texi b/doc/general.texi index 905e2d1..adf5b4e 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -631,7 +631,7 @@ following image formats are supported: @tab Codec used in Delphine Software International games. @item Discworld II BMV Video @tab @tab X @item Canopus Lossless Codec @tab @tab X -@item Cinepak@tab @tab X +@item Cinepak@tab X @tab X @item Cirrus Logic AccuPak @tab X @tab X @tab fourcc: CLJR @item Creative YUV (CYUV)@tab @tab X diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 240f7d8..2b91588 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -186,6 +186,7 @@ OBJS-$(CONFIG_CDGRAPHICS_DECODER) += cdgraphics.o OBJS-$(CONFIG_CDXL_DECODER)+= cdxl.o OBJS-$(CONFIG_CFHD_DECODER)+= cfhd.o cfhddata.o OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o +OBJS-$(CONFIG_CINEPAK_ENCODER) += cinepakenc.o OBJS-$(CONFIG_CLEARVIDEO_DECODER) += clearvideo.o OBJS-$(CONFIG_CLJR_DECODER)+= cljrdec.o OBJS-$(CONFIG_CLJR_ENCODER)+= cljrenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 70c35e9..5635ae1 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -133,7 +133,7 @@ void avcodec_register_all(void) REGISTER_DECODER(CDGRAPHICS,cdgraphics); REGISTER_DECODER(CDXL, cdxl); REGISTER_DECODER(CFHD, cfhd); -REGISTER_DECODER(CINEPAK, cinepak); +REGISTER_ENCDEC (CINEPAK, cinepak); REGISTER_DECODER(CLEARVIDEO,clearvideo); REGISTER_ENCDEC (CLJR, cljr); REGISTER_DECODER(CLLC, cllc); diff --git a/libavcodec/cinepakenc.c b/libavcodec/cinepakenc.c new file mode 100644 index 000..5466a1e --- /dev/null +++ b/libavcodec/cinepakenc.c @@ -0,0 +1,1238 @@ +/* + * Cinepak encoder (c) 2011 Tomas Härdin + * http://titan.codemill.se/~tomhar/cinepakenc.patch + * + * Fixes and improvements, vintage decoders compatibility + * (c) 2013, 2014 Rl, Aetey Global Technologies AB + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/* MAYBE: + * - "optimally" split the frame into several non-regular areas + * using a separate codebook pair for each area and approximating + * the area by several rectangular strips (generally not full width ones) + * (use quadtree splitting? a simple fixed-granularity grid?) + * + * + * version 2014-01-23 Rl + * - added option handling for flexibility + * + * version 2014-01-21 Rl + * - believe it or not, now we get even smaller files, with better quality + * (which means I missed an optimization earlier :) + * + * version 2014-01-20 Rl + * - made the encoder compatible with vintage decoders + * and added some yet unused code for possible future + * incremental codebook updates + * - fixed a small memory leak + * + * version
Re: [libav-devel] Bug in -loop feature
On Wed, 28 Jun 2017 00:31:16 +0200 Peter Großewrote: > Hello. > > I've problems playing a short clip [1] in a continuous loop using the -loop > option and I'm not sure, how to fix this. > > Running > avconv -loop -1 -i in.mp4 -qscale 2 out.avi > leads to an infinite loop (without any output) after the first iteration. > > I narrowed down the problem to a call to av_seek_frame(), looking for a > non-existant timestamp. See below. > > The clip is a stream capture of a live stream containing one video and one > audio track. Both tracks start with negative stamps: > > Video: > ts[0] = -512 (keyframe) > ts[1] = -256 (no keyframe) > ts[2] = 0 (no keyframe) > ts[3] = 256 (no keyframe) > ts[4] = 512 (no keyframe) > > Audio: > ts[0] = -1024 (keyframe) > ts[1] = 0 (keyframe) > ts[2] = 1024 (keyframe) > ts[3] = 2048 (keyframe) > ts[4] = 3072 (keyframe) > > In libavformat/utils.c:1664 in update_stream_timings(), the smallest > timestamp of all streams of the given format context is calculated and set as > "start_time". > > In my case > streams[0].start_time = 0 > streams[0].time_base = 1/12800 > > streams[1].start_time = -1024 > streams[1].time_base = 1/48000 > > leads to > ic->start_time = -21333 > > due to the smaller timestamp of the audio track. > > When the clip ends, seek_to_start() (avtools/avconv.c:2515) is called, which > calls av_seek_frame() with stream_index -1 and this start_time. > > And there is the issue: stream_index=-1 indicates no specific stream is > selected, but the given start_time relates to the audio track. > > The called seek_frame_internal() then selects the default stream, since no > specific stream was selected, which is in my case stream 0, the video track. > Then the "start_time" timestamp (of the audio track) gets rescaled with the > time_base of the selected stream (the video track). > > timestamp = -273 > > The following call to read_seek (in my case mov_read_seek) then fails to > find a frame with that invalid timestamp and returns AVERROR_INVALIDDATA. > This leads to seek_to_start() to return, as well as process_input() and > the loop starts again with the same result, leading to the described infinite > loop. > > My question is now: which of these issues are bugs and how to fix them > properly? > > Should the AVFormatContext->start_time be set to smallest timestamp of all > streams or only of the default stream? Maybe also store the stream index the > timestamp refers to? > > Should seek_to_start() use stream_index=-1 and the context start_time > together? > > How should the errors occurring during seek_to_start() be handled? I guess > in the context of live streams restarting the encoding after errors > is nice, but when decoding files any errors should make avconv exit, since > recovering from decoding problems of the same file is not likely. > > How should the mov demuxer handle negative timestamps when seeking? > Currently, all negative timestamps are set to 0 in mov_read_seek() > (mov.c:4053), which leads in my case to mov_seek_stream() bailing out with > AVERROR_INVALIDDATA, since no key frame with that timestamp is found > (keyframe is at -512) and the condition > > if (sample < 0 && st->nb_index_entries && > timestamp < st->index_entries[0].timestamp) > > is not met: timestamp=0 is not smaller than the first (negative) timestamp. > > Looking through the code, I noticed a time_offset is calculated when parsing > the header of the clip. Using this offset when seeking for timestamp=0 fixed > the immediate problem, see attached patch. But I'm not sure, if this is > correct and I think the other issues are still valid. > > I hope the information provided is enough to reproduce the issue. > > Regards > Peter > > [1] https://trac.ffmpeg.org/raw-attachment/ticket/6139/loop.mp4 I'd like to ask kindly if anyone could give me some more feedback to help me fixing these issues? Or is now somehow a bad time? Is more information required? Regards Peter ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 8/9] cinepakenc: misc small changes
On Mon, Jul 03, 2017 at 08:18:32PM +0200, Luca Barbato wrote: > On 6/28/17 12:27 AM, Diego Biurrun wrote: > > --- a/libavcodec/cinepakenc.c > > +++ b/libavcodec/cinepakenc.c > > @@ -212,10 +211,10 @@ static av_cold int cinepak_encode_init(AVCodecContext > > *avctx) > > if (!(s->input_frame = av_frame_alloc())) > > goto enomem; > > > > -if (!(s->codebook_input = av_malloc(sizeof(int) * (avctx->pix_fmt == > > AV_PIX_FMT_RGB24 ? 6 : 4) * (avctx->width * avctx->height) >> 2))) > > +if (!(s->codebook_input = av_malloc(sizeof(*s->codebook_input) * > > (avctx->pix_fmt == AV_PIX_FMT_RGB24 ? 6 : 4) * (avctx->width * > > avctx->height) >> 2))) > > goto enomem; > > > > av_malloc_array > > > -if (!(s->codebook_closest = av_malloc(sizeof(int) * (avctx->width * > > avctx->height) >> 2))) > > +if (!(s->codebook_closest = av_malloc(sizeof(*s->codebook_closest) * > > (avctx->width * avctx->height) >> 2))) > > av_malloc_array That won't play nice with the shift, which is done after the multiplication. Whether or not that is intentional, I don't know. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 17/25] channel_layout: Add Ambisonic components and channel order
On 6/29/17 12:11 AM, Vittorio Giovara wrote: > Signed-off-by: Vittorio Giovara> --- > libavutil/channel_layout.c | 86 > -- > libavutil/channel_layout.h | 33 ++ > 2 files changed, 116 insertions(+), 3 deletions(-) Looks fine. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 05/25] avtools: Use the new channel layout API in AVFrame
On 6/29/17 12:10 AM, Vittorio Giovara wrote: > --- > avtools/avconv.c| 2 +- > avtools/avconv_filter.c | 2 +- > avtools/avplay.c| 4 ++-- > 3 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/avtools/avconv.c b/avtools/avconv.c > index 8dd11bb5fc..42cbfef592 100644 > --- a/avtools/avconv.c > +++ b/avtools/avconv.c > @@ -1209,7 +1209,7 @@ static int ifilter_send_frame(InputFilter *ifilter, > AVFrame *frame) > switch (ifilter->ist->st->codecpar->codec_type) { > case AVMEDIA_TYPE_AUDIO: > need_reinit |= ifilter->sample_rate!= frame->sample_rate || > - ifilter->channel_layout != frame->channel_layout; > + ifilter->channel_layout != frame->ch_layout.u.mask; > break; > case AVMEDIA_TYPE_VIDEO: > need_reinit |= ifilter->width != frame->width || > diff --git a/avtools/avconv_filter.c b/avtools/avconv_filter.c > index 884478da27..e719c06658 100644 > --- a/avtools/avconv_filter.c > +++ b/avtools/avconv_filter.c > @@ -798,7 +798,7 @@ int ifilter_parameters_from_frame(InputFilter *ifilter, > const AVFrame *frame) > ifilter->sample_aspect_ratio = frame->sample_aspect_ratio; > > ifilter->sample_rate = frame->sample_rate; > -ifilter->channel_layout = frame->channel_layout; > +ifilter->channel_layout = frame->ch_layout.u.mask; > > if (frame->hw_frames_ctx) { > ifilter->hw_frames_ctx = av_buffer_ref(frame->hw_frames_ctx); > diff --git a/avtools/avplay.c b/avtools/avplay.c > index b6dbc52cf7..6cc63258fc 100644 > --- a/avtools/avplay.c > +++ b/avtools/avplay.c > @@ -1837,11 +1837,11 @@ static int audio_decode_frame(PlayerState *is, double > *pts_ptr) > is->frame->format, 1); > > audio_resample = is->frame->format != is->sdl_sample_fmt > || > - is->frame->channel_layout != > is->sdl_channel_layout || > + is->frame->ch_layout.u.mask != > is->sdl_channel_layout || > is->frame->sample_rate!= > is->sdl_sample_rate; > > resample_changed = is->frame->format != > is->resample_sample_fmt || > - is->frame->channel_layout != > is->resample_channel_layout || > + is->frame->ch_layout.u.mask != > is->resample_channel_layout || > is->frame->sample_rate!= > is->resample_sample_rate; > > if ((!is->avr && audio_resample) || resample_changed) { > Doesn't hurt, but might be folded with patch 16. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] lavr: switch to the new channel layout API
On 6/29/17 10:17 PM, Vittorio Giovara wrote: > From: Anton Khirnov> > Set a whitelist of supported channel order. > > Signed-off-by: Vittorio Giovara > --- > libavresample/audio_mix.c| 148 ++-- > libavresample/audio_mix_matrix.c | 477 > ++- > libavresample/avresample.h | 42 +++- > libavresample/internal.h | 10 +- > libavresample/options.c | 8 + > libavresample/tests/avresample.c | 26 +-- > libavresample/utils.c| 130 +++ > 7 files changed, 507 insertions(+), 334 deletions(-) > Seems fine. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 04/25] avframe: switch to the new channel layout API
On 6/29/17 12:10 AM, Vittorio Giovara wrote: > From: Anton Khirnov> > Signed-off-by: Vittorio Giovara > --- > libavcodec/decode.c | 67 > libavcodec/encode.c | 9 ++ > libavutil/frame.c | 88 > +++-- > libavutil/frame.h | 12 +++- > 4 files changed, 146 insertions(+), 30 deletions(-) > Seems fine. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 03/25] lavc: deprecate channel count/layout changing side data
On 6/29/17 12:10 AM, Vittorio Giovara wrote: > From: Anton Khirnov> > They are incompatible with the new channel layout scheme and no decoder > uses them. > > Signed-off-by: Vittorio Giovara > --- > libavcodec/avcodec.h | 5 + > libavcodec/decode.c | 4 > libavformat/dump.c | 9 - > libavformat/utils.c | 9 + > 4 files changed, 26 insertions(+), 1 deletion(-) > Seems ok, if/when we need the functionality we can introduce something later. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] bitstream read_vlc inline and vorbis example
On 5/21/17 5:47 PM, Luca Barbato wrote: > Order changed and content as Anton asked. > Ping. I'd like to at least have vorbis and flac merged. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/9] cinepakenc: fixes and improvements
On 6/28/17 12:27 AM, Diego Biurrun wrote: > From: "addr-see-the-webs...@aetey.se"> > Fixed/improved multistrip adaptivity. > Improved R/D by optimized codebook generation. > Support for the correct color space. > Vintage compatibility. > > Signed-off-by: Diego Biurrun > --- > libavcodec/cinepakenc.c | 868 > +--- > 1 file changed, 674 insertions(+), 194 deletions(-) This patch and all the other should be flatten in a single one in the end or it should be split in many otherwise it is doing lots of different things and few of them get undone and/or removed later in the set if I read it correctly. What remains is probably fine. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/9] Adding Cinepak encoder
On Mon, Jul 03, 2017 at 08:20:20PM +0200, Luca Barbato wrote: > On 6/28/17 12:27 AM, Diego Biurrun wrote: > > +av_log(avctx, AV_LOG_INFO, "strip coding stats: %i V1 mode, %i V4 > > mode, %i MC mode (%i V1 encs, %i V4 encs, %i skips)\n", > > +s->num_v1_mode, s->num_v4_mode, s->num_mc_mode, s->num_v1_encs, > > s->num_v4_encs, s->num_skips); > > This should be verbose. This is put under #if CINEPAKENC_DEBUG in 2/9 and dropped together with the rest of the debug code in 4/9, so I won't bother. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel