From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 4EEC146583 for ; Fri, 21 Jul 2023 13:38:12 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8C5E468C607; Fri, 21 Jul 2023 16:37:59 +0300 (EEST) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 32E0868C3F0 for ; Fri, 21 Jul 2023 16:37:52 +0300 (EEST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 941A95C011B for ; Fri, 21 Jul 2023 09:37:49 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 21 Jul 2023 09:37:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=itanimul.li; h= cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm1; t=1689946669; x=1690033069; bh=CKmzQn0vaG V7nO1uGqenvX/xi8fKwi6x8lAtKntEYZA=; b=AnxwZuH0e29GLbgKdoEGzvs1f5 ROMofn8Mdm6My8uG3wV+9BCn+tWT58HQDsZXGGIPRXXllydxGZDjFwjccSi9BPlj zxf7bvzGMVGRojYJ6Wt+0x7s4FgeevoiiE6RhHKFt2EjxbdNITEW3sC2zpOja4vI XzcLcRKYiF3v65HZah3iohUP0H37Ytv/M+Ci86eRDouUqCUAai0Na6o93HNWncXk G2LqFZtjhqhq+qsDS+Usa7FBkvoYJ4W9DY0hFwwhFhrOzdk8W9d8A073FJFnsvck JTLRbLFV8VIwvfkhrn96DA7NntJZ2wc2RbDjO/BVO7dsy3I9W5YU32GTsxfA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1689946669; x=1690033069; bh=CKmzQn0vaGV7nO1uGqenvX/xi8fK wi6x8lAtKntEYZA=; b=h02VIy6/uPbosfz2o+27JsO2JLqH++itqUlea6UfEGPX Tm6bzsLAQpZarGol6lorf1d/rJMZzuQv+TcdJ0SxJIikCP9nRq9YX4U1o5hCL5Pj jcX3g4sI7RkJ/oGVtDW4juTHvjVAfUaZQAci3CGcE6k73gOiWxmFZdzikYX5Ywp5 ua8KE9LxABjvFDBMFLffa5hWeE5nU9LVyYiiyIXPIQDyBNmBSmrTggG9XFj95ugk c2Mz77jbl57H0WdNBhvhTZ54Nur1Jncf41nMdjLaF9cm7pa1Op2GwrFS/vW1RmLi 51WL4c0OElM2CHcsv41+7xxNIR1iph8nZOu8sGkzzw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrhedvgdeivdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffoggfgsedtkeertdertd dtnecuhfhrohhmpedflfdrucffvghkkhgvrhdfuceojhguvghksehithgrnhhimhhulhdr lhhiqeenucggtffrrghtthgvrhhnpeeutefgtdeuvdejjeejvdetleffueehtdeftedugf elhfejueektedvvddtveeiieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpehjuggvkhesihhtrghnihhmuhhlrdhlih X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 21 Jul 2023 09:37:48 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Jul 2023 15:37:40 +0200 Message-ID: <20230721133746.33335-1-jdek@itanimul.li> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/7] lavu: add ecinfo sidedata X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Add sidedata for passing basic Error Concealment information helpful to a renderer or end user attempting to filter or conceal video decoding errors and artifacts. Co-Authored-By: Thomas Guillem Signed-off-by: J. Dekker --- libavutil/Makefile | 2 ++ libavutil/ec.c | 42 +++++++++++++++++++++++++++++ libavutil/ec.h | 66 +++++++++++++++++++++++++++++++++++++++++++++ libavutil/frame.c | 1 + libavutil/frame.h | 6 +++++ libavutil/version.h | 2 +- 6 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 libavutil/ec.c create mode 100644 libavutil/ec.h diff --git a/libavutil/Makefile b/libavutil/Makefile index bd9c6f9e32..81b6b1fb8a 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -28,6 +28,7 @@ HEADERS = adler32.h \ display.h \ dovi_meta.h \ downmix_info.h \ + ec.h \ encryption_info.h \ error.h \ eval.h \ @@ -124,6 +125,7 @@ OBJS = adler32.o \ dovi_meta.o \ downmix_info.o \ encryption_info.o \ + ec.o \ error.o \ eval.o \ fifo.o \ diff --git a/libavutil/ec.c b/libavutil/ec.c new file mode 100644 index 0000000000..762accd0a6 --- /dev/null +++ b/libavutil/ec.c @@ -0,0 +1,42 @@ +/* + * 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 + */ + +#include "config.h" +#include "ec.h" + +AVECInfo *av_eci_create_side_data(AVFrame *f) +{ + AVBufferRef *buf = NULL; + AVECInfo *eci = av_mallocz(sizeof(AVECInfo)); + + if (!eci) + return NULL; + + buf = av_buffer_create((uint8_t *)eci, sizeof(AVECInfo), NULL, NULL, 0); + if (!buf) { + av_freep(&eci); + return NULL; + } + + if (!av_frame_new_side_data_from_buf(f, AV_FRAME_DATA_EC_INFO, buf)) { + av_buffer_unref(&buf); + return NULL; + } + + return eci; +} diff --git a/libavutil/ec.h b/libavutil/ec.h new file mode 100644 index 0000000000..439fe876a2 --- /dev/null +++ b/libavutil/ec.h @@ -0,0 +1,66 @@ +/* + * 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_EC_H +#define AVUTIL_EC_H + +#include +#include +#include + +#include "libavutil/mem.h" +#include "libavutil/frame.h" + +/** + * Error Concealment information helpful to a renderer or end user + * attempting to filter or conceal video decoding errors and artifacts. + */ +typedef struct AVECInfo { + /** + * Integer estimating how many pixels of the video frame had decoding + * errors. + */ + uint64_t error; + /** + * Integer estimating how many pixels of the video frame decoded + * without error. + */ + uint64_t ok; + /** + * Integer estimating how many pixels of the video frame's reference + * frames had decoding errors. + */ + uint64_t ref_error; + /** + * Integer estimating how many pixels of the video frame's reference + * frames decoded without error. + */ + uint64_t ref_ok; +} AVECInfo; + +static inline void av_eci_reset(AVECInfo *info) +{ + info->error = info->ok = info->ref_error = info->ref_ok = 0; +} + +/** + * Creates AVECInfo in a specified frame as side data. + */ +AVECInfo *av_eci_create_side_data(AVFrame *f); + +#endif /* AVUTIL_EC_H */ diff --git a/libavutil/frame.c b/libavutil/frame.c index b6cee2d886..30a838bf22 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -960,6 +960,7 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type) case AV_FRAME_DATA_DOVI_RPU_BUFFER: return "Dolby Vision RPU Data"; case AV_FRAME_DATA_DOVI_METADATA: return "Dolby Vision Metadata"; case AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT: return "Ambient viewing environment"; + case AV_FRAME_DATA_EC_INFO: return "Error Concealment Information"; } return NULL; } diff --git a/libavutil/frame.h b/libavutil/frame.h index a491315f25..08c6b96d29 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -214,6 +214,12 @@ enum AVFrameSideDataType { * Ambient viewing environment metadata, as defined by H.274. */ AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT, + /** + * Error Concealment Information helpful to a renderer attempting to filter + * or conceal video decoding errors and artifacts. See AVECInfo defined in + * libavutil/error.h. + */ + AV_FRAME_DATA_EC_INFO, }; enum AVActiveFormatDescription { diff --git a/libavutil/version.h b/libavutil/version.h index 24af520e08..9e798b0e3f 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 58 -#define LIBAVUTIL_VERSION_MINOR 14 +#define LIBAVUTIL_VERSION_MINOR 15 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ -- 2.41.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".