diff --git a/webrtc/modules/video_processing/main/source/color_enhancement.cc b/webrtc/modules/video_processing/main/source/color_enhancement.cc index bbe23793a..eeec01659 100644 --- a/webrtc/modules/video_processing/main/source/color_enhancement.cc +++ b/webrtc/modules/video_processing/main/source/color_enhancement.cc @@ -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 diff --git a/webrtc/modules/video_processing/main/source/color_enhancement.h b/webrtc/modules/video_processing/main/source/color_enhancement.h index 9bf4ee984..233a47fe8 100644 --- a/webrtc/modules/video_processing/main/source/color_enhancement.h +++ b/webrtc/modules/video_processing/main/source/color_enhancement.h @@ -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 diff --git a/webrtc/modules/video_processing/main/source/color_enhancement_private.h b/webrtc/modules/video_processing/main/source/color_enhancement_private.h index 0b4891572..e5789105a 100644 --- a/webrtc/modules/video_processing/main/source/color_enhancement_private.h +++ b/webrtc/modules/video_processing/main/source/color_enhancement_private.h @@ -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 \ No newline at end of file +} // namespace VideoProcessing +} // namespace webrtc + +#endif // WEBRTC_MODULES_VIDEO_PROCESSING_MAIN_SOURCE_COLOR_ENHANCEMENT_PRIVATE_H_