From patchwork Wed Dec 6 08:22:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 44950 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9153:b0:181:818d:5e7f with SMTP id x19csp106193pzc; Wed, 6 Dec 2023 00:22:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IElYvRk2+nUEXHtKfeAVplNYoL6PKng6At1Vpu1KzyzjXnUWRPVNs9stBIqYJiYbu0T5F7A X-Received: by 2002:a17:906:3f5b:b0:a10:8db4:bcf3 with SMTP id f27-20020a1709063f5b00b00a108db4bcf3mr283777ejj.9.1701850959208; Wed, 06 Dec 2023 00:22:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701850959; cv=none; d=google.com; s=arc-20160816; b=gSIC7WrGOJgc2Br1y7z97UFD0P9Funo4/RobWepswMblvpzPurRXd6hdQeuacjRGTx EdH1riX4T36DgcKgbGvuDmOzJLE4whkKqZLywaP4XUh+b7mzDh/3i3XB9itzzeAmiK+q tYwchz2stxuNTlQDgSFcxz6bRNH3CVmv46QSl9gnOwsUs6L5uYEioijMYsJ2Ax89mAHZ iBewy2LgPxxk2vnVjAXf9Wkpko2LO37b8FO+xtwy9Arfk1b/2NX2rSXuhkbHQDzlsnpL DDSAd0KoNuXn31KhWJvxPIXfXF/JLdB6/K6JAgCf/FxiMVDw7UDvkXgACoVG8u1IYlHf /d1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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:delivered-to; bh=jfJ/Ace0okpxIW663V43esUL6hGFr/NXpaWAzCZiajU=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=FIyRlPIL/AFl3N7FFGiktMiXgqhscr1Q8ktp9d4ROcZuLsn5aWqy4o0fUGKXE4Su6n 0Uo/mWr38AsDQR0y+Q0NAr/w6rSnGoFSnMARddpPBnHhG4vbxvhGeKMaTqgpuImK1vnd h1RVPvN301KHkY99c/5Q8XfVjkbRatG9UT8wqkH2pcnczYVrKUvA6d/FDMYaa2gd7RAo pjBrsr/V3XCgc85WioURlXB/mZE6Ih1nVZvDPTA9BFi3YcR7unemCVQDrS0qKqAVeUz9 xLChIr3LXeqiRhJbeLgtXI4g1Y6kFEGFoBPYAabotzkLV6LSzgRJ38d4TodjlCHftWmR Il+Q== ARC-Authentication-Results: i=1; mx.google.com; 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 qf15-20020a1709077f0f00b00a1b63199eb9si3521625ejc.130.2023.12.06.00.22.38; Wed, 06 Dec 2023 00:22:39 -0800 (PST) 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; 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 8F57B68CF07; Wed, 6 Dec 2023 10:22:34 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9AF9268BAC9 for ; Wed, 6 Dec 2023 10:22:27 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 0E77FE9A1E; Wed, 6 Dec 2023 09:22:27 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id E_kb_o2_ABFn; Wed, 6 Dec 2023 09:22:24 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 8B509E9982; Wed, 6 Dec 2023 09:22:24 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Wed, 6 Dec 2023 09:22:14 +0100 Message-Id: <20231206082220.5532-1-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 1/7] avutil/tests/imgutils: factorize basic tests to new function 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 Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: AQFVg+I7rHZ1 Signed-off-by: Marton Balint --- libavutil/tests/imgutils.c | 68 ++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/libavutil/tests/imgutils.c b/libavutil/tests/imgutils.c index 748bd6c9d2..1e2bb3fa01 100644 --- a/libavutil/tests/imgutils.c +++ b/libavutil/tests/imgutils.c @@ -19,6 +19,41 @@ #include "libavutil/imgutils.c" #undef printf +static int check_image_fill(enum AVPixelFormat pix_fmt, int w, int h) { + uint8_t *data[4]; + size_t sizes[4]; + ptrdiff_t linesizes1[4], offsets[3] = { 0 }; + int i, total_size, linesizes[4]; + + if (av_image_fill_linesizes(linesizes, pix_fmt, w) < 0) + return -1; + for (i = 0; i < 4; i++) + linesizes1[i] = linesizes[i]; + if (av_image_fill_plane_sizes(sizes, pix_fmt, h, linesizes1) < 0) + return -1; + total_size = av_image_fill_pointers(data, pix_fmt, h, (void *)1, linesizes); + if (total_size < 0) + return -1; + for (i = 0; i < 4 && data[i]; i++); + printf("planes: %d", i); + // Test the output of av_image_fill_linesizes() + printf(", linesizes:"); + for (i = 0; i < 4; i++) + printf(" %3d", linesizes[i]); + // Test the output of av_image_fill_plane_sizes() + printf(", plane_sizes:"); + for (i = 0; i < 4; i++) + printf(" %5"SIZE_SPECIFIER, sizes[i]); + // Test the output of av_image_fill_pointers() + for (i = 0; i < 3 && data[i + 1]; i++) + offsets[i] = data[i + 1] - data[i]; + printf(", plane_offsets:"); + for (i = 0; i < 3; i++) + printf(" %5"PTRDIFF_SPECIFIER, offsets[i]); + printf(", total_size: %d", total_size); + + return 0; +} int main(void) { @@ -35,39 +70,14 @@ int main(void) printf("\n"); while (desc = av_pix_fmt_desc_next(desc)) { - uint8_t *data[4]; - size_t sizes[4]; - ptrdiff_t linesizes1[4], offsets[3] = { 0 }; - int i, total_size, w = 64, h = 48, linesizes[4]; + int w = 64, h = 48; enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(desc); - if (av_image_fill_linesizes(linesizes, pix_fmt, w) < 0) - continue; - for (i = 0; i < 4; i++) - linesizes1[i] = linesizes[i]; - if (av_image_fill_plane_sizes(sizes, pix_fmt, h, linesizes1) < 0) - continue; - total_size = av_image_fill_pointers(data, pix_fmt, h, (void *)1, linesizes); - if (total_size < 0) + if (desc->flags & AV_PIX_FMT_FLAG_HWACCEL) continue; printf("%-16s", desc->name); - for (i = 0; i < 4 && data[i]; i++); - printf("planes: %d", i); - // Test the output of av_image_fill_linesizes() - printf(", linesizes:"); - for (i = 0; i < 4; i++) - printf(" %3d", linesizes[i]); - // Test the output of av_image_fill_plane_sizes() - printf(", plane_sizes:"); - for (i = 0; i < 4; i++) - printf(" %5"SIZE_SPECIFIER, sizes[i]); - // Test the output of av_image_fill_pointers() - for (i = 0; i < 3 && data[i + 1]; i++) - offsets[i] = data[i + 1] - data[i]; - printf(", plane_offsets:"); - for (i = 0; i < 3; i++) - printf(" %5"PTRDIFF_SPECIFIER, offsets[i]); - printf(", total_size: %d\n", total_size); + check_image_fill(pix_fmt, w, h); + printf("\n"); } return 0; From patchwork Wed Dec 6 08:22:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 44951 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9153:b0:181:818d:5e7f with SMTP id x19csp106292pzc; Wed, 6 Dec 2023 00:22:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+JcCKUB1kOhFnNebmKCavOON0HUgTgIMYGDARQbybnk9rJXLEbi18NTX02p96cJAejipz X-Received: by 2002:a17:906:f817:b0:a19:2f9b:5050 with SMTP id kh23-20020a170906f81700b00a192f9b5050mr201661ejb.54.1701850972198; Wed, 06 Dec 2023 00:22:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701850972; cv=none; d=google.com; s=arc-20160816; b=BFfM9C4/6cJt8lOm31YxU7u7zSy3IAvzSSZGA9vmYwDgj9PaavrdGyBbz2Z6WWdaen gSOK8qoyN8bE/bzWmVRjqp5jVfcAfLV3Yegbsszac3D2GhjypzDTac6/FeraXsUi0Knv VFAcW3HTTXBNmn6Y2nFeXyBoG3pYPUXX7uIFiaD7ii9W/FutIz63/vFl3JBy9h+JahYW IcIWyHMIEAvKAx4b0cs1OUdnFrOyvd29jioWnutjagKFgD6GvMzc0Vu84Bpen5V8MM6T Hg5viyJN83NxK7Msr/vcr+YzAFmdcVA9XOpWSvZJXL9h7yWtEwx9U4/AG6KvpaQ6R8M7 lObA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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:delivered-to; bh=cp2CzYP5/cuNDQWjgJT+AopRhYn6UcQhfOwN1JSOoeI=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=DnK/4ojmhPwtQh4hLVl3vSp8BFQMVtJpvKMma8IZrWcWmBt8K/Pl64UWM6BKE9dhZX vE+wYrsK/R0x4WdGzRUrHYV+Q6Dq4BGTKzhan2v0PFX/JYMk14deShXE5JF0eWkzHyVi PxjKCKTENRAIt4AiPDgEOckyM5QJMwfqf+PeffyBrpb8BtDDw/KzCgSuh7oWGHof2nl2 SR3rzMXo8hIVhz0v93tzBw29IZAedCyakXGFC0bnsUS5jXFRokc6755tBi1R8PfnuyJf vkfbQ95fz8efYO+Pmycc59eHctZCy+y8rJFDc2vosDNqTuoVLV4uMGRQ6TPbISxLPXdI jQRw== ARC-Authentication-Results: i=1; mx.google.com; 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 ne36-20020a1709077ba400b00a1d5063b02asi794973ejc.717.2023.12.06.00.22.51; Wed, 06 Dec 2023 00:22:52 -0800 (PST) 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; 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 4B7D368CF49; Wed, 6 Dec 2023 10:22:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3953568CF29 for ; Wed, 6 Dec 2023 10:22:30 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 6A820E9A1F; Wed, 6 Dec 2023 09:22:29 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WgFX8eJypAtI; Wed, 6 Dec 2023 09:22:26 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 5B579E9A20; Wed, 6 Dec 2023 09:22:26 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Wed, 6 Dec 2023 09:22:15 +0100 Message-Id: <20231206082220.5532-2-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231206082220.5532-1-cus@passwd.hu> References: <20231206082220.5532-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 2/7] avutil/tests/imgutils: add tests for av_image_fill_black() 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 Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 1edHG5dQ+Kz4 Signed-off-by: Marton Balint --- libavutil/tests/imgutils.c | 61 +++++++++-- tests/ref/fate/imgutils | 217 +++++++++++++++++++++++++++++++++++++ 2 files changed, 269 insertions(+), 9 deletions(-) diff --git a/libavutil/tests/imgutils.c b/libavutil/tests/imgutils.c index 1e2bb3fa01..582a358157 100644 --- a/libavutil/tests/imgutils.c +++ b/libavutil/tests/imgutils.c @@ -17,6 +17,7 @@ */ #include "libavutil/imgutils.c" +#include "libavutil/crc.h" #undef printf static int check_image_fill(enum AVPixelFormat pix_fmt, int w, int h) { @@ -55,9 +56,44 @@ static int check_image_fill(enum AVPixelFormat pix_fmt, int w, int h) { return 0; } +static int check_image_fill_black(const AVPixFmtDescriptor *desc, enum AVPixelFormat pix_fmt, int w, int h) +{ + uint8_t *data[4]; + ptrdiff_t linesizes1[4]; + int ret, total_size, linesizes[4]; + + ret = av_image_fill_linesizes(linesizes, pix_fmt, w); + if (ret < 0) + return ret; + total_size = av_image_alloc(data, linesizes, w, h, pix_fmt, 4); + if (total_size < 0) { + printf("alloc failure"); + return total_size; + } + printf("total_size: %6d", total_size); + if (desc->flags & AV_PIX_FMT_FLAG_PAL) + total_size -= 256 * 4; + // Make it non-black by default... + memset(data[0], 0xA3, total_size); + for (int i = 0; i < 4; i++) + linesizes1[i] = linesizes[i]; + for (enum AVColorRange range = 0; range < AVCOL_RANGE_NB; range++) { + ret = av_image_fill_black(data, linesizes1, pix_fmt, range, w, h); + printf(", black_%s_crc: ", av_color_range_name(range)); + if (ret < 0) { + printf("----------"); + } else { + const AVCRC *crc = av_crc_get_table(AV_CRC_32_IEEE_LE); + printf("0x%08"PRIx32, av_crc(crc, 0, data[0], total_size)); + } + } + av_freep(&data[0]); + + return 0; +} + int main(void) { - const AVPixFmtDescriptor *desc = NULL; int64_t x, y; for (y = -1; yflags & AV_PIX_FMT_FLAG_HWACCEL) - continue; - printf("%-16s", desc->name); - check_image_fill(pix_fmt, w, h); - printf("\n"); + if (desc->flags & AV_PIX_FMT_FLAG_HWACCEL) + continue; + + printf("%-16s", desc->name); + if (i == 0) + check_image_fill(pix_fmt, w, h); + else + check_image_fill_black(desc, pix_fmt, w, h); + printf("\n"); + } } return 0; diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils index f166cb67fb..f12bef3fb5 100644 --- a/tests/ref/fate/imgutils +++ b/tests/ref/fate/imgutils @@ -54,6 +54,7 @@ 0000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000 +image_fill tests yuv420p planes: 3, linesizes: 64 32 32 0, plane_sizes: 3072 768 768 0, plane_offsets: 3072 768 0, total_size: 4608 yuyv422 planes: 1, linesizes: 128 0 0 0, plane_sizes: 6144 0 0 0, plane_offsets: 0 0 0, total_size: 6144 rgb24 planes: 1, linesizes: 192 0 0 0, plane_sizes: 9216 0 0 0, plane_offsets: 0 0 0, total_size: 9216 @@ -268,3 +269,219 @@ p412be planes: 2, linesizes: 128 256 0 0, plane_sizes: 6144 12288 p412le planes: 2, linesizes: 128 256 0 0, plane_sizes: 6144 12288 0 0, plane_offsets: 6144 0 0, total_size: 18432 gbrap14be planes: 4, linesizes: 128 128 128 128, plane_sizes: 6144 6144 6144 6144, plane_offsets: 6144 6144 6144, total_size: 24576 gbrap14le planes: 4, linesizes: 128 128 128 128, plane_sizes: 6144 6144 6144 6144, plane_offsets: 6144 6144 6144, total_size: 24576 + +image_fill_black tests +yuv420p total_size: 4608, black_unknown_crc: 0xd00f6cc6, black_tv_crc: 0xd00f6cc6, black_pc_crc: 0x234969af +yuyv422 total_size: 6144, black_unknown_crc: 0xcb089fb0, black_tv_crc: 0xcb089fb0, black_pc_crc: 0xc9dc3ddf +rgb24 total_size: 9216, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bgr24 total_size: 9216, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +yuv422p total_size: 6144, black_unknown_crc: 0x71fcc79c, black_tv_crc: 0x71fcc79c, black_pc_crc: 0xa9fa0192 +yuv444p total_size: 9216, black_unknown_crc: 0x1c302b58, black_tv_crc: 0x1c302b58, black_pc_crc: 0xdf792ea7 +yuv410p total_size: 3456, black_unknown_crc: 0x09f3e4b0, black_tv_crc: 0x09f3e4b0, black_pc_crc: 0xe4f4e553 +yuv411p total_size: 4608, black_unknown_crc: 0xd00f6cc6, black_tv_crc: 0xd00f6cc6, black_pc_crc: 0x234969af +gray total_size: 3072, black_unknown_crc: 0x63e301a2, black_tv_crc: 0x63e301a2, black_pc_crc: 0x00000000 +monow total_size: 384, black_unknown_crc: 0x1ba3e150, black_tv_crc: 0x1ba3e150, black_pc_crc: 0x1ba3e150 +monob total_size: 384, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +pal8 total_size: 4096, black_unknown_crc: 0x63e301a2, black_tv_crc: 0x63e301a2, black_pc_crc: 0x00000000 +yuvj420p total_size: 4608, black_unknown_crc: 0xd00f6cc6, black_tv_crc: 0xd00f6cc6, black_pc_crc: 0x234969af +yuvj422p total_size: 6144, black_unknown_crc: 0x71fcc79c, black_tv_crc: 0x71fcc79c, black_pc_crc: 0xa9fa0192 +yuvj444p total_size: 9216, black_unknown_crc: 0x1c302b58, black_tv_crc: 0x1c302b58, black_pc_crc: 0xdf792ea7 +uyvy422 total_size: 6144, black_unknown_crc: 0xaf9476bb, black_tv_crc: 0xaf9476bb, black_pc_crc: 0x16a51378 +uyyvyy411 total_size: 4608, black_unknown_crc: 0x6f8b7288, black_tv_crc: 0x6f8b7288, black_pc_crc: 0x9f9c5552 +bgr8 total_size: 3072, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bgr4 total_size: 1536, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bgr4_byte total_size: 3072, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +rgb8 total_size: 3072, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +rgb4 total_size: 1536, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +rgb4_byte total_size: 3072, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +nv12 total_size: 4608, black_unknown_crc: 0xd00f6cc6, black_tv_crc: 0xd00f6cc6, black_pc_crc: 0x234969af +nv21 total_size: 4608, black_unknown_crc: 0xd00f6cc6, black_tv_crc: 0xd00f6cc6, black_pc_crc: 0x234969af +argb total_size: 12288, black_unknown_crc: 0x97f3518e, black_tv_crc: 0x97f3518e, black_pc_crc: 0x97f3518e +rgba total_size: 12288, black_unknown_crc: 0xf15ae524, black_tv_crc: 0xf15ae524, black_pc_crc: 0xf15ae524 +abgr total_size: 12288, black_unknown_crc: 0x97f3518e, black_tv_crc: 0x97f3518e, black_pc_crc: 0x97f3518e +bgra total_size: 12288, black_unknown_crc: 0xf15ae524, black_tv_crc: 0xf15ae524, black_pc_crc: 0xf15ae524 +gray16be total_size: 6144, black_unknown_crc: 0x02d4a26f, black_tv_crc: 0x02d4a26f, black_pc_crc: 0x00000000 +gray16le total_size: 6144, black_unknown_crc: 0xb93165c3, black_tv_crc: 0xb93165c3, black_pc_crc: 0x00000000 +yuv440p total_size: 6144, black_unknown_crc: 0x71fcc79c, black_tv_crc: 0x71fcc79c, black_pc_crc: 0xa9fa0192 +yuvj440p total_size: 6144, black_unknown_crc: 0x71fcc79c, black_tv_crc: 0x71fcc79c, black_pc_crc: 0xa9fa0192 +yuva420p total_size: 7680, black_unknown_crc: 0x0bcc140f, black_tv_crc: 0x0bcc140f, black_pc_crc: 0xa724ab23 +rgb48be total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +rgb48le total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +rgb565be total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +rgb565le total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +rgb555be total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +rgb555le total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bgr565be total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bgr565le total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bgr555be total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bgr555le total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +yuv420p16le total_size: 9216, black_unknown_crc: 0xfff85b60, black_tv_crc: 0xfff85b60, black_pc_crc: 0xc03cff93 +yuv420p16be total_size: 9216, black_unknown_crc: 0x4d4d9903, black_tv_crc: 0x4d4d9903, black_pc_crc: 0x69c6fe01 +yuv422p16le total_size: 12288, black_unknown_crc: 0x6582d6cf, black_tv_crc: 0x6582d6cf, black_pc_crc: 0xc9dc3ddf +yuv422p16be total_size: 12288, black_unknown_crc: 0x0bbe5df7, black_tv_crc: 0x0bbe5df7, black_pc_crc: 0x16a51378 +yuv444p16le total_size: 18432, black_unknown_crc: 0x4028ac30, black_tv_crc: 0x4028ac30, black_pc_crc: 0xab7c7698 +yuv444p16be total_size: 18432, black_unknown_crc: 0x26991800, black_tv_crc: 0x26991800, black_pc_crc: 0xfe7f6700 +rgb444le total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +rgb444be total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bgr444le total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bgr444be total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +ya8 total_size: 6144, black_unknown_crc: 0xcb089fb0, black_tv_crc: 0xcb089fb0, black_pc_crc: 0xc9dc3ddf +bgr48be total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bgr48le total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +yuv420p9be total_size: 9216, black_unknown_crc: 0x9154a536, black_tv_crc: 0x9154a536, black_pc_crc: 0xeeddecd0 +yuv420p9le total_size: 9216, black_unknown_crc: 0x9a9b3206, black_tv_crc: 0x9a9b3206, black_pc_crc: 0xd38dfc02 +yuv420p10be total_size: 9216, black_unknown_crc: 0xf9d84c2d, black_tv_crc: 0xf9d84c2d, black_pc_crc: 0x06cadfe1 +yuv420p10le total_size: 9216, black_unknown_crc: 0xee47624d, black_tv_crc: 0xee47624d, black_pc_crc: 0x7c6afe45 +yuv422p10be total_size: 12288, black_unknown_crc: 0x7cb8d0b6, black_tv_crc: 0x7cb8d0b6, black_pc_crc: 0xa0507635 +yuv422p10le total_size: 12288, black_unknown_crc: 0x2ef977dc, black_tv_crc: 0x2ef977dc, black_pc_crc: 0x5a944de0 +yuv444p9be total_size: 18432, black_unknown_crc: 0x0c244ddf, black_tv_crc: 0x0c244ddf, black_pc_crc: 0x01fcfece +yuv444p9le total_size: 18432, black_unknown_crc: 0x4d323000, black_tv_crc: 0x4d323000, black_pc_crc: 0x278fc841 +yuv444p10be total_size: 18432, black_unknown_crc: 0x18489bbe, black_tv_crc: 0x18489bbe, black_pc_crc: 0x03f9fd9c +yuv444p10le total_size: 18432, black_unknown_crc: 0x9a646000, black_tv_crc: 0x9a646000, black_pc_crc: 0x4f1f9082 +yuv422p9be total_size: 12288, black_unknown_crc: 0x3e5c685b, black_tv_crc: 0x3e5c685b, black_pc_crc: 0xbd90b83a +yuv422p9le total_size: 12288, black_unknown_crc: 0x177cbbee, black_tv_crc: 0x177cbbee, black_pc_crc: 0x2d4a26f0 +gbrp total_size: 9216, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +gbrp9be total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +gbrp9le total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +gbrp10be total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +gbrp10le total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +gbrp16be total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +gbrp16le total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +yuva422p total_size: 9216, black_unknown_crc: 0x6fa9db98, black_tv_crc: 0x6fa9db98, black_pc_crc: 0xace0de67 +yuva444p total_size: 12288, black_unknown_crc: 0x72114eba, black_tv_crc: 0x72114eba, black_pc_crc: 0x001deeda +yuva420p9be total_size: 15360, black_unknown_crc: 0x47717974, black_tv_crc: 0x47717974, black_pc_crc: 0xf485b36d +yuva420p9le total_size: 15360, black_unknown_crc: 0xe23950ad, black_tv_crc: 0xe23950ad, black_pc_crc: 0x86e10ca7 +yuva422p9be total_size: 18432, black_unknown_crc: 0x2f5a84da, black_tv_crc: 0x2f5a84da, black_pc_crc: 0x228237cb +yuva422p9le total_size: 18432, black_unknown_crc: 0x3d7bba46, black_tv_crc: 0x3d7bba46, black_pc_crc: 0x57c64207 +yuva444p9be total_size: 24576, black_unknown_crc: 0x12aed20d, black_tv_crc: 0x12aed20d, black_pc_crc: 0x2f0c503b +yuva444p9le total_size: 24576, black_unknown_crc: 0x7b4cbb96, black_tv_crc: 0x7b4cbb96, black_pc_crc: 0xb4cb8c8d +yuva420p10be total_size: 15360, black_unknown_crc: 0x56f111dd, black_tv_crc: 0x56f111dd, black_pc_crc: 0xea6983ae +yuva420p10le total_size: 15360, black_unknown_crc: 0xa2931f21, black_tv_crc: 0xa2931f21, black_pc_crc: 0x6b23a735 +yuva422p10be total_size: 18432, black_unknown_crc: 0x86a6ea81, black_tv_crc: 0x86a6ea81, black_pc_crc: 0x9d178ca3 +yuva422p10le total_size: 18432, black_unknown_crc: 0xc767ccb6, black_tv_crc: 0xc767ccb6, black_pc_crc: 0x121c3c34 +yuva444p10be total_size: 24576, black_unknown_crc: 0xfd4e472f, black_tv_crc: 0xfd4e472f, black_pc_crc: 0x860b4343 +yuva444p10le total_size: 24576, black_unknown_crc: 0x4b09cf16, black_tv_crc: 0x4b09cf16, black_pc_crc: 0x0f76a761 +yuva420p16be total_size: 15360, black_unknown_crc: 0xe112be6e, black_tv_crc: 0xe112be6e, black_pc_crc: 0xd37e906b +yuva420p16le total_size: 15360, black_unknown_crc: 0xcbc146fa, black_tv_crc: 0xcbc146fa, black_pc_crc: 0x7f83a0d6 +yuva422p16be total_size: 18432, black_unknown_crc: 0x630b483b, black_tv_crc: 0x630b483b, black_pc_crc: 0xbbed373b +yuva422p16le total_size: 18432, black_unknown_crc: 0xdac3d2ac, black_tv_crc: 0xdac3d2ac, black_pc_crc: 0x31970804 +yuva444p16be total_size: 24576, black_unknown_crc: 0x4010c8d3, black_tv_crc: 0x4010c8d3, black_pc_crc: 0xca6bd07e +yuva444p16le total_size: 24576, black_unknown_crc: 0x1824855b, black_tv_crc: 0x1824855b, black_pc_crc: 0x06f5c440 +xyz12le total_size: 18432, black_unknown_crc: 0x24c4432b, black_tv_crc: 0x24c4432b, black_pc_crc: 0xfe5a7889 +xyz12be total_size: 18432, black_unknown_crc: 0xac983d03, black_tv_crc: 0xac983d03, black_pc_crc: 0x949a61fc +nv16 total_size: 6144, black_unknown_crc: 0x71fcc79c, black_tv_crc: 0x71fcc79c, black_pc_crc: 0xa9fa0192 +nv20le total_size: 12288, black_unknown_crc: 0x2ef977dc, black_tv_crc: 0x2ef977dc, black_pc_crc: 0x5a944de0 +nv20be total_size: 12288, black_unknown_crc: 0x7cb8d0b6, black_tv_crc: 0x7cb8d0b6, black_pc_crc: 0xa0507635 +rgba64be total_size: 24576, black_unknown_crc: 0x0ab5caf6, black_tv_crc: 0x0ab5caf6, black_pc_crc: 0x0ab5caf6 +rgba64le total_size: 24576, black_unknown_crc: 0x0ab5caf6, black_tv_crc: 0x0ab5caf6, black_pc_crc: 0x0ab5caf6 +bgra64be total_size: 24576, black_unknown_crc: 0x0ab5caf6, black_tv_crc: 0x0ab5caf6, black_pc_crc: 0x0ab5caf6 +bgra64le total_size: 24576, black_unknown_crc: 0x0ab5caf6, black_tv_crc: 0x0ab5caf6, black_pc_crc: 0x0ab5caf6 +yvyu422 total_size: 6144, black_unknown_crc: 0xcb089fb0, black_tv_crc: 0xcb089fb0, black_pc_crc: 0xc9dc3ddf +ya16be total_size: 12288, black_unknown_crc: 0x5483d935, black_tv_crc: 0x5483d935, black_pc_crc: 0x06397bf3 +ya16le total_size: 12288, black_unknown_crc: 0x5d8e1cf6, black_tv_crc: 0x5d8e1cf6, black_pc_crc: 0x8fceec45 +gbrap total_size: 12288, black_unknown_crc: 0xda63f152, black_tv_crc: 0xda63f152, black_pc_crc: 0xda63f152 +gbrap16be total_size: 24576, black_unknown_crc: 0x53374343, black_tv_crc: 0x53374343, black_pc_crc: 0x53374343 +gbrap16le total_size: 24576, black_unknown_crc: 0x53374343, black_tv_crc: 0x53374343, black_pc_crc: 0x53374343 +0rgb total_size: 12288, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +rgb0 total_size: 12288, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +0bgr total_size: 12288, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bgr0 total_size: 12288, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +yuv420p12be total_size: 9216, black_unknown_crc: 0x220de93c, black_tv_crc: 0x220de93c, black_pc_crc: 0x1b2b7f84 +yuv420p12le total_size: 9216, black_unknown_crc: 0x0fff85b6, black_tv_crc: 0x0fff85b6, black_pc_crc: 0x2adaff55 +yuv420p14be total_size: 9216, black_unknown_crc: 0x8837a4f0, black_tv_crc: 0x8837a4f0, black_pc_crc: 0x6cadfe10 +yuv420p14le total_size: 9216, black_unknown_crc: 0x3ffe16d8, black_tv_crc: 0x3ffe16d8, black_pc_crc: 0xab6bfd54 +yuv422p12be total_size: 12288, black_unknown_crc: 0x50be94e3, black_tv_crc: 0x50be94e3, black_pc_crc: 0xecd2d217 +yuv422p12le total_size: 12288, black_unknown_crc: 0xbbe5df70, black_tv_crc: 0xbbe5df70, black_pc_crc: 0xb12031c1 +yuv422p14be total_size: 12288, black_unknown_crc: 0x998b55cd, black_tv_crc: 0x998b55cd, black_pc_crc: 0x05a944de +yuv422p14le total_size: 12288, black_unknown_crc: 0x82047703, black_tv_crc: 0x82047703, black_pc_crc: 0xa913cdc7 +yuv444p12be total_size: 18432, black_unknown_crc: 0x02699180, black_tv_crc: 0x02699180, black_pc_crc: 0x0fe7f670 +yuv444p12le total_size: 18432, black_unknown_crc: 0x04028ac3, black_tv_crc: 0x04028ac3, black_pc_crc: 0xe70f4449 +yuv444p14be total_size: 18432, black_unknown_crc: 0x09a64600, black_tv_crc: 0x09a64600, black_pc_crc: 0x3f9fd9c0 +yuv444p14le total_size: 18432, black_unknown_crc: 0x100a2b0c, black_tv_crc: 0x100a2b0c, black_pc_crc: 0x2adf1da6 +gbrp12be total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +gbrp12le total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +gbrp14be total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +gbrp14le total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +yuvj411p total_size: 4608, black_unknown_crc: 0xd00f6cc6, black_tv_crc: 0xd00f6cc6, black_pc_crc: 0x234969af +bayer_bggr8 total_size: 3072, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bayer_rggb8 total_size: 3072, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bayer_gbrg8 total_size: 3072, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bayer_grbg8 total_size: 3072, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bayer_bggr16le total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bayer_bggr16be total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bayer_rggb16le total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bayer_rggb16be total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bayer_gbrg16le total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bayer_gbrg16be total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bayer_grbg16le total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +bayer_grbg16be total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +yuv440p10le total_size: 12288, black_unknown_crc: 0x2ef977dc, black_tv_crc: 0x2ef977dc, black_pc_crc: 0x5a944de0 +yuv440p10be total_size: 12288, black_unknown_crc: 0x7cb8d0b6, black_tv_crc: 0x7cb8d0b6, black_pc_crc: 0xa0507635 +yuv440p12le total_size: 12288, black_unknown_crc: 0xbbe5df70, black_tv_crc: 0xbbe5df70, black_pc_crc: 0xb12031c1 +yuv440p12be total_size: 12288, black_unknown_crc: 0x50be94e3, black_tv_crc: 0x50be94e3, black_pc_crc: 0xecd2d217 +ayuv64le total_size: 24576, black_unknown_crc: 0xcb441ee4, black_tv_crc: 0xcb441ee4, black_pc_crc: 0x48ba1e8d +ayuv64be total_size: 24576, black_unknown_crc: 0xe0be064e, black_tv_crc: 0xe0be064e, black_pc_crc: 0xd45321b2 +p010le total_size: 9216, black_unknown_crc: 0xfff85b60, black_tv_crc: 0xfff85b60, black_pc_crc: 0xc03cff93 +p010be total_size: 9216, black_unknown_crc: 0x4d4d9903, black_tv_crc: 0x4d4d9903, black_pc_crc: 0x69c6fe01 +gbrap12be total_size: 24576, black_unknown_crc: 0x49bd3f36, black_tv_crc: 0x49bd3f36, black_pc_crc: 0x49bd3f36 +gbrap12le total_size: 24576, black_unknown_crc: 0x039f4b57, black_tv_crc: 0x039f4b57, black_pc_crc: 0x039f4b57 +gbrap10be total_size: 24576, black_unknown_crc: 0x3ebe070a, black_tv_crc: 0x3ebe070a, black_pc_crc: 0x3ebe070a +gbrap10le total_size: 24576, black_unknown_crc: 0x0797e156, black_tv_crc: 0x0797e156, black_pc_crc: 0x0797e156 +gray12be total_size: 6144, black_unknown_crc: 0xbd90b83a, black_tv_crc: 0xbd90b83a, black_pc_crc: 0x00000000 +gray12le total_size: 6144, black_unknown_crc: 0x2d4a26f0, black_tv_crc: 0x2d4a26f0, black_pc_crc: 0x00000000 +gray10be total_size: 6144, black_unknown_crc: 0x89569dcf, black_tv_crc: 0x89569dcf, black_pc_crc: 0x00000000 +gray10le total_size: 6144, black_unknown_crc: 0x0b5289bc, black_tv_crc: 0x0b5289bc, black_pc_crc: 0x00000000 +p016le total_size: 9216, black_unknown_crc: 0xfff85b60, black_tv_crc: 0xfff85b60, black_pc_crc: 0xc03cff93 +p016be total_size: 9216, black_unknown_crc: 0x4d4d9903, black_tv_crc: 0x4d4d9903, black_pc_crc: 0x69c6fe01 +gray9be total_size: 6144, black_unknown_crc: 0xa913cdc7, black_tv_crc: 0xa913cdc7, black_pc_crc: 0x00000000 +gray9le total_size: 6144, black_unknown_crc: 0x05a944de, black_tv_crc: 0x05a944de, black_pc_crc: 0x00000000 +gbrpf32be total_size: 36864, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- +gbrpf32le total_size: 36864, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- +gbrapf32be total_size: 49152, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- +gbrapf32le total_size: 49152, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- +gray14be total_size: 6144, black_unknown_crc: 0x9bd1ea2b, black_tv_crc: 0x9bd1ea2b, black_pc_crc: 0x00000000 +gray14le total_size: 6144, black_unknown_crc: 0xb5289bc0, black_tv_crc: 0xb5289bc0, black_pc_crc: 0x00000000 +grayf32be total_size: 12288, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- +grayf32le total_size: 12288, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- +yuva422p12be total_size: 18432, black_unknown_crc: 0xa7067ca1, black_tv_crc: 0xa7067ca1, black_pc_crc: 0xaa881b51 +yuva422p12le total_size: 18432, black_unknown_crc: 0xb6bdf055, black_tv_crc: 0xb6bdf055, black_pc_crc: 0x55b03edf +yuva444p12be total_size: 24576, black_unknown_crc: 0x488f478f, black_tv_crc: 0x488f478f, black_pc_crc: 0xc6fb24d1 +yuva444p12le total_size: 24576, black_unknown_crc: 0xea96f416, black_tv_crc: 0xea96f416, black_pc_crc: 0x201a538b +nv24 total_size: 9216, black_unknown_crc: 0x1c302b58, black_tv_crc: 0x1c302b58, black_pc_crc: 0xdf792ea7 +nv42 total_size: 9216, black_unknown_crc: 0x1c302b58, black_tv_crc: 0x1c302b58, black_pc_crc: 0xdf792ea7 +y210be total_size: 12288, black_unknown_crc: 0x5483d935, black_tv_crc: 0x5483d935, black_pc_crc: 0x06397bf3 +y210le total_size: 12288, black_unknown_crc: 0x5d8e1cf6, black_tv_crc: 0x5d8e1cf6, black_pc_crc: 0x8fceec45 +x2rgb10le total_size: 12288, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +x2rgb10be total_size: 12288, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +x2bgr10le total_size: 12288, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +x2bgr10be total_size: 12288, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +p210be total_size: 12288, black_unknown_crc: 0x0bbe5df7, black_tv_crc: 0x0bbe5df7, black_pc_crc: 0x16a51378 +p210le total_size: 12288, black_unknown_crc: 0x6582d6cf, black_tv_crc: 0x6582d6cf, black_pc_crc: 0xc9dc3ddf +p410be total_size: 18432, black_unknown_crc: 0x26991800, black_tv_crc: 0x26991800, black_pc_crc: 0xfe7f6700 +p410le total_size: 18432, black_unknown_crc: 0x4028ac30, black_tv_crc: 0x4028ac30, black_pc_crc: 0xab7c7698 +p216be total_size: 12288, black_unknown_crc: 0x0bbe5df7, black_tv_crc: 0x0bbe5df7, black_pc_crc: 0x16a51378 +p216le total_size: 12288, black_unknown_crc: 0x6582d6cf, black_tv_crc: 0x6582d6cf, black_pc_crc: 0xc9dc3ddf +p416be total_size: 18432, black_unknown_crc: 0x26991800, black_tv_crc: 0x26991800, black_pc_crc: 0xfe7f6700 +p416le total_size: 18432, black_unknown_crc: 0x4028ac30, black_tv_crc: 0x4028ac30, black_pc_crc: 0xab7c7698 +vuya total_size: 12288, black_unknown_crc: 0x60db2d2c, black_tv_crc: 0x60db2d2c, black_pc_crc: 0x2dae630a +rgbaf16be total_size: 24576, black_unknown_crc: 0x0ab5caf6, black_tv_crc: 0x0ab5caf6, black_pc_crc: 0x0ab5caf6 +rgbaf16le total_size: 24576, black_unknown_crc: 0x0ab5caf6, black_tv_crc: 0x0ab5caf6, black_pc_crc: 0x0ab5caf6 +vuyx total_size: 12288, black_unknown_crc: 0x9181c808, black_tv_crc: 0x9181c808, black_pc_crc: 0xdcf4862e +p012le total_size: 9216, black_unknown_crc: 0xfff85b60, black_tv_crc: 0xfff85b60, black_pc_crc: 0xc03cff93 +p012be total_size: 9216, black_unknown_crc: 0x4d4d9903, black_tv_crc: 0x4d4d9903, black_pc_crc: 0x69c6fe01 +y212be total_size: 12288, black_unknown_crc: 0x5483d935, black_tv_crc: 0x5483d935, black_pc_crc: 0x06397bf3 +y212le total_size: 12288, black_unknown_crc: 0x5d8e1cf6, black_tv_crc: 0x5d8e1cf6, black_pc_crc: 0x8fceec45 +xv30be total_size: 12288, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- +xv30le total_size: 12288, black_unknown_crc: 0x4bb0b075, black_tv_crc: 0x4bb0b075, black_pc_crc: 0x02d585cf +xv36be total_size: 24576, black_unknown_crc: 0x6ba828bd, black_tv_crc: 0x6ba828bd, black_pc_crc: 0x5f450f41 +xv36le total_size: 24576, black_unknown_crc: 0xc3794950, black_tv_crc: 0xc3794950, black_pc_crc: 0x40874939 +rgbf32be total_size: 36864, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- +rgbf32le total_size: 36864, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- +rgbaf32be total_size: 49152, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- +rgbaf32le total_size: 49152, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- +p212be total_size: 12288, black_unknown_crc: 0x0bbe5df7, black_tv_crc: 0x0bbe5df7, black_pc_crc: 0x16a51378 +p212le total_size: 12288, black_unknown_crc: 0x6582d6cf, black_tv_crc: 0x6582d6cf, black_pc_crc: 0xc9dc3ddf +p412be total_size: 18432, black_unknown_crc: 0x26991800, black_tv_crc: 0x26991800, black_pc_crc: 0xfe7f6700 +p412le total_size: 18432, black_unknown_crc: 0x4028ac30, black_tv_crc: 0x4028ac30, black_pc_crc: 0xab7c7698 +gbrap14be total_size: 24576, black_unknown_crc: 0x4ec0d987, black_tv_crc: 0x4ec0d987, black_pc_crc: 0x4ec0d987 +gbrap14le total_size: 24576, black_unknown_crc: 0x13bde353, black_tv_crc: 0x13bde353, black_pc_crc: 0x13bde353 From patchwork Wed Dec 6 08:22:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 44952 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9153:b0:181:818d:5e7f with SMTP id x19csp106352pzc; Wed, 6 Dec 2023 00:23:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IE0RWZ2RpEQf935weK1wKL8U+AY7GehqDgZ0M8/ZYyR0ts8LDl48IoDuHYjHk6CQZi7ATYv X-Received: by 2002:a05:6402:3595:b0:54c:d1a2:45fc with SMTP id y21-20020a056402359500b0054cd1a245fcmr782429edc.3.1701850983620; Wed, 06 Dec 2023 00:23:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701850983; cv=none; d=google.com; s=arc-20160816; b=xhzxrq+HyMF83qOHLXp+gK5rry6vOaH0edkjtLNG+Q2JhZebWWWdGD+IJ3V6+pWGnJ W1pXmPwJPcdUvIJ/cHCHR1WKNx/B/t/br2InZl2mlvVz1EFXTXD5Xsw3aRSsAWkY0SSm xBT7XYh2rjGzUXhrVf1WYKE4E3bhNfTHxzz2FHnkYJ9Iyne6dVe4QlfkAyNw7fGdCAMl 8dALldEN97EnysNUPEaVtf8p2BTLeM7MCPWUtU68K7W8qdocXK2edf/cNy8XWy8JV7CF QLASe+PJKJNvF5h44TFQnn0hqL0H3j1s3BtisJeKaCY9/zIPmMuL5qARaSWTVHiajG8R TiQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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:delivered-to; bh=aNjDeKKHOJ9KOCku3K7pNV02SEYHaBxwCOuvsQlZxOE=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=s3ZXXMe86iZCLAKWxfZ2xIBYHtRB0Pou/97/EjXgBQhNpk75MP6z1CTuQMsfoFggRX S5tTguTir4ZJWFJHhWCz3LNK++Ija7zIG3B4oXpVfJXqV4RZLhDrKq3hRbBm+OSwiavz FlHy9kSC6Y+yU19+QqLvGNyAGtPC5q8hCjX8VOoImDEXYpECSctON59t3vA7ijXQV2Sg 5FHW7fRP2CGuhnfPQ9TGu707Ej4hOCdNs2LsCvIzfttTIRhUAMku8ZUOm+nHO3YLCloE LbZMoXSOSTH+km0HxtRlgU6K1VT2/2a3XoXR2fJOywFnVt7uyXK0vJ05FDJ7BC7GjSmS d5rg== ARC-Authentication-Results: i=1; mx.google.com; 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 ee8-20020a056402290800b0054c4b16b045si1735062edb.626.2023.12.06.00.23.03; Wed, 06 Dec 2023 00:23:03 -0800 (PST) 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; 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 0A0FE68CF5A; Wed, 6 Dec 2023 10:22:39 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 447DC68CDF6 for ; Wed, 6 Dec 2023 10:22:31 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 262B9E9A20; Wed, 6 Dec 2023 09:22:31 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YGgaKYYp6hiF; Wed, 6 Dec 2023 09:22:28 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 9FFFFE9982; Wed, 6 Dec 2023 09:22:27 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Wed, 6 Dec 2023 09:22:16 +0100 Message-Id: <20231206082220.5532-3-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231206082220.5532-1-cus@passwd.hu> References: <20231206082220.5532-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 3/7] avutil/imgutils: fix av_image_fill_black() for some pixel formats 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 Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 4T4+P1MbqGiN - Fixes YA formats, because previous code always assumed alpha as the 4th component. - Fixes PAL format (as long as 0 is black, as in a systematic palette), because previous code assumed it as limited Y. - Fixes XYZ format because it does not need nonzero chroma components - Fixes xv30be as the bitstream mode got merged to the non-bitstream mode. Signed-off-by: Marton Balint --- libavutil/imgutils.c | 49 +++++++++++++++-------------------------- tests/ref/fate/imgutils | 14 ++++++------ 2 files changed, 25 insertions(+), 38 deletions(-) diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c index da3812698e..5e401139c8 100644 --- a/libavutil/imgutils.c +++ b/libavutil/imgutils.c @@ -590,35 +590,18 @@ int av_image_fill_black(uint8_t * const dst_data[4], const ptrdiff_t dst_linesiz uint8_t clear_block[4][MAX_BLOCK_SIZE] = {{0}}; // clear padding with 0 int clear_block_size[4] = {0}; ptrdiff_t plane_line_bytes[4] = {0}; - int rgb, limited; + int rgb, xyz, pal, limited, alpha, bitstream; int plane, c; if (!desc || nb_planes < 1 || nb_planes > 4 || desc->flags & AV_PIX_FMT_FLAG_HWACCEL) return AVERROR(EINVAL); rgb = !!(desc->flags & AV_PIX_FMT_FLAG_RGB); - limited = !rgb && range != AVCOL_RANGE_JPEG; - - if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) { - ptrdiff_t bytewidth = av_image_get_linesize(pix_fmt, width, 0); - uint8_t *data; - int mono = pix_fmt == AV_PIX_FMT_MONOWHITE || pix_fmt == AV_PIX_FMT_MONOBLACK; - int fill = pix_fmt == AV_PIX_FMT_MONOWHITE ? 0xFF : 0; - if (nb_planes != 1 || !(rgb || mono) || bytewidth < 1) - return AVERROR(EINVAL); - - if (!dst_data) - return 0; - - data = dst_data[0]; - - // (Bitstream + alpha will be handled incorrectly - it'll remain transparent.) - for (;height > 0; height--) { - memset(data, fill, bytewidth); - data += dst_linesize[0]; - } - return 0; - } + xyz = !!(desc->flags & AV_PIX_FMT_FLAG_XYZ); + pal = !!(desc->flags & AV_PIX_FMT_FLAG_PAL); + limited = !rgb && !xyz && !pal && range != AVCOL_RANGE_JPEG; + alpha = !pal && !!(desc->flags & AV_PIX_FMT_FLAG_ALPHA); + bitstream = !!(desc->flags & AV_PIX_FMT_FLAG_BITSTREAM); for (c = 0; c < desc->nb_components; c++) { const AVComponentDescriptor comp = desc->comp[c]; @@ -635,7 +618,7 @@ int av_image_fill_black(uint8_t * const dst_data[4], const ptrdiff_t dst_linesiz for (c = 0; c < desc->nb_components; c++) { const AVComponentDescriptor comp = desc->comp[c]; // (Multiple pixels happen e.g. with AV_PIX_FMT_UYVY422.) - int w = clear_block_size[comp.plane] / comp.step; + int w = (bitstream ? 8 : 1) * clear_block_size[comp.plane] / comp.step; uint8_t *c_data[4]; const int c_linesize[4] = {0}; uint16_t src_array[MAX_BLOCK_SIZE]; @@ -644,18 +627,22 @@ int av_image_fill_black(uint8_t * const dst_data[4], const ptrdiff_t dst_linesiz if (comp.depth > 16) return AVERROR(EINVAL); - if (!rgb && comp.depth < 8) - return AVERROR(EINVAL); if (w < 1) return AVERROR(EINVAL); - if (c == 0 && limited) { - src = 16 << (comp.depth - 8); - } else if ((c == 1 || c == 2) && !rgb) { - src = 128 << (comp.depth - 8); - } else if (c == 3) { + if (pix_fmt == AV_PIX_FMT_MONOWHITE) { + src = 1; + } else if (c + 1 == desc->nb_components && alpha) { // (Assume even limited YUV uses full range alpha.) src = (1 << comp.depth) - 1; + } else if (c == 0 && limited && comp.depth > 1) { + if (comp.depth < 8) + return AVERROR(EINVAL); + src = 16 << (comp.depth - 8); + } else if ((c == 1 || c == 2) && !rgb && !xyz) { + if (comp.depth < 8) + return AVERROR(EINVAL); + src = 128 << (comp.depth - 8); } for (x = 0; x < w; x++) diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils index f12bef3fb5..c31bc38d77 100644 --- a/tests/ref/fate/imgutils +++ b/tests/ref/fate/imgutils @@ -282,7 +282,7 @@ yuv411p total_size: 4608, black_unknown_crc: 0xd00f6cc6, black_tv_cr gray total_size: 3072, black_unknown_crc: 0x63e301a2, black_tv_crc: 0x63e301a2, black_pc_crc: 0x00000000 monow total_size: 384, black_unknown_crc: 0x1ba3e150, black_tv_crc: 0x1ba3e150, black_pc_crc: 0x1ba3e150 monob total_size: 384, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 -pal8 total_size: 4096, black_unknown_crc: 0x63e301a2, black_tv_crc: 0x63e301a2, black_pc_crc: 0x00000000 +pal8 total_size: 4096, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 yuvj420p total_size: 4608, black_unknown_crc: 0xd00f6cc6, black_tv_crc: 0xd00f6cc6, black_pc_crc: 0x234969af yuvj422p total_size: 6144, black_unknown_crc: 0x71fcc79c, black_tv_crc: 0x71fcc79c, black_pc_crc: 0xa9fa0192 yuvj444p total_size: 9216, black_unknown_crc: 0x1c302b58, black_tv_crc: 0x1c302b58, black_pc_crc: 0xdf792ea7 @@ -325,7 +325,7 @@ rgb444le total_size: 6144, black_unknown_crc: 0x00000000, black_tv_cr rgb444be total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 bgr444le total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 bgr444be total_size: 6144, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 -ya8 total_size: 6144, black_unknown_crc: 0xcb089fb0, black_tv_crc: 0xcb089fb0, black_pc_crc: 0xc9dc3ddf +ya8 total_size: 6144, black_unknown_crc: 0x21aa6b6a, black_tv_crc: 0x21aa6b6a, black_pc_crc: 0x237ec905 bgr48be total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 bgr48le total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 yuv420p9be total_size: 9216, black_unknown_crc: 0x9154a536, black_tv_crc: 0x9154a536, black_pc_crc: 0xeeddecd0 @@ -367,8 +367,8 @@ yuva422p16be total_size: 18432, black_unknown_crc: 0x630b483b, black_tv_cr yuva422p16le total_size: 18432, black_unknown_crc: 0xdac3d2ac, black_tv_crc: 0xdac3d2ac, black_pc_crc: 0x31970804 yuva444p16be total_size: 24576, black_unknown_crc: 0x4010c8d3, black_tv_crc: 0x4010c8d3, black_pc_crc: 0xca6bd07e yuva444p16le total_size: 24576, black_unknown_crc: 0x1824855b, black_tv_crc: 0x1824855b, black_pc_crc: 0x06f5c440 -xyz12le total_size: 18432, black_unknown_crc: 0x24c4432b, black_tv_crc: 0x24c4432b, black_pc_crc: 0xfe5a7889 -xyz12be total_size: 18432, black_unknown_crc: 0xac983d03, black_tv_crc: 0xac983d03, black_pc_crc: 0x949a61fc +xyz12le total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +xyz12be total_size: 18432, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 nv16 total_size: 6144, black_unknown_crc: 0x71fcc79c, black_tv_crc: 0x71fcc79c, black_pc_crc: 0xa9fa0192 nv20le total_size: 12288, black_unknown_crc: 0x2ef977dc, black_tv_crc: 0x2ef977dc, black_pc_crc: 0x5a944de0 nv20be total_size: 12288, black_unknown_crc: 0x7cb8d0b6, black_tv_crc: 0x7cb8d0b6, black_pc_crc: 0xa0507635 @@ -377,8 +377,8 @@ rgba64le total_size: 24576, black_unknown_crc: 0x0ab5caf6, black_tv_cr bgra64be total_size: 24576, black_unknown_crc: 0x0ab5caf6, black_tv_crc: 0x0ab5caf6, black_pc_crc: 0x0ab5caf6 bgra64le total_size: 24576, black_unknown_crc: 0x0ab5caf6, black_tv_crc: 0x0ab5caf6, black_pc_crc: 0x0ab5caf6 yvyu422 total_size: 6144, black_unknown_crc: 0xcb089fb0, black_tv_crc: 0xcb089fb0, black_pc_crc: 0xc9dc3ddf -ya16be total_size: 12288, black_unknown_crc: 0x5483d935, black_tv_crc: 0x5483d935, black_pc_crc: 0x06397bf3 -ya16le total_size: 12288, black_unknown_crc: 0x5d8e1cf6, black_tv_crc: 0x5d8e1cf6, black_pc_crc: 0x8fceec45 +ya16be total_size: 12288, black_unknown_crc: 0x9f12f9d6, black_tv_crc: 0x9f12f9d6, black_pc_crc: 0xcda85b10 +ya16le total_size: 12288, black_unknown_crc: 0x1fe8aba3, black_tv_crc: 0x1fe8aba3, black_pc_crc: 0xcda85b10 gbrap total_size: 12288, black_unknown_crc: 0xda63f152, black_tv_crc: 0xda63f152, black_pc_crc: 0xda63f152 gbrap16be total_size: 24576, black_unknown_crc: 0x53374343, black_tv_crc: 0x53374343, black_pc_crc: 0x53374343 gbrap16le total_size: 24576, black_unknown_crc: 0x53374343, black_tv_crc: 0x53374343, black_pc_crc: 0x53374343 @@ -471,7 +471,7 @@ p012le total_size: 9216, black_unknown_crc: 0xfff85b60, black_tv_cr p012be total_size: 9216, black_unknown_crc: 0x4d4d9903, black_tv_crc: 0x4d4d9903, black_pc_crc: 0x69c6fe01 y212be total_size: 12288, black_unknown_crc: 0x5483d935, black_tv_crc: 0x5483d935, black_pc_crc: 0x06397bf3 y212le total_size: 12288, black_unknown_crc: 0x5d8e1cf6, black_tv_crc: 0x5d8e1cf6, black_pc_crc: 0x8fceec45 -xv30be total_size: 12288, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- +xv30be total_size: 12288, black_unknown_crc: 0x1c42115f, black_tv_crc: 0x1c42115f, black_pc_crc: 0x37bf2ef8 xv30le total_size: 12288, black_unknown_crc: 0x4bb0b075, black_tv_crc: 0x4bb0b075, black_pc_crc: 0x02d585cf xv36be total_size: 24576, black_unknown_crc: 0x6ba828bd, black_tv_crc: 0x6ba828bd, black_pc_crc: 0x5f450f41 xv36le total_size: 24576, black_unknown_crc: 0xc3794950, black_tv_crc: 0xc3794950, black_pc_crc: 0x40874939 From patchwork Wed Dec 6 08:22:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 44953 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9153:b0:181:818d:5e7f with SMTP id x19csp106417pzc; Wed, 6 Dec 2023 00:23:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGdxpvXD0NNMgzguaV4t9S46f82nuPTXQioLyED+oxIizbbtj0Fz42+NcNxZcZ88JFqNfF/ X-Received: by 2002:a50:f603:0:b0:54b:f6f7:9c4d with SMTP id c3-20020a50f603000000b0054bf6f79c4dmr373410edn.38.1701850994286; Wed, 06 Dec 2023 00:23:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701850994; cv=none; d=google.com; s=arc-20160816; b=cOn/YN9Ruc0NTIia/gHIC7KG8GaLehdPHTie7S4+f7OK71WfttCVwkdKXqWHAl7WYQ 3OKXhq749vaA7P75cxP/9TlFrveEmEA+xomulf+6ax8PeWeqL4JE6Ynzmd24ntt1d/Fs H84slojwsCOF1Fpz8LBu15sZW6N4rVG9zEQGiiAY5ZAs5wwYfRUBj9WYoCwd99CM6rZN uLWCFeicP6T5PNvCiqwEJSLpkJAbPu84VHJKlDa8NnitIw1PPp/cqNh1qbw086fFQZsm lhMixcIMaHCNzwskZY872RuJnERiOkBBXt/EB9hR6xBede6LNjzLoIbnj6zUfU99hyiN BL7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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:delivered-to; bh=oZuMCqP3qLHaL/kzPtOvd/kZ9SRwu+Yl8zv0QJ+vMkM=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=zDy4bymwpv/u50Tdfn1LGkdTUMnN/Shyr/UGLcklvgNWzJUbz8R991od3xPsp+B8rh wPHu1+uBObmbHIaeys2AbyZMIv+Cr4kA+s2k0X/2vKD25Bw/a2mB+AX3Ula0k0DPW84B K9mBi+SIkRk9A3U7JOnUXgthiXziTt55Z3Xp2L3YTcjgfmOMKPFuLUVU4WYg/c4B/qo2 sH2mauzt0z/XLgEaJBYjyRpSNQu5jHn5QoBS4KVxBUq+ybTciRLbYG8SEOG8k0I0R2XE RQkaz9w3KfA/1jqFuKkV2bIfCfDijg0XzWIBbj39ep5bJSbsxv5JT4zT30fiPffl3/jg ARMA== ARC-Authentication-Results: i=1; mx.google.com; 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 k16-20020a508ad0000000b0054cb2a0de51si1804773edk.128.2023.12.06.00.23.13; Wed, 06 Dec 2023 00:23:14 -0800 (PST) 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; 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 9756A68CF59; Wed, 6 Dec 2023 10:22:41 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 666B568CEDF for ; Wed, 6 Dec 2023 10:22:32 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 4B355E9A28; Wed, 6 Dec 2023 09:22:32 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Lnu_zXjdmh9f; Wed, 6 Dec 2023 09:22:30 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 974B1E9A24; Wed, 6 Dec 2023 09:22:28 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Wed, 6 Dec 2023 09:22:17 +0100 Message-Id: <20231206082220.5532-4-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231206082220.5532-1-cus@passwd.hu> References: <20231206082220.5532-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 4/7] avutil/imgutils: add support for 32bit pixel format for av_image_fill_black() 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 Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: hPX57EK8f0OH Signed-off-by: Marton Balint --- libavutil/imgutils.c | 33 +++++++++++++++++++++++---------- tests/ref/fate/imgutils | 24 ++++++++++++------------ 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c index 5e401139c8..67119b0870 100644 --- a/libavutil/imgutils.c +++ b/libavutil/imgutils.c @@ -590,7 +590,7 @@ int av_image_fill_black(uint8_t * const dst_data[4], const ptrdiff_t dst_linesiz uint8_t clear_block[4][MAX_BLOCK_SIZE] = {{0}}; // clear padding with 0 int clear_block_size[4] = {0}; ptrdiff_t plane_line_bytes[4] = {0}; - int rgb, xyz, pal, limited, alpha, bitstream; + int rgb, xyz, pal, limited, alpha, bitstream, fltp; int plane, c; if (!desc || nb_planes < 1 || nb_planes > 4 || desc->flags & AV_PIX_FMT_FLAG_HWACCEL) @@ -602,6 +602,7 @@ int av_image_fill_black(uint8_t * const dst_data[4], const ptrdiff_t dst_linesiz limited = !rgb && !xyz && !pal && range != AVCOL_RANGE_JPEG; alpha = !pal && !!(desc->flags & AV_PIX_FMT_FLAG_ALPHA); bitstream = !!(desc->flags & AV_PIX_FMT_FLAG_BITSTREAM); + fltp = !!(desc->flags & AV_PIX_FMT_FLAG_FLOAT); for (c = 0; c < desc->nb_components; c++) { const AVComponentDescriptor comp = desc->comp[c]; @@ -621,11 +622,11 @@ int av_image_fill_black(uint8_t * const dst_data[4], const ptrdiff_t dst_linesiz int w = (bitstream ? 8 : 1) * clear_block_size[comp.plane] / comp.step; uint8_t *c_data[4]; const int c_linesize[4] = {0}; - uint16_t src_array[MAX_BLOCK_SIZE]; - uint16_t src = 0; + uint32_t src_array[MAX_BLOCK_SIZE]; + uint32_t src = 0; int x; - if (comp.depth > 16) + if (comp.depth > 32) return AVERROR(EINVAL); if (w < 1) return AVERROR(EINVAL); @@ -634,15 +635,27 @@ int av_image_fill_black(uint8_t * const dst_data[4], const ptrdiff_t dst_linesiz src = 1; } else if (c + 1 == desc->nb_components && alpha) { // (Assume even limited YUV uses full range alpha.) - src = (1 << comp.depth) - 1; + if (fltp) { + if (comp.depth != 16 && comp.depth != 32) + return AVERROR(EINVAL); + src = (comp.depth == 16 ? 0x3C00 : 0x3F800000); // 1.0 + } else { + src = (comp.depth == 32 ? 0 : (1 << comp.depth)) - 1; + } } else if (c == 0 && limited && comp.depth > 1) { - if (comp.depth < 8) + if (comp.depth < 8 || (fltp && comp.depth != 16 && comp.depth != 32)) return AVERROR(EINVAL); - src = 16 << (comp.depth - 8); + if (fltp) + src = (comp.depth == 16 ? 0x3000 : 0x3D800000); // 0.0625 + else + src = 16 << (comp.depth - 8); } else if ((c == 1 || c == 2) && !rgb && !xyz) { - if (comp.depth < 8) + if (comp.depth < 8 || fltp && comp.depth != 16 && comp.depth != 32) return AVERROR(EINVAL); - src = 128 << (comp.depth - 8); + if (fltp) + src = (comp.depth == 16 ? 0x3800 : 0x3F000000); // 0.5 + else + src = 128 << (comp.depth - 8); } for (x = 0; x < w; x++) @@ -651,7 +664,7 @@ int av_image_fill_black(uint8_t * const dst_data[4], const ptrdiff_t dst_linesiz for (x = 0; x < 4; x++) c_data[x] = &clear_block[x][0]; - av_write_image_line(src_array, c_data, c_linesize, desc, 0, 0, c, w); + av_write_image_line2(src_array, c_data, c_linesize, desc, 0, 0, c, w, 4); } for (plane = 0; plane < nb_planes; plane++) { diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils index c31bc38d77..fb2ed6d158 100644 --- a/tests/ref/fate/imgutils +++ b/tests/ref/fate/imgutils @@ -435,14 +435,14 @@ p016le total_size: 9216, black_unknown_crc: 0xfff85b60, black_tv_cr p016be total_size: 9216, black_unknown_crc: 0x4d4d9903, black_tv_crc: 0x4d4d9903, black_pc_crc: 0x69c6fe01 gray9be total_size: 6144, black_unknown_crc: 0xa913cdc7, black_tv_crc: 0xa913cdc7, black_pc_crc: 0x00000000 gray9le total_size: 6144, black_unknown_crc: 0x05a944de, black_tv_crc: 0x05a944de, black_pc_crc: 0x00000000 -gbrpf32be total_size: 36864, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- -gbrpf32le total_size: 36864, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- -gbrapf32be total_size: 49152, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- -gbrapf32le total_size: 49152, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- +gbrpf32be total_size: 36864, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +gbrpf32le total_size: 36864, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +gbrapf32be total_size: 49152, black_unknown_crc: 0xda9c5af9, black_tv_crc: 0xda9c5af9, black_pc_crc: 0xda9c5af9 +gbrapf32le total_size: 49152, black_unknown_crc: 0xd2f28790, black_tv_crc: 0xd2f28790, black_pc_crc: 0xd2f28790 gray14be total_size: 6144, black_unknown_crc: 0x9bd1ea2b, black_tv_crc: 0x9bd1ea2b, black_pc_crc: 0x00000000 gray14le total_size: 6144, black_unknown_crc: 0xb5289bc0, black_tv_crc: 0xb5289bc0, black_pc_crc: 0x00000000 -grayf32be total_size: 12288, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- -grayf32le total_size: 12288, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- +grayf32be total_size: 12288, black_unknown_crc: 0x4bafcc11, black_tv_crc: 0x4bafcc11, black_pc_crc: 0x00000000 +grayf32le total_size: 12288, black_unknown_crc: 0xca17685c, black_tv_crc: 0xca17685c, black_pc_crc: 0x00000000 yuva422p12be total_size: 18432, black_unknown_crc: 0xa7067ca1, black_tv_crc: 0xa7067ca1, black_pc_crc: 0xaa881b51 yuva422p12le total_size: 18432, black_unknown_crc: 0xb6bdf055, black_tv_crc: 0xb6bdf055, black_pc_crc: 0x55b03edf yuva444p12be total_size: 24576, black_unknown_crc: 0x488f478f, black_tv_crc: 0x488f478f, black_pc_crc: 0xc6fb24d1 @@ -464,8 +464,8 @@ p216le total_size: 12288, black_unknown_crc: 0x6582d6cf, black_tv_cr p416be total_size: 18432, black_unknown_crc: 0x26991800, black_tv_crc: 0x26991800, black_pc_crc: 0xfe7f6700 p416le total_size: 18432, black_unknown_crc: 0x4028ac30, black_tv_crc: 0x4028ac30, black_pc_crc: 0xab7c7698 vuya total_size: 12288, black_unknown_crc: 0x60db2d2c, black_tv_crc: 0x60db2d2c, black_pc_crc: 0x2dae630a -rgbaf16be total_size: 24576, black_unknown_crc: 0x0ab5caf6, black_tv_crc: 0x0ab5caf6, black_pc_crc: 0x0ab5caf6 -rgbaf16le total_size: 24576, black_unknown_crc: 0x0ab5caf6, black_tv_crc: 0x0ab5caf6, black_pc_crc: 0x0ab5caf6 +rgbaf16be total_size: 24576, black_unknown_crc: 0x76fd69af, black_tv_crc: 0x76fd69af, black_pc_crc: 0x76fd69af +rgbaf16le total_size: 24576, black_unknown_crc: 0x21283f40, black_tv_crc: 0x21283f40, black_pc_crc: 0x21283f40 vuyx total_size: 12288, black_unknown_crc: 0x9181c808, black_tv_crc: 0x9181c808, black_pc_crc: 0xdcf4862e p012le total_size: 9216, black_unknown_crc: 0xfff85b60, black_tv_crc: 0xfff85b60, black_pc_crc: 0xc03cff93 p012be total_size: 9216, black_unknown_crc: 0x4d4d9903, black_tv_crc: 0x4d4d9903, black_pc_crc: 0x69c6fe01 @@ -475,10 +475,10 @@ xv30be total_size: 12288, black_unknown_crc: 0x1c42115f, black_tv_cr xv30le total_size: 12288, black_unknown_crc: 0x4bb0b075, black_tv_crc: 0x4bb0b075, black_pc_crc: 0x02d585cf xv36be total_size: 24576, black_unknown_crc: 0x6ba828bd, black_tv_crc: 0x6ba828bd, black_pc_crc: 0x5f450f41 xv36le total_size: 24576, black_unknown_crc: 0xc3794950, black_tv_crc: 0xc3794950, black_pc_crc: 0x40874939 -rgbf32be total_size: 36864, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- -rgbf32le total_size: 36864, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- -rgbaf32be total_size: 49152, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- -rgbaf32le total_size: 49152, black_unknown_crc: ----------, black_tv_crc: ----------, black_pc_crc: ---------- +rgbf32be total_size: 36864, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +rgbf32le total_size: 36864, black_unknown_crc: 0x00000000, black_tv_crc: 0x00000000, black_pc_crc: 0x00000000 +rgbaf32be total_size: 49152, black_unknown_crc: 0x5eae6680, black_tv_crc: 0x5eae6680, black_pc_crc: 0x5eae6680 +rgbaf32le total_size: 49152, black_unknown_crc: 0x11d73f6d, black_tv_crc: 0x11d73f6d, black_pc_crc: 0x11d73f6d p212be total_size: 12288, black_unknown_crc: 0x0bbe5df7, black_tv_crc: 0x0bbe5df7, black_pc_crc: 0x16a51378 p212le total_size: 12288, black_unknown_crc: 0x6582d6cf, black_tv_crc: 0x6582d6cf, black_pc_crc: 0xc9dc3ddf p412be total_size: 18432, black_unknown_crc: 0x26991800, black_tv_crc: 0x26991800, black_pc_crc: 0xfe7f6700 From patchwork Wed Dec 6 08:22:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 44954 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9153:b0:181:818d:5e7f with SMTP id x19csp106481pzc; Wed, 6 Dec 2023 00:23:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IHnxLAH3efbgz5LmGI4o8Aur+ZWbrUVBIBJ6qOnYWeP2Z/WIDsJPzRz8Xw0bjg738vKcvBl X-Received: by 2002:a17:906:c7cf:b0:a19:6a79:2d3f with SMTP id dc15-20020a170906c7cf00b00a196a792d3fmr715736ejb.1.1701851005208; Wed, 06 Dec 2023 00:23:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701851005; cv=none; d=google.com; s=arc-20160816; b=s3GaMuetPuPSKWhOw0jdM6Awk214ENjY0M484NanWxb1p2G967xbl9GuFolVFtTug/ Jm7ku4l++4jUqkuqwyv6IyQbO/7aKW9QhgIFMOudiFgSQOh9g0meHvPwB8zfMRSH4Npq VKbdM6XcLuPkGoT7F5JFgg8xwGg13JKhSwlhg1s08pXNS6hiR2QdDSomWIeHhhG6EQKt kgPhyrvPMcYj8uP0D6+Vi2c50sRVNm6JYYLnLCYN68DGbc2aXwuHm58puvrn527p4ukO 0lOGEhKX5t1GTRBqYKdGTGz6/Z5H1dv2m/T9bHuV0KZoLR/1V0UJAhHZybyKCfoJHnm2 5dlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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:delivered-to; bh=WhxYM5ckJ/lGtZl4PCFK3uD+jUpwd5bOkenWTPwQkz0=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=LYN6w/zgkbjfUQIdHFTtbr3+xRLP9ApBwmHoeMi9iyULYWjs4y93AimXxolLlOm/U3 lLSrBkDUAPm5yfj0HOEOrQ+8GND5adREwg+l5uFlZ3xaKoJSi5cNi/P2Gv5rXrFctHCp Imxbz8RqeBM4GWoRAZ80zWwEHle1PsXXO0TZElIxNjz0vJzz1dhkRoxoTBNoYCMTUN2S yYBRYRK7qSaxaKaethMTr9+/RJOUYBe1oTRjLABEdl9ALbqWHqahpIGh544LeY3eZM1g b1tlM8DtVA4ydo/H2lnIH5O7JR/PH0DNWZEyOwIQOldmOCjlQCw5w2XV/moO6feTLlz/ NMRQ== ARC-Authentication-Results: i=1; mx.google.com; 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 f23-20020a170906561700b00a0f78bc6480si6459910ejq.934.2023.12.06.00.23.24; Wed, 06 Dec 2023 00:23:25 -0800 (PST) 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; 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 E05E768CF5D; Wed, 6 Dec 2023 10:22:42 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3F53C68CEDF for ; Wed, 6 Dec 2023 10:22:33 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 279F5E9A1E; Wed, 6 Dec 2023 09:22:33 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MDP33us6S7uU; Wed, 6 Dec 2023 09:22:31 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 0BE6EE9A25; Wed, 6 Dec 2023 09:22:30 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Wed, 6 Dec 2023 09:22:18 +0100 Message-Id: <20231206082220.5532-5-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231206082220.5532-1-cus@passwd.hu> References: <20231206082220.5532-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 5/7] avutil/imgutils: factorize a fill color function 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 Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 5tQQQ49gBIC9 In preparation for making it public. Signed-off-by: Marton Balint --- libavutil/imgutils.c | 103 +++++++++++++++++++++++++++---------------- 1 file changed, 64 insertions(+), 39 deletions(-) diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c index 67119b0870..278e30ee0f 100644 --- a/libavutil/imgutils.c +++ b/libavutil/imgutils.c @@ -579,30 +579,24 @@ static void memset_bytes(uint8_t *dst, size_t dst_size, uint8_t *clear, // if it's a subsampled packed format). #define MAX_BLOCK_SIZE 32 -int av_image_fill_black(uint8_t * const dst_data[4], const ptrdiff_t dst_linesize[4], - enum AVPixelFormat pix_fmt, enum AVColorRange range, +static int image_fill_color(uint8_t * const dst_data[4], const ptrdiff_t dst_linesize[4], + enum AVPixelFormat pix_fmt, const uint32_t color[4], int width, int height) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); int nb_planes = av_pix_fmt_count_planes(pix_fmt); - // A pixel or a group of pixels on each plane, with a value that represents black. + // A pixel or a group of pixels on each plane, with a value that represents the color. // Consider e.g. AV_PIX_FMT_UYVY422 for non-trivial cases. uint8_t clear_block[4][MAX_BLOCK_SIZE] = {{0}}; // clear padding with 0 int clear_block_size[4] = {0}; ptrdiff_t plane_line_bytes[4] = {0}; - int rgb, xyz, pal, limited, alpha, bitstream, fltp; + int bitstream; int plane, c; if (!desc || nb_planes < 1 || nb_planes > 4 || desc->flags & AV_PIX_FMT_FLAG_HWACCEL) return AVERROR(EINVAL); - rgb = !!(desc->flags & AV_PIX_FMT_FLAG_RGB); - xyz = !!(desc->flags & AV_PIX_FMT_FLAG_XYZ); - pal = !!(desc->flags & AV_PIX_FMT_FLAG_PAL); - limited = !rgb && !xyz && !pal && range != AVCOL_RANGE_JPEG; - alpha = !pal && !!(desc->flags & AV_PIX_FMT_FLAG_ALPHA); bitstream = !!(desc->flags & AV_PIX_FMT_FLAG_BITSTREAM); - fltp = !!(desc->flags & AV_PIX_FMT_FLAG_FLOAT); for (c = 0; c < desc->nb_components; c++) { const AVComponentDescriptor comp = desc->comp[c]; @@ -623,7 +617,6 @@ int av_image_fill_black(uint8_t * const dst_data[4], const ptrdiff_t dst_linesiz uint8_t *c_data[4]; const int c_linesize[4] = {0}; uint32_t src_array[MAX_BLOCK_SIZE]; - uint32_t src = 0; int x; if (comp.depth > 32) @@ -631,35 +624,8 @@ int av_image_fill_black(uint8_t * const dst_data[4], const ptrdiff_t dst_linesiz if (w < 1) return AVERROR(EINVAL); - if (pix_fmt == AV_PIX_FMT_MONOWHITE) { - src = 1; - } else if (c + 1 == desc->nb_components && alpha) { - // (Assume even limited YUV uses full range alpha.) - if (fltp) { - if (comp.depth != 16 && comp.depth != 32) - return AVERROR(EINVAL); - src = (comp.depth == 16 ? 0x3C00 : 0x3F800000); // 1.0 - } else { - src = (comp.depth == 32 ? 0 : (1 << comp.depth)) - 1; - } - } else if (c == 0 && limited && comp.depth > 1) { - if (comp.depth < 8 || (fltp && comp.depth != 16 && comp.depth != 32)) - return AVERROR(EINVAL); - if (fltp) - src = (comp.depth == 16 ? 0x3000 : 0x3D800000); // 0.0625 - else - src = 16 << (comp.depth - 8); - } else if ((c == 1 || c == 2) && !rgb && !xyz) { - if (comp.depth < 8 || fltp && comp.depth != 16 && comp.depth != 32) - return AVERROR(EINVAL); - if (fltp) - src = (comp.depth == 16 ? 0x3800 : 0x3F000000); // 0.5 - else - src = 128 << (comp.depth - 8); - } - for (x = 0; x < w; x++) - src_array[x] = src; + src_array[x] = color[c]; for (x = 0; x < 4; x++) c_data[x] = &clear_block[x][0]; @@ -690,3 +656,62 @@ int av_image_fill_black(uint8_t * const dst_data[4], const ptrdiff_t dst_linesiz return 0; } + +int av_image_fill_black(uint8_t * const dst_data[4], const ptrdiff_t dst_linesize[4], + enum AVPixelFormat pix_fmt, enum AVColorRange range, + int width, int height) +{ + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); + int nb_planes = av_pix_fmt_count_planes(pix_fmt); + int rgb, xyz, pal, limited, alpha, fltp; + uint32_t colors[4] = {0}; + + if (!desc || nb_planes < 1 || nb_planes > 4 || desc->flags & AV_PIX_FMT_FLAG_HWACCEL) + return AVERROR(EINVAL); + + rgb = !!(desc->flags & AV_PIX_FMT_FLAG_RGB); + xyz = !!(desc->flags & AV_PIX_FMT_FLAG_XYZ); + pal = !!(desc->flags & AV_PIX_FMT_FLAG_PAL); + limited = !rgb && !xyz && !pal && range != AVCOL_RANGE_JPEG; + alpha = !pal && !!(desc->flags & AV_PIX_FMT_FLAG_ALPHA); + fltp = !!(desc->flags & AV_PIX_FMT_FLAG_FLOAT); + + for (int c = 0; c < desc->nb_components; c++) { + const AVComponentDescriptor comp = desc->comp[c]; + uint32_t color = 0; + + if (comp.depth > 32) + return AVERROR(EINVAL); + + if (pix_fmt == AV_PIX_FMT_MONOWHITE) { + color = 1; + } else if (c + 1 == desc->nb_components && alpha) { + // (Assume even limited YUV uses full range alpha.) + if (fltp) { + if (comp.depth != 16 && comp.depth != 32) + return AVERROR(EINVAL); + color = (comp.depth == 16 ? 0x3C00 : 0x3F800000); // 1.0 + } else { + color = (comp.depth == 32 ? 0 : (1 << comp.depth)) - 1; + } + } else if (c == 0 && limited && comp.depth > 1) { + if (comp.depth < 8 || (fltp && comp.depth != 16 && comp.depth != 32)) + return AVERROR(EINVAL); + if (fltp) + color = (comp.depth == 16 ? 0x3000 : 0x3D800000); // 0.0625 + else + color = 16 << (comp.depth - 8); + } else if ((c == 1 || c == 2) && !rgb && !xyz) { + if (comp.depth < 8 || fltp && comp.depth != 16 && comp.depth != 32) + return AVERROR(EINVAL); + if (fltp) + color = (comp.depth == 16 ? 0x3800 : 0x3F000000); // 0.5 + else + color = 128 << (comp.depth - 8); + } + + colors[c] = color; + } + + return image_fill_color(dst_data, dst_linesize, pix_fmt, colors, width, height); +} From patchwork Wed Dec 6 08:22:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 44955 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9153:b0:181:818d:5e7f with SMTP id x19csp106556pzc; Wed, 6 Dec 2023 00:23:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4pIKZmpmXQl8iZczlyDQ127rW1EQc7vCT35fRNB2wDLPj96uslkfmRdUfbXzZxB24SDlP X-Received: by 2002:a17:906:297:b0:a1c:4c3e:99e2 with SMTP id 23-20020a170906029700b00a1c4c3e99e2mr2884387ejf.22.1701851017014; Wed, 06 Dec 2023 00:23:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701851017; cv=none; d=google.com; s=arc-20160816; b=YngCGUBQvsz83Xgp4XgVwCemHvEG7HGFHsKy5Nno3kNXHBjuf2nVbBdmxf3ORCvXwU 395FbBm23TBAxfepRGTttnE/4tI3mXhQc41JboGPvsTRzZe8vfCosfPsGNqaHPoTyFbl TqZsN7eA2KjVX5wWCHyYTmBT4e8bnxQSJaJfLQioQPs5DOkZn/uRVaW1Z6Kjy/33PR8s 4pAOIU4Hz8OWG81DzqFUbgt8JytgaJTNAozzf4ytMnTzhCWHBmDEPTXZum/pUHpQ7an1 JQv+BxXLZDVHqqqn6qYSSlFyNnIK2Im39AnXLCtegKevq/cVU1RUiZr5PYp0Shj9GjU3 sBvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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:delivered-to; bh=2KiYRKCd3X6R7jwzGp2o5I6d4lc/zBLgAw4mV5u/48A=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=SWkzux1OhL5qszXhDCYem7l7lKUfU0snv9gZOdJCD6HvN07/gcQOh7OV8aLXlVJKHV 52LFZL7RLbG5o95Bl5m8qbKYwIyu4WJfAXy/Pe7znwKUuAMIyWfOa+3yHCKmyM8schm+ g9nGHla9VmLvaU5S6ZPqwep3TxFa1pK/TylQE1UBkMuTTzR3LWsYOsJK57TacJ/8mGwP jDSAnp2tjV58S9iSUdT9JRA2drqQWEmTNjJsrx7Z4zVvG86A/NRx4PuTLRqr/tWt/ido HeK4O1dRW2o/rjgF+zBnYFBnBVY8Qtcsqs4sLQ3Ue+jT3WjpTZjs7bFo1EPmh9AEY/yx ZfMA== ARC-Authentication-Results: i=1; mx.google.com; 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 r10-20020a170906350a00b009d441527214si6452761eja.1045.2023.12.06.00.23.36; Wed, 06 Dec 2023 00:23:36 -0800 (PST) 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; 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 0951E68CF5C; Wed, 6 Dec 2023 10:22:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AF36568CF57 for ; Wed, 6 Dec 2023 10:22:34 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 97BD1E9A21; Wed, 6 Dec 2023 09:22:34 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QJvuZPxKC6ZG; Wed, 6 Dec 2023 09:22:32 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 18184E9A27; Wed, 6 Dec 2023 09:22:31 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Wed, 6 Dec 2023 09:22:19 +0100 Message-Id: <20231206082220.5532-6-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231206082220.5532-1-cus@passwd.hu> References: <20231206082220.5532-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 6/7] avutil/imgutils: add new function av_image_fill_color() 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 Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: kixXBFlOFNTY Signed-off-by: Marton Balint --- doc/APIchanges | 3 +++ libavutil/imgutils.c | 4 ++-- libavutil/imgutils.h | 30 ++++++++++++++++++++++++++++++ libavutil/version.h | 2 +- 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 4a2dc1c44f..416e2bec5e 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09 API changes, most recent first: +2023-12-xx - xxxxxxxxxxx - lavu 58.33.100 - imgutils.h + Add av_image_fill_color() + 2023-11-08 - b82957a66a7 - lavu 58.32.100 - channel_layout.h Add AV_CH_LAYOUT_7POINT2POINT3 and AV_CHANNEL_LAYOUT_7POINT2POINT3. Add AV_CH_LAYOUT_9POINT1POINT4_BACK and AV_CHANNEL_LAYOUT_9POINT1POINT4_BACK. diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c index 278e30ee0f..e1eefcdd70 100644 --- a/libavutil/imgutils.c +++ b/libavutil/imgutils.c @@ -579,7 +579,7 @@ static void memset_bytes(uint8_t *dst, size_t dst_size, uint8_t *clear, // if it's a subsampled packed format). #define MAX_BLOCK_SIZE 32 -static int image_fill_color(uint8_t * const dst_data[4], const ptrdiff_t dst_linesize[4], +int av_image_fill_color(uint8_t * const dst_data[4], const ptrdiff_t dst_linesize[4], enum AVPixelFormat pix_fmt, const uint32_t color[4], int width, int height) { @@ -713,5 +713,5 @@ int av_image_fill_black(uint8_t * const dst_data[4], const ptrdiff_t dst_linesiz colors[c] = color; } - return image_fill_color(dst_data, dst_linesize, pix_fmt, colors, width, height); + return av_image_fill_color(dst_data, dst_linesize, pix_fmt, colors, width, height); } diff --git a/libavutil/imgutils.h b/libavutil/imgutils.h index fa3bb101b1..6e744b0cac 100644 --- a/libavutil/imgutils.h +++ b/libavutil/imgutils.h @@ -339,6 +339,36 @@ int av_image_fill_black(uint8_t * const dst_data[4], const ptrdiff_t dst_linesiz enum AVPixelFormat pix_fmt, enum AVColorRange range, int width, int height); +/** + * Overwrite the image data with a color. This is suitable for filling a + * sub-rectangle of an image, meaning the padding between the right most pixel + * and the left most pixel on the next line will not be overwritten. For some + * formats, the image size might be rounded up due to inherent alignment. + * + * If the pixel format has alpha, it is also replaced. Color component values + * are interpreted as native integers (or intfloats) regardless of actual pixel + * format endianness. + * + * This can return an error if the pixel format is not supported. Normally, all + * non-hwaccel pixel formats should be supported. + * + * Passing NULL for dst_data is allowed. Then the function returns whether the + * operation would have succeeded. (It can return an error if the pix_fmt is + * not supported.) + * + * @param dst_data data pointers to destination image + * @param dst_linesize linesizes for the destination image + * @param pix_fmt the pixel format of the image + * @param color the color components to be used for the fill + * @param width the width of the image in pixels + * @param height the height of the image in pixels + * @return 0 if the image data was filled, a negative AVERROR code otherwise + */ +int av_image_fill_color(uint8_t * const dst_data[4], const ptrdiff_t dst_linesize[4], + enum AVPixelFormat pix_fmt, const uint32_t color[4], + int width, int height); + + /** * @} */ diff --git a/libavutil/version.h b/libavutil/version.h index c5fa7c3692..0684996bf2 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 58 -#define LIBAVUTIL_VERSION_MINOR 32 +#define LIBAVUTIL_VERSION_MINOR 33 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ From patchwork Wed Dec 6 08:22:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 44949 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9153:b0:181:818d:5e7f with SMTP id x19csp106631pzc; Wed, 6 Dec 2023 00:23:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IGvh1eZKdweYO4DDEv5SyDdDNQSFMYJq2XtyGxg91jnIBsJLEH+57hIBI+54XdWpP1sYhkP X-Received: by 2002:a17:906:2b55:b0:a19:4f2b:f78a with SMTP id b21-20020a1709062b5500b00a194f2bf78amr222440ejg.5.1701851028478; Wed, 06 Dec 2023 00:23:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701851028; cv=none; d=google.com; s=arc-20160816; b=A4+ck+cQur5KJwIgpEw0W1jEih0dN8nY45VK8YhrOBMHX2v8MLT/sr5PWZmfM9gfzv pXeobtzmA1tmbaTQ1riinCUPI/Hr7ImzgRgTFnecVhnv0pONdBQOD8el0BNuP0/kRLKj DS/PLtR5JuFMfFzjzCreiF5gul7A8yWPgWt77F8IGdFfNZrHsuAlTiBLVM0kseC81FXz 2vZgVAtnUTZbkeA/ULw1mmwmxvrfvWp6dOhnoHBPqJ5X7gukDYP9rK1//BzRyCjXSV7o 34GUJCuu2L2L/Kr6wvsGrw6BiZB7+uqw+jdibqocg2KJgckHA+i+1k99RFFZ1ZwoyxU1 ov1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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:delivered-to; bh=ruk3yrQC+4chWLc4o0xLgcxZ3RvFJVqHLLNEVI+MlLU=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=OavsD1mDpKMnSzCzjwI6uBE/fHEmgz0/kQIgZ5V/Y1aWLJ6xIzp0KSJkBKx+m4ko3V eucZ5MDyPc2nTCIinfPp2qVg13tpZpLdnyIdg8Cne0utCoAYA2eFj7pl5uLNKw0V2T5V p7HxqkSN9MGBa3mwhDPxEkAx24IicWAsTp/rkJUJh2CaLadaVzuoNuvyJ9PIy0FFNhmO 5Azj0dw4V6FW7dSlGK5LQb0fr4jMoeWpIUwRrf6unm0cfZgRvMyZ93fUbVcqPI9c/3QT OW2cWPhvAm1EGOstcp4bKrhxnoFawxI2C12jzKTWrDWgSbc46oxWgHMQBz/N6ffI3Jdj STTw== ARC-Authentication-Results: i=1; mx.google.com; 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 u25-20020a1709060b1900b009fc5429b148si6205088ejg.586.2023.12.06.00.23.48; Wed, 06 Dec 2023 00:23:48 -0800 (PST) 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; 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 2820B68CF75; Wed, 6 Dec 2023 10:22:46 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AE1E868CF5D for ; Wed, 6 Dec 2023 10:22:37 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 93C4FE9982; Wed, 6 Dec 2023 09:22:37 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1kG5NqBYHfds; Wed, 6 Dec 2023 09:22:35 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id D54C4E9A23; Wed, 6 Dec 2023 09:22:31 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Wed, 6 Dec 2023 09:22:20 +0100 Message-Id: <20231206082220.5532-7-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231206082220.5532-1-cus@passwd.hu> References: <20231206082220.5532-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 7/7] avcodec: add AV_CODEC_FLAG_CLEAR 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 Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: AlhbbMlF4w4r Signed-off-by: Marton Balint --- doc/APIchanges | 3 +++ doc/codecs.texi | 14 ++++++++++++++ libavcodec/avcodec.h | 4 ++++ libavcodec/decode.c | 6 ++++++ libavcodec/options_table.h | 1 + libavcodec/version.h | 2 +- 6 files changed, 29 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 416e2bec5e..f839504a64 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09 API changes, most recent first: +2023-12-xx - xxxxxxxxxxx - lavc 60.36.100 - avcodec.h + Add AV_CODEC_FLAG_CLEAR. + 2023-12-xx - xxxxxxxxxxx - lavu 58.33.100 - imgutils.h Add av_image_fill_color() diff --git a/doc/codecs.texi b/doc/codecs.texi index 5b950b4560..0504a535f2 100644 --- a/doc/codecs.texi +++ b/doc/codecs.texi @@ -76,6 +76,20 @@ Apply interlaced motion estimation. Use closed gop. @item output_corrupt Output even potentially corrupted frames. +@item clear +Clear the contents of the video buffer before decoding the next picture to it. + +Usually if only a part of a picture is affected by a decode error then the +decoder (if it implements error concealment) tries to hide it by interpolating +pixels from neighbouring areas or in some cases from the previous frame. Even +without error concealment it is quite likely that the affected area will +contain pixels from an earlier frame, due to frame pooling. + +For quality checking this might not be desirable, because it makes the errors +less noticable. By using this flag, and combining it with disabled error +concealment (@code{-ec 0}) it is possible to ensure that no leftover data from +an earlier frame is presented in areas affected by decode errors. + @end table @item time_base @var{rational number} diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 7fb44e28f4..97848e942f 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -312,6 +312,10 @@ typedef struct RcOverride{ * loop filter. */ #define AV_CODEC_FLAG_LOOP_FILTER (1 << 11) +/** + * Clear frame buffer contents before decoding. + */ +#define AV_CODEC_FLAG_CLEAR (1 << 12) /** * Only decode/encode grayscale. */ diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 2cfb3fcf97..f9b18a2c35 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1675,6 +1675,12 @@ FF_ENABLE_DEPRECATION_WARNINGS validate_avframe_allocation(avctx, frame); + if (avctx->flags & AV_CODEC_FLAG_CLEAR && avctx->codec_type == AVMEDIA_TYPE_VIDEO) { + uint32_t color[4] = {0}; + ptrdiff_t linesize[4] = {frame->linesize[0], frame->linesize[1], frame->linesize[2], frame->linesize[3]}; + av_image_fill_color(frame->data, linesize, frame->format, color, frame->width, frame->height); + } + ret = ff_attach_decode_data(frame); if (ret < 0) goto fail; diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index ee243d9894..23ff4cddf8 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -62,6 +62,7 @@ static const AVOption avcodec_options[] = { {"frame_duration", "use frame durations", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_FRAME_DURATION}, .unit = "flags"}, {"pass1", "use internal 2-pass ratecontrol in first pass mode", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_PASS1 }, INT_MIN, INT_MAX, 0, "flags"}, {"pass2", "use internal 2-pass ratecontrol in second pass mode", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_PASS2 }, INT_MIN, INT_MAX, 0, "flags"}, +{"clear", "clear frames before decoding", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_CLEAR }, INT_MIN, INT_MAX, V|D, "flags"}, {"gray", "only decode/encode grayscale", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_GRAY }, INT_MIN, INT_MAX, V|E|D, "flags"}, {"psnr", "error[?] variables will be set during encoding", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_PSNR }, INT_MIN, INT_MAX, V|E, "flags"}, {"ildct", "use interlaced DCT", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_INTERLACED_DCT }, INT_MIN, INT_MAX, V|E, "flags"}, diff --git a/libavcodec/version.h b/libavcodec/version.h index 1008fead27..34b059a8a9 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 35 +#define LIBAVCODEC_VERSION_MINOR 36 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \