@@ -87,16 +87,31 @@ void Pixel::init( const AVPixelFormat avPixelFormat )
87
87
88
88
setSubsampling ( eSubsamplingNone );
89
89
90
- if ( ( pix_desc->log2_chroma_w == true ) &&
91
- ( pix_desc->log2_chroma_h == false ) )
90
+ if ( ( pix_desc->log2_chroma_w == 0 ) &&
91
+ ( pix_desc->log2_chroma_h == 1 ) )
92
+ {
93
+ setSubsampling ( eSubsampling440 );
94
+ }
95
+ else if ( ( pix_desc->log2_chroma_w == 1 ) &&
96
+ ( pix_desc->log2_chroma_h == 0 ) )
92
97
{
93
98
setSubsampling ( eSubsampling422 );
94
99
}
95
- if ( ( pix_desc->log2_chroma_w == true ) &&
96
- ( pix_desc->log2_chroma_h == true ) )
100
+ else if ( ( pix_desc->log2_chroma_w == 1 ) &&
101
+ ( pix_desc->log2_chroma_h == 1 ) )
97
102
{
98
103
setSubsampling ( eSubsampling420 );
99
104
}
105
+ else if ( ( pix_desc->log2_chroma_w == 3 ) &&
106
+ ( pix_desc->log2_chroma_h == 0 ) )
107
+ {
108
+ setSubsampling ( eSubsampling411 );
109
+ }
110
+ else if ( ( pix_desc->log2_chroma_w == 2 ) &&
111
+ ( pix_desc->log2_chroma_h == 2 ) )
112
+ {
113
+ setSubsampling ( eSubsampling410 );
114
+ }
100
115
}
101
116
102
117
bool Pixel::asCorrectColorComponents ( const AVPixFmtDescriptor* pix_desc, const EComponentType componentType ) const
@@ -114,18 +129,33 @@ bool Pixel::asCorrectSubsampling( const AVPixFmtDescriptor* pix_desc, const ESub
114
129
{
115
130
case eSubsamplingNone :
116
131
{
117
- return ( pix_desc->log2_chroma_w == false ) &&
118
- ( pix_desc->log2_chroma_h == false );
132
+ return ( pix_desc->log2_chroma_w == 0 ) &&
133
+ ( pix_desc->log2_chroma_h == 0 );
134
+ }
135
+ case eSubsampling440 :
136
+ {
137
+ return ( pix_desc->log2_chroma_w == 0 ) &&
138
+ ( pix_desc->log2_chroma_h == 1 );
119
139
}
120
140
case eSubsampling422 :
121
141
{
122
- return ( pix_desc->log2_chroma_w == true ) &&
123
- ( pix_desc->log2_chroma_h == false );
142
+ return ( pix_desc->log2_chroma_w == 1 ) &&
143
+ ( pix_desc->log2_chroma_h == 0 );
124
144
}
125
145
case eSubsampling420 :
126
146
{
127
- return ( pix_desc->log2_chroma_w == true ) &&
128
- ( pix_desc->log2_chroma_h == true );
147
+ return ( pix_desc->log2_chroma_w == 1 ) &&
148
+ ( pix_desc->log2_chroma_h == 1 );
149
+ }
150
+ case eSubsampling411:
151
+ {
152
+ return ( pix_desc->log2_chroma_w == 3 ) &&
153
+ ( pix_desc->log2_chroma_h == 0 );
154
+ }
155
+ case eSubsampling410 :
156
+ {
157
+ return ( pix_desc->log2_chroma_w == 2 ) &&
158
+ ( pix_desc->log2_chroma_h == 2 );
129
159
}
130
160
}
131
161
return false ;
0 commit comments