libavfilter/vf_colormatrix.c File Reference

ColorMatrix 2.0 is based on the original ColorMatrix filter by Wilbert Dijkhof. More...

#include <strings.h>
#include <float.h>
#include "avfilter.h"
#include "libavutil/pixdesc.h"
#include "libavutil/avstring.h"

Go to the source code of this file.

Data Structures

struct  ColorMatrixContext

Defines

#define NS(n)   n < 0 ? (int)(n*65536.0-0.5+DBL_EPSILON) : (int)(n*65536.0+0.5)
#define CB(n)   av_clip_uint8(n)
#define ma   m[0][0]
#define mb   m[0][1]
#define mc   m[0][2]
#define md   m[1][0]
#define me   m[1][1]
#define mf   m[1][2]
#define mg   m[2][0]
#define mh   m[2][1]
#define mi   m[2][2]
#define ima   im[0][0]
#define imb   im[0][1]
#define imc   im[0][2]
#define imd   im[1][0]
#define ime   im[1][1]
#define imf   im[1][2]
#define img   im[2][0]
#define imh   im[2][1]
#define imi   im[2][2]

Functions

static void inverse3x3 (double im[3][3], const double m[3][3])
static void solve_coefficients (double cm[3][3], double rgb[3][3], const double yuv[3][3])
static void calc_coefficients (AVFilterContext *ctx)
static int get_color_mode_index (const char *name)
static av_cold int init (AVFilterContext *ctx, const char *args, void *opaque)
static void process_frame_uyvy422 (ColorMatrixContext *color, AVFilterBufferRef *dst, AVFilterBufferRef *src)
static void process_frame_yuv422p (ColorMatrixContext *color, AVFilterBufferRef *dst, AVFilterBufferRef *src)
static void process_frame_yuv420p (ColorMatrixContext *color, AVFilterBufferRef *dst, AVFilterBufferRef *src)
static int config_input (AVFilterLink *inlink)
static int query_formats (AVFilterContext *ctx)
static AVFilterBufferRefget_video_buffer (AVFilterLink *inlink, int perms, int w, int h)
static void start_frame (AVFilterLink *link, AVFilterBufferRef *picref)
static void end_frame (AVFilterLink *link)
static void null_draw_slice (AVFilterLink *link, int y, int h, int slice_dir)

Variables

static const double yuv_coeff [4][3][3]
static const char * color_modes [] = {"bt709", "FCC", "bt601", "smpte240m"}
AVFilter avfilter_vf_colormatrix


Detailed Description

ColorMatrix 2.0 is based on the original ColorMatrix filter by Wilbert Dijkhof.

It adds the ability to convert between any of: Rec.709, FCC, Rec.601, and SMPTE 240M. It also makes pre and post clipping optional, adds an option to use scaled or non-scaled coefficients, and more...

Definition in file vf_colormatrix.c.


Define Documentation

#define CB (  )     av_clip_uint8(n)

#define ima   im[0][0]

Definition at line 74 of file vf_colormatrix.c.

Referenced by adpcm_compress_trellis(), and inverse3x3().

#define imb   im[0][1]

Definition at line 75 of file vf_colormatrix.c.

Referenced by inverse3x3().

#define imc   im[0][2]

Definition at line 76 of file vf_colormatrix.c.

Referenced by avcodec_register_all(), and inverse3x3().

#define imd   im[1][0]

Definition at line 77 of file vf_colormatrix.c.

Referenced by inverse3x3().

#define ime   im[1][1]

Definition at line 78 of file vf_colormatrix.c.

Referenced by inverse3x3().

#define imf   im[1][2]

Definition at line 79 of file vf_colormatrix.c.

Referenced by inverse3x3().

#define img   im[2][0]

#define imh   im[2][1]

Definition at line 81 of file vf_colormatrix.c.

Referenced by inverse3x3().

#define imi   im[2][2]

Definition at line 82 of file vf_colormatrix.c.

Referenced by inverse3x3().

#define ma   m[0][0]

Definition at line 64 of file vf_colormatrix.c.

Referenced by inverse3x3().

#define mb   m[0][1]

#define mc   m[0][2]

#define md   m[1][0]

#define me   m[1][1]

#define mf   m[1][2]

Definition at line 69 of file vf_colormatrix.c.

Referenced by inverse3x3().

#define mg   m[2][0]

Definition at line 70 of file vf_colormatrix.c.

Referenced by inverse3x3().

#define mh   m[2][1]

#define mi   m[2][2]

Definition at line 72 of file vf_colormatrix.c.

Referenced by inverse3x3().

#define NS (  )     n < 0 ? (int)(n*65536.0-0.5+DBL_EPSILON) : (int)(n*65536.0+0.5)

Definition at line 37 of file vf_colormatrix.c.

Referenced by calc_coefficients().


Function Documentation

static void calc_coefficients ( AVFilterContext ctx  )  [static]

Definition at line 107 of file vf_colormatrix.c.

Referenced by init().

static int config_input ( AVFilterLink inlink  )  [static]

Definition at line 305 of file vf_colormatrix.c.

static void end_frame ( AVFilterLink link  )  [static]

Definition at line 349 of file vf_colormatrix.c.

static int get_color_mode_index ( const char *  name  )  [static]

Definition at line 136 of file vf_colormatrix.c.

Referenced by init().

static AVFilterBufferRef* get_video_buffer ( AVFilterLink inlink,
int  perms,
int  w,
int  h 
) [static]

Definition at line 333 of file vf_colormatrix.c.

Referenced by avfilter_get_video_buffer().

static av_cold int init ( AVFilterContext ctx,
const char *  args,
void *  opaque 
) [static]

Definition at line 146 of file vf_colormatrix.c.

static void inverse3x3 ( double  im[3][3],
const double  m[3][3] 
) [static]

Definition at line 84 of file vf_colormatrix.c.

Referenced by calc_coefficients().

static void null_draw_slice ( AVFilterLink link,
int  y,
int  h,
int  slice_dir 
) [static]

Definition at line 367 of file vf_colormatrix.c.

static void process_frame_uyvy422 ( ColorMatrixContext color,
AVFilterBufferRef dst,
AVFilterBufferRef src 
) [static]

Definition at line 183 of file vf_colormatrix.c.

Referenced by end_frame().

static void process_frame_yuv420p ( ColorMatrixContext color,
AVFilterBufferRef dst,
AVFilterBufferRef src 
) [static]

Definition at line 257 of file vf_colormatrix.c.

Referenced by end_frame().

static void process_frame_yuv422p ( ColorMatrixContext color,
AVFilterBufferRef dst,
AVFilterBufferRef src 
) [static]

Definition at line 215 of file vf_colormatrix.c.

Referenced by end_frame().

static int query_formats ( AVFilterContext ctx  )  [static]

Definition at line 319 of file vf_colormatrix.c.

static void solve_coefficients ( double  cm[3][3],
double  rgb[3][3],
const double  yuv[3][3] 
) [static]

Definition at line 99 of file vf_colormatrix.c.

Referenced by calc_coefficients().

static void start_frame ( AVFilterLink link,
AVFilterBufferRef picref 
) [static]

Definition at line 340 of file vf_colormatrix.c.


Variable Documentation

Initial value:

 {
    .name          = "colormatrix",
    .description   = NULL_IF_CONFIG_SMALL("Color matrix conversion"),

    .priv_size     = sizeof(ColorMatrixContext),
    .init          = init,
    .query_formats = query_formats,

    .inputs    = (AVFilterPad[]) {{ .name             = "default",
                                    .type             = AVMEDIA_TYPE_VIDEO,
                                    .config_props     = config_input,
                                    .start_frame      = start_frame,
                                    .get_video_buffer = get_video_buffer,
                                    .draw_slice       = null_draw_slice,
                                    .end_frame        = end_frame, },
                                  { .name = NULL }},

    .outputs   = (AVFilterPad[]) {{ .name             = "default",
                                    .type             = AVMEDIA_TYPE_VIDEO, },
                                  { .name = NULL }},
}

Definition at line 369 of file vf_colormatrix.c.

const char* color_modes[] = {"bt709", "FCC", "bt601", "smpte240m"} [static]

Definition at line 134 of file vf_colormatrix.c.

Referenced by get_color_mode_index().

const double yuv_coeff[4][3][3] [static]

Initial value:

 {
    { { +0.7152, +0.0722, +0.2126 }, 
      { -0.3850, +0.5000, -0.1150 },
      { -0.4540, -0.0460, +0.5000 } },
    { { +0.5900, +0.1100, +0.3000 }, 
      { -0.3310, +0.5000, -0.1690 },
      { -0.4210, -0.0790, +0.5000 } },
    { { +0.5870, +0.1140, +0.2990 }, 
      { -0.3313, +0.5000, -0.1687 },
      { -0.4187, -0.0813, +0.5000 } },
    { { +0.7010, +0.0870, +0.2120 }, 
      { -0.3840, +0.5000, -0.1160 },
      { -0.4450, -0.0550, +0.5000 } },
}

Definition at line 40 of file vf_colormatrix.c.

Referenced by calc_coefficients().


Generated on Fri Oct 26 02:48:01 2012 for FFmpeg by  doxygen 1.5.8