summaryrefslogtreecommitdiff
path: root/src/libfame_wrapper.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libfame_wrapper.cc')
-rw-r--r--src/libfame_wrapper.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/libfame_wrapper.cc b/src/libfame_wrapper.cc
index 94989f1..5c71154 100644
--- a/src/libfame_wrapper.cc
+++ b/src/libfame_wrapper.cc
@@ -49,7 +49,8 @@ LibFAMEWrapper::LibFAMEWrapper(Info *i)
yuv.v = new unsigned char [w*h];// [w*h/4]
calc_bitrate = 0;
-
+ frame_number = 0;
+
////////////LIBDV STUFF///////////////
dvdecoder = NULL; // Initialize in encode method
@@ -99,7 +100,7 @@ LibFAMEWrapper::LibFAMEWrapper(Info *i)
fame_par.quality = config->readInt("frame_quality");
// Bitrate
- fame_par.bitrate = 0; // video bitrate (0=VBR)
+ fame_par.bitrate = 150000; // video bitrate in bytes pr second (0=VBR)
// slices_per_frame is the number of frame slices per frame. More slices provide
// better error recovery. There must be at least one slice per frame, and at most
@@ -226,8 +227,6 @@ Frame *LibFAMEWrapper::encode(Frame *dvframe)
// Allocate a new frame for the output
Frame *output = new Frame(NULL, FAME_BUFFER_SIZE);
- fame_frame_statistics_t stats;
-
// Init frame params
dv_get_timestamp(dvdecoder, output->timecode); // Set timecode
output->size = 0; // Init size (incremented as we read)
@@ -242,7 +241,10 @@ Frame *LibFAMEWrapper::encode(Frame *dvframe)
pt += written;
output->size += written;
}
- fame_end_frame(fame_context, &stats);
+
+ // fame_frame_statistics_t stats;
+
+ // fame_end_frame(fame_context, &stats);
/*
info->info("frame_number: %d, coding: %c, target_bits: %d, actual_bits: %d, spatial_activity: %d, quant_scale: %f",
stats.frame_number,
@@ -262,8 +264,9 @@ Frame *LibFAMEWrapper::encode(Frame *dvframe)
float quant_scale;
}
*/
- calc_bitrate += stats.actual_bits;
- output->bitrate = (unsigned int)(((double)calc_bitrate / (double)(stats.frame_number+1)) * 25.0);
+ frame_number++;
+ calc_bitrate += output->size; //stats.actual_bits;
+ output->bitrate = (unsigned int)((double)calc_bitrate / (double)frame_number) * 25;
return output;
}