#include <inttypes.h>#include <string.h>#include <math.h>#include <stdio.h>#include <unistd.h>#include "config.h"#include <assert.h>#include "swscale.h"#include "swscale_internal.h"#include "rgb2rgb.h"#include "libavutil/x86_cpu.h"#include "libavutil/bswap.h"#include "swscale_template.c"Go to the source code of this file.
Defines | |
| #define | DITHER1XBPP |
| #define | FAST_BGR2YV12 |
| #define | RET 0xC3 |
| #define | PI 3.14159265358979323846 |
| #define | isSupportedIn(x) |
| #define | isSupportedOut(x) |
| #define | isPacked(x) |
| #define | RGB2YUV_SHIFT 16 |
| #define | BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5)) |
| #define | BV ((int)(-0.071*(1<<RGB2YUV_SHIFT)+0.5)) |
| #define | BU ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5)) |
| #define | GY ((int)( 0.504*(1<<RGB2YUV_SHIFT)+0.5)) |
| #define | GV ((int)(-0.368*(1<<RGB2YUV_SHIFT)+0.5)) |
| #define | GU ((int)(-0.291*(1<<RGB2YUV_SHIFT)+0.5)) |
| #define | RY ((int)( 0.257*(1<<RGB2YUV_SHIFT)+0.5)) |
| #define | RV ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5)) |
| #define | RU ((int)(-0.148*(1<<RGB2YUV_SHIFT)+0.5)) |
| #define | YSCALE_YUV_2_PACKEDX_C(type) |
| #define | YSCALE_YUV_2_RGBX_C(type) |
| #define | YSCALE_YUV_2_PACKED2_C |
| #define | YSCALE_YUV_2_RGB2_C(type) |
| #define | YSCALE_YUV_2_PACKED1_C |
| #define | YSCALE_YUV_2_RGB1_C(type) |
| #define | YSCALE_YUV_2_PACKED1B_C |
| #define | YSCALE_YUV_2_RGB1B_C(type) |
| #define | YSCALE_YUV_2_ANYRGB_C(func, func2) |
| #define | COMPILE_C |
| #define | RENAME(a) a ## _C |
| #define | MAX_FUNNY_CODE_SIZE 10000 |
Functions | |
| static SwsVector * | sws_getConvVec (SwsVector *a, SwsVector *b) |
| const char * | sws_format_name (enum PixelFormat format) |
| static void | yuv2yuvXinC (int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW) |
| static void | yuv2nv12XinC (int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, uint8_t *uDest, int dstW, int chrDstW, int dstFormat) |
| static void | yuv2packedXinC (SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, int dstW, int y) |
| for (i=0;i< dstW-1;i+=2) | |
| static double | getSplineCoeff (double a, double b, double c, double d, double dist) |
| static int | initFilter (int16_t **outFilter, int16_t **filterPos, int *outFilterSize, int xInc, int srcW, int dstW, int filterAlign, int one, int flags, SwsVector *srcFilter, SwsVector *dstFilter, double param[2]) |
| static void | globalInit (void) |
| static SwsFunc | getSwsFunc (int flags) |
| static int | PlanarToNV12Wrapper (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[]) |
| static int | PlanarToYuy2Wrapper (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[]) |
| static int | PlanarToUyvyWrapper (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dstParam[], int dstStride[]) |
| static int | rgb2rgbWrapper (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
| static int | bgr24toyv12Wrapper (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
| static int | yvu9toyv12Wrapper (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
| static int | packedCopy (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
| static int | planarCopy (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
| static int | gray16togray (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
| static int | graytogray16 (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
| static int | gray16swap (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
| static void | getSubSampleFactors (int *h, int *v, int format) |
| static uint16_t | roundToInt16 (int64_t f) |
| int | sws_setColorspaceDetails (SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation) |
| int | sws_getColorspaceDetails (SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation) |
| static int | handle_jpeg (int *format) |
| SwsContext * | sws_getContext (int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, double *param) |
| int | sws_scale (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
| int | sws_scale_ordered (SwsContext *c, uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) |
| SwsFilter * | sws_getDefaultFilter (float lumaGBlur, float chromaGBlur, float lumaSharpen, float chromaSharpen, float chromaHShift, float chromaVShift, int verbose) |
| SwsVector * | sws_getGaussianVec (double variance, double quality) |
| SwsVector * | sws_getConstVec (double c, int length) |
| SwsVector * | sws_getIdentityVec (void) |
| double | sws_dcVec (SwsVector *a) |
| void | sws_scaleVec (SwsVector *a, double scalar) |
| void | sws_normalizeVec (SwsVector *a, double height) |
| static SwsVector * | sws_sumVec (SwsVector *a, SwsVector *b) |
| static SwsVector * | sws_diffVec (SwsVector *a, SwsVector *b) |
| static SwsVector * | sws_getShiftedVec (SwsVector *a, int shift) |
| void | sws_shiftVec (SwsVector *a, int shift) |
| void | sws_addVec (SwsVector *a, SwsVector *b) |
| void | sws_subVec (SwsVector *a, SwsVector *b) |
| void | sws_convVec (SwsVector *a, SwsVector *b) |
| SwsVector * | sws_cloneVec (SwsVector *a) |
| void | sws_printVec (SwsVector *a) |
| void | sws_freeVec (SwsVector *a) |
| void | sws_freeFilter (SwsFilter *filter) |
| void | sws_freeContext (SwsContext *c) |
| SwsContext * | sws_getCachedContext (struct SwsContext *context, int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, double *param) |
Variables | |
| const int32_t | Inverse_Table_6_9 [8][4] |
| static unsigned char | clip_table [768] |
| const uint8_t | dither_2x2_4 [2][8] |
| const uint8_t | dither_2x2_8 [2][8] |
| const uint8_t | dither_8x8_32 [8][8] |
| const uint8_t | dither_8x8_73 [8][8] |
| const uint8_t | dither_8x8_220 [8][8] |
| break | |
| case | PIX_FMT_BGR24 |
| uint8_t * | dest [1] = g[Y1] |
| dest = 6 | |
| break | |
| case | PIX_FMT_RGB565 |
| const int | dg1 = dither_2x2_4[y&1 ][0] |
| const int | db1 = dither_2x2_8[(y&1)^1][0] |
| const int | dr2 = dither_2x2_8[y&1 ][1] |
| const int | dg2 = dither_2x2_4[y&1 ][1] |
| const int | db2 = dither_2x2_8[(y&1)^1][1] |
| break | |
| case | PIX_FMT_RGB555 |
| const int | dg1 = dither_2x2_8[y&1 ][1] |
| const int | db1 = dither_2x2_8[(y&1)^1][0] |
| const int | dr2 = dither_2x2_8[y&1 ][1] |
| const int | dg2 = dither_2x2_8[y&1 ][0] |
| const int | db2 = dither_2x2_8[(y&1)^1][1] |
| break | |
| case | PIX_FMT_RGB8 |
| const uint8_t *const | d32 = dither_8x8_32[y&7] |
| break | |
| case | PIX_FMT_RGB4 |
| const uint8_t *const | d128 = dither_8x8_220[y&7] |
| break | |
| case | PIX_FMT_RGB4_BYTE |
| const uint8_t *const | d128 = dither_8x8_220[y&7] |
| break | |
| case | PIX_FMT_MONOBLACK |
| uint8_t * | g = c->table_gU[128] + c->table_gV[128] |
| int | acc = 0 |
| break | |
| case | PIX_FMT_YUYV422 |
| break | |
| case | PIX_FMT_UYVY422 |
| break | |
| #define isPacked | ( | x | ) |
Value:
( \
(x)==PIX_FMT_PAL8 \
|| (x)==PIX_FMT_YUYV422 \
|| (x)==PIX_FMT_UYVY422 \
|| isRGB(x) \
|| isBGR(x) \
)
Definition at line 139 of file swscale.c.
Referenced by swScale().
| #define isSupportedIn | ( | x | ) |
Value:
( \
(x)==PIX_FMT_YUV420P \
|| (x)==PIX_FMT_YUVA420P \
|| (x)==PIX_FMT_YUYV422 \
|| (x)==PIX_FMT_UYVY422 \
|| (x)==PIX_FMT_RGB32 \
|| (x)==PIX_FMT_BGR24 \
|| (x)==PIX_FMT_BGR565 \
|| (x)==PIX_FMT_BGR555 \
|| (x)==PIX_FMT_BGR32 \
|| (x)==PIX_FMT_RGB24 \
|| (x)==PIX_FMT_RGB565 \
|| (x)==PIX_FMT_RGB555 \
|| (x)==PIX_FMT_GRAY8 \
|| (x)==PIX_FMT_YUV410P \
|| (x)==PIX_FMT_GRAY16BE \
|| (x)==PIX_FMT_GRAY16LE \
|| (x)==PIX_FMT_YUV444P \
|| (x)==PIX_FMT_YUV422P \
|| (x)==PIX_FMT_YUV411P \
|| (x)==PIX_FMT_PAL8 \
|| (x)==PIX_FMT_BGR8 \
|| (x)==PIX_FMT_RGB8 \
|| (x)==PIX_FMT_BGR4_BYTE \
|| (x)==PIX_FMT_RGB4_BYTE \
|| (x)==PIX_FMT_YUV440P \
)
| #define isSupportedOut | ( | x | ) |
Value:
( \
(x)==PIX_FMT_YUV420P \
|| (x)==PIX_FMT_YUYV422 \
|| (x)==PIX_FMT_UYVY422 \
|| (x)==PIX_FMT_YUV444P \
|| (x)==PIX_FMT_YUV422P \
|| (x)==PIX_FMT_YUV411P \
|| isRGB(x) \
|| isBGR(x) \
|| (x)==PIX_FMT_NV12 \
|| (x)==PIX_FMT_NV21 \
|| (x)==PIX_FMT_GRAY16BE \
|| (x)==PIX_FMT_GRAY16LE \
|| (x)==PIX_FMT_GRAY8 \
|| (x)==PIX_FMT_YUV410P \
)
| #define MAX_FUNNY_CODE_SIZE 10000 |
| #define YSCALE_YUV_2_ANYRGB_C | ( | func, | |||
| func2 | ) |
| #define YSCALE_YUV_2_PACKED1_C |
Value:
for (i=0; i<(dstW>>1); i++){\ const int i2= 2*i;\ int Y1= buf0[i2 ]>>7;\ int Y2= buf0[i2+1]>>7;\ int U= (uvbuf1[i ])>>7;\ int V= (uvbuf1[i+VOFW])>>7;\
Definition at line 461 of file swscale.c.
Referenced by yuv2packed1().
| #define YSCALE_YUV_2_PACKED1B_C |
| #define YSCALE_YUV_2_PACKED2_C |
Value:
for (i=0; i<(dstW>>1); i++){ \ const int i2= 2*i; \ int Y1= (buf0[i2 ]*yalpha1+buf1[i2 ]*yalpha)>>19; \ int Y2= (buf0[i2+1]*yalpha1+buf1[i2+1]*yalpha)>>19; \ int U= (uvbuf0[i ]*uvalpha1+uvbuf1[i ]*uvalpha)>>19; \ int V= (uvbuf0[i+VOFW]*uvalpha1+uvbuf1[i+VOFW]*uvalpha)>>19; \
Definition at line 446 of file swscale.c.
Referenced by yuv2packed2().
| #define YSCALE_YUV_2_RGB1_C | ( | type | ) |
| #define YSCALE_YUV_2_RGB1B_C | ( | type | ) |
| #define YSCALE_YUV_2_RGB2_C | ( | type | ) |
| #define YSCALE_YUV_2_RGBX_C | ( | type | ) |
| static int bgr24toyv12Wrapper | ( | SwsContext * | c, | |
| uint8_t * | src[], | |||
| int | srcStride[], | |||
| int | srcSliceY, | |||
| int | srcSliceH, | |||
| uint8_t * | dst[], | |||
| int | dstStride[] | |||
| ) | [static] |
Definition at line 1606 of file swscale.c.
01606 : conv= rgb24tobgr15; break; 01607 case 0x38: conv= rgb32tobgr15; break; 01608 case 0x43: conv= rgb15tobgr16; break; 01609 case 0x44: conv= rgb16tobgr16; break; 01610 case 0x46: conv= rgb24tobgr16; break; 01611 case 0x48: conv= rgb32tobgr16; break; 01612 case 0x63: conv= rgb15tobgr24; break; 01613 case 0x64: conv= rgb16tobgr24; break; 01614 case 0x66: conv= rgb24tobgr24; break; 01615 case 0x68: conv= rgb32tobgr24; break; 01616 case 0x83: conv= rgb15tobgr32; break; 01617 case 0x84: conv= rgb16tobgr32; break;
| for | ( | ) |
Definition at line 730 of file swscale.c.
Referenced by add_frame_default(), alac_decode_frame(), apply_loop_filter(), apply_window_and_mdct(), audio_read_packet(), av_picture_pad(), avcodec_default_get_buffer(), bfi_decode_frame(), copy_frame_default(), dc1394_read_common(), dca_init_vlcs(), dca_parse_frame_header(), dca_subframe_footer(), dca_subsubframe(), decode(), decode_frame(), decode_residuals(), decode_subframe(), decode_subframe_lpc(), decouple_info(), dnxhd_decode_macroblocks(), dnxhd_setup_threads_slices(), dnxhd_unquantize_c(), dv_guess_qnos(), dv_inject_audio(), dv_set_class_number(), encode_frame(), ff_dnxhd_find_cid(), ff_do_elbg(), ff_rm_parse_packet(), film_read_header(), filter_channel(), flac_decode_frame(), flashsv_decode_frame(), floor_encode(), flush_packet(), gainCompensateAndOverlap(), generate_new_codebooks(), get_frame_mb(), get_guid(), gif_read_image(), idcin_decode_init(), indeo3_decode_frame(), ipvideo_decode_block_opcode_0x7(), ipvideo_decode_block_opcode_0x9(), ipvideo_decode_block_opcode_0xA(), ipvideo_decode_block_opcode_0xD(), ipvideo_decode_opcodes(), ir2_decode_plane(), libextractor_elf_extract(), matroska_parse_block(), mov_build_index(), mov_read_close(), msvideo1_decode_16bit(), nelly_decode_block(), pack_yuv(), pnm_decode_frame(), put_floor_header(), put_main_header(), put_vector(), qdm2_decode_fft_packets(), qdm2_decode_super_block(), qdm2_fft_tone_synthesizer(), qdm2_synthesis_filter(), reconstruct_and_encode_image(), remap_codebooks(), rematrix_channels(), residue_encode(), rpza_decode_stream(), seqvideo_decode(), shorten_decode_frame(), simple_lbg(), smc_decode_stream(), sp5x_decode_frame(), svq1_decode_frame(), svq3_decode_frame(), svq3_decode_mb(), try_shift_candidate(), txd_decode_frame(), unpack_modes(), vmd_decode(), vmdvideo_decode_init(), vorbis_encode_close(), vorbis_encode_frame(), vp3_calculate_pixel_addresses(), vp56_decode_frame(), and vp56_parse_mb_type_models().
00735 : 00736 case PIX_FMT_BGR8: 00737 { 00738 const uint8_t * const d64= dither_8x8_73[y&7]; 00739 const uint8_t * const d32= dither_8x8_32[y&7]; 00740 YSCALE_YUV_2_RGBX_C(uint8_t) 00741 ((uint8_t*)dest)[i2+0]= r[Y1+d32[(i2+0)&7]] + g[Y1+d32[(i2+0)&7]] + b[Y1+d64[(i2+0)&7]]; 00742 ((uint8_t*)dest)[i2+1]= r[Y2+d32[(i2+1)&7]] + g[Y2+d32[(i2+1)&7]] + b[Y2+d64[(i2+1)&7]]; 00743 } 00744 } 00745 break; 00746 case PIX_FMT_RGB4: 00747 case PIX_FMT_BGR4: 00748 { 00749 const uint8_t * const d64= dither_8x8_73 [y&7]; 00750 const uint8_t * const d128=dither_8x8_220[y&7]; 00751 YSCALE_YUV_2_RGBX_C(uint8_t) 00752 ((uint8_t*)dest)[i]= r[Y1+d128[(i2+0)&7]] + g[Y1+d64[(i2+0)&7]] + b[Y1+d128[(i2+0)&7]] 00753 +((r[Y2+d128[(i2+1)&7]] + g[Y2+d64[(i2+1)&7]] + b[Y2+d128[(i2+1)&7]])<<4); 00754 } 00755 } break;
| static double getSplineCoeff | ( | double | a, | |
| double | b, | |||
| double | c, | |||
| double | d, | |||
| double | dist | |||
| ) | [static] |
Definition at line 871 of file swscale.c.
Referenced by initFilter().
00912 : the HAVE_xyz is messed up after that line so don't use it
| static void getSubSampleFactors | ( | int * | h, | |
| int * | v, | |||
| int | format | |||
| ) | [static] |
Definition at line 1778 of file swscale.c.
01781 { 01782 01783 int length= c->srcW; 01784 int y= srcSliceY; 01785 int height= srcSliceH; 01786 int i, j; 01787 uint8_t *srcPtr= src[0]; 01788 uint8_t *dstPtr= dst[0] + dstStride[0]*y; 01789 for (i=0; i<height; i++) 01790 { 01791 for (j=0; j<length; j++) 01792 { 01793 dstPtr[j<<1] = srcPtr[j]; 01794 dstPtr[(j<<1)+1] = srcPtr[j]; 01795 } 01796 srcPtr+= srcStride[0]; 01797 dstPtr+= dstStride[0]; 01798 } 01799 return srcSliceH; 01800 } 01801 01802 static int gray16swap(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, 01803 int srcSliceH, uint8_t* dst[], int dstStride[]){ 01804 01805 int length= c->srcW; 01806 int y= srcSliceY; 01807 int height= srcSliceH; 01808 int i, j; 01809 uint16_t *srcPtr= (uint16_t*)src[0]; 01810 uint16_t *dstPtr= (uint16_t*)(dst[0] + dstStride[0]*y/2); 01811 for (i=0; i<height; i++) 01812 { 01813 for (j=0; j<length; j++) dstPtr[j] = bswap_16(srcPtr[j]); 01814 srcPtr+= srcStride[0]/2; 01815 dstPtr+= dstStride[0]/2; 01816 } 01817 return srcSliceH; 01818 } 01819 01820
| static SwsFunc getSwsFunc | ( | int | flags | ) | [static] |
Definition at line 1445 of file swscale.c.
01448 { 01449 int maxShift= 3-d; 01450 int shift=0; 01451 01452 memcpy(funnyCode + fragmentPos, fragmentA, fragmentLengthA); 01453 01454 funnyCode[fragmentPos + imm8OfPShufW1A]= 01455 funnyCode[fragmentPos + imm8OfPShufW2A]= 01456 a | (b<<2) | (c<<4) | (d<<6); 01457 01458 if (i+4>=dstW) shift=maxShift; //avoid overread 01459 else if ((filterPos[i/2]&3) <= maxShift) shift=filterPos[i/2]&3; //partial align 01460 01461 if (shift && i>=shift) 01462 { 01463 funnyCode[fragmentPos + imm8OfPShufW1A]+= 0x55*shift; 01464 funnyCode[fragmentPos + imm8OfPShufW2A]+= 0x55*shift; 01465 filterPos[i/2]-=shift; 01466 } 01467 01468 fragmentPos+= fragmentLengthA; 01469 } 01470 01471 funnyCode[fragmentPos]= RET; 01472 } 01473 xpos+=xInc; 01474 } 01475 filterPos[i/2]= xpos>>16; // needed to jump to the next part 01476 } 01477 #endif /* COMPILE_MMX2 */ 01478 01479 static void globalInit(void){ 01480 // generating tables: 01481 int i;
| static void globalInit | ( | void | ) | [static] |
| static int gray16swap | ( | SwsContext * | c, | |
| uint8_t * | src[], | |||
| int | srcStride[], | |||
| int | srcSliceY, | |||
| int | srcSliceH, | |||
| uint8_t * | dst[], | |||
| int | dstStride[] | |||
| ) | [static] |
Definition at line 1759 of file swscale.c.
References c.
01765 { 01766 int height= -((-srcSliceH)>>c->chrDstVSubSample); 01767 memset(dst[1], 128, dstStride[1]*height); 01768 memset(dst[2], 128, dstStride[2]*height); 01769 } 01770 if (c->srcFormat == PIX_FMT_GRAY16LE) srcPtr++; 01771 for (i=0; i<height; i++) 01772 { 01773 for (j=0; j<length; j++) dstPtr[j] = srcPtr[j<<1]; 01774 srcPtr+= srcStride[0]; 01775 dstPtr+= dstStride[0];
| static int gray16togray | ( | SwsContext * | c, | |
| uint8_t * | src[], | |||
| int | srcStride[], | |||
| int | srcSliceY, | |||
| int | srcSliceH, | |||
| uint8_t * | dst[], | |||
| int | dstStride[] | |||
| ) | [static] |
Definition at line 1712 of file swscale.c.
01721 { 01722 int plane; 01723 for (plane=0; plane<3; plane++) 01724 { 01725 int length= plane==0 ? c->srcW : -((-c->srcW )>>c->chrDstHSubSample); 01726 int y= plane==0 ? srcSliceY: -((-srcSliceY)>>c->chrDstVSubSample); 01727 int height= plane==0 ? srcSliceH: -((-srcSliceH)>>c->chrDstVSubSample); 01728 01729 if ((isGray(c->srcFormat) || isGray(c->dstFormat)) && plane>0) 01730 { 01731 if (!isGray(c->dstFormat)) 01732 memset(dst[plane], 128, dstStride[plane]*height); 01733 } 01734 else 01735 {
| static int graytogray16 | ( | SwsContext * | c, | |
| uint8_t * | src[], | |||
| int | srcStride[], | |||
| int | srcSliceY, | |||
| int | srcSliceH, | |||
| uint8_t * | dst[], | |||
| int | dstStride[] | |||
| ) | [static] |
Definition at line 1737 of file swscale.c.
References height.
01739 { 01740 int i; 01741 uint8_t *srcPtr= src[plane]; 01742 uint8_t *dstPtr= dst[plane] + dstStride[plane]*y; 01743 for (i=0; i<height; i++) 01744 { 01745 memcpy(dstPtr, srcPtr, length); 01746 srcPtr+= srcStride[plane]; 01747 dstPtr+= dstStride[plane]; 01748 } 01749 } 01750 } 01751 } 01752 return srcSliceH; 01753 } 01754 01755 static int gray16togray(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, 01756 int srcSliceH, uint8_t* dst[], int dstStride[]){ 01757
| static int initFilter | ( | int16_t ** | outFilter, | |
| int16_t ** | filterPos, | |||
| int * | outFilterSize, | |||
| int | xInc, | |||
| int | srcW, | |||
| int | dstW, | |||
| int | filterAlign, | |||
| int | one, | |||
| int | flags, | |||
| SwsVector * | srcFilter, | |||
| SwsVector * | dstFilter, | |||
| double | param[2] | |||
| ) | [inline, static] |
Definition at line 882 of file swscale.c.
References getSplineCoeff().
00912 : the HAVE_xyz is messed up after that line so don't use it 00913 00914 static double getSplineCoeff(double a, double b, double c, double d, double dist) 00915 { 00916 // printf("%f %f %f %f %f\n", a,b,c,d,dist); 00917 if (dist<=1.0) return ((d*dist + c)*dist + b)*dist +a; 00918 else return getSplineCoeff( 0.0, 00919 b+ 2.0*c + 3.0*d, 00920 c + 3.0*d, 00921 -b- 3.0*c - 6.0*d, 00922 dist-1.0); 00923 } 00924 00925 static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outFilterSize, int xInc, 00926 int srcW, int dstW, int filterAlign, int one, int flags, 00927 SwsVector *srcFilter, SwsVector *dstFilter, double param[2]) 00928 { 00929 int i; 00930 int filterSize; 00931 int filter2Size; 00932 int minFilterSize; 00933 double *filter=NULL; 00934 double *filter2=NULL; 00935 int ret= -1; 00936 #if defined(ARCH_X86) 00937 if (flags & SWS_CPU_CAPS_MMX) 00938 asm volatile("emms\n\t"::: "memory"); //FIXME this should not be required but it IS (even for non-MMX versions) 00939 #endif 00940 00941 // Note the +1 is for the MMXscaler which reads over the end 00942 *filterPos = av_malloc((dstW+1)*sizeof(int16_t)); 00943 00944 if (FFABS(xInc - 0x10000) <10) // unscaled 00945 { 00946 int i; 00947 filterSize= 1; 00948 filter= av_malloc(dstW*sizeof(double)*filterSize); 00949 for (i=0; i<dstW*filterSize; i++) filter[i]=0; 00950 00951 for (i=0; i<dstW; i++) 00952 { 00953 filter[i*filterSize]=1; 00954 (*filterPos)[i]=i; 00955 } 00956 00957 } 00958 else if (flags&SWS_POINT) // lame looking point sampling mode 00959 { 00960 int i; 00961 int xDstInSrc; 00962 filterSize= 1; 00963 filter= av_malloc(dstW*sizeof(double)*filterSize); 00964 00965 xDstInSrc= xInc/2 - 0x8000; 00966 for (i=0; i<dstW; i++) 00967 { 00968 int xx= (xDstInSrc - ((filterSize-1)<<15) + (1<<15))>>16; 00969 00970 (*filterPos)[i]= xx; 00971 filter[i]= 1.0; 00972 xDstInSrc+= xInc; 00973 } 00974 } 00975 else if ((xInc <= (1<<16) && (flags&SWS_AREA)) || (flags&SWS_FAST_BILINEAR)) // bilinear upscale 00976 { 00977 int i; 00978 int xDstInSrc; 00979 if (flags&SWS_BICUBIC) filterSize= 4; 00980 else if (flags&SWS_X ) filterSize= 4; 00981 else filterSize= 2; // SWS_BILINEAR / SWS_AREA 00982 filter= av_malloc(dstW*sizeof(double)*filterSize); 00983 00984 xDstInSrc= xInc/2 - 0x8000; 00985 for (i=0; i<dstW; i++) 00986 { 00987 int xx= (xDstInSrc - ((filterSize-1)<<15) + (1<<15))>>16; 00988 int j; 00989 00990 (*filterPos)[i]= xx; 00991 //Bilinear upscale / linear interpolate / Area averaging 00992 for (j=0; j<filterSize; j++) 00993 { 00994 double d= FFABS((xx<<16) - xDstInSrc)/(double)(1<<16); 00995 double coeff= 1.0 - d; 00996 if (coeff<0) coeff=0; 00997 filter[i*filterSize + j]= coeff; 00998 xx++; 00999 } 01000 xDstInSrc+= xInc; 01001 } 01002 } 01003 else 01004 { 01005 double xDstInSrc; 01006 double sizeFactor, filterSizeInSrc; 01007 const double xInc1= (double)xInc / (double)(1<<16); 01008 01009 if (flags&SWS_BICUBIC) sizeFactor= 4.0; 01010 else if (flags&SWS_X) sizeFactor= 8.0; 01011 else if (flags&SWS_AREA) sizeFactor= 1.0; //downscale only, for upscale it is bilinear 01012 else if (flags&SWS_GAUSS) sizeFactor= 8.0; // infinite ;) 01013 else if (flags&SWS_LANCZOS) sizeFactor= param[0] != SWS_PARAM_DEFAULT ? 2.0*param[0] : 6.0; 01014 else if (flags&SWS_SINC) size