| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #import "RTCShader.h" | 11 #import "RTCShader.h" |
| 12 | 12 |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #import "RTCShader+Private.h" | 15 #import "RTCShader+Private.h" |
| 16 #import "WebRTC/RTCVideoFrame.h" | 16 #import "WebRTC/RTCVideoFrame.h" |
| 17 | 17 |
| 18 #include "webrtc/api/video/video_rotation.h" |
| 18 #include "webrtc/base/optional.h" | 19 #include "webrtc/base/optional.h" |
| 19 #include "webrtc/common_video/rotation.h" | |
| 20 | 20 |
| 21 // |kNumTextures| must not exceed 8, which is the limit in OpenGLES2. Two sets | 21 // |kNumTextures| must not exceed 8, which is the limit in OpenGLES2. Two sets |
| 22 // of 3 textures are used here, one for each of the Y, U and V planes. Having | 22 // of 3 textures are used here, one for each of the Y, U and V planes. Having |
| 23 // two sets alleviates CPU blockage in the event that the GPU is asked to render | 23 // two sets alleviates CPU blockage in the event that the GPU is asked to render |
| 24 // to a texture that is already in use. | 24 // to a texture that is already in use. |
| 25 static const GLsizei kNumTextureSets = 2; | 25 static const GLsizei kNumTextureSets = 2; |
| 26 static const GLsizei kNumTexturesPerSet = 3; | 26 static const GLsizei kNumTexturesPerSet = 3; |
| 27 static const GLsizei kNumTextures = kNumTexturesPerSet * kNumTextureSets; | 27 static const GLsizei kNumTextures = kNumTexturesPerSet * kNumTextureSets; |
| 28 | 28 |
| 29 // Fragment shader converts YUV values from input textures into a final RGB | 29 // Fragment shader converts YUV values from input textures into a final RGB |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 offset:textureOffset + 2 | 213 offset:textureOffset + 2 |
| 214 width:frame.chromaWidth | 214 width:frame.chromaWidth |
| 215 height:frame.chromaHeight | 215 height:frame.chromaHeight |
| 216 stride:frame.vPitch]; | 216 stride:frame.vPitch]; |
| 217 | 217 |
| 218 _currentTextureSet = (_currentTextureSet + 1) % kNumTextureSets; | 218 _currentTextureSet = (_currentTextureSet + 1) % kNumTextureSets; |
| 219 return YES; | 219 return YES; |
| 220 } | 220 } |
| 221 | 221 |
| 222 @end | 222 @end |
| OLD | NEW |