From patchwork Mon Nov 6 12:57:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 5887 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp2858103jah; Mon, 6 Nov 2017 04:57:46 -0800 (PST) X-Google-Smtp-Source: ABhQp+THH9ycVAwe+g7YWQYgFTQfTn3bAnbkq8tcFY7BAhAHry4RxPX92yLvP2oAs38jplZ1qm/+ X-Received: by 10.28.140.15 with SMTP id o15mr4950179wmd.8.1509973066244; Mon, 06 Nov 2017 04:57:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509973066; cv=none; d=google.com; s=arc-20160816; b=z7DHKT5xCxRERO00H8oyvfWgUZ3d1nkjAyiS9bysBsy6heC3cA0z5te5POfCOtufUO o/Ot4HBgw8SnkeHarh16A75RSFyu99IuodM901OyJ/FnUfLvcU0xaV73j5k5ptq+dmLD 1EYLk09u3iHXnV7RYfATM1EheR6Sn8T0CXc0xWdb5V99ht2iRhr50RYjMtwRMugBf8m0 QMQ/Tqgnp7BN3vGmxXzbd+C0o9LFWQOGnUAVXLY2srOCCgcSekRUwtsz9XmjDXs6tBPY qAeHqHg578pQA/ozmQs9hmiV6+XUI31SkkM1zUNqA8HdTvmwosPY37AJ+m8UpyieBgCS hHmw== 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:references:in-reply-to:mime-version :dkim-signature:delivered-to:arc-authentication-results; bh=uwcFsJ+CVrhkhZNiEkQId/LwTrK75tRXUhViC5Srsjc=; b=t8D7jvVWVnlwz2kMXWOVX11gDDBm0/Rz5M0fH6Fd3xjzv6Ywm4O8SLbLZyb7nsRStP d5Cd9ekmZ++hmF+sFve2DyekDxKrQdqoCQHK/SUog6FlDEHDZNZYiDjDRYDQLVmt/qd8 3IeD6CSvcADSwawru5hMRmE8n4qQD+UV48O0ZuoBi68DKO6KWyVr84OCXtGqEa9Ql924 Jd2t4eFpETpVXiLGDYjJ/aHsY/qdsWMPSeCZDtmSP13o53lO48cGWHOW+J0UpZnACryG W5drSskjlhaWi9XcUgP0LW/o+cXFtAWLCQRKKfGkg9IVpG984NT9T28pX6nnxLo0oAHG nNDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=u1Mp6nU0; 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=NONE 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 t12si10190290wrb.533.2017.11.06.04.57.45; Mon, 06 Nov 2017 04:57:46 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=u1Mp6nU0; 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=NONE 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 A465F689C7C; Mon, 6 Nov 2017 14:57:32 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-it0-f51.google.com (mail-it0-f51.google.com [209.85.214.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 21D28689C57 for ; Mon, 6 Nov 2017 14:57:26 +0200 (EET) Received: by mail-it0-f51.google.com with SMTP id n195so5145822itg.0 for ; Mon, 06 Nov 2017 04:57:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=rmslsMOw5erlLdU4YsH3AYnHUNsBTDsZeVUfdo8W9XQ=; b=u1Mp6nU0KNGHJUABmkkfhme3D33g+TOPUq43QoJb3urfCXHmcQupZVQiAMsIqUtHuk 6OKCeygzf+vMqJVzpSUa/sH99QulIyj8AJEdhm5OsJ6wt6dbnSgRQjs1qmukRWET/aTV DpG5P2VvgOko9hLwYw8vdqMXJ+jwVml3zP5OV7prND84OCsfDrPPKJZ5IjO+XyRouXxG Y8plCxxwjtrFDYpSbYWOcsDqSXPCrPmPkQJE5BFMoAe8NvP4UHDW9TEA/Zul8KWxl43i NGafBoean0EQXhPyMaXOYt+zjAVdiNVE162TkiUxzCH7nMR0r99ILWK7aeERGcrmVJP8 8JDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=rmslsMOw5erlLdU4YsH3AYnHUNsBTDsZeVUfdo8W9XQ=; b=YVPj+d9+eDIj1PjzjjF+vME7It1+OkbQpkqYfqi7k4UuJH8D4yjgvJ58B/GodKfdQH +twxFu5XpPG3S5ApwS2Xj7mg6wQhaAaTSOqaUsoh7XxdCE5Vdr4pP6AwSVPDu4DNOcpI A52VW8ic3Z+6Zbs2HZs0lm6d6OB/GCsh0VPjoav2xgWFEKhc63Wkkn+ebf5zjwKnNSsE Dlx5TWvMvzSENM+2l15coL+GKQq0kEgiEGTdQp3qKA2DW+uWS5CRW26EuX2Mv1AjWfoj QWN2h2laWO8GdY46FGIaRV+AiKLNc7ltGs1C++HyVIy8k6C/l5Cvc/eYh8TZJl/U36GN 8dkA== X-Gm-Message-State: AJaThX487MC8nSb+5aAulNY+haNAGafo8QvDPcS5Lo3w65aKL8Tk4I/G kTfKOkYuAfjuxHZ2SBM7cbscmw2lnMmIOlbk56w= X-Received: by 10.36.8.136 with SMTP id 130mr9411222itc.18.1509973056722; Mon, 06 Nov 2017 04:57:36 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.63.101 with HTTP; Mon, 6 Nov 2017 04:57:16 -0800 (PST) In-Reply-To: References: From: Carl Eugen Hoyos Date: Mon, 6 Nov 2017 13:57:16 +0100 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH]lavc/pcm-dvd: Do not use an incompatible pointer on big-endian. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" 2017-11-06 11:53 GMT+01:00 Hendrik Leppkes : > On Wed, Nov 1, 2017 at 6:33 PM, Carl Eugen Hoyos wrote: >> 2017-11-01 18:18 GMT+01:00 Hendrik Leppkes : >>> On Wed, Nov 1, 2017 at 5:13 PM, Carl Eugen Hoyos wrote: >>>> Hi! >>>> >>>> Attached patch silences a gcc warning, tested with Fever.vob >>>> >>>> >>>> @@ -163,10 +162,12 @@ static void *pcm_dvd_decode_samples(AVCodecContext *avctx, const uint8_t *src, >>>> switch (avctx->bits_per_coded_sample) { >>>> case 16: { >>>> #if HAVE_BIGENDIAN >>>> + int8_t *dst16 = dst; >>>> bytestream2_get_buffer(&gb, dst16, blocks * s->block_size); >>>> - dst16 += blocks * s->block_size / 2; >>>> + dst16 += blocks * s->block_size; >>>> #else >>>> int samples = blocks * avctx->channels; >>>> + int16_t *dst16 = dst; >>>> do { >>>> *dst16++ = bytestream2_get_be16u(&gb); >>>> } while (--samples); >>> >>> This results in quite misleading code. dst16 is named like that >>> because its a 16-bit pointer, using the same pointer with different >>> types based on this ifdef seems error-prone in the future. >> >> Agree, new patch attached. > > I think you attached the wrong patch, this is an old version of the > pcm-bluray patch. New try attached. Thank you, Carl Eugen From 244eb73d55e4f1eb85d1f8bcf8f12542d0e57537 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Wed, 1 Nov 2017 18:31:29 +0100 Subject: [PATCH] lavc/pcm-dvd: Do not use an incompatible pointer on big-endian. Fixes the following gcc warning: libavcodec/pcm-dvd.c:166:37: warning: passing argument 2 of 'bytestream2_get_buffer' from incompatible pointer type --- libavcodec/pcm-dvd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavcodec/pcm-dvd.c b/libavcodec/pcm-dvd.c index 0a751a8..329b555 100644 --- a/libavcodec/pcm-dvd.c +++ b/libavcodec/pcm-dvd.c @@ -153,7 +153,6 @@ static void *pcm_dvd_decode_samples(AVCodecContext *avctx, const uint8_t *src, void *dst, int blocks) { PCMDVDContext *s = avctx->priv_data; - int16_t *dst16 = dst; int32_t *dst32 = dst; GetByteContext gb; int i; @@ -163,15 +162,17 @@ static void *pcm_dvd_decode_samples(AVCodecContext *avctx, const uint8_t *src, switch (avctx->bits_per_coded_sample) { case 16: { #if HAVE_BIGENDIAN - bytestream2_get_buffer(&gb, dst16, blocks * s->block_size); - dst16 += blocks * s->block_size / 2; + int8_t *dst8 = dst; + bytestream2_get_buffer(&gb, dst8, blocks * s->block_size); + return dst8 + blocks * s->block_size; #else int samples = blocks * avctx->channels; + int16_t *dst16 = dst; do { *dst16++ = bytestream2_get_be16u(&gb); } while (--samples); -#endif return dst16; +#endif } case 20: if (avctx->channels == 1) { -- 1.7.10.4