[vlc-devel] [PATCH 05/24] [codec/dirac] invent extra pts & dts values when field_coding
davidf+nntp at woaf.net
davidf+nntp at woaf.net
Thu Oct 30 12:29:34 CET 2008
From: David Flynn <davidf at rd.bbc.co.uk>
When field coding, there is one dirac picture per field:
-> picture_number increases by two per frame
-> PTS and DTS at input to module is only per frame
So, invent pts & dts for the second field, store in TLB/queue
Signed-off-by: David Flynn <davidf at rd.bbc.co.uk>
---
modules/codec/dirac.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/modules/codec/dirac.c b/modules/codec/dirac.c
index e0895ac..7885adb 100644
--- a/modules/codec/dirac.c
+++ b/modules/codec/dirac.c
@@ -310,7 +310,7 @@ struct picture_pts_t
* encoder_sys_t : dirac encoder descriptor
*****************************************************************************/
#define ENC_BUFSIZE 1024*1024*10
-#define PTS_TLB_SIZE 16
+#define PTS_TLB_SIZE 32
struct encoder_sys_t
{
dirac_encoder_t *p_dirac;
@@ -327,6 +327,7 @@ struct encoder_sys_t
struct picture_pts_t pts_tlb[PTS_TLB_SIZE];
mtime_t i_pts_offset;
+ mtime_t i_field_time;
};
static struct {
@@ -637,7 +638,6 @@ static int ReadDiracPictureNumber( uint32_t *p_picnum, block_t *p_block )
return 0;
}
-
/****************************************************************************
* Encode: the whole thing
****************************************************************************
@@ -671,6 +671,12 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
date_Increment( &m_date, 1 );
#endif
p_sys->i_pts_offset = date_Get( &m_date );
+
+ if( 1 == p_sys->ctx.enc_params.picture_coding_mode ) {
+ date_Set( &m_date, 0 );
+ date_Increment( &m_date, 1 );
+ p_sys->i_field_time = date_Get( &m_date ) / 2;
+ }
}
/* Copy input picture into encoder input buffer (stride by stride) */
@@ -711,6 +717,16 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
block_FifoPut( p_sys->p_dts_fifo, p_block );
p_block = NULL;
+ if( 1 == p_sys->ctx.enc_params.picture_coding_mode ) {
+ StorePicturePTS( p_enc, p_sys->i_input_picnum, p_pic->date + p_sys->i_field_time );
+ p_sys->i_input_picnum++;
+
+ p_block = block_New( p_enc, 1 );
+ p_block->i_dts = p_pic->date - p_sys->i_pts_offset + p_sys->i_field_time;
+ block_FifoPut( p_sys->p_dts_fifo, p_block );
+ p_block = NULL;
+ }
+
dirac_encoder_state_t state;
/* Retrieve encoded frames from encoder */
do
--
1.5.6.5
More information about the vlc-devel
mailing list