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 9E4CE49D12 for ; Mon, 8 Apr 2024 16:02:13 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E1D5668D264; Mon, 8 Apr 2024 19:02:10 +0300 (EEST) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 30F7B68D07E for ; Mon, 8 Apr 2024 19:02:04 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id AEE5F240002 for ; Mon, 8 Apr 2024 16:02:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1712592122; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=OZN2FqPnGvfjwf5ZuzZMDQvtDL7j7iNB9MYiyOakJXg=; b=gpTMDsQora5w+ZivQUryr4bwlN2fOtIVGguGauTsoE4aE66frZm66al1XH6YfKG5dvDUvG CChiNjDsX2BnzFuceeYPnu82yy93bXSJ/UiX9UVj8nbliclM9WuoSrqwWCLplC3zopRyOS yGNCObcWEqNi+aM3ZKY+qBjhtPS4utlLhg3mFGBglW5GE8Qfm8zc94VJwvBvLUdU4e6vfx AzYZHMlBKMBfbRMwJ2kEMm4b8VwnWzjKHaLAjXjKZQQ9jOFB23lx+sRhaGCtUJij68sT1q PKXIS1y582ufBPsNJTrr25PDks8MVJaHFNHaQCbTG4QyhHy8Mzv+nJluJYPwHw== Date: Mon, 8 Apr 2024 18:02:02 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240408160202.GG6420@pb2> References: MIME-Version: 1.0 In-Reply-To: X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 1/2] avcodec/mpegvideo_enc: Reject input incompatible with chroma subsampling 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="===============1658968058273709288==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============1658968058273709288== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="JPHcF2elmJaPFTKL" Content-Disposition: inline --JPHcF2elmJaPFTKL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 08, 2024 at 12:51:08AM +0200, Andreas Rheinhardt wrote: > Andreas Rheinhardt: > > Fixes ticket #10952. > >=20 > > Discovered by: Zeng Yunxiang > > Signed-off-by: Andreas Rheinhardt > > --- > > I am pretty sure that a lot of other encoders don't handle this well > > either. Maybe we should handle this more generically in > > ff_encode_preinit? > >=20 > > libavcodec/mpegvideo_enc.c | 12 ++++++++++++ > > 1 file changed, 12 insertions(+) > >=20 > > diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c > > index d1b1917824..a65ecc6839 100644 > > --- a/libavcodec/mpegvideo_enc.c > > +++ b/libavcodec/mpegvideo_enc.c > > @@ -314,6 +314,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avct= x) > > AVCPBProperties *cpb_props; > > int i, ret; > > int mb_array_size, mv_table_size; > > + int chroma_h_subsampling =3D 1, chroma_v_subsampling =3D 1; > > =20 > > mpv_encode_defaults(s); > > =20 > > @@ -325,14 +326,25 @@ av_cold int ff_mpv_encode_init(AVCodecContext *av= ctx) > > case AV_PIX_FMT_YUVJ422P: > > case AV_PIX_FMT_YUV422P: > > s->chroma_format =3D CHROMA_422; > > + chroma_h_subsampling =3D 2; > > break; > > case AV_PIX_FMT_YUVJ420P: > > case AV_PIX_FMT_YUV420P: > > default: > > s->chroma_format =3D CHROMA_420; > > + chroma_h_subsampling =3D 2; > > + chroma_v_subsampling =3D 2; > > break; > > } > > =20 > > + if (avctx->width & (chroma_h_subsampling - 1) || > > + avctx->height & (chroma_v_subsampling - 1)) { > > + av_log(avctx, AV_LOG_ERROR, > > + "Dimensions %dx%d incompatible with chroma subsampling.= \n", > > + avctx->width, avctx->height); > > + return AVERROR(EINVAL); > > + } > > + > > avctx->bits_per_raw_sample =3D av_clip(avctx->bits_per_raw_sample,= 0, 8); > > =20 > > s->bit_rate =3D avctx->bit_rate; >=20 > Will apply this patchset tomorrow unless there are objections. this breaks =2E/ffmpeg -i 'samples.multimedia.cx/game-formats/sierra-vmd/lastdynasty/HG= 060808.VMD' -y test.avi [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The worst form of inequality is to try to make unequal things equal. -- Aristotle --JPHcF2elmJaPFTKL Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZhQU9AAKCRBhHseHBAsP q3COAJ4imdrsrNP5O/iFXPLFpRbU+3NXxwCeKcc+FuQcfA/rkp5S9yAfUOVnbi8= =C4DD -----END PGP SIGNATURE----- --JPHcF2elmJaPFTKL-- --===============1658968058273709288== 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". --===============1658968058273709288==--