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

Side by Side Diff: webrtc/common_video/libyuv/webrtc_libyuv.cc

Issue 2681683003: Added Vp9 simulcast tests. (Closed)
Patch Set: rebase Created 3 years, 10 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
« no previous file with comments | « no previous file | webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 src_frame.video_frame_buffer()->StrideY(), 281 src_frame.video_frame_buffer()->StrideY(),
282 src_frame.video_frame_buffer()->DataU(), 282 src_frame.video_frame_buffer()->DataU(),
283 src_frame.video_frame_buffer()->StrideU(), 283 src_frame.video_frame_buffer()->StrideU(),
284 src_frame.video_frame_buffer()->DataV(), 284 src_frame.video_frame_buffer()->DataV(),
285 src_frame.video_frame_buffer()->StrideV(), 285 src_frame.video_frame_buffer()->StrideV(),
286 dst_frame, dst_sample_size, 286 dst_frame, dst_sample_size,
287 src_frame.width(), src_frame.height(), 287 src_frame.width(), src_frame.height(),
288 ConvertVideoType(dst_video_type)); 288 ConvertVideoType(dst_video_type));
289 } 289 }
290 290
291 // Compute PSNR for an I420 frame (all planes) 291 // Compute PSNR for an I420 frame (all planes). Can upscale test frame.
292 double I420PSNR(const VideoFrameBuffer& ref_buffer, 292 double I420PSNR(const VideoFrameBuffer& ref_buffer,
293 const VideoFrameBuffer& test_buffer) { 293 const VideoFrameBuffer& test_buffer) {
294 RTC_DCHECK_GE(ref_buffer.width(), test_buffer.width());
295 RTC_DCHECK_GE(ref_buffer.height(), test_buffer.height());
294 if ((ref_buffer.width() != test_buffer.width()) || 296 if ((ref_buffer.width() != test_buffer.width()) ||
295 (ref_buffer.height() != test_buffer.height())) 297 (ref_buffer.height() != test_buffer.height())) {
296 return -1; 298 rtc::scoped_refptr<I420Buffer> scaled_buffer =
297 else if (ref_buffer.width() < 0 || ref_buffer.height() < 0) 299 I420Buffer::Create(ref_buffer.width(), ref_buffer.height());
298 return -1; 300 scaled_buffer->ScaleFrom(test_buffer);
299 301 return I420PSNR(ref_buffer, *scaled_buffer);
300 double psnr = libyuv::I420Psnr(ref_buffer.DataY(), ref_buffer.StrideY(), 302 }
301 ref_buffer.DataU(), ref_buffer.StrideU(), 303 double psnr = libyuv::I420Psnr(
302 ref_buffer.DataV(), ref_buffer.StrideV(), 304 ref_buffer.DataY(), ref_buffer.StrideY(), ref_buffer.DataU(),
303 test_buffer.DataY(), test_buffer.StrideY(), 305 ref_buffer.StrideU(), ref_buffer.DataV(), ref_buffer.StrideV(),
304 test_buffer.DataU(), test_buffer.StrideU(), 306 test_buffer.DataY(), test_buffer.StrideY(), test_buffer.DataU(),
305 test_buffer.DataV(), test_buffer.StrideV(), 307 test_buffer.StrideU(), test_buffer.DataV(), test_buffer.StrideV(),
306 test_buffer.width(), test_buffer.height()); 308 test_buffer.width(), test_buffer.height());
307 // LibYuv sets the max psnr value to 128, we restrict it here. 309 // LibYuv sets the max psnr value to 128, we restrict it here.
308 // In case of 0 mse in one frame, 128 can skew the results significantly. 310 // In case of 0 mse in one frame, 128 can skew the results significantly.
309 return (psnr > kPerfectPSNR) ? kPerfectPSNR : psnr; 311 return (psnr > kPerfectPSNR) ? kPerfectPSNR : psnr;
310 } 312 }
311 313
312 // Compute PSNR for an I420 frame (all planes) 314 // Compute PSNR for an I420 frame (all planes)
313 double I420PSNR(const VideoFrame* ref_frame, const VideoFrame* test_frame) { 315 double I420PSNR(const VideoFrame* ref_frame, const VideoFrame* test_frame) {
314 if (!ref_frame || !test_frame) 316 if (!ref_frame || !test_frame)
315 return -1; 317 return -1;
316 return I420PSNR(*ref_frame->video_frame_buffer(), 318 return I420PSNR(*ref_frame->video_frame_buffer(),
317 *test_frame->video_frame_buffer()); 319 *test_frame->video_frame_buffer());
318 } 320 }
319 321
320 // Compute SSIM for an I420 frame (all planes) 322 // Compute SSIM for an I420 frame (all planes). Can upscale test_buffer.
321 double I420SSIM(const VideoFrameBuffer& ref_buffer, 323 double I420SSIM(const VideoFrameBuffer& ref_buffer,
322 const VideoFrameBuffer& test_buffer) { 324 const VideoFrameBuffer& test_buffer) {
325 RTC_DCHECK_GE(ref_buffer.width(), test_buffer.width());
326 RTC_DCHECK_GE(ref_buffer.height(), test_buffer.height());
323 if ((ref_buffer.width() != test_buffer.width()) || 327 if ((ref_buffer.width() != test_buffer.width()) ||
324 (ref_buffer.height() != test_buffer.height())) 328 (ref_buffer.height() != test_buffer.height())) {
325 return -1; 329 rtc::scoped_refptr<I420Buffer> scaled_buffer =
326 else if (ref_buffer.width() < 0 || ref_buffer.height() < 0) 330 I420Buffer::Create(ref_buffer.width(), ref_buffer.height());
327 return -1; 331 scaled_buffer->ScaleFrom(test_buffer);
328 332 return I420SSIM(ref_buffer, *scaled_buffer);
329 return libyuv::I420Ssim(ref_buffer.DataY(), ref_buffer.StrideY(), 333 }
330 ref_buffer.DataU(), ref_buffer.StrideU(), 334 return libyuv::I420Ssim(
331 ref_buffer.DataV(), ref_buffer.StrideV(), 335 ref_buffer.DataY(), ref_buffer.StrideY(), ref_buffer.DataU(),
332 test_buffer.DataY(), test_buffer.StrideY(), 336 ref_buffer.StrideU(), ref_buffer.DataV(), ref_buffer.StrideV(),
333 test_buffer.DataU(), test_buffer.StrideU(), 337 test_buffer.DataY(), test_buffer.StrideY(), test_buffer.DataU(),
334 test_buffer.DataV(), test_buffer.StrideV(), 338 test_buffer.StrideU(), test_buffer.DataV(), test_buffer.StrideV(),
335 test_buffer.width(), test_buffer.height()); 339 test_buffer.width(), test_buffer.height());
336 } 340 }
337 double I420SSIM(const VideoFrame* ref_frame, const VideoFrame* test_frame) { 341 double I420SSIM(const VideoFrame* ref_frame, const VideoFrame* test_frame) {
338 if (!ref_frame || !test_frame) 342 if (!ref_frame || !test_frame)
339 return -1; 343 return -1;
340 return I420SSIM(*ref_frame->video_frame_buffer(), 344 return I420SSIM(*ref_frame->video_frame_buffer(),
341 *test_frame->video_frame_buffer()); 345 *test_frame->video_frame_buffer());
342 } 346 }
343 347
344 void NV12Scale(std::vector<uint8_t>* tmp_buffer, 348 void NV12Scale(std::vector<uint8_t>* tmp_buffer,
345 const uint8_t* src_y, int src_stride_y, 349 const uint8_t* src_y, int src_stride_y,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 src_v, src_uv_width, 446 src_v, src_uv_width,
443 src_width, src_height, 447 src_width, src_height,
444 dst_y, dst_stride_y, 448 dst_y, dst_stride_y,
445 dst_u, dst_stride_u, 449 dst_u, dst_stride_u,
446 dst_v, dst_stride_v, 450 dst_v, dst_stride_v,
447 dst_width, dst_height, 451 dst_width, dst_height,
448 libyuv::kFilterBox); 452 libyuv::kFilterBox);
449 } 453 }
450 454
451 } // namespace webrtc 455 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698