| 198 | } |
| 199 | |
| 200 | static int32_t avifSampleTransformOperation32bOneOperand(int32_t operand, uint8_t operator) |
| 201 | { |
| 202 | switch (operator) { |
| 203 | case AVIF_SAMPLE_TRANSFORM_NEGATION: |
| 204 | return avifSampleTransformClamp32b(-(int64_t)operand); |
| 205 | case AVIF_SAMPLE_TRANSFORM_ABSOLUTE: |
| 206 | return operand >= 0 ? operand : avifSampleTransformClamp32b(-(int64_t)operand); |
| 207 | case AVIF_SAMPLE_TRANSFORM_NOT: |
| 208 | return ~operand; |
| 209 | case AVIF_SAMPLE_TRANSFORM_BSR: { |
| 210 | if (operand <= 0) { |
| 211 | return 0; |
| 212 | } |
| 213 | int32_t log2 = 0; |
| 214 | operand >>= 1; |
| 215 | for (; operand != 0; ++log2) { |
| 216 | operand >>= 1; |
| 217 | } |
| 218 | return log2; |
| 219 | } |
| 220 | default: |
| 221 | assert(AVIF_FALSE); |
| 222 | } |
| 223 | return 0; |
| 224 | } |
| 225 | |
| 226 | static int32_t avifSampleTransformOperation32bTwoOperands(int32_t leftOperand, int32_t rightOperand, uint8_t operator) |
| 227 | { |
no test coverage detected