From patchwork Mon Apr 8 07:10:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zachary Zhou X-Patchwork-Id: 12637 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id EC9DB4481D5 for ; Mon, 8 Apr 2019 10:11:45 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CE67F68AA46; Mon, 8 Apr 2019 10:11:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 969ED68A67C for ; Mon, 8 Apr 2019 10:11:38 +0300 (EEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Apr 2019 00:11:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,324,1549958400"; d="scan'208";a="132334367" Received: from jiandon-desk.sh.intel.com ([10.239.193.48]) by orsmga008.jf.intel.com with ESMTP; 08 Apr 2019 00:11:35 -0700 From: Zachary Zhou To: ffmpeg-devel@ffmpeg.org Date: Mon, 8 Apr 2019 15:10:08 +0800 Message-Id: <20190408071010.12955-1-zachary.zhou@intel.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v1 1/3] fftools: Add thumbnail output to vaapi_h264 decoder X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: zachary.zhou@intel.com Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This is sample code for reference HW support for decode+scaling in a single HW command (VDBOX+SFC). The primary target usage is video analytics, but can be used playback, transcoding, etc. For VAAPI - https://github.com/intel/libva basically, it allows multiple outputs (in different resolutions) using the decode context in a single call (you can search for “additional_outputs” in va.h). VAAPI sample code - https://github.com/intel/libva-utils/commit/957a269f02b00760b7e807643c821ee26abc529b --- fftools/ffmpeg_opt.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 53d688b764..bfb0f882b5 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -111,6 +111,10 @@ int filter_nbthreads = 0; int filter_complex_nbthreads = 0; int vstats_version = 2; +int sfc_flags = 0; +int sfc_width = 0; +int sfc_height = 0; +char *sfc_format; static int intra_only = 0; static int file_overwrite = 0; @@ -1100,6 +1104,13 @@ static int open_input_file(OptionsContext *o, const char *filename) av_dict_set(&o->g->format_opts, "scan_all_pmts", "1", AV_DICT_DONT_OVERWRITE); scan_all_pmts_set = 1; } + + //sfc opt + av_dict_set_int(&o->g->codec_opts, "sfc_flags", sfc_flags, AV_DICT_DONT_OVERWRITE); + av_dict_set_int(&o->g->codec_opts, "sfc_width", sfc_width, AV_DICT_DONT_OVERWRITE); + av_dict_set_int(&o->g->codec_opts, "sfc_height", sfc_height, AV_DICT_DONT_OVERWRITE); + av_dict_set(&o->g->codec_opts, "sfc_format", sfc_format, AV_DICT_DONT_OVERWRITE); + /* open the input file with generic avformat function */ err = avformat_open_input(&ic, filename, file_iformat, &o->g->format_opts); if (err < 0) { @@ -2898,6 +2909,13 @@ static int opt_vstats_file(void *optctx, const char *opt, const char *arg) return 0; } +static int opt_sfc_format(void *optctx, const char *opt, const char *arg) +{ + av_free (sfc_format); + sfc_format = av_strdup (arg); + return 0; +} + static int opt_vstats(void *optctx, const char *opt, const char *arg) { char filename[40]; @@ -3746,5 +3764,15 @@ const OptionDef options[] = { { "filter_hw_device", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_hw_device }, "set hardware device used when filtering", "device" }, + //sfc opt + { "sfc_flags", OPT_VIDEO | HAS_ARG | OPT_INT | OPT_INPUT, { &sfc_flags }, + "set sfc flags", "sfc" }, + { "sfc_width", OPT_VIDEO | HAS_ARG | OPT_INT | OPT_INPUT, { &sfc_width }, + "set sfc width", "sfc" }, + { "sfc_height", OPT_VIDEO | HAS_ARG | OPT_INT | OPT_INPUT, { &sfc_height }, + "set sfc height", "sfc" }, + { "sfc_format", OPT_VIDEO | HAS_ARG | OPT_EXPERT , { .func_arg = opt_sfc_format }, + "set sfc format", "sfc" }, + { NULL, }, };