annotate libswscale/swscale_bfin.c @ 28918:0fc1194ec544

Prefer ffdv over qdv, it seems qdv can not play some FFmpeg-encoded samples.
author reimar
date Sun, 15 Mar 2009 09:25:50 +0000
parents e9e41961f16e
children f0687e100b07
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 #include <unistd.h>
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
30 #include "rgb2rgb.h"
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
31 #include "swscale.h"
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
32 #include "swscale_internal.h"
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
33
25978
a8ff60976ccb FLAT objects cannot have multiple sections, so using the L1 attributes breaks
diego
parents: 23813
diff changeset
34 #ifdef __FDPIC__
a8ff60976ccb FLAT objects cannot have multiple sections, so using the L1 attributes breaks
diego
parents: 23813
diff changeset
35 #define L1CODE __attribute__ ((l1_text))
a8ff60976ccb FLAT objects cannot have multiple sections, so using the L1 attributes breaks
diego
parents: 23813
diff changeset
36 #else
a8ff60976ccb FLAT objects cannot have multiple sections, so using the L1 attributes breaks
diego
parents: 23813
diff changeset
37 #define L1CODE
a8ff60976ccb FLAT objects cannot have multiple sections, so using the L1 attributes breaks
diego
parents: 23813
diff changeset
38 #endif
23584
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
39
28048
3cfb920cbe4b Delete unnecessary 'extern' keywords.
diego
parents: 27158
diff changeset
40 int ff_bfin_uyvytoyv12 (const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
3cfb920cbe4b Delete unnecessary 'extern' keywords.
diego
parents: 27158
diff changeset
41 long width, long height,
3cfb920cbe4b Delete unnecessary 'extern' keywords.
diego
parents: 27158
diff changeset
42 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
43
28048
3cfb920cbe4b Delete unnecessary 'extern' keywords.
diego
parents: 27158
diff changeset
44 int ff_bfin_yuyvtoyv12 (const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
3cfb920cbe4b Delete unnecessary 'extern' keywords.
diego
parents: 27158
diff changeset
45 long width, long height,
3cfb920cbe4b Delete unnecessary 'extern' keywords.
diego
parents: 27158
diff changeset
46 long lumStride, long chromStride, long srcStride) L1CODE;
23813
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
47
23584
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
48 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
49 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
50 {
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
51 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
52 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
53 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
54 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
55 int w = dstStride[0];
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
56
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
57 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
58
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
59 return srcSliceH;
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
60 }
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
61
23813
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
62 static int yuyvtoyv12_unscaled (SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
63 int srcSliceH, uint8_t* dst[], int dstStride[])
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
64 {
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
65 uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY;
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
66 uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2;
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
67 uint8_t *dstv = dst[2] + dstStride[2]*srcSliceY/2;
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
68 uint8_t *ip = src[0] + srcStride[0]*srcSliceY;
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
69 int w = dstStride[0];
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
70
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
71 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
72
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
73 return srcSliceH;
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
74 }
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
75
23584
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
76
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
77 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
78 {
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
79 SwsFunc swScale = c->swScale;
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
80 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
81 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
82 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
83 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
84 c->swScale = uyvytoyv12_unscaled;
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
85 }
23813
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
86 if (c->dstFormat == PIX_FMT_YUV420P)
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
87 if (c->srcFormat == PIX_FMT_YUYV422) {
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
88 av_log (NULL, AV_LOG_VERBOSE, "selecting Blackfin optimized yuyvtoyv12_unscaled\n");
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
89 c->swScale = yuyvtoyv12_unscaled;
5b10bd9793b8 integrating blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23584
diff changeset
90 }
23584
a01f8876ea2c adding Blackfin swscale_bfin infrastructure, and the first swscale routine uyvy to yv12 video resampler
mhoffman
parents:
diff changeset
91 }