diff --git a/gst/ffmpegcolorspace/avcodec.h b/gst/ffmpegcolorspace/avcodec.h index 942ef24e30..ec42eb0105 100644 --- a/gst/ffmpegcolorspace/avcodec.h +++ b/gst/ffmpegcolorspace/avcodec.h @@ -85,6 +85,7 @@ enum PixelFormat { PIX_FMT_XVMC_MPEG2_IDCT, PIX_FMT_UYVY422, ///< Packed pixel, Cb Y0 Cr Y1 PIX_FMT_UYVY411, ///< Packed pixel, Cb Y0 Y1 Cr Y2 Y3 + PIX_FMT_V308, ///< Packed pixel, Y0 Cb Cr PIX_FMT_AYUV4444, ///< Packed pixel, A0 Y0 Cb Cr PIX_FMT_NB diff --git a/gst/ffmpegcolorspace/gstffmpegcodecmap.c b/gst/ffmpegcolorspace/gstffmpegcodecmap.c index 0265c5b670..6b31dd9f3c 100644 --- a/gst/ffmpegcolorspace/gstffmpegcodecmap.c +++ b/gst/ffmpegcolorspace/gstffmpegcodecmap.c @@ -353,6 +353,9 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context) bpp = depth = 8; endianness = G_BYTE_ORDER; break; + case PIX_FMT_V308: + fmt = GST_MAKE_FOURCC ('V', '3', '0', '8'); + break; case PIX_FMT_AYUV4444: fmt = GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'); break; @@ -614,6 +617,9 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps, case GST_MAKE_FOURCC ('Y', 'V', 'U', '9'): context->pix_fmt = PIX_FMT_YVU410P; break; + case GST_MAKE_FOURCC ('V', '3', '0', '8'): + context->pix_fmt = PIX_FMT_V308; + break; case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'): context->pix_fmt = PIX_FMT_AYUV4444; break; @@ -857,6 +863,14 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, picture->data[2] = NULL; picture->linesize[0] = stride; return size; + case PIX_FMT_V308: + stride = GST_ROUND_UP_4 (width * 3); + size = stride * height; + picture->data[0] = ptr; + picture->data[1] = NULL; + picture->data[2] = NULL; + picture->linesize[0] = stride; + return size; case PIX_FMT_UYVY411: /* FIXME, probably not the right stride */ stride = GST_ROUND_UP_4 (width); diff --git a/gst/ffmpegcolorspace/imgconvert.c b/gst/ffmpegcolorspace/imgconvert.c index 82f8a0b897..d1e48ce52c 100644 --- a/gst/ffmpegcolorspace/imgconvert.c +++ b/gst/ffmpegcolorspace/imgconvert.c @@ -130,6 +130,17 @@ static PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { /* .y_chroma_shift = */ 0, /* .depth = */ 8, }, + /* [PIX_FMT_V308] = */ { + /* .format = */ PIX_FMT_V308, + /* .name = */ "v308", + /* .nb_channels = */ 1, + /* .color_type = */ FF_COLOR_YUV, + /* .pixel_type = */ FF_PIXEL_PACKED, + /* .is_alpha = */ 0, + /* .x_chroma_shift = */ 0, + /* .y_chroma_shift = */ 0, + /* .depth = */ 8, + }, /* [PIX_FMT_YUV410P] = */ { /* .format = */ PIX_FMT_YUV410P, /* .name = */ "yuv410p", @@ -2182,6 +2193,7 @@ static ConvertEntry convert_table[] = { {PIX_FMT_RGB24, PIX_FMT_YUVJ420P, rgb24_to_yuvj420p}, {PIX_FMT_RGB24, PIX_FMT_YUVJ444P, rgb24_to_yuvj444p}, {PIX_FMT_RGB24, PIX_FMT_AYUV4444, rgb24_to_ayuv4444}, + {PIX_FMT_RGB24, PIX_FMT_V308, rgb24_to_v308}, {PIX_FMT_RGB32, PIX_FMT_RGB24, rgb32_to_rgb24}, {PIX_FMT_RGB32, PIX_FMT_RGB555, rgba32_to_rgb555}, @@ -2303,9 +2315,10 @@ static ConvertEntry convert_table[] = { {PIX_FMT_UYVY411, PIX_FMT_YUV411P, uyvy411_to_yuv411p}, - {PIX_FMT_AYUV4444, PIX_FMT_RGBA32, ayuv4444_to_rgba32}, + {PIX_FMT_V308, PIX_FMT_RGB24, v308_to_rgb24}, - {PIX_FMT_AYUV4444, PIX_FMT_RGB24, ayuv4444_to_rgb24} + {PIX_FMT_AYUV4444, PIX_FMT_RGBA32, ayuv4444_to_rgba32}, + {PIX_FMT_AYUV4444, PIX_FMT_RGB24, ayuv4444_to_rgb24}, }; static ConvertEntry * @@ -2766,6 +2779,7 @@ deinterlace_line (uint8_t * dst, } #endif } + static void deinterlace_line_inplace (uint8_t * lum_m4, uint8_t * lum_m3, uint8_t * lum_m2, uint8_t * lum_m1, uint8_t * lum, int size) diff --git a/gst/ffmpegcolorspace/imgconvert_template.h b/gst/ffmpegcolorspace/imgconvert_template.h index 2835a00691..b495e605b7 100644 --- a/gst/ffmpegcolorspace/imgconvert_template.h +++ b/gst/ffmpegcolorspace/imgconvert_template.h @@ -1300,6 +1300,58 @@ static void rgb24_to_ayuv4444(AVPicture *dst, const AVPicture *src, d += dst_wrap; } } + +static void v308_to_rgb24(AVPicture *dst, const AVPicture *src, + int width, int height) +{ + uint8_t *s, *d, *d1, *s1; + int w, y, cb, cr, r_add, g_add, b_add; + uint8_t *cm = cropTbl + MAX_NEG_CROP; + unsigned int r, g, b; + + d = dst->data[0]; + s = src->data[0]; + for(;height > 0; height --) { + d1 = d; + s1 = s; + for(w = width; w > 0; w--) { + YUV_TO_RGB1_CCIR(s1[1], s1[2]); + + YUV_TO_RGB2_CCIR(r, g, b, s1[0]); + RGB_OUT(d1, r, g, b); + d1 += BPP; + s1 += 3; + } + d += dst->linesize[0]; + s += src->linesize[0]; + } +} + +static void rgb24_to_v308(AVPicture *dst, const AVPicture *src, + int width, int height) +{ + int src_wrap, dst_wrap, x, y; + int r, g, b; + uint8_t *d; + const uint8_t *p; + + src_wrap = src->linesize[0] - width * BPP; + dst_wrap = dst->linesize[0] - width * 3; + d = dst->data[0]; + p = src->data[0]; + for(y=0;y