From patchwork Wed Apr 19 18:11:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Izen X-Patchwork-Id: 41251 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4645:b0:e3:3194:9d20 with SMTP id eb5csp683794pzb; Wed, 19 Apr 2023 11:12:03 -0700 (PDT) X-Google-Smtp-Source: AKy350ZZT/v0ptBzg7ij6BOyDvBebCtJ9zLM1ZN9j5MxLuH4W9jaTKS+Vq80cW0tpm4DEH3ehGaR X-Received: by 2002:a05:6402:14:b0:508:3f06:8fd1 with SMTP id d20-20020a056402001400b005083f068fd1mr2210883edu.29.1681927923347; Wed, 19 Apr 2023 11:12:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681927923; cv=none; d=google.com; s=arc-20160816; b=WYmEYnNk3vC32tSy42uydHAPOJXFLsgpMCUuOzCDt8P+wtaXUohDX5vvNoap3aldhz 3zG4LDYix33V4A0NMYXjCHMTtpm9tUJHkS0NckTm7tHgE+CcCHG5M7oCnFMOxF/zcUcF +0jiz40l9tFvCJafCcveusRPyIh+669LXqugm0WJ49e6a5QIrkVgomzLK0sujUa0rMMD II758l82T2yHgNfFK5oz3zGD8k/CbEwG5ZgIJ1fHaPnODyguRkWlmw0OA5g1EgMPvpPf 54uu7gzseICLTGZUSGRvfpN/itIEnJXrxuwmdENZ8hvmHkNYAClzttNNBIbimgnw2iwl ZHAw== 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:dkim-signature:delivered-to; bh=D+BVQMAVDOVxWDOYbMn9aFq2/5p2cXXN5ESKYMsXc7A=; b=OFozmAVk+0gmywypqWdsXMatCD0kuXaYxDuR/pEc9hmyXZXruNXqAW+h8CBdHTXQqp IZmcSKyEUs5K5ZB6aS6YGt0kFef/Q34f5Mh8MEzZLyMKoGm7DqPjN0TfsvIR2kGclyXz A3BF0aGKoZcmWzs8kZUjnKZhRvnKgOxxoLuQFn27rC2qiXgccZQNs4/9mYb7YQ7SJ3Oa +IaqyJxQAIs/0RHNbjmhXEZohbp582KbT5qCphbV6LVMmEeX7JqvUJ0i+N6COqCgTe65 fCMIQWUBDJAPH1RNFOCxLuCRLL72fUmwOfB0cy4jam5OjxVbXZ2NX1Ey9EUcZkAiRU+1 TNtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20221208 header.b=jnT+8SdG; 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 p25-20020a056402075900b005067c4146e4si14194162edy.233.2023.04.19.11.12.03; Wed, 19 Apr 2023 11:12:03 -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=jnT+8SdG; 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 42E0568BE34; Wed, 19 Apr 2023 21:11:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9733368B680 for ; Wed, 19 Apr 2023 21:11:31 +0300 (EEST) Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-54f8b687a06so607747b3.0 for ; Wed, 19 Apr 2023 11:11:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681927890; x=1684519890; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1m99/ZRQFasSBFJVJkW1FGEiRKd5ywRsGhJS9xUD204=; b=jnT+8SdGalkbq77oUo25Dcs6tsLebPq0ywo0TQp6qcwKuar57cWKCT8iI70iVWjvIr U0jEm9UsotQ4HUyNIi0pd3fu31VWcOE2J27AcorkQEMdxxsoSwCvo8U4AsDYrDR0yNr4 pwjG58lSeoBgmBKsgIUzKHCdfQouAh6BhtaYZqCkw9NnYBMXrQ5b+rVD8tgVWN9esKWO 6Zu89yHKC0z6x2tVvyvdOBiJhqUhWVYwOw6kXKpdvPTxmLnFV2NleWQ2LbbRcrJkfVMr WgiRoomPpsMX4VhqffRUbzbU9iN3OKyYY1sqg1muokXHuHM1H+LgRXuAs6jp2cBbiLTK X+WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681927890; x=1684519890; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1m99/ZRQFasSBFJVJkW1FGEiRKd5ywRsGhJS9xUD204=; b=N+aHpg8tfF0UJsgtwOI3IoadDpLwjwSqDdOEOf69JQRLaRHtF1Ftdkb8i8wkKAs78O REL9BxESs3bazaLVNUsRes3T0Ot5IJILU2U8rpeqhgAXVE8t/4Hr+D9qttIW2UVTy/aS zGAWPMy6fwf2aT/seSQccVJxdfRWvMALE9lozcCgO9pRDVpsyOisMiRUggoMLBG7hjsW S/qqVazMDHvsFDzjjHZhVUvdjjenhkYiatwgpuEZAaOu170ncWJwYEdjAAIfB2cEmM20 FUh70m9cxpFq1410vfMXDScbay0h+3gDW0RWzUA9DAjIAA0Y7uhKExnC/9WUDocbfT4h edNA== X-Gm-Message-State: AAQBX9fYH2NVFCIRX2TawVxFhWAR1w7EhHJxVMcEYnKp/nYkn/QUYCZO b+61CqgNJI9rBVARZquSh2Wulg+AtvE= X-Received: by 2002:a81:743:0:b0:54f:87d0:cb3d with SMTP id 64-20020a810743000000b0054f87d0cb3dmr17837954ywh.4.1681927890256; Wed, 19 Apr 2023 11:11:30 -0700 (PDT) Received: from gauss.local (c-98-224-219-15.hsd1.mi.comcast.net. [98.224.219.15]) by smtp.gmail.com with ESMTPSA id w67-20020a814946000000b00555e1886350sm280586ywa.78.2023.04.19.11.11.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 11:11:29 -0700 (PDT) From: Leo Izen To: ffmpeg-devel@ffmpeg.org Date: Wed, 19 Apr 2023 14:11:25 -0400 Message-Id: <20230419181126.38662-3-leo.izen@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230419181126.38662-1-leo.izen@gmail.com> References: <20230419181126.38662-1-leo.izen@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 2/3] avcodec/mjpeg: fix weird RGB-subsampled baseline JPEGs 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: PuNW8thiwioP These were broken before any of the recent RGB JPEG commits. This is an additional fix to bring them in line with the rest of the RGB jpegs, which should now all work after the previous patch. Fixes #10190. --- libavcodec/mjpegdec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 1e3ddb72fb..330c5da5a8 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -576,6 +576,12 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) if (s->adobe_transform == 0 || s->component_id[0] == 'R' && s->component_id[1] == 'G' && s->component_id[2] == 'B') { s->avctx->pix_fmt = AV_PIX_FMT_GBRP; + if (!s->progressive) { + for (int i = 0; i < 2; i++) { + FFSWAP(int, s->upscale_h[i], s->upscale_h[(i + 2) % 3]); + FFSWAP(int, s->upscale_v[i], s->upscale_v[(i + 2) % 3]); + } + } } else { s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;