[FFmpeg-cvslog] avcodec/vaapi: free slice_buffers when decoding failed
ffmpeg | branch: master | Linjie Fu | Wed Sep 19 10:01:23 2018 +0800| [0f9b298242ca2e1e2e4414967921463566f1dded] | committer: Mark Thompson avcodec/vaapi: free slice_buffers when decoding failed If vaEndPicture() failed in ff_vaapi_decode_issue(), free the pic->slice_buffers. Fixes the memory leak issue in ticket #7385 Signed-off-by: Linjie Fu Signed-off-by: Mark Thompson > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0f9b298242ca2e1e2e4414967921463566f1dded --- libavcodec/vaapi_decode.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index ece75c0815..69512e1d45 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -200,12 +200,8 @@ int ff_vaapi_decode_issue(AVCodecContext *avctx, AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS) ff_vaapi_decode_destroy_buffers(avctx, pic); -pic->nb_param_buffers = 0; -pic->nb_slices= 0; -pic->slices_allocated = 0; -av_freep(&pic->slice_buffers); - -return 0; +err = 0; +goto exit; fail_with_picture: vas = vaEndPicture(ctx->hwctx->display, ctx->va_context); @@ -216,6 +212,12 @@ fail_with_picture: fail: ff_vaapi_decode_destroy_buffers(avctx, pic); fail_at_end: +exit: +pic->nb_param_buffers = 0; +pic->nb_slices= 0; +pic->slices_allocated = 0; +av_freep(&pic->slice_buffers); + return err; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/qsvdec: flush buffered data before reinit
ffmpeg | branch: master | Linjie Fu | Tue Oct 16 09:36:13 2018 +0800| [87368884a52b09eef96190ff1654d56591ec7038] | committer: Zhong Li lavc/qsvdec: flush buffered data before reinit Flush the buffered data in libmfx before video param reinit in case the frames drop. Cache the first frame causing the reinit and decode zero-size pkt to flush the buffered pkt before reinit. After all the buffered pkts being flushed, resume to reinit and decode. Fix the issue in ticket #7399. [V2]: Move the definition of zero_pkt to where it is exactly used. Signed-off-by: Linjie Fu Signed-off-by: Zhong Li > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=87368884a52b09eef96190ff1654d56591ec7038 --- libavcodec/qsvdec.c | 12 libavcodec/qsvdec.h | 2 ++ libavcodec/qsvdec_h2645.c | 11 +++ libavcodec/qsvdec_other.c | 10 +++--- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index 22e7a46a85..6753e596a1 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -372,6 +372,8 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext *q, ++q->zero_consume_run; if (q->zero_consume_run > 1) ff_qsv_print_warning(avctx, ret, "A decode call did not consume any data"); +} else if (!*sync && bs.DataOffset) { +++q->buffered_count; } else { q->zero_consume_run = 0; } @@ -526,6 +528,16 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q, AV_PIX_FMT_NONE, AV_PIX_FMT_NONE }; enum AVPixelFormat qsv_format; +AVPacket zero_pkt = {0}; + +if (q->buffered_count) { +q->reinit_flag = 1; +/* decode zero-size pkt to flush the buffered pkt before reinit */ +q->buffered_count--; +return qsv_decode(avctx, q, frame, got_frame, &zero_pkt); +} + +q->reinit_flag = 0; qsv_format = ff_qsv_map_pixfmt(q->parser->format, &q->fourcc); if (qsv_format < 0) { diff --git a/libavcodec/qsvdec.h b/libavcodec/qsvdec.h index 5b7b03a48b..111536caba 100644 --- a/libavcodec/qsvdec.h +++ b/libavcodec/qsvdec.h @@ -53,6 +53,8 @@ typedef struct QSVContext { AVFifoBuffer *async_fifo; int zero_consume_run; +int buffered_count; +int reinit_flag; // the internal parser and codec context for parsing the data AVCodecParserContext *parser; diff --git a/libavcodec/qsvdec_h2645.c b/libavcodec/qsvdec_h2645.c index d9d2318d1a..b8a78aa81b 100644 --- a/libavcodec/qsvdec_h2645.c +++ b/libavcodec/qsvdec_h2645.c @@ -146,10 +146,11 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data, /* no more data */ if (av_fifo_size(s->packet_fifo) < sizeof(AVPacket)) return avpkt->size ? avpkt->size : ff_qsv_process_data(avctx, &s->qsv, frame, got_frame, avpkt); - -av_packet_unref(&s->buffer_pkt); - -av_fifo_generic_read(s->packet_fifo, &s->buffer_pkt, sizeof(s->buffer_pkt), NULL); +/* in progress of reinit, no read from fifo and keep the buffer_pkt */ +if (!s->qsv.reinit_flag) { +av_packet_unref(&s->buffer_pkt); +av_fifo_generic_read(s->packet_fifo, &s->buffer_pkt, sizeof(s->buffer_pkt), NULL); +} } ret = ff_qsv_process_data(avctx, &s->qsv, frame, got_frame, &s->buffer_pkt); @@ -159,6 +160,8 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data, av_packet_unref(&s->buffer_pkt); return ret; } +if (s->qsv.reinit_flag) +continue; s->buffer_pkt.size -= ret; s->buffer_pkt.data += ret; diff --git a/libavcodec/qsvdec_other.c b/libavcodec/qsvdec_other.c index 993c7a8e80..03251d2c85 100644 --- a/libavcodec/qsvdec_other.c +++ b/libavcodec/qsvdec_other.c @@ -132,9 +132,11 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data, /* no more data */ if (av_fifo_size(s->packet_fifo) < sizeof(AVPacket)) return avpkt->size ? avpkt->size : ff_qsv_process_data(avctx, &s->qsv, frame, got_frame, avpkt); - -av_packet_unref(&s->input_ref); -av_fifo_generic_read(s->packet_fifo, &s->input_ref, sizeof(s->input_ref), NULL); +/* in progress of reinit, no read from fifo and keep the buffer_pkt */ +if (!s->qsv.reinit_flag) { +av_packet_unref(&s->input_ref); +av_fifo_generic_read(s->packet_fifo, &s->input_ref, sizeof(s->input_ref), NULL); +} } ret = ff_qsv_process_data(avctx
[FFmpeg-cvslog] lavc/qsvdec: Add GPU-accelerated memory copy support
ffmpeg | branch: master | Linjie Fu | Tue Oct 8 21:41:02 2019 +0800| [5345965b3f088ad5acd5151bec421c97470675a4] | committer: Zhong Li lavc/qsvdec: Add GPU-accelerated memory copy support GPU copy enables or disables GPU accelerated copying between video and system memory. This may lead to a notable performance improvement. Memory must be sequent and aligned with 128x64. CMD: ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -c:v h264_qsv -gpu_copy on -i input.h264 -f null - or: ffmpeg -c:v h264_qsv -gpu_copy on -i input.h264 -f null - Signed-off-by: Linjie Fu Signed-off-by: ChaoX A Liu Signed-off-by: Zhong Li > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5345965b3f088ad5acd5151bec421c97470675a4 --- libavcodec/qsv.c | 31 +--- libavcodec/qsv_internal.h | 7 +++--- libavcodec/qsvdec.c | 60 +++ libavcodec/qsvdec.h | 2 ++ libavcodec/qsvdec_h2645.c | 10 libavcodec/qsvdec_other.c | 5 libavcodec/qsvenc.c | 8 --- 7 files changed, 104 insertions(+), 19 deletions(-) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 81fa4a82ef..b00e427435 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -412,15 +412,21 @@ static int ff_qsv_set_display_handle(AVCodecContext *avctx, QSVSession *qs) #endif //AVCODEC_QSV_LINUX_SESSION_HANDLE int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs, - const char *load_plugins) + const char *load_plugins, int gpu_copy) { -mfxIMPL impl = MFX_IMPL_AUTO_ANY; -mfxVersion ver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } }; +mfxIMPL impl = MFX_IMPL_AUTO_ANY; +mfxVersionver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } }; +mfxInitParam init_par = { MFX_IMPL_AUTO_ANY }; const char *desc; int ret; -ret = MFXInit(impl, &ver, &qs->session); +#if QSV_VERSION_ATLEAST(1, 16) +init_par.GPUCopy= gpu_copy; +#endif +init_par.Implementation = impl; +init_par.Version= ver; +ret = MFXInitEx(init_par, &qs->session); if (ret < 0) return ff_qsv_print_error(avctx, ret, "Error initializing an internal MFX session"); @@ -712,7 +718,8 @@ static mfxStatus qsv_frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) } int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession, - AVBufferRef *device_ref, const char *load_plugins) + AVBufferRef *device_ref, const char *load_plugins, + int gpu_copy) { static const mfxHandleType handle_types[] = { MFX_HANDLE_VA_DISPLAY, @@ -722,11 +729,12 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession, AVHWDeviceContext*device_ctx = (AVHWDeviceContext*)device_ref->data; AVQSVDeviceContext *device_hwctx = device_ctx->hwctx; mfxSessionparent_session = device_hwctx->session; +mfxInitParaminit_par = { MFX_IMPL_AUTO_ANY }; +mfxHDLhandle = NULL; mfxSessionsession; mfxVersionver; mfxIMPL impl; -mfxHDLhandle = NULL; mfxHandleType handle_type; mfxStatus err; @@ -752,7 +760,12 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession, "from the session\n"); } -err = MFXInit(impl, &ver, &session); +#if QSV_VERSION_ATLEAST(1, 16) +init_par.GPUCopy= gpu_copy; +#endif +init_par.Implementation = impl; +init_par.Version= ver; +err = MFXInitEx(init_par, &session); if (err != MFX_ERR_NONE) return ff_qsv_print_error(avctx, err, "Error initializing a child MFX session"); @@ -783,7 +796,7 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession, int ff_qsv_init_session_frames(AVCodecContext *avctx, mfxSession *psession, QSVFramesContext *qsv_frames_ctx, - const char *load_plugins, int opaque) + const char *load_plugins, int opaque, int gpu_copy) { mfxFrameAllocator frame_allocator = { .pthis = qsv_frames_ctx, @@ -803,7 +816,7 @@ int ff_qsv_init_session_frames(AVCodecContext *avctx, mfxSession *psession, int ret; ret = ff_qsv_init_session_device(avctx, &session, - frames_ctx->device_ref, load_plugins); + frames_ctx->device_ref, load_plugins, gpu_copy); if (ret < 0) return ret; diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h index 8b44a9b6f4..37559270e5 100644 --- a/libavcodec
[FFmpeg-cvslog] lavc/qsvdec: remove unused check_dec_param
ffmpeg | branch: master | Linjie Fu | Fri Oct 18 16:28:59 2019 +0800| [e1d993d829a6386d1b0514ea38f723d2b31b38fe] | committer: Zhong Li lavc/qsvdec: remove unused check_dec_param Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e1d993d829a6386d1b0514ea38f723d2b31b38fe --- libavcodec/qsvdec.c | 27 --- 1 file changed, 27 deletions(-) diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index ae5023989c..0d34021b42 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -164,33 +164,6 @@ static inline unsigned int qsv_fifo_size(const AVFifoBuffer* fifo) return av_fifo_size(fifo) / qsv_fifo_item_size(); } -static int check_dec_param(AVCodecContext *avctx, QSVContext *q, mfxVideoParam *param_in) -{ -mfxVideoParam param_out = { .mfx.CodecId = param_in->mfx.CodecId }; -mfxStatus ret; - -#define CHECK_MATCH(x) \ -do { \ - if (param_out.mfx.x != param_in->mfx.x) { \ - av_log(avctx, AV_LOG_WARNING, "Required "#x" %d is unsupported\n", \ - param_in->mfx.x); \ - } \ -} while (0) - -ret = MFXVideoDECODE_Query(q->session, param_in, ¶m_out); - -if (ret < 0) { -CHECK_MATCH(CodecId); -CHECK_MATCH(CodecProfile); -CHECK_MATCH(CodecLevel); -CHECK_MATCH(FrameInfo.Width); -CHECK_MATCH(FrameInfo.Height); -#undef CHECK_MATCH -return 0; -} -return 1; -} - static int qsv_decode_preinit(AVCodecContext *avctx, QSVContext *q, enum AVPixelFormat pix_fmt, mfxVideoParam *param) { mfxSession session = NULL; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/qsvenc: Fix bitrate_limit to allow AVC encode in limited bitrate
ffmpeg | branch: master | Linjie Fu | Tue Oct 15 15:56:23 2019 +0800| [e786e37326d4274c1dfbc37a6478680684c779c9] | committer: Zhong Li lavc/qsvenc: Fix bitrate_limit to allow AVC encode in limited bitrate MFXVideoENCODE_Query calls CheckVideoParamQueryLike in MSDK and will determine whether to set param.mfx.TargetKbps to the allowed minTargetKbps according to the bitrate_limit in extco2 buffer. Thus q->param.ExtParam must be set before MFXVideoENCODE_Query in case minTargetKbps is written to TargetKbps by default. 1080P AVC encoding with option "-bitrate_limit 0 -b:v 100k": Before patch: 902 kbps After patch: 156 kbps Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e786e37326d4274c1dfbc37a6478680684c779c9 --- libavcodec/qsvenc.c | 38 +++--- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index ba85d645ca..dcff778607 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -1052,25 +1052,6 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q) if (ret < 0) return ret; -ret = MFXVideoENCODE_Query(q->session, &q->param, &q->param); -if (ret == MFX_WRN_PARTIAL_ACCELERATION) { -av_log(avctx, AV_LOG_WARNING, "Encoder will work with partial HW acceleration\n"); -} else if (ret < 0) { -return ff_qsv_print_error(avctx, ret, - "Error querying encoder params"); -} - -ret = MFXVideoENCODE_QueryIOSurf(q->session, &q->param, &q->req); -if (ret < 0) -return ff_qsv_print_error(avctx, ret, - "Error querying (IOSurf) the encoding parameters"); - -if (opaque_alloc) { -ret = qsv_init_opaque_alloc(avctx, q); -if (ret < 0) -return ret; -} - if (avctx->hwaccel_context) { AVQSVContext *qsv = avctx->hwaccel_context; int i, j; @@ -1100,6 +1081,25 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q) q->param.NumExtParam = q->nb_extparam_internal; } +ret = MFXVideoENCODE_Query(q->session, &q->param, &q->param); +if (ret == MFX_WRN_PARTIAL_ACCELERATION) { +av_log(avctx, AV_LOG_WARNING, "Encoder will work with partial HW acceleration\n"); +} else if (ret < 0) { +return ff_qsv_print_error(avctx, ret, + "Error querying encoder params"); +} + +ret = MFXVideoENCODE_QueryIOSurf(q->session, &q->param, &q->req); +if (ret < 0) +return ff_qsv_print_error(avctx, ret, + "Error querying (IOSurf) the encoding parameters"); + +if (opaque_alloc) { +ret = qsv_init_opaque_alloc(avctx, q); +if (ret < 0) +return ret; +} + ret = MFXVideoENCODE_Init(q->session, &q->param); if (ret < 0) return ff_qsv_print_error(avctx, ret, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/qsvenc: Fix some code indentations
ffmpeg | branch: master | Linjie Fu | Tue Nov 26 11:53:16 2019 +0800| [df625057af9b646742b3b7ff558dd18d52cc8b4d] | committer: Zhong Li lavc/qsvenc: Fix some code indentations Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=df625057af9b646742b3b7ff558dd18d52cc8b4d --- libavcodec/qsvenc.c | 8 libavcodec/qsvenc.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 1bc5600061..4f103b9ff6 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -764,10 +764,10 @@ FF_ENABLE_DEPRECATION_WARNINGS #if QSV_HAVE_EXT_VP9_PARAM if (avctx->codec_id == AV_CODEC_ID_VP9) { - q->extvp9param.Header.BufferId = MFX_EXTBUFF_VP9_PARAM; - q->extvp9param.Header.BufferSz = sizeof(q->extvp9param); - q->extvp9param.WriteIVFHeaders = MFX_CODINGOPTION_OFF; - q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extvp9param; +q->extvp9param.Header.BufferId = MFX_EXTBUFF_VP9_PARAM; +q->extvp9param.Header.BufferSz = sizeof(q->extvp9param); +q->extvp9param.WriteIVFHeaders = MFX_CODINGOPTION_OFF; +q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extvp9param; } #endif diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index a3e9357865..ee35582075 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -125,7 +125,7 @@ typedef struct QSVEncContext { mfxExtMultiFrameControl extmfc; #endif #if QSV_HAVE_EXT_VP9_PARAM - mfxExtVP9Param extvp9param; +mfxExtVP9Param extvp9param; #endif mfxExtOpaqueSurfaceAlloc opaque_alloc; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] libavformat/utils: Fix code indentation
ffmpeg | branch: master | Linjie Fu | Mon Dec 2 09:53:47 2019 +0800| [8fc8bdddbf7355ea206fad0c66a42eba6a2904bb] | committer: Michael Niedermayer libavformat/utils: Fix code indentation Introduced since 077939626eeaa0c1364065414c18ab9b3a072281. Signed-off-by: Linjie Fu Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8fc8bdddbf7355ea206fad0c66a42eba6a2904bb --- libavformat/utils.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 8196442dd1..4d18880acb 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3776,18 +3776,18 @@ FF_ENABLE_DEPRECATION_WARNINGS } analyzed_all_streams = 0; if (!missing_streams || !*missing_streams) -if (i == ic->nb_streams) { -analyzed_all_streams = 1; -/* NOTE: If the format has no header, then we need to read some - * packets to get most of the streams, so we cannot stop here. */ -if (!(ic->ctx_flags & AVFMTCTX_NOHEADER)) { -/* If we found the info for all the codecs, we can stop. */ -ret = count; -av_log(ic, AV_LOG_DEBUG, "All info found\n"); -flush_codecs = 0; -break; +if (i == ic->nb_streams) { +analyzed_all_streams = 1; +/* NOTE: If the format has no header, then we need to read some + * packets to get most of the streams, so we cannot stop here. */ +if (!(ic->ctx_flags & AVFMTCTX_NOHEADER)) { +/* If we found the info for all the codecs, we can stop. */ +ret = count; +av_log(ic, AV_LOG_DEBUG, "All info found\n"); +flush_codecs = 0; +break; +} } -} /* We did not get all the codec info, but we read too much data. */ if (read_size >= probesize) { ret = count; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/qsvenc: add Tiles encode support for HEVC
ffmpeg | branch: master | Linjie Fu | Tue Nov 26 11:56:18 2019 +0800| [8446318502bf21347a4867a5a1fcd8d9bfbd6a41] | committer: Zhong Li lavc/qsvenc: add Tiles encode support for HEVC Add -tile_rows and -tile_cols option to specify the number of tile rows and columns for ICL+ (gen 11) platform. A tile must wholly contain all the slices within it. Slices cannot cross tile boundaries. So the slice number would be implicitly resized to the max(nSlice, nTile). Example: ffmpeg -v verbose -hwaccel qsv -init_hw_device qsv=hw -filter_hw_device hw -f rawvideo -s:v 1920x1080 -i ./input.nv12 -vf format=nv12,hwupload=extra_hw_frames=64 -c:v hevc_qsv -tile_rows 2 -tile_cols 2 -slices 4 -y output.h265 Also dump the actual quantity of encoded tiled rows and columns in run time. Fix the enhancement #8400. Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8446318502bf21347a4867a5a1fcd8d9bfbd6a41 --- libavcodec/qsvenc.c | 32 +++- libavcodec/qsvenc.h | 7 +++ libavcodec/qsvenc_hevc.c | 3 +++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 4f103b9ff6..9e416500e9 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -139,6 +139,9 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q, #if QSV_HAVE_CO3 mfxExtCodingOption3 *co3 = (mfxExtCodingOption3*)coding_opts[2]; #endif +#if QSV_HAVE_EXT_HEVC_TILES +mfxExtHEVCTiles *exthevctiles = (mfxExtHEVCTiles *)coding_opts[3 + QSV_HAVE_CO_VPS]; +#endif av_log(avctx, AV_LOG_VERBOSE, "profile: %s; level: %"PRIu16"\n", print_profile(info->CodecProfile), info->CodecLevel); @@ -204,6 +207,12 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q, av_log(avctx, AV_LOG_VERBOSE, "RateDistortionOpt: %s\n", print_threestate(co->RateDistortionOpt)); +#if QSV_HAVE_EXT_HEVC_TILES +if (avctx->codec_id == AV_CODEC_ID_HEVC) +av_log(avctx, AV_LOG_VERBOSE, "NumTileColumns: %"PRIu16"; NumTileRows: %"PRIu16"\n", + exthevctiles->NumTileColumns, exthevctiles->NumTileRows); +#endif + #if QSV_HAVE_CO2 av_log(avctx, AV_LOG_VERBOSE, "RecoveryPointSEI: %s IntRefType: %"PRIu16"; IntRefCycleSize: %"PRIu16"; IntRefQPDelta: %"PRId16"\n", @@ -771,6 +780,16 @@ FF_ENABLE_DEPRECATION_WARNINGS } #endif +#if QSV_HAVE_EXT_HEVC_TILES +if (avctx->codec_id == AV_CODEC_ID_HEVC) { +q->exthevctiles.Header.BufferId = MFX_EXTBUFF_HEVC_TILES; +q->exthevctiles.Header.BufferSz = sizeof(q->exthevctiles); +q->exthevctiles.NumTileColumns = q->tile_cols; +q->exthevctiles.NumTileRows = q->tile_rows; +q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->exthevctiles; +} +#endif + if (!check_enc_param(avctx,q)) { av_log(avctx, AV_LOG_ERROR, "some encoding parameters are not supported by the QSV " @@ -889,7 +908,14 @@ static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q) }; #endif -mfxExtBuffer *ext_buffers[2 + QSV_HAVE_CO2 + QSV_HAVE_CO3 + QSV_HAVE_CO_VPS]; +#if QSV_HAVE_EXT_HEVC_TILES +mfxExtHEVCTiles hevc_tile_buf = { + .Header.BufferId = MFX_EXTBUFF_HEVC_TILES, + .Header.BufferSz = sizeof(hevc_tile_buf), +}; +#endif + +mfxExtBuffer *ext_buffers[2 + QSV_HAVE_CO2 + QSV_HAVE_CO3 + QSV_HAVE_CO_VPS + QSV_HAVE_EXT_HEVC_TILES]; int need_pps = avctx->codec_id != AV_CODEC_ID_MPEG2VIDEO; int ret, ext_buf_num = 0, extradata_offset = 0; @@ -907,6 +933,10 @@ static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q) if (q->hevc_vps) ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&extradata_vps; #endif +#if QSV_HAVE_EXT_HEVC_TILES +if (avctx->codec_id == AV_CODEC_ID_HEVC) +ext_buffers[ext_buf_num++] = (mfxExtBuffer*)&hevc_tile_buf; +#endif q->param.ExtParam= ext_buffers; q->param.NumExtParam = ext_buf_num; diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index ee35582075..6609171af3 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -38,6 +38,7 @@ #define QSV_HAVE_CO3 QSV_VERSION_ATLEAST(1, 11) #define QSV_HAVE_CO_VPS QSV_VERSION_ATLEAST(1, 17) +#define QSV_HAVE_EXT_HEVC_TILES QSV_VERSION_ATLEAST(1, 13) #define QSV_HAVE_EXT_VP9_PARAM QSV_VERSION_ATLEAST(1, 26) #define QSV_HAVE_TRELLIS QSV_VERSION_ATLEAST(1, 8) @@ -124,6 +125,9 @@ typedef struct QSVEncContext { mfxExtMultiFrameParam extmfp; mfxExtMultiFrameControl extmfc; #endif +#if QSV_HAVE_EXT_HEVC_TILES +mfxExtHEVCTiles exthevctiles; +#endif #if QSV_HAVE_EXT_VP9_PARAM mfxExtVP9Param extvp9param; #endif @@ -161,6 +1
[FFmpeg-cvslog] lavc/mips: simplify the switch code
ffmpeg | branch: master | Linjie Fu | Wed Dec 11 16:48:03 2019 +0800| [bffb9326b6b30656d73039d5dfbe755e76846aea] | committer: Michael Niedermayer lavc/mips: simplify the switch code Signed-off-by: Linjie Fu Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bffb9326b6b30656d73039d5dfbe755e76846aea --- libavcodec/mips/h264pred_init_mips.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavcodec/mips/h264pred_init_mips.c b/libavcodec/mips/h264pred_init_mips.c index 63637b8732..e537ad8bd4 100644 --- a/libavcodec/mips/h264pred_init_mips.c +++ b/libavcodec/mips/h264pred_init_mips.c @@ -73,10 +73,7 @@ static av_cold void h264_pred_init_msa(H264PredContext *h, int codec_id, switch (codec_id) { case AV_CODEC_ID_SVQ3: -; -break; case AV_CODEC_ID_RV40: -; break; case AV_CODEC_ID_VP7: case AV_CODEC_ID_VP8: ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/utils.c: fix code indentations
ffmpeg | branch: master | Linjie Fu | Wed Dec 11 16:52:01 2019 +0800| [7aef2f59b518defea168cde51c7df0c43408286a] | committer: Michael Niedermayer lavc/utils.c: fix code indentations Introduced since 4b4a02b8. Signed-off-by: Linjie Fu Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7aef2f59b518defea168cde51c7df0c43408286a --- libavcodec/utils.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 75e7035b8a..8a49234bcd 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -654,12 +654,12 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code // only call ff_set_dimensions() for non H.264/VP6F/DXV codecs so as not to overwrite previously setup dimensions if (!(avctx->coded_width && avctx->coded_height && avctx->width && avctx->height && (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_VP6F || avctx->codec_id == AV_CODEC_ID_DXV))) { -if (avctx->coded_width && avctx->coded_height) -ret = ff_set_dimensions(avctx, avctx->coded_width, avctx->coded_height); -else if (avctx->width && avctx->height) -ret = ff_set_dimensions(avctx, avctx->width, avctx->height); -if (ret < 0) -goto free_and_end; +if (avctx->coded_width && avctx->coded_height) +ret = ff_set_dimensions(avctx, avctx->coded_width, avctx->coded_height); +else if (avctx->width && avctx->height) +ret = ff_set_dimensions(avctx, avctx->width, avctx->height); +if (ret < 0) +goto free_and_end; } if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vaapi_encode: grow packet if vaMapBuffer returns multiple buffers
ffmpeg | branch: master | Linjie Fu | Thu May 30 20:34:31 2019 -0400| [efefba61f8513e9d909af041b17584fd82775c63] | committer: Ruiling Song lavc/vaapi_encode: grow packet if vaMapBuffer returns multiple buffers Currently, assigning new buffer for pkt when multiple buffers were returned from vaMapBuffer will overwrite the previous encoded pkt data and lead to encode issues. Iterate through the buf_list first to find out the total buffer size needed for the pkt, allocate the whole pkt to avoid repeated reallocation and memcpy, then copy data from each buf to pkt. Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=efefba61f8513e9d909af041b17584fd82775c63 --- libavcodec/vaapi_encode.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 3be9159d37..b0235114df 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -579,6 +579,8 @@ static int vaapi_encode_output(AVCodecContext *avctx, VAAPIEncodeContext *ctx = avctx->priv_data; VACodedBufferSegment *buf_list, *buf; VAStatus vas; +int total_size = 0; +uint8_t *ptr; int err; err = vaapi_encode_wait(avctx, pic); @@ -595,15 +597,21 @@ static int vaapi_encode_output(AVCodecContext *avctx, goto fail; } +for (buf = buf_list; buf; buf = buf->next) +total_size += buf->size; + +err = av_new_packet(pkt, total_size); +ptr = pkt->data; + +if (err < 0) +goto fail_mapped; + for (buf = buf_list; buf; buf = buf->next) { av_log(avctx, AV_LOG_DEBUG, "Output buffer: %u bytes " "(status %08x).\n", buf->size, buf->status); -err = av_new_packet(pkt, buf->size); -if (err < 0) -goto fail_mapped; - -memcpy(pkt->data, buf->buf, buf->size); +memcpy(ptr, buf->buf, buf->size); +ptr += buf->size; } if (pic->type == PICTURE_TYPE_IDR) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] FATE/hevc.mak: cosmetic for fate-hevc-paired-fields
ffmpeg | branch: master | Linjie Fu | Sat Dec 14 01:55:31 2019 +0800| [fb705e40733b43dba93a060ddd99c9d391adfc32] | committer: James Almer FATE/hevc.mak: cosmetic for fate-hevc-paired-fields Adjust the order of fate-hevc-paired-fields. Signed-off-by: Linjie Fu Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fb705e40733b43dba93a060ddd99c9d391adfc32 --- tests/fate/hevc.mak | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/fate/hevc.mak b/tests/fate/hevc.mak index 735949ae27..35af3e43ac 100644 --- a/tests/fate/hevc.mak +++ b/tests/fate/hevc.mak @@ -226,9 +226,6 @@ $(foreach N,$(HEVC_SAMPLES_444_12BIT),$(eval $(call FATE_HEVC_TEST_444_12BIT,$(N fate-hevc-paramchange-yuv420p-yuv420p10: CMD = framecrc -vsync 0 -i $(TARGET_SAMPLES)/hevc/paramchange_yuv420p_yuv420p10.hevc -sws_flags area+accurate_rnd+bitexact FATE_HEVC += fate-hevc-paramchange-yuv420p-yuv420p10 -fate-hevc-paired-fields: CMD = probeframes -show_entries frame=interlaced_frame,top_field_first $(TARGET_SAMPLES)/hevc/paired_fields.hevc -FATE_HEVC_FFPROBE-$(call DEMDEC, HEVC, HEVC) += fate-hevc-paired-fields - tests/data/hevc-mp4.mov: TAG = GEN tests/data/hevc-mp4.mov: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \ @@ -250,6 +247,9 @@ FATE_HEVC-$(call DEMDEC, MOV, HEVC) += fate-hevc-extradata-reload fate-hevc-extradata-reload: CMD = framemd5 -i $(TARGET_SAMPLES)/hevc/extradata-reload-multi-stsd.mov -sws_flags bitexact +fate-hevc-paired-fields: CMD = probeframes -show_entries frame=interlaced_frame,top_field_first $(TARGET_SAMPLES)/hevc/paired_fields.hevc +FATE_HEVC_FFPROBE-$(call DEMDEC, HEVC, HEVC) += fate-hevc-paired-fields + fate-hevc-monochrome-crop: CMD = probeframes -show_entries frame=width,height:stream=width,height $(TARGET_SAMPLES)/hevc/hevc-monochrome.hevc FATE_HEVC_FFPROBE-$(call DEMDEC, HEVC, HEVC) += fate-hevc-monochrome-crop ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] FATE: add test for hevc files with 4 TUDepth(0..4) of cbf_cb/cbf_cr
ffmpeg | branch: master | Linjie Fu | Sat Dec 14 01:54:13 2019 +0800| [ed2bd94fc0f473803e931035492f1c2c57393251] | committer: James Almer FATE: add test for hevc files with 4 TUDepth(0..4) of cbf_cb/cbf_cr 5 cabac states for cbf_cb and cbf_cr are supported according to Table 9-4. Add a test for 64x64 4:4:4 8bit HEVC clips with TUDepth = 4, cbf_cr > 0. Signed-off-by: Xu Guangxin Signed-off-by: Linjie Fu Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ed2bd94fc0f473803e931035492f1c2c57393251 --- tests/fate/hevc.mak | 3 +++ tests/ref/fate/hevc-cabac-tudepth | 6 ++ 2 files changed, 9 insertions(+) diff --git a/tests/fate/hevc.mak b/tests/fate/hevc.mak index 559c3898bc..735949ae27 100644 --- a/tests/fate/hevc.mak +++ b/tests/fate/hevc.mak @@ -256,6 +256,9 @@ FATE_HEVC_FFPROBE-$(call DEMDEC, HEVC, HEVC) += fate-hevc-monochrome-crop fate-hevc-two-first-slice: CMD = threads=2 framemd5 -i $(TARGET_SAMPLES)/hevc/two_first_slice.mp4 -sws_flags bitexact -t 00:02.00 -an FATE_HEVC-$(call DEMDEC, MOV, HEVC) += fate-hevc-two-first-slice +fate-hevc-cabac-tudepth: CMD = framecrc -flags unaligned -i $(TARGET_SAMPLES)/hevc/cbf_cr_cb_TUDepth_4_circle.h265 -pix_fmt yuv444p +FATE_HEVC-$(call DEMDEC, HEVC, HEVC) += fate-hevc-cabac-tudepth + FATE_SAMPLES_AVCONV += $(FATE_HEVC-yes) FATE_SAMPLES_FFPROBE += $(FATE_HEVC_FFPROBE-yes) diff --git a/tests/ref/fate/hevc-cabac-tudepth b/tests/ref/fate/hevc-cabac-tudepth new file mode 100644 index 00..ad874c3dde --- /dev/null +++ b/tests/ref/fate/hevc-cabac-tudepth @@ -0,0 +1,6 @@ +#tb 0: 1/25 +#media_type 0: video +#codec_id 0: rawvideo +#dimensions 0: 64x64 +#sar 0: 0/1 +0, 0, 0,1,12288, 0x0127a0d9 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/hevc_cabac: fix cbf_cb and cbf_cr for transform depth 4
ffmpeg | branch: master | Linjie Fu | Wed Dec 11 16:47:38 2019 +0800| [d31a2902261072f8195a005b78b4e0c4a973bf80] | committer: James Almer lavc/hevc_cabac: fix cbf_cb and cbf_cr for transform depth 4 The max transform depth is 5(from 0 to 4), so we need 5 cabac states for cbf_cb and cbf_cr. See Table 9-4 for details. Signed-off-by: Xu Guangxin Signed-off-by: Linjie Fu Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d31a2902261072f8195a005b78b4e0c4a973bf80 --- libavcodec/hevc_cabac.c | 42 +- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c index 8abb780dd7..3dc0987dad 100644 --- a/libavcodec/hevc_cabac.c +++ b/libavcodec/hevc_cabac.c @@ -66,7 +66,7 @@ static const int8_t num_bins_in_se[] = { 1, // no_residual_data_flag 3, // split_transform_flag 2, // cbf_luma - 4, // cbf_cb, cbf_cr + 5, // cbf_cb, cbf_cr 2, // transform_skip_flag[][] 2, // explicit_rdpcm_flag[][] 2, // explicit_rdpcm_dir_flag[][] @@ -122,23 +122,23 @@ static const int elem_offset[sizeof(num_bins_in_se)] = { 37, // split_transform_flag 40, // cbf_luma 42, // cbf_cb, cbf_cr -46, // transform_skip_flag[][] -48, // explicit_rdpcm_flag[][] -50, // explicit_rdpcm_dir_flag[][] -52, // last_significant_coeff_x_prefix -70, // last_significant_coeff_y_prefix -88, // last_significant_coeff_x_suffix -88, // last_significant_coeff_y_suffix -88, // significant_coeff_group_flag -92, // significant_coeff_flag -136, // coeff_abs_level_greater1_flag -160, // coeff_abs_level_greater2_flag -166, // coeff_abs_level_remaining -166, // coeff_sign_flag -166, // log2_res_scale_abs -174, // res_scale_sign_flag -176, // cu_chroma_qp_offset_flag -177, // cu_chroma_qp_offset_idx +47, // transform_skip_flag[][] +49, // explicit_rdpcm_flag[][] +51, // explicit_rdpcm_dir_flag[][] +53, // last_significant_coeff_x_prefix +71, // last_significant_coeff_y_prefix +89, // last_significant_coeff_x_suffix +89, // last_significant_coeff_y_suffix +89, // significant_coeff_group_flag +93, // significant_coeff_flag +137, // coeff_abs_level_greater1_flag +161, // coeff_abs_level_greater2_flag +167, // coeff_abs_level_remaining +167, // coeff_sign_flag +167, // log2_res_scale_abs +175, // res_scale_sign_flag +177, // cu_chroma_qp_offset_flag +178, // cu_chroma_qp_offset_idx }; #define CNU 154 @@ -189,7 +189,7 @@ static const uint8_t init_values[3][HEVC_CONTEXTS] = { // cbf_luma 111, 141, // cbf_cb, cbf_cr - 94, 138, 182, 154, + 94, 138, 182, 154, 154, // transform_skip_flag 139, 139, // explicit_rdpcm_flag @@ -266,7 +266,7 @@ static const uint8_t init_values[3][HEVC_CONTEXTS] = { // cbf_luma 153, 111, // cbf_cb, cbf_cr - 149, 107, 167, 154, + 149, 107, 167, 154, 154, // transform_skip_flag 139, 139, // explicit_rdpcm_flag @@ -343,7 +343,7 @@ static const uint8_t init_values[3][HEVC_CONTEXTS] = { // cbf_luma 153, 111, // cbf_cb, cbf_cr - 149, 92, 167, 154, + 149, 92, 167, 154, 154, // transform_skip_flag 139, 139, // explicit_rdpcm_flag ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/h264dec.h: remove unused ff_h264_decode_slice_header
ffmpeg | branch: master | Linjie Fu | Tue Dec 17 16:57:33 2019 +0800| [e43d66dc67186a2ca9fefec4e6c189116a3029ba] | committer: Michael Niedermayer lavc/h264dec.h: remove unused ff_h264_decode_slice_header Once removed in 4a9bab3db0d9ec449ebc8b5e823374d1d1df7761. Introduced again in b25cd7540e7. Signed-off-by: Linjie Fu Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e43d66dc67186a2ca9fefec4e6c189116a3029ba --- libavcodec/h264dec.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h index 1d9723260d..530e2d4071 100644 --- a/libavcodec/h264dec.h +++ b/libavcodec/h264dec.h @@ -832,8 +832,6 @@ int ff_h264_slice_context_init(H264Context *h, H264SliceContext *sl); void ff_h264_draw_horiz_band(const H264Context *h, H264SliceContext *sl, int y, int height); -int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl, -const H2645NAL *nal); /** * Submit a slice for decoding. * ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/h265_profile_level: Fix the default profile in ff_h265_guess_level
ffmpeg | branch: master | Linjie Fu | Wed Jan 15 14:54:43 2020 +0800| [f0287e120a1a3eb6a1ccd8aca0b980f567a62d72] | committer: Mark Thompson lavc/h265_profile_level: Fix the default profile in ff_h265_guess_level Default to using multiplication factors for Main profile. Introduced since cd3578a8e4e11e0ba021e621367a7974d6de5da0. Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f0287e120a1a3eb6a1ccd8aca0b980f567a62d72 --- libavcodec/h265_profile_level.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h265_profile_level.c b/libavcodec/h265_profile_level.c index 70db1a52f6..d79c1ab204 100644 --- a/libavcodec/h265_profile_level.c +++ b/libavcodec/h265_profile_level.c @@ -188,7 +188,7 @@ const H265LevelDescriptor *ff_h265_guess_level(const H265RawProfileTierLevel *pt profile = NULL; if (!profile) { // Default to using multiplication factors for Main profile. -profile = &h265_profiles[3]; +profile = &h265_profiles[4]; } pic_size = width * height; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/vf_scale_qsv: fix the class_name in help for scale_qsv
ffmpeg | branch: master | Linjie Fu | Tue Jan 21 16:50:14 2020 +0800| [edf2c7be5c60bc1ab4141b26dd948c4a3adf8423] | committer: Zhong Li lavfi/vf_scale_qsv: fix the class_name in help for scale_qsv Class name is used in show_help_children(avfilter_get_class(),...) to prompt the available filters. $ ffmpeg -h full Before: qsvscale AVOptions: After: scale_qsv AVOptions: Signed-off-by: Linjie Fu Signed-off-by: Zhong Li > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=edf2c7be5c60bc1ab4141b26dd948c4a3adf8423 --- libavfilter/vf_scale_qsv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index 1cf5367969..d1fa9424d2 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -629,7 +629,7 @@ static const AVOption options[] = { }; static const AVClass qsvscale_class = { -.class_name = "qsvscale", +.class_name = "scale_qsv", .item_name = av_default_item_name, .option = options, .version= LIBAVUTIL_VERSION_INT, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/qsvenc: add support for external bitrate control for HEVC
ffmpeg | branch: master | Linjie Fu | Thu Feb 13 20:47:24 2020 +0800| [ebee8085952de079946d903f0cc6e37aee3bc035] | committer: Zhong Li lavc/qsvenc: add support for external bitrate control for HEVC Enables option for hevc_qsv encoder: -extbrc Improvements in BD-Rate could be observed with extbrc on. Signed-off-by: Linjie Fu Signed-off-by: Zhong Li > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ebee8085952de079946d903f0cc6e37aee3bc035 --- libavcodec/qsvenc.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 40904af388..52b4e43979 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -687,11 +687,8 @@ FF_ENABLE_DEPRECATION_WARNINGS q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extco; -if (avctx->codec_id == AV_CODEC_ID_H264) { #if QSV_HAVE_CO2 -q->extco2.Header.BufferId = MFX_EXTBUFF_CODING_OPTION2; -q->extco2.Header.BufferSz = sizeof(q->extco2); - +if (avctx->codec_id == AV_CODEC_ID_H264) { if (q->int_ref_type >= 0) q->extco2.IntRefType = q->int_ref_type; if (q->int_ref_cycle_size >= 0) @@ -703,8 +700,6 @@ FF_ENABLE_DEPRECATION_WARNINGS q->extco2.BitrateLimit = q->bitrate_limit ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; if (q->mbbrc >= 0) q->extco2.MBBRC = q->mbbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; -if (q->extbrc >= 0) -q->extco2.ExtBRC = q->extbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; if (q->max_frame_size >= 0) q->extco2.MaxFrameSize = q->max_frame_size; @@ -752,9 +747,20 @@ FF_ENABLE_DEPRECATION_WARNINGS q->extco2.MaxQPP = q->extco2.MaxQPB = q->extco2.MaxQPI; } #endif +} + +if (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_HEVC) { +if (q->extbrc >= 0) +q->extco2.ExtBRC = q->extbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; + +q->extco2.Header.BufferId = MFX_EXTBUFF_CODING_OPTION2; +q->extco2.Header.BufferSz = sizeof(q->extco2); + q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extco2; +} #endif +if (avctx->codec_id == AV_CODEC_ID_H264) { #if QSV_HAVE_MF if (QSV_RUNTIME_VERSION_ATLEAST(q->ver, 1, 25)) { q->extmfp.Header.BufferId = MFX_EXTBUFF_MULTI_FRAME_PARAM; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/hevc_ps: parse constraint flags for HEVC REXT
ffmpeg | branch: master | Linjie Fu | Wed Jan 15 15:01:28 2020 +0800| [0d83fcc07b31c528c4fb95528b8e50c440eefc87] | committer: Mark Thompson lavc/hevc_ps: parse constraint flags for HEVC REXT Parse all the constraint flags according to ITU-T Rec. H.265 (02/2018). They have to be passed to hw decoders to determine the exact profile for Range Extension HEVC. Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0d83fcc07b31c528c4fb95528b8e50c440eefc87 --- libavcodec/hevc_ps.c | 42 ++ libavcodec/hevc_ps.h | 13 - 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index a30b8b8022..ea6fd536c6 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -267,7 +267,7 @@ static int decode_profile_tier_level(GetBitContext *gb, AVCodecContext *avctx, { int i; -if (get_bits_left(gb) < 2+1+5 + 32 + 4 + 16 + 16 + 12) +if (get_bits_left(gb) < 2+1+5 + 32 + 4 + 43 + 1) return -1; ptl->profile_space = get_bits(gb, 2); @@ -295,9 +295,43 @@ static int decode_profile_tier_level(GetBitContext *gb, AVCodecContext *avctx, ptl->non_packed_constraint_flag = get_bits1(gb); ptl->frame_only_constraint_flag = get_bits1(gb); -skip_bits(gb, 16); // XXX_reserved_zero_44bits[0..15] -skip_bits(gb, 16); // XXX_reserved_zero_44bits[16..31] -skip_bits(gb, 12); // XXX_reserved_zero_44bits[32..43] +#define check_profile_idc(idc) \ +ptl->profile_idc == idc || ptl->profile_compatibility_flag[idc] + +if (check_profile_idc(4) || check_profile_idc(5) || check_profile_idc(6) || +check_profile_idc(7) || check_profile_idc(8) || check_profile_idc(9) || +check_profile_idc(10)) { + +ptl->max_12bit_constraint_flag= get_bits1(gb); +ptl->max_10bit_constraint_flag= get_bits1(gb); +ptl->max_8bit_constraint_flag = get_bits1(gb); +ptl->max_422chroma_constraint_flag= get_bits1(gb); +ptl->max_420chroma_constraint_flag= get_bits1(gb); +ptl->max_monochrome_constraint_flag = get_bits1(gb); +ptl->intra_constraint_flag= get_bits1(gb); +ptl->one_picture_only_constraint_flag = get_bits1(gb); +ptl->lower_bit_rate_constraint_flag = get_bits1(gb); + +if (check_profile_idc(5) || check_profile_idc(9) || check_profile_idc(10)) { +ptl->max_14bit_constraint_flag= get_bits1(gb); +skip_bits_long(gb, 33); // XXX_reserved_zero_33bits[0..32] +} else { +skip_bits_long(gb, 34); // XXX_reserved_zero_34bits[0..33] +} +} else if (check_profile_idc(2)) { +skip_bits(gb, 7); +ptl->one_picture_only_constraint_flag = get_bits1(gb); +skip_bits_long(gb, 35); // XXX_reserved_zero_35bits[0..34] +} else { +skip_bits_long(gb, 43); // XXX_reserved_zero_43bits[0..42] +} + +if (check_profile_idc(1) || check_profile_idc(2) || check_profile_idc(3) || +check_profile_idc(4) || check_profile_idc(5) || check_profile_idc(9)) +ptl->inbld_flag = get_bits1(gb); +else +skip_bits1(gb); +#undef check_profile_idc return 0; } diff --git a/libavcodec/hevc_ps.h b/libavcodec/hevc_ps.h index 2840dc416f..8e1bccdaaf 100644 --- a/libavcodec/hevc_ps.h +++ b/libavcodec/hevc_ps.h @@ -177,11 +177,22 @@ typedef struct PTLCommon { uint8_t tier_flag; uint8_t profile_idc; uint8_t profile_compatibility_flag[32]; -uint8_t level_idc; uint8_t progressive_source_flag; uint8_t interlaced_source_flag; uint8_t non_packed_constraint_flag; uint8_t frame_only_constraint_flag; +uint8_t max_12bit_constraint_flag; +uint8_t max_10bit_constraint_flag; +uint8_t max_8bit_constraint_flag; +uint8_t max_422chroma_constraint_flag; +uint8_t max_420chroma_constraint_flag; +uint8_t max_monochrome_constraint_flag; +uint8_t intra_constraint_flag; +uint8_t one_picture_only_constraint_flag; +uint8_t lower_bit_rate_constraint_flag; +uint8_t max_14bit_constraint_flag; +uint8_t inbld_flag; +uint8_t level_idc; } PTLCommon; typedef struct PTL { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavu/hwcontext_vaapi: add vaapi_format_map support for Y210
ffmpeg | branch: master | Linjie Fu | Wed Jan 15 15:00:12 2020 +0800| [f4cd4017bff0bcfb252bc1805ed40e738c6a4803] | committer: Mark Thompson lavu/hwcontext_vaapi: add vaapi_format_map support for Y210 VA_RT_FORMAT describes the desired sampling format for surface. When creating surface, VA_RT_FORMAT will be used firstly to choose the expected fourcc/media_format for the surface. And the fourcc will be revised by the value of VASurfaceAttribPixelFormat. Add vaapi_format_map support for new pixel_format Y210. This is fundamental for both VA-API and QSV. Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f4cd4017bff0bcfb252bc1805ed40e738c6a4803 --- libavutil/hwcontext_vaapi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index cf117640f2..cfcfc46867 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -116,6 +116,9 @@ static const VAAPIFormatDescriptor vaapi_format_map[] = { #endif MAP(UYVY, YUV422, UYVY422, 0), MAP(YUY2, YUV422, YUYV422, 0), +#ifdef VA_FOURCC_Y210 +MAP(Y210, YUV422_10, Y210, 0), +#endif MAP(411P, YUV411, YUV411P, 0), MAP(422V, YUV422, YUV440P, 0), MAP(444P, YUV444, YUV444P, 0), ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vaapi_decode: add profile_parser and format map support for HEVC REXT
ffmpeg | branch: master | Linjie Fu | Wed Jan 15 15:02:02 2020 +0800| [d2378645fbdd1da7acaa084ddcae90830f54589b] | committer: Mark Thompson lavc/vaapi_decode: add profile_parser and format map support for HEVC REXT Add function pointer field in vaapi_profile_map[], set profile_parser for HEVC_REXT to find the exact va_profile. Also add format map support. Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d2378645fbdd1da7acaa084ddcae90830f54589b --- libavcodec/vaapi_decode.c | 28 ++-- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index 69512e1d45..4ee53165e1 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -24,6 +24,7 @@ #include "decode.h" #include "internal.h" #include "vaapi_decode.h" +#include "vaapi_hevc.h" int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, @@ -255,6 +256,10 @@ static const struct { MAP(422H, YUV422P), #ifdef VA_FOURCC_YV16 MAP(YV16, YUV422P), +#endif +MAP(YUY2, YUYV422), +#ifdef VA_FOURCC_Y210 +MAP(Y210,Y210), #endif // 4:4:0 MAP(422V, YUV440P), @@ -364,8 +369,9 @@ static const struct { enum AVCodecID codec_id; int codec_profile; VAProfile va_profile; +VAProfile (*profile_parser)(AVCodecContext *avctx); } vaapi_profile_map[] = { -#define MAP(c, p, v) { AV_CODEC_ID_ ## c, FF_PROFILE_ ## p, VAProfile ## v } +#define MAP(c, p, v, ...) { AV_CODEC_ID_ ## c, FF_PROFILE_ ## p, VAProfile ## v, __VA_ARGS__ } MAP(MPEG2VIDEO, MPEG2_SIMPLE,MPEG2Simple ), MAP(MPEG2VIDEO, MPEG2_MAIN, MPEG2Main ), MAP(H263,UNKNOWN, H263Baseline), @@ -380,6 +386,10 @@ static const struct { #if VA_CHECK_VERSION(0, 37, 0) MAP(HEVC,HEVC_MAIN, HEVCMain), MAP(HEVC,HEVC_MAIN_10,HEVCMain10 ), +#endif +#if VA_CHECK_VERSION(1, 2, 0) +MAP(HEVC,HEVC_REXT, None, + ff_vaapi_parse_hevc_rext_profile ), #endif MAP(MJPEG, MJPEG_HUFFMAN_BASELINE_DCT, JPEGBaseline), @@ -415,8 +425,8 @@ static int vaapi_decode_make_config(AVCodecContext *avctx, VAStatus vas; int err, i, j; const AVCodecDescriptor *codec_desc; -VAProfile *profile_list = NULL, matched_va_profile; -int profile_count, exact_match, matched_ff_profile; +VAProfile *profile_list = NULL, matched_va_profile, va_profile; +int profile_count, exact_match, matched_ff_profile, codec_profile; AVHWDeviceContext*device = (AVHWDeviceContext*)device_ref->data; AVVAAPIDeviceContext *hwctx = device->hwctx; @@ -454,15 +464,21 @@ static int vaapi_decode_make_config(AVCodecContext *avctx, if (avctx->profile == vaapi_profile_map[i].codec_profile || vaapi_profile_map[i].codec_profile == FF_PROFILE_UNKNOWN) profile_match = 1; + +va_profile = vaapi_profile_map[i].profile_parser ? + vaapi_profile_map[i].profile_parser(avctx) : + vaapi_profile_map[i].va_profile; +codec_profile = vaapi_profile_map[i].codec_profile; + for (j = 0; j < profile_count; j++) { -if (vaapi_profile_map[i].va_profile == profile_list[j]) { +if (va_profile == profile_list[j]) { exact_match = profile_match; break; } } if (j < profile_count) { -matched_va_profile = vaapi_profile_map[i].va_profile; -matched_ff_profile = vaapi_profile_map[i].codec_profile; +matched_va_profile = va_profile; +matched_ff_profile = codec_profile; if (exact_match) break; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/hevcdec: add 4:2:2 8-bit/10-bit VAAPI decode support
ffmpeg | branch: master | Linjie Fu | Wed Jan 15 15:02:21 2020 +0800| [669428ac5d9b39f718e7d46f52410722dd20b94a] | committer: Mark Thompson lavc/hevcdec: add 4:2:2 8-bit/10-bit VAAPI decode support Add decode support for 4:2:2 8-bt and 10-bit HEVC Range Extension clips. Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=669428ac5d9b39f718e7d46f52410722dd20b94a --- libavcodec/hevcdec.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index c74881e814..7448be482c 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -425,6 +425,12 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) #endif #if CONFIG_HEVC_NVDEC_HWACCEL *fmt++ = AV_PIX_FMT_CUDA; +#endif +break; +case AV_PIX_FMT_YUV422P: +case AV_PIX_FMT_YUV422P10LE: +#if CONFIG_HEVC_VAAPI_HWACCEL + *fmt++ = AV_PIX_FMT_VAAPI; #endif break; case AV_PIX_FMT_YUV420P12: ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vaapi_hevc: extend parameter buffer to ParameterBufferHEVCExtension
ffmpeg | branch: master | Linjie Fu | Wed Jan 15 15:01:05 2020 +0800| [aa6b2e1604c285e16109d0377e0bb5e8b4fbe13e] | committer: Mark Thompson lavc/vaapi_hevc: extend parameter buffer to ParameterBufferHEVCExtension Extend ParameterBufferHEVC to ParameterBufferHEVCExtension for both VAPicture and VASlice. Pass Range Extension flags to support the decode for HEVC REXT. Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aa6b2e1604c285e16109d0377e0bb5e8b4fbe13e --- libavcodec/vaapi_hevc.c | 104 +++- 1 file changed, 85 insertions(+), 19 deletions(-) diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index c69d63d8ec..ee54e44e7c 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -29,8 +29,13 @@ #include "vaapi_decode.h" typedef struct VAAPIDecodePictureHEVC { +#if VA_CHECK_VERSION(1, 2, 0) +VAPictureParameterBufferHEVCExtension pic_param; +VASliceParameterBufferHEVCExtension last_slice_param; +#else VAPictureParameterBufferHEVC pic_param; VASliceParameterBufferHEVC last_slice_param; +#endif const uint8_t *last_buffer; size_t last_size; @@ -117,11 +122,13 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx, const HEVCPPS *pps = h->ps.pps; const ScalingList *scaling_list = NULL; -int err, i; +int pic_param_size, err, i; + +VAPictureParameterBufferHEVC *pic_param = (VAPictureParameterBufferHEVC *)&pic->pic_param; pic->pic.output_surface = ff_vaapi_get_surface_id(h->ref->frame); -pic->pic_param = (VAPictureParameterBufferHEVC) { +*pic_param = (VAPictureParameterBufferHEVC) { .pic_width_in_luma_samples= sps->width, .pic_height_in_luma_samples = sps->height, .log2_min_luma_coding_block_size_minus3 = sps->log2_min_cb_size - 3, @@ -188,29 +195,61 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx, }, }; -fill_vaapi_pic(&pic->pic_param.CurrPic, h->ref, 0); -fill_vaapi_reference_frames(h, &pic->pic_param); +fill_vaapi_pic(&pic_param->CurrPic, h->ref, 0); +fill_vaapi_reference_frames(h, pic_param); if (pps->tiles_enabled_flag) { -pic->pic_param.num_tile_columns_minus1 = pps->num_tile_columns - 1; -pic->pic_param.num_tile_rows_minus1= pps->num_tile_rows - 1; +pic_param->num_tile_columns_minus1 = pps->num_tile_columns - 1; +pic_param->num_tile_rows_minus1= pps->num_tile_rows - 1; for (i = 0; i < pps->num_tile_columns; i++) -pic->pic_param.column_width_minus1[i] = pps->column_width[i] - 1; +pic_param->column_width_minus1[i] = pps->column_width[i] - 1; for (i = 0; i < pps->num_tile_rows; i++) -pic->pic_param.row_height_minus1[i] = pps->row_height[i] - 1; +pic_param->row_height_minus1[i] = pps->row_height[i] - 1; } if (h->sh.short_term_ref_pic_set_sps_flag == 0 && h->sh.short_term_rps) { -pic->pic_param.st_rps_bits = h->sh.short_term_ref_pic_set_size; +pic_param->st_rps_bits = h->sh.short_term_ref_pic_set_size; } else { -pic->pic_param.st_rps_bits = 0; +pic_param->st_rps_bits = 0; +} + +#if VA_CHECK_VERSION(1, 2, 0) +if (avctx->profile == FF_PROFILE_HEVC_REXT) { +pic->pic_param.rext = (VAPictureParameterBufferHEVCRext) { +.range_extension_pic_fields.bits = { +.transform_skip_rotation_enabled_flag = sps->transform_skip_rotation_enabled_flag, +.transform_skip_context_enabled_flag= sps->transform_skip_context_enabled_flag, +.implicit_rdpcm_enabled_flag= sps->implicit_rdpcm_enabled_flag, +.explicit_rdpcm_enabled_flag= sps->explicit_rdpcm_enabled_flag, +.extended_precision_processing_flag = sps->extended_precision_processing_flag, +.intra_smoothing_disabled_flag = sps->intra_smoothing_disabled_flag, +.high_precision_offsets_enabled_flag= sps->high_precision_offsets_enabled_flag, +.persistent_rice_adaptation_enabled_flag= sps->persistent_rice_adaptation_enabled_flag, +.cabac_bypass_alignment_enabled_flag= sps->cabac_bypass_alignment_enabled_flag, +.cross_component_prediction_enabled_flag= pps->cross_component_prediction_enabled_flag, +.chroma_qp_offset_list_enabled_flag = pps->chroma_qp_offset_list_enabled_flag, +}, +.diff_cu_chroma_qp_offset_depth = pp
[FFmpeg-cvslog] lavu/pix_fmt: add new pixel format y210
ffmpeg | branch: master | Linjie Fu | Wed Jan 15 14:58:38 2020 +0800| [1c37cad084041c74c6f21505e24670611e6f28a5] | committer: Mark Thompson lavu/pix_fmt: add new pixel format y210 Add some packed 4:2:2 10-bit pixel formats for hardware decode support in VAAPI and QSV. Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1c37cad084041c74c6f21505e24670611e6f28a5 --- libavutil/pixdesc.c | 23 +++ libavutil/pixfmt.h | 5 + libavutil/version.h | 2 +- tests/ref/fate/sws-pixdesc-query | 7 +++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 64178b7d56..9d61c52567 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -205,6 +205,29 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { { 0, 4, 1, 0, 8, 3, 7, 2 },/* V */ }, }, +[AV_PIX_FMT_Y210LE] = { +.name = "y210le", +.nb_components = 3, +.log2_chroma_w = 1, +.log2_chroma_h = 0, +.comp = { +{ 0, 4, 0, 6, 10, 3, 9, 1 },/* Y */ +{ 0, 8, 2, 6, 10, 7, 9, 3 },/* U */ +{ 0, 8, 6, 6, 10, 7, 9, 7 },/* V */ +}, +}, +[AV_PIX_FMT_Y210BE] = { +.name = "y210be", +.nb_components = 3, +.log2_chroma_w = 1, +.log2_chroma_h = 0, +.comp = { +{ 0, 4, 0, 6, 10, 3, 9, 1 },/* Y */ +{ 0, 8, 2, 6, 10, 7, 9, 3 },/* U */ +{ 0, 8, 6, 6, 10, 7, 9, 7 },/* V */ +}, +.flags = AV_PIX_FMT_FLAG_BE, +}, [AV_PIX_FMT_RGB24] = { .name = "rgb24", .nb_components = 3, diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index e1a511758b..1c625cfc8a 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -355,6 +355,9 @@ enum AVPixelFormat { */ AV_PIX_FMT_VULKAN, +AV_PIX_FMT_Y210BE,///< packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, big-endian +AV_PIX_FMT_Y210LE,///< packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, little-endian + AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions }; @@ -443,6 +446,8 @@ enum AVPixelFormat { #define AV_PIX_FMT_P010 AV_PIX_FMT_NE(P010BE, P010LE) #define AV_PIX_FMT_P016 AV_PIX_FMT_NE(P016BE, P016LE) +#define AV_PIX_FMT_Y210 AV_PIX_FMT_NE(Y210BE, Y210LE) + /** * Chromaticity coordinates of the source primaries. * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1. diff --git a/libavutil/version.h b/libavutil/version.h index 90cc55b9ac..8c4f91bb8f 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 41 +#define LIBAVUTIL_VERSION_MINOR 42 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query index e23492293e..bc9a0d874d 100644 --- a/tests/ref/fate/sws-pixdesc-query +++ b/tests/ref/fate/sws-pixdesc-query @@ -59,6 +59,8 @@ isNBPS: p010le xyz12be xyz12le + y210be + y210le yuv420p10be yuv420p10le yuv420p12be @@ -140,6 +142,7 @@ isBE: rgb565be rgba64be xyz12be + y210be ya16be yuv420p10be yuv420p12be @@ -188,6 +191,8 @@ isYUV: uyyvyy411 xyz12be xyz12le + y210be + y210le ya16be ya16le ya8 @@ -686,6 +691,8 @@ Packed: uyyvyy411 xyz12be xyz12le + y210be + y210le ya16be ya16le ya8 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vaapi_decode: add decode support for HEVC_MAIN_STILL_PICTURE
ffmpeg | branch: master | Linjie Fu | Wed Jan 15 15:02:40 2020 +0800| [a7b92cb55907fd33aa75eabea95db39ba949cb99] | committer: Mark Thompson lavc/vaapi_decode: add decode support for HEVC_MAIN_STILL_PICTURE Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a7b92cb55907fd33aa75eabea95db39ba949cb99 --- libavcodec/vaapi_decode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index 4ee53165e1..54a0ecb47a 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -386,6 +386,8 @@ static const struct { #if VA_CHECK_VERSION(0, 37, 0) MAP(HEVC,HEVC_MAIN, HEVCMain), MAP(HEVC,HEVC_MAIN_10,HEVCMain10 ), +MAP(HEVC,HEVC_MAIN_STILL_PICTURE, + HEVCMain), #endif #if VA_CHECK_VERSION(1, 2, 0) MAP(HEVC,HEVC_REXT, None, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] swscale: Add swscale input support for Y210LE
ffmpeg | branch: master | Linjie Fu | Wed Jan 15 14:59:34 2020 +0800| [d2aa1fbfd4c4599fc0ae8f32b5e95ad65546944b] | committer: Mark Thompson swscale: Add swscale input support for Y210LE Add swscale input support for Y210LE, output support and fate test could be added later if there is requirement for software CSC to this packed format. Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d2aa1fbfd4c4599fc0ae8f32b5e95ad65546944b --- libswscale/input.c | 24 libswscale/utils.c | 1 + 2 files changed, 25 insertions(+) diff --git a/libswscale/input.c b/libswscale/input.c index 159f70307d..8346cf4da6 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -552,6 +552,24 @@ static void yvy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, con av_assert1(src1 == src2); } +static void y210le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, +const uint8_t *unused1, int width, uint32_t *unused2) +{ +int i; +for (i = 0; i < width; i++) { +AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 2) >> 6); +AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6) >> 6); +} +} + +static void y210le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, + const uint8_t *unused1, int width, uint32_t *unused2) +{ +int i; +for (i = 0; i < width; i++) +AV_WN16(dst + i * 2, AV_RL16(src + i * 4) >> 6); +} + static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused) { @@ -1154,6 +1172,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_P016BE: c->chrToYV12 = p016BEToUV_c; break; +case AV_PIX_FMT_Y210LE: +c->chrToYV12 = y210le_UV_c; +break; } if (c->chrSrcHSubSample) { switch (srcFormat) { @@ -1586,6 +1607,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) c->lumToYV12 = grayf32ToY16_bswap_c; #endif break; +case AV_PIX_FMT_Y210LE: +c->lumToYV12 = y210le_Y_c; +break; } if (c->needAlpha) { if (is16BPS(srcFormat) || isNBPS(srcFormat)) { diff --git a/libswscale/utils.c b/libswscale/utils.c index e9c66aeb4f..bb3495b990 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -266,6 +266,7 @@ static const FormatEntry format_entries[] = { [AV_PIX_FMT_YUVA444P12LE] = { 1, 1 }, [AV_PIX_FMT_NV24]= { 1, 1 }, [AV_PIX_FMT_NV42]= { 1, 1 }, +[AV_PIX_FMT_Y210LE] = { 1, 0 }, }; int sws_isSupportedInput(enum AVPixelFormat pix_fmt) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vaapi_hevc: add function to find exact va_profile for REXT
ffmpeg | branch: master | Linjie Fu | Wed Jan 15 15:01:42 2020 +0800| [85cc7bcd4cf1e1963c22c1ea1594160a33da4fee] | committer: Mark Thompson lavc/vaapi_hevc: add function to find exact va_profile for REXT Add vaapi_parse_rext_profile and use profile constraint flags to determine the exact va_profile for HEVC_REXT. If profile mismatch is allowed, select Main profile by default. Add build object in Makefile for h265_profile_level dependency. Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=85cc7bcd4cf1e1963c22c1ea1594160a33da4fee --- libavcodec/Makefile | 2 +- libavcodec/vaapi_hevc.c | 78 + libavcodec/vaapi_hevc.h | 27 + 3 files changed, 106 insertions(+), 1 deletion(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 12704af6bd..0de585279c 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -889,7 +889,7 @@ OBJS-$(CONFIG_HEVC_D3D11VA_HWACCEL) += dxva2_hevc.o OBJS-$(CONFIG_HEVC_DXVA2_HWACCEL) += dxva2_hevc.o OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += nvdec_hevc.o OBJS-$(CONFIG_HEVC_QSV_HWACCEL) += qsvdec_h2645.o -OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_hevc.o +OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_hevc.o h265_profile_level.o OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) += vdpau_hevc.o OBJS-$(CONFIG_MJPEG_NVDEC_HWACCEL)+= nvdec_mjpeg.o OBJS-$(CONFIG_MJPEG_VAAPI_HWACCEL)+= vaapi_mjpeg.o diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index ee54e44e7c..d832b8cb0d 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -27,6 +27,8 @@ #include "hevcdec.h" #include "hwaccel.h" #include "vaapi_decode.h" +#include "vaapi_hevc.h" +#include "h265_profile_level.h" typedef struct VAAPIDecodePictureHEVC { #if VA_CHECK_VERSION(1, 2, 0) @@ -487,6 +489,82 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx, return 0; } +static int ptl_convert(const PTLCommon *general_ptl, H265RawProfileTierLevel *h265_raw_ptl) +{ +h265_raw_ptl->general_profile_space = general_ptl->profile_space; +h265_raw_ptl->general_tier_flag = general_ptl->tier_flag; +h265_raw_ptl->general_profile_idc = general_ptl->profile_idc; + +memcpy(h265_raw_ptl->general_profile_compatibility_flag, + general_ptl->profile_compatibility_flag, 32 * sizeof(uint8_t)); + +#define copy_field(name) h265_raw_ptl->general_ ## name = general_ptl->name +copy_field(progressive_source_flag); +copy_field(interlaced_source_flag); +copy_field(non_packed_constraint_flag); +copy_field(frame_only_constraint_flag); +copy_field(max_12bit_constraint_flag); +copy_field(max_10bit_constraint_flag); +copy_field(max_422chroma_constraint_flag); +copy_field(max_420chroma_constraint_flag); +copy_field(max_monochrome_constraint_flag); +copy_field(intra_constraint_flag); +copy_field(one_picture_only_constraint_flag); +copy_field(lower_bit_rate_constraint_flag); +copy_field(max_14bit_constraint_flag); +copy_field(inbld_flag); +copy_field(level_idc); +#undef copy_field + +return 0; +} + +/* + * Find exact va_profile for HEVC Range Extension + */ +VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx) +{ +const HEVCContext *h = avctx->priv_data; +const HEVCSPS *sps = h->ps.sps; +const PTL *ptl = &sps->ptl; +const PTLCommon *general_ptl = &ptl->general_ptl; +const H265ProfileDescriptor *profile; +H265RawProfileTierLevel h265_raw_ptl = {0}; + +/* convert PTLCommon to H265RawProfileTierLevel */ +ptl_convert(general_ptl, &h265_raw_ptl); + +profile = ff_h265_get_profile(&h265_raw_ptl); +if (!profile) { +av_log(avctx, AV_LOG_WARNING, "HEVC profile is not found.\n"); +goto end; +} else { +av_log(avctx, AV_LOG_VERBOSE, "HEVC profile %s is found.\n", profile->name); +} + +#if VA_CHECK_VERSION(1, 2, 0) +if (!strcmp(profile->name, "Main 4:2:2 10") || +!strcmp(profile->name, "Main 4:2:2 10 Intra")) +return VAProfileHEVCMain422_10; +else if (!strcmp(profile->name, "Main 4:4:4") || + !strcmp(profile->name, "Main 4:4:4 Intra")) +return VAProfileHEVCMain444; +else if (!strcmp(profile->name, "Main 4:4:4 10") || + !strcmp(profile->name, "Main 4:4:4 10 Intra")) +return VAProfileHEVCMain444_10; +#else +av_log(avctx, AV_LOG_WARNING, "HEVC profile %s is " + "not supported with this VA version.\n", profile->name); +#endif + +end: +if (avctx->hwaccel_flags & AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH) { +// De
[FFmpeg-cvslog] lavc/avcodec.h: fix missing line breaks in API documentation
ffmpeg | branch: master | Linjie Fu | Fri Feb 28 00:13:28 2020 +0800| [220c7dadc4988e4ef52e93b098e6f02283f7852a] | committer: Michael Niedermayer lavc/avcodec.h: fix missing line breaks in API documentation "In both cases.." and "Repeat this call until.." would be better to be in a separate line. http://ffmpeg.org/doxygen/trunk/group__lavc__encdec.html Signed-off-by: Linjie Fu Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=220c7dadc4988e4ef52e93b098e6f02283f7852a --- libavcodec/avcodec.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 894a9e5565..5a0fc3405c 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -92,6 +92,7 @@ * compressed data in an AVPacket. * - For encoding, call avcodec_send_frame() to give the encoder an AVFrame * containing uncompressed audio or video. + * * In both cases, it is recommended that AVPackets and AVFrames are * refcounted, or libavcodec might have to copy the input data. (libavformat * always returns refcounted AVPackets, and av_frame_get_buffer() allocates @@ -102,6 +103,7 @@ * an AVFrame containing uncompressed audio or video data. * - For encoding, call avcodec_receive_packet(). On success, it will return * an AVPacket with a compressed frame. + * * Repeat this call until it returns AVERROR(EAGAIN) or an error. The * AVERROR(EAGAIN) return value means that new input data is required to * return new output. In this case, continue with sending input. For each ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/v4l2_context: fix compile warning for incompatible pointer type
ffmpeg | branch: master | Linjie Fu | Fri Feb 28 00:14:32 2020 +0800| [dfa1fc17a54a31e51f36f1f764dfdc76062ffe78] | committer: Michael Niedermayer lavc/v4l2_context: fix compile warning for incompatible pointer type Signed-off-by: Linjie Fu Reviewed-by: Andriy Gelman Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dfa1fc17a54a31e51f36f1f764dfdc76062ffe78 --- libavcodec/v4l2_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c index 95a2bfa6a4..8110bbb555 100644 --- a/libavcodec/v4l2_context.c +++ b/libavcodec/v4l2_context.c @@ -48,7 +48,7 @@ static inline V4L2m2mContext *ctx_to_m2mctx(V4L2Context *ctx) container_of(ctx, V4L2m2mContext, capture); } -static inline AVClass *logger(V4L2Context *ctx) +static inline AVCodecContext *logger(V4L2Context *ctx) { return ctx_to_m2mctx(ctx)->avctx; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vaapi_encode_h265: fix conf_win_xxx_offset for 4:2:2/4:4:4 encoding
ffmpeg | branch: master | Linjie Fu | Sun Mar 8 16:28:46 2020 +0800| [2847c5c6f93b00c0ec9fb82dba7c382faf7335cc] | committer: Mark Thompson lavc/vaapi_encode_h265: fix conf_win_xxx_offset for 4:2:2/4:4:4 encoding Use desc->log2_chroma_w/h to calculate the sps->conf_win_right/bottom_offset. Based on Table 6-1, SubWidthC and SubHeightC depend on chroma format(log2_chroma_w/h). Based on D-28 and D-29, set the correct cropped width/height. croppedWidth = pic_width_in_luma_samples − SubWidthC * ( conf_win_right_offset + conf_win_left_offset ); croppedHeight = pic_height_in_luma_samples − SubHeightC * ( conf_win_bottom_offset + conf_win_top_offset ); Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2847c5c6f93b00c0ec9fb82dba7c382faf7335cc --- libavcodec/vaapi_encode_h265.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c index 538862a9d5..97dc5a7e75 100644 --- a/libavcodec/vaapi_encode_h265.c +++ b/libavcodec/vaapi_encode_h265.c @@ -410,10 +410,10 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) sps->conformance_window_flag = 1; sps->conf_win_left_offset = 0; sps->conf_win_right_offset = -(ctx->surface_width - avctx->width) / 2; +(ctx->surface_width - avctx->width) >> desc->log2_chroma_w; sps->conf_win_top_offset= 0; sps->conf_win_bottom_offset = -(ctx->surface_height - avctx->height) / 2; +(ctx->surface_height - avctx->height) >> desc->log2_chroma_h; } else { sps->conformance_window_flag = 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/vf_dnn_processing: Fix compile warning of mixed declarations and code
ffmpeg | branch: master | Linjie Fu | Wed Mar 18 12:23:10 2020 +0800| [acc6f632b45f4b9eb0dc2572b3d95224022582cb] | committer: Guo, Yejun lavfi/vf_dnn_processing: Fix compile warning of mixed declarations and code Signed-off-by: Linjie Fu Reviewed-by: Guo, Yejun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=acc6f632b45f4b9eb0dc2572b3d95224022582cb --- libavfilter/vf_dnn_processing.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_dnn_processing.c b/libavfilter/vf_dnn_processing.c index 7f40f85dad..fabe4f1d01 100644 --- a/libavfilter/vf_dnn_processing.c +++ b/libavfilter/vf_dnn_processing.c @@ -418,10 +418,13 @@ static av_always_inline int isPlanarYUV(enum AVPixelFormat pix_fmt) static int copy_uv_planes(DnnProcessingContext *ctx, AVFrame *out, const AVFrame *in) { +const AVPixFmtDescriptor *desc; +int uv_height; + if (!ctx->sws_uv_scale) { av_assert0(in->height == out->height && in->width == out->width); -const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(in->format); -int uv_height = AV_CEIL_RSHIFT(in->height, desc->log2_chroma_h); +desc = av_pix_fmt_desc_get(in->format); +uv_height = AV_CEIL_RSHIFT(in->height, desc->log2_chroma_h); for (int i = 1; i < 3; ++i) { int bytewidth = av_image_get_linesize(in->format, in->width, i); av_image_copy_plane(out->data[i], out->linesize[i], ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/x86/hevc_add_res: Fix overflow in ADD_RES_SSE_8_8
ffmpeg | branch: master | Linjie Fu | Thu Mar 5 15:47:54 2020 +0800| [e9abef437f0a348c017d4ac8b23a122881c1dc87] | committer: Anton Khirnov lavc/x86/hevc_add_res: Fix overflow in ADD_RES_SSE_8_8 Fix overflow for coeff -32768 in function ADD_RES_SSE_8_8 with no performance drop. ./checkasm --test=hevc_add_res --bench Mainline: - hevc_add_res.add_residual [OK] hevc_add_res_8x8_8_sse2: 15.5 Add overflow test case: - hevc_add_res.add_residual [FAILED] After: - hevc_add_res.add_residual [OK] hevc_add_res_8x8_8_sse2: 15.5 Signed-off-by: Xu Guangxin Signed-off-by: Linjie Fu Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e9abef437f0a348c017d4ac8b23a122881c1dc87 --- libavcodec/x86/hevc_add_res.asm | 45 - 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/libavcodec/x86/hevc_add_res.asm b/libavcodec/x86/hevc_add_res.asm index 249c607a85..e5e9f247bb 100644 --- a/libavcodec/x86/hevc_add_res.asm +++ b/libavcodec/x86/hevc_add_res.asm @@ -57,32 +57,30 @@ cglobal hevc_add_residual_4_8, 3, 3, 6 RET %macro ADD_RES_SSE_8_8 0 -pxor m3, m3 -mova m4, [r1] -mova m6, [r1+16] -mova m0, [r1+32] -mova m2, [r1+48] -psubw m5, m3, m4 -psubw m7, m3, m6 -psubw m1, m3, m0 -packuswb m4, m0 -packuswb m5, m1 -psubw m3, m2 -packuswb m6, m2 -packuswb m7, m3 - movq m0, [r0] movq m1, [r0+r2] -movhpsm0, [r0+r2*2] -movhpsm1, [r0+r3] -paddusb m0, m4 -paddusb m1, m6 -psubusb m0, m5 -psubusb m1, m7 +punpcklbw m0, m4 +punpcklbw m1, m4 +mova m2, [r1] +mova m3, [r1+16] +paddswm0, m2 +paddswm1, m3 +packuswb m0, m1 + +movq m2, [r0+r2*2] +movq m3, [r0+r3] +punpcklbw m2, m4 +punpcklbw m3, m4 +mova m6, [r1+32] +mova m7, [r1+48] +paddswm2, m6 +paddswm3, m7 +packuswb m2, m3 + movq[r0], m0 -movq [r0+r2], m1 -movhps [r0+2*r2], m0 -movhps [r0+r3], m1 +movhps [r0+r2], m0 +movq [r0+r2*2], m2 +movhps [r0+r3], m2 %endmacro %macro ADD_RES_SSE_16_32_8 3 @@ -120,6 +118,7 @@ cglobal hevc_add_residual_4_8, 3, 3, 6 %macro TRANSFORM_ADD_8 0 ; void ff_hevc_add_residual_8_8_(uint8_t *dst, int16_t *res, ptrdiff_t stride) cglobal hevc_add_residual_8_8, 3, 4, 8 +pxor m4, m4 lea r3, [r2*3] ADD_RES_SSE_8_8 add r1, 64 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/x86/hevc_add_res: Fix coeff overflow in ADD_RES_SSE_16_32_8
ffmpeg | branch: master | Linjie Fu | Thu Mar 5 15:48:09 2020 +0800| [8b8492452d53293b2ac8c842877fadf7925fc950] | committer: Anton Khirnov lavc/x86/hevc_add_res: Fix coeff overflow in ADD_RES_SSE_16_32_8 Fix overflow for coeff -32768 in function ADD_RES_SSE_16_32_8 with no performance drop.(SSE2/AVX/AVX2) ./checkasm --test=hevc_add_res --bench Mainline: - hevc_add_res.add_residual [OK] hevc_add_res_32x32_8_sse2: 127.5 hevc_add_res_32x32_8_avx: 127.0 hevc_add_res_32x32_8_avx2: 86.5 Add overflow test case: - hevc_add_res.add_residual [FAILED] After: - hevc_add_res.add_residual [OK] hevc_add_res_32x32_8_sse2: 126.8 hevc_add_res_32x32_8_avx: 128.3 hevc_add_res_32x32_8_avx2: 86.8 Signed-off-by: Xu Guangxin Signed-off-by: Linjie Fu Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b8492452d53293b2ac8c842877fadf7925fc950 --- libavcodec/x86/hevc_add_res.asm | 40 +--- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/libavcodec/x86/hevc_add_res.asm b/libavcodec/x86/hevc_add_res.asm index e5e9f247bb..c6c40078a0 100644 --- a/libavcodec/x86/hevc_add_res.asm +++ b/libavcodec/x86/hevc_add_res.asm @@ -84,34 +84,36 @@ cglobal hevc_add_residual_4_8, 3, 3, 6 %endmacro %macro ADD_RES_SSE_16_32_8 3 -mova xm2, [r1+%1] +mova m1, [%2] +mova m2, m1 +punpcklbw m1, m0 +punpckhbw m2, m0 +mova xm5, [r1+%1] mova xm6, [r1+%1+16] %if cpuflag(avx2) -vinserti128 m2, m2, [r1+%1+32], 1 +vinserti128 m5, m5, [r1+%1+32], 1 vinserti128 m6, m6, [r1+%1+48], 1 %endif -psubw m1, m0, m2 -psubw m5, m0, m6 -packuswb m2, m6 -packuswb m1, m5 +paddswm1, m5 +paddswm2, m6 -mova xm4, [r1+%1+mmsize*2] +mova m3, [%3] +mova m4, m3 +punpcklbw m3, m0 +punpckhbw m4, m0 +mova xm5, [r1+%1+mmsize*2] mova xm6, [r1+%1+mmsize*2+16] %if cpuflag(avx2) -vinserti128 m4, m4, [r1+%1+96 ], 1 +vinserti128 m5, m5, [r1+%1+96], 1 vinserti128 m6, m6, [r1+%1+112], 1 %endif -psubw m3, m0, m4 -psubw m5, m0, m6 -packuswb m4, m6 -packuswb m3, m5 - -paddusb m2, [%2] -paddusb m4, [%3] -psubusb m2, m1 -psubusb m4, m3 -mova[%2], m2 -mova[%3], m4 +paddswm3, m5 +paddswm4, m6 + +packuswb m1, m2 +packuswb m3, m4 +mova[%2], m1 +mova[%3], m3 %endmacro ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/x86/hevc_add_res: Fix overflow in ADD_RES_MMX_4_8
ffmpeg | branch: master | Linjie Fu | Thu Mar 5 15:47:37 2020 +0800| [0da14ed09e557bd672881d35fd47c2d18df4ad4e] | committer: Anton Khirnov lavc/x86/hevc_add_res: Fix overflow in ADD_RES_MMX_4_8 Fix overflow for coeff -32768 in function ADD_RES_MMX_4_8 with no performance drop. ./checkasm --test=hevc_add_res --bench Mainline: - hevc_add_res.add_residual [OK] hevc_add_res_4x4_8_mmxext: 15.5 Add overflow test case: - hevc_add_res.add_residual [FAILED] After: - hevc_add_res.add_residual [OK] hevc_add_res_4x4_8_mmxext: 15.0 Signed-off-by: Xu Guangxin Signed-off-by: Linjie Fu Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0da14ed09e557bd672881d35fd47c2d18df4ad4e --- libavcodec/x86/hevc_add_res.asm | 23 +++ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/libavcodec/x86/hevc_add_res.asm b/libavcodec/x86/hevc_add_res.asm index 36d4d8e2e2..249c607a85 100644 --- a/libavcodec/x86/hevc_add_res.asm +++ b/libavcodec/x86/hevc_add_res.asm @@ -30,27 +30,26 @@ cextern pw_1023 %macro ADD_RES_MMX_4_8 0 mova m0, [r1] mova m2, [r1+8] -pxor m1, m1 -pxor m3, m3 -psubw m1, m0 -psubw m3, m2 -packuswb m0, m2 -packuswb m1, m3 -movd m2, [r0] +movd m1, [r0] movd m3, [r0+r2] -punpckldq m2, m3 -paddusb m0, m2 -psubusb m0, m1 +punpcklbw m1, m4 +punpcklbw m3, m4 + +paddswm0, m1 +paddswm2, m3 +packuswb m0, m4 +packuswb m2, m4 + movd[r0], m0 -psrlq m0, 32 -movd [r0+r2], m0 +movd [r0+r2], m2 %endmacro INIT_MMX mmxext ; void ff_hevc_add_residual_4_8_mmxext(uint8_t *dst, int16_t *res, ptrdiff_t stride) cglobal hevc_add_residual_4_8, 3, 3, 6 +pxor m4, m4 ADD_RES_MMX_4_8 add r1, 16 lea r0, [r0+r2*2] ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] tests/checkasm: add overflow test for hevc_add_res
ffmpeg | branch: master | Linjie Fu | Mon Mar 9 22:55:28 2020 +0800| [ddf6ca3a0ea2c2544c8170bd3f630c61fa343105] | committer: Anton Khirnov tests/checkasm: add overflow test for hevc_add_res Add overflow test for hevc_add_res when int16_t coeff = -32768. The result of C is good, while ASM is not. To verify: make fate-checkasm-hevc_add_res ffmpeg/tests/checkasm/checkasm --test=hevc_add_res ./checkasm --test=hevc_add_res checkasm: using random seed 679391863 MMXEXT: hevc_add_res_4x4_8_mmxext (hevc_add_res.c:69) - hevc_add_res.add_residual [FAILED] SSE2: hevc_add_res_8x8_8_sse2 (hevc_add_res.c:69) hevc_add_res_16x16_8_sse2 (hevc_add_res.c:69) hevc_add_res_32x32_8_sse2 (hevc_add_res.c:69) - hevc_add_res.add_residual [FAILED] AVX: hevc_add_res_8x8_8_avx (hevc_add_res.c:69) hevc_add_res_16x16_8_avx (hevc_add_res.c:69) hevc_add_res_32x32_8_avx (hevc_add_res.c:69) - hevc_add_res.add_residual [FAILED] AVX2: hevc_add_res_32x32_8_avx2 (hevc_add_res.c:69) - hevc_add_res.add_residual [FAILED] checkasm: 8 of 14 tests have failed Signed-off-by: Xu Guangxin Signed-off-by: Linjie Fu Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ddf6ca3a0ea2c2544c8170bd3f630c61fa343105 --- tests/checkasm/hevc_add_res.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/checkasm/hevc_add_res.c b/tests/checkasm/hevc_add_res.c index a68d5745c8..0a3bcbb706 100644 --- a/tests/checkasm/hevc_add_res.c +++ b/tests/checkasm/hevc_add_res.c @@ -42,7 +42,7 @@ AV_WN16A(buf + j * 2, rnd() & 0x3FF); \ } while (0) -static void compare_add_res(int size, ptrdiff_t stride) +static void compare_add_res(int size, ptrdiff_t stride, int overflow_test) { LOCAL_ALIGNED_32(int16_t, res0, [32 * 32]); LOCAL_ALIGNED_32(int16_t, res1, [32 * 32]); @@ -53,6 +53,8 @@ static void compare_add_res(int size, ptrdiff_t stride) randomize_buffers(res0, size); randomize_buffers2(dst0, size); +if (overflow_test) +res0[0] = 0x8000; memcpy(res1, res0, sizeof(*res0) * size); memcpy(dst1, dst0, sizeof(int16_t) * size); @@ -73,7 +75,9 @@ static void check_add_res(HEVCDSPContext h, int bit_depth) ptrdiff_t stride = block_size << (bit_depth > 8); if (check_func(h.add_residual[i - 2], "hevc_add_res_%dx%d_%d", block_size, block_size, bit_depth)) { -compare_add_res(size, stride); +compare_add_res(size, stride, 0); +// overflow test for res = -32768 +compare_add_res(size, stride, 1); } } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] checkasm/hevc_add_res: prepare test data only if the fuction is not tested
ffmpeg | branch: master | Linjie Fu | Mon Mar 9 22:54:59 2020 +0800| [69b9548dd63dfbe97a19ca9b93488cebe80f6ef9] | committer: Anton Khirnov checkasm/hevc_add_res: prepare test data only if the fuction is not tested check_func will return NULL for functions that have already been tested. If the func is tested and skipped (which happens several times), there is no need to prepare data(randomize_buffers and memcpy). Move relative code in compare_add_res(), prepare data and do check only if the function is not tested. Signed-off-by: Linjie Fu Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=69b9548dd63dfbe97a19ca9b93488cebe80f6ef9 --- tests/checkasm/hevc_add_res.c | 33 - 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/tests/checkasm/hevc_add_res.c b/tests/checkasm/hevc_add_res.c index e92c6b427b..a68d5745c8 100644 --- a/tests/checkasm/hevc_add_res.c +++ b/tests/checkasm/hevc_add_res.c @@ -42,31 +42,38 @@ AV_WN16A(buf + j * 2, rnd() & 0x3FF); \ } while (0) -static void check_add_res(HEVCDSPContext h, int bit_depth) +static void compare_add_res(int size, ptrdiff_t stride) { -int i; LOCAL_ALIGNED_32(int16_t, res0, [32 * 32]); LOCAL_ALIGNED_32(int16_t, res1, [32 * 32]); LOCAL_ALIGNED_32(uint8_t, dst0, [32 * 32 * 2]); LOCAL_ALIGNED_32(uint8_t, dst1, [32 * 32 * 2]); +declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, int16_t *res, ptrdiff_t stride); + +randomize_buffers(res0, size); +randomize_buffers2(dst0, size); +memcpy(res1, res0, sizeof(*res0) * size); +memcpy(dst1, dst0, sizeof(int16_t) * size); + +call_ref(dst0, res0, stride); +call_new(dst1, res1, stride); +if (memcmp(dst0, dst1, size)) +fail(); +bench_new(dst1, res1, stride); +} + +static void check_add_res(HEVCDSPContext h, int bit_depth) +{ +int i; + for (i = 2; i <= 5; i++) { int block_size = 1 << i; int size = block_size * block_size; ptrdiff_t stride = block_size << (bit_depth > 8); -declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, int16_t *res, ptrdiff_t stride); - -randomize_buffers(res0, size); -randomize_buffers2(dst0, size); -memcpy(res1, res0, sizeof(*res0) * size); -memcpy(dst1, dst0, sizeof(int16_t) * size); if (check_func(h.add_residual[i - 2], "hevc_add_res_%dx%d_%d", block_size, block_size, bit_depth)) { -call_ref(dst0, res0, stride); -call_new(dst1, res1, stride); -if (memcmp(dst0, dst1, size)) -fail(); -bench_new(dst1, res1, stride); +compare_add_res(size, stride); } } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/pthread_frame: Update user context in ff_frame_thread_free
ffmpeg | branch: master | Linjie Fu | Fri Dec 27 16:47:35 2019 +0800| [091341f2ab5bd35ca1a2aae90503adc74f8d3523] | committer: Anton Khirnov lavc/pthread_frame: Update user context in ff_frame_thread_free Resolution/format changes lead to re-initialization of hardware accelerations(vaapi/dxva2/..) with new hwaccel_priv_data in the worker-thread. But hwaccel_priv_data in user context won't be updated until the resolution changing frame is output. A termination with "-vframes" just after the reinit will lead to: 1. memory leak in worker-thread. 2. double free in user-thread. Update user context in ff_frame_thread_free with the last thread submit_packet() was called on. To reproduce: ffmpeg -hwaccel vaapi(dxva2) -v verbose -i fate-suite/h264/reinit-large_420_8-to-small_420_8.h264 -pix_fmt nv12 -f rawvideo -vsync passthrough -vframes 47 -y out.yuv Signed-off-by: Linjie Fu Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=091341f2ab5bd35ca1a2aae90503adc74f8d3523 --- libavcodec/pthread_frame.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index b5bd494474..172731a98e 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -658,6 +658,13 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count) park_frame_worker_threads(fctx, thread_count); +if (fctx->prev_thread && avctx->internal->hwaccel_priv_data != + fctx->prev_thread->avctx->internal->hwaccel_priv_data) { +if (update_context_from_thread(avctx, fctx->prev_thread->avctx, 1) < 0) { +av_log(avctx, AV_LOG_ERROR, "Failed to update user thread.\n"); +} +} + if (fctx->prev_thread && fctx->prev_thread != fctx->threads) if (update_context_from_thread(fctx->threads->avctx, fctx->prev_thread->avctx, 0) < 0) { av_log(avctx, AV_LOG_ERROR, "Final thread update failed\n"); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/libopenh264enc: fix the if-else coding style
ffmpeg | branch: master | Linjie Fu | Mon Apr 6 19:14:45 2020 +0800| [917d28d5ff118cad5babd50f68fe9490e0c54d55] | committer: Anton Khirnov lavc/libopenh264enc: fix the if-else coding style Signed-off-by: Linjie Fu Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=917d28d5ff118cad5babd50f68fe9490e0c54d55 --- libavcodec/libopenh264enc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c index ae6d17c6d2..dd5d4ee7b9 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -199,8 +199,7 @@ FF_ENABLE_DEPRECATION_WARNINGS param.sSpatialLayers[0].eAspectRatio = asp_idc[i]; } param.sSpatialLayers[0].bAspectRatioPresent = true; -} -else { +} else { param.sSpatialLayers[0].bAspectRatioPresent = false; } #endif @@ -227,7 +226,7 @@ FF_ENABLE_DEPRECATION_WARNINGS #endif if (s->slice_mode == SM_SIZELIMITED_SLICE) { -if (s->max_nal_size){ +if (s->max_nal_size) { param.uiMaxNalSize = s->max_nal_size; #if OPENH264_VER_AT_LEAST(1, 6) param.sSpatialLayers[0].sSliceArgument.uiSliceSizeConstraint = s->max_nal_size; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vaapi_decode: fix the build failure when hevc_vaapi is disabled
ffmpeg | branch: master | Linjie Fu | Sun Apr 12 23:47:00 2020 +0800| [798ab1d03e8df06f2c7dd9a01bb303f368df5de4] | committer: Mark Thompson lavc/vaapi_decode: fix the build failure when hevc_vaapi is disabled Verified with ./configure --enable-vaapi --disable-hwaccel=hevc_vaapi Failure reported in: http://fate.ffmpeg.org/report.cgi?time=20200401135031&slot=x86_64-archlinux-gcc-random Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=798ab1d03e8df06f2c7dd9a01bb303f368df5de4 --- libavcodec/vaapi_decode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index 54a0ecb47a..5e4f62baad 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -389,7 +389,7 @@ static const struct { MAP(HEVC,HEVC_MAIN_STILL_PICTURE, HEVCMain), #endif -#if VA_CHECK_VERSION(1, 2, 0) +#if VA_CHECK_VERSION(1, 2, 0) && CONFIG_HEVC_VAAPI_HWACCEL MAP(HEVC,HEVC_REXT, None, ff_vaapi_parse_hevc_rext_profile ), #endif ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] tests/api/api-h264-slice-test: remove unused bool header
ffmpeg | branch: master | Linjie Fu | Wed Apr 1 12:52:24 2020 +0800| [e3510fb1780924d248cd2527c662a0f5ec71ed05] | committer: Josh de Kock tests/api/api-h264-slice-test: remove unused bool header Signed-off-by: Linjie Fu Signed-off-by: Josh de Kock > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e3510fb1780924d248cd2527c662a0f5ec71ed05 --- tests/api/api-h264-slice-test.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/api/api-h264-slice-test.c b/tests/api/api-h264-slice-test.c index dee93b8349..b7aa405b0d 100644 --- a/tests/api/api-h264-slice-test.c +++ b/tests/api/api-h264-slice-test.c @@ -24,7 +24,6 @@ #include "config.h" -#include #include #include #include ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/libopenh264enc: set slice_mode option to deprecated
ffmpeg | branch: master | Linjie Fu | Wed Apr 29 11:00:50 2020 +0800| [59a9204b8a11a1428367d6e1ddc0ef123cfddb61] | committer: Martin Storsjö lavc/libopenh264enc: set slice_mode option to deprecated "slice mode" option seems to be unnecessary since it could be determined by -slices/max_nal_size. default:SM_FIXEDSLCNUM_SLICE mode with cpu-number slices. -slices N: SM_FIXEDSLCNUM_SLICE mode with N slices. -max_nal_size: SM_SIZELIMITED_SLICE mode with limited size slices. Add FF_API_OPENH264_SLICE_MODE macro to remove this option after LIBAVCODEC_VERSION_MAJOR = 59. Signed-off-by: Linjie Fu Signed-off-by: Martin Storsjö > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=59a9204b8a11a1428367d6e1ddc0ef123cfddb61 --- libavcodec/libopenh264enc.c | 7 +-- libavcodec/version.h| 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c index 29269f9513..3bb3cceb64 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -56,11 +56,13 @@ typedef struct SVCContext { #define OFFSET(x) offsetof(SVCContext, x) #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM +#define DEPRECATED AV_OPT_FLAG_DEPRECATED static const AVOption options[] = { +#if FF_API_OPENH264_SLICE_MODE #if OPENH264_VER_AT_LEAST(1, 6) -{ "slice_mode", "set slice mode", OFFSET(slice_mode), AV_OPT_TYPE_INT, { .i64 = SM_FIXEDSLCNUM_SLICE }, SM_SINGLE_SLICE, SM_RESERVED, VE, "slice_mode" }, +{ "slice_mode", "set slice mode, use slices/max_nal_size", OFFSET(slice_mode), AV_OPT_TYPE_INT, { .i64 = SM_FIXEDSLCNUM_SLICE }, SM_SINGLE_SLICE, SM_RESERVED, VE|DEPRECATED, "slice_mode" }, #else -{ "slice_mode", "set slice mode", OFFSET(slice_mode), AV_OPT_TYPE_INT, { .i64 = SM_AUTO_SLICE }, SM_SINGLE_SLICE, SM_RESERVED, VE, "slice_mode" }, +{ "slice_mode", "set slice mode, use slices/max_nal_size", OFFSET(slice_mode), AV_OPT_TYPE_INT, { .i64 = SM_AUTO_SLICE }, SM_SINGLE_SLICE, SM_RESERVED, VE|DEPRECATED, "slice_mode" }, #endif { "fixed", "a fixed number of slices", 0, AV_OPT_TYPE_CONST, { .i64 = SM_FIXEDSLCNUM_SLICE }, 0, 0, VE, "slice_mode" }, #if OPENH264_VER_AT_LEAST(1, 6) @@ -70,6 +72,7 @@ static const AVOption options[] = { { "rowmb", "one slice per row of macroblocks", 0, AV_OPT_TYPE_CONST, { .i64 = SM_ROWMB_SLICE }, 0, 0, VE, "slice_mode" }, { "auto", "automatic number of slices according to number of threads", 0, AV_OPT_TYPE_CONST, { .i64 = SM_AUTO_SLICE }, 0, 0, VE, "slice_mode" }, { "dyn", "Dynamic slicing", 0, AV_OPT_TYPE_CONST, { .i64 = SM_DYN_SLICE }, 0, 0, VE, "slice_mode" }, +#endif #endif { "loopfilter", "enable loop filter", OFFSET(loopfilter), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE }, { "profile", "set profile restrictions", OFFSET(profile), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, VE }, diff --git a/libavcodec/version.h b/libavcodec/version.h index 3de16c884c..521342 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -135,6 +135,9 @@ #ifndef FF_API_UNSANITIZED_BITRATES #define FF_API_UNSANITIZED_BITRATES (LIBAVCODEC_VERSION_MAJOR < 59) #endif +#ifndef FF_API_OPENH264_SLICE_MODE +#define FF_API_OPENH264_SLICE_MODE (LIBAVCODEC_VERSION_MAJOR < 59) +#endif #endif /* AVCODEC_VERSION_H */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/libopenh264enc: prompt slice number changing inside libopenh264
ffmpeg | branch: master | Linjie Fu | Wed Apr 29 11:00:49 2020 +0800| [9310361252c88bcab74a7ccbe2c910c7a1a37397] | committer: Martin Storsjö lavc/libopenh264enc: prompt slice number changing inside libopenh264 Libopenh264enc would set the slice according to the number of cpu cores if uiSliceNum equals to 0 (auto) in SM_FIXEDSLCNUM_SLICE mode. Prompt a warning for user to catch this. Signed-off-by: Linjie Fu Signed-off-by: Martin Storsjö > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9310361252c88bcab74a7ccbe2c910c7a1a37397 --- libavcodec/libopenh264enc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c index dc3bd536a8..29269f9513 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -244,6 +244,8 @@ FF_ENABLE_DEPRECATION_WARNINGS param.sSpatialLayers[0].sSliceCfg.uiSliceMode = s->slice_mode; param.sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceNum = avctx->slices; #endif +if (avctx->slices == 0 && s->slice_mode == SM_FIXEDSLCNUM_SLICE) +av_log(avctx, AV_LOG_WARNING, "Slice count will be set automatically\n"); if (s->slice_mode == SM_SIZELIMITED_SLICE) { if (s->max_nal_size) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/libopenh264enc: Add qmin/qmax support
ffmpeg | branch: master | Linjie Fu | Wed Apr 29 11:00:46 2020 +0800| [433ece8c8b62e092601ee9580029ba0e6e48ff58] | committer: Martin Storsjö lavc/libopenh264enc: Add qmin/qmax support Clip iMinQp/iMaxQp to (1, 51) for user specified qp range. If not set, leave iMinQp/iMaxQp untouched and use the values (0, 51) initialized in FillDefault(), and the QP range would be adjusted to the defaults inside libopenh264 library according to the iUsageType, (12, 42) for iUsageType == CAMERA_VIDEO_REAL_TIME which is default. <https://github.com/cisco/openh264/blob/master/codec/encoder/core/src/encoder_ext.cpp#L375> Signed-off-by: Linjie Fu Signed-off-by: Martin Storsjö > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=433ece8c8b62e092601ee9580029ba0e6e48ff58 --- libavcodec/libopenh264enc.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c index dd5d4ee7b9..265eb9c941 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -135,6 +135,10 @@ FF_ENABLE_DEPRECATION_WARNINGS param.iTargetBitrate = avctx->bit_rate; param.iMaxBitrate= FFMAX(avctx->rc_max_rate, avctx->bit_rate); param.iRCMode= RC_QUALITY_MODE; +if (avctx->qmax >= 0) +param.iMaxQp = av_clip(avctx->qmax, 1, 51); +if (avctx->qmin >= 0) +param.iMinQp = av_clip(avctx->qmin, 1, param.iMaxQp); param.iTemporalLayerNum = 1; param.iSpatialLayerNum = 1; param.bEnableDenoise = 0; @@ -331,6 +335,12 @@ static int svc_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, return 0; } +static const AVCodecDefault svc_enc_defaults[] = { +{ "qmin", "-1"}, +{ "qmax", "-1"}, +{ NULL }, +}; + AVCodec ff_libopenh264_encoder = { .name = "libopenh264", .long_name = NULL_IF_CONFIG_SMALL("OpenH264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), @@ -344,6 +354,7 @@ AVCodec ff_libopenh264_encoder = { .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }, +.defaults = svc_enc_defaults, .priv_class = &class, .wrapper_name = "libopenh264", }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/libopenh264enc: add bit rate control select support
ffmpeg | branch: master | Linjie Fu | Wed Apr 29 11:00:48 2020 +0800| [75fc3f97b0073d0ff57b4bd1e5ce8b36a5f9ac14] | committer: Martin Storsjö lavc/libopenh264enc: add bit rate control select support RC_BITRATE_MODE: set BITS_EXCEEDED to iCurrentBitsLevel and allows QP adjust in RcCalculatePictureQp(). RC_BUFFERBASED_MODE: use buffer status to adjust the video quality. RC_TIMESTAMP_MODE: bit rate control based on timestamp, introduced in release 1.4. Default to use RC_QUALITY_MODE. Signed-off-by: Linjie Fu Signed-off-by: Martin Storsjö > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=75fc3f97b0073d0ff57b4bd1e5ce8b36a5f9ac14 --- libavcodec/libopenh264enc.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c index 245752d71e..dc3bd536a8 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -49,6 +49,9 @@ typedef struct SVCContext { int skip_frames; int skipped; int cabac; + +// rate control mode +int rc_mode; } SVCContext; #define OFFSET(x) offsetof(SVCContext, x) @@ -73,6 +76,16 @@ static const AVOption options[] = { { "max_nal_size", "set maximum NAL size in bytes", OFFSET(max_nal_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, { "allow_skip_frames", "allow skipping frames to hit the target bitrate", OFFSET(skip_frames), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, { "cabac", "Enable cabac", OFFSET(cabac), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, + +{ "rc_mode", "Select rate control mode", OFFSET(rc_mode), AV_OPT_TYPE_INT, { .i64 = RC_QUALITY_MODE }, RC_OFF_MODE, RC_TIMESTAMP_MODE, VE, "rc_mode" }, +{ "off", "bit rate control off", 0, AV_OPT_TYPE_CONST, { .i64 = RC_OFF_MODE }, 0, 0, VE, "rc_mode" }, +{ "quality", "quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RC_QUALITY_MODE }, 0, 0, VE, "rc_mode" }, +{ "bitrate", "bitrate mode", 0, AV_OPT_TYPE_CONST, { .i64 = RC_BITRATE_MODE }, 0, 0, VE, "rc_mode" }, +{ "buffer","using buffer status to adjust the video quality (no bitrate control)", 0, AV_OPT_TYPE_CONST, { .i64 = RC_BUFFERBASED_MODE }, 0, 0, VE, "rc_mode" }, +#if OPENH264_VER_AT_LEAST(1, 4) +{ "timestamp", "bit rate control based on timestamp", 0, AV_OPT_TYPE_CONST, { .i64 = RC_TIMESTAMP_MODE }, 0, 0, VE, "rc_mode" }, +#endif + { NULL } }; @@ -136,7 +149,7 @@ FF_ENABLE_DEPRECATION_WARNINGS param.iPicHeight = avctx->height; param.iTargetBitrate = avctx->bit_rate > 0 ? avctx->bit_rate : TARGET_BITRATE_DEFAULT; param.iMaxBitrate= FFMAX(avctx->rc_max_rate, avctx->bit_rate); -param.iRCMode= RC_QUALITY_MODE; +param.iRCMode= s->rc_mode; if (avctx->qmax >= 0) param.iMaxQp = av_clip(avctx->qmax, 1, 51); if (avctx->qmin >= 0) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/libopenh264enc: add default gop size and bit rate
ffmpeg | branch: master | Linjie Fu | Wed Apr 29 11:00:47 2020 +0800| [e5f097eca78342bf34a70f4c43c61238c8ae41c2] | committer: Martin Storsjö lavc/libopenh264enc: add default gop size and bit rate It would be 200kbps bitrate with gop size = 12 by default which generated too many IDR frames in rather low bit rate. The quality would be poor. Set these default values to -1 to check whether it's specified by user explicitly. Use 2Mbps bitrate as nvenc sugguested, and leave gop size untouched in libopenh264. Signed-off-by: Linjie Fu Signed-off-by: Martin Storsjö > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e5f097eca78342bf34a70f4c43c61238c8ae41c2 --- libavcodec/libopenh264enc.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c index 265eb9c941..245752d71e 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -37,6 +37,8 @@ #define SM_SIZELIMITED_SLICE SM_DYN_SLICE #endif +#define TARGET_BITRATE_DEFAULT 2*1000*1000 + typedef struct SVCContext { const AVClass *av_class; ISVCEncoder *encoder; @@ -132,7 +134,7 @@ FF_ENABLE_DEPRECATION_WARNINGS param.fMaxFrameRate = 1/av_q2d(avctx->time_base); param.iPicWidth = avctx->width; param.iPicHeight = avctx->height; -param.iTargetBitrate = avctx->bit_rate; +param.iTargetBitrate = avctx->bit_rate > 0 ? avctx->bit_rate : TARGET_BITRATE_DEFAULT; param.iMaxBitrate= FFMAX(avctx->rc_max_rate, avctx->bit_rate); param.iRCMode= RC_QUALITY_MODE; if (avctx->qmax >= 0) @@ -147,7 +149,8 @@ FF_ENABLE_DEPRECATION_WARNINGS param.bEnableFrameSkip = s->skip_frames; param.bEnableLongTermReference = 0; param.iLtrMarkPeriod = 30; -param.uiIntraPeriod = avctx->gop_size; +if (avctx->gop_size >= 0) +param.uiIntraPeriod = avctx->gop_size; #if OPENH264_VER_AT_LEAST(1, 4) param.eSpsPpsIdStrategy = CONSTANT_ID; #else @@ -336,6 +339,8 @@ static int svc_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, } static const AVCodecDefault svc_enc_defaults[] = { +{ "b", "0" }, +{ "g", "-1"}, { "qmin", "-1"}, { "qmax", "-1"}, { NULL }, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vaapi_encode: add FF_CODEC_CAP_INIT_CLEANUP caps for encoders
ffmpeg | branch: master | Linjie Fu | Tue Mar 31 23:34:00 2020 +0800| [2b3206891649f317c20993411efef4bee39ae784] | committer: James Almer lavc/vaapi_encode: add FF_CODEC_CAP_INIT_CLEANUP caps for encoders ff_vaapi_encode_close() is not enough to free the resources like cbs if initialization failure happens after codec->configure (except for vp8/vp9). We need to call avctx->codec->close() to deallocate, otherwise memory leak happens. Add FF_CODEC_CAP_INIT_CLEANUP for vaapi encoders and deallocate the resources at free_and_end inside avcodec_open2(). Reviewed-by: Timo Rothenpieler Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2b3206891649f317c20993411efef4bee39ae784 --- libavcodec/vaapi_encode.c | 1 - libavcodec/vaapi_encode_h264.c | 1 + libavcodec/vaapi_encode_h265.c | 1 + libavcodec/vaapi_encode_mjpeg.c | 1 + libavcodec/vaapi_encode_mpeg2.c | 1 + libavcodec/vaapi_encode_vp8.c | 1 + libavcodec/vaapi_encode_vp9.c | 1 + 7 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index f551967ad6..cb05ebd774 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -2366,7 +2366,6 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx) return 0; fail: -ff_vaapi_encode_close(avctx); return err; } diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c index 67b1ecae1b..e195650ef7 100644 --- a/libavcodec/vaapi_encode_h264.c +++ b/libavcodec/vaapi_encode_h264.c @@ -1356,6 +1356,7 @@ AVCodec ff_h264_vaapi_encoder = { .close = &vaapi_encode_h264_close, .priv_class = &vaapi_encode_h264_class, .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE, +.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .defaults = vaapi_encode_h264_defaults, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_VAAPI, diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c index e20e8cbdd0..92e0510911 100644 --- a/libavcodec/vaapi_encode_h265.c +++ b/libavcodec/vaapi_encode_h265.c @@ -1292,6 +1292,7 @@ AVCodec ff_hevc_vaapi_encoder = { .close = &vaapi_encode_h265_close, .priv_class = &vaapi_encode_h265_class, .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE, +.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .defaults = vaapi_encode_h265_defaults, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_VAAPI, diff --git a/libavcodec/vaapi_encode_mjpeg.c b/libavcodec/vaapi_encode_mjpeg.c index 2b5d3bf4f9..8b441d36c3 100644 --- a/libavcodec/vaapi_encode_mjpeg.c +++ b/libavcodec/vaapi_encode_mjpeg.c @@ -565,6 +565,7 @@ AVCodec ff_mjpeg_vaapi_encoder = { .priv_class = &vaapi_encode_mjpeg_class, .capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_INTRA_ONLY, +.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .defaults = vaapi_encode_mjpeg_defaults, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_VAAPI, diff --git a/libavcodec/vaapi_encode_mpeg2.c b/libavcodec/vaapi_encode_mpeg2.c index 0398c4cd8c..02c76552ef 100644 --- a/libavcodec/vaapi_encode_mpeg2.c +++ b/libavcodec/vaapi_encode_mpeg2.c @@ -702,6 +702,7 @@ AVCodec ff_mpeg2_vaapi_encoder = { .close = &vaapi_encode_mpeg2_close, .priv_class = &vaapi_encode_mpeg2_class, .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE, +.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .defaults = vaapi_encode_mpeg2_defaults, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_VAAPI, diff --git a/libavcodec/vaapi_encode_vp8.c b/libavcodec/vaapi_encode_vp8.c index 16cbcbd81c..cff926baae 100644 --- a/libavcodec/vaapi_encode_vp8.c +++ b/libavcodec/vaapi_encode_vp8.c @@ -257,6 +257,7 @@ AVCodec ff_vp8_vaapi_encoder = { .close = &ff_vaapi_encode_close, .priv_class = &vaapi_encode_vp8_class, .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE, +.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .defaults = vaapi_encode_vp8_defaults, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_VAAPI, diff --git a/libavcodec/vaapi_encode_vp9.c b/libavcodec/vaapi_encode_vp9.c index d05319ef39..8514b85991 100644 --- a/libavcodec/vaapi_encode_vp9.c +++ b/libavcodec/vaapi_encode_vp9.c @@ -291,6 +291,7 @@ AVCodec ff_vp9_vaapi_encoder = { .close = &ff_vaapi_encode_close, .priv_class = &vaapi_encode_vp9_class, .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE, +.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .defaults = vaapi_encode_vp9_defaults, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_VAAPI, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmp
[FFmpeg-cvslog] lavc/vp9: fix reference frame dimensions check for SINGLE_REFERENCE mode
ffmpeg | branch: master | Linjie Fu | Tue Mar 17 22:53:58 2020 +0800| [9473268cfb580dccd3f1f3be338cd22661ef791e] | committer: Ronald S. Bultje lavc/vp9: fix reference frame dimensions check for SINGLE_REFERENCE mode With the description in frame size with refs semantics (SPEC 7.2.5), it is a requirement of bitstream conformance that for at least one reference frame has the valid dimensions. Modify the check to make sure the decoder works well in SINGLE_REFERENCE mode that not all reference frames have valid dimensions. Check and error out if invalid reference frame is used in inter_recon. One of the failure case is a 480x272 inter frame (SINGLE_REFERENCE mode) with following reference pool: 0. 960x544LASTvalid 1. 1920x1088 GOLDEN invalid, but not used in single reference mode 2. 1920x1088 ALTREF invalid, but not used in single reference mode 3~7 ... Unused Identical logic in libvpx: <https://github.com/webmproject/libvpx/blob/master/vp9/decoder/vp9_decodeframe.c#L736> Signed-off-by: Linjie Fu Signed-off-by: Ronald S. Bultje > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9473268cfb580dccd3f1f3be338cd22661ef791e --- libavcodec/vp9.c | 20 ++-- libavcodec/vp9dec.h | 5 + libavcodec/vp9recon.c | 10 ++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c index d34cbf0040..6c801edca7 100644 --- a/libavcodec/vp9.c +++ b/libavcodec/vp9.c @@ -804,6 +804,7 @@ static int decode_frame_header(AVCodecContext *avctx, /* check reference frames */ if (!s->s.h.keyframe && !s->s.h.intraonly) { +int valid_ref_frame = 0; for (i = 0; i < 3; i++) { AVFrame *ref = s->s.refs[s->s.h.refidx[i]].f; int refw = ref->width, refh = ref->height; @@ -817,17 +818,25 @@ static int decode_frame_header(AVCodecContext *avctx, } else if (refw == w && refh == h) { s->mvscale[i][0] = s->mvscale[i][1] = 0; } else { +/* Check to make sure at least one of frames that */ +/* this frame references has valid dimensions */ if (w * 2 < refw || h * 2 < refh || w > 16 * refw || h > 16 * refh) { -av_log(avctx, AV_LOG_ERROR, +av_log(avctx, AV_LOG_WARNING, "Invalid ref frame dimensions %dx%d for frame size %dx%d\n", refw, refh, w, h); -return AVERROR_INVALIDDATA; +s->mvscale[i][0] = s->mvscale[i][1] = REF_INVALID_SCALE; +continue; } s->mvscale[i][0] = (refw << 14) / w; s->mvscale[i][1] = (refh << 14) / h; s->mvstep[i][0] = 16 * s->mvscale[i][0] >> 14; s->mvstep[i][1] = 16 * s->mvscale[i][1] >> 14; } +valid_ref_frame++; +} +if (!valid_ref_frame) { +av_log(avctx, AV_LOG_ERROR, "No valid reference frame is found, bitstream not supported\n"); +return AVERROR_INVALIDDATA; } } @@ -1622,6 +1631,7 @@ FF_ENABLE_DEPRECATION_WARNINGS s->td[i].eob = s->td[i].eob_base; s->td[i].uveob[0] = s->td[i].uveob_base[0]; s->td[i].uveob[1] = s->td[i].uveob_base[1]; +s->td[i].error_info = 0; } #if HAVE_THREADS @@ -1678,6 +1688,12 @@ FF_ENABLE_DEPRECATION_WARNINGS } while (s->pass++ == 1); ff_thread_report_progress(&s->s.frames[CUR_FRAME].tf, INT_MAX, 0); +if (s->td->error_info < 0) { +av_log(avctx, AV_LOG_ERROR, "Failed to decode tile data\n"); +s->td->error_info = 0; +return AVERROR_INVALIDDATA; +} + finish: // ref frame setup for (i = 0; i < 8; i++) { diff --git a/libavcodec/vp9dec.h b/libavcodec/vp9dec.h index de02b146f0..e203666bb4 100644 --- a/libavcodec/vp9dec.h +++ b/libavcodec/vp9dec.h @@ -36,6 +36,8 @@ #include "vp9dsp.h" #include "vp9shared.h" +#define REF_INVALID_SCALE 0x + enum MVJoint { MV_JOINT_ZERO, MV_JOINT_H, @@ -221,6 +223,9 @@ struct VP9TileData { struct { int x, y; } min_mv, max_mv; int16_t *block_base, *block, *uvblock_base[2], *uvblock[2]; uint8_t *eob_base, *uveob_base[2], *eob, *uveob[2]; + +// error message +int error_info; }; void ff_vp9_fill_mv(VP9TileData *td, VP56mv *mv, int mode, int sb); diff --git a/libavcodec/vp9recon.c b/libavcodec/vp9recon.c index 49bb04e1f4..9a4e7c7a03 100644 --- a/libavcodec/vp9recon.c +++ b/libavcodec/vp9recon.c @@ -572,6 +572,16 @@ static av_always_inline void inter_recon(VP9TileData *td, int bytesperpixel) VP9Block *b = td->b; int row = td->
[FFmpeg-cvslog] MAINTAINERS: Add myself to libopenh264enc
ffmpeg | branch: master | Linjie Fu | Thu Apr 30 09:12:44 2020 +0800| [74aa332157b5098e0a2cfd43ae71febb755b9352] | committer: Michael Niedermayer MAINTAINERS: Add myself to libopenh264enc Reviewed-by: Martin Storsjö Signed-off-by: Linjie Fu Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=74aa332157b5098e0a2cfd43ae71febb755b9352 --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 06956f8741..96654f1258 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -194,6 +194,7 @@ Codecs: libdavs2.cHuiwen Ren libgsm.c Michel Bardiaux libkvazaar.c Arttu Ylä-Outinen + libopenh264enc.c Martin Storsjo, Linjie Fu libopenjpeg.c Jaikrishnan Menon libopenjpegenc.c Michael Bradshaw libtheoraenc.cDavid Conrad ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/libopenh264enc: Allow specifying the profile through AVCodecContext
ffmpeg | branch: master | Linjie Fu | Wed May 6 21:47:51 2020 +0800| [e3e2702d400e047d7a12b3c4f7ee666ffdafd090] | committer: Linjie Fu lavc/libopenh264enc: Allow specifying the profile through AVCodecContext And determine the profile with following priority: 1. s->profile; then 2. avctx->profile; then 3. s->cabac; then 4. a default profile. This seems more natural in case user somehow sets both avctx->profile and s->profile. Reviewed-by: Martin Storsjö Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e3e2702d400e047d7a12b3c4f7ee666ffdafd090 --- libavcodec/libopenh264enc.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c index 12c71ca0e9..4c57fa1c89 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -182,6 +182,21 @@ FF_ENABLE_DEPRECATION_WARNINGS param.iEntropyCodingModeFlag = 0; param.iMultipleThreadIdc = avctx->thread_count; +/* Allow specifying the libopenh264 profile through AVCodecContext. */ +if (FF_PROFILE_UNKNOWN == s->profile && +FF_PROFILE_UNKNOWN != avctx->profile) +switch (avctx->profile) { +case FF_PROFILE_H264_HIGH: +case FF_PROFILE_H264_MAIN: +case FF_PROFILE_H264_CONSTRAINED_BASELINE: +s->profile = avctx->profile; +break; +default: +av_log(avctx, AV_LOG_WARNING, + "Unsupported avctx->profile: %d.\n", avctx->profile); +break; +} + if (s->profile == FF_PROFILE_UNKNOWN) s->profile = !s->cabac ? FF_PROFILE_H264_CONSTRAINED_BASELINE : #if OPENH264_VER_AT_LEAST(1, 8) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/libopenh264enc: Rewrite profile handling
ffmpeg | branch: master | Linjie Fu | Wed May 6 21:47:50 2020 +0800| [d3a7bdd4ac54349aea9150a234478635d50ebd87] | committer: Linjie Fu lavc/libopenh264enc: Rewrite profile handling Support the profiles "constrained_baseline" and "high" for libopenh264 version >= 1.8, support "constrained_baseline" and "main" for earlier version. If option not supported with current version, convert to constrained baseline with a warning for users. Reviewed-by: Martin Storsjö Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d3a7bdd4ac54349aea9150a234478635d50ebd87 --- libavcodec/libopenh264enc.c | 44 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c index 3bb3cceb64..12c71ca0e9 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -44,7 +44,7 @@ typedef struct SVCContext { ISVCEncoder *encoder; int slice_mode; int loopfilter; -char *profile; +int profile; int max_nal_size; int skip_frames; int skipped; @@ -75,7 +75,12 @@ static const AVOption options[] = { #endif #endif { "loopfilter", "enable loop filter", OFFSET(loopfilter), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE }, -{ "profile", "set profile restrictions", OFFSET(profile), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, VE }, +{ "profile", "set profile restrictions", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, 0x, VE, "profile" }, +#define PROFILE(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, { .i64 = value }, 0, 0, VE, "profile" +{ PROFILE("constrained_baseline", FF_PROFILE_H264_CONSTRAINED_BASELINE) }, +{ PROFILE("main", FF_PROFILE_H264_MAIN) }, +{ PROFILE("high", FF_PROFILE_H264_HIGH) }, +#undef PROFILE { "max_nal_size", "set maximum NAL size in bytes", OFFSET(max_nal_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, { "allow_skip_frames", "allow skipping frames to hit the target bitrate", OFFSET(skip_frames), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, { "cabac", "Enable cabac", OFFSET(cabac), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, @@ -176,10 +181,41 @@ FF_ENABLE_DEPRECATION_WARNINGS param.iLoopFilterDisableIdc = !s->loopfilter; param.iEntropyCodingModeFlag = 0; param.iMultipleThreadIdc = avctx->thread_count; -if (s->profile && !strcmp(s->profile, "main")) + +if (s->profile == FF_PROFILE_UNKNOWN) +s->profile = !s->cabac ? FF_PROFILE_H264_CONSTRAINED_BASELINE : +#if OPENH264_VER_AT_LEAST(1, 8) + FF_PROFILE_H264_HIGH; +#else + FF_PROFILE_H264_MAIN; +#endif + +switch (s->profile) { +#if OPENH264_VER_AT_LEAST(1, 8) +case FF_PROFILE_H264_HIGH: param.iEntropyCodingModeFlag = 1; -else if (!s->profile && s->cabac) +av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, " +"select EProfileIdc PRO_HIGH in libopenh264.\n"); +break; +#else +case FF_PROFILE_H264_MAIN: param.iEntropyCodingModeFlag = 1; +av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, " +"select EProfileIdc PRO_MAIN in libopenh264.\n"); +break; +#endif +case FF_PROFILE_H264_CONSTRAINED_BASELINE: +case FF_PROFILE_UNKNOWN: +param.iEntropyCodingModeFlag = 0; +av_log(avctx, AV_LOG_VERBOSE, "Using CAVLC, " + "select EProfileIdc PRO_BASELINE in libopenh264.\n"); +break; +default: +param.iEntropyCodingModeFlag = 0; +av_log(avctx, AV_LOG_WARNING, "Unsupported profile, " + "select EProfileIdc PRO_BASELINE in libopenh264.\n"); +break; +} param.sSpatialLayers[0].iVideoWidth = param.iPicWidth; param.sSpatialLayers[0].iVideoHeight= param.iPicHeight; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/libopenh264enc: Add coder option to replace cabac
ffmpeg | branch: master | Linjie Fu | Wed May 6 21:47:52 2020 +0800| [e4d37abcc13b236a544d37b9a8a4aa16bebe1fda] | committer: Linjie Fu lavc/libopenh264enc: Add coder option to replace cabac Set DEPRECATED flag to option cabac, replace with coder. The priority logic is: 1. s->coder; then 2. avctx->coder_type; then 3. s->cabac. Change the default option to -1 and allow the default cabac to be determined by profile. Add FF_API_OPENH264_CABAC macro for cabac to remove this option after LIBAVCODEC_VERSION_MAJOR = 59. Reviewed-by: Martin Storsjö Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e4d37abcc13b236a544d37b9a8a4aa16bebe1fda --- libavcodec/libopenh264enc.c | 40 +++- libavcodec/version.h| 3 +++ 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c index 4c57fa1c89..f63aa52348 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -48,7 +48,10 @@ typedef struct SVCContext { int max_nal_size; int skip_frames; int skipped; -int cabac; +#if FF_API_OPENH264_CABAC +int cabac; // deprecated +#endif +int coder; // rate control mode int rc_mode; @@ -83,7 +86,15 @@ static const AVOption options[] = { #undef PROFILE { "max_nal_size", "set maximum NAL size in bytes", OFFSET(max_nal_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, { "allow_skip_frames", "allow skipping frames to hit the target bitrate", OFFSET(skip_frames), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, -{ "cabac", "Enable cabac", OFFSET(cabac), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, +#if FF_API_OPENH264_CABAC +{ "cabac", "Enable cabac(deprecated, use coder)", OFFSET(cabac), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE|DEPRECATED }, +#endif +{ "coder", "Coder type", OFFSET(coder), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE, "coder" }, +{ "default", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, INT_MIN, INT_MAX, VE, "coder" }, +{ "cavlc",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "coder" }, +{ "cabac",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "coder" }, +{ "vlc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "coder" }, +{ "ac", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "coder" }, { "rc_mode", "Select rate control mode", OFFSET(rc_mode), AV_OPT_TYPE_INT, { .i64 = RC_QUALITY_MODE }, RC_OFF_MODE, RC_TIMESTAMP_MODE, VE, "rc_mode" }, { "off", "bit rate control off", 0, AV_OPT_TYPE_CONST, { .i64 = RC_OFF_MODE }, 0, 0, VE, "rc_mode" }, @@ -145,13 +156,6 @@ static av_cold int svc_encode_init(AVCodecContext *avctx) (*s->encoder)->GetDefaultParams(s->encoder, ¶m); -#if FF_API_CODER_TYPE -FF_DISABLE_DEPRECATION_WARNINGS -if (!s->cabac) -s->cabac = avctx->coder_type == FF_CODER_TYPE_AC; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - param.fMaxFrameRate = 1/av_q2d(avctx->time_base); param.iPicWidth = avctx->width; param.iPicHeight = avctx->height; @@ -197,12 +201,22 @@ FF_ENABLE_DEPRECATION_WARNINGS break; } -if (s->profile == FF_PROFILE_UNKNOWN) -s->profile = !s->cabac ? FF_PROFILE_H264_CONSTRAINED_BASELINE : +#if FF_API_CODER_TYPE && FF_API_OPENH264_CABAC +FF_DISABLE_DEPRECATION_WARNINGS +if (s->coder < 0 && avctx->coder_type == FF_CODER_TYPE_AC) +s->coder = 1; + +if (s->coder < 0) +s->coder = s->cabac; +FF_ENABLE_DEPRECATION_WARNINGS +#endif + +if (s->profile == FF_PROFILE_UNKNOWN && s->coder >= 0) +s->profile = s->coder == 0 ? FF_PROFILE_H264_CONSTRAINED_BASELINE : #if OPENH264_VER_AT_LEAST(1, 8) - FF_PROFILE_H264_HIGH; + FF_PROFILE_H264_HIGH; #else - FF_PROFILE_H264_MAIN; + FF_PROFILE_H264_MAIN; #endif switch (s->profile) { diff --git a/libavcodec/version.h b/libavcodec/version.h index 82255d7f38..9d260c80da 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -138,6 +138,9 @@ #ifndef FF_API_OPENH264_SLICE_MODE #define FF_API_OPENH264_SLICE_MODE (LIBAVCODEC_VERSION_MAJOR < 59) #endif +#ifndef FF_API_OPENH264_CABAC +#define FF_API_OPENH264_CABAC (LIBAVCODEC_VERSION_MAJOR < 59) +#endif #endif /* AVCODEC_VERSION_H */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/qsvdec: add decode support for HEVC 4:2:2 8-bit and 10-bit
ffmpeg | branch: master | Linjie Fu | Wed Feb 26 16:39:29 2020 +0800| [9723d7d523b0871159e56f8144d59bd35a0390e2] | committer: Linjie Fu lavc/qsvdec: add decode support for HEVC 4:2:2 8-bit and 10-bit Enables HEVC Range Extension decoding support (Linux) for 4:2:2 8/10 bit on ICL+ (gen11 +) platform. Restricted to linux only for now. Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9723d7d523b0871159e56f8144d59bd35a0390e2 --- libavcodec/qsv.c | 16 libavutil/hwcontext_qsv.c | 24 2 files changed, 40 insertions(+) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index db98c75073..171a8d6077 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -195,6 +195,12 @@ enum AVPixelFormat ff_qsv_map_fourcc(uint32_t fourcc) case MFX_FOURCC_NV12: return AV_PIX_FMT_NV12; case MFX_FOURCC_P010: return AV_PIX_FMT_P010; case MFX_FOURCC_P8: return AV_PIX_FMT_PAL8; +#if CONFIG_VAAPI +case MFX_FOURCC_YUY2: return AV_PIX_FMT_YUYV422; +#if QSV_VERSION_ATLEAST(1, 27) +case MFX_FOURCC_Y210: return AV_PIX_FMT_Y210; +#endif +#endif } return AV_PIX_FMT_NONE; } @@ -211,6 +217,16 @@ int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc) case AV_PIX_FMT_P010: *fourcc = MFX_FOURCC_P010; return AV_PIX_FMT_P010; +#if CONFIG_VAAPI +case AV_PIX_FMT_YUV422P: +*fourcc = MFX_FOURCC_YUY2; +return AV_PIX_FMT_YUYV422; +#if QSV_VERSION_ATLEAST(1, 27) +case AV_PIX_FMT_YUV422P10: +*fourcc = MFX_FOURCC_Y210; +return AV_PIX_FMT_Y210; +#endif +#endif default: return AVERROR(ENOSYS); } diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index b1b67400de..4306c6e3b9 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -44,6 +44,10 @@ #include "pixdesc.h" #include "time.h" +#define QSV_VERSION_ATLEAST(MAJOR, MINOR) \ +(MFX_VERSION_MAJOR > (MAJOR) || \ + MFX_VERSION_MAJOR == (MAJOR) && MFX_VERSION_MINOR >= (MINOR)) + typedef struct QSVDevicePriv { AVBufferRef *child_device_ctx; } QSVDevicePriv; @@ -103,6 +107,14 @@ static const struct { { AV_PIX_FMT_BGRA, MFX_FOURCC_RGB4 }, { AV_PIX_FMT_P010, MFX_FOURCC_P010 }, { AV_PIX_FMT_PAL8, MFX_FOURCC_P8 }, +#if CONFIG_VAAPI +{ AV_PIX_FMT_YUYV422, + MFX_FOURCC_YUY2 }, +#if QSV_VERSION_ATLEAST(1, 27) +{ AV_PIX_FMT_Y210, + MFX_FOURCC_Y210 }, +#endif +#endif }; static uint32_t qsv_fourcc_from_pix_fmt(enum AVPixelFormat pix_fmt) @@ -773,7 +785,19 @@ static int map_frame_to_surface(const AVFrame *frame, mfxFrameSurface1 *surface) surface->Data.R = frame->data[0] + 2; surface->Data.A = frame->data[0] + 3; break; +#if CONFIG_VAAPI +case AV_PIX_FMT_YUYV422: +surface->Data.Y = frame->data[0]; +surface->Data.U = frame->data[0] + 1; +surface->Data.V = frame->data[0] + 3; +break; +case AV_PIX_FMT_Y210: +surface->Data.Y16 = (mfxU16 *)frame->data[0]; +surface->Data.U16 = (mfxU16 *)frame->data[0] + 1; +surface->Data.V16 = (mfxU16 *)frame->data[0] + 3; +break; +#endif default: return MFX_ERR_UNSUPPORTED; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/qsvenc: add encode support for HEVC 4:2:2 8-bit and 10-bit
ffmpeg | branch: master | Linjie Fu | Wed Feb 26 16:40:02 2020 +0800| [8999a2f21d1ed11b4ce4400d20a11959a2b18869] | committer: Linjie Fu lavc/qsvenc: add encode support for HEVC 4:2:2 8-bit and 10-bit Enables HEVC Range Extension encoding support (Linux) for 4:2:2 8/10 bit on ICL+ (gen11 +) platform. Restricted to linux only for now. Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8999a2f21d1ed11b4ce4400d20a11959a2b18869 --- libavcodec/qsv.c | 2 ++ libavcodec/qsvenc.c | 4 +++- libavcodec/qsvenc_hevc.c | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 171a8d6077..17720070f1 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -219,10 +219,12 @@ int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc) return AV_PIX_FMT_P010; #if CONFIG_VAAPI case AV_PIX_FMT_YUV422P: +case AV_PIX_FMT_YUYV422: *fourcc = MFX_FOURCC_YUY2; return AV_PIX_FMT_YUYV422; #if QSV_VERSION_ATLEAST(1, 27) case AV_PIX_FMT_YUV422P10: +case AV_PIX_FMT_Y210: *fourcc = MFX_FOURCC_Y210; return AV_PIX_FMT_Y210; #endif diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 9ec0636dde..edf37708cb 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -66,6 +66,7 @@ static const struct { { MFX_PROFILE_HEVC_MAIN,"main" }, { MFX_PROFILE_HEVC_MAIN10, "main10"}, { MFX_PROFILE_HEVC_MAINSP, "mainsp"}, +{ MFX_PROFILE_HEVC_REXT,"rext" }, #endif }; @@ -544,7 +545,8 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->param.mfx.FrameInfo.CropH = avctx->height; q->param.mfx.FrameInfo.AspectRatioW = avctx->sample_aspect_ratio.num; q->param.mfx.FrameInfo.AspectRatioH = avctx->sample_aspect_ratio.den; -q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; +q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420 + +!desc->log2_chroma_w + !desc->log2_chroma_h; q->param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth; q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth; q->param.mfx.FrameInfo.Shift = desc->comp[0].depth > 8; diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c index 36e5ef6052..88c78a8135 100644 --- a/libavcodec/qsvenc_hevc.c +++ b/libavcodec/qsvenc_hevc.c @@ -240,6 +240,7 @@ static const AVOption options[] = { { "main",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_MAIN }, INT_MIN, INT_MAX, VE, "profile" }, { "main10", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_MAIN10 }, INT_MIN, INT_MAX, VE, "profile" }, { "mainsp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_MAINSP }, INT_MIN, INT_MAX, VE, "profile" }, +{ "rext",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_REXT }, INT_MIN, INT_MAX, VE, "profile" }, { "gpb", "1: GPB (generalized P/B frame); 0: regular P frame", OFFSET(qsv.gpb), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE}, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vaapi_hevc: add missing max_8bit_constraint_flag
ffmpeg | branch: master | Linjie Fu | Tue May 12 21:46:40 2020 +0800| [7ae340111ec8e1d7d5bc074cbd3e1b9ca4e90a8d] | committer: Linjie Fu lavc/vaapi_hevc: add missing max_8bit_constraint_flag This is accidentally missed while rebasing. Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7ae340111ec8e1d7d5bc074cbd3e1b9ca4e90a8d --- libavcodec/vaapi_hevc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index c83d481b90..9083331c45 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -505,6 +505,7 @@ static int ptl_convert(const PTLCommon *general_ptl, H265RawProfileTierLevel *h2 copy_field(frame_only_constraint_flag); copy_field(max_12bit_constraint_flag); copy_field(max_10bit_constraint_flag); +copy_field(max_8bit_constraint_flag); copy_field(max_422chroma_constraint_flag); copy_field(max_420chroma_constraint_flag); copy_field(max_monochrome_constraint_flag); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools/ffmpeg_filter: add -autoscale to disable/enable the default scale
ffmpeg | branch: master | Linjie Fu | Mon Jun 8 16:58:05 2020 +0800| [0b511bd9a5487c672fe199ffb2a78a50fc5b2d9f] | committer: Linjie Fu fftools/ffmpeg_filter: add -autoscale to disable/enable the default scale Currently, ffmpeg inserts scale filter by default in the filter graph to force the whole decoded stream to scale into the same size with the first frame. It's not quite make sense in resolution changing cases if user wants the rawvideo without any scale. Using autoscale/noautoscale as an output option to indicate whether auto inserting the scale filter in the filter graph: -noautoscale or -autoscale 0: disable the default auto scale filter inserting. ffmpeg -y -i input.mp4 out1.yuv -noautoscale out2.yuv -autoscale 0 out3.yuv Update docs. Suggested-by: Mark Thompson Reviewed-by: Nicolas George Signed-off-by: U. Artie Eoff Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0b511bd9a5487c672fe199ffb2a78a50fc5b2d9f --- doc/ffmpeg.texi | 16 fftools/ffmpeg.h| 3 +++ fftools/ffmpeg_filter.c | 2 +- fftools/ffmpeg_opt.c| 6 ++ 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 92fb10f4f4..70b8965d7f 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -734,10 +734,6 @@ ffmpeg -dump_attachment:t "" -i INPUT Technical note -- attachments are implemented as codec extradata, so this option can actually be used to extract extradata from any stream, not just attachments. - -@item -noautorotate -Disable automatically rotating video based on file metadata. - @end table @section Video Options @@ -819,6 +815,18 @@ Create the filtergraph specified by @var{filtergraph} and use it to filter the stream. This is an alias for @code{-filter:v}, see the @ref{filter_option,,-filter option}. + +@item -autorotate +Automatically rotate the video according to file metadata. Enabled by +default, use @option{-noautorotate} to disable it. + +@item -autoscale +Automatically scale the video according to the resolution of first frame. +Enabled by default, use @option{-noautoscale} to disable it. When autoscale is +disabled, all output frames of filter graph might not be in the same resolution +and may be inadequate for some encoder/muxer. Therefore, it is not recommended +to disable it unless you really know what you are doing. +Disable autoscale at your own risk. @end table @section Advanced Video options diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 828cb2a4ff..6e3f2545c7 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -229,6 +229,8 @@ typedef struct OptionsContext { intnb_time_bases; SpecifierOpt *enc_time_bases; intnb_enc_time_bases; +SpecifierOpt *autoscale; +intnb_autoscale; } OptionsContext; typedef struct InputFilter { @@ -479,6 +481,7 @@ typedef struct OutputStream { int force_fps; int top_field_first; int rotate_overridden; +int autoscale; double rotate_override_value; AVRational frame_aspect_ratio; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 422e1268e9..4784e8a575 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -470,7 +470,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, if (ret < 0) return ret; -if (ofilter->width || ofilter->height) { +if ((ofilter->width || ofilter->height) && ofilter->ost->autoscale) { char args[255]; AVFilterContext *filter; AVDictionaryEntry *e = NULL; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 2eb4e1c973..9d1489ce01 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -62,6 +62,7 @@ static const char *opt_name_hwaccels[] = {"hwaccel", NULL}; static const char *opt_name_hwaccel_devices[] = {"hwaccel_device", NULL}; static const char *opt_name_hwaccel_output_formats[]= {"hwaccel_output_format", NULL}; static const char *opt_name_autorotate[]= {"autorotate", NULL}; +static const char *opt_name_autoscale[] = {"autoscale", NULL}; static const char *opt_name_max_frames[]= {"frames", "aframes", "vframes", "dframes", NULL}; static const char *opt_name_bitstream_filters[] = {"bsf", "absf", "vbsf", NULL}; static const char *opt_name_codec_tags[]= {"tag", "atag", "vtag", "stag", NULL}; @@ -1462,6 +1463,8 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e ost->encoder_opts = filter_codec_opts(o->g->codec_opts, ost->enc->id, oc, st, ost->enc); MATCH_PER_STREAM_OPT(presets, str, preset, oc, s
[FFmpeg-cvslog] lavc/qsvenc_hevc: add qmax/qmin support for HEVC encoding
ffmpeg | branch: master | Linjie Fu | Wed Mar 11 18:39:28 2020 +0800| [c2d000ec27af1a5cd5341a67e941e0313879ab18] | committer: Zhong Li lavc/qsvenc_hevc: add qmax/qmin support for HEVC encoding Add qmax/qmin support for HEVC software bitrate control(SWBRC). Limitations: - RateControlMethod != MFX_RATECONTROL_CQP - with EXTBRC ON Signed-off-by: Dmitry Rogozhkin Signed-off-by: Linjie Fu Signed-off-by: Zhong Li > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c2d000ec27af1a5cd5341a67e941e0313879ab18 --- libavcodec/qsvenc.c | 11 +-- libavcodec/qsvenc_hevc.c | 2 ++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index ed4539f697..1ed8f5d973 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -735,6 +735,11 @@ FF_ENABLE_DEPRECATION_WARNINGS if (q->adaptive_b >= 0) q->extco2.AdaptiveB = q->adaptive_b ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; #endif +} + +if (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_HEVC) { +if (q->extbrc >= 0) +q->extco2.ExtBRC = q->extbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; #if QSV_VERSION_ATLEAST(1, 9) if (avctx->qmin >= 0 && avctx->qmax >= 0 && avctx->qmin > avctx->qmax) { @@ -750,12 +755,6 @@ FF_ENABLE_DEPRECATION_WARNINGS q->extco2.MaxQPP = q->extco2.MaxQPB = q->extco2.MaxQPI; } #endif -} - -if (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_HEVC) { -if (q->extbrc >= 0) -q->extco2.ExtBRC = q->extbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; - q->extco2.Header.BufferId = MFX_EXTBUFF_CODING_OPTION2; q->extco2.Header.BufferSz = sizeof(q->extco2); diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c index 88c78a8135..347f30655e 100644 --- a/libavcodec/qsvenc_hevc.c +++ b/libavcodec/qsvenc_hevc.c @@ -263,6 +263,8 @@ static const AVCodecDefault qsv_enc_defaults[] = { // same as the x264 default { "g", "248" }, { "bf","8" }, +{ "qmin", "-1"}, +{ "qmax", "-1"}, { "trellis", "-1"}, { "flags", "+cgop" }, #if FF_API_PRIVATE_OPT ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vaapi_encode: add EQUAL_MULTI_ROWS support for slice structure
ffmpeg | branch: master | Linjie Fu | Mon May 11 14:32:42 2020 +0800| [489c5db0791f39518775b12eef6d48276c17f96f] | committer: Linjie Fu lavc/vaapi_encode: add EQUAL_MULTI_ROWS support for slice structure VA_ENC_SLICE_STRUCTURE_EQUAL_MULTI_ROWS is added to in the latest libva (1.8.0) which matches the hardware behaviour: /** \brief Driver supports any number of rows per slice but they must *be the same for all slices except for the last one, which must be *equal or smaller to the previous slices. */ And VA_ENC_SLICE_STRUCTURE_EQUAL_ROWS is kind of deprecated for iHD since it's somehow introduced in [1] which is misleading from what we actually handles. [1]<https://github.com/intel/libva/commit/0e6d5441f19bdc674b4da3169d614d10fd644778> Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=489c5db0791f39518775b12eef6d48276c17f96f --- libavcodec/vaapi_encode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index e39db20200..d6a986d5f0 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -1900,6 +1900,9 @@ static av_cold int vaapi_encode_init_slice_structure(AVCodecContext *avctx) req_slices = avctx->slices; } if (slice_structure & VA_ENC_SLICE_STRUCTURE_ARBITRARY_ROWS || +#if VA_CHECK_VERSION(1, 8, 0) +slice_structure & VA_ENC_SLICE_STRUCTURE_EQUAL_MULTI_ROWS || +#endif slice_structure & VA_ENC_SLICE_STRUCTURE_ARBITRARY_MACROBLOCKS) { ctx->nb_slices = req_slices; ctx->slice_size = ctx->slice_block_rows / ctx->nb_slices; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vaapi_encode: add tile slice encoding support
ffmpeg | branch: master | Linjie Fu | Tue May 12 21:47:12 2020 +0800| [a7c2cdf0f6bc53d2bdf05fc92f20415a3de7045f] | committer: Linjie Fu lavc/vaapi_encode: add tile slice encoding support Add functions to initialize tile slice structure and make tile slice: - vaapi_encode_init_tile_slice_structure - vaapi_encode_make_tile_slice Tile slice is not allowed to cross the boundary of a tile due to the constraints of media-driver. Currently adding support for one slice per tile. N x N tile encoding is supposed to be supported with the the capability of ARBITRARY_MACROBLOCKS slice structures. N X 1 tile encoding should also work in ARBITRARY_ROWS slice structure. Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a7c2cdf0f6bc53d2bdf05fc92f20415a3de7045f --- libavcodec/vaapi_encode.c | 128 +++--- libavcodec/vaapi_encode.h | 16 ++ 2 files changed, 136 insertions(+), 8 deletions(-) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 2cd2d1f82a..1de43cc977 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -218,6 +218,33 @@ static int vaapi_encode_make_row_slice(AVCodecContext *avctx, return 0; } +static int vaapi_encode_make_tile_slice(AVCodecContext *avctx, +VAAPIEncodePicture *pic) +{ +VAAPIEncodeContext *ctx = avctx->priv_data; +VAAPIEncodeSlice *slice; +int i, j, index; + +for (i = 0; i < ctx->tile_cols; i++) { +for (j = 0; j < ctx->tile_rows; j++) { +index= j * ctx->tile_cols + i; +slice= &pic->slices[index]; +slice->index = index; + +pic->slices[index].block_start = ctx->col_bd[i] + + ctx->row_bd[j] * ctx->slice_block_cols; +pic->slices[index].block_size = ctx->row_height[j] * ctx->col_width[i]; + +av_log(avctx, AV_LOG_DEBUG, "Slice %2d: (%2d, %2d) start at: %4d " + "width:%2d height:%2d (%d blocks).\n", index, ctx->col_bd[i], + ctx->row_bd[j], slice->block_start, ctx->col_width[i], + ctx->row_height[j], slice->block_size); +} +} + +return 0; +} + static int vaapi_encode_issue(AVCodecContext *avctx, VAAPIEncodePicture *pic) { @@ -407,7 +434,10 @@ static int vaapi_encode_issue(AVCodecContext *avctx, goto fail; } -vaapi_encode_make_row_slice(avctx, pic); +if (ctx->tile_rows && ctx->tile_cols) +vaapi_encode_make_tile_slice(avctx, pic); +else +vaapi_encode_make_row_slice(avctx, pic); } for (i = 0; i < pic->nb_slices; i++) { @@ -1903,11 +1933,76 @@ static av_cold int vaapi_encode_init_row_slice_structure(AVCodecContext *avctx, return 0; } +static av_cold int vaapi_encode_init_tile_slice_structure(AVCodecContext *avctx, + uint32_t slice_structure) +{ +VAAPIEncodeContext *ctx = avctx->priv_data; +int i, req_tiles; + +if (!(slice_structure & VA_ENC_SLICE_STRUCTURE_ARBITRARY_MACROBLOCKS || + (slice_structure & VA_ENC_SLICE_STRUCTURE_ARBITRARY_ROWS && + ctx->tile_cols == 1))) { +av_log(avctx, AV_LOG_ERROR, "Supported slice structure (%#x) doesn't work for " + "current tile requirement.\n", slice_structure); +return AVERROR(EINVAL); +} + +if (ctx->tile_rows > ctx->slice_block_rows || +ctx->tile_cols > ctx->slice_block_cols) { +av_log(avctx, AV_LOG_WARNING, "Not enough block rows/cols (%d x %d) " + "for configured number of tile (%d x %d); ", + ctx->slice_block_rows, ctx->slice_block_cols, + ctx->tile_rows, ctx->tile_cols); +ctx->tile_rows = ctx->tile_rows > ctx->slice_block_rows ? + ctx->slice_block_rows : ctx->tile_rows; +ctx->tile_cols = ctx->tile_cols > ctx->slice_block_cols ? + ctx->slice_block_cols : ctx->tile_cols; +av_log(avctx, AV_LOG_WARNING, "using allowed maximum (%d x %d).\n", + ctx->tile_rows, ctx->tile_cols); +} + +req_tiles = ctx->tile_rows * ctx->tile_cols; + +// Tile slice is not allowed to cross the boundary of a tile due to +// the constraints of media-driver. Currently we support one slice +// per tile. This could be extended to multiple slices per tile. +if (avctx->slices != req_tiles) +av_log(avctx, AV_LOG_WARNING, "The number of requested slices " + "mis
[FFmpeg-cvslog] lavc/vaapi_encode_h265: add h265 tile encoding support
ffmpeg | branch: master | Linjie Fu | Tue May 12 21:47:13 2020 +0800| [43a08d907ba765677254b4816f246a8ecfd7ff78] | committer: Linjie Fu lavc/vaapi_encode_h265: add h265 tile encoding support Default to enable uniform_spacing_flag. Guess level by the tile rows/cols. Supported for ICL+ platforms. Also add documentations. To encode with 4 rows 2 columns: ffmpeg ... -c:v hevc_vaapi -tiles 4x2 ... ffmpeg ... -c:v hevc_vaapi -tile_rows 4 -tile_cols 2 ... Suggested-by: Jun Zhao Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=43a08d907ba765677254b4816f246a8ecfd7ff78 --- doc/encoders.texi | 13 + libavcodec/vaapi_encode_h265.c | 38 +- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index 5406d20c00..23542c8a62 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -3145,6 +3145,19 @@ Include HDR metadata if the input frames have it messages). @end table +@item tiles +Set the number of tiles to encode the input video with, as rows x columns. +Larger numbers allow greater parallelism in both encoding and decoding, but +may decrease coding efficiency. + +@item tile_rows +Selects how many rows of tiles to encode with. For example, 4 tile rows would +be requested by setting the tile_rows option to 4. + +@item tile_cols +Selects how many columns of tiles to encode with. For example, 5 tile columns +would be requested by setting the tile_cols option to 5. + @end table @item mjpeg_vaapi diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c index 045a0261a1..7aa395fb61 100644 --- a/libavcodec/vaapi_encode_h265.c +++ b/libavcodec/vaapi_encode_h265.c @@ -63,6 +63,9 @@ typedef struct VAAPIEncodeH265Context { int level; int sei; +int trows; +int tcols; + // Derived settings. int fixed_qp_idr; int fixed_qp_p; @@ -344,7 +347,7 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) level = ff_h265_guess_level(ptl, avctx->bit_rate, ctx->surface_width, ctx->surface_height, -ctx->nb_slices, 1, 1, +ctx->nb_slices, ctx->tile_rows, ctx->tile_cols, (ctx->b_per_p > 0) + 1); if (level) { av_log(avctx, AV_LOG_VERBOSE, "Using level %s.\n", level->name); @@ -557,6 +560,20 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) pps->pps_loop_filter_across_slices_enabled_flag = 1; +if (ctx->tile_rows && ctx->tile_cols) { +pps->tiles_enabled_flag = 1; +pps->uniform_spacing_flag = 1; + +pps->num_tile_rows_minus1 = ctx->tile_rows - 1; +pps->num_tile_columns_minus1= ctx->tile_cols - 1; + +pps->loop_filter_across_tiles_enabled_flag = 1; + +for (i = 0; i <= pps->num_tile_rows_minus1; i++) +pps->row_height_minus1[i] = ctx->row_height[i] - 1; +for (i = 0; i <= pps->num_tile_columns_minus1; i++) +pps->column_width_minus1[i] = ctx->col_width[i] - 1; +} // Fill VAAPI parameter buffers. @@ -665,6 +682,13 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) }, }; +if (pps->tiles_enabled_flag) { +for (i = 0; i <= vpic->num_tile_rows_minus1; i++) +vpic->row_height_minus1[i] = pps->row_height_minus1[i]; +for (i = 0; i <= vpic->num_tile_columns_minus1; i++) +vpic->column_width_minus1[i] = pps->column_width_minus1[i]; +} + return 0; } @@ -1180,6 +1204,11 @@ static av_cold int vaapi_encode_h265_init(AVCodecContext *avctx) if (priv->qp > 0) ctx->explicit_qp = priv->qp; +if (priv->trows && priv->tcols) { +ctx->tile_rows = priv->trows; +ctx->tile_cols = priv->tcols; +} + return ff_vaapi_encode_init(avctx); } @@ -1256,6 +1285,13 @@ static const AVOption vaapi_encode_h265_options[] = { { .i64 = SEI_MASTERING_DISPLAY | SEI_CONTENT_LIGHT_LEVEL }, INT_MIN, INT_MAX, FLAGS, "sei" }, +{ "tiles", "Tile rows x cols", + OFFSET(trows), AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, 0, FLAGS }, +{ "tile_rows", "Number of rows for tile encoding", + OFFSET(trows), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS }, +{ "tile_cols", "Number of cols for tile encoding", + OFFSET(tcols), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS }, + { NULL }, }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vaapi_encode: wrap slice codes into row slice functions
ffmpeg | branch: master | Linjie Fu | Tue May 12 21:47:11 2020 +0800| [65f4d561c9dbd0a20ed9ed8c229dbbf3b89262ce] | committer: Linjie Fu lavc/vaapi_encode: wrap slice codes into row slice functions Wrap current whole-row slice codes into following functions: - vaapi_encode_make_row_slice() - vaapi_encode_init_row_slice_structure() Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=65f4d561c9dbd0a20ed9ed8c229dbbf3b89262ce --- libavcodec/vaapi_encode.c | 190 ++ 1 file changed, 109 insertions(+), 81 deletions(-) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index d6a986d5f0..2cd2d1f82a 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -163,6 +163,61 @@ static int vaapi_encode_wait(AVCodecContext *avctx, return 0; } +static int vaapi_encode_make_row_slice(AVCodecContext *avctx, + VAAPIEncodePicture *pic) +{ +VAAPIEncodeContext *ctx = avctx->priv_data; +VAAPIEncodeSlice *slice; +int i, rounding; + +for (i = 0; i < pic->nb_slices; i++) +pic->slices[i].row_size = ctx->slice_size; + +rounding = ctx->slice_block_rows - ctx->nb_slices * ctx->slice_size; +if (rounding > 0) { +// Place rounding error at top and bottom of frame. +av_assert0(rounding < pic->nb_slices); +// Some Intel drivers contain a bug where the encoder will fail +// if the last slice is smaller than the one before it. Since +// that's straightforward to avoid here, just do so. +if (rounding <= 2) { +for (i = 0; i < rounding; i++) +++pic->slices[i].row_size; +} else { +for (i = 0; i < (rounding + 1) / 2; i++) +++pic->slices[pic->nb_slices - i - 1].row_size; +for (i = 0; i < rounding / 2; i++) +++pic->slices[i].row_size; +} +} else if (rounding < 0) { +// Remove rounding error from last slice only. +av_assert0(rounding < ctx->slice_size); +pic->slices[pic->nb_slices - 1].row_size += rounding; +} + +for (i = 0; i < pic->nb_slices; i++) { +slice = &pic->slices[i]; +slice->index = i; +if (i == 0) { +slice->row_start = 0; +slice->block_start = 0; +} else { +const VAAPIEncodeSlice *prev = &pic->slices[i - 1]; +slice->row_start = prev->row_start + prev->row_size; +slice->block_start = prev->block_start + prev->block_size; +} +slice->block_size = slice->row_size * ctx->slice_block_cols; + +av_log(avctx, AV_LOG_DEBUG, "Slice %d: %d-%d (%d rows), " + "%d-%d (%d blocks).\n", i, slice->row_start, + slice->row_start + slice->row_size - 1, slice->row_size, + slice->block_start, slice->block_start + slice->block_size - 1, + slice->block_size); +} + +return 0; +} + static int vaapi_encode_issue(AVCodecContext *avctx, VAAPIEncodePicture *pic) { @@ -346,57 +401,17 @@ static int vaapi_encode_issue(AVCodecContext *avctx, if (pic->nb_slices == 0) pic->nb_slices = ctx->nb_slices; if (pic->nb_slices > 0) { -int rounding; - 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++) -pic->slices[i].row_size = ctx->slice_size; - -rounding = ctx->slice_block_rows - ctx->nb_slices * ctx->slice_size; -if (rounding > 0) { -// Place rounding error at top and bottom of frame. -av_assert0(rounding < pic->nb_slices); -// Some Intel drivers contain a bug where the encoder will fail -// if the last slice is smaller than the one before it. Since -// that's straightforward to avoid here, just do so. -if (rounding <= 2) { -for (i = 0; i < rounding; i++) -++pic->slices[i].row_size; -} else { -for (i = 0; i < (rounding + 1) / 2; i++) -++pic->slices[pic->nb_slices - i - 1].row_size; -for (i = 0; i < rounding / 2; i++) -++pic->slices[i].row_size; -} -} else if (rounding < 0) { -// Remove rounding error from last slice only. -av_assert0(rounding < ctx->slice_size); -pic->slices[pic->nb_slices - 1].row_size += rounding; -} +vaapi_e
[FFmpeg-cvslog] lavc/vaapi_encode: Add render target support for 422 10-bit
ffmpeg | branch: master | Linjie Fu | Mon Jun 22 15:41:35 2020 +0800| [21442a820aec365fc298d9a89d564db7ef866d86] | committer: Linjie Fu lavc/vaapi_encode: Add render target support for 422 10-bit This enables VAAPI encoding support for 422 10-bit(Y210). Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=21442a820aec365fc298d9a89d564db7ef866d86 --- libavcodec/vaapi_encode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 1de43cc977..6766641ac7 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -1248,6 +1248,9 @@ static const VAAPIEncodeRTFormat vaapi_encode_rt_formats[] = { { "YUV400",VA_RT_FORMAT_YUV400,8, 1, }, { "YUV420",VA_RT_FORMAT_YUV420,8, 3, 1, 1 }, { "YUV422",VA_RT_FORMAT_YUV422,8, 3, 1, 0 }, +#if VA_CHECK_VERSION(1, 2, 0) +{ "YUV422_10", VA_RT_FORMAT_YUV422_10,10, 3, 1, 0 }, +#endif { "YUV444",VA_RT_FORMAT_YUV444,8, 3, 0, 0 }, { "YUV411",VA_RT_FORMAT_YUV411,8, 3, 2, 0 }, #if VA_CHECK_VERSION(0, 38, 1) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/qsvenc: assert uninitialized pict_type
ffmpeg | branch: master | Linjie Fu | Wed Nov 28 10:41:55 2018 +0800| [67cdfcf694f840d215be940f82545c45c9be193a] | committer: Zhong Li lavc/qsvenc: assert uninitialized pict_type Assert in function ff_qsv_encode to avoid using uninitialized value: FF_DISABLE_DEPRECATION_WARNINGS avctx->coded_frame->pict_type = pict_type; FF_ENABLE_DEPRECATION_WARNINGS Signed-off-by: Linjie Fu Signed-off-by: Zhong Li > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=67cdfcf694f840d215be940f82545c45c9be193a --- libavcodec/qsvenc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 3946c1d837..7f4592f878 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -1337,6 +1337,8 @@ int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q, pict_type = AV_PICTURE_TYPE_P; else if (bs->FrameType & MFX_FRAMETYPE_B || bs->FrameType & MFX_FRAMETYPE_xB) pict_type = AV_PICTURE_TYPE_B; +else +av_assert0(!"Uninitialized pict_type!"); #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/qsvenc: replace assert with error return
ffmpeg | branch: master | Linjie Fu | Sun Dec 9 21:30:38 2018 +0800| [1c96d2e3998b9a2a97447547cb2d688ec0ce09ed] | committer: Zhong Li lavc/qsvenc: replace assert with error return Fix the (m)jpeg encoding regression issue as decription in tikect #7593, due to bs->FrameType is not set in such case in MSDK (https://github.com/Intel-Media-SDK/MediaSDK/issues/970). (And assert on a value coming from an external library is not proper.) Add default type check for bs->FrameType, and return invalid data error in function ff_qsv_encode to avoid using uninitialized value. Signed-off-by: Linjie Fu Signed-off-by: Zhong Li > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1c96d2e3998b9a2a97447547cb2d688ec0ce09ed --- libavcodec/qsvenc.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 53ba7cad15..70772dc0e2 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -1344,8 +1344,13 @@ int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q, pict_type = AV_PICTURE_TYPE_P; else if (bs->FrameType & MFX_FRAMETYPE_B || bs->FrameType & MFX_FRAMETYPE_xB) pict_type = AV_PICTURE_TYPE_B; -else -av_assert0(!"Uninitialized pict_type!"); +else if (bs->FrameType == MFX_FRAMETYPE_UNKNOWN) { +pict_type = AV_PICTURE_TYPE_NONE; +av_log(avctx, AV_LOG_WARNING, "Unkown FrameType, set pict_type to AV_PICTURE_TYPE_NONE.\n"); +} else { +av_log(avctx, AV_LOG_ERROR, "Invalid FrameType:%d.\n", bs->FrameType); +return AVERROR_INVALIDDATA; +} #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/qsvenc: add VDENC support for H264
ffmpeg | branch: master | Linjie Fu | Thu Nov 29 14:14:22 2018 +0800| [e92ce340e63058de32aec733b59fe2b196bed214] | committer: Zhong Li lavc/qsvenc: add VDENC support for H264 Add VDENC(lowpower mode) support for QSV H264 It's an experimental function(like lowpower in vaapi) with some limitations: - CBR/VBR require HuC which should be explicitly loaded via i915 module parameter(i915.enable_guc=2 for linux kernel version >= 4.16) Use option "-low_power 1" to enable VDENC. Add in dump_video_param() to show the status of VDENC in runtime log. Signed-off-by: Linjie Fu Signed-off-by: Zhong Li > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e92ce340e63058de32aec733b59fe2b196bed214 --- libavcodec/qsvenc.c | 7 +++ libavcodec/qsvenc.h | 2 ++ libavcodec/qsvenc_h264.c | 4 3 files changed, 13 insertions(+) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 56a3756357..5b6c68e307 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -226,6 +226,10 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q, av_log(avctx, AV_LOG_VERBOSE, "\n"); #endif +#if QSV_HAVE_VDENC +av_log(avctx, AV_LOG_VERBOSE, "VDENC: %s\n", print_threestate(info->LowPower)); +#endif + #if QSV_VERSION_ATLEAST(1, 8) av_log(avctx, AV_LOG_VERBOSE, "RepeatPPS: %s; NumMbPerSlice: %"PRIu16"; LookAheadDS: ", @@ -475,6 +479,9 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) } } +#if QSV_HAVE_VDENC +q->param.mfx.LowPower = q->low_power ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; +#endif q->param.mfx.CodecProfile = q->profile; q->param.mfx.TargetUsage= avctx->compression_level; q->param.mfx.GopPicSize = FFMAX(0, avctx->gop_size); diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index 4316a101ca..47a70a4898 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -44,6 +44,7 @@ #define QSV_HAVE_LA QSV_VERSION_ATLEAST(1, 7) #define QSV_HAVE_LA_DS QSV_VERSION_ATLEAST(1, 8) #define QSV_HAVE_LA_HRD QSV_VERSION_ATLEAST(1, 11) +#define QSV_HAVE_VDENC QSV_VERSION_ATLEAST(1, 15) #if defined(_WIN32) || defined(__CYGWIN__) #define QSV_HAVE_AVBR QSV_VERSION_ATLEAST(1, 3) @@ -163,6 +164,7 @@ typedef struct QSVEncContext { int recovery_point_sei; int repeat_pps; +int low_power; int a53_cc; diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c index 8e61826eef..f458137848 100644 --- a/libavcodec/qsvenc_h264.c +++ b/libavcodec/qsvenc_h264.c @@ -154,6 +154,10 @@ static const AVOption options[] = { { "auto" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_MF_AUTO }, INT_MIN, INT_MAX, VE, "mfmode" }, #endif +#if QSV_HAVE_VDENC +{ "low_power", "enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE}, +#endif + { "repeat_pps", "repeat pps for every frame", OFFSET(qsv.repeat_pps), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, { NULL }, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/hevc_parser: report detailed log when missing picture occurs
ffmpeg | branch: master | Linjie Fu | Fri Jan 11 16:07:33 2019 +0800| [5764c9528b97c8340bfaacbe98b1de87a8e92e4d] | committer: Michael Niedermayer lavc/hevc_parser: report detailed log when missing picture occurs Report the detailed log with buf_size in parse_nal_units to provide more information when picture could not be found. Match the behaviour in h264_parser. Signed-off-by: Linjie Fu Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5764c9528b97c8340bfaacbe98b1de87a8e92e4d --- libavcodec/hevc_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c index 369d1338d0..f0b0789990 100644 --- a/libavcodec/hevc_parser.c +++ b/libavcodec/hevc_parser.c @@ -239,7 +239,7 @@ static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf, } } /* didn't find a picture! */ -av_log(avctx, AV_LOG_ERROR, "missing picture in access unit\n"); +av_log(avctx, AV_LOG_ERROR, "missing picture in access unit with size %d\n", buf_size); return -1; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] qsvenc: Add VDENC support for H264 and HEVC
ffmpeg | branch: master | Linjie Fu | Mon Nov 5 10:28:59 2018 +0800| [e716323fa8526c7243ce73edd077761dc40e5f86] | committer: Luca Barbato qsvenc: Add VDENC support for H264 and HEVC Add VDENC(lowpower mode) support for QSV h264 and HEVC It's an experimental function(like lowpower in vaapi) with some limitations: - CBR/VBR require HuC which should be explicitly loaded via i915 module parameter(i915.enable_guc=2 for linux kerner version >= 4.16) - HEVC VDENC was supported >= ICE LAKE use option "-low_power 1" to enable VDENC. Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e716323fa8526c7243ce73edd077761dc40e5f86 --- libavcodec/qsvenc.c | 3 +++ libavcodec/qsvenc.h | 2 ++ libavcodec/qsvenc_h264.c | 3 +++ libavcodec/qsvenc_hevc.c | 3 +++ 4 files changed, 11 insertions(+) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 17a0559f36..16d6e79e2b 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -472,6 +472,9 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) } } +#if QSV_HAVE_VDENC +q->param.mfx.LowPower = q->low_power ? MFX_CODINGOPTION_ON:MFX_CODINGOPTION_OFF; +#endif q->param.mfx.CodecProfile = q->profile; q->param.mfx.TargetUsage= avctx->compression_level; q->param.mfx.GopPicSize = FFMAX(0, avctx->gop_size); diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index 2d83c7b1af..b74b977e88 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -44,6 +44,7 @@ #define QSV_HAVE_LA QSV_VERSION_ATLEAST(1, 7) #define QSV_HAVE_LA_DS QSV_VERSION_ATLEAST(1, 8) #define QSV_HAVE_LA_HRD QSV_VERSION_ATLEAST(1, 11) +#define QSV_HAVE_VDENC QSV_VERSION_ATLEAST(1, 15) #if defined(_WIN32) #define QSV_HAVE_AVBR QSV_VERSION_ATLEAST(1, 3) @@ -159,6 +160,7 @@ typedef struct QSVEncContext { int int_ref_cycle_size; int int_ref_qp_delta; int recovery_point_sei; +int low_power; #if QSV_HAVE_MF int mfmode; diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c index 164f57332f..795e27c002 100644 --- a/libavcodec/qsvenc_h264.c +++ b/libavcodec/qsvenc_h264.c @@ -101,6 +101,9 @@ static const AVOption options[] = { { "off", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_MF_DISABLED }, INT_MIN, INT_MAX, VE, "mfmode" }, { "auto" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_MF_AUTO }, INT_MIN, INT_MAX, VE, "mfmode" }, #endif +#if QSV_HAVE_VDENC +{ "low_power", "enable low power mode (experimental, many limitations by mfx version, HW platform, BRC modes, etc.", OFFSET(qsv.low_power), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE}, +#endif { NULL }, }; diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c index 471d174873..cba671bb90 100644 --- a/libavcodec/qsvenc_hevc.c +++ b/libavcodec/qsvenc_hevc.c @@ -238,6 +238,9 @@ static const AVOption options[] = { { "main",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_MAIN }, INT_MIN, INT_MAX, VE, "profile" }, { "main10", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_MAIN10 }, INT_MIN, INT_MAX, VE, "profile" }, { "mainsp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_MAINSP }, INT_MIN, INT_MAX, VE, "profile" }, +#if QSV_HAVE_VDENC +{ "low_power", "enable low power mode (experimental, many limitations by mfx version, HW platform, BRC modes, etc.", OFFSET(qsv.low_power), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, +#endif { NULL }, }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/deinterlace_qsv: set specific field for repeat
ffmpeg | branch: master | Linjie Fu | Fri Mar 8 23:34:01 2019 +0800| [147ef1d9472ea39f837224bc8a2fbe07a9f04ae3] | committer: Zhong Li lavf/deinterlace_qsv: set specific field for repeat Set specific field for repeat in PicStruct if the frame has repeat flag. Match the CheckInputPicStruct in MSDK. Fix #7701. Signed-off-by: Linjie Fu Signed-off-by: Zhong Li > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=147ef1d9472ea39f837224bc8a2fbe07a9f04ae3 --- libavfilter/vf_deinterlace_qsv.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c index d6b02e98c5..bee10c220f 100644 --- a/libavfilter/vf_deinterlace_qsv.c +++ b/libavfilter/vf_deinterlace_qsv.c @@ -419,9 +419,11 @@ static int submit_frame(AVFilterContext *ctx, AVFrame *frame, qf->surface.Info.PicStruct = !qf->frame->interlaced_frame ? MFX_PICSTRUCT_PROGRESSIVE : (qf->frame->top_field_first ? MFX_PICSTRUCT_FIELD_TFF : MFX_PICSTRUCT_FIELD_BFF); -if (qf->frame->repeat_pict == 1) +if (qf->frame->repeat_pict == 1) { qf->surface.Info.PicStruct |= MFX_PICSTRUCT_FIELD_REPEATED; -else if (qf->frame->repeat_pict == 2) +qf->surface.Info.PicStruct |= qf->frame->top_field_first ? MFX_PICSTRUCT_FIELD_TFF : + MFX_PICSTRUCT_FIELD_BFF; +} else if (qf->frame->repeat_pict == 2) qf->surface.Info.PicStruct |= MFX_PICSTRUCT_FRAME_DOUBLING; else if (qf->frame->repeat_pict == 4) qf->surface.Info.PicStruct |= MFX_PICSTRUCT_FRAME_TRIPLING; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/qsvenc: expose low_power as a common option for QSV encoder
ffmpeg | branch: master | Linjie Fu | Fri Mar 29 13:19:06 2019 +0800| [a8355eed3699acffebb70e1b939989d39b72dfc7] | committer: Zhong Li lavc/qsvenc: expose low_power as a common option for QSV encoder Always exposes low_power option for all qsv encoder, and reports a warning if VDENC is not supported in current version of MSDK. Signed-off-by: Linjie Fu Signed-off-by: Zhong Li > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a8355eed3699acffebb70e1b939989d39b72dfc7 --- libavcodec/qsvenc.c | 11 ++- libavcodec/qsvenc.h | 1 + libavcodec/qsvenc_h264.c | 4 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index a6641f68fc..4c03133817 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -488,9 +488,18 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) } } +if (q->low_power) { #if QSV_HAVE_VDENC -q->param.mfx.LowPower = q->low_power ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; +q->param.mfx.LowPower = MFX_CODINGOPTION_ON; +#else +av_log(avctx, AV_LOG_WARNING, "The low_power option is " +"not supported with this MSDK version.\n"); +q->low_power = 0; +q->param.mfx.LowPower = MFX_CODINGOPTION_OFF; #endif +} else +q->param.mfx.LowPower = MFX_CODINGOPTION_OFF; + q->param.mfx.CodecProfile = q->profile; q->param.mfx.TargetUsage= avctx->compression_level; q->param.mfx.GopPicSize = FFMAX(0, avctx->gop_size); diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index eed6f2c2c2..70e0b048ee 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -89,6 +89,7 @@ { "adaptive_b", "Adaptive B-frame placement", OFFSET(qsv.adaptive_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \ { "b_strategy", "Strategy to choose between I/P/B-frames", OFFSET(qsv.b_strategy),AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \ { "forced_idr", "Forcing I frames as IDR frames", OFFSET(qsv.forced_idr), AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE }, \ +{ "low_power", "enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, { .i64 = 0}, 0, 1, VE},\ typedef int SetEncodeCtrlCB (AVCodecContext *avctx, const AVFrame *frame, mfxEncodeCtrl* enc_ctrl); diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c index 2bf3419d27..27f36b9f7b 100644 --- a/libavcodec/qsvenc_h264.c +++ b/libavcodec/qsvenc_h264.c @@ -148,10 +148,6 @@ static const AVOption options[] = { { "auto" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_MF_AUTO }, INT_MIN, INT_MAX, VE, "mfmode" }, #endif -#if QSV_HAVE_VDENC -{ "low_power", "enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE}, -#endif - { "repeat_pps", "repeat pps for every frame", OFFSET(qsv.repeat_pps), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, { NULL }, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavu/hwcontext_qsv: Fix the realign check for hwupload
ffmpeg | branch: master | Linjie Fu | Mon Apr 15 21:23:40 2019 +0800| [2d81acaa1adf2280d74d280491f05f0baa4a31d9] | committer: Zhong Li lavu/hwcontext_qsv: Fix the realign check for hwupload Fix the aligned check in hwupload, input surface should be 16 aligned too. Partly fix #7830. Signed-off-by: Linjie Fu Signed-off-by: Zhong Li > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2d81acaa1adf2280d74d280491f05f0baa4a31d9 --- libavutil/hwcontext_qsv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 8f9838d7d8..49b5952cef 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -892,8 +892,7 @@ static int qsv_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst, if (ret < 0) return ret; - -if (src->height & 16 || src->linesize[0] & 16) { +if (src->height & 15 || src->linesize[0] & 15) { realigned = 1; memset(&tmp_frame, 0, sizeof(tmp_frame)); tmp_frame.format = src->format; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/qsvenc: Fix the memory leak for enc_ctrl.Payload
ffmpeg | branch: master | Linjie Fu | Mon Apr 15 21:23:18 2019 +0800| [8f6e65183354d1d402ae80c71cba2759fe152018] | committer: Zhong Li lavc/qsvenc: Fix the memory leak for enc_ctrl.Payload frame->enc_ctrl.Payload is malloced in get_free_frame, directly memset the whole structure of enc_ctrl to zero will cause the memory leak for enc_ctrl.Payload. frame->enc_ctrl as a structure will be malloc and init to zero by calling frame = av_mallocz(sizeof(*frame)), so the memset is redundant and can be removed. Signed-off-by: Linjie Fu Signed-off-by: Zhong Li > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8f6e65183354d1d402ae80c71cba2759fe152018 --- libavcodec/qsvenc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index a03ab69590..8dbad713d0 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -1307,7 +1307,6 @@ static int encode_frame(AVCodecContext *avctx, QSVEncContext *q, if (qsv_frame) { surf = &qsv_frame->surface; enc_ctrl = &qsv_frame->enc_ctrl; -memset(enc_ctrl, 0, sizeof(mfxEncodeCtrl)); if (frame->pict_type == AV_PICTURE_TYPE_I) { enc_ctrl->FrameType = MFX_FRAMETYPE_I | MFX_FRAMETYPE_REF; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavf/qsvvpp: avoid the double-free when working in sys memory mode
ffmpeg | branch: master | Linjie Fu | Mon Apr 15 21:24:06 2019 +0800| [6895b350c31d8fda5bd9e4285c52de6e391e7ff4] | committer: Zhong Li lavf/qsvvpp: avoid the double-free when working in sys memory mode Currently, picref will be freed by calling av_frame_free(&picref) in submit_frame() in qsvvpp.c when working in system memory mode,and normally it is freed in filter_frame() in vf_vpp_qsv.c when working in other modes. Double free happens when working in system memory mode, remove to fix the memory issue. Reproduce: ffmpeg -init_hw_device qsv=foo -filter_hw_device foo -f rawvideo -pix_fmt nv12 -s:v 852x480 \ -i 852x480.nv12 -vf 'vpp_qsv=w=500:h=400' -f rawvideo -pix_fmt nv12 qsv.nv12 Signed-off-by: Linjie Fu Signed-off-by: Zhong Li > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6895b350c31d8fda5bd9e4285c52de6e391e7ff4 --- libavfilter/qsvvpp.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c index 06efdf5089..5cd1d5d345 100644 --- a/libavfilter/qsvvpp.c +++ b/libavfilter/qsvvpp.c @@ -316,7 +316,6 @@ static QSVFrame *submit_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *p } av_frame_copy_props(qsv_frame->frame, picref); -av_frame_free(&picref); } else qsv_frame->frame = av_frame_clone(picref); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavu/hwcontext_qsv: fix the memory leak
ffmpeg | branch: master | Linjie Fu | Fri Jul 26 16:00:24 2019 +0800| [b3b7523feb5acbe1a3376104616fca389e1aaeca] | committer: Zhong Li lavu/hwcontext_qsv: fix the memory leak av_dict_free child_device_opts to fix the memory leak. Signed-off-by: Linjie Fu Signed-off-by: Zhong Li > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b3b7523feb5acbe1a3376104616fca389e1aaeca --- libavutil/hwcontext_qsv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 59e4ed9157..0329a81ec3 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -1240,6 +1240,8 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device, ret = av_hwdevice_ctx_create(&priv->child_device_ctx, child_device_type, e ? e->value : NULL, child_device_opts, 0); + +av_dict_free(&child_device_opts); if (ret < 0) return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavf/vf_vpp_qsv: add support for QSV transpose filter
ffmpeg | branch: master | Linjie Fu | Thu Jul 11 01:57:46 2019 +0800| [af3ddd581faf2c3c4748ae589947c662b1a2271e] | committer: Zhong Li lavf/vf_vpp_qsv: add support for QSV transpose filter Add transpose support for qsv_vpp with rotate and hflip: - rotate: [0, 3] support clockwise rotation of 0, 90, 180, 270; - hflip: [0, 1] support horizontal flip; Configure with: {"cclock_hflip","clock","cclock","clock_hflip","reversal","hflip","vflip"} CMD: ffmpeg -hwaccel qsv -c:v h264_qsv -i input.h264 -vf 'format=qsv,vpp_qsv=transpose=clock' -c:v h264_qsv output.h264 ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -c:v h264_qsv -i input.h264 -vf 'hwupload=extra_hw_frames=64,format=qsv,vpp_qsv=transpose=cclock_hflip' -f rawvideo -pix_fmt nv12 ./transpose.yuv Signed-off-by: Linjie Fu Signed-off-by: Zhong Li > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=af3ddd581faf2c3c4748ae589947c662b1a2271e --- libavfilter/vf_vpp_qsv.c | 101 ++- 1 file changed, 99 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 915cf748c4..f18513359a 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -36,12 +36,15 @@ #include "libavformat/avformat.h" #include "qsvvpp.h" +#include "transpose.h" #define OFFSET(x) offsetof(VPPContext, x) #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM) /* number of video enhancement filters */ -#define ENH_FILTERS_COUNT (5) +#define ENH_FILTERS_COUNT (7) +#define QSV_HAVE_ROTATION QSV_VERSION_ATLEAST(1, 17) +#define QSV_HAVE_MIRRORING QSV_VERSION_ATLEAST(1, 19) typedef struct VPPContext{ const AVClass *class; @@ -54,6 +57,8 @@ typedef struct VPPContext{ mfxExtVPPDenoise denoise_conf; mfxExtVPPDetail detail_conf; mfxExtVPPProcAmp procamp_conf; +mfxExtVPPRotation rotation_conf; +mfxExtVPPMirroring mirroring_conf; int out_width; int out_height; @@ -74,6 +79,10 @@ typedef struct VPPContext{ int crop_x; int crop_y; +int transpose; +int rotate; /* rotate angle : [0, 90, 180, 270] */ +int hflip; /* flip mode : 0 = off, 1 = HORIZONTAL flip */ + /* param for the procamp */ intprocamp;/* enable procamp */ float hue; @@ -100,6 +109,15 @@ static const AVOption options[] = { { "contrast","ProcAmp contrast", OFFSET(contrast), AV_OPT_TYPE_FLOAT,{ .dbl = 1.0 }, 0.0, 10.0, .flags = FLAGS}, { "brightness", "ProcAmp brightness", OFFSET(brightness), AV_OPT_TYPE_FLOAT,{ .dbl = 0.0 }, -100.0, 100.0, .flags = FLAGS}, +{ "transpose", "set transpose direction", OFFSET(transpose), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 6, FLAGS, "transpose"}, +{ "cclock_hflip", "rotate counter-clockwise with horizontal flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK_FLIP }, .flags=FLAGS, .unit = "transpose" }, +{ "clock", "rotate clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK }, .flags=FLAGS, .unit = "transpose" }, +{ "cclock","rotate counter-clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK }, .flags=FLAGS, .unit = "transpose" }, +{ "clock_hflip", "rotate clockwise with horizontal flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK_FLIP }, .flags=FLAGS, .unit = "transpose" }, +{ "reversal", "rotate by half-turn", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_REVERSAL}, .flags=FLAGS, .unit = "transpose" }, +{ "hflip", "flip horizontally", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_HFLIP }, .flags=FLAGS, .unit = "transpose" }, +{ "vflip", "flip vertically", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_VFLIP }, .flags=FLAGS, .unit = "transpose" }, + { "cw", "set the width crop area expression", OFFSET(cw), AV_OPT_TYPE_STRING, { .str = "iw" }, CHAR_MIN, CHAR_MAX, FLAGS }, { "ch", "set the height crop area expression", OFFSET(ch), AV_OPT_TYPE_STRING, { .str = "ih" }, CHAR_MIN, CHAR_MAX, FLAGS }, { "cx", "set the x crop area expression", OFFSET(cx), AV_OPT_TYPE_STRING, { .str = "(in_w-out_w)/2" }, CHAR_MIN, CHAR_MAX, FLAGS },
[FFmpeg-cvslog] swscale/output: fix some code indentations
ffmpeg | branch: master | Linjie Fu | Thu Sep 5 11:01:15 2019 +0800| [ef1342650f97b34e2bf4b25a81278fa5b3c2d17e] | committer: Michael Niedermayer swscale/output: fix some code indentations Signed-off-by: Linjie Fu Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ef1342650f97b34e2bf4b25a81278fa5b3c2d17e --- libswscale/output.c | 70 ++--- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/libswscale/output.c b/libswscale/output.c index 26b0ff3d48..7eb4644ce6 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -630,28 +630,28 @@ yuv2mono_2_c_template(SwsContext *c, const int16_t *buf[2], } c->dither_error[0][i] = err; } else { -for (i = 0; i < dstW; i += 8) { -int Y, acc = 0; - -Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19; -accumulate_bit(acc, Y + d128[0]); -Y = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19; -accumulate_bit(acc, Y + d128[1]); -Y = (buf0[i + 2] * yalpha1 + buf1[i + 2] * yalpha) >> 19; -accumulate_bit(acc, Y + d128[2]); -Y = (buf0[i + 3] * yalpha1 + buf1[i + 3] * yalpha) >> 19; -accumulate_bit(acc, Y + d128[3]); -Y = (buf0[i + 4] * yalpha1 + buf1[i + 4] * yalpha) >> 19; -accumulate_bit(acc, Y + d128[4]); -Y = (buf0[i + 5] * yalpha1 + buf1[i + 5] * yalpha) >> 19; -accumulate_bit(acc, Y + d128[5]); -Y = (buf0[i + 6] * yalpha1 + buf1[i + 6] * yalpha) >> 19; -accumulate_bit(acc, Y + d128[6]); -Y = (buf0[i + 7] * yalpha1 + buf1[i + 7] * yalpha) >> 19; -accumulate_bit(acc, Y + d128[7]); - -output_pixel(*dest++, acc); -} +for (i = 0; i < dstW; i += 8) { +int Y, acc = 0; + +Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19; +accumulate_bit(acc, Y + d128[0]); +Y = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19; +accumulate_bit(acc, Y + d128[1]); +Y = (buf0[i + 2] * yalpha1 + buf1[i + 2] * yalpha) >> 19; +accumulate_bit(acc, Y + d128[2]); +Y = (buf0[i + 3] * yalpha1 + buf1[i + 3] * yalpha) >> 19; +accumulate_bit(acc, Y + d128[3]); +Y = (buf0[i + 4] * yalpha1 + buf1[i + 4] * yalpha) >> 19; +accumulate_bit(acc, Y + d128[4]); +Y = (buf0[i + 5] * yalpha1 + buf1[i + 5] * yalpha) >> 19; +accumulate_bit(acc, Y + d128[5]); +Y = (buf0[i + 6] * yalpha1 + buf1[i + 6] * yalpha) >> 19; +accumulate_bit(acc, Y + d128[6]); +Y = (buf0[i + 7] * yalpha1 + buf1[i + 7] * yalpha) >> 19; +accumulate_bit(acc, Y + d128[7]); + +output_pixel(*dest++, acc); +} } } @@ -687,19 +687,19 @@ yuv2mono_1_c_template(SwsContext *c, const int16_t *buf0, } c->dither_error[0][i] = err; } else { -for (i = 0; i < dstW; i += 8) { -int acc = 0; -accumulate_bit(acc, ((buf0[i + 0] + 64) >> 7) + d128[0]); -accumulate_bit(acc, ((buf0[i + 1] + 64) >> 7) + d128[1]); -accumulate_bit(acc, ((buf0[i + 2] + 64) >> 7) + d128[2]); -accumulate_bit(acc, ((buf0[i + 3] + 64) >> 7) + d128[3]); -accumulate_bit(acc, ((buf0[i + 4] + 64) >> 7) + d128[4]); -accumulate_bit(acc, ((buf0[i + 5] + 64) >> 7) + d128[5]); -accumulate_bit(acc, ((buf0[i + 6] + 64) >> 7) + d128[6]); -accumulate_bit(acc, ((buf0[i + 7] + 64) >> 7) + d128[7]); - -output_pixel(*dest++, acc); -} +for (i = 0; i < dstW; i += 8) { +int acc = 0; +accumulate_bit(acc, ((buf0[i + 0] + 64) >> 7) + d128[0]); +accumulate_bit(acc, ((buf0[i + 1] + 64) >> 7) + d128[1]); +accumulate_bit(acc, ((buf0[i + 2] + 64) >> 7) + d128[2]); +accumulate_bit(acc, ((buf0[i + 3] + 64) >> 7) + d128[3]); +accumulate_bit(acc, ((buf0[i + 4] + 64) >> 7) + d128[4]); +accumulate_bit(acc, ((buf0[i + 5] + 64) >> 7) + d128[5]); +accumulate_bit(acc, ((buf0[i + 6] + 64) >> 7) + d128[6]); +accumulate_bit(acc, ((buf0[i + 7] + 64) >> 7) + d128[7]); + +output_pixel(*dest++, acc); +} } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/qsvenc: add return check for ff_qsv_map_pixfmt
ffmpeg | branch: master | Linjie Fu | Tue Feb 25 10:02:33 2020 +0800| [c39b6e1425f041622a4e58d1c7c215c75a04a845] | committer: Haihao Xiang lavc/qsvenc: add return check for ff_qsv_map_pixfmt Return an error directly if pixfmt is not supported for encoding, otherwise it may be hidden until query/check in MSDK. Signed-off-by: Linjie Fu Signed-off-by: Haihao Xiang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c39b6e1425f041622a4e58d1c7c215c75a04a845 --- libavcodec/qsvenc.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 602436da63..4e7a15f060 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -578,7 +578,9 @@ static int init_video_param_jpeg(AVCodecContext *avctx, QSVEncContext *q) if (!desc) return AVERROR_BUG; -ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC); +ret = ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC); +if (ret < 0) +return AVERROR_BUG; q->param.mfx.FrameInfo.CropX = 0; q->param.mfx.FrameInfo.CropY = 0; @@ -681,7 +683,9 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) if (!desc) return AVERROR_BUG; -ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC); +ret = ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC); +if (ret < 0) +return AVERROR_BUG; q->param.mfx.FrameInfo.CropX = 0; q->param.mfx.FrameInfo.CropY = 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavf/vf_deinterlace_vaapi: flush queued frame for field in DeinterlacingBob
ffmpeg | branch: master | Linjie Fu | Wed Sep 18 16:19:58 2019 +0800| [9c58fd22269c9784f1f97d7e4a30daf4e06917f8] | committer: Haihao Xiang lavf/vf_deinterlace_vaapi: flush queued frame for field in DeinterlacingBob For DeinterlacingBob mode with rate=field, the frame number of output should equal 2x input total since only intra deinterlace is used. Currently for "backward_ref = 0, rate = field", extra_delay is introduced. Due to the async without flush, frame number of output is [expected_number - 2]. Specifically, if the input only has 1 frame, the output will be empty. Add deint_vaapi_request_frame for deinterlace_vaapi, send NULL frame to flush the queued frame. For 1 frame input in Bob mode with rate=field, before patch: 0 frame; after patch: 2 frames; ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i input.h264 -an -vf deinterlace_vaapi=mode=bob:rate=field -f null - Tested-by: Mark Thompson Reviewed-by: Mark Thompson Signed-off-by: Linjie Fu Signed-off-by: Haihao Xiang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9c58fd22269c9784f1f97d7e4a30daf4e06917f8 --- libavfilter/vf_deinterlace_vaapi.c | 44 -- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/libavfilter/vf_deinterlace_vaapi.c b/libavfilter/vf_deinterlace_vaapi.c index 65f319ba9a..1304561034 100644 --- a/libavfilter/vf_deinterlace_vaapi.c +++ b/libavfilter/vf_deinterlace_vaapi.c @@ -46,6 +46,9 @@ typedef struct DeintVAAPIContext { intqueue_count; AVFrame *frame_queue[MAX_REFERENCES]; intextra_delay_for_timestamps; + +inteof; +intprev_pts; } DeintVAAPIContext; static const char *deint_vaapi_mode_name(int mode) @@ -188,9 +191,11 @@ static int deint_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame) void *filter_params_addr = NULL; int err, i, field, current_frame_index; -av_log(avctx, AV_LOG_DEBUG, "Filter input: %s, %ux%u (%"PRId64").\n", - av_get_pix_fmt_name(input_frame->format), - input_frame->width, input_frame->height, input_frame->pts); +// NULL frame is used to flush the queue in field mode +if (input_frame) +av_log(avctx, AV_LOG_DEBUG, "Filter input: %s, %ux%u (%"PRId64").\n", +av_get_pix_fmt_name(input_frame->format), +input_frame->width, input_frame->height, input_frame->pts); if (ctx->queue_count < ctx->queue_depth) { ctx->frame_queue[ctx->queue_count++] = input_frame; @@ -208,6 +213,9 @@ static int deint_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame) current_frame_index = ctx->pipeline_caps.num_forward_references; input_frame = ctx->frame_queue[current_frame_index]; +if (!input_frame) +return 0; + input_surface = (VASurfaceID)(uintptr_t)input_frame->data[3]; for (i = 0; i < ctx->pipeline_caps.num_forward_references; i++) forward_references[i] = (VASurfaceID)(uintptr_t) @@ -289,6 +297,8 @@ static int deint_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame) if (ctx->field_rate == 2) { if (field == 0) output_frame->pts = 2 * input_frame->pts; +else if (ctx->eof) +output_frame->pts = 3 * input_frame->pts - ctx->prev_pts; else output_frame->pts = input_frame->pts + ctx->frame_queue[current_frame_index + 1]->pts; @@ -304,6 +314,8 @@ static int deint_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame) break; } +ctx->prev_pts = input_frame->pts; + return err; fail: @@ -313,6 +325,25 @@ fail: return err; } +static int deint_vaapi_request_frame(AVFilterLink *link) +{ +AVFilterContext *avctx = link->src; +DeintVAAPIContext *ctx = avctx->priv; +int ret; + +if (ctx->eof) +return AVERROR_EOF; + +ret = ff_request_frame(link->src->inputs[0]); +if (ret == AVERROR_EOF && ctx->extra_delay_for_timestamps) { +ctx->eof = 1; +deint_vaapi_filter_frame(link->src->inputs[0], NULL); +} else if (ret < 0) +return ret; + +return 0; +} + static av_cold int deint_vaapi_init(AVFilterContext *avctx) { VAAPIVPPContext *vpp_ctx = avctx->priv; @@ -373,9 +404,10 @@ static const AVFilterPad deint_vaapi_inputs[] = { static const AVFilterPad deint_vaapi_outputs[] = { { -.name = "default", -.type = AVMEDIA_TYPE_VIDEO, -.config_props = &deint_vaapi_config_output, +.name = "default", +.type = AVMEDIA_TYPE_VIDEO, +.request_frame = &deint_va
[FFmpeg-cvslog] lavc/vaapi_encode_h265: Add GPB frame support for hevc_vaapi
ffmpeg | branch: master | Linjie Fu | Thu Mar 17 14:41:49 2022 +0800| [a285968a0b122484635846babd9a1e8183e70fb0] | committer: Haihao Xiang lavc/vaapi_encode_h265: Add GPB frame support for hevc_vaapi Use GPB frames to replace regular P/B frames if backend driver does not support it. - GPB: Generalized P and B picture. Regular P/B frames replaced by B frames with previous-predict only, L0 == L1. Normal B frames still have 2 different ref_lists and allow bi-prediction Signed-off-by: Linjie Fu Signed-off-by: Fei Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a285968a0b122484635846babd9a1e8183e70fb0 --- libavcodec/vaapi_encode.c | 67 ++ libavcodec/vaapi_encode.h | 1 + libavcodec/vaapi_encode_h265.c | 15 ++ 3 files changed, 78 insertions(+), 5 deletions(-) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index ffd6cb1c25..21a0ed0827 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -1875,6 +1875,7 @@ static av_cold int vaapi_encode_init_gop_structure(AVCodecContext *avctx) VAStatus vas; VAConfigAttrib attr = { VAConfigAttribEncMaxRefFrames }; uint32_t ref_l0, ref_l1; +int prediction_pre_only; vas = vaGetConfigAttributes(ctx->hwctx->display, ctx->va_profile, @@ -1893,6 +1894,51 @@ static av_cold int vaapi_encode_init_gop_structure(AVCodecContext *avctx) ref_l1 = attr.value >> 16 & 0x; } +ctx->p_to_gpb = 0; +prediction_pre_only = 0; + +#if VA_CHECK_VERSION(1, 9, 0) +if (!(ctx->codec->flags & FLAG_INTRA_ONLY || +avctx->gop_size <= 1)) { +attr = (VAConfigAttrib) { VAConfigAttribPredictionDirection }; +vas = vaGetConfigAttributes(ctx->hwctx->display, +ctx->va_profile, +ctx->va_entrypoint, +&attr, 1); +if (vas != VA_STATUS_SUCCESS) { +av_log(avctx, AV_LOG_WARNING, "Failed to query prediction direction " + "attribute: %d (%s).\n", vas, vaErrorStr(vas)); +return AVERROR_EXTERNAL; +} else if (attr.value == VA_ATTRIB_NOT_SUPPORTED) { +av_log(avctx, AV_LOG_VERBOSE, "Driver does not report any additional " + "prediction constraints.\n"); +} else { +if (((ref_l0 > 0 || ref_l1 > 0) && !(attr.value & VA_PREDICTION_DIRECTION_PREVIOUS)) || +((ref_l1 == 0) && (attr.value & (VA_PREDICTION_DIRECTION_FUTURE | VA_PREDICTION_DIRECTION_BI_NOT_EMPTY { +av_log(avctx, AV_LOG_ERROR, "Driver report incorrect prediction " + "direction attribute.\n"); +return AVERROR_EXTERNAL; +} + +if (!(attr.value & VA_PREDICTION_DIRECTION_FUTURE)) { +if (ref_l0 > 0 && ref_l1 > 0) { +prediction_pre_only = 1; +av_log(avctx, AV_LOG_VERBOSE, "Driver only support same reference " + "lists for B-frames.\n"); +} +} + +if (attr.value & VA_PREDICTION_DIRECTION_BI_NOT_EMPTY) { +if (ref_l0 > 0 && ref_l1 > 0) { +ctx->p_to_gpb = 1; +av_log(avctx, AV_LOG_VERBOSE, "Driver does not support P-frames, " + "replacing them with B-frames.\n"); +} +} +} +} +#endif + if (ctx->codec->flags & FLAG_INTRA_ONLY || avctx->gop_size <= 1) { av_log(avctx, AV_LOG_VERBOSE, "Using intra frames only.\n"); @@ -1902,15 +1948,26 @@ static av_cold int vaapi_encode_init_gop_structure(AVCodecContext *avctx) "reference frames.\n"); return AVERROR(EINVAL); } else if (!(ctx->codec->flags & FLAG_B_PICTURES) || - ref_l1 < 1 || avctx->max_b_frames < 1) { -av_log(avctx, AV_LOG_VERBOSE, "Using intra and P-frames " - "(supported references: %d / %d).\n", ref_l0, ref_l1); + ref_l1 < 1 || avctx->max_b_frames < 1 || + prediction_pre_only) { +if (ctx->p_to_gpb) + av_log(avctx, AV_LOG_VERBOSE, "Using intra and B-frames " + "(supported references: %d / %d).\n", + ref_l0, ref_l1); +else +av_log(avctx, AV_LOG_VERBOSE, "Using intra and P-frames " + "(supported references: %d / %d).\n", ref_l0, ref_l1); ctx->gop_size = avctx->gop_size;
[FFmpeg-cvslog] mailmap: add entry for myself
ffmpeg | branch: master | Linjie Fu | Mon Mar 8 15:06:10 2021 +| [74b5564fb51107fc512bd25081ce7e11cb35871e] | committer: Linjie Fu mailmap: add entry for myself Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=74b5564fb51107fc512bd25081ce7e11cb35871e --- .mailmap | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index 3bd1a85c3c..ba072f38c8 100644 --- a/.mailmap +++ b/.mailmap @@ -10,7 +10,8 @@ - + + ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools/ffmpeg_filter: fix the flags parsing for scaler
ffmpeg | branch: master | Linjie Fu | Sun Aug 1 18:58:19 2021 +0800| [b3a0548a981db52911dd34d9de254c4fee0a8f79] | committer: Linjie Fu fftools/ffmpeg_filter: fix the flags parsing for scaler Scaler relys on "-sws_flags" option to pass the flags to swscale and scale filter. Currently passing "sws_flags=xxx" as a filter option to scaler leads to an incorrect option parsing. Check and change the string to "flags=xxx" and dumped flags information. (Refer to parse_sws_flags()) CMD: $ffmpeg -v verbose -i input.mp4 -sws_flags lanczos+bitexact+accurate_rnd \ -vf format=yuv420p,scale=800x600 -an -vframes 10 -f md5 - Before: [auto_scaler_0 @ 0x7f96c3808680] w:iw h:ih flags:'' interl:0 [auto_scaler_0 @ 0x7f96c3808680] w:1920 h:1080 fmt:yuvj420p sar:0/1 -> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0x0 [Parsed_scale_1 @ 0x7f96c3806e40] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:800 h:600 fmt:yuv420p sar:0/1 flags:0x0 MD5=ff1d6091690c6fcd36d458d2a9f648ce After: [auto_scaler_0 @ 0x7fe94563b4c0] w:iw h:ih flags:'lanczos+bitexact+accurate_rnd' interl:0 [auto_scaler_0 @ 0x7fe94563b4c0] w:1920 h:1080 fmt:yuvj420p sar:0/1 -> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0xc0200 [Parsed_scale_1 @ 0x7fe945639d00] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:800 h:600 fmt:yuv420p sar:0/1 flags:0xc0200 MD5=ff1d6091690c6fcd36d458d2a9f648ce Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b3a0548a981db52911dd34d9de254c4fee0a8f79 --- fftools/ffmpeg_filter.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 958d74f008..94838adc56 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -977,7 +977,11 @@ int configure_filtergraph(FilterGraph *fg) } if (strlen(args)) args[strlen(args)-1] = 0; -fg->graph->scale_sws_opts = av_strdup(args); + +if (!strncmp(args, "sws_flags=", 10)) { +// keep the 'flags=' part +fg->graph->scale_sws_opts = av_strdup(args+4); +} args[0] = 0; while ((e = av_dict_get(ost->swr_opts, "", e, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fftools: Don't set default swscale flags in ffmpeg/ffprobe/ffplay
ffmpeg | branch: master | Linjie Fu | Thu Aug 5 00:37:29 2021 +0800| [5b0e6b0d82dfcc5c6b999e2678b52b0cff38ae0a] | committer: Linjie Fu fftools: Don't set default swscale flags in ffmpeg/ffprobe/ffplay Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5b0e6b0d82dfcc5c6b999e2678b52b0cff38ae0a --- fftools/cmdutils.c | 8 fftools/ffplay.c | 2 -- fftools/ffprobe.c | 1 - 3 files changed, 11 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 0b1ef03a25..912e881174 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -81,11 +81,6 @@ enum show_muxdemuxers { SHOW_MUXERS, }; -void init_opts(void) -{ -av_dict_set(&sws_dict, "flags", "bicubic", 0); -} - void uninit_opts(void) { av_dict_free(&swr_opts); @@ -670,7 +665,6 @@ static void finish_group(OptionParseContext *octx, int group_idx, resample_opts = NULL; sws_dict= NULL; swr_opts= NULL; -init_opts(); memset(&octx->cur_group, 0, sizeof(octx->cur_group)); } @@ -708,8 +702,6 @@ static void init_parse_context(OptionParseContext *octx, octx->global_opts.group_def = &global_group; octx->global_opts.arg = ""; - -init_opts(); } void uninit_parse_context(OptionParseContext *octx) diff --git a/fftools/ffplay.c b/fftools/ffplay.c index 6b19574eae..46758b9f55 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -3695,8 +3695,6 @@ int main(int argc, char **argv) #endif avformat_network_init(); -init_opts(); - signal(SIGINT , sigterm_handler); /* Interrupt (ANSI).*/ signal(SIGTERM, sigterm_handler); /* Termination (ANSI). */ diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index f411ba35b5..95263e1e6f 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -3721,7 +3721,6 @@ int main(int argc, char **argv) options = real_options; parse_loglevel(argc, argv, options); avformat_network_init(); -init_opts(); #if CONFIG_AVDEVICE avdevice_register_all(); #endif ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavfi/vf_scale: use default swscale flags for scaler
ffmpeg | branch: master | Linjie Fu | Thu Aug 5 00:35:02 2021 +0800| [9f14396a5103ec80893db801035ece5d14c0d3c5] | committer: Linjie Fu lavfi/vf_scale: use default swscale flags for scaler Currently the default swscale flags for simple filter graph is bicubic, however for complex filter graph it uses bilinear as decleared in scale filter. $ffmpeg -v verbose -i input.mp4 -vf format=yuv420p,scale=800x600 -an -f null - [Parsed_scale_1 @ 0x7f86d2c160c0] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:800 h:600 fmt:yuv420p sar:0/1 flags:0x4 $ffmpeg -v verbose -i input.mp4 -filter_complex format=yuv420p,scale=800x600 -an -f null - [Parsed_scale_1 @ 0x7f8779e046c0] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:800 h:600 fmt:yuv420p sar:0/1 flags:0x2 Use default swscale flags (bicubic currently) for scale filter. - Remove flags="bilinear" from vf_scale - Update the FATE refs Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9f14396a5103ec80893db801035ece5d14c0d3c5 --- libavfilter/vf_scale.c | 4 ++-- tests/ref/fate/filter-scale2ref_keep_aspect | 10 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index f07e01bf90..aa855b894a 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -313,7 +313,7 @@ static av_cold int init_dict(AVFilterContext *ctx, AVDictionary **opts) scale->flags = 0; -if (scale->flags_str) { +if (scale->flags_str && *scale->flags_str) { const AVClass *class = sws_get_class(); const AVOption*o = av_opt_find(&class, "sws_flags", NULL, 0, AV_OPT_SEARCH_FAKE_OBJ); @@ -900,7 +900,7 @@ static const AVOption scale_options[] = { { "width", "Output video width", OFFSET(w_expr), AV_OPT_TYPE_STRING,.flags = TFLAGS }, { "h", "Output video height", OFFSET(h_expr), AV_OPT_TYPE_STRING,.flags = TFLAGS }, { "height","Output video height", OFFSET(h_expr), AV_OPT_TYPE_STRING,.flags = TFLAGS }, -{ "flags", "Flags to pass to libswscale", OFFSET(flags_str), AV_OPT_TYPE_STRING, { .str = "bilinear" }, .flags = FLAGS }, +{ "flags", "Flags to pass to libswscale", OFFSET(flags_str), AV_OPT_TYPE_STRING, { .str = "" }, .flags = FLAGS }, { "interl", "set interlacing", OFFSET(interlaced), AV_OPT_TYPE_BOOL, {.i64 = 0 }, -1, 1, FLAGS }, { "size", "set video size", OFFSET(size_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, FLAGS }, { "s", "set video size", OFFSET(size_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, FLAGS }, diff --git a/tests/ref/fate/filter-scale2ref_keep_aspect b/tests/ref/fate/filter-scale2ref_keep_aspect index 8dd0dbb13b..53c6fc14ec 100644 --- a/tests/ref/fate/filter-scale2ref_keep_aspect +++ b/tests/ref/fate/filter-scale2ref_keep_aspect @@ -7,8 +7,8 @@ #dimensions 0: 160x120 #sar 0: 1/1 #stream#, dts,pts, duration, size, hash -0, 0, 0,1,57600, 9a19c23dc3a557786840d0098606d5f1 -0, 1, 1,1,57600, e6fbdabaf1bb0d28afc648ed4d27e9f0 -0, 2, 2,1,57600, 52924ed0a751214c50fb2e7a626c8cc5 -0, 3, 3,1,57600, 67d5fd6ee71793f1cf8794d1c27afdce -0, 4, 4,1,57600, 85f7775f7b01afd369fc8919dc759d30 +0, 0, 0,1,57600, 65fe9892ad710cc5763b04b390327d40 +0, 1, 1,1,57600, 5e8d4524bc8889afa8769e851e998bc0 +0, 2, 2,1,57600, 8f5e0e58d1f4c2104b82ef7a16850f1e +0, 3, 3,1,57600, cfe4142845e1445d33748493faa63cda +0, 4, 4,1,57600, bb491f3b01788773fb6129aef0f0abd2 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] Revert "fftools/ffmpeg_filter: fix the flags parsing for scaler"
ffmpeg | branch: master | Linjie Fu | Mon Aug 30 21:26:31 2021 +0800| [7352c370faa793f897f44d48e7ddc11a4f11bf92] | committer: Linjie Fu Revert "fftools/ffmpeg_filter: fix the flags parsing for scaler" This reverts commit b3a0548a981db52911dd34d9de254c4fee0a8f79. This breaks the usage of swscale options, scale_sws_opts should be passed to auto-inserted scale-filters. Signed-off-by: Linjie Fu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7352c370faa793f897f44d48e7ddc11a4f11bf92 --- fftools/ffmpeg_filter.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 67ae2dc824..21d54cc8ae 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -983,11 +983,7 @@ int configure_filtergraph(FilterGraph *fg) } if (strlen(args)) { args[strlen(args)-1] = 0; - -if (!strncmp(args, "sws_flags=", 10)) { -// keep the 'flags=' part -fg->graph->scale_sws_opts = av_strdup(args+4); -} +fg->graph->scale_sws_opts = av_strdup(args); } args[0] = 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/avcodec: Add HEVC Screen Content Coding Extensions profile
ffmpeg | branch: master | Linjie Fu | Thu Feb 16 13:46:28 2023 +0800| [f45937754368fd6e34d4a4c61b8736f2d22136ab] | committer: Haihao Xiang lavc/avcodec: Add HEVC Screen Content Coding Extensions profile Described in HEVC spec A.3.7. Bump minor version and add APIchanges entry for new added profile. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f45937754368fd6e34d4a4c61b8736f2d22136ab --- doc/APIchanges| 3 +++ libavcodec/avcodec.h | 1 + libavcodec/hevc_ps.c | 2 ++ libavcodec/profiles.c | 1 + libavcodec/version.h | 2 +- 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 0ba18e8609..9f851c7346 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09 API changes, most recent first: +2023-02-25 - xx - lavc 60.5.100 - avcodec.h + Add FF_PROFILE_HEVC_SCC. + 8< - FFmpeg 6.0 was cut here 8< - 2023-02-16 - 927042b409 - lavf 60.2.100 - avformat.h diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 39881a1d2b..9a0fe97cad 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1654,6 +1654,7 @@ typedef struct AVCodecContext { #define FF_PROFILE_HEVC_MAIN_10 2 #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 #define FF_PROFILE_HEVC_REXT4 +#define FF_PROFILE_HEVC_SCC 9 #define FF_PROFILE_VVC_MAIN_10 1 #define FF_PROFILE_VVC_MAIN_10_444 33 diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 5fe62ec35b..4aa5b76d5f 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -259,6 +259,8 @@ static int decode_profile_tier_level(GetBitContext *gb, AVCodecContext *avctx, av_log(avctx, AV_LOG_DEBUG, "Main Still Picture profile bitstream\n"); else if (ptl->profile_idc == FF_PROFILE_HEVC_REXT) av_log(avctx, AV_LOG_DEBUG, "Range Extension profile bitstream\n"); +else if (ptl->profile_idc == FF_PROFILE_HEVC_SCC) +av_log(avctx, AV_LOG_DEBUG, "Screen Content Coding Extension profile bitstream\n"); else av_log(avctx, AV_LOG_WARNING, "Unknown HEVC profile: %d\n", ptl->profile_idc); diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c index 7af7fbeb13..2230fc5415 100644 --- a/libavcodec/profiles.c +++ b/libavcodec/profiles.c @@ -85,6 +85,7 @@ const AVProfile ff_hevc_profiles[] = { { FF_PROFILE_HEVC_MAIN_10, "Main 10" }, { FF_PROFILE_HEVC_MAIN_STILL_PICTURE, "Main Still Picture" }, { FF_PROFILE_HEVC_REXT, "Rext"}, +{ FF_PROFILE_HEVC_SCC, "Scc" }, { FF_PROFILE_UNKNOWN }, }; diff --git a/libavcodec/version.h b/libavcodec/version.h index 06631ffa8c..7aa95fc3f1 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 4 +#define LIBAVCODEC_VERSION_MINOR 5 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/hevcdec: Fix the parsing for use_integer_mv_flag
ffmpeg | branch: master | Linjie Fu | Thu Feb 16 13:46:31 2023 +0800| [513d188d9bfe882580cdb8f3e9a8ed0c290875ad] | committer: Haihao Xiang lavc/hevcdec: Fix the parsing for use_integer_mv_flag According to 7.3.6.1, use_integer_mv_flag should be parsed if motion_vector_resolution_control_idc equals to 2. If not present, it equals to motion_vector_resolution_control_idc. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=513d188d9bfe882580cdb8f3e9a8ed0c290875ad --- libavcodec/hevcdec.c | 8 libavcodec/hevcdec.h | 1 + 2 files changed, 9 insertions(+) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index f9a97ac7f5..52fa627133 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -839,6 +839,14 @@ static int hls_slice_header(HEVCContext *s) sh->max_num_merge_cand); return AVERROR_INVALIDDATA; } + +// Syntax in 7.3.6.1 +if (s->ps.sps->motion_vector_resolution_control_idc == 2) +sh->use_integer_mv_flag = get_bits1(gb); +else +// Inferred to be equal to motion_vector_resolution_control_idc if not present +sh->use_integer_mv_flag = s->ps.sps->motion_vector_resolution_control_idc; + } sh->slice_qp_delta = get_se_golomb(gb); diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index 7841ba8565..a7fc669bcb 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -305,6 +305,7 @@ typedef struct SliceHeader { int tc_offset; ///< tc_offset_div2 * 2 unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand +uint8_t use_integer_mv_flag; unsigned *entry_point_offset; int * offset; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/hevcdec: Add slice parse support for HEVC SCC extension
ffmpeg | branch: master | Linjie Fu | Thu Feb 16 13:46:30 2023 +0800| [c1dceaf0c74fc010cf43744c36af6d9ebaa0b13d] | committer: Haihao Xiang lavc/hevcdec: Add slice parse support for HEVC SCC extension Signed-off-by: Linjie Fu Signed-off-by: Fei Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c1dceaf0c74fc010cf43744c36af6d9ebaa0b13d --- libavcodec/hevcdec.c | 6 ++ libavcodec/hevcdec.h | 4 2 files changed, 10 insertions(+) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 567e8d81d4..f9a97ac7f5 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -856,6 +856,12 @@ static int hls_slice_header(HEVCContext *s) sh->slice_cr_qp_offset = 0; } +if (s->ps.pps->pps_slice_act_qp_offsets_present_flag) { +sh->slice_act_y_qp_offset = get_se_golomb(gb); +sh->slice_act_cb_qp_offset = get_se_golomb(gb); +sh->slice_act_cr_qp_offset = get_se_golomb(gb); +} + if (s->ps.pps->chroma_qp_offset_list_enabled_flag) sh->cu_chroma_qp_offset_enabled_flag = get_bits1(gb); else diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index 9d3f4adbb3..7841ba8565 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -295,6 +295,10 @@ typedef struct SliceHeader { int slice_cb_qp_offset; int slice_cr_qp_offset; +int slice_act_y_qp_offset; +int slice_act_cb_qp_offset; +int slice_act_cr_qp_offset; + uint8_t cu_chroma_qp_offset_enabled_flag; int beta_offset;///< beta_offset_div2 * 2 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/hevcdec: Set max_num_merge_cand to uint8_t
ffmpeg | branch: master | Linjie Fu | Thu Feb 16 13:46:32 2023 +0800| [fc3837ba85eafaeb5674c3d6b574a79da46d55b2] | committer: Haihao Xiang lavc/hevcdec: Set max_num_merge_cand to uint8_t uint8_t is big enough and keep consistent with the definition in cbs_h265.h. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fc3837ba85eafaeb5674c3d6b574a79da46d55b2 --- libavcodec/hevcdec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index a7fc669bcb..aab816791e 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -304,7 +304,7 @@ typedef struct SliceHeader { int beta_offset;///< beta_offset_div2 * 2 int tc_offset; ///< tc_offset_div2 * 2 -unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand +uint8_t max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand uint8_t use_integer_mv_flag; unsigned *entry_point_offset; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/hevc: Update reference list for SCC
ffmpeg | branch: master | Linjie Fu | Thu Feb 16 13:46:33 2023 +0800| [09c656d9c4f6fc66f0f2d60c235bb393b979e27f] | committer: Haihao Xiang lavc/hevc: Update reference list for SCC Screen Content Coding allows non-intra slice in an IRAP frame which can reference the frame itself, and would mark the current decoded picture as "used for long-term reference", no matter TwoVersionsOfCurrDecPicFlag(8.1.3), hence some previous restricts are not suitable any more. Constructe RefPicListTemp and RefPicList according to 8-8/9/10. Disable slice decoding for SCC profile to avoid unexpected error in hevc native decoder and patch welcome. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=09c656d9c4f6fc66f0f2d60c235bb393b979e27f --- libavcodec/hevc_refs.c | 21 - libavcodec/hevcdec.c | 10 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c index 811e8feff8..96153a2459 100644 --- a/libavcodec/hevc_refs.c +++ b/libavcodec/hevc_refs.c @@ -322,7 +322,7 @@ int ff_hevc_slice_rpl(HEVCContext *s) return ret; if (!(s->rps[ST_CURR_BEF].nb_refs + s->rps[ST_CURR_AFT].nb_refs + - s->rps[LT_CURR].nb_refs)) { + s->rps[LT_CURR].nb_refs) && !s->ps.pps->pps_curr_pic_ref_enabled_flag) { av_log(s->avctx, AV_LOG_ERROR, "Zero refs in the frame RPS.\n"); return AVERROR_INVALIDDATA; } @@ -349,6 +349,13 @@ int ff_hevc_slice_rpl(HEVCContext *s) rpl_tmp.nb_refs++; } } +// Construct RefPicList0, RefPicList1 (8-8, 8-10) +if (s->ps.pps->pps_curr_pic_ref_enabled_flag) { +rpl_tmp.list[rpl_tmp.nb_refs] = s->ref->poc; +rpl_tmp.ref[rpl_tmp.nb_refs]= s->ref; +rpl_tmp.isLongTerm[rpl_tmp.nb_refs] = 1; +rpl_tmp.nb_refs++; +} } /* reorder the references if necessary */ @@ -371,6 +378,14 @@ int ff_hevc_slice_rpl(HEVCContext *s) rpl->nb_refs = FFMIN(rpl->nb_refs, sh->nb_refs[list_idx]); } +// 8-9 +if (s->ps.pps->pps_curr_pic_ref_enabled_flag && +!sh->rpl_modification_flag[list_idx] && +rpl_tmp.nb_refs > sh->nb_refs[L0]) { +rpl->list[sh->nb_refs[L0] - 1] = s->ref->poc; +rpl->ref[sh->nb_refs[L0] - 1] = s->ref; +} + if (sh->collocated_list == list_idx && sh->collocated_ref_idx < rpl->nb_refs) s->ref->collocated_ref = rpl->ref[sh->collocated_ref_idx]; @@ -541,5 +556,9 @@ int ff_hevc_frame_nb_refs(const HEVCContext *s) for (i = 0; i < long_rps->nb_refs; i++) ret += !!long_rps->used[i]; } + +if (s->ps.pps->pps_curr_pic_ref_enabled_flag) +ret++; + return ret; } diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 52fa627133..121ceb4e75 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -668,7 +668,8 @@ static int hls_slice_header(HEVCContext *s) sh->slice_type); return AVERROR_INVALIDDATA; } -if (IS_IRAP(s) && sh->slice_type != HEVC_SLICE_I) { +if (IS_IRAP(s) && sh->slice_type != HEVC_SLICE_I && +!s->ps.pps->pps_curr_pic_ref_enabled_flag) { av_log(s->avctx, AV_LOG_ERROR, "Inter slices in an IRAP frame.\n"); return AVERROR_INVALIDDATA; } @@ -3123,6 +3124,13 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) if (ret < 0) goto fail; } else { +if (s->avctx->profile == FF_PROFILE_HEVC_SCC) { +av_log(s->avctx, AV_LOG_ERROR, + "SCC profile is not yet implemented in hevc native decoder.\n"); +ret = AVERROR_PATCHWELCOME; +goto fail; +} + if (s->threads_number > 1 && s->sh.num_entry_point_offsets > 0) ctb_addr_ts = hls_slice_data_wpp(s, nal); else ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/hevc_ps: Add SPS/PPS parse support for HEVC extension syntax
ffmpeg | branch: master | Linjie Fu | Thu Feb 16 13:46:29 2023 +0800| [56e3cd23d486d6aa2e3dcddc57c8048547df4f42] | committer: Haihao Xiang lavc/hevc_ps: Add SPS/PPS parse support for HEVC extension syntax 1. Add extension syntax according to 7.3.2.2.3/7.3.2.3.3 in T-REC-H.265-201911. 2. Keep using parsed PPS when bitstream overread for compatibility. For example, the clip PS_A_VIDYO_3.bit in FATE test has incomplete extension syntax which will be overread and un-decodable if without this change. 3. Format brace in pps_range_extensions(). Signed-off-by: Linjie Fu Signed-off-by: Haihao Xiang Signed-off-by: Fei Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=56e3cd23d486d6aa2e3dcddc57c8048547df4f42 --- libavcodec/hevc.h| 3 + libavcodec/hevc_ps.c | 289 --- libavcodec/hevc_ps.h | 69 3 files changed, 349 insertions(+), 12 deletions(-) diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h index 1804755327..6b454a75c1 100644 --- a/libavcodec/hevc.h +++ b/libavcodec/hevc.h @@ -154,6 +154,9 @@ enum { // get near that, though, so set a lower limit here with the maximum // possible value for 4K video (at most 135 16x16 Ctb rows). HEVC_MAX_ENTRY_POINT_OFFSETS = HEVC_MAX_TILE_COLUMNS * 135, + +// A.3.7: Screen content coding extensions +HEVC_MAX_PALETTE_PREDICTOR_SIZE = 128, }; diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 4aa5b76d5f..348e4d8de2 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -853,7 +853,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, HEVCWindow *ow; int ret = 0; int log2_diff_max_min_transform_block_size; -int bit_depth_chroma, start, vui_present, sublayer_ordering_info; +int bit_depth_chroma, start, vui_present, sublayer_ordering_info, num_comps; int i; // Coded parameters @@ -1074,8 +1074,12 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, decode_vui(gb, avctx, apply_defdispwin, sps); if (get_bits1(gb)) { // sps_extension_flag -sps->sps_range_extension_flag = get_bits1(gb); -skip_bits(gb, 7); //sps_extension_7bits = get_bits(gb, 7); +sps->sps_range_extension_flag = get_bits1(gb); +sps->sps_multilayer_extension_flag = get_bits1(gb); +sps->sps_3d_extension_flag = get_bits1(gb); +sps->sps_scc_extension_flag= get_bits1(gb); +skip_bits(gb, 4); // sps_extension_4bits + if (sps->sps_range_extension_flag) { sps->transform_skip_rotation_enabled_flag = get_bits1(gb); sps->transform_skip_context_enabled_flag = get_bits1(gb); @@ -1101,6 +1105,57 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, av_log(avctx, AV_LOG_WARNING, "cabac_bypass_alignment_enabled_flag not yet implemented\n"); } + +if (sps->sps_multilayer_extension_flag) { +skip_bits1(gb); // inter_view_mv_vert_constraint_flag +av_log(avctx, AV_LOG_WARNING, + "sps_multilayer_extension_flag not yet implemented\n"); +} + +if (sps->sps_3d_extension_flag) { +for (i = 0; i <= 1; i++) { +skip_bits1(gb); // iv_di_mc_enabled_flag +skip_bits1(gb); // iv_mv_scal_enabled_flag +if (i == 0) { +get_ue_golomb_long(gb); // log2_ivmc_sub_pb_size_minus3 +skip_bits1(gb); // iv_res_pred_enabled_flag +skip_bits1(gb); // depth_ref_enabled_flag +skip_bits1(gb); // vsp_mc_enabled_flag +skip_bits1(gb); // dbbp_enabled_flag +} else { +skip_bits1(gb); // tex_mc_enabled_flag +get_ue_golomb_long(gb); // log2_ivmc_sub_pb_size_minus3 +skip_bits1(gb); // intra_contour_enabled_flag +skip_bits1(gb); // intra_dc_only_wedge_enabled_flag +skip_bits1(gb); // cqt_cu_part_pred_enabled_flag +skip_bits1(gb); // inter_dc_only_enabled_flag +skip_bits1(gb); // skip_intra_enabled_flag +} +} +av_log(avctx, AV_LOG_WARNING, + "sps_3d_extension_flag not yet implemented\n"); +} + +if (sps->sps_scc_extension_flag) { +sps->sps_curr_pic_ref_enabled_flag = get_bits1(gb); +sps->palette_mode_enabled_flag = get_bits1(gb); +if (sps->palette_mode_enabled_flag) { +sps->palette_max_size = get_ue_golomb_long(gb); +sps->delta_palette_max_predictor_size = get_ue_golomb_long(gb); +sps->sps_palette_predictor_initializers_present_flag = get
[FFmpeg-cvslog] lavc/vaapi_hevc: Loose the restricts for SCC decoding
ffmpeg | branch: master | Linjie Fu | Thu Feb 16 13:46:37 2023 +0800| [6489e0679d0b073dabf0e5b5c8ed5418cdeeea44] | committer: Haihao Xiang lavc/vaapi_hevc: Loose the restricts for SCC decoding Allow current picture as the reference picture. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6489e0679d0b073dabf0e5b5c8ed5418cdeeea44 --- libavcodec/vaapi_hevc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index a06785f7a6..0e5da15e53 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -104,7 +104,8 @@ static void fill_vaapi_reference_frames(const HEVCContext *h, VAPictureParameter const HEVCFrame *frame = NULL; while (!frame && j < FF_ARRAY_ELEMS(h->DPB)) { -if (&h->DPB[j] != current_picture && (h->DPB[j].flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF))) +if ((&h->DPB[j] != current_picture || h->ps.pps->pps_curr_pic_ref_enabled_flag) && +(h->DPB[j].flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF))) frame = &h->DPB[j]; j++; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vaapi_hevc: Add vaapi profile parse support for SCC
ffmpeg | branch: master | Linjie Fu | Thu Feb 16 13:46:35 2023 +0800| [fb1998f508598d02b8547ae4eadfc6649d4e476d] | committer: Haihao Xiang lavc/vaapi_hevc: Add vaapi profile parse support for SCC Note that Screen-Extended Main 4:4:4 and 4:4:4 10 supports chroma_format_idc from 0, 1 or 3, hence both 420 and 444 are supported. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fb1998f508598d02b8547ae4eadfc6649d4e476d --- libavcodec/vaapi_decode.c | 4 +++- libavcodec/vaapi_hevc.c | 14 -- libavcodec/vaapi_hevc.h | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index 134f10eca5..ab8c12e364 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -410,7 +410,9 @@ static const struct { #endif #if VA_CHECK_VERSION(1, 2, 0) && CONFIG_HEVC_VAAPI_HWACCEL MAP(HEVC,HEVC_REXT, None, - ff_vaapi_parse_hevc_rext_profile ), + ff_vaapi_parse_hevc_rext_scc_profile ), +MAP(HEVC,HEVC_SCC,None, + ff_vaapi_parse_hevc_rext_scc_profile ), #endif MAP(MJPEG, MJPEG_HUFFMAN_BASELINE_DCT, JPEGBaseline), diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index a7b541750c..1cf43bd4dc 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -591,9 +591,9 @@ static int ptl_convert(const PTLCommon *general_ptl, H265RawProfileTierLevel *h2 } /* - * Find exact va_profile for HEVC Range Extension + * Find exact va_profile for HEVC Range Extension and Screen Content Coding Extension */ -VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx) +VAProfile ff_vaapi_parse_hevc_rext_scc_profile(AVCodecContext *avctx) { const HEVCContext *h = avctx->priv_data; const HEVCSPS *sps = h->ps.sps; @@ -632,6 +632,16 @@ VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx) else if (!strcmp(profile->name, "Main 4:4:4 12") || !strcmp(profile->name, "Main 4:4:4 12 Intra")) return VAProfileHEVCMain444_12; +else if (!strcmp(profile->name, "Screen-Extended Main")) +return VAProfileHEVCSccMain; +else if (!strcmp(profile->name, "Screen-Extended Main 10")) +return VAProfileHEVCSccMain10; +else if (!strcmp(profile->name, "Screen-Extended Main 4:4:4")) +return VAProfileHEVCSccMain444; +#if VA_CHECK_VERSION(1, 8, 0) +else if (!strcmp(profile->name, "Screen-Extended Main 4:4:4 10")) +return VAProfileHEVCSccMain444_10; +#endif #else av_log(avctx, AV_LOG_WARNING, "HEVC profile %s is " "not supported with this VA version.\n", profile->name); diff --git a/libavcodec/vaapi_hevc.h b/libavcodec/vaapi_hevc.h index b3b0e6fc1e..449635d0d7 100644 --- a/libavcodec/vaapi_hevc.h +++ b/libavcodec/vaapi_hevc.h @@ -22,6 +22,6 @@ #include #include "avcodec.h" -VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx); +VAProfile ff_vaapi_parse_hevc_rext_scc_profile(AVCodecContext *avctx); #endif /* AVCODEC_VAAPI_HEVC_H */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vaapi_hevc: Set correct rps type for scc
ffmpeg | branch: master | Linjie Fu | Thu Feb 16 13:46:36 2023 +0800| [b7104243ff134f243c1916e7cfea702a6cf5bc54] | committer: Haihao Xiang lavc/vaapi_hevc: Set correct rps type for scc According to 8.1.3 and 8.3.2. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b7104243ff134f243c1916e7cfea702a6cf5bc54 --- libavcodec/vaapi_hevc.c | 4 1 file changed, 4 insertions(+) diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index 1cf43bd4dc..a06785f7a6 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -71,6 +71,7 @@ static void fill_vaapi_pic(VAPictureHEVC *va_pic, const HEVCFrame *pic, int rps_ static int find_frame_rps_type(const HEVCContext *h, const HEVCFrame *pic) { VASurfaceID pic_surf = ff_vaapi_get_surface_id(pic->frame); +const HEVCFrame *current_picture = h->ref; int i; for (i = 0; i < h->rps[ST_CURR_BEF].nb_refs; i++) { @@ -88,6 +89,9 @@ static int find_frame_rps_type(const HEVCContext *h, const HEVCFrame *pic) return VA_PICTURE_HEVC_RPS_LT_CURR; } +if (h->ps.pps->pps_curr_pic_ref_enabled_flag && current_picture->poc == pic->poc) +return VA_PICTURE_HEVC_LONG_TERM_REFERENCE; + return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vaapi_hevc: Pass SCC parameters Through VA-API
ffmpeg | branch: master | Linjie Fu | Thu Feb 16 13:46:34 2023 +0800| [7373bb24f76f6e2b85a18ea4ffb395bd38e148a8] | committer: Haihao Xiang lavc/vaapi_hevc: Pass SCC parameters Through VA-API Including sps/pps/slice parameters. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7373bb24f76f6e2b85a18ea4ffb395bd38e148a8 --- libavcodec/vaapi_hevc.c | 57 - 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index 20fb36adfa..a7b541750c 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -126,6 +126,10 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx, const ScalingList *scaling_list = NULL; int pic_param_size, err, i; +#if VA_CHECK_VERSION(1, 2, 0) +int num_comps, pre_palette_size; +#endif + VAPictureParameterBufferHEVC *pic_param = (VAPictureParameterBufferHEVC *)&pic->pic_param; pic->pic.output_surface = ff_vaapi_get_surface_id(h->ref->frame); @@ -218,7 +222,8 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx, } #if VA_CHECK_VERSION(1, 2, 0) -if (avctx->profile == FF_PROFILE_HEVC_REXT) { +if (avctx->profile == FF_PROFILE_HEVC_REXT || +avctx->profile == FF_PROFILE_HEVC_SCC) { pic->pic_param.rext = (VAPictureParameterBufferHEVCRext) { .range_extension_pic_fields.bits = { .transform_skip_rotation_enabled_flag = sps->transform_skip_rotation_enabled_flag, @@ -245,8 +250,46 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx, for (i = 0; i < 6; i++) pic->pic_param.rext.cr_qp_offset_list[i]= pps->cr_qp_offset_list[i]; } + +pre_palette_size = pps->pps_palette_predictor_initializers_present_flag ? + pps->pps_num_palette_predictor_initializers : + (sps->sps_palette_predictor_initializers_present_flag ? + sps->sps_num_palette_predictor_initializers_minus1 + 1 : + 0); + +if (avctx->profile == FF_PROFILE_HEVC_SCC) { +pic->pic_param.scc = (VAPictureParameterBufferHEVCScc) { +.screen_content_pic_fields.bits = { +.pps_curr_pic_ref_enabled_flag = pps->pps_curr_pic_ref_enabled_flag, +.palette_mode_enabled_flag = sps->palette_mode_enabled_flag, +.motion_vector_resolution_control_idc = sps->motion_vector_resolution_control_idc, +.intra_boundary_filtering_disabled_flag = sps->intra_boundary_filtering_disabled_flag, +.residual_adaptive_colour_transform_enabled_flag += pps->residual_adaptive_colour_transform_enabled_flag, +.pps_slice_act_qp_offsets_present_flag = pps->pps_slice_act_qp_offsets_present_flag, +}, +.palette_max_size = sps->palette_max_size, +.delta_palette_max_predictor_size = sps->delta_palette_max_predictor_size, +.predictor_palette_size = pre_palette_size, +.pps_act_y_qp_offset_plus5 = pps->residual_adaptive_colour_transform_enabled_flag ? + pps->pps_act_y_qp_offset + 5 : 0, +.pps_act_cb_qp_offset_plus5 = pps->residual_adaptive_colour_transform_enabled_flag ? + pps->pps_act_cb_qp_offset + 5 : 0, +.pps_act_cr_qp_offset_plus3 = pps->residual_adaptive_colour_transform_enabled_flag ? + pps->pps_act_cr_qp_offset + 3 : 0, +}; + +num_comps = pps->monochrome_palette_flag ? 1 : 3; +for (int comp = 0; comp < num_comps; comp++) +for (int j = 0; j < pre_palette_size; j++) +pic->pic_param.scc.predictor_palette_entries[comp][j] = +pps->pps_palette_predictor_initializers_present_flag ? +pps->pps_palette_predictor_initializer[comp][j]: +sps->sps_palette_predictor_initializer[comp][j]; +} + #endif -pic_param_size = avctx->profile == FF_PROFILE_HEVC_REXT ? +pic_param_size = avctx->profile >= FF_PROFILE_HEVC_REXT ? sizeof(pic->pic_param) : sizeof(VAPictureParameterBufferHEVC); err = ff_vaapi_decode_make_param_buffer(avctx, &pic->pic, @@ -299,7 +342,7 @@ static int vaapi_hevc_end_frame(AVCodecContext *avctx) VASliceParameterB
[FFmpeg-cvslog] doc/vaapi_encode: add documentations for max_frame_size
ffmpeg | branch: master | Linjie Fu | Thu May 5 17:07:15 2022 +0800| [e8381691813a4f10a280169a782a716568e57614] | committer: Haihao Xiang doc/vaapi_encode: add documentations for max_frame_size Add docs for max_frame_size option. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e8381691813a4f10a280169a782a716568e57614 --- doc/encoders.texi | 5 + 1 file changed, 5 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 9796a606fa..bee45f9853 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -3714,6 +3714,11 @@ performance. This option doesn't work if driver doesn't implement vaSyncBuffer function. Please make sure there are enough hw_frames allocated if a large number of async_depth is used. +@item max_frame_size +Set the allowed max size in bytes for each frame. If the frame size exceeds +the limitation, encoder will adjust the QP value to control the frame size. +Invalid in CQP rate control mode. + @item rc_mode Set the rate control mode to use. A given driver may only support a subset of modes. ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/vaapi_encode: add support for maxframesize
ffmpeg | branch: master | Linjie Fu | Thu May 5 17:07:14 2022 +0800| [99446c74cf5f67635931312f23126b4c1f0274ef] | committer: Haihao Xiang lavc/vaapi_encode: add support for maxframesize Add support for max frame size: - max_frame_size (bytes) to indicate the max allowed size for frame. Control each encoded frame size into target limitation size by adjusting whole frame's average QP value. The driver will use multi passes to adjust average QP setp by step to achieve the target, and the result may not strictly guaranteed. Frame size may exceed target alone with using the maximum average QP value. The failure always happens on the intra(especially the first intra frame of a new GOP) frames or set max_frame_size with a very small number. example cmdline: ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -f rawvideo \ -v verbose -s:v 352x288 -i ./input.yuv -vf format=nv12,hwupload \ -c:v h264_vaapi -profile:v main -g 30 -rc_mode VBR -b:v 500k \ -bf 3 -max_frame_size 4 -vframes 100 -y ./max_frame_size.h264 Max frame size was enabled since VA-API version (0, 33, 0), but query is available since (1, 5, 0). It will be passed as a parameter in picParam and should be set for each frame. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=99446c74cf5f67635931312f23126b4c1f0274ef --- libavcodec/vaapi_encode.c | 74 +++ libavcodec/vaapi_encode.h | 10 ++- 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 0e2f5ed447..284ce29888 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -365,6 +365,17 @@ static int vaapi_encode_issue(AVCodecContext *avctx, goto fail; } +#if VA_CHECK_VERSION(1, 5, 0) +if (ctx->max_frame_size) { +err = vaapi_encode_make_misc_param_buffer(avctx, pic, + VAEncMiscParameterTypeMaxFrameSize, + &ctx->mfs_params, + sizeof(ctx->mfs_params)); +if (err < 0) +goto fail; +} +#endif + if (pic->type == PICTURE_TYPE_IDR) { if (ctx->va_packed_headers & VA_ENC_PACKED_HEADER_SEQUENCE && ctx->codec->write_sequence_header) { @@ -1869,6 +1880,63 @@ rc_mode_found: return 0; } +static av_cold int vaapi_encode_init_max_frame_size(AVCodecContext *avctx) +{ +#if VA_CHECK_VERSION(1, 5, 0) +VAAPIEncodeContext *ctx = avctx->priv_data; +VAConfigAttrib attr = { VAConfigAttribMaxFrameSize }; +VAStatus vas; + +if (ctx->va_rc_mode == VA_RC_CQP) { +ctx->max_frame_size = 0; +av_log(avctx, AV_LOG_ERROR, "Max frame size is invalid in CQP rate " + "control mode.\n"); +return AVERROR(EINVAL); +} + +vas = vaGetConfigAttributes(ctx->hwctx->display, +ctx->va_profile, +ctx->va_entrypoint, +&attr, 1); +if (vas != VA_STATUS_SUCCESS) { +ctx->max_frame_size = 0; +av_log(avctx, AV_LOG_ERROR, "Failed to query max frame size " + "config attribute: %d (%s).\n", vas, vaErrorStr(vas)); +return AVERROR_EXTERNAL; +} + +if (attr.value == VA_ATTRIB_NOT_SUPPORTED) { +ctx->max_frame_size = 0; +av_log(avctx, AV_LOG_ERROR, "Max frame size attribute " + "is not supported.\n"); +return AVERROR(EINVAL); +} else { +VAConfigAttribValMaxFrameSize attr_mfs; +attr_mfs.value = attr.value; +// Prefer to use VAEncMiscParameterTypeMaxFrameSize for max frame size. +if (!attr_mfs.bits.max_frame_size && attr_mfs.bits.multiple_pass) { +ctx->max_frame_size = 0; +av_log(avctx, AV_LOG_ERROR, "Driver only supports multiple pass " + "max frame size which has not been implemented in FFmpeg.\n"); +return AVERROR(EINVAL); +} + +ctx->mfs_params = (VAEncMiscParameterBufferMaxFrameSize){ +.max_frame_size = ctx->max_frame_size * 8, +}; + +av_log(avctx, AV_LOG_VERBOSE, "Set max frame size: %d bytes.\n", + ctx->max_frame_size); +} +#else +av_log(avctx, AV_LOG_ERROR, "The max frame size option is not supported with " + "this VAAPI version.\n"); +return AVERROR(EINVAL); +#endif + +return 0; +} + static av_cold int vaapi_encode_init_gop_structure(AVCodecContext *avctx) { VAAPIEncodeContext *ctx = avctx->priv_data; @@ -2548,6 +2616,12 @@ av_cold int ff_vaapi_encode_