[Ffmpeg-devel] [PATCH] another vorbis optimization
Luca Barbato
lu_zero
Thu Aug 10 04:38:22 CEST 2006
Loren Merritt wrote:
> Now with optimized windowing too, for a total of 15% speedup.
Wonderful =)
> static int vorbis_parse_audio_packet(vorbis_context *vc) {
> GetBitContext *gb=&vc->gb;
> @@ -1490,6 +1507,7 @@
> uint_fast8_t res_num=0;
> int_fast16_t retlen=0;
> uint_fast16_t saved_start=0;
what about moving bias somewhere else (like in the vorbis_context) and
spare a branch?
> + int bias= (vc->dsp.float_to_int16 == ff_float_to_int16_c) ? 385 : 0;
>
> if (get_bits1(gb)) {
> av_log(vc->avccontext, AV_LOG_ERROR, "Not a Vorbis I audio packet.\n");
[...]
> saved_start=(vc->blocksize_1-vc->blocksize_0)/4;
> buf += vc->blocksize_1/2;
> - for(i=0;i<saved_start;++i) {
> - saved[i]=buf[i];
> + if(vc->dsp.float_to_int16 != ff_float_to_int16_c) {
as ugly as could be: what about having 2 bias values in the context:
scalar [385, 0], vector [0,(15<<23)] and spare some other branches?
> + for(i=0; i<saved_start; i++)
> + ((uint32_t*)saved)[i] = ((uint32_t*)buf)[i] + (15<<23);
> + } else {
> + for(i=0; i<saved_start; i++)
> + saved[i] = buf[i];
> }
[....]
> + int_fast32_t tmp = ((int32_t*)src)[i];
> + if(tmp & 0xf0000){
Is it really slower now?
> +// tmp = (0x43c0ffff - tmp)>>31; //ask gcc devs why this is slower
> + if(tmp > 0x43c0ffff) tmp = 0xFFFF;
> + else tmp = 0;
> + }
--
Luca Barbato
Gentoo/linux Gentoo/PPC
http://dev.gentoo.org/~lu_zero
More information about the ffmpeg-devel
mailing list