Mercurial > libavcodec.hg
comparison dvbsub.c @ 5354:dfa6e7fa2bac libavcodec
create colorspace.h and use it where appropriate
patch by Ian Caulfield: /ian caulfield gmail com/
author | benoit |
---|---|
date | Tue, 17 Jul 2007 12:33:14 +0000 |
parents | 6166fbf375cc |
children | d030978bcd93 |
comparison
equal
deleted
inserted
replaced
5353:7e4703e16bbd | 5354:dfa6e7fa2bac |
---|---|
18 * License along with FFmpeg; if not, write to the Free Software | 18 * License along with FFmpeg; if not, write to the Free Software |
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20 */ | 20 */ |
21 #include "avcodec.h" | 21 #include "avcodec.h" |
22 #include "bytestream.h" | 22 #include "bytestream.h" |
23 #include "colorspace.h" | |
23 | 24 |
24 typedef struct DVBSubtitleContext { | 25 typedef struct DVBSubtitleContext { |
25 int hide_state; | 26 int hide_state; |
26 int object_version; | 27 int object_version; |
27 } DVBSubtitleContext; | 28 } DVBSubtitleContext; |
191 bitmap += linesize; | 192 bitmap += linesize; |
192 } | 193 } |
193 *pq = q; | 194 *pq = q; |
194 } | 195 } |
195 | 196 |
196 #define SCALEBITS 10 | |
197 #define ONE_HALF (1 << (SCALEBITS - 1)) | |
198 #define FIX(x) ((int) ((x) * (1<<SCALEBITS) + 0.5)) | |
199 | |
200 #define RGB_TO_Y_CCIR(r, g, b) \ | |
201 ((FIX(0.29900*219.0/255.0) * (r) + FIX(0.58700*219.0/255.0) * (g) + \ | |
202 FIX(0.11400*219.0/255.0) * (b) + (ONE_HALF + (16 << SCALEBITS))) >> SCALEBITS) | |
203 | |
204 #define RGB_TO_U_CCIR(r1, g1, b1, shift)\ | |
205 (((- FIX(0.16874*224.0/255.0) * r1 - FIX(0.33126*224.0/255.0) * g1 + \ | |
206 FIX(0.50000*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128) | |
207 | |
208 #define RGB_TO_V_CCIR(r1, g1, b1, shift)\ | |
209 (((FIX(0.50000*224.0/255.0) * r1 - FIX(0.41869*224.0/255.0) * g1 - \ | |
210 FIX(0.08131*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128) | |
211 | |
212 static int encode_dvb_subtitles(DVBSubtitleContext *s, | 197 static int encode_dvb_subtitles(DVBSubtitleContext *s, |
213 uint8_t *outbuf, AVSubtitle *h) | 198 uint8_t *outbuf, AVSubtitle *h) |
214 { | 199 { |
215 uint8_t *q, *pseg_len; | 200 uint8_t *q, *pseg_len; |
216 int page_id, region_id, clut_id, object_id, i, bpp_index, page_state; | 201 int page_id, region_id, clut_id, object_id, i, bpp_index, page_state; |