[FFmpeg-cvslog] avfilter/vf_colorchannelmixer: add float formats support

2022-03-03 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed Mar  2 16:59:18 
2022 +0100| [59520f068da89006d527f044a6560235260bcc6c] | committer: Paul B Mahol

avfilter/vf_colorchannelmixer: add float formats support

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=59520f068da89006d527f044a6560235260bcc6c
---

 libavfilter/colorchannelmixer_template.c | 68 +++-
 libavfilter/vf_colorchannelmixer.c   | 33 
 2 files changed, 92 insertions(+), 9 deletions(-)

diff --git a/libavfilter/colorchannelmixer_template.c 
b/libavfilter/colorchannelmixer_template.c
index 0f15f8fd07..bef57476aa 100644
--- a/libavfilter/colorchannelmixer_template.c
+++ b/libavfilter/colorchannelmixer_template.c
@@ -21,10 +21,21 @@
 #include 
 
 #undef pixel
+#undef cpixel
+#undef ROUND
 #if DEPTH == 8
 #define pixel uint8_t
+#define cpixel int
+#define ROUND lrintf
 #elif DEPTH == 16
 #define pixel uint16_t
+#define cpixel int
+#define ROUND lrintf
+#else
+#define NOP(x) (x)
+#define pixel float
+#define cpixel float
+#define ROUND NOP
 #endif
 
 #undef fn
@@ -60,8 +71,22 @@ static av_always_inline int 
fn(filter_slice_rgba_planar)(AVFilterContext *ctx, v
 const pixel gin = srcg[j];
 const pixel bin = srcb[j];
 const pixel ain = have_alpha ? srca[j] : 0;
-int rout, gout, bout;
-
+cpixel rout, gout, bout;
+
+#if DEPTH == 32
+rout = s->rr * rin +
+   s->rg * gin +
+   s->rb * bin +
+   (have_alpha == 1 ? s->ra * ain : 0);
+gout = s->gr * rin +
+   s->gg * gin +
+   s->gb * bin +
+   (have_alpha == 1 ? s->ga * ain : 0);
+bout = s->br * rin +
+   s->bg * gin +
+   s->bb * bin +
+   (have_alpha == 1 ? s->ba * ain : 0);
+#else
 rout = s->lut[R][R][rin] +
s->lut[R][G][gin] +
s->lut[R][B][bin] +
@@ -74,31 +99,52 @@ static av_always_inline int 
fn(filter_slice_rgba_planar)(AVFilterContext *ctx, v
s->lut[B][G][gin] +
s->lut[B][B][bin] +
(have_alpha == 1 ? s->lut[B][A][ain] : 0);
+#endif
 
 if (pc) {
-float frout = av_clipf(rout, 0.f, max);
-float fgout = av_clipf(gout, 0.f, max);
-float fbout = av_clipf(bout, 0.f, max);
-float lin, lout;
+float frout, fgout, fbout, lin, lout;
+
+#if DEPTH < 32
+frout = av_clipf(rout, 0.f, max);
+fgout = av_clipf(gout, 0.f, max);
+fbout = av_clipf(bout, 0.f, max);
+#else
+frout = rout;
+fgout = gout;
+fbout = bout;
+#endif
 
 preserve_color(s->preserve_color, rin, gin, bin,
rout, gout, bout, max, &lin, &lout);
 preservel(&frout, &fgout, &fbout, lin, lout, max);
 
-rout = lrintf(lerpf(rout, frout, pa));
-gout = lrintf(lerpf(gout, fgout, pa));
-bout = lrintf(lerpf(bout, fbout, pa));
+rout = ROUND(lerpf(rout, frout, pa));
+gout = ROUND(lerpf(gout, fgout, pa));
+bout = ROUND(lerpf(bout, fbout, pa));
 }
 
+#if DEPTH < 32
 dstr[j] = av_clip_uintp2(rout, depth);
 dstg[j] = av_clip_uintp2(gout, depth);
 dstb[j] = av_clip_uintp2(bout, depth);
+#else
+dstr[j] = rout;
+dstg[j] = gout;
+dstb[j] = bout;
+#endif
 
 if (have_alpha == 1) {
+#if DEPTH < 32
 dsta[j] = av_clip_uintp2(s->lut[A][R][rin] +
  s->lut[A][G][gin] +
  s->lut[A][B][bin] +
  s->lut[A][A][ain], depth);
+#else
+dsta[j] = s->ar * rin +
+  s->ag * gin +
+  s->ab * bin +
+  s->aa * ain;
+#endif
 }
 }
 
@@ -115,6 +161,8 @@ static av_always_inline int 
fn(filter_slice_rgba_planar)(AVFilterContext *ctx, v
 return 0;
 }
 
+#if DEPTH < 32
+
 static av_always_inline int fn(filter_slice_rgba_packed)(AVFilterContext *ctx, 
void *arg, int jobnr, int nb_jobs,
  int have_alpha, int 
step, int pc, int depth)
 {
@@ -191,3 +239,5 @@ static av_always_inline int 
fn(filter_slice_rgba_packed)(AVFilterContext *ctx, v
 
 return 0;
 }
+
+#endif
diff --git a/libavfilter/vf_colorchannelmixer.c 
b/libavfilter/vf_colorchannelmixer.c
index b32e0a9d0e..88dd7451dc 100644
--- a/libavfilter/vf_colorchannelmixer.c
+++ b/libavfilter/vf_colorchannelmixer.c
@@ -77,6 +77,10 @@ static void preservel(float *r, float *g, float *b, float 
lin, float lout, float
 #define DEPTH 

[FFmpeg-cvslog] avfilter/vf_maskedmerge: fix rounding when masking

2022-03-03 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed Mar  2 22:30:40 
2022 +0100| [dae95b3ffd62ed86cd2e3798c2f281aa67969eca] | committer: Paul B Mahol

avfilter/vf_maskedmerge: fix rounding when masking

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dae95b3ffd62ed86cd2e3798c2f281aa67969eca
---

 libavfilter/maskedmerge.h  |  2 +-
 libavfilter/vf_maskedmerge.c   | 20 
 libavfilter/x86/vf_maskedmerge.asm | 17 ++---
 3 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/libavfilter/maskedmerge.h b/libavfilter/maskedmerge.h
index 8e2b1cf676..c1cf8027e4 100644
--- a/libavfilter/maskedmerge.h
+++ b/libavfilter/maskedmerge.h
@@ -30,7 +30,7 @@ typedef struct MaskedMergeContext {
 int linesize[4];
 int nb_planes;
 int planes;
-int half, depth;
+int half, depth, max;
 FFFrameSync fs;
 
 void (*maskedmerge)(const uint8_t *bsrc, const uint8_t *osrc,
diff --git a/libavfilter/vf_maskedmerge.c b/libavfilter/vf_maskedmerge.c
index 11492af61f..db0c516938 100644
--- a/libavfilter/vf_maskedmerge.c
+++ b/libavfilter/vf_maskedmerge.c
@@ -96,7 +96,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int 
jobnr, int nb_jobs)
base->linesize[p], overlay->linesize[p],
mask->linesize[p], out->linesize[p],
s->width[p], slice_end - slice_start,
-   s->half, s->depth);
+   s->half, s->max);
 }
 
 return 0;
@@ -138,13 +138,13 @@ static int process_frame(FFFrameSync *fs)
 return ff_filter_frame(outlink, out);
 }
 
-#define MASKEDMERGE(n, type, half, shift)  \
+#define MASKEDMERGE(n, type, ctype, half, max, div)\
 static void maskedmerge##n(const uint8_t *bbsrc, const uint8_t *oosrc, \
const uint8_t *mmsrc, uint8_t *ddst,\
ptrdiff_t blinesize, ptrdiff_t olinesize,   \
ptrdiff_t mlinesize, ptrdiff_t dlinesize,   \
int w, int h,   \
-   int hhalf, int sshift)  \
+   int hhalf, int mmax)\
 {  \
 const type *bsrc = (const type *)bbsrc;\
 const type *osrc = (const type *)oosrc;\
@@ -158,7 +158,10 @@ static void maskedmerge##n(const uint8_t *bbsrc, const 
uint8_t *oosrc, \
\
 for (int y = 0; y < h; y++) {  \
 for (int x = 0; x < w; x++) {  \
-dst[x] = bsrc[x] + ((msrc[x] * (osrc[x] - bsrc[x]) + half) shift); 
\
+const type invm = max - msrc[x];   \
+const ctype r = ((ctype)(bsrc[x] * invm) + \
+ (ctype)(msrc[x] * osrc[x] + half))  div;  \
+dst[x] = r;\
 }  \
\
 dst  += dlinesize; \
@@ -168,9 +171,9 @@ static void maskedmerge##n(const uint8_t *bbsrc, const 
uint8_t *oosrc, \
 }  \
 }
 
-MASKEDMERGE(8,  uint8_t, 128, >> 8)
-MASKEDMERGE(16, uint16_t, hhalf, >> sshift)
-MASKEDMERGE(32, float, 0.f, + 0.f)
+MASKEDMERGE(8,  uint8_t,  uint16_t,   127, 255,  / 255)
+MASKEDMERGE(16, uint16_t, uint32_t, hhalf, mmax, / mmax)
+MASKEDMERGE(32, float,float,  0.f, 1.f,  + 0.f)
 
 static int config_input(AVFilterLink *inlink)
 {
@@ -189,7 +192,8 @@ static int config_input(AVFilterLink *inlink)
 s->width[0]  = s->width[3]  = inlink->w;
 
 s->depth = desc->comp[0].depth;
-s->half = (1 << s->depth) / 2;
+s->max  = (1 << s->depth) - 1;
+s->half = s->max / 2;
 
 if (s->depth == 8)
 s->maskedmerge = maskedmerge8;
diff --git a/libavfilter/x86/vf_maskedmerge.asm 
b/libavfilter/x86/vf_maskedmerge.asm
index 7e61935b97..1028299087 100644
--- a/libavfilter/x86/vf_maskedmerge.asm
+++ b/libavfilter/x86/vf_maskedmerge.asm
@@ -24,26 +24,28 @@
 
 SECTION_RODATA
 
-pw_128: times 8 dw 128
-pw_256: times 8 dw 256
+pw_127: times 8 dw 127
+pw_255: times 8 dw 255
+pw_32897: times 8 dw 32897
 
 SECTION .text
 
 INIT_XMM sse2
 %if ARCH_X86_64
-cglobal maskedmerge8, 8, 11, 7, bsrc, osrc, msrc, dst, blinesize, olinesize, 
mlinesize, dlinesize, w, h, x
+cglobal maskedmerge8, 8, 11, 8, bsrc, osrc, msrc, dst, blinesize, olinesize, 
mlinesize, dlinesize, w, h, x
 mov wd, dword wm
 mov hd, dword hm
 %else
-cglobal maskedmerge8, 5, 7, 

[FFmpeg-cvslog] avfilter/vf_colorchannelmixer: refactor / add template

2022-03-03 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed Mar  2 15:35:14 
2022 +0100| [835446a8e10bf402a2731bbf5db7c282fff8c4f8] | committer: Paul B Mahol

avfilter/vf_colorchannelmixer: refactor / add template

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=835446a8e10bf402a2731bbf5db7c282fff8c4f8
---

 libavfilter/colorchannelmixer_template.c | 193 +++
 libavfilter/vf_colorchannelmixer.c   | 411 ---
 2 files changed, 244 insertions(+), 360 deletions(-)

diff --git a/libavfilter/colorchannelmixer_template.c 
b/libavfilter/colorchannelmixer_template.c
new file mode 100644
index 00..0f15f8fd07
--- /dev/null
+++ b/libavfilter/colorchannelmixer_template.c
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2013 Paul B Mahol
+ *
+ * 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 
+
+#undef pixel
+#if DEPTH == 8
+#define pixel uint8_t
+#elif DEPTH == 16
+#define pixel uint16_t
+#endif
+
+#undef fn
+#undef fn2
+#undef fn3
+#define fn3(a,b)   a##_##b
+#define fn2(a,b)   fn3(a,b)
+#define fn(a)  fn2(a, DEPTH)
+
+static av_always_inline int fn(filter_slice_rgba_planar)(AVFilterContext *ctx, 
void *arg, int jobnr, int nb_jobs,
+ int have_alpha, int 
depth, int pc)
+{
+ColorChannelMixerContext *s = ctx->priv;
+ThreadData *td = arg;
+AVFrame *in = td->in;
+AVFrame *out = td->out;
+const float pa = s->preserve_amount;
+const float max = (1 << depth) - 1;
+const int slice_start = (out->height * jobnr) / nb_jobs;
+const int slice_end = (out->height * (jobnr+1)) / nb_jobs;
+const pixel *srcg = (const pixel *)(in->data[0] + slice_start * 
in->linesize[0]);
+const pixel *srcb = (const pixel *)(in->data[1] + slice_start * 
in->linesize[1]);
+const pixel *srcr = (const pixel *)(in->data[2] + slice_start * 
in->linesize[2]);
+const pixel *srca = (const pixel *)(in->data[3] + slice_start * 
in->linesize[3]);
+pixel *dstg = (pixel *)(out->data[0] + slice_start * out->linesize[0]);
+pixel *dstb = (pixel *)(out->data[1] + slice_start * out->linesize[1]);
+pixel *dstr = (pixel *)(out->data[2] + slice_start * out->linesize[2]);
+pixel *dsta = (pixel *)(out->data[3] + slice_start * out->linesize[3]);
+
+for (int i = slice_start; i < slice_end; i++) {
+for (int j = 0; j < out->width; j++) {
+const pixel rin = srcr[j];
+const pixel gin = srcg[j];
+const pixel bin = srcb[j];
+const pixel ain = have_alpha ? srca[j] : 0;
+int rout, gout, bout;
+
+rout = s->lut[R][R][rin] +
+   s->lut[R][G][gin] +
+   s->lut[R][B][bin] +
+   (have_alpha == 1 ? s->lut[R][A][ain] : 0);
+gout = s->lut[G][R][rin] +
+   s->lut[G][G][gin] +
+   s->lut[G][B][bin] +
+   (have_alpha == 1 ? s->lut[G][A][ain] : 0);
+bout = s->lut[B][R][rin] +
+   s->lut[B][G][gin] +
+   s->lut[B][B][bin] +
+   (have_alpha == 1 ? s->lut[B][A][ain] : 0);
+
+if (pc) {
+float frout = av_clipf(rout, 0.f, max);
+float fgout = av_clipf(gout, 0.f, max);
+float fbout = av_clipf(bout, 0.f, max);
+float lin, lout;
+
+preserve_color(s->preserve_color, rin, gin, bin,
+   rout, gout, bout, max, &lin, &lout);
+preservel(&frout, &fgout, &fbout, lin, lout, max);
+
+rout = lrintf(lerpf(rout, frout, pa));
+gout = lrintf(lerpf(gout, fgout, pa));
+bout = lrintf(lerpf(bout, fbout, pa));
+}
+
+dstr[j] = av_clip_uintp2(rout, depth);
+dstg[j] = av_clip_uintp2(gout, depth);
+dstb[j] = av_clip_uintp2(bout, depth);
+
+if (have_alpha == 1) {
+dsta[j] = av_clip_uintp2(s->lut[A][R][rin] +
+ s->lut[A][G][gin] +
+ s->lut[A][B][bin] +
+ s->lut[A][A][ain], depth);
+}
+}
+
+srcg += in->

[FFmpeg-cvslog] doc/filters: correct default value of lut filters

2022-03-03 Thread Gyan Doshi
ffmpeg | branch: master | Gyan Doshi  | Thu Mar  3 17:06:33 
2022 +0530| [72684d2c2df015fadefc06b6eb58964ad8afa2fe] | committer: Gyan Doshi

doc/filters: correct default value of lut filters

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=72684d2c2df015fadefc06b6eb58964ad8afa2fe
---

 doc/filters.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 8cba7f744d..571d9430c6 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -15096,7 +15096,7 @@ expression
 
 @end table
 
-All expressions default to "val".
+All expressions default to "clipval".
 
 @subsection Commands
 

___
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/avf_abitscope: add support for more input formats

2022-03-03 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Mar  3 12:10:29 
2022 +0100| [352a01c3ef8797f83f4429e1f5320179aea0e4fd] | committer: Paul B Mahol

avfilter/avf_abitscope: add support for more input formats

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=352a01c3ef8797f83f4429e1f5320179aea0e4fd
---

 libavfilter/avf_abitscope.c | 48 ++---
 1 file changed, 28 insertions(+), 20 deletions(-)

diff --git a/libavfilter/avf_abitscope.c b/libavfilter/avf_abitscope.c
index 16b2d66f11..982bcc6e61 100644
--- a/libavfilter/avf_abitscope.c
+++ b/libavfilter/avf_abitscope.c
@@ -71,7 +71,10 @@ static int query_formats(AVFilterContext *ctx)
 AVFilterChannelLayouts *layouts;
 AVFilterLink *inlink = ctx->inputs[0];
 AVFilterLink *outlink = ctx->outputs[0];
-static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16P, 
AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_NONE };
+static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16P, 
AV_SAMPLE_FMT_S32P,
+   AV_SAMPLE_FMT_U8P,  
AV_SAMPLE_FMT_S64P,
+   AV_SAMPLE_FMT_FLTP, 
AV_SAMPLE_FMT_DBLP,
+   AV_SAMPLE_FMT_NONE };
 static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGBA, 
AV_PIX_FMT_NONE };
 int ret;
 
@@ -144,18 +147,7 @@ static int config_output(AVFilterLink *outlink)
 return 0;
 }
 
-static void count_bits(AudioBitScopeContext *s, uint32_t sample, int max)
-{
-int i;
-
-for (i = 0; i < max; i++) {
-if (sample & (1U << i))
-s->counter[i]++;
-}
-}
-
-
-#define BARS(type, depth)   \
+#define BARS(type, depth, one)  \
 for (int ch = 0; ch < inlink->channels; ch++) { \
 const type *in = (const type *)insamples->extended_data[ch];\
 const int w = outpicref->width / inlink->channels;  \
@@ -163,8 +155,12 @@ static void count_bits(AudioBitScopeContext *s, uint32_t 
sample, int max)
 const uint32_t color = AV_RN32(&s->fg[4 * ch]); \
 \
 memset(s->counter, 0, sizeof(s->counter));  \
-for (int i = 0; i < insamples->nb_samples; i++) \
-count_bits(s, in[i], depth);\
+for (int i = 0; i < insamples->nb_samples; i++) {   \
+for (int j = 0; j < depth; j++) {   \
+if (in[i] & (one << j)) \
+s->counter[j]++;\
+}   \
+}   \
 \
 for (int b = 0; b < depth; b++) {   \
 for (int j = 1; j < h - 1; j++) {   \
@@ -178,7 +174,7 @@ static void count_bits(AudioBitScopeContext *s, uint32_t 
sample, int max)
 }   \
 }
 
-#define TRACE(type, depth)  \
+#define TRACE(type, depth, one) \
 for (int ch = 0; ch < inlink->channels; ch++) { \
 const int w = outpicref->width / inlink->channels;  \
 const type *in = (const type *)insamples->extended_data[ch];\
@@ -186,8 +182,12 @@ static void count_bits(AudioBitScopeContext *s, uint32_t 
sample, int max)
 int wv; \
 \
 memset(s->counter, 0, sizeof(s->counter));  \
-for (int i = 0; i < insamples->nb_samples; i++) \
-count_bits(s, in[i], depth);\
+for (int i = 0; i < insamples->nb_samples; i++) {   \
+for (int j = 0; j < depth; j++) {   \
+if (in[i] & (one << j)) \
+s->counter[j]++;\
+}   \
+}   \
 \
 for (int b = 0; b < depth; b++) {   \
 

[FFmpeg-cvslog] avfilter/vf_geq: add float formats support

2022-03-03 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Mar  3 13:14:47 
2022 +0100| [d607af50fde4f8f83ebdfe494650351e8f6d021c] | committer: Paul B Mahol

avfilter/vf_geq: add float formats support

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d607af50fde4f8f83ebdfe494650351e8f6d021c
---

 libavfilter/vf_geq.c | 57 +++-
 1 file changed, 48 insertions(+), 9 deletions(-)

diff --git a/libavfilter/vf_geq.c b/libavfilter/vf_geq.c
index eef1ac0958..fd9e0fd80b 100644
--- a/libavfilter/vf_geq.c
+++ b/libavfilter/vf_geq.c
@@ -52,6 +52,7 @@ typedef struct GEQContext {
 AVFrame *picref;///< current input buffer
 uint8_t *dst;   ///< reference pointer to the 8bits output
 uint16_t *dst16;///< reference pointer to the 16bits output
+float *dst32;   ///< reference pointer to the 32bits output
 double values[VAR_VARS_NB]; ///< expression values
 int hsub, vsub; ///< chroma subsampling
 int planes; ///< number of planes
@@ -114,13 +115,19 @@ static inline double getpix(void *priv, double x, double 
y, int plane)
 x -= xi;
 y -= yi;
 
-if (geq->bps > 8) {
+if (geq->bps > 8 && geq->bps <= 16) {
 const uint16_t *src16 = (const uint16_t*)src;
 linesize /= 2;
 
 return (1-y)*((1-x)*src16[xi +  yi* linesize] + x*src16[xi + 1 
+  yi* linesize])
   +   y *((1-x)*src16[xi + (yi+1) * linesize] + x*src16[xi + 1 
+ (yi+1) * linesize]);
-} else {
+} else if (geq->bps == 32) {
+const float *src32 = (const float*)src;
+linesize /= 4;
+
+return (1-y)*((1-x)*src32[xi +  yi* linesize] + x*src32[xi + 1 
+  yi* linesize])
+  +   y *((1-x)*src32[xi + (yi+1) * linesize] + x*src32[xi + 1 
+ (yi+1) * linesize]);
+} else if (geq->bps == 8) {
 return (1-y)*((1-x)*src[xi +  yi* linesize] + x*src[xi + 1 +  
yi* linesize])
   +   y *((1-x)*src[xi + (yi+1) * linesize] + x*src[xi + 1 + 
(yi+1) * linesize]);
 }
@@ -128,15 +135,22 @@ static inline double getpix(void *priv, double x, double 
y, int plane)
 xi = av_clipd(x, 0, w - 1);
 yi = av_clipd(y, 0, h - 1);
 
-if (geq->bps > 8) {
+if (geq->bps > 8 && geq->bps <= 16) {
 const uint16_t *src16 = (const uint16_t*)src;
 linesize /= 2;
 
 return src16[xi + yi * linesize];
-} else {
+} else if (geq->bps == 32) {
+const float *src32 = (const float*)src;
+linesize /= 4;
+
+return src32[xi + yi * linesize];
+} else if (geq->bps == 8) {
 return src[xi + yi * linesize];
 }
 }
+
+return 0;
 }
 
 static int calculate_sums(GEQContext *geq, int plane, int w, int h)
@@ -150,10 +164,12 @@ static int calculate_sums(GEQContext *geq, int plane, int 
w, int h)
 geq->pixel_sums[plane] = av_malloc_array(w, h * sizeof 
(*geq->pixel_sums[plane]));
 if (!geq->pixel_sums[plane])
 return AVERROR(ENOMEM);
-if (geq->bps > 8)
+if (geq->bps == 32)
+linesize /= 4;
+else if (geq->bps > 8 && geq->bps <= 16)
 linesize /= 2;
 for (yi = 0; yi < h; yi ++) {
-if (geq->bps > 8) {
+if (geq->bps > 8 && geq->bps <= 16) {
 const uint16_t *src16 = (const uint16_t*)src;
 double linesum = 0;
 
@@ -161,13 +177,21 @@ static int calculate_sums(GEQContext *geq, int plane, int 
w, int h)
 linesum += src16[xi + yi * linesize];
 geq->pixel_sums[plane][xi + yi * w] = linesum;
 }
-} else {
+} else if (geq->bps == 8) {
 double linesum = 0;
 
 for (xi = 0; xi < w; xi ++) {
 linesum += src[xi + yi * linesize];
 geq->pixel_sums[plane][xi + yi * w] = linesum;
 }
+} else if (geq->bps == 32) {
+const float *src32 = (const float*)src;
+double linesum = 0;
+
+for (xi = 0; xi < w; xi ++) {
+linesum += src32[xi + yi * linesize];
+geq->pixel_sums[plane][xi + yi * w] = linesum;
+}
 }
 if (yi)
 for (xi = 0; xi < w; xi ++) {
@@ -249,8 +273,10 @@ static av_cold int geq_init(AVFilterContext *ctx)
 if (!geq->expr_str[V]) geq->expr_str[V] = av_strdup(geq->expr_str[U]);
 }
 
-if (!geq->expr_str[A]) {
+if (!geq->expr_str[A] && geq->bps != 32) {
 geq->expr_str[A] = av_asprintf("%d", (1expr_str[A] = av_asprintf("%f", 1.f);
 }
 if (!geq->expr_str[G])
 geq->expr_str[G] = av_strdup("g(X,Y)");
@@ -322,6 +348,7 @@ static int geq_query_formats(AVFilterContext *ctx)
 AV_PIX_FMT_YUV444P16,  AV_PIX_FMT_YUV422P16,  AV_PIX_FMT_YUV420P16,
 

[FFmpeg-cvslog] avfilter/avf_abitscope: refactor code & add trace mode

2022-03-03 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Mar  3 11:31:38 
2022 +0100| [de0bb77563a02d9556af8144fee88cdbedd0cdef] | committer: Paul B Mahol

avfilter/avf_abitscope: refactor code & add trace mode

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=de0bb77563a02d9556af8144fee88cdbedd0cdef
---

 doc/filters.texi|   3 +
 libavfilter/avf_abitscope.c | 138 
 2 files changed, 92 insertions(+), 49 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 571d9430c6..59f9dab2ea 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -25867,6 +25867,9 @@ Default value is @code{1024x256}.
 Specify list of colors separated by space or by '|' which will be used to
 draw channels. Unrecognized or missing colors will be replaced
 by white color.
+
+@item mode, m
+Set output mode. Can be @code{bars} or @code{trace}. Default is @code{bars}.
 @end table
 
 @section adrawgraph
diff --git a/libavfilter/avf_abitscope.c b/libavfilter/avf_abitscope.c
index f74a6eacb0..16b2d66f11 100644
--- a/libavfilter/avf_abitscope.c
+++ b/libavfilter/avf_abitscope.c
@@ -34,13 +34,17 @@ typedef struct AudioBitScopeContext {
 int w, h;
 AVRational frame_rate;
 char *colors;
+int mode;
 
 int nb_channels;
 int nb_samples;
 int depth;
+int current_vpos;
 uint8_t *fg;
 
 uint64_t counter[64];
+
+AVFrame *outpicref;
 } AudioBitScopeContext;
 
 #define OFFSET(x) offsetof(AudioBitScopeContext, x)
@@ -52,6 +56,10 @@ static const AVOption abitscope_options[] = {
 { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, 
{.str="1024x256"}, 0, 0, FLAGS },
 { "s","set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, 
{.str="1024x256"}, 0, 0, FLAGS },
 { "colors", "set channels colors", OFFSET(colors), AV_OPT_TYPE_STRING, 
{.str = "red|green|blue|yellow|orange|lime|pink|magenta|brown" }, 0, 0, FLAGS },
+{ "mode", "set output mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = 0 }, 
0, 1, FLAGS, "mode" },
+{ "m","set output mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = 0 }, 
0, 1, FLAGS, "mode" },
+{ "bars",  NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, 0, 0, FLAGS, "mode" },
+{ "trace", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 1 }, 0, 0, FLAGS, "mode" },
 { NULL }
 };
 
@@ -146,75 +154,99 @@ static void count_bits(AudioBitScopeContext *s, uint32_t 
sample, int max)
 }
 }
 
+
+#define BARS(type, depth)   \
+for (int ch = 0; ch < inlink->channels; ch++) { \
+const type *in = (const type *)insamples->extended_data[ch];\
+const int w = outpicref->width / inlink->channels;  \
+const int h = outpicref->height / depth;\
+const uint32_t color = AV_RN32(&s->fg[4 * ch]); \
+\
+memset(s->counter, 0, sizeof(s->counter));  \
+for (int i = 0; i < insamples->nb_samples; i++) \
+count_bits(s, in[i], depth);\
+\
+for (int b = 0; b < depth; b++) {   \
+for (int j = 1; j < h - 1; j++) {   \
+uint8_t *dst = outpicref->data[0] + (b * h + j) * 
outpicref->linesize[0] + w * ch * 4; \
+const int ww = (s->counter[depth - b - 1] / 
(float)insamples->nb_samples) * (w - 1); \
+\
+for (int i = 0; i < ww; i++) {  \
+AV_WN32(&dst[i * 4], color);\
+}   \
+}   \
+}   \
+}
+
+#define TRACE(type, depth)  \
+for (int ch = 0; ch < inlink->channels; ch++) { \
+const int w = outpicref->width / inlink->channels;  \
+const type *in = (const type *)insamples->extended_data[ch];\
+const int wb = w / depth;   \
+int wv; \
+\
+memset(s->counter, 0, sizeof(s->counter));  \
+for (int i = 0; i < insamples->nb_samples; i++) \
+count_bits(s, in[i], depth);\
+  

[FFmpeg-cvslog] avfilter/vf_zscale: add slice threading support

2022-03-03 Thread Victoria Zhislina
ffmpeg | branch: master | Victoria Zhislina  | Mon Feb 21 
11:20:55 2022 +0300| [d0aefc37069e1602aa8cc5568e87f4a5e52fb4f3] | committer: 
Paul B Mahol

avfilter/vf_zscale: add slice threading support

By ffmpeg threading support implementation via frame slicing and doing
zimg_filter_graph_build that used to take 30-60% of each frame processig
only if necessary (some parameters changed)
the performance increase vs original version
in video downscale and color conversion  >4x is seen
on 64 cores Intel Xeon, 3x on i7-6700K (4 cores with HT)

Signed-off-by: Victoria Zhislina 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d0aefc37069e1602aa8cc5568e87f4a5e52fb4f3
---

 libavfilter/vf_zscale.c | 408 +---
 1 file changed, 282 insertions(+), 126 deletions(-)

diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c
index 1288c5efc1..dea2b9578b 100644
--- a/libavfilter/vf_zscale.c
+++ b/libavfilter/vf_zscale.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2015 Paul B Mahol
+ * Copyright (c) 2022 Victoria Zhislina, Intel
  *
  * This file is part of FFmpeg.
  *
@@ -44,6 +45,8 @@
 #include "libavutil/imgutils.h"
 
 #define ZIMG_ALIGNMENT 32
+#define MIN_TILESIZE 64
+#define MAX_THREADS 64
 
 static const char *const var_names[] = {
 "in_w",   "iw",
@@ -113,13 +116,17 @@ typedef struct ZScaleContext {
 
 int force_original_aspect_ratio;
 
-void *tmp;
-size_t tmp_size;
+void *tmp[MAX_THREADS]; //separate for each thread;
+int nb_threads;
+int slice_h;
 
 zimg_image_format src_format, dst_format;
 zimg_image_format alpha_src_format, alpha_dst_format;
+zimg_image_format src_format_tmp, dst_format_tmp;
+zimg_image_format alpha_src_format_tmp, alpha_dst_format_tmp;
 zimg_graph_builder_params alpha_params, params;
-zimg_filter_graph *alpha_graph, *graph;
+zimg_graph_builder_params alpha_params_tmp, params_tmp;
+zimg_filter_graph *alpha_graph[MAX_THREADS], *graph[MAX_THREADS];
 
 enum AVColorSpace in_colorspace, out_colorspace;
 enum AVColorTransferCharacteristic in_trc, out_trc;
@@ -128,10 +135,35 @@ typedef struct ZScaleContext {
 enum AVChromaLocation in_chromal, out_chromal;
 } ZScaleContext;
 
+typedef struct ThreadData {
+const AVPixFmtDescriptor *desc, *odesc;
+AVFrame *in, *out;
+} ThreadData;
+
 static av_cold int init(AVFilterContext *ctx)
 {
 ZScaleContext *s = ctx->priv;
 int ret;
+int i;
+for (i = 0; i < MAX_THREADS; i++) {
+s->tmp[i] = NULL;
+s->graph[i] = NULL;
+s->alpha_graph[i] = NULL;
+}
+zimg_image_format_default(&s->src_format, ZIMG_API_VERSION);
+zimg_image_format_default(&s->dst_format, ZIMG_API_VERSION);
+zimg_image_format_default(&s->src_format_tmp, ZIMG_API_VERSION);
+zimg_image_format_default(&s->dst_format_tmp, ZIMG_API_VERSION);
+
+zimg_image_format_default(&s->alpha_src_format, ZIMG_API_VERSION);
+zimg_image_format_default(&s->alpha_dst_format, ZIMG_API_VERSION);
+zimg_image_format_default(&s->alpha_src_format_tmp, ZIMG_API_VERSION);
+zimg_image_format_default(&s->alpha_dst_format_tmp, ZIMG_API_VERSION);
+
+zimg_graph_builder_params_default(&s->params, ZIMG_API_VERSION);
+zimg_graph_builder_params_default(&s->params_tmp, ZIMG_API_VERSION);
+zimg_graph_builder_params_default(&s->alpha_params, ZIMG_API_VERSION);
+zimg_graph_builder_params_default(&s->alpha_params_tmp, ZIMG_API_VERSION);
 
 if (s->size_str && (s->w_expr || s->h_expr)) {
 av_log(ctx, AV_LOG_ERROR,
@@ -471,6 +503,51 @@ static enum AVColorRange convert_range_from_zimg(enum 
zimg_pixel_range_e color_r
 return AVCOL_RANGE_UNSPECIFIED;
 }
 
+/* returns 0 if image formats are the same and 1 otherwise */
+static int compare_zimg_image_formats(zimg_image_format *img_fmt0, 
zimg_image_format *img_fmt1)
+{
+return ((img_fmt0->chroma_location != img_fmt1->chroma_location) ||
+#if ZIMG_API_VERSION >= 0x204
+(img_fmt0->alpha != img_fmt1->alpha) ||
+#endif
+(img_fmt0->color_family != img_fmt1->color_family) ||
+(img_fmt0->color_primaries != img_fmt1->color_primaries) ||
+(img_fmt0->depth != img_fmt1->depth) ||
+(img_fmt0->field_parity != img_fmt1->field_parity) ||
+(img_fmt0->height != img_fmt1->height) ||
+(img_fmt0->matrix_coefficients != img_fmt1->matrix_coefficients) ||
+(img_fmt0->pixel_range != img_fmt1->pixel_range) ||
+(img_fmt0->pixel_type != img_fmt1->pixel_type) ||
+(img_fmt0->subsample_h != img_fmt1->subsample_h) ||
+(img_fmt0->subsample_w != img_fmt1->subsample_w) ||
+(img_fmt0->transfer_characteristics != 
img_fmt1->transfer_characteristics) ||
+(img_fmt0->width != img_fmt1->width));
+}
+
+/* returns 0 if graph builder parameters are the same and 1 otherwise */
+static int compare_zimg_graph_builder_params(zimg_graph_builder_params *parm0, 
zimg_graph_builder_params *parm1)
+{
+/* the 

[FFmpeg-cvslog] avfilter/vf_zscale: fix several issues in previous commit

2022-03-03 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Mar  3 15:58:33 
2022 +0100| [837c55da3deebe48639b8c6c2fe34c29609352d3] | committer: Paul B Mahol

avfilter/vf_zscale: fix several issues in previous commit

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=837c55da3deebe48639b8c6c2fe34c29609352d3
---

 libavfilter/vf_zscale.c | 60 +
 1 file changed, 25 insertions(+), 35 deletions(-)

diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c
index dea2b9578b..6e94fc8c82 100644
--- a/libavfilter/vf_zscale.c
+++ b/libavfilter/vf_zscale.c
@@ -44,8 +44,7 @@
 #include "libavutil/pixdesc.h"
 #include "libavutil/imgutils.h"
 
-#define ZIMG_ALIGNMENT 32
-#define MIN_TILESIZE 64
+#define ZIMG_ALIGNMENT 64
 #define MAX_THREADS 64
 
 static const char *const var_names[] = {
@@ -118,7 +117,6 @@ typedef struct ZScaleContext {
 
 void *tmp[MAX_THREADS]; //separate for each thread;
 int nb_threads;
-int slice_h;
 
 zimg_image_format src_format, dst_format;
 zimg_image_format alpha_src_format, alpha_dst_format;
@@ -566,48 +564,47 @@ static void format_init(zimg_image_format *format, 
AVFrame *frame, const AVPixFm
 }
 
 static int graphs_build(AVFrame *in, AVFrame *out, const AVPixFmtDescriptor 
*desc, const AVPixFmtDescriptor *out_desc,
-ZScaleContext *s, int job_nr)
+AVFilterContext *ctx, int job_nr, int n_jobs)
 {
+ZScaleContext *s = ctx->priv;
 int ret;
 size_t size;
 zimg_image_format src_format;
 zimg_image_format dst_format;
 zimg_image_format alpha_src_format;
 zimg_image_format alpha_dst_format;
+const int in_slice_start  =  4 * in->height  + 2) / 4) *  job_nr)   / 
n_jobs);
+const int in_slice_end= (job_nr == n_jobs-1) ? in->height  : 4 *  
(((in->height  + 2) / 4) * (job_nr+1) / n_jobs);
+const int out_slice_start =  4 * out->height + 2) / 4) *  job_nr)   / 
n_jobs);
+const int out_slice_end   = (job_nr == n_jobs-1) ? out->height : 4 *  
(((out->height + 2) / 4) * (job_nr+1) / n_jobs);
 
 src_format = s->src_format;
 dst_format = s->dst_format;
 /* The input slice is specified through the active_region field,
 unlike the output slice.
-according to zimg requirements input and output slices should have even 
dimentions */
+according to zimg requirements input and output slices should have even 
dimensions */
 src_format.active_region.width = in->width;
-src_format.active_region.height = s->slice_h;
+src_format.active_region.height = in_slice_end - in_slice_start;
 src_format.active_region.left = 0;
-src_format.active_region.top = job_nr * src_format.active_region.height;
+src_format.active_region.top = in_slice_start;
 //dst now is the single tile only!!
 dst_format.width = out->width;
-dst_format.height = ((unsigned int)(out->height / s->nb_threads)) & 
0xfffe;
-
-//the last slice could differ from the previous ones due to the slices 
division "tail"
-if (job_nr == (s->nb_threads - 1)) {
-src_format.active_region.height = src_format.height - 
src_format.active_region.top;
-dst_format.height = out->height - job_nr * dst_format.height;
-}
+dst_format.height = out_slice_end - out_slice_start;
 
 if (s->graph[job_nr]) {
 zimg_filter_graph_free(s->graph[job_nr]);
 }
 s->graph[job_nr] = zimg_filter_graph_build(&src_format, &dst_format, 
&s->params);
 if (!s->graph[job_nr])
-return print_zimg_error(NULL);
+return print_zimg_error(ctx);
 
 ret = zimg_filter_graph_get_tmp_size(s->graph[job_nr], &size);
 if (ret)
-return print_zimg_error(NULL);
+return print_zimg_error(ctx);
 
 if (s->tmp[job_nr])
 av_freep(&s->tmp[job_nr]);
-s->tmp[job_nr] = av_malloc(size);
+s->tmp[job_nr] = av_calloc(size, 1);
 if (!s->tmp[job_nr])
 return AVERROR(ENOMEM);
 
@@ -617,25 +614,19 @@ static int graphs_build(AVFrame *in, AVFrame *out, const 
AVPixFmtDescriptor *des
 /* The input slice is specified through the active_region field, 
unlike the output slice.
 according to zimg requirements input and output slices should have 
even dimentions */
 alpha_src_format.active_region.width = in->width;
-alpha_src_format.active_region.height = s->slice_h;
+alpha_src_format.active_region.height = in_slice_end - in_slice_start;
 alpha_src_format.active_region.left = 0;
-alpha_src_format.active_region.top = job_nr * 
alpha_src_format.active_region.height;
+alpha_src_format.active_region.top = in_slice_start;
 //dst now is the single tile only!!
 alpha_dst_format.width = out->width;
-alpha_dst_format.height = ((unsigned int)(out->height / 
s->nb_threads)) & 0xfffe;
-
-//the last slice could differ from the previous ones due to the slices 
division "tail"
-if (job_nr == (s->nb_thread

[FFmpeg-cvslog] avfilter/framepool: use av_image_fill_plane_sizes() to calculate pool sizes

2022-03-03 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Mar  1 11:05:40 
2022 -0300| [8fcd9d7375979baf2d09e97b36dd482b6210a999] | committer: James Almer

avfilter/framepool: use av_image_fill_plane_sizes() to calculate pool sizes

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8fcd9d7375979baf2d09e97b36dd482b6210a999
---

 libavfilter/framepool.c | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c
index 5b510c9af9..96bfe46319 100644
--- a/libavfilter/framepool.c
+++ b/libavfilter/framepool.c
@@ -57,6 +57,8 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* 
(*alloc)(size_t size),
 int i, ret;
 FFFramePool *pool;
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
+ptrdiff_t linesizes[4];
+size_t sizes[4];
 
 if (!desc)
 return NULL;
@@ -89,13 +91,19 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* 
(*alloc)(size_t size),
 }
 }
 
-for (i = 0; i < 4 && pool->linesize[i]; i++) {
-int h = pool->height;
-if (i == 1 || i == 2)
-h = AV_CEIL_RSHIFT(h, desc->log2_chroma_h);
+for (i = 0; i < 4; i++)
+linesizes[i] = pool->linesize[i];
 
-pool->pools[i] = av_buffer_pool_init(pool->linesize[i] * h + align,
- alloc);
+if (av_image_fill_plane_sizes(sizes, pool->format,
+  pool->height,
+  linesizes) < 0) {
+goto fail;
+}
+
+for (i = 0; i < 4 && sizes[i]; i++) {
+if (sizes[i] > SIZE_MAX - align)
+goto fail;
+pool->pools[i] = av_buffer_pool_init(sizes[i] + align, alloc);
 if (!pool->pools[i])
 goto 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] avfilter/framepool: remove superfluous pallete buffer allocation

2022-03-03 Thread James Almer
ffmpeg | branch: master | James Almer  | Thu Mar  3 14:01:36 
2022 -0300| [ee88804d07c145bc7bca40c94bf6fd4cf71c06e4] | committer: James Almer

avfilter/framepool: remove superfluous pallete buffer allocation

av_image_fill_plane_sizes() already sets sizes[1] to AVPALETTE_SIZE.
Should fix memory leaks.

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ee88804d07c145bc7bca40c94bf6fd4cf71c06e4
---

 libavfilter/framepool.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c
index 96bfe46319..1990902666 100644
--- a/libavfilter/framepool.c
+++ b/libavfilter/framepool.c
@@ -56,13 +56,9 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* 
(*alloc)(size_t size),
 {
 int i, ret;
 FFFramePool *pool;
-const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
 ptrdiff_t linesizes[4];
 size_t sizes[4];
 
-if (!desc)
-return NULL;
-
 pool = av_mallocz(sizeof(FFFramePool));
 if (!pool)
 return NULL;
@@ -108,12 +104,6 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* 
(*alloc)(size_t size),
 goto fail;
 }
 
-if (desc->flags & AV_PIX_FMT_FLAG_PAL) {
-pool->pools[1] = av_buffer_pool_init(AVPALETTE_SIZE, alloc);
-if (!pool->pools[1])
-goto fail;
-}
-
 return pool;
 
 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] avcodec/tiff: do not abort on zero denominator

2022-03-03 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Mar  3 21:21:05 
2022 +0100| [4a5ee8c39947fe6ce48383aac0e7053aade71e67] | committer: Paul B Mahol

avcodec/tiff: do not abort on zero denominator

Fixes decoding valid DNG file.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4a5ee8c39947fe6ce48383aac0e7053aade71e67
---

 libavcodec/tiff.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 923f85d07f..e46a80e3ed 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1241,8 +1241,8 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
 value  = ff_tget(&s->gb, TIFF_LONG, s->le);
 value2 = ff_tget(&s->gb, TIFF_LONG, s->le);
 if (!value2) {
-av_log(s->avctx, AV_LOG_ERROR, "Invalid denominator in 
rational\n");
-return AVERROR_INVALIDDATA;
+av_log(s->avctx, AV_LOG_WARNING, "Invalid denominator in 
rational\n");
+value2 = 1;
 }
 
 break;
@@ -1421,8 +1421,8 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
 value  = ff_tget(&s->gb, TIFF_LONG, s->le);
 value2 = ff_tget(&s->gb, TIFF_LONG, s->le);
 if (!value2) {
-av_log(s->avctx, AV_LOG_ERROR, "Invalid black level 
denominator\n");
-return AVERROR_INVALIDDATA;
+av_log(s->avctx, AV_LOG_WARNING, "Invalid black level 
denominator\n");
+value2 = 1;
 }
 
 s->black_level = value / value2;

___
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/asrc_sinc: check allocation return value

2022-03-03 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Mar  3 22:54:33 
2022 +0100| [99f7f4144aa644b0d26dae6efe9ac81ba252cb1a] | committer: Paul B Mahol

avfilter/asrc_sinc: check allocation return value

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=99f7f4144aa644b0d26dae6efe9ac81ba252cb1a
---

 libavfilter/asrc_sinc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavfilter/asrc_sinc.c b/libavfilter/asrc_sinc.c
index e64a1e2f1c..1218696b27 100644
--- a/libavfilter/asrc_sinc.c
+++ b/libavfilter/asrc_sinc.c
@@ -113,6 +113,9 @@ static float *make_lpf(int num_taps, float Fc, float beta, 
float rho,
 float *h = av_calloc(num_taps, sizeof(*h)), sum = 0;
 float mult = scale / bessel_I_0(beta), mult1 = 1.f / (.5f * m + rho);
 
+if (!h)
+return NULL;
+
 av_assert0(Fc >= 0 && Fc <= 1);
 
 for (i = 0; i <= m / 2; 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/asrc_sinc: remove no longer correct (un)pack

2022-03-03 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Mar  3 22:52:45 
2022 +0100| [f4d123341c564e33d0410c41a05e9782d4df7585] | committer: Paul B Mahol

avfilter/asrc_sinc: remove no longer correct (un)pack

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f4d123341c564e33d0410c41a05e9782d4df7585
---

 libavfilter/asrc_sinc.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/libavfilter/asrc_sinc.c b/libavfilter/asrc_sinc.c
index 9ccb5694df..e64a1e2f1c 100644
--- a/libavfilter/asrc_sinc.c
+++ b/libavfilter/asrc_sinc.c
@@ -200,8 +200,6 @@ static void invert(float *h, int n)
 h[(n - 1) / 2] += 1;
 }
 
-#define PACK(h, n)   h[1] = h[n]
-#define UNPACK(h, n) h[n] = h[1], h[n + 1] = h[1] = 0;
 #define SQR(a) ((a) * (a))
 
 static float safe_log(float x)
@@ -239,7 +237,6 @@ static int fir_to_phase(SincContext *s, float **h, int 
*len, int *post_len, floa
 }
 
 s->tx_fn(s->tx, work, work, sizeof(float));   /* Cepstral: */
-UNPACK(work, work_len);
 
 for (i = 0; i <= work_len; i += 2) {
 float angle = atan2f(work[i + 1], work[i]);
@@ -261,7 +258,6 @@ static int fir_to_phase(SincContext *s, float **h, int 
*len, int *post_len, floa
 work[i + 1] = 0;
 }
 
-PACK(work, work_len);
 s->itx_fn(s->itx, work, work, sizeof(float));
 
 for (i = 0; i < work_len; 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".