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 ESMTPS id D80CD45AC0 for ; Sun, 19 Jan 2025 09:50:13 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 842EC68B449; Sun, 19 Jan 2025 11:50:09 +0200 (EET) Received: from mx.sdf.org (mx.sdf.org [205.166.94.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 03B0C68B266 for ; Sun, 19 Jan 2025 11:50:01 +0200 (EET) Received: from db9113ea98d98dd28eac7beef2464e3c ([1.145.145.240]) (authenticated (0 bits)) by mx.sdf.org (8.18.1/8.14.3) with ESMTPSA id 50J9np0N014910 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO) for ; Sun, 19 Jan 2025 09:49:57 GMT Date: Sun, 19 Jan 2025 20:49:50 +1100 From: Peter Ross To: ffmpeg-devel@ffmpeg.org Message-ID: <3c2004ecb7e4156284d4879188ce1ac2dfe0aa07.1737279929.git.pross@xvid.org> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCHv2] avcodec/leaddec: support format 0x1006 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 Content-Type: multipart/mixed; boundary="===============3133447992347268030==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============3133447992347268030== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zObdQmg43vRkEIgn" Content-Disposition: inline --zObdQmg43vRkEIgn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Fixes ticket #10658. --- Tested with some different vertical resolution alignments. When the vertical resolution is not aligned to macroblock height, the reference encoder & decoder performs buggy placement of the initial field. Its an internal bug, but because the encoder and decoder are aligned, end-user does not see it. FFmpeg decoder does not reproduce this behaviour. libavcodec/leaddec.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libavcodec/leaddec.c b/libavcodec/leaddec.c index 88387902ca..e6a91faabc 100644 --- a/libavcodec/leaddec.c +++ b/libavcodec/leaddec.c @@ -164,6 +164,10 @@ static int lead_decode_frame(AVCodecContext *avctx, AV= Frame * frame, case 0x1000: avctx->pix_fmt =3D AV_PIX_FMT_YUV420P; break; + case 0x1006: + fields =3D 2; + avctx->pix_fmt =3D AV_PIX_FMT_YUV420P; + break; case 0x2000: avctx->pix_fmt =3D AV_PIX_FMT_YUV444P; break; @@ -237,7 +241,8 @@ static int lead_decode_frame(AVCodecContext *avctx, AVF= rame * frame, return ret; } } else if (avctx->pix_fmt =3D=3D AV_PIX_FMT_YUV420P) { - for (int mb_y =3D 0; mb_y < (avctx->height + 15) / 16; mb_y++) + for (int f =3D 0; f < fields; f++) + for (int mb_y =3D 0; mb_y < (avctx->height + 15) / 16 / fields; mb= _y++) for (int mb_x =3D 0; mb_x < (avctx->width + 15) / 16; mb_x++) for (int b =3D 0; b < (yuv20p_half ? 4 : 6); b++) { int luma_block =3D yuv20p_half ? 2 : 4; @@ -258,8 +263,8 @@ static int lead_decode_frame(AVCodecContext *avctx, AVF= rame * frame, =20 ret =3D decode_block(s, &gb, dc_vlc, dc_bits, ac_vlc, = ac_bits, dc_pred + plane, dequant[!(b < 4)], - frame->data[plane] + y*frame->linesize[plane] + x, - (yuv20p_half && b < 2 ? 2 : 1) * frame->linesize[p= lane]); + frame->data[plane] + (f + y*fields)*frame->linesiz= e[plane] + x, + (yuv20p_half && b < 2 ? 2 : 1) * fields * frame->l= inesize[plane]); if (ret < 0) return ret; =20 --=20 2.45.2 -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B) --zObdQmg43vRkEIgn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQSpB+AvpuUM0jTNINJnYHnFrEDdawUCZ4zKtwAKCRBnYHnFrEDd aycbAJ952bHRU0i/q7PKppSq+hyfoOzEFgCfcJhgRTNRO7DVwv1EOfH4L3+YE6U= =vlcr -----END PGP SIGNATURE----- --zObdQmg43vRkEIgn-- --===============3133447992347268030== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============3133447992347268030==--