Libav 0.7.1
|
#include <inttypes.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include "config.h"
#include <assert.h>
#include "swscale.h"
#include "swscale_internal.h"
#include "rgb2rgb.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/cpu.h"
#include "libavutil/avutil.h"
#include "libavutil/mathematics.h"
#include "libavutil/bswap.h"
#include "libavutil/pixdesc.h"
Go to the source code of this file.
Defines | |
#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)) |
#define | isRGBA32(x) |
#define | CONV_IS(src, dst) (srcFormat == PIX_FMT_##src && dstFormat == PIX_FMT_##dst) |
#define | COPY9_OR_10TO16(rfunc, wfunc) |
#define | COPY9_OR_10TO9_OR_10(loop) |
#define | COPY9_OR_10TO9_OR_10_2(rfunc, wfunc) |
#define | COPY9_OR_10TO8(rfunc) |
#define | COPY16TO9_OR_10(rfunc, wfunc) |
#define | COPY8TO9_OR_10(wfunc) |
Functions | |
static void | fillPlane (uint8_t *plane, int stride, int width, int height, int y, uint8_t val) |
static void | copyPlane (const uint8_t *src, int srcStride, int srcSliceY, int srcSliceH, int width, uint8_t *dst, int dstStride) |
static int | planarToNv12Wrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[]) |
static int | planarToYuy2Wrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[]) |
static int | planarToUyvyWrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[]) |
static int | yuv422pToYuy2Wrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[]) |
static int | yuv422pToUyvyWrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[]) |
static int | yuyvToYuv420Wrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[]) |
static int | yuyvToYuv422Wrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[]) |
static int | uyvyToYuv420Wrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[]) |
static int | uyvyToYuv422Wrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[]) |
static void | gray8aToPacked32 (const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette) |
static void | gray8aToPacked32_1 (const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette) |
static void | gray8aToPacked24 (const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette) |
static int | palToRgbWrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
static int | rgbToRgbWrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
static int | bgr24ToYv12Wrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
static int | yvu9ToYv12Wrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
static int | packedCopyWrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
static int | planarCopyWrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
void | ff_get_unscaled_swscale (SwsContext *c) |
Sets c->swScale to an unscaled converter if one exists for the specific source and destination formats, bit depths, flags, etc. | |
static void | reset_ptr (const uint8_t *src[], int format) |
static int | check_image_pointers (uint8_t *data[4], enum PixelFormat pix_fmt, const int linesizes[4]) |
int | sws_scale (SwsContext *c, const uint8_t *const src[], 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. | |
void | sws_convertPalette8ToPacked32 (const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette) |
Converts an 8bit paletted frame into a frame with a color depth of 32-bits. | |
void | sws_convertPalette8ToPacked24 (const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette) |
Converts an 8bit paletted frame into a frame with a color depth of 24 bits. |
#define BU ( (int)(0.500*224/255*(1<<RGB2YUV_SHIFT)+0.5)) |
Definition at line 40 of file swscale_unscaled.c.
Referenced by sws_scale().
#define BV (-(int)(0.081*224/255*(1<<RGB2YUV_SHIFT)+0.5)) |
Definition at line 39 of file swscale_unscaled.c.
Referenced by sws_scale().
#define BY ( (int)(0.114*219/255*(1<<RGB2YUV_SHIFT)+0.5)) |
Definition at line 38 of file swscale_unscaled.c.
Referenced by sws_scale().
Referenced by rgbToRgbWrapper().
#define COPY16TO9_OR_10 | ( | rfunc, | |
wfunc | |||
) |
for (i = 0; i < height; i++) { \ for (j = 0; j < length; j++) { \ wfunc(&dstPtr2[j], rfunc(&srcPtr2[j])>>(16-dst_depth)); \ } \ dstPtr2 += dstStride[plane]/2; \ srcPtr2 += srcStride[plane]/2; \ }
Referenced by planarCopyWrapper().
#define COPY8TO9_OR_10 | ( | wfunc | ) |
for (i = 0; i < height; i++) { \ for (j = 0; j < length; j++) { \ const int srcpx = srcPtr[j]; \ wfunc(&dstPtr2[j], (srcpx<<(dst_depth-8)) | (srcpx >> (16-dst_depth))); \ } \ dstPtr2 += dstStride[plane]/2; \ srcPtr += srcStride[plane]; \ }
Referenced by planarCopyWrapper().
#define COPY9_OR_10TO16 | ( | rfunc, | |
wfunc | |||
) |
for (i = 0; i < height; i++) { \ for (j = 0; j < length; j++) { \ int srcpx = rfunc(&srcPtr2[j]); \ wfunc(&dstPtr2[j], (srcpx<<(16-src_depth)) | (srcpx>>(2*src_depth-16))); \ } \ dstPtr2 += dstStride[plane]/2; \ srcPtr2 += srcStride[plane]/2; \ }
Referenced by planarCopyWrapper().
#define COPY9_OR_10TO8 | ( | rfunc | ) |
for (i = 0; i < height; i++) { \ for (j = 0; j < length; j++) { \ dstPtr[j] = rfunc(&srcPtr2[j])>>(src_depth-8); \ } \ dstPtr += dstStride[plane]; \ srcPtr2 += srcStride[plane]/2; \ }
Referenced by planarCopyWrapper().
#define COPY9_OR_10TO9_OR_10 | ( | loop | ) |
#define COPY9_OR_10TO9_OR_10_2 | ( | rfunc, | |
wfunc | |||
) |
if (dst_depth > src_depth) { \ COPY9_OR_10TO9_OR_10(int srcpx = rfunc(&srcPtr2[j]); \ wfunc(&dstPtr2[j], (srcpx << 1) | (srcpx >> 9))); \ } else if (dst_depth < src_depth) { \ COPY9_OR_10TO9_OR_10(wfunc(&dstPtr2[j], rfunc(&srcPtr2[j]) >> 1)); \ } else { \ COPY9_OR_10TO9_OR_10(wfunc(&dstPtr2[j], rfunc(&srcPtr2[j]))); \ }
Referenced by planarCopyWrapper().
#define GU (-(int)(0.331*224/255*(1<<RGB2YUV_SHIFT)+0.5)) |
Definition at line 43 of file swscale_unscaled.c.
Referenced by sws_scale().
#define GV (-(int)(0.419*224/255*(1<<RGB2YUV_SHIFT)+0.5)) |
Definition at line 42 of file swscale_unscaled.c.
Referenced by sws_scale().
#define GY ( (int)(0.587*219/255*(1<<RGB2YUV_SHIFT)+0.5)) |
Definition at line 41 of file swscale_unscaled.c.
Referenced by sws_scale().
#define isRGBA32 | ( | x | ) |
( \ (x) == PIX_FMT_ARGB \ || (x) == PIX_FMT_RGBA \ || (x) == PIX_FMT_BGRA \ || (x) == PIX_FMT_ABGR \ )
Definition at line 258 of file swscale_unscaled.c.
Referenced by rgbToRgbWrapper().
#define RGB2YUV_SHIFT 15 |
Definition at line 37 of file swscale_unscaled.c.
Referenced by sws_scale().
#define RU (-(int)(0.169*224/255*(1<<RGB2YUV_SHIFT)+0.5)) |
Definition at line 46 of file swscale_unscaled.c.
Referenced by sws_scale().
#define RV ( (int)(0.500*224/255*(1<<RGB2YUV_SHIFT)+0.5)) |
Definition at line 45 of file swscale_unscaled.c.
Referenced by sws_scale().
#define RY ( (int)(0.299*219/255*(1<<RGB2YUV_SHIFT)+0.5)) |
Definition at line 44 of file swscale_unscaled.c.
Referenced by sws_scale().
static int bgr24ToYv12Wrapper | ( | SwsContext * | c, |
const uint8_t * | src[], | ||
int | srcStride[], | ||
int | srcSliceY, | ||
int | srcSliceH, | ||
uint8_t * | dst[], | ||
int | dstStride[] | ||
) | [static] |
Definition at line 359 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
static int check_image_pointers | ( | uint8_t * | data[4], |
enum PixelFormat | pix_fmt, | ||
const int | linesizes[4] | ||
) | [static] |
Definition at line 717 of file swscale_unscaled.c.
Referenced by sws_scale().
static void copyPlane | ( | const uint8_t * | src, |
int | srcStride, | ||
int | srcSliceY, | ||
int | srcSliceH, | ||
int | width, | ||
uint8_t * | dst, | ||
int | dstStride | ||
) | [static] |
Definition at line 58 of file swscale_unscaled.c.
Referenced by planarToNv12Wrapper(), and yvu9ToYv12Wrapper().
void ff_get_unscaled_swscale | ( | SwsContext * | c | ) |
Sets c->swScale to an unscaled converter if one exists for the specific source and destination formats, bit depths, flags, etc.
Definition at line 597 of file swscale_unscaled.c.
Referenced by sws_init_context().
static void fillPlane | ( | uint8_t * | plane, |
int | stride, | ||
int | width, | ||
int | height, | ||
int | y, | ||
uint8_t | val | ||
) | [static] |
Definition at line 48 of file swscale_unscaled.c.
Referenced by bgr24ToYv12Wrapper(), planarCopyWrapper(), uyvyToYuv420Wrapper(), yuyvToYuv420Wrapper(), and yvu9ToYv12Wrapper().
static void gray8aToPacked24 | ( | const uint8_t * | src, |
uint8_t * | dst, | ||
int | num_pixels, | ||
const uint8_t * | palette | ||
) | [static] |
Definition at line 200 of file swscale_unscaled.c.
Referenced by palToRgbWrapper().
static void gray8aToPacked32 | ( | const uint8_t * | src, |
uint8_t * | dst, | ||
int | num_pixels, | ||
const uint8_t * | palette | ||
) | [static] |
Definition at line 185 of file swscale_unscaled.c.
Referenced by palToRgbWrapper().
static void gray8aToPacked32_1 | ( | const uint8_t * | src, |
uint8_t * | dst, | ||
int | num_pixels, | ||
const uint8_t * | palette | ||
) | [static] |
Definition at line 192 of file swscale_unscaled.c.
Referenced by palToRgbWrapper().
static int packedCopyWrapper | ( | SwsContext * | c, |
const uint8_t * | src[], | ||
int | srcStride[], | ||
int | srcSliceY, | ||
int | srcSliceH, | ||
uint8_t * | dst[], | ||
int | dstStride[] | ||
) | [static] |
Definition at line 390 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
static int palToRgbWrapper | ( | SwsContext * | c, |
const uint8_t * | src[], | ||
int | srcStride[], | ||
int | srcSliceY, | ||
int | srcSliceH, | ||
uint8_t * | dst[], | ||
int | dstStride[] | ||
) | [static] |
Definition at line 213 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
static int planarCopyWrapper | ( | SwsContext * | c, |
const uint8_t * | src[], | ||
int | srcStride[], | ||
int | srcSliceY, | ||
int | srcSliceH, | ||
uint8_t * | dst[], | ||
int | dstStride[] | ||
) | [static] |
Definition at line 415 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
static int planarToNv12Wrapper | ( | SwsContext * | c, |
const uint8_t * | src[], | ||
int | srcStride[], | ||
int | srcSliceY, | ||
int | srcSliceH, | ||
uint8_t * | dstParam[], | ||
int | dstStride[] | ||
) | [static] |
Definition at line 75 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
static int planarToUyvyWrapper | ( | SwsContext * | c, |
const uint8_t * | src[], | ||
int | srcStride[], | ||
int | srcSliceY, | ||
int | srcSliceH, | ||
uint8_t * | dstParam[], | ||
int | dstStride[] | ||
) | [static] |
Definition at line 101 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
static int planarToYuy2Wrapper | ( | SwsContext * | c, |
const uint8_t * | src[], | ||
int | srcStride[], | ||
int | srcSliceY, | ||
int | srcSliceH, | ||
uint8_t * | dstParam[], | ||
int | dstStride[] | ||
) | [static] |
Definition at line 91 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
static void reset_ptr | ( | const uint8_t * | src[], |
int | format | ||
) | [static] |
Definition at line 705 of file swscale_unscaled.c.
Referenced by sws_scale().
static int rgbToRgbWrapper | ( | SwsContext * | c, |
const uint8_t * | src[], | ||
int | srcStride[], | ||
int | srcSliceY, | ||
int | srcSliceH, | ||
uint8_t * | dst[], | ||
int | dstStride[] | ||
) | [static] |
Definition at line 266 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
void sws_convertPalette8ToPacked24 | ( | const uint8_t * | src, |
uint8_t * | dst, | ||
int | num_pixels, | ||
const uint8_t * | palette | ||
) |
Converts an 8bit paletted frame into a frame with a color depth of 24 bits.
With the palette format "ABCD", the destination frame ends up with the format "ABC".
src | source frame buffer |
dst | destination frame buffer |
num_pixels | number of pixels to convert |
palette | array with [256] entries, which must match color arrangement (RGB or BGR) of src |
Definition at line 876 of file swscale_unscaled.c.
Referenced by palToRgbWrapper().
void sws_convertPalette8ToPacked32 | ( | const uint8_t * | src, |
uint8_t * | dst, | ||
int | num_pixels, | ||
const uint8_t * | palette | ||
) |
Converts an 8bit paletted frame into a frame with a color depth of 32-bits.
The output frame will have the same packed format as the palette.
src | source frame buffer |
dst | destination frame buffer |
num_pixels | number of pixels to convert |
palette | array with [256] entries, which must match color arrangement (RGB or BGR) of src |
Definition at line 867 of file swscale_unscaled.c.
Referenced by palToRgbWrapper().
int sws_scale | ( | SwsContext * | c, |
const uint8_t *const | src[], | ||
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.
Scales the image slice in srcSlice and puts the resulting scaled slice in the image in dst.
Assumes planar YUV to be in YUV order instead of YVU.
Definition at line 736 of file swscale_unscaled.c.
Referenced by do_video_out(), doTest(), draw_slice(), main(), queue_picture(), and write_video_frame().
static int uyvyToYuv420Wrapper | ( | SwsContext * | c, |
const uint8_t * | src[], | ||
int | srcStride[], | ||
int | srcSliceY, | ||
int | srcSliceH, | ||
uint8_t * | dstParam[], | ||
int | dstStride[] | ||
) | [static] |
Definition at line 158 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
static int uyvyToYuv422Wrapper | ( | SwsContext * | c, |
const uint8_t * | src[], | ||
int | srcStride[], | ||
int | srcSliceY, | ||
int | srcSliceH, | ||
uint8_t * | dstParam[], | ||
int | dstStride[] | ||
) | [static] |
Definition at line 173 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
static int yuv422pToUyvyWrapper | ( | SwsContext * | c, |
const uint8_t * | src[], | ||
int | srcStride[], | ||
int | srcSliceY, | ||
int | srcSliceH, | ||
uint8_t * | dstParam[], | ||
int | dstStride[] | ||
) | [static] |
Definition at line 121 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
static int yuv422pToYuy2Wrapper | ( | SwsContext * | c, |
const uint8_t * | src[], | ||
int | srcStride[], | ||
int | srcSliceY, | ||
int | srcSliceH, | ||
uint8_t * | dstParam[], | ||
int | dstStride[] | ||
) | [static] |
Definition at line 111 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
static int yuyvToYuv420Wrapper | ( | SwsContext * | c, |
const uint8_t * | src[], | ||
int | srcStride[], | ||
int | srcSliceY, | ||
int | srcSliceH, | ||
uint8_t * | dstParam[], | ||
int | dstStride[] | ||
) | [static] |
Definition at line 131 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
static int yuyvToYuv422Wrapper | ( | SwsContext * | c, |
const uint8_t * | src[], | ||
int | srcStride[], | ||
int | srcSliceY, | ||
int | srcSliceH, | ||
uint8_t * | dstParam[], | ||
int | dstStride[] | ||
) | [static] |
Definition at line 146 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
static int yvu9ToYv12Wrapper | ( | SwsContext * | c, |
const uint8_t * | src[], | ||
int | srcStride[], | ||
int | srcSliceY, | ||
int | srcSliceH, | ||
uint8_t * | dst[], | ||
int | dstStride[] | ||
) | [static] |
Definition at line 374 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().