Moving video type convert functionality to libyuv. deleting vplibConversions as it is no longer needed.

Review URL: http://webrtc-codereview.appspot.com/338002

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1298 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mikhal@webrtc.org 2011-12-27 23:45:30 +00:00
parent 9b377aa1da
commit e39de16fa5
6 changed files with 43 additions and 84 deletions

View File

@ -15,6 +15,7 @@
#ifndef WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_LIBYUV_H_
#define WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_LIBYUV_H_
#include "common_types.h" // RawVideoTypes.
#include "typedefs.h"
namespace webrtc {
@ -43,6 +44,10 @@ enum VideoType {
kNumberOfVideoTypes
};
// Conversion between the RawVideoType and the LibYuv videoType.
// TODO(wu): Consolidate types into one type throughout WebRtc.
VideoType RawVideoTypeToCommonVideoVideoType(RawVideoType type);
// Supported rotation
// Direction of rotation - clockwise.
enum VideoRotationMode {

View File

@ -21,6 +21,38 @@
namespace webrtc {
VideoType RawVideoTypeToCommonVideoVideoType(RawVideoType type) {
switch (type) {
case kVideoI420:
return kI420;
case kVideoIYUV:
return kIYUV;
case kVideoRGB24:
return kRGB24;
case kVideoARGB:
return kARGB;
case kVideoARGB4444:
return kARGB4444;
case kVideoRGB565:
return kRGB565;
case kVideoARGB1555:
return kARGB1555;
case kVideoYUY2:
return kYUY2;
case kVideoYV12:
return kYV12;
case kVideoUYVY:
return kUYVY;
case kVideoNV21:
return kNV21;
case kVideoNV12:
return kNV12;
default:
assert(false);
}
return kUnknown;
}
int CalcBufferSize(VideoType type, int width, int height) {
int bits_per_pixel = 32;
switch (type) {

View File

@ -37,13 +37,11 @@
'video_capture_config.h',
'video_capture_delay.h',
'video_capture_impl.h',
'vplib_conversions.h',
'device_info_impl.h',
# DEFINE PLATFORM INDEPENDENT SOURCE FILES
'video_capture_factory.cc',
'video_capture_impl.cc',
'vplib_conversions.cc',
'device_info_impl.cc',
],
'conditions': [

View File

@ -9,13 +9,14 @@
*/
#include "video_capture_impl.h"
#include "trace.h"
#include "common_video/libyuv/include/libyuv.h"
#include "critical_section_wrapper.h"
#include "tick_util.h"
#include "vplib_conversions.h"
#include "video_capture_config.h"
#include "module_common_types.h"
#include "ref_count.h"
#include "tick_util.h"
#include "trace.h"
#include "video_capture_config.h"
#ifdef WEBRTC_ANDROID
#include "video_capture_android.h" // Need inclusion here to set Java environment.
@ -304,7 +305,7 @@ WebRtc_Word32 VideoCaptureImpl::IncomingFrame(WebRtc_UWord8* videoFrame,
if (frameInfo.codecType == kVideoCodecUnknown) // None encoded. Convert to I420.
{
const VideoType commonVideoType = videocapturemodule::
const VideoType commonVideoType =
RawVideoTypeToCommonVideoVideoType(frameInfo.rawType);
int size = CalcBufferSize(commonVideoType, width, height);
if (size != videoFrameLength)

View File

@ -1,51 +0,0 @@
/*
* 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 "vplib_conversions.h"
namespace webrtc
{
namespace videocapturemodule
{
VideoType RawVideoTypeToCommonVideoVideoType(RawVideoType type)
{
switch (type)
{
case kVideoI420:
return kI420;
case kVideoIYUV:
return kIYUV;
case kVideoRGB24:
return kRGB24;
case kVideoARGB:
return kARGB;
case kVideoARGB4444:
return kARGB4444;
case kVideoRGB565:
return kRGB565;
case kVideoARGB1555:
return kARGB1555;
case kVideoYUY2:
return kYUY2;
case kVideoYV12:
return kYV12;
case kVideoUYVY:
return kUYVY;
case kVideoNV21:
return kNV21;
case kVideoNV12:
return kNV12;
default:
assert(!"RawVideoTypeToCommonVideoVideoType unknown type");
}
return kUnknown;
}
} //namespace videocapturemodule
}//namespace webrtc

View File

@ -1,26 +0,0 @@
/*
* 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.
*/
#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VPLIB_CONVERSIONS_H_
#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VPLIB_CONVERSIONS_H_
#include "video_capture.h"
#include "common_video/libyuv/include/libyuv.h"
// TODO (mikhal): Update file name
namespace webrtc
{
namespace videocapturemodule
{
VideoType RawVideoTypeToCommonVideoVideoType(RawVideoType type);
} // namespace videocapturemodule
} // namespace webrtc
#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VPLIB_CONVERSIONS_H_