[Ffmpeg-devel] [RFC] RGB48 support

Michael Niedermayer michaelni
Wed Apr 11 13:23:08 CEST 2007


Hi

On Wed, Apr 11, 2007 at 01:03:56PM +0200, Ivo wrote:
> Hi,
> 
> On Tuesday 10 April 2007 23:13, Michael Niedermayer wrote:
> > On Tue, Apr 10, 2007 at 06:15:35PM +0200, Ivo wrote:
> > > I noticed several lines of:
> > >
> > > src2= formatConvBuffer+2048;
> > >
> > > in swscale_template.c. If I understand the code correctly, this
> > > constant is arbitrarily chosen and swscale will fail if you feed it
> > > very large images (like an 8k 70mm film scan). Is that correct?
> >
> > yes, the 2048 stuff should be changed to a #defined constant (or variable
> > but that will be more difficult and likely somewhat slower, so constant
> > is better)
> 
> I think a variable would be preferable, unless the speed penalty is really 
> noticable. 

a 0.1% speed loss is ok, more needs strong justifications, please keep
in mind not a single person ever complaint about this limitation (its rather
that you found it by RTFS not by failure to scale a image)


> Otherwise, what constant should we choose? 

the user can choose ...


[...]

> 
> > did you test the yuv2rgb.c code ?
> 
> Yes, I converted several yuv sources to rgb48, outputted the raw data, 
> prepended a PPM P6 header with dd and viewed the result :)  

and was the yuv2rgb.c code actually used in that convtion? 


> Do you see 
> something wrong with the code?

ill take a look again but IIRC it looks odd but i might be wrong ...


[...]
> > > +static inline void RENAME(rgb48to48)(const uint8_t *src, uint8_t *dst,
> > > long src_size) +{
> > > +    uint8_t *d = dst, *s = (uint8_t *) src;
> > > +    const uint8_t *end = s + src_size;
> > > +
> > > +    for (; s<end; s+=2, d+=2) {
> > > +        *d     = *(s+1);
> > > +        *(d+1) = *s;
> > > +    }
> > > +}
> >
> > hmm try:
> > unsigned int a= *(uint32_t*)s;
> > *(uint32_t*)d= ((a>>8)&0x00FF00FF) + ((a<<8)&0xFF00FF00);
> 
> I suppose that can overread the buffer by 2 bytes or are the buffers 
> required to be over-malloced and have enough room at the end?

well you can handle the last pixel differently if you want


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070411/eecfbbd5/attachment.pgp>



More information about the ffmpeg-devel mailing list