blob: e993b9740eb7d341f1967ef3445fd07c51f0d50c [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11// This sub-API supports the following functionalities:
12// - Effect filters
13// - Deflickering
14// - Denoising
15// - Color enhancement
16
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000017#ifndef WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_IMAGE_PROCESS_H_
18#define WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_IMAGE_PROCESS_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000019
20#include "common_types.h"
mikhal@webrtc.org9fedff72012-10-24 18:33:04 +000021#include "common_video/interface/i420_video_frame.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000022
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000023namespace webrtc {
niklase@google.com470e71d2011-07-07 08:21:25 +000024
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000025class VideoEngine;
niklase@google.com470e71d2011-07-07 08:21:25 +000026
27// This class declares an abstract interface for a user defined effect filter.
28// The effect filter is registered using RegisterCaptureEffectFilter(),
29// RegisterSendEffectFilter() or RegisterRenderEffectFilter() and deregistered
30// with the corresponding deregister function.
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000031class WEBRTC_DLLEXPORT ViEEffectFilter {
32 public:
33 // This method is called with an I420 video frame allowing the user to
34 // modify the video frame.
mikhal@webrtc.org9fedff72012-10-24 18:33:04 +000035 virtual int Transform(int size, unsigned char* frameBuffer,
36 unsigned int timeStamp90KHz, unsigned int width,
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000037 unsigned int height) = 0;
38 protected:
39 ViEEffectFilter() {}
40 virtual ~ViEEffectFilter() {}
niklase@google.com470e71d2011-07-07 08:21:25 +000041};
42
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000043class WEBRTC_DLLEXPORT ViEImageProcess {
44 public:
45 // Factory for the ViEImageProcess sub‐API and increases an internal
46 // reference counter if successful. Returns NULL if the API is not supported
47 // or if construction fails.
48 static ViEImageProcess* GetInterface(VideoEngine* video_engine);
niklase@google.com470e71d2011-07-07 08:21:25 +000049
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000050 // Releases the ViEImageProcess sub-API and decreases an internal reference
51 // counter. Returns the new reference count. This value should be zero
52 // for all sub-API:s before the VideoEngine object can be safely deleted.
53 virtual int Release() = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000054
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000055 // This function registers a EffectFilter to use for a specified capture
56 // device.
57 virtual int RegisterCaptureEffectFilter(const int capture_id,
58 ViEEffectFilter& capture_filter) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000059
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000060 // This function deregisters a EffectFilter for a specified capture device.
61 virtual int DeregisterCaptureEffectFilter(const int capture_id) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000062
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000063 // This function registers an EffectFilter to use for a specified channel.
64 virtual int RegisterSendEffectFilter(const int video_channel,
65 ViEEffectFilter& send_filter) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000066
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000067 // This function deregisters a send effect filter for a specified channel.
68 virtual int DeregisterSendEffectFilter(const int video_channel) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000069
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000070 // This function registers a EffectFilter to use for the rendered video
71 // stream on an incoming channel.
72 virtual int RegisterRenderEffectFilter(const int video_channel,
73 ViEEffectFilter& render_filter) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000074
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000075 // This function deregisters a render effect filter for a specified channel.
76 virtual int DeregisterRenderEffectFilter(const int video_channel) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000077
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000078 // All cameras run the risk of getting in almost perfect sync with
79 // florescent lamps, which will result in a very annoying flickering of the
80 // image. Most cameras have some type of filter to protect against this but
81 // not all of them succeed. Enabling this function will remove the flicker.
82 virtual int EnableDeflickering(const int capture_id, const bool enable) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000083
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000084 // Some cameras produce very noisy captured images, especially in low‐light
85 // conditions. This functionality will reduce the camera noise.
86 virtual int EnableDenoising(const int capture_id, const bool enable) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000087
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000088 // This function enhances the colors on the decoded video stream, enabled by
89 // default.
90 virtual int EnableColorEnhancement(const int video_channel,
91 const bool enable) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000092
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000093 protected:
94 ViEImageProcess() {}
95 virtual ~ViEImageProcess() {}
niklase@google.com470e71d2011-07-07 08:21:25 +000096};
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000097
98} // namespace webrtc
99
100#endif // WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_IMAGE_PROCESS_H_