GstVideoDither

GstVideoDither — Utility object for dithering and quantizing lines of video

Synopsis

#include <gst/video/video-dither.h>

                    GstVideoDither;
enum                GstVideoDitherFlags;
enum                GstVideoDitherMethod;
void                gst_video_dither_free               (GstVideoDither *dither);
void                gst_video_dither_line               (GstVideoDither *dither,
                                                         gpointer line,
                                                         guint x,
                                                         guint y,
                                                         guint width);
GstVideoDither *    gst_video_dither_new                (GstVideoDitherMethod method,
                                                         GstVideoDitherFlags flags,
                                                         GstVideoFormat format,
                                                         guint quantizer[GST_VIDEO_MAX_COMPONENTS],
                                                         guint width);

Description

GstVideoDither provides implementations of several dithering algorithms that can be applied to lines of video pixels to quantize and dither them.

Details

GstVideoDither

typedef struct _GstVideoDither GstVideoDither;

enum GstVideoDitherFlags

typedef enum {
  GST_VIDEO_DITHER_FLAG_NONE       = 0,
  GST_VIDEO_DITHER_FLAG_INTERLACED = (1 << 0),
  GST_VIDEO_DITHER_FLAG_QUANTIZE   = (1 << 1),
} GstVideoDitherFlags;

Extra flags that influence the result from gst_video_chroma_resample_new().

GST_VIDEO_DITHER_FLAG_NONE

no flags

GST_VIDEO_DITHER_FLAG_INTERLACED

the input is interlaced

GST_VIDEO_DITHER_FLAG_QUANTIZE

quantize values in addition to adding dither.

enum GstVideoDitherMethod

typedef enum {
  GST_VIDEO_DITHER_NONE,
  GST_VIDEO_DITHER_VERTERR,
  GST_VIDEO_DITHER_FLOYD_STEINBERG,
  GST_VIDEO_DITHER_SIERRA_LITE,
  GST_VIDEO_DITHER_BAYER,
} GstVideoDitherMethod;

Different dithering methods to use.

GST_VIDEO_DITHER_NONE

no dithering

GST_VIDEO_DITHER_VERTERR

propagate rounding errors downwards

GST_VIDEO_DITHER_FLOYD_STEINBERG

Dither with floyd-steinberg error diffusion

GST_VIDEO_DITHER_SIERRA_LITE

Dither with Sierra Lite error diffusion

GST_VIDEO_DITHER_BAYER

ordered dither using a bayer pattern

gst_video_dither_free ()

void                gst_video_dither_free               (GstVideoDither *dither);

Free dither

dither :

a GstVideoDither

gst_video_dither_line ()

void                gst_video_dither_line               (GstVideoDither *dither,
                                                         gpointer line,
                                                         guint x,
                                                         guint y,
                                                         guint width);

Dither width pixels starting from offset x in line using dither.

y is the line number of line in the output image.

dither :

a GstVideoDither

line :

pointer to the pixels of the line

x :

x coordinate

y :

y coordinate

width :

the width

gst_video_dither_new ()

GstVideoDither *    gst_video_dither_new                (GstVideoDitherMethod method,
                                                         GstVideoDitherFlags flags,
                                                         GstVideoFormat format,
                                                         guint quantizer[GST_VIDEO_MAX_COMPONENTS],
                                                         guint width);

Make a new dither object for dithering lines of format using the algorithm described by method.

Each component will be quantized to a multiple of quantizer. Better performance is achived when quantizer is a power of 2.

width is the width of the lines that this ditherer will handle.

method :

a GstVideoDitherMethod

flags :

a GstVideoDitherFlags

format :

a GstVideoFormat

quantizer :

quantizer

width :

the width of the lines

Returns :

a new GstVideoDither