summaryrefslogtreecommitdiff
path: root/libavcodec/imgconvert.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-10-27 21:42:26 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-10-27 21:42:26 +0000
commitd7e2f57f0e6d1b8f51dd8f5b3324263d4b4d935a (patch)
treed66bc2be77d6649ca0e1c8ea01aabe465d97cfb7 /libavcodec/imgconvert.c
parentab711b3c8d59671e2f506a9febd030f74fda006b (diff)
downloadffmpeg-d7e2f57f0e6d1b8f51dd8f5b3324263d4b4d935a.tar.gz
YUV420P to YUV422 conversion routine by (Danny Laarmans <dlaarmans at androme dot com>)
Originally committed as revision 3642 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/imgconvert.c')
-rw-r--r--libavcodec/imgconvert.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index 0e763abf9e..a22fd889b2 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -922,6 +922,39 @@ static void uyvy411_to_yuv411p(AVPicture *dst, const AVPicture *src,
}
+static void yuv420p_to_yuv422(AVPicture *dst, const AVPicture *src,
+ int width, int height)
+{
+ int w, h;
+ uint8_t *line1, *line2, *linesrc = dst->data[0];
+ uint8_t *lum1, *lum2, *lumsrc = src->data[0];
+ uint8_t *cb1, *cb2 = src->data[1];
+ uint8_t *cr1, *cr2 = src->data[2];
+
+ for(h = height / 2; h--;) {
+ line1 = linesrc;
+ line2 = linesrc + dst->linesize[0];
+
+ lum1 = lumsrc;
+ lum2 = lumsrc + src->linesize[0];
+
+ cb1 = cb2;
+ cr1 = cr2;
+
+ for(w = width / 2; w--;) {
+ *line1++ = *lum1++; *line2++ = *lum2++;
+ *line1++ = *line2++ = *cb1++;
+ *line1++ = *lum1++; *line2++ = *lum2++;
+ *line1++ = *line2++ = *cr1++;
+ }
+
+ linesrc += dst->linesize[0] * 2;
+ lumsrc += src->linesize[0] * 2;
+ cb2 += src->linesize[1];
+ cr2 += src->linesize[2];
+ }
+}
+
#define SCALEBITS 10
#define ONE_HALF (1 << (SCALEBITS - 1))
#define FIX(x) ((int) ((x) * (1<<SCALEBITS) + 0.5))
@@ -1631,6 +1664,9 @@ typedef struct ConvertEntry {
*/
static ConvertEntry convert_table[PIX_FMT_NB][PIX_FMT_NB] = {
[PIX_FMT_YUV420P] = {
+ [PIX_FMT_YUV422] = {
+ .convert = yuv420p_to_yuv422,
+ },
[PIX_FMT_RGB555] = {
.convert = yuv420p_to_rgb555
},