API Reference

C-compatible programming interface for the Ultraziq x265 Toolkit.

Technical Introduction

Ultraziq public interface is pure C, defined in uhdkit.h, ensuring maximum portability.

uhdkit_version_str: Library version string.
x265_max_bit_depth: Internal bit depth (8 or 10).

Parameter Management

uhdkit_param* uhdkit_param_alloc(UHDKIT_TYPE_HEVC)

Allocates an uhdkit_param instance for the x265/HEVC encoder core.

int uhdkit_param_default_preset(uhdkit_param* p, const char* preset, const char* tune)

Initializes the parameter structure with a target preset (e.g., "medium", "ultrafast") and tune factor.

uhdkit_param* p = uhdkit_param_alloc(UHDKIT_TYPE_HEVC);
uhdkit_param_default_preset(p, "medium", "ssim");
int uhdkit_param_apply_profile(uhdkit_param* p, const char* profile)

Restricts parameters to a specific HEVC profile (e.g., "main", "main10").

int uhdkit_param_parse(uhdkit_param* p, const char* name, const char* value)

Parses individual parameters by string name. Used for Ultraziq-specific features.

Pictures & Stats

uhdkit_picture* uhdkit_picture_alloc(uhdkit_param* p)

Allocates a picture container for raw YUV input.

uhdkit_stats* uhdkit_stats_alloc(uhdkit_param* p)

Allocates a statistics object for tracking encode performance.

Encoder Core

uhdkit_encoder* uhdkit_encoder_open(uhdkit_param* p)

Creates a new encoder instance. All parameters are cloned internally.

int uhdkit_encoder_encode(uhdkit_encoder* e, uhdkit_nal** nals, uint32_t* n_nals, uhdkit_picture* in, uhdkit_picture** out)

The primary encoding entry point. Processes a single frame. Pass in = NULL to flush.

int uhdkit_encoder_reconfig(uhdkit_encoder* e, uhdkit_param* p)

Dynamically updates encoder parameters in real-time.

Logging & Cleanup

void uhdkit_encoder_close(uhdkit_encoder* e)

Shuts down the encoder and releases internal thread pools.

void uhdkit_cleanup(uhdkit_param* p)

Global static resource cleanup for the library.

Color Space Conversion

Utility functions to translate internal Ultraziq tokens to x265 constants.

int uhdkit_to_x265_csp(int csp)