110
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) {
112
color = h->rects[object_id].bitmap[i];
111
for (i=0; i<h->rects[object_id]->w*h->rects[object_id]->h; ++i) {
112
color = h->rects[object_id]->pict.data[0][i];
113
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
115
hist[color] += alpha;
117
117
for (color=3;; --color) {
138
138
for (object_id = 0; object_id < rects; object_id++) {
139
139
offset1[object_id] = q - outbuf;
140
140
// worst case memory requirement: 1 nibble per pixel..
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
142
+ 17*rects + 21 > outbuf_size) {
143
143
av_log(NULL, AV_LOG_ERROR, "dvd_subtitle too big\n");
146
dvd_encode_rle(&q, h->rects[object_id].bitmap,
147
h->rects[object_id].w*2,
148
h->rects[object_id].w, h->rects[object_id].h >> 1,
146
dvd_encode_rle(&q, h->rects[object_id]->pict.data[0],
147
h->rects[object_id]->w*2,
148
h->rects[object_id]->w, h->rects[object_id]->h >> 1,
150
150
offset2[object_id] = q - outbuf;
151
dvd_encode_rle(&q, h->rects[object_id].bitmap + h->rects[object_id].w,
152
h->rects[object_id].w*2,
153
h->rects[object_id].w, h->rects[object_id].h >> 1,
151
dvd_encode_rle(&q, h->rects[object_id]->pict.data[0] + h->rects[object_id]->w,
152
h->rects[object_id]->w*2,
153
h->rects[object_id]->w, h->rects[object_id]->h >> 1,
170
170
// XXX not sure if more than one rect can really be encoded..
171
171
// 12 bytes per rect
172
172
for (object_id = 0; object_id < rects; object_id++) {
173
int x2 = h->rects[object_id].x + h->rects[object_id].w - 1;
174
int y2 = h->rects[object_id].y + h->rects[object_id].h - 1;
173
int x2 = h->rects[object_id]->x + h->rects[object_id]->w - 1;
174
int y2 = h->rects[object_id]->y + h->rects[object_id]->h - 1;
177
177
// x1 x2 -> 6 nibbles
178
*q++ = h->rects[object_id].x >> 4;
179
*q++ = (h->rects[object_id].x << 4) | ((x2 >> 8) & 0xf);
178
*q++ = h->rects[object_id]->x >> 4;
179
*q++ = (h->rects[object_id]->x << 4) | ((x2 >> 8) & 0xf);
181
181
// y1 y2 -> 6 nibbles
182
*q++ = h->rects[object_id].y >> 4;
183
*q++ = (h->rects[object_id].y << 4) | ((y2 >> 8) & 0xf);
182
*q++ = h->rects[object_id]->y >> 4;
183
*q++ = (h->rects[object_id]->y << 4) | ((y2 >> 8) & 0xf);