Revision 00b2fa86

View differences:

libavcodec/imgconvert.c
235 235
        .depth = 8,
236 236
        .x_chroma_shift = 2, .y_chroma_shift = 0,
237 237
    },
238
    [PIX_FMT_BGR32] = {
239
        .name = "bgr32",
240
        .nb_channels = 4, .is_alpha = 1,
241
        .color_type = FF_COLOR_RGB,
242
        .pixel_type = FF_PIXEL_PACKED,
243
        .depth = 8,
244
        .x_chroma_shift = 0, .y_chroma_shift = 0,
245
    },
246
    [PIX_FMT_BGR565] = {
247
        .name = "bgr565",
248
        .nb_channels = 3,
249
        .color_type = FF_COLOR_RGB,
250
        .pixel_type = FF_PIXEL_PACKED,
251
        .depth = 5,
252
        .x_chroma_shift = 0, .y_chroma_shift = 0,
253
    },
254
    [PIX_FMT_BGR555] = {
255
        .name = "bgr555",
256
        .nb_channels = 4, .is_alpha = 1,
257
        .color_type = FF_COLOR_RGB,
258
        .pixel_type = FF_PIXEL_PACKED,
259
        .depth = 5,
260
        .x_chroma_shift = 0, .y_chroma_shift = 0,
261
    },
262
    [PIX_FMT_RGB8] = {
263
        .name = "rgb8",
264
        .nb_channels = 1,
265
        .color_type = FF_COLOR_RGB,
266
        .pixel_type = FF_PIXEL_PACKED,
267
        .depth = 8,
268
        .x_chroma_shift = 0, .y_chroma_shift = 0,
269
    },
270
    [PIX_FMT_RGB4] = {
271
        .name = "rgb4",
272
        .nb_channels = 1,
273
        .color_type = FF_COLOR_RGB,
274
        .pixel_type = FF_PIXEL_PACKED,
275
        .depth = 4,
276
        .x_chroma_shift = 0, .y_chroma_shift = 0,
277
    },
278
    [PIX_FMT_RGB4_BYTE] = {
279
        .name = "rgb4_byte",
280
        .nb_channels = 1,
281
        .color_type = FF_COLOR_RGB,
282
        .pixel_type = FF_PIXEL_PACKED,
283
        .depth = 8,
284
        .x_chroma_shift = 0, .y_chroma_shift = 0,
285
    },
286
    [PIX_FMT_BGR8] = {
287
        .name = "bgr8",
288
        .nb_channels = 1,
289
        .color_type = FF_COLOR_RGB,
290
        .pixel_type = FF_PIXEL_PACKED,
291
        .depth = 8,
292
        .x_chroma_shift = 0, .y_chroma_shift = 0,
293
    },
294
    [PIX_FMT_BGR4] = {
295
        .name = "bgr4",
296
        .nb_channels = 1,
297
        .color_type = FF_COLOR_RGB,
298
        .pixel_type = FF_PIXEL_PACKED,
299
        .depth = 4,
300
        .x_chroma_shift = 0, .y_chroma_shift = 0,
301
    },
302
    [PIX_FMT_BGR4_BYTE] = {
303
        .name = "bgr4_byte",
304
        .nb_channels = 1,
305
        .color_type = FF_COLOR_RGB,
306
        .pixel_type = FF_PIXEL_PACKED,
307
        .depth = 8,
308
        .x_chroma_shift = 0, .y_chroma_shift = 0,
309
    },
310
    [PIX_FMT_NV12] = {
311
        .name = "nv12",
312
        .nb_channels = 2,
313
        .color_type = FF_COLOR_YUV,
314
        .pixel_type = FF_PIXEL_PLANAR,
315
        .depth = 8,
316
        .x_chroma_shift = 1, .y_chroma_shift = 1,
317
    },
318
    [PIX_FMT_NV21] = {
319
        .name = "nv12",
320
        .nb_channels = 2,
321
        .color_type = FF_COLOR_YUV,
322
        .pixel_type = FF_PIXEL_PLANAR,
323
        .depth = 8,
324
        .x_chroma_shift = 1, .y_chroma_shift = 1,
325
    },
326

  
327
    [PIX_FMT_BGR32_1] = {
328
        .name = "bgr32_1",
329
        .nb_channels = 4, .is_alpha = 1,
330
        .color_type = FF_COLOR_RGB,
331
        .pixel_type = FF_PIXEL_PACKED,
332
        .depth = 8,
333
        .x_chroma_shift = 0, .y_chroma_shift = 0,
334
    },
335
    [PIX_FMT_RGB32_1] = {
336
        .name = "rgb32_1",
337
        .nb_channels = 4, .is_alpha = 1,
338
        .color_type = FF_COLOR_RGB,
339
        .pixel_type = FF_PIXEL_PACKED,
340
        .depth = 8,
341
        .x_chroma_shift = 0, .y_chroma_shift = 0,
342
    },
238 343
};
239 344

  
240 345
void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift)
......
292 397
        picture->linesize[1] = w2;
293 398
        picture->linesize[2] = w2;
294 399
        return size + 2 * size2;
400
    case PIX_FMT_NV12:
401
    case PIX_FMT_NV21:
402
        w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift;
403
        h2 = (height + (1 << pinfo->y_chroma_shift) - 1) >> pinfo->y_chroma_shift;
404
        size2 = w2 * h2 * 2;
405
        picture->data[0] = ptr;
406
        picture->data[1] = picture->data[0] + size;
407
        picture->data[2] = NULL;
408
        picture->linesize[0] = width;
409
        picture->linesize[1] = w2;
410
        picture->linesize[2] = 0;
411
        return size + 2 * size2;
295 412
    case PIX_FMT_RGB24:
296 413
    case PIX_FMT_BGR24:
297 414
        picture->data[0] = ptr;
......
300 417
        picture->linesize[0] = width * 3;
301 418
        return size * 3;
302 419
    case PIX_FMT_RGBA32:
420
    case PIX_FMT_BGR32:
421
    case PIX_FMT_RGB32_1:
422
    case PIX_FMT_BGR32_1:
303 423
        picture->data[0] = ptr;
304 424
        picture->data[1] = NULL;
305 425
        picture->data[2] = NULL;
306 426
        picture->linesize[0] = width * 4;
307 427
        return size * 4;
428
    case PIX_FMT_BGR555:
429
    case PIX_FMT_BGR565:
308 430
    case PIX_FMT_RGB555:
309 431
    case PIX_FMT_RGB565:
310 432
    case PIX_FMT_YUV422:
......
325 447
        picture->data[2] = NULL;
326 448
        picture->linesize[0] = width + width/2;
327 449
        return size + size/2;
450
    case PIX_FMT_RGB8:
451
    case PIX_FMT_BGR8:
452
    case PIX_FMT_RGB4_BYTE:
453
    case PIX_FMT_BGR4_BYTE:
328 454
    case PIX_FMT_GRAY8:
329 455
        picture->data[0] = ptr;
330 456
        picture->data[1] = NULL;
331 457
        picture->data[2] = NULL;
332 458
        picture->linesize[0] = width;
333 459
        return size;
460
    case PIX_FMT_RGB4:
461
    case PIX_FMT_BGR4:
462
        picture->data[0] = ptr;
463
        picture->data[1] = NULL;
464
        picture->data[2] = NULL;
465
        picture->linesize[0] = width / 2;
466
        return size / 2;
334 467
    case PIX_FMT_MONOWHITE:
335 468
    case PIX_FMT_MONOBLACK:
336 469
        picture->data[0] = ptr;
......
370 503
    if (pf->pixel_type == FF_PIXEL_PACKED || pf->pixel_type == FF_PIXEL_PALETTE) {
371 504
        if (pix_fmt == PIX_FMT_YUV422 ||
372 505
            pix_fmt == PIX_FMT_UYVY422 ||
506
            pix_fmt == PIX_FMT_BGR565 ||
507
            pix_fmt == PIX_FMT_BGR565 ||
373 508
            pix_fmt == PIX_FMT_RGB565 ||
374 509
            pix_fmt == PIX_FMT_RGB555)
375 510
            w = width * 2;
......
484 619
        case PIX_FMT_UYVY422:
485 620
        case PIX_FMT_RGB565:
486 621
        case PIX_FMT_RGB555:
622
        case PIX_FMT_BGR565:
623
        case PIX_FMT_BGR555:
487 624
            bits = 16;
488 625
            break;
489 626
        case PIX_FMT_UYVY411:
......
602 739
        case PIX_FMT_UYVY422:
603 740
        case PIX_FMT_RGB565:
604 741
        case PIX_FMT_RGB555:
742
        case PIX_FMT_BGR565:
743
        case PIX_FMT_BGR555:
605 744
            bits = 16;
606 745
            break;
607 746
        case PIX_FMT_UYVY411:

Also available in: Unified diff