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
00031 #include "libswscale/rgb2rgb.h"
00032 #include "libswscale/swscale.h"
00033 #include "libswscale/swscale_internal.h"
00034
00035 #if defined (__FDPIC__) && CONFIG_SRAM
00036 #define L1CODE __attribute__((l1_text))
00037 #else
00038 #define L1CODE
00039 #endif
00040
00041 int ff_bfin_uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
00042 uint8_t *vdst, int width, int height,
00043 int lumStride, int chromStride, int srcStride) L1CODE;
00044
00045 int ff_bfin_yuyvtoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
00046 uint8_t *vdst, int width, int height,
00047 int lumStride, int chromStride, int srcStride) L1CODE;
00048
00049 static int uyvytoyv12_unscaled(SwsContext *c, uint8_t *src[], int srcStride[],
00050 int srcSliceY, int srcSliceH, uint8_t *dst[],
00051 int dstStride[])
00052 {
00053 uint8_t *dsty = dst[0] + dstStride[0] * srcSliceY;
00054 uint8_t *dstu = dst[1] + dstStride[1] * srcSliceY / 2;
00055 uint8_t *dstv = dst[2] + dstStride[2] * srcSliceY / 2;
00056 uint8_t *ip = src[0] + srcStride[0] * srcSliceY;
00057 int w = dstStride[0];
00058
00059 ff_bfin_uyvytoyv12(ip, dsty, dstu, dstv, w, srcSliceH,
00060 dstStride[0], dstStride[1], srcStride[0]);
00061
00062 return srcSliceH;
00063 }
00064
00065 static int yuyvtoyv12_unscaled(SwsContext *c, uint8_t *src[], int srcStride[],
00066 int srcSliceY, int srcSliceH, uint8_t *dst[],
00067 int dstStride[])
00068 {
00069 uint8_t *dsty = dst[0] + dstStride[0] * srcSliceY;
00070 uint8_t *dstu = dst[1] + dstStride[1] * srcSliceY / 2;
00071 uint8_t *dstv = dst[2] + dstStride[2] * srcSliceY / 2;
00072 uint8_t *ip = src[0] + srcStride[0] * srcSliceY;
00073 int w = dstStride[0];
00074
00075 ff_bfin_yuyvtoyv12(ip, dsty, dstu, dstv, w, srcSliceH,
00076 dstStride[0], dstStride[1], srcStride[0]);
00077
00078 return srcSliceH;
00079 }
00080
00081 void ff_bfin_get_unscaled_swscale(SwsContext *c)
00082 {
00083 if (c->dstFormat == PIX_FMT_YUV420P && c->srcFormat == PIX_FMT_UYVY422) {
00084 av_log(NULL, AV_LOG_VERBOSE,
00085 "selecting Blackfin optimized uyvytoyv12_unscaled\n");
00086 c->swScale = uyvytoyv12_unscaled;
00087 }
00088 if (c->dstFormat == PIX_FMT_YUV420P && c->srcFormat == PIX_FMT_YUYV422) {
00089 av_log(NULL, AV_LOG_VERBOSE,
00090 "selecting Blackfin optimized yuyvtoyv12_unscaled\n");
00091 c->swScale = yuyvtoyv12_unscaled;
00092 }
00093 }