libavcodec/imgresample.c File Reference

High quality image resampling with polyphase filters . More...

#include "avcodec.h"
#include "dsputil.h"
#include "imgconvert.h"
#include "libswscale/swscale.h"
#include "x86/mmx.h"

Go to the source code of this file.

Data Structures

struct  SwsContext
struct  ImgReSampleContext

Defines

#define NB_COMPONENTS   3
#define PHASE_BITS   4
#define NB_PHASES   (1 << PHASE_BITS)
#define NB_TAPS   4
#define FCENTER   1
#define POS_FRAC_BITS   16
#define POS_FRAC   (1 << POS_FRAC_BITS)
#define FILTER_BITS   8
#define LINE_BUF_HEIGHT   (NB_TAPS * 4)
#define FILTER4(reg)
#define DUMP(reg)   movq_r2m(reg, tmp); printf(#reg "=%016"PRIx64"\n", tmp.uq);

Functions

void av_build_filter (int16_t *filter, double factor, int tap_count, int phase_count, int scale, int type)
static int get_phase (int pos)
static void h_resample_fast (uint8_t *dst, int dst_width, const uint8_t *src, int src_width, int src_start, int src_incr, int16_t *filters)
static void v_resample (uint8_t *dst, int dst_width, const uint8_t *src, int wrap, int16_t *filter)
static void h_resample_fast4_mmx (uint8_t *dst, int dst_width, const uint8_t *src, int src_width, int src_start, int src_incr, int16_t *filters)
static void v_resample4_mmx (uint8_t *dst, int dst_width, const uint8_t *src, int wrap, int16_t *filter)
static void h_resample_slow (uint8_t *dst, int dst_width, const uint8_t *src, int src_width, int src_start, int src_incr, int16_t *filters)
static void h_resample (uint8_t *dst, int dst_width, const uint8_t *src, int src_width, int src_start, int src_incr, int16_t *filters)
static void component_resample (ImgReSampleContext *s, uint8_t *output, int owrap, int owidth, int oheight, uint8_t *input, int iwrap, int iwidth, int iheight)
ImgReSampleContextimg_resample_full_init (int owidth, int oheight, int iwidth, int iheight, int topBand, int bottomBand, int leftBand, int rightBand, int padtop, int padbottom, int padleft, int padright)
ImgReSampleContextimg_resample_init (int owidth, int oheight, int iwidth, int iheight)
void img_resample (ImgReSampleContext *s, AVPicture *output, const AVPicture *input)
void img_resample_close (ImgReSampleContext *s)
static const char * context_to_name (void *ptr)
struct SwsContextsws_getContext (int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, double *param)
void sws_freeContext (struct SwsContext *ctx)
struct SwsContextsws_getCachedContext (struct SwsContext *ctx, int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, double *param)
 Checks if context is valid or reallocs a new one instead.
int sws_scale (struct SwsContext *ctx, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
 Scales the image slice in srcSlice and puts the resulting scaled slice in the image in dst.

Variables

static const AVClass context_class = { "imgresample", context_to_name, NULL }


Detailed Description

High quality image resampling with polyphase filters .

WARNING: This file is deprecated and will be removed after FFmpeg 0.5 release, do not lose your time improving it!

Definition in file imgresample.c.


Define Documentation

#define DUMP ( reg   )     movq_r2m(reg, tmp); printf(#reg "=%016"PRIx64"\n", tmp.uq);

Definition at line 179 of file imgresample.c.

#define FCENTER   1

Definition at line 44 of file imgresample.c.

Referenced by component_resample().

#define FILTER4 ( reg   ) 

Value:

{\
        s = src + (src_pos >> POS_FRAC_BITS);\
        phase = get_phase(src_pos);\
        filter = filters + phase * NB_TAPS;\
        movq_m2r(*s, reg);\
        punpcklbw_r2r(mm7, reg);\
        movq_m2r(*filter, mm6);\
        pmaddwd_r2r(reg, mm6);\
        movq_r2r(mm6, reg);\
        psrlq_i2r(32, reg);\
        paddd_r2r(mm6, reg);\
        psrad_i2r(FILTER_BITS, reg);\
        src_pos += src_incr;\
}

Definition at line 163 of file imgresample.c.

Referenced by h_resample_fast4_mmx().

#define FILTER_BITS   8

#define LINE_BUF_HEIGHT   (NB_TAPS * 4)

Definition at line 52 of file imgresample.c.

Referenced by component_resample(), and img_resample_full_init().

#define NB_COMPONENTS   3

Definition at line 39 of file imgresample.c.

#define NB_PHASES   (1 << PHASE_BITS)

Definition at line 42 of file imgresample.c.

Referenced by img_resample_full_init().

#define NB_TAPS   4

#define PHASE_BITS   4

Definition at line 41 of file imgresample.c.

Referenced by get_phase().

#define POS_FRAC   (1 << POS_FRAC_BITS)

Definition at line 48 of file imgresample.c.

Referenced by component_resample(), and img_resample_full_init().

#define POS_FRAC_BITS   16


Function Documentation

void av_build_filter ( int16_t *  filter,
double  factor,
int  tap_count,
int  phase_count,
int  scale,
int  type 
)

static void component_resample ( ImgReSampleContext s,
uint8_t *  output,
int  owrap,
int  owidth,
int  oheight,
uint8_t *  input,
int  iwrap,
int  iwidth,
int  iheight 
) [static]

Definition at line 363 of file imgresample.c.

Referenced by img_resample().

static const char* context_to_name ( void *  ptr  )  [static]

Definition at line 516 of file imgresample.c.

static int get_phase ( int  pos  )  [inline, static]

Definition at line 73 of file imgresample.c.

Referenced by component_resample(), h_resample_fast(), and h_resample_slow().

static void h_resample ( uint8_t *  dst,
int  dst_width,
const uint8_t *  src,
int  src_width,
int  src_start,
int  src_incr,
int16_t *  filters 
) [static]

Definition at line 326 of file imgresample.c.

Referenced by component_resample().

static void h_resample_fast ( uint8_t *  dst,
int  dst_width,
const uint8_t *  src,
int  src_width,
int  src_start,
int  src_incr,
int16_t *  filters 
) [static]

Definition at line 79 of file imgresample.c.

Referenced by h_resample().

static void h_resample_fast4_mmx ( uint8_t *  dst,
int  dst_width,
const uint8_t *  src,
int  src_width,
int  src_start,
int  src_incr,
int16_t *  filters 
) [static]

Definition at line 182 of file imgresample.c.

Referenced by h_resample().

static void h_resample_slow ( uint8_t *  dst,
int  dst_width,
const uint8_t *  src,
int  src_width,
int  src_start,
int  src_incr,
int16_t *  filters 
) [static]

Definition at line 290 of file imgresample.c.

Referenced by h_resample().

void img_resample ( ImgReSampleContext s,
AVPicture output,
const AVPicture input 
)

Definition at line 488 of file imgresample.c.

Referenced by sws_scale().

void img_resample_close ( ImgReSampleContext s  ) 

Definition at line 510 of file imgresample.c.

Referenced by sws_freeContext().

ImgReSampleContext* img_resample_full_init ( int  owidth,
int  oheight,
int  iwidth,
int  iheight,
int  topBand,
int  bottomBand,
int  leftBand,
int  rightBand,
int  padtop,
int  padbottom,
int  padleft,
int  padright 
)

Definition at line 428 of file imgresample.c.

Referenced by img_resample_init().

ImgReSampleContext* img_resample_init ( int  owidth,
int  oheight,
int  iwidth,
int  iheight 
)

Definition at line 481 of file imgresample.c.

Referenced by sws_getContext().

void sws_freeContext ( struct SwsContext ctx  ) 

Definition at line 556 of file imgresample.c.

Referenced by av_encode(), doTest(), Release(), and sws_getCachedContext().

struct SwsContext* sws_getCachedContext ( struct SwsContext ctx,
int  srcW,
int  srcH,
int  srcFormat,
int  dstW,
int  dstH,
int  dstFormat,
int  flags,
SwsFilter srcFilter,
SwsFilter dstFilter,
double *  param 
) [read]

Checks if context is valid or reallocs a new one instead.

If context is NULL, just calls sws_getContext() to get a new one. Otherwise, checks if the parameters are the same already saved in context. If that is the case, returns the current context. Otherwise, frees context and gets a new one.

Be warned that srcFilter, dstFilter are not checked, they are assumed to remain valid.

Definition at line 580 of file imgresample.c.

Referenced by get_watermark_picture(), Process(), Process0(), Process1(), and queue_picture().

struct SwsContext* sws_getContext ( int  srcW,
int  srcH,
int  srcFormat,
int  dstW,
int  dstH,
int  dstFormat,
int  flags,
SwsFilter srcFilter,
SwsFilter dstFilter,
double *  param 
) [read]

Definition at line 523 of file imgresample.c.

Referenced by av_encode(), doTest(), main(), sws_getCachedContext(), and write_video_frame().

int sws_scale ( struct SwsContext context,
uint8_t *  srcSlice[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t *  dst[],
int  dstStride[] 
)

Scales the image slice in srcSlice and puts the resulting scaled slice in the image in dst.

A slice is a sequence of consecutive rows in an image.

Parameters:
context the scaling context previously created with sws_getContext()
srcSlice the array containing the pointers to the planes of the source slice
srcStride the array containing the strides for each plane of the source image
srcSliceY the position in the source image of the slice to process, that is the number (counted starting from zero) in the image of the first row of the slice
srcSliceH the height of the source slice, that is the number of rows in the slice
dst the array containing the pointers to the planes of the destination image
dstStride the array containing the strides for each plane of the destination image
Returns:
the height of the output slice

Definition at line 605 of file imgresample.c.

Referenced by do_video_out(), doTest(), get_watermark_picture(), main(), Process(), Process0(), Process1(), queue_picture(), sws_scale_ordered(), and write_video_frame().

static void v_resample ( uint8_t *  dst,
int  dst_width,
const uint8_t *  src,
int  wrap,
int16_t *  filter 
) [static]

Definition at line 123 of file imgresample.c.

Referenced by component_resample().

static void v_resample4_mmx ( uint8_t *  dst,
int  dst_width,
const uint8_t *  src,
int  wrap,
int16_t *  filter 
) [static]

Definition at line 227 of file imgresample.c.

Referenced by component_resample().


Variable Documentation

const AVClass context_class = { "imgresample", context_to_name, NULL } [static]

Definition at line 521 of file imgresample.c.


Generated on Fri Oct 26 02:35:43 2012 for FFmpeg by  doxygen 1.5.8