• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*------------------------------------------------------------------------
2  * Vulkan Conformance Tests
3  * ------------------------
4  *
5  * Copyright (c) 2021 The Khronos Group Inc.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  *//*!
20  * \file
21  * \brief Video Encoding and Decoding Utility Functions
22  *//*--------------------------------------------------------------------*/
23 
24 #include "vktVideoPictureUtils.hpp"
25 #include "deMemory.h"
26 
27 using namespace vk;
28 using namespace std;
29 
30 namespace vkt
31 {
32 namespace video
33 {
VulkanPicture()34 VulkanPicture::VulkanPicture()
35 	: m_refCount ()
36 {
37 	Clear();
38 }
39 
~VulkanPicture()40 VulkanPicture::~VulkanPicture ()
41 {
42 }
43 
AddRef()44 void VulkanPicture::AddRef ()
45 {
46 	m_refCount++;
47 }
48 
Release()49 void VulkanPicture::Release ()
50 {
51 	int32_t ref = --m_refCount;
52 
53 	if (ref == 0)
54 		Reset();
55 	else
56 		DE_ASSERT(ref > 0);
57 }
58 
Clear()59 void VulkanPicture::Clear ()
60 {
61 	DE_ASSERT(m_refCount == 0);
62 
63 	decodeWidth = 0;
64 	decodeHeight = 0;
65 	decodeSuperResWidth = 0;
66 	deMemset(&reserved, 0, sizeof(reserved));
67 }
68 
Reset()69 void VulkanPicture::Reset()
70 {
71 	DE_ASSERT(m_refCount == 0);
72 
73 	delete this;
74 }
75 
76 } // video
77 } // vkt
78