From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 3A45640D3A for ; Wed, 16 Nov 2022 08:44:30 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 640BC68BC0D; Wed, 16 Nov 2022 10:44:27 +0200 (EET) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2EB7468B945 for ; Wed, 16 Nov 2022 10:44:21 +0200 (EET) Received: by mail-pl1-f178.google.com with SMTP id io19so15787470plb.8 for ; Wed, 16 Nov 2022 00:44:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=RkKlBj1FGa3x4f41XFZB2s0Nccjrh9lk9p6SSB2gS+k=; b=B8not2tXLw2pujClUQgvf+Z1xLvxY+D20s2HUT9KjixYLXKgPRPEFBHhBvAJxuru2C JZc6apsPbA6z1/InkCqS31zW8PmcwURUOzc3HARKIgJt3c9HT/vvq4P7WxDURMwKaib/ 4lwHZtYw/Gsuj77doKQJuP1c0Pzfaz9iMC3lk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=RkKlBj1FGa3x4f41XFZB2s0Nccjrh9lk9p6SSB2gS+k=; b=PfXqcn8VyXDcuv2Qc92nEQqfEtL6GdaWK7V377mvFUb9nxygxfuHc4qWb1MZTU+G66 i9pQaUSq3QElbfic0iJb0qa/1U7B0o+LGNswX9ksDGTiAl/B9Ws2biwhIh0SzSQnrIPB 3aK1ZLXCqFHkXmiLSWtCxWG3qz197blPRP9GRMtqdTL3htNiyz0ToiYHNywgz82XL4sD ZhIRulf9/5/gGUrZE38sb19SBRCFTzHstjqcb5FC5B5SMDrvdCQzD+3dZ0ijszRCe28X d3Emej3KvJuNxA3LzD4R7+cG8HKttPV5e1apMr5gCVNBYQkJCrgyOavkNJeNtfIp/U0m MAug== X-Gm-Message-State: ANoB5pmNg24U3pVH0RD7e/qtzxbukV61JfWsSG2bZmU5r1qVgGdz0uVg 83H4qjeCdH2DEnQTGvB2dgmvdYHRceJN2A== X-Google-Smtp-Source: AA0mqf4g/vHuQlNS+NL4VrCVKhhOSNKPA3U5O/eti329NDnFHAhA6gZMg2x9CUTKf/10fwZAN1KoVw== X-Received: by 2002:a17:902:ccd2:b0:186:fd58:c700 with SMTP id z18-20020a170902ccd200b00186fd58c700mr7937733ple.119.1668588258662; Wed, 16 Nov 2022 00:44:18 -0800 (PST) Received: from hiroh1.tok.corp.google.com ([2401:fa00:8f:203:f58b:71c2:aa56:5cfa]) by smtp.gmail.com with ESMTPSA id f14-20020a170902684e00b0017b69f99321sm11315970pln.219.2022.11.16.00.44.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 00:44:18 -0800 (PST) From: Hirokazu Honda To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Nov 2022 17:44:12 +0900 Message-Id: <20221116084412.2537585-1-hiroh@chromium.org> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/vp8: Fix wrong vpx_rac_is_end() check X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Hirokazu Honda Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: The check of vpx_rac_is_end check(s) are added originally from 1afd246960202917e244c844c534e9c1e3c323f5. It causes a regression of some vp8 stream. b6b9ac5698c8f911841b469af77199153278c55c fixes the regression by a sort of band-aid way. This fixes the wrongness of the original commit. vpx_rac_is_end() should be called against the bool decoder for the vp8 headr context, not one for each coefficient. Reference is vp8_dixie_tokens_process_row() in token.c in spec 20.16. Fixes: Ticket 8069 Fixes: regression of 1afd246960202917e244c844c534e9c1e3c323f5. Fixes: b6b9ac5698c8f911841b469af77199153278c55c Signed-off-by: Hirokazu Honda --- libavcodec/vp8.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 67f36d8933..77f5a6b657 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -2404,7 +2404,8 @@ static av_always_inline int decode_mb_row_no_filter(AVCodecContext *avctx, void int num_jobs = s->num_jobs; const VP8Frame *prev_frame = s->prev_frame; VP8Frame *curframe = s->curframe; - VPXRangeCoder *c = &s->coeff_partition[mb_y & (s->num_coeff_partitions - 1)]; + VPXRangeCoder *coeff_c = &s->coeff_partition[mb_y & (s->num_coeff_partitions - 1)]; + VP8Macroblock *mb; uint8_t *dst[3] = { curframe->tf.f->data[0] + 16 * mb_y * s->linesize, @@ -2412,7 +2413,7 @@ static av_always_inline int decode_mb_row_no_filter(AVCodecContext *avctx, void curframe->tf.f->data[2] + 8 * mb_y * s->uvlinesize }; - if (vpx_rac_is_end(c)) + if (vpx_rac_is_end(&s->c)) return AVERROR_INVALIDDATA; if (mb_y == 0) @@ -2443,7 +2444,7 @@ static av_always_inline int decode_mb_row_no_filter(AVCodecContext *avctx, void td->mv_bounds.mv_max.x = ((s->mb_width - 1) << 6) + MARGIN; for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) { - if (vpx_rac_is_end(c)) + if (vpx_rac_is_end(&s->c)) return AVERROR_INVALIDDATA; // Wait for previous thread to read mb_x+2, and reach mb_y-1. if (prev_td != td) { @@ -2471,7 +2472,7 @@ static av_always_inline int decode_mb_row_no_filter(AVCodecContext *avctx, void prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP8_FRAME_PREVIOUS); if (!mb->skip) - decode_mb_coeffs(s, td, c, mb, s->top_nnz[mb_x], td->left_nnz, is_vp7); + decode_mb_coeffs(s, td, coeff_c, mb, s->top_nnz[mb_x], td->left_nnz, is_vp7); if (mb->mode <= MODE_I4x4) intra_predict(s, td, dst, mb, mb_x, mb_y, is_vp7); -- 2.38.1.431.g37b22c650d-goog _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".