Coverage Report

Created: 2025-06-22 07:30

/src/assimp/contrib/Open3DGC/o3dgcSC3DMCEncodeParams.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
Copyright (c) 2013 Khaled Mammou - Advanced Micro Devices, Inc.
3
4
Permission is hereby granted, free of charge, to any person obtaining a copy
5
of this software and associated documentation files (the "Software"), to deal
6
in the Software without restriction, including without limitation the rights
7
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
copies of the Software, and to permit persons to whom the Software is
9
furnished to do so, subject to the following conditions:
10
11
The above copyright notice and this permission notice shall be included in
12
all copies or substantial portions of the Software.
13
14
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
THE SOFTWARE.
21
*/
22
23
24
#pragma once
25
#ifndef O3DGC_SC3DMC_ENCODE_PARAMS_H
26
#define O3DGC_SC3DMC_ENCODE_PARAMS_H
27
28
#include "o3dgcCommon.h"
29
30
namespace o3dgc
31
{
32
    class SC3DMCEncodeParams
33
    {
34
    public:
35
        //! Constructor.
36
                                    SC3DMCEncodeParams(void)
37
0
                                    {
38
0
                                        memset(this, 0, sizeof(SC3DMCEncodeParams));
39
0
                                        m_encodeMode        = O3DGC_SC3DMC_ENCODE_MODE_TFAN;
40
0
                                        m_streamTypeMode    = O3DGC_STREAM_TYPE_ASCII;
41
0
                                        m_coordQuantBits    = 14;
42
0
                                        m_normalQuantBits   = 8;
43
0
                                        m_coordPredMode     = O3DGC_SC3DMC_PARALLELOGRAM_PREDICTION;
44
0
                                        m_normalPredMode    = O3DGC_SC3DMC_SURF_NORMALS_PREDICTION;
45
0
                                        for(unsigned long a = 0; a < O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES; ++a)
46
0
                                        {
47
0
                                            m_floatAttributePredMode[a] = O3DGC_SC3DMC_DIFFERENTIAL_PREDICTION;
48
0
                                        }
49
0
                                        for(unsigned long a = 0; a < O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES; ++a)
50
0
                                        {
51
0
                                            m_intAttributePredMode[a] = O3DGC_SC3DMC_NO_PREDICTION;
52
0
                                        }
53
0
                                    };
54
55
0
        O3DGCStreamType             GetStreamType()    const { return m_streamTypeMode;}
56
0
        O3DGCSC3DMCEncodingMode     GetEncodeMode()    const { return m_encodeMode;}
57
58
0
        unsigned long               GetNumFloatAttributes() const { return m_numFloatAttributes;}
59
0
        unsigned long               GetNumIntAttributes()   const { return m_numIntAttributes;}
60
0
        unsigned long               GetCoordQuantBits()     const { return m_coordQuantBits;}
61
0
        unsigned long               GetNormalQuantBits()    const { return m_normalQuantBits;}
62
        unsigned long               GetFloatAttributeQuantBits(unsigned long a) const
63
0
                                    {
64
0
                                       assert(a < O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);
65
0
                                       return m_floatAttributeQuantBits[a];
66
0
                                    }
67
0
        O3DGCSC3DMCPredictionMode   GetCoordPredMode()    const { return m_coordPredMode; }
68
0
        O3DGCSC3DMCPredictionMode   GetNormalPredMode()   const { return m_normalPredMode; }
69
        O3DGCSC3DMCPredictionMode   GetFloatAttributePredMode(unsigned long a) const
70
0
                                    {
71
0
                                       assert(a < O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);
72
0
                                       return m_floatAttributePredMode[a];
73
0
                                    }
74
        O3DGCSC3DMCPredictionMode   GetIntAttributePredMode(unsigned long a) const
75
0
                                    { 
76
0
                                        assert(a < O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES);
77
0
                                        return m_intAttributePredMode[a];
78
0
                                    }
79
0
        O3DGCSC3DMCPredictionMode & GetCoordPredMode()    { return m_coordPredMode; }
80
0
        O3DGCSC3DMCPredictionMode & GetNormalPredMode()   { return m_normalPredMode; }
81
        O3DGCSC3DMCPredictionMode & GetFloatAttributePredMode(unsigned long a)
82
0
                                    {
83
0
                                       assert(a < O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);
84
0
                                       return m_floatAttributePredMode[a];
85
0
                                    }
86
        O3DGCSC3DMCPredictionMode & GetIntAttributePredMode(unsigned long a)
87
0
                                    {
88
0
                                        assert(a < O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES);
89
0
                                        return m_intAttributePredMode[a];
90
0
                                    }
91
0
        void                        SetStreamType(O3DGCStreamType streamTypeMode)  { m_streamTypeMode = streamTypeMode;}
92
0
        void                        SetEncodeMode(O3DGCSC3DMCEncodingMode encodeMode)  { m_encodeMode = encodeMode;}
93
        void                        SetNumFloatAttributes(unsigned long numFloatAttributes) 
94
0
                                    { 
95
0
                                        assert(numFloatAttributes < O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);
96
0
                                        m_numFloatAttributes = numFloatAttributes;
97
0
                                    }
98
        void                        SetNumIntAttributes  (unsigned long numIntAttributes)
99
0
                                    { 
100
0
                                        assert(numIntAttributes < O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES);
101
0
                                        m_numIntAttributes   = numIntAttributes;
102
0
                                    }
103
0
        void                        SetCoordQuantBits   (unsigned int coordQuantBits   ) { m_coordQuantBits    = coordQuantBits   ; }
104
0
        void                        SetNormalQuantBits  (unsigned int normalQuantBits  ) { m_normalQuantBits   = normalQuantBits  ; }
105
        void                        SetFloatAttributeQuantBits(unsigned long a, unsigned long q) 
106
0
                                    { 
107
0
                                       assert(a < O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);
108
0
                                       m_floatAttributeQuantBits[a] = q;
109
0
                                    }
110
0
        void                        SetCoordPredMode   (O3DGCSC3DMCPredictionMode coordPredMode   ) { m_coordPredMode    = coordPredMode   ; }
111
0
        void                        SetNormalPredMode  (O3DGCSC3DMCPredictionMode normalPredMode  ) { m_normalPredMode   = normalPredMode  ; }
112
        void                        SetFloatAttributePredMode(unsigned long a, O3DGCSC3DMCPredictionMode p) 
113
0
                                    {
114
0
                                       assert(a < O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);
115
0
                                       m_floatAttributePredMode[a] = p;
116
0
                                    }                       
117
        void                        SetIntAttributePredMode(unsigned long a, O3DGCSC3DMCPredictionMode p) 
118
0
                                    { 
119
0
                                        assert(a < O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES);
120
0
                                        m_intAttributePredMode[a] = p;
121
0
                                    }
122
    private:
123
        unsigned long               m_numFloatAttributes;
124
        unsigned long               m_numIntAttributes;
125
        unsigned long               m_coordQuantBits;
126
        unsigned long               m_normalQuantBits;
127
        unsigned long               m_floatAttributeQuantBits[O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES];
128
        
129
        O3DGCSC3DMCPredictionMode   m_coordPredMode;
130
        O3DGCSC3DMCPredictionMode   m_normalPredMode; 
131
        O3DGCSC3DMCPredictionMode   m_floatAttributePredMode[O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES];
132
        O3DGCSC3DMCPredictionMode   m_intAttributePredMode  [O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES];
133
        O3DGCStreamType             m_streamTypeMode;
134
        O3DGCSC3DMCEncodingMode     m_encodeMode;
135
    };
136
}
137
#endif // O3DGC_SC3DMC_ENCODE_PARAMS_H