From patchwork Wed Aug 2 20:33:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Izen X-Patchwork-Id: 34977 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c11f:b0:130:ccc6:6c4b with SMTP id bh31csp896014pzb; Wed, 2 Aug 2023 13:33:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlFdKseMNqFNqvsmIBFhtNPnBrUk8pW8ifm2KeqIoRcEotSzMouZDbhYw/jHtAglGVODr9wk X-Received: by 2002:a2e:3618:0:b0:2b5:7a87:a85a with SMTP id d24-20020a2e3618000000b002b57a87a85amr6440633lja.13.1691008431497; Wed, 02 Aug 2023 13:33:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691008431; cv=none; d=google.com; s=arc-20160816; b=YUINwHtt1k+urzOuozd17QWrHT5arziST9caPX3W+lPL3huzu8Ha0BhvB0K1x7FrGV PLTSh660GlOSrUlyFAxLHE4m+aMaOy8UG1PcLvwWmylm9XmoDY9ULTWpQYJP7xsaiP82 Tz7l+L7DBPVm5DSvWkZ/sxsbh6Hq7BgWvWr5iglvHniSyjL8Ci5EfhxG7sGvXuSY2Npv si0ls5nmFjms6HlCPDYdvJwjUVnLzg/rea4Zapz5qE5cdoBC5TdHeEThsejUf5lou4WG rlTxMRCkW4Epj5Dq2PPc4XvWZz8sRsqf86b3+vKfMIr1pnY+cLcvheQyWBml/A1w9vQk XAhg== 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:message-id:date:to:from :dkim-signature:delivered-to; bh=dbK7swYjnXWARwqwujYnhalqEC3k3ps8I5Bgk3ebaXA=; fh=W57KVLPaTz0tbsYsrKIbKYuBNANpg4Tl/mHbnGjtYGU=; b=spX3+nz+bvSiWVpHzny7NtuD6P93/5K9iUcgOu17v2z+vMwkBIv2mNbrjgzmoES0Uv PI1g6q/rLylRC2IDzohGlTsCOsABcwxMcWBwVlPsKg0SE6zJ23fvpwBn9mzy7YHDTfKj YeL3QF+yzaQtMzEg50QNYPnvLG+FLfQTaC7sd0gShlw9cRthDFJYSEBccv6HNnRh0M1q dhhBA2i8ZT/iHUYisu44R3bFDVchbMPJEuR4ubVoNKoOlhqg+PEC0v5RTdS0vnxnAcWq h31b6/YuS2YSu+lQK7pd583GRQVWnCfZkjOv/NZV0wUZqnritkUBwNaoL3j4Lc5VaycM seuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20221208 header.b=lUf2HIy+; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id k8-20020a1709063e0800b00988919c8a70si72872eji.59.2023.08.02.13.33.50; Wed, 02 Aug 2023 13:33:51 -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=@gmail.com header.s=20221208 header.b=lUf2HIy+; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 398F1689975; Wed, 2 Aug 2023 23:33:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com [209.85.128.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 068C1689975 for ; Wed, 2 Aug 2023 23:33:40 +0300 (EEST) Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-583b0190db4so343087b3.0 for ; Wed, 02 Aug 2023 13:33:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691008418; x=1691613218; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=X3yA2kkJzNlmDG8ObcbK5gCDykk/QCV7HROTzc/uh+I=; b=lUf2HIy+mQWj6X8iDENj2QCgb2XCk/7s53DD9GCb1tO/3CQPxzvHi3EdLk5gek5hNM LHQ5C1IrpVxNrDx9Iciu2Ci3SGvy5IhHgU5/DoM2gsvC0eOR0t1sVJPkXrg466t8RJPe cKuZ5ab7DyQnhe4Rz5gfvKhgdR2unNfYHOMTCOA4OgTRD9cXpCwj+cB7uf/4cUSUnnjV gSrI35eBaStyEgB2bT00blCK+B65Ibfw1MUqseUfYF1uTlRoS7IKteNDNyK8+mEh4PX3 Hiw8lASp2SnTPqO2rypww9lDudvwXetLm7qW4Ej/ici0/W9B/RkFh1hSyBSW1qFui2nx mniA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691008418; x=1691613218; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=X3yA2kkJzNlmDG8ObcbK5gCDykk/QCV7HROTzc/uh+I=; b=l+8AAzgbQUETXYDDOHehGbyXMsJ4J+Z/WcKxZjosCDveYf7hm5sem1w/YjoI2Lz7SJ q33fGHvEJhUragQjU5WEC7rRLMKVTPoYseOqw8r0UR0enK6UIDAJLlb08wYOcXK6gtYc ZN/Qs8XzK3A+sfg5XAS6MgaFH3JEeshQZHyxMDrPJIdmq56XW4NNQX9I96uk7UCxDgdn IvVrsobyvENivTV4SzuatcC4cdboatkmPNjI8+HfG2qKWaCbazB3ZW6VYJJKU6IqVnZx IAunWeiVCiLhwMgoxCFK4hslf8CgjRy4XrInhWBIcKqz/M1cJRZRm4WN4V5ZcLaiaHlK nJ7Q== X-Gm-Message-State: ABy/qLZ7G90eyX0mW+kvDFzXS9zhLiNUQhMNS0/ifsS45jApA2OhCIZ/ N3so3U18X7TSseT7QMx0yQDOjmuz4VI= X-Received: by 2002:a25:dcca:0:b0:d14:3f68:969b with SMTP id y193-20020a25dcca000000b00d143f68969bmr6690416ybe.1.1691008418042; Wed, 02 Aug 2023 13:33:38 -0700 (PDT) Received: from gauss.local (c-68-56-149-176.hsd1.mi.comcast.net. [68.56.149.176]) by smtp.gmail.com with ESMTPSA id cf4-20020a056902180400b00c654cc439fesm3930524ybb.52.2023.08.02.13.33.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 13:33:37 -0700 (PDT) From: Leo Izen To: ffmpeg-devel@ffmpeg.org Date: Wed, 2 Aug 2023 16:33:29 -0400 Message-ID: <20230802203334.23640-1-leo.izen@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v7 0/5] JPEG XL Parser (and bug fixes) 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: Leo Izen Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: rqkMDj287Sy6 Changes from v6: - Added dummy stub libavformat/jpegxl_parse.c to fix shared builds Changes from v5: - Attached an extra commit to fix existing bug with libjxldec - Made various changes based on comments by Andreas Reinhardt -- removed jpegxl_parse.c from avformat, and jpegxl_parse.o from avformat/Makefile/OBJS -- checked for failure in init_vlc_lengths -- used a macro to initialize VLCElem structs -- used heap allocations for a buffer of size 250k, instead of stack -- renamed "code" to "len" - Fix demuxer to avoid using avio_size, breaking piped input - Fix some parser bugs discovered during more extensive testing Changes from v4: - Added an entropy decoder and full parser, which finds the boundaries between files correctly - Removed unnecessary logging in libjxldec Changes from v3: - Don't remove AV_CODEC_CAP_DR1 from libjxldec - jpegxl_parse.o added to STLIBOBJS in avcodec/Makefile - add pipe demuxer to avformat/Makefile's SHLIBOBJS Changes from v2: - Fix libjxldec to work with packets that are smaller than one frame - Change how code is shared between libavcodec and libavformat to be more sensible. - Fix the parser to work with large headers that proceed the codestream in a container format (for example, if several-KB Exif boxes preceed the codestream.) - Modify the parser to set width/height instead of avctx Note: avctx->pix_fmt and s->format are both set, because otherwise the CLI tools won't print the pixel format without libjxl enabled. - Update the fate test based on the new parser's packetization This test relies on FATE samples that haven't been uploaded yet. To test, unzip the following zipfile[1] in the FATE_SAMPLES directory, placing the test images in jxl/. [1]: https://buzo.us/y.zip sha256sum: 43a2eeb0dfdf471b47a9fdfb1653974fa156ceceb776891cc137569a8ebf0e75 signature: https://buzo.us/R.asc Leo Izen (5): avcodec/libjxldec: fix errors when decoding grayscale after rgb avcodec/libjxldec: use internal AVFrame as buffered space avcodec/jpegxl_parser: add JPEG XL parser avformat/jpegxl: remove jpegxl_probe, instead call avcodec/jpegxl_parse fate/jpegxl_anim: add demuxer fate test for jpegxl_anim libavcodec/Makefile | 3 + libavcodec/jpegxl.h | 94 ++ libavcodec/jpegxl_parse.c | 520 ++++++ libavcodec/jpegxl_parse.h | 72 + libavcodec/jpegxl_parser.c | 1477 +++++++++++++++++ libavcodec/libjxldec.c | 41 +- libavcodec/parsers.c | 1 + libavcodec/version.h | 2 +- libavformat/Makefile | 6 +- libavformat/img2dec.c | 4 +- libavformat/jpegxl_anim_dec.c | 132 +- .../{jpegxl_probe.h => jpegxl_parse.c} | 21 +- libavformat/jpegxl_probe.c | 412 ----- libavformat/version.h | 2 +- tests/Makefile | 1 + tests/fate/jxl.mak | 16 + tests/ref/fate/jxl-anim-demux-belgium | 6 + tests/ref/fate/jxl-anim-demux-icos4d | 6 + tests/ref/fate/jxl-anim-demux-lenna256 | 6 + tests/ref/fate/jxl-anim-demux-newton | 6 + 20 files changed, 2273 insertions(+), 555 deletions(-) create mode 100644 libavcodec/jpegxl.h create mode 100644 libavcodec/jpegxl_parse.c create mode 100644 libavcodec/jpegxl_parse.h create mode 100644 libavcodec/jpegxl_parser.c rename libavformat/{jpegxl_probe.h => jpegxl_parse.c} (55%) delete mode 100644 libavformat/jpegxl_probe.c create mode 100644 tests/fate/jxl.mak create mode 100644 tests/ref/fate/jxl-anim-demux-belgium create mode 100644 tests/ref/fate/jxl-anim-demux-icos4d create mode 100644 tests/ref/fate/jxl-anim-demux-lenna256 create mode 100644 tests/ref/fate/jxl-anim-demux-newton