MCPcopy Create free account
hub / github.com/Vanilagy/webcodecs-polyfill / getPixelFormatInfo

Function getPixelFormatInfo

src/video_frame.ts:1162–1291  ·  view source on GitHub ↗
(format: string)

Source from the content-addressed store, hash-verified

1160};
1161
1162const getPixelFormatInfo = (format: string): PixelFormatInfo | null => {
1163 switch (format) {
1164 case 'I420':
1165 return {
1166 planes: [
1167 { sampleWidth: 1, sampleHeight: 1, bytesPerSample: 1 }, // Y
1168 { sampleWidth: 2, sampleHeight: 2, bytesPerSample: 1 }, // U
1169 { sampleWidth: 2, sampleHeight: 2, bytesPerSample: 1 }, // V
1170 ],
1171 };
1172 case 'I420P10':
1173 case 'I420P12':
1174 return {
1175 planes: [
1176 { sampleWidth: 1, sampleHeight: 1, bytesPerSample: 2 },
1177 { sampleWidth: 2, sampleHeight: 2, bytesPerSample: 2 },
1178 { sampleWidth: 2, sampleHeight: 2, bytesPerSample: 2 },
1179 ],
1180 };
1181 case 'I420A':
1182 return {
1183 planes: [
1184 { sampleWidth: 1, sampleHeight: 1, bytesPerSample: 1 }, // Y
1185 { sampleWidth: 2, sampleHeight: 2, bytesPerSample: 1 }, // U
1186 { sampleWidth: 2, sampleHeight: 2, bytesPerSample: 1 }, // V
1187 { sampleWidth: 1, sampleHeight: 1, bytesPerSample: 1 }, // A
1188 ],
1189 };
1190 case 'I420AP10':
1191 case 'I420AP12':
1192 return {
1193 planes: [
1194 { sampleWidth: 1, sampleHeight: 1, bytesPerSample: 2 },
1195 { sampleWidth: 2, sampleHeight: 2, bytesPerSample: 2 },
1196 { sampleWidth: 2, sampleHeight: 2, bytesPerSample: 2 },
1197 { sampleWidth: 1, sampleHeight: 1, bytesPerSample: 2 },
1198 ],
1199 };
1200 case 'I422':
1201 return {
1202 planes: [
1203 { sampleWidth: 1, sampleHeight: 1, bytesPerSample: 1 },
1204 { sampleWidth: 2, sampleHeight: 1, bytesPerSample: 1 },
1205 { sampleWidth: 2, sampleHeight: 1, bytesPerSample: 1 },
1206 ],
1207 };
1208 case 'I422P10':
1209 case 'I422P12':
1210 return {
1211 planes: [
1212 { sampleWidth: 1, sampleHeight: 1, bytesPerSample: 2 },
1213 { sampleWidth: 2, sampleHeight: 1, bytesPerSample: 2 },
1214 { sampleWidth: 2, sampleHeight: 1, bytesPerSample: 2 },
1215 ],
1216 };
1217 case 'I422A':
1218 return {
1219 planes: [

Callers 4

copyToMethod · 0.85
ConvertToRGBFrameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected