From patchwork Mon Jun 8 08:58:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Linjie" X-Patchwork-Id: 20198 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 65DC844B837 for ; Mon, 8 Jun 2020 12:02:58 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3CE0E6882D5; Mon, 8 Jun 2020 12:02:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4022A6809B4 for ; Mon, 8 Jun 2020 12:02:51 +0300 (EEST) IronPort-SDR: zESIxQ+89GRv2jVamLjbvjvFlvieUlzRGhSXJx1S5KGhvYCLrcsCtiLi6phcyXKUAQA7yxS4fb 57d5S4O1u+Nw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2020 02:02:48 -0700 IronPort-SDR: vVXm4SBGbrHUACgpUbVwXHOeI5NSdfkpv6jGKAYEqhvTNVcBhTbIY9JjqTB3OIJHILjb9T0IyN le1lt1WJwzwQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,487,1583222400"; d="scan'208";a="472625244" Received: from icl-dev.sh.intel.com ([10.239.158.73]) by fmsmga005.fm.intel.com with ESMTP; 08 Jun 2020 02:02:47 -0700 From: Linjie Fu To: ffmpeg-devel@ffmpeg.org Date: Mon, 8 Jun 2020 16:58:03 +0800 Message-Id: <1591606685-4450-1-git-send-email-linjie.fu@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [FFmpeg-devel] [PATCH 1/3] lavc/avcodec: Add caps for the support of variable dimension encoding 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: Linjie Fu MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" And declare AV_CODEC_CAP_VARIABLE_DIMENSIONS for rawvideo and wrapped_avframe. Signed-off-by: Linjie Fu --- doc/APIchanges | 3 +++ fftools/cmdutils.c | 2 ++ libavcodec/avcodec.h | 4 +++- libavcodec/codec.h | 5 +++++ libavcodec/rawenc.c | 1 + libavcodec/version.h | 2 +- libavcodec/wrapped_avframe.c | 1 + 7 files changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index c7e4ce3..f4d350c 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2017-10-21 API changes, most recent first: +2020-06-xx - xxxxxxxxxx - lavc 58.90.101 - codec.h + Add AV_CODEC_CAP_VARIABLE_DIMENSIONS. + 2020-06-xx - xxxxxxxxxx - lavu 56.50.100 - buffer.h Passing NULL as alloc argument to av_buffer_pool_init2() is now allowed. diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 13567a7..e0469cd 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -1424,6 +1424,8 @@ static void print_codec(const AVCodec *c) printf("hardware "); if (c->capabilities & AV_CODEC_CAP_HYBRID) printf("hybrid "); + if (c->capabilities & AV_CODEC_CAP_VARIABLE_DIMENSIONS) + printf("multidimension "); if (!c->capabilities) printf("none"); printf("\n"); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index c91b2fd..b435ce6 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -97,7 +97,9 @@ * - For decoding, call avcodec_send_packet() to give the decoder raw * compressed data in an AVPacket. * - For encoding, call avcodec_send_frame() to give the encoder an AVFrame - * containing uncompressed audio or video. + * containing uncompressed audio or video. Video encoder requires input + * frames to be in constant dimensions unless it declare the capability + * of AV_CODEC_CAP_VARIABLE_DIMENSIONS. * * In both cases, it is recommended that AVPackets and AVFrames are * refcounted, or libavcodec might have to copy the input data. (libavformat diff --git a/libavcodec/codec.h b/libavcodec/codec.h index 1fda619..9855477 100644 --- a/libavcodec/codec.h +++ b/libavcodec/codec.h @@ -169,6 +169,11 @@ * remain pending. */ #define AV_CODEC_CAP_ENCODER_FLUSH (1 << 21) +/** + * Codec supports variable dimensions encoding. This indicates that input frames are + * allowed to be in variable dimensions/resolutions, otherwise they have to keep constant. + */ +#define AV_CODEC_CAP_VARIABLE_DIMENSIONS (1 << 22) /** * AVProfile. diff --git a/libavcodec/rawenc.c b/libavcodec/rawenc.c index d181b74..486c0d7 100644 --- a/libavcodec/rawenc.c +++ b/libavcodec/rawenc.c @@ -92,4 +92,5 @@ AVCodec ff_rawvideo_encoder = { .id = AV_CODEC_ID_RAWVIDEO, .init = raw_encode_init, .encode2 = raw_encode, + .capabilities = AV_CODEC_CAP_VARIABLE_DIMENSIONS, }; diff --git a/libavcodec/version.h b/libavcodec/version.h index 524fbc3..4e2cc5d 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MINOR 90 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/libavcodec/wrapped_avframe.c b/libavcodec/wrapped_avframe.c index 85ff32d..ae29328 100644 --- a/libavcodec/wrapped_avframe.c +++ b/libavcodec/wrapped_avframe.c @@ -116,6 +116,7 @@ AVCodec ff_wrapped_avframe_encoder = { .id = AV_CODEC_ID_WRAPPED_AVFRAME, .encode2 = wrapped_avframe_encode, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, + .capabilities = AV_CODEC_CAP_VARIABLE_DIMENSIONS, }; AVCodec ff_wrapped_avframe_decoder = {