GstVideoChroma

GstVideoChroma — Functions and utility object for operating on chroma video planes

Synopsis

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

enum                GstVideoChromaSite;
GstVideoChromaSite  gst_video_chroma_from_string        (const gchar *s);
const gchar *       gst_video_chroma_to_string          (GstVideoChromaSite site);
enum                GstVideoChromaFlags;

enum                GstVideoChromaMethod;
                    GstVideoChromaResample;
void                gst_video_chroma_resample           (GstVideoChromaResample *resample,
                                                         gpointer lines[],
                                                         gint width);
void                gst_video_chroma_resample_free      (GstVideoChromaResample *resample);
void                gst_video_chroma_resample_get_info  (GstVideoChromaResample *resample,
                                                         guint *n_lines,
                                                         gint *offset);
GstVideoChromaResample * gst_video_chroma_resample_new  (GstVideoChromaMethod method,
                                                         GstVideoChromaSite site,
                                                         GstVideoChromaFlags flags,
                                                         GstVideoFormat format,
                                                         gint h_factor,
                                                         gint v_factor);

Description

The functions gst_video_chroma_from_string() and gst_video_chroma_to_string() convert between GstVideoChromaSite and string descriptions.

GstVideoChromaResample is a utility object for resampling chroma planes and converting between different chroma sampling sitings.

Details

enum GstVideoChromaSite

typedef enum {
  GST_VIDEO_CHROMA_SITE_UNKNOWN   =  0,
  GST_VIDEO_CHROMA_SITE_NONE      = (1 << 0),
  GST_VIDEO_CHROMA_SITE_H_COSITED = (1 << 1),
  GST_VIDEO_CHROMA_SITE_V_COSITED = (1 << 2),
  GST_VIDEO_CHROMA_SITE_ALT_LINE  = (1 << 3),
  /* some common chroma cositing */
  GST_VIDEO_CHROMA_SITE_COSITED   = (GST_VIDEO_CHROMA_SITE_H_COSITED | GST_VIDEO_CHROMA_SITE_V_COSITED),
  GST_VIDEO_CHROMA_SITE_JPEG      = (GST_VIDEO_CHROMA_SITE_NONE),
  GST_VIDEO_CHROMA_SITE_MPEG2     = (GST_VIDEO_CHROMA_SITE_H_COSITED),
  GST_VIDEO_CHROMA_SITE_DV        = (GST_VIDEO_CHROMA_SITE_COSITED | GST_VIDEO_CHROMA_SITE_ALT_LINE),
} GstVideoChromaSite;

Various Chroma sitings.

GST_VIDEO_CHROMA_SITE_UNKNOWN

unknown cositing

GST_VIDEO_CHROMA_SITE_NONE

no cositing

GST_VIDEO_CHROMA_SITE_H_COSITED

chroma is horizontally cosited

GST_VIDEO_CHROMA_SITE_V_COSITED

chroma is vertically cosited

GST_VIDEO_CHROMA_SITE_ALT_LINE

choma samples are sited on alternate lines

GST_VIDEO_CHROMA_SITE_COSITED

chroma samples cosited with luma samples

GST_VIDEO_CHROMA_SITE_JPEG

jpeg style cositing, also for mpeg1 and mjpeg

GST_VIDEO_CHROMA_SITE_MPEG2

mpeg2 style cositing

GST_VIDEO_CHROMA_SITE_DV

DV style cositing

gst_video_chroma_from_string ()

GstVideoChromaSite  gst_video_chroma_from_string        (const gchar *s);

Convert s to a GstVideoChromaSite

s :

a chromasite string

Returns :

a GstVideoChromaSite or GST_VIDEO_CHROMA_SITE_UNKNOWN when s does not contain a valid chroma description.

gst_video_chroma_to_string ()

const gchar *       gst_video_chroma_to_string          (GstVideoChromaSite site);

Converts site to its string representation.

site :

a GstVideoChromaSite

Returns :

a string describing site.

enum GstVideoChromaFlags

typedef enum {
  GST_VIDEO_CHROMA_FLAG_NONE       = 0,
  GST_VIDEO_CHROMA_FLAG_INTERLACED = (1 << 0),
} GstVideoChromaFlags;

Extra flags that influence the result from gst_video_chroma_resample_new().

GST_VIDEO_CHROMA_FLAG_NONE

no flags

GST_VIDEO_CHROMA_FLAG_INTERLACED

the input is interlaced

enum GstVideoChromaMethod

typedef enum {
  GST_VIDEO_CHROMA_METHOD_NEAREST,
  GST_VIDEO_CHROMA_METHOD_LINEAR
} GstVideoChromaMethod;

Different subsampling and upsampling methods

GST_VIDEO_CHROMA_METHOD_NEAREST

Duplicates the chroma samples when upsampling and drops when subsampling

GST_VIDEO_CHROMA_METHOD_LINEAR

Uses linear interpolation to reconstruct missing chroma and averaging to subsample

GstVideoChromaResample

typedef struct _GstVideoChromaResample GstVideoChromaResample;

gst_video_chroma_resample ()

void                gst_video_chroma_resample           (GstVideoChromaResample *resample,
                                                         gpointer lines[],
                                                         gint width);

Perform resampling of width chroma pixels in lines.

resample :

a GstVideoChromaResample

lines :

pixel lines

width :

the number of pixels on one line

gst_video_chroma_resample_free ()

void                gst_video_chroma_resample_free      (GstVideoChromaResample *resample);

Free resample

resample :

a GstVideoChromaResample

gst_video_chroma_resample_get_info ()

void                gst_video_chroma_resample_get_info  (GstVideoChromaResample *resample,
                                                         guint *n_lines,
                                                         gint *offset);

The resampler must be fed n_lines at a time. The first line should be at offset.

resample :

a GstVideoChromaResample

n_lines :

the number of input lines

offset :

the first line

gst_video_chroma_resample_new ()

GstVideoChromaResample * gst_video_chroma_resample_new  (GstVideoChromaMethod method,
                                                         GstVideoChromaSite site,
                                                         GstVideoChromaFlags flags,
                                                         GstVideoFormat format,
                                                         gint h_factor,
                                                         gint v_factor);

Create a new resampler object for the given parameters. When h_factor or v_factor is > 0, upsampling will be used, otherwise subsampling is performed.

method :

a GstVideoChromaMethod

site :

a GstVideoChromaSite

flags :

GstVideoChromaFlags

format :

the GstVideoFormat

h_factor :

horizontal resampling factor

v_factor :

vertical resampling factor

Returns :

a new GstVideoChromaResample that should be freed with gst_video_chroma_resample_free() after usage.