[FFmpeg-cvslog] avcodec/exr.c: make channel name comparisons case insensitive

2020-01-22 Thread Gonzalo Garramuño
ffmpeg | branch: master | Gonzalo Garramuño  | Mon Jan 20 
14:25:50 2020 -0300| [44b1c5ddcf7b1c403cffb576f40d1f6c4231b063] | committer: 
Paul B Mahol

avcodec/exr.c: make channel name comparisons case insensitive

Allow matching channel names in lowercase, like Diffuse.r in addition to 
Diffuse.R

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

 libavcodec/exr.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index aeeaed40f5..49250dd095 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -41,6 +41,7 @@
 #include "libavutil/common.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/intfloat.h"
+#include "libavutil/avstring.h"
 #include "libavutil/opt.h"
 #include "libavutil/color_utils.h"
 
@@ -1399,24 +1400,24 @@ static int decode_header(EXRContext *s, AVFrame *frame)
 }
 
 if (layer_match) { /* only search channel if the layer match 
is valid */
-if (!strcmp(ch_gb.buffer, "R") ||
-!strcmp(ch_gb.buffer, "X") ||
-!strcmp(ch_gb.buffer, "U")) {
+if (!av_strcasecmp(ch_gb.buffer, "R") ||
+!av_strcasecmp(ch_gb.buffer, "X") ||
+!av_strcasecmp(ch_gb.buffer, "U")) {
 channel_index = 0;
 s->is_luma = 0;
-} else if (!strcmp(ch_gb.buffer, "G") ||
-   !strcmp(ch_gb.buffer, "V")) {
+} else if (!av_strcasecmp(ch_gb.buffer, "G") ||
+   !av_strcasecmp(ch_gb.buffer, "V")) {
 channel_index = 1;
 s->is_luma = 0;
-} else if (!strcmp(ch_gb.buffer, "Y")) {
+} else if (!av_strcasecmp(ch_gb.buffer, "Y")) {
 channel_index = 1;
 s->is_luma = 1;
-} else if (!strcmp(ch_gb.buffer, "B") ||
-   !strcmp(ch_gb.buffer, "Z") ||
-   !strcmp(ch_gb.buffer, "W")){
+} else if (!av_strcasecmp(ch_gb.buffer, "B") ||
+   !av_strcasecmp(ch_gb.buffer, "Z") ||
+   !av_strcasecmp(ch_gb.buffer, "W")){
channel_index = 2;
 s->is_luma = 0;
-} else if (!strcmp(ch_gb.buffer, "A")) {
+} else if (!av_strcasecmp(ch_gb.buffer, "A")) {
 channel_index = 3;
 } else {
 av_log(s->avctx, AV_LOG_WARNING,

___
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/exr: fix some small cosmetics nits

2020-01-22 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed Jan 22 10:42:57 
2020 +0100| [2bae3da79e71d04dd7ec79cb7d48e845b69f6e21] | committer: Paul B Mahol

avcodec/exr: fix some small cosmetics nits

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

 libavcodec/exr.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 49250dd095..1db30a1ae0 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -1183,7 +1183,7 @@ static int decode_block(AVCodecContext *avctx, void 
*tdata,
 const uint8_t * a;
 const uint8_t *rgb[3];
 
-for (c = 0; c < rgb_channel_count; c++){
+for (c = 0; c < rgb_channel_count; c++) {
 rgb[c] = channel_buffer[c];
 }
 
@@ -1414,8 +1414,8 @@ static int decode_header(EXRContext *s, AVFrame *frame)
 s->is_luma = 1;
 } else if (!av_strcasecmp(ch_gb.buffer, "B") ||
!av_strcasecmp(ch_gb.buffer, "Z") ||
-   !av_strcasecmp(ch_gb.buffer, "W")){
-   channel_index = 2;
+   !av_strcasecmp(ch_gb.buffer, "W")) {
+channel_index = 2;
 s->is_luma = 0;
 } else if (!av_strcasecmp(ch_gb.buffer, "A")) {
 channel_index = 3;
@@ -1495,7 +1495,7 @@ static int decode_header(EXRContext *s, AVFrame *frame)
 
 /* Check if all channels are set with an offset or if the channels
  * are causing an overflow  */
-if (!s->is_luma){/* if we expected to have at least 3 channels */
+if (!s->is_luma) {/* if we expected to have at least 3 channels */
 if (FFMIN3(s->channel_offsets[0],
s->channel_offsets[1],
s->channel_offsets[2]) < 0) {
@@ -1596,7 +1596,7 @@ static int decode_header(EXRContext *s, AVFrame *frame)
 s->tile_attr.level_mode = tileLevel & 0x0f;
 s->tile_attr.level_round = (tileLevel >> 4) & 0x0f;
 
-if (s->tile_attr.level_mode >= EXR_TILE_LEVEL_UNKNOWN){
+if (s->tile_attr.level_mode >= EXR_TILE_LEVEL_UNKNOWN) {
 avpriv_report_missing_feature(s->avctx, "Tile level mode %d",
   s->tile_attr.level_mode);
 ret = AVERROR_PATCHWELCOME;

___
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_v360: improve fisheye input format

2020-01-22 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed Jan 22 12:23:58 
2020 +0100| [a00fa73f47c7b201d2b82475f88f94a754b5b87c] | committer: Paul B Mahol

avfilter/vf_v360: improve fisheye input format

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

 libavfilter/vf_v360.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index c4a5926db7..2ed0acb5a7 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -2379,22 +2379,23 @@ static void xyz_to_fisheye(const V360Context *s,
const float *vec, int width, int height,
int16_t us[4][4], int16_t vs[4][4], float *du, 
float *dv)
 {
-const float h = hypotf(vec[0], vec[1]);
-const float lh= h > 0.f ? h : 1.f;
-const float theta = acosf(fabsf(vec[2])) / M_PI;
+const float phi   = -atan2f(hypotf(vec[0], vec[1]), -vec[2]) / M_PI;
+const float theta = -atan2f(vec[0], vec[1]);
 
-const float uf = (theta * ( vec[0] / lh) * s->input_mirror_modifier[0] / 
s->iflat_range[0] + 0.5f) * width;
-const float vf = (theta * (-vec[1] / lh) * s->input_mirror_modifier[1] / 
s->iflat_range[1] + 0.5f) * height;
+float uf = sinf(theta) * phi * s->input_mirror_modifier[0] / 
s->iflat_range[0];
+float vf = cosf(theta) * phi * s->input_mirror_modifier[1] / 
s->iflat_range[1];
 
-int visible, ui, vi;
+const int visible = hypotf(uf, vf) <= 0.5f;
+int ui, vi;
+
+uf = (uf + 0.5f) * width;
+vf = (vf + 0.5f) * height;
 
 ui = floorf(uf);
 vi = floorf(vf);
 
-visible = vec[2] < 0.f;
-
-*du = uf - ui;
-*dv = vf - vi;
+*du = visible ? uf - ui : 0.f;
+*dv = visible ? vf - vi : 0.f;
 
 for (int i = -1; i < 3; i++) {
 for (int j = -1; j < 3; j++) {

___
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] swscale/swscale: Fix several invalid shifts related to vChrDrop

2020-01-22 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Jan 21 22:52:19 2020 +0100| [a6ca22c11834c0ff075592e3f051d41068c407db] | 
committer: Michael Niedermayer

swscale/swscale: Fix several invalid shifts related to vChrDrop

Fixes: Invalid shifts
Fixes: #8166
Fixes: filter-crop_scale_vflip FATE-test

Reviewed-by: Andreas Rheinhardt 
Signed-off-by: Michael Niedermayer 

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

 libswscale/swscale.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 4ecfa88ff7..8436f056d4 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -295,8 +295,8 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 srcStride[2] =
 srcStride[3] = srcStride[0];
 }
-srcStride[1] <<= c->vChrDrop;
-srcStride[2] <<= c->vChrDrop;
+srcStride[1] *= 1 << c->vChrDrop;
+srcStride[2] *= 1 << c->vChrDrop;
 
 DEBUG_BUFFERS("swscale() %p[%d] %p[%d] %p[%d] %p[%d] -> %p[%d] %p[%d] 
%p[%d] %p[%d]\n",
   src[0], srcStride[0], src[1], srcStride[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] swscale/output: Fix several invalid shifts in yuv2rgb_full_1_c_template()

2020-01-22 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Jan 21 22:52:19 2020 +0100| [7b7f97532b2ac8836d8d8e3c71dd026e35ae1ca7] | 
committer: Michael Niedermayer

swscale/output: Fix several invalid shifts in yuv2rgb_full_1_c_template()

Fixes: Invalid shifts
Fixes: #8320

Reviewed-by: Andreas Rheinhardt 
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libswscale/output.c b/libswscale/output.c
index d192ea854b..a793a89443 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -2093,7 +2093,7 @@ yuv2rgb_full_1_c_template(SwsContext *c, const int16_t 
*buf0,
 if (uvalpha < 2048) {
 int A = 0; //init to silence warning
 for (i = 0; i < dstW; i++) {
-int Y = buf0[i] << 2;
+int Y = buf0[i] * 4;
 int U = (ubuf0[i] - (128<<7)) * 4;
 int V = (vbuf0[i] - (128<<7)) * 4;
 
@@ -2110,9 +2110,9 @@ yuv2rgb_full_1_c_template(SwsContext *c, const int16_t 
*buf0,
 const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
 int A = 0; //init to silence warning
 for (i = 0; i < dstW; i++) {
-int Y = buf0[i] << 2;
-int U = (ubuf0[i] + ubuf1[i] - (128<<8)) << 1;
-int V = (vbuf0[i] + vbuf1[i] - (128<<8)) << 1;
+int Y = buf0[i] * 4;
+int U = (ubuf0[i] + ubuf1[i] - (128<<8)) * 2;
+int V = (vbuf0[i] + vbuf1[i] - (128<<8)) * 2;
 
 if (hasAlpha) {
 A = (abuf0[i] + 64) >> 7;

___
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] avutil/log: Move log_level_offset_offset code from av_log() to v_log()

2020-01-22 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Jan 21 15:32:24 2020 +0100| [07b3d2c6545791a8ca6d0123c824b146e4ce] | 
committer: Michael Niedermayer

avutil/log: Move log_level_offset_offset code from av_log() to v_log()

Suggested-by: Anton
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavutil/log.c b/libavutil/log.c
index e8a0db7716..c3e65f0470 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -362,19 +362,19 @@ static void (*av_log_callback)(void*, int, const char*, 
va_list) =
 
 void av_log(void* avcl, int level, const char *fmt, ...)
 {
-AVClass* avc = avcl ? *(AVClass **) avcl : NULL;
 va_list vl;
 va_start(vl, fmt);
-if (avc && avc->version >= (50 << 16 | 15 << 8 | 2) &&
-avc->log_level_offset_offset && level >= AV_LOG_FATAL)
-level += *(int *) (((uint8_t *) avcl) + avc->log_level_offset_offset);
 av_vlog(avcl, level, fmt, vl);
 va_end(vl);
 }
 
 void av_vlog(void* avcl, int level, const char *fmt, va_list vl)
 {
+AVClass* avc = avcl ? *(AVClass **) avcl : NULL;
 void (*log_callback)(void*, int, const char*, va_list) = av_log_callback;
+if (avc && avc->version >= (50 << 16 | 15 << 8 | 2) &&
+avc->log_level_offset_offset && level >= AV_LOG_FATAL)
+level += *(int *) (((uint8_t *) avcl) + avc->log_level_offset_offset);
 if (log_callback)
 log_callback(avcl, level, fmt, vl);
 }

___
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_stack: add fill option for xstack

2020-01-22 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed Jan 22 19:11:38 
2020 +0100| [a3e67c2d2ff63254470a9bef673f98641ced639b] | committer: Paul B Mahol

avfilter/vf_stack: add fill option for xstack

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

 doc/filters.texi   |  4 
 libavfilter/vf_stack.c | 29 +
 2 files changed, 33 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index fc900cf458..40db2e5c54 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -20062,6 +20062,10 @@ a layout must be set by the user.
 @item shortest
 If set to 1, force the output to terminate when the shortest input
 terminates. Default value is 0.
+
+@item fill
+If set to valid color, all unused pixels will be filled with that color.
+By default fill is set to none, so it is disabled.
 @end table
 
 @subsection Examples
diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c
index 5bc4ccf6ed..35b7177e83 100644
--- a/libavfilter/vf_stack.c
+++ b/libavfilter/vf_stack.c
@@ -21,9 +21,11 @@
 #include "libavutil/avstring.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/opt.h"
+#include "libavutil/parseutils.h"
 #include "libavutil/pixdesc.h"
 
 #include "avfilter.h"
+#include "drawutils.h"
 #include "formats.h"
 #include "internal.h"
 #include "framesync.h"
@@ -44,6 +46,12 @@ typedef struct StackContext {
 int is_vertical;
 int is_horizontal;
 int nb_planes;
+uint8_t fillcolor[4];
+char *fillcolor_str;
+int fillcolor_enable;
+
+FFDrawContext draw;
+FFDrawColor color;
 
 StackItem *items;
 AVFrame **frames;
@@ -53,8 +61,13 @@ typedef struct StackContext {
 static int query_formats(AVFilterContext *ctx)
 {
 AVFilterFormats *pix_fmts = NULL;
+StackContext *s = ctx->priv;
 int fmt, ret;
 
+if (s->fillcolor_enable) {
+return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0));
+}
+
 for (fmt = 0; av_pix_fmt_desc_get(fmt); fmt++) {
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
 if (!(desc->flags & AV_PIX_FMT_FLAG_PAL ||
@@ -87,6 +100,12 @@ static av_cold int init(AVFilterContext *ctx)
 return AVERROR(ENOMEM);
 
 if (!strcmp(ctx->filter->name, "xstack")) {
+if (strcmp(s->fillcolor_str, "none") &&
+av_parse_color(s->fillcolor, s->fillcolor_str, -1, ctx) >= 0) {
+s->fillcolor_enable = 1;
+} else {
+s->fillcolor_enable = 0;
+}
 if (!s->layout) {
 if (s->nb_inputs == 2) {
 s->layout = av_strdup("0_0|w0_0");
@@ -159,6 +178,10 @@ static int process_frame(FFFrameSync *fs)
 out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base);
 out->sample_aspect_ratio = outlink->sample_aspect_ratio;
 
+if (s->fillcolor_enable)
+ff_fill_rectangle(&s->draw, &s->color, out->data, out->linesize,
+  0, 0, outlink->w, outlink->h);
+
 ctx->internal->execute(ctx, process_slice, out, NULL, FFMIN(s->nb_inputs, 
ff_filter_get_nb_threads(ctx)));
 
 return ff_filter_frame(outlink, out);
@@ -234,6 +257,11 @@ static int config_output(AVFilterLink *outlink)
 char *arg3, *p3, *saveptr3 = NULL;
 int inw, inh, size;
 
+if (s->fillcolor_enable) {
+ff_draw_init(&s->draw, ctx->inputs[0]->format, 0);
+ff_draw_color(&s->draw, &s->color, s->fillcolor);
+}
+
 for (i = 0; i < s->nb_inputs; i++) {
 AVFilterLink *inlink = ctx->inputs[i];
 StackItem *item = &s->items[i];
@@ -425,6 +453,7 @@ static const AVOption xstack_options[] = {
 { "inputs", "set number of inputs", OFFSET(nb_inputs), AV_OPT_TYPE_INT, 
{.i64=2}, 2, INT_MAX, .flags = FLAGS },
 { "layout", "set custom layout", OFFSET(layout), AV_OPT_TYPE_STRING, 
{.str=NULL}, 0, 0, .flags = FLAGS },
 { "shortest", "force termination when the shortest input terminates", 
OFFSET(shortest), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, .flags = FLAGS },
+{ "fill",  "set the color for unused pixels", OFFSET(fillcolor_str), 
AV_OPT_TYPE_STRING, {.str = "none"}, .flags = FLAGS },
 { 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] avcodec/hapdec: Add codec_tags list

2020-01-22 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
Dec 29 21:24:01 2019 +0100| [576bf05aa9e4d1ff682ec2513d3d5635f7ec5fb8] | 
committer: Michael Niedermayer

avcodec/hapdec: Add codec_tags list

Signed-off-by: Michael Niedermayer 

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

 libavcodec/hapdec.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c
index 8c845770cf..d23ceb5cef 100644
--- a/libavcodec/hapdec.c
+++ b/libavcodec/hapdec.c
@@ -484,4 +484,12 @@ AVCodec ff_hap_decoder = {
   AV_CODEC_CAP_DR1,
 .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE |
   FF_CODEC_CAP_INIT_CLEANUP,
+.codec_tags = (const uint32_t []){
+MKTAG('H','a','p','1'),
+MKTAG('H','a','p','5'),
+MKTAG('H','a','p','Y'),
+MKTAG('H','a','p','A'),
+MKTAG('H','a','p','M'),
+FF_CODEC_TAGS_END,
+},
 };

___
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] swscale/input: Fix several invalid shifts related to rgb2yuv constants

2020-01-22 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Jan 21 22:52:19 2020 +0100| [d48e510124d0fea24e2ec27271687c92e4428a18] | 
committer: Michael Niedermayer

swscale/input: Fix several invalid shifts related to rgb2yuv constants

Fixes: Invalid shifts
Fixes: #8140
Fixes: #8146

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libswscale/input.c b/libswscale/input.c
index 064f8da314..159f70307d 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -286,8 +286,8 @@ static av_always_inline void 
rgb16_32ToUV_c_template(int16_t *dstU,
  int gsh, int bsh, int S,
  int32_t *rgb2yuv)
 {
-const int ru   = rgb2yuv[RU_IDX] << rsh, gu = rgb2yuv[GU_IDX] << gsh, 
bu = rgb2yuv[BU_IDX] << bsh,
-  rv   = rgb2yuv[RV_IDX] << rsh, gv = rgb2yuv[GV_IDX] << gsh, 
bv = rgb2yuv[BV_IDX] << bsh;
+const int ru   = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * 
(1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
+  rv   = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * 
(1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh);
 const unsigned rnd = (256u<<((S)-1)) + (1<<(S-7));
 int i;
 
@@ -314,8 +314,8 @@ static av_always_inline void 
rgb16_32ToUV_half_c_template(int16_t *dstU,
   int gsh, int bsh, 
int S,
   int32_t *rgb2yuv)
 {
-const int ru   = rgb2yuv[RU_IDX] << rsh, gu = rgb2yuv[GU_IDX] << gsh, 
bu = rgb2yuv[BU_IDX] << bsh,
-  rv   = rgb2yuv[RV_IDX] << rsh, gv = rgb2yuv[GV_IDX] << gsh, 
bv = rgb2yuv[BV_IDX] << bsh,
+const int ru   = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * 
(1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
+  rv   = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * 
(1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh),
   maskgx   = ~(maskr | maskb);
 const unsigned rnd = (256U<<(S)) + (1<<(S-6));
 int 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/avcodec: Add codec_tags array to AVCodec

2020-01-22 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
Dec 29 21:22:05 2019 +0100| [550a6b4212ca98ccee2d633abaf408d42a3d6187] | 
committer: Michael Niedermayer

avcodec/avcodec: Add codec_tags array to AVCodec

This allows the fuzzer to target meaningfull codec tags instead
of hunting the 4gb space, which it seems to have problems with.

Suggested-by: James
Signed-off-by: Michael Niedermayer 

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

 libavcodec/avcodec.h  | 5 +
 libavcodec/internal.h | 6 ++
 2 files changed, 11 insertions(+)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 4b0e7c0853..774ed1e641 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3644,6 +3644,11 @@ typedef struct AVCodec {
  * The user can only access this field via avcodec_get_hw_config().
  */
 const struct AVCodecHWConfigInternal **hw_configs;
+
+/**
+ * List of supported codec_tags, terminated by FF_CODEC_TAGS_END.
+ */
+const uint32_t *codec_tags;
 } AVCodec;
 
 #if FF_API_CODEC_GET_SET
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 5930dd0da0..4188d1c46f 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -69,6 +69,12 @@
  */
 #define FF_CODEC_CAP_SLICE_THREAD_HAS_MF(1 << 5)
 
+/**
+ * AVCodec.codec_tags termination value
+ */
+#define FF_CODEC_TAGS_END -1
+
+
 #ifdef TRACE
 #   define ff_tlog(ctx, ...) av_log(ctx, AV_LOG_TRACE, __VA_ARGS__)
 #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] tools/target_dec_fuzzer: Use codec_tags list

2020-01-22 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
Dec 29 22:09:35 2019 +0100| [5f7727e1c9c33c26cc5caf06bfe83a96d2c107da] | 
committer: Michael Niedermayer

tools/target_dec_fuzzer: Use codec_tags list

This should make it much quicker for the fuzzer to test
real relevant codec_tags

Signed-off-by: Michael Niedermayer 

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

 tools/target_dec_fuzzer.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index 9f342ebde9..a3d784a019 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -213,6 +213,11 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 ctx->channels   = 
(unsigned)bytestream2_get_le32(&gbc) % FF_SANE_NB_CHANNELS;
 ctx->block_align= bytestream2_get_le32(&gbc) & 
0x7FFF;
 ctx->codec_tag  = bytestream2_get_le32(&gbc);
+if (c->codec_tags) {
+int n;
+for (n = 0; c->codec_tags[n] != FF_CODEC_TAGS_END; n++);
+ctx->codec_tag = c->codec_tags[ctx->codec_tag % n];
+}
 keyframes   = bytestream2_get_le64(&gbc);
 ctx->request_channel_layout = bytestream2_get_le64(&gbc);
 

___
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".