Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/vp8_sequence_coder.cc

Issue 2354223002: Revert of Move MutableDataY{,U,V} methods to I420Buffer only. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 inst.startBitrate = target_bitrate; 141 inst.startBitrate = target_bitrate;
142 inst.maxBitrate = 8000; 142 inst.maxBitrate = 8000;
143 inst.width = width; 143 inst.width = width;
144 inst.height = height; 144 inst.height = height;
145 145
146 if (encoder->InitEncode(&inst, 1, 1440) < 0) { 146 if (encoder->InitEncode(&inst, 1, 1440) < 0) {
147 fprintf(stderr, "Error: Cannot initialize vp8 encoder\n"); 147 fprintf(stderr, "Error: Cannot initialize vp8 encoder\n");
148 return -1; 148 return -1;
149 } 149 }
150 EXPECT_EQ(0, decoder->InitDecode(&inst, 1)); 150 EXPECT_EQ(0, decoder->InitDecode(&inst, 1));
151 151 webrtc::VideoFrame input_frame;
152 size_t length = webrtc::CalcBufferSize(webrtc::kI420, width, height); 152 size_t length = webrtc::CalcBufferSize(webrtc::kI420, width, height);
153 std::unique_ptr<uint8_t[]> frame_buffer(new uint8_t[length]); 153 std::unique_ptr<uint8_t[]> frame_buffer(new uint8_t[length]);
154 154
155 int half_width = (width + 1) / 2; 155 int half_width = (width + 1) / 2;
156 // Set and register callbacks. 156 // Set and register callbacks.
157 Vp8SequenceCoderEncodeCallback encoder_callback(encoded_file); 157 Vp8SequenceCoderEncodeCallback encoder_callback(encoded_file);
158 encoder->RegisterEncodeCompleteCallback(&encoder_callback); 158 encoder->RegisterEncodeCompleteCallback(&encoder_callback);
159 Vp8SequenceCoderDecodeCallback decoder_callback(output_file); 159 Vp8SequenceCoderDecodeCallback decoder_callback(output_file);
160 decoder->RegisterDecodeCompleteCallback(&decoder_callback); 160 decoder->RegisterDecodeCompleteCallback(&decoder_callback);
161 // Read->Encode->Decode sequence. 161 // Read->Encode->Decode sequence.
162 // num_frames = -1 implies unlimited encoding (entire sequence). 162 // num_frames = -1 implies unlimited encoding (entire sequence).
163 int64_t starttime = rtc::TimeMillis(); 163 int64_t starttime = rtc::TimeMillis();
164 int frame_cnt = 1; 164 int frame_cnt = 1;
165 int frames_processed = 0; 165 int frames_processed = 0;
166 rtc::scoped_refptr<webrtc::I420Buffer> i420_buffer = 166 input_frame.CreateEmptyFrame(width, height, width, half_width, half_width);
167 webrtc::I420Buffer::Create(width, height, width, half_width, half_width);
168
169 while (!feof(input_file) && 167 while (!feof(input_file) &&
170 (num_frames == -1 || frames_processed < num_frames)) { 168 (num_frames == -1 || frames_processed < num_frames)) {
171 if (fread(frame_buffer.get(), 1, length, input_file) != length) 169 if (fread(frame_buffer.get(), 1, length, input_file) != length)
172 continue; 170 continue;
173 if (frame_cnt >= start_frame) { 171 if (frame_cnt >= start_frame) {
174 webrtc::ConvertToI420(webrtc::kI420, frame_buffer.get(), 0, 0, width, 172 webrtc::ConvertToI420(webrtc::kI420, frame_buffer.get(), 0, 0, width,
175 height, 0, webrtc::kVideoRotation_0, &i420_buffer); 173 height, 0, webrtc::kVideoRotation_0, &input_frame);
176 webrtc::VideoFrame input_frame(i420_buffer, 0, 0,
177 webrtc::kVideoRotation_0);
178 encoder->Encode(input_frame, NULL, NULL); 174 encoder->Encode(input_frame, NULL, NULL);
179 decoder->Decode(encoder_callback.encoded_image(), false, NULL); 175 decoder->Decode(encoder_callback.encoded_image(), false, NULL);
180 ++frames_processed; 176 ++frames_processed;
181 } 177 }
182 ++frame_cnt; 178 ++frame_cnt;
183 } 179 }
184 printf("\nProcessed %d frames\n", frames_processed); 180 printf("\nProcessed %d frames\n", frames_processed);
185 int64_t endtime = rtc::TimeMillis(); 181 int64_t endtime = rtc::TimeMillis();
186 int64_t totalExecutionTime = endtime - starttime; 182 int64_t totalExecutionTime = endtime - starttime;
187 printf("Total execution time: %.2lf ms\n", 183 printf("Total execution time: %.2lf ms\n",
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 239
244 parser.ProcessFlags(); 240 parser.ProcessFlags();
245 if (parser.GetFlag("help") == "true") { 241 if (parser.GetFlag("help") == "true") {
246 parser.PrintUsageMessage(); 242 parser.PrintUsageMessage();
247 exit(EXIT_SUCCESS); 243 exit(EXIT_SUCCESS);
248 } 244 }
249 parser.PrintEnteredFlags(); 245 parser.PrintEnteredFlags();
250 246
251 return SequenceCoder(&parser); 247 return SequenceCoder(&parser);
252 } 248 }
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc ('k') | webrtc/modules/video_processing/test/denoiser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698