-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathSkImageDecoder_libtijpeg_entry.h
120 lines (101 loc) · 3.64 KB
/
SkImageDecoder_libtijpeg_entry.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
* Copyright (C) Texas Instruments - http://www.ti.com/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* ==============================================================================
* Texas Instruments OMAP (TM) Platform Software
* (c) Copyright Texas Instruments, Incorporated. All Rights Reserved.
*
* Use of this software is controlled by the terms and conditions found
* in the license agreement under which this software has been supplied.
* ============================================================================ */
#ifndef SKIAHW_DECODER_ENTRY_H
#define SKIAHW_DECODER_ENTRY_H
#include "SkBitmap.h"
#include "SkStream.h"
#include "SkImageDecoder.h"
#include "SkImageDecoder_libtijpeg.h"
#include "SkImageUtility.h"
#include <stdio.h>
#include <string.h>
#include <semaphore.h>
#include <utils/threads.h>
#include <utils/List.h>
extern "C" {
#include "OMX_Component.h"
#include "OMX_IVCommon.h"
}
class SkTIJPEGImageDecoderEntry;
typedef WatchdogThread<SkTIJPEGImageDecoderEntry> DecoderWatchdog;
// typedef SkTIJPEGImageCodecList_Item<SkTIJPEGImageDecoder, DecoderWatchdog> SkTIJPEGImageDecoderList_Item;
class SkTIJPEGImageDecoderList_Item
{
public:
SkTIJPEGImageDecoder* Decoder;
android::sp<DecoderWatchdog> WatchdogTimer;
};
class SkTIJPEGImageDecoderListWrapper
{
public:
SkTIJPEGImageDecoderListWrapper() {}
~SkTIJPEGImageDecoderListWrapper(){
while(list.begin() != list.end())
{
android::List<SkTIJPEGImageDecoderList_Item*>::iterator iter = list.begin();
SkTIJPEGImageDecoderList_Item* item = static_cast<SkTIJPEGImageDecoderList_Item*>(*iter);
SkAutoTDelete<SkTIJPEGImageDecoder> autodelete(item->Decoder);
item->WatchdogTimer.clear();
SkDebugf("SkTIJPEGImageDecoder Cleanup: 0x%x", item);
list.erase(iter);
}
}
android::List<SkTIJPEGImageDecoderList_Item*> list;
};
class SkTIJPEGImageDecoderEntry :public SkImageDecoder
{
friend class WatchdogThread<SkTIJPEGImageDecoderEntry>;
friend class SkTIJPEGImageDecoder;
protected:
virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode);
public:
typedef struct JpegDecoderParams
{
// Quatization Table
// Huffman Table
// SectionDecode;
// SubRegionDecode
OMX_U32 nXOrg; /* X origin*/
OMX_U32 nYOrg; /* Y origin*/
OMX_U32 nXLength; /* X length*/
OMX_U32 nYLength; /* Y length*/
}JpegDecoderParams;
SkTIJPEGImageDecoderEntry();
~SkTIJPEGImageDecoderEntry();
virtual Format getFormat() const { return kJPEG_Format; }
bool SetJpegDecParams(JpegDecoderParams * jdp) {
memcpy(&jpegDecParams, jdp, sizeof(JpegDecoderParams));
return true;
}
private:
JpegDecoderParams jpegDecParams;
bool WatchdogCallback(void* param);
};
extern "C" SkImageDecoder* SkImageDecoder_HWJPEG_Factory() {
return SkNEW(SkTIJPEGImageDecoderEntry);
}
#endif