diff options
Diffstat (limited to 'gst/ffmpegcolorspace/imgconvert_template.h')
-rw-r--r-- | gst/ffmpegcolorspace/imgconvert_template.h | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/gst/ffmpegcolorspace/imgconvert_template.h b/gst/ffmpegcolorspace/imgconvert_template.h index b495e605b..0ade4fa90 100644 --- a/gst/ffmpegcolorspace/imgconvert_template.h +++ b/gst/ffmpegcolorspace/imgconvert_template.h @@ -753,2 +753,106 @@ static void glue(gray_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src, +static void glue(RGB_NAME, _to_gray16_l)(AVPicture *dst, const AVPicture *src, + int width, int height) +{ + const unsigned char *p; + unsigned char *q; + int r, g, b, dst_wrap, src_wrap; + int x, y; + + p = src->data[0]; + src_wrap = src->linesize[0] - BPP * width; + + q = dst->data[0]; + dst_wrap = dst->linesize[0] - 2 * width; + + for(y=0;y<height;y++) { + for(x=0;x<width;x++) { + RGB_IN(r, g, b, p); + GST_WRITE_UINT16_LE (q, RGB_TO_Y(r, g, b) << 8); + q += 2; + p += BPP; + } + p += src_wrap; + q += dst_wrap; + } +} + +static void glue(gray16_l_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src, + int width, int height) +{ + const unsigned char *p; + unsigned char *q; + int r, dst_wrap, src_wrap; + int x, y; + + p = src->data[0]; + src_wrap = src->linesize[0] - 2 * width; + + q = dst->data[0]; + dst_wrap = dst->linesize[0] - BPP * width; + + for(y=0;y<height;y++) { + for(x=0;x<width;x++) { + r = GST_READ_UINT16_LE (p) >> 8; + RGB_OUT(q, r, r, r); + q += BPP; + p += 2; + } + p += src_wrap; + q += dst_wrap; + } +} + +static void glue(RGB_NAME, _to_gray16_b)(AVPicture *dst, const AVPicture *src, + int width, int height) +{ + const unsigned char *p; + unsigned char *q; + int r, g, b, dst_wrap, src_wrap; + int x, y; + + p = src->data[0]; + src_wrap = src->linesize[0] - BPP * width; + + q = dst->data[0]; + dst_wrap = dst->linesize[0] - 2 * width; + + for(y=0;y<height;y++) { + for(x=0;x<width;x++) { + RGB_IN(r, g, b, p); + GST_WRITE_UINT16_BE (q, RGB_TO_Y(r, g, b) << 8); + q += 2; + p += BPP; + } + p += src_wrap; + q += dst_wrap; + } +} + +static void glue(gray16_b_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src, + int width, int height) +{ + const unsigned char *p; + unsigned char *q; + int r, dst_wrap, src_wrap; + int x, y; + + p = src->data[0]; + src_wrap = src->linesize[0] - 2 * width; + + q = dst->data[0]; + dst_wrap = dst->linesize[0] - BPP * width; + + for(y=0;y<height;y++) { + for(x=0;x<width;x++) { + r = GST_READ_UINT16_BE (p) >> 8; + RGB_OUT(q, r, r, r); + q += BPP; + p += 2; + } + p += src_wrap; + q += dst_wrap; + } +} + static void glue(pal8_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src, |