Remove DISABLE_YUV flag

R=fbarchard@google.com, pbos@webrtc.org, tommi@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/41979004

Cr-Commit-Position: refs/heads/master@{#8402}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8402 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
magjed@webrtc.org 2015-02-18 08:47:13 +00:00
parent 97aaf68fed
commit dd4a8da68a
4 changed files with 2 additions and 53 deletions

View File

@ -27,30 +27,22 @@
#include "talk/media/base/cpuid.h"
#if !defined(DISABLE_YUV)
#include "libyuv/cpu_id.h"
#endif
namespace cricket {
bool CpuInfo::TestCpuFlag(int flag) {
#if !defined(DISABLE_YUV)
return libyuv::TestCpuFlag(flag) ? true : false;
#else
return false;
#endif
}
void CpuInfo::MaskCpuFlagsForTest(int enable_flags) {
#if !defined(DISABLE_YUV)
libyuv::MaskCpuFlags(enable_flags);
#endif
}
// Detect an Intel Core I5 or better such as 4th generation Macbook Air.
bool IsCoreIOrBetter() {
#if !defined(DISABLE_YUV) && (defined(__i386__) || defined(__x86_64__) || \
defined(_M_IX86) || defined(_M_X64))
#if defined(__i386__) || defined(__x86_64__) || \
defined(_M_IX86) || defined(_M_X64)
uint32 cpu_info[4];
libyuv::CpuId(0, 0, &cpu_info[0]); // Function 0: Vendor ID
if (cpu_info[1] == 0x756e6547 && cpu_info[3] == 0x49656e69 &&

View File

@ -31,9 +31,7 @@
#include <string>
#include <vector>
#if !defined(DISABLE_YUV)
#include "libyuv/compare.h"
#endif
#include "talk/media/base/mediachannel.h"
#include "talk/media/base/videocapturer.h"
#include "talk/media/base/videocommon.h"
@ -185,28 +183,13 @@ std::string GetTestFilePath(const std::string& filename);
// PSNR formula: psnr = 10 * log10 (Peak Signal^2 / mse)
// sse is set to a small number for identical frames or sse == 0
static inline double ComputePSNR(double sse, double count) {
#if !defined(DISABLE_YUV)
return libyuv::SumSquareErrorToPsnr(static_cast<uint64>(sse),
static_cast<uint64>(count));
#else
if (sse <= 0.)
sse = 65025.0 * count / pow(10., 128./10.); // produces max PSNR of 128
return 10.0 * log10(65025.0 * count / sse);
#endif
}
static inline double ComputeSumSquareError(const uint8 *org, const uint8 *rec,
int size) {
#if !defined(DISABLE_YUV)
return static_cast<double>(libyuv::ComputeSumSquareError(org, rec, size));
#else
double sse = 0.;
for (int j = 0; j < size; ++j) {
const int diff = static_cast<int>(org[j]) - static_cast<int>(rec[j]);
sse += static_cast<double>(diff * diff);
}
return sse;
#endif
}
// Loads the image with the specified prefix and size into |out|.

View File

@ -31,9 +31,7 @@
#include <algorithm>
#if !defined(DISABLE_YUV)
#include "libyuv/scale_argb.h"
#endif
#include "talk/media/base/videoframefactory.h"
#include "talk/media/base/videoprocessor.h"
#include "webrtc/base/common.h"
@ -385,7 +383,6 @@ void VideoCapturer::OnFrameCaptured(VideoCapturer*,
if (SignalVideoFrame.is_empty()) {
return;
}
#if !defined(DISABLE_YUV)
// Use a temporary buffer to scale
rtc::scoped_ptr<uint8[]> scale_buffer;
@ -505,7 +502,6 @@ void VideoCapturer::OnFrameCaptured(VideoCapturer*,
modified_frame->data_size = modified_frame_size;
modified_frame->data = temp_buffer_data;
}
#endif // !DISABLE_YUV
// Size to crop captured frame to. This adjusts the captured frames
// aspect ratio to match the final view aspect ratio, considering pixel

View File

@ -29,12 +29,9 @@
#include <string.h>
#if !defined(DISABLE_YUV)
#include "libyuv/compare.h"
#include "libyuv/planar_functions.h"
#include "libyuv/scale.h"
#endif
#include "talk/media/base/videocommon.h"
#include "webrtc/base/logging.h"
@ -86,7 +83,6 @@ rtc::StreamResult VideoFrame::Write(rtc::StreamInterface* stream,
bool VideoFrame::CopyToPlanes(
uint8* dst_y, uint8* dst_u, uint8* dst_v,
int32 dst_pitch_y, int32 dst_pitch_u, int32 dst_pitch_v) const {
#if !defined(DISABLE_YUV)
int32 src_width = static_cast<int>(GetWidth());
int32 src_height = static_cast<int>(GetHeight());
return libyuv::I420Copy(GetYPlane(), GetYPitch(),
@ -96,13 +92,6 @@ bool VideoFrame::CopyToPlanes(
dst_u, dst_pitch_u,
dst_v, dst_pitch_v,
src_width, src_height) == 0;
#else
int uv_size = GetUPitch() * GetChromaHeight();
memcpy(dst_y, GetYPlane(), GetWidth() * GetHeight());
memcpy(dst_u, GetUPlane(), uv_size);
memcpy(dst_v, GetVPlane(), uv_size);
return true;
#endif
}
void VideoFrame::CopyToFrame(VideoFrame* dst) const {
@ -176,15 +165,12 @@ void VideoFrame::StretchToPlanes(
}
}
// TODO(fbarchard): Implement a simple scale for non-libyuv.
#if !defined(DISABLE_YUV)
// Scale to the output I420 frame.
libyuv::Scale(src_y, src_u, src_v,
GetYPitch(), GetUPitch(), GetVPitch(),
static_cast<int>(src_width), static_cast<int>(src_height),
dst_y, dst_u, dst_v, dst_pitch_y, dst_pitch_u, dst_pitch_v,
static_cast<int>(width), static_cast<int>(height), interpolate);
#endif
}
size_t VideoFrame::StretchToBuffer(size_t dst_width, size_t dst_height,
@ -237,7 +223,6 @@ VideoFrame* VideoFrame::Stretch(size_t dst_width, size_t dst_height,
}
bool VideoFrame::SetToBlack() {
#if !defined(DISABLE_YUV)
return libyuv::I420Rect(GetYPlane(), GetYPitch(),
GetUPlane(), GetUPitch(),
GetVPlane(), GetVPitch(),
@ -245,13 +230,6 @@ bool VideoFrame::SetToBlack() {
static_cast<int>(GetWidth()),
static_cast<int>(GetHeight()),
16, 128, 128) == 0;
#else
int uv_size = GetUPitch() * GetChromaHeight();
memset(GetYPlane(), 16, GetWidth() * GetHeight());
memset(GetUPlane(), 128, uv_size);
memset(GetVPlane(), 128, uv_size);
return true;
#endif
}
static const size_t kMaxSampleSize = 1000000000u;