From patchwork Fri Jul 21 13:37:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Dekker" X-Patchwork-Id: 42884 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:be1d:b0:130:ccc6:6c4b with SMTP id ge29csp228445pzb; Fri, 21 Jul 2023 06:38:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlFzcHpG06waK/0+NNz4bu/5mnFKPJvhJMHw366JPDC3NU76OWmtyMvljXtrTm0zYKiCDNE5 X-Received: by 2002:a17:906:12:b0:987:5761:2868 with SMTP id 18-20020a170906001200b0098757612868mr1747916eja.11.1689946694992; Fri, 21 Jul 2023 06:38:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689946694; cv=none; d=google.com; s=arc-20160816; b=CksuXbNfzCjBs2wKk1cS+4CRQxX77QZwftSSZdkop3Ahk6NRM9SKmOWPAEyMlyWSUr zJJ6i66/ifC3N+L/1XLUti7v1H+/eHaA9zOBZkc/+ykjv7gYTdSVHe9EtVVQo96EUrYr K4G/PCdH/9W6oP1uvFWmgTodRDYYDY/2ln6VXM5RogBseltJouQfdA5BaFk4rqtjN221 N+OyYuN7gJfGBXRx7PnECb4rfyfVD0e+/ihJJA4o8UTWCWQ5n4OyG+Al7lUx0day1uPE 7OlZJKtsX50ikjOhGRlyU/VXD1WmAGVssq1a7N77hGOd296qd94aSSd0hr11Vd9zClbk xP0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from:feedback-id :dkim-signature:dkim-signature:delivered-to; bh=oPUVJdGOCWEXYilK9zFZUG46uahyDu51AEHQLfvh9s0=; fh=RX379NAUHdZIU7CQlxbXTMt5HBBB5CUKf4o4OtPlQjY=; b=tJRAf+XA95teB8V4nt5wyRNERmd129xy4E+e1NUgsCeU5cimMBdKNAmrqP74XgcwnE Fy+Rrj7X/wzE8NReNE9SUxXWcfey7TBKA575qGMLD5vsR6Z6ObxmTkt0Azl34cLMsMvb JyPUCOuySMp+HqjANFFBDxPNUujfnf7Cvp6leIESDiFoaU9D2fuWDq4pJnZ0UW44yfNu TQ5HU/NUjdmF+6002D1jQy/co9ny3dTTpUzwW4QAe/kfYCrWxf/DcCBjrn7vI4DZy6HU VVSrF0zoDFgdrOlGERqmCVLjNR834/n2ktnu7RL2/Cct80qG1/XqOgN3Nm4ybUGwe7jf XdCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm1 header.b=AnxwZuH0; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm3 header.b="h02VIy6/"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id pg1-20020a170907204100b009926703c4b9si2207770ejb.413.2023.07.21.06.38.14; Fri, 21 Jul 2023 06:38:14 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm1 header.b=AnxwZuH0; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm3 header.b="h02VIy6/"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C9E8E68C3F0; Fri, 21 Jul 2023 16:37:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: bhczbnGZ+pzd 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, \ From patchwork Fri Jul 21 13:37:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Dekker" X-Patchwork-Id: 42883 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:be1d:b0:130:ccc6:6c4b with SMTP id ge29csp228330pzb; Fri, 21 Jul 2023 06:38:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlE4gbsC0SU0w7AoIeO3G3jZ1HB9Aj2SxjzCvn0wgdm00bxVtOyqIHo/1RD1nz6LAR9rFn7C X-Received: by 2002:a17:906:8451:b0:994:1fd2:cf96 with SMTP id e17-20020a170906845100b009941fd2cf96mr1741646ejy.0.1689946684033; Fri, 21 Jul 2023 06:38:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689946684; cv=none; d=google.com; s=arc-20160816; b=tP7efKxUoX/Zc9AJVaZyE9DEpnb1Y3q+lzzHYYRjLJSZJdQIoovfdT0IvlUHcdKFLs KXqEpSRlbSLg0/vGX5HyjHx7B7VMX4E6WahMcoj4so5WQmIa9xSp5ebRTreB+0mTd8Nl DLBjisAZDfsTW6fOor4dFxC+epKo0pc+izihMX+KPJKABjU33TgpCiwTngWgJbwPl0XS qw0BDOeaMoRxqVZngto99V6K30IK4V6INRlq5OeTB8zqq+BANwsQmcB9pVKhZUH4SGAB 22TmVMut0ixGjdjzqgqqix+n++k2/NT2iM90SBuOSu//F/cyG+b4olwFukJPDdn7eCQI QomA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:feedback-id:dkim-signature:dkim-signature:delivered-to; bh=/nnXBrrl2IZ4kEvM5dlPj9Olb5w+th54QDHuoXEjZTs=; fh=RX379NAUHdZIU7CQlxbXTMt5HBBB5CUKf4o4OtPlQjY=; b=X4ZqDO8ZLdtP5zxGxQvR/TXHKEC2tyvyZwosJgktTUcpm7CJXuSmxEOtpCVqw9dj26 kA35H/hFlDDmhoNfZX/02BeE8ObEI3cobQHuQhK4qVtG7MSR2PXUca71PePgw+DPdhlo OEqhFdHhbnb/ev3+rx+Xmv+FBjq7nGI5bC9OXlM1YoLjed05dsmGVqmF/pnhM+/4bbxV LOb+rC2Pz48CaoCken5KEEityaAl6USpcFl9wX0M8T8lzqfgF1lkY4skrsNImHBidXFy NomwlptfGoWU934YNCw7ZR3PxZcQriDWpYSwgwNarciIw4SKRUBRt17UOPKjYmpB62wq gXAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm1 header.b=lP4IWKGO; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm3 header.b=0tmzTskH; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a12-20020a1709066d4c00b00992bf74c316si2191289ejt.974.2023.07.21.06.38.03; Fri, 21 Jul 2023 06:38:04 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm1 header.b=lP4IWKGO; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm3 header.b=0tmzTskH; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AD50268C5C7; Fri, 21 Jul 2023 16:37:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2FF0F68C1B8 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 7BFED5C00E4 for ; Fri, 21 Jul 2023 09:37:50 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 21 Jul 2023 09:37:50 -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:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1689946670; x= 1690033070; bh=W0BBqZM48XwTr14WH7K12GYo3LyKZA9FVY1J+BPBmo4=; b=l P4IWKGOby54OYts2efLrXpXpxvIejgcq9kCxA6N/TcHTNc12qpO3eXkHgQDKefMJ wOGgnSncDyPv6kLJq7YM3BMSXi7i/jvq1W69TahsMndNptIltTALBjPjtdgBFg2n 9RTB3ijpLByy/oVkXMfliKE3ARwAnQsVfXHfWHVRGkOU/1JmvFCDCOay9PVvNhRd H7D7CZPzXU4eAabpDuMOisoe12IpwOoHV0Waj3UXUwjXqhMjCxktnfqFsqqQrEmQ a8m/pO4sp2GdWVLW6tgRHmZxWmJ+stNQS/AU2S81SaM5QHNoPFdkQEMhn4HH4Sxq GtSA2GZDqScaZVDlFUP4w== 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 :in-reply-to:message-id:mime-version:references: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=1689946670; x=1690033070; bh=W 0BBqZM48XwTr14WH7K12GYo3LyKZA9FVY1J+BPBmo4=; b=0tmzTskHuHxrknaSu dFvQofNCE/y4tdNKA1FOvD+Qe690ArJQUe6QxirFZXEBesLm/TB2wxZ1C9yzayzI 3oaBrWoA0At+Nz7/BXWedoU/+8/LhJjFd4gW6u+pLd9E+JXSETqhn10Bi4aM5OVj BVH/OQmDroTqCwQ9hRfiXa9461Pv1O7LsW/HcPHvTEiTx3sztNcISoCAB0Me2Jp6 o71RR8epCw9KDg+cCj9V6JdMP9MHCFBKQzRMeQjXJpuJW4ykcHNvWhI3t0K9fxjq 5ewXL1tgTxkNdmJMQsYNRYXMYeRlkFaTV4En4xMGPumhhcZeAcuKetp5nUVzfKpF T6O/Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrhedvgdeivdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpedflfdrucffvghkkhgvrhdfuceojhguvghksehithgrnhhimhhu lhdrlhhiqeenucggtffrrghtthgvrhhnpeegvdfhffduudegheevieekieeffefgveffke dtheekieefhfevueetueefhfetteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgr mhepmhgrihhlfhhrohhmpehjuggvkhesihhtrghnihhmuhhlrdhlih X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 21 Jul 2023 09:37:49 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Jul 2023 15:37:41 +0200 Message-ID: <20230721133746.33335-2-jdek@itanimul.li> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230721133746.33335-1-jdek@itanimul.li> References: <20230721133746.33335-1-jdek@itanimul.li> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/7] lavc: add AV_CODEC_EXPORT_DATA_ERROR 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Tgv3HD838MRN Add an option to avcodec to allow supported decoders to optionally output information about error resilience as sidedata. Co-Authored-By: Thomas Guillem Signed-off-by: J. Dekker --- libavcodec/avcodec.h | 5 +++++ libavcodec/options_table.h | 1 + libavcodec/version.h | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index fe41ecc3c9..7400604fc5 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -410,6 +410,11 @@ typedef struct RcOverride{ * Do not apply film grain, export it instead. */ #define AV_CODEC_EXPORT_DATA_FILM_GRAIN (1 << 3) +/** + * Decoding only. + * Export the AVECInfo structure through frame side data. + */ +#define AV_CODEC_EXPORT_DATA_ERROR (1 << 4) /** * The decoder will keep a reference to the frame and may reuse it later. diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index bb4b894b06..0a1dc4b062 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -91,6 +91,7 @@ static const AVOption avcodec_options[] = { {"prft", "export Producer Reference Time through packet side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_PRFT}, INT_MIN, INT_MAX, A|V|S|E, "export_side_data"}, {"venc_params", "export video encoding parameters through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS}, INT_MIN, INT_MAX, V|D, "export_side_data"}, {"film_grain", "export film grain parameters through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_FILM_GRAIN}, INT_MIN, INT_MAX, V|D, "export_side_data"}, +{"error_info", "export error info through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_ERROR}, INT_MIN, INT_MAX, V|D, "export_side_data"}, {"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, 0, INT_MAX}, {"g", "set the group of picture (GOP) size", OFFSET(gop_size), AV_OPT_TYPE_INT, {.i64 = 12 }, INT_MIN, INT_MAX, V|E}, {"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E}, diff --git a/libavcodec/version.h b/libavcodec/version.h index 9411511e04..728ab8839d 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 22 +#define LIBAVCODEC_VERSION_MINOR 23 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ From patchwork Fri Jul 21 13:37:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Dekker" X-Patchwork-Id: 42885 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:be1d:b0:130:ccc6:6c4b with SMTP id ge29csp228528pzb; Fri, 21 Jul 2023 06:38:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlE1d7v6sYFT66qu4nXnZJF+rN+Vm11K4Q2gRImd8C8+MmB6ITFxEGBieOMnLyzqO4qYCHqX X-Received: by 2002:a17:907:c29:b0:993:f664:ce25 with SMTP id ga41-20020a1709070c2900b00993f664ce25mr10491910ejc.19.1689946704732; Fri, 21 Jul 2023 06:38:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689946704; cv=none; d=google.com; s=arc-20160816; b=EgQMcokKggSZiIQk8sshQFTV8zFgR4jV/07tiw8c0pr0DIMYUfu9aDaOKk7dThqP/r EPo/Wp9s6aQGjNX6DDDAjiECFk4FcOSJPx6wHqK4oz8vKPbCnxLkqeVONp7ZjTlWflFv TK1zzP/8Ih0OpmsKmmRyxduTBnJ35EKdTWsUlrz/C6FNqaKDKv+vrLRdvKggITv10YzI C3BLB5N9OyteD9L1/FWBbZ8ACoaNAYDxau5s4D338B74NAzPFegPIpfKEebu300G5hAI 0petmsM2zxiOL4/qLkDQO1XRj0doja4y7EOSBRBeNBPUUuDx4VoM91lV6dALjsW21HbX 3Jfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:feedback-id:dkim-signature:dkim-signature:delivered-to; bh=XPDQvvMxc2VDuQHi2gV4j0t4ShI7LMPOSxpKoSGMy7A=; fh=RX379NAUHdZIU7CQlxbXTMt5HBBB5CUKf4o4OtPlQjY=; b=CskbZofbetdzv+8Yiba+OaQ74vnpQ8a0DKd+Qrxxt65jyY7o8X0+Wc5lYn+Fy8/3T/ +JfU55uqAoKzADL4A+oJ2ZAjHUWfrPRvWhHG8BE+vvL9HRU5pmCHMM3IZvteen6cpYIy kCIpn8zNX5OAN3hAEX8xpDh0OhOnBdxcC/4flKiQ3VTEdIFkIUyf8MRmkxxNHnW6Subg w23nH8wR952ZLXNSR5/JGgvjKDZ3kNjUDwKe/dY9U34Umu11jBvI0a8yj5Q4/0h5uoR7 UHB8pYb37Vuo0xlvdypbpaMIzDiqh3JW9TlvmiIh094q28QVOrETiW4uAANNdy25lpeA EbaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm1 header.b=K2ATTkPf; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm3 header.b=RQmt0SAa; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id h11-20020aa7de0b000000b0051e05cd6191si2301365edv.28.2023.07.21.06.38.24; Fri, 21 Jul 2023 06:38:24 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm1 header.b=K2ATTkPf; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm3 header.b=RQmt0SAa; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E9DA268BE88; Fri, 21 Jul 2023 16:38:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4686F68C50A 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 6828A5C0152 for ; Fri, 21 Jul 2023 09:37:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 21 Jul 2023 09:37:51 -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:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1689946671; x= 1690033071; bh=a99xMkyUHPVI5hgR8eKAChGM4msynWHyYwPHg21+YBU=; b=K 2ATTkPftS7BtGGi5oHiJcwGVou70rhrLl1IlWauzhi4cCTQzSrLoPjbbY7uj+LWu Dn6OZREhMjcgDSHyX4pSZ7D9H6MDb1uoL3yXVxegf+FsGvZrUARTRx9Zv6wtAU80 Dp8REFwF+/U/PpHt8UN2agvXMRFi7A0fWLDafS4GobRTpyKhsysrxcctr4Z8j3z6 KphIPm+8vvIjF+fZzjou0ZPZVihTJQCGPTuQ/igVNH74p++GDZAR3D9QK4lAwfh4 z2rsYhRKc1juDEkfKXsk41ds/Dr8Inm+sxLlg/20aaBJtf2vlni/6Eax416Vb3Ww KV6By6jyvNKyuaHtBBmIQ== 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 :in-reply-to:message-id:mime-version:references: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=1689946671; x=1690033071; bh=a 99xMkyUHPVI5hgR8eKAChGM4msynWHyYwPHg21+YBU=; b=RQmt0SAabMrhZEuvv I4CZE+OFTIY26WtppVperIh/g4quxti3l5e367zMxSx1XW1mVab6xCzJpLCiRG0y W6o/tHKlEFrx2x4iiJIbtmp7gxb+2gkvC16Hp6NCnGIAA/56AQLhsAByVQa7AEGa u40ar3fIykgLVNDmOQHmZ9SResahxiV01jmRM30BVqeRo5TzGHJoyNi2uzhUcpVb OPjzA3gu/VsP/HVvVnWGsb5j50ruaDXr9UySW1iUn1kagsxngVTHnU7yFf3UPpLH 0G2lovyXkornEInc0zLbLkeleXFPKdRFoAdLvEtDPjB4/B282/8J7GoTN+2lKbVf di0Qw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrhedvgdeivdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpedflfdrucffvghkkhgvrhdfuceojhguvghksehithgrnhhimhhu lhdrlhhiqeenucggtffrrghtthgvrhhnpeegvdfhffduudegheevieekieeffefgveffke dtheekieefhfevueetueefhfetteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgr mhepmhgrihhlfhhrohhmpehjuggvkhesihhtrghnihhmuhhlrdhlih X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 21 Jul 2023 09:37:50 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Jul 2023 15:37:42 +0200 Message-ID: <20230721133746.33335-3-jdek@itanimul.li> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230721133746.33335-1-jdek@itanimul.li> References: <20230721133746.33335-1-jdek@itanimul.li> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/7] lavc/error_resilience: fill ecinfo 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: RTamLCcDtwkp Fill ECInfo inside error resilience using references set by the decoder. Co-Authored-By: Thomas Guillem Signed-off-by: J. Dekker --- libavcodec/error_resilience.c | 91 +++++++++++++++++++++++++++++------ libavcodec/error_resilience.h | 4 +- 2 files changed, 79 insertions(+), 16 deletions(-) diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index 2aa6f1d864..c1417ecf07 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -28,6 +28,7 @@ #include #include "libavutil/internal.h" +#include "libavutil/ec.h" #include "avcodec.h" #include "error_resilience.h" #include "me_cmp.h" @@ -411,7 +412,7 @@ static void guess_mv(ERContext *s) num_avail = 0; if (s->last_pic.motion_val[0]) - ff_thread_await_progress(s->last_pic.tf, mb_height-1, 0); + ff_thread_await_progress(s->last_pic.tf, INT_MAX, 0); for (i = 0; i < mb_width * mb_height; i++) { const int mb_xy = s->mb_index2xy[i]; int f = 0; @@ -889,25 +890,61 @@ void ff_er_add_slice(ERContext *s, int startx, int starty, } } -void ff_er_frame_end(ERContext *s) +static void +er_fill_info_ref(ERContext *s) +{ + uint64_t acc_ok = 0, acc_err = 0; + av_assert0(s->cur_pic.info); + + if (s->cur_pic.f->pict_type != AV_PICTURE_TYPE_I) { + ERPicture *reffs[2] = {&s->last_pic, &s->next_pic}; + int i, nb_ref_pics = s->cur_pic.f->pict_type == AV_PICTURE_TYPE_B ? 2 : 1; + + for (i = 0; i < nb_ref_pics; i++) { + ERPicture *reff = reffs[i]; + + if (reff->info == NULL) + continue; + + ff_thread_await_progress(reff->tf, INT_MAX, 0); + + /* should check more accurately how refs are used */ + if (reff->info->error == 0 && reff->info->ref_error == 0) + continue; + + if (acc_err < (reff->info->error + reff->info->ref_error)){ + acc_err = reff->info->error + reff->info->ref_error; + acc_ok = reff->info->ok + reff->info->ref_ok; + } + } + } + + s->cur_pic.info->ref_error = acc_err; + s->cur_pic.info->ref_ok = acc_ok; +} + +int ff_er_frame_end(ERContext *s) { int *linesize = NULL; - int i, mb_x, mb_y, error, error_type, dc_error, mv_error, ac_error; + int i, mb_x, mb_y, error, error_type, dc_error, mv_error, ac_error, terror; int distance; int threshold_part[4] = { 100, 100, 100 }; int threshold = 50; int is_intra_likely; int size = s->b8_stride * 2 * s->mb_height; + /* We do not support ER of field pictures yet, * though it should not crash if enabled. */ - if (!s->avctx->error_concealment || !atomic_load(&s->error_count) || - s->avctx->lowres || - !er_supported(s) || - atomic_load(&s->error_count) == 3 * s->mb_width * - (s->avctx->skip_top + s->avctx->skip_bottom)) { - return; + if (!s->avctx->error_concealment || s->avctx->lowres || !er_supported(s)) + return 0; + + if (!atomic_load(&s->error_count) || + atomic_load(&s->error_count) == 3 * s->mb_width * (s->avctx->skip_top + s->avctx->skip_bottom)) + { + goto end_find_ref_errs; } + linesize = s->cur_pic.f->linesize; if ( s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO @@ -921,7 +958,7 @@ void ff_er_frame_end(ERContext *s) if (mb_x == s->mb_width) { av_log(s->avctx, AV_LOG_DEBUG, "ignoring last missing slice\n"); - return; + goto end_find_ref_errs; } } @@ -960,7 +997,7 @@ void ff_er_frame_end(ERContext *s) s->cur_pic.ref_index[i] = NULL; s->cur_pic.motion_val[i] = NULL; } - return; + goto end_find_ref_errs; } } @@ -1100,10 +1137,12 @@ void ff_er_frame_end(ERContext *s) } #endif - dc_error = ac_error = mv_error = 0; + terror = dc_error = ac_error = mv_error = 0; for (i = 0; i < s->mb_num; i++) { const int mb_xy = s->mb_index2xy[i]; int error = s->error_status_table[mb_xy]; + if (error) + terror++; if (error & ER_DC_ERROR) dc_error++; if (error & ER_AC_ERROR) @@ -1111,10 +1150,9 @@ void ff_er_frame_end(ERContext *s) if (error & ER_MV_ERROR) mv_error++; } - av_log(s->avctx, AV_LOG_INFO, "concealing %d DC, %d AC, %d MV errors in %c frame\n", - dc_error, ac_error, mv_error, av_get_picture_type_char(s->cur_pic.f->pict_type)); - s->cur_pic.f->decode_error_flags |= FF_DECODE_ERROR_CONCEALMENT_ACTIVE; + fprintf(stderr, "concealing %d DC, %d AC, %d MV errors in %c frame: %d\n", + dc_error, ac_error, mv_error, av_get_picture_type_char(s->cur_pic.f->pict_type), terror * 256); is_intra_likely = is_intra_more_likely(s); @@ -1349,7 +1387,30 @@ void ff_er_frame_end(ERContext *s) s->cur_pic.motion_val[i] = NULL; } + av_assert0(terror); + if (s->cur_pic.info) { + /* assumes 16x16 mbs */ + s->cur_pic.info->error = terror * 256; + s->cur_pic.info->ok = (s->mb_num - terror) * 256; + er_fill_info_ref(s); + } + + memset(&s->cur_pic, 0, sizeof(ERPicture)); + memset(&s->last_pic, 0, sizeof(ERPicture)); + memset(&s->next_pic, 0, sizeof(ERPicture)); + + return 1; + +end_find_ref_errs: + if (s->cur_pic.info) + { + er_fill_info_ref(s); + s->cur_pic.info->error = s->cur_pic.info->ok = 0; + } + memset(&s->cur_pic, 0, sizeof(ERPicture)); memset(&s->last_pic, 0, sizeof(ERPicture)); memset(&s->next_pic, 0, sizeof(ERPicture)); + + return 0; } diff --git a/libavcodec/error_resilience.h b/libavcodec/error_resilience.h index 47cc8a4fc6..97479d2c0c 100644 --- a/libavcodec/error_resilience.h +++ b/libavcodec/error_resilience.h @@ -25,6 +25,7 @@ #include "avcodec.h" #include "me_cmp.h" #include "threadframe.h" +#include "libavutil/ec.h" ///< current MB is the first after a resync marker #define VP_START 1 @@ -48,6 +49,7 @@ typedef struct ERPicture { uint32_t *mb_type; int field_picture; + AVECInfo *info; } ERPicture; typedef struct ERContext { @@ -90,7 +92,7 @@ typedef struct ERContext { } ERContext; void ff_er_frame_start(ERContext *s); -void ff_er_frame_end(ERContext *s); +int ff_er_frame_end(ERContext *s); void ff_er_add_slice(ERContext *s, int startx, int starty, int endx, int endy, int status); From patchwork Fri Jul 21 13:37:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Dekker" X-Patchwork-Id: 42886 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:be1d:b0:130:ccc6:6c4b with SMTP id ge29csp228613pzb; Fri, 21 Jul 2023 06:38:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlFNS0K6EyqUPpnhvYWFBKWjruLb6KD3H+j5LYLcdJKCvmu7fbM8CFiSog80xwQA0JfLZPwt X-Received: by 2002:a17:906:7a1b:b0:98e:1c4b:10bb with SMTP id d27-20020a1709067a1b00b0098e1c4b10bbmr1697485ejo.35.1689946713426; Fri, 21 Jul 2023 06:38:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689946713; cv=none; d=google.com; s=arc-20160816; b=zSKV4/c4WLC88yK99XsJPtdbXkgFl4WPow8/C4EOf5GuG1mYymT6j4GHWI/ikuGmDk bUZWJvN53EA9+cw7xYDC36PpiIwRk79ki8aMYGsKnW098I8XZDtKjzOxUuXqIXjKHp+K Rk1XOCdwo+caFw8k9Gy7EajNxuoGuSQ74vBR/jaLMm1qRecbLBBjWN4XBIgiidVrfl3Z TsrAfjZdTbxteIuYZ9x1XYgptKco3qzfypKssfxyMVsRyrwSOzglVVuaqbzKHnZnZKed iL/L179WzxS20IGss78gBnPns6zpn+/aObe4z/9w2s2yGXCEHlxvOOjbKo2Tvxz20zDh 3SnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:feedback-id:dkim-signature:dkim-signature:delivered-to; bh=dkMJkzt7Afhjk4XrM57mBNCZv4tifBJE4t1Du2DSJ8g=; fh=RX379NAUHdZIU7CQlxbXTMt5HBBB5CUKf4o4OtPlQjY=; b=Bw4ElxNq5dee3v4zfxK67utOT8ED61eOb8El7WDTUtvIQeVaFZ64nN1p3/fNVnM5IX jVh/eYApdbj0iDVxB2HNQccIZIzsfgvEq2AfMOpe9fwZdxvfiYrciYw4NR6j7GtCRNjG 2k4KMRNF7ea241Xjk06vhz5yx28G83j+8SAostLtBKUySq4VBiUtTxmC/Rx3u3u+uc+0 cz6xsSszaWlFiyX8l8mZpk8th3QfqK5kVexHjMzdgk+ejH5c4b9b9EfIy8rz+B2PFrMW uyCkeINnsozZ/xW4Z9+n34gSmFuhx4yzrBZtkRDCo69MFJBEhT88sJeza9xRBDTSGabE VnAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm1 header.b=XqlFDkR3; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm3 header.b=AfcpOKnE; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ot18-20020a170906ccd200b0099b495adc29si2053620ejb.545.2023.07.21.06.38.33; Fri, 21 Jul 2023 06:38:33 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm1 header.b=XqlFDkR3; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm3 header.b=AfcpOKnE; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 34DED68C638; Fri, 21 Jul 2023 16:38:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 37D6968C1B8 for ; Fri, 21 Jul 2023 16:37:53 +0300 (EEST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 525595C0167 for ; Fri, 21 Jul 2023 09:37:52 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 21 Jul 2023 09:37:52 -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:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1689946672; x= 1690033072; bh=buSnVS+aLDQ552UrZEV5btzaCDrpUUIdNu37FDBmJ18=; b=X qlFDkR3Heq4YMUE0g+dhCB3MJv4+OcUsHxV5eUMvny1qCXd5qeO0w008S5fLkR/m qiZU7QI41cNX2m2JXjLbfYH32iSqJRnzkLJSecr4jYmnEgzVjt/vRYs1URAjdcJk Bjkr+oPxtJM6l+kIVoZ+UTqAY4wDoB6DbsD3SwXFTZR1BIPEnQjCmyZPaeKUqlFM XmxJ/SGOwxwkFzwiLVeEskWOsg5W6ICkJ7R/EJmLCGguy4+uBUNU9roCUGyduRYb a54jrGDEywpUSXYT20/JQq08E0YMM59POEftC7FxaN4f7TKSBs6tDT/lBcZPKLBm A2gAONTfi3UhcNMKhH1iw== 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 :in-reply-to:message-id:mime-version:references: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=1689946672; x=1690033072; bh=b uSnVS+aLDQ552UrZEV5btzaCDrpUUIdNu37FDBmJ18=; b=AfcpOKnEOrfzWsUlU LIJLA85wQOciWz4HIS8c/PzXNt7Ajg4YM5Ed3v81taM+SuEq9QUzFV/oSiQwMC/7 fl5kondWPs2ycKvbHQTgdI1oBYWyaAg/mTQRphSGF6n2LTGckbFPZa09GcaXi5By S0npoLFvX4EdZw4n6HhcPbHB6eKcyVWdcTjwsTLFS3wyaMrNFhx/Sl5+loRsNsx8 7xsKcj/VSjQjxI/hkFinwUuhC7VGVA54UmF9tT5LfdPJVRkGkuaUR9CMaI/vsp0Q zSNpY3OvQimGaKsKV1IlLS/O6kCAJxlJGcTcvi8shbYH9JBf+8GhXo8Vn6u+IxMu oXY2Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrhedvgdeifecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpedflfdrucffvghkkhgvrhdfuceojhguvghksehithgrnhhimhhu lhdrlhhiqeenucggtffrrghtthgvrhhnpeegvdfhffduudegheevieekieeffefgveffke dtheekieefhfevueetueefhfetteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgr mhepmhgrihhlfhhrohhmpehjuggvkhesihhtrghnihhmuhhlrdhlih X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 21 Jul 2023 09:37:51 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Jul 2023 15:37:43 +0200 Message-ID: <20230721133746.33335-4-jdek@itanimul.li> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230721133746.33335-1-jdek@itanimul.li> References: <20230721133746.33335-1-jdek@itanimul.li> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/7] lavc: set decode_error_flags when ec active 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: gEflbt0Pvr+W FF_DECODE_ERROR_CONCEALMENT_ACTIVE should be set when ec is active on supported decoders. Co-Authored-By: Thomas Guillem Signed-off-by: J. Dekker --- libavcodec/h263dec.c | 6 ++++-- libavcodec/mpeg12dec.c | 3 ++- libavcodec/mss2.c | 8 +++++--- libavcodec/rv10.c | 10 ++++++++-- libavcodec/rv34.c | 12 +++++++++--- libavcodec/vc1dec.c | 6 ++++-- 6 files changed, 32 insertions(+), 13 deletions(-) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 68a618a7ed..f3b9f09303 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -620,8 +620,10 @@ retry: av_assert1(s->bitstream_buffer_size == 0); frame_end: - if (!s->studio_profile) - ff_er_frame_end(&s->er); + if (!s->studio_profile) { + if (ff_er_frame_end(&s->er) > 0) + s->current_picture.f->decode_error_flags |= FF_DECODE_ERROR_CONCEALMENT_ACTIVE; + } if (avctx->hwaccel) { ret = avctx->hwaccel->end_frame(avctx); diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 27b45c6fc4..82a1e56b67 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2038,7 +2038,8 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict) if (/* s->mb_y << field_pic == s->mb_height && */ !s->first_field && !s1->first_slice) { /* end of image */ - ff_er_frame_end(&s->er); + if (ff_er_frame_end(&s->er) > 0) + s->current_picture_ptr->f->decode_error_flags |= FF_DECODE_ERROR_CONCEALMENT_ACTIVE; ff_mpv_frame_end(s); diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index 98103f7fed..851346b0ad 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -421,8 +421,12 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size, ff_vc1_decode_blocks(v); + f = s->current_picture.f; + if (v->end_mb_x == s->mb_width && s->end_mb_y == s->mb_height) { - ff_er_frame_end(&s->er); + if (ff_er_frame_end(&s->er) > 0) + f->decode_error_flags |= FF_DECODE_ERROR_CONCEALMENT_ACTIVE; + } else { av_log(v->s.avctx, AV_LOG_WARNING, "disabling error correction due to block count mismatch %dx%d != %dx%d\n", @@ -431,8 +435,6 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size, ff_mpv_frame_end(s); - f = s->current_picture.f; - if (v->respic == 3) { ctx->dsp.upsample_plane(f->data[0], f->linesize[0], w, h); ctx->dsp.upsample_plane(f->data[1], f->linesize[1], w+1 >> 1, h+1 >> 1); diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index bb1ead5002..09a1d4dba6 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -440,6 +440,12 @@ static av_cold int rv10_decode_end(AVCodecContext *avctx) return 0; } +static void rv10_er_frame_end(MpegEncContext *s) +{ + if (ff_er_frame_end(&s->er) > 0) + s->current_picture_ptr->f->decode_error_flags |= FF_DECODE_ERROR_CONCEALMENT_ACTIVE; +} + static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, int buf_size, int buf_size2, int whole_size) { @@ -477,7 +483,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, if ((s->mb_x == 0 && s->mb_y == 0) || !s->current_picture_ptr) { // FIXME write parser so we always have complete frames? if (s->current_picture_ptr) { - ff_er_frame_end(&s->er); + rv10_er_frame_end(s); ff_mpv_frame_end(s); s->mb_x = s->mb_y = s->resync_mb_x = s->resync_mb_y = 0; } @@ -649,7 +655,7 @@ static int rv10_decode_frame(AVCodecContext *avctx, AVFrame *pict, } if (s->current_picture_ptr && s->mb_y >= s->mb_height) { - ff_er_frame_end(&s->er); + rv10_er_frame_end(s); ff_mpv_frame_end(s); if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index 51f18147af..c6231adf5f 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -1554,13 +1554,19 @@ static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n, in return buf_size; } +static void rv34_er_frame_end(MpegEncContext *s) +{ + if (ff_er_frame_end(&s->er) > 0) + s->current_picture_ptr->f->decode_error_flags |= FF_DECODE_ERROR_CONCEALMENT_ACTIVE; +} + static int finish_frame(AVCodecContext *avctx, AVFrame *pict) { RV34DecContext *r = avctx->priv_data; MpegEncContext *s = &r->s; int got_picture = 0, ret; - ff_er_frame_end(&s->er); + rv34_er_frame_end(s); ff_mpv_frame_end(s); s->mb_num_left = 0; @@ -1655,7 +1661,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, av_log(avctx, AV_LOG_ERROR, "New frame but still %d MB left.\n", s->mb_num_left); if (!s->context_reinit) - ff_er_frame_end(&s->er); + rv34_er_frame_end(s); ff_mpv_frame_end(s); } @@ -1790,7 +1796,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, av_log(avctx, AV_LOG_INFO, "marking unfished frame as finished\n"); /* always mark the current frame as finished, frame-mt supports * only complete frames */ - ff_er_frame_end(&s->er); + rv34_er_frame_end(s); ff_mpv_frame_end(s); s->mb_num_left = 0; ff_thread_report_progress(&s->current_picture_ptr->tf, INT_MAX, 0); diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 9e343d003f..d930502176 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -1321,8 +1321,10 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, } if ( !v->field_mode && avctx->codec_id != AV_CODEC_ID_WMV3IMAGE - && avctx->codec_id != AV_CODEC_ID_VC1IMAGE) - ff_er_frame_end(&s->er); + && avctx->codec_id != AV_CODEC_ID_VC1IMAGE) { + if (ff_er_frame_end(&s->er) > 0) + s->current_picture.f->decode_error_flags |= FF_DECODE_ERROR_CONCEALMENT_ACTIVE; + } } ff_mpv_frame_end(s); From patchwork Fri Jul 21 13:37:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Dekker" X-Patchwork-Id: 42887 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:be1d:b0:130:ccc6:6c4b with SMTP id ge29csp228708pzb; Fri, 21 Jul 2023 06:38:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlE/FgDMi+rXxHAeP+92zveqwi9QvGU/p7slmkn/OAfhdnlcW1yZx7srG66CnjL9euGYdHYg X-Received: by 2002:a17:906:7691:b0:991:c566:979 with SMTP id o17-20020a170906769100b00991c5660979mr1614332ejm.36.1689946722131; Fri, 21 Jul 2023 06:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689946722; cv=none; d=google.com; s=arc-20160816; b=0h4TiRXMYDRhhFZUZ4LG5EXbQ2CuF2GvgbtRAjvhvSRbBW4LJtP2UjuYKVHNUMRCjT hnCLX6jTfNzAW34P8wVEGt5KDSmkhSO9z0dmyClSjRxImgkuYpSIfPwVq3MFNRQbjOiQ gaWBYLU/U75I0meRNzHOl1sJxo1Vu2uQvMXK+iUyQ/469MmKKWv+kMOAykXemA0c+LWm Qb844eoCjWeBawy490Z5/tgeJHadIPXA+eC4eArB+dZklY56Rb6lL4xFnTUwNJinrNSz mBsEf5WuP4f7OCfdG9HWnJy2hjPFGLqUdH6aTGA/NE3umK2LY4LUgmhBGZjes/RmPhnQ Qj6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:feedback-id:dkim-signature:dkim-signature:delivered-to; bh=9g7AagCK5OlZ39f89EeiQGZELkXTQMsDNdzMHhayVPY=; fh=RX379NAUHdZIU7CQlxbXTMt5HBBB5CUKf4o4OtPlQjY=; b=Dk4TJ5tryJaQnh1cRxUkgJ780EZCY6In2Y97AwHoqGtGWFNOhBuPOGptgI8P4kmvNB womeOhaWZnAOHHOjjxltPZPmbX19k8Q7uKcPZJS9W210wCcSDfSxX8+Q58P0h32FEp7d WdWvC+UtRy7mKXaTkIDfz5tBn0DOhcgHOn2G4w/MI6FN0wqf0k+YK1VkKRBGMNA8/y73 wjK7U4R/Khu2hODUSsaH/WLeW9CLNXoK0T94poTr/Q2wIReT/WlAKXeB1UUqHet7tKUo 9gm4T/1G/9gI7nLPlIfywtJ4jKNMTx1Cw6+lz75hPPl55hRW11PzVSLKO+Yq03MSLEaT hMdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm1 header.b=pbctysA3; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm3 header.b="Z3/kIZsL"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n23-20020a170906379700b00988be9d8c53si2166964ejc.946.2023.07.21.06.38.41; Fri, 21 Jul 2023 06:38:42 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm1 header.b=pbctysA3; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm3 header.b="Z3/kIZsL"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4FAA868C3D6; Fri, 21 Jul 2023 16:38:03 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2574868C5DC for ; Fri, 21 Jul 2023 16:37:54 +0300 (EEST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 466905C0131 for ; Fri, 21 Jul 2023 09:37:53 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 21 Jul 2023 09:37:53 -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:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1689946673; x= 1690033073; bh=+URvZCdRy/h0qcZIfId2bkiRXUOKMDGwHgtD8iG+rLw=; b=p bctysA35RPUbVt1a28JKUC7RU7/vhvMcqym3JSqPA0vh5upz2SZIE+nqb5ZNC9hL igW5IjfMZtfh+KAmrZ+jtiheeRz4IS8nTsksUBWnkJlRpDfmoX8Rj4Cc7ZD5E0Xf Yx8fw/CYoL6YDLEHvIfaTZEqh2DfcRVp5KIy9TY3bKgh3S5To7QEHUThyUJebpgy GoHE9fvvuOSWANrtSBKCQAROl2X5xO7EbAFYOWhWDtd3JeTOm3BCKJiXiLrfBxPO P8NZ3LtcqRvVtW5MWp6P0F9V+BrcEV0mKsc/UJ0zqk6ijl/O4e/Wh1GzDzLA0lad O/1PruzglUGxeW6E/VnYg== 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 :in-reply-to:message-id:mime-version:references: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=1689946673; x=1690033073; bh=+ URvZCdRy/h0qcZIfId2bkiRXUOKMDGwHgtD8iG+rLw=; b=Z3/kIZsLJWa9k9AN+ VCJrVe+EjIZPCtK2firMaRgN3RIq3cqSSnrvxrqqglNNhU2n/oT1b1AWwVwNN2R7 Apv0Fa5Sm5CFdaj1PMGWgEZdaR2RkMe+y0tyECUnAM+C4GQmyyTqEteVlIMXD3Ot puoocEAideKI29oDYm1N/d/XVYTiur7gEseW4bZz1tuxvH0KgS+o5IlsMpJZXR6E 1jM44p4oBCjxeyZQjFu+1ZKupjNsA0E1EBP5eekYT18HRnty9Rp70ErKmCT+2NU3 nFiWjkazXhOXXWlTaU1IHrW8wmQudWLPVCfQY44sFazVBxQ9YPuWRZa+HlioUsJL qFXhg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrhedvgdeivdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpedflfdrucffvghkkhgvrhdfuceojhguvghksehithgrnhhimhhu lhdrlhhiqeenucggtffrrghtthgvrhhnpeeuvddukefftdfggfekteekteekvefgheekvd duueethefhvdefkeekteelhfeljeenucffohhmrghinheptghomhhmohhnrdhfihhlmhen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjuggvkh esihhtrghnihhmuhhlrdhlih X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 21 Jul 2023 09:37:52 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Jul 2023 15:37:44 +0200 Message-ID: <20230721133746.33335-5-jdek@itanimul.li> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230721133746.33335-1-jdek@itanimul.li> References: <20230721133746.33335-1-jdek@itanimul.li> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/7] lavc/h264: export ecinfo 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: wcLEuY1rkZAl Export ecinfo to the user when AV_CODEC_EXPORT_DATA_ERROR is set. Co-Authored-By: Thomas Guillem Signed-off-by: J. Dekker --- libavcodec/h264_picture.c | 10 ++++++++-- libavcodec/h264_slice.c | 16 +++++++++++----- libavcodec/h264dec.c | 33 +++++++++++++++++++++++++++------ libavcodec/h264dec.h | 8 +++++++- 4 files changed, 53 insertions(+), 14 deletions(-) diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c index dcaf0fdb0a..aa7c5ac673 100644 --- a/libavcodec/h264_picture.c +++ b/libavcodec/h264_picture.c @@ -48,6 +48,7 @@ void ff_h264_unref_picture(H264Context *h, H264Picture *pic) av_buffer_unref(&pic->qscale_table_buf); av_buffer_unref(&pic->mb_type_buf); av_buffer_unref(&pic->pps_buf); + av_buffer_unref(&pic->ec_info_buf); for (i = 0; i < 2; i++) { av_buffer_unref(&pic->motion_val_buf[i]); av_buffer_unref(&pic->ref_index_buf[i]); @@ -61,6 +62,7 @@ static void h264_copy_picture_params(H264Picture *dst, const H264Picture *src) dst->qscale_table = src->qscale_table; dst->mb_type = src->mb_type; dst->pps = src->pps; + dst->ec_info = src->ec_info; for (int i = 0; i < 2; i++) { dst->motion_val[i] = src->motion_val[i]; @@ -111,7 +113,9 @@ int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src) dst->qscale_table_buf = av_buffer_ref(src->qscale_table_buf); dst->mb_type_buf = av_buffer_ref(src->mb_type_buf); dst->pps_buf = av_buffer_ref(src->pps_buf); - if (!dst->qscale_table_buf || !dst->mb_type_buf || !dst->pps_buf) { + dst->ec_info_buf = av_buffer_ref(src->ec_info_buf); + if (!dst->qscale_table_buf || !dst->mb_type_buf || !dst->pps_buf + || !dst->ec_info_buf) { ret = AVERROR(ENOMEM); goto fail; } @@ -168,6 +172,7 @@ int ff_h264_replace_picture(H264Context *h, H264Picture *dst, const H264Picture ret = av_buffer_replace(&dst->qscale_table_buf, src->qscale_table_buf); ret |= av_buffer_replace(&dst->mb_type_buf, src->mb_type_buf); ret |= av_buffer_replace(&dst->pps_buf, src->pps_buf); + ret |= av_buffer_replace(&dst->ec_info_buf, src->ec_info_buf); if (ret < 0) goto fail; @@ -192,7 +197,7 @@ fail: return ret; } -void ff_h264_set_erpic(ERPicture *dst, H264Picture *src) +void ff_h264_set_erpic(ERPicture *dst, H264Picture *src, bool export_error) { #if CONFIG_ERROR_RESILIENCE int i; @@ -202,6 +207,7 @@ void ff_h264_set_erpic(ERPicture *dst, H264Picture *src) if (!src) return; + dst->info = export_error ? src->ec_info : NULL; dst->f = src->f; dst->tf = &src->tf; diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 41bf30eefc..b291405c2a 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -176,12 +176,15 @@ static int init_table_pools(H264Context *h) sizeof(int16_t), av_buffer_allocz); h->ref_index_pool = av_buffer_pool_init(4 * mb_array_size, av_buffer_allocz); + h->ec_info_pool = av_buffer_pool_init(sizeof(AVECInfo), av_buffer_allocz); + if (!h->qscale_table_pool || !h->mb_type_pool || !h->motion_val_pool || - !h->ref_index_pool) { + !h->ref_index_pool || !h->ec_info_pool) { av_buffer_pool_uninit(&h->qscale_table_pool); av_buffer_pool_uninit(&h->mb_type_pool); av_buffer_pool_uninit(&h->motion_val_pool); av_buffer_pool_uninit(&h->ref_index_pool); + av_buffer_pool_uninit(&h->ec_info_pool); return AVERROR(ENOMEM); } @@ -240,11 +243,13 @@ static int alloc_picture(H264Context *h, H264Picture *pic) pic->qscale_table_buf = av_buffer_pool_get(h->qscale_table_pool); pic->mb_type_buf = av_buffer_pool_get(h->mb_type_pool); - if (!pic->qscale_table_buf || !pic->mb_type_buf) + pic->ec_info_buf = av_buffer_pool_get(h->ec_info_pool); + if (!pic->qscale_table_buf || !pic->mb_type_buf || !pic->ec_info_buf) goto fail; pic->mb_type = (uint32_t*)pic->mb_type_buf->data + 2 * h->mb_stride + 1; pic->qscale_table = pic->qscale_table_buf->data + 2 * h->mb_stride + 1; + pic->ec_info = (AVECInfo*) pic->ec_info_buf->data; for (i = 0; i < 2; i++) { pic->motion_val_buf[i] = av_buffer_pool_get(h->motion_val_pool); @@ -514,6 +519,7 @@ FF_ENABLE_DEPRECATION_WARNINGS pic->f->crop_right = h->crop_right; pic->f->crop_top = h->crop_top; pic->f->crop_bottom = h->crop_bottom; + pic->error_decode_slices = 0; pic->needs_fg = h->sei.common.film_grain_characteristics.present && !h->avctx->hwaccel && !(h->avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN); @@ -524,7 +530,7 @@ FF_ENABLE_DEPRECATION_WARNINGS h->cur_pic_ptr = pic; ff_h264_unref_picture(h, &h->cur_pic); if (CONFIG_ERROR_RESILIENCE) { - ff_h264_set_erpic(&h->er.cur_pic, NULL); + ff_h264_set_erpic(&h->er.cur_pic, NULL, false); } if ((ret = ff_h264_ref_picture(h, &h->cur_pic, h->cur_pic_ptr)) < 0) @@ -537,8 +543,8 @@ FF_ENABLE_DEPRECATION_WARNINGS if (CONFIG_ERROR_RESILIENCE && h->enable_er) { ff_er_frame_start(&h->er); - ff_h264_set_erpic(&h->er.last_pic, NULL); - ff_h264_set_erpic(&h->er.next_pic, NULL); + ff_h264_set_erpic(&h->er.last_pic, NULL, false); + ff_h264_set_erpic(&h->er.next_pic, NULL, false); } for (i = 0; i < 16; i++) { diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 19f8dba131..fa30f75f99 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -153,6 +153,7 @@ void ff_h264_free_tables(H264Context *h) av_buffer_pool_uninit(&h->mb_type_pool); av_buffer_pool_uninit(&h->motion_val_pool); av_buffer_pool_uninit(&h->ref_index_pool); + av_buffer_pool_uninit(&h->ec_info_pool); #if CONFIG_ERROR_RESILIENCE av_freep(&h->er.mb_index2xy); @@ -741,7 +742,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size) // set decode_error_flags to allow users to detect concealed decoding errors if ((ret < 0 || h->er.error_occurred) && h->cur_pic_ptr) { - h->cur_pic_ptr->f->decode_error_flags |= FF_DECODE_ERROR_DECODE_SLICES; + h->cur_pic_ptr->error_decode_slices = 1; } ret = 0; @@ -764,24 +765,34 @@ end: H264SliceContext *sl = h->slice_ctx; int use_last_pic = h->last_pic_for_ec.f->buf[0] && !sl->ref_count[0]; + bool export_error = avctx->export_side_data & AV_CODEC_EXPORT_DATA_ERROR; - ff_h264_set_erpic(&h->er.cur_pic, h->cur_pic_ptr); + ff_h264_set_erpic(&h->er.cur_pic, h->cur_pic_ptr, export_error); if (use_last_pic) { - ff_h264_set_erpic(&h->er.last_pic, &h->last_pic_for_ec); + ff_h264_set_erpic(&h->er.last_pic, &h->last_pic_for_ec, export_error); sl->ref_list[0][0].parent = &h->last_pic_for_ec; memcpy(sl->ref_list[0][0].data, h->last_pic_for_ec.f->data, sizeof(sl->ref_list[0][0].data)); memcpy(sl->ref_list[0][0].linesize, h->last_pic_for_ec.f->linesize, sizeof(sl->ref_list[0][0].linesize)); sl->ref_list[0][0].reference = h->last_pic_for_ec.reference; } else if (sl->ref_count[0]) { - ff_h264_set_erpic(&h->er.last_pic, sl->ref_list[0][0].parent); + ff_h264_set_erpic(&h->er.last_pic, sl->ref_list[0][0].parent, export_error); } else - ff_h264_set_erpic(&h->er.last_pic, NULL); + ff_h264_set_erpic(&h->er.last_pic, NULL, export_error); if (sl->ref_count[1]) - ff_h264_set_erpic(&h->er.next_pic, sl->ref_list[1][0].parent); + ff_h264_set_erpic(&h->er.next_pic, sl->ref_list[1][0].parent, export_error); ff_er_frame_end(&h->er); + + /* Copy the ec_info into out_ec_info now since the ec_info might be + * written by an other thread while outputing the picture. Don't add + * the ec_info in the AVFrame side data since the AVFrame metadata + * can't be modified after calling ff_thread_finish_setup() (prevent + * data-races). */ + if (export_error) + h->cur_pic_ptr->out_ec_info = *h->cur_pic_ptr->ec_info; + if (use_last_pic) memset(&sl->ref_list[0][0], 0, sizeof(sl->ref_list[0][0])); } @@ -850,6 +861,16 @@ static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp) if (ret < 0) return ret; + if (srcp->out_ec_info.error | srcp->out_ec_info.ref_error) { + AVECInfo *eci = av_eci_create_side_data(dst); + if (eci) + *eci = srcp->out_ec_info; + dst->decode_error_flags |= FF_DECODE_ERROR_CONCEALMENT_ACTIVE; + av_log(h, AV_LOG_DEBUG, "ecinfo error: %" PRIu64 ", ref_error: %" PRIu64 "\n", eci->error, eci->ref_error); + } + if (srcp->error_decode_slices) + dst->decode_error_flags |= FF_DECODE_ERROR_DECODE_SLICES; + if (srcp->needs_fg && (ret = av_frame_copy_props(dst, srcp->f)) < 0) return ret; diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h index 9a1ec1bace..5a541e2c0b 100644 --- a/libavcodec/h264dec.h +++ b/libavcodec/h264dec.h @@ -154,6 +154,11 @@ typedef struct H264Picture { int mb_width, mb_height; int mb_stride; + + AVBufferRef *ec_info_buf; + AVECInfo *ec_info; + AVECInfo out_ec_info; + int error_decode_slices; } H264Picture; typedef struct H264Ref { @@ -551,6 +556,7 @@ typedef struct H264Context { AVBufferPool *mb_type_pool; AVBufferPool *motion_val_pool; AVBufferPool *ref_index_pool; + AVBufferPool *ec_info_pool; int ref2frm[MAX_SLICES][2][64]; ///< reference to frame number lists, used in the loop filter, the first 2 are for -2,-1 } H264Context; @@ -806,6 +812,6 @@ void ff_h264_flush_change(H264Context *h); void ff_h264_free_tables(H264Context *h); -void ff_h264_set_erpic(ERPicture *dst, H264Picture *src); +void ff_h264_set_erpic(ERPicture *dst, H264Picture *src, bool export_error); #endif /* AVCODEC_H264DEC_H */ From patchwork Fri Jul 21 13:37:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Dekker" X-Patchwork-Id: 42889 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:be1d:b0:130:ccc6:6c4b with SMTP id ge29csp228921pzb; Fri, 21 Jul 2023 06:39:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlG62LtEv1+YyFwRhid9I0IBfTonYee2OKoGig7F2gYR6lpR5DeKerrRrZLIFxMOYUuzNbDg X-Received: by 2002:a19:9114:0:b0:4fc:3756:754e with SMTP id t20-20020a199114000000b004fc3756754emr1189447lfd.56.1689946742741; Fri, 21 Jul 2023 06:39:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689946742; cv=none; d=google.com; s=arc-20160816; b=sq3PYtKzWat4sOTHJFY2vD9jKVltRDU9Ir08MIUbFxZACdcL23p4FoTRRKtqJ/jcGt PCHXSwpHL6sd/97RJovC0/B1TFET5s6XqA58eor3qZED17DY8pgx0KCm7H/gi13Hdo+B A9BP/HMLWmZ6YB0jgpJ59hgBByn5VpZ9+8OyPGkhJuvSlscH79+8cB1kC+CF/TSEhcqE 5Y30K/bEFJYKdsjmURutZQ8r/z+aswXVXnDbEEpS/ldSSG5/lAga6WmQ5qgarWBO5Bwm R65vrAO8r8F17tx1AbNztBfIYAlJJm+nyJ98QV0vD8m+ccwnv+f7Cikxeda9a3bEXw9L 7dgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:feedback-id:dkim-signature:dkim-signature:delivered-to; bh=j74wde193tW0ZGfmxxT68aKHGhHRq5awjSpkq5ZNEcw=; fh=RX379NAUHdZIU7CQlxbXTMt5HBBB5CUKf4o4OtPlQjY=; b=IpCnsuXC8DW+U6ZuHiPGzbbQRSdPaJjEHtM6TNPLJGniLMrqlmlfR+/nGrzGCo2gqL e7Obzt4G+aMiqimE0xybbJAlBi/SOnAZmgWhajFY02+VwHj7uWgJzcFiKdeK9MTqPPkW Ts29iTN4c0iPqEeqM0Dvb9lz9lBb//5QvcnXoo9xEykSWDj6arDwLmXW4n8BbJLjXkRH pW4EhCyfDFNcjTgSe9rKSz0MRaEPg0DjXT2PXzuAOpz7/NRlMh3tQoWQn5vUeRPA3UIX KkoaC/z1yIrR6ApCkQ2fkvRpan9dI34Ca46CcImqbpG1SRVF3ZQmMopfJhSYZHmJwTpn 86Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm1 header.b=WZ0Zz1du; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm3 header.b="yvL0Gz/Z"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i26-20020aa7c9da000000b0051e27ecdd08si2275356edt.114.2023.07.21.06.39.02; Fri, 21 Jul 2023 06:39:02 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm1 header.b=WZ0Zz1du; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm3 header.b="yvL0Gz/Z"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6553468C665; Fri, 21 Jul 2023 16:38:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 329E968C5BF for ; Fri, 21 Jul 2023 16:37:58 +0300 (EEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 2228F5C0115 for ; Fri, 21 Jul 2023 09:37:54 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 21 Jul 2023 09:37:54 -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:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1689946674; x= 1690033074; bh=jjwKR8x2DbAxjf1olYvoiLcQWbudyEIct7Ab1IV7HxI=; b=W Z0Zz1duzzL5pKTSjoVTcln7vxebnTPgIr+q1ARXrzypBA9OCWS+uZx7EU2QGH4uq NCpxfOzClpQjpgwLMw9B9PhZd2iR9q0G7Pd5ZVi5YTZt1d+wxR9oP7UPNeBhgiWh EH2C71STlrvFfYHnyHk/spdzgRTT8zlzVKI7exK+Ggmgz1L6J9DJUu2BVF1yEUnj uE8/qhIsSXgManlZoiRMIShpqSFt3RFn7tD1ctm1S5lK1D1KqankLXzoEZqyPZHe XBfFbFME7O6QVvQuS2nxWuWiWyrH6SPR/Lfd83oiQWSELmTQZqeXyopxCbv5SdsI rOOSS9+fEI+wdnc2TO4mQ== 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 :in-reply-to:message-id:mime-version:references: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=1689946674; x=1690033074; bh=j jwKR8x2DbAxjf1olYvoiLcQWbudyEIct7Ab1IV7HxI=; b=yvL0Gz/ZR9ti8jIWS f+XNqYifQV59tr86DMlX3ZF4ABK1GKkvvx1zeKNBKVOBgoh+JwO6hRHl0fsCwFmy vI40PvwylusI4kqkyDCsiAc5mTs+GGm9c3NtQslxNGnGm5UuqJyksOsdIUN8sSMD +PXtxhtlMcqdtQvTUhTd/VYebt/LLX9l+UT5w2cnXjZYoU9yqKqCkrJipaGKhzDT qPUtzBlLNfrMg2doa03hYDVZR0PCDulCnCwxRl7kq0BxhtguzKHA8aMavBstr/7V CDTS25d/FdziNZB/Ww0uKdIHm52HjBKSkDQ2qm4i0Xj+qcsz1FHa0IfQU3EV0NbC qY7Hg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrhedvgdeifecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpedflfdrucffvghkkhgvrhdfuceojhguvghksehithgrnhhimhhu lhdrlhhiqeenucggtffrrghtthgvrhhnpeegvdfhffduudegheevieekieeffefgveffke dtheekieefhfevueetueefhfetteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgr mhepmhgrihhlfhhrohhmpehjuggvkhesihhtrghnihhmuhhlrdhlih X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 21 Jul 2023 09:37:53 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Jul 2023 15:37:45 +0200 Message-ID: <20230721133746.33335-6-jdek@itanimul.li> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230721133746.33335-1-jdek@itanimul.li> References: <20230721133746.33335-1-jdek@itanimul.li> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/7] tools/ffprobe: add ecinfo frame side data 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 0p7T5ft4Y9hI Signed-off-by: J. Dekker --- fftools/ffprobe.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index a39185f6fe..9b1f04e1be 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -39,6 +39,7 @@ #include "libavutil/bprint.h" #include "libavutil/channel_layout.h" #include "libavutil/display.h" +#include "libavutil/ec.h" #include "libavutil/hash.h" #include "libavutil/hdr_dynamic_metadata.h" #include "libavutil/mastering_display_metadata.h" @@ -2277,6 +2278,17 @@ static void print_ambient_viewing_environment(WriterContext *w, print_q("ambient_light_y", env->ambient_light_y, '/'); } +static void print_ecinfo(WriterContext *w, const AVECInfo *ecinfo) +{ + if (!ecinfo) + return; + + print_int("ok", ecinfo->ok); + print_int("error", ecinfo->error); + print_int("ref_ok", ecinfo->ref_ok); + print_int("ref_error", ecinfo->ref_error); +} + static void print_pkt_side_data(WriterContext *w, AVCodecParameters *par, const AVPacketSideData *side_data, @@ -2741,6 +2753,8 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, } else if (sd->type == AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT) { print_ambient_viewing_environment( w, (const AVAmbientViewingEnvironment *)sd->data); + } else if (sd->type = AV_FRAME_DATA_EC_INFO) { + print_ecinfo(w, (AVECInfo*)sd->data); } writer_print_section_footer(w); } From patchwork Fri Jul 21 13:37:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Dekker" X-Patchwork-Id: 42888 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:be1d:b0:130:ccc6:6c4b with SMTP id ge29csp228842pzb; Fri, 21 Jul 2023 06:38:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlHhiHVHxSFEV8n+inK3umHU5WUY4NYm8cYcFiDAJbU/O1ICzdkOw+Y5s2l2PcS1utcmb/cW X-Received: by 2002:a2e:9856:0:b0:2b9:4b2b:89d8 with SMTP id e22-20020a2e9856000000b002b94b2b89d8mr1451990ljj.35.1689946733695; Fri, 21 Jul 2023 06:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689946733; cv=none; d=google.com; s=arc-20160816; b=HerVHeYSa2nMvnbabge2UYxiBxK4GnSLQtb2LPjJPnZWW8OkDMgtJ4/E38775XItl/ RLnyg72y4prOIlSZ2pFb5nt+D3xKvNRUg96QMezSFdRtM72pPFg9tMAthOXdj54yyJzr pklTTG7zUAExBYlMwaGLAQZ7rHZZAYsemz3ZpJn+PuTPU5hMX0IMHmQfvqfN+eeeIwU2 cueb8RjCSLYrW+uqpvnB7a1/B5FdPtpEe13s0YkcCwpJPUQUjXkYsXQFF+nbaxCcUvfe ekbMwhtDFaRYv3xGtn3/e8IzastVFz5nSUqyqHqThwX7t6sW8U1O05dHorz4dvrvWB/N hDPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:feedback-id:dkim-signature:dkim-signature:delivered-to; bh=o+jheMh9snYs0cs1+8LjwS2NASxT2+bL4kFZt2eGGac=; fh=RX379NAUHdZIU7CQlxbXTMt5HBBB5CUKf4o4OtPlQjY=; b=nPjVgVyLWTIuV1DizFnK/k+wSFbfmQ379dE/atJRBfiDr8SuaYTEeRX/bjsUC8CaGY 3ZosYaSYjQIdWWzCYVUHxn3TL1B/qbsU6OAx1FuRheFegEkzKp16V/wSqt82q+DMuyQD HDnCdyqG/WaAigF0dDX7l0apb8q5uJ5m4cnlVfnpZROOX6W+QTF5JQJagk9BZY1HH/Il acL5DCjiAd1bN+8Cu2PKVB0Ac0KiI+1qIRAsPXa609rQj653EzbkOZE54qYr6HvdQemn u8IeKw1VbBKp/dougpMsFG6Y3t3fBNW74MsI8Jxhszl1ojV1QxOAkqLfD05OG+U1Jjkx t/Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm1 header.b=wDYCJiUY; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm3 header.b=2EP1PsS6; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dx22-20020a170906a85600b00992bcbf775asi2049689ejb.940.2023.07.21.06.38.52; Fri, 21 Jul 2023 06:38:53 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm1 header.b=wDYCJiUY; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm3 header.b=2EP1PsS6; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4761E68C65E; Fri, 21 Jul 2023 16:38:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2F03468C641 for ; Fri, 21 Jul 2023 16:37:58 +0300 (EEST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id F0F9A5C0165 for ; Fri, 21 Jul 2023 09:37:54 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 21 Jul 2023 09:37:54 -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:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1689946674; x= 1690033074; bh=yME2RoxfRVy0401AQLSlYsN3A9Ey7LaHf6hbPsSlOUw=; b=w DYCJiUYPQXC/Oz5CrdT0oxBujBoseh6Ob+YFuDmxDR2BhsQgRem3qzq74d9+cfrf /GShIBvwvkrNQgsHZZzDi6GSdYG1RE6GT0Y7C0HfvOXksiPZ3lbdWEYpOKYW7dw6 wAtObV+3DyLHV5DHg2eFYVn6Kcff9nA/tFvahpkSjodix5APfeO+shfpgY6Hm4Jy jJXdLhGPSchqbCAr9RkhRrn/7ZlkzTEY2T9S7/IVn8Q7vPZDzqwViS/7sAUnPjBr crRTHQA7eJxPRIpIerWcK4qc97VJqBU5iaL/ZEvLTLgXrbC9rSMuvgZgxV2wgBIy DBycII4/VHqAnif5qAYCw== 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 :in-reply-to:message-id:mime-version:references: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=1689946674; x=1690033074; bh=y ME2RoxfRVy0401AQLSlYsN3A9Ey7LaHf6hbPsSlOUw=; b=2EP1PsS6LsOpxwQLO D0wDRwovFEITPscHcZcg+VxXeRQT+hJr7iiQ+MP72NupKS5ew2/bKBdslNLLSEB5 wTNpSswCY4QTDZW0YAY/oQhvDf4Puaxd64pXHzPLfXACbiqj+k7+Vz+tdNGGvQJN uQehwO/kHS3mywAriJkbch2D4ShITDAlelBjpZdbfpQEetNrAJZ/bHJjy2SAFsiF GPKD/ISCN7NvhZ//By6DoYCJmKufjgs+odXgYnPvllP4gqi6uiLB8N+r2B30Ga3T x5xfPhd8RBYTLW7iL6uM2uwFAxLToLJ7EHy5iHki2HnugOcxIE8CG2GJpvLAnsO2 MSb/w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrhedvgdeivdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpedflfdrucffvghkkhgvrhdfuceojhguvghksehithgrnhhimhhu lhdrlhhiqeenucggtffrrghtthgvrhhnpedvhefgfeeifeeggeetkefgvdelfeegteeuie ekgfefueehteeuhfetieffvdevudenucffohhmrghinheptdiguddrshhtnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhguvghksehithgrnh himhhulhdrlhhi X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 21 Jul 2023 09:37:54 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Jul 2023 15:37:46 +0200 Message-ID: <20230721133746.33335-7-jdek@itanimul.li> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230721133746.33335-1-jdek@itanimul.li> References: <20230721133746.33335-1-jdek@itanimul.li> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 7/7] fate: add ecinfo sidedata test 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: OssDVjAeFOCg Signed-off-by: J. Dekker --- tests/Makefile | 1 + tests/fate/ec.mak | 6 + tests/ref/fate/ec-sidedata-h264 | 332 ++++++++++++++++++++++++++++++++ 3 files changed, 339 insertions(+) create mode 100644 tests/fate/ec.mak create mode 100644 tests/ref/fate/ec-sidedata-h264 ec/basic.h264 is available here: https://0x1.st/bP.h264 diff --git a/tests/Makefile b/tests/Makefile index e09f30a0fc..f108a2460b 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -176,6 +176,7 @@ include $(SRC_PATH)/tests/fate/dnxhd.mak include $(SRC_PATH)/tests/fate/dpcm.mak include $(SRC_PATH)/tests/fate/dvvideo.mak include $(SRC_PATH)/tests/fate/ea.mak +include $(SRC_PATH)/tests/fate/ec.mak include $(SRC_PATH)/tests/fate/exif.mak include $(SRC_PATH)/tests/fate/enc_external.mak # Must be included after lavf-video.mak diff --git a/tests/fate/ec.mak b/tests/fate/ec.mak new file mode 100644 index 0000000000..fe46b7f8f8 --- /dev/null +++ b/tests/fate/ec.mak @@ -0,0 +1,6 @@ +FATE_EC-$(call ALLYES, ERROR_RESILIENCE H264_PARSER H264_DECODER) += fate-ec-sidedata-h264 +fate-ec-sidedata-h264: SRC = $(TARGET_SAMPLES)/ec/basic.h264 +fate-ec-sidedata-h264: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -export_side_data +error_info -show_entries side_data -print_format default -bitexact -v 0 -i "$(SRC)" + +FATE_SAMPLES_FFMPEG+=$(FATE_EC-yes) +fate-ec: $(FATE_EC-yes) diff --git a/tests/ref/fate/ec-sidedata-h264 b/tests/ref/fate/ec-sidedata-h264 new file mode 100644 index 0000000000..e00d2fc89c --- /dev/null +++ b/tests/ref/fate/ec-sidedata-h264 @@ -0,0 +1,332 @@ +[PACKET] +[/PACKET] +[PACKET] +[/PACKET] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=414720 +error=142336 +ref_ok=0 +ref_error=0 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=414720 +ref_error=142336 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=414720 +ref_error=142336 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=414720 +ref_error=142336 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=414720 +ref_error=142336 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=414720 +ref_error=142336 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=414720 +ref_error=142336 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=414720 +ref_error=142336 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=414720 +ref_error=142336 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=1007360 +ref_error=663808 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=290816 +error=266240 +ref_ok=716544 +ref_error=397568 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=1007360 +ref_error=663808 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=301824 +error=255232 +ref_ok=414720 +ref_error=142336 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=716544 +ref_error=397568 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=716544 +ref_error=397568 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=716544 +ref_error=397568 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=716544 +ref_error=397568 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=716544 +ref_error=397568 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=716544 +ref_error=397568 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=716544 +ref_error=397568 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=716544 +ref_error=397568 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=716544 +ref_error=397568 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=716544 +ref_error=397568 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=716544 +ref_error=397568 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=716544 +ref_error=397568 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=716544 +ref_error=397568 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=716544 +ref_error=397568 +[/SIDE_DATA] +[/FRAME] +[PACKET] +[/PACKET] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=716544 +ref_error=397568 +[/SIDE_DATA] +[/FRAME] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=716544 +ref_error=397568 +[/SIDE_DATA] +[/FRAME] +[FRAME] +[SIDE_DATA] +side_data_type=Error Concealment Information +ok=0 +error=0 +ref_ok=716544 +ref_error=397568 +[/SIDE_DATA] +[/FRAME] +[STREAM] +[/STREAM]