@brief Helper to run a compression on a single 4x4 block */
| 133 | |
| 134 | /** @brief Helper to run a compression on a single 4x4 block */ |
| 135 | static void run_positive_test( |
| 136 | astcenc_profile profile, |
| 137 | float* input |
| 138 | ) { |
| 139 | astcenc_error status; |
| 140 | astcenc_config config; |
| 141 | astcenc_context* context; |
| 142 | |
| 143 | static const astcenc_swizzle swizzle { |
| 144 | ASTCENC_SWZ_R, ASTCENC_SWZ_G, ASTCENC_SWZ_B, ASTCENC_SWZ_A |
| 145 | }; |
| 146 | |
| 147 | astcenc_config_init(profile, 4, 4, 1, ASTCENC_PRE_MEDIUM, 0, &config); |
| 148 | status = astcenc_context_alloc(&config, 1, &context, nullptr); |
| 149 | EXPECT_EQ(status, ASTCENC_SUCCESS); |
| 150 | |
| 151 | // Single 16 byte block output data |
| 152 | uint8_t data[16]; |
| 153 | |
| 154 | astcenc_image image; |
| 155 | image.dim_x = 4u; |
| 156 | image.dim_y = 4u; |
| 157 | image.dim_z = 1u; |
| 158 | image.data_type = ASTCENC_TYPE_F32; |
| 159 | float* slices = input; |
| 160 | image.data = reinterpret_cast<void**>(&slices); |
| 161 | |
| 162 | // Should not error or trip any UBSAN errors |
| 163 | status = astcenc_compress_image(context, &image, &swizzle, data, 16, 0); |
| 164 | EXPECT_EQ(status, ASTCENC_SUCCESS); |
| 165 | |
| 166 | astcenc_context_free(context); |
| 167 | } |
| 168 | |
| 169 | /** @brief Input data contains negative infinities. */ |
| 170 | TEST(compress, data_neg_inf_ldr) |
no test coverage detected