[Ffmpeg-devel] swscale -- architecture ideas

Marc Hoffman mmh
Fri Apr 20 02:19:43 CEST 2007


Looking into the SwScaler....

What if we changed the context to contain the set of acceleration
routines much like what we have in dsputils. What this would mean is
we could probably get rid of a lot of the ifdefs and make it easier to
add new post processors backends.

I'm thinking all the functions that are called via RENAME(blah) would become something like 

c->sdsp.hscale (...)

And then we can call an architecture dependent init function that can
overide the C behavior much like is done for the dsputils.

typedef swsdspops {
...
  void (* hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW, int xInc,
		  int16_t *filter, int16_t *filterPos, long filterSize);

  void (* yuv2yuvX)  (SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
  void (* yuv2nv12X) (SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
  void (* yuv2yuv1)  (int16_t *lumSrc, int16_t *chrSrc,
...

...
} SwsDspOps;

Then we would define SwsContext


/* this struct should be aligned on at least 32-byte boundary */
typedef struct SwsContext{
        /**
         * info on struct for av_log
         */
        AVClass *av_class;

	/**
	 *
	 * Note the src,dst,srcStride,dstStride will be copied, in the sws_scale() warper so they can freely be modified here
	 */
	SwsFunc swScale;

	SwsDspOps *sdsp;
...


Anyways I'm thinking something like this might help organizing things
a bit. I'm sitting here on a stack of ifdef changes that represent the
Blackfin accelerator changes. And I think we might want to consider
this type of change or direction for the code base.

Thanks
Marc






More information about the ffmpeg-devel mailing list