annotate libswscale/yuv2rgb_mlib.c @ 19445:f95c2db61ee3

help_mp-hu.h & xml/hu/ports.xml synced with r19449
author Gabrov
date Sat, 19 Aug 2006 12:34:01 +0000
parents ac69ba536915
children 8e50cba9fe03
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1 /*
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2 * yuv2rgb_mlib.c, Software YUV to RGB coverter using mediaLib
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
3 *
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
4 * Copyright (C) 2000, Håkan Hjort <d95hjort@dtek.chalmers.se>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
5 * All Rights Reserved.
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
6 *
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
7 * This file is part of mpeg2dec, a free MPEG-2 video decoder
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
8 *
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
9 * mpeg2dec is free software; you can redistribute it and/or modify
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
11 * the Free Software Foundation; either version 2, or (at your option)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
12 * any later version.
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
13 *
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
14 * mpeg2dec is distributed in the hope that it will be useful,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
17 * GNU General Public License for more details.
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
18 *
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
20 * along with GNU Make; see the file COPYING. If not, write to
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
21 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
22 *
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
23 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
24
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
25 #include <mlib_types.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
26 #include <mlib_status.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
27 #include <mlib_sys.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
28 #include <mlib_video.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
29 #include <inttypes.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
30 #include <stdlib.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
31 #include <assert.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
32
19431
ac69ba536915 Explicitly include libmpcodecs/img_format.h and libvo/fastmemcpy.h.
diego
parents: 18861
diff changeset
33 #include "libmpcodecs/img_format.h" //FIXME try to reduce dependency of such stuff
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
34 #include "swscale.h"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
35
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
36 static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
37 int srcSliceH, uint8_t* dst[], int dstStride[]){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
38 if(c->srcFormat == IMGFMT_422P){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
39 srcStride[1] *= 2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
40 srcStride[2] *= 2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
41 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
42
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
43 assert(srcStride[1] == srcStride[2]);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
44
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
45 mlib_VideoColorYUV2ARGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
46 srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
47 return srcSliceH;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
48 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
49
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
50 static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
51 int srcSliceH, uint8_t* dst[], int dstStride[]){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
52 if(c->srcFormat == IMGFMT_422P){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
53 srcStride[1] *= 2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
54 srcStride[2] *= 2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
55 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
56
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
57 assert(srcStride[1] == srcStride[2]);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
58
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
59 mlib_VideoColorYUV2ABGR420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
60 srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
61 return srcSliceH;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
62 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
63
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
64 static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
65 int srcSliceH, uint8_t* dst[], int dstStride[]){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
66 if(c->srcFormat == IMGFMT_422P){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
67 srcStride[1] *= 2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
68 srcStride[2] *= 2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
69 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
70
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
71 assert(srcStride[1] == srcStride[2]);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
72
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
73 mlib_VideoColorYUV2RGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
74 srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
75 return srcSliceH;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
76 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
77
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
78
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
79 SwsFunc yuv2rgb_init_mlib(SwsContext *c)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
80 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
81 switch(c->dstFormat){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
82 case IMGFMT_RGB24: return mlib_YUV2RGB420_24;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
83 case IMGFMT_RGB32: return mlib_YUV2ARGB420_32;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
84 case IMGFMT_BGR32: return mlib_YUV2ABGR420_32;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
85 default: return NULL;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
86 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
87 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
88