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 EC45949D1D for ; Mon, 8 Apr 2024 16:07:40 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9EC4A68D28D; Mon, 8 Apr 2024 19:07:39 +0300 (EEST) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 495B568ADF1 for ; Mon, 8 Apr 2024 19:07:33 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 7E2921BF204 for ; Mon, 8 Apr 2024 16:07:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1712592452; 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=lJ1tZd4DTW4k9qpFOCmMdJjnuH4f4GTMhLfogQ4x530=; b=UTNUU7iTsw/7ZZv2+JzsYL38C93S5rFckGL2vywjjgHAEIqsI/X6JuTYELnJEMCuIcc2d9 w8ySpisplvMyP1nWul/4BhKOpkW2mtXO5mm2/Zq+gjPng7frJ/Z6aSj/FnmRf90ESc3EfQ j0+wXUIvnGvokuzbAWc2+9YTPAUIGpEL56xQIvA2NZFlLfjQPN46aR3WeMUllDJVwN8aBq GPAgn3LCJ8aJFc3Vs5Q+zI/T6IyEqWOzDQ8lV7Tog4Vu87/zEzxdSQG5pCN5fE2gpMU9fp cRjNurZFxwlj02QbfU353AetsYKP4o+hOuH/WzPxsoWn8PBeOgzBPXbGNKWQYA== Date: Mon, 8 Apr 2024 18:07:31 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240408160731.GH6420@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="===============5982414459491940892==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============5982414459491940892== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="+6Ri4IAKTGNbsEzb" Content-Disposition: inline --+6Ri4IAKTGNbsEzb 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. Also please dont apply stuff like this with a 1 day warning, i just saw thi= s now dropping support for odd resolutions is a major change and not ok thanks [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Elect your leaders based on what they did after the last election, not based on what they say before an election. --+6Ri4IAKTGNbsEzb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZhQWQwAKCRBhHseHBAsP qzTbAJwLN5X8t8TI6fvq44P0FGid8cmxRgCeN3em/v2/XW9sS91qdf5vHQzONEM= =arHK -----END PGP SIGNATURE----- --+6Ri4IAKTGNbsEzb-- --===============5982414459491940892== 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". --===============5982414459491940892==--