Re: [libav-devel] [PATCH] Add support for CUVID decode
On 10/27/2016 8:58 AM, Ruta Gadkari wrote: > From 31f2ef09647f120f3ad245db0ad4f5339171ff57 Mon Sep 17 00:00:00 2001 > From: rgadkari_test > Date: Thu, 27 Oct 2016 16:35:59 +0530 > Subject: [PATCH 1/1] CUVID: Add support for CUVID decode > > --- > configure | 53 +++ > libavcodec/Makefile| 5 + > libavcodec/allcodecs.c | 20 ++ > libavcodec/cuvid.c | 917 > + > 4 files changed, 995 insertions(+) > create mode 100644 libavcodec/cuvid.c > > diff --git a/configure b/configure > index c7185e3..2412625 100755 > --- a/configure > +++ b/configure > @@ -234,6 +234,7 @@ External library support: > >The following libraries provide various hardware acceleration features: >--enable-cudaNvidia CUDA (dynamically linked) > + --enable-cuvid enable CUVID support [autodetect] >--enable-d3d11va Microsoft Direct3D 11 video acceleration [auto] >--enable-dxva2 Microsoft DirectX 9 video acceleration [auto] >--enable-libmfx Intel MediaSDK (AKA Quick Sync Video) > @@ -1223,6 +1224,7 @@ HWACCEL_LIBRARY_NONFREE_LIST=" > " > HWACCEL_LIBRARY_LIST=" > $HWACCEL_LIBRARY_NONFREE_LIST > +cuvid > d3d11va > dxva2 > libmfx > @@ -2118,6 +2120,7 @@ zmbv_decoder_deps="zlib" > zmbv_encoder_deps="zlib" > > # hardware accelerators > +cuvid_deps="cuda" > d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder" > dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode" > vaapi_deps="va_va_h" > @@ -2125,8 +2128,10 @@ vda_deps="VideoDecodeAcceleration_VDADecoder_h > pthreads" > vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration > -framework QuartzCore" > vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h" > > +h263_cuvid_hwaccel_deps="cuda cuvid CUVIDMPEG4PICPARAMS" See https://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=21b68cdbae6576bb58c19dd44c0669293f7d05d1 Unless you found out how to make it work in this patch, it would appear h263 is not supported by cuvid. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCHv3] arm: vp9: Add NEON optimizations of VP9 MC functions
On 2016-10-19 22:18:43 +0300, Martin Storsjö wrote: > This work is sponsored by, and copyright, Google. > > The filter coefficients are signed values, where the product of the > multiplication with one individual filter coefficient doesn't > overflow a 16 bit signed value (the largest filter coefficient is > 127). But when the products are accumulated, the resulting sum can > overflow the 16 bit signed range. Instead of accumulating in 32 bit, > we accumulate all filter taps but the largest one in one register, and > the largest one (either index 3 or 4) in a separate one, added with > saturation afterwards. "Instead of ..., we accumulate the largest product (either index 3 or 4) last with a saturated addition." Is shorter and easier to understand. ... > --- > libavcodec/arm/Makefile | 2 + > libavcodec/arm/vp9dsp_init_arm.c | 140 +++ > libavcodec/arm/vp9mc_neon.S | 787 > +++ > libavcodec/vp9.h | 4 +- > libavcodec/vp9block.c| 10 +- > libavcodec/vp9dsp.c | 2 + > 6 files changed, 942 insertions(+), 3 deletions(-) > create mode 100644 libavcodec/arm/vp9dsp_init_arm.c > create mode 100644 libavcodec/arm/vp9mc_neon.S > > diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile > index bd4dd4e..2638230 100644 > --- a/libavcodec/arm/Makefile > +++ b/libavcodec/arm/Makefile > @@ -45,6 +45,7 @@ OBJS-$(CONFIG_MLP_DECODER) += > arm/mlpdsp_init_arm.o > OBJS-$(CONFIG_RV40_DECODER)+= arm/rv40dsp_init_arm.o > OBJS-$(CONFIG_VORBIS_DECODER) += arm/vorbisdsp_init_arm.o > OBJS-$(CONFIG_VP6_DECODER) += arm/vp6dsp_init_arm.o > +OBJS-$(CONFIG_VP9_DECODER) += arm/vp9dsp_init_arm.o > > > # ARMv5 optimizations > @@ -138,3 +139,4 @@ NEON-OBJS-$(CONFIG_RV40_DECODER) += > arm/rv34dsp_neon.o\ >arm/rv40dsp_neon.o > NEON-OBJS-$(CONFIG_VORBIS_DECODER) += arm/vorbisdsp_neon.o > NEON-OBJS-$(CONFIG_VP6_DECODER)+= arm/vp6dsp_neon.o > +NEON-OBJS-$(CONFIG_VP9_DECODER)+= arm/vp9mc_neon.o > diff --git a/libavcodec/arm/vp9dsp_init_arm.c > b/libavcodec/arm/vp9dsp_init_arm.c > new file mode 100644 > index 000..db8c683 > --- /dev/null > +++ b/libavcodec/arm/vp9dsp_init_arm.c > @@ -0,0 +1,140 @@ > +/* > + * Copyright (c) 2016 Google Inc. > + * > + * 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 > + > +#include "libavutil/attributes.h" > +#include "libavutil/arm/cpu.h" > +#include "libavcodec/vp9.h" > + > +#define declare_fpel(type, sz) \ > +void ff_vp9_##type##sz##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ > + const uint8_t *src, ptrdiff_t src_stride, \ > + int h, int mx, int my) > + > +#define declare_copy_avg(sz) \ > +declare_fpel(copy, sz); \ > +declare_fpel(avg , sz) > + > +#define decl_mc_func(op, filter, dir, sz) > \ > +void ff_vp9_##op##_##filter##sz##_##dir##_neon(uint8_t *dst, ptrdiff_t > dst_stride, \ > + const uint8_t *src, ptrdiff_t > src_stride, \ > + int h, int mx, int my) > + > +#define define_8tap_2d_fn(op, filter, sz) > \ > +static void op##_##filter##sz##_hv_neon(uint8_t *dst, ptrdiff_t dst_stride, > \ > +const uint8_t *src, ptrdiff_t > src_stride, \ > +int h, int mx, int my) > \ > +{ > \ > +LOCAL_ALIGNED_16(uint8_t, temp, [72 * 64]); > \ Is there a reason why the temporary array doesn't depend on the size? > +/* We only need h + 7 lines, but the horizontal filter assumes an > \ > + * even number of rows, so filter h + 8 lines here. */ > \ > +ff_vp9_put_##filter##sz##_h_neon(temp, 64, > \ > +
Re: [libav-devel] [PATCH 2/2] svq3: Drop unused function dctcoef_get
On 01/11/2016 17:51, Diego Biurrun wrote: > libavcodec/svq3.c:627:29: warning: unused function 'dctcoef_get' > [-Wunused-function] > --- > libavcodec/svq3.c | 5 - > 1 file changed, 5 deletions(-) > > diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c > index aa85e7c..5165737 100644 > --- a/libavcodec/svq3.c > +++ b/libavcodec/svq3.c > @@ -622,11 +622,6 @@ static av_always_inline void > hl_decode_mb_idct_luma(SVQ3Context *s, > } > } > > -static av_always_inline int dctcoef_get(int16_t *mb, int index) > -{ > -return AV_RN16A(mb + index); > -} > - > static av_always_inline void hl_decode_mb_predict_luma(SVQ3Context *s, > int mb_type, > const int > *block_offset, > Ok. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2] Drop unreachable break and return statements
On 01/11/2016 17:43, Diego Biurrun wrote: > On Mon, Oct 31, 2016 at 10:57:12PM +0100, Luca Barbato wrote: >> On 31/10/2016 22:28, Diego Biurrun wrote: >>> exit_program(1); >>> -return 0; >> >> Some compilers might not like that at all. > > Elaborate. compilers not implementing av_noreturn would just complain complain quite loudly... lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] mov: Detect spherical videos with packet side data
This includes both versions of the spec, XML and mp4 box. Signed-off-by: Vittorio Giovara --- avprobe.c| 20 libavcodec/avcodec.h | 44 libavformat/dump.c | 28 ++ libavformat/isom.h | 4 + libavformat/mov.c| 277 +++ 5 files changed, 373 insertions(+) diff --git a/avprobe.c b/avprobe.c index eff9c0d..474b325 100644 --- a/avprobe.c +++ b/avprobe.c @@ -729,6 +729,7 @@ static void show_stream(InputFile *ifile, InputStream *ist) for (i = 0; i < stream->nb_side_data; i++) { const AVPacketSideData* sd = &stream->side_data[i]; AVStereo3D *stereo; +AVSphericalVideo *spherical; switch (sd->type) { case AV_PKT_DATA_DISPLAYMATRIX: @@ -749,6 +750,25 @@ static void show_stream(InputFile *ifile, InputStream *ist) !!(stereo->flags & AV_STEREO3D_FLAG_INVERT)); probe_object_footer("stereo3d"); break; +case AV_PKT_DATA_SPHERICAL: +spherical = (AVSphericalVideo *)sd->data; +probe_object_header("spherical"); + +if (spherical->type == AV_SPHERICAL_EQUIRECTANGULAR) +probe_str("projection", "equirectangular"); +else if (spherical->type == AV_SPHERICAL_CUBEMAP) +probe_str("projection", "cubemap"); +else if (spherical->type == AV_SPHERICAL_MESH) +probe_str("projection", "mesh"); +else +probe_str("projection", "unknown"); + +probe_int("yaw", spherical->yaw); +probe_int("pitch", spherical->pitch); +probe_int("roll", spherical->roll); + +probe_object_footer("spherical"); +break; } } probe_object_footer("sidedata"); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 88e6c62..c301977 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -702,6 +702,44 @@ enum AVAudioServiceType { AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI }; +/** + * Video surface should be mapped on a sphere, and probably needs additional + * processing before it can be displayed. + */ +enum AVSphericalType { +AV_SPHERICAL_EQUIRECTANGULAR, +AV_SPHERICAL_CUBEMAP, +AV_SPHERICAL_MESH, +AV_SPHERICAL_NB, ///< Not part of ABI +}; + +/** + * @note Size of this struct is not part of ABI. + */ +typedef struct AVSphericalVideo { +/** + * Projection type. + */ +enum AVSphericalType type; + +/** + * Clockwise rotation in degrees around the up vector, [-180.0, 180.0]. + */ +double yaw; + +/** + * Counter-clockwise rotation in degrees around the right vector + * post yaw transform, [-90.0, 90.0]. + */ +double pitch; + + /** + * Counter-clockwise rotation in degrees around the forward vector post + * yaw and pitch transform, [-180.0, 180.0]. + */ +double roll; +} AVSphericalVideo; + /** * @ingroup lavc_encoding */ @@ -1289,6 +1327,12 @@ enum AVPacketSideDataType { * This side data corresponds to the AVCPBProperties struct. */ AV_PKT_DATA_CPB_PROPERTIES, + +/** + * This side data should be associated with a video stream and corresponds + * to the AVSphericalVideo struct. + */ +AV_PKT_DATA_SPHERICAL, }; typedef struct AVPacketSideData { diff --git a/libavformat/dump.c b/libavformat/dump.c index 3b50f5d..61f438f 100644 --- a/libavformat/dump.c +++ b/libavformat/dump.c @@ -306,6 +306,30 @@ static void dump_cpb(void *ctx, AVPacketSideData *sd) cpb->vbv_delay); } +static void dump_spherical(void *ctx, AVPacketSideData *sd) +{ +AVSphericalVideo *spherical = (AVSphericalVideo *)sd->data; + +if (sd->size < sizeof(*spherical)) { +av_log(ctx, AV_LOG_INFO, "invalid data"); +return; +} + +if (spherical->type == AV_SPHERICAL_EQUIRECTANGULAR) +av_log(ctx, AV_LOG_INFO, "equirectangular "); +else if (spherical->type == AV_SPHERICAL_CUBEMAP) +av_log(ctx, AV_LOG_INFO, "cubemap "); +else if (spherical->type == AV_SPHERICAL_MESH) +av_log(ctx, AV_LOG_INFO, "mesh "); +else { +av_log(ctx, AV_LOG_WARNING, "unknown"); +return; +} + +av_log(ctx, AV_LOG_INFO, "(%f/%f/%f) ", + spherical->yaw, spherical->pitch, spherical->roll); +} + static void dump_sidedata(void *ctx, AVStream *st, const char *indent) { int i; @@ -354,6 +378,10 @@ static void dump_sidedata(void *ctx, AVStream *st, const char *indent) av_log(ctx, AV_LOG_INFO, "cpb: "); dump_cpb(ctx, &sd); break; +case AV_PKT_DATA_SPHERICAL: +av_log(ctx, AV_LOG_INFO, "spherical: "); +dump_spherical(ctx, &sd); +break; default: av_
Re: [libav-devel] [PATCH 1/5] intrax8: Have function signature match across declaration and definition
On Tue, 1 Nov 2016, Diego Biurrun wrote: libavcodec/intrax8.c(776) : warning C4028: formal parameter 1 different from declaration --- libavcodec/intrax8.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h index ad172b1..b641538 100644 --- a/libavcodec/intrax8.h +++ b/libavcodec/intrax8.h @@ -105,7 +105,7 @@ void ff_intrax8_common_end(IntraX8Context *w); * @param quant_offset offset away from zero * @param loopfilter enable filter after decoding a block */ -int ff_intrax8_decode_picture(IntraX8Context *w, Picture *pict, +int ff_intrax8_decode_picture(IntraX8Context *const w, Picture *pict, GetBitContext *gb, int *mb_x, int *mb_y, int quant, int halfpq, int loopfilter, int lowdelay); -- 2.1.4 While this probably is ok as a first step, I'd prefer a second step to remove the const here altogether (making this first step skippable as well, if you want to). Having const here is completely useless for a function signature; it's the same as if you'd have "int foo(const int bar);". // Martin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 5/5] float_dsp: Have implementation match function pointer prototype
libavutil/x86/float_dsp_init.c(144) : warning C4028: formal parameter 1 different from declaration libavutil/x86/float_dsp_init.c(144) : warning C4028: formal parameter 2 different from declaration --- libavutil/x86/float_dsp_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/x86/float_dsp_init.c b/libavutil/x86/float_dsp_init.c index b704330..dcbe3f1 100644 --- a/libavutil/x86/float_dsp_init.c +++ b/libavutil/x86/float_dsp_init.c @@ -54,7 +54,7 @@ void ff_vector_fmul_reverse_avx(float *dst, const float *src0, float ff_scalarproduct_float_sse(const float *v1, const float *v2, int order); -void ff_butterflies_float_sse(float *src0, float *src1, int len); +void ff_butterflies_float_sse(float *restrict src0, float *restrict src1, int len); #if HAVE_6REGS && HAVE_INLINE_ASM static void vector_fmul_window_3dnowext(float *dst, const float *src0, -- 2.1.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 1/2] h264_qpel: x86: Move function with only one instance out of template macro
libavcodec/x86/h264_qpel.c:392:785: warning: unused function 'ff_avg_h264_qpel8or16_hv1_lowpass_mmxext' [-Wunused-function] --- libavcodec/x86/h264_qpel.c | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/libavcodec/x86/h264_qpel.c b/libavcodec/x86/h264_qpel.c index 43e150c..7445825 100644 --- a/libavcodec/x86/h264_qpel.c +++ b/libavcodec/x86/h264_qpel.c @@ -75,6 +75,17 @@ void ff_ ## OPNAME ## _pixels8_l2_shift5_mmxext(uint8_t *dst, const int16_t *src DEF_QPEL(avg) DEF_QPEL(put) +static av_always_inline void ff_put_h264_qpel8or16_hv1_lowpass_mmxext(int16_t *tmp, const uint8_t *src, int tmpStride, int srcStride, int size) +{ +int w = (size + 8) >> 2; +src -= 2 * srcStride + 2; +while (w--) { +ff_put_h264_qpel8or16_hv1_lowpass_op_mmxext(src, tmp, srcStride, size); +tmp += 4; +src += 4; +} +} + #define QPEL_H264(OPNAME, OP, MMX)\ static av_always_inline void ff_ ## OPNAME ## h264_qpel4_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, const uint8_t *src, int dstStride, int tmpStride, int srcStride){\ int w=3;\ @@ -95,15 +106,6 @@ static av_always_inline void ff_ ## OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(u dst += 4;\ ff_ ## OPNAME ## h264_qpel8or16_v_lowpass_op_mmxext(dst, src, dstStride, srcStride, h);\ }\ -static av_always_inline void ff_ ## OPNAME ## h264_qpel8or16_hv1_lowpass_ ## MMX(int16_t *tmp, const uint8_t *src, int tmpStride, int srcStride, int size){\ -int w = (size+8)>>2;\ -src -= 2*srcStride+2;\ -while(w--){\ -ff_ ## OPNAME ## h264_qpel8or16_hv1_lowpass_op_mmxext(src, tmp, srcStride, size);\ -tmp += 4;\ -src += 4;\ -}\ -}\ static av_always_inline void ff_ ## OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, int dstStride, int tmpStride, int size){\ int w = size>>4;\ do{\ -- 2.1.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 2/2] svq3: Drop unused function dctcoef_get
libavcodec/svq3.c:627:29: warning: unused function 'dctcoef_get' [-Wunused-function] --- libavcodec/svq3.c | 5 - 1 file changed, 5 deletions(-) diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c index aa85e7c..5165737 100644 --- a/libavcodec/svq3.c +++ b/libavcodec/svq3.c @@ -622,11 +622,6 @@ static av_always_inline void hl_decode_mb_idct_luma(SVQ3Context *s, } } -static av_always_inline int dctcoef_get(int16_t *mb, int index) -{ -return AV_RN16A(mb + index); -} - static av_always_inline void hl_decode_mb_predict_luma(SVQ3Context *s, int mb_type, const int *block_offset, -- 2.1.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 3/5] pixblockdsp: Have function pointer prototype match implementation
libavcodec/pixblockdsp.c(58) : warning C4028: formal parameter 1 different from declaration libavcodec/pixblockdsp.c(63) : warning C4028: formal parameter 1 different from declaration libavcodec/pixblockdsp.c(66) : warning C4028: formal parameter 1 different from declaration --- libavcodec/pixblockdsp.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/pixblockdsp.h b/libavcodec/pixblockdsp.h index e082d2e..910314d 100644 --- a/libavcodec/pixblockdsp.h +++ b/libavcodec/pixblockdsp.h @@ -21,13 +21,15 @@ #include +#include "config.h" + #include "avcodec.h" typedef struct PixblockDSPContext { -void (*get_pixels)(int16_t *block /* align 16 */, +void (*get_pixels)(int16_t *restrict block /* align 16 */, const uint8_t *pixels /* align 8 */, ptrdiff_t stride); -void (*diff_pixels)(int16_t *block /* align 16 */, +void (*diff_pixels)(int16_t *restrict block /* align 16 */, const uint8_t *s1 /* align 8 */, const uint8_t *s2 /* align 8 */, ptrdiff_t stride); -- 2.1.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 1/5] intrax8: Have function signature match across declaration and definition
libavcodec/intrax8.c(776) : warning C4028: formal parameter 1 different from declaration --- libavcodec/intrax8.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h index ad172b1..b641538 100644 --- a/libavcodec/intrax8.h +++ b/libavcodec/intrax8.h @@ -105,7 +105,7 @@ void ff_intrax8_common_end(IntraX8Context *w); * @param quant_offset offset away from zero * @param loopfilter enable filter after decoding a block */ -int ff_intrax8_decode_picture(IntraX8Context *w, Picture *pict, +int ff_intrax8_decode_picture(IntraX8Context *const w, Picture *pict, GetBitContext *gb, int *mb_x, int *mb_y, int quant, int halfpq, int loopfilter, int lowdelay); -- 2.1.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 4/5] dnxhdenc: Have function pointer prototype match implementation
libavcodec/dnxhdenc.c(326) : warning C4028: formal parameter 1 different from declaration libavcodec/dnxhdenc.c(329) : warning C4028: formal parameter 1 different from declaration --- libavcodec/dnxhdenc.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/dnxhdenc.h b/libavcodec/dnxhdenc.h index d3df0e0..c6755f7 100644 --- a/libavcodec/dnxhdenc.h +++ b/libavcodec/dnxhdenc.h @@ -26,6 +26,8 @@ #include +#include "config.h" + #include "mpegvideo.h" #include "dnxhddata.h" @@ -93,8 +95,8 @@ typedef struct DNXHDEncContext { RCCMPEntry *mb_cmp; RCEntry (*mb_rc)[8160]; -void (*get_pixels_8x4_sym)(int16_t * /* align 16 */, - const uint8_t *, ptrdiff_t); +void (*get_pixels_8x4_sym)(int16_t *restrict /* align 16 */ block, + const uint8_t *pixels, ptrdiff_t line_size); } DNXHDEncContext; void ff_dnxhdenc_init_x86(DNXHDEncContext *ctx); -- 2.1.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 2/5] ituh263dec: Have function signature match across declaration and definition
libavcodec/ituh263dec.c(215) : warning C4028: formal parameter 1 different from declaration libavcodec/ituh263dec.c(215) : warning C4028: formal parameter 2 different from declaration --- libavcodec/h263.h | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/h263.h b/libavcodec/h263.h index e3274c1..a5d3860 100644 --- a/libavcodec/h263.h +++ b/libavcodec/h263.h @@ -21,7 +21,11 @@ #define AVCODEC_H263_H #include + +#include "config.h" + #include "libavutil/rational.h" + #include "get_bits.h" #include "mpegvideo.h" #include "h263data.h" @@ -95,7 +99,7 @@ int av_const h263_get_picture_format(int width, int height); void ff_clean_h263_qscales(MpegEncContext *s); int ff_h263_resync(MpegEncContext *s); -const uint8_t *ff_h263_find_resync_marker(const uint8_t *p, const uint8_t *end); +const uint8_t *ff_h263_find_resync_marker(const uint8_t *restrict p, const uint8_t *restrict end); void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code); -- 2.1.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2] Drop unreachable break and return statements
On Mon, Oct 31, 2016 at 10:57:12PM +0100, Luca Barbato wrote: > On 31/10/2016 22:28, Diego Biurrun wrote: > > exit_program(1); > > -return 0; > > Some compilers might not like that at all. Elaborate. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Add support for CUVID decode
On 01/11/2016 12:54, Ruta Gadkari wrote: > Have kept Timo's authorship in copyright on file cuvid.c > Do you mean the "From" in the submitted patch as well? Depending on how much it is changed you can do that or you can mention him in the commit message. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 8/9] Use avpriv_report_missing_feature() where appropriate
On Mon, Oct 31, 2016 at 10:54:47PM +0100, Luca Barbato wrote: > On 27/10/2016 20:54, Diego Biurrun wrote: > > av_log(avctx, AV_LOG_ERROR, "Bitrate not supported, use 6300\n"); > > Probably this one should be converted as well. IIUC only 5300 and 6300 are supported bitrates for G.723. Therefore this error case is not one that will be fixed in the future or when a suitable sample is available. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] hevc: Add HEVC IDCT 4x4 for PPC
>> +static const vector int16_t trans4[4] = { >> +{ 64, 64, 64, 64, 64, 64, 64, 64 }, >> +{ 83, 36, 83, 36, 83, 36, 83, 36 }, >> +{ 64, -64, 64, -64, 64, -64, 64, -64 }, >> +{ 36, -83, 36, -83, 36, -83, 36, -83 }, >> +}; > > This fits in int8_t, is there a reason to have it int16_t? the reason is I need to multiply the vectors of the same type > >> +static const vec_u8 mask[2] = { >> +{ 0x00, 0x01, 0x08, 0x09, 0x10, 0x11, 0x18, 0x19, 0x02, 0x03, 0x0A, >> 0x0B, 0x12, 0x13, 0x1A, 0x1B }, >> +{ 0x04, 0x05, 0x0C, 0x0D, 0x14, 0x15, 0x1C, 0x1D, 0x06, 0x07, 0x0E, >> 0x0F, 0x16, 0x17, 0x1E, 0x1F }, >> +}; > > Where do these tables come from? I would expect them to be shared > across arches. This is permutation mask used by vec_perm and it's specific for this case (which is matrix tranposition). Alexandra ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Add support for CUVID decode
On Tue, Nov 01, 2016 at 11:12:12AM +, Ruta Gadkari wrote: > --- a/configure > +++ b/configure > @@ -234,6 +234,7 @@ External library support: > >The following libraries provide various hardware acceleration features: >--enable-cudaNvidia CUDA (dynamically linked) > + --enable-cuvid enable CUVID support [autodetect] >--enable-d3d11va Microsoft Direct3D 11 video acceleration [auto] >--enable-dxva2 Microsoft DirectX 9 video acceleration [auto] >--enable-libmfx Intel MediaSDK (AKA Quick Sync Video) Look at the other descriptions in that block. You should describe CUVID itself; "enable" and "support" add no meaningful information. > @@ -4563,6 +4597,20 @@ check_type "va/va.h va/va_enc_jpeg.h" > "VAEncPictureParameterBufferJPEG" > > check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC" > > +check_type "cuviddec.h" "CUVIDH264PICPARAMS" > +check_type "cuviddec.h" "CUVIDHEVCPICPARAMS" > +check_type "cuviddec.h" "CUVIDJPEGPICPARAMS" > +check_type "cuviddec.h" "CUVIDMPEG2PICPARAMS" > +check_type "cuviddec.h" "CUVIDMPEG4PICPARAMS" > +check_type "cuviddec.h" "CUVIDVC1PICPARAMS" > +check_type "cuviddec.h" "CUVIDVP8PICPARAMS" > +check_type "cuviddec.h" "CUVIDVP9PICPARAMS" > + > +# Enable CUVID by default if CUDA is enabled > +if enabled cuda && ! disabled cuvid; then > +enable cuvid > +fi I think this enabling logic is completely unnecessary. Doesn't it work without this block? > @@ -4608,6 +4656,8 @@ enabled avisynth && { check_lib > "avisynth/avisynth_c.h windows.h" LoadL > check_lib "avxsynth/avxsynth_c.h dlfcn.h" > dlopen -ldl || > die "ERROR: LoadLibrary/dlopen not found, or > avisynth header not found"; } > enabled cuda && check_lib cuda.h cuInit -lcuda > +enabled cuvid && { require libnvcuvid cuviddec.h > cuvidCreateDecoder -lnvcuvid || > + die "ERROR: CUVID not found"; } You should try this on a system without cuvid or read what the require() function does. Hint: redundant output. > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile As I said before, you do not add all the necessary entries. See also https://www.libav.org/documentation/developer.html#New-codecs-or-formats-checklist Have you tried compiling all the components you add standalone as described in the above link? > --- /dev/null > +++ b/libavcodec/cuvid.c > @@ -0,0 +1,892 @@ > +/* trailing whitespace > +#include "libavutil/buffer.h" > +#include "libavutil/mathematics.h" > +#include "libavutil/hwcontext.h" > +#include "libavutil/hwcontext_cuda.h" > +#include "libavutil/fifo.h" > +#include "libavutil/log.h" > +#include "libavutil/opt.h" > +#include "libavutil/common.h" nit: order > +static int CUDAAPI cuvid_handle_video_sequence(void *opaque, CUVIDEOFORMAT* > format) *format > +if (ctx->cudecoder) { > +av_log(avctx, AV_LOG_ERROR, "re-initializing decoder is not > supported\n"); > +avpriv_report_missing_feature(avctx, "Decoder reinitialization"); Please look up what avpriv_report_missing_feature() actually does and prints. Hint: redundant output. > +ctx->internal_error = AVERROR_INVALIDDATA; For missing features we usually employ PATCHWELCOME. > +if (hwframe_ctx->pool && ( That '(' does not belong at the end of the line but at the beginning of the next line. > +if (format->chroma_format != cudaVideoChromaFormat_420) { > +av_log(avctx, AV_LOG_ERROR, "Chroma formats other than 420 are not > supported\n"); > +avpriv_report_missing_feature(avctx, "Chroma formats other than > 420"); > +ctx->internal_error = AVERROR_INVALIDDATA; see above > +static int CUDAAPI cuvid_handle_picture_decode(void *opaque, CUVIDPICPARAMS* > picparams) *picparams > +static int CUDAAPI cuvid_handle_picture_display(void *opaque, > CUVIDPARSERDISPINFO* dispinfo) *dispinfo > +static int cuvid_decode_packet(AVCodecContext *avctx, const AVPacket *avpkt) > +{ > +if (ctx->bsf && avpkt && avpkt->size) { > +if ((ret = av_packet_ref(&filter_packet, avpkt)) < 0) { > +av_log(avctx, AV_LOG_ERROR, "av_packet_ref failed\n"); > +return ret; > +} > + > +if ((ret = av_bsf_send_packet(ctx->bsf, &filter_packet)) < 0) { > +av_log(avctx, AV_LOG_ERROR, "av_bsf_send_packet failed\n"); > +av_packet_unref(&filter_packet); > +return ret; > +} > + > +if ((ret = av_bsf_receive_packet(ctx->bsf, &filtered_packet)) < 0) { > +av_log(avctx, AV_LOG_ERROR, "av_bsf_receive_packet failed\n"); > +return ret; > +} Don't you need to unref the packet in the third error case as well? > +static av_cold int cuvid_decode_init(AVCodecContext *avctx) > +{ > + > +switch (avctx->codec->id) { > +#if CONFIG_VP8_CUVID_DECODER > +case AV_CODEC_ID_VP8: > +ctx->cuparseinfo.CodecType = cudaVideoC
Re: [libav-devel] [PATCH] hevc: Add HEVC IDCT 4x4 for PPC
On Tue, Nov 01, 2016 at 09:37:50AM +0100, Alexandra Hájková wrote: > From: Alexandra Hajkova Your name lost some accents here.. > --- > libavcodec/hevcdsp.c | 2 + > libavcodec/hevcdsp.h | 1 + > libavcodec/ppc/Makefile | 1 + > libavcodec/ppc/hevcdsp_ppc.c | 111 > ++ > libavcodec/ppc/hevcdsp_template.c | 52 ++ > 5 files changed, 167 insertions(+) > create mode 100644 libavcodec/ppc/hevcdsp_ppc.c > create mode 100644 libavcodec/ppc/hevcdsp_template.c > > --- a/libavcodec/hevcdsp.c > +++ b/libavcodec/hevcdsp.c > @@ -247,4 +247,6 @@ void ff_hevc_dsp_init(HEVCDSPContext *hevcdsp, int > bit_depth) > > if (ARCH_X86) > ff_hevc_dsp_init_x86(hevcdsp, bit_depth); > +if (ARCH_PPC) > +ff_hevc_dsp_init_altivec(hevcdsp, bit_depth); order Look at how other such init functions are named. > --- a/libavcodec/hevcdsp.h > +++ b/libavcodec/hevcdsp.h > @@ -116,6 +116,7 @@ typedef struct HEVCDSPContext { > void ff_hevc_dsp_init(HEVCDSPContext *hpc, int bit_depth); > > void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth); > +void ff_hevc_dsp_init_altivec(HEVCDSPContext *c, const int bit_depth); order > --- /dev/null > +++ b/libavcodec/ppc/hevcdsp_ppc.c > @@ -0,0 +1,111 @@ > + > +/* > + * Copyright (c) Alexandra Hajkova stray empty line > +static const vector int16_t trans4[4] = { > +{ 64, 64, 64, 64, 64, 64, 64, 64 }, > +{ 83, 36, 83, 36, 83, 36, 83, 36 }, > +{ 64, -64, 64, -64, 64, -64, 64, -64 }, > +{ 36, -83, 36, -83, 36, -83, 36, -83 }, > +}; This fits in int8_t, is there a reason to have it int16_t? > +static const vec_u8 mask[2] = { > +{ 0x00, 0x01, 0x08, 0x09, 0x10, 0x11, 0x18, 0x19, 0x02, 0x03, 0x0A, > 0x0B, 0x12, 0x13, 0x1A, 0x1B }, > +{ 0x04, 0x05, 0x0C, 0x0D, 0x14, 0x15, 0x1C, 0x1D, 0x06, 0x07, 0x0E, > 0x0F, 0x16, 0x17, 0x1E, 0x1F }, > +}; Where do these tables come from? I would expect them to be shared across arches. > +#if HAVE_ALTIVEC > +static void transform4x4(vector int16_t src_01, vector int16_t src_23, > + vector int32_t res[4], const int shift, int16_t > *coeffs) long line > +// if is not used by the other transform This sentence lacks a proper subject and is therefore confusing. > +av_cold void ff_hevc_dsp_init_altivec(HEVCDSPContext *c, const int bit_depth) > +{ > +#undef FUNC > +#define FUNC(a, bit_depth) a ## _ ## bit_depth This macro seems pretty pointless. It adds one level of indirection and makes the expression longer. > +#if HAVE_ALTIVEC What about endianness? > --- /dev/null > +++ b/libavcodec/ppc/hevcdsp_template.c > @@ -0,0 +1,52 @@ > + > +#include "libavcodec/bit_depth_template.c" > + > +#if HAVE_ALTIVEC Moving this ifdef out of the template seems simpler and is how the other template files are handled. > +static void FUNC(ff_hevc_idct_4x4)(int16_t *coeffs, int col_limit) > +{ > +const int shift = 7; > +const int shift2 = 20 - BIT_DEPTH; > +vector int16_t src_01, src_23; > +vector int32_t res[4]; > +vector int16_t res_packed[2]; > + > +src_01 = vec_ld(0, (short *) coeffs); > +src_23 = vec_ld(16, (short *) coeffs); Is the cast required? Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Add support for CUVID decode
> Looks like your Git is misconfigured. Corrected my Git config in the new patch. > Also, this is an implementation written by Timo Rothenspieler for ffmpeg, so > keeping authorship alive would surely be appreciated. Have kept Timo's authorship in copyright on file cuvid.c Do you mean the "From" in the submitted patch as well? - Hendrik ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel --- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. --- ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Add support for CUVID decode
On Tue, Nov 01, 2016 at 11:15:55AM +, Ruta Gadkari wrote: > Thanks for your review. > I have updated the patch and taken care of all the review comments and sent a > new patch for review. What about Hendrik's question/comment? Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Add support for CUVID decode
Thanks for your review. I have updated the patch and taken care of all the review comments and sent a new patch for review. Regards Ruta --- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. --- ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] Add support for CUVID decode
Patch to add support for hardware accelerated CUVID decode in Libav. Thanks Ruta --- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. --- 0001-CUVID-Add-support-for-CUVID-decode.patch Description: 0001-CUVID-Add-support-for-CUVID-decode.patch ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 3/7] lavfi: Always propagate hw_frames_ctx through links
On 01/11/16 09:29, Anton Khirnov wrote: > Quoting Mark Thompson (2016-11-01 00:40:55) >> Also adds a new flag to mark filters which are aware of hwframes and >> will perform this task themselves. >> >> This is required to allow software-mapped hardware frames to work, >> because we need to have the frames context available for any later >> mapping operation in the filter graph. >> >> The output from the filter graph should only propagate further to an >> encoder if the hardware format actually matches the visible format >> (mapped frames are valid here and have an hw_frames_ctx, but this >> should not be given to the encoder as its hardware context). >> --- >> Does this new flag need to go in APIchanges, and what version bump does it >> need? It's not a public field, but the layout of AVFilter has been changed >> by adding it. > > No, that part of AVFilter is not public so changing anything there is ok > without any bumps. > >> >> (Bikeshed décor choices welcome wrt naming / location.) >> >> avconv.c | 5 - >> libavfilter/avfilter.c | 13 - >> libavfilter/avfilter.h | 2 ++ >> libavfilter/internal.h | 6 ++ >> 4 files changed, 20 insertions(+), 6 deletions(-) >> >> diff --git a/avconv.c b/avconv.c >> index 0b75cbe..776f5d8 100644 >> --- a/avconv.c >> +++ b/avconv.c >> @@ -38,6 +38,7 @@ >> #include "libavutil/parseutils.h" >> #include "libavutil/samplefmt.h" >> #include "libavutil/fifo.h" >> +#include "libavutil/hwcontext.h" >> #include "libavutil/internal.h" >> #include "libavutil/intreadwrite.h" >> #include "libavutil/dict.h" >> @@ -2046,7 +2047,9 @@ static int init_output_stream(OutputStream *ost, char >> *error, int error_len) >> if (!av_dict_get(ost->encoder_opts, "threads", NULL, 0)) >> av_dict_set(&ost->encoder_opts, "threads", "auto", 0); >> >> -if (ost->filter && ost->filter->filter->inputs[0]->hw_frames_ctx) { >> +if (ost->filter && ost->filter->filter->inputs[0]->hw_frames_ctx && >> + >> ((AVHWFramesContext*)ost->filter->filter->inputs[0]->hw_frames_ctx->data)->format >> == >> +ost->filter->filter->inputs[0]->format) { >> ost->enc_ctx->hw_frames_ctx = >> av_buffer_ref(ost->filter->filter->inputs[0]->hw_frames_ctx); >> if (!ost->enc_ctx->hw_frames_ctx) >> return AVERROR(ENOMEM); >> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c >> index 1cedb15..55015a8 100644 >> --- a/libavfilter/avfilter.c >> +++ b/libavfilter/avfilter.c >> @@ -212,11 +212,14 @@ int avfilter_config_links(AVFilterContext *filter) >> } >> >> if (link->src->nb_inputs && link->src->inputs[0]->hw_frames_ctx >> && >> -!link->hw_frames_ctx) { >> -AVHWFramesContext *input_ctx = >> (AVHWFramesContext*)link->src->inputs[0]->hw_frames_ctx->data; >> - >> -if (input_ctx->format == link->format) { >> -link->hw_frames_ctx = >> av_buffer_ref(link->src->inputs[0]->hw_frames_ctx); >> +!(link->src->filter->flags_internal & >> + FF_FILTER_FLAG_HWFRAME_AWARE)) { >> +if (link->hw_frames_ctx) { >> +av_log(link->src, AV_LOG_WARNING, "hw_frames_ctx " >> + "unexpectedly set by non-hwframe-aware >> filter?\n"); > > This should probably return an error. Or it might possibly be an assert. I initially wrote it as an assert, but that broke intermediate states so it became a warning. If it's squashed with the following patch as you suggest then that concern is removed, so I'll change it to an assert. av_assert0(!link->hw_frames_ctx && "should not be set by non-hwframe-aware filter"); >> +} else { >> +link->hw_frames_ctx = >> +av_buffer_ref(link->src->inputs[0]->hw_frames_ctx); >> if (!link->hw_frames_ctx) >> return AVERROR(ENOMEM); >> } >> diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h >> index a17b2a2..568480d 100644 >> --- a/libavfilter/avfilter.h >> +++ b/libavfilter/avfilter.h >> @@ -244,6 +244,8 @@ typedef struct AVFilter { >> >> int priv_size; ///< size of private data to allocate for the filter >> >> +int flags_internal; ///< Additional flags for avfilter internal use >> only. >> + >> /** >> * Used by the filter registration system. Must not be touched by any >> other >> * code. >> diff --git a/libavfilter/internal.h b/libavfilter/internal.h >> index 202c2c0..417d289 100644 >> --- a/libavfilter/internal.h >> +++ b/libavfilter/internal.h >> @@ -220,4 +220,10 @@ AVFilterContext *ff_filter_alloc(const AVFilter >> *filter, const char *inst_name); >> */ >> void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext >> *filter); >> >> +/** >> + * The filter is aware of hardware frames, and the hardware frame c
Re: [libav-devel] [PATCH 3/7] lavfi: Always propagate hw_frames_ctx through links
On 01/11/2016 00:40, Mark Thompson wrote: > ((AVHWFramesContext*)ost->filter->filter->inputs[0]->hw_frames_ctx->data)->format > == > +ost->filter->filter->inputs[0]->format This will be sort of common, probably could be hidden in a function. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 3/3] configure: Allow detecting and using LLVM lld-link as linker for windows
On 01/11/2016 08:31, Martin Storsjö wrote: > On Tue, 9 Aug 2016, Martin Storsjö wrote: > >> It should be something like this: >> >> - Build a recent trunk version (the last fixes were merged a few days >> ago) - I'm using these versions: >> - llvm 380a420a69bfe1198143f0cef0c0c30f51e7d5b3 >> - clang 20ac821dee568d0293fc7efee414aa1b961b5142 >> - lld 003757eef4ea1d5c1769e4077dd11a3d3db03034 > > For the record, the current versions of today (SVN rev 285649) also work > well: > - llvm f185e91e2bc8a41efad3da70d7a40fb34e2ea3f5 > - clang e30072cab95f2538755e30383349e91e20750eca > - lld f5fb6495913ce3c38a18207c568beb6d40f653c4 > > This version gets rid of the need to manually build compiler-rt and add > it via --extra-libs or --extra-ldflags; now it relies only on what the > msvc libs provide. > > I've updated my fate instance for clang/llvm 4.0 to use these versions now. > Sounds nice. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 5/7] hwcontext: Hardware frame mapping
Quoting Mark Thompson (2016-11-01 00:43:03) > struct AVHWDeviceInternal { > const HWContextType *hw_type; > void*priv; > + > +// For derived devices, the device it was derived from. > +AVBufferRef *source_device; This is unused for now. No more comments from me. -- Anton Khirnov ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 4/7] lavfi: Mark all hwframe-aware filters
Quoting Mark Thompson (2016-11-01 00:41:28) > --- > libavfilter/vf_deinterlace_qsv.c | 2 ++ > libavfilter/vf_hwdownload.c | 1 + > libavfilter/vf_hwupload.c| 1 + > libavfilter/vf_hwupload_cuda.c | 2 ++ > libavfilter/vf_scale_npp.c | 2 ++ > libavfilter/vf_scale_qsv.c | 2 ++ > libavfilter/vf_scale_vaapi.c | 1 + > 7 files changed, 11 insertions(+) I'd rather squash this into the previous patch. Otherwise ok. -- Anton Khirnov ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 3/7] lavfi: Always propagate hw_frames_ctx through links
Quoting Mark Thompson (2016-11-01 00:40:55) > Also adds a new flag to mark filters which are aware of hwframes and > will perform this task themselves. > > This is required to allow software-mapped hardware frames to work, > because we need to have the frames context available for any later > mapping operation in the filter graph. > > The output from the filter graph should only propagate further to an > encoder if the hardware format actually matches the visible format > (mapped frames are valid here and have an hw_frames_ctx, but this > should not be given to the encoder as its hardware context). > --- > Does this new flag need to go in APIchanges, and what version bump does it > need? It's not a public field, but the layout of AVFilter has been changed > by adding it. No, that part of AVFilter is not public so changing anything there is ok without any bumps. > > (Bikeshed décor choices welcome wrt naming / location.) > > avconv.c | 5 - > libavfilter/avfilter.c | 13 - > libavfilter/avfilter.h | 2 ++ > libavfilter/internal.h | 6 ++ > 4 files changed, 20 insertions(+), 6 deletions(-) > > diff --git a/avconv.c b/avconv.c > index 0b75cbe..776f5d8 100644 > --- a/avconv.c > +++ b/avconv.c > @@ -38,6 +38,7 @@ > #include "libavutil/parseutils.h" > #include "libavutil/samplefmt.h" > #include "libavutil/fifo.h" > +#include "libavutil/hwcontext.h" > #include "libavutil/internal.h" > #include "libavutil/intreadwrite.h" > #include "libavutil/dict.h" > @@ -2046,7 +2047,9 @@ static int init_output_stream(OutputStream *ost, char > *error, int error_len) > if (!av_dict_get(ost->encoder_opts, "threads", NULL, 0)) > av_dict_set(&ost->encoder_opts, "threads", "auto", 0); > > -if (ost->filter && ost->filter->filter->inputs[0]->hw_frames_ctx) { > +if (ost->filter && ost->filter->filter->inputs[0]->hw_frames_ctx && > + > ((AVHWFramesContext*)ost->filter->filter->inputs[0]->hw_frames_ctx->data)->format > == > +ost->filter->filter->inputs[0]->format) { > ost->enc_ctx->hw_frames_ctx = > av_buffer_ref(ost->filter->filter->inputs[0]->hw_frames_ctx); > if (!ost->enc_ctx->hw_frames_ctx) > return AVERROR(ENOMEM); > diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c > index 1cedb15..55015a8 100644 > --- a/libavfilter/avfilter.c > +++ b/libavfilter/avfilter.c > @@ -212,11 +212,14 @@ int avfilter_config_links(AVFilterContext *filter) > } > > if (link->src->nb_inputs && link->src->inputs[0]->hw_frames_ctx > && > -!link->hw_frames_ctx) { > -AVHWFramesContext *input_ctx = > (AVHWFramesContext*)link->src->inputs[0]->hw_frames_ctx->data; > - > -if (input_ctx->format == link->format) { > -link->hw_frames_ctx = > av_buffer_ref(link->src->inputs[0]->hw_frames_ctx); > +!(link->src->filter->flags_internal & > + FF_FILTER_FLAG_HWFRAME_AWARE)) { > +if (link->hw_frames_ctx) { > +av_log(link->src, AV_LOG_WARNING, "hw_frames_ctx " > + "unexpectedly set by non-hwframe-aware > filter?\n"); This should probably return an error. Or it might possibly be an assert. > +} else { > +link->hw_frames_ctx = > +av_buffer_ref(link->src->inputs[0]->hw_frames_ctx); > if (!link->hw_frames_ctx) > return AVERROR(ENOMEM); > } > diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h > index a17b2a2..568480d 100644 > --- a/libavfilter/avfilter.h > +++ b/libavfilter/avfilter.h > @@ -244,6 +244,8 @@ typedef struct AVFilter { > > int priv_size; ///< size of private data to allocate for the filter > > +int flags_internal; ///< Additional flags for avfilter internal use only. > + > /** > * Used by the filter registration system. Must not be touched by any > other > * code. > diff --git a/libavfilter/internal.h b/libavfilter/internal.h > index 202c2c0..417d289 100644 > --- a/libavfilter/internal.h > +++ b/libavfilter/internal.h > @@ -220,4 +220,10 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, > const char *inst_name); > */ > void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext > *filter); > > +/** > + * The filter is aware of hardware frames, and the hardware frame contexts > + * should not be automatically propagated through it. > + */ > +#define FF_FILTER_FLAG_HWFRAME_AWARE (1 << 0) > + > #endif /* AVFILTER_INTERNAL_H */ > -- > 2.10.1 Looks fine otherwise. -- Anton Khirnov ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/7] lavfi: Use ff_get_video_buffer in all filters using hwframes
Quoting Mark Thompson (2016-11-01 00:37:19) > --- > Using the change in the previous patch. > > Not tested with cuda or qsv - vf_scale_npp wants it too, but that change > would be more than a trivial replacement so it would be better if someone who > could build/test it does it. > > libavfilter/vf_deinterlace_qsv.c | 10 -- > libavfilter/vf_hwupload.c| 9 ++--- > libavfilter/vf_hwupload_cuda.c | 6 +- > libavfilter/vf_scale_qsv.c | 6 +- > libavfilter/vf_scale_vaapi.c | 11 +++ > 5 files changed, 11 insertions(+), 31 deletions(-) Looks ok. I'll put the missing filters on my todo list. -- Anton Khirnov ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/7] lavfi: Make default get_video_buffer work with hardware frames
Quoting Mark Thompson (2016-11-01 00:34:47) > --- > Same as discussed earlier on IRC. > > libavfilter/video.c | 14 ++ > 1 file changed, 10 insertions(+), 4 deletions(-) LGTM -- Anton Khirnov ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] hevc: Add HEVC IDCT 4x4 for PPC
From: Alexandra Hajkova --- libavcodec/hevcdsp.c | 2 + libavcodec/hevcdsp.h | 1 + libavcodec/ppc/Makefile | 1 + libavcodec/ppc/hevcdsp_ppc.c | 111 ++ libavcodec/ppc/hevcdsp_template.c | 52 ++ 5 files changed, 167 insertions(+) create mode 100644 libavcodec/ppc/hevcdsp_ppc.c create mode 100644 libavcodec/ppc/hevcdsp_template.c diff --git a/libavcodec/hevcdsp.c b/libavcodec/hevcdsp.c index 7c19198..e370254 100644 --- a/libavcodec/hevcdsp.c +++ b/libavcodec/hevcdsp.c @@ -247,4 +247,6 @@ void ff_hevc_dsp_init(HEVCDSPContext *hevcdsp, int bit_depth) if (ARCH_X86) ff_hevc_dsp_init_x86(hevcdsp, bit_depth); +if (ARCH_PPC) +ff_hevc_dsp_init_altivec(hevcdsp, bit_depth); } diff --git a/libavcodec/hevcdsp.h b/libavcodec/hevcdsp.h index 49cb711..d50551a 100644 --- a/libavcodec/hevcdsp.h +++ b/libavcodec/hevcdsp.h @@ -116,6 +116,7 @@ typedef struct HEVCDSPContext { void ff_hevc_dsp_init(HEVCDSPContext *hpc, int bit_depth); void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth); +void ff_hevc_dsp_init_altivec(HEVCDSPContext *c, const int bit_depth); extern const int16_t ff_hevc_epel_coeffs[7][16]; extern const int8_t ff_hevc_epel_coeffs8[7][16]; diff --git a/libavcodec/ppc/Makefile b/libavcodec/ppc/Makefile index 09eabcb..1c71df6 100644 --- a/libavcodec/ppc/Makefile +++ b/libavcodec/ppc/Makefile @@ -25,6 +25,7 @@ OBJS-$(CONFIG_VP8DSP) += ppc/vp8dsp_altivec.o # decoders/encoders OBJS-$(CONFIG_APE_DECODER) += ppc/apedsp_altivec.o +OBJS-$(CONFIG_HEVC_DECODER)+= ppc/hevcdsp_ppc.o OBJS-$(CONFIG_SVQ1_ENCODER)+= ppc/svq1enc_altivec.o OBJS-$(CONFIG_VORBIS_DECODER) += ppc/vorbisdsp_altivec.o OBJS-$(CONFIG_VP7_DECODER) += ppc/vp8dsp_altivec.o diff --git a/libavcodec/ppc/hevcdsp_ppc.c b/libavcodec/ppc/hevcdsp_ppc.c new file mode 100644 index 000..a2cb25a --- /dev/null +++ b/libavcodec/ppc/hevcdsp_ppc.c @@ -0,0 +1,111 @@ + +/* + * Copyright (c) Alexandra Hajkova + * + * 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 "config.h" +#if HAVE_ALTIVEC_H +#include +#undef pixel +#endif + +#include "libavutil/cpu.h" +#include "libavutil/ppc/cpu.h" +#include "libavutil/ppc/types_altivec.h" +#include "libavutil/ppc/util_altivec.h" + +#include "libavcodec/hevcdsp.h" + +static const vector int16_t trans4[4] = { +{ 64, 64, 64, 64, 64, 64, 64, 64 }, +{ 83, 36, 83, 36, 83, 36, 83, 36 }, +{ 64, -64, 64, -64, 64, -64, 64, -64 }, +{ 36, -83, 36, -83, 36, -83, 36, -83 }, +}; + +static const vec_u8 mask[2] = { +{ 0x00, 0x01, 0x08, 0x09, 0x10, 0x11, 0x18, 0x19, 0x02, 0x03, 0x0A, 0x0B, 0x12, 0x13, 0x1A, 0x1B }, +{ 0x04, 0x05, 0x0C, 0x0D, 0x14, 0x15, 0x1C, 0x1D, 0x06, 0x07, 0x0E, 0x0F, 0x16, 0x17, 0x1E, 0x1F }, +}; + +#if HAVE_ALTIVEC +static void transform4x4(vector int16_t src_01, vector int16_t src_23, + vector int32_t res[4], const int shift, int16_t *coeffs) +{ +vector int16_t src_02, src_13; +vector int32_t zero = vec_splat_s32(0); +vector int32_t e0, o0, e1, o1; +vector int32_t add; + +src_13 = vec_mergel(src_01, src_23); +src_02 = vec_mergeh(src_01, src_23); + +e0 = vec_msums(src_02, trans4[0], zero); +o0 = vec_msums(src_13, trans4[1], zero); +e1 = vec_msums(src_02, trans4[2], zero); +o1 = vec_msums(src_13, trans4[3], zero); + +// if is not used by the other transform +add = vec_sl(vec_splat_s32(1), vec_splat_u32(shift - 1)); +e0 = vec_add(e0, add); +e1 = vec_add(e1, add); + +res[0] = vec_add(e0, o0); +res[1] = vec_add(e1, o1); +res[2] = vec_sub(e1, o1); +res[3] = vec_sub(e0, o0); +} + +static void scale(vector int32_t res[4], vector int16_t res_packed[2], int shift) +{ +int i; +vector unsigned int v_shift = vec_splat_u32(shift); + +for (i = 0; i < 4; i++) +res[i] = vec_sra(res[i], v_shift); + +// clip16 +res_packed[0] = vec_packs(res[0], res[1]); +res_packed[1] = vec_packs(res[2], res[3]); +} +#endif /* HAVE_ALTIVEC */ + +#define BIT_DEPTH 8 +#include "libavcodec/ppc/hevcdsp_template.c" +#undef BIT_DEPTH + +#define BIT_DEPTH 1
Re: [libav-devel] [PATCH 3/3] configure: Allow detecting and using LLVM lld-link as linker for windows
On Tue, 9 Aug 2016, Martin Storsjö wrote: It should be something like this: - Build a recent trunk version (the last fixes were merged a few days ago) - I'm using these versions: - llvm 380a420a69bfe1198143f0cef0c0c30f51e7d5b3 - clang 20ac821dee568d0293fc7efee414aa1b961b5142 - lld 003757eef4ea1d5c1769e4077dd11a3d3db03034 For the record, the current versions of today (SVN rev 285649) also work well: - llvm f185e91e2bc8a41efad3da70d7a40fb34e2ea3f5 - clang e30072cab95f2538755e30383349e91e20750eca - lld f5fb6495913ce3c38a18207c568beb6d40f653c4 This version gets rid of the need to manually build compiler-rt and add it via --extra-libs or --extra-ldflags; now it relies only on what the msvc libs provide. I've updated my fate instance for clang/llvm 4.0 to use these versions now. // Martin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel