[FFmpeg-devel] [PATCH] Move param initialization and colorspace details from sws_getContext() to sws_init_context().

Michael Niedermayer michaelni
Sat Oct 2 18:23:51 CEST 2010


On Sat, Oct 02, 2010 at 01:24:03AM +0200, Stefano Sabatini wrote:
> On date Friday 2010-10-01 21:19:45 +0200, Stefano Sabatini encoded:
> > On date Thursday 2010-09-30 01:34:14 +0200, Michael Niedermayer encoded:
> > > On Thu, Sep 30, 2010 at 12:56:20AM +0200, Stefano Sabatini wrote:
> > > > On date Wednesday 2010-09-29 19:25:28 +0200, Michael Niedermayer encoded:
> > > > > On Wed, Sep 29, 2010 at 06:00:27PM +0200, Stefano Sabatini wrote:
> > > > > > Allow to automatically set the default parameters without explicitely
> > > > > > set them, also simplify conversion to the new sws_init_context() API.
> > > > > > ---
> > > > > >  utils.c |   18 +++++++-----------
> > > > > >  1 files changed, 7 insertions(+), 11 deletions(-)
> > > > > > 
> > > > > > diff --git a/utils.c b/utils.c
> > > > > > index 938af9e..bee5a3a 100644
> > > > > > --- a/utils.c
> > > > > > +++ b/utils.c
> > > > > > @@ -761,10 +761,17 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
> > > > > >      int dstW= c->dstW;
> > > > > >      int dstH= c->dstH;
> > > > > >      int flags;
> > > > > > +    c->srcRange = handle_jpeg(&c->srcFormat);
> > > > > > +    c->dstRange = handle_jpeg(&c->dstFormat);
> > > > > 
> > > > > that breaks user setted *Range
> > > > 
> > > > I'm aware but I cannot see a simpler way. A possibility would be to
> > > > introduce an hack external to this function, but then doesn't look
> > > > that good as well.
> > > > 
> > > > The problem is: how should the new API deal with JPEG colorspaces?
> > > > Currently when we want to use the JPEG colorspace we pass one of the
> > > > YUVJ* pixel formats. Avoiding this hack would mean to make the various
> > > > FFmpeg components (well, mainly codecs) explicitely define which
> > > > colorspace/range to use.
> > > 
> > > YUVJ* is deprecated
> > > so designing new code toward it doesnt feel very good at all
> > > 
> > > also i dont see a problem
> > > if YUVJ set Range appropriately
> > > if not dont touch Range and leave it at the default / what the usert did set
> > 
> > Currently this has to be done directly in the application (in this
> > case ffmpeg.c, right?), so I was thinking about creating a copy of
> > handle_jpeg(), which is ugly, while it should be duty of libavcodec to
> > do that, but I have yet to think which would be the better way.
> 
> More problems which should be addressed: libswscale only supports two
> values for the color range, 0 and 1, libavcodec uses an enum
> AVColorRange, so as the first thing libswscale should be updated
> (would this comport a major break?).

the enum also has just 2 values that matter (unspecified really is useless in
this context)


> 
> Then we should update all the libavcodec code which doesn't set
> adeguately the color_range.

yes

[...]]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101002/80e68ad0/attachment.pgp>



More information about the ffmpeg-devel mailing list