Using Convert in lieu of ExtractBuffer: Less error prone (as we don't need to compute buffer sizes etc.). This cl is first in a series (doing all of WebRtc would make it quite a big cl). While at it, fixing a few headers.
BUG=988 Review URL: https://webrtc-codereview.appspot.com/995014 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3343 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -144,11 +144,7 @@ int SequenceCoder(webrtc::test::CommandLineParser parser) {
|
||||
unsigned int length = webrtc::CalcBufferSize(webrtc::kI420, width, height);
|
||||
webrtc::scoped_array<uint8_t> frame_buffer(new uint8_t[length]);
|
||||
|
||||
int half_height = (height + 1) / 2;
|
||||
int half_width = (width + 1) / 2;
|
||||
int size_y = width * height;
|
||||
int size_uv = half_width * half_height;
|
||||
|
||||
// Set and register callbacks.
|
||||
Vp8SequenceCoderEncodeCallback encoder_callback(encoded_file);
|
||||
encoder->RegisterEncodeCompleteCallback(&encoder_callback);
|
||||
@ -159,17 +155,15 @@ int SequenceCoder(webrtc::test::CommandLineParser parser) {
|
||||
int64_t starttime = webrtc::TickTime::MillisecondTimestamp();
|
||||
int frame_cnt = 1;
|
||||
int frames_processed = 0;
|
||||
input_frame.CreateEmptyFrame(width, height, width, half_width, half_width);
|
||||
while (!feof(input_file) &&
|
||||
(num_frames == -1 || frames_processed < num_frames)) {
|
||||
if (fread(frame_buffer.get(), 1, length, input_file) != length)
|
||||
continue;
|
||||
if (frame_cnt >= start_frame) {
|
||||
input_frame.CreateFrame(size_y, frame_buffer.get(),
|
||||
size_uv, frame_buffer.get() + size_y,
|
||||
size_uv, frame_buffer.get() + size_y +
|
||||
size_uv,
|
||||
width, height,
|
||||
width, half_width, half_width);
|
||||
webrtc::ConvertToI420(webrtc::kI420, frame_buffer.get(), 0, 0,
|
||||
width, height, 0, webrtc::kRotateNone,
|
||||
&input_frame);
|
||||
encoder->Encode(input_frame, NULL, NULL);
|
||||
decoder->Decode(encoder_callback.encoded_image(), false, NULL);
|
||||
++frames_processed;
|
||||
|
||||
Reference in New Issue
Block a user