Commit ec0f02a4 authored by Antoine Lejeune's avatar Antoine Lejeune Committed by Rémi Denis-Courmont

Maemo: Add the swscale_nokia770 library

Its interface is close to swscale and the library used part of the
swscale module code.
The library was developped by Siarhei Siamashka.
Signed-off-by: default avatarRémi Denis-Courmont <rdenis@simphalempin.com>
parent 374571ac
...@@ -4853,12 +4853,13 @@ dnl Maemo ...@@ -4853,12 +4853,13 @@ dnl Maemo
dnl dnl
AC_ARG_ENABLE(maemo, AC_ARG_ENABLE(maemo,
[ --enable-maemo Internet tablets based on Maemo SDK (default disabled)]) [ --enable-maemo Internet tablets based on Maemo SDK (default disabled)])
if test "${enable_maemo}" != "no" if test "${enable_maemo}" = "yes"
then then
PKG_CHECK_MODULES(HILDON, [hildon-1 hildon-fm-2], [ PKG_CHECK_MODULES(HILDON, [hildon-1 hildon-fm-2], [
VLC_ADD_CFLAGS([maemo],[${HILDON_CFLAGS}]) VLC_ADD_CFLAGS([maemo],[${HILDON_CFLAGS}])
VLC_ADD_LIBS([maemo],[${HILDON_LIBS}]) VLC_ADD_LIBS([maemo],[${HILDON_LIBS}])
VLC_ADD_PLUGIN([maemo]) VLC_ADD_PLUGIN([maemo])
VLC_ADD_PLUGIN([swscale_maemo])
AC_DEFINE([BUILD_MAEMO], 1, [Define if you're using Maemo interfaces]) AC_DEFINE([BUILD_MAEMO], 1, [Define if you're using Maemo interfaces])
ALIASES="${ALIASES} mvlc" ALIASES="${ALIASES} mvlc"
], [ ], [
......
...@@ -43,6 +43,7 @@ SOURCES_chain = chain.c ...@@ -43,6 +43,7 @@ SOURCES_chain = chain.c
SOURCES_postproc = postproc.c SOURCES_postproc = postproc.c
SOURCES_swscale = swscale.c ../codec/avcodec/chroma.c SOURCES_swscale = swscale.c ../codec/avcodec/chroma.c
SOURCES_imgresample = imgresample.c ../codec/avcodec/chroma.c SOURCES_imgresample = imgresample.c ../codec/avcodec/chroma.c
SOURCES_swscale_maemo = swscale_maemo.c libswscale_nokia770/arm_jit_swscale.c libswscale_nokia770/arm_colorconv.S libswscale_nokia770/arm_jit_swscale.h libswscale_nokia770/arm_colorconv.h
SOURCES_scene = scene.c SOURCES_scene = scene.c
SOURCES_yuvp = yuvp.c SOURCES_yuvp = yuvp.c
noinst_HEADERS = filter_common.h filter_picture.h noinst_HEADERS = filter_common.h filter_picture.h
/*
* ARM assembly optimized color format conversion functions
* (YV12 -> YUY2, YV12 -> some custom YUV420 format used by
* Epson graphics chip in Nokia N800)
*
* Copyright (C) 2007 Siarhei Siamashka <ssvb@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
.text
/*******************************************************/
.align
.global yv12_to_yuy2_line_arm
.func yv12_to_yuy2_line_arm
yv12_to_yuy2_line_arm:
#define DST r0
#define SRC_Y r1
#define SRC_U r2
#define SRC_V r3
#define WIDTH ip
ldr ip, [sp], #0
stmfd sp!, {r4-r8, r10, lr}
#define TMP1 r8
#define TMP2 r10
#define TMP3 lr
bic WIDTH, #1
subs WIDTH, #8
blt 2f
1:
ldrb r4, [SRC_Y], #1
ldrb TMP1, [SRC_U], #1
ldrb TMP2, [SRC_Y], #1
ldrb TMP3, [SRC_V], #1
add r4, r4, TMP1, lsl #8
add r4, r4, TMP2, lsl #16
add r4, r4, TMP3, lsl #24
ldrb r5, [SRC_Y], #1
ldrb TMP1, [SRC_U], #1
ldrb TMP2, [SRC_Y], #1
ldrb TMP3, [SRC_V], #1
add r5, r5, TMP1, lsl #8
add r5, r5, TMP2, lsl #16
add r5, r5, TMP3, lsl #24
ldrb r6, [SRC_Y], #1
ldrb TMP1, [SRC_U], #1
ldrb TMP2, [SRC_Y], #1
ldrb TMP3, [SRC_V], #1
add r6, r6, TMP1, lsl #8
add r6, r6, TMP2, lsl #16
add r6, r6, TMP3, lsl #24
ldrb r7, [SRC_Y], #1
ldrb TMP1, [SRC_U], #1
ldrb TMP2, [SRC_Y], #1
ldrb TMP3, [SRC_V], #1
add r7, r7, TMP1, lsl #8
add r7, r7, TMP2, lsl #16
add r7, r7, TMP3, lsl #24
stmia DST!, {r4-r7}
subs WIDTH, WIDTH, #8
bge 1b
2:
adds WIDTH, WIDTH, #8
ble 4f
3:
ldrb r4, [SRC_Y], #1
ldrb TMP1, [SRC_U], #1
ldrb TMP2, [SRC_Y], #1
ldrb TMP3, [SRC_V], #1
add r4, r4, TMP1, lsl #8
add r4, r4, TMP2, lsl #16
add r4, r4, TMP3, lsl #24
str r4, [DST], #4
subs WIDTH, WIDTH, #2
bgt 3b
4:
ldmfd sp!, {r4-r8, r10, pc}
#undef DST
#undef SRC_Y
#undef SRC_U
#undef SRC_V
#undef WIDTH
#undef TMP1
#undef TMP2
#undef TMP3
.endfunc
/*******************************************************/
#define DST r0
#define SRC_Y r1
#define SRC_U r2
#define WIDTH r3
#define TMP1 r10
#define TMP2 r11
#define TMP3 lr
.macro YUV420_function_template function_name, USE_PLD, USE_ARMV6
.align
.global \function_name
.func \function_name
\function_name:
/* Read information about 4 pixels, convert them to YUV420 and store into 6 bytes using 16-bit writes */
.macro CONVERT_4_PIXELS_MACROBLOCK
ldrb r4, [SRC_Y], #1
ldrb TMP1, [SRC_U], #1
ldrb r5, [SRC_U], #1
ldrb TMP2, [SRC_Y], #1
ldrb r6, [SRC_Y, #1]
ldrb TMP3, [SRC_Y], #2
add r4, r4, TMP1, lsl #8
add r5, r5, TMP2, lsl #8
add r6, r6, TMP3, lsl #8
strh r4, [DST], #2
strh r5, [DST], #2
strh r6, [DST], #2
.endm
.if \USE_ARMV6
.macro CONVERT_8_PIXELS_MACROBLOCK_1 DST_REG1, DST_REG2, FLAG1, FLAG2, PLD_FLAG
.if \FLAG1 == 0
ldrb \DST_REG1, [SRC_U], #1
ldrh TMP1, [SRC_Y], #2
ldrb TMP2, [SRC_U], #1
.endif
.if \FLAG2 == 1
ldrh \DST_REG2, [SRC_Y], #2
.endif
.if \PLD_FLAG == 1
pld [SRC_Y, #48]
.endif
add \DST_REG1, \DST_REG1, TMP1, lsl #8
add \DST_REG1, \DST_REG1, TMP2, lsl #24
.if \FLAG2 == 1
ldrb TMP1, [SRC_U], #1
ldrb TMP2, [SRC_Y], #1
.endif
rev16 \DST_REG1, \DST_REG1
.endm
.macro CONVERT_8_PIXELS_MACROBLOCK_2 DST_REG1, DST_REG2, FLAG1, FLAG2, DUMMY1
.if \FLAG1 == 0
ldrh \DST_REG1, [SRC_Y], #2
ldrb TMP1, [SRC_U], #1
ldrb TMP2, [SRC_Y], #1
.endif
.if \FLAG2 == 1
ldrb \DST_REG2, [SRC_Y], #1
.endif
add \DST_REG1, \DST_REG1, TMP1, lsl #16
add \DST_REG1, \DST_REG1, TMP2, lsl #24
.if \FLAG2 == 1
ldrb TMP1, [SRC_U], #1
ldrh TMP2, [SRC_Y], #2
.endif
rev16 \DST_REG1, \DST_REG1
.endm
.macro CONVERT_8_PIXELS_MACROBLOCK_3 DST_REG1, DST_REG2, FLAG1, FLAG2, DUMMY1
.if \FLAG1 == 0
ldrb \DST_REG1, [SRC_Y], #1
ldrb TMP1, [SRC_U], #1
ldrh TMP2, [SRC_Y], #2
.endif
.if \FLAG2 == 1
ldrb \DST_REG2, [SRC_U], #1
.endif
add \DST_REG1, \DST_REG1, TMP1, lsl #8
add \DST_REG1, \DST_REG1, TMP2, lsl #16
.if \FLAG2 == 1
ldrh TMP1, [SRC_Y], #2
ldrb TMP2, [SRC_U], #1
.endif
rev16 \DST_REG1, \DST_REG1
.endm
.else
/* Prepare the first 32-bit output value for 8 pixels macroblock */
.macro CONVERT_8_PIXELS_MACROBLOCK_1 DST_REG, DUMMY1, DUMMY2, DUMMY3, PLD_FLAG
ldrb \DST_REG, [SRC_Y], #1
ldrb TMP1, [SRC_U], #1
ldrb TMP2, [SRC_U], #1
ldrb TMP3, [SRC_Y], #1
.if \USE_PLD && (\PLD_FLAG == 1)
pld [SRC_Y, #48]
.endif
add \DST_REG, \DST_REG, TMP1, lsl #8
add \DST_REG, \DST_REG, TMP2, lsl #16
add \DST_REG, \DST_REG, TMP3, lsl #24
.endm
/* Prepare the second 32-bit output value for 8 pixels macroblock */
.macro CONVERT_8_PIXELS_MACROBLOCK_2 DST_REG, DUMMY1, DUMMY2, DUMMY3, DUMMY4
ldrb \DST_REG, [SRC_Y, #1]
ldrb TMP1, [SRC_Y], #2
ldrb TMP2, [SRC_Y], #1
ldrb TMP3, [SRC_U], #1
add \DST_REG, \DST_REG, TMP1, lsl #8
add \DST_REG, \DST_REG, TMP2, lsl #16
add \DST_REG, \DST_REG, TMP3, lsl #24
.endm
/* Prepare the third 32-bit output value for 8 pixels macroblock */
.macro CONVERT_8_PIXELS_MACROBLOCK_3 DST_REG, DUMMY1, DUMMY2, DUMMY3, DUMMY4
ldrb \DST_REG, [SRC_U], #1
ldrb TMP1, [SRC_Y], #1
ldrb TMP2, [SRC_Y, #1]
ldrb TMP3, [SRC_Y], #2
add \DST_REG, \DST_REG, TMP1, lsl #8
add \DST_REG, \DST_REG, TMP2, lsl #16
add \DST_REG, \DST_REG, TMP3, lsl #24
.endm
.endif
.if \USE_PLD
pld [SRC_Y]
.endif
stmfd sp!, {r4-r8, r10-r11, lr}
/* Destination buffer should be at least 16-bit aligned, image width should be multiple of 4 */
bic DST, #1
bic WIDTH, #3
/* Ensure 32-bit alignment of the destination buffer */
tst DST, #2
beq 1f
subs WIDTH, #4
blt 6f
CONVERT_4_PIXELS_MACROBLOCK
1:
subs WIDTH, #32
blt 3f
2: /* Convert 32 pixels per loop iteration */
CONVERT_8_PIXELS_MACROBLOCK_1 r4, r6, 0, 1, 1 /* Also do cache preload for SRC_Y */
CONVERT_8_PIXELS_MACROBLOCK_2 r6, r7, 1, 1, 0
CONVERT_8_PIXELS_MACROBLOCK_3 r7, r8, 1, 1, 0
CONVERT_8_PIXELS_MACROBLOCK_1 r8, r5, 1, 1, 0
stmia DST!, {r4, r6, r7, r8}
subs WIDTH, #32
CONVERT_8_PIXELS_MACROBLOCK_2 r5, r6, 1, 1, 0
CONVERT_8_PIXELS_MACROBLOCK_3 r6, r7, 1, 1, 0
CONVERT_8_PIXELS_MACROBLOCK_1 r7, r8, 1, 1, 0
CONVERT_8_PIXELS_MACROBLOCK_2 r8, r4, 1, 1, 0
stmia DST!, {r5, r6, r7, r8}
.if \USE_PLD
/* Do cache preload for SRC_U */
pld [SRC_U, #48]
.endif
CONVERT_8_PIXELS_MACROBLOCK_3 r4, r6, 1, 1, 0
CONVERT_8_PIXELS_MACROBLOCK_1 r6, r7, 1, 1, 0
CONVERT_8_PIXELS_MACROBLOCK_2 r7, r8, 1, 1, 0
CONVERT_8_PIXELS_MACROBLOCK_3 r8, r4, 1, 0, 0
stmia DST!, {r4, r6, r7, r8}
bge 2b
3:
adds WIDTH, WIDTH, #32
ble 6f
subs WIDTH, WIDTH, #8
blt 5f
4: /* Convert remaining pixels processing them 8 per iteration */
CONVERT_8_PIXELS_MACROBLOCK_1 r4, r5, 0, 1, 0
CONVERT_8_PIXELS_MACROBLOCK_2 r5, r6, 1, 1, 0
CONVERT_8_PIXELS_MACROBLOCK_3 r6, r7, 1, 0, 0
stmia DST!, {r4-r6}
subs WIDTH, WIDTH, #8
bge 4b
5: /* Convert the last 4 pixels if needed */
adds WIDTH, WIDTH, #8
ble 6f
CONVERT_4_PIXELS_MACROBLOCK
subs WIDTH, #4
bgt 4b
6: /* Restore all registers and return */
ldmfd sp!, {r4-r8, r10-r11, pc}
.purgem CONVERT_4_PIXELS_MACROBLOCK
.purgem CONVERT_8_PIXELS_MACROBLOCK_1
.purgem CONVERT_8_PIXELS_MACROBLOCK_2
.purgem CONVERT_8_PIXELS_MACROBLOCK_3
#undef DST
#undef SRC_Y
#undef SRC_U
#undef WIDTH
#undef TMP1
#undef TMP2
#undef TMP3
.endfunc
.endm
YUV420_function_template yv12_to_yuv420_line_arm, 0, 0
YUV420_function_template yv12_to_yuv420_line_armv5, 1, 0
YUV420_function_template yv12_to_yuv420_line_armv6, 1, 1
/*
* ARM assembly optimized color format conversion functions
* (YV12 -> YUY2, YV12 -> some custom YUV420 format used by
* Epson graphics chip in Nokia N800)
*
* Copyright (C) 2007 Siarhei Siamashka <ssvb@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef __ARM_COLORCONV_H__
#define __ARM_COLORCONV_H__
#include <stdint.h>
/**
* Convert a line of pixels from YV12 to YUY2 color format
* @param dst - destination buffer for YUY2 pixel data, it should be 32-bit aligned
* @param src_y - pointer to Y plane
* @param src_u - pointer to U plane
* @param src_v - pointer to V plane
* @param w - number of pixels to convert (should be multiple of 2)
*/
void yv12_to_yuy2_line_arm(uint32_t *dst, const uint16_t *src_y, const uint8_t *src_u, const uint8_t *src_v, int w);
/**
* Convert a line of pixels from YV12 to YUV420 color format
* @param dst - destination buffer for YUV420 pixel data, it should be at least 16-bit aligned
* @param src_y - pointer to Y plane
* @param src_c - pointer to chroma plane (U for even lines, V for odd lines)
* @param w - number of pixels to convert (should be multiple of 4)
*/
void yv12_to_yuv420_line_arm(uint16_t *dst, const uint8_t *src_y, const uint8_t *src_c, int w);
/**
* Convert a line of pixels from YV12 to YUV420 color format
* @param dst - destination buffer for YUV420 pixel data, it should be at least 16-bit aligned
* @param src_y - pointer to Y plane
* @param src_c - pointer to chroma plane (U for even lines, V for odd lines)
* @param w - number of pixels to convert (should be multiple of 4)
*/
void yv12_to_yuv420_line_armv5(uint16_t *dst, const uint8_t *src_y, const uint8_t *src_c, int w);
/**
* Convert a line of pixels from YV12 to YUV420 color format
* @param dst - destination buffer for YUV420 pixel data, it should be at least 16-bit aligned
* @param src_y - pointer to Y plane, it should be 16-bit aligned
* @param src_c - pointer to chroma plane (U for even lines, V for odd lines)
* @param w - number of pixels to convert (should be multiple of 4)
*/
void yv12_to_yuv420_line_armv6(uint16_t *dst, const uint16_t *src_y, const uint8_t *src_c, int w);
#endif
This diff is collapsed.
/*
* Fast JIT powered scaler for ARM
*
* Copyright (C) 2007 Siarhei Siamashka <ssvb@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef ARM_JIT_SWSCALE_H
#define ARM_JIT_SWSCALE_H
#include <stdint.h>
struct SwsContextArmJit;
struct SwsContextArmJit *sws_arm_jit_create_omapfb_yuv422_scaler(int source_w, int source_h, int target_w, int target_h, int quality);
struct SwsContextArmJit *sws_arm_jit_create_omapfb_yuv420_scaler(int source_w, int source_h, int target_w, int target_h, int quality);
struct SwsContextArmJit *sws_arm_jit_create_omapfb_yuv420_scaler_armv6(int source_w, int source_h, int target_w, int target_h, int quality);
int sws_arm_jit_scale(struct SwsContextArmJit *context, uint8_t* src[], int srcStride[], int y, int h, uint8_t* dst[], int dstStride[]);
void sws_arm_jit_free(struct SwsContextArmJit *context);
#endif
/*****************************************************************************
* swscale_maemo.c: scaling and chroma conversion using libswscale_nokia770
*****************************************************************************
* Copyright (C) 1999-2008 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_vout.h>
#include <vlc_filter.h>
#include "libswscale_nokia770/arm_jit_swscale.h"
#include "libswscale_nokia770/arm_colorconv.h"
/****************************************************************************
* Local prototypes
****************************************************************************/
static int OpenScaler( vlc_object_t * );
static void CloseScaler( vlc_object_t * );
static picture_t *Filter( filter_t *, picture_t * );
static int Init( filter_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( N_("Video scaling filter") );
set_capability( "video filter2", 1000 );
set_category( CAT_VIDEO );
set_subcategory( SUBCAT_VIDEO_VFILTER );
set_callbacks( OpenScaler, CloseScaler );
vlc_module_end();
/*****************************************************************************
* filter_sys_t : filter descriptor
*****************************************************************************/
struct filter_sys_t
{
struct SwsContextArmJit *ctx;
es_format_t fmt_in;
es_format_t fmt_out;
};
/*****************************************************************************
* OpenScaler: probe the filter and return score
*****************************************************************************/
static int OpenScaler( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t*)p_this;
filter_sys_t *p_sys;
/* Allocate the memory needed to store the decoder's structure */
if( ( p_filter->p_sys = p_sys =
(filter_sys_t *)malloc(sizeof(filter_sys_t)) ) == NULL )
{
return VLC_ENOMEM;
}
/* Misc init */
p_sys->ctx = NULL;
p_filter->pf_video_filter = Filter;
es_format_Init( &p_sys->fmt_in, 0, 0 );
es_format_Init( &p_sys->fmt_out, 0, 0 );
if( Init( p_filter ) )
{
free( p_sys );
return VLC_EGENERIC;
}
msg_Dbg( p_filter, "%ix%i chroma: %4.4s -> %ix%i chroma: %4.4s",
p_filter->fmt_in.video.i_width, p_filter->fmt_in.video.i_height,
(char *)&p_filter->fmt_in.video.i_chroma,
p_filter->fmt_out.video.i_width, p_filter->fmt_out.video.i_height,
(char *)&p_filter->fmt_out.video.i_chroma );
return VLC_SUCCESS;
}
/*****************************************************************************
* CloseFilter: clean up the filter
*****************************************************************************/
static void CloseScaler( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t*)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
if( p_sys->ctx )
sws_arm_jit_free( p_sys->ctx );
free( p_sys );
}
/*****************************************************************************
* Helpers
*****************************************************************************/
static bool IsFmtSimilar( const video_format_t *p_fmt1, const video_format_t *p_fmt2 )
{
return p_fmt1->i_chroma == p_fmt2->i_chroma &&
p_fmt1->i_width == p_fmt2->i_width &&
p_fmt1->i_height == p_fmt2->i_height;
}
static int Init( filter_t *p_filter )
{
filter_sys_t *p_sys = p_filter->p_sys;
if( IsFmtSimilar( &p_filter->fmt_in.video, &p_sys->fmt_in ) &&
IsFmtSimilar( &p_filter->fmt_out.video, &p_sys->fmt_out ) &&
p_sys->ctx )
{
return VLC_SUCCESS;
}
if( ( p_filter->fmt_in.video.i_chroma != VLC_FOURCC('I','4','2','0') &&
p_filter->fmt_in.video.i_chroma != VLC_FOURCC('I','Y','U','V') &&
p_filter->fmt_in.video.i_chroma != VLC_FOURCC('Y','V','1','2') ) ||
p_filter->fmt_out.video.i_chroma != VLC_FOURCC('Y','4','2','0') )
{
msg_Err( p_filter, "format not supported" );
return VLC_EGENERIC;
}
if( p_sys->ctx )
sws_arm_jit_free( p_sys->ctx );
p_sys->ctx =
sws_arm_jit_create_omapfb_yuv420_scaler_armv6(
p_filter->fmt_in.video.i_width,
p_filter->fmt_in.video.i_height,
p_filter->fmt_out.video.i_width,
p_filter->fmt_out.video.i_height, 2 );
if( !p_sys->ctx )
{
msg_Err( p_filter, "could not init SwScaler" );
return VLC_EGENERIC;
}
p_sys->fmt_in = p_filter->fmt_in;
p_sys->fmt_out = p_filter->fmt_out;
return VLC_SUCCESS;
}
/****************************************************************************
* Filter: the whole thing
****************************************************************************
* This function is called just after the thread is launched.
****************************************************************************/
static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
{
filter_sys_t *p_sys = p_filter->p_sys;
uint8_t *src[3]; int src_stride[3];
uint8_t *dst[3]; int dst_stride[3];
picture_t *p_pic_dst;
int i_plane;
int i_nb_planes = p_pic->i_planes;
/* Check if format properties changed */
if( Init( p_filter ) != VLC_SUCCESS )
return NULL;
/* Request output picture */
p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
if( !p_pic_dst )
{
msg_Warn( p_filter, "can't get output picture" );
return NULL;
}
for( i_plane = 0; i_plane < __MIN(3, p_pic->i_planes); i_plane++ )
{
src[i_plane] = p_pic->p[i_plane].p_pixels;
src_stride[i_plane] = p_pic->p[i_plane].i_pitch;
}
for( i_plane = 0; i_plane < __MIN(3, i_nb_planes); i_plane++ )
{
dst[i_plane] = p_pic_dst->p[i_plane].p_pixels;
dst_stride[i_plane] = p_pic_dst->p[i_plane].i_pitch;
}
sws_arm_jit_scale( p_sys->ctx, src, src_stride, 0,
p_filter->fmt_in.video.i_height, dst, dst_stride);
picture_CopyProperties( p_pic_dst, p_pic );
picture_Release( p_pic );
return p_pic_dst;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment