[FFmpeg-cvslog] avfilter/af_adynamicequalizer: rework processing
ffmpeg | branch: master | Paul B Mahol | Fri Oct 7 23:57:46 2022 +0200| [5676b7cdcfec5f07c591891d2f1361464f652352] | committer: Paul B Mahol avfilter/af_adynamicequalizer: rework processing > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5676b7cdcfec5f07c591891d2f1361464f652352 --- doc/filters.texi | 28 +++--- libavfilter/af_adynamicequalizer.c | 193 +++-- 2 files changed, 91 insertions(+), 130 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 7e516a43ba..68205147f0 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -897,25 +897,17 @@ Set the amount of milliseconds the signal from detection has to fall below the detection threshold before equalization ends. Default is 200. Allowed range is between 1 and 2000. -@item knee -Curve the sharp knee around the detection threshold to calculate -equalization gain more softly. -Default is 1. Allowed range is between 0 and 8. - @item ratio Set the ratio by which the equalization gain is raised. -Default is 1. Allowed range is between 1 and 20. +Default is 1. Allowed range is between 0 and 30. @item makeup -Set the makeup offset in dB by which the equalization gain is raised. -Default is 0. Allowed range is between 0 and 30. +Set the makeup offset by which the equalization gain is raised. +Default is 0. Allowed range is between 0 and 100. @item range -Set the max allowed cut/boost amount in dB. Default is 0. -Allowed range is from 0 to 200. - -@item slew -Set the slew factor. Default is 1. Allowed range is from 1 to 200. +Set the max allowed cut/boost amount. Default is 50. +Allowed range is from 1 to 200. @item mode Set the mode of filter operation, can be one of the following: @@ -939,6 +931,16 @@ Set the type of target filter, can be one of the following: @item highshelf @end table Default type is @samp{bell}. + +@item direction +Set processing direction relative to threshold. +@table @samp +@item downward +Boost or cut if threshhold is higher than detected volume. +@item upward +Boost or cut if threshhold is lower than detected volume. +@end table +Default direction is @samp{downward}. @end table @subsection Commands diff --git a/libavfilter/af_adynamicequalizer.c b/libavfilter/af_adynamicequalizer.c index 35d1adb9cb..144a5fcfe8 100644 --- a/libavfilter/af_adynamicequalizer.c +++ b/libavfilter/af_adynamicequalizer.c @@ -34,13 +34,12 @@ typedef struct AudioDynamicEqualizerContext { double ratio; double range; double makeup; -double knee; -double slew; double attack; double release; double attack_coef; double release_coef; int mode; +int direction; int type; AVFrame *state; @@ -55,6 +54,12 @@ static int config_input(AVFilterLink *inlink) if (!s->state) return AVERROR(ENOMEM); +for (int ch = 0; ch < inlink->ch_layout.nb_channels; ch++) { +double *state = (double *)s->state->extended_data[ch]; + +state[4] = 1.; +} + return 0; } @@ -71,69 +76,6 @@ static double get_svf(double in, double *m, double *a, double *b) return m[0] * v0 + m[1] * v1 + m[2] * v2; } -static inline double from_dB(double x) -{ -return exp(0.05 * x * M_LN10); -} - -static inline double to_dB(double x) -{ -return 20. * log10(x); -} - -static inline double sqr(double x) -{ -return x * x; -} - -static double get_gain(double in, double srate, double makeup, - double aattack, double iratio, double knee, double range, - double thresdb, double slewfactor, double *state, - double attack_coeff, double release_coeff, double nc) -{ -double width = (6. * knee) + 0.01; -double cdb = 0.; -double Lgain = 1.; -double Lxg, Lxl, Lyg, Lyl, Ly1; -double checkwidth = 0.; -double slewwidth = 1.8; -int attslew = 0; - -Lyg = 0.; -Lxg = to_dB(fabs(in) + DBL_EPSILON); - -Lyg = Lxg + (iratio - 1.) * sqr(Lxg - thresdb + width * .5) / (2. * width); - -checkwidth = 2. * fabs(Lxg - thresdb); -if (2. * (Lxg - thresdb) < -width) { -Lyg = Lxg; -} else if (checkwidth <= width) { -Lyg = thresdb + (Lxg - thresdb) * iratio; -if (checkwidth <= slewwidth) { -if (Lyg >= state[2]) -attslew = 1; -} -} else if (2. * (Lxg - thresdb) > width) { -Lyg = thresdb + (Lxg - thresdb) * iratio; -} - -attack_coeff = attslew ? aattack : attack_coeff; - -Lxl = Lxg - Lyg; - -Ly1 = fmax(Lxl, release_coeff * state[1] +(1. - release_coeff) * Lxl); -Lyl = attack_coeff * state[0] + (1. - attack_coeff) * Ly1; - -cdb = -Lyl; -Lgain = from_dB(nc * fmin(cdb - makeup, range)); - -state[0] = Lyl; -state[1] = Ly1; -state[2] = Lyg; - -return Lgain; -} - typedef struct ThreadData { AVFrame *in, *out; } ThreadData; @@ -146,25 +88,24 @@ static int filter_channels(AVFilterContext *ctx,
[FFmpeg-cvslog] avcodec/huffyuvenc: Remove redundant casts
ffmpeg | branch: master | Andreas Rheinhardt | Sat Oct 1 20:12:34 2022 +0200| [8f8c0ad291626fe1630986bc2b515e055f4f6321] | committer: Andreas Rheinhardt avcodec/huffyuvenc: Remove redundant casts Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8f8c0ad291626fe1630986bc2b515e055f4f6321 --- libavcodec/huffyuvenc.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 2d63b12abc..d159d5d309 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -333,20 +333,20 @@ static av_cold int encode_init(AVCodecContext *avctx) return AVERROR(EINVAL); } -((uint8_t*)avctx->extradata)[0] = s->predictor | (s->decorrelate << 6); -((uint8_t*)avctx->extradata)[2] = s->interlaced ? 0x10 : 0x20; +avctx->extradata[0] = s->predictor | (s->decorrelate << 6); +avctx->extradata[2] = s->interlaced ? 0x10 : 0x20; if (s->context) -((uint8_t*)avctx->extradata)[2] |= 0x40; +avctx->extradata[2] |= 0x40; if (s->version < 3) { -((uint8_t*)avctx->extradata)[1] = s->bitstream_bpp; -((uint8_t*)avctx->extradata)[3] = 0; +avctx->extradata[1] = s->bitstream_bpp; +avctx->extradata[3] = 0; } else { -((uint8_t*)avctx->extradata)[1] = ((s->bps-1)<<4) | s->chroma_h_shift | (s->chroma_v_shift<<2); +avctx->extradata[1] = ((s->bps-1)<<4) | s->chroma_h_shift | (s->chroma_v_shift<<2); if (s->chroma) -((uint8_t*)avctx->extradata)[2] |= s->yuv ? 1 : 2; +avctx->extradata[2] |= s->yuv ? 1 : 2; if (s->alpha) -((uint8_t*)avctx->extradata)[2] |= 4; -((uint8_t*)avctx->extradata)[3] = 1; +avctx->extradata[2] |= 4; +avctx->extradata[3] = 1; } s->avctx->extradata_size = 4; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/ylc: Remove inclusion of huffyuvdsp.h
ffmpeg | branch: master | Andreas Rheinhardt | Sun Oct 2 00:10:16 2022 +0200| [d287651c34901dfdd4e7a466792c40e5426000d0] | committer: Andreas Rheinhardt avcodec/ylc: Remove inclusion of huffyuvdsp.h Also improve the other headers a bit. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d287651c34901dfdd4e7a466792c40e5426000d0 --- libavcodec/ylc.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libavcodec/ylc.c b/libavcodec/ylc.c index 3ea6749ffe..29c10f05da 100644 --- a/libavcodec/ylc.c +++ b/libavcodec/ylc.c @@ -18,21 +18,17 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include #include #define YLC_VLC_BITS 10 -#include "libavutil/imgutils.h" -#include "libavutil/internal.h" #include "libavutil/intreadwrite.h" #include "libavutil/mem.h" +#include "libavutil/pixfmt.h" #include "avcodec.h" #include "bswapdsp.h" #include "codec_internal.h" #include "get_bits.h" -#include "huffyuvdsp.h" #include "thread.h" #include "unary.h" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/huffyuvenc: Don't second-guess error code
ffmpeg | branch: master | Andreas Rheinhardt | Sat Oct 1 21:29:34 2022 +0200| [9ec50660ad49ddb92fcbf43c61a6871cf1170f71] | committer: Andreas Rheinhardt avcodec/huffyuvenc: Don't second-guess error code Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9ec50660ad49ddb92fcbf43c61a6871cf1170f71 --- libavcodec/huffyuvenc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 8867de0d44..84ab7f423a 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -391,9 +391,9 @@ static av_cold int encode_init(AVCodecContext *avctx) s->stats[i][j]= 0; } -if (ff_huffyuv_alloc_temp(s)) { -return AVERROR(ENOMEM); -} +ret = ff_huffyuv_alloc_temp(s); +if (ret < 0) +return ret; s->picture_number=0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/huffyuvenc: Avoid pointless indirections
ffmpeg | branch: master | Andreas Rheinhardt | Sat Oct 1 20:24:28 2022 +0200| [be65f24ad6808d0f01808dc92719a89189bca4e8] | committer: Andreas Rheinhardt avcodec/huffyuvenc: Avoid pointless indirections Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=be65f24ad6808d0f01808dc92719a89189bca4e8 --- libavcodec/huffyuvenc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index d159d5d309..fa4923962f 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -348,7 +348,7 @@ static av_cold int encode_init(AVCodecContext *avctx) avctx->extradata[2] |= 4; avctx->extradata[3] = 1; } -s->avctx->extradata_size = 4; +avctx->extradata_size = 4; if (avctx->stats_in) { char *p = avctx->stats_in; @@ -378,10 +378,10 @@ static av_cold int encode_init(AVCodecContext *avctx) } } -ret = store_huffman_tables(s, s->avctx->extradata + s->avctx->extradata_size); +ret = store_huffman_tables(s, avctx->extradata + avctx->extradata_size); if (ret < 0) return ret; -s->avctx->extradata_size += ret; +avctx->extradata_size += ret; if (s->context) { for (i = 0; i < 4; i++) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/huffyuvenc: Remove always-false check
ffmpeg | branch: master | Andreas Rheinhardt | Sat Oct 1 21:05:42 2022 +0200| [e766378619c58786da20cbcd69ed36010ca5959b] | committer: Andreas Rheinhardt avcodec/huffyuvenc: Remove always-false check The ffvhuff encoder has AVCodec.pix_fmts set and therefore encode_preinit_video() checks that the used pixel format is permissible. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e766378619c58786da20cbcd69ed36010ca5959b --- libavcodec/huffyuvenc.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index fa4923962f..80dcdbaa93 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -310,12 +310,6 @@ static av_cold int encode_init(AVCodecContext *avctx) } if (avctx->codec->id == AV_CODEC_ID_HUFFYUV) { -if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) { -av_log(avctx, AV_LOG_ERROR, - "Error: YV12 is not supported by huffyuv; use " - "vcodec=ffvhuff or format=422p\n"); -return AVERROR(EINVAL); -} if (s->interlaced != ( s->height > 288 )) av_log(avctx, AV_LOG_INFO, "using huffyuv 2.2.0 or newer interlacing flag\n"); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/huffyuvencdsp: Pass pix_fmt directly when initing dsp
ffmpeg | branch: master | Andreas Rheinhardt | Sat Oct 1 21:49:29 2022 +0200| [1741adb1c76d36ca1a0d6e9165d5928510cdd9a2] | committer: Andreas Rheinhardt avcodec/huffyuvencdsp: Pass pix_fmt directly when initing dsp It is the only thing that is actually used. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1741adb1c76d36ca1a0d6e9165d5928510cdd9a2 --- libavcodec/huffyuvenc.c | 2 +- libavcodec/huffyuvencdsp.c | 4 ++-- libavcodec/huffyuvencdsp.h | 6 +++--- libavcodec/x86/huffyuvencdsp_init.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 84ab7f423a..2137a16714 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -210,7 +210,7 @@ static av_cold int encode_init(AVCodecContext *avctx) const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); ff_huffyuv_common_init(avctx); -ff_huffyuvencdsp_init(&s->hencdsp, avctx); +ff_huffyuvencdsp_init(&s->hencdsp, avctx->pix_fmt); ff_llvidencdsp_init(&s->llvidencdsp); avctx->extradata = av_mallocz(3*MAX_N + 4); diff --git a/libavcodec/huffyuvencdsp.c b/libavcodec/huffyuvencdsp.c index ea1ef911b0..36e8f6130b 100644 --- a/libavcodec/huffyuvencdsp.c +++ b/libavcodec/huffyuvencdsp.c @@ -68,12 +68,12 @@ static void sub_hfyu_median_pred_int16_c(uint16_t *dst, const uint16_t *src1, co *left_top = lt; } -av_cold void ff_huffyuvencdsp_init(HuffYUVEncDSPContext *c, AVCodecContext *avctx) +av_cold void ff_huffyuvencdsp_init(HuffYUVEncDSPContext *c, enum AVPixelFormat pix_fmt) { c->diff_int16 = diff_int16_c; c->sub_hfyu_median_pred_int16 = sub_hfyu_median_pred_int16_c; #if ARCH_X86 -ff_huffyuvencdsp_init_x86(c, avctx); +ff_huffyuvencdsp_init_x86(c, pix_fmt); #endif } diff --git a/libavcodec/huffyuvencdsp.h b/libavcodec/huffyuvencdsp.h index 603f9c8c2c..779a51ac79 100644 --- a/libavcodec/huffyuvencdsp.h +++ b/libavcodec/huffyuvencdsp.h @@ -21,7 +21,7 @@ #include -#include "avcodec.h" +#include "libavutil/pixfmt.h" typedef struct HuffYUVEncDSPContext { void (*diff_int16)(uint16_t *dst /* align 16 */, @@ -34,7 +34,7 @@ typedef struct HuffYUVEncDSPContext { int w, int *left, int *left_top); } HuffYUVEncDSPContext; -void ff_huffyuvencdsp_init(HuffYUVEncDSPContext *c, AVCodecContext *avctx); -void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c, AVCodecContext *avctx); +void ff_huffyuvencdsp_init(HuffYUVEncDSPContext *c, enum AVPixelFormat pix_fmt); +void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c, enum AVPixelFormat pix_fmt); #endif /* AVCODEC_HUFFYUVENCDSP_H */ diff --git a/libavcodec/x86/huffyuvencdsp_init.c b/libavcodec/x86/huffyuvencdsp_init.c index cc6dc5a560..c9c33b75b4 100644 --- a/libavcodec/x86/huffyuvencdsp_init.c +++ b/libavcodec/x86/huffyuvencdsp_init.c @@ -35,10 +35,10 @@ void ff_diff_int16_avx2(uint16_t *dst, const uint16_t *src1, const uint16_t *src void ff_sub_hfyu_median_pred_int16_mmxext(uint16_t *dst, const uint16_t *src1, const uint16_t *src2, unsigned mask, int w, int *left, int *left_top); -av_cold void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c, AVCodecContext *avctx) +av_cold void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c, enum AVPixelFormat pix_fmt) { av_unused int cpu_flags = av_get_cpu_flags(); -const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(avctx->pix_fmt); +const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(pix_fmt); if (EXTERNAL_MMXEXT(cpu_flags) && pix_desc && pix_desc->comp[0].depth<16) { c->sub_hfyu_median_pred_int16 = ff_sub_hfyu_median_pred_int16_mmxext; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/huffyuvenc: Remove redundant call
ffmpeg | branch: master | Andreas Rheinhardt | Sat Oct 1 21:21:12 2022 +0200| [75842c35e7698eba2114a84b2854c3c130b2f2d4] | committer: Andreas Rheinhardt avcodec/huffyuvenc: Remove redundant call All codecs here have the FF_CODEC_CAP_INIT_CLEANUP set, so ff_huffyuv_common_end() will be called automatically in encode_end() on error. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=75842c35e7698eba2114a84b2854c3c130b2f2d4 --- libavcodec/huffyuvenc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 80dcdbaa93..8867de0d44 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -392,7 +392,6 @@ static av_cold int encode_init(AVCodecContext *avctx) } if (ff_huffyuv_alloc_temp(s)) { -ff_huffyuv_common_end(s); return AVERROR(ENOMEM); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/huffyuv: Use AVCodecContext.(width|height) directly
ffmpeg | branch: master | Andreas Rheinhardt | Sat Oct 1 22:30:21 2022 +0200| [2415f5158bfbce1c974554e29772a9df76940ad9] | committer: Andreas Rheinhardt avcodec/huffyuv: Use AVCodecContext.(width|height) directly These parameters are easily accessible whereever they are accessed, so using copies from HYuvContext is unnecessary. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2415f5158bfbce1c974554e29772a9df76940ad9 --- libavcodec/huffyuv.c| 9 ++--- libavcodec/huffyuv.h| 3 +-- libavcodec/huffyuvdec.c | 10 +- libavcodec/huffyuvenc.c | 20 +--- 4 files changed, 17 insertions(+), 25 deletions(-) diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index 471bfa1bb9..4a5bd53998 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -55,12 +55,12 @@ int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table, int return 0; } -av_cold int ff_huffyuv_alloc_temp(HYuvContext *s) +av_cold int ff_huffyuv_alloc_temp(HYuvContext *s, int width) { int i; for (i=0; i<3; i++) { -s->temp[i]= av_malloc(4*s->width + 16); +s->temp[i] = av_malloc(4 * width + 16); if (!s->temp[i]) return AVERROR(ENOMEM); s->temp16[i] = (uint16_t*)s->temp[i]; @@ -75,11 +75,6 @@ av_cold void ff_huffyuv_common_init(AVCodecContext *avctx) s->flags = avctx->flags; ff_bswapdsp_init(&s->bdsp); - -s->width = avctx->width; -s->height = avctx->height; - -av_assert1(s->width > 0 && s->height > 0); } av_cold void ff_huffyuv_common_end(HYuvContext *s) diff --git a/libavcodec/huffyuv.h b/libavcodec/huffyuv.h index 83309d4b11..92e390ad78 100644 --- a/libavcodec/huffyuv.h +++ b/libavcodec/huffyuv.h @@ -72,7 +72,6 @@ typedef struct HYuvContext { int yuv; int chroma_h_shift; int chroma_v_shift; -int width, height; int flags; int context; int picture_number; @@ -96,7 +95,7 @@ typedef struct HYuvContext { void ff_huffyuv_common_init(AVCodecContext *s); void ff_huffyuv_common_end(HYuvContext *s); -int ff_huffyuv_alloc_temp(HYuvContext *s); +int ff_huffyuv_alloc_temp(HYuvContext *s, int width); int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table, int n); #endif /* AVCODEC_HUFFYUV_H */ diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index edfc8c0038..89db3db65a 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -558,7 +558,7 @@ static av_cold int decode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } -if ((ret = ff_huffyuv_alloc_temp(s)) < 0) +if ((ret = ff_huffyuv_alloc_temp(s, avctx->width)) < 0) return ret; return 0; @@ -873,8 +873,8 @@ static int decode_slice(AVCodecContext *avctx, AVFrame *p, int height, { HYuvContext *s = avctx->priv_data; int fake_ystride, fake_ustride, fake_vstride; -const int width = s->width; -const int width2 = s->width >> 1; +const int width = avctx->width; +const int width2 = avctx->width >> 1; int ret; if ((ret = init_get_bits8(&s->gb, s->bitstream_buffer + table_size, buf_size - table_size)) < 0) @@ -1185,8 +1185,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; HYuvContext *s = avctx->priv_data; -const int width = s->width; -const int height = s->height; +const int width = avctx->width; +const int height = avctx->height; int slice, table_size = 0, ret, nb_slices; unsigned slices_info_offset; int slice_height; diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 9da344a666..0e9b24c8db 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -236,7 +236,7 @@ static av_cold int encode_init(AVCodecContext *avctx) switch (avctx->pix_fmt) { case AV_PIX_FMT_YUV420P: case AV_PIX_FMT_YUV422P: -if (s->width & 1) { +if (avctx->width & 1) { av_log(avctx, AV_LOG_ERROR, "Width must be even for this colorspace.\n"); return AVERROR(EINVAL); } @@ -310,7 +310,7 @@ static av_cold int encode_init(AVCodecContext *avctx) } if (avctx->codec->id == AV_CODEC_ID_HUFFYUV) { -if (s->interlaced != ( s->height > 288 )) +if (s->interlaced != ( avctx->height > 288 )) av_log(avctx, AV_LOG_INFO, "using huffyuv 2.2.0 or newer interlacing flag\n"); } @@ -379,7 +379,7 @@ static av_cold int encode_init(AVCodecContext *avctx) if (s->context) { for (i = 0; i < 4; i++) { -int pels = s->width * s->height / (i ? 40 : 10); +int pels = avctx->width * avctx->height / (i ? 40 : 10); for (j = 0; j < s->vlc_n; j++) { int d = FFMIN(j, s->vlc_n - j); s->stats[i][j] = pels/(d*d + 1); @@ -391,7 +391,7 @@ st
[FFmpeg-cvslog] avcodec/huffyuvenc: Improve code locality
ffmpeg | branch: master | Andreas Rheinhardt | Sat Oct 1 22:05:51 2022 +0200| [f9be667452524f9e1ca9dd6e0f4e357a9b1cfaac] | committer: Andreas Rheinhardt avcodec/huffyuvenc: Improve code locality Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f9be667452524f9e1ca9dd6e0f4e357a9b1cfaac --- libavcodec/huffyuvenc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 020159a20e..f903b1924a 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -207,7 +207,7 @@ static av_cold int encode_init(AVCodecContext *avctx) HYuvContext *s = avctx->priv_data; int i, j; int ret; -const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); +const AVPixFmtDescriptor *desc; s->avctx = avctx; ff_huffyuv_common_init(avctx); @@ -215,6 +215,8 @@ static av_cold int encode_init(AVCodecContext *avctx) ff_llvidencdsp_init(&s->llvidencdsp); avctx->extradata = av_mallocz(3*MAX_N + 4); +if (!avctx->extradata) +return AVERROR(ENOMEM); if (s->flags&AV_CODEC_FLAG_PASS1) { #define STATS_OUT_SIZE 21*MAX_N*3 + 4 avctx->stats_out = av_mallocz(STATS_OUT_SIZE); // 21*256*3(%llu ) + 3(\n) + 1(0) = 16132 @@ -223,9 +225,7 @@ static av_cold int encode_init(AVCodecContext *avctx) } s->version = 2; -if (!avctx->extradata) -return AVERROR(ENOMEM); - +desc = av_pix_fmt_desc_get(avctx->pix_fmt); s->bps = desc->comp[0].depth; s->yuv = !(desc->flags & AV_PIX_FMT_FLAG_RGB) && desc->nb_components >= 2; s->chroma = desc->nb_components > 2; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/huffyuvenc: Avoid unnecessary function call
ffmpeg | branch: master | Andreas Rheinhardt | Sat Oct 1 22:09:04 2022 +0200| [bfdf3470f79571e33d0e02ced0ed9d3b45125a49] | committer: Andreas Rheinhardt avcodec/huffyuvenc: Avoid unnecessary function call av_pix_fmt_get_chroma_sub_sample() is superfluous if one already has an AVPixFmtDescriptor. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bfdf3470f79571e33d0e02ced0ed9d3b45125a49 --- libavcodec/huffyuvenc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index f903b1924a..9da344a666 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -230,9 +230,8 @@ static av_cold int encode_init(AVCodecContext *avctx) s->yuv = !(desc->flags & AV_PIX_FMT_FLAG_RGB) && desc->nb_components >= 2; s->chroma = desc->nb_components > 2; s->alpha = !!(desc->flags & AV_PIX_FMT_FLAG_ALPHA); -av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, - &s->chroma_h_shift, - &s->chroma_v_shift); +s->chroma_h_shift = desc->log2_chroma_w; +s->chroma_v_shift = desc->log2_chroma_h; switch (avctx->pix_fmt) { case AV_PIX_FMT_YUV420P: ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/huffyuv: Split HYuvContext into decoder and encoder context
ffmpeg | branch: master | Andreas Rheinhardt | Sat Oct 1 23:36:09 2022 +0200| [566280c3f464512446768fa5ee625edbf6a53c81] | committer: Andreas Rheinhardt avcodec/huffyuv: Split HYuvContext into decoder and encoder context While the share of elements used by both is quite big, the amount of code shared between the decoders and encoders is negligible. Therefore one can easily split the context if one wants to. The reasons for doing so are that the non-shared elements are non-negligible: The stats array which is only used by the encoder takes 524288B of 868904B (on x64); similarly, pix_bgr_map which is only used by the decoder takes 16KiB. Furthermore, using a shared context also entails inclusions of unneeded headers like put_bits.h for the decoder and get_bits.h for the encoder (and all of these and much more for huffyuv.c). Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=566280c3f464512446768fa5ee625edbf6a53c81 --- libavcodec/huffyuv.c| 19 ++-- libavcodec/huffyuv.h| 68 ++--- libavcodec/huffyuvdec.c | 80 - libavcodec/huffyuvdsp.c | 1 + libavcodec/huffyuvdsp.h | 13 libavcodec/huffyuvenc.c | 73 6 files changed, 139 insertions(+), 115 deletions(-) diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index 23a2bb2537..bbe4b952b0 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -30,10 +30,11 @@ #include +#include "libavutil/attributes.h" +#include "libavutil/error.h" +#include "libavutil/log.h" #include "libavutil/mem.h" -#include "avcodec.h" -#include "bswapdsp.h" #include "huffyuv.h" int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table, int n) @@ -55,25 +56,25 @@ int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table, int return 0; } -av_cold int ff_huffyuv_alloc_temp(HYuvContext *s, int width) +av_cold int ff_huffyuv_alloc_temp(uint8_t *temp[3], uint16_t *temp16[3], int width) { int i; for (i=0; i<3; i++) { -s->temp[i] = av_malloc(4 * width + 16); -if (!s->temp[i]) +temp[i] = av_malloc(4 * width + 16); +if (!temp[i]) return AVERROR(ENOMEM); -s->temp16[i] = (uint16_t*)s->temp[i]; +temp16[i] = (uint16_t*)temp[i]; } return 0; } -av_cold void ff_huffyuv_common_end(HYuvContext *s) +av_cold void ff_huffyuv_common_end(uint8_t *temp[3], uint16_t *temp16[3]) { int i; for(i = 0; i < 3; i++) { -av_freep(&s->temp[i]); -s->temp16[i] = NULL; +av_freep(&temp[i]); +temp16[i] = NULL; } } diff --git a/libavcodec/huffyuv.h b/libavcodec/huffyuv.h index 823a091809..6cc48bf57d 100644 --- a/libavcodec/huffyuv.h +++ b/libavcodec/huffyuv.h @@ -31,16 +31,19 @@ #include -#include "avcodec.h" -#include "bswapdsp.h" -#include "get_bits.h" -#include "huffyuvdsp.h" -#include "huffyuvencdsp.h" -#include "put_bits.h" -#include "lossless_videodsp.h" -#include "lossless_videoencdsp.h" - -#define VLC_BITS 12 +#include "config.h" + +#if HAVE_BIGENDIAN +#define B 3 +#define G 2 +#define R 1 +#define A 0 +#else +#define B 0 +#define G 1 +#define R 2 +#define A 3 +#endif #define MAX_BITS 16 #define MAX_N (1priv_data; int i; -ff_huffyuv_common_end(s); +ff_huffyuv_common_end(s->temp, s->temp16); av_freep(&s->bitstream_buffer); for (i = 0; i < 8; i++) @@ -293,7 +331,7 @@ static av_cold int decode_end(AVCodecContext *avctx) static av_cold int decode_init(AVCodecContext *avctx) { -HYuvContext *s = avctx->priv_data; +HYuvDecContext *s = avctx->priv_data; int ret; ret = av_image_check_size(avctx->width, avctx->height, 0, avctx); @@ -559,7 +597,7 @@ static av_cold int decode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } -if ((ret = ff_huffyuv_alloc_temp(s, avctx->width)) < 0) +if ((ret = ff_huffyuv_alloc_temp(s->temp, s->temp16, avctx->width)) < 0) return ret; return 0; @@ -618,7 +656,7 @@ static av_cold int decode_init(AVCodecContext *avctx) GET_VLC_DUAL(dst0, dst1, re, &s->gb, s->vlc[4+plane1].table,\ s->vlc[0].table, s->vlc[plane1].table, VLC_BITS, 3, OP8bits) -static void decode_422_bitstream(HYuvContext *s, int count) +static void decode_422_bitstream(HYuvDecContext *s, int count) { int i, icount; OPEN_READER(re, &s->gb); @@ -662,7 +700,7 @@ static void decode_422_bitstream(HYuvContext *s, int count) dst1 = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2;\ dst1 += get_bits(&s->gb, 2);\ } -static void decode_plane_bitstream(HYuvContext *s, int width, int plane) +static void decode_plane_bitstream(HYuvDecContext *s, int width, int plane) { int i, count = width/2; @@ -723,7 +761,7 @@ static void deco
[FFmpeg-cvslog] avocdec/huffyuvdec: Don't use HYuvContext.avctx
ffmpeg | branch: master | Andreas Rheinhardt | Sat Oct 1 21:58:49 2022 +0200| [59535346b15e10efe0cfba24261e1f24634d31a4] | committer: Andreas Rheinhardt avocdec/huffyuvdec: Don't use HYuvContext.avctx It is nearly unused anyway, so stop use the field altogether. This is in preparation for splitting HYuvContext into decoder and encoder contexts. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=59535346b15e10efe0cfba24261e1f24634d31a4 --- libavcodec/huffyuv.c| 1 - libavcodec/huffyuvdec.c | 18 +- libavcodec/huffyuvenc.c | 1 + 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index e582060cc3..471bfa1bb9 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -72,7 +72,6 @@ av_cold void ff_huffyuv_common_init(AVCodecContext *avctx) { HYuvContext *s = avctx->priv_data; -s->avctx = avctx; s->flags = avctx->flags; ff_bswapdsp_init(&s->bdsp); diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index fce7497386..edfc8c0038 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -813,12 +813,12 @@ static void decode_bgr_bitstream(HYuvContext *s, int count) } } -static void draw_slice(HYuvContext *s, AVFrame *frame, int y) +static void draw_slice(HYuvContext *s, AVCodecContext *avctx, AVFrame *frame, int y) { int h, cy, i; int offset[AV_NUM_DATA_POINTERS]; -if (!s->avctx->draw_horiz_band) +if (!avctx->draw_horiz_band) return; h = y - s->last_slice_end; @@ -836,7 +836,7 @@ static void draw_slice(HYuvContext *s, AVFrame *frame, int y) offset[i] = 0; emms_c(); -s->avctx->draw_horiz_band(s->avctx, frame, offset, y, 3, h); +avctx->draw_horiz_band(avctx, frame, offset, y, 3, h); s->last_slice_end = y + h; } @@ -952,7 +952,7 @@ static int decode_slice(AVCodecContext *avctx, AVFrame *p, int height, break; } } -draw_slice(s, p, height); +draw_slice(s, avctx, p, height); } else if (s->bitstream_bpp < 24) { int y, cy; int lefty, leftu, leftv; @@ -1006,7 +1006,7 @@ static int decode_slice(AVCodecContext *avctx, AVFrame *p, int height, break; } -draw_slice(s, p, y); +draw_slice(s, avctx, p, y); ydst = p->data[0] + p->linesize[0] * (y + y_offset); udst = p->data[1] + p->linesize[1] * (cy + y_offset); @@ -1029,7 +1029,7 @@ static int decode_slice(AVCodecContext *avctx, AVFrame *p, int height, } } } -draw_slice(s, p, height); +draw_slice(s, avctx, p, height); break; case MEDIAN: @@ -1100,7 +1100,7 @@ static int decode_slice(AVCodecContext *avctx, AVFrame *p, int height, if (y >= height) break; } -draw_slice(s, p, y); +draw_slice(s, avctx, p, y); decode_422_bitstream(s, width); @@ -1117,7 +1117,7 @@ static int decode_slice(AVCodecContext *avctx, AVFrame *p, int height, } } -draw_slice(s, p, height); +draw_slice(s, avctx, p, height); break; } } @@ -1163,7 +1163,7 @@ static int decode_slice(AVCodecContext *avctx, AVFrame *p, int height, } } // just 1 large slice as this is not possible in reverse order -draw_slice(s, p, height); +draw_slice(s, avctx, p, height); break; default: av_log(avctx, AV_LOG_ERROR, diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 2137a16714..020159a20e 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -209,6 +209,7 @@ static av_cold int encode_init(AVCodecContext *avctx) int ret; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); +s->avctx = avctx; ff_huffyuv_common_init(avctx); ff_huffyuvencdsp_init(&s->hencdsp, avctx->pix_fmt); ff_llvidencdsp_init(&s->llvidencdsp); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/huffyuv: Speed up generating Huffman codes
ffmpeg | branch: master | Andreas Rheinhardt | Sun Oct 2 00:46:11 2022 +0200| [cad1593330e9d1990fa092bc7cd2fa4324d6ccf9] | committer: Andreas Rheinhardt avcodec/huffyuv: Speed up generating Huffman codes The codes here have the property that the long codes are to the left of the tree (each zero bit child node is by definition to the left of its one bit sibling); they also have the property that among codes of the same length, the symbol is ascending from left to right. These properties can be used to create the codes from the lengths in only two passes over the array of lengths (the current code uses one pass for each length, i.e. 32): First one counts how many nodes of each length there are. Then one calculates the range of codes of each length (possible because the codes are ordered by length in the tree). This enables one to calculate the actual codes with only one further traversal of the length array. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cad1593330e9d1990fa092bc7cd2fa4324d6ccf9 --- libavcodec/huffyuv.c | 22 +- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index bbe4b952b0..6bcaacfc37 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -39,19 +39,23 @@ int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table, int n) { -int len, index; -uint32_t bits = 0; +int lens[33] = { 0 }; +uint32_t codes[33]; -for (len = 32; len > 0; len--) { -for (index = 0; index < n; index++) { -if (len_table[index] == len) -dst[index] = bits++; -} -if (bits & 1) { +for (int i = 0; i < n; i++) +lens[len_table[i]]++; + +codes[32] = 0; +for (int i = FF_ARRAY_ELEMS(lens) - 1; i > 0; i--) { +if ((lens[i] + codes[i]) & 1) { av_log(NULL, AV_LOG_ERROR, "Error generating huffman table\n"); return -1; } -bits >>= 1; +codes[i - 1] = (lens[i] + codes[i]) >> 1; +} +for (int i = 0; i < n; i++) { +if (len_table[i]) +dst[i] = codes[len_table[i]]++; } return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/huffyuv: Inline ff_huffyuv_common_init() in its callers
ffmpeg | branch: master | Andreas Rheinhardt | Sat Oct 1 22:36:34 2022 +0200| [83a8b9fac7b03a3a9c703e2a0641ab2cc35efaae] | committer: Andreas Rheinhardt avcodec/huffyuv: Inline ff_huffyuv_common_init() in its callers This is in preparation for splitting HYuvContext. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=83a8b9fac7b03a3a9c703e2a0641ab2cc35efaae --- libavcodec/huffyuv.c| 9 - libavcodec/huffyuv.h| 1 - libavcodec/huffyuvdec.c | 5 +++-- libavcodec/huffyuvenc.c | 4 +++- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index 4a5bd53998..23a2bb2537 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -68,15 +68,6 @@ av_cold int ff_huffyuv_alloc_temp(HYuvContext *s, int width) return 0; } -av_cold void ff_huffyuv_common_init(AVCodecContext *avctx) -{ -HYuvContext *s = avctx->priv_data; - -s->flags = avctx->flags; - -ff_bswapdsp_init(&s->bdsp); -} - av_cold void ff_huffyuv_common_end(HYuvContext *s) { int i; diff --git a/libavcodec/huffyuv.h b/libavcodec/huffyuv.h index 92e390ad78..823a091809 100644 --- a/libavcodec/huffyuv.h +++ b/libavcodec/huffyuv.h @@ -93,7 +93,6 @@ typedef struct HYuvContext { int non_determ; // non-deterministic, multi-threaded encoder allowed } HYuvContext; -void ff_huffyuv_common_init(AVCodecContext *s); void ff_huffyuv_common_end(HYuvContext *s); int ff_huffyuv_alloc_temp(HYuvContext *s, int width); int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table, int n); diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index 89db3db65a..093070e348 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -300,6 +300,9 @@ static av_cold int decode_init(AVCodecContext *avctx) if (ret < 0) return ret; +s->flags = avctx->flags; + +ff_bswapdsp_init(&s->bdsp); ff_huffyuvdsp_init(&s->hdsp, avctx->pix_fmt); ff_llviddsp_init(&s->llviddsp); memset(s->vlc, 0, 4 * sizeof(VLC)); @@ -545,8 +548,6 @@ static av_cold int decode_init(AVCodecContext *avctx) } } -ff_huffyuv_common_init(avctx); - if ((avctx->pix_fmt == AV_PIX_FMT_YUV422P || avctx->pix_fmt == AV_PIX_FMT_YUV420P) && avctx->width & 1) { av_log(avctx, AV_LOG_ERROR, "width must be even for this colorspace\n"); return AVERROR_INVALIDDATA; diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 0e9b24c8db..5293d32d2b 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -210,7 +210,9 @@ static av_cold int encode_init(AVCodecContext *avctx) const AVPixFmtDescriptor *desc; s->avctx = avctx; -ff_huffyuv_common_init(avctx); +s->flags = avctx->flags; + +ff_bswapdsp_init(&s->bdsp); ff_huffyuvencdsp_init(&s->hencdsp, avctx->pix_fmt); ff_llvidencdsp_init(&s->llvidencdsp); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/huffyuv: Update outdated link
ffmpeg | branch: master | Andreas Rheinhardt | Sun Oct 2 16:38:53 2022 +0200| [6bf99f8c9366e2a58bbb4eb271c1061724fcd720] | committer: Andreas Rheinhardt avcodec/huffyuv: Update outdated link Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6bf99f8c9366e2a58bbb4eb271c1061724fcd720 --- libavcodec/huffyuv.c| 2 +- libavcodec/huffyuv.h| 2 +- libavcodec/huffyuvdec.c | 2 +- libavcodec/huffyuvenc.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index 6bcaacfc37..aaba313bf1 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -3,7 +3,7 @@ * * Copyright (c) 2002-2014 Michael Niedermayer * - * see http://www.pcisys.net/~melanson/codecs/huffyuv.txt for a description of + * see https://multimedia.cx/huffyuv.txt for a description of * the algorithm used * * This file is part of FFmpeg. diff --git a/libavcodec/huffyuv.h b/libavcodec/huffyuv.h index 6cc48bf57d..22a766611e 100644 --- a/libavcodec/huffyuv.h +++ b/libavcodec/huffyuv.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2002-2014 Michael Niedermayer * - * see http://www.pcisys.net/~melanson/codecs/huffyuv.txt for a description of + * see https://multimedia.cx/huffyuv.txt for a description of * the algorithm used * * This file is part of FFmpeg. diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index a065185986..7d3515cc88 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -3,7 +3,7 @@ * * Copyright (c) 2002-2014 Michael Niedermayer * - * see http://www.pcisys.net/~melanson/codecs/huffyuv.txt for a description of + * see https://multimedia.cx/huffyuv.txt for a description of * the algorithm used * * This file is part of FFmpeg. diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 17d2490dc3..db274e37ad 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2002-2014 Michael Niedermayer * - * see http://www.pcisys.net/~melanson/codecs/huffyuv.txt for a description of + * see https://multimedia.cx/huffyuv.txt for a description of * the algorithm used * * This file is part of FFmpeg. ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/mjpegenc_common: Don't check luma/chroma matrices unnecessarily
ffmpeg | branch: master | Andreas Rheinhardt | Wed Oct 5 18:23:06 2022 +0200| [77adbe28abd2372eee46ed4c07ad737584bfebc9] | committer: Andreas Rheinhardt avcodec/mjpegenc_common: Don't check luma/chroma matrices unnecessarily These matrices are only used for MJPEG, not for LJPEG. So only check them for the former. This is in preparation for removing said matrices from LJPEG altogether (i.e. sending NULL matrices). Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=77adbe28abd2372eee46ed4c07ad737584bfebc9 --- libavcodec/mjpegenc_common.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c index 98c464fc62..0076e94296 100644 --- a/libavcodec/mjpegenc_common.c +++ b/libavcodec/mjpegenc_common.c @@ -61,15 +61,13 @@ static void jpeg_table_header(AVCodecContext *avctx, PutBitContext *p, ScanTable *intra_scantable, uint16_t luma_intra_matrix[64], uint16_t chroma_intra_matrix[64], - int hsample[3], int use_slices) + int hsample[3], int use_slices, int matrices_differ) { int i, j, size; uint8_t *ptr; if (m) { -int matrix_count = 1 + !!memcmp(luma_intra_matrix, -chroma_intra_matrix, -sizeof(luma_intra_matrix[0]) * 64); +int matrix_count = 1 + matrices_differ; if (m->force_duplicated_matrix) matrix_count = 2; /* quant matrixes */ @@ -285,9 +283,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb, const int lossless = !m; int hsample[4], vsample[4]; int components = 3 + (avctx->pix_fmt == AV_PIX_FMT_BGRA); -int chroma_matrix = !!memcmp(luma_intra_matrix, - chroma_intra_matrix, - sizeof(luma_intra_matrix[0])*64); +int chroma_matrix; ff_mjpeg_init_hvsample(avctx, hsample, vsample); @@ -299,9 +295,12 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb, jpeg_put_comments(avctx, pb, frame); +chroma_matrix = !lossless && !!memcmp(luma_intra_matrix, + chroma_intra_matrix, + sizeof(luma_intra_matrix[0]) * 64); jpeg_table_header(avctx, pb, m, intra_scantable, luma_intra_matrix, chroma_intra_matrix, hsample, - use_slices); + use_slices, chroma_matrix); switch (avctx->codec_id) { case AV_CODEC_ID_MJPEG: put_marker(pb, SOF0 ); break; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/ljpegenc: Remove unused IDCTDSPContext
ffmpeg | branch: master | Andreas Rheinhardt | Wed Oct 5 18:41:18 2022 +0200| [5bd55b488fe5e4bbeb87dbe1d47eb6cdafa7bcd2] | committer: Andreas Rheinhardt avcodec/ljpegenc: Remove unused IDCTDSPContext It is basically write-only. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5bd55b488fe5e4bbeb87dbe1d47eb6cdafa7bcd2 --- configure | 2 +- libavcodec/ljpegenc.c | 14 ++ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/configure b/configure index 957b7fe13e..ab6ff27249 100755 --- a/configure +++ b/configure @@ -2869,7 +2869,7 @@ ipu_decoder_select="mpegvideodec" jpegls_decoder_select="mjpeg_decoder" jv_decoder_select="blockdsp" lagarith_decoder_select="llviddsp" -ljpeg_encoder_select="idctdsp jpegtables" +ljpeg_encoder_select="jpegtables" lscr_decoder_select="inflate_wrapper" magicyuv_decoder_select="llviddsp" magicyuv_encoder_select="llvidencdsp" diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c index a708d71220..4b88218990 100644 --- a/libavcodec/ljpegenc.c +++ b/libavcodec/ljpegenc.c @@ -33,22 +33,16 @@ #include "libavutil/frame.h" #include "libavutil/mem.h" #include "libavutil/opt.h" -#include "libavutil/pixdesc.h" #include "avcodec.h" #include "codec_internal.h" #include "encode.h" -#include "idctdsp.h" #include "jpegtables.h" -#include "mathops.h" #include "mjpegenc_common.h" #include "mjpeg.h" typedef struct LJpegEncContext { AVClass *class; -IDCTDSPContext idsp; -ScanTable scantable; -uint16_t matrix[64]; int vsample[4]; int hsample[4]; @@ -240,8 +234,8 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt, init_put_bits(&pb, pkt->data, pkt->size); -ff_mjpeg_encode_picture_header(avctx, &pb, pict, NULL, &s->scantable, - s->pred, s->matrix, s->matrix, 0); +ff_mjpeg_encode_picture_header(avctx, &pb, pict, NULL, NULL, + s->pred, NULL, NULL, 0); header_bits = put_bits_count(&pb); @@ -287,10 +281,6 @@ static av_cold int ljpeg_encode_init(AVCodecContext *avctx) if (!s->scratch) return AVERROR(ENOMEM); -ff_idctdsp_init(&s->idsp, avctx); -ff_init_scantable(s->idsp.idct_permutation, &s->scantable, - ff_zigzag_direct); - ff_mjpeg_init_hvsample(avctx, s->hsample, s->vsample); ff_mjpeg_build_huffman_codes(s->huff_size_dc_luminance, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/ljpegenc: Remove unnecessary emms_c()
ffmpeg | branch: master | Andreas Rheinhardt | Wed Oct 5 18:49:00 2022 +0200| [af94ae7dc78b5379d62cd315d25a18f0d2c3fa18] | committer: Andreas Rheinhardt avcodec/ljpegenc: Remove unnecessary emms_c() This encoder does not use any DSP function at all. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=af94ae7dc78b5379d62cd315d25a18f0d2c3fa18 --- libavcodec/ljpegenc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c index 4b88218990..81c52a7c78 100644 --- a/libavcodec/ljpegenc.c +++ b/libavcodec/ljpegenc.c @@ -248,8 +248,6 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt, if (ret < 0) return ret; -emms_c(); - ff_mjpeg_escape_FF(&pb, header_bits >> 3); ff_mjpeg_encode_picture_trailer(&pb, header_bits); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/asvdec: Remove unnecessary emms_c()
ffmpeg | branch: master | Andreas Rheinhardt | Wed Oct 5 19:51:13 2022 +0200| [ebcaa24274c4f67393710d2d40bd75b4e2f7f8e2] | committer: Andreas Rheinhardt avcodec/asvdec: Remove unnecessary emms_c() This codec uses BswapDSP, BlockDSP and IDCTDSP. The former never used MMX, the latter does not use it for idct_put since bfb28b5ce89f3e950214b67ea95b45e3355c2caf and BlockDSP does not use it since commit ee551a21ddcbf81afe183d9489c534ee80f263a0. Therefore this emms_c() is can be removed. (It was actually always redundant, because its caller (decode_simple_internal()) calls emms_c() itself afterwards.) Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ebcaa24274c4f67393710d2d40bd75b4e2f7f8e2 --- libavcodec/asvdec.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c index 7dafc115b3..be89544732 100644 --- a/libavcodec/asvdec.c +++ b/libavcodec/asvdec.c @@ -293,8 +293,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, *got_frame = 1; -emms_c(); - return (get_bits_count(&a->gb) + 31) / 32 * 4; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/vc2enc: Don't use bitcount when byte-aligned
ffmpeg | branch: master | Andreas Rheinhardt | Thu Oct 6 02:31:21 2022 +0200| [d2dc6440e6d46d34cfb7d925d4a5420cebf5bf66] | committer: Andreas Rheinhardt avcodec/vc2enc: Don't use bitcount when byte-aligned (There is a small issue that is now being treated differently: The earlier code would record a position in a buffer that is being written to via put_bits(), then write data, then overwrite the byte at the position recorded earlier and only then flush the PutBitContext. In case there was no writeout in the meantime, said flush would overwrite what one has just written. This never happened in my tests, but maybe it can happen. In this case this commit fixes this issue by flushing before overwriting the old data.) Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d2dc6440e6d46d34cfb7d925d4a5420cebf5bf66 --- libavcodec/vc2enc.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c index 5cb6e0d198..82d11462aa 100644 --- a/libavcodec/vc2enc.c +++ b/libavcodec/vc2enc.c @@ -233,7 +233,7 @@ static void encode_parse_info(VC2EncContext *s, enum DiracParseCodes pcode) align_put_bits(&s->pb); -cur_pos = put_bits_count(&s->pb) >> 3; +cur_pos = put_bytes_count(&s->pb, 0); /* Magic string */ ff_put_string(&s->pb, "BBCD", 0); @@ -746,7 +746,7 @@ static int encode_hq_slice(AVCodecContext *avctx, void *arg) /* Luma + 2 Chroma planes */ for (p = 0; p < 3; p++) { int bytes_start, bytes_len, pad_s, pad_c; -bytes_start = put_bits_count(pb) >> 3; +bytes_start = put_bytes_count(pb, 0); put_bits(pb, 8, 0); for (level = 0; level < s->wavelet_depth; level++) { for (orientation = !!level; orientation < 4; orientation++) { @@ -755,10 +755,10 @@ static int encode_hq_slice(AVCodecContext *avctx, void *arg) quants[level][orientation]); } } -align_put_bits(pb); -bytes_len = (put_bits_count(pb) >> 3) - bytes_start - 1; +flush_put_bits(pb); +bytes_len = put_bytes_output(pb) - bytes_start - 1; if (p == 2) { -int len_diff = slice_bytes_max - (put_bits_count(pb) >> 3); +int len_diff = slice_bytes_max - put_bytes_output(pb); pad_s = FFALIGN((bytes_len + len_diff), s->size_scaler)/s->size_scaler; pad_c = (pad_s*s->size_scaler) - bytes_len; } else { @@ -766,7 +766,6 @@ static int encode_hq_slice(AVCodecContext *avctx, void *arg) pad_c = (pad_s*s->size_scaler) - bytes_len; } pb->buf[bytes_start] = pad_s; -flush_put_bits(pb); /* vc2-reference uses that padding that decodes to '0' coeffs */ memset(put_bits_ptr(pb), 0xFF, pad_c); skip_put_bytes(pb, pad_c); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/speedhqenc: Remove unnecessary headers
ffmpeg | branch: master | Andreas Rheinhardt | Thu Oct 6 02:45:57 2022 +0200| [33a96b600bd45fe5ca33e3d688b873cdaceb4ee3] | committer: Andreas Rheinhardt avcodec/speedhqenc: Remove unnecessary headers Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=33a96b600bd45fe5ca33e3d688b873cdaceb4ee3 --- libavcodec/speedhqenc.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavcodec/speedhqenc.h b/libavcodec/speedhqenc.h index 5100bb2d34..0c52e6a380 100644 --- a/libavcodec/speedhqenc.h +++ b/libavcodec/speedhqenc.h @@ -31,10 +31,7 @@ #include -#include "mjpeg.h" -#include "mjpegenc_common.h" #include "mpegvideo.h" -#include "put_bits.h" int ff_speedhq_encode_init(MpegEncContext *s); void ff_speedhq_encode_close(MpegEncContext *s); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/me_cmp: Mark ff_square_tab as hidden
ffmpeg | branch: master | Andreas Rheinhardt | Thu Oct 6 00:53:01 2022 +0200| [b9133bce0447bee9f5b4052c1467eb6908214acb] | committer: Andreas Rheinhardt avcodec/me_cmp: Mark ff_square_tab as hidden ff_square_tab is always used with an offset; if this table is marked as hidden, the compiler can infer that it and therefore also ff_square_tab + 256 have a fixed offset from the code. This allows to avoid performing "+ 256" at runtime by baking it into the offset from the code to the table. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b9133bce0447bee9f5b4052c1467eb6908214acb --- libavcodec/me_cmp.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/me_cmp.h b/libavcodec/me_cmp.h index c6de2d0061..90ea76c891 100644 --- a/libavcodec/me_cmp.h +++ b/libavcodec/me_cmp.h @@ -21,9 +21,11 @@ #include +#include "libavutil/attributes_internal.h" + #include "avcodec.h" -extern const uint32_t ff_square_tab[512]; +extern const uint32_t attribute_visibility_hidden ff_square_tab[512]; /* minimum alignment rules ;) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/mjpegenc_common: Don't flush unnecessarily
ffmpeg | branch: master | Andreas Rheinhardt | Thu Oct 6 02:47:50 2022 +0200| [4486ff924202dcfb3121596ff900873483d5ffd1] | committer: Andreas Rheinhardt avcodec/mjpegenc_common: Don't flush unnecessarily The PutBitContext has already been flushed a few lines above and nothing has been written to it in the meantime. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4486ff924202dcfb3121596ff900873483d5ffd1 --- libavcodec/mjpegenc_common.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c index 0076e94296..c37c964931 100644 --- a/libavcodec/mjpegenc_common.c +++ b/libavcodec/mjpegenc_common.c @@ -423,7 +423,6 @@ void ff_mjpeg_escape_FF(PutBitContext *pb, int start) if(ff_count==0) return; -flush_put_bits(pb); skip_put_bytes(pb, ff_count); for(i=size-1; ff_count; i--){ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/opus: Rename opus.c->opus_celt.c, opus_celt.c->opusdec_celt.c
ffmpeg | branch: master | Andreas Rheinhardt | Fri Oct 7 20:17:06 2022 +0200| [8320e236c1f11e7a397ddce7e4206c11ac9de9a9] | committer: Andreas Rheinhardt avcodec/opus: Rename opus.c->opus_celt.c, opus_celt.c->opusdec_celt.c Since commit 4fc2531fff112836026aad2bdaf128c9d15a72e3 opus.c contains only the celt stuff shared between decoder and encoder. meanwhile, opus_celt.c is decoder-only. So the new names reflect the actual content better than the current ones. Reviewed-by: Lynne Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8320e236c1f11e7a397ddce7e4206c11ac9de9a9 --- libavcodec/Makefile | 8 +- libavcodec/opus.c | 484 - libavcodec/opus_celt.c| 876 -- libavcodec/opusdec_celt.c | 586 +++ 4 files changed, 977 insertions(+), 977 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 592d9347f6..37b63cadc2 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -554,11 +554,11 @@ OBJS-$(CONFIG_NELLYMOSER_ENCODER) += nellymoserenc.o nellymoser.o OBJS-$(CONFIG_NOTCHLC_DECODER) += notchlc.o OBJS-$(CONFIG_NUV_DECODER) += nuv.o rtjpeg.o OBJS-$(CONFIG_ON2AVC_DECODER) += on2avc.o on2avcdata.o -OBJS-$(CONFIG_OPUS_DECODER)+= opusdec.o opus.o opus_celt.o opus_rc.o \ +OBJS-$(CONFIG_OPUS_DECODER)+= opusdec.o opusdec_celt.o opus_celt.o \ opus_pvq.o opus_silk.o opustab.o vorbis_data.o \ - opusdsp.o opus_parse.o -OBJS-$(CONFIG_OPUS_ENCODER)+= opusenc.o opus.o opus_rc.o opustab.o opus_pvq.o \ - opusenc_psy.o + opusdsp.o opus_parse.o opus_rc.o +OBJS-$(CONFIG_OPUS_ENCODER)+= opusenc.o opusenc_psy.o opus_celt.o \ + opus_pvq.o opus_rc.o opustab.o OBJS-$(CONFIG_PAF_AUDIO_DECODER) += pafaudio.o OBJS-$(CONFIG_PAF_VIDEO_DECODER) += pafvideo.o OBJS-$(CONFIG_PAM_DECODER) += pnmdec.o pnm.o diff --git a/libavcodec/opus.c b/libavcodec/opus.c deleted file mode 100644 index a24c38be52..00 --- a/libavcodec/opus.c +++ /dev/null @@ -1,484 +0,0 @@ -/* - * Copyright (c) 2012 Andrew D'Addesio - * Copyright (c) 2013-2014 Mozilla Corporation - * - * 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 - */ - -#include - -#include "opus_celt.h" -#include "opus_pvq.h" -#include "opustab.h" - -void ff_celt_quant_bands(CeltFrame *f, OpusRangeCoder *rc) -{ -float lowband_scratch[8 * 22]; -float norm1[2 * 8 * 100]; -float *norm2 = norm1 + 8 * 100; - -int totalbits = (f->framebits << 3) - f->anticollapse_needed; - -int update_lowband = 1; -int lowband_offset = 0; - -int i, j; - -for (i = f->start_band; i < f->end_band; i++) { -uint32_t cm[2] = { (1 << f->blocks) - 1, (1 << f->blocks) - 1 }; -int band_offset = ff_celt_freq_bands[i] << f->size; -int band_size = ff_celt_freq_range[i] << f->size; -float *X = f->block[0].coeffs + band_offset; -float *Y = (f->channels == 2) ? f->block[1].coeffs + band_offset : NULL; -float *norm_loc1, *norm_loc2; - -int consumed = opus_rc_tell_frac(rc); -int effective_lowband = -1; -int b = 0; - -/* Compute how many bits we want to allocate to this band */ -if (i != f->start_band) -f->remaining -= consumed; -f->remaining2 = totalbits - consumed - 1; -if (i <= f->coded_bands - 1) { -int curr_balance = f->remaining / FFMIN(3, f->coded_bands-i); -b = av_clip_uintp2(FFMIN(f->remaining2 + 1, f->pulses[i] + curr_balance), 14); -} - -if ((ff_celt_freq_bands[i] - ff_celt_freq_range[i] >= ff_celt_freq_bands[f->start_band] || -i == f->start_band + 1) && (update_lowband || lowband_offset == 0)) -lowband_offset = i; - -if (i == f->start_band + 1) { -/* Special Hybrid Folding (RFC 8251 section 9). Copy the first band into -the second to ensure the second band never has
[FFmpeg-cvslog] Changelog: update
ffmpeg | branch: release/4.4 | Michael Niedermayer | Sun Oct 9 19:56:48 2022 +0200| [4bc4cafaef8a55462138d7b6f7579c1522de26dc] | committer: Michael Niedermayer Changelog: update Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4bc4cafaef8a55462138d7b6f7579c1522de26dc --- Changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog b/Changelog index ada5ad7012..f2d394e29b 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest. version 4.4.3: +- avformat/vividas: Check packet size - configure: link to libatomic when it's present - avcodec/dstdec: Check for overflow in build_filter() - avformat/spdifdec: Use 64bit to compute bit rate ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] Tag n4.4.3 : FFmpeg 4.4.3 release
[ffmpeg] [branch: refs/tags/n4.4.3] Tag:3d69f9682f06bbf72e0cdcdc9e66c9307ed6b24f > http://git.videolan.org/gitweb.cgi/ffmpeg.git?a=tag;h=3d69f9682f06bbf72e0cdcdc9e66c9307ed6b24f Tagger: Michael Niedermayer Date: Sun Oct 9 21:04:19 2022 +0200 FFmpeg 4.4.3 release ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] [ffmpeg-web] branch master updated. 413ba73 web/download: Add FFmpeg 4.4.3
The branch, master has been updated via 413ba737591a423f1480772a39e5cf51ec6bbdfd (commit) from 0c8cf93b557dc54ca9bd8b0c3fd82c22cc676b56 (commit) - Log - commit 413ba737591a423f1480772a39e5cf51ec6bbdfd Author: Michael Niedermayer AuthorDate: Sun Oct 9 21:29:18 2022 +0200 Commit: Michael Niedermayer CommitDate: Sun Oct 9 21:30:58 2022 +0200 web/download: Add FFmpeg 4.4.3 diff --git a/src/download b/src/download index 3ea700b..d6eca81 100644 --- a/src/download +++ b/src/download @@ -376,10 +376,10 @@ libpostproc56. 3.100 - FFmpeg 4.4.2 "Rao" + FFmpeg 4.4.3 "Rao" -4.4.2 was released on 2022-04-14. It is the latest stable FFmpeg release +4.4.3 was released on 2022-10-09. It is the latest stable FFmpeg release from the 4.4 release branch, which was cut from master on 2021-04-08. It includes the following library versions: @@ -395,19 +395,19 @@ libswresample 3. 9.100 libpostproc55. 9.100 - Download xz tarball - PGP signature + Download xz tarball + PGP signature - Download bzip2 tarball - PGP signature + Download bzip2 tarball + PGP signature - Download gzip tarball - PGP signature + Download gzip tarball + PGP signature - https://git.ffmpeg.org/gitweb/ffmpeg.git/shortlog/n4.4.2";>Changelog + https://git.ffmpeg.org/gitweb/ffmpeg.git/shortlog/n4.4.3";>Changelog https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/refs/heads/release/4.4:/RELEASE_NOTES";>Release Notes --- Summary of changes: src/download | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) hooks/post-receive -- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/genh: Check sample rate
ffmpeg | branch: release/4.2 | Michael Niedermayer | Mon Apr 11 22:00:52 2022 +0200| [30ac63c8d2195c3ddcd2867fd607e328baa03fb0] | committer: Michael Niedermayer avformat/genh: Check sample rate Fixes: signed integer overflow: -2515507630940093440 * 4 cannot be represented in type 'long' Fixes: 46318/clusterfuzz-testcase-minimized-ffmpeg_dem_GENH_fuzzer-5009637474172928 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit a3d790f1977ed6c326eb93bb61757297a7905dcc) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=30ac63c8d2195c3ddcd2867fd607e328baa03fb0 --- libavformat/genh.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/genh.c b/libavformat/genh.c index 698104a9d6..0b55a8884a 100644 --- a/libavformat/genh.c +++ b/libavformat/genh.c @@ -67,6 +67,9 @@ static int genh_read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; st->codecpar->block_align = align * st->codecpar->channels; st->codecpar->sample_rate = avio_rl32(s->pb); +if (st->codecpar->sample_rate < 0) +return AVERROR_INVALIDDATA; + avio_skip(s->pb, 4); st->duration = avio_rl32(s->pb); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/video: Add ff_default_get_video_buffer2() to set specific alignment
ffmpeg | branch: release/4.2 | Michael Niedermayer | Mon Apr 11 22:40:59 2022 +0200| [ddc96fdb4326c4de1da2c1ef993ae2996572af93] | committer: Michael Niedermayer avfilter/video: Add ff_default_get_video_buffer2() to set specific alignment Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit d74078270198b97fdda258840f0d501a3ffcc693) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ddc96fdb4326c4de1da2c1ef993ae2996572af93 --- libavfilter/video.c | 7 ++- libavfilter/video.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libavfilter/video.c b/libavfilter/video.c index 7a8e587798..b049804419 100644 --- a/libavfilter/video.c +++ b/libavfilter/video.c @@ -41,7 +41,7 @@ AVFrame *ff_null_get_video_buffer(AVFilterLink *link, int w, int h) return ff_get_video_buffer(link->dst->outputs[0], w, h); } -AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h) +AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int align) { AVFrame *frame = NULL; int pool_width = 0; @@ -96,6 +96,11 @@ AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h) return frame; } +AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h) +{ +return ff_default_get_video_buffer2(link, w, h, av_cpu_max_align()); +} + AVFrame *ff_get_video_buffer(AVFilterLink *link, int w, int h) { AVFrame *ret = NULL; diff --git a/libavfilter/video.h b/libavfilter/video.h index 56c58d6766..f9174a4a0b 100644 --- a/libavfilter/video.h +++ b/libavfilter/video.h @@ -24,6 +24,7 @@ #include "avfilter.h" AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h); +AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int align); AVFrame *ff_null_get_video_buffer(AVFilterLink *link, int w, int h); /** ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_frei0r: Copy to frame allocated according to frei0r requirements
ffmpeg | branch: release/4.2 | Michael Niedermayer | Mon Apr 11 13:49:05 2022 +0200| [54c4f1e32b6d1c124146aba2afc5d8fd9208fb16] | committer: Michael Niedermayer avfilter/vf_frei0r: Copy to frame allocated according to frei0r requirements Fixes: issues with non trivial linesize Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit d353909e773ba8a8201fa13d6c35251351dd567a) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=54c4f1e32b6d1c124146aba2afc5d8fd9208fb16 --- libavfilter/vf_frei0r.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c index 5d38405999..8595324ec5 100644 --- a/libavfilter/vf_frei0r.c +++ b/libavfilter/vf_frei0r.c @@ -353,14 +353,20 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) { Frei0rContext *s = inlink->dst->priv; AVFilterLink *outlink = inlink->dst->outputs[0]; -AVFrame *out; +AVFrame *out = ff_default_get_video_buffer2(outlink, outlink->w, outlink->h, 16); +if (!out) +goto fail; -out = ff_get_video_buffer(outlink, outlink->w, outlink->h); -if (!out) { +av_frame_copy_props(out, in); + +if (in->linesize[0] != out->linesize[0]) { +AVFrame *in2 = ff_default_get_video_buffer2(outlink, outlink->w, outlink->h, 16); +if (!in2) +goto fail; +av_frame_copy(in2, in); av_frame_free(&in); -return AVERROR(ENOMEM); +in = in2; } -av_frame_copy_props(out, in); s->update(s->instance, in->pts * av_q2d(inlink->time_base) * 1000, (const uint32_t *)in->data[0], @@ -369,6 +375,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_free(&in); return ff_filter_frame(outlink, out); +fail: +av_frame_free(&in); +av_frame_free(&out); +return AVERROR(ENOMEM); } #define OFFSET(x) offsetof(Frei0rContext, x) @@ -451,7 +461,7 @@ static int source_config_props(AVFilterLink *outlink) static int source_request_frame(AVFilterLink *outlink) { Frei0rContext *s = outlink->src->priv; -AVFrame *frame = ff_get_video_buffer(outlink, outlink->w, outlink->h); +AVFrame *frame = ff_default_get_video_buffer2(outlink, outlink->w, outlink->h, 16); if (!frame) return AVERROR(ENOMEM); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vsrc_mandelbrot: Check for malloc failure
ffmpeg | branch: release/4.2 | Michael Niedermayer | Thu Apr 21 22:45:12 2022 +0200| [55a3423863fcdb070dc6cf2ff2d7f88399ee9bfb] | committer: Michael Niedermayer avfilter/vsrc_mandelbrot: Check for malloc failure Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit fbd22504c4148d2a01ccfe38df26c144f56db76b) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=55a3423863fcdb070dc6cf2ff2d7f88399ee9bfb --- libavfilter/vsrc_mandelbrot.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c index 6ad108151f..11650e36f7 100644 --- a/libavfilter/vsrc_mandelbrot.c +++ b/libavfilter/vsrc_mandelbrot.c @@ -134,6 +134,9 @@ static av_cold int init(AVFilterContext *ctx) s-> next_cache= av_malloc_array(s->cache_allocated, sizeof(*s-> next_cache)); s-> zyklus= av_malloc_array(s->maxiter + 16, sizeof(*s->zyklus)); +if (!s->point_cache || !s->next_cache || !s->zyklus) +return AVERROR(ENOMEM); + return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/asfdec_f: Check packet_frag_timestamp
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Mar 20 23:13:16 2022 +0100| [485aeea57c186c719b46898649a84c76ed484a63] | committer: Michael Niedermayer avformat/asfdec_f: Check packet_frag_timestamp Fixes: signed integer overflow: -9223372036854775808 - 4607 cannot be represented in type 'long' Fixes: 45685/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5280102802391040 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit ffc877215056e8f0feb1ff23ba7dc4c19277b94b) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=485aeea57c186c719b46898649a84c76ed484a63 --- libavformat/asfdec_f.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index 5ca9e981b6..c8fff6ca06 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -1315,10 +1315,12 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) if ((ret = av_new_packet(&asf_st->pkt, asf_st->packet_obj_size)) < 0) return ret; asf_st->seq = asf->packet_seq; -if (asf->ts_is_pts) { -asf_st->pkt.pts = asf->packet_frag_timestamp - asf->hdr.preroll; -} else -asf_st->pkt.dts = asf->packet_frag_timestamp - asf->hdr.preroll; +if (asf->packet_frag_timestamp != AV_NOPTS_VALUE) { +if (asf->ts_is_pts) { +asf_st->pkt.pts = asf->packet_frag_timestamp - asf->hdr.preroll; +} else +asf_st->pkt.dts = asf->packet_frag_timestamp - asf->hdr.preroll; +} asf_st->pkt.stream_index = asf->stream_index; asf_st->pkt.pos = asf_st->packet_pos = asf->packet_pos; asf_st->pkt_clean= 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/act: Check ff_get_wav_header() for failure
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun May 15 22:55:12 2022 +0200| [c8177552a7291bfe873443194bd58d921c662f6d] | committer: Michael Niedermayer avformat/act: Check ff_get_wav_header() for failure Fixes: missing error check Fixes: CID717495 Signed-off-by: Michael Niedermayer (cherry picked from commit 5982da87e3464e7df529a169352748560d70ba80) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c8177552a7291bfe873443194bd58d921c662f6d --- libavformat/act.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/act.c b/libavformat/act.c index 26425ca1bb..f6edfb44ab 100644 --- a/libavformat/act.c +++ b/libavformat/act.c @@ -66,6 +66,7 @@ static int read_header(AVFormatContext *s) AVIOContext *pb = s->pb; int size; AVStream* st; +int ret; int min,sec,msec; @@ -75,7 +76,9 @@ static int read_header(AVFormatContext *s) avio_skip(pb, 16); size=avio_rl32(pb); -ff_get_wav_header(s, pb, st->codecpar, size, 0); +ret = ff_get_wav_header(s, pb, st->codecpar, size, 0); +if (ret < 0) +return ret; /* 8000Hz (Fine-rec) file format has 10 bytes long ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/bfi: Check offsets better
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Mar 20 23:24:40 2022 +0100| [a162f52438d585f4e8f3580ec3d174dad0ef8f6d] | committer: Michael Niedermayer avformat/bfi: Check offsets better Fixes: signed integer overflow: -2145378272 - 538976288 cannot be represented in type 'int' Fixes: 45690/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5015496544616448 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 35dc93ab44a57d78956414624c4e011414220e98) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a162f52438d585f4e8f3580ec3d174dad0ef8f6d --- libavformat/bfi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/bfi.c b/libavformat/bfi.c index f9e0bb2e30..35b6816aad 100644 --- a/libavformat/bfi.c +++ b/libavformat/bfi.c @@ -140,12 +140,12 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) audio_offset= avio_rl32(pb); avio_rl32(pb); video_offset= avio_rl32(pb); -audio_size = video_offset - audio_offset; -bfi->video_size = chunk_size - video_offset; -if (audio_size < 0 || bfi->video_size < 0) { +if (audio_offset < 0 || video_offset < audio_offset || chunk_size < video_offset) { av_log(s, AV_LOG_ERROR, "Invalid audio/video offsets or chunk size\n"); return AVERROR_INVALIDDATA; } +audio_size = video_offset - audio_offset; +bfi->video_size = chunk_size - video_offset; //Tossing an audio packet at the audio decoder. ret = av_get_packet(pb, pkt, audio_size); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/texturedspenc: Fix indexing in color distribution determination
ffmpeg | branch: release/4.2 | Michael Niedermayer | Mon Jan 2 00:28:33 2017 +0100| [8987124baddcafddcf233bbdb3d9a320cba5de2c] | committer: Michael Niedermayer avcodec/texturedspenc: Fix indexing in color distribution determination Fixes CID1396405 MSE and PSNR is slightly improved, and some noticable corruptions disappear as well. Signed-off-by: Michael Niedermayer Signed-off-by: Marton Balint (cherry picked from commit ade36d61de8ea5a5acb30a05a0cbcda069127143) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8987124baddcafddcf233bbdb3d9a320cba5de2c --- libavcodec/texturedspenc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/texturedspenc.c b/libavcodec/texturedspenc.c index 3d68e0cf39..5ce72cbd1e 100644 --- a/libavcodec/texturedspenc.c +++ b/libavcodec/texturedspenc.c @@ -255,11 +255,11 @@ static void optimize_colors(const uint8_t *block, ptrdiff_t stride, muv = minv = maxv = bp[0]; for (y = 0; y < 4; y++) { -for (x = 4; x < 4; x += 4) { +for (x = 0; x < 4; x++) { muv += bp[x * 4 + y * stride]; -if (bp[x] < minv) +if (bp[x * 4 + y * stride] < minv) minv = bp[x * 4 + y * stride]; -else if (bp[x] > maxv) +else if (bp[x * 4 + y * stride] > maxv) maxv = bp[x * 4 + y * stride]; } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/aiffdec: avoid integer overflow in get_meta()
ffmpeg | branch: release/4.2 | Michael Niedermayer | Wed Mar 23 01:08:56 2022 +0100| [4aeea332ebf87cb3bb77a053516e49b082d75c4e] | committer: Michael Niedermayer avformat/aiffdec: avoid integer overflow in get_meta() Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int' Fixes: 45891/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-6159183893889024 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 6a02de21278ec3bea1d2c62665f2629d5a62210f) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4aeea332ebf87cb3bb77a053516e49b082d75c4e --- libavformat/aiffdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 68961c447a..dbd6e92a74 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -73,7 +73,7 @@ static int get_tag(AVIOContext *pb, uint32_t * tag) /* Metadata string read */ static void get_meta(AVFormatContext *s, const char *key, int size) { -uint8_t *str = av_malloc(size+1); +uint8_t *str = av_malloc(size+1U); if (str) { int res = avio_read(s->pb, str, size); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/aiffdec: cleanup size handling for extreem cases
ffmpeg | branch: release/4.2 | Michael Niedermayer | Wed Mar 23 14:30:42 2022 +0100| [62e2545463841a5ececaae7c33d3c4bc03ccd637] | committer: Michael Niedermayer avformat/aiffdec: cleanup size handling for extreem cases Signed-off-by: Michael Niedermayer (cherry picked from commit c6f1e48b86471b1cc91c468e78a065075ed409bd) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=62e2545463841a5ececaae7c33d3c4bc03ccd637 --- libavformat/aiffdec.c | 24 +++- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index dbd6e92a74..22dc3597ee 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -54,9 +54,9 @@ static enum AVCodecID aiff_codec_get_id(int bps) } /* returns the size of the found tag */ -static int get_tag(AVIOContext *pb, uint32_t * tag) +static int64_t get_tag(AVIOContext *pb, uint32_t * tag) { -int size; +int64_t size; if (avio_feof(pb)) return AVERROR(EIO); @@ -64,16 +64,16 @@ static int get_tag(AVIOContext *pb, uint32_t * tag) *tag = avio_rl32(pb); size = avio_rb32(pb); -if (size < 0) -size = 0x7fff; - return size; } /* Metadata string read */ -static void get_meta(AVFormatContext *s, const char *key, int size) +static void get_meta(AVFormatContext *s, const char *key, int64_t size) { -uint8_t *str = av_malloc(size+1U); +uint8_t *str = NULL; + +if (size < SIZE_MAX) +str = av_malloc(size+1); if (str) { int res = avio_read(s->pb, str, size); @@ -90,7 +90,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size) } /* Returns the number of sound data frames or negative on error */ -static int get_aiff_header(AVFormatContext *s, int size, +static int get_aiff_header(AVFormatContext *s, int64_t size, unsigned version) { AVIOContext *pb= s->pb; @@ -101,9 +101,6 @@ static int get_aiff_header(AVFormatContext *s, int size, int sample_rate; unsigned int num_frames; -if (size == INT_MAX) -return AVERROR_INVALIDDATA; - if (size & 1) size++; par->codec_type = AVMEDIA_TYPE_AUDIO; @@ -214,7 +211,8 @@ static int aiff_probe(const AVProbeData *p) /* aiff input */ static int aiff_read_header(AVFormatContext *s) { -int ret, size, filesize; +int ret; +int64_t filesize, size; int64_t offset = 0, position; uint32_t tag; unsigned version = AIFF_C_VERSION1; @@ -225,7 +223,7 @@ static int aiff_read_header(AVFormatContext *s) /* check FORM header */ filesize = get_tag(pb, &tag); -if (filesize < 0 || tag != MKTAG('F', 'O', 'R', 'M')) +if (filesize < 4 || tag != MKTAG('F', 'O', 'R', 'M')) return AVERROR_INVALIDDATA; /* AIFF data type */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/alacdsp: Make intermediates unsigned
ffmpeg | branch: release/4.2 | Michael Niedermayer | Thu Apr 28 23:34:53 2022 +0200| [0b999775a0b5e65e5c3963d3795fcf38ba9b88ff] | committer: Michael Niedermayer avcodec/alacdsp: Make intermediates unsigned Fixes: signed integer overflow: -14914387 + -2147418648 cannot be represented in type 'int' Fixes: 46464/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-474307197311385 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 8709f4c10a216cb3e11564bc392841e832f8e3b1) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0b999775a0b5e65e5c3963d3795fcf38ba9b88ff --- libavcodec/alacdsp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/alacdsp.c b/libavcodec/alacdsp.c index 8718d1b6b1..b3c1c424f3 100644 --- a/libavcodec/alacdsp.c +++ b/libavcodec/alacdsp.c @@ -29,12 +29,12 @@ static void decorrelate_stereo(int32_t *buffer[2], int nb_samples, int i; for (i = 0; i < nb_samples; i++) { -int32_t a, b; +uint32_t a, b; a = buffer[0][i]; b = buffer[1][i]; -a -= (int)(b * (unsigned)decorr_left_weight) >> decorr_shift; +a -= (int)(b * decorr_left_weight) >> decorr_shift; b += a; buffer[0][i] = b; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/cdgraphics: limit scrolling to the line
ffmpeg | branch: release/4.2 | Michael Niedermayer | Thu Jun 9 22:36:00 2022 +0200| [d40c8b42026fb2ab01cc66bc3dfad7463f018c60] | committer: Michael Niedermayer avcodec/cdgraphics: limit scrolling to the line Fixes: out of array access Fixes: 47877/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CDGRAPHICS_fuzzer-5690504626438144 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit b7e30a13d4e4557b87f977b76a6bb5e3cbe5ac78) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d40c8b42026fb2ab01cc66bc3dfad7463f018c60 --- libavcodec/cdgraphics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c index cf3f01a417..1341669a34 100644 --- a/libavcodec/cdgraphics.c +++ b/libavcodec/cdgraphics.c @@ -239,7 +239,7 @@ static void cdg_scroll(CDGraphicsContext *cc, uint8_t *data, for (y = FFMAX(0, vinc); y < FFMIN(CDG_FULL_HEIGHT + vinc, CDG_FULL_HEIGHT); y++) memcpy(out + FFMAX(0, hinc) + stride * y, in + FFMAX(0, hinc) - hinc + (y - vinc) * stride, - FFMIN(stride + hinc, stride)); + FFABS(stride) - FFABS(hinc)); if (vinc > 0) cdg_fill_wrapper(0, 0, out, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/ape: more bits in size for less overflows
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sat Apr 2 22:18:49 2022 +0200| [b928cd3bda752c2a0a877b2581cce2d4e19978bc] | committer: Michael Niedermayer avformat/ape: more bits in size for less overflows Fixes: signed integer overflow: 2147483647 + 3 cannot be represented in type 'int' Fixes: 46184/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-4678059519770624 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit e5f6707a7b91664491041526ef3cce7412258b89) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b928cd3bda752c2a0a877b2581cce2d4e19978bc --- libavformat/ape.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/ape.c b/libavformat/ape.c index 977e6f3d18..dcca9b20fb 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -42,8 +42,8 @@ typedef struct APEFrame { int64_t pos; +int64_t size; int nblocks; -int size; int skip; int64_t pts; } APEFrame; @@ -146,7 +146,7 @@ static void ape_dumpinfo(AVFormatContext * s, APEContext * ape_ctx) av_log(s, AV_LOG_DEBUG, "\nFrames\n\n"); for (i = 0; i < ape_ctx->totalframes; i++) -av_log(s, AV_LOG_DEBUG, "%8d %8"PRId64" %8d (%d samples)\n", i, +av_log(s, AV_LOG_DEBUG, "%8d %8"PRId64" %8"PRId64" (%d samples)\n", i, ape_ctx->frames[i].pos, ape_ctx->frames[i].size, ape_ctx->frames[i].nblocks); @@ -164,7 +164,8 @@ static int ape_read_header(AVFormatContext * s) AVStream *st; uint32_t tag; int i; -int total_blocks, final_size = 0; +int total_blocks; +int64_t final_size = 0; int64_t pts, file_size; /* Skip any leading junk such as id3v2 tags */ @@ -403,7 +404,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt) if (ape->frames[ape->currentframe].size <= 0 || ape->frames[ape->currentframe].size > INT_MAX - extra_size) { -av_log(s, AV_LOG_ERROR, "invalid packet size: %d\n", +av_log(s, AV_LOG_ERROR, "invalid packet size: %8"PRId64"\n", ape->frames[ape->currentframe].size); ape->currentframe++; return AVERROR(EIO); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/jpeglsdec: fix end check for xfrm
ffmpeg | branch: release/4.2 | Michael Niedermayer | Thu Jun 9 21:13:59 2022 +0200| [92a4adfd8c4a79139baf76b494cefeb35b06fa9c] | committer: Michael Niedermayer avcodec/jpeglsdec: fix end check for xfrm Fixes: out of array access Fixes: 47871/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AMV_fuzzer-5646305956855808 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 6a82412bf33108111eb3f63076fd5a51349ae114) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=92a4adfd8c4a79139baf76b494cefeb35b06fa9c --- libavcodec/jpeglsdec.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c index 615c9e5068..59fb304a83 100644 --- a/libavcodec/jpeglsdec.c +++ b/libavcodec/jpeglsdec.c @@ -465,19 +465,19 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, for (i = 0; i < s->height; i++) { switch(s->xfrm) { case 1: -for (x = off; x < w; x += 3) { +for (x = off; x + 2 < w; x += 3) { src[x ] += src[x+1] + 128; src[x+2] += src[x+1] + 128; } break; case 2: -for (x = off; x < w; x += 3) { +for (x = off; x + 2 < w; x += 3) { src[x ] += src[x+1] + 128; src[x+2] += ((src[x ] + src[x+1])>>1) + 128; } break; case 3: -for (x = off; x < w; x += 3) { +for (x = off; x + 2 < w; x += 3) { int g = src[x+0] - ((src[x+2]+src[x+1])>>2) + 64; src[x+0] = src[x+2] + g + 128; src[x+2] = src[x+1] + g + 128; @@ -485,7 +485,7 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, } break; case 4: -for (x = off; x < w; x += 3) { +for (x = off; x + 2 < w; x += 3) { int r= src[x+0] - (( 359 * (src[x+2]-128) + 490) >> 8); int g= src[x+0] - (( 88 * (src[x+1]-128) - 183 * (src[x+2]-128) + 30) >> 8); int b= src[x+0] + ((454 * (src[x+1]-128) + 574) >> 8); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/qdrw: adjust max colors to array size
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Jul 3 00:43:21 2022 +0200| [d79de91f1ea8262a1f6c0ef103bf4433da000eff] | committer: Michael Niedermayer avcodec/qdrw: adjust max colors to array size Fixes: out of array access Fixes: 48429/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDRAW_fuzzer-4608329791438848 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit cd847f86d31f87f0f7733ca6ab7a2c022a1398bd) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d79de91f1ea8262a1f6c0ef103bf4433da000eff --- libavcodec/qdrw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c index 65279c9805..c04c756d71 100644 --- a/libavcodec/qdrw.c +++ b/libavcodec/qdrw.c @@ -369,7 +369,7 @@ static int decode_frame(AVCodecContext *avctx, bytestream2_skip(&gbc, 18); colors = bytestream2_get_be16(&gbc); -if (colors < 0 || colors > 256) { +if (colors < 0 || colors > 255) { av_log(avctx, AV_LOG_ERROR, "Error color count - %i(0x%X)\n", colors, colors); return AVERROR_INVALIDDATA; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/aasc: Fix indention
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sat Jun 18 20:54:36 2022 +0200| [d4dad587e6d456b1ceeb1ee62cd665338f72738e] | committer: Michael Niedermayer avcodec/aasc: Fix indention Signed-off-by: Michael Niedermayer (cherry picked from commit af2ed09220fe82e0aa479d1b93be6aadc4930efc) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d4dad587e6d456b1ceeb1ee62cd665338f72738e --- libavcodec/aasc.c | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/libavcodec/aasc.c b/libavcodec/aasc.c index 58cc3c85ba..bf1555e72c 100644 --- a/libavcodec/aasc.c +++ b/libavcodec/aasc.c @@ -104,26 +104,26 @@ static int aasc_decode_frame(AVCodecContext *avctx, ff_msrle_decode(avctx, s->frame, 8, &s->gb); break; case MKTAG('A', 'A', 'S', 'C'): -switch (compr) { -case 0: -stride = (avctx->width * psize + psize) & ~psize; -if (buf_size < stride * avctx->height) +switch (compr) { +case 0: +stride = (avctx->width * psize + psize) & ~psize; +if (buf_size < stride * avctx->height) +return AVERROR_INVALIDDATA; +for (i = avctx->height - 1; i >= 0; i--) { +memcpy(s->frame->data[0] + i * s->frame->linesize[0], buf, avctx->width * psize); +buf += stride; +buf_size -= stride; +} +break; +case 1: +bytestream2_init(&s->gb, buf, buf_size); +ff_msrle_decode(avctx, s->frame, 8, &s->gb); +break; +default: +av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr); return AVERROR_INVALIDDATA; -for (i = avctx->height - 1; i >= 0; i--) { -memcpy(s->frame->data[0] + i * s->frame->linesize[0], buf, avctx->width * psize); -buf += stride; -buf_size -= stride; } break; -case 1: -bytestream2_init(&s->gb, buf, buf_size); -ff_msrle_decode(avctx, s->frame, 8, &s->gb); -break; -default: -av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr); -return AVERROR_INVALIDDATA; -} -break; default: av_log(avctx, AV_LOG_ERROR, "Unknown FourCC: %X\n", avctx->codec_tag); return -1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/sctp: close socket on errors
ffmpeg | branch: release/4.2 | Michael Niedermayer | Mon May 23 01:23:22 2022 +0200| [84fbe1a05d2a3619fd4d3edc4b0730192eaec604] | committer: Michael Niedermayer avformat/sctp: close socket on errors This is untested as i have no testcase Fixes: CID1302709 Signed-off-by: Michael Niedermayer (cherry picked from commit c9a2996544187f67e533bc24f4cf773e50d2362b) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=84fbe1a05d2a3619fd4d3edc4b0730192eaec604 --- libavformat/sctp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/sctp.c b/libavformat/sctp.c index 9a80e9b015..be0cb47865 100644 --- a/libavformat/sctp.c +++ b/libavformat/sctp.c @@ -282,6 +282,8 @@ fail: goto restart; } fail1: +if (fd >= 0) +closesocket(fd); ret = AVERROR(EIO); freeaddrinfo(ai); return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/wnv1: Check for width =1
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Jul 3 02:31:47 2022 +0200| [3ca6eeff7711183a14b02fe36af2d4cb3733be27] | committer: Michael Niedermayer avcodec/wnv1: Check for width =1 The decoder only outputs pixels for width >1 images, fail early Fixes: Timeout Fixes: 48298/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WNV1_fuzzer-6198626319204352 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit d98d5a436aa70d3cef8f914c0467ef2fb2dd1dfc) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3ca6eeff7711183a14b02fe36af2d4cb3733be27 --- libavcodec/wnv1.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/wnv1.c b/libavcodec/wnv1.c index 915e9c7dc9..291be78cc8 100644 --- a/libavcodec/wnv1.c +++ b/libavcodec/wnv1.c @@ -136,6 +136,9 @@ static av_cold int decode_init(AVCodecContext *avctx) { static VLC_TYPE code_table[1 << CODE_VLC_BITS][2]; +if (avctx->width <= 1) +return AVERROR_INVALIDDATA; + avctx->pix_fmt = AV_PIX_FMT_YUV422P; code_vlc.table = code_table; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/iff: simplify duration calculation
ffmpeg | branch: release/4.2 | Michael Niedermayer | Mon Jul 4 23:32:40 2022 +0200| [86cbbd66cd12b162f006f2ea25e860eab6727204] | committer: Michael Niedermayer avformat/iff: simplify duration calculation Fixes: signed integer overflow: 315680096256 * 134215943 cannot be represented in type 'long long' Fixes: 48713/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-5886272312311808 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 0740641e932551342cc1737d981e950ecffa3b63) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=86cbbd66cd12b162f006f2ea25e860eab6727204 --- libavformat/iff.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/iff.c b/libavformat/iff.c index e086c6d671..cf4d42ecab 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -385,7 +385,7 @@ static int read_dst_frame(AVFormatContext *s, AVPacket *pkt) avio_skip(pb, 1); pkt->flags |= AV_PKT_FLAG_KEY; pkt->stream_index = 0; -pkt->duration = 588LL * s->streams[0]->codecpar->sample_rate / 44100; +pkt->duration = s->streams[0]->codecpar->sample_rate / 75; pkt->pos = chunk_pos; chunk_pos = avio_tell(pb); @@ -398,7 +398,8 @@ static int read_dst_frame(AVFormatContext *s, AVPacket *pkt) case ID_FRTE: if (data_size < 4) return AVERROR_INVALIDDATA; -s->streams[0]->duration = avio_rb32(pb) * 588LL * s->streams[0]->codecpar->sample_rate / 44100; +s->streams[0]->duration = avio_rb32(pb) * (uint64_t)s->streams[0]->codecpar->sample_rate / 75; + break; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/ffv1dec_template: fix indention
ffmpeg | branch: release/4.2 | Michael Niedermayer | Mon Jul 4 17:19:02 2022 +0200| [7513f8c03671b12170b5ace1cf147bf36c9c96fd] | committer: Michael Niedermayer avcodec/ffv1dec_template: fix indention Signed-off-by: Michael Niedermayer (cherry picked from commit eee7364c90699f50a36aaada38c52ccc0d6bf501) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7513f8c03671b12170b5ace1cf147bf36c9c96fd --- libavcodec/ffv1dec_template.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/ffv1dec_template.c b/libavcodec/ffv1dec_template.c index 0b1d176ba1..9b1d65e825 100644 --- a/libavcodec/ffv1dec_template.c +++ b/libavcodec/ffv1dec_template.c @@ -93,11 +93,11 @@ static av_always_inline int RENAME(decode_line)(FFV1Context *s, int w, run_count--; } } else { -while (run_count > 1 && w-x > 1) { -sample[1][x] = RENAME(predict)(sample[1] + x, sample[0] + x); -x++; -run_count--; -} +while (run_count > 1 && w-x > 1) { +sample[1][x] = RENAME(predict)(sample[1] + x, sample[0] + x); +x++; +run_count--; +} } run_count--; if (run_count < 0) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/ffv1dec: Limit golomb rice coded slices to width 8M
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Jul 3 13:31:19 2022 +0200| [2921c393b180d87cf60a6a36a42304cbbe3e6db8] | committer: Michael Niedermayer avcodec/ffv1dec: Limit golomb rice coded slices to width 8M This limit is possibly not reachable due to other restrictions on buffers but the decoder run table is too small beyond this, so explicitly check for it. Signed-off-by: Michael Niedermayer (cherry picked from commit b4431399ec1e10afff458cf1ffae2a75987d725a) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2921c393b180d87cf60a6a36a42304cbbe3e6db8 --- libavcodec/ffv1dec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index 2ff749ffa4..dddfaed4d5 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -188,6 +188,9 @@ static int decode_slice_header(FFV1Context *f, FFV1Context *fs) || (unsigned)fs->slice_y + (uint64_t)fs->slice_height > f->height) return -1; +if (fs->ac == AC_GOLOMB_RICE && fs->slice_width >= (1<<23)) +return AVERROR_INVALIDDATA; + for (i = 0; i < f->plane_count; i++) { PlaneContext * const p = &fs->plane[i]; int idx = get_symbol(c, state, 0); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/qpeldsp: copy less for the mc0x cases
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Jun 26 00:59:15 2022 +0200| [a541add1b653d28728cb0db6ab7cd5807bb19ff4] | committer: Michael Niedermayer avcodec/qpeldsp: copy less for the mc0x cases Fixes: out of array access Fixes: 47936/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5745039940124672 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit e690d4edf581c42dbd907c0fafe53fba86a00812) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a541add1b653d28728cb0db6ab7cd5807bb19ff4 --- libavcodec/qpeldsp.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/qpeldsp.c b/libavcodec/qpeldsp.c index 6e52b33657..d99b8fd0ba 100644 --- a/libavcodec/qpeldsp.c +++ b/libavcodec/qpeldsp.c @@ -198,7 +198,7 @@ static void OPNAME ## qpel8_mc01_c(uint8_t *dst, const uint8_t *src, \ uint8_t full[16 * 9]; \ uint8_t half[64]; \ \ -copy_block9(full, src, 16, stride, 9);\ +copy_block8(full, src, 16, stride, 9);\ put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16); \ OPNAME ## pixels8_l2_8(dst, full, half, stride, 16, 8, 8);\ } \ @@ -208,7 +208,7 @@ static void OPNAME ## qpel8_mc02_c(uint8_t *dst, const uint8_t *src, \ { \ uint8_t full[16 * 9]; \ \ -copy_block9(full, src, 16, stride, 9);\ +copy_block8(full, src, 16, stride, 9);\ OPNAME ## mpeg4_qpel8_v_lowpass(dst, full, stride, 16); \ } \ \ @@ -218,7 +218,7 @@ static void OPNAME ## qpel8_mc03_c(uint8_t *dst, const uint8_t *src, \ uint8_t full[16 * 9]; \ uint8_t half[64]; \ \ -copy_block9(full, src, 16, stride, 9);\ +copy_block8(full, src, 16, stride, 9);\ put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16); \ OPNAME ## pixels8_l2_8(dst, full + 16, half, stride, 16, 8, 8); \ } \ @@ -458,7 +458,7 @@ static void OPNAME ## qpel16_mc01_c(uint8_t *dst, const uint8_t *src, \ uint8_t full[24 * 17];\ uint8_t half[256];\ \ -copy_block17(full, src, 24, stride, 17); \ +copy_block16(full, src, 24, stride, 17); \ put ## RND ## mpeg4_qpel16_v_lowpass(half, full, 16, 24); \ OPNAME ## pixels16_l2_8(dst, full, half, stride, 24, 16, 16); \ } \ @@ -468,7 +468,7 @@ static void OPNAME ## qpel16_mc02_c(uint8_t *dst, const uint8_t *src, \ { \ uint8_t full[24 * 17];\ \ -copy_block17(full, src, 24, stride, 17); \ +copy_block16(full, src, 24, stride, 17); \ OPNAME ## mpeg4_qpel16_v_lowpass(dst, full, stride, 24); \ } \ \ @@ -478,7 +478,7 @@ static void OPNAME ## qpel16_mc03_c(uint8_t *dst, const uint8_t *src, \ uint8_t full[24 * 17];\ uint8_t half[256];\
[FFmpeg-cvslog] avcodec/hevcdsp_template: stay within tables in sao_band_filter()
ffmpeg | branch: release/4.2 | Michael Niedermayer | Thu Jun 9 22:21:55 2022 +0200| [c7c63dead57e1648d52b49465ef28fdab36c8465] | committer: Michael Niedermayer avcodec/hevcdsp_template: stay within tables in sao_band_filter() Fixes: out of array read Fixes: 47875/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5719393113341952 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 9c5250a5612d4b32d79108de0c03945b2017963e) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c7c63dead57e1648d52b49465ef28fdab36c8465 --- libavcodec/hevcdsp_template.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c index 56cd9e605d..61425975cd 100644 --- a/libavcodec/hevcdsp_template.c +++ b/libavcodec/hevcdsp_template.c @@ -313,7 +313,7 @@ static void FUNC(sao_band_filter)(uint8_t *_dst, uint8_t *_src, offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) -dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]); +dst[x] = av_clip_pixel(src[x] + offset_table[(src[x] >> shift) & 31]); dst += stride_dst; src += stride_src; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/rtsp: break on unknown protocols
ffmpeg | branch: release/4.2 | Michael Niedermayer | Fri May 20 00:50:33 2022 +0200| [ea9418debcf3673428e1daef4e9978ab0a663e8e] | committer: Michael Niedermayer avformat/rtsp: break on unknown protocols This function needs more cleanup and it lacks error handling Fixes: use of uninitialized memory Fixes: CID700776 Signed-off-by: Michael Niedermayer (cherry picked from commit 73c0fd27c5c53c42e5060fb3a0c1fc5708b6f670) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ea9418debcf3673428e1daef4e9978ab0a663e8e --- libavformat/rtsp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 859defa592..664272c0ac 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -932,6 +932,8 @@ static void rtsp_parse_transport(AVFormatContext *s, ";,", &p); } th->transport = RTSP_TRANSPORT_RAW; +} else { +break; } if (!av_strcasecmp(lower_transport, "TCP")) th->lower_transport = RTSP_LOWER_TRANSPORT_TCP; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/h264dec: Skip late SEI
ffmpeg | branch: release/4.2 | Michael Niedermayer | Wed Apr 27 22:16:51 2022 +0200| [43b4d0afd5a9b9379eaa72c3ef18dc7406d9a35e] | committer: Michael Niedermayer avcodec/h264dec: Skip late SEI Fixes: Race condition Fixes: clusterfuzz-testcase-minimized-mediasource_MP2T_AVC_pipeline_integration_fuzzer-6282675434094592 Found-by: google ClusterFuzz Tested-by: Dan Sanders Signed-off-by: Michael Niedermayer (cherry picked from commit f7dd408d64013ae177c1f8d0e04418e5075db5bc) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=43b4d0afd5a9b9379eaa72c3ef18dc7406d9a35e --- libavcodec/h264dec.c | 4 1 file changed, 4 insertions(+) diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index daf113060a..062e3adfc1 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -699,6 +699,10 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size) avpriv_request_sample(avctx, "data partitioning"); break; case H264_NAL_SEI: +if (h->setup_finished) { +avpriv_request_sample(avctx, "Late SEI"); +break; +} ret = ff_h264_sei_decode(&h->sei, &nal->gb, &h->ps, avctx); h->has_recovery_point = h->has_recovery_point || h->sei.recovery_point.recovery_frame_cnt != -1; if (avctx->debug & FF_DEBUG_GREEN_MD) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_signature: Fix integer overflow in filter_frame()
ffmpeg | branch: release/4.2 | Michael Niedermayer | Wed May 18 02:10:52 2022 +0200| [30dff62b4fdacfefee61ff91f9b75985fee3dd9d] | committer: Michael Niedermayer avfilter/vf_signature: Fix integer overflow in filter_frame() Fixes: CID1403233 The second of the 2 changes may be unneeded but will help coverity Signed-off-by: Michael Niedermayer (cherry picked from commit dd6040675ec18d19429f882caea6bb306ed6677a) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=30dff62b4fdacfefee61ff91f9b75985fee3dd9d --- libavfilter/vf_signature.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c index d07b213f31..8bdd7f55a2 100644 --- a/libavfilter/vf_signature.c +++ b/libavfilter/vf_signature.c @@ -223,7 +223,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref) dw1 = inlink->w / 32; if (inlink->w % 32) dw2 = dw1 + 1; -denom = (sc->divide) ? dh1 * dh2 * dw1 * dw2 : 1; +denom = (sc->divide) ? dh1 * (int64_t)dh2 * dw1 * dw2 : 1; for (i = 0; i < 32; i++) { rowcount = 0; @@ -249,7 +249,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref) } } -denom = (sc->divide) ? 1 : dh1 * dh2 * dw1 * dw2; +denom = (sc->divide) ? 1 : dh1 * (int64_t)dh2 * dw1 * dw2; for (i = 0; i < ELEMENT_COUNT; i++) { const ElemCat* elemcat = elements[i]; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/lagarith: Check dst/src in zero run code
ffmpeg | branch: release/4.2 | Michael Niedermayer | Tue Jul 12 20:43:20 2022 +0200| [52c4226a6875bdd78066d68210c46cfa332f30ad] | committer: Michael Niedermayer avcodec/lagarith: Check dst/src in zero run code Fixes: out of array access Fixes: 48799/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LAGARITH_fuzzer-4764457825337344 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit 9450f759748d02d1d284d2e4afd741cb0fe0c04a) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=52c4226a6875bdd78066d68210c46cfa332f30ad --- libavcodec/lagarith.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c index 0a45812bc1..bbd90526b9 100644 --- a/libavcodec/lagarith.c +++ b/libavcodec/lagarith.c @@ -408,6 +408,9 @@ output_zeros: if (zero_run) { zero_run = 0; i += esc_count; +if (i > end - dst || +i >= src_end - src) +return AVERROR_INVALIDDATA; memcpy(dst, src, i); dst += i; l->zeros_rem = lag_calc_zero_run(src[i]); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/asfdec_f: Use 64bit for packet start time
ffmpeg | branch: release/4.2 | Michael Niedermayer | Tue Jul 19 00:32:18 2022 +0200| [ea1761e14d46c1475696332c120e062f24851dc2] | committer: Michael Niedermayer avformat/asfdec_f: Use 64bit for packet start time Fixes: signed integer overflow: 2147483647 + 32 cannot be represented in type 'int' Fixes: 49014/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_fuzzer-6314973315334144 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 8ed78486fcb065b5b459f14d4b1c3242f6d21ec7) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ea1761e14d46c1475696332c120e062f24851dc2 --- libavformat/asfdec_f.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index c8fff6ca06..7418410d43 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -104,7 +104,7 @@ typedef struct ASFContext { int ts_is_pts; int packet_multi_size; int packet_time_delta; -int packet_time_start; +int64_t packet_time_start; int64_t packet_pos; int stream_index; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/nutdec: Check get_packetheader() in mainheader
ffmpeg | branch: release/4.2 | Michael Niedermayer | Wed Jul 6 23:54:49 2022 +0200| [1b8dbd0b37d5a4f7936fc091aa49faa0ed637951] | committer: Michael Niedermayer avformat/nutdec: Check get_packetheader() in mainheader Fixes; Timeout Fixes: 48794/clusterfuzz-testcase-minimized-ffmpeg_dem_NUT_fuzzer-6524604713140224 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit b5de084aa63b79586bc445e6a7fea837688b3941) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1b8dbd0b37d5a4f7936fc091aa49faa0ed637951 --- libavformat/nutdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index cc1e6b6fbe..855214a451 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -199,6 +199,8 @@ static int decode_main_header(NUTContext *nut) int tmp_stream, tmp_mul, tmp_pts, tmp_size, tmp_res, tmp_head_idx; length = get_packetheader(nut, bc, 1, MAIN_STARTCODE); +if (length == (uint64_t)-1) +return AVERROR_INVALIDDATA; end = length + avio_tell(bc); nut->version = ffio_read_varlen(bc); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/flvdec: Check for EOF in index reading
ffmpeg | branch: release/4.2 | Michael Niedermayer | Mon Jun 20 01:36:29 2022 +0200| [1654bac49ebeab42ddee66272d64032c6afc48b3] | committer: Michael Niedermayer avformat/flvdec: Check for EOF in index reading Fixes: Timeout Fixes: 47992/clusterfuzz-testcase-minimized-ffmpeg_dem_LIVE_FLV_fuzzer-6020443879899136 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit ceff5d7b74cd9ae6055957979d27d289c70a9e1b) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1654bac49ebeab42ddee66272d64032c6afc48b3 --- libavformat/flvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index ce706da03c..a4b582cf60 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -462,6 +462,8 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, int64_t m goto invalid; if (current_array == × && (d <= INT64_MIN / 1000 || d >= INT64_MAX / 1000)) goto invalid; +if (avio_feof(ioc)) +goto invalid; current_array[0][i] = d; } if (times && filepositions) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/sbrdsp_fixed: Fix integer overflows in sbr_qmf_deint_neg_c()
ffmpeg | branch: release/4.2 | Michael Niedermayer | Mon May 2 00:51:12 2022 +0200| [f5c39a8672506567eb037c3dbe3a3514e1edbe7e] | committer: Michael Niedermayer avcodec/sbrdsp_fixed: Fix integer overflows in sbr_qmf_deint_neg_c() Fixes: signed integer overflow: 2147483645 + 16 cannot be represented in type 'int' Fixes: 46993/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-4759025234870272 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 1537f40516d625fc5fa57db4fdfb737312fbc500) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f5c39a8672506567eb037c3dbe3a3514e1edbe7e --- libavcodec/sbrdsp_fixed.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/sbrdsp_fixed.c b/libavcodec/sbrdsp_fixed.c index 43fcc90ae5..0d34a2a710 100644 --- a/libavcodec/sbrdsp_fixed.c +++ b/libavcodec/sbrdsp_fixed.c @@ -114,8 +114,8 @@ static void sbr_qmf_deint_neg_c(int *v, const int *src) { int i; for (i = 0; i < 32; i++) { -v[ i] = ( src[63 - 2*i] + 0x10) >> 5; -v[63 - i] = (-src[63 - 2*i - 1] + 0x10) >> 5; +v[ i] = (int)(0x10U + src[63 - 2*i]) >> 5; +v[63 - i] = (int)(0x10U - src[63 - 2*i - 1]) >> 5; } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/hevcdec: Check s->ref in the md5 path similar to hwaccel
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Aug 14 23:39:56 2022 +0200| [85f1286c8f4ed33f3ed43cc28d5dda044e1764ca] | committer: Michael Niedermayer avcodec/hevcdec: Check s->ref in the md5 path similar to hwaccel This is somewhat redundant with the is_decoded check. Maybe there is a nicer solution Fixes: Null pointer dereference Fixes: 49584/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5297367351427072 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 3b51e1992289383aa9f083c88e153e34b6412c89) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=85f1286c8f4ed33f3ed43cc28d5dda044e1764ca --- libavcodec/hevcdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 30d5768c0f..06804fd94b 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -3236,7 +3236,7 @@ static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output, } } else { /* verify the SEI checksum */ -if (avctx->err_recognition & AV_EF_CRCCHECK && s->is_decoded && +if (avctx->err_recognition & AV_EF_CRCCHECK && s->ref && s->is_decoded && s->sei.picture_hash.is_md5) { ret = verify_md5(s, s->ref->frame); if (ret < 0 && avctx->err_recognition & AV_EF_EXPLODE) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
ffmpeg-cvslog@ffmpeg.org
ffmpeg | branch: release/4.2 | Michael Niedermayer | Fri Jul 22 00:51:32 2022 +0200| [3a41f58c94e2595204f70e0c9e7526e282574958] | committer: Michael Niedermayer avcodec/hevc_filter: copy_CTB() only within width&height Fixes: out of array access Fixes: 49271/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5424984922652672 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 009ef35d384c3df22d8a8be7416dc9d532e91c52) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3a41f58c94e2595204f70e0c9e7526e282574958 --- libavcodec/hevc_filter.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c index 6b9824088c..a45cb6f0fb 100644 --- a/libavcodec/hevc_filter.c +++ b/libavcodec/hevc_filter.c @@ -145,11 +145,22 @@ int i, j; if (((intptr_t)dst | (intptr_t)src | stride_dst | stride_src) & 15) { for (i = 0; i < height; i++) { -for (j = 0; j < width; j+=8) +for (j = 0; j < width - 7; j+=8) AV_COPY64U(dst+j, src+j); dst += stride_dst; src += stride_src; } +if (width&7) { +dst += ((width>>3)<<3) - stride_dst * height; +src += ((width>>3)<<3) - stride_src * height; +width &= 7; +for (i = 0; i < height; i++) { +for (j = 0; j < width; j++) +dst[j] = src[j]; +dst += stride_dst; +src += stride_src; +} +} } else { for (i = 0; i < height; i++) { for (j = 0; j < width; j+=16) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/h263dec: Sanity check against minimal I/P frame size
ffmpeg | branch: release/4.2 | Michael Niedermayer | Mon Aug 15 00:02:37 2022 +0200| [457941c11ad8b2490d71837d5e17a4d3b4ec77fe] | committer: Michael Niedermayer avcodec/h263dec: Sanity check against minimal I/P frame size Fixes: Timeout Fixes: 49718/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-4874987894341632 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit ca4ff9c21cb77e024fa4ff5889826a8bee4d0e0a) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=457941c11ad8b2490d71837d5e17a4d3b4ec77fe --- libavcodec/h263dec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 8ee844e298..2b64cb5b3b 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -544,6 +544,8 @@ retry: avctx->has_b_frames = !s->low_delay; if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) { +if (s->pict_type != AV_PICTURE_TYPE_B && s->mb_num/2 > get_bits_left(&s->gb)) +return AVERROR_INVALIDDATA; if (ff_mpeg4_workaround_bugs(avctx) == 1) goto retry; if (s->studio_profile != (s->idsp.idct == NULL)) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] MAINTAINERS: Add ED25519 key for signing my commits in the future
ffmpeg | branch: release/4.2 | Michael Niedermayer | Tue Aug 9 21:53:32 2022 +0200| [6b42366763e6aefd503e760abc1134d06017015a] | committer: Michael Niedermayer MAINTAINERS: Add ED25519 key for signing my commits in the future Signed-off-by: Michael Niedermayer (cherry picked from commit 05225180bea208dfd81efac327e429711a963697) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6b42366763e6aefd503e760abc1134d06017015a --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 88b0109f22..22bfe3b2f2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -601,6 +601,7 @@ Jean Delvare 7CA6 9F44 60F1 BDC4 1FD2 C858 A552 6B9B B3CD 4E6A Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE Lou Logan (llogan)7D68 DC73 CBEF EABB 671A B6CF 621C 2E28 82F8 DC3A Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB + DD1E C9E8 DE08 5C62 9B3E 1846 B18E 8928 B394 8D64 Nicolas George24CE 01CE 9ACC 5CEB 74D8 8D9D B063 D997 36E5 4C93 Nikolay Aleksandrov 8978 1D8C FB71 588E 4B27 EAA8 C4F0 B5FC E011 13B1 Panagiotis Issaris6571 13A3 33D9 3726 F728 AA98 F643 B12E ECF3 E029 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] libavformat/iff: Check for overflow in body_end calculation
ffmpeg | branch: release/4.2 | Michael Niedermayer | Mon Aug 22 20:31:32 2022 +0200| [e84ddc90c78696adcebb2e6d43c1e60467992362] | committer: Michael Niedermayer libavformat/iff: Check for overflow in body_end calculation Fixes: signed integer overflow: -6322983228386819992 - 5557477266266529857 cannot be represented in type 'long' Fixes: 50112/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-6329186221948928 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit bcb46903040e5a5199281f4ad0a1fdaf750ebc37) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e84ddc90c78696adcebb2e6d43c1e60467992362 --- libavformat/iff.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/iff.c b/libavformat/iff.c index cf4d42ecab..bce9425a32 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -502,6 +502,9 @@ static int iff_read_header(AVFormatContext *s) case ID_DST: case ID_MDAT: iff->body_pos = avio_tell(pb); +if (iff->body_pos < 0 || iff->body_pos + data_size > INT64_MAX) +return AVERROR_INVALIDDATA; + iff->body_end = iff->body_pos + data_size; iff->body_size = data_size; if (chunk_id == ID_DST) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] libavcodec/8bps: Check that line lengths fit within the buffer
ffmpeg | branch: release/4.2 | Michael Niedermayer | Mon Aug 22 22:10:09 2022 +0200| [b9a50e01610cfd8f3dbe61bf06dbfdacab41f56b] | committer: Michael Niedermayer libavcodec/8bps: Check that line lengths fit within the buffer Fixes: Timeout Fixes: undefined pointer arithmetic Fixes: 50330/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EIGHTBPS_fuzzer-5436287485607936 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 2316d5ec1a95b13ff9a0ce80409fa367a041966d) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b9a50e01610cfd8f3dbe61bf06dbfdacab41f56b --- libavcodec/8bps.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c index aa2318fa2d..655c62725b 100644 --- a/libavcodec/8bps.c +++ b/libavcodec/8bps.c @@ -70,6 +70,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, unsigned char *planemap = c->planemap; int ret; +if (buf_size < planes * height *2) +return AVERROR_INVALIDDATA; + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/avidec: Prevent entity expansion attacks
ffmpeg | branch: release/4.2 | Michael Niedermayer | Thu Aug 18 00:22:41 2022 +0200| [28f1396cfbed254a8c350da0512c48058ecee59a] | committer: Michael Niedermayer avformat/avidec: Prevent entity expansion attacks Fixes: Timeout Fixes no testcase, this is the same idea as similar attacks against XML parsers Signed-off-by: Michael Niedermayer (cherry picked from commit f3e823c2aa04d4f5571a5e04c27a244890704c8d) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=28f1396cfbed254a8c350da0512c48058ecee59a --- libavformat/avidec.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 2635bbac28..430b4c8aa7 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -80,6 +80,8 @@ typedef struct AVIContext { int stream_index; DVDemuxContext *dv_demux; int odml_depth; +int64_t odml_read; +int64_t odml_max_pos; int use_odml; #define MAX_ODML_DEPTH 1000 int64_t dts_max; @@ -189,7 +191,7 @@ static int read_odml_index(AVFormatContext *s, int64_t frame_num) st = s->streams[stream_id]; ast = st->priv_data; -if (index_sub_type) +if (index_sub_type || entries_in_use < 0) return AVERROR_INVALIDDATA; avio_rl32(pb); @@ -210,11 +212,18 @@ static int read_odml_index(AVFormatContext *s, int64_t frame_num) } for (i = 0; i < entries_in_use; i++) { +avi->odml_max_pos = FFMAX(avi->odml_max_pos, avio_tell(pb)); + +// If we read more than there are bytes then we must have been reading something twice +if (avi->odml_read > avi->odml_max_pos) +return AVERROR_INVALIDDATA; + if (index_type) { int64_t pos = avio_rl32(pb) + base - 8; int len = avio_rl32(pb); int key = len >= 0; len &= 0x7FFF; +avi->odml_read += 8; av_log(s, AV_LOG_TRACE, "pos:%"PRId64", len:%X\n", pos, len); @@ -233,6 +242,7 @@ static int read_odml_index(AVFormatContext *s, int64_t frame_num) int64_t offset, pos; int duration; int ret; +avi->odml_read += 16; offset = avio_rl64(pb); avio_rl32(pb); /* size */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] doc/git-howto.texi: Document commit signing
ffmpeg | branch: release/4.2 | Michael Niedermayer | Tue Aug 9 21:49:04 2022 +0200| [54efe79ce7b587522469ec8a4fbcba63b458321c] | committer: Michael Niedermayer doc/git-howto.texi: Document commit signing Signed-off-by: Michael Niedermayer (cherry picked from commit ced0dc807eb67516b341d68f04ce5a87b02820de) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=54efe79ce7b587522469ec8a4fbcba63b458321c --- doc/git-howto.texi | 22 +- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/doc/git-howto.texi b/doc/git-howto.texi index 2b4fb80233..bd26fcb259 100644 --- a/doc/git-howto.texi +++ b/doc/git-howto.texi @@ -187,11 +187,18 @@ to make sure you don't have untracked files or deletions. git add [-i|-p|-A] @end example -Make sure you have told Git your name and email address +Make sure you have told Git your name, email address and GPG key @example git config --global user.name "My Name" git config --global user.email my@@email.invalid +git config --global user.signingkey ABCDEF0123245 +@end example + +Enable signing all commits or use -S + +@example +git config --global commit.gpgsign true @end example Use @option{--global} to set the global configuration for all your Git checkouts. @@ -393,6 +400,19 @@ git checkout -b svn_23456 $SHA1 where @var{$SHA1} is the commit hash from the @command{git log} output. +@chapter gpg key generation + +If you have no gpg key yet, we recommend that you create a ed25519 based key as it +is small, fast and secure. Especially it results in small signatures in git. + +@example +gpg --default-new-key-algo "ed25519/cert,sign+cv25519/encr" --quick-generate-key "human@@server.com" +@end example + +When generating a key, make sure the email specified matches the email used in git as some sites like +github consider mismatches a reason to declare such commits unverified. After generating a key you +can add it to the MAINTAINER file and upload it to a keyserver. + @chapter Pre-push checklist Once you have a set of commits that you feel are ready for pushing, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/asfdec_o: limit recursion depth in asf_read_unknown()
ffmpeg | branch: release/4.2 | Michael Niedermayer | Wed Aug 31 01:21:38 2022 +0200| [48b8139b95078c88ab580968462a81207126ec3c] | committer: Michael Niedermayer avformat/asfdec_o: limit recursion depth in asf_read_unknown() The threshold of 5 is arbitrary, both smaller and larger should work fine Fixes: Stack overflow Fixes: 50603/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_O_fuzzer-6049302564175872 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 1f1a368169ef9d945dc4b4764f5c60ba9bbc9134) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=48b8139b95078c88ab580968462a81207126ec3c --- libavformat/asfdec_o.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c index 1704719f03..baede5ba20 100644 --- a/libavformat/asfdec_o.c +++ b/libavformat/asfdec_o.c @@ -113,6 +113,7 @@ typedef struct ASFContext { int64_t data_offset; int64_t first_packet_offset; // packet offset int64_t unknown_offset; // for top level header objects or subobjects without specified behavior +int in_asf_read_unknown; // ASF file must not contain more than 128 streams according to the specification ASFStream *asf_st[ASF_MAX_STREAMS]; @@ -177,7 +178,7 @@ static int asf_read_unknown(AVFormatContext *s, const GUIDParseTable *g) uint64_t size = avio_rl64(pb); int ret; -if (size > INT64_MAX) +if (size > INT64_MAX || asf->in_asf_read_unknown > 5) return AVERROR_INVALIDDATA; if (asf->is_header) @@ -186,8 +187,11 @@ static int asf_read_unknown(AVFormatContext *s, const GUIDParseTable *g) if (!g->is_subobject) { if (!(ret = strcmp(g->name, "Header Extension"))) avio_skip(pb, 22); // skip reserved fields and Data Size -if ((ret = detect_unknown_subobject(s, asf->unknown_offset, -asf->unknown_size)) < 0) +asf->in_asf_read_unknown ++; +ret = detect_unknown_subobject(s, asf->unknown_offset, +asf->unknown_size); +asf->in_asf_read_unknown --; +if (ret < 0) return ret; } else { if (size < 24) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/bink: disallow odd positioned scaled blocks
ffmpeg | branch: release/4.2 | Michael Niedermayer | Mon Jun 13 02:01:20 2022 +0200| [9909b41f92e754c10e7835977027ceac554a4081] | committer: Michael Niedermayer avcodec/bink: disallow odd positioned scaled blocks Fixes: out of array access Fixes: 47911/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINK_fuzzer-6194020855971840 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Anton Khirnov Signed-off-by: Michael Niedermayer (cherry picked from commit b14104a6376cd774b08cbe5fda56b34320a41b2e) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9909b41f92e754c10e7835977027ceac554a4081 --- libavcodec/bink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/bink.c b/libavcodec/bink.c index d18c0ceae4..5834b4e465 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -1052,7 +1052,7 @@ static int bink_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb, for (bx = 0; bx < bw; bx++, dst += 8, prev += 8) { blk = get_value(c, BINK_SRC_BLOCK_TYPES); // 16x16 block type on odd line means part of the already decoded block, so skip it -if ((by & 1) && blk == SCALED_BLOCK) { +if (((by & 1) || (bx & 1)) && blk == SCALED_BLOCK) { bx++; dst += 8; prev += 8; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/fmvc: Move frame allocation to a later stage
ffmpeg | branch: release/4.2 | Michael Niedermayer | Fri Jun 10 23:09:09 2022 +0200| [6c6861279d2d7ebe32d44975629bb49225d1fd5a] | committer: Michael Niedermayer avcodec/fmvc: Move frame allocation to a later stage This way more things are checked before allocation Signed-off-by: Michael Niedermayer (cherry picked from commit 9783749c66bf6ca2ce7a6db4c74957fe77cbe803) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6c6861279d2d7ebe32d44975629bb49225d1fd5a --- libavcodec/fmvc.c | 21 +++-- 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/libavcodec/fmvc.c b/libavcodec/fmvc.c index 5bee96a18d..8f5b59da22 100644 --- a/libavcodec/fmvc.c +++ b/libavcodec/fmvc.c @@ -401,20 +401,17 @@ static int decode_frame(AVCodecContext *avctx, void *data, PutByteContext *pb = &s->pb; AVFrame *frame = data; int ret, y, x; +int key_frame; if (avpkt->size < 8) return AVERROR_INVALIDDATA; -if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) -return ret; - bytestream2_init(gb, avpkt->data, avpkt->size); bytestream2_skip(gb, 2); -frame->key_frame = !!bytestream2_get_le16(gb); -frame->pict_type = frame->key_frame ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; +key_frame = !!bytestream2_get_le16(gb); -if (frame->key_frame) { +if (key_frame) { const uint8_t *src; unsigned type, size; uint8_t *dst; @@ -434,6 +431,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, return AVERROR_PATCHWELCOME; } +if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) +return ret; + +frame->key_frame = 1; +frame->pict_type = AV_PICTURE_TYPE_I; + src = s->buffer; dst = frame->data[0] + (avctx->height - 1) * frame->linesize[0]; for (y = 0; y < avctx->height; y++) { @@ -512,6 +515,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, dst = &rect[block_h * s->stride]; } +if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) +return ret; + +frame->key_frame = 0; +frame->pict_type = AV_PICTURE_TYPE_P; + ssrc = s->buffer; ddst = frame->data[0] + (avctx->height - 1) * frame->linesize[0]; for (y = 0; y < avctx->height; y++) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/speedhq: Check width
ffmpeg | branch: release/4.2 | Michael Niedermayer | Thu Aug 18 23:41:57 2022 +0200| [5e6469b241e57d15af41d505bd4b0eb05cbee207] | committer: Michael Niedermayer avcodec/speedhq: Check width Fixes: out of array access Fixes: 50014/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEDHQ_fuzzer-4748914632294400 Alternatively the buffer size can be increased Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit f0395f9ef6051315973f1fdded1804f81458566d) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5e6469b241e57d15af41d505bd4b0eb05cbee207 --- libavcodec/speedhq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/speedhq.c b/libavcodec/speedhq.c index 948b813f7f..a3b0bc4649 100644 --- a/libavcodec/speedhq.c +++ b/libavcodec/speedhq.c @@ -424,7 +424,7 @@ static int speedhq_decode_frame(AVCodecContext *avctx, uint32_t second_field_offset; int ret; -if (buf_size < 4 || avctx->width < 8) +if (buf_size < 4 || avctx->width < 8 || avctx->width % 8 != 0) return AVERROR_INVALIDDATA; quality = buf[0]; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] libavformat/hls: Free keys
ffmpeg | branch: release/4.2 | Michael Niedermayer | Fri Sep 9 00:32:23 2022 +0200| [3b184fab451647a68cee42da3453658faf73f246] | committer: Michael Niedermayer libavformat/hls: Free keys Fixes: memleak Fixes: 50703/clusterfuzz-testcase-minimized-ffmpeg_dem_HLS_fuzzer-6399058578636800 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Steven Liu Signed-off-by: Michael Niedermayer (cherry picked from commit d32a9f3137c91de86547601a38fea0693c3497f1) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3b184fab451647a68cee42da3453658faf73f246 --- libavformat/hls.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/hls.c b/libavformat/hls.c index 994f7222cd..b38ad77695 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -231,6 +231,7 @@ static void free_init_section_list(struct playlist *pls) { int i; for (i = 0; i < pls->n_init_sections; i++) { +av_freep(&pls->init_sections[i]->key); av_freep(&pls->init_sections[i]->url); av_freep(&pls->init_sections[i]); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_showinfo: remove backspaces
ffmpeg | branch: release/4.2 | Michael Niedermayer | Thu Jul 21 20:15:06 2022 +0200| [f7c84aa4db9891466072735cf62b763f6be3054b] | committer: Michael Niedermayer avfilter/vf_showinfo: remove backspaces They mess with storing editing and comparing the results Signed-off-by: Michael Niedermayer (cherry picked from commit 31581ae7ee6d007f2f2dcd16de5df991ba7aa1b6) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f7c84aa4db9891466072735cf62b763f6be3054b --- libavfilter/vf_showinfo.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c index f6f8f49778..37a2de3ad7 100644 --- a/libavfilter/vf_showinfo.c +++ b/libavfilter/vf_showinfo.c @@ -226,12 +226,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) av_log(ctx, AV_LOG_INFO, " %08"PRIX32, plane_checksum[plane]); av_log(ctx, AV_LOG_INFO, "] mean:["); for (plane = 0; plane < 4 && frame->data[plane] && frame->linesize[plane]; plane++) -av_log(ctx, AV_LOG_INFO, "%"PRId64" ", (sum[plane] + pixelcount[plane]/2) / pixelcount[plane]); -av_log(ctx, AV_LOG_INFO, "\b] stdev:["); +av_log(ctx, AV_LOG_INFO, "%s%"PRId64, + plane ? " ":"", + (sum[plane] + pixelcount[plane]/2) / pixelcount[plane]); +av_log(ctx, AV_LOG_INFO, "] stdev:["); for (plane = 0; plane < 4 && frame->data[plane] && frame->linesize[plane]; plane++) -av_log(ctx, AV_LOG_INFO, "%3.1f ", +av_log(ctx, AV_LOG_INFO, "%s%3.1f", + plane ? " ":"", sqrt((sum2[plane] - sum[plane]*(double)sum[plane]/pixelcount[plane])/pixelcount[plane])); -av_log(ctx, AV_LOG_INFO, "\b]"); +av_log(ctx, AV_LOG_INFO, "]"); } av_log(ctx, AV_LOG_INFO, "\n"); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/tiff: Fix loop detection
ffmpeg | branch: release/4.2 | Michael Niedermayer | Mon Sep 12 19:55:09 2022 +0200| [b14de343c7ebed2a3946e9db39fca28a61206680] | committer: Michael Niedermayer avcodec/tiff: Fix loop detection Fixes regression with tickets/4364/L1004220.DNG Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit 43a4854510a3d596e114d899177a5b3b323ca9fb) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b14de343c7ebed2a3946e9db39fca28a61206680 --- libavcodec/tiff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 0a0dd44710..1e7e0d697d 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -1406,7 +1406,7 @@ static int decode_frame(AVCodecContext *avctx, TiffContext *const s = avctx->priv_data; AVFrame *const p = data; ThreadFrame frame = { .f = data }; -unsigned off, last_off; +unsigned off, last_off = 0; int le, ret, plane, planes; int i, j, entries, stride; unsigned soff, ssize; @@ -1462,7 +1462,6 @@ again: /** whether we should process this multi-page IFD's next page */ retry_for_page = s->get_page && s->cur_page + 1 < s->get_page; // get_page is 1-indexed -last_off = off; if (retry_for_page) { // set offset to the next IFD off = ff_tget_long(&s->gb, le); @@ -1480,6 +1479,7 @@ again: avpriv_request_sample(s->avctx, "non increasing IFD offset\n"); return AVERROR_INVALIDDATA; } +last_off = off; if (off >= UINT_MAX - 14 || avpkt->size < off + 14) { av_log(avctx, AV_LOG_ERROR, "IFD offset is greater than image size\n"); return AVERROR_INVALIDDATA; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/apedec: Fix integer overflow in filter_3800()
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Sep 11 00:30:42 2022 +0200| [f1e46857ccbb44e96de74527aa623c1df8fd0c03] | committer: Michael Niedermayer avcodec/apedec: Fix integer overflow in filter_3800() Fixes: signed integer overflow: -2147448926 + -198321 cannot be represented in type 'int' Fixes: 48798/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5739619273015296 Fixes: 48798/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-6744428485672960 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit f05247f6a4698c14f1cd523daa90188f50dcf6ad) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f1e46857ccbb44e96de74527aa623c1df8fd0c03 --- libavcodec/apedec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index 035fa9a434..5a769a3ea9 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -880,7 +880,7 @@ static av_always_inline int filter_3800(APEPredictor *p, p->coeffsB[filter][0] += (((d3 >> 29) & 4) - 2) * sign; p->coeffsB[filter][1] -= (((d4 >> 30) & 2) - 1) * sign; -p->filterB[filter] = p->lastA[filter] + (predictionB >> shift); +p->filterB[filter] = p->lastA[filter] + (unsigned)(predictionB >> shift); p->filterA[filter] = p->filterB[filter] + (unsigned)((int)(p->filterA[filter] * 31U) >> 5); return p->filterA[filter]; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mxfdec: Check run_in is within 65536
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Sep 18 14:28:03 2022 +0200| [c75a0b98f88a6613b85d91291b77ac4a268b4856] | committer: Michael Niedermayer avformat/mxfdec: Check run_in is within 65536 Fixes: signed integer overflow: 9223372036854775807 - -2146905566 cannot be represented in type 'long' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-6570996594769920 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 7786097825d9e3f02b4574c1924c28818eb83340) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c75a0b98f88a6613b85d91291b77ac4a268b4856 --- libavformat/mxfdec.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 7e6cbdbe39..d8f9fc91ba 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -58,6 +58,7 @@ #include "mxf.h" #define MXF_MAX_CHUNK_SIZE (32 << 20) +#define RUN_IN_MAX (65535+1) // S377m-2004 section 5.5 and S377-1-2009 section 6.5, the +1 is to be slightly more tolerant typedef enum { Header, @@ -3174,6 +3175,7 @@ static int mxf_read_header(AVFormatContext *s) KLVPacket klv; int64_t essence_offset = 0; int ret; +int64_t run_in; mxf->last_forward_tell = INT64_MAX; @@ -3183,7 +3185,10 @@ static int mxf_read_header(AVFormatContext *s) } avio_seek(s->pb, -14, SEEK_CUR); mxf->fc = s; -mxf->run_in = avio_tell(s->pb); +run_in = avio_tell(s->pb); +if (run_in < 0 || run_in > RUN_IN_MAX) +return AVERROR_INVALIDDATA; +mxf->run_in = run_in; mxf_read_random_index_pack(s); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mxfdec: only probe max run in
ffmpeg | branch: release/4.2 | Michael Niedermayer | Wed Sep 21 18:23:30 2022 +0200| [b6b9c173e0594d89e30a7d5e912d7291ee2bc1b6] | committer: Michael Niedermayer avformat/mxfdec: only probe max run in Suggested-by: Tomas Härdin Signed-off-by: Michael Niedermayer (cherry picked from commit 1182bbb2c3226260ed672920251e3410bde8c6c9) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b6b9c173e0594d89e30a7d5e912d7291ee2bc1b6 --- libavformat/mxfdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index d8f9fc91ba..4152d035e0 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -3617,7 +3617,7 @@ static int mxf_read_close(AVFormatContext *s) static int mxf_probe(const AVProbeData *p) { const uint8_t *bufp = p->buf; -const uint8_t *end = p->buf + p->buf_size; +const uint8_t *end = p->buf + FFMIN(p->buf_size, RUN_IN_MAX + 1 + sizeof(mxf_header_partition_pack_key)); if (p->buf_size < sizeof(mxf_header_partition_pack_key)) return 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/tta: Check 24bit scaling for overflow
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Sep 11 00:11:20 2022 +0200| [9645062686b338eb5510eb917ab4f2b2e1430395] | committer: Michael Niedermayer avcodec/tta: Check 24bit scaling for overflow Fixes: signed integer overflow: -8427924 * 256 cannot be represented in type 'int' Fixes: 48798/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TTA_fuzzer-5409428670644224 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 3993345f915bccceee315f44d412445346990e14) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9645062686b338eb5510eb917ab4f2b2e1430395 --- libavcodec/tta.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libavcodec/tta.c b/libavcodec/tta.c index 304f3a81df..b1ed8785c1 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -371,8 +371,15 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data, case 3: { // shift samples for 24-bit sample format int32_t *samples = (int32_t *)frame->data[0]; -for (i = 0; i < framelen * s->channels; i++) -*samples++ *= 256; +int overflow = 0; + +for (i = 0; i < framelen * s->channels; i++) { +int scaled = *samples * 256U; +overflow += (scaled >> 8 != *samples); +*samples++ = scaled; +} +if (overflow) +av_log(avctx, AV_LOG_WARNING, "%d overflows occurred on 24bit upscale\n", overflow); // reset decode buffer s->decode_buffer = NULL; break; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/aiffdec: Check block_duration
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sat Sep 17 16:32:08 2022 +0200| [f1299281643283fbf0fff01fd025d00f4fb2765b] | committer: Michael Niedermayer avformat/aiffdec: Check block_duration Fixes: signed integer overflow: 3 * -2147483648 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-6668935979728896 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit 1c2b6265c87417033f990fa4a14da9d4008320a4) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f1299281643283fbf0fff01fd025d00f4fb2765b --- libavformat/aiffdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 22dc3597ee..83d09527ad 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -366,6 +366,8 @@ got_sound: av_log(s, AV_LOG_ERROR, "could not find COMM tag or invalid block_align value\n"); return -1; } +if (aiff->block_duration < 0) +return AVERROR_INVALIDDATA; /* Now positioned, get the sound data start and end */ avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/aiffdec: Use 64bit for block_duration use
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sat Sep 17 16:32:09 2022 +0200| [9053465771127ad5893c905429de8844bad66ba6] | committer: Michael Niedermayer avformat/aiffdec: Use 64bit for block_duration use Fixes: signed integer overflow: 3 * -2147483648 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-6668935979728896 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit 9303ba272e988d87084880c57056b750cc5ffd08) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9053465771127ad5893c905429de8844bad66ba6 --- libavformat/aiffdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 83d09527ad..4de612ffc5 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -422,7 +422,7 @@ static int aiff_read_packet(AVFormatContext *s, pkt->flags &= ~AV_PKT_FLAG_CORRUPT; /* Only one stream in an AIFF file */ pkt->stream_index = 0; -pkt->duration = (res / st->codecpar->block_align) * aiff->block_duration; +pkt->duration = (res / st->codecpar->block_align) * (int64_t) aiff->block_duration; return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/icodec: Check nb_pal
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sat Sep 17 23:15:56 2022 +0200| [297ef9edd93fd91f6303d822a9ff18077e4627bb] | committer: Michael Niedermayer avformat/icodec: Check nb_pal Fixes: signed integer overflow: 538976288 * 4 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_ICO_fuzzer-6690068904935424 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross Signed-off-by: Michael Niedermayer (cherry picked from commit db73ae0dc114aa6fae08e69f977944f056a24995) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=297ef9edd93fd91f6303d822a9ff18077e4627bb --- libavformat/icodec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/icodec.c b/libavformat/icodec.c index d2affbf35f..f513336c93 100644 --- a/libavformat/icodec.c +++ b/libavformat/icodec.c @@ -204,6 +204,9 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) AV_WL32(buf + 32, image->nb_pal); } +if (image->nb_pal > INT_MAX / 4 - 14 - 40) +return AVERROR_INVALIDDATA; + AV_WL32(buf - 4, 14 + 40 + image->nb_pal * 4); AV_WL32(buf + 8, AV_RL32(buf + 8) / 2); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/ape: Check frames size
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sat Sep 17 21:19:53 2022 +0200| [4235afc12c303219c458be1016a36c84d3cc3354] | committer: Michael Niedermayer avformat/ape: Check frames size Fixes: signed integer overflow: 9223372036854775806 + 3 cannot be represented in type 'long' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_APE_fuzzer-6389264140599296 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit d0349c9929e2891c90011a83152624d5cf18e628) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4235afc12c303219c458be1016a36c84d3cc3354 --- libavformat/ape.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/ape.c b/libavformat/ape.c index dcca9b20fb..b7e4368c0a 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -323,6 +323,8 @@ static int ape_read_header(AVFormatContext * s) ape->frames[i].pos -= ape->frames[i].skip; ape->frames[i].size += ape->frames[i].skip; } +if (ape->frames[i].size > INT_MAX - 3) +return AVERROR_INVALIDDATA; ape->frames[i].size = (ape->frames[i].size + 3) & ~3; } if (ape->fileversion < 3810) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/asfdec_o: Limit packet offset
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sat Sep 17 21:30:55 2022 +0200| [0c56afb8d6c28d98ed9d4d373d6461c0921ac382] | committer: Michael Niedermayer avformat/asfdec_o: Limit packet offset avoids overflows with it Fixes: signed integer overflow: 9223372036846866010 + 4294967047 cannot be represented in type 'long' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_O_fuzzer-6538296768987136 Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_O_fuzzer-657169555665715 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 736e9e69d5dbbe1d81885dfef59917eb915d2f96) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0c56afb8d6c28d98ed9d4d373d6461c0921ac382 --- libavformat/asfdec_o.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c index baede5ba20..71e65f4763 100644 --- a/libavformat/asfdec_o.c +++ b/libavformat/asfdec_o.c @@ -1361,6 +1361,8 @@ static int asf_read_packet_header(AVFormatContext *s) unsigned char error_flags, len_flags, pay_flags; asf->packet_offset = avio_tell(pb); +if (asf->packet_offset > INT64_MAX/2) +asf->packet_offset = 0; error_flags = avio_r8(pb); // read Error Correction Flags if (error_flags & ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT) { if (!(error_flags & ASF_ERROR_CORRECTION_LENGTH_TYPE)) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/cafdec: Check that nb_frasmes fits within 64bit
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sat Sep 17 21:48:43 2022 +0200| [bf1893f342b02e7920f6760516f4fa86ddce2a15] | committer: Michael Niedermayer avformat/cafdec: Check that nb_frasmes fits within 64bit Fixes: signed integer overflow: 1099511693312 * 538976288 cannot be represented in type 'long' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-6565048815845376 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit d4bb4e375975dc0d31d5309106cf6ee0ed75140f) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bf1893f342b02e7920f6760516f4fa86ddce2a15 --- libavformat/cafdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index f0fd326fb6..b1db03a893 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -344,7 +344,7 @@ static int read_header(AVFormatContext *s) found_data: if (caf->bytes_per_packet > 0 && caf->frames_per_packet > 0) { -if (caf->data_size > 0) +if (caf->data_size > 0 && caf->data_size / caf->bytes_per_packet < INT64_MAX / caf->frames_per_packet) st->nb_frames = (caf->data_size / caf->bytes_per_packet) * caf->frames_per_packet; } else if (st->nb_index_entries && st->duration > 0) { if (st->codecpar->sample_rate && caf->data_size / st->duration > INT64_MAX / st->codecpar->sample_rate / 8) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/dxa: avoid bpc overflows
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sat Sep 17 22:40:47 2022 +0200| [cc57578a35c9cfa838bbf0e154c391ab116d9a62] | committer: Michael Niedermayer avformat/dxa: avoid bpc overflows Fixes: signed integer overflow: 2147483647 + 32 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_DXA_fuzzer-6639823726706688 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 93db0f0740cacd64ae07b5e8606b70021e48d364) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cc57578a35c9cfa838bbf0e154c391ab116d9a62 --- libavformat/dxa.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/dxa.c b/libavformat/dxa.c index 78f5f6500d..03b9dbc43b 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -118,9 +118,12 @@ static int dxa_read_header(AVFormatContext *s) if(tag == MKTAG('d', 'a', 't', 'a')) break; avio_skip(pb, fsize); } -c->bpc = (fsize + c->frames - 1) / c->frames; -if(ast->codecpar->block_align) +c->bpc = (fsize + (int64_t)c->frames - 1) / c->frames; +if(ast->codecpar->block_align) { +if (c->bpc > INT_MAX - ast->codecpar->block_align + 1) +return AVERROR_INVALIDDATA; c->bpc = ((c->bpc + ast->codecpar->block_align - 1) / ast->codecpar->block_align) * ast->codecpar->block_align; +} c->bytes_left = fsize; c->wavpos = avio_tell(pb); avio_seek(pb, c->vidpos, SEEK_SET); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/flvdec: Use 64bit for sum_flv_tag_size
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Sep 18 13:38:21 2022 +0200| [a3169bd84330b2afc5379feb5e0188b39628f7fd] | committer: Michael Niedermayer avformat/flvdec: Use 64bit for sum_flv_tag_size Fixes: signed integer overflow: 2138820085 + 16130322 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_LIVE_FLV_fuzzer-6704728165187584 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 7124f10c1d521096042ba3c9c519828147f78c46) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a3169bd84330b2afc5379feb5e0188b39628f7fd --- libavformat/flvdec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index a4b582cf60..37f565b1ae 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -65,7 +65,7 @@ typedef struct FLVContext { uint8_t resync_buffer[2*RESYNC_BUFFER_SIZE]; int broken_sizes; -int sum_flv_tag_size; +int64_t sum_flv_tag_size; int last_keyframe_stream_index; int keyframe_count; @@ -1036,7 +1036,7 @@ retry: type = (avio_r8(s->pb) & 0x1F); orig_size = size = avio_rb24(s->pb); -flv->sum_flv_tag_size += size + 11; +flv->sum_flv_tag_size += size + 11LL; dts = avio_rb24(s->pb); dts |= (unsigned)avio_r8(s->pb) << 24; av_log(s, AV_LOG_TRACE, "type:%d, size:%d, last:%d, dts:%"PRId64" pos:%"PRId64"\n", type, size, last, dts, avio_tell(s->pb)); @@ -1358,7 +1358,7 @@ leave: !avio_feof(s->pb) && (last != orig_size || !last) && last != flv->sum_flv_tag_size && !flv->broken_sizes) { -av_log(s, AV_LOG_ERROR, "Packet mismatch %d %d %d\n", last, orig_size + 11, flv->sum_flv_tag_size); +av_log(s, AV_LOG_ERROR, "Packet mismatch %d %d %"PRId64"\n", last, orig_size + 11, flv->sum_flv_tag_size); avio_seek(s->pb, pos + 1, SEEK_SET); ret = resync(s); av_packet_unref(pkt); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/nutdec: Check fields
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Sep 18 14:47:25 2022 +0200| [8ab83a7714f90b24670fd43652274f3e0a09a96f] | committer: Michael Niedermayer avformat/nutdec: Check fields Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_NUT_fuzzer-6566001610719232 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 2c146406eac06f3d3cd3d981c29e7affd834cb4d) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8ab83a7714f90b24670fd43652274f3e0a09a96f --- libavformat/nutdec.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 855214a451..3ac9cb6b53 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -244,6 +244,11 @@ static int decode_main_header(NUTContext *nut) for (i = 0; i < 256;) { int tmp_flags = ffio_read_varlen(bc); int tmp_fields = ffio_read_varlen(bc); +if (tmp_fields < 0) { +av_log(s, AV_LOG_ERROR, "fields %d is invalid\n", tmp_fields); +ret = AVERROR_INVALIDDATA; +goto fail; +} if (tmp_fields > 0) tmp_pts = get_s(bc); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/xwma: Use av_rescale() for duration computation
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Sep 18 16:45:30 2022 +0200| [caa009a3fb518ab36cd780798230cd32d33f89b0] | committer: Michael Niedermayer avformat/xwma: Use av_rescale() for duration computation Fixes: signed integer overflow: 34242363648 * 538976288 cannot be represented in type 'long' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6577923913547776 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 2c789f753c3657be9041307f9c03749f5ba5a6bb) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=caa009a3fb518ab36cd780798230cd32d33f89b0 --- libavformat/xwma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/xwma.c b/libavformat/xwma.c index 29f4c2be18..e37c16b6df 100644 --- a/libavformat/xwma.c +++ b/libavformat/xwma.c @@ -278,7 +278,7 @@ static int xwma_read_header(AVFormatContext *s) * the total duration using the average bits per sample and the * total data length. */ -st->duration = (size<<3) * st->codecpar->sample_rate / st->codecpar->bit_rate; +st->duration = av_rescale((size<<3), st->codecpar->sample_rate, st->codecpar->bit_rate); } fail: ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/rmdec: check tag_size
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Sep 18 15:06:25 2022 +0200| [0a5e3c39eb14003b831d2796a816fed97de3f029] | committer: Michael Niedermayer avformat/rmdec: check tag_size Fixes: signed integer overflow: -2147483648 - 8 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_RM_fuzzer-6598073725353984 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 2cb7ee8a36bddd3425897135db514ca62fec6e44) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0a5e3c39eb14003b831d2796a816fed97de3f029 --- libavformat/rmdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 098e299e6c..34a5923ce9 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -564,6 +564,8 @@ static int rm_read_header(AVFormatContext *s) } tag_size = avio_rb32(pb); +if (tag_size < 0) +return AVERROR_INVALIDDATA; avio_skip(pb, tag_size - 8); for(;;) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/rpl: Use 64bit for duration computation
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Sep 18 16:49:26 2022 +0200| [619612ac014e6ee2c3dc708760ba056ac563db56] | committer: Michael Niedermayer avformat/rpl: Use 64bit for duration computation Fixes: signed integer overflow: 24709512 * 88 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6737973728641024 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 529f64b2eb98e0c3ae4944abd5d01fa7c1def047) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=619612ac014e6ee2c3dc708760ba056ac563db56 --- libavformat/rpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rpl.c b/libavformat/rpl.c index 61009b55c0..d959393678 100644 --- a/libavformat/rpl.c +++ b/libavformat/rpl.c @@ -276,7 +276,7 @@ static int rpl_read_header(AVFormatContext *s) error |= read_line(pb, line, sizeof(line)); // size of "helpful" sprite if (vst) { error |= read_line(pb, line, sizeof(line)); // offset to key frame list -vst->duration = number_of_chunks * rpl->frames_per_chunk; +vst->duration = number_of_chunks * (int64_t)rpl->frames_per_chunk; } // Read the index ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/sdsdec: Use av_rescale() to avoid intermediate overflow in duration calculation
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Sep 18 16:42:21 2022 +0200| [3f283529f78b974962a867842df8d884b32d9c9e] | committer: Michael Niedermayer avformat/sdsdec: Use av_rescale() to avoid intermediate overflow in duration calculation Fixes: signed integer overflow: 72128794995445727 * 240 cannot be represented in type 'long' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_SDS_fuzzer-6628185583779840 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit aa8eb1bed075931b0ce0a8bc9a8ff5882830044c) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3f283529f78b974962a867842df8d884b32d9c9e --- libavformat/sdsdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/sdsdec.c b/libavformat/sdsdec.c index 9c361cdff2..2f4056c8b3 100644 --- a/libavformat/sdsdec.c +++ b/libavformat/sdsdec.c @@ -112,7 +112,7 @@ static int sds_read_header(AVFormatContext *ctx) st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->channels = 1; st->codecpar->sample_rate = sample_period ? 10 / sample_period : 16000; -st->duration = (avio_size(pb) - 21) / (127) * s->size / 4; +st->duration = av_rescale((avio_size(pb) - 21) / 127, s->size, 4); avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/spdifdec: Use 64bit to compute bit rate
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Sep 18 18:12:11 2022 +0200| [674f7c87c90da33b49ac6cd594cdefc453d65ce1] | committer: Michael Niedermayer avformat/spdifdec: Use 64bit to compute bit rate Fixes: signed integer overflow: 32 * 553590816 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-6564974517944320 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 4075f0cec1830a7ac081b1a23bd3f5c4e266fe26) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=674f7c87c90da33b49ac6cd594cdefc453d65ce1 --- libavformat/spdifdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c index d74f58d82b..8c1a7c87e6 100644 --- a/libavformat/spdifdec.c +++ b/libavformat/spdifdec.c @@ -229,7 +229,7 @@ int ff_spdif_read_packet(AVFormatContext *s, AVPacket *pkt) if (!s->bit_rate && s->streams[0]->codecpar->sample_rate) /* stream bitrate matches 16-bit stereo PCM bitrate for currently supported codecs */ -s->bit_rate = 2 * 16 * s->streams[0]->codecpar->sample_rate; +s->bit_rate = 2 * 16LL * s->streams[0]->codecpar->sample_rate; return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/dstdec: Check for overflow in build_filter()
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sat Sep 10 23:49:28 2022 +0200| [23d078dbd1144688fb4982fd32a3c9076ccd83cc] | committer: Michael Niedermayer avcodec/dstdec: Check for overflow in build_filter() Fixes: signed integer overflow: 1917019860 + 265558963 cannot be represented in type 'int' Fixes: 48798/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-4833165046317056 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 8008940da5aa43895fd4574114309c3324249eab) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=23d078dbd1144688fb4982fd32a3c9076ccd83cc --- libavcodec/dstdec.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libavcodec/dstdec.c b/libavcodec/dstdec.c index ebba6cc2c9..a94133e410 100644 --- a/libavcodec/dstdec.c +++ b/libavcodec/dstdec.c @@ -214,7 +214,7 @@ static uint8_t prob_dst_x_bit(int c) return (ff_reverse[c & 127] >> 1) + 1; } -static void build_filter(int16_t table[DST_MAX_ELEMENTS][16][256], const Table *fsets) +static int build_filter(int16_t table[DST_MAX_ELEMENTS][16][256], const Table *fsets) { int i, j, k, l; @@ -225,14 +225,17 @@ static void build_filter(int16_t table[DST_MAX_ELEMENTS][16][256], const Table * int total = av_clip(length - j * 8, 0, 8); for (k = 0; k < 256; k++) { -int v = 0; +int64_t v = 0; for (l = 0; l < total; l++) v += (((k >> l) & 1) * 2 - 1) * fsets->coeff[i][j * 8 + l]; +if ((int16_t)v != v) +return AVERROR_INVALIDDATA; table[i][j][k] = v; } } } +return 0; } static int decode_frame(AVCodecContext *avctx, void *data, @@ -328,7 +331,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; ac_init(ac, gb); -build_filter(s->filter, &s->fsets); +ret = build_filter(s->filter, &s->fsets); +if (ret < 0) +return ret; memset(s->status, 0xAA, sizeof(s->status)); memset(dsd, 0, frame->nb_samples * 4 * avctx->channels); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/vividas: Check packet size
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Sep 18 19:14:07 2022 +0200| [6447e6bb092aa5eac9ad0678ba1a81d371f1b978] | committer: Michael Niedermayer avformat/vividas: Check packet size Fixes: signed integer overflow: 119760682 - -2084600173 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-6745781167587328 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 5f44489cc5d4f3767f6ad2ad067ee6a3f78374bb) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6447e6bb092aa5eac9ad0678ba1a81d371f1b978 --- libavformat/vividas.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/libavformat/vividas.c b/libavformat/vividas.c index f530034736..c2141587d4 100644 --- a/libavformat/vividas.c +++ b/libavformat/vividas.c @@ -684,6 +684,7 @@ static int viv_read_packet(AVFormatContext *s, if (viv->sb_entries[viv->current_sb_entry].flag == 0) { uint64_t v_size = ffio_read_varlen(pb); +int last = 0, last_start; if (!viv->num_audio) return AVERROR_INVALIDDATA; @@ -707,12 +708,18 @@ static int viv_read_packet(AVFormatContext *s, if (i > 0 && start == 0) break; +if (start < last) +return AVERROR_INVALIDDATA; viv->n_audio_subpackets = i + 1; +last = viv->audio_subpackets[i].start = start; viv->audio_subpackets[i].pcm_bytes = pcm_bytes; } +last_start = viv->audio_subpackets[viv->n_audio_subpackets].start = (int)(off - avio_tell(pb)); +if (last_start < last) +return AVERROR_INVALIDDATA; viv->current_audio_subpacket = 0; } else { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] Update for 4.2.8
ffmpeg | branch: release/4.2 | Michael Niedermayer | Sun Oct 9 22:09:57 2022 +0200| [4fb9e37c9fd6308f0d60d0cf616ebd8a847f30b8] | committer: Michael Niedermayer Update for 4.2.8 Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4fb9e37c9fd6308f0d60d0cf616ebd8a847f30b8 --- Changelog| 69 RELEASE | 2 +- doc/Doxyfile | 2 +- 3 files changed, 71 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index ae04cd4cab..c5c8f31bf3 100644 --- a/Changelog +++ b/Changelog @@ -1,6 +1,75 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest. +version 4.2.8 + avformat/vividas: Check packet size + avcodec/dstdec: Check for overflow in build_filter() + avformat/spdifdec: Use 64bit to compute bit rate + avformat/rpl: Use 64bit for duration computation + avformat/xwma: Use av_rescale() for duration computation + avformat/sdsdec: Use av_rescale() to avoid intermediate overflow in duration calculation + avformat/rmdec: check tag_size + avformat/nutdec: Check fields + avformat/flvdec: Use 64bit for sum_flv_tag_size + avformat/dxa: avoid bpc overflows + avformat/cafdec: Check that nb_frasmes fits within 64bit + avformat/asfdec_o: Limit packet offset + avformat/ape: Check frames size + avformat/icodec: Check nb_pal + avformat/aiffdec: Use 64bit for block_duration use + avformat/aiffdec: Check block_duration + avformat/mxfdec: only probe max run in + avformat/mxfdec: Check run_in is within 65536 + avcodec/apedec: Fix integer overflow in filter_3800() + avcodec/tta: Check 24bit scaling for overflow + avcodec/tiff: Fix loop detection + libavformat/hls: Free keys + avcodec/fmvc: Move frame allocation to a later stage + avfilter/vf_showinfo: remove backspaces + avcodec/speedhq: Check width + avcodec/bink: disallow odd positioned scaled blocks + avformat/asfdec_o: limit recursion depth in asf_read_unknown() + doc/git-howto.texi: Document commit signing + libavcodec/8bps: Check that line lengths fit within the buffer + libavformat/iff: Check for overflow in body_end calculation + avformat/avidec: Prevent entity expansion attacks + avcodec/h263dec: Sanity check against minimal I/P frame size + avcodec/hevcdec: Check s->ref in the md5 path similar to hwaccel + MAINTAINERS: Add ED25519 key for signing my commits in the future + avcodec/hevc_filter: copy_CTB() only within width&height + avformat/flvdec: Check for EOF in index reading + avformat/nutdec: Check get_packetheader() in mainheader + avformat/asfdec_f: Use 64bit for packet start time + avcodec/lagarith: Check dst/src in zero run code + avcodec/h264dec: Skip late SEI + avcodec/sbrdsp_fixed: Fix integer overflows in sbr_qmf_deint_neg_c() + avfilter/vf_signature: Fix integer overflow in filter_frame() + avformat/rtsp: break on unknown protocols + avcodec/hevcdsp_template: stay within tables in sao_band_filter() + avcodec/qpeldsp: copy less for the mc0x cases + avcodec/ffv1dec: Limit golomb rice coded slices to width 8M + avformat/iff: simplify duration calculation + avcodec/wnv1: Check for width =1 + avcodec/ffv1dec_template: fix indention + avformat/sctp: close socket on errors + avcodec/aasc: Fix indention + avcodec/qdrw: adjust max colors to array size + avcodec/alacdsp: Make intermediates unsigned + avformat/aiffdec: cleanup size handling for extreem cases + avcodec/jpeglsdec: fix end check for xfrm + avcodec/cdgraphics: limit scrolling to the line + avformat/aiffdec: avoid integer overflow in get_meta() + avformat/ape: more bits in size for less overflows + avformat/bfi: Check offsets better + avformat/asfdec_f: Check packet_frag_timestamp + avcodec/texturedspenc: Fix indexing in color distribution determination + avformat/act: Check ff_get_wav_header() for failure + avfilter/vsrc_mandelbrot: Check for malloc failure + avfilter/vf_frei0r: Copy to frame allocated according to frei0r requirements + avfilter/video: Add ff_default_get_video_buffer2() to set specific alignment + avformat/genh: Check sample rate + configure: extend SDL check to accept all 2.x versions + version 4.2.7 avfilter/vf_colorspace: fix memmory leaks avformat/nutenc: don't allocate a dynamic AVIOContext if no index is going to be written diff --git a/RELEASE b/RELEASE index 4739c61f1e..ad9e446d8c 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -4.2.7 +4.2.8 diff --git a/doc/Doxyfile b/doc/Doxyfile index eb9634cb62..16cdd1faca 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 4.2.7 +PROJECT_NUMBER = 4.2.8 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a __
[FFmpeg-cvslog] lavc/x86/simple_idct: Fix linking shared libavcodec with MS link.exe
ffmpeg | branch: master | Carl Eugen Hoyos | Sun Sep 11 16:02:09 2022 +0200| [60e87faf7f32a84a0aecf9a2969c7ce89b5e5f29] | committer: Carl Eugen Hoyos lavc/x86/simple_idct: Fix linking shared libavcodec with MS link.exe link.exe hangs on empty simple_idct.o Fixes ticket #9909. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=60e87faf7f32a84a0aecf9a2969c7ce89b5e5f29 --- libavcodec/x86/simple_idct.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/x86/simple_idct.asm b/libavcodec/x86/simple_idct.asm index dcf0da6df1..982b2f0bbb 100644 --- a/libavcodec/x86/simple_idct.asm +++ b/libavcodec/x86/simple_idct.asm @@ -25,9 +25,9 @@ %include "libavutil/x86/x86util.asm" -%if ARCH_X86_32 SECTION_RODATA +%if ARCH_X86_32 cextern pb_80 wm1010: dw 0, 0x, 0, 0x ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/rotate: Avoid undefined behaviour.
ffmpeg | branch: master | Carl Eugen Hoyos | Sat Sep 3 22:50:19 2022 +0200| [82479ef6bd107312aa086bab12c29ba4551d544a] | committer: Carl Eugen Hoyos lavfi/rotate: Avoid undefined behaviour. Fixes the following integer overflows: libavfilter/vf_rotate.c:273:13: runtime error: signed integer overflow: 92951468 + 2058533568 cannot be represented in type 'int' libavfilter/vf_rotate.c:273:37: runtime error: signed integer overflow: 39684 * 54149 cannot be represented in type 'int' libavfilter/vf_rotate.c:272:13: runtime error: signed integer overflow: 247587320 + 1900985032 cannot be represented in type 'int' libavfilter/vf_rotate.c:272:37: runtime error: signed integer overflow: 42584 * 50430 cannot be represented in type 'int' libavfilter/vf_rotate.c:272:50: runtime error: signed integer overflow: 65083 * 52912 cannot be represented in type 'int' libavfilter/vf_rotate.c:273:50: runtime error: signed integer overflow: 65286 * 38044 cannot be represented in type 'int' Fixes ticket #9799, different output with different compilers. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=82479ef6bd107312aa086bab12c29ba4551d544a --- libavfilter/vf_rotate.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavfilter/vf_rotate.c b/libavfilter/vf_rotate.c index 4429e3d543..96c250a459 100644 --- a/libavfilter/vf_rotate.c +++ b/libavfilter/vf_rotate.c @@ -258,8 +258,8 @@ static uint8_t *interpolate_bilinear16(uint8_t *dst_color, { int int_x = av_clip(x>>16, 0, max_x); int int_y = av_clip(y>>16, 0, max_y); -int frac_x = x&0x; -int frac_y = y&0x; +int64_t frac_x = x&0x; +int64_t frac_y = y&0x; int i; int int_x1 = FFMIN(int_x+1, max_x); int int_y1 = FFMIN(int_y+1, max_y); @@ -269,10 +269,10 @@ static uint8_t *interpolate_bilinear16(uint8_t *dst_color, int s01 = AV_RL16(&src[src_linestep * int_x1 + i + src_linesize * int_y ]); int s10 = AV_RL16(&src[src_linestep * int_x + i + src_linesize * int_y1]); int s11 = AV_RL16(&src[src_linestep * int_x1 + i + src_linesize * int_y1]); -int s0 = (((1<<16) - frac_x)*s00 + frac_x*s01); -int s1 = (((1<<16) - frac_x)*s10 + frac_x*s11); +int64_t s0 = (((1<<16) - frac_x)*s00 + frac_x*s01); +int64_t s1 = (((1<<16) - frac_x)*s10 + frac_x*s11); -AV_WL16(&dst_color[i], ((int64_t)((1<<16) - frac_y)*s0 + (int64_t)frac_y*s1) >> 32); +AV_WL16(&dst_color[i], (((1<<16) - frac_y)*s0 + frac_y*s1) >> 32); } return dst_color; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/opusdsp: RISC-V V (128-bit) postfilter
ffmpeg | branch: master | Rémi Denis-Courmont | Wed Oct 5 19:12:53 2022 +0300| [8009581912d0e5d6ecfa650cd0ce90c58c515b69] | committer: Lynne lavc/opusdsp: RISC-V V (128-bit) postfilter This is implemented for a vector size of 128-bit. Since the scalar product in the inner loop covers 5 samples or 160 bits, we need a group multipler of 2. To avoid reconfiguring the vector type, the outer loop, which loads multiple input samples sticks to the same multipler. Consequently, the outer loop loads 8 samples per iteration. This is safe since the minimum period of the CELT codec is 15 samples. The same code would also work, albeit needlessly inefficiently with a vector length of 256 bits. A proper implementation will follow instead. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8009581912d0e5d6ecfa650cd0ce90c58c515b69 --- libavcodec/opusdsp.c| 2 ++ libavcodec/opusdsp.h| 1 + libavcodec/riscv/Makefile | 2 ++ libavcodec/riscv/opusdsp_init.c | 42 ++ libavcodec/riscv/opusdsp_rvv.S | 57 + 5 files changed, 104 insertions(+) diff --git a/libavcodec/opusdsp.c b/libavcodec/opusdsp.c index badcfcc884..0764d712e4 100644 --- a/libavcodec/opusdsp.c +++ b/libavcodec/opusdsp.c @@ -58,6 +58,8 @@ av_cold void ff_opus_dsp_init(OpusDSP *ctx) #if ARCH_AARCH64 ff_opus_dsp_init_aarch64(ctx); +#elif ARCH_RISCV +ff_opus_dsp_init_riscv(ctx); #elif ARCH_X86 ff_opus_dsp_init_x86(ctx); #endif diff --git a/libavcodec/opusdsp.h b/libavcodec/opusdsp.h index 3ea3d14bf0..c2a301e832 100644 --- a/libavcodec/opusdsp.h +++ b/libavcodec/opusdsp.h @@ -30,5 +30,6 @@ void ff_opus_dsp_init(OpusDSP *ctx); void ff_opus_dsp_init_x86(OpusDSP *ctx); void ff_opus_dsp_init_aarch64(OpusDSP *ctx); +void ff_opus_dsp_init_riscv(OpusDSP *ctx); #endif /* AVCODEC_OPUSDSP_H */ diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile index eae87ea231..965942f4df 100644 --- a/libavcodec/riscv/Makefile +++ b/libavcodec/riscv/Makefile @@ -12,6 +12,8 @@ OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_init.o RVV-OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_rvv.o OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_init.o RVV-OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_rvv.o +OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_init.o +RVV-OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_rvv.o OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o \ riscv/pixblockdsp_rvi.o RVV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvv.o diff --git a/libavcodec/riscv/opusdsp_init.c b/libavcodec/riscv/opusdsp_init.c new file mode 100644 index 00..ca58bb4039 --- /dev/null +++ b/libavcodec/riscv/opusdsp_init.c @@ -0,0 +1,42 @@ +/* + * Copyright © 2022 Rémi Denis-Courmont. + * + * 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 + */ + +#include "config.h" + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/riscv/cpu.h" +#include "libavcodec/opusdsp.h" + +void ff_opus_postfilter_rvv_128(float *data, int period, float *g, int len); + +av_cold void ff_opus_dsp_init_riscv(OpusDSP *d) +{ +#if HAVE_RVV +int flags = av_get_cpu_flags(); + +if (flags & AV_CPU_FLAG_RVV_F32) +switch (ff_get_rv_vlenb()) { +case 16: +d->postfilter = ff_opus_postfilter_rvv_128; +break; +} +#endif +} diff --git a/libavcodec/riscv/opusdsp_rvv.S b/libavcodec/riscv/opusdsp_rvv.S new file mode 100644 index 00..79b46696cd --- /dev/null +++ b/libavcodec/riscv/opusdsp_rvv.S @@ -0,0 +1,57 @@ +/* + * Copyright © 2022 Rémi Denis-Courmont. + * + * 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 Pub
[FFmpeg-cvslog] lavu/riscv: helper macro for VTYPE encoding
ffmpeg | branch: master | Rémi Denis-Courmont | Wed Oct 5 19:12:54 2022 +0300| [f59a767ccd56ba1b82ae94e2229f9151936f8b7c] | committer: Lynne lavu/riscv: helper macro for VTYPE encoding On most cases, the vector type (VTYPE) for the RISC-V Vector extension is supplied as an immediate value, with either of the VSETVLI or VSETIVLI instructions. There is however a third instruction VSETVL which takes the vector type from a general purpose register. That is so the type can be selected at run-time. This introduces a macro to load a (valid) vector type into a register. The syntax follows that of VSETVLI and VSETIVLI, with element size, group multiplier, then tail and mask policies. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f59a767ccd56ba1b82ae94e2229f9151936f8b7c --- libavutil/riscv/asm.S | 75 +++ 1 file changed, 75 insertions(+) diff --git a/libavutil/riscv/asm.S b/libavutil/riscv/asm.S index ffa0bd9068..6ca74f263a 100644 --- a/libavutil/riscv/asm.S +++ b/libavutil/riscv/asm.S @@ -92,3 +92,78 @@ shnadd 3, \rd, \rs1, \rs2 .endm #endif + +/* Convenience macro to load a Vector type (vtype) as immediate */ +.macro lvtypei rd, e, m=m1, tp=tu, mp=mu + +.ifc \e,e8 +.equ ei, 0 +.else +.ifc \e,e16 +.equ ei, 8 +.else +.ifc \e,e32 +.equ ei, 16 +.else +.ifc \e,e64 +.equ ei, 24 +.else +.error "Unknown element type" +.endif +.endif +.endif +.endif + +.ifc \m,m1 +.equ mi, 0 +.else +.ifc \m,m2 +.equ mi, 1 +.else +.ifc \m,m4 +.equ mi, 2 +.else +.ifc \m,m8 +.equ mi, 3 +.else +.ifc \m,mf8 +.equ mi, 5 +.else +.ifc \m,mf4 +.equ mi, 6 +.else +.ifc \m,mf2 +.equ mi, 7 +.else +.error "Unknown multiplier" +.equ mi, 3 +.endif +.endif +.endif +.endif +.endif +.endif +.endif + +.ifc \tp,tu +.equ tpi, 0 +.else +.ifc \tp,ta +.equ tpi, 64 +.else +.error "Unknown tail policy" +.endif +.endif + +.ifc \mp,mu +.equ mpi, 0 +.else +.ifc \mp,ma +.equ mpi, 128 +.else +.error "Unknown mask policy" +.endif +.endif + +li \rd, (ei | mi | tpi | mpi) +.endm ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/opusdsp: RISC-V V (256-bit) postfilter
ffmpeg | branch: master | Rémi Denis-Courmont | Wed Oct 5 19:12:55 2022 +0300| [97d34befea598d34e92ed384acb3dced5490ae8a] | committer: Lynne lavc/opusdsp: RISC-V V (256-bit) postfilter This adds a variant of the postfilter for use with 256-bit vectors. As a single vector is then large enough to perform the scalar product, the group multipler is reduced to just one at run-time. The different vector type is passed via register. Unfortunately, there is no VSETIVL instruction, so the constant vector size (5) also needs to be passed via a register. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=97d34befea598d34e92ed384acb3dced5490ae8a --- libavcodec/riscv/opusdsp_init.c | 4 libavcodec/riscv/opusdsp_rvv.S | 16 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/libavcodec/riscv/opusdsp_init.c b/libavcodec/riscv/opusdsp_init.c index ca58bb4039..a5e3e4748a 100644 --- a/libavcodec/riscv/opusdsp_init.c +++ b/libavcodec/riscv/opusdsp_init.c @@ -26,6 +26,7 @@ #include "libavcodec/opusdsp.h" void ff_opus_postfilter_rvv_128(float *data, int period, float *g, int len); +void ff_opus_postfilter_rvv_256(float *data, int period, float *g, int len); av_cold void ff_opus_dsp_init_riscv(OpusDSP *d) { @@ -37,6 +38,9 @@ av_cold void ff_opus_dsp_init_riscv(OpusDSP *d) case 16: d->postfilter = ff_opus_postfilter_rvv_128; break; +case 32: +d->postfilter = ff_opus_postfilter_rvv_256; +break; } #endif } diff --git a/libavcodec/riscv/opusdsp_rvv.S b/libavcodec/riscv/opusdsp_rvv.S index 79b46696cd..243c9a5e52 100644 --- a/libavcodec/riscv/opusdsp_rvv.S +++ b/libavcodec/riscv/opusdsp_rvv.S @@ -21,30 +21,38 @@ #include "libavutil/riscv/asm.S" func ff_opus_postfilter_rvv_128, zve32f +lvtypei a5, e32, m2, ta, ma +j 1f +endfunc + +func ff_opus_postfilter_rvv_256, zve32f +lvtypei a5, e32, m1, ta, ma +1: +li a4, 5 addi a1, a1, 2 slli a1, a1, 2 lw t1, 4(a2) vsetivli zero, 3, e32, m1, ta, ma vle32.v v24, (a2) sub a1, a0, a1 // a1 = &x4 = &data[-(period + 2)] -vsetivli zero, 5, e32, m2, ta, ma +vsetvl zero, a4, a5 vslide1up.vx v8, v24, t1 lw t2, 8(a2) vle32.v v16, (a1) vslide1up.vx v24, v8, t2 // v24 = { g[2], g[1], g[0], g[1], g[2] } 2: -vsetvli t0, a3, e32, m2, ta, ma +vsetvl t0, a3, a5 vle32.v v0, (a0) sub a3, a3, t0 3: -vsetivli zero, 5, e32, m2, ta, ma +vsetvl zero, a4, a5 lw t2, 20(a1) vfmul.vv v8, v24, v16 addi a0, a0, 4 vslide1down.vx v16, v16, t2 addi a1, a1, 4 vfredusum.vs v0, v8, v0 -vsetvlizero, t0, e32, m2, ta, ma +vsetvl zero, t0, a5 vmv.x.st1, v0 addi t0, t0, -1 vslide1down.vx v0, v0, zero ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".