FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
swscale_bfin.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com>
3  *
4  * Blackfin software video scaler operations
5  *
6  * This file is part of FFmpeg.
7  *
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.
12  *
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.
17  *
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
21  */
22 
23 #include <stdint.h>
24 
25 #include "config.h"
26 #include "libavutil/attributes.h"
28 
29 #if defined (__FDPIC__) && CONFIG_SRAM
30 #define L1CODE __attribute__((l1_text))
31 #else
32 #define L1CODE
33 #endif
34 
35 int ff_bfin_uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
36  uint8_t *vdst, int width, int height,
37  int lumStride, int chromStride, int srcStride) L1CODE;
38 
39 int ff_bfin_yuyvtoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
40  uint8_t *vdst, int width, int height,
41  int lumStride, int chromStride, int srcStride) L1CODE;
42 
43 static int uyvytoyv12_unscaled(SwsContext *c, const uint8_t *src[],
44  int srcStride[], int srcSliceY, int srcSliceH,
45  uint8_t *dst[], int dstStride[])
46 {
47  uint8_t *dsty = dst[0] + dstStride[0] * srcSliceY;
48  uint8_t *dstu = dst[1] + dstStride[1] * srcSliceY / 2;
49  uint8_t *dstv = dst[2] + dstStride[2] * srcSliceY / 2;
50  const uint8_t *ip = src[0] + srcStride[0] * srcSliceY;
51  int w = dstStride[0];
52 
53  ff_bfin_uyvytoyv12(ip, dsty, dstu, dstv, w, srcSliceH,
54  dstStride[0], dstStride[1], srcStride[0]);
55 
56  return srcSliceH;
57 }
58 
59 static int yuyvtoyv12_unscaled(SwsContext *c, const uint8_t *src[],
60  int srcStride[], int srcSliceY, int srcSliceH,
61  uint8_t *dst[], int dstStride[])
62 {
63  uint8_t *dsty = dst[0] + dstStride[0] * srcSliceY;
64  uint8_t *dstu = dst[1] + dstStride[1] * srcSliceY / 2;
65  uint8_t *dstv = dst[2] + dstStride[2] * srcSliceY / 2;
66  const uint8_t *ip = src[0] + srcStride[0] * srcSliceY;
67  int w = dstStride[0];
68 
69  ff_bfin_yuyvtoyv12(ip, dsty, dstu, dstv, w, srcSliceH,
70  dstStride[0], dstStride[1], srcStride[0]);
71 
72  return srcSliceH;
73 }
74 
76 {
78  av_log(NULL, AV_LOG_VERBOSE,
79  "selecting Blackfin optimized uyvytoyv12_unscaled\n");
81  }
83  av_log(NULL, AV_LOG_VERBOSE,
84  "selecting Blackfin optimized yuyvtoyv12_unscaled\n");
86  }
87 }