Mercurial > mplayer.hg
annotate libmpcodecs/vd_lcl.c @ 9675:62c5a17038ba
XML version of MPlayer's doc
author | nicolas |
---|---|
date | Sun, 23 Mar 2003 23:35:12 +0000 |
parents | 2ed9b2143f94 |
children | f686c2a2b64c |
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: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
211 switch (hc->compression) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
212 case COMP_ZLIB_HISPEED: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
213 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
|
214 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
215 case COMP_ZLIB_HICOMP: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
216 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
|
217 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
218 case COMP_ZLIB_NORMAL: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
219 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
|
220 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
221 default: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
222 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] Unsupported compression format for ZLIB (%d).\n", hc->compression); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
223 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
224 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
225 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
226 default: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
227 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
|
228 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
229 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
230 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
231 /* Allocate decompression buffer */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
232 /* 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
|
233 if (hc->decomp_size) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
234 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
|
235 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
|
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 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
240 /* Detect flags */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
241 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
|
242 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
|
243 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
|
244 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
|
245 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
|
246 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
|
247 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
|
248 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
|
249 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
|
250 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
251 /* If needed init zlib */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
252 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
|
253 #ifdef HAVE_ZLIB |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
254 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
|
255 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
|
256 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
|
257 zret = inflateInit(&(hc->zstream)); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
258 if (zret != Z_OK) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
259 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
|
260 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
261 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
262 #else |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
263 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
|
264 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
265 #endif |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
266 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
267 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
268 /* |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
269 * Initialize video output device |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
270 */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
271 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
|
272 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
273 return vo_ret; |
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 |
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 /* |
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 * Uninit LCL decoder |
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 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
|
285 { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
286 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
|
287 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
288 if (sh->context) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
289 #ifdef HAVE_ZLIB |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
290 inflateEnd(&hc->zstream); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
291 #endif |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
292 free(sh->context); |
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 } |
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 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
297 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
298 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
|
299 { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
300 int tmp; |
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 tmp = (pix14 + 0x80000) >> 20; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
303 if (tmp < 0) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
304 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
305 if (tmp > 255) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
306 return 255; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
307 return tmp; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
308 } |
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 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
311 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
312 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
|
313 { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
314 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
|
315 } |
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 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
|
320 { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
321 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
|
322 } |
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 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
|
327 { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
328 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
|
329 } |
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 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
|
333 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
334 /* |
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 * Decode a frame |
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 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
|
340 { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
341 mp_image_t* mpi; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
342 int pixel_ptr; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
343 int row, col; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
344 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
|
345 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
|
346 unsigned char *outptr; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
347 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
|
348 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
|
349 #ifdef HAVE_ZLIB |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
350 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
|
351 #endif |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
352 unsigned int mszh_dlen; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
353 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
|
354 int uqvq; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
355 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
|
356 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
357 // Skipped frame |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
358 if(len <= 0) |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
359 return NULL; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
360 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
361 /* Get output image buffer */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
362 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
|
363 if (!mpi) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
364 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
|
365 return NULL; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
366 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
367 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
368 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
|
369 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
370 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
371 /* Decompress frame */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
372 switch (hc->codec) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
373 case CODEC_MSZH: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
374 switch (hc->compression) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
375 case COMP_MSZH: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
376 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
|
377 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
|
378 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
|
379 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
|
380 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
|
381 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
|
382 mthread_outlen, mszh_dlen); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
383 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
384 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
|
385 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
|
386 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
|
387 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
|
388 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
|
389 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
390 encoded = hc->decomp_buf; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
391 len = hc->decomp_size; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
392 } else { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
393 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
|
394 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
|
395 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
|
396 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
|
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 = mszh_dlen; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
400 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
401 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
402 case COMP_MSZH_NOCOMP: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
403 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
404 default: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
405 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
|
406 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
407 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
408 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
409 case CODEC_ZLIB: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
410 switch (hc->compression) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
411 case COMP_ZLIB_HISPEED: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
412 case COMP_ZLIB_HICOMP: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
413 case COMP_ZLIB_NORMAL: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
414 #ifdef HAVE_ZLIB |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
415 zret = inflateReset(&(hc->zstream)); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
416 if (zret != Z_OK) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
417 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
|
418 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
419 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
420 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
|
421 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
|
422 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
|
423 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
|
424 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
|
425 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
|
426 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
|
427 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
|
428 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
|
429 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
|
430 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
431 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
432 if (mthread_outlen != (unsigned int)(hc->zstream.total_out)) { |
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_WARN, "[LCL] ZLIB: 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
|
434 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
|
435 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
436 zret = inflateReset(&(hc->zstream)); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
437 if (zret != Z_OK) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
438 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
|
439 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
440 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
441 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
|
442 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
|
443 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
|
444 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
|
445 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
|
446 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
|
447 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
|
448 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
449 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
450 if ((hc->decomp_size - mthread_outlen) != (unsigned int)(hc->zstream.total_out)) { |
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_WARN, "[LCL] ZLIB: 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
|
452 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
|
453 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
454 } else { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
455 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
|
456 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
|
457 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
|
458 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
|
459 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
|
460 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
|
461 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
|
462 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
463 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
464 if (hc->decomp_size != (unsigned int)(hc->zstream.total_out)) { |
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_WARN, "[LCL] ZLIB: 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
|
466 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
|
467 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
468 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
469 encoded = hc->decomp_buf; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
470 len = hc->decomp_size;; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
471 #else |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
472 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
|
473 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
474 #endif |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
475 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
476 default: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
477 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] BUG! Unknown ZLIB 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
|
478 return 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
479 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
480 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
481 default: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
482 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
|
483 return 0; |
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 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
487 /* Apply PNG filter */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
488 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
|
489 switch (hc->imgtype) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
490 case IMGTYPE_YUV111: |
8972 | 491 case IMGTYPE_RGB24: |
7222
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
492 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
|
493 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
|
494 yq = encoded[pixel_ptr++]; |
8451 | 495 uqvq = encoded[pixel_ptr++]; |
496 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
|
497 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
|
498 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
|
499 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
|
500 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
|
501 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
|
502 pixel_ptr += 3; |
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 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
505 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
506 case IMGTYPE_YUV422: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
507 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
|
508 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
|
509 yq = uq = vq =0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
510 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
|
511 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
|
512 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
|
513 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
|
514 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
|
515 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
|
516 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
|
517 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
|
518 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
|
519 pixel_ptr += 8; |
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 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
522 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
523 case IMGTYPE_YUV411: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
524 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
|
525 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
|
526 yq = uq = vq =0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
527 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
|
528 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
|
529 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
|
530 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
|
531 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
|
532 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
|
533 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
|
534 pixel_ptr += 6; |
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 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
537 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
538 case IMGTYPE_YUV211: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
539 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
|
540 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
|
541 yq = uq = vq =0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
542 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
|
543 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
|
544 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
|
545 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
|
546 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
|
547 pixel_ptr += 4; |
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 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
550 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
551 case IMGTYPE_YUV420: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
552 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
|
553 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
|
554 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
|
555 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
|
556 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
|
557 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
|
558 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
|
559 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
|
560 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
|
561 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
|
562 pixel_ptr += 6; |
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 } |
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 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
567 default: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
568 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
|
569 return 0; |
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 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
573 /* Convert colorspace */ |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
574 switch (hc->imgtype) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
575 case IMGTYPE_YUV111: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
576 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
|
577 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
|
578 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
|
579 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
|
580 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
|
581 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
|
582 encoded += 3; |
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 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
585 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
586 case IMGTYPE_YUV422: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
587 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
|
588 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
|
589 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
|
590 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
|
591 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
|
592 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
|
593 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
|
594 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
|
595 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
|
596 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
|
597 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
|
598 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
|
599 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
|
600 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
|
601 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
|
602 encoded += 8; |
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 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
605 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
606 case IMGTYPE_RGB24: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
607 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
|
608 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
|
609 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
|
610 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
|
611 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
|
612 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
|
613 encoded += 3; |
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 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
616 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
617 case IMGTYPE_YUV411: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
618 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
|
619 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
|
620 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
|
621 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
|
622 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
|
623 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
|
624 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
|
625 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
|
626 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
|
627 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
|
628 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
|
629 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
|
630 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
|
631 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
|
632 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
|
633 encoded += 6; |
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 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
636 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
637 case IMGTYPE_YUV211: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
638 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
|
639 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
|
640 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
|
641 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
|
642 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
|
643 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
|
644 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
|
645 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
|
646 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
|
647 encoded += 4; |
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 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
650 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
651 case IMGTYPE_YUV420: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
652 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
|
653 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
|
654 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
|
655 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
|
656 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
|
657 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
|
658 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
|
659 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
|
660 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
|
661 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
|
662 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
|
663 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
|
664 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
|
665 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
|
666 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
|
667 pixel_ptr += 6; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
668 encoded += 6; |
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 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
671 break; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
672 default: |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
673 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
|
674 return 0; |
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 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
677 return mpi; |
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 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
682 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
|
683 { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
684 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
|
685 unsigned char mask = 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
686 unsigned char maskbit = 0; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
687 unsigned int ofs, cnt; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
688 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
689 while (srclen > 0) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
690 if (maskbit == 0) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
691 mask = *(srcptr++); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
692 maskbit = 8; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
693 srclen--; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
694 continue; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
695 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
696 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
|
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 *(destptr++) = *(srcptr++); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
701 srclen -= 4; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
702 } else { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
703 ofs = *(srcptr++); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
704 cnt = *(srcptr++); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
705 ofs += cnt * 256;; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
706 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
|
707 ofs &= 0x7ff; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
708 srclen -= 2; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
709 cnt *= 4; |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
710 for (; cnt > 0; cnt--) { |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
711 *(destptr) = *(destptr - ofs); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
712 destptr++; |
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 |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
717 return (destptr - destptr_bak); |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
718 } |
81f720e51821
added LCL decoder by Roberto Togni <r_togni@libero.it>, removed my old vd_zlib
alex
parents:
diff
changeset
|
719 |