Mercurial > libavcodec.hg
comparison dvdsubenc.c @ 8516:315b302fcd1d libavcodec
Replace AVSubtitleRect.rgba_palette and bitmap by AVPicture.
author | michael |
---|---|
date | Sat, 03 Jan 2009 19:17:18 +0000 |
parents | aa45029f5cd7 |
children | 04423b2f6e0b |
comparison
equal
deleted
inserted
replaced
8515:45506d633cdc | 8516:315b302fcd1d |
---|---|
107 hist[i] = 0; | 107 hist[i] = 0; |
108 cmap[i] = 0; | 108 cmap[i] = 0; |
109 } | 109 } |
110 for (object_id = 0; object_id < rects; object_id++) | 110 for (object_id = 0; object_id < rects; object_id++) |
111 for (i=0; i<h->rects[object_id]->w*h->rects[object_id]->h; ++i) { | 111 for (i=0; i<h->rects[object_id]->w*h->rects[object_id]->h; ++i) { |
112 color = h->rects[object_id]->bitmap[i]; | 112 color = h->rects[object_id]->pict.data[0][i]; |
113 // only count non-transparent pixels | 113 // only count non-transparent pixels |
114 alpha = h->rects[object_id]->rgba_palette[color] >> 24; | 114 alpha = ((uint32_t*)h->rects[object_id]->pict.data[1])[color] >> 24; |
115 hist[color] += alpha; | 115 hist[color] += alpha; |
116 } | 116 } |
117 for (color=3;; --color) { | 117 for (color=3;; --color) { |
118 hmax = 0; | 118 hmax = 0; |
119 imax = 0; | 119 imax = 0; |
141 if ((q - outbuf) + h->rects[object_id]->w*h->rects[object_id]->h/2 | 141 if ((q - outbuf) + h->rects[object_id]->w*h->rects[object_id]->h/2 |
142 + 17*rects + 21 > outbuf_size) { | 142 + 17*rects + 21 > outbuf_size) { |
143 av_log(NULL, AV_LOG_ERROR, "dvd_subtitle too big\n"); | 143 av_log(NULL, AV_LOG_ERROR, "dvd_subtitle too big\n"); |
144 return -1; | 144 return -1; |
145 } | 145 } |
146 dvd_encode_rle(&q, h->rects[object_id]->bitmap, | 146 dvd_encode_rle(&q, h->rects[object_id]->pict.data[0], |
147 h->rects[object_id]->w*2, | 147 h->rects[object_id]->w*2, |
148 h->rects[object_id]->w, h->rects[object_id]->h >> 1, | 148 h->rects[object_id]->w, h->rects[object_id]->h >> 1, |
149 cmap); | 149 cmap); |
150 offset2[object_id] = q - outbuf; | 150 offset2[object_id] = q - outbuf; |
151 dvd_encode_rle(&q, h->rects[object_id]->bitmap + h->rects[object_id]->w, | 151 dvd_encode_rle(&q, h->rects[object_id]->pict.data[0] + h->rects[object_id]->w, |
152 h->rects[object_id]->w*2, | 152 h->rects[object_id]->w*2, |
153 h->rects[object_id]->w, h->rects[object_id]->h >> 1, | 153 h->rects[object_id]->w, h->rects[object_id]->h >> 1, |
154 cmap); | 154 cmap); |
155 } | 155 } |
156 | 156 |