#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.
Macros | |
#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 | FILL8TO9_OR_10(wfunc) |
#define | isRGBA32(x) |
#define | IS_NOT_NE(bpp, desc) |
#define | CONV_IS(src, dst) (srcFormat == AV_PIX_FMT_##src && dstFormat == AV_PIX_FMT_##dst) |
#define | clip9(x) av_clip_uintp2(x, 9) |
#define | clip10(x) av_clip_uintp2(x, 10) |
#define | DITHER_COPY(dst, dstStride, wfunc, src, srcStride, rfunc, dithers, shift, clip) |
#define | COPY9_OR_10TO16(rfunc, wfunc) |
#define | COPY9_OR_10TO9_OR_10(loop) |
#define | COPY9_OR_10TO9_OR_10_2(rfunc, wfunc) |
#define | W8(a, b) { *(a) = (b); } |
#define | COPY9_OR_10TO8(rfunc) |
#define | COPY16TO9_OR_10(rfunc, wfunc) |
#define | COPY8TO9_OR_10(wfunc) |
#define | COPY16TO8(rfunc) |
#define | IS_DIFFERENT_ENDIANESS(src_fmt, dst_fmt, pix_fmt) |
Typedefs | |
typedef void(* | rgbConvFn )(const uint8_t *, uint8_t *, int) |
Functions | |
static void | fillPlane (uint8_t *plane, int stride, int width, int height, int y, uint8_t val) |
static void | fill_plane9or10 (uint8_t *plane, int stride, int width, int height, int y, uint8_t val, const int dst_depth, const int big_endian) |
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 | packed_16bpc_bswap (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
static int | palToRgbWrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
static void | gbr24ptopacked24 (const uint8_t *src[], int srcStride[], uint8_t *dst, int dstStride, int srcSliceH, int width) |
static void | gbr24ptopacked32 (const uint8_t *src[], int srcStride[], uint8_t *dst, int dstStride, int srcSliceH, int alpha_first, int width) |
static int | planarRgbToRgbWrapper (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
static rgbConvFn | findRgbConvFn (SwsContext *c) |
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) |
Set c->swScale to an unscaled converter if one exists for the specific source and destination formats, bit depths, flags, etc. More... | |
static void | reset_ptr (const uint8_t *src[], int format) |
static int | check_image_pointers (uint8_t *data[4], enum AVPixelFormat pix_fmt, const int linesizes[4]) |
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... | |
void | sws_convertPalette8ToPacked32 (const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette) |
Convert an 8-bit paletted frame into a frame with a color depth of 32 bits. More... | |
void | sws_convertPalette8ToPacked24 (const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette) |
Convert an 8-bit paletted frame into a frame with a color depth of 24 bits. More... | |
Variables | |
const uint8_t | dither_8x8_1 [8][8] |
const uint8_t | dither_8x8_3 [8][8] |
const uint8_t | dither_8x8_64 [8][8] |
const uint8_t | dither_8x8_128 [8][8] |
const uint8_t | dither_8x8_256 [8][8] |
#define BU ( (int) (0.500 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) |
Definition at line 82 of file swscale_unscaled.c.
Referenced by sws_scale().
#define BV (-(int) (0.081 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) |
Definition at line 81 of file swscale_unscaled.c.
Referenced by sws_scale().
#define BY ( (int) (0.114 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) |
Definition at line 80 of file swscale_unscaled.c.
Referenced by sws_scale().
#define clip10 | ( | x | ) | av_clip_uintp2(x, 10) |
Definition at line 662 of file swscale_unscaled.c.
#define clip9 | ( | x | ) | av_clip_uintp2(x, 9) |
Definition at line 661 of file swscale_unscaled.c.
#define CONV_IS | ( | src, | |
dst | |||
) | (srcFormat == AV_PIX_FMT_##src && dstFormat == AV_PIX_FMT_##dst) |
Referenced by findRgbConvFn().
#define COPY16TO8 | ( | rfunc | ) |
Referenced by planarCopyWrapper().
#define COPY16TO9_OR_10 | ( | rfunc, | |
wfunc | |||
) |
Referenced by planarCopyWrapper().
#define COPY8TO9_OR_10 | ( | wfunc | ) |
Referenced by planarCopyWrapper().
#define COPY9_OR_10TO16 | ( | rfunc, | |
wfunc | |||
) |
Referenced by planarCopyWrapper().
#define COPY9_OR_10TO8 | ( | rfunc | ) |
Referenced by planarCopyWrapper().
#define COPY9_OR_10TO9_OR_10 | ( | loop | ) |
#define COPY9_OR_10TO9_OR_10_2 | ( | rfunc, | |
wfunc | |||
) |
Referenced by planarCopyWrapper().
#define DITHER_COPY | ( | dst, | |
dstStride, | |||
wfunc, | |||
src, | |||
srcStride, | |||
rfunc, | |||
dithers, | |||
shift, | |||
clip | |||
) |
Definition at line 663 of file swscale_unscaled.c.
#define FILL8TO9_OR_10 | ( | wfunc | ) |
Referenced by fill_plane9or10().
#define GU (-(int) (0.331 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) |
Definition at line 85 of file swscale_unscaled.c.
Referenced by sws_scale().
#define GV (-(int) (0.419 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) |
Definition at line 84 of file swscale_unscaled.c.
Referenced by sws_scale().
#define GY ( (int) (0.587 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) |
Definition at line 83 of file swscale_unscaled.c.
Referenced by sws_scale().
#define IS_DIFFERENT_ENDIANESS | ( | src_fmt, | |
dst_fmt, | |||
pix_fmt | |||
) |
#define IS_NOT_NE | ( | bpp, | |
desc | |||
) |
Referenced by findRgbConvFn().
#define isRGBA32 | ( | x | ) |
Definition at line 471 of file swscale_unscaled.c.
Referenced by findRgbConvFn(), and rgbToRgbWrapper().
#define RGB2YUV_SHIFT 15 |
Definition at line 79 of file swscale_unscaled.c.
Referenced by sws_scale().
#define RU (-(int) (0.169 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) |
Definition at line 88 of file swscale_unscaled.c.
Referenced by sws_scale().
#define RV ( (int) (0.500 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) |
Definition at line 87 of file swscale_unscaled.c.
Referenced by sws_scale().
#define RY ( (int) (0.299 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) |
Definition at line 86 of file swscale_unscaled.c.
Referenced by sws_scale().
Definition at line 479 of file swscale_unscaled.c.
|
static |
Definition at line 601 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 1024 of file swscale_unscaled.c.
Referenced by sws_scale().
|
static |
Definition at line 122 of file swscale_unscaled.c.
Referenced by planarToNv12Wrapper(), and yvu9ToYv12Wrapper().
void ff_get_unscaled_swscale | ( | SwsContext * | c | ) |
Set c->swScale to an unscaled converter if one exists for the specific source and destination formats, bit depths, flags, etc.
Definition at line 894 of file swscale_unscaled.c.
Referenced by sws_init_context().
|
static |
Definition at line 101 of file swscale_unscaled.c.
Referenced by planarCopyWrapper().
|
static |
Definition at line 90 of file swscale_unscaled.c.
Referenced by bgr24ToYv12Wrapper(), planarCopyWrapper(), uyvyToYuv420Wrapper(), yuyvToYuv420Wrapper(), and yvu9ToYv12Wrapper().
|
static |
Definition at line 480 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale(), and rgbToRgbWrapper().
|
static |
Definition at line 368 of file swscale_unscaled.c.
Referenced by planarRgbToRgbWrapper().
|
static |
Definition at line 386 of file swscale_unscaled.c.
Referenced by planarRgbToRgbWrapper().
|
static |
Definition at line 286 of file swscale_unscaled.c.
Referenced by palToRgbWrapper().
|
static |
Definition at line 269 of file swscale_unscaled.c.
Referenced by palToRgbWrapper().
|
static |
Definition at line 277 of file swscale_unscaled.c.
Referenced by palToRgbWrapper().
|
static |
Definition at line 300 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 634 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 322 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 682 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 415 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 139 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 171 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 159 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
Definition at line 1012 of file swscale_unscaled.c.
Referenced by sws_scale().
|
static |
Definition at line 558 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 | ||
) |
Convert an 8-bit 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 1194 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 | ||
) |
Convert an 8-bit 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 1184 of file swscale_unscaled.c.
Referenced by palToRgbWrapper().
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.
Scale the image slice in srcSlice and put the resulting scaled slice in the image in dst.
Assumes planar YUV to be in YUV order instead of YVU.
Definition at line 1043 of file swscale_unscaled.c.
Referenced by doTest(), filter_frame(), main(), queue_picture(), wrap(), and write_video_frame().
|
static |
Definition at line 238 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 255 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 195 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 183 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 207 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 224 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 617 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
const uint8_t dither_8x8_1[8][8] |
Definition at line 37 of file swscale_unscaled.c.
const uint8_t dither_8x8_128[8][8] |
const uint8_t dither_8x8_256[8][8] |
Definition at line 68 of file swscale_unscaled.c.
const uint8_t dither_8x8_3[8][8] |
Definition at line 47 of file swscale_unscaled.c.
const uint8_t dither_8x8_64[8][8] |
Definition at line 57 of file swscale_unscaled.c.