summaryrefslogtreecommitdiff
path: root/src/libfame_wrapper.cc
diff options
context:
space:
mode:
authordeva <deva>2005-09-12 15:34:25 +0000
committerdeva <deva>2005-09-12 15:34:25 +0000
commit701608f39c59b530f6cede66ec24e9ddda8beae6 (patch)
treee974077734a45e0e6bb5b487b230922656834bed /src/libfame_wrapper.cc
parent84e9873f846478476487d5cd2587e5879a0be8ea (diff)
*** empty log message ***
Diffstat (limited to 'src/libfame_wrapper.cc')
-rw-r--r--src/libfame_wrapper.cc29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/libfame_wrapper.cc b/src/libfame_wrapper.cc
index e17ed68..94989f1 100644
--- a/src/libfame_wrapper.cc
+++ b/src/libfame_wrapper.cc
@@ -47,7 +47,9 @@ LibFAMEWrapper::LibFAMEWrapper(Info *i)
yuv.y = new unsigned char [w*h * 2];
yuv.u = new unsigned char [w*h];// [w*h/4]
yuv.v = new unsigned char [w*h];// [w*h/4]
-
+
+ calc_bitrate = 0;
+
////////////LIBDV STUFF///////////////
dvdecoder = NULL; // Initialize in encode method
@@ -224,6 +226,8 @@ 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)
@@ -238,7 +242,28 @@ Frame *LibFAMEWrapper::encode(Frame *dvframe)
pt += written;
output->size += written;
}
- fame_end_frame(fame_context,0);
+ 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,
+ stats.coding,
+ stats.target_bits,
+ stats.actual_bits,
+ stats.spatial_activity,
+ stats.quant_scale);
+ */
+ /*
+ fame_frame_statistics_t_ {
+ unsigned int frame_number;
+ char coding;
+ signed int target_bits;
+ unsigned int actual_bits;
+ unsigned int spatial_activity;
+ float quant_scale;
+ }
+ */
+ calc_bitrate += stats.actual_bits;
+ output->bitrate = (unsigned int)(((double)calc_bitrate / (double)(stats.frame_number+1)) * 25.0);
return output;
}