From patchwork Tue Jul 31 00:22:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niki Bowe X-Patchwork-Id: 9846 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp4455070jad; Mon, 30 Jul 2018 17:23:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcaTdZTOCo70urtHKYyVqnruzScAbxz62FkvAEtXZbX06MpmnE03NOuqC0UQaJzhV+22tlV X-Received: by 2002:adf:e584:: with SMTP id l4-v6mr18325663wrm.190.1532996593492; Mon, 30 Jul 2018 17:23:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532996593; cv=none; d=google.com; s=arc-20160816; b=MWieh4QxeT/AYDByTfMQTCzvu8yxJ7fGMbwkEGAd4b/miEbE//DJKg5YiD4RO2KW3k yJPO8Z0Zfpmc9fApIvi9EJb+bsvhgHIm1ncB7m+A1E2vUl11sC1oSNxzfa5EGG0keC0e 3RtJrmsdJTDi9TqV5UPN+K1F+SyT3eZsc8g8WG27sUrHyHNmh+wi0yb3vukZ94LHGuBb NEXvF1NkEs21HnLuXhqxhuO9IRIB5Cb3109EJbFI4mrE7mFsSohceW2kI8yaHbrDr1R1 QIrkPlCHqTOsf8QdWFMv554LtPni2KeT5o2OGESeCgC6xca0GLN699HsARPk8PbqoNjb x8CA== 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:message-id:date:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=5RlB4grzvoxMUtxSzYEsZD9sScN/YlRoW5DFIHXLFIs=; b=Q/kZWJNN6a7J0V3M8+ciLLaaW4p+jlHz8+yJNNJ78x4wwUsM8Or+cyQYb/GzIrM7yi 34oD+7hFj4ofbykDlcD/b480a2noQGxPp7pznbV2T1eeb2V/vXPhxh2h43S5f5aSZiG8 Zo0Pjj0L71YEOOJKCd0FFFhf8cZHl8cXceMR0RxX8z5+7S6tqL/mgfcTxW8Ubl9buyxC eibwAtqjyVhZhE9r8XM8yfEbSf3XiJ/smZ51epiJGPYUM1SGhiY9o7Y+bjBn/aHgwa1e 4dkyzGBtqBJDNVQGxMnkoYZ6tjCAuulQBJokwfg8BKt+HjvMhw9NIHDEIQh8DDF5NbKM ycrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@google.com header.s=20161025 header.b=cv+QL0Jg; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id d128-v6si598739wmd.100.2018.07.30.17.23.12; Mon, 30 Jul 2018 17:23:13 -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=@google.com header.s=20161025 header.b=cv+QL0Jg; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 552CB68A24C; Tue, 31 Jul 2018 03:22:54 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl0-f43.google.com (mail-pl0-f43.google.com [209.85.160.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BD57F689C85 for ; Tue, 31 Jul 2018 03:22:47 +0300 (EEST) Received: by mail-pl0-f43.google.com with SMTP id u11-v6so754384plq.5 for ; Mon, 30 Jul 2018 17:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Qb+VT8egRkCO0QV+mXWmf6vnH6bsM71o8OsHvFeUngY=; b=cv+QL0JgXiGIGEuO/Rin+w96Q0sGe5SBjBZD1v7GVuw/JwDAY/1p/ftdcc9ts/Ij0A oGFCxG55503v1sSxAetEjMNQ+Bj9lKzzqv/I8lfuhgOzqCElTp8xgV7UuHL7iU4xshaX +h1XtaE2Y+Cjz6yNLcYR01bn4MDCyu9LHSOICLNyIbMnNN5KQ+EnaMDAyRCvjpzo5qyG fM0JEIutaJHetYOjteVtC7GKqQQ347LzJv2e2KEZYLlbGpvO6xFOHTkto/lQsrHd1lub woEms6r49N+0jDJ0qLNi9Qfv1GKWqGCfMY4Mq7h5L2HLEkcJWElYCVS/gtEAc6aONWMX 5NGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Qb+VT8egRkCO0QV+mXWmf6vnH6bsM71o8OsHvFeUngY=; b=t+u8o+54cKVCfsBhIKQLyQfmWr37XgodzZ8yQXk4UpCbC9E/KEosIiA/487HH9V86n lktQoFQYL1NyMexPj7Sq/y+3xgJv4PF/EaUogTiQ1IJdcEXIpVvUwNoRDfU7dZ+I+dhf oMURqzar4/fILK40uJvm2UjqC3pidiHhVf4aC8SRED9IQpg8iVf91PQXCcpzqbdfDPoX l47wX/XMRSiqLOVRcBFS7sO6nlHn4acWJYyJDagvAUE7Cqd5bUrG6cyCqurpaeFnhcey eeg8ZeCiQKpUeCnUQImxpZI/p6TwXxX7DlqkPoo0B/LF/03ogYp22jAhOzjC/l5YTvVi ny+A== X-Gm-Message-State: AOUpUlEBEhlIwxzuTaAy3gPKI87q2bb+9YOFfP7F+MRb+GpapHX9KfkU fkMg9gyjlQtKNKOj2LnYT5+W1+aW7Qw= X-Received: by 2002:a17:902:aa4b:: with SMTP id c11-v6mr18170447plr.344.1532996582392; Mon, 30 Jul 2018 17:23:02 -0700 (PDT) Received: from nbowe.mtv.corp.google.com ([2620:0:1000:4011:7591:af81:7367:cd86]) by smtp.gmail.com with ESMTPSA id x7-v6sm19456569pgk.9.2018.07.30.17.23.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jul 2018 17:23:01 -0700 (PDT) From: Nikolas Bowe To: ffmpeg-devel@ffmpeg.org Date: Mon, 30 Jul 2018 17:22:02 -0700 Message-Id: <20180731002202.144566-1-nbowe@google.com> X-Mailer: git-send-email 2.18.0.345.g5c9ce644c3-goog MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavc/svq3: Fix regression decoding some files. 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 Cc: Nikolas Bowe Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes some SVQ3 encoded files which fail to decode correctly after 6d6faa2a2d. These files exhibit lots of artifacts and logs show "Media key encryption is not implemented". However they decode without artifacts before 6d6faa2a2d. The attatched patch allows these files to successfully decode, but also reject media key files. Tested on the files in #6094 and http://samples.mplayerhq.hu/V-codecs/SVQ3/Vertical400kbit.sorenson3.mov --- libavcodec/svq3.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c index fc17081ecf..18a4448ffa 100644 --- a/libavcodec/svq3.c +++ b/libavcodec/svq3.c @@ -1064,16 +1064,15 @@ static int svq3_decode_slice_header(AVCodecContext *avctx) av_log(s->avctx, AV_LOG_ERROR, "illegal slice type %u \n", slice_id); return -1; } - if (get_bits1(&s->gb_slice)) { - avpriv_report_missing_feature(s->avctx, "Media key encryption"); - return AVERROR_PATCHWELCOME; - } s->slice_type = ff_h264_golomb_to_pict_type[slice_id]; if ((header & 0x9F) == 2) { - i = (s->mb_num < 64) ? 5 : av_log2(s->mb_num - 1); + i = (s->mb_num < 64) ? 6 : (1 + av_log2(s->mb_num - 1)); get_bits(&s->gb_slice, i); + } else if (get_bits1(&s->gb_slice)) { + avpriv_report_missing_feature(s->avctx, "Media key encryption"); + return AVERROR_PATCHWELCOME; } s->slice_num = get_bits(&s->gb_slice, 8);