blob: 9a12748e25f5da9247c0e892efba326e47935907 [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
pbos@webrtc.orgf5d4cb12013-05-17 13:44:48 +000020#include "webrtc/common_types.h"
21#include "webrtc/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
pbos@webrtc.orgfe1ef932013-10-21 10:34:43 +000025class I420FrameCallback;
26
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000027class VideoEngine;
niklase@google.com470e71d2011-07-07 08:21:25 +000028
29// This class declares an abstract interface for a user defined effect filter.
30// The effect filter is registered using RegisterCaptureEffectFilter(),
31// RegisterSendEffectFilter() or RegisterRenderEffectFilter() and deregistered
32// with the corresponding deregister function.
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000033class WEBRTC_DLLEXPORT ViEEffectFilter {
34 public:
35 // This method is called with an I420 video frame allowing the user to
36 // modify the video frame.
mikhal@webrtc.org9fedff72012-10-24 18:33:04 +000037 virtual int Transform(int size, unsigned char* frameBuffer,
38 unsigned int timeStamp90KHz, unsigned int width,
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000039 unsigned int height) = 0;
40 protected:
41 ViEEffectFilter() {}
42 virtual ~ViEEffectFilter() {}
niklase@google.com470e71d2011-07-07 08:21:25 +000043};
44
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000045class WEBRTC_DLLEXPORT ViEImageProcess {
46 public:
47 // Factory for the ViEImageProcess sub‐API and increases an internal
48 // reference counter if successful. Returns NULL if the API is not supported
49 // or if construction fails.
50 static ViEImageProcess* GetInterface(VideoEngine* video_engine);
niklase@google.com470e71d2011-07-07 08:21:25 +000051
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000052 // Releases the ViEImageProcess sub-API and decreases an internal reference
53 // counter. Returns the new reference count. This value should be zero
54 // for all sub-API:s before the VideoEngine object can be safely deleted.
55 virtual int Release() = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000056
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000057 // This function registers a EffectFilter to use for a specified capture
58 // device.
59 virtual int RegisterCaptureEffectFilter(const int capture_id,
60 ViEEffectFilter& capture_filter) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000061
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000062 // This function deregisters a EffectFilter for a specified capture device.
63 virtual int DeregisterCaptureEffectFilter(const int capture_id) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000064
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000065 // This function registers an EffectFilter to use for a specified channel.
66 virtual int RegisterSendEffectFilter(const int video_channel,
67 ViEEffectFilter& send_filter) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000068
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000069 // This function deregisters a send effect filter for a specified channel.
70 virtual int DeregisterSendEffectFilter(const int video_channel) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000071
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000072 // This function registers a EffectFilter to use for the rendered video
73 // stream on an incoming channel.
74 virtual int RegisterRenderEffectFilter(const int video_channel,
75 ViEEffectFilter& render_filter) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000076
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000077 // This function deregisters a render effect filter for a specified channel.
78 virtual int DeregisterRenderEffectFilter(const int video_channel) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000079
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000080 // All cameras run the risk of getting in almost perfect sync with
81 // florescent lamps, which will result in a very annoying flickering of the
82 // image. Most cameras have some type of filter to protect against this but
83 // not all of them succeed. Enabling this function will remove the flicker.
84 virtual int EnableDeflickering(const int capture_id, const bool enable) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000085
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000086 // Some cameras produce very noisy captured images, especially in low‐light
87 // conditions. This functionality will reduce the camera noise.
88 virtual int EnableDenoising(const int capture_id, const bool enable) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000089
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000090 // This function enhances the colors on the decoded video stream, enabled by
91 // default.
92 virtual int EnableColorEnhancement(const int video_channel,
93 const bool enable) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000094
pbos@webrtc.orgfe1ef932013-10-21 10:34:43 +000095 // New-style callbacks, used by VideoSendStream/VideoReceiveStream.
96 virtual void RegisterPreEncodeCallback(
97 int video_channel,
98 I420FrameCallback* pre_encode_callback) = 0;
99 virtual void DeRegisterPreEncodeCallback(int video_channel) = 0;
100
101 virtual void RegisterPreRenderCallback(
102 int video_channel,
103 I420FrameCallback* pre_render_callback) = 0;
104 virtual void DeRegisterPreRenderCallback(int video_channel) = 0;
105
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +0000106 protected:
107 ViEImageProcess() {}
108 virtual ~ViEImageProcess() {}
niklase@google.com470e71d2011-07-07 08:21:25 +0000109};
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +0000110
111} // namespace webrtc
112
113#endif // WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_IMAGE_PROCESS_H_