vocenc: fix sample rate rounding direction

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-06-25 03:14:27 +02:00
parent f15803e957
commit bacbbd2b03
4 changed files with 16 additions and 16 deletions

View File

@ -64,13 +64,13 @@ static int voc_write_packet(AVFormatContext *s, AVPacket *pkt)
if (s->streams[0]->codec->channels > 1) {
avio_w8(pb, VOC_TYPE_EXTENDED);
avio_wl24(pb, 4);
avio_wl16(pb, 65536-256000000/(enc->sample_rate*enc->channels));
avio_wl16(pb, 65536-(256000000 + enc->sample_rate*enc->channels/2)/(enc->sample_rate*enc->channels));
avio_w8(pb, enc->codec_tag);
avio_w8(pb, enc->channels - 1);
}
avio_w8(pb, VOC_TYPE_VOICE_DATA);
avio_wl24(pb, pkt->size + 2);
avio_w8(pb, 256 - 1000000 / enc->sample_rate);
avio_w8(pb, 256 - (1000000 + enc->sample_rate/2) / enc->sample_rate);
avio_w8(pb, enc->codec_tag);
}
voc->param_written = 1;

View File

@ -1,3 +1,3 @@
5c4ee01048e7a8a138a97e80cf7a1924 *./tests/data/lavf/lavf.voc
e4cefbeb4c20f5735de1877fbcfd8d1d *./tests/data/lavf/lavf.voc
45261 ./tests/data/lavf/lavf.voc
./tests/data/lavf/lavf.voc CRC=0x74b2b546

View File

@ -1,3 +1,3 @@
8ed10b311e49b4d4b18679b126492159 *./tests/data/lavf/lavf.s16.voc
1d7be2b6527b76a33d2185ec6fb23f91 *./tests/data/lavf/lavf.s16.voc
180437 ./tests/data/lavf/lavf.s16.voc
./tests/data/lavf/lavf.s16.voc CRC=0x7bd585ff

View File

@ -1,27 +1,27 @@
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 1024
ret:-1 st:-1 flags:0 ts:-1.000000
ret:-1 st:-1 flags:1 ts: 1.894167
ret:-1 st: 0 flags:0 ts: 0.788335
ret:-1 st: 0 flags:1 ts:-0.317508
ret:-1 st: 0 flags:0 ts: 0.788330
ret:-1 st: 0 flags:1 ts:-0.317494
ret:-1 st:-1 flags:0 ts: 2.576668
ret:-1 st:-1 flags:1 ts: 1.470835
ret:-1 st: 0 flags:0 ts: 0.365006
ret:-1 st: 0 flags:1 ts:-0.740837
ret:-1 st: 0 flags:0 ts: 0.365012
ret:-1 st: 0 flags:1 ts:-0.740834
ret:-1 st:-1 flags:0 ts: 2.153336
ret:-1 st:-1 flags:1 ts: 1.047503
ret:-1 st: 0 flags:0 ts:-0.058323
ret:-1 st: 0 flags:1 ts: 2.835834
ret:-1 st: 0 flags:0 ts:-0.058328
ret:-1 st: 0 flags:1 ts: 2.835848
ret:-1 st:-1 flags:0 ts: 1.730004
ret:-1 st:-1 flags:1 ts: 0.624171
ret:-1 st: 0 flags:0 ts:-0.481652
ret:-1 st: 0 flags:1 ts: 2.412505
ret:-1 st: 0 flags:0 ts:-0.481669
ret:-1 st: 0 flags:1 ts: 2.412507
ret:-1 st:-1 flags:0 ts: 1.306672
ret:-1 st:-1 flags:1 ts: 0.200839
ret:-1 st: 0 flags:0 ts:-0.905003
ret:-1 st: 0 flags:1 ts: 1.989176
ret:-1 st: 0 flags:0 ts:-0.904986
ret:-1 st: 0 flags:1 ts: 1.989167
ret:-1 st:-1 flags:0 ts: 0.883340
ret:-1 st:-1 flags:1 ts:-0.222493
ret:-1 st: 0 flags:0 ts: 2.671668
ret:-1 st: 0 flags:1 ts: 1.565847
ret:-1 st: 0 flags:0 ts: 2.671673
ret:-1 st: 0 flags:1 ts: 1.565849
ret:-1 st:-1 flags:0 ts: 0.460008
ret:-1 st:-1 flags:1 ts:-0.645825