From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTPS id C85464CE20
	for <ffmpegdev@gitmailbox.com>; Sat, 15 Mar 2025 00:34:53 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 72B7468E335;
	Sat, 15 Mar 2025 02:34:49 +0200 (EET)
Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net
 [217.70.183.200])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7B12E687A55
 for <ffmpeg-devel@ffmpeg.org>; Sat, 15 Mar 2025 02:34:42 +0200 (EET)
Received: by mail.gandi.net (Postfix) with ESMTPSA id C0B4342DF9
 for <ffmpeg-devel@ffmpeg.org>; Sat, 15 Mar 2025 00:34:41 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc;
 s=gm1; t=1741998881;
 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=IRg/HTncP5V6j0Sa7kMj0nnPhQw/Ft1OqorDY5GrNB0=;
 b=NzqUG1VQCaFvjfZCcELMYZsQ2meHIuuSKWE8GxBVZSTNvRFEKuaF8Z0YMh24+ekccnmvNt
 GXvZIb6GLxLVqdiNjier0aNQ4bY605Cd9pJ9Zj3ZTi050PYIQL0n5ddiTY407/M7jpl4sk
 HtA204zWdKu3rxwHnDiJKVJF5Fd5RGJ7LdLCvMjKVDz4CYwkIKAPkwqdbPYU3wh51kVPvU
 Ta9HMB1crs5qmWqVPLH6KfzMK/AukCJqwb+91nOBrzONZYXdE0CwC2ALih9LiTCaY4KhoD
 IvoKqhlzGyHBhZz1nax9OiFPoHBXz8NVhr3FBlveC3jpWukECX+B61nBHCERJQ==
Date: Sat, 15 Mar 2025 01:34:41 +0100
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Message-ID: <20250315003441.GO4991@pb2>
References: <20250310004552.2980855-1-michael@niedermayer.cc>
 <e57ac6f3-c0db-4c7c-b14e-da428b422331@lynne.ee>
 <20250311005906.GV4991@pb2>
 <79552cb3-9928-4be1-accf-4a87d39a2849@gmail.com>
 <02eb0006-be20-446e-979a-916f1e81e75d@gmail.com>
MIME-Version: 1.0
In-Reply-To: <02eb0006-be20-446e-979a-916f1e81e75d@gmail.com>
X-GND-State: clean
X-GND-Score: -85
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddufedvvdelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculdduhedmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddunecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpeetteduteejgefgkeetfedvtdffhedvkeevudeggeevgedvtdejkeekhefhgeetgfenucffohhmrghinhepghhithhhuhgsuhhsvghrtghonhhtvghnthdrtghomhenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg
X-GND-Sasl: michael@niedermayer.cc
Subject: Re: [FFmpeg-devel] [PATCH] ffv1: implement remap for
 encode/decode_plane()
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Content-Type: multipart/mixed; boundary="===============5772704509760950855=="
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/20250315003441.GO4991@pb2/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>


--===============5772704509760950855==
Content-Type: multipart/signed; micalg=pgp-sha512;
	protocol="application/pgp-signature"; boundary="2TetqUoQwMzB4R7x"
Content-Disposition: inline


--2TetqUoQwMzB4R7x
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Mar 11, 2025 at 04:06:58PM -0300, James Almer wrote:
>=20
>=20
> On 3/11/2025 11:13 AM, James Almer wrote:
> > On 3/10/2025 9:59 PM, Michael Niedermayer wrote:
> > > On Mon, Mar 10, 2025 at 06:48:29PM +0100, Lynne wrote:
> > > > On 10/03/2025 01:45, Michael Niedermayer wrote:
> > > > > Sponsored-by: Sovereign Tech Fund
> > > > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > > > > ---
> > > > > =A0=A0 libavcodec/ffv1dec.c | 20 ++++++++-----
> > > > > =A0=A0 libavcodec/ffv1enc.c | 67
> > > > > +++++++++++++++++++++++++++++++++++++ +------
> > > > > =A0=A0 2 files changed, 71 insertions(+), 16 deletions(-)
> > > > >=20
> > > > > diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
> > > > > index 9738e4e9c9f..72c93fcf0cd 100644
> > > > > --- a/libavcodec/ffv1dec.c
> > > > > +++ b/libavcodec/ffv1dec.c
> > > > > @@ -92,7 +92,7 @@ static int is_input_end(RangeCoder *c,
> > > > > GetBitContext *gb, int ac)
> > > > > =A0=A0 static int decode_plane(FFV1Context *f, FFV1SliceContext *=
sc,
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0 GetBitContext *gb,
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0 uint8_t *src, int w, int h, int
> > > > > stride, int plane_index,
> > > > > -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0 int pixel_stride, int ac)
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0 int remap_index, int pixel_stride, int ac)
> > > > > =A0=A0 {
> > > > > =A0=A0=A0=A0=A0=A0 int x, y;
> > > > > =A0=A0=A0=A0=A0=A0 int16_t *sample[2];
> > > > > @@ -116,12 +116,18 @@ static int decode_plane(FFV1Context
> > > > > *f, FFV1SliceContext *sc,
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 int ret =3D decode_lin=
e(f, sc, gb, w, sample,
> > > > > plane_index, 8, ac);
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (ret < 0)
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return ret;
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (sc->remap)
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 for (x =3D 0; x < =
w; x++)
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 sample=
[1][x] =3D sc->fltmap[remap_index]
> > > > > [sample[1][x]];
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 for (x =3D 0; x < w; x=
++)
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 src[x*pixe=
l_stride + stride * y] =3D sample[1][x];
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 } else {
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 int ret =3D decode_lin=
e(f, sc, gb, w, sample,
> > > > > plane_index, f->avctx->bits_per_raw_sample, ac);
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (ret < 0)
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return ret;
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (sc->remap)
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 for (x =3D 0; x < =
w; x++)
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 sample=
[1][x] =3D sc->fltmap[remap_index]
> > > > > [sample[1][x]];
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (f->packed_at_lsb) {
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 for (x =3D=
 0; x < w; x++) {
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0 ((uint16_t*)(src +
> > > > > stride*y))[x*pixel_stride] =3D sample[1][x];
> > > > > @@ -347,17 +353,17 @@ static int decode_slice(AVCodecContext
> > > > > *c, void *arg)
> > > > > =A0=A0=A0=A0=A0=A0 if (f->colorspace =3D=3D 0 && (f->chroma_plane=
s || !f-
> > > > > >transparency)) {
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 const int cx=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 =3D x >> f->chroma_h_shift;
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 const int cy=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 =3D y >> f->chroma_v_shift;
> > > > > -=A0=A0=A0=A0=A0=A0=A0 decode_plane(f, sc, &gb, p->data[0] + ps*x=
 + y*p-
> > > > > >linesize[0], width, height, p->linesize[0], 0, 1, ac);
> > > > > +=A0=A0=A0=A0=A0=A0=A0 decode_plane(f, sc, &gb, p->data[0] + ps*x=
 + y*p-
> > > > > >linesize[0], width, height, p->linesize[0], 0, 0, 1, ac);
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (f->chroma_planes) {
> > > > > -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 decode_plane(f, sc, &gb, p->da=
ta[1] +
> > > > > ps*cx+cy*p- >linesize[1], chroma_width, chroma_height,
> > > > > p->linesize[1], 1, 1, ac);
> > > > > -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 decode_plane(f, sc, &gb, p->da=
ta[2] +
> > > > > ps*cx+cy*p- >linesize[2], chroma_width, chroma_height,
> > > > > p->linesize[2], 1, 1, ac);
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 decode_plane(f, sc, &gb, p->da=
ta[1] +
> > > > > ps*cx+cy*p- >linesize[1], chroma_width, chroma_height,
> > > > > p->linesize[1], 1, 1, 1, ac);
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 decode_plane(f, sc, &gb, p->da=
ta[2] +
> > > > > ps*cx+cy*p- >linesize[2], chroma_width, chroma_height,
> > > > > p->linesize[2], 1, 2, 1, ac);
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (f->transparency)
> > > > > -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 decode_plane(f, sc, &gb, p->da=
ta[3] + ps*x +
> > > > > y*p- >linesize[3], width, height, p->linesize[3],
> > > > > (f->version >=3D 4 && !f- >chroma_planes) ? 1 : 2, 1, ac);
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 decode_plane(f, sc, &gb, p->da=
ta[3] + ps*x +
> > > > > y*p- >linesize[3], width, height, p->linesize[3],
> > > > > (f->version >=3D 4 && !f- >chroma_planes) ? 1 : 2, 2, 1, ac);
> > > > > =A0=A0=A0=A0=A0=A0 } else if (f->colorspace =3D=3D 0) {
> > > > > -=A0=A0=A0=A0=A0=A0=A0=A0 decode_plane(f, sc, &gb, p->data[0] + p=
s*x + y*p-
> > > > > >linesize[0]=A0=A0=A0 , width, height, p->linesize[0], 0, 2, ac);
> > > > > -=A0=A0=A0=A0=A0=A0=A0=A0 decode_plane(f, sc, &gb, p->data[0] + p=
s*x + y*p-
> > > > > >linesize[0] + 1, width, height, p->linesize[0], 1, 2, ac);
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0 decode_plane(f, sc, &gb, p->data[0] + p=
s*x + y*p-
> > > > > >linesize[0]=A0=A0=A0 , width, height, p->linesize[0], 0, 0, 2,
> > > > > ac);
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0 decode_plane(f, sc, &gb, p->data[0] + p=
s*x + y*p-
> > > > > >linesize[0] + 1, width, height, p->linesize[0], 1, 1, 2,
> > > > > ac);
> > > > > =A0=A0=A0=A0=A0=A0 } else if (f->use32bit) {
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 uint8_t *planes[4] =3D { p->data[0=
] + ps * x + y *
> > > > > p- >linesize[0],
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 p->data[1] + ps * x + y *
> > > > > p- >linesize[1],
> > > > > diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
> > > > > index f3041219b71..4c55c01263b 100644
> > > > > --- a/libavcodec/ffv1enc.c
> > > > > +++ b/libavcodec/ffv1enc.c
> > > > > @@ -272,7 +272,7 @@ static inline void
> > > > > put_vlc_symbol(PutBitContext *pb, VlcState *const state,
> > > > > =A0=A0 static int encode_plane(FFV1Context *f, FFV1SliceContext *=
sc,
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0 const uint8_t *src, int w, int h,
> > > > > -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0 int stride, int plane_index, int
> > > > > pixel_stride, int ac)
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0 int stride, int plane_index, int
> > > > > remap_index, int pixel_stride, int ac)
> > > > > =A0=A0 {
> > > > > =A0=A0=A0=A0=A0=A0 int x, y, i, ret;
> > > > > =A0=A0=A0=A0=A0=A0 const int pass1 =3D !!(f->avctx->flags & AV_CO=
DEC_FLAG_PASS1);
> > > > > @@ -288,9 +288,14 @@ static int encode_plane(FFV1Context *f,
> > > > > FFV1SliceContext *sc,
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 sample[0][-1]=3D sample[1][0=A0 ];
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 sample[1][ w]=3D sample[1][w-1];
> > > > > +
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (f->bits_per_raw_sample <=3D 8)=
 {
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 for (x =3D 0; x < w; x=
++)
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 sample[0][=
x] =3D src[x * pixel_stride + stride * y];
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (sc->remap)
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 for (x =3D 0; x < =
w; x++)
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 sample=
[0][x] =3D sc->fltmap[remap_index]
> > > > > [ sample[0][x] ];
> > > > > +
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if((ret =3D encode_lin=
e(f, sc, f->avctx, w,
> > > > > sample, plane_index, 8, ac, pass1)) < 0)
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return ret;
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 } else {
> > > > > @@ -303,6 +308,10 @@ static int encode_plane(FFV1Context *f,
> > > > > FFV1SliceContext *sc,
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0 sample[0][x] =3D ((uint16_t*)(src +
> > > > > stride*y)) [x] >> (16 - f->bits_per_raw_sample);
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (sc->remap)
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 for (x =3D 0; x < =
w; x++)
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 sample=
[0][x] =3D sc->fltmap[remap_index]
> > > > > [ sample[0][x] ];
> > > > > +
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if((ret =3D encode_lin=
e(f, sc, f->avctx, w,
> > > > > sample, plane_index, f->bits_per_raw_sample, ac, pass1)) <
> > > > > 0)
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return ret;
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }
> > > > > @@ -310,6 +319,30 @@ static int encode_plane(FFV1Context *f,
> > > > > FFV1SliceContext *sc,
> > > > > =A0=A0=A0=A0=A0=A0 return 0;
> > > > > =A0=A0 }
> > > > > +static void load_plane(FFV1Context *f, FFV1SliceContext *sc,
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =
const uint8_t *src, int w, int h,
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =
int stride, int remap_index, int pixel_stride)
> > > > > +{
> > > > > +=A0=A0=A0 int x, y;
> > > > > +
> > > > > +=A0=A0=A0 memset(sc->fltmap[remap_index], 0, sizeof(sc-
> > > > > >fltmap[remap_index]));
> > > > > +
> > > > > +=A0=A0=A0 for (y =3D 0; y < h; y++) {
> > > > > +=A0=A0=A0=A0=A0=A0=A0 if (f->bits_per_raw_sample <=3D 8) {
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 for (x =3D 0; x < w; x++)
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 sc->fltmap[remap_i=
ndex][ src[x *
> > > > > pixel_stride + stride * y] ] =3D 1;
> > > > > +=A0=A0=A0=A0=A0=A0=A0 } else {
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (f->packed_at_lsb) {
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 for (x =3D 0; x < =
w; x++)
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 sc->fl=
tmap[remap_index][
> > > > > ((uint16_t*)(src + stride*y))[x] ] =3D 1;
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 } else {
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 for (x =3D 0; x < =
w; x++)
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 sc->fl=
tmap[remap_index][
> > > > > ((uint16_t*)(src + stride*y))[x] >> (16 -
> > > > > f->bits_per_raw_sample) ] =3D 1;
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }
> > > > > +=A0=A0=A0=A0=A0=A0=A0 }
> > > > > +=A0=A0=A0 }
> > > > > +}
> > > > > +
> > > > > =A0=A0 static void write_quant_table(RangeCoder *c, int16_t *quan=
t_table)
> > > > > =A0=A0 {
> > > > > =A0=A0=A0=A0=A0=A0 int last =3D 0;
> > > > > @@ -1178,8 +1211,24 @@ retry:
> > > > > =A0=A0=A0=A0=A0=A0 }
> > > > > =A0=A0=A0=A0=A0=A0 if (sc->remap) {
> > > > > -=A0=A0=A0=A0=A0=A0=A0 if (f->colorspace =3D=3D 0) {
> > > > > -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 av_assert0(0);
> > > > > +=A0=A0=A0=A0=A0=A0=A0 if (f->colorspace =3D=3D 0 && c->pix_fmt !=
=3D AV_PIX_FMT_YA8) {
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 const int cx=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0 =3D x >> f->chroma_h_shift;
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 const int cy=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0 =3D y >> f->chroma_v_shift;
> > > > > +
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 //TODO decide on the order for=
 the encoded
> > > > > remaps and loads. with golomb rice it
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 // easier to have all range co=
ded ones
> > > > > together, otherwise it may be nicer to handle each plane as
> > > > > a whole?
> > > > > +
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 load_plane(f, sc, p->data[0] +=
 ps*x +
> > > > > y*p->linesize[0], width, height, p->linesize[0], 0, 1);
> > > > > +
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (f->chroma_planes) {
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 load_plane(f, sc, =
p->data[1] + ps*cx+cy*p-
> > > > > >linesize[1], chroma_width, chroma_height, p->linesize[1],
> > > > > 1, 1);
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 load_plane(f, sc, =
p->data[2] + ps*cx+cy*p-
> > > > > >linesize[2], chroma_width, chroma_height, p->linesize[2],
> > > > > 2, 1);
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (f->transparency)
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 load_plane(f, sc, =
p->data[3] + ps*x + y*p-
> > > > > >linesize[3], width, height, p->linesize[3], 3, 1);
> > > > > +=A0=A0=A0=A0=A0=A0=A0 } else if (c->pix_fmt =3D=3D AV_PIX_FMT_YA=
8) {
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 load_plane(f, sc, p->data[0] +=
=A0=A0=A0=A0 ps*x + y*p-
> > > > > >linesize[0], width, height, p->linesize[0], 0, 2);
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 load_plane(f, sc, p->data[0] +=
 1 + ps*x + y*p-
> > > > > >linesize[0], width, height, p->linesize[0], 1, 2);
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 } else if (f->use32bit) {
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 load_rgb_frame32(f, sc=
, planes, width,
> > > > > height, p- >linesize);
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 } else
> > > > > @@ -1206,17 +1255,17 @@ retry:
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 const int cx=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 =3D x >> f->chroma_h_shift;
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 const int cy=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 =3D y >> f->chroma_v_shift;
> > > > > -=A0=A0=A0=A0=A0=A0=A0 ret =3D encode_plane(f, sc, p->data[0] + p=
s*x + y*p-
> > > > > >linesize[0], width, height, p->linesize[0], 0, 1, ac);
> > > > > +=A0=A0=A0=A0=A0=A0=A0 ret =3D encode_plane(f, sc, p->data[0] + p=
s*x + y*p-
> > > > > >linesize[0], width, height, p->linesize[0], 0, 0, 1, ac);
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (f->chroma_planes) {
> > > > > -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ret |=3D encode_plane(f, sc, p=
->data[1] +
> > > > > ps*cx+cy*p- >linesize[1], chroma_width, chroma_height,
> > > > > p->linesize[1], 1, 1, ac);
> > > > > -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ret |=3D encode_plane(f, sc, p=
->data[2] +
> > > > > ps*cx+cy*p- >linesize[2], chroma_width, chroma_height,
> > > > > p->linesize[2], 1, 1, ac);
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ret |=3D encode_plane(f, sc, p=
->data[1] +
> > > > > ps*cx+cy*p- >linesize[1], chroma_width, chroma_height,
> > > > > p->linesize[1], 1, 1, 1, ac);
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ret |=3D encode_plane(f, sc, p=
->data[2] +
> > > > > ps*cx+cy*p- >linesize[2], chroma_width, chroma_height,
> > > > > p->linesize[2], 1, 2, 1, ac);
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (f->transparency)
> > > > > -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ret |=3D encode_plane(f, sc, p=
->data[3] + ps*x +
> > > > > y*p- >linesize[3], width, height, p->linesize[3], 2, 1, ac);
> > > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ret |=3D encode_plane(f, sc, p=
->data[3] + ps*x +
> > > > > y*p- >linesize[3], width, height, p->linesize[3], 2, 3, 1,
> > > > > ac);
> > > > > =A0=A0=A0=A0=A0=A0 } else if (c->pix_fmt =3D=3D AV_PIX_FMT_YA8) {
> > > > > -=A0=A0=A0=A0=A0=A0=A0 ret=A0 =3D encode_plane(f, sc, p->data[0] =
+=A0=A0=A0=A0 ps*x +
> > > > > y*p- >linesize[0], width, height, p->linesize[0], 0, 2, ac);
> > > > > -=A0=A0=A0=A0=A0=A0=A0 ret |=3D encode_plane(f, sc, p->data[0] + =
1 + ps*x +
> > > > > y*p- >linesize[0], width, height, p->linesize[0], 1, 2, ac);
> > > > > +=A0=A0=A0=A0=A0=A0=A0 ret=A0 =3D encode_plane(f, sc, p->data[0] =
+=A0=A0=A0=A0 ps*x +
> > > > > y*p- >linesize[0], width, height, p->linesize[0], 0, 0, 2,
> > > > > ac);
> > > > > +=A0=A0=A0=A0=A0=A0=A0 ret |=3D encode_plane(f, sc, p->data[0] + =
1 + ps*x +
> > > > > y*p- >linesize[0], width, height, p->linesize[0], 1, 1, 2,
> > > > > ac);
> > > > > =A0=A0=A0=A0=A0=A0 } else if (f->use32bit) {
> > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ret =3D encode_rgb_frame32(f, sc, =
planes, width,
> > > > > height, p- >linesize, ac);
> > > > > =A0=A0=A0=A0=A0=A0 } else {
> > > >=20
> > > > Doesn't apply properly.
> > > > What does it even do? Does the current git master not already do th=
is?
> > >=20
> > > master implements remap for encode_rgb_frame*
> > > This implements it for the other cases.
> > > Most of this is untested though, i have no YUV planar float16 material
> > There is one very tiny exr sample that's YA float16, the one from fate-
> > exr-ya-scanline-zip-half-12x8. Not sure how useful can it be considering
> > it's so small and has no chroma planes.
>=20
> There's also https://raw.githubusercontent.com/AcademySoftwareFoundation/=
openexr-images/main/LuminanceChroma/Garden.exr
> which is grayf16.

patches sent to support these

thx

[...]

--=20
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued

--2TetqUoQwMzB4R7x
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZ9TLHgAKCRBhHseHBAsP
q5OaAJ9o3tMj4B24zWDDNK2K7p7EznRJQwCfW2BU0GhYwLoqaEahMatoUTYjzX4=
=pFAH
-----END PGP SIGNATURE-----

--2TetqUoQwMzB4R7x--

--===============5772704509760950855==
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".

--===============5772704509760950855==--