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
26 #include "libavutil/attributes.h"
27 #include "libavutil/bfin/attributes.h"
28 #include "libswscale/swscale_internal.h"
30 int ff_bfin_uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
31 uint8_t *vdst, int width, int height,
32 int lumStride, int chromStride,
33 int srcStride) attribute_l1_text;
35 int ff_bfin_yuyvtoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
36 uint8_t *vdst, int width, int height,
37 int lumStride, int chromStride,
38 int srcStride) attribute_l1_text;
40 static int uyvytoyv12_unscaled(SwsContext *c, const uint8_t *src[],
41 int srcStride[], int srcSliceY, int srcSliceH,
42 uint8_t *dst[], int dstStride[])
44 uint8_t *dsty = dst[0] + dstStride[0] * srcSliceY;
45 uint8_t *dstu = dst[1] + dstStride[1] * srcSliceY / 2;
46 uint8_t *dstv = dst[2] + dstStride[2] * srcSliceY / 2;
47 const uint8_t *ip = src[0] + srcStride[0] * srcSliceY;
50 ff_bfin_uyvytoyv12(ip, dsty, dstu, dstv, w, srcSliceH,
51 dstStride[0], dstStride[1], srcStride[0]);
56 static int yuyvtoyv12_unscaled(SwsContext *c, const uint8_t *src[],
57 int srcStride[], int srcSliceY, int srcSliceH,
58 uint8_t *dst[], int dstStride[])
60 uint8_t *dsty = dst[0] + dstStride[0] * srcSliceY;
61 uint8_t *dstu = dst[1] + dstStride[1] * srcSliceY / 2;
62 uint8_t *dstv = dst[2] + dstStride[2] * srcSliceY / 2;
63 const uint8_t *ip = src[0] + srcStride[0] * srcSliceY;
66 ff_bfin_yuyvtoyv12(ip, dsty, dstu, dstv, w, srcSliceH,
67 dstStride[0], dstStride[1], srcStride[0]);
72 av_cold void ff_get_unscaled_swscale_bfin(SwsContext *c)
74 if (c->dstFormat == AV_PIX_FMT_YUV420P && c->srcFormat == AV_PIX_FMT_UYVY422) {
75 av_log(NULL, AV_LOG_VERBOSE,
76 "selecting Blackfin optimized uyvytoyv12_unscaled\n");
77 c->swscale = uyvytoyv12_unscaled;
79 if (c->dstFormat == AV_PIX_FMT_YUV420P && c->srcFormat == AV_PIX_FMT_YUYV422) {
80 av_log(NULL, AV_LOG_VERBOSE,
81 "selecting Blackfin optimized yuyvtoyv12_unscaled\n");
82 c->swscale = yuyvtoyv12_unscaled;