From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 96B5641116 for ; Fri, 15 Apr 2022 19:31:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F1D3D68B4DB; Fri, 15 Apr 2022 22:31:45 +0300 (EEST) Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 91E0B68B3E9 for ; Fri, 15 Apr 2022 22:31:39 +0300 (EEST) Received: by mail-qk1-f182.google.com with SMTP id b68so2484328qkc.4 for ; Fri, 15 Apr 2022 12:31:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=hZLSvxuICR9l9chHxK5zkYNqOtU3IX+bspcxuJihrac=; b=ZxeC96hoaviF5MfDL++mMsj7n3nB84Tc2inebo3GUFsJcDGSUWV/7fZ5Visrt2p/mX OtCUp5KoB4TUwKXvj9hUkKslnKlCgD9bHTBcEuLaKAvYlfprR4tEdhfJmrutT2IXqCvm XY2ZH4yfEEP6WISqz9dNs5YAyD3ZrqcyOUDW9nACIe/PetBKsx/OQGxXtxSk5vg4U9qD fM2ZlpYcG76ZKaFlX1hwyy3fK5xYtq9nnIG+ksNPlGh14BqJdwjPrWZNzGOHGPylu3Qn 1131YXGjuIiPqdP//ChfkAP8XfpOH//mbNbGLDoKBW9rAxh9fb1AH8zUzopQjmfkp+Wb e2RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=hZLSvxuICR9l9chHxK5zkYNqOtU3IX+bspcxuJihrac=; b=TAiEtfixnkakj13D1J+ZvFYkvvVY2ExL1+Fd919l5js6p4WGQwHMzjLtpEuK1Lwlnq 0Q22w/DLN62drix8cqRxD5M5DSm0k6v7jeJKLOiIV746Goe2EmpqxLFrSRmnu7RN8Por wgwqVYComi53UyorQS84f7WZQWiZQCcdpZ2O5VH62EWnatvrbOn2xLe4AoUrW/a8WnVw IDuXZarINHj5kpF/LaENSCpz0S/S7Nz3uYZGWzY829vT+qzYF4JdMX3BCnj0tUYumnDO HiERBVzzKrHN81xNYbj24XTu28gE9TOeMN0k2Zy/QwZK1GFDPKqVBNqxMZBNwhJQN30w 6W6A== X-Gm-Message-State: AOAM531Q1x0o2CQnn4DD+FKdvdDA6sYjzlQoNs+AOcMKXZ6KNyYHr1EH GD/h1BSF7kYCdgjyHwnK+xsvDLgs71c= X-Google-Smtp-Source: ABdhPJyuhg0bkVybzzpmgResodRdfO1ngNhxHaKt9C0RrnGcsD2uLnUkeYxacQVn8n3mT0pHRqKnPg== X-Received: by 2002:a05:620a:1712:b0:69c:3d5d:37a with SMTP id az18-20020a05620a171200b0069c3d5d037amr313385qkb.23.1650051097927; Fri, 15 Apr 2022 12:31:37 -0700 (PDT) Received: from [192.168.1.35] (c-68-41-54-207.hsd1.mi.comcast.net. [68.41.54.207]) by smtp.gmail.com with ESMTPSA id bk18-20020a05620a1a1200b00680c72b7bf4sm3144120qkb.93.2022.04.15.12.31.37 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Apr 2022 12:31:37 -0700 (PDT) Message-ID: <7faa7db9-e40b-60c2-2ea8-35c7860b7790@gmail.com> Date: Fri, 15 Apr 2022 15:31:36 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Content-Language: en-US-large To: ffmpeg-devel@ffmpeg.org References: <20220412055333.62424-1-leo.izen@gmail.com> <20220412055333.62424-3-leo.izen@gmail.com> From: Leo Izen In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH v14 2/4] avcodec/libjxl: add Jpeg XL decoding via libjxl X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 4/15/22 07:08, Andreas Rheinhardt wrote: > Leo Izen: > >> + return avpkt->size - remaining; > If this decoder is supposed to produce multiple frames from one packet > of input, it needs to use the receive_frame-callback. For video > decoders, it is only checked whether the return value is >= 0 or not > (see lines 451-456 in decode.c). It isn't, because I've chosen not to support animated JXL at this time. As far as I'm aware an animated JXL file will just decode to its first frame with this decoder. >> + case JXL_DEC_SUCCESS: >> + av_log(avctx, AV_LOG_DEBUG, "SUCCESS event emitted\n"); >> + /* >> + * The file has finished decoding >> + * reset the decoder to let us >> + * reuse it again for the next image >> + */ >> + JxlDecoderReset(ctx->decoder); >> + libjxl_init_jxl_decoder(avctx); > You are only resetting the decoder on success. What happens if any of > the errors happened? Would the decoder need to be reset before decoding > the next picture? This was already brought up by Anton. The JXL_DEC_SUCCESS event isn't fired until the start of the next packet (if there is one). It is the "finished decoding" event which we never actually get to for single images because JXL_DEC_FULL_IMAGE is always fired first. If this is fired it means we're in an image2 sequence and this is the next frame, at which point the data will have been swapped out. Resetting the decoder is necessary here to make the library re-read the header info and not whine. I agree that it's a bit confusing and I should probably add a block comment explaining this. >> + buf = avpkt->data; >> + remaining = avpkt->size; >> + continue; > Didn't you already feed this data to the decoder? This somehow looks > like a recipe for an infinite loop. No, see up. - Leo Izen (thebombzen) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".