[FFmpeg-cvslog] lswr/swresample: Mention the actually supported formats when erroring out.

2017-10-28 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Thu Oct 26 
16:52:22 2017 +0200| [851829455889cfefee8d802d8428ed36effb9fcf] | committer: 
Carl Eugen Hoyos

lswr/swresample: Mention the actually supported formats when erroring out.

Fixes ticket #6779.

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

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

diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 74c96dce60..f076b6c8cf 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -240,7 +240,7 @@ av_cold int swr_init(struct SwrContext *s){
 &&s->int_sample_fmt != AV_SAMPLE_FMT_S64P
 &&s->int_sample_fmt != AV_SAMPLE_FMT_FLTP
 &&s->int_sample_fmt != AV_SAMPLE_FMT_DBLP){
-av_log(s, AV_LOG_ERROR, "Requested sample format %s is not supported 
internally, S16/S32/S64/FLT/DBL is supported\n", 
av_get_sample_fmt_name(s->int_sample_fmt));
+av_log(s, AV_LOG_ERROR, "Requested sample format %s is not supported 
internally, s16p/s32p/s64p/fltp/dblp are supported\n", 
av_get_sample_fmt_name(s->int_sample_fmt));
 return AVERROR(EINVAL);
 }
 
@@ -276,7 +276,7 @@ av_cold int swr_init(struct SwrContext *s){
 && s->int_sample_fmt != AV_SAMPLE_FMT_FLTP
 && s->int_sample_fmt != AV_SAMPLE_FMT_DBLP
 && s->resample){
-av_log(s, AV_LOG_ERROR, "Resampling only supported with internal 
s16/s32/flt/dbl\n");
+av_log(s, AV_LOG_ERROR, "Resampling only supported with internal 
s16p/s32p/fltp/dblp\n");
 ret = AVERROR(EINVAL);
 goto fail;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavfi/paletteuse: move "new" option before debugging options

2017-10-28 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Sat Oct 28 17:15:06 
2017 +0200| [5c8e904eb38605cbce217cafb86f404bee60fd55] | committer: Clément 
Bœsch

lavfi/paletteuse: move "new" option before debugging options

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

 libavfilter/vf_paletteuse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index fdd3e838b0..15dddeaa1a 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -118,6 +118,7 @@ static const AVOption paletteuse_options[] = {
 { "bayer_scale", "set scale for bayer dithering", OFFSET(bayer_scale), 
AV_OPT_TYPE_INT, {.i64=2}, 0, 5, FLAGS },
 { "diff_mode",   "set frame difference mode", OFFSET(diff_mode),   
AV_OPT_TYPE_INT, {.i64=DIFF_MODE_NONE}, 0, NB_DIFF_MODE-1, FLAGS, "diff_mode" },
 { "rectangle", "process smallest different rectangle", 0, 
AV_OPT_TYPE_CONST, {.i64=DIFF_MODE_RECTANGLE}, INT_MIN, INT_MAX, FLAGS, 
"diff_mode" },
+{ "new", "take new palette for each output frame", OFFSET(new), 
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
 { "alpha_threshold", "set the alpha threshold for transparency", 
OFFSET(trans_thresh), AV_OPT_TYPE_INT, {.i64=128}, 0, 255 },
 
 /* following are the debug options, not part of the official API */
@@ -128,7 +129,6 @@ static const AVOption paletteuse_options[] = {
 { "bruteforce","brute-force into the palette", 0, 
AV_OPT_TYPE_CONST, {.i64=COLOR_SEARCH_BRUTEFORCE},INT_MIN, INT_MAX, FLAGS, 
"search" },
 { "mean_err", "compute and print mean error", OFFSET(calc_mean_err), 
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
 { "debug_accuracy", "test color search accuracy", OFFSET(debug_accuracy), 
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
-{ "new", "take new palette for each output frame", OFFSET(new), 
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
 { NULL }
 };
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavfi/paletteuse: fix to support transparency

2017-10-28 Thread Bjorn Roche
ffmpeg | branch: master | Bjorn Roche  | Mon Oct 23 19:12:57 
2017 -0400| [aba926e7d654b6dfab680130c92e571ee9a956f0] | committer: Clément 
Bœsch

lavfi/paletteuse: fix to support transparency

This patch enables paletteuse to identify the transparency in incoming
video and tag transparent pixels on outgoing video with the correct
index from the palette.

This requires tracking the transparency index in the palette,
establishing an alpha threshold below which a pixel is considered
transparent and above which the pixel is considered opaque, and
additional changes to track the alpha value throughout the conversion
process.

This change is a partial fix for https://trac.ffmpeg.org/ticket/4443
However, animated GIFs are still output incorrectly due to a bug
in gif optimization which does not correctly handle transparency.

Signed-off-by: Clément Bœsch 

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

 doc/filters.texi|   7 ++
 libavfilter/vf_paletteuse.c | 195 
 2 files changed, 131 insertions(+), 71 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index ce7e053194..64e84d9b45 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -11545,6 +11545,13 @@ Default is @var{none}.
 
 @item new
 Take new palette for each output frame.
+
+@item alpha_threshold
+Sets the alpha threshold for transparency. Alpha values above this threshold
+will be treated as completely opaque, and values below this threshold will be
+treated as completely transparent.
+
+The option must be an integer value in the range [0,255]. Default is @var{128}.
 @end table
 
 @subsection Examples
diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index 79a0672891..fdd3e838b0 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -56,7 +56,7 @@ enum diff_mode {
 };
 
 struct color_node {
-uint8_t val[3];
+uint8_t val[4];
 uint8_t palette_id;
 int split;
 int left_id, right_id;
@@ -86,6 +86,8 @@ typedef struct PaletteUseContext {
 struct cache_node cache[CACHE_SIZE];/* lookup cache */
 struct color_node map[AVPALETTE_COUNT]; /* 3D-Tree (KD-Tree with K=3) for 
reverse colormap */
 uint32_t palette[AVPALETTE_COUNT];
+int transparency_index; /* index in the palette of transparency. -1 if 
there is no transparency in the palette. */
+int trans_thresh;
 int palette_loaded;
 int dither;
 int new;
@@ -116,6 +118,7 @@ static const AVOption paletteuse_options[] = {
 { "bayer_scale", "set scale for bayer dithering", OFFSET(bayer_scale), 
AV_OPT_TYPE_INT, {.i64=2}, 0, 5, FLAGS },
 { "diff_mode",   "set frame difference mode", OFFSET(diff_mode),   
AV_OPT_TYPE_INT, {.i64=DIFF_MODE_NONE}, 0, NB_DIFF_MODE-1, FLAGS, "diff_mode" },
 { "rectangle", "process smallest different rectangle", 0, 
AV_OPT_TYPE_CONST, {.i64=DIFF_MODE_RECTANGLE}, INT_MIN, INT_MAX, FLAGS, 
"diff_mode" },
+{ "alpha_threshold", "set the alpha threshold for transparency", 
OFFSET(trans_thresh), AV_OPT_TYPE_INT, {.i64=128}, 0, 255 },
 
 /* following are the debug options, not part of the official API */
 { "debug_kdtree", "save Graphviz graph of the kdtree in specified file", 
OFFSET(dot_filename), AV_OPT_TYPE_STRING, {.str=NULL}, CHAR_MIN, CHAR_MAX, 
FLAGS },
@@ -157,34 +160,43 @@ static int query_formats(AVFilterContext *ctx)
 
 static av_always_inline int dither_color(uint32_t px, int er, int eg, int eb, 
int scale, int shift)
 {
-return av_clip_uint8((px >> 16 & 0xff) + ((er * scale) / (1<> 24  ) << 24
+ | av_clip_uint8((px >> 16 & 0xff) + ((er * scale) / (1<>  8 & 0xff) + ((eg * scale) / (1<= trans_thresh && c2[0] >= trans_thresh) {
+return dr*dr + dg*dg + db*db;
+} else {
+return 255*255 + 255*255 + 255*255;
+}
 }
 
-static av_always_inline uint8_t colormap_nearest_bruteforce(const uint32_t 
*palette, const uint8_t *rgb)
+static av_always_inline uint8_t colormap_nearest_bruteforce(const uint32_t 
*palette, const uint8_t *argb, const int trans_thresh)
 {
 int i, pal_id = -1, min_dist = INT_MAX;
 
 for (i = 0; i < AVPALETTE_COUNT; i++) {
 const uint32_t c = palette[i];
 
-if ((c & 0xff00) == 0xff00) { // ignore transparent entry
-const uint8_t palrgb[] = {
+if (c >> 24 >= trans_thresh) { // ignore transparent entry
+const uint8_t palargb[] = {
+palette[i]>>24 & 0xff,
 palette[i]>>16 & 0xff,
 palette[i]>> 8 & 0xff,
 palette[i] & 0xff,
 };
-const int d = diff(palrgb, rgb);
+const int d = diff(palargb, argb, trans_thresh);
 if (d < min_dist) {
 pal_id = i;
 min_dist = d;
@@ -203,13 +215,14 @@ struct nearest_color {
 static void colormap_nearest_node(const struct c

[FFmpeg-cvslog] lavfi/paletteuse: simplify color get function prototypes

2017-10-28 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Sat Oct 28 17:39:48 
2017 +0200| [33e226f84d599bfd30eaf0687c59b6ad5e63022c] | committer: Clément 
Bœsch

lavfi/paletteuse: simplify color get function prototypes

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

 libavfilter/vf_paletteuse.c | 43 +++
 1 file changed, 15 insertions(+), 28 deletions(-)

diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index 15dddeaa1a..73d22a5b95 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -338,12 +338,8 @@ end:
  * Note: a, r, g, and b are the components of color, but are passed as well to 
avoid
  * recomputing them (they are generally computed by the caller for other uses).
  */
-static av_always_inline int color_get(struct cache_node *cache, uint32_t color,
+static av_always_inline int color_get(PaletteUseContext *s, uint32_t color,
   uint8_t a, uint8_t r, uint8_t g, uint8_t 
b,
-  int transparency_index,
-  int trans_thresh,
-  const struct color_node *map,
-  const uint32_t *palette,
   const enum color_search_method 
search_method)
 {
 int i;
@@ -352,12 +348,12 @@ static av_always_inline int color_get(struct cache_node 
*cache, uint32_t color,
 const uint8_t ghash = g & ((1= 0) {
-return transparency_index;
+if (a < s->trans_thresh && s->transparency_index >= 0) {
+return s->transparency_index;
 }
 
 for (i = 0; i < node->nb_entries; i++) {
@@ -371,25 +367,21 @@ static av_always_inline int color_get(struct cache_node 
*cache, uint32_t color,
 if (!e)
 return AVERROR(ENOMEM);
 e->color = color;
-e->pal_entry = COLORMAP_NEAREST(search_method, palette, map, argb_elts, 
trans_thresh);
+e->pal_entry = COLORMAP_NEAREST(search_method, s->palette, s->map, 
argb_elts, s->trans_thresh);
 
 return e->pal_entry;
 }
 
-static av_always_inline int get_dst_color_err(struct cache_node *cache,
-  uint32_t c, const struct 
color_node *map,
-  const uint32_t *palette,
-  int transparency_index,
-  int trans_thresh,
-  int *er, int *eg, int *eb,
+static av_always_inline int get_dst_color_err(PaletteUseContext *s,
+  uint32_t c, int *er, int *eg, 
int *eb,
   const enum color_search_method 
search_method)
 {
 const uint8_t a = c >> 24 & 0xff;
 const uint8_t r = c >> 16 & 0xff;
 const uint8_t g = c >>  8 & 0xff;
 const uint8_t b = c   & 0xff;
-const int dstx = color_get(cache, c, a, r, g, b, transparency_index, 
trans_thresh, map, palette, search_method);
-const uint32_t dstc = palette[dstx];
+const int dstx = color_get(s, c, a, r, g, b, search_method);
+const uint32_t dstc = s->palette[dstx];
 *er = r - (dstc >> 16 & 0xff);
 *eg = g - (dstc >>  8 & 0xff);
 *eb = b - (dstc   & 0xff);
@@ -402,15 +394,10 @@ static av_always_inline int set_frame(PaletteUseContext 
*s, AVFrame *out, AVFram
   const enum color_search_method 
search_method)
 {
 int x, y;
-const struct color_node *map = s->map;
-struct cache_node *cache = s->cache;
-const uint32_t *palette = s->palette;
 const int src_linesize = in ->linesize[0] >> 2;
 const int dst_linesize = out->linesize[0];
 uint32_t *src = ((uint32_t *)in ->data[0]) + y_start*src_linesize;
 uint8_t  *dst =  out->data[0]  + y_start*dst_linesize;
-int transparency_index = s->transparency_index;
-int trans_thresh = s->trans_thresh;
 
 w += x_start;
 h += y_start;
@@ -428,7 +415,7 @@ static av_always_inline int set_frame(PaletteUseContext *s, 
AVFrame *out, AVFram
 const uint8_t r = av_clip_uint8(r8 + d);
 const uint8_t g = av_clip_uint8(g8 + d);
 const uint8_t b = av_clip_uint8(b8 + d);
-const int color = color_get(cache, src[x], a8, r, g, b, 
transparency_index, trans_thresh, map, palette, search_method);
+const int color = color_get(s, src[x], a8, r, g, b, 
search_method);
 
 if (color < 0)
 return color;
@@ -436,7 +423,7 @@ static av_always_inline int set_frame(PaletteUseContext *s, 
AVFrame *out, AVFram
 
 } else if (dither == DITHERING_HECKBERT) {
 const int right = x < w

[FFmpeg-cvslog] avcodec: add MagicYUV encoder

2017-10-28 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Jul  8 19:14:05 
2017 +0200| [3729ae659fb21b0509be7f19f9f41a4729f30347] | committer: Paul B Mahol

avcodec: add MagicYUV encoder

Signed-off-by: Paul B Mahol 

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

 Changelog|   1 +
 doc/general.texi |   2 +-
 libavcodec/Makefile  |   1 +
 libavcodec/allcodecs.c   |   2 +-
 libavcodec/magicyuvenc.c | 558 +++
 5 files changed, 562 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 6592d868da..8c45b2946d 100644
--- a/Changelog
+++ b/Changelog
@@ -6,6 +6,7 @@ version :
 - Dropped support for OpenJPEG versions 2.0 and below. Using OpenJPEG now
   requires 2.1 (or later) and pkg-config.
 - VDA dropped (use VideoToolbox instead)
+- MagicYUV encoder
 
 
 version 3.4:
diff --git a/doc/general.texi b/doc/general.texi
index a40400612e..56f315d67b 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -792,7 +792,7 @@ following image formats are supported:
 @item LucasArts SANM/Smush   @tab @tab  X
 @tab Used in LucasArts games / SMUSH animations.
 @item lossless MJPEG @tab  X  @tab  X
-@item MagicYUV Video @tab @tab  X
+@item MagicYUV Video @tab  X  @tab  X
 @item Mandsoft Screen Capture Codec  @tab @tab  X
 @item Microsoft ATC Screen   @tab @tab  X
 @tab Also known as Microsoft Screen 3.
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 8c878c3699..e4e7a4adbf 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -397,6 +397,7 @@ OBJS-$(CONFIG_M101_DECODER)+= m101.o
 OBJS-$(CONFIG_MACE3_DECODER)   += mace.o
 OBJS-$(CONFIG_MACE6_DECODER)   += mace.o
 OBJS-$(CONFIG_MAGICYUV_DECODER)+= magicyuv.o
+OBJS-$(CONFIG_MAGICYUV_ENCODER)+= magicyuvenc.o
 OBJS-$(CONFIG_MDEC_DECODER)+= mdec.o mpeg12.o mpeg12data.o
 OBJS-$(CONFIG_METASOUND_DECODER)   += metasound.o metasound_data.o \
   twinvq.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 83691267aa..98655ddd7c 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -240,7 +240,7 @@ static void register_all(void)
 REGISTER_ENCODER(LJPEG, ljpeg);
 REGISTER_DECODER(LOCO,  loco);
 REGISTER_DECODER(M101,  m101);
-REGISTER_DECODER(MAGICYUV,  magicyuv);
+REGISTER_ENCDEC (MAGICYUV,  magicyuv);
 REGISTER_DECODER(MDEC,  mdec);
 REGISTER_DECODER(MIMIC, mimic);
 REGISTER_ENCDEC (MJPEG, mjpeg);
diff --git a/libavcodec/magicyuvenc.c b/libavcodec/magicyuvenc.c
new file mode 100644
index 00..f948b03e4b
--- /dev/null
+++ b/libavcodec/magicyuvenc.c
@@ -0,0 +1,558 @@
+/*
+ * MagicYUV encoder
+ * Copyright (c) 2017 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 
+#include 
+
+#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/qsort.h"
+
+#include "avcodec.h"
+#include "bytestream.h"
+#include "put_bits.h"
+#include "internal.h"
+#include "thread.h"
+#include "lossless_videoencdsp.h"
+
+typedef enum Prediction {
+LEFT = 1,
+GRADIENT,
+MEDIAN,
+} Prediction;
+
+typedef struct HuffEntry {
+uint8_t  sym;
+uint8_t  len;
+uint32_t code;
+} HuffEntry;
+
+typedef struct PTable {
+int value;  ///< input value
+int64_t prob;   ///< number of occurences of this value in input
+} PTable;
+
+typedef struct MagicYUVContext {
+const AVClass   *class;
+int  frame_pred;
+PutBitContextpb;
+int  planes;
+uint8_t  format;
+AVFrame *p;
+int  max;
+int  slice_height;
+int  nb_slices;
+int  correlate;
+int  hshift[4];
+int  vshift[4];
+uint8_t *slices[4];
+unsigned slice_pos[4];
+unsigned tables_size;
+HuffEntryhe[4][256];
+LLVidEncDSPContext   llvidencdsp;
+void (*predict)(s

[FFmpeg-cvslog] lavfi/paletteuse: fix debug_accuracy after aba926e7d

2017-10-28 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Sat Oct 28 17:59:47 
2017 +0200| [3d547c19c211ac61771629e6bcdfbdba393a76ae] | committer: Clément 
Bœsch

lavfi/paletteuse: fix debug_accuracy after aba926e7d

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

 libavfilter/vf_paletteuse.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index 73d22a5b95..19017ac7b7 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -558,16 +558,16 @@ static int debug_accuracy(const struct color_node *node, 
const uint32_t *palette
 for (r = 0; r < 256; r++) {
 for (g = 0; g < 256; g++) {
 for (b = 0; b < 256; b++) {
-const uint8_t rgb[] = {r, g, b};
-const int r1 = COLORMAP_NEAREST(search_method, palette, node, 
rgb, trans_thresh);
-const int r2 = colormap_nearest_bruteforce(palette, rgb, 
trans_thresh);
+const uint8_t argb[] = {0xff, r, g, b};
+const int r1 = COLORMAP_NEAREST(search_method, palette, node, 
argb, trans_thresh);
+const int r2 = colormap_nearest_bruteforce(palette, argb, 
trans_thresh);
 if (r1 != r2) {
 const uint32_t c1 = palette[r1];
 const uint32_t c2 = palette[r2];
-const uint8_t palrgb1[] = { c1>>16 & 0xff, c1>> 8 & 0xff, 
c1 & 0xff };
-const uint8_t palrgb2[] = { c2>>16 & 0xff, c2>> 8 & 0xff, 
c2 & 0xff };
-const int d1 = diff(palrgb1, rgb, trans_thresh);
-const int d2 = diff(palrgb2, rgb, trans_thresh);
+const uint8_t palargb1[] = { 0xff, c1>>16 & 0xff, c1>> 8 & 
0xff, c1 & 0xff };
+const uint8_t palargb2[] = { 0xff, c2>>16 & 0xff, c2>> 8 & 
0xff, c2 & 0xff };
+const int d1 = diff(palargb1, argb, trans_thresh);
+const int d2 = diff(palargb2, argb, trans_thresh);
 if (d1 != d2) {
 av_log(NULL, AV_LOG_ERROR,
"/!\\ %02X%02X%02X: %d ! %d (%06"PRIX32" ! 
%06"PRIX32") / dist: %d ! %d\n",

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavfi/paletteuse: fix debug_mean_error after aba926e7d

2017-10-28 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Sat Oct 28 18:01:41 
2017 +0200| [157d08e971f43dd17ba2c3618e31c76fa938efe2] | committer: Clément 
Bœsch

lavfi/paletteuse: fix debug_mean_error after aba926e7d

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

 libavfilter/vf_paletteuse.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index 19017ac7b7..84c31de3be 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -787,9 +787,9 @@ static void debug_mean_error(PaletteUseContext *s, const 
AVFrame *in1,
 for (x = 0; x < in1->width; x++) {
 const uint32_t c1 = src1[x];
 const uint32_t c2 = palette[src2[x]];
-const uint8_t rgb1[] = {c1 >> 16 & 0xff, c1 >> 8 & 0xff, c1 & 
0xff};
-const uint8_t rgb2[] = {c2 >> 16 & 0xff, c2 >> 8 & 0xff, c2 & 
0xff};
-mean_err += diff(rgb1, rgb2, s->trans_thresh);
+const uint8_t argb1[] = {0xff, c1 >> 16 & 0xff, c1 >> 8 & 0xff, c1 
& 0xff};
+const uint8_t argb2[] = {0xff, c2 >> 16 & 0xff, c2 >> 8 & 0xff, c2 
& 0xff};
+mean_err += diff(argb1, argb2, s->trans_thresh);
 }
 src1 += src1_linesize;
 src2 += src2_linesize;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] configure: add missing llvidencdsp dependency to MagicYUV encoder

2017-10-28 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Oct 28 13:14:51 
2017 -0300| [93a1aac44198a7d27e427090e3749aa923a78eaa] | committer: James Almer

configure: add missing llvidencdsp dependency to MagicYUV encoder

Signed-off-by: James Almer 

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

 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 0e1ccaac58..2f259996ae 100755
--- a/configure
+++ b/configure
@@ -2518,6 +2518,7 @@ jv_decoder_select="blockdsp"
 lagarith_decoder_select="llviddsp"
 ljpeg_encoder_select="aandcttables idctdsp jpegtables mpegvideoenc"
 magicyuv_decoder_select="llviddsp"
+magicyuv_encoder_select="llvidencdsp"
 mdec_decoder_select="blockdsp idctdsp mpegvideo"
 metasound_decoder_select="lsp mdct sinewin"
 mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec: bump minor after addition of MagicYUV encoder

2017-10-28 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Oct 28 13:14:47 
2017 -0300| [26ad6df1ced738e3443b9105b6b434ac18d1deac] | committer: James Almer

avcodec: bump minor after addition of MagicYUV encoder

Signed-off-by: James Almer 

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

 libavcodec/version.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/version.h b/libavcodec/version.h
index 226da1935f..6c0d7a8328 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,8 +28,8 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  58
-#define LIBAVCODEC_VERSION_MINOR   0
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MINOR   1
+#define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavfi/paletteuse: fix debug_kdtree after aba926e7d

2017-10-28 Thread Clément Bœsch
ffmpeg | branch: master | Clément Bœsch  | Sat Oct 28 18:49:30 
2017 +0200| [1d348dd03fb485b9c62904734cde11a2f4813f37] | committer: Clément 
Bœsch

lavfi/paletteuse: fix debug_kdtree after aba926e7d

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

 libavfilter/vf_paletteuse.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index 84c31de3be..ed80ab04d5 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -506,15 +506,16 @@ static void disp_node(AVBPrint *buf,
 const uint32_t fontcolor = node->val[1] > 0x50 &&
node->val[2] > 0x50 &&
node->val[3] > 0x50 ? 0 : 0xff;
+const int rgb_comp = node->split - 1;
 av_bprintf(buf, "%*cnode%d ["
"label=\"%c%02X%c%02X%c%02X%c\" "
"fillcolor=\"#%02x%02x%02x\" "
"fontcolor=\"#%06"PRIX32"\"]\n",
depth*INDENT, ' ', node->palette_id,
-   "[  "[node->split], node->val[1],
-   "][ "[node->split], node->val[2],
-   " ]["[node->split], node->val[3],
-   "  ]"[node->split],
+   "[  "[rgb_comp], node->val[1],
+   "][ "[rgb_comp], node->val[2],
+   " ]["[rgb_comp], node->val[3],
+   "  ]"[rgb_comp],
node->val[1], node->val[2], node->val[3],
fontcolor);
 if (parent_id != -1)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] golomb: Simplify get_ur_golomb_jpegls

2017-10-28 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Tue Apr 11 
12:11:59 2017 +0200| [19c5fa9eea47d45b5eedce3bff4edeaf83fb3942] | committer: 
Luca Barbato

golomb: Simplify get_ur_golomb_jpegls

The loop always consumes the bit read and the new bitstream reader
can read 0 bits just fine.

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

 libavcodec/golomb.h | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index 648f9243fc..cff7e42e51 100644
--- a/libavcodec/golomb.h
+++ b/libavcodec/golomb.h
@@ -290,16 +290,12 @@ static inline int get_ur_golomb_jpegls(BitstreamContext 
*bc, int k, int limit,
 return buf;
 } else {
 int i;
-for (i = 0; i < limit && bitstream_peek(bc, 1) == 0 && 
bitstream_bits_left(bc) > 0; i++)
-bitstream_skip(bc, 1);
-bitstream_skip(bc, 1);
+for (i = 0;
+ i < limit && bitstream_read_bit(bc) == 0 && 
bitstream_bits_left(bc) > 0;
+ i++);
 
 if (i < limit - 1) {
-if (k) {
-buf = bitstream_read(bc, k);
-} else {
-buf = 0;
-}
+buf = bitstream_read(bc, k);
 
 return buf + (i << k);
 } else if (i == limit - 1) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat: Free the internal codec context at the end

2017-10-28 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Wed Apr 12 
01:46:30 2017 +0200| [9e4a5eb51b9f3b2bff0ef08e0074b7fe4893075d] | committer: 
Luca Barbato

avformat: Free the internal codec context at the end

Avoid a use after free in avformat_find_stream_info.

CC: libav-sta...@libav.org

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

 libavformat/utils.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8fa89eb790..eaba473914 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2466,11 +2466,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
 count++;
 }
 
-// close codecs which were opened in try_decode_frame()
-for (i = 0; i < ic->nb_streams; i++) {
-st = ic->streams[i];
-avcodec_close(st->internal->avctx);
-}
 for (i = 0; i < ic->nb_streams; i++) {
 st = ic->streams[i];
 avctx = st->internal->avctx;
@@ -2570,6 +2565,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
 find_stream_info_err:
 for (i = 0; i < ic->nb_streams; i++) {
+avcodec_close(ic->streams[i]->internal->avctx);
 av_freep(&ic->streams[i]->info);
 av_bsf_free(&ic->streams[i]->internal->extract_extradata.bsf);
 av_packet_free(&ic->streams[i]->internal->extract_extradata.pkt);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '19c5fa9eea47d45b5eedce3bff4edeaf83fb3942'

2017-10-28 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Oct 28 14:01:05 
2017 -0300| [f4bda7e305385d080e233a79a578c0db926aa10d] | committer: James Almer

Merge commit '19c5fa9eea47d45b5eedce3bff4edeaf83fb3942'

* commit '19c5fa9eea47d45b5eedce3bff4edeaf83fb3942':
  golomb: Simplify get_ur_golomb_jpegls

This commit is a noop, see
https://ffmpeg.org/pipermail/ffmpeg-devel/2017-April/209609.html

Merged-by: James Almer 

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



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '9e4a5eb51b9f3b2bff0ef08e0074b7fe4893075d'

2017-10-28 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Oct 28 14:01:25 
2017 -0300| [1e5669457f6072f6bfb0e15aaeb958b44a742833] | committer: James Almer

Merge commit '9e4a5eb51b9f3b2bff0ef08e0074b7fe4893075d'

* commit '9e4a5eb51b9f3b2bff0ef08e0074b7fe4893075d':
  avformat: Free the internal codec context at the end

Merged-by: James Almer 

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

 libavformat/utils.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 6dbc48d54d..0ab2f61eb0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3875,12 +3875,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
 }
 }
 
-// close codecs which were opened in try_decode_frame()
-for (i = 0; i < ic->nb_streams; i++) {
-st = ic->streams[i];
-avcodec_close(st->internal->avctx);
-}
-
 ff_rfps_calculate(ic);
 
 for (i = 0; i < ic->nb_streams; i++) {
@@ -4071,6 +4065,7 @@ find_stream_info_err:
 st = ic->streams[i];
 if (st->info)
 av_freep(&st->info->duration_error);
+avcodec_close(ic->streams[i]->internal->avctx);
 av_freep(&ic->streams[i]->info);
 av_bsf_free(&ic->streams[i]->internal->extract_extradata.bsf);
 av_packet_free(&ic->streams[i]->internal->extract_extradata.pkt);


==

diff --cc libavformat/utils.c
index 6dbc48d54d,eaba473914..0ab2f61eb0
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@@ -3824,65 -2466,6 +3824,59 @@@ FF_ENABLE_DEPRECATION_WARNING
  count++;
  }
  
 +if (eof_reached) {
 +int stream_index;
 +for (stream_index = 0; stream_index < ic->nb_streams; stream_index++) 
{
 +st = ic->streams[stream_index];
 +avctx = st->internal->avctx;
 +if (!has_codec_parameters(st, NULL)) {
 +const AVCodec *codec = find_probe_decoder(ic, st, 
st->codecpar->codec_id);
 +if (codec && !avctx->codec) {
 +AVDictionary *opts = NULL;
 +if (ic->codec_whitelist)
 +av_dict_set(&opts, "codec_whitelist", 
ic->codec_whitelist, 0);
 +if (avcodec_open2(avctx, codec, (options && stream_index 
< orig_nb_streams) ? &options[stream_index] : &opts) < 0)
 +av_log(ic, AV_LOG_WARNING,
 +   "Failed to open codec in %s\n",__FUNCTION__);
 +av_dict_free(&opts);
 +}
 +}
 +
 +// EOF already reached while reading the stream above.
 +// So continue with reoordering DTS with whatever delay we have.
 +if (ic->internal->packet_buffer && 
!has_decode_delay_been_guessed(st)) {
 +update_dts_from_pts(ic, stream_index, 
ic->internal->packet_buffer);
 +}
 +}
 +}
 +
 +if (flush_codecs) {
 +AVPacket empty_pkt = { 0 };
 +int err = 0;
 +av_init_packet(&empty_pkt);
 +
 +for (i = 0; i < ic->nb_streams; i++) {
 +
 +st = ic->streams[i];
 +
 +/* flush the decoders */
 +if (st->info->found_decoder == 1) {
 +do {
 +err = try_decode_frame(ic, st, &empty_pkt,
 +(options && i < orig_nb_streams)
 +? &options[i] : NULL);
 +} while (err > 0 && !has_codec_parameters(st, NULL));
 +
 +if (err < 0) {
 +av_log(ic, AV_LOG_INFO,
 +"decoding for stream %d failed\n", st->index);
 +}
 +}
 +}
 +}
 +
- // close codecs which were opened in try_decode_frame()
- for (i = 0; i < ic->nb_streams; i++) {
- st = ic->streams[i];
- avcodec_close(st->internal->avctx);
- }
- 
 +ff_rfps_calculate(ic);
 +
  for (i = 0; i < ic->nb_streams; i++) {
  st = ic->streams[i];
  avctx = st->internal->avctx;
@@@ -4066,11 -2561,11 +4060,12 @@@ FF_ENABLE_DEPRECATION_WARNING
  st->internal->avctx_inited = 0;
  }
  
 -estimate_timings(ic, old_offset);
 -
  find_stream_info_err:
  for (i = 0; i < ic->nb_streams; i++) {
 +st = ic->streams[i];
 +if (st->info)
 +av_freep(&st->info->duration_error);
+ avcodec_close(ic->streams[i]->internal->avctx);
  av_freep(&ic->streams[i]->info);
  av_bsf_free(&ic->streams[i]->internal->extract_extradata.bsf);
  av_packet_free(&ic->streams[i]->internal->extract_extradata.pkt);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] swscale: Add input support for gbrap10 pixel format

2017-10-28 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Jun 10 13:01:26 
2016 +0200| [f6a9c20a52d67df2cd1cdbe3d2c58f33b7d4] | committer: Luca Barbato

swscale: Add input support for gbrap10 pixel format

Signed-off-by: Paul B Mahol 

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

 libswscale/input.c | 16 
 libswscale/utils.c |  3 +++
 2 files changed, 19 insertions(+)

diff --git a/libswscale/input.c b/libswscale/input.c
index d8560a1f2b..761776c1ce 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -699,11 +699,21 @@ static void planar_rgb10le_to_y(uint8_t *dst, const 
uint8_t *src[4], int w)
 planar_rgb16_to_y(dst, src, w, 10, 0);
 }
 
+static void planar_rgb10le_to_a(uint8_t *dst, const uint8_t *src[4], int w)
+{
+planar_rgb16_to_a(dst, src, w, 10, 0);
+}
+
 static void planar_rgb10be_to_y(uint8_t *dst, const uint8_t *src[4], int w)
 {
 planar_rgb16_to_y(dst, src, w, 10, 1);
 }
 
+static void planar_rgb10be_to_a(uint8_t *dst, const uint8_t *src[4], int w)
+{
+planar_rgb16_to_a(dst, src, w, 10, 1);
+}
+
 static void planar_rgb12le_to_y(uint8_t *dst, const uint8_t *src[4], int w)
 {
 planar_rgb16_to_y(dst, src, w, 12, 0);
@@ -842,6 +852,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_GBRP9LE:
 c->readChrPlanar = planar_rgb9le_to_uv;
 break;
+case AV_PIX_FMT_GBRAP10LE:
 case AV_PIX_FMT_GBRP10LE:
 c->readChrPlanar = planar_rgb10le_to_uv;
 break;
@@ -856,6 +867,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_GBRP9BE:
 c->readChrPlanar = planar_rgb9be_to_uv;
 break;
+case AV_PIX_FMT_GBRAP10BE:
 case AV_PIX_FMT_GBRP10BE:
 c->readChrPlanar = planar_rgb10be_to_uv;
 break;
@@ -1073,6 +1085,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_GBRP9LE:
 c->readLumPlanar = planar_rgb9le_to_y;
 break;
+case AV_PIX_FMT_GBRAP10LE:
+c->readAlpPlanar = planar_rgb10le_to_a;
 case AV_PIX_FMT_GBRP10LE:
 c->readLumPlanar = planar_rgb10le_to_y;
 break;
@@ -1089,6 +1103,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_GBRP9BE:
 c->readLumPlanar = planar_rgb9be_to_y;
 break;
+case AV_PIX_FMT_GBRAP10BE:
+c->readAlpPlanar = planar_rgb10be_to_a;
 case AV_PIX_FMT_GBRP10BE:
 c->readLumPlanar = planar_rgb10be_to_y;
 break;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 6034b70465..3a5c779ea3 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -191,6 +191,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
 [AV_PIX_FMT_GBRP16LE]= { 1, 0 },
 [AV_PIX_FMT_GBRP16BE]= { 1, 0 },
 [AV_PIX_FMT_GBRAP]   = { 1, 1 },
+[AV_PIX_FMT_GBRAP10LE]   = { 1, 0 },
+[AV_PIX_FMT_GBRAP10BE]   = { 1, 0 },
 [AV_PIX_FMT_GBRAP12LE]   = { 1, 1 },
 [AV_PIX_FMT_GBRAP12BE]   = { 1, 1 },
 [AV_PIX_FMT_GBRAP16LE]   = { 1, 0 },
@@ -1021,6 +1023,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter 
*srcFilter,
 srcFormat != AV_PIX_FMT_RGB4_BYTE && srcFormat != AV_PIX_FMT_BGR4_BYTE 
&&
 srcFormat != AV_PIX_FMT_GBRP9BE   && srcFormat != AV_PIX_FMT_GBRP9LE  
&&
 srcFormat != AV_PIX_FMT_GBRP10BE  && srcFormat != AV_PIX_FMT_GBRP10LE 
&&
+srcFormat != AV_PIX_FMT_GBRAP10BE && srcFormat != AV_PIX_FMT_GBRAP10LE 
&&
 srcFormat != AV_PIX_FMT_GBRP12BE  && srcFormat != AV_PIX_FMT_GBRP12LE 
&&
 srcFormat != AV_PIX_FMT_GBRP16BE  && srcFormat != AV_PIX_FMT_GBRP16LE 
&&
 ((dstW >> c->chrDstHSubSample) <= (srcW >> 1) ||

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] pixfmt: Add gbrap10 pixel format

2017-10-28 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Jun 10 12:48:09 
2016 +0200| [030c8be7a2c0f3ce0440ef37fe5207c0288b8c9e] | committer: Luca Barbato

pixfmt: Add gbrap10 pixel format

Signed-off-by: Paul B Mahol 
Signed-off-by: Luca Barbato 

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

 libavutil/pixdesc.c | 28 
 libavutil/pixfmt.h  |  4 
 2 files changed, 32 insertions(+)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 815e084155..fb2e1a12f3 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -1683,6 +1683,34 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 },
 .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
 },
+[AV_PIX_FMT_GBRAP10LE] = {
+.name = "gbrap10le",
+.nb_components = 4,
+.log2_chroma_w = 0,
+.log2_chroma_h = 0,
+.comp = {
+{ 2, 2, 0, 0, 10, 1, 9, 1 },   /* R */
+{ 0, 2, 0, 0, 10, 1, 9, 1 },   /* G */
+{ 1, 2, 0, 0, 10, 1, 9, 1 },   /* B */
+{ 3, 2, 0, 0, 10, 1, 9, 1 },   /* A */
+},
+.flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB |
+ AV_PIX_FMT_FLAG_ALPHA,
+},
+[AV_PIX_FMT_GBRAP10BE] = {
+.name = "gbrap10be",
+.nb_components = 4,
+.log2_chroma_w = 0,
+.log2_chroma_h = 0,
+.comp = {
+{ 2, 2, 0, 0, 10, 1, 9, 1 },   /* R */
+{ 0, 2, 0, 0, 10, 1, 9, 1 },   /* G */
+{ 1, 2, 0, 0, 10, 1, 9, 1 },   /* B */
+{ 3, 2, 0, 0, 10, 1, 9, 1 },   /* A */
+},
+.flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
+ AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
+},
 [AV_PIX_FMT_GBRAP12LE] = {
 .name = "gbrap12le",
 .nb_components = 4,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 3c670fc9d4..fc1969ef12 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -234,6 +234,9 @@ enum AVPixelFormat {
 AV_PIX_FMT_GRAY12BE,  ///

[FFmpeg-cvslog] utvideodec: Support UQY2

2017-10-28 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Apr 10 11:08:44 
2017 +0200| [c5230955640cb65101a5f8add83abee0410583eb] | committer: Luca Barbato

utvideodec: Support UQY2

Signed-off-by: Luca Barbato 

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

 libavcodec/utvideo.c|   6 ++
 libavcodec/utvideo.h|   4 +-
 libavcodec/utvideodec.c | 282 +---
 libavformat/riff.c  |   1 +
 4 files changed, 253 insertions(+), 40 deletions(-)

diff --git a/libavcodec/utvideo.c b/libavcodec/utvideo.c
index 35e927ca2d..556b4de602 100644
--- a/libavcodec/utvideo.c
+++ b/libavcodec/utvideo.c
@@ -39,3 +39,9 @@ int ff_ut_huff_cmp_len(const void *a, const void *b)
 const HuffEntry *aa = a, *bb = b;
 return (aa->len - bb->len)*256 + aa->sym - bb->sym;
 }
+
+int ff_ut10_huff_cmp_len(const void *a, const void *b)
+{
+const HuffEntry *aa = a, *bb = b;
+return (aa->len - bb->len) * 1024 + aa->sym - bb->sym;
+}
diff --git a/libavcodec/utvideo.h b/libavcodec/utvideo.h
index c7f54145f1..bc83a28d43 100644
--- a/libavcodec/utvideo.h
+++ b/libavcodec/utvideo.h
@@ -76,6 +76,7 @@ typedef struct UtvideoContext {
 int  compression;
 int  interlaced;
 int  frame_pred;
+int  pro;
 
 ptrdiff_t slice_stride;
 uint8_t *slice_bits, *slice_buffer[4];
@@ -83,12 +84,13 @@ typedef struct UtvideoContext {
 } UtvideoContext;
 
 typedef struct HuffEntry {
-uint8_t  sym;
+uint16_t sym;
 uint8_t  len;
 uint32_t code;
 } HuffEntry;
 
 /* Compare huffman tree nodes */
 int ff_ut_huff_cmp_len(const void *a, const void *b);
+int ff_ut10_huff_cmp_len(const void *a, const void *b);
 
 #endif /* AVCODEC_UTVIDEO_H */
diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index 2aaf861e62..47f9de86c4 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -37,6 +37,50 @@
 #include "thread.h"
 #include "utvideo.h"
 
+static int build_huff10(const uint8_t *src, VLC *vlc, int *fsym)
+{
+int i;
+HuffEntry he[1024];
+int last;
+uint32_t codes[1024];
+uint8_t bits[1024];
+uint16_t syms[1024];
+uint32_t code;
+
+*fsym = -1;
+for (i = 0; i < 1024; i++) {
+he[i].sym = i;
+he[i].len = *src++;
+}
+qsort(he, 1024, sizeof(*he), ff_ut10_huff_cmp_len);
+
+if (!he[0].len) {
+*fsym = he[0].sym;
+return 0;
+}
+
+last = 1023;
+while (he[last].len == 255 && last)
+last--;
+
+if (he[last].len > 32) {
+return -1;
+}
+
+code = 1;
+for (i = last; i >= 0; i--) {
+codes[i] = code >> (32 - he[i].len);
+bits[i]  = he[i].len;
+syms[i]  = he[i].sym;
+code += 0x8000u >> (he[i].len - 1);
+}
+
+return ff_init_vlc_sparse(vlc, FFMIN(he[last].len, 11), last + 1,
+  bits,  sizeof(*bits),  sizeof(*bits),
+  codes, sizeof(*codes), sizeof(*codes),
+  syms,  sizeof(*syms),  sizeof(*syms), 0);
+}
+
 static int build_huff(const uint8_t *src, VLC *vlc, int *fsym)
 {
 int i;
@@ -79,6 +123,111 @@ static int build_huff(const uint8_t *src, VLC *vlc, int 
*fsym)
   syms,  sizeof(*syms),  sizeof(*syms), 0);
 }
 
+static int decode_plane10(UtvideoContext *c, int plane_no,
+  uint16_t *dst, int step, int stride,
+  int width, int height,
+  const uint8_t *src, const uint8_t *huff,
+  int use_pred)
+{
+BitstreamContext bc;
+int i, j, slice, pix, ret;
+int sstart, send;
+VLC vlc;
+int prev, fsym;
+
+if ((ret = build_huff10(huff, &vlc, &fsym)) < 0) {
+av_log(c->avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n");
+return ret;
+}
+if (fsym >= 0) { // build_huff reported a symbol to fill slices with
+send = 0;
+for (slice = 0; slice < c->slices; slice++) {
+uint16_t *dest;
+
+sstart = send;
+send   = (height * (slice + 1) / c->slices);
+dest   = dst + sstart * stride;
+
+prev = 0x200;
+for (j = sstart; j < send; j++) {
+for (i = 0; i < width * step; i += step) {
+pix = fsym;
+if (use_pred) {
+prev += pix;
+prev &= 0x3FF;
+pix   = prev;
+}
+dest[i] = pix;
+}
+dest += stride;
+}
+}
+return 0;
+}
+
+send = 0;
+for (slice = 0; slice < c->slices; slice++) {
+uint16_t *dest;
+int slice_data_start, slice_data_end, slice_size;
+
+sstart = send;
+send   = (height * (slice + 1) / c->slices);
+dest   = dst + sstart * stride;
+
+// slice offset 

[FFmpeg-cvslog] swscale: Add gbrap10 output

2017-10-28 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Nov 10 00:02:50 2016 +0100| [ac29b82ec596c19c649b43f9988cbcc56f83b9e8] | 
committer: Luca Barbato

swscale: Add gbrap10 output

Signed-off-by: Michael Niedermayer 
Signed-off-by: Luca Barbato 

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

 libswscale/output.c | 2 ++
 libswscale/utils.c  | 4 ++--
 tests/ref/fate/filter-pixdesc-gbrap10be | 1 +
 tests/ref/fate/filter-pixdesc-gbrap10le | 1 +
 tests/ref/fate/filter-pixfmts-copy  | 2 ++
 tests/ref/fate/filter-pixfmts-null  | 2 ++
 tests/ref/fate/filter-pixfmts-scale | 2 ++
 tests/ref/fate/filter-pixfmts-vflip | 2 ++
 8 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/libswscale/output.c b/libswscale/output.c
index d0c303c3a8..cfb204300a 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -1457,6 +1457,8 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
 case AV_PIX_FMT_GBRP10LE:
 case AV_PIX_FMT_GBRP12BE:
 case AV_PIX_FMT_GBRP12LE:
+case AV_PIX_FMT_GBRAP10BE:
+case AV_PIX_FMT_GBRAP10LE:
 case AV_PIX_FMT_GBRAP12BE:
 case AV_PIX_FMT_GBRAP12LE:
 case AV_PIX_FMT_GBRP16BE:
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 3a5c779ea3..248a8081ff 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -191,8 +191,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
 [AV_PIX_FMT_GBRP16LE]= { 1, 0 },
 [AV_PIX_FMT_GBRP16BE]= { 1, 0 },
 [AV_PIX_FMT_GBRAP]   = { 1, 1 },
-[AV_PIX_FMT_GBRAP10LE]   = { 1, 0 },
-[AV_PIX_FMT_GBRAP10BE]   = { 1, 0 },
+[AV_PIX_FMT_GBRAP10LE]   = { 1, 1 },
+[AV_PIX_FMT_GBRAP10BE]   = { 1, 1 },
 [AV_PIX_FMT_GBRAP12LE]   = { 1, 1 },
 [AV_PIX_FMT_GBRAP12BE]   = { 1, 1 },
 [AV_PIX_FMT_GBRAP16LE]   = { 1, 0 },
diff --git a/tests/ref/fate/filter-pixdesc-gbrap10be 
b/tests/ref/fate/filter-pixdesc-gbrap10be
new file mode 100644
index 00..de31be676d
--- /dev/null
+++ b/tests/ref/fate/filter-pixdesc-gbrap10be
@@ -0,0 +1 @@
+pixdesc-gbrap10be   555c0acf80a24fbe2cac7e1babf90e05
diff --git a/tests/ref/fate/filter-pixdesc-gbrap10le 
b/tests/ref/fate/filter-pixdesc-gbrap10le
new file mode 100644
index 00..7e355e2cf0
--- /dev/null
+++ b/tests/ref/fate/filter-pixdesc-gbrap10le
@@ -0,0 +1 @@
+pixdesc-gbrap10le   7745a3c869fd7dbc1d8fd9db28bd2f89
diff --git a/tests/ref/fate/filter-pixfmts-copy 
b/tests/ref/fate/filter-pixfmts-copy
index bd16f11075..c23187c595 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -13,6 +13,8 @@ bgr565le6a0d182c7165103b2613d1805c822f9f
 bgr836b9ef72c87da36ac547202d85a5805f
 bgra56e6e1bfde40aaa27473e01b46345c82
 gbrap   57cb1a02d6f015a4329fe367f3bdfe49
+gbrap10be   56d152356064bce059f85be97f548d68
+gbrap10le   30e9fdb568a60eb3f8dcd55497425fa2
 gbrap12be   df4b550099df0702f602a8b305702a8c
 gbrap12le   f947c43e494ab87410dfb2547e7e22f2
 gbrpd5f73b5d3ba7f6cadbc9b4ecbc161005
diff --git a/tests/ref/fate/filter-pixfmts-null 
b/tests/ref/fate/filter-pixfmts-null
index bd16f11075..c23187c595 100644
--- a/tests/ref/fate/filter-pixfmts-null
+++ b/tests/ref/fate/filter-pixfmts-null
@@ -13,6 +13,8 @@ bgr565le6a0d182c7165103b2613d1805c822f9f
 bgr836b9ef72c87da36ac547202d85a5805f
 bgra56e6e1bfde40aaa27473e01b46345c82
 gbrap   57cb1a02d6f015a4329fe367f3bdfe49
+gbrap10be   56d152356064bce059f85be97f548d68
+gbrap10le   30e9fdb568a60eb3f8dcd55497425fa2
 gbrap12be   df4b550099df0702f602a8b305702a8c
 gbrap12le   f947c43e494ab87410dfb2547e7e22f2
 gbrpd5f73b5d3ba7f6cadbc9b4ecbc161005
diff --git a/tests/ref/fate/filter-pixfmts-scale 
b/tests/ref/fate/filter-pixfmts-scale
index e1737f0b20..0c73ec827a 100644
--- a/tests/ref/fate/filter-pixfmts-scale
+++ b/tests/ref/fate/filter-pixfmts-scale
@@ -13,6 +13,8 @@ bgr565le34438643c183ff1748cf7d71453f981c
 bgr8e731ba3dbec294e1daa7313e08e88034
 bgra6e1f417ae41636f631de1cfe39ce1778
 gbrap   eefdbfd1426765ce5e9790022533db0d
+gbrap10be   27453716362dda9ebf43c0f6992eff48
+gbrap10le   253139dcb985b9d7c2e583595596dfa0
 gbrap12be   af4acb3ad0a6630f6ec4534e4d2e869a
 gbrap12le   90ca5271960dc1ebd6ebe14189223e36
 gbrp5d14768d2ab6cbf3879966b5d5c6befb
diff --git a/tests/ref/fate/filter-pixfmts-vflip 
b/tests/ref/fate/filter-pixfmts-vflip
index 11a48c7c71..184793000a 100644
--- a/tests/ref/fate/filter-pixfmts-vflip
+++ b/tests/ref/fate/filter-pixfmts-vflip
@@ -13,6 +13,8 @@ bgr565le6f98ccb05e608863ef0912b9a6fd960b
 bgr81f916a75563e6be42c056e7d973a7356
 bgradd8eaea69683884ea45bf2fb635ce415
 gbrap   

[FFmpeg-cvslog] Merge commit '378460fef1e563704bc5a307ba748a2b819cc09d'

2017-10-28 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Oct 28 14:04:32 
2017 -0300| [4205e20c287b97932f8d6a8db8cb78d80b01] | committer: James Almer

Merge commit '378460fef1e563704bc5a307ba748a2b819cc09d'

* commit '378460fef1e563704bc5a307ba748a2b819cc09d':
  utvideodec: Support for gradient prediction
  utvideodec: Reuse the huffyuv add_left
  utvideodec: Support ULY4 and ULH4
  utvideodec: Support UQRA and UQRG
  swscale: Add gbrap10 output
  swscale: Add input support for gbrap10 pixel format
  pixfmt: Add gbrap10 pixel format
  utvideodec: Support UQY2

This commit is a noop, see
115e63c8d6791ebdc921caf40c3def024690af2e
8100426fe4ba41b74404cbbd83184afa3239f64b
9d30690f20343ed3057fe4abf82009598d320ce5
b828788d58cb6f55e0bffa4682d75ddf84b4214b
84efdabc94251f1f6f483eb737e95d53376ae921
c62cb9bf5a50df416532afd8d5f79ebade174ac7
ea93052db3594f93f2d10be085a770184da0513d
faa94a576f5f3de10fc7016e0d94229faa1c2159

Merged-by: James Almer 

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



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] utvideodec: Reuse the huffyuv add_left

2017-10-28 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Dec 23 15:41:51 
2016 +0100| [9227bd8ac2f22cfad2ee5bc3122d407196a0ba15] | committer: Luca Barbato

utvideodec: Reuse the huffyuv add_left

~10% faster when simd is available.

Signed-off-by: Paul B Mahol 
Signed-off-by: Luca Barbato 

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

 configure   |   2 +-
 libavcodec/utvideo.h|   2 +
 libavcodec/utvideodec.c | 164 +++-
 3 files changed, 137 insertions(+), 31 deletions(-)

diff --git a/configure b/configure
index ecc77842ff..e83a4cf697 100755
--- a/configure
+++ b/configure
@@ -2129,7 +2129,7 @@ truespeech_decoder_select="bswapdsp"
 tscc_decoder_deps="zlib"
 txd_decoder_select="texturedsp"
 twinvq_decoder_select="mdct lsp sinewin"
-utvideo_decoder_select="bswapdsp"
+utvideo_decoder_select="bswapdsp huffyuvdsp"
 utvideo_encoder_select="bswapdsp huffman huffyuvencdsp"
 vble_decoder_select="huffyuvdsp"
 vc1_decoder_select="blockdsp error_resilience h263_decoder h264qpel intrax8 
mpeg_er mpegvideo vc1dsp"
diff --git a/libavcodec/utvideo.h b/libavcodec/utvideo.h
index bc83a28d43..2fa2b7cb93 100644
--- a/libavcodec/utvideo.h
+++ b/libavcodec/utvideo.h
@@ -30,6 +30,7 @@
 #include "libavutil/common.h"
 #include "avcodec.h"
 #include "bswapdsp.h"
+#include "huffyuvdsp.h"
 #include "huffyuvencdsp.h"
 
 enum {
@@ -68,6 +69,7 @@ typedef struct UtvideoContext {
 const AVClass *class;
 AVCodecContext *avctx;
 BswapDSPContext bdsp;
+HuffYUVDSPContext hdspdec;
 HuffYUVEncDSPContext hdsp;
 
 uint32_t frame_info_size, flags, frame_info;
diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index f5fae8ba44..67ffe6f253 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -373,8 +373,110 @@ static void restore_rgb_planes10(AVFrame *frame, int 
width, int height)
 }
 }
 
-static void restore_median(uint8_t *src, int step, ptrdiff_t stride,
-   int width, int height, int slices, int rmode)
+static void restore_median_planar(UtvideoContext *c, uint8_t *src,
+  ptrdiff_t stride, int width, int height,
+  int slices, int rmode)
+{
+int i, j, slice;
+int A, B, C;
+uint8_t *bsrc;
+int slice_start, slice_height;
+const int cmask = ~rmode;
+
+for (slice = 0; slice < slices; slice++) {
+slice_start  = ((slice * height) / slices) & cmask;
+slice_height = slice + 1) * height) / slices) & cmask) -
+   slice_start;
+
+if (!slice_height)
+continue;
+bsrc = src + slice_start * stride;
+
+// first line - left neighbour prediction
+bsrc[0] += 0x80;
+c->hdspdec.add_hfyu_left_pred(bsrc, bsrc, width, 0);
+bsrc += stride;
+if (slice_height <= 1)
+continue;
+// second line - first element has top prediction, the rest uses median
+C= bsrc[-stride];
+bsrc[0] += C;
+A= bsrc[0];
+for (i = 1; i < width; i++) {
+B= bsrc[i - stride];
+bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
+C= B;
+A= bsrc[i];
+}
+bsrc += stride;
+// the rest of lines use continuous median prediction
+for (j = 2; j < slice_height; j++) {
+c->hdspdec.add_hfyu_median_pred(bsrc, bsrc - stride,
+bsrc, width, &A, &B);
+bsrc += stride;
+}
+}
+}
+
+/* UtVideo interlaced mode treats every two lines as a single one,
+ * so restoring function should take care of possible padding between
+ * two parts of the same "line".
+ */
+static void restore_median_planar_il(UtvideoContext *c, uint8_t *src,
+ ptrdiff_t stride, int width, int height,
+ int slices, int rmode)
+{
+int i, j, slice;
+int A, B, C;
+uint8_t *bsrc;
+int slice_start, slice_height;
+const int cmask   = ~(rmode ? 3 : 1);
+const int stride2 = stride << 1;
+
+for (slice = 0; slice < slices; slice++) {
+slice_start= ((slice * height) / slices) & cmask;
+slice_height   = slice + 1) * height) / slices) & cmask) -
+ slice_start;
+slice_height >>= 1;
+if (!slice_height)
+continue;
+
+bsrc = src + slice_start * stride;
+
+// first line - left neighbour prediction
+bsrc[0] += 0x80;
+A = c->hdspdec.add_hfyu_left_pred(bsrc, bsrc, width, 0);
+c->hdspdec.add_hfyu_left_pred(bsrc + stride, bsrc + stride, width, A);
+bsrc += stride2;
+if (slice_height <= 1)
+continue;
+// second line - first element has top prediction, the rest uses median
+C= bsrc[-stride2];

[FFmpeg-cvslog] utvideodec: Support ULY4 and ULH4

2017-10-28 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Sep  4 01:56:02 
2016 +0200| [4f33d9d41a03981adff0a9a95ef034fd14625e95] | committer: Luca Barbato

utvideodec: Support ULY4 and ULH4

Signed-off-by: Paul B Mahol 
Signed-off-by: Luca Barbato 

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

 libavcodec/utvideodec.c | 30 ++
 libavformat/riff.c  |  2 ++
 2 files changed, 32 insertions(+)

diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index cc18e3dc95..f5fae8ba44 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -681,6 +681,26 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 }
 }
 break;
+case AV_PIX_FMT_YUV444P:
+for (i = 0; i < 3; i++) {
+ret = decode_plane(c, i, frame.f->data[i], 1, frame.f->linesize[i],
+   avctx->width, avctx->height,
+   plane_start[i], c->frame_pred == PRED_LEFT);
+if (ret)
+return ret;
+if (c->frame_pred == PRED_MEDIAN) {
+if (!c->interlaced) {
+restore_median(frame.f->data[i], 1, frame.f->linesize[i],
+   avctx->width, avctx->height,
+   c->slices, 0);
+} else {
+restore_median_il(frame.f->data[i], 1, 
frame.f->linesize[i],
+  avctx->width, avctx->height,
+  c->slices, 0);
+}
+}
+}
+break;
 case AV_PIX_FMT_YUV422P10:
 for (i = 0; i < 3; i++) {
 ret = decode_plane10(c, i, (uint16_t *)frame.f->data[i], 1, 
frame.f->linesize[i] / 2,
@@ -762,6 +782,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
 avctx->pix_fmt = AV_PIX_FMT_YUV422P;
 avctx->colorspace = AVCOL_SPC_BT470BG;
 break;
+case MKTAG('U', 'L', 'Y', '4'):
+c->planes  = 3;
+avctx->pix_fmt = AV_PIX_FMT_YUV444P;
+avctx->colorspace = AVCOL_SPC_BT470BG;
+break;
 case MKTAG('U', 'Q', 'Y', '2'):
 c->planes  = 3;
 avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
@@ -784,6 +809,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
 avctx->pix_fmt = AV_PIX_FMT_YUV422P;
 avctx->colorspace = AVCOL_SPC_BT709;
 break;
+case MKTAG('U', 'L', 'H', '4'):
+c->planes  = 3;
+avctx->pix_fmt = AV_PIX_FMT_YUV444P;
+avctx->colorspace = AVCOL_SPC_BT709;
+break;
 default:
 av_log(avctx, AV_LOG_ERROR, "Unknown Ut Video FOURCC provided 
(%08X)\n",
avctx->codec_tag);
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 9cd330b344..a6734f2789 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -340,8 +340,10 @@ const AVCodecTag ff_codec_bmp_tags[] = {
 { AV_CODEC_ID_UTVIDEO,  MKTAG('U', 'L', 'R', 'G') },
 { AV_CODEC_ID_UTVIDEO,  MKTAG('U', 'L', 'Y', '0') },
 { AV_CODEC_ID_UTVIDEO,  MKTAG('U', 'L', 'Y', '2') },
+{ AV_CODEC_ID_UTVIDEO,  MKTAG('U', 'L', 'Y', '4') },
 { AV_CODEC_ID_UTVIDEO,  MKTAG('U', 'L', 'H', '0') },
 { AV_CODEC_ID_UTVIDEO,  MKTAG('U', 'L', 'H', '2') },
+{ AV_CODEC_ID_UTVIDEO,  MKTAG('U', 'L', 'H', '4') },
 { AV_CODEC_ID_UTVIDEO,  MKTAG('U', 'Q', 'Y', '2') },
 { AV_CODEC_ID_UTVIDEO,  MKTAG('U', 'Q', 'R', 'A') },
 { AV_CODEC_ID_UTVIDEO,  MKTAG('U', 'Q', 'R', 'G') },

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] utvideodec: Support UQRA and UQRG

2017-10-28 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Mon Apr 10 11:35:00 
2017 +0200| [a93faf30d688b872e0ecc453b2dfc36470683ed6] | committer: Luca Barbato

utvideodec: Support UQRA and UQRG

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

 libavcodec/utvideodec.c | 43 +++
 libavformat/riff.c  |  2 ++
 2 files changed, 45 insertions(+)

diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index 47f9de86c4..cc18e3dc95 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -351,6 +351,28 @@ static void restore_rgb_planes(uint8_t *src, int step, 
ptrdiff_t stride,
 }
 }
 
+static void restore_rgb_planes10(AVFrame *frame, int width, int height)
+{
+uint16_t *src_r = (uint16_t *)frame->data[2];
+uint16_t *src_g = (uint16_t *)frame->data[0];
+uint16_t *src_b = (uint16_t *)frame->data[1];
+int r, g, b;
+int i, j;
+
+for (j = 0; j < height; j++) {
+for (i = 0; i < width; i++) {
+r = src_r[i];
+g = src_g[i];
+b = src_b[i];
+src_r[i] = (r + g - 0x200) & 0x3FF;
+src_b[i] = (b + g - 0x200) & 0x3FF;
+}
+src_r += frame->linesize[2] / 2;
+src_g += frame->linesize[0] / 2;
+src_b += frame->linesize[1] / 2;
+}
+}
+
 static void restore_median(uint8_t *src, int step, ptrdiff_t stride,
int width, int height, int slices, int rmode)
 {
@@ -605,6 +627,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 restore_rgb_planes(frame.f->data[0], c->planes, frame.f->linesize[0],
avctx->width, avctx->height);
 break;
+case AV_PIX_FMT_GBRAP10:
+case AV_PIX_FMT_GBRP10:
+for (i = 0; i < c->planes; i++) {
+ret = decode_plane10(c, i, (uint16_t *)frame.f->data[i], 1,
+ frame.f->linesize[i] / 2, avctx->width,
+ avctx->height, plane_start[i],
+ plane_start[i + 1] - 1024,
+ c->frame_pred == PRED_LEFT);
+if (ret)
+return ret;
+}
+restore_rgb_planes10(frame.f, avctx->width, avctx->height);
+break;
 case AV_PIX_FMT_YUV420P:
 for (i = 0; i < 3; i++) {
 ret = decode_plane(c, i, frame.f->data[i], 1, frame.f->linesize[i],
@@ -731,6 +766,14 @@ static av_cold int decode_init(AVCodecContext *avctx)
 c->planes  = 3;
 avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
 break;
+case MKTAG('U', 'Q', 'R', 'G'):
+c->planes  = 3;
+avctx->pix_fmt = AV_PIX_FMT_GBRP10;
+break;
+case MKTAG('U', 'Q', 'R', 'A'):
+c->planes  = 4;
+avctx->pix_fmt = AV_PIX_FMT_GBRAP10;
+break;
 case MKTAG('U', 'L', 'H', '0'):
 c->planes  = 3;
 avctx->pix_fmt = AV_PIX_FMT_YUV420P;
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 69dabc0d52..9cd330b344 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -343,6 +343,8 @@ const AVCodecTag ff_codec_bmp_tags[] = {
 { AV_CODEC_ID_UTVIDEO,  MKTAG('U', 'L', 'H', '0') },
 { AV_CODEC_ID_UTVIDEO,  MKTAG('U', 'L', 'H', '2') },
 { AV_CODEC_ID_UTVIDEO,  MKTAG('U', 'Q', 'Y', '2') },
+{ AV_CODEC_ID_UTVIDEO,  MKTAG('U', 'Q', 'R', 'A') },
+{ AV_CODEC_ID_UTVIDEO,  MKTAG('U', 'Q', 'R', 'G') },
 { AV_CODEC_ID_VBLE, MKTAG('V', 'B', 'L', 'E') },
 { AV_CODEC_ID_ESCAPE130,MKTAG('E', '1', '3', '0') },
 { AV_CODEC_ID_DXTORY,   MKTAG('x', 't', 'o', 'r') },

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] utvideodec: Support for gradient prediction

2017-10-28 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Apr  7 20:09:22 
2017 +0200| [378460fef1e563704bc5a307ba748a2b819cc09d] | committer: Luca Barbato

utvideodec: Support for gradient prediction

Introduced with utvideo 18.

Signed-off-by: Paul B Mahol 
Signed-off-by: Luca Barbato 

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

 libavcodec/utvideodec.c | 232 ++--
 1 file changed, 227 insertions(+), 5 deletions(-)

diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index 67ffe6f253..910d64b57e 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -602,6 +602,189 @@ static void restore_median_packed_il(uint8_t *src, int 
step, ptrdiff_t stride,
 }
 }
 
+static void restore_gradient_planar(UtvideoContext *c, uint8_t *src, ptrdiff_t 
stride,
+int width, int height, int slices, int 
rmode)
+{
+int i, j, slice;
+int A, B, C;
+uint8_t *bsrc;
+int slice_start, slice_height;
+const int cmask = ~rmode;
+
+for (slice = 0; slice < slices; slice++) {
+slice_start  = ((slice * height) / slices) & cmask;
+slice_height = slice + 1) * height) / slices) & cmask) -
+   slice_start;
+
+if (!slice_height)
+continue;
+bsrc = src + slice_start * stride;
+
+// first line - left neighbour prediction
+bsrc[0] += 0x80;
+c->hdspdec.add_hfyu_left_pred(bsrc, bsrc, width, 0);
+bsrc += stride;
+if (slice_height <= 1)
+continue;
+for (j = 1; j < slice_height; j++) {
+// second line - first element has top prediction, the rest uses 
gradient
+bsrc[0] = (bsrc[0] + bsrc[-stride]) & 0xFF;
+for (i = 1; i < width; i++) {
+A = bsrc[i - stride];
+B = bsrc[i - (stride + 1)];
+C = bsrc[i - 1];
+bsrc[i] = (A - B + C + bsrc[i]) & 0xFF;
+}
+bsrc += stride;
+}
+}
+}
+
+static void restore_gradient_planar_il(UtvideoContext *c, uint8_t *src, 
ptrdiff_t stride,
+  int width, int height, int slices, int 
rmode)
+{
+int i, j, slice;
+int A, B, C;
+uint8_t *bsrc;
+int slice_start, slice_height;
+const int cmask   = ~(rmode ? 3 : 1);
+const ptrdiff_t stride2 = stride << 1;
+
+for (slice = 0; slice < slices; slice++) {
+slice_start= ((slice * height) / slices) & cmask;
+slice_height   = slice + 1) * height) / slices) & cmask) -
+ slice_start;
+slice_height >>= 1;
+if (!slice_height)
+continue;
+
+bsrc = src + slice_start * stride;
+
+// first line - left neighbour prediction
+bsrc[0] += 0x80;
+A = c->hdspdec.add_hfyu_left_pred(bsrc, bsrc, width, 0);
+c->hdspdec.add_hfyu_left_pred(bsrc + stride, bsrc + stride, width, A);
+bsrc += stride2;
+if (slice_height <= 1)
+continue;
+for (j = 1; j < slice_height; j++) {
+// second line - first element has top prediction, the rest uses 
gradient
+bsrc[0] = (bsrc[0] + bsrc[-stride2]) & 0xFF;
+for (i = 1; i < width; i++) {
+A = bsrc[i - stride2];
+B = bsrc[i - (stride2 + 1)];
+C = bsrc[i - 1];
+bsrc[i] = (A - B + C + bsrc[i]) & 0xFF;
+}
+for (i = 0; i < width; i++) {
+A = bsrc[i - stride];
+B = bsrc[i - (1 + stride)];
+C = bsrc[i - 1 + stride];
+bsrc[i + stride] = (A - B + C + bsrc[i + stride]) & 0xFF;
+}
+bsrc += stride2;
+}
+}
+}
+
+static void restore_gradient_packed(uint8_t *src, int step, ptrdiff_t stride,
+int width, int height, int slices, int 
rmode)
+{
+int i, j, slice;
+int A, B, C;
+uint8_t *bsrc;
+int slice_start, slice_height;
+const int cmask = ~rmode;
+
+for (slice = 0; slice < slices; slice++) {
+slice_start  = ((slice * height) / slices) & cmask;
+slice_height = slice + 1) * height) / slices) & cmask) -
+   slice_start;
+
+if (!slice_height)
+continue;
+bsrc = src + slice_start * stride;
+
+// first line - left neighbour prediction
+bsrc[0] += 0x80;
+A = bsrc[0];
+for (i = step; i < width * step; i += step) {
+bsrc[i] += A;
+A= bsrc[i];
+}
+bsrc += stride;
+if (slice_height <= 1)
+continue;
+for (j = 1; j < slice_height; j++) {
+// second line - first element has top prediction, the rest uses 
gradient
+C= bsrc[-stride];
+bsrc[0] += C;
+for (i 

[FFmpeg-cvslog] avfilter/zscale: fix segfault on library error

2017-10-28 Thread dxfhgwet
ffmpeg | branch: master | dxfhgwet  | Sat Oct 28 10:20:22 
2017 -0700| [b43d13144bdb63704dd55533b3fba9be376164ce] | committer: Paul B Mahol

avfilter/zscale: fix segfault on library error

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

 libavfilter/vf_zscale.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c
index c303dd4d63..5ee272ed1d 100644
--- a/libavfilter/vf_zscale.c
+++ b/libavfilter/vf_zscale.c
@@ -321,7 +321,7 @@ static int print_zimg_error(AVFilterContext *ctx)
 
 av_log(ctx, AV_LOG_ERROR, "code %d: %s\n", err_code, err_msg);
 
-return err_code;
+return AVERROR_EXTERNAL;
 }
 
 static int convert_chroma_location(enum AVChromaLocation chroma_location)
@@ -624,7 +624,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
 
 ret = zimg_filter_graph_process(s->graph, &src_buf, &dst_buf, s->tmp, 0, 
0, 0, 0);
 if (ret) {
-print_zimg_error(link->dst);
+ret = print_zimg_error(link->dst);
 goto fail;
 }
 
@@ -639,7 +639,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
 
 ret = zimg_filter_graph_process(s->alpha_graph, &src_buf, &dst_buf, 
s->tmp, 0, 0, 0, 0);
 if (ret) {
-print_zimg_error(link->dst);
+ret = print_zimg_error(link->dst);
 goto fail;
 }
 } else if (odesc->flags & AV_PIX_FMT_FLAG_ALPHA) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avfilter/zscale: fix memory leak

2017-10-28 Thread dxfhgwet
ffmpeg | branch: master | dxfhgwet  | Fri Oct 27 21:54:13 
2017 -0700| [ff763351e74550df3b9a0465634d1ec48b15b043] | committer: Paul B Mahol

avfilter/zscale: fix memory leak

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

 libavfilter/vf_zscale.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c
index 5ee272ed1d..09fd842fe5 100644
--- a/libavfilter/vf_zscale.c
+++ b/libavfilter/vf_zscale.c
@@ -673,6 +673,7 @@ static void uninit(AVFilterContext *ctx)
 ZScaleContext *s = ctx->priv;
 
 zimg_filter_graph_free(s->graph);
+zimg_filter_graph_free(s->alpha_graph);
 av_freep(&s->tmp);
 s->tmp_size = 0;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] swscale: Do not shift negative values directly

2017-10-28 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Sat Apr 15 
14:39:45 2017 +0200| [f56fa95cd13f627891a1bfb66bf61b971b9e0238] | committer: 
Luca Barbato

swscale: Do not shift negative values directly

It is undefined in C as reported:
warning: shifting a negative signed value is undefined

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

 libswscale/output.c | 23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/libswscale/output.c b/libswscale/output.c
index cfb204300a..07edcfd4cc 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -130,6 +130,9 @@ DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_220)[8][8] 
= {
 AV_WL16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
 }
 
+// Shifting negative amounts is undefined in C
+#define SHIFT_LEFT(val, shift) ((val) * (1 << (shift)))
+
 static av_always_inline void
 yuv2plane1_16_c_template(const int32_t *src, uint16_t *dest, int dstW,
  int big_endian, int output_bits)
@@ -601,8 +604,8 @@ yuv2rgb48_X_c_template(SwsContext *c, const int16_t 
*lumFilter,
 int j;
 int Y1 = -0x4000;
 int Y2 = -0x4000;
-int U  = -128 << 23; // 19
-int V  = -128 << 23;
+int U  = SHIFT_LEFT(-128, 23); // 19
+int V  = SHIFT_LEFT(-128, 23);
 int R, G, B;
 
 for (j = 0; j < lumFilterSize; j++) {
@@ -663,8 +666,8 @@ yuv2rgb48_2_c_template(SwsContext *c, const int32_t *buf[2],
 for (i = 0; i < ((dstW + 1) >> 1); i++) {
 int Y1 = (buf0[i * 2] * yalpha1  + buf1[i * 2] * yalpha) >> 14;
 int Y2 = (buf0[i * 2 + 1] * yalpha1  + buf1[i * 2 + 1] * yalpha) >> 14;
-int U  = (ubuf0[i]* uvalpha1 + ubuf1[i]* uvalpha + 
(-128 << 23)) >> 14;
-int V  = (vbuf0[i]* uvalpha1 + vbuf1[i]* uvalpha + 
(-128 << 23)) >> 14;
+int U  = (ubuf0[i]* uvalpha1 + ubuf1[i]* uvalpha + 
SHIFT_LEFT(-128, 23)) >> 14;
+int V  = (vbuf0[i]* uvalpha1 + vbuf1[i]* uvalpha + 
SHIFT_LEFT(-128, 23)) >> 14;
 int R, G, B;
 
 Y1 -= c->yuv2rgb_y_offset;
@@ -701,8 +704,8 @@ yuv2rgb48_1_c_template(SwsContext *c, const int32_t *buf0,
 for (i = 0; i < ((dstW + 1) >> 1); i++) {
 int Y1 = (buf0[i * 2]) >> 2;
 int Y2 = (buf0[i * 2 + 1]) >> 2;
-int U  = (ubuf0[i] + (-128 << 11)) >> 2;
-int V  = (vbuf0[i] + (-128 << 11)) >> 2;
+int U  = (ubuf0[i] + SHIFT_LEFT(-128, 11)) >> 2;
+int V  = (vbuf0[i] + SHIFT_LEFT(-128, 11)) >> 2;
 int R, G, B;
 
 Y1 -= c->yuv2rgb_y_offset;
@@ -729,8 +732,8 @@ yuv2rgb48_1_c_template(SwsContext *c, const int32_t *buf0,
 for (i = 0; i < ((dstW + 1) >> 1); i++) {
 int Y1 = (buf0[i * 2]) >> 2;
 int Y2 = (buf0[i * 2 + 1]) >> 2;
-int U  = (ubuf0[i] + ubuf1[i] + (-128 << 12)) >> 3;
-int V  = (vbuf0[i] + vbuf1[i] + (-128 << 12)) >> 3;
+int U  = (ubuf0[i] + ubuf1[i] + SHIFT_LEFT(-128, 12)) >> 3;
+int V  = (vbuf0[i] + vbuf1[i] + SHIFT_LEFT(-128, 12)) >> 3;
 int R, G, B;
 
 Y1 -= c->yuv2rgb_y_offset;
@@ -1172,8 +1175,8 @@ yuv2rgb_full_X_c_template(SwsContext *c, const int16_t 
*lumFilter,
 for (i = 0; i < dstW; i++) {
 int j;
 int Y = 0;
-int U = -128 << 19;
-int V = -128 << 19;
+int U = SHIFT_LEFT(-128, 19);
+int V = SHIFT_LEFT(-128, 19);
 int R, G, B, A;
 
 for (j = 0; j < lumFilterSize; j++) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit 'f56fa95cd13f627891a1bfb66bf61b971b9e0238'

2017-10-28 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Oct 28 14:38:24 
2017 -0300| [f361f15f362eee8751fc394aa2a8a3ce90b579dd] | committer: James Almer

Merge commit 'f56fa95cd13f627891a1bfb66bf61b971b9e0238'

* commit 'f56fa95cd13f627891a1bfb66bf61b971b9e0238':
  swscale: Do not shift negative values directly

14:30:21]  michaelni: do you prefer how f56fa95cd1 (libav) handles 
left shift of negative value, or how we're currently doing it?
[14:30:31]  ours is cleaner looking, IMO
[14:30:57] <@ubitux> i agree
[14:31:13] <@ubitux> if we didn't forget any, i think this commit is better 
noop'ed
[14:31:57]  ubitux: we even have a bunch of other cases this commit 
doesn't handle that i'd have to manually change, so yeah, i'm leaning towards 
nooping it
[14:34:04]  jamrial, +1, ours as its cleaner

This commit is a noop.

Merged-by: James Almer 

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



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit 'f56fa95cd13f627891a1bfb66bf61b971b9e0238'

2017-10-28 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Oct 28 14:42:28 
2017 -0300| [27050d4836b111ee2395b896872e41795d7ac015] | committer: James Almer

Merge commit 'f56fa95cd13f627891a1bfb66bf61b971b9e0238'

* commit 'f56fa95cd13f627891a1bfb66bf61b971b9e0238':
  swscale: Do not shift negative values directly

14:30:21]  michaelni: do you prefer how f56fa95cd1 (libav) handles 
left shift of negative value, or how we're currently doing it?
[14:30:31]  ours is cleaner looking, IMO
[14:30:57] <@ubitux> i agree
[14:31:13] <@ubitux> if we didn't forget any, i think this commit is better 
noop'ed
[14:31:57]  ubitux: we even have a bunch of other cases this commit 
doesn't handle that i'd have to manually change, so yeah, i'm leaning towards 
nooping it
[14:34:04]  jamrial, +1, ours as its cleaner

This commit is a noop.

Merged-by: James Almer 

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



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] swscale: Do not shift negative values directly

2017-10-28 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Sat Apr 15 
14:39:45 2017 +0200| [f56fa95cd13f627891a1bfb66bf61b971b9e0238] | committer: 
Luca Barbato

swscale: Do not shift negative values directly

It is undefined in C as reported:
warning: shifting a negative signed value is undefined

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

 libswscale/output.c | 23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/libswscale/output.c b/libswscale/output.c
index cfb204300a..07edcfd4cc 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -130,6 +130,9 @@ DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_220)[8][8] 
= {
 AV_WL16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
 }
 
+// Shifting negative amounts is undefined in C
+#define SHIFT_LEFT(val, shift) ((val) * (1 << (shift)))
+
 static av_always_inline void
 yuv2plane1_16_c_template(const int32_t *src, uint16_t *dest, int dstW,
  int big_endian, int output_bits)
@@ -601,8 +604,8 @@ yuv2rgb48_X_c_template(SwsContext *c, const int16_t 
*lumFilter,
 int j;
 int Y1 = -0x4000;
 int Y2 = -0x4000;
-int U  = -128 << 23; // 19
-int V  = -128 << 23;
+int U  = SHIFT_LEFT(-128, 23); // 19
+int V  = SHIFT_LEFT(-128, 23);
 int R, G, B;
 
 for (j = 0; j < lumFilterSize; j++) {
@@ -663,8 +666,8 @@ yuv2rgb48_2_c_template(SwsContext *c, const int32_t *buf[2],
 for (i = 0; i < ((dstW + 1) >> 1); i++) {
 int Y1 = (buf0[i * 2] * yalpha1  + buf1[i * 2] * yalpha) >> 14;
 int Y2 = (buf0[i * 2 + 1] * yalpha1  + buf1[i * 2 + 1] * yalpha) >> 14;
-int U  = (ubuf0[i]* uvalpha1 + ubuf1[i]* uvalpha + 
(-128 << 23)) >> 14;
-int V  = (vbuf0[i]* uvalpha1 + vbuf1[i]* uvalpha + 
(-128 << 23)) >> 14;
+int U  = (ubuf0[i]* uvalpha1 + ubuf1[i]* uvalpha + 
SHIFT_LEFT(-128, 23)) >> 14;
+int V  = (vbuf0[i]* uvalpha1 + vbuf1[i]* uvalpha + 
SHIFT_LEFT(-128, 23)) >> 14;
 int R, G, B;
 
 Y1 -= c->yuv2rgb_y_offset;
@@ -701,8 +704,8 @@ yuv2rgb48_1_c_template(SwsContext *c, const int32_t *buf0,
 for (i = 0; i < ((dstW + 1) >> 1); i++) {
 int Y1 = (buf0[i * 2]) >> 2;
 int Y2 = (buf0[i * 2 + 1]) >> 2;
-int U  = (ubuf0[i] + (-128 << 11)) >> 2;
-int V  = (vbuf0[i] + (-128 << 11)) >> 2;
+int U  = (ubuf0[i] + SHIFT_LEFT(-128, 11)) >> 2;
+int V  = (vbuf0[i] + SHIFT_LEFT(-128, 11)) >> 2;
 int R, G, B;
 
 Y1 -= c->yuv2rgb_y_offset;
@@ -729,8 +732,8 @@ yuv2rgb48_1_c_template(SwsContext *c, const int32_t *buf0,
 for (i = 0; i < ((dstW + 1) >> 1); i++) {
 int Y1 = (buf0[i * 2]) >> 2;
 int Y2 = (buf0[i * 2 + 1]) >> 2;
-int U  = (ubuf0[i] + ubuf1[i] + (-128 << 12)) >> 3;
-int V  = (vbuf0[i] + vbuf1[i] + (-128 << 12)) >> 3;
+int U  = (ubuf0[i] + ubuf1[i] + SHIFT_LEFT(-128, 12)) >> 3;
+int V  = (vbuf0[i] + vbuf1[i] + SHIFT_LEFT(-128, 12)) >> 3;
 int R, G, B;
 
 Y1 -= c->yuv2rgb_y_offset;
@@ -1172,8 +1175,8 @@ yuv2rgb_full_X_c_template(SwsContext *c, const int16_t 
*lumFilter,
 for (i = 0; i < dstW; i++) {
 int j;
 int Y = 0;
-int U = -128 << 19;
-int V = -128 << 19;
+int U = SHIFT_LEFT(-128, 19);
+int V = SHIFT_LEFT(-128, 19);
 int R, G, B, A;
 
 for (j = 0; j < lumFilterSize; j++) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] dca: Account for lfe when checking for the channel count

2017-10-28 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Mon Apr 17 
12:53:14 2017 +| [5352802da81f2083e65d466612e639a4e6e5530e] | committer: 
Sean McGovern

dca: Account for lfe when checking for the channel count

Bug-Id: 1037
CC: libav-sta...@libav.org

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

 libavcodec/dcadec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index ed1ed2d5f3..3fe46cdc5c 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -1300,7 +1300,7 @@ static int set_channel_layout(AVCodecContext *avctx, int 
channels)
 s->channel_order_tab = ff_dca_channel_reorder_nolfe[s->amode];
 }
 
-if (channels < ff_dca_channels[s->amode])
+if (channels < ff_dca_channels[s->amode] + !!s->lfe)
 return AVERROR_INVALIDDATA;
 
 if (channels > !!s->lfe &&

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] swscale: Convert the check check_image_pointers helper to a macro

2017-10-28 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Sat Apr 15 
14:55:33 2017 +0200| [37f573543c4fd7f44339e04d8d15b95118493ddd] | committer: 
Luca Barbato

swscale: Convert the check check_image_pointers helper to a macro

Avoid warnings about types mismatch and make the code a little simpler.

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

 libswscale/swscale_unscaled.c | 37 +++--
 1 file changed, 15 insertions(+), 22 deletions(-)

diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index d3863bba10..f130ac58cb 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -1190,20 +1190,19 @@ static void reset_ptr(const uint8_t *src[], enum 
AVPixelFormat format)
 }
 }
 
-static int check_image_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt,
-const int linesizes[4])
-{
-const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
-int i;
-
-for (i = 0; i < 4; i++) {
-int plane = desc->comp[i].plane;
-if (!data[plane] || !linesizes[plane])
-return 0;
-}
-
-return 1;
-}
+#define CHECK_IMAGE_POINTERS(data, pix_fmt, linesizes, msg)\
+do {   \
+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); \
+int i; \
+   \
+for (i = 0; i < 4; i++) {  \
+int plane = desc->comp[i].plane;   \
+if (!data[plane] || !linesizes[plane]) {   \
+av_log(c, AV_LOG_ERROR, msg);  \
+return 0;  \
+}  \
+}  \
+} while (0)
 
 /**
  * swscale wrapper, so we don't need to export the SwsContext.
@@ -1223,14 +1222,8 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
 if (srcSliceH == 0)
 return 0;
 
-if (!check_image_pointers(srcSlice, c->srcFormat, srcStride)) {
-av_log(c, AV_LOG_ERROR, "bad src image pointers\n");
-return 0;
-}
-if (!check_image_pointers(dst, c->dstFormat, dstStride)) {
-av_log(c, AV_LOG_ERROR, "bad dst image pointers\n");
-return 0;
-}
+CHECK_IMAGE_POINTERS(srcSlice, c->srcFormat, srcStride, "bad src image 
pointers\n");
+CHECK_IMAGE_POINTERS(dst, c->dstFormat, dstStride, "bad dst image 
pointers\n");
 
 if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != 
c->srcH) {
 av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n");

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '37f573543c4fd7f44339e04d8d15b95118493ddd'

2017-10-28 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Oct 28 15:04:25 
2017 -0300| [dea0f2b36b98e1135de2a3521f4f9d78b2fadf21] | committer: James Almer

Merge commit '37f573543c4fd7f44339e04d8d15b95118493ddd'

* commit '37f573543c4fd7f44339e04d8d15b95118493ddd':
  swscale: Convert the check check_image_pointers helper to a macro

[14:52:50]  michaelni, ubitux: 37f573543c yay or nay? we don't have 
the warnings mentioned there because we cast the argument
[14:54:10] <@ubitux> i don't really see the improvement, no opinion
[15:04:14]  jamrial, functions are better/cleaner than macros
[15:04:20]  IMHO that is

This commit is a noop.

Merged-by: James Almer 

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



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '5352802da81f2083e65d466612e639a4e6e5530e'

2017-10-28 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Oct 28 15:06:08 
2017 -0300| [7d829da3f91984240bae05325f1f7538d31f605b] | committer: James Almer

Merge commit '5352802da81f2083e65d466612e639a4e6e5530e'

* commit '5352802da81f2083e65d466612e639a4e6e5530e':
  dca: Account for lfe when checking for the channel count

This commit is a noop.

Merged-by: James Almer 

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



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] travis: Exclude gcc for the macOS target

2017-10-28 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Tue Apr 18 
20:21:35 2017 +0200| [4809781586d1c956005f72946a2aab5915eab350] | committer: 
Luca Barbato

travis: Exclude gcc for the macOS target

On a normal macOS setup, 'gcc' is a symlink to clang. Therefore there is
little point in running the tests twice, with CC=gcc and CC=clang.

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

 .travis.yml | 4 
 1 file changed, 4 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index 6f9647a701..5aa2802636 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,6 +11,10 @@ addons:
 compiler:
   - clang
   - gcc
+matrix:
+exclude:
+- os: osx
+  compiler: gcc
 cache:
   directories:
 - libav-samples

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '4809781586d1c956005f72946a2aab5915eab350'

2017-10-28 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Oct 28 15:08:31 
2017 -0300| [16a17fb6b2592caea6f0e7b79d09fd7d1f33177d] | committer: James Almer

Merge commit '4809781586d1c956005f72946a2aab5915eab350'

* commit '4809781586d1c956005f72946a2aab5915eab350':
  travis: Exclude gcc for the macOS target

Merged-by: James Almer 

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

 .travis.yml | 4 
 1 file changed, 4 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index 40f01f94c2..63f2051cb3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,6 +11,10 @@ addons:
 compiler:
   - clang
   - gcc
+matrix:
+exclude:
+- os: osx
+  compiler: gcc
 cache:
   directories:
 - ffmpeg-samples


==

diff --cc .travis.yml
index 40f01f94c2,5aa2802636..63f2051cb3
--- a/.travis.yml
+++ b/.travis.yml
@@@ -11,9 -11,13 +11,13 @@@ addons
  compiler:
- clang
- gcc
+ matrix:
+ exclude:
+ - os: osx
+   compiler: gcc
  cache:
directories:
 -- libav-samples
 +- ffmpeg-samples
  before_install:
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update --all; fi
  install:

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] dashenc: use av_dict_set_int instead of static function

2017-10-28 Thread Peter Große
ffmpeg | branch: master | Peter Große  | Thu Oct 26 17:58:35 
2017 +0200| [3606c114172ec0cb25660b4c2e146bed5b211ba3] | committer: Michael 
Niedermayer

dashenc: use av_dict_set_int instead of static function

Signed-off-by: Peter Große 
Signed-off-by: Michael Niedermayer 

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

 libavformat/dashenc.c | 12 ++--
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 240ff41380..5086f4a21f 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -664,14 +664,6 @@ static int dict_copy_entry(AVDictionary **dst, const 
AVDictionary *src, const ch
 return 0;
 }
 
-static int dict_set_int(AVDictionary **pm, const char *key, int64_t value, int 
flags)
-{
-char valuestr[22];
-snprintf(valuestr, sizeof(valuestr), "%"PRId64, value);
-flags &= ~AV_DICT_DONT_STRDUP_VAL;
-return av_dict_set(pm, key, valuestr, flags);
-}
-
 static int dash_init(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
@@ -782,8 +774,8 @@ static int dash_init(AVFormatContext *s)
 if (!strcmp(os->format_name, "mp4")) {
 av_dict_set(&opts, "movflags", "frag_custom+dash+delay_moov", 0);
 } else {
-dict_set_int(&opts, "cluster_time_limit", c->min_seg_duration / 
1000, 0);
-dict_set_int(&opts, "cluster_size_limit", 5 * 1024 * 1024, 0); // 
set a large cluster size limit
+av_dict_set_int(&opts, "cluster_time_limit", c->min_seg_duration / 
1000, 0);
+av_dict_set_int(&opts, "cluster_size_limit", 5 * 1024 * 1024, 0); 
// set a large cluster size limit
 }
 if ((ret = avformat_write_header(ctx, &opts)) < 0)
 return ret;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] dashenc: move UTCTiming element to the end of the manifest

2017-10-28 Thread Peter Große
ffmpeg | branch: master | Peter Große  | Fri Oct 27 21:18:47 
2017 +0200| [8edb9d457251c190f7ad9de764981f79eb113374] | committer: Michael 
Niedermayer

dashenc: move UTCTiming element to the end of the manifest

Required by comformance XSD [1].

[1] 
https://github.com/Dash-Industry-Forum/Conformance-and-reference-source/blob/master/conformance/MPDValidator/schemas/DASH-MPD.xsd

Signed-off-by: Michael Niedermayer 

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

 libavformat/dashenc.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 5086f4a21f..04b0fd99e6 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -627,8 +627,6 @@ static int write_manifest(AVFormatContext *s, int final)
 av_free(escaped);
 }
 avio_printf(out, "\t\n");
-if (c->utc_timing_url)
-avio_printf(out, "\t\n", 
c->utc_timing_url);
 
 if (c->window_size && s->nb_streams > 0 && c->streams[0].nb_segments > 0 
&& !c->use_template) {
 OutputStream *os = &c->streams[0];
@@ -646,6 +644,10 @@ static int write_manifest(AVFormatContext *s, int final)
 return ret;
 }
 avio_printf(out, "\t\n");
+
+if (c->utc_timing_url)
+avio_printf(out, "\t\n", 
c->utc_timing_url);
+
 avio_printf(out, "\n");
 avio_flush(out);
 ff_format_io_close(s, &out);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavf/mov.c: Fix parsing of edit list atoms with invalid elst entry count.

2017-10-28 Thread Sasi Inguva
ffmpeg | branch: master | Sasi Inguva  | Wed Oct 18 20:11:16 
2017 -0700| [80137531139588774e048d6e1dae34ab5cbbbfa2] | committer: Michael 
Niedermayer

lavf/mov.c: Fix parsing of edit list atoms with invalid elst entry count.

Signed-off-by: Sasi Inguva 
Signed-off-by: Michael Niedermayer 

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

 libavformat/mov.c   | 21 ++-
 tests/fate/mov.mak  |  4 ++
 tests/ref/fate/mov-invalid-elst-entry-count | 57 +
 3 files changed, 81 insertions(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 2ee67561e4..209b7470a9 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4852,6 +4852,7 @@ static int mov_read_elst(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 {
 MOVStreamContext *sc;
 int i, edit_count, version;
+int64_t elst_entry_size;
 
 if (c->fc->nb_streams < 1 || c->ignore_editlist)
 return 0;
@@ -4860,6 +4861,21 @@ static int mov_read_elst(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 version = avio_r8(pb); /* version */
 avio_rb24(pb); /* flags */
 edit_count = avio_rb32(pb); /* entries */
+atom.size -= 8;
+
+elst_entry_size = version == 1 ? 20 : 12;
+if (atom.size != edit_count * elst_entry_size) {
+if (c->fc->strict_std_compliance >= FF_COMPLIANCE_STRICT) {
+av_log(c->fc, AV_LOG_ERROR, "Invalid edit list entry_count: %d for 
elst atom of size: %"PRId64" bytes.\n",
+   edit_count, atom.size + 8);
+return AVERROR_INVALIDDATA;
+} else {
+edit_count = atom.size / elst_entry_size;
+if (edit_count * elst_entry_size != atom.size) {
+av_log(c->fc, AV_LOG_WARNING, "ELST atom of %"PRId64" bytes, 
bigger than %d entries.", atom.size, edit_count);
+}
+}
+}
 
 if (!edit_count)
 return 0;
@@ -4872,17 +4888,20 @@ static int mov_read_elst(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 return AVERROR(ENOMEM);
 
 av_log(c->fc, AV_LOG_TRACE, "track[%u].edit_count = %i\n", 
c->fc->nb_streams - 1, edit_count);
-for (i = 0; i < edit_count && !pb->eof_reached; i++) {
+for (i = 0; i < edit_count && atom.size > 0 && !pb->eof_reached; i++) {
 MOVElst *e = &sc->elst_data[i];
 
 if (version == 1) {
 e->duration = avio_rb64(pb);
 e->time = avio_rb64(pb);
+atom.size -= 16;
 } else {
 e->duration = avio_rb32(pb); /* segment duration */
 e->time = (int32_t)avio_rb32(pb); /* media time */
+atom.size -= 8;
 }
 e->rate = avio_rb32(pb) / 65536.0;
+atom.size -= 4;
 av_log(c->fc, AV_LOG_TRACE, "duration=%"PRId64" time=%"PRId64" 
rate=%f\n",
e->duration, e->time, e->rate);
 
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 5013e7d528..604703e254 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -6,6 +6,7 @@ FATE_MOV = fate-mov-3elist \
fate-mov-1elist-ends-last-bframe \
fate-mov-2elist-elist1-ends-bframe \
fate-mov-3elist-encrypted \
+   fate-mov-invalid-elst-entry-count \
fate-mov-gpmf-remux \
fate-mov-440hz-10ms \
 
@@ -43,6 +44,9 @@ fate-mov-2elist-elist1-ends-bframe: CMD = framemd5 -i 
$(TARGET_SAMPLES)/mov/mov-
 # Makes sure that we handle edit lists and start padding correctly.
 fate-mov-440hz-10ms: CMD = framemd5 -i $(TARGET_SAMPLES)/mov/440hz-10ms.m4a
 
+# Makes sure that we handle invalid edit list entry count correctly.
+fate-mov-invalid-elst-entry-count: CMD = framemd5 -i 
$(TARGET_SAMPLES)/mov/invalid_elst_entry_count.mov
+
 fate-mov-aac-2048-priming: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_packets 
-print_format compact $(TARGET_SAMPLES)/mov/aac-2048-priming.mov
 
 fate-mov-zombie: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_streams 
-show_packets -show_frames -bitexact -print_format compact 
$(TARGET_SAMPLES)/mov/white_zombie_scrunch-part.mov
diff --git a/tests/ref/fate/mov-invalid-elst-entry-count 
b/tests/ref/fate/mov-invalid-elst-entry-count
new file mode 100644
index 00..13b575816b
--- /dev/null
+++ b/tests/ref/fate/mov-invalid-elst-entry-count
@@ -0,0 +1,57 @@
+#format: frame checksums
+#version: 2
+#hash: MD5
+#tb 0: 1/24
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 640x480
+#sar 0: 1/1
+#stream#, dts,pts, duration, size, hash
+0,  0,  0,1,   460800, 549730883a0b56e6accaf021903daecf
+0,  1,  1,1,   460800, 783389b4342d4be925fc5244791e760a
+0,  2,  2,1,   460800, 8384af6426d94a2077930c93013e09ad
+0,  3,  3,1,   460800, 9380a1d9ecacf5b3105383c1c8083188
+0,  4,  4,1,   460800, eb28174acfceb868b9058757bed049c5
+0,  5,

[FFmpeg-cvslog] avformat/ac3dec: Check buf2 before adding 16 in ac3_eac3_probe()

2017-10-28 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Oct 28 16:16:46 2017 +0200| [eb54efc1e1aafe18d0a8a0c72a78314645bccc83] | 
committer: Michael Niedermayer

avformat/ac3dec: Check buf2 before adding 16 in ac3_eac3_probe()

This is needed since e0250cf3651e6417e0117486a7816b45fb2d34cd as that uses 
end-buf2
Note, there are more than 16 bytes allocated beyond "end"

Fixes: regression (segfault) with probetest

Signed-off-by: Michael Niedermayer 

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

 libavformat/ac3dec.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/ac3dec.c b/libavformat/ac3dec.c
index 8ea73824a6..6f423ff7eb 100644
--- a/libavformat/ac3dec.c
+++ b/libavformat/ac3dec.c
@@ -47,8 +47,11 @@ static int ac3_eac3_probe(AVProbeData *p, enum AVCodecID 
expected_codec_id)
 uint16_t frame_size;
 int i, ret;
 
-if(!memcmp(buf2, "\x1\x10\0\0\0\0\0\0", 8))
+if(!memcmp(buf2, "\x1\x10\0\0\0\0\0\0", 8)) {
+if (buf2 + 16 > end)
+break;
 buf2+=16;
+}
 if (buf[0] == 0x77 && buf[1] == 0x0B) {
 for(i=0; i<8; i+=2) {
 buf3[i  ] = buf2[i+1];

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] flv: Validate the packet size

2017-10-28 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Mon Apr 17 
14:10:52 2017 +| [279e3aaa14daba6b7a37d75f3fb6e29c732d123f] | committer: 
Luca Barbato

flv: Validate the packet size

Size can be negative at that point.

Bug-Id: 1041
CC: libav-sta...@libav.org

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

 libavformat/flvdec.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 693c859ebf..1b29740f41 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -912,6 +912,12 @@ skip:
 st->codecpar->codec_id == AV_CODEC_ID_H264) {
 int type = avio_r8(s->pb);
 size--;
+
+if (size < 0) {
+ret = AVERROR_INVALIDDATA;
+goto leave;
+}
+
 if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
 // sign extension
 int32_t cts = (avio_rb24(s->pb) + 0xff80) ^ 0xff80;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '279e3aaa14daba6b7a37d75f3fb6e29c732d123f'

2017-10-28 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Oct 28 15:29:23 
2017 -0300| [220603d0c83ef1fe2727813f81bab5a96cfb046d] | committer: James Almer

Merge commit '279e3aaa14daba6b7a37d75f3fb6e29c732d123f'

* commit '279e3aaa14daba6b7a37d75f3fb6e29c732d123f':
  flv: Validate the packet size

Merged-by: James Almer 

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

 libavformat/flvdec.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 2d89bef15f..0217cef842 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -1152,6 +1152,12 @@ retry_duration:
 st->codecpar->codec_id == AV_CODEC_ID_MPEG4) {
 int type = avio_r8(s->pb);
 size--;
+
+if (size < 0) {
+ret = AVERROR_INVALIDDATA;
+goto leave;
+}
+
 if (st->codecpar->codec_id == AV_CODEC_ID_H264 || 
st->codecpar->codec_id == AV_CODEC_ID_MPEG4) {
 // sign extension
 int32_t cts = (avio_rb24(s->pb) + 0xff80) ^ 0xff80;


==

diff --cc libavformat/flvdec.c
index 2d89bef15f,1b29740f41..0217cef842
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@@ -1148,11 -909,16 +1148,17 @@@ retry_duration
  }
  
  if (st->codecpar->codec_id == AV_CODEC_ID_AAC ||
 -st->codecpar->codec_id == AV_CODEC_ID_H264) {
 +st->codecpar->codec_id == AV_CODEC_ID_H264 ||
 +st->codecpar->codec_id == AV_CODEC_ID_MPEG4) {
  int type = avio_r8(s->pb);
  size--;
+ 
+ if (size < 0) {
+ ret = AVERROR_INVALIDDATA;
+ goto leave;
+ }
+ 
 -if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
 +if (st->codecpar->codec_id == AV_CODEC_ID_H264 || 
st->codecpar->codec_id == AV_CODEC_ID_MPEG4) {
  // sign extension
  int32_t cts = (avio_rb24(s->pb) + 0xff80) ^ 0xff80;
  pts = dts + cts;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


Re: [FFmpeg-cvslog] Merge commit '279e3aaa14daba6b7a37d75f3fb6e29c732d123f'

2017-10-28 Thread Carl Eugen Hoyos
2017-10-28 20:30 GMT+02:00 James Almer :
> ffmpeg | branch: master | James Almer  | Sat Oct 28 
> 15:29:23 2017 -0300| [220603d0c83ef1fe2727813f81bab5a96cfb046d] | committer: 
> James Almer
>
> Merge commit '279e3aaa14daba6b7a37d75f3fb6e29c732d123f'
>
> * commit '279e3aaa14daba6b7a37d75f3fb6e29c732d123f':
>   flv: Validate the packet size

Just for the record:
The crash that triggered this patch - a codecpar regression -
was never reproducible with FFmpeg.

Carl Eugen
___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] fate: change fate-ffmpeg-attached_pics to encode to pcm_s16le

2017-10-28 Thread Marton Balint
ffmpeg | branch: master | Marton Balint  | Fri Oct 27 22:14:23 
2017 +0200| [859144fb1fffc671069e2e119c14de0b66b648c4] | committer: Marton 
Balint

fate: change fate-ffmpeg-attached_pics to encode to pcm_s16le

Previously alac encoder was used, from a first glance I thought it is bitexact,
but it turns out it is using floating point arithmetic as well, so probably it
is not. Fixes fate failures on mingw32/64.

Signed-off-by: Marton Balint 

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

 tests/fate/ffmpeg.mak   |   6 +-
 tests/ref/fate/ffmpeg-attached_pics | 259 ++--
 2 files changed, 132 insertions(+), 133 deletions(-)

diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
index a806c05d45..0975af2612 100644
--- a/tests/fate/ffmpeg.mak
+++ b/tests/fate/ffmpeg.mak
@@ -30,9 +30,9 @@ fate-ffmpeg-filter_complex: CMD = framecrc -filter_complex 
color=d=1:r=5 -fflags
 FATE_FFMPEG-$(call ALLYES, AEVALSRC_FILTER ASETNSAMPLES_FILTER 
AC3_FIXED_ENCODER) += fate-ffmpeg-filter_complex_audio
 fate-ffmpeg-filter_complex_audio: CMD = framecrc -filter_complex 
"aevalsrc=0:d=0.1,asetnsamples=1537" -c ac3_fixed
 
-# Ticket 6375
-FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER PNG_DECODER ALAC_DECODER 
ALAC_ENCODER) += fate-ffmpeg-attached_pics
-fate-ffmpeg-attached_pics: CMD = threads=2 framecrc -i 
$(TARGET_SAMPLES)/lossless-audio/inside.m4a -acodec alac -max_muxing_queue_size 
16
+# Ticket 6375, use case of NoX
+FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER PNG_DECODER ALAC_DECODER 
PCM_S16LE_ENCODER RAWVIDEO_ENCODER) += fate-ffmpeg-attached_pics
+fate-ffmpeg-attached_pics: CMD = threads=2 framecrc -i 
$(TARGET_SAMPLES)/lossless-audio/inside.m4a -c:a pcm_s16le 
-max_muxing_queue_size 16
 
 FATE_SAMPLES_FFMPEG-$(CONFIG_COLORKEY_FILTER) += fate-ffmpeg-filter_colorkey
 fate-ffmpeg-filter_colorkey: tests/data/filtergraphs/colorkey
diff --git a/tests/ref/fate/ffmpeg-attached_pics 
b/tests/ref/fate/ffmpeg-attached_pics
index 3a0f151819..ee2f20638e 100644
--- a/tests/ref/fate/ffmpeg-attached_pics
+++ b/tests/ref/fate/ffmpeg-attached_pics
@@ -1,4 +1,3 @@
-#extradata 1:   36, 0x45f80468
 #tb 0: 1/9
 #media_type 0: video
 #codec_id 0: rawvideo
@@ -6,136 +5,136 @@
 #sar 0: 2834/2834
 #tb 1: 1/44100
 #media_type 1: audio
-#codec_id 1: alac
+#codec_id 1: pcm_s16le
 #sample_rate 1: 44100
 #channel_layout 1: 3
 #channel_layout_name 1: stereo
 0,  0,  0,0,   12, 0x748cc771
-1,  0,  0, 4096,   32, 0x204b0676
-1,   4096,   4096, 4096, 5826, 0x56583236
-1,   8192,   8192, 4096, 5532, 0x5f047492
-1,  12288,  12288, 4096, 5245, 0xaa3f1897
-1,  16384,  16384, 4096, 4782, 0x392f3ac3
-1,  20480,  20480, 4096, 4602, 0x9bd6ffad
-1,  24576,  24576, 4096, 4357, 0x5df6530b
-1,  28672,  28672, 4096, 7443, 0x38ce542b
-1,  32768,  32768, 4096, 5803, 0x196ae519
-1,  36864,  36864, 4096, 5619, 0xd436cd94
-1,  40960,  40960, 4096, 4896, 0x42df7109
-1,  45056,  45056, 4096, 4755, 0xfbfdfd5f
-1,  49152,  49152, 4096, 4597, 0x93f3ce66
-1,  53248,  53248, 4096, , 0x56ffe620
-1,  57344,  57344, 4096, 5498, 0xa0865dc8
-1,  61440,  61440, 4096, 5343, 0x42134619
-1,  65536,  65536, 4096, 6261, 0xd60d1379
-1,  69632,  69632, 4096, 4496, 0x0eb49c68
-1,  73728,  73728, 4096, 4336, 0x21d541bd
-1,  77824,  77824, 4096, 8395, 0x02030a38
-1,  81920,  81920, 4096, 8174, 0x47bdb71d
-1,  86016,  86016, 4096, 7434, 0x2304318e
-1,  90112,  90112, 4096, 7619, 0x80e6a037
-1,  94208,  94208, 4096, 6086, 0xd3438d2f
-1,  98304,  98304, 4096, 6075, 0xd6019fbf
-1, 102400, 102400, 4096, 9597, 0x28f46a38
-1, 106496, 106496, 4096,10287, 0x9dbf0938
-1, 110592, 110592, 4096,10537, 0xc417fb81
-1, 114688, 114688, 4096,10360, 0xc580caa3
-1, 118784, 118784, 4096, 9778, 0xb9c2d3e5
-1, 122880, 122880, 4096,10307, 0x05b1b271
-1, 126976, 126976, 4096,11289, 0x97f07c63
-1, 131072, 131072, 4096,11561, 0x8a45194a
-1, 135168, 135168, 4096,11327, 0x86587829
-1, 139264, 139264, 4096,11347, 0x15659d6e
-1, 143360, 143360, 4096,11006, 0x9a002c7f
-1, 147456, 147456, 4096,11147, 0x853955e0
-1, 151552, 151552, 4096,11025, 0x7bdafbda
-1, 155648, 155648, 4096,11561, 0x2ec43d86
-1, 159744, 159744, 4096,11329, 0x6eaba39a
-1, 163840, 163840, 4096,10886, 0x5c31b777
-1, 167936, 167936, 4096,11505, 0xc

[FFmpeg-cvslog] mjpeg: Report non-3 component rgb lossless as not supported

2017-10-28 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Mon Apr 17 
19:11:57 2017 +| [f2c469b73f8ac3dd6a98d38281f61b68ea6dd336] | committer: 
Luca Barbato

mjpeg: Report non-3 component rgb lossless as not supported

Bug-Id: 1043
CC: libav-sta...@libav.org

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

 libavcodec/mjpegdec.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 13d3e8cb02..296ca59018 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1129,6 +1129,12 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const 
uint8_t *mb_bitmask,
 for (i = s->mjpb_skiptosod; i > 0; i--)
 skip_bits(&s->gb, 8);
 
+if (s->lossless && s->rgb && nb_components != 3) {
+avpriv_request_sample(s->avctx,
+  "Lossless RGB image without 3 components");
+return AVERROR_PATCHWELCOME;
+}
+
 next_field:
 for (i = 0; i < nb_components; i++)
 s->last_dc[i] = 1024;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit 'f2c469b73f8ac3dd6a98d38281f61b68ea6dd336'

2017-10-28 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Oct 28 18:08:41 
2017 -0300| [1232b349175cf8882734300af727a4a1149a24d6] | committer: James Almer

Merge commit 'f2c469b73f8ac3dd6a98d38281f61b68ea6dd336'

* commit 'f2c469b73f8ac3dd6a98d38281f61b68ea6dd336':
  mjpeg: Report non-3 component rgb lossless as not supported

[15:56:27]  michaelni: can't reproduce the failure f2c469b73f is 
trying to "fix"
[15:56:30]  do we support what that commit claims is unsupported?
[16:56:54]  jamrial, yes, we support lossless rgba

This commit is a noop.

Merged-by: James Almer 

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



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '1731c3530bffb876deb9e00dfffdf9841a8412cd'

2017-10-28 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Oct 28 18:16:01 
2017 -0300| [495d3b2cc3fa0598f54d9c50ab4aa9dcea6134ce] | committer: James Almer

Merge commit '1731c3530bffb876deb9e00dfffdf9841a8412cd'

* commit '1731c3530bffb876deb9e00dfffdf9841a8412cd':
  mm: Skip unexpected audio packets

This commit is a noop. The generic code already drops packets from
non-existant streams.

Merged-by: James Almer 

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



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] mm: Skip unexpected audio packets

2017-10-28 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Mon Apr 17 
19:25:35 2017 +| [1731c3530bffb876deb9e00dfffdf9841a8412cd] | committer: 
Luca Barbato

mm: Skip unexpected audio packets

Bug-Id: 1046
CC: libav-sta...@libav.org

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

 libavformat/mm.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/mm.c b/libavformat/mm.c
index 16505502fd..a94d2611a2 100644
--- a/libavformat/mm.c
+++ b/libavformat/mm.c
@@ -174,6 +174,12 @@ static int read_packet(AVFormatContext *s,
 return 0;
 
 case MM_TYPE_AUDIO :
+if (s->nb_streams != 2) {
+av_log(s, AV_LOG_ERROR,
+   "Unexpected audio packet, skipping\n");
+avio_skip(pb, length);
+return AVERROR_INVALIDDATA;
+}
 if (av_get_packet(s->pb, pkt, length)<0)
 return AVERROR(ENOMEM);
 pkt->size = length;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit 'e00db9f78bb475ed5103364f61892f4e75ef89ba'

2017-10-28 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Oct 28 18:18:41 
2017 -0300| [f568d9d0baffb4c3c82a806a6aade464a92052aa] | committer: James Almer

Merge commit 'e00db9f78bb475ed5103364f61892f4e75ef89ba'

* commit 'e00db9f78bb475ed5103364f61892f4e75ef89ba':
  checkasm: hevc: Add a hevc_ prefix to the add_residual functions

Merged-by: James Almer 

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

 tests/checkasm/hevc_add_res.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/checkasm/hevc_add_res.c b/tests/checkasm/hevc_add_res.c
index 185656ae8c..e92c6b427b 100644
--- a/tests/checkasm/hevc_add_res.c
+++ b/tests/checkasm/hevc_add_res.c
@@ -61,7 +61,7 @@ static void check_add_res(HEVCDSPContext h, int bit_depth)
 memcpy(res1, res0, sizeof(*res0) * size);
 memcpy(dst1, dst0, sizeof(int16_t) * size);
 
-if (check_func(h.add_residual[i - 2], "add_res_%dx%d_%d", block_size, 
block_size, bit_depth)) {
+if (check_func(h.add_residual[i - 2], "hevc_add_res_%dx%d_%d", 
block_size, block_size, bit_depth)) {
 call_ref(dst0, res0, stride);
 call_new(dst1, res1, stride);
 if (memcmp(dst0, dst1, size))


==

diff --cc tests/checkasm/hevc_add_res.c
index 185656ae8c,c9ed86b5cc..e92c6b427b
--- a/tests/checkasm/hevc_add_res.c
+++ b/tests/checkasm/hevc_add_res.c
@@@ -59,9 -59,9 +59,9 @@@ static void check_add_res(HEVCDSPContex
  randomize_buffers(res0, size);
  randomize_buffers2(dst0, size);
  memcpy(res1, res0, sizeof(*res0) * size);
 -memcpy(dst1, dst0, size);
 +memcpy(dst1, dst0, sizeof(int16_t) * size);
  
- if (check_func(h.add_residual[i - 2], "add_res_%dx%d_%d", block_size, 
block_size, bit_depth)) {
+ if (check_func(h.add_residual[i - 2], "hevc_add_res_%dx%d_%d", 
block_size, block_size, bit_depth)) {
  call_ref(dst0, res0, stride);
  call_new(dst1, res1, stride);
  if (memcmp(dst0, dst1, size))

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] checkasm: hevc: Add a hevc_ prefix to the add_residual functions

2017-10-28 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Wed Apr 19 
10:37:51 2017 +0300| [e00db9f78bb475ed5103364f61892f4e75ef89ba] | committer: 
Martin Storsjö

checkasm: hevc: Add a hevc_ prefix to the add_residual functions

This makes it easier to group them with the rest when running e.g.
--bench=hevc.

Signed-off-by: Martin Storsjö 

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

 tests/checkasm/hevc_add_res.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/checkasm/hevc_add_res.c b/tests/checkasm/hevc_add_res.c
index 2cd97eaf36..c9ed86b5cc 100644
--- a/tests/checkasm/hevc_add_res.c
+++ b/tests/checkasm/hevc_add_res.c
@@ -61,7 +61,7 @@ static void check_add_res(HEVCDSPContext h, int bit_depth)
 memcpy(res1, res0, sizeof(*res0) * size);
 memcpy(dst1, dst0, size);
 
-if (check_func(h.add_residual[i - 2], "add_res_%dx%d_%d", block_size, 
block_size, bit_depth)) {
+if (check_func(h.add_residual[i - 2], "hevc_add_res_%dx%d_%d", 
block_size, block_size, bit_depth)) {
 call_ref(dst0, res0, stride);
 call_new(dst1, res1, stride);
 if (memcmp(dst0, dst1, size))

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] qsvenc: Use MFXVideoENCODE_Query() to update the parameters

2017-10-28 Thread Aaron Levinson
ffmpeg | branch: master | Aaron Levinson  | Sun Apr 16 
18:07:42 2017 -0700| [b22094d74901fb3ac203c8322f8d84aded470bfb] | committer: 
Luca Barbato

qsvenc: Use MFXVideoENCODE_Query() to update the parameters

Fill out the default/unset parameters with ones actually in use.

Matches the current MediaSDK example code.

Signed-off-by: Luca Barbato 

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

 libavcodec/qsvenc.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index bd8c24321e..6ac5ca1340 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -757,10 +757,18 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext 
*q)
 if (ret < 0)
 return ret;
 
+ret = MFXVideoENCODE_Query(q->session, &q->param, &q->param);
+if (ret == MFX_WRN_PARTIAL_ACCELERATION) {
+av_log(avctx, AV_LOG_WARNING, "Encoder will work with partial HW 
acceleration\n");
+} else if (ret < 0) {
+return ff_qsv_print_error(avctx, ret,
+  "Error querying encoder params");
+}
+
 ret = MFXVideoENCODE_QueryIOSurf(q->session, &q->param, &q->req);
 if (ret < 0)
 return ff_qsv_print_error(avctx, ret,
-  "Error querying the encoding parameters");
+  "Error querying (IOSurf) the encoding 
parameters");
 
 if (opaque_alloc) {
 ret = qsv_init_opaque_alloc(avctx, q);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] qsvenc: Make sure the interlaced encoding works

2017-10-28 Thread Aaron Levinson
ffmpeg | branch: master | Aaron Levinson  | Sun Apr 16 
18:06:37 2017 -0700| [8fd8f91e47f33cd82371a97ac81afc476144964f] | committer: 
Luca Barbato

qsvenc: Make sure the interlaced encoding works

And reduce the vertical alignment constraint when possible to reduce the
memory usage.

Signed-off-by: Luca Barbato 

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

 libavcodec/qsvenc.c | 29 +++--
 libavcodec/qsvenc.h |  1 +
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 6ac5ca1340..7c6ad09dda 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -366,8 +366,6 @@ static int init_video_param(AVCodecContext *avctx, 
QSVEncContext *q)
 return AVERROR_BUG;
 q->param.mfx.CodecId = ret;
 
-q->width_align = avctx->codec_id == AV_CODEC_ID_HEVC ? 32 : 16;
-
 if (avctx->level > 0)
 q->param.mfx.CodecLevel = avctx->level;
 
@@ -389,20 +387,39 @@ static int init_video_param(AVCodecContext *avctx, 
QSVEncContext *q)
 
 ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC);
 
-q->param.mfx.FrameInfo.Width  = FFALIGN(avctx->width, 
q->width_align);
-q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, 32);
 q->param.mfx.FrameInfo.CropX  = 0;
 q->param.mfx.FrameInfo.CropY  = 0;
 q->param.mfx.FrameInfo.CropW  = avctx->width;
 q->param.mfx.FrameInfo.CropH  = avctx->height;
 q->param.mfx.FrameInfo.AspectRatioW   = avctx->sample_aspect_ratio.num;
 q->param.mfx.FrameInfo.AspectRatioH   = avctx->sample_aspect_ratio.den;
-q->param.mfx.FrameInfo.PicStruct  = MFX_PICSTRUCT_PROGRESSIVE;
 q->param.mfx.FrameInfo.ChromaFormat   = MFX_CHROMAFORMAT_YUV420;
 q->param.mfx.FrameInfo.BitDepthLuma   = desc->comp[0].depth;
 q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth;
 q->param.mfx.FrameInfo.Shift  = desc->comp[0].depth > 8;
 
+// TODO:  detect version of MFX--if the minor version is greater than
+// or equal to 19, then can use the same alignment settings as H.264
+// for HEVC
+q->width_align = avctx->codec_id == AV_CODEC_ID_HEVC ? 32 : 16;
+q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, q->width_align);
+
+if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) {
+// it is important that PicStruct be setup correctly from the
+// start--otherwise, encoding doesn't work and results in a bunch
+// of incompatible video parameter errors
+q->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_FIELD_TFF;
+// height alignment always must be 32 for interlaced video
+q->height_align = 32;
+} else {
+q->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
+// for progressive video, the height should be aligned to 16 for
+// H.264.  For HEVC, depending on the version of MFX, it should be
+// either 32 or 16.  The lower number is better if possible.
+q->height_align = avctx->codec_id == AV_CODEC_ID_HEVC ? 32 : 16;
+}
+q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, q->height_align);
+
 if (avctx->hw_frames_ctx) {
 AVHWFramesContext *frames_ctx = 
(AVHWFramesContext*)avctx->hw_frames_ctx->data;
 AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx;
@@ -898,7 +915,7 @@ static int submit_frame(QSVEncContext *q, const AVFrame 
*frame,
 } else {
 /* make a copy if the input is not padded as libmfx requires */
 if (frame->height & 31 || frame->linesize[0] & (q->width_align - 1)) {
-qf->frame->height = FFALIGN(frame->height, 32);
+qf->frame->height = FFALIGN(frame->height, q->height_align);
 qf->frame->width  = FFALIGN(frame->width, q->width_align);
 
 ret = ff_get_buffer(q->avctx, qf->frame, AV_GET_BUFFER_FLAG_REF);
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index 13e4c47481..a6399040e9 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -79,6 +79,7 @@ typedef struct QSVEncContext {
 
 int packet_size;
 int width_align;
+int height_align;
 
 mfxVideoParam param;
 mfxFrameAllocRequest req;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '8fd8f91e47f33cd82371a97ac81afc476144964f'

2017-10-28 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Oct 28 18:30:31 
2017 -0300| [49fe0ecd405ddcee8840a98b3f09f0efe41b233d] | committer: James Almer

Merge commit '8fd8f91e47f33cd82371a97ac81afc476144964f'

* commit '8fd8f91e47f33cd82371a97ac81afc476144964f':
  qsvenc: Make sure the interlaced encoding works
  qsvenc: Use MFXVideoENCODE_Query() to update the parameters

This commit is a noop, see
dd8319767e1674d030b5d803c43029e67db5efb8
ae5b67ee64bec00c52881ff8426fddaf477341c1

Merged-by: James Almer 

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



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavfi/palettegen: Allow setting the background colour.

2017-10-28 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Tue Oct 17 
23:39:59 2017 +0200| [1da8c4ec85c150349b81237d13d84cb16404243d] | committer: 
Carl Eugen Hoyos

lavfi/palettegen: Allow setting the background colour.

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

 doc/filters.texi| 3 +++
 libavfilter/version.h   | 2 +-
 libavfilter/vf_palettegen.c | 5 -
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 64e84d9b45..6f6dfcff48 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -11458,6 +11458,9 @@ If not set, the maximum of colors in the palette will 
be 256. You probably want
 to disable this option for a standalone image.
 Set by default.
 
+@item transparency_color
+Set the color that will be used as background for transparency.
+
 @item stats_mode
 Set statistics mode.
 
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 5bcf9b4df0..908dc4938a 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -31,7 +31,7 @@
 
 #define LIBAVFILTER_VERSION_MAJOR   7
 #define LIBAVFILTER_VERSION_MINOR   0
-#define LIBAVFILTER_VERSION_MICRO 100
+#define LIBAVFILTER_VERSION_MICRO 101
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
diff --git a/libavfilter/vf_palettegen.c b/libavfilter/vf_palettegen.c
index 03de317348..2a04ae5c4d 100644
--- a/libavfilter/vf_palettegen.c
+++ b/libavfilter/vf_palettegen.c
@@ -27,6 +27,7 @@
 #include "libavutil/internal.h"
 #include "libavutil/opt.h"
 #include "libavutil/qsort.h"
+#include "libavutil/intreadwrite.h"
 #include "avfilter.h"
 #include "internal.h"
 
@@ -74,6 +75,7 @@ typedef struct PaletteGenContext {
 struct range_box boxes[256];// define the segmentation of the 
colorspace (the final palette)
 int nb_boxes;   // number of boxes (increase will 
segmenting them)
 int palette_pushed; // if the palette frame is pushed 
into the outlink or not
+uint8_t[4] transparency_color;  // background color for 
transparency
 } PaletteGenContext;
 
 #define OFFSET(x) offsetof(PaletteGenContext, x)
@@ -81,6 +83,7 @@ typedef struct PaletteGenContext {
 static const AVOption palettegen_options[] = {
 { "max_colors", "set the maximum number of colors to use in the palette", 
OFFSET(max_colors), AV_OPT_TYPE_INT, {.i64=256}, 4, 256, FLAGS },
 { "reserve_transparent", "reserve a palette entry for transparency", 
OFFSET(reserve_transparent), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS },
+{ "transparency_color", "set a background color for transparency", 
OFFSET(transparency_color), AV_OPT_TYPE_COLOR, {.str="lime"}, CHAR_MIN, 
CHAR_MAX, FLAGS },
 { "stats_mode", "set statistics mode", OFFSET(stats_mode), 
AV_OPT_TYPE_INT, {.i64=STATS_MODE_ALL_FRAMES}, 0, NB_STATS_MODE-1, FLAGS, 
"mode" },
 { "full", "compute full frame histograms", 0, AV_OPT_TYPE_CONST, 
{.i64=STATS_MODE_ALL_FRAMES}, INT_MIN, INT_MAX, FLAGS, "mode" },
 { "diff", "compute histograms only for the part that differs from 
previous frame", 0, AV_OPT_TYPE_CONST, {.i64=STATS_MODE_DIFF_FRAMES}, INT_MIN, 
INT_MAX, FLAGS, "mode" },
@@ -250,7 +253,7 @@ static void write_palette(AVFilterContext *ctx, AVFrame 
*out)
 
 if (s->reserve_transparent) {
 av_assert0(s->nb_boxes < 256);
-pal[out->width - pal_linesize - 1] = 0xff00; // add a green 
transparent color
+pal[out->width - pal_linesize - 1] = AV_RB32(&s->transparency_color) 
>> 8;
 }
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavfi/palettegen: Fix compilation after 1da8c4e.

2017-10-28 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Sun Oct 29 
02:35:36 2017 +0200| [8b43039fe19cacb8e7e0950ae50851cb91fa34e4] | committer: 
Carl Eugen Hoyos

lavfi/palettegen: Fix compilation after 1da8c4e.

Found-by: James Almer

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

 libavfilter/vf_palettegen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_palettegen.c b/libavfilter/vf_palettegen.c
index 2a04ae5c4d..5ff73e6b2b 100644
--- a/libavfilter/vf_palettegen.c
+++ b/libavfilter/vf_palettegen.c
@@ -75,7 +75,7 @@ typedef struct PaletteGenContext {
 struct range_box boxes[256];// define the segmentation of the 
colorspace (the final palette)
 int nb_boxes;   // number of boxes (increase will 
segmenting them)
 int palette_pushed; // if the palette frame is pushed 
into the outlink or not
-uint8_t[4] transparency_color;  // background color for 
transparency
+uint8_t transparency_color[4];  // background color for 
transparency
 } PaletteGenContext;
 
 #define OFFSET(x) offsetof(PaletteGenContext, x)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat: remove use of deprecated AVFMT_FLAG_KEEP_SIDE_DATA flag

2017-10-28 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Oct 28 23:47:22 
2017 -0300| [ca2b7794234cccd6c4ae548c4bd2eac5c53b80f2] | committer: James Almer

avformat: remove use of deprecated AVFMT_FLAG_KEEP_SIDE_DATA flag

It has no effect whatsoever since the major bump.
Replace the flag's documentation to reflect this as well.

Signed-off-by: James Almer 

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

 fftools/ffmpeg_opt.c| 2 --
 fftools/ffprobe.c   | 2 --
 libavformat/avformat.h  | 2 +-
 libavformat/options_table.h | 2 +-
 libavformat/tests/seek.c| 2 --
 5 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 3a947d8686..f4ff1605f0 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -991,7 +991,6 @@ static int open_input_file(OptionsContext *o, const char 
*filename)
 print_error(filename, AVERROR(ENOMEM));
 exit_program(1);
 }
-ic->flags |= AVFMT_FLAG_KEEP_SIDE_DATA;
 if (o->nb_audio_sample_rate) {
 av_dict_set_int(&o->g->format_opts, "sample_rate", 
o->audio_sample_rate[o->nb_audio_sample_rate - 1].u.i, 0);
 }
@@ -1989,7 +1988,6 @@ static int read_ffserver_streams(OptionsContext *o, 
AVFormatContext *s, const ch
 int i, err;
 AVFormatContext *ic = avformat_alloc_context();
 
-ic->flags |= AVFMT_FLAG_KEEP_SIDE_DATA;
 ic->interrupt_callback = int_cb;
 err = avformat_open_input(&ic, filename, NULL, NULL);
 if (err < 0)
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index b2e8949d9f..ab36f8bc42 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2828,8 +2828,6 @@ static int open_input_file(InputFile *ifile, const char 
*filename)
 exit_program(1);
 }
 
-fmt_ctx->flags |= AVFMT_FLAG_KEEP_SIDE_DATA;
-
 if (!av_dict_get(format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE)) {
 av_dict_set(&format_opts, "scan_all_pmts", "1", 
AV_DICT_DONT_OVERWRITE);
 scan_all_pmts_set = 1;
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 65fc9eac0c..edb0c601f9 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1444,7 +1444,7 @@ typedef struct AVFormatContext {
 #define AVFMT_FLAG_SORT_DTS0x1 ///< try to interleave outputted 
packets by dts (using this flag can slow demuxing down)
 #define AVFMT_FLAG_PRIV_OPT0x2 ///< Enable use of private options by 
delaying codec open (this could be made default once all code is converted)
 #if FF_API_LAVF_KEEPSIDE_FLAG
-#define AVFMT_FLAG_KEEP_SIDE_DATA 0x4 ///< Don't merge side data but keep 
it separate. Deprecated, will be the default.
+#define AVFMT_FLAG_KEEP_SIDE_DATA 0x4 ///< Deprecated, does nothing.
 #endif
 #define AVFMT_FLAG_FAST_SEEK   0x8 ///< Enable fast, but inaccurate seeks 
for some formats
 #define AVFMT_FLAG_SHORTEST   0x10 ///< Stop muxing when the shortest 
stream stops.
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index 118086df66..b60d031f67 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -49,7 +49,7 @@ static const AVOption avformat_options[] = {
 {"discardcorrupt", "discard corrupted frames", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVFMT_FLAG_DISCARD_CORRUPT }, INT_MIN, INT_MAX, D, "fflags"},
 {"sortdts", "try to interleave outputted packets by dts", 0, 
AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_SORT_DTS }, INT_MIN, INT_MAX, D, 
"fflags"},
 #if FF_API_LAVF_KEEPSIDE_FLAG
-{"keepside", "don't merge side data", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVFMT_FLAG_KEEP_SIDE_DATA }, INT_MIN, INT_MAX, D, "fflags"},
+{"keepside", "deprecated, does nothing", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVFMT_FLAG_KEEP_SIDE_DATA }, INT_MIN, INT_MAX, D, "fflags"},
 #endif
 {"fastseek", "fast but inaccurate seeks", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVFMT_FLAG_FAST_SEEK }, INT_MIN, INT_MAX, D, "fflags"},
 {"latm", "enable RTP MP4A-LATM payload", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVFMT_FLAG_MP4A_LATM }, INT_MIN, INT_MAX, E, "fflags"},
diff --git a/libavformat/tests/seek.c b/libavformat/tests/seek.c
index 5cf3a123e3..7ed56ba4ef 100644
--- a/libavformat/tests/seek.c
+++ b/libavformat/tests/seek.c
@@ -67,8 +67,6 @@ int main(int argc, char **argv)
 int frame_count = 1;
 int duration = 4;
 
-ic->flags |= AVFMT_FLAG_KEEP_SIDE_DATA;
-
 for(i=2; ihttp://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/hlsenc: fix base_output_dirname is null when basename_size is 0 bug

2017-10-28 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Sun Oct 29 
12:30:44 2017 +0800| [f5208307618d992ddd2d96866cf5a267c9bc7165] | committer: 
Steven Liu

avformat/hlsenc: fix base_output_dirname is null when basename_size is 0 bug

fix ticket id: #6777
when use argument hls_segment_filename, the basename_size will be 0

Signed-off-by: Steven Liu 

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

 libavformat/hlsenc.c | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 418f153c6f..55ce800c5a 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1335,6 +1335,7 @@ static int hls_write_header(AVFormatContext *s)
 AVDictionary *options = NULL;
 int basename_size = 0;
 int vtt_basename_size = 0;
+int fmp4_init_filename_len = strlen(hls->fmp4_init_filename) + 1;
 
 if (hls->segment_type == SEGMENT_TYPE_FMP4) {
 pattern = "%d.m4s";
@@ -1445,7 +1446,6 @@ static int hls_write_header(AVFormatContext *s)
 }
 
 if (av_strcasecmp(hls->fmp4_init_filename, "init.mp4")) {
-int fmp4_init_filename_len = strlen(hls->fmp4_init_filename) + 1;
 hls->base_output_dirname = av_malloc(fmp4_init_filename_len);
 if (!hls->base_output_dirname) {
 ret = AVERROR(ENOMEM);
@@ -1453,19 +1453,25 @@ static int hls_write_header(AVFormatContext *s)
 }
 av_strlcpy(hls->base_output_dirname, hls->fmp4_init_filename, 
fmp4_init_filename_len);
 } else {
-hls->base_output_dirname = av_malloc(basename_size);
+if (basename_size > 0) {
+hls->base_output_dirname = av_malloc(basename_size);
+} else {
+hls->base_output_dirname = 
av_malloc(strlen(hls->fmp4_init_filename));
+}
 if (!hls->base_output_dirname) {
 ret = AVERROR(ENOMEM);
 goto fail;
 }
 
-av_strlcpy(hls->base_output_dirname, s->filename, basename_size);
-p = strrchr(hls->base_output_dirname, '/');
+if (basename_size > 0) {
+av_strlcpy(hls->base_output_dirname, s->filename, basename_size);
+p = strrchr(hls->base_output_dirname, '/');
+}
 if (p) {
 *(p + 1) = '\0';
 av_strlcat(hls->base_output_dirname, hls->fmp4_init_filename, 
basename_size);
 } else {
-av_strlcpy(hls->base_output_dirname, hls->fmp4_init_filename, 
basename_size);
+av_strlcpy(hls->base_output_dirname, hls->fmp4_init_filename, 
fmp4_init_filename_len);
 }
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/hlsenc: fix missing first segment bug in fmp4 mode

2017-10-28 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Sun Oct 29 
12:31:49 2017 +0800| [c3e279e75227946046ccb447d355b557118a616c] | committer: 
Steven Liu

avformat/hlsenc: fix missing first segment bug in fmp4 mode

fix ticket id: #6776
fix code logic error, need not check first segment.

Signed-off-by: Steven Liu 

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

 libavformat/hlsenc.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 55ce800c5a..530fc11305 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1080,7 +1080,7 @@ static int hls_window(AVFormatContext *s, int last)
 avio_printf(out, ",BYTERANGE=\"%"PRId64"@%"PRId64"\"", 
en->size, en->pos);
 }
 avio_printf(out, "\n");
-} else {
+}
 if (hls->flags & HLS_ROUND_DURATIONS)
 avio_printf(out, "#EXTINF:%ld,\n",  lrint(en->duration));
 else
@@ -1088,7 +1088,7 @@ static int hls_window(AVFormatContext *s, int last)
 if (byterange_mode)
 avio_printf(out, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n",
 en->size, en->pos);
-}
+
 if (hls->flags & HLS_PROGRAM_DATE_TIME) {
 time_t tt, wrongsecs;
 int milli;
@@ -1113,11 +1113,9 @@ static int hls_window(AVFormatContext *s, int last)
 avio_printf(out, "#EXT-X-PROGRAM-DATE-TIME:%s.%03d%s\n", buf0, 
milli, buf1);
 prog_date_time += en->duration;
 }
-if (!((hls->segment_type == SEGMENT_TYPE_FMP4) && (en == 
hls->segments))) {
 if (hls->baseurl)
 avio_printf(out, "%s", hls->baseurl);
 avio_printf(out, "%s\n", en->filename);
-}
 }
 
 if (last && (hls->flags & HLS_OMIT_ENDLIST)==0)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/hlsenc: reindent hlsenc code

2017-10-28 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Sun Oct 29 
12:32:24 2017 +0800| [073986c5aeb84e51b202f908d5ede059d371d57b] | committer: 
Steven Liu

avformat/hlsenc: reindent hlsenc code

Signed-off-by: Steven Liu 

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

 libavformat/hlsenc.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 530fc11305..0ea93480a5 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1081,13 +1081,13 @@ static int hls_window(AVFormatContext *s, int last)
 }
 avio_printf(out, "\n");
 }
-if (hls->flags & HLS_ROUND_DURATIONS)
-avio_printf(out, "#EXTINF:%ld,\n",  lrint(en->duration));
-else
-avio_printf(out, "#EXTINF:%f,\n", en->duration);
-if (byterange_mode)
-avio_printf(out, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n",
-en->size, en->pos);
+if (hls->flags & HLS_ROUND_DURATIONS)
+avio_printf(out, "#EXTINF:%ld,\n",  lrint(en->duration));
+else
+avio_printf(out, "#EXTINF:%f,\n", en->duration);
+if (byterange_mode)
+avio_printf(out, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n",
+en->size, en->pos);
 
 if (hls->flags & HLS_PROGRAM_DATE_TIME) {
 time_t tt, wrongsecs;
@@ -1113,9 +1113,9 @@ static int hls_window(AVFormatContext *s, int last)
 avio_printf(out, "#EXT-X-PROGRAM-DATE-TIME:%s.%03d%s\n", buf0, 
milli, buf1);
 prog_date_time += en->duration;
 }
-if (hls->baseurl)
-avio_printf(out, "%s", hls->baseurl);
-avio_printf(out, "%s\n", en->filename);
+if (hls->baseurl)
+avio_printf(out, "%s", hls->baseurl);
+avio_printf(out, "%s\n", en->filename);
 }
 
 if (last && (hls->flags & HLS_OMIT_ENDLIST)==0)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog