#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 | isRGBA32(x) |
#define | IS_NOT_NE(bpp, fmt) |
#define | CONV_IS(src, dst) (srcFormat == PIX_FMT_##src && dstFormat == 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 | 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 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. | |
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 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. | |
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. | |
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. |
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 536 of file swscale_unscaled.c.
#define clip9 | ( | x | ) | av_clip_uintp2(x, 9) |
Definition at line 535 of file swscale_unscaled.c.
#define CONV_IS | ( | src, | |
dst | |||
) | (srcFormat == PIX_FMT_##src && dstFormat == 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 537 of file swscale_unscaled.c.
#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, | |
fmt | |||
) |
Referenced by findRgbConvFn().
#define isRGBA32 | ( | x | ) |
Definition at line 347 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().
typedef void(* rgbConvFn)(const uint8_t *, uint8_t *, int) |
Definition at line 355 of file swscale_unscaled.c.
|
static |
Definition at line 475 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 886 of file swscale_unscaled.c.
Referenced by sws_scale().
|
static |
Definition at line 101 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 759 of file swscale_unscaled.c.
Referenced by sws_init_context().
|
static |
Definition at line 90 of file swscale_unscaled.c.
Referenced by bgr24ToYv12Wrapper(), planarCopyWrapper(), uyvyToYuv420Wrapper(), yuyvToYuv420Wrapper(), and yvu9ToYv12Wrapper().
|
static |
Definition at line 356 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale(), and rgbToRgbWrapper().
|
static |
Definition at line 265 of file swscale_unscaled.c.
Referenced by palToRgbWrapper().
|
static |
Definition at line 248 of file swscale_unscaled.c.
Referenced by palToRgbWrapper().
|
static |
Definition at line 256 of file swscale_unscaled.c.
Referenced by palToRgbWrapper().
|
static |
Definition at line 279 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 508 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 301 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 556 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 118 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 150 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 138 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 874 of file swscale_unscaled.c.
Referenced by sws_scale().
|
static |
Definition at line 432 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 1056 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 1046 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 905 of file swscale_unscaled.c.
Referenced by do_video_out(), do_video_resample(), doTest(), draw_slice(), main(), queue_picture(), and write_video_frame().
|
static |
Definition at line 217 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 234 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 174 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 162 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 186 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 203 of file swscale_unscaled.c.
Referenced by ff_get_unscaled_swscale().
|
static |
Definition at line 491 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.