From patchwork Sun Dec 8 21:31:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 16676 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id A21374487C8 for ; Sun, 8 Dec 2019 23:34:27 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 921D068B4D9; Sun, 8 Dec 2019 23:34:27 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe02-1.mx.upcmail.net (vie01a-dmta-pe02-1.mx.upcmail.net [62.179.121.157]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9B96868B03A for ; Sun, 8 Dec 2019 23:34:20 +0200 (EET) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe02.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1ie4C4-0004iR-1C for ffmpeg-devel@ffmpeg.org; Sun, 08 Dec 2019 22:34:20 +0100 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id e4B6i75Xwwlyse4B6i20s0; Sun, 08 Dec 2019 22:33:20 +0100 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=E5OzWpVl c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=ouAzAKchELLhj6rIrRoA:9 a=pHzHmUro8NiASowvMSCR:22 a=Ew2E2A-JSTLzCXPT_086:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 8 Dec 2019 22:31:20 +0100 Message-Id: <20191208213120.15190-5-michael@niedermayer.cc> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191208213120.15190-1-michael@niedermayer.cc> References: <20191208213120.15190-1-michael@niedermayer.cc> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfPiIpYt2ehjE1+IJzfCk5wRFbLCGf9wwfpgxTK04rXp8VamYarBeK/oK6XD6URSb1TPnBXVAq2JLzSR27yqleEXNhzV8MyPj8C2soPa2i4Z3i3jFFb0e nmOzNnMHJNN+C3S6W1zdHlAGnPqNuNJAJLeAy0BiAivA9EjBorLh++DY Subject: [FFmpeg-devel] [PATCH 5/5] libavcodec/vc1: Remove bits variable 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" Signed-off-by: Michael Niedermayer --- libavcodec/mss2.c | 2 -- libavcodec/vc1.h | 2 -- libavcodec/vc1_block.c | 16 ++++++++-------- libavcodec/vc1dec.c | 2 -- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index d977cb1160..9434a740a7 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -412,8 +412,6 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size, ff_mpeg_er_frame_start(s); - v->bits = buf_size * 8; - v->end_mb_x = (w + 15) >> 4; s->end_mb_y = (h + 15) >> 4; if (v->respic & 1) diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h index 69f6ca9e4d..4559a06cb6 100644 --- a/libavcodec/vc1.h +++ b/libavcodec/vc1.h @@ -176,8 +176,6 @@ typedef struct VC1Context{ H264ChromaContext h264chroma; VC1DSPContext vc1dsp; - int bits; - /** Simple/Main Profile sequence header */ //@{ int res_sprite; ///< reserved, sprite mode diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c index 0ccaf6b022..16542dba3a 100644 --- a/libavcodec/vc1_block.c +++ b/libavcodec/vc1_block.c @@ -2632,10 +2632,10 @@ static void vc1_decode_i_blocks(VC1Context *v) if (v->s.loop_filter) ff_vc1_i_loop_filter(v); - if (get_bits_count(&s->gb) > v->bits) { + if (get_bits_left(&s->gb) < 0) { ff_er_add_slice(&s->er, 0, 0, s->mb_x, s->mb_y, ER_MB_ERROR); av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", - get_bits_count(&s->gb), v->bits); + get_bits_count(&s->gb), s->gb.size_in_bits); return; } @@ -2778,11 +2778,11 @@ static int vc1_decode_i_blocks_adv(VC1Context *v) if (v->s.loop_filter) ff_vc1_i_loop_filter(v); - if (get_bits_count(&s->gb) > v->bits) { + if (get_bits_left(&s->gb) < 0) { // TODO: may need modification to handle slice coding ff_er_add_slice(&s->er, 0, s->start_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR); av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", - get_bits_count(&s->gb), v->bits); + get_bits_count(&s->gb), s->gb.size_in_bits); return 0; } inc_blk_idx(v->topleft_blk_idx); @@ -2862,11 +2862,11 @@ static void vc1_decode_p_blocks(VC1Context *v) if (apply_loop_filter) ff_vc1_p_loop_filter(v); } - if (get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) { + if (get_bits_left(&s->gb) < 0 || get_bits_count(&s->gb) < 0) { // TODO: may need modification to handle slice coding ff_er_add_slice(&s->er, 0, s->start_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR); av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", - get_bits_count(&s->gb), v->bits, s->mb_x, s->mb_y); + get_bits_count(&s->gb), s->gb.size_in_bits, s->mb_x, s->mb_y); return; } inc_blk_idx(v->topleft_blk_idx); @@ -2951,11 +2951,11 @@ static void vc1_decode_b_blocks(VC1Context *v) if (v->s.loop_filter) ff_vc1_i_loop_filter(v); } - if (get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) { + if (get_bits_left(&s->gb) < 0 || get_bits_count(&s->gb) < 0) { // TODO: may need modification to handle slice coding ff_er_add_slice(&s->er, 0, s->start_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR); av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", - get_bits_count(&s->gb), v->bits, s->mb_x, s->mb_y); + get_bits_count(&s->gb), s->gb.size_in_bits, s->mb_x, s->mb_y); return; } } diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index a67957448d..b84c16eef0 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -1031,7 +1031,6 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, ff_mpeg_er_frame_start(s); - v->bits = FFMIN(buf_size * 8, s->gb.size_in_bits); v->end_mb_x = s->mb_width; if (v->field_mode) { s->current_picture.f->linesize[0] <<= 1; @@ -1107,7 +1106,6 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, ff_vc1_decode_blocks(v); if (i != n_slices) { s->gb = slices[i].gb; - v->bits = FFMIN(buf_size * 8, s->gb.size_in_bits); } } if (v->field_mode) {