Commit 5c808483 authored by Jean-Paul Saman's avatar Jean-Paul Saman

davinci: Partially backport 788db410392dea2bd5c390efff8da3246cfd66d1

Needs more cleaning and rewritting.
parent fd963914
......@@ -4,4 +4,6 @@ SOURCES_davinci = \
auddec.c \
viddec.c \
videnc.c \
resizer.c \
reziser.h \
$(NULL)
This diff is collapsed.
#ifndef RESIZER_H
#define RESIZER_H
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/fb.h>
#include <video/davincifb.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <ti/sdo/ce/osal/Memory.h>
#include <inttypes.h>
#include <asm-arm/arch-davinci/davinci_resizer.h>
#include <math.h>
#define NUM_BUFFERS 1 /* XXX: mesure performance with 3 buffers if needed */
#define BPP 16
#define PI 3.1415926535897932384626
typedef struct
{
int i_fd;
struct fb_var_screeninfo var_info;
struct fb_fix_screeninfo fix_info;
uint8_t *p_map;
UInt32 p_physbufs[NUM_BUFFERS];
} davinci_fb_t;
typedef struct
{
int i_fd;
unsigned int i_height;
unsigned int i_width;
uint8_t *p_yuyv;
int offset;
int i_yuyv;
unsigned int i_out_width;
unsigned int i_out_height;
vlc_bool_t b_direct;
} davinci_resizer_t;
void Resize_coeff( decoder_t *, unsigned int *, unsigned int * );
int OpenFB( const char *psz_name );
void get_coeffs( short [32], unsigned int, unsigned int );
void Resize( decoder_t *, vlc_bool_t, davinci_resizer_t *, davinci_fb_t *,
XDM_BufDesc );
int DavinciInit( decoder_t *, davinci_fb_t *, davinci_resizer_t * );
void DavinciClose( davinci_fb_t *, davinci_resizer_t * );
#endif /* RESIZER_H */
This diff is collapsed.
......@@ -5,6 +5,7 @@
* $Id$
*
* Authors: Antoine Cellerier <dionoea at videolan dot org>
* Rafaël Carré <rcarre@m2x.nl>
*
* 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
......@@ -49,6 +50,58 @@ struct encoder_sys_t
/*****************************************************************************
*
*****************************************************************************/
static void picfree( picture_t *p_pic )
{
if( p_pic->i_type == MEMORY_PICTURE )
free( p_pic->p_data_orig );
free( p_pic );
}
static picture_t * NewEncoderBuffer( encoder_t *p_enc, decoder_t *p_dec )
{
p_dec->fmt_out.video.i_chroma = p_dec->fmt_out.i_codec;
picture_t *p_pic = malloc(sizeof(picture_t));
if( !p_pic ) return NULL;
if( !p_enc->p_sys->in.numBufs )
{
vout_AllocatePicture( p_dec, p_pic,
p_dec->fmt_out.video.i_chroma,
p_dec->fmt_out.video.i_width,
p_dec->fmt_out.video.i_height,
p_dec->fmt_out.video.i_aspect );
if( !p_pic->i_planes )
{
free( p_pic );
return NULL;
}
p_pic->i_type = MEMORY_PICTURE;
}
else
{
p_pic->i_planes = 1;
vout_InitPicture( p_dec, p_pic,
p_dec->fmt_out.video.i_chroma,
p_dec->fmt_out.video.i_width,
p_dec->fmt_out.video.i_height,
p_dec->fmt_out.video.i_aspect );
p_pic->p_data = p_enc->p_sys->in.bufs[0];
p_pic->p_data_orig = NULL;
p_pic->p[0].p_pixels = p_pic->p_data;
p_pic->i_type = DIRECT_PICTURE;
}
p_pic->pf_release = picfree;
p_pic->i_status = RESERVED_PICTURE;
p_pic->p_sys = NULL;
return p_pic;
}
int OpenVideoEncoder( vlc_object_t *p_this )
{
encoder_t *p_enc = (encoder_t *)p_this;
......@@ -147,6 +200,7 @@ int OpenVideoEncoder( vlc_object_t *p_this )
/* Initialize random stuff */
p_enc->pf_encode_video = EncodeVideo;
p_enc->pf_enc_buffer_new = NewEncoderBuffer;
free( psz_codec );
return VLC_SUCCESS;
......@@ -257,11 +311,16 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pic )
/* Copy input picture */
assert( p_pic->i_planes == p_sys->in.numBufs );
assert( p_pic->i_planes == 1 );
for( i = 0; i < p_pic->i_planes; i++ )
{
plane_t *p = p_pic->p+i;
memcpy( p_sys->in.bufs[i], p->p_pixels, p->i_pitch * p->i_visible_lines );
if( p_pic->i_type == MEMORY_PICTURE )
{
plane_t *p = p_pic->p+i;
memcpy( p_sys->in.bufs[i], p->p_pixels, p->i_pitch * p->i_visible_lines );
}
/* if it's our direct buffer, we have nothing to do */
}
/* Configure input */
......
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