Move src/ -> webrtc/
TBR=niklas.enbom@webrtc.org Review URL: https://webrtc-codereview.appspot.com/915006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2963 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
46
webrtc/modules/video_coding/main/test/test_util.cc
Normal file
46
webrtc/modules/video_coding/main/test/test_util.cc
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "test_util.h"
|
||||
#include "test_macros.h"
|
||||
#include "rtp_dump.h"
|
||||
#include <cmath>
|
||||
|
||||
using namespace webrtc;
|
||||
|
||||
// Normal Distribution
|
||||
#define PI 3.14159265
|
||||
double
|
||||
NormalDist(double mean, double stdDev)
|
||||
{
|
||||
// Creating a Normal distribution variable from two independent uniform
|
||||
// variables based on the Box-Muller transform
|
||||
double uniform1 = (std::rand() + 1.0) / (RAND_MAX + 1.0);
|
||||
double uniform2 = (std::rand() + 1.0) / (RAND_MAX + 1.0);
|
||||
return (mean + stdDev * sqrt(-2 * log(uniform1)) * cos(2 * PI * uniform2));
|
||||
}
|
||||
|
||||
RTPVideoCodecTypes
|
||||
ConvertCodecType(const char* plname)
|
||||
{
|
||||
if (strncmp(plname,"VP8" , 3) == 0)
|
||||
{
|
||||
return kRTPVideoVP8;
|
||||
}
|
||||
else if (strncmp(plname,"I420" , 5) == 0)
|
||||
{
|
||||
return kRTPVideoI420;
|
||||
}
|
||||
else
|
||||
{
|
||||
return kRTPVideoNoVideo; // Default value
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user