Lines Matching refs:a2b
427 static bool read_mft_common(const mft_CommonLayout* mftTag, skcms_A2B* a2b) { in read_mft_common() argument
432 a2b->matrix_channels = 0; in read_mft_common()
434 a2b->input_channels = mftTag->input_channels[0]; in read_mft_common()
435 a2b->output_channels = mftTag->output_channels[0]; in read_mft_common()
438 if (a2b->output_channels != ARRAY_COUNT(a2b->output_curves)) { in read_mft_common()
442 if (a2b->input_channels < 1 || a2b->input_channels > ARRAY_COUNT(a2b->input_curves)) { in read_mft_common()
446 for (uint32_t i = 0; i < a2b->input_channels; ++i) { in read_mft_common()
447 a2b->grid_points[i] = mftTag->grid_points[0]; in read_mft_common()
450 if (a2b->grid_points[0] < 2) { in read_mft_common()
459 skcms_A2B* a2b) { in init_a2b_tables() argument
465 uint32_t byte_len_all_input_tables = a2b->input_channels * byte_len_per_input_table; in init_a2b_tables()
466 uint32_t byte_len_all_output_tables = a2b->output_channels * byte_len_per_output_table; in init_a2b_tables()
468 uint64_t grid_size = a2b->output_channels * byte_width; in init_a2b_tables()
469 for (uint32_t axis = 0; axis < a2b->input_channels; ++axis) { in init_a2b_tables()
470 grid_size *= a2b->grid_points[axis]; in init_a2b_tables()
477 for (uint32_t i = 0; i < a2b->input_channels; ++i) { in init_a2b_tables()
478 a2b->input_curves[i].table_entries = input_table_entries; in init_a2b_tables()
480 a2b->input_curves[i].table_8 = table_base + i * byte_len_per_input_table; in init_a2b_tables()
481 a2b->input_curves[i].table_16 = nullptr; in init_a2b_tables()
483 a2b->input_curves[i].table_8 = nullptr; in init_a2b_tables()
484 a2b->input_curves[i].table_16 = table_base + i * byte_len_per_input_table; in init_a2b_tables()
489 a2b->grid_8 = table_base + byte_len_all_input_tables; in init_a2b_tables()
490 a2b->grid_16 = nullptr; in init_a2b_tables()
492 a2b->grid_8 = nullptr; in init_a2b_tables()
493 a2b->grid_16 = table_base + byte_len_all_input_tables; in init_a2b_tables()
497 for (uint32_t i = 0; i < a2b->output_channels; ++i) { in init_a2b_tables()
498 a2b->output_curves[i].table_entries = output_table_entries; in init_a2b_tables()
500 a2b->output_curves[i].table_8 = output_table_base + i * byte_len_per_output_table; in init_a2b_tables()
501 a2b->output_curves[i].table_16 = nullptr; in init_a2b_tables()
503 a2b->output_curves[i].table_8 = nullptr; in init_a2b_tables()
504 a2b->output_curves[i].table_16 = output_table_base + i * byte_len_per_output_table; in init_a2b_tables()
511 static bool read_tag_mft1(const skcms_ICCTag* tag, skcms_A2B* a2b) { in read_tag_mft1() argument
517 if (!read_mft_common(mftTag->common, a2b)) { in read_tag_mft1()
525 input_table_entries, output_table_entries, a2b); in read_tag_mft1()
528 static bool read_tag_mft2(const skcms_ICCTag* tag, skcms_A2B* a2b) { in read_tag_mft2() argument
534 if (!read_mft_common(mftTag->common, a2b)) { in read_tag_mft2()
548 input_table_entries, output_table_entries, a2b); in read_tag_mft2()
598 static bool read_tag_mab(const skcms_ICCTag* tag, skcms_A2B* a2b, bool pcs_is_xyz) { in read_tag_mab() argument
605 a2b->input_channels = mABTag->input_channels[0]; in read_tag_mab()
606 a2b->output_channels = mABTag->output_channels[0]; in read_tag_mab()
609 if (a2b->output_channels != ARRAY_COUNT(a2b->output_curves)) { in read_tag_mab()
613 if (a2b->input_channels > ARRAY_COUNT(a2b->input_curves)) { in read_tag_mab()
628 if (!read_curves(tag->buf, tag->size, b_curve_offset, a2b->output_channels, in read_tag_mab()
629 a2b->output_curves)) { in read_tag_mab()
638 a2b->matrix_channels = a2b->output_channels; in read_tag_mab()
639 if (!read_curves(tag->buf, tag->size, m_curve_offset, a2b->matrix_channels, in read_tag_mab()
640 a2b->matrix_curves)) { in read_tag_mab()
650 a2b->matrix.vals[0][0] = encoding_factor * read_big_fixed(mtx_buf + 0); in read_tag_mab()
651 a2b->matrix.vals[0][1] = encoding_factor * read_big_fixed(mtx_buf + 4); in read_tag_mab()
652 a2b->matrix.vals[0][2] = encoding_factor * read_big_fixed(mtx_buf + 8); in read_tag_mab()
653 a2b->matrix.vals[1][0] = encoding_factor * read_big_fixed(mtx_buf + 12); in read_tag_mab()
654 a2b->matrix.vals[1][1] = encoding_factor * read_big_fixed(mtx_buf + 16); in read_tag_mab()
655 a2b->matrix.vals[1][2] = encoding_factor * read_big_fixed(mtx_buf + 20); in read_tag_mab()
656 a2b->matrix.vals[2][0] = encoding_factor * read_big_fixed(mtx_buf + 24); in read_tag_mab()
657 a2b->matrix.vals[2][1] = encoding_factor * read_big_fixed(mtx_buf + 28); in read_tag_mab()
658 a2b->matrix.vals[2][2] = encoding_factor * read_big_fixed(mtx_buf + 32); in read_tag_mab()
659 a2b->matrix.vals[0][3] = encoding_factor * read_big_fixed(mtx_buf + 36); in read_tag_mab()
660 a2b->matrix.vals[1][3] = encoding_factor * read_big_fixed(mtx_buf + 40); in read_tag_mab()
661 a2b->matrix.vals[2][3] = encoding_factor * read_big_fixed(mtx_buf + 44); in read_tag_mab()
666 a2b->matrix_channels = 0; in read_tag_mab()
674 if (!read_curves(tag->buf, tag->size, a_curve_offset, a2b->input_channels, in read_tag_mab()
675 a2b->input_curves)) { in read_tag_mab()
685 a2b->grid_8 = clut->variable; in read_tag_mab()
686 a2b->grid_16 = nullptr; in read_tag_mab()
688 a2b->grid_8 = nullptr; in read_tag_mab()
689 a2b->grid_16 = clut->variable; in read_tag_mab()
694 uint64_t grid_size = a2b->output_channels * clut->grid_byte_width[0]; in read_tag_mab()
695 for (uint32_t i = 0; i < a2b->input_channels; ++i) { in read_tag_mab()
696 a2b->grid_points[i] = clut->grid_points[i]; in read_tag_mab()
698 if (a2b->grid_points[i] < 2) { in read_tag_mab()
701 grid_size *= a2b->grid_points[i]; in read_tag_mab()
712 if (a2b->input_channels != a2b->output_channels) { in read_tag_mab()
717 a2b->input_channels = 0; in read_tag_mab()
777 static bool read_a2b(const skcms_ICCTag* tag, skcms_A2B* a2b, bool pcs_is_xyz) { in read_a2b() argument
780 ok = read_tag_mft1(tag, a2b); in read_a2b()
782 ok = read_tag_mft2(tag, a2b); in read_a2b()
784 ok = read_tag_mab(tag, a2b, pcs_is_xyz); in read_a2b()
792 a2b->input_channels > 0 ? a2b->input_curves + 0 : nullptr, in read_a2b()
793 a2b->input_channels > 1 ? a2b->input_curves + 1 : nullptr, in read_a2b()
794 a2b->input_channels > 2 ? a2b->input_curves + 2 : nullptr, in read_a2b()
795 a2b->input_channels > 3 ? a2b->input_curves + 3 : nullptr, in read_a2b()
796 a2b->matrix_channels > 0 ? a2b->matrix_curves + 0 : nullptr, in read_a2b()
797 a2b->matrix_channels > 1 ? a2b->matrix_curves + 1 : nullptr, in read_a2b()
798 a2b->matrix_channels > 2 ? a2b->matrix_curves + 2 : nullptr, in read_a2b()
799 a2b->output_channels > 0 ? a2b->output_curves + 0 : nullptr, in read_a2b()
800 a2b->output_channels > 1 ? a2b->output_curves + 1 : nullptr, in read_a2b()
801 a2b->output_channels > 2 ? a2b->output_curves + 2 : nullptr, in read_a2b()