diff --git a/talk/media/base/cpuid.cc b/talk/media/base/cpuid.cc index bd87d2e3c..8cf912ffb 100644 --- a/talk/media/base/cpuid.cc +++ b/talk/media/base/cpuid.cc @@ -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 && diff --git a/talk/media/base/testutils.h b/talk/media/base/testutils.h index f5a460f0c..1b6f2bacc 100644 --- a/talk/media/base/testutils.h +++ b/talk/media/base/testutils.h @@ -31,9 +31,7 @@ #include #include -#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(sse), static_cast(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(libyuv::ComputeSumSquareError(org, rec, size)); -#else - double sse = 0.; - for (int j = 0; j < size; ++j) { - const int diff = static_cast(org[j]) - static_cast(rec[j]); - sse += static_cast(diff * diff); - } - return sse; -#endif } // Loads the image with the specified prefix and size into |out|. diff --git a/talk/media/base/videocapturer.cc b/talk/media/base/videocapturer.cc index abef449a4..f0bb80a5a 100644 --- a/talk/media/base/videocapturer.cc +++ b/talk/media/base/videocapturer.cc @@ -31,9 +31,7 @@ #include -#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 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 diff --git a/talk/media/base/videoframe.cc b/talk/media/base/videoframe.cc index 19ad934db..96da6a3cb 100644 --- a/talk/media/base/videoframe.cc +++ b/talk/media/base/videoframe.cc @@ -29,12 +29,9 @@ #include -#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(GetWidth()); int32 src_height = static_cast(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(src_width), static_cast(src_height), dst_y, dst_u, dst_v, dst_pitch_y, dst_pitch_u, dst_pitch_v, static_cast(width), static_cast(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(GetWidth()), static_cast(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;