demux:mkv: fix wrong value reset after clean of an array
[vlc.git] / modules / video_chroma / omxdl.c
blobadca69a7d13541becf2e3896f44375c5442bea54
1 /*****************************************************************************
2 * omxdl.c : OpenMAX DL chroma conversions for VLC
3 *****************************************************************************
4 * Copyright (C) 2011 RĂ©mi Denis-Courmont
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
21 #ifdef HAVE_CONFIG_H
22 # include "config.h"
23 #endif
25 #include <vlc_common.h>
26 #include <vlc_plugin.h>
27 #include <vlc_filter.h>
28 #include <vlc_picture.h>
29 #include <omxtypes.h>
30 #include <omxIP.h>
32 static int Open (vlc_object_t *);
33 static int OpenScaler (vlc_object_t *);
35 vlc_module_begin ()
36 set_description (N_("OpenMAX DL image processing"))
37 set_capability ("video converter", 90)
38 set_callbacks (Open, NULL)
39 vlc_module_end ()
41 #define SRC_WIDTH (filter->fmt_in.video.i_width)
42 #define SRC_HEIGHT (filter->fmt_in.video.i_height)
43 #define DST_WIDTH (filter->fmt_out.video.i_width)
44 #define DST_HEIGHT (filter->fmt_out.video.i_height)
46 /*** Conversions from I420 ***/
47 static void I420_RV16 (filter_t *filter, picture_t *src, picture_t *dst)
49 const OMX_U8 *in[3] = { src->Y_PIXELS, src->U_PIXELS, src->V_PIXELS };
50 OMX_INT instep[3] = { src->Y_PITCH, src->U_PITCH, src->V_PITCH };
51 OMX_U16 *out = (void *)dst->p->p_pixels;
52 OMX_INT outstep = dst->p->i_pitch;
53 OMXSize size = { SRC_WIDTH, SRC_HEIGHT };
55 omxIPCS_YCbCr420ToBGR565_U8_U16_P3C3R (in, instep, out, outstep, size);
57 VIDEO_FILTER_WRAPPER (I420_RV16)
59 /*** Conversions from YV12 ***/
60 static void YV12_RV16 (filter_t *filter, picture_t *src, picture_t *dst)
62 const OMX_U8 *in[3] = { src->Y_PIXELS, src->V_PIXELS, src->U_PIXELS };
63 OMX_INT instep[3] = { src->Y_PITCH, src->V_PITCH, src->U_PITCH };
64 OMX_U16 *out = (void *)dst->p->p_pixels;
65 OMX_INT outstep = dst->p->i_pitch;
66 OMXSize size = { SRC_WIDTH, SRC_HEIGHT };
68 omxIPCS_YCbCr420ToBGR565_U8_U16_P3C3R (in, instep, out, outstep, size);
70 VIDEO_FILTER_WRAPPER (YV12_RV16)
72 /*** Conversions from I422 ***/
73 static void I422_I420 (filter_t *filter, picture_t *src, picture_t *dst)
75 const OMX_U8 *in[3] = { src->Y_PIXELS, src->U_PIXELS, src->V_PIXELS };
76 OMX_INT instep[3] = { src->Y_PITCH, src->U_PITCH, src->V_PITCH };
77 OMX_U8 *out[3] = { dst->Y_PIXELS, dst->U_PIXELS, dst->V_PIXELS };
78 OMX_INT outstep[3] = { dst->Y_PITCH, dst->U_PITCH, dst->V_PITCH };
79 OMXSize size = { SRC_WIDTH, SRC_HEIGHT };
81 omxIPCS_YCbCr422ToYCbCr420Rotate_U8_P3R (
82 in, instep, out, outstep, size, OMX_IP_DISABLE);
84 VIDEO_FILTER_WRAPPER (I422_I420)
86 static void I422_YV12 (filter_t *filter, picture_t *src, picture_t *dst)
88 const OMX_U8 *in[3] = { src->Y_PIXELS, src->U_PIXELS, src->V_PIXELS };
89 OMX_INT instep[3] = { src->Y_PITCH, src->U_PITCH, src->V_PITCH };
90 OMX_U8 *out[3] = { dst->Y_PIXELS, dst->V_PIXELS, dst->U_PIXELS };
91 OMX_INT outstep[3] = { dst->Y_PITCH, dst->V_PITCH, dst->U_PITCH };
92 OMXSize size = { SRC_WIDTH, SRC_HEIGHT };
94 omxIPCS_YCbCr422ToYCbCr420Rotate_U8_P3R (
95 in, instep, out, outstep, size, OMX_IP_DISABLE);
97 VIDEO_FILTER_WRAPPER (I422_YV12)
99 /*** Conversions from I444 ***/
100 static void I444_RV16 (filter_t *filter, picture_t *src, picture_t *dst)
102 const OMX_U8 *in[3] = { src->Y_PIXELS, src->U_PIXELS, src->V_PIXELS };
103 OMX_INT instep = src->p->i_pitch;
104 OMX_U16 *out = (void *)dst->p->p_pixels;
105 OMX_INT outstep = dst->p->i_pitch;
106 OMXSize size = {
107 filter->fmt_in.video.i_width,
108 filter->fmt_in.video.i_height,
111 omxIPCS_YCbCr444ToBGR565_U8_U16_P3C3R (in, instep, out, outstep, size);
113 VIDEO_FILTER_WRAPPER (I444_RV16)
115 /*** Conversions from YUY2 ***/
116 static void YUYV_RV24 (filter_t *filter, picture_t *src, picture_t *dst)
118 const OMX_U8 *in = src->p->p_pixels;
119 OMX_INT instep = src->p->i_pitch;
120 OMX_U8 *out = dst->p->p_pixels;
121 OMX_INT outstep = dst->p->i_pitch;
122 OMXSize size = { SRC_WIDTH, SRC_HEIGHT };
124 omxIPCS_YCbYCr422ToBGR888_U8_C2C3R (in, instep, out, outstep, size);
126 VIDEO_FILTER_WRAPPER (YUYV_RV24)
128 static void YUYV_RV16 (filter_t *filter, picture_t *src, picture_t *dst)
130 const OMX_U8 *in = src->p->p_pixels;
131 OMX_INT instep = src->p->i_pitch;
132 OMX_U16 *out = (void *)dst->p->p_pixels;
133 OMX_INT outstep = dst->p->i_pitch;
134 OMXSize size = { SRC_WIDTH, SRC_HEIGHT };
136 omxIPCS_YCbYCr422ToBGR565_U8_U16_C2C3R (in, instep, out, outstep, size);
138 VIDEO_FILTER_WRAPPER (YUYV_RV16)
140 /*** Conversions from UYVY ***/
141 static void UYVY_I420 (filter_t *filter, picture_t *src, picture_t *dst)
143 const OMX_U8 *in = src->p->p_pixels;
144 OMX_INT instep = src->p->i_pitch;
145 OMX_U8 *out[3] = { dst->Y_PIXELS, dst->U_PIXELS, dst->V_PIXELS };
146 OMX_INT outstep[3] = { dst->Y_PITCH, dst->U_PITCH, dst->V_PITCH };
147 OMXSize size = { SRC_WIDTH, SRC_HEIGHT };
149 omxIPCS_CbYCrY422ToYCbCr420Rotate_U8_C2P3R (
150 in, instep, out, outstep, size, OMX_IP_DISABLE);
152 VIDEO_FILTER_WRAPPER (UYVY_I420)
154 static void UYVY_YV12 (filter_t *filter, picture_t *src, picture_t *dst)
156 const OMX_U8 *in = src->p->p_pixels;
157 OMX_INT instep = src->p->i_pitch;
158 OMX_U8 *out[3] = { dst->Y_PIXELS, dst->V_PIXELS, dst->U_PIXELS };
159 OMX_INT outstep[3] = { dst->Y_PITCH, dst->V_PITCH, dst->U_PITCH };
160 OMXSize size = { SRC_WIDTH, SRC_HEIGHT };
162 omxIPCS_CbYCrY422ToYCbCr420Rotate_U8_C2P3R (
163 in, instep, out, outstep, size, OMX_IP_DISABLE);
165 VIDEO_FILTER_WRAPPER (UYVY_YV12)
167 /*** Helpers ***/
168 static int FixRV24 (video_format_t *fmt)
170 #ifndef WORDS_BIGENDIAN
171 if (fmt->i_rmask == 0 && fmt->i_gmask == 0 && fmt->i_bmask == 0)
173 fmt->i_rmask = 0xff0000;
174 fmt->i_gmask = 0x00ff00;
175 fmt->i_bmask = 0x0000ff;
177 return (fmt->i_rmask == 0xff0000 && fmt->i_gmask == 0x00ff00
178 && fmt->i_bmask == 0x0000ff) ? 0 : -1;
179 #else
180 if (fmt->i_rmask == 0 && fmt->i_gmask == 0 && fmt->i_bmask == 0)
182 fmt->i_rmask = 0x0000ff;
183 fmt->i_gmask = 0x00ff00;
184 fmt->i_bmask = 0xff0000;
186 return (fmt->i_rmask == 0x0000ff && fmt->i_gmask == 0x00ff00
187 && fmt->i_bmask == 0xff0000) ? 0 : -1;
188 #endif
191 static int FixRV16 (video_format_t *fmt)
193 #ifndef WORDS_BIGENDIAN
194 if (fmt->i_rmask == 0 && fmt->i_gmask == 0 && fmt->i_bmask == 0)
196 fmt->i_rmask = 0xf800;
197 fmt->i_gmask = 0x07e0;
198 fmt->i_bmask = 0x001f;
200 return (fmt->i_rmask == 0xf800 && fmt->i_gmask == 0x07e0
201 && fmt->i_bmask == 0x001f) ? 0 : -1;
202 #else
203 (void) fmt;
204 return -1;
205 #endif
208 static int FixRV15 (video_format_t *fmt)
210 #ifndef WORDS_BIGENDIAN
211 if (fmt->i_rmask == 0 && fmt->i_gmask == 0 && fmt->i_bmask == 0)
213 fmt->i_rmask = 0x7c00;
214 fmt->i_gmask = 0x03e0;
215 fmt->i_bmask = 0x001f;
217 return (fmt->i_rmask == 0x7c00 && fmt->i_gmask == 0x03e0
218 && fmt->i_bmask == 0x001f) ? 0 : -1;
219 #else
220 (void) fmt;
221 return -1;
222 #endif
225 static int FixRV12 (video_format_t *fmt)
227 #ifndef WORDS_BIGENDIAN
228 if (fmt->i_rmask == 0 && fmt->i_gmask == 0 && fmt->i_bmask == 0)
230 fmt->i_rmask = 0x0f00;
231 fmt->i_gmask = 0x00f0;
232 fmt->i_bmask = 0x000f;
234 return (fmt->i_rmask == 0x0f00 && fmt->i_gmask == 0x00f0
235 && fmt->i_bmask == 0x000f) ? 0 : -1;
236 #else
237 if (fmt->i_rmask == 0 && fmt->i_gmask == 0 && fmt->i_bmask == 0)
239 fmt->i_rmask = 0x000f;
240 fmt->i_gmask = 0xf000;
241 fmt->i_bmask = 0x0f00;
243 return (fmt->i_rmask == 0x000f && fmt->i_gmask == 0xf000
244 && fmt->i_bmask == 0x0f00) ? 0 : -1;
245 #endif
248 /*** Initialization ***/
249 static int Open (vlc_object_t *obj)
251 filter_t *filter = (filter_t *)obj;
253 if (filter->fmt_in.video.orientation != filter->fmt_out.video.orientation)
254 return VLC_EGENERIC;
256 if ((filter->fmt_in.video.i_width != filter->fmt_out.video.i_width)
257 || (filter->fmt_in.video.i_height != filter->fmt_out.video.i_height))
258 return OpenScaler (obj);
260 switch (filter->fmt_in.video.i_chroma)
262 case VLC_CODEC_I420:
263 switch (filter->fmt_out.video.i_chroma)
265 case VLC_CODEC_RGB16:
266 if (FixRV16 (&filter->fmt_out.video))
267 return VLC_EGENERIC;
268 filter->pf_video_filter = I420_RV16_Filter;
269 return VLC_SUCCESS;
271 break;
273 case VLC_CODEC_YV12:
274 switch (filter->fmt_out.video.i_chroma)
276 case VLC_CODEC_RGB16:
277 if (FixRV16 (&filter->fmt_out.video))
278 return VLC_EGENERIC;
279 filter->pf_video_filter = YV12_RV16_Filter;
280 return VLC_SUCCESS;
282 break;
284 case VLC_CODEC_I422:
285 switch (filter->fmt_out.video.i_chroma)
287 case VLC_CODEC_I420:
288 filter->pf_video_filter = I422_I420_Filter;
289 return VLC_SUCCESS;
290 case VLC_CODEC_YV12:
291 filter->pf_video_filter = I422_YV12_Filter;
292 return VLC_SUCCESS;
294 break;
296 case VLC_CODEC_I444:
297 switch (filter->fmt_out.video.i_chroma)
299 case VLC_CODEC_RGB16:
300 if (FixRV16 (&filter->fmt_out.video))
301 return VLC_EGENERIC;
302 filter->pf_video_filter = I444_RV16_Filter;
303 return VLC_SUCCESS;
305 return VLC_EGENERIC;
307 case VLC_CODEC_YUYV:
308 switch (filter->fmt_out.video.i_chroma)
310 case VLC_CODEC_RGB24:
311 if (FixRV24 (&filter->fmt_out.video))
312 return VLC_EGENERIC;
313 filter->pf_video_filter = YUYV_RV24_Filter;
314 return VLC_SUCCESS;
315 case VLC_CODEC_RGB16:
316 if (FixRV16 (&filter->fmt_out.video))
317 return VLC_EGENERIC;
318 filter->pf_video_filter = YUYV_RV16_Filter;
319 return VLC_SUCCESS;
321 return VLC_EGENERIC;
323 case VLC_CODEC_UYVY:
324 switch (filter->fmt_out.video.i_chroma)
326 case VLC_CODEC_I420:
327 filter->pf_video_filter = UYVY_I420_Filter;
328 return VLC_SUCCESS;
329 case VLC_CODEC_YV12:
330 filter->pf_video_filter = UYVY_YV12_Filter;
331 return VLC_SUCCESS;
333 return VLC_EGENERIC;
335 /* fallback to scaler (conversion with 1:1 scale) */
336 return OpenScaler (obj);
339 /* TODO: configurable interpolation */
341 #define XRR_MAX \
342 (OMX_INT)(((float)((SRC_WIDTH & ~1) - 1)) / ((DST_WIDTH & ~1) - 1) * (1 << 16) + .5)
343 #define YRR_MAX \
344 (OMX_INT)(((float)((SRC_HEIGHT & ~1) - 1)) / ((DST_HEIGHT & ~1) - 1) * (1 << 16) + .5)
345 #define CNV (*(int *)(filter->p_sys))
347 /*** Scaling from I420 ***/
348 static void I420_I420_Scale (filter_t *filter, picture_t *src, picture_t *dst)
350 const OMX_U8 *in[3] = { src->Y_PIXELS, src->U_PIXELS, src->V_PIXELS };
351 OMX_INT instep[3] = { src->Y_PITCH, src->U_PITCH, src->V_PITCH };
352 OMXSize insize = { SRC_WIDTH, SRC_HEIGHT };
353 OMX_U8 *out[3] = { dst->Y_PIXELS, dst->U_PIXELS, dst->V_PIXELS };
354 OMX_INT outstep[3] = { dst->Y_PITCH, dst->U_PITCH, dst->V_PITCH };
355 OMXSize outsize = { DST_WIDTH, DST_HEIGHT };
357 omxIPCS_YCbCr420RszRot_U8_P3R (
358 in, instep, insize, out, outstep, outsize,
359 OMX_IP_NEAREST, OMX_IP_DISABLE, XRR_MAX, YRR_MAX);
361 VIDEO_FILTER_WRAPPER (I420_I420_Scale)
363 static void I420_YV12_Scale (filter_t *filter, picture_t *src, picture_t *dst)
365 const OMX_U8 *in[3] = { src->Y_PIXELS, src->U_PIXELS, src->V_PIXELS };
366 OMX_INT instep[3] = { src->Y_PITCH, src->U_PITCH, src->V_PITCH };
367 OMXSize insize = { SRC_WIDTH, SRC_HEIGHT };
368 OMX_U8 *out[3] = { dst->Y_PIXELS, dst->V_PIXELS, dst->U_PIXELS };
369 OMX_INT outstep[3] = { dst->Y_PITCH, dst->V_PITCH, dst->U_PITCH };
370 OMXSize outsize = { DST_WIDTH, DST_HEIGHT };
372 omxIPCS_YCbCr420RszRot_U8_P3R (
373 in, instep, insize, out, outstep, outsize,
374 OMX_IP_NEAREST, OMX_IP_DISABLE, XRR_MAX, YRR_MAX);
376 VIDEO_FILTER_WRAPPER (I420_YV12_Scale)
378 static void I420_RGB_Scale (filter_t *filter, picture_t *src, picture_t *dst)
380 const OMX_U8 *in[3] = { src->Y_PIXELS, src->U_PIXELS, src->V_PIXELS };
381 OMX_INT instep[3] = { src->Y_PITCH, src->U_PITCH, src->V_PITCH };
382 OMXSize insize = { SRC_WIDTH, SRC_HEIGHT };
383 OMX_U8 *out = dst->p->p_pixels;
384 OMX_INT outstep = dst->p->i_pitch;
385 OMXSize outsize = { DST_WIDTH, DST_HEIGHT };
387 omxIPCS_YCbCr420RszCscRotBGR_U8_P3C3R (
388 in, instep, insize, out, outstep, outsize,
389 CNV, OMX_IP_NEAREST, OMX_IP_DISABLE, XRR_MAX, YRR_MAX);
391 VIDEO_FILTER_WRAPPER (I420_RGB_Scale)
393 /*** Scaling from YV12 ***/
394 static void YV12_I420_Scale (filter_t *filter, picture_t *src, picture_t *dst)
396 const OMX_U8 *in[3] = { src->Y_PIXELS, src->V_PIXELS, src->U_PIXELS };
397 OMX_INT instep[3] = { src->Y_PITCH, src->V_PITCH, src->U_PITCH };
398 OMXSize insize = { SRC_WIDTH, SRC_HEIGHT };
399 OMX_U8 *out[3] = { dst->Y_PIXELS, dst->U_PIXELS, dst->V_PIXELS };
400 OMX_INT outstep[3] = { dst->Y_PITCH, dst->U_PITCH, dst->V_PITCH };
401 OMXSize outsize = { DST_WIDTH, DST_HEIGHT };
403 omxIPCS_YCbCr420RszRot_U8_P3R (
404 in, instep, insize, out, outstep, outsize,
405 OMX_IP_NEAREST, OMX_IP_DISABLE, XRR_MAX, YRR_MAX);
407 VIDEO_FILTER_WRAPPER (YV12_I420_Scale)
409 static void YV12_YV12_Scale (filter_t *filter, picture_t *src, picture_t *dst)
411 const OMX_U8 *in[3] = { src->Y_PIXELS, src->V_PIXELS, src->U_PIXELS };
412 OMX_INT instep[3] = { src->Y_PITCH, src->V_PITCH, src->U_PITCH };
413 OMXSize insize = { SRC_WIDTH, SRC_HEIGHT };
414 OMX_U8 *out[3] = { dst->Y_PIXELS, dst->V_PIXELS, dst->U_PIXELS };
415 OMX_INT outstep[3] = { dst->Y_PITCH, dst->V_PITCH, dst->U_PITCH };
416 OMXSize outsize = { DST_WIDTH, DST_HEIGHT };
418 omxIPCS_YCbCr420RszRot_U8_P3R (
419 in, instep, insize, out, outstep, outsize,
420 OMX_IP_NEAREST, OMX_IP_DISABLE, XRR_MAX, YRR_MAX);
422 VIDEO_FILTER_WRAPPER (YV12_YV12_Scale)
424 static void YV12_RGB_Scale (filter_t *filter, picture_t *src, picture_t *dst)
426 const OMX_U8 *in[3] = { src->Y_PIXELS, src->V_PIXELS, src->U_PIXELS };
427 OMX_INT instep[3] = { src->Y_PITCH, src->V_PITCH, src->U_PITCH };
428 OMXSize insize = { SRC_WIDTH, SRC_HEIGHT };
429 OMX_U8 *out = dst->p->p_pixels;
430 OMX_INT outstep = dst->p->i_pitch;
431 OMXSize outsize = { DST_WIDTH, DST_HEIGHT };
433 omxIPCS_YCbCr420RszCscRotBGR_U8_P3C3R (
434 in, instep, insize, out, outstep, outsize,
435 CNV, OMX_IP_NEAREST, OMX_IP_DISABLE, XRR_MAX, YRR_MAX);
437 VIDEO_FILTER_WRAPPER (YV12_RGB_Scale)
439 /*** Scaling from I422 ***/
440 static void I422_I422_Scale (filter_t *filter, picture_t *src, picture_t *dst)
442 const OMX_U8 *in[3] = { src->Y_PIXELS, src->U_PIXELS, src->V_PIXELS };
443 OMX_INT instep[3] = { src->Y_PITCH, src->U_PITCH, src->V_PITCH };
444 OMXSize insize = { SRC_WIDTH, SRC_HEIGHT };
445 OMX_U8 *out[3] = { dst->Y_PIXELS, dst->U_PIXELS, dst->V_PIXELS };
446 OMX_INT outstep[3] = { dst->Y_PITCH, dst->U_PITCH, dst->V_PITCH };
447 OMXSize outsize = { DST_WIDTH, DST_HEIGHT };
449 omxIPCS_YCbCr422RszRot_U8_P3R (
450 in, instep, insize, out, outstep, outsize,
451 OMX_IP_NEAREST, OMX_IP_DISABLE, XRR_MAX, YRR_MAX);
453 VIDEO_FILTER_WRAPPER (I422_I422_Scale)
455 static void I422_RGB_Scale (filter_t *filter, picture_t *src, picture_t *dst)
457 const OMX_U8 *in[3] = { src->Y_PIXELS, src->U_PIXELS, src->V_PIXELS };
458 OMX_INT instep[3] = { src->Y_PITCH, src->U_PITCH, src->V_PITCH };
459 OMXSize insize = { SRC_WIDTH, SRC_HEIGHT };
460 OMX_U8 *out = dst->p->p_pixels;
461 OMX_INT outstep = dst->p->i_pitch;
462 OMXSize outsize = { DST_WIDTH, DST_HEIGHT };
464 omxIPCS_YCbCr422RszCscRotBGR_U8_P3C3R (
465 in, instep, insize, out, outstep, outsize,
466 CNV, OMX_IP_NEAREST, OMX_IP_DISABLE, XRR_MAX, YRR_MAX);
468 VIDEO_FILTER_WRAPPER (I422_RGB_Scale)
470 /*** Scaling initialization ***/
471 static int OpenScaler (vlc_object_t *obj)
473 filter_t *filter = (filter_t *)obj;
474 int *conv = vlc_obj_malloc(obj, sizeof (*conv));
476 if (unlikely(conv == NULL))
477 return VLC_ENOMEM;
479 filter->p_sys = conv;
481 switch (filter->fmt_in.video.i_chroma)
483 case VLC_CODEC_I420:
484 switch (filter->fmt_out.video.i_chroma)
486 case VLC_CODEC_I420:
487 filter->pf_video_filter = I420_I420_Scale_Filter;
488 return VLC_SUCCESS;
489 case VLC_CODEC_YV12:
490 filter->pf_video_filter = I420_YV12_Scale_Filter;
491 return VLC_SUCCESS;
492 case VLC_CODEC_RGB16:
493 if (FixRV16 (&filter->fmt_out.video))
494 return VLC_EGENERIC;
495 filter->pf_video_filter = I420_RGB_Scale_Filter;
496 *conv = OMX_IP_BGR565;
497 return VLC_SUCCESS;
498 case VLC_CODEC_RGB15:
499 if (FixRV15 (&filter->fmt_out.video))
500 break;
501 filter->pf_video_filter = I420_RGB_Scale_Filter;
502 *conv = OMX_IP_BGR555;
503 return VLC_SUCCESS;
504 case VLC_CODEC_RGB12:
505 if (FixRV12 (&filter->fmt_out.video))
506 break;
507 filter->pf_video_filter = I420_RGB_Scale_Filter;
508 *conv = OMX_IP_BGR444;
509 return VLC_SUCCESS;
510 case VLC_CODEC_RGB24:
511 if (FixRV24 (&filter->fmt_out.video))
512 break;
513 filter->pf_video_filter = I420_RGB_Scale_Filter;
514 *conv = OMX_IP_BGR888;
515 return VLC_SUCCESS;
517 break;
519 case VLC_CODEC_YV12:
520 switch (filter->fmt_out.video.i_chroma)
522 case VLC_CODEC_I420:
523 filter->pf_video_filter = YV12_I420_Scale_Filter;
524 return VLC_SUCCESS;
525 case VLC_CODEC_YV12:
526 filter->pf_video_filter = YV12_YV12_Scale_Filter;
527 return VLC_SUCCESS;
528 case VLC_CODEC_RGB16:
529 if (FixRV16 (&filter->fmt_out.video))
530 break;
531 filter->pf_video_filter = YV12_RGB_Scale_Filter;
532 *conv = OMX_IP_BGR565;
533 return VLC_SUCCESS;
534 case VLC_CODEC_RGB15:
535 if (FixRV15 (&filter->fmt_out.video))
536 break;
537 filter->pf_video_filter = YV12_RGB_Scale_Filter;
538 *conv = OMX_IP_BGR555;
539 return VLC_SUCCESS;
540 case VLC_CODEC_RGB12:
541 if (FixRV12 (&filter->fmt_out.video))
542 break;
543 filter->pf_video_filter = YV12_RGB_Scale_Filter;
544 *conv = OMX_IP_BGR444;
545 return VLC_SUCCESS;
546 case VLC_CODEC_RGB24:
547 if (FixRV24 (&filter->fmt_out.video))
548 break;
549 filter->pf_video_filter = YV12_RGB_Scale_Filter;
550 *conv = OMX_IP_BGR888;
551 return VLC_SUCCESS;
553 break;
555 case VLC_CODEC_I422:
556 switch (filter->fmt_out.video.i_chroma)
558 case VLC_CODEC_I422:
559 filter->pf_video_filter = I422_I422_Scale_Filter;
560 return VLC_SUCCESS;
561 case VLC_CODEC_RGB16:
562 if (FixRV16 (&filter->fmt_out.video))
563 break;
564 filter->pf_video_filter = I422_RGB_Scale_Filter;
565 *conv = OMX_IP_BGR565;
566 return VLC_SUCCESS;
567 case VLC_CODEC_RGB15:
568 if (FixRV15 (&filter->fmt_out.video))
569 break;
570 filter->pf_video_filter = I422_RGB_Scale_Filter;
571 *conv = OMX_IP_BGR555;
572 return VLC_SUCCESS;
573 case VLC_CODEC_RGB12:
574 if (FixRV12 (&filter->fmt_out.video))
575 break;
576 filter->pf_video_filter = I422_RGB_Scale_Filter;
577 *conv = OMX_IP_BGR444;
578 return VLC_SUCCESS;
579 case VLC_CODEC_RGB24:
580 if (FixRV24 (&filter->fmt_out.video))
581 break;
582 filter->pf_video_filter = I422_RGB_Scale_Filter;
583 *conv = OMX_IP_BGR888;
584 return VLC_SUCCESS;
586 break;
588 return VLC_EGENERIC;