ext/dv/gstdvdec.c: remove unneeded comment from dvdec (related to DV 4CC codes in AVI files) moved them in gstreamer/...

Original commit message from CVS:
* ext/dv/gstdvdec.c:
remove unneeded comment from dvdec
(related to DV 4CC codes in AVI files)
moved them in gstreamer/docs/random/mimetypes
* gst/asfdemux/gstasfdemux.c:
(gst_asf_demux_process_ext_content_desc):
don't send text tags if they are empty
fix mem leak on error path
* gst/ffmpegcolorspace/avcodec.h:
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
(gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_pixfmt),
(gst_ffmpegcsp_avpicture_fill):
* gst/ffmpegcolorspace/imgconvert.c: (img_get_alpha_info):
* gst/ffmpegcolorspace/imgconvert_template.h:
adds BGR32 and BGRA32 to ffmpegcolorspace
(still bad colors, fixing it on next commit)
helps with dvdec outputing BGR32
This commit is contained in:
Stéphane Loeuillet 2005-01-08 12:25:26 +00:00
parent 37b9719c75
commit 8bc3ca9106
5 changed files with 177 additions and 3 deletions

View file

@ -1,3 +1,23 @@
2005-01-08 Stephane LOEUILLET <stephane.loeuillet@tiscali.fr>
* ext/dv/gstdvdec.c:
remove unneeded comment from dvdec
(related to DV 4CC codes in AVI files)
moved them in gstreamer/docs/random/mimetypes
* gst/asfdemux/gstasfdemux.c:
(gst_asf_demux_process_ext_content_desc):
don't send text tags if they are empty
fix mem leak on error path
* gst/ffmpegcolorspace/avcodec.h:
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
(gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_pixfmt),
(gst_ffmpegcsp_avpicture_fill):
* gst/ffmpegcolorspace/imgconvert.c: (img_get_alpha_info):
* gst/ffmpegcolorspace/imgconvert_template.h:
adds BGR32 and BGRA32 to ffmpegcolorspace
(still bad colors, fixing it on next commit)
helps with dvdec outputing BGR32
2005-01-08 Stephane LOEUILLET <stephane.loeuillet@tiscali.fr>
* ext/dv/gstdvdec.c:

View file

@ -59,7 +59,9 @@ enum PixelFormat {
PIX_FMT_YUV422P, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
PIX_FMT_YUV444P, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
PIX_FMT_RGBA32, ///< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness
PIX_FMT_BGRA32, ///< Packed pixel, 4 bytes per pixel, ARGBARGB...
PIX_FMT_RGB32, ///< Packed pixel, 4 bytes per pixel, BGRXBGRX..., stored in cpu endianness
PIX_FMT_BGR32, ///< Packed pixel, 4 bytes per pixel, XRGBXRGB...
PIX_FMT_YUV410P, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
PIX_FMT_YUV411P, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
PIX_FMT_RGB565, ///< always stored in cpu endianness

View file

@ -159,6 +159,20 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context)
r_mask = 0x0000ff00;
g_mask = 0x00ff0000;
b_mask = 0xff000000;
#endif
break;
case PIX_FMT_BGR32:
bpp = 32;
depth = 24;
endianness = G_BIG_ENDIAN;
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
r_mask = 0x0000ff00;
g_mask = 0x00ff0000;
b_mask = 0xff000000;
#else
r_mask = 0x00ff0000;
g_mask = 0x0000ff00;
b_mask = 0x000000ff;
#endif
break;
case PIX_FMT_RGBA32:
@ -175,6 +189,22 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context)
g_mask = 0x00ff0000;
b_mask = 0x0000ff00;
a_mask = 0x000000ff;
#endif
break;
case PIX_FMT_BGRA32:
bpp = 32;
depth = 32;
endianness = G_BIG_ENDIAN;
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
r_mask = 0xff000000;
g_mask = 0x00ff0000;
b_mask = 0x0000ff00;
a_mask = 0x000000ff;
#else
r_mask = 0x000000ff;
g_mask = 0x0000ff00;
b_mask = 0x00ff0000;
a_mask = 0xff000000;
#endif
break;
case PIX_FMT_YUV410P:
@ -468,6 +498,13 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps,
if (rmask == 0x0000ff00)
#endif
context->pix_fmt = PIX_FMT_RGB32;
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
if (rmask == 0x0000ff00)
#else
if (rmask == 0x00ff0000)
#endif
context->pix_fmt = PIX_FMT_BGR32;
}
break;
case 24:
@ -585,6 +622,8 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture,
case PIX_FMT_AYUV4444:
case PIX_FMT_RGB32:
case PIX_FMT_RGBA32:
case PIX_FMT_BGR32:
case PIX_FMT_BGRA32:
stride = width * 4;
size = stride * height;
picture->data[0] = ptr;

View file

@ -189,6 +189,17 @@ static PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
/* .y_chroma_shift = */ 0,
/* .depth = */ 8,
},
/* [PIX_FMT_BGR32] = */ {
/* .format = */ PIX_FMT_BGR32,
/* .name = */ "bgr32",
/* .nb_channels = */ 4,
/* .color_type = */ FF_COLOR_RGB,
/* .pixel_type = */ FF_PIXEL_PACKED,
/* .is_alpha = */ 0,
/* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0,
/* .depth = */ 8,
},
/* [PIX_FMT_RGBA32] = */ {
/* .format = */ PIX_FMT_RGBA32,
/* .name = */ "rgba32",
@ -200,6 +211,17 @@ static PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
/* .y_chroma_shift = */ 0,
/* .depth = */ 8,
},
/* [PIX_FMT_BGRA32] = */ {
/* .format = */ PIX_FMT_BGRA32,
/* .name = */ "bgra32",
/* .nb_channels = */ 4,
/* .color_type = */ FF_COLOR_RGB,
/* .pixel_type = */ FF_PIXEL_PACKED,
/* .is_alpha = */ 1,
/* .x_chroma_shift = */ 0,
/* .y_chroma_shift = */ 0,
/* .depth = */ 8,
},
/* [PIX_FMT_RGB565] = */ {
/* .format = */ PIX_FMT_RGB565,
/* .name = */ "rgb565",
@ -1577,6 +1599,36 @@ bitcopy_n (unsigned int a, int n)
#include "imgconvert_template.h"
/* bgr32 handling */
#define RGB_NAME bgr32
#define RGB_IN(r, g, b, s)\
{\
unsigned int v = ((const uint32_t *)(s))[0];\
r = (v >> 8) & 0xff;\
g = (v >> 16) & 0xff;\
b = (v >> 24) & 0xff;\
}
#define RGBA_IN(r, g, b, a, s)\
{\
unsigned int v = ((const uint32_t *)(s))[0];\
a = 0xff;\
r = (v >> 8) & 0xff;\
g = (v >> 16) & 0xff;\
b = (v >> 24) & 0xff;\
}
#define RGBA_OUT(d, r, g, b, a)\
{\
((uint32_t *)(d))[0] = a | (r << 8) | (g << 16) | (b << 24);\
}
#define BPP 4
#include "imgconvert_template.h"
/* rgba32 handling */
#define RGB_NAME rgba32
@ -1608,6 +1660,36 @@ bitcopy_n (unsigned int a, int n)
#include "imgconvert_template.h"
/* bgra32 handling */
#define RGB_NAME bgra32
#define RGB_IN(r, g, b, s)\
{\
unsigned int v = ((const uint32_t *)(s))[0];\
r = (v >> 8) & 0xff;\
g = (v >> 16) & 0xff;\
b = (v >> 24) & 0xff;\
}
#define RGBA_IN(r, g, b, a, s)\
{\
unsigned int v = ((const uint32_t *)(s))[0];\
a = v & 0xff;\
r = (v >> 8) & 0xff;\
g = (v >> 16) & 0xff;\
b = (v >> 24) & 0xff;\
}
#define RGBA_OUT(d, r, g, b, a)\
{\
((uint32_t *)(d))[0] = a | (r << 8) | (g << 16) | (b << 24 );\
}
#define BPP 4
#include "imgconvert_template.h"
static void
mono_to_gray (AVPicture * dst, const AVPicture * src,
int width, int height, int xor_mask)
@ -1755,7 +1837,9 @@ static ConvertEntry convert_table[] = {
{PIX_FMT_YUV420P, PIX_FMT_BGR24, yuv420p_to_bgr24},
{PIX_FMT_YUV420P, PIX_FMT_RGB24, yuv420p_to_rgb24},
{PIX_FMT_YUV420P, PIX_FMT_RGB32, yuv420p_to_rgb32},
{PIX_FMT_YUV420P, PIX_FMT_BGR32, yuv420p_to_bgr32},
{PIX_FMT_YUV420P, PIX_FMT_RGBA32, yuv420p_to_rgba32},
{PIX_FMT_YUV420P, PIX_FMT_BGRA32, yuv420p_to_bgra32},
{PIX_FMT_YUV422P, PIX_FMT_YUV422, yuv422p_to_yuv422},
{PIX_FMT_YUV422P, PIX_FMT_UYVY422, yuv422p_to_uyvy422},
@ -1767,24 +1851,26 @@ static ConvertEntry convert_table[] = {
{PIX_FMT_YUVJ420P, PIX_FMT_BGR24, yuvj420p_to_bgr24},
{PIX_FMT_YUVJ420P, PIX_FMT_RGB24, yuvj420p_to_rgb24},
{PIX_FMT_YUVJ420P, PIX_FMT_RGB32, yuvj420p_to_rgb32},
{PIX_FMT_YUVJ420P, PIX_FMT_BGR32, yuvj420p_to_bgr32},
{PIX_FMT_YUVJ420P, PIX_FMT_RGBA32, yuvj420p_to_rgba32},
{PIX_FMT_YUVJ420P, PIX_FMT_BGRA32, yuvj420p_to_bgra32},
{PIX_FMT_YUVJ444P, PIX_FMT_RGB24, yuvj444p_to_rgb24},
{PIX_FMT_YUV422, PIX_FMT_YUV420P, yuv422_to_yuv420p},
{PIX_FMT_YUV422, PIX_FMT_YUV422P, yuv422_to_yuv422p},
{PIX_FMT_UYVY422, PIX_FMT_YUV420P, uyvy422_to_yuv420p},
{PIX_FMT_UYVY422, PIX_FMT_YUV422P, uyvy422_to_yuv422p},
{PIX_FMT_RGB24, PIX_FMT_YUV420P, rgb24_to_yuv420p},
{PIX_FMT_RGB24, PIX_FMT_RGB565, rgb24_to_rgb565},
{PIX_FMT_RGB24, PIX_FMT_RGB555, rgb24_to_rgb555},
{PIX_FMT_RGB24, PIX_FMT_RGB32, rgb24_to_rgb32},
{PIX_FMT_RGB24, PIX_FMT_BGR32, rgb24_to_bgr32},
{PIX_FMT_RGB24, PIX_FMT_RGBA32, rgb24_to_rgba32},
{PIX_FMT_RGB24, PIX_FMT_BGR24, rgb24_to_bgr24},
{PIX_FMT_RGB24, PIX_FMT_BGRA32, rgb24_to_bgra32},
{PIX_FMT_RGB24, PIX_FMT_GRAY8, rgb24_to_gray},
{PIX_FMT_RGB24, PIX_FMT_PAL8, rgb24_to_pal8},
{PIX_FMT_RGB24, PIX_FMT_YUV444P, rgb24_to_yuv444p},
@ -1798,6 +1884,8 @@ static ConvertEntry convert_table[] = {
{PIX_FMT_RGB32, PIX_FMT_YUV420P, rgb32_to_yuv420p},
{PIX_FMT_RGB32, PIX_FMT_GRAY8, rgb32_to_gray},
{PIX_FMT_RGBA32, PIX_FMT_BGRA32, rgba32_to_bgra32},
{PIX_FMT_RGBA32, PIX_FMT_BGR32, rgba32_to_bgr32},
{PIX_FMT_RGBA32, PIX_FMT_RGB24, rgba32_to_rgb24},
{PIX_FMT_RGBA32, PIX_FMT_RGB555, rgba32_to_rgb555},
{PIX_FMT_RGBA32, PIX_FMT_PAL8, rgba32_to_pal8},
@ -1809,6 +1897,16 @@ static ConvertEntry convert_table[] = {
{PIX_FMT_BGR24, PIX_FMT_YUV420P, bgr24_to_yuv420p},
{PIX_FMT_BGR24, PIX_FMT_GRAY8, bgr24_to_gray},
{PIX_FMT_BGR32, PIX_FMT_RGB24, bgr32_to_rgb24},
{PIX_FMT_BGR32, PIX_FMT_RGBA32, bgr32_to_rgba32},
{PIX_FMT_BGR32, PIX_FMT_YUV420P, bgr32_to_yuv420p},
{PIX_FMT_BGR32, PIX_FMT_GRAY8, bgr32_to_gray},
{PIX_FMT_BGRA32, PIX_FMT_RGB24, bgra32_to_rgb24},
{PIX_FMT_BGRA32, PIX_FMT_RGBA32, bgra32_to_rgba32},
{PIX_FMT_BGRA32, PIX_FMT_YUV420P, bgra32_to_yuv420p},
{PIX_FMT_BGRA32, PIX_FMT_GRAY8, bgra32_to_gray},
{PIX_FMT_RGB555, PIX_FMT_RGB24, rgb555_to_rgb24},
{PIX_FMT_RGB555, PIX_FMT_RGB32, rgb555_to_rgba32},
{PIX_FMT_RGB555, PIX_FMT_RGBA32, rgb555_to_rgba32},
@ -1824,7 +1922,9 @@ static ConvertEntry convert_table[] = {
{PIX_FMT_GRAY8, PIX_FMT_RGB24, gray_to_rgb24},
{PIX_FMT_GRAY8, PIX_FMT_BGR24, gray_to_bgr24},
{PIX_FMT_GRAY8, PIX_FMT_RGB32, gray_to_rgb32},
{PIX_FMT_GRAY8, PIX_FMT_BGR32, gray_to_bgr32},
{PIX_FMT_GRAY8, PIX_FMT_RGBA32, gray_to_rgba32},
{PIX_FMT_GRAY8, PIX_FMT_BGRA32, gray_to_bgra32},
{PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, gray_to_monowhite},
{PIX_FMT_GRAY8, PIX_FMT_MONOBLACK, gray_to_monoblack},
@ -1837,7 +1937,9 @@ static ConvertEntry convert_table[] = {
{PIX_FMT_PAL8, PIX_FMT_BGR24, pal8_to_bgr24},
{PIX_FMT_PAL8, PIX_FMT_RGB24, pal8_to_rgb24},
{PIX_FMT_PAL8, PIX_FMT_RGB32, pal8_to_rgb32},
{PIX_FMT_PAL8, PIX_FMT_BGR32, pal8_to_bgr32},
{PIX_FMT_PAL8, PIX_FMT_RGBA32, pal8_to_rgba32},
{PIX_FMT_PAL8, PIX_FMT_BGRA32, pal8_to_bgra32},
{PIX_FMT_UYVY411, PIX_FMT_YUV411P, uyvy411_to_yuv411p},
@ -2167,9 +2269,15 @@ img_get_alpha_info (const AVPicture * src, int pix_fmt, int width, int height)
case PIX_FMT_RGB32:
ret = get_alpha_info_rgb32 (src, width, height);
break;
case PIX_FMT_BGR32:
ret = get_alpha_info_bgr32 (src, width, height);
break;
case PIX_FMT_RGBA32:
ret = get_alpha_info_rgba32 (src, width, height);
break;
case PIX_FMT_BGRA32:
ret = get_alpha_info_bgra32 (src, width, height);
break;
case PIX_FMT_RGB555:
ret = get_alpha_info_rgb555 (src, width, height);
break;

View file

@ -468,6 +468,9 @@ static void glue(RGB_NAME, _to_rgba32)(AVPicture *dst, const AVPicture *src,
}
}
#if !defined(rgba32_fcts_done)
#define rgba32_fcts_done
static void ayuv4444_to_rgba32(AVPicture *dst, const AVPicture *src,
int width, int height)
{
@ -522,7 +525,9 @@ static void rgba32_to_ayuv4444(AVPicture *dst, const AVPicture *src,
}
}
#endif /* !defined(FMT_RGBA32) && defined(RGBA_IN) */
#endif /* !defined(rgba32_fcts_done) */
#endif /* !defined(FMT_RGBA32) && defined(RGBA_OUT) */
#ifndef FMT_RGB24