[SCM] libav/experimental: Original Commit: r36 | ods15 | 2006-09-23 08:43:09 +0300 (Sat, 23 Sep 2006) | 2 lines
siretart at users.alioth.debian.org
siretart at users.alioth.debian.org
Sun Jun 30 15:51:25 UTC 2013
The following commit has been merged in the experimental branch:
commit b9b040236e7c2f6f5e218fabcceea9f37d169894
Author: Oded Shimon <ods15 at ods15.dyndns.org>
Date: Mon Oct 2 05:56:18 2006 +0000
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
diff --git a/libavcodec/vorbis_enc.c b/libavcodec/vorbis_enc.c
index 3885709..aefc093 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;
}
--
Libav/FFmpeg packaging
More information about the pkg-multimedia-commits
mailing list