[FFmpeg-cvslog] avcodec: libdav1d AV1 decoder wrapper.

2018-11-05 Thread James Almer
ffmpeg | branch: master | James Almer  | Mon May 21 17:46:48 
2018 -0400| [beaa350e24167f4ff31275a6114693f5ce7cd409] | committer: James Almer

avcodec: libdav1d AV1 decoder wrapper.

Originally written by Ronald S. Bultje, with fixes, optimizations and
improvements by James Almer.

Signed-off-by: James Almer 

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

 Changelog  |   2 +
 configure  |   4 +
 doc/general.texi   |   4 +-
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/libdav1d.c  | 270 +
 libavcodec/version.h   |   4 +-
 7 files changed, 282 insertions(+), 4 deletions(-)

diff --git a/Changelog b/Changelog
index 640ffe7c12..e38a607025 100644
--- a/Changelog
+++ b/Changelog
@@ -3,6 +3,8 @@ releases are sorted from youngest to oldest.
 
 version :
 - tpad filter
+- AV1 decoding support through libdav1d
+
 
 version 4.1:
 - deblock filter
diff --git a/configure b/configure
index e79dae896c..00b5d9795e 100755
--- a/configure
+++ b/configure
@@ -226,6 +226,7 @@ External library support:
   --enable-libcelt enable CELT decoding via libcelt [no]
   --enable-libcdio enable audio CD grabbing with libcdio [no]
   --enable-libcodec2   enable codec2 en/decoding using libcodec2 [no]
+  --enable-libdav1denable AV1 decoding via libdav1d [no]
   --enable-libdavs2enable AVS2 decoding via libdavs2 [no]
   --enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
and libraw1394 [no]
@@ -1712,6 +1713,7 @@ EXTERNAL_LIBRARY_LIST="
 libcaca
 libcelt
 libcodec2
+libdav1d
 libdc1394
 libdrm
 libflite
@@ -3090,6 +3092,7 @@ libaom_av1_encoder_select="extract_extradata_bsf"
 libcelt_decoder_deps="libcelt"
 libcodec2_decoder_deps="libcodec2"
 libcodec2_encoder_deps="libcodec2"
+libdav1d_decoder_deps="libdav1d"
 libdavs2_decoder_deps="libdavs2"
 libfdk_aac_decoder_deps="libfdk_aac"
 libfdk_aac_encoder_deps="libfdk_aac"
@@ -6068,6 +6071,7 @@ enabled libcelt   && require libcelt celt/celt.h 
celt_decode -lcelt0 &&
die "ERROR: libcelt must be installed and 
version must be >= 0.11.0."; }
 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 libdc1394 && require_pkg_config libdc1394 libdc1394-2 
dc1394/dc1394.h dc1394_new
 enabled libdrm&& require_pkg_config libdrm libdrm xf86drm.h 
drmGetVersion
diff --git a/doc/general.texi b/doc/general.texi
index 2b015f143a..5256e0653d 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -758,8 +758,8 @@ following image formats are supported:
 @item Autodesk Animator Flic video  @tab @tab  X
 @item Autodesk RLE   @tab @tab  X
 @tab fourcc: AASC
-@item AV1@tab @tab  E
-@tab Supported through external library libaom
+@item AV1@tab  E  @tab  E
+@tab Supported through external libraries libaom and libdav1d
 @item Avid 1:1 10-bit RGB Packer  @tab  X  @tab  X
 @tab fourcc: AVrp
 @item AVS (Audio Video Standard) video  @tab @tab  X
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 3e41497e34..8643da8f2b 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -956,6 +956,7 @@ OBJS-$(CONFIG_LIBAOM_AV1_ENCODER) += libaomenc.o
 OBJS-$(CONFIG_LIBCELT_DECODER)+= libcelt_dec.o
 OBJS-$(CONFIG_LIBCODEC2_DECODER)  += libcodec2.o codec2utils.o
 OBJS-$(CONFIG_LIBCODEC2_ENCODER)  += libcodec2.o codec2utils.o
+OBJS-$(CONFIG_LIBDAV1D_DECODER)   += libdav1d.o
 OBJS-$(CONFIG_LIBDAVS2_DECODER)   += libdavs2.o
 OBJS-$(CONFIG_LIBFDK_AAC_DECODER) += libfdk-aacdec.o
 OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 1b8144a2b7..2c17db5a70 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -676,6 +676,7 @@ extern AVCodec ff_libaom_av1_encoder;
 extern AVCodec ff_libcelt_decoder;
 extern AVCodec ff_libcodec2_encoder;
 extern AVCodec ff_libcodec2_decoder;
+extern AVCodec ff_libdav1d_decoder;
 extern AVCodec ff_libdavs2_decoder;
 extern AVCodec ff_libfdk_aac_encoder;
 extern AVCodec ff_libfdk_aac_decoder;
diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
new file mode 100644
index 00..873adfda40
--- /dev/null
+++ b/libavcodec/libdav1d.c
@@ -0,0 +1,270 @@
+/*
+ * Copyright (c) 2018 Ronald S. Bultje 
+ * Copyright (c) 2018 James Almer 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can 

[FFmpeg-cvslog] Tag n4.2-dev : Main development, master branch after release/4.1 branched off

2018-11-05 Thread git
[ffmpeg] [branch: refs/tags/n4.2-dev]
Tag:562ae4d1d500bb9baa7db82f74e87cedb3594dcc
> http://git.videolan.org/gitweb.cgi/ffmpeg.git?a=tag;h=562ae4d1d500bb9baa7db82f74e87cedb3594dcc

Tagger: James Almer 
Date:   Mon Nov  5 21:21:01 2018 -0300

Main development, master branch after release/4.1 branched off
___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] [ffmpeg-web] branch master updated. 0d3eb9e web/security: add CVE-2018-10001 entry to FFmpeg 4.0

2018-11-05 Thread ffmpeg-git
The branch, master has been updated
   via  0d3eb9e802c1ee63bf627dfc9e688bbe118eaa4e (commit)
   via  916bc717c793c61548da06f636c78f683404ecee (commit)
  from  45cc0cafbbd06f5b33adf6d8fd907da218bce93d (commit)


- Log -
commit 0d3eb9e802c1ee63bf627dfc9e688bbe118eaa4e
Author: Michael Niedermayer 
AuthorDate: Tue Nov 6 01:17:23 2018 +0100
Commit: Michael Niedermayer 
CommitDate: Tue Nov 6 01:17:23 2018 +0100

web/security: add CVE-2018-10001 entry to FFmpeg 4.0

diff --git a/src/security b/src/security
index df42c5b..748a447 100644
--- a/src/security
+++ b/src/security
@@ -64,6 +64,7 @@ Fixes following vulnerabilities:
 CVE-2018-6912, 76cc0f0f673353cd4746cd3b83838ae335e5d9ed
 CVE-2018-7751, a6cba062051f345e8ebfdff34aba071ed73d923f
 CVE-2018-7557, 7414d0bda7763f9bd69c26c068e482ab297c1c96
+CVE-2018-10001, 47b7c68ae54560e2308bdb6be4fb076c73b93081
 
 
 FFmpeg 3.4

commit 916bc717c793c61548da06f636c78f683404ecee
Author: Michael Niedermayer 
AuthorDate: Tue Nov 6 01:16:50 2018 +0100
Commit: Michael Niedermayer 
CommitDate: Tue Nov 6 01:16:50 2018 +0100

web: add FFmpeg 4.1

diff --git a/src/download b/src/download
index 1b2508c..d4ef0d0 100644
--- a/src/download
+++ b/src/download
@@ -1,10 +1,10 @@
 
 
   
-https://ffmpeg.org/releases/ffmpeg-4.0.3.tar.bz2; class="btn 
btn-success">
+https://ffmpeg.org/releases/ffmpeg-4.1.tar.bz2; class="btn 
btn-success">
   
   Download
-  ffmpeg-4.0.3.tar.bz2
+  ffmpeg-4.1.tar.bz2
 
 
 More releases
@@ -269,6 +269,43 @@
 and much faster bug fixes such as additional features and security patches.
   
 
+  FFmpeg 4.1 "al-Khwarizmi"
+
+  
+4.1 was released on 2018-11-06. It is the latest stable FFmpeg release
+from the 4.1 release branch, which was cut from master on 2018-11-02.
+  
+  It includes the following library versions:
+  
+  
+libavutil  56. 22.100
+libavcodec 58. 35.100
+libavformat58. 20.100
+libavdevice58.  5.100
+libavfilter 7. 40.101
+libswscale  5.  3.100
+libswresample   3.  3.100
+libpostproc55.  3.100
+
+  
+
+  Download xz 
tarball
+  PGP signature
+ 
+
+  Download 
bzip2 tarball
+  PGP 
signature
+ 
+
+  Download 
gzip tarball
+  PGP signature
+ 
+
+  https://git.ffmpeg.org/gitweb/ffmpeg.git/shortlog/n4.1;>Changelog
+  https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/refs/heads/release/4.1:/RELEASE_NOTES;>Release
 Notes
+ 
+   
+
   FFmpeg 4.0.3 "Wu"
 
   
diff --git a/src/security b/src/security
index 5f143a8..df42c5b 100644
--- a/src/security
+++ b/src/security
@@ -1,5 +1,27 @@
 Please report vulnerabilities to mailto:ffmpeg-secur...@ffmpeg.org;>ffmpeg-secur...@ffmpeg.org
 
+
+FFmpeg 4.1
+
+4.1
+
+Fixes following vulnerabilities:
+
+
+CVE-2018-12458, e1182fac1afba92a4975917823a5f644bee7e6e8
+CVE-2018-12459, 2fc108f60f98cd00813418a8754a46476b404a3c
+CVE-2018-12460, b3332a182f8ba33a34542e4a0370f38b914ccf7d
+CVE-2018-13300, 95556e27e2c1d56d9e18f5db34d6f756f3011148
+CVE-2018-13301, 2aa9047486dbff12d9e040f917e5f799ed2fd78b
+CVE-2018-13302, ed22dc22216f74c75ee7901f82649e1ff725ba50
+CVE-2018-13303, 00e8181bd97c834fe60751b0c511d4bb97875f78
+CVE-2018-13304, bd27a9364ca274ca97f1df6d984e88a0700fb235
+CVE-2018-13305, d08d4a8c7387e758d439b0592782e4cfa2b4d6a4
+CVE-2018-14394, 3a2d21bc5f97aa0161db3ae731fc2732be6108b8
+CVE-2018-14395, fa19fbcf712a6a6cc5a5cfdc3254a97b9bce6582
+CVE-2018-15822, 6b67d7f05918f7a1ee8fc6ff21355d7e8736aa10
+
+
 FFmpeg 4.0
 
 4.0.3

---

Summary of changes:
 src/download | 41 +++--
 src/security | 23 +++
 2 files changed, 62 insertions(+), 2 deletions(-)


hooks/post-receive
-- 

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


[FFmpeg-cvslog] Tag n4.1 : FFmpeg 4.1 release

2018-11-05 Thread git
[ffmpeg] [branch: refs/tags/n4.1]
Tag:085d7707e7dd817e3a859adb5457db757669597a
> http://git.videolan.org/gitweb.cgi/ffmpeg.git?a=tag;h=085d7707e7dd817e3a859adb5457db757669597a

Tagger: Michael Niedermayer 
Date:   Tue Nov  6 00:59:36 2018 +0100

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


[FFmpeg-cvslog] configure: Add missing V4L2 M2M decoder BSF dependencies

2018-11-05 Thread Mark Thompson
ffmpeg | branch: release/4.1 | Mark Thompson  | Mon Nov  5 
14:22:10 2018 +| [ec1b5216fc65602b97cf5dc97a9a9a266f38894f] | committer: 
Mark Thompson

configure: Add missing V4L2 M2M decoder BSF dependencies

(cherry picked from commit e9d2e3fdaacb6872dd689ffd5a65e476b70dee3d)

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

 configure | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure b/configure
index 5e8c20f8fb..e79dae896c 100755
--- a/configure
+++ b/configure
@@ -2957,6 +2957,7 @@ h264_rkmpp_decoder_deps="rkmpp"
 h264_rkmpp_decoder_select="h264_mp4toannexb_bsf"
 h264_vaapi_encoder_select="cbs_h264 vaapi_encode"
 h264_v4l2m2m_decoder_deps="v4l2_m2m h264_v4l2_m2m"
+h264_v4l2m2m_decoder_select="h264_mp4toannexb_bsf"
 h264_v4l2m2m_encoder_deps="v4l2_m2m h264_v4l2_m2m"
 hevc_amf_encoder_deps="amf"
 hevc_cuvid_decoder_deps="cuvid"
@@ -2971,6 +2972,7 @@ hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf"
 hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
 hevc_vaapi_encoder_select="cbs_h265 vaapi_encode"
 hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m"
+hevc_v4l2m2m_decoder_select="hevc_mp4toannexb_bsf"
 hevc_v4l2m2m_encoder_deps="v4l2_m2m hevc_v4l2_m2m"
 mjpeg_cuvid_decoder_deps="cuvid"
 mjpeg_qsv_encoder_deps="libmfx"

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


[FFmpeg-cvslog] configure: Add missing IVF muxer BSF dependency

2018-11-05 Thread Mark Thompson
ffmpeg | branch: release/4.1 | Mark Thompson  | Mon Nov  5 
14:22:05 2018 +| [066ff02621cea7d78d7791c91e0d916c30bffb27] | committer: 
Mark Thompson

configure: Add missing IVF muxer BSF dependency

(cherry picked from commit a4fb2b115071220f23ad7b3d82037647e94279ed)

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

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

diff --git a/configure b/configure
index 23ad59031c..5e8c20f8fb 100755
--- a/configure
+++ b/configure
@@ -3180,7 +3180,7 @@ image2_alias_pix_demuxer_select="image2_demuxer"
 image2_brender_pix_demuxer_select="image2_demuxer"
 ipod_muxer_select="mov_muxer"
 ismv_muxer_select="mov_muxer"
-ivf_muxer_select="av1_metadata_bsf"
+ivf_muxer_select="av1_metadata_bsf vp9_superframe_bsf"
 matroska_audio_muxer_select="matroska_muxer"
 matroska_demuxer_select="iso_media riffdec"
 matroska_demuxer_suggest="bzlib lzo zlib"

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


[FFmpeg-cvslog] cbs_av1: Support redundant frame headers

2018-11-05 Thread Mark Thompson
ffmpeg | branch: release/4.1 | Mark Thompson  | Sun Nov  4 
23:58:01 2018 +| [10506de9ad1fb050737ef79cf4853742b793c37d] | committer: 
Mark Thompson

cbs_av1: Support redundant frame headers

(cherry picked from commit f5894178fb8063ec17c61c04df96a70607ca2daa)

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

 libavcodec/cbs_av1.c | 16 +--
 libavcodec/cbs_av1.h |  5 ++-
 libavcodec/cbs_av1_syntax_template.c | 82 +---
 3 files changed, 91 insertions(+), 12 deletions(-)

diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index 1c49d90f51..ff32a6fca5 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -996,7 +996,10 @@ static int cbs_av1_read_unit(CodedBitstreamContext *ctx,
 case AV1_OBU_REDUNDANT_FRAME_HEADER:
 {
 err = cbs_av1_read_frame_header_obu(ctx, ,
->obu.frame_header);
+>obu.frame_header,
+obu->header.obu_type ==
+AV1_OBU_REDUNDANT_FRAME_HEADER,
+unit->data_ref);
 if (err < 0)
 return err;
 }
@@ -1016,7 +1019,8 @@ static int cbs_av1_read_unit(CodedBitstreamContext *ctx,
 break;
 case AV1_OBU_FRAME:
 {
-err = cbs_av1_read_frame_obu(ctx, , >obu.frame);
+err = cbs_av1_read_frame_obu(ctx, , >obu.frame,
+ unit->data_ref);
 if (err < 0)
 return err;
 
@@ -1124,7 +1128,10 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx,
 case AV1_OBU_REDUNDANT_FRAME_HEADER:
 {
 err = cbs_av1_write_frame_header_obu(ctx, pbc,
- >obu.frame_header);
+ >obu.frame_header,
+ obu->header.obu_type ==
+ 
AV1_OBU_REDUNDANT_FRAME_HEADER,
+ NULL);
 if (err < 0)
 return err;
 }
@@ -1141,7 +1148,7 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx,
 break;
 case AV1_OBU_FRAME:
 {
-err = cbs_av1_write_frame_obu(ctx, pbc, >obu.frame);
+err = cbs_av1_write_frame_obu(ctx, pbc, >obu.frame, NULL);
 if (err < 0)
 return err;
 
@@ -1302,6 +1309,7 @@ static void cbs_av1_close(CodedBitstreamContext *ctx)
 CodedBitstreamAV1Context *priv = ctx->priv_data;
 
 av_buffer_unref(>sequence_header_ref);
+av_buffer_unref(>frame_header_ref);
 
 av_freep(>write_buffer);
 }
diff --git a/libavcodec/cbs_av1.h b/libavcodec/cbs_av1.h
index 614a0bf108..f662265f75 100644
--- a/libavcodec/cbs_av1.h
+++ b/libavcodec/cbs_av1.h
@@ -399,7 +399,10 @@ typedef struct CodedBitstreamAV1Context {
 AV1RawSequenceHeader *sequence_header;
 AVBufferRef  *sequence_header_ref;
 
-int seen_frame_header;
+int seen_frame_header;
+AVBufferRef *frame_header_ref;
+uint8_t *frame_header;
+size_t   frame_header_size;
 
 int temporal_id;
 int spatial_id;
diff --git a/libavcodec/cbs_av1_syntax_template.c 
b/libavcodec/cbs_av1_syntax_template.c
index e146bbf8bb..0da79b615d 100644
--- a/libavcodec/cbs_av1_syntax_template.c
+++ b/libavcodec/cbs_av1_syntax_template.c
@@ -1463,24 +1463,90 @@ static int 
FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
 }
 
 static int FUNC(frame_header_obu)(CodedBitstreamContext *ctx, RWContext *rw,
-  AV1RawFrameHeader *current)
+  AV1RawFrameHeader *current, int redundant,
+  AVBufferRef *rw_buffer_ref)
 {
 CodedBitstreamAV1Context *priv = ctx->priv_data;
-int err;
-
-HEADER("Frame Header");
+int start_pos, fh_bits, fh_bytes, err;
+uint8_t *fh_start;
 
 if (priv->seen_frame_header) {
-// Nothing to do.
+if (!redundant) {
+av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid repeated "
+   "frame header OBU.\n");
+return AVERROR_INVALIDDATA;
+} else {
+GetBitContext fh;
+size_t i, b;
+uint32_t val;
+
+HEADER("Redundant Frame Header");
+
+av_assert0(priv->frame_header_ref && priv->frame_header);
+
+init_get_bits(, priv->frame_header,
+  priv->frame_header_size);
+for (i = 0; i < priv->frame_header_size; i += 8) {
+b = FFMIN(priv->frame_header_size - i, 8);
+val = get_bits(, b);
+xf(b, frame_header_copy[i],
+   

[FFmpeg-cvslog] cbs_av1: Fix header writing when already aligned

2018-11-05 Thread Mark Thompson
ffmpeg | branch: release/4.1 | Mark Thompson  | Sun Nov  4 
23:56:39 2018 +| [af3fccfeff74da54fc3e702fbb6757c2aad2814e] | committer: 
Mark Thompson

cbs_av1: Fix header writing when already aligned

(cherry picked from commit 6bdb7712ae0267ba4f69c7434d2b3dee12762d1d)

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

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

diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index 9bac9dde09..1c49d90f51 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -1179,7 +1179,7 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx,
 if (err < 0)
 return err;
 end_pos = put_bits_count(pbc);
-obu->obu_size = (end_pos - start_pos + 7) / 8;
+obu->obu_size = header_size = (end_pos - start_pos + 7) / 8;
 } else {
 // Empty OBU.
 obu->obu_size = 0;

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


[FFmpeg-cvslog] cbs_av1: Support redundant frame headers

2018-11-05 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Sun Nov  4 23:58:01 
2018 +| [f5894178fb8063ec17c61c04df96a70607ca2daa] | committer: Mark 
Thompson

cbs_av1: Support redundant frame headers

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

 libavcodec/cbs_av1.c | 16 +--
 libavcodec/cbs_av1.h |  5 ++-
 libavcodec/cbs_av1_syntax_template.c | 82 +---
 3 files changed, 91 insertions(+), 12 deletions(-)

diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index 1c49d90f51..ff32a6fca5 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -996,7 +996,10 @@ static int cbs_av1_read_unit(CodedBitstreamContext *ctx,
 case AV1_OBU_REDUNDANT_FRAME_HEADER:
 {
 err = cbs_av1_read_frame_header_obu(ctx, ,
->obu.frame_header);
+>obu.frame_header,
+obu->header.obu_type ==
+AV1_OBU_REDUNDANT_FRAME_HEADER,
+unit->data_ref);
 if (err < 0)
 return err;
 }
@@ -1016,7 +1019,8 @@ static int cbs_av1_read_unit(CodedBitstreamContext *ctx,
 break;
 case AV1_OBU_FRAME:
 {
-err = cbs_av1_read_frame_obu(ctx, , >obu.frame);
+err = cbs_av1_read_frame_obu(ctx, , >obu.frame,
+ unit->data_ref);
 if (err < 0)
 return err;
 
@@ -1124,7 +1128,10 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx,
 case AV1_OBU_REDUNDANT_FRAME_HEADER:
 {
 err = cbs_av1_write_frame_header_obu(ctx, pbc,
- >obu.frame_header);
+ >obu.frame_header,
+ obu->header.obu_type ==
+ 
AV1_OBU_REDUNDANT_FRAME_HEADER,
+ NULL);
 if (err < 0)
 return err;
 }
@@ -1141,7 +1148,7 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx,
 break;
 case AV1_OBU_FRAME:
 {
-err = cbs_av1_write_frame_obu(ctx, pbc, >obu.frame);
+err = cbs_av1_write_frame_obu(ctx, pbc, >obu.frame, NULL);
 if (err < 0)
 return err;
 
@@ -1302,6 +1309,7 @@ static void cbs_av1_close(CodedBitstreamContext *ctx)
 CodedBitstreamAV1Context *priv = ctx->priv_data;
 
 av_buffer_unref(>sequence_header_ref);
+av_buffer_unref(>frame_header_ref);
 
 av_freep(>write_buffer);
 }
diff --git a/libavcodec/cbs_av1.h b/libavcodec/cbs_av1.h
index 614a0bf108..f662265f75 100644
--- a/libavcodec/cbs_av1.h
+++ b/libavcodec/cbs_av1.h
@@ -399,7 +399,10 @@ typedef struct CodedBitstreamAV1Context {
 AV1RawSequenceHeader *sequence_header;
 AVBufferRef  *sequence_header_ref;
 
-int seen_frame_header;
+int seen_frame_header;
+AVBufferRef *frame_header_ref;
+uint8_t *frame_header;
+size_t   frame_header_size;
 
 int temporal_id;
 int spatial_id;
diff --git a/libavcodec/cbs_av1_syntax_template.c 
b/libavcodec/cbs_av1_syntax_template.c
index e146bbf8bb..0da79b615d 100644
--- a/libavcodec/cbs_av1_syntax_template.c
+++ b/libavcodec/cbs_av1_syntax_template.c
@@ -1463,24 +1463,90 @@ static int 
FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
 }
 
 static int FUNC(frame_header_obu)(CodedBitstreamContext *ctx, RWContext *rw,
-  AV1RawFrameHeader *current)
+  AV1RawFrameHeader *current, int redundant,
+  AVBufferRef *rw_buffer_ref)
 {
 CodedBitstreamAV1Context *priv = ctx->priv_data;
-int err;
-
-HEADER("Frame Header");
+int start_pos, fh_bits, fh_bytes, err;
+uint8_t *fh_start;
 
 if (priv->seen_frame_header) {
-// Nothing to do.
+if (!redundant) {
+av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid repeated "
+   "frame header OBU.\n");
+return AVERROR_INVALIDDATA;
+} else {
+GetBitContext fh;
+size_t i, b;
+uint32_t val;
+
+HEADER("Redundant Frame Header");
+
+av_assert0(priv->frame_header_ref && priv->frame_header);
+
+init_get_bits(, priv->frame_header,
+  priv->frame_header_size);
+for (i = 0; i < priv->frame_header_size; i += 8) {
+b = FFMIN(priv->frame_header_size - i, 8);
+val = get_bits(, b);
+xf(b, frame_header_copy[i],
+   val, val, val, 1, i / 8);
+}
+}
 } else {

[FFmpeg-cvslog] cbs_av1: Fix header writing when already aligned

2018-11-05 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Sun Nov  4 23:56:39 
2018 +| [6bdb7712ae0267ba4f69c7434d2b3dee12762d1d] | committer: Mark 
Thompson

cbs_av1: Fix header writing when already aligned

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

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

diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index 9bac9dde09..1c49d90f51 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -1179,7 +1179,7 @@ static int cbs_av1_write_obu(CodedBitstreamContext *ctx,
 if (err < 0)
 return err;
 end_pos = put_bits_count(pbc);
-obu->obu_size = (end_pos - start_pos + 7) / 8;
+obu->obu_size = header_size = (end_pos - start_pos + 7) / 8;
 } else {
 // Empty OBU.
 obu->obu_size = 0;

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


[FFmpeg-cvslog] doc/filters: add document for opencl filters

2018-11-05 Thread Ruiling Song
ffmpeg | branch: master | Ruiling Song  | Mon Oct 29 
13:17:59 2018 +0800| [952a299fd390ca59267c30097ce2148ca730cc17] | committer: 
Lou Logan

doc/filters: add document for opencl filters

Signed-off-by: Danil Iashchenko 
Signed-off-by: Ruiling Song 
Signed-off-by: Gyan Doshi 

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

 doc/filters.texi | 486 +++
 1 file changed, 486 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index e1798a53ef..902666c9d0 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10607,6 +10607,7 @@ A floating point number which specifies chroma temporal 
strength. It defaults to
 @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
 @end table
 
+@anchor{hwdownload}
 @section hwdownload
 
 Download hardware frames to system memory.
@@ -10697,6 +10698,7 @@ ways if there are any additional constraints on that 
filter's output.
 Do not use it without fully understanding the implications of its use.
 @end table
 
+@anchor{hwupload}
 @section hwupload
 
 Upload system memory frames to hardware surfaces.
@@ -18459,6 +18461,490 @@ pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} 
is 1.
 
 @c man end VIDEO FILTERS
 
+@chapter OpenCL Video Filters
+@c man begin OPENCL VIDEO FILTERS
+
+Below is a description of the currently available OpenCL video filters.
+
+To enable compilation of these filters you need to configure FFmpeg with
+@code{--enable-opencl}.
+
+Running OpenCL filters requires you to initialize a hardware device and to 
pass that device to all filters in any filter graph.
+@table @option
+
+@item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
+Initialise a new hardware device of type @var{opencl} called @var{name}, using 
the
+given device parameters.
+
+@item -filter_hw_device @var{name}
+Pass the hardware device called @var{name} to all filters in any filter graph.
+
+@end table
+
+For more detailed information see 
@url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
+
+@itemize
+@item
+Example of choosing the first device on the second platform and running 
avgblur_opencl filter with default parameters on it.
+@example
+-init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, 
avgblur_opencl, hwdownload" OUTPUT
+@end example
+@end itemize
+
+Since OpenCL filters are not able to access frame data in normal memory, all 
frame data needs to be uploaded(@ref{hwupload}) to hardware surfaces connected 
to the appropriate device before being used and then 
downloaded(@ref{hwdownload}) back to normal memory. Note that @ref{hwupload} 
will upload to a surface with the same layout as the software frame, so it may 
be necessary to add a @ref{format} filter immediately before to get the input 
into the right format and @ref{hwdownload} does not support all formats on the 
output - it may be necessary to insert an additional @ref{format} filter 
immediately following in the graph to get the output in a supported format.
+
+@section avgblur_opencl
+
+Apply average blur filter.
+
+The filter accepts the following options:
+
+@table @option
+@item sizeX
+Set horizontal radius size.
+Range is @code{[1, 1024]} and default value is @code{1}.
+
+@item planes
+Set which planes to filter. Default value is @code{0xf}, by which all planes 
are processed.
+
+@item sizeY
+Set vertical radius size. Range is @code{[1, 1024]} and default value is 
@code{0}. If zero, @code{sizeX} value will be used.
+@end table
+
+@subsection Example
+
+@itemize
+@item
+Apply average blur filter with horizontal and vertical size of 3, setting each 
pixel of the output to the average value of the 7x7 region centered on it in 
the input. For pixels on the edges of the image, the region does not extend 
beyond the image boundaries, and so out-of-range coordinates are not used in 
the calculations.
+@example
+-i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
+@end example
+@end itemize
+
+@section boxblur_opencl
+
+Apply a boxblur algorithm to the input video.
+
+It accepts the following parameters:
+
+@table @option
+
+@item luma_radius, lr
+@item luma_power, lp
+@item chroma_radius, cr
+@item chroma_power, cp
+@item alpha_radius, ar
+@item alpha_power, ap
+
+@end table
+
+A description of the accepted options follows.
+
+@table @option
+@item luma_radius, lr
+@item chroma_radius, cr
+@item alpha_radius, ar
+Set an expression for the box radius in pixels used for blurring the
+corresponding input plane.
+
+The radius value must be a non-negative number, and must not be
+greater than the value of the expression @code{min(w,h)/2} for the
+luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
+planes.
+
+Default value for @option{luma_radius} is "2". If not specified,
+@option{chroma_radius} and @option{alpha_radius} default to the
+corresponding value set for @option{luma_radius}.
+
+The expressions can contain the 

[FFmpeg-cvslog] doc/filters: add tonemap_opencl document.

2018-11-05 Thread Ruiling Song
ffmpeg | branch: master | Ruiling Song  | Mon Oct 29 
13:56:59 2018 +0800| [a587454fd07c831a6c315ae2daf1d8f66396d967] | committer: 
Lou Logan

doc/filters: add tonemap_opencl document.

Signed-off-by: Ruiling Song 
Signed-off-by: Gyan Doshi 

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

 doc/filters.texi | 96 
 1 file changed, 96 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 902666c9d0..223940c721 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -16650,6 +16650,7 @@ tmix=frames=3:weights="-1 2 -1":scale=1
 @end example
 @end itemize
 
+@anchor{tonemap}
 @section tonemap
 Tone map colors from different dynamic ranges.
 
@@ -18885,6 +18886,101 @@ Apply sobel operator with scale set to 2 and delta 
set to 10
 @end example
 @end itemize
 
+@section tonemap_opencl
+
+Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
+
+It accepts the following parameters:
+
+@table @option
+@item tonemap
+Specify the tone-mapping operator to be used. Same as tonemap option in 
@ref{tonemap}.
+
+@item param
+Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
+
+@item desat
+Apply desaturation for highlights that exceed this level of brightness. The
+higher the parameter, the more color information will be preserved. This
+setting helps prevent unnaturally blown-out colors for super-highlights, by
+(smoothly) turning into white instead. This makes images feel more natural,
+at the cost of reducing information about out-of-range colors.
+
+The default value is 0.5, and the algorithm here is a little different from
+the cpu version tonemap currently. A setting of 0.0 disables this option.
+
+@item threshold
+The tonemapping algorithm parameters is fine-tuned per each scene. And a 
threshold
+is used to detect whether the scene has changed or not. If the distance beween
+the current frame average brightness and the current running average exceeds
+a threshold value, we would re-calculate scene average and peak brightness.
+The default value is 0.2.
+
+@item format
+Specify the output pixel format.
+
+Currently supported formats are:
+@table @var
+@item p010
+@item nv12
+@end table
+
+@item range, r
+Set the output color range.
+
+Possible values are:
+@table @var
+@item tv/mpeg
+@item pc/jpeg
+@end table
+
+Default is same as input.
+
+@item primaries, p
+Set the output color primaries.
+
+Possible values are:
+@table @var
+@item bt709
+@item bt2020
+@end table
+
+Default is same as input.
+
+@item transfer, t
+Set the output transfer characteristics.
+
+Possible values are:
+@table @var
+@item bt709
+@item bt2020
+@end table
+
+Default is bt709.
+
+@item matrix, m
+Set the output colorspace matrix.
+
+Possible value are:
+@table @var
+@item bt709
+@item bt2020
+@end table
+
+Default is same as input.
+
+@end table
+
+@subsection Example
+
+@itemize
+@item
+Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using 
linear operator.
+@example
+-i INPUT -vf 
"format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010"
 OUTPUT
+@end example
+@end itemize
+
 @section unsharp_opencl
 
 Sharpen or blur the input video.

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


[FFmpeg-cvslog] proresdec2: Parse codec_tag and export profile information

2018-11-05 Thread Vittorio Giovara
ffmpeg | branch: master | Vittorio Giovara  | Fri 
Nov  2 15:24:45 2018 -0400| [aefbb2bf029f3a01cc4198c9470550f7b007e868] | 
committer: Vittorio Giovara

proresdec2: Parse codec_tag and export profile information

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

 libavcodec/proresdec2.c | 24 
 libavcodec/version.h|  2 +-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index 6b3021bdfa..130a4e3fe8 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -62,6 +62,30 @@ 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);
 
+switch (avctx->codec_tag) {
+case MKTAG('a','p','c','o'):
+avctx->profile = FF_PROFILE_PRORES_PROXY;
+break;
+case MKTAG('a','p','c','s'):
+avctx->profile = FF_PROFILE_PRORES_LT;
+break;
+case MKTAG('a','p','c','n'):
+avctx->profile = FF_PROFILE_PRORES_STANDARD;
+break;
+case MKTAG('a','p','c','h'):
+avctx->profile = FF_PROFILE_PRORES_HQ;
+break;
+case MKTAG('a','p','4','h'):
+avctx->profile = FF_PROFILE_PRORES_;
+break;
+case MKTAG('a','p','4','x'):
+avctx->profile = FF_PROFILE_PRORES_XQ;
+break;
+default:
+avctx->profile = FF_PROFILE_UNKNOWN;
+av_log(avctx, AV_LOG_WARNING, "Unknown prores profile %d\n", 
avctx->codec_tag);
+}
+
 return 0;
 }
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 893ab9b0d1..0351b36c2b 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  38
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #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] prores: Use profile names in the various encoders and decoders

2018-11-05 Thread Vittorio Giovara
ffmpeg | branch: master | Vittorio Giovara  | Fri 
Nov  2 15:23:16 2018 -0400| [cdc487bfc841ce47e64bdd774f7bcc40e3f4a626] | 
committer: Vittorio Giovara

prores: Use profile names in the various encoders and decoders

Export FF_PROFILE_PRORES_* symbols publicly, add a missing one.

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

 libavcodec/avcodec.h|  7 +++
 libavcodec/codec_desc.c |  1 +
 libavcodec/profiles.c   | 10 ++
 libavcodec/profiles.h   |  1 +
 libavcodec/proresdec2.c |  2 ++
 libavcodec/proresenc_anatoliy.c | 11 +++
 libavcodec/proresenc_kostya.c   |  2 ++
 libavcodec/version.h|  2 +-
 8 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 80fa469f26..3922e89331 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2971,6 +2971,13 @@ typedef struct AVCodecContext {
 
 #define FF_PROFILE_SBC_MSBC 1
 
+#define FF_PROFILE_PRORES_PROXY 0
+#define FF_PROFILE_PRORES_LT1
+#define FF_PROFILE_PRORES_STANDARD  2
+#define FF_PROFILE_PRORES_HQ3
+#define FF_PROFILE_PRORES_  4
+#define FF_PROFILE_PRORES_XQ5
+
 /**
  * level
  * - encoding: Set by user.
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 1a159f7e13..ce9d39d924 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1077,6 +1077,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .name  = "prores",
 .long_name = NULL_IF_CONFIG_SMALL("Apple ProRes (iCodec Pro)"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+.profiles  = NULL_IF_CONFIG_SMALL(ff_prores_profiles),
 },
 {
 .id= AV_CODEC_ID_JV,
diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c
index c31399f83e..8a4447e438 100644
--- a/libavcodec/profiles.c
+++ b/libavcodec/profiles.c
@@ -151,4 +151,14 @@ const AVProfile ff_sbc_profiles[] = {
 { FF_PROFILE_UNKNOWN },
 };
 
+const AVProfile ff_prores_profiles[] = {
+{ FF_PROFILE_PRORES_PROXY,"Proxy"},
+{ FF_PROFILE_PRORES_LT,   "LT"   },
+{ FF_PROFILE_PRORES_STANDARD, "Standard" },
+{ FF_PROFILE_PRORES_HQ,   "HQ"   },
+{ FF_PROFILE_PRORES_, "" },
+{ FF_PROFILE_PRORES_XQ,   "XQ"   },
+{ FF_PROFILE_UNKNOWN }
+};
+
 #endif /* !CONFIG_SMALL */
diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
index 9d7e211e15..4669dad8d5 100644
--- a/libavcodec/profiles.h
+++ b/libavcodec/profiles.h
@@ -33,5 +33,6 @@ extern const AVProfile ff_vc1_profiles[];
 extern const AVProfile ff_vp9_profiles[];
 extern const AVProfile ff_av1_profiles[];
 extern const AVProfile ff_sbc_profiles[];
+extern const AVProfile ff_prores_profiles[];
 
 #endif /* AVCODEC_PROFILES_H */
diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index d818e5d8da..6b3021bdfa 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -33,6 +33,7 @@
 #include "get_bits.h"
 #include "idctdsp.h"
 #include "internal.h"
+#include "profiles.h"
 #include "simple_idct.h"
 #include "proresdec.h"
 #include "proresdata.h"
@@ -730,4 +731,5 @@ AVCodec ff_prores_decoder = {
 .close  = decode_close,
 .decode = decode_frame,
 .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SLICE_THREADS | 
AV_CODEC_CAP_FRAME_THREADS,
+.profiles   = NULL_IF_CONFIG_SMALL(ff_prores_profiles),
 };
diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index dbbf13f4c0..f35f049a78 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -30,6 +30,7 @@
 #include "avcodec.h"
 #include "dct.h"
 #include "internal.h"
+#include "profiles.h"
 #include "proresdata.h"
 #include "put_bits.h"
 #include "bytestream.h"
@@ -37,12 +38,6 @@
 
 #define DEFAULT_SLICE_MB_WIDTH 8
 
-#define FF_PROFILE_PRORES_PROXY 0
-#define FF_PROFILE_PRORES_LT1
-#define FF_PROFILE_PRORES_STANDARD  2
-#define FF_PROFILE_PRORES_HQ3
-#define FF_PROFILE_PRORES_  4
-
 static const AVProfile profiles[] = {
 { FF_PROFILE_PRORES_PROXY,"apco"},
 { FF_PROFILE_PRORES_LT,   "apcs"},
@@ -679,7 +674,7 @@ AVCodec ff_prores_aw_encoder = {
 .encode2= prores_encode_frame,
 .pix_fmts   = (const enum AVPixelFormat[]){AV_PIX_FMT_YUV422P10, 
AV_PIX_FMT_YUV444P10, AV_PIX_FMT_NONE},
 .capabilities   = AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_INTRA_ONLY,
-.profiles   = profiles
+.profiles   = NULL_IF_CONFIG_SMALL(ff_prores_profiles),
 };
 
 AVCodec ff_prores_encoder = {
@@ -693,5 +688,5 @@ AVCodec ff_prores_encoder = {
 .encode2= prores_encode_frame,
 .pix_fmts   = (const enum AVPixelFormat[]){AV_PIX_FMT_YUV422P10, 
AV_PIX_FMT_YUV444P10, AV_PIX_FMT_NONE},
 .capabilities   = 

[FFmpeg-cvslog] mjpeg: Use profile names in the encoder and decoder

2018-11-05 Thread Vittorio Giovara
ffmpeg | branch: master | Vittorio Giovara  | Fri 
Nov  2 15:33:20 2018 -0400| [d37faad0cdbb5577b6ce72625847cae5bf110db9] | 
committer: Vittorio Giovara

mjpeg: Use profile names in the encoder and decoder

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

 libavcodec/codec_desc.c | 1 +
 libavcodec/mjpegdec.c   | 2 ++
 libavcodec/mjpegenc.c   | 2 ++
 libavcodec/profiles.c   | 9 +
 libavcodec/profiles.h   | 1 +
 libavcodec/version.h| 2 +-
 6 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index ce9d39d924..4850e4fb43 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -81,6 +81,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Motion JPEG"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
 .mime_types= MT("image/jpeg"),
+.profiles  = NULL_IF_CONFIG_SMALL(ff_mjpeg_profiles),
 },
 {
 .id= AV_CODEC_ID_MJPEGB,
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index b0cb3ffc83..96c425515a 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -43,6 +43,7 @@
 #include "mjpeg.h"
 #include "mjpegdec.h"
 #include "jpeglsdec.h"
+#include "profiles.h"
 #include "put_bits.h"
 #include "tiff.h"
 #include "exif.h"
@@ -2796,6 +2797,7 @@ AVCodec ff_mjpeg_decoder = {
 .capabilities   = AV_CODEC_CAP_DR1,
 .max_lowres = 3,
 .priv_class = _class,
+.profiles   = NULL_IF_CONFIG_SMALL(ff_mjpeg_profiles),
 .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE |
   FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
 .hw_configs = (const AVCodecHWConfigInternal*[]) {
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index d2fcb8e191..0ea7bd3d10 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -38,6 +38,7 @@
 #include "mpegvideo.h"
 #include "mjpeg.h"
 #include "mjpegenc.h"
+#include "profiles.h"
 
 static int alloc_huffman(MpegEncContext *s)
 {
@@ -418,6 +419,7 @@ AVCodec ff_mjpeg_encoder = {
 AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, 
AV_PIX_FMT_NONE
 },
 .priv_class = _class,
+.profiles   = NULL_IF_CONFIG_SMALL(ff_mjpeg_profiles),
 };
 #endif
 
diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c
index 8a4447e438..e6f937fdb4 100644
--- a/libavcodec/profiles.c
+++ b/libavcodec/profiles.c
@@ -161,4 +161,13 @@ const AVProfile ff_prores_profiles[] = {
 { FF_PROFILE_UNKNOWN }
 };
 
+const AVProfile ff_mjpeg_profiles[] = {
+{ FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT,"Baseline"},
+{ FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT, "Sequential"  },
+{ FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT, "Progressive" },
+{ FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS,"Lossless"},
+{ FF_PROFILE_MJPEG_JPEG_LS, "JPEG LS" },
+{ FF_PROFILE_UNKNOWN }
+};
+
 #endif /* !CONFIG_SMALL */
diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
index 4669dad8d5..ab61e03e15 100644
--- a/libavcodec/profiles.h
+++ b/libavcodec/profiles.h
@@ -34,5 +34,6 @@ extern const AVProfile ff_vp9_profiles[];
 extern const AVProfile ff_av1_profiles[];
 extern const AVProfile ff_sbc_profiles[];
 extern const AVProfile ff_prores_profiles[];
+extern const AVProfile ff_mjpeg_profiles[];
 
 #endif /* AVCODEC_PROFILES_H */
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 0351b36c2b..b4916fb724 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  38
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
 
 #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] proresenc_anatoliy: Rename a profile name with the correct one

2018-11-05 Thread Vittorio Giovara
ffmpeg | branch: master | Vittorio Giovara  | Fri 
Nov  2 15:21:35 2018 -0400| [febaa63b0f7f7ef7e80cfc5031e1d0982d9c74ea] | 
committer: Vittorio Giovara

proresenc_anatoliy: Rename a profile name with the correct one

In all Apple documentation, this profile is called Prores .

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

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

diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index 6b9ce4a59a..dbbf13f4c0 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -41,14 +41,14 @@
 #define FF_PROFILE_PRORES_LT1
 #define FF_PROFILE_PRORES_STANDARD  2
 #define FF_PROFILE_PRORES_HQ3
-#define FF_PROFILE_PRORES_444   4
+#define FF_PROFILE_PRORES_  4
 
 static const AVProfile profiles[] = {
 { FF_PROFILE_PRORES_PROXY,"apco"},
 { FF_PROFILE_PRORES_LT,   "apcs"},
 { FF_PROFILE_PRORES_STANDARD, "apcn"},
 { FF_PROFILE_PRORES_HQ,   "apch"},
-{ FF_PROFILE_PRORES_444,  "ap4h"},
+{ FF_PROFILE_PRORES_, "ap4h"},
 { FF_PROFILE_UNKNOWN }
 };
 
@@ -550,7 +550,7 @@ static int prores_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
 bytestream_put_buffer(, "fmpg", 4);
 bytestream_put_be16(, avctx->width);
 bytestream_put_be16(, avctx->height);
-if (avctx->profile == FF_PROFILE_PRORES_444) {
+if (avctx->profile == FF_PROFILE_PRORES_) {
 *buf++ = 0xC2; // 444, not interlaced
 } else {
 *buf++ = 0x82; // 422, not interlaced
@@ -605,13 +605,13 @@ static av_cold int prores_encode_init(AVCodecContext 
*avctx)
 av_log(avctx, AV_LOG_INFO,
 "encoding with ProRes standard (apcn) profile\n");
 } else if (avctx->pix_fmt == AV_PIX_FMT_YUV444P10) {
-avctx->profile = FF_PROFILE_PRORES_444;
+avctx->profile = FF_PROFILE_PRORES_;
 av_log(avctx, AV_LOG_INFO,
-   "encoding with ProRes 444 (ap4h) profile\n");
+   "encoding with ProRes  (ap4h) profile\n");
 }
 
 } else if (avctx->profile < FF_PROFILE_PRORES_PROXY
-|| avctx->profile > FF_PROFILE_PRORES_444) {
+|| avctx->profile > FF_PROFILE_PRORES_) {
 av_log(
 avctx,
 AV_LOG_ERROR,
@@ -622,13 +622,13 @@ static av_cold int prores_encode_init(AVCodecContext 
*avctx)
 av_log(avctx, AV_LOG_ERROR,
"encoding with ProRes 444 (ap4h) profile, need YUV444P10 
input\n");
 return AVERROR(EINVAL);
-}  else if ((avctx->pix_fmt == AV_PIX_FMT_YUV444P10) && (avctx->profile < 
FF_PROFILE_PRORES_444)){
+}  else if ((avctx->pix_fmt == AV_PIX_FMT_YUV444P10) && (avctx->profile < 
FF_PROFILE_PRORES_)){
 av_log(avctx, AV_LOG_ERROR,
"encoding with ProRes Proxy/LT/422/422 HQ (apco, apcs, apcn, 
ap4h) profile, need YUV422P10 input\n");
 return AVERROR(EINVAL);
 }
 
-if (avctx->profile < FF_PROFILE_PRORES_444) { /* 422 versions */
+if (avctx->profile < FF_PROFILE_PRORES_) { /* 422 versions */
 ctx->is_422 = 1;
 if ((avctx->height & 0xf) || (avctx->width & 0xf)) {
 ctx->fill_y = av_malloc(4 * (DEFAULT_SLICE_MB_WIDTH << 8));

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


[FFmpeg-cvslog] libopenh264enc: Handle sample_aspect_ratio

2018-11-05 Thread Valery Kot
ffmpeg | branch: master | Valery Kot  | Thu Nov  1 
14:15:11 2018 +0100| [be827e1d38cbaaa55c969d87b3650118ee1e6fb3] | committer: 
Mark Thompson

libopenh264enc: Handle sample_aspect_ratio

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

 libavcodec/libopenh264enc.c | 41 +
 1 file changed, 41 insertions(+)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index 83c3f0ce20..5baa423433 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -164,6 +164,47 @@ FF_ENABLE_DEPRECATION_WARNINGS
 param.sSpatialLayers[0].iSpatialBitrate = param.iTargetBitrate;
 param.sSpatialLayers[0].iMaxSpatialBitrate  = param.iMaxBitrate;
 
+#if OPENH264_VER_AT_LEAST(1, 7)
+if (avctx->sample_aspect_ratio.num && avctx->sample_aspect_ratio.den) {
+// Table E-1.
+static const AVRational sar_idc[] = {
+{   0,  0 }, // Unspecified (never written here).
+{   1,  1 }, {  12, 11 }, {  10, 11 }, {  16, 11 },
+{  40, 33 }, {  24, 11 }, {  20, 11 }, {  32, 11 },
+{  80, 33 }, {  18, 11 }, {  15, 11 }, {  64, 33 },
+{ 160, 99 }, // Last 3 are unknown to openh264: {   4,  3 }, {   
3,  2 }, {   2,  1 },
+};
+static const ESampleAspectRatio asp_idc[] = {
+ASP_UNSPECIFIED,
+ASP_1x1,  ASP_12x11,   ASP_10x11,   ASP_16x11,
+ASP_40x33,ASP_24x11,   ASP_20x11,   ASP_32x11,
+ASP_80x33,ASP_18x11,   ASP_15x11,   ASP_64x33,
+ASP_160x99,
+};
+int num, den, i;
+
+av_reduce(, , avctx->sample_aspect_ratio.num,
+  avctx->sample_aspect_ratio.den, 65535);
+
+for (i = 1; i < FF_ARRAY_ELEMS(sar_idc); i++) {
+if (num == sar_idc[i].num &&
+den == sar_idc[i].den)
+break;
+}
+if (i == FF_ARRAY_ELEMS(sar_idc)) {
+param.sSpatialLayers[0].eAspectRatio = ASP_EXT_SAR;
+param.sSpatialLayers[0].sAspectRatioExtWidth = num;
+param.sSpatialLayers[0].sAspectRatioExtHeight = den;
+} else {
+param.sSpatialLayers[0].eAspectRatio = asp_idc[i];
+}
+param.sSpatialLayers[0].bAspectRatioPresent = true;
+}
+else {
+param.sSpatialLayers[0].bAspectRatioPresent = false;
+}
+#endif
+
 if ((avctx->slices > 1) && (s->max_nal_size)) {
 av_log(avctx, AV_LOG_ERROR,
"Invalid combination -slices %d and -max_nal_size %d.\n",

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


[FFmpeg-cvslog] configure: Add missing V4L2 M2M decoder BSF dependencies

2018-11-05 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Mon Nov  5 14:22:10 
2018 +| [e9d2e3fdaacb6872dd689ffd5a65e476b70dee3d] | committer: Mark 
Thompson

configure: Add missing V4L2 M2M decoder BSF dependencies

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

 configure | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure b/configure
index 5e8c20f8fb..e79dae896c 100755
--- a/configure
+++ b/configure
@@ -2957,6 +2957,7 @@ h264_rkmpp_decoder_deps="rkmpp"
 h264_rkmpp_decoder_select="h264_mp4toannexb_bsf"
 h264_vaapi_encoder_select="cbs_h264 vaapi_encode"
 h264_v4l2m2m_decoder_deps="v4l2_m2m h264_v4l2_m2m"
+h264_v4l2m2m_decoder_select="h264_mp4toannexb_bsf"
 h264_v4l2m2m_encoder_deps="v4l2_m2m h264_v4l2_m2m"
 hevc_amf_encoder_deps="amf"
 hevc_cuvid_decoder_deps="cuvid"
@@ -2971,6 +2972,7 @@ hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf"
 hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
 hevc_vaapi_encoder_select="cbs_h265 vaapi_encode"
 hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m"
+hevc_v4l2m2m_decoder_select="hevc_mp4toannexb_bsf"
 hevc_v4l2m2m_encoder_deps="v4l2_m2m hevc_v4l2_m2m"
 mjpeg_cuvid_decoder_deps="cuvid"
 mjpeg_qsv_encoder_deps="libmfx"

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


[FFmpeg-cvslog] configure: Add missing IVF muxer BSF dependency

2018-11-05 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Mon Nov  5 14:22:05 
2018 +| [a4fb2b115071220f23ad7b3d82037647e94279ed] | committer: Mark 
Thompson

configure: Add missing IVF muxer BSF dependency

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

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

diff --git a/configure b/configure
index 23ad59031c..5e8c20f8fb 100755
--- a/configure
+++ b/configure
@@ -3180,7 +3180,7 @@ image2_alias_pix_demuxer_select="image2_demuxer"
 image2_brender_pix_demuxer_select="image2_demuxer"
 ipod_muxer_select="mov_muxer"
 ismv_muxer_select="mov_muxer"
-ivf_muxer_select="av1_metadata_bsf"
+ivf_muxer_select="av1_metadata_bsf vp9_superframe_bsf"
 matroska_audio_muxer_select="matroska_muxer"
 matroska_demuxer_select="iso_media riffdec"
 matroska_demuxer_suggest="bzlib lzo zlib"

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


[FFmpeg-cvslog] libavutil: Undeprecate the AVFrame reordered_opaque field

2018-11-05 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Thu Oct 25 
15:41:26 2018 +0300| [4e9cff2824769e792c7867b09e1efb67278abe79] | committer: 
Martin Storsjö

libavutil: Undeprecate the AVFrame reordered_opaque field

This was marked as deprecated (but only in the doxygen, not with an
actual deprecation attribute) in 81c623fae05 in 2011, but was
undeprecated in ad1ee5fa7.

Signed-off-by: Martin Storsjö 

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

 libavutil/frame.h   | 1 -
 libavutil/version.h | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavutil/frame.h b/libavutil/frame.h
index e2a292980f..66f27f44bd 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -389,7 +389,6 @@ typedef struct AVFrame {
  * that time,
  * the decoder reorders values as needed and sets AVFrame.reordered_opaque
  * to exactly one of the values provided by the user through 
AVCodecContext.reordered_opaque
- * @deprecated in favor of pkt_pts
  */
 int64_t reordered_opaque;
 
diff --git a/libavutil/version.h b/libavutil/version.h
index 161e3f15ae..adbf59639c 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -80,7 +80,7 @@
 
 #define LIBAVUTIL_VERSION_MAJOR  56
 #define LIBAVUTIL_VERSION_MINOR  23
-#define LIBAVUTIL_VERSION_MICRO 100
+#define LIBAVUTIL_VERSION_MICRO 101
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \

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


[FFmpeg-cvslog] flvdec: Export unknown metadata packets as opaque data

2018-11-05 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Fri Oct  5 
16:16:11 2018 +0300| [d7638d8dfc3c4ffd0dc18a64937a5a07ed67b354] | committer: 
Martin Storsjö

flvdec: Export unknown metadata packets as opaque data

Signed-off-by: Martin Storsjö 

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

 libavformat/flv.h |  1 +
 libavformat/flvdec.c  | 18 ++
 libavformat/version.h |  2 +-
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/libavformat/flv.h b/libavformat/flv.h
index 3aabb3adc9..3571b90279 100644
--- a/libavformat/flv.h
+++ b/libavformat/flv.h
@@ -66,6 +66,7 @@ enum {
 FLV_STREAM_TYPE_VIDEO,
 FLV_STREAM_TYPE_AUDIO,
 FLV_STREAM_TYPE_SUBTITLE,
+FLV_STREAM_TYPE_DATA,
 FLV_STREAM_TYPE_NB,
 };
 
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index ffc975f15d..4b9f46902b 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -143,7 +143,9 @@ static AVStream *create_stream(AVFormatContext *s, int 
codec_type)
 st->codecpar->codec_type = codec_type;
 if (s->nb_streams>=3 ||(   s->nb_streams==2
&& s->streams[0]->codecpar->codec_type != 
AVMEDIA_TYPE_SUBTITLE
-   && s->streams[1]->codecpar->codec_type != 
AVMEDIA_TYPE_SUBTITLE))
+   && s->streams[1]->codecpar->codec_type != 
AVMEDIA_TYPE_SUBTITLE
+   && s->streams[0]->codecpar->codec_type != 
AVMEDIA_TYPE_DATA
+   && s->streams[1]->codecpar->codec_type != 
AVMEDIA_TYPE_DATA))
 s->ctx_flags &= ~AVFMTCTX_NOHEADER;
 if (codec_type == AVMEDIA_TYPE_AUDIO) {
 st->codecpar->bit_rate = flv->audio_bit_rate;
@@ -1001,7 +1003,7 @@ retry:
 int type;
 meta_pos = avio_tell(s->pb);
 type = flv_read_metabody(s, next);
-if (type == 0 && dts == 0 || type < 0 || type == TYPE_UNKNOWN) 
{
+if (type == 0 && dts == 0 || type < 0) {
 if (type < 0 && flv->validate_count &&
 flv->validate_index[0].pos > next &&
 flv->validate_index[0].pos - 4 < next
@@ -1015,6 +1017,8 @@ retry:
 return flv_data_packet(s, pkt, dts, next);
 } else if (type == TYPE_ONCAPTION) {
 return flv_data_packet(s, pkt, dts, next);
+} else if (type == TYPE_UNKNOWN) {
+stream_type = FLV_STREAM_TYPE_DATA;
 }
 avio_seek(s->pb, meta_pos, SEEK_SET);
 }
@@ -1054,10 +1058,13 @@ skip:
 } else if (stream_type == FLV_STREAM_TYPE_SUBTITLE) {
 if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE)
 break;
+} else if (stream_type == FLV_STREAM_TYPE_DATA) {
+if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA)
+break;
 }
 }
 if (i == s->nb_streams) {
-static const enum AVMediaType stream_types[] = 
{AVMEDIA_TYPE_VIDEO, AVMEDIA_TYPE_AUDIO, AVMEDIA_TYPE_SUBTITLE};
+static const enum AVMediaType stream_types[] = 
{AVMEDIA_TYPE_VIDEO, AVMEDIA_TYPE_AUDIO, AVMEDIA_TYPE_SUBTITLE, 
AVMEDIA_TYPE_DATA};
 st = create_stream(s, stream_types[stream_type]);
 if (!st)
 return AVERROR(ENOMEM);
@@ -1153,6 +1160,8 @@ retry_duration:
 size -= ret;
 } else if (stream_type == FLV_STREAM_TYPE_SUBTITLE) {
 st->codecpar->codec_id = AV_CODEC_ID_TEXT;
+} else if (stream_type == FLV_STREAM_TYPE_DATA) {
+st->codecpar->codec_id = AV_CODEC_ID_NONE; // Opaque AMF data
 }
 
 if (st->codecpar->codec_id == AV_CODEC_ID_AAC ||
@@ -1253,7 +1262,8 @@ retry_duration:
 
 if (stream_type == FLV_STREAM_TYPE_AUDIO ||
 ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY) ||
-stream_type == FLV_STREAM_TYPE_SUBTITLE)
+stream_type == FLV_STREAM_TYPE_SUBTITLE ||
+stream_type == FLV_STREAM_TYPE_DATA)
 pkt->flags |= AV_PKT_FLAG_KEY;
 
 leave:
diff --git a/libavformat/version.h b/libavformat/version.h
index 3a839f2fa8..843f922f9c 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  58
-#define LIBAVFORMAT_VERSION_MINOR  21
+#define LIBAVFORMAT_VERSION_MINOR  22
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \

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


[FFmpeg-cvslog] libx264: Pass the reordered_opaque field through the encoder

2018-11-05 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Thu Oct 11 
16:03:10 2018 +0300| [882ae091d48b112004b977314884176841f12cef] | committer: 
Martin Storsjö

libx264: Pass the reordered_opaque field through the encoder

libx264 does have a field for opaque data to pass along with frames
through the encoder, but it is a pointer, while the libavcodec
reordered_opaque field is an int64_t. Therefore, allocate an array
within the libx264 wrapper, where reordered_opaque values in flight
are stored, and pass a pointer to this array to libx264.

Update the public libavcodec documentation for the AVCodecContext
field to explain this usage, and add a codec capability that allows
detecting whether an encoder handles this field.

Signed-off-by: Martin Storsjö 

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

 libavcodec/avcodec.h | 12 +++-
 libavcodec/libx264.c | 35 ---
 libavcodec/version.h |  2 +-
 3 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 7ffef768dc..80fa469f26 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1072,6 +1072,13 @@ typedef struct RcOverride{
 #define AV_CODEC_CAP_HYBRID  (1 << 19)
 
 /**
+ * This codec takes the reordered_opaque field from input AVFrames
+ * and returns it in the corresponding field in AVCodecContext after
+ * encoding.
+ */
+#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE (1 << 20)
+
+/**
  * Pan Scan area.
  * This specifies the area which should be displayed.
  * Note there may be multiple such areas for one frame.
@@ -2677,7 +2684,10 @@ typedef struct AVCodecContext {
 /**
  * opaque 64-bit number (generally a PTS) that will be reordered and
  * output in AVFrame.reordered_opaque
- * - encoding: unused
+ * - encoding: Set by libavcodec to the reordered_opaque of the input
+ * frame corresponding to the last returned packet. Only
+ * supported by encoders with the
+ * AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE capability.
  * - decoding: Set by user.
  */
 int64_t reordered_opaque;
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index d6367bf557..a68d0a7f61 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -92,6 +92,9 @@ typedef struct X264Context {
 int noise_reduction;
 
 char *x264_params;
+
+int nb_reordered_opaque, next_reordered_opaque;
+int64_t *reordered_opaque;
 } X264Context;
 
 static void X264_log(void *p, int level, const char *fmt, va_list args)
@@ -278,6 +281,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, 
const AVFrame *frame,
 int nnal, i, ret;
 x264_picture_t pic_out = {0};
 int pict_type;
+int64_t *out_opaque;
 
 x264_picture_init( >pic );
 x4->pic.img.i_csp   = x4->params.i_csp;
@@ -297,6 +301,11 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, 
const AVFrame *frame,
 
 x4->pic.i_pts  = frame->pts;
 
+x4->reordered_opaque[x4->next_reordered_opaque] = 
frame->reordered_opaque;
+x4->pic.opaque = >reordered_opaque[x4->next_reordered_opaque];
+x4->next_reordered_opaque++;
+x4->next_reordered_opaque %= x4->nb_reordered_opaque;
+
 switch (frame->pict_type) {
 case AV_PICTURE_TYPE_I:
 x4->pic.i_type = x4->forced_idr > 0 ? X264_TYPE_IDR
@@ -350,6 +359,14 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, 
const AVFrame *frame,
 pkt->pts = pic_out.i_pts;
 pkt->dts = pic_out.i_dts;
 
+out_opaque = pic_out.opaque;
+if (out_opaque >= x4->reordered_opaque &&
+out_opaque < >reordered_opaque[x4->nb_reordered_opaque]) {
+ctx->reordered_opaque = *out_opaque;
+} else {
+// Unexpected opaque pointer on picture output
+ctx->reordered_opaque = 0;
+}
 
 switch (pic_out.i_type) {
 case X264_TYPE_IDR:
@@ -393,6 +410,7 @@ static av_cold int X264_close(AVCodecContext *avctx)
 
 av_freep(>extradata);
 av_freep(>sei);
+av_freep(>reordered_opaque);
 
 if (x4->enc) {
 x264_encoder_close(x4->enc);
@@ -846,6 +864,14 @@ FF_ENABLE_DEPRECATION_WARNINGS
 cpb_props->max_bitrate = x4->params.rc.i_vbv_max_bitrate * 1000;
 cpb_props->avg_bitrate = x4->params.rc.i_bitrate * 1000;
 
+// Overestimate the reordered opaque buffer size, in case a runtime
+// reconfigure would increase the delay (which it shouldn't).
+x4->nb_reordered_opaque = x264_encoder_maximum_delayed_frames(x4->enc) + 
17;
+x4->reordered_opaque= av_malloc_array(x4->nb_reordered_opaque,
+  sizeof(*x4->reordered_opaque));
+if (!x4->reordered_opaque)
+return AVERROR(ENOMEM);
+
 return 0;
 }
 
@@ -1059,7 +1085,8 @@ AVCodec ff_libx264_encoder = {
 .init = X264_init,
 .encode2  = X264_frame,
 .close 

[FFmpeg-cvslog] flvdec: Rename FLV_STREAM_TYPE_DATA into FLV_STREAM_TYPE_SUBTITLE

2018-11-05 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Fri Oct  5 
16:11:08 2018 +0300| [e7ed9d81bff0e244fce1bb35e9fda2c255c1c2bb] | committer: 
Martin Storsjö

flvdec: Rename FLV_STREAM_TYPE_DATA into FLV_STREAM_TYPE_SUBTITLE

This is always treated as a subtitle at the moment anyway.

Signed-off-by: Martin Storsjö 

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

 libavformat/flv.h| 2 +-
 libavformat/flvdec.c | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/flv.h b/libavformat/flv.h
index df5ce3d17f..3aabb3adc9 100644
--- a/libavformat/flv.h
+++ b/libavformat/flv.h
@@ -65,7 +65,7 @@ enum FlvTagType {
 enum {
 FLV_STREAM_TYPE_VIDEO,
 FLV_STREAM_TYPE_AUDIO,
-FLV_STREAM_TYPE_DATA,
+FLV_STREAM_TYPE_SUBTITLE,
 FLV_STREAM_TYPE_NB,
 };
 
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index a2dea464e3..ffc975f15d 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -996,7 +996,7 @@ retry:
 if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_VIDEO_INFO_CMD)
 goto skip;
 } else if (type == FLV_TAG_TYPE_META) {
-stream_type=FLV_STREAM_TYPE_DATA;
+stream_type=FLV_STREAM_TYPE_SUBTITLE;
 if (size > 13 + 1 + 4) { // Header-type metadata stuff
 int type;
 meta_pos = avio_tell(s->pb);
@@ -1051,7 +1051,7 @@ skip:
 if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
 (s->video_codec_id || flv_same_video_codec(st->codecpar, 
flags)))
 break;
-} else if (stream_type == FLV_STREAM_TYPE_DATA) {
+} else if (stream_type == FLV_STREAM_TYPE_SUBTITLE) {
 if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE)
 break;
 }
@@ -1151,7 +1151,7 @@ retry_duration:
 if (ret < 0)
 return ret;
 size -= ret;
-} else if (stream_type == FLV_STREAM_TYPE_DATA) {
+} else if (stream_type == FLV_STREAM_TYPE_SUBTITLE) {
 st->codecpar->codec_id = AV_CODEC_ID_TEXT;
 }
 
@@ -1253,7 +1253,7 @@ retry_duration:
 
 if (stream_type == FLV_STREAM_TYPE_AUDIO ||
 ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY) ||
-stream_type == FLV_STREAM_TYPE_DATA)
+stream_type == FLV_STREAM_TYPE_SUBTITLE)
 pkt->flags |= AV_PKT_FLAG_KEY;
 
 leave:

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