[FFmpeg-devel] snowenc.c

yann.lepetitcorps at free.fr yann.lepetitcorps at free.fr
Mon Jan 9 22:48:51 CET 2012


> > I see this into the libavcodec/snowenc.c :
> >
> > //near copy & paste from dsputil, FIXME
> > static int pix_sum(uint8_t * pix, int line_size, int w)

[...]

> > And is this used for make the sum of values of a w*w quad started on the
> > pixel
> > pointed by pix ?
>
> yes

Yeah, I'm happy to have found this myself :)

Heu .. this can perhaps to be renamed to something like
pix_sum_square_area(uint8_t * pix, int
line_size, int size) for to be more clear about what it make exactly ?



> > In this case, why not using a w*h **rectangular** quad instead a **square**
> w*w
> > quad ?
>
> > (this is more generic, so can be certainly reused in more places)
>
> where can it be reused ?

This can be reused for to precompute the total energy present in a given
pictore/video area for example ...
(this type of calculation is certainly used in a lot of picture/video
compression formats)

Cf. we precompute the 2D integrale F(x,Y) of the picture f(x,y) and after we can
very speedly compute the energy stored into one random rectangular area
(x0,y0)-(x1,y1) with only a substraction F(x1,y1) - F(x0, y0)
(it's why I say about about the additionnal h parameter for to handle the y0
and y1 values ...)

Something like this but where alls values of F0 and F1 are already precomputed

  F0 = ff_pix_sum_rect_area(pix, line_size, x0, y0);
  F1 = ff_pix_sum_rect_area(pix, line_size, x1, y1);

  total_energy_of_rect_area = F1 -F0;


> Note, if you just want to work on something and dont know what.
> Please see our bug tracker (http://ffmpeg.org/trac/ffmpeg or
> http://wiki.multimedia.cx/index.php?title=Small_FFmpeg_Tasks)


I know exactly what I want ... a super mega speed and hyper powered API that can
 handle a lot of audio/video file formats on a lot of differents platform and
that have the possibility to convert/transform/make specials effects on top of
this :)

And the FFMPEG seem to be a very very good API for to make this ...

More seriously, I prefer to work about things such as globals/locals
optimisations (more for the speed than for the size), make the API more easy to
understand/use and adding additionnals options/paths

For example, the h parameter can be used for to be able to compute independantly
the total energy  for the odd and even lines with something like this :


int pix_sum_rect_area_even_field(uint8_t * pix, int line_size, int w, int h)
{
   return ff_pix_sum_rect_area(pix, line_size*2, w, h/2);
}

int pix_sum_rect_area_odd_field(uint8_t * pix, int line_size, int w, int h)
{
   return ff_pix_sum_rect_area(pix+line_size, line_size*2, w, h/2);
}


> Thanks
>
> [...]

A lot of thanks for your attention/help


@+
Yannoo


More information about the ffmpeg-devel mailing list