From: "J. Dekker" <jdek@itanimul.li>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 1/7] lavu: add ecinfo sidedata
Date: Fri, 21 Jul 2023 15:37:40 +0200
Message-ID: <20230721133746.33335-1-jdek@itanimul.li> (raw)
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 <thomas@gllm.fr>
Signed-off-by: J. Dekker <jdek@itanimul.li>
---
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 <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#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".
next reply other threads:[~2023-07-21 13:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-21 13:37 J. Dekker [this message]
2023-07-21 13:37 ` [FFmpeg-devel] [PATCH 2/7] lavc: add AV_CODEC_EXPORT_DATA_ERROR J. Dekker
2023-07-21 13:37 ` [FFmpeg-devel] [PATCH 3/7] lavc/error_resilience: fill ecinfo J. Dekker
2023-07-21 13:37 ` [FFmpeg-devel] [PATCH 4/7] lavc: set decode_error_flags when ec active J. Dekker
2023-07-21 13:37 ` [FFmpeg-devel] [PATCH 5/7] lavc/h264: export ecinfo J. Dekker
2023-07-21 13:37 ` [FFmpeg-devel] [PATCH 6/7] tools/ffprobe: add ecinfo frame side data J. Dekker
2023-07-21 13:47 ` [FFmpeg-devel] [PATCH 6/7 v1.1] " J. Dekker
2023-07-21 13:37 ` [FFmpeg-devel] [PATCH 7/7] fate: add ecinfo sidedata test J. Dekker
2023-07-21 14:44 ` [FFmpeg-devel] [PATCH 1/7] lavu: add ecinfo sidedata Devin Heitmueller
2023-07-25 12:05 ` J. Dekker
2023-07-25 22:00 ` Michael Niedermayer
2023-07-21 23:49 ` Michael Niedermayer
[not found] ` <20230721133746.33335-1-jdek@itanimul.li-N_sf260--B-9>
2023-07-22 0:12 ` Lynne
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230721133746.33335-1-jdek@itanimul.li \
--to=jdek@itanimul.li \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git