From patchwork Thu Jan 26 00:45:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Cadhalpun X-Patchwork-Id: 2312 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp2465663vsb; Wed, 25 Jan 2017 16:54:19 -0800 (PST) X-Received: by 10.223.131.193 with SMTP id 59mr128555wre.186.1485392059281; Wed, 25 Jan 2017 16:54:19 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id f186si24394252wma.165.2017.01.25.16.54.18; Wed, 25 Jan 2017 16:54:19 -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=@googlemail.com; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4887368A629; Thu, 26 Jan 2017 02:54:16 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 28F5968A240 for ; Thu, 26 Jan 2017 02:54:10 +0200 (EET) Received: by mail-wm0-f66.google.com with SMTP id r126so46554536wmr.3 for ; Wed, 25 Jan 2017 16:54:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:subject:to:references:message-id:date:user-agent:mime-version :in-reply-to; bh=Dby3H9cD8Nq4rqtS3q6canr1z1lnUcbuFm1DQpwjvPQ=; b=PMQcjvKgaOooGVAGjBrve5ii3DOhyMB0ONmDHRDYN5wyILhPMKub+ZSrgOA/ggUie5 ChWajCIfoVAba3LeELCLqKxUQVaesB+FuRkIeDe7wJututniiLHOIEU+Xy32K2DQDVch 1NhJ7aVvHmhkellp0xFIhFE6WmL9ARXMCTNmsFLnbDJM5+EWtlmL1cmiKy56sMfGfS/N XTl16+5TsaRk0eP/APCCBBxect3EVojAPJRoF7/f5pujixi+fNmsq/hfXDJ2sFpq14EB W8jro4lIe4psmZNfFBWf39lvWAksvWhuoCt2Bc7ULI3J26U0KlRGiGLvUuUy6Z70LHfY eGxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:references:message-id:date :user-agent:mime-version:in-reply-to; bh=Dby3H9cD8Nq4rqtS3q6canr1z1lnUcbuFm1DQpwjvPQ=; b=SdF22bEQISUxaEiOLkvpvmKnDn26N80p/rST3l0ad+HyIctT7I8c+5Rd+PyZaFAxEj ReskXGNl8dDE7282zo4njrZ/vH7uEHxwZvIYMn2oiQrJCBHsT6ZcmqwC5RqBAxdEYfzT syqSPs9rm2/hludL/Yc5F+IX0SkRi1p7Qwgpbiu69Eg4Ryay66950zaccZR0YvDO8GYR EHY8rDzxen4X/5l4Mjd/xWHsRACuwKUQrYFaHE1k+oN+3YQ4H1OxodXNEh7A7ZGdDwrg KxrvXso7/qumgTzoNt3qrpiK5vIlCOEeno8tRYCnmI8mv22WFGAl8ht13r8L6A1yD3zy 3UWw== X-Gm-Message-State: AIkVDXI9sTAvS/m4oZwUFLfOrx9nX9qAkjiWwCgeBR8VMZUGkam8YHAY+7BghwEHpB+70w== X-Received: by 10.28.229.193 with SMTP id c184mr426836wmh.83.1485391554075; Wed, 25 Jan 2017 16:45:54 -0800 (PST) Received: from [192.168.2.21] (p5B0954C8.dip0.t-ipconnect.de. [91.9.84.200]) by smtp.googlemail.com with ESMTPSA id 18sm27421309wrb.14.2017.01.25.16.45.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jan 2017 16:45:53 -0800 (PST) From: Andreas Cadhalpun X-Google-Original-From: Andreas Cadhalpun To: ffmpeg-devel@ffmpeg.org References: <76824ab4-271d-ca78-23ce-bcec85877b7d@googlemail.com> <056e5273-0b21-2355-4ec6-7e2a134e5659@googlemail.com> <20170107004115.GN4749@nb4> Message-ID: <284d2f58-99bf-13d4-b774-6258039660e8@googlemail.com> Date: Thu, 26 Jan 2017 01:45:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170107004115.GN4749@nb4> Subject: Re: [FFmpeg-devel] [PATCH] h264_ps: validate chroma sample location 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" On 07.01.2017 01:41, Michael Niedermayer wrote: > On Fri, Jan 06, 2017 at 11:33:13PM +0100, Andreas Cadhalpun wrote: >> On 06.01.2017 22:47, Kieran Kunhya wrote: >>> On Fri, 6 Jan 2017 at 20:44 Andreas Cadhalpun < >>> andreas.cadhalpun@googlemail.com> wrote: >>> >>>> Signed-off-by: Andreas Cadhalpun >>>> --- >>>> libavcodec/h264_ps.c | 4 ++++ >>>> 1 file changed, 4 insertions(+) >>>> >>>> diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c >>>> index 8218e3a010..089bfc650a 100644 >>>> --- a/libavcodec/h264_ps.c >>>> +++ b/libavcodec/h264_ps.c >>>> @@ -181,6 +181,10 @@ static inline int decode_vui_parameters(GetBitContext >>>> *gb, AVCodecContext *avctx >>>> if (get_bits1(gb)) { >>>> /* chroma_sample_location_type_top_field */ >>>> avctx->chroma_sample_location = get_ue_golomb(gb) + 1; >>>> + if (!av_chroma_location_name(avctx->chroma_sample_location)) { >>>> + av_log(avctx, AV_LOG_WARNING, "Invalid chroma sample location >>>> %d, setting to unspecified\n", avctx->chroma_sample_location); >>>> + avctx->chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED; >>>> + } >>>> >>>> >>> Is there a way to long only once, this seems like it could spam the user >>> full of these warnings. >> >> One could add a field like shown_chroma_loc_warning to SPS, but I think >> that would be a bit too much overhead for this. >> Alternatively, one could drop the log message entirely. (Wrong color >> primaries etc. aren't logged either...) > > I think making it a "normally not displayed" log level would be a > better choice than removing it entirely OK, I reduced it to AV_LOG_VERBOSE. Best regards, Andreas From 5874739904fa8f13be03faee27e4bb2ac061258f Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Fri, 6 Jan 2017 21:36:39 +0100 Subject: [PATCH] h264_ps: validate chroma sample location Signed-off-by: Andreas Cadhalpun --- libavcodec/h264_ps.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c index 8218e3a010..474eaf0d2d 100644 --- a/libavcodec/h264_ps.c +++ b/libavcodec/h264_ps.c @@ -181,6 +181,10 @@ static inline int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx if (get_bits1(gb)) { /* chroma_sample_location_type_top_field */ avctx->chroma_sample_location = get_ue_golomb(gb) + 1; + if (!av_chroma_location_name(avctx->chroma_sample_location)) { + av_log(avctx, AV_LOG_VERBOSE, "Invalid chroma sample location %d, setting to unspecified\n", avctx->chroma_sample_location); + avctx->chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED; + } get_ue_golomb(gb); /* chroma_sample_location_type_bottom_field */ } -- 2.11.0