From patchwork Thu Jun 15 19:50:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ronald S. Bultje" X-Patchwork-Id: 3995 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.22.4 with SMTP id 4csp957514vsw; Thu, 15 Jun 2017 12:56:59 -0700 (PDT) X-Received: by 10.28.143.16 with SMTP id r16mr4871254wmd.50.1497556619668; Thu, 15 Jun 2017 12:56:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497556619; cv=none; d=google.com; s=arc-20160816; b=qSc15F9CGQM+U0dWg+CyA688xSMHsZ/qix+Mh8ZtCGLO3xRpfRv/Jv6rYbdv+l0N8r H0hv2t+JU/ZnVxGt+u8ftnKxfLqzygAa1FlcaP548D3LAwhA81Iayu/ACyNaqa7z54cU Cb6kHSHMZUFiYStvrCBoE+wlO07DS9Tg4EqDbP4XkA/POIQ7Jwh7UcNTx7RSR52HPvPd jAcvIp9XbrKwOdM2sBM7klitJoTT9HI2OAFSEtTl+cMucZp/+4xJ2wr7Fvjl5CRJ88xN aYHitDOEVSyniNVDCTJ3aVyt4VSaFccNryDMNR6G7rhSqDQuWyZE/I9ea/V9W1Zdox2D Nesw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=nx8zIA5WlBRnXSHwvhcPk8BPZUFdCM0q77HD7BSUu84=; b=PAoiOQLOZDU2z5XalLgMHX4bjW0fZRbb1XWU3qpx+bu9ds56rhJmWB9dd87qHCM8sb +jO8qVuz1jg4nnrOg473sSjZcwTopGAhnEypOssQA6MZW0tg0No8B3ZejQZPFS7JIORx LlzOPDOGBT1qBKeYMIRFri1aMFJtWJuillSMnmN/KcRN8VNm4pc7b017LaUmah99Mke6 JY23Gv47/+gZVDlEvaxQtBSIS5Q73+QbPfwFA845BxayJjO5F3pJ50gS2vStn1OmAMBs 1lp/us9FzzeyEDsC9KUbPLLtxc73g5uxqQsayPRKovTHvG0xcLX4veAfWtUAQTTdpVvQ SlZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.b=RTZxgCY+; 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 g15si135123wrb.153.2017.06.15.12.56.59; Thu, 15 Jun 2017 12:56:59 -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.b=RTZxgCY+; 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 C62B268A3BC; Thu, 15 Jun 2017 22:56:53 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt0-f196.google.com (mail-qt0-f196.google.com [209.85.216.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EFD0768A27F for ; Thu, 15 Jun 2017 22:56:47 +0300 (EEST) Received: by mail-qt0-f196.google.com with SMTP id w1so5412174qtg.0 for ; Thu, 15 Jun 2017 12:56:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9fJMCPNdDA6U9NzLLTr/k/UgeBFg3dCegF7JFXOkwZY=; b=RTZxgCY+sb3s4t4y63Sik6v6WXTWqaYFtHcQxFegDOZyNpB1f4MtGw/ky8oiDZF9WL ZkDsYF7AcrhN3IwTyyznmKvySohDuxhRjkZMD7UfbC+7a+Fq5QmNn4iJM8GIV8tqituB BSwHLTolZid7NpJrMSUCbvpU52hM2bbhlNhETSJtuGgrsCGf3XbgTHfEucnKKcnixgWw /HXEI0dWw2nB7i0h10yOdmc0QQ70TOTonjdLsJrvNAVkF6ey0bvP3ShPZ4WKCxfnw1E3 R9DZzWMP1eMkitlkOEIWhbdE14LBidvumsq/S06AGkOlvqJAuzj9oOIW1G4dgc1MLyHs LfRg== 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:in-reply-to :references; bh=9fJMCPNdDA6U9NzLLTr/k/UgeBFg3dCegF7JFXOkwZY=; b=H6FX9heNr7aUqKLajg1Wn4PN/R0InpOG5zR+zfREZqIf82SAsK6hhI1P/DTvsvydyQ k9MIZI3Np53m9Q/AElEJ7jZQ7lzPCnGrmaoqF7LjCND7wVQbEFbZg3JNaM8yhLSiHrHT SgMqRUv7nv1ALXYftIrvA0PWo/90ja906om+xLQ/NCwQLalCMdcH792TxyTtawamKoyp 81gX4Api9xAoOIU3q1CdEX8MzghCVn+Xe27fydo260KHAeGTQ59TFVRDunvu5tzSbTk5 VXK3O2eVgAAPhDCafYp1cRBTbgNL5QFzSq9Vk0zGqOF/OLF4H2HR3CuQhzKAhZpdsSsG lhvw== X-Gm-Message-State: AKS2vOyKe1BwM6rioGGUDdPdWO76qHhu6so42rTuH8x6zg4Ze/FYR5JT R6x+czJEZxWEM4A5Niw= X-Received: by 10.200.49.81 with SMTP id h17mr8249285qtb.13.1497556240530; Thu, 15 Jun 2017 12:50:40 -0700 (PDT) Received: from localhost.localdomain ([65.206.95.146]) by smtp.gmail.com with ESMTPSA id m29sm94796qta.66.2017.06.15.12.50.39 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 15 Jun 2017 12:50:40 -0700 (PDT) From: "Ronald S. Bultje" To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Jun 2017 15:50:33 -0400 Message-Id: <1497556233-65009-3-git-send-email-rsbultje@gmail.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1497556233-65009-1-git-send-email-rsbultje@gmail.com> References: <1497556233-65009-1-git-send-email-rsbultje@gmail.com> Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/h264: Fix mix of lossless and lossy MBs decoding 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: "Ronald S . Bultje" , Anton Mitrofanov MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Anton Mitrofanov Signed-off-by: Ronald S. Bultje --- libavcodec/h264_cabac.c | 16 ++++++++-------- libavcodec/h264_cavlc.c | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c index 28aacc5..0973e30 100644 --- a/libavcodec/h264_cabac.c +++ b/libavcodec/h264_cabac.c @@ -2389,14 +2389,6 @@ decode_intra_mb: const uint8_t *scan, *scan8x8; const uint32_t *qmul; - if(IS_INTERLACED(mb_type)){ - scan8x8 = sl->qscale ? h->field_scan8x8 : h->field_scan8x8_q0; - scan = sl->qscale ? h->field_scan : h->field_scan_q0; - }else{ - scan8x8 = sl->qscale ? h->zigzag_scan8x8 : h->zigzag_scan8x8_q0; - scan = sl->qscale ? h->zigzag_scan : h->zigzag_scan_q0; - } - // decode_cabac_mb_dqp if(get_cabac_noinline( &sl->cabac, &sl->cabac_state[60 + (sl->last_qscale_diff != 0)])){ int val = 1; @@ -2427,6 +2419,14 @@ decode_intra_mb: }else sl->last_qscale_diff=0; + if(IS_INTERLACED(mb_type)){ + scan8x8 = sl->qscale ? h->field_scan8x8 : h->field_scan8x8_q0; + scan = sl->qscale ? h->field_scan : h->field_scan_q0; + }else{ + scan8x8 = sl->qscale ? h->zigzag_scan8x8 : h->zigzag_scan8x8_q0; + scan = sl->qscale ? h->zigzag_scan : h->zigzag_scan_q0; + } + decode_cabac_luma_residual(h, sl, scan, scan8x8, pixel_shift, mb_type, cbp, 0); if (CHROMA444(h)) { decode_cabac_luma_residual(h, sl, scan, scan8x8, pixel_shift, mb_type, cbp, 1); diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c index e70bb3e..f01e760 100644 --- a/libavcodec/h264_cavlc.c +++ b/libavcodec/h264_cavlc.c @@ -1102,14 +1102,6 @@ decode_intra_mb: const uint8_t *scan, *scan8x8; const int max_qp = 51 + 6 * (h->ps.sps->bit_depth_luma - 8); - if(IS_INTERLACED(mb_type)){ - scan8x8 = sl->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0; - scan = sl->qscale ? h->field_scan : h->field_scan_q0; - }else{ - scan8x8 = sl->qscale ? h->zigzag_scan8x8_cavlc : h->zigzag_scan8x8_cavlc_q0; - scan = sl->qscale ? h->zigzag_scan : h->zigzag_scan_q0; - } - dquant= get_se_golomb(&sl->gb); sl->qscale += (unsigned)dquant; @@ -1126,6 +1118,14 @@ decode_intra_mb: sl->chroma_qp[0] = get_chroma_qp(h->ps.pps, 0, sl->qscale); sl->chroma_qp[1] = get_chroma_qp(h->ps.pps, 1, sl->qscale); + if(IS_INTERLACED(mb_type)){ + scan8x8 = sl->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0; + scan = sl->qscale ? h->field_scan : h->field_scan_q0; + }else{ + scan8x8 = sl->qscale ? h->zigzag_scan8x8_cavlc : h->zigzag_scan8x8_cavlc_q0; + scan = sl->qscale ? h->zigzag_scan : h->zigzag_scan_q0; + } + if ((ret = decode_luma_residual(h, sl, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 0)) < 0 ) { return -1; }