1 /**
2 
3     \file ADM_uyvy
4     \author mean fixounet@free.fr, 2004-1010
5 */
6 
7 /***************************************************************************
8  *                                                                         *
9  *   This program 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 of the License, or     *
12  *   (at your option) any later version.                                   *
13  *                                                                         *
14  ***************************************************************************/
15 
16 #include "ADM_default.h"
17 #include "fourcc.h"
18 #include "ADM_uyvy.h"
19 
20 
21 /**
22     \fn uncompress
23 */
uncompress(ADMCompressedImage * in,ADMImage * out)24 bool   decoderUYVY::uncompress (ADMCompressedImage * in, ADMImage * out)
25 {
26 
27     if(in->dataLength!=_w*_h*2)
28     {
29         return false;
30     }
31 
32     ADMImageRef *ref=out->castToRef();
33     out->flags = AVI_KEY_FRAME;
34     out->_colorspace = ADM_COLOR_UYVY422;
35 
36     ref->_planes[0] = in->data;
37     ref->_planes[1] = NULL;
38     ref->_planes[2] = NULL;
39 
40     ref->_planeStride[0] = _w*2;
41     ref->_planeStride[1] = 0;
42     ref->_planeStride[2] = 0;
43     out->Pts=in->demuxerPts;
44     return true;
45 }
46 
47 /**
48     \fn uncompress
49 */
uncompress(ADMCompressedImage * in,ADMImage * out)50 bool   decoderYUY2::uncompress  (ADMCompressedImage * in, ADMImage * out)
51 {
52     if(in->dataLength!=_w*_h*2)
53     {
54         return false;
55     }
56 
57 
58     ADMImageRef *ref=out->castToRef();
59     out->flags = AVI_KEY_FRAME;
60     out->_colorspace = ADM_COLOR_YUV422;
61 
62     ref->_planes[0] = in->data;
63     ref->_planes[1] = NULL;
64     ref->_planes[2] = NULL;
65 
66     ref->_planeStride[0] = _w*2;
67     ref->_planeStride[1] = 0;
68     ref->_planeStride[2] = 0;
69     out->Pts=in->demuxerPts;
70     return true;
71 }
72