diff options
author | Oded Shimon <ods15@ods15.dyndns.org> | 2006-10-02 05:56:18 +0000 |
---|---|---|
committer | Oded Shimon <ods15@ods15.dyndns.org> | 2006-10-02 05:56:18 +0000 |
commit | b9b040236e7c2f6f5e218fabcceea9f37d169894 (patch) | |
tree | 3e3d7529729b190f83928ea55508b6651e19d1ad /libavcodec/vorbis_enc.c | |
parent | e3bbb5910f5996c8640a65d0b1034b7a5463438f (diff) | |
download | ffmpeg-b9b040236e7c2f6f5e218fabcceea9f37d169894.tar.gz |
Original Commit: r36 | ods15 | 2006-09-23 08:43:09 +0300 (Sat, 23 Sep 2006) | 2 lines
starting point for packet encode, writing floor
Originally committed as revision 6444 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vorbis_enc.c')
-rw-r--r-- | libavcodec/vorbis_enc.c | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/libavcodec/vorbis_enc.c b/libavcodec/vorbis_enc.c index 388570902c..aefc0935ef 100644 --- a/libavcodec/vorbis_enc.c +++ b/libavcodec/vorbis_enc.c @@ -589,14 +589,45 @@ static int vorbis_encode_init(AVCodecContext * avccontext) static int vorbis_encode_frame(AVCodecContext * avccontext, unsigned char * packets, int buf_size, void *data) { -#if 0 venc_context_t * venc = avccontext->priv_data; signed short * audio = data; int samples = data ? avccontext->frame_size : 0; + vorbis_mode_t * mode; + mapping_t * mapping; + PutBitContext pb; + int i; + + init_put_bits(&pb, packets, buf_size); + + put_bits(&pb, 1, 0); // magic bit + + put_bits(&pb, ilog(venc->nmodes - 1), 0); // 0 bits, the mode + + mode = &venc->modes[0]; + mapping = &venc->mappings[mode->mapping]; + if (mode->blockflag) { + put_bits(&pb, 1, 0); + put_bits(&pb, 1, 0); + } + + for (i = 0; i < venc->channels; i++) { + floor_t * fc = &venc->floors[mapping->floor[mapping->mux[i]]]; + int range = 255 / fc->multiplier + 1; + int j; + put_bits(&pb, 1, 1); // non zero + put_bits(&pb, ilog(range - 1), 113); // magic value - 3.7180282E-05 + put_bits(&pb, ilog(range - 1), 113); // both sides of X + for (j = 0; j < fc->partitions; j++) { + floor_class_t * c = &fc->classes[fc->partition_to_class[j]]; + codebook_t * book = &venc->codebooks[c->books[0]]; + int entry = 0; + int k; + for (k = 0; k < c->dim; k++) { + put_bits(&pb, book->entries[entry].len, book->entries[entry].codeword); + } + } + } - avccontext->coded_frame->pts = av_rescale_q(op2->granulepos, (AVRational){1, avccontext->sample_rate}, avccontext->time_base); - memcpy(packets, compressed_frame, l); -#endif return data ? 50 : 0; } |