Mercurial > mplayer.hg
annotate libmpcodecs/vd_lcl.c @ 12013:d0a1e865c1af
-vo directfb options by Jiri Svoboda
author | diego |
---|---|
date | Fri, 05 Mar 2004 04:49:36 +0000 |
parents | beeafc00201e |
children |
rev | line source |
---|---|
7222
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
1 /* |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
2 * |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
3 * LCL (LossLess Codec Library) Decoder for Mplayer |
8972 | 4 * (c) 2002, 2003 Roberto Togni |
7222
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
5 * |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
6 * Fourcc: MSZH, ZLIB |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
7 * |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
8 * Win32 dll: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
9 * Ver2.23 By Kenji Oshima 2000.09.20 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
10 * avimszh.dll, avizlib.dll |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
11 * |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
12 * A description of the decoding algorithm can be found here: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
13 * http://www.pcisys.net/~melanson/codecs |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
14 * |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
15 */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
16 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
17 #include <stdio.h> |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
18 #include <stdlib.h> |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
19 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
20 #include "config.h" |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
21 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
22 #ifdef HAVE_ZLIB |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
23 #include <zlib.h> |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
24 #endif |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
25 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
26 #include "mp_msg.h" |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
27 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
28 #include "vd_internal.h" |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
29 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
30 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
31 static vd_info_t info = { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
32 "LCL Video decoder", |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
33 "lcl", |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
34 "Roberto Togni", |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
35 "Roberto Togni", |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
36 "native codec" |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
37 }; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
38 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
39 LIBVD_EXTERN(lcl) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
40 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
41 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
42 #define BMPTYPE_YUV 1 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
43 #define BMPTYPE_RGB 2 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
44 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
45 #define IMGTYPE_YUV111 0 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
46 #define IMGTYPE_YUV422 1 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
47 #define IMGTYPE_RGB24 2 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
48 #define IMGTYPE_YUV411 3 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
49 #define IMGTYPE_YUV211 4 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
50 #define IMGTYPE_YUV420 5 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
51 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
52 #define COMP_MSZH 0 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
53 #define COMP_MSZH_NOCOMP 1 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
54 #define COMP_ZLIB_HISPEED 1 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
55 #define COMP_ZLIB_HICOMP 9 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
56 #define COMP_ZLIB_NORMAL -1 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
57 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
58 #define FLAG_MULTITHREAD 1 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
59 #define FLAG_NULLFRAME 2 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
60 #define FLAG_PNGFILTER 4 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
61 #define FLAGMASK_UNUSED 0xf8 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
62 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
63 #define CODEC_MSZH 1 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
64 #define CODEC_ZLIB 3 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
65 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
66 #define FOURCC_MSZH mmioFOURCC('M','S','Z','H') |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
67 #define FOURCC_ZLIB mmioFOURCC('Z','L','I','B') |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
68 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
69 /* |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
70 * Decoder context |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
71 */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
72 typedef struct { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
73 // Image type |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
74 int imgtype; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
75 // Compression type |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
76 int compression; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
77 // Flags |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
78 int flags; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
79 // Codec type |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
80 int codec; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
81 // Decompressed data size |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
82 unsigned int decomp_size; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
83 // Decompression buffer |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
84 unsigned char* decomp_buf; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
85 #ifdef HAVE_ZLIB |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
86 z_stream zstream; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
87 #endif |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
88 } lcl_context_t; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
89 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
90 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
91 /* |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
92 * Internal function prototypes |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
93 */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
94 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
95 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
96 // to set/get/query special features/parameters |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
97 static int control(sh_video_t *sh,int cmd,void* arg,...) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
98 { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
99 return CONTROL_UNKNOWN; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
100 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
101 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
102 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
103 /* |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
104 * |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
105 * Init LCL decoder |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
106 * |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
107 */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
108 static int init(sh_video_t *sh) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
109 { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
110 int vo_ret; // Video output init ret value |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
111 int zret; // Zlib return code |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
112 lcl_context_t *hc; // Decoder context |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
113 BITMAPINFOHEADER *bih = sh->bih; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
114 int basesize = bih->biWidth * bih->biHeight; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
115 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
116 if ((hc = malloc(sizeof(lcl_context_t))) == NULL) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
117 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Can't allocate memory for LCL decoder context.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
118 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
119 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
120 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
121 sh->context = (void *)hc; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
122 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
123 #ifdef HAVE_ZLIB |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
124 // Needed if zlib unused or init aborted before inflateInit |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
125 memset(&(hc->zstream), 0, sizeof(z_stream)); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
126 #endif |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
127 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
128 if ((bih->biCompression != FOURCC_MSZH) && (bih->biCompression != FOURCC_ZLIB)) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
129 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "[LCL] Unknown BITMAPHEADER fourcc.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
130 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
131 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
132 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
133 if (bih->biSize < sizeof(BITMAPINFOHEADER) + 8) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
134 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] BITMAPHEADER size too small.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
135 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
136 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
137 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
138 /* Detect codec type */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
139 switch (hc->codec = *((char *)bih + sizeof(BITMAPINFOHEADER) + 7)) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
140 case CODEC_MSZH: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
141 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] Codec is MSZH.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
142 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
143 case CODEC_ZLIB: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
144 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] Codec is ZLIB.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
145 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
146 default: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
147 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "[LCL] Unknown codec id %d. Trusting fourcc.\n", hc->codec); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
148 switch (bih->biCompression) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
149 case FOURCC_MSZH: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
150 hc->codec = CODEC_MSZH; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
151 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
152 case FOURCC_ZLIB: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
153 hc->codec = CODEC_ZLIB; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
154 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
155 default: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
156 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "[LCL] BUG! Unknown coded id and fourcc. Why am I here?.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
157 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
158 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
159 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
160 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
161 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
162 /* Detect image type */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
163 switch (hc->imgtype = *((char *)bih + sizeof(BITMAPINFOHEADER) + 4)) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
164 case IMGTYPE_YUV111: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
165 hc->decomp_size = basesize * 3; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
166 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] Image type is YUV 1:1:1.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
167 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
168 case IMGTYPE_YUV422: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
169 hc->decomp_size = basesize * 2; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
170 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] Image type is YUV 4:2:2.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
171 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
172 case IMGTYPE_RGB24: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
173 hc->decomp_size = basesize * 3; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
174 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] Image type is RGB 24.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
175 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
176 case IMGTYPE_YUV411: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
177 hc->decomp_size = basesize / 2 * 3; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
178 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] Image type is YUV 4:1:1.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
179 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
180 case IMGTYPE_YUV211: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
181 hc->decomp_size = basesize * 2; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
182 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] Image type is YUV 2:1:1.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
183 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
184 case IMGTYPE_YUV420: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
185 hc->decomp_size = basesize / 2 * 3; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
186 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] Image type is YUV 4:2:0.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
187 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
188 default: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
189 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] Unsupported image format %d.\n", hc->imgtype); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
190 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
191 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
192 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
193 /* Detect compression method */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
194 hc->compression = *((char *)bih + sizeof(BITMAPINFOHEADER) + 5); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
195 switch (hc->codec) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
196 case CODEC_MSZH: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
197 switch (hc->compression) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
198 case COMP_MSZH: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
199 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] Compression enabled.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
200 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
201 case COMP_MSZH_NOCOMP: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
202 hc->decomp_size = 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
203 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] No compression.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
204 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
205 default: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
206 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] Unsupported compression format for MSZH (%d).\n", hc->compression); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
207 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
208 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
209 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
210 case CODEC_ZLIB: |
11646 | 211 #ifdef HAVE_ZLIB |
7222
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
212 switch (hc->compression) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
213 case COMP_ZLIB_HISPEED: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
214 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] High speed compression.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
215 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
216 case COMP_ZLIB_HICOMP: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
217 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] High compression.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
218 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
219 case COMP_ZLIB_NORMAL: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
220 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] Normal compression.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
221 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
222 default: |
11516 | 223 if ((hc->compression < Z_NO_COMPRESSION) || (hc->compression > Z_BEST_COMPRESSION)) { |
224 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] Unusupported compression level for ZLIB: (%d).\n", hc->compression); | |
225 return 0; | |
226 } | |
227 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] Compression level for ZLIB: (%d).\n", hc->compression); | |
7222
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
228 } |
11646 | 229 #else |
230 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] Zlib support not compiled.\n"); | |
231 return 0; | |
232 #endif | |
7222
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
233 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
234 default: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
235 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] BUG! Unknown codec in compression switch.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
236 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
237 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
238 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
239 /* Allocate decompression buffer */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
240 /* 4*8 max oveflow space for mszh decomp algorithm */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
241 if (hc->decomp_size) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
242 if ((hc->decomp_buf = malloc(hc->decomp_size+4*8)) == NULL) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
243 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] Can't allocate decompression buffer.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
244 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
245 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
246 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
247 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
248 /* Detect flags */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
249 hc->flags = *((char *)bih + sizeof(BITMAPINFOHEADER) + 6); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
250 if (hc->flags & FLAG_MULTITHREAD) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
251 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] Multithread encoder flag set.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
252 if (hc->flags & FLAG_NULLFRAME) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
253 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] Nullframe insertion flag set.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
254 if ((hc->codec == CODEC_ZLIB) && (hc->flags & FLAG_PNGFILTER)) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
255 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] PNG filter flag set.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
256 if (hc->flags & FLAGMASK_UNUSED) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
257 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "[LCL] Unknown flag set (%d).\n", hc->flags); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
258 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
259 /* If needed init zlib */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
260 if (hc->codec == CODEC_ZLIB) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
261 #ifdef HAVE_ZLIB |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
262 hc->zstream.zalloc = Z_NULL; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
263 hc->zstream.zfree = Z_NULL; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
264 hc->zstream.opaque = Z_NULL; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
265 zret = inflateInit(&(hc->zstream)); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
266 if (zret != Z_OK) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
267 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] Inflate init error: %d\n", zret); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
268 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
269 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
270 #else |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
271 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] Zlib support not compiled.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
272 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
273 #endif |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
274 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
275 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
276 /* |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
277 * Initialize video output device |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
278 */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
279 vo_ret = mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_BGR24); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
280 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
281 return vo_ret; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
282 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
283 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
284 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
285 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
286 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
287 /* |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
288 * |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
289 * Uninit LCL decoder |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
290 * |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
291 */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
292 static void uninit(sh_video_t *sh) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
293 { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
294 lcl_context_t *hc = (lcl_context_t *) sh->context; // Decoder context |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
295 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
296 if (sh->context) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
297 #ifdef HAVE_ZLIB |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
298 inflateEnd(&hc->zstream); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
299 #endif |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
300 free(sh->context); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
301 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
302 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
303 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
304 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
305 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
306 inline unsigned char fix (int pix14) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
307 { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
308 int tmp; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
309 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
310 tmp = (pix14 + 0x80000) >> 20; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
311 if (tmp < 0) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
312 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
313 if (tmp > 255) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
314 return 255; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
315 return tmp; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
316 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
317 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
318 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
319 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
320 inline unsigned char get_b (unsigned char yq, signed char bq) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
321 { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
322 return fix((yq << 20) + bq * 1858076); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
323 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
324 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
325 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
326 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
327 inline unsigned char get_g (unsigned char yq, signed char bq, signed char rq) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
328 { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
329 return fix((yq << 20) - bq * 360857 - rq * 748830); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
330 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
331 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
332 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
333 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
334 inline unsigned char get_r (unsigned char yq, signed char rq) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
335 { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
336 return fix((yq << 20) + rq * 1470103); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
337 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
338 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
339 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
340 int mszh_decomp(unsigned char * srcptr, int srclen, unsigned char * destptr); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
341 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
342 /* |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
343 * |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
344 * Decode a frame |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
345 * |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
346 */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
347 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
348 { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
349 mp_image_t* mpi; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
350 int pixel_ptr; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
351 int row, col; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
352 unsigned char *encoded = (unsigned char *)data; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
353 lcl_context_t *hc = (lcl_context_t *) sh->context; // Decoder context |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
354 unsigned char *outptr; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
355 int width = sh->disp_w; // Real image width |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
356 int height = sh->disp_h; // Real image height |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
357 #ifdef HAVE_ZLIB |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
358 int zret; // Zlib return code |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
359 #endif |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
360 unsigned int mszh_dlen; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
361 unsigned char yq, y1q, uq, vq; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
362 int uqvq; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
363 unsigned int mthread_inlen, mthread_outlen; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
364 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
365 // Skipped frame |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
366 if(len <= 0) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
367 return NULL; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
368 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
369 /* Get output image buffer */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
370 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0, sh->disp_w, sh->disp_h); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
371 if (!mpi) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
372 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Can't allocate mpi image for lcl codec.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
373 return NULL; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
374 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
375 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
376 outptr = mpi->planes[0]; // Output image pointer |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
377 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
378 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
379 /* Decompress frame */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
380 switch (hc->codec) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
381 case CODEC_MSZH: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
382 switch (hc->compression) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
383 case COMP_MSZH: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
384 if (hc->flags & FLAG_MULTITHREAD) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
385 mthread_inlen = *((unsigned int*)encoded); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
386 mthread_outlen = *((unsigned int*)(encoded+4)); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
387 mszh_dlen = mszh_decomp(encoded + 8, mthread_inlen, hc->decomp_buf); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
388 if (mthread_outlen != mszh_dlen) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
389 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "[LCL] MSZH: mthread1 decoded size differs (%d != %d)\n", |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
390 mthread_outlen, mszh_dlen); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
391 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
392 mszh_dlen = mszh_decomp(encoded + 8 + mthread_inlen, len - mthread_inlen, |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
393 hc->decomp_buf + mthread_outlen); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
394 if ((hc->decomp_size - mthread_outlen) != mszh_dlen) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
395 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "[LCL] MSZH: mthread2 decoded size differs (%d != %d)\n", |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
396 hc->decomp_size - mthread_outlen, mszh_dlen); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
397 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
398 encoded = hc->decomp_buf; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
399 len = hc->decomp_size; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
400 } else { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
401 mszh_dlen = mszh_decomp(encoded, len, hc->decomp_buf); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
402 if (hc->decomp_size != mszh_dlen) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
403 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "[LCL] MSZH: decoded size differs (%d != %d)\n", |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
404 hc->decomp_size, mszh_dlen); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
405 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
406 encoded = hc->decomp_buf; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
407 len = mszh_dlen; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
408 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
409 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
410 case COMP_MSZH_NOCOMP: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
411 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
412 default: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
413 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] BUG! Unknown MSZH compression in frame decoder.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
414 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
415 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
416 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
417 case CODEC_ZLIB: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
418 #ifdef HAVE_ZLIB |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
419 zret = inflateReset(&(hc->zstream)); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
420 if (zret != Z_OK) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
421 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] ZLIB: inflate reset error: %d\n", zret); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
422 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
423 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
424 if (hc->flags & FLAG_MULTITHREAD) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
425 mthread_inlen = *((unsigned int*)encoded); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
426 mthread_outlen = *((unsigned int*)(encoded+4)); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
427 hc->zstream.next_in = encoded + 8; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
428 hc->zstream.avail_in = mthread_inlen; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
429 hc->zstream.next_out = hc->decomp_buf; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
430 hc->zstream.avail_out = mthread_outlen; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
431 zret = inflate(&(hc->zstream), Z_FINISH); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
432 if ((zret != Z_OK) && (zret != Z_STREAM_END)) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
433 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] ZLIB: mthread1 inflate error: %d\n", zret); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
434 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
435 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
436 if (mthread_outlen != (unsigned int)(hc->zstream.total_out)) { |
11516 | 437 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "[LCL] ZLIB: mthread1 decoded size differs (%u != %lu)\n", |
7222
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
438 mthread_outlen, hc->zstream.total_out); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
439 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
440 zret = inflateReset(&(hc->zstream)); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
441 if (zret != Z_OK) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
442 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] ZLIB: mthread2 inflate reset error: %d\n", zret); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
443 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
444 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
445 hc->zstream.next_in = encoded + 8 + mthread_inlen; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
446 hc->zstream.avail_in = len - mthread_inlen; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
447 hc->zstream.next_out = hc->decomp_buf + mthread_outlen; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
448 hc->zstream.avail_out = mthread_outlen; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
449 zret = inflate(&(hc->zstream), Z_FINISH); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
450 if ((zret != Z_OK) && (zret != Z_STREAM_END)) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
451 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] ZLIB: mthread2 inflate error: %d\n", zret); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
452 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
453 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
454 if ((hc->decomp_size - mthread_outlen) != (unsigned int)(hc->zstream.total_out)) { |
11516 | 455 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "[LCL] ZLIB: mthread2 decoded size differs (%d != %lu)\n", |
7222
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
456 hc->decomp_size - mthread_outlen, hc->zstream.total_out); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
457 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
458 } else { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
459 hc->zstream.next_in = data; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
460 hc->zstream.avail_in = len; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
461 hc->zstream.next_out = hc->decomp_buf; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
462 hc->zstream.avail_out = hc->decomp_size; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
463 zret = inflate(&(hc->zstream), Z_FINISH); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
464 if ((zret != Z_OK) && (zret != Z_STREAM_END)) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
465 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] ZLIB: inflate error: %d\n", zret); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
466 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
467 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
468 if (hc->decomp_size != (unsigned int)(hc->zstream.total_out)) { |
11516 | 469 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "[LCL] ZLIB: decoded size differs (%d != %lu)\n", |
7222
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
470 hc->decomp_size, hc->zstream.total_out); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
471 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
472 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
473 encoded = hc->decomp_buf; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
474 len = hc->decomp_size;; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
475 #else |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
476 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] BUG! Zlib support not compiled in frame decoder.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
477 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
478 #endif |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
479 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
480 default: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
481 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] BUG! Unknown codec in frame decoder compression switch.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
482 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
483 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
484 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
485 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
486 /* Apply PNG filter */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
487 if ((hc->codec == CODEC_ZLIB) && (hc->flags & FLAG_PNGFILTER)) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
488 switch (hc->imgtype) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
489 case IMGTYPE_YUV111: |
8972 | 490 case IMGTYPE_RGB24: |
7222
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
491 for (row = 0; row < height; row++) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
492 pixel_ptr = row * width * 3; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
493 yq = encoded[pixel_ptr++]; |
8451 | 494 uqvq = encoded[pixel_ptr++]; |
495 uqvq+=(encoded[pixel_ptr++] << 8); | |
7222
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
496 for (col = 1; col < width; col++) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
497 encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
498 uqvq -= (encoded[pixel_ptr+1] | (encoded[pixel_ptr+2]<<8)); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
499 encoded[pixel_ptr+1] = (uqvq) & 0xff; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
500 encoded[pixel_ptr+2] = ((uqvq)>>8) & 0xff; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
501 pixel_ptr += 3; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
502 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
503 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
504 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
505 case IMGTYPE_YUV422: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
506 for (row = 0; row < height; row++) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
507 pixel_ptr = row * width * 2; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
508 yq = uq = vq =0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
509 for (col = 0; col < width/4; col++) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
510 encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
511 encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
512 encoded[pixel_ptr+2] = yq -= encoded[pixel_ptr+2]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
513 encoded[pixel_ptr+3] = yq -= encoded[pixel_ptr+3]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
514 encoded[pixel_ptr+4] = uq -= encoded[pixel_ptr+4]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
515 encoded[pixel_ptr+5] = uq -= encoded[pixel_ptr+5]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
516 encoded[pixel_ptr+6] = vq -= encoded[pixel_ptr+6]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
517 encoded[pixel_ptr+7] = vq -= encoded[pixel_ptr+7]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
518 pixel_ptr += 8; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
519 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
520 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
521 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
522 case IMGTYPE_YUV411: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
523 for (row = 0; row < height; row++) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
524 pixel_ptr = row * width / 2 * 3; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
525 yq = uq = vq =0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
526 for (col = 0; col < width/4; col++) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
527 encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
528 encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
529 encoded[pixel_ptr+2] = yq -= encoded[pixel_ptr+2]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
530 encoded[pixel_ptr+3] = yq -= encoded[pixel_ptr+3]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
531 encoded[pixel_ptr+4] = uq -= encoded[pixel_ptr+4]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
532 encoded[pixel_ptr+5] = vq -= encoded[pixel_ptr+5]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
533 pixel_ptr += 6; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
534 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
535 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
536 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
537 case IMGTYPE_YUV211: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
538 for (row = 0; row < height; row++) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
539 pixel_ptr = row * width * 2; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
540 yq = uq = vq =0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
541 for (col = 0; col < width/2; col++) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
542 encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
543 encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
544 encoded[pixel_ptr+2] = uq -= encoded[pixel_ptr+2]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
545 encoded[pixel_ptr+3] = vq -= encoded[pixel_ptr+3]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
546 pixel_ptr += 4; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
547 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
548 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
549 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
550 case IMGTYPE_YUV420: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
551 for (row = 0; row < height/2; row++) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
552 pixel_ptr = row * width * 3; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
553 yq = y1q = uq = vq =0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
554 for (col = 0; col < width/2; col++) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
555 encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
556 encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
557 encoded[pixel_ptr+2] = y1q -= encoded[pixel_ptr+2]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
558 encoded[pixel_ptr+3] = y1q -= encoded[pixel_ptr+3]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
559 encoded[pixel_ptr+4] = uq -= encoded[pixel_ptr+4]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
560 encoded[pixel_ptr+5] = vq -= encoded[pixel_ptr+5]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
561 pixel_ptr += 6; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
562 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
563 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
564 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
565 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
566 default: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
567 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] BUG! Unknown imagetype in pngfilter switch.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
568 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
569 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
570 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
571 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
572 /* Convert colorspace */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
573 switch (hc->imgtype) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
574 case IMGTYPE_YUV111: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
575 for (row = height - 1; row >= 0; row--) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
576 pixel_ptr = row * mpi->stride[0]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
577 for (col = 0; col < width; col++) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
578 outptr[pixel_ptr++] = get_b(encoded[0], encoded[1]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
579 outptr[pixel_ptr++] = get_g(encoded[0], encoded[1], encoded[2]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
580 outptr[pixel_ptr++] = get_r(encoded[0], encoded[2]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
581 encoded += 3; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
582 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
583 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
584 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
585 case IMGTYPE_YUV422: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
586 for (row = height - 1; row >= 0; row--) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
587 pixel_ptr = row * mpi->stride[0]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
588 for (col = 0; col < width/4; col++) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
589 outptr[pixel_ptr++] = get_b(encoded[0], encoded[4]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
590 outptr[pixel_ptr++] = get_g(encoded[0], encoded[4], encoded[6]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
591 outptr[pixel_ptr++] = get_r(encoded[0], encoded[6]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
592 outptr[pixel_ptr++] = get_b(encoded[1], encoded[4]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
593 outptr[pixel_ptr++] = get_g(encoded[1], encoded[4], encoded[6]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
594 outptr[pixel_ptr++] = get_r(encoded[1], encoded[6]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
595 outptr[pixel_ptr++] = get_b(encoded[2], encoded[5]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
596 outptr[pixel_ptr++] = get_g(encoded[2], encoded[5], encoded[7]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
597 outptr[pixel_ptr++] = get_r(encoded[2], encoded[7]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
598 outptr[pixel_ptr++] = get_b(encoded[3], encoded[5]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
599 outptr[pixel_ptr++] = get_g(encoded[3], encoded[5], encoded[7]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
600 outptr[pixel_ptr++] = get_r(encoded[3], encoded[7]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
601 encoded += 8; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
602 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
603 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
604 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
605 case IMGTYPE_RGB24: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
606 for (row = height - 1; row >= 0; row--) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
607 pixel_ptr = row * mpi->stride[0]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
608 for (col = 0; col < width; col++) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
609 outptr[pixel_ptr++] = encoded[0]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
610 outptr[pixel_ptr++] = encoded[1]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
611 outptr[pixel_ptr++] = encoded[2]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
612 encoded += 3; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
613 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
614 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
615 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
616 case IMGTYPE_YUV411: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
617 for (row = height - 1; row >= 0; row--) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
618 pixel_ptr = row * mpi->stride[0]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
619 for (col = 0; col < width/4; col++) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
620 outptr[pixel_ptr++] = get_b(encoded[0], encoded[4]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
621 outptr[pixel_ptr++] = get_g(encoded[0], encoded[4], encoded[5]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
622 outptr[pixel_ptr++] = get_r(encoded[0], encoded[5]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
623 outptr[pixel_ptr++] = get_b(encoded[1], encoded[4]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
624 outptr[pixel_ptr++] = get_g(encoded[1], encoded[4], encoded[5]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
625 outptr[pixel_ptr++] = get_r(encoded[1], encoded[5]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
626 outptr[pixel_ptr++] = get_b(encoded[2], encoded[4]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
627 outptr[pixel_ptr++] = get_g(encoded[2], encoded[4], encoded[5]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
628 outptr[pixel_ptr++] = get_r(encoded[2], encoded[5]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
629 outptr[pixel_ptr++] = get_b(encoded[3], encoded[4]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
630 outptr[pixel_ptr++] = get_g(encoded[3], encoded[4], encoded[5]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
631 outptr[pixel_ptr++] = get_r(encoded[3], encoded[5]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
632 encoded += 6; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
633 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
634 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
635 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
636 case IMGTYPE_YUV211: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
637 for (row = height - 1; row >= 0; row--) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
638 pixel_ptr = row * mpi->stride[0]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
639 for (col = 0; col < width/2; col++) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
640 outptr[pixel_ptr++] = get_b(encoded[0], encoded[2]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
641 outptr[pixel_ptr++] = get_g(encoded[0], encoded[2], encoded[3]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
642 outptr[pixel_ptr++] = get_r(encoded[0], encoded[3]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
643 outptr[pixel_ptr++] = get_b(encoded[1], encoded[2]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
644 outptr[pixel_ptr++] = get_g(encoded[1], encoded[2], encoded[3]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
645 outptr[pixel_ptr++] = get_r(encoded[1], encoded[3]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
646 encoded += 4; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
647 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
648 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
649 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
650 case IMGTYPE_YUV420: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
651 for (row = height / 2 - 1; row >= 0; row--) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
652 pixel_ptr = 2 * row * mpi->stride[0]; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
653 for (col = 0; col < width/2; col++) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
654 outptr[pixel_ptr] = get_b(encoded[0], encoded[4]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
655 outptr[pixel_ptr+1] = get_g(encoded[0], encoded[4], encoded[5]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
656 outptr[pixel_ptr+2] = get_r(encoded[0], encoded[5]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
657 outptr[pixel_ptr+3] = get_b(encoded[1], encoded[4]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
658 outptr[pixel_ptr+4] = get_g(encoded[1], encoded[4], encoded[5]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
659 outptr[pixel_ptr+5] = get_r(encoded[1], encoded[5]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
660 outptr[pixel_ptr-mpi->stride[0]] = get_b(encoded[2], encoded[4]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
661 outptr[pixel_ptr-mpi->stride[0]+1] = get_g(encoded[2], encoded[4], encoded[5]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
662 outptr[pixel_ptr-mpi->stride[0]+2] = get_r(encoded[2], encoded[5]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
663 outptr[pixel_ptr-mpi->stride[0]+3] = get_b(encoded[3], encoded[4]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
664 outptr[pixel_ptr-mpi->stride[0]+4] = get_g(encoded[3], encoded[4], encoded[5]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
665 outptr[pixel_ptr-mpi->stride[0]+5] = get_r(encoded[3], encoded[5]); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
666 pixel_ptr += 6; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
667 encoded += 6; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
668 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
669 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
670 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
671 default: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
672 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] BUG! Unknown imagetype in image decoder.\n"); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
673 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
674 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
675 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
676 return mpi; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
677 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
678 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
679 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
680 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
681 int mszh_decomp(unsigned char * srcptr, int srclen, unsigned char * destptr) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
682 { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
683 unsigned char *destptr_bak = destptr; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
684 unsigned char mask = 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
685 unsigned char maskbit = 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
686 unsigned int ofs, cnt; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
687 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
688 while (srclen > 0) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
689 if (maskbit == 0) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
690 mask = *(srcptr++); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
691 maskbit = 8; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
692 srclen--; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
693 continue; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
694 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
695 if ((mask & (1 << (--maskbit))) == 0) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
696 *(destptr++) = *(srcptr++); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
697 *(destptr++) = *(srcptr++); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
698 *(destptr++) = *(srcptr++); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
699 *(destptr++) = *(srcptr++); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
700 srclen -= 4; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
701 } else { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
702 ofs = *(srcptr++); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
703 cnt = *(srcptr++); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
704 ofs += cnt * 256;; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
705 cnt = ((cnt >> 3) & 0x1f) + 1; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
706 ofs &= 0x7ff; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
707 srclen -= 2; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
708 cnt *= 4; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
709 for (; cnt > 0; cnt--) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
710 *(destptr) = *(destptr - ofs); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
711 destptr++; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
712 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
713 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
714 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
715 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
716 return (destptr - destptr_bak); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
717 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
718 |