• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libswscale/bfin/swscale_bfin.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com>
00003  *
00004  * Blackfin software video scaler operations
00005  *
00006  * This file is part of FFmpeg.
00007  *
00008  * FFmpeg is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2.1 of the License, or (at your option) any later version.
00012  *
00013  * FFmpeg is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with FFmpeg; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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                        long width, long height,
00042                        long lumStride, long chromStride, long srcStride) L1CODE;
00043 
00044 int ff_bfin_yuyvtoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
00045                        long width, long height,
00046                        long lumStride, long chromStride, long 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     SwsFunc swScale = c->swScale;
00082     if (c->flags & SWS_CPU_CAPS_BFIN)
00083         if (c->dstFormat == PIX_FMT_YUV420P)
00084             if (c->srcFormat == PIX_FMT_UYVY422) {
00085                 av_log (NULL, AV_LOG_VERBOSE, "selecting Blackfin optimized uyvytoyv12_unscaled\n");
00086                 c->swScale = uyvytoyv12_unscaled;
00087             }
00088         if (c->dstFormat == PIX_FMT_YUV420P)
00089             if (c->srcFormat == PIX_FMT_YUYV422) {
00090                 av_log (NULL, AV_LOG_VERBOSE, "selecting Blackfin optimized yuyvtoyv12_unscaled\n");
00091                 c->swScale = yuyvtoyv12_unscaled;
00092             }
00093 }

Generated on Fri Sep 16 2011 17:17:52 for FFmpeg by  doxygen 1.7.1