Commit c37e84c1 authored by Christophe Massiot's avatar Christophe Massiot

* modules/stream_out/transrate: New transrating module, based on GPL

  code from www.metakine.com.
  CAUTION : the code is currently very ugly, with static variables, no
  code convention, etc. I check it in "as is" because it may be useful
  to some people.
  Don't expect a bitrate reduction of more than 30 % with acceptable
  quality.
* modules/demux/mpeg/ts.c: Useful debug message
parent 5cefc073
dnl Autoconf settings for vlc dnl Autoconf settings for vlc
dnl $Id: configure.ac,v 1.105 2003/11/06 16:36:40 nitrox Exp $ dnl $Id: configure.ac,v 1.106 2003/11/07 21:30:52 massiot Exp $
AC_INIT(vlc,0.6.3-cvs) AC_INIT(vlc,0.6.3-cvs)
...@@ -353,7 +353,7 @@ AC_CHECK_LIB(m,cos,[ ...@@ -353,7 +353,7 @@ AC_CHECK_LIB(m,cos,[
AX_ADD_LDFLAGS([adjust distort a52tofloat32],[-lm]) AX_ADD_LDFLAGS([adjust distort a52tofloat32],[-lm])
]) ])
AC_CHECK_LIB(m,pow,[ AC_CHECK_LIB(m,pow,[
AX_ADD_LDFLAGS([ffmpeg stream_out_transcode i420_rgb faad],[-lm]) AX_ADD_LDFLAGS([ffmpeg stream_out_transcode stream_out_transrate i420_rgb faad],[-lm])
]) ])
AC_CHECK_LIB(m,sqrt,[ AC_CHECK_LIB(m,sqrt,[
AX_ADD_LDFLAGS([headphone_channel_mixer],[-lm]) AX_ADD_LDFLAGS([headphone_channel_mixer],[-lm])
...@@ -1064,6 +1064,7 @@ then ...@@ -1064,6 +1064,7 @@ then
AX_ADD_PLUGINS([stream_out_dummy stream_out_standard stream_out_es stream_out_rtp]) AX_ADD_PLUGINS([stream_out_dummy stream_out_standard stream_out_es stream_out_rtp])
AX_ADD_PLUGINS([stream_out_duplicate stream_out_display stream_out_gather]) AX_ADD_PLUGINS([stream_out_duplicate stream_out_display stream_out_gather])
AX_ADD_PLUGINS([stream_out_transrate])
dnl Ogg and vorbis are handled in their respective section dnl Ogg and vorbis are handled in their respective section
fi fi
...@@ -3443,6 +3444,7 @@ AC_OUTPUT([ ...@@ -3443,6 +3444,7 @@ AC_OUTPUT([
modules/mux/mpeg/Makefile modules/mux/mpeg/Makefile
modules/packetizer/Makefile modules/packetizer/Makefile
modules/stream_out/Makefile modules/stream_out/Makefile
modules/stream_out/transrate/Makefile
modules/video_chroma/Makefile modules/video_chroma/Makefile
modules/video_filter/Makefile modules/video_filter/Makefile
modules/video_filter/deinterlace/Makefile modules/video_filter/deinterlace/Makefile
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mpeg_ts.c : Transport Stream input module for vlc * mpeg_ts.c : Transport Stream input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: ts.c,v 1.41 2003/11/06 20:12:37 gbazin Exp $ * $Id: ts.c,v 1.42 2003/11/07 21:30:52 massiot Exp $
* *
* Authors: Henri Fallon <henri@via.ecp.fr> * Authors: Henri Fallon <henri@via.ecp.fr>
* Johan Bilien <jobi@via.ecp.fr> * Johan Bilien <jobi@via.ecp.fr>
...@@ -1356,6 +1356,8 @@ static void TS_DVBPSI_HandlePMT( input_thread_t * p_input, ...@@ -1356,6 +1356,8 @@ static void TS_DVBPSI_HandlePMT( input_thread_t * p_input,
memset( &demux_data, 0, sizeof(es_ts_data_t) ); memset( &demux_data, 0, sizeof(es_ts_data_t) );
*psz_desc = 0; *psz_desc = 0;
msg_Dbg( p_input, "new PID 0x%x stream type 0x%x",
p_es->i_pid, p_es->i_type );
switch( p_es->i_type ) switch( p_es->i_type )
{ {
......
SOURCES_stream_out_transrate = transrate.c
This diff is collapsed.
// put blk
/* type definitions for variable length code table entries */
typedef struct
{
unsigned char code; /* right justified */
char len;
} VLCtable;
/* for codes longer than 8 bits (excluding leading zeroes) */
typedef struct
{
unsigned short code; /* right justified */
char len;
} sVLCtable;
/* Table B-2, B-3, B-4 variable length codes for macroblock_type
*
* indexed by [macroblock_type]
*/
const static VLCtable mbtypetab[3][32]=
{
/* I */
{
{0,0}, {1,1}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
{0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
{0,0}, {1,2}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
{0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}
},
/* P */
{
{0,0}, {3,5}, {1,2}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
{1,3}, {0,0}, {1,1}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
{0,0}, {1,6}, {1,5}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
{0,0}, {0,0}, {2,5}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}
},
/* B */
{
{0,0}, {3,5}, {0,0}, {0,0}, {2,3}, {0,0}, {3,3}, {0,0},
{2,4}, {0,0}, {3,4}, {0,0}, {2,2}, {0,0}, {3,2}, {0,0},
{0,0}, {1,6}, {0,0}, {0,0}, {0,0}, {0,0}, {2,6}, {0,0},
{0,0}, {0,0}, {3,6}, {0,0}, {0,0}, {0,0}, {2,5}, {0,0}
}
};
/* Table B-5 ... B-8 variable length codes for macroblock_type in
* scalable sequences
*
* not implemented
*/
/* Table B-9, variable length codes for coded_block_pattern
*
* indexed by [coded_block_pattern]
*/
const static VLCtable cbptable[64]=
{
{0x01,9}, {0x0b,5}, {0x09,5}, {0x0d,6},
{0x0d,4}, {0x17,7}, {0x13,7}, {0x1f,8},
{0x0c,4}, {0x16,7}, {0x12,7}, {0x1e,8},
{0x13,5}, {0x1b,8}, {0x17,8}, {0x13,8},
{0x0b,4}, {0x15,7}, {0x11,7}, {0x1d,8},
{0x11,5}, {0x19,8}, {0x15,8}, {0x11,8},
{0x0f,6}, {0x0f,8}, {0x0d,8}, {0x03,9},
{0x0f,5}, {0x0b,8}, {0x07,8}, {0x07,9},
{0x0a,4}, {0x14,7}, {0x10,7}, {0x1c,8},
{0x0e,6}, {0x0e,8}, {0x0c,8}, {0x02,9},
{0x10,5}, {0x18,8}, {0x14,8}, {0x10,8},
{0x0e,5}, {0x0a,8}, {0x06,8}, {0x06,9},
{0x12,5}, {0x1a,8}, {0x16,8}, {0x12,8},
{0x0d,5}, {0x09,8}, {0x05,8}, {0x05,9},
{0x0c,5}, {0x08,8}, {0x04,8}, {0x04,9},
{0x07,3}, {0x0a,5}, {0x08,5}, {0x0c,6}
};
/* Table B-14, DCT coefficients table zero
*
* indexed by [run][level-1]
* split into two tables (dct_code_tab1, dct_code_tab2) to reduce size
* 'first DCT coefficient' condition and 'End of Block' are treated elsewhere
* codes do not include s (sign bit)
*/
const static VLCtable dct_code_tab1[2][40]=
{
/* run = 0, level = 1...40 */
{
{0x03, 2}, {0x04, 4}, {0x05, 5}, {0x06, 7},
{0x26, 8}, {0x21, 8}, {0x0a,10}, {0x1d,12},
{0x18,12}, {0x13,12}, {0x10,12}, {0x1a,13},
{0x19,13}, {0x18,13}, {0x17,13}, {0x1f,14},
{0x1e,14}, {0x1d,14}, {0x1c,14}, {0x1b,14},
{0x1a,14}, {0x19,14}, {0x18,14}, {0x17,14},
{0x16,14}, {0x15,14}, {0x14,14}, {0x13,14},
{0x12,14}, {0x11,14}, {0x10,14}, {0x18,15},
{0x17,15}, {0x16,15}, {0x15,15}, {0x14,15},
{0x13,15}, {0x12,15}, {0x11,15}, {0x10,15}
},
/* run = 1, level = 1...18 */
{
{0x03, 3}, {0x06, 6}, {0x25, 8}, {0x0c,10},
{0x1b,12}, {0x16,13}, {0x15,13}, {0x1f,15},
{0x1e,15}, {0x1d,15}, {0x1c,15}, {0x1b,15},
{0x1a,15}, {0x19,15}, {0x13,16}, {0x12,16},
{0x11,16}, {0x10,16}, {0x00, 0}, {0x00, 0},
{0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
{0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
{0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
{0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
{0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}
}
};
const static VLCtable dct_code_tab2[30][5]=
{
/* run = 2...31, level = 1...5 */
{{0x05, 4}, {0x04, 7}, {0x0b,10}, {0x14,12}, {0x14,13}},
{{0x07, 5}, {0x24, 8}, {0x1c,12}, {0x13,13}, {0x00, 0}},
{{0x06, 5}, {0x0f,10}, {0x12,12}, {0x00, 0}, {0x00, 0}},
{{0x07, 6}, {0x09,10}, {0x12,13}, {0x00, 0}, {0x00, 0}},
{{0x05, 6}, {0x1e,12}, {0x14,16}, {0x00, 0}, {0x00, 0}},
{{0x04, 6}, {0x15,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x07, 7}, {0x11,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x05, 7}, {0x11,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x27, 8}, {0x10,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x23, 8}, {0x1a,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x22, 8}, {0x19,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x20, 8}, {0x18,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x0e,10}, {0x17,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x0d,10}, {0x16,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x08,10}, {0x15,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1f,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1a,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x19,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x17,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x16,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1f,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1e,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1d,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1c,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1b,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1f,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1e,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1d,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1c,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1b,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}}
};
/* Table B-15, DCT coefficients table one
*
* indexed by [run][level-1]
* split into two tables (dct_code_tab1a, dct_code_tab2a) to reduce size
* 'End of Block' is treated elsewhere
* codes do not include s (sign bit)
*/
const static VLCtable dct_code_tab1a[2][40]=
{
/* run = 0, level = 1...40 */
{
{0x02, 2}, {0x06, 3}, {0x07, 4}, {0x1c, 5},
{0x1d, 5}, {0x05, 6}, {0x04, 6}, {0x7b, 7},
{0x7c, 7}, {0x23, 8}, {0x22, 8}, {0xfa, 8},
{0xfb, 8}, {0xfe, 8}, {0xff, 8}, {0x1f,14},
{0x1e,14}, {0x1d,14}, {0x1c,14}, {0x1b,14},
{0x1a,14}, {0x19,14}, {0x18,14}, {0x17,14},
{0x16,14}, {0x15,14}, {0x14,14}, {0x13,14},
{0x12,14}, {0x11,14}, {0x10,14}, {0x18,15},
{0x17,15}, {0x16,15}, {0x15,15}, {0x14,15},
{0x13,15}, {0x12,15}, {0x11,15}, {0x10,15}
},
/* run = 1, level = 1...18 */
{
{0x02, 3}, {0x06, 5}, {0x79, 7}, {0x27, 8},
{0x20, 8}, {0x16,13}, {0x15,13}, {0x1f,15},
{0x1e,15}, {0x1d,15}, {0x1c,15}, {0x1b,15},
{0x1a,15}, {0x19,15}, {0x13,16}, {0x12,16},
{0x11,16}, {0x10,16}, {0x00, 0}, {0x00, 0},
{0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
{0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
{0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
{0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
{0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}
}
};
const static VLCtable dct_code_tab2a[30][5]=
{
/* run = 2...31, level = 1...5 */
{{0x05, 5}, {0x07, 7}, {0xfc, 8}, {0x0c,10}, {0x14,13}},
{{0x07, 5}, {0x26, 8}, {0x1c,12}, {0x13,13}, {0x00, 0}},
{{0x06, 6}, {0xfd, 8}, {0x12,12}, {0x00, 0}, {0x00, 0}},
{{0x07, 6}, {0x04, 9}, {0x12,13}, {0x00, 0}, {0x00, 0}},
{{0x06, 7}, {0x1e,12}, {0x14,16}, {0x00, 0}, {0x00, 0}},
{{0x04, 7}, {0x15,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x05, 7}, {0x11,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x78, 7}, {0x11,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x7a, 7}, {0x10,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x21, 8}, {0x1a,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x25, 8}, {0x19,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x24, 8}, {0x18,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x05, 9}, {0x17,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x07, 9}, {0x16,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x0d,10}, {0x15,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1f,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1a,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x19,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x17,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x16,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1f,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1e,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1d,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1c,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1b,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1f,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1e,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1d,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1c,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
{{0x1b,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}}
};
This diff is collapsed.
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