FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
swscale.c File Reference
#include <inttypes.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "libavutil/avassert.h"
#include "libavutil/avutil.h"
#include "libavutil/bswap.h"
#include "libavutil/cpu.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
#include "config.h"
#include "rgb2rgb.h"
#include "swscale_internal.h"
#include "swscale.h"

Go to the source code of this file.

Macros

#define DEBUG_SWSCALE_BUFFERS   0
 
#define DEBUG_BUFFERS(...)
 
#define RGB2YUV_SHIFT   15
 
#define BY   ( (int) (0.114 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))
 
#define BV   (-(int) (0.081 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))
 
#define BU   ( (int) (0.500 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))
 
#define GY   ( (int) (0.587 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))
 
#define GV   (-(int) (0.419 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))
 
#define GU   (-(int) (0.331 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))
 
#define RY   ( (int) (0.299 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))
 
#define RV   ( (int) (0.500 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))
 
#define RU   (-(int) (0.169 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))
 

Functions

static void gamma_convert (uint8_t *src[], int width, uint16_t *gamma)
 
static av_always_inline void fillPlane (uint8_t *plane, int stride, int width, int height, int y, uint8_t val)
 
static void hScale16To19_c (SwsContext *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize)
 
static void hScale16To15_c (SwsContext *c, int16_t *dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize)
 
static void hScale8To15_c (SwsContext *c, int16_t *dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize)
 
static void hScale8To19_c (SwsContext *c, int16_t *_dst, int dstW, const uint8_t *src, const int16_t *filter, const int32_t *filterPos, int filterSize)
 
static void chrRangeToJpeg_c (int16_t *dstU, int16_t *dstV, int width)
 
static void chrRangeFromJpeg_c (int16_t *dstU, int16_t *dstV, int width)
 
static void lumRangeToJpeg_c (int16_t *dst, int width)
 
static void lumRangeFromJpeg_c (int16_t *dst, int width)
 
static void chrRangeToJpeg16_c (int16_t *_dstU, int16_t *_dstV, int width)
 
static void chrRangeFromJpeg16_c (int16_t *_dstU, int16_t *_dstV, int width)
 
static void lumRangeToJpeg16_c (int16_t *_dst, int width)
 
static void lumRangeFromJpeg16_c (int16_t *_dst, int width)
 
static av_always_inline void hyscale (SwsContext *c, int16_t *dst, int dstWidth, const uint8_t *src_in[4], int srcW, int xInc, const int16_t *hLumFilter, const int32_t *hLumFilterPos, int hLumFilterSize, uint8_t *formatConvBuffer, uint32_t *pal, int isAlpha)
 
static av_always_inline void hcscale (SwsContext *c, int16_t *dst1, int16_t *dst2, int dstWidth, const uint8_t *src_in[4], int srcW, int xInc, const int16_t *hChrFilter, const int32_t *hChrFilterPos, int hChrFilterSize, uint8_t *formatConvBuffer, uint32_t *pal)
 
static int swscale (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
 
av_cold void ff_sws_init_range_convert (SwsContext *c)
 
static av_cold void sws_init_swscale (SwsContext *c)
 
SwsFunc ff_getSwsFunc (SwsContext *c)
 Return function pointer to fastest main scaler path function depending on architecture and available optimizations. More...
 
static void reset_ptr (const uint8_t *src[], enum AVPixelFormat format)
 
static int check_image_pointers (const uint8_t *const data[4], enum AVPixelFormat pix_fmt, const int linesizes[4])
 
static void xyz12Torgb48 (struct SwsContext *c, uint16_t *dst, const uint16_t *src, int stride, int h)
 
static void rgb48Toxyz12 (struct SwsContext *c, uint16_t *dst, const uint16_t *src, int stride, int h)
 
int attribute_align_arg sws_scale (struct SwsContext *c, const uint8_t *const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
 swscale wrapper, so we don't need to export the SwsContext. More...
 

Variables

const uint8_t ff_dither_8x8_128 [9][8]
 
static const uint8_t sws_pb_64 [8]
 

Macro Definition Documentation

#define DEBUG_SWSCALE_BUFFERS   0

Definition at line 313 of file swscale.c.

#define DEBUG_BUFFERS (   ...)
Value:
av_log(c, AV_LOG_DEBUG, __VA_ARGS__)
#define av_log(a,...)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
static double c[64]
#define DEBUG_SWSCALE_BUFFERS
Definition: swscale.c:313

Definition at line 314 of file swscale.c.

Referenced by swscale().

#define RGB2YUV_SHIFT   15
#define BY   ( (int) (0.114 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))

Referenced by sws_scale().

#define BV   (-(int) (0.081 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))

Referenced by sws_scale().

#define BU   ( (int) (0.500 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))

Referenced by sws_scale().

#define GY   ( (int) (0.587 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))

Referenced by sws_scale().

#define GV   (-(int) (0.419 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))

Referenced by sws_scale().

#define GU   (-(int) (0.331 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))

Referenced by sws_scale().

#define RY   ( (int) (0.299 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))

Referenced by sws_scale().

#define RV   ( (int) (0.500 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))

Referenced by sws_scale().

#define RU   (-(int) (0.169 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))

Referenced by sws_scale().

Function Documentation

static void gamma_convert ( uint8_t src[],
int  width,
uint16_t *  gamma 
)
static

Definition at line 55 of file swscale.c.

Referenced by swscale().

static av_always_inline void fillPlane ( uint8_t plane,
int  stride,
int  width,
int  height,
int  y,
uint8_t  val 
)
static

Definition at line 71 of file swscale.c.

Referenced by swscale().

static void hScale16To19_c ( SwsContext c,
int16_t *  _dst,
int  dstW,
const uint8_t _src,
const int16_t *  filter,
const int32_t filterPos,
int  filterSize 
)
static

Definition at line 82 of file swscale.c.

Referenced by sws_init_swscale().

static void hScale16To15_c ( SwsContext c,
int16_t *  dst,
int  dstW,
const uint8_t _src,
const int16_t *  filter,
const int32_t filterPos,
int  filterSize 
)
static

Definition at line 109 of file swscale.c.

Referenced by sws_init_swscale().

static void hScale8To15_c ( SwsContext c,
int16_t *  dst,
int  dstW,
const uint8_t src,
const int16_t *  filter,
const int32_t filterPos,
int  filterSize 
)
static

Definition at line 135 of file swscale.c.

Referenced by sws_init_swscale().

static void hScale8To19_c ( SwsContext c,
int16_t *  _dst,
int  dstW,
const uint8_t src,
const int16_t *  filter,
const int32_t filterPos,
int  filterSize 
)
static

Definition at line 151 of file swscale.c.

Referenced by sws_init_swscale().

static void chrRangeToJpeg_c ( int16_t *  dstU,
int16_t *  dstV,
int  width 
)
static

Definition at line 170 of file swscale.c.

Referenced by ff_sws_init_range_convert().

static void chrRangeFromJpeg_c ( int16_t *  dstU,
int16_t *  dstV,
int  width 
)
static

Definition at line 179 of file swscale.c.

Referenced by ff_sws_init_range_convert().

static void lumRangeToJpeg_c ( int16_t *  dst,
int  width 
)
static

Definition at line 188 of file swscale.c.

Referenced by ff_sws_init_range_convert().

static void lumRangeFromJpeg_c ( int16_t *  dst,
int  width 
)
static

Definition at line 195 of file swscale.c.

Referenced by ff_sws_init_range_convert().

static void chrRangeToJpeg16_c ( int16_t *  _dstU,
int16_t *  _dstV,
int  width 
)
static

Definition at line 202 of file swscale.c.

Referenced by ff_sws_init_range_convert().

static void chrRangeFromJpeg16_c ( int16_t *  _dstU,
int16_t *  _dstV,
int  width 
)
static

Definition at line 213 of file swscale.c.

Referenced by ff_sws_init_range_convert().

static void lumRangeToJpeg16_c ( int16_t *  _dst,
int  width 
)
static

Definition at line 224 of file swscale.c.

Referenced by ff_sws_init_range_convert().

static void lumRangeFromJpeg16_c ( int16_t *  _dst,
int  width 
)
static

Definition at line 233 of file swscale.c.

Referenced by ff_sws_init_range_convert().

static av_always_inline void hyscale ( SwsContext c,
int16_t *  dst,
int  dstWidth,
const uint8_t src_in[4],
int  srcW,
int  xInc,
const int16_t *  hLumFilter,
const int32_t hLumFilterPos,
int  hLumFilterSize,
uint8_t formatConvBuffer,
uint32_t *  pal,
int  isAlpha 
)
static

Definition at line 242 of file swscale.c.

Referenced by swscale().

static av_always_inline void hcscale ( SwsContext c,
int16_t *  dst1,
int16_t *  dst2,
int  dstWidth,
const uint8_t src_in[4],
int  srcW,
int  xInc,
const int16_t *  hChrFilter,
const int32_t hChrFilterPos,
int  hChrFilterSize,
uint8_t formatConvBuffer,
uint32_t *  pal 
)
static

Definition at line 278 of file swscale.c.

Referenced by swscale().

static int swscale ( SwsContext c,
const uint8_t src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t dst[],
int  dstStride[] 
)
static

Definition at line 318 of file swscale.c.

Referenced by ff_getSwsFunc(), ffprobe_show_library_versions(), and print_all_libs_info().

av_cold void ff_sws_init_range_convert ( SwsContext c)

Definition at line 699 of file swscale.c.

Referenced by sws_init_swscale(), and sws_setColorspaceDetails().

static av_cold void sws_init_swscale ( SwsContext c)
static

Definition at line 724 of file swscale.c.

Referenced by ff_getSwsFunc().

SwsFunc ff_getSwsFunc ( SwsContext c)

Return function pointer to fastest main scaler path function depending on architecture and available optimizations.

Definition at line 757 of file swscale.c.

Referenced by sws_init_context().

static void reset_ptr ( const uint8_t src[],
enum AVPixelFormat  format 
)
static

Definition at line 769 of file swscale.c.

Referenced by sws_scale().

static int check_image_pointers ( const uint8_t *const  data[4],
enum AVPixelFormat  pix_fmt,
const int  linesizes[4] 
)
static

Definition at line 781 of file swscale.c.

Referenced by sws_scale().

static void xyz12Torgb48 ( struct SwsContext c,
uint16_t *  dst,
const uint16_t *  src,
int  stride,
int  h 
)
static

Definition at line 796 of file swscale.c.

Referenced by sws_scale().

static void rgb48Toxyz12 ( struct SwsContext c,
uint16_t *  dst,
const uint16_t *  src,
int  stride,
int  h 
)
static

Definition at line 852 of file swscale.c.

Referenced by sws_scale().

Variable Documentation

const uint8_t ff_dither_8x8_128[9][8]
Initial value:
= {
{ 36, 68, 60, 92, 34, 66, 58, 90, },
{ 100, 4, 124, 28, 98, 2, 122, 26, },
{ 52, 84, 44, 76, 50, 82, 42, 74, },
{ 116, 20, 108, 12, 114, 18, 106, 10, },
{ 32, 64, 56, 88, 38, 70, 62, 94, },
{ 96, 0, 120, 24, 102, 6, 126, 30, },
{ 48, 80, 40, 72, 54, 86, 46, 78, },
{ 112, 16, 104, 8, 118, 22, 110, 14, },
{ 36, 68, 60, 92, 34, 66, 58, 90, },
}

Definition at line 39 of file swscale.c.

Referenced by swscale().

const uint8_t sws_pb_64[8]
static
Initial value:
= {
64, 64, 64, 64, 64, 64, 64, 64
}

Definition at line 51 of file swscale.c.

Referenced by swscale().