1 /* 2 * swapped_buffer.h - swapped buffer 3 * 4 * Copyright (c) 2015 Intel Corporation 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 * 18 * Author: Wind Yuan <feng.yuan@intel.com> 19 */ 20 21 #ifndef XCAM_SWAPPED_BUFFER_H 22 #define XCAM_SWAPPED_BUFFER_H 23 24 #include <xcam_std.h> 25 #include <buffer_pool.h> 26 27 namespace XCam { 28 29 class SwappedBuffer 30 : public virtual BufferProxy 31 { 32 public: 33 enum SwapFlags { 34 SwapNone = 0, 35 SwapY = 1, 36 SwapUV = 2, 37 }; 38 39 enum SwapOffsets { 40 SwapYOffset0 = 0, 41 SwapYOffset1 = 1, 42 SwapUVOffset0 = 2, 43 SwapUVOffset1 = 3, 44 }; 45 46 enum InitOrder { 47 OrderYMask = 0x000F, 48 OrderY0Y1 = 0x0001, 49 OrderY1Y0 = 0x0002, 50 OrderUVMask = 0x0F00, 51 OrderUV0UV1 = 0x0100, 52 OrderUV1UV0 = 0x0200, 53 }; 54 55 protected: 56 explicit SwappedBuffer ( 57 const VideoBufferInfo &info, const SmartPtr<BufferData> &data); 58 59 public: 60 virtual ~SwappedBuffer (); 61 void set_swap_info (uint32_t flags, uint32_t* offsets); 62 63 SmartPtr<SwappedBuffer> swap_clone ( 64 SmartPtr<SwappedBuffer> self, uint32_t flags); 65 66 protected: 67 virtual SmartPtr<SwappedBuffer> create_new_swap_buffer ( 68 const VideoBufferInfo &info, SmartPtr<BufferData> &data); 69 70 bool swap_new_buffer_info ( 71 const VideoBufferInfo &in, uint32_t flags, VideoBufferInfo &out); 72 73 private: 74 XCAM_DEAD_COPY (SwappedBuffer); 75 76 protected: 77 uint32_t _swap_flags; 78 uint32_t _swap_offsets[XCAM_VIDEO_MAX_COMPONENTS * 2]; 79 }; 80 81 } 82 83 #endif //XCAM_SWAPPED_BUFFER_H 84