DSP Utilities
DSP Context

DSP Utilities. More...

## Functions

GAVL_PUBLIC int | gavl_dsp_interpolate_video_frame (gavl_dsp_context_t *ctx, gavl_video_format_t *format, gavl_video_frame_t *src_1, gavl_video_frame_t *src_2, gavl_video_frame_t *dst, float factor)
| Do a linear interpolation of a video frame.
GAVL_PUBLIC int | gavl_dsp_audio_frame_swap_endian (gavl_dsp_context_t *ctx, gavl_audio_frame_t *frame, const gavl_audio_format_t *format)
| Swap endianness an audio frame.
GAVL_PUBLIC int | gavl_dsp_video_frame_swap_endian (gavl_dsp_context_t *ctx, gavl_video_frame_t *frame, const gavl_video_format_t *format)
| Swap endianness a video frame.
GAVL_PUBLIC void | gavl_dsp_video_frame_shift_bits (gavl_dsp_context_t *ctx, gavl_video_frame_t *frame, const gavl_video_format_t *format, int bits)
| Shift bits in a video frame.
GAVL_PUBLIC void | gavl_dsp_video_frame_shift_bits_copy (gavl_dsp_context_t *ctx, gavl_video_frame_t *dst, const gavl_video_frame_t *src, const gavl_video_format_t *format, int bits)
void | gavl_dsp_video_frame_shuffle_4 (gavl_dsp_context_t *ctx, gavl_video_frame_t *frame, const gavl_video_format_t *format, int *src_indices)
void | gavl_dsp_video_frame_shuffle_4_copy (gavl_dsp_context_t *ctx, gavl_video_frame_t *dst, const gavl_video_frame_t *src, const gavl_video_format_t *format, int *src_indices)

## Detailed Description

DSP Utilities.

These are some utility functions, which use a DSP context but operate on higher level structures like video frames. As usual, these are supported for any format.

## Function Documentation

## gavl_dsp_interpolate_video_frame()

GAVL_PUBLIC int gavl_dsp_interpolate_video_frame | ( | gavl_dsp_context_t * | ctx,
|  | gavl_video_format_t * | format,
|  | gavl_video_frame_t * | src_1,
|  | gavl_video_frame_t * | src_2,
|  | gavl_video_frame_t * | dst,
|  | float | factor )

Do a linear interpolation of a video frame.

Parameters

  ctx | A DSP context
  format | Video format
  src_1 | Frame 1
  src_2 | Frame 2
  dst | Destination frame
  factor | Interpolation factor

Returns
  1 on success, 0 if an error occurred

If factor is 1.0, dst will be equal to src1, if factor is 0.0, dst will be equal to src2.

If the quality is at least GAVL_QUALITY_MIN, this function never fails.

## gavl_dsp_audio_frame_swap_endian()

GAVL_PUBLIC int gavl_dsp_audio_frame_swap_endian | ( | gavl_dsp_context_t * | ctx,
|  | gavl_audio_frame_t * | frame,
|  | const gavl_audio_format_t * | format )

Swap endianness an audio frame.

Parameters

  ctx | An initialized dsp context
  frame | An audio frame
  format | The format of the frame

Returns
  1 on success, 0 if an error occurred

If the quality is at least GAVL_QUALITY_MIN, this function never fails.

## gavl_dsp_video_frame_swap_endian()

GAVL_PUBLIC int gavl_dsp_video_frame_swap_endian | ( | gavl_dsp_context_t * | ctx,
|  | gavl_video_frame_t * | frame,
|  | const gavl_video_format_t * | format )

Swap endianness a video frame.

Parameters

  ctx | An initialized dsp context
  frame | A video frame
  format | The format of the frame

Returns
  1 on success, 0 if an error occurred

This function swaps endianness for pixelformats, which have multibyte numbers as components. For 32 bit long formats with 8 bit components, it swaps the pixels as if they were 32 bit integers. For all other formats, it does nothing.

If the quality is at least GAVL_QUALITY_MIN, this function never fails.

## gavl_dsp_video_frame_shift_bits()

GAVL_PUBLIC void gavl_dsp_video_frame_shift_bits | ( | gavl_dsp_context_t * | ctx,
|  | gavl_video_frame_t * | frame,
|  | const gavl_video_format_t * | format,
|  | int | bits )

Shift bits in a video frame.

Parameters

  ctx | An initialized dsp context
  frame | A video frame
  format | The format of the frame
  bits | Number of bits to shift each component

This shifts the bits of all components. It works only for 16 bit formats right now. If bits is larger than zero, the components are shifted left (resulting in larger numbers). If bits is smaller than zero, the components are shifted right (resulting in smaller numbers).

Since 1.5.0