Revision db4fac64 libavcodec/dvbsub.c

View differences:

libavcodec/dvbsub.c
228 228
    for (region_id = 0; region_id < h->num_rects; region_id++) {
229 229
        *q++ = region_id;
230 230
        *q++ = 0xff; /* reserved */
231
        bytestream_put_be16(&q, h->rects[region_id].x); /* left pos */
232
        bytestream_put_be16(&q, h->rects[region_id].y); /* top pos */
231
        bytestream_put_be16(&q, h->rects[region_id]->x); /* left pos */
232
        bytestream_put_be16(&q, h->rects[region_id]->y); /* top pos */
233 233
    }
234 234

  
235 235
    bytestream_put_be16(&pseg_len, q - pseg_len - 2);
......
239 239

  
240 240
            /* CLUT segment */
241 241

  
242
            if (h->rects[clut_id].nb_colors <= 4) {
242
            if (h->rects[clut_id]->nb_colors <= 4) {
243 243
                /* 2 bpp, some decoders do not support it correctly */
244 244
                bpp_index = 0;
245
            } else if (h->rects[clut_id].nb_colors <= 16) {
245
            } else if (h->rects[clut_id]->nb_colors <= 16) {
246 246
                /* 4 bpp, standard encoding */
247 247
                bpp_index = 1;
248 248
            } else {
......
257 257
            *q++ = clut_id;
258 258
            *q++ = (0 << 4) | 0xf; /* version = 0 */
259 259

  
260
            for(i = 0; i < h->rects[clut_id].nb_colors; i++) {
260
            for(i = 0; i < h->rects[clut_id]->nb_colors; i++) {
261 261
                *q++ = i; /* clut_entry_id */
262 262
                *q++ = (1 << (7 - bpp_index)) | (0xf << 1) | 1; /* 2 bits/pixel full range */
263 263
                {
264 264
                    int a, r, g, b;
265
                    a = (h->rects[clut_id].rgba_palette[i] >> 24) & 0xff;
266
                    r = (h->rects[clut_id].rgba_palette[i] >> 16) & 0xff;
267
                    g = (h->rects[clut_id].rgba_palette[i] >> 8) & 0xff;
268
                    b = (h->rects[clut_id].rgba_palette[i] >> 0) & 0xff;
265
                    a = (h->rects[clut_id]->rgba_palette[i] >> 24) & 0xff;
266
                    r = (h->rects[clut_id]->rgba_palette[i] >> 16) & 0xff;
267
                    g = (h->rects[clut_id]->rgba_palette[i] >> 8) & 0xff;
268
                    b = (h->rects[clut_id]->rgba_palette[i] >> 0) & 0xff;
269 269

  
270 270
                    *q++ = RGB_TO_Y_CCIR(r, g, b);
271 271
                    *q++ = RGB_TO_V_CCIR(r, g, b, 0);
......
282 282

  
283 283
        /* region composition segment */
284 284

  
285
        if (h->rects[region_id].nb_colors <= 4) {
285
        if (h->rects[region_id]->nb_colors <= 4) {
286 286
            /* 2 bpp, some decoders do not support it correctly */
287 287
            bpp_index = 0;
288
        } else if (h->rects[region_id].nb_colors <= 16) {
288
        } else if (h->rects[region_id]->nb_colors <= 16) {
289 289
            /* 4 bpp, standard encoding */
290 290
            bpp_index = 1;
291 291
        } else {
......
299 299
        q += 2; /* segment length */
300 300
        *q++ = region_id;
301 301
        *q++ = (s->object_version << 4) | (0 << 3) | 0x07; /* version , no fill */
302
        bytestream_put_be16(&q, h->rects[region_id].w); /* region width */
303
        bytestream_put_be16(&q, h->rects[region_id].h); /* region height */
302
        bytestream_put_be16(&q, h->rects[region_id]->w); /* region width */
303
        bytestream_put_be16(&q, h->rects[region_id]->h); /* region height */
304 304
        *q++ = ((1 + bpp_index) << 5) | ((1 + bpp_index) << 2) | 0x03;
305 305
        *q++ = region_id; /* clut_id == region_id */
306 306
        *q++ = 0; /* 8 bit fill colors */
......
322 322
        for (object_id = 0; object_id < h->num_rects; object_id++) {
323 323
            /* Object Data segment */
324 324

  
325
            if (h->rects[object_id].nb_colors <= 4) {
325
            if (h->rects[object_id]->nb_colors <= 4) {
326 326
                /* 2 bpp, some decoders do not support it correctly */
327 327
                bpp_index = 0;
328
            } else if (h->rects[object_id].nb_colors <= 16) {
328
            } else if (h->rects[object_id]->nb_colors <= 16) {
329 329
                /* 4 bpp, standard encoding */
330 330
                bpp_index = 1;
331 331
            } else {
......
358 358
                    dvb_encode_rle = dvb_encode_rle4;
359 359

  
360 360
                top_ptr = q;
361
                dvb_encode_rle(&q, h->rects[object_id].bitmap, h->rects[object_id].w * 2,
362
                                    h->rects[object_id].w, h->rects[object_id].h >> 1);
361
                dvb_encode_rle(&q, h->rects[object_id]->bitmap, h->rects[object_id]->w * 2,
362
                                    h->rects[object_id]->w, h->rects[object_id]->h >> 1);
363 363
                bottom_ptr = q;
364
                dvb_encode_rle(&q, h->rects[object_id].bitmap + h->rects[object_id].w,
365
                                    h->rects[object_id].w * 2, h->rects[object_id].w,
366
                                    h->rects[object_id].h >> 1);
364
                dvb_encode_rle(&q, h->rects[object_id]->bitmap + h->rects[object_id]->w,
365
                                    h->rects[object_id]->w * 2, h->rects[object_id]->w,
366
                                    h->rects[object_id]->h >> 1);
367 367

  
368 368
                bytestream_put_be16(&ptop_field_len, bottom_ptr - top_ptr);
369 369
                bytestream_put_be16(&pbottom_field_len, q - bottom_ptr);

Also available in: Unified diff