[FFmpeg-cvslog] r15331 - in trunk: libavcodec/flacenc.c tests/ffmpeg.regression.ref tests/rotozoom.regression.ref

jbr subversion
Mon Sep 15 00:25:50 CEST 2008


Author: jbr
Date: Mon Sep 15 00:25:50 2008
New Revision: 15331

Log:
write actual min and max frame size to FLAC header. update regression test checksum.

Modified:
   trunk/libavcodec/flacenc.c
   trunk/tests/ffmpeg.regression.ref
   trunk/tests/rotozoom.regression.ref

Modified: trunk/libavcodec/flacenc.c
==============================================================================
--- trunk/libavcodec/flacenc.c	(original)
+++ trunk/libavcodec/flacenc.c	Mon Sep 15 00:25:50 2008
@@ -95,7 +95,10 @@ typedef struct FlacEncodeContext {
     int ch_code;
     int samplerate;
     int sr_code[2];
+    int min_framesize;
+    int min_encoded_framesize;
     int max_framesize;
+    int max_encoded_framesize;
     uint32_t frame_count;
     uint64_t sample_count;
     uint8_t md5sum[16];
@@ -133,7 +136,7 @@ static void write_streaminfo(FlacEncodeC
     /* streaminfo metadata block */
     put_bits(&pb, 16, s->avctx->frame_size);
     put_bits(&pb, 16, s->avctx->frame_size);
-    put_bits(&pb, 24, 0);
+    put_bits(&pb, 24, s->min_framesize);
     put_bits(&pb, 24, s->max_framesize);
     put_bits(&pb, 20, s->samplerate);
     put_bits(&pb, 3, s->channels-1);
@@ -374,6 +377,7 @@ static av_cold int flac_encode_init(AVCo
     } else {
         s->max_framesize = 14 + (s->avctx->frame_size * s->channels * 2);
     }
+    s->min_encoded_framesize = 0xFFFFFF;
 
     /* initialize MD5 context */
     s->md5ctx = av_malloc(av_md5_size);
@@ -1278,6 +1282,8 @@ static int flac_encode_frame(AVCodecCont
 
     /* when the last block is reached, update the header in extradata */
     if (!data) {
+        s->min_framesize = s->min_encoded_framesize;
+        s->max_framesize = s->max_encoded_framesize;
         av_md5_final(s->md5ctx, s->md5sum);
         write_streaminfo(s, avctx->extradata);
         return 0;
@@ -1318,6 +1324,10 @@ write_frame:
     s->frame_count++;
     s->sample_count += avctx->frame_size;
     update_md5_sum(s, samples);
+    if (out_bytes > s->max_encoded_framesize)
+        s->max_encoded_framesize = out_bytes;
+    if (out_bytes < s->min_encoded_framesize)
+        s->min_encoded_framesize = out_bytes;
 
     return out_bytes;
 }

Modified: trunk/tests/ffmpeg.regression.ref
==============================================================================
--- trunk/tests/ffmpeg.regression.ref	(original)
+++ trunk/tests/ffmpeg.regression.ref	Mon Sep 15 00:25:50 2008
@@ -201,7 +201,7 @@ de1122d20d56c44cf49f028e25a67788 *./test
 267073 ./tests/data/a-adpcm_swf.flv
 e48b800e2d9be6afcd430d4f08a34eb6 *./tests/data/adpcm_swf.vsynth.out.wav
 stddev:  934.28 PSNR: 36.91 bytes:  1056812/  1058444
-10a8bf5796004b150c7aed115cbafef5 *./tests/data/a-flac.flac
+7781a016edfc242a39e4d65af02d861a *./tests/data/a-flac.flac
 353368 ./tests/data/a-flac.flac
 95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/flac.vsynth.out.wav
 stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444

Modified: trunk/tests/rotozoom.regression.ref
==============================================================================
--- trunk/tests/rotozoom.regression.ref	(original)
+++ trunk/tests/rotozoom.regression.ref	Mon Sep 15 00:25:50 2008
@@ -201,7 +201,7 @@ de1122d20d56c44cf49f028e25a67788 *./test
 267073 ./tests/data/a-adpcm_swf.flv
 e48b800e2d9be6afcd430d4f08a34eb6 *./tests/data/adpcm_swf.rotozoom.out.wav
 stddev:  934.28 PSNR: 36.91 bytes:  1056812/  1058444
-10a8bf5796004b150c7aed115cbafef5 *./tests/data/a-flac.flac
+7781a016edfc242a39e4d65af02d861a *./tests/data/a-flac.flac
 353368 ./tests/data/a-flac.flac
 95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/flac.rotozoom.out.wav
 stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444




More information about the ffmpeg-cvslog mailing list