|
FDL Core Library
ASC Framing Decision List — C/C++ Reference Implementation
|
Value-type operations: dimensions arithmetic, point arithmetic, floating-point comparison. More...
#include "fdl/fdl_core.h"#include "fdl_constants.h"#include <algorithm>#include <cmath>#include <cstdlib>Functions | |
| double | fdl_fp_rel_tol (void) |
| Relative tolerance for floating-point comparison. | |
| double | fdl_fp_abs_tol (void) |
| Absolute tolerance for floating-point comparison. | |
| fdl_dimensions_f64_t | fdl_dimensions_normalize (fdl_dimensions_f64_t dims, double squeeze) |
| Normalize dimensions by applying anamorphic squeeze to width. | |
| fdl_dimensions_f64_t | fdl_dimensions_scale (fdl_dimensions_f64_t dims, double scale_factor, double target_squeeze) |
| Scale normalized dimensions and apply target squeeze. | |
| fdl_dimensions_f64_t | fdl_dimensions_normalize_and_scale (fdl_dimensions_f64_t dims, double input_squeeze, double scale_factor, double target_squeeze) |
| Normalize and scale in one step. | |
| fdl_dimensions_f64_t | fdl_dimensions_sub (fdl_dimensions_f64_t a, fdl_dimensions_f64_t b) |
| Subtract two dimensions: result = a - b. | |
| int | fdl_dimensions_equal (fdl_dimensions_f64_t a, fdl_dimensions_f64_t b) |
| Check if dimensions are approximately equal within FDL tolerance. | |
| int | fdl_dimensions_f64_gt (fdl_dimensions_f64_t a, fdl_dimensions_f64_t b) |
| Check if a > b using OR logic (either width or height is greater). | |
| int | fdl_dimensions_f64_lt (fdl_dimensions_f64_t a, fdl_dimensions_f64_t b) |
| Check if a < b using OR logic (either width or height is less). | |
| int | fdl_dimensions_is_zero (fdl_dimensions_f64_t dims) |
| Check if both width and height are zero. | |
| int | fdl_dimensions_i64_is_zero (fdl_dimensions_i64_t dims) |
| Check if both width and height are zero (int64 variant). | |
| fdl_dimensions_f64_t | fdl_dimensions_i64_normalize (fdl_dimensions_i64_t dims, double squeeze) |
| Normalize int64 dimensions by applying anamorphic squeeze to width. | |
| fdl_dimensions_i64_t | fdl_dimensions_f64_to_i64 (fdl_dimensions_f64_t dims) |
| Convert float dimensions to int64 by truncation. | |
| int | fdl_dimensions_i64_gt (fdl_dimensions_i64_t a, fdl_dimensions_i64_t b) |
| Check if a > b using OR logic (either width or height is greater). | |
| int | fdl_dimensions_i64_lt (fdl_dimensions_i64_t a, fdl_dimensions_i64_t b) |
| Check if a < b using OR logic (either width or height is less). | |
| fdl_point_f64_t | fdl_point_normalize (fdl_point_f64_t point, double squeeze) |
| Normalize a point by applying anamorphic squeeze to x. | |
| fdl_point_f64_t | fdl_point_scale (fdl_point_f64_t point, double scale_factor, double target_squeeze) |
| Scale a normalized point and apply target squeeze. | |
| fdl_point_f64_t | fdl_point_add (fdl_point_f64_t a, fdl_point_f64_t b) |
| Add two points: result = a + b. | |
| fdl_point_f64_t | fdl_point_sub (fdl_point_f64_t a, fdl_point_f64_t b) |
| Subtract two points: result = a - b. | |
| fdl_point_f64_t | fdl_point_mul_scalar (fdl_point_f64_t a, double scalar) |
| Multiply point by scalar. | |
| fdl_point_f64_t | fdl_point_clamp (fdl_point_f64_t point, double min_val, double max_val, int has_min, int has_max) |
| Clamp point values to [min_val, max_val]. | |
| int | fdl_point_is_zero (fdl_point_f64_t point) |
| Check if both x and y are zero. | |
| fdl_point_f64_t | fdl_point_normalize_and_scale (fdl_point_f64_t point, double input_squeeze, double scale_factor, double target_squeeze) |
| Normalize and scale a point in one step. | |
| int | fdl_point_equal (fdl_point_f64_t a, fdl_point_f64_t b) |
| Check approximate equality within FDL tolerances. | |
| int | fdl_point_f64_lt (fdl_point_f64_t a, fdl_point_f64_t b) |
| Check if a < b using OR logic (either x or y is less). | |
| int | fdl_point_f64_gt (fdl_point_f64_t a, fdl_point_f64_t b) |
| Check if a > b using OR logic (either x or y is greater). | |
| void | fdl_free (void *ptr) |
| Free memory allocated by fdl_core functions. | |
Value-type operations: dimensions arithmetic, point arithmetic, floating-point comparison.
| double fdl_fp_rel_tol | ( | void | ) |
Relative tolerance for floating-point comparison.
| double fdl_fp_abs_tol | ( | void | ) |
Absolute tolerance for floating-point comparison.
| fdl_dimensions_f64_t fdl_dimensions_normalize | ( | fdl_dimensions_f64_t | dims, |
| double | squeeze | ||
| ) |
Normalize dimensions by applying anamorphic squeeze to width.
Converts from squeezed (sensor) coordinates to unsqueezed (display) coordinates. width *= squeeze; height unchanged.
| dims | Dimensions to normalize. |
| squeeze | Anamorphic squeeze factor (e.g. 2.0 for 2x anamorphic). |
| fdl_dimensions_f64_t fdl_dimensions_scale | ( | fdl_dimensions_f64_t | dims, |
| double | scale_factor, | ||
| double | target_squeeze | ||
| ) |
Scale normalized dimensions and apply target squeeze.
width = (width * scale_factor) / target_squeeze; height = height * scale_factor.
| dims | Normalized dimensions to scale. |
| scale_factor | Scale multiplier. |
| target_squeeze | Target anamorphic squeeze to apply. |
| fdl_dimensions_f64_t fdl_dimensions_normalize_and_scale | ( | fdl_dimensions_f64_t | dims, |
| double | input_squeeze, | ||
| double | scale_factor, | ||
| double | target_squeeze | ||
| ) |
Normalize and scale in one step.
Equivalent to fdl_dimensions_scale(fdl_dimensions_normalize(dims, input_squeeze), ...).
| dims | Dimensions to transform. |
| input_squeeze | Source anamorphic squeeze factor. |
| scale_factor | Scale multiplier. |
| target_squeeze | Target anamorphic squeeze factor. |
| fdl_dimensions_f64_t fdl_dimensions_sub | ( | fdl_dimensions_f64_t | a, |
| fdl_dimensions_f64_t | b | ||
| ) |
Subtract two dimensions: result = a - b.
| a | Minuend dimensions. |
| b | Subtrahend dimensions. |
| int fdl_dimensions_equal | ( | fdl_dimensions_f64_t | a, |
| fdl_dimensions_f64_t | b | ||
| ) |
Check if dimensions are approximately equal within FDL tolerance.
Uses relative tolerance of 1e-9 and absolute tolerance of 1e-6.
| a | First dimensions. |
| b | Second dimensions. |
| int fdl_dimensions_f64_gt | ( | fdl_dimensions_f64_t | a, |
| fdl_dimensions_f64_t | b | ||
| ) |
Check if a > b using OR logic (either width or height is greater).
| a | First dimensions. |
| b | Second dimensions. |
| int fdl_dimensions_f64_lt | ( | fdl_dimensions_f64_t | a, |
| fdl_dimensions_f64_t | b | ||
| ) |
Check if a < b using OR logic (either width or height is less).
| a | First dimensions. |
| b | Second dimensions. |
| int fdl_dimensions_is_zero | ( | fdl_dimensions_f64_t | dims | ) |
Check if both width and height are zero.
| dims | Dimensions to test. |
| int fdl_dimensions_i64_is_zero | ( | fdl_dimensions_i64_t | dims | ) |
Check if both width and height are zero (int64 variant).
| dims | Integer dimensions to test. |
| fdl_dimensions_f64_t fdl_dimensions_i64_normalize | ( | fdl_dimensions_i64_t | dims, |
| double | squeeze | ||
| ) |
Normalize int64 dimensions by applying anamorphic squeeze to width.
| dims | Integer dimensions to normalize. |
| squeeze | Anamorphic squeeze factor. |
| fdl_dimensions_i64_t fdl_dimensions_f64_to_i64 | ( | fdl_dimensions_f64_t | dims | ) |
Convert float dimensions to int64 by truncation.
| dims | Float dimensions to convert. |
| int fdl_dimensions_i64_gt | ( | fdl_dimensions_i64_t | a, |
| fdl_dimensions_i64_t | b | ||
| ) |
Check if a > b using OR logic (either width or height is greater).
| a | First dimensions. |
| b | Second dimensions. |
| int fdl_dimensions_i64_lt | ( | fdl_dimensions_i64_t | a, |
| fdl_dimensions_i64_t | b | ||
| ) |
Check if a < b using OR logic (either width or height is less).
| a | First dimensions. |
| b | Second dimensions. |
| fdl_point_f64_t fdl_point_normalize | ( | fdl_point_f64_t | point, |
| double | squeeze | ||
| ) |
Normalize a point by applying anamorphic squeeze to x.
| point | Point to normalize. |
| squeeze | Anamorphic squeeze factor. |
| fdl_point_f64_t fdl_point_scale | ( | fdl_point_f64_t | point, |
| double | scale_factor, | ||
| double | target_squeeze | ||
| ) |
Scale a normalized point and apply target squeeze.
x = (x * scale_factor) / target_squeeze; y = y * scale_factor.
| point | Normalized point to scale. |
| scale_factor | Scale multiplier. |
| target_squeeze | Target anamorphic squeeze. |
| fdl_point_f64_t fdl_point_add | ( | fdl_point_f64_t | a, |
| fdl_point_f64_t | b | ||
| ) |
Add two points: result = a + b.
| a | First point. |
| b | Second point. |
| fdl_point_f64_t fdl_point_sub | ( | fdl_point_f64_t | a, |
| fdl_point_f64_t | b | ||
| ) |
Subtract two points: result = a - b.
| a | Minuend point. |
| b | Subtrahend point. |
| fdl_point_f64_t fdl_point_mul_scalar | ( | fdl_point_f64_t | a, |
| double | scalar | ||
| ) |
Multiply point by scalar.
| a | Point to scale. |
| scalar | Scalar multiplier applied to both x and y. |
| fdl_point_f64_t fdl_point_clamp | ( | fdl_point_f64_t | point, |
| double | min_val, | ||
| double | max_val, | ||
| int | has_min, | ||
| int | has_max | ||
| ) |
Clamp point values to [min_val, max_val].
Each bound is optional — set the corresponding has_* flag to enable it.
| point | Point to clamp. |
| min_val | Minimum bound (applied to both x and y). |
| max_val | Maximum bound (applied to both x and y). |
| has_min | FDL_TRUE to apply min_val, FDL_FALSE to skip. |
| has_max | FDL_TRUE to apply max_val, FDL_FALSE to skip. |
| int fdl_point_is_zero | ( | fdl_point_f64_t | point | ) |
Check if both x and y are zero.
| point | Point to test. |
| fdl_point_f64_t fdl_point_normalize_and_scale | ( | fdl_point_f64_t | point, |
| double | input_squeeze, | ||
| double | scale_factor, | ||
| double | target_squeeze | ||
| ) |
Normalize and scale a point in one step.
| point | Point to transform. |
| input_squeeze | Source anamorphic squeeze factor. |
| scale_factor | Scale multiplier. |
| target_squeeze | Target anamorphic squeeze factor. |
| int fdl_point_equal | ( | fdl_point_f64_t | a, |
| fdl_point_f64_t | b | ||
| ) |
Check approximate equality within FDL tolerances.
| a | First point. |
| b | Second point. |
| int fdl_point_f64_lt | ( | fdl_point_f64_t | a, |
| fdl_point_f64_t | b | ||
| ) |
Check if a < b using OR logic (either x or y is less).
| a | First point. |
| b | Second point. |
| int fdl_point_f64_gt | ( | fdl_point_f64_t | a, |
| fdl_point_f64_t | b | ||
| ) |
Check if a > b using OR logic (either x or y is greater).
| a | First point. |
| b | Second point. |
| void fdl_free | ( | void * | ptr | ) |
Free memory allocated by fdl_core functions.
Use this for strings returned by serialization, error messages, and other heap-allocated values. Safe to call with NULL.
| ptr | Pointer to free, or NULL (no-op). |