Mercurial > libavcodec.hg
comparison xsubdec.c @ 5487:3039b660bf35 libavcodec
get rid of xsubdec array and calculate value instead
author | reimar |
---|---|
date | Sun, 05 Aug 2007 12:11:20 +0000 |
parents | 06486d4cfa88 |
children | 0f736b1402ca |
comparison
equal
deleted
inserted
replaced
5486:06486d4cfa88 | 5487:3039b660bf35 |
---|---|
21 ms = (ms + c) * tc_muls[i]; | 21 ms = (ms + c) * tc_muls[i]; |
22 } | 22 } |
23 ms = av_rescale_q(ms, (AVRational){1, 1000}, avctx->time_base); | 23 ms = av_rescale_q(ms, (AVRational){1, 1000}, avctx->time_base); |
24 return ms; | 24 return ms; |
25 } | 25 } |
26 | |
27 static const uint8_t runbits[8] = { 14, 14, 10, 10, 6, 6, 2, 2 }; | |
28 | 26 |
29 static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, | 27 static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, |
30 uint8_t *buf, int buf_size) { | 28 uint8_t *buf, int buf_size) { |
31 AVSubtitle *sub = data; | 29 AVSubtitle *sub = data; |
32 uint8_t *buf_end = buf + buf_size; | 30 uint8_t *buf_end = buf + buf_size; |
83 init_get_bits(&gb, buf, rlelen * 8); | 81 init_get_bits(&gb, buf, rlelen * 8); |
84 bitmap = sub->rects[0].bitmap; | 82 bitmap = sub->rects[0].bitmap; |
85 for (y = 0; y < h; y++) { | 83 for (y = 0; y < h; y++) { |
86 for (x = 0; x < w; ) { | 84 for (x = 0; x < w; ) { |
87 int log2 = ff_log2_tab[show_bits(&gb, 8)]; | 85 int log2 = ff_log2_tab[show_bits(&gb, 8)]; |
88 int run = get_bits(&gb, runbits[log2]); | 86 int run = get_bits(&gb, 14 - 4 * (log2 >> 1)); |
89 int colour = get_bits(&gb, 2); | 87 int colour = get_bits(&gb, 2); |
90 run = FFMIN(run, w - x); | 88 run = FFMIN(run, w - x); |
91 // run length 0 means till end of row | 89 // run length 0 means till end of row |
92 if (!run) run = w - x; | 90 if (!run) run = w - x; |
93 memset(bitmap, colour, run); | 91 memset(bitmap, colour, run); |