[FFmpeg-devel] is libswscale maintained?

Andrew Randrianasulu randrianasulu at gmail.com
Wed Sep 11 04:48:09 EEST 2024


On Wed, Sep 11, 2024 at 3:21 AM Michael Niedermayer
<michael at niedermayer.cc> wrote:
>
> Hi
>
> On Wed, Sep 11, 2024 at 02:45:59AM +0300, Andrew Randrianasulu wrote:
> > I can't find entry about it in ffmpeg/MAINTAINERS
>
> I do try to maintain swscale. But iam surely happy if others help
> If you have a patch that needs to be reviewed or applied i can look at it

well, sadly I do not have any patches because I do not even understand how
chrRangeToJpeg_c works (I think I traced ~same code back to 2008 when
it was introduced to fix jpeg's full range yuv)

https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/HEAD:/libswscale/swscale.c
line 159

I wonder why two other functions  look different ( lumRangeToJpeg16_c
vs lumRangeToJpeg_c -
I assumed some shit by 4 should be there <according to stackoverflow >
but 4769U ?

static void chrRangeToJpeg_c(int16_t *dstU, int16_t *dstV, int width)
 160 {
 161     int i;
 162     for (i = 0; i < width; i++) {
 163         dstU[i] = (FFMIN(dstU[i], 30775) * 4663 - 9289992) >> 12; // -264
 164         dstV[i] = (FFMIN(dstV[i], 30775) * 4663 - 9289992) >> 12; // -264
 165     }
 166 }
 167
 168 static void chrRangeFromJpeg_c(int16_t *dstU, int16_t *dstV, int width)
 169 {
 170     int i;
 171     for (i = 0; i < width; i++) {
 172         dstU[i] = (dstU[i] * 1799 + 4081085) >> 11; // 1469
 173         dstV[i] = (dstV[i] * 1799 + 4081085) >> 11; // 1469
 174     }
 175 }
 176
 177 static void lumRangeToJpeg_c(int16_t *dst, int width)
 178 {
 179     int i;
 180     for (i = 0; i < width; i++)
 181         dst[i] = (FFMIN(dst[i], 30189) * 19077 - 39057361) >> 14;
 182 }
 183
 184 static void lumRangeFromJpeg_c(int16_t *dst, int width)
 185 {
 186     int i;
 187     for (i = 0; i < width; i++)
 188         dst[i] = (dst[i] * 14071 + 33561947) >> 14;
 189 }
 190
 191 static void chrRangeToJpeg16_c(int16_t *_dstU, int16_t *_dstV, int width)
 192 {
 193     int i;
 194     int32_t *dstU = (int32_t *) _dstU;
 195     int32_t *dstV = (int32_t *) _dstV;
 196     for (i = 0; i < width; i++) {
 197         dstU[i] = (FFMIN(dstU[i], 30775 << 4) * 4663 - (9289992
<< 4)) >> 12; // -264
 198         dstV[i] = (FFMIN(dstV[i], 30775 << 4) * 4663 - (9289992
<< 4)) >> 12; // -264
 199     }
 200 }
 201
 202 static void chrRangeFromJpeg16_c(int16_t *_dstU, int16_t *_dstV, int width)
 203 {
 204     int i;
 205     int32_t *dstU = (int32_t *) _dstU;
 206     int32_t *dstV = (int32_t *) _dstV;
 207     for (i = 0; i < width; i++) {
 208         dstU[i] = (dstU[i] * 1799 + (4081085 << 4)) >> 11; // 1469
 209         dstV[i] = (dstV[i] * 1799 + (4081085 << 4)) >> 11; // 1469
 210     }
 211 }
 212
 213 static void lumRangeToJpeg16_c(int16_t *_dst, int width)
 214 {
 215     int i;
 216     int32_t *dst = (int32_t *) _dst;
 217     for (i = 0; i < width; i++) {
 218         dst[i] = ((int)(FFMIN(dst[i], 30189 << 4) * 4769U -
(39057361 << 2))) >> 12;
 219     }
 220 }
 221
 222 static void lumRangeFromJpeg16_c(int16_t *_dst, int width)
 223 {
 224     int i;
 225     int32_t *dst = (int32_t *) _dst;
 226     for (i = 0; i < width; i++)
 227         dst[i] = (dst[i]*(14071/4) + (33561947<<4)/4)>>12;
 228 }

=====

I have very limited understanding how it was supposed to work , apart
from recognizing 16-bit long datatypes as function params ...

can you leave few words in source code explaining how it works?

>
>
> >
> > bugs meanwhile exist
> >
> > https://trac.ffmpeg.org/ticket/3345
> > https://trac.ffmpeg.org/ticket/7978
>
> I was not aware of these and ATM i dont have time but
> these smell like some constant somewhere is a little off
>
> thx
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> What does censorship reveal? It reveals fear. -- Julian Assange
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list