[FFmpeg-devel] Trans.: a64multienc.c and drawutils.c optimisations

Michael Niedermayer michaelni at gmx.at
Wed Dec 28 05:43:56 CET 2011


On Wed, Dec 28, 2011 at 04:35:04AM +0100, yann.lepetitcorps at free.fr wrote:
[...]
> 
> I have a make a new diff file that compile the majority of the needed
> corrections
> 
> PS : is better to add the last post at the beginning (we see instantly the
> lastest modification at the opening of the mail) or to add the last post at the
> end (the discusion is stored in the natural order) [cf. FIFO vs FILO order] ?

best is to replace irrelevant parts of the mail by [...]
and then place the reply interleaved under each relevant part


> 
> @+
> Yannoo

>  libavcodec/a64multienc.c |    5 ++-
>  libavcodec/adpcm.c       |    6 +++-
>  libavfilter/drawutils.c  |   59 +++++++++++++++++++++++++++++++++++++++++++++--
>  libavfilter/drawutils.h  |    6 ++++
>  4 files changed, 71 insertions(+), 5 deletions(-)
> 396c48e5a6bba9bb6bf3aa544436cb97f9dabfd7  ylp_28dec2011_04h02.diff
> diff --git a/libavcodec/a64multienc.c b/libavcodec/a64multienc.c
> index 5a665d0..3d04e62 100644
> --- a/libavcodec/a64multienc.c
> +++ b/libavcodec/a64multienc.c
> @@ -49,15 +49,16 @@ static void to_meta_with_crop(AVCodecContext *avctx, AVFrame *p, int *dest)
>      int height = FFMIN(avctx->height, C64YRES);
>      int width  = FFMIN(avctx->width , C64XRES);
>      uint8_t *src = p->data[0];
> +    uint8_t *src2;
>  
>      for (blocky = 0; blocky < C64YRES; blocky += 8) {
>          for (blockx = 0; blockx < C64XRES; blockx += 8) {
>              for (y = blocky; y < blocky + 8 && y < C64YRES; y++) {
> +                src2 = src + y * p->linesize[0];
>                  for (x = blockx; x < blockx + 8 && x < C64XRES; x += 2) {
>                      if(x < width && y < height) {
>                          /* build average over 2 pixels */
> -                        luma = (src[(x + 0 + y * p->linesize[0])] +
> -                                src[(x + 1 + y * p->linesize[0])]) / 2;
> +                        luma  = (src2[x] + src2[x+1]) / 2;
>                          /* write blocks as linear data now so they are suitable for elbg */
>                          dest[0] = luma;
>                      }
> diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
> index 688fba4..70715c9 100644
> --- a/libavcodec/adpcm.c
> +++ b/libavcodec/adpcm.c
> @@ -160,6 +160,8 @@ static inline short adpcm_ima_expand_nibble(ADPCMChannelStatus *c, char nibble,
>      return (short)c->predictor;
>  }
>  
> +int adpcm_nibble_diff_step_tab[8] = { 0, 4, 2, 6, 1, 3, 5, 7 };     
> +
>  static inline int adpcm_ima_qt_expand_nibble(ADPCMChannelStatus *c, int nibble, int shift)
>  {
>      int step_index;
> @@ -169,11 +171,13 @@ static inline int adpcm_ima_qt_expand_nibble(ADPCMChannelStatus *c, int nibble,
>      step = ff_adpcm_step_table[c->step_index];
>      step_index = c->step_index + ff_adpcm_index_table[nibble];
>      step_index = av_clip(step_index, 0, 88);
> -
> +/*
>      diff = step >> 3;
>      if (nibble & 4) diff += step;
>      if (nibble & 2) diff += step >> 1;
>      if (nibble & 1) diff += step >> 2;
> +*/
> +    diff =  (adpcm_nibble_diff_step_tab[nibble &0x7]+8) * step;

see adpcm_ima_expand_nibble()
one problem though is that this is not producing the same result

also it is best to send each self contained change in a seperate patch,
like 1 patch for the adpcm change and one patch for the drawutils.

also i suggest to configure your editor so it inserts spaces when you
hit the tab key and so that it removes trailing whitespace, both are
forbidden in ffmpeg git.

Thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Incandescent light bulbs waste a lot of energy as heat so the EU forbids them.
Their replacement, compact fluorescent lamps, much more expensive, dont fit in
many old lamps, flicker, contain toxic mercury, produce a fraction of the light
that is claimed and in a unnatural spectrum rendering colors different than
in natural light. Ah and we now need to turn the heaters up more in winter to
compensate the lower wasted heat. Who wins? Not the environment, thats for sure
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111228/47c67765/attachment.asc>


More information about the ffmpeg-devel mailing list