[Ffmpeg-cvslog] r5571 - trunk/libavcodec/flacenc.c
Justin Ruggles
jruggle
Sun Jul 2 16:36:35 CEST 2006
michael wrote:
> Author: michael
> Date: Sun Jul 2 11:30:51 2006
> New Revision: 5571
>
> Modified:
> trunk/libavcodec/flacenc.c
>
> Log:
> simplify
>
>
> Modified: trunk/libavcodec/flacenc.c
> ==============================================================================
> --- trunk/libavcodec/flacenc.c (original)
> +++ trunk/libavcodec/flacenc.c Sun Jul 2 11:30:51 2006
> @@ -301,20 +301,19 @@
> uint32_t sums[][256])
> {
> int i, j;
> - int parts, cnt;
> - uint32_t *res;
> + int parts;
> + uint32_t *res, *res_end;
>
> /* sums for highest level */
> parts = (1 << pmax);
> res = &data[pred_order];
> - cnt = (n >> pmax) - pred_order;
> + res_end = &data[n >> pmax];
> for(i=0; i<parts; i++) {
> - if(i == 1) cnt = (n >> pmax);
> - if(i > 0) res = &data[i*cnt];
> sums[pmax][i] = 0;
> - for(j=0; j<cnt; j++) {
> - sums[pmax][i] += res[j];
> + while(res < res_end){
> + sums[pmax][i] += *(res++);
> }
> + res_end+= n >> pmax;
> }
> /* sums for lower levels */
> for(i=pmax-1; i>=0; i--) {
> _______________________________________________
> ffmpeg-cvslog mailing list
> ffmpeg-cvslog at mplayerhq.hu
> http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-cvslog
>
Thanks! I always thought my solution there was quite ugly. I'm glad you
found a simpler one.
-Justin
More information about the ffmpeg-cvslog
mailing list