VPM: Fixing namespace

R=marpan@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4930 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mikhal@webrtc.org 2013-10-04 20:21:30 +00:00
parent 4598380860
commit 35e4dd3067
3 changed files with 42 additions and 40 deletions

View File

@ -15,43 +15,42 @@
#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
namespace VideoProcessing {
int32_t ColorEnhancement(I420VideoFrame* frame) {
assert(frame);
// Pointers to U and V color pixels.
uint8_t* ptr_u;
uint8_t* ptr_v;
uint8_t temp_chroma;
if (frame->IsZeroSize()) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoPreocessing,
-1, "Null frame pointer");
return VPM_GENERAL_ERROR;
}
if (frame->width() == 0 || frame->height() == 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoPreocessing,
-1, "Invalid frame size");
return VPM_GENERAL_ERROR;
}
int32_t ColorEnhancement(I420VideoFrame* frame) {
assert(frame);
// Pointers to U and V color pixels.
uint8_t* ptr_u;
uint8_t* ptr_v;
uint8_t temp_chroma;
if (frame->IsZeroSize()) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoPreocessing,
-1, "Null frame pointer");
return VPM_GENERAL_ERROR;
}
// set pointers to first U and V pixels (skip luminance)
ptr_u = frame->buffer(kUPlane);
ptr_v = frame->buffer(kVPlane);
int size_uv = ((frame->width() + 1) / 2) * ((frame->height() + 1) / 2);
if (frame->width() == 0 || frame->height() == 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoPreocessing,
-1, "Invalid frame size");
return VPM_GENERAL_ERROR;
}
// Loop through all chrominance pixels and modify color
for (int ix = 0; ix < size_uv; ix++) {
temp_chroma = colorTable[*ptr_u][*ptr_v];
*ptr_v = colorTable[*ptr_v][*ptr_u];
*ptr_u = temp_chroma;
// Set pointers to first U and V pixels (skip luminance).
ptr_u = frame->buffer(kUPlane);
ptr_v = frame->buffer(kVPlane);
int size_uv = ((frame->width() + 1) / 2) * ((frame->height() + 1) / 2);
ptr_u++;
ptr_v++;
}
return VPM_OK;
// Loop through all chrominance pixels and modify color.
for (int ix = 0; ix < size_uv; ix++) {
temp_chroma = colorTable[*ptr_u][*ptr_v];
*ptr_v = colorTable[*ptr_v][*ptr_u];
*ptr_u = temp_chroma;
ptr_u++;
ptr_v++;
}
return VPM_OK;
}
} // namespace VideoProcessing
} // namespace webrtc

View File

@ -18,11 +18,11 @@
#include "webrtc/typedefs.h"
namespace webrtc {
namespace VideoProcessing {
int32_t ColorEnhancement(I420VideoFrame* frame);
}
int32_t ColorEnhancement(I420VideoFrame* frame);
} // namespace VideoProcessing
} // namespace webrtc
#endif // WEBRTC_MODULES_VIDEO_PROCESSING_COLOR_ENHANCEMENT_H

View File

@ -8,15 +8,16 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef VPM_COLOR_ENHANCEMENT_PRIVATE_H
#define VPM_COLOR_ENHANCEMENT_PRIVATE_H
#ifndef WEBRTC_MODULES_VIDEO_PROCESSING_MAIN_SOURCE_COLOR_ENHANCEMENT_PRIVATE_H_
#define WEBRTC_MODULES_VIDEO_PROCESSING_MAIN_SOURCE_COLOR_ENHANCEMENT_PRIVATE_H_
#include "webrtc/typedefs.h"
namespace webrtc {
namespace VideoProcessing {
//Table created with Matlab script createTable.m
//Usage:
// Table created with Matlab script createTable.m
// Usage:
// Umod=colorTable[U][V]
// Vmod=colorTable[V][U]
static const uint8_t colorTable[256][256] = {
@ -278,6 +279,8 @@ static const uint8_t colorTable[256][256] = {
{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}
};
} // namespace
#endif // VPM_COLOR_ENHANCEMENT_PRIVATE_H
} // namespace VideoProcessing
} // namespace webrtc
#endif // WEBRTC_MODULES_VIDEO_PROCESSING_MAIN_SOURCE_COLOR_ENHANCEMENT_PRIVATE_H_