• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libswscale/yuv2rgb_mlib.c

Go to the documentation of this file.
00001 /*
00002  * software YUV to RGB converter using mediaLib
00003  *
00004  * Copyright (C) 2003 Michael Niedermayer <michaelni@gmx.at>
00005  *
00006  * This file is part of FFmpeg.
00007  *
00008  * FFmpeg is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2.1 of the License, or (at your option) any later version.
00012  *
00013  * FFmpeg is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with FFmpeg; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00021  */
00022 
00023 #include <mlib_types.h>
00024 #include <mlib_status.h>
00025 #include <mlib_sys.h>
00026 #include <mlib_video.h>
00027 #include <inttypes.h>
00028 #include <stdlib.h>
00029 #include <assert.h>
00030 
00031 #include "swscale.h"
00032 
00033 static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
00034                                int srcSliceH, uint8_t* dst[], int dstStride[]){
00035     if(c->srcFormat == PIX_FMT_YUV422P){
00036         srcStride[1] *= 2;
00037         srcStride[2] *= 2;
00038     }
00039 
00040     assert(srcStride[1] == srcStride[2]);
00041 
00042     mlib_VideoColorYUV2ARGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
00043                                srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
00044     return srcSliceH;
00045 }
00046 
00047 static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
00048                                int srcSliceH, uint8_t* dst[], int dstStride[]){
00049     if(c->srcFormat == PIX_FMT_YUV422P){
00050         srcStride[1] *= 2;
00051         srcStride[2] *= 2;
00052     }
00053 
00054     assert(srcStride[1] == srcStride[2]);
00055 
00056     mlib_VideoColorYUV2ABGR420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
00057                                srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
00058     return srcSliceH;
00059 }
00060 
00061 static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
00062                               int srcSliceH, uint8_t* dst[], int dstStride[]){
00063     if(c->srcFormat == PIX_FMT_YUV422P){
00064         srcStride[1] *= 2;
00065         srcStride[2] *= 2;
00066     }
00067 
00068     assert(srcStride[1] == srcStride[2]);
00069 
00070     mlib_VideoColorYUV2RGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
00071                               srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
00072     return srcSliceH;
00073 }
00074 
00075 
00076 SwsFunc sws_yuv2rgb_init_mlib(SwsContext *c)
00077 {
00078     switch(c->dstFormat){
00079     case PIX_FMT_RGB24: return mlib_YUV2RGB420_24;
00080     case PIX_FMT_BGR32: return mlib_YUV2ARGB420_32;
00081     case PIX_FMT_RGB32: return mlib_YUV2ABGR420_32;
00082     default: return NULL;
00083     }
00084 }
00085 

Generated on Sat Feb 16 2013 09:23:15 for ffmpeg by  doxygen 1.7.1