[FFmpeg-cvslog] hwcontext: fix comments for av_hwdevice_ctx_alloc()

2017-03-21 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sun Mar 19 15:44:46 
2017 +0800| [9365dfcbf665b83b2e60c5ec5e2abf1f0a49e2c3] | committer: Mark 
Thompson

hwcontext: fix comments for av_hwdevice_ctx_alloc()

fix the wrong comments for av_hwdevice_ctx_alloc()

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavutil/hwcontext.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h
index 785da09..f5bc077 100644
--- a/libavutil/hwcontext.h
+++ b/libavutil/hwcontext.h
@@ -223,10 +223,9 @@ typedef struct AVHWFramesContext {
 } AVHWFramesContext;
 
 /**
- * Allocate an AVHWDeviceContext for a given pixel format.
+ * Allocate an AVHWDeviceContext for a given hardware type.
  *
- * @param format a hwaccel pixel format (AV_PIX_FMT_FLAG_HWACCEL must be set
- *   on the corresponding format descriptor)
+ * @param type the type of the hardware device to allocate.
  * @return a reference to the newly created AVHWDeviceContext on success or 
NULL
  * on failure.
  */

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


[FFmpeg-cvslog] lavc/vaapi_encode: fix p_per_i calculate issue.

2017-04-02 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed Mar 29 17:18:59 
2017 +0800| [08087f54626780b6955e470d59b1c7eff6c57f72] | committer: Mark 
Thompson

lavc/vaapi_encode: fix p_per_i calculate issue.

now gop_size <= (max_b_frames + 1) * p_per_i + 1 (IDR frame),
so celing p_per_i = (gop_size - 1 + max_b_frames) / (max_b_frames + 1)

Signed-off-by: Jun Zhao 
Signed-off-by: Leilei 
Signed-off-by: Mark Thompson 

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

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

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 070ff5f..7e9c00f 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -1433,7 +1433,7 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
 ctx->output_order = - ctx->output_delay - 1;
 
 // Currently we never generate I frames, only IDR.
-ctx->p_per_i = ((avctx->gop_size + avctx->max_b_frames) /
+ctx->p_per_i = ((avctx->gop_size - 1 + avctx->max_b_frames) /
 (avctx->max_b_frames + 1));
 ctx->b_per_p = avctx->max_b_frames;
 

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


[FFmpeg-cvslog] vaapi_h264: Fix POC on IDR frames

2017-05-05 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Fri Nov 11 14:53:49 
2016 +0800| [9b1db2d33883c6ff3f8c7b2453146501ba14ca20] | committer: Mark 
Thompson

vaapi_h264: Fix POC on IDR frames

In H.264 section 8.2.1, we have that "The bitstream shall not contain
data that result in Min(TopFieldOrderCnt, BottomFieldOrderCnt) not
equal to 0 for a coded IDR frame".  This fixes the encoder to always
conform to this - previously the POC values formed an unbroken
sequence, not resetting to zero on IDR frames.

Signed-off-by: Mark Thompson 

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

 libavcodec/vaapi_encode_h264.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index b550f6f24a..deb99a7d2f 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -146,6 +146,7 @@ typedef struct VAAPIEncodeH264Context {
 int fixed_qp_b;
 
 int next_frame_num;
+int64_t last_idr_frame;
 int64_t idr_pic_count;
 
 int cpb_delay;
@@ -960,6 +961,7 @@ static int 
vaapi_encode_h264_init_picture_params(AVCodecContext *avctx,
 vpic->frame_num = 0;
 priv->next_frame_num = 1;
 priv->cpb_delay = 0;
+priv->last_idr_frame = pic->display_order;
 } else {
 vpic->frame_num = priv->next_frame_num;
 if (pic->type != PICTURE_TYPE_B) {
@@ -976,8 +978,8 @@ static int 
vaapi_encode_h264_init_picture_params(AVCodecContext *avctx,
 vpic->CurrPic.picture_id  = pic->recon_surface;
 vpic->CurrPic.frame_idx   = vpic->frame_num;
 vpic->CurrPic.flags   = 0;
-vpic->CurrPic.TopFieldOrderCnt= pic->display_order;
-vpic->CurrPic.BottomFieldOrderCnt = pic->display_order;
+vpic->CurrPic.TopFieldOrderCnt= pic->display_order - 
priv->last_idr_frame;
+vpic->CurrPic.BottomFieldOrderCnt = pic->display_order - 
priv->last_idr_frame;
 
 for (i = 0; i < pic->nb_refs; i++) {
 VAAPIEncodePicture *ref = pic->refs[i];
@@ -985,8 +987,8 @@ static int 
vaapi_encode_h264_init_picture_params(AVCodecContext *avctx,
 vpic->ReferenceFrames[i].picture_id = ref->recon_surface;
 vpic->ReferenceFrames[i].frame_idx  = ref->encode_order;
 vpic->ReferenceFrames[i].flags = VA_PICTURE_H264_SHORT_TERM_REFERENCE;
-vpic->ReferenceFrames[i].TopFieldOrderCnt= ref->display_order;
-vpic->ReferenceFrames[i].BottomFieldOrderCnt = ref->display_order;
+vpic->ReferenceFrames[i].TopFieldOrderCnt= ref->display_order - 
priv->last_idr_frame;
+vpic->ReferenceFrames[i].BottomFieldOrderCnt = ref->display_order - 
priv->last_idr_frame;
 }
 for (; i < FF_ARRAY_ELEMS(vpic->ReferenceFrames); i++) {
 vpic->ReferenceFrames[i].picture_id = VA_INVALID_ID;
@@ -1057,7 +1059,7 @@ static int 
vaapi_encode_h264_init_slice_params(AVCodecContext *avctx,
 vslice->pic_parameter_set_id = vpic->pic_parameter_set_id;
 vslice->idr_pic_id = priv->idr_pic_count++;
 
-vslice->pic_order_cnt_lsb = pic->display_order &
+vslice->pic_order_cnt_lsb = (pic->display_order - priv->last_idr_frame) &
 ((1 << (4 + vseq->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4)) 
- 1);
 
 for (i = 0; i < FF_ARRAY_ELEMS(vslice->RefPicList0); i++) {

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


[FFmpeg-cvslog] lavc/golomb: add value range comment for set_ue_golomb().

2017-06-23 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed Jun 14 10:08:58 
2017 +0800| [ea1d07aed96a170d2aaf68a96822485dd20cb346] | committer: Michael 
Niedermayer

lavc/golomb: add value range comment for set_ue_golomb().

set_ue_golomb just support 2^16 - 2 at most, becase this function call
put_bits, and put_bits just support write up to 31 bits, when write 32
bit in put_bits, it's will overwrite the bit buffer, and the default
assert level is 0, the av_assert2(n <= 31 && value < (1U << n)) in
put_bits can not be trigger runtime.

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 

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

 libavcodec/golomb.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index 4f5514795a..1e834f9327 100644
--- a/libavcodec/golomb.h
+++ b/libavcodec/golomb.h
@@ -458,7 +458,7 @@ static inline int get_te(GetBitContext *s, int r, char 
*file, const char *func,
 #endif /* TRACE */
 
 /**
- * write unsigned exp golomb code.
+ * write unsigned exp golomb code. 2^16 - 2 at most
  */
 static inline void set_ue_golomb(PutBitContext *pb, int i)
 {

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


[FFmpeg-cvslog] lavc/put_bits: Add put_bits64() to support up to 64 bits.

2017-06-24 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed Jun 14 10:22:10 
2017 +0800| [2b7d9a1f3fa759c82aaa3569612b40d5ccb1e319] | committer: Michael 
Niedermayer

lavc/put_bits: Add put_bits64() to support up to 64 bits.

put_bits64() can write up to 64 bits into a bitstream.

Reviewed-by: Mark Thompson 
Reviewed-by: Michael Niedermayer 
Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 

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

 libavcodec/put_bits.h | 35 +++
 1 file changed, 35 insertions(+)

diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h
index 9bd45cd8ba..b85e88f28c 100644
--- a/libavcodec/put_bits.h
+++ b/libavcodec/put_bits.h
@@ -243,6 +243,41 @@ static void av_unused put_bits32(PutBitContext *s, 
uint32_t value)
 }
 
 /**
+ * Write up to 64 bits into a bitstream.
+ */
+static inline void put_bits64(PutBitContext *s, int n, uint64_t value)
+{
+av_assert2((n == 64) || (n < 64 && value < (UINT64_C(1) << n)));
+
+if (n < 32)
+put_bits(s, n, value);
+else if (n == 32)
+put_bits32(s, value);
+else if (n < 64) {
+uint32_t lo = value & 0x;
+uint32_t hi = value >> 32;
+#ifdef BITSTREAM_WRITER_LE
+put_bits32(s, lo);
+put_bits(s, n - 32, hi);
+#else
+put_bits(s, n - 32, hi);
+put_bits32(s, lo);
+#endif
+} else {
+uint32_t lo = value & 0x;
+uint32_t hi = value >> 32;
+#ifdef BITSTREAM_WRITER_LE
+put_bits32(s, lo);
+put_bits32(s, hi);
+#else
+put_bits32(s, hi);
+put_bits32(s, lo);
+#endif
+
+}
+}
+
+/**
  * Return the pointer to the byte where the bitstream writer will put
  * the next bit.
  */

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


[FFmpeg-cvslog] lavc/golobm: Add set_ue_golomb_long to support up to 2^32 -2.

2017-06-24 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed Jun 14 10:35:20 
2017 +0800| [e61abe2d73297e0b6dc1e179b717afc00c32af98] | committer: Michael 
Niedermayer

lavc/golobm: Add set_ue_golomb_long to support up to 2^32 -2.

add set_ue_golomb_long to support up to 2^32-2.

Reviewed-by: Mark Thompson 
Reviewed-by: Michael Niedermayer 
Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 

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

 libavcodec/golomb.h | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index 1e834f9327..efb1eff8aa 100644
--- a/libavcodec/golomb.h
+++ b/libavcodec/golomb.h
@@ -474,6 +474,21 @@ static inline void set_ue_golomb(PutBitContext *pb, int i)
 }
 
 /**
+ * write unsigned exp golomb code. 2^32-2 at most.
+ */
+static inline void set_ue_golomb_long(PutBitContext *pb, uint32_t i)
+{
+av_assert2(i <= (UINT32_MAX - 1));
+
+if (i < 256)
+put_bits(pb, ff_ue_golomb_len[i], i + 1);
+else {
+int e = av_log2(i + 1);
+put_bits64(pb, 2 * e + 1, i + 1);
+}
+}
+
+/**
  * write truncated unsigned exp golomb code.
  */
 static inline void set_te_golomb(PutBitContext *pb, int i, int range)

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


[FFmpeg-cvslog] lavc/tests/golomb: Add unit test for set_ue_golomb_long.

2017-06-24 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed Jun 14 10:42:36 
2017 +0800| [32deea87c1d60c01a99786b7206b54efab6d8f64] | committer: Michael 
Niedermayer

lavc/tests/golomb: Add unit test for set_ue_golomb_long.

Add unit test for set_ue_golomb_long.

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 

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

 libavcodec/tests/golomb.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/libavcodec/tests/golomb.c b/libavcodec/tests/golomb.c
index 965367b7be..85b8a9390b 100644
--- a/libavcodec/tests/golomb.c
+++ b/libavcodec/tests/golomb.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 
+#include "libavutil/internal.h"
 #include "libavutil/mem.h"
 
 #include "libavcodec/get_bits.h"
@@ -76,6 +77,24 @@ int main(void)
 }
 }
 
+#define EXTEND_L(i) ((i) << 4 | (i) & 15)
+init_put_bits(&pb, temp, SIZE);
+for (i = 0; i < COUNT; i++)
+set_ue_golomb_long(&pb, EXTEND_L(i));
+flush_put_bits(&pb);
+
+init_get_bits(&gb, temp, 8 * SIZE);
+for (i = 0; i < COUNT; i++) {
+int j, s = show_bits_long(&gb, 32);
+
+j = get_ue_golomb_long(&gb);
+if (j != EXTEND_L(i)) {
+fprintf(stderr, "get_ue_golomb_long: expected %d, got %d. "
+"bits: %8x\n", EXTEND_L(i), j, s);
+ret = 1;
+}
+}
+
 init_put_bits(&pb, temp, SIZE);
 for (i = 0; i < COUNT; i++)
 set_se_golomb(&pb, i - COUNT / 2);

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


[FFmpeg-cvslog] lavc/vaapi_encode_h265: Remove duplicate slice_segment_address.

2017-07-18 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Tue Jul 18 00:01:09 
2017 -0400| [5b8a708492f84ab49bcf9f694c50ac87cbdcc21b] | committer: Mark 
Thompson

lavc/vaapi_encode_h265: Remove duplicate slice_segment_address.

the VAEncSliceParameterBufferHEVC in libva have support this field,
so remove the duplicate field in VAAPIEncodeH265MiscSliceParams.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavcodec/vaapi_encode_h265.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index 1d648a6d87..cf6b9388d1 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -149,7 +149,6 @@ typedef struct VAAPIEncodeH265MiscSequenceParams {
 typedef struct VAAPIEncodeH265MiscSliceParams {
 // Slice segments.
 char first_slice_segment_in_pic_flag;
-unsigned int slice_segment_address;
 
 // Short-term reference picture sets.
 char short_term_ref_pic_set_sps_flag;
@@ -586,7 +585,7 @@ static void 
vaapi_encode_h265_write_slice_header2(PutBitContext *pbc,
 if (vpic->pic_fields.bits.dependent_slice_segments_enabled_flag)
 u(1, vslice_field(dependent_slice_segment_flag));
 u(av_log2((priv->ctu_width * priv->ctu_height) - 1) + 1,
-  mslice_var(slice_segment_address));
+  vslice_var(slice_segment_address));
 }
 if (!vslice->slice_fields.bits.dependent_slice_segment_flag) {
 for (i = 0; i < mseq->num_extra_slice_header_bits; i++)

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


[FFmpeg-cvslog] examples/hw_decode: Add a HWAccel decoding example.

2017-07-29 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Thu Jul 20 00:58:56 
2017 -0400| [1e0c75ea165c926c544d42f0a1e51d7f6fa95354] | committer: Mark 
Thompson

examples/hw_decode: Add a HWAccel decoding example.

Works with VAAPI, VDPAU, DXVA2 and D3D11VA.

Signed-off-by: Liu, Kaixuan 
Signed-off-by: Jun Zhao 
Reviewed-by: Steven Liu 
Signed-off-by: Mark Thompson 

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

 configure|   2 +
 doc/Makefile |   1 +
 doc/examples/Makefile|   1 +
 doc/examples/hw_decode.c | 266 +++
 4 files changed, 270 insertions(+)

diff --git a/configure b/configure
index 5811ee149a..66c7b948e4 100755
--- a/configure
+++ b/configure
@@ -1468,6 +1468,7 @@ EXAMPLE_LIST="
 filtering_audio_example
 filtering_video_example
 http_multiclient_example
+hw_decode_example
 metadata_example
 muxing_example
 qsvdec_example
@@ -3208,6 +3209,7 @@ filter_audio_example_deps="avfilter avutil"
 filtering_audio_example_deps="avfilter avcodec avformat avutil"
 filtering_video_example_deps="avfilter avcodec avformat avutil"
 http_multiclient_example_deps="avformat avutil fork"
+hw_decode_example_deps="avcodec avformat avutil"
 metadata_example_deps="avformat avutil"
 muxing_example_deps="avcodec avformat avutil swscale"
 qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder"
diff --git a/doc/Makefile b/doc/Makefile
index 4cc9eedd12..b670f0bd4c 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -48,6 +48,7 @@ DOC_EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE)  += 
filter_audio
 DOC_EXAMPLES-$(CONFIG_FILTERING_AUDIO_EXAMPLE)   += filtering_audio
 DOC_EXAMPLES-$(CONFIG_FILTERING_VIDEO_EXAMPLE)   += filtering_video
 DOC_EXAMPLES-$(CONFIG_HTTP_MULTICLIENT_EXAMPLE)  += http_multiclient
+DOC_EXAMPLES-$(CONFIG_HW_DECODE_EXAMPLE) += hw_decode
 DOC_EXAMPLES-$(CONFIG_METADATA_EXAMPLE)  += metadata
 DOC_EXAMPLES-$(CONFIG_MUXING_EXAMPLE)+= muxing
 DOC_EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE)+= qsvdec
diff --git a/doc/examples/Makefile b/doc/examples/Makefile
index 2d0a3062c2..6428154c51 100644
--- a/doc/examples/Makefile
+++ b/doc/examples/Makefile
@@ -22,6 +22,7 @@ EXAMPLES=   avio_dir_cmd   \
 filtering_video\
 filtering_audio\
 http_multiclient   \
+hw_decode  \
 metadata   \
 muxing \
 remuxing   \
diff --git a/doc/examples/hw_decode.c b/doc/examples/hw_decode.c
new file mode 100644
index 00..9c7adbf51a
--- /dev/null
+++ b/doc/examples/hw_decode.c
@@ -0,0 +1,266 @@
+/*
+ * Copyright (c) 2017 Jun Zhao
+ * Copyright (c) 2017 Kaixuan Liu
+ *
+ * HW Acceleration API (video decoding) decode sample
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * HW-Accelerated decoding example.
+ *
+ * @example hw_decode.c
+ * This example shows how to do HW-accelerated decoding with output
+ * frames from the HW video surfaces.
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static AVBufferRef *hw_device_ctx = NULL;
+static enum AVPixelFormat hw_pix_fmt;
+static FILE *output_file = NULL;
+
+static enum AVPixelFormat find_fmt_by_hw_type(const enum AVHWDeviceType type)
+{
+enum AVPixelFormat fmt;
+
+switch (type) {
+case AV_HWDEVICE_TYPE_VAAPI:
+fmt = AV_PIX_FMT_VAAPI;
+break;
+case AV_HWDEVICE_TYPE_DXVA2:
+fmt = AV_PIX_FMT_DXVA2_VLD;
+break;
+case AV_HWDEVICE_TYPE_D3D11VA:
+fmt = AV_PIX_FMT_D3D11;
+break;
+case AV_HWDEVICE_TYPE_VDPAU:
+fmt = AV_PIX_FMT_VDPAU;
+break;
+case AV_HWDEVICE_TYPE_VIDEOTOOLBOX:
+fmt = AV_PIX_FMT_VIDEOTOOLBOX;
+break;
+default:
+fmt = AV_PIX_FMT_NONE;
+break;
+}
+
+return fmt;
+}
+
+static int hw_decoder_init(A

[FFmpeg-cvslog] lavc/vaapi_encode_h264: add "coder" option support

2017-08-20 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Tue Aug  8 03:33:53 
2017 -0400| [c6a8c2a4f7396c4524a081df8a0ef9656946067d] | committer: Mark 
Thompson

lavc/vaapi_encode_h264: add "coder" option support

Follow libx264 style to support "coder" option, and set it to
cabac by default.

Signed-off-by: Yi A Wang 
Signed-off-by: Jun Zhao 
Reviewed-by: Steven Liu 
Signed-off-by: Mark Thompson 

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

 libavcodec/vaapi_encode_h264.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index 0adb903285..90c7f7e3cc 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -160,6 +160,8 @@ typedef struct VAAPIEncodeH264Options {
 int qp;
 int quality;
 int low_power;
+// Entropy encoder type.
+int coder;
 } VAAPIEncodeH264Options;
 
 
@@ -775,6 +777,8 @@ static int 
vaapi_encode_h264_init_sequence_params(AVCodecContext *avctx)
 VAEncPictureParameterBufferH264   *vpic = ctx->codec_picture_params;
 VAAPIEncodeH264Context*priv = ctx->priv_data;
 VAAPIEncodeH264MiscSequenceParams *mseq = &priv->misc_sequence_params;
+VAAPIEncodeH264Options *opt =
+(VAAPIEncodeH264Options*)ctx->codec_options_data;
 int i;
 
 {
@@ -920,7 +924,7 @@ static int 
vaapi_encode_h264_init_sequence_params(AVCodecContext *avctx)
 vpic->num_ref_idx_l1_active_minus1 = 0;
 
 vpic->pic_fields.bits.entropy_coding_mode_flag =
-((avctx->profile & 0xff) != 66);
+opt->coder ? ((avctx->profile & 0xff) != 66) : 0;
 vpic->pic_fields.bits.weighted_pred_flag = 0;
 vpic->pic_fields.bits.weighted_bipred_idc = 0;
 vpic->pic_fields.bits.transform_8x8_mode_flag =
@@ -1262,6 +1266,12 @@ static const AVOption vaapi_encode_h264_options[] = {
 { "low_power", "Use low-power encoding mode (experimental: only supported "
   "on some platforms, does not support all features)",
   OFFSET(low_power), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS },
+{ "coder", "Entropy coder type",
+  OFFSET(coder), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, FLAGS, "coder" },
+{ "cavlc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, 
FLAGS, "coder" },
+{ "cabac", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, 
FLAGS, "coder" },
+{ "vlc",   NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, 
FLAGS, "coder" },
+{ "ac",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, 
FLAGS, "coder" },
 { NULL },
 };
 

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


[FFmpeg-cvslog] doc/encoders: add "coder" option documentation for h264_vaapi

2017-08-20 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Tue Aug 15 21:49:08 
2017 -0400| [b8b84f9af55dede0df943083bc2dae38e4c06508] | committer: Mark 
Thompson

doc/encoders: add "coder" option documentation for h264_vaapi

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 doc/encoders.texi | 12 
 1 file changed, 12 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 420c7969e1..018fb4b07a 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2583,6 +2583,18 @@ Size / quality tradeoff: higher values are smaller / 
worse quality.
 @table @option
 @item low_power
 Use low-power encoding mode.
+@item coder
+Set entropy encoder (default is @emph{cabac}).  Possible values:
+
+@table @samp
+@item ac
+@item cabac
+Use CABAC.
+
+@item vlc
+@item cavlc
+Use CAVLC.
+@end table
 @end table
 
 @item hevc_vaapi

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


[FFmpeg-cvslog] lavc/vaapi_encode_h265: Enable VBR mode

2017-08-28 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Fri Aug 25 15:56:51 
2017 +0800| [385cafb07ac1e46433931ea9749a134efd7350be] | committer: Mark 
Thompson

lavc/vaapi_encode_h265: Enable VBR mode

Follow vaapi_h264 style, enable the VBR mode.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

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

diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index cf6b9388d1..971458db87 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -1185,13 +1185,15 @@ static av_cold int 
vaapi_encode_h265_configure(AVCodecContext *avctx)
"%d / %d / %d for IDR- / P- / B-frames.\n",
priv->fixed_qp_idr, priv->fixed_qp_p, priv->fixed_qp_b);
 
-} else if (ctx->va_rc_mode == VA_RC_CBR) {
+} else if (ctx->va_rc_mode == VA_RC_CBR ||
+   ctx->va_rc_mode == VA_RC_VBR) {
 // These still need to be  set for pic_init_qp/slice_qp_delta.
 priv->fixed_qp_idr = 30;
 priv->fixed_qp_p   = 30;
 priv->fixed_qp_b   = 30;
 
-av_log(avctx, AV_LOG_DEBUG, "Using constant-bitrate = %"PRId64" 
bps.\n",
+av_log(avctx, AV_LOG_DEBUG, "Using %s-bitrate = %"PRId64" bps.\n",
+   ctx->va_rc_mode == VA_RC_CBR ? "constant" : "variable",
avctx->bit_rate);
 
 } else {
@@ -1251,9 +1253,12 @@ static av_cold int vaapi_encode_h265_init(AVCodecContext 
*avctx)
 }
 ctx->va_entrypoint = VAEntrypointEncSlice;
 
-if (avctx->bit_rate > 0)
-ctx->va_rc_mode = VA_RC_CBR;
-else
+if (avctx->bit_rate > 0) {
+if (avctx->rc_max_rate == avctx->bit_rate)
+ctx->va_rc_mode = VA_RC_CBR;
+else
+ctx->va_rc_mode = VA_RC_VBR;
+} else
 ctx->va_rc_mode = VA_RC_CQP;
 
 ctx->va_packed_headers =

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


[FFmpeg-cvslog] lavc/vaapi_encode: Change the slice/parameter buffers to dynamic alloc.

2017-08-28 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Thu Aug 24 09:13:01 
2017 +0800| [e4a6eb70f471eda36592078e8fa1bad87fc9df73] | committer: Mark 
Thompson

lavc/vaapi_encode: Change the slice/parameter buffers to dynamic alloc.

Change the slice/parameter buffers to be allocated dynamically.

Signed-off-by: Wang, Yi A 
Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavcodec/vaapi_encode.c | 42 ++
 libavcodec/vaapi_encode.h |  6 ++
 2 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 22114bedbe..4d7683f146 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -36,13 +36,17 @@ static int vaapi_encode_make_packed_header(AVCodecContext 
*avctx,
 VAAPIEncodeContext *ctx = avctx->priv_data;
 VAStatus vas;
 VABufferID param_buffer, data_buffer;
+VABufferID *tmp;
 VAEncPackedHeaderParameterBuffer params = {
 .type = type,
 .bit_length = bit_len,
 .has_emulation_bytes = 1,
 };
 
-av_assert0(pic->nb_param_buffers + 2 <= MAX_PARAM_BUFFERS);
+tmp = av_realloc_array(pic->param_buffers, sizeof(*tmp), 
pic->nb_param_buffers + 2);
+if (!tmp)
+return AVERROR(ENOMEM);
+pic->param_buffers = tmp;
 
 vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context,
  VAEncPackedHeaderParameterBufferType,
@@ -77,9 +81,13 @@ static int vaapi_encode_make_param_buffer(AVCodecContext 
*avctx,
 {
 VAAPIEncodeContext *ctx = avctx->priv_data;
 VAStatus vas;
+VABufferID *tmp;
 VABufferID buffer;
 
-av_assert0(pic->nb_param_buffers + 1 <= MAX_PARAM_BUFFERS);
+tmp = av_realloc_array(pic->param_buffers, sizeof(*tmp), 
pic->nb_param_buffers + 1);
+if (!tmp)
+return AVERROR(ENOMEM);
+pic->param_buffers = tmp;
 
 vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context,
  type, len, 1, data, &buffer);
@@ -313,15 +321,14 @@ static int vaapi_encode_issue(AVCodecContext *avctx,
 }
 }
 
-av_assert0(pic->nb_slices <= MAX_PICTURE_SLICES);
+pic->slices = av_mallocz_array(pic->nb_slices, sizeof(*pic->slices));
+if (!pic->slices) {
+err = AVERROR(ENOMEM);
+goto fail;
+}
 for (i = 0; i < pic->nb_slices; i++) {
-slice = av_mallocz(sizeof(*slice));
-if (!slice) {
-err = AVERROR(ENOMEM);
-goto fail;
-}
+slice = &pic->slices[i];
 slice->index = i;
-pic->slices[i] = slice;
 
 if (ctx->codec->slice_params_size > 0) {
 slice->codec_slice_params = 
av_mallocz(ctx->codec->slice_params_size);
@@ -425,8 +432,16 @@ fail_with_picture:
 fail:
 for(i = 0; i < pic->nb_param_buffers; i++)
 vaDestroyBuffer(ctx->hwctx->display, pic->param_buffers[i]);
+for (i = 0; i < pic->nb_slices; i++) {
+if (pic->slices) {
+av_freep(&pic->slices[i].priv_data);
+av_freep(&pic->slices[i].codec_slice_params);
+}
+}
 fail_at_end:
 av_freep(&pic->codec_picture_params);
+av_freep(&pic->param_buffers);
+av_freep(&pic->slices);
 av_frame_free(&pic->recon_image);
 av_buffer_unref(&pic->output_buffer_ref);
 pic->output_buffer = VA_INVALID_ID;
@@ -535,15 +550,18 @@ static int vaapi_encode_free(AVCodecContext *avctx,
 vaapi_encode_discard(avctx, pic);
 
 for (i = 0; i < pic->nb_slices; i++) {
-av_freep(&pic->slices[i]->priv_data);
-av_freep(&pic->slices[i]->codec_slice_params);
-av_freep(&pic->slices[i]);
+if (pic->slices) {
+av_freep(&pic->slices[i].priv_data);
+av_freep(&pic->slices[i].codec_slice_params);
+}
 }
 av_freep(&pic->codec_picture_params);
 
 av_frame_free(&pic->input_image);
 av_frame_free(&pic->recon_image);
 
+av_freep(&pic->param_buffers);
+av_freep(&pic->slices);
 // Output buffer should already be destroyed.
 av_assert0(pic->output_buffer == VA_INVALID_ID);
 
diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
index 3bf0cc87c7..bcb9d57371 100644
--- a/libavcodec/vaapi_encode.h
+++ b/libavcodec/vaapi_encode.h
@@ -35,8 +35,6 @@ enum {
 MAX_CONFIG_ATTRIBUTES  = 4,
 MAX_GLOBAL_PARAMS  = 4,
 MAX_PICTURE_REFERENCES = 2,
-MAX_PICTURE_SLICES = 112,
-MAX_PARAM_BUFFERS  = 128,
 MAX_REORDER_DELAY  = 16,
 MAX_PARAM_BUFFER_SIZE  = 1024,
 };
@@ -73,7 +71,7 @@ typedef struct VAAPIEncodePicture {
 VASurfaceID recon_s

[FFmpeg-cvslog] lavc/vaapi_encode_mpeg2: fix frame rate calc error when use time_base.

2017-09-09 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Tue Sep  5 23:07:15 
2017 -0400| [a918f16f7ccc7eb75330c97036888cf05c14b311] | committer: Mark 
Thompson

lavc/vaapi_encode_mpeg2: fix frame rate calc error when use time_base.

fix frame rate calc error when use time_base.

Signed-off-by: Yun Zhou 
Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

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

diff --git a/libavcodec/vaapi_encode_mpeg2.c b/libavcodec/vaapi_encode_mpeg2.c
index fbddfa5d5a..dc918884e8 100644
--- a/libavcodec/vaapi_encode_mpeg2.c
+++ b/libavcodec/vaapi_encode_mpeg2.c
@@ -208,7 +208,7 @@ static int 
vaapi_encode_mpeg2_init_sequence_params(AVCodecContext *avctx)
 if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
 vseq->frame_rate = (float)avctx->framerate.num / avctx->framerate.den;
 else
-vseq->frame_rate = (float)avctx->time_base.num / avctx->time_base.den;
+vseq->frame_rate = (float)avctx->time_base.den / avctx->time_base.num;
 
 vseq->aspect_ratio_information = 1;
 vseq->vbv_buffer_size = avctx->rc_buffer_size / (16 * 1024);

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


[FFmpeg-cvslog] kmsgrab: Fix build failure with old libdrm

2017-09-14 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed Sep 13 20:21:38 
2017 -0400| [462568185b0af4d651441ae397cc83bdb7e573ed] | committer: Mark 
Thompson

kmsgrab: Fix build failure with old libdrm

DRM_FORMAT_R8 was added in libdrm 2.4.68.
DRM_FORMAT_R16 was added in libdrm 2.4.82.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavdevice/kmsgrab.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavdevice/kmsgrab.c b/libavdevice/kmsgrab.c
index d222abfd60..67a83ef84a 100644
--- a/libavdevice/kmsgrab.c
+++ b/libavdevice/kmsgrab.c
@@ -202,8 +202,12 @@ static const struct {
 enum AVPixelFormat pixfmt;
 uint32_t drm_format;
 } kmsgrab_formats[] = {
+#ifdef DRM_FORMAT_R8
 { AV_PIX_FMT_GRAY8,DRM_FORMAT_R8   },
+#endif
+#ifdef DRM_FORMAT_R16
 { AV_PIX_FMT_GRAY16LE, DRM_FORMAT_R16  },
+#endif
 { AV_PIX_FMT_RGB24,DRM_FORMAT_RGB888   },
 { AV_PIX_FMT_BGR24,DRM_FORMAT_BGR888   },
 { AV_PIX_FMT_0RGB, DRM_FORMAT_XRGB },

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


[FFmpeg-cvslog] hwcontext_vaapi: Fix build failure with old libdrm

2017-09-14 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed Sep 13 20:21:38 
2017 -0400| [197d298ab3b27d1ec2ee7bf568debca105881a54] | committer: Mark 
Thompson

hwcontext_vaapi: Fix build failure with old libdrm

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavutil/hwcontext_vaapi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 2cc6f26715..852f0abda2 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -918,9 +918,11 @@ static const struct {
 int   nb_layer_formats;
 uint32_t layer_formats[AV_DRM_MAX_PLANES];
 } vaapi_drm_format_map[] = {
+#ifdef DRM_FORMAT_R8
 DRM_MAP(NV12, 2, DRM_FORMAT_R8,  DRM_FORMAT_RG88),
+#endif
 DRM_MAP(NV12, 1, DRM_FORMAT_NV12),
-#ifdef VA_FOURCC_P010
+#if defined(VA_FOURCC_P010) && defined(DRM_FORMAT_R16)
 DRM_MAP(P010, 2, DRM_FORMAT_R16, DRM_FORMAT_RG1616),
 #endif
 DRM_MAP(BGRA, 1, DRM_FORMAT_BGRA),

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


[FFmpeg-cvslog] lavc/vaapi_decode: fix profile search when profile mismatch is allowed

2017-10-09 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Oct  9 15:50:19 
2017 +0800| [217a723b4e0573129c4ec9c31ca3ee666a2a64f6] | committer: Mark 
Thompson

lavc/vaapi_decode: fix profile search when profile mismatch is allowed

When profile mismatch is allowed, use the highest supported profile for
VAAPI decoding.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavcodec/vaapi_decode.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
index 5a555b2bd3..27ef33837c 100644
--- a/libavcodec/vaapi_decode.c
+++ b/libavcodec/vaapi_decode.c
@@ -281,7 +281,7 @@ static int vaapi_decode_make_config(AVCodecContext *avctx)
 VAStatus vas;
 int err, i, j;
 const AVCodecDescriptor *codec_desc;
-VAProfile profile, *profile_list = NULL;
+VAProfile profile, va_profile, *profile_list = NULL;
 int profile_count, exact_match, alt_profile;
 const AVPixFmtDescriptor *sw_desc, *desc;
 
@@ -328,6 +328,7 @@ static int vaapi_decode_make_config(AVCodecContext *avctx)
 if (exact_match)
 break;
 alt_profile = vaapi_profile_map[i].codec_profile;
+va_profile = vaapi_profile_map[i].va_profile;
 }
 }
 av_freep(&profile_list);
@@ -347,6 +348,7 @@ static int vaapi_decode_make_config(AVCodecContext *avctx)
 av_log(avctx, AV_LOG_WARNING, "Using possibly-"
"incompatible profile %d instead.\n",
alt_profile);
+profile = va_profile;
 } else {
 av_log(avctx, AV_LOG_VERBOSE, "Codec %s profile %d not "
"supported for hardware decode.\n",

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


[FFmpeg-cvslog] lavc: enable hwaccel_flags option

2017-10-09 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Oct  9 15:49:58 
2017 +0800| [71e2ec017a1b51987d50b97d48b6a6114a58507d] | committer: Mark 
Thompson

lavc: enable hwaccel_flags option

Enable per-stream hwaccel_flags.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavcodec/options_table.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 12712fb541..2ac37c3ff1 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -576,6 +576,10 @@ static const AVOption avcodec_options[] = {
 {"pixel_format", "set pixel format", OFFSET(pix_fmt), AV_OPT_TYPE_PIXEL_FMT, 
{.i64=AV_PIX_FMT_NONE}, -1, INT_MAX, 0 },
 {"video_size", "set video size", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, 
{.str=NULL}, 0, INT_MAX, 0 },
 {"max_pixels", "Maximum number of pixels", OFFSET(max_pixels), 
AV_OPT_TYPE_INT64, {.i64 = INT_MAX }, 0, INT_MAX, A|V|S|D|E },
+{"hwaccel_flags", NULL, OFFSET(hwaccel_flags), AV_OPT_TYPE_FLAGS, {.i64 = 
AV_HWACCEL_FLAG_IGNORE_LEVEL }, 0, UINT_MAX, V|D, "hwaccel_flags"},
+{"ignore_level", "ignore level even if the codec level used is unknown or 
higher than the maximum supported level reported by the hardware driver", 0, 
AV_OPT_TYPE_CONST, { .i64 = AV_HWACCEL_FLAG_IGNORE_LEVEL }, INT_MIN, INT_MAX, V 
| D, "hwaccel_flags" },
+{"allow_high_depth", "allow to output YUV pixel formats with a different 
chroma sampling than 4:2:0 and/or other than 8 bits per component", 0, 
AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH }, INT_MIN, 
INT_MAX, V | D, "hwaccel_flags"},
+{"allow_profile_mismatch", "attempt to decode anyway if HW accelerated 
decoder's supported profiles do not exactly match the stream", 0, 
AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH }, INT_MIN, 
INT_MAX, V | D, "hwaccel_flags"},
 {NULL},
 };
 

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


[FFmpeg-cvslog] ffmpeg: remove hwaccel_lax_profile_check option

2017-10-16 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Oct  9 02:13:14 
2017 -0400| [2e94490225909a2d40d25722b49f54a3fe967635] | committer: Mark 
Thompson

ffmpeg: remove hwaccel_lax_profile_check option

This has been unused for a long time, and the original purpose has been
replaced by the per-stream hwaccel_flags.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 fftools/ffmpeg.h | 1 -
 fftools/ffmpeg_opt.c | 3 ---
 2 files changed, 4 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index f6c76bcc55..888f77223a 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -624,7 +624,6 @@ extern const AVIOInterruptCB int_cb;
 
 extern const OptionDef options[];
 extern const HWAccel hwaccels[];
-extern int hwaccel_lax_profile_check;
 extern AVBufferRef *hw_device_ctx;
 #if CONFIG_QSV
 extern char *qsv_device;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 100fa76e46..500920326b 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -100,7 +100,6 @@ const HWAccel hwaccels[] = {
 #endif
 { 0 },
 };
-int hwaccel_lax_profile_check = 0;
 AVBufferRef *hw_device_ctx;
 HWDevice *filter_hw_device;
 
@@ -3640,8 +3639,6 @@ const OptionDef options[] = {
 { "autorotate",   HAS_ARG | OPT_BOOL | OPT_SPEC |
   OPT_EXPERT | OPT_INPUT,  
  { .off = OFFSET(autorotate) },
 "automatically insert correct rotate filters" },
-{ "hwaccel_lax_profile_check", OPT_BOOL | OPT_EXPERT,  
  { &hwaccel_lax_profile_check},
-"attempt to decode anyway if HW accelerated decoder's supported 
profiles do not exactly match the stream" },
 
 /* audio options */
 { "aframes",OPT_AUDIO | HAS_ARG  | OPT_PERFILE | OPT_OUTPUT,   
{ .func_arg = opt_audio_frames },

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


[FFmpeg-cvslog] lavc/vaapi_encode_h264: correct VUI max_dec_frame_buffering setting

2017-10-24 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Tue Oct 24 13:25:21 
2017 +0800| [f31478ba1472afe5c1eed60f219ae331816425a2] | committer: Mark 
Thompson

lavc/vaapi_encode_h264: correct VUI max_dec_frame_buffering setting

This should refer to the existing SPS structure, not the VAAPI sequence
parameter buffer (which is not yet initialised).

Signed-off-by: Jun Zhao 
Signed-off-by: Wang, Yi A 
Signed-off-by: Mark Thompson 

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

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

diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index 9a4bd53da1..1d43e934ef 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -441,7 +441,7 @@ static int 
vaapi_encode_h264_init_sequence_params(AVCodecContext *avctx)
 sps->vui.log2_max_mv_length_horizontal = 16;
 sps->vui.log2_max_mv_length_vertical   = 16;
 sps->vui.max_num_reorder_frames= (ctx->b_per_p > 0);
-sps->vui.max_dec_frame_buffering   = vseq->max_num_ref_frames;
+sps->vui.max_dec_frame_buffering   = sps->max_num_ref_frames;
 
 pps->nal_unit_header.nal_ref_idc = 3;
 pps->nal_unit_header.nal_unit_type = H264_NAL_PPS;

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


[FFmpeg-cvslog] examples/transcoding: suppress build warning.

2017-10-31 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Tue Oct 31 16:09:45 
2017 +0800| [fdfc51766d28087c44307ddb5a4b087d47dbe8ef] | committer: Michael 
Niedermayer

examples/transcoding: suppress build warning.

suppress the "warning: assignment discards ‘const’ qualifier from
pointer target type" build warning.

Signed-off-by: Jun Zhao 
Reviewed-by: Steven Liu 
Signed-off-by: Michael Niedermayer 

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

 doc/examples/transcoding.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/examples/transcoding.c b/doc/examples/transcoding.c
index e1b3311081..e32ab20245 100644
--- a/doc/examples/transcoding.c
+++ b/doc/examples/transcoding.c
@@ -227,8 +227,8 @@ static int init_filter(FilteringContext* fctx, 
AVCodecContext *dec_ctx,
 {
 char args[512];
 int ret = 0;
-AVFilter *buffersrc = NULL;
-AVFilter *buffersink = NULL;
+const AVFilter *buffersrc = NULL;
+const AVFilter *buffersink = NULL;
 AVFilterContext *buffersrc_ctx = NULL;
 AVFilterContext *buffersink_ctx = NULL;
 AVFilterInOut *outputs = avfilter_inout_alloc();

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


[FFmpeg-cvslog] examples/filtering_video: suppress the build warning.

2017-10-31 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Tue Oct 31 16:11:06 
2017 +0800| [cb6e20f8de12cf6401ae2dd5f9eea9587ddfe1eb] | committer: Michael 
Niedermayer

examples/filtering_video: suppress the build warning.

suppress the "warning: assignment discards ‘const’ qualifier from
pointer target type" build warning.

Signed-off-by: Jun Zhao 
Reviewed-by: Steven Liu 
Signed-off-by: Michael Niedermayer 

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

 doc/examples/filtering_video.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/examples/filtering_video.c b/doc/examples/filtering_video.c
index fedb2e1c99..9b607ba016 100644
--- a/doc/examples/filtering_video.c
+++ b/doc/examples/filtering_video.c
@@ -92,8 +92,8 @@ static int init_filters(const char *filters_descr)
 {
 char args[512];
 int ret = 0;
-AVFilter *buffersrc  = avfilter_get_by_name("buffer");
-AVFilter *buffersink = avfilter_get_by_name("buffersink");
+const AVFilter *buffersrc  = avfilter_get_by_name("buffer");
+const AVFilter *buffersink = avfilter_get_by_name("buffersink");
 AVFilterInOut *outputs = avfilter_inout_alloc();
 AVFilterInOut *inputs  = avfilter_inout_alloc();
 AVRational time_base = fmt_ctx->streams[video_stream_index]->time_base;

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


[FFmpeg-cvslog] examples/filtering_audio: suppress the build warning.

2017-10-31 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Tue Oct 31 16:12:36 
2017 +0800| [5c51d0edd4f37d675cbe1a010baa38c6968b8f19] | committer: Michael 
Niedermayer

examples/filtering_audio: suppress the build warning.

suppress the "warning: assignment discards ‘const’ qualifier from
pointer target type" build warning.

Signed-off-by: Jun Zhao 
Reviewed-by: Steven Liu 
Signed-off-by: Michael Niedermayer 

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

 doc/examples/filtering_audio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/examples/filtering_audio.c b/doc/examples/filtering_audio.c
index d58b9b75ea..18d6ca275c 100644
--- a/doc/examples/filtering_audio.c
+++ b/doc/examples/filtering_audio.c
@@ -89,8 +89,8 @@ static int init_filters(const char *filters_descr)
 {
 char args[512];
 int ret = 0;
-AVFilter *abuffersrc  = avfilter_get_by_name("abuffer");
-AVFilter *abuffersink = avfilter_get_by_name("abuffersink");
+const AVFilter *abuffersrc  = avfilter_get_by_name("abuffer");
+const AVFilter *abuffersink = avfilter_get_by_name("abuffersink");
 AVFilterInOut *outputs = avfilter_inout_alloc();
 AVFilterInOut *inputs  = avfilter_inout_alloc();
 static const enum AVSampleFormat out_sample_fmts[] = { AV_SAMPLE_FMT_S16, 
-1 };

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


[FFmpeg-cvslog] lavc/libx265: switch to ff_alloc_packet2

2017-11-09 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed Nov  8 21:04:51 
2017 +0800| [dd435c957aa48349f25c58bac88010d5af696227] | committer: Michael 
Niedermayer

lavc/libx265: switch to ff_alloc_packet2

ff_alloc_packet have been deprecated, switch to use
ff_alloc_packet2.

Signed-off-by: Jun Zhao 
Reviewed-by: Derek Buitenhuis 
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 784b51c52d..4456e300f2 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -294,7 +294,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, 
AVPacket *pkt,
 for (i = 0; i < nnal; i++)
 payload += nal[i].sizeBytes;
 
-ret = ff_alloc_packet(pkt, payload);
+ret = ff_alloc_packet2(avctx, pkt, payload, payload);
 if (ret < 0) {
 av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
 return ret;

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


[FFmpeg-cvslog] lavc/libkvazaar: switch to ff_alloc_packet2.

2017-11-09 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed Nov  8 21:02:23 
2017 +0800| [2c6b0315d9cda3ff549c66eb8603afd8ba5e4574] | committer: Michael 
Niedermayer

lavc/libkvazaar: switch to ff_alloc_packet2.

ff_alloc_packet have been deprecated, switch to use the
ff_alloc_packet2.

Signed-off-by: Jun Zhao 
Reviewed-by: Arttu Ylä-Outinen 
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c
index f35b0df61d..25e7b32f5f 100644
--- a/libavcodec/libkvazaar.c
+++ b/libavcodec/libkvazaar.c
@@ -231,7 +231,7 @@ static int libkvazaar_encode(AVCodecContext *avctx,
 kvz_data_chunk *chunk = NULL;
 uint64_t written = 0;
 
-retval = ff_alloc_packet(avpkt, len_out);
+retval = ff_alloc_packet2(avctx, avpkt, len_out, len_out);
 if (retval < 0) {
 av_log(avctx, AV_LOG_ERROR, "Failed to allocate output packet.\n");
 goto done;

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


[FFmpeg-cvslog] hwcontext_vaapi: add the fourcc of I420 format map.

2017-11-20 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Nov 20 08:36:45 
2017 +0800| [3db5961727d300ed048f1fae87e3e4fd339b8456] | committer: Mark 
Thompson

hwcontext_vaapi: add the fourcc of I420 format map.

VA-API 2.0 have enable the I420, so enable this map.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavutil/hwcontext_vaapi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 0382eb06f2..fcff25dc9b 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -101,7 +101,9 @@ static const struct {
 MAP(NV12, YUV420,  NV12),
 MAP(YV12, YUV420,  YUV420P), // With U/V planes swapped.
 MAP(IYUV, YUV420,  YUV420P),
-  //MAP(I420, YUV420,  YUV420P), // Not in libva but used by Intel driver.
+#ifdef VA_FOURCC_I420
+MAP(I420, YUV420,  YUV420P),
+#endif
 #ifdef VA_FOURCC_YV16
 MAP(YV16, YUV422,  YUV422P), // With U/V planes swapped.
 #endif

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


[FFmpeg-cvslog] ffmpeg: add return value check to supress the build warning.

2017-11-20 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sat Nov 18 13:24:24 
2017 +0800| [a5870cb37f7a694a8dc3d6b8f2deaa8fd788e17e] | committer: Michael 
Niedermayer

ffmpeg: add return value check to supress the build warning.

add return value check to supress the build warning message like
"warning: ignoring return value" when use attribute -Wunused-result.

Signed-off-by: Jun Zhao 
Reviewed-by: 刘歧 
Signed-off-by: Michael Niedermayer 

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

 fftools/ffmpeg.c | 28 +++-
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index babd85f7bc..0c16e75ab0 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -220,13 +220,18 @@ static void sub2video_push_ref(InputStream *ist, int64_t 
pts)
 {
 AVFrame *frame = ist->sub2video.frame;
 int i;
+int ret;
 
 av_assert1(frame->data[0]);
 ist->sub2video.last_pts = frame->pts = pts;
-for (i = 0; i < ist->nb_filters; i++)
-av_buffersrc_add_frame_flags(ist->filters[i]->filter, frame,
- AV_BUFFERSRC_FLAG_KEEP_REF |
- AV_BUFFERSRC_FLAG_PUSH);
+for (i = 0; i < ist->nb_filters; i++) {
+ret = av_buffersrc_add_frame_flags(ist->filters[i]->filter, frame,
+   AV_BUFFERSRC_FLAG_KEEP_REF |
+   AV_BUFFERSRC_FLAG_PUSH);
+if (ret != AVERROR_EOF && ret < 0)
+av_log(NULL, AV_LOG_WARNING, "Error while add the frame to buffer 
source(%s).\n",
+   av_err2str(ret));
+}
 }
 
 void sub2video_update(InputStream *ist, AVSubtitle *sub)
@@ -295,11 +300,15 @@ static void sub2video_heartbeat(InputStream *ist, int64_t 
pts)
 static void sub2video_flush(InputStream *ist)
 {
 int i;
+int ret;
 
 if (ist->sub2video.end_pts < INT64_MAX)
 sub2video_update(ist, NULL);
-for (i = 0; i < ist->nb_filters; i++)
-av_buffersrc_add_frame(ist->filters[i]->filter, NULL);
+for (i = 0; i < ist->nb_filters; i++) {
+ret = av_buffersrc_add_frame(ist->filters[i]->filter, NULL);
+if (ret != AVERROR_EOF && ret < 0)
+av_log(NULL, AV_LOG_WARNING, "Flush the frame error.\n");
+}
 }
 
 /* end of sub2video hack */
@@ -327,13 +336,14 @@ static int main_return_code = 0;
 static void
 sigterm_handler(int sig)
 {
+int ret;
 received_sigterm = sig;
 received_nb_signals++;
 term_exit_sigsafe();
 if(received_nb_signals > 3) {
-write(2/*STDERR_FILENO*/, "Received > 3 system signals, hard 
exiting\n",
-   strlen("Received > 3 system signals, hard 
exiting\n"));
-
+ret = write(2/*STDERR_FILENO*/, "Received > 3 system signals, hard 
exiting\n",
+strlen("Received > 3 system signals, hard exiting\n"));
+if (ret < 0) { /* Do nothing */ };
 exit(123);
 }
 }

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


[FFmpeg-cvslog] examples: Add a VA-API encode example.

2017-11-28 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Nov  6 14:45:27 
2017 +0800| [23db3a1ae6d1be3438aec73c4dc91185d7958300] | committer: Mark 
Thompson

examples: Add a VA-API encode example.

Supports only raw NV12 input.

Example use:
./vaapi_encode 1920 1080 test.yuv test.h264

Signed-off-by: Jun Zhao 
Signed-off-by: Liu, Kaixuan 
Signed-off-by: Mark Thompson 

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

 configure   |   2 +
 doc/examples/Makefile   |   1 +
 doc/examples/vaapi_encode.c | 224 
 3 files changed, 227 insertions(+)

diff --git a/configure b/configure
index 28902d41f5..11eeeaa609 100755
--- a/configure
+++ b/configure
@@ -1522,6 +1522,7 @@ EXAMPLE_LIST="
 scaling_video_example
 transcode_aac_example
 transcoding_example
+vaapi_encode_example
 "
 
 EXTERNAL_AUTODETECT_LIBRARY_LIST="
@@ -3300,6 +3301,7 @@ resampling_audio_example_deps="avutil swresample"
 scaling_video_example_deps="avutil swscale"
 transcode_aac_example_deps="avcodec avformat swresample"
 transcoding_example_deps="avfilter avcodec avformat avutil"
+vaapi_encode_example_deps="avcodec avutil"
 
 # EXTRALIBS_LIST
 cpu_init_extralibs="pthreads_extralibs"
diff --git a/doc/examples/Makefile b/doc/examples/Makefile
index 58afd71b85..da5af36532 100644
--- a/doc/examples/Makefile
+++ b/doc/examples/Makefile
@@ -19,6 +19,7 @@ EXAMPLES-$(CONFIG_RESAMPLING_AUDIO_EXAMPLE)  += 
resampling_audio
 EXAMPLES-$(CONFIG_SCALING_VIDEO_EXAMPLE) += scaling_video
 EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE) += transcode_aac
 EXAMPLES-$(CONFIG_TRANSCODING_EXAMPLE)   += transcoding
+EXAMPLES-$(CONFIG_VAAPI_ENCODE_EXAMPLE)  += vaapi_encode
 
 EXAMPLES   := $(EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)$(EXESUF))
 EXAMPLES_G := $(EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)_g$(EXESUF))
diff --git a/doc/examples/vaapi_encode.c b/doc/examples/vaapi_encode.c
new file mode 100644
index 00..866b03d58c
--- /dev/null
+++ b/doc/examples/vaapi_encode.c
@@ -0,0 +1,224 @@
+/*
+ * Video Acceleration API (video encoding) encode sample
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * Intel VAAPI-accelerated encoding example.
+ *
+ * @example vaapi_encode.c
+ * This example shows how to do VAAPI-accelerated encoding. now only support 
NV12
+ * raw file, usage like: vaapi_encode 1920 1080 input.yuv output.h264
+ *
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+static int width, height;
+static AVBufferRef *hw_device_ctx = NULL;
+
+static int set_hwframe_ctx(AVCodecContext *ctx, AVBufferRef *hw_device_ctx)
+{
+AVBufferRef *hw_frames_ref;
+AVHWFramesContext *frames_ctx = NULL;
+int err = 0;
+
+if (!(hw_frames_ref = av_hwframe_ctx_alloc(hw_device_ctx))) {
+fprintf(stderr, "Failed to create VAAPI frame context.\n");
+return -1;
+}
+frames_ctx = (AVHWFramesContext *)(hw_frames_ref->data);
+frames_ctx->format= AV_PIX_FMT_VAAPI;
+frames_ctx->sw_format = AV_PIX_FMT_NV12;
+frames_ctx->width = width;
+frames_ctx->height= height;
+frames_ctx->initial_pool_size = 20;
+if ((err = av_hwframe_ctx_init(hw_frames_ref)) < 0) {
+fprintf(stderr, "Failed to initialize VAAPI frame context."
+"Error code: %s\n",av_err2str(err));
+return err;
+}
+ctx->hw_frames_ctx = av_buffer_ref(hw_frames_ref);
+if (!ctx->hw_frames_ctx)
+err = AVERROR(ENOMEM);
+
+av_buffer_unref(&hw_frames_ref);
+return err;
+}
+
+static int encode_write(AVCodecContext *avctx, AVFrame *frame, FILE *fout)
+{
+int ret = 0;
+AVPacket enc_pkt;
+
+av_init_packet(&enc_pkt);
+enc_pkt.data = NULL;
+enc_pkt.size = 0;
+
+if ((ret = avcodec_send_frame(avctx, frame)) < 0) {
+fprintf(stderr, "Error code: %s\n", av_err2str(ret));
+goto end;
+}
+while (1) {
+ret = avcodec_receive_packet(avctx, &enc_pkt);
+if (ret)
+break;
+
+enc_pkt.stream_index =

[FFmpeg-cvslog] vaapi_h264: Fix VUI max_dec_frame_buffering

2017-12-10 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Tue Oct 24 13:25:21 
2017 +0800| [4b57f064477cd39e723689790b909e6deed2] | committer: Mark 
Thompson

vaapi_h264: Fix VUI max_dec_frame_buffering

This should refer to the existing SPS structure, not the VAAPI sequence
parameter buffer (which is not yet initialised).

From ffmpeg commit f31478ba1472afe5c1eed60f219ae331816425a2.

Signed-off-by: Mark Thompson 

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

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

diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index 03605b05b2..e6a166698b 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -453,7 +453,7 @@ static int 
vaapi_encode_h264_init_sequence_params(AVCodecContext *avctx)
 sps->vui.log2_max_mv_length_horizontal = 16;
 sps->vui.log2_max_mv_length_vertical   = 16;
 sps->vui.max_num_reorder_frames= (ctx->b_per_p > 0);
-sps->vui.max_dec_frame_buffering   = vseq->max_num_ref_frames;
+sps->vui.max_dec_frame_buffering   = sps->max_num_ref_frames;
 
 pps->nal_unit_header.nal_ref_idc = 3;
 pps->nal_unit_header.nal_unit_type = H264_NAL_PPS;

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


[FFmpeg-cvslog] vaapi_h265: Enable VBR mode

2017-12-10 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Fri Aug 25 15:56:51 
2017 +0800| [e7adf2250b437165bc30c3b277bfce50875a0909] | committer: Mark 
Thompson

vaapi_h265: Enable VBR mode

To match vaapi_h264.

From ffmpeg commit 385cafb07ac1e46433931ea9749a134efd7350be.

Signed-off-by: Mark Thompson 

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

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

diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index 477065e2ce..0e5958d531 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -839,13 +839,15 @@ static av_cold int 
vaapi_encode_h265_configure(AVCodecContext *avctx)
"%d / %d / %d for IDR- / P- / B-frames.\n",
priv->fixed_qp_idr, priv->fixed_qp_p, priv->fixed_qp_b);
 
-} else if (ctx->va_rc_mode == VA_RC_CBR) {
+} else if (ctx->va_rc_mode == VA_RC_CBR ||
+   ctx->va_rc_mode == VA_RC_VBR) {
 // These still need to be  set for pic_init_qp/slice_qp_delta.
 priv->fixed_qp_idr = 30;
 priv->fixed_qp_p   = 30;
 priv->fixed_qp_b   = 30;
 
-av_log(avctx, AV_LOG_DEBUG, "Using constant-bitrate = %d bps.\n",
+av_log(avctx, AV_LOG_DEBUG, "Using %s-bitrate = %d bps.\n",
+   ctx->va_rc_mode == VA_RC_CBR ? "constant" : "variable",
avctx->bit_rate);
 
 } else {
@@ -905,9 +907,12 @@ static av_cold int vaapi_encode_h265_init(AVCodecContext 
*avctx)
 }
 ctx->va_entrypoint = VAEntrypointEncSlice;
 
-if (avctx->bit_rate > 0)
-ctx->va_rc_mode = VA_RC_CBR;
-else
+if (avctx->bit_rate > 0) {
+if (avctx->rc_max_rate == avctx->bit_rate)
+ctx->va_rc_mode = VA_RC_CBR;
+else
+ctx->va_rc_mode = VA_RC_VBR;
+} else
 ctx->va_rc_mode = VA_RC_CQP;
 
 ctx->va_packed_headers =

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


[FFmpeg-cvslog] avfilter/formats: fix wrong function name in error message

2017-12-12 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Dec  4 12:50:34 
2017 +0800| [4280948702bc256e21c375790b889c735d233b0d] | committer: Michael 
Niedermayer

avfilter/formats: fix wrong function name in error message

Use perdefined micro __FUNCTION__ rather than hard coding function name
to fix wrong function name in error message.

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index d4de862237..20a2c89719 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -72,7 +72,7 @@ do {
 for (j = 0; j < b->nb; j++)
 \
 if (a->fmts[i] == b->fmts[j]) {
 \
 if(k >= FFMIN(a->nb, b->nb)){  
 \
-av_log(NULL, AV_LOG_ERROR, "Duplicate formats in 
avfilter_merge_formats() detected\n"); \
+av_log(NULL, AV_LOG_ERROR, "Duplicate formats in %s 
detected\n", __FUNCTION__); \
 av_free(ret->fmts);
 \
 av_free(ret);  
 \
 return NULL;   
 \

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


[FFmpeg-cvslog] lavc/vp8: Support resolution changes in the VP8 decoder hwaccel

2017-12-15 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Thu Nov 30 07:53:53 
2017 +0800| [d228d52f1cc958e25f3017945ad06382ab1db7a6] | committer: Mark 
Thompson

lavc/vp8: Support resolution changes in the VP8 decoder hwaccel

Use the following command to reproduce this issue:
make fate-vp8-size-change HWACCEL="vaapi -vaapi_device \
/dev/dri/renderD128 -hwaccel_output_format yuv420p"
SAMPLES=../fate-suite/.

At the same time, reconstruct the public logic as a function.

Signed-off-by: Yun Zhou 
Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavcodec/vp8.c | 36 
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 471c0bb89e..7f71a75e4b 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -167,6 +167,22 @@ static VP8Frame *vp8_find_free_buffer(VP8Context *s)
 return frame;
 }
 
+static enum AVPixelFormat get_pixel_format(VP8Context *s)
+{
+enum AVPixelFormat pix_fmts[] = {
+#if CONFIG_VP8_VAAPI_HWACCEL
+AV_PIX_FMT_VAAPI,
+#endif
+#if CONFIG_VP8_NVDEC_HWACCEL
+AV_PIX_FMT_CUDA,
+#endif
+AV_PIX_FMT_YUV420P,
+AV_PIX_FMT_NONE,
+};
+
+return ff_get_format(s->avctx, pix_fmts);
+}
+
 static av_always_inline
 int update_dimensions(VP8Context *s, int width, int height, int is_vp7)
 {
@@ -182,6 +198,13 @@ int update_dimensions(VP8Context *s, int width, int 
height, int is_vp7)
 return ret;
 }
 
+if (!s->actually_webp && !is_vp7) {
+s->pix_fmt = get_pixel_format(s);
+if (s->pix_fmt < 0)
+return AVERROR(EINVAL);
+avctx->pix_fmt = s->pix_fmt;
+}
+
 s->mb_width  = (s->avctx->coded_width  + 15) / 16;
 s->mb_height = (s->avctx->coded_height + 15) / 16;
 
@@ -2598,18 +2621,7 @@ int vp78_decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 if (s->actually_webp) {
 // avctx->pix_fmt already set in caller.
 } else if (!is_vp7 && s->pix_fmt == AV_PIX_FMT_NONE) {
-enum AVPixelFormat pix_fmts[] = {
-#if CONFIG_VP8_VAAPI_HWACCEL
-AV_PIX_FMT_VAAPI,
-#endif
-#if CONFIG_VP8_NVDEC_HWACCEL
-AV_PIX_FMT_CUDA,
-#endif
-AV_PIX_FMT_YUV420P,
-AV_PIX_FMT_NONE,
-};
-
-s->pix_fmt = ff_get_format(s->avctx, pix_fmts);
+s->pix_fmt = get_pixel_format(s);
 if (s->pix_fmt < 0) {
 ret = AVERROR(EINVAL);
 goto err;

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


[FFmpeg-cvslog] tests/audiomatch: Whitespace refinement

2017-12-19 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Dec 18 09:16:52 
2017 +0800| [e72b8549920feae3366c4d3030afd1ccb80da48e] | committer: Michael 
Niedermayer

tests/audiomatch: Whitespace refinement

Refine the coding style.

Signed-off-by: Michael Niedermayer 

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

 tests/audiomatch.c | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/tests/audiomatch.c b/tests/audiomatch.c
index e63e494add..c17227859a 100644
--- a/tests/audiomatch.c
+++ b/tests/audiomatch.c
@@ -25,23 +25,23 @@
 #define FFMIN(a,b) ((a) > (b) ? (b) : (a))
 #define FFMAX(a,b) ((a) > (b) ? (a) : (b))
 
-static int64_t fsize(FILE *f){
-int64_t end, pos= ftell(f);
+static int64_t fsize(FILE *f) {
+int64_t end, pos = ftell(f);
 fseek(f, 0, SEEK_END);
 end = ftell(f);
 fseek(f, pos, SEEK_SET);
 return end;
 }
 
-int main(int argc, char **argv){
+int main(int argc, char **argv) {
 FILE *f[2];
 int i, pos;
 int siglen, datlen;
 int bestpos = 0;
-double bestc=0;
-double sigamp= 0;
+double bestc = 0;
+double sigamp = 0;
 int16_t *signal, *data;
-int maxshift= 16384;
+int maxshift = 16384;
 
 if (argc < 3) {
 printf("audiomatch  \n");
@@ -87,24 +87,24 @@ int main(int argc, char **argv){
 datlen /= 2;
 siglen /= 2;
 
-for(i=0; i sigamp * 0.94)
+if (fabs(c) > sigamp * 0.94)
 maxshift = FFMIN(maxshift, fabs(pos)+32);
-if(fabs(c)>fabs(bestc)){
-bestc= c;
+if (fabs(c) > fabs(bestc)) {
+bestc = c;
 bestpos = pos;
 }
 }

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


[FFmpeg-cvslog] tests/audiomatch: Add return value check for fread.

2017-12-19 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Dec 18 08:59:58 
2017 +0800| [2b38900cb377c56d855807012d931c7c40d215ed] | committer: Michael 
Niedermayer

tests/audiomatch: Add return value check for fread.

Check fread return value to fix build warning as "ignoring
return value of ‘fread’"

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/tests/audiomatch.c b/tests/audiomatch.c
index ca56df09b3..e63e494add 100644
--- a/tests/audiomatch.c
+++ b/tests/audiomatch.c
@@ -80,8 +80,10 @@ int main(int argc, char **argv){
 data   = malloc(datlen * sizeof(*data));
 signal = malloc(siglen * sizeof(*signal));
 
-fread(data  , 1, datlen, f[0]);
-fread(signal, 1, siglen, f[1]);
+if (fread(data  , 1, datlen, f[0]) != datlen)
+return 1;
+if (fread(signal, 1, siglen, f[1]) != siglen)
+return 1;
 datlen /= 2;
 siglen /= 2;
 

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


[FFmpeg-cvslog] lavc/vaapi_encode: give a debug message if attrs unsupported.

2017-12-19 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Tue Dec 19 14:13:58 
2017 +0800| [a31a48261164f2ec7d218f541891086f930b090b] | committer: Mark 
Thompson

lavc/vaapi_encode: give a debug message if attrs unsupported.

Give a debug message when query attribute get VA_ATTRIB_NOT_SUPPORTED,
it's will help to trace and debug some issue.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavcodec/vaapi_encode.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 590f4be4ed..550ea47991 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -1036,6 +1036,8 @@ static av_cold int 
vaapi_encode_config_attributes(AVCodecContext *avctx)
 // Unfortunately we have to treat this as "don't know" and hope
 // for the best, because the Intel MJPEG encoder returns this
 // for all the interesting attributes.
+av_log(avctx, AV_LOG_DEBUG, "Attribute (%d) is not supported.\n",
+   attr[i].type);
 continue;
 }
 switch (attr[i].type) {

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


[FFmpeg-cvslog] avfilter/formats: fix wrong function name in error message

2017-12-30 Thread Jun Zhao
ffmpeg | branch: release/3.3 | Jun Zhao  | Mon Dec  4 
12:50:34 2017 +0800| [603845225cb3214d6107b22a8f884559c4b7ea9d] | committer: 
Michael Niedermayer

avfilter/formats: fix wrong function name in error message

Use perdefined micro __FUNCTION__ rather than hard coding function name
to fix wrong function name in error message.

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 4280948702bc256e21c375790b889c735d233b0d)
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index d4de862237..20a2c89719 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -72,7 +72,7 @@ do {
 for (j = 0; j < b->nb; j++)
 \
 if (a->fmts[i] == b->fmts[j]) {
 \
 if(k >= FFMIN(a->nb, b->nb)){  
 \
-av_log(NULL, AV_LOG_ERROR, "Duplicate formats in 
avfilter_merge_formats() detected\n"); \
+av_log(NULL, AV_LOG_ERROR, "Duplicate formats in %s 
detected\n", __FUNCTION__); \
 av_free(ret->fmts);
 \
 av_free(ret);  
 \
 return NULL;   
 \

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


[FFmpeg-cvslog] avfilter/formats: fix wrong function name in error message

2018-01-08 Thread Jun Zhao
ffmpeg | branch: release/3.2 | Jun Zhao  | Mon Dec  4 
12:50:34 2017 +0800| [1a6f38b31b235a2ba9bf188ec0f52f76a090c7a5] | committer: 
Michael Niedermayer

avfilter/formats: fix wrong function name in error message

Use perdefined micro __FUNCTION__ rather than hard coding function name
to fix wrong function name in error message.

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 4280948702bc256e21c375790b889c735d233b0d)
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 20f45e33cc..2323017aad 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -72,7 +72,7 @@ do {
 for (j = 0; j < b->nb; j++)
 \
 if (a->fmts[i] == b->fmts[j]) {
 \
 if(k >= FFMIN(a->nb, b->nb)){  
 \
-av_log(NULL, AV_LOG_ERROR, "Duplicate formats in 
avfilter_merge_formats() detected\n"); \
+av_log(NULL, AV_LOG_ERROR, "Duplicate formats in %s 
detected\n", __FUNCTION__); \
 av_free(ret->fmts);
 \
 av_free(ret);  
 \
 return NULL;   
 \

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


[FFmpeg-cvslog] examples/vaapi_encode: Remove redundancy check when free context.

2018-01-12 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Thu Jan 11 13:21:58 
2018 +0800| [9b955eece610f7f8b4aa2096b4e0ca738e21edc4] | committer: Michael 
Niedermayer

examples/vaapi_encode: Remove redundancy check when free context.

avcodec_free_context have handle NULL pointer case, so caller doesn't
need to check the NULL before call this function.

Signe-off-by: Jun Zhao 

Signed-off-by: Michael Niedermayer 

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

 doc/examples/vaapi_encode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/doc/examples/vaapi_encode.c b/doc/examples/vaapi_encode.c
index f66a4a7c48..6425b1c98c 100644
--- a/doc/examples/vaapi_encode.c
+++ b/doc/examples/vaapi_encode.c
@@ -217,8 +217,7 @@ close:
 fclose(fout);
 av_frame_free(&sw_frame);
 av_frame_free(&hw_frame);
-if (avctx)
-avcodec_free_context(&avctx);
+avcodec_free_context(&avctx);
 av_buffer_unref(&hw_device_ctx);
 
 return err;

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


[FFmpeg-cvslog] lavc/snow_dwt: add struct MpegEncContext to fix headers check.

2018-01-16 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Jan 15 18:57:33 
2018 +0800| [a919ab853efcecf89516e703df8018d0649e1143] | committer: Michael 
Niedermayer

lavc/snow_dwt: add struct MpegEncContext to fix headers check.

add missing struct MpegEncContext, use make checkheaders
found this warning.

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 

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

 libavcodec/snow_dwt.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/snow_dwt.h b/libavcodec/snow_dwt.h
index e2d7528056..ee699de35e 100644
--- a/libavcodec/snow_dwt.h
+++ b/libavcodec/snow_dwt.h
@@ -24,6 +24,8 @@
 #include 
 #include 
 
+struct MpegEncContext;
+
 typedef int DWTELEM;
 typedef short IDWTELEM;
 

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


[FFmpeg-cvslog] lavfi/deinterlace_vaapi: fix can't show full option information.

2018-01-17 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Tue Jan 16 22:44:02 
2018 +0800| [383804edd812410219a097e2bf3efac8a8b4562a] | committer: Michael 
Niedermayer

lavfi/deinterlace_vaapi: fix can't show full option information.

use ffmpeg -h filter=deinterlace_vaapi can't get full help information,
the root cause is not setting the flags fileld in options.

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavfilter/vf_deinterlace_vaapi.c 
b/libavfilter/vf_deinterlace_vaapi.c
index 44c5ae7642..a38da5d57b 100644
--- a/libavfilter/vf_deinterlace_vaapi.c
+++ b/libavfilter/vf_deinterlace_vaapi.c
@@ -615,22 +615,22 @@ static const AVOption deint_vaapi_options[] = {
   OFFSET(mode), AV_OPT_TYPE_INT, { .i64 = VAProcDeinterlacingNone },
   VAProcDeinterlacingNone, VAProcDeinterlacingCount - 1, FLAGS, "mode" },
 { "default", "Use the highest-numbered (and therefore possibly most 
advanced) deinterlacing algorithm",
-  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingNone }, .unit = "mode" 
},
+  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingNone }, 0, 0, FLAGS, 
"mode" },
 { "bob", "Use the bob deinterlacing algorithm",
-  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingBob }, .unit = "mode" 
},
+  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingBob }, 0, 0, FLAGS, 
"mode" },
 { "weave", "Use the weave deinterlacing algorithm",
-  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingWeave }, .unit = 
"mode" },
+  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingWeave }, 0, 0, FLAGS,  
"mode" },
 { "motion_adaptive", "Use the motion adaptive deinterlacing algorithm",
-  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingMotionAdaptive }, 
.unit = "mode" },
+  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingMotionAdaptive }, 0, 
0, FLAGS, "mode" },
 { "motion_compensated", "Use the motion compensated deinterlacing 
algorithm",
-  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingMotionCompensated }, 
.unit = "mode" },
+  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingMotionCompensated }, 
0, 0, FLAGS, "mode" },
 
 { "rate", "Generate output at frame rate or field rate",
   OFFSET(field_rate), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 2, FLAGS, "rate" },
 { "frame", "Output at frame rate (one frame of output for each 
field-pair)",
-  0, AV_OPT_TYPE_CONST, { .i64 = 1 }, .unit = "rate" },
+  0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, "rate" },
 { "field", "Output at field rate (one frame of output for each field)",
-  0, AV_OPT_TYPE_CONST, { .i64 = 2 }, .unit = "rate" },
+  0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, FLAGS, "rate" },
 
 { "auto", "Only deinterlace fields, passing frames through unchanged",
   OFFSET(auto_enable), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS },

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


[FFmpeg-cvslog] lavfi: use common VAAPI VPP infrastructure for vf_scale_vaapi.

2018-01-21 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Jan  8 16:02:35 
2018 +0800| [19214f005140b0ee7f706509bd3fab47f4af9b90] | committer: Mark 
Thompson

lavfi: use common VAAPI VPP infrastructure for vf_scale_vaapi.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavfilter/Makefile |   2 +-
 libavfilter/vf_scale_vaapi.c | 356 +--
 2 files changed, 42 insertions(+), 316 deletions(-)

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index ef4729dd3f..3d8dd2c890 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -296,7 +296,7 @@ OBJS-$(CONFIG_SCALE_FILTER)  += vf_scale.o 
scale.o
 OBJS-$(CONFIG_SCALE_CUDA_FILTER) += vf_scale_cuda.o 
vf_scale_cuda.ptx.o
 OBJS-$(CONFIG_SCALE_NPP_FILTER)  += vf_scale_npp.o scale.o
 OBJS-$(CONFIG_SCALE_QSV_FILTER)  += vf_scale_qsv.o
-OBJS-$(CONFIG_SCALE_VAAPI_FILTER)+= vf_scale_vaapi.o scale.o
+OBJS-$(CONFIG_SCALE_VAAPI_FILTER)+= vf_scale_vaapi.o scale.o 
vaapi_vpp.o
 OBJS-$(CONFIG_SCALE2REF_FILTER)  += vf_scale.o scale.o
 OBJS-$(CONFIG_SELECT_FILTER) += f_select.o
 OBJS-$(CONFIG_SELECTIVECOLOR_FILTER) += vf_selectivecolor.o
diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c
index 4bead5aaf4..d349ff0f90 100644
--- a/libavfilter/vf_scale_vaapi.c
+++ b/libavfilter/vf_scale_vaapi.c
@@ -18,12 +18,7 @@
 
 #include 
 
-#include 
-#include 
-
 #include "libavutil/avassert.h"
-#include "libavutil/hwcontext.h"
-#include "libavutil/hwcontext_vaapi.h"
 #include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
@@ -33,276 +28,74 @@
 #include "internal.h"
 #include "scale.h"
 #include "video.h"
+#include "vaapi_vpp.h"
 
 typedef struct ScaleVAAPIContext {
-const AVClass *class;
-
-AVVAAPIDeviceContext *hwctx;
-AVBufferRef *device_ref;
-
-int valid_ids;
-VAConfigID  va_config;
-VAContextID va_context;
-
-AVBufferRef   *input_frames_ref;
-AVHWFramesContext *input_frames;
-
-AVBufferRef   *output_frames_ref;
-AVHWFramesContext *output_frames;
+VAAPIVPPContext vpp_ctx; // must be the first fileld
 
 char *output_format_string;
-enum AVPixelFormat output_format;
 
 char *w_expr;  // width expression string
 char *h_expr;  // height expression string
-
-int output_width;  // computed width
-int output_height; // computed height
 } ScaleVAAPIContext;
 
-
-static int scale_vaapi_query_formats(AVFilterContext *avctx)
-{
-enum AVPixelFormat pix_fmts[] = {
-AV_PIX_FMT_VAAPI, AV_PIX_FMT_NONE,
-};
-int err;
-
-if ((err = ff_formats_ref(ff_make_format_list(pix_fmts),
-  &avctx->inputs[0]->out_formats)) < 0)
-return err;
-if ((err = ff_formats_ref(ff_make_format_list(pix_fmts),
-  &avctx->outputs[0]->in_formats)) < 0)
-return err;
-
-return 0;
-}
-
-static int scale_vaapi_pipeline_uninit(ScaleVAAPIContext *ctx)
-{
-if (ctx->va_context != VA_INVALID_ID) {
-vaDestroyContext(ctx->hwctx->display, ctx->va_context);
-ctx->va_context = VA_INVALID_ID;
-}
-
-if (ctx->va_config != VA_INVALID_ID) {
-vaDestroyConfig(ctx->hwctx->display, ctx->va_config);
-ctx->va_config = VA_INVALID_ID;
-}
-
-av_buffer_unref(&ctx->output_frames_ref);
-av_buffer_unref(&ctx->device_ref);
-ctx->hwctx = 0;
-
-return 0;
-}
-
-static int scale_vaapi_config_input(AVFilterLink *inlink)
-{
-AVFilterContext *avctx = inlink->dst;
-ScaleVAAPIContext *ctx = avctx->priv;
-
-scale_vaapi_pipeline_uninit(ctx);
-
-if (!inlink->hw_frames_ctx) {
-av_log(avctx, AV_LOG_ERROR, "A hardware frames reference is "
-   "required to associate the processing device.\n");
-return AVERROR(EINVAL);
-}
-
-ctx->input_frames_ref = av_buffer_ref(inlink->hw_frames_ctx);
-ctx->input_frames = (AVHWFramesContext*)ctx->input_frames_ref->data;
-
-return 0;
-}
-
 static int scale_vaapi_config_output(AVFilterLink *outlink)
 {
-AVFilterLink *inlink = outlink->src->inputs[0];
-AVFilterContext *avctx = outlink->src;
-ScaleVAAPIContext *ctx = avctx->priv;
-AVVAAPIHWConfig *hwconfig = NULL;
-AVHWFramesConstraints *constraints = NULL;
-AVVAAPIFramesContext *va_frames;
-VAStatus vas;
-int err, i;
-
-scale_vaapi_pipeline_uninit(ctx);
-
-ctx->device_ref = av_buffer_ref(ctx->input_frames->device_ref);
-ctx->hwctx = ((AVHWDeviceContext*)ctx->device_ref->data)-&

[FFmpeg-cvslog] lavfi: add denoise and sharpness VAAPI video filters.

2018-01-21 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Jan  8 16:19:17 
2018 +0800| [9bba10c174c893b08b036898a522ed6dad1d3660] | committer: Mark 
Thompson

lavfi: add denoise and sharpness VAAPI video filters.

Most code between them is common, so put them in a new file for
miscellaneous VAAPI filters.

Signed-off-by: Yun Zhou 
Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 Changelog   |   2 +-
 configure   |   2 +
 libavfilter/Makefile|   2 +
 libavfilter/allfilters.c|   2 +
 libavfilter/vf_misc_vaapi.c | 293 
 5 files changed, 300 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index c7ecfffbb3..7a73447a6b 100644
--- a/Changelog
+++ b/Changelog
@@ -38,7 +38,7 @@ version :
 - Removed the ffserver program
 - Removed the ffmenc and ffmdec muxer and demuxer
 - VideoToolbox HEVC encoder and hwaccel
-- VAAPI-accelerated ProcAmp (color balance) filter
+- VAAPI-accelerated ProcAmp (color balance), denoise and sharpness filters
 
 
 version 3.4:
diff --git a/configure b/configure
index 12fb34a202..24c4f672a3 100755
--- a/configure
+++ b/configure
@@ -3204,6 +3204,7 @@ deconvolve_filter_select="fft"
 deinterlace_qsv_filter_deps="libmfx"
 deinterlace_vaapi_filter_deps="vaapi"
 delogo_filter_deps="gpl"
+denoise_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
 deshake_filter_select="pixelutils"
 drawtext_filter_deps="libfreetype"
 drawtext_filter_suggest="libfontconfig libfribidi"
@@ -3257,6 +3258,7 @@ scale2ref_filter_deps="swscale"
 scale_filter_deps="swscale"
 scale_qsv_filter_deps="libmfx"
 select_filter_select="pixelutils"
+sharpness_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
 showcqt_filter_deps="avcodec avformat swscale"
 showcqt_filter_suggest="libfontconfig libfreetype"
 showcqt_filter_select="fft"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 43d0dd36e6..34971ce6c1 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -174,6 +174,7 @@ OBJS-$(CONFIG_DEINTERLACE_QSV_FILTER)+= 
vf_deinterlace_qsv.o
 OBJS-$(CONFIG_DEINTERLACE_VAAPI_FILTER)  += vf_deinterlace_vaapi.o 
vaapi_vpp.o
 OBJS-$(CONFIG_DEJUDDER_FILTER)   += vf_dejudder.o
 OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
+OBJS-$(CONFIG_DENOISE_VAAPI_FILTER)  += vf_misc_vaapi.o vaapi_vpp.o
 OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
 OBJS-$(CONFIG_DESPILL_FILTER)+= vf_despill.o
 OBJS-$(CONFIG_DETELECINE_FILTER) += vf_detelecine.o
@@ -309,6 +310,7 @@ OBJS-$(CONFIG_SETPTS_FILTER) += setpts.o
 OBJS-$(CONFIG_SETRANGE_FILTER)   += vf_setparams.o
 OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
 OBJS-$(CONFIG_SETTB_FILTER)  += settb.o
+OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER)+= vf_misc_vaapi.o vaapi_vpp.o
 OBJS-$(CONFIG_SHOWINFO_FILTER)   += vf_showinfo.o
 OBJS-$(CONFIG_SHOWPALETTE_FILTER)+= vf_showpalette.o
 OBJS-$(CONFIG_SHUFFLEFRAMES_FILTER)  += vf_shuffleframes.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 63550628e5..9adb1090b7 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -184,6 +184,7 @@ static void register_all(void)
 REGISTER_FILTER(DEINTERLACE_VAAPI, deinterlace_vaapi, vf);
 REGISTER_FILTER(DEJUDDER,   dejudder,   vf);
 REGISTER_FILTER(DELOGO, delogo, vf);
+REGISTER_FILTER(DENOISE_VAAPI,  denoise_vaapi,  vf);
 REGISTER_FILTER(DESHAKE,deshake,vf);
 REGISTER_FILTER(DESPILL,despill,vf);
 REGISTER_FILTER(DETELECINE, detelecine, vf);
@@ -318,6 +319,7 @@ static void register_all(void)
 REGISTER_FILTER(SETRANGE,   setrange,   vf);
 REGISTER_FILTER(SETSAR, setsar, vf);
 REGISTER_FILTER(SETTB,  settb,  vf);
+REGISTER_FILTER(SHARPNESS_VAAPI, sharpness_vaapi, vf);
 REGISTER_FILTER(SHOWINFO,   showinfo,   vf);
 REGISTER_FILTER(SHOWPALETTE,showpalette,vf);
 REGISTER_FILTER(SHUFFLEFRAMES,  shuffleframes,  vf);
diff --git a/libavfilter/vf_misc_vaapi.c b/libavfilter/vf_misc_vaapi.c
new file mode 100644
index 00..316f15e38b
--- /dev/null
+++ b/libavfilter/vf_misc_vaapi.c
@@ -0,0 +1,293 @@
+/*
+ * 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 

[FFmpeg-cvslog] lavfi: use common VAAPI VPP infrastructure for vf_deinterlace_vaapi.

2018-01-21 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Jan  8 16:07:38 
2018 +0800| [92704c480e811e0bd2a605173559d2baa974119f] | committer: Mark 
Thompson

lavfi: use common VAAPI VPP infrastructure for vf_deinterlace_vaapi.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavfilter/Makefile   |   2 +-
 libavfilter/vf_deinterlace_vaapi.c | 351 +
 2 files changed, 46 insertions(+), 307 deletions(-)

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 3d8dd2c890..bbc97a0831 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -171,7 +171,7 @@ OBJS-$(CONFIG_DECONVOLVE_FILTER) += 
vf_convolve.o framesync.o
 OBJS-$(CONFIG_DEFLATE_FILTER)+= vf_neighbor.o
 OBJS-$(CONFIG_DEFLICKER_FILTER)  += vf_deflicker.o
 OBJS-$(CONFIG_DEINTERLACE_QSV_FILTER)+= vf_deinterlace_qsv.o
-OBJS-$(CONFIG_DEINTERLACE_VAAPI_FILTER)  += vf_deinterlace_vaapi.o
+OBJS-$(CONFIG_DEINTERLACE_VAAPI_FILTER)  += vf_deinterlace_vaapi.o 
vaapi_vpp.o
 OBJS-$(CONFIG_DEJUDDER_FILTER)   += vf_dejudder.o
 OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
 OBJS-$(CONFIG_DESHAKE_FILTER)+= vf_deshake.o
diff --git a/libavfilter/vf_deinterlace_vaapi.c 
b/libavfilter/vf_deinterlace_vaapi.c
index a38da5d57b..9700f85817 100644
--- a/libavfilter/vf_deinterlace_vaapi.c
+++ b/libavfilter/vf_deinterlace_vaapi.c
@@ -18,13 +18,8 @@
 
 #include 
 
-#include 
-#include 
-
 #include "libavutil/avassert.h"
 #include "libavutil/common.h"
-#include "libavutil/hwcontext.h"
-#include "libavutil/hwcontext_vaapi.h"
 #include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
@@ -33,31 +28,17 @@
 #include "formats.h"
 #include "internal.h"
 #include "video.h"
+#include "vaapi_vpp.h"
 
 #define MAX_REFERENCES 8
 
 typedef struct DeintVAAPIContext {
-const AVClass *class;
-
-AVVAAPIDeviceContext *hwctx;
-AVBufferRef   *device_ref;
+VAAPIVPPContext vpp_ctx; // must be the first fileld
 
 intmode;
 intfield_rate;
 intauto_enable;
 
-intvalid_ids;
-VAConfigID va_config;
-VAContextIDva_context;
-
-AVBufferRef   *input_frames_ref;
-AVHWFramesContext *input_frames;
-
-AVBufferRef   *output_frames_ref;
-AVHWFramesContext *output_frames;
-intoutput_height;
-intoutput_width;
-
 VAProcFilterCapDeinterlacing
deint_caps[VAProcDeinterlacingCount];
 int nb_deint_caps;
@@ -67,8 +48,6 @@ typedef struct DeintVAAPIContext {
 intqueue_count;
 AVFrame   *frame_queue[MAX_REFERENCES];
 intextra_delay_for_timestamps;
-
-VABufferID filter_buffer;
 } DeintVAAPIContext;
 
 static const char *deint_vaapi_mode_name(int mode)
@@ -85,82 +64,29 @@ static const char *deint_vaapi_mode_name(int mode)
 }
 }
 
-static int deint_vaapi_query_formats(AVFilterContext *avctx)
+static void deint_vaapi_pipeline_uninit(AVFilterContext *avctx)
 {
-enum AVPixelFormat pix_fmts[] = {
-AV_PIX_FMT_VAAPI, AV_PIX_FMT_NONE,
-};
-int err;
-
-if ((err = ff_formats_ref(ff_make_format_list(pix_fmts),
-  &avctx->inputs[0]->out_formats)) < 0)
-return err;
-if ((err = ff_formats_ref(ff_make_format_list(pix_fmts),
-  &avctx->outputs[0]->in_formats)) < 0)
-return err;
-
-return 0;
-}
-
-static int deint_vaapi_pipeline_uninit(AVFilterContext *avctx)
-{
-DeintVAAPIContext *ctx = avctx->priv;
+DeintVAAPIContext *ctx   = avctx->priv;
 int i;
 
 for (i = 0; i < ctx->queue_count; i++)
 av_frame_free(&ctx->frame_queue[i]);
 ctx->queue_count = 0;
 
-if (ctx->filter_buffer != VA_INVALID_ID) {
-vaDestroyBuffer(ctx->hwctx->display, ctx->filter_buffer);
-ctx->filter_buffer = VA_INVALID_ID;
-}
-
-if (ctx->va_context != VA_INVALID_ID) {
-vaDestroyContext(ctx->hwctx->display, ctx->va_context);
-ctx->va_context = VA_INVALID_ID;
-}
-
-if (ctx->va_config != VA_INVALID_ID) {
-vaDestroyConfig(ctx->hwctx->display, ctx->va_config);
-ctx->va_config = VA_INVALID_ID;
-}
-
-av_buffer_unref(&ctx->device_ref);
-ctx->hwctx = NULL;
-
-return 0;
-}
-
-static int deint_vaapi_config_input(AVFilterLink *inlink)
-{
-AVFilterContext   *avctx = inlink->dst;
-DeintVAAPIContext *ctx = avctx->priv;
-
-deint_vaapi_pipeline_uninit(avctx);
-
-

[FFmpeg-cvslog] lavfi: VAAPI VPP common infrastructure.

2018-01-21 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Jan  8 15:56:43 
2018 +0800| [dfdeed5a2c8f432d6c5eda1a3a6a1f333f3d4604] | committer: Mark 
Thompson

lavfi: VAAPI VPP common infrastructure.

Re-work the VAAPI common infrastructure to avoid code duplication
between filters.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavfilter/vaapi_vpp.c | 379 
 libavfilter/vaapi_vpp.h |  82 +++
 2 files changed, 461 insertions(+)

diff --git a/libavfilter/vaapi_vpp.c b/libavfilter/vaapi_vpp.c
new file mode 100644
index 00..9d917722a0
--- /dev/null
+++ b/libavfilter/vaapi_vpp.c
@@ -0,0 +1,379 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+
+#include "libavutil/avassert.h"
+#include "libavutil/pixdesc.h"
+#include "formats.h"
+
+#include "vaapi_vpp.h"
+
+int ff_vaapi_vpp_query_formats(AVFilterContext *avctx)
+{
+enum AVPixelFormat pix_fmts[] = {
+AV_PIX_FMT_VAAPI, AV_PIX_FMT_NONE,
+};
+int err;
+
+if ((err = ff_formats_ref(ff_make_format_list(pix_fmts),
+  &avctx->inputs[0]->out_formats)) < 0)
+return err;
+if ((err = ff_formats_ref(ff_make_format_list(pix_fmts),
+  &avctx->outputs[0]->in_formats)) < 0)
+return err;
+
+return 0;
+}
+
+void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx)
+{
+VAAPIVPPContext *ctx   = avctx->priv;
+int i;
+for (i = 0; i < ctx->nb_filter_buffers; i++) {
+if (ctx->filter_buffers[i] != VA_INVALID_ID) {
+vaDestroyBuffer(ctx->hwctx->display, ctx->filter_buffers[i]);
+ctx->filter_buffers[i] = VA_INVALID_ID;
+}
+}
+ctx->nb_filter_buffers = 0;
+
+if (ctx->va_context != VA_INVALID_ID) {
+vaDestroyContext(ctx->hwctx->display, ctx->va_context);
+ctx->va_context = VA_INVALID_ID;
+}
+
+if (ctx->va_config != VA_INVALID_ID) {
+vaDestroyConfig(ctx->hwctx->display, ctx->va_config);
+ctx->va_config = VA_INVALID_ID;
+}
+
+av_buffer_unref(&ctx->output_frames_ref);
+av_buffer_unref(&ctx->device_ref);
+ctx->hwctx = NULL;
+}
+
+int ff_vaapi_vpp_config_input(AVFilterLink *inlink)
+{
+AVFilterContext *avctx = inlink->dst;
+VAAPIVPPContext *ctx   = avctx->priv;
+
+if (ctx->pipeline_uninit)
+ctx->pipeline_uninit(avctx);
+
+if (!inlink->hw_frames_ctx) {
+av_log(avctx, AV_LOG_ERROR, "A hardware frames reference is "
+   "required to associate the processing device.\n");
+return AVERROR(EINVAL);
+}
+
+ctx->input_frames_ref = av_buffer_ref(inlink->hw_frames_ctx);
+if (!ctx->input_frames_ref) {
+av_log(avctx, AV_LOG_ERROR, "A input frames reference create "
+   "failed.\n");
+return AVERROR(ENOMEM);
+}
+ctx->input_frames = (AVHWFramesContext*)ctx->input_frames_ref->data;
+
+return 0;
+}
+
+int ff_vaapi_vpp_config_output(AVFilterLink *outlink)
+{
+AVFilterContext *avctx = outlink->src;
+VAAPIVPPContext *ctx   = avctx->priv;
+AVVAAPIHWConfig *hwconfig = NULL;
+AVHWFramesConstraints *constraints = NULL;
+AVVAAPIFramesContext *va_frames;
+VAStatus vas;
+int err, i;
+
+if (ctx->pipeline_uninit)
+ctx->pipeline_uninit(avctx);
+
+if (!ctx->output_width)
+ctx->output_width  = avctx->inputs[0]->w;
+if (!ctx->output_height)
+ctx->output_height = avctx->inputs[0]->h;
+
+av_assert0(ctx->input_frames);
+ctx->device_ref = av_buffer_ref(ctx->input_frames->device_ref);
+if (!ctx->device_ref) {
+av_log(avctx, AV_LOG_ERROR, "A device reference create "
+   "failed.\n");
+return AVERROR(ENOMEM);
+}
+ctx->hwctx = ((AVHWDeviceContext*)ctx->device_ref->data)->hwctx;
+
+av_assert0(ctx->va_config == V

[FFmpeg-cvslog] lavfi: add ProcAmp (color balance) VAAPI video filter.

2018-01-21 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Jan  8 16:12:41 
2018 +0800| [fcf5eae4bf24dac897da34b95cfe23634b9ac5fa] | committer: Mark 
Thompson

lavfi: add ProcAmp (color balance) VAAPI video filter.

Add ProcAmp(color balance) vaapi video filter, use the option
like -vf "procamp_vaapi=b=10:h=120:c=2.8:s=3.7" to set
brightness/hue/contrast/saturation.

Signed-off-by: Yun Zhou 
Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 Changelog  |   1 +
 configure  |   1 +
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vf_procamp_vaapi.c | 281 +
 5 files changed, 285 insertions(+)

diff --git a/Changelog b/Changelog
index 61075b3392..c7ecfffbb3 100644
--- a/Changelog
+++ b/Changelog
@@ -38,6 +38,7 @@ version :
 - Removed the ffserver program
 - Removed the ffmenc and ffmdec muxer and demuxer
 - VideoToolbox HEVC encoder and hwaccel
+- VAAPI-accelerated ProcAmp (color balance) filter
 
 
 version 3.4:
diff --git a/configure b/configure
index 5d533621ae..12fb34a202 100755
--- a/configure
+++ b/configure
@@ -3245,6 +3245,7 @@ perspective_filter_deps="gpl"
 phase_filter_deps="gpl"
 pp7_filter_deps="gpl"
 pp_filter_deps="gpl postproc"
+procamp_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
 program_opencl_filter_deps="opencl"
 pullup_filter_deps="gpl"
 removelogo_filter_deps="avcodec avformat swscale"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index bbc97a0831..43d0dd36e6 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -275,6 +275,7 @@ OBJS-$(CONFIG_PP_FILTER) += vf_pp.o
 OBJS-$(CONFIG_PP7_FILTER)+= vf_pp7.o
 OBJS-$(CONFIG_PREMULTIPLY_FILTER)+= vf_premultiply.o framesync.o
 OBJS-$(CONFIG_PREWITT_FILTER)+= vf_convolution.o
+OBJS-$(CONFIG_PROCAMP_VAAPI_FILTER)  += vf_procamp_vaapi.o vaapi_vpp.o
 OBJS-$(CONFIG_PROGRAM_OPENCL_FILTER) += vf_program_opencl.o opencl.o 
framesync.o
 OBJS-$(CONFIG_PSEUDOCOLOR_FILTER)+= vf_pseudocolor.o
 OBJS-$(CONFIG_PSNR_FILTER)   += vf_psnr.o framesync.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 42516bbdf9..63550628e5 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -284,6 +284,7 @@ static void register_all(void)
 REGISTER_FILTER(PP7,pp7,vf);
 REGISTER_FILTER(PREMULTIPLY,premultiply,vf);
 REGISTER_FILTER(PREWITT,prewitt,vf);
+REGISTER_FILTER(PROCAMP_VAAPI,  procamp_vaapi,  vf);
 REGISTER_FILTER(PROGRAM_OPENCL, program_opencl, vf);
 REGISTER_FILTER(PSEUDOCOLOR,pseudocolor,vf);
 REGISTER_FILTER(PSNR,   psnr,   vf);
diff --git a/libavfilter/vf_procamp_vaapi.c b/libavfilter/vf_procamp_vaapi.c
new file mode 100644
index 00..10f9a6ba0c
--- /dev/null
+++ b/libavfilter/vf_procamp_vaapi.c
@@ -0,0 +1,281 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include 
+
+#include "libavutil/avassert.h"
+#include "libavutil/mem.h"
+#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
+
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "vaapi_vpp.h"
+
+// ProcAmp Min/Max/Default Values
+#define BRIGHTNESS_MIN -100.0F
+#define BRIGHTNESS_MAX  100.0F
+#define BRIGHTNESS_DEFAULT0.0F
+
+#define CONTRAST_MIN  0.0F
+#define CONTRAST_MAX 10.0F
+#define CONTRAST_DEFAULT  1.0F
+
+#define HUE_MIN-180.0F
+#define HUE_MAX 180.0F
+#define HUE_DEFAULT   0.0F
+
+#define SATURATION_MIN0.0F
+#define SATURATION_MAX   10.0F
+#define SATURATION_DEFAULT1.0F
+
+#define EPSILON   0.1F
+
+typedef struct ProcampVAAPIContext {
+VAAPIVPPContext vpp_ctx; // must be the first fileld
+
+float bright;
+float hue;
+float saturation;
+float contrast;
+} Proca

[FFmpeg-cvslog] lavfi/vf_xxx_vaapi: fix typo.

2018-01-24 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed Jan 24 08:40:59 
2018 +0800| [4dbae00bac7af0b35622feb5ac78d29ac16889fd] | committer: Carl Eugen 
Hoyos

lavfi/vf_xxx_vaapi: fix typo.

Signed-off-by: Jun Zhao 

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

 libavfilter/vf_deinterlace_vaapi.c | 2 +-
 libavfilter/vf_misc_vaapi.c| 4 ++--
 libavfilter/vf_procamp_vaapi.c | 2 +-
 libavfilter/vf_scale_vaapi.c   | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavfilter/vf_deinterlace_vaapi.c 
b/libavfilter/vf_deinterlace_vaapi.c
index 9700f85817..f7a262d0c6 100644
--- a/libavfilter/vf_deinterlace_vaapi.c
+++ b/libavfilter/vf_deinterlace_vaapi.c
@@ -33,7 +33,7 @@
 #define MAX_REFERENCES 8
 
 typedef struct DeintVAAPIContext {
-VAAPIVPPContext vpp_ctx; // must be the first fileld
+VAAPIVPPContext vpp_ctx; // must be the first field
 
 intmode;
 intfield_rate;
diff --git a/libavfilter/vf_misc_vaapi.c b/libavfilter/vf_misc_vaapi.c
index 316f15e38b..c60b7b0c48 100644
--- a/libavfilter/vf_misc_vaapi.c
+++ b/libavfilter/vf_misc_vaapi.c
@@ -38,13 +38,13 @@
 #define SHARPNESS_DEFAULT  44
 
 typedef struct DenoiseVAAPIContext {
-VAAPIVPPContext vpp_ctx; // must be the first fileld
+VAAPIVPPContext vpp_ctx; // must be the first field
 
 int denoise; // enable denoise algo.
 } DenoiseVAAPIContext;
 
 typedef struct SharpnessVAAPIContext {
-VAAPIVPPContext vpp_ctx; // must be the first fileld
+VAAPIVPPContext vpp_ctx; // must be the first field
 
 int sharpness;   // enable sharpness.
 } SharpnessVAAPIContext;
diff --git a/libavfilter/vf_procamp_vaapi.c b/libavfilter/vf_procamp_vaapi.c
index 10f9a6ba0c..aad76aa371 100644
--- a/libavfilter/vf_procamp_vaapi.c
+++ b/libavfilter/vf_procamp_vaapi.c
@@ -47,7 +47,7 @@
 #define EPSILON   0.1F
 
 typedef struct ProcampVAAPIContext {
-VAAPIVPPContext vpp_ctx; // must be the first fileld
+VAAPIVPPContext vpp_ctx; // must be the first field
 
 float bright;
 float hue;
diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c
index d349ff0f90..c19e23ccd0 100644
--- a/libavfilter/vf_scale_vaapi.c
+++ b/libavfilter/vf_scale_vaapi.c
@@ -31,7 +31,7 @@
 #include "vaapi_vpp.h"
 
 typedef struct ScaleVAAPIContext {
-VAAPIVPPContext vpp_ctx; // must be the first fileld
+VAAPIVPPContext vpp_ctx; // must be the first field
 
 char *output_format_string;
 

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


[FFmpeg-cvslog] lavfi/procamp_vaapi: fix the green video issue if without arguments.

2018-01-25 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed Jan 24 09:28:24 
2018 +0800| [658ac0672f46cef483e68440061da763e908b68a] | committer: Mark 
Thompson

lavfi/procamp_vaapi: fix the green video issue if without arguments.

Fix the green output issue when use procamp_vaapi without any
arguments, now if use procamp_vaapi without any arguments, will use
the default value to setting procamp_vaapi.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavfilter/vf_procamp_vaapi.c | 73 ++
 1 file changed, 31 insertions(+), 42 deletions(-)

diff --git a/libavfilter/vf_procamp_vaapi.c b/libavfilter/vf_procamp_vaapi.c
index aad76aa371..45a3120b23 100644
--- a/libavfilter/vf_procamp_vaapi.c
+++ b/libavfilter/vf_procamp_vaapi.c
@@ -44,8 +44,6 @@
 #define SATURATION_MAX   10.0F
 #define SATURATION_DEFAULT1.0F
 
-#define EPSILON   0.1F
-
 typedef struct ProcampVAAPIContext {
 VAAPIVPPContext vpp_ctx; // must be the first field
 
@@ -65,11 +63,6 @@ static float map(float x, float in_min, float in_max, float 
out_min, float out_m
 return (float)output;
 }
 
-static int fequal(float a, float b)
-{
-return fabs(a-b) < EPSILON;
-}
-
 static int procamp_vaapi_build_filter_params(AVFilterContext *avctx)
 {
 VAAPIVPPContext *vpp_ctx = avctx->priv;
@@ -93,41 +86,37 @@ static int 
procamp_vaapi_build_filter_params(AVFilterContext *avctx)
 return AVERROR(EIO);
 }
 
-if (!fequal(ctx->bright, BRIGHTNESS_DEFAULT)) {
-procamp_params[i].type   = VAProcFilterColorBalance;
-procamp_params[i].attrib = VAProcColorBalanceBrightness;
-procamp_params[i].value  = map(ctx->bright, BRIGHTNESS_MIN, 
BRIGHTNESS_MAX,
-   
procamp_caps[VAProcColorBalanceBrightness-1].range.min_value,
-   
procamp_caps[VAProcColorBalanceBrightness-1].range.max_value);
-i++;
-}
-
-if (!fequal(ctx->contrast, CONTRAST_DEFAULT)) {
-procamp_params[i].type   = VAProcFilterColorBalance;
-procamp_params[i].attrib = VAProcColorBalanceContrast;
-procamp_params[i].value  = map(ctx->contrast, CONTRAST_MIN, 
CONTRAST_MAX,
-   
procamp_caps[VAProcColorBalanceContrast-1].range.min_value,
-   
procamp_caps[VAProcColorBalanceContrast-1].range.max_value);
-i++;
-}
-
-if (!fequal(ctx->hue, HUE_DEFAULT)) {
-procamp_params[i].type   = VAProcFilterColorBalance;
-procamp_params[i].attrib = VAProcColorBalanceHue;
-procamp_params[i].value  = map(ctx->hue, HUE_MIN, HUE_MAX,
-   
procamp_caps[VAProcColorBalanceHue-1].range.min_value,
-   
procamp_caps[VAProcColorBalanceHue-1].range.max_value);
-i++;
-}
-
-if (!fequal(ctx->saturation, SATURATION_DEFAULT)) {
-procamp_params[i].type   = VAProcFilterColorBalance;
-procamp_params[i].attrib = VAProcColorBalanceSaturation;
-procamp_params[i].value  = map(ctx->saturation, SATURATION_MIN, 
SATURATION_MAX,
-   
procamp_caps[VAProcColorBalanceSaturation-1].range.min_value,
-   
procamp_caps[VAProcColorBalanceSaturation-1].range.max_value);
-i++;
-}
+/* brightness */
+procamp_params[i].type   = VAProcFilterColorBalance;
+procamp_params[i].attrib = VAProcColorBalanceBrightness;
+procamp_params[i].value  = map(ctx->bright, BRIGHTNESS_MIN, BRIGHTNESS_MAX,
+   
procamp_caps[VAProcColorBalanceBrightness-1].range.min_value,
+   
procamp_caps[VAProcColorBalanceBrightness-1].range.max_value);
+i++;
+
+/* contrast */
+procamp_params[i].type   = VAProcFilterColorBalance;
+procamp_params[i].attrib = VAProcColorBalanceContrast;
+procamp_params[i].value  = map(ctx->contrast, CONTRAST_MIN, CONTRAST_MAX,
+   
procamp_caps[VAProcColorBalanceContrast-1].range.min_value,
+   
procamp_caps[VAProcColorBalanceContrast-1].range.max_value);
+i++;
+
+/* hue */
+procamp_params[i].type   = VAProcFilterColorBalance;
+procamp_params[i].attrib = VAProcColorBalanceHue;
+procamp_params[i].value  = map(ctx->hue, HUE_MIN, HUE_MAX,
+   
procamp_caps[VAProcColorBalanceHue-1].range.min_value,
+   
procamp_caps[VAProcColorBalanceHue-1].range.max_value);
+i++;
+
+/* saturation */
+procamp_params[i].type   = VAProcFilterColorBalance;
+procamp_params[i].attrib = VAProcColorBalanceSaturation;
+procamp_params[i].value  = map(ctx-&g

[FFmpeg-cvslog] lavfi/misc_vaapi: use default value setting if without arguments.

2018-01-25 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed Jan 24 09:32:50 
2018 +0800| [4e6e1e5350b73bee3122ad4044195bb14d69c229] | committer: Mark 
Thompson

lavfi/misc_vaapi: use default value setting if without arguments.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavfilter/vf_misc_vaapi.c | 64 +
 1 file changed, 30 insertions(+), 34 deletions(-)

diff --git a/libavfilter/vf_misc_vaapi.c b/libavfilter/vf_misc_vaapi.c
index c60b7b0c48..8b179fe215 100644
--- a/libavfilter/vf_misc_vaapi.c
+++ b/libavfilter/vf_misc_vaapi.c
@@ -71,24 +71,22 @@ static int 
denoise_vaapi_build_filter_params(AVFilterContext *avctx)
 
 VAProcFilterParameterBuffer denoise;
 
-if (ctx->denoise != DENOISE_DEFAULT) {
-vas = vaQueryVideoProcFilterCaps(vpp_ctx->hwctx->display, 
vpp_ctx->va_context,
- VAProcFilterNoiseReduction,
- &caps, &num_caps);
-if (vas != VA_STATUS_SUCCESS) {
-av_log(avctx, AV_LOG_ERROR, "Failed to query denoise caps "
-   "context: %d (%s).\n", vas, vaErrorStr(vas));
-return AVERROR(EIO);
-}
-
-denoise.type  = VAProcFilterNoiseReduction;
-denoise.value =  map(ctx->denoise, DENOISE_MIN, DENOISE_MAX,
- caps.range.min_value,
- caps.range.max_value);
-ff_vaapi_vpp_make_param_buffers(avctx, VAProcFilterParameterBufferType,
-&denoise, sizeof(denoise), 1);
+vas = vaQueryVideoProcFilterCaps(vpp_ctx->hwctx->display, 
vpp_ctx->va_context,
+ VAProcFilterNoiseReduction,
+ &caps, &num_caps);
+if (vas != VA_STATUS_SUCCESS) {
+av_log(avctx, AV_LOG_ERROR, "Failed to query denoise caps "
+   "context: %d (%s).\n", vas, vaErrorStr(vas));
+return AVERROR(EIO);
 }
 
+denoise.type  = VAProcFilterNoiseReduction;
+denoise.value =  map(ctx->denoise, DENOISE_MIN, DENOISE_MAX,
+ caps.range.min_value,
+ caps.range.max_value);
+ff_vaapi_vpp_make_param_buffers(avctx, VAProcFilterParameterBufferType,
+&denoise, sizeof(denoise), 1);
+
 return 0;
 }
 
@@ -104,26 +102,24 @@ static int 
sharpness_vaapi_build_filter_params(AVFilterContext *avctx)
 
 VAProcFilterParameterBuffer sharpness;
 
-if (ctx->sharpness != SHARPNESS_DEFAULT) {
-vas = vaQueryVideoProcFilterCaps(vpp_ctx->hwctx->display, 
vpp_ctx->va_context,
- VAProcFilterSharpening,
- &caps, &num_caps);
-if (vas != VA_STATUS_SUCCESS) {
-av_log(avctx, AV_LOG_ERROR, "Failed to query sharpness caps "
-   "context: %d (%s).\n", vas, vaErrorStr(vas));
-return AVERROR(EIO);
-}
-
-sharpness.type  = VAProcFilterSharpening;
-sharpness.value = map(ctx->sharpness,
-  SHARPNESS_MIN, SHARPNESS_MAX,
-  caps.range.min_value,
-  caps.range.max_value);
-ff_vaapi_vpp_make_param_buffers(avctx,
-VAProcFilterParameterBufferType,
-&sharpness, sizeof(sharpness), 1);
+vas = vaQueryVideoProcFilterCaps(vpp_ctx->hwctx->display, 
vpp_ctx->va_context,
+ VAProcFilterSharpening,
+ &caps, &num_caps);
+if (vas != VA_STATUS_SUCCESS) {
+av_log(avctx, AV_LOG_ERROR, "Failed to query sharpness caps "
+   "context: %d (%s).\n", vas, vaErrorStr(vas));
+return AVERROR(EIO);
 }
 
+sharpness.type  = VAProcFilterSharpening;
+sharpness.value = map(ctx->sharpness,
+  SHARPNESS_MIN, SHARPNESS_MAX,
+  caps.range.min_value,
+  caps.range.max_value);
+ff_vaapi_vpp_make_param_buffers(avctx,
+VAProcFilterParameterBufferType,
+&sharpness, sizeof(sharpness), 1);
+
 return 0;
 }
 

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


[FFmpeg-cvslog] avfilter/formats: fix wrong function name in error message

2018-01-30 Thread Jun Zhao
ffmpeg | branch: release/3.4 | Jun Zhao  | Mon Dec  4 
12:50:34 2017 +0800| [9aa0ed850b77fe46d5b766329f45deb9150cea10] | committer: 
Michael Niedermayer

avfilter/formats: fix wrong function name in error message

Use perdefined micro __FUNCTION__ rather than hard coding function name
to fix wrong function name in error message.

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 4280948702bc256e21c375790b889c735d233b0d)
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index d4de862237..20a2c89719 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -72,7 +72,7 @@ do {
 for (j = 0; j < b->nb; j++)
 \
 if (a->fmts[i] == b->fmts[j]) {
 \
 if(k >= FFMIN(a->nb, b->nb)){  
 \
-av_log(NULL, AV_LOG_ERROR, "Duplicate formats in 
avfilter_merge_formats() detected\n"); \
+av_log(NULL, AV_LOG_ERROR, "Duplicate formats in %s 
detected\n", __FUNCTION__); \
 av_free(ret->fmts);
 \
 av_free(ret);  
 \
 return NULL;   
 \

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


[FFmpeg-cvslog] lavfi/deinterlace_vaapi: fix can't show full option information.

2018-01-30 Thread Jun Zhao
ffmpeg | branch: release/3.4 | Jun Zhao  | Tue Jan 16 
22:44:02 2018 +0800| [7b56d6584c46072b0f959f22a461cff01b302a65] | committer: 
Michael Niedermayer

lavfi/deinterlace_vaapi: fix can't show full option information.

use ffmpeg -h filter=deinterlace_vaapi can't get full help information,
the root cause is not setting the flags fileld in options.

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 383804edd812410219a097e2bf3efac8a8b4562a)
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavfilter/vf_deinterlace_vaapi.c 
b/libavfilter/vf_deinterlace_vaapi.c
index 44c5ae7642..a38da5d57b 100644
--- a/libavfilter/vf_deinterlace_vaapi.c
+++ b/libavfilter/vf_deinterlace_vaapi.c
@@ -615,22 +615,22 @@ static const AVOption deint_vaapi_options[] = {
   OFFSET(mode), AV_OPT_TYPE_INT, { .i64 = VAProcDeinterlacingNone },
   VAProcDeinterlacingNone, VAProcDeinterlacingCount - 1, FLAGS, "mode" },
 { "default", "Use the highest-numbered (and therefore possibly most 
advanced) deinterlacing algorithm",
-  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingNone }, .unit = "mode" 
},
+  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingNone }, 0, 0, FLAGS, 
"mode" },
 { "bob", "Use the bob deinterlacing algorithm",
-  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingBob }, .unit = "mode" 
},
+  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingBob }, 0, 0, FLAGS, 
"mode" },
 { "weave", "Use the weave deinterlacing algorithm",
-  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingWeave }, .unit = 
"mode" },
+  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingWeave }, 0, 0, FLAGS,  
"mode" },
 { "motion_adaptive", "Use the motion adaptive deinterlacing algorithm",
-  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingMotionAdaptive }, 
.unit = "mode" },
+  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingMotionAdaptive }, 0, 
0, FLAGS, "mode" },
 { "motion_compensated", "Use the motion compensated deinterlacing 
algorithm",
-  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingMotionCompensated }, 
.unit = "mode" },
+  0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingMotionCompensated }, 
0, 0, FLAGS, "mode" },
 
 { "rate", "Generate output at frame rate or field rate",
   OFFSET(field_rate), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 2, FLAGS, "rate" },
 { "frame", "Output at frame rate (one frame of output for each 
field-pair)",
-  0, AV_OPT_TYPE_CONST, { .i64 = 1 }, .unit = "rate" },
+  0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, "rate" },
 { "field", "Output at field rate (one frame of output for each field)",
-  0, AV_OPT_TYPE_CONST, { .i64 = 2 }, .unit = "rate" },
+  0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, FLAGS, "rate" },
 
 { "auto", "Only deinterlace fields, passing frames through unchanged",
   OFFSET(auto_enable), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS },

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


[FFmpeg-cvslog] avfilter/formats: fix wrong function name in error message

2018-01-31 Thread Jun Zhao
ffmpeg | branch: release/2.8 | Jun Zhao  | Mon Dec  4 
12:50:34 2017 +0800| [15df68bf5059da248e795e813bc3e40054b7ee22] | committer: 
Michael Niedermayer

avfilter/formats: fix wrong function name in error message

Use perdefined micro __FUNCTION__ rather than hard coding function name
to fix wrong function name in error message.

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 4280948702bc256e21c375790b889c735d233b0d)
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 8758b3d113..7b65f44107 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -72,7 +72,7 @@ do {
 for (j = 0; j < b->nb; j++)
 \
 if (a->fmts[i] == b->fmts[j]) {
 \
 if(k >= FFMIN(a->nb, b->nb)){  
 \
-av_log(NULL, AV_LOG_ERROR, "Duplicate formats in 
avfilter_merge_formats() detected\n"); \
+av_log(NULL, AV_LOG_ERROR, "Duplicate formats in %s 
detected\n", __FUNCTION__); \
 av_free(ret->fmts);
 \
 av_free(ret);  
 \
 return NULL;   
 \

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


[FFmpeg-cvslog] examples: Add a VA-API transcode example.

2018-02-04 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Thu Jan 11 15:00:30 
2018 +0800| [0519e66a90f076591fb35dab1a3ed14204de08c0] | committer: Mark 
Thompson

examples: Add a VA-API transcode example.

Usage is:
./vaapi_transcode input_stream codec output_stream
For example:
- ./vaapi_transcode input.mp4 h264_vaapi output_h264.mp4
- ./vaapi_transcode input.mp4 vp8_vaapi output_vp8.ivf

Does not handle resolution changes on the input stream.

Signed-off-by: Jun Zhao 
Signed-off-by: Liu, Kaixuan 
Signed-off-by: Mark Thompson 

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

 configure  |   2 +
 doc/examples/Makefile  |   1 +
 doc/examples/vaapi_transcode.c | 306 +
 3 files changed, 309 insertions(+)

diff --git a/configure b/configure
index 0b01a221c7..27113828c6 100755
--- a/configure
+++ b/configure
@@ -1526,6 +1526,7 @@ EXAMPLE_LIST="
 transcode_aac_example
 transcoding_example
 vaapi_encode_example
+vaapi_transcode_example
 "
 
 EXTERNAL_AUTODETECT_LIBRARY_LIST="
@@ -3320,6 +3321,7 @@ scaling_video_example_deps="avutil swscale"
 transcode_aac_example_deps="avcodec avformat swresample"
 transcoding_example_deps="avfilter avcodec avformat avutil"
 vaapi_encode_example_deps="avcodec avutil h264_vaapi_encoder"
+vaapi_transcode_example_deps="avcodec avformat avutil h264_vaapi_encoder"
 
 # EXTRALIBS_LIST
 cpu_init_extralibs="pthreads_extralibs"
diff --git a/doc/examples/Makefile b/doc/examples/Makefile
index da5af36532..928ff306b3 100644
--- a/doc/examples/Makefile
+++ b/doc/examples/Makefile
@@ -20,6 +20,7 @@ EXAMPLES-$(CONFIG_SCALING_VIDEO_EXAMPLE) += scaling_video
 EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE) += transcode_aac
 EXAMPLES-$(CONFIG_TRANSCODING_EXAMPLE)   += transcoding
 EXAMPLES-$(CONFIG_VAAPI_ENCODE_EXAMPLE)  += vaapi_encode
+EXAMPLES-$(CONFIG_VAAPI_TRANSCODE_EXAMPLE)   += vaapi_transcode
 
 EXAMPLES   := $(EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)$(EXESUF))
 EXAMPLES_G := $(EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)_g$(EXESUF))
diff --git a/doc/examples/vaapi_transcode.c b/doc/examples/vaapi_transcode.c
new file mode 100644
index 00..6318895af3
--- /dev/null
+++ b/doc/examples/vaapi_transcode.c
@@ -0,0 +1,306 @@
+/*
+ * Video Acceleration API (video transcoding) transcode sample
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * Intel VAAPI-accelerated transcoding example.
+ *
+ * @example vaapi_transcode.c
+ * This example shows how to do VAAPI-accelerated transcoding.
+ * Usage: vaapi_transcode input_stream codec output_stream
+ * e.g: - vaapi_transcode input.mp4 h264_vaapi output_h264.mp4
+ *  - vaapi_transcode input.mp4 vp9_vaapi output_vp9.ivf
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+static AVFormatContext *ifmt_ctx = NULL, *ofmt_ctx = NULL;
+static AVBufferRef *hw_device_ctx = NULL;
+static AVCodecContext *decoder_ctx = NULL, *encoder_ctx = NULL;
+static int video_stream = -1;
+static AVStream *ost;
+static int initialized = 0;
+
+static enum AVPixelFormat get_vaapi_format(AVCodecContext *ctx,
+   const enum AVPixelFormat *pix_fmts)
+{
+const enum AVPixelFormat *p;
+
+for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) {
+if (*p == AV_PIX_FMT_VAAPI)
+return *p;
+}
+
+fprintf(stderr, "Unable to decode this file using VA-API.\n");
+return AV_PIX_FMT_NONE;
+}
+
+static int open_input_file(const char *filename)
+{
+int ret;
+AVCodec *decoder = NULL;
+AVStream *video = NULL;
+
+if ((ret = avformat_open_input(&ifmt_ctx, filename, NULL, NULL)) < 0) {
+fprintf(stderr, "Cannot open input file '%s', Error code: %s\n",
+filename, av_err2str(ret));
+return ret;
+}
+
+if ((ret = avformat_find_stream_info(ifmt_ctx, NULL)) < 0) {
+fprintf(stderr, "Cannot find input stream information. Error code: 
%s\n",
+av_err2str(ret));
+return ret;
+}
+
+ret = av_find_best_stream(ifmt_ctx, AVMED

[FFmpeg-cvslog] hwcontext: Fix documentation for av_hwdevice_ctx_alloc()

2018-02-11 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sun Mar 19 15:44:46 
2017 +0800| [96e476cc9d414e248692c773d9dce736662572b8] | committer: Mark 
Thompson

hwcontext: Fix documentation for av_hwdevice_ctx_alloc()

From ffmpeg commit 9365dfcbf665b83b2e60c5ec5e2abf1f0a49e2c3.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavutil/hwcontext.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h
index 203ea510ec..ba293d72e5 100644
--- a/libavutil/hwcontext.h
+++ b/libavutil/hwcontext.h
@@ -252,8 +252,9 @@ const char *av_hwdevice_get_type_name(enum AVHWDeviceType 
type);
 enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev);
 
 /**
- * Allocate an AVHWDeviceContext for a given pixel format.
+ * Allocate an AVHWDeviceContext for a given hardware type.
  *
+ * @param type the type of the hardware device to allocate.
  * @return a reference to the newly created AVHWDeviceContext on success or 
NULL
  * on failure.
  */

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


[FFmpeg-cvslog] avfilter/formats: fix wrong function name in error message

2018-02-19 Thread Jun Zhao
ffmpeg | branch: release/3.0 | Jun Zhao  | Mon Dec  4 
12:50:34 2017 +0800| [e512c83e63fced446d050da564c38ec722b08840] | committer: 
Michael Niedermayer

avfilter/formats: fix wrong function name in error message

Use perdefined micro __FUNCTION__ rather than hard coding function name
to fix wrong function name in error message.

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 4280948702bc256e21c375790b889c735d233b0d)
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index f12dcf4783..8cb77b27b1 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -72,7 +72,7 @@ do {
 for (j = 0; j < b->nb; j++)
 \
 if (a->fmts[i] == b->fmts[j]) {
 \
 if(k >= FFMIN(a->nb, b->nb)){  
 \
-av_log(NULL, AV_LOG_ERROR, "Duplicate formats in 
avfilter_merge_formats() detected\n"); \
+av_log(NULL, AV_LOG_ERROR, "Duplicate formats in %s 
detected\n", __FUNCTION__); \
 av_free(ret->fmts);
 \
 av_free(ret);  
 \
 return NULL;   
 \

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


[FFmpeg-cvslog] vaapi_encode: Allocate slice structures and parameter buffers dynamically

2018-02-21 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Thu Aug 24 09:13:01 
2017 +0800| [c8e135ea9225137050a6315fd9ba9c0f242c90b6] | committer: Mark 
Thompson

vaapi_encode: Allocate slice structures and parameter buffers dynamically

This removes the arbitrary limit on the allowed number of slices and
parameter buffers.

From ffmpeg commit e4a6eb70f471eda36592078e8fa1bad87fc9df73.

Signed-off-by: Mark Thompson 

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

 libavcodec/vaapi_encode.c | 40 ++--
 libavcodec/vaapi_encode.h |  6 ++
 2 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 47795ba735..c6113b1de5 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -36,13 +36,17 @@ static int vaapi_encode_make_packed_header(AVCodecContext 
*avctx,
 VAAPIEncodeContext *ctx = avctx->priv_data;
 VAStatus vas;
 VABufferID param_buffer, data_buffer;
+VABufferID *tmp;
 VAEncPackedHeaderParameterBuffer params = {
 .type = type,
 .bit_length = bit_len,
 .has_emulation_bytes = 1,
 };
 
-av_assert0(pic->nb_param_buffers + 2 <= MAX_PARAM_BUFFERS);
+tmp = av_realloc_array(pic->param_buffers, sizeof(*tmp), 
pic->nb_param_buffers + 2);
+if (!tmp)
+return AVERROR(ENOMEM);
+pic->param_buffers = tmp;
 
 vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context,
  VAEncPackedHeaderParameterBufferType,
@@ -77,9 +81,13 @@ static int vaapi_encode_make_param_buffer(AVCodecContext 
*avctx,
 {
 VAAPIEncodeContext *ctx = avctx->priv_data;
 VAStatus vas;
+VABufferID *tmp;
 VABufferID buffer;
 
-av_assert0(pic->nb_param_buffers + 1 <= MAX_PARAM_BUFFERS);
+tmp = av_realloc_array(pic->param_buffers, sizeof(*tmp), 
pic->nb_param_buffers + 1);
+if (!tmp)
+return AVERROR(ENOMEM);
+pic->param_buffers = tmp;
 
 vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context,
  type, len, 1, data, &buffer);
@@ -313,15 +321,16 @@ static int vaapi_encode_issue(AVCodecContext *avctx,
 }
 }
 
-av_assert0(pic->nb_slices <= MAX_PICTURE_SLICES);
-for (i = 0; i < pic->nb_slices; i++) {
-slice = av_mallocz(sizeof(*slice));
-if (!slice) {
+if (pic->nb_slices > 0) {
+pic->slices = av_mallocz_array(pic->nb_slices, sizeof(*pic->slices));
+if (!pic->slices) {
 err = AVERROR(ENOMEM);
 goto fail;
 }
+}
+for (i = 0; i < pic->nb_slices; i++) {
+slice = &pic->slices[i];
 slice->index = i;
-pic->slices[i] = slice;
 
 if (ctx->codec->slice_params_size > 0) {
 slice->codec_slice_params = 
av_mallocz(ctx->codec->slice_params_size);
@@ -425,8 +434,16 @@ fail_with_picture:
 fail:
 for(i = 0; i < pic->nb_param_buffers; i++)
 vaDestroyBuffer(ctx->hwctx->display, pic->param_buffers[i]);
+for (i = 0; i < pic->nb_slices; i++) {
+if (pic->slices) {
+av_freep(&pic->slices[i].priv_data);
+av_freep(&pic->slices[i].codec_slice_params);
+}
+}
 fail_at_end:
 av_freep(&pic->codec_picture_params);
+av_freep(&pic->param_buffers);
+av_freep(&pic->slices);
 av_frame_free(&pic->recon_image);
 av_buffer_unref(&pic->output_buffer_ref);
 pic->output_buffer = VA_INVALID_ID;
@@ -535,15 +552,18 @@ static int vaapi_encode_free(AVCodecContext *avctx,
 vaapi_encode_discard(avctx, pic);
 
 for (i = 0; i < pic->nb_slices; i++) {
-av_freep(&pic->slices[i]->priv_data);
-av_freep(&pic->slices[i]->codec_slice_params);
-av_freep(&pic->slices[i]);
+if (pic->slices) {
+av_freep(&pic->slices[i].priv_data);
+av_freep(&pic->slices[i].codec_slice_params);
+}
 }
 av_freep(&pic->codec_picture_params);
 
 av_frame_free(&pic->input_image);
 av_frame_free(&pic->recon_image);
 
+av_freep(&pic->param_buffers);
+av_freep(&pic->slices);
 // Output buffer should already be destroyed.
 av_assert0(pic->output_buffer == VA_INVALID_ID);
 
diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
index 1b0fed80e4..31c3790531 100644
--- a/libavcodec/vaapi_encode.h
+++ b/libavcodec/vaapi_encode.h
@@ -35,8 +35,6 @@ enum {
 MAX_CONFIG_ATTRIBUTES  = 4,
 MAX_GLOBAL_PARAMS  = 4,
 MAX_PICTURE_REFERENCES = 2,
-MAX_PICTURE_SLICES = 112,
-MAX_PARAM_BUFFERS  = 128,
 MAX_REORDER_DELAY  = 16,
 MAX_PARAM_BUFFER_SIZE  = 1024,
 };
@@ -73,7 +71,

[FFmpeg-cvslog] ffmpeg_opt: fix max_error_rate help info display issue.

2018-02-23 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Fri Feb 23 15:58:10 
2018 +0800| [74afa545286bdb4b6fb1137209338cab00280f78] | committer: Michael 
Niedermayer

ffmpeg_opt: fix max_error_rate help info display issue.

ffmpeg -h display "max_error_rate" option help information have
been cut off, the root cause is used a wrong initial order.

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 

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

 fftools/ffmpeg_opt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 997d538381..1b591d9695 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -3457,7 +3457,7 @@ const OptionDef options[] = {
 { "debug_ts",   OPT_BOOL | OPT_EXPERT,   { 
&debug_ts },
 "print timestamp debugging info" },
 { "max_error_rate",  HAS_ARG | OPT_FLOAT,{ 
&max_error_rate },
-"maximum error rate", "ratio of errors (0.0: no errors, 1.0: 100% 
errors) above which ffmpeg returns an error instead of success." },
+"ratio of errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg 
returns an error instead of success.", "maximum error rate" },
 { "discard",OPT_STRING | HAS_ARG | OPT_SPEC |
 OPT_INPUT,   { .off = 
OFFSET(discard) },
 "discard", "" },

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


[FFmpeg-cvslog] doc/bitstream_filters: documents delete_filler option.

2018-02-23 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Fri Feb 23 15:02:29 
2018 +0800| [b141902872bbe5d9389ee9f4fddbb87698c86689] | committer: Michael 
Niedermayer

doc/bitstream_filters: documents delete_filler option.

documents delete_filler option for bsf h264_metadata.

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi
index 5efb8e0ee8..cfd81fa12d 100644
--- a/doc/bitstream_filters.texi
+++ b/doc/bitstream_filters.texi
@@ -153,6 +153,9 @@ possibly separated by hyphens, and the string can be 
anything.
 For example, @samp{086f3693-b7b3-4f2c-9653-21492feee5b8+hello} will
 insert the string ``hello'' associated with the given UUID.
 
+@item delete_filler
+Deletes both filler NAL units and filler SEI messages.
+
 @end table
 
 @section h264_mp4toannexb

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


[FFmpeg-cvslog] doc/bitstream_filters: correct dump_extra bsfs docs.

2018-03-03 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Fri Feb 23 13:53:05 
2018 +0800| [1c7f1f38c533382710361ef7e765f1de4f7dfa78] | committer: Michael 
Niedermayer

doc/bitstream_filters: correct dump_extra bsfs docs.

Update dump_extra bit stream filter docs to follow current
code implement.

Signed-off-by: Jun Zhao 
Reviewed-by: Steven Liu 
Signed-off-by: Michael Niedermayer 

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

 doc/bitstream_filters.texi | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi
index cfd81fa12d..b7ea549322 100644
--- a/doc/bitstream_filters.texi
+++ b/doc/bitstream_filters.texi
@@ -50,21 +50,22 @@ DTS-HD.
 
 Add extradata to the beginning of the filtered packets.
 
+@table @option
+@item freq
 The additional argument specifies which packets should be filtered.
 It accepts the values:
 @table @samp
-@item a
-add extradata to all key packets, but only if @var{local_header} is
-set in the @option{flags2} codec context field
-
 @item k
+@item keyframe
 add extradata to all key packets
 
 @item e
+@item all
 add extradata to all packets
 @end table
+@end table
 
-If not specified it is assumed @samp{k}.
+If not specified it is assumed @samp{e}.
 
 For example the following @command{ffmpeg} command forces a global
 header (thus disabling individual packet headers) in the H.264 packets

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


[FFmpeg-cvslog] lavu/opt: add bit stream filter option dump support.

2018-03-15 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed Mar 14 10:05:05 
2018 +0800| [7b5cf0a410760bbd516d5c72cbb867c45017f9a7] | committer: Michael 
Niedermayer

lavu/opt: add bit stream filter option dump support.

enable dump bit stream filter and update opt fate test ref.

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 

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

 libavutil/opt.c|  1 +
 tests/ref/fate/opt | 50 +-
 2 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index df88663e3f..3b0aab4ee8 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1181,6 +1181,7 @@ static void opt_list(void *obj, void *av_log_obj, const 
char *unit,
 av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & 
AV_OPT_FLAG_SUBTITLE_PARAM) ? 'S' : '.');
 av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & 
AV_OPT_FLAG_EXPORT) ? 'X' : '.');
 av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & 
AV_OPT_FLAG_READONLY)   ? 'R' : '.');
+av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & 
AV_OPT_FLAG_BSF_PARAM)  ? 'B' : '.');
 
 if (opt->help)
 av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help);
diff --git a/tests/ref/fate/opt b/tests/ref/fate/opt
index 7b47d429c5..6a7dbfa797 100644
--- a/tests/ref/fate/opt
+++ b/tests/ref/fate/opt
@@ -18,31 +18,31 @@ num64=1
 flt=0.33
 dbl=0.33
 TestContext AVOptions:
-  -num   E... set num (from 0 to 100) (default 0)
-  -toggleE... set toggle (from 0 to 1) (default 1)
-  -rational E... set rational (from 0 to 10) 
(default 1/1)
-  -string E... set string (default "default")
-  -escape E... set escape str (default "\=,")
-  -flags   E... set flags (default cool)
- cool E... set cool flag
- lame E... set lame flag
- mu   E... set mu flag
-  -size   E... set size (default "200x300")
-  -pix_fmt   E... set pixfmt (default 0bgr)
-  -sample_fmt E... set samplefmt (default s16)
-  -video_rate E... set videorate (default "25")
-  -duration E... set duration (default 0.001)
-  -color   E... set color (default "pink")
-  -cl E... set channel layout (default 
0x137)
-  -binE... set binary value
-  -bin1   E... set binary value
-  -bin2   E... set binary value
-  -num64   E... set num 64bit (from 0 to 100) 
(default 1)
-  -flt E... set float (from 0 to 100) (default 
0.33)
-  -dblE... set double (from 0 to 100) (default 
0.33)
-  -bool1 E... set boolean value (default auto)
-  -bool2 E... set boolean value (default true)
-  -bool3 E... set boolean value (default false)
+  -num   E set num (from 0 to 100) (default 0)
+  -toggleE set toggle (from 0 to 1) (default 
1)
+  -rational E set rational (from 0 to 10) 
(default 1/1)
+  -string E set string (default "default")
+  -escape E set escape str (default "\=,")
+  -flags   E set flags (default cool)
+ cool E set cool flag
+ lame E set lame flag
+ mu   E set mu flag
+  -size   E set size (default "200x300")
+  -pix_fmt   E set pixfmt (default 0bgr)
+  -sample_fmt E set samplefmt (default s16)
+  -video_rate E set videorate (default "25")
+  -duration E set duration (default 0.001)
+  -color   E set color (default "pink")
+  -cl E set channel layout (default 
0x137)
+  -binE set binary value
+  -bin1   E set binary value
+  -bin2   E set binary value
+  -num64   E set num 64bit (from 0 to 100) 
(default 1)
+  -flt E set float (from 0 to 100) (default 
0.33)
+  -dblE set double (from 0 to 100) 
(default 0.33)
+  -bool1 E set boolean value (default auto)
+  -bool2  

[FFmpeg-cvslog] ffmpeg: support dump bit stream filter options.

2018-03-15 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Thu Mar  8 13:50:31 
2018 +0800| [a675eed17538708a4efb90946b83161ec788b36a] | committer: Michael 
Niedermayer

ffmpeg: support dump bit stream filter options.

Support dump bit stream filter option in ffmpeg -h full and
ffmpeg -h bsf=FooBar.

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 

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

 fftools/cmdutils.c   | 17 +
 fftools/ffmpeg_opt.c |  3 ++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 0c7d13c27a..f9d87f6724 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1897,6 +1897,21 @@ static void show_help_filter(const char *name)
 }
 #endif
 
+static void show_help_bsf(const char *name)
+{
+const AVBitStreamFilter *bsf = av_bsf_get_by_name(name);
+
+if (!bsf) {
+av_log(NULL, AV_LOG_ERROR, "Unknown bit stream filter '%s'.\n", name);
+return;
+}
+
+printf("Bit stream filter %s\n", bsf->name);
+if (bsf->priv_class)
+show_help_children(bsf->priv_class, AV_OPT_FLAG_BSF_PARAM);
+printf("\n");
+}
+
 int show_help(void *optctx, const char *opt, const char *arg)
 {
 char *topic, *par;
@@ -1923,6 +1938,8 @@ int show_help(void *optctx, const char *opt, const char 
*arg)
 } else if (!strcmp(topic, "filter")) {
 show_help_filter(par);
 #endif
+} else if (!strcmp(topic, "bsf")) {
+show_help_bsf(par);
 } else {
 show_help_default(topic, par);
 }
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 1b591d9695..d7a7eb0662 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -3114,7 +3114,7 @@ void show_help_default(const char *opt, const char *arg)
"-h  -- print basic options\n"
"-h long -- print more options\n"
"-h full -- print all options (including all format and codec 
specific options, very long)\n"
-   "-h type=name -- print all options for the named 
decoder/encoder/demuxer/muxer/filter\n"
+   "-h type=name -- print all options for the named 
decoder/encoder/demuxer/muxer/filter/bsf\n"
"See man %s for detailed description of the options.\n"
"\n", program_name);
 
@@ -3159,6 +3159,7 @@ void show_help_default(const char *opt, const char *arg)
 #endif
 show_help_children(swr_get_class(), AV_OPT_FLAG_AUDIO_PARAM);
 show_help_children(avfilter_get_class(), AV_OPT_FLAG_VIDEO_PARAM | 
AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM);
+show_help_children(av_bsf_get_class(), AV_OPT_FLAG_VIDEO_PARAM | 
AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_BSF_PARAM);
 }
 }
 

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


[FFmpeg-cvslog] lavu/opt: add AV_OPT_FLAG_BSF_PARAM

2018-03-15 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Thu Mar  8 13:47:23 
2018 +0800| [e0e72539cf5cb9d83cd13434f3be7b80e7ca84e4] | committer: Michael 
Niedermayer

lavu/opt: add AV_OPT_FLAG_BSF_PARAM

add AV_OPT_FLAG_BSF_PARAM for bit stream filter options.

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 

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

 libavutil/opt.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavutil/opt.h b/libavutil/opt.h
index 391720f2e2..07da68ea23 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -287,6 +287,7 @@ typedef struct AVOption {
  * This flag only makes sense when AV_OPT_FLAG_EXPORT is also set.
  */
 #define AV_OPT_FLAG_READONLY128
+#define AV_OPT_FLAG_BSF_PARAM   (1<<8) ///< a generic parameter which can 
be set by the user for bit stream filtering
 #define AV_OPT_FLAG_FILTERING_PARAM (1<<16) ///< a generic parameter which can 
be set by the user for filtering
 //FIXME think about enc-audio, ... style flags
 

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


[FFmpeg-cvslog] lavc/extract_extradata_bsf: support dump options.

2018-03-17 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Thu Mar  8 14:05:53 
2018 +0800| [edce64c9e98f32579dddb5dccf590034686decc2] | committer: James Almer

lavc/extract_extradata_bsf: support dump options.

support dump bit stream filter options

Signed-off-by: Jun Zhao 
Signed-off-by: James Almer 

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

 libavcodec/extract_extradata_bsf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/extract_extradata_bsf.c 
b/libavcodec/extract_extradata_bsf.c
index 1c386becd7..82632c5b57 100644
--- a/libavcodec/extract_extradata_bsf.c
+++ b/libavcodec/extract_extradata_bsf.c
@@ -322,9 +322,10 @@ static const enum AVCodecID codec_ids[] = {
 };
 
 #define OFFSET(x) offsetof(ExtractExtradataContext, x)
+#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_BSF_PARAM)
 static const AVOption options[] = {
 { "remove", "remove the extradata from the bitstream", OFFSET(remove), 
AV_OPT_TYPE_INT,
-{ .i64 = 0 }, 0, 1 },
+{ .i64 = 0 }, 0, 1, FLAGS },
 { NULL },
 };
 

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


[FFmpeg-cvslog] lavc/h264_metadata_bsf: support dump options.

2018-03-18 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed Mar 14 13:42:19 
2018 +0800| [840f5b3e5ba12b26f53bf8539cb5f0f14c4a6d40] | committer: Mark 
Thompson

lavc/h264_metadata_bsf: support dump options.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavcodec/h264_metadata_bsf.c | 66 --
 1 file changed, 38 insertions(+), 28 deletions(-)

diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c
index da37115b5d..3dc4affddd 100644
--- a/libavcodec/h264_metadata_bsf.c
+++ b/libavcodec/h264_metadata_bsf.c
@@ -591,82 +591,92 @@ static void h264_metadata_close(AVBSFContext *bsf)
 }
 
 #define OFFSET(x) offsetof(H264MetadataContext, x)
+#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_BSF_PARAM)
 static const AVOption h264_metadata_options[] = {
 { "aud", "Access Unit Delimiter NAL units",
 OFFSET(aud), AV_OPT_TYPE_INT,
-{ .i64 = PASS }, PASS, REMOVE, 0, "aud" },
-{ "pass",   NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PASS   }, .unit = "aud" },
-{ "insert", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = INSERT }, .unit = "aud" },
-{ "remove", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = REMOVE }, .unit = "aud" },
+{ .i64 = PASS }, PASS, REMOVE, FLAGS, "aud" },
+{ "pass",   NULL, 0, AV_OPT_TYPE_CONST,
+{ .i64 = PASS   }, .flags = FLAGS, .unit = "aud" },
+{ "insert", NULL, 0, AV_OPT_TYPE_CONST,
+{ .i64 = INSERT }, .flags = FLAGS, .unit = "aud" },
+{ "remove", NULL, 0, AV_OPT_TYPE_CONST,
+{ .i64 = REMOVE }, .flags = FLAGS, .unit = "aud" },
 
 { "sample_aspect_ratio", "Set sample aspect ratio (table E-1)",
 OFFSET(sample_aspect_ratio), AV_OPT_TYPE_RATIONAL,
-{ .dbl = 0.0 }, 0, 65535 },
+{ .dbl = 0.0 }, 0, 65535, FLAGS },
 
 { "video_format", "Set video format (table E-2)",
 OFFSET(video_format), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 7 },
+{ .i64 = -1 }, -1, 7, FLAGS},
 { "video_full_range_flag", "Set video full range flag",
 OFFSET(video_full_range_flag), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 1 },
+{ .i64 = -1 }, -1, 1, FLAGS },
 { "colour_primaries", "Set colour primaries (table E-3)",
 OFFSET(colour_primaries), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 255 },
+{ .i64 = -1 }, -1, 255, FLAGS },
 { "transfer_characteristics", "Set transfer characteristics (table E-4)",
 OFFSET(transfer_characteristics), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 255 },
+{ .i64 = -1 }, -1, 255, FLAGS },
 { "matrix_coefficients", "Set matrix coefficients (table E-5)",
 OFFSET(matrix_coefficients), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 255 },
+{ .i64 = -1 }, -1, 255, FLAGS },
 
 { "chroma_sample_loc_type", "Set chroma sample location type (figure E-1)",
 OFFSET(chroma_sample_loc_type), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 6 },
+{ .i64 = -1 }, -1, 6, FLAGS },
 
 { "tick_rate", "Set VUI tick rate (num_units_in_tick / time_scale)",
 OFFSET(tick_rate), AV_OPT_TYPE_RATIONAL,
-{ .dbl = 0.0 }, 0, UINT_MAX },
+{ .dbl = 0.0 }, 0, UINT_MAX, FLAGS },
 { "fixed_frame_rate_flag", "Set VUI fixed frame rate flag",
 OFFSET(fixed_frame_rate_flag), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 1 },
+{ .i64 = -1 }, -1, 1, FLAGS },
 
 { "crop_left", "Set left border crop offset",
 OFFSET(crop_left), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, H264_MAX_WIDTH },
+{ .i64 = -1 }, -1, H264_MAX_WIDTH, FLAGS },
 { "crop_right", "Set right border crop offset",
 OFFSET(crop_right), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, H264_MAX_WIDTH },
+{ .i64 = -1 }, -1, H264_MAX_WIDTH, FLAGS },
 { "crop_top", "Set top border crop offset",
 OFFSET(crop_top), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, H264_MAX_HEIGHT },
+{ .i64 = -1 }, -1, H264_MAX_HEIGHT, FLAGS },
 { "crop_bottom", "Set bottom border crop offset",
 OFFSET(crop_bottom), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, H264_MAX_HEIGHT },
+{ .i64 = -1 }, -1, H264_MAX_HEIGHT, FLAGS },
 
 { "sei_user_data", "Insert SEI user data (UUID+string)",
-OFFSET(sei_user_data), AV_OPT_TYPE_STRING, { .str = NULL } },
+OFFSET(sei_user_data), AV_OPT_TYPE_STRING, { .str = NULL }, .flags = 
FLAGS },
 
 { "delete_filler", "Delete all fi

[FFmpeg-cvslog] lavc/mpeg2_metadata_bsf: support dump options.

2018-03-18 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed Mar 14 13:42:37 
2018 +0800| [dd21f02a044703e1473e56fbb61f849b0c8b993a] | committer: Mark 
Thompson

lavc/mpeg2_metadata_bsf: support dump options.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavcodec/mpeg2_metadata_bsf.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/libavcodec/mpeg2_metadata_bsf.c b/libavcodec/mpeg2_metadata_bsf.c
index 3bb6c1d549..6d5f581ab1 100644
--- a/libavcodec/mpeg2_metadata_bsf.c
+++ b/libavcodec/mpeg2_metadata_bsf.c
@@ -266,27 +266,28 @@ static void mpeg2_metadata_close(AVBSFContext *bsf)
 }
 
 #define OFFSET(x) offsetof(MPEG2MetadataContext, x)
+#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_BSF_PARAM)
 static const AVOption mpeg2_metadata_options[] = {
 { "display_aspect_ratio", "Set display aspect ratio (table 6-3)",
 OFFSET(display_aspect_ratio), AV_OPT_TYPE_RATIONAL,
-{ .dbl = 0.0 }, 0, 65535 },
+{ .dbl = 0.0 }, 0, 65535, FLAGS },
 
 { "frame_rate", "Set frame rate",
 OFFSET(frame_rate), AV_OPT_TYPE_RATIONAL,
-{ .dbl = 0.0 }, 0, UINT_MAX },
+{ .dbl = 0.0 }, 0, UINT_MAX, FLAGS },
 
 { "video_format", "Set video format (table 6-6)",
 OFFSET(video_format), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 7 },
+{ .i64 = -1 }, -1, 7, FLAGS },
 { "colour_primaries", "Set colour primaries (table 6-7)",
 OFFSET(colour_primaries), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 255 },
+{ .i64 = -1 }, -1, 255, FLAGS },
 { "transfer_characteristics", "Set transfer characteristics (table 6-8)",
 OFFSET(transfer_characteristics), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 255 },
+{ .i64 = -1 }, -1, 255, FLAGS },
 { "matrix_coefficients", "Set matrix coefficients (table 6-9)",
 OFFSET(matrix_coefficients), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 255 },
+{ .i64 = -1 }, -1, 255, FLAGS },
 
 { NULL }
 };

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


[FFmpeg-cvslog] lavc/h265_metadata_bsf: support dump options.

2018-03-18 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed Mar 14 13:42:28 
2018 +0800| [2a103e12ba901af519d77562c09694264e2277d4] | committer: Mark 
Thompson

lavc/h265_metadata_bsf: support dump options.

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavcodec/h265_metadata_bsf.c | 38 +-
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/libavcodec/h265_metadata_bsf.c b/libavcodec/h265_metadata_bsf.c
index 2398ee95c5..8759e410f3 100644
--- a/libavcodec/h265_metadata_bsf.c
+++ b/libavcodec/h265_metadata_bsf.c
@@ -379,59 +379,63 @@ static void h265_metadata_close(AVBSFContext *bsf)
 }
 
 #define OFFSET(x) offsetof(H265MetadataContext, x)
+#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_BSF_PARAM)
 static const AVOption h265_metadata_options[] = {
 { "aud", "Access Unit Delimiter NAL units",
 OFFSET(aud), AV_OPT_TYPE_INT,
-{ .i64 = PASS }, PASS, REMOVE, 0, "aud" },
-{ "pass",   NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PASS   }, .unit = "aud" },
-{ "insert", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = INSERT }, .unit = "aud" },
-{ "remove", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = REMOVE }, .unit = "aud" },
+{ .i64 = PASS }, PASS, REMOVE, FLAGS, "aud" },
+{ "pass",   NULL, 0, AV_OPT_TYPE_CONST,
+{ .i64 = PASS   }, .flags = FLAGS, .unit = "aud" },
+{ "insert", NULL, 0, AV_OPT_TYPE_CONST,
+{ .i64 = INSERT }, .flags = FLAGS, .unit = "aud" },
+{ "remove", NULL, 0, AV_OPT_TYPE_CONST,
+{ .i64 = REMOVE }, .flags = FLAGS, .unit = "aud" },
 
 { "sample_aspect_ratio", "Set sample aspect ratio (table E-1)",
 OFFSET(sample_aspect_ratio), AV_OPT_TYPE_RATIONAL,
-{ .dbl = 0.0 }, 0, 65535 },
+{ .dbl = 0.0 }, 0, 65535, FLAGS },
 
 { "video_format", "Set video format (table E-2)",
 OFFSET(video_format), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 7 },
+{ .i64 = -1 }, -1, 7, FLAGS },
 { "video_full_range_flag", "Set video full range flag",
 OFFSET(video_full_range_flag), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 1 },
+{ .i64 = -1 }, -1, 1, FLAGS },
 { "colour_primaries", "Set colour primaries (table E-3)",
 OFFSET(colour_primaries), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 255 },
+{ .i64 = -1 }, -1, 255, FLAGS },
 { "transfer_characteristics", "Set transfer characteristics (table E-4)",
 OFFSET(transfer_characteristics), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 255 },
+{ .i64 = -1 }, -1, 255, FLAGS },
 { "matrix_coefficients", "Set matrix coefficients (table E-5)",
 OFFSET(matrix_coefficients), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 255 },
+{ .i64 = -1 }, -1, 255, FLAGS },
 
 { "chroma_sample_loc_type", "Set chroma sample location type (figure E-1)",
 OFFSET(chroma_sample_loc_type), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, 6 },
+{ .i64 = -1 }, -1, 6, FLAGS },
 
 { "tick_rate",
 "Set VPS and VUI tick rate (num_units_in_tick / time_scale)",
 OFFSET(tick_rate), AV_OPT_TYPE_RATIONAL,
-{ .dbl = 0.0 }, 0, UINT_MAX },
+{ .dbl = 0.0 }, 0, UINT_MAX, FLAGS },
 { "num_ticks_poc_diff_one",
 "Set VPS and VUI number of ticks per POC increment",
 OFFSET(num_ticks_poc_diff_one), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, INT_MAX },
+{ .i64 = -1 }, -1, INT_MAX, FLAGS },
 
 { "crop_left", "Set left border crop offset",
 OFFSET(crop_left), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, HEVC_MAX_WIDTH },
+{ .i64 = -1 }, -1, HEVC_MAX_WIDTH, FLAGS },
 { "crop_right", "Set right border crop offset",
 OFFSET(crop_right), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, HEVC_MAX_WIDTH },
+{ .i64 = -1 }, -1, HEVC_MAX_WIDTH, FLAGS },
 { "crop_top", "Set top border crop offset",
 OFFSET(crop_top), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, HEVC_MAX_HEIGHT },
+{ .i64 = -1 }, -1, HEVC_MAX_HEIGHT, FLAGS },
 { "crop_bottom", "Set bottom border crop offset",
 OFFSET(crop_bottom), AV_OPT_TYPE_INT,
-{ .i64 = -1 }, -1, HEVC_MAX_HEIGHT },
+{ .i64 = -1 }, -1, HEVC_MAX_HEIGHT, FLAGS },
 
 { NULL }
 };

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


[FFmpeg-cvslog] lavc/dump_extradata_bsf: support dump options.

2018-03-21 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Thu Mar  8 14:01:48 
2018 +0800| [a4726288f8c14fecb8e0e2b36acc6c595dfa3b03] | committer: James Almer

lavc/dump_extradata_bsf: support dump options.

support dump bit stream filter options

Signed-off-by: Jun Zhao 
Signed-off-by: James Almer 

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

 libavcodec/dump_extradata_bsf.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavcodec/dump_extradata_bsf.c b/libavcodec/dump_extradata_bsf.c
index fa7bc86e19..081ae5aa08 100644
--- a/libavcodec/dump_extradata_bsf.c
+++ b/libavcodec/dump_extradata_bsf.c
@@ -78,13 +78,14 @@ fail:
 }
 
 #define OFFSET(x) offsetof(DumpExtradataContext, x)
+#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_BSF_PARAM)
 static const AVOption options[] = {
 { "freq", "When do dump extradata", OFFSET(freq), AV_OPT_TYPE_INT,
-{ .i64 = DUMP_FREQ_KEYFRAME }, DUMP_FREQ_KEYFRAME, DUMP_FREQ_ALL, 0, 
"freq" },
-{ "k",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = DUMP_FREQ_KEYFRAME 
}, .unit = "freq" },
-{ "keyframe", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = DUMP_FREQ_KEYFRAME 
}, .unit = "freq" },
-{ "e",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = DUMP_FREQ_ALL  
}, .unit = "freq" },
-{ "all",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = DUMP_FREQ_ALL  
}, .unit = "freq" },
+{ .i64 = DUMP_FREQ_KEYFRAME }, DUMP_FREQ_KEYFRAME, DUMP_FREQ_ALL, 
FLAGS, "freq" },
+{ "k",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = DUMP_FREQ_KEYFRAME 
}, .flags = FLAGS, .unit = "freq" },
+{ "keyframe", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = DUMP_FREQ_KEYFRAME 
}, .flags = FLAGS, .unit = "freq" },
+{ "e",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = DUMP_FREQ_ALL  
}, .flags = FLAGS, .unit = "freq" },
+{ "all",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = DUMP_FREQ_ALL  
}, .flags = FLAGS, .unit = "freq" },
 { NULL },
 };
 

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


[FFmpeg-cvslog] lavc/noise_bsf: support dump options.

2018-03-21 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Thu Mar  8 14:57:47 
2018 +0800| [b8e406c01a75904e84c743a35ac4c2f28de4a625] | committer: James Almer

lavc/noise_bsf: support dump options.

support dump bit stream filter options.

Signed-off-by: Jun Zhao 
Signed-off-by: James Almer 

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

 libavcodec/noise_bsf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/noise_bsf.c b/libavcodec/noise_bsf.c
index 84b94032ad..6bb89507fc 100644
--- a/libavcodec/noise_bsf.c
+++ b/libavcodec/noise_bsf.c
@@ -78,9 +78,10 @@ fail:
 }
 
 #define OFFSET(x) offsetof(NoiseContext, x)
+#define FLAGS 
(AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_BSF_PARAM)
 static const AVOption options[] = {
-{ "amount", NULL, OFFSET(amount), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 
INT_MAX },
-{ "dropamount", NULL, OFFSET(dropamount), AV_OPT_TYPE_INT, { .i64 = 0 }, 
0, INT_MAX },
+{ "amount", NULL, OFFSET(amount), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 
INT_MAX, FLAGS },
+{ "dropamount", NULL, OFFSET(dropamount), AV_OPT_TYPE_INT, { .i64 = 0 }, 
0, INT_MAX, FLAGS },
 { NULL },
 };
 

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


[FFmpeg-cvslog] lavc/remove_extradata_bsf: support dump options.

2018-03-21 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Thu Mar  8 15:00:27 
2018 +0800| [28aaed773712d170e13f35658aac685dd8b7db44] | committer: James Almer

lavc/remove_extradata_bsf: support dump options.

support dump bit stream filter options

Signed-off-by: Jun Zhao 
Signed-off-by: James Almer 

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

 libavcodec/remove_extradata_bsf.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavcodec/remove_extradata_bsf.c 
b/libavcodec/remove_extradata_bsf.c
index d74391e547..b762079e05 100644
--- a/libavcodec/remove_extradata_bsf.c
+++ b/libavcodec/remove_extradata_bsf.c
@@ -90,12 +90,13 @@ static void remove_extradata_close(AVBSFContext *ctx)
 }
 
 #define OFFSET(x) offsetof(RemoveExtradataContext, x)
+#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_BSF_PARAM)
 static const AVOption options[] = {
-{ "freq", NULL, OFFSET(freq), AV_OPT_TYPE_INT, { .i64 = 
REMOVE_FREQ_KEYFRAME }, REMOVE_FREQ_KEYFRAME, REMOVE_FREQ_NONKEYFRAME, 0, 
"freq" },
-{ "k",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
REMOVE_FREQ_NONKEYFRAME }, .unit = "freq" },
-{ "keyframe", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
REMOVE_FREQ_KEYFRAME }, .unit = "freq" },
-{ "e",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = REMOVE_FREQ_ALL 
 }, .unit = "freq" },
-{ "all",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = REMOVE_FREQ_ALL 
 }, .unit = "freq" },
+{ "freq", NULL, OFFSET(freq), AV_OPT_TYPE_INT, { .i64 = 
REMOVE_FREQ_KEYFRAME }, REMOVE_FREQ_KEYFRAME, REMOVE_FREQ_NONKEYFRAME, FLAGS, 
"freq" },
+{ "k",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
REMOVE_FREQ_NONKEYFRAME }, .flags = FLAGS, .unit = "freq" },
+{ "keyframe", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
REMOVE_FREQ_KEYFRAME }, .flags = FLAGS, .unit = "freq" },
+{ "e",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = REMOVE_FREQ_ALL 
 }, .flags = FLAGS, .unit = "freq" },
+{ "all",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = REMOVE_FREQ_ALL 
 }, .flags = FLAGS, .unit = "freq" },
 { NULL },
 };
 

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


[FFmpeg-cvslog] kmsgrab: add category for kmsgrab

2018-03-26 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Mar 26 08:22:07 
2018 +0800| [ac6e27d74f6a413d400c228b0eb2d3af32c1ea76] | committer: Mark 
Thompson

kmsgrab: add category for kmsgrab

Makes kmsgrab visible in "ffmpeg -devices".

Signed-off-by: Jun Zhao 
Signed-off-by: Mark Thompson 

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

 libavdevice/kmsgrab.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavdevice/kmsgrab.c b/libavdevice/kmsgrab.c
index 6a6de09c37..d0de774871 100644
--- a/libavdevice/kmsgrab.c
+++ b/libavdevice/kmsgrab.c
@@ -451,6 +451,7 @@ static const AVClass kmsgrab_class = {
 .item_name  = av_default_item_name,
 .option = options,
 .version= LIBAVUTIL_VERSION_INT,
+.category   = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
 };
 
 AVInputFormat ff_kmsgrab_demuxer = {

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


[FFmpeg-cvslog] cmdutils: fix new API break the "ffmpeg -muxers/demuxers"

2018-04-01 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sun Apr  1 22:29:46 
2018 +0800| [9b125826ed7eda54387c06469c081229b222ee59] | committer: Josh de Kock

cmdutils: fix new API break the "ffmpeg -muxers/demuxers"

fix commit 2238190 break the "ffmpeg -muxers/demuxers".

Signed-off-by: Jun Zhao 
Signed-off-by: Josh de Kock 

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

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

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index a6cf002fd0..1001f36299 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1278,7 +1278,7 @@ static int show_formats_devices(void *optctx, const char 
*opt, const char *arg,
 const char *long_name = NULL;
 
 if (muxdemuxers !=SHOW_DEMUXERS) {
-ifmt_opaque = NULL;
+ofmt_opaque = NULL;
 while ((ofmt = av_muxer_iterate(&ofmt_opaque))) {
 is_dev = is_device(ofmt->priv_class);
 if (!is_dev && device_only)
@@ -1292,7 +1292,7 @@ static int show_formats_devices(void *optctx, const char 
*opt, const char *arg,
 }
 }
 if (muxdemuxers != SHOW_MUXERS) {
-ofmt_opaque = NULL;
+ifmt_opaque = NULL;
 while ((ifmt = av_demuxer_iterate(&ifmt_opaque))) {
 is_dev = is_device(ifmt->priv_class);
 if (!is_dev && device_only)

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


[FFmpeg-cvslog] avformat/options_table: Change the seek2any location in opt table.

2018-04-02 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sun Apr  1 15:53:11 
2018 +0800| [c6c20249e724e1db37af72815742c0cd520d4756] | committer: Michael 
Niedermayer

avformat/options_table: Change the seek2any location in opt table.

Change the seek2any location in avformat_options to make code more
readable.

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 

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

 libavformat/options_table.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index b8fa47c6fd..7c4d84798e 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -54,10 +54,10 @@ static const AVOption avformat_options[] = {
 {"fastseek", "fast but inaccurate seeks", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVFMT_FLAG_FAST_SEEK }, INT_MIN, INT_MAX, D, "fflags"},
 {"latm", "enable RTP MP4A-LATM payload", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVFMT_FLAG_MP4A_LATM }, INT_MIN, INT_MAX, E, "fflags"},
 {"nobuffer", "reduce the latency introduced by optional buffering", 0, 
AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_NOBUFFER }, 0, INT_MAX, D, "fflags"},
-{"seek2any", "allow seeking to non-keyframes on demuxer level when supported", 
OFFSET(seek2any), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, D},
 {"bitexact", "do not write random/volatile data", 0, AV_OPT_TYPE_CONST, { .i64 
= AVFMT_FLAG_BITEXACT }, 0, 0, E, "fflags" },
 {"shortest", "stop muxing with the shortest stream", 0, AV_OPT_TYPE_CONST, { 
.i64 = AVFMT_FLAG_SHORTEST }, 0, 0, E, "fflags" },
 {"autobsf", "add needed bsfs automatically", 0, AV_OPT_TYPE_CONST, { .i64 = 
AVFMT_FLAG_AUTO_BSF }, 0, 0, E, "fflags" },
+{"seek2any", "allow seeking to non-keyframes on demuxer level when supported", 
OFFSET(seek2any), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, D},
 {"analyzeduration", "specify how many microseconds are analyzed to probe the 
input", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, 
INT64_MAX, D},
 {"cryptokey", "decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, {.dbl = 0}, 
0, 0, D},
 {"indexmem", "max memory used for timestamp index (per stream)", 
OFFSET(max_index_size), AV_OPT_TYPE_INT, {.i64 = 1<<20 }, 0, INT_MAX, D},

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


[FFmpeg-cvslog] lavf/hls: Remove the dead code in parse_playlist()

2018-04-03 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed Apr  4 11:04:56 
2018 +0800| [51e3010575ca55ee64ffe3c48087d263e9c1e65f] | committer: Steven Liu

lavf/hls: Remove the dead code in  parse_playlist()

Signed-off-by: Jun Zhao 
Reviewed-by: Steven Liu 

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

 libavformat/hls.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index c578bf86e3..ae0545a086 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -743,7 +743,6 @@ static int parse_playlist(HLSContext *c, const char *url,
 }
 
 if (!in) {
-#if 1
 AVDictionary *opts = NULL;
 /* Some HLS servers don't like being sent the range header */
 av_dict_set(&opts, "seekable", "0", 0);
@@ -766,12 +765,6 @@ static int parse_playlist(HLSContext *c, const char *url,
 c->playlist_pb = in;
 else
 close_in = 1;
-#else
-ret = open_in(c, &in, url);
-if (ret < 0)
-return ret;
-close_in = 1;
-#endif
 }
 
 if (av_opt_get(in, "location", AV_OPT_SEARCH_CHILDREN, &new_url) >= 0)

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


[FFmpeg-cvslog] MAINTAINERS: add myself to the general developers list

2018-04-09 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Tue Apr  3 07:14:46 
2018 +0800| [3b350528d252b16f9f1860fe5a83aca814ae2b14] | committer: Michael 
Niedermayer

MAINTAINERS: add myself to the general developers list

Signed-off-by: Jun Zhao 
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/MAINTAINERS b/MAINTAINERS
index 3c54ad6781..5c7bf4726f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -552,6 +552,7 @@ Ivan Uskov
 James Darnley
 Jan Ekström
 Joakim Plate
+Jun Zhao
 Kieran Kunhya
 Kirill Gavrilov
 Martin Storsjö

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


[FFmpeg-cvslog] lavf/aviobuf: add ff_get_chomp_line

2018-04-12 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Apr  9 23:05:42 
2018 +0800| [cdd107b96586916508f8665b08be7de54d9633cf] | committer: Jun Zhao

lavf/aviobuf: add ff_get_chomp_line

Same as ff_get_line but strip the white-space characters in the
string tail.

Signed-off-by: Jun Zhao 

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

 libavformat/aviobuf.c  |  8 
 libavformat/internal.h | 10 ++
 2 files changed, 18 insertions(+)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 95b3364478..e752d0e1a6 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -823,6 +823,14 @@ int ff_get_line(AVIOContext *s, char *buf, int maxlen)
 return i;
 }
 
+int ff_get_chomp_line(AVIOContext *s, char *buf, int maxlen)
+{
+int len = ff_get_line(s, buf, maxlen);
+while (len > 0 && av_isspace(buf[len - 1]))
+buf[--len] = '\0';
+return len;
+}
+
 int64_t ff_read_line_to_bprint(AVIOContext *s, AVBPrint *bp)
 {
 int len, end;
diff --git a/libavformat/internal.h b/libavformat/internal.h
index c50382ad29..3582682925 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -300,6 +300,16 @@ void ff_put_v(AVIOContext *bc, uint64_t val);
 int ff_get_line(AVIOContext *s, char *buf, int maxlen);
 
 /**
+ * Same as ff_get_line but strip the white-space characters in the text tail
+ *
+ * @param s the read-only AVIOContext
+ * @param buf buffer to store the read line
+ * @param maxlen size of the buffer
+ * @return the length of the string written in the buffer
+ */
+int ff_get_chomp_line(AVIOContext *s, char *buf, int maxlen);
+
+/**
  * Read a whole line of text from AVIOContext to an AVBPrint buffer. Stop
  * reading after reaching a \\r, a \\n, a \\r\\n, a \\0 or EOF.  The line
  * ending characters are NOT included in the buffer, but they are skipped on

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


[FFmpeg-cvslog] lavf/hlsproto: use ff_get_chomp_line

2018-04-12 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Apr  9 23:13:03 
2018 +0800| [52623bc26fc49a1335a7ba4aab6ddb2b6588c105] | committer: Jun Zhao

lavf/hlsproto: use ff_get_chomp_line

Signed-off-by: Jun Zhao 

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

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

diff --git a/libavformat/hlsproto.c b/libavformat/hlsproto.c
index 2b19ed0cf6..e7ef2d88ea 100644
--- a/libavformat/hlsproto.c
+++ b/libavformat/hlsproto.c
@@ -69,14 +69,6 @@ typedef struct HLSContext {
 int64_t last_load_time;
 } HLSContext;
 
-static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
-{
-int len = ff_get_line(s, buf, maxlen);
-while (len > 0 && av_isspace(buf[len - 1]))
-buf[--len] = '\0';
-return len;
-}
-
 static void free_segment_list(HLSContext *s)
 {
 int i;
@@ -122,7 +114,7 @@ static int parse_playlist(URLContext *h, const char *url)
h->protocol_whitelist, 
h->protocol_blacklist)) < 0)
 return ret;
 
-read_chomp_line(in, line, sizeof(line));
+ff_get_chomp_line(in, line, sizeof(line));
 if (strcmp(line, "#EXTM3U")) {
 ret = AVERROR_INVALIDDATA;
 goto fail;
@@ -131,7 +123,7 @@ static int parse_playlist(URLContext *h, const char *url)
 free_segment_list(s);
 s->finished = 0;
 while (!avio_feof(in)) {
-read_chomp_line(in, line, sizeof(line));
+ff_get_chomp_line(in, line, sizeof(line));
 if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
 struct variant_info info = {{0}};
 is_variant = 1;

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


[FFmpeg-cvslog] lavf/hlsenc: use ff_get_chomp_line

2018-04-12 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Apr  9 23:12:16 
2018 +0800| [f1ccb4dbcf0b878120ba3990476ce7059ead2d74] | committer: Jun Zhao

lavf/hlsenc: use ff_get_chomp_line

Signed-off-by: Jun Zhao 

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

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

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 8eb84212a0..01a06d8b26 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -696,14 +696,6 @@ static int hls_encryption_start(AVFormatContext *s)
 return 0;
 }
 
-static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
-{
-int len = ff_get_line(s, buf, maxlen);
-while (len > 0 && av_isspace(buf[len - 1]))
-buf[--len] = '\0';
-return len;
-}
-
 static int hls_mux_init(AVFormatContext *s, VariantStream *vs)
 {
 AVDictionary *options = NULL;
@@ -1072,7 +1064,7 @@ static int parse_playlist(AVFormatContext *s, const char 
*url, VariantStream *vs
s->protocol_whitelist, 
s->protocol_blacklist)) < 0)
 return ret;
 
-read_chomp_line(in, line, sizeof(line));
+ff_get_chomp_line(in, line, sizeof(line));
 if (strcmp(line, "#EXTM3U")) {
 ret = AVERROR_INVALIDDATA;
 goto fail;
@@ -1080,7 +1072,7 @@ static int parse_playlist(AVFormatContext *s, const char 
*url, VariantStream *vs
 
 vs->discontinuity = 0;
 while (!avio_feof(in)) {
-read_chomp_line(in, line, sizeof(line));
+ff_get_chomp_line(in, line, sizeof(line));
 if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
 int64_t tmp_sequence = strtoll(ptr, NULL, 10);
 if (tmp_sequence < vs->sequence)

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


[FFmpeg-cvslog] lavf/hls: use ff_get_chomp_line

2018-04-12 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Apr  9 23:11:02 
2018 +0800| [0e49118271ce0a3e8911200824032508b5a7de16] | committer: Jun Zhao

lavf/hls: use ff_get_chomp_line

Signed-off-by: Jun Zhao 

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

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

diff --git a/libavformat/hls.c b/libavformat/hls.c
index ae0545a086..1257cd101c 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -216,14 +216,6 @@ typedef struct HLSContext {
 AVIOContext *playlist_pb;
 } HLSContext;
 
-static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
-{
-int len = ff_get_line(s, buf, maxlen);
-while (len > 0 && av_isspace(buf[len - 1]))
-buf[--len] = '\0';
-return len;
-}
-
 static void free_segment_list(struct playlist *pls)
 {
 int i;
@@ -770,7 +762,7 @@ static int parse_playlist(HLSContext *c, const char *url,
 if (av_opt_get(in, "location", AV_OPT_SEARCH_CHILDREN, &new_url) >= 0)
 url = new_url;
 
-read_chomp_line(in, line, sizeof(line));
+ff_get_chomp_line(in, line, sizeof(line));
 if (strcmp(line, "#EXTM3U")) {
 ret = AVERROR_INVALIDDATA;
 goto fail;
@@ -782,7 +774,7 @@ static int parse_playlist(HLSContext *c, const char *url,
 pls->type = PLS_TYPE_UNSPECIFIED;
 }
 while (!avio_feof(in)) {
-read_chomp_line(in, line, sizeof(line));
+ff_get_chomp_line(in, line, sizeof(line));
 if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
 is_variant = 1;
 memset(&variant_info, 0, sizeof(variant_info));

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


[FFmpeg-cvslog] doc/examples/filtering_video: Remove setting deprecated refcounted_frames

2018-04-22 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sat Apr 21 15:34:23 
2018 +0800| [0c28a5cf0fc642825036c07c2b57b79c42583b27] | committer: Jun Zhao

doc/examples/filtering_video: Remove setting deprecated refcounted_frames

When use new decode APIs(avcodec_send_packet/avcodec_receive_frame),
don't need to setting the deprecated field refcounted_frames.

Reviewed-by: wm4 
Signed-off-by: Jun Zhao 

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

 doc/examples/filtering_video.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/doc/examples/filtering_video.c b/doc/examples/filtering_video.c
index ed4e7bbd81..38ff9bb7db 100644
--- a/doc/examples/filtering_video.c
+++ b/doc/examples/filtering_video.c
@@ -77,7 +77,6 @@ static int open_input_file(const char *filename)
 if (!dec_ctx)
 return AVERROR(ENOMEM);
 avcodec_parameters_to_context(dec_ctx, 
fmt_ctx->streams[video_stream_index]->codecpar);
-av_opt_set_int(dec_ctx, "refcounted_frames", 1, 0);
 
 /* init the video decoder */
 if ((ret = avcodec_open2(dec_ctx, dec, NULL)) < 0) {

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


[FFmpeg-cvslog] doc/examples/hw_decode: Remove setting deprecated refcounted_frames

2018-04-22 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sat Apr 21 15:28:27 
2018 +0800| [c6d8492cffc43cdd658e05474241fbce045a9167] | committer: Jun Zhao

doc/examples/hw_decode: Remove setting deprecated refcounted_frames

When use new decode APIs(avcodec_send_packet/avcodec_receive_frame),
don't need to setting the deprecated field refcounted_frames.

Reviewed-by: wm4 
Signed-off-by: Jun Zhao 

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

 doc/examples/hw_decode.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/doc/examples/hw_decode.c b/doc/examples/hw_decode.c
index 77ae8df35b..4a4e7fc8ac 100644
--- a/doc/examples/hw_decode.c
+++ b/doc/examples/hw_decode.c
@@ -211,7 +211,6 @@ int main(int argc, char *argv[])
 return -1;
 
 decoder_ctx->get_format  = get_hw_format;
-av_opt_set_int(decoder_ctx, "refcounted_frames", 1, 0);
 
 if (hw_decoder_init(decoder_ctx, type) < 0)
 return -1;

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


[FFmpeg-cvslog] doc/examples/hw_decode: Remove setting deprecated refcounted_frames

2018-04-22 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sat Apr 21 15:28:27 
2018 +0800| [c6d8492cffc43cdd658e05474241fbce045a9167] | committer: Jun Zhao

doc/examples/hw_decode: Remove setting deprecated refcounted_frames

When use new decode APIs(avcodec_send_packet/avcodec_receive_frame),
don't need to setting the deprecated field refcounted_frames.

Reviewed-by: wm4 
Signed-off-by: Jun Zhao 

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

 doc/examples/hw_decode.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/doc/examples/hw_decode.c b/doc/examples/hw_decode.c
index 77ae8df35b..4a4e7fc8ac 100644
--- a/doc/examples/hw_decode.c
+++ b/doc/examples/hw_decode.c
@@ -211,7 +211,6 @@ int main(int argc, char *argv[])
 return -1;
 
 decoder_ctx->get_format  = get_hw_format;
-av_opt_set_int(decoder_ctx, "refcounted_frames", 1, 0);
 
 if (hw_decoder_init(decoder_ctx, type) < 0)
 return -1;

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


[FFmpeg-cvslog] doc/examples/filtering_audio: Remove setting deprecated refcounted_frames

2018-04-22 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sat Apr 21 15:36:59 
2018 +0800| [f97fa89925a5d4df7deb8ed49262d497f07e1b0a] | committer: Jun Zhao

doc/examples/filtering_audio: Remove setting deprecated refcounted_frames

When use new decode APIs(avcodec_send_packet/avcodec_receive_frame),
don't need to setting the deprecated field refcounted_frames.

Reviewed-by: wm4 
Signed-off-by: Jun Zhao 

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

 doc/examples/filtering_audio.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/doc/examples/filtering_audio.c b/doc/examples/filtering_audio.c
index b109dbcb96..834b137cd9 100644
--- a/doc/examples/filtering_audio.c
+++ b/doc/examples/filtering_audio.c
@@ -74,7 +74,6 @@ static int open_input_file(const char *filename)
 if (!dec_ctx)
 return AVERROR(ENOMEM);
 avcodec_parameters_to_context(dec_ctx, 
fmt_ctx->streams[audio_stream_index]->codecpar);
-av_opt_set_int(dec_ctx, "refcounted_frames", 1, 0);
 
 /* init the audio decoder */
 if ((ret = avcodec_open2(dec_ctx, dec, NULL)) < 0) {

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


[FFmpeg-cvslog] doc/examples/filtering_video: Remove setting deprecated refcounted_frames

2018-04-22 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sat Apr 21 15:34:23 
2018 +0800| [0c28a5cf0fc642825036c07c2b57b79c42583b27] | committer: Jun Zhao

doc/examples/filtering_video: Remove setting deprecated refcounted_frames

When use new decode APIs(avcodec_send_packet/avcodec_receive_frame),
don't need to setting the deprecated field refcounted_frames.

Reviewed-by: wm4 
Signed-off-by: Jun Zhao 

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

 doc/examples/filtering_video.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/doc/examples/filtering_video.c b/doc/examples/filtering_video.c
index ed4e7bbd81..38ff9bb7db 100644
--- a/doc/examples/filtering_video.c
+++ b/doc/examples/filtering_video.c
@@ -77,7 +77,6 @@ static int open_input_file(const char *filename)
 if (!dec_ctx)
 return AVERROR(ENOMEM);
 avcodec_parameters_to_context(dec_ctx, 
fmt_ctx->streams[video_stream_index]->codecpar);
-av_opt_set_int(dec_ctx, "refcounted_frames", 1, 0);
 
 /* init the video decoder */
 if ((ret = avcodec_open2(dec_ctx, dec, NULL)) < 0) {

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


[FFmpeg-cvslog] doc/examples/filtering_audio: Remove setting deprecated refcounted_frames

2018-04-22 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sat Apr 21 15:36:59 
2018 +0800| [f97fa89925a5d4df7deb8ed49262d497f07e1b0a] | committer: Jun Zhao

doc/examples/filtering_audio: Remove setting deprecated refcounted_frames

When use new decode APIs(avcodec_send_packet/avcodec_receive_frame),
don't need to setting the deprecated field refcounted_frames.

Reviewed-by: wm4 
Signed-off-by: Jun Zhao 

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

 doc/examples/filtering_audio.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/doc/examples/filtering_audio.c b/doc/examples/filtering_audio.c
index b109dbcb96..834b137cd9 100644
--- a/doc/examples/filtering_audio.c
+++ b/doc/examples/filtering_audio.c
@@ -74,7 +74,6 @@ static int open_input_file(const char *filename)
 if (!dec_ctx)
 return AVERROR(ENOMEM);
 avcodec_parameters_to_context(dec_ctx, 
fmt_ctx->streams[audio_stream_index]->codecpar);
-av_opt_set_int(dec_ctx, "refcounted_frames", 1, 0);
 
 /* init the audio decoder */
 if ((ret = avcodec_open2(dec_ctx, dec, NULL)) < 0) {

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


[FFmpeg-cvslog] lavf/format: Remove the dead code in av_probe_input_buffer2.

2018-05-06 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sun Apr  8 08:09:13 
2018 +0800| [053ee996a03b8744af6e12d39e3087efae218b64] | committer: Jun Zhao

lavf/format: Remove the dead code in av_probe_input_buffer2.

Remove the dead code in av_probe_input_buffer2

Signed-off-by: Jun Zhao 

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

 libavformat/format.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/libavformat/format.c b/libavformat/format.c
index 1c66afb7e6..2c4c895530 100644
--- a/libavformat/format.c
+++ b/libavformat/format.c
@@ -250,14 +250,6 @@ int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat 
**fmt,
 *semi = '\0';
 }
 }
-#if 0
-if (!*fmt && pb->av_class && av_opt_get(pb, "mime_type", 
AV_OPT_SEARCH_CHILDREN, &mime_type) >= 0 && mime_type) {
-if (!av_strcasecmp(mime_type, "audio/aacp")) {
-*fmt = av_find_input_format("aac");
-}
-av_freep(&mime_type);
-}
-#endif
 
 for (probe_size = PROBE_BUF_MIN; probe_size <= max_probe_size && !*fmt;
  probe_size = FFMIN(probe_size << 1,

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


[FFmpeg-cvslog] avformat/avio: make the logic simple

2018-05-06 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sun Apr  8 08:05:08 
2018 +0800| [4d3e9e31356b4d7d4196f271e19679ea65e51223] | committer: Jun Zhao

avformat/avio: make the logic simple

remove the "ret" to make the code simple and generic.

Signed-off-by: Jun Zhao 

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

 libavformat/avio.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index 63e82872f7..663789ec02 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -663,8 +663,7 @@ int ffurl_shutdown(URLContext *h, int flags)
 
 int ff_check_interrupt(AVIOInterruptCB *cb)
 {
-int ret;
-if (cb && cb->callback && (ret = cb->callback(cb->opaque)))
-return ret;
+if (cb && cb->callback)
+return cb->callback(cb->opaque);
 return 0;
 }

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


[FFmpeg-cvslog] lavf/network: fix doxygen comments.

2018-05-10 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sun May  6 19:53:19 
2018 +0800| [1655e1096e539fd53a741dfb0a3cbda204c159ee] | committer: Jun Zhao

lavf/network: fix doxygen comments.

Signed-off-by: Jun Zhao 

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

 libavformat/network.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/network.h b/libavformat/network.h
index e3fda4d5e2..efaa7893a4 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -87,9 +87,9 @@ int ff_network_wait_fd(int fd, int write);
  * This works similarly to ff_network_wait_fd, but waits up to 'timeout' 
microseconds
  * Uses ff_network_wait_fd in a loop
  *
- * @fd Socket descriptor
- * @write Set 1 to wait for socket able to be read, 0 to be written
- * @timeout Timeout interval, in microseconds. Actual precision is 10 mcs, 
due to ff_network_wait_fd usage
+ * @param fd Socket descriptor
+ * @param write Set 1 to wait for socket able to be read, 0 to be written
+ * @param timeout Timeout interval, in microseconds. Actual precision is 
10 mcs, due to ff_network_wait_fd usage
  * @param int_cb Interrupt callback, is checked before each ff_network_wait_fd 
call
  * @return 0 if data can be read/written, AVERROR(ETIMEDOUT) if timeout 
expired, or negative error code
  */
@@ -98,7 +98,7 @@ int ff_network_wait_fd_timeout(int fd, int write, int64_t 
timeout, AVIOInterrupt
 /**
  * Waits for up to 'timeout' microseconds. If the usert's int_cb is set and
  * triggered, return before that.
- * @timeout Timeout in microseconds. Maybe have lower actual precision.
+ * @param timeout Timeout in microseconds. Maybe have lower actual precision.
  * @param int_cb Interrupt callback, is checked regularly.
  * @return AVERROR(ETIMEDOUT) if timeout expirted, AVERROR_EXIT if interrupted 
by int_cb
  */

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


[FFmpeg-cvslog] lavfi/tests/filtfmts: fix the build warning.

2018-05-10 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sun May  6 09:33:28 
2018 +0800| [74a7ddd985c487b6645470174228ae2d734e6924] | committer: Jun Zhao

lavfi/tests/filtfmts: fix the build warning.

fix the build warning: ignoring return value.

Signed-off-by: Jun Zhao 

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

 libavfilter/tests/filtfmts.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/tests/filtfmts.c b/libavfilter/tests/filtfmts.c
index a958621f1c..317df86c55 100644
--- a/libavfilter/tests/filtfmts.c
+++ b/libavfilter/tests/filtfmts.c
@@ -138,9 +138,9 @@ int main(int argc, char **argv)
 }
 
 if (filter->query_formats)
-filter->query_formats(filter_ctx);
+ret = filter->query_formats(filter_ctx);
 else
-ff_default_query_formats(filter_ctx);
+ret = ff_default_query_formats(filter_ctx);
 
 print_formats(filter_ctx);
 

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


[FFmpeg-cvslog] checkasm/sw_rgb: fix the function declaration warning

2018-05-10 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sun May  6 09:33:27 
2018 +0800| [b30575bc982fd70799f63f2031640b9916f1648d] | committer: Jun Zhao

checkasm/sw_rgb: fix the function declaration warning

fix the warning: "function declaration isn’t a prototype", in C
int foo() and int foo(void) are different functions. int foo()
accepts an arbitrary number of arguments, while int foo(void) accepts 0
arguments.

Signed-off-by: Jun Zhao 

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

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

diff --git a/tests/checkasm/sw_rgb.c b/tests/checkasm/sw_rgb.c
index d2b211f7b4..000420d8f7 100644
--- a/tests/checkasm/sw_rgb.c
+++ b/tests/checkasm/sw_rgb.c
@@ -68,7 +68,7 @@ static void check_shuffle_bytes(void * func, const char * 
report)
 }
 }
 
-static void check_uyvy_to_422p()
+static void check_uyvy_to_422p(void)
 {
 int i;
 

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


[FFmpeg-cvslog] lavc/h2645_parse: rename the nal_unit_name to hevc_nal_unit_name.

2018-05-16 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon May 14 14:49:56 
2018 +0800| [7582a907e40ef1012e40a9b17aead05a6777b0ca] | committer: Jun Zhao

lavc/h2645_parse: rename the nal_unit_name to hevc_nal_unit_name.

Rename the nal_unit_name to hevc_nal_unit_name, will add a
h264_nal_unit_name function.

Signed-off-by: Jun Zhao 

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

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

diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c
index 53ba3e3582..99c2245021 100644
--- a/libavcodec/h2645_parse.c
+++ b/libavcodec/h2645_parse.c
@@ -212,7 +212,7 @@ static const char *hevc_nal_type_name[64] = {
 "UNSPEC63", // HEVC_NAL_UNSPEC63
 };
 
-static const char *nal_unit_name(int nal_type)
+static const char *hevc_nal_unit_name(int nal_type)
 {
 av_assert0(nal_type >= 0 && nal_type < 64);
 return hevc_nal_type_name[nal_type];
@@ -264,7 +264,7 @@ static int hevc_parse_nal_header(H2645NAL *nal, void 
*logctx)
 
 av_log(logctx, AV_LOG_DEBUG,
"nal_unit_type: %d(%s), nuh_layer_id: %d, temporal_id: %d\n",
-   nal->type, nal_unit_name(nal->type), nuh_layer_id, 
nal->temporal_id);
+   nal->type, hevc_nal_unit_name(nal->type), nuh_layer_id, 
nal->temporal_id);
 
 return nuh_layer_id == 0;
 }

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


[FFmpeg-cvslog] lavc/h2645_parse: add h264_nal_unit_name for h264 NAL type.

2018-05-16 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Fri May 11 10:28:32 
2018 +0800| [b7cd2ab22e217e7125a0bb4c3b30bcbe1bd7bd9d] | committer: Jun Zhao

lavc/h2645_parse: add h264_nal_unit_name for h264 NAL type.

Signed-off-by: Jun Zhao 

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

 libavcodec/h264.h| 23 ++-
 libavcodec/h2645_parse.c | 46 --
 2 files changed, 66 insertions(+), 3 deletions(-)

diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 650580bf3a..7a1fb6d687 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -26,8 +26,12 @@
 
 #define QP_MAX_NUM (51 + 6*6)   // The maximum supported qp
 
-/* NAL unit types */
+/*
+ * Table 7-1 – NAL unit type codes, syntax element categories, and NAL unit 
type classes in
+ * T-REC-H.264-201704
+ */
 enum {
+H264_NAL_UNSPECIFIED = 0,
 H264_NAL_SLICE   = 1,
 H264_NAL_DPA = 2,
 H264_NAL_DPB = 3,
@@ -41,7 +45,24 @@ enum {
 H264_NAL_END_STREAM  = 11,
 H264_NAL_FILLER_DATA = 12,
 H264_NAL_SPS_EXT = 13,
+H264_NAL_PREFIX  = 14,
+H264_NAL_SUB_SPS = 15,
+H264_NAL_DPS = 16,
+H264_NAL_RESERVED17  = 17,
+H264_NAL_RESERVED18  = 18,
 H264_NAL_AUXILIARY_SLICE = 19,
+H264_NAL_EXTEN_SLICE = 20,
+H264_NAL_DEPTH_EXTEN_SLICE = 21,
+H264_NAL_RESERVED22  = 22,
+H264_NAL_RESERVED23  = 23,
+H264_NAL_UNSPECIFIED24   = 24,
+H264_NAL_UNSPECIFIED25   = 25,
+H264_NAL_UNSPECIFIED26   = 26,
+H264_NAL_UNSPECIFIED27   = 27,
+H264_NAL_UNSPECIFIED28   = 28,
+H264_NAL_UNSPECIFIED29   = 29,
+H264_NAL_UNSPECIFIED30   = 30,
+H264_NAL_UNSPECIFIED31   = 31,
 };
 
 
diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c
index 99c2245021..aaa4b8f443 100644
--- a/libavcodec/h2645_parse.c
+++ b/libavcodec/h2645_parse.c
@@ -28,6 +28,7 @@
 
 #include "bytestream.h"
 #include "hevc.h"
+#include "h264.h"
 #include "h2645_parse.h"
 
 int ff_h2645_extract_rbsp(const uint8_t *src, int length,
@@ -218,6 +219,47 @@ static const char *hevc_nal_unit_name(int nal_type)
 return hevc_nal_type_name[nal_type];
 }
 
+static const char *h264_nal_type_name[32] = {
+"Unspecified 0", //H264_NAL_UNSPECIFIED
+"Coded slice of a non-IDR picture", // H264_NAL_SLICE
+"Coded slice data partition A", // H264_NAL_DPA
+"Coded slice data partition B", // H264_NAL_DPB
+"Coded slice data partition C", // H264_NAL_DPC
+"IDR", // H264_NAL_IDR_SLICE
+"SEI", // H264_NAL_SEI
+"SPS", // H264_NAL_SPS
+"PPS", // H264_NAL_PPS
+"AUD", // H264_NAL_AUD
+"End of sequence", // H264_NAL_END_SEQUENCE
+"End of stream", // H264_NAL_END_STREAM
+"Filler data", // H264_NAL_FILLER_DATA
+"SPS extension", // H264_NAL_SPS_EXT
+"Prefix", // H264_NAL_PREFIX
+"Subset SPS", // H264_NAL_SUB_SPS
+"Depth parameter set", // H264_NAL_DPS
+"Reserved 17", // H264_NAL_RESERVED17
+"Reserved 18", // H264_NAL_RESERVED18
+"Auxiliary coded picture without partitioning", // H264_NAL_AUXILIARY_SLICE
+"Slice extension", // H264_NAL_EXTEN_SLICE
+"Slice extension for a depth view or a 3D-AVC texture view", // 
H264_NAL_DEPTH_EXTEN_SLICE
+"Reserved 22", // H264_NAL_RESERVED22
+"Reserved 23", // H264_NAL_RESERVED23
+"Unspecified 24", // H264_NAL_UNSPECIFIED24
+"Unspecified 25", // H264_NAL_UNSPECIFIED25
+"Unspecified 26", // H264_NAL_UNSPECIFIED26
+"Unspecified 27", // H264_NAL_UNSPECIFIED27
+"Unspecified 28", // H264_NAL_UNSPECIFIED28
+"Unspecified 29", // H264_NAL_UNSPECIFIED29
+"Unspecified 30", // H264_NAL_UNSPECIFIED30
+"Unspecified 31", // H264_NAL_UNSPECIFIED31
+};
+
+static const char *h264_nal_unit_name(int nal_type)
+{
+av_assert0(nal_type >= 0 && nal_type < 32);
+return h264_nal_type_name[nal_type];
+}
+
 static int get_bit_length(H2645NAL *nal, int skip_trailing_zeros)
 {
 int size = nal->size;
@@ -280,8 +322,8 @@ static int h264_parse_nal_header(H2645NAL *nal, void 
*logctx)
 nal->type= get_bits(gb, 5);
 
 av_log(logctx, AV_LOG_DEBUG,
-   "nal_unit_type: %d, nal_ref_idc: %d\n",
-   nal->type, nal->ref_idc);
+   "nal_unit_type: %d(%s), nal_ref_idc: %d\n",
+   nal->type, h264_nal_unit_name(nal->type), nal->ref_idc);
 
 return 1;
 }

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


[FFmpeg-cvslog] lavc/h2645_parse: log more HEVC NAL type.

2018-05-16 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Fri May 11 10:02:27 
2018 +0800| [48c5ac8b0f6648099d8cf684658ca807db8dca86] | committer: Jun Zhao

lavc/h2645_parse: log more HEVC NAL type.

Signed-off-by: Jun Zhao 

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

 libavcodec/h2645_parse.c | 97 ++--
 libavcodec/hevc.h| 26 -
 2 files changed, 94 insertions(+), 29 deletions(-)

diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c
index d436d65f48..53ba3e3582 100644
--- a/libavcodec/h2645_parse.c
+++ b/libavcodec/h2645_parse.c
@@ -145,36 +145,77 @@ nsc:
 return si;
 }
 
+static const char *hevc_nal_type_name[64] = {
+"TRAIL_N", // HEVC_NAL_TRAIL_N
+"TRAIL_R", // HEVC_NAL_TRAIL_R
+"TSA_N", // HEVC_NAL_TSA_N
+"TSA_R", // HEVC_NAL_TSA_R
+"STSA_N", // HEVC_NAL_STSA_N
+"STSA_R", // HEVC_NAL_STSA_R
+"RADL_N", // HEVC_NAL_RADL_N
+"RADL_R", // HEVC_NAL_RADL_R
+"RASL_N", // HEVC_NAL_RASL_N
+"RASL_R", // HEVC_NAL_RASL_R
+"RSV_VCL_N10", // HEVC_NAL_VCL_N10
+"RSV_VCL_R11", // HEVC_NAL_VCL_R11
+"RSV_VCL_N12", // HEVC_NAL_VCL_N12
+"RSV_VLC_R13", // HEVC_NAL_VCL_R13
+"RSV_VCL_N14", // HEVC_NAL_VCL_N14
+"RSV_VCL_R15", // HEVC_NAL_VCL_R15
+"BLA_W_LP", // HEVC_NAL_BLA_W_LP
+"BLA_W_RADL", // HEVC_NAL_BLA_W_RADL
+"BLA_N_LP", // HEVC_NAL_BLA_N_LP
+"IDR_W_RADL", // HEVC_NAL_IDR_W_RADL
+"IDR_N_LP", // HEVC_NAL_IDR_N_LP
+"CRA_NUT", // HEVC_NAL_CRA_NUT
+"IRAP_IRAP_VCL22", // HEVC_NAL_IRAP_VCL22
+"IRAP_IRAP_VCL23", // HEVC_NAL_IRAP_VCL23
+"RSV_VCL24", // HEVC_NAL_RSV_VCL24
+"RSV_VCL25", // HEVC_NAL_RSV_VCL25
+"RSV_VCL26", // HEVC_NAL_RSV_VCL26
+"RSV_VCL27", // HEVC_NAL_RSV_VCL27
+"RSV_VCL28", // HEVC_NAL_RSV_VCL28
+"RSV_VCL29", // HEVC_NAL_RSV_VCL29
+"RSV_VCL30", // HEVC_NAL_RSV_VCL30
+"RSV_VCL31", // HEVC_NAL_RSV_VCL31
+"VPS", // HEVC_NAL_VPS
+"SPS", // HEVC_NAL_SPS
+"PPS", // HEVC_NAL_PPS
+"AUD", // HEVC_NAL_AUD
+"EOS_NUT", // HEVC_NAL_EOS_NUT
+"EOB_NUT", // HEVC_NAL_EOB_NUT
+"FD_NUT", // HEVC_NAL_FD_NUT
+"SEI_PREFIX", // HEVC_NAL_SEI_PREFIX
+"SEI_SUFFIX", // HEVC_NAL_SEI_SUFFIX
+"RSV_NVCL41", // HEVC_NAL_RSV_NVCL41
+"RSV_NVCL42", // HEVC_NAL_RSV_NVCL42
+"RSV_NVCL43", // HEVC_NAL_RSV_NVCL43
+"RSV_NVCL44", // HEVC_NAL_RSV_NVCL44
+"RSV_NVCL45", // HEVC_NAL_RSV_NVCL45
+"RSV_NVCL46", // HEVC_NAL_RSV_NVCL46
+"RSV_NVCL47", // HEVC_NAL_RSV_NVCL47
+"UNSPEC48", // HEVC_NAL_UNSPEC48
+"UNSPEC49", // HEVC_NAL_UNSPEC49
+"UNSPEC50", // HEVC_NAL_UNSPEC50
+"UNSPEC51", // HEVC_NAL_UNSPEC51
+"UNSPEC52", // HEVC_NAL_UNSPEC52
+"UNSPEC53", // HEVC_NAL_UNSPEC53
+"UNSPEC54", // HEVC_NAL_UNSPEC54
+"UNSPEC55", // HEVC_NAL_UNSPEC55
+"UNSPEC56", // HEVC_NAL_UNSPEC56
+"UNSPEC57", // HEVC_NAL_UNSPEC57
+"UNSPEC58", // HEVC_NAL_UNSPEC58
+"UNSPEC59", // HEVC_NAL_UNSPEC59
+"UNSPEC60", // HEVC_NAL_UNSPEC60
+"UNSPEC61", // HEVC_NAL_UNSPEC61
+"UNSPEC62", // HEVC_NAL_UNSPEC62
+"UNSPEC63", // HEVC_NAL_UNSPEC63
+};
+
 static const char *nal_unit_name(int nal_type)
 {
-switch(nal_type) {
-case HEVC_NAL_TRAIL_N: return "TRAIL_N";
-case HEVC_NAL_TRAIL_R: return "TRAIL_R";
-case HEVC_NAL_TSA_N  : return "TSA_N";
-case HEVC_NAL_TSA_R  : return "TSA_R";
-case HEVC_NAL_STSA_N : return "STSA_N";
-case HEVC_NAL_STSA_R : return "STSA_R";
-case HEVC_NAL_RADL_N : return "RADL_N";
-case HEVC_NAL_RADL_R : return "RADL_R";
-case HEVC_NAL_RASL_N : return "RASL_N";
-case HEVC_NAL_RASL_R : return "RASL_R";
-case HEVC_NAL_BLA_W_LP   : return "BLA_W_LP";
-case HEVC_NAL_BLA_W_RADL : return "BLA_W_RADL";
-case HEVC_NAL_BLA_N_LP   : return "BLA_N_LP";
-case HEVC_NAL_IDR_W_RADL : return "IDR_W_RADL";
-case HEVC_NAL_IDR_N_LP   : return "IDR_N_LP";
-case HEVC_NAL_CRA_NUT: return "CRA_NUT";
-case HEVC_NAL_VPS: return "VPS";
-case HEVC_NAL_SPS: return "SPS";
-case HEVC_NAL_P

[FFmpeg-cvslog] cmdutils: dump supported hardware devices in print_codec()

2018-05-28 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sat May 26 20:57:45 
2018 +0800| [81b77e7bf16a754005a2af7e5cf35e2eefc91a39] | committer: Jun Zhao

cmdutils: dump supported hardware devices in print_codec()

dump the supported hardware devices for codec when use the command
like ./ffmpeg -h decoder=h264.

Signed-off-by: Jun Zhao 

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

 fftools/cmdutils.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 70234b8923..844f43359c 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1444,6 +1444,17 @@ static void print_codec(const AVCodec *c)
 printf("\n");
 }
 
+if (avcodec_get_hw_config(c, 0)) {
+printf("Supported hardware devices: ");
+for (int i = 0;; i++) {
+const AVCodecHWConfig *config = avcodec_get_hw_config(c, i);
+if (!config)
+break;
+printf("%s ", av_hwdevice_get_type_name(config->device_type));
+}
+printf("\n");
+}
+
 if (c->supported_framerates) {
 const AVRational *fps = c->supported_framerates;
 

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


[FFmpeg-cvslog] cmdutils: print missing caps in print_codec().

2018-05-28 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Fri May 25 14:57:48 
2018 +0800| [90acf168a6e29713f7d1d24f3f39f1c3207a2915] | committer: Jun Zhao

cmdutils: print missing caps in print_codec().

print full caps type in print_codec().

Signed-off-by: Jun Zhao 

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

 fftools/cmdutils.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 8ffc9d240b..70234b8923 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1414,6 +1414,16 @@ static void print_codec(const AVCodec *c)
AV_CODEC_CAP_SLICE_THREADS |
AV_CODEC_CAP_AUTO_THREADS))
 printf("threads ");
+if (c->capabilities & AV_CODEC_CAP_AVOID_PROBING)
+printf("avoidprobe ");
+if (c->capabilities & AV_CODEC_CAP_INTRA_ONLY)
+printf("intraonly ");
+if (c->capabilities & AV_CODEC_CAP_LOSSLESS)
+printf("lossless ");
+if (c->capabilities & AV_CODEC_CAP_HARDWARE)
+printf("hardware ");
+if (c->capabilities & AV_CODEC_CAP_HYBRID)
+printf("hybrid ");
 if (!c->capabilities)
 printf("none");
 printf("\n");

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


[FFmpeg-cvslog] lavfi/opencl: remove redundant header.

2018-06-07 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed May 30 08:54:45 
2018 +0800| [3161df5b0c2dfa31b9c19ba13b4c943773cf57a5] | committer: Jun Zhao

lavfi/opencl: remove redundant header.

remove redundant header

Signed-off-by: Jun Zhao 

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

 libavfilter/opencl.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavfilter/opencl.c b/libavfilter/opencl.c
index ae61667380..ac5eec68c6 100644
--- a/libavfilter/opencl.c
+++ b/libavfilter/opencl.c
@@ -19,12 +19,9 @@
 #include 
 #include 
 
-#include "libavutil/hwcontext.h"
-#include "libavutil/hwcontext_opencl.h"
 #include "libavutil/mem.h"
 #include "libavutil/pixdesc.h"
 
-#include "avfilter.h"
 #include "formats.h"
 #include "opencl.h"
 

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


[FFmpeg-cvslog] lavu/hwcontext_opecl: fix the build warning

2018-06-07 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Wed May 30 08:13:13 
2018 +0800| [3bab7b70da9705031bfc23d9fd15dc49af967055] | committer: Jun Zhao

lavu/hwcontext_opecl: fix the build warning

fix the build warning when use Portable Computing Language (pocl).

Signed-off-by: Jun Zhao 

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

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

diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index e08d7bcb9b..07458c2fb1 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -2810,7 +2810,7 @@ static int opencl_map_from(AVHWFramesContext *hwfc, 
AVFrame *dst,
 static int opencl_map_to(AVHWFramesContext *hwfc, AVFrame *dst,
  const AVFrame *src, int flags)
 {
-OpenCLDeviceContext *priv = hwfc->device_ctx->internal->priv;
+av_unused OpenCLDeviceContext *priv = hwfc->device_ctx->internal->priv;
 av_assert0(dst->format == AV_PIX_FMT_OPENCL);
 switch (src->format) {
 #if HAVE_OPENCL_DRM_BEIGNET
@@ -2851,7 +2851,7 @@ static int opencl_map_to(AVHWFramesContext *hwfc, AVFrame 
*dst,
 static int opencl_frames_derive_to(AVHWFramesContext *dst_fc,
AVHWFramesContext *src_fc, int flags)
 {
-OpenCLDeviceContext *priv = dst_fc->device_ctx->internal->priv;
+av_unused OpenCLDeviceContext *priv = dst_fc->device_ctx->internal->priv;
 switch (src_fc->device_ctx->type) {
 #if HAVE_OPENCL_DRM_BEIGNET
 case AV_HWDEVICE_TYPE_DRM:

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


[FFmpeg-cvslog] configure: fix check for opencl

2018-06-07 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sat Jun  2 11:02:38 
2018 +0800| [3769aafb7c9a1fdcd1c9099a8ed7ba1d876c0693] | committer: Jun Zhao

configure: fix check for opencl

add pkg-config support for opencl check.

Signed-off-by: Jun Zhao 

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

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

diff --git a/configure b/configure
index 625cfef2ff..473be31d7f 100755
--- a/configure
+++ b/configure
@@ -6135,7 +6135,8 @@ enabled openal&& { { for al_extralibs in 
"${OPENAL_LIBS}" "-lopenal"
die "ERROR: openal not found"; } &&
  { test_cpp_condition "AL/al.h" 
"defined(AL_VERSION_1_1)" ||
die "ERROR: openal must be installed and 
version must be 1.1 or compatible"; }
-enabled opencl&& { check_lib opencl OpenCL/cl.h 
clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
+enabled opencl&& { check_pkg_config opencl OpenCL CL/cl.h 
clEnqueueNDRangeKernel ||
+   check_lib opencl OpenCL/cl.h 
clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
check_lib opencl CL/cl.h clEnqueueNDRangeKernel 
-lOpenCL ||
die "ERROR: opencl not found"; } &&
  { test_cpp_condition "OpenCL/cl.h" 
"defined(CL_VERSION_1_2)" ||

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


[FFmpeg-cvslog] lavc/dolby_e: fix make checkheaders warning

2018-06-09 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Jun  4 21:32:37 
2018 +0800| [4030d3d3f4951c3df63e8231df90621eb75bb832] | committer: Jun Zhao

lavc/dolby_e: fix make checkheaders warning

move the the function init_tables() definitions from header file
to .c file to fix make checkheaders warning.

Signed-off-by: Jun Zhao 

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

 libavcodec/dolby_e.c | 87 
 libavcodec/dolby_e.h | 86 ---
 2 files changed, 87 insertions(+), 86 deletions(-)

diff --git a/libavcodec/dolby_e.c b/libavcodec/dolby_e.c
index 91a00ce878..429612ec08 100644
--- a/libavcodec/dolby_e.c
+++ b/libavcodec/dolby_e.c
@@ -681,6 +681,93 @@ static av_cold int dolby_e_close(AVCodecContext *avctx)
 return 0;
 }
 
+
+static av_cold void init_tables(void)
+{
+int i, j;
+
+for (i = 1; i < 17; i++)
+mantissa_tab1[i][0] = 1.0f / (1 << i - 1);
+
+for (i = 2; i < 16; i++) {
+mantissa_tab1[i][1] = 1.0f  / ((1 << i) - 1);
+mantissa_tab1[i][2] = 0.5f  / ((1 << i) - 1);
+mantissa_tab1[i][3] = 0.25f / ((1 << i) - 1);
+}
+
+mantissa_tab1[i][1] = 0.5f   / (1 << 15);
+mantissa_tab1[i][2] = 0.75f  / (1 << 15);
+mantissa_tab1[i][3] = 0.875f / (1 << 15);
+
+for (i = 1; i < 17; i++) {
+mantissa_tab2[i][1] = mantissa_tab1[i][0] * 0.5f;
+mantissa_tab2[i][2] = mantissa_tab1[i][0] * 0.75f;
+mantissa_tab2[i][3] = mantissa_tab1[i][0] * 0.875f;
+for (j = 1; j < 4; j++)
+mantissa_tab3[i][j] = 1.0f / (1 << i) + 1.0f / (1 << j) - 1.0f / 
(1 << i + j);
+}
+
+mantissa_tab3[1][3] = 0.6875f;
+
+for (i = 0; i < 25; i++) {
+exponent_tab[i * 2] = 1.0f  / (1 << i);
+exponent_tab[i * 2 + 1] = M_SQRT1_2 / (1 << i);
+}
+
+for (i = 1; i < 1024; i++)
+gain_tab[i] = exp2f((i - 960) / 64.0f);
+
+// short 1
+ff_kbd_window_init(window, 3.0f, 128);
+for (i = 0; i < 128; i++)
+window[128 + i] = window[127 - i];
+
+// start
+for (i = 0; i < 192; i++)
+window[256 + i] = start_window[i];
+
+// short 2
+for (i = 0; i < 192; i++)
+window[448 + i] = short_window2[i];
+for (i = 0; i < 64; i++)
+window[640 + i] = window[63 - i];
+
+// short 3
+for (i = 0; i < 64; i++)
+window[704 + i] = short_window3[i];
+for (i = 0; i < 192; i++)
+window[768 + i] = window[64 + i];
+
+// bridge
+for (i = 0; i < 128; i++)
+window[960 + i] = window[i];
+for (i = 0; i < 64; i++)
+window[1088 + i] = 1.0f;
+
+// long
+ff_kbd_window_init(window + 1408, 3.0f, 256);
+for (i = 0; i < 640; i++)
+window[1664 + i] = 1.0f;
+for (i = 0; i < 256; i++)
+window[2304 + i] = window[1152 + i] = window[1663 - i];
+
+// reverse start
+for (i = 0; i < 192; i++)
+window[2560 + i] = window[447 - i];
+
+// reverse short 2
+for (i = 0; i < 256; i++)
+window[2752 + i] = window[703 - i];
+
+// reverse short 3
+for (i = 0; i < 256; i++)
+window[3008 + i] = window[959 - i];
+
+// reverse bridge
+for (i = 0; i < 448; i++)
+window[3264 + i] = window[1407 - i];
+}
+
 static av_cold int dolby_e_init(AVCodecContext *avctx)
 {
 static AVOnce init_once = AV_ONCE_INIT;
diff --git a/libavcodec/dolby_e.h b/libavcodec/dolby_e.h
index 0390233720..ae04bf699c 100644
--- a/libavcodec/dolby_e.h
+++ b/libavcodec/dolby_e.h
@@ -644,90 +644,4 @@ static float gain_tab[1024];
 
 DECLARE_ALIGNED(32, static float, window)[3712];
 
-static av_cold void init_tables(void)
-{
-int i, j;
-
-for (i = 1; i < 17; i++)
-mantissa_tab1[i][0] = 1.0f / (1 << i - 1);
-
-for (i = 2; i < 16; i++) {
-mantissa_tab1[i][1] = 1.0f  / ((1 << i) - 1);
-mantissa_tab1[i][2] = 0.5f  / ((1 << i) - 1);
-mantissa_tab1[i][3] = 0.25f / ((1 << i) - 1);
-}
-
-mantissa_tab1[i][1] = 0.5f   / (1 << 15);
-mantissa_tab1[i][2] = 0.75f  / (1 << 15);
-mantissa_tab1[i][3] = 0.875f / (1 << 15);
-
-for (i = 1; i < 17; i++) {
-mantissa_tab2[i][1] = mantissa_tab1[i][0] * 0.5f;
-mantissa_tab2[i][2] = mantissa_tab1[i][0] * 0.75f;
-mantissa_tab2[i][3] = mantissa_tab1[i][0] * 0.875f;
-for (j = 1; j < 4; j++)
-mantissa_tab3[i][j] = 1.0f / (1 << i) + 1.0f / (1 << j) - 1.0f / 
(1 << i + j);
-}
-
-mantissa_tab3[1][3] = 0.6875f;
-
-for (i = 0; i < 25; i++) {
-exponent_tab[i * 2] = 1.0f  / (1 << i);
-exponent_tab[i * 2 + 1] = M_SQRT1_2 / (1 << i);
-}
-
-for (i = 1; i < 1024; i++)
-   

[FFmpeg-cvslog] lavc/aacsbr: fix make checkheaders warning

2018-06-09 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Mon Jun  4 21:42:18 
2018 +0800| [12138402652f28649e63629ef76fba8b71561afb] | committer: Jun Zhao

lavc/aacsbr: fix make checkheaders warning

move the the function aacsbr_tableinit definition from header file
to .c file to fix make checkheaders warning.

Signed-off-by: Jun Zhao 

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

 libavcodec/aacsbr_tablegen_common.h | 12 
 libavcodec/aacsbr_template.c| 12 
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavcodec/aacsbr_tablegen_common.h 
b/libavcodec/aacsbr_tablegen_common.h
index 8c8f6effa1..8e0dd9e1fd 100644
--- a/libavcodec/aacsbr_tablegen_common.h
+++ b/libavcodec/aacsbr_tablegen_common.h
@@ -111,16 +111,4 @@ static DECLARE_ALIGNED(32, INTFLOAT, 
sbr_qmf_window_us)[640] = {
 Q31( 0.8537385600f),
 };
 
-static av_cold void aacsbr_tableinit(void)
-{
-int n;
-for (n = 1; n < 320; n++)
-sbr_qmf_window_us[320 + n] = sbr_qmf_window_us[320 - n];
-sbr_qmf_window_us[384] = -sbr_qmf_window_us[384];
-sbr_qmf_window_us[512] = -sbr_qmf_window_us[512];
-
-for (n = 0; n < 320; n++)
-sbr_qmf_window_ds[n] = sbr_qmf_window_us[2*n];
-}
-
 #endif /* AVCODEC_AACSBR_TABLEGEN_COMMON_H */
diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c
index 3fe78d5b62..821615f2ab 100644
--- a/libavcodec/aacsbr_template.c
+++ b/libavcodec/aacsbr_template.c
@@ -34,6 +34,18 @@
 
 #include "libavutil/qsort.h"
 
+static av_cold void aacsbr_tableinit(void)
+{
+int n;
+for (n = 1; n < 320; n++)
+sbr_qmf_window_us[320 + n] = sbr_qmf_window_us[320 - n];
+sbr_qmf_window_us[384] = -sbr_qmf_window_us[384];
+sbr_qmf_window_us[512] = -sbr_qmf_window_us[512];
+
+for (n = 0; n < 320; n++)
+sbr_qmf_window_ds[n] = sbr_qmf_window_us[2*n];
+}
+
 av_cold void AAC_RENAME(ff_aac_sbr_init)(void)
 {
 static const struct {

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


[FFmpeg-cvslog] fftools/ffmpeg: Replace the number by macro for bprint init

2018-06-16 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sun Jun 10 15:56:04 
2018 +0800| [24be912827f6586f75cbd023b041e9752d66e449] | committer: Jun Zhao

fftools/ffmpeg: Replace the number by macro for bprint init

Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao 

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

 fftools/ffmpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 50c2fa5d51..6dfab64bc7 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1689,7 +1689,7 @@ static void print_report(int is_last_report, int64_t 
timer_start, int64_t cur_ti
 
 vid = 0;
 av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC);
-av_bprint_init(&buf_script, 0, 1);
+av_bprint_init(&buf_script, 0, AV_BPRINT_SIZE_AUTOMATIC);
 for (i = 0; i < nb_output_streams; i++) {
 float q = -1;
 ost = output_streams[i];

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


[FFmpeg-cvslog] lavc/dvdsubenc: Replace the number by macro for bprint init

2018-06-16 Thread Jun Zhao
ffmpeg | branch: master | Jun Zhao  | Sun Jun 10 15:59:03 
2018 +0800| [d0a2ad241c914bd69bf33490a7310f0a917c9053] | committer: Jun Zhao

lavc/dvdsubenc: Replace the number by macro for bprint init

Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao 

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

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

diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c
index 26afdc666b..ff95ed2002 100644
--- a/libavcodec/dvdsubenc.c
+++ b/libavcodec/dvdsubenc.c
@@ -438,7 +438,7 @@ static int dvdsub_init(AVCodecContext *avctx)
 av_assert0(sizeof(dvdc->global_palette) == sizeof(default_palette));
 memcpy(dvdc->global_palette, default_palette, 
sizeof(dvdc->global_palette));
 
-av_bprint_init(&extradata, 0, 1);
+av_bprint_init(&extradata, 0, AV_BPRINT_SIZE_AUTOMATIC);
 if (avctx->width && avctx->height)
 av_bprintf(&extradata, "size: %dx%d\n", avctx->width, avctx->height);
 av_bprintf(&extradata, "palette:");

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


  1   2   3   4   >