annotate libswscale/swscale_bfin.c @ 27158:65b8334df960

spelling/grammar/wording overhaul
author diego
date Fri, 04 Jul 2008 13:49:45 +0000
parents a8ff60976ccb
children 3cfb920cbe4b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23584
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
1 /*
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
2 * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com>
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
3 *
27158
65b8334df960 spelling/grammar/wording overhaul
diego
parents: 25978
diff changeset
4 * Blackfin software video scaler operations
23584
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
5 *
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
6 * This file is part of FFmpeg.
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
7 *
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
12 *
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
16 * Lesser General Public License for more details.
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
17 *
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
21 */
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
22
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
23 #include <stdio.h>
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
24 #include <stdlib.h>
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
25 #include <string.h>
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
26 #include <inttypes.h>
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
27 #include <assert.h>
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
28 #include "config.h"
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
29 #ifdef HAVE_MALLOC_H
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
30 #include <malloc.h>
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
31 #endif
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
32 #include <unistd.h>
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
33 #include "rgb2rgb.h"
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
34 #include "swscale.h"
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
35 #include "swscale_internal.h"
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
36
25978
a8ff60976ccb FLAT objects cannot have multiple sections, so using the L1 attributes breaks
diego
parents: 23813
diff changeset
37 #ifdef __FDPIC__
a8ff60976ccb FLAT objects cannot have multiple sections, so using the L1 attributes breaks
diego
parents: 23813
diff changeset
38 #define L1CODE __attribute__ ((l1_text))
a8ff60976ccb FLAT objects cannot have multiple sections, so using the L1 attributes breaks
diego
parents: 23813
diff changeset
39 #else
a8ff60976ccb FLAT objects cannot have multiple sections, so using the L1 attributes breaks
diego
parents: 23813
diff changeset
40 #define L1CODE
a8ff60976ccb FLAT objects cannot have multiple sections, so using the L1 attributes breaks
diego
parents: 23813
diff changeset
41 #endif
23584
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
42
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
43 extern int ff_bfin_uyvytoyv12 (const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
44 long width, long height,
25978
a8ff60976ccb FLAT objects cannot have multiple sections, so using the L1 attributes breaks
diego
parents: 23813
diff changeset
45 long lumStride, long chromStride, long srcStride) L1CODE;
23584
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
46
23813
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
47 extern int ff_bfin_yuyvtoyv12 (const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
48 long width, long height,
25978
a8ff60976ccb FLAT objects cannot have multiple sections, so using the L1 attributes breaks
diego
parents: 23813
diff changeset
49 long lumStride, long chromStride, long srcStride) L1CODE;
23813
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
50
23584
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
51 static int uyvytoyv12_unscaled (SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
52 int srcSliceH, uint8_t* dst[], int dstStride[])
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
53 {
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
54 uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY;
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
55 uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2;
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
56 uint8_t *dstv = dst[2] + dstStride[2]*srcSliceY/2;
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
57 uint8_t *ip = src[0] + srcStride[0]*srcSliceY;
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
58 int w = dstStride[0];
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
59
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
60 ff_bfin_uyvytoyv12 (ip, dsty, dstu, dstv, w, srcSliceH, dstStride[0], dstStride[1], srcStride[0]);
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
61
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
62 return srcSliceH;
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
63 }
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
64
23813
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
65 static int yuyvtoyv12_unscaled (SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
66 int srcSliceH, uint8_t* dst[], int dstStride[])
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
67 {
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
68 uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY;
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
69 uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2;
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
70 uint8_t *dstv = dst[2] + dstStride[2]*srcSliceY/2;
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
71 uint8_t *ip = src[0] + srcStride[0]*srcSliceY;
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
72 int w = dstStride[0];
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
73
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
74 ff_bfin_yuyvtoyv12 (ip, dsty, dstu, dstv, w, srcSliceH, dstStride[0], dstStride[1], srcStride[0]);
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
75
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
76 return srcSliceH;
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
77 }
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
78
23584
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
79
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
80 void ff_bfin_get_unscaled_swscale (SwsContext *c)
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
81 {
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
82 SwsFunc swScale = c->swScale;
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
83 if (c->flags & SWS_CPU_CAPS_BFIN)
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
84 if (c->dstFormat == PIX_FMT_YUV420P)
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
85 if (c->srcFormat == PIX_FMT_UYVY422) {
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
86 av_log (NULL, AV_LOG_VERBOSE, "selecting Blackfin optimized uyvytoyv12_unscaled\n");
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
87 c->swScale = uyvytoyv12_unscaled;
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
88 }
23813
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
89 if (c->dstFormat == PIX_FMT_YUV420P)
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
90 if (c->srcFormat == PIX_FMT_YUYV422) {
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
91 av_log (NULL, AV_LOG_VERBOSE, "selecting Blackfin optimized yuyvtoyv12_unscaled\n");
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
92 c->swScale = yuyvtoyv12_unscaled;
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
93 }
23584
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
94 }