FFmpeg-soc
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
June 2010
- 16 participants
- 56 discussions
Hi guys,
Here is the depacketizer for SVQ3 that Ronald wrote some time ago. To
test, you'll need to disable audio until we get QDM2 merged -- thanks
Martin for the tip. (s1->skip_media = 1; return; in line 272 of
rtsp.c, and add "-an" to your ffmpeg/ffplay parameters).
I also updated the Changelog entry with a reference to RTSP-HTTP.
Josh
5
18
Author: mchinen
Date: Thu Jul 1 01:27:39 2010
New Revision: 5846
Log:
add saving and loading of index table to/from files.
depends on the moving_put_v_r23915.patch submitted earlier today.
Added:
seek2010/seek2010_06_30_r23915.patch
Added: seek2010/seek2010_06_30_r23915.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ seek2010/seek2010_06_30_r23915.patch Thu Jul 1 01:27:39 2010 (r5846)
@@ -0,0 +1,535 @@
+Index: libavformat/avformat.h
+===================================================================
+--- libavformat/avformat.h (revision 23915)
++++ libavformat/avformat.h (working copy)
+@@ -531,6 +531,16 @@
+ * Number of frames that have been demuxed during av_find_stream_info()
+ */
+ int codec_info_nb_frames;
++
++ /* new av_seek_frame_table() support */
++#define AV_SEEKTABLE_BUILDING 0x0001 ///< a flag set by av_build_index to mark that the index is being built
++#define AV_SEEKTABLE_CBR 0x0002 ///< a flag set by av_build_index to note that the file is constant bit rate
++#define AV_SEEKTABLE_FINISHED 0x0004 ///< a flag set by av_build_index to note that the complete index table is ready to use
++#define AV_SEEKTABLE_COPIED 0x0008 ///< a flag to note that the seek table has been copied.
++ int seek_table_flags;
++ AVIndexEntry* parallel_index_entries; ///used with AV_BUILD_INDEX_PARALLEL. should not be touched by client
++ int parallel_nb_index_entries;
++ unsigned int parallel_index_entries_allocated_size;
+ } AVStream;
+
+ #define AV_PROGRAM_RUNNING 1
+@@ -1129,6 +1139,36 @@
+ int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags);
+
+ /**
++ * Gets the index for a specific timestamp using the table.
++ * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond
++ * to the timestamp which is <= the requested one, if backward
++ * is 0, then it will be >=
++ * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise
++ * @return < 0 if no such timestamp could be found
++ */
++int av_table_search_timestamp(AVStream *st, int64_t wanted_timestamp, int flags);
++
++/**
++ * Builds a complete index for seeking in each stream where it is possible.
++ * Requires that the streams have been opened.
++ * Part of the new seeking api. incomplete.
++ */
++int av_build_index(AVFormatContext *s, int flags);
++#define AV_BUILD_INDEX_PARALLEL 0x0001 ///< Builds the index via a copied demuxer streams. av_build_index with this flag can be called on a seperate thread while decoding is happening on another.
++
++/**
++ * Saves the index table built with av_build_index to a file
++ * Returns 0 if succesful or a negative value on failure.
++ */
++int av_save_index_file(AVFormatContext *ic, const char *filename);
++
++/**
++ * Loads the index saved with av_save_index.
++ * Returns 0 if successful or a negative value on failure.
++ */
++int av_load_index_file(AVFormatContext *ic, const char *filename);
++
++/**
+ * Ensure the index uses less memory than the maximum specified in
+ * AVFormatContext.max_index_size by discarding entries if it grows
+ * too large.
+@@ -1147,6 +1187,15 @@
+ int size, int distance, int flags);
+
+ /**
++ * Perform a dictionary search on the seek table.
++ * av_build_index must be successfully called before using this function.
++ * @param timestamp target timestamp in the time base of the given stream
++ * @param stream_index stream number
++ */
++int av_seek_frame_table(AVFormatContext *s,
++ int stream_index, int64_t timestamp, int flags);
++
++/**
+ * Perform a binary search using av_index_search_timestamp() and
+ * AVCodec.read_timestamp().
+ * This is not supposed to be called directly by a user application,
+Index: libavformat/utils.c
+===================================================================
+--- libavformat/utils.c (revision 23915)
++++ libavformat/utils.c (working copy)
+@@ -1031,7 +1031,6 @@
+ pkt->convergence_duration = pc->convergence_duration;
+ }
+
+-
+ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
+ {
+ AVStream *st;
+@@ -1355,21 +1354,28 @@
+
+ st->index_entries= entries;
+
+- index= av_index_search_timestamp(st, timestamp, AVSEEK_FLAG_ANY);
++ //if we are building the table, the indicies added in order, so we don't have to do expensive searching.
++ if(st->seek_table_flags & AV_SEEKTABLE_BUILDING) {
++ index = st->nb_index_entries++;
++ ie = &st->index_entries[index];
++ }
++ else {
++ index= av_index_search_timestamp(st, timestamp, AVSEEK_FLAG_ANY);
+
+- if(index<0){
+- index= st->nb_index_entries++;
+- ie= &entries[index];
+- assert(index==0 || ie[-1].timestamp < timestamp);
+- }else{
+- ie= &entries[index];
+- if(ie->timestamp != timestamp){
+- if(ie->timestamp <= timestamp)
+- return -1;
+- memmove(entries + index + 1, entries + index, sizeof(AVIndexEntry)*(st->nb_index_entries - index));
+- st->nb_index_entries++;
+- }else if(ie->pos == pos && distance < ie->min_distance) //do not reduce the distance
+- distance= ie->min_distance;
++ if(index<0){
++ index= st->nb_index_entries++;
++ ie= &entries[index];
++ assert(index==0 || ie[-1].timestamp < timestamp);
++ }else{
++ ie= &entries[index];
++ if(ie->timestamp != timestamp){
++ if(ie->timestamp <= timestamp)
++ return -1;
++ memmove(entries + index + 1, entries + index, sizeof(AVIndexEntry)*(st->nb_index_entries - index));
++ st->nb_index_entries++;
++ }else if(ie->pos == pos && distance < ie->min_distance) //do not reduce the distance
++ distance= ie->min_distance;
++ }
+ }
+
+ ie->pos = pos;
+@@ -1705,6 +1711,11 @@
+ timestamp = av_rescale(timestamp, st->time_base.den, AV_TIME_BASE * (int64_t)st->time_base.num);
+ }
+
++ /* if we've built a seek table, use it. */
++ st = s->streams[stream_index];
++ if (st->seek_table_flags & AV_SEEKTABLE_FINISHED)
++ return av_seek_frame_table(s, stream_index, timestamp, flags);
++
+ /* first, we try the format specific seek */
+ if (s->iformat->read_seek)
+ ret = s->iformat->read_seek(s, stream_index, timestamp, flags);
+@@ -1742,6 +1753,362 @@
+ // try some generic seek like av_seek_frame_generic() but with new ts semantics
+ }
+
++int av_seek_frame_table(AVFormatContext *s,
++ int stream_index, int64_t timestamp, int flags)
++{
++ int index;
++ int64_t ret;
++ AVStream *st;
++ AVIndexEntry *ie;
++
++ st = s->streams[stream_index];
++
++ //TODO: see if we can do something with the CBR field.
++ if(st->seek_table_flags & AV_SEEKTABLE_CBR){
++ ;
++ }
++
++ //see if we need to move the parallel table over
++ if(st->parallel_index_entries) {
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: copying over parallel frames\n");
++ av_free(st->index_entries);
++ st->index_entries = st->parallel_index_entries;
++ st->nb_index_entries = st->parallel_nb_index_entries;
++ st->index_entries_allocated_size = st->parallel_index_entries_allocated_size;
++ st->parallel_index_entries = NULL;
++ }
++
++ index = av_index_search_timestamp(st, timestamp, flags);
++
++ /* this function should only be called after the table is complete. */
++ if(index < 0 || index >= st->nb_index_entries-1){
++ return -1;
++ }
++
++ ff_read_frame_flush(s);
++ /* we use the native seek function if it exists, (still have to modify them to use seek_table) */
++ if (s->iformat->read_seek){
++ if(s->iformat->read_seek(s, stream_index, timestamp, flags) >= 0) {
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: table seeked using native function\n");
++ return 0;
++ }
++ }
++
++ ie = &st->index_entries[index];
++ if ((ret = url_fseek(s->pb, ie->pos, SEEK_SET)) < 0)
++ return ret;
++ av_update_cur_dts(s, st, ie->timestamp);
++
++ {
++ float request_time = (((float)timestamp/st->time_base.den)*st->time_base.num);
++ float actual_time = (((float)ie->timestamp/st->time_base.den)*st->time_base.num);
++ float time_base_inv = ((float)st->time_base.den/st->time_base.num);
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: table seeked to %.2fs (actual request was %.2fs), timebaseinv %f, samplerate of %d\n",actual_time, request_time, time_base_inv, st->codec->sample_rate );
++ }
++ return 0;
++}
++
++/**
++ * Starts building a index for seeking.
++ * TODO: use a different file pointer so we can do this in a thread-safe manner,
++ * as there are cases when the user will want to playback while building the index
++ **/
++int av_build_index(AVFormatContext *s, int flags)
++{
++ AVStream *st;
++ int ret;
++ int stream_index;
++ int i;
++ int orig_flags;
++
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: starting building index\n");
++ stream_index = av_find_default_stream_index(s);
++ if(stream_index < 0)
++ return -1;
++
++ st = s->streams[stream_index];
++ /* TODO: check if this stream is CBR and the codec has a seek by timestamp. */
++ /* if this is true then we can set a flag and exit here. */
++ if(0) {
++ st->seek_table_flags |= AV_SEEKTABLE_CBR;
++ } else if(0) {
++ /* TODO: for this case see if we have a special method for generating the table */
++ /* specific to a given format. */
++ } else if(st->nb_frames!=0 && st->nb_index_entries > st->nb_frames/2) {
++ /* some demuxers load a complete index upon file open. */
++ st->seek_table_flags |= AV_SEEKTABLE_COPIED;
++ } else {
++ AVFormatContext *build_ic;
++ AVPacket pkt;
++
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: building index from scratch\n");
++
++ /* if the client needs it to be threadsafe, create a new format context to read from. */
++ if(flags & AV_BUILD_INDEX_PARALLEL) {
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: making thread-safe copy of streams\n");
++ build_ic = avformat_alloc_context();
++ ret = av_open_input_file(&build_ic, s->filename, s->iformat, 0, NULL);
++
++ if(ret < 0) {
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: error re-opening file/streams: %i\n", ret);
++ goto cleanup;
++ }
++ if(build_ic->nb_streams != s->nb_streams) {
++ ret = -1;
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: cloned AVFormatContext has different number of streams!");
++ goto cleanup;
++ }
++
++ for(i = 0; i < build_ic->nb_streams; i++) {
++ AVStream *build_st= build_ic->streams[i];
++ AVCodecContext *avctx = build_st->codec;
++ AVCodec *pcodec;
++ build_ic->streams[i]->discard = AVDISCARD_DEFAULT;
++
++ //compare with the orignal stream's context, and if opened, copy settings and open the clone
++ if(s->streams[i]->codec->priv_data) {
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: copying stream based on priv_data\n");
++ if((ret = avcodec_copy_context(avctx, s->streams[i]->codec)) < 0) {
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: error copying codec:%i\n", ret);
++ goto cleanup;
++ }
++ pcodec = avcodec_find_decoder(avctx->codec_id);
++ if((ret = avcodec_open(avctx,pcodec)) < 0) {
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: error opening codec:%i\n", ret);
++ goto cleanup;
++ }
++ }
++ }
++ } else {
++ build_ic = s;
++ }
++
++ /* default table generation behavior from av_seek_frame_generic */
++ /* TODO: see why s->data_offset is the file length for avi/mp4 and others */
++ if ((ret = url_fseek(build_ic->pb, 0/*s->data_offset*/, SEEK_SET)) < 0){
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: error building index: %i\n", ret);
++ goto cleanup;
++ }
++
++ orig_flags = build_ic->flags;
++ build_ic->flags |= AVFMT_FLAG_GENPTS;
++ for(i=0;; i++) {
++ do{
++ ret = av_read_frame(build_ic, &pkt);
++ }while(ret == AVERROR(EAGAIN));
++ if(ret<0)
++ break;
++ av_free_packet(&pkt);
++ }
++ build_ic->flags = orig_flags;
++ ret = 0;
++ cleanup:
++ if(flags & AV_BUILD_INDEX_PARALLEL) {
++ //TODO: delay/wait till the main index signals us that we are okay to swap
++ if(build_ic) {
++ //take the index over from our clone
++ for(i = 0; i < build_ic->nb_streams; i++) {
++ if(ret >= 0) {
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: marking %i frames from parallel stream ready for copy\n", build_ic->streams[i]->nb_index_entries);
++ s->streams[i]->parallel_index_entries = build_ic->streams[i]->index_entries;
++ s->streams[i]->parallel_nb_index_entries = build_ic->streams[i]->nb_index_entries;
++ s->streams[i]->parallel_index_entries_allocated_size = build_ic->streams[i]->index_entries_allocated_size;
++ build_ic->streams[i]->index_entries = NULL;
++ s->streams[i]->seek_table_flags |= AV_SEEKTABLE_FINISHED;
++ }
++ avcodec_close(build_ic->streams[i]->codec);
++ }
++ av_close_input_file(build_ic);
++ }
++ }
++ if(ret < 0)
++ return ret;
++ }
++
++ /* since we may have moved the read cursor to the end, return seek to start of stream for non-parallel clients. Not sure if this the desired behavior. */
++ if( !(flags & AV_BUILD_INDEX_PARALLEL) && !(st->seek_table_flags & AV_SEEKTABLE_COPIED) ) {
++ ff_read_frame_flush(s);
++ for(i=0; i<s->nb_streams;i++)
++ if(s->streams[i]->nb_index_entries)
++ s->streams[i]->seek_table_flags |= AV_SEEKTABLE_FINISHED;
++ if( (ret = av_seek_frame(s, stream_index, st->start_time, 0) ) < 0 ) {
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: finished building index but error seeking: %i,trying url_fseek\n", ret);
++ /* last ditch effort to seek using the file pointer. */
++ if ((ret = url_fseek(s->pb, 0, SEEK_SET)) < 0) {
++ av_log(s,AV_LOG_DEBUG,"SEEK_TABLE_DEBUG: error seeking with url_fseek: %i\n", ret);
++ return ret;
++ }
++ }
++ }
++ av_log(s, AV_LOG_DEBUG, "SEEK_TABLE_DEBUG: finished building index\n");
++ return 0;
++}
++
++/**
++ * Save the flags, size, and differences for the index table
++ */
++#define AV_SAVEINDEX_PACKETSIZE 1000
++static int av_save_index_stream(ByteIOContext *bc, AVStream *st) {
++ AVIndexEntry start_ie;
++ AVIndexEntry *last_ie, *curr_ie;
++ int i;
++
++ //we may need to save something like codec id to be safe.
++ put_v(bc, st->seek_table_flags);
++ //we only write the index if we have a finished table.
++ if(st->seek_table_flags & AV_SEEKTABLE_FINISHED) {
++ put_v(bc, st->nb_index_entries);
++
++ memset(&start_ie, 0, sizeof(AVIndexEntry));
++ last_ie = &start_ie;
++ for(i = 0; i < st->nb_index_entries; i++) {
++ curr_ie = &st->index_entries[i];
++ put_v(bc, curr_ie->pos - last_ie->pos);
++ put_v(bc, curr_ie->timestamp - last_ie->timestamp);
++ put_v(bc, curr_ie->flags - last_ie->pos);
++ put_v(bc, curr_ie->size - last_ie->size);
++ put_v(bc, curr_ie->min_distance - last_ie->min_distance);
++ last_ie = curr_ie;
++ if(i % AV_SAVEINDEX_PACKETSIZE == 0)
++ put_flush_packet(bc);
++ }
++ av_log(NULL, AV_LOG_DEBUG, "successfully wrote index stream with %i entries.\n", st->nb_index_entries);
++ }
++ put_flush_packet(bc);
++
++ return 0;
++}
++
++/**
++ * load the flags, size, and differences for the index table
++ */
++static int av_load_index_stream(ByteIOContext *bc, AVStream *st) {
++ AVIndexEntry *ie, *last_ie;
++ uint64_t v;
++
++ //check to see if we have a table saved in this stream.
++ v = ff_get_v(bc);
++ if(v & AV_SEEKTABLE_FINISHED) {
++ st->seek_table_flags = v;
++ st->nb_index_entries = v = ff_get_v(bc);
++
++ //dump the old index and make the new one.
++ av_free(st->index_entries);
++ st->index_entries = av_malloc(v * sizeof(AVIndexEntry));
++
++ //the first index entry is not a diff, so it gets special treatment.
++ ie = st->index_entries;
++ if(v--) {
++ ie->pos = ff_get_v(bc);
++ ie->timestamp = ff_get_v(bc);
++ ie->flags = ff_get_v(bc);
++ ie->size = ff_get_v(bc);
++ ie->min_distance = ff_get_v(bc);
++ last_ie = ie;
++ ie++;
++ }
++
++ while(v--) {
++ ie->pos = ff_get_v(bc) + last_ie->pos;
++ ie->timestamp = ff_get_v(bc) + last_ie->timestamp;
++ ie->flags = ff_get_v(bc) + last_ie->flags;
++ ie->size = ff_get_v(bc) + last_ie->size;
++ ie->min_distance = ff_get_v(bc) + last_ie->min_distance;
++ last_ie = ie;
++ ie++;
++ }
++ av_log(NULL, AV_LOG_DEBUG, "successfully loaded index stream with %i entries.\n", st->nb_index_entries);
++ }
++ return 0;
++}
++
++/**
++ * Saves the table index built with av_build_index to a file.
++ * Returns 0 if successful, or a negative number if not.
++ * this is not mean to be human-readable
++ * we save the following things in order:
++ * - A strz "FFmpegTableIndex" (17 bytes)
++ * - The libavformat version number
++ * - The file name (null terminated)
++ * - the number of streams (4 bytes)
++ * - each of the streams' index tables via av_save_index_stream
++ */
++#define AV_INDEX_IDENTIFIER "FFmpegTableIndex"
++#define AV_INDEX_NOFILENAME "nofilename"
++static int av_save_index(ByteIOContext *bc, AVFormatContext *ic) {
++ int i, ret;
++
++ put_strz(bc, AV_INDEX_IDENTIFIER);
++ put_v(bc, LIBAVFORMAT_VERSION_INT);
++ put_strz(bc, ic->filename?ic->filename:AV_INDEX_NOFILENAME);
++ put_v(bc, ic->nb_streams);
++ for(i = 0; i< ic->nb_streams; i++) {
++ ret = av_save_index_stream(bc, ic->streams[i]);
++ if(ret < 0)
++ return ret;
++ }
++ put_flush_packet(bc);
++ av_log(ic, AV_LOG_DEBUG, "successfully wrote index.\n");
++ return 0;
++}
++
++static int av_load_index(ByteIOContext *bc, AVFormatContext *ic) {
++ int i, ret;
++ uint64_t v;
++ char read_str[256];
++
++ get_strz(bc, read_str, 255);
++ if( strcmp(read_str, AV_INDEX_IDENTIFIER) )
++ return -1;
++ //version
++ v = ff_get_v(bc);
++ //make sure the filename matches the context we will write to.
++ get_strz(bc, read_str, 255);
++ if( strlen(read_str) < 255 && strcmp(read_str, ic->filename) && strcmp(read_str, AV_INDEX_NOFILENAME) )
++ return -1;
++
++ v = ff_get_v(bc);
++ if( v != ic->nb_streams)
++ return -1;
++ for(i =0; i<v; i++) {
++ ret = av_load_index_stream(bc, ic->streams[i]);
++ if(ret < 0)
++ return ret;
++ }
++ av_log(ic, AV_LOG_DEBUG, "successfully read index.\n");
++ return 0;
++}
++
++int av_save_index_file(AVFormatContext *ic, const char* filename) {
++ ByteIOContext* bc;
++ int i, ret, table_completed = 0;
++
++ //do a first pass to see if we have any tables that need saving.
++ //only write the file if it exists.
++ for(i = 0; i< ic->nb_streams; i++)
++ table_completed |= ic->streams[i]->seek_table_flags & AV_SEEKTABLE_FINISHED;
++ if(!table_completed)
++ return -1;
++
++ if ((ret=url_fopen(&bc, filename, URL_WRONLY)) < 0) {
++ return -1;
++ }
++ ret = av_save_index(bc, ic);
++ url_fclose(bc);
++ return ret;
++}
++
++int av_load_index_file(AVFormatContext *ic, const char* filename) {
++ ByteIOContext* bc;
++ int ret;
++
++ if ((ret=url_fopen(&bc, filename, URL_RDONLY)) < 0) {
++ return -1;
++ }
++ ret = av_load_index(bc, ic);
++ url_fclose(bc);
++ return ret;
++}
+ /*******************************************************/
+
+ /**
+Index: ffplay.c
+===================================================================
+--- ffplay.c (revision 23915)
++++ ffplay.c (working copy)
+@@ -2389,6 +2389,7 @@
+ AVFormatParameters params, *ap = ¶ms;
+ int eof=0;
+ int pkt_in_play_range = 0;
++ char *index_filename = NULL;
+
+ ic = avformat_alloc_context();
+
+@@ -2505,6 +2506,18 @@
+ goto fail;
+ }
+
++ if(ic->filename){
++ index_filename = av_malloc(strlen(ic->filename) + 5);
++ strcpy(index_filename, ic->filename);
++ strcat(index_filename, ".fdx");
++ }
++
++ if (av_load_index_file(ic, index_filename) < 0 ) {
++ av_build_index(ic, 0); //AV_BUILD_INDEX_PARALLEL);
++ av_save_index_file(ic, index_filename);
++ }
++ av_free(index_filename);
++
+ for(;;) {
+ if (is->abort_request)
+ break;
1
0
Author: mchinen
Date: Wed Jun 30 12:42:38 2010
New Revision: 5845
Log:
removing extra newline from proposed patch.
Modified:
seek2010/moving_put_v_r23893.patch
Modified: seek2010/moving_put_v_r23893.patch
==============================================================================
--- seek2010/moving_put_v_r23893.patch Wed Jun 30 02:35:26 2010 (r5844)
+++ seek2010/moving_put_v_r23893.patch Wed Jun 30 12:42:38 2010 (r5845)
@@ -20,7 +20,7 @@ Index: libavformat/aviobuf.c
===================================================================
--- libavformat/aviobuf.c (revision 23893)
+++ libavformat/aviobuf.c (working copy)
-@@ -284,6 +284,28 @@
+@@ -284,6 +284,27 @@
put_byte(s, val);
}
@@ -45,7 +45,6 @@ Index: libavformat/aviobuf.c
+ put_byte(bc, val&127);
+}
+
-+
void put_tag(ByteIOContext *s, const char *tag)
{
while (*tag) {
1
0
Author: mchinen
Date: Wed Jun 30 02:35:26 2010
New Revision: 5844
Log:
Moving put_v and get_length (which put_v uses) to aviobuf.c and avio.h as public functions.
put_v used to be static in nutenc.c, but it is a general purpose tool that can be useful for saving the index table to a file.
get_length is also made public because it is used within nutenc.c as well.
Unlike my previous patch commits, I hope this one can be reviewed and commited soon since it is independent of seeking api changes.
Patch is against most current revision (23893)
Added:
seek2010/moving_put_v_r23893.patch
Added: seek2010/moving_put_v_r23893.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ seek2010/moving_put_v_r23893.patch Wed Jun 30 02:35:26 2010 (r5844)
@@ -0,0 +1,83 @@
+Index: libavformat/avio.h
+===================================================================
+--- libavformat/avio.h (revision 23893)
++++ libavformat/avio.h (working copy)
+@@ -348,8 +348,12 @@
+ void put_tag(ByteIOContext *s, const char *tag);
+
+ void put_strz(ByteIOContext *s, const char *buf);
+-
++void put_v(ByteIOContext *bc, uint64_t val);
+ /**
++ * Gets the length in bytes which is needed to store val as v.
++ */
++int get_length(uint64_t val);
++/**
+ * fseek() equivalent for ByteIOContext.
+ * @return new position or AVERROR.
+ */
+Index: libavformat/aviobuf.c
+===================================================================
+--- libavformat/aviobuf.c (revision 23893)
++++ libavformat/aviobuf.c (working copy)
+@@ -284,6 +284,28 @@
+ put_byte(s, val);
+ }
+
++/**
++ * Gets the length in bytes which is needed to store val as v.
++ */
++int get_length(uint64_t val){
++ int i=1;
++
++ while(val>>=7)
++ i++;
++
++ return i;
++}
++
++void put_v(ByteIOContext *bc, uint64_t val){
++ int i= get_length(val);
++
++ while(--i>0)
++ put_byte(bc, 128 | (val>>(7*i)));
++
++ put_byte(bc, val&127);
++}
++
++
+ void put_tag(ByteIOContext *s, const char *tag)
+ {
+ while (*tag) {
+Index: libavformat/nutenc.c
+===================================================================
+--- libavformat/nutenc.c (revision 23893)
++++ libavformat/nutenc.c (working copy)
+@@ -241,27 +241,6 @@
+ nut->frame_code['N'].flags= FLAG_INVALID;
+ }
+
+-/**
+- * Gets the length in bytes which is needed to store val as v.
+- */
+-static int get_length(uint64_t val){
+- int i=1;
+-
+- while(val>>=7)
+- i++;
+-
+- return i;
+-}
+-
+-static void put_v(ByteIOContext *bc, uint64_t val){
+- int i= get_length(val);
+-
+- while(--i>0)
+- put_byte(bc, 128 | (val>>(7*i)));
+-
+- put_byte(bc, val&127);
+-}
+-
+ static void put_tt(NUTContext *nut, StreamContext *nus, ByteIOContext *bc, uint64_t val){
+ val *= nut->time_base_count;
+ val += nus->time_base - nut->time_base;
1
0
Hi,
This cleans up FMTP parsing code somewhat. I only did it for H.264 and
MPEG-4/AAC; if this approach is OK, I'll do the rest (Xiph, AMR, etc).
0001 -- rtpdec.h is a better place for SPACE_CHARS. Removes a
dependency on internal.h, and avoids having to #include it in later
patches.
0002 -- self explanatory. It is likely I will have to change
value[4096] to be malloc'd due to massive Xiph extradata.
003-005 -- H.264 related
0006-007 -- MPEG-4/AAC related
Josh
3
8
27 Jun '10
- Log -----------------------------------------------------------------
commit a5364ae5ef0f5b80efc51bc164051f583e0ce3bc
Author: Naufal <naufal11(a)gmail.com>
Date: Sun Jun 27 23:55:01 2010 +0530
Generate adaptive & total excitation vector
diff --git a/libavcodec/g723_1.c b/libavcodec/g723_1.c
index 8c58b2c..e24248c 100755
--- a/libavcodec/g723_1.c
+++ b/libavcodec/g723_1.c
@@ -330,6 +330,45 @@ static void gen_fcb_excitation(int16_t *vector, G723_1_Subframe subfrm,
}
}
+/*
+ * Generate adaptive codebook excitation
+ *
+ * @param vector restored excitation vector
+ */
+static void gen_acb_excitation(int16_t *vector, int16_t *prev_excitation,
+ int16_t pitch_lag, G723_1_Subframe subfrm,
+ Rate cur_rate)
+{
+ int16_t residual[SUBFRAME_LEN + PITCH_ORDER - 1];
+ const int16_t *cb_ptr;
+ int lag = pitch_lag + subfrm.ad_cb_lag - 1;
+ int temp = PITCH_MAX - PITCH_ORDER / 2 - lag;
+ int i, j;
+ int64_t sum;
+
+ residual[0] = prev_excitation[temp];
+ residual[1] = prev_excitation[temp + 1];
+
+ for (i = 2; i < SUBFRAME_LEN + PITCH_ORDER - 1; i++)
+ residual[i] = prev_excitation[temp + i % lag];
+
+ // Select quantization table
+ if (cur_rate == Rate6k3 && pitch_lag < SUBFRAME_LEN - 2)
+ cb_ptr = adaptive_cb_gain85;
+ else
+ cb_ptr = adaptive_cb_gain170;
+
+ // Calculate adaptive vector
+ cb_ptr += subfrm.ad_cb_gain * 20;
+ for (i = 0; i < SUBFRAME_LEN; i++) {
+ sum = 0;
+ for (j = 0; j < PITCH_ORDER; j++) {
+ temp = av_clipl_int32((int64_t)residual[i + j] * cb_ptr[j] << 1);
+ sum = av_clipl_int32(sum + (temp << 1));
+ }
+ vector[i] = av_clipl_int32(sum + (1 << 15)) >> 16;
+ }
+}
static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
@@ -341,9 +380,10 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
int16_t cur_lsp[LPC_ORDER];
int16_t lpc[SUBFRAMES * LPC_ORDER + 4];
int16_t temp_vector[FRAME_LEN + PITCH_MAX];
+ int16_t acb_vector[SUBFRAME_LEN];
int16_t *vector_ptr;
int16_t interp_gain;
- int bad_frame = 0, erased_frames = 0, i;
+ int bad_frame = 0, erased_frames = 0, i, j;
if (!buf_size || buf_size < frame_size[buf[0] & 3]) {
*data_size = 0;
@@ -375,6 +415,15 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
for (i = 0; i < SUBFRAMES; i++) {
gen_fcb_excitation(vector_ptr, p->subframe[i], p->cur_rate,
p->pitch_lag[i >> 1], i);
+ gen_acb_excitation(acb_vector, &temp_vector[SUBFRAME_LEN * i],
+ p->pitch_lag[i >> 1], p->subframe[i],
+ p->cur_rate);
+ // Get the total excitation
+ for (j = 0; j < SUBFRAME_LEN; j++) {
+ vector_ptr[j] = av_clip_int16(vector_ptr[j] << 1);
+ vector_ptr[j] = av_clip_int16(vector_ptr[j] + acb_vector[j]);
+ }
+ vector_ptr += SUBFRAME_LEN;
}
}
}
diff --git a/libavcodec/g723_1_data.h b/libavcodec/g723_1_data.h
index 86a749b..fc20054 100644
--- a/libavcodec/g723_1_data.h
+++ b/libavcodec/g723_1_data.h
@@ -6,6 +6,7 @@
#define LSP_CB_SIZE 256
#define PITCH_MIN 18
#define PITCH_MAX (PITCH_MIN + 127)
+#define PITCH_ORDER 5
#define GRID_SIZE 2
#define PULSE_MAX 6
#define GAIN_LEVELS 24
@@ -1015,3 +1016,647 @@ static const int16_t pitch_contrib[340] = {
60, 0, 2, 25650, 60, 0, -2, 31253,
-2, 25144, 0, 17998
};
+
+static const int16_t adaptive_cb_gain85[85 * 20] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 800, 1496, 167, -256,
+ -338, -39, -136, -1, -4, -6, -73, -8,
+ -15, 12, 23, 2, 16, 30, 3, -5,
+ -462, -686, 493, 2575, 311, -13, -28, -14,
+ -404, -5, -19, 13, 20, 72, 107, -77,
+ 8, 13, -9, -48, 1483, 144, 784, 928,
+ 1243, -134, -1, -37, -52, -94, -13, -71,
+ -6, -84, -8, -44, -112, -10, -59, -70,
+ -77, 275, 3522, 1056, -1254, 0, -4, -757,
+ -68, -95, 1, 16, -59, 4, -17, -227,
+ -5, 21, 269, 80, -125, -40, -264, 381,
+ 5027, 0, 0, -4, -8, -1542, 0, -2,
+ 0, 2, 0, 6, 38, 12, 81, -117,
+ 138, 332, 2215, 2574, 1339, -1, -6, -299,
+ -404, -109, -2, -18, -44, -21, -52, -348,
+ -11, -27, -181, -210, 3685, 2883, -887, 866,
+ -1639, -828, -507, -48, -45, -164, -648, 199,
+ 156, -194, -152, 46, 368, 288, -88, 86,
+ 1396, 2146, 2235, 345, 942, -118, -281, -305,
+ -7, -54, -182, -190, -292, -29, -45, -47,
+ -80, -123, -128, -19, 13, 4475, 3549, -804,
+ -655, 0, -1222, -768, -39, -26, -3, -2,
+ -969, 0, 219, 174, 0, 179, 141, -32,
+ -724, 254, 242, 6049, 2462, -32, -3, -3,
+ -2233, -370, 11, 10, -3, 267, -94, -89,
+ 108, -38, -36, -909, 626, -1713, 6121, 4561,
+ -1061, -23, -179, -2287, -1270, -68, 65, -233,
+ 640, -174, 477, -1704, 40, -111, 396, 295,
+ -350, 1391, 7985, 511, -405, -7, -118, -3892,
+ -15, -10, 29, 170, -678, 10, -43, -249,
+ -8, 34, 197, 12, 3144, -529, 608, 2530,
+ 3878, -603, -17, -22, -390, -918, 101, -116,
+ 19, -485, 81, -93, -744, 125, -144, -599,
+ 2589, -689, 3045, 5603, -404, -409, -29, -566,
+ -1916, -10, 108, -481, 128, -885, 235, -1041,
+ 63, -17, 75, 138, 3107, 513, 1374, -3594,
+ -4922, -589, -16, -115, -788, -1478, -97, -260,
+ -43, 681, 112, 301, 933, 154, 413, -1079,
+ 2468, 6010, 1107, -390, 1961, -372, -2204, -74,
+ -9, -234, -905, -166, -406, 58, 143, 26,
+ -295, -719, -132, 46, 4773, 2766, 2368, 4862,
+ -4044, -1390, -467, -342, -1443, -998, -806, -690,
+ -399, -1416, -821, -702, 1178, 682, 584, 1200,
+ 1665, -1879, 1443, 1701, 8562, -169, -215, -127,
+ -176, -4475, 190, -146, 165, -172, 195, -149,
+ -870, 982, -754, -889, 2716, 9011, -1007, 755,
+ -1785, -450, -4956, -61, -34, -194, -1493, 167,
+ 554, -125, -415, 46, 296, 982, -109, 82,
+ -2727, 7548, 1285, 938, 3420, -453, -3478, -100,
+ -53, -714, 1256, 213, -592, 156, -432, -73,
+ 569, -1576, -268, -196, 3677, 882, 4050, 1202,
+ 2323, -825, -47, -1001, -88, -329, -198, -909,
+ -218, -269, -64, -297, -521, -125, -574, -170,
+ 2046, -753, 122, 10102, 603, -255, -34, 0,
+ -6229, -22, 94, -15, 5, -1261, 464, -75,
+ -75, 27, -4, -372, 449, -1815, 10690, 3870,
+ -527, -12, -201, -6976, -914, -16, 49, -293,
+ 1184, -106, 428, -2525, 14, -58, 344, 124,
+ -941, 2352, 5049, 3650, 2637, -54, -337, -1556,
+ -813, -424, 135, 290, -725, 209, -524, -1125,
+ 151, -378, -812, -587, -1879, 796, 3117, 9569,
+ -404, -215, -38, -593, -5589, -9, 91, 357,
+ -151, 1097, -464, -1821, -46, 19, 76, 236,
+ -1715, 2043, -2096, 9946, 4001, -179, -254, -268,
+ -6038, -977, 213, -219, 261, 1041, -1240, 1272,
+ 418, -498, 511, -2429, -5772, -618, -3921, 284,
+ -3155, -2033, -23, -938, -4, -607, -218, -1381,
+ -148, 100, 10, 68, -1111, -119, -755, 54,
+ 382, 4748, 8003, -2064, 2198, -8, -1376, -3909,
+ -260, -294, -110, -186, -2319, 48, 598, 1008,
+ -51, -637, -1073, 277, -867, 3015, 11926, -1675,
+ 947, -45, -555, -8681, -171, -54, 159, 631,
+ -2195, -88, 308, 1219, 50, -174, -690, 96,
+ -4933, -432, 6757, 3771, 1352, -1485, -11, -2786,
+ -867, -111, -130, 2034, 178, 1135, 99, -1555,
+ 407, 35, -557, -311, 152, 9726, 4231, -1928,
+ 1490, -1, -5774, -1092, -226, -135, -90, -39,
+ -2511, 17, 1144, 498, -13, -884, -384, 175,
+ 2512, 193, 9033, 5361, -3148, -385, -2, -4980,
+ -1754, -605, -29, -1385, -106, -822, -63, -2956,
+ 482, 37, 1735, 1030, 8464, 2844, 12, 549,
+ 2132, -4373, -493, 0, -18, -277, -1469, -6,
+ -2, -284, -95, 0, -1101, -370, -1, -71,
+ 2141, -2602, 7166, 9046, -1350, -279, -413, -3134,
+ -4994, -111, 340, -936, 1138, -1182, 1436, -3957,
+ 176, -214, 590, 745, -244, 278, 13307, 1227,
+ -161, -3, -4, -10808, -91, -1, 4, 198,
+ -226, 18, -20, -997, -2, 2, 131, 12,
+ -1947, 8217, 6269, 917, -2559, -231, -4121, -2399,
+ -51, -399, 976, 745, -3144, 108, -460, -350,
+ -304, 1283, 979, 143, -1810, 2061, -2781, 6056,
+ 10058, -200, -259, -472, -2238, -6174, 227, -307,
+ 349, 669, -761, 1028, 1111, -1265, 1707, -3717,
+ 7827, 9161, -3409, 2473, -1510, -3739, -5122, -709,
+ -373, -139, -4376, 1628, 1906, -1181, -1382, 514,
+ 721, 844, -314, 228, -1430, 8313, 9541, -2955,
+ 1626, -124, -4218, -5556, -533, -161, 725, 832,
+ -4841, -257, 1499, 1721, 142, -825, -947, 293,
+ 2819, -4247, 5391, 8673, 2756, -485, -1101, -1774,
+ -4591, -463, 730, -927, 1397, -1492, 2248, -2854,
+ -474, 714, -907, -1459, 141, 14552, 690, 257,
+ -112, -1, -12926, -29, -4, 0, -125, -5,
+ -613, -2, -228, -10, 0, 99, 4, 1,
+ 11938, -1859, 1806, -962, -884, -8699, -211, -199,
+ -56, -47, 1355, -1316, 205, 701, -109, 106,
+ 644, -100, 97, -51, 3728, 1982, 2264, 4584,
+ 3131, -848, -239, -312, -1282, -598, -451, -515,
+ -273, -1043, -554, -633, -712, -378, -432, -876,
+ -1181, 766, 720, 14303, -216, -85, -35, -31,
+-12486, -2, 55, 51, -33, 1031, -668, -628,
+ -15, 10, 9, 189, -4385, 4826, 10112, 1569,
+ 3388, -1173, -1421, -6242, -150, -700, 1291, 2706,
+ -2979, 420, -462, -969, 906, -998, -2091, -324,
+ -448, 1932, 15591, -1842, 657, -12, -227, -14837,
+ -207, -26, 52, 427, -1838, -50, 217, 1753,
+ 18, -77, -626, 74, -4141, 1844, 3962, 5517,
+ 6220, -1046, -207, -958, -1858, -2361, 466, 1001,
+ -446, 1394, -621, -1334, 1572, -700, -1504, -2094,
+ 729, -2299, 14755, 3657, -952, -32, -322, -13288,
+ -816, -55, 102, -656, 2071, -162, 513, -3294,
+ 42, -133, 857, 212, -1385, 5801, 13339, -3137,
+ 1344, -117, -2054, -10861, -600, -110, 490, 1127,
+ -4723, -265, 1111, 2554, 113, -476, -1094, 257,
+ 4710, 9661, 1073, -2467, 3274, -1354, -5697, -70,
+ -371, -654, -2777, -308, -633, 709, 1455, 161,
+ -941, -1930, -214, 493, 1843, -3624, 12422, 6898,
+ -1559, -207, -802, -9419, -2904, -148, 407, -1397,
+ 2748, -775, 1526, -5230, 175, -344, 1182, 656,
+ 1433, 2394, 2507, 1380, 8780, -125, -349, -383,
+ -116, -4705, -209, -219, -366, -120, -201, -211,
+ -768, -1283, -1343, -740, -1712, 12915, 5883, -2197,
+ 991, -179, -10181, -2112, -294, -60, 1350, 615,
+ -4638, -229, 1732, 789, 103, -781, -356, 133,
+ 15072, 2158, -1245, 910, -496, -13865, -284, -94,
+ -50, -15, -1986, 1145, 164, -837, -119, 69,
+ 456, 65, -37, 27, 4655, 7319, 4916, 586,
+ -3381, -1322, -3270, -1475, -20, -697, -2079, -1396,
+ -2196, -166, -261, -175, 960, 1510, 1014, 120,
+ 1191, -2140, 5120, 13498, -1418, -86, -279, -1600,
+-11121, -122, 155, -372, 669, -981, 1763, -4218,
+ 103, -185, 443, 1168, -1530, -817, 8191, 9632,
+ -1452, -143, -40, -4095, -5663, -128, -76, 765,
+ 408, 900, 480, -4815, -135, -72, 726, 854,
+ -3236, 607, 1696, -2106, 11485, -639, -22, -175,
+ -270, -8051, 119, 335, -62, -416, 78, 218,
+ 2268, -425, -1189, 1476, 3203, -1903, -837, 9679,
+ 7057, -626, -221, -42, -5718, -3039, 372, 163,
+ -97, -1892, 1124, 494, -1380, 819, 360, -4169,
+ 213, -655, 17015, 620, -384, -2, -26, -17671,
+ -23, -9, 8, -221, 681, -8, 24, -644,
+ 5, -15, 399, 14, 5088, 35, -3339, 3726,
+ 8488, -1580, 0, -680, -847, -4397, -10, 1037,
+ 7, -1157, -8, 759, -2636, -18, 1730, -1930,
+ -988, 1454, -2688, 15039, 2682, -59, -129, -441,
+-13805, -439, 87, -162, 238, 907, -1335, 2467,
+ 161, -238, 440, -2462, -4865, -2842, -53, 5495,
+ 6523, -1445, -493, 0, -1843, -2597, -844, -16,
+ -9, 1632, 953, 18, 1937, 1131, 21, -2188,
+ 3076, 15069, -2914, 1810, -971, -577, -13860, -518,
+ -200, -57, -2829, 547, 2680, -339, -1665, 322,
+ 182, 893, -172, 107, 1311, 5355, 11054, 2299,
+ -3654, -105, -1750, -7458, -322, -814, -428, -885,
+ -3613, -184, -751, -1551, 292, 1194, 2465, 512,
+ 4035, 5619, 4618, 1815, 1912, -994, -1927, -1301,
+ -201, -223, -1384, -1137, -1583, -447, -622, -511,
+ -471, -656, -539, -211, -2131, 2754, -4501, 12879,
+ 7432, -277, -463, -1236, -10124, -3371, 358, -585,
+ 756, 1675, -2165, 3538, 967, -1249, 2042, -5842,
+ 5618, -515, 3219, -4149, 4857, -1926, -16, -632,
+ -1050, -1440, 176, -1104, 101, 1422, -130, 815,
+ -1666, 152, -954, 1230, 1838, -1709, 1139, 16867,
+ 716, -206, -178, -79, -17366, -31, 191, -127,
+ 118, -1892, 1759, -1173, -80, 74, -49, -737,
+ 1978, -3845, 10050, 11854, -2492, -238, -902, -6164,
+ -8576, -379, 464, -1213, 2358, -1431, 2782, -7271,
+ 301, -585, 1529, 1803, -2600, 11246, 11289, -3647,
+ 1463, -412, -7720, -7778, -812, -130, 1784, 1791,
+ -7749, -578, 2504, 2513, 232, -1004, -1008, 325,
+ 3442, 907, 2725, 8970, 3638, -723, -50, -453,
+ -4911, -808, -190, -572, -150, -1884, -496, -1492,
+ -764, -201, -605, -1992, -126, 17498, 3481, -2003,
+ 1090, 0, -18689, -739, -244, -72, 135, 26,
+ -3717, -15, 2139, 425, 8, -1165, -231, 133,
+ -1814, 1048, -2164, 4070, 16272, -200, -67, -285,
+ -1011, -16160, 116, -239, 138, 450, -260, 537,
+ 1801, -1041, 2149, -4042, 9354, 12580, -1883, 962,
+ -617, -5341, -9660, -216, -56, -23, -7183, 1075,
+ 1446, -549, -738, 110, 352, 474, -71, 36,
+ 1708, 4199, 7387, 6335, 1003, -178, -1076, -3330,
+ -2449, -61, -437, -770, -1893, -660, -1623, -2856,
+ -104, -257, -452, -388, -2624, 5623, 17310, -2353,
+ 592, -420, -1930, -18288, -338, -21, 900, 2772,
+ -5941, -376, 807, 2486, 94, -203, -625, 85,
+ 1211, -850, 1193, -1926, 15992, -89, -44, -86,
+ -226, -15609, 62, -88, 61, 142, -100, 140,
+ -1182, 830, -1165, 1880, 3983, -2054, 11506, -19,
+ 3622, -968, -257, -8080, 0, -801, 499, -2797,
+ 1442, 4, -2, 13, -880, 454, -2544, 4,
+ -786, -1354, 16092, 7246, -1665, -37, -111, -15805,
+ -3205, -169, -65, 772, 1330, 348, 599, -7117,
+ -80, -137, 1636, 736, -4316, -511, 6674, 11665,
+ 4633, -1137, -15, -2719, -8305, -1310, -134, 1758,
+ 208, 3073, 364, -4752, 1220, 144, -1887, -3299,
+ 7912, 4557, 1937, 1885, 7037, -3821, -1267, -229,
+ -216, -3022, -2200, -935, -538, -910, -524, -222,
+ -3398, -1957, -832, -809, 3434, 2967, 5867, 8196,
+ 8766, -720, -537, -2101, -4100, -4690, -622, -1230,
+ -1062, -1718, -1484, -2935, -1837, -1588, -3139, -4385,
+ 5881, 9176, 8119, 3934, 3355, -2111, -5139, -4023,
+ -944, -687, -3294, -2914, -4547, -1412, -2203, -1949,
+ -1204, -1879, -1662, -805
+};
+
+static const int16_t adaptive_cb_gain170[170 * 20] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 776, 212, 715, 670,
+ 809, -36, -2, -31, -27, -39, -10, -33,
+ -9, -31, -8, -29, -38, -10, -35, -33,
+ 1296, 1316, -168, -320, -815, -102, -105, -1,
+ -6, -40, -104, 13, 13, 25, 25, -3,
+ 64, 65, -8, -15, -589, 680, 2478, 308,
+ -596, -21, -28, -375, -5, -21, 24, 89,
+ -102, 11, -12, -46, -21, 24, 90, 11,
+ -735, -487, -5, 2948, 468, -33, -14, 0,
+ -530, -13, -21, 0, 0, 132, 87, 0,
+ 21, 13, 0, -84, 1042, 1730, 1068, 333,
+ 626, -66, -182, -69, -6, -23, -110, -67,
+ -112, -21, -35, -21, -39, -66, -40, -12,
+ 486, -769, 4074, 2825, -1107, -14, -36, -1013,
+ -487, -74, 22, -120, 191, -83, 132, -702,
+ 32, -52, 275, 191, 1521, -767, -124, 4320,
+ 1026, -141, -35, 0, -1139, -64, 71, 11,
+ -5, -401, 202, 32, -95, 48, 7, -270,
+ 2425, 1267, 3439, -91, -1166, -359, -98, -722,
+ 0, -83, -187, -509, -266, 13, 7, 19,
+ 172, 90, 244, -6, -1251, 975, 173, 4039,
+ 2005, -95, -58, -1, -996, -245, 74, 13,
+ -10, 308, -240, -42, 153, -119, -21, -494,
+ 1820, 632, 1322, 2062, 1031, -202, -24, -106,
+ -259, -64, -70, -146, -51, -229, -79, -166,
+ -114, -39, -83, -129, -447, 4904, 244, -315,
+ -2038, -12, -1467, -3, -6, -253, 134, 6,
+ -73, -8, 94, 4, -55, 610, 30, -39,
+ -208, -1102, 463, -448, 5653, -2, -74, -13,
+ -12, -1950, -14, 5, 31, -5, -30, 12,
+ 71, 380, -159, 154, 4739, 2600, -1864, 856,
+ -1554, -1371, -412, -212, -44, -147, -752, 539,
+ 295, -247, -135, 97, 449, 246, -176, 81,
+ 1894, 3533, 35, -26, 2145, -219, -762, 0,
+ 0, -280, -408, -4, -7, 3, 5, 0,
+ -248, -462, -4, 3, -2699, 1841, 4072, 2443,
+ 1582, -444, -207, -1012, -364, -152, 303, 670,
+ -457, 402, -274, -607, 260, -177, -393, -236,
+ -844, 3358, 6106, -1059, -537, -43, -688, -2275,
+ -68, -17, 173, 314, -1251, -54, 217, 395,
+ -27, 110, 200, -34, 1251, 1016, 3020, 2210,
+ 1445, -95, -63, -556, -298, -127, -77, -230,
+ -187, -168, -137, -407, -110, -89, -266, -194,
+ 2099, 2277, 4038, 3533, -2870, -269, -316, -995,
+ -762, -503, -291, -517, -561, -452, -491, -871,
+ 367, 399, 707, 619, 400, -1114, 8516, 2422,
+ -1117, -9, -75, -4426, -358, -76, 27, -208,
+ 579, -59, 164, -1259, 27, -75, 580, 165,
+ -4398, -2011, 3912, -2407, 2258, -1180, -247, -934,
+ -353, -311, -540, 1050, 480, -646, -295, 575,
+ 606, 277, -539, 331, 1767, -1447, 4240, 6160,
+ -757, -190, -127, -1097, -2316, -35, 156, -457,
+ 374, -664, 544, -1594, 81, -66, 195, 284,
+ 1594, -1463, 1035, 6938, 1920, -155, -130, -65,
+ -2938, -225, 142, -100, 92, -675, 619, -438,
+ -186, 171, -121, -813, -562, 4716, 4085, -591,
+ 2421, -19, -1357, -1018, -21, -357, 162, 140,
+ -1175, -20, 170, 147, 83, -696, -603, 87,
+ 1552, 8778, -935, 354, -1424, -147, -4703, -53,
+ -7, -123, -831, 88, 501, -33, -189, 20,
+ 134, 763, -81, 30, 4831, -4431, 41, -1479,
+ -2976, -1424, -1198, 0, -133, -540, 1306, -12,
+ 11, 436, -400, 3, 877, -804, 7, -268,
+ 2090, 1192, 1006, 1645, 4853, -266, -86, -61,
+ -165, -1437, -152, -128, -73, -210, -119, -101,
+ -619, -353, -298, -487, 2386, 5712, 1426, -94,
+ 1350, -347, -1991, -124, 0, -111, -832, -207,
+ -497, 13, 32, 8, -196, -470, -117, 7,
+ -1349, 1091, 1659, 8891, 313, -111, -72, -168,
+ -4825, -5, 89, 136, -110, 732, -592, -900,
+ 25, -20, -31, -170, 9980, 916, -381, -808,
+ 88, -6080, -51, -8, -39, 0, -558, 232,
+ 21, 492, 45, -18, -53, -4, 2, 4,
+ 2338, -1031, -248, 3928, 6484, -333, -64, -3,
+ -942, -2566, 147, 35, -15, -560, 247, 59,
+ -925, 408, 98, -1555, 6166, -1240, -337, 3672,
+ -1277, -2320, -93, -6, -823, -99, 466, 126,
+ -25, -1382, 278, 75, 480, -96, -26, 286,
+ 4377, -132, -2588, 1701, 4865, -1169, -1, -409,
+ -176, -1444, 35, 691, -20, -454, 13, 268,
+ -1299, 39, 768, -505, 2594, 3295, 3944, 1481,
+ 682, -410, -662, -949, -133, -28, -521, -624,
+ -793, -234, -297, -356, -108, -137, -164, -61,
+ 4151, 624, 815, 4485, 2229, -1052, -23, -40,
+ -1228, -303, -158, -206, -31, -1136, -170, -223,
+ -565, -84, -111, -610, -3575, -361, 4924, 2791,
+ 4698, -780, -7, -1480, -475, -1347, -78, 1074,
+ 108, 609, 61, -839, 1025, 103, -1412, -800,
+ -2518, 3791, 8623, 315, 2465, -387, -877, -4538,
+ -6, -370, 582, 1325, -1995, 48, -73, -166,
+ 378, -570, -1297, -47, -691, 2989, 9957, -421,
+ -1142, -29, -545, -6051, -10, -79, 126, 420,
+ -1817, -17, 76, 256, -48, 208, 694, -29,
+ -1918, 104, -3190, -3410, -4440, -224, 0, -621,
+ -709, -1203, 12, -373, 20, -399, 21, -664,
+ -519, 28, -864, -924, -3359, -1668, 1854, 6939,
+ 1430, -688, -169, -209, -2939, -124, -341, 380,
+ 188, 1422, 706, -785, 293, 145, -161, -606,
+ 42, 9706, 3164, -952, 907, 0, -5750, -611,
+ -55, -50, -25, -8, -1874, 2, 564, 183,
+ -2, -537, -175, 52, 1607, 785, 2862, 4327,
+ 3307, -157, -37, -500, -1143, -667, -77, -280,
+ -137, -424, -207, -756, -324, -158, -577, -873,
+ 6801, 3416, 2227, 1682, -3217, -2823, -712, -302,
+ -172, -631, -1418, -924, -464, -698, -350, -228,
+ 1335, 670, 437, 330, 3459, 3898, 364, 7841,
+ -2640, -730, -927, -8, -3753, -425, -823, -76,
+ -86, -1655, -1865, -174, 557, 628, 58, 1263,
+ -5902, -3458, -2465, -1886, 4334, -2126, -730, -371,
+ -217, -1146, -1245, -888, -520, -679, -398, -283,
+ 1561, 915, 652, 499, -3710, 1133, 7849, 3443,
+ -215, -840, -78, -3760, -723, -2, 256, 1777,
+ -543, 779, -238, -1649, -48, 14, 103, 45,
+ 4132, 2828, 2, -4212, -4116, -1042, -488, 0,
+ -1083, -1034, -713, 0, 0, 1062, 727, 0,
+ 1038, 710, 0, -1058, 5875, 8496, -1796, 1376,
+ -1786, -2107, -4406, -197, -115, -194, -3047, 644,
+ 931, -493, -713, 150, 640, 926, -195, 150,
+ 3143, 3483, 3546, -793, 4489, -603, -740, -767,
+ -38, -1230, -668, -680, -754, 152, 168, 171,
+ -861, -954, -971, 217, 2845, 7965, 3695, -5432,
+ 3978, -494, -3873, -833, -1801, -966, -1383, -641,
+ -1796, 943, 2641, 1225, -691, -1934, -897, 1319,
+ 1538, 150, 7139, 2049, 3097, -144, -1, -3110,
+ -256, -585, -14, -670, -65, -192, -18, -892,
+ -290, -28, -1349, -387, 618, 7520, 4729, -238,
+ -3373, -23, -3452, -1365, -3, -694, -283, -178,
+ -2170, 8, 109, 68, 127, 1548, 973, -49,
+ 2965, -3013, 7912, 7076, -1997, -536, -554, -3821,
+ -3056, -243, 545, -1431, 1455, -1280, 1301, -3417,
+ 361, -367, 964, 862, 2443, -929, -1113, 9677,
+ 4138, -364, -52, -75, -5716, -1045, 138, 166,
+ -63, -1443, 549, 657, -617, 234, 281, -2444,
+ 1966, 3309, 10085, -3399, 2105, -236, -668, -6207,
+ -705, -270, -397, -1210, -2037, 408, 686, 2092,
+ -252, -425, -1295, 436, -112, -1368, 8868, 4822,
+ 2048, 0, -114, -4800, -1419, -256, -9, 61,
+ 740, 33, 402, -2610, 14, 171, -1108, -602,
+ -2597, 438, -1839, 6229, 7266, -411, -11, -206,
+ -2368, -3223, 69, -291, 49, 987, -166, 699,
+ 1152, -194, 816, -2763, 3454, 553, 9127, 4946,
+ -5596, -728, -18, -5084, -1493, -1911, -116, -1924,
+ -308, -1042, -166, -2755, 1179, 188, 3117, 1689,
+ -532, -663, 12262, 2495, -1004, -17, -26, -9177,
+ -380, -61, -21, 398, 496, 81, 101, -1867,
+ -32, -40, 751, 152, -2100, 1317, -1509, 11425,
+ 2997, -269, -105, -139, -7967, -548, 168, -193,
+ 121, 1464, -918, 1052, 384, -240, 276, -2090,
+ 1193, -2697, 11259, 5373, -763, -86, -444, -7737,
+ -1762, -35, 196, -819, 1853, -391, 884, -3692,
+ 55, -125, 525, 250, 2405, -471, 11079, 203,
+ 782, -353, -13, -7491, -2, -37, 69, -1626,
+ 318, -29, 5, -137, -114, 22, -529, -9,
+ -1871, 5685, 11290, -2662, 1353, -213, -1972, -7780,
+ -432, -111, 649, 1289, -3917, -304, 923, 1834,
+ 154, -469, -932, 220, -3768, 5927, -3093, 5041,
+ 5212, -866, -2144, -584, -1551, -1658, 1363, -711,
+ 1119, 1159, -1824, 951, 1198, -1885, 984, -1603,
+ -2546, 9502, 5969, -2440, 1928, -395, -5511, -2175,
+ -363, -226, 1477, 927, -3462, -379, 1415, 889,
+ 299, -1118, -702, 287, -4963, 3568, 4592, 5508,
+ 3451, -1503, -777, -1287, -1851, -727, 1080, 1391,
+ -1000, 1668, -1199, -1543, 1045, -751, -967, -1160,
+ 1745, -2586, 3983, 10899, -1551, -186, -408, -968,
+ -7250, -146, 275, -424, 628, -1161, 1720, -2649,
+ 165, -244, 377, 1032, 867, -456, -727, 3369,
+ 11822, -45, -12, -32, -692, -8531, 24, 38,
+ -20, -178, 93, 149, -625, 329, 525, -2431,
+ 7535, 2422, 1926, 1405, 1599, -3466, -358, -226,
+ -120, -156, -1114, -886, -284, -646, -207, -165,
+ -735, -236, -188, -137, 1041, -735, -142, 13209,
+ 1515, -66, -33, -1, -10649, -140, 46, 9,
+ -6, -839, 593, 114, -96, 68, 13, -1222,
+ 7950, 6745, -1444, -1008, 2721, -3857, -2777, -127,
+ -62, -452, -3273, 700, 594, 489, 415, -88,
+ -1320, -1120, 239, 167, -4754, -1379, 4522, -578,
+ -5733, -1379, -116, -1248, -20, -2006, -400, 1312,
+ 380, -167, -48, 159, -1663, -482, 1582, -202,
+ 3220, 5978, 5923, 2430, -2689, -633, -2181, -2141,
+ -360, -441, -1175, -1164, -2161, -477, -886, -878,
+ 528, 981, 972, 398, 377, 1312, 13978, -1470,
+ 677, -8, -105, -11925, -132, -28, -30, -321,
+ -1119, 33, 117, 1254, -15, -54, -577, 60,
+ -3435, 6770, 314, -885, 5686, -720, -2797, -6,
+ -47, -1973, 1419, 65, -129, -185, 366, 16,
+ 1192, -2349, -109, 307, 3171, 8774, -2260, 2679,
+ 3069, -613, -4699, -312, -438, -575, -1698, 437,
+ 1210, -518, -1435, 369, -594, -1643, 423, -501,
+ 5557, 1509, 5407, -125, -7386, -1884, -139, -1784,
+ 0, -3330, -511, -1834, -498, 42, 11, 41,
+ 2505, 680, 2438, -56, -2838, 2595, 13228, 271,
+ 1793, -491, -411, -10680, -4, -196, 449, 2291,
+ -2095, 47, -42, -219, 310, -284, -1447, -29,
+ 664, -278, 14966, 951, -711, -26, -4, -13672,
+ -55, -30, 11, -606, 253, -38, 16, -869,
+ 28, -12, 650, 41, 808, 1770, 8658, 5863,
+ -1486, -39, -191, -4576, -2098, -134, -87, -427,
+ -935, -289, -633, -3098, 73, 160, 785, 531,
+ 3063, 1539, 2000, -542, 9576, -572, -144, -244,
+ -17, -5597, -287, -374, -188, 101, 51, 66,
+ -1790, -900, -1169, 317, 514, 14083, -323, 896,
+ -891, -16, -12106, -6, -49, -48, -442, 10,
+ 277, -28, -770, 17, 27, 766, -17, 48,
+ 892, 158, 5237, 11057, -1603, -48, -1, -1674,
+ -7462, -156, -8, -285, -50, -602, -106, -3534,
+ 87, 15, 512, 1082, -1612, 2564, -4296, 12526,
+ 5710, -158, -401, -1126, -9576, -1990, 252, -422,
+ 672, 1232, -1960, 3284, 561, -893, 1497, -4365,
+ 4889, -6878, 612, 6109, 4753, -1459, -2887, -22,
+ -2277, -1379, 2052, -182, 257, -1823, 2564, -228,
+ -1418, 1995, -177, -1772, 3053, -506, 2403, 9625,
+ 1322, -569, -15, -352, -5655, -106, 94, -448,
+ 74, -1794, 297, -1412, -246, 40, -194, -777,
+ -754, 12904, 4480, -2113, 1471, -34, -10163, -1225,
+ -272, -132, 594, 206, -3529, -97, 1664, 577,
+ 67, -1159, -402, 189, 4255, 1476, 5055, 2393,
+ 2912, -1105, -132, -1559, -349, -517, -383, -1313,
+ -455, -621, -215, -738, -756, -262, -898, -425,
+ -1371, 535, 1417, 14604, -997, -114, -17, -122,
+-13017, -60, 44, 118, -46, 1222, -477, -1263,
+ -83, 32, 86, 888, 5368, -1744, 4083, -1236,
+ 3753, -1758, -185, -1017, -93, -860, 571, -1338,
+ 434, 405, -131, 308, -1229, 399, -935, 283,
+ 1588, -3097, 14415, 3699, -1171, -154, -585, -12683,
+ -835, -83, 300, -1397, 2725, -358, 699, -3255,
+ 113, -221, 1030, 264, 212, 7989, 9471, -3344,
+ 2009, -2, -3895, -5475, -682, -246, -103, -123,
+ -4618, 43, 1630, 1933, -26, -979, -1161, 410,
+ 856, 2294, -627, 6930, 6929, -44, -321, -24,
+ -2931, -2930, -119, 32, 87, -362, -970, 265,
+ -362, -970, 265, -2931, 2357, -4187, 7162, 7683,
+ 3371, -339, -1070, -3131, -3603, -693, 602, -1030,
+ 1830, -1105, 1963, -3359, -485, 861, -1474, -1581,
+ 350, 4585, 14053, -3819, 1218, -7, -1283, -12054,
+ -890, -90, -97, -300, -3933, 81, 1068, 3275,
+ -26, -341, -1045, 284, -3248, 3531, 475, 2137,
+ 11711, -644, -761, -13, -278, -8372, 700, 94,
+ -102, 423, -460, -62, 2322, -2524, -340, -1528,
+ -3017, 3852, 1725, 8440, 5257, -555, -905, -181,
+ -4348, -1686, 709, 317, -405, 1554, -1984, -889,
+ 968, -1236, -553, -2708, -909, 3196, 15512, -2528,
+ 1066, -50, -623, -14686, -390, -69, 177, 861,
+ -3026, -140, 493, 2393, 59, -208, -1009, 164,
+ 959, -3370, 9617, 9545, -1761, -56, -693, -5645,
+ -5561, -189, 197, -563, 1978, -558, 1963, -5603,
+ 103, -362, 1034, 1026, 7575, 11796, -4845, 3252,
+ -1703, -3502, -8493, -1433, -645, -177, -5454, 2240,
+ 3488, -1503, -2341, 961, 787, 1226, -503, 338,
+ 6409, 1722, 1764, -4191, 6015, -2507, -181, -189,
+ -1072, -2208, -673, -690, -185, 1639, 440, 451,
+ -2353, -632, -647, 1538, -2420, 12161, 5038, 1286,
+ -2098, -357, -9027, -1549, -100, -268, 1796, 744,
+ -3740, 190, -954, -395, -310, 1557, 645, 164,
+ -2232, -1341, 7246, 9470, -1977, -304, -109, -3204,
+ -5474, -238, -182, 987, 593, 1290, 775, -4188,
+ -269, -161, 874, 1143, 1030, 7034, 4231, 1551,
+ 3077, -64, -3019, -1093, -146, -577, -442, -266,
+ -1816, -97, -666, -400, -193, -1321, -794, -291,
+ 5121, 11835, -477, -1749, 2298, -1601, -8549, -13,
+ -186, -322, -3699, 149, 344, 546, 1264, -50,
+ -718, -1660, 66, 245, -3328, 3827, 5921, 9976,
+ -1045, -676, -894, -2140, -6075, -66, 777, 1203,
+ -1383, 2027, -2330, -3605, -212, 244, 377, 636,
+ 3813, 5718, -4666, -3412, 5674, -887, -1995, -1329,
+ -710, -1965, -1331, 1086, 1628, 794, 1191, -972,
+ -1320, -1980, 1616, 1181, 1348, -3672, 13154, 6938,
+ -1690, -110, -823, -10561, -2938, -174, 302, -1082,
+ 2948, -570, 1555, -5570, 139, -379, 1357, 716,
+ 2151, -3586, 6949, 12131, -1224, -282, -785, -2947,
+ -8982, -91, 470, -912, 1521, -1592, 2655, -5145,
+ 160, -268, 519, 906, -2889, 9647, 10276, -2728,
+ 995, -509, -5680, -6445, -454, -60, 1701, 1812,
+ -6051, -481, 1606, 1711, 175, -586, -624, 165,
+ 6177, 2184, 555, 1985, 6589, -2329, -291, -18,
+ -240, -2650, -823, -209, -74, -748, -264, -67,
+ -2484, -878, -223, -798, -492, 391, 17166, -681,
+ 240, -14, -9, -17987, -28, -3, 11, 515,
+ -410, -20, 16, 713, 7, -5, -252, 10,
+ 12628, 5448, -2630, 3011, -2695, -9733, -1811, -422,
+ -553, -443, -4199, 2027, 874, -2321, -1001, 483,
+ 2077, 896, -432, 495, -3628, -534, 3447, 7002,
+ 6751, -803, -17, -725, -2992, -2782, -118, 763,
+ 112, 1550, 228, -1473, 1495, 220, -1420, -2885,
+ -5239, 5901, 8107, 3650, 4846, -1675, -2125, -4012,
+ -813, -1433, 1887, 2592, -2920, 1167, -1315, -1806,
+ 1550, -1745, -2398, -1080, 6157, 6678, 4099, -1074,
+ 2348, -2314, -2722, -1025, -70, -336, -2509, -1540,
+ -1670, 403, 437, 268, -882, -957, -587, 153,
+ 1079, 16099, 242, -881, 1690, -71, -15820, -3,
+ -47, -174, -1060, -16, -238, 58, 865, 13,
+ -111, -1661, -25, 90, -278, 227, -1039, 1636,
+ 16945, -4, -3, -65, -163, -17526, 3, -17,
+ 14, 27, -22, 103, 287, -234, 1074, -1693,
+ 15778, -1454, 574, -603, -107, -15195, -129, -20,
+ -22, 0, 1400, -553, 51, 581, -53, 21,
+ 103, -9, 3, -3, 2406, -836, 13224, 7993,
+ -4266, -353, -42, -10673, -3899, -1111, 122, -1942,
+ 674, -1174, 407, -6451, 626, -217, 3443, 2081,
+ 3184, 14368, -3336, 2255, -1801, -619, -12600, -679,
+ -310, -198, -2793, 648, 2926, -438, -1977, 459,
+ 350, 1580, -366, 247, -1698, 17076, 2504, -539,
+ -646, -176, -17798, -382, -17, -25, 1770, 259,
+ -2610, -55, 561, 82, -67, 673, 98, -21,
+ 2375, -797, -2696, 14483, 5383, -344, -38, -443,
+-12803, -1769, 115, 391, -131, -2100, 705, 2384,
+ -780, 262, 886, -4759, -2691, 2554, -4520, 9573,
+ 10655, -442, -398, -1247, -5594, -6930, 419, -742,
+ 704, 1572, -1492, 2641, 1750, -1661, 2939, -6226,
+ -4332, -4399, -1657, 4880, 7375, -1145, -1181, -167,
+ -1453, -3319, -1163, -438, -444, 1290, 1310, 493,
+ 1950, 1980, 745, -2196, -3498, 7405, 9955, 2693,
+ -2971, -746, -3347, -6049, -442, -538, 1581, 2125,
+ -4499, 575, -1217, -1636, -634, 1342, 1805, 488,
+ 6717, -3792, 7739, 2798, 3489, -2754, -877, -3655,
+ -477, -743, 1554, -3173, 1791, -1147, 647, -1321,
+ -1430, 807, -1648, -595, 5263, 9770, 3463, 1069,
+ -3971, -1690, -5826, -732, -69, -962, -3138, -1112,
+ -2065, -343, -637, -226, 1275, 2368, 839, 259,
+ 1243, -2634, 16772, 1871, 332, -94, -423, -17169,
+ -213, -6, 199, -1273, 2696, -142, 300, -1915,
+ -25, 53, -339, -37, 2691, 2836, 3105, 5711,
+ 4817, -442, -491, -588, -1991, -1416, -465, -510,
+ -537, -938, -988, -1082, -791, -834, -913, -1679,
+ 4366, 2944, 7210, 3627, 1161, -1163, -529, -3172,
+ -803, -82, -784, -1921, -1295, -966, -651, -1596,
+ -309, -208, -511, -257, 13888, 3951, -671, -2305,
+ 3354, -11773, -953, -27, -324, -686, -3349, 569,
+ 161, 1954, 556, -94, -2843, -809, 137, 472,
+ 7053, 5847, 2929, 8378, -4794, -3036, -2086, -523,
+ -4284, -1403, -2517, -1261, -1045, -3607, -2990, -1498,
+ 2064, 1711, 857, 2451, -2191, 12838, 9182, -3915,
+ 1617, -293, -10059, -5146, -935, -159, 1717, 1228,
+ -7195, -523, 3068, 2194, 216, -1267, -906, 386,
+ -4881, 13114, 5767, -435, 4155, -1454, -10498, -2030,
+ -11, -1054, 3907, 1718, -4616, -129, 348, 153,
+ 1238, -3326, -1462, 110, 7843, -1250, 210, 7106,
+ -5203, -3754, -95, -2, -3082, -1652, 598, -100,
+ 16, -3402, 542, -91, 2491, -397, 66, 2257,
+ -2463, 8168, 14551, -3908, 1828, -370, -4072, -12923,
+ -932, -204, 1228, 2188, -7254, -587, 1948, 3471,
+ 274, -911, -1623, 436, -1579, 347, -272, -2735,
+ 16031, -152, -7, -4, -456, -15686, 33, -26,
+ 5, -263, 58, -45, 1545, -340, 266, 2676,
+ -6327, 1328, 5093, -5079, 7617, -2443, -107, -1583,
+ -1574, -3541, 513, 1967, -413, -1961, 411, 1578,
+ 2941, -617, -2367, 2361, 3286, -4509, 11306, 11025,
+ -2623, -659, -1241, -7802, -7419, -420, 904, -2267,
+ 3112, -2211, 3034, -7608, 526, -722, 1810, 1765,
+ 5567, 17853, -3754, 1166, -519, -1892, -19455, -860,
+ -83, -16, -6067, 1275, 4090, -396, -1271, 267,
+ 176, 566, -119, 37, -2136, -424, 15292, 5108,
+ -1648, -278, -10, -14273, -1593, -165, -55, 1993,
+ 396, 666, 132, -4768, -214, -42, 1538, 514,
+ 2267, -3297, 2549, 16563, -791, -313, -663, -396,
+-16745, -38, 456, -352, 513, -2291, 3333, -2576,
+ 109, -159, 123, 799, 3655, 1899, -3364, 6279,
+ 12510, -815, -220, -690, -2406, -9552, -423, 750,
+ 390, -1400, -728, 1289, -2791, -1450, 2568, -4794,
+ 8052, 2285, -6193, 5138, 6003, -3957, -318, -2341,
+ -1611, -2199, -1123, 3044, 864, -2525, -716, 1942,
+ -2950, -837, 2269, -1882, -386, -2291, 7679, 15387,
+ -2723, -9, -320, -3599, -14452, -452, -54, 181,
+ 1074, 362, 2152, -7212, -64, -380, 1276, 2557,
+ 2777, -1173, 3984, 13079, 2508, -470, -84, -969,
+-10440, -384, 198, -675, 285, -2217, 936, -3180,
+ -425, 179, -610, -2002, -1879, 1771, -2684, 16705,
+ 1833, -215, -191, -439, -17032, -205, 203, -308,
+ 290, 1916, -1805, 2736, 210, -198, 300, -1869,
+ 1052, 4495, 15519, 1467, -4032, -67, -1233, -14700,
+ -131, -992, -288, -997, -4257, -94, -402, -1389,
+ 259, 1106, 3819, 361, 3010, 2544, 6969, 7559,
+ 1996, -553, -395, -2964, -3487, -243, -467, -1280,
+ -1082, -1388, -1174, -3215, -366, -310, -849, -921,
+ -5209, -1867, 8713, 10351, 1549, -1656, -212, -4634,
+ -6540, -146, -593, 2770, 993, 3291, 1180, -5505,
+ 492, 176, -824, -979, -4314, 8513, 913, 7547,
+ -2723, -1135, -4423, -50, -3476, -452, 2241, 240,
+ -474, 1987, -3921, -420, -717, 1415, 151, 1254,
+ 12929, -1219, 2448, 1757, 6303, -10204, -90, -365,
+ -188, -2425, 962, -1932, 182, -1386, 130, -262,
+ -4974, 469, -941, -676, 6465, 4132, 3167, 3160,
+ 5697, -2551, -1042, -612, -609, -1981, -1630, -1249,
+ -798, -1247, -797, -611, -2248, -1437, -1101, -1099,
+ -3636, 4859, 18914, -1335, 810, -807, -1441, -21836,
+ -108, -40, 1078, 4198, -5609, -296, 396, 1541,
+ 179, -240, -936, 66, 8844, 7864, 654, -4063,
+ -5680, -4774, -3774, -26, -1007, -1969, -4245, -353,
+ -314, 2193, 1950, 162, 3066, 2726, 226, -1408,
+ 1859, 2634, 9228, 996, 9464, -211, -423, -5197,
+ -60, -5467, -299, -1047, -1483, -113, -160, -561,
+ -1074, -1521, -5330, -575, 2949, 12260, 10290, -497,
+ -3943, -530, -9174, -6463, -15, -949, -2206, -1852,
+ -7700, 89, 372, 312, 709, 2950, 2476, -119,
+ -2903, 1552, 14867, 9970, -496, -514, -147, -13491,
+ -6068, -15, 275, 2634, -1408, 1766, -944, -9047,
+ -87, 47, 450, 302, 3243, 8234, 7586, 3373,
+ 2151, -642, -4138, -3512, -694, -282, -1630, -1501,
+ -3812, -667, -1695, -1561, -425, -1081, -996, -442,
+ -9631, 60, 3501, 5359, 10150, -5662, 0, -748,
+ -1752, -6288, 35, 2058, -12, 3150, -19, -1145,
+ 5967, -37, -2169, -3320, -6874, -2553, -5446, -2195,
+ -7841, -2884, -397, -1810, -294, -3753, -1071, -2285,
+ -848, -921, -342, -729, -3290, -1221, -2606, -1050,
+ -3413, -1141, 4630, 13612, 7897, -711, -79, -1308,
+-11310, -3806, -237, 964, 322, 2836, 948, -3847,
+ 1645, 550, -2231, -6561, 4410, -5678, 8006, -3992,
+ 3811, -1187, -1968, -3912, -973, -886, 1528, -2155,
+ 2775, 1074, -1383, 1951, -1025, 1321, -1862, 928,
+ 5659, 11535, 2203, -452, 7169, -1954, -8121, -296,
+ -12, -3137, -3984, -761, -1551, 156, 318, 60,
+ -2476, -5048, -964, 197, 2914, -2914, 3485, -3965,
+ 13675, -518, -518, -741, -959, -11414, 518, -620,
+ 620, 705, -705, 843, -2433, 2432, -2909, 3310,
+ 7843, 1907, 1022, 8882, 7972, -3755, -222, -63,
+ -4815, -3879, -913, -489, -119, -4252, -1034, -554,
+ -3816, -928, -497, -4322, 13807, 9531, 1436, 1612,
+ 1779, -11636, -5544, -125, -158, -193, -8032, -1210,
+ -835, -1358, -938, -141, -1499, -1035, -156, -175,
+ 13620, -5337, 5450, -2263, 1723, -11322, -1738, -1813,
+ -312, -181, 4436, -4531, 1775, 1881, -737, 752,
+ -1432, 561, -573, 238, 5297, 8374, 8872, 7694,
+ 6538, -1712, -4280, -4804, -3613, -2609, -2707, -2868,
+ -4534, -2487, -3932, -4166, -2113, -3341, -3540, -3070
+};
commit c82807ae7c40b743f66a467bf52c04e78faa6edb
Author: Naufal <naufal11(a)gmail.com>
Date: Mon Jun 21 14:24:47 2010 +0530
Initialize variables
diff --git a/libavcodec/g723_1.c b/libavcodec/g723_1.c
index bfac828..8c58b2c 100755
--- a/libavcodec/g723_1.c
+++ b/libavcodec/g723_1.c
@@ -343,7 +343,7 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
int16_t temp_vector[FRAME_LEN + PITCH_MAX];
int16_t *vector_ptr;
int16_t interp_gain;
- int bad_frame, erased_frames, i;
+ int bad_frame = 0, erased_frames = 0, i;
if (!buf_size || buf_size < frame_size[buf[0] & 3]) {
*data_size = 0;
-----------------------------------------------------------------------
Summary of changes:
libavcodec/g723_1.c | 51 ++++-
libavcodec/g723_1_data.h | 645 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 695 insertions(+), 1 deletions(-)
--
http://github.com/naufal/ffmpeg-soc
1
0
Sent to luca, but not ffmpeg-soc...
On 22 June 2010 23:52, Josh Allmann <joshua.allmann(a)gmail.com> wrote:
> Hi,
>
> On 21 June 2010 14:28, Luca Barbato <lu_zero(a)gentoo.org> wrote:
>> On 21/06/2010 21:18, Josh Allmann wrote:
>>
>>> Okay, updated patches attached, with more forthcoming.
>>> (Ignore the numbering; that teaches me to do git rebase instead of git pull...)
>>
>> 0001 should use ff_ namespace probably.
>>
>
> Done
>
>> 0029 not sure if hex_to_data might have other usages and thus should be
>> put in the header as well.
>>
>
> Left as-is per Ronald's suggestion.
>
>> The rest seems ok
>>
>
> Three more patches attached which clean up the rest.
>
> 004 breaks receiving video (mpeg4 AND h264) if streamed in conjunction
> with AAC, but video seems to work OK in isolation. Which is weird
> because 004 should only touch the AAC codepath.
>
> Been staring at this bug all day, so I'm just gonna turn in what I
> have, get some sleep, and hopefully dream up a fix.
>
> Josh
>
5
18
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "AMR-WB decoder".
The branch, master has been updated
via 18bd5b400745788b6f7bc40dafc0c2c1d9ebdc28 (commit)
from 16c2032735c2e55fb9fa7e05cb07ca9d6e0328a1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 18bd5b400745788b6f7bc40dafc0c2c1d9ebdc28
Author: Marcelo Povoa <marspeoplester(a)gmail.com>
Date: Thu Jun 24 13:28:23 2010 -0300
Decode pitch lag for all modes
diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c
index d2a264f..68a5d91 100644
--- a/libavcodec/amrwbdec.c
+++ b/libavcodec/amrwbdec.c
@@ -37,8 +37,9 @@ typedef struct {
double isp[4][LP_ORDER]; ///< ISP vectors from current frame
double isp_sub4_past[LP_ORDER]; ///< ISP vector for the 4th subframe of the previous frame
- float lp_coef[4][LP_ORDER]; ///< Linear Prediction Coefficients from ISP vector
+ float lp_coef[4][LP_ORDER]; ///< Linear Prediction Coefficients from ISP vector
+ uint8_t base_pitch_lag; ///< integer part of pitch lag for next relative subframe
} AMRWBContext;
static int amrwb_decode_init(AVCodecContext *avctx)
@@ -285,6 +286,106 @@ static void isp2lp(double isp[LP_ORDER], float *lp, int lp_half_order) {
lp2[lp_half_order] = last_isp;
}
+/**
+ * Decode a adaptive codebook index into pitch lag (except 6k60, 8k85 modes)
+ * Calculate (nearest) integer lag and fractional lag using 1/4 resolution
+ * In 1st and 3rd subframes index is relative to last subframe integer lag
+ *
+ * @param lag_int [out] Decoded integer pitch lag
+ * @param lag_frac [out] Decoded fractional pitch lag
+ * @param pitch_index [in] Adaptive codebook pitch index
+ * @param base_lag_int [in/out] Base integer lag used in relative subframes
+ * @param subframe [in] Current subframe index (0 to 3)
+ */
+static void decode_pitch_lag_high(int *lag_int, int *lag_frac, int pitch_index,
+ uint8_t *base_lag_int, const int subframe)
+{
+ if (subframe == 0 || subframe == 2) {
+ if (pitch_index < 376) {
+ *lag_int = (pitch_index + 137) >> 2;
+ *lag_frac = pitch_index - (*lag_int << 2) + 136;
+ } else if (pitch_index < 440) {
+ *lag_int = (pitch_index + 257 - 376) >> 1;
+ *lag_frac = (pitch_index - (*lag_int << 1) + 256 - 376) << 1;
+ /* the actual resolution is 1/2 but expressed as 1/4 */
+ } else {
+ *lag_int = pitch_index - 280;
+ *lag_frac = 0;
+ }
+ *base_lag_int = *lag_int; // store previous lag
+ } else {
+ *lag_int = (pitch_index + 1) >> 2;
+ *lag_frac = pitch_index - (*lag_int << 2);
+ *lag_int += *base_lag_int - 8;
+ /* Doesn't seem to need bounding according to TS 26.190 */
+ }
+}
+
+/**
+ * Decode a adaptive codebook index into pitch lag for 8k85 mode
+ * Description is analogous to decode_pitch_lag_high
+ */
+static void decode_pitch_lag_8K85(int *lag_int, int *lag_frac, int pitch_index,
+ uint8_t *base_lag_int, const int subframe)
+{
+ if (subframe == 0 || subframe == 2) {
+ if (pitch_index < 116) {
+ *lag_int = (pitch_index + 69) >> 1;
+ *lag_frac = (pitch_index - (*lag_int << 1) + 68) << 1;
+ } else {
+ *lag_int = pitch_index - 24;
+ *lag_frac = 0;
+ }
+ *base_lag_int = *lag_int;
+ } else {
+ *lag_int = (pitch_index + 1) >> 1;
+ *lag_frac = pitch_index - (*lag_int << 1);
+ *lag_int += *base_lag_int - 8;
+ }
+}
+
+/**
+ * Decode a adaptive codebook index into pitch lag for 6k60 mode
+ * Description is analogous to decode_pitch_lag_high, but relative
+ * index is used for all subframes except the first
+ */
+static void decode_pitch_lag_6K60(int *lag_int, int *lag_frac, int pitch_index,
+ uint8_t *base_lag_int, const int subframe)
+{
+ if (subframe == 0) {
+ if (pitch_index < 116) {
+ *lag_int = (pitch_index + 69) >> 1;
+ *lag_frac = (pitch_index - (*lag_int << 1) + 68) << 1;
+ } else {
+ *lag_int = pitch_index - 24;
+ *lag_frac = 0;
+ }
+ *base_lag_int = *lag_int;
+ } else {
+ *lag_int = (pitch_index + 1) >> 1;
+ *lag_frac = pitch_index - (*lag_int << 1);
+ *lag_int += *base_lag_int - 8;
+ }
+}
+
+static void decode_pitch_vector(AMRWBContext *ctx,
+ const AMRWBSubFrame *amr_subframe,
+ const int subframe)
+{
+ int pitch_lag_int, pitch_lag_frac;
+ enum Mode mode = ctx->fr_cur_mode;
+
+ if (mode == MODE_6k60) {
+ decode_pitch_lag_6K60(&pitch_lag_int, &pitch_lag_frac, amr_subframe->adap,
+ &ctx->base_pitch_lag, subframe);
+ } else if (mode == MODE_8k85) {
+ decode_pitch_lag_8K85(&pitch_lag_int, &pitch_lag_frac, amr_subframe->adap,
+ &ctx->base_pitch_lag, subframe);
+ } else
+ decode_pitch_lag_high(&pitch_lag_int, &pitch_lag_frac, amr_subframe->adap,
+ &ctx->base_pitch_lag, subframe);
+}
+
static int amrwb_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
AVPacket *avpkt)
{
@@ -292,7 +393,7 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
AMRWBFrame *cf = &ctx->frame;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
- int i;
+ int sub;
ctx->fr_cur_mode = unpack_bitstream(ctx, buf, buf_size);
@@ -319,8 +420,14 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
/* Generate a ISP vector for each subframe */
interpolate_isp(ctx->isp, ctx->isp_sub4_past);
- for (i=0; i<4; i++)
- isp2lp(ctx->isp[i], ctx->lp_coef[i], LP_ORDER/2);
+ for (sub = 0; sub < 4; sub++)
+ isp2lp(ctx->isp[sub], ctx->lp_coef[sub], LP_ORDER/2);
+
+ for (sub = 0; sub < 4; sub++) {
+ const AMRWBSubFrame *cur_subframe = &cf->subframe[sub];
+
+ decode_pitch_vector(ctx, cur_subframe, sub);
+ }
//update state for next frame
memcpy(ctx->isp_sub4_past, ctx->isp[3], LP_ORDER * sizeof(ctx->isp[3][0]));
-----------------------------------------------------------------------
Summary of changes:
libavcodec/amrwbdec.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 111 insertions(+), 4 deletions(-)
hooks/post-receive
--
AMR-WB decoder
1
0
Hi,
2010/6/23 Rémi Denis-Courmont <rem(a)videolan.org>:
> On Saturday 12 June 2010 08:53:03 Josh Allmann, you wrote:
>> Hello,
>>
>> Here is a first attempt at integrating the RTSP layer from ffmpeg. It
>> does so by adding an access demuxer to the VLC scaffolding for
>> libavformat.
>>
>> All the major transports are working (udp, tcp, rtsp-http). I have not
>> yet looked at features like auth or muxing, but I can do that once I
>> know this patch is on the right track.
>
> @@ -117,10 +119,33 @@ int OpenDemux( vlc_object_t *p_this )
> unsigned int i;
> int64_t i_start_time = -1;
> bool b_can_seek;
> + char filename[128] = "", opts[8] = "";
> + int filename_len = 0;
>
> I'm afraid an RTSP URL could easily exceed 127 characters. Why don't you use
> asprintf() or similar instead?
>
Well, that's a good function to know. Fixed.
> + if( var_CreateGetBool( p_demux, "rtsp-tcp" ) )
>
> var_InheritBool.
>
Fixed
> + strcpy(opts, "?tcp");
>
> If I'm not mistaken, you could simply assign a const char pointer instead of
> using strcpy().
Fixed
>
> + else if( var_CreateGetBool( p_demux, "rtsp-http" ) )
> + strcpy(opts, "?http");
> + else if( var_CreateGetBool( p_demux, "rtsp-udp" ) )
> + strcpy(opts, "?udp");
>
> Same notes as above.
>
Fixed
> + /* build the filename string */
> + if( p_demux->psz_access )
> + {
> + filename_len += av_strlcatf( filename + filename_len,
> + sizeof(filename) - filename_len,
> + "%s://", p_demux->psz_access);
> + }
> + filename_len += av_strlcpy( filename + filename_len,
> + p_demux->psz_path,
> + sizeof(filename) - filename_len );
> + filename_len += av_strlcpy( filename + filename_len,
> + opts,
> + sizeof(filename) - filename_len );
>
> As noted above, this could probably be corrected and simplified to
> if (psz_access) asprintf(...); else asprintf(...);
> plus error handling.
>
Indeed, simplified considerably.
> --
> Rémi Denis-Courmont
>
1
0
Hi Baptiste,
I'm cc'ing the soc list because this there's more questions/discussion
that would benefit from having more readers.
This week I got the table stuff working for parallel/background
building and applied a bunch of suggestions by MN including removing
the AVSeekTable structure I added and eliminating a lot of the table
specific calls. Now for next week I am thinking of these issues:
I want to get accurate seeking for flac/vbr mp3 working in the table.
Some people mentioned they seek using the duration ratio over
filesize, but as flac is vbr this causes some troubles.
I've been debugging why the table doesn't work for flac - as it exists
there is no accurate way to seek using these two because the packet
from av_read_frame doesn't contain anything useful. It appears we
need to use some decoding to get the info that would be useful for the
table. I notice there's a decode_frame_header function in flacdec.c
that gets the number of samples in the frame, but it doesn't appear
there's a way around this. I'm thinking to reuse it somehow but
couldn't find the right place to do this - is it okay to make another
function pointer in the parser/AVInputFormat that can be used with
av_build_index to decode the frame info? Or does it exist already, or
is there a better way?
I've also been looking at VBR mp3, where table troubles exist, but not
as severe - the duration and timestamps of the index entries seem to
be off because of CBR assumptions. I guess it will need something
like the frame header decoder function in flac. I will do this after
solving flac which will give us the structure/framework to make it
easier.
As the next step I'm thinking to do the read and write index (to
file,) but this shouldn't be hard once it is clear what the format is.
If there's no human-redable requirement I'll just write the relevant
size/flag variables and AVIndexEntry array out in bytes with an endian
magic at the top. I think this is a pretty simple thing to implement
one way, but people will want to discuss exactly how it is done.
av_save_index(FILE*,AVFormatContext*) to write all the streams per
AVFormatContext and a av_save_index_stream(FILE*AVStreamContext*) that
it is dependent on. Please let me know if there's some example in av*
of file save/load for internal ffmpeg stuff - the reason I use FILE*
is because I saw that the dump functions use it.
Michael
2
1