[FFmpeg-cvslog] lavc/libdavs2: output delayed frames

2018-12-02 Thread hwrenx
ffmpeg | branch: master | hwrenx  | Mon Dec  3 14:37:42 2018 
+0800| [42597d6fa03c679c00ea8b42d6af53efab199eb6] | committer: Steven Liu

lavc/libdavs2: output delayed frames

Signed-off-by: hwrenx 

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

 libavcodec/libdavs2.c | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index 7fdafdab81..5100f9f7fb 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -125,6 +125,23 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic,
 return 1;
 }
 
+static int send_delayed_frame(AVCodecContext *avctx, AVFrame *frame, int 
*got_frame)
+{
+DAVS2Context *cad  = avctx->priv_data;
+int   ret  = DAVS2_DEFAULT;
+
+ret = davs2_decoder_flush(cad->decoder, &cad->headerset, &cad->out_frame);
+if (ret == DAVS2_ERROR) {
+av_log(avctx, AV_LOG_ERROR, "Decoder error: can't flush delayed 
frame\n");
+return AVERROR_EXTERNAL;
+}
+if (ret == DAVS2_GOT_FRAME) {
+*got_frame = davs2_dump_frames(avctx, &cad->out_frame, 
&cad->headerset, ret, frame);
+davs2_decoder_frame_unref(cad->decoder, &cad->out_frame);
+}
+return ret;
+}
+
 static av_cold int davs2_end(AVCodecContext *avctx)
 {
 DAVS2Context *cad = avctx->priv_data;
@@ -147,8 +164,9 @@ static int davs2_decode_frame(AVCodecContext *avctx, void 
*data,
 AVFrame  *frame= data;
 int   ret  = DAVS2_DEFAULT;
 
+/* end of stream, output what is still in the buffers */
 if (!buf_size) {
-return 0;
+return send_delayed_frame(avctx, frame, got_frame);
 }
 
 cad->packet.data = buf_ptr;

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


[FFmpeg-cvslog] lavc/libdavs2: fix function return value error

2018-12-02 Thread hwrenx
ffmpeg | branch: master | hwrenx  | Mon Dec  3 14:42:43 2018 
+0800| [8ef0fdaafcf0e80d16c1d6117e60172906879879] | committer: Steven Liu

lavc/libdavs2: fix function return value error

Signed-off-by: hwrenx 

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

 libavcodec/libdavs2.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index 5100f9f7fb..37635bbef9 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -58,7 +58,7 @@ static av_cold int davs2_init(AVCodecContext *avctx)
 return 0;
 }
 
-static int davs2_dump_frames(AVCodecContext *avctx, davs2_picture_t *pic,
+static int davs2_dump_frames(AVCodecContext *avctx, davs2_picture_t *pic, int 
*got_frame,
  davs2_seq_info_t *headerset, int ret_type, 
AVFrame *frame)
 {
 DAVS2Context *cad= avctx->priv_data;
@@ -66,8 +66,10 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic,
 int plane = 0;
 int line  = 0;
 
-if (!headerset)
+if (!headerset) {
+*got_frame = 0;
 return 0;
+}
 
 if (!pic || ret_type == DAVS2_GOT_HEADER) {
 avctx->width = headerset->width;
@@ -76,6 +78,7 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic,
AV_PIX_FMT_YUV420P10 : AV_PIX_FMT_YUV420P;
 
 avctx->framerate = av_d2q(headerset->frame_rate,4096);
+*got_frame = 0;
 return 0;
 }
 
@@ -122,7 +125,8 @@ static int davs2_dump_frames(AVCodecContext *avctx, 
davs2_picture_t *pic,
 frame->pts   = cad->out_frame.pts;
 frame->format= avctx->pix_fmt;
 
-return 1;
+*got_frame = 1;
+return 0;
 }
 
 static int send_delayed_frame(AVCodecContext *avctx, AVFrame *frame, int 
*got_frame)
@@ -136,7 +140,7 @@ static int send_delayed_frame(AVCodecContext *avctx, 
AVFrame *frame, int *got_fr
 return AVERROR_EXTERNAL;
 }
 if (ret == DAVS2_GOT_FRAME) {
-*got_frame = davs2_dump_frames(avctx, &cad->out_frame, 
&cad->headerset, ret, frame);
+ret = davs2_dump_frames(avctx, &cad->out_frame, got_frame, 
&cad->headerset, ret, frame);
 davs2_decoder_frame_unref(cad->decoder, &cad->out_frame);
 }
 return ret;
@@ -185,11 +189,11 @@ static int davs2_decode_frame(AVCodecContext *avctx, void 
*data,
 ret = davs2_decoder_recv_frame(cad->decoder, &cad->headerset, 
&cad->out_frame);
 
 if (ret != DAVS2_DEFAULT) {
-*got_frame = davs2_dump_frames(avctx, &cad->out_frame, 
&cad->headerset, ret, frame);
+ret = davs2_dump_frames(avctx, &cad->out_frame, got_frame, 
&cad->headerset, ret, frame);
 davs2_decoder_frame_unref(cad->decoder, &cad->out_frame);
 }
 
-return buf_size;
+return ret == 0 ? buf_size : ret;
 }
 
 AVCodec ff_libdavs2_decoder = {

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


[FFmpeg-cvslog] libdavs2: update api version and enable avx option

2018-12-02 Thread hwrenx
ffmpeg | branch: master | hwrenx  | Mon Dec  3 14:37:05 2018 
+0800| [701cbbb58c76dbaa5c4e346e575cc3021d78fb02] | committer: Steven Liu

libdavs2: update api version and enable avx option

Signed-off-by: hwrenx 

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

 configure | 2 +-
 libavcodec/libdavs2.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 1870b4d189..330e55049f 100755
--- a/configure
+++ b/configure
@@ -6082,7 +6082,7 @@ enabled libcelt   && require libcelt celt/celt.h 
celt_decode -lcelt0 &&
 enabled libcaca   && require_pkg_config libcaca caca caca.h 
caca_create_canvas
 enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create 
-lcodec2
 enabled libdav1d  && require_pkg_config libdav1d "dav1d >= 0.0.1" 
"dav1d/dav1d.h" dav1d_version
-enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.5.115" 
davs2.h davs2_decoder_open
+enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.6.0" 
davs2.h davs2_decoder_open
 enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 
dc1394/dc1394.h dc1394_new
 enabled libdrm&& require_pkg_config libdrm libdrm xf86drm.h 
drmGetVersion
 enabled libfdk_aac&& { check_pkg_config libfdk_aac fdk-aac 
"fdk-aac/aacenc_lib.h" aacEncOpen ||
diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index 3da1498208..7fdafdab81 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -40,11 +40,14 @@ typedef struct DAVS2Context {
 static av_cold int davs2_init(AVCodecContext *avctx)
 {
 DAVS2Context *cad = avctx->priv_data;
+int cpu_flags = av_get_cpu_flags();
 
 /* init the decoder */
 cad->param.threads  = avctx->thread_count;
 cad->param.info_level   = 0;
 cad->decoder= davs2_decoder_open(&cad->param);
+cad->param.disable_avx  = !(cpu_flags & AV_CPU_FLAG_AVX &&
+cpu_flags & AV_CPU_FLAG_AVX2);
 
 if (!cad->decoder) {
 av_log(avctx, AV_LOG_ERROR, "decoder created error.");

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


[FFmpeg-cvslog] Revert "lavf/dashenc: Write media trailers when DASH trailer is written."

2018-12-02 Thread Karthick J
ffmpeg | branch: master | Karthick J  | Mon Dec  3 
11:46:18 2018 +0530| [4bbb6d1ae9e6ae839c2cc1f8a7bb1afc2b1be984] | committer: 
Karthick J

Revert "lavf/dashenc: Write media trailers when DASH trailer is written."

This reverts commit e444b3b184f36e3c97bb3489822f6b05ccb848a8.
Causing build error due to rebasing. Sorry for about it.

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

 libavformat/dashenc.c | 82 +++
 1 file changed, 24 insertions(+), 58 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index f455a24af6..279a9bec54 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -441,6 +441,8 @@ static void dash_free(AVFormatContext *s)
 return;
 for (i = 0; i < s->nb_streams; i++) {
 OutputStream *os = &c->streams[i];
+if (os->ctx && os->ctx_inited)
+av_write_trailer(os->ctx);
 if (os->ctx && os->ctx->pb)
 ffio_free_dyn_buf(&os->ctx->pb);
 ff_format_io_close(s, &os->out);
@@ -1357,47 +1359,6 @@ static void dashenc_delete_file(AVFormatContext *s, char 
*filename) {
 }
 }
 
-static int dashenc_delete_segment_file(AVFormatContext *s, const char* file)
-{
-DASHContext *c = s->priv_data;
-size_t dirname_len, file_len;
-char filename[1024];
-
-dirname_len = strlen(c->dirname);
-if (dirname_len >= sizeof(filename)) {
-av_log(s, AV_LOG_WARNING, "Cannot delete segments as the directory 
path is too long: %"PRIu64" characters: %s\n",
-(uint64_t)dirname_len, c->dirname);
-return AVERROR(ENAMETOOLONG);
-}
-
-memcpy(filename, c->dirname, dirname_len);
-
-file_len = strlen(file);
-if ((dirname_len + file_len) >= sizeof(filename)) {
-av_log(s, AV_LOG_WARNING, "Cannot delete segments as the path is too 
long: %"PRIu64" characters: %s%s\n",
-(uint64_t)(dirname_len + file_len), c->dirname, file);
-return AVERROR(ENAMETOOLONG);
-}
-
-memcpy(filename + dirname_len, file, file_len + 1); // include the 
terminating zero
-dashenc_delete_file(s, filename);
-
-return 0;
-}
-
-static inline void dashenc_delete_media_segments(AVFormatContext *s, 
OutputStream *os, int remove_count)
-{
-for (int i = 0; i < remove_count; ++i) {
-dashenc_delete_segment_file(s, os->segments[i]->file);
-
-// Delete the segment regardless of whether the file was successfully 
deleted
-av_free(os->segments[i]);
-}
-
-os->nb_segments -= remove_count;
-memmove(os->segments, os->segments + remove_count, os->nb_segments * 
sizeof(*os->segments));
-}
-
 static int dash_flush(AVFormatContext *s, int final, int stream)
 {
 DASHContext *c = s->priv_data;
@@ -1487,12 +1448,23 @@ static int dash_flush(AVFormatContext *s, int final, 
int stream)
 os->pos += range_length;
 }
 
-if (c->window_size) {
+if (c->window_size || (final && c->remove_at_exit)) {
 for (i = 0; i < s->nb_streams; i++) {
 OutputStream *os = &c->streams[i];
-int remove_count = os->nb_segments - c->window_size - 
c->extra_window_size;
-if (remove_count > 0)
-dashenc_delete_media_segments(s, os, remove_count);
+int j;
+int remove = os->nb_segments - c->window_size - 
c->extra_window_size;
+if (final && c->remove_at_exit)
+remove = os->nb_segments;
+if (remove > 0) {
+for (j = 0; j < remove; j++) {
+char filename[1024];
+snprintf(filename, sizeof(filename), "%s%s", c->dirname, 
os->segments[j]->file);
+dashenc_delete_file(s, filename);
+av_free(os->segments[j]);
+}
+os->nb_segments -= remove;
+memmove(os->segments, os->segments + remove, os->nb_segments * 
sizeof(*os->segments));
+}
 }
 }
 
@@ -1643,7 +1615,6 @@ static int dash_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 static int dash_write_trailer(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
-int i;
 
 if (s->nb_streams > 0) {
 OutputStream *os = &c->streams[0];
@@ -1659,19 +1630,14 @@ static int dash_write_trailer(AVFormatContext *s)
 }
 dash_flush(s, 1, -1);
 
-for (i = 0; i < s->nb_streams; ++i) {
-OutputStream *os = &c->streams[i];
-if (os->ctx && os->ctx_inited) {
-av_write_trailer(os->ctx);
-}
-
-if (c->remove_at_exit) {
-dashenc_delete_media_segments(s, os, os->nb_segments);
-dashenc_delete_segment_file(s, os->initfile);
-}
-}
-
 if (c->remove_at_exit) {
+char filename[1024];
+int i;
+for (i = 0; i < s->nb_streams; i++) {
+OutputStream *os = &c->streams[i];
+snprintf(filename, sizeof(filename), "%s

[FFmpeg-cvslog] lavf/dashenc: Use avpriv_io_delete to delete files.

2018-12-02 Thread Andrey Semashev
ffmpeg | branch: master | Andrey Semashev  | Fri Nov 
30 12:03:45 2018 +0300| [a68a975584462e1cdd1b810956e43025efb6eb04] | committer: 
Karthick J

lavf/dashenc: Use avpriv_io_delete to delete files.

This fixes incorrect handling of file pseudo-URIs (i.e. when the filename
starts with "file:").

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

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

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index a924f4af97..f455a24af6 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1347,8 +1347,13 @@ static void dashenc_delete_file(AVFormatContext *s, char 
*filename) {
 
 av_dict_free(&http_opts);
 ff_format_io_close(s, &out);
-} else if (unlink(filename) < 0) {
-av_log(s, AV_LOG_ERROR, "failed to delete %s: %s\n", filename, 
strerror(errno));
+} else {
+int res = avpriv_io_delete(filename);
+if (res < 0) {
+char errbuf[AV_ERROR_MAX_STRING_SIZE];
+av_strerror(res, errbuf, sizeof(errbuf));
+av_log(s, (res == AVERROR(ENOENT) ? AV_LOG_WARNING : 
AV_LOG_ERROR), "failed to delete %s: %s\n", filename, errbuf);
+}
 }
 }
 

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


[FFmpeg-cvslog] avformat/dashenc: Added proper logging when io_open fails for write

2018-12-02 Thread Karthick J
ffmpeg | branch: master | Karthick J  | Fri Nov 30 
11:08:09 2018 +0530| [0a80b39780c279b4e7f83d45ab15f6e84f143408] | committer: 
Karthick J

avformat/dashenc: Added proper logging when io_open fails for write

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

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

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index e08f1528be..5b1f4e5818 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -209,6 +209,15 @@ static const char *get_format_str(SegmentType 
segment_type) {
 return NULL;
 }
 
+static int handle_io_open_error(AVFormatContext *s, int err, char *url) {
+DASHContext *c = s->priv_data;
+char errbuf[AV_ERROR_MAX_STRING_SIZE];
+av_strerror(err, errbuf, sizeof(errbuf));
+av_log(s, c->ignore_io_errors ? AV_LOG_WARNING : AV_LOG_ERROR,
+   "Unable to open %s for writing: %s\n", url, errbuf);
+return c->ignore_io_errors ? 0 : err;
+}
+
 static inline SegmentType select_segment_type(SegmentType segment_type, enum 
AVCodecID codec_id)
 {
 if (segment_type == SEGMENT_TYPE_AUTO) {
@@ -538,7 +547,7 @@ static void output_segment_list(OutputStream *os, 
AVIOContext *out, AVFormatCont
 ret = dashenc_io_open(s, &c->m3u8_out, temp_filename_hls, &http_opts);
 av_dict_free(&http_opts);
 if (ret < 0) {
-av_log(s, AV_LOG_ERROR, "Unable to open %s for writing\n", 
temp_filename_hls);
+handle_io_open_error(s, ret, temp_filename_hls);
 return;
 }
 for (i = start_index; i < os->nb_segments; i++) {
@@ -853,8 +862,7 @@ static int write_manifest(AVFormatContext *s, int final)
 ret = dashenc_io_open(s, &c->mpd_out, temp_filename, &opts);
 av_dict_free(&opts);
 if (ret < 0) {
-av_log(s, AV_LOG_ERROR, "Unable to open %s for writing\n", 
temp_filename);
-return c->ignore_io_errors ? 0 : ret;
+return handle_io_open_error(s, ret, temp_filename);
 }
 out = c->mpd_out;
 avio_printf(out, "\n");
@@ -944,8 +952,7 @@ static int write_manifest(AVFormatContext *s, int final)
 ret = dashenc_io_open(s, &c->m3u8_out, temp_filename, &opts);
 av_dict_free(&opts);
 if (ret < 0) {
-av_log(s, AV_LOG_ERROR, "Unable to open %s for writing\n", 
temp_filename);
-return c->ignore_io_errors ? 0 : ret;
+return handle_io_open_error(s, ret, temp_filename);
 }
 
 ff_hls_write_playlist_version(c->m3u8_out, 7);
@@ -1578,7 +1585,7 @@ static int dash_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 ret = dashenc_io_open(s, &os->out, os->temp_path, &opts);
 av_dict_free(&opts);
 if (ret < 0) {
-return c->ignore_io_errors ? 0 : ret;
+return handle_io_open_error(s, ret, os->temp_path);
 }
 }
 

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


[FFmpeg-cvslog] lavf/dashenc: Write media trailers when DASH trailer is written.

2018-12-02 Thread Andrey Semashev
ffmpeg | branch: master | Andrey Semashev  | Thu Nov 
29 21:28:32 2018 +0300| [e444b3b184f36e3c97bb3489822f6b05ccb848a8] | committer: 
Karthick J

lavf/dashenc: Write media trailers when DASH trailer is written.

This commit ensures that all (potentially, long) filesystem activity is
performed when the user calls av_write_trailer on the DASH libavformat
context, not when freeing the context. Also, this defers media segment
deletion until after the media trailers are written.

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

 libavformat/dashenc.c | 82 ---
 1 file changed, 58 insertions(+), 24 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 5b1f4e5818..a924f4af97 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -441,8 +441,6 @@ static void dash_free(AVFormatContext *s)
 return;
 for (i = 0; i < s->nb_streams; i++) {
 OutputStream *os = &c->streams[i];
-if (os->ctx && os->ctx_inited)
-av_write_trailer(os->ctx);
 if (os->ctx && os->ctx->pb)
 ffio_free_dyn_buf(&os->ctx->pb);
 ff_format_io_close(s, &os->out);
@@ -1354,6 +1352,47 @@ static void dashenc_delete_file(AVFormatContext *s, char 
*filename) {
 }
 }
 
+static int dashenc_delete_segment_file(AVFormatContext *s, const char* file)
+{
+DASHContext *c = s->priv_data;
+size_t dirname_len, file_len;
+char filename[1024];
+
+dirname_len = strlen(c->dirname);
+if (dirname_len >= sizeof(filename)) {
+av_log(s, AV_LOG_WARNING, "Cannot delete segments as the directory 
path is too long: %"PRIu64" characters: %s\n",
+(uint64_t)dirname_len, c->dirname);
+return AVERROR(ENAMETOOLONG);
+}
+
+memcpy(filename, c->dirname, dirname_len);
+
+file_len = strlen(file);
+if ((dirname_len + file_len) >= sizeof(filename)) {
+av_log(s, AV_LOG_WARNING, "Cannot delete segments as the path is too 
long: %"PRIu64" characters: %s%s\n",
+(uint64_t)(dirname_len + file_len), c->dirname, file);
+return AVERROR(ENAMETOOLONG);
+}
+
+memcpy(filename + dirname_len, file, file_len + 1); // include the 
terminating zero
+dashenc_delete_file(s, filename);
+
+return 0;
+}
+
+static inline void dashenc_delete_media_segments(AVFormatContext *s, 
OutputStream *os, int remove_count)
+{
+for (int i = 0; i < remove_count; ++i) {
+dashenc_delete_segment_file(s, os->segments[i]->file);
+
+// Delete the segment regardless of whether the file was successfully 
deleted
+av_free(os->segments[i]);
+}
+
+os->nb_segments -= remove_count;
+memmove(os->segments, os->segments + remove_count, os->nb_segments * 
sizeof(*os->segments));
+}
+
 static int dash_flush(AVFormatContext *s, int final, int stream)
 {
 DASHContext *c = s->priv_data;
@@ -1443,23 +1482,12 @@ static int dash_flush(AVFormatContext *s, int final, 
int stream)
 os->pos += range_length;
 }
 
-if (c->window_size || (final && c->remove_at_exit)) {
+if (c->window_size) {
 for (i = 0; i < s->nb_streams; i++) {
 OutputStream *os = &c->streams[i];
-int j;
-int remove = os->nb_segments - c->window_size - 
c->extra_window_size;
-if (final && c->remove_at_exit)
-remove = os->nb_segments;
-if (remove > 0) {
-for (j = 0; j < remove; j++) {
-char filename[1024];
-snprintf(filename, sizeof(filename), "%s%s", c->dirname, 
os->segments[j]->file);
-dashenc_delete_file(s, filename);
-av_free(os->segments[j]);
-}
-os->nb_segments -= remove;
-memmove(os->segments, os->segments + remove, os->nb_segments * 
sizeof(*os->segments));
-}
+int remove_count = os->nb_segments - c->window_size - 
c->extra_window_size;
+if (remove_count > 0)
+dashenc_delete_media_segments(s, os, remove_count);
 }
 }
 
@@ -1610,6 +1638,7 @@ static int dash_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 static int dash_write_trailer(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
+int i;
 
 if (s->nb_streams > 0) {
 OutputStream *os = &c->streams[0];
@@ -1625,14 +1654,19 @@ static int dash_write_trailer(AVFormatContext *s)
 }
 dash_flush(s, 1, -1);
 
-if (c->remove_at_exit) {
-char filename[1024];
-int i;
-for (i = 0; i < s->nb_streams; i++) {
-OutputStream *os = &c->streams[i];
-snprintf(filename, sizeof(filename), "%s%s", c->dirname, 
os->initfile);
-dashenc_delete_file(s, filename);
+for (i = 0; i < s->nb_streams; ++i) {
+OutputStream *os = &c->streams[i];
+if (os->ctx && os->ctx_inited) {
+ 

[FFmpeg-cvslog] lavf: add transpose_opencl filter

2018-12-02 Thread Ruiling Song
ffmpeg | branch: master | Ruiling Song  | Wed Nov 28 
10:27:38 2018 +0800| [416dc9a5e81729e3313bcc13aebc5faa082c63a3] | committer: 
Mark Thompson

lavf: add transpose_opencl filter

Signed-off-by: Ruiling Song 
Signed-off-by: Mark Thompson 

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

 configure |   1 +
 libavfilter/Makefile  |   1 +
 libavfilter/allfilters.c  |   1 +
 libavfilter/opencl/transpose.cl   |  35 +
 libavfilter/opencl_source.h   |   1 +
 libavfilter/transpose.h   |  34 +
 libavfilter/vf_transpose.c|  14 +-
 libavfilter/vf_transpose_opencl.c | 288 ++
 8 files changed, 362 insertions(+), 13 deletions(-)

diff --git a/configure b/configure
index ed77b4ee81..1870b4d189 100755
--- a/configure
+++ b/configure
@@ -3480,6 +3480,7 @@ tinterlace_merge_test_deps="tinterlace_filter"
 tinterlace_pad_test_deps="tinterlace_filter"
 tonemap_filter_deps="const_nan"
 tonemap_opencl_filter_deps="opencl const_nan"
+transpose_opencl_filter_deps="opencl"
 unsharp_opencl_filter_deps="opencl"
 uspp_filter_deps="gpl avcodec"
 vaguedenoiser_filter_deps="gpl"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 1895fa2b0d..6e2658186d 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -393,6 +393,7 @@ OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) += 
vf_tonemap_opencl.o colorspace.o
 OBJS-$(CONFIG_TPAD_FILTER)   += vf_tpad.o
 OBJS-$(CONFIG_TRANSPOSE_FILTER)  += vf_transpose.o
 OBJS-$(CONFIG_TRANSPOSE_NPP_FILTER)  += vf_transpose_npp.o cuda_check.o
+OBJS-$(CONFIG_TRANSPOSE_OPENCL_FILTER)   += vf_transpose_opencl.o opencl.o 
opencl/transpose.o
 OBJS-$(CONFIG_TRIM_FILTER)   += trim.o
 OBJS-$(CONFIG_UNPREMULTIPLY_FILTER)  += vf_premultiply.o framesync.o
 OBJS-$(CONFIG_UNSHARP_FILTER)+= vf_unsharp.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 837c99eb75..a600069500 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -372,6 +372,7 @@ extern AVFilter ff_vf_tonemap_opencl;
 extern AVFilter ff_vf_tpad;
 extern AVFilter ff_vf_transpose;
 extern AVFilter ff_vf_transpose_npp;
+extern AVFilter ff_vf_transpose_opencl;
 extern AVFilter ff_vf_trim;
 extern AVFilter ff_vf_unpremultiply;
 extern AVFilter ff_vf_unsharp;
diff --git a/libavfilter/opencl/transpose.cl b/libavfilter/opencl/transpose.cl
new file mode 100644
index 00..e6388aba8f
--- /dev/null
+++ b/libavfilter/opencl/transpose.cl
@@ -0,0 +1,35 @@
+/*
+ * 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
+ */
+kernel void transpose(__write_only image2d_t dst,
+  __read_only image2d_t src,
+  int dir) {
+const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
+   CLK_ADDRESS_CLAMP_TO_EDGE   |
+   CLK_FILTER_NEAREST);
+
+int2 size = get_image_dim(dst);
+int x = get_global_id(0);
+int y = get_global_id(1);
+
+int xin = (dir & 2) ? (size.y - 1 - y) : y;
+int yin = (dir & 1) ? (size.x - 1 - x) : x;
+float4 data = read_imagef(src, sampler, (int2)(xin, yin));
+
+if (x < size.x && y < size.y)
+write_imagef(dst, (int2)(x, y), data);
+}
diff --git a/libavfilter/opencl_source.h b/libavfilter/opencl_source.h
index 2f67d890b3..4118138c30 100644
--- a/libavfilter/opencl_source.h
+++ b/libavfilter/opencl_source.h
@@ -25,6 +25,7 @@ extern const char *ff_opencl_source_convolution;
 extern const char *ff_opencl_source_neighbor;
 extern const char *ff_opencl_source_overlay;
 extern const char *ff_opencl_source_tonemap;
+extern const char *ff_opencl_source_transpose;
 extern const char *ff_opencl_source_unsharp;
 
 #endif /* AVFILTER_OPENCL_SOURCE_H */
diff --git a/libavfilter/transpose.h b/libavfilter/transpose.h
new file mode 100644
index 00..d4bb4da1ae
--- /dev/null
+++ b/libavfilter/transpose.h
@@ -0,0 +1,34 @@
+/*
+ * 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; ei

[FFmpeg-cvslog] hwcontext_opencl: Use correct function to enumerate devices

2018-12-02 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Wed Nov 28 00:16:30 
2018 +| [21608bc30303b221db8f3e2fb0952e7e7f2bd270] | committer: Mark 
Thompson

hwcontext_opencl: Use correct function to enumerate devices

Also assert that all required functions are present.

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

 libavutil/hwcontext_opencl.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index be71c8323e..d3df6221c4 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -500,6 +500,9 @@ static int opencl_device_create_internal(AVHWDeviceContext 
*hwdev,
  *device_name_src   = NULL;
 int err, found, p, d;
 
+av_assert0(selector->enumerate_platforms &&
+   selector->enumerate_devices);
+
 err = selector->enumerate_platforms(hwdev, &nb_platforms, &platforms,
 selector->context);
 if (err)
@@ -531,9 +534,9 @@ static int opencl_device_create_internal(AVHWDeviceContext 
*hwdev,
 continue;
 }
 
-err = opencl_enumerate_devices(hwdev, platforms[p], platform_name,
-   &nb_devices, &devices,
-   selector->context);
+err = selector->enumerate_devices(hwdev, platforms[p], platform_name,
+  &nb_devices, &devices,
+  selector->context);
 if (err < 0)
 continue;
 

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


[FFmpeg-cvslog] configure: Avoid use of nonstandard features of sed

2018-12-02 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Sun Dec  2 23:31:50 
2018 +| [2f6b1806ce2bc007a3a3596680a9f8089fb78145] | committer: Mark 
Thompson

configure: Avoid use of nonstandard features of sed

Standard sed does not support EREs.

Fixes #7310.

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

 configure | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/configure b/configure
index 2af6c0d797..ed77b4ee81 100755
--- a/configure
+++ b/configure
@@ -3725,8 +3725,7 @@ find_things_extern(){
 
 find_filters_extern(){
 file=$source_path/$1
-#sed -n "s/^extern AVFilter 
ff_\([avfsinkrc]\{2,5\}\)_\(\w\+\);/\2_filter/p" $file
-sed -E -n "s/^extern AVFilter 
ff_([avfsinkrc]{2,5})_([a-zA-Z0-9_]+);/\2_filter/p" $file
+sed -n 's/^extern AVFilter 
ff_[avfsinkrc]\{2,5\}_\([[:alnum:]_]\{1,\}\);/\1_filter/p' $file
 }
 
 FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c)

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


[FFmpeg-cvslog] trace_headers: Update documentation

2018-12-02 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt 
 | Sat Dec  1 08:52:55 2018 +0100| 
[5d8df52c45b2b17e3b2e2b04640d580ea39707f1] | committer: Mark Thompson

trace_headers: Update documentation

It also supports AV1 and (M)JPEG.

Signed-off-by: Andreas Rheinhardt 
Signed-off-by: Mark Thompson 

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

 doc/bitstream_filters.texi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi
index 15c578aa8a..b779265f58 100644
--- a/doc/bitstream_filters.texi
+++ b/doc/bitstream_filters.texi
@@ -632,7 +632,8 @@ Log trace output containing all syntax elements in the 
coded stream
 headers (everything above the level of individual coded blocks).
 This can be useful for debugging low-level stream issues.
 
-Supports H.264, H.265, MPEG-2 and VP9.
+Supports AV1, H.264, H.265, (M)JPEG, MPEG-2 and VP9, but depending
+on the build only a subset of these may be available.
 
 @section truehd_core
 

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


[FFmpeg-cvslog] cbs_h265: Fix Time Code SEI syntax

2018-12-02 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt 
 | Sat Dec  1 08:52:54 2018 +0100| 
[9f588ba5ca283c6b0b0b744085275e6253ba5cc6] | committer: Mark Thompson

cbs_h265: Fix Time Code SEI syntax

Signed-off-by: Andreas Rheinhardt 
Signed-off-by: Mark Thompson 

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

 libavcodec/cbs_h265_syntax_template.c | 56 +++
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/libavcodec/cbs_h265_syntax_template.c 
b/libavcodec/cbs_h265_syntax_template.c
index 0a430df23a..f1e1bb0e7e 100644
--- a/libavcodec/cbs_h265_syntax_template.c
+++ b/libavcodec/cbs_h265_syntax_template.c
@@ -1955,36 +1955,40 @@ static int FUNC(sei_time_code)(CodedBitstreamContext 
*ctx, RWContext *rw,
 u(2, num_clock_ts, 1, 3);
 
 for (i = 0; i < current->num_clock_ts; i++) {
-flags(units_field_based_flag[i], 1, i);
-us(5, counting_type[i], 0, 6,1, i);
-flags(full_timestamp_flag[i],1, i);
-flags(discontinuity_flag[i], 1, i);
-flags(cnt_dropped_flag[i],   1, i);
-
-us(9, n_frames[i], 0, MAX_UINT_BITS(9), 1, i);
-
-if (current->full_timestamp_flag[i]) {
-us(6, seconds_value[i], 0, 59, 1, i);
-us(6, minutes_value[i], 0, 59, 1, i);
-us(5, hours_value[i],   0, 23, 1, i);
-} else {
-flags(seconds_flag[i], 1, i);
-if (current->seconds_flag[i]) {
+flags(clock_timestamp_flag[i],   1, i);
+
+if (current->clock_timestamp_flag[i]) {
+flags(units_field_based_flag[i], 1, i);
+us(5, counting_type[i], 0, 6,1, i);
+flags(full_timestamp_flag[i],1, i);
+flags(discontinuity_flag[i], 1, i);
+flags(cnt_dropped_flag[i],   1, i);
+
+us(9, n_frames[i], 0, MAX_UINT_BITS(9), 1, i);
+
+if (current->full_timestamp_flag[i]) {
 us(6, seconds_value[i], 0, 59, 1, i);
-flags(minutes_flag[i], 1, i);
-if (current->minutes_flag[i]) {
-us(6, minutes_value[i], 0, 59, 1, i);
-flags(hours_flag[i], 1, i);
-if (current->hours_flag[i])
-us(5, hours_value[i], 0, 23, 1, i);
+us(6, minutes_value[i], 0, 59, 1, i);
+us(5, hours_value[i],   0, 23, 1, i);
+} else {
+flags(seconds_flag[i], 1, i);
+if (current->seconds_flag[i]) {
+us(6, seconds_value[i], 0, 59, 1, i);
+flags(minutes_flag[i], 1, i);
+if (current->minutes_flag[i]) {
+us(6, minutes_value[i], 0, 59, 1, i);
+flags(hours_flag[i], 1, i);
+if (current->hours_flag[i])
+us(5, hours_value[i], 0, 23, 1, i);
+}
 }
 }
-}
 
-us(5, time_offset_length[i], 0, 31, 1, i);
-if (current->time_offset_length[i] > 0)
-us(current->time_offset_length[i], time_offset_value[i],
-   0, MAX_UINT_BITS(current->time_offset_length[i]), 1, i);
+us(5, time_offset_length[i], 0, 31, 1, i);
+if (current->time_offset_length[i] > 0)
+us(current->time_offset_length[i], time_offset_value[i],
+   0, MAX_UINT_BITS(current->time_offset_length[i]), 1, i);
+}
 }
 
 return 0;

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


[FFmpeg-cvslog] Force aix nm to work on 32 and 64 bit binaries by default.

2018-12-02 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Sun Dec  2 
15:18:46 2018 +0100| [f7faaa8c187fd110629cdf327dbf4f8322eea085] | committer: 
Carl Eugen Hoyos

Force aix nm to work on 32 and 64 bit binaries by default.

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

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

diff --git a/configure b/configure
index 54b7e1119b..2af6c0d797 100755
--- a/configure
+++ b/configure
@@ -3608,6 +3608,7 @@ host_os=$target_os_default
 if test "$target_os_default" = aix; then
 arch_default=$(uname -p)
 strip_default="strip -X32_64"
+nm_default="nm -g -X32_64"
 else
 arch_default=$(uname -m)
 fi

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


[FFmpeg-cvslog] avformat/dashenc: Added an option to ignore io errors

2018-12-02 Thread kjeyapal
ffmpeg | branch: master | kjeya...@akamai.com  | Wed Nov 
28 22:54:17 2018 +0530| [c32aad19614ca42fe67efeced893332dae09a1e3] | committer: 
Karthick J

avformat/dashenc: Added an option to ignore io errors

When dashenc has to run for long duration(say 24x7 live stream), one can enable 
this option to ignore the io failure of few segment's upload due to an 
intermittent network issues.
When the network connection recovers dashenc will continue with the upload of 
the current segments, leading to the recovery of the stream.

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

 doc/muxers.texi   |  3 +++
 libavformat/dashenc.c | 17 +++--
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index a02ac01b55..f1cc6f5fee 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -300,6 +300,9 @@ If this flag is set, the dash segment files will be in in 
ISOBMFF format.
 @item webm
 If this flag is set, the dash segment files will be in in WebM format.
 
+@item -ignore_io_errors @var{ignore_io_errors}
+Ignore IO errors during open and write. Useful for long-duration runs with 
network output.
+
 @end table
 
 @anchor{framecrc}
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 72c6e5a8e6..e08f1528be 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -138,6 +138,7 @@ typedef struct DASHContext {
 int index_correction;
 char *format_options_str;
 SegmentType segment_type_option;  /* segment type as specified in options 
*/
+int ignore_io_errors;
 } DASHContext;
 
 static struct codec_string {
@@ -853,7 +854,7 @@ static int write_manifest(AVFormatContext *s, int final)
 av_dict_free(&opts);
 if (ret < 0) {
 av_log(s, AV_LOG_ERROR, "Unable to open %s for writing\n", 
temp_filename);
-return ret;
+return c->ignore_io_errors ? 0 : ret;
 }
 out = c->mpd_out;
 avio_printf(out, "\n");
@@ -944,7 +945,7 @@ static int write_manifest(AVFormatContext *s, int final)
 av_dict_free(&opts);
 if (ret < 0) {
 av_log(s, AV_LOG_ERROR, "Unable to open %s for writing\n", 
temp_filename);
-return ret;
+return c->ignore_io_errors ? 0 : ret;
 }
 
 ff_hls_write_playlist_version(c->m3u8_out, 7);
@@ -1576,8 +1577,9 @@ static int dash_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 set_http_options(&opts, c);
 ret = dashenc_io_open(s, &os->out, os->temp_path, &opts);
 av_dict_free(&opts);
-if (ret < 0)
-return ret;
+if (ret < 0) {
+return c->ignore_io_errors ? 0 : ret;
+}
 }
 
 //write out the data immediately in streaming mode
@@ -1588,9 +1590,11 @@ static int dash_write_packet(AVFormatContext *s, 
AVPacket *pkt)
 write_styp(os->ctx->pb);
 avio_flush(os->ctx->pb);
 len = avio_get_dyn_buf (os->ctx->pb, &buf);
-avio_write(os->out, buf + os->written_len, len - os->written_len);
+if (os->out) {
+avio_write(os->out, buf + os->written_len, len - os->written_len);
+avio_flush(os->out);
+}
 os->written_len = len;
-avio_flush(os->out);
 }
 
 return ret;
@@ -1693,6 +1697,7 @@ static const AVOption options[] = {
 { "auto", "select segment file format based on codec", 0, 
AV_OPT_TYPE_CONST, {.i64 = SEGMENT_TYPE_AUTO }, 0, UINT_MAX,   E, 
"segment_type"},
 { "mp4", "make segment file in ISOBMFF format", 0, AV_OPT_TYPE_CONST, 
{.i64 = SEGMENT_TYPE_MP4 }, 0, UINT_MAX,   E, "segment_type"},
 { "webm", "make segment file in WebM format", 0, AV_OPT_TYPE_CONST, {.i64 
= SEGMENT_TYPE_WEBM }, 0, UINT_MAX,   E, "segment_type"},
+{ "ignore_io_errors", "Ignore IO errors during open and write. Useful for 
long-duration runs with network output", OFFSET(ignore_io_errors), 
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },
 { NULL },
 };
 

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


[FFmpeg-cvslog] avformat/dashenc: Handled the error from dashenc_io_open()

2018-12-02 Thread kjeyapal
ffmpeg | branch: master | kjeya...@akamai.com  | Wed Nov 
28 22:54:16 2018 +0530| [6c1e1242012e116e2622ec7a9f56972eaf5c15f8] | committer: 
Karthick J

avformat/dashenc: Handled the error from dashenc_io_open()

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

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

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index af3f0ee167..72c6e5a8e6 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -534,8 +534,12 @@ static void output_segment_list(OutputStream *os, 
AVIOContext *out, AVFormatCont
 snprintf(temp_filename_hls, sizeof(temp_filename_hls), use_rename ? 
"%s.tmp" : "%s", filename_hls);
 
 set_http_options(&http_opts, c);
-dashenc_io_open(s, &c->m3u8_out, temp_filename_hls, &http_opts);
+ret = dashenc_io_open(s, &c->m3u8_out, temp_filename_hls, &http_opts);
 av_dict_free(&http_opts);
+if (ret < 0) {
+av_log(s, AV_LOG_ERROR, "Unable to open %s for writing\n", 
temp_filename_hls);
+return;
+}
 for (i = start_index; i < os->nb_segments; i++) {
 Segment *seg = os->segments[i];
 double duration = (double) seg->duration / timescale;

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


[FFmpeg-cvslog] lavf/dashenc: Don't put non-mp4 streams in HLS manifests.

2018-12-02 Thread Andrey Semashev
ffmpeg | branch: master | Andrey Semashev  | Wed Nov 
28 14:36:08 2018 +0300| [2a5cf8a241e3591015dfc94ecca66ffe5b08e29e] | committer: 
Karthick J

lavf/dashenc: Don't put non-mp4 streams in HLS manifests.

The only native HLS implementation in the wild (Safari browser) doesn't
support WebM. And at least some MSE-based players (e.g. shaka-player)
cannot handle WebM media segments when playing HLS. So just skip non-mp4
streams from HLS manifests. Note that such streams will still be described
by the DASH manifest and therefore consumed by players supporting DASH.

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

 libavformat/dashenc.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 6ce70e0076..a7d8c4e237 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -225,6 +225,7 @@ static inline SegmentType select_segment_type(SegmentType 
segment_type, enum AVC
 static int init_segment_types(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
+int has_mp4_streams = 0;
 for (int i = 0; i < s->nb_streams; ++i) {
 OutputStream *os = &c->streams[i];
 SegmentType segment_type = select_segment_type(
@@ -235,6 +236,12 @@ static int init_segment_types(AVFormatContext *s)
 av_log(s, AV_LOG_ERROR, "Could not select DASH segment type for 
stream %d\n", i);
 return AVERROR_MUXER_NOT_FOUND;
 }
+has_mp4_streams |= segment_type == SEGMENT_TYPE_MP4;
+}
+
+if (c->hls_playlist && !has_mp4_streams) {
+ av_log(s, AV_LOG_WARNING, "No mp4 streams, disabling HLS manifest 
generation\n");
+ c->hls_playlist = 0;
 }
 
 return 0;
@@ -510,7 +517,7 @@ static void output_segment_list(OutputStream *os, 
AVIOContext *out, AVFormatCont
 }
 avio_printf(out, "\t\t\t\t\n");
 }
-if (c->hls_playlist && start_index < os->nb_segments)
+if (c->hls_playlist && start_index < os->nb_segments && os->segment_type 
== SEGMENT_TYPE_MP4)
 {
 int timescale = os->ctx->streams[0]->time_base.den;
 char temp_filename_hls[1024];
@@ -944,6 +951,8 @@ static int write_manifest(AVFormatContext *s, int final)
 OutputStream *os = &c->streams[i];
 if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO)
 continue;
+if (os->segment_type != SEGMENT_TYPE_MP4)
+continue;
 get_hls_playlist_name(playlist_file, sizeof(playlist_file), NULL, 
i);
 ff_hls_write_audio_rendition(c->m3u8_out, (char *)audio_group,
  playlist_file, i, is_default);
@@ -967,6 +976,8 @@ static int write_manifest(AVFormatContext *s, int final)
 int stream_bitrate = st->codecpar->bit_rate + os->muxer_overhead;
 if (st->codecpar->codec_type != AVMEDIA_TYPE_VIDEO)
 continue;
+if (os->segment_type != SEGMENT_TYPE_MP4)
+continue;
 av_strlcpy(codec_str, os->codec_str, sizeof(codec_str));
 if (max_audio_bitrate) {
 agroup = (char *)audio_group;

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


[FFmpeg-cvslog] lavf/dashenc: Delete HLS manifests on trailer writing if remove_at_exit is set.

2018-12-02 Thread Andrey Semashev
ffmpeg | branch: master | Andrey Semashev  | Wed Nov 
28 14:36:09 2018 +0300| [84c17449ce221c42475403a133e91c7677034c98] | committer: 
Karthick J

lavf/dashenc: Delete HLS manifests on trailer writing if remove_at_exit is set.

This fixes HLS manifests being left behind if remove_at_exit is set.

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

 libavformat/dashenc.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index a7d8c4e237..af3f0ee167 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1619,6 +1619,18 @@ static int dash_write_trailer(AVFormatContext *s)
 dashenc_delete_file(s, filename);
 }
 dashenc_delete_file(s, s->url);
+
+if (c->hls_playlist && c->master_playlist_created) {
+for (i = 0; i < s->nb_streams; i++) {
+OutputStream *os = &c->streams[i];
+if (os->segment_type == SEGMENT_TYPE_MP4) {
+get_hls_playlist_name(filename, sizeof(filename), 
c->dirname, i);
+dashenc_delete_file(s, filename);
+}
+}
+snprintf(filename, sizeof(filename), "%smaster.m3u8", c->dirname);
+dashenc_delete_file(s, filename);
+}
 }
 
 return 0;

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


[FFmpeg-cvslog] tests/ref/fate/vc1test_smm0005: Add a newline.

2018-12-02 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Sun Dec  2 
14:17:53 2018 +0100| [3c7a2a0b92e670a1dc70be3198ece2646f25d495] | committer: 
Carl Eugen Hoyos

tests/ref/fate/vc1test_smm0005: Add a newline.

Fixes fate-pixelutils on aix.

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

 tests/ref/fate/vc1test_smm0005 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/ref/fate/vc1test_smm0005 b/tests/ref/fate/vc1test_smm0005
index 670dd8da1d..0c189ca558 100644
--- a/tests/ref/fate/vc1test_smm0005
+++ b/tests/ref/fate/vc1test_smm0005
@@ -26,4 +26,4 @@
 0, 20, 20,1,   518400, 0xda9ebefb
 0, 21, 21,1,   518400, 0xb810bc59
 0, 22, 22,1,   518400, 0xc79fc02d
-0, 23, 23,1,   518400, 0x28d9ad0d
\ No newline at end of file
+0, 23, 23,1,   518400, 0x28d9ad0d

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


[FFmpeg-cvslog] avcodec/proresdec : add unpack alpha 12 func

2018-12-02 Thread Martin Vignali
ffmpeg | branch: master | Martin Vignali  | Sat Nov 
17 23:37:23 2018 +0100| [fddc92d45479950e5a2a718563f6347e26bc3c11] | committer: 
Martin Vignali

avcodec/proresdec : add unpack alpha 12 func

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

 libavcodec/proresdec2.c | 47 +--
 1 file changed, 41 insertions(+), 6 deletions(-)

diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index 40d15720ba..8a537eed1a 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -46,6 +46,11 @@ static void permute(uint8_t *dst, const uint8_t *src, const 
uint8_t permutation[
 dst[i] = permutation[src[i]];
 }
 
+#define ALPHA_SHIFT_16_TO_10(alpha_val) (alpha_val >> 6)
+#define ALPHA_SHIFT_8_TO_10(alpha_val)  ((alpha_val << 2) | (alpha_val >> 6))
+#define ALPHA_SHIFT_16_TO_12(alpha_val) (alpha_val >> 4)
+#define ALPHA_SHIFT_8_TO_12(alpha_val)  ((alpha_val << 4) | (alpha_val >> 4))
+
 static void inline unpack_alpha(GetBitContext *gb, uint16_t *dst, int 
num_coeffs,
 const int num_bits, const int 
decode_precision) {
 const int mask = (1 << num_bits) - 1;
@@ -67,9 +72,17 @@ static void inline unpack_alpha(GetBitContext *gb, uint16_t 
*dst, int num_coeffs
 }
 alpha_val = (alpha_val + val) & mask;
 if (num_bits == 16) {
-dst[idx++] = alpha_val >> 6;
+if (decode_precision == 10) {
+dst[idx++] = ALPHA_SHIFT_16_TO_10(alpha_val);
+} else { /* 12b */
+dst[idx++] = ALPHA_SHIFT_16_TO_12(alpha_val);
+}
 } else {
-dst[idx++] = (alpha_val << 2) | (alpha_val >> 6);
+if (decode_precision == 10) {
+dst[idx++] = ALPHA_SHIFT_8_TO_10(alpha_val);
+} else { /* 12b */
+dst[idx++] = ALPHA_SHIFT_8_TO_12(alpha_val);
+}
 }
 if (idx >= num_coeffs)
 break;
@@ -80,11 +93,21 @@ static void inline unpack_alpha(GetBitContext *gb, uint16_t 
*dst, int num_coeffs
 if (idx + val > num_coeffs)
 val = num_coeffs - idx;
 if (num_bits == 16) {
-for (i = 0; i < val; i++)
-dst[idx++] = alpha_val >> 6;
+for (i = 0; i < val; i++) {
+if (decode_precision == 10) {
+dst[idx++] = ALPHA_SHIFT_16_TO_10(alpha_val);
+} else { /* 12b */
+dst[idx++] = ALPHA_SHIFT_16_TO_12(alpha_val);
+}
+}
 } else {
-for (i = 0; i < val; i++)
-dst[idx++] = (alpha_val << 2) | (alpha_val >> 6);
+for (i = 0; i < val; i++) {
+if (decode_precision == 10) {
+dst[idx++] = ALPHA_SHIFT_8_TO_10(alpha_val);
+} else { /* 12b */
+dst[idx++] = ALPHA_SHIFT_8_TO_12(alpha_val);
+}
+}
 }
 } while (idx < num_coeffs);
 }
@@ -99,6 +122,16 @@ static void unpack_alpha_10(GetBitContext *gb, uint16_t 
*dst, int num_coeffs,
 }
 }
 
+static void unpack_alpha_12(GetBitContext *gb, uint16_t *dst, int num_coeffs,
+const int num_bits)
+{
+if (num_bits == 16) {
+unpack_alpha(gb, dst, num_coeffs, 16, 12);
+} else { /* 8 bits alpha */
+unpack_alpha(gb, dst, num_coeffs, 8, 12);
+}
+}
+
 static av_cold int decode_init(AVCodecContext *avctx)
 {
 int ret = 0;
@@ -146,6 +179,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
 if (avctx->bits_per_raw_sample == 10){
 ctx->unpack_alpha = unpack_alpha_10;
+} else if (avctx->bits_per_raw_sample == 12){
+ctx->unpack_alpha = unpack_alpha_12;
 } else {
 av_log(avctx, AV_LOG_ERROR, "Fail to set unpack_alpha for bits per raw 
sample %d\n", avctx->bits_per_raw_sample);
 return AVERROR_BUG;

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


[FFmpeg-cvslog] avcodec/proresdsp : remove unused value

2018-12-02 Thread Martin Vignali
ffmpeg | branch: master | Martin Vignali  | Sat Nov 
17 23:32:43 2018 +0100| [dae9b4b8a4d9aee62a9fbb944da40b08ff442365] | committer: 
Martin Vignali

avcodec/proresdsp : remove unused value

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

 libavcodec/proresdsp.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c
index 5b5ada21fe..3c337dc433 100644
--- a/libavcodec/proresdsp.c
+++ b/libavcodec/proresdsp.c
@@ -27,7 +27,6 @@
 #include "proresdsp.h"
 #include "simple_idct.h"
 
-#define BIAS (1 << (PRORES_BITS_PER_SAMPLE - 1))   ///< bias value 
for converting signed pixels into unsigned ones
 #define CLIP_MIN (1 << (PRORES_BITS_PER_SAMPLE - 8))   ///< minimum 
value for clipping resulting pixels
 #define CLIP_MAX (1 << PRORES_BITS_PER_SAMPLE) - CLIP_MIN - 1  ///< maximum 
value for clipping resulting pixels
 

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


[FFmpeg-cvslog] avcodec/proresdec : make inline func for unpack alpha

2018-12-02 Thread Martin Vignali
ffmpeg | branch: master | Martin Vignali  | Sat Nov 
17 23:37:00 2018 +0100| [859604fe9d680fbd1abc4b78a528909904874d95] | committer: 
Martin Vignali

avcodec/proresdec : make inline func for unpack alpha

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

 libavcodec/proresdec2.c | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index 94323df128..40d15720ba 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -46,9 +46,8 @@ static void permute(uint8_t *dst, const uint8_t *src, const 
uint8_t permutation[
 dst[i] = permutation[src[i]];
 }
 
-static void unpack_alpha_10(GetBitContext *gb, uint16_t *dst, int num_coeffs,
-const int num_bits)
-{
+static void inline unpack_alpha(GetBitContext *gb, uint16_t *dst, int 
num_coeffs,
+const int num_bits, const int 
decode_precision) {
 const int mask = (1 << num_bits) - 1;
 int i, idx, val, alpha_val;
 
@@ -86,11 +85,20 @@ static void unpack_alpha_10(GetBitContext *gb, uint16_t 
*dst, int num_coeffs,
 } else {
 for (i = 0; i < val; i++)
 dst[idx++] = (alpha_val << 2) | (alpha_val >> 6);
-
 }
 } while (idx < num_coeffs);
 }
 
+static void unpack_alpha_10(GetBitContext *gb, uint16_t *dst, int num_coeffs,
+const int num_bits)
+{
+if (num_bits == 16) {
+unpack_alpha(gb, dst, num_coeffs, 16, 10);
+} else { /* 8 bits alpha */
+unpack_alpha(gb, dst, num_coeffs, 8, 10);
+}
+}
+
 static av_cold int decode_init(AVCodecContext *avctx)
 {
 int ret = 0;

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


[FFmpeg-cvslog] avcodec/utils : add YUVA444P12 and YUVA422P12 to pixfmt who need height padding in avcodec_align_dimensions2

2018-12-02 Thread Martin Vignali
ffmpeg | branch: master | Martin Vignali  | Tue Nov 
27 22:21:47 2018 +0100| [a87ca4bbcab067baefadd7833f107912f4698a00] | committer: 
Martin Vignali

avcodec/utils : add YUVA444P12 and YUVA422P12 to pixfmt who need height padding 
in avcodec_align_dimensions2

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

 libavcodec/utils.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 1661d48b90..c4c64a6ca4 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -214,6 +214,8 @@ void avcodec_align_dimensions2(AVCodecContext *s, int 
*width, int *height,
 case AV_PIX_FMT_YUVA422P9BE:
 case AV_PIX_FMT_YUVA422P10LE:
 case AV_PIX_FMT_YUVA422P10BE:
+case AV_PIX_FMT_YUVA422P12LE:
+case AV_PIX_FMT_YUVA422P12BE:
 case AV_PIX_FMT_YUVA422P16LE:
 case AV_PIX_FMT_YUVA422P16BE:
 case AV_PIX_FMT_YUV440P10LE:
@@ -234,6 +236,8 @@ void avcodec_align_dimensions2(AVCodecContext *s, int 
*width, int *height,
 case AV_PIX_FMT_YUVA444P9BE:
 case AV_PIX_FMT_YUVA444P10LE:
 case AV_PIX_FMT_YUVA444P10BE:
+case AV_PIX_FMT_YUVA444P12LE:
+case AV_PIX_FMT_YUVA444P12BE:
 case AV_PIX_FMT_YUVA444P16LE:
 case AV_PIX_FMT_YUVA444P16BE:
 case AV_PIX_FMT_GBRP9LE:

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


[FFmpeg-cvslog] avcodec/proresdec : rename dsp part for 10b and check dspinit for supported bits per raw sample

2018-12-02 Thread Martin Vignali
ffmpeg | branch: master | Martin Vignali  | Sat Nov 
17 23:35:35 2018 +0100| [c097a32e93b4b4d9cb576bf21014b19121806161] | committer: 
Martin Vignali

avcodec/proresdec : rename dsp part for 10b and check dspinit for supported 
bits per raw sample

based on patch by Kieran Kunhya

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

 libavcodec/proresdec2.c |  9 +++--
 libavcodec/proresdsp.c  | 25 +++--
 libavcodec/proresdsp.h  |  4 +---
 libavcodec/simple_idct.c|  2 +-
 libavcodec/simple_idct.h|  2 +-
 libavcodec/tests/dct.c  |  2 +-
 libavcodec/x86/proresdsp_init.c |  2 ++
 7 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index 835df19418..12b2cba090 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -48,6 +48,7 @@ static void permute(uint8_t *dst, const uint8_t *src, const 
uint8_t permutation[
 
 static av_cold int decode_init(AVCodecContext *avctx)
 {
+int ret = 0;
 ProresContext *ctx = avctx->priv_data;
 uint8_t idct_permutation[64];
 
@@ -78,7 +79,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
 }
 
 ff_blockdsp_init(&ctx->bdsp, avctx);
-ff_proresdsp_init(&ctx->prodsp, avctx);
+ret = ff_proresdsp_init(&ctx->prodsp, avctx);
+if (ret < 0) {
+av_log(avctx, AV_LOG_ERROR, "Fail to init proresdsp for bits per raw 
sample %d\n", avctx->bits_per_raw_sample);
+return ret;
+}
 
 ff_init_scantable_permutation(idct_permutation,
   ctx->prodsp.idct_permutation_type);
@@ -86,7 +91,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 permute(ctx->progressive_scan, ff_prores_progressive_scan, 
idct_permutation);
 permute(ctx->interlaced_scan, ff_prores_interlaced_scan, idct_permutation);
 
-return 0;
+return ret;
 }
 
 static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c
index 3c337dc433..6b15ed3add 100644
--- a/libavcodec/proresdsp.c
+++ b/libavcodec/proresdsp.c
@@ -27,15 +27,15 @@
 #include "proresdsp.h"
 #include "simple_idct.h"
 
-#define CLIP_MIN (1 << (PRORES_BITS_PER_SAMPLE - 8))   ///< minimum 
value for clipping resulting pixels
-#define CLIP_MAX (1 << PRORES_BITS_PER_SAMPLE) - CLIP_MIN - 1  ///< maximum 
value for clipping resulting pixels
+#define CLIP_MIN (1 << 2) ///< minimum value for clipping 
resulting pixels
+#define CLIP_MAX_10 (1 << 10) - CLIP_MIN - 1  ///< maximum value for clipping 
resulting pixels
 
-#define CLIP(x) (av_clip((x), CLIP_MIN, CLIP_MAX))
+#define CLIP_10(x) (av_clip((x), CLIP_MIN, CLIP_MAX_10))
 
 /**
  * Add bias value, clamp and output pixels of a slice
  */
-static void put_pixels(uint16_t *dst, ptrdiff_t linesize, const int16_t *in)
+static void put_pixels_10(uint16_t *dst, ptrdiff_t linesize, const int16_t *in)
 {
 int x, y, src_offset, dst_offset;
 
@@ -43,25 +43,30 @@ static void put_pixels(uint16_t *dst, ptrdiff_t linesize, 
const int16_t *in)
 for (x = 0; x < 8; x++) {
 src_offset = (y << 3) + x;
 
-dst[dst_offset + x] = CLIP(in[src_offset]);
+dst[dst_offset + x] = CLIP_10(in[src_offset]);
 }
 }
 }
 
-static void prores_idct_put_c(uint16_t *out, ptrdiff_t linesize, int16_t 
*block, const int16_t *qmat)
+static void prores_idct_put_10_c(uint16_t *out, ptrdiff_t linesize, int16_t 
*block, const int16_t *qmat)
 {
-ff_prores_idct(block, qmat);
-put_pixels(out, linesize >> 1, block);
+ff_prores_idct_10(block, qmat);
+put_pixels_10(out, linesize >> 1, block);
 }
 
-av_cold void ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx)
+av_cold int ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx)
 {
-dsp->idct_put = prores_idct_put_c;
+if (avctx->bits_per_raw_sample == 10) {
+dsp->idct_put = prores_idct_put_10_c;
 dsp->idct_permutation_type = FF_IDCT_PERM_NONE;
+} else {
+return AVERROR_BUG;
+}
 
 if (ARCH_X86)
 ff_proresdsp_init_x86(dsp, avctx);
 
 ff_init_scantable_permutation(dsp->idct_permutation,
   dsp->idct_permutation_type);
+return 0;
 }
diff --git a/libavcodec/proresdsp.h b/libavcodec/proresdsp.h
index 558fae53bf..37ba76b8e4 100644
--- a/libavcodec/proresdsp.h
+++ b/libavcodec/proresdsp.h
@@ -27,15 +27,13 @@
 #include 
 #include "avcodec.h"
 
-#define PRORES_BITS_PER_SAMPLE 10 ///< output precision of prores decoder
-
 typedef struct ProresDSPContext {
 int idct_permutation_type;
 uint8_t idct_permutation[64];
 void (*idct_put)(uint16_t *out, ptrdiff_t linesize, int16_t *block, const 
int16_t *qmat);
 } ProresDSPContext;
 
-void ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx);
+int ff_proresdsp_init(ProresDSPContext *dsp, AVCodecCon

[FFmpeg-cvslog] avcodec/proresdsp indent after prev commit

2018-12-02 Thread Martin Vignali
ffmpeg | branch: master | Martin Vignali  | Sat Nov 
17 23:35:52 2018 +0100| [9a22e6fa1dec29cc2f8bc3cd217d20573e19ebe7] | committer: 
Martin Vignali

avcodec/proresdsp indent after prev commit

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

 libavcodec/proresdsp.c  |  4 ++--
 libavcodec/x86/proresdsp_init.c | 16 
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c
index 6b15ed3add..7be7e68287 100644
--- a/libavcodec/proresdsp.c
+++ b/libavcodec/proresdsp.c
@@ -57,8 +57,8 @@ static void prores_idct_put_10_c(uint16_t *out, ptrdiff_t 
linesize, int16_t *blo
 av_cold int ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx)
 {
 if (avctx->bits_per_raw_sample == 10) {
-dsp->idct_put = prores_idct_put_10_c;
-dsp->idct_permutation_type = FF_IDCT_PERM_NONE;
+dsp->idct_put = prores_idct_put_10_c;
+dsp->idct_permutation_type = FF_IDCT_PERM_NONE;
 } else {
 return AVERROR_BUG;
 }
diff --git a/libavcodec/x86/proresdsp_init.c b/libavcodec/x86/proresdsp_init.c
index 747aeb826e..bde79ab8c0 100644
--- a/libavcodec/x86/proresdsp_init.c
+++ b/libavcodec/x86/proresdsp_init.c
@@ -36,15 +36,15 @@ av_cold void ff_proresdsp_init_x86(ProresDSPContext *dsp, 
AVCodecContext *avctx)
 int cpu_flags = av_get_cpu_flags();
 
 if (avctx->bits_per_raw_sample == 10){
-if (EXTERNAL_SSE2(cpu_flags)) {
-dsp->idct_permutation_type = FF_IDCT_PERM_TRANSPOSE;
-dsp->idct_put = ff_prores_idct_put_10_sse2;
-}
+if (EXTERNAL_SSE2(cpu_flags)) {
+dsp->idct_permutation_type = FF_IDCT_PERM_TRANSPOSE;
+dsp->idct_put = ff_prores_idct_put_10_sse2;
+}
 
-if (EXTERNAL_AVX(cpu_flags)) {
-dsp->idct_permutation_type = FF_IDCT_PERM_TRANSPOSE;
-dsp->idct_put = ff_prores_idct_put_10_avx;
-}
+if (EXTERNAL_AVX(cpu_flags)) {
+dsp->idct_permutation_type = FF_IDCT_PERM_TRANSPOSE;
+dsp->idct_put = ff_prores_idct_put_10_avx;
+}
 }
 #endif /* ARCH_X86_64 */
 }

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


[FFmpeg-cvslog] avcodec/proresdec : add 12b prores idct

2018-12-02 Thread Martin Vignali
ffmpeg | branch: master | Martin Vignali  | Sat Nov 
17 23:37:50 2018 +0100| [6a583261ea631e6da5593c4477e36fde9bc731ab] | committer: 
Martin Vignali

avcodec/proresdec : add 12b prores idct

based on patch by Kieran Kunhya

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

 libavcodec/proresdsp.c   | 31 ---
 libavcodec/simple_idct.c | 16 
 libavcodec/simple_idct.h |  1 +
 3 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c
index 7be7e68287..a3c618cdd1 100644
--- a/libavcodec/proresdsp.c
+++ b/libavcodec/proresdsp.c
@@ -29,36 +29,61 @@
 
 #define CLIP_MIN (1 << 2) ///< minimum value for clipping 
resulting pixels
 #define CLIP_MAX_10 (1 << 10) - CLIP_MIN - 1  ///< maximum value for clipping 
resulting pixels
+#define CLIP_MAX_12 (1 << 12) - CLIP_MIN - 1  ///< maximum value for clipping 
resulting pixels
 
 #define CLIP_10(x) (av_clip((x), CLIP_MIN, CLIP_MAX_10))
+#define CLIP_12(x) (av_clip((x), CLIP_MIN, CLIP_MAX_12))
 
 /**
  * Add bias value, clamp and output pixels of a slice
  */
-static void put_pixels_10(uint16_t *dst, ptrdiff_t linesize, const int16_t *in)
-{
+
+static inline void put_pixel(uint16_t *dst, ptrdiff_t linesize, const int16_t 
*in, int bits_per_raw_sample) {
 int x, y, src_offset, dst_offset;
 
 for (y = 0, dst_offset = 0; y < 8; y++, dst_offset += linesize) {
 for (x = 0; x < 8; x++) {
 src_offset = (y << 3) + x;
 
-dst[dst_offset + x] = CLIP_10(in[src_offset]);
+if (bits_per_raw_sample == 10) {
+dst[dst_offset + x] = CLIP_10(in[src_offset]);
+} else {//12b
+dst[dst_offset + x] = CLIP_12(in[src_offset]);
+}
 }
 }
 }
 
+static void put_pixels_10(uint16_t *dst, ptrdiff_t linesize, const int16_t *in)
+{
+put_pixel(dst, linesize, in, 10);
+}
+
+static void put_pixels_12(uint16_t *dst, ptrdiff_t linesize, const int16_t *in)
+{
+put_pixel(dst, linesize, in, 12);
+}
+
 static void prores_idct_put_10_c(uint16_t *out, ptrdiff_t linesize, int16_t 
*block, const int16_t *qmat)
 {
 ff_prores_idct_10(block, qmat);
 put_pixels_10(out, linesize >> 1, block);
 }
 
+static void prores_idct_put_12_c(uint16_t *out, ptrdiff_t linesize, int16_t 
*block, const int16_t *qmat)
+{
+ff_prores_idct_12(block, qmat);
+put_pixels_12(out, linesize >> 1, block);
+}
+
 av_cold int ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx)
 {
 if (avctx->bits_per_raw_sample == 10) {
 dsp->idct_put = prores_idct_put_10_c;
 dsp->idct_permutation_type = FF_IDCT_PERM_NONE;
+} else if (avctx->bits_per_raw_sample == 12) {
+dsp->idct_put = prores_idct_put_12_c;
+dsp->idct_permutation_type = FF_IDCT_PERM_NONE;
 } else {
 return AVERROR_BUG;
 }
diff --git a/libavcodec/simple_idct.c b/libavcodec/simple_idct.c
index 2171d71d06..3b2e736538 100644
--- a/libavcodec/simple_idct.c
+++ b/libavcodec/simple_idct.c
@@ -251,3 +251,19 @@ void ff_prores_idct_10(int16_t *block, const int16_t *qmat)
 idctSparseCol_extrashift_10(block + i);
 }
 }
+
+void ff_prores_idct_12(int16_t *block, const int16_t *qmat)
+{
+int i;
+
+for (i = 0; i < 64; i++)
+block[i] *= qmat[i];
+
+for (i = 0; i < 8; i++)
+idctRowCondDC_int16_12bit(block + i*8, 0);
+
+for (i = 0; i < 8; i++) {
+block[i] += 8192;
+idctSparseCol_int16_12bit(block + i);
+}
+}
diff --git a/libavcodec/simple_idct.h b/libavcodec/simple_idct.h
index 634a78e59e..20578b3347 100644
--- a/libavcodec/simple_idct.h
+++ b/libavcodec/simple_idct.h
@@ -53,6 +53,7 @@ void ff_simple_idct_int16_12bit(int16_t *block);
  * for larger scale of input coefficients.
  */
 void ff_prores_idct_10(int16_t *block, const int16_t *qmat);
+void ff_prores_idct_12(int16_t *block, const int16_t *qmat);
 
 void ff_simple_idct248_put(uint8_t *dest, ptrdiff_t line_size, int16_t *block);
 

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


[FFmpeg-cvslog] avcodec/proresdec : move dsp init after codec tag check

2018-12-02 Thread Martin Vignali
ffmpeg | branch: master | Martin Vignali  | Sat Nov 
17 23:33:12 2018 +0100| [a970920026010bd9e03f99017c305212b889d4a5] | committer: 
Martin Vignali

avcodec/proresdec : move dsp init after codec tag check

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

 libavcodec/proresdec2.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index 130a4e3fe8..835df19418 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -53,15 +53,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
 avctx->bits_per_raw_sample = 10;
 
-ff_blockdsp_init(&ctx->bdsp, avctx);
-ff_proresdsp_init(&ctx->prodsp, avctx);
-
-ff_init_scantable_permutation(idct_permutation,
-  ctx->prodsp.idct_permutation_type);
-
-permute(ctx->progressive_scan, ff_prores_progressive_scan, 
idct_permutation);
-permute(ctx->interlaced_scan, ff_prores_interlaced_scan, idct_permutation);
-
 switch (avctx->codec_tag) {
 case MKTAG('a','p','c','o'):
 avctx->profile = FF_PROFILE_PRORES_PROXY;
@@ -86,6 +77,15 @@ static av_cold int decode_init(AVCodecContext *avctx)
 av_log(avctx, AV_LOG_WARNING, "Unknown prores profile %d\n", 
avctx->codec_tag);
 }
 
+ff_blockdsp_init(&ctx->bdsp, avctx);
+ff_proresdsp_init(&ctx->prodsp, avctx);
+
+ff_init_scantable_permutation(idct_permutation,
+  ctx->prodsp.idct_permutation_type);
+
+permute(ctx->progressive_scan, ff_prores_progressive_scan, 
idct_permutation);
+permute(ctx->interlaced_scan, ff_prores_interlaced_scan, idct_permutation);
+
 return 0;
 }
 

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


[FFmpeg-cvslog] avcodec/proresdec : add 12b decoding

2018-12-02 Thread Martin Vignali
ffmpeg | branch: master | Martin Vignali  | Tue Nov 
27 22:41:38 2018 +0100| [ffafa53dbf06c8967aada9b7c0fc7ef9cb374fc0] | committer: 
Martin Vignali

avcodec/proresdec : add 12b decoding

based on patch by Kieran Kunhya

ticket 7163

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

 libavcodec/proresdec2.c | 35 -
 tests/fate/prores.mak   |  8 
 tests/ref/fate/prores-alpha |  4 ++--
 tests/ref/fate/prores-alpha_skip|  4 ++--
 tests/ref/fate/prores-transparency  |  2 +-
 tests/ref/fate/prores-transparency_skip |  2 +-
 6 files changed, 40 insertions(+), 15 deletions(-)

diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index 8a537eed1a..8581d797fb 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -155,15 +155,23 @@ static av_cold int decode_init(AVCodecContext *avctx)
 break;
 case MKTAG('a','p','4','h'):
 avctx->profile = FF_PROFILE_PRORES_;
+avctx->bits_per_raw_sample = 12;
 break;
 case MKTAG('a','p','4','x'):
 avctx->profile = FF_PROFILE_PRORES_XQ;
+avctx->bits_per_raw_sample = 12;
 break;
 default:
 avctx->profile = FF_PROFILE_UNKNOWN;
 av_log(avctx, AV_LOG_WARNING, "Unknown prores profile %d\n", 
avctx->codec_tag);
 }
 
+if (avctx->bits_per_raw_sample == 10) {
+av_log(avctx, AV_LOG_DEBUG, "Auto bitdepth precision. Use 10b decoding 
based on codec tag");
+} else { /* 12b */
+av_log(avctx, AV_LOG_DEBUG, "Auto bitdepth precision. Use 12b decoding 
based on codec tag");
+}
+
 ff_blockdsp_init(&ctx->bdsp, avctx);
 ret = ff_proresdsp_init(&ctx->prodsp, avctx);
 if (ret < 0) {
@@ -211,6 +219,7 @@ static int decode_frame_header(ProresContext *ctx, const 
uint8_t *buf,
 
 width  = AV_RB16(buf + 8);
 height = AV_RB16(buf + 10);
+
 if (width != avctx->width || height != avctx->height) {
 av_log(avctx, AV_LOG_ERROR, "picture resolution change: %dx%d -> 
%dx%d\n",
avctx->width, avctx->height, width, height);
@@ -237,9 +246,17 @@ static int decode_frame_header(ProresContext *ctx, const 
uint8_t *buf,
 }
 
 if (ctx->alpha_info) {
-avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUVA444P10 : 
AV_PIX_FMT_YUVA422P10;
+if (avctx->bits_per_raw_sample == 10) {
+avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUVA444P10 
: AV_PIX_FMT_YUVA422P10;
+} else { /* 12b */
+avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUVA444P12 
: AV_PIX_FMT_YUVA422P12;
+}
 } else {
-avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P10 : 
AV_PIX_FMT_YUV422P10;
+if (avctx->bits_per_raw_sample == 10) {
+avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P10 : 
AV_PIX_FMT_YUV422P10;
+} else { /* 12b */
+avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P12 : 
AV_PIX_FMT_YUV422P12;
+}
 }
 
 avctx->color_primaries = buf[14];
@@ -585,6 +602,7 @@ static void decode_slice_alpha(ProresContext *ctx,
 }
 
 block = blocks;
+
 for (i = 0; i < 16; i++) {
 memcpy(dst, block, 16 * blocks_per_slice * sizeof(*dst));
 dst   += dst_stride >> 1;
@@ -606,6 +624,7 @@ static int decode_slice_thread(AVCodecContext *avctx, void 
*arg, int jobnr, int
 LOCAL_ALIGNED_16(int16_t, qmat_chroma_scaled,[64]);
 int mb_x_shift;
 int ret;
+uint16_t val_no_chroma;
 
 slice->ret = -1;
 //av_log(avctx, AV_LOG_INFO, "slice %d mb width %d mb x %d y %d\n",
@@ -643,7 +662,8 @@ static int decode_slice_thread(AVCodecContext *avctx, void 
*arg, int jobnr, int
 chroma_stride = pic->linesize[1] << 1;
 }
 
-if (avctx->pix_fmt == AV_PIX_FMT_YUV444P10 || avctx->pix_fmt == 
AV_PIX_FMT_YUVA444P10) {
+if (avctx->pix_fmt == AV_PIX_FMT_YUV444P10 || avctx->pix_fmt == 
AV_PIX_FMT_YUVA444P10 ||
+avctx->pix_fmt == AV_PIX_FMT_YUV444P12 || avctx->pix_fmt == 
AV_PIX_FMT_YUVA444P12) {
 mb_x_shift = 5;
 log2_chroma_blocks_per_mb = 2;
 } else {
@@ -684,10 +704,15 @@ static int decode_slice_thread(AVCodecContext *avctx, 
void *arg, int jobnr, int
 else {
 size_t mb_max_x = slice->mb_count << (mb_x_shift - 1);
 size_t i, j;
+if (avctx->bits_per_raw_sample == 10) {
+val_no_chroma = 511;
+} else { /* 12b */
+val_no_chroma = 511 * 4;
+}
 for (i = 0; i < 16; ++i)
 for (j = 0; j < mb_max_x; ++j) {
-*(uint16_t*)(dest_u + (i * chroma_stride) + (j << 1)) = 511;
-*(uint16_t*)(dest_v + (i * chroma_stride) + (j << 1)) = 511;
+*(uint16_t*)(dest_u + (i * chroma_stride) + (j << 1)) = 
val_no_chroma;
+*(uint16_t*)(dest_v + (i * chroma_stride) + (j <<

[FFmpeg-cvslog] avcodec/proresdec : put unpack alpha func in prores ctx

2018-12-02 Thread Martin Vignali
ffmpeg | branch: master | Martin Vignali  | Sat Nov 
17 23:36:23 2018 +0100| [1cccf9365df0351467eca13313ae989da5c2b0f3] | committer: 
Martin Vignali

avcodec/proresdec : put unpack alpha func in prores ctx

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

 libavcodec/proresdec.h  |   1 +
 libavcodec/proresdec2.c | 100 +---
 2 files changed, 54 insertions(+), 47 deletions(-)

diff --git a/libavcodec/proresdec.h b/libavcodec/proresdec.h
index 14ede5d16b..3d99eba078 100644
--- a/libavcodec/proresdec.h
+++ b/libavcodec/proresdec.h
@@ -50,6 +50,7 @@ typedef struct {
 const uint8_t *scan;
 int first_field;
 int alpha_info;
+void (*unpack_alpha)(GetBitContext *gb, uint16_t *dst, int num_coeffs, 
const int num_bits);
 } ProresContext;
 
 #endif /* AVCODEC_PRORESDEC_H */
diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index 12b2cba090..94323df128 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -46,6 +46,51 @@ static void permute(uint8_t *dst, const uint8_t *src, const 
uint8_t permutation[
 dst[i] = permutation[src[i]];
 }
 
+static void unpack_alpha_10(GetBitContext *gb, uint16_t *dst, int num_coeffs,
+const int num_bits)
+{
+const int mask = (1 << num_bits) - 1;
+int i, idx, val, alpha_val;
+
+idx   = 0;
+alpha_val = mask;
+do {
+do {
+if (get_bits1(gb)) {
+val = get_bits(gb, num_bits);
+} else {
+int sign;
+val  = get_bits(gb, num_bits == 16 ? 7 : 4);
+sign = val & 1;
+val  = (val + 2) >> 1;
+if (sign)
+val = -val;
+}
+alpha_val = (alpha_val + val) & mask;
+if (num_bits == 16) {
+dst[idx++] = alpha_val >> 6;
+} else {
+dst[idx++] = (alpha_val << 2) | (alpha_val >> 6);
+}
+if (idx >= num_coeffs)
+break;
+} while (get_bits_left(gb)>0 && get_bits1(gb));
+val = get_bits(gb, 4);
+if (!val)
+val = get_bits(gb, 11);
+if (idx + val > num_coeffs)
+val = num_coeffs - idx;
+if (num_bits == 16) {
+for (i = 0; i < val; i++)
+dst[idx++] = alpha_val >> 6;
+} else {
+for (i = 0; i < val; i++)
+dst[idx++] = (alpha_val << 2) | (alpha_val >> 6);
+
+}
+} while (idx < num_coeffs);
+}
+
 static av_cold int decode_init(AVCodecContext *avctx)
 {
 int ret = 0;
@@ -91,6 +136,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
 permute(ctx->progressive_scan, ff_prores_progressive_scan, 
idct_permutation);
 permute(ctx->interlaced_scan, ff_prores_interlaced_scan, idct_permutation);
 
+if (avctx->bits_per_raw_sample == 10){
+ctx->unpack_alpha = unpack_alpha_10;
+} else {
+av_log(avctx, AV_LOG_ERROR, "Fail to set unpack_alpha for bits per raw 
sample %d\n", avctx->bits_per_raw_sample);
+return AVERROR_BUG;
+}
 return ret;
 }
 
@@ -466,51 +517,6 @@ static int decode_slice_chroma(AVCodecContext *avctx, 
SliceContext *slice,
 return 0;
 }
 
-static void unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs,
- const int num_bits)
-{
-const int mask = (1 << num_bits) - 1;
-int i, idx, val, alpha_val;
-
-idx   = 0;
-alpha_val = mask;
-do {
-do {
-if (get_bits1(gb)) {
-val = get_bits(gb, num_bits);
-} else {
-int sign;
-val  = get_bits(gb, num_bits == 16 ? 7 : 4);
-sign = val & 1;
-val  = (val + 2) >> 1;
-if (sign)
-val = -val;
-}
-alpha_val = (alpha_val + val) & mask;
-if (num_bits == 16) {
-dst[idx++] = alpha_val >> 6;
-} else {
-dst[idx++] = (alpha_val << 2) | (alpha_val >> 6);
-}
-if (idx >= num_coeffs)
-break;
-} while (get_bits_left(gb)>0 && get_bits1(gb));
-val = get_bits(gb, 4);
-if (!val)
-val = get_bits(gb, 11);
-if (idx + val > num_coeffs)
-val = num_coeffs - idx;
-if (num_bits == 16) {
-for (i = 0; i < val; i++)
-dst[idx++] = alpha_val >> 6;
-} else {
-for (i = 0; i < val; i++)
-dst[idx++] = (alpha_val << 2) | (alpha_val >> 6);
-
-}
-} while (idx < num_coeffs);
-}
-
 /**
  * Decode alpha slice plane.
  */
@@ -530,9 +536,9 @@ static void decode_slice_alpha(ProresContext *ctx,
 init_get_bits(&gb, buf, buf_size << 3);
 
 if (ctx->alpha_info == 2) {
-unpack_alpha(&gb, blocks, blocks_per_slice * 4