[FFmpeg-devel] [PATCH 1/3] avfilter/vf_sr: fix read out of bounds
--- libavfilter/vf_sr.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c index 5ad1baa..26cacde 100644 --- a/libavfilter/vf_sr.c +++ b/libavfilter/vf_sr.c @@ -239,7 +239,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) 0, sr_context->sws_slice_h, out->data, out->linesize); sws_scale(sr_context->sws_contexts[1], (const uint8_t **)out->data, out->linesize, - 0, out->height, (uint8_t * const*)(&sr_context->input.data), &sr_context->sws_input_linesize); + 0, out->height, (uint8_t * const*)(&sr_context->input.data), + (int [4]){sr_context->sws_input_linesize, 0, 0, 0}); break; case ESPCN: if (sr_context->sws_contexts[0]){ @@ -250,7 +251,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } sws_scale(sr_context->sws_contexts[1], (const uint8_t **)in->data, in->linesize, - 0, in->height, (uint8_t * const*)(&sr_context->input.data), &sr_context->sws_input_linesize); + 0, in->height, (uint8_t * const*)(&sr_context->input.data), + (int [4]){sr_context->sws_input_linesize, 0, 0, 0}); } av_frame_free(&in); @@ -260,7 +262,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) return AVERROR(EIO); } -sws_scale(sr_context->sws_contexts[2], (const uint8_t **)(&sr_context->output.data), &sr_context->sws_output_linesize, +sws_scale(sr_context->sws_contexts[2], (const uint8_t **)(&sr_context->output.data), + (int [4]){sr_context->sws_output_linesize, 0, 0, 0}, 0, out->height, (uint8_t * const*)out->data, out->linesize); return ff_filter_frame(outlink, out); -- 2.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/3] avfilter/dnn_backend_native: fix memleak
--- libavfilter/dnn_backend_native.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavfilter/dnn_backend_native.c b/libavfilter/dnn_backend_native.c index 7ed155d..3108185 100644 --- a/libavfilter/dnn_backend_native.c +++ b/libavfilter/dnn_backend_native.c @@ -489,6 +489,7 @@ void ff_dnn_free_model_native(DNNModel **model) } av_freep(&network->layers[layer].params); } +av_freep(&network->layers); av_freep(&network); av_freep(model); } -- 2.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/3] avfilter/dnn_backend_native: fix invalid free
--- libavfilter/dnn_backend_native.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/dnn_backend_native.c b/libavfilter/dnn_backend_native.c index baefea7..7ed155d 100644 --- a/libavfilter/dnn_backend_native.c +++ b/libavfilter/dnn_backend_native.c @@ -489,7 +489,7 @@ void ff_dnn_free_model_native(DNNModel **model) } av_freep(&network->layers[layer].params); } -av_freep(network); +av_freep(&network); av_freep(model); } } -- 2.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avfilter/vf_sr: fix read out of bounds
--- libavfilter/vf_sr.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c index 5ad1baa..bc9d186 100644 --- a/libavfilter/vf_sr.c +++ b/libavfilter/vf_sr.c @@ -239,7 +239,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) 0, sr_context->sws_slice_h, out->data, out->linesize); sws_scale(sr_context->sws_contexts[1], (const uint8_t **)out->data, out->linesize, - 0, out->height, (uint8_t * const*)(&sr_context->input.data), &sr_context->sws_input_linesize); + 0, out->height, (uint8_t * const*)(&sr_context->input.data), + (const int [4]){sr_context->sws_input_linesize, 0, 0, 0}); break; case ESPCN: if (sr_context->sws_contexts[0]){ @@ -250,7 +251,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } sws_scale(sr_context->sws_contexts[1], (const uint8_t **)in->data, in->linesize, - 0, in->height, (uint8_t * const*)(&sr_context->input.data), &sr_context->sws_input_linesize); + 0, in->height, (uint8_t * const*)(&sr_context->input.data), + (const int [4]){sr_context->sws_input_linesize, 0, 0, 0}); } av_frame_free(&in); @@ -260,7 +262,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) return AVERROR(EIO); } -sws_scale(sr_context->sws_contexts[2], (const uint8_t **)(&sr_context->output.data), &sr_context->sws_output_linesize, +sws_scale(sr_context->sws_contexts[2], (const uint8_t **)(&sr_context->output.data), + (const int [4]){sr_context->sws_output_linesize, 0, 0, 0}, 0, out->height, (uint8_t * const*)out->data, out->linesize); return ff_filter_frame(outlink, out); -- 2.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] avfilter/vf_sr: fix read out of bounds
Please drop this one. I have sent a version use const int array. On 2018年09月13日 15:49, Zhao Zhili wrote: --- libavfilter/vf_sr.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c index 5ad1baa..26cacde 100644 --- a/libavfilter/vf_sr.c +++ b/libavfilter/vf_sr.c @@ -239,7 +239,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) 0, sr_context->sws_slice_h, out->data, out->linesize); sws_scale(sr_context->sws_contexts[1], (const uint8_t **)out->data, out->linesize, - 0, out->height, (uint8_t * const*)(&sr_context->input.data), &sr_context->sws_input_linesize); + 0, out->height, (uint8_t * const*)(&sr_context->input.data), + (int [4]){sr_context->sws_input_linesize, 0, 0, 0}); break; case ESPCN: if (sr_context->sws_contexts[0]){ @@ -250,7 +251,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } sws_scale(sr_context->sws_contexts[1], (const uint8_t **)in->data, in->linesize, - 0, in->height, (uint8_t * const*)(&sr_context->input.data), &sr_context->sws_input_linesize); + 0, in->height, (uint8_t * const*)(&sr_context->input.data), + (int [4]){sr_context->sws_input_linesize, 0, 0, 0}); } av_frame_free(&in); @@ -260,7 +262,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) return AVERROR(EIO); } -sws_scale(sr_context->sws_contexts[2], (const uint8_t **)(&sr_context->output.data), &sr_context->sws_output_linesize, +sws_scale(sr_context->sws_contexts[2], (const uint8_t **)(&sr_context->output.data), + (int [4]){sr_context->sws_output_linesize, 0, 0, 0}, 0, out->height, (uint8_t * const*)out->data, out->linesize); return ff_filter_frame(outlink, out); ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Revert "avcodec/decode: copy the output parameters from the last bsf in the chain back to the AVCodecContext"
So, what do we do now? Honor the doxy and stop trying to manipulate what's meant to be an user owned pointer/buffer, officially break the API and declare it's meant to be allocated by the user but then ownership is passed to the library during or after the avcodec_open2() call, or just revert this commit and pretend nothing happened? Documenting the API break that already happened seems like the least bad option right now. Firefox already merged code to work around the crash. It already is freed in multiple places, so existing code probably already is compatible. No solution to this is overly pretty unfortunately. Specially as this goes along with likely leaking the extradata pointer, as unconditionally freeing it will most definitely cause crashes left and right. 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] avcodec: add native iLBC decoder
Signed-off-by: Paul B Mahol --- libavcodec/Makefile|1 + libavcodec/allcodecs.c |1 + libavcodec/ilbcdata.h | 263 +++ libavcodec/ilbcdec.c | 1507 4 files changed, 1772 insertions(+) create mode 100644 libavcodec/ilbcdata.h create mode 100644 libavcodec/ilbcdec.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 3e16a13004..f619f300e7 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -384,6 +384,7 @@ OBJS-$(CONFIG_HUFFYUV_ENCODER) += huffyuv.o huffyuvenc.o OBJS-$(CONFIG_IDCIN_DECODER) += idcinvideo.o OBJS-$(CONFIG_IDF_DECODER) += bintext.o cga_data.o OBJS-$(CONFIG_IFF_ILBM_DECODER)+= iff.o +OBJS-$(CONFIG_ILBC_DECODER)+= ilbcdec.o OBJS-$(CONFIG_IMC_DECODER) += imc.o OBJS-$(CONFIG_IMM4_DECODER)+= imm4.o OBJS-$(CONFIG_INDEO2_DECODER) += indeo2.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 7dbfcb3dda..c0b4d56d0d 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -424,6 +424,7 @@ extern AVCodec ff_g729_decoder; extern AVCodec ff_gsm_decoder; extern AVCodec ff_gsm_ms_decoder; extern AVCodec ff_iac_decoder; +extern AVCodec ff_ilbc_decoder; extern AVCodec ff_imc_decoder; extern AVCodec ff_interplay_acm_decoder; extern AVCodec ff_mace3_decoder; diff --git a/libavcodec/ilbcdata.h b/libavcodec/ilbcdata.h new file mode 100644 index 00..62b32a541f --- /dev/null +++ b/libavcodec/ilbcdata.h @@ -0,0 +1,263 @@ +/* + * Copyright (c) 2013, The WebRTC project authors. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Google nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * iLBC decoder + * + * 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 + */ + +#ifndef AVCODEC_ILBCDATA_H +#define AVCODEC_ILBCDATA_H + +#include "libavutil/common.h" + +static const uint8_t lsf_dim_codebook[] = { 3, 3, 4 }; +static const uint8_t lsf_size_codebook[] = { 64, 128, 128 }; +static const int16_t lsf_weight_20ms[] = { 12288, 8192, 4096, 0 }; +static const int16_t lsf_weight_30ms[] = { 8192, 16384, 10923, 5461, 0, 0 }; + +static const int16_t hp_out_coeffs[] = { 3849, -7699, 3849, 7918, -3833 }; + +static const int16_t kPlcPfSlope[] = { 26667, 18729, 13653, 10258, 7901, 6214 }; + +static const int16_t kPlcPitchFact[] = { 0, 5462, 10922, 16384, 21846, 27306 }; + +static const int16_t kCbFiltersRev[] = { +-140, 446, -755, 3302, 2922, -590, 343, -138 +}; + +static const int16_t kPlcPerSqr[] = { 839, 1343, 2048, 2998, 4247, 5849 }; + +static const int16_t alpha[] = { +6554, 13107, 19661, 26214 +}; + +static const int16_t kLpcChirpSyntDenum[] = { +32767, 29573, 26690, 24087, 21739, 19619, 17707, 15980, 14422, 13016, 11747 +}; + +static const int16_t LpcChirp
[FFmpeg-devel] [PATCH 1/2] checkasm/float_dsp: add test for vector_dmul
Signed-off-by: James Almer --- tests/checkasm/float_dsp.c | 24 1 file changed, 24 insertions(+) diff --git a/tests/checkasm/float_dsp.c b/tests/checkasm/float_dsp.c index 2f999a3162..2abe4eccbd 100644 --- a/tests/checkasm/float_dsp.c +++ b/tests/checkasm/float_dsp.c @@ -61,6 +61,28 @@ static void test_vector_fmul(const float *src0, const float *src1) bench_new(odst, src0, src1, LEN); } +static void test_vector_dmul(const double *src0, const double *src1) +{ +LOCAL_ALIGNED_32(double, cdst, [LEN]); +LOCAL_ALIGNED_32(double, odst, [LEN]); +int i; + +declare_func(void, double *dst, const double *src0, const double *src1, + int len); + +call_ref(cdst, src0, src1, LEN); +call_new(odst, src0, src1, LEN); +for (i = 0; i < LEN; i++) { +if (!double_near_abs_eps(cdst[i], odst[i], DBL_EPSILON)) { +fprintf(stderr, "%d: %- .12f - %- .12f = % .12g\n", +i, cdst[i], odst[i], cdst[i] - odst[i]); +fail(); +break; +} +} +bench_new(odst, src0, src1, LEN); +} + #define ARBITRARY_FMUL_ADD_CONST 0.005 static void test_vector_fmul_add(const float *src0, const float *src1, const float *src2) { @@ -294,6 +316,8 @@ void checkasm_check_float_dsp(void) if (check_func(fdsp->vector_fmac_scalar, "vector_fmac_scalar")) test_vector_fmac_scalar(src0, src1, src2); report("vector_fmac"); +if (check_func(fdsp->vector_dmul, "vector_dmul")) +test_vector_dmul(dbl_src0, dbl_src1); if (check_func(fdsp->vector_dmul_scalar, "vector_dmul_scalar")) test_vector_dmul_scalar(dbl_src0, dbl_src1); report("vector_dmul"); -- 2.19.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] avutil/float_dsp: add ff_vector_dmul_{sse2, avx}
~3x to 5x faster. Signed-off-by: James Almer --- libavutil/x86/float_dsp.asm| 33 + libavutil/x86/float_dsp_init.c | 7 +++ 2 files changed, 40 insertions(+) diff --git a/libavutil/x86/float_dsp.asm b/libavutil/x86/float_dsp.asm index 06d2d2cfd1..d77d8e9e9c 100644 --- a/libavutil/x86/float_dsp.asm +++ b/libavutil/x86/float_dsp.asm @@ -58,6 +58,39 @@ INIT_YMM avx VECTOR_FMUL %endif +;- +; void vector_dmul(double *dst, const double *src0, const double *src1, int len) +;- +%macro VECTOR_DMUL 0 +cglobal vector_dmul, 4,4,4, dst, src0, src1, len +lea lenq, [lend*8 - mmsize*4] +ALIGN 16 +.loop: +movapsm0, [src0q + lenq + 0*mmsize] +movapsm1, [src0q + lenq + 1*mmsize] +movapsm2, [src0q + lenq + 2*mmsize] +movapsm3, [src0q + lenq + 3*mmsize] +mulpd m0, m0, [src1q + lenq + 0*mmsize] +mulpd m1, m1, [src1q + lenq + 1*mmsize] +mulpd m2, m2, [src1q + lenq + 2*mmsize] +mulpd m3, m3, [src1q + lenq + 3*mmsize] +movaps[dstq + lenq + 0*mmsize], m0 +movaps[dstq + lenq + 1*mmsize], m1 +movaps[dstq + lenq + 2*mmsize], m2 +movaps[dstq + lenq + 3*mmsize], m3 + +sub lenq, mmsize*4 +jge .loop +RET +%endmacro + +INIT_XMM sse2 +VECTOR_DMUL +%if HAVE_AVX_EXTERNAL +INIT_YMM avx +VECTOR_DMUL +%endif + ;-- ; void ff_vector_fmac_scalar(float *dst, const float *src, float mul, int len) ;-- diff --git a/libavutil/x86/float_dsp_init.c b/libavutil/x86/float_dsp_init.c index 122087a196..8826e4e2c9 100644 --- a/libavutil/x86/float_dsp_init.c +++ b/libavutil/x86/float_dsp_init.c @@ -29,6 +29,11 @@ void ff_vector_fmul_sse(float *dst, const float *src0, const float *src1, void ff_vector_fmul_avx(float *dst, const float *src0, const float *src1, int len); +void ff_vector_dmul_sse2(double *dst, const double *src0, const double *src1, + int len); +void ff_vector_dmul_avx(double *dst, const double *src0, const double *src1, +int len); + void ff_vector_fmac_scalar_sse(float *dst, const float *src, float mul, int len); void ff_vector_fmac_scalar_avx(float *dst, const float *src, float mul, @@ -92,11 +97,13 @@ av_cold void ff_float_dsp_init_x86(AVFloatDSPContext *fdsp) fdsp->butterflies_float = ff_butterflies_float_sse; } if (EXTERNAL_SSE2(cpu_flags)) { +fdsp->vector_dmul = ff_vector_dmul_sse2; fdsp->vector_dmac_scalar = ff_vector_dmac_scalar_sse2; fdsp->vector_dmul_scalar = ff_vector_dmul_scalar_sse2; } if (EXTERNAL_AVX_FAST(cpu_flags)) { fdsp->vector_fmul = ff_vector_fmul_avx; +fdsp->vector_dmul = ff_vector_dmul_avx; fdsp->vector_fmac_scalar = ff_vector_fmac_scalar_avx; fdsp->vector_dmul_scalar = ff_vector_dmul_scalar_avx; fdsp->vector_dmac_scalar = ff_vector_dmac_scalar_avx; -- 2.19.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec: add native iLBC decoder
2018-09-13 13:03 GMT+02:00, Paul B Mahol : > @@ -0,0 +1,263 @@ > +/* > + * Copyright (c) 2013, The WebRTC project authors. All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions are > + * met: > + * > + * * Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * > + * * Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in > + * the documentation and/or other materials provided with the > + * distribution. > + * > + * * Neither the name of Google nor the names of its contributors may > + * be used to endorse or promote products derived from this software > + * without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT > + * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + */ > + > +/* > + * iLBC decoder > + * > + * 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 > + */ Is the additional license necessary? There is nothing wrong with it, I just wonder if you were ok with anybody else using your additions to the code under the original license or if you intended that this is impossible. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Revert "avcodec/decode: copy the output parameters from the last bsf in the chain back to the AVCodecContext"
On 9/13/2018 6:50 AM, Timo Rothenpieler wrote: >> So, what do we do now? Honor the doxy and stop trying to manipulate >> what's meant to be an user owned pointer/buffer, officially break the >> API and declare it's meant to be allocated by the user but then >> ownership is passed to the library during or after the avcodec_open2() >> call, or just revert this commit and pretend nothing happened? > > Documenting the API break that already happened seems like the least bad > option right now. Firefox already merged code to work around the crash. > > It already is freed in multiple places, so existing code probably > already is compatible. > > No solution to this is overly pretty unfortunately. > Specially as this goes along with likely leaking the extradata pointer, > as unconditionally freeing it will most definitely cause crashes left > and right. Commit fd056029f45a9f6d213d9fce8165632042511d4f is what introduced avcodec_free_context(), including the unconditional av_free call for extradata. Assuming that's the first case of the extradata pointer being manipulated by lavc for a decoder, then the doxy has been pretty much incorrect for at least four years now. So i guess you're right, and perhaps we should just change the doxy to reflect the behavior the library has featured all this time: That the user needs to allocate it with av_malloc(), but after calling avcodec_open2() ownership is passed to lavc. > > > > ___ > 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] libavdevice: allow cropping avfoundation screen capture
Hello, I've developed a patch to add an option to allow cropping of the avfoundation screen capture. Note that if the captured width is not a multiple of 16 then https://trac.ffmpeg.org/ticket/5654 will be triggered. Also note that the "capture_crop_y" property is bottom up, I don't know If we should fix that or just document it for the user? Thanks, Alan Birtles. 0001-allow-specifying-cropRect-for-avfoundation-screen-ca.patch Description: 0001-allow-specifying-cropRect-for-avfoundation-screen-ca.patch ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavdevice: allow cropping avfoundation screen capture
2018-09-13 17:52 GMT+02:00, alan.birt...@sony.com : > I've developed a patch to add an option to allow cropping of the > avfoundation screen capture. > Note that if the captured width is not a multiple of 16 then > https://trac.ffmpeg.org/ticket/5654 will be triggered. Does the patch attached there work for you? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavdevice: allow cropping avfoundation screen capture
Yes the patch for #5654 worked correctly. -Original Message- From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of Carl Eugen Hoyos Sent: 13 September 2018 16:59 To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH] libavdevice: allow cropping avfoundation screen capture 2018-09-13 17:52 GMT+02:00, alan.birt...@sony.com : > I've developed a patch to add an option to allow cropping of the > avfoundation screen capture. > Note that if the captured width is not a multiple of 16 then > https://trac.ffmpeg.org/ticket/5654 will be triggered. Does the patch attached there work for you? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/libaom: fix setting amount of threads
The libaom doxy says that a value of 0 for the threads fields is equivalent to a value of 1, whereas for avctx->thread_count it means the maximum amount of threads possible for the host system. Use av_cpu_count() to get the correct thread count when auto threads is requested. Signed-off-by: James Almer --- libavcodec/libaomdec.c | 2 +- libavcodec/libaomenc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c index 6a2de6d47a..2530c9f76b 100644 --- a/libavcodec/libaomdec.c +++ b/libavcodec/libaomdec.c @@ -43,7 +43,7 @@ static av_cold int aom_init(AVCodecContext *avctx, AV1DecodeContext *ctx = avctx->priv_data; struct aom_codec_dec_cfg deccfg = { /* token partitions+1 would be a decent choice */ -.threads = FFMIN(avctx->thread_count, 16) +.threads = FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), 16) }; av_log(avctx, AV_LOG_INFO, "%s\n", aom_codec_version_str()); diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index bbf4cf8b64..6a79d9b873 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -319,7 +319,7 @@ static av_cold int aom_init(AVCodecContext *avctx, enccfg.g_h= avctx->height; enccfg.g_timebase.num = avctx->time_base.num; enccfg.g_timebase.den = avctx->time_base.den; -enccfg.g_threads = avctx->thread_count; +enccfg.g_threads = avctx->thread_count ? avctx->thread_count : av_cpu_count(); if (ctx->lag_in_frames >= 0) enccfg.g_lag_in_frames = ctx->lag_in_frames; -- 2.19.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/libaom: fix setting amount of threads
On Thu, Sep 13, 2018 at 7:26 PM, James Almer wrote: > The libaom doxy says that a value of 0 for the threads fields is > equivalent to a value of 1, whereas for avctx->thread_count it means > the maximum amount of threads possible for the host system. > > Use av_cpu_count() to get the correct thread count when auto threads > is requested. > > Signed-off-by: James Almer > --- Same things as in our libvpx wrappers, LGTM. Jan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/libaom: fix setting amount of threads
On 9/13/2018 1:32 PM, Jan Ekström wrote: > On Thu, Sep 13, 2018 at 7:26 PM, James Almer wrote: >> The libaom doxy says that a value of 0 for the threads fields is >> equivalent to a value of 1, whereas for avctx->thread_count it means >> the maximum amount of threads possible for the host system. >> >> Use av_cpu_count() to get the correct thread count when auto threads >> is requested. >> >> Signed-off-by: James Almer >> --- > > Same things as in our libvpx wrappers, LGTM. > > Jan Pushed, thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add bm3d filter
On Sat, May 12, 2018 at 01:54:49PM +0200, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > doc/filters.texi | 86 > libavfilter/Makefile |1 + > libavfilter/allfilters.c |1 + > libavfilter/vf_bm3d.c| 1077 > ++ > 4 files changed, 1165 insertions(+) > create mode 100644 libavfilter/vf_bm3d.c [...] > +static void do_output16(BM3DContext *s, uint8_t *dst, int dst_linesize, > +int plane, int nb_jobs) > +{ > +const int height = s->planeheight[plane]; > +const int width = s->planewidth[plane]; > +const int depth = s->depth; > +int i, j, k; > + > +for (i = 0; i < height; i++) { > +for (j = 0; j < width; j++) { > +uint16_t *dstp = (uint16_t *)dst + i * dst_linesize / 2; > +float sum_den = 0.f; > +float sum_num = 0.f; > + > +for (k = 0; k < nb_jobs; k++) { > +SliceContext *sc = &s->slices[k]; > +float num = sc->num[i * width + j]; > +float den = sc->den[i * width + j]; > + > +sum_num += num; > +sum_den += den; > +} > + > +dstp[j] = av_clip_uintp2(sum_num / sum_den, depth); fails to build CC libavfilter/vf_bm3d.o In file included from src/libavutil/intmath.h:30:0, from src/libavutil/common.h:106, from src/libavutil/avutil.h:296, from src/libavutil/avassert.h:31, from src/libavfilter/vf_bm3d.c:35: src/libavutil/arm/intmath.h: In function ‘do_output16’: src/libavutil/arm/intmath.h:77:5: warning: asm operand 2 probably doesn’t match constraints [enabled by default] src/libavutil/arm/intmath.h:77:5: error: impossible constraint in ‘asm’ src/libavfilter/vf_bm3d.c: In function ‘config_output’: src/libavfilter/vf_bm3d.c:1006:21: warning: ‘ref’ may be used uninitialized in this function [-Wuninitialized] make: *** [libavfilter/vf_bm3d.o] Error 1 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have never wished to cater to the crowd; for what I know they do not approve, and what they approve I do not know. -- Epicurus signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavdevice: allow cropping avfoundation screen capture
2018-09-13 18:16 GMT+02:00, alan.birt...@sony.com : > Yes the patch for #5654 worked correctly. I applied that patch, thank you for testing it! Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] avcodec/diracdec: check that GetBitContext has not ended in codeblock()
Fixes: Timeout (part 2 of 2) Fixes: 9774/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5748957085958144 Signed-off-by: Michael Niedermayer --- libavcodec/diracdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index cbd7fd1532..af561d1426 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -548,6 +548,8 @@ static inline int codeblock(DiracContext *s, SubBand *b, } } else { for (y = top; y < bottom; y++) { +if (get_bits_left(gb) < 1) +return AVERROR_INVALIDDATA; for (x = left; x < right; x++) { int val = coeff_unpack_golomb(gb, qfactor, qoffset); if (b->pshift) { -- 2.18.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] avcodec/diracdec: Propagate errors from codeblock()
Consider a component to be damaged if more than 50% of its subbands are damaged Fixes: Timeout (part 1 of 2) Fixes: 9774/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5748957085958144 Signed-off-by: Michael Niedermayer --- libavcodec/diracdec.c | 47 +-- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index 9a417caec5..cbd7fd1532 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -488,7 +488,7 @@ UNPACK_ARITH(10, int32_t) * Decode the coeffs in the rectangle defined by left, right, top, bottom * [DIRAC_STD] 13.4.3.2 Codeblock unpacking loop. codeblock() */ -static inline void codeblock(DiracContext *s, SubBand *b, +static inline int codeblock(DiracContext *s, SubBand *b, GetBitContext *gb, DiracArith *c, int left, int right, int top, int bottom, int blockcnt_one, int is_arith) @@ -505,7 +505,7 @@ static inline void codeblock(DiracContext *s, SubBand *b, zero_block = get_bits1(gb); if (zero_block) -return; +return 0; } if (s->codeblock_mode && !(s->old_delta_quant && blockcnt_one)) { @@ -516,7 +516,7 @@ static inline void codeblock(DiracContext *s, SubBand *b, quant = dirac_get_se_golomb(gb); if (quant > INT_MAX - b->quant || b->quant + quant < 0) { av_log(s->avctx, AV_LOG_ERROR, "Invalid quant\n"); -return; +return AVERROR_INVALIDDATA; } b->quant += quant; } @@ -524,7 +524,7 @@ static inline void codeblock(DiracContext *s, SubBand *b, if (b->quant > (DIRAC_MAX_QUANT_INDEX - 1)) { av_log(s->avctx, AV_LOG_ERROR, "Unsupported quant %d\n", b->quant); b->quant = 0; -return; +return AVERROR_INVALIDDATA; } qfactor = ff_dirac_qscale_tab[b->quant]; @@ -559,6 +559,7 @@ static inline void codeblock(DiracContext *s, SubBand *b, buf += b->stride; } } + return 0; } /** @@ -593,7 +594,7 @@ INTRA_DC_PRED(10, uint32_t) * Dirac Specification -> * 13.4.2 Non-skipped subbands. subband_coeffs() */ -static av_always_inline void decode_subband_internal(DiracContext *s, SubBand *b, int is_arith) +static av_always_inline int decode_subband_internal(DiracContext *s, SubBand *b, int is_arith) { int cb_x, cb_y, left, right, top, bottom; DiracArith c; @@ -601,9 +602,10 @@ static av_always_inline void decode_subband_internal(DiracContext *s, SubBand *b int cb_width = s->codeblock[b->level + (b->orientation != subband_ll)].width; int cb_height = s->codeblock[b->level + (b->orientation != subband_ll)].height; int blockcnt_one = (cb_width + cb_height) == 2; +int ret; if (!b->length) -return; +return 0; init_get_bits8(&gb, b->coeff_data, b->length); @@ -616,7 +618,9 @@ static av_always_inline void decode_subband_internal(DiracContext *s, SubBand *b left = 0; for (cb_x = 0; cb_x < cb_width; cb_x++) { right = (b->width * (cb_x+1LL)) / cb_width; -codeblock(s, b, &gb, &c, left, right, top, bottom, blockcnt_one, is_arith); +ret = codeblock(s, b, &gb, &c, left, right, top, bottom, blockcnt_one, is_arith); +if (ret < 0) +return ret; left = right; } top = bottom; @@ -629,33 +633,35 @@ static av_always_inline void decode_subband_internal(DiracContext *s, SubBand *b intra_dc_prediction_8(b); } } +return 0; } static int decode_subband_arith(AVCodecContext *avctx, void *b) { DiracContext *s = avctx->priv_data; -decode_subband_internal(s, b, 1); -return 0; +return decode_subband_internal(s, b, 1); } static int decode_subband_golomb(AVCodecContext *avctx, void *arg) { DiracContext *s = avctx->priv_data; SubBand **b = arg; -decode_subband_internal(s, *b, 0); -return 0; +return decode_subband_internal(s, *b, 0); } /** * Dirac Specification -> * [DIRAC_STD] 13.4.1 core_transform_data() */ -static void decode_component(DiracContext *s, int comp) +static int decode_component(DiracContext *s, int comp) { AVCodecContext *avctx = s->avctx; SubBand *bands[3*MAX_DWT_LEVELS+1]; enum dirac_subband orientation; int level, num_bands = 0; +int ret[3*MAX_DWT_LEVELS+1]; +int i; +int damaged_count = 0; /* Unpack all subbands at all levels. */ for (level = 0; level < s->wavelet_depth; level++) { @@ -677,11 +683,20 @@ static void decode_component(DiracContext *s, int comp) /* arithmetic coding has inter-level dependencies, so we can only execute one level at a time */ if (s->is_arith) avctx->execute(avctx, decode_subband_arith, &s->plane[comp].band[level][!!l
Re: [FFmpeg-devel] [PATCH] avcodec/mips: [loongson] fix bug of svq3-watermark failed in fate test.
On Thu, Sep 13, 2018 at 11:04:05AM +0800, Shiyou Yin wrote: > Failed case: svq3-watermark > When minimum loop count of following functions are greater than parameter h > passed to them, svq3-watermark failed. > 1. ff_put_pixels4_8_mmi > 2. ff_avg_pixels4_8_mmi > 3. ff_put_pixels4_l2_8_mmi > 4. ff_avg_pixels4_l2_8_mmi > --- > libavcodec/mips/hpeldsp_mmi.c | 112 > +- > 1 file changed, 23 insertions(+), 89 deletions(-) will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship naturally arises out of democracy, and the most aggravated form of tyranny and slavery out of the most extreme liberty. -- 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] lavfi/silencedetect: fix spelling
On Mon, Sep 10, 2018 at 03:07:15PM -0400, Tristan Matthews wrote: > --- > libavfilter/af_silencedetect.c | 18 +- > 1 file changed, 9 insertions(+), 9 deletions(-) will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is dangerous to be right in matters on which the established authorities are wrong. -- Voltaire signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] FFmpeg 4.1
Hi all its almost 5 months since 4.0 so its time to make a new release. Are there any suggestions for a name ? If not ill pick something from unused past suggestions. If there are no objections i will likely make that release in the next weeks thanks -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Whats the most studid thing your enemy could do ? Blow himself up Whats the most studid thing you could do ? Give up your rights and freedom because your enemy blew himself up. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg 4.1
On 9/13/2018 10:22 PM, Michael Niedermayer wrote: > Hi all > > its almost 5 months since 4.0 so its time to make a new release. > > Are there any suggestions for a name ? > If not ill pick something from unused past suggestions. > > If there are no objections i will likely make that release in the next weeks I'd like more opinions and hopefully a final decision in the "Revert "avcodec/decode: copy the output parameters from the last bsf in the chain back to the AVCodecContext"" thread, regarding what to do with avctx extradata, before tagging the new release. > > thanks ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel