Re: [FFmpeg-devel] [PATCH] avutil: add API for mb_types
On Sun, Nov 12, 2017 at 01:55:14AM +, Rostislav Pehlivanov wrote: [...] > The range should be derived from the codec ID. The frame doesn't contain the codec ID, so this information should be added to that struct somehow (it needs to reach the filters who are agnostics). [...] -- Clément B. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] nvenc: support d3d11 surface input
--- libavcodec/nvenc.c | 106 ++--- libavcodec/nvenc.h | 11 +- 2 files changed, 95 insertions(+), 22 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index c685d973c1..eba59634f6 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -45,6 +45,9 @@ const enum AVPixelFormat ff_nvenc_pix_fmts[] = { AV_PIX_FMT_0RGB32, AV_PIX_FMT_0BGR32, AV_PIX_FMT_CUDA, +#if CONFIG_D3D11VA +AV_PIX_FMT_D3D11, +#endif AV_PIX_FMT_NONE }; @@ -172,6 +175,9 @@ static int nvenc_push_context(AVCodecContext *avctx) NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; CUresult cu_res; +if (ctx->d3d11_device) +return 0; + cu_res = dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context); if (cu_res != CUDA_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "cuCtxPushCurrent failed\n"); @@ -188,6 +194,9 @@ static int nvenc_pop_context(AVCodecContext *avctx) CUresult cu_res; CUcontext dummy; +if (ctx->d3d11_device) +return 0; + cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy); if (cu_res != CUDA_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "cuCtxPopCurrent failed\n"); @@ -206,8 +215,16 @@ static av_cold int nvenc_open_session(AVCodecContext *avctx) params.version= NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER; params.apiVersion = NVENCAPI_VERSION; -params.device = ctx->cu_context; -params.deviceType = NV_ENC_DEVICE_TYPE_CUDA; +if (ctx->d3d11_device) +{ +params.device = ctx->d3d11_device; +params.deviceType = NV_ENC_DEVICE_TYPE_DIRECTX; +} +else +{ +params.device = ctx->cu_context; +params.deviceType = NV_ENC_DEVICE_TYPE_CUDA; +} ret = p_nvenc->nvEncOpenEncodeSessionEx(¶ms, &ctx->nvencoder); if (ret != NV_ENC_SUCCESS) { @@ -458,23 +475,48 @@ static av_cold int nvenc_setup_device(AVCodecContext *avctx) return AVERROR_BUG; } -if (avctx->pix_fmt == AV_PIX_FMT_CUDA || avctx->hw_frames_ctx || avctx->hw_device_ctx) { +if (avctx->pix_fmt == AV_PIX_FMT_CUDA || avctx->pix_fmt == AV_PIX_FMT_D3D11 || avctx->hw_frames_ctx || avctx->hw_device_ctx) { AVHWFramesContext *frames_ctx; AVHWDeviceContext *hwdev_ctx; -AVCUDADeviceContext *device_hwctx; +AVCUDADeviceContext *cuda_device_hwctx = NULL; +#if CONFIG_D3D11VA +AVD3D11VADeviceContext *d3d11_device_hwctx = NULL; +#endif int ret; if (avctx->hw_frames_ctx) { frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; -device_hwctx = frames_ctx->device_ctx->hwctx; +if (frames_ctx->format == AV_PIX_FMT_CUDA) +cuda_device_hwctx = frames_ctx->device_ctx->hwctx; +#if CONFIG_D3D11VA +else if (frames_ctx->format == AV_PIX_FMT_D3D11) +d3d11_device_hwctx = frames_ctx->device_ctx->hwctx; +#endif +else +return AVERROR(EINVAL); } else if (avctx->hw_device_ctx) { hwdev_ctx = (AVHWDeviceContext*)avctx->hw_device_ctx->data; -device_hwctx = hwdev_ctx->hwctx; +if (hwdev_ctx->type == AV_HWDEVICE_TYPE_CUDA) +cuda_device_hwctx = hwdev_ctx->hwctx; +#if CONFIG_D3D11VA +else if (hwdev_ctx->type == AV_HWDEVICE_TYPE_D3D11VA) +d3d11_device_hwctx = hwdev_ctx->hwctx; +#endif +else +return AVERROR(EINVAL); } else { return AVERROR(EINVAL); } -ctx->cu_context = device_hwctx->cuda_ctx; +if (cuda_device_hwctx) { +ctx->cu_context = cuda_device_hwctx->cuda_ctx; +} +#if CONFIG_D3D11VA +else if (d3d11_device_hwctx) { +ctx->d3d11_device = d3d11_device_hwctx->device; +ID3D11Device_AddRef(ctx->d3d11_device); +} +#endif ret = nvenc_open_session(avctx); if (ret < 0) @@ -1205,7 +1247,7 @@ static av_cold int nvenc_alloc_surface(AVCodecContext *avctx, int idx) NV_ENC_CREATE_BITSTREAM_BUFFER allocOut = { 0 }; allocOut.version = NV_ENC_CREATE_BITSTREAM_BUFFER_VER; -if (avctx->pix_fmt == AV_PIX_FMT_CUDA) { +if (avctx->pix_fmt == AV_PIX_FMT_CUDA || avctx->pix_fmt == AV_PIX_FMT_D3D11) { ctx->surfaces[idx].in_ref = av_frame_alloc(); if (!ctx->surfaces[idx].in_ref) return AVERROR(ENOMEM); @@ -1237,7 +1279,7 @@ static av_cold int nvenc_alloc_surface(AVCodecContext *avctx, int idx) nv_status = p_nvenc->nvEncCreateBitstreamBuffer(ctx->nvencoder, &allocOut); if (nv_status != NV_ENC_SUCCESS) { int err = nvenc_print_error(avctx, nv_status, "CreateBitstreamBuffer failed"); -if (avctx->pix_fmt != AV_PIX_FMT_CUDA) +if (avctx->pix_fmt != AV_PIX_FMT_CUDA && avctx->pix_fmt != AV_PIX_FMT_D3D11) p_nvenc->nvEncDestroyInputBuffer(ctx->nvencoder, ctx->surfaces[idx
[FFmpeg-devel] [PATCH 1/2] nvenc: factor context push/pop into functions
This reduces code repetition, and will allow adding further push/pop refinement for D3D11 devices in future commits. --- libavcodec/nvenc.c | 171 - 1 file changed, 76 insertions(+), 95 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index e1d3316de3..c685d973c1 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -166,6 +166,37 @@ static av_cold int nvenc_load_libraries(AVCodecContext *avctx) return 0; } +static int nvenc_push_context(AVCodecContext *avctx) +{ +NvencContext *ctx= avctx->priv_data; +NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; +CUresult cu_res; + +cu_res = dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context); +if (cu_res != CUDA_SUCCESS) { +av_log(avctx, AV_LOG_ERROR, "cuCtxPushCurrent failed\n"); +return AVERROR_EXTERNAL; +} + +return 0; +} + +static int nvenc_pop_context(AVCodecContext *avctx) +{ +NvencContext *ctx= avctx->priv_data; +NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; +CUresult cu_res; +CUcontext dummy; + +cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy); +if (cu_res != CUDA_SUCCESS) { +av_log(avctx, AV_LOG_ERROR, "cuCtxPopCurrent failed\n"); +return AVERROR_EXTERNAL; +} + +return 0; +} + static av_cold int nvenc_open_session(AVCodecContext *avctx) { NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS params = { 0 }; @@ -335,7 +366,6 @@ static av_cold int nvenc_check_device(AVCodecContext *avctx, int idx) int major, minor, ret; CUresult cu_res; CUdevice cu_device; -CUcontext dummy; int loglevel = AV_LOG_VERBOSE; if (ctx->device == LIST_DEVICES) @@ -378,11 +408,8 @@ static av_cold int nvenc_check_device(AVCodecContext *avctx, int idx) ctx->cu_context = ctx->cu_context_internal; -cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy); -if (cu_res != CUDA_SUCCESS) { -av_log(avctx, AV_LOG_FATAL, "Failed popping CUDA context: 0x%x\n", (int)cu_res); +if ((ret = nvenc_pop_context(avctx)) < 0) goto fail2; -} if ((ret = nvenc_open_session(avctx)) < 0) goto fail2; @@ -398,20 +425,14 @@ static av_cold int nvenc_check_device(AVCodecContext *avctx, int idx) return 0; fail3: -cu_res = dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context); -if (cu_res != CUDA_SUCCESS) { -av_log(avctx, AV_LOG_ERROR, "cuCtxPushCurrent failed\n"); -return AVERROR_EXTERNAL; -} +if ((ret = nvenc_push_context(avctx)) < 0) +return ret; p_nvenc->nvEncDestroyEncoder(ctx->nvencoder); ctx->nvencoder = NULL; -cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy); -if (cu_res != CUDA_SUCCESS) { -av_log(avctx, AV_LOG_ERROR, "cuCtxPopCurrent failed\n"); -return AVERROR_EXTERNAL; -} +if ((ret = nvenc_pop_context(avctx)) < 0) +return ret; fail2: dl_fn->cuda_dl->cuCtxDestroy(ctx->cu_context_internal); @@ -1031,8 +1052,6 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx) NV_ENC_PRESET_CONFIG preset_config = { 0 }; NVENCSTATUS nv_status = NV_ENC_SUCCESS; AVCPBProperties *cpb_props; -CUresult cu_res; -CUcontext dummy; int res = 0; int dw, dh; @@ -1123,19 +1142,15 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx) if (res) return res; -cu_res = dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context); -if (cu_res != CUDA_SUCCESS) { -av_log(avctx, AV_LOG_ERROR, "cuCtxPushCurrent failed\n"); -return AVERROR_EXTERNAL; -} +res = nvenc_push_context(avctx); +if (res < 0) +return res; nv_status = p_nvenc->nvEncInitializeEncoder(ctx->nvencoder, &ctx->init_encode_params); -cu_res = dl_fn->cuda_dl->cuCtxPopCurrent(&dummy); -if (cu_res != CUDA_SUCCESS) { -av_log(avctx, AV_LOG_ERROR, "cuCtxPopCurrent failed\n"); -return AVERROR_EXTERNAL; -} +res = nvenc_pop_context(avctx); +if (res < 0) +return res; if (nv_status != NV_ENC_SUCCESS) { return nvenc_print_error(avctx, nv_status, "InitializeEncoder failed"); @@ -1239,9 +1254,6 @@ static av_cold int nvenc_alloc_surface(AVCodecContext *avctx, int idx) static av_cold int nvenc_setup_surfaces(AVCodecContext *avctx) { NvencContext *ctx = avctx->priv_data; -NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; -CUresult cu_res; -CUcontext dummy; int i, res; ctx->surfaces = av_mallocz_array(ctx->nb_surfaces, sizeof(*ctx->surfaces)); @@ -1263,29 +1275,21 @@ static av_cold int nvenc_setup_surfaces(AVCodecContext *avctx) if (!ctx->output_surface_ready_queue) return AVERROR(ENOMEM); -cu_res = dl_fn->cuda_dl->cuCtxPushCurrent(ctx->cu_context); -if (cu_res != CUDA_SUCCESS) { -av_log(avctx, AV_LOG_ERROR, "cuCtxPushCurrent failed\n"); -return AVERROR_EX
Re: [FFmpeg-devel] [PATCH 2/2] nvenc: support d3d11 surface input
On Sun, Nov 12, 2017 at 10:30 AM, Hendrik Leppkes wrote: > --- > libavcodec/nvenc.c | 106 > ++--- > libavcodec/nvenc.h | 11 +- > 2 files changed, 95 insertions(+), 22 deletions(-) > Some details, if anyone cares (tested with 1080p) On an idle system, performance of d3d11 decode, hwdownload, nvenc is largely similar to a d3d11 -> nvenc direct connection, however once the GPU is busy (I was testing with a 3D rendering going on last night), hwdownload quickly degrades in performance, while the direct connection didn't suffer at all. Additionally, a sharp drop in CPU usage can also be observed. In case anyone is interested, I plan on working on a D3D11 VPP filter in the future to allow scaling and deinterlacing in this particular workflow, using D3D11 Video Processor APIs. - Hendrik ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] avcodec/nvdec: add support for 12 bit formats
Ideally, this should also set avctx->bits_per_raw_sample or an equivalent, if it exists. I would assume that the surrounding codec parser already sets that? A hwaccel does not usually set fields in avctx. smime.p7s Description: S/MIME Cryptographic Signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [RFC] H264 Error Resilience
2017-11-10 22:54 GMT+01:00 Michael Niedermayer : > H264 features: > Redundant pictures. It would be possible to encode a low bitrate image > for each access unit and use it when the primary picture has lost > slices. This can be limited to slices which would be concealed poorly > if lost. This would increase the bitrate of the h264 stream > > Data partitioning. We support data partitioning for MPEG4(-ASP) and > it provided there useful quality gains. This would seperate the > high bitrate textures from low bitrate motion vectors. The later is > much more important for maitaining ok looking images Wouldn't both need changes to the encoder / does an encoder exist that supports these? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/videotoolboxenc: add hevc_videotoolbox encoder
2017-11-11 4:57 GMT+01:00 Aman Gupta : > -status = CMVideoFormatDescriptionGetH264ParameterSetAtIndex(vid_fmt, > -0, > -NULL, > -NULL, > -&ps_count, > -NULL); > +status = vtctx->get_param_set_func(vid_fmt, > + 0, > + NULL, > + NULL, > + &ps_count, > + NULL); Please don't do this: It makes reviewing your changes (not only now) unnecessarily difficult > -if(vtctx->has_b_frames && vtctx->profile == H264_PROF_BASELINE){ > -av_log(avctx, AV_LOG_WARNING, "Cannot use B-frames with baseline > profile. Output will not contain B-frames.\n"); > -vtctx->has_b_frames = false; > +vtctx->has_b_frames = avctx->max_b_frames > 0; > +if(vtctx->has_b_frames && vtctx->profile == H264_PROF_BASELINE){ > +av_log(avctx, AV_LOG_WARNING, "Cannot use B-frames with baseline > profile. Output will not contain B-frames.\n"); > +vtctx->has_b_frames = false; This is much worse: Do not re-indent, push another commit with white-space changes only. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/decode: don't increase hw frame size
In case the hw frames context does not return way too large frames, but slightly smaller ones(for example height being 1080, while coded_height is 1088), this causes failures because various code will try to read/write beyond the frame size. --- libavcodec/decode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index a7f1e23fc2..0a5ec6a21b 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1491,8 +1491,8 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags if (avctx->hw_frames_ctx) { ret = av_hwframe_get_buffer(avctx->hw_frames_ctx, frame, 0); -frame->width = avctx->coded_width; -frame->height = avctx->coded_height; +frame->width = FFMIN(avctx->coded_width, frame->width); +frame->height = FFMIN(avctx->coded_height, frame->height); return ret; } -- 2.14.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/4] avcodec/nvdec: correctly set output frame size
This is actually not correct, as the classic hwaccels all set the cropping information properly on the frame. So not using the coded_width/height as frame size results in too much cropping. So just dropping this one. smime.p7s Description: S/MIME Cryptographic Signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil/crc: use ff_thread_once at av_crc_get_table
On Wed, Nov 1, 2017 at 12:37 AM, Muhammad Faiz wrote: > On Mon, Oct 30, 2017 at 8:07 PM, Michael Niedermayer > wrote: >> On Mon, Oct 30, 2017 at 02:14:35PM +0700, Muhammad Faiz wrote: >>> On Tue, Oct 24, 2017 at 4:31 PM, Muhammad Faiz wrote: >>> > Fix tsan warnings. >>> > >>> > Signed-off-by: Muhammad Faiz >>> > --- >>> > libavutil/crc.c | 49 + >>> > 1 file changed, 29 insertions(+), 20 deletions(-) >>> >>> Ping. >> >> I assume james patch is faster than both ? >> >> If this code is never run in speed relevant loops then your solution is >> better. Otherwise i think james patch is better > > I guess the common usage is to call av_crc() which is far more > computationally intensive after calling av_crc_get_table(). Ping. I'm going to apply this tomorrow. Thank's. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avformat/hlsenc: write fmp4 init header after first AV frame
fix ticket id: 6825 Signed-off-by: Steven Liu --- libavformat/hlsenc.c | 28 +--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 5ea9d216a4..3a4c8d65be 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -108,6 +108,9 @@ typedef struct HLSContext { uint32_t start_sequence_source_type; // enum StartSequenceSourceType AVOutputFormat *oformat; AVOutputFormat *vtt_oformat; +AVIOContext *out; +int packets_written; +int init_range_length; AVFormatContext *avf; AVFormatContext *vtt_avf; @@ -607,9 +610,14 @@ static int hls_mux_init(AVFormatContext *s) av_log(s, AV_LOG_WARNING, "Multi-file byterange mode is currently unsupported in the HLS muxer.\n"); return AVERROR_PATCHWELCOME; } +hls->packets_written = 0; +hls->init_range_length = 0; hls->fmp4_init_mode = !byterange_mode; set_http_options(s, &options, hls); -if ((ret = s->io_open(s, &oc->pb, hls->base_output_dirname, AVIO_FLAG_WRITE, &options)) < 0) { +if ((ret = avio_open_dyn_buf(&oc->pb)) < 0) +return ret; + +if ((ret = s->io_open(s, &hls->out, hls->base_output_dirname, AVIO_FLAG_WRITE, &options)) < 0) { av_log(s, AV_LOG_ERROR, "Failed to open segment '%s'\n", hls->fmp4_init_filename); return ret; } @@ -634,6 +642,7 @@ static int hls_mux_init(AVFormatContext *s) av_dict_free(&options); return AVERROR(EINVAL); } +avio_flush(oc->pb); av_dict_free(&options); } return 0; @@ -1600,6 +1609,8 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) int is_ref_pkt = 1; int ret = 0, can_split = 1; int stream_index = 0; +int range_length = 0; +uint8_t *buffer = NULL; if (hls->sequence - hls->nb_entries > hls->start_sequence && hls->init_time > 0) { /* reset end_pts, hls->recording_time at end of the init hls list */ @@ -1645,7 +1656,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) } } -if (hls->fmp4_init_mode || can_split && av_compare_ts(pkt->pts - hls->start_pts, st->time_base, +if (hls->packets_written && can_split && av_compare_ts(pkt->pts - hls->start_pts, st->time_base, end_pts, AV_TIME_BASE_Q) >= 0) { int64_t new_start_pos; char *old_filename = av_strdup(hls->avf->filename); @@ -1661,7 +1672,17 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) hls->size = new_start_pos - hls->start_pos; if (!byterange_mode) { -ff_format_io_close(s, &oc->pb); +if (hls->segment_type == SEGMENT_TYPE_FMP4 && !hls->init_range_length) { +avio_flush(oc->pb); +range_length = avio_close_dyn_buf(oc->pb, &buffer); +avio_write(hls->out, buffer, range_length); +hls->init_range_length = range_length; +avio_open_dyn_buf(&oc->pb); +hls->packets_written = 0; +ff_format_io_close(s, &hls->out); +} else { +ff_format_io_close(s, &oc->pb); +} if (hls->vtt_avf) { ff_format_io_close(s, &hls->vtt_avf->pb); } @@ -1719,6 +1740,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) } } +hls->packets_written++; ret = ff_write_chained(oc, stream_index, pkt, s, 0); return ret; -- 2.11.0 (Apple Git-81) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec: implement vp9 nvdec hwaccel
Hi, On Sat, Nov 11, 2017 at 6:04 PM, Timo Rothenpieler wrote: > --- > configure | 2 + > libavcodec/Makefile| 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/nvdec.c | 1 + > libavcodec/nvdec_vp9.c | 225 ++ > +++ > libavcodec/vp9.c | 11 ++- > 6 files changed, 240 insertions(+), 1 deletion(-) > create mode 100644 libavcodec/nvdec_vp9.c No comments from me, vp9.c changes are OK and the nvdec implementation seems sensible. Feel free to push in 2-3 days if there's no comments from others. Ronald ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH]lavf/tcp: Fix type of argument optlen to getsockopt()
Hi! Attached patch fixes a warning on aix here. Please comment, Carl Eugen From cd61d9b7b52fd6c74cb19a8e9383b3a2056e67b2 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sun, 12 Nov 2017 15:23:14 +0100 Subject: [PATCH] lavf/tcp: Fix the type of the optlen argument to getsockopt(). Fixes a warning on aix: libavformat/tcp.c:283:58: warning: passing argument 5 of 'getsockopt' from incompatible pointer type --- libavformat/tcp.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/tcp.c b/libavformat/tcp.c index 07b4ed9..dfb5e5b 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -270,7 +270,7 @@ static int tcp_get_window_size(URLContext *h) { TCPContext *s = h->priv_data; int avail; -int avail_len = sizeof(avail); +socklen_t avail_len = sizeof(avail); #if HAVE_WINSOCK2_H /* SO_RCVBUF with winsock only reports the actual TCP window size when -- 1.7.10.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] nvenc: factor context push/pop into functions
Am 12.11.2017 um 10:30 schrieb Hendrik Leppkes: This reduces code repetition, and will allow adding further push/pop refinement for D3D11 devices in future commits. --- libavcodec/nvenc.c | 171 - 1 file changed, 76 insertions(+), 95 deletions(-) lgtm smime.p7s Description: S/MIME Cryptographic Signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] nvenc: support d3d11 surface input
Am 12.11.2017 um 10:30 schrieb Hendrik Leppkes: --- libavcodec/nvenc.c | 106 ++--- libavcodec/nvenc.h | 11 +- 2 files changed, 95 insertions(+), 22 deletions(-) Don't have a setup to test D3D11VA with right now, but it does not break stuff on Linux and Cygwin. So if it works for you, that's LGTM as well. smime.p7s Description: S/MIME Cryptographic Signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [RFC] H264 Error Resilience
On Sun, Nov 12, 2017 at 01:40:50PM +0100, Carl Eugen Hoyos wrote: > 2017-11-10 22:54 GMT+01:00 Michael Niedermayer : > > > H264 features: > > Redundant pictures. It would be possible to encode a low bitrate image > > for each access unit and use it when the primary picture has lost > > slices. This can be limited to slices which would be concealed poorly > > if lost. This would increase the bitrate of the h264 stream > > > > Data partitioning. We support data partitioning for MPEG4(-ASP) and > > it provided there useful quality gains. This would seperate the > > high bitrate textures from low bitrate motion vectors. The later is > > much more important for maitaining ok looking images > > Wouldn't both need changes to the encoder / does an encoder exist > that supports these? These require encoder side support, yes. I dont know if an/which existing encoder supports this [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Into a blind darkness they enter who follow after the Ignorance, they as if into a greater darkness enter who devote themselves to the Knowledge alone. -- Isha Upanishad signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v4 06/14] avcodec: add decode_params callback to AVHWAccel struct
On Sat, Nov 11, 2017 at 06:44:34PM +, Aman Gupta wrote: > On Sat, Nov 11, 2017 at 3:54 AM Michael Niedermayer > wrote: > > > On Fri, Nov 10, 2017 at 01:40:51PM -0800, Aman Gupta wrote: > > > From: Aman Gupta > > > > > > --- > > > libavcodec/avcodec.h | 14 ++ > > > 1 file changed, 14 insertions(+) > > > > > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > > > index c4134424f0..2bd46faa50 100644 > > > --- a/libavcodec/avcodec.h > > > +++ b/libavcodec/avcodec.h > > > @@ -3459,6 +3459,20 @@ typedef struct AVHWAccel { > > > */ > > > int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, > > uint32_t buf_size); > > > > > > +/** > > > + * Callback for parameter data (SPS/PPS/VPS etc). > > > + * > > > + * Useful for hardware decoders which keep persistent state about > > the > > > + * video parameters, and need to receive any changes to update that > > state. > > > + * > > > + * @param avctx the codec context > > > > > + * @param type the parameter type > > > > thats a bit terse > > one couldnt use this with just this information. > > is this the nal unit type ? if so then saying this would be clearer > > > Will label as nal unit type, thanks. > > > > > > > > > + * @param buf the slice data buffer base > > > + * @param buf_size the size of the slice in bytes > > > + * @return zero if successful, a negative value otherwise > > > + */ > > > > > +int (*decode_params)(AVCodecContext *avctx, int type, const uint8_t > > *buf, uint32_t buf_size); > > > > uint32_t possibly should be something else, either unsigned or size_t > > > I copied decode_slice, which also uses uint32_t > > Should I change this one or leave it consistent? i dont think changing some but leaving others makes much sense either all could be left 32bit or all changed in a seperate patch [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have never wished to cater to the crowd; for what I know they do not approve, and what they approve I do not know. -- Epicurus signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avutil: add API for mb types.
This is based on motion_type.h TODO: docs & split into a commit per lib Signed-off-by: Michael Niedermayer --- libavcodec/avcodec.h | 4 ++ libavcodec/options_table.h | 1 + libavutil/block_type.h | 107 + libavutil/frame.h | 14 ++ 4 files changed, 126 insertions(+) create mode 100644 libavutil/block_type.h diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 15ca871b59..1a49fa0a9a 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -923,6 +923,10 @@ typedef struct RcOverride{ * Show all frames before the first keyframe */ #define AV_CODEC_FLAG2_SHOW_ALL (1 << 22) +/** + * Export block types through frame side data + */ +#define AV_CODEC_FLAG2_EXPORT_BLOCKS (1 << 27) /** * Export motion vectors through frame side data */ diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index d89f58d540..0b86b4d0fb 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -74,6 +74,7 @@ static const AVOption avcodec_options[] = { {"chunks", "Frame data might be split into multiple chunks", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_CHUNKS }, INT_MIN, INT_MAX, V|D, "flags2"}, {"showall", "Show all frames before the first keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SHOW_ALL }, INT_MIN, INT_MAX, V|D, "flags2"}, {"export_mvs", "export motion vectors through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, V|D, "flags2"}, +{"export_blocks", "export block types through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_BLOCKS}, INT_MIN, INT_MAX, V|D, "flags2"}, {"skip_manual", "do not skip samples and export skip information as frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SKIP_MANUAL}, INT_MIN, INT_MAX, V|D, "flags2"}, {"ass_ro_flush_noop", "do not reset ASS ReadOrder field on flush", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_RO_FLUSH_NOOP}, INT_MIN, INT_MAX, S|D, "flags2"}, {"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, 0, INT_MAX}, diff --git a/libavutil/block_type.h b/libavutil/block_type.h new file mode 100644 index 00..3f53f1d082 --- /dev/null +++ b/libavutil/block_type.h @@ -0,0 +1,107 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_BLOCK_TYPE_H +#define AVUTIL_BLOCK_TYPE_H + +#include + + +typedef struct AVBlockType { +/** + * Block type. + * 1: Prediction (this can be spatial prediction or motion compensation for example) + * 2: Transform + * 3: Residual + * 4: Filter + * 5: Metadata + * + * Multiple Filter, Transform and prediction blocks are allowed, for example + * for bidirectional motion compensation. Multiple residuals are allowed, for + * example DC and AC residual. + */ +uint8_t type; +/** + * Bitmask that lists which planes (for example: Y:1,Cb:2,Cr:4,Alpha:8) + * this block applies to. + */ +uint8_t plane_mask; +/** + * The field (top:1, bottom:2) this block applies to. + */ +uint8_t field_mask; +uint8_t name[16]; +/** + * Left Top corner position. This can be outside of the vissible frame. + */ +int32_t x, y; +/** + * Width and height of the block. + */ +uint16_t w, h; +/** + * Number identifying the slice the Block is in. + */ +uint16_t slice_num; +/** + * Location in bits where the block related information is stored. can be -1 + */ +uint32_t block_index, block_bits; + +/** + * Main Direction, 0 is horizontal, 48 is vertical, + * values 0 to 95 follow clockwise direction. + * 255 means that the block has no direction. + * This represents the main direction of a transform, prediction or filter + */ +uint8_t direction; + +/** + * Quantization parameter, a value of 0x8000 means lossless, 0x7FFF means not applicable + * for MC prediction this is the precission of the motion vector. + */ +int16_t qp; + +/** + * Where the prediction comes from; negative value when it comes + * from the past, positive value when it comes from the future. + * 0 For Intra. +
Re: [FFmpeg-devel] [DEVEL][PATCH v2] ffmpeg: fix channel_layout bug on non-default layout
On Sat, Nov 11, 2017 at 02:15:25AM +0100, pkv.stream wrote: > Le 11/11/2017 à 1:07 AM, Michael Niedermayer a écrit : > >On Fri, Nov 10, 2017 at 10:27:48PM +0100, pkv.stream wrote: > >>Le 10/11/2017 à 1:12 AM, Michael Niedermayer a écrit : > >>>On Thu, Nov 09, 2017 at 09:37:33PM +0100, pkv.stream wrote: > Hi Michael, > > >> ffmpeg_opt.c | 11 ++- > >> 1 file changed, 10 insertions(+), 1 deletion(-) > >>2af07f4366efdfaf1018bb2ea29be672befe0823 > >>0001-ffmpeg-fix-channel_layout-bug-on-non-default-layout.patch > >> From 4ec55dc88923108132307b41300a1abddf32e6f7 Mon Sep 17 00:00:00 2001 > >>From: pkviet > >>Date: Mon, 2 Oct 2017 11:14:31 +0200 > >>Subject: [PATCH] ffmpeg: fix channel_layout bug on non-default layout > >> > >>Fix for ticket 6706. > >>The -channel_layout option was not working when the channel layout was > >>not > >>a default one (ex: for 4 channels, quad was interpreted as 4.0 which is > >>the default layout for 4 channels; or octagonal interpreted as 7.1). > >>This led to the spurious auto-insertion of an auto-resampler filter > >>remapping the channels even if input and output had identical channel > >>layouts. > >>The fix operates by directly calling the channel layout if defined in > >>options. If the layout is undefined, the default layout is selected as > >>before the fix. > >>--- > >> ffmpeg_opt.c | 11 ++- > >> 1 file changed, 10 insertions(+), 1 deletion(-) > >> > >>diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c > >>index 100fa76..cf5a63c 100644 > >>--- a/ffmpeg_opt.c > >>+++ b/ffmpeg_opt.c > >>@@ -1804,6 +1804,12 @@ static OutputStream > >>*new_audio_stream(OptionsContext *o, AVFormatContext *oc, in > >> MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, > >> oc, st); > >>+AVDictionaryEntry *output_layout = > >>av_dict_get(o->g->codec_opts, > >>+ > >>"channel_layout", > >>+ NULL, > >>AV_DICT_MATCH_CASE); > >This doesnt look right > > > >not an issue of the patch as such but > >why is the channel_layout option per file and not per stream? > just my ignorance; do you mean this is not the right way to retrieve > the channel_layout option from an audio stream ? > >>>I think there is more buggy with how the channel_layout is handled > >>> > >>>try this: > >>>./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -channel_layout 5 test.wav > >>>and this: > >>>./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -channel_layout:a 5 test.wav > >>> > >>>while it may appear that the are both working this is deceiving. > >>>I think only the channel number gets actually used in the 2nd case > >>> > >>>Look at what your code with av_dict_get() reads. > >>>It does not obtain the 5 in the 2nd case > >>ok I fixed that by using the flag AV_DICT_IGNORE_SUFFIX ; now > >>-channel_layout:a works as expected. > >>I fixed also all the styling issues you spotted (mixed declarations, > >>{} for if etc). > >> > >>Still not understanding your initial comment though : > >>'why is the channel_layout option per file and not per stream?' > >> > >>do you mean o->g->codec_opts is not where I should retrieve the > >>channel_layout ? if not where from ? > >> > >>Thanks > >> > >>>[...] > >>> > >>> > >>>___ > >>>ffmpeg-devel mailing list > >>>ffmpeg-devel@ffmpeg.org > >>>http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > >> > >> ffmpeg_opt.c | 12 ++-- > >> 1 file changed, 10 insertions(+), 2 deletions(-) > >>849898d28e989ffa5cc598c6fe4d43847b636132 > >>0001-ffmpeg-fix-channel_layout-bug-on-non-default-layout.patch > >> From 6d4f1c14135f9473b77e1c649d0e7bbaeba00a50 Mon Sep 17 00:00:00 2001 > >>From: pkviet > >>Date: Mon, 2 Oct 2017 11:14:31 +0200 > >>Subject: [PATCH] ffmpeg: fix channel_layout bug on non-default layout > >> > >>Fix for ticket 6706. > >>The -channel_layout option was not working when the channel layout was not > >>a default one (ex: for 4 channels, quad was interpreted as 4.0 which is > >>the default layout for 4 channels; or octagonal interpreted as 7.1). > >>This led to the spurious auto-insertion of an auto-resampler filter > >>remapping the channels even if input and output had identical channel > >>layouts. > >>The fix operates by directly calling the channel layout if defined in > >>options. If the layout is undefined, the default layout is selected as > >>before the fix. > >>--- > >> fftools/ffmpeg_opt.c | 12 ++-- > >> 1 file changed, 10 insertions(+), 2 deletions(-) > >> > >>diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c > >>index ca6f10d..cb25d7b 100644 > >>--- a/fftools/ffmpeg_opt.c > >>+++ b/fftools/ffmpeg_opt.c > >>@@ -1785,6 +1785,7 @@ static OutputStream *new_audio_stream(OptionsContext > >>*o, AVForm
Re: [FFmpeg-devel] [PATCH] Fix missing used attribute for inline assembly variables
On Sat, Nov 11, 2017 at 08:36:32AM +, Thomas Köppe wrote: > Variables used in inline assembly need to be marked with attribute((used)). > Static constants already were, via the define of DECLARE_ASM_CONST. > But DECLARE_ALIGNED does not add this attribute, and some of the variables > defined with it are const only used in inline assembly, and therefore > appeared dead. This change adds a macro DECLARE_ASM_ALIGNED that marks > variables as used. > > This change makes FFMPEG work with Clang's ThinLTO. > --- > libavcodec/cabac.c | 2 +- > libavcodec/x86/constants.c | 20 ++-- > libavutil/mem.h| 20 > libswscale/x86/swscale.c | 12 ++-- > 4 files changed, 37 insertions(+), 17 deletions(-) doesnt apply cleanly anymore Applying: Fix missing used attribute for inline assembly variables Using index info to reconstruct a base tree... M libavutil/mem.h Falling back to patching base and 3-way merge... Auto-merging libavutil/mem.h CONFLICT (content): Merge conflict in libavutil/mem.h error: Failed to merge in the changes. Patch failed at 0001 Fix missing used attribute for inline assembly variables The copy of the patch that failed is found in: .git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Those who are best at talking, realize last or never when they are wrong. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [DEVEL][PATCH v2] ffmpeg: fix channel_layout bug on non-default layout
Le 12 nov. 2017 5:01 PM, "Michael Niedermayer" a écrit : On Sat, Nov 11, 2017 at 02:15:25AM +0100, pkv.stream wrote: > Le 11/11/2017 à 1:07 AM, Michael Niedermayer a écrit : > >On Fri, Nov 10, 2017 at 10:27:48PM +0100, pkv.stream wrote: > >>Le 10/11/2017 à 1:12 AM, Michael Niedermayer a écrit : > >>>On Thu, Nov 09, 2017 at 09:37:33PM +0100, pkv.stream wrote: > Hi Michael, > > >> ffmpeg_opt.c | 11 ++- > >> 1 file changed, 10 insertions(+), 1 deletion(-) > >>2af07f4366efdfaf1018bb2ea29be672befe0823 0001-ffmpeg-fix-channel_ layout-bug-on-non-default-layout.patch > >> From 4ec55dc88923108132307b41300a1abddf32e6f7 Mon Sep 17 00:00:00 2001 > >>From: pkviet > >>Date: Mon, 2 Oct 2017 11:14:31 +0200 > >>Subject: [PATCH] ffmpeg: fix channel_layout bug on non-default layout > >> > >>Fix for ticket 6706. > >>The -channel_layout option was not working when the channel layout was not > >>a default one (ex: for 4 channels, quad was interpreted as 4.0 which is > >>the default layout for 4 channels; or octagonal interpreted as 7.1). > >>This led to the spurious auto-insertion of an auto-resampler filter > >>remapping the channels even if input and output had identical channel > >>layouts. > >>The fix operates by directly calling the channel layout if defined in > >>options. If the layout is undefined, the default layout is selected as > >>before the fix. > >>--- > >> ffmpeg_opt.c | 11 ++- > >> 1 file changed, 10 insertions(+), 1 deletion(-) > >> > >>diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c > >>index 100fa76..cf5a63c 100644 > >>--- a/ffmpeg_opt.c > >>+++ b/ffmpeg_opt.c > >>@@ -1804,6 +1804,12 @@ static OutputStream > >>*new_audio_stream(OptionsContext *o, AVFormatContext *oc, in > >> MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st); > >>+AVDictionaryEntry *output_layout = av_dict_get(o->g->codec_opts, > >>+ "channel_layout", > >>+ NULL, AV_DICT_MATCH_CASE); > >This doesnt look right > > > >not an issue of the patch as such but > >why is the channel_layout option per file and not per stream? > just my ignorance; do you mean this is not the right way to retrieve > the channel_layout option from an audio stream ? > >>>I think there is more buggy with how the channel_layout is handled > >>> > >>>try this: > >>>./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -channel_layout 5 test.wav > >>>and this: > >>>./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -channel_layout:a 5 test.wav > >>> > >>>while it may appear that the are both working this is deceiving. > >>>I think only the channel number gets actually used in the 2nd case > >>> > >>>Look at what your code with av_dict_get() reads. > >>>It does not obtain the 5 in the 2nd case > >>ok I fixed that by using the flag AV_DICT_IGNORE_SUFFIX ; now > >>-channel_layout:a works as expected. > >>I fixed also all the styling issues you spotted (mixed declarations, > >>{} for if etc). > >> > >>Still not understanding your initial comment though : > >>'why is the channel_layout option per file and not per stream?' > >> > >>do you mean o->g->codec_opts is not where I should retrieve the > >>channel_layout ? if not where from ? > >> > >>Thanks > >> > >>>[...] > >>> > >>> > >>>___ > >>>ffmpeg-devel mailing list > >>>ffmpeg-devel@ffmpeg.org > >>>http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > >> > >> ffmpeg_opt.c | 12 ++-- > >> 1 file changed, 10 insertions(+), 2 deletions(-) > >>849898d28e989ffa5cc598c6fe4d43847b636132 0001-ffmpeg-fix-channel_ layout-bug-on-non-default-layout.patch > >> From 6d4f1c14135f9473b77e1c649d0e7bbaeba00a50 Mon Sep 17 00:00:00 2001 > >>From: pkviet > >>Date: Mon, 2 Oct 2017 11:14:31 +0200 > >>Subject: [PATCH] ffmpeg: fix channel_layout bug on non-default layout > >> > >>Fix for ticket 6706. > >>The -channel_layout option was not working when the channel layout was not > >>a default one (ex: for 4 channels, quad was interpreted as 4.0 which is > >>the default layout for 4 channels; or octagonal interpreted as 7.1). > >>This led to the spurious auto-insertion of an auto-resampler filter > >>remapping the channels even if input and output had identical channel > >>layouts. > >>The fix operates by directly calling the channel layout if defined in > >>options. If the layout is undefined, the default layout is selected as > >>before the fix. > >>--- > >> fftools/ffmpeg_opt.c | 12 ++-- > >> 1 file changed, 10 insertions(+), 2 deletions(-) > >> > >>diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c > >>index ca6f10d..cb25d7b 100644 > >>--- a/fftools/ffmpeg_opt.c > >>+++ b/fftools/ffmpeg_opt.c > >>@@ -1785,6 +1785,7 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in > >> AVStream *st; > >> Outpu
Re: [FFmpeg-devel] avcodec/qsvenc Question for Intel QSV low latency
On Sun, Nov 12, 2017 at 11:40:57AM +0900, Natsuki Kai wrote: > Hello guys, > > this is my first posting to ffmpeg-devel, and I believe my mail format is > correct. > > I'm using ffmpeg for encoding video in real-time, so low encode delay is > needed. > Once I call "avcodec_send_frame(avctx, frame)", I'd like to get the encoded > data from "avcodec_receive_packet(avctx, avpkt)". > > However I cannot do that in ffmpeg and Intel QSV (qsv), > "avcodec_receive_packet()" returns nothing when I input the first frame to > qsv encoder by calling "avcodec_send_frame()". > Of cource, after second frame inputs, qsv encoder returns valid data. > I'd like to get a valid data from first calling. > > I've tried some cases and as a result, my requirement is satisfied when > avcodec/qsvenc.c will be fixed like below diff info. > Then I have a question. > Why q->async_fifo is set to be q->async_depth "+ 1"? > Anybody knows? > > --- a/avcodec/qsvenc.c > +++ b/avcodec/qsvenc.c > @@ -803,7 +803,7 @@ > > q->param.AsyncDepth = q->async_depth; > > -q->async_fifo = av_fifo_alloc((1 + q->async_depth) * > +q->async_fifo = av_fifo_alloc((q->async_depth) * >(sizeof(AVPacket) + > sizeof(mfxSyncPoint*) + sizeof(mfxBitstream*))); > if (!q->async_fifo) > return AVERROR(ENOMEM); This looks corrupted by a newline Applying: avcodec/qsvenc Question for Intel QSV low latency error: corrupt patch at line 10 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Those who are best at talking, realize last or never when they are wrong. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/vf_tile: add overlap option
Le primidi 21 brumaire, an CCXXVI, Paul B Mahol a écrit : > Signed-off-by: Paul B Mahol > --- > doc/filters.texi | 5 + > libavfilter/vf_tile.c | 54 > ++- > 2 files changed, 50 insertions(+), 9 deletions(-) > > diff --git a/doc/filters.texi b/doc/filters.texi > index 5c6729a484..6079290fbd 100644 > --- a/doc/filters.texi > +++ b/doc/filters.texi > @@ -14441,6 +14441,11 @@ refer to the pad video filter. > Specify the color of the unused area. For the syntax of this option, check > the > "Color" section in the ffmpeg-utils manual. The default value of @var{color} > is "black". > + > +@item overlap > +Set the number of frames to overlap when tiling several successive frames > together. > +The default value is @code{0}, meaning overlap @var{0} frames. If it is more > +than @var{nb_frames - 1} its set to @var{nb_frames - 1} and warning is > displayed. "The value must be between 0 and nb_frames-1", and do not specify what happens if it is outside the range. Otherwise, we cannot extend the behaviour without breaking the API. > @end table > > @subsection Examples > diff --git a/libavfilter/vf_tile.c b/libavfilter/vf_tile.c > index e9d246fc73..7717ce12e7 100644 > --- a/libavfilter/vf_tile.c > +++ b/libavfilter/vf_tile.c > @@ -37,11 +37,13 @@ typedef struct TileContext { > unsigned w, h; > unsigned margin; > unsigned padding; > +unsigned overlap; > unsigned current; > unsigned nb_frames; > FFDrawContext draw; > FFDrawColor blank; > AVFrame *out_ref; > +AVFrame *prev_out_ref; > uint8_t rgba_color[4]; > } TileContext; > > @@ -58,6 +60,8 @@ static const AVOption tile_options[] = { > { "padding", "set inner border thickness in pixels", OFFSET(padding), > AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1024, FLAGS }, > { "color", "set the color of the unused area", OFFSET(rgba_color), > AV_OPT_TYPE_COLOR, {.str = "black"}, .flags = FLAGS }, > +{ "overlap", "set how many frames to overlap for each render", > OFFSET(overlap), > +AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS }, > { NULL } > }; > > @@ -90,6 +94,11 @@ static av_cold int init(AVFilterContext *ctx) > return AVERROR(EINVAL); > } > > +if (tile->overlap >= tile->nb_frames) { > +av_log(ctx, AV_LOG_WARNING, "overlap must be less than %d\n", > tile->nb_frames); > +tile->overlap = tile->nb_frames - 1; > +} > + > return 0; > } > > @@ -120,19 +129,19 @@ static int config_props(AVFilterLink *outlink) > outlink->h = tile->h * inlink->h + total_margin_h; > outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; > outlink->frame_rate = av_mul_q(inlink->frame_rate, > - av_make_q(1, tile->nb_frames)); > + av_make_q(1, tile->nb_frames - > tile->overlap)); > ff_draw_init(&tile->draw, inlink->format, 0); > ff_draw_color(&tile->draw, &tile->blank, tile->rgba_color); > > return 0; > } > > -static void get_current_tile_pos(AVFilterContext *ctx, unsigned *x, unsigned > *y) > +static void get_tile_pos(AVFilterContext *ctx, unsigned *x, unsigned *y, > unsigned current) > { > TileContext *tile= ctx->priv; > AVFilterLink *inlink = ctx->inputs[0]; > -const unsigned tx = tile->current % tile->w; > -const unsigned ty = tile->current / tile->w; > +const unsigned tx = current % tile->w; > +const unsigned ty = current / tile->w; > > *x = tile->margin + (inlink->w + tile->padding) * tx; > *y = tile->margin + (inlink->h + tile->padding) * ty; > @@ -144,7 +153,7 @@ static void draw_blank_frame(AVFilterContext *ctx, > AVFrame *out_buf) > AVFilterLink *inlink = ctx->inputs[0]; > unsigned x0, y0; > > -get_current_tile_pos(ctx, &x0, &y0); > +get_tile_pos(ctx, &x0, &y0, tile->current); > ff_fill_rectangle(&tile->draw, &tile->blank, >out_buf->data, out_buf->linesize, >x0, y0, inlink->w, inlink->h); > @@ -160,8 +169,13 @@ static int end_last_frame(AVFilterContext *ctx) > > while (tile->current < tile->nb_frames) > draw_blank_frame(ctx, out_buf); > +tile->current = tile->overlap; > +if (tile->current) { > +av_frame_free(&tile->prev_out_ref); > +tile->prev_out_ref = av_frame_clone(out_buf); > +} > ret = ff_filter_frame(outlink, out_buf); > -tile->current = 0; > +tile->out_ref = NULL; > return ret; > } > > @@ -176,7 +190,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame > *picref) > AVFilterLink *outlink = ctx->outputs[0]; > unsigned x0, y0; > > -if (!tile->current) { > +if (!tile->out_ref) { > tile->out_ref = ff_get_video_buffer(outlink, outlink->w, outlink->h); > if (!tile->out_ref) { > av_frame_free(&picref); > @@ -194,7 +208,21 @@ static int filter_f
Re: [FFmpeg-devel] [PATCH] avutil: add API for mb types.
On 12 November 2017 at 15:59, Michael Niedermayer wrote: > This is based on motion_type.h > > TODO: docs & split into a commit per lib > Signed-off-by: Michael Niedermayer > --- > libavcodec/avcodec.h | 4 ++ > libavcodec/options_table.h | 1 + > libavutil/block_type.h | 107 ++ > +++ > libavutil/frame.h | 14 ++ > 4 files changed, 126 insertions(+) > create mode 100644 libavutil/block_type.h > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index 15ca871b59..1a49fa0a9a 100644 > --- a/libavcodec/avcodec.h > +++ b/libavcodec/avcodec.h > @@ -923,6 +923,10 @@ typedef struct RcOverride{ > * Show all frames before the first keyframe > */ > #define AV_CODEC_FLAG2_SHOW_ALL (1 << 22) > +/** > + * Export block types through frame side data > + */ > +#define AV_CODEC_FLAG2_EXPORT_BLOCKS (1 << 27) > /** > * Export motion vectors through frame side data > */ > diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h > index d89f58d540..0b86b4d0fb 100644 > --- a/libavcodec/options_table.h > +++ b/libavcodec/options_table.h > @@ -74,6 +74,7 @@ static const AVOption avcodec_options[] = { > {"chunks", "Frame data might be split into multiple chunks", 0, > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_CHUNKS }, INT_MIN, INT_MAX, V|D, > "flags2"}, > {"showall", "Show all frames before the first keyframe", 0, > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SHOW_ALL }, INT_MIN, INT_MAX, > V|D, "flags2"}, > {"export_mvs", "export motion vectors through frame side data", 0, > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, > V|D, "flags2"}, > +{"export_blocks", "export block types through frame side data", 0, > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_BLOCKS}, INT_MIN, INT_MAX, > V|D, "flags2"}, > {"skip_manual", "do not skip samples and export skip information as frame > side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SKIP_MANUAL}, > INT_MIN, INT_MAX, V|D, "flags2"}, > {"ass_ro_flush_noop", "do not reset ASS ReadOrder field on flush", 0, > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_RO_FLUSH_NOOP}, INT_MIN, INT_MAX, > S|D, "flags2"}, > {"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, > 0, INT_MAX}, > diff --git a/libavutil/block_type.h b/libavutil/block_type.h > new file mode 100644 > index 00..3f53f1d082 > --- /dev/null > +++ b/libavutil/block_type.h > @@ -0,0 +1,107 @@ > +/* > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > 02110-1301 USA > + */ > + > +#ifndef AVUTIL_BLOCK_TYPE_H > +#define AVUTIL_BLOCK_TYPE_H > + > +#include > + > + > +typedef struct AVBlockType { > +/** > + * Block type. > + * 1: Prediction (this can be spatial prediction or motion > compensation for example) > + * 2: Transform > + * 3: Residual > + * 4: Filter > + * 5: Metadata > + * > + * Multiple Filter, Transform and prediction blocks are allowed, for > example > + * for bidirectional motion compensation. Multiple residuals are > allowed, for > + * example DC and AC residual. > + */ > +uint8_t type; > +/** > + * Bitmask that lists which planes (for example: > Y:1,Cb:2,Cr:4,Alpha:8) > + * this block applies to. > + */ > +uint8_t plane_mask; > +/** > + * The field (top:1, bottom:2) this block applies to. > + */ > +uint8_t field_mask; > +uint8_t name[16]; > +/** > + * Left Top corner position. This can be outside of the vissible > frame. > + */ > +int32_t x, y; > +/** > + * Width and height of the block. > + */ > +uint16_t w, h; > +/** > + * Number identifying the slice the Block is in. > + */ > +uint16_t slice_num; > +/** > + * Location in bits where the block related information is stored. > can be -1 > + */ > +uint32_t block_index, block_bits; > + > +/** > + * Main Direction, 0 is horizontal, 48 is vertical, > + * values 0 to 95 follow clockwise direction. > + * 255 means that the block has no direction. > + * This represents the main direction of a transform, prediction or > filter > + */ > +uint8_t direction; > + > +/** > + * Quantization parameter, a valu
Re: [FFmpeg-devel] [DEVEL][PATCH v2] ffmpeg: fix channel_layout bug on non-default layout
Le 12/11/2017 à 5:00 PM, Michael Niedermayer a écrit : On Sat, Nov 11, 2017 at 02:15:25AM +0100, pkv.stream wrote: Le 11/11/2017 à 1:07 AM, Michael Niedermayer a écrit : On Fri, Nov 10, 2017 at 10:27:48PM +0100, pkv.stream wrote: Le 10/11/2017 à 1:12 AM, Michael Niedermayer a écrit : On Thu, Nov 09, 2017 at 09:37:33PM +0100, pkv.stream wrote: Hi Michael, ffmpeg_opt.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) 2af07f4366efdfaf1018bb2ea29be672befe0823 0001-ffmpeg-fix-channel_layout-bug-on-non-default-layout.patch From 4ec55dc88923108132307b41300a1abddf32e6f7 Mon Sep 17 00:00:00 2001 From: pkviet Date: Mon, 2 Oct 2017 11:14:31 +0200 Subject: [PATCH] ffmpeg: fix channel_layout bug on non-default layout Fix for ticket 6706. The -channel_layout option was not working when the channel layout was not a default one (ex: for 4 channels, quad was interpreted as 4.0 which is the default layout for 4 channels; or octagonal interpreted as 7.1). This led to the spurious auto-insertion of an auto-resampler filter remapping the channels even if input and output had identical channel layouts. The fix operates by directly calling the channel layout if defined in options. If the layout is undefined, the default layout is selected as before the fix. --- ffmpeg_opt.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 100fa76..cf5a63c 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -1804,6 +1804,12 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st); +AVDictionaryEntry *output_layout = av_dict_get(o->g->codec_opts, + "channel_layout", + NULL, AV_DICT_MATCH_CASE); This doesnt look right not an issue of the patch as such but why is the channel_layout option per file and not per stream? just my ignorance; do you mean this is not the right way to retrieve the channel_layout option from an audio stream ? I think there is more buggy with how the channel_layout is handled try this: ./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -channel_layout 5 test.wav and this: ./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -channel_layout:a 5 test.wav while it may appear that the are both working this is deceiving. I think only the channel number gets actually used in the 2nd case Look at what your code with av_dict_get() reads. It does not obtain the 5 in the 2nd case ok I fixed that by using the flag AV_DICT_IGNORE_SUFFIX ; now -channel_layout:a works as expected. I fixed also all the styling issues you spotted (mixed declarations, {} for if etc). Still not understanding your initial comment though : 'why is the channel_layout option per file and not per stream?' do you mean o->g->codec_opts is not where I should retrieve the channel_layout ? if not where from ? Thanks [...] ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ffmpeg_opt.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) 849898d28e989ffa5cc598c6fe4d43847b636132 0001-ffmpeg-fix-channel_layout-bug-on-non-default-layout.patch From 6d4f1c14135f9473b77e1c649d0e7bbaeba00a50 Mon Sep 17 00:00:00 2001 From: pkviet Date: Mon, 2 Oct 2017 11:14:31 +0200 Subject: [PATCH] ffmpeg: fix channel_layout bug on non-default layout Fix for ticket 6706. The -channel_layout option was not working when the channel layout was not a default one (ex: for 4 channels, quad was interpreted as 4.0 which is the default layout for 4 channels; or octagonal interpreted as 7.1). This led to the spurious auto-insertion of an auto-resampler filter remapping the channels even if input and output had identical channel layouts. The fix operates by directly calling the channel layout if defined in options. If the layout is undefined, the default layout is selected as before the fix. --- fftools/ffmpeg_opt.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index ca6f10d..cb25d7b 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1785,6 +1785,7 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in AVStream *st; OutputStream *ost; AVCodecContext *audio_enc; +AVDictionaryEntry *output_layout; ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO, source_index); st = ost->st; @@ -1799,7 +1800,10 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in char *sample_fmt = NULL; MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st); - +output_layout = av_dict_get(o->g->codec_opts,"channel_layout", NULL, AV_DICT_IGNORE_SUFFIX); i didnt try but i as
Re: [FFmpeg-devel] [PATCH] avutil: add API for mb types.
On 12 November 2017 at 16:21, Rostislav Pehlivanov wrote: > > > On 12 November 2017 at 15:59, Michael Niedermayer > wrote: > >> This is based on motion_type.h >> >> TODO: docs & split into a commit per lib >> Signed-off-by: Michael Niedermayer >> --- >> libavcodec/avcodec.h | 4 ++ >> libavcodec/options_table.h | 1 + >> libavutil/block_type.h | 107 ++ >> +++ >> libavutil/frame.h | 14 ++ >> 4 files changed, 126 insertions(+) >> create mode 100644 libavutil/block_type.h >> >> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h >> index 15ca871b59..1a49fa0a9a 100644 >> --- a/libavcodec/avcodec.h >> +++ b/libavcodec/avcodec.h >> @@ -923,6 +923,10 @@ typedef struct RcOverride{ >> * Show all frames before the first keyframe >> */ >> #define AV_CODEC_FLAG2_SHOW_ALL (1 << 22) >> +/** >> + * Export block types through frame side data >> + */ >> +#define AV_CODEC_FLAG2_EXPORT_BLOCKS (1 << 27) >> /** >> * Export motion vectors through frame side data >> */ >> diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h >> index d89f58d540..0b86b4d0fb 100644 >> --- a/libavcodec/options_table.h >> +++ b/libavcodec/options_table.h >> @@ -74,6 +74,7 @@ static const AVOption avcodec_options[] = { >> {"chunks", "Frame data might be split into multiple chunks", 0, >> AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_CHUNKS }, INT_MIN, INT_MAX, V|D, >> "flags2"}, >> {"showall", "Show all frames before the first keyframe", 0, >> AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SHOW_ALL }, INT_MIN, INT_MAX, >> V|D, "flags2"}, >> {"export_mvs", "export motion vectors through frame side data", 0, >> AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, >> V|D, "flags2"}, >> +{"export_blocks", "export block types through frame side data", 0, >> AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_BLOCKS}, INT_MIN, INT_MAX, >> V|D, "flags2"}, >> {"skip_manual", "do not skip samples and export skip information as >> frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = >> AV_CODEC_FLAG2_SKIP_MANUAL}, INT_MIN, INT_MAX, V|D, "flags2"}, >> {"ass_ro_flush_noop", "do not reset ASS ReadOrder field on flush", 0, >> AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_RO_FLUSH_NOOP}, INT_MIN, INT_MAX, >> S|D, "flags2"}, >> {"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, >> 0, INT_MAX}, >> diff --git a/libavutil/block_type.h b/libavutil/block_type.h >> new file mode 100644 >> index 00..3f53f1d082 >> --- /dev/null >> +++ b/libavutil/block_type.h >> @@ -0,0 +1,107 @@ >> +/* >> + * This file is part of FFmpeg. >> + * >> + * FFmpeg is free software; you can redistribute it and/or >> + * modify it under the terms of the GNU Lesser General Public >> + * License as published by the Free Software Foundation; either >> + * version 2.1 of the License, or (at your option) any later version. >> + * >> + * FFmpeg is distributed in the hope that it will be useful, >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >> + * Lesser General Public License for more details. >> + * >> + * You should have received a copy of the GNU Lesser General Public >> + * License along with FFmpeg; if not, write to the Free Software >> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA >> 02110-1301 USA >> + */ >> + >> +#ifndef AVUTIL_BLOCK_TYPE_H >> +#define AVUTIL_BLOCK_TYPE_H >> + >> +#include >> + >> + >> +typedef struct AVBlockType { >> +/** >> + * Block type. >> + * 1: Prediction (this can be spatial prediction or motion >> compensation for example) >> + * 2: Transform >> + * 3: Residual >> + * 4: Filter >> + * 5: Metadata >> + * >> + * Multiple Filter, Transform and prediction blocks are allowed, for >> example >> + * for bidirectional motion compensation. Multiple residuals are >> allowed, for >> + * example DC and AC residual. >> + */ >> +uint8_t type; >> +/** >> + * Bitmask that lists which planes (for example: >> Y:1,Cb:2,Cr:4,Alpha:8) >> + * this block applies to. >> + */ >> +uint8_t plane_mask; >> +/** >> + * The field (top:1, bottom:2) this block applies to. >> + */ >> +uint8_t field_mask; >> +uint8_t name[16]; >> +/** >> + * Left Top corner position. This can be outside of the vissible >> frame. >> + */ >> +int32_t x, y; >> +/** >> + * Width and height of the block. >> + */ >> +uint16_t w, h; >> +/** >> + * Number identifying the slice the Block is in. >> + */ >> +uint16_t slice_num; >> +/** >> + * Location in bits where the block related information is stored. >> can be -1 >> + */ >> +uint32_t block_index, block_bits; >> + >> +/** >> + * Main Direction, 0 is horizontal, 48 is vertical, >> + * values 0 to 95 follow clockwise direction. >> + * 255 means that
[FFmpeg-devel] [PATCH] Fix missing used attribute for inline assembly variables
Variables used in inline assembly need to be marked with attribute((used)). Static constants already were, via the define of DECLARE_ASM_CONST. But DECLARE_ALIGNED does not add this attribute, and some of the variables defined with it are const only used in inline assembly, and therefore appeared dead. This change adds a macro DECLARE_ASM_ALIGNED that marks variables as used. This change makes FFMPEG work with Clang's ThinLTO. --- libavcodec/cabac.c | 2 +- libavcodec/x86/constants.c | 20 ++-- libavutil/mem.h| 17 + libswscale/x86/swscale.c | 12 ++-- 4 files changed, 34 insertions(+), 17 deletions(-) diff --git a/libavcodec/cabac.c b/libavcodec/cabac.c index dd2b057c6d..e51139de3b 100644 --- a/libavcodec/cabac.c +++ b/libavcodec/cabac.c @@ -32,7 +32,7 @@ #include "cabac.h" #include "cabac_functions.h" -const uint8_t ff_h264_cabac_tables[512 + 4*2*64 + 4*64 + 63] = { +DECLARE_ASM_ALIGNED(1, const uint8_t, ff_h264_cabac_tables)[512 + 4*2*64 + 4*64 + 63] = { 9,8,7,7,6,6,6,6,5,5,5,5,5,5,5,5, 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, diff --git a/libavcodec/x86/constants.c b/libavcodec/x86/constants.c index 11002ee61e..47905c74a1 100644 --- a/libavcodec/x86/constants.c +++ b/libavcodec/x86/constants.c @@ -26,23 +26,23 @@ DECLARE_ALIGNED(32, const ymm_reg, ff_pw_1)= { 0x0001000100010001ULL, 0x000 0x0001000100010001ULL, 0x0001000100010001ULL }; DECLARE_ALIGNED(32, const ymm_reg, ff_pw_2)= { 0x0002000200020002ULL, 0x0002000200020002ULL, 0x0002000200020002ULL, 0x0002000200020002ULL }; -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_3)= { 0x0003000300030003ULL, 0x0003000300030003ULL }; -DECLARE_ALIGNED(32, const ymm_reg, ff_pw_4)= { 0x0004000400040004ULL, 0x0004000400040004ULL, +DECLARE_ASM_ALIGNED(16, const xmm_reg, ff_pw_3)= { 0x0003000300030003ULL, 0x0003000300030003ULL }; +DECLARE_ASM_ALIGNED(32, const ymm_reg, ff_pw_4)= { 0x0004000400040004ULL, 0x0004000400040004ULL, 0x0004000400040004ULL, 0x0004000400040004ULL }; -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_5)= { 0x0005000500050005ULL, 0x0005000500050005ULL }; +DECLARE_ASM_ALIGNED(16, const xmm_reg, ff_pw_5)= { 0x0005000500050005ULL, 0x0005000500050005ULL }; DECLARE_ALIGNED(16, const xmm_reg, ff_pw_8)= { 0x0008000800080008ULL, 0x0008000800080008ULL }; -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_9)= { 0x0009000900090009ULL, 0x0009000900090009ULL }; +DECLARE_ASM_ALIGNED(16, const xmm_reg, ff_pw_9)= { 0x0009000900090009ULL, 0x0009000900090009ULL }; DECLARE_ALIGNED(8, const uint64_t, ff_pw_15) = 0x000F000F000F000FULL; DECLARE_ALIGNED(16, const xmm_reg, ff_pw_16) = { 0x0010001000100010ULL, 0x0010001000100010ULL }; DECLARE_ALIGNED(16, const xmm_reg, ff_pw_17) = { 0x0011001100110011ULL, 0x0011001100110011ULL }; -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_18) = { 0x0012001200120012ULL, 0x0012001200120012ULL }; +DECLARE_ASM_ALIGNED(16, const xmm_reg, ff_pw_18) = { 0x0012001200120012ULL, 0x0012001200120012ULL }; DECLARE_ALIGNED(16, const xmm_reg, ff_pw_20) = { 0x0014001400140014ULL, 0x0014001400140014ULL }; DECLARE_ALIGNED(16, const xmm_reg, ff_pw_32) = { 0x0020002000200020ULL, 0x0020002000200020ULL }; -DECLARE_ALIGNED(8, const uint64_t, ff_pw_42) = 0x002A002A002A002AULL; -DECLARE_ALIGNED(8, const uint64_t, ff_pw_53) = 0x0035003500350035ULL; -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_64) = { 0x0040004000400040ULL, 0x0040004000400040ULL }; -DECLARE_ALIGNED(8, const uint64_t, ff_pw_96) = 0x0060006000600060ULL; -DECLARE_ALIGNED(8, const uint64_t, ff_pw_128) = 0x0080008000800080ULL; +DECLARE_ASM_ALIGNED(8, const uint64_t, ff_pw_42) = 0x002A002A002A002AULL; +DECLARE_ASM_ALIGNED(8, const uint64_t, ff_pw_53) = 0x0035003500350035ULL; +DECLARE_ASM_ALIGNED(16, const xmm_reg, ff_pw_64) = { 0x0040004000400040ULL, 0x0040004000400040ULL }; +DECLARE_ASM_ALIGNED(8, const uint64_t, ff_pw_96) = 0x0060006000600060ULL; +DECLARE_ASM_ALIGNED(8, const uint64_t, ff_pw_128) = 0x0080008000800080ULL; DECLARE_ALIGNED(32, const ymm_reg, ff_pw_255) = { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL }; DECLARE_ALIGNED(32, const ymm_reg, ff_pw_256) = { 0x0100010001000100ULL, 0x0100010001000100ULL, diff --git a/libavutil/mem.h b/libavutil/mem.h index e5ca8299dc..9e344bd2c3 100644 --- a/libavutil/mem.h +++ b/libavutil/mem.h @@ -73,6 +73,19 @@ * @param v Name of the variable */ +/** + * @def DECLARE_ASM_ALIGNED(n,t,v) + * Declare an aligned variable appropriate for use in inline assembly code. + * + * @code{.c} + * DECLARE_ASM_ALIGNED(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008); + * @en
Re: [FFmpeg-devel] [DEVEL][PATCH v2] ffmpeg: fix channel_layout bug on non-default layout
On Sun, Nov 12, 2017 at 05:07:04PM +0100, Kv Pham wrote: > Le 12 nov. 2017 5:01 PM, "Michael Niedermayer" a > écrit : > > On Sat, Nov 11, 2017 at 02:15:25AM +0100, pkv.stream wrote: > > Le 11/11/2017 à 1:07 AM, Michael Niedermayer a écrit : > > >On Fri, Nov 10, 2017 at 10:27:48PM +0100, pkv.stream wrote: > > >>Le 10/11/2017 à 1:12 AM, Michael Niedermayer a écrit : > > >>>On Thu, Nov 09, 2017 at 09:37:33PM +0100, pkv.stream wrote: > > Hi Michael, > > > > >> ffmpeg_opt.c | 11 ++- > > >> 1 file changed, 10 insertions(+), 1 deletion(-) > > >>2af07f4366efdfaf1018bb2ea29be672befe0823 0001-ffmpeg-fix-channel_ > layout-bug-on-non-default-layout.patch > > >> From 4ec55dc88923108132307b41300a1abddf32e6f7 Mon Sep 17 00:00:00 > 2001 > > >>From: pkviet > > >>Date: Mon, 2 Oct 2017 11:14:31 +0200 > > >>Subject: [PATCH] ffmpeg: fix channel_layout bug on non-default > layout > > >> > > >>Fix for ticket 6706. > > >>The -channel_layout option was not working when the channel layout > was not > > >>a default one (ex: for 4 channels, quad was interpreted as 4.0 > which is > > >>the default layout for 4 channels; or octagonal interpreted as 7.1). > > >>This led to the spurious auto-insertion of an auto-resampler filter > > >>remapping the channels even if input and output had identical > channel > > >>layouts. > > >>The fix operates by directly calling the channel layout if defined > in > > >>options. If the layout is undefined, the default layout is selected > as > > >>before the fix. > > >>--- > > >> ffmpeg_opt.c | 11 ++- > > >> 1 file changed, 10 insertions(+), 1 deletion(-) > > >> > > >>diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c > > >>index 100fa76..cf5a63c 100644 > > >>--- a/ffmpeg_opt.c > > >>+++ b/ffmpeg_opt.c > > >>@@ -1804,6 +1804,12 @@ static OutputStream > > >>*new_audio_stream(OptionsContext > *o, AVFormatContext *oc, in > > >> MATCH_PER_STREAM_OPT(audio_channels, i, > audio_enc->channels, oc, st); > > >>+AVDictionaryEntry *output_layout = > av_dict_get(o->g->codec_opts, > > >>+ > "channel_layout", > > >>+ NULL, > AV_DICT_MATCH_CASE); > > >This doesnt look right > > > > > >not an issue of the patch as such but > > >why is the channel_layout option per file and not per stream? > > just my ignorance; do you mean this is not the right way to retrieve > > the channel_layout option from an audio stream ? > > >>>I think there is more buggy with how the channel_layout is handled > > >>> > > >>>try this: > > >>>./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -channel_layout 5 test.wav > > >>>and this: > > >>>./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -channel_layout:a 5 test.wav > > >>> > > >>>while it may appear that the are both working this is deceiving. > > >>>I think only the channel number gets actually used in the 2nd case > > >>> > > >>>Look at what your code with av_dict_get() reads. > > >>>It does not obtain the 5 in the 2nd case > > >>ok I fixed that by using the flag AV_DICT_IGNORE_SUFFIX ; now > > >>-channel_layout:a works as expected. > > >>I fixed also all the styling issues you spotted (mixed declarations, > > >>{} for if etc). > > >> > > >>Still not understanding your initial comment though : > > >>'why is the channel_layout option per file and not per stream?' > > >> > > >>do you mean o->g->codec_opts is not where I should retrieve the > > >>channel_layout ? if not where from ? > > >> > > >>Thanks > > >> > > >>>[...] > > >>> > > >>> > > >>>___ > > >>>ffmpeg-devel mailing list > > >>>ffmpeg-devel@ffmpeg.org > > >>>http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > >> > > >> ffmpeg_opt.c | 12 ++-- > > >> 1 file changed, 10 insertions(+), 2 deletions(-) > > >>849898d28e989ffa5cc598c6fe4d43847b636132 0001-ffmpeg-fix-channel_ > layout-bug-on-non-default-layout.patch > > >> From 6d4f1c14135f9473b77e1c649d0e7bbaeba00a50 Mon Sep 17 00:00:00 2001 > > >>From: pkviet > > >>Date: Mon, 2 Oct 2017 11:14:31 +0200 > > >>Subject: [PATCH] ffmpeg: fix channel_layout bug on non-default layout > > >> > > >>Fix for ticket 6706. > > >>The -channel_layout option was not working when the channel layout was > not > > >>a default one (ex: for 4 channels, quad was interpreted as 4.0 which is > > >>the default layout for 4 channels; or octagonal interpreted as 7.1). > > >>This led to the spurious auto-insertion of an auto-resampler filter > > >>remapping the channels even if input and output had identical channel > > >>layouts. > > >>The fix operates by directly calling the channel layout if defined in > > >>options. If the layout is undefined, the default layout is selected as > > >>before the fix. > > >>--- > > >> fftools/ffmpeg_opt.c | 12 ++-- > > >> 1 file changed, 10 insertions(+), 2 deletions(-) > > >> > > >>diff
Re: [FFmpeg-devel] [PATCH] avutil: add API for mb types.
On Sun, Nov 12, 2017 at 04:21:15PM +, Rostislav Pehlivanov wrote: > On 12 November 2017 at 15:59, Michael Niedermayer > wrote: > > > This is based on motion_type.h > > > > TODO: docs & split into a commit per lib > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/avcodec.h | 4 ++ > > libavcodec/options_table.h | 1 + > > libavutil/block_type.h | 107 ++ > > +++ > > libavutil/frame.h | 14 ++ > > 4 files changed, 126 insertions(+) > > create mode 100644 libavutil/block_type.h > > > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > > index 15ca871b59..1a49fa0a9a 100644 > > --- a/libavcodec/avcodec.h > > +++ b/libavcodec/avcodec.h > > @@ -923,6 +923,10 @@ typedef struct RcOverride{ > > * Show all frames before the first keyframe > > */ > > #define AV_CODEC_FLAG2_SHOW_ALL (1 << 22) > > +/** > > + * Export block types through frame side data > > + */ > > +#define AV_CODEC_FLAG2_EXPORT_BLOCKS (1 << 27) > > /** > > * Export motion vectors through frame side data > > */ > > diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h > > index d89f58d540..0b86b4d0fb 100644 > > --- a/libavcodec/options_table.h > > +++ b/libavcodec/options_table.h > > @@ -74,6 +74,7 @@ static const AVOption avcodec_options[] = { > > {"chunks", "Frame data might be split into multiple chunks", 0, > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_CHUNKS }, INT_MIN, INT_MAX, V|D, > > "flags2"}, > > {"showall", "Show all frames before the first keyframe", 0, > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SHOW_ALL }, INT_MIN, INT_MAX, > > V|D, "flags2"}, > > {"export_mvs", "export motion vectors through frame side data", 0, > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, > > V|D, "flags2"}, > > +{"export_blocks", "export block types through frame side data", 0, > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_BLOCKS}, INT_MIN, INT_MAX, > > V|D, "flags2"}, > > {"skip_manual", "do not skip samples and export skip information as frame > > side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SKIP_MANUAL}, > > INT_MIN, INT_MAX, V|D, "flags2"}, > > {"ass_ro_flush_noop", "do not reset ASS ReadOrder field on flush", 0, > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_RO_FLUSH_NOOP}, INT_MIN, INT_MAX, > > S|D, "flags2"}, > > {"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, > > 0, INT_MAX}, > > diff --git a/libavutil/block_type.h b/libavutil/block_type.h > > new file mode 100644 > > index 00..3f53f1d082 > > --- /dev/null > > +++ b/libavutil/block_type.h > > @@ -0,0 +1,107 @@ > > +/* > > + * This file is part of FFmpeg. > > + * > > + * FFmpeg is free software; you can redistribute it and/or > > + * modify it under the terms of the GNU Lesser General Public > > + * License as published by the Free Software Foundation; either > > + * version 2.1 of the License, or (at your option) any later version. > > + * > > + * FFmpeg is distributed in the hope that it will be useful, > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > + * Lesser General Public License for more details. > > + * > > + * You should have received a copy of the GNU Lesser General Public > > + * License along with FFmpeg; if not, write to the Free Software > > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > > 02110-1301 USA > > + */ > > + > > +#ifndef AVUTIL_BLOCK_TYPE_H > > +#define AVUTIL_BLOCK_TYPE_H > > + > > +#include > > + > > + > > +typedef struct AVBlockType { > > +/** > > + * Block type. > > + * 1: Prediction (this can be spatial prediction or motion > > compensation for example) > > + * 2: Transform > > + * 3: Residual > > + * 4: Filter > > + * 5: Metadata > > + * > > + * Multiple Filter, Transform and prediction blocks are allowed, for > > example > > + * for bidirectional motion compensation. Multiple residuals are > > allowed, for > > + * example DC and AC residual. > > + */ > > +uint8_t type; > > +/** > > + * Bitmask that lists which planes (for example: > > Y:1,Cb:2,Cr:4,Alpha:8) > > + * this block applies to. > > + */ > > +uint8_t plane_mask; > > +/** > > + * The field (top:1, bottom:2) this block applies to. > > + */ > > +uint8_t field_mask; > > +uint8_t name[16]; > > +/** > > + * Left Top corner position. This can be outside of the vissible > > frame. > > + */ > > +int32_t x, y; > > +/** > > + * Width and height of the block. > > + */ > > +uint16_t w, h; > > +/** > > + * Number identifying the slice the Block is in. > > + */ > > +uint16_t slice_num; > > +/** > > + * Location in bits where the block related information is stored. > > can be -1 > > + */ > > +uint32_t block_index, block_bits; > > + > > +/** >
Re: [FFmpeg-devel] [PATCH] avutil: add API for mb types.
Le duodi 22 brumaire, an CCXXVI, Michael Niedermayer a écrit : > the codec id integer would make this depend on libavcodec ABI, > thats a problem Merge the libs and be done with it. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [DEVEL][PATCH v2] ffmpeg: fix channel_layout bug on non-default layout
Le 12/11/2017 à 5:38 PM, Michael Niedermayer a écrit : On Sun, Nov 12, 2017 at 05:07:04PM +0100, Kv Pham wrote: Le 12 nov. 2017 5:01 PM, "Michael Niedermayer" a écrit : On Sat, Nov 11, 2017 at 02:15:25AM +0100, pkv.stream wrote: Le 11/11/2017 à 1:07 AM, Michael Niedermayer a écrit : On Fri, Nov 10, 2017 at 10:27:48PM +0100, pkv.stream wrote: Le 10/11/2017 à 1:12 AM, Michael Niedermayer a écrit : On Thu, Nov 09, 2017 at 09:37:33PM +0100, pkv.stream wrote: Hi Michael, ffmpeg_opt.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) 2af07f4366efdfaf1018bb2ea29be672befe0823 0001-ffmpeg-fix-channel_ layout-bug-on-non-default-layout.patch From 4ec55dc88923108132307b41300a1abddf32e6f7 Mon Sep 17 00:00:00 2001 From: pkviet Date: Mon, 2 Oct 2017 11:14:31 +0200 Subject: [PATCH] ffmpeg: fix channel_layout bug on non-default layout Fix for ticket 6706. The -channel_layout option was not working when the channel layout was not a default one (ex: for 4 channels, quad was interpreted as 4.0 which is the default layout for 4 channels; or octagonal interpreted as 7.1). This led to the spurious auto-insertion of an auto-resampler filter remapping the channels even if input and output had identical channel layouts. The fix operates by directly calling the channel layout if defined in options. If the layout is undefined, the default layout is selected as before the fix. --- ffmpeg_opt.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 100fa76..cf5a63c 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -1804,6 +1804,12 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st); +AVDictionaryEntry *output_layout = av_dict_get(o->g->codec_opts, + "channel_layout", + NULL, AV_DICT_MATCH_CASE); This doesnt look right not an issue of the patch as such but why is the channel_layout option per file and not per stream? just my ignorance; do you mean this is not the right way to retrieve the channel_layout option from an audio stream ? I think there is more buggy with how the channel_layout is handled try this: ./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -channel_layout 5 test.wav and this: ./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -channel_layout:a 5 test.wav while it may appear that the are both working this is deceiving. I think only the channel number gets actually used in the 2nd case Look at what your code with av_dict_get() reads. It does not obtain the 5 in the 2nd case ok I fixed that by using the flag AV_DICT_IGNORE_SUFFIX ; now -channel_layout:a works as expected. I fixed also all the styling issues you spotted (mixed declarations, {} for if etc). Still not understanding your initial comment though : 'why is the channel_layout option per file and not per stream?' do you mean o->g->codec_opts is not where I should retrieve the channel_layout ? if not where from ? Thanks [...] ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ffmpeg_opt.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) 849898d28e989ffa5cc598c6fe4d43847b636132 0001-ffmpeg-fix-channel_ layout-bug-on-non-default-layout.patch From 6d4f1c14135f9473b77e1c649d0e7bbaeba00a50 Mon Sep 17 00:00:00 2001 From: pkviet Date: Mon, 2 Oct 2017 11:14:31 +0200 Subject: [PATCH] ffmpeg: fix channel_layout bug on non-default layout Fix for ticket 6706. The -channel_layout option was not working when the channel layout was not a default one (ex: for 4 channels, quad was interpreted as 4.0 which is the default layout for 4 channels; or octagonal interpreted as 7.1). This led to the spurious auto-insertion of an auto-resampler filter remapping the channels even if input and output had identical channel layouts. The fix operates by directly calling the channel layout if defined in options. If the layout is undefined, the default layout is selected as before the fix. --- fftools/ffmpeg_opt.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index ca6f10d..cb25d7b 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1785,6 +1785,7 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in AVStream *st; OutputStream *ost; AVCodecContext *audio_enc; +AVDictionaryEntry *output_layout; ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO, source_index); st = ost->st; @@ -1799,7 +1800,10 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in char *sample_fmt = NULL; MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st); - +output_layout = av_d
[FFmpeg-devel] [PATCH] avfilter/vf_*_qsv: Fix flags
Signed-off-by: Michael Niedermayer --- libavfilter/vf_overlay_qsv.c | 2 +- libavfilter/vf_vpp_qsv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_overlay_qsv.c b/libavfilter/vf_overlay_qsv.c index 471576e35a..1f50d4bb21 100644 --- a/libavfilter/vf_overlay_qsv.c +++ b/libavfilter/vf_overlay_qsv.c @@ -42,7 +42,7 @@ #define OVERLAY 1 #define OFFSET(x) offsetof(QSVOverlayContext, x) -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM +#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM) enum var_name { VAR_MAIN_iW, VAR_MW, diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 86af017d2e..eb2f1cc7eb 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -37,7 +37,7 @@ #include "qsvvpp.h" #define OFFSET(x) offsetof(VPPContext, x) -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM +#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM) /* number of video enhancement filters */ #define ENH_FILTERS_COUNT (5) -- 2.15.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil: add API for mb types.
On 12 November 2017 at 16:42, Michael Niedermayer wrote: > On Sun, Nov 12, 2017 at 04:21:15PM +, Rostislav Pehlivanov wrote: > > On 12 November 2017 at 15:59, Michael Niedermayer > > > wrote: > > > > > This is based on motion_type.h > > > > > > TODO: docs & split into a commit per lib > > > Signed-off-by: Michael Niedermayer > > > --- > > > libavcodec/avcodec.h | 4 ++ > > > libavcodec/options_table.h | 1 + > > > libavutil/block_type.h | 107 ++ > > > +++ > > > libavutil/frame.h | 14 ++ > > > 4 files changed, 126 insertions(+) > > > create mode 100644 libavutil/block_type.h > > > > > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > > > index 15ca871b59..1a49fa0a9a 100644 > > > --- a/libavcodec/avcodec.h > > > +++ b/libavcodec/avcodec.h > > > @@ -923,6 +923,10 @@ typedef struct RcOverride{ > > > * Show all frames before the first keyframe > > > */ > > > #define AV_CODEC_FLAG2_SHOW_ALL (1 << 22) > > > +/** > > > + * Export block types through frame side data > > > + */ > > > +#define AV_CODEC_FLAG2_EXPORT_BLOCKS (1 << 27) > > > /** > > > * Export motion vectors through frame side data > > > */ > > > diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h > > > index d89f58d540..0b86b4d0fb 100644 > > > --- a/libavcodec/options_table.h > > > +++ b/libavcodec/options_table.h > > > @@ -74,6 +74,7 @@ static const AVOption avcodec_options[] = { > > > {"chunks", "Frame data might be split into multiple chunks", 0, > > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_CHUNKS }, INT_MIN, INT_MAX, > V|D, > > > "flags2"}, > > > {"showall", "Show all frames before the first keyframe", 0, > > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SHOW_ALL }, INT_MIN, INT_MAX, > > > V|D, "flags2"}, > > > {"export_mvs", "export motion vectors through frame side data", 0, > > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, > INT_MAX, > > > V|D, "flags2"}, > > > +{"export_blocks", "export block types through frame side data", 0, > > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_BLOCKS}, INT_MIN, > INT_MAX, > > > V|D, "flags2"}, > > > {"skip_manual", "do not skip samples and export skip information as > frame > > > side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SKIP_MANUAL}, > > > INT_MIN, INT_MAX, V|D, "flags2"}, > > > {"ass_ro_flush_noop", "do not reset ASS ReadOrder field on flush", 0, > > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_RO_FLUSH_NOOP}, INT_MIN, > INT_MAX, > > > S|D, "flags2"}, > > > {"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = > 0}, > > > 0, INT_MAX}, > > > diff --git a/libavutil/block_type.h b/libavutil/block_type.h > > > new file mode 100644 > > > index 00..3f53f1d082 > > > --- /dev/null > > > +++ b/libavutil/block_type.h > > > @@ -0,0 +1,107 @@ > > > +/* > > > + * This file is part of FFmpeg. > > > + * > > > + * FFmpeg is free software; you can redistribute it and/or > > > + * modify it under the terms of the GNU Lesser General Public > > > + * License as published by the Free Software Foundation; either > > > + * version 2.1 of the License, or (at your option) any later version. > > > + * > > > + * FFmpeg is distributed in the hope that it will be useful, > > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > > + * Lesser General Public License for more details. > > > + * > > > + * You should have received a copy of the GNU Lesser General Public > > > + * License along with FFmpeg; if not, write to the Free Software > > > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > > > 02110-1301 USA > > > + */ > > > + > > > +#ifndef AVUTIL_BLOCK_TYPE_H > > > +#define AVUTIL_BLOCK_TYPE_H > > > + > > > +#include > > > + > > > + > > > +typedef struct AVBlockType { > > > +/** > > > + * Block type. > > > + * 1: Prediction (this can be spatial prediction or motion > > > compensation for example) > > > + * 2: Transform > > > + * 3: Residual > > > + * 4: Filter > > > + * 5: Metadata > > > + * > > > + * Multiple Filter, Transform and prediction blocks are allowed, > for > > > example > > > + * for bidirectional motion compensation. Multiple residuals are > > > allowed, for > > > + * example DC and AC residual. > > > + */ > > > +uint8_t type; > > > +/** > > > + * Bitmask that lists which planes (for example: > > > Y:1,Cb:2,Cr:4,Alpha:8) > > > + * this block applies to. > > > + */ > > > +uint8_t plane_mask; > > > +/** > > > + * The field (top:1, bottom:2) this block applies to. > > > + */ > > > +uint8_t field_mask; > > > +uint8_t name[16]; > > > +/** > > > + * Left Top corner position. This can be outside of the vissible > > > frame. > > > + */ > > > +int32_t x, y; > > > +/** > > > + * Width and height of the block. > > > +
[FFmpeg-devel] [DEVEL][PATCH v3] ffmpeg: fix channel_layout bug on non-default layout
Le 12/11/2017 à 5:38 PM, Michael Niedermayer a écrit : On Sun, Nov 12, 2017 at 05:07:04PM +0100, Kv Pham wrote: Le 12 nov. 2017 5:01 PM, "Michael Niedermayer" a écrit : On Sat, Nov 11, 2017 at 02:15:25AM +0100, pkv.stream wrote: Le 11/11/2017 à 1:07 AM, Michael Niedermayer a écrit : On Fri, Nov 10, 2017 at 10:27:48PM +0100, pkv.stream wrote: Le 10/11/2017 à 1:12 AM, Michael Niedermayer a écrit : On Thu, Nov 09, 2017 at 09:37:33PM +0100, pkv.stream wrote: Hi Michael, ffmpeg_opt.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) 2af07f4366efdfaf1018bb2ea29be672befe0823 0001-ffmpeg-fix-channel_ layout-bug-on-non-default-layout.patch From 4ec55dc88923108132307b41300a1abddf32e6f7 Mon Sep 17 00:00:00 2001 From: pkviet Date: Mon, 2 Oct 2017 11:14:31 +0200 Subject: [PATCH] ffmpeg: fix channel_layout bug on non-default layout Fix for ticket 6706. The -channel_layout option was not working when the channel layout was not a default one (ex: for 4 channels, quad was interpreted as 4.0 which is the default layout for 4 channels; or octagonal interpreted as 7.1). This led to the spurious auto-insertion of an auto-resampler filter remapping the channels even if input and output had identical channel layouts. The fix operates by directly calling the channel layout if defined in options. If the layout is undefined, the default layout is selected as before the fix. --- ffmpeg_opt.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 100fa76..cf5a63c 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -1804,6 +1804,12 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st); +AVDictionaryEntry *output_layout = av_dict_get(o->g->codec_opts, + "channel_layout", + NULL, AV_DICT_MATCH_CASE); This doesnt look right not an issue of the patch as such but why is the channel_layout option per file and not per stream? just my ignorance; do you mean this is not the right way to retrieve the channel_layout option from an audio stream ? I think there is more buggy with how the channel_layout is handled try this: ./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -channel_layout 5 test.wav and this: ./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -channel_layout:a 5 test.wav while it may appear that the are both working this is deceiving. I think only the channel number gets actually used in the 2nd case Look at what your code with av_dict_get() reads. It does not obtain the 5 in the 2nd case ok I fixed that by using the flag AV_DICT_IGNORE_SUFFIX ; now -channel_layout:a works as expected. I fixed also all the styling issues you spotted (mixed declarations, {} for if etc). Still not understanding your initial comment though : 'why is the channel_layout option per file and not per stream?' do you mean o->g->codec_opts is not where I should retrieve the channel_layout ? if not where from ? Thanks [...] ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ffmpeg_opt.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) 849898d28e989ffa5cc598c6fe4d43847b636132 0001-ffmpeg-fix-channel_ layout-bug-on-non-default-layout.patch From 6d4f1c14135f9473b77e1c649d0e7bbaeba00a50 Mon Sep 17 00:00:00 2001 From: pkviet Date: Mon, 2 Oct 2017 11:14:31 +0200 Subject: [PATCH] ffmpeg: fix channel_layout bug on non-default layout Fix for ticket 6706. The -channel_layout option was not working when the channel layout was not a default one (ex: for 4 channels, quad was interpreted as 4.0 which is the default layout for 4 channels; or octagonal interpreted as 7.1). This led to the spurious auto-insertion of an auto-resampler filter remapping the channels even if input and output had identical channel layouts. The fix operates by directly calling the channel layout if defined in options. If the layout is undefined, the default layout is selected as before the fix. --- fftools/ffmpeg_opt.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index ca6f10d..cb25d7b 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1785,6 +1785,7 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in AVStream *st; OutputStream *ost; AVCodecContext *audio_enc; +AVDictionaryEntry *output_layout; ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO, source_index); st = ost->st; @@ -1799,7 +1800,10 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in char *sample_fmt = NULL; MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st); - +output_layout = av_d
Re: [FFmpeg-devel] [PATCH] avfilter/vf_*_qsv: Fix flags
On 12/11/17 17:08, Michael Niedermayer wrote: > Signed-off-by: Michael Niedermayer > --- > libavfilter/vf_overlay_qsv.c | 2 +- > libavfilter/vf_vpp_qsv.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavfilter/vf_overlay_qsv.c b/libavfilter/vf_overlay_qsv.c > index 471576e35a..1f50d4bb21 100644 > --- a/libavfilter/vf_overlay_qsv.c > +++ b/libavfilter/vf_overlay_qsv.c > @@ -42,7 +42,7 @@ > #define OVERLAY 1 > > #define OFFSET(x) offsetof(QSVOverlayContext, x) > -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM > +#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM) > > enum var_name { > VAR_MAIN_iW, VAR_MW, > diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c > index 86af017d2e..eb2f1cc7eb 100644 > --- a/libavfilter/vf_vpp_qsv.c > +++ b/libavfilter/vf_vpp_qsv.c > @@ -37,7 +37,7 @@ > #include "qsvvpp.h" > > #define OFFSET(x) offsetof(VPPContext, x) > -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM > +#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM) > > /* number of video enhancement filters */ > #define ENH_FILTERS_COUNT (5) > LGTM. Thanks, - Mark ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil: add API for mb types.
Hi, On Sun, Nov 12, 2017 at 11:42 AM, Michael Niedermayer < mich...@niedermayer.cc> wrote: > On Sun, Nov 12, 2017 at 04:21:15PM +, Rostislav Pehlivanov wrote: > > On 12 November 2017 at 15:59, Michael Niedermayer > > > wrote: > > > > > This is based on motion_type.h > > > > > > TODO: docs & split into a commit per lib > > > Signed-off-by: Michael Niedermayer > > > --- > > > libavcodec/avcodec.h | 4 ++ > > > libavcodec/options_table.h | 1 + > > > libavutil/block_type.h | 107 ++ > > > +++ > > > libavutil/frame.h | 14 ++ > > > 4 files changed, 126 insertions(+) > > > create mode 100644 libavutil/block_type.h > > > > > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > > > index 15ca871b59..1a49fa0a9a 100644 > > > --- a/libavcodec/avcodec.h > > > +++ b/libavcodec/avcodec.h > > > @@ -923,6 +923,10 @@ typedef struct RcOverride{ > > > * Show all frames before the first keyframe > > > */ > > > #define AV_CODEC_FLAG2_SHOW_ALL (1 << 22) > > > +/** > > > + * Export block types through frame side data > > > + */ > > > +#define AV_CODEC_FLAG2_EXPORT_BLOCKS (1 << 27) > > > /** > > > * Export motion vectors through frame side data > > > */ > > > diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h > > > index d89f58d540..0b86b4d0fb 100644 > > > --- a/libavcodec/options_table.h > > > +++ b/libavcodec/options_table.h > > > @@ -74,6 +74,7 @@ static const AVOption avcodec_options[] = { > > > {"chunks", "Frame data might be split into multiple chunks", 0, > > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_CHUNKS }, INT_MIN, INT_MAX, > V|D, > > > "flags2"}, > > > {"showall", "Show all frames before the first keyframe", 0, > > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SHOW_ALL }, INT_MIN, INT_MAX, > > > V|D, "flags2"}, > > > {"export_mvs", "export motion vectors through frame side data", 0, > > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, > INT_MAX, > > > V|D, "flags2"}, > > > +{"export_blocks", "export block types through frame side data", 0, > > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_BLOCKS}, INT_MIN, > INT_MAX, > > > V|D, "flags2"}, > > > {"skip_manual", "do not skip samples and export skip information as > frame > > > side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SKIP_MANUAL}, > > > INT_MIN, INT_MAX, V|D, "flags2"}, > > > {"ass_ro_flush_noop", "do not reset ASS ReadOrder field on flush", 0, > > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_RO_FLUSH_NOOP}, INT_MIN, > INT_MAX, > > > S|D, "flags2"}, > > > {"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = > 0}, > > > 0, INT_MAX}, > > > diff --git a/libavutil/block_type.h b/libavutil/block_type.h > > > new file mode 100644 > > > index 00..3f53f1d082 > > > --- /dev/null > > > +++ b/libavutil/block_type.h > > > @@ -0,0 +1,107 @@ > > > +/* > > > + * This file is part of FFmpeg. > > > + * > > > + * FFmpeg is free software; you can redistribute it and/or > > > + * modify it under the terms of the GNU Lesser General Public > > > + * License as published by the Free Software Foundation; either > > > + * version 2.1 of the License, or (at your option) any later version. > > > + * > > > + * FFmpeg is distributed in the hope that it will be useful, > > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > > + * Lesser General Public License for more details. > > > + * > > > + * You should have received a copy of the GNU Lesser General Public > > > + * License along with FFmpeg; if not, write to the Free Software > > > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > > > 02110-1301 USA > > > + */ > > > + > > > +#ifndef AVUTIL_BLOCK_TYPE_H > > > +#define AVUTIL_BLOCK_TYPE_H > > > + > > > +#include > > > + > > > + > > > +typedef struct AVBlockType { > > > +/** > > > + * Block type. > > > + * 1: Prediction (this can be spatial prediction or motion > > > compensation for example) > > > + * 2: Transform > > > + * 3: Residual > > > + * 4: Filter > > > + * 5: Metadata > > > + * > > > + * Multiple Filter, Transform and prediction blocks are allowed, > for > > > example > > > + * for bidirectional motion compensation. Multiple residuals are > > > allowed, for > > > + * example DC and AC residual. > > > + */ > > > +uint8_t type; > > > +/** > > > + * Bitmask that lists which planes (for example: > > > Y:1,Cb:2,Cr:4,Alpha:8) > > > + * this block applies to. > > > + */ > > > +uint8_t plane_mask; > > > +/** > > > + * The field (top:1, bottom:2) this block applies to. > > > + */ > > > +uint8_t field_mask; > > > +uint8_t name[16]; > > > +/** > > > + * Left Top corner position. This can be outside of the vissible > > > frame. > > > + */ > > > +int32_t x, y; > > > +/** > > > + * Width
Re: [FFmpeg-devel] Added HW H.264 and HEVC encoding for AMD GPUs based on AMF SDK
On 05/11/17 03:49, Mikhail Mironov wrote: > From fc6a3f63eb9c3734f4101cee2a2f5707e063ab62 Mon Sep 17 00:00:00 2001 > From: mmironov > Date: Fri, 27 Oct 2017 13:03:15 -0400 > Subject: [PATCH] Added: HW accelerated H.264 and HEVC encoding for AMD GPUs > based on AMF SDK > > Signed-off-by: mmironov > --- > Changelog|3 +- > compat/amd/amfsdkenc.h | 1753 > ++ > configure| 25 + > libavcodec/Makefile |4 + > libavcodec/allcodecs.c |2 + > libavcodec/amfenc.c | 515 ++ > libavcodec/amfenc.h | 137 > libavcodec/amfenc_h264.c | 366 ++ > libavcodec/amfenc_hevc.c | 294 > libavcodec/version.h |4 +- > 10 files changed, 3100 insertions(+), 3 deletions(-) > create mode 100644 compat/amd/amfsdkenc.h > create mode 100644 libavcodec/amfenc.c > create mode 100644 libavcodec/amfenc.h > create mode 100644 libavcodec/amfenc_h264.c > create mode 100644 libavcodec/amfenc_hevc.c > > ... > diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c > new file mode 100644 > index 000..fcfbd20 > --- /dev/null > +++ b/libavcodec/amfenc.c > ... > + > +static int amf_init_context(AVCodecContext *avctx) > +{ > +AmfContext *ctx = avctx->priv_data; > +AMF_RESULT res = AMF_OK; > + > +// confugure AMF logger > +// the return of these functions indicates old state and do not affect > behaviour > +ctx->trace->pVtbl->EnableWriter(ctx->trace, > AMF_TRACE_WRITER_DEBUG_OUTPUT, ctx->log_to_dbg != 0 ); > +if (ctx->log_to_dbg) > +ctx->trace->pVtbl->SetWriterLevel(ctx->trace, > AMF_TRACE_WRITER_DEBUG_OUTPUT, AMF_TRACE_TRACE); > +ctx->trace->pVtbl->EnableWriter(ctx->trace, AMF_TRACE_WRITER_CONSOLE, 0); > +ctx->trace->pVtbl->SetGlobalLevel(ctx->trace, AMF_TRACE_TRACE); > + > +// connect AMF logger to av_log > +ctx->tracer.vtbl = &tracer_vtbl; > +ctx->tracer.avctx = avctx; > +ctx->trace->pVtbl->RegisterWriter(ctx->trace, > FFMPEG_AMF_WRITER_ID,(AMFTraceWriter*)&ctx->tracer, 1); > +ctx->trace->pVtbl->SetWriterLevel(ctx->trace, FFMPEG_AMF_WRITER_ID, > AMF_TRACE_TRACE); > + > +res = ctx->factory->pVtbl->CreateContext(ctx->factory, &ctx->context); > +AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR_UNKNOWN, > "CreateContext() failed with error %d\n", res); > +// try to reuse existing DX device > +if (avctx->hw_frames_ctx) { > +AVHWFramesContext *device_ctx = > (AVHWFramesContext*)avctx->hw_frames_ctx->data; > +if (device_ctx->device_ctx->type == AV_HWDEVICE_TYPE_D3D11VA){ > +if (amf_av_to_amf_format(device_ctx->sw_format) == > AMF_SURFACE_UNKNOWN) { This test is inverted. Have you actually tested this path? Even with that test fixed, I'm unable to pass the following initialisation test with an AMD D3D11 device. > +if (device_ctx->device_ctx->hwctx) { > +AVD3D11VADeviceContext *device_d3d11 = > (AVD3D11VADeviceContext *)device_ctx->device_ctx->hwctx; > +res = ctx->context->pVtbl->InitDX11(ctx->context, > device_d3d11->device, AMF_DX11_1); > +if (res == AMF_OK) { > +ctx->hw_frames_ctx = > av_buffer_ref(avctx->hw_frames_ctx); > +}else { > +av_log(avctx, AV_LOG_INFO, "amf_shared: > avctx->hw_frames_ctx has non-AMD device, switching to default\n"); > +} > +} > +}else { > +av_log(avctx, AV_LOG_INFO, "amf_shared: avctx->hw_frames_ctx > has format not uspported by AMF, switching to default\n"); > +} > +} > +} else if (avctx->hw_device_ctx) { > +AVHWDeviceContext *device_ctx = > (AVHWDeviceContext*)(avctx->hw_device_ctx->data); > +if (device_ctx->type == AV_HWDEVICE_TYPE_D3D11VA) { > +if (device_ctx->hwctx) { > +AVD3D11VADeviceContext *device_d3d11 = > (AVD3D11VADeviceContext *)device_ctx->hwctx; > +res = ctx->context->pVtbl->InitDX11(ctx->context, > device_d3d11->device, AMF_DX11_1); > +if (res == AMF_OK) { > +ctx->hw_device_ctx = av_buffer_ref(avctx->hw_device_ctx); > +} else { > +av_log(avctx, AV_LOG_INFO, "amf_shared: > avctx->hw_device_ctx has non-AMD device, switching to default\n"); > +} > +} > +} > +} > +if (!ctx->hw_frames_ctx && !ctx->hw_device_ctx) { > +res = ctx->context->pVtbl->InitDX11(ctx->context, NULL, AMF_DX11_1); > +if (res != AMF_OK) { > +res = ctx->context->pVtbl->InitDX9(ctx->context, NULL); > +AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR_UNKNOWN, > "InitDX9() failed with error %d\n", res); > +} > +} > +return 0; > +} > + > +static int amf_init_encoder(AVCodecContext *avctx) > +{
[FFmpeg-devel] [PATCH v2 2/2] avcodec/videotoolboxenc: re-indent code
From: Aman Gupta Cosmetic change only. --- libavcodec/videotoolboxenc.c | 158 +-- 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 5f6a382672..b1495bd6b4 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -407,11 +407,11 @@ static int get_params_size( size_t i; int status; status = vtctx->get_param_set_func(vid_fmt, -0, -NULL, -NULL, -&ps_count, -NULL); + 0, + NULL, + NULL, + &ps_count, + NULL); if (status) { is_count_bad = 1; ps_count = 0; @@ -422,11 +422,11 @@ static int get_params_size( const uint8_t *ps; size_t ps_size; status = vtctx->get_param_set_func(vid_fmt, -i, -&ps, -&ps_size, -NULL, -NULL); + i, + &ps, + &ps_size, + NULL, + NULL); if (status) { /* * When ps_count is invalid, status != 0 ends the loop normally @@ -463,11 +463,11 @@ static int copy_param_sets( size_t i; status = vtctx->get_param_set_func(vid_fmt, -0, -NULL, -NULL, -&ps_count, -NULL); + 0, + NULL, + NULL, + &ps_count, + NULL); if (status) { is_count_bad = 1; ps_count = 0; @@ -481,11 +481,11 @@ static int copy_param_sets( size_t next_offset; status = vtctx->get_param_set_func(vid_fmt, -i, -&ps, -&ps_size, -NULL, -NULL); + i, + &ps, + &ps_size, + NULL, + NULL); if (status) { if (i > 0 && is_count_bad) status = 0; @@ -597,11 +597,11 @@ static int get_length_code_size( } status = vtctx->get_param_set_func(vid_fmt, -0, -NULL, -NULL, -NULL, -&isize); + 0, + NULL, + NULL, + NULL, + &isize); if (status) { av_log(avctx, AV_LOG_ERROR, "Error getting length code size: %d\n", status); return AVERROR_EXTERNAL; @@ -1018,55 +1018,55 @@ static int vtenc_create_encoder(AVCodecContext *avctx, } if (vtctx->codec_id == AV_CODEC_ID_H264) { -// kVTCompressionPropertyKey_DataRateLimits is not available for HEVC -bytes_per_second_value = max_rate >> 3; -bytes_per_second = CFNumberCreate(kCFAllocatorDefault, - kCFNumberSInt64Type, - &bytes_per_second_value); -if (!bytes_per_second) { -return AVER
Re: [FFmpeg-devel] [PATCH] videotoolbox: add frame_params support
On Sat, Nov 11, 2017 at 9:02 PM, James Almer wrote: > From: wm4 > > Allows decoding with API users which require this API. > --- > libavcodec/videotoolbox.c | 19 +++ > 1 file changed, 19 insertions(+) > > diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c > index ecb2502c1f..f0790e7353 100644 > --- a/libavcodec/videotoolbox.c > +++ b/libavcodec/videotoolbox.c > @@ -947,6 +947,19 @@ fail: > return err; > } > > +static int videotoolbox_frame_params(AVCodecContext *avctx, > + AVBufferRef *hw_frames_ctx) > +{ > +AVHWFramesContext *frames_ctx = (AVHWFramesContext*)hw_frames_ > ctx->data; > + > +frames_ctx->format= AV_PIX_FMT_VIDEOTOOLBOX; > +frames_ctx->width = avctx->coded_width; > +frames_ctx->height= avctx->coded_height; > +frames_ctx->sw_format = AV_PIX_FMT_NV12; > + > +return 0; > +} > + > AVHWAccel ff_h263_videotoolbox_hwaccel = { > .name = "h263_videotoolbox", > .type = AVMEDIA_TYPE_VIDEO, > @@ -956,6 +969,7 @@ AVHWAccel ff_h263_videotoolbox_hwaccel = { > .start_frame= videotoolbox_mpeg_start_frame, > .decode_slice = videotoolbox_mpeg_decode_slice, > .end_frame = videotoolbox_mpeg_end_frame, > +.frame_params = videotoolbox_frame_params, > .init = videotoolbox_common_init, > .uninit = videotoolbox_uninit, > .priv_data_size = sizeof(VTContext), > @@ -970,6 +984,7 @@ AVHWAccel ff_hevc_videotoolbox_hwaccel = { > .start_frame= ff_videotoolbox_h264_start_frame, > .decode_slice = ff_videotoolbox_h264_decode_slice, > .end_frame = videotoolbox_hevc_end_frame, > +.frame_params = videotoolbox_frame_params, > .init = videotoolbox_common_init, > .uninit = ff_videotoolbox_uninit, > .priv_data_size = sizeof(VTContext), > @@ -984,6 +999,7 @@ AVHWAccel ff_h264_videotoolbox_hwaccel = { > .start_frame= ff_videotoolbox_h264_start_frame, > .decode_slice = ff_videotoolbox_h264_decode_slice, > .end_frame = videotoolbox_h264_end_frame, > +.frame_params = videotoolbox_frame_params, > .init = videotoolbox_common_init, > .uninit = videotoolbox_uninit, > .priv_data_size = sizeof(VTContext), > @@ -998,6 +1014,7 @@ AVHWAccel ff_mpeg1_videotoolbox_hwaccel = { > .start_frame= videotoolbox_mpeg_start_frame, > .decode_slice = videotoolbox_mpeg_decode_slice, > .end_frame = videotoolbox_mpeg_end_frame, > +.frame_params = videotoolbox_frame_params, > .init = videotoolbox_common_init, > .uninit = videotoolbox_uninit, > .priv_data_size = sizeof(VTContext), > @@ -1012,6 +1029,7 @@ AVHWAccel ff_mpeg2_videotoolbox_hwaccel = { > .start_frame= videotoolbox_mpeg_start_frame, > .decode_slice = videotoolbox_mpeg_decode_slice, > .end_frame = videotoolbox_mpeg_end_frame, > +.frame_params = videotoolbox_frame_params, > .init = videotoolbox_common_init, > .uninit = videotoolbox_uninit, > .priv_data_size = sizeof(VTContext), > @@ -1026,6 +1044,7 @@ AVHWAccel ff_mpeg4_videotoolbox_hwaccel = { > .start_frame= videotoolbox_mpeg_start_frame, > .decode_slice = videotoolbox_mpeg_decode_slice, > .end_frame = videotoolbox_mpeg_end_frame, > +.frame_params = videotoolbox_frame_params, > .init = videotoolbox_common_init, > .uninit = videotoolbox_uninit, > .priv_data_size = sizeof(VTContext), > LGTM > -- > 2.14.2 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 1/2] avcodec/videotoolboxenc: add hevc_videotoolbox encoder
From: Aman Gupta --- configure| 2 + libavcodec/allcodecs.c | 1 + libavcodec/videotoolboxenc.c | 153 +++ 3 files changed, 143 insertions(+), 13 deletions(-) diff --git a/configure b/configure index 2cf18ecc12..39b9d4cb0c 100755 --- a/configure +++ b/configure @@ -2928,6 +2928,8 @@ pcm_mulaw_at_encoder_select="audio_frame_queue" chromaprint_muxer_deps="chromaprint" h264_videotoolbox_encoder_deps="pthreads" h264_videotoolbox_encoder_select="videotoolbox_encoder" +hevc_videotoolbox_encoder_deps="pthreads" +hevc_videotoolbox_encoder_select="videotoolbox_encoder" libcelt_decoder_deps="libcelt" libfdk_aac_decoder_deps="libfdk_aac" libfdk_aac_encoder_deps="libfdk_aac" diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index c817003693..d8be53a52a 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -670,6 +670,7 @@ static void register_all(void) REGISTER_ENCODER(HEVC_QSV, hevc_qsv); REGISTER_ENCODER(HEVC_V4L2M2M, hevc_v4l2m2m); REGISTER_ENCODER(HEVC_VAAPI,hevc_vaapi); +REGISTER_ENCODER(HEVC_VIDEOTOOLBOX, hevc_videotoolbox); REGISTER_ENCODER(LIBKVAZAAR,libkvazaar); REGISTER_DECODER(MJPEG_CUVID, mjpeg_cuvid); REGISTER_ENCODER(MJPEG_QSV, mjpeg_qsv); diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index eba6cc672f..5f6a382672 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -35,6 +35,17 @@ #include "h264_sei.h" #include +#if !HAVE_KCMVIDEOCODECTYPE_HEVC +enum { kCMVideoCodecType_HEVC = 'hvc1' }; +#endif + +typedef OSStatus (*getParameterSetAtIndex)(CMFormatDescriptionRef videoDesc, + size_t parameterSetIndex, + const uint8_t * _Nullable *parameterSetPointerOut, + size_t *parameterSetSizeOut, + size_t *parameterSetCountOut, + int *NALUnitHeaderLengthOut); + //These symbols may not be present static struct{ CFStringRef kCVImageBufferColorPrimaries_ITU_R_2020; @@ -65,10 +76,15 @@ static struct{ CFStringRef kVTProfileLevel_H264_High_5_2; CFStringRef kVTProfileLevel_H264_High_AutoLevel; +CFStringRef kVTProfileLevel_HEVC_Main_AutoLevel; +CFStringRef kVTProfileLevel_HEVC_Main10_AutoLevel; + CFStringRef kVTCompressionPropertyKey_RealTime; CFStringRef kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder; CFStringRef kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder; + +getParameterSetAtIndex CMVideoFormatDescriptionGetHEVCParameterSetAtIndex; } compat_keys; #define GET_SYM(symbol, defaultVal) \ @@ -83,6 +99,12 @@ do{ \ static pthread_once_t once_ctrl = PTHREAD_ONCE_INIT; static void loadVTEncSymbols(){ +compat_keys.CMVideoFormatDescriptionGetHEVCParameterSetAtIndex = +(getParameterSetAtIndex)dlsym( +RTLD_DEFAULT, +"CMVideoFormatDescriptionGetHEVCParameterSetAtIndex" +); + GET_SYM(kCVImageBufferColorPrimaries_ITU_R_2020, "ITU_R_2020"); GET_SYM(kCVImageBufferTransferFunction_ITU_R_2020, "ITU_R_2020"); GET_SYM(kCVImageBufferYCbCrMatrix_ITU_R_2020, "ITU_R_2020"); @@ -111,6 +133,9 @@ static void loadVTEncSymbols(){ GET_SYM(kVTProfileLevel_H264_High_5_2, "H264_High_5_2"); GET_SYM(kVTProfileLevel_H264_High_AutoLevel, "H264_High_AutoLevel"); +GET_SYM(kVTProfileLevel_HEVC_Main_AutoLevel, "HEVC_Main_AutoLevel"); +GET_SYM(kVTProfileLevel_HEVC_Main10_AutoLevel, "HEVC_Main10_AutoLevel"); + GET_SYM(kVTCompressionPropertyKey_RealTime, "RealTime"); GET_SYM(kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder, @@ -133,6 +158,13 @@ typedef enum VTH264Entropy{ VT_CABAC } VTH264Entropy; +typedef enum VT_HEVCProfile { +HEVC_PROF_AUTO, +HEVC_PROF_MAIN, +HEVC_PROF_MAIN10, +HEVC_PROF_COUNT +} VT_HEVCProfile; + static const uint8_t start_code[] = { 0, 0, 0, 1 }; typedef struct ExtraSEI { @@ -149,10 +181,12 @@ typedef struct BufNode { typedef struct VTEncContext { AVClass *class; +enum AVCodecID codec_id; VTCompressionSessionRef session; CFStringRef ycbcr_matrix; CFStringRef color_primaries; CFStringRef transfer_function; +getParameterSetAtIndex get_param_set_func; pthread_mutex_t lock; pthread_cond_t cv_sample_sent; @@ -348,6 +382,7 @@ static CMVideoCodecType get_cm_codec_type(enum AVCodecID id) { switch (id) { case AV_CODEC_ID_H264: return kCMVideoCodecType_H264; +case AV_CODEC_ID_HEVC: return kCMVideoCodecType_HEVC; default: return 0; } } @@ -365,12 +400,13 @@ stat
Re: [FFmpeg-devel] libavcodec/als: remove check for predictor order of a block
Hi, On Sat, Nov 4, 2017 at 3:11 AM, Thilo Borgmann wrote: > Am 03.11.17 um 21:13 schrieb Paul B Mahol: >> On 11/3/17, Thilo Borgmann wrote: >>> Am 02.11.17 um 21:32 schrieb Umair Khan: Hi, On Fri, Oct 20, 2017 at 1:44 AM, Ronald S. Bultje wrote: > > Hi, > > On Thu, Oct 19, 2017 at 4:03 PM, Umair Khan wrote: > >> I tried decoding the file in both the cases and I don't see any >> address related error in the console while decoding. Following is the >> output after I apply the patch :- >> > [..] > >> Is there something which I'm missing? >> > > You need to run under valgrind or compile with address sanitizer support: > configure --toolchain=gcc-asan or --toolchain=clang-asan, depending on > the > name of clang on your system. Thanks for the help. I was finally able to reproduce the error. I have been trying to debug this heap-buffer-overflow error for some days. I have finally found the source of the issue at least. https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/alsdec.c#L934 raw_samples pointer is overflowing inside that loop. I haven't thought of a proper fix for this yet. I'll look at the documentation to understand the logic first. However, in case someone (Thilo?) already has some idea on fixing it, that'd be great. >>> >>> I don't remember exactly but you will need to figure out what the actual >>> limit is for opt_order. >>> >>> If I could give a closer hint, this bug would have been fixed a long time >>> ago... >>> >>> You could have a look at the reference codec code and look where they limit >>> that opt_order/buffer size. >> >> There are already patches by Michael and me which deals with this bug. >> Which you do not want to apply and without real proof. > > Yes and no. If you search some more in the archives, you'll also find > http://ffmpeg.org/pipermail/ffmpeg-devel/2016-November/202513.html > > The idea of Michael and you that you are referring to, is basically to double > a part of buffer size calculation to be "more" failsafe. However, especially > if Umair wants to dig in now, we should better solve the root of the issue > and find the actual required buffer size instead of guessing, don't we? > > We cannot accept the removal of the predictor order check alltogether because > of the fuzzed file we have. This is what I vetoed in the past (IIRC) and has > been suggested by myself, Umair and I think Paul, too. > Wrong? > > What we could do and I would not veto on, would be to have a bigger buffer > like Michael's in > http://ffmpeg.org/pipermail/ffmpeg-devel/2016-June/195113.html > However, this should be tested again and should get a comment in the code > because that buffer size is not reflected in the spec as far as I can tell. > Also, this would not actually remove that bug from my own list about ALS. > That might be fine with you but not the way I think we should proceed. I'd > rather love to see Umair fixing it correctly. The attached patch fixes the address sanitizer issue. This check is also present in the spec PDF(the one Thilo sent me) on page 30. -Umair 0001-libavcodec-als-fix-address-sanitization-error-in-dec.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] videotoolbox: add frame_params support
On 11/12/2017 3:25 PM, Aman Gupta wrote: > On Sat, Nov 11, 2017 at 9:02 PM, James Almer wrote: > >> From: wm4 >> >> Allows decoding with API users which require this API. >> --- >> libavcodec/videotoolbox.c | 19 +++ >> 1 file changed, 19 insertions(+) >> >> diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c >> index ecb2502c1f..f0790e7353 100644 >> --- a/libavcodec/videotoolbox.c >> +++ b/libavcodec/videotoolbox.c >> @@ -947,6 +947,19 @@ fail: >> return err; >> } >> >> +static int videotoolbox_frame_params(AVCodecContext *avctx, >> + AVBufferRef *hw_frames_ctx) >> +{ >> +AVHWFramesContext *frames_ctx = (AVHWFramesContext*)hw_frames_ >> ctx->data; >> + >> +frames_ctx->format= AV_PIX_FMT_VIDEOTOOLBOX; >> +frames_ctx->width = avctx->coded_width; >> +frames_ctx->height= avctx->coded_height; >> +frames_ctx->sw_format = AV_PIX_FMT_NV12; >> + >> +return 0; >> +} >> + >> AVHWAccel ff_h263_videotoolbox_hwaccel = { >> .name = "h263_videotoolbox", >> .type = AVMEDIA_TYPE_VIDEO, >> @@ -956,6 +969,7 @@ AVHWAccel ff_h263_videotoolbox_hwaccel = { >> .start_frame= videotoolbox_mpeg_start_frame, >> .decode_slice = videotoolbox_mpeg_decode_slice, >> .end_frame = videotoolbox_mpeg_end_frame, >> +.frame_params = videotoolbox_frame_params, >> .init = videotoolbox_common_init, >> .uninit = videotoolbox_uninit, >> .priv_data_size = sizeof(VTContext), >> @@ -970,6 +984,7 @@ AVHWAccel ff_hevc_videotoolbox_hwaccel = { >> .start_frame= ff_videotoolbox_h264_start_frame, >> .decode_slice = ff_videotoolbox_h264_decode_slice, >> .end_frame = videotoolbox_hevc_end_frame, >> +.frame_params = videotoolbox_frame_params, >> .init = videotoolbox_common_init, >> .uninit = ff_videotoolbox_uninit, >> .priv_data_size = sizeof(VTContext), >> @@ -984,6 +999,7 @@ AVHWAccel ff_h264_videotoolbox_hwaccel = { >> .start_frame= ff_videotoolbox_h264_start_frame, >> .decode_slice = ff_videotoolbox_h264_decode_slice, >> .end_frame = videotoolbox_h264_end_frame, >> +.frame_params = videotoolbox_frame_params, >> .init = videotoolbox_common_init, >> .uninit = videotoolbox_uninit, >> .priv_data_size = sizeof(VTContext), >> @@ -998,6 +1014,7 @@ AVHWAccel ff_mpeg1_videotoolbox_hwaccel = { >> .start_frame= videotoolbox_mpeg_start_frame, >> .decode_slice = videotoolbox_mpeg_decode_slice, >> .end_frame = videotoolbox_mpeg_end_frame, >> +.frame_params = videotoolbox_frame_params, >> .init = videotoolbox_common_init, >> .uninit = videotoolbox_uninit, >> .priv_data_size = sizeof(VTContext), >> @@ -1012,6 +1029,7 @@ AVHWAccel ff_mpeg2_videotoolbox_hwaccel = { >> .start_frame= videotoolbox_mpeg_start_frame, >> .decode_slice = videotoolbox_mpeg_decode_slice, >> .end_frame = videotoolbox_mpeg_end_frame, >> +.frame_params = videotoolbox_frame_params, >> .init = videotoolbox_common_init, >> .uninit = videotoolbox_uninit, >> .priv_data_size = sizeof(VTContext), >> @@ -1026,6 +1044,7 @@ AVHWAccel ff_mpeg4_videotoolbox_hwaccel = { >> .start_frame= videotoolbox_mpeg_start_frame, >> .decode_slice = videotoolbox_mpeg_decode_slice, >> .end_frame = videotoolbox_mpeg_end_frame, >> +.frame_params = videotoolbox_frame_params, >> .init = videotoolbox_common_init, >> .uninit = videotoolbox_uninit, >> .priv_data_size = sizeof(VTContext), >> > > LGTM > Pushed, thanks ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] libavcodec/als: remove check for predictor order of a block
2017-11-12 20:05 GMT+01:00 Umair Khan : > The attached patch fixes the address sanitizer issue. Breaks compilation here, how did you test? libavcodec/alsdec.c: In function ‘decode_var_block_data’: libavcodec/alsdec.c:938:7: error: expected ‘}’ before ‘else’ Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avfilter/vf_threshold: add x86 SIMD
Signed-off-by: Paul B Mahol --- libavfilter/threshold.h | 51 +++ libavfilter/vf_threshold.c | 32 + libavfilter/x86/Makefile| 2 ++ libavfilter/x86/vf_threshold.asm| 69 + libavfilter/x86/vf_threshold_init.c | 41 ++ 5 files changed, 171 insertions(+), 24 deletions(-) create mode 100644 libavfilter/threshold.h create mode 100644 libavfilter/x86/vf_threshold.asm create mode 100644 libavfilter/x86/vf_threshold_init.c diff --git a/libavfilter/threshold.h b/libavfilter/threshold.h new file mode 100644 index 00..8b55ad6ba1 --- /dev/null +++ b/libavfilter/threshold.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2016 Paul B Mahol + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_THRESHOLD_H +#define AVFILTER_THRESHOLD_H + +#include "avfilter.h" +#include "framesync.h" + +typedef struct ThresholdContext { +const AVClass *class; + +int depth; +int planes; +int bpc; + +int nb_planes; +int width[4], height[4]; + +void (*threshold)(const uint8_t *in, const uint8_t *threshold, + const uint8_t *min, const uint8_t *max, + uint8_t *out, + ptrdiff_t ilinesize, ptrdiff_t tlinesize, + ptrdiff_t flinesize, ptrdiff_t slinesize, + ptrdiff_t olinesize, + int w, int h); + +AVFrame *frames[4]; +FFFrameSync fs; +} ThresholdContext; + +void ff_threshold_init_x86(ThresholdContext *s); + +#endif /* AVFILTER_THRESHOLD_H */ diff --git a/libavfilter/vf_threshold.c b/libavfilter/vf_threshold.c index 88f6ef28d7..4183b353d2 100644 --- a/libavfilter/vf_threshold.c +++ b/libavfilter/vf_threshold.c @@ -31,27 +31,7 @@ #include "framesync.h" #include "internal.h" #include "video.h" - -typedef struct ThresholdContext { -const AVClass *class; - -int planes; -int bpc; - -int nb_planes; -int width[4], height[4]; - -void (*threshold)(const uint8_t *in, const uint8_t *threshold, - const uint8_t *min, const uint8_t *max, - uint8_t *out, - ptrdiff_t ilinesize, ptrdiff_t tlinesize, - ptrdiff_t flinesize, ptrdiff_t slinesize, - ptrdiff_t olinesize, - int w, int h); - -AVFrame *frames[4]; -FFFrameSync fs; -} ThresholdContext; +#include "threshold.h" #define OFFSET(x) offsetof(ThresholdContext, x) #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM @@ -155,7 +135,7 @@ static void threshold8(const uint8_t *in, const uint8_t *threshold, in+= ilinesize; threshold += tlinesize; min += flinesize; -max += flinesize; +max += slinesize; out += olinesize; } } @@ -183,7 +163,7 @@ static void threshold16(const uint8_t *iin, const uint8_t *tthreshold, in+= ilinesize / 2; threshold += tlinesize / 2; min += flinesize / 2; -max += flinesize / 2; +max += slinesize / 2; out += olinesize / 2; } } @@ -203,8 +183,9 @@ static int config_input(AVFilterLink *inlink) s->height[0] = s->height[3] = inlink->h; s->width[1] = s->width[2] = AV_CEIL_RSHIFT(inlink->w, hsub); s->width[0] = s->width[3] = inlink->w; +s->depth = desc->comp[0].depth; -if (desc->comp[0].depth == 8) { +if (s->depth == 8) { s->threshold = threshold8; s->bpc = 1; } else { @@ -212,6 +193,9 @@ static int config_input(AVFilterLink *inlink) s->bpc = 2; } +if (ARCH_X86) +ff_threshold_init_x86(s); + return 0; } diff --git a/libavfilter/x86/Makefile b/libavfilter/x86/Makefile index 3431625883..c10f4d5538 100644 --- a/libavfilter/x86/Makefile +++ b/libavfilter/x86/Makefile @@ -20,6 +20,7 @@ OBJS-$(CONFIG_SPP_FILTER)+= x86/vf_spp.o OBJS-$(CONFIG_SSIM_FILTER) += x86/vf_ssim_init.o OBJS-$(CONFIG_STEREO3D_FILTER) += x86/vf_stereo3d_init.o OBJS-$(CONFIG_TBLEND_FILTER) += x86/vf_
Re: [FFmpeg-devel] libavcodec/als: remove check for predictor order of a block
Hi, On Mon, Nov 13, 2017 at 12:45 AM, Carl Eugen Hoyos wrote: > 2017-11-12 20:05 GMT+01:00 Umair Khan : > >> The attached patch fixes the address sanitizer issue. > > Breaks compilation here, how did you test? > > libavcodec/alsdec.c: In function ‘decode_var_block_data’: > libavcodec/alsdec.c:938:7: error: expected ‘}’ before ‘else’ Sorry for the faulty patch. Here is the fixed one. 0001-libavcodec-als-fix-address-sanitization-error-in-dec.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] configure: ERROR: x265 not found using pkg-config
I get the following error during configure: ERROR: x265 not found using pkg-config My last compile run (3 days ago) worked perfectly. Somebody must have changed the configure script. Cheers, K. C. -- regards Helmut K. C. Tessarek KeyID 0xF7832007C11F128D Key fingerprint = 28A3 1666 4FE8 D72C CFD5 8B23 F783 2007 C11F 128D /* Thou shalt not follow the NULL pointer for chaos and madness await thee at its end. */ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] libavcodec/als: remove check for predictor order of a block
2017-11-12 20:30 GMT+01:00 Umair Khan : > Hi, > > On Mon, Nov 13, 2017 at 12:45 AM, Carl Eugen Hoyos wrote: >> 2017-11-12 20:05 GMT+01:00 Umair Khan : >> >>> The attached patch fixes the address sanitizer issue. >> >> Breaks compilation here, how did you test? >> >> libavcodec/alsdec.c: In function ‘decode_var_block_data’: >> libavcodec/alsdec.c:938:7: error: expected ‘}’ before ‘else’ > > Sorry for the faulty patch. Here is the fixed one. The commit message of your patch is: libavcodec/als: fix address sanitization error in decoder Is there an error in current FFmpeg git head that asan shows? If not, the commit message makes no sense. I believe you should send two patches that are meant to be committed together, one of them fixing ticket #6297. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] configure: ERROR: x265 not found using pkg-config
On 11/12/2017 4:35 PM, Helmut K. C. Tessarek wrote: > I get the following error during configure: > > ERROR: x265 not found using pkg-config > > My last compile run (3 days ago) worked perfectly. Somebody must have > changed the configure script. > > Cheers, > K. C. > Does this fix it for you? diff --git a/configure b/configure index 2f026c45bc..2a7b846a6d 100755 --- a/configure +++ b/configure @@ -1293,8 +1293,8 @@ test_pkg_config(){ check_pkg_config(){ log check_pkg_config "$@" name="$1" -test_pkg_config "$@" && -eval add_cflags \$${name}_cflags +test_pkg_config "$@" || return 1 +eval add_cflags \$${name}_cflags } check_exec(){ If not, you'll have to give me more info, like the config.log file, but for that open a trac ticket. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/vf_threshold: add x86 SIMD
On 12 November 2017 at 19:15, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > libavfilter/threshold.h | 51 +++ > libavfilter/vf_threshold.c | 32 + > libavfilter/x86/Makefile| 2 ++ > libavfilter/x86/vf_threshold.asm| 69 ++ > +++ > libavfilter/x86/vf_threshold_init.c | 41 ++ > 5 files changed, 171 insertions(+), 24 deletions(-) > create mode 100644 libavfilter/threshold.h > create mode 100644 libavfilter/x86/vf_threshold.asm > create mode 100644 libavfilter/x86/vf_threshold_init.c > > diff --git a/libavfilter/threshold.h b/libavfilter/threshold.h > new file mode 100644 > index 00..8b55ad6ba1 > --- /dev/null > +++ b/libavfilter/threshold.h > @@ -0,0 +1,51 @@ > +/* > + * Copyright (c) 2016 Paul B Mahol > + * > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > 02110-1301 USA > + */ > + > +#ifndef AVFILTER_THRESHOLD_H > +#define AVFILTER_THRESHOLD_H > + > +#include "avfilter.h" > +#include "framesync.h" > + > +typedef struct ThresholdContext { > +const AVClass *class; > + > +int depth; > +int planes; > +int bpc; > + > +int nb_planes; > +int width[4], height[4]; > + > +void (*threshold)(const uint8_t *in, const uint8_t *threshold, > + const uint8_t *min, const uint8_t *max, > + uint8_t *out, > + ptrdiff_t ilinesize, ptrdiff_t tlinesize, > + ptrdiff_t flinesize, ptrdiff_t slinesize, > + ptrdiff_t olinesize, > + int w, int h); > + > +AVFrame *frames[4]; > +FFFrameSync fs; > +} ThresholdContext; > + > +void ff_threshold_init_x86(ThresholdContext *s); > + > +#endif /* AVFILTER_THRESHOLD_H */ > diff --git a/libavfilter/vf_threshold.c b/libavfilter/vf_threshold.c > index 88f6ef28d7..4183b353d2 100644 > --- a/libavfilter/vf_threshold.c > +++ b/libavfilter/vf_threshold.c > @@ -31,27 +31,7 @@ > #include "framesync.h" > #include "internal.h" > #include "video.h" > - > -typedef struct ThresholdContext { > -const AVClass *class; > - > -int planes; > -int bpc; > - > -int nb_planes; > -int width[4], height[4]; > - > -void (*threshold)(const uint8_t *in, const uint8_t *threshold, > - const uint8_t *min, const uint8_t *max, > - uint8_t *out, > - ptrdiff_t ilinesize, ptrdiff_t tlinesize, > - ptrdiff_t flinesize, ptrdiff_t slinesize, > - ptrdiff_t olinesize, > - int w, int h); > - > -AVFrame *frames[4]; > -FFFrameSync fs; > -} ThresholdContext; > +#include "threshold.h" > > #define OFFSET(x) offsetof(ThresholdContext, x) > #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM > @@ -155,7 +135,7 @@ static void threshold8(const uint8_t *in, const > uint8_t *threshold, > in+= ilinesize; > threshold += tlinesize; > min += flinesize; > -max += flinesize; > +max += slinesize; > out += olinesize; > } > } > @@ -183,7 +163,7 @@ static void threshold16(const uint8_t *iin, const > uint8_t *tthreshold, > in+= ilinesize / 2; > threshold += tlinesize / 2; > min += flinesize / 2; > -max += flinesize / 2; > +max += slinesize / 2; > out += olinesize / 2; > } > } > @@ -203,8 +183,9 @@ static int config_input(AVFilterLink *inlink) > s->height[0] = s->height[3] = inlink->h; > s->width[1] = s->width[2] = AV_CEIL_RSHIFT(inlink->w, hsub); > s->width[0] = s->width[3] = inlink->w; > +s->depth = desc->comp[0].depth; > > -if (desc->comp[0].depth == 8) { > +if (s->depth == 8) { > s->threshold = threshold8; > s->bpc = 1; > } else { > @@ -212,6 +193,9 @@ static int config_input(AVFilterLink *inlink) > s->bpc = 2; > } > > +if (ARCH_X86) > +ff_threshold_init_x86(s); > Give ff_threshold_init_x86 the bit depth via an argument? I don't mind which way its done, but saves a field in the context. > +
Re: [FFmpeg-devel] [PATCH] avfilter/vf_threshold: add x86 SIMD
On 11/12/2017 4:15 PM, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > libavfilter/threshold.h | 51 +++ > libavfilter/vf_threshold.c | 32 + > libavfilter/x86/Makefile| 2 ++ > libavfilter/x86/vf_threshold.asm| 69 > + > libavfilter/x86/vf_threshold_init.c | 41 ++ > 5 files changed, 171 insertions(+), 24 deletions(-) > create mode 100644 libavfilter/threshold.h > create mode 100644 libavfilter/x86/vf_threshold.asm > create mode 100644 libavfilter/x86/vf_threshold_init.c > > diff --git a/libavfilter/threshold.h b/libavfilter/threshold.h > new file mode 100644 > index 00..8b55ad6ba1 > --- /dev/null > +++ b/libavfilter/threshold.h > @@ -0,0 +1,51 @@ > +/* > + * Copyright (c) 2016 Paul B Mahol > + * > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > + */ > + > +#ifndef AVFILTER_THRESHOLD_H > +#define AVFILTER_THRESHOLD_H > + > +#include "avfilter.h" > +#include "framesync.h" > + > +typedef struct ThresholdContext { > +const AVClass *class; > + > +int depth; > +int planes; > +int bpc; > + > +int nb_planes; > +int width[4], height[4]; > + > +void (*threshold)(const uint8_t *in, const uint8_t *threshold, > + const uint8_t *min, const uint8_t *max, > + uint8_t *out, > + ptrdiff_t ilinesize, ptrdiff_t tlinesize, > + ptrdiff_t flinesize, ptrdiff_t slinesize, > + ptrdiff_t olinesize, > + int w, int h); > + > +AVFrame *frames[4]; > +FFFrameSync fs; > +} ThresholdContext; > + > +void ff_threshold_init_x86(ThresholdContext *s); > + > +#endif /* AVFILTER_THRESHOLD_H */ > diff --git a/libavfilter/vf_threshold.c b/libavfilter/vf_threshold.c > index 88f6ef28d7..4183b353d2 100644 > --- a/libavfilter/vf_threshold.c > +++ b/libavfilter/vf_threshold.c > @@ -31,27 +31,7 @@ > #include "framesync.h" > #include "internal.h" > #include "video.h" > - > -typedef struct ThresholdContext { > -const AVClass *class; > - > -int planes; > -int bpc; > - > -int nb_planes; > -int width[4], height[4]; > - > -void (*threshold)(const uint8_t *in, const uint8_t *threshold, > - const uint8_t *min, const uint8_t *max, > - uint8_t *out, > - ptrdiff_t ilinesize, ptrdiff_t tlinesize, > - ptrdiff_t flinesize, ptrdiff_t slinesize, > - ptrdiff_t olinesize, > - int w, int h); > - > -AVFrame *frames[4]; > -FFFrameSync fs; > -} ThresholdContext; > +#include "threshold.h" > > #define OFFSET(x) offsetof(ThresholdContext, x) > #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM > @@ -155,7 +135,7 @@ static void threshold8(const uint8_t *in, const uint8_t > *threshold, > in+= ilinesize; > threshold += tlinesize; > min += flinesize; > -max += flinesize; > +max += slinesize; Unrelated fix? > out += olinesize; > } > } > @@ -183,7 +163,7 @@ static void threshold16(const uint8_t *iin, const uint8_t > *tthreshold, > in+= ilinesize / 2; > threshold += tlinesize / 2; > min += flinesize / 2; > -max += flinesize / 2; > +max += slinesize / 2; Same. > out += olinesize / 2; > } > } > @@ -203,8 +183,9 @@ static int config_input(AVFilterLink *inlink) > s->height[0] = s->height[3] = inlink->h; > s->width[1] = s->width[2] = AV_CEIL_RSHIFT(inlink->w, hsub); > s->width[0] = s->width[3] = inlink->w; > +s->depth = desc->comp[0].depth; > > -if (desc->comp[0].depth == 8) { > +if (s->depth == 8) { > s->threshold = threshold8; > s->bpc = 1; > } else { > @@ -212,6 +193,9 @@ static int config_input(AVFilterLink *inlink) > s->bpc = 2; > } > > +if (ARCH_X86) > +ff_threshold_init_x86(s); > + > return 0; > } > > diff --git a/libavfilter/x86/Makefile b/libavfilter/x86/Makefile > index 343
Re: [FFmpeg-devel] configure: ERROR: x265 not found using pkg-config
W dniu 12.11.2017 o 20:35, Helmut K. C. Tessarek pisze: > I get the following error during configure: > > ERROR: x265 not found using pkg-config > > My last compile run (3 days ago) worked perfectly. Somebody must have > changed the configure script. This time it is x265 bug. Please apply patch https://patches.videolan.org/patch/18630/ to x265 and recheck. Mateusz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] configure: ERROR: x265 not found using pkg-config
On 2017-11-12 15:10, James Almer wrote: > Does this fix it for you? Unfortunately it did not. As requested, here the ticket: https://trac.ffmpeg.org/ticket/6830 Cheers, K. C. -- regards Helmut K. C. Tessarek KeyID 0xF7832007C11F128D Key fingerprint = 28A3 1666 4FE8 D72C CFD5 8B23 F783 2007 C11F 128D /* Thou shalt not follow the NULL pointer for chaos and madness await thee at its end. */ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] Remove REP_RET usage throughout x86 asm files
No longer needed as AUTO_REP_RET deals with it on normal RETs. Signed-off-by: Rostislav Pehlivanov --- libavcodec/x86/aacpsdsp.asm | 10 libavcodec/x86/ac3dsp.asm | 10 libavcodec/x86/alacdsp.asm | 4 +-- libavcodec/x86/audiodsp.asm | 2 +- libavcodec/x86/dirac_dwt.asm| 14 +-- libavcodec/x86/fft.asm | 8 +++--- libavcodec/x86/flacdsp.asm | 8 +++--- libavcodec/x86/h264_chromamc.asm| 18 +++--- libavcodec/x86/h264_chromamc_10bit.asm | 10 libavcodec/x86/h264_deblock_10bit.asm | 10 libavcodec/x86/h264_idct.asm| 22 - libavcodec/x86/h264_idct_10bit.asm | 8 +++--- libavcodec/x86/h264_intrapred.asm | 30 +++--- libavcodec/x86/h264_intrapred_10bit.asm | 16 ++-- libavcodec/x86/h264_qpel_10bit.asm | 2 +- libavcodec/x86/h264_qpel_8bit.asm | 26 +-- libavcodec/x86/h264_weight.asm | 16 ++-- libavcodec/x86/h264_weight_10bit.asm| 12 - libavcodec/x86/hevc_sao.asm | 2 +- libavcodec/x86/hevc_sao_10bit.asm | 2 +- libavcodec/x86/hpeldsp.asm | 22 - libavcodec/x86/hpeldsp_vp3.asm | 4 +-- libavcodec/x86/huffyuvdsp.asm | 2 +- libavcodec/x86/jpeg2000dsp.asm | 4 +-- libavcodec/x86/lossless_videodsp.asm| 2 +- libavcodec/x86/lossless_videoencdsp.asm | 2 +- libavcodec/x86/mdct15.asm | 2 +- libavcodec/x86/me_cmp.asm | 2 +- libavcodec/x86/pixblockdsp.asm | 2 +- libavcodec/x86/pngdsp.asm | 2 +- libavcodec/x86/qpel.asm | 6 ++--- libavcodec/x86/qpeldsp.asm | 12 - libavcodec/x86/rv34dsp.asm | 2 +- libavcodec/x86/rv40dsp.asm | 10 libavcodec/x86/sbrdsp.asm | 12 - libavcodec/x86/takdsp.asm | 8 +++--- libavcodec/x86/utvideodsp.asm | 4 +-- libavcodec/x86/v210.asm | 2 +- libavcodec/x86/vc1dsp_mc.asm| 2 +- libavcodec/x86/videodsp.asm | 2 +- libavcodec/x86/vp8dsp.asm | 30 +++--- libavcodec/x86/vp8dsp_loopfilter.asm| 6 ++--- libavfilter/x86/af_afir.asm | 2 +- libavfilter/x86/af_volume.asm | 6 ++--- libavfilter/x86/avf_showcqt.asm | 4 +-- libavfilter/x86/vf_blend.asm| 2 +- libavfilter/x86/vf_gradfun.asm | 6 ++--- libavfilter/x86/vf_hqdn3d.asm | 2 +- libavfilter/x86/vf_interlace.asm| 6 ++--- libavfilter/x86/vf_maskedmerge.asm | 2 +- libavfilter/x86/vf_stereo3d.asm | 2 +- libavfilter/x86/vf_w3fdif.asm | 10 libavresample/x86/audio_convert.asm | 44 - libavresample/x86/audio_mix.asm | 10 libavresample/x86/dither.asm| 6 ++--- libavutil/x86/float_dsp.asm | 18 +++--- libavutil/x86/lls.asm | 4 +-- libavutil/x86/x86inc.asm| 16 libswresample/x86/audio_convert.asm | 12 - libswresample/x86/rematrix.asm | 8 +++--- libswscale/x86/input.asm| 14 +-- libswscale/x86/output.asm | 10 libswscale/x86/scale.asm| 2 +- tests/checkasm/x86/checkasm.asm | 2 +- 64 files changed, 271 insertions(+), 287 deletions(-) diff --git a/libavcodec/x86/aacpsdsp.asm b/libavcodec/x86/aacpsdsp.asm index 4acd087c85..73c7c09514 100644 --- a/libavcodec/x86/aacpsdsp.asm +++ b/libavcodec/x86/aacpsdsp.asm @@ -49,7 +49,7 @@ align 16 add dstq, mmsize addnq, mmsize*2 jl .loop -REP_RET +RET %endmacro INIT_XMM sse @@ -83,7 +83,7 @@ align 16 add src2q, mmsize add nq, mmsize*2 jl .loop -REP_RET +RET ;*** ;void ff_ps_stereo_interpolate_sse3(float (*l)[2], float (*r)[2], @@ -116,7 +116,7 @@ align 16 movhps [rq+nq], m2 add nq, 8 jl .loop -REP_RET +RET ;*** ;void ps_stereo_interpolate_ipdopd_sse3(float (*l)[2], float (*r)[2], @@ -164,7 +164,7 @@ align 16 movhps [rq+nq], m2 add nq, 8 jl .loop -REP_RET +RET ;** ;void ps_hybrid_analysis_ileave_sse(float out[2][38][64], @@ -478,7 +478,7 @@ align 16 addoutq, strideq add nq, 64 jl .loop -REP_RET +RET %endmacro INIT_XMM sse diff --git a/libavcodec/x86/ac3dsp.asm b/libavcodec/x86/ac3dsp.asm index 675ade3101..304c6cfd8c 100644 --- a/libavcodec/x86/ac3dsp.asm +++ b/libavcodec/x86/ac3dsp.asm @@ -64,7 +64,7 @@ cgloba
Re: [FFmpeg-devel] [PATCH] avfilter/vf_threshold: add x86 SIMD
On 2017-11-12 21:15, Rostislav Pehlivanov wrote: > On 12 November 2017 at 19:15, Paul B Mahol wrote: > +movam7, [pb_128] >> +addinq, wq >> +add thresholdq, wq >> +add minq, wq >> +add maxq, wq >> +add outq, wq >> +neg wq >> +.nextrow: >> +mov xq, wq >> + >> +.loop: >> > > Unindent this, we don't have leading spaces before labels, including for > loops inside loops Yes we do. We have many labels indented, even twice indented for loops within loops (And not all of them are my doing.) signature.asc Description: OpenPGP digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [Patch] Fix for ticket 6658 (Dash demuxer segfault)
On Thu, Nov 09, 2017 at 00:19:33 +, Colin NG wrote: Before the next attempt, please do have a look at the docs about ffmpeg's programming style, especially bracket placement. > +static int isLocal(char *url) { > + > +if (av_strstart(url, "http://";, NULL) || av_strstart(url, "https://";, > NULL)) Apart from the fact that I'm not sure whether such a function doesn't already exist: > +{ > +return FALSE; > +} > + > +return TRUE; > +} TRUE/FALSE? Are you sure? Apart from that, a ternary check would be simpler. > -ret = s->io_open(s, pb, url, AVIO_FLAG_READ, &tmp); > +{ > +av_freep(pb); > +AVDictionary *opts = NULL; > +set_httpheader_options(c, opts); > +ret = avio_open2(pb, url, AVIO_FLAG_READ, c->interrupt_callback, > &opts); > +av_dict_free(&opts); > +if (ret < 0) > +return ret; > +} Why a separate block? > if (ret >= 0) { And the return above obsoletes this check. > +char *path = malloc(MAX_URL_SIZE); ffmpeg has its own malloc variants, and you MUST check the result. > -for (i = 0; i < n_baseurl_nodes; ++i) { > +for (i = 0; i < n_baseurl_nodes; i++) { Why this change? (Yes, the latter is the more correct style, but doesn't have anything to do with your patch.) > } > + > if (rep_bandwidth_val && tmp_str[0] != '\0') { Why this change? > -} else if (!av_strcasecmp(fragmenturl_node->name, (const char > *)"SegmentURL")) { > +} > +else if (!av_strcasecmp(fragmenturl_node->name, (const char > *)"SegmentURL")) { Why this change? > } > + > representation_segmenttemplate_node = > find_child_node_by_name(representation_node, "SegmentTemplate"); Why this change? > +av_log(s, AV_LOG_INFO, "representation_segmentlist_node \n"); And why whitespace before the line break? > adaptionset_baseurl_node); > -if (ret < 0) { > + if (ret < 0) { > return ret; Why this change? > close_in = 1; > - > set_httpheader_options(c, opts); Why this change? > +if ((mpd_baseurl_node = find_child_node_by_name(node, "BaseURL")) == > NULL) > +{ > +mpd_baseurl_node = xmlNewNode(node, "BaseURL"); > + } Watch your bracket style, and your indentation. ... and probably a lot of other issues which I cannot judge. Moritz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] MAINTAINERS: add myself as videotoolbox* maintainer
From: Aman Gupta --- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 4df6c6533d..6a92b5190d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -245,7 +245,7 @@ Codecs: txd.c Ivo van Poorten vc2* Rostislav Pehlivanov vcr1.cMichael Niedermayer - videotoolboxenc.c Rick Kern + videotoolboxenc.c Rick Kern, Aman Gupta vima.cPaul B Mahol vorbisdec.c Denes Balatoni, David Conrad vorbisenc.c Oded Shimon @@ -272,7 +272,7 @@ Hardware acceleration: vaapi*Gwenole Beauchesne vaapi_encode* Mark Thompson vdpau*Philip Langdale, Carl Eugen Hoyos - videotoolbox* Rick Kern + videotoolbox* Rick Kern, Aman Gupta libavdevice -- 2.14.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] avcodec/h264_metadata_bsf: fix the AVClass version number
On 11/11/2017 7:54 AM, Michael Niedermayer wrote: > On Sat, Nov 11, 2017 at 01:47:20AM -0300, James Almer wrote: >> --- >> libavcodec/h264_metadata_bsf.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c >> index 73e73e96e4..ada40a57c7 100644 >> --- a/libavcodec/h264_metadata_bsf.c >> +++ b/libavcodec/h264_metadata_bsf.c >> @@ -506,7 +506,7 @@ static const AVClass h264_metadata_class = { >> .class_name = "h264_metadata_bsf", >> .item_name = av_default_item_name, >> .option = h264_metadata_options, >> -.version= LIBAVCODEC_VERSION_MAJOR, >> +.version= LIBAVUTIL_VERSION_INT, >> }; >> >> static const enum AVCodecID h264_metadata_codec_ids[] = { > > should be ok > > thx Patchset pushed. Thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: write fmp4 init header after first AV frame
On Sun, Nov 12, 2017 at 5:29 AM, Steven Liu wrote: > fix ticket id: 6825 > > Signed-off-by: Steven Liu > --- > libavformat/hlsenc.c | 28 +--- > 1 file changed, 25 insertions(+), 3 deletions(-) > > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > index 5ea9d216a4..3a4c8d65be 100644 > --- a/libavformat/hlsenc.c > +++ b/libavformat/hlsenc.c > @@ -108,6 +108,9 @@ typedef struct HLSContext { > uint32_t start_sequence_source_type; // enum StartSequenceSourceType > AVOutputFormat *oformat; > AVOutputFormat *vtt_oformat; > +AVIOContext *out; > +int packets_written; > +int init_range_length; > > AVFormatContext *avf; > AVFormatContext *vtt_avf; > @@ -607,9 +610,14 @@ static int hls_mux_init(AVFormatContext *s) > av_log(s, AV_LOG_WARNING, "Multi-file byterange mode is > currently unsupported in the HLS muxer.\n"); > return AVERROR_PATCHWELCOME; > } > +hls->packets_written = 0; > +hls->init_range_length = 0; > hls->fmp4_init_mode = !byterange_mode; > set_http_options(s, &options, hls); > -if ((ret = s->io_open(s, &oc->pb, hls->base_output_dirname, > AVIO_FLAG_WRITE, &options)) < 0) { > +if ((ret = avio_open_dyn_buf(&oc->pb)) < 0) > +return ret; > + > +if ((ret = s->io_open(s, &hls->out, hls->base_output_dirname, > AVIO_FLAG_WRITE, &options)) < 0) { > av_log(s, AV_LOG_ERROR, "Failed to open segment '%s'\n", > hls->fmp4_init_filename); > return ret; > } > @@ -634,6 +642,7 @@ static int hls_mux_init(AVFormatContext *s) > av_dict_free(&options); > return AVERROR(EINVAL); > } > +avio_flush(oc->pb); > av_dict_free(&options); > } > return 0; > @@ -1600,6 +1609,8 @@ static int hls_write_packet(AVFormatContext *s, > AVPacket *pkt) > int is_ref_pkt = 1; > int ret = 0, can_split = 1; > int stream_index = 0; > +int range_length = 0; > +uint8_t *buffer = NULL; > > if (hls->sequence - hls->nb_entries > hls->start_sequence && > hls->init_time > 0) { > /* reset end_pts, hls->recording_time at end of the init hls list > */ > @@ -1645,7 +1656,7 @@ static int hls_write_packet(AVFormatContext *s, > AVPacket *pkt) > } > > } > -if (hls->fmp4_init_mode || can_split && av_compare_ts(pkt->pts - > hls->start_pts, st->time_base, > +if (hls->packets_written && can_split && av_compare_ts(pkt->pts - > hls->start_pts, st->time_base, > end_pts, AV_TIME_BASE_Q) >= 0) { > int64_t new_start_pos; > char *old_filename = av_strdup(hls->avf->filename); > @@ -1661,7 +1672,17 @@ static int hls_write_packet(AVFormatContext *s, > AVPacket *pkt) > hls->size = new_start_pos - hls->start_pos; > > if (!byterange_mode) { > -ff_format_io_close(s, &oc->pb); > +if (hls->segment_type == SEGMENT_TYPE_FMP4 && > !hls->init_range_length) { > +avio_flush(oc->pb); > +range_length = avio_close_dyn_buf(oc->pb, &buffer); > +avio_write(hls->out, buffer, range_length); > +hls->init_range_length = range_length; > +avio_open_dyn_buf(&oc->pb); > +hls->packets_written = 0; > +ff_format_io_close(s, &hls->out); > +} else { > +ff_format_io_close(s, &oc->pb); > +} > if (hls->vtt_avf) { > ff_format_io_close(s, &hls->vtt_avf->pb); > } > @@ -1719,6 +1740,7 @@ static int hls_write_packet(AVFormatContext *s, > AVPacket *pkt) > } > } > > +hls->packets_written++; > ret = ff_write_chained(oc, stream_index, pkt, s, 0); > > return ret; > Patch LGTM. I confirmed it fixes the issue in ticket 6825 > -- > 2.11.0 (Apple Git-81) > > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil: add API for mb types.
On Sun, Nov 12, 2017 at 05:18:09PM +, Rostislav Pehlivanov wrote: > On 12 November 2017 at 16:42, Michael Niedermayer > wrote: > > > On Sun, Nov 12, 2017 at 04:21:15PM +, Rostislav Pehlivanov wrote: > > > On 12 November 2017 at 15:59, Michael Niedermayer > > > > > wrote: > > > > > > > This is based on motion_type.h > > > > > > > > TODO: docs & split into a commit per lib > > > > Signed-off-by: Michael Niedermayer > > > > --- > > > > libavcodec/avcodec.h | 4 ++ > > > > libavcodec/options_table.h | 1 + > > > > libavutil/block_type.h | 107 ++ > > > > +++ > > > > libavutil/frame.h | 14 ++ > > > > 4 files changed, 126 insertions(+) > > > > create mode 100644 libavutil/block_type.h > > > > > > > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > > > > index 15ca871b59..1a49fa0a9a 100644 > > > > --- a/libavcodec/avcodec.h > > > > +++ b/libavcodec/avcodec.h > > > > @@ -923,6 +923,10 @@ typedef struct RcOverride{ > > > > * Show all frames before the first keyframe > > > > */ > > > > #define AV_CODEC_FLAG2_SHOW_ALL (1 << 22) > > > > +/** > > > > + * Export block types through frame side data > > > > + */ > > > > +#define AV_CODEC_FLAG2_EXPORT_BLOCKS (1 << 27) > > > > /** > > > > * Export motion vectors through frame side data > > > > */ > > > > diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h > > > > index d89f58d540..0b86b4d0fb 100644 > > > > --- a/libavcodec/options_table.h > > > > +++ b/libavcodec/options_table.h > > > > @@ -74,6 +74,7 @@ static const AVOption avcodec_options[] = { > > > > {"chunks", "Frame data might be split into multiple chunks", 0, > > > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_CHUNKS }, INT_MIN, INT_MAX, > > V|D, > > > > "flags2"}, > > > > {"showall", "Show all frames before the first keyframe", 0, > > > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SHOW_ALL }, INT_MIN, INT_MAX, > > > > V|D, "flags2"}, > > > > {"export_mvs", "export motion vectors through frame side data", 0, > > > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, > > INT_MAX, > > > > V|D, "flags2"}, > > > > +{"export_blocks", "export block types through frame side data", 0, > > > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_BLOCKS}, INT_MIN, > > INT_MAX, > > > > V|D, "flags2"}, > > > > {"skip_manual", "do not skip samples and export skip information as > > frame > > > > side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SKIP_MANUAL}, > > > > INT_MIN, INT_MAX, V|D, "flags2"}, > > > > {"ass_ro_flush_noop", "do not reset ASS ReadOrder field on flush", 0, > > > > AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_RO_FLUSH_NOOP}, INT_MIN, > > INT_MAX, > > > > S|D, "flags2"}, > > > > {"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = > > 0}, > > > > 0, INT_MAX}, > > > > diff --git a/libavutil/block_type.h b/libavutil/block_type.h > > > > new file mode 100644 > > > > index 00..3f53f1d082 > > > > --- /dev/null > > > > +++ b/libavutil/block_type.h > > > > @@ -0,0 +1,107 @@ > > > > +/* > > > > + * This file is part of FFmpeg. > > > > + * > > > > + * FFmpeg is free software; you can redistribute it and/or > > > > + * modify it under the terms of the GNU Lesser General Public > > > > + * License as published by the Free Software Foundation; either > > > > + * version 2.1 of the License, or (at your option) any later version. > > > > + * > > > > + * FFmpeg is distributed in the hope that it will be useful, > > > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > > > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > > > + * Lesser General Public License for more details. > > > > + * > > > > + * You should have received a copy of the GNU Lesser General Public > > > > + * License along with FFmpeg; if not, write to the Free Software > > > > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > > > > 02110-1301 USA > > > > + */ > > > > + > > > > +#ifndef AVUTIL_BLOCK_TYPE_H > > > > +#define AVUTIL_BLOCK_TYPE_H > > > > + > > > > +#include > > > > + > > > > + > > > > +typedef struct AVBlockType { > > > > +/** > > > > + * Block type. > > > > + * 1: Prediction (this can be spatial prediction or motion > > > > compensation for example) > > > > + * 2: Transform > > > > + * 3: Residual > > > > + * 4: Filter > > > > + * 5: Metadata > > > > + * > > > > + * Multiple Filter, Transform and prediction blocks are allowed, > > for > > > > example > > > > + * for bidirectional motion compensation. Multiple residuals are > > > > allowed, for > > > > + * example DC and AC residual. > > > > + */ > > > > +uint8_t type; > > > > +/** > > > > + * Bitmask that lists which planes (for example: > > > > Y:1,Cb:2,Cr:4,Alpha:8) > > > > + * this block applies to. > > > > + */ > > > > +uint8_t plane_mask; > > > > +/** > > > > + * The field (top:1, bot
Re: [FFmpeg-devel] [PATCH 2/9] avformat/hlsenc: allocate space for terminating null
2017-11-09 2:17 GMT+08:00 Timo Rothenpieler : > Fixes CID #1420394 > --- > libavformat/hlsenc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > index 5ea9d216a4..b571772f60 100644 > --- a/libavformat/hlsenc.c > +++ b/libavformat/hlsenc.c > @@ -1455,7 +1455,7 @@ static int hls_write_header(AVFormatContext *s) > if (basename_size > 0) { > hls->base_output_dirname = av_malloc(basename_size); > } else { > -hls->base_output_dirname = > av_malloc(strlen(hls->fmp4_init_filename)); > +hls->base_output_dirname = > av_malloc(strlen(hls->fmp4_init_filename) + 1); > } > if (!hls->base_output_dirname) { > ret = AVERROR(ENOMEM); > -- > 2.14.2 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel pushed Thanks ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Fix missing used attribute for inline assembly variables
On Sun, Nov 12, 2017 at 04:24:37PM +, Thomas Köppe wrote: > Variables used in inline assembly need to be marked with attribute((used)). > Static constants already were, via the define of DECLARE_ASM_CONST. > But DECLARE_ALIGNED does not add this attribute, and some of the variables > defined with it are const only used in inline assembly, and therefore > appeared dead. This change adds a macro DECLARE_ASM_ALIGNED that marks > variables as used. > > This change makes FFMPEG work with Clang's ThinLTO. > --- > libavcodec/cabac.c | 2 +- > libavcodec/x86/constants.c | 20 ++-- > libavutil/mem.h| 17 + > libswscale/x86/swscale.c | 12 ++-- > 4 files changed, 34 insertions(+), 17 deletions(-) will apply thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship: All citizens are under surveillance, all their steps and actions recorded, for the politicians to enforce control. Democracy: All politicians are under surveillance, all their steps and actions recorded, for the citizens to enforce control. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/vf_*_qsv: Fix flags
On Sun, Nov 12, 2017 at 05:42:20PM +, Mark Thompson wrote: > On 12/11/17 17:08, Michael Niedermayer wrote: > > Signed-off-by: Michael Niedermayer > > --- > > libavfilter/vf_overlay_qsv.c | 2 +- > > libavfilter/vf_vpp_qsv.c | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/libavfilter/vf_overlay_qsv.c b/libavfilter/vf_overlay_qsv.c > > index 471576e35a..1f50d4bb21 100644 > > --- a/libavfilter/vf_overlay_qsv.c > > +++ b/libavfilter/vf_overlay_qsv.c > > @@ -42,7 +42,7 @@ > > #define OVERLAY 1 > > > > #define OFFSET(x) offsetof(QSVOverlayContext, x) > > -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM > > +#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM) > > > > enum var_name { > > VAR_MAIN_iW, VAR_MW, > > diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c > > index 86af017d2e..eb2f1cc7eb 100644 > > --- a/libavfilter/vf_vpp_qsv.c > > +++ b/libavfilter/vf_vpp_qsv.c > > @@ -37,7 +37,7 @@ > > #include "qsvvpp.h" > > > > #define OFFSET(x) offsetof(VPPContext, x) > > -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM > > +#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM) > > > > /* number of video enhancement filters */ > > #define ENH_FILTERS_COUNT (5) > > > > LGTM. will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Freedom in capitalist society always remains about the same as it was in ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/img2enc: add frame_pts option for make output filename
2017-11-12 9:44 GMT+08:00 Carl Eugen Hoyos : > 2017-10-31 8:14 GMT+01:00 Steven Liu : >> when use frame_pts option, the output image name can be set >> with PTS of current frame. > > If this fixes ticket #1452, please mention it in the commit message. > > Thank you, Carl Eugen > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel pushed and modifed with Carl suggestion. Thanks ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec: deprecate getters and setters for AVCodecContext and AVCodec fields
The fields can be accessed directly, so these are not needed anymore. Signed-off-by: James Almer --- libavcodec/avcodec.h | 20 libavcodec/utils.c | 2 ++ libavcodec/version.h | 3 +++ 3 files changed, 25 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 8c76c9f908..9fda5dc270 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3235,22 +3235,39 @@ typedef struct AVCodecContext { int apply_cropping; } AVCodecContext; +#if FF_API_CODEC_GET_SET +/** + * Accessors for some AVCodecContext fields. These used to be provided for ABI + * compatibility, and do not need to be used anymore. + */ +attribute_deprecated AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); +attribute_deprecated void av_codec_set_pkt_timebase (AVCodecContext *avctx, AVRational val); +attribute_deprecated const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx); +attribute_deprecated void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc); +attribute_deprecated unsigned av_codec_get_codec_properties(const AVCodecContext *avctx); +attribute_deprecated int av_codec_get_lowres(const AVCodecContext *avctx); +attribute_deprecated void av_codec_set_lowres(AVCodecContext *avctx, int val); +attribute_deprecated int av_codec_get_seek_preroll(const AVCodecContext *avctx); +attribute_deprecated void av_codec_set_seek_preroll(AVCodecContext *avctx, int val); +attribute_deprecated uint16_t *av_codec_get_chroma_intra_matrix(const AVCodecContext *avctx); +attribute_deprecated void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val); +#endif /** * AVProfile. @@ -3387,7 +3404,10 @@ typedef struct AVCodec { const char *bsfs; } AVCodec; +#if FF_API_CODEC_GET_SET +attribute_deprecated int av_codec_get_max_lowres(const AVCodec *codec); +#endif struct MpegEncContext; diff --git a/libavcodec/utils.c b/libavcodec/utils.c index b3a578110b..e50de6e89b 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -552,6 +552,7 @@ enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags, return AV_PIX_FMT_NONE; } +#if FF_API_CODEC_GET_SET MAKE_ACCESSORS(AVCodecContext, codec, AVRational, pkt_timebase) MAKE_ACCESSORS(AVCodecContext, codec, const AVCodecDescriptor *, codec_descriptor) MAKE_ACCESSORS(AVCodecContext, codec, int, lowres) @@ -567,6 +568,7 @@ int av_codec_get_max_lowres(const AVCodec *codec) { return codec->max_lowres; } +#endif int avpriv_codec_get_cap_skip_frame_fill_param(const AVCodec *codec){ return !!(codec->caps_internal & FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM); diff --git a/libavcodec/version.h b/libavcodec/version.h index 9c17e5716d..f4872267f1 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -120,6 +120,9 @@ #ifndef FF_API_GETCHROMA #define FF_API_GETCHROMA (LIBAVCODEC_VERSION_MAJOR < 59) #endif +#ifndef FF_API_CODEC_GET_SET +#define FF_API_CODEC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 59) +#endif #endif /* AVCODEC_VERSION_H */ -- 2.14.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] configure: add missing optional dependecy on libxvid to mpegvideoenc
It uses some of its rate control functionality when available. This also reverts commit 91df92e442844fbde69396d169bb352091cbb66f, implementing a proper fix instead. Signed-off-by: James Almer --- configure | 1 + libavcodec/Makefile | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 46b4815f2e..bf50bfcfc3 100755 --- a/configure +++ b/configure @@ -2416,6 +2416,7 @@ mpegaudio_select="mpegaudiodsp mpegaudioheader" mpegaudiodsp_select="dct" mpegvideo_select="blockdsp h264chroma hpeldsp idctdsp me_cmp mpeg_er videodsp" mpegvideoenc_select="me_cmp mpegvideo pixblockdsp qpeldsp" +mpegvideoenc_suggest="libxvid" vc1dsp_select="h264chroma qpeldsp startcode" rdft_select="fft" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 8c5dfd6319..7ac4e13a06 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -96,6 +96,7 @@ OBJS-$(CONFIG_INTRAX8) += intrax8.o intrax8dsp.o msmpeg4data.o OBJS-$(CONFIG_IVIDSP) += ivi_dsp.o OBJS-$(CONFIG_JNI) += ffjni.o jni.o OBJS-$(CONFIG_JPEGTABLES) += jpegtables.o +OBJS-$(CONFIG_LIBXVID) += libxvid_rc.o OBJS-$(CONFIG_LLAUDDSP)+= lossless_audiodsp.o OBJS-$(CONFIG_LLVIDDSP)+= lossless_videodsp.o OBJS-$(CONFIG_LLVIDENCDSP) += lossless_videoencdsp.o @@ -958,7 +959,7 @@ OBJS-$(CONFIG_LIBX262_ENCODER)+= libx264.o OBJS-$(CONFIG_LIBX264_ENCODER)+= libx264.o OBJS-$(CONFIG_LIBX265_ENCODER)+= libx265.o OBJS-$(CONFIG_LIBXAVS_ENCODER)+= libxavs.o -OBJS-$(CONFIG_LIBXVID_ENCODER)+= libxvid.o libxvid_rc.o +OBJS-$(CONFIG_LIBXVID_ENCODER)+= libxvid.o OBJS-$(CONFIG_LIBZVBI_TELETEXT_DECODER) += libzvbi-teletextdec.o ass.o # parsers -- 2.14.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] avcodec/qsvenc Question for Intel QSV low latency
Oh sorry, I don't understand how to do well yet... I'll try again. Thank you guys. diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 2bc19f5241..7d73c64dca 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -803,7 +803,7 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q) q->param.AsyncDepth = q->async_depth; -q->async_fifo = av_fifo_alloc((1 + q->async_depth) * +q->async_fifo = av_fifo_alloc((q->async_depth) * (sizeof(AVPacket) + sizeof(mfxSyncPoint*) + sizeof(mfxBitstream*))); if (!q->async_fifo) return AVERROR(ENOMEM); On Mon, Nov 13, 2017 at 1:13 AM, Michael Niedermayer wrote: > On Sun, Nov 12, 2017 at 11:40:57AM +0900, Natsuki Kai wrote: > > Hello guys, > > > > this is my first posting to ffmpeg-devel, and I believe my mail format is > > correct. > > > > I'm using ffmpeg for encoding video in real-time, so low encode delay is > > needed. > > Once I call "avcodec_send_frame(avctx, frame)", I'd like to get the > encoded > > data from "avcodec_receive_packet(avctx, avpkt)". > > > > However I cannot do that in ffmpeg and Intel QSV (qsv), > > "avcodec_receive_packet()" returns nothing when I input the first frame > to > > qsv encoder by calling "avcodec_send_frame()". > > Of cource, after second frame inputs, qsv encoder returns valid data. > > I'd like to get a valid data from first calling. > > > > I've tried some cases and as a result, my requirement is satisfied when > > avcodec/qsvenc.c will be fixed like below diff info. > > Then I have a question. > > Why q->async_fifo is set to be q->async_depth "+ 1"? > > Anybody knows? > > > > --- a/avcodec/qsvenc.c > > +++ b/avcodec/qsvenc.c > > @@ -803,7 +803,7 @@ > > > > q->param.AsyncDepth = q->async_depth; > > > > -q->async_fifo = av_fifo_alloc((1 + q->async_depth) * > > +q->async_fifo = av_fifo_alloc((q->async_depth) * > >(sizeof(AVPacket) + > > sizeof(mfxSyncPoint*) + sizeof(mfxBitstream*))); > > if (!q->async_fifo) > > return AVERROR(ENOMEM); > > This looks corrupted by a newline > > Applying: avcodec/qsvenc Question for Intel QSV low latency > error: corrupt patch at line 10 > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Those who are best at talking, realize last or never when they are wrong. > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] libavcodec/als: remove check for predictor order of a block
Hi, On Mon, Nov 13, 2017 at 1:09 AM, Carl Eugen Hoyos wrote: > 2017-11-12 20:30 GMT+01:00 Umair Khan : >> Hi, >> >> On Mon, Nov 13, 2017 at 12:45 AM, Carl Eugen Hoyos >> wrote: >>> 2017-11-12 20:05 GMT+01:00 Umair Khan : >>> The attached patch fixes the address sanitizer issue. >>> >>> Breaks compilation here, how did you test? >>> >>> libavcodec/alsdec.c: In function ‘decode_var_block_data’: >>> libavcodec/alsdec.c:938:7: error: expected ‘}’ before ‘else’ >> >> Sorry for the faulty patch. Here is the fixed one. > > The commit message of your patch is: > libavcodec/als: fix address sanitization error in decoder > > Is there an error in current FFmpeg git head that asan > shows? If not, the commit message makes no sense. > > I believe you should send two patches that are meant > to be committed together, one of them fixing ticket #6297. This is the complete patchset. -Umair 0001-libavcodec-als-remove-check-for-predictor-order-of-a.patch Description: Binary data 0002-libavcodec-als-fix-address-sanitization-error-in-dec.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel