~ubuntu-branches/ubuntu/hardy/avidemux/hardy

« back to all changes in this revision

Viewing changes to avidemux/ADM_libswscale/yuv2rgb_mlib.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2006-12-15 17:13:20 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20061215171320-w79pvpehxx2fr217
Tags: 1:2.3.0-0.0ubuntu1
* Merge from debian-multimedia.org, remaining Ubuntu change:
  - desktop file,
  - no support for ccache and make -j.
* Closes Ubuntu: #69614.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * yuv2rgb_mlib.c, Software YUV to RGB coverter using mediaLib
 
3
 *
 
4
 *  Copyright (C) 2000, H�kan Hjort <d95hjort@dtek.chalmers.se>
 
5
 *  All Rights Reserved.
 
6
 *
 
7
 *  This file is part of mpeg2dec, a free MPEG-2 video decoder
 
8
 *
 
9
 *  mpeg2dec is free software; you can redistribute it and/or modify
 
10
 *  it under the terms of the GNU General Public License as published by
 
11
 *  the Free Software Foundation; either version 2, or (at your option)
 
12
 *  any later version.
 
13
 *
 
14
 *  mpeg2dec is distributed in the hope that it will be useful,
 
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 *  GNU General Public License for more details.
 
18
 *
 
19
 *  You should have received a copy of the GNU General Public License
 
20
 *  along with GNU Make; see the file COPYING.  If not, write to
 
21
 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 
22
 *
 
23
 */
 
24
 
 
25
#include <mlib_types.h>
 
26
#include <mlib_status.h>
 
27
#include <mlib_sys.h>
 
28
#include <mlib_video.h>
 
29
#include <inttypes.h>
 
30
#include <stdlib.h>
 
31
#include <assert.h>
 
32
 
 
33
#include "swscale.h"
 
34
 
 
35
static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, 
 
36
             int srcSliceH, uint8_t* dst[], int dstStride[]){
 
37
    if(c->srcFormat == PIX_FMT_YUV422P){
 
38
        srcStride[1] *= 2;
 
39
        srcStride[2] *= 2;
 
40
    }
 
41
    
 
42
    assert(srcStride[1] == srcStride[2]);
 
43
 
 
44
    mlib_VideoColorYUV2ARGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
 
45
                             srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
 
46
    return srcSliceH;
 
47
}
 
48
 
 
49
static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, 
 
50
             int srcSliceH, uint8_t* dst[], int dstStride[]){
 
51
    if(c->srcFormat == PIX_FMT_YUV422P){
 
52
        srcStride[1] *= 2;
 
53
        srcStride[2] *= 2;
 
54
    }
 
55
    
 
56
    assert(srcStride[1] == srcStride[2]);
 
57
 
 
58
    mlib_VideoColorYUV2ABGR420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
 
59
                             srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
 
60
    return srcSliceH;
 
61
}
 
62
 
 
63
static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, 
 
64
             int srcSliceH, uint8_t* dst[], int dstStride[]){
 
65
    if(c->srcFormat == PIX_FMT_YUV422P){
 
66
        srcStride[1] *= 2;
 
67
        srcStride[2] *= 2;
 
68
    }
 
69
    
 
70
    assert(srcStride[1] == srcStride[2]);
 
71
 
 
72
    mlib_VideoColorYUV2RGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
 
73
                             srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
 
74
    return srcSliceH;
 
75
}
 
76
 
 
77
 
 
78
SwsFunc yuv2rgb_init_mlib(SwsContext *c) 
 
79
{
 
80
        switch(c->dstFormat){
 
81
        case PIX_FMT_RGB24: return mlib_YUV2RGB420_24;
 
82
        case PIX_FMT_BGR32: return mlib_YUV2ARGB420_32;
 
83
        case PIX_FMT_RGB32: return mlib_YUV2ABGR420_32;
 
84
        default: return NULL;
 
85
        }
 
86
}
 
87