[Ffmpeg-cvslog] r5516 - trunk/libavcodec/flacenc.c

Justin Ruggles jruggle
Sun Jun 25 17:34:26 CEST 2006


michael wrote:
>  static void
>  write_utf8(PutBitContext *pb, uint32_t val)
>  {
> -    int i, bytes, mask, shift;
> -
> -    bytes = 1;
> -    if(val >= 0x80)      bytes++;
> -    if(val >= 0x800)     bytes++;
> -    if(val >= 0x10000)   bytes++;
> -    if(val >= 0x200000)  bytes++;
> -    if(val >= 0x4000000) bytes++;
> +    int bytes, shift;
>  
> -    if(bytes == 1) {
> +    if(val < 0x80){
>          put_bits(pb, 8, val);
>          return;
>      }
>  
> +    bytes= (av_log2(val)-1) / 5;
>      shift = (bytes - 1) * 6;
> -    mask = 0x80 + ((1 << 7) - (1 << (8 - bytes)));
> -    put_bits(pb, 8, mask | (val >> shift));
> -    for(i=0; i<bytes-1; i++) {
> +    put_bits(pb, 8, (256 - (256>>bytes)) | (val >> shift));
> +    while(shift >= 6){
>          shift -= 6;
>          put_bits(pb, 8, 0x80 | ((val >> shift) & 0x3F));
>      }

This portion breaks the FLAC files.  Here is a fix.  The regression test
is only 58 frames, so it worked fine before and is unaffected by this
change.

-Justin
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: utf8.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20060625/49fa52a1/attachment.txt>



More information about the ffmpeg-cvslog mailing list