blob: aff2d613fd5c6caffd3478b0d801aaf6cf27c6a5 [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"
niklase@google.com470e71d2011-07-07 08:21:25 +000021
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000022namespace webrtc {
niklase@google.com470e71d2011-07-07 08:21:25 +000023
sprang@webrtc.org40709352013-11-26 11:41:59 +000024class EncodedImageCallback;
pbos@webrtc.orgfe1ef932013-10-21 10:34:43 +000025class I420FrameCallback;
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000026class VideoEngine;
niklase@google.com470e71d2011-07-07 08:21:25 +000027
28// This class declares an abstract interface for a user defined effect filter.
29// The effect filter is registered using RegisterCaptureEffectFilter(),
30// RegisterSendEffectFilter() or RegisterRenderEffectFilter() and deregistered
31// with the corresponding deregister function.
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000032class WEBRTC_DLLEXPORT ViEEffectFilter {
33 public:
34 // This method is called with an I420 video frame allowing the user to
35 // modify the video frame.
mikhal@webrtc.org9fedff72012-10-24 18:33:04 +000036 virtual int Transform(int size, unsigned char* frameBuffer,
37 unsigned int timeStamp90KHz, unsigned int width,
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000038 unsigned int height) = 0;
39 protected:
40 ViEEffectFilter() {}
41 virtual ~ViEEffectFilter() {}
niklase@google.com470e71d2011-07-07 08:21:25 +000042};
43
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000044class WEBRTC_DLLEXPORT ViEImageProcess {
45 public:
46 // Factory for the ViEImageProcess sub‐API and increases an internal
47 // reference counter if successful. Returns NULL if the API is not supported
48 // or if construction fails.
49 static ViEImageProcess* GetInterface(VideoEngine* video_engine);
niklase@google.com470e71d2011-07-07 08:21:25 +000050
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000051 // Releases the ViEImageProcess sub-API and decreases an internal reference
52 // counter. Returns the new reference count. This value should be zero
53 // for all sub-API:s before the VideoEngine object can be safely deleted.
54 virtual int Release() = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000055
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000056 // This function registers a EffectFilter to use for a specified capture
57 // device.
58 virtual int RegisterCaptureEffectFilter(const int capture_id,
59 ViEEffectFilter& capture_filter) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000060
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000061 // This function deregisters a EffectFilter for a specified capture device.
62 virtual int DeregisterCaptureEffectFilter(const int capture_id) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000063
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000064 // This function registers an EffectFilter to use for a specified channel.
65 virtual int RegisterSendEffectFilter(const int video_channel,
66 ViEEffectFilter& send_filter) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000067
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000068 // This function deregisters a send effect filter for a specified channel.
69 virtual int DeregisterSendEffectFilter(const int video_channel) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000070
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000071 // This function registers a EffectFilter to use for the rendered video
72 // stream on an incoming channel.
73 virtual int RegisterRenderEffectFilter(const int video_channel,
74 ViEEffectFilter& render_filter) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000075
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000076 // This function deregisters a render effect filter for a specified channel.
77 virtual int DeregisterRenderEffectFilter(const int video_channel) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000078
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000079 // All cameras run the risk of getting in almost perfect sync with
80 // florescent lamps, which will result in a very annoying flickering of the
81 // image. Most cameras have some type of filter to protect against this but
82 // not all of them succeed. Enabling this function will remove the flicker.
83 virtual int EnableDeflickering(const int capture_id, const bool enable) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000084
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000085 // Some cameras produce very noisy captured images, especially in low‐light
86 // conditions. This functionality will reduce the camera noise.
87 virtual int EnableDenoising(const int capture_id, const bool enable) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000088
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +000089 // This function enhances the colors on the decoded video stream, enabled by
90 // default.
91 virtual int EnableColorEnhancement(const int video_channel,
92 const bool enable) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000093
pbos@webrtc.orgfe1ef932013-10-21 10:34:43 +000094 // New-style callbacks, used by VideoSendStream/VideoReceiveStream.
95 virtual void RegisterPreEncodeCallback(
96 int video_channel,
97 I420FrameCallback* pre_encode_callback) = 0;
98 virtual void DeRegisterPreEncodeCallback(int video_channel) = 0;
99
sprang@webrtc.org40709352013-11-26 11:41:59 +0000100 virtual void RegisterPostEncodeImageCallback(
101 int video_channel,
sprang@webrtc.orgb3ea3af2013-11-27 10:28:27 +0000102 EncodedImageCallback* post_encode_callback) {}
sprang@webrtc.org40709352013-11-26 11:41:59 +0000103 virtual void DeRegisterPostEncodeCallback(int video_channel) {}
104
105 virtual void RegisterPreDecodeImageCallback(
106 int video_channel,
sprang@webrtc.orgb3ea3af2013-11-27 10:28:27 +0000107 EncodedImageCallback* pre_decode_callback) {}
sprang@webrtc.org40709352013-11-26 11:41:59 +0000108 virtual void DeRegisterPreDecodeCallback(int video_channel) {}
109
pbos@webrtc.orgfe1ef932013-10-21 10:34:43 +0000110 virtual void RegisterPreRenderCallback(
111 int video_channel,
112 I420FrameCallback* pre_render_callback) = 0;
113 virtual void DeRegisterPreRenderCallback(int video_channel) = 0;
114
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +0000115 protected:
116 ViEImageProcess() {}
117 virtual ~ViEImageProcess() {}
niklase@google.com470e71d2011-07-07 08:21:25 +0000118};
mflodman@webrtc.orgd5a4d9b2012-01-02 13:04:05 +0000119
120} // namespace webrtc
121
122#endif // WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_IMAGE_PROCESS_H_