From patchwork Sun Sep 10 20:48:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul B Mahol X-Patchwork-Id: 43683 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4e27:b0:149:dfde:5c0a with SMTP id gk39csp1760316pzb; Sun, 10 Sep 2023 13:40:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEaVhe7JKB+O6Khag6kDi9M4icEAsnXLN/7nNNjz+7P/hK+s/dcY5dCcznlF+U59TTQvA9W X-Received: by 2002:a17:907:6e87:b0:9a1:c69c:9388 with SMTP id sh7-20020a1709076e8700b009a1c69c9388mr12783901ejc.37.1694378452543; Sun, 10 Sep 2023 13:40:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694378452; cv=none; d=google.com; s=arc-20160816; b=HUc9JdqXZCAkcI/7Uke5uZWyLdqlgWHCfNG3BGwFRLvx1mBVDlww8CIzrWthspKv6p vIA2zK8vJ8knmJ0dBUoPEMHaZhCJMFFKx0xC7scKOyf0SBjPum9cbILlOlubj5+zLEeA +3Oanw1M5oNer84/NR3N46LWrGLoWBSJMdWnU2jHFKizjxsYYJjmIVdQYry72ZSFOW02 5SU06uLLu/MpjUtbG8WyDBtPpbMnN/QBYsOc5favOLfIE+l01BT/+3hAr/GY2oLuT2GC I9nV8KqpBfnSnzRppArj5qmtl8DlA/Vvxex3lKQvQeTTNmvFPuj4RFwoffdHbY+6FXNG xnVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:mime-version:dkim-signature:delivered-to; bh=a/cMd62Bv+vYrdhkH+SQZj/k0lDZIiuvOg2Chc/sraw=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=Yt22apgw5MDbZiPw1+uLQK8jgsFTYX5TdkLfOhrREgSD4Ldg5Scs3UJbxGF2AcXzft SVw7TYKQOZjYwNr0RRVkJz2bvBYQCHONY6dTzgvLynZdpLZ3lszjzlNjvSwHhWEJb1xN u2RRf0CqZJ5lsZdkYws4uvLoJj3LJXLQqcDpeP3YpoxIjklZI8QknQ7YUlPuzQqB8emG 3XpdQ+2U6r0PrRnm1+96LiTdYDHKBvADdB3PF3Py7PQp1T2DzuENzl/QPjgdE2JhPpN/ Pv2R952CZnhR/UZiXPK/ILKxnzCbIItskixl6KvREoRtGYo0PyQ9nJwdGItZmwYkehjg /c6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20221208 header.b=j1puPlUi; 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 l1-20020aa7d941000000b00526a9e4a8ffsi5325354eds.532.2023.09.10.13.40.51; Sun, 10 Sep 2023 13:40:52 -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=j1puPlUi; 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 642BC68C90F; Sun, 10 Sep 2023 23:40:48 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1E9D768C7A9 for ; Sun, 10 Sep 2023 23:40:42 +0300 (EEST) Received: by mail-vs1-f47.google.com with SMTP id ada2fe7eead31-44d45391e84so1461594137.3 for ; Sun, 10 Sep 2023 13:40:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694378440; x=1694983240; darn=ffmpeg.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=Fgg7HPu7HdELJPLL3/B9fBtUnTZBkOwr6A7UfM8HCU8=; b=j1puPlUirqy1e9ZnaHS/dpJPeEDDyoz8ze5sSG2ftFUk4Z44JQW1NxJDrtn+X933pJ 2QxWoW0/HbiOqT8a+Q1f+9jUh22Z7Ho9RtiqLfmvyjTXUEWtNlCzv6Pm/CC4JCTux2tq NZaUGlq242h+jf+/twxY6HpMnFMx8R4m73bqFo+qYCM2ZuGVJsECnXVQHyfLOwUo10tG LjFa4BE8Elve+axm8GFd7IcmQOtGe6uAW+8p4Ny+ASmRV9wJ2UA0Prgqroiu7FRyUe8n 69orFKZAj6KvfHLOBogKZRQobKq6kE9tkjZfMPNNTxn11k8y2dP/f24uRc7wmEZY5k8b Gjgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694378440; x=1694983240; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Fgg7HPu7HdELJPLL3/B9fBtUnTZBkOwr6A7UfM8HCU8=; b=MfYxQ449NOS8QbpGQ7aKFl2y20DFMADw4iomfSxyuqgSqBYwZymyhaNdgR8TlstmUW StWS9mi64I6XGIBbzog+FkvwptyESsaUwc3p15M4hQBiphLfgFznseGWcEMcwSW186I+ XHytNNtVtvo/LSacrfgddrFZzRy9kJQTTOqvUs510wvbkoLq7nChQHGNxMuP6B95kClJ G2cekTJLlLwskwahddIrpStQjK8P1DNOTwKuyJ/R8HQ8GW2PoODzBpIwpnGbNxaNPkQF oIdRUwddoBJ1G2Rqrt9MMIKS/ZgLGkKbzmroDcCqzH0QAyWcfYuNJxJE+vNNBgSZSI2d 34Cw== X-Gm-Message-State: AOJu0YxAHS3qOBhaQBtXGsK5eMhoB70/D/ob1kmZrdYLsNKGg3Ww2I2z TuPbrxDIVTAZMRlAqiwxOtU1VP8G8gbWdBpyOQkSBf9PTzk= X-Received: by 2002:a67:db14:0:b0:44d:5105:b143 with SMTP id z20-20020a67db14000000b0044d5105b143mr6279826vsj.27.1694378440268; Sun, 10 Sep 2023 13:40:40 -0700 (PDT) MIME-Version: 1.0 From: Paul B Mahol Date: Sun, 10 Sep 2023 22:48:05 +0200 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [FFmpeg-devel] [PATCH] avcodec/8bps: switch to planar RGB 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: cL28RDgMX30Y Attached. From 3b7f86ff244692b77d5f9f6e48f70138b0405181 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Sun, 10 Sep 2023 22:19:19 +0200 Subject: [PATCH 1/2] avcodec/8bps: use uint8/uint16 where possible Signed-off-by: Paul B Mahol --- libavcodec/8bps.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c index af98f62fad..15c236f114 100644 --- a/libavcodec/8bps.c +++ b/libavcodec/8bps.c @@ -45,8 +45,8 @@ static const enum AVPixelFormat pixfmt_rgb24[] = { typedef struct EightBpsContext { AVCodecContext *avctx; - unsigned char planes; - unsigned char planemap[4]; + uint8_t planes; + uint8_t planemap[4]; } EightBpsContext; static int decode_frame(AVCodecContext *avctx, AVFrame *frame, @@ -55,15 +55,15 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; EightBpsContext * const c = avctx->priv_data; - const unsigned char *encoded = buf; - unsigned char *pixptr, *pixptr_end; + const uint8_t *encoded = buf; + uint8_t *pixptr, *pixptr_end; unsigned int height = avctx->height; // Real image height unsigned int dlen, p, row; - const unsigned char *lp, *dp, *ep; - unsigned char count; + const uint8_t *lp, *dp, *ep; + uint8_t count; unsigned int px_inc; unsigned int planes = c->planes; - unsigned char *planemap = c->planemap; + uint8_t *planemap = c->planemap; int ret; if (buf_size < planes * height * 2) @@ -89,7 +89,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, pixptr_end = pixptr + frame->linesize[0]; if (ep - lp < row * 2 + 2) return AVERROR_INVALIDDATA; - dlen = av_be2ne16(*(const unsigned short *)(lp + row * 2)); + dlen = av_be2ne16(*(const uint16_t *)(lp + row * 2)); /* Decode a row of this plane */ while (dlen > 0) { if (ep - dp <= 1) -- 2.39.1