summaryrefslogtreecommitdiff
path: root/legacy/emotion/src
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-06-07 05:26:39 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-06-07 05:26:39 +0000
commite14550b58c4f83445c8bbc0c98d0fe8b63adab31 (patch)
tree531869fb9b4cc1ca591f4f5de5ffbe948ab304a0 /legacy/emotion/src
parentdd84715cc8632055b40e7dfb7756ecc72564386e (diff)
emotion: fix stride for all YUV video.
SVN revision: 71772
Diffstat (limited to 'legacy/emotion/src')
-rw-r--r--legacy/emotion/src/modules/gstreamer/emotion_convert.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/legacy/emotion/src/modules/gstreamer/emotion_convert.c b/legacy/emotion/src/modules/gstreamer/emotion_convert.c
index 1bfc19a9cd..3d3b46e189 100644
--- a/legacy/emotion/src/modules/gstreamer/emotion_convert.c
+++ b/legacy/emotion/src/modules/gstreamer/emotion_convert.c
@@ -78,45 +78,57 @@ _evas_video_bgra(unsigned char *evas_data, const unsigned char *gst_data, unsign
78} 78}
79 79
80static void 80static void
81_evas_video_i420(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h __UNUSED__, unsigned int output_height) 81_evas_video_i420(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h, unsigned int output_height)
82{ 82{
83 const unsigned char **rows; 83 const unsigned char **rows;
84 unsigned int i, j; 84 unsigned int i, j;
85 unsigned int rh; 85 unsigned int rh;
86 unsigned int stride_y, stride_uv;
86 87
87 rh = output_height; 88 rh = output_height;
88 89
89 rows = (const unsigned char **)evas_data; 90 rows = (const unsigned char **)evas_data;
90 91
92 stride_y = GST_ROUND_UP_4(w);
93 stride_uv = GST_ROUND_UP_8(w) / 2;
94
91 for (i = 0; i < rh; i++) 95 for (i = 0; i < rh; i++)
92 rows[i] = &gst_data[i * w]; 96 rows[i] = &gst_data[i * stride_y];
93 97
94 for (j = 0; j < (rh / 2); j++, i++) 98 for (j = 0; j < (rh / 2); j++, i++)
95 rows[i] = &gst_data[h * w + j * (w / 2)]; 99 rows[i] = &gst_data[h * stride_y + j * stride_uv];
96 100
97 for (j = 0; j < (rh / 2); j++, i++) 101 for (j = 0; j < (rh / 2); j++, i++)
98 rows[i] = &gst_data[h * w + rh * (w / 4) + j * (w / 2)]; 102 rows[i] = &gst_data[h * stride_y +
103 (rh / 2) * stride_uv +
104 j * stride_uv];
99} 105}
100 106
101static void 107static void
102_evas_video_yv12(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h __UNUSED__, unsigned int output_height) 108_evas_video_yv12(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h, unsigned int output_height)
103{ 109{
104 const unsigned char **rows; 110 const unsigned char **rows;
105 unsigned int i, j; 111 unsigned int i, j;
106 unsigned int rh; 112 unsigned int rh;
113 unsigned int stride_y, stride_uv;
107 114
108 rh = output_height; 115 rh = output_height;
109 116
110 rows = (const unsigned char **)evas_data; 117 rows = (const unsigned char **)evas_data;
111 118
119 stride_y = GST_ROUND_UP_4(w);
120 stride_uv = GST_ROUND_UP_8(w) / 2;
121
112 for (i = 0; i < rh; i++) 122 for (i = 0; i < rh; i++)
113 rows[i] = &gst_data[i * w]; 123 rows[i] = &gst_data[i * stride_y];
114 124
115 for (j = 0; j < (rh / 2); j++, i++) 125 for (j = 0; j < (rh / 2); j++, i++)
116 rows[i] = &gst_data[h * w + rh * (w / 4) + j * (w / 2)]; 126 rows[i] = &gst_data[h * stride_y +
127 (rh / 2) * stride_uv +
128 j * stride_uv];
117 129
118 for (j = 0; j < (rh / 2); j++, i++) 130 for (j = 0; j < (rh / 2); j++, i++)
119 rows[i] = &gst_data[h * w + j * (w / 2)]; 131 rows[i] = &gst_data[h * stride_y + j * stride_uv];
120} 132}
121 133
122static void 134static void
@@ -124,11 +136,14 @@ _evas_video_yuy2(unsigned char *evas_data, const unsigned char *gst_data, unsign
124{ 136{
125 const unsigned char **rows; 137 const unsigned char **rows;
126 unsigned int i; 138 unsigned int i;
139 unsigned int stride;
127 140
128 rows = (const unsigned char **)evas_data; 141 rows = (const unsigned char **)evas_data;
129 142
143 stride = GST_ROUND_UP_4(w * 2);
144
130 for (i = 0; i < output_height; i++) 145 for (i = 0; i < output_height; i++)
131 rows[i] = &gst_data[i * w * 2]; 146 rows[i] = &gst_data[i * stride];
132} 147}
133 148
134static void 149static void