[FFmpeg-cvslog] avformat/dhav: Fix incorrect non-DHAV chunk skipping logic
ffmpeg | branch: master | Idan Freiberg | Wed Jan 13 14:34:54 2021 +0200| [a6912e5b88463b7b39cc3ee4f9338f57ef7ff7e6] | committer: Paul B Mahol avformat/dhav: Fix incorrect non-DHAV chunk skipping logic DAV files may contain a variable length padding in between chunks filled with 0xff bytes. The current skipping logic is incorrect as it may skip over DHAV chunks not appearing sequentially in the file. We now look for the 'DHAV' tag using a byte-by-byte search in order to handle such situations. Also the dhav->last_good_pos field will not be updated while skipping unrecognized data. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a6912e5b88463b7b39cc3ee4f9338f57ef7ff7e6 --- libavformat/dhav.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/libavformat/dhav.c b/libavformat/dhav.c index 00e0d8476e..6a6c235e65 100644 --- a/libavformat/dhav.c +++ b/libavformat/dhav.c @@ -173,18 +173,9 @@ static int read_chunk(AVFormatContext *s) if (avio_feof(s->pb)) return AVERROR_EOF; -if (avio_rl32(s->pb) != MKTAG('D','H','A','V') && dhav->last_good_pos < INT64_MAX - 0x8000) { -dhav->last_good_pos += 0x8000; -avio_seek(s->pb, dhav->last_good_pos, SEEK_SET); - -while (avio_rl32(s->pb) != MKTAG('D','H','A','V')) { -if (avio_feof(s->pb) || dhav->last_good_pos >= INT64_MAX - 0x8000) -return AVERROR_EOF; -dhav->last_good_pos += 0x8000; -ret = avio_skip(s->pb, 0x8000 - 4); -if (ret < 0) -return ret; -} +while (avio_r8(s->pb) != 'D' || avio_r8(s->pb) != 'H' || avio_r8(s->pb) != 'A' || avio_r8(s->pb) != 'V') { +if (avio_feof(s->pb)) +return AVERROR_EOF; } start = avio_tell(s->pb) - 4; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_w3fdif: add support for >8 depth gray formats
ffmpeg | branch: master | Paul B Mahol | Thu Jan 14 19:09:44 2021 +0100| [aaeee01eabe1604df223ba8be3e8acb5276b7918] | committer: Paul B Mahol avfilter/vf_w3fdif: add support for >8 depth gray formats > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aaeee01eabe1604df223ba8be3e8acb5276b7918 --- libavfilter/vf_w3fdif.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavfilter/vf_w3fdif.c b/libavfilter/vf_w3fdif.c index bbf1d026e2..a714235ecf 100644 --- a/libavfilter/vf_w3fdif.c +++ b/libavfilter/vf_w3fdif.c @@ -85,6 +85,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P, AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP, AV_PIX_FMT_GRAY8, +AV_PIX_FMT_GRAY9, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16, AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV422P9, AV_PIX_FMT_YUV444P9, AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/libvpxenc: add a way to set VP9E_SET_SVC_REF_FRAME_CONFIG
ffmpeg | branch: master | Wonkap Jang | Fri Jan 8 15:33:29 2021 -0800| [57dae5723f2e06a531d7db8e961f84ed5d5f07de] | committer: James Zern avcodec/libvpxenc: add a way to set VP9E_SET_SVC_REF_FRAME_CONFIG In order to fine-control referencing schemes in VP9 encoding, there is a need to use VP9E_SET_SVC_REF_FRAME_CONFIG method. This commit provides a way to use the API through frame metadata. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=57dae5723f2e06a531d7db8e961f84ed5d5f07de --- doc/encoders.texi | 32 +++ libavcodec/libvpxenc.c | 83 ++ libavcodec/version.h | 2 +- 3 files changed, 116 insertions(+), 1 deletion(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index 60e763a704..c2ba7d3e6f 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -2128,6 +2128,38 @@ midpoint is passed in rather than calculated for a specific clip or chunk. The valid range is [0, 1]. 0 (default) uses standard VBR. @item enable-tpl @var{boolean} Enable temporal dependency model. +@item ref-frame-config +Using per-frame metadata, set members of the structure @code{vpx_svc_ref_frame_config_t} in @code{vpx/vp8cx.h} to fine-control referencing schemes and frame buffer management. +@*Use a :-separated list of key=value pairs. +For example, +@example +av_dict_set(&av_frame->metadata, "ref-frame-config", \ +"rfc_update_buffer_slot=7:rfc_lst_fb_idx=0:rfc_gld_fb_idx=1:rfc_alt_fb_idx=2:rfc_reference_last=0:rfc_reference_golden=0:rfc_reference_alt_ref=0"); +@end example +@table @option +@item rfc_update_buffer_slot +Indicates the buffer slot number to update +@item rfc_update_last +Indicates whether to update the LAST frame +@item rfc_update_golden +Indicates whether to update GOLDEN frame +@item rfc_update_alt_ref +Indicates whether to update ALT_REF frame +@item rfc_lst_fb_idx +LAST frame buffer index +@item rfc_gld_fb_idx +GOLDEN frame buffer index +@item rfc_alt_fb_idx +ALT_REF frame buffer index +@item rfc_reference_last +Indicates whether to reference LAST frame +@item rfc_reference_golden +Indicates whether to reference GOLDEN frame +@item rfc_reference_alt_ref +Indicates whether to reference ALT_REF frame +@item rfc_reference_duration +Indicates frame duration +@end table @end table @end table diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index a7c76eb835..284cb9a108 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -125,6 +125,10 @@ typedef struct VPxEncoderContext { * encounter a frame with ROI side data. */ int roi_warned; +#if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT) +vpx_svc_ref_frame_config_t ref_frame_config; +AVDictionary *vpx_ref_frame_config; +#endif } VPxContext; /** String mappings for enum vp8e_enc_control_id */ @@ -152,6 +156,7 @@ static const char *const ctlidstr[] = { [VP9E_SET_SVC_LAYER_ID]= "VP9E_SET_SVC_LAYER_ID", #if VPX_ENCODER_ABI_VERSION >= 12 [VP9E_SET_SVC_PARAMETERS] = "VP9E_SET_SVC_PARAMETERS", +[VP9E_SET_SVC_REF_FRAME_CONFIG]= "VP9E_SET_SVC_REF_FRAME_CONFIG", #endif [VP9E_SET_SVC] = "VP9E_SET_SVC", #if VPX_ENCODER_ABI_VERSION >= 11 @@ -394,6 +399,20 @@ static void vp8_ts_parse_int_array(int *dest, char *value, size_t value_len, int } } +#if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT) +static void vp8_ts_parse_int64_array(int64_t *dest, char *value, size_t value_len, int max_entries) +{ +int dest_idx = 0; +char *saveptr = NULL; +char *token = av_strtok(value, ",", &saveptr); + +while (token && dest_idx < max_entries) { +dest[dest_idx++] = strtoull(token, NULL, 10); +token = av_strtok(NULL, ",", &saveptr); +} +} +#endif + static void set_temporal_layer_pattern(int layering_mode, vpx_codec_enc_cfg_t *cfg, int *layer_flags, int *flag_periodicity) { @@ -541,6 +560,48 @@ static int vpx_ts_param_parse(VPxContext *ctx, struct vpx_codec_enc_cfg *enccfg, return 0; } +#if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT) +static int vpx_ref_frame_config_parse(VPxContext *ctx, const struct vpx_codec_enc_cfg *enccfg, + char *key, char *value, enum AVCodecID codec_id) +{ +size_t value_len = strlen(value); +int ss_number_layers = enccfg->ss_number_layers; +vpx_svc_ref_frame_config_t *ref_frame_config = &ctx->ref_frame_config; + +if (!value_len) +return -1; + +if (codec_id != AV_CODEC_ID_VP9) +return -1; + +if (!strcmp(key, "rfc_update_buffer_slot")) { +vp8_ts_parse_int_array(ref_frame_config->update_buffer_slot, value, value_len, ss_number_layers); +} else if (!strcmp(key, "rfc_update_last")) { +vp8_ts_parse_int_array(ref_frame_config->update_last, value, value_len, ss_number_layers
[FFmpeg-cvslog] libavfilter/dnn: add batch mode for async execution
ffmpeg | branch: master | Guo, Yejun | Thu Jan 7 11:14:10 2021 +0800| [64ea15f05075d58cbd76bdcd5bac9d3b47d891ee] | committer: Guo, Yejun libavfilter/dnn: add batch mode for async execution the default number of batch_size is 1 Signed-off-by: Xie, Lin Signed-off-by: Wu Zhiwen Signed-off-by: Guo, Yejun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=64ea15f05075d58cbd76bdcd5bac9d3b47d891ee --- libavfilter/dnn/dnn_backend_openvino.c | 187 +++-- libavfilter/dnn/dnn_backend_openvino.h | 1 + libavfilter/dnn/dnn_interface.c| 1 + libavfilter/dnn_interface.h| 2 + libavfilter/vf_dnn_processing.c| 40 ++- 5 files changed, 196 insertions(+), 35 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c index d27e451eea..5271d1caa5 100644 --- a/libavfilter/dnn/dnn_backend_openvino.c +++ b/libavfilter/dnn/dnn_backend_openvino.c @@ -37,6 +37,7 @@ typedef struct OVOptions{ char *device_type; int nireq; +int batch_size; } OVOptions; typedef struct OVContext { @@ -70,7 +71,8 @@ typedef struct TaskItem { typedef struct RequestItem { ie_infer_request_t *infer_request; -TaskItem *task; +TaskItem **tasks; +int task_count; ie_complete_call_back_t callback; } RequestItem; @@ -83,6 +85,7 @@ typedef struct RequestItem { static const AVOption dnn_openvino_options[] = { { "device", "device to run model", OFFSET(options.device_type), AV_OPT_TYPE_STRING, { .str = "CPU" }, 0, 0, FLAGS }, { "nireq", "number of request", OFFSET(options.nireq), AV_OPT_TYPE_INT,{ .i64 = 0 }, 0, INT_MAX, FLAGS }, +{ "batch_size", "batch size per request", OFFSET(options.batch_size), AV_OPT_TYPE_INT,{ .i64 = 1 }, 1, 1000, FLAGS}, { NULL } }; @@ -100,7 +103,19 @@ static DNNDataType precision_to_datatype(precision_e precision) } } -static DNNReturnType fill_model_input_ov(OVModel *ov_model, TaskItem *task, RequestItem *request) +static int get_datatype_size(DNNDataType dt) +{ +switch (dt) +{ +case DNN_FLOAT: +return sizeof(float); +default: +av_assert0(!"not supported yet."); +return 1; +} +} + +static DNNReturnType fill_model_input_ov(OVModel *ov_model, RequestItem *request) { dimensions_t dims; precision_e precision; @@ -109,6 +124,7 @@ static DNNReturnType fill_model_input_ov(OVModel *ov_model, TaskItem *task, Requ IEStatusCode status; DNNData input; ie_blob_t *input_blob = NULL; +TaskItem *task = request->tasks[0]; status = ie_infer_request_get_blob(request->infer_request, task->input_name, &input_blob); if (status != OK) { @@ -134,12 +150,19 @@ static DNNReturnType fill_model_input_ov(OVModel *ov_model, TaskItem *task, Requ input.channels = dims.dims[1]; input.data = blob_buffer.buffer; input.dt = precision_to_datatype(precision); -if (task->do_ioproc) { -if (ov_model->model->pre_proc != NULL) { -ov_model->model->pre_proc(task->in_frame, &input, ov_model->model->filter_ctx); -} else { -proc_from_frame_to_dnn(task->in_frame, &input, ctx); + +av_assert0(request->task_count <= dims.dims[0]); +for (int i = 0; i < request->task_count; ++i) { +task = request->tasks[i]; +if (task->do_ioproc) { +if (ov_model->model->pre_proc != NULL) { +ov_model->model->pre_proc(task->in_frame, &input, ov_model->model->filter_ctx); +} else { +proc_from_frame_to_dnn(task->in_frame, &input, ctx); +} } +input.data = (uint8_t *)input.data + + input.width * input.height * input.channels * get_datatype_size(input.dt); } ie_blob_free(&input_blob); @@ -152,7 +175,7 @@ static void infer_completion_callback(void *args) precision_e precision; IEStatusCode status; RequestItem *request = args; -TaskItem *task = request->task; +TaskItem *task = request->tasks[0]; ie_blob_t *output_blob = NULL; ie_blob_buffer_t blob_buffer; DNNData output; @@ -194,41 +217,56 @@ static void infer_completion_callback(void *args) output.width= dims.dims[3]; output.dt = precision_to_datatype(precision); output.data = blob_buffer.buffer; -if (task->do_ioproc) { -if (task->ov_model->model->post_proc != NULL) { -task->ov_model->model->post_proc(task->out_frame, &output, task->ov_model->model->filter_ctx); + +av_assert0(request->task_count <= dims.dims[0]); +av_assert0(request->task_count >= 1); +for (int i = 0; i < request->task_count; ++i) { +task = request->tasks[i]; +if (task->do_ioproc) { +if (task->ov_model->model->post_proc != NULL) { +task->ov_model->model->post_proc(task->out_frame, &output, task->ov_model->model->filter_ctx);