annotate libswscale/bfin/swscale_bfin.c @ 32651:6eaa0d19ac10

Make internal FFmpeg use the new API that does not pose a limit on the maximum number of streams.
author reimar
date Fri, 31 Dec 2010 16:04:57 +0000
parents 1f7d0e9e2ebf
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29042
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
1 /*
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
2 * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com>
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
3 *
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
4 * Blackfin software video scaler operations
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
5 *
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
6 * This file is part of FFmpeg.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
7 *
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
12 *
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
16 * Lesser General Public License for more details.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
17 *
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
21 */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
22
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
23 #include <stdio.h>
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
24 #include <stdlib.h>
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
25 #include <string.h>
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
26 #include <inttypes.h>
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
27 #include <assert.h>
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
28 #include "config.h"
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
29 #include <unistd.h>
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
30 #include "libswscale/rgb2rgb.h"
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
31 #include "libswscale/swscale.h"
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
32 #include "libswscale/swscale_internal.h"
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
33
30430
cdb6693dd949 Blackfin: use SRAM only when CONFIG_SRAM is set
mru
parents: 29042
diff changeset
34 #if defined (__FDPIC__) && CONFIG_SRAM
29042
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
35 #define L1CODE __attribute__ ((l1_text))
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
36 #else
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
37 #define L1CODE
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
38 #endif
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
39
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
40 int ff_bfin_uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
31113
1f7d0e9e2ebf Revert r31153. It failed to build on:
ramiro
parents: 31096
diff changeset
41 long width, long height,
1f7d0e9e2ebf Revert r31153. It failed to build on:
ramiro
parents: 31096
diff changeset
42 long lumStride, long chromStride, long srcStride) L1CODE;
29042
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
43
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
44 int ff_bfin_yuyvtoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
31113
1f7d0e9e2ebf Revert r31153. It failed to build on:
ramiro
parents: 31096
diff changeset
45 long width, long height,
1f7d0e9e2ebf Revert r31153. It failed to build on:
ramiro
parents: 31096
diff changeset
46 long lumStride, long chromStride, long srcStride) L1CODE;
29042
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
47
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
48 static int uyvytoyv12_unscaled(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
49 int srcSliceH, uint8_t* dst[], int dstStride[])
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
50 {
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
51 uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
52 uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
53 uint8_t *dstv = dst[2] + dstStride[2]*srcSliceY/2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
54 uint8_t *ip = src[0] + srcStride[0]*srcSliceY;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
55 int w = dstStride[0];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
56
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
57 ff_bfin_uyvytoyv12(ip, dsty, dstu, dstv, w, srcSliceH,
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
58 dstStride[0], dstStride[1], srcStride[0]);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
59
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
60 return srcSliceH;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
61 }
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
62
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
63 static int yuyvtoyv12_unscaled(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
64 int srcSliceH, uint8_t* dst[], int dstStride[])
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
65 {
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
66 uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
67 uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
68 uint8_t *dstv = dst[2] + dstStride[2]*srcSliceY/2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
69 uint8_t *ip = src[0] + srcStride[0]*srcSliceY;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
70 int w = dstStride[0];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
71
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
72 ff_bfin_yuyvtoyv12(ip, dsty, dstu, dstv, w, srcSliceH,
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
73 dstStride[0], dstStride[1], srcStride[0]);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
74
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
75 return srcSliceH;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
76 }
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
77
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
78
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
79 void ff_bfin_get_unscaled_swscale(SwsContext *c)
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
80 {
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
81 SwsFunc swScale = c->swScale;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
82 if (c->flags & SWS_CPU_CAPS_BFIN)
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
83 if (c->dstFormat == PIX_FMT_YUV420P)
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
84 if (c->srcFormat == PIX_FMT_UYVY422) {
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
85 av_log (NULL, AV_LOG_VERBOSE, "selecting Blackfin optimized uyvytoyv12_unscaled\n");
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
86 c->swScale = uyvytoyv12_unscaled;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
87 }
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
88 if (c->dstFormat == PIX_FMT_YUV420P)
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
89 if (c->srcFormat == PIX_FMT_YUYV422) {
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
90 av_log (NULL, AV_LOG_VERBOSE, "selecting Blackfin optimized yuyvtoyv12_unscaled\n");
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
91 c->swScale = yuyvtoyv12_unscaled;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
92 }
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
93 }