Mapping from PixelInformationBox subsampling_type and subsampling_location as defined in ISO/IEC 23008-12:2024/CDAM 2:2025 section 6.5.6.3 to chroma_sample_position as defined in AV1 specification Section 6.4.2.
| 410 | // Mapping from PixelInformationBox subsampling_type and subsampling_location as defined in ISO/IEC 23008-12:2024/CDAM 2:2025 section 6.5.6.3 |
| 411 | // to chroma_sample_position as defined in AV1 specification Section 6.4.2. |
| 412 | static uint8_t avifSubsamplingLocationToChromaSamplePosition(uint8_t subsamplingType, uint8_t subsamplingLocation) |
| 413 | { |
| 414 | if (subsamplingType == AVIF_PIXI_444) { |
| 415 | return AVIF_CHROMA_SAMPLE_POSITION_COLOCATED; |
| 416 | } |
| 417 | if (subsamplingType == AVIF_PIXI_422) { |
| 418 | if (subsamplingLocation == 0 || subsamplingLocation == 2 || subsamplingLocation == 4) { |
| 419 | return AVIF_CHROMA_SAMPLE_POSITION_COLOCATED; |
| 420 | } |
| 421 | } |
| 422 | if (subsamplingType == AVIF_PIXI_420) { |
| 423 | if (subsamplingLocation == 0) { |
| 424 | return AVIF_CHROMA_SAMPLE_POSITION_VERTICAL; |
| 425 | } |
| 426 | if (subsamplingLocation == 2) { |
| 427 | return AVIF_CHROMA_SAMPLE_POSITION_COLOCATED; |
| 428 | } |
| 429 | } |
| 430 | if (subsamplingType == AVIF_PIXI_411) { |
| 431 | if (subsamplingLocation == 0 || subsamplingLocation == 2 || subsamplingLocation == 4) { |
| 432 | return AVIF_CHROMA_SAMPLE_POSITION_COLOCATED; |
| 433 | } |
| 434 | } |
| 435 | if (subsamplingType == AVIF_PIXI_440) { |
| 436 | if (subsamplingLocation == 0 || subsamplingLocation == 1) { |
| 437 | return AVIF_CHROMA_SAMPLE_POSITION_VERTICAL; |
| 438 | } |
| 439 | if (subsamplingLocation == 2 || subsamplingLocation == 3) { |
| 440 | return AVIF_CHROMA_SAMPLE_POSITION_COLOCATED; |
| 441 | } |
| 442 | } |
| 443 | return AVIF_CHROMA_SAMPLE_POSITION_UNKNOWN; |
| 444 | } |
| 445 | #endif // AVIF_ENABLE_EXPERIMENTAL_EXTENDED_PIXI |
| 446 | |
| 447 | static const avifPropertyArray * avifSampleTableGetProperties(const avifSampleTable * sampleTable, avifCodecType codecType) |
no outgoing calls
no test coverage detected