[FFmpeg-devel] [PATCH] libavfilter/vf_avgblur_opencl.c: add openCL version of libavfilter/vf_avgblur.c filter
[master 319e56f87c] lavfi: Add OpenCL avgblur filter 6 files changed, 381 insertions(+) create mode 100644 libavfilter/opencl/avgblur.cl create mode 100644 libavfilter/vf_avgblur_opencl.c diff --git a/configure b/configure index fe81ba31b5..203737615c 100755 --- a/configure +++ b/configure @@ -3205,6 +3205,7 @@ aresample_filter_deps="swresample" ass_filter_deps="libass" atempo_filter_deps="avcodec" atempo_filter_select="rdft" +avgblur_opencl_filter_deps="opencl" azmq_filter_deps="libzmq" blackframe_filter_deps="gpl" boxblur_filter_deps="gpl" diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 6a6083618d..6bf32ad260 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -138,6 +138,8 @@ OBJS-$(CONFIG_ALPHAMERGE_FILTER) += vf_alphamerge.o OBJS-$(CONFIG_ASS_FILTER)+= vf_subtitles.o OBJS-$(CONFIG_ATADENOISE_FILTER) += vf_atadenoise.o OBJS-$(CONFIG_AVGBLUR_FILTER)+= vf_avgblur.o +OBJS-$(CONFIG_AVGBLUR_OPENCL_FILTER) += vf_avgblur_opencl.o opencl.o \ +opencl/avgblur.o OBJS-$(CONFIG_BBOX_FILTER) += bbox.o vf_bbox.o OBJS-$(CONFIG_BENCH_FILTER) += f_bench.o OBJS-$(CONFIG_BITPLANENOISE_FILTER) += vf_bitplanenoise.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 9adb1090b7..cb04d1b113 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -148,6 +148,7 @@ static void register_all(void) REGISTER_FILTER(ASS,ass,vf); REGISTER_FILTER(ATADENOISE, atadenoise, vf); REGISTER_FILTER(AVGBLUR,avgblur,vf); +REGISTER_FILTER(AVGBLUR_OPENCL, avgblur_opencl, vf); REGISTER_FILTER(BBOX, bbox, vf); REGISTER_FILTER(BENCH, bench, vf); REGISTER_FILTER(BITPLANENOISE, bitplanenoise, vf); diff --git a/libavfilter/opencl/avgblur.cl b/libavfilter/opencl/avgblur.cl new file mode 100644 index 00..fff655529b --- /dev/null +++ b/libavfilter/opencl/avgblur.cl @@ -0,0 +1,60 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg 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. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +__kernel void avgblur_horiz(__write_only image2d_t dst, +__read_only image2d_t src, +int rad) +{ +const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE | + CLK_FILTER_NEAREST); +int2 loc = (int2)(get_global_id(0), get_global_id(1)); +int2 size = (int2)(get_global_size(0), get_global_size(1)); + +int count = 0; +float4 acc = (float4)(0,0,0,0); + +for (int xx = max(0,loc.x-rad); xx < min(loc.x+rad+1,size.x); xx++) +{ +count++; +acc += read_imagef(src, sampler, (int2)(xx, loc.y)); +} + +write_imagef(dst, loc, acc / count); +} + +__kernel void avgblur_vert(__write_only image2d_t dst, + __read_only image2d_t src, + int radv) +{ +const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE | + CLK_FILTER_NEAREST); +int2 loc = (int2)(get_global_id(0), get_global_id(1)); +int2 size = (int2)(get_global_size(0), get_global_size(1)); + +int count = 0; +float4 acc = (float4)(0,0,0,0); + +for (int yy = max(0,loc.y-radv); yy < min(loc.y+radv+1,size.y); yy++) +{ +count++; +acc += read_imagef(src, sampler, (int2)(loc.x, yy)); +} + +write_imagef(dst, loc, acc / count); +} diff --git a/libavfilter/opencl_source.h b/libavfilter/opencl_source.h index 23cdfc6ac9..02bc1723b0 100644 --- a/libavfilter/opencl_source.h +++ b/libavfilter/opencl_source.h @@ -19,6 +19,7 @@ #ifndef AVFILTER_OPENCL_SOURCE_H #define AVFILTER_OPENCL_SOURCE_H +extern const char *ff_opencl_source_avgblur; extern const char *ff_opencl_source_overlay; extern const char *ff_opencl_source_unsharp; diff --git a/libavfilter/vf_avgblur_opencl.c b/libavfilter/vf_avgblur_ opencl.c new file mode 100644 index 00..6e5ae4f32e --- /dev/null +++ b/libavfilter/vf_avgblur_opencl.c @@ -0,0 +1,316 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the
Re: [FFmpeg-devel] GSoC
On Sun, Mar 11, 2018 at 10:18 PM, Mark Thompsonwrote: > On 11/03/18 04:36, Dylan Fernando wrote: > > On Thu, Mar 8, 2018 at 8:57 AM, Mark Thompson wrote: > > > >> On 07/03/18 03:56, Dylan Fernando wrote: > >>> Thanks, it works now > >>> > >>> Would trying to implement an OpenCL version of vf_fade be a good idea > >> for a > >>> qualification task, or would it be a better idea to try a different > >> filter? > >> > >> That sounds like a sensible choice to me, though if you haven't written > a > >> filter before you might find it helpful to write something simpler > first to > >> understand how it fits together (for example: vflip, which has trivial > >> processing parts but still needs the surrounding boilerplate). > >> > >> - Mark > >> > >> (PS: be aware that top-posting is generally frowned upon on this mailing > >> list.) > >> > >> > >>> On Wed, Mar 7, 2018 at 1:20 AM, Mark Thompson wrote: > >>> > On 06/03/18 12:37, Dylan Fernando wrote: > > Hi, > > > > I am Dylan Fernando. I am a Computer Science student from Australia. > I > >> am > > new to FFmpeg and I wish to apply for GSoC this year. > > I would like to do the Video filtering with OpenCL project and I > have a > few > > questions. Would trying to implement an opencl version of vf_fade be > a > good > > idea for the qualification task, or would I be better off using a > different > > filter? > > > > Also, I’m having a bit of trouble with running unsharp_opencl. I > tried > > running: > > ffmpeg -hide_banner -nostats -v verbose -init_hw_device > opencl=ocl:0.1 > > -filter_hw_device ocl -i space.mpg -filter_complex unsharp_opencl > output.mp4 > > > > but I got the error: > > [AVHWDeviceContext @ 0x7fdac050c700] 0.1: Apple / Intel(R) Iris(TM) > > Graphics 6100 > > [mpeg @ 0x7fdac3132600] max_analyze_duration 500 reached at > 5005000 > > microseconds st:0 > > Input #0, mpeg, from 'space.mpg': > > Duration: 00:00:21.99, start: 0.387500, bitrate: 6108 kb/s > > Stream #0:0[0x1e0]: Video: mpeg2video (Main), 1 reference frame, > > yuv420p(tv, bt470bg, bottom first, left), 720x480 [SAR 8:9 DAR 4:3], > >> 6000 > > kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc > > Stream mapping: > > Stream #0:0 (mpeg2video) -> unsharp_opencl > > unsharp_opencl -> Stream #0:0 (mpeg4) > > Press [q] to stop, [?] for help > > [graph 0 input from stream 0:0 @ 0x7fdac0418800] w:720 h:480 > pixfmt:yuv420p > > tb:1/9 fr:3/1001 sar:8/9 sws_param:flags=2 > > [auto_scaler_0 @ 0x7fdac05232c0] w:iw h:ih flags:'bilinear' interl:0 > > [Parsed_unsharp_opencl_0 @ 0x7fdac0715a80] auto-inserting filter > > 'auto_scaler_0' between the filter 'graph 0 input from stream 0:0' > and > the > > filter 'Parsed_unsharp_opencl_0' > > Impossible to convert between the formats supported by the filter > >> 'graph > 0 > > input from stream 0:0' and the filter 'auto_scaler_0' > > Error reinitializing filters! > > Failed to inject frame into filter network: Function not implemented > > Error while processing the decoded data for stream #0:0 > > Conversion failed! > > > > How do I correctly run unsharp_opencl? Should I be running it on a > > different video file? > > It's intended to be used in filter graphs where much of the activity > is > already happening on the GPU, so the input and output are in the > AV_PIX_FMT_OPENCL format which contains GPU-side OpenCL images. > > If you want to use it standalone then you need hwupload and hwdownload > filters to move the frames between the CPU and GPU. For your example, > >> it > should work with: > > ffmpeg -init_hw_device opencl=ocl:0.1 -filter_hw_device ocl -i > space.mpg > -filter_complex hwupload,unsharp_opencl,hwdownload output.mp4 > > (There are constraints on what formats can be used and therefore > >> suitable > files (or required format conversions), but I believe a normal yuv420p > video like this should work in all cases.) > > - Mark > >> > > > > Thanks. > > > > How is AV_PIX_FMT_OPENCL formatted? When using read_imagef(), does xyzw > > correspond to RGBA respectively, or to YUV? Would I have to account for > > different formats? If so, how do I check the format of the input? > > See libavutil/hwcontext_opencl.c and in particular the functions > opencl_get_buffer(), opencl_pool_alloc() and opencl_get_plane_format() for > the code creating the AV_PIX_FMT_OPENCL images. > > It tries to support all formats which are representable as OpenCL images, > so the component values are dependent on what the format of the underlying > image is. What can actually be represented does depends a bit on the > implementation - for example, CL_R channel order is needed for all planar > YUV images, and CL_RG
Re: [FFmpeg-devel] GSoC
On Thu, Mar 15, 2018 at 12:08 PM, Dylan Fernandowrote: > > > On Sun, Mar 11, 2018 at 10:18 PM, Mark Thompson wrote: > >> On 11/03/18 04:36, Dylan Fernando wrote: >> > On Thu, Mar 8, 2018 at 8:57 AM, Mark Thompson wrote: >> > >> >> On 07/03/18 03:56, Dylan Fernando wrote: >> >>> Thanks, it works now >> >>> >> >>> Would trying to implement an OpenCL version of vf_fade be a good idea >> >> for a >> >>> qualification task, or would it be a better idea to try a different >> >> filter? >> >> >> >> That sounds like a sensible choice to me, though if you haven't >> written a >> >> filter before you might find it helpful to write something simpler >> first to >> >> understand how it fits together (for example: vflip, which has trivial >> >> processing parts but still needs the surrounding boilerplate). >> >> >> >> - Mark >> >> >> >> (PS: be aware that top-posting is generally frowned upon on this >> mailing >> >> list.) >> >> >> >> >> >>> On Wed, Mar 7, 2018 at 1:20 AM, Mark Thompson wrote: >> >>> >> On 06/03/18 12:37, Dylan Fernando wrote: >> > Hi, >> > >> > I am Dylan Fernando. I am a Computer Science student from >> Australia. I >> >> am >> > new to FFmpeg and I wish to apply for GSoC this year. >> > I would like to do the Video filtering with OpenCL project and I >> have a >> few >> > questions. Would trying to implement an opencl version of vf_fade >> be a >> good >> > idea for the qualification task, or would I be better off using a >> different >> > filter? >> > >> > Also, I’m having a bit of trouble with running unsharp_opencl. I >> tried >> > running: >> > ffmpeg -hide_banner -nostats -v verbose -init_hw_device >> opencl=ocl:0.1 >> > -filter_hw_device ocl -i space.mpg -filter_complex unsharp_opencl >> output.mp4 >> > >> > but I got the error: >> > [AVHWDeviceContext @ 0x7fdac050c700] 0.1: Apple / Intel(R) Iris(TM) >> > Graphics 6100 >> > [mpeg @ 0x7fdac3132600] max_analyze_duration 500 reached at >> 5005000 >> > microseconds st:0 >> > Input #0, mpeg, from 'space.mpg': >> > Duration: 00:00:21.99, start: 0.387500, bitrate: 6108 kb/s >> > Stream #0:0[0x1e0]: Video: mpeg2video (Main), 1 reference frame, >> > yuv420p(tv, bt470bg, bottom first, left), 720x480 [SAR 8:9 DAR 4:3], >> >> 6000 >> > kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc >> > Stream mapping: >> > Stream #0:0 (mpeg2video) -> unsharp_opencl >> > unsharp_opencl -> Stream #0:0 (mpeg4) >> > Press [q] to stop, [?] for help >> > [graph 0 input from stream 0:0 @ 0x7fdac0418800] w:720 h:480 >> pixfmt:yuv420p >> > tb:1/9 fr:3/1001 sar:8/9 sws_param:flags=2 >> > [auto_scaler_0 @ 0x7fdac05232c0] w:iw h:ih flags:'bilinear' interl:0 >> > [Parsed_unsharp_opencl_0 @ 0x7fdac0715a80] auto-inserting filter >> > 'auto_scaler_0' between the filter 'graph 0 input from stream 0:0' >> and >> the >> > filter 'Parsed_unsharp_opencl_0' >> > Impossible to convert between the formats supported by the filter >> >> 'graph >> 0 >> > input from stream 0:0' and the filter 'auto_scaler_0' >> > Error reinitializing filters! >> > Failed to inject frame into filter network: Function not implemented >> > Error while processing the decoded data for stream #0:0 >> > Conversion failed! >> > >> > How do I correctly run unsharp_opencl? Should I be running it on a >> > different video file? >> >> It's intended to be used in filter graphs where much of the activity >> is >> already happening on the GPU, so the input and output are in the >> AV_PIX_FMT_OPENCL format which contains GPU-side OpenCL images. >> >> If you want to use it standalone then you need hwupload and >> hwdownload >> filters to move the frames between the CPU and GPU. For your >> example, >> >> it >> should work with: >> >> ffmpeg -init_hw_device opencl=ocl:0.1 -filter_hw_device ocl -i >> space.mpg >> -filter_complex hwupload,unsharp_opencl,hwdownload output.mp4 >> >> (There are constraints on what formats can be used and therefore >> >> suitable >> files (or required format conversions), but I believe a normal >> yuv420p >> video like this should work in all cases.) >> >> - Mark >> >> >> > >> > Thanks. >> > >> > How is AV_PIX_FMT_OPENCL formatted? When using read_imagef(), does xyzw >> > correspond to RGBA respectively, or to YUV? Would I have to account for >> > different formats? If so, how do I check the format of the input? >> >> See libavutil/hwcontext_opencl.c and in particular the functions >> opencl_get_buffer(), opencl_pool_alloc() and opencl_get_plane_format() for >> the code creating the AV_PIX_FMT_OPENCL images. >> >> It tries to support all formats which are representable as OpenCL images, >> so the component values
Re: [FFmpeg-devel] [PATCH] libavfilter: Add OpenCL convolution filter v0.1
On 14/03/18 09:43, Danil Iashchenko wrote: > Behaves like the existing convolution filter, except working on OpenCL > hardware frames. > Takes exactly the same options: 4 convolution matrices, 4 rdiv values, 4 bias > values. > If not specified, default parameters are applied. > Matrices can be different sizes. > > NEW IN THIS PATCH: > -fixed bug, if matrices have different dims. > -renamed some variables due to readability. > > filter applies: > matrix0, rdiv0, bias0 to image plane0. > matrix1, rdiv1, bias1 to image plane1. > matrix2, rdiv2, bias2 to image plane2. > matrix3, rdiv3, bias3 to image plane3. > > About Kernel parameters: > dst - destination image > src - source image > coef_matrices_dims - stores dimensions of matrix{0..3} consecutively one > after the other > coef_matrices - stores matrices{0..3} consecutively one after the other > rdivs - stores rdiv{0..3} parameters consecutively one after the other > biases - stores bias{0..3} parameters consecutively one after the other > > About sscanf. I had (!err_code) condition, because I would never get empty > line > as option(if not specified, I always have default matrix), but changed to > (err_code != 1) due to read-ability. > Also, before sscanf I split matrix with spaces, so I process each single value > of matrix seperately from others and check if they are ok. My logic here is that you want to make sure that exactly one argument has been converted, so checking for != 1 is the right thing to do for errors. Even if you can argue that == 0 is the only possible error case and other error cases can't possibly happen, someone reading the code also has to think about that in the same way to be able to convince themselves that there isn't an error, where if you wrote != 1 they wouldn't need to think about it at all. (To offer a counterexample to the suggestion that you couldn't get -1 from sscanf() in the previous code, note that it only split for ' ' so it would fail on other whitespace. E.g. "1 2 3 4 6 7 8 9" (tab in the middle) would be accepted as a matrix and then invoke undefined behaviour reading the uninitialised value in the middle of the that matrix.) > about rdiv_buffer, bias_buffer, dims_buffer objects: they should be buffer > objects, because they store sequence of values, not a single value You only need to pass one value to each invocation of the kernel, since only one value is needed for each plane. > --- > configure | 1 + > libavfilter/Makefile| 1 + > libavfilter/allfilters.c| 1 + > libavfilter/opencl/convolution.cl | 46 > libavfilter/opencl_source.h | 1 + > libavfilter/vf_convolution_opencl.c | 449 > > 6 files changed, 499 insertions(+) > create mode 100644 libavfilter/opencl/convolution.cl > create mode 100644 libavfilter/vf_convolution_opencl.c > > diff --git a/configure b/configure > index 6916b45..bf5c312 100755 > --- a/configure > +++ b/configure > @@ -3210,6 +3210,7 @@ blackframe_filter_deps="gpl" > boxblur_filter_deps="gpl" > bs2b_filter_deps="libbs2b" > colormatrix_filter_deps="gpl" > +convolution_opencl_filter_deps="opencl" > convolve_filter_deps="avcodec" > convolve_filter_select="fft" > coreimage_filter_deps="coreimage appkit" > diff --git a/libavfilter/Makefile b/libavfilter/Makefile > index 6a60836..d005934 100644 > --- a/libavfilter/Makefile > +++ b/libavfilter/Makefile > @@ -156,6 +156,7 @@ OBJS-$(CONFIG_COLORLEVELS_FILTER)+= > vf_colorlevels.o > OBJS-$(CONFIG_COLORMATRIX_FILTER)+= vf_colormatrix.o > OBJS-$(CONFIG_COLORSPACE_FILTER) += vf_colorspace.o > colorspacedsp.o > OBJS-$(CONFIG_CONVOLUTION_FILTER)+= vf_convolution.o > +OBJS-$(CONFIG_CONVOLUTION_OPENCL_FILTER) += vf_convolution_opencl.o > opencl.o opencl/convolution.o > OBJS-$(CONFIG_CONVOLVE_FILTER) += vf_convolve.o framesync.o > OBJS-$(CONFIG_COPY_FILTER) += vf_copy.o > OBJS-$(CONFIG_COREIMAGE_FILTER) += vf_coreimage.o > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c > index 9adb109..f2dc55e 100644 > --- a/libavfilter/allfilters.c > +++ b/libavfilter/allfilters.c > @@ -166,6 +166,7 @@ static void register_all(void) > REGISTER_FILTER(COLORMATRIX,colormatrix,vf); > REGISTER_FILTER(COLORSPACE, colorspace, vf); > REGISTER_FILTER(CONVOLUTION,convolution,vf); > +REGISTER_FILTER(CONVOLUTION_OPENCL, convolution_opencl, vf); > REGISTER_FILTER(CONVOLVE, convolve, vf); > REGISTER_FILTER(COPY, copy, vf); > REGISTER_FILTER(COREIMAGE, coreimage, vf); > diff --git a/libavfilter/opencl/convolution.cl > b/libavfilter/opencl/convolution.cl > new file mode 100644 > index 000..192f1ef > --- /dev/null > +++ b/libavfilter/opencl/convolution.cl > @@ -0,0 +1,46 @@ > +/* > + * This file is part of
Re: [FFmpeg-devel] [PATCH] libavformat/movenc : Change MOV_TIMESCALE from 1000 to 600
On Sat, Mar 10, 2018 at 02:38:17PM +, Mark Burton wrote: > On 9 Mar 2018, at 01:26, Carl Eugen Hoyoswrote: > > This breaks fate, our regression testing suite (my mistake). > > To download the test-suite: > > $ make SAMPLES=fate-suite fate-rsync > > $ make SAMPLES=fate-suite GEN=1 fate > > This changes the values for fate, then commit again with: > > $ git commit tests libavformat > > > Thanks Carl, I hope the below is now correct. > > From 0c73563d06c05245ecf8bcaf64bc1c2809f375e4 Mon Sep 17 00:00:00 2001 > From: mwjburton > Date: Sat, 10 Mar 2018 14:33:02 + > Subject: [PATCH] libavformat/movenc : Change MOV_TIMESCALE from 1000 to 600 > > Changing the MOV_TIMESCALE value from 1000 to 600 results in > files that seek accurately in professional Quicktime software. This is > due to the fact 600 is cleanly divisible by more frame rates than 1000, for > example 24fps and 30fps. The Quicktime specification default is set to 600 > for this reason. When set to 1000 seeking can be inaccurate for these fame > rates. for other cases 600 is less accurate for example input that uses timestamps in ms precission like flv but also 3/1001 will be less precisse is there something that iam missing or can this simply be computed from the input timebases instead of being a fixed value ? so its accurate for the inpiut when that is possible and only some fixed value when that is not possible [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB During times of universal deceit, telling the truth becomes a revolutionary act. -- George Orwell signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavfi/deshake: Check alignment before calling asm init function
On Sat, Mar 10, 2018 at 08:50:08PM +0100, Carl Eugen Hoyos wrote: > Hi! > > Attached patch fixes ticket #7078 for me. > > Please comment, Carl Eugen > vf_deshake.c |8 > 1 file changed, 4 insertions(+), 4 deletions(-) > 9f4517eae88416277aeb5bd5b677159914e9c451 > 0001-lavfi-deshake-Check-alignment-before-calling-asm-ini.patch > From 75ead282c3aa3c214d37e766690e2edd037307c0 Mon Sep 17 00:00:00 2001 > From: Carl Eugen Hoyos> Date: Sat, 10 Mar 2018 20:46:21 +0100 > Subject: [PATCH] lavfi/deshake: Check alignment before calling asm init > function. > > Do this for every frame to make sure dynamic filters do not > cause crashes. > > Fixes ticket #7078. > --- > libavfilter/vf_deshake.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c > index fb4eb35..75e9990 100644 > --- a/libavfilter/vf_deshake.c > +++ b/libavfilter/vf_deshake.c > @@ -342,10 +342,6 @@ static av_cold int init(AVFilterContext *ctx) > { > DeshakeContext *deshake = ctx->priv; > > -deshake->sad = av_pixelutils_get_sad_fn(4, 4, 1, deshake); // 16x16, 2nd > source unaligned > -if (!deshake->sad) > -return AVERROR(EINVAL); > - > deshake->refcount = 20; // XXX: add to options? > deshake->blocksize /= 2; > deshake->blocksize = av_clip(deshake->blocksize, 4, 128); > @@ -432,6 +428,10 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) > } > av_frame_copy_props(out, in); > > +deshake->sad = av_pixelutils_get_sad_fn(4, 4, !((unsigned > long)in->data[0] & 15), deshake); // 16x16, 2nd source unaligned > +if (!deshake->sad) > +return AVERROR(EINVAL); does this need to check linesize too ? no more comments from me thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When the tyrant has disposed of foreign enemies by conquest or treaty, and there is nothing more to fear from them, then he is always stirring up some war or other, in order that the people may require a leader. -- Plato signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v3] avcodec: fix atomics usage for h264/mpeg error_count
On Wed, Mar 14, 2018 at 08:11:35AM +0100, wm4 wrote: > On Tue, 13 Mar 2018 19:07:33 +0100 > Michael Niedermayerwrote: > > > On Tue, Mar 13, 2018 at 04:02:57PM +, Aman Gupta wrote: > > > On Tue, Mar 13, 2018 at 4:39 AM Michael Niedermayer > > > > > > wrote: > > > > > > > On Mon, Mar 12, 2018 at 06:49:19PM -0700, Aman Gupta wrote: > > > > > From: Aman Gupta > > > > > > > > > > --- > > > > > libavcodec/h264_slice.c| 5 +++-- > > > > > libavcodec/mpeg12dec.c | 12 +++- > > > > > libavcodec/mpegvideo_enc.c | 3 ++- > > > > > 3 files changed, 12 insertions(+), 8 deletions(-) > > > > > > > > Iam a little bit confused, you write about "fixing" but not what this is > > > > fixing and it appears there are several distinct types of changes > > > > > > > > > The type of error_count is already atomic_int. I don't know when that was > > > changed. > > > > > > The fix here is that these files do not compile on FreeBSD because of > > > errors such as: > > > > > > [2018-03-11 18:26:55.078686] [freebsd-x86_64] libavcodec/mpegvideo_enc.c: > > > In function 'merge_context_after_encode': > > > > > > [2018-03-11 18:26:55.081607] [freebsd-x86_64] > > > libavcodec/mpegvideo_enc.c:3578:33: error: invalid operands to binary + > > > (have 'atomic_int' and 'atomic_int') > > > > > > > > > [2018-03-11 16:43:23.543072] [freebsd-x86_64] CClibavcodec/mpeg12dec.o > > > > > > [2018-03-11 16:43:23.768864] [freebsd-x86_64] libavcodec/mpeg12dec.c: In > > > function 'slice_decode_thread': > > > > > > > > [2018-03-11 16:43:23.769713] [freebsd-x86_64] > > > libavcodec/mpeg12dec.c:1996:23: error: incompatible types when assigning > > > to > > > type 'atomic_int' from type 'int' > > > > what compiler is this ? > > 6.5.16.1 Simple assignment > > Constraints > > One of the following shall hold: 114) > > — the left operand has atomic, qualified, or unqualified arithmetic > > type, and the right has > > arithmetic type; > > > > Please someone correct me here if iam wrong but > > To me this sounds like doing normal arithmetic operations between atomic and > > non atomic arithmetic types is allowed. > > It's true that C11 atomics allow direct access, but we also have > some atomic wrappers that won't work correctly then. I haven't checked > why this one fails, but the gcc compat wrappers use non-atomic types for > the emulation, so this patch is justified and necessary. The wrappers should be fixed if they do not work. If they cannot be fixed and cannot implement the C11 spec correctly they should not use the standard C11 types but choose differnt function and type names. And document these limitations and differences in that new API [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you drop bombs on a foreign country and kill a hundred thousand innocent people, expect your government to call the consequence "unprovoked inhuman terrorist attacks" and use it to justify dropping more bombs and killing more people. The technology changed, the idea is old. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]avfilter/astreamslect: fixing activating in some cases
Bodecs Bela (2018-03-14): > In case of some content, astreamselect filter remains in non active > state. > > please review this pacth. I am not sure this is the right fix of this. I am not sure either. framesync was not designed for audio. I would like to investigate: can you share the failing case? Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] avutil/buffer: add av_buffer_fast_alloc()
On Wed, 14 Mar 2018 16:02:36 -0300 James Almerwrote: > On 3/14/2018 3:59 PM, wm4 wrote: > > On Wed, 14 Mar 2018 14:45:33 -0300 > > James Almer wrote: > > > >> On 3/14/2018 1:41 PM, wm4 wrote: > >>> On Wed, 14 Mar 2018 13:30:28 -0300 > >>> James Almer wrote: > >>> > On 3/14/2018 12:51 PM, wm4 wrote: > > On Wed, 14 Mar 2018 12:30:04 -0300 > > James Almer wrote: > > > >> Same use case as av_fast_malloc(). If the buffer passed to it is > >> writable and big enough it will be reused, otherwise a new one will > >> be allocated instead. > >> > >> Signed-off-by: James Almer > >> --- > >> TODO: Changelog and APIChanges entries, version bump. > >> > >> libavutil/buffer.c | 33 + > >> libavutil/buffer.h | 42 ++ > >> 2 files changed, 75 insertions(+) > >> > >> diff --git a/libavutil/buffer.c b/libavutil/buffer.c > >> index 8d1aa5fa84..26e015d7ee 100644 > >> --- a/libavutil/buffer.c > >> +++ b/libavutil/buffer.c > >> @@ -215,6 +215,39 @@ int av_buffer_realloc(AVBufferRef **pbuf, int > >> size) > >> return 0; > >> } > >> > >> +static inline int buffer_fast_alloc(AVBufferRef **pbuf, int size, > >> +AVBufferRef* (*buffer_alloc)(int > >> size)) > >> +{ > >> +AVBufferRef *buf = *pbuf; > >> + > >> +if (buf && av_buffer_is_writable(buf) > >> +&& buf->data == buf->buffer->data > >> +&& size <= buf->buffer->size) { > >> +buf->size = FFMAX(0, size); > >> +return 0; > >> +} > >> + > >> +av_buffer_unref(pbuf); > >> + > >> +buf = buffer_alloc(size); > >> +if (!buf) > >> +return AVERROR(ENOMEM); > >> + > >> +*pbuf = buf; > >> + > >> +return 0; > >> +} > >> + > >> +int av_buffer_fast_alloc(AVBufferRef **pbuf, int size) > >> +{ > >> +return buffer_fast_alloc(pbuf, size, av_buffer_alloc); > >> +} > >> + > >> +int av_buffer_fast_allocz(AVBufferRef **pbuf, int size) > >> +{ > >> +return buffer_fast_alloc(pbuf, size, av_buffer_allocz); > >> +} > >> + > >> AVBufferPool *av_buffer_pool_init2(int size, void *opaque, > >> AVBufferRef* (*alloc)(void > >> *opaque, int size), > >> void (*pool_free)(void *opaque)) > >> diff --git a/libavutil/buffer.h b/libavutil/buffer.h > >> index 73b6bd0b14..1166017d22 100644 > >> --- a/libavutil/buffer.h > >> +++ b/libavutil/buffer.h > >> @@ -197,6 +197,48 @@ int av_buffer_make_writable(AVBufferRef **buf); > >> */ > >> int av_buffer_realloc(AVBufferRef **buf, int size); > >> > >> +/** > >> + * Allocate a buffer, reusing the given one if writable and large > >> enough. > >> + * > >> + * @code{.c} > >> + * AVBufferRef *buf = ...; > >> + * int ret = av_buffer_fast_alloc(, size); > >> + * if (ret < 0) { > >> + * // Allocation failed; buf already freed > >> + * return ret; > >> + * } > >> + * @endcode > >> + * > >> + * @param buf A buffer reference. *buf may be NULL. On success, a > >> new buffer > >> + * reference will be written in its place. On failure, it > >> will be > >> + * unreferenced and set to NULL. > >> + * @param size Required buffer size. > >> + * > >> + * @return 0 on success, a negative AVERROR on failure. > >> + * > >> + * @see av_buffer_realloc() > >> + * @see av_buffer_fast_allocz() > >> + */ > >> +int av_buffer_fast_alloc(AVBufferRef **buf, int size); > >> + > >> +/** > >> + * Allocate and clear a buffer, reusing the given one if writable and > >> large > >> + * enough. > >> + * > >> + * Like av_buffer_fast_alloc(), but all newly allocated space is > >> initially > >> + * cleared. Reused buffer is not cleared. > >> + * > >> + * @param buf A buffer reference. *buf may be NULL. On success, a > >> new buffer > >> + * reference will be written in its place. On failure, it > >> will be > >> + * unreferenced and set to NULL. > >> + * @param size Required buffer size. > >> + * > >> + * @return 0 on success, a negative AVERROR on failure. > >> + * > >> + * @see av_buffer_fast_alloc() > >> + */ > >> +int av_buffer_fast_allocz(AVBufferRef **buf, int size); > >> + > >> /** > >> * @} > >> */ > > > > LGTM > > > > Also some comment on the side: I think what you'd actually want is some > > sort of flexible buffer pool. E.g.
Re: [FFmpeg-devel] [PATCH v2] avutil/buffer: add av_buffer_fast_alloc()
On 3/14/2018 3:59 PM, wm4 wrote: > On Wed, 14 Mar 2018 14:45:33 -0300 > James Almerwrote: > >> On 3/14/2018 1:41 PM, wm4 wrote: >>> On Wed, 14 Mar 2018 13:30:28 -0300 >>> James Almer wrote: >>> On 3/14/2018 12:51 PM, wm4 wrote: > On Wed, 14 Mar 2018 12:30:04 -0300 > James Almer wrote: > >> Same use case as av_fast_malloc(). If the buffer passed to it is >> writable and big enough it will be reused, otherwise a new one will >> be allocated instead. >> >> Signed-off-by: James Almer >> --- >> TODO: Changelog and APIChanges entries, version bump. >> >> libavutil/buffer.c | 33 + >> libavutil/buffer.h | 42 ++ >> 2 files changed, 75 insertions(+) >> >> diff --git a/libavutil/buffer.c b/libavutil/buffer.c >> index 8d1aa5fa84..26e015d7ee 100644 >> --- a/libavutil/buffer.c >> +++ b/libavutil/buffer.c >> @@ -215,6 +215,39 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) >> return 0; >> } >> >> +static inline int buffer_fast_alloc(AVBufferRef **pbuf, int size, >> +AVBufferRef* (*buffer_alloc)(int >> size)) >> +{ >> +AVBufferRef *buf = *pbuf; >> + >> +if (buf && av_buffer_is_writable(buf) >> +&& buf->data == buf->buffer->data >> +&& size <= buf->buffer->size) { >> +buf->size = FFMAX(0, size); >> +return 0; >> +} >> + >> +av_buffer_unref(pbuf); >> + >> +buf = buffer_alloc(size); >> +if (!buf) >> +return AVERROR(ENOMEM); >> + >> +*pbuf = buf; >> + >> +return 0; >> +} >> + >> +int av_buffer_fast_alloc(AVBufferRef **pbuf, int size) >> +{ >> +return buffer_fast_alloc(pbuf, size, av_buffer_alloc); >> +} >> + >> +int av_buffer_fast_allocz(AVBufferRef **pbuf, int size) >> +{ >> +return buffer_fast_alloc(pbuf, size, av_buffer_allocz); >> +} >> + >> AVBufferPool *av_buffer_pool_init2(int size, void *opaque, >> AVBufferRef* (*alloc)(void *opaque, >> int size), >> void (*pool_free)(void *opaque)) >> diff --git a/libavutil/buffer.h b/libavutil/buffer.h >> index 73b6bd0b14..1166017d22 100644 >> --- a/libavutil/buffer.h >> +++ b/libavutil/buffer.h >> @@ -197,6 +197,48 @@ int av_buffer_make_writable(AVBufferRef **buf); >> */ >> int av_buffer_realloc(AVBufferRef **buf, int size); >> >> +/** >> + * Allocate a buffer, reusing the given one if writable and large >> enough. >> + * >> + * @code{.c} >> + * AVBufferRef *buf = ...; >> + * int ret = av_buffer_fast_alloc(, size); >> + * if (ret < 0) { >> + * // Allocation failed; buf already freed >> + * return ret; >> + * } >> + * @endcode >> + * >> + * @param buf A buffer reference. *buf may be NULL. On success, a new >> buffer >> + * reference will be written in its place. On failure, it >> will be >> + * unreferenced and set to NULL. >> + * @param size Required buffer size. >> + * >> + * @return 0 on success, a negative AVERROR on failure. >> + * >> + * @see av_buffer_realloc() >> + * @see av_buffer_fast_allocz() >> + */ >> +int av_buffer_fast_alloc(AVBufferRef **buf, int size); >> + >> +/** >> + * Allocate and clear a buffer, reusing the given one if writable and >> large >> + * enough. >> + * >> + * Like av_buffer_fast_alloc(), but all newly allocated space is >> initially >> + * cleared. Reused buffer is not cleared. >> + * >> + * @param buf A buffer reference. *buf may be NULL. On success, a new >> buffer >> + * reference will be written in its place. On failure, it >> will be >> + * unreferenced and set to NULL. >> + * @param size Required buffer size. >> + * >> + * @return 0 on success, a negative AVERROR on failure. >> + * >> + * @see av_buffer_fast_alloc() >> + */ >> +int av_buffer_fast_allocz(AVBufferRef **buf, int size); >> + >> /** >> * @} >> */ > > LGTM > > Also some comment on the side: I think what you'd actually want is some > sort of flexible buffer pool. E.g. consider the allocated AVBufferRef > gets used and buffered by the consumer for 1 frame. Then the > AVBufferRef will always be not-writable, and will always be newly > allocated, and this optimization via fast_alloc does not help. With a > buffer pool, it would allocate a second AVBufferRef, but then always > reuse it. Anyway, I might be overthinking
Re: [FFmpeg-devel] [PATCH v2] avutil/buffer: add av_buffer_fast_alloc()
On Wed, 14 Mar 2018 14:45:33 -0300 James Almerwrote: > On 3/14/2018 1:41 PM, wm4 wrote: > > On Wed, 14 Mar 2018 13:30:28 -0300 > > James Almer wrote: > > > >> On 3/14/2018 12:51 PM, wm4 wrote: > >>> On Wed, 14 Mar 2018 12:30:04 -0300 > >>> James Almer wrote: > >>> > Same use case as av_fast_malloc(). If the buffer passed to it is > writable and big enough it will be reused, otherwise a new one will > be allocated instead. > > Signed-off-by: James Almer > --- > TODO: Changelog and APIChanges entries, version bump. > > libavutil/buffer.c | 33 + > libavutil/buffer.h | 42 ++ > 2 files changed, 75 insertions(+) > > diff --git a/libavutil/buffer.c b/libavutil/buffer.c > index 8d1aa5fa84..26e015d7ee 100644 > --- a/libavutil/buffer.c > +++ b/libavutil/buffer.c > @@ -215,6 +215,39 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) > return 0; > } > > +static inline int buffer_fast_alloc(AVBufferRef **pbuf, int size, > +AVBufferRef* (*buffer_alloc)(int > size)) > +{ > +AVBufferRef *buf = *pbuf; > + > +if (buf && av_buffer_is_writable(buf) > +&& buf->data == buf->buffer->data > +&& size <= buf->buffer->size) { > +buf->size = FFMAX(0, size); > +return 0; > +} > + > +av_buffer_unref(pbuf); > + > +buf = buffer_alloc(size); > +if (!buf) > +return AVERROR(ENOMEM); > + > +*pbuf = buf; > + > +return 0; > +} > + > +int av_buffer_fast_alloc(AVBufferRef **pbuf, int size) > +{ > +return buffer_fast_alloc(pbuf, size, av_buffer_alloc); > +} > + > +int av_buffer_fast_allocz(AVBufferRef **pbuf, int size) > +{ > +return buffer_fast_alloc(pbuf, size, av_buffer_allocz); > +} > + > AVBufferPool *av_buffer_pool_init2(int size, void *opaque, > AVBufferRef* (*alloc)(void *opaque, > int size), > void (*pool_free)(void *opaque)) > diff --git a/libavutil/buffer.h b/libavutil/buffer.h > index 73b6bd0b14..1166017d22 100644 > --- a/libavutil/buffer.h > +++ b/libavutil/buffer.h > @@ -197,6 +197,48 @@ int av_buffer_make_writable(AVBufferRef **buf); > */ > int av_buffer_realloc(AVBufferRef **buf, int size); > > +/** > + * Allocate a buffer, reusing the given one if writable and large > enough. > + * > + * @code{.c} > + * AVBufferRef *buf = ...; > + * int ret = av_buffer_fast_alloc(, size); > + * if (ret < 0) { > + * // Allocation failed; buf already freed > + * return ret; > + * } > + * @endcode > + * > + * @param buf A buffer reference. *buf may be NULL. On success, a new > buffer > + * reference will be written in its place. On failure, it > will be > + * unreferenced and set to NULL. > + * @param size Required buffer size. > + * > + * @return 0 on success, a negative AVERROR on failure. > + * > + * @see av_buffer_realloc() > + * @see av_buffer_fast_allocz() > + */ > +int av_buffer_fast_alloc(AVBufferRef **buf, int size); > + > +/** > + * Allocate and clear a buffer, reusing the given one if writable and > large > + * enough. > + * > + * Like av_buffer_fast_alloc(), but all newly allocated space is > initially > + * cleared. Reused buffer is not cleared. > + * > + * @param buf A buffer reference. *buf may be NULL. On success, a new > buffer > + * reference will be written in its place. On failure, it > will be > + * unreferenced and set to NULL. > + * @param size Required buffer size. > + * > + * @return 0 on success, a negative AVERROR on failure. > + * > + * @see av_buffer_fast_alloc() > + */ > +int av_buffer_fast_allocz(AVBufferRef **buf, int size); > + > /** > * @} > */ > >>> > >>> LGTM > >>> > >>> Also some comment on the side: I think what you'd actually want is some > >>> sort of flexible buffer pool. E.g. consider the allocated AVBufferRef > >>> gets used and buffered by the consumer for 1 frame. Then the > >>> AVBufferRef will always be not-writable, and will always be newly > >>> allocated, and this optimization via fast_alloc does not help. With a > >>> buffer pool, it would allocate a second AVBufferRef, but then always > >>> reuse it. Anyway, I might be overthinking it. > >> > >> No, that's a good
[FFmpeg-devel] [PATCH]avfilter/astreamslect: fixing activating in some cases
Dear All, In case of some content, astreamselect filter remains in non active state. please review this pacth. I am not sure this is the right fix of this. thank you, in advance! Bela Bodecs >From acd81c80b8b5b33b03e99adb3bad04bc291e4218 Mon Sep 17 00:00:00 2001 From: Bela BodecsDate: Wed, 14 Mar 2018 19:22:03 +0100 Subject: [PATCH] avfilter/f_astreamselect: fixing activating in some cases In case of some content, astreamselect filter remains in non active state. Signed-off-by: Bela Bodecs --- libavfilter/f_streamselect.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavfilter/f_streamselect.c b/libavfilter/f_streamselect.c index 923deb1..2aef3f4 100644 --- a/libavfilter/f_streamselect.c +++ b/libavfilter/f_streamselect.c @@ -25,6 +25,7 @@ #include "framesync.h" #include "internal.h" #include "video.h" +#include "filters.h" typedef struct StreamSelectContext { const AVClass *class; @@ -66,8 +67,10 @@ static int process_frame(FFFrameSync *fs) AVFrame *out; if (s->is_audio && s->last_pts[j] == in[j]->pts && -ctx->outputs[i]->frame_count_in > 0) +ctx->outputs[i]->frame_count_in > 0) { +ff_filter_set_ready(ctx->outputs[i]->src, 200); continue; +} out = av_frame_clone(in[j]); if (!out) return AVERROR(ENOMEM); -- 2.5.3.windows.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] avutil/buffer: add av_buffer_fast_alloc()
On 3/14/2018 1:41 PM, wm4 wrote: > On Wed, 14 Mar 2018 13:30:28 -0300 > James Almerwrote: > >> On 3/14/2018 12:51 PM, wm4 wrote: >>> On Wed, 14 Mar 2018 12:30:04 -0300 >>> James Almer wrote: >>> Same use case as av_fast_malloc(). If the buffer passed to it is writable and big enough it will be reused, otherwise a new one will be allocated instead. Signed-off-by: James Almer --- TODO: Changelog and APIChanges entries, version bump. libavutil/buffer.c | 33 + libavutil/buffer.h | 42 ++ 2 files changed, 75 insertions(+) diff --git a/libavutil/buffer.c b/libavutil/buffer.c index 8d1aa5fa84..26e015d7ee 100644 --- a/libavutil/buffer.c +++ b/libavutil/buffer.c @@ -215,6 +215,39 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) return 0; } +static inline int buffer_fast_alloc(AVBufferRef **pbuf, int size, +AVBufferRef* (*buffer_alloc)(int size)) +{ +AVBufferRef *buf = *pbuf; + +if (buf && av_buffer_is_writable(buf) +&& buf->data == buf->buffer->data +&& size <= buf->buffer->size) { +buf->size = FFMAX(0, size); +return 0; +} + +av_buffer_unref(pbuf); + +buf = buffer_alloc(size); +if (!buf) +return AVERROR(ENOMEM); + +*pbuf = buf; + +return 0; +} + +int av_buffer_fast_alloc(AVBufferRef **pbuf, int size) +{ +return buffer_fast_alloc(pbuf, size, av_buffer_alloc); +} + +int av_buffer_fast_allocz(AVBufferRef **pbuf, int size) +{ +return buffer_fast_alloc(pbuf, size, av_buffer_allocz); +} + AVBufferPool *av_buffer_pool_init2(int size, void *opaque, AVBufferRef* (*alloc)(void *opaque, int size), void (*pool_free)(void *opaque)) diff --git a/libavutil/buffer.h b/libavutil/buffer.h index 73b6bd0b14..1166017d22 100644 --- a/libavutil/buffer.h +++ b/libavutil/buffer.h @@ -197,6 +197,48 @@ int av_buffer_make_writable(AVBufferRef **buf); */ int av_buffer_realloc(AVBufferRef **buf, int size); +/** + * Allocate a buffer, reusing the given one if writable and large enough. + * + * @code{.c} + * AVBufferRef *buf = ...; + * int ret = av_buffer_fast_alloc(, size); + * if (ret < 0) { + * // Allocation failed; buf already freed + * return ret; + * } + * @endcode + * + * @param buf A buffer reference. *buf may be NULL. On success, a new buffer + * reference will be written in its place. On failure, it will be + * unreferenced and set to NULL. + * @param size Required buffer size. + * + * @return 0 on success, a negative AVERROR on failure. + * + * @see av_buffer_realloc() + * @see av_buffer_fast_allocz() + */ +int av_buffer_fast_alloc(AVBufferRef **buf, int size); + +/** + * Allocate and clear a buffer, reusing the given one if writable and large + * enough. + * + * Like av_buffer_fast_alloc(), but all newly allocated space is initially + * cleared. Reused buffer is not cleared. + * + * @param buf A buffer reference. *buf may be NULL. On success, a new buffer + * reference will be written in its place. On failure, it will be + * unreferenced and set to NULL. + * @param size Required buffer size. + * + * @return 0 on success, a negative AVERROR on failure. + * + * @see av_buffer_fast_alloc() + */ +int av_buffer_fast_allocz(AVBufferRef **buf, int size); + /** * @} */ >>> >>> LGTM >>> >>> Also some comment on the side: I think what you'd actually want is some >>> sort of flexible buffer pool. E.g. consider the allocated AVBufferRef >>> gets used and buffered by the consumer for 1 frame. Then the >>> AVBufferRef will always be not-writable, and will always be newly >>> allocated, and this optimization via fast_alloc does not help. With a >>> buffer pool, it would allocate a second AVBufferRef, but then always >>> reuse it. Anyway, I might be overthinking it. >> >> No, that's a good idea, and it would come in handy in a lot more places >> than this fast_alloc API. But it's probably not trivial to implement, >> and would explain why the existing buffer pool API is for fixed sizes only. >> >> In any case, do you think it's better to try and implement your >> suggestion instead of this patch? You're right that it's a matter of >> creating one extra
Re: [FFmpeg-devel] [PATCH] reitnerlace - tinterlace-like filter under LGPL
2018-03-13 16:10 GMT+01:00 Vasile Toncu: > > > On 06.03.2018 20:38, Thomas Mundt wrote: > >> Hi, >> >> 2018-03-05 13:48 GMT+01:00 Carl Eugen Hoyos : >> >> 2018-03-05 12:37 GMT+01:00, Paul B Mahol : >>> On 3/5/18, Vasile Toncu wrote: > Hello, > > Thanks for the review. I've made changes according to your guidance. > > It would be great to know if the community will go on with our > intention > of adding reinterlace as a alternative for tinterlace. > > That being said, here is the new patch. > As already said, this is not acceptable. There is no point in having 2 filters with near same funcionality. >>> If you consider the new filter ok, the existing filter will be removed >>> in the same push. I believe sending only the new filter makes >>> reviewing easier. >>> >>> For me reviewing would be easier when Vasile sends a patchset that >> includes >> the replacement of tinterlace filter. >> That way existing fate tests could be used which are fortunately pretty >> extensive in this case. >> Also it would be helpful when you and/or other experienced ffmpeg >> developers would clarify first which parts of tinterlace have to be >> rewritten for proper relicensing. >> Being left in the dark makes working on patches frustrating. >> >> Another question is how to deal with vf_interlace? IMHO for the user there >> should be no difference in output, speed and license. >> Two options: >> 1. Relicensing and slice threading will also be ported to vf_interlace >> 2. The commands from vf_interlace will be included in the new tinterlace >> filter. vf_interlace will be deleted together with old tinterlace filter >> >> I would prefer the second option, but maybe there are even better options >> that don´t come to my mind. >> >> Please comment. >> Thanks, >> Thomas >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > > Hello everyone, > > sorry for a delayed response. > > From what has been discussed in here, I think the reinterlace will exist > with tinterlace for a period of time, just after that the tinterlace can be > removed. > > To have the reinterlace added, what is needed to be done from my side? > > Thanks, > Vasile Toncu > Two filters with almost the same functionality won´t be accepted, as Paul stated in this thread. Also there is vf_interlace filter, which is a subset of vf_tinterlace and should not differ in speed, output and license. As already said, I would prefer to include vf_interlace options into vf_tinterlace and remove vf_interlace. Also you want several changes: Making tinterlace filter LGPL, adding new options and adding slice threading. This should be done in a patch set: Patch 1/5: Include vf_interlace options into vf_tinterlace filter and remove vf_interlace Patch 2/5: Your new LGPL vf_reinterlace filter without the new options, fixes and slice threading Patch 3/5: Rename vf_reinterlace and replace vf_tinterlace by it Patch 4/5: Add slice threading Patch 5/5: Add the new options and fate tests for them Please run fate. All tests should pass. As already said, I don´t have the skills to suggest what has to be done making the relicensing legal. So I can do a technical review only. These are just my suggestions to the best of my knowledge! There might be better ideas from more experienced developers. Please comment. Regards, Thomas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] avutil/buffer: add av_buffer_fast_alloc()
On Wed, 14 Mar 2018 13:30:28 -0300 James Almerwrote: > On 3/14/2018 12:51 PM, wm4 wrote: > > On Wed, 14 Mar 2018 12:30:04 -0300 > > James Almer wrote: > > > >> Same use case as av_fast_malloc(). If the buffer passed to it is > >> writable and big enough it will be reused, otherwise a new one will > >> be allocated instead. > >> > >> Signed-off-by: James Almer > >> --- > >> TODO: Changelog and APIChanges entries, version bump. > >> > >> libavutil/buffer.c | 33 + > >> libavutil/buffer.h | 42 ++ > >> 2 files changed, 75 insertions(+) > >> > >> diff --git a/libavutil/buffer.c b/libavutil/buffer.c > >> index 8d1aa5fa84..26e015d7ee 100644 > >> --- a/libavutil/buffer.c > >> +++ b/libavutil/buffer.c > >> @@ -215,6 +215,39 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) > >> return 0; > >> } > >> > >> +static inline int buffer_fast_alloc(AVBufferRef **pbuf, int size, > >> +AVBufferRef* (*buffer_alloc)(int > >> size)) > >> +{ > >> +AVBufferRef *buf = *pbuf; > >> + > >> +if (buf && av_buffer_is_writable(buf) > >> +&& buf->data == buf->buffer->data > >> +&& size <= buf->buffer->size) { > >> +buf->size = FFMAX(0, size); > >> +return 0; > >> +} > >> + > >> +av_buffer_unref(pbuf); > >> + > >> +buf = buffer_alloc(size); > >> +if (!buf) > >> +return AVERROR(ENOMEM); > >> + > >> +*pbuf = buf; > >> + > >> +return 0; > >> +} > >> + > >> +int av_buffer_fast_alloc(AVBufferRef **pbuf, int size) > >> +{ > >> +return buffer_fast_alloc(pbuf, size, av_buffer_alloc); > >> +} > >> + > >> +int av_buffer_fast_allocz(AVBufferRef **pbuf, int size) > >> +{ > >> +return buffer_fast_alloc(pbuf, size, av_buffer_allocz); > >> +} > >> + > >> AVBufferPool *av_buffer_pool_init2(int size, void *opaque, > >> AVBufferRef* (*alloc)(void *opaque, > >> int size), > >> void (*pool_free)(void *opaque)) > >> diff --git a/libavutil/buffer.h b/libavutil/buffer.h > >> index 73b6bd0b14..1166017d22 100644 > >> --- a/libavutil/buffer.h > >> +++ b/libavutil/buffer.h > >> @@ -197,6 +197,48 @@ int av_buffer_make_writable(AVBufferRef **buf); > >> */ > >> int av_buffer_realloc(AVBufferRef **buf, int size); > >> > >> +/** > >> + * Allocate a buffer, reusing the given one if writable and large enough. > >> + * > >> + * @code{.c} > >> + * AVBufferRef *buf = ...; > >> + * int ret = av_buffer_fast_alloc(, size); > >> + * if (ret < 0) { > >> + * // Allocation failed; buf already freed > >> + * return ret; > >> + * } > >> + * @endcode > >> + * > >> + * @param buf A buffer reference. *buf may be NULL. On success, a new > >> buffer > >> + * reference will be written in its place. On failure, it > >> will be > >> + * unreferenced and set to NULL. > >> + * @param size Required buffer size. > >> + * > >> + * @return 0 on success, a negative AVERROR on failure. > >> + * > >> + * @see av_buffer_realloc() > >> + * @see av_buffer_fast_allocz() > >> + */ > >> +int av_buffer_fast_alloc(AVBufferRef **buf, int size); > >> + > >> +/** > >> + * Allocate and clear a buffer, reusing the given one if writable and > >> large > >> + * enough. > >> + * > >> + * Like av_buffer_fast_alloc(), but all newly allocated space is initially > >> + * cleared. Reused buffer is not cleared. > >> + * > >> + * @param buf A buffer reference. *buf may be NULL. On success, a new > >> buffer > >> + * reference will be written in its place. On failure, it > >> will be > >> + * unreferenced and set to NULL. > >> + * @param size Required buffer size. > >> + * > >> + * @return 0 on success, a negative AVERROR on failure. > >> + * > >> + * @see av_buffer_fast_alloc() > >> + */ > >> +int av_buffer_fast_allocz(AVBufferRef **buf, int size); > >> + > >> /** > >> * @} > >> */ > > > > LGTM > > > > Also some comment on the side: I think what you'd actually want is some > > sort of flexible buffer pool. E.g. consider the allocated AVBufferRef > > gets used and buffered by the consumer for 1 frame. Then the > > AVBufferRef will always be not-writable, and will always be newly > > allocated, and this optimization via fast_alloc does not help. With a > > buffer pool, it would allocate a second AVBufferRef, but then always > > reuse it. Anyway, I might be overthinking it. > > No, that's a good idea, and it would come in handy in a lot more places > than this fast_alloc API. But it's probably not trivial to implement, > and would explain why the existing buffer pool API is for fixed sizes only. > > In any case, do you think it's better to try and implement your > suggestion instead of this patch? You're right that it's a matter of > creating one extra reference and this function would probably stop
Re: [FFmpeg-devel] [PATCH v2] avutil/buffer: add av_buffer_fast_alloc()
On 3/14/2018 12:51 PM, wm4 wrote: > On Wed, 14 Mar 2018 12:30:04 -0300 > James Almerwrote: > >> Same use case as av_fast_malloc(). If the buffer passed to it is >> writable and big enough it will be reused, otherwise a new one will >> be allocated instead. >> >> Signed-off-by: James Almer >> --- >> TODO: Changelog and APIChanges entries, version bump. >> >> libavutil/buffer.c | 33 + >> libavutil/buffer.h | 42 ++ >> 2 files changed, 75 insertions(+) >> >> diff --git a/libavutil/buffer.c b/libavutil/buffer.c >> index 8d1aa5fa84..26e015d7ee 100644 >> --- a/libavutil/buffer.c >> +++ b/libavutil/buffer.c >> @@ -215,6 +215,39 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) >> return 0; >> } >> >> +static inline int buffer_fast_alloc(AVBufferRef **pbuf, int size, >> +AVBufferRef* (*buffer_alloc)(int size)) >> +{ >> +AVBufferRef *buf = *pbuf; >> + >> +if (buf && av_buffer_is_writable(buf) >> +&& buf->data == buf->buffer->data >> +&& size <= buf->buffer->size) { >> +buf->size = FFMAX(0, size); >> +return 0; >> +} >> + >> +av_buffer_unref(pbuf); >> + >> +buf = buffer_alloc(size); >> +if (!buf) >> +return AVERROR(ENOMEM); >> + >> +*pbuf = buf; >> + >> +return 0; >> +} >> + >> +int av_buffer_fast_alloc(AVBufferRef **pbuf, int size) >> +{ >> +return buffer_fast_alloc(pbuf, size, av_buffer_alloc); >> +} >> + >> +int av_buffer_fast_allocz(AVBufferRef **pbuf, int size) >> +{ >> +return buffer_fast_alloc(pbuf, size, av_buffer_allocz); >> +} >> + >> AVBufferPool *av_buffer_pool_init2(int size, void *opaque, >> AVBufferRef* (*alloc)(void *opaque, int >> size), >> void (*pool_free)(void *opaque)) >> diff --git a/libavutil/buffer.h b/libavutil/buffer.h >> index 73b6bd0b14..1166017d22 100644 >> --- a/libavutil/buffer.h >> +++ b/libavutil/buffer.h >> @@ -197,6 +197,48 @@ int av_buffer_make_writable(AVBufferRef **buf); >> */ >> int av_buffer_realloc(AVBufferRef **buf, int size); >> >> +/** >> + * Allocate a buffer, reusing the given one if writable and large enough. >> + * >> + * @code{.c} >> + * AVBufferRef *buf = ...; >> + * int ret = av_buffer_fast_alloc(, size); >> + * if (ret < 0) { >> + * // Allocation failed; buf already freed >> + * return ret; >> + * } >> + * @endcode >> + * >> + * @param buf A buffer reference. *buf may be NULL. On success, a new >> buffer >> + * reference will be written in its place. On failure, it will >> be >> + * unreferenced and set to NULL. >> + * @param size Required buffer size. >> + * >> + * @return 0 on success, a negative AVERROR on failure. >> + * >> + * @see av_buffer_realloc() >> + * @see av_buffer_fast_allocz() >> + */ >> +int av_buffer_fast_alloc(AVBufferRef **buf, int size); >> + >> +/** >> + * Allocate and clear a buffer, reusing the given one if writable and large >> + * enough. >> + * >> + * Like av_buffer_fast_alloc(), but all newly allocated space is initially >> + * cleared. Reused buffer is not cleared. >> + * >> + * @param buf A buffer reference. *buf may be NULL. On success, a new >> buffer >> + * reference will be written in its place. On failure, it will >> be >> + * unreferenced and set to NULL. >> + * @param size Required buffer size. >> + * >> + * @return 0 on success, a negative AVERROR on failure. >> + * >> + * @see av_buffer_fast_alloc() >> + */ >> +int av_buffer_fast_allocz(AVBufferRef **buf, int size); >> + >> /** >> * @} >> */ > > LGTM > > Also some comment on the side: I think what you'd actually want is some > sort of flexible buffer pool. E.g. consider the allocated AVBufferRef > gets used and buffered by the consumer for 1 frame. Then the > AVBufferRef will always be not-writable, and will always be newly > allocated, and this optimization via fast_alloc does not help. With a > buffer pool, it would allocate a second AVBufferRef, but then always > reuse it. Anyway, I might be overthinking it. No, that's a good idea, and it would come in handy in a lot more places than this fast_alloc API. But it's probably not trivial to implement, and would explain why the existing buffer pool API is for fixed sizes only. In any case, do you think it's better to try and implement your suggestion instead of this patch? You're right that it's a matter of creating one extra reference and this function would probably stop being "fast". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] avutil/buffer: add av_buffer_fast_alloc()
On Wed, 14 Mar 2018 12:30:04 -0300 James Almerwrote: > Same use case as av_fast_malloc(). If the buffer passed to it is > writable and big enough it will be reused, otherwise a new one will > be allocated instead. > > Signed-off-by: James Almer > --- > TODO: Changelog and APIChanges entries, version bump. > > libavutil/buffer.c | 33 + > libavutil/buffer.h | 42 ++ > 2 files changed, 75 insertions(+) > > diff --git a/libavutil/buffer.c b/libavutil/buffer.c > index 8d1aa5fa84..26e015d7ee 100644 > --- a/libavutil/buffer.c > +++ b/libavutil/buffer.c > @@ -215,6 +215,39 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) > return 0; > } > > +static inline int buffer_fast_alloc(AVBufferRef **pbuf, int size, > +AVBufferRef* (*buffer_alloc)(int size)) > +{ > +AVBufferRef *buf = *pbuf; > + > +if (buf && av_buffer_is_writable(buf) > +&& buf->data == buf->buffer->data > +&& size <= buf->buffer->size) { > +buf->size = FFMAX(0, size); > +return 0; > +} > + > +av_buffer_unref(pbuf); > + > +buf = buffer_alloc(size); > +if (!buf) > +return AVERROR(ENOMEM); > + > +*pbuf = buf; > + > +return 0; > +} > + > +int av_buffer_fast_alloc(AVBufferRef **pbuf, int size) > +{ > +return buffer_fast_alloc(pbuf, size, av_buffer_alloc); > +} > + > +int av_buffer_fast_allocz(AVBufferRef **pbuf, int size) > +{ > +return buffer_fast_alloc(pbuf, size, av_buffer_allocz); > +} > + > AVBufferPool *av_buffer_pool_init2(int size, void *opaque, > AVBufferRef* (*alloc)(void *opaque, int > size), > void (*pool_free)(void *opaque)) > diff --git a/libavutil/buffer.h b/libavutil/buffer.h > index 73b6bd0b14..1166017d22 100644 > --- a/libavutil/buffer.h > +++ b/libavutil/buffer.h > @@ -197,6 +197,48 @@ int av_buffer_make_writable(AVBufferRef **buf); > */ > int av_buffer_realloc(AVBufferRef **buf, int size); > > +/** > + * Allocate a buffer, reusing the given one if writable and large enough. > + * > + * @code{.c} > + * AVBufferRef *buf = ...; > + * int ret = av_buffer_fast_alloc(, size); > + * if (ret < 0) { > + * // Allocation failed; buf already freed > + * return ret; > + * } > + * @endcode > + * > + * @param buf A buffer reference. *buf may be NULL. On success, a new buffer > + * reference will be written in its place. On failure, it will be > + * unreferenced and set to NULL. > + * @param size Required buffer size. > + * > + * @return 0 on success, a negative AVERROR on failure. > + * > + * @see av_buffer_realloc() > + * @see av_buffer_fast_allocz() > + */ > +int av_buffer_fast_alloc(AVBufferRef **buf, int size); > + > +/** > + * Allocate and clear a buffer, reusing the given one if writable and large > + * enough. > + * > + * Like av_buffer_fast_alloc(), but all newly allocated space is initially > + * cleared. Reused buffer is not cleared. > + * > + * @param buf A buffer reference. *buf may be NULL. On success, a new buffer > + * reference will be written in its place. On failure, it will be > + * unreferenced and set to NULL. > + * @param size Required buffer size. > + * > + * @return 0 on success, a negative AVERROR on failure. > + * > + * @see av_buffer_fast_alloc() > + */ > +int av_buffer_fast_allocz(AVBufferRef **buf, int size); > + > /** > * @} > */ LGTM Also some comment on the side: I think what you'd actually want is some sort of flexible buffer pool. E.g. consider the allocated AVBufferRef gets used and buffered by the consumer for 1 frame. Then the AVBufferRef will always be not-writable, and will always be newly allocated, and this optimization via fast_alloc does not help. With a buffer pool, it would allocate a second AVBufferRef, but then always reuse it. Anyway, I might be overthinking it. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil/buffer: add av_buffer_fast_alloc()
On 3/14/2018 12:09 PM, wm4 wrote: > On Wed, 14 Mar 2018 11:59:59 -0300 > James Almerwrote: > >> On 3/14/2018 11:35 AM, wm4 wrote: >>> On Wed, 14 Mar 2018 11:13:52 -0300 >>> James Almer wrote: >>> On 3/14/2018 4:14 AM, wm4 wrote: > On Tue, 13 Mar 2018 20:48:56 -0300 > James Almer wrote: > >> Same concept as av_fast_malloc(). If the buffer passed to it is writable >> and big enough it will be reused, otherwise a new one will be allocated >> instead. >> >> Signed-off-by: James Almer >> --- >> TODO: Changelog and APIChanges entries, version bump. >> >> libavutil/buffer.c | 63 >> ++ >> libavutil/buffer.h | 42 >> 2 files changed, 105 insertions(+) >> >> diff --git a/libavutil/buffer.c b/libavutil/buffer.c >> index 8d1aa5fa84..16ce1b82e2 100644 >> --- a/libavutil/buffer.c >> +++ b/libavutil/buffer.c >> @@ -215,6 +215,69 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) >> return 0; >> } >> >> +static av_always_inline int buffer_fast_alloc(AVBufferRef **pbuf, int >> size, int zero_alloc) >> +{ >> +AVBufferRef *buf = *pbuf; >> +AVBuffer *b; >> +uint8_t *data; >> + >> +if (!buf || !av_buffer_is_writable(buf) || buf->data != >> buf->buffer->data) { >> +/* Buffer can't be reused, and neither can the entire >> AVBufferRef. >> + * Unref the latter and alloc a new one. */ >> +av_buffer_unref(pbuf); >> + >> +buf = av_buffer_alloc(size); >> +if (!buf) >> +return AVERROR(ENOMEM); >> + >> +if (zero_alloc) >> +memset(buf->data, 0, size); >> + >> +*pbuf = buf; >> +return 0; >> +} >> +b = buf->buffer; >> + >> +if (size <= b->size) { >> +/* Buffer can be reused. Update the size of AVBufferRef but >> leave the >> + * AVBuffer untouched. */ >> +buf->size = FFMAX(0, size); >> +return 0; >> +} >> + >> +/* Buffer can't be reused, but there's no need to alloc new >> AVBuffer and >> + * AVBufferRef structs. Free the existing buffer, allocate a new >> one, and >> + * reset AVBuffer and AVBufferRef to default values. */ >> +b->free(b->opaque, b->data); >> +b->free = av_buffer_default_free; >> +b->opaque = NULL; >> +b->flags = 0; >> + >> +data = av_malloc(size); >> +if (!data) { >> +av_buffer_unref(pbuf); >> +return AVERROR(ENOMEM); >> +} >> + >> +if (zero_alloc) >> +memset(data, 0, size); >> + >> +b->data = buf->data = data; >> +b->size = buf->size = size; >> + >> +return 0; >> +} >> + >> +int av_buffer_fast_alloc(AVBufferRef **pbuf, int size) >> +{ >> +return buffer_fast_alloc(pbuf, size, 0); >> +} >> + >> +int av_buffer_fast_allocz(AVBufferRef **pbuf, int size) >> +{ >> +return buffer_fast_alloc(pbuf, size, 1); >> +} >> + >> AVBufferPool *av_buffer_pool_init2(int size, void *opaque, >> AVBufferRef* (*alloc)(void *opaque, >> int size), >> void (*pool_free)(void *opaque)) >> diff --git a/libavutil/buffer.h b/libavutil/buffer.h >> index 73b6bd0b14..1166017d22 100644 >> --- a/libavutil/buffer.h >> +++ b/libavutil/buffer.h >> @@ -197,6 +197,48 @@ int av_buffer_make_writable(AVBufferRef **buf); >> */ >> int av_buffer_realloc(AVBufferRef **buf, int size); >> >> +/** >> + * Allocate a buffer, reusing the given one if writable and large >> enough. >> + * >> + * @code{.c} >> + * AVBufferRef *buf = ...; >> + * int ret = av_buffer_fast_alloc(, size); >> + * if (ret < 0) { >> + * // Allocation failed; buf already freed >> + * return ret; >> + * } >> + * @endcode >> + * >> + * @param buf A buffer reference. *buf may be NULL. On success, a new >> buffer >> + * reference will be written in its place. On failure, it >> will be >> + * unreferenced and set to NULL. >> + * @param size Required buffer size. >> + * >> + * @return 0 on success, a negative AVERROR on failure. >> + * >> + * @see av_buffer_realloc() >> + * @see av_buffer_fast_allocz() >> + */ >> +int av_buffer_fast_alloc(AVBufferRef **buf, int size); >> + >> +/** >> + * Allocate and clear a buffer, reusing the given one if writable and >> large >> + * enough. >> + * >> + * Like
[FFmpeg-devel] [PATCH v2] avutil/buffer: add av_buffer_fast_alloc()
Same use case as av_fast_malloc(). If the buffer passed to it is writable and big enough it will be reused, otherwise a new one will be allocated instead. Signed-off-by: James Almer--- TODO: Changelog and APIChanges entries, version bump. libavutil/buffer.c | 33 + libavutil/buffer.h | 42 ++ 2 files changed, 75 insertions(+) diff --git a/libavutil/buffer.c b/libavutil/buffer.c index 8d1aa5fa84..26e015d7ee 100644 --- a/libavutil/buffer.c +++ b/libavutil/buffer.c @@ -215,6 +215,39 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) return 0; } +static inline int buffer_fast_alloc(AVBufferRef **pbuf, int size, +AVBufferRef* (*buffer_alloc)(int size)) +{ +AVBufferRef *buf = *pbuf; + +if (buf && av_buffer_is_writable(buf) +&& buf->data == buf->buffer->data +&& size <= buf->buffer->size) { +buf->size = FFMAX(0, size); +return 0; +} + +av_buffer_unref(pbuf); + +buf = buffer_alloc(size); +if (!buf) +return AVERROR(ENOMEM); + +*pbuf = buf; + +return 0; +} + +int av_buffer_fast_alloc(AVBufferRef **pbuf, int size) +{ +return buffer_fast_alloc(pbuf, size, av_buffer_alloc); +} + +int av_buffer_fast_allocz(AVBufferRef **pbuf, int size) +{ +return buffer_fast_alloc(pbuf, size, av_buffer_allocz); +} + AVBufferPool *av_buffer_pool_init2(int size, void *opaque, AVBufferRef* (*alloc)(void *opaque, int size), void (*pool_free)(void *opaque)) diff --git a/libavutil/buffer.h b/libavutil/buffer.h index 73b6bd0b14..1166017d22 100644 --- a/libavutil/buffer.h +++ b/libavutil/buffer.h @@ -197,6 +197,48 @@ int av_buffer_make_writable(AVBufferRef **buf); */ int av_buffer_realloc(AVBufferRef **buf, int size); +/** + * Allocate a buffer, reusing the given one if writable and large enough. + * + * @code{.c} + * AVBufferRef *buf = ...; + * int ret = av_buffer_fast_alloc(, size); + * if (ret < 0) { + * // Allocation failed; buf already freed + * return ret; + * } + * @endcode + * + * @param buf A buffer reference. *buf may be NULL. On success, a new buffer + * reference will be written in its place. On failure, it will be + * unreferenced and set to NULL. + * @param size Required buffer size. + * + * @return 0 on success, a negative AVERROR on failure. + * + * @see av_buffer_realloc() + * @see av_buffer_fast_allocz() + */ +int av_buffer_fast_alloc(AVBufferRef **buf, int size); + +/** + * Allocate and clear a buffer, reusing the given one if writable and large + * enough. + * + * Like av_buffer_fast_alloc(), but all newly allocated space is initially + * cleared. Reused buffer is not cleared. + * + * @param buf A buffer reference. *buf may be NULL. On success, a new buffer + * reference will be written in its place. On failure, it will be + * unreferenced and set to NULL. + * @param size Required buffer size. + * + * @return 0 on success, a negative AVERROR on failure. + * + * @see av_buffer_fast_alloc() + */ +int av_buffer_fast_allocz(AVBufferRef **buf, int size); + /** * @} */ -- 2.16.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/hapqa_extract: remove the AVOption flags
On 3/14/2018 3:32 AM, Martin Vignali wrote: > 2018-03-14 2:09 GMT+01:00 James Almer: > >> These two are not used for bitstream filters. >> >> Signed-off-by: James Almer >> --- >> libavcodec/hapqa_extract_bsf.c | 7 +++ >> 1 file changed, 3 insertions(+), 4 deletions(-) >> >> diff --git a/libavcodec/hapqa_extract_bsf.c b/libavcodec/hapqa_extract_ >> bsf.c >> index ee5dc191f7..652f79a7fe 100644 >> --- a/libavcodec/hapqa_extract_bsf.c >> +++ b/libavcodec/hapqa_extract_bsf.c >> @@ -110,11 +110,10 @@ static const enum AVCodecID codec_ids[] = { >> }; >> >> #define OFFSET(x) offsetof(HapqaExtractContext, x) >> -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM >> static const AVOption options[] = { >> -{ "texture", "texture to keep", OFFSET(texture), AV_OPT_TYPE_INT, { >> .i64 = 0 }, 0, 1, FLAGS, "texture" }, >> -{ "color", "keep HapQ texture", 0, AV_OPT_TYPE_CONST, { .i64 = 0 >> }, 0, 0, FLAGS, "texture" }, >> -{ "alpha", "keep HapAlphaOnly texture", 0, AV_OPT_TYPE_CONST, { >> .i64 = 1 }, 0, 0, FLAGS, "texture" }, >> +{ "texture", "texture to keep", OFFSET(texture), AV_OPT_TYPE_INT, { >> .i64 = 0 }, 0, 1, 0, "texture" }, >> +{ "color", "keep HapQ texture", 0, AV_OPT_TYPE_CONST, { >> .i64 = 0 }, .unit = "texture" }, >> +{ "alpha", "keep HapAlphaOnly texture", 0, AV_OPT_TYPE_CONST, { >> .i64 = 1 }, .unit = "texture" }, >> { NULL }, >> }; >> >> >> > ok > > Martin Pushed, thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil/buffer: add av_buffer_fast_alloc()
On Wed, 14 Mar 2018 11:59:59 -0300 James Almerwrote: > On 3/14/2018 11:35 AM, wm4 wrote: > > On Wed, 14 Mar 2018 11:13:52 -0300 > > James Almer wrote: > > > >> On 3/14/2018 4:14 AM, wm4 wrote: > >>> On Tue, 13 Mar 2018 20:48:56 -0300 > >>> James Almer wrote: > >>> > Same concept as av_fast_malloc(). If the buffer passed to it is writable > and big enough it will be reused, otherwise a new one will be allocated > instead. > > Signed-off-by: James Almer > --- > TODO: Changelog and APIChanges entries, version bump. > > libavutil/buffer.c | 63 > ++ > libavutil/buffer.h | 42 > 2 files changed, 105 insertions(+) > > diff --git a/libavutil/buffer.c b/libavutil/buffer.c > index 8d1aa5fa84..16ce1b82e2 100644 > --- a/libavutil/buffer.c > +++ b/libavutil/buffer.c > @@ -215,6 +215,69 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) > return 0; > } > > +static av_always_inline int buffer_fast_alloc(AVBufferRef **pbuf, int > size, int zero_alloc) > +{ > +AVBufferRef *buf = *pbuf; > +AVBuffer *b; > +uint8_t *data; > + > +if (!buf || !av_buffer_is_writable(buf) || buf->data != > buf->buffer->data) { > +/* Buffer can't be reused, and neither can the entire > AVBufferRef. > + * Unref the latter and alloc a new one. */ > +av_buffer_unref(pbuf); > + > +buf = av_buffer_alloc(size); > +if (!buf) > +return AVERROR(ENOMEM); > + > +if (zero_alloc) > +memset(buf->data, 0, size); > + > +*pbuf = buf; > +return 0; > +} > +b = buf->buffer; > + > +if (size <= b->size) { > +/* Buffer can be reused. Update the size of AVBufferRef but > leave the > + * AVBuffer untouched. */ > +buf->size = FFMAX(0, size); > +return 0; > +} > + > +/* Buffer can't be reused, but there's no need to alloc new > AVBuffer and > + * AVBufferRef structs. Free the existing buffer, allocate a new > one, and > + * reset AVBuffer and AVBufferRef to default values. */ > +b->free(b->opaque, b->data); > +b->free = av_buffer_default_free; > +b->opaque = NULL; > +b->flags = 0; > + > +data = av_malloc(size); > +if (!data) { > +av_buffer_unref(pbuf); > +return AVERROR(ENOMEM); > +} > + > +if (zero_alloc) > +memset(data, 0, size); > + > +b->data = buf->data = data; > +b->size = buf->size = size; > + > +return 0; > +} > + > +int av_buffer_fast_alloc(AVBufferRef **pbuf, int size) > +{ > +return buffer_fast_alloc(pbuf, size, 0); > +} > + > +int av_buffer_fast_allocz(AVBufferRef **pbuf, int size) > +{ > +return buffer_fast_alloc(pbuf, size, 1); > +} > + > AVBufferPool *av_buffer_pool_init2(int size, void *opaque, > AVBufferRef* (*alloc)(void *opaque, > int size), > void (*pool_free)(void *opaque)) > diff --git a/libavutil/buffer.h b/libavutil/buffer.h > index 73b6bd0b14..1166017d22 100644 > --- a/libavutil/buffer.h > +++ b/libavutil/buffer.h > @@ -197,6 +197,48 @@ int av_buffer_make_writable(AVBufferRef **buf); > */ > int av_buffer_realloc(AVBufferRef **buf, int size); > > +/** > + * Allocate a buffer, reusing the given one if writable and large > enough. > + * > + * @code{.c} > + * AVBufferRef *buf = ...; > + * int ret = av_buffer_fast_alloc(, size); > + * if (ret < 0) { > + * // Allocation failed; buf already freed > + * return ret; > + * } > + * @endcode > + * > + * @param buf A buffer reference. *buf may be NULL. On success, a new > buffer > + * reference will be written in its place. On failure, it > will be > + * unreferenced and set to NULL. > + * @param size Required buffer size. > + * > + * @return 0 on success, a negative AVERROR on failure. > + * > + * @see av_buffer_realloc() > + * @see av_buffer_fast_allocz() > + */ > +int av_buffer_fast_alloc(AVBufferRef **buf, int size); > + > +/** > + * Allocate and clear a buffer, reusing the given one if writable and > large > + * enough. > + * > + * Like av_buffer_fast_alloc(), but all newly allocated space is
Re: [FFmpeg-devel] [PATCH] avutil/buffer: add av_buffer_fast_alloc()
On 3/14/2018 11:35 AM, wm4 wrote: > On Wed, 14 Mar 2018 11:13:52 -0300 > James Almerwrote: > >> On 3/14/2018 4:14 AM, wm4 wrote: >>> On Tue, 13 Mar 2018 20:48:56 -0300 >>> James Almer wrote: >>> Same concept as av_fast_malloc(). If the buffer passed to it is writable and big enough it will be reused, otherwise a new one will be allocated instead. Signed-off-by: James Almer --- TODO: Changelog and APIChanges entries, version bump. libavutil/buffer.c | 63 ++ libavutil/buffer.h | 42 2 files changed, 105 insertions(+) diff --git a/libavutil/buffer.c b/libavutil/buffer.c index 8d1aa5fa84..16ce1b82e2 100644 --- a/libavutil/buffer.c +++ b/libavutil/buffer.c @@ -215,6 +215,69 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) return 0; } +static av_always_inline int buffer_fast_alloc(AVBufferRef **pbuf, int size, int zero_alloc) +{ +AVBufferRef *buf = *pbuf; +AVBuffer *b; +uint8_t *data; + +if (!buf || !av_buffer_is_writable(buf) || buf->data != buf->buffer->data) { +/* Buffer can't be reused, and neither can the entire AVBufferRef. + * Unref the latter and alloc a new one. */ +av_buffer_unref(pbuf); + +buf = av_buffer_alloc(size); +if (!buf) +return AVERROR(ENOMEM); + +if (zero_alloc) +memset(buf->data, 0, size); + +*pbuf = buf; +return 0; +} +b = buf->buffer; + +if (size <= b->size) { +/* Buffer can be reused. Update the size of AVBufferRef but leave the + * AVBuffer untouched. */ +buf->size = FFMAX(0, size); +return 0; +} + +/* Buffer can't be reused, but there's no need to alloc new AVBuffer and + * AVBufferRef structs. Free the existing buffer, allocate a new one, and + * reset AVBuffer and AVBufferRef to default values. */ +b->free(b->opaque, b->data); +b->free = av_buffer_default_free; +b->opaque = NULL; +b->flags = 0; + +data = av_malloc(size); +if (!data) { +av_buffer_unref(pbuf); +return AVERROR(ENOMEM); +} + +if (zero_alloc) +memset(data, 0, size); + +b->data = buf->data = data; +b->size = buf->size = size; + +return 0; +} + +int av_buffer_fast_alloc(AVBufferRef **pbuf, int size) +{ +return buffer_fast_alloc(pbuf, size, 0); +} + +int av_buffer_fast_allocz(AVBufferRef **pbuf, int size) +{ +return buffer_fast_alloc(pbuf, size, 1); +} + AVBufferPool *av_buffer_pool_init2(int size, void *opaque, AVBufferRef* (*alloc)(void *opaque, int size), void (*pool_free)(void *opaque)) diff --git a/libavutil/buffer.h b/libavutil/buffer.h index 73b6bd0b14..1166017d22 100644 --- a/libavutil/buffer.h +++ b/libavutil/buffer.h @@ -197,6 +197,48 @@ int av_buffer_make_writable(AVBufferRef **buf); */ int av_buffer_realloc(AVBufferRef **buf, int size); +/** + * Allocate a buffer, reusing the given one if writable and large enough. + * + * @code{.c} + * AVBufferRef *buf = ...; + * int ret = av_buffer_fast_alloc(, size); + * if (ret < 0) { + * // Allocation failed; buf already freed + * return ret; + * } + * @endcode + * + * @param buf A buffer reference. *buf may be NULL. On success, a new buffer + * reference will be written in its place. On failure, it will be + * unreferenced and set to NULL. + * @param size Required buffer size. + * + * @return 0 on success, a negative AVERROR on failure. + * + * @see av_buffer_realloc() + * @see av_buffer_fast_allocz() + */ +int av_buffer_fast_alloc(AVBufferRef **buf, int size); + +/** + * Allocate and clear a buffer, reusing the given one if writable and large + * enough. + * + * Like av_buffer_fast_alloc(), but all newly allocated space is initially + * cleared. Reused buffer is not cleared. + * + * @param buf A buffer reference. *buf may be NULL. On success, a new buffer + * reference will be written in its place. On failure, it will be + * unreferenced and set to NULL. + * @param size Required buffer size. + * + * @return 0 on success,
Re: [FFmpeg-devel] [PATCH] avutil/buffer: add av_buffer_fast_alloc()
On Wed, 14 Mar 2018 11:13:52 -0300 James Almerwrote: > On 3/14/2018 4:14 AM, wm4 wrote: > > On Tue, 13 Mar 2018 20:48:56 -0300 > > James Almer wrote: > > > >> Same concept as av_fast_malloc(). If the buffer passed to it is writable > >> and big enough it will be reused, otherwise a new one will be allocated > >> instead. > >> > >> Signed-off-by: James Almer > >> --- > >> TODO: Changelog and APIChanges entries, version bump. > >> > >> libavutil/buffer.c | 63 > >> ++ > >> libavutil/buffer.h | 42 > >> 2 files changed, 105 insertions(+) > >> > >> diff --git a/libavutil/buffer.c b/libavutil/buffer.c > >> index 8d1aa5fa84..16ce1b82e2 100644 > >> --- a/libavutil/buffer.c > >> +++ b/libavutil/buffer.c > >> @@ -215,6 +215,69 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) > >> return 0; > >> } > >> > >> +static av_always_inline int buffer_fast_alloc(AVBufferRef **pbuf, int > >> size, int zero_alloc) > >> +{ > >> +AVBufferRef *buf = *pbuf; > >> +AVBuffer *b; > >> +uint8_t *data; > >> + > >> +if (!buf || !av_buffer_is_writable(buf) || buf->data != > >> buf->buffer->data) { > >> +/* Buffer can't be reused, and neither can the entire AVBufferRef. > >> + * Unref the latter and alloc a new one. */ > >> +av_buffer_unref(pbuf); > >> + > >> +buf = av_buffer_alloc(size); > >> +if (!buf) > >> +return AVERROR(ENOMEM); > >> + > >> +if (zero_alloc) > >> +memset(buf->data, 0, size); > >> + > >> +*pbuf = buf; > >> +return 0; > >> +} > >> +b = buf->buffer; > >> + > >> +if (size <= b->size) { > >> +/* Buffer can be reused. Update the size of AVBufferRef but leave > >> the > >> + * AVBuffer untouched. */ > >> +buf->size = FFMAX(0, size); > >> +return 0; > >> +} > >> + > >> +/* Buffer can't be reused, but there's no need to alloc new AVBuffer > >> and > >> + * AVBufferRef structs. Free the existing buffer, allocate a new one, > >> and > >> + * reset AVBuffer and AVBufferRef to default values. */ > >> +b->free(b->opaque, b->data); > >> +b->free = av_buffer_default_free; > >> +b->opaque = NULL; > >> +b->flags = 0; > >> + > >> +data = av_malloc(size); > >> +if (!data) { > >> +av_buffer_unref(pbuf); > >> +return AVERROR(ENOMEM); > >> +} > >> + > >> +if (zero_alloc) > >> +memset(data, 0, size); > >> + > >> +b->data = buf->data = data; > >> +b->size = buf->size = size; > >> + > >> +return 0; > >> +} > >> + > >> +int av_buffer_fast_alloc(AVBufferRef **pbuf, int size) > >> +{ > >> +return buffer_fast_alloc(pbuf, size, 0); > >> +} > >> + > >> +int av_buffer_fast_allocz(AVBufferRef **pbuf, int size) > >> +{ > >> +return buffer_fast_alloc(pbuf, size, 1); > >> +} > >> + > >> AVBufferPool *av_buffer_pool_init2(int size, void *opaque, > >> AVBufferRef* (*alloc)(void *opaque, > >> int size), > >> void (*pool_free)(void *opaque)) > >> diff --git a/libavutil/buffer.h b/libavutil/buffer.h > >> index 73b6bd0b14..1166017d22 100644 > >> --- a/libavutil/buffer.h > >> +++ b/libavutil/buffer.h > >> @@ -197,6 +197,48 @@ int av_buffer_make_writable(AVBufferRef **buf); > >> */ > >> int av_buffer_realloc(AVBufferRef **buf, int size); > >> > >> +/** > >> + * Allocate a buffer, reusing the given one if writable and large enough. > >> + * > >> + * @code{.c} > >> + * AVBufferRef *buf = ...; > >> + * int ret = av_buffer_fast_alloc(, size); > >> + * if (ret < 0) { > >> + * // Allocation failed; buf already freed > >> + * return ret; > >> + * } > >> + * @endcode > >> + * > >> + * @param buf A buffer reference. *buf may be NULL. On success, a new > >> buffer > >> + * reference will be written in its place. On failure, it > >> will be > >> + * unreferenced and set to NULL. > >> + * @param size Required buffer size. > >> + * > >> + * @return 0 on success, a negative AVERROR on failure. > >> + * > >> + * @see av_buffer_realloc() > >> + * @see av_buffer_fast_allocz() > >> + */ > >> +int av_buffer_fast_alloc(AVBufferRef **buf, int size); > >> + > >> +/** > >> + * Allocate and clear a buffer, reusing the given one if writable and > >> large > >> + * enough. > >> + * > >> + * Like av_buffer_fast_alloc(), but all newly allocated space is initially > >> + * cleared. Reused buffer is not cleared. > >> + * > >> + * @param buf A buffer reference. *buf may be NULL. On success, a new > >> buffer > >> + * reference will be written in its place. On failure, it > >> will be > >> + * unreferenced and set to NULL. > >> + * @param size Required buffer size. > >> + * > >> + * @return 0 on success, a negative AVERROR on failure. > >> + *
Re: [FFmpeg-devel] [PATCH] avutil/buffer: add av_buffer_fast_alloc()
On 3/14/2018 4:14 AM, wm4 wrote: > On Tue, 13 Mar 2018 20:48:56 -0300 > James Almerwrote: > >> Same concept as av_fast_malloc(). If the buffer passed to it is writable >> and big enough it will be reused, otherwise a new one will be allocated >> instead. >> >> Signed-off-by: James Almer >> --- >> TODO: Changelog and APIChanges entries, version bump. >> >> libavutil/buffer.c | 63 >> ++ >> libavutil/buffer.h | 42 >> 2 files changed, 105 insertions(+) >> >> diff --git a/libavutil/buffer.c b/libavutil/buffer.c >> index 8d1aa5fa84..16ce1b82e2 100644 >> --- a/libavutil/buffer.c >> +++ b/libavutil/buffer.c >> @@ -215,6 +215,69 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) >> return 0; >> } >> >> +static av_always_inline int buffer_fast_alloc(AVBufferRef **pbuf, int size, >> int zero_alloc) >> +{ >> +AVBufferRef *buf = *pbuf; >> +AVBuffer *b; >> +uint8_t *data; >> + >> +if (!buf || !av_buffer_is_writable(buf) || buf->data != >> buf->buffer->data) { >> +/* Buffer can't be reused, and neither can the entire AVBufferRef. >> + * Unref the latter and alloc a new one. */ >> +av_buffer_unref(pbuf); >> + >> +buf = av_buffer_alloc(size); >> +if (!buf) >> +return AVERROR(ENOMEM); >> + >> +if (zero_alloc) >> +memset(buf->data, 0, size); >> + >> +*pbuf = buf; >> +return 0; >> +} >> +b = buf->buffer; >> + >> +if (size <= b->size) { >> +/* Buffer can be reused. Update the size of AVBufferRef but leave >> the >> + * AVBuffer untouched. */ >> +buf->size = FFMAX(0, size); >> +return 0; >> +} >> + >> +/* Buffer can't be reused, but there's no need to alloc new AVBuffer and >> + * AVBufferRef structs. Free the existing buffer, allocate a new one, >> and >> + * reset AVBuffer and AVBufferRef to default values. */ >> +b->free(b->opaque, b->data); >> +b->free = av_buffer_default_free; >> +b->opaque = NULL; >> +b->flags = 0; >> + >> +data = av_malloc(size); >> +if (!data) { >> +av_buffer_unref(pbuf); >> +return AVERROR(ENOMEM); >> +} >> + >> +if (zero_alloc) >> +memset(data, 0, size); >> + >> +b->data = buf->data = data; >> +b->size = buf->size = size; >> + >> +return 0; >> +} >> + >> +int av_buffer_fast_alloc(AVBufferRef **pbuf, int size) >> +{ >> +return buffer_fast_alloc(pbuf, size, 0); >> +} >> + >> +int av_buffer_fast_allocz(AVBufferRef **pbuf, int size) >> +{ >> +return buffer_fast_alloc(pbuf, size, 1); >> +} >> + >> AVBufferPool *av_buffer_pool_init2(int size, void *opaque, >> AVBufferRef* (*alloc)(void *opaque, int >> size), >> void (*pool_free)(void *opaque)) >> diff --git a/libavutil/buffer.h b/libavutil/buffer.h >> index 73b6bd0b14..1166017d22 100644 >> --- a/libavutil/buffer.h >> +++ b/libavutil/buffer.h >> @@ -197,6 +197,48 @@ int av_buffer_make_writable(AVBufferRef **buf); >> */ >> int av_buffer_realloc(AVBufferRef **buf, int size); >> >> +/** >> + * Allocate a buffer, reusing the given one if writable and large enough. >> + * >> + * @code{.c} >> + * AVBufferRef *buf = ...; >> + * int ret = av_buffer_fast_alloc(, size); >> + * if (ret < 0) { >> + * // Allocation failed; buf already freed >> + * return ret; >> + * } >> + * @endcode >> + * >> + * @param buf A buffer reference. *buf may be NULL. On success, a new >> buffer >> + * reference will be written in its place. On failure, it will >> be >> + * unreferenced and set to NULL. >> + * @param size Required buffer size. >> + * >> + * @return 0 on success, a negative AVERROR on failure. >> + * >> + * @see av_buffer_realloc() >> + * @see av_buffer_fast_allocz() >> + */ >> +int av_buffer_fast_alloc(AVBufferRef **buf, int size); >> + >> +/** >> + * Allocate and clear a buffer, reusing the given one if writable and large >> + * enough. >> + * >> + * Like av_buffer_fast_alloc(), but all newly allocated space is initially >> + * cleared. Reused buffer is not cleared. >> + * >> + * @param buf A buffer reference. *buf may be NULL. On success, a new >> buffer >> + * reference will be written in its place. On failure, it will >> be >> + * unreferenced and set to NULL. >> + * @param size Required buffer size. >> + * >> + * @return 0 on success, a negative AVERROR on failure. >> + * >> + * @see av_buffer_fast_alloc() >> + */ >> +int av_buffer_fast_allocz(AVBufferRef **buf, int size); >> + >> /** >> * @} >> */ > > Wouldn't it be better to avoid writing a lot of new allocation code > (with possibly subtle problems), and just use av_buffer_realloc() to > handle reallocation? (Possibly it could be moved to an internal > function to avoid the memcpy()
Re: [FFmpeg-devel] [PATCH] doc/utils: document the "ms" and "us" suffixes for durations
On Sat, Mar 10, 2018 at 19:32:09 +0100, Moritz Barsnick wrote: > These suffixes were recently introduced in > 61c972384d311508d07f9360d196909e27195655 > and completed in 8218249f1f04de65904f58519bde21948e5a0783. Ping. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 1/1] libavformat/hlsenc: Option to set timeout for socket I/O operation
On 3/14/18 5:31 PM, Steven Liu wrote: > > >> On 14 Mar 2018, at 19:57, Steven Liuwrote: >> >> >> >>> On 14 Mar 2018, at 19:45, Dixit, Vishwanath wrote: >>> >>> >>> On 3/6/18 2:12 PM, Steven Liu wrote: > On 5 Mar 2018, at 17:41, rpata...@akamai.com wrote: > > From: Ravindra > > --- > doc/muxers.texi | 3 +++ > libavformat/hlsenc.c | 5 - > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/doc/muxers.texi b/doc/muxers.texi > index c156ec0..3a63da7 100644 > --- a/doc/muxers.texi > +++ b/doc/muxers.texi > @@ -964,6 +964,9 @@ publishing it repeatedly every after 30 segments i.e. > every after 60s. > @item http_persistent > Use persistent HTTP connections. Applicable only for HTTP output. > > +@item timeout > +Set timeout for socket I/O operations. Applicable only for HTTP output. > + > @end table > > @anchor{ico} > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > index 08fe0aa..5d462da 100644 > --- a/libavformat/hlsenc.c > +++ b/libavformat/hlsenc.c > @@ -224,6 +224,7 @@ typedef struct HLSContext { > int http_persistent; > AVIOContext *m3u8_out; > AVIOContext *sub_m3u8_out; > +int64_t timeout; > } HLSContext; > > static int mkdir_p(const char *path) { > @@ -305,7 +306,8 @@ static void set_http_options(AVFormatContext *s, > AVDictionary **options, HLSCont > av_dict_set(options, "user_agent", c->user_agent, 0); > if (c->http_persistent) > av_dict_set_int(options, "multiple_requests", 1, 0); > - > +if (c->timeout >= 0) > +av_dict_set_int(options, "timeout", c->timeout, 0); > } > > static void write_codec_attr(AVStream *st, VariantStream *vs) { > @@ -2792,6 +2794,7 @@ static const AVOption options[] = { > {"master_pl_name", "Create HLS master playlist with this name", > OFFSET(master_pl_name), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0,E}, > {"master_pl_publish_rate", "Publish master play list every after this > many segment intervals", OFFSET(master_publish_rate), AV_OPT_TYPE_INT, > {.i64 = 0}, 0, UINT_MAX, E}, > {"http_persistent", "Use persistent HTTP connections", > OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E }, > +{"timeout", "set timeout for socket I/O operations", > OFFSET(timeout), AV_OPT_TYPE_DURATION, { .i64 = -1 }, -1, INT_MAX, .flags > = E }, > { NULL }, > }; > > -- > 1.9.1 > Will apply! >>> Hi Steven, >>> >>> Could you please apply this patch. >> Oops, Sorry for delay apply this, i pushed it now. > Done. >>> Thank you Steven… ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/openh264enc.c: generate IDR frame in response to I frame pict_type
On Mon, Mar 12, 2018 at 14:38:21 -0800, Lou Logan wrote: > But you don't necessarily need to make a new patch to address the > minor whitespace issue. You can wait for other comments and include > it with any other requested changes. Another whitespace nit: > if (frame->pict_type==AV_PICTURE_TYPE_I) { Please use single spaces around operators, i.e. if (frame->pict_type == AV_PICTURE_TYPE_I) { Moritz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Fix iterating of input and output devices
My bad Am 14.03.2018 13:25, schrieb Timo Rothenpieler: -if (!(prev = ((AVOutputFormat *)prev)->next)) +if (!(prev = prev ? ((AVInputFormat *)prev)->next : (void*)outdev_list[0])) AVOutputFormat ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-develFrom cd8842ecf606d368832066fcda925c705e9e9205 Mon Sep 17 00:00:00 2001 From: Felix MatouschekDate: Wed, 14 Mar 2018 13:14:07 +0100 Subject: [PATCH] Fix iterating of input and output devices To: ffmpeg-devel@ffmpeg.org In the previous implementation the first input or output device was skipped when device_next was called with prev = NULL Signed-off-by: Felix Matouschek --- libavdevice/alldevices.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c index 4c89649b97..39993354bc 100644 --- a/libavdevice/alldevices.c +++ b/libavdevice/alldevices.c @@ -126,16 +126,13 @@ static void *device_next(void *prev, int output, ff_thread_once(_device_next_init, av_device_init_next); -if (!prev && !(prev = (output ? (void*)outdev_list[0] : (void*)indev_list[0]))) -return NULL; - do { if (output) { -if (!(prev = ((AVOutputFormat *)prev)->next)) +if (!(prev = prev ? ((AVOutputFormat *)prev)->next : (void*)outdev_list[0])) break; pc = ((AVOutputFormat *)prev)->priv_class; } else { -if (!(prev = ((AVInputFormat *)prev)->next)) +if (!(prev = prev ? ((AVInputFormat *)prev)->next : (void*)indev_list[0])) break; pc = ((AVInputFormat *)prev)->priv_class; } -- 2.14.1.windows.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Fix iterating of input and output devices
>-if (!(prev = ((AVOutputFormat *)prev)->next)) >+if (!(prev = prev ? ((AVInputFormat *)prev)->next : (void*)outdev_list[0])) AVOutputFormat smime.p7s Description: S/MIME Cryptographic Signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] Fix iterating of input and output devices
This fixes the iterating of input and output devices In the previous implementation the first input or output device was skipped when device_next was called with prev = NULLFrom f90823e8dccf5751e88b8990f5789d8f67e7c496 Mon Sep 17 00:00:00 2001 From: Felix MatouschekDate: Wed, 14 Mar 2018 13:14:07 +0100 Subject: [PATCH] Fix iterating of input and output devices To: ffmpeg-devel@ffmpeg.org In the previous implementation the first input or output device was skipped when device_next was called with prev = NULL Signed-off-by: Felix Matouschek --- libavdevice/alldevices.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c index 4c89649b97..271a3182a0 100644 --- a/libavdevice/alldevices.c +++ b/libavdevice/alldevices.c @@ -126,16 +126,13 @@ static void *device_next(void *prev, int output, ff_thread_once(_device_next_init, av_device_init_next); -if (!prev && !(prev = (output ? (void*)outdev_list[0] : (void*)indev_list[0]))) -return NULL; - do { if (output) { -if (!(prev = ((AVOutputFormat *)prev)->next)) +if (!(prev = prev ? ((AVInputFormat *)prev)->next : (void*)outdev_list[0])) break; pc = ((AVOutputFormat *)prev)->priv_class; } else { -if (!(prev = ((AVInputFormat *)prev)->next)) +if (!(prev = prev ? ((AVInputFormat *)prev)->next : (void*)indev_list[0])) break; pc = ((AVInputFormat *)prev)->priv_class; } -- 2.14.1.windows.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 1/1] libavformat/hlsenc: Option to set timeout for socket I/O operation
> On 14 Mar 2018, at 19:57, Steven Liuwrote: > > > >> On 14 Mar 2018, at 19:45, Dixit, Vishwanath wrote: >> >> >> On 3/6/18 2:12 PM, Steven Liu wrote: >>> >>> On 5 Mar 2018, at 17:41, rpata...@akamai.com wrote: From: Ravindra --- doc/muxers.texi | 3 +++ libavformat/hlsenc.c | 5 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index c156ec0..3a63da7 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -964,6 +964,9 @@ publishing it repeatedly every after 30 segments i.e. every after 60s. @item http_persistent Use persistent HTTP connections. Applicable only for HTTP output. +@item timeout +Set timeout for socket I/O operations. Applicable only for HTTP output. + @end table @anchor{ico} diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 08fe0aa..5d462da 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -224,6 +224,7 @@ typedef struct HLSContext { int http_persistent; AVIOContext *m3u8_out; AVIOContext *sub_m3u8_out; +int64_t timeout; } HLSContext; static int mkdir_p(const char *path) { @@ -305,7 +306,8 @@ static void set_http_options(AVFormatContext *s, AVDictionary **options, HLSCont av_dict_set(options, "user_agent", c->user_agent, 0); if (c->http_persistent) av_dict_set_int(options, "multiple_requests", 1, 0); - +if (c->timeout >= 0) +av_dict_set_int(options, "timeout", c->timeout, 0); } static void write_codec_attr(AVStream *st, VariantStream *vs) { @@ -2792,6 +2794,7 @@ static const AVOption options[] = { {"master_pl_name", "Create HLS master playlist with this name", OFFSET(master_pl_name), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0,E}, {"master_pl_publish_rate", "Publish master play list every after this many segment intervals", OFFSET(master_publish_rate), AV_OPT_TYPE_INT, {.i64 = 0}, 0, UINT_MAX, E}, {"http_persistent", "Use persistent HTTP connections", OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E }, +{"timeout", "set timeout for socket I/O operations", OFFSET(timeout), AV_OPT_TYPE_DURATION, { .i64 = -1 }, -1, INT_MAX, .flags = E }, { NULL }, }; -- 1.9.1 >>> >>> Will apply! >>> >> Hi Steven, >> >> Could you please apply this patch. > Oops, Sorry for delay apply this, i pushed it now. Done. >> >> PS: following up on behalf of Ravindra Patagar >> >> Regards, >> Vishwanath >> >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > Thanks > Steven Thanks Steven ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]download: Use git.ffmpeg.org to browse repository
2018-03-09 0:02 GMT+01:00, Lou Logan: > On Thu, 8 Mar 2018 23:37:19 +0100 > Carl Eugen Hoyos wrote: >> diff --git a/src/download b/src/download >> index 6783c35..b03e3d0 100644 >> --- a/src/download >> +++ b/src/download >> @@ -143,7 +143,7 @@ >> >>Snapshot >> >> -https://github.com/FFmpeg/FFmpeg; class="btn >> btn-success"> >> +https://git.ffmpeg.org/gitweb/ffmpeg.git; class="btn >> btn-success"> >>Browse >> >> > > Fine with me. Patch applied. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 1/1] libavformat/hlsenc: Option to set timeout for socket I/O operation
> On 14 Mar 2018, at 19:45, Dixit, Vishwanathwrote: > > > On 3/6/18 2:12 PM, Steven Liu wrote: >> >> >>> On 5 Mar 2018, at 17:41, rpata...@akamai.com wrote: >>> >>> From: Ravindra >>> >>> --- >>> doc/muxers.texi | 3 +++ >>> libavformat/hlsenc.c | 5 - >>> 2 files changed, 7 insertions(+), 1 deletion(-) >>> >>> diff --git a/doc/muxers.texi b/doc/muxers.texi >>> index c156ec0..3a63da7 100644 >>> --- a/doc/muxers.texi >>> +++ b/doc/muxers.texi >>> @@ -964,6 +964,9 @@ publishing it repeatedly every after 30 segments i.e. >>> every after 60s. >>> @item http_persistent >>> Use persistent HTTP connections. Applicable only for HTTP output. >>> >>> +@item timeout >>> +Set timeout for socket I/O operations. Applicable only for HTTP output. >>> + >>> @end table >>> >>> @anchor{ico} >>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c >>> index 08fe0aa..5d462da 100644 >>> --- a/libavformat/hlsenc.c >>> +++ b/libavformat/hlsenc.c >>> @@ -224,6 +224,7 @@ typedef struct HLSContext { >>>int http_persistent; >>>AVIOContext *m3u8_out; >>>AVIOContext *sub_m3u8_out; >>> +int64_t timeout; >>> } HLSContext; >>> >>> static int mkdir_p(const char *path) { >>> @@ -305,7 +306,8 @@ static void set_http_options(AVFormatContext *s, >>> AVDictionary **options, HLSCont >>>av_dict_set(options, "user_agent", c->user_agent, 0); >>>if (c->http_persistent) >>>av_dict_set_int(options, "multiple_requests", 1, 0); >>> - >>> +if (c->timeout >= 0) >>> +av_dict_set_int(options, "timeout", c->timeout, 0); >>> } >>> >>> static void write_codec_attr(AVStream *st, VariantStream *vs) { >>> @@ -2792,6 +2794,7 @@ static const AVOption options[] = { >>>{"master_pl_name", "Create HLS master playlist with this name", >>> OFFSET(master_pl_name), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0,E}, >>>{"master_pl_publish_rate", "Publish master play list every after this >>> many segment intervals", OFFSET(master_publish_rate), AV_OPT_TYPE_INT, >>> {.i64 = 0}, 0, UINT_MAX, E}, >>>{"http_persistent", "Use persistent HTTP connections", >>> OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E }, >>> +{"timeout", "set timeout for socket I/O operations", OFFSET(timeout), >>> AV_OPT_TYPE_DURATION, { .i64 = -1 }, -1, INT_MAX, .flags = E }, >>>{ NULL }, >>> }; >>> >>> -- >>> 1.9.1 >>> >> >> Will apply! >> > Hi Steven, > > Could you please apply this patch. Oops, Sorry for delay apply this, i pushed it now. > > PS: following up on behalf of Ravindra Patagar > > Regards, > Vishwanath > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel Thanks Steven ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 1/1] libavformat/hlsenc: Option to set timeout for socket I/O operation
On 3/6/18 2:12 PM, Steven Liu wrote: > > >> On 5 Mar 2018, at 17:41, rpata...@akamai.com wrote: >> >> From: Ravindra>> >> --- >> doc/muxers.texi | 3 +++ >> libavformat/hlsenc.c | 5 - >> 2 files changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/doc/muxers.texi b/doc/muxers.texi >> index c156ec0..3a63da7 100644 >> --- a/doc/muxers.texi >> +++ b/doc/muxers.texi >> @@ -964,6 +964,9 @@ publishing it repeatedly every after 30 segments i.e. >> every after 60s. >> @item http_persistent >> Use persistent HTTP connections. Applicable only for HTTP output. >> >> +@item timeout >> +Set timeout for socket I/O operations. Applicable only for HTTP output. >> + >> @end table >> >> @anchor{ico} >> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c >> index 08fe0aa..5d462da 100644 >> --- a/libavformat/hlsenc.c >> +++ b/libavformat/hlsenc.c >> @@ -224,6 +224,7 @@ typedef struct HLSContext { >> int http_persistent; >> AVIOContext *m3u8_out; >> AVIOContext *sub_m3u8_out; >> +int64_t timeout; >> } HLSContext; >> >> static int mkdir_p(const char *path) { >> @@ -305,7 +306,8 @@ static void set_http_options(AVFormatContext *s, >> AVDictionary **options, HLSCont >> av_dict_set(options, "user_agent", c->user_agent, 0); >> if (c->http_persistent) >> av_dict_set_int(options, "multiple_requests", 1, 0); >> - >> +if (c->timeout >= 0) >> +av_dict_set_int(options, "timeout", c->timeout, 0); >> } >> >> static void write_codec_attr(AVStream *st, VariantStream *vs) { >> @@ -2792,6 +2794,7 @@ static const AVOption options[] = { >> {"master_pl_name", "Create HLS master playlist with this name", >> OFFSET(master_pl_name), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0,E}, >> {"master_pl_publish_rate", "Publish master play list every after this >> many segment intervals", OFFSET(master_publish_rate), AV_OPT_TYPE_INT, {.i64 >> = 0}, 0, UINT_MAX, E}, >> {"http_persistent", "Use persistent HTTP connections", >> OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E }, >> +{"timeout", "set timeout for socket I/O operations", OFFSET(timeout), >> AV_OPT_TYPE_DURATION, { .i64 = -1 }, -1, INT_MAX, .flags = E }, >> { NULL }, >> }; >> >> -- >> 1.9.1 >> > > Will apply! > Hi Steven, Could you please apply this patch. PS: following up on behalf of Ravindra Patagar Regards, Vishwanath ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavfilter: Add OpenCL convolution filter v0.1
2018-03-14 10:43 GMT+01:00, Danil Iashchenko: > About sscanf. I had (!err_code) condition, because I would never > get empty line as option (if not specified, I always have default > matrix), but changed to (err_code != 1) due to read-ability. Was this requested? I ask because several developers believe the opposite is true... [...] > --- /dev/null > +++ b/libavfilter/opencl/convolution.cl > @@ -0,0 +1,46 @@ > +/* > + * This file is part of FFmpeg. Please add your name. [...] > +for (i = 0; i < 4; i++) { > +p = ctx->matrix_str[i]; > +while (ctx->matrix_size[i] < 49) { > +if (!(arg = av_strtok(p, " ", ))) Please split this line. And ask one of the mentors to add your name to the OpenCL project on https://trac.ffmpeg.org/wiki/SponsoringPrograms/GSoC/2018 - other potential students should know that you are interested in this project and that you have (nearly) completed a qualification task. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] libavfilter: Add OpenCL convolution filter v0.1
Behaves like the existing convolution filter, except working on OpenCL hardware frames. Takes exactly the same options: 4 convolution matrices, 4 rdiv values, 4 bias values. If not specified, default parameters are applied. Matrices can be different sizes. NEW IN THIS PATCH: -fixed bug, if matrices have different dims. -renamed some variables due to readability. filter applies: matrix0, rdiv0, bias0 to image plane0. matrix1, rdiv1, bias1 to image plane1. matrix2, rdiv2, bias2 to image plane2. matrix3, rdiv3, bias3 to image plane3. About Kernel parameters: dst - destination image src - source image coef_matrices_dims - stores dimensions of matrix{0..3} consecutively one after the other coef_matrices - stores matrices{0..3} consecutively one after the other rdivs - stores rdiv{0..3} parameters consecutively one after the other biases - stores bias{0..3} parameters consecutively one after the other About sscanf. I had (!err_code) condition, because I would never get empty line as option(if not specified, I always have default matrix), but changed to (err_code != 1) due to read-ability. Also, before sscanf I split matrix with spaces, so I process each single value of matrix seperately from others and check if they are ok. about rdiv_buffer, bias_buffer, dims_buffer objects: they should be buffer objects, because they store sequence of values, not a single value --- configure | 1 + libavfilter/Makefile| 1 + libavfilter/allfilters.c| 1 + libavfilter/opencl/convolution.cl | 46 libavfilter/opencl_source.h | 1 + libavfilter/vf_convolution_opencl.c | 449 6 files changed, 499 insertions(+) create mode 100644 libavfilter/opencl/convolution.cl create mode 100644 libavfilter/vf_convolution_opencl.c diff --git a/configure b/configure index 6916b45..bf5c312 100755 --- a/configure +++ b/configure @@ -3210,6 +3210,7 @@ blackframe_filter_deps="gpl" boxblur_filter_deps="gpl" bs2b_filter_deps="libbs2b" colormatrix_filter_deps="gpl" +convolution_opencl_filter_deps="opencl" convolve_filter_deps="avcodec" convolve_filter_select="fft" coreimage_filter_deps="coreimage appkit" diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 6a60836..d005934 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -156,6 +156,7 @@ OBJS-$(CONFIG_COLORLEVELS_FILTER)+= vf_colorlevels.o OBJS-$(CONFIG_COLORMATRIX_FILTER)+= vf_colormatrix.o OBJS-$(CONFIG_COLORSPACE_FILTER) += vf_colorspace.o colorspacedsp.o OBJS-$(CONFIG_CONVOLUTION_FILTER)+= vf_convolution.o +OBJS-$(CONFIG_CONVOLUTION_OPENCL_FILTER) += vf_convolution_opencl.o opencl.o opencl/convolution.o OBJS-$(CONFIG_CONVOLVE_FILTER) += vf_convolve.o framesync.o OBJS-$(CONFIG_COPY_FILTER) += vf_copy.o OBJS-$(CONFIG_COREIMAGE_FILTER) += vf_coreimage.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 9adb109..f2dc55e 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -166,6 +166,7 @@ static void register_all(void) REGISTER_FILTER(COLORMATRIX,colormatrix,vf); REGISTER_FILTER(COLORSPACE, colorspace, vf); REGISTER_FILTER(CONVOLUTION,convolution,vf); +REGISTER_FILTER(CONVOLUTION_OPENCL, convolution_opencl, vf); REGISTER_FILTER(CONVOLVE, convolve, vf); REGISTER_FILTER(COPY, copy, vf); REGISTER_FILTER(COREIMAGE, coreimage, vf); diff --git a/libavfilter/opencl/convolution.cl b/libavfilter/opencl/convolution.cl new file mode 100644 index 000..192f1ef --- /dev/null +++ b/libavfilter/opencl/convolution.cl @@ -0,0 +1,46 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg 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. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +__kernel void convolution_global(__write_only image2d_t dst, + __read_only image2d_t src, + __constant int *coef_matrices_dims, + __constant float *coef_matrices, + __constant float *rdivs, + __constant float *biases) +{ +const sampler_t sampler =
[FFmpeg-devel] [PATCH 1/2] fftools/cmdutils: add logflags option
Allows to set the AV_LOG_PRINT_LEVEL and AV_LOG_SKIP_REPEATED flags using a distinct command-line option, similar to other flag options. Previously only the AV_LOG_SKIP_REPEATED flag was supported as a prefix to the "loglevel" option value. Signed-off-by: Tobias Rapp--- doc/fftools-common-opts.texi | 13 + fftools/cmdutils.c | 31 +++ fftools/cmdutils.h | 6 ++ 3 files changed, 50 insertions(+) diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi index 185ec21..dd69741 100644 --- a/doc/fftools-common-opts.texi +++ b/doc/fftools-common-opts.texi @@ -209,6 +209,19 @@ the environment variable @env{AV_LOG_FORCE_COLOR}. The use of the environment variable @env{NO_COLOR} is deprecated and will be dropped in a future FFmpeg version. +@item -logflags flags (@emph{global}) +Allows to set or clear logging flags. + +Possible flags for this option are: +@table @option +@item repeat +Repeated log output will not be compressed to the first line and the "Last +message repeated n times" line will be omitted. +@item level +Add a @code{[level]} prefix string to each log message. Can be used as an +alternative to log coloring e.g. when dumping the log to file. +@end table + @item -report Dump full command line and console output to a file named @code{@var{program}-@var{MMDD}-@var{HHMMSS}.log} in the current diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 0c7d13c..11fe69a 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -514,6 +514,9 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options) idx = locate_option(argc, argv, options, "v"); if (idx && argv[idx + 1]) opt_loglevel(NULL, "loglevel", argv[idx + 1]); +idx = locate_option(argc, argv, options, "logflags"); +if (idx && argv[idx + 1]) +opt_logflags(NULL, "logflags", argv[idx + 1]); idx = locate_option(argc, argv, options, "report"); if ((env = getenv("FFREPORT")) || idx) { init_report(env); @@ -918,6 +921,34 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg) return 0; } +int opt_logflags(void *optctx, const char *opt, const char *arg) +{ +static const AVOption logflags_opts[] = { +{ "flags" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" }, +/* implement AV_LOG_SKIP_REPEATED using inverse logic for consistency with the -loglevel option */ +{ "repeat", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_LOG_SKIP_REPEATED },.unit = "flags" }, +{ "level" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_LOG_PRINT_LEVEL },.unit = "flags" }, +{ NULL }, +}; +static const AVClass class = { +.class_name = "logflags", +.item_name = av_default_item_name, +.option = logflags_opts, +.version= LIBAVUTIL_VERSION_INT, +}; +const AVClass *pclass = +int flags = av_log_get_flags(); +int ret; + +flags ^= AV_LOG_SKIP_REPEATED; +if ((ret = av_opt_eval_flags(, _opts[0], arg, )) < 0) +return ret; +flags ^= AV_LOG_SKIP_REPEATED; + +av_log_set_flags(flags); +return 0; +} + static void expand_filename_template(AVBPrint *bp, const char *template, struct tm *tm) { diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h index 8724489..28735b2 100644 --- a/fftools/cmdutils.h +++ b/fftools/cmdutils.h @@ -99,6 +99,11 @@ int opt_default(void *optctx, const char *opt, const char *arg); */ int opt_loglevel(void *optctx, const char *opt, const char *arg); +/** + * Update the log flags of libav* libraries. + */ +int opt_logflags(void *optctx, const char *opt, const char *arg); + int opt_report(const char *opt); int opt_max_alloc(void *optctx, const char *opt, const char *arg); @@ -236,6 +241,7 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags, { "colors", OPT_EXIT, { .func_arg = show_colors }, "show available color names" },\ { "loglevel",HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \ { "v", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \ +{ "logflags",HAS_ARG, { .func_arg = opt_logflags }, "set logging flags", "flags" },\ { "report", 0,{ (void*)opt_report }, "generate a report" }, \ { "max_alloc", HAS_ARG, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \ { "cpuflags",HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \ -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org
[FFmpeg-devel] [PATCH 2/2] avutil/log: print level prefix also when no AVClass context is available
Adds the level prefix to all log messages, except those with level <= AV_LOG_QUIET as they seem to be used for flushing the log buffer. Signed-off-by: Tobias Rapp--- libavutil/log.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavutil/log.c b/libavutil/log.c index bd47f2a..9b7d484 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -266,11 +266,11 @@ static void format_line(void *avcl, int level, const char *fmt, va_list vl, av_bprintf(part+1, "[%s @ %p] ", avc->item_name(avcl), avcl); if(type) type[1] = get_category(avcl); - -if (flags & AV_LOG_PRINT_LEVEL) -av_bprintf(part+2, "[%s] ", get_level_str(level)); } +if (*print_prefix && (level > AV_LOG_QUIET) && (flags & AV_LOG_PRINT_LEVEL)) +av_bprintf(part+2, "[%s] ", get_level_str(level)); + av_vbprintf(part+3, fmt, vl); if(*part[0].str || *part[1].str || *part[2].str || *part[3].str) { -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] Change cube faces order to match Youtube's
On 3/14/18, Hazem Ashmawywrote: > So I'm still looking into using bilinear instead of nearest. Most of > the online discussions are in the context of computer graphics and > using things like openGL shaders. > > One solution I found and may try to implement is to add padding pixels > around each face tile in the input frame. This should help in handling > sampling near cube edges and corners. However, I'm not sure about the > complexity of this or its effect on the performance. WDYT? Either that or doing it hard way, by picking different pixels for each face. Anyway that (padding) solution doesn't sound that bad, and is much simpler than above mentioned alternative. > > Meanwhile this is a hacky/lazy way to use bilinear, but I can barely > notice any improvements > over using nearest by my bare eyes, are there any systematic way to > evaluate the quality? Not realy. One could compare with another projection conversion utility, there are at least two freely available AFAIK. > https://github.com/HazemSamir/FFmpeg/commit/fcd82b9782b5f32072d9b0516b275fe3d4f4a163 > > On 3/12/18, Paul B Mahol wrote: >> On 3/12/18, Hazem Ashmawy wrote: >>> On 3/12/18, Paul B Mahol wrote: On 3/12/18, Hazem Ashmawy wrote: > Sorry about that! Here is github branch > > https://github.com/FFmpeg/FFmpeg/compare/master...HazemSamir:panorama_youtube Good, now can you look at how to use bilinear instead of nearest interpolation for cubemap to equirectangular conversion. Nearest is extremly ugly. >>> Sure, will look into that. Just to take that into my consideration, >>> why didn't you use it at the first place? Were there any obstacles? >> >> It was non-trivial to do. >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] ffmpeg_filter: enable stream_loop in HWAccel transcoding.
From 731b6cb1f3a13fa18cfe39c1ddba92050b999668 Mon Sep 17 00:00:00 2001 From: Jun ZhaoDate: Wed, 14 Mar 2018 16:13:39 +0800 Subject: [PATCH] ffmpeg_filter: enable stream_loop in HWAccel transcoding. use the cmd: ffmpeg -y -stream_loop 1 -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i input.mp4 -c:v h264_vaapi output.mp4 can get the error like: Error while decoding stream #0:1: Invalid data found when processing input Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scaler_0' Error reinitializing filters! Failed to inject frame into filter network: Function not implemented the root cause is can't insert software scale filter in the hwaccel transcoding pipeline. Signed-off-by: Jun Zhao --- fftools/ffmpeg_filter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 877fd670e6..c85dd7ae8d 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -452,6 +452,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, int pad_idx = out->pad_idx; int ret; char name[255]; +const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(ofilter->format); snprintf(name, sizeof(name), "out_%d_%d", ost->file_index, ost->index); ret = avfilter_graph_create_filter(>filter, @@ -461,7 +462,8 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, if (ret < 0) return ret; -if (ofilter->width || ofilter->height) { +if ((ofilter->width || ofilter->height) && +(!desc || (desc && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL { char args[255]; AVFilterContext *filter; AVDictionaryEntry *e = NULL; -- 2.14.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] Change cube faces order to match Youtube's
So I'm still looking into using bilinear instead of nearest. Most of the online discussions are in the context of computer graphics and using things like openGL shaders. One solution I found and may try to implement is to add padding pixels around each face tile in the input frame. This should help in handling sampling near cube edges and corners. However, I'm not sure about the complexity of this or its effect on the performance. WDYT? Meanwhile this is a hacky/lazy way to use bilinear, but I can barely notice any improvements over using nearest by my bare eyes, are there any systematic way to evaluate the quality? https://github.com/HazemSamir/FFmpeg/commit/fcd82b9782b5f32072d9b0516b275fe3d4f4a163 On 3/12/18, Paul B Maholwrote: > On 3/12/18, Hazem Ashmawy wrote: >> On 3/12/18, Paul B Mahol wrote: >>> On 3/12/18, Hazem Ashmawy wrote: Sorry about that! Here is github branch https://github.com/FFmpeg/FFmpeg/compare/master...HazemSamir:panorama_youtube >>> >>> Good, now can you look at how to use bilinear instead of nearest >>> interpolation >>> for cubemap to equirectangular conversion. >>> >>> Nearest is extremly ugly. >>> >> Sure, will look into that. Just to take that into my consideration, >> why didn't you use it at the first place? Were there any obstacles? > > It was non-trivial to do. > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avformat/opensrt: add Haivision Open SRT protocol
Updated patch according to latest feedback : - spelling errors and capitalization - renamed option "timeout" -> "rw_timeout" - changed max values for duration parameters to INT64_MAX 0001-avformat-opensrt-add-Haivision-Open-SRT-protocol.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil/buffer: add av_buffer_fast_alloc()
On Tue, 13 Mar 2018 20:48:56 -0300 James Almerwrote: > Same concept as av_fast_malloc(). If the buffer passed to it is writable > and big enough it will be reused, otherwise a new one will be allocated > instead. > > Signed-off-by: James Almer > --- > TODO: Changelog and APIChanges entries, version bump. > > libavutil/buffer.c | 63 > ++ > libavutil/buffer.h | 42 > 2 files changed, 105 insertions(+) > > diff --git a/libavutil/buffer.c b/libavutil/buffer.c > index 8d1aa5fa84..16ce1b82e2 100644 > --- a/libavutil/buffer.c > +++ b/libavutil/buffer.c > @@ -215,6 +215,69 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) > return 0; > } > > +static av_always_inline int buffer_fast_alloc(AVBufferRef **pbuf, int size, > int zero_alloc) > +{ > +AVBufferRef *buf = *pbuf; > +AVBuffer *b; > +uint8_t *data; > + > +if (!buf || !av_buffer_is_writable(buf) || buf->data != > buf->buffer->data) { > +/* Buffer can't be reused, and neither can the entire AVBufferRef. > + * Unref the latter and alloc a new one. */ > +av_buffer_unref(pbuf); > + > +buf = av_buffer_alloc(size); > +if (!buf) > +return AVERROR(ENOMEM); > + > +if (zero_alloc) > +memset(buf->data, 0, size); > + > +*pbuf = buf; > +return 0; > +} > +b = buf->buffer; > + > +if (size <= b->size) { > +/* Buffer can be reused. Update the size of AVBufferRef but leave the > + * AVBuffer untouched. */ > +buf->size = FFMAX(0, size); > +return 0; > +} > + > +/* Buffer can't be reused, but there's no need to alloc new AVBuffer and > + * AVBufferRef structs. Free the existing buffer, allocate a new one, and > + * reset AVBuffer and AVBufferRef to default values. */ > +b->free(b->opaque, b->data); > +b->free = av_buffer_default_free; > +b->opaque = NULL; > +b->flags = 0; > + > +data = av_malloc(size); > +if (!data) { > +av_buffer_unref(pbuf); > +return AVERROR(ENOMEM); > +} > + > +if (zero_alloc) > +memset(data, 0, size); > + > +b->data = buf->data = data; > +b->size = buf->size = size; > + > +return 0; > +} > + > +int av_buffer_fast_alloc(AVBufferRef **pbuf, int size) > +{ > +return buffer_fast_alloc(pbuf, size, 0); > +} > + > +int av_buffer_fast_allocz(AVBufferRef **pbuf, int size) > +{ > +return buffer_fast_alloc(pbuf, size, 1); > +} > + > AVBufferPool *av_buffer_pool_init2(int size, void *opaque, > AVBufferRef* (*alloc)(void *opaque, int > size), > void (*pool_free)(void *opaque)) > diff --git a/libavutil/buffer.h b/libavutil/buffer.h > index 73b6bd0b14..1166017d22 100644 > --- a/libavutil/buffer.h > +++ b/libavutil/buffer.h > @@ -197,6 +197,48 @@ int av_buffer_make_writable(AVBufferRef **buf); > */ > int av_buffer_realloc(AVBufferRef **buf, int size); > > +/** > + * Allocate a buffer, reusing the given one if writable and large enough. > + * > + * @code{.c} > + * AVBufferRef *buf = ...; > + * int ret = av_buffer_fast_alloc(, size); > + * if (ret < 0) { > + * // Allocation failed; buf already freed > + * return ret; > + * } > + * @endcode > + * > + * @param buf A buffer reference. *buf may be NULL. On success, a new buffer > + * reference will be written in its place. On failure, it will be > + * unreferenced and set to NULL. > + * @param size Required buffer size. > + * > + * @return 0 on success, a negative AVERROR on failure. > + * > + * @see av_buffer_realloc() > + * @see av_buffer_fast_allocz() > + */ > +int av_buffer_fast_alloc(AVBufferRef **buf, int size); > + > +/** > + * Allocate and clear a buffer, reusing the given one if writable and large > + * enough. > + * > + * Like av_buffer_fast_alloc(), but all newly allocated space is initially > + * cleared. Reused buffer is not cleared. > + * > + * @param buf A buffer reference. *buf may be NULL. On success, a new buffer > + * reference will be written in its place. On failure, it will be > + * unreferenced and set to NULL. > + * @param size Required buffer size. > + * > + * @return 0 on success, a negative AVERROR on failure. > + * > + * @see av_buffer_fast_alloc() > + */ > +int av_buffer_fast_allocz(AVBufferRef **buf, int size); > + > /** > * @} > */ Wouldn't it be better to avoid writing a lot of new allocation code (with possibly subtle problems), and just use av_buffer_realloc() to handle reallocation? (Possibly it could be moved to an internal function to avoid the memcpy() required by realloc.) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v3] avcodec: fix atomics usage for h264/mpeg error_count
On Tue, 13 Mar 2018 19:07:33 +0100 Michael Niedermayerwrote: > On Tue, Mar 13, 2018 at 04:02:57PM +, Aman Gupta wrote: > > On Tue, Mar 13, 2018 at 4:39 AM Michael Niedermayer > > wrote: > > > > > On Mon, Mar 12, 2018 at 06:49:19PM -0700, Aman Gupta wrote: > > > > From: Aman Gupta > > > > > > > > --- > > > > libavcodec/h264_slice.c| 5 +++-- > > > > libavcodec/mpeg12dec.c | 12 +++- > > > > libavcodec/mpegvideo_enc.c | 3 ++- > > > > 3 files changed, 12 insertions(+), 8 deletions(-) > > > > > > Iam a little bit confused, you write about "fixing" but not what this is > > > fixing and it appears there are several distinct types of changes > > > > > > The type of error_count is already atomic_int. I don't know when that was > > changed. > > > > The fix here is that these files do not compile on FreeBSD because of > > errors such as: > > > > [2018-03-11 18:26:55.078686] [freebsd-x86_64] libavcodec/mpegvideo_enc.c: > > In function 'merge_context_after_encode': > > > > [2018-03-11 18:26:55.081607] [freebsd-x86_64] > > libavcodec/mpegvideo_enc.c:3578:33: error: invalid operands to binary + > > (have 'atomic_int' and 'atomic_int') > > > > > > [2018-03-11 16:43:23.543072] [freebsd-x86_64] CClibavcodec/mpeg12dec.o > > > > [2018-03-11 16:43:23.768864] [freebsd-x86_64] libavcodec/mpeg12dec.c: In > > function 'slice_decode_thread': > > > > > [2018-03-11 16:43:23.769713] [freebsd-x86_64] > > libavcodec/mpeg12dec.c:1996:23: error: incompatible types when assigning to > > type 'atomic_int' from type 'int' > > what compiler is this ? > 6.5.16.1 Simple assignment > Constraints > One of the following shall hold: 114) > — the left operand has atomic, qualified, or unqualified arithmetic type, > and the right has > arithmetic type; > > Please someone correct me here if iam wrong but > To me this sounds like doing normal arithmetic operations between atomic and > non atomic arithmetic types is allowed. It's true that C11 atomics allow direct access, but we also have some atomic wrappers that won't work correctly then. I haven't checked why this one fails, but the gcc compat wrappers use non-atomic types for the emulation, so this patch is justified and necessary. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/hapqa_extract: remove the AVOption flags
2018-03-14 2:09 GMT+01:00 James Almer: > These two are not used for bitstream filters. > > Signed-off-by: James Almer > --- > libavcodec/hapqa_extract_bsf.c | 7 +++ > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/libavcodec/hapqa_extract_bsf.c b/libavcodec/hapqa_extract_ > bsf.c > index ee5dc191f7..652f79a7fe 100644 > --- a/libavcodec/hapqa_extract_bsf.c > +++ b/libavcodec/hapqa_extract_bsf.c > @@ -110,11 +110,10 @@ static const enum AVCodecID codec_ids[] = { > }; > > #define OFFSET(x) offsetof(HapqaExtractContext, x) > -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM > static const AVOption options[] = { > -{ "texture", "texture to keep", OFFSET(texture), AV_OPT_TYPE_INT, { > .i64 = 0 }, 0, 1, FLAGS, "texture" }, > -{ "color", "keep HapQ texture", 0, AV_OPT_TYPE_CONST, { .i64 = 0 > }, 0, 0, FLAGS, "texture" }, > -{ "alpha", "keep HapAlphaOnly texture", 0, AV_OPT_TYPE_CONST, { > .i64 = 1 }, 0, 0, FLAGS, "texture" }, > +{ "texture", "texture to keep", OFFSET(texture), AV_OPT_TYPE_INT, { > .i64 = 0 }, 0, 1, 0, "texture" }, > +{ "color", "keep HapQ texture", 0, AV_OPT_TYPE_CONST, { > .i64 = 0 }, .unit = "texture" }, > +{ "alpha", "keep HapAlphaOnly texture", 0, AV_OPT_TYPE_CONST, { > .i64 = 1 }, .unit = "texture" }, > { NULL }, > }; > > > ok Martin ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] fate/hap : add test for hap encoding
2018-03-14 1:48 GMT+01:00 James Almer: > On 3/13/2018 4:31 PM, Martin Vignali wrote: > > 2018-03-11 19:37 GMT+01:00 Martin Vignali : > > > >> > >> > >> 2017-11-26 18:25 GMT+01:00 Martin Vignali : > >> > >>> Hello, > >>> > >>> Patch in attach, add test for hap encoding (currently not cover) (patch > >>> 002) > >>> and move decoding tests to a separate file (patch 001) > >>> > >>> decoding can be test with > >>> make fate-hap SAMPLES=fate-suite/ > >>> > >>> and encoding can be test with > >>> make fate-hapenc SAMPLES=fate-suite/ > >>> > >>> Hap encoding need ffmpeg compile with libsnappy (--enable-libsnappy) > >>> > >>> > >> If noone is against, > >> i plan to apply this in few days. > >> > >> In attach, updated patch (in order to apply it on master). > >> > >> Martin > >> > >> > > Pushed. > > > > Martin > > These tests are failing > http://fate.ffmpeg.org/report.cgi?slot=x86_64-archlinux-gcc- > enableshared=20180313201913 > > I'm with Carl, there's a reason we don't tests wrappers using external > libraries. The output for such tests is unpredictable and depends on a > lot of external factors we can't control, so please remove these tests. > In that case we can let the test using "none" compression (bypass the snappy part) and remove only snappy1 and snappy16 test Like in patch in attach. Please apply, if it's ok, i will can't do it soon. Martin 0001-fate-hapenc-remove-test-which-use-libsnappy.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 10/10] lavf/movenc: handle AC3 and EAC3 data extraction in check_bitstream
This allows us to write AC3 and EAC3 data to the header even in non-seekable output, like with segment.c (which I add tests for). --- libavformat/movenc.c | 64 +--- tests/fate/avformat.mak | 60 +- tests/ref/fate/segment-ac3-to-mp4-header-000 | 38 ++ tests/ref/fate/segment-ac3-to-mp4-header-001 | 30 +++ tests/ref/fate/segment-ac3-to-mp4-header-all | 62 +++ tests/ref/fate/segment-ac3-to-mp4-header-md5sum | 1 + tests/ref/fate/segment-eac3-to-mp4-header-000| 38 ++ tests/ref/fate/segment-eac3-to-mp4-header-001| 21 tests/ref/fate/segment-eac3-to-mp4-header-all| 53 tests/ref/fate/segment-eac3-to-mp4-header-md5sum | 1 + 10 files changed, 348 insertions(+), 20 deletions(-) create mode 100644 tests/ref/fate/segment-ac3-to-mp4-header-000 create mode 100644 tests/ref/fate/segment-ac3-to-mp4-header-001 create mode 100644 tests/ref/fate/segment-ac3-to-mp4-header-all create mode 100644 tests/ref/fate/segment-ac3-to-mp4-header-md5sum create mode 100644 tests/ref/fate/segment-eac3-to-mp4-header-000 create mode 100644 tests/ref/fate/segment-eac3-to-mp4-header-001 create mode 100644 tests/ref/fate/segment-eac3-to-mp4-header-all create mode 100644 tests/ref/fate/segment-eac3-to-mp4-header-md5sum diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b5ef09c4c7..1f15d244ed 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -368,11 +368,11 @@ struct eac3_info { }; #if CONFIG_AC3_PARSER -static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track) +static int parse_eac3(MOVMuxContext *mov, const AVPacket *pkt, MOVTrack *track, int *num_blocks) { AC3HeaderInfo *hdr = NULL; struct eac3_info *info; -int num_blocks, ret; +int ret = 1; if (!track->eac3_priv && !(track->eac3_priv = av_mallocz(sizeof(*info return AVERROR(ENOMEM); @@ -389,7 +389,8 @@ static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track) } info->data_rate = FFMAX(info->data_rate, hdr->bit_rate / 1000); -num_blocks = hdr->num_blocks; +if (num_blocks) +*num_blocks = hdr->num_blocks; if (!info->ec3_done) { /* AC-3 substream must be the first one */ @@ -415,7 +416,7 @@ static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track) } else if (hdr->substreamid < info->num_ind_sub || hdr->substreamid == 0 && info->substream[0].bsid) { info->ec3_done = 1; -goto concatenate; +goto end; } } @@ -465,44 +466,53 @@ static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track) } } -concatenate: +end: +av_free(hdr); + +return ret; +} + +static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track) +{ +int num_blocks; +struct eac3_info *info; +int ret = parse_eac3(mov, pkt, track, _blocks); +if (ret <= 0) +return ret; + +info = track->eac3_priv; + if (!info->num_blocks && num_blocks == 6) { -ret = pkt->size; -goto end; +return pkt->size; } else if (info->num_blocks + num_blocks > 6) { -ret = AVERROR_INVALIDDATA; -goto end; +return AVERROR_INVALIDDATA; } if (!info->num_blocks) { ret = av_packet_ref(>pkt, pkt); if (!ret) info->num_blocks = num_blocks; -goto end; +return ret; } else { if ((ret = av_grow_packet(>pkt, pkt->size)) < 0) -goto end; +return ret; memcpy(info->pkt.data + info->pkt.size - pkt->size, pkt->data, pkt->size); info->num_blocks += num_blocks; info->pkt.duration += pkt->duration; if ((ret = av_copy_packet_side_data(>pkt, pkt)) < 0) -goto end; +return ret; if (info->num_blocks != 6) -goto end; +return ret; av_packet_unref(pkt); ret = av_packet_ref(pkt, >pkt); if (ret < 0) -goto end; +return ret; av_packet_unref(>pkt); info->num_blocks = 0; } -ret = pkt->size; - -end: -av_free(hdr); -return ret; +return pkt->size; } #endif @@ -6572,12 +6582,28 @@ static int mov_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) { int ret = 1; AVStream *st = s->streams[pkt->stream_index]; +MOVMuxContext *mov = s->priv_data; +MOVTrack *trk = >tracks[pkt->stream_index]; if (st->codecpar->codec_id == AV_CODEC_ID_AAC) { if (pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) ret = ff_stream_add_bitstream_filter(st, "aac_adtstoasc", NULL); } else if (st->codecpar->codec_id == AV_CODEC_ID_VP9) { ret =
[FFmpeg-devel] [PATCH 06/10] Revert "avformat/mux: stop delaying writing the header"
This reverts commit d6d605eb05c3ca32f591016c345eb2ad9e81c554. --- libavformat/avformat.h | 2 +- libavformat/internal.h | 6 + libavformat/mux.c | 52 ++ libavformat/options_table.h| 2 +- libavformat/tests/fifo_muxer.c | 52 ++ tests/ref/fate/fifo-muxer-tst | 1 + tests/ref/fate/rgb24-mkv | 4 ++-- 7 files changed, 105 insertions(+), 14 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index a2fe7c6bb2..9e87d6cdac 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1482,7 +1482,7 @@ typedef struct AVFormatContext { #endif #define AVFMT_FLAG_FAST_SEEK 0x8 ///< Enable fast, but inaccurate seeks for some formats #define AVFMT_FLAG_SHORTEST 0x10 ///< Stop muxing when the shortest stream stops. -#define AVFMT_FLAG_AUTO_BSF 0x20 ///< Add bitstream filters as requested by the muxer +#define AVFMT_FLAG_AUTO_BSF 0x20 ///< Wait for packet data before writing a header, and add bitstream filters as requested by the muxer /** * Maximum size of the data read from input for determining diff --git a/libavformat/internal.h b/libavformat/internal.h index a020b1b417..666e2054a7 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -120,6 +120,12 @@ struct AVFormatInternal { int avoid_negative_ts_use_pts; +/** + * Whether or not a header has already been written + */ +int header_written; +int write_header_ret; + /** * Timestamp of the end of the shortest stream. */ diff --git a/libavformat/mux.c b/libavformat/mux.c index a13f0e3a1b..5fdc9275cc 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -485,6 +485,25 @@ static void flush_if_needed(AVFormatContext *s) } } +static int write_header_internal(AVFormatContext *s) +{ +if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb) +avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_HEADER); +if (s->oformat->write_header) { +int ret = s->oformat->write_header(s); +if (ret >= 0 && s->pb && s->pb->error < 0) +ret = s->pb->error; +s->internal->write_header_ret = ret; +if (ret < 0) +return ret; +flush_if_needed(s); +} +s->internal->header_written = 1; +if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb) +avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_UNKNOWN); +return 0; +} + int avformat_init_output(AVFormatContext *s, AVDictionary **options) { int ret = 0; @@ -515,18 +534,11 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options) if ((ret = avformat_init_output(s, options)) < 0) return ret; -if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb) -avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_HEADER); -if (s->oformat->write_header) { -ret = s->oformat->write_header(s); -if (ret >= 0 && s->pb && s->pb->error < 0) -ret = s->pb->error; +if (!(s->oformat->check_bitstream && s->flags & AVFMT_FLAG_AUTO_BSF)) { +ret = write_header_internal(s); if (ret < 0) goto fail; -flush_if_needed(s); } -if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb) -avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_UNKNOWN); if (!s->internal->streams_initialized) { if ((ret = init_pts(s)) < 0) @@ -738,6 +750,12 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) } } +if (!s->internal->header_written) { +ret = s->internal->write_header_ret ? s->internal->write_header_ret : write_header_internal(s); +if (ret < 0) +goto fail; +} + if ((pkt->flags & AV_PKT_FLAG_UNCODED_FRAME)) { AVFrame *frame = (AVFrame *)pkt->data; av_assert0(pkt->size == UNCODED_FRAME_PACKET_SIZE); @@ -753,6 +771,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) ret = s->pb->error; } +fail: + if (ret < 0) { pkt->pts = pts_backup; pkt->dts = dts_backup; @@ -885,6 +905,11 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt) if (!pkt) { if (s->oformat->flags & AVFMT_ALLOW_FLUSH) { +if (!s->internal->header_written) { +ret = s->internal->write_header_ret ? s->internal->write_header_ret : write_header_internal(s); +if (ret < 0) +return ret; +} ret = s->oformat->write_packet(s, NULL); flush_if_needed(s); if (ret >= 0 && s->pb && s->pb->error < 0) @@ -1268,8 +1293,14 @@ int av_write_trailer(AVFormatContext *s) goto fail; } +if (!s->internal->header_written) { +ret = s->internal->write_header_ret ? s->internal->write_header_ret : write_header_internal(s); +if (ret < 0)
[FFmpeg-devel] [PATCH 09/10] lavf/mux: propagate extradata changes before we call write_header to codecpar
This includes extradata generated by an encoder post-init, or extradata generated by automatically-added bsfs. This fixes remuxing ADTS to non-seekable MKV, which had been broken in f63c3516577d605e51cf16358cbdfa0bc97565d8, so the tests modified there are restored. This moves extradata writing in aac-autobsf-adtstoasc to write_header, resulting in a smaller file since we don't write a padding void, so that test reference is also updated. --- libavformat/mux.c| 14 ++ tests/fate/avformat.mak | 4 ++-- tests/ref/fate/aac-autobsf-adtstoasc | 4 ++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/libavformat/mux.c b/libavformat/mux.c index 5fdc9275cc..611a3c0f15 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -892,6 +892,20 @@ static int do_packet_auto_bsf(AVFormatContext *s, AVPacket *pkt) { return 0; } } + +if (!s->internal->header_written) { +int side_size; +uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, _size); +if (side && side_size > 0 && (side_size != st->codecpar->extradata_size || + memcmp(side, st->codecpar->extradata, side_size))) { +av_freep(>codecpar->extradata); +if ((ret = ff_alloc_extradata(st->codecpar, side_size)) < 0) +return ret; +memcpy(st->codecpar->extradata, side, side_size); +st->codecpar->extradata_size = side_size; +} +} + return 1; } diff --git a/tests/fate/avformat.mak b/tests/fate/avformat.mak index 346a4b4509..35a75c68c0 100644 --- a/tests/fate/avformat.mak +++ b/tests/fate/avformat.mak @@ -95,14 +95,14 @@ tests/data/mp4-to-ts.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data tests/data/adts-to-mkv.m3u8: TAG = GEN tests/data/adts-to-mkv.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \ --i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.m4a \ +-i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts \ -f segment -segment_time 1 -map 0 -flags +bitexact -codec copy -segment_format_options live=1 \ -segment_list $(TARGET_PATH)/$@ -y $(TARGET_PATH)/tests/data/adts-to-mkv-%03d.mkv -nostdin 2>/dev/null tests/data/adts-to-mkv-header.mkv: TAG = GEN tests/data/adts-to-mkv-header.mkv: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \ --i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.m4a \ +-i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts \ -f segment -segment_time 1 -map 0 -flags +bitexact -codec copy -segment_format_options live=1 \ -segment_header_filename $(TARGET_PATH)/tests/data/adts-to-mkv-header.mkv \ -y $(TARGET_PATH)/tests/data/adts-to-mkv-header-%03d.mkv -nostdin 2>/dev/null diff --git a/tests/ref/fate/aac-autobsf-adtstoasc b/tests/ref/fate/aac-autobsf-adtstoasc index 9ca8e7ed9e..d5dfbabe5f 100644 --- a/tests/ref/fate/aac-autobsf-adtstoasc +++ b/tests/ref/fate/aac-autobsf-adtstoasc @@ -1,5 +1,5 @@ -b0375ba00bcbd55023a176255b8d4ba2 *tests/data/fate/aac-autobsf-adtstoasc.matroska -6728 tests/data/fate/aac-autobsf-adtstoasc.matroska +1bd4a110db26231cade5344de302254e *tests/data/fate/aac-autobsf-adtstoasc.matroska +6396 tests/data/fate/aac-autobsf-adtstoasc.matroska #extradata 0:2, 0x0030001c #tb 0: 1/1000 #media_type 0: audio -- 2.16.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 08/10] lavf/matroskaenc: don't rewrite extradata if we already have some
matroska doesn't support mid-stream extradata changes, and rewriting the same extradata already written in write_header would cause errors since we previously didn't write a filler void. --- libavformat/matroskaenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 5950b4de44..e4db5a9a1c 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -2266,7 +2266,8 @@ static int mkv_check_new_extra_data(AVFormatContext *s, AVPacket *pkt) switch (par->codec_id) { case AV_CODEC_ID_AAC: -if (side_data_size && (s->pb->seekable & AVIO_SEEKABLE_NORMAL) && !mkv->is_live) { +if (side_data_size && !par->extradata_size && +(s->pb->seekable & AVIO_SEEKABLE_NORMAL) && !mkv->is_live) { int filler, output_sample_rate = 0; int64_t curpos; ret = get_aac_sample_rates(s, side_data, side_data_size, >sample_rate, -- 2.16.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 04/10] lavf/dashenc: remove unneeded call to dash_free
--- libavformat/dashenc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 79d63e52d4..5689aef811 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -1030,10 +1030,8 @@ static int dash_write_header(AVFormatContext *s) int i, ret; for (i = 0; i < s->nb_streams; i++) { OutputStream *os = >streams[i]; -if ((ret = avformat_write_header(os->ctx, NULL)) < 0) { -dash_free(s); +if ((ret = avformat_write_header(os->ctx, NULL)) < 0) return ret; -} } ret = write_manifest(s, 0); if (!ret) -- 2.16.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 07/10] lavf: document that AVStream::codecpar may be modified by lavf after avformat_write_header(). This is assumed not to break API because it's already true (see e.g. matroska
--- libavformat/avformat.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 9e87d6cdac..5f0ebfc114 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1006,7 +1006,8 @@ typedef struct AVStream { * * - demuxing: filled by libavformat on stream creation or in * avformat_find_stream_info() - * - muxing: filled by the caller before avformat_write_header() + * - muxing: filled by the caller before avformat_write_header(); + * - may be modified by libavformat afterwards */ AVCodecParameters *codecpar; -- 2.16.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 05/10] lavf/dashenc: don't call flush_init_segment before avformat_write_header
Fixes crash when muxing MKV-in-DASH --- libavformat/dashenc.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 5689aef811..63ff827583 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -985,13 +985,6 @@ static int dash_init(AVFormatContext *s) av_log(s, AV_LOG_VERBOSE, "Representation %d init segment will be written to: %s\n", i, filename); -// Flush init segment -// except for mp4, since delay_moov is set and the init segment -// is then flushed after the first packets -if (strcmp(os->format_name, "mp4")) { -flush_init_segment(s, os); -} - s->streams[i]->time_base = st->time_base; // If the muxer wants to shift timestamps, request to have them shifted // already before being handed to this muxer, so we don't have mismatches @@ -1032,6 +1025,9 @@ static int dash_write_header(AVFormatContext *s) OutputStream *os = >streams[i]; if ((ret = avformat_write_header(os->ctx, NULL)) < 0) return ret; + +if ((ret = flush_init_segment(s, os)) < 0) +return ret; } ret = write_manifest(s, 0); if (!ret) -- 2.16.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 01/10] FATE: add -nostdin to remaining ffmpeg CLI invocations
This prevents ffmpeg from modifying terminal parameters, which resulted in broken terminals after tests nondeterministically when multiple processes attempted to save and restore the state at the same time. --- tests/fate/avformat.mak | 6 +++--- tests/fate/filter-audio.mak | 4 ++-- tests/fate/filter-video.mak | 4 ++-- tests/fate/fits.mak | 4 ++-- tests/fate/flvenc.mak | 2 +- tests/fate/hevc.mak | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/fate/avformat.mak b/tests/fate/avformat.mak index a12f9ccc71..346a4b4509 100644 --- a/tests/fate/avformat.mak +++ b/tests/fate/avformat.mak @@ -90,14 +90,14 @@ tests/data/mp4-to-ts.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \ -i $(TARGET_SAMPLES)/h264/interlaced_crop.mp4 \ -f ssegment -segment_time 1 -map 0 -flags +bitexact -codec copy \ --segment_list $(TARGET_PATH)/$@ -y $(TARGET_PATH)/tests/data/mp4-to-ts-%03d.ts 2>/dev/null +-segment_list $(TARGET_PATH)/$@ -y $(TARGET_PATH)/tests/data/mp4-to-ts-%03d.ts -nostdin 2>/dev/null tests/data/adts-to-mkv.m3u8: TAG = GEN tests/data/adts-to-mkv.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \ -i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.m4a \ -f segment -segment_time 1 -map 0 -flags +bitexact -codec copy -segment_format_options live=1 \ --segment_list $(TARGET_PATH)/$@ -y $(TARGET_PATH)/tests/data/adts-to-mkv-%03d.mkv 2>/dev/null +-segment_list $(TARGET_PATH)/$@ -y $(TARGET_PATH)/tests/data/adts-to-mkv-%03d.mkv -nostdin 2>/dev/null tests/data/adts-to-mkv-header.mkv: TAG = GEN tests/data/adts-to-mkv-header.mkv: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data @@ -105,7 +105,7 @@ tests/data/adts-to-mkv-header.mkv: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data -i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.m4a \ -f segment -segment_time 1 -map 0 -flags +bitexact -codec copy -segment_format_options live=1 \ -segment_header_filename $(TARGET_PATH)/tests/data/adts-to-mkv-header.mkv \ --y $(TARGET_PATH)/tests/data/adts-to-mkv-header-%03d.mkv 2>/dev/null +-y $(TARGET_PATH)/tests/data/adts-to-mkv-header-%03d.mkv -nostdin 2>/dev/null tests/data/adts-to-mkv-header-%.mkv: tests/data/adts-to-mkv-header.mkv ; diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak index 2a3ba1992f..5c5a762f09 100644 --- a/tests/fate/filter-audio.mak +++ b/tests/fate/filter-audio.mak @@ -181,7 +181,7 @@ tests/data/hls-list.m3u8: TAG = GEN tests/data/hls-list.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \ -f lavfi -i "aevalsrc=cos(2*PI*t)*sin(2*PI*(440+4*t)*t):d=20" -f segment -segment_time 10 -map 0 -flags +bitexact -codec:a mp2fixed \ --segment_list $(TARGET_PATH)/$@ -y $(TARGET_PATH)/tests/data/hls-out-%03d.ts 2>/dev/null +-segment_list $(TARGET_PATH)/$@ -y $(TARGET_PATH)/tests/data/hls-out-%03d.ts -nostdin 2>/dev/null FATE_AFILTER-$(call ALLYES, HLS_DEMUXER MPEGTS_MUXER MPEGTS_DEMUXER AEVALSRC_FILTER LAVFI_INDEV MP2FIXED_ENCODER) += fate-filter-hls fate-filter-hls: tests/data/hls-list.m3u8 @@ -195,7 +195,7 @@ tests/data/hls-list-append.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data $(TARGET_EXEC) $(TARGET_PATH)/$< \ -f lavfi -i "aevalsrc=cos(2*PI*t)*sin(2*PI*(440+4*t)*t):d=20" -f hls -hls_time 10 -map 0 -flags +bitexact \ -hls_flags append_list -codec:a mp2fixed -hls_segment_filename $(TARGET_PATH)/tests/data/hls-append-out-%03d.ts \ -$(TARGET_PATH)/tests/data/hls-list-append.m3u8 2>/dev/null +$(TARGET_PATH)/tests/data/hls-list-append.m3u8 -nostdin 2>/dev/null FATE_AFILTER-$(call ALLYES, HLS_DEMUXER MPEGTS_MUXER MPEGTS_DEMUXER AEVALSRC_FILTER LAVFI_INDEV MP2FIXED_ENCODER) += fate-filter-hls-append fate-filter-hls-append: tests/data/hls-list-append.m3u8 diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index 07572143a8..5814bc8551 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -611,7 +611,7 @@ fate-filter-tile: CMD = video_filter "tile=3x3:nb_frames=5:padding=7:margin=2" tests/pixfmts.mak: TAG = GEN tests/pixfmts.mak: ffmpeg$(PROGSSUF)$(EXESUF) | tests $(M)printf "PIXFMTS = " > $@ - $(Q)$(TARGET_EXEC) $(TARGET_PATH)/$< -pix_fmts list 2> /dev/null | awk 'NR > 8 && /^IO/ { printf $$2 " " }' >> $@ + $(Q)$(TARGET_EXEC) $(TARGET_PATH)/$< -pix_fmts list -nostdin 2> /dev/null | awk 'NR > 8 && /^IO/ { printf $$2 " " }' >> $@ $(Q)printf "\n" >> $@ RUNNING_PIXFMTS_TESTS := $(filter check fate fate-list fate-filter fate-vfilter fate-filter-pixdesc%,$(MAKECMDGOALS)) @@ -758,7 +758,7 @@ fate-filter-metadata-avf-aphase-meter-out-of-phase: CMD = run $(FILTER_METADATA_ tests/data/file4560-override2rotate0.mov: TAG = GEN
[FFmpeg-devel] [PATCH 03/10] lavf/movenc: keep eac3_priv around; fixes eac3 in DASH
DASH muxing sometimes calls mov_write_eac3_tag multiple times on the same stream. We need to keep this data around so it's available in the second call, else we won't write the data QuickTime needs. --- libavformat/movenc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index accab417f6..b5ef09c4c7 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -554,7 +554,6 @@ static int mov_write_eac3_tag(AVIOContext *pb, MOVTrack *track) end: av_packet_unref(>pkt); -av_freep(>eac3_priv); return size; } -- 2.16.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 02/10] lavf/movenc: fix leak of eac3_priv
This could previously happen in error or early-exit cases. The next commit would make it happen in all cases. --- libavformat/movenc.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 5b1e66c897..accab417f6 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -5773,6 +5773,12 @@ static void mov_free(AVFormatContext *s) av_freep(>tracks[i].cluster); av_freep(>tracks[i].frag_info); +if (mov->tracks[i].eac3_priv) { +struct eac3_info *info = mov->tracks[i].eac3_priv; +av_packet_unref(>pkt); +av_freep(>tracks[i].eac3_priv); +} + if (mov->tracks[i].vos_len) av_freep(>tracks[i].vos_data); -- 2.16.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel