sync mga_vid.h to revision 265 from the mga_vid repo
[mplayer/glamo.git] / libswscale / swscale_bfin.c
blobbbc304dfe35616878405d40dfceabf6c8d1e8022
1 /*
2 * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com>
4 * Blackfin Software Video SCALER Operations
6 * This file is part of FFmpeg.
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <string.h>
26 #include <inttypes.h>
27 #include <assert.h>
28 #include "config.h"
29 #ifdef HAVE_MALLOC_H
30 #include <malloc.h>
31 #endif
32 #include <unistd.h>
33 #include "rgb2rgb.h"
34 #include "swscale.h"
35 #include "swscale_internal.h"
37 #ifdef __FDPIC__
38 #define L1CODE __attribute__ ((l1_text))
39 #else
40 #define L1CODE
41 #endif
43 extern int ff_bfin_uyvytoyv12 (const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
44 long width, long height,
45 long lumStride, long chromStride, long srcStride) L1CODE;
47 extern int ff_bfin_yuyvtoyv12 (const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
48 long width, long height,
49 long lumStride, long chromStride, long srcStride) L1CODE;
51 static int uyvytoyv12_unscaled (SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
52 int srcSliceH, uint8_t* dst[], int dstStride[])
54 uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY;
55 uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2;
56 uint8_t *dstv = dst[2] + dstStride[2]*srcSliceY/2;
57 uint8_t *ip = src[0] + srcStride[0]*srcSliceY;
58 int w = dstStride[0];
60 ff_bfin_uyvytoyv12 (ip, dsty, dstu, dstv, w, srcSliceH, dstStride[0], dstStride[1], srcStride[0]);
62 return srcSliceH;
65 static int yuyvtoyv12_unscaled (SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
66 int srcSliceH, uint8_t* dst[], int dstStride[])
68 uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY;
69 uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2;
70 uint8_t *dstv = dst[2] + dstStride[2]*srcSliceY/2;
71 uint8_t *ip = src[0] + srcStride[0]*srcSliceY;
72 int w = dstStride[0];
74 ff_bfin_yuyvtoyv12 (ip, dsty, dstu, dstv, w, srcSliceH, dstStride[0], dstStride[1], srcStride[0]);
76 return srcSliceH;
80 void ff_bfin_get_unscaled_swscale (SwsContext *c)
82 SwsFunc swScale = c->swScale;
83 if (c->flags & SWS_CPU_CAPS_BFIN)
84 if (c->dstFormat == PIX_FMT_YUV420P)
85 if (c->srcFormat == PIX_FMT_UYVY422) {
86 av_log (NULL, AV_LOG_VERBOSE, "selecting Blackfin optimized uyvytoyv12_unscaled\n");
87 c->swScale = uyvytoyv12_unscaled;
89 if (c->dstFormat == PIX_FMT_YUV420P)
90 if (c->srcFormat == PIX_FMT_YUYV422) {
91 av_log (NULL, AV_LOG_VERBOSE, "selecting Blackfin optimized yuyvtoyv12_unscaled\n");
92 c->swScale = yuyvtoyv12_unscaled;