00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <stdio.h>
00024 #include <stdlib.h>
00025 #include <string.h>
00026 #include <inttypes.h>
00027 #include <assert.h>
00028 #include "config.h"
00029 #include <unistd.h>
00030 #include "libswscale/rgb2rgb.h"
00031 #include "libswscale/swscale.h"
00032 #include "libswscale/swscale_internal.h"
00033
00034 #if defined (__FDPIC__) && CONFIG_SRAM
00035 #define L1CODE __attribute__ ((l1_text))
00036 #else
00037 #define L1CODE
00038 #endif
00039
00040 int ff_bfin_uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
00041 int width, int height,
00042 int lumStride, int chromStride, int srcStride) L1CODE;
00043
00044 int ff_bfin_yuyvtoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
00045 int width, int height,
00046 int lumStride, int chromStride, int srcStride) L1CODE;
00047
00048 static int uyvytoyv12_unscaled(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
00049 int srcSliceH, uint8_t* dst[], int dstStride[])
00050 {
00051 uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY;
00052 uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2;
00053 uint8_t *dstv = dst[2] + dstStride[2]*srcSliceY/2;
00054 uint8_t *ip = src[0] + srcStride[0]*srcSliceY;
00055 int w = dstStride[0];
00056
00057 ff_bfin_uyvytoyv12(ip, dsty, dstu, dstv, w, srcSliceH,
00058 dstStride[0], dstStride[1], srcStride[0]);
00059
00060 return srcSliceH;
00061 }
00062
00063 static int yuyvtoyv12_unscaled(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
00064 int srcSliceH, uint8_t* dst[], int dstStride[])
00065 {
00066 uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY;
00067 uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2;
00068 uint8_t *dstv = dst[2] + dstStride[2]*srcSliceY/2;
00069 uint8_t *ip = src[0] + srcStride[0]*srcSliceY;
00070 int w = dstStride[0];
00071
00072 ff_bfin_yuyvtoyv12(ip, dsty, dstu, dstv, w, srcSliceH,
00073 dstStride[0], dstStride[1], srcStride[0]);
00074
00075 return srcSliceH;
00076 }
00077
00078
00079 void ff_bfin_get_unscaled_swscale(SwsContext *c)
00080 {
00081 if (c->dstFormat == PIX_FMT_YUV420P && c->srcFormat == PIX_FMT_UYVY422) {
00082 av_log (NULL, AV_LOG_VERBOSE, "selecting Blackfin optimized uyvytoyv12_unscaled\n");
00083 c->swScale = uyvytoyv12_unscaled;
00084 }
00085 if (c->dstFormat == PIX_FMT_YUV420P && c->srcFormat == PIX_FMT_YUYV422) {
00086 av_log (NULL, AV_LOG_VERBOSE, "selecting Blackfin optimized yuyvtoyv12_unscaled\n");
00087 c->swScale = yuyvtoyv12_unscaled;
00088 }
00089 }