Mercurial > libavcodec.hg
comparison imgconvert.c @ 9245:b5d1395879a0 libavcodec
Make the pixel formats which were defined as macros:
PIX_FMT_ARGB
PIX_FMT_RGBA
PIX_FMT_ABGR
PIX_FMT_BGRA
defined as enum PixelFormat values, and viceversa make:
PIX_FMT_RGB32
PIX_FMT_RGB32_1
PIX_FMT_BGR32
PIX_FMT_BGR32_1
defined as macros, also resort accordingly the enum PixelFormat
list.
Also make avcodec_get_pix_fmt() recognize the "rgb32" and "bgr32"
aliases, in order to make ffmpeg pass regressions test.
This change breaks ABI backward compatibility.
author | stefano |
---|---|
date | Sun, 22 Mar 2009 22:50:19 +0000 |
parents | 3153dcc9f8d0 |
children | 9e8931fef1c1 |
comparison
equal
deleted
inserted
replaced
9244:cbf65173eed3 | 9245:b5d1395879a0 |
---|---|
190 .color_type = FF_COLOR_RGB, | 190 .color_type = FF_COLOR_RGB, |
191 .pixel_type = FF_PIXEL_PACKED, | 191 .pixel_type = FF_PIXEL_PACKED, |
192 .depth = 8, | 192 .depth = 8, |
193 .x_chroma_shift = 0, .y_chroma_shift = 0, | 193 .x_chroma_shift = 0, .y_chroma_shift = 0, |
194 }, | 194 }, |
195 [PIX_FMT_RGB32] = { | 195 [PIX_FMT_ARGB] = { |
196 .name = "rgb32", | 196 .name = "argb", |
197 .nb_channels = 4, .is_alpha = 1, | 197 .nb_channels = 4, .is_alpha = 1, |
198 .color_type = FF_COLOR_RGB, | 198 .color_type = FF_COLOR_RGB, |
199 .pixel_type = FF_PIXEL_PACKED, | 199 .pixel_type = FF_PIXEL_PACKED, |
200 .depth = 8, | 200 .depth = 8, |
201 .x_chroma_shift = 0, .y_chroma_shift = 0, | 201 .x_chroma_shift = 0, .y_chroma_shift = 0, |
333 .color_type = FF_COLOR_YUV, | 333 .color_type = FF_COLOR_YUV, |
334 .pixel_type = FF_PIXEL_PACKED, | 334 .pixel_type = FF_PIXEL_PACKED, |
335 .depth = 8, | 335 .depth = 8, |
336 .x_chroma_shift = 2, .y_chroma_shift = 0, | 336 .x_chroma_shift = 2, .y_chroma_shift = 0, |
337 }, | 337 }, |
338 [PIX_FMT_BGR32] = { | 338 [PIX_FMT_ABGR] = { |
339 .name = "bgr32", | 339 .name = "abgr", |
340 .nb_channels = 4, .is_alpha = 1, | 340 .nb_channels = 4, .is_alpha = 1, |
341 .color_type = FF_COLOR_RGB, | 341 .color_type = FF_COLOR_RGB, |
342 .pixel_type = FF_PIXEL_PACKED, | 342 .pixel_type = FF_PIXEL_PACKED, |
343 .depth = 8, | 343 .depth = 8, |
344 .x_chroma_shift = 0, .y_chroma_shift = 0, | 344 .x_chroma_shift = 0, .y_chroma_shift = 0, |
438 .pixel_type = FF_PIXEL_PLANAR, | 438 .pixel_type = FF_PIXEL_PLANAR, |
439 .depth = 8, | 439 .depth = 8, |
440 .x_chroma_shift = 1, .y_chroma_shift = 1, | 440 .x_chroma_shift = 1, .y_chroma_shift = 1, |
441 }, | 441 }, |
442 | 442 |
443 [PIX_FMT_BGR32_1] = { | 443 [PIX_FMT_BGRA] = { |
444 .name = "bgr32_1", | 444 .name = "bgra", |
445 .nb_channels = 4, .is_alpha = 1, | 445 .nb_channels = 4, .is_alpha = 1, |
446 .color_type = FF_COLOR_RGB, | 446 .color_type = FF_COLOR_RGB, |
447 .pixel_type = FF_PIXEL_PACKED, | 447 .pixel_type = FF_PIXEL_PACKED, |
448 .depth = 8, | 448 .depth = 8, |
449 .x_chroma_shift = 0, .y_chroma_shift = 0, | 449 .x_chroma_shift = 0, .y_chroma_shift = 0, |
450 }, | 450 }, |
451 [PIX_FMT_RGB32_1] = { | 451 [PIX_FMT_RGBA] = { |
452 .name = "rgb32_1", | 452 .name = "rgba", |
453 .nb_channels = 4, .is_alpha = 1, | 453 .nb_channels = 4, .is_alpha = 1, |
454 .color_type = FF_COLOR_RGB, | 454 .color_type = FF_COLOR_RGB, |
455 .pixel_type = FF_PIXEL_PACKED, | 455 .pixel_type = FF_PIXEL_PACKED, |
456 .depth = 8, | 456 .depth = 8, |
457 .x_chroma_shift = 0, .y_chroma_shift = 0, | 457 .x_chroma_shift = 0, .y_chroma_shift = 0, |
505 # define X_NE(be, le) le | 505 # define X_NE(be, le) le |
506 #endif | 506 #endif |
507 | 507 |
508 enum PixelFormat avcodec_get_pix_fmt(const char *name) | 508 enum PixelFormat avcodec_get_pix_fmt(const char *name) |
509 { | 509 { |
510 enum PixelFormat pix_fmt = avcodec_get_pix_fmt_internal(name); | 510 enum PixelFormat pix_fmt; |
511 | 511 |
512 if (!strcmp(name, "rgb32")) | |
513 name = X_NE("argb", "bgra"); | |
514 else if (!strcmp(name, "bgr32")) | |
515 name = X_NE("abgr", "rgba"); | |
516 | |
517 pix_fmt = avcodec_get_pix_fmt_internal(name); | |
512 if (pix_fmt == PIX_FMT_NONE) { | 518 if (pix_fmt == PIX_FMT_NONE) { |
513 char name2[32]; | 519 char name2[32]; |
514 snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le")); | 520 snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le")); |
515 pix_fmt = avcodec_get_pix_fmt_internal(name2); | 521 pix_fmt = avcodec_get_pix_fmt_internal(name2); |
516 } | 522 } |
622 break; | 628 break; |
623 case PIX_FMT_RGB24: | 629 case PIX_FMT_RGB24: |
624 case PIX_FMT_BGR24: | 630 case PIX_FMT_BGR24: |
625 picture->linesize[0] = width * 3; | 631 picture->linesize[0] = width * 3; |
626 break; | 632 break; |
627 case PIX_FMT_RGB32: | 633 case PIX_FMT_ARGB: |
628 case PIX_FMT_BGR32: | 634 case PIX_FMT_ABGR: |
629 case PIX_FMT_RGB32_1: | 635 case PIX_FMT_RGBA: |
630 case PIX_FMT_BGR32_1: | 636 case PIX_FMT_BGRA: |
631 picture->linesize[0] = width * 4; | 637 picture->linesize[0] = width * 4; |
632 break; | 638 break; |
633 case PIX_FMT_RGB48BE: | 639 case PIX_FMT_RGB48BE: |
634 case PIX_FMT_RGB48LE: | 640 case PIX_FMT_RGB48LE: |
635 picture->linesize[0] = width * 6; | 641 picture->linesize[0] = width * 6; |
714 picture->data[2] = NULL; | 720 picture->data[2] = NULL; |
715 picture->data[3] = NULL; | 721 picture->data[3] = NULL; |
716 return size + 2 * size2; | 722 return size + 2 * size2; |
717 case PIX_FMT_RGB24: | 723 case PIX_FMT_RGB24: |
718 case PIX_FMT_BGR24: | 724 case PIX_FMT_BGR24: |
719 case PIX_FMT_RGB32: | 725 case PIX_FMT_ARGB: |
720 case PIX_FMT_BGR32: | 726 case PIX_FMT_ABGR: |
721 case PIX_FMT_RGB32_1: | 727 case PIX_FMT_RGBA: |
722 case PIX_FMT_BGR32_1: | 728 case PIX_FMT_BGRA: |
723 case PIX_FMT_RGB48BE: | 729 case PIX_FMT_RGB48BE: |
724 case PIX_FMT_RGB48LE: | 730 case PIX_FMT_RGB48LE: |
725 case PIX_FMT_GRAY16BE: | 731 case PIX_FMT_GRAY16BE: |
726 case PIX_FMT_GRAY16LE: | 732 case PIX_FMT_GRAY16LE: |
727 case PIX_FMT_BGR555: | 733 case PIX_FMT_BGR555: |