diff options
Diffstat (limited to 'chromium/third_party/webrtc/modules/video_processing/main/source/color_enhancement.cc')
-rw-r--r-- | chromium/third_party/webrtc/modules/video_processing/main/source/color_enhancement.cc | 60 |
1 files changed, 27 insertions, 33 deletions
diff --git a/chromium/third_party/webrtc/modules/video_processing/main/source/color_enhancement.cc b/chromium/third_party/webrtc/modules/video_processing/main/source/color_enhancement.cc index eeec01659c0..aaa3a462256 100644 --- a/chromium/third_party/webrtc/modules/video_processing/main/source/color_enhancement.cc +++ b/chromium/third_party/webrtc/modules/video_processing/main/source/color_enhancement.cc @@ -12,44 +12,38 @@ #include "webrtc/modules/video_processing/main/source/color_enhancement.h" #include "webrtc/modules/video_processing/main/source/color_enhancement_private.h" -#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; -} - -// 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); - -// 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; + assert(frame); + // Pointers to U and V color pixels. + uint8_t* ptr_u; + uint8_t* ptr_v; + uint8_t temp_chroma; + if (frame->IsZeroSize()) { + return VPM_GENERAL_ERROR; + } + if (frame->width() == 0 || frame->height() == 0) { + 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); + + // 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 |