From 25eaef07fa6cbdbd99f4a9b418933a37e66e74ae Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sat, 2 Dec 2006 21:06:18 +0000 Subject: wmv9 is already provided by ffmpeg-wmv9 with lower priority the decoder is still buggy so it must be used only if w32codec is not present CVS patchset: 8399 CVS date: 2006/12/02 21:06:18 --- src/libffmpeg/video_decoder.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/libffmpeg/video_decoder.c b/src/libffmpeg/video_decoder.c index 8f6f70ab9..ad2bc99b4 100644 --- a/src/libffmpeg/video_decoder.c +++ b/src/libffmpeg/video_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_decoder.c,v 1.63 2006/09/18 18:56:56 tmattern Exp $ + * $Id: video_decoder.c,v 1.64 2006/12/02 21:06:18 miguelfreitas Exp $ * * xine video decoder plugin using ffmpeg * @@ -1541,7 +1541,6 @@ static uint32_t supported_video_types[] = { BUF_VIDEO_XL, BUF_VIDEO_RT21, BUF_VIDEO_FPS1, - BUF_VIDEO_WMV9, BUF_VIDEO_CSCD, BUF_VIDEO_ALGMM, BUF_VIDEO_ZMBV, -- cgit v1.2.3 From 81fbe8ca719feb4e02b826bee0a779401a785e3f Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sat, 2 Dec 2006 22:35:18 +0000 Subject: two fixes to viz glue code: - avoid overrunning the provided input audio buffer. - generate a bad frame if time is due but we don't have enough data for updating the viz plugin. this could happen in some rare situations but the result was pretty catastrophic: xine froze with 100% cpu usage. CVS patchset: 8400 CVS date: 2006/12/02 22:35:18 --- src/post/goom/xine_goom.c | 30 +++++++++++++++++++----------- src/post/visualizations/fftgraph.c | 22 +++++++++++++++------- src/post/visualizations/fftscope.c | 22 +++++++++++++++------- src/post/visualizations/fooviz.c | 22 +++++++++++++++------- src/post/visualizations/oscope.c | 22 +++++++++++++++------- 5 files changed, 79 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/post/goom/xine_goom.c b/src/post/goom/xine_goom.c index f879f1ebc..e4f55068b 100644 --- a/src/post/goom/xine_goom.c +++ b/src/post/goom/xine_goom.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_goom.c,v 1.63 2006/10/23 21:13:44 hadess Exp $ + * $Id: xine_goom.c,v 1.64 2006/12/02 22:35:18 miguelfreitas Exp $ * * GOOM post plugin. * @@ -43,7 +43,7 @@ #include "goom.h" -#define NUMSAMPLES 512 +#define NUMSAMPLES 512 /* hardcoded into goom api */ #define FPS 14 #define GOOM_WIDTH 320 @@ -83,7 +83,7 @@ struct post_plugin_goom_s { PluginInfo *goom; int data_idx; - gint16 data [2][512]; + gint16 data [2][NUMSAMPLES]; audio_buffer_t buf; /* dummy buffer just to hold a copy of audio data */ int channels; @@ -386,6 +386,7 @@ static int goom_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, this->sample_rate = rate; this->samples_per_frame = rate / this->fps; this->data_idx = 0; + this->sample_counter = 0; init_yuv_planes(&this->yuv, this->width, this->height); this->skip_frame = 0; @@ -445,7 +446,6 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen, buf = &this->buf; this->sample_counter += buf->num_frames; - j = (this->channels >= 2) ? 1 : 0; do { @@ -455,7 +455,7 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen, data8 += samples_used * this->channels; /* scale 8 bit data to 16 bits and convert to signed as well */ - for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES; + for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES; i++, this->data_idx++, data8 += this->channels ) { this->data[0][this->data_idx] = ((int16_t)data8[0] << 8) - 0x8000; this->data[1][this->data_idx] = ((int16_t)data8[j] << 8) - 0x8000; @@ -464,16 +464,15 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen, data = buf->mem; data += samples_used * this->channels; - for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES; + for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES; i++, this->data_idx++, data += this->channels ) { this->data[0][this->data_idx] = data[0]; this->data[1][this->data_idx] = data[j]; } } - if( this->sample_counter >= this->samples_per_frame && - this->data_idx == NUMSAMPLES ) { - this->data_idx = 0; + if( this->sample_counter >= this->samples_per_frame ) { + samples_used += this->samples_per_frame; frame = this->vo_port->get_frame (this->vo_port, this->width_back, this->height_back, @@ -481,14 +480,23 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen, VO_BOTH_FIELDS); frame->extra_info->invalid = 1; - frame->bad_frame = 0; + + /* frame is marked as bad if we don't have enough samples for + * updating the viz plugin (calculations may be skipped). + * we must keep the framerate though. */ + if( this->data_idx == NUMSAMPLES ) { + frame->bad_frame = 0; + this->data_idx = 0; + } else { + frame->bad_frame = 1; + } frame->duration = 90000 * this->samples_per_frame / this->sample_rate; frame->pts = pts; this->metronom->got_video_frame(this->metronom, frame); this->sample_counter -= this->samples_per_frame; - if (!this->skip_frame) { + if (!this->skip_frame && !frame->bad_frame) { /* Try to be fast */ goom_frame = (uint8_t *)goom_update (this->goom, this->data, 0, 0, NULL, NULL); diff --git a/src/post/visualizations/fftgraph.c b/src/post/visualizations/fftgraph.c index f9f8f0d4a..669a4bc94 100644 --- a/src/post/visualizations/fftgraph.c +++ b/src/post/visualizations/fftgraph.c @@ -20,7 +20,7 @@ * FftGraph Visualization Post Plugin For xine * by Thibaut Mattern (tmattern@noos.fr) * - * $Id: fftgraph.c,v 1.14 2006/01/27 07:46:14 tmattern Exp $ + * $Id: fftgraph.c,v 1.15 2006/12/02 22:35:18 miguelfreitas Exp $ * */ @@ -230,6 +230,7 @@ static int fftgraph_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream this->lines_per_channel = FFTGRAPH_HEIGHT / this->channels; this->samples_per_frame = rate / FPS; this->data_idx = 0; + this->sample_counter = 0; this->vo_port->open(this->vo_port, XINE_ANON_STREAM); this->metronom->set_master(this->metronom, stream->metronom); @@ -342,7 +343,7 @@ static void fftgraph_port_put_buffer (xine_audio_port_t *port_gen, data8 += samples_used * this->channels; /* scale 8 bit data to 16 bits and convert to signed as well */ - for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES; + for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES; i++, this->data_idx++, data8 += this->channels ) { for( c = 0; c < this->channels; c++){ this->wave[c][this->data_idx].re = (double)(data8[c] << 8) - 0x8000; @@ -353,7 +354,7 @@ static void fftgraph_port_put_buffer (xine_audio_port_t *port_gen, data = buf->mem; data += samples_used * this->channels; - for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES; + for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES; i++, this->data_idx++, data += this->channels ) { for( c = 0; c < this->channels; c++){ this->wave[c][this->data_idx].re = (double)data[c]; @@ -362,17 +363,24 @@ static void fftgraph_port_put_buffer (xine_audio_port_t *port_gen, } } - if( this->sample_counter >= this->samples_per_frame && - this->data_idx == NUMSAMPLES ) { + if( this->sample_counter >= this->samples_per_frame ) { - this->data_idx = 0; samples_used += this->samples_per_frame; frame = this->vo_port->get_frame (this->vo_port, FFTGRAPH_WIDTH, FFTGRAPH_HEIGHT, this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); frame->extra_info->invalid = 1; - frame->bad_frame = 0; + + /* frame is marked as bad if we don't have enough samples for + * updating the viz plugin (calculations may be skipped). + * we must keep the framerate though. */ + if( this->data_idx == NUMSAMPLES ) { + frame->bad_frame = 0; + this->data_idx = 0; + } else { + frame->bad_frame = 1; + } frame->duration = 90000 * this->samples_per_frame / port->rate; frame->pts = pts; this->metronom->got_video_frame(this->metronom, frame); diff --git a/src/post/visualizations/fftscope.c b/src/post/visualizations/fftscope.c index 8448f3a65..aef517c59 100644 --- a/src/post/visualizations/fftscope.c +++ b/src/post/visualizations/fftscope.c @@ -22,7 +22,7 @@ * * FFT code by Steve Haehnichen, originally licensed under GPL v1 * - * $Id: fftscope.c,v 1.29 2006/01/27 07:46:14 tmattern Exp $ + * $Id: fftscope.c,v 1.30 2006/12/02 22:35:18 miguelfreitas Exp $ * */ @@ -289,6 +289,7 @@ static int fftscope_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream this->channels = MAXCHANNELS; this->samples_per_frame = rate / FPS; this->data_idx = 0; + this->sample_counter = 0; this->fft = fft_new(FFT_BITS); this->vo_port->open(this->vo_port, XINE_ANON_STREAM); @@ -363,7 +364,7 @@ static void fftscope_port_put_buffer (xine_audio_port_t *port_gen, data8 += samples_used * this->channels; /* scale 8 bit data to 16 bits and convert to signed as well */ - for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES; + for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES; i++, this->data_idx++, data8 += this->channels ) { for( c = 0; c < this->channels; c++){ this->wave[c][this->data_idx].re = (double)(data8[c] << 8) - 0x8000; @@ -374,7 +375,7 @@ static void fftscope_port_put_buffer (xine_audio_port_t *port_gen, data = buf->mem; data += samples_used * this->channels; - for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES; + for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES; i++, this->data_idx++, data += this->channels ) { for( c = 0; c < this->channels; c++){ this->wave[c][this->data_idx].re = (double)data[c]; @@ -383,17 +384,24 @@ static void fftscope_port_put_buffer (xine_audio_port_t *port_gen, } } - if( this->sample_counter >= this->samples_per_frame && - this->data_idx == NUMSAMPLES ) { + if( this->sample_counter >= this->samples_per_frame ) { - this->data_idx = 0; samples_used += this->samples_per_frame; frame = this->vo_port->get_frame (this->vo_port, FFT_WIDTH, FFT_HEIGHT, this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); frame->extra_info->invalid = 1; - frame->bad_frame = 0; + + /* frame is marked as bad if we don't have enough samples for + * updating the viz plugin (calculations may be skipped). + * we must keep the framerate though. */ + if( this->data_idx == NUMSAMPLES ) { + frame->bad_frame = 0; + this->data_idx = 0; + } else { + frame->bad_frame = 1; + } frame->duration = 90000 * this->samples_per_frame / port->rate; frame->pts = pts; this->metronom->got_video_frame(this->metronom, frame); diff --git a/src/post/visualizations/fooviz.c b/src/post/visualizations/fooviz.c index 8d1e84150..9e69fefab 100644 --- a/src/post/visualizations/fooviz.c +++ b/src/post/visualizations/fooviz.c @@ -23,7 +23,7 @@ * process. It simply paints the screen a solid color and rotates through * colors on each iteration. * - * $Id: fooviz.c,v 1.27 2006/07/10 22:08:44 dgp85 Exp $ + * $Id: fooviz.c,v 1.28 2006/12/02 22:35:18 miguelfreitas Exp $ * */ @@ -118,6 +118,7 @@ static int fooviz_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, this->channels = _x_ao_mode2channels(mode); this->samples_per_frame = rate / FPS; this->data_idx = 0; + this->sample_counter = 0; this->vo_port->open(this->vo_port, XINE_ANON_STREAM); this->metronom->set_master(this->metronom, stream->metronom); @@ -180,7 +181,7 @@ static void fooviz_port_put_buffer (xine_audio_port_t *port_gen, data8 += samples_used * this->channels; /* scale 8 bit data to 16 bits and convert to signed as well */ - for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES; + for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES; i++, this->data_idx++, data8 += this->channels ) { this->data[0][this->data_idx] = ((int16_t)data8[0] << 8) - 0x8000; this->data[1][this->data_idx] = ((int16_t)data8[j] << 8) - 0x8000; @@ -189,24 +190,31 @@ static void fooviz_port_put_buffer (xine_audio_port_t *port_gen, data = buf->mem; data += samples_used * this->channels; - for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES; + for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES; i++, this->data_idx++, data += this->channels ) { this->data[0][this->data_idx] = data[0]; this->data[1][this->data_idx] = data[j]; } } - if( this->sample_counter >= this->samples_per_frame && - this->data_idx == NUMSAMPLES ) { + if( this->sample_counter >= this->samples_per_frame ) { - this->data_idx = 0; samples_used += this->samples_per_frame; frame = this->vo_port->get_frame (this->vo_port, FOO_WIDTH, FOO_HEIGHT, this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); frame->extra_info->invalid = 1; - frame->bad_frame = 0; + + /* frame is marked as bad if we don't have enough samples for + * updating the viz plugin (calculations may be skipped). + * we must keep the framerate though. */ + if( this->data_idx == NUMSAMPLES ) { + frame->bad_frame = 0; + this->data_idx = 0; + } else { + frame->bad_frame = 1; + } frame->duration = 90000 * this->samples_per_frame / port->rate; frame->pts = pts; this->metronom->got_video_frame(this->metronom, frame); diff --git a/src/post/visualizations/oscope.c b/src/post/visualizations/oscope.c index 68ae0e054..483fc39ab 100644 --- a/src/post/visualizations/oscope.c +++ b/src/post/visualizations/oscope.c @@ -20,7 +20,7 @@ * Basic Oscilloscope Visualization Post Plugin For xine * by Mike Melanson (melanson@pcisys.net) * - * $Id: oscope.c,v 1.20 2006/01/27 07:46:14 tmattern Exp $ + * $Id: oscope.c,v 1.21 2006/12/02 22:35:18 miguelfreitas Exp $ * */ @@ -191,6 +191,7 @@ static int oscope_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, this->channels = MAXCHANNELS; this->samples_per_frame = rate / FPS; this->data_idx = 0; + this->sample_counter = 0; init_yuv_planes(&this->yuv, OSCOPE_WIDTH, OSCOPE_HEIGHT); this->vo_port->open(this->vo_port, XINE_ANON_STREAM); @@ -252,7 +253,7 @@ static void oscope_port_put_buffer (xine_audio_port_t *port_gen, data8 += samples_used * this->channels; /* scale 8 bit data to 16 bits and convert to signed as well */ - for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES; + for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES; i++, this->data_idx++, data8 += this->channels ) for( c = 0; c < this->channels; c++) this->data[c][this->data_idx] = ((int16_t)data8[c] << 8) - 0x8000; @@ -260,23 +261,30 @@ static void oscope_port_put_buffer (xine_audio_port_t *port_gen, data = buf->mem; data += samples_used * this->channels; - for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES; + for( i = samples_used; i < buf->num_frames && this->data_idx < NUMSAMPLES; i++, this->data_idx++, data += this->channels ) for( c = 0; c < this->channels; c++) this->data[c][this->data_idx] = data[c]; } - if( this->sample_counter >= this->samples_per_frame && - this->data_idx == NUMSAMPLES ) { + if( this->sample_counter >= this->samples_per_frame ) { - this->data_idx = 0; samples_used += this->samples_per_frame; frame = this->vo_port->get_frame (this->vo_port, OSCOPE_WIDTH, OSCOPE_HEIGHT, this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); frame->extra_info->invalid = 1; - frame->bad_frame = 0; + + /* frame is marked as bad if we don't have enough samples for + * updating the viz plugin (calculations may be skipped). + * we must keep the framerate though. */ + if( this->data_idx == NUMSAMPLES ) { + frame->bad_frame = 0; + this->data_idx = 0; + } else { + frame->bad_frame = 1; + } frame->duration = 90000 * this->samples_per_frame / port->rate; frame->pts = pts; this->metronom->got_video_frame(this->metronom, frame); -- cgit v1.2.3 From 6876730b6da8f78a34c18306a0234c77b681641b Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sun, 3 Dec 2006 19:23:16 +0000 Subject: should fix bug reported by Christophe Thommeret where avi+subtitles (actually master/slave streams) could cause demux to get into an endless loop. CVS patchset: 8401 CVS date: 2006/12/03 19:23:16 --- src/xine-engine/demux.c | 4 ++-- src/xine-engine/video_decoder.c | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index c6a234ae5..2178ccb71 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -20,7 +20,7 @@ * Demuxer helper functions * hide some xine engine details from demuxers and reduce code duplication * - * $Id: demux.c,v 1.64 2006/08/13 23:51:34 miguelfreitas Exp $ + * $Id: demux.c,v 1.65 2006/12/03 19:23:16 miguelfreitas Exp $ */ @@ -336,7 +336,7 @@ static void *demux_loop (void *stream_gen) { finished_count_video = stream->finished_count_video + 1; pthread_mutex_unlock (&stream->counter_lock); - /* demux_thread_running is zero if demux loop has being stopped by user */ + /* demux_thread_running is zero if demux loop has been stopped by user */ non_user = stream->demux_thread_running; stream->demux_thread_running = 0; diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index 16ebb61b2..8f6b82faa 100644 --- a/src/xine-engine/video_decoder.c +++ b/src/xine-engine/video_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_decoder.c,v 1.161 2006/09/08 21:11:29 miguelfreitas Exp $ + * $Id: video_decoder.c,v 1.162 2006/12/03 19:23:16 miguelfreitas Exp $ * */ @@ -193,8 +193,13 @@ static void *video_decoder_loop (void *stream_gen) { /* * wait the output fifos to run dry before sending the notification event - * to the frontend. this test is only valid if there is only a single - * stream attached to the current output port. + * to the frontend. exceptions: + * 1) don't wait if there is more than one stream attached to the current + * output port (the other stream might be sending data so we would be + * here forever) + * 2) early_finish_event: send notification asap to allow gapless switch + * 3) slave stream: don't wait. get into an unblocked state asap to allow + * new master actions. */ while(1) { int num_bufs, num_streams; @@ -204,7 +209,8 @@ static void *video_decoder_loop (void *stream_gen) { num_streams = stream->video_out->get_property(stream->video_out, VO_PROP_NUM_STREAMS); running_ticket->release(running_ticket, 0); - if( num_bufs > 0 && num_streams == 1 && !stream->early_finish_event ) + if( num_bufs > 0 && num_streams == 1 && !stream->early_finish_event && + stream->master == stream ) xine_usec_sleep (10000); else break; -- cgit v1.2.3 From 787a4ce45f794abb7c8864b337d37e04b0a5b2b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 4 Dec 2006 13:59:38 +0000 Subject: Add a little more debug in case a vorbis stream cannot be decoded, just to know what to look for. CVS patchset: 8403 CVS date: 2006/12/04 13:59:38 --- src/libvorbis/xine_decoder.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/libvorbis/xine_decoder.c b/src/libvorbis/xine_decoder.c index 12d0a83f2..ef8575949 100644 --- a/src/libvorbis/xine_decoder.c +++ b/src/libvorbis/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.47 2006/07/10 22:08:30 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.48 2006/12/04 13:59:38 dgp85 Exp $ * * (ogg/)vorbis audio decoder plugin (libvorbis wrapper) for xine */ @@ -148,13 +148,16 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { lprintf ("%d headers to go\n", this->header_count); if (this->header_count) { + int res = 0; if (this->header_count == 3) this->op.b_o_s = 1; - if(vorbis_synthesis_headerin(&this->vi,&this->vc,&this->op)<0){ + + if( (res = vorbis_synthesis_headerin(&this->vi,&this->vc,&this->op)) < 0 ){ /* error case; not a vorbis header */ - printf("libvorbis: this bitstream does not contain vorbis audio data.\n"); + xine_log(this->stream->xine, XINE_LOG_MSG, "libvorbis: this bitstream does not contain vorbis audio data. Following first 64 bytes (return: %d).\n", res); + xine_hexdump(this->op.packet, this->op.bytes < 64 ? this->op.bytes : 64); return; } -- cgit v1.2.3 From e6d1a700e06ba8a985c29ba212b359c9e33bcc55 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Mon, 4 Dec 2006 22:25:13 +0000 Subject: trying an updated ffmpeg version (51.25.0) CVS patchset: 8405 CVS date: 2006/12/04 22:25:13 --- src/libffmpeg/diff_to_ffmpeg_cvs.txt | 234 +- src/libffmpeg/dvaudio_decoder.c | 18 +- src/libffmpeg/libavcodec/4xm.c | 14 +- src/libffmpeg/libavcodec/8bps.c | 12 +- src/libffmpeg/libavcodec/Makefile.am | 8 +- src/libffmpeg/libavcodec/aasc.c | 10 +- src/libffmpeg/libavcodec/adpcm.c | 10 +- src/libffmpeg/libavcodec/adx.c | 10 +- src/libffmpeg/libavcodec/alac.c | 16 +- src/libffmpeg/libavcodec/alpha/asm.h | 10 +- src/libffmpeg/libavcodec/alpha/dsputil_alpha.c | 10 +- src/libffmpeg/libavcodec/alpha/dsputil_alpha_asm.S | 10 +- src/libffmpeg/libavcodec/alpha/motion_est_alpha.c | 10 +- .../libavcodec/alpha/motion_est_mvi_asm.S | 10 +- src/libffmpeg/libavcodec/alpha/mpegvideo_alpha.c | 10 +- src/libffmpeg/libavcodec/alpha/regdef.h | 21 + src/libffmpeg/libavcodec/alpha/simple_idct_alpha.c | 10 +- src/libffmpeg/libavcodec/armv4l/dsputil_arm.c | 52 +- src/libffmpeg/libavcodec/armv4l/mpegvideo_arm.c | 10 +- src/libffmpeg/libavcodec/armv4l/simple_idct_arm.S | 20 +- src/libffmpeg/libavcodec/asv1.c | 16 +- src/libffmpeg/libavcodec/avcodec.h | 87 +- src/libffmpeg/libavcodec/avs.c | 10 +- src/libffmpeg/libavcodec/bitstream.c | 51 +- src/libffmpeg/libavcodec/bitstream.h | 161 +- src/libffmpeg/libavcodec/bytestream.h | 89 + src/libffmpeg/libavcodec/cabac.c | 91 +- src/libffmpeg/libavcodec/cabac.h | 560 ++++- src/libffmpeg/libavcodec/cavs.c | 140 +- src/libffmpeg/libavcodec/cavsdata.h | 12 +- src/libffmpeg/libavcodec/cinepak.c | 10 +- src/libffmpeg/libavcodec/cljr.c | 10 +- src/libffmpeg/libavcodec/cook.c | 11 +- src/libffmpeg/libavcodec/cookdata.h | 10 +- src/libffmpeg/libavcodec/cscd.c | 10 +- src/libffmpeg/libavcodec/cyuv.c | 16 +- src/libffmpeg/libavcodec/dpcm.c | 10 +- src/libffmpeg/libavcodec/dsputil.c | 284 +-- src/libffmpeg/libavcodec/dsputil.h | 134 +- src/libffmpeg/libavcodec/dv.c | 162 +- src/libffmpeg/libavcodec/dvdata.h | 67 +- src/libffmpeg/libavcodec/error_resilience.c | 30 +- src/libffmpeg/libavcodec/eval.c | 376 +++- src/libffmpeg/libavcodec/eval.h | 84 + src/libffmpeg/libavcodec/faandct.c | 10 +- src/libffmpeg/libavcodec/faandct.h | 10 +- src/libffmpeg/libavcodec/fft.c | 64 +- src/libffmpeg/libavcodec/ffv1.c | 21 +- src/libffmpeg/libavcodec/flac.c | 114 +- src/libffmpeg/libavcodec/flashsv.c | 10 +- src/libffmpeg/libavcodec/flicvideo.c | 52 +- src/libffmpeg/libavcodec/fraps.c | 206 +- src/libffmpeg/libavcodec/g726.c | 161 +- src/libffmpeg/libavcodec/golomb.c | 10 +- src/libffmpeg/libavcodec/golomb.h | 14 +- src/libffmpeg/libavcodec/h261.c | 29 +- src/libffmpeg/libavcodec/h261data.h | 39 +- src/libffmpeg/libavcodec/h263.c | 65 +- src/libffmpeg/libavcodec/h263data.h | 31 +- src/libffmpeg/libavcodec/h263dec.c | 37 +- src/libffmpeg/libavcodec/h264.c | 471 ++-- src/libffmpeg/libavcodec/h264data.h | 56 +- src/libffmpeg/libavcodec/h264idct.c | 18 +- src/libffmpeg/libavcodec/huffyuv.c | 28 +- src/libffmpeg/libavcodec/i386/Makefile.am | 2 + src/libffmpeg/libavcodec/i386/cputest.c | 25 +- .../libavcodec/i386/dsputil_h264_template_mmx.c | 10 +- src/libffmpeg/libavcodec/i386/dsputil_mmx.c | 432 +++- src/libffmpeg/libavcodec/i386/dsputil_mmx_avg.h | 60 +- src/libffmpeg/libavcodec/i386/dsputil_mmx_rnd.h | 26 +- src/libffmpeg/libavcodec/i386/fdct_mmx.c | 158 +- src/libffmpeg/libavcodec/i386/fft_3dn.c | 125 ++ src/libffmpeg/libavcodec/i386/fft_3dn2.c | 210 ++ src/libffmpeg/libavcodec/i386/fft_sse.c | 289 ++- src/libffmpeg/libavcodec/i386/h264dsp_mmx.c | 230 +- src/libffmpeg/libavcodec/i386/idct_mmx.c | 3 - src/libffmpeg/libavcodec/i386/idct_mmx_xvid.c | 37 +- src/libffmpeg/libavcodec/i386/mmx.h | 22 +- src/libffmpeg/libavcodec/i386/motion_est_mmx.c | 22 +- src/libffmpeg/libavcodec/i386/mpegvideo_mmx.c | 23 +- .../libavcodec/i386/mpegvideo_mmx_template.c | 16 +- src/libffmpeg/libavcodec/i386/simple_idct_mmx.c | 154 +- src/libffmpeg/libavcodec/i386/vp3dsp_mmx.c | 10 +- src/libffmpeg/libavcodec/i386/vp3dsp_sse2.c | 10 +- src/libffmpeg/libavcodec/idcinvideo.c | 10 +- src/libffmpeg/libavcodec/imgconvert.c | 296 ++- src/libffmpeg/libavcodec/imgconvert_template.h | 44 +- src/libffmpeg/libavcodec/imgresample.c | 57 +- src/libffmpeg/libavcodec/indeo2.c | 12 +- src/libffmpeg/libavcodec/indeo2data.h | 21 + src/libffmpeg/libavcodec/indeo3.c | 12 +- src/libffmpeg/libavcodec/indeo3data.h | 20 + src/libffmpeg/libavcodec/interplayvideo.c | 10 +- src/libffmpeg/libavcodec/jfdctfst.c | 37 +- src/libffmpeg/libavcodec/jfdctint.c | 37 +- src/libffmpeg/libavcodec/jpeg_ls.c | 276 +-- src/libffmpeg/libavcodec/jrevdct.c | 37 +- src/libffmpeg/libavcodec/kmvc.c | 16 +- src/libffmpeg/libavcodec/lcl.c | 38 +- src/libffmpeg/libavcodec/loco.c | 10 +- src/libffmpeg/libavcodec/lzo.c | 14 +- src/libffmpeg/libavcodec/lzo.h | 21 + src/libffmpeg/libavcodec/mace.c | 18 +- src/libffmpeg/libavcodec/mathops.h | 69 + src/libffmpeg/libavcodec/mdct.c | 10 +- src/libffmpeg/libavcodec/mdec.c | 10 +- src/libffmpeg/libavcodec/mem.c | 135 -- src/libffmpeg/libavcodec/mjpeg.c | 243 ++- src/libffmpeg/libavcodec/mlib/dsputil_mlib.c | 16 +- src/libffmpeg/libavcodec/mmvideo.c | 10 +- src/libffmpeg/libavcodec/motion_est.c | 63 +- src/libffmpeg/libavcodec/motion_est_template.c | 228 +- src/libffmpeg/libavcodec/mpeg12.c | 385 +++- src/libffmpeg/libavcodec/mpeg12data.h | 32 +- src/libffmpeg/libavcodec/mpeg4data.h | 22 + src/libffmpeg/libavcodec/mpegaudio.h | 22 +- src/libffmpeg/libavcodec/mpegaudiodec.c | 1001 +++++---- src/libffmpeg/libavcodec/mpegaudiodectab.h | 93 +- src/libffmpeg/libavcodec/mpegaudiotab.h | 17 +- src/libffmpeg/libavcodec/mpegvideo.c | 213 +- src/libffmpeg/libavcodec/mpegvideo.h | 121 +- src/libffmpeg/libavcodec/msmpeg4.c | 26 +- src/libffmpeg/libavcodec/msmpeg4data.h | 24 + src/libffmpeg/libavcodec/msrle.c | 10 +- src/libffmpeg/libavcodec/msvideo1.c | 10 +- src/libffmpeg/libavcodec/nuv.c | 10 +- src/libffmpeg/libavcodec/opt.c | 381 ++++ src/libffmpeg/libavcodec/opt.h | 22 + src/libffmpeg/libavcodec/parser.c | 321 +-- src/libffmpeg/libavcodec/parser.h | 63 + src/libffmpeg/libavcodec/pcm.c | 10 +- src/libffmpeg/libavcodec/ppc/dsputil_altivec.c | 612 ++---- src/libffmpeg/libavcodec/ppc/dsputil_altivec.h | 77 +- src/libffmpeg/libavcodec/ppc/dsputil_ppc.c | 130 +- src/libffmpeg/libavcodec/ppc/dsputil_ppc.h | 21 +- src/libffmpeg/libavcodec/ppc/fdct_altivec.c | 15 +- src/libffmpeg/libavcodec/ppc/fft_altivec.c | 95 +- src/libffmpeg/libavcodec/ppc/gcc_fixes.h | 16 + src/libffmpeg/libavcodec/ppc/gmc_altivec.c | 38 +- src/libffmpeg/libavcodec/ppc/idct_altivec.c | 24 +- src/libffmpeg/libavcodec/ppc/mpegvideo_altivec.c | 58 +- src/libffmpeg/libavcodec/ppc/mpegvideo_ppc.c | 14 +- src/libffmpeg/libavcodec/qdm2.c | 10 +- src/libffmpeg/libavcodec/qdm2data.h | 10 +- src/libffmpeg/libavcodec/qdrw.c | 12 +- src/libffmpeg/libavcodec/qpeg.c | 10 +- src/libffmpeg/libavcodec/qtrle.c | 10 +- src/libffmpeg/libavcodec/ra144.c | 10 +- src/libffmpeg/libavcodec/ra144.h | 10 +- src/libffmpeg/libavcodec/ra288.c | 10 +- src/libffmpeg/libavcodec/ra288.h | 10 +- src/libffmpeg/libavcodec/rangecoder.c | 10 +- src/libffmpeg/libavcodec/rangecoder.h | 10 +- src/libffmpeg/libavcodec/ratecontrol.c | 214 +- src/libffmpeg/libavcodec/ratecontrol.h | 103 + src/libffmpeg/libavcodec/raw.c | 31 +- src/libffmpeg/libavcodec/resample2.c | 12 +- src/libffmpeg/libavcodec/roqvideo.c | 10 +- src/libffmpeg/libavcodec/rpza.c | 10 +- src/libffmpeg/libavcodec/rtjpeg.c | 39 +- src/libffmpeg/libavcodec/rtjpeg.h | 22 +- src/libffmpeg/libavcodec/rv10.c | 53 +- src/libffmpeg/libavcodec/shorten.c | 12 +- src/libffmpeg/libavcodec/simple_idct.c | 20 +- src/libffmpeg/libavcodec/simple_idct.h | 10 +- src/libffmpeg/libavcodec/smacker.c | 24 +- src/libffmpeg/libavcodec/smc.c | 10 +- src/libffmpeg/libavcodec/snow.c | 278 +-- src/libffmpeg/libavcodec/snow.h | 16 +- src/libffmpeg/libavcodec/sp5x.h | 10 +- src/libffmpeg/libavcodec/sparc/dsputil_vis.c | 21 +- src/libffmpeg/libavcodec/sparc/vis.h | 21 +- src/libffmpeg/libavcodec/svq1.c | 24 +- src/libffmpeg/libavcodec/svq1_cb.h | 10 +- src/libffmpeg/libavcodec/svq1_vlc.h | 20 + src/libffmpeg/libavcodec/svq3.c | 12 +- src/libffmpeg/libavcodec/swscale.h | 144 +- src/libffmpeg/libavcodec/truemotion1.c | 10 +- src/libffmpeg/libavcodec/truemotion1data.h | 16 + src/libffmpeg/libavcodec/truemotion2.c | 12 +- src/libffmpeg/libavcodec/truespeech.c | 10 +- src/libffmpeg/libavcodec/truespeech_data.h | 21 + src/libffmpeg/libavcodec/tscc.c | 12 +- src/libffmpeg/libavcodec/tta.c | 39 +- src/libffmpeg/libavcodec/ulti.c | 10 +- src/libffmpeg/libavcodec/ulti_cb.h | 21 + src/libffmpeg/libavcodec/utils.c | 350 ++- src/libffmpeg/libavcodec/vc1.c | 1857 +++++++++++++--- src/libffmpeg/libavcodec/vc1acdata.h | 21 + src/libffmpeg/libavcodec/vc1data.h | 43 +- src/libffmpeg/libavcodec/vc1dsp.c | 44 +- src/libffmpeg/libavcodec/vcr1.c | 10 +- src/libffmpeg/libavcodec/vmdav.c | 49 +- src/libffmpeg/libavcodec/vorbis.c | 646 +++--- src/libffmpeg/libavcodec/vorbis.h | 2285 +------------------- src/libffmpeg/libavcodec/vorbis_data.c | 2155 ++++++++++++++++++ src/libffmpeg/libavcodec/vp3.c | 32 +- src/libffmpeg/libavcodec/vp3data.h | 20 + src/libffmpeg/libavcodec/vp3dsp.c | 12 +- src/libffmpeg/libavcodec/vqavideo.c | 33 +- src/libffmpeg/libavcodec/wmadata.h | 21 + src/libffmpeg/libavcodec/wmadec.c | 42 +- src/libffmpeg/libavcodec/wmv2.c | 13 +- src/libffmpeg/libavcodec/wnv1.c | 10 +- src/libffmpeg/libavcodec/ws-snd1.c | 15 +- src/libffmpeg/libavcodec/xan.c | 10 +- src/libffmpeg/libavcodec/xl.c | 12 +- src/libffmpeg/libavcodec/zmbv.c | 18 +- src/libffmpeg/libavutil/Makefile.am | 1 + src/libffmpeg/libavutil/adler32.c | 20 +- src/libffmpeg/libavutil/adler32.h | 20 + src/libffmpeg/libavutil/avutil.h | 107 +- src/libffmpeg/libavutil/bswap.h | 24 +- src/libffmpeg/libavutil/common.h | 151 +- src/libffmpeg/libavutil/crc.c | 20 + src/libffmpeg/libavutil/crc.h | 20 + src/libffmpeg/libavutil/integer.c | 10 +- src/libffmpeg/libavutil/integer.h | 10 +- src/libffmpeg/libavutil/internal.h | 122 +- src/libffmpeg/libavutil/intfloat_readwrite.h | 20 + src/libffmpeg/libavutil/lls.c | 10 +- src/libffmpeg/libavutil/lls.h | 10 +- src/libffmpeg/libavutil/log.c | 10 +- src/libffmpeg/libavutil/log.h | 22 +- src/libffmpeg/libavutil/mathematics.c | 12 +- src/libffmpeg/libavutil/mathematics.h | 20 + src/libffmpeg/libavutil/md5.c | 20 +- src/libffmpeg/libavutil/md5.h | 20 + src/libffmpeg/libavutil/mem.c | 171 ++ src/libffmpeg/libavutil/rational.c | 27 +- src/libffmpeg/libavutil/rational.h | 10 +- src/libffmpeg/libavutil/x86_cpu.h | 22 + src/libffmpeg/xine_decoder.c | 8 +- 233 files changed, 13869 insertions(+), 8004 deletions(-) create mode 100644 src/libffmpeg/libavcodec/bytestream.h create mode 100644 src/libffmpeg/libavcodec/eval.h create mode 100644 src/libffmpeg/libavcodec/i386/fft_3dn.c create mode 100644 src/libffmpeg/libavcodec/i386/fft_3dn2.c create mode 100644 src/libffmpeg/libavcodec/mathops.h delete mode 100644 src/libffmpeg/libavcodec/mem.c create mode 100644 src/libffmpeg/libavcodec/opt.c create mode 100644 src/libffmpeg/libavcodec/parser.h create mode 100644 src/libffmpeg/libavcodec/ratecontrol.h create mode 100644 src/libffmpeg/libavcodec/vorbis_data.c create mode 100644 src/libffmpeg/libavutil/mem.c (limited to 'src') diff --git a/src/libffmpeg/diff_to_ffmpeg_cvs.txt b/src/libffmpeg/diff_to_ffmpeg_cvs.txt index 617712ef3..3dfb43dc3 100644 --- a/src/libffmpeg/diff_to_ffmpeg_cvs.txt +++ b/src/libffmpeg/diff_to_ffmpeg_cvs.txt @@ -1,6 +1,8 @@ ---- /home/melanson/projects/ffmpeg/libavcodec/avcodec.h 2006-08-01 20:03:33.000000000 -0700 -+++ libavcodec/avcodec.h 2006-08-01 20:55:16.000000000 -0700 -@@ -27,6 +27,13 @@ +Index: libavcodec/avcodec.h +=================================================================== +--- libavcodec/avcodec.h (revision 7221) ++++ libavcodec/avcodec.h (working copy) +@@ -47,6 +47,13 @@ #define AV_TIME_BASE 1000000 #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} @@ -14,7 +16,7 @@ enum CodecID { CODEC_ID_NONE, CODEC_ID_MPEG1VIDEO, -@@ -2629,6 +2636,13 @@ +@@ -2686,6 +2693,13 @@ extern unsigned int av_xiphlacing(unsigned char *s, unsigned int v); @@ -28,10 +30,11 @@ #ifdef __cplusplus } #endif - ---- /home/melanson/projects/ffmpeg/libavcodec/dsputil.h 2006-08-01 20:03:33.000000000 -0700 -+++ libavcodec/dsputil.h 2006-08-01 20:55:16.000000000 -0700 -@@ -31,6 +31,9 @@ +Index: libavcodec/dsputil.h +=================================================================== +--- libavcodec/dsputil.h (revision 7221) ++++ libavcodec/dsputil.h (working copy) +@@ -33,6 +33,9 @@ #include "common.h" #include "avcodec.h" @@ -41,10 +44,11 @@ //#define DEBUG /* dct code */ - ---- /home/melanson/projects/ffmpeg/libavcodec/motion_est.c 2006-07-02 20:16:54.000000000 -0700 -+++ libavcodec/motion_est.c 2006-08-01 21:18:45.000000000 -0700 -@@ -21,6 +21,9 @@ +Index: libavcodec/motion_est.c +=================================================================== +--- libavcodec/motion_est.c (revision 7221) ++++ libavcodec/motion_est.c (working copy) +@@ -23,6 +23,9 @@ * new Motion Estimation (X1/EPZS) by Michael Niedermayer */ @@ -54,16 +58,17 @@ /** * @file motion_est.c * Motion estimation. -@@ -2113,3 +2116,5 @@ +@@ -2112,3 +2115,5 @@ } } } + +#endif /* CONFIG_ENCODERS */ - ---- /home/melanson/projects/ffmpeg/libavcodec/mpeg12.c 2006-07-02 20:16:54.000000000 -0700 -+++ libavcodec/mpeg12.c 2006-08-01 21:18:45.000000000 -0700 -@@ -34,6 +34,13 @@ +Index: libavcodec/mpeg12.c +=================================================================== +--- libavcodec/mpeg12.c (revision 7221) ++++ libavcodec/mpeg12.c (working copy) +@@ -36,6 +36,13 @@ //#include @@ -77,10 +82,11 @@ /* Start codes. */ #define SEQ_END_CODE 0x000001b7 #define SEQ_START_CODE 0x000001b3 - ---- /home/melanson/projects/ffmpeg/libavcodec/mpegvideo.c 2006-08-01 20:03:33.000000000 -0700 -+++ libavcodec/mpegvideo.c 2006-08-01 21:18:45.000000000 -0700 -@@ -38,6 +38,14 @@ +Index: libavcodec/mpegvideo.c +=================================================================== +--- libavcodec/mpegvideo.c (revision 7221) ++++ libavcodec/mpegvideo.c (working copy) +@@ -40,6 +40,14 @@ //#undef NDEBUG //#include @@ -93,26 +99,9 @@ + + #ifdef CONFIG_ENCODERS - static void encode_picture(MpegEncContext *s, int picture_number); + static int encode_picture(MpegEncContext *s, int picture_number); #endif //CONFIG_ENCODERS -@@ -1165,6 +1173,8 @@ - s->low_delay= 0; //s->max_b_frames ? 0 : 1; - avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); - break; -+/* xine: this is never used in either decode or MPEG-1 encode mode */ -+#if 0 - case CODEC_ID_MPEG2VIDEO: - s->out_format = FMT_MPEG1; - s->low_delay= 0; //s->max_b_frames ? 0 : 1; -@@ -1300,6 +1310,7 @@ - avctx->delay=0; - s->low_delay=1; - break; -+#endif /* #if 0 */ - default: - return -1; - } -@@ -1321,6 +1332,8 @@ +@@ -1345,6 +1353,8 @@ ff_set_cmp(&s->dsp, s->dsp.ildct_cmp, s->avctx->ildct_cmp); ff_set_cmp(&s->dsp, s->dsp.frame_skip_cmp, s->avctx->frame_skip_cmp); @@ -121,7 +110,7 @@ #ifdef CONFIG_H261_ENCODER if (s->out_format == FMT_H261) ff_h261_encode_init(s); -@@ -1329,6 +1342,8 @@ +@@ -1353,6 +1363,8 @@ h263_encode_init(s); if(s->msmpeg4_version) ff_msmpeg4_encode_init(s); @@ -130,7 +119,7 @@ if (s->out_format == FMT_MPEG1) ff_mpeg1_encode_init(s); -@@ -1373,9 +1388,12 @@ +@@ -1397,9 +1409,12 @@ ff_rate_control_uninit(s); @@ -143,7 +132,7 @@ av_freep(&avctx->extradata); -@@ -2516,8 +2534,11 @@ +@@ -2545,8 +2560,11 @@ MPV_frame_end(s); @@ -153,9 +142,9 @@ mjpeg_picture_trailer(s); +#endif /* #if 0 */ - if(s->flags&CODEC_FLAG_PASS1) - ff_write_pass1_stats(s); -@@ -4516,6 +4537,8 @@ + if(avctx->rc_buffer_size){ + RateControlContext *rcc= &s->rc_context; +@@ -4575,6 +4593,8 @@ case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: mpeg1_encode_mb(s, s->block, motion_x, motion_y); break; @@ -164,7 +153,7 @@ case CODEC_ID_MPEG4: mpeg4_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_MSMPEG4V2: -@@ -4536,6 +4559,7 @@ +@@ -4595,6 +4615,7 @@ h263_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_MJPEG: mjpeg_encode_mb(s, s->block); break; @@ -172,7 +161,7 @@ default: assert(0); } -@@ -4757,6 +4781,8 @@ +@@ -4816,6 +4837,8 @@ +sse(s, s->new_picture.data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[2], w>>1, h>>1, s->uvlinesize); } @@ -181,7 +170,7 @@ static int pre_estimate_motion_thread(AVCodecContext *c, void *arg){ MpegEncContext *s= arg; -@@ -4800,6 +4826,7 @@ +@@ -4859,6 +4882,7 @@ } return 0; } @@ -189,7 +178,7 @@ static int mb_var_thread(AVCodecContext *c, void *arg){ MpegEncContext *s= arg; -@@ -4824,6 +4851,8 @@ +@@ -4883,6 +4907,8 @@ } static void write_slice_end(MpegEncContext *s){ @@ -198,7 +187,7 @@ if(s->codec_id==CODEC_ID_MPEG4){ if(s->partitioned_frame){ ff_mpeg4_merge_partitions(s); -@@ -4833,6 +4862,7 @@ +@@ -4892,6 +4918,7 @@ }else if(s->out_format == FMT_MJPEG){ ff_mjpeg_stuffing(&s->pb); } @@ -206,7 +195,7 @@ align_put_bits(&s->pb); flush_put_bits(&s->pb); -@@ -4886,10 +4916,13 @@ +@@ -4945,10 +4972,13 @@ case CODEC_ID_FLV1: s->gob_index = ff_h263_get_gob_height(s); break; @@ -220,7 +209,7 @@ } s->resync_mb_x=0; -@@ -4962,9 +4995,12 @@ +@@ -5021,9 +5051,12 @@ if(s->start_mb_y != mb_y || mb_x!=0){ write_slice_end(s); @@ -233,7 +222,7 @@ } assert((put_bits_count(&s->pb)&7) == 0); -@@ -4988,19 +5024,25 @@ +@@ -5047,19 +5080,25 @@ } switch(s->codec_id){ @@ -259,7 +248,7 @@ } if(s->flags&CODEC_FLAG_PASS1){ -@@ -5113,7 +5155,10 @@ +@@ -5172,7 +5211,10 @@ s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; s->mb_intra= 0; @@ -270,7 +259,7 @@ encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb, &dmin, &next_block, mx, my); } -@@ -5299,7 +5344,10 @@ +@@ -5354,7 +5396,10 @@ s->mb_intra= 0; motion_x=s->b_direct_mv_table[xy][0]; motion_y=s->b_direct_mv_table[xy][1]; @@ -281,7 +270,7 @@ break; case CANDIDATE_MB_TYPE_BIDIR: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; -@@ -5407,8 +5455,11 @@ +@@ -5462,8 +5507,11 @@ } //not beautiful here but we must write it before flushing so it has to be here @@ -293,8 +282,8 @@ write_slice_end(s); -@@ -5469,6 +5520,8 @@ - s->current_picture.quality = ff_rate_estimate_qscale(s, dry_run); +@@ -5531,6 +5579,8 @@ + } if(s->adaptive_quant){ +/* xine: do not need this for decode or MPEG-1 encoding modes */ @@ -302,7 +291,7 @@ switch(s->codec_id){ case CODEC_ID_MPEG4: ff_clean_mpeg4_qscales(s); -@@ -5479,6 +5532,7 @@ +@@ -5541,6 +5591,7 @@ ff_clean_h263_qscales(s); break; } @@ -310,7 +299,7 @@ s->lambda= s->lambda_table[0]; //FIXME broken -@@ -5499,10 +5553,13 @@ +@@ -5562,10 +5613,13 @@ s->me.mb_var_sum_temp = s->me.mc_mb_var_sum_temp = 0; @@ -324,7 +313,7 @@ s->me.scene_change_score=0; -@@ -5532,6 +5589,8 @@ +@@ -5596,6 +5650,8 @@ ff_update_duplicate_context(s->thread_context[i], s); } @@ -333,7 +322,7 @@ ff_init_me(s); /* Estimate motion for every MB */ -@@ -5546,6 +5605,8 @@ +@@ -5610,6 +5666,8 @@ s->avctx->execute(s->avctx, estimate_motion_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count); }else /* if(s->pict_type == I_TYPE) */{ @@ -342,7 +331,7 @@ /* I-Frame */ for(i=0; imb_stride*s->mb_height; i++) s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA; -@@ -5569,6 +5630,8 @@ +@@ -5633,6 +5691,8 @@ //printf("Scene change detected, encoding as I Frame %d %d\n", s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum); } @@ -351,15 +340,15 @@ if(!s->umvplus){ if(s->pict_type==P_TYPE || s->pict_type==S_TYPE) { s->f_code= ff_get_best_fcode(s, s->p_mv_table, CANDIDATE_MB_TYPE_INTER); -@@ -5622,6 +5685,7 @@ +@@ -5686,6 +5746,7 @@ } } } +#endif /* #if 0 */ - estimate_qp(s, 0); - -@@ -5652,6 +5716,8 @@ + if (estimate_qp(s, 0) < 0) + return -1; +@@ -5717,6 +5778,8 @@ s->last_bits= put_bits_count(&s->pb); switch(s->out_format) { @@ -368,7 +357,7 @@ case FMT_MJPEG: mjpeg_picture_header(s); break; -@@ -5680,11 +5746,15 @@ +@@ -5745,11 +5808,15 @@ else h263_encode_picture_header(s, picture_number); break; @@ -384,10 +373,11 @@ default: assert(0); } - ---- /home/melanson/projects/ffmpeg/libavcodec/snow.c 2006-07-02 20:16:54.000000000 -0700 -+++ libavcodec/snow.c 2006-08-01 21:18:45.000000000 -0700 -@@ -1975,6 +1975,7 @@ +Index: libavcodec/snow.c +=================================================================== +--- libavcodec/snow.c (revision 7221) ++++ libavcodec/snow.c (working copy) +@@ -1977,6 +1977,7 @@ #define P_MV1 P[9] #define FLAG_QPEL 1 //must be 1 @@ -395,7 +385,7 @@ static int encode_q_branch(SnowContext *s, int level, int x, int y){ uint8_t p_buffer[1024]; uint8_t i_buffer[1024]; -@@ -2203,6 +2204,7 @@ +@@ -2205,6 +2206,7 @@ return score; } } @@ -403,15 +393,15 @@ static always_inline int same_block(BlockNode *a, BlockNode *b){ if((a->type&BLOCK_INTRA) && (b->type&BLOCK_INTRA)){ -@@ -2317,6 +2319,7 @@ +@@ -2319,6 +2321,7 @@ } } +#ifdef CONFIG_ENCODERS - static void encode_blocks(SnowContext *s){ + static void encode_blocks(SnowContext *s, int search){ int x, y; int w= s->b_width; -@@ -2338,6 +2341,7 @@ +@@ -2340,6 +2343,7 @@ } } } @@ -419,7 +409,7 @@ static void decode_blocks(SnowContext *s){ int x, y; -@@ -4030,6 +4034,7 @@ +@@ -3910,6 +3914,7 @@ } } @@ -427,7 +417,7 @@ static int encode_init(AVCodecContext *avctx) { SnowContext *s = avctx->priv_data; -@@ -4117,6 +4122,7 @@ +@@ -3997,6 +4002,7 @@ return 0; } @@ -435,7 +425,7 @@ static int frame_start(SnowContext *s){ AVFrame tmp; -@@ -4155,6 +4161,7 @@ +@@ -4035,6 +4041,7 @@ return 0; } @@ -443,7 +433,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ SnowContext *s = avctx->priv_data; RangeCoder * const c= &s->c; -@@ -4382,6 +4389,7 @@ +@@ -4288,6 +4295,7 @@ return ff_rac_terminate(c); } @@ -451,7 +441,7 @@ static void common_end(SnowContext *s){ int plane_index, level, orientation, i; -@@ -4413,6 +4421,7 @@ +@@ -4319,6 +4327,7 @@ } } @@ -459,7 +449,7 @@ static int encode_end(AVCodecContext *avctx) { SnowContext *s = avctx->priv_data; -@@ -4422,6 +4431,7 @@ +@@ -4328,6 +4337,7 @@ return 0; } @@ -467,12 +457,22 @@ static int decode_init(AVCodecContext *avctx) { - ---- /home/melanson/projects/ffmpeg/libavutil/common.h 2006-08-01 20:03:31.000000000 -0700 -+++ libavutil/./common.h 2006-08-01 21:18:45.000000000 -0700 -@@ -358,4 +358,16 @@ - void *av_realloc(void *ptr, unsigned int size); - void av_free(void *ptr); +Index: libavutil/common.h +=================================================================== +--- libavutil/common.h (revision 7221) ++++ libavutil/common.h (working copy) +@@ -375,7 +375,7 @@ + ); + return (d << 32) | (a & 0xffffffff); + } +-#elif defined(ARCH_X86_32) ++#elif defined(ARCH_X86) + static inline long long read_time(void) + { + long long l; +@@ -446,4 +446,23 @@ + char *av_strdup(const char *s); + void av_freep(void *ptr); +/* xine: inline causes trouble for debug compiling */ +#ifdef DISABLE_INLINE @@ -485,16 +485,20 @@ +# define inline +# define always_inline +#endif ++ ++/* xine: define ASMALIGN here since it's cleaner that generating it in the configure */ ++#if HAVE_ASMALIGN_POT ++# define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\n\t" ++#else ++# define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\n\t" ++#endif + #endif /* COMMON_H */ Index: libavutil/integer.c =================================================================== -RCS file: /cvsroot/xine/xine-lib/src/libffmpeg/libavutil/integer.c,v -retrieving revision 1.2 -diff -u -p -r1.2 integer.c ---- libavutil/integer.c 2 Aug 2006 07:12:57 -0000 1.2 -+++ libavutil/integer.c 13 Sep 2006 21:05:42 -0000 -@@ -124,8 +124,8 @@ AVInteger av_mod_i(AVInteger *quot, AVIn +--- libavutil/integer.c (revision 7221) ++++ libavutil/integer.c (working copy) +@@ -126,8 +126,8 @@ AVInteger quot_temp; if(!quot) quot = "_temp; @@ -507,21 +511,39 @@ diff -u -p -r1.2 integer.c b= av_shr_i(b, -i); Index: libavutil/internal.h =================================================================== -RCS file: /cvsroot/xine/xine-lib/src/libffmpeg/libavutil/internal.h,v -retrieving revision 1.1 -diff -u -p -r1.1 internal.h ---- libavutil/internal.h 2 Aug 2006 07:39:20 -0000 1.1 -+++ libavutil/internal.h 13 Sep 2006 21:05:42 -0000 -@@ -87,7 +87,11 @@ +--- libavutil/internal.h (revision 7221) ++++ libavutil/internal.h (working copy) +@@ -93,11 +93,15 @@ + #include /* dprintf macros */ - # ifdef DEBUG --# define dprintf(fmt,...) av_log(NULL, AV_LOG_DEBUG, fmt, __VA_ARGS__) +-#ifdef DEBUG +-# define dprintf(fmt,...) av_log(NULL, AV_LOG_DEBUG, fmt, __VA_ARGS__) +-#else +-# define dprintf(fmt,...) +-#endif ++# ifdef DEBUG +# ifdef __GNUC__ +# define dprintf(fmt,args...) av_log(NULL, AV_LOG_DEBUG, fmt, ##args) +# else +# define dprintf(fmt,...) av_log(NULL, AV_LOG_DEBUG, fmt, __VA_ARGS__) +# endif - # else - # define dprintf(fmt,...) - # endif ++# else ++# define dprintf(fmt,...) ++# endif + + #define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0) + +Index: libavcodec/mlib/dsputil_mlib.c +=================================================================== +--- libavcodec/mlib/dsputil_mlib.c (revision 7221) ++++ libavcodec/mlib/dsputil_mlib.c (working copy) +@@ -22,6 +22,8 @@ + #include "../dsputil.h" + #include "../mpegvideo.h" + ++#include "../../../xine-utils/xineutils.h" ++ + #include + #include + #include diff --git a/src/libffmpeg/dvaudio_decoder.c b/src/libffmpeg/dvaudio_decoder.c index 663335aaa..2c851bae1 100644 --- a/src/libffmpeg/dvaudio_decoder.c +++ b/src/libffmpeg/dvaudio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: dvaudio_decoder.c,v 1.11 2006/07/10 22:08:29 dgp85 Exp $ + * $Id: dvaudio_decoder.c,v 1.12 2006/12/04 22:25:13 miguelfreitas Exp $ * * dv audio decoder based on patch by Dan Dennedy * @@ -97,22 +97,6 @@ typedef struct dvaudio_decoder_s { } dvaudio_decoder_t; -enum dv_pack_type { - dv_header525 = 0x3f, /* see dv_write_pack for important details on */ - dv_header625 = 0xbf, /* these two packs */ - dv_timecode = 0x13, - dv_audio_source = 0x50, - dv_audio_control = 0x51, - dv_audio_recdate = 0x52, - dv_audio_rectime = 0x53, - dv_video_source = 0x60, - dv_video_control = 0x61, - dv_viedo_recdate = 0x62, - dv_video_rectime = 0x63, - dv_unknown_pack = 0xff, -}; - - /* * This is the dumbest implementation of all -- it simply looks at * a fixed offset and if pack isn't there -- fails. We might want diff --git a/src/libffmpeg/libavcodec/4xm.c b/src/libffmpeg/libavcodec/4xm.c index a986f151e..ea60e9bf2 100644 --- a/src/libffmpeg/libavcodec/4xm.c +++ b/src/libffmpeg/libavcodec/4xm.c @@ -2,18 +2,20 @@ * 4XM codec * Copyright (c) 2003 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -104,8 +106,8 @@ static VLC block_type_vlc[4]; typedef struct CFrameBuffer{ - int allocated_size; - int size; + unsigned int allocated_size; + unsigned int size; int id; uint8_t *data; }CFrameBuffer; diff --git a/src/libffmpeg/libavcodec/8bps.c b/src/libffmpeg/libavcodec/8bps.c index b16e3bb56..297465043 100644 --- a/src/libffmpeg/libavcodec/8bps.c +++ b/src/libffmpeg/libavcodec/8bps.c @@ -2,18 +2,20 @@ * Quicktime Planar RGB (8BPS) Video Decoder * Copyright (C) 2003 Roberto Togni * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -37,7 +39,7 @@ #include "avcodec.h" -const enum PixelFormat pixfmt_rgb24[] = {PIX_FMT_BGR24, PIX_FMT_RGBA32, -1}; +static const enum PixelFormat pixfmt_rgb24[] = {PIX_FMT_BGR24, PIX_FMT_RGBA32, -1}; /* * Decoder context diff --git a/src/libffmpeg/libavcodec/Makefile.am b/src/libffmpeg/libavcodec/Makefile.am index bf98dd7ca..cf34b0d28 100644 --- a/src/libffmpeg/libavcodec/Makefile.am +++ b/src/libffmpeg/libavcodec/Makefile.am @@ -64,7 +64,6 @@ libavcodec_la_SOURCES = \ lzo.c \ mdct.c \ mace.c \ - mem.c \ mjpeg.c \ mmvideo.c \ motion_est.c \ @@ -75,6 +74,7 @@ libavcodec_la_SOURCES = \ msrle.c \ msvideo1.c \ nuv.c \ + opt.c \ parser.c \ pcm.c \ qdm2.c \ @@ -107,6 +107,7 @@ libavcodec_la_SOURCES = \ vcr1.c \ vmdav.c \ vorbis.c \ + vorbis_data.c \ vp3.c \ vp3dsp.c \ vqavideo.c \ @@ -128,11 +129,13 @@ libavcodec_la_LDFLAGS = \ noinst_HEADERS = \ avcodec.h \ bitstream.h \ + bytestream.h \ cabac.h \ cavsdata.h \ cookdata.h \ dsputil.h \ dvdata.h \ + eval.h \ faandct.h \ fastmemcpy.h \ golomb.h \ @@ -143,6 +146,7 @@ noinst_HEADERS = \ h263data.h \ h264data.h \ lzo.h \ + mathops.h \ mpeg4data.h \ mpeg12data.h \ mpegaudio.h \ @@ -151,10 +155,12 @@ noinst_HEADERS = \ mpegvideo.h \ msmpeg4data.h \ opt.h \ + parser.h \ qdm2data.h \ ra144.h \ ra288.h \ rangecoder.h \ + ratecontrol.h \ rtjpeg.h \ simple_idct.h \ snow.h \ diff --git a/src/libffmpeg/libavcodec/aasc.c b/src/libffmpeg/libavcodec/aasc.c index 462282800..6c8e3166e 100644 --- a/src/libffmpeg/libavcodec/aasc.c +++ b/src/libffmpeg/libavcodec/aasc.c @@ -2,18 +2,20 @@ * Autodesc RLE Decoder * Copyright (C) 2005 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/adpcm.c b/src/libffmpeg/libavcodec/adpcm.c index 796cd267c..ec3fe6f6e 100644 --- a/src/libffmpeg/libavcodec/adpcm.c +++ b/src/libffmpeg/libavcodec/adpcm.c @@ -2,18 +2,20 @@ * ADPCM codecs * Copyright (c) 2001-2003 The ffmpeg Project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avcodec.h" diff --git a/src/libffmpeg/libavcodec/adx.c b/src/libffmpeg/libavcodec/adx.c index c8c785590..b449c9124 100644 --- a/src/libffmpeg/libavcodec/adx.c +++ b/src/libffmpeg/libavcodec/adx.c @@ -2,18 +2,20 @@ * ADX ADPCM codecs * Copyright (c) 2001,2003 BERO * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avcodec.h" diff --git a/src/libffmpeg/libavcodec/alac.c b/src/libffmpeg/libavcodec/alac.c index 5211e5057..793f71a11 100644 --- a/src/libffmpeg/libavcodec/alac.c +++ b/src/libffmpeg/libavcodec/alac.c @@ -3,18 +3,20 @@ * Copyright (c) 2005 David Hammerton * All rights reserved. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -471,9 +473,9 @@ static int alac_decode_frame(AVCodecContext *avctx, return input_buffer_size; } if (alac_set_info(alac)) { - av_log(NULL, AV_LOG_ERROR, "alac: set_info failed\n"); - return input_buffer_size; - } + av_log(avctx, AV_LOG_ERROR, "alac: set_info failed\n"); + return input_buffer_size; + } alac->context_initialized = 1; } diff --git a/src/libffmpeg/libavcodec/alpha/asm.h b/src/libffmpeg/libavcodec/alpha/asm.h index 056e043f3..c0ddde528 100644 --- a/src/libffmpeg/libavcodec/alpha/asm.h +++ b/src/libffmpeg/libavcodec/alpha/asm.h @@ -2,18 +2,20 @@ * Alpha optimized DSP utils * Copyright (c) 2002 Falk Hueffner * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/alpha/dsputil_alpha.c b/src/libffmpeg/libavcodec/alpha/dsputil_alpha.c index 299a25dc4..c98d6f7ff 100644 --- a/src/libffmpeg/libavcodec/alpha/dsputil_alpha.c +++ b/src/libffmpeg/libavcodec/alpha/dsputil_alpha.c @@ -2,18 +2,20 @@ * Alpha optimized DSP utils * Copyright (c) 2002 Falk Hueffner * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/alpha/dsputil_alpha_asm.S b/src/libffmpeg/libavcodec/alpha/dsputil_alpha_asm.S index 29ba9dc02..367f2d743 100644 --- a/src/libffmpeg/libavcodec/alpha/dsputil_alpha_asm.S +++ b/src/libffmpeg/libavcodec/alpha/dsputil_alpha_asm.S @@ -2,18 +2,20 @@ * Alpha optimized DSP utils * Copyright (c) 2002 Falk Hueffner * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/alpha/motion_est_alpha.c b/src/libffmpeg/libavcodec/alpha/motion_est_alpha.c index ea8580be7..337ffb38e 100644 --- a/src/libffmpeg/libavcodec/alpha/motion_est_alpha.c +++ b/src/libffmpeg/libavcodec/alpha/motion_est_alpha.c @@ -2,18 +2,20 @@ * Alpha optimized DSP utils * Copyright (c) 2002 Falk Hueffner * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/alpha/motion_est_mvi_asm.S b/src/libffmpeg/libavcodec/alpha/motion_est_mvi_asm.S index e043f4371..6015a7824 100644 --- a/src/libffmpeg/libavcodec/alpha/motion_est_mvi_asm.S +++ b/src/libffmpeg/libavcodec/alpha/motion_est_mvi_asm.S @@ -2,18 +2,20 @@ * Alpha optimized DSP utils * Copyright (c) 2002 Falk Hueffner * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/alpha/mpegvideo_alpha.c b/src/libffmpeg/libavcodec/alpha/mpegvideo_alpha.c index 4c512451e..8ad264b06 100644 --- a/src/libffmpeg/libavcodec/alpha/mpegvideo_alpha.c +++ b/src/libffmpeg/libavcodec/alpha/mpegvideo_alpha.c @@ -2,18 +2,20 @@ * Alpha optimized DSP utils * Copyright (c) 2002 Falk Hueffner * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/alpha/regdef.h b/src/libffmpeg/libavcodec/alpha/regdef.h index 7e7fc06b2..01e263bac 100644 --- a/src/libffmpeg/libavcodec/alpha/regdef.h +++ b/src/libffmpeg/libavcodec/alpha/regdef.h @@ -1,3 +1,24 @@ +/* + * Alpha optimized DSP utils + * copyright (c) 2002 Falk Hueffner + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + /* Some BSDs don't seem to have regdef.h... sigh */ #ifndef alpha_regdef_h #define alpha_regdef_h diff --git a/src/libffmpeg/libavcodec/alpha/simple_idct_alpha.c b/src/libffmpeg/libavcodec/alpha/simple_idct_alpha.c index 3a5db009b..adadd3ab0 100644 --- a/src/libffmpeg/libavcodec/alpha/simple_idct_alpha.c +++ b/src/libffmpeg/libavcodec/alpha/simple_idct_alpha.c @@ -3,18 +3,20 @@ * * Copyright (c) 2001 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * based upon some outcommented c code from mpeg2dec (idct_mmx.c diff --git a/src/libffmpeg/libavcodec/armv4l/dsputil_arm.c b/src/libffmpeg/libavcodec/armv4l/dsputil_arm.c index cebd176b3..9f0bfa2af 100644 --- a/src/libffmpeg/libavcodec/armv4l/dsputil_arm.c +++ b/src/libffmpeg/libavcodec/armv4l/dsputil_arm.c @@ -2,18 +2,20 @@ * ARMv4L optimized DSP utils * Copyright (c) 2001 Lionel Ulmer. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -27,6 +29,12 @@ extern void dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx); extern void j_rev_dct_ARM(DCTELEM *data); extern void simple_idct_ARM(DCTELEM *data); +extern void simple_idct_armv5te(DCTELEM *data); +extern void simple_idct_put_armv5te(uint8_t *dest, int line_size, + DCTELEM *data); +extern void simple_idct_add_armv5te(uint8_t *dest, int line_size, + DCTELEM *data); + /* XXX: local hack */ static void (*ff_put_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size); static void (*ff_add_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size); @@ -164,45 +172,48 @@ static void simple_idct_ARM_add(uint8_t *dest, int line_size, DCTELEM *block) simple_idct_ARM (block); ff_add_pixels_clamped(block, dest, line_size); } + +#ifdef HAVE_IPP static void simple_idct_ipp(DCTELEM *block) { -#ifdef HAVE_IPP ippiDCT8x8Inv_Video_16s_C1I(block); -#endif } static void simple_idct_ipp_put(uint8_t *dest, int line_size, DCTELEM *block) { -#ifdef HAVE_IPP ippiDCT8x8Inv_Video_16s8u_C1R(block, dest, line_size); -#endif } void add_pixels_clamped_iwmmxt(const DCTELEM *block, uint8_t *pixels, int line_size); static void simple_idct_ipp_add(uint8_t *dest, int line_size, DCTELEM *block) { -#ifdef HAVE_IPP ippiDCT8x8Inv_Video_16s_C1I(block); #ifdef HAVE_IWMMXT add_pixels_clamped_iwmmxt(block, dest, line_size); #else add_pixels_clamped_ARM(block, dest, line_size); #endif -#endif } +#endif void dsputil_init_armv4l(DSPContext* c, AVCodecContext *avctx) { - const int idct_algo= avctx->idct_algo; + int idct_algo= avctx->idct_algo; ff_put_pixels_clamped = c->put_pixels_clamped; ff_add_pixels_clamped = c->add_pixels_clamped; -#ifdef HAVE_IPP - if(idct_algo==FF_IDCT_ARM){ + if(idct_algo == FF_IDCT_AUTO){ +#if defined(HAVE_IPP) + idct_algo = FF_IDCT_IPP; +#elif defined(HAVE_ARMV5TE) + idct_algo = FF_IDCT_SIMPLEARMV5TE; #else - if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_ARM){ + idct_algo = FF_IDCT_ARM; #endif + } + + if(idct_algo==FF_IDCT_ARM){ c->idct_put= j_rev_dct_ARM_put; c->idct_add= j_rev_dct_ARM_add; c->idct = j_rev_dct_ARM; @@ -212,22 +223,27 @@ void dsputil_init_armv4l(DSPContext* c, AVCodecContext *avctx) c->idct_add= simple_idct_ARM_add; c->idct = simple_idct_ARM; c->idct_permutation_type= FF_NO_IDCT_PERM; +#ifdef HAVE_ARMV5TE + } else if (idct_algo==FF_IDCT_SIMPLEARMV5TE){ + c->idct_put= simple_idct_put_armv5te; + c->idct_add= simple_idct_add_armv5te; + c->idct = simple_idct_armv5te; + c->idct_permutation_type = FF_NO_IDCT_PERM; +#endif #ifdef HAVE_IPP - } else if (idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_IPP){ -#else } else if (idct_algo==FF_IDCT_IPP){ -#endif c->idct_put= simple_idct_ipp_put; c->idct_add= simple_idct_ipp_add; c->idct = simple_idct_ipp; c->idct_permutation_type= FF_NO_IDCT_PERM; +#endif } /* c->put_pixels_tab[0][0] = put_pixels16_arm; */ // NG! c->put_pixels_tab[0][1] = put_pixels16_x2_arm; //OK! c->put_pixels_tab[0][2] = put_pixels16_y2_arm; //OK! /* c->put_pixels_tab[0][3] = put_pixels16_xy2_arm; /\* NG *\/ */ -/* c->put_no_rnd_pixels_tab[0][0] = put_pixels16_arm; // ?(»È¤ï¤ì¤Ê¤¤) */ +/* c->put_no_rnd_pixels_tab[0][0] = put_pixels16_arm; */ c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_arm; // OK c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_arm; //OK /* c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_arm; //NG */ diff --git a/src/libffmpeg/libavcodec/armv4l/mpegvideo_arm.c b/src/libffmpeg/libavcodec/armv4l/mpegvideo_arm.c index 263e3c5bc..10a005cd3 100644 --- a/src/libffmpeg/libavcodec/armv4l/mpegvideo_arm.c +++ b/src/libffmpeg/libavcodec/armv4l/mpegvideo_arm.c @@ -1,18 +1,20 @@ /* * Copyright (c) 2002 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/armv4l/simple_idct_arm.S b/src/libffmpeg/libavcodec/armv4l/simple_idct_arm.S index 43751896d..b5a20f6da 100644 --- a/src/libffmpeg/libavcodec/armv4l/simple_idct_arm.S +++ b/src/libffmpeg/libavcodec/armv4l/simple_idct_arm.S @@ -5,20 +5,22 @@ * * Author: Frederic Boulay * - * You can redistribute this file and/or modify - * it under the terms of the GNU General Public License (version 2) - * as published by the Free Software Foundation. + * This file is part of FFmpeg. * - * This file is distributed in the hope that it will be useful, + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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. + * 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 General Public License - * along with this library; if not, write to the Free Software + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * * The function defined in this file, is derived from the simple_idct function * from the libavcodec library part of the ffmpeg project. */ diff --git a/src/libffmpeg/libavcodec/asv1.c b/src/libffmpeg/libavcodec/asv1.c index 3cfb76e65..ec6bbb9ba 100644 --- a/src/libffmpeg/libavcodec/asv1.c +++ b/src/libffmpeg/libavcodec/asv1.c @@ -2,18 +2,20 @@ * ASUS V1/V2 codec * Copyright (c) 2003 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -462,6 +464,7 @@ for(i=0; iavctx->extradata_size; i++){ return (get_bits_count(&a->gb)+31)/32*4; } +#ifdef CONFIG_ENCODERS static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ ASV1Context * const a = avctx->priv_data; AVFrame *pict = data; @@ -515,6 +518,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, return size*4; } +#endif /* CONFIG_ENCODERS */ static void common_init(AVCodecContext *avctx){ ASV1Context * const a = avctx->priv_data; @@ -564,6 +568,7 @@ static int decode_init(AVCodecContext *avctx){ return 0; } +#ifdef CONFIG_ENCODERS static int encode_init(AVCodecContext *avctx){ ASV1Context * const a = avctx->priv_data; int i; @@ -587,6 +592,7 @@ static int encode_init(AVCodecContext *avctx){ return 0; } +#endif static int decode_end(AVCodecContext *avctx){ ASV1Context * const a = avctx->priv_data; @@ -632,6 +638,7 @@ AVCodec asv1_encoder = { encode_init, encode_frame, //encode_end, + .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1}, }; AVCodec asv2_encoder = { @@ -642,6 +649,7 @@ AVCodec asv2_encoder = { encode_init, encode_frame, //encode_end, + .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1}, }; #endif //CONFIG_ENCODERS diff --git a/src/libffmpeg/libavcodec/avcodec.h b/src/libffmpeg/libavcodec/avcodec.h index 9be5dcf6e..d8090ed32 100644 --- a/src/libffmpeg/libavcodec/avcodec.h +++ b/src/libffmpeg/libavcodec/avcodec.h @@ -1,3 +1,23 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + #ifndef AVCODEC_H #define AVCODEC_H @@ -17,8 +37,8 @@ extern "C" { #define AV_STRINGIFY(s) AV_TOSTRING(s) #define AV_TOSTRING(s) #s -#define LIBAVCODEC_VERSION_INT ((51<<16)+(11<<8)+0) -#define LIBAVCODEC_VERSION 51.11.0 +#define LIBAVCODEC_VERSION_INT ((51<<16)+(25<<8)+0) +#define LIBAVCODEC_VERSION 51.25.0 #define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT #define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) @@ -126,6 +146,16 @@ enum CodecID { CODEC_ID_KMVC, CODEC_ID_FLASHSV, CODEC_ID_CAVS, + CODEC_ID_JPEG2000, + CODEC_ID_VMNC, + CODEC_ID_VP5, + CODEC_ID_VP6, + CODEC_ID_VP6F, + CODEC_ID_TARGA, + CODEC_ID_DSICINVIDEO, + CODEC_ID_TIERTEXSEQVIDEO, + CODEC_ID_TIFF, + CODEC_ID_GIF, /* various pcm "codecs" */ CODEC_ID_PCM_S16LE= 0x10000, @@ -183,7 +213,9 @@ enum CodecID { CODEC_ID_MP2= 0x15000, CODEC_ID_MP3, /* prefered ID for MPEG Audio layer 1, 2 or3 decoding */ CODEC_ID_AAC, +#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) CODEC_ID_MPEG4AAC, +#endif CODEC_ID_AC3, CODEC_ID_DTS, CODEC_ID_VORBIS, @@ -207,6 +239,10 @@ enum CodecID { CODEC_ID_TRUESPEECH, CODEC_ID_TTA, CODEC_ID_SMACKAUDIO, + CODEC_ID_QCELP, + CODEC_ID_WAVPACK, + CODEC_ID_DSICINAUDIO, + CODEC_ID_IMC, /* subtitle codecs */ CODEC_ID_DVD_SUBTITLE= 0x17000, @@ -343,6 +379,7 @@ typedef struct RcOverride{ #define CODEC_FLAG2_BRDO 0x00000400 ///< b-frame rate-distortion optimization #define CODEC_FLAG2_INTRA_VLC 0x00000800 ///< use MPEG-2 intra VLC table #define CODEC_FLAG2_MEMC_ONLY 0x00001000 ///< only do ME/MC (I frames -> ref, P frame -> ME+MC) +#define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format /* Unsupported options : * Syntax Arithmetic coding (SAC) @@ -723,7 +760,7 @@ typedef struct AVCodecContext { * - encoding: set/allocated/freed by lavc. * - decoding: set/allocated/freed by user. */ - void *extradata; + uint8_t *extradata; int extradata_size; /** @@ -1200,6 +1237,7 @@ typedef struct AVCodecContext { #define FF_IDCT_IPP 13 #define FF_IDCT_XVIDMMX 14 #define FF_IDCT_CAVS 15 +#define FF_IDCT_SIMPLEARMV5TE 16 /** * slice count. @@ -1863,7 +1901,7 @@ typedef struct AVCodecContext { * - encoding: set by user. * - decoding: unused */ - int crf; + float crf; /** * constant quantization parameter rate control method @@ -2029,6 +2067,13 @@ typedef struct AVCodecContext { * - decoding: unused. */ int max_partition_order; + + /** + * GOP timecode frame start number, in non drop frame format + * - encoding: set by user. + * - decoding: unused. + */ + int64_t timecode_frame_start; } AVCodecContext; /** @@ -2067,6 +2112,7 @@ typedef struct AVPicture { * AVPaletteControl * This structure defines a method for communicating palette changes * between and demuxer and a decoder. + * this is totally broken, palette changes should be sent as AVPackets */ #define AVPALETTE_SIZE 1024 #define AVPALETTE_COUNT 256 @@ -2082,7 +2128,7 @@ typedef struct AVPaletteControl { * data is probably 6 bits in size and needs to be scaled */ unsigned int palette[AVPALETTE_COUNT]; -} AVPaletteControl; +} AVPaletteControl attribute_deprecated; typedef struct AVSubtitleRect { uint16_t x; @@ -2109,6 +2155,7 @@ extern AVCodec mp3lame_encoder; extern AVCodec oggvorbis_encoder; extern AVCodec faac_encoder; extern AVCodec flac_encoder; +extern AVCodec gif_encoder; extern AVCodec xvid_encoder; extern AVCodec mpeg1video_encoder; extern AVCodec mpeg2video_encoder; @@ -2142,6 +2189,7 @@ extern AVCodec asv2_encoder; extern AVCodec vcr1_encoder; extern AVCodec ffv1_encoder; extern AVCodec snow_encoder; +extern AVCodec vorbis_encoder; extern AVCodec mdec_encoder; extern AVCodec zlib_encoder; extern AVCodec sonic_encoder; @@ -2149,6 +2197,7 @@ extern AVCodec sonic_ls_encoder; extern AVCodec svq1_encoder; extern AVCodec x264_encoder; +extern AVCodec gif_decoder; extern AVCodec h263_decoder; extern AVCodec h261_decoder; extern AVCodec mpeg4_decoder; @@ -2196,6 +2245,9 @@ extern AVCodec h264_decoder; extern AVCodec indeo3_decoder; extern AVCodec vp3_decoder; extern AVCodec theora_decoder; +extern AVCodec vp5_decoder; +extern AVCodec vp6_decoder; +extern AVCodec vp6f_decoder; extern AVCodec amr_nb_decoder; extern AVCodec amr_nb_encoder; extern AVCodec amr_wb_encoder; @@ -2264,6 +2316,14 @@ extern AVCodec smackaud_decoder; extern AVCodec kmvc_decoder; extern AVCodec flashsv_decoder; extern AVCodec cavs_decoder; +extern AVCodec vmnc_decoder; +extern AVCodec wavpack_decoder; +extern AVCodec targa_decoder; +extern AVCodec dsicinvideo_decoder; +extern AVCodec dsicinaudio_decoder; +extern AVCodec tiertexseqvideo_decoder; +extern AVCodec tiff_decoder; +extern AVCodec imc_decoder; /* pcm codecs */ #define PCM_CODEC(id, name) \ @@ -2456,6 +2516,17 @@ int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, v */ int avcodec_open(AVCodecContext *avctx, AVCodec *codec); +/** + * Decode an audio frame. + * + * @param avctx the codec context. + * @param samples output buffer, 16 byte aligned + * @param frame_size_ptr the output buffer size in bytes, zero if no frame could be compressed + * @param buf input buffer, 16 byte aligned + * @param buf_size the input buffer size + * @return 0 if successful, -1 if not. + */ + int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, uint8_t *buf, int buf_size); @@ -2598,12 +2669,12 @@ void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); extern AVBitStreamFilter dump_extradata_bsf; extern AVBitStreamFilter remove_extradata_bsf; extern AVBitStreamFilter noise_bsf; +extern AVBitStreamFilter mp3_header_compress_bsf; +extern AVBitStreamFilter mp3_header_decompress_bsf; +extern AVBitStreamFilter mjpega_dump_header_bsf; /* memory */ -void *av_mallocz(unsigned int size); -char *av_strdup(const char *s); -void av_freep(void *ptr); void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size); /* for static data only */ /* call av_free_static to release all staticaly allocated tables */ diff --git a/src/libffmpeg/libavcodec/avs.c b/src/libffmpeg/libavcodec/avs.c index 557e9becb..953aea1be 100644 --- a/src/libffmpeg/libavcodec/avs.c +++ b/src/libffmpeg/libavcodec/avs.c @@ -2,18 +2,20 @@ * AVS video decoder. * Copyright (c) 2006 Aurelien Jacobs * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/bitstream.c b/src/libffmpeg/libavcodec/bitstream.c index 49c6ece1b..22d256df5 100755 --- a/src/libffmpeg/libavcodec/bitstream.c +++ b/src/libffmpeg/libavcodec/bitstream.c @@ -3,18 +3,20 @@ * Copyright (c) 2000, 2001 Fabrice Bellard. * Copyright (c) 2002-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * alternative bitstream reader & writer by Michael Niedermayer @@ -47,47 +49,6 @@ void ff_put_string(PutBitContext * pbc, char *s, int put_zero) put_bits(pbc, 8, 0); } -/* bit input functions */ - -/** - * reads 0-32 bits. - */ -unsigned int get_bits_long(GetBitContext *s, int n){ - if(n<=17) return get_bits(s, n); - else{ - int ret= get_bits(s, 16) << (n-16); - return ret | get_bits(s, n-16); - } -} - -/** - * shows 0-32 bits. - */ -unsigned int show_bits_long(GetBitContext *s, int n){ - if(n<=17) return show_bits(s, n); - else{ - GetBitContext gb= *s; - int ret= get_bits_long(s, n); - *s= gb; - return ret; - } -} - -void align_get_bits(GetBitContext *s) -{ - int n= (-get_bits_count(s)) & 7; - if(n) skip_bits(s, n); -} - -int check_marker(GetBitContext *s, const char *msg) -{ - int bit= get_bits1(s); - if(!bit) - av_log(NULL, AV_LOG_INFO, "Marker bit missing %s\n", msg); - - return bit; -} - /* VLC decoding */ //#define DEBUG_VLC diff --git a/src/libffmpeg/libavcodec/bitstream.h b/src/libffmpeg/libavcodec/bitstream.h index 10db64d33..af25b6dcf 100644 --- a/src/libffmpeg/libavcodec/bitstream.h +++ b/src/libffmpeg/libavcodec/bitstream.h @@ -1,3 +1,23 @@ +/* + * copyright (c) 2004 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + /** * @file bitstream.h * bitstream api header. @@ -6,17 +26,28 @@ #ifndef BITSTREAM_H #define BITSTREAM_H +#include "log.h" + +#if defined(ALT_BITSTREAM_READER_LE) && !defined(ALT_BITSTREAM_READER) +#define ALT_BITSTREAM_READER +#endif + //#define ALT_BITSTREAM_WRITER //#define ALIGNED_BITSTREAM_WRITER - +#if !defined(LIBMPEG2_BITSTREAM_READER) && !defined(A32_BITSTREAM_READER) && !defined(ALT_BITSTREAM_READER) +# ifdef ARCH_ARMV4L +# define A32_BITSTREAM_READER +# else #define ALT_BITSTREAM_READER //#define LIBMPEG2_BITSTREAM_READER //#define A32_BITSTREAM_READER +# endif +#endif #define LIBMPEG2_BITSTREAM_READER_HACK //add BERO extern const uint8_t ff_reverse[256]; -#if defined(ARCH_X86) || defined(ARCH_X86_64) +#if defined(ARCH_X86) // avoid +32 for shift optimization (gcc should do that ...) static inline int32_t NEG_SSR32( int32_t a, int8_t s){ asm ("sarl %1, %0\n\t" @@ -140,7 +171,7 @@ typedef struct RL_VLC_ELEM { #endif /* used to avoid missaligned exceptions on some archs (alpha, ...) */ -#if defined(ARCH_X86) || defined(ARCH_X86_64) +#if defined(ARCH_X86) # define unaligned16(a) (*(const uint16_t*)(a)) # define unaligned32(a) (*(const uint32_t*)(a)) # define unaligned64(a) (*(const uint64_t*)(a)) @@ -169,7 +200,7 @@ unaligned(16) unaligned(32) unaligned(64) #undef unaligned -#endif //!ARCH_X86 +#endif /* defined(ARCH_X86) */ #ifndef ALT_BITSTREAM_WRITER static inline void put_bits(PutBitContext *s, int n, unsigned int value) @@ -216,7 +247,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) static inline void put_bits(PutBitContext *s, int n, unsigned int value) { # ifdef ALIGNED_BITSTREAM_WRITER -# if defined(ARCH_X86) || defined(ARCH_X86_64) +# if defined(ARCH_X86) asm volatile( "movl %0, %%ecx \n\t" "xorl %%eax, %%eax \n\t" @@ -247,7 +278,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) s->index= index; # endif # else //ALIGNED_BITSTREAM_WRITER -# if defined(ARCH_X86) || defined(ARCH_X86_64) +# if defined(ARCH_X86) asm volatile( "movl $7, %%ecx \n\t" "andl %0, %%ecx \n\t" @@ -429,13 +460,16 @@ static inline int unaligned32_le(const void *v) # ifdef ALT_BITSTREAM_READER_LE # define SHOW_UBITS(name, gb, num)\ ((name##_cache) & (NEG_USR32(0xffffffff,num))) + +# define SHOW_SBITS(name, gb, num)\ + NEG_SSR32((name##_cache)<<(32-(num)), num) # else # define SHOW_UBITS(name, gb, num)\ NEG_USR32(name##_cache, num) -# endif # define SHOW_SBITS(name, gb, num)\ NEG_SSR32(name##_cache, num) +# endif # define GET_CACHE(name, gb)\ ((uint32_t)name##_cache) @@ -443,6 +477,11 @@ static inline int unaligned32_le(const void *v) static inline int get_bits_count(GetBitContext *s){ return s->index; } + +static inline void skip_bits_long(GetBitContext *s, int n){ + s->index += n; +} + #elif defined LIBMPEG2_BITSTREAM_READER //libmpeg2 like reader @@ -506,6 +545,16 @@ static inline int get_bits_count(GetBitContext *s){ return (s->buffer_ptr - s->buffer)*8 - 16 + s->bit_count; } +static inline void skip_bits_long(GetBitContext *s, int n){ + OPEN_READER(re, s) + re_bit_count += n; + re_buffer_ptr += 2*(re_bit_count>>4); + re_bit_count &= 15; + re_cache = ((re_buffer_ptr[-2]<<8) + re_buffer_ptr[-1]) << (16+re_bit_count); + UPDATE_CACHE(re, s) + CLOSE_READER(re, s) +} + #elif defined A32_BITSTREAM_READER # define MIN_CACHE_BITS 32 @@ -531,13 +580,13 @@ static inline int get_bits_count(GetBitContext *s){ name##_bit_count-= 32;\ }\ -#if defined(ARCH_X86) || defined(ARCH_X86_64) +#if defined(ARCH_X86) # define SKIP_CACHE(name, gb, num)\ asm(\ "shldl %2, %1, %0 \n\t"\ "shll %2, %1 \n\t"\ : "+r" (name##_cache0), "+r" (name##_cache1)\ - : "Ic" ((uint8_t)num)\ + : "Ic" ((uint8_t)(num))\ ); #else # define SKIP_CACHE(name, gb, num)\ @@ -571,6 +620,17 @@ static inline int get_bits_count(GetBitContext *s){ return ((uint8_t*)s->buffer_ptr - s->buffer)*8 - 32 + s->bit_count; } +static inline void skip_bits_long(GetBitContext *s, int n){ + OPEN_READER(re, s) + re_bit_count += n; + re_buffer_ptr += re_bit_count>>5; + re_bit_count &= 31; + re_cache0 = be2me_32( re_buffer_ptr[-1] ) << re_bit_count; + re_cache1 = 0; + UPDATE_CACHE(re, s) + CLOSE_READER(re, s) +} + #endif /** @@ -615,8 +675,6 @@ static inline unsigned int get_bits(GetBitContext *s, int n){ return tmp; } -unsigned int get_bits_long(GetBitContext *s, int n); - /** * shows 0-17 bits. * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't @@ -630,8 +688,6 @@ static inline unsigned int show_bits(GetBitContext *s, int n){ return tmp; } -unsigned int show_bits_long(GetBitContext *s, int n); - static inline void skip_bits(GetBitContext *s, int n){ //Note gcc seems to optimize this to s->index+=n for the ALT_READER :)) OPEN_READER(re, s) @@ -668,6 +724,44 @@ static inline void skip_bits1(GetBitContext *s){ skip_bits(s, 1); } +/** + * reads 0-32 bits. + */ +static inline unsigned int get_bits_long(GetBitContext *s, int n){ + if(n<=17) return get_bits(s, n); + else{ +#ifdef ALT_BITSTREAM_READER_LE + int ret= get_bits(s, 16); + return ret | (get_bits(s, n-16) << 16); +#else + int ret= get_bits(s, 16) << (n-16); + return ret | get_bits(s, n-16); +#endif + } +} + +/** + * shows 0-32 bits. + */ +static inline unsigned int show_bits_long(GetBitContext *s, int n){ + if(n<=17) return show_bits(s, n); + else{ + GetBitContext gb= *s; + int ret= get_bits_long(s, n); + *s= gb; + return ret; + } +} + +static inline int check_marker(GetBitContext *s, const char *msg) +{ + int bit= get_bits1(s); + if(!bit) + av_log(NULL, AV_LOG_INFO, "Marker bit missing %s\n", msg); + + return bit; +} + /** * init GetBitContext. * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes larger then the actual read bits @@ -689,38 +783,22 @@ static inline void init_get_bits(GetBitContext *s, #ifdef ALT_BITSTREAM_READER s->index=0; #elif defined LIBMPEG2_BITSTREAM_READER -#ifdef LIBMPEG2_BITSTREAM_READER_HACK - if ((int)buffer&1) { - /* word alignment */ - s->cache = (*buffer++)<<24; - s->buffer_ptr = buffer; - s->bit_count = 16-8; - } else -#endif - { - s->buffer_ptr = buffer; - s->bit_count = 16; - s->cache = 0; - } + s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1)); + s->bit_count = 16 + 8*((intptr_t)buffer&1); + skip_bits_long(s, 0); #elif defined A32_BITSTREAM_READER - s->buffer_ptr = (uint32_t*)buffer; - s->bit_count = 32; - s->cache0 = 0; - s->cache1 = 0; -#endif - { - OPEN_READER(re, s) - UPDATE_CACHE(re, s) - UPDATE_CACHE(re, s) - CLOSE_READER(re, s) - } -#ifdef A32_BITSTREAM_READER - s->cache1 = 0; + s->buffer_ptr = (uint32_t*)((intptr_t)buffer&(~3)); + s->bit_count = 32 + 8*((intptr_t)buffer&3); + skip_bits_long(s, 0); #endif } -int check_marker(GetBitContext *s, const char *msg); -void align_get_bits(GetBitContext *s); +static inline void align_get_bits(GetBitContext *s) +{ + int n= (-get_bits_count(s)) & 7; + if(n) skip_bits(s, n); +} + int init_vlc(VLC *vlc, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size, @@ -816,7 +894,6 @@ static always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], //#define TRACE #ifdef TRACE -#include "avcodec.h" static inline void print_bin(int bits, int n){ int i; diff --git a/src/libffmpeg/libavcodec/bytestream.h b/src/libffmpeg/libavcodec/bytestream.h new file mode 100644 index 000000000..25c457fe4 --- /dev/null +++ b/src/libffmpeg/libavcodec/bytestream.h @@ -0,0 +1,89 @@ +/* + * Bytestream functions + * copyright (c) 2006 Baptiste Coudurier + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef FFMPEG_BYTESTREAM_H +#define FFMPEG_BYTESTREAM_H + +static always_inline unsigned int bytestream_get_le32(uint8_t **b) +{ + (*b) += 4; + return LE_32(*b - 4); +} + +static always_inline unsigned int bytestream_get_le16(uint8_t **b) +{ + (*b) += 2; + return LE_16(*b - 2); +} + +static always_inline unsigned int bytestream_get_byte(uint8_t **b) +{ + (*b)++; + return (*b)[-1]; +} + +static always_inline unsigned int bytestream_get_buffer(uint8_t **b, uint8_t *dst, unsigned int size) +{ + memcpy(dst, *b, size); + (*b) += size; + return size; +} + +static always_inline void bytestream_put_be32(uint8_t **b, const unsigned int value) +{ + *(*b)++ = value >> 24; + *(*b)++ = value >> 16; + *(*b)++ = value >> 8; + *(*b)++ = value; +}; + +static always_inline void bytestream_put_be16(uint8_t **b, const unsigned int value) +{ + *(*b)++ = value >> 8; + *(*b)++ = value; +} + +static always_inline void bytestream_put_le32(uint8_t **b, const unsigned int value) +{ + *(*b)++ = value; + *(*b)++ = value >> 8; + *(*b)++ = value >> 16; + *(*b)++ = value >> 24; +} + +static always_inline void bytestream_put_le16(uint8_t **b, const unsigned int value) +{ + *(*b)++ = value; + *(*b)++ = value >> 8; +} + +static always_inline void bytestream_put_byte(uint8_t **b, const unsigned int value) +{ + *(*b)++ = value; +} + +static always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size) +{ + memcpy(*b, src, size); + (*b) += size; +} + +#endif /* FFMPEG_BYTESTREAM_H */ diff --git a/src/libffmpeg/libavcodec/cabac.c b/src/libffmpeg/libavcodec/cabac.c index 88790a960..c6da6292a 100644 --- a/src/libffmpeg/libavcodec/cabac.c +++ b/src/libffmpeg/libavcodec/cabac.c @@ -2,18 +2,20 @@ * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder * Copyright (c) 2003 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -29,7 +31,7 @@ #include "bitstream.h" #include "cabac.h" -const uint8_t ff_h264_lps_range[64][4]= { +static const uint8_t lps_range[64][4]= { {128,176,208,240}, {128,167,197,227}, {128,158,187,216}, {123,150,178,205}, {116,142,169,195}, {111,135,160,185}, {105,128,152,175}, {100,122,144,166}, { 95,116,137,158}, { 90,110,130,150}, { 85,104,123,142}, { 81, 99,117,135}, @@ -48,7 +50,12 @@ const uint8_t ff_h264_lps_range[64][4]= { { 6, 8, 9, 11}, { 6, 7, 9, 10}, { 6, 7, 8, 9}, { 2, 2, 2, 2}, }; -const uint8_t ff_h264_mps_state[64]= { +uint8_t ff_h264_mlps_state[4*64]; +uint8_t ff_h264_lps_range[4*2*64]; +uint8_t ff_h264_lps_state[2*64]; +uint8_t ff_h264_mps_state[2*64]; + +static const uint8_t mps_state[64]= { 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24, @@ -59,7 +66,7 @@ const uint8_t ff_h264_mps_state[64]= { 57,58,59,60,61,62,62,63, }; -const uint8_t ff_h264_lps_state[64]= { +static const uint8_t lps_state[64]= { 0, 0, 1, 2, 2, 4, 4, 5, 6, 7, 8, 9, 9,11,11,12, 13,13,15,15,16,16,18,18, @@ -69,25 +76,40 @@ const uint8_t ff_h264_lps_state[64]= { 33,33,34,34,35,35,35,36, 36,36,37,37,37,38,38,63, }; - -const uint8_t ff_h264_norm_shift[256]= { - 8,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4, - 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +#if 0 +const uint8_t ff_h264_norm_shift_old[128]= { + 7,6,5,5,4,4,4,4,3,3,3,3,3,3,3,3, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,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,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,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,0,0,0,0,0,0,0,0, }; +#endif +const uint8_t ff_h264_norm_shift[512]= { + 9,8,7,7,6,6,6,6,5,5,5,5,5,5,5,5, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,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,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,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,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,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,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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; /** * @@ -122,28 +144,37 @@ void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size){ c->low = (*c->bytestream++)<<10; #endif c->low+= ((*c->bytestream++)<<2) + 2; - c->range= 0x1FE<<(CABAC_BITS + 1); + c->range= 0x1FE; } -void ff_init_cabac_states(CABACContext *c, uint8_t const (*lps_range)[4], - uint8_t const *mps_state, uint8_t const *lps_state, int state_count){ +void ff_init_cabac_states(CABACContext *c){ int i, j; - for(i=0; ilps_range[2*i+0][j+4]= - c->lps_range[2*i+1][j+4]= lps_range[i][j]; + ff_h264_lps_range[j*2*64+2*i+0]= + ff_h264_lps_range[j*2*64+2*i+1]= lps_range[i][j]; } - c->mps_state[2*i+0]= 2*mps_state[i]; - c->mps_state[2*i+1]= 2*mps_state[i]+1; + ff_h264_mlps_state[128+2*i+0]= + ff_h264_mps_state[2*i+0]= 2*mps_state[i]+0; + ff_h264_mlps_state[128+2*i+1]= + ff_h264_mps_state[2*i+1]= 2*mps_state[i]+1; if( i ){ - c->lps_state[2*i+0]= 2*lps_state[i]; - c->lps_state[2*i+1]= 2*lps_state[i]+1; +#ifdef BRANCHLESS_CABAC_DECODER + ff_h264_mlps_state[128-2*i-1]= 2*lps_state[i]+0; + ff_h264_mlps_state[128-2*i-2]= 2*lps_state[i]+1; }else{ - c->lps_state[2*i+0]= 1; - c->lps_state[2*i+1]= 0; + ff_h264_mlps_state[128-2*i-1]= 1; + ff_h264_mlps_state[128-2*i-2]= 0; +#else + ff_h264_lps_state[2*i+0]= 2*lps_state[i]+0; + ff_h264_lps_state[2*i+1]= 2*lps_state[i]+1; + }else{ + ff_h264_lps_state[2*i+0]= 1; + ff_h264_lps_state[2*i+1]= 0; +#endif } } } diff --git a/src/libffmpeg/libavcodec/cabac.h b/src/libffmpeg/libavcodec/cabac.h index e79774157..43fe78e3b 100644 --- a/src/libffmpeg/libavcodec/cabac.h +++ b/src/libffmpeg/libavcodec/cabac.h @@ -2,18 +2,20 @@ * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder * Copyright (c) 2003 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -26,9 +28,14 @@ //#undef NDEBUG #include +#ifdef ARCH_X86 +#include "x86_cpu.h" +#endif -#define CABAC_BITS 8 +#define CABAC_BITS 16 #define CABAC_MASK ((1<lps_range[*state][c->range>>6]; +static void put_cabac(CABACContext *c, uint8_t * const state, int bit){ + int RangeLPS= ff_h264_lps_range[2*(c->range&0xC0) + *state]; if(bit == ((*state)&1)){ c->range -= RangeLPS; - *state= c->mps_state[*state]; + *state= ff_h264_mps_state[*state]; }else{ c->low += c->range - RangeLPS; c->range = RangeLPS; - *state= c->lps_state[*state]; + *state= ff_h264_lps_state[*state]; } renorm_cabac_encoder(c); @@ -102,7 +106,7 @@ static inline void put_cabac(CABACContext *c, uint8_t * const state, int bit){ #endif } -static inline void put_cabac_static(CABACContext *c, int RangeLPS, int bit){ +static void put_cabac_static(CABACContext *c, int RangeLPS, int bit){ assert(c->range > RangeLPS); if(!bit){ @@ -122,7 +126,7 @@ static inline void put_cabac_static(CABACContext *c, int RangeLPS, int bit){ /** * @param bit 0 -> write zero bit, !=0 write one bit */ -static inline void put_cabac_bypass(CABACContext *c, int bit){ +static void put_cabac_bypass(CABACContext *c, int bit){ c->low += c->low; if(bit){ @@ -148,7 +152,7 @@ static inline void put_cabac_bypass(CABACContext *c, int bit){ * * @return the number of bytes written */ -static inline int put_cabac_terminate(CABACContext *c, int bit){ +static int put_cabac_terminate(CABACContext *c, int bit){ c->range -= 2; if(!bit){ @@ -176,7 +180,7 @@ static inline int put_cabac_terminate(CABACContext *c, int bit){ /** * put (truncated) unary binarization. */ -static inline void put_cabac_u(CABACContext *c, uint8_t * state, int v, int max, int max_index, int truncated){ +static void put_cabac_u(CABACContext *c, uint8_t * state, int v, int max, int max_index, int truncated){ int i; assert(v <= max); @@ -211,7 +215,7 @@ static inline void put_cabac_u(CABACContext *c, uint8_t * state, int v, int max, /** * put unary exp golomb k-th order binarization. */ -static inline void put_cabac_ueg(CABACContext *c, uint8_t * state, int v, int max, int is_signed, int k, int max_index){ +static void put_cabac_ueg(CABACContext *c, uint8_t * state, int v, int max, int is_signed, int k, int max_index){ int i; if(v==0) @@ -219,7 +223,7 @@ static inline void put_cabac_ueg(CABACContext *c, uint8_t * state, int v, int ma else{ const int sign= v < 0; - if(is_signed) v= ABS(v); + if(is_signed) v= FFABS(v); if(vbytestream <= c->bytestream_end) #if CABAC_BITS == 16 - c->low+= ((c->bytestream[0]<<9) + (c->bytestream[1])<<1); + c->low+= (c->bytestream[0]<<9) + (c->bytestream[1]<<1); #else c->low+= c->bytestream[0]<<1; #endif @@ -264,16 +267,14 @@ static void refill(CABACContext *c){ c->bytestream+= CABAC_BITS/8; } -#if 0 /* all use commented */ static void refill2(CABACContext *c){ int i, x; x= c->low ^ (c->low-1); - i= 8 - ff_h264_norm_shift[x>>(CABAC_BITS+1)]; + i= 7 - ff_h264_norm_shift[x>>(CABAC_BITS-1)]; x= -CABAC_MASK; - if(c->bytestream < c->bytestream_end) #if CABAC_BITS == 16 x+= (c->bytestream[0]<<9) + (c->bytestream[1]<<1); #else @@ -283,10 +284,9 @@ static void refill2(CABACContext *c){ c->low += x<bytestream+= CABAC_BITS/8; } -#endif static inline void renorm_cabac_decoder(CABACContext *c){ - while(c->range < (0x200 << CABAC_BITS)){ + while(c->range < 0x100){ c->range+= c->range; c->low+= c->low; if(!(c->low & CABAC_MASK)) @@ -295,76 +295,506 @@ static inline void renorm_cabac_decoder(CABACContext *c){ } static inline void renorm_cabac_decoder_once(CABACContext *c){ - int mask= (c->range - (0x200 << CABAC_BITS))>>31; - c->range+= c->range&mask; - c->low += c->low &mask; +#ifdef ARCH_X86_DISABLED + int temp; +#if 0 + //P3:683 athlon:475 + asm( + "lea -0x100(%0), %2 \n\t" + "shr $31, %2 \n\t" //FIXME 31->63 for x86-64 + "shl %%cl, %0 \n\t" + "shl %%cl, %1 \n\t" + : "+r"(c->range), "+r"(c->low), "+c"(temp) + ); +#elif 0 + //P3:680 athlon:474 + asm( + "cmp $0x100, %0 \n\t" + "setb %%cl \n\t" //FIXME 31->63 for x86-64 + "shl %%cl, %0 \n\t" + "shl %%cl, %1 \n\t" + : "+r"(c->range), "+r"(c->low), "+c"(temp) + ); +#elif 1 + int temp2; + //P3:665 athlon:517 + asm( + "lea -0x100(%0), %%eax \n\t" + "cdq \n\t" + "mov %0, %%eax \n\t" + "and %%edx, %0 \n\t" + "and %1, %%edx \n\t" + "add %%eax, %0 \n\t" + "add %%edx, %1 \n\t" + : "+r"(c->range), "+r"(c->low), "+a"(temp), "+d"(temp2) + ); +#elif 0 + int temp2; + //P3:673 athlon:509 + asm( + "cmp $0x100, %0 \n\t" + "sbb %%edx, %%edx \n\t" + "mov %0, %%eax \n\t" + "and %%edx, %0 \n\t" + "and %1, %%edx \n\t" + "add %%eax, %0 \n\t" + "add %%edx, %1 \n\t" + : "+r"(c->range), "+r"(c->low), "+a"(temp), "+d"(temp2) + ); +#else + int temp2; + //P3:677 athlon:511 + asm( + "cmp $0x100, %0 \n\t" + "lea (%0, %0), %%eax \n\t" + "lea (%1, %1), %%edx \n\t" + "cmovb %%eax, %0 \n\t" + "cmovb %%edx, %1 \n\t" + : "+r"(c->range), "+r"(c->low), "+a"(temp), "+d"(temp2) + ); +#endif +#else + //P3:675 athlon:476 + int shift= (uint32_t)(c->range - 0x100)>>31; + c->range<<= shift; + c->low <<= shift; +#endif if(!(c->low & CABAC_MASK)) refill(c); } -static inline int get_cabac(CABACContext *c, uint8_t * const state){ - int RangeLPS= c->lps_range[*state][c->range>>(CABAC_BITS+7)]<<(CABAC_BITS+1); +static int always_inline get_cabac_inline(CABACContext *c, uint8_t * const state){ + //FIXME gcc generates duplicate load/stores for c->low and c->range +#define LOW "0" +#define RANGE "4" +#ifdef ARCH_X86_64 +#define BYTESTART "16" +#define BYTE "24" +#define BYTEEND "32" +#else +#define BYTESTART "12" +#define BYTE "16" +#define BYTEEND "20" +#endif +#if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) + int bit; + +#ifndef BRANCHLESS_CABAC_DECODER + asm volatile( + "movzbl (%1), %0 \n\t" + "movl "RANGE "(%2), %%ebx \n\t" + "movl "RANGE "(%2), %%edx \n\t" + "andl $0xC0, %%ebx \n\t" + "movzbl "MANGLE(ff_h264_lps_range)"(%0, %%ebx, 2), %%esi\n\t" + "movl "LOW "(%2), %%ebx \n\t" +//eax:state ebx:low, edx:range, esi:RangeLPS + "subl %%esi, %%edx \n\t" + "movl %%edx, %%ecx \n\t" + "shll $17, %%ecx \n\t" + "cmpl %%ecx, %%ebx \n\t" + " ja 1f \n\t" + +#if 1 + //athlon:4067 P3:4110 + "lea -0x100(%%edx), %%ecx \n\t" + "shr $31, %%ecx \n\t" + "shl %%cl, %%edx \n\t" + "shl %%cl, %%ebx \n\t" +#else + //athlon:4057 P3:4130 + "cmp $0x100, %%edx \n\t" //FIXME avoidable + "setb %%cl \n\t" + "shl %%cl, %%edx \n\t" + "shl %%cl, %%ebx \n\t" +#endif + "movzbl "MANGLE(ff_h264_mps_state)"(%0), %%ecx \n\t" + "movb %%cl, (%1) \n\t" +//eax:state ebx:low, edx:range, esi:RangeLPS + "test %%bx, %%bx \n\t" + " jnz 2f \n\t" + "mov "BYTE "(%2), %%"REG_S" \n\t" + "subl $0xFFFF, %%ebx \n\t" + "movzwl (%%"REG_S"), %%ecx \n\t" + "bswap %%ecx \n\t" + "shrl $15, %%ecx \n\t" + "add $2, %%"REG_S" \n\t" + "addl %%ecx, %%ebx \n\t" + "mov %%"REG_S", "BYTE "(%2) \n\t" + "jmp 2f \n\t" + "1: \n\t" +//eax:state ebx:low, edx:range, esi:RangeLPS + "subl %%ecx, %%ebx \n\t" + "movl %%esi, %%edx \n\t" + "movzbl " MANGLE(ff_h264_norm_shift) "(%%esi), %%ecx \n\t" + "shll %%cl, %%ebx \n\t" + "shll %%cl, %%edx \n\t" + "movzbl "MANGLE(ff_h264_lps_state)"(%0), %%ecx \n\t" + "movb %%cl, (%1) \n\t" + "add $1, %0 \n\t" + "test %%bx, %%bx \n\t" + " jnz 2f \n\t" + + "mov "BYTE "(%2), %%"REG_c" \n\t" + "movzwl (%%"REG_c"), %%esi \n\t" + "bswap %%esi \n\t" + "shrl $15, %%esi \n\t" + "subl $0xFFFF, %%esi \n\t" + "add $2, %%"REG_c" \n\t" + "mov %%"REG_c", "BYTE "(%2) \n\t" + + "leal -1(%%ebx), %%ecx \n\t" + "xorl %%ebx, %%ecx \n\t" + "shrl $15, %%ecx \n\t" + "movzbl " MANGLE(ff_h264_norm_shift) "(%%ecx), %%ecx \n\t" + "neg %%ecx \n\t" + "add $7, %%ecx \n\t" + + "shll %%cl , %%esi \n\t" + "addl %%esi, %%ebx \n\t" + "2: \n\t" + "movl %%edx, "RANGE "(%2) \n\t" + "movl %%ebx, "LOW "(%2) \n\t" + :"=&a"(bit) //FIXME this is fragile gcc either runs out of registers or misscompiles it (for example if "+a"(bit) or "+m"(*state) is used + :"r"(state), "r"(c) + : "%"REG_c, "%ebx", "%edx", "%"REG_S, "memory" + ); + bit&=1; +#else /* BRANCHLESS_CABAC_DECODER */ + + +#if defined CMOV_IS_FAST +#define BRANCHLESS_GET_CABAC_UPDATE(ret, cabac, statep, low, lowword, range, tmp, tmpbyte)\ + "mov "tmp" , %%ecx \n\t"\ + "shl $17 , "tmp" \n\t"\ + "cmp "low" , "tmp" \n\t"\ + "cmova %%ecx , "range" \n\t"\ + "sbb %%ecx , %%ecx \n\t"\ + "and %%ecx , "tmp" \n\t"\ + "sub "tmp" , "low" \n\t"\ + "xor %%ecx , "ret" \n\t" +#else /* CMOV_IS_FAST */ +#define BRANCHLESS_GET_CABAC_UPDATE(ret, cabac, statep, low, lowword, range, tmp, tmpbyte)\ + "mov "tmp" , %%ecx \n\t"\ + "shl $17 , "tmp" \n\t"\ + "sub "low" , "tmp" \n\t"\ + "sar $31 , "tmp" \n\t" /*lps_mask*/\ + "sub %%ecx , "range" \n\t" /*RangeLPS - range*/\ + "and "tmp" , "range" \n\t" /*(RangeLPS - range)&lps_mask*/\ + "add %%ecx , "range" \n\t" /*new range*/\ + "shl $17 , %%ecx \n\t"\ + "and "tmp" , %%ecx \n\t"\ + "sub %%ecx , "low" \n\t"\ + "xor "tmp" , "ret" \n\t" +#endif /* CMOV_IS_FAST */ + + +#define BRANCHLESS_GET_CABAC(ret, cabac, statep, low, lowword, range, tmp, tmpbyte)\ + "movzbl "statep" , "ret" \n\t"\ + "mov "range" , "tmp" \n\t"\ + "and $0xC0 , "range" \n\t"\ + "movzbl "MANGLE(ff_h264_lps_range)"("ret", "range", 2), "range" \n\t"\ + "sub "range" , "tmp" \n\t"\ + BRANCHLESS_GET_CABAC_UPDATE(ret, cabac, statep, low, lowword, range, tmp, tmpbyte)\ + "movzbl " MANGLE(ff_h264_norm_shift) "("range"), %%ecx \n\t"\ + "shl %%cl , "range" \n\t"\ + "movzbl "MANGLE(ff_h264_mlps_state)"+128("ret"), "tmp" \n\t"\ + "mov "tmpbyte" , "statep" \n\t"\ + "shl %%cl , "low" \n\t"\ + "test "lowword" , "lowword" \n\t"\ + " jnz 1f \n\t"\ + "mov "BYTE"("cabac"), %%"REG_c" \n\t"\ + "movzwl (%%"REG_c") , "tmp" \n\t"\ + "bswap "tmp" \n\t"\ + "shr $15 , "tmp" \n\t"\ + "sub $0xFFFF , "tmp" \n\t"\ + "add $2 , %%"REG_c" \n\t"\ + "mov %%"REG_c" , "BYTE "("cabac") \n\t"\ + "lea -1("low") , %%ecx \n\t"\ + "xor "low" , %%ecx \n\t"\ + "shr $15 , %%ecx \n\t"\ + "movzbl " MANGLE(ff_h264_norm_shift) "(%%ecx), %%ecx \n\t"\ + "neg %%ecx \n\t"\ + "add $7 , %%ecx \n\t"\ + "shl %%cl , "tmp" \n\t"\ + "add "tmp" , "low" \n\t"\ + "1: \n\t" + + asm volatile( + "movl "RANGE "(%2), %%esi \n\t" + "movl "LOW "(%2), %%ebx \n\t" + BRANCHLESS_GET_CABAC("%0", "%2", "(%1)", "%%ebx", "%%bx", "%%esi", "%%edx", "%%dl") + "movl %%esi, "RANGE "(%2) \n\t" + "movl %%ebx, "LOW "(%2) \n\t" + + :"=&a"(bit) + :"r"(state), "r"(c) + : "%"REG_c, "%ebx", "%edx", "%esi", "memory" + ); + bit&=1; +#endif /* BRANCHLESS_CABAC_DECODER */ +#else /* defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) */ + int s = *state; + int RangeLPS= ff_h264_lps_range[2*(c->range&0xC0) + s]; int bit, lps_mask attribute_unused; c->range -= RangeLPS; -#if 1 - if(c->low < c->range){ - bit= (*state)&1; - *state= c->mps_state[*state]; +#ifndef BRANCHLESS_CABAC_DECODER + if(c->low < (c->range<<17)){ + bit= s&1; + *state= ff_h264_mps_state[s]; renorm_cabac_decoder_once(c); }else{ -// int shift= ff_h264_norm_shift[RangeLPS>>17]; - bit= ((*state)&1)^1; - c->low -= c->range; - *state= c->lps_state[*state]; - c->range = RangeLPS; - renorm_cabac_decoder(c); -/* c->range = RangeLPS<low <<= shift; + bit= ff_h264_norm_shift[RangeLPS]; + c->low -= (c->range<<17); + *state= ff_h264_lps_state[s]; + c->range = RangeLPS<low <<= bit; + bit= (s&1)^1; + if(!(c->low & 0xFFFF)){ refill2(c); - }*/ + } } -#else - lps_mask= (c->range - c->low)>>31; +#else /* BRANCHLESS_CABAC_DECODER */ + lps_mask= ((c->range<<17) - c->low)>>31; - c->low -= c->range & lps_mask; + c->low -= (c->range<<17) & lps_mask; c->range += (RangeLPS - c->range) & lps_mask; - bit= ((*state)^lps_mask)&1; - *state= c->mps_state[(*state) - (128&lps_mask)]; + s^=lps_mask; + *state= (ff_h264_mlps_state+128)[s]; + bit= s&1; - lps_mask= ff_h264_norm_shift[c->range>>(CABAC_BITS+2)]; + lps_mask= ff_h264_norm_shift[c->range]; c->range<<= lps_mask; c->low <<= lps_mask; if(!(c->low & CABAC_MASK)) refill2(c); -#endif - +#endif /* BRANCHLESS_CABAC_DECODER */ +#endif /* defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) */ return bit; } -static inline int get_cabac_bypass(CABACContext *c){ +static int __attribute((noinline)) get_cabac_noinline(CABACContext *c, uint8_t * const state){ + return get_cabac_inline(c,state); +} + +static int get_cabac(CABACContext *c, uint8_t * const state){ + return get_cabac_inline(c,state); +} + +static int get_cabac_bypass(CABACContext *c){ +#if 0 //not faster + int bit; + asm volatile( + "movl "RANGE "(%1), %%ebx \n\t" + "movl "LOW "(%1), %%eax \n\t" + "shl $17, %%ebx \n\t" + "add %%eax, %%eax \n\t" + "sub %%ebx, %%eax \n\t" + "cdq \n\t" + "and %%edx, %%ebx \n\t" + "add %%ebx, %%eax \n\t" + "test %%ax, %%ax \n\t" + " jnz 1f \n\t" + "movl "BYTE "(%1), %%"REG_b" \n\t" + "subl $0xFFFF, %%eax \n\t" + "movzwl (%%"REG_b"), %%ecx \n\t" + "bswap %%ecx \n\t" + "shrl $15, %%ecx \n\t" + "addl $2, %%"REG_b" \n\t" + "addl %%ecx, %%eax \n\t" + "movl %%"REG_b", "BYTE "(%1) \n\t" + "1: \n\t" + "movl %%eax, "LOW "(%1) \n\t" + + :"=&d"(bit) + :"r"(c) + : "%eax", "%"REG_b, "%ecx", "memory" + ); + return bit+1; +#else + int range; c->low += c->low; if(!(c->low & CABAC_MASK)) refill(c); - if(c->low < c->range){ + range= c->range<<17; + if(c->low < range){ return 0; }else{ - c->low -= c->range; + c->low -= range; return 1; } +#endif } + +static always_inline int get_cabac_bypass_sign(CABACContext *c, int val){ +#if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) + asm volatile( + "movl "RANGE "(%1), %%ebx \n\t" + "movl "LOW "(%1), %%eax \n\t" + "shl $17, %%ebx \n\t" + "add %%eax, %%eax \n\t" + "sub %%ebx, %%eax \n\t" + "cdq \n\t" + "and %%edx, %%ebx \n\t" + "add %%ebx, %%eax \n\t" + "xor %%edx, %%ecx \n\t" + "sub %%edx, %%ecx \n\t" + "test %%ax, %%ax \n\t" + " jnz 1f \n\t" + "mov "BYTE "(%1), %%"REG_b" \n\t" + "subl $0xFFFF, %%eax \n\t" + "movzwl (%%"REG_b"), %%edx \n\t" + "bswap %%edx \n\t" + "shrl $15, %%edx \n\t" + "add $2, %%"REG_b" \n\t" + "addl %%edx, %%eax \n\t" + "mov %%"REG_b", "BYTE "(%1) \n\t" + "1: \n\t" + "movl %%eax, "LOW "(%1) \n\t" + + :"+c"(val) + :"r"(c) + : "%eax", "%"REG_b, "%edx", "memory" + ); + return val; +#else + int range, mask; + c->low += c->low; + + if(!(c->low & CABAC_MASK)) + refill(c); + + range= c->range<<17; + c->low -= range; + mask= c->low >> 31; + range &= mask; + c->low += range; + return (val^mask)-mask; +#endif +} + +//FIXME the x86 code from this file should be moved into i386/h264 or cabac something.c/h (note ill kill you if you move my code away from under my fingers before iam finished with it!) +//FIXME use some macros to avoid duplicatin get_cabac (cant be done yet as that would make optimization work hard) +#if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) +static int decode_significance_x86(CABACContext *c, int max_coeff, uint8_t *significant_coeff_ctx_base, int *index){ + void *end= significant_coeff_ctx_base + max_coeff - 1; + int minusstart= -(int)significant_coeff_ctx_base; + int minusindex= 4-(int)index; + int coeff_count; + asm volatile( + "movl "RANGE "(%3), %%esi \n\t" + "movl "LOW "(%3), %%ebx \n\t" + + "2: \n\t" + + BRANCHLESS_GET_CABAC("%%edx", "%3", "(%1)", "%%ebx", "%%bx", "%%esi", "%%eax", "%%al") + + "test $1, %%edx \n\t" + " jz 3f \n\t" + + BRANCHLESS_GET_CABAC("%%edx", "%3", "61(%1)", "%%ebx", "%%bx", "%%esi", "%%eax", "%%al") + + "mov %2, %%"REG_a" \n\t" + "movl %4, %%ecx \n\t" + "add %1, %%"REG_c" \n\t" + "movl %%ecx, (%%"REG_a") \n\t" + + "test $1, %%edx \n\t" + " jnz 4f \n\t" + + "add $4, %%"REG_a" \n\t" + "mov %%"REG_a", %2 \n\t" + + "3: \n\t" + "add $1, %1 \n\t" + "cmp %5, %1 \n\t" + " jb 2b \n\t" + "mov %2, %%"REG_a" \n\t" + "movl %4, %%ecx \n\t" + "add %1, %%"REG_c" \n\t" + "movl %%ecx, (%%"REG_a") \n\t" + "4: \n\t" + "add %6, %%eax \n\t" + "shr $2, %%eax \n\t" + + "movl %%esi, "RANGE "(%3) \n\t" + "movl %%ebx, "LOW "(%3) \n\t" + :"=&a"(coeff_count), "+r"(significant_coeff_ctx_base), "+m"(index)\ + :"r"(c), "m"(minusstart), "m"(end), "m"(minusindex)\ + : "%"REG_c, "%ebx", "%edx", "%esi", "memory"\ + ); + return coeff_count; +} + +static int decode_significance_8x8_x86(CABACContext *c, uint8_t *significant_coeff_ctx_base, int *index, uint8_t *sig_off){ + int minusindex= 4-(int)index; + int coeff_count; + long last=0; + asm volatile( + "movl "RANGE "(%3), %%esi \n\t" + "movl "LOW "(%3), %%ebx \n\t" + + "mov %1, %%"REG_D" \n\t" + "2: \n\t" + + "mov %6, %%"REG_a" \n\t" + "movzbl (%%"REG_a", %%"REG_D"), %%edi \n\t" + "add %5, %%"REG_D" \n\t" + + BRANCHLESS_GET_CABAC("%%edx", "%3", "(%%"REG_D")", "%%ebx", "%%bx", "%%esi", "%%eax", "%%al") + + "mov %1, %%edi \n\t" + "test $1, %%edx \n\t" + " jz 3f \n\t" + + "movzbl "MANGLE(last_coeff_flag_offset_8x8)"(%%edi), %%edi\n\t" + "add %5, %%"REG_D" \n\t" + + BRANCHLESS_GET_CABAC("%%edx", "%3", "15(%%"REG_D")", "%%ebx", "%%bx", "%%esi", "%%eax", "%%al") + + "mov %2, %%"REG_a" \n\t" + "mov %1, %%edi \n\t" + "movl %%edi, (%%"REG_a") \n\t" + + "test $1, %%edx \n\t" + " jnz 4f \n\t" + + "add $4, %%"REG_a" \n\t" + "mov %%"REG_a", %2 \n\t" + + "3: \n\t" + "addl $1, %%edi \n\t" + "mov %%edi, %1 \n\t" + "cmpl $63, %%edi \n\t" + " jb 2b \n\t" + "mov %2, %%"REG_a" \n\t" + "movl %%edi, (%%"REG_a") \n\t" + "4: \n\t" + "addl %4, %%eax \n\t" + "shr $2, %%eax \n\t" + + "movl %%esi, "RANGE "(%3) \n\t" + "movl %%ebx, "LOW "(%3) \n\t" + :"=&a"(coeff_count),"+m"(last), "+m"(index)\ + :"r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base), "m"(sig_off)\ + : "%"REG_c, "%ebx", "%edx", "%esi", "%"REG_D, "memory"\ + ); + return coeff_count; +} +#endif /* defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) */ + /** * * @return the number of bytes read or 0 if no end */ -static inline int get_cabac_terminate(CABACContext *c){ - c->range -= 4<low < c->range){ +static int get_cabac_terminate(CABACContext *c){ + c->range -= 2; + if(c->low < c->range<<17){ renorm_cabac_decoder_once(c); return 0; }else{ @@ -375,7 +805,7 @@ static inline int get_cabac_terminate(CABACContext *c){ /** * get (truncated) unnary binarization. */ -static inline int get_cabac_u(CABACContext *c, uint8_t * state, int max, int max_index, int truncated){ +static int get_cabac_u(CABACContext *c, uint8_t * state, int max, int max_index, int truncated){ int i; for(i=0; i * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -29,6 +31,7 @@ #include "mpegvideo.h" #include "cavsdata.h" +#ifdef CONFIG_CAVS_DECODER typedef struct { MpegEncContext s; Picture picture; ///< currently decoded frame @@ -291,7 +294,7 @@ static void intra_pred_plane(uint8_t *d,uint8_t *top,uint8_t *left,int stride) { int x,y,ia; int ih = 0; int iv = 0; - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; for(x=0; x<4; x++) { ih += (x+1)*(top[5+x]-top[3-x]); @@ -1316,50 +1319,7 @@ static int decode_seq_header(AVSContext *h) { return 0; } -/** - * finds the end of the current frame in the bitstream. - * @return the position of the first byte of the next frame, or -1 - */ -int ff_cavs_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size) { - int pic_found, i; - uint32_t state; - - pic_found= pc->frame_start_found; - state= pc->state; - - i=0; - if(!pic_found){ - for(i=0; i SLICE_MAX_START_CODE){ - pc->frame_start_found=0; - pc->state=-1; - return i-3; - } - } - } - } - pc->frame_start_found= pic_found; - pc->state= state; - return END_NOT_FOUND; -} - -void ff_cavs_flush(AVCodecContext * avctx) { +static void cavs_flush(AVCodecContext * avctx) { AVSContext *h = avctx->priv_data; h->got_keyframe = 0; } @@ -1496,5 +1456,85 @@ AVCodec cavs_decoder = { cavs_decode_end, cavs_decode_frame, CODEC_CAP_DR1 | CODEC_CAP_DELAY, - .flush= ff_cavs_flush, + .flush= cavs_flush, +}; +#endif /* CONFIG_CAVS_DECODER */ + +#ifdef CONFIG_CAVSVIDEO_PARSER +/** + * finds the end of the current frame in the bitstream. + * @return the position of the first byte of the next frame, or -1 + */ +static int cavs_find_frame_end(ParseContext *pc, const uint8_t *buf, + int buf_size) { + int pic_found, i; + uint32_t state; + + pic_found= pc->frame_start_found; + state= pc->state; + + i=0; + if(!pic_found){ + for(i=0; i SLICE_MAX_START_CODE){ + pc->frame_start_found=0; + pc->state=-1; + return i-3; + } + } + } + } + pc->frame_start_found= pic_found; + pc->state= state; + return END_NOT_FOUND; +} + +static int cavsvideo_parse(AVCodecParserContext *s, + AVCodecContext *avctx, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size) +{ + ParseContext *pc = s->priv_data; + int next; + + if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){ + next= buf_size; + }else{ + next= cavs_find_frame_end(pc, buf, buf_size); + + if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) { + *poutbuf = NULL; + *poutbuf_size = 0; + return buf_size; + } + } + *poutbuf = (uint8_t *)buf; + *poutbuf_size = buf_size; + return next; +} + +AVCodecParser cavsvideo_parser = { + { CODEC_ID_CAVS }, + sizeof(ParseContext1), + NULL, + cavsvideo_parse, + ff_parse1_close, + ff_mpeg4video_split, }; +#endif /* CONFIG_CAVSVIDEO_PARSER */ diff --git a/src/libffmpeg/libavcodec/cavsdata.h b/src/libffmpeg/libavcodec/cavsdata.h index d6c78e433..d76985136 100644 --- a/src/libffmpeg/libavcodec/cavsdata.h +++ b/src/libffmpeg/libavcodec/cavsdata.h @@ -2,18 +2,20 @@ * Chinese AVS video (AVS1-P2, JiZhun profile) decoder. * Copyright (c) 2006 Stefan Gehrer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -129,6 +131,7 @@ enum mv_loc_t { MV_BWD_X3 }; +#ifdef CONFIG_CAVS_DECODER static const uint8_t partition_flags[30] = { 0, //I_8X8 0, //P_SKIP @@ -637,3 +640,4 @@ static const int_fast8_t left_modifier_l[8] = { 0,-1, 6,-1,-1, 7, 6, 7}; static const int_fast8_t top_modifier_l[8] = {-1, 1, 5,-1,-1, 5, 7, 7}; static const int_fast8_t left_modifier_c[7] = { 5,-1, 2,-1, 6, 5, 6}; static const int_fast8_t top_modifier_c[7] = { 4, 1,-1,-1, 4, 6, 6}; +#endif /* CONFIG_CAVS_DECODER */ diff --git a/src/libffmpeg/libavcodec/cinepak.c b/src/libffmpeg/libavcodec/cinepak.c index 797681231..e137377e5 100644 --- a/src/libffmpeg/libavcodec/cinepak.c +++ b/src/libffmpeg/libavcodec/cinepak.c @@ -2,18 +2,20 @@ * Cinepak Video Decoder * Copyright (C) 2003 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/cljr.c b/src/libffmpeg/libavcodec/cljr.c index feb0d8bb2..44810f5cf 100644 --- a/src/libffmpeg/libavcodec/cljr.c +++ b/src/libffmpeg/libavcodec/cljr.c @@ -2,18 +2,20 @@ * Cirrus Logic AccuPak (CLJR) codec * Copyright (c) 2003 Alex Beregszaszi * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/cook.c b/src/libffmpeg/libavcodec/cook.c index fb04cf574..47d9ce2c3 100644 --- a/src/libffmpeg/libavcodec/cook.c +++ b/src/libffmpeg/libavcodec/cook.c @@ -3,18 +3,20 @@ * Copyright (c) 2003 Sascha Sommer * Copyright (c) 2005 Benjamin Larsson * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -45,7 +47,6 @@ #include #include -#define ALT_BITSTREAM_READER #include "avcodec.h" #include "bitstream.h" #include "dsputil.h" diff --git a/src/libffmpeg/libavcodec/cookdata.h b/src/libffmpeg/libavcodec/cookdata.h index 1247d9d91..395c9a7dd 100644 --- a/src/libffmpeg/libavcodec/cookdata.h +++ b/src/libffmpeg/libavcodec/cookdata.h @@ -3,18 +3,20 @@ * Copyright (c) 2003 Sascha Sommer * Copyright (c) 2005 Benjamin Larsson * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/cscd.c b/src/libffmpeg/libavcodec/cscd.c index 0d6e04526..e4257f4c0 100644 --- a/src/libffmpeg/libavcodec/cscd.c +++ b/src/libffmpeg/libavcodec/cscd.c @@ -2,18 +2,20 @@ * CamStudio decoder * Copyright (c) 2006 Reimar Doeffinger * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include diff --git a/src/libffmpeg/libavcodec/cyuv.c b/src/libffmpeg/libavcodec/cyuv.c index b64e1a58b..101f2bd85 100644 --- a/src/libffmpeg/libavcodec/cyuv.c +++ b/src/libffmpeg/libavcodec/cyuv.c @@ -2,18 +2,20 @@ * * Copyright (C) 2003 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Creative YUV (CYUV) Video Decoder @@ -75,9 +77,9 @@ static int cyuv_decode_frame(AVCodecContext *avctx, int v_ptr; /* prediction error tables (make it clear that they are signed values) */ - signed char *y_table = buf + 0; - signed char *u_table = buf + 16; - signed char *v_table = buf + 32; + signed char *y_table = (signed char*)buf + 0; + signed char *u_table = (signed char*)buf + 16; + signed char *v_table = (signed char*)buf + 32; unsigned char y_pred, u_pred, v_pred; int stream_ptr; diff --git a/src/libffmpeg/libavcodec/dpcm.c b/src/libffmpeg/libavcodec/dpcm.c index df9da9489..99c0cac64 100644 --- a/src/libffmpeg/libavcodec/dpcm.c +++ b/src/libffmpeg/libavcodec/dpcm.c @@ -2,18 +2,20 @@ * Assorted DPCM codecs * Copyright (c) 2003 The ffmpeg Project. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/dsputil.c b/src/libffmpeg/libavcodec/dsputil.c index 9b79b8659..51eddbc60 100644 --- a/src/libffmpeg/libavcodec/dsputil.c +++ b/src/libffmpeg/libavcodec/dsputil.c @@ -3,18 +3,20 @@ * Copyright (c) 2000, 2001 Fabrice Bellard. * Copyright (c) 2002-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * gmc & q-pel & 32/64 bit based MC by Michael Niedermayer @@ -35,8 +37,11 @@ /* snow.c */ void ff_spatial_dwt(int *buffer, int width, int height, int stride, int type, int decomposition_count); -uint8_t cropTbl[256 + 2 * MAX_NEG_CROP] = {0, }; -uint32_t squareTbl[512] = {0, }; +/* vorbis.c */ +void vorbis_inverse_coupling(float *mag, float *ang, int blocksize); + +uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP] = {0, }; +uint32_t ff_squareTbl[512] = {0, }; const uint8_t ff_zigzag_direct[64] = { 0, 1, 8, 16, 9, 2, 3, 10, @@ -88,7 +93,7 @@ const uint8_t ff_alternate_vertical_scan[64] = { }; /* a*inverse[b]>>32 == a/b for all 0<=a<=65536 && 2<=b<=255 */ -const uint32_t inverse[256]={ +const uint32_t ff_inverse[256]={ 0, 4294967295U,2147483648U,1431655766, 1073741824, 858993460, 715827883, 613566757, 536870912, 477218589, 429496730, 390451573, 357913942, 330382100, 306783379, 286331154, 268435456, 252645136, 238609295, 226050911, 214748365, 204522253, 195225787, 186737709, @@ -160,7 +165,7 @@ static int pix_sum_c(uint8_t * pix, int line_size) static int pix_norm1_c(uint8_t * pix, int line_size) { int s, i, j; - uint32_t *sq = squareTbl + 256; + uint32_t *sq = ff_squareTbl + 256; s = 0; for (i = 0; i < 16; i++) { @@ -226,7 +231,7 @@ static void bswap_buf(uint32_t *dst, uint32_t *src, int w){ static int sse4_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) { int s, i; - uint32_t *sq = squareTbl + 256; + uint32_t *sq = ff_squareTbl + 256; s = 0; for (i = 0; i < h; i++) { @@ -243,7 +248,7 @@ static int sse4_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) static int sse8_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) { int s, i; - uint32_t *sq = squareTbl + 256; + uint32_t *sq = ff_squareTbl + 256; s = 0; for (i = 0; i < h; i++) { @@ -264,7 +269,7 @@ static int sse8_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) static int sse16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) { int s, i; - uint32_t *sq = squareTbl + 256; + uint32_t *sq = ff_squareTbl + 256; s = 0; for (i = 0; i < h; i++) { @@ -353,7 +358,7 @@ static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, in for(i=0; i=0 && y>=0); -static inline void copy_block9(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h) -{ - int i; for(i=0; i> 6; + dst[1] = (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6; + dst[2] = (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6; + dst[3] = (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6; + dst[4] = (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6; + dst[5] = (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6; + dst[6] = (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6; + dst[7] = (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6; + dst+= stride; + src+= stride; } } - #define QPEL_MC(r, OPNAME, RND, OP) \ static void OPNAME ## mpeg4_qpel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ - uint8_t *cm = cropTbl + MAX_NEG_CROP;\ + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\ int i;\ for(i=0; i>1; + ad1= FFABS(d1)>>1; d2= clip((p0-p3)/4, -ad1, ad1); @@ -2735,7 +2687,7 @@ static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale){ src[y*stride-1] = p1; src[y*stride+0] = p2; - ad1= ABS(d1)>>1; + ad1= FFABS(d1)>>1; d2= clip((p0-p3)/4, -ad1, ad1); @@ -2787,18 +2739,18 @@ static inline void h264_loop_filter_luma_c(uint8_t *pix, int xstride, int ystrid const int q1 = pix[1*xstride]; const int q2 = pix[2*xstride]; - if( ABS( p0 - q0 ) < alpha && - ABS( p1 - p0 ) < beta && - ABS( q1 - q0 ) < beta ) { + if( FFABS( p0 - q0 ) < alpha && + FFABS( p1 - p0 ) < beta && + FFABS( q1 - q0 ) < beta ) { int tc = tc0[i]; int i_delta; - if( ABS( p2 - p0 ) < beta ) { + if( FFABS( p2 - p0 ) < beta ) { pix[-2*xstride] = p1 + clip( (( p2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - p1, -tc0[i], tc0[i] ); tc++; } - if( ABS( q2 - q0 ) < beta ) { + if( FFABS( q2 - q0 ) < beta ) { pix[ xstride] = q1 + clip( (( q2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - q1, -tc0[i], tc0[i] ); tc++; } @@ -2835,9 +2787,9 @@ static inline void h264_loop_filter_chroma_c(uint8_t *pix, int xstride, int ystr const int q0 = pix[0]; const int q1 = pix[1*xstride]; - if( ABS( p0 - q0 ) < alpha && - ABS( p1 - p0 ) < beta && - ABS( q1 - q0 ) < beta ) { + if( FFABS( p0 - q0 ) < alpha && + FFABS( p1 - p0 ) < beta && + FFABS( q1 - q0 ) < beta ) { int delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); @@ -2866,9 +2818,9 @@ static inline void h264_loop_filter_chroma_intra_c(uint8_t *pix, int xstride, in const int q0 = pix[0]; const int q1 = pix[1*xstride]; - if( ABS( p0 - q0 ) < alpha && - ABS( p1 - p0 ) < beta && - ABS( q1 - q0 ) < beta ) { + if( FFABS( p0 - q0 ) < alpha && + FFABS( p1 - p0 ) < beta && + FFABS( q1 - q0 ) < beta ) { pix[-xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; /* p0' */ pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2; /* q0' */ @@ -3097,9 +3049,9 @@ static int nsse16_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){ } if(y+1avctx->nsse_weight; - else return score1 + ABS(score2)*8; + if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight; + else return score1 + FFABS(score2)*8; } static int nsse8_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){ @@ -3123,9 +3075,9 @@ static int nsse8_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){ } if(y+1avctx->nsse_weight; - else return score1 + ABS(score2)*8; + if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight; + else return score1 + FFABS(score2)*8; } static int try_8x8basis_c(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){ @@ -3324,7 +3276,7 @@ o2= (i1)-(i2); y= a-b;\ } -#define BUTTERFLYA(x,y) (ABS((x)+(y)) + ABS((x)-(y))) +#define BUTTERFLYA(x,y) (FFABS((x)+(y)) + FFABS((x)-(y))) static int hadamard8_diff8x8_c(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h){ int i; @@ -3421,7 +3373,7 @@ static int hadamard8_intra8x8_c(/*MpegEncContext*/ void *s, uint8_t *src, uint8_ +BUTTERFLYA(temp[8*3+i], temp[8*7+i]); } - sum -= ABS(temp[8*0] + temp[8*4]); // -mean + sum -= FFABS(temp[8*0] + temp[8*4]); // -mean return sum; } @@ -3438,7 +3390,7 @@ static int dct_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2 s->dsp.fdct(temp); for(i=0; i<64; i++) - sum+= ABS(temp[i]); + sum+= FFABS(temp[i]); return sum; } @@ -3487,7 +3439,7 @@ static int dct264_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *s #undef DST #define SRC(x) dct[x][i] -#define DST(x,v) sum += ABS(v) +#define DST(x,v) sum += FFABS(v) for( i = 0; i < 8; i++ ) DCT8_1D #undef SRC @@ -3508,13 +3460,11 @@ static int dct_max8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2 s->dsp.fdct(temp); for(i=0; i<64; i++) - sum= FFMAX(sum, ABS(temp[i])); + sum= FFMAX(sum, FFABS(temp[i])); return sum; } -void simple_idct(DCTELEM *block); //FIXME - static int quant_psnr8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ MpegEncContext * const s= (MpegEncContext *)c; DECLARE_ALIGNED_8 (uint64_t, aligned_temp[sizeof(DCTELEM)*64*2/8]); @@ -3684,8 +3634,8 @@ static int vsad_intra16_c(/*MpegEncContext*/ void *c, uint8_t *s, uint8_t *dummy for(y=1; y>31; + // is this faster on some gcc/cpu combinations? +// if(tmp > 0x43c0ffff) tmp = 0xFFFF; +// else tmp = 0; + } + dst[i] = tmp - 0x8000; + } +} + /* XXX: those functions should be suppressed ASAP when all IDCTs are converted */ static void ff_jref_idct_put(uint8_t *dest, int line_size, DCTELEM *block) @@ -3787,13 +3770,13 @@ static void ff_jref_idct2_add(uint8_t *dest, int line_size, DCTELEM *block) static void ff_jref_idct1_put(uint8_t *dest, int line_size, DCTELEM *block) { - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; dest[0] = cm[(block[0] + 4)>>3]; } static void ff_jref_idct1_add(uint8_t *dest, int line_size, DCTELEM *block) { - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; dest[0] = cm[dest[0] + ((block[0] + 4)>>3)]; } @@ -3805,14 +3788,14 @@ void dsputil_static_init(void) { int i; - for(i=0;i<256;i++) cropTbl[i + MAX_NEG_CROP] = i; + for(i=0;i<256;i++) ff_cropTbl[i + MAX_NEG_CROP] = i; for(i=0;iavg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_c; c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_c; c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_c; + c->put_no_rnd_h264_chroma_pixels_tab[0]= put_no_rnd_h264_chroma_mc8_c; c->weight_h264_pixels_tab[0]= weight_h264_pixels16x16_c; c->weight_h264_pixels_tab[1]= weight_h264_pixels16x8_c; @@ -4075,6 +4059,7 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx) c->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_c; c->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_c; c->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_c; + c->h264_loop_filter_strength= NULL; c->h263_h_loop_filter= h263_h_loop_filter_c; c->h263_v_loop_filter= h263_v_loop_filter_c; @@ -4090,6 +4075,14 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx) c->inner_add_yblock = ff_snow_inner_add_yblock; #endif +#ifdef CONFIG_VORBIS_DECODER + c->vorbis_inverse_coupling = vorbis_inverse_coupling; +#endif + c->vector_fmul = vector_fmul_c; + c->vector_fmul_reverse = vector_fmul_reverse_c; + c->vector_fmul_add_add = ff_vector_fmul_add_add_c; + c->float_to_int16 = ff_float_to_int16_c; + c->shrink[0]= ff_img_copy_plane; c->shrink[1]= ff_shrink22; c->shrink[2]= ff_shrink44; @@ -4097,6 +4090,9 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx) c->prefetch= just_return; + memset(c->put_2tap_qpel_pixels_tab, 0, sizeof(c->put_2tap_qpel_pixels_tab)); + memset(c->avg_2tap_qpel_pixels_tab, 0, sizeof(c->avg_2tap_qpel_pixels_tab)); + #ifdef HAVE_MMX dsputil_init_mmx(c, avctx); #endif @@ -4121,6 +4117,16 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx) #ifdef ARCH_SH4 dsputil_init_sh4(c,avctx); #endif +#ifdef ARCH_BFIN + dsputil_init_bfin(c,avctx); +#endif + + for(i=0; i<64; i++){ + if(!c->put_2tap_qpel_pixels_tab[0][i]) + c->put_2tap_qpel_pixels_tab[0][i]= c->put_h264_qpel_pixels_tab[0][i]; + if(!c->avg_2tap_qpel_pixels_tab[0][i]) + c->avg_2tap_qpel_pixels_tab[0][i]= c->avg_h264_qpel_pixels_tab[0][i]; + } switch(c->idct_permutation_type){ case FF_NO_IDCT_PERM: diff --git a/src/libffmpeg/libavcodec/dsputil.h b/src/libffmpeg/libavcodec/dsputil.h index df7830564..de3c1d564 100644 --- a/src/libffmpeg/libavcodec/dsputil.h +++ b/src/libffmpeg/libavcodec/dsputil.h @@ -3,18 +3,20 @@ * Copyright (c) 2000, 2001, 2002 Fabrice Bellard. * Copyright (c) 2002-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -61,6 +63,10 @@ void ff_h264_idct_dc_add_c(uint8_t *dst, DCTELEM *block, int stride); void ff_h264_lowres_idct_add_c(uint8_t *dst, int stride, DCTELEM *block); void ff_h264_lowres_idct_put_c(uint8_t *dst, int stride, DCTELEM *block); +void ff_vector_fmul_add_add_c(float *dst, const float *src0, const float *src1, + const float *src2, int src3, int blocksize, int step); +void ff_float_to_int16_c(int16_t *dst, const float *src, int len); + /* encoding scans */ extern const uint8_t ff_alternate_horizontal_scan[64]; extern const uint8_t ff_alternate_vertical_scan[64]; @@ -71,8 +77,8 @@ extern const uint8_t ff_zigzag248_direct[64]; #define MAX_NEG_CROP 1024 /* temporary */ -extern uint32_t squareTbl[512]; -extern uint8_t cropTbl[256 + 2 * MAX_NEG_CROP]; +extern uint32_t ff_squareTbl[512]; +extern uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP]; /* VP3 DSP functions */ void ff_vp3_idct_c(DCTELEM *block/* align 16*/); @@ -269,11 +275,16 @@ typedef struct DSPContext { * h264 Chram MC */ h264_chroma_mc_func put_h264_chroma_pixels_tab[3]; + /* This is really one func used in VC-1 decoding */ + h264_chroma_mc_func put_no_rnd_h264_chroma_pixels_tab[3]; h264_chroma_mc_func avg_h264_chroma_pixels_tab[3]; qpel_mc_func put_h264_qpel_pixels_tab[4][16]; qpel_mc_func avg_h264_qpel_pixels_tab[4][16]; + qpel_mc_func put_2tap_qpel_pixels_tab[4][16]; + qpel_mc_func avg_2tap_qpel_pixels_tab[4][16]; + h264_weight_func weight_h264_pixels_tab[10]; h264_biweight_func biweight_h264_pixels_tab[10]; @@ -304,12 +315,27 @@ typedef struct DSPContext { void (*h264_h_loop_filter_chroma)(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0); void (*h264_v_loop_filter_chroma_intra)(uint8_t *pix, int stride, int alpha, int beta); void (*h264_h_loop_filter_chroma_intra)(uint8_t *pix, int stride, int alpha, int beta); + // h264_loop_filter_strength: simd only. the C version is inlined in h264.c + void (*h264_loop_filter_strength)(int16_t bS[2][4][4], uint8_t nnz[40], int8_t ref[2][40], int16_t mv[2][40][2], + int bidir, int edges, int step, int mask_mv0, int mask_mv1); void (*h263_v_loop_filter)(uint8_t *src, int stride, int qscale); void (*h263_h_loop_filter)(uint8_t *src, int stride, int qscale); void (*h261_loop_filter)(uint8_t *src, int stride); + /* assume len is a multiple of 4, and arrays are 16-byte aligned */ + void (*vorbis_inverse_coupling)(float *mag, float *ang, int blocksize); + /* assume len is a multiple of 8, and arrays are 16-byte aligned */ + void (*vector_fmul)(float *dst, const float *src, int len); + void (*vector_fmul_reverse)(float *dst, const float *src0, const float *src1, int len); + /* assume len is a multiple of 8, and src arrays are 16-byte aligned */ + void (*vector_fmul_add_add)(float *dst, const float *src0, const float *src1, const float *src2, int src3, int len, int step); + + /* C version: convert floats from the range [384.0,386.0] to ints in [-32768,32767] + * simd versions: convert floats from [-32768.0,32767.0] without rescaling and arrays are 16byte aligned */ + void (*float_to_int16)(int16_t *dst, const float *src, int len); + /* (I)DCT */ void (*fdct)(DCTELEM *block/* align 16*/); void (*fdct248)(DCTELEM *block/* align 16*/); @@ -374,8 +400,8 @@ typedef struct DSPContext { void (*vc1_inv_trans_8x4)(DCTELEM *b, int n); void (*vc1_inv_trans_4x8)(DCTELEM *b, int n); void (*vc1_inv_trans_4x4)(DCTELEM *b, int n); - void (*vc1_v_overlap)(uint8_t* src, int stride, int rnd); - void (*vc1_h_overlap)(uint8_t* src, int stride, int rnd); + void (*vc1_v_overlap)(uint8_t* src, int stride); + void (*vc1_h_overlap)(uint8_t* src, int stride); /* put 8x8 block with bicubic interpolation and quarterpel precision * last argument is actually round value instead of height */ @@ -553,6 +579,13 @@ void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx); void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx); +#elif defined(ARCH_BFIN) + +#define DECLARE_ALIGNED_8(t,v) t v __attribute__ ((aligned (8))) +#define STRIDE_ALIGN 8 + +void dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx); + #else #define DECLARE_ALIGNED_8(t,v) t v __attribute__ ((aligned (8))) @@ -595,6 +628,8 @@ void get_psnr(uint8_t *orig_image[3], uint8_t *coded_image[3], FFTSample type */ typedef float FFTSample; +struct MDCTContext; + typedef struct FFTComplex { FFTSample re, im; } FFTComplex; @@ -606,6 +641,8 @@ typedef struct FFTContext { FFTComplex *exptab; FFTComplex *exptab1; /* only used by SSE code */ void (*fft_calc)(struct FFTContext *s, FFTComplex *z); + void (*imdct_calc)(struct MDCTContext *s, FFTSample *output, + const FFTSample *input, FFTSample *tmp); } FFTContext; int ff_fft_init(FFTContext *s, int nbits, int inverse); @@ -636,6 +673,10 @@ typedef struct MDCTContext { int ff_mdct_init(MDCTContext *s, int nbits, int inverse); void ff_imdct_calc(MDCTContext *s, FFTSample *output, const FFTSample *input, FFTSample *tmp); +void ff_imdct_calc_3dn2(MDCTContext *s, FFTSample *output, + const FFTSample *input, FFTSample *tmp); +void ff_imdct_calc_sse(MDCTContext *s, FFTSample *output, + const FFTSample *input, FFTSample *tmp); void ff_mdct_calc(MDCTContext *s, FFTSample *out, const FFTSample *input, FFTSample *tmp); void ff_mdct_end(MDCTContext *s); @@ -660,4 +701,81 @@ static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int st return score;\ } + +static inline void copy_block2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h) +{ + int i; + for(i=0; i for providing wealth * of DV technical info. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -31,6 +33,7 @@ * @file dv.c * DV codec. */ +#define ALT_BITSTREAM_READER #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" @@ -270,11 +273,6 @@ static const int vs_total_ac_bits = (100 * 4 + 68*2) * 5; /* see dv_88_areas and dv_248_areas for details */ static const int mb_area_start[5] = { 1, 6, 21, 43, 64 }; -#ifndef ALT_BITSTREAM_READER -#warning only works with ALT_BITSTREAM_READER -static int re_index; //Hack to make it compile -#endif - static inline int get_bits_left(GetBitContext *s) { return s->size_in_bits - get_bits_count(s); @@ -707,7 +705,7 @@ static always_inline void dv_set_class_number(DCTELEM* blk, EncBlockInfo* bi, /* weigh it and and shift down into range, adding for rounding */ /* the extra division by a factor of 2^4 reverses the 8x expansion of the DCT AND the 2x doubling of the weights */ - level = (ABS(level) * weight[i] + (1<<(dv_weight_bits+3))) >> (dv_weight_bits+4); + level = (FFABS(level) * weight[i] + (1<<(dv_weight_bits+3))) >> (dv_weight_bits+4); bi->mb[i] = level; if(level>max) max= level; bi->bit_size[area] += dv_rl2vlc_size(i - prev - 1, level); @@ -1014,6 +1012,7 @@ static int dv_decode_mt(AVCodecContext *avctx, void* sl) return 0; } +#ifdef CONFIG_ENCODERS static int dv_encode_mt(AVCodecContext *avctx, void* sl) { DVVideoContext *s = avctx->priv_data; @@ -1032,7 +1031,9 @@ static int dv_encode_mt(AVCodecContext *avctx, void* sl) &s->sys->video_place[slice*5]); return 0; } +#endif +#ifdef CONFIG_DECODERS /* NOTE: exactly one frame must be given (120000 bytes for NTSC, 144000 bytes for PAL - or twice those for 50Mbps) */ static int dvvideo_decode_frame(AVCodecContext *avctx, @@ -1072,7 +1073,132 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, return s->sys->frame_size; } +#endif + + +static inline int dv_write_pack(enum dv_pack_type pack_id, DVVideoContext *c, uint8_t* buf) +{ + /* + * Here's what SMPTE314M says about these two: + * (page 6) APTn, AP1n, AP2n, AP3n: These data shall be identical + * as track application IDs (APTn = 001, AP1n = + * 001, AP2n = 001, AP3n = 001), if the source signal + * comes from a digital VCR. If the signal source is + * unknown, all bits for these data shall be set to 1. + * (page 12) STYPE: STYPE defines a signal type of video signal + * 00000b = 4:1:1 compression + * 00100b = 4:2:2 compression + * XXXXXX = Reserved + * Now, I've got two problems with these statements: + * 1. it looks like APT == 111b should be a safe bet, but it isn't. + * It seems that for PAL as defined in IEC 61834 we have to set + * APT to 000 and for SMPTE314M to 001. + * 2. It is not at all clear what STYPE is used for 4:2:0 PAL + * compression scheme (if any). + */ + int apt = (c->sys->pix_fmt == PIX_FMT_YUV420P ? 0 : 1); + int stype = (c->sys->pix_fmt == PIX_FMT_YUV422P ? 4 : 0); + + uint8_t aspect = 0; + if((int)(av_q2d(c->avctx->sample_aspect_ratio) * c->avctx->width / c->avctx->height * 10) == 17) /* 16:9 */ + aspect = 0x02; + + buf[0] = (uint8_t)pack_id; + switch (pack_id) { + case dv_header525: /* I can't imagine why these two weren't defined as real */ + case dv_header625: /* packs in SMPTE314M -- they definitely look like ones */ + buf[1] = 0xf8 | /* reserved -- always 1 */ + (apt & 0x07); /* APT: Track application ID */ + buf[2] = (0 << 7) | /* TF1: audio data is 0 - valid; 1 - invalid */ + (0x0f << 3) | /* reserved -- always 1 */ + (apt & 0x07); /* AP1: Audio application ID */ + buf[3] = (0 << 7) | /* TF2: video data is 0 - valid; 1 - invalid */ + (0x0f << 3) | /* reserved -- always 1 */ + (apt & 0x07); /* AP2: Video application ID */ + buf[4] = (0 << 7) | /* TF3: subcode(SSYB) is 0 - valid; 1 - invalid */ + (0x0f << 3) | /* reserved -- always 1 */ + (apt & 0x07); /* AP3: Subcode application ID */ + break; + case dv_video_source: + buf[1] = 0xff; /* reserved -- always 1 */ + buf[2] = (1 << 7) | /* B/W: 0 - b/w, 1 - color */ + (1 << 6) | /* following CLF is valid - 0, invalid - 1 */ + (3 << 4) | /* CLF: color frames id (see ITU-R BT.470-4) */ + 0xf; /* reserved -- always 1 */ + buf[3] = (3 << 6) | /* reserved -- always 1 */ + (c->sys->dsf << 5) | /* system: 60fields/50fields */ + stype; /* signal type video compression */ + buf[4] = 0xff; /* VISC: 0xff -- no information */ + break; + case dv_video_control: + buf[1] = (0 << 6) | /* Copy generation management (CGMS) 0 -- free */ + 0x3f; /* reserved -- always 1 */ + buf[2] = 0xc8 | /* reserved -- always b11001xxx */ + aspect; + buf[3] = (1 << 7) | /* Frame/field flag 1 -- frame, 0 -- field */ + (1 << 6) | /* First/second field flag 0 -- field 2, 1 -- field 1 */ + (1 << 5) | /* Frame change flag 0 -- same picture as before, 1 -- different */ + (1 << 4) | /* 1 - interlaced, 0 - noninterlaced */ + 0xc; /* reserved -- always b1100 */ + buf[4] = 0xff; /* reserved -- always 1 */ + break; + default: + buf[1] = buf[2] = buf[3] = buf[4] = 0xff; + } + return 5; +} + +static void dv_format_frame(DVVideoContext* c, uint8_t* buf) +{ + int chan, i, j, k; + + for (chan = 0; chan < c->sys->n_difchan; chan++) { + for (i = 0; i < c->sys->difseg_size; i++) { + memset(buf, 0xff, 80 * 6); /* First 6 DIF blocks are for control data */ + + /* DV header: 1DIF */ + buf += dv_write_dif_id(dv_sect_header, chan, i, 0, buf); + buf += dv_write_pack((c->sys->dsf ? dv_header625 : dv_header525), c, buf); + buf += 72; /* unused bytes */ + + /* DV subcode: 2DIFs */ + for (j = 0; j < 2; j++) { + buf += dv_write_dif_id(dv_sect_subcode, chan, i, j, buf); + for (k = 0; k < 6; k++) + buf += dv_write_ssyb_id(k, (i < c->sys->difseg_size/2), buf) + 5; + buf += 29; /* unused bytes */ + } + + /* DV VAUX: 3DIFS */ + for (j = 0; j < 3; j++) { + buf += dv_write_dif_id(dv_sect_vaux, chan, i, j, buf); + buf += dv_write_pack(dv_video_source, c, buf); + buf += dv_write_pack(dv_video_control, c, buf); + buf += 7*5; + buf += dv_write_pack(dv_video_source, c, buf); + buf += dv_write_pack(dv_video_control, c, buf); + buf += 4*5 + 2; /* unused bytes */ + } + + /* DV Audio/Video: 135 Video DIFs + 9 Audio DIFs */ + for (j = 0; j < 135; j++) { + if (j%15 == 0) { + memset(buf, 0xff, 80); + buf += dv_write_dif_id(dv_sect_audio, chan, i, j/15, buf); + buf += 77; /* audio control & shuffled PCM audio */ + } + buf += dv_write_dif_id(dv_sect_video, chan, i, j, buf); + buf += 77; /* 1 video macro block: 1 bytes control + 4 * 14 bytes Y 8x8 data + 10 bytes Cr 8x8 data + 10 bytes Cb 8x8 data */ + } + } + } +} + +#ifdef CONFIG_ENCODERS static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size, void *data) { @@ -1095,21 +1221,11 @@ static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size, emms_c(); - /* Fill in just enough of the header for dv_frame_profile() to - return the correct result, so that the frame can be decoded - correctly. The rest of the metadata is filled in by the dvvideo - avformat. (this should probably change so that encode_frame() - fills in ALL of the metadata - e.g. for Quicktime-wrapped DV - streams) */ - - /* NTSC/PAL format */ - buf[3] = s->sys->dsf ? 0x80 : 0x00; - - /* 25Mbps or 50Mbps */ - buf[80*5 + 48 + 3] = (s->sys->pix_fmt == PIX_FMT_YUV422P) ? 0x4 : 0x0; + dv_format_frame(s, buf); return s->sys->frame_size; } +#endif static int dvvideo_close(AVCodecContext *c) { @@ -1133,6 +1249,7 @@ AVCodec dvvideo_encoder = { }; #endif // CONFIG_DVVIDEO_ENCODER +#ifdef CONFIG_DVVIDEO_DECODER AVCodec dvvideo_decoder = { "dvvideo", CODEC_TYPE_VIDEO, @@ -1145,3 +1262,4 @@ AVCodec dvvideo_decoder = { CODEC_CAP_DR1, NULL }; +#endif diff --git a/src/libffmpeg/libavcodec/dvdata.h b/src/libffmpeg/libavcodec/dvdata.h index a3d42d66c..dce4aba98 100644 --- a/src/libffmpeg/libavcodec/dvdata.h +++ b/src/libffmpeg/libavcodec/dvdata.h @@ -2,18 +2,20 @@ * Constants for DV codec * Copyright (c) 2002 Fabrice Bellard. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -2624,6 +2626,29 @@ static const DVprofile dv_profiles[] = { } }; +enum dv_section_type { + dv_sect_header = 0x1f, + dv_sect_subcode = 0x3f, + dv_sect_vaux = 0x56, + dv_sect_audio = 0x76, + dv_sect_video = 0x96, +}; + +enum dv_pack_type { + dv_header525 = 0x3f, /* see dv_write_pack for important details on */ + dv_header625 = 0xbf, /* these two packs */ + dv_timecode = 0x13, + dv_audio_source = 0x50, + dv_audio_control = 0x51, + dv_audio_recdate = 0x52, + dv_audio_rectime = 0x53, + dv_video_source = 0x60, + dv_video_control = 0x61, + dv_video_recdate = 0x62, + dv_video_rectime = 0x63, + dv_unknown_pack = 0xff, +}; + /* minimum number of bytes to read from a DV stream in order to determine the profile */ #define DV_PROFILE_BYTES (6*80) /* 6 DIF blocks */ @@ -2663,3 +2688,37 @@ static inline const DVprofile* dv_codec_profile(AVCodecContext* codec) return NULL; } + +static inline int dv_write_dif_id(enum dv_section_type t, uint8_t chan_num, uint8_t seq_num, + uint8_t dif_num, uint8_t* buf) +{ + buf[0] = (uint8_t)t; /* Section type */ + buf[1] = (seq_num<<4) | /* DIF seq number 0-9 for 525/60; 0-11 for 625/50 */ + (chan_num << 3) | /* FSC: for 50Mb/s 0 - first channel; 1 - second */ + 7; /* reserved -- always 1 */ + buf[2] = dif_num; /* DIF block number Video: 0-134, Audio: 0-8 */ + return 3; +} + + +static inline int dv_write_ssyb_id(uint8_t syb_num, uint8_t fr, uint8_t* buf) +{ + if (syb_num == 0 || syb_num == 6) { + buf[0] = (fr<<7) | /* FR ID 1 - first half of each channel; 0 - second */ + (0<<4) | /* AP3 (Subcode application ID) */ + 0x0f; /* reserved -- always 1 */ + } + else if (syb_num == 11) { + buf[0] = (fr<<7) | /* FR ID 1 - first half of each channel; 0 - second */ + 0x7f; /* reserved -- always 1 */ + } + else { + buf[0] = (fr<<7) | /* FR ID 1 - first half of each channel; 0 - second */ + (0<<4) | /* APT (Track application ID) */ + 0x0f; /* reserved -- always 1 */ + } + buf[1] = 0xf0 | /* reserved -- always 1 */ + (syb_num & 0x0f); /* SSYB number 0 - 11 */ + buf[2] = 0xff; /* reserved -- always 1 */ + return 3; +} diff --git a/src/libffmpeg/libavcodec/error_resilience.c b/src/libffmpeg/libavcodec/error_resilience.c index 9912044ec..0923721ee 100644 --- a/src/libffmpeg/libavcodec/error_resilience.c +++ b/src/libffmpeg/libavcodec/error_resilience.c @@ -3,18 +3,20 @@ * * Copyright (c) 2002-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -197,7 +199,7 @@ static void guess_dc(MpegEncContext *s, int16_t *dc, int w, int h, int stride, i */ static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int stride, int is_luma){ int b_x, b_y; - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; for(b_y=0; b_y>1); + d= FFABS(b) - ((FFABS(a) + FFABS(c) + 1)>>1); d= FFMAX(d, 0); if(b<0) d= -d; @@ -257,7 +259,7 @@ static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st */ static void v_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int stride, int is_luma){ int b_x, b_y; - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; for(b_y=0; b_y>1); + d= FFABS(b) - ((FFABS(a) + FFABS(c)+1)>>1); d= FFMAX(d, 0); if(b<0) d= -d; @@ -493,22 +495,22 @@ int score_sum=0; if(mb_x>0 && fixed[mb_xy-1]){ int k; for(k=0; k<16; k++) - score += ABS(src[k*s->linesize-1 ]-src[k*s->linesize ]); + score += FFABS(src[k*s->linesize-1 ]-src[k*s->linesize ]); } if(mb_x+1linesize+15]-src[k*s->linesize+16]); + score += FFABS(src[k*s->linesize+15]-src[k*s->linesize+16]); } if(mb_y>0 && fixed[mb_xy-mb_stride]){ int k; for(k=0; k<16; k++) - score += ABS(src[k-s->linesize ]-src[k ]); + score += FFABS(src[k-s->linesize ]-src[k ]); } if(mb_y+1linesize*15]-src[k+s->linesize*16]); + score += FFABS(src[k+s->linesize*15]-src[k+s->linesize*16]); } if(score <= best_score){ // <= will favor the last MV diff --git a/src/libffmpeg/libavcodec/eval.c b/src/libffmpeg/libavcodec/eval.c index 5b0e51d62..961c8b5ac 100644 --- a/src/libffmpeg/libavcodec/eval.c +++ b/src/libffmpeg/libavcodec/eval.c @@ -1,20 +1,23 @@ /* * simple arithmetic expression evaluator * - * Copyright (c) 2002 Michael Niedermayer + * Copyright (c) 2002-2006 Michael Niedermayer + * Copyright (c) 2006 Oded Shimon * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -28,6 +31,7 @@ #include "avcodec.h" #include "mpegvideo.h" +#include "eval.h" #include #include @@ -35,7 +39,7 @@ #include #ifndef NAN - #define NAN 0 + #define NAN 0.0/0.0 #endif #ifndef M_PI @@ -52,9 +56,69 @@ typedef struct Parser{ double (**func2)(void *, double a, double b); // NULL terminated char **func2_name; // NULL terminated void *opaque; + char **error; +#define VARS 10 + double var[VARS]; } Parser; -static double evalExpression(Parser *p); +static int8_t si_prefixes['z' - 'E' + 1]={ + ['y'-'E']= -24, + ['z'-'E']= -21, + ['a'-'E']= -18, + ['f'-'E']= -15, + ['p'-'E']= -12, + ['n'-'E']= - 9, + ['u'-'E']= - 6, + ['m'-'E']= - 3, + ['c'-'E']= - 2, + ['d'-'E']= - 1, + ['h'-'E']= 2, + ['k'-'E']= 3, + ['K'-'E']= 3, + ['M'-'E']= 6, + ['G'-'E']= 9, + ['T'-'E']= 12, + ['P'-'E']= 15, + ['E'-'E']= 18, + ['Z'-'E']= 21, + ['Y'-'E']= 24, +}; + +/** strtod() function extended with 'k', 'M', 'G', 'ki', 'Mi', 'Gi' and 'B' + * postfixes. This allows using f.e. kB, MiB, G and B as a postfix. This + * function assumes that the unit of numbers is bits not bytes. + */ +static double av_strtod(const char *name, char **tail) { + double d; + char *next; + d = strtod(name, &next); + /* if parsing succeeded, check for and interpret postfixes */ + if (next!=name) { + + if(*next >= 'E' && *next <= 'z'){ + int e= si_prefixes[*next - 'E']; + if(e){ + if(next[1] == 'i'){ + d*= pow( 2, e/0.3); + next+=2; + }else{ + d*= pow(10, e); + next++; + } + } + } + + if(*next=='B') { + d*=8; + *next++; + } + } + /* if requested, fill in tail with the position after the last parsed + character */ + if (tail) + *tail = next; + return d; +} static int strmatch(const char *s, const char *prefix){ int i; @@ -64,143 +128,318 @@ static int strmatch(const char *s, const char *prefix){ return 1; } -static double evalPrimary(Parser *p){ - double d, d2=NAN; +struct ff_expr_s { + enum { + e_value, e_const, e_func0, e_func1, e_func2, + e_squish, e_gauss, e_ld, + e_mod, e_max, e_min, e_eq, e_gt, e_gte, + e_pow, e_mul, e_div, e_add, + e_last, e_st, e_while, + } type; + double value; // is sign in other types + union { + int const_index; + double (*func0)(double); + double (*func1)(void *, double); + double (*func2)(void *, double, double); + } a; + AVEvalExpr * param[2]; +}; + +static double eval_expr(Parser * p, AVEvalExpr * e) { + switch (e->type) { + case e_value: return e->value; + case e_const: return e->value * p->const_value[e->a.const_index]; + case e_func0: return e->value * e->a.func0(eval_expr(p, e->param[0])); + case e_func1: return e->value * e->a.func1(p->opaque, eval_expr(p, e->param[0])); + case e_func2: return e->value * e->a.func2(p->opaque, eval_expr(p, e->param[0]), eval_expr(p, e->param[1])); + case e_squish: return 1/(1+exp(4*eval_expr(p, e->param[0]))); + case e_gauss: { double d = eval_expr(p, e->param[0]); return exp(-d*d/2)/sqrt(2*M_PI); } + case e_ld: return e->value * p->var[clip(eval_expr(p, e->param[0]), 0, VARS-1)]; + case e_while: { + double d = NAN; + while(eval_expr(p, e->param[0])) + d=eval_expr(p, e->param[1]); + return d; + } + default: { + double d = eval_expr(p, e->param[0]); + double d2 = eval_expr(p, e->param[1]); + switch (e->type) { + case e_mod: return e->value * (d - floor(d/d2)*d2); + case e_max: return e->value * (d > d2 ? d : d2); + case e_min: return e->value * (d < d2 ? d : d2); + case e_eq: return e->value * (d == d2 ? 1.0 : 0.0); + case e_gt: return e->value * (d > d2 ? 1.0 : 0.0); + case e_gte: return e->value * (d >= d2 ? 1.0 : 0.0); + case e_pow: return e->value * pow(d, d2); + case e_mul: return e->value * (d * d2); + case e_div: return e->value * (d / d2); + case e_add: return e->value * (d + d2); + case e_last:return e->value * d2; + case e_st : return e->value * (p->var[clip(d, 0, VARS-1)]= d2); + } + } + } + return NAN; +} + +static AVEvalExpr * parse_expr(Parser *p); + +void ff_eval_free(AVEvalExpr * e) { + if (!e) return; + ff_eval_free(e->param[0]); + ff_eval_free(e->param[1]); + av_freep(&e); +} + +static AVEvalExpr * parse_primary(Parser *p) { + AVEvalExpr * d = av_mallocz(sizeof(AVEvalExpr)); char *next= p->s; int i; /* number */ - d= strtod(p->s, &next); + d->value = av_strtod(p->s, &next); if(next != p->s){ + d->type = e_value; p->s= next; return d; } + d->value = 1; /* named constants */ for(i=0; p->const_name && p->const_name[i]; i++){ if(strmatch(p->s, p->const_name[i])){ p->s+= strlen(p->const_name[i]); - return p->const_value[i]; + d->type = e_const; + d->a.const_index = i; + return d; } } p->s= strchr(p->s, '('); if(p->s==NULL){ - av_log(NULL, AV_LOG_ERROR, "Parser: missing ( in \"%s\"\n", next); - return NAN; + *p->error = "missing ("; + p->s= next; + ff_eval_free(d); + return NULL; } p->s++; // "(" - d= evalExpression(p); + if (*next == '(') { // special case do-nothing + av_freep(&d); + d = parse_expr(p); + if(p->s[0] != ')'){ + *p->error = "missing )"; + ff_eval_free(d); + return NULL; + } + p->s++; // ")" + return d; + } + d->param[0] = parse_expr(p); if(p->s[0]== ','){ p->s++; // "," - d2= evalExpression(p); + d->param[1] = parse_expr(p); } if(p->s[0] != ')'){ - av_log(NULL, AV_LOG_ERROR, "Parser: missing ) in \"%s\"\n", next); - return NAN; + *p->error = "missing )"; + ff_eval_free(d); + return NULL; } p->s++; // ")" - if( strmatch(next, "sinh" ) ) d= sinh(d); - else if( strmatch(next, "cosh" ) ) d= cosh(d); - else if( strmatch(next, "tanh" ) ) d= tanh(d); - else if( strmatch(next, "sin" ) ) d= sin(d); - else if( strmatch(next, "cos" ) ) d= cos(d); - else if( strmatch(next, "tan" ) ) d= tan(d); - else if( strmatch(next, "exp" ) ) d= exp(d); - else if( strmatch(next, "log" ) ) d= log(d); - else if( strmatch(next, "squish") ) d= 1/(1+exp(4*d)); - else if( strmatch(next, "gauss" ) ) d= exp(-d*d/2)/sqrt(2*M_PI); - else if( strmatch(next, "abs" ) ) d= fabs(d); - else if( strmatch(next, "max" ) ) d= d > d2 ? d : d2; - else if( strmatch(next, "min" ) ) d= d < d2 ? d : d2; - else if( strmatch(next, "gt" ) ) d= d > d2 ? 1.0 : 0.0; - else if( strmatch(next, "gte" ) ) d= d >= d2 ? 1.0 : 0.0; - else if( strmatch(next, "lt" ) ) d= d > d2 ? 0.0 : 1.0; - else if( strmatch(next, "lte" ) ) d= d >= d2 ? 0.0 : 1.0; - else if( strmatch(next, "eq" ) ) d= d == d2 ? 1.0 : 0.0; - else if( strmatch(next, "(" ) ) d= d; -// else if( strmatch(next, "l1" ) ) d= 1 + d2*(d - 1); -// else if( strmatch(next, "sq01" ) ) d= (d >= 0.0 && d <=1.0) ? 1.0 : 0.0; - else{ + d->type = e_func0; + if( strmatch(next, "sinh" ) ) d->a.func0 = sinh; + else if( strmatch(next, "cosh" ) ) d->a.func0 = cosh; + else if( strmatch(next, "tanh" ) ) d->a.func0 = tanh; + else if( strmatch(next, "sin" ) ) d->a.func0 = sin; + else if( strmatch(next, "cos" ) ) d->a.func0 = cos; + else if( strmatch(next, "tan" ) ) d->a.func0 = tan; + else if( strmatch(next, "atan" ) ) d->a.func0 = atan; + else if( strmatch(next, "asin" ) ) d->a.func0 = asin; + else if( strmatch(next, "acos" ) ) d->a.func0 = acos; + else if( strmatch(next, "exp" ) ) d->a.func0 = exp; + else if( strmatch(next, "log" ) ) d->a.func0 = log; + else if( strmatch(next, "abs" ) ) d->a.func0 = fabs; + else if( strmatch(next, "squish") ) d->type = e_squish; + else if( strmatch(next, "gauss" ) ) d->type = e_gauss; + else if( strmatch(next, "mod" ) ) d->type = e_mod; + else if( strmatch(next, "max" ) ) d->type = e_max; + else if( strmatch(next, "min" ) ) d->type = e_min; + else if( strmatch(next, "eq" ) ) d->type = e_eq; + else if( strmatch(next, "gte" ) ) d->type = e_gte; + else if( strmatch(next, "gt" ) ) d->type = e_gt; + else if( strmatch(next, "lte" ) ) { AVEvalExpr * tmp = d->param[1]; d->param[1] = d->param[0]; d->param[0] = tmp; d->type = e_gt; } + else if( strmatch(next, "lt" ) ) { AVEvalExpr * tmp = d->param[1]; d->param[1] = d->param[0]; d->param[0] = tmp; d->type = e_gte; } + else if( strmatch(next, "ld" ) ) d->type = e_ld; + else if( strmatch(next, "st" ) ) d->type = e_st; + else if( strmatch(next, "while" ) ) d->type = e_while; + else { for(i=0; p->func1_name && p->func1_name[i]; i++){ if(strmatch(next, p->func1_name[i])){ - return p->func1[i](p->opaque, d); + d->a.func1 = p->func1[i]; + d->type = e_func1; + return d; } } for(i=0; p->func2_name && p->func2_name[i]; i++){ if(strmatch(next, p->func2_name[i])){ - return p->func2[i](p->opaque, d, d2); + d->a.func2 = p->func2[i]; + d->type = e_func2; + return d; } } - av_log(NULL, AV_LOG_ERROR, "Parser: unknown function in \"%s\"\n", next); - return NAN; + *p->error = "unknown function"; + ff_eval_free(d); + return NULL; } return d; } -static double evalPow(Parser *p){ - int sign= (*p->s == '+') - (*p->s == '-'); - p->s += sign&1; - return (sign|1) * evalPrimary(p); +static AVEvalExpr * new_eval_expr(int type, int value, AVEvalExpr *p0, AVEvalExpr *p1){ + AVEvalExpr * e = av_mallocz(sizeof(AVEvalExpr)); + e->type =type ; + e->value =value ; + e->param[0] =p0 ; + e->param[1] =p1 ; + return e; } -static double evalFactor(Parser *p){ - double ret= evalPow(p); +static AVEvalExpr * parse_pow(Parser *p, int *sign){ + *sign= (*p->s == '+') - (*p->s == '-'); + p->s += *sign&1; + return parse_primary(p); +} + +static AVEvalExpr * parse_factor(Parser *p){ + int sign, sign2; + AVEvalExpr * e = parse_pow(p, &sign); while(p->s[0]=='^'){ p->s++; - ret= pow(ret, evalPow(p)); + e= new_eval_expr(e_pow, 1, e, parse_pow(p, &sign2)); + if (e->param[1]) e->param[1]->value *= (sign2|1); } - return ret; + if (e) e->value *= (sign|1); + return e; } -static double evalTerm(Parser *p){ - double ret= evalFactor(p); +static AVEvalExpr * parse_term(Parser *p){ + AVEvalExpr * e = parse_factor(p); while(p->s[0]=='*' || p->s[0]=='/'){ - if(*p->s++ == '*') ret*= evalFactor(p); - else ret/= evalFactor(p); + int c= *p->s++; + e= new_eval_expr(c == '*' ? e_mul : e_div, 1, e, parse_factor(p)); } - return ret; + return e; } -static double evalExpression(Parser *p){ - double ret= 0; +static AVEvalExpr * parse_subexpr(Parser *p) { + AVEvalExpr * e = parse_term(p); + while(*p->s == '+' || *p->s == '-') { + e= new_eval_expr(e_add, 1, e, parse_term(p)); + }; + + return e; +} + +static AVEvalExpr * parse_expr(Parser *p) { + AVEvalExpr * e; if(p->stack_index <= 0) //protect against stack overflows - return NAN; + return NULL; p->stack_index--; - do{ - ret += evalTerm(p); - }while(*p->s == '+' || *p->s == '-'); + e = parse_subexpr(p); + + while(*p->s == ';') { + p->s++; + e= new_eval_expr(e_last, 1, e, parse_subexpr(p)); + }; p->stack_index++; - return ret; + return e; } -double ff_eval(char *s, double *const_value, const char **const_name, +static int verify_expr(AVEvalExpr * e) { + if (!e) return 0; + switch (e->type) { + case e_value: + case e_const: return 1; + case e_func0: + case e_func1: + case e_squish: + case e_ld: + case e_gauss: return verify_expr(e->param[0]); + default: return verify_expr(e->param[0]) && verify_expr(e->param[1]); + } +} + +AVEvalExpr * ff_parse(char *s, const char **const_name, double (**func1)(void *, double), const char **func1_name, double (**func2)(void *, double, double), char **func2_name, - void *opaque){ + char **error){ Parser p; + AVEvalExpr * e; + char w[strlen(s) + 1], * wp = w; + + while (*s) + if (!isspace(*s++)) *wp++ = s[-1]; + *wp++ = 0; p.stack_index=100; - p.s= s; - p.const_value= const_value; + p.s= w; p.const_name = const_name; p.func1 = func1; p.func1_name = func1_name; p.func2 = func2; p.func2_name = func2_name; + p.error= error; + + e = parse_expr(&p); + if (!verify_expr(e)) { + ff_eval_free(e); + return NULL; + } + return e; +} + +double ff_parse_eval(AVEvalExpr * e, double *const_value, void *opaque) { + Parser p; + + p.const_value= const_value; p.opaque = opaque; + return eval_expr(&p, e); +} - return evalExpression(&p); +double ff_eval2(char *s, double *const_value, const char **const_name, + double (**func1)(void *, double), const char **func1_name, + double (**func2)(void *, double, double), char **func2_name, + void *opaque, char **error){ + AVEvalExpr * e = ff_parse(s, const_name, func1, func1_name, func2, func2_name, error); + double d; + if (!e) return NAN; + d = ff_parse_eval(e, const_value, opaque); + ff_eval_free(e); + return d; } +#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) +attribute_deprecated double ff_eval(char *s, double *const_value, const char **const_name, + double (**func1)(void *, double), const char **func1_name, + double (**func2)(void *, double, double), char **func2_name, + void *opaque){ + char *error=NULL; + double ret; + ret = ff_eval2(s, const_value, const_name, func1, func1_name, func2, func2_name, opaque, &error); + if (error) + av_log(NULL, AV_LOG_ERROR, "Error evaluating \"%s\": %s\n", s, error); + return ret; +} +#endif + #ifdef TEST #undef printf static double const_values[]={ @@ -216,6 +455,7 @@ static const char *const_names[]={ main(){ int i; printf("%f == 12.7\n", ff_eval("1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)", const_values, const_names, NULL, NULL, NULL, NULL, NULL)); + printf("%f == 0.931322575\n", ff_eval("80G/80Gi", const_values, const_names, NULL, NULL, NULL, NULL, NULL)); for(i=0; i<1050; i++){ START_TIMER diff --git a/src/libffmpeg/libavcodec/eval.h b/src/libffmpeg/libavcodec/eval.h new file mode 100644 index 000000000..b52199cf4 --- /dev/null +++ b/src/libffmpeg/libavcodec/eval.h @@ -0,0 +1,84 @@ +/* + * simple arithmetic expression evaluator + * + * Copyright (c) 2002 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file eval.h + * eval header. + */ + +#ifndef AVCODEC_EVAL_H +#define AVCODEC_EVAL_H + +#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) +double ff_eval(char *s, double *const_value, const char **const_name, + double (**func1)(void *, double), const char **func1_name, + double (**func2)(void *, double, double), char **func2_name, + void *opaque); +#endif + +/** + * Parses and evaluates an expression. + * Note, this is significantly slower than ff_parse_eval() + * @param s expression as a zero terminated string for example "1+2^3+5*5+sin(2/3)" + * @param func1 NULL terminated array of function pointers for functions which take 1 argument + * @param func2 NULL terminated array of function pointers for functions which take 2 arguments + * @param const_name NULL terminated array of zero terminated strings of constant identifers for example {"PI", "E", 0} + * @param func1_name NULL terminated array of zero terminated strings of func1 identifers + * @param func2_name NULL terminated array of zero terminated strings of func2 identifers + * @param error pointer to a char* which is set to an error message if something goes wrong + * @param const_value a zero terminated array of values for the identifers from const_name + * @param opaque a pointer which will be passed to all functions from func1 and func2 + * @return the value of the expression + */ +double ff_eval2(char *s, double *const_value, const char **const_name, + double (**func1)(void *, double), const char **func1_name, + double (**func2)(void *, double, double), char **func2_name, + void *opaque, char **error); + +typedef struct ff_expr_s AVEvalExpr; + +/** + * Parses a expression. + * @param s expression as a zero terminated string for example "1+2^3+5*5+sin(2/3)" + * @param func1 NULL terminated array of function pointers for functions which take 1 argument + * @param func2 NULL terminated array of function pointers for functions which take 2 arguments + * @param const_name NULL terminated array of zero terminated strings of constant identifers for example {"PI", "E", 0} + * @param func1_name NULL terminated array of zero terminated strings of func1 identifers + * @param func2_name NULL terminated array of zero terminated strings of func2 identifers + * @param error pointer to a char* which is set to an error message if something goes wrong + * @return AVEvalExpr which must be freed with ff_eval_free by the user when its not needed anymore + * NULL if anything went wrong + */ +AVEvalExpr * ff_parse(char *s, const char **const_name, + double (**func1)(void *, double), const char **func1_name, + double (**func2)(void *, double, double), char **func2_name, + char **error); +/** + * Evaluates a previously parsed expression. + * @param const_value a zero terminated array of values for the identifers from ff_parse const_name + * @param opaque a pointer which will be passed to all functions from func1 and func2 + * @return the value of the expression + */ +double ff_parse_eval(AVEvalExpr * e, double *const_value, void *opaque); +void ff_eval_free(AVEvalExpr * e); + +#endif /* AVCODEC_EVAL_H */ diff --git a/src/libffmpeg/libavcodec/faandct.c b/src/libffmpeg/libavcodec/faandct.c index cd7ef7c6b..e3c0d84a2 100644 --- a/src/libffmpeg/libavcodec/faandct.c +++ b/src/libffmpeg/libavcodec/faandct.c @@ -2,18 +2,20 @@ * Floating point AAN DCT * Copyright (c) 2003 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * this implementation is based upon the IJG integer AAN DCT (see jfdctfst.c) diff --git a/src/libffmpeg/libavcodec/faandct.h b/src/libffmpeg/libavcodec/faandct.h index 677594c04..77dd41dae 100644 --- a/src/libffmpeg/libavcodec/faandct.h +++ b/src/libffmpeg/libavcodec/faandct.h @@ -2,18 +2,20 @@ * Floating point AAN DCT * Copyright (c) 2003 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/fft.c b/src/libffmpeg/libavcodec/fft.c index 1c63f6889..62a6a5576 100644 --- a/src/libffmpeg/libavcodec/fft.c +++ b/src/libffmpeg/libavcodec/fft.c @@ -2,18 +2,20 @@ * FFT/IFFT transforms * Copyright (c) 2002 Fabrice Bellard. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -54,24 +56,35 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse) s->exptab[i].im = s1; } s->fft_calc = ff_fft_calc_c; + s->imdct_calc = ff_imdct_calc; s->exptab1 = NULL; /* compute constant table for HAVE_SSE version */ -#if (defined(HAVE_MMX) && (defined(HAVE_BUILTIN_VECTOR) || defined(HAVE_MM3DNOW))) || defined(HAVE_ALTIVEC) +#if defined(HAVE_MMX) \ + || (defined(HAVE_ALTIVEC) && !defined(ALTIVEC_USE_REFERENCE_C_CODE)) { - int has_vectors = 0; + int has_vectors = mm_support(); + if (has_vectors) { #if defined(HAVE_MMX) -#ifdef HAVE_MM3DNOW - has_vectors = mm_support() & (MM_3DNOW | MM_3DNOWEXT | MM_SSE | MM_SSE2); -#else - has_vectors = mm_support() & (MM_SSE | MM_SSE2); -#endif -#endif -#if defined(HAVE_ALTIVEC) && !defined(ALTIVEC_USE_REFERENCE_C_CODE) - has_vectors = mm_support() & MM_ALTIVEC; + if (has_vectors & MM_3DNOWEXT) { + /* 3DNowEx for K7/K8 */ + s->imdct_calc = ff_imdct_calc_3dn2; + s->fft_calc = ff_fft_calc_3dn2; + } else if (has_vectors & MM_3DNOW) { + /* 3DNow! for K6-2/3 */ + s->fft_calc = ff_fft_calc_3dn; + } else if (has_vectors & MM_SSE) { + /* SSE for P3/P4 */ + s->imdct_calc = ff_imdct_calc_sse; + s->fft_calc = ff_fft_calc_sse; + } +#else /* HAVE_MMX */ + if (has_vectors & MM_ALTIVEC) + s->fft_calc = ff_fft_calc_altivec; #endif - if (has_vectors) { + } + if (s->fft_calc != ff_fft_calc_c) { int np, nblocks, np2, l; FFTComplex *q; @@ -97,27 +110,6 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse) nblocks = nblocks >> 1; } while (nblocks != 0); av_freep(&s->exptab); -#if defined(HAVE_MMX) -#ifdef HAVE_MM3DNOW - if (has_vectors & MM_3DNOWEXT) - /* 3DNowEx for Athlon(XP) */ - s->fft_calc = ff_fft_calc_3dn2; - else if (has_vectors & MM_3DNOW) - /* 3DNow! for K6-2/3 */ - s->fft_calc = ff_fft_calc_3dn; -#endif -#ifdef HAVE_BUILTIN_VECTOR - if (has_vectors & MM_SSE2) - /* SSE for P4/K8 */ - s->fft_calc = ff_fft_calc_sse; - else if ((has_vectors & MM_SSE) && - s->fft_calc == ff_fft_calc_c) - /* SSE for P3 */ - s->fft_calc = ff_fft_calc_sse; -#endif -#else /* HAVE_MMX */ - s->fft_calc = ff_fft_calc_altivec; -#endif } } #endif diff --git a/src/libffmpeg/libavcodec/ffv1.c b/src/libffmpeg/libavcodec/ffv1.c index c987d84f6..62623e591 100644 --- a/src/libffmpeg/libavcodec/ffv1.c +++ b/src/libffmpeg/libavcodec/ffv1.c @@ -3,18 +3,20 @@ * * Copyright (c) 2003 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -223,7 +225,7 @@ static inline void put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signe int i; if(v){ - const int a= ABS(v); + const int a= FFABS(v); const int e= av_log2(a); put_rac(c, state+0, 0); @@ -271,7 +273,7 @@ static inline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed){ static inline void update_vlc_state(VlcState * const state, const int v){ int drift= state->drift; int count= state->count; - state->error_sum += ABS(v); + state->error_sum += FFABS(v); drift += v; if(count == 128){ //FIXME variable @@ -354,6 +356,7 @@ static inline int get_vlc_symbol(GetBitContext *gb, VlcState * const state, int return ret; } +#ifdef CONFIG_ENCODERS static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ PlaneContext * const p= &s->plane[plane_index]; RangeCoder * const c= &s->c; @@ -527,6 +530,7 @@ static void write_header(FFV1Context *f){ for(i=0; i<5; i++) write_quant_table(c, f->quant_table[i]); } +#endif /* CONFIG_ENCODERS */ static int common_init(AVCodecContext *avctx){ FFV1Context *s = avctx->priv_data; @@ -545,6 +549,7 @@ static int common_init(AVCodecContext *avctx){ return 0; } +#ifdef CONFIG_ENCODERS static int encode_init(AVCodecContext *avctx) { FFV1Context *s = avctx->priv_data; @@ -608,6 +613,7 @@ static int encode_init(AVCodecContext *avctx) return 0; } +#endif /* CONFIG_ENCODERS */ static void clear_state(FFV1Context *f){ @@ -632,6 +638,7 @@ static void clear_state(FFV1Context *f){ } } +#ifdef CONFIG_ENCODERS static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ FFV1Context *f = avctx->priv_data; RangeCoder * const c= &f->c; @@ -687,6 +694,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, return used_count + (put_bits_count(&f->pb)+7)/8; } } +#endif /* CONFIG_ENCODERS */ static int common_end(AVCodecContext *avctx){ FFV1Context *s = avctx->priv_data; @@ -1027,5 +1035,6 @@ AVCodec ffv1_encoder = { encode_init, encode_frame, common_end, + .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_RGBA32, -1}, }; #endif diff --git a/src/libffmpeg/libavcodec/flac.c b/src/libffmpeg/libavcodec/flac.c index 659112c77..6c64ad0a1 100644 --- a/src/libffmpeg/libavcodec/flac.c +++ b/src/libffmpeg/libavcodec/flac.c @@ -2,18 +2,20 @@ * FLAC (Free Lossless Audio Codec) decoder * Copyright (c) 2003 Alex Beregszaszi * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -33,6 +35,7 @@ #include +#define ALT_BITSTREAM_READER #include "avcodec.h" #include "bitstream.h" #include "golomb.h" @@ -92,18 +95,23 @@ static int64_t get_utf8(GetBitContext *gb){ } static void metadata_streaminfo(FLACContext *s); -static void dump_headers(FLACContext *s); +static void allocate_buffers(FLACContext *s); +static int metadata_parse(FLACContext *s); static int flac_decode_init(AVCodecContext * avctx) { FLACContext *s = avctx->priv_data; s->avctx = avctx; - /* initialize based on the demuxer-supplied streamdata header */ - if (avctx->extradata_size == FLAC_STREAMINFO_SIZE) { + if (avctx->extradata_size > 4) { + /* initialize based on the demuxer-supplied streamdata header */ init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size*8); - metadata_streaminfo(s); - dump_headers(s); + if (avctx->extradata_size == FLAC_STREAMINFO_SIZE) { + metadata_streaminfo(s); + allocate_buffers(s); + } else { + metadata_parse(s); + } } return 0; @@ -156,7 +164,51 @@ static void metadata_streaminfo(FLACContext *s) skip_bits(&s->gb, 64); /* md5 sum */ skip_bits(&s->gb, 64); /* md5 sum */ - allocate_buffers(s); + dump_headers(s); +} + +/** + * Parse a list of metadata blocks. This list of blocks must begin with + * the fLaC marker. + * @param s the flac decoding context containing the gb bit reader used to + * parse metadata + * @return 1 if some metadata was read, 0 if no fLaC marker was found + */ +static int metadata_parse(FLACContext *s) +{ + int i, metadata_last, metadata_type, metadata_size, streaminfo_updated=0; + + if (show_bits_long(&s->gb, 32) == MKBETAG('f','L','a','C')) { + skip_bits(&s->gb, 32); + + av_log(s->avctx, AV_LOG_DEBUG, "STREAM HEADER\n"); + do { + metadata_last = get_bits(&s->gb, 1); + metadata_type = get_bits(&s->gb, 7); + metadata_size = get_bits_long(&s->gb, 24); + + av_log(s->avctx, AV_LOG_DEBUG, + " metadata block: flag = %d, type = %d, size = %d\n", + metadata_last, metadata_type, metadata_size); + if (metadata_size) { + switch (metadata_type) { + case METADATA_TYPE_STREAMINFO: + metadata_streaminfo(s); + streaminfo_updated = 1; + break; + + default: + for (i=0; igb, 8); + } + } + } while (!metadata_last); + + if (streaminfo_updated) + allocate_buffers(s); + return 1; + } + return 0; } static int decode_residuals(FLACContext *s, int channel, int pred_order) @@ -525,7 +577,6 @@ static int flac_decode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size) { FLACContext *s = avctx->priv_data; - int metadata_last, metadata_type, metadata_size; int tmp = 0, i, j = 0, input_buf_size = 0; int16_t *samples = data; @@ -556,47 +607,8 @@ static int flac_decode_frame(AVCodecContext *avctx, init_get_bits(&s->gb, buf, buf_size*8); - /* fLaC signature (be) */ - if (show_bits_long(&s->gb, 32) == bswap_32(ff_get_fourcc("fLaC"))) + if (!metadata_parse(s)) { - skip_bits(&s->gb, 32); - - av_log(s->avctx, AV_LOG_DEBUG, "STREAM HEADER\n"); - do { - metadata_last = get_bits(&s->gb, 1); - metadata_type = get_bits(&s->gb, 7); - metadata_size = get_bits_long(&s->gb, 24); - - av_log(s->avctx, AV_LOG_DEBUG, " metadata block: flag = %d, type = %d, size = %d\n", - metadata_last, metadata_type, - metadata_size); - if(metadata_size){ - switch(metadata_type) - { - case METADATA_TYPE_STREAMINFO:{ - metadata_streaminfo(s); - - /* Buffer might have been reallocated, reinit bitreader */ - if(buf != &s->bitstream[s->bitstream_index]) - { - int bits_count = get_bits_count(&s->gb); - buf= &s->bitstream[s->bitstream_index]; - init_get_bits(&s->gb, buf, buf_size*8); - skip_bits(&s->gb, bits_count); - } - - dump_headers(s); - break;} - default: - for(i=0; igb, 8); - } - } - } while(!metadata_last); - } - else - { - tmp = show_bits(&s->gb, 16); if(tmp != 0xFFF8){ av_log(s->avctx, AV_LOG_ERROR, "FRAME HEADER not here\n"); diff --git a/src/libffmpeg/libavcodec/flashsv.c b/src/libffmpeg/libavcodec/flashsv.c index 3214d1860..fea8e2224 100644 --- a/src/libffmpeg/libavcodec/flashsv.c +++ b/src/libffmpeg/libavcodec/flashsv.c @@ -3,18 +3,20 @@ * Copyright (C) 2004 Alex Beregszaszi * Copyright (C) 2006 Benjamin Larsson * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/flicvideo.c b/src/libffmpeg/libavcodec/flicvideo.c index fa128d0d3..95cb26ce4 100644 --- a/src/libffmpeg/libavcodec/flicvideo.c +++ b/src/libffmpeg/libavcodec/flicvideo.c @@ -2,18 +2,20 @@ * FLI/FLC Animation Video Decoder * Copyright (C) 2003, 2004 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -154,7 +156,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, int starting_line; signed short line_packets; int y_ptr; - signed char byte_run; + int byte_run; int pixel_skip; int pixel_countdown; unsigned char *pixels; @@ -188,7 +190,6 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, case FLI_256_COLOR: case FLI_COLOR: stream_ptr_after_color_chunk = stream_ptr + chunk_size - 6; - s->new_palette = 1; /* check special case: If this file is from the Magic Carpet * game and uses 6-bit colors even though it reports 256-color @@ -214,6 +215,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, color_changes = 256; for (j = 0; j < color_changes; j++) { + unsigned int entry; /* wrap around, for good measure */ if ((unsigned)palette_ptr >= 256) @@ -222,7 +224,10 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, r = buf[stream_ptr++] << color_shift; g = buf[stream_ptr++] << color_shift; b = buf[stream_ptr++] << color_shift; - s->palette[palette_ptr++] = (r << 16) | (g << 8) | b; + entry = (r << 16) | (g << 8) | b; + if (s->palette[palette_ptr] != entry) + s->new_palette = 1; + s->palette[palette_ptr++] = entry; } } @@ -241,9 +246,15 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, while (compressed_lines > 0) { line_packets = LE_16(&buf[stream_ptr]); stream_ptr += 2; - if (line_packets < 0) { + if ((line_packets & 0xC000) == 0xC000) { + // line skip opcode line_packets = -line_packets; y_ptr += line_packets * s->frame.linesize[0]; + } else if ((line_packets & 0xC000) == 0x4000) { + av_log(avctx, AV_LOG_ERROR, "Undefined opcode (%x) in DELTA_FLI\n", line_packets); + } else if ((line_packets & 0xC000) == 0x8000) { + // "last byte" opcode + pixels[y_ptr + s->frame.linesize[0] - 1] = line_packets & 0xff; } else { compressed_lines--; pixel_ptr = y_ptr; @@ -253,7 +264,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, pixel_skip = buf[stream_ptr++]; pixel_ptr += pixel_skip; pixel_countdown -= pixel_skip; - byte_run = buf[stream_ptr++]; + byte_run = (signed char)(buf[stream_ptr++]); if (byte_run < 0) { byte_run = -byte_run; palette_idx1 = buf[stream_ptr++]; @@ -296,14 +307,14 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, pixel_skip = buf[stream_ptr++]; pixel_ptr += pixel_skip; pixel_countdown -= pixel_skip; - byte_run = buf[stream_ptr++]; + byte_run = (signed char)(buf[stream_ptr++]); if (byte_run > 0) { CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++, pixel_countdown--) { palette_idx1 = buf[stream_ptr++]; pixels[pixel_ptr++] = palette_idx1; } - } else { + } else if (byte_run < 0) { byte_run = -byte_run; palette_idx1 = buf[stream_ptr++]; CHECK_PIXEL_PTR(byte_run); @@ -336,7 +347,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, stream_ptr++; pixel_countdown = s->avctx->width; while (pixel_countdown > 0) { - byte_run = buf[stream_ptr++]; + byte_run = (signed char)(buf[stream_ptr++]); if (byte_run > 0) { palette_idx1 = buf[stream_ptr++]; CHECK_PIXEL_PTR(byte_run); @@ -402,9 +413,8 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, "and final chunk ptr = %d\n", buf_size, stream_ptr); /* make the palette available on the way out */ -// if (s->new_palette) { - if (1) { - memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE); + memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE); + if (s->new_palette) { s->frame.palette_has_changed = 1; s->new_palette = 0; } @@ -439,7 +449,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, int compressed_lines; signed short line_packets; int y_ptr; - signed char byte_run; + int byte_run; int pixel_skip; int pixel_countdown; unsigned char *pixels; @@ -499,7 +509,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, pixel_skip = buf[stream_ptr++]; pixel_ptr += (pixel_skip*2); /* Pixel is 2 bytes wide */ pixel_countdown -= pixel_skip; - byte_run = buf[stream_ptr++]; + byte_run = (signed char)(buf[stream_ptr++]); if (byte_run < 0) { byte_run = -byte_run; pixel = LE_16(&buf[stream_ptr]); @@ -530,9 +540,9 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, break; case FLI_BLACK: - /* set the whole frame to 0x0000 which is balck in both 15Bpp and 16Bpp modes. */ + /* set the whole frame to 0x0000 which is black in both 15Bpp and 16Bpp modes. */ memset(pixels, 0x0000, - s->frame.linesize[0] * s->avctx->height * 2); + s->frame.linesize[0] * s->avctx->height); break; case FLI_BRUN: @@ -545,7 +555,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, pixel_countdown = (s->avctx->width * 2); while (pixel_countdown > 0) { - byte_run = buf[stream_ptr++]; + byte_run = (signed char)(buf[stream_ptr++]); if (byte_run > 0) { palette_idx1 = buf[stream_ptr++]; CHECK_PIXEL_PTR(byte_run); @@ -599,7 +609,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, pixel_countdown = s->avctx->width; /* Width is in pixels, not bytes */ while (pixel_countdown > 0) { - byte_run = buf[stream_ptr++]; + byte_run = (signed char)(buf[stream_ptr++]); if (byte_run > 0) { pixel = LE_16(&buf[stream_ptr]); stream_ptr += 2; diff --git a/src/libffmpeg/libavcodec/fraps.c b/src/libffmpeg/libavcodec/fraps.c index d107e47b1..18d270049 100644 --- a/src/libffmpeg/libavcodec/fraps.c +++ b/src/libffmpeg/libavcodec/fraps.c @@ -1,19 +1,22 @@ /* * Fraps FPS1 decoder * Copyright (c) 2005 Roine Gustafsson + * Copyright (c) 2006 Konstantin Shishkov * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -22,24 +25,41 @@ * @file fraps.c * Lossless Fraps 'FPS1' decoder * @author Roine Gustafsson + * @author Konstantin Shishkov * - * Only decodes version 0 and 1 files. * Codec algorithm for version 0 is taken from Transcode * - * Version 2 files, which are the most commonly found Fraps files, cannot be - * decoded yet. + * Version 2 files support by Konstantin Shishkov */ #include "avcodec.h" +#include "bitstream.h" +#include "dsputil.h" #define FPS_TAG MKTAG('F', 'P', 'S', 'x') +/* symbol for Huffman tree node */ +#define HNODE -1 + +/** + * Huffman node + * FIXME one day this should belong to one general framework + */ +typedef struct Node{ + int16_t sym; + int16_t n0; + int count; +}Node; + /** * local variable storage */ typedef struct FrapsContext{ AVCodecContext *avctx; AVFrame frame; + Node nodes[512]; + uint8_t *tmpbuf; + DSPContext dsp; } FrapsContext; @@ -58,10 +78,117 @@ static int decode_init(AVCodecContext *avctx) s->avctx = avctx; s->frame.data[0] = NULL; + s->tmpbuf = NULL; + + dsputil_init(&s->dsp, avctx); return 0; } +/** + * Comparator - our nodes should ascend by count + * but with preserved symbol order + */ +static int huff_cmp(const Node *a, const Node *b){ + return (a->count - b->count)*256 + a->sym - b->sym; +} + +static void get_tree_codes(uint32_t *bits, int16_t *lens, uint8_t *xlat, Node *nodes, int node, uint32_t pfx, int pl, int *pos) +{ + int s; + + s = nodes[node].sym; + if(s != HNODE || !nodes[node].count){ + bits[*pos] = pfx; + lens[*pos] = pl; + xlat[*pos] = s; + (*pos)++; + }else{ + pfx <<= 1; + pl++; + get_tree_codes(bits, lens, xlat, nodes, nodes[node].n0, pfx, pl, pos); + pfx |= 1; + get_tree_codes(bits, lens, xlat, nodes, nodes[node].n0+1, pfx, pl, pos); + } +} + +static int build_huff_tree(VLC *vlc, Node *nodes, uint8_t *xlat) +{ + uint32_t bits[256]; + int16_t lens[256]; + int pos = 0; + + get_tree_codes(bits, lens, xlat, nodes, 510, 0, 0, &pos); + return init_vlc(vlc, 9, pos, lens, 2, 2, bits, 4, 4, 0); +} + + +/** + * decode Fraps v2 packed plane + */ +static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w, + int h, uint8_t *src, int size, int Uoff) +{ + int i, j; + int cur_node; + GetBitContext gb; + VLC vlc; + int64_t sum = 0; + uint8_t recode[256]; + + for(i = 0; i < 256; i++){ + s->nodes[i].sym = i; + s->nodes[i].count = LE_32(src); + s->nodes[i].n0 = -2; + if(s->nodes[i].count < 0) { + av_log(s->avctx, AV_LOG_ERROR, "Symbol count < 0\n"); + return -1; + } + src += 4; + sum += s->nodes[i].count; + } + size -= 1024; + + if(sum >> 31) { + av_log(s->avctx, AV_LOG_ERROR, "Too high symbol frequencies. Tree construction is not possible\n"); + return -1; + } + qsort(s->nodes, 256, sizeof(Node), huff_cmp); + cur_node = 256; + for(i = 0; i < 511; i += 2){ + s->nodes[cur_node].sym = HNODE; + s->nodes[cur_node].count = s->nodes[i].count + s->nodes[i+1].count; + s->nodes[cur_node].n0 = i; + for(j = cur_node; j > 0; j--){ + if(s->nodes[j].count >= s->nodes[j - 1].count) break; + FFSWAP(Node, s->nodes[j], s->nodes[j - 1]); + } + cur_node++; + } + if(build_huff_tree(&vlc, s->nodes, recode) < 0){ + av_log(s->avctx, AV_LOG_ERROR, "Error building tree\n"); + return -1; + } + /* we have built Huffman table and are ready to decode plane */ + + /* convert bits so they may be used by standard bitreader */ + s->dsp.bswap_buf(s->tmpbuf, src, size >> 2); + + init_get_bits(&gb, s->tmpbuf, size * 8); + for(j = 0; j < h; j++){ + for(i = 0; i < w; i++){ + dst[i] = recode[get_vlc2(&gb, vlc.table, 9, 3)]; + /* lines are stored as deltas between previous lines + * and we need to add 0x80 to the first lines of chroma planes + */ + if(j) dst[i] += dst[i - stride]; + else if(Uoff) dst[i] += 0x80; + } + dst += stride; + } + free_vlc(&vlc); + return 0; +} /** * decode a frame @@ -84,16 +211,18 @@ static int decode_frame(AVCodecContext *avctx, unsigned int x, y; uint32_t *buf32; uint32_t *luma1,*luma2,*cb,*cr; + uint32_t offs[4]; + int i, is_chroma, planes; header = LE_32(buf); version = header & 0xff; header_size = (header & (1<<30))? 8 : 4; /* bit 30 means pad to 8 bytes */ - if (version > 1) { + if (version > 2 && version != 4) { av_log(avctx, AV_LOG_ERROR, "This file is encoded with Fraps version %d. " \ - "This codec can only decode version 0 and 1.\n", version); + "This codec can only decode version 0, 1, 2 and 4.\n", version); return -1; } @@ -185,30 +314,50 @@ static int decode_frame(AVCodecContext *avctx, break; case 2: + case 4: /** - * Fraps v2 sub-header description. All numbers are little-endian: - * (this is all guesswork) - * - * 0: DWORD 'FPSx' - * 4: DWORD 0x00000010 unknown, perhaps flags - * 8: DWORD off_2 offset to plane 2 - * 12: DWORD off_3 offset to plane 3 - * 16: 256xDWORD freqtbl_1 frequency table for plane 1 - * 1040: plane_1 - * ... - * off_2: 256xDWORD freqtbl_2 frequency table for plane 2 - * plane_2 - * ... - * off_3: 256xDWORD freqtbl_3 frequency table for plane 3 - * plane_3 + * Fraps v2 is Huffman-coded YUV420 planes + * Fraps v4 is virtually the same */ - if ((BE_32(buf) != FPS_TAG)||(buf_size < (3*1024 + 8))) { + avctx->pix_fmt = PIX_FMT_YUV420P; + planes = 3; + f->reference = 1; + f->buffer_hints = FF_BUFFER_HINTS_VALID | + FF_BUFFER_HINTS_PRESERVE | + FF_BUFFER_HINTS_REUSABLE; + if (avctx->reget_buffer(avctx, f)) { + av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + return -1; + } + /* skip frame */ + if(buf_size == 8) { + f->pict_type = FF_P_TYPE; + f->key_frame = 0; + break; + } + f->pict_type = FF_I_TYPE; + f->key_frame = 1; + if ((LE_32(buf) != FPS_TAG)||(buf_size < (planes*1024 + 24))) { av_log(avctx, AV_LOG_ERROR, "Fraps: error in data stream\n"); return -1; } - - /* NOT FINISHED */ - + for(i = 0; i < planes; i++) { + offs[i] = LE_32(buf + 4 + i * 4); + if(offs[i] >= buf_size || (i && offs[i] <= offs[i - 1] + 1024)) { + av_log(avctx, AV_LOG_ERROR, "Fraps: plane %i offset is out of bounds\n", i); + return -1; + } + } + offs[planes] = buf_size; + for(i = 0; i < planes; i++){ + is_chroma = !!i; + s->tmpbuf = av_realloc(s->tmpbuf, offs[i + 1] - offs[i] - 1024 + FF_INPUT_BUFFER_PADDING_SIZE); + if(fraps2_decode_plane(s, f->data[i], f->linesize[i], avctx->width >> is_chroma, + avctx->height >> is_chroma, buf + offs[i], offs[i + 1] - offs[i], is_chroma) < 0) { + av_log(avctx, AV_LOG_ERROR, "Error decoding plane %i\n", i); + return -1; + } + } break; } @@ -231,6 +380,7 @@ static int decode_end(AVCodecContext *avctx) if (s->frame.data[0]) avctx->release_buffer(avctx, &s->frame); + av_freep(&s->tmpbuf); return 0; } diff --git a/src/libffmpeg/libavcodec/g726.c b/src/libffmpeg/libavcodec/g726.c index 8114fe0f3..c509292b6 100644 --- a/src/libffmpeg/libavcodec/g726.c +++ b/src/libffmpeg/libavcodec/g726.c @@ -5,18 +5,20 @@ * This is a very straightforward rendition of the G.726 * Section 4 "Computational Details". * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include @@ -31,20 +33,19 @@ * instead of simply using 32bit integer arithmetic. */ typedef struct Float11 { - int sign; /**< 1bit sign */ - int exp; /**< 4bit exponent */ - int mant; /**< 6bit mantissa */ + int sign; /**< 1bit sign */ + int exp; /**< 4bit exponent */ + int mant; /**< 6bit mantissa */ } Float11; static inline Float11* i2f(int16_t i, Float11* f) { - f->sign = (i < 0); - if (f->sign) - i = -i; - f->exp = av_log2_16bit(i) + !!i; - f->mant = i? (i<<6) >> f->exp : - 1<<5; - return f; + f->sign = (i < 0); + if (f->sign) + i = -i; + f->exp = av_log2_16bit(i) + !!i; + f->mant = i? (i<<6) >> f->exp : 1<<5; + return f; } static inline int16_t mult(Float11* f1, Float11* f2) @@ -59,39 +60,39 @@ static inline int16_t mult(Float11* f1, Float11* f2) static inline int sgn(int value) { - return (value < 0) ? -1 : 1; + return (value < 0) ? -1 : 1; } typedef struct G726Tables { - int bits; /**< bits per sample */ - int* quant; /**< quantization table */ - int* iquant; /**< inverse quantization table */ - int* W; /**< special table #1 ;-) */ - int* F; /**< special table #2 */ + int bits; /**< bits per sample */ + int* quant; /**< quantization table */ + int* iquant; /**< inverse quantization table */ + int* W; /**< special table #1 ;-) */ + int* F; /**< special table #2 */ } G726Tables; typedef struct G726Context { - G726Tables* tbls; /**< static tables needed for computation */ - - Float11 sr[2]; /**< prev. reconstructed samples */ - Float11 dq[6]; /**< prev. difference */ - int a[2]; /**< second order predictor coeffs */ - int b[6]; /**< sixth order predictor coeffs */ - int pk[2]; /**< signs of prev. 2 sez + dq */ - - int ap; /**< scale factor control */ - int yu; /**< fast scale factor */ - int yl; /**< slow scale factor */ - int dms; /**< short average magnitude of F[i] */ - int dml; /**< long average magnitude of F[i] */ - int td; /**< tone detect */ - - int se; /**< estimated signal for the next iteration */ - int sez; /**< estimated second order prediction */ - int y; /**< quantizer scaling factor for the next iteration */ + G726Tables* tbls; /**< static tables needed for computation */ + + Float11 sr[2]; /**< prev. reconstructed samples */ + Float11 dq[6]; /**< prev. difference */ + int a[2]; /**< second order predictor coeffs */ + int b[6]; /**< sixth order predictor coeffs */ + int pk[2]; /**< signs of prev. 2 sez + dq */ + + int ap; /**< scale factor control */ + int yu; /**< fast scale factor */ + int yl; /**< slow scale factor */ + int dms; /**< short average magnitude of F[i] */ + int dml; /**< long average magnitude of F[i] */ + int td; /**< tone detect */ + + int se; /**< estimated signal for the next iteration */ + int sez; /**< estimated second order prediction */ + int y; /**< quantizer scaling factor for the next iteration */ } G726Context; -static int quant_tbl16[] = /**< 16kbit/s 2bits per sample */ +static int quant_tbl16[] = /**< 16kbit/s 2bits per sample */ { 260, INT_MAX }; static int iquant_tbl16[] = { 116, 365, 365, 116 }; @@ -100,7 +101,7 @@ static int W_tbl16[] = static int F_tbl16[] = { 0, 7, 7, 0 }; -static int quant_tbl24[] = /**< 24kbit/s 3bits per sample */ +static int quant_tbl24[] = /**< 24kbit/s 3bits per sample */ { 7, 217, 330, INT_MAX }; static int iquant_tbl24[] = { INT_MIN, 135, 273, 373, 373, 273, 135, INT_MIN }; @@ -109,7 +110,7 @@ static int W_tbl24[] = static int F_tbl24[] = { 0, 1, 2, 7, 7, 2, 1, 0 }; -static int quant_tbl32[] = /**< 32kbit/s 4bits per sample */ +static int quant_tbl32[] = /**< 32kbit/s 4bits per sample */ { -125, 79, 177, 245, 299, 348, 399, INT_MAX }; static int iquant_tbl32[] = { INT_MIN, 4, 135, 213, 273, 323, 373, 425, @@ -120,7 +121,7 @@ static int W_tbl32[] = static int F_tbl32[] = { 0, 0, 0, 1, 1, 1, 3, 7, 7, 3, 1, 1, 1, 0, 0, 0 }; -static int quant_tbl40[] = /**< 40kbit/s 5bits per sample */ +static int quant_tbl40[] = /**< 40kbit/s 5bits per sample */ { -122, -16, 67, 138, 197, 249, 297, 338, 377, 412, 444, 474, 501, 527, 552, INT_MAX }; static int iquant_tbl40[] = @@ -149,25 +150,25 @@ static G726Tables G726Tables_pool[] = */ static inline uint8_t quant(G726Context* c, int d) { - int sign, exp, i, dln; + int sign, exp, i, dln; - sign = i = 0; - if (d < 0) { - sign = 1; - d = -d; - } - exp = av_log2_16bit(d); - dln = ((exp<<7) + (((d<<7)>>exp)&0x7f)) - (c->y>>2); + sign = i = 0; + if (d < 0) { + sign = 1; + d = -d; + } + exp = av_log2_16bit(d); + dln = ((exp<<7) + (((d<<7)>>exp)&0x7f)) - (c->y>>2); - while (c->tbls->quant[i] < INT_MAX && c->tbls->quant[i] < dln) + while (c->tbls->quant[i] < INT_MAX && c->tbls->quant[i] < dln) ++i; - if (sign) - i = ~i; - if (c->tbls->bits != 2 && i == 0) /* I'm not sure this is a good idea */ - i = 0xff; + if (sign) + i = ~i; + if (c->tbls->bits != 2 && i == 0) /* I'm not sure this is a good idea */ + i = 0xff; - return i; + return i; } /** @@ -209,7 +210,7 @@ static inline int16_t g726_iterate(G726Context* c, int16_t I) c->a[0] = 0; c->a[1] = 0; for (i=0; i<6; i++) - c->b[i] = 0; + c->b[i] = 0; } else { /* This is a bit crazy, but it really is +255 not +256 */ fa1 = clip((-c->a[0]*c->pk[0]*pk0)>>5, -256, 255); @@ -220,7 +221,7 @@ static inline int16_t g726_iterate(G726Context* c, int16_t I) c->a[0] = clip(c->a[0], -(15360 - c->a[1]), 15360 - c->a[1]); for (i=0; i<6; i++) - c->b[i] += 128*dq0*sgn(-c->dq[i].sign) - (c->b[i]>>8); + c->b[i] += 128*dq0*sgn(-c->dq[i].sign) - (c->b[i]>>8); } /* Update Dq and Sr and Pk */ @@ -229,7 +230,7 @@ static inline int16_t g726_iterate(G726Context* c, int16_t I) c->sr[1] = c->sr[0]; i2f(re_signal, &c->sr[0]); for (i=5; i>0; i--) - c->dq[i] = c->dq[i-1]; + c->dq[i] = c->dq[i-1]; i2f(dq, &c->dq[0]); c->dq[0].sign = I >> (c->tbls->bits - 1); /* Isn't it crazy ?!?! */ @@ -240,11 +241,11 @@ static inline int16_t g726_iterate(G726Context* c, int16_t I) c->dms += ((c->tbls->F[I]<<9) - c->dms) >> 5; c->dml += ((c->tbls->F[I]<<11) - c->dml) >> 7; if (tr) - c->ap = 256; + c->ap = 256; else if (c->y > 1535 && !c->td && (abs((c->dms << 2) - c->dml) < (c->dml >> 3))) - c->ap += (-c->ap) >> 4; + c->ap += (-c->ap) >> 4; else - c->ap += (0x200 - c->ap) >> 4; + c->ap += (0x200 - c->ap) >> 4; /* Update Yu and Yl */ c->yu = clip(c->y + (((c->tbls->W[I] << 5) - c->y) >> 5), 544, 5120); @@ -257,10 +258,10 @@ static inline int16_t g726_iterate(G726Context* c, int16_t I) /* Next iteration for SE and SEZ */ c->se = 0; for (i=0; i<6; i++) - c->se += mult(i2f(c->b[i] >> 2, &f), &c->dq[i]); + c->se += mult(i2f(c->b[i] >> 2, &f), &c->dq[i]); c->sez = c->se >> 1; for (i=0; i<2; i++) - c->se += mult(i2f(c->a[i] >> 2, &f), &c->sr[i]); + c->se += mult(i2f(c->a[i] >> 2, &f), &c->sr[i]); c->se >>= 1; return clip(re_signal << 2, -0xffff, 0xffff); @@ -272,13 +273,13 @@ static int g726_reset(G726Context* c, int bit_rate) c->tbls = &G726Tables_pool[bit_rate/8000 - 2]; for (i=0; i<2; i++) { - i2f(0, &c->sr[i]); - c->a[i] = 0; - c->pk[i] = 1; + i2f(0, &c->sr[i]); + c->a[i] = 0; + c->pk[i] = 1; } for (i=0; i<6; i++) { - i2f(0, &c->dq[i]); - c->b[i] = 0; + i2f(0, &c->dq[i]); + c->b[i] = 0; } c->ap = 0; c->dms = 0; @@ -299,22 +300,24 @@ static int16_t g726_decode(G726Context* c, int16_t i) return g726_iterate(c, i); } +#ifdef CONFIG_ENCODERS static int16_t g726_encode(G726Context* c, int16_t sig) { - uint8_t i; + uint8_t i; - i = quant(c, sig/4 - c->se) & ((1<tbls->bits) - 1); - g726_iterate(c, i); - return i; + i = quant(c, sig/4 - c->se) & ((1<tbls->bits) - 1); + g726_iterate(c, i); + return i; } +#endif /* Interfacing to the libavcodec */ typedef struct AVG726Context { - G726Context c; - int bits_left; - int bit_buffer; - int code_size; + G726Context c; + int bits_left; + int bit_buffer; + int code_size; } AVG726Context; static int g726_init(AVCodecContext * avctx) @@ -350,6 +353,7 @@ static int g726_close(AVCodecContext *avctx) return 0; } +#ifdef CONFIG_ENCODERS static int g726_encode_frame(AVCodecContext *avctx, uint8_t *dst, int buf_size, void *data) { @@ -360,12 +364,13 @@ static int g726_encode_frame(AVCodecContext *avctx, init_put_bits(&pb, dst, 1024*1024); for (; buf_size; buf_size--) - put_bits(&pb, c->code_size, g726_encode(&c->c, *samples++)); + put_bits(&pb, c->code_size, g726_encode(&c->c, *samples++)); flush_put_bits(&pb); return put_bits_count(&pb)>>3; } +#endif static int g726_decode_frame(AVCodecContext *avctx, void *data, int *data_size, diff --git a/src/libffmpeg/libavcodec/golomb.c b/src/libffmpeg/libavcodec/golomb.c index c140b8b07..50df4fc40 100644 --- a/src/libffmpeg/libavcodec/golomb.c +++ b/src/libffmpeg/libavcodec/golomb.c @@ -2,18 +2,20 @@ * exp golomb vlc stuff * Copyright (c) 2003 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/golomb.h b/src/libffmpeg/libavcodec/golomb.h index a8221ec29..9bf7aec46 100644 --- a/src/libffmpeg/libavcodec/golomb.h +++ b/src/libffmpeg/libavcodec/golomb.h @@ -3,18 +3,20 @@ * Copyright (c) 2003 Michael Niedermayer * Copyright (c) 2004 Alex Beregszaszi * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -443,6 +445,10 @@ static inline void set_ur_golomb_jpegls(PutBitContext *pb, int i, int k, int lim if(k) put_bits(pb, k, i&((1< 31) { + put_bits(pb, 31, 0); + limit -= 31; + } put_bits(pb, limit , 1); put_bits(pb, esc_len, i - 1); } diff --git a/src/libffmpeg/libavcodec/h261.c b/src/libffmpeg/libavcodec/h261.c index e56978e61..8d4ca08cd 100644 --- a/src/libffmpeg/libavcodec/h261.c +++ b/src/libffmpeg/libavcodec/h261.c @@ -3,18 +3,20 @@ * Copyright (c) 2002-2004 Michael Niedermayer * Copyright (c) 2004 Maarten Daniels * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -75,7 +77,7 @@ void ff_h261_loop_filter(MpegEncContext *s){ s->dsp.h261_loop_filter(dest_cr, uvlinesize); } -static int ff_h261_get_picture_format(int width, int height){ +int ff_h261_get_picture_format(int width, int height){ // QCIF if (width == 176 && height == 144) return 0; @@ -373,8 +375,6 @@ static VLC h261_mtype_vlc; static VLC h261_mv_vlc; static VLC h261_cbp_vlc; -void init_vlc_rl(RLTable *rl, int use_static); - static void h261_decode_init_vlc(H261Context *h){ static int done = 0; @@ -781,7 +781,14 @@ static int h261_decode_picture_header(H261Context *h){ } /* temporal reference */ - s->picture_number = get_bits(&s->gb, 5); /* picture timestamp */ + i= get_bits(&s->gb, 5); /* picture timestamp */ + if(i < (s->picture_number&31)) + i += 32; + s->picture_number = (s->picture_number&~31) + i; + + s->avctx->time_base= (AVRational){1001, 30000}; + s->current_picture.pts= s->picture_number; + /* PTYPE starts here */ skip_bits1(&s->gb); /* split screen off */ @@ -859,7 +866,6 @@ static int h261_find_frame_end(ParseContext *pc, AVCodecContext* avctx, const ui state= (state<<8) | buf[i]; for(j=0; j<8; j++){ if(((state>>j)&0xFFFFF) == 0x00010){ - i++; vop_found=1; break; } @@ -999,10 +1005,6 @@ assert(s->current_picture.pict_type == s->pict_type); *pict= *(AVFrame*)s->current_picture_ptr; ff_print_debug_info(s, pict); - /* Return the Picture timestamp as the frame number */ - /* we substract 1 because it is added on utils.c */ - avctx->frame_number = s->picture_number - 1; - *data_size = sizeof(AVFrame); return get_consumed_bytes(s, buf_size); @@ -1026,6 +1028,7 @@ AVCodec h261_encoder = { MPV_encode_init, MPV_encode_picture, MPV_encode_end, + .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1}, }; #endif diff --git a/src/libffmpeg/libavcodec/h261data.h b/src/libffmpeg/libavcodec/h261data.h index 9ea991b23..2a93b73e3 100755 --- a/src/libffmpeg/libavcodec/h261data.h +++ b/src/libffmpeg/libavcodec/h261data.h @@ -1,3 +1,24 @@ +/* + * copyright (c) 2002-2004 Michael Niedermayer + * copyright (c) 2004 Maarten Daniels + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + /** * @file h261data.h * H.261 tables. @@ -5,7 +26,7 @@ #define MB_TYPE_H261_FIL 0x800000 // H.261 VLC table for macroblock addressing -const uint8_t h261_mba_code[35] = { +static const uint8_t h261_mba_code[35] = { 1, 3, 2, 3, 2, 3, 2, 7, 6, 11, 10, 9, @@ -19,7 +40,7 @@ const uint8_t h261_mba_code[35] = { 1 //(start code) }; -const uint8_t h261_mba_bits[35] = { +static const uint8_t h261_mba_bits[35] = { 1, 3, 3, 4, 4, 5, 5, 7, 7, 8, 8, 8, @@ -34,13 +55,13 @@ const uint8_t h261_mba_bits[35] = { }; //H.261 VLC table for macroblock type -const uint8_t h261_mtype_code[10] = { +static const uint8_t h261_mtype_code[10] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; -const uint8_t h261_mtype_bits[10] = { +static const uint8_t h261_mtype_bits[10] = { 4, 7, 1, 5, 9, 8, 10, 3, 2, 6 @@ -60,7 +81,7 @@ static const int h261_mtype_map[10]= { }; //H.261 VLC table for motion vectors -const uint8_t h261_mv_tab[17][2] = { +static const uint8_t h261_mv_tab[17][2] = { {1,1}, {1,2}, {1,3}, {1,4}, {3,6}, {5,7}, {4,7}, {3,7}, {11,9}, {10,9}, {9,9}, {17,10}, {16,10}, {15,10}, {14,10}, {13,10}, {12,10} }; @@ -71,7 +92,7 @@ static const int mvmap[17] = }; //H.261 VLC table for coded block pattern -const uint8_t h261_cbp_tab[63][2] = +static const uint8_t h261_cbp_tab[63][2] = { {11,5}, {9,5}, {13,6}, {13,4}, {23,7}, {19,7}, {31,8}, {12,4}, {22,7}, {18,7}, {30,8}, {19,5}, {27,8}, {23,8}, {19,8}, {11,4}, @@ -84,7 +105,7 @@ const uint8_t h261_cbp_tab[63][2] = }; //H.261 VLC table for transform coefficients -const uint16_t h261_tcoeff_vlc[65][2] = { +static const uint16_t h261_tcoeff_vlc[65][2] = { { 0x2, 2 }, { 0x3, 2 },{ 0x4, 4 },{ 0x5, 5 }, { 0x6, 7 },{ 0x26, 8 },{ 0x21, 8 },{ 0xa, 10 }, { 0x1d, 12 },{ 0x18, 12 },{ 0x13, 12 },{ 0x10 , 12 }, @@ -104,7 +125,7 @@ const uint16_t h261_tcoeff_vlc[65][2] = { { 0x1, 6 } //escape }; -const int8_t h261_tcoeff_level[64] = { +static const int8_t h261_tcoeff_level[64] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 1, @@ -115,7 +136,7 @@ const int8_t h261_tcoeff_level[64] = { 1, 1, 1, 1, 1, 1, 1, 1 }; -const int8_t h261_tcoeff_run[64] = { +static const int8_t h261_tcoeff_run[64] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, diff --git a/src/libffmpeg/libavcodec/h263.c b/src/libffmpeg/libavcodec/h263.c index f88114f70..ba51c245a 100644 --- a/src/libffmpeg/libavcodec/h263.c +++ b/src/libffmpeg/libavcodec/h263.c @@ -5,18 +5,20 @@ * Copyright (c) 2001 Juan J. Sierralta P. * Copyright (c) 2002-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * ac prediction encoding, b-frame support, error resilience, optimizations, @@ -60,6 +62,8 @@ static void h263p_encode_umotion(MpegEncContext * s, int val); static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n, int dc, uint8_t *scan_table, PutBitContext *dc_pb, PutBitContext *ac_pb); +static int mpeg4_get_block_length(MpegEncContext * s, DCTELEM * block, int n, int intra_dc, + uint8_t *scan_table); #endif static int h263_decode_motion(MpegEncContext * s, int pred, int fcode); @@ -69,10 +73,8 @@ static int h263_decode_block(MpegEncContext * s, DCTELEM * block, static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr); static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, int n, int coded, int intra, int rvlc); -static int mpeg4_get_block_length(MpegEncContext * s, DCTELEM * block, int n, int intra_dc, - uint8_t *scan_table); -static int h263_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr); #ifdef CONFIG_ENCODERS +static int h263_pred_dc(MpegEncContext * s, int n, int16_t **dc_val_ptr); static void mpeg4_encode_visual_object_header(MpegEncContext * s); static void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number); #endif //CONFIG_ENCODERS @@ -111,7 +113,7 @@ max run: 29/41 #endif #if 0 //3IV1 is quite rare and it slows things down a tiny bit -#define IS_3IV1 s->avctx->codec_tag == ff_get_fourcc("3IV1") +#define IS_3IV1 s->codec_tag == ff_get_fourcc("3IV1") #else #define IS_3IV1 0 #endif @@ -210,7 +212,7 @@ void h263_encode_picture_header(MpegEncContext * s, int picture_number) int div, error; div= (s->avctx->time_base.num*1800000LL + 500LL*s->avctx->time_base.den) / ((1000LL+i)*s->avctx->time_base.den); div= clip(1, div, 127); - error= ABS(s->avctx->time_base.num*1800000LL - (1000LL+i)*s->avctx->time_base.den*div); + error= FFABS(s->avctx->time_base.num*1800000LL - (1000LL+i)*s->avctx->time_base.den*div); if(error < best_error){ best_error= error; best_divisor= div; @@ -556,7 +558,7 @@ void ff_clean_mpeg4_qscales(MpegEncContext *s){ #define tab_size ((signed)(sizeof(s->direct_scale_mv[0])/sizeof(int16_t))) #define tab_bias (tab_size/2) -static void ff_mpeg4_init_direct_mv(MpegEncContext *s){ +void ff_mpeg4_init_direct_mv(MpegEncContext *s){ int i; for(i=0; idirect_scale_mv[0][i] = (i-tab_bias)*s->pb_time/s->pp_time; @@ -1231,7 +1233,7 @@ void h263_encode_mb(MpegEncContext * s, int cbpc, cbpy, i, cbp, pred_x, pred_y; int16_t pred_dc; int16_t rec_intradc[6]; - uint16_t *dc_ptr[6]; + int16_t *dc_ptr[6]; const int interleaved_stats= (s->flags&CODEC_FLAG_PASS1); const int dquant_code[5]= {1,0,9,2,3}; @@ -1515,7 +1517,8 @@ void ff_h263_loop_filter(MpegEncContext * s){ } } -static int h263_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr) +#ifdef CONFIG_ENCODERS +static int h263_pred_dc(MpegEncContext * s, int n, int16_t **dc_val_ptr) { int x, y, wrap, a, c, pred_dc, scale; int16_t *dc_val; @@ -1559,6 +1562,7 @@ static int h263_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr) *dc_val_ptr = &dc_val[x + y * wrap]; return pred_dc; } +#endif /* CONFIG_ENCODERS */ static void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n) { @@ -2527,7 +2531,7 @@ void ff_set_qscale(MpegEncContext * s, int qscale) static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, int level, int *dir_ptr, int encoding) { int a, b, c, wrap, pred, scale, ret; - uint16_t *dc_val; + int16_t *dc_val; /* find prediction */ if (n < 4) { @@ -3184,20 +3188,29 @@ void ff_mpeg4_encode_video_packet_header(MpegEncContext *s) * @return 0 if not */ static inline int mpeg4_is_resync(MpegEncContext *s){ - const int bits_count= get_bits_count(&s->gb); + int bits_count= get_bits_count(&s->gb); + int v= show_bits(&s->gb, 16); if(s->workaround_bugs&FF_BUG_NO_PADDING){ return 0; } + while(v<=0xFF){ + if(s->pict_type==B_TYPE || (v>>(8-s->pict_type)!=1) || s->partitioned_frame) + break; + skip_bits(&s->gb, 8+s->pict_type); + bits_count+= 8+s->pict_type; + v= show_bits(&s->gb, 16); + } + if(bits_count + 8 >= s->gb.size_in_bits){ - int v= show_bits(&s->gb, 8); + v>>=8; v|= 0x7F >> (7-(bits_count&7)); if(v==0x7F) return 1; }else{ - if(show_bits(&s->gb, 16) == ff_mpeg4_resync_prefix[bits_count&7]){ + if(v == ff_mpeg4_resync_prefix[bits_count&7]){ int len; GetBitContext gb= s->gb; @@ -4516,12 +4529,6 @@ end: /* per-MB end of slice check */ if(s->codec_id==CODEC_ID_MPEG4){ -#if 0 //http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_IEC_14496-4_2004_Conformance_Testing/video_conformance/version_1/simple/ERROR.ZIP/mit025.m4v needs this but its unclear if the mpeg4 standard allows this at all (MN) - if(s->pict_type != B_TYPE){ - while(show_bits(&s->gb, 9 + (s->pict_type == P_TYPE)) == 1) - skip_bits(&s->gb, 9 + (s->pict_type == P_TYPE)); - } -#endif if(mpeg4_is_resync(s)){ const int delta= s->mb_x + 1 == s->mb_width ? 2 : 1; if(s->pict_type==B_TYPE && s->next_picture.mbskip_table[xy + delta]) @@ -4929,7 +4936,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, #if 0 if(s->error_resilience >= FF_ER_COMPLIANT){ - const int abs_level= ABS(level); + const int abs_level= FFABS(level); if(abs_level<=MAX_LEVEL && run<=MAX_RUN){ const int run1= run - rl->max_run[last][abs_level] - 1; if(abs_level <= rl->max_level[last][run]){ @@ -5290,7 +5297,7 @@ int h263_decode_picture_header(MpegEncContext *s) ); } #if 1 - if (s->pict_type == I_TYPE && s->avctx->codec_tag == ff_get_fourcc("ZYGO")){ + if (s->pict_type == I_TYPE && s->codec_tag == ff_get_fourcc("ZYGO")){ int i,j; for(i=0; i<85; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb)); av_log(s->avctx, AV_LOG_DEBUG, "\n"); @@ -5615,7 +5622,7 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){ skip_bits1(gb); /* marker */ height = get_bits(gb, 13); skip_bits1(gb); /* marker */ - if(width && height && !(s->width && s->avctx->codec_tag == ff_get_fourcc("MP4S"))){ /* they should be non zero but who knows ... */ + if(width && height && !(s->width && s->codec_tag == ff_get_fourcc("MP4S"))){ /* they should be non zero but who knows ... */ s->width = width; s->height = height; // printf("width/height: %d %d\n", width, height); @@ -5799,7 +5806,7 @@ static int decode_user_data(MpegEncContext *s, GetBitContext *gb){ int ver = 0, build = 0, ver2 = 0, ver3 = 0; char last; - for(i=0; i<255 && gb->index < gb->size_in_bits; i++){ + for(i=0; i<255 && get_bits_count(gb) < gb->size_in_bits; i++){ if(show_bits(gb, 23) == 0) break; buf[i]= get_bits(gb, 8); } @@ -5908,7 +5915,7 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){ s->pb_field_time= ( ROUNDED_DIV(s->time, s->t_frame) - ROUNDED_DIV(s->last_non_b_time - s->pp_time, s->t_frame))*2; } -//av_log(s->avctx, AV_LOG_DEBUG, "last nonb %Ld last_base %d time %Ld pp %d pb %d t %d ppf %d pbf %d\n", s->last_non_b_time, s->last_time_base, s->time, s->pp_time, s->pb_time, s->t_frame, s->pp_field_time, s->pb_field_time); +//av_log(s->avctx, AV_LOG_DEBUG, "last nonb %"PRId64" last_base %d time %"PRId64" pp %d pb %d t %d ppf %d pbf %d\n", s->last_non_b_time, s->last_time_base, s->time, s->pp_time, s->pb_time, s->t_frame, s->pp_field_time, s->pb_field_time); if(s->avctx->time_base.num) s->current_picture_ptr->pts= (s->time + s->avctx->time_base.num/2) / s->avctx->time_base.num; @@ -5925,7 +5932,7 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){ av_log(s->avctx, AV_LOG_ERROR, "vop not coded\n"); return FRAME_SKIPPED; } -//printf("time %d %d %d || %Ld %Ld %Ld\n", s->time_increment_bits, s->avctx->time_base.den, s->time_base, +//printf("time %d %d %d || %"PRId64" %"PRId64" %"PRId64"\n", s->time_increment_bits, s->avctx->time_base.den, s->time_base, //s->time, s->last_non_b_time, s->last_non_b_time - s->pp_time); if (s->shape != BIN_ONLY_SHAPE && ( s->pict_type == P_TYPE || (s->pict_type == S_TYPE && s->vol_sprite_usage==GMC_SPRITE))) { @@ -6059,7 +6066,7 @@ int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb) /* search next start code */ align_get_bits(gb); - if(s->avctx->codec_tag == ff_get_fourcc("WV1F") && show_bits(gb, 24) == 0x575630){ + if(s->codec_tag == ff_get_fourcc("WV1F") && show_bits(gb, 24) == 0x575630){ skip_bits(gb, 24); if(get_bits(gb, 8) == 0xF0) return decode_vop_header(s, gb); diff --git a/src/libffmpeg/libavcodec/h263data.h b/src/libffmpeg/libavcodec/h263data.h index 01bcaedb4..5eddc3b54 100644 --- a/src/libffmpeg/libavcodec/h263data.h +++ b/src/libffmpeg/libavcodec/h263data.h @@ -1,3 +1,26 @@ +/* + * copyright (c) 2000,2001 Fabrice Bellard + * H263+ support + * copyright (c) 2001 Juan J. Sierralta P. + * copyright (c) 2002-2004 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + /** * @file h263data.h * H.263 tables. @@ -65,7 +88,7 @@ static const int h263_mb_type_b_map[15]= { MB_TYPE_INTRA4x4 | MB_TYPE_CBP | MB_TYPE_QUANT, }; -const uint8_t cbpc_b_tab[4][2] = { +static const uint8_t cbpc_b_tab[4][2] = { {0, 1}, {2, 2}, {7, 3}, @@ -157,7 +180,7 @@ static RLTable rl_inter = { inter_level, }; -const uint16_t intra_vlc_aic[103][2] = { +static const uint16_t intra_vlc_aic[103][2] = { { 0x2, 2 }, { 0x6, 3 }, { 0xe, 4 }, { 0xc, 5 }, { 0xd, 5 }, { 0x10, 6 }, { 0x11, 6 }, { 0x12, 6 }, { 0x16, 7 }, { 0x1b, 8 }, { 0x20, 9 }, { 0x21, 9 }, @@ -186,7 +209,7 @@ const uint16_t intra_vlc_aic[103][2] = { { 0x59, 12 }, { 0x5a, 12 }, { 0x3, 7 }, }; -const int8_t intra_run_aic[102] = { +static const int8_t intra_run_aic[102] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -202,7 +225,7 @@ const int8_t intra_run_aic[102] = { 18, 19, 20, 21, 22, 23, }; -const int8_t intra_level_aic[102] = { +static const int8_t intra_level_aic[102] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, diff --git a/src/libffmpeg/libavcodec/h263dec.c b/src/libffmpeg/libavcodec/h263dec.c index b53192d74..66370c179 100644 --- a/src/libffmpeg/libavcodec/h263dec.c +++ b/src/libffmpeg/libavcodec/h263dec.c @@ -3,18 +3,20 @@ * Copyright (c) 2001 Fabrice Bellard. * Copyright (c) 2002-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -516,19 +518,19 @@ retry: avctx->has_b_frames= !s->low_delay; if(s->xvid_build==0 && s->divx_version==0 && s->lavc_build==0){ - if(s->avctx->stream_codec_tag == ff_get_fourcc("XVID") || - s->avctx->codec_tag == ff_get_fourcc("XVID") || s->avctx->codec_tag == ff_get_fourcc("XVIX") || - s->avctx->codec_tag == ff_get_fourcc("RMP4")) + if(s->stream_codec_tag == ff_get_fourcc("XVID") || + s->codec_tag == ff_get_fourcc("XVID") || s->codec_tag == ff_get_fourcc("XVIX") || + s->codec_tag == ff_get_fourcc("RMP4")) s->xvid_build= -1; #if 0 - if(s->avctx->codec_tag == ff_get_fourcc("DIVX") && s->vo_type==0 && s->vol_control_parameters==1 + if(s->codec_tag == ff_get_fourcc("DIVX") && s->vo_type==0 && s->vol_control_parameters==1 && s->padding_bug_score > 0 && s->low_delay) // XVID with modified fourcc s->xvid_build= -1; #endif } if(s->xvid_build==0 && s->divx_version==0 && s->lavc_build==0){ - if(s->avctx->codec_tag == ff_get_fourcc("DIVX") && s->vo_type==0 && s->vol_control_parameters==0) + if(s->codec_tag == ff_get_fourcc("DIVX") && s->vo_type==0 && s->vol_control_parameters==0) s->divx_version= 400; //divx 4 } @@ -538,10 +540,10 @@ retry: } if(s->workaround_bugs&FF_BUG_AUTODETECT){ - if(s->avctx->codec_tag == ff_get_fourcc("XVIX")) + if(s->codec_tag == ff_get_fourcc("XVIX")) s->workaround_bugs|= FF_BUG_XVID_ILACE; - if(s->avctx->codec_tag == ff_get_fourcc("UMP4")){ + if(s->codec_tag == ff_get_fourcc("UMP4")){ s->workaround_bugs|= FF_BUG_UMP4; } @@ -693,6 +695,17 @@ retry: s->next_p_frame_damaged=0; } + if((s->avctx->flags2 & CODEC_FLAG2_FAST) && s->pict_type==B_TYPE){ + s->me.qpel_put= s->dsp.put_2tap_qpel_pixels_tab; + s->me.qpel_avg= s->dsp.avg_2tap_qpel_pixels_tab; + }else if((!s->no_rounding) || s->pict_type==B_TYPE){ + s->me.qpel_put= s->dsp.put_qpel_pixels_tab; + s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab; + }else{ + s->me.qpel_put= s->dsp.put_no_rnd_qpel_pixels_tab; + s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab; + } + if(MPV_frame_start(s, avctx) < 0) return -1; @@ -785,7 +798,7 @@ assert(s->current_picture.pict_type == s->pict_type); avctx->frame_number = s->picture_number - 1; #ifdef PRINT_FRAME_TIME -av_log(avctx, AV_LOG_DEBUG, "%Ld\n", rdtsc()-time); +av_log(avctx, AV_LOG_DEBUG, "%"PRId64"\n", rdtsc()-time); #endif return get_consumed_bytes(s, buf_size); diff --git a/src/libffmpeg/libavcodec/h264.c b/src/libffmpeg/libavcodec/h264.c index 1a7fb76b4..ad23ae120 100644 --- a/src/libffmpeg/libavcodec/h264.c +++ b/src/libffmpeg/libavcodec/h264.c @@ -2,18 +2,20 @@ * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder * Copyright (c) 2003 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -371,6 +373,7 @@ typedef struct H264Context{ /* 0x100 -> non null luma_dc, 0x80/0x40 -> non null chroma_dc (cb/cr), 0x?0 -> chroma_cbp(0,1,2), 0x0? luma_cbp */ uint16_t *cbp_table; + int cbp; int top_cbp; int left_cbp; /* chroma_pred_mode for i4x4 or i16x16, else 0 */ @@ -409,6 +412,7 @@ static VLC run7_vlc; static void svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp); static void svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc); static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize); +static void filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize); static always_inline uint32_t pack16to32(int a, int b){ #ifdef WORDS_BIGENDIAN @@ -617,7 +621,7 @@ static void fill_caches(H264Context *h, int mb_type, int for_deblock){ if(USES_LIST(mb_type,list)){ uint32_t *src = (uint32_t*)s->current_picture.motion_val[list][h->mb2b_xy[mb_xy]]; uint32_t *dst = (uint32_t*)h->mv_cache[list][scan8[0]]; - uint8_t *ref = &s->current_picture.ref_index[list][h->mb2b8_xy[mb_xy]]; + int8_t *ref = &s->current_picture.ref_index[list][h->mb2b8_xy[mb_xy]]; for(i=0; i<4; i++, dst+=8, src+=h->b_stride){ dst[0] = src[0]; dst[1] = src[1]; @@ -1131,7 +1135,7 @@ static inline int fetch_diagonal_mv(H264Context *h, const int16_t **C, int i, in * make mbaff happy, so we can't move all this logic to fill_caches */ if(FRAME_MBAFF){ MpegEncContext *s = &h->s; - const int *mb_types = s->current_picture_ptr->mb_type; + const uint32_t *mb_types = s->current_picture_ptr->mb_type; const int16_t *mv; *(uint32_t*)h->mv_cache[list][scan8[0]-2] = 0; *C = h->mv_cache[list][scan8[0]-2]; @@ -1339,7 +1343,7 @@ static inline void direct_dist_scale_factor(H264Context * const h){ h->dist_scale_factor[i] = 256; }else{ int tb = clip(poc - poc0, -128, 127); - int tx = (16384 + (ABS(td) >> 1)) / td; + int tx = (16384 + (FFABS(td) >> 1)) / td; h->dist_scale_factor[i] = clip((tb*tx + 32) >> 6, -1024, 1023); } } @@ -1470,8 +1474,8 @@ static inline void pred_direct_motion(H264Context * const h, int *mb_type){ fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_type_col) - && ( (l1ref0[0] == 0 && ABS(l1mv0[0][0]) <= 1 && ABS(l1mv0[0][1]) <= 1) - || (l1ref0[0] < 0 && l1ref1[0] == 0 && ABS(l1mv1[0][0]) <= 1 && ABS(l1mv1[0][1]) <= 1 + && ( (l1ref0[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1) + || (l1ref0[0] < 0 && l1ref1[0] == 0 && FFABS(l1mv1[0][0]) <= 1 && FFABS(l1mv1[0][1]) <= 1 && (h->x264_build>33 || !h->x264_build)))){ if(ref[0] > 0) fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mv[0][0],mv[0][1]), 4); @@ -1506,7 +1510,7 @@ static inline void pred_direct_motion(H264Context * const h, int *mb_type){ const int16_t (*l1mv)[2]= l1ref0[x8 + y8*h->b8_stride] == 0 ? l1mv0 : l1mv1; if(IS_SUB_8X8(sub_mb_type)){ const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride]; - if(ABS(mv_col[0]) <= 1 && ABS(mv_col[1]) <= 1){ + if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ if(ref[0] == 0) fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); if(ref[1] == 0) @@ -1515,7 +1519,7 @@ static inline void pred_direct_motion(H264Context * const h, int *mb_type){ }else for(i4=0; i4<4; i4++){ const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride]; - if(ABS(mv_col[0]) <= 1 && ABS(mv_col[1]) <= 1){ + if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ if(ref[0] == 0) *(uint32_t*)h->mv_cache[0][scan8[i8*4+i4]] = 0; if(ref[1] == 0) @@ -1712,6 +1716,9 @@ static inline void write_back_motion(H264Context *h, int mb_type){ *(uint64_t*)s->current_picture.motion_val[list][b_xy + 2 + y*h->b_stride]= *(uint64_t*)h->mv_cache[list][scan8[0]+2 + 8*y]; } if( h->pps.cabac ) { + if(IS_SKIP(mb_type)) + fill_rectangle(h->mvd_table[list][b_xy], 4, 4, h->b_stride, 0, 4); + else for(y=0; y<4; y++){ *(uint64_t*)h->mvd_table[list][b_xy + 0 + y*h->b_stride]= *(uint64_t*)h->mvd_cache[list][scan8[0]+0 + 8*y]; *(uint64_t*)h->mvd_table[list][b_xy + 2 + y*h->b_stride]= *(uint64_t*)h->mvd_cache[list][scan8[0]+2 + 8*y]; @@ -1719,7 +1726,7 @@ static inline void write_back_motion(H264Context *h, int mb_type){ } { - uint8_t *ref_index = &s->current_picture.ref_index[list][b8_xy]; + int8_t *ref_index = &s->current_picture.ref_index[list][b8_xy]; ref_index[0+0*h->b8_stride]= h->ref_cache[list][scan8[0]]; ref_index[1+0*h->b8_stride]= h->ref_cache[list][scan8[4]]; ref_index[0+1*h->b8_stride]= h->ref_cache[list][scan8[8]]; @@ -2444,7 +2451,7 @@ static void pred16x16_128_dc_c(uint8_t *src, int stride){ static inline void pred16x16_plane_compat_c(uint8_t *src, int stride, const int svq3){ int i, j, k; int a; - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; const uint8_t * const src0 = src+7-stride; const uint8_t *src1 = src+8*stride-1; const uint8_t *src2 = src1-2*stride; // == src+6*stride-1; @@ -2587,7 +2594,7 @@ static void pred8x8_dc_c(uint8_t *src, int stride){ static void pred8x8_plane_c(uint8_t *src, int stride){ int j, k; int a; - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; const uint8_t * const src0 = src+3-stride; const uint8_t *src1 = src+4*stride-1; const uint8_t *src2 = src1-2*stride; // == src+2*stride-1; @@ -3142,7 +3149,7 @@ static void hl_motion(H264Context *h, uint8_t *dest_y, uint8_t *dest_cb, uint8_t prefetch_motion(h, 1); } -static void decode_init_vlc(H264Context *h){ +static void decode_init_vlc(){ static int done = 0; if (!done) { @@ -3399,7 +3406,7 @@ static int decode_init(AVCodecContext *avctx){ s->low_delay= 1; avctx->pix_fmt= PIX_FMT_YUV420P; - decode_init_vlc(h); + decode_init_vlc(); if(avctx->extradata_size > 0 && avctx->extradata && *(char *)avctx->extradata == 1){ @@ -3632,6 +3639,9 @@ static void hl_decode_mb(H264Context *h){ dest_cb = s->current_picture.data[1] + (mb_y * 8 * s->uvlinesize) + mb_x * 8; dest_cr = s->current_picture.data[2] + (mb_y * 8 * s->uvlinesize) + mb_x * 8; + s->dsp.prefetch(dest_y + (s->mb_x&3)*4*s->linesize + 64, s->linesize, 4); + s->dsp.prefetch(dest_cb + (s->mb_x&7)*s->uvlinesize + 64, dest_cr - dest_cb, 2); + if (MB_FIELD) { linesize = h->mb_linesize = s->linesize * 2; uvlinesize = h->mb_uvlinesize = s->uvlinesize * 2; @@ -3780,8 +3790,8 @@ static void hl_decode_mb(H264Context *h){ xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0); }else if(s->codec_id == CODEC_ID_H264){ hl_motion(h, dest_y, dest_cb, dest_cr, - s->dsp.put_h264_qpel_pixels_tab, s->dsp.put_h264_chroma_pixels_tab, - s->dsp.avg_h264_qpel_pixels_tab, s->dsp.avg_h264_chroma_pixels_tab, + s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab, + s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab, s->dsp.weight_h264_pixels_tab, s->dsp.biweight_h264_pixels_tab); } @@ -3879,7 +3889,7 @@ static void hl_decode_mb(H264Context *h){ tprintf("call filter_mb\n"); backup_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize); fill_caches(h, mb_type, 1); //FIXME don't fill stuff which isn't used by filter_mb - filter_mb(h, mb_x, mb_y, dest_y, dest_cb, dest_cr, linesize, uvlinesize); + filter_mb_fast(h, mb_x, mb_y, dest_y, dest_cb, dest_cr, linesize, uvlinesize); } } } @@ -4203,7 +4213,7 @@ static void implicit_weight_table(H264Context *h){ int td = clip(poc1 - poc0, -128, 127); if(td){ int tb = clip(cur_poc - poc0, -128, 127); - int tx = (16384 + (ABS(td) >> 1)) / td; + int tx = (16384 + (FFABS(td) >> 1)) / td; int dist_scale_factor = clip((tb*tx + 32) >> 6, -1024, 1023) >> 2; if(dist_scale_factor < -64 || dist_scale_factor > 128) h->implicit_weight[ref0][ref1] = 32; @@ -4883,6 +4893,14 @@ static int decode_slice_header(H264Context *h){ ); } + if((s->avctx->flags2 & CODEC_FLAG2_FAST) && !s->current_picture.reference){ + s->me.qpel_put= s->dsp.put_2tap_qpel_pixels_tab; + s->me.qpel_avg= s->dsp.avg_2tap_qpel_pixels_tab; + }else{ + s->me.qpel_put= s->dsp.put_h264_qpel_pixels_tab; + s->me.qpel_avg= s->dsp.avg_h264_qpel_pixels_tab; + } + return 0; } @@ -5100,10 +5118,7 @@ static void decode_mb_skip(H264Context *h){ fill_caches(h, mb_type, 0); //FIXME check what is needed and what not ... pred_direct_motion(h, &mb_type); - if(h->pps.cabac){ - fill_rectangle(h->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 4); - fill_rectangle(h->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 4); - } + mb_type|= MB_TYPE_SKIP; } else { @@ -5114,12 +5129,10 @@ static void decode_mb_skip(H264Context *h){ pred_pskip_motion(h, &mx, &my); fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, 0, 1); fill_rectangle( h->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mx,my), 4); - if(h->pps.cabac) - fill_rectangle(h->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 4); } write_back_motion(h, mb_type); - s->current_picture.mb_type[mb_xy]= mb_type|MB_TYPE_SKIP; + s->current_picture.mb_type[mb_xy]= mb_type; s->current_picture.qscale_table[mb_xy]= s->qscale; h->slice_table[ mb_xy ]= h->slice_num; h->prev_mb_skipped= 1; @@ -5184,7 +5197,7 @@ static int decode_mb_cavlc(H264Context *h){ assert(h->slice_type == I_TYPE); decode_intra_mb: if(mb_type > 25){ - av_log(h->s.avctx, AV_LOG_ERROR, "mb_type %d in %c slice to large at %d %d\n", mb_type, av_get_pict_type_char(h->slice_type), s->mb_x, s->mb_y); + av_log(h->s.avctx, AV_LOG_ERROR, "mb_type %d in %c slice too large at %d %d\n", mb_type, av_get_pict_type_char(h->slice_type), s->mb_x, s->mb_y); return -1; } partition_count=0; @@ -5478,6 +5491,7 @@ decode_intra_mb: else cbp= golomb_to_inter_cbp[cbp]; } + h->cbp = cbp; if(dct8x8_allowed && (cbp&15) && !IS_INTRA(mb_type)){ if(get_bits1(&s->gb)) @@ -5619,7 +5633,7 @@ static int decode_cabac_field_decoding_flag(H264Context *h) { ctx += 1; } - return get_cabac( &h->cabac, &h->cabac_state[70 + ctx] ); + return get_cabac_noinline( &h->cabac, &h->cabac_state[70 + ctx] ); } static int decode_cabac_intra_mb_type(H264Context *h, int ctx_base, int intra_slice) { @@ -5635,11 +5649,11 @@ static int decode_cabac_intra_mb_type(H264Context *h, int ctx_base, int intra_sl ctx++; if( h->slice_table[mbb_xy] == h->slice_num && !IS_INTRA4x4( s->current_picture.mb_type[mbb_xy] ) ) ctx++; - if( get_cabac( &h->cabac, &state[ctx] ) == 0 ) + if( get_cabac_noinline( &h->cabac, &state[ctx] ) == 0 ) return 0; /* I4x4 */ state += 2; }else{ - if( get_cabac( &h->cabac, &state[0] ) == 0 ) + if( get_cabac_noinline( &h->cabac, &state[0] ) == 0 ) return 0; /* I4x4 */ } @@ -5647,11 +5661,11 @@ static int decode_cabac_intra_mb_type(H264Context *h, int ctx_base, int intra_sl return 25; /* PCM */ mb_type = 1; /* I16x16 */ - mb_type += 12 * get_cabac( &h->cabac, &state[1] ); /* cbp_luma != 0 */ - if( get_cabac( &h->cabac, &state[2] ) ) /* cbp_chroma */ - mb_type += 4 + 4 * get_cabac( &h->cabac, &state[2+intra_slice] ); - mb_type += 2 * get_cabac( &h->cabac, &state[3+intra_slice] ); - mb_type += 1 * get_cabac( &h->cabac, &state[3+2*intra_slice] ); + mb_type += 12 * get_cabac_noinline( &h->cabac, &state[1] ); /* cbp_luma != 0 */ + if( get_cabac_noinline( &h->cabac, &state[2] ) ) /* cbp_chroma */ + mb_type += 4 + 4 * get_cabac_noinline( &h->cabac, &state[2+intra_slice] ); + mb_type += 2 * get_cabac_noinline( &h->cabac, &state[3+intra_slice] ); + mb_type += 1 * get_cabac_noinline( &h->cabac, &state[3+2*intra_slice] ); return mb_type; } @@ -5661,14 +5675,14 @@ static int decode_cabac_mb_type( H264Context *h ) { if( h->slice_type == I_TYPE ) { return decode_cabac_intra_mb_type(h, 3, 1); } else if( h->slice_type == P_TYPE ) { - if( get_cabac( &h->cabac, &h->cabac_state[14] ) == 0 ) { + if( get_cabac_noinline( &h->cabac, &h->cabac_state[14] ) == 0 ) { /* P-type */ - if( get_cabac( &h->cabac, &h->cabac_state[15] ) == 0 ) { + if( get_cabac_noinline( &h->cabac, &h->cabac_state[15] ) == 0 ) { /* P_L0_D16x16, P_8x8 */ - return 3 * get_cabac( &h->cabac, &h->cabac_state[16] ); + return 3 * get_cabac_noinline( &h->cabac, &h->cabac_state[16] ); } else { /* P_L0_D8x16, P_L0_D16x8 */ - return 2 - get_cabac( &h->cabac, &h->cabac_state[17] ); + return 2 - get_cabac_noinline( &h->cabac, &h->cabac_state[17] ); } } else { return decode_cabac_intra_mb_type(h, 17, 0) + 5; @@ -5684,17 +5698,17 @@ static int decode_cabac_mb_type( H264Context *h ) { if( h->slice_table[mbb_xy] == h->slice_num && !IS_DIRECT( s->current_picture.mb_type[mbb_xy] ) ) ctx++; - if( !get_cabac( &h->cabac, &h->cabac_state[27+ctx] ) ) + if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+ctx] ) ) return 0; /* B_Direct_16x16 */ - if( !get_cabac( &h->cabac, &h->cabac_state[27+3] ) ) { - return 1 + get_cabac( &h->cabac, &h->cabac_state[27+5] ); /* B_L[01]_16x16 */ + if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+3] ) ) { + return 1 + get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ); /* B_L[01]_16x16 */ } - bits = get_cabac( &h->cabac, &h->cabac_state[27+4] ) << 3; - bits|= get_cabac( &h->cabac, &h->cabac_state[27+5] ) << 2; - bits|= get_cabac( &h->cabac, &h->cabac_state[27+5] ) << 1; - bits|= get_cabac( &h->cabac, &h->cabac_state[27+5] ); + bits = get_cabac_noinline( &h->cabac, &h->cabac_state[27+4] ) << 3; + bits|= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ) << 2; + bits|= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ) << 1; + bits|= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ); if( bits < 8 ) return bits + 3; /* B_Bi_16x16 through B_L1_L0_16x8 */ else if( bits == 13 ) { @@ -5704,7 +5718,7 @@ static int decode_cabac_mb_type( H264Context *h ) { else if( bits == 15 ) return 22; /* B_8x8 */ - bits= ( bits<<1 ) | get_cabac( &h->cabac, &h->cabac_state[27+5] ); + bits= ( bits<<1 ) | get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ); return bits - 4; /* B_L0_Bi_* through B_Bi_Bi_* */ } else { /* TODO SI/SP frames? */ @@ -5745,7 +5759,7 @@ static int decode_cabac_mb_skip( H264Context *h, int mb_x, int mb_y ) { if( h->slice_type == B_TYPE ) ctx += 13; - return get_cabac( &h->cabac, &h->cabac_state[11+ctx] ); + return get_cabac_noinline( &h->cabac, &h->cabac_state[11+ctx] ); } static int decode_cabac_mb_intra4x4_pred_mode( H264Context *h, int pred_mode ) { @@ -5777,12 +5791,12 @@ static int decode_cabac_mb_chroma_pre_mode( H264Context *h) { if( h->slice_table[mbb_xy] == h->slice_num && h->chroma_pred_mode_table[mbb_xy] != 0 ) ctx++; - if( get_cabac( &h->cabac, &h->cabac_state[64+ctx] ) == 0 ) + if( get_cabac_noinline( &h->cabac, &h->cabac_state[64+ctx] ) == 0 ) return 0; - if( get_cabac( &h->cabac, &h->cabac_state[64+3] ) == 0 ) + if( get_cabac_noinline( &h->cabac, &h->cabac_state[64+3] ) == 0 ) return 1; - if( get_cabac( &h->cabac, &h->cabac_state[64+3] ) == 0 ) + if( get_cabac_noinline( &h->cabac, &h->cabac_state[64+3] ) == 0 ) return 2; else return 3; @@ -5859,13 +5873,13 @@ static int decode_cabac_mb_cbp_chroma( H264Context *h) { ctx = 0; if( cbp_a > 0 ) ctx++; if( cbp_b > 0 ) ctx += 2; - if( get_cabac( &h->cabac, &h->cabac_state[77 + ctx] ) == 0 ) + if( get_cabac_noinline( &h->cabac, &h->cabac_state[77 + ctx] ) == 0 ) return 0; ctx = 4; if( cbp_a == 2 ) ctx++; if( cbp_b == 2 ) ctx += 2; - return 1 + get_cabac( &h->cabac, &h->cabac_state[77 + ctx] ); + return 1 + get_cabac_noinline( &h->cabac, &h->cabac_state[77 + ctx] ); } static int decode_cabac_mb_dqp( H264Context *h) { MpegEncContext * const s = &h->s; @@ -5881,7 +5895,7 @@ static int decode_cabac_mb_dqp( H264Context *h) { if( h->last_qscale_diff != 0 ) ctx++; - while( get_cabac( &h->cabac, &h->cabac_state[60 + ctx] ) ) { + while( get_cabac_noinline( &h->cabac, &h->cabac_state[60 + ctx] ) ) { if( ctx < 2 ) ctx = 2; else @@ -5923,7 +5937,7 @@ static int decode_cabac_b_mb_sub_type( H264Context *h ) { } static inline int decode_cabac_mb_transform_size( H264Context *h ) { - return get_cabac( &h->cabac, &h->cabac_state[399 + h->neighbor_transform_size] ); + return get_cabac_noinline( &h->cabac, &h->cabac_state[399 + h->neighbor_transform_size] ); } static int decode_cabac_mb_ref( H264Context *h, int list, int n ) { @@ -5989,8 +6003,7 @@ static int decode_cabac_mb_mvd( H264Context *h, int list, int n, int l ) { mvd += 1 << k; } } - if( get_cabac_bypass( &h->cabac ) ) return -mvd; - else return mvd; + return get_cabac_bypass_sign( &h->cabac, -mvd ); } static int inline get_cabac_cbf_ctx( H264Context *h, int cat, int idx ) { @@ -6021,6 +6034,13 @@ static int inline get_cabac_cbf_ctx( H264Context *h, int cat, int idx ) { return ctx + 4 * cat; } +static const __attribute((used)) uint8_t last_coeff_flag_offset_8x8[63] = { + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, + 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8 +}; + static int decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff) { const int mb_xy = h->s.mb_x + h->s.mb_y*h->s.mb_stride; static const int significant_coeff_flag_offset[2][6] = { @@ -6034,7 +6054,7 @@ static int decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n static const int coeff_abs_level_m1_offset[6] = { 227+0, 227+10, 227+20, 227+30, 227+39, 426 }; - static const int significant_coeff_flag_offset_8x8[2][63] = { + static const uint8_t significant_coeff_flag_offset_8x8[2][63] = { { 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5, 4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7, 7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11, @@ -6044,16 +6064,10 @@ static int decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n 9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9, 9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14 } }; - static const int last_coeff_flag_offset_8x8[63] = { - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, - 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8 - }; int index[64]; - int i, last; + int last; int coeff_count = 0; int abslevel1 = 1; @@ -6063,6 +6077,20 @@ static int decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n uint8_t *last_coeff_ctx_base; uint8_t *abs_level_m1_ctx_base; +#ifndef ARCH_X86 +#define CABAC_ON_STACK +#endif +#ifdef CABAC_ON_STACK +#define CC &cc + CABACContext cc; + cc.range = h->cabac.range; + cc.low = h->cabac.low; + cc.bytestream= h->cabac.bytestream; +#else +#define CC &h->cabac +#endif + + /* cat: 0-> DC 16x16 n = 0 * 1-> AC 16x16 n = luma4x4idx * 2-> Luma4x4 n = luma4x4idx @@ -6073,12 +6101,16 @@ static int decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n /* read coded block flag */ if( cat != 5 ) { - if( get_cabac( &h->cabac, &h->cabac_state[85 + get_cabac_cbf_ctx( h, cat, n ) ] ) == 0 ) { + if( get_cabac( CC, &h->cabac_state[85 + get_cabac_cbf_ctx( h, cat, n ) ] ) == 0 ) { if( cat == 1 || cat == 2 ) h->non_zero_count_cache[scan8[n]] = 0; else if( cat == 4 ) h->non_zero_count_cache[scan8[16+n]] = 0; - +#ifdef CABAC_ON_STACK + h->cabac.range = cc.range ; + h->cabac.low = cc.low ; + h->cabac.bytestream= cc.bytestream; +#endif return 0; } } @@ -6094,22 +6126,28 @@ static int decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n #define DECODE_SIGNIFICANCE( coefs, sig_off, last_off ) \ for(last= 0; last < coefs; last++) { \ uint8_t *sig_ctx = significant_coeff_ctx_base + sig_off; \ - if( get_cabac( &h->cabac, sig_ctx )) { \ + if( get_cabac( CC, sig_ctx )) { \ uint8_t *last_ctx = last_coeff_ctx_base + last_off; \ index[coeff_count++] = last; \ - if( get_cabac( &h->cabac, last_ctx ) ) { \ + if( get_cabac( CC, last_ctx ) ) { \ last= max_coeff; \ break; \ } \ } \ + }\ + if( last == max_coeff -1 ) {\ + index[coeff_count++] = last;\ } - const int *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD]; + const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD]; +#if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) + coeff_count= decode_significance_8x8_x86(CC, significant_coeff_ctx_base, index, sig_off); + } else { + coeff_count= decode_significance_x86(CC, max_coeff, significant_coeff_ctx_base, index); +#else DECODE_SIGNIFICANCE( 63, sig_off[last], last_coeff_flag_offset_8x8[last] ); } else { DECODE_SIGNIFICANCE( max_coeff - 1, last, last ); - } - if( last == max_coeff -1 ) { - index[coeff_count++] = last; +#endif } assert(coeff_count > 0); @@ -6126,51 +6164,54 @@ static int decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, coeff_count, 1); } - for( i = coeff_count - 1; i >= 0; i-- ) { + for( coeff_count--; coeff_count >= 0; coeff_count-- ) { uint8_t *ctx = (abslevelgt1 != 0 ? 0 : FFMIN( 4, abslevel1 )) + abs_level_m1_ctx_base; - int j= scantable[index[i]]; + int j= scantable[index[coeff_count]]; - if( get_cabac( &h->cabac, ctx ) == 0 ) { + if( get_cabac( CC, ctx ) == 0 ) { if( !qmul ) { - if( get_cabac_bypass( &h->cabac ) ) block[j] = -1; - else block[j] = 1; + block[j] = get_cabac_bypass_sign( CC, -1); }else{ - if( get_cabac_bypass( &h->cabac ) ) block[j] = (-qmul[j] + 32) >> 6; - else block[j] = ( qmul[j] + 32) >> 6; + block[j] = (get_cabac_bypass_sign( CC, -qmul[j]) + 32) >> 6;; } abslevel1++; } else { int coeff_abs = 2; ctx = 5 + FFMIN( 4, abslevelgt1 ) + abs_level_m1_ctx_base; - while( coeff_abs < 15 && get_cabac( &h->cabac, ctx ) ) { + while( coeff_abs < 15 && get_cabac( CC, ctx ) ) { coeff_abs++; } if( coeff_abs >= 15 ) { int j = 0; - while( get_cabac_bypass( &h->cabac ) ) { - coeff_abs += 1 << j; + while( get_cabac_bypass( CC ) ) { j++; } + coeff_abs=1; while( j-- ) { - if( get_cabac_bypass( &h->cabac ) ) - coeff_abs += 1 << j ; + coeff_abs += coeff_abs + get_cabac_bypass( CC ); } + coeff_abs+= 14; } if( !qmul ) { - if( get_cabac_bypass( &h->cabac ) ) block[j] = -coeff_abs; + if( get_cabac_bypass( CC ) ) block[j] = -coeff_abs; else block[j] = coeff_abs; }else{ - if( get_cabac_bypass( &h->cabac ) ) block[j] = (-coeff_abs * qmul[j] + 32) >> 6; + if( get_cabac_bypass( CC ) ) block[j] = (-coeff_abs * qmul[j] + 32) >> 6; else block[j] = ( coeff_abs * qmul[j] + 32) >> 6; } abslevelgt1++; } } +#ifdef CABAC_ON_STACK + h->cabac.range = cc.range ; + h->cabac.low = cc.low ; + h->cabac.bytestream= cc.bytestream; +#endif return 0; } @@ -6580,7 +6621,7 @@ decode_intra_mb: cbp |= decode_cabac_mb_cbp_chroma( h ) << 4; } - h->cbp_table[mb_xy] = cbp; + h->cbp_table[mb_xy] = h->cbp = cbp; if( dct8x8_allowed && (cbp&15) && !IS_INTRA( mb_type ) ) { if( decode_cabac_mb_transform_size( h ) ) @@ -6640,8 +6681,10 @@ decode_intra_mb: for( i4x4 = 0; i4x4 < 4; i4x4++ ) { const int index = 4*i8x8 + i4x4; //av_log( s->avctx, AV_LOG_ERROR, "Luma4x4: %d\n", index ); +//START_TIMER if( decode_cabac_residual(h, h->mb + 16*index, 2, index, scan, h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale], 16) < 0 ) return -1; +//STOP_TIMER("decode_residual") } } else { uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ]; @@ -6694,16 +6737,16 @@ decode_intra_mb: } -static void filter_mb_edgev( H264Context *h, uint8_t *pix, int stride, int bS[4], int qp ) { +static void filter_mb_edgev( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int qp ) { int i, d; - const int index_a = clip( qp + h->slice_alpha_c0_offset, 0, 51 ); - const int alpha = alpha_table[index_a]; - const int beta = beta_table[clip( qp + h->slice_beta_offset, 0, 51 )]; + const int index_a = qp + h->slice_alpha_c0_offset; + const int alpha = (alpha_table+52)[index_a]; + const int beta = (beta_table+52)[qp + h->slice_beta_offset]; if( bS[0] < 4 ) { int8_t tc[4]; for(i=0; i<4; i++) - tc[i] = bS[i] ? tc0_table[index_a][bS[i] - 1] : -1; + tc[i] = bS[i] ? (tc0_table+52)[index_a][bS[i] - 1] : -1; h->s.dsp.h264_h_loop_filter_luma(pix, stride, alpha, beta, tc); } else { /* 16px edge length, because bS=4 is triggered by being at @@ -6717,12 +6760,12 @@ static void filter_mb_edgev( H264Context *h, uint8_t *pix, int stride, int bS[4] const int q1 = pix[1]; const int q2 = pix[2]; - if( ABS( p0 - q0 ) < alpha && - ABS( p1 - p0 ) < beta && - ABS( q1 - q0 ) < beta ) { + if( FFABS( p0 - q0 ) < alpha && + FFABS( p1 - p0 ) < beta && + FFABS( q1 - q0 ) < beta ) { - if(ABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ - if( ABS( p2 - p0 ) < beta) + if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ + if( FFABS( p2 - p0 ) < beta) { const int p3 = pix[-4]; /* p0', p1', p2' */ @@ -6733,7 +6776,7 @@ static void filter_mb_edgev( H264Context *h, uint8_t *pix, int stride, int bS[4] /* p0' */ pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2; } - if( ABS( q2 - q0 ) < beta) + if( FFABS( q2 - q0 ) < beta) { const int q3 = pix[3]; /* q0', q1', q2' */ @@ -6755,23 +6798,23 @@ static void filter_mb_edgev( H264Context *h, uint8_t *pix, int stride, int bS[4] } } } -static void filter_mb_edgecv( H264Context *h, uint8_t *pix, int stride, int bS[4], int qp ) { +static void filter_mb_edgecv( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int qp ) { int i; - const int index_a = clip( qp + h->slice_alpha_c0_offset, 0, 51 ); - const int alpha = alpha_table[index_a]; - const int beta = beta_table[clip( qp + h->slice_beta_offset, 0, 51 )]; + const int index_a = qp + h->slice_alpha_c0_offset; + const int alpha = (alpha_table+52)[index_a]; + const int beta = (beta_table+52)[qp + h->slice_beta_offset]; if( bS[0] < 4 ) { int8_t tc[4]; for(i=0; i<4; i++) - tc[i] = bS[i] ? tc0_table[index_a][bS[i] - 1] + 1 : 0; + tc[i] = bS[i] ? (tc0_table+52)[index_a][bS[i] - 1] + 1 : 0; h->s.dsp.h264_h_loop_filter_chroma(pix, stride, alpha, beta, tc); } else { h->s.dsp.h264_h_loop_filter_chroma_intra(pix, stride, alpha, beta); } } -static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int bS[8], int qp[2] ) { +static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int16_t bS[8], int qp[2] ) { int i; for( i = 0; i < 16; i++, pix += stride) { int index_a; @@ -6790,12 +6833,12 @@ static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int } qp_index = MB_FIELD ? (i >> 3) : (i & 1); - index_a = clip( qp[qp_index] + h->slice_alpha_c0_offset, 0, 51 ); - alpha = alpha_table[index_a]; - beta = beta_table[clip( qp[qp_index] + h->slice_beta_offset, 0, 51 )]; + index_a = qp[qp_index] + h->slice_alpha_c0_offset; + alpha = (alpha_table+52)[index_a]; + beta = (beta_table+52)[qp[qp_index] + h->slice_beta_offset]; if( bS[bS_index] < 4 ) { - const int tc0 = tc0_table[index_a][bS[bS_index] - 1]; + const int tc0 = (tc0_table+52)[index_a][bS[bS_index] - 1]; const int p0 = pix[-1]; const int p1 = pix[-2]; const int p2 = pix[-3]; @@ -6803,17 +6846,17 @@ static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int const int q1 = pix[1]; const int q2 = pix[2]; - if( ABS( p0 - q0 ) < alpha && - ABS( p1 - p0 ) < beta && - ABS( q1 - q0 ) < beta ) { + if( FFABS( p0 - q0 ) < alpha && + FFABS( p1 - p0 ) < beta && + FFABS( q1 - q0 ) < beta ) { int tc = tc0; int i_delta; - if( ABS( p2 - p0 ) < beta ) { + if( FFABS( p2 - p0 ) < beta ) { pix[-2] = p1 + clip( ( p2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( p1 << 1 ) ) >> 1, -tc0, tc0 ); tc++; } - if( ABS( q2 - q0 ) < beta ) { + if( FFABS( q2 - q0 ) < beta ) { pix[1] = q1 + clip( ( q2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( q1 << 1 ) ) >> 1, -tc0, tc0 ); tc++; } @@ -6832,12 +6875,12 @@ static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int const int q1 = pix[1]; const int q2 = pix[2]; - if( ABS( p0 - q0 ) < alpha && - ABS( p1 - p0 ) < beta && - ABS( q1 - q0 ) < beta ) { + if( FFABS( p0 - q0 ) < alpha && + FFABS( p1 - p0 ) < beta && + FFABS( q1 - q0 ) < beta ) { - if(ABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ - if( ABS( p2 - p0 ) < beta) + if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ + if( FFABS( p2 - p0 ) < beta) { const int p3 = pix[-4]; /* p0', p1', p2' */ @@ -6848,7 +6891,7 @@ static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int /* p0' */ pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2; } - if( ABS( q2 - q0 ) < beta) + if( FFABS( q2 - q0 ) < beta) { const int q3 = pix[3]; /* q0', q1', q2' */ @@ -6869,7 +6912,7 @@ static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int } } } -static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, int bS[8], int qp[2] ) { +static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, int16_t bS[8], int qp[2] ) { int i; for( i = 0; i < 8; i++, pix += stride) { int index_a; @@ -6884,20 +6927,20 @@ static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, in } qp_index = MB_FIELD ? (i >> 2) : (i & 1); - index_a = clip( qp[qp_index] + h->slice_alpha_c0_offset, 0, 51 ); - alpha = alpha_table[index_a]; - beta = beta_table[clip( qp[qp_index] + h->slice_beta_offset, 0, 51 )]; + index_a = qp[qp_index] + h->slice_alpha_c0_offset; + alpha = (alpha_table+52)[index_a]; + beta = (beta_table+52)[qp[qp_index] + h->slice_beta_offset]; if( bS[bS_index] < 4 ) { - const int tc = tc0_table[index_a][bS[bS_index] - 1] + 1; + const int tc = (tc0_table+52)[index_a][bS[bS_index] - 1] + 1; const int p0 = pix[-1]; const int p1 = pix[-2]; const int q0 = pix[0]; const int q1 = pix[1]; - if( ABS( p0 - q0 ) < alpha && - ABS( p1 - p0 ) < beta && - ABS( q1 - q0 ) < beta ) { + if( FFABS( p0 - q0 ) < alpha && + FFABS( p1 - p0 ) < beta && + FFABS( q1 - q0 ) < beta ) { const int i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); pix[-1] = clip_uint8( p0 + i_delta ); /* p0' */ @@ -6910,9 +6953,9 @@ static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, in const int q0 = pix[0]; const int q1 = pix[1]; - if( ABS( p0 - q0 ) < alpha && - ABS( p1 - p0 ) < beta && - ABS( q1 - q0 ) < beta ) { + if( FFABS( p0 - q0 ) < alpha && + FFABS( p1 - p0 ) < beta && + FFABS( q1 - q0 ) < beta ) { pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2; /* p0' */ pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2; /* q0' */ @@ -6922,17 +6965,17 @@ static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, in } } -static void filter_mb_edgeh( H264Context *h, uint8_t *pix, int stride, int bS[4], int qp ) { +static void filter_mb_edgeh( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int qp ) { int i, d; - const int index_a = clip( qp + h->slice_alpha_c0_offset, 0, 51 ); - const int alpha = alpha_table[index_a]; - const int beta = beta_table[clip( qp + h->slice_beta_offset, 0, 51 )]; + const int index_a = qp + h->slice_alpha_c0_offset; + const int alpha = (alpha_table+52)[index_a]; + const int beta = (beta_table+52)[qp + h->slice_beta_offset]; const int pix_next = stride; if( bS[0] < 4 ) { int8_t tc[4]; for(i=0; i<4; i++) - tc[i] = bS[i] ? tc0_table[index_a][bS[i] - 1] : -1; + tc[i] = bS[i] ? (tc0_table+52)[index_a][bS[i] - 1] : -1; h->s.dsp.h264_v_loop_filter_luma(pix, stride, alpha, beta, tc); } else { /* 16px edge length, see filter_mb_edgev */ @@ -6944,15 +6987,15 @@ static void filter_mb_edgeh( H264Context *h, uint8_t *pix, int stride, int bS[4] const int q1 = pix[1*pix_next]; const int q2 = pix[2*pix_next]; - if( ABS( p0 - q0 ) < alpha && - ABS( p1 - p0 ) < beta && - ABS( q1 - q0 ) < beta ) { + if( FFABS( p0 - q0 ) < alpha && + FFABS( p1 - p0 ) < beta && + FFABS( q1 - q0 ) < beta ) { const int p3 = pix[-4*pix_next]; const int q3 = pix[ 3*pix_next]; - if(ABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ - if( ABS( p2 - p0 ) < beta) { + if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){ + if( FFABS( p2 - p0 ) < beta) { /* p0', p1', p2' */ pix[-1*pix_next] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3; pix[-2*pix_next] = ( p2 + p1 + p0 + q0 + 2 ) >> 2; @@ -6961,7 +7004,7 @@ static void filter_mb_edgeh( H264Context *h, uint8_t *pix, int stride, int bS[4] /* p0' */ pix[-1*pix_next] = ( 2*p1 + p0 + q1 + 2 ) >> 2; } - if( ABS( q2 - q0 ) < beta) { + if( FFABS( q2 - q0 ) < beta) { /* q0', q1', q2' */ pix[0*pix_next] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3; pix[1*pix_next] = ( p0 + q0 + q1 + q2 + 2 ) >> 2; @@ -6982,22 +7025,130 @@ static void filter_mb_edgeh( H264Context *h, uint8_t *pix, int stride, int bS[4] } } -static void filter_mb_edgech( H264Context *h, uint8_t *pix, int stride, int bS[4], int qp ) { +static void filter_mb_edgech( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int qp ) { int i; - const int index_a = clip( qp + h->slice_alpha_c0_offset, 0, 51 ); - const int alpha = alpha_table[index_a]; - const int beta = beta_table[clip( qp + h->slice_beta_offset, 0, 51 )]; + const int index_a = qp + h->slice_alpha_c0_offset; + const int alpha = (alpha_table+52)[index_a]; + const int beta = (beta_table+52)[qp + h->slice_beta_offset]; if( bS[0] < 4 ) { int8_t tc[4]; for(i=0; i<4; i++) - tc[i] = bS[i] ? tc0_table[index_a][bS[i] - 1] + 1 : 0; + tc[i] = bS[i] ? (tc0_table+52)[index_a][bS[i] - 1] + 1 : 0; h->s.dsp.h264_v_loop_filter_chroma(pix, stride, alpha, beta, tc); } else { h->s.dsp.h264_v_loop_filter_chroma_intra(pix, stride, alpha, beta); } } +static void filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) { + MpegEncContext * const s = &h->s; + int mb_xy, mb_type; + int qp, qp0, qp1, qpc, qpc0, qpc1, qp_thresh; + + if(mb_x==0 || mb_y==0 || !s->dsp.h264_loop_filter_strength) { + filter_mb(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize); + return; + } + assert(!FRAME_MBAFF); + + mb_xy = mb_x + mb_y*s->mb_stride; + mb_type = s->current_picture.mb_type[mb_xy]; + qp = s->current_picture.qscale_table[mb_xy]; + qp0 = s->current_picture.qscale_table[mb_xy-1]; + qp1 = s->current_picture.qscale_table[h->top_mb_xy]; + qpc = get_chroma_qp( h->pps.chroma_qp_index_offset, qp ); + qpc0 = get_chroma_qp( h->pps.chroma_qp_index_offset, qp0 ); + qpc1 = get_chroma_qp( h->pps.chroma_qp_index_offset, qp1 ); + qp0 = (qp + qp0 + 1) >> 1; + qp1 = (qp + qp1 + 1) >> 1; + qpc0 = (qpc + qpc0 + 1) >> 1; + qpc1 = (qpc + qpc1 + 1) >> 1; + qp_thresh = 15 - h->slice_alpha_c0_offset; + if(qp <= qp_thresh && qp0 <= qp_thresh && qp1 <= qp_thresh && + qpc <= qp_thresh && qpc0 <= qp_thresh && qpc1 <= qp_thresh) + return; + + if( IS_INTRA(mb_type) ) { + int16_t bS4[4] = {4,4,4,4}; + int16_t bS3[4] = {3,3,3,3}; + if( IS_8x8DCT(mb_type) ) { + filter_mb_edgev( h, &img_y[4*0], linesize, bS4, qp0 ); + filter_mb_edgev( h, &img_y[4*2], linesize, bS3, qp ); + filter_mb_edgeh( h, &img_y[4*0*linesize], linesize, bS4, qp1 ); + filter_mb_edgeh( h, &img_y[4*2*linesize], linesize, bS3, qp ); + } else { + filter_mb_edgev( h, &img_y[4*0], linesize, bS4, qp0 ); + filter_mb_edgev( h, &img_y[4*1], linesize, bS3, qp ); + filter_mb_edgev( h, &img_y[4*2], linesize, bS3, qp ); + filter_mb_edgev( h, &img_y[4*3], linesize, bS3, qp ); + filter_mb_edgeh( h, &img_y[4*0*linesize], linesize, bS4, qp1 ); + filter_mb_edgeh( h, &img_y[4*1*linesize], linesize, bS3, qp ); + filter_mb_edgeh( h, &img_y[4*2*linesize], linesize, bS3, qp ); + filter_mb_edgeh( h, &img_y[4*3*linesize], linesize, bS3, qp ); + } + filter_mb_edgecv( h, &img_cb[2*0], uvlinesize, bS4, qpc0 ); + filter_mb_edgecv( h, &img_cb[2*2], uvlinesize, bS3, qpc ); + filter_mb_edgecv( h, &img_cr[2*0], uvlinesize, bS4, qpc0 ); + filter_mb_edgecv( h, &img_cr[2*2], uvlinesize, bS3, qpc ); + filter_mb_edgech( h, &img_cb[2*0*uvlinesize], uvlinesize, bS4, qpc1 ); + filter_mb_edgech( h, &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc ); + filter_mb_edgech( h, &img_cr[2*0*uvlinesize], uvlinesize, bS4, qpc1 ); + filter_mb_edgech( h, &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc ); + return; + } else { + DECLARE_ALIGNED_8(int16_t, bS[2][4][4]); + uint64_t (*bSv)[4] = (uint64_t(*)[4])bS; + int edges; + if( IS_8x8DCT(mb_type) && (h->cbp&7) == 7 ) { + edges = 4; + bSv[0][0] = bSv[0][2] = bSv[1][0] = bSv[1][2] = 0x0002000200020002ULL; + } else { + int mask_edge1 = (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : + (mb_type & MB_TYPE_16x8) ? 1 : 0; + int mask_edge0 = (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) + && (s->current_picture.mb_type[mb_xy-1] & (MB_TYPE_16x16 | MB_TYPE_8x16)) + ? 3 : 0; + int step = IS_8x8DCT(mb_type) ? 2 : 1; + edges = (mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4; + s->dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache, + (h->slice_type == B_TYPE), edges, step, mask_edge0, mask_edge1 ); + } + if( IS_INTRA(s->current_picture.mb_type[mb_xy-1]) ) + bSv[0][0] = 0x0004000400040004ULL; + if( IS_INTRA(s->current_picture.mb_type[h->top_mb_xy]) ) + bSv[1][0] = 0x0004000400040004ULL; + +#define FILTER(hv,dir,edge)\ + if(bSv[dir][edge]) {\ + filter_mb_edge##hv( h, &img_y[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qp : qp##dir );\ + if(!(edge&1)) {\ + filter_mb_edgec##hv( h, &img_cb[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir );\ + filter_mb_edgec##hv( h, &img_cr[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir );\ + }\ + } + if( edges == 1 ) { + FILTER(v,0,0); + FILTER(h,1,0); + } else if( IS_8x8DCT(mb_type) ) { + FILTER(v,0,0); + FILTER(v,0,2); + FILTER(h,1,0); + FILTER(h,1,2); + } else { + FILTER(v,0,0); + FILTER(v,0,1); + FILTER(v,0,2); + FILTER(v,0,3); + FILTER(h,1,0); + FILTER(h,1,1); + FILTER(h,1,2); + FILTER(h,1,3); + } +#undef FILTER + } +} + static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) { MpegEncContext * const s = &h->s; const int mb_xy= mb_x + mb_y*s->mb_stride; @@ -7035,7 +7186,7 @@ static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8 */ const int pair_xy = mb_x + (mb_y&~1)*s->mb_stride; const int left_mb_xy[2] = { pair_xy-1, pair_xy-1+s->mb_stride }; - int bS[8]; + int16_t bS[8]; int qp[2]; int chroma_qp[2]; int mb_qp, mbn0_qp, mbn1_qp; @@ -7114,7 +7265,7 @@ static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8 int mbn_xy = mb_xy - 2 * s->mb_stride; int qp, chroma_qp; int i, j; - int bS[4]; + int16_t bS[4]; for(j=0; j<2; j++, mbn_xy += s->mb_stride){ if( IS_INTRA(mb_type) || @@ -7150,7 +7301,7 @@ static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8 /* mbn_xy: neighbor macroblock */ const int mbn_xy = edge > 0 ? mb_xy : mbm_xy; const int mbn_type = s->current_picture.mb_type[mbn_xy]; - int bS[4]; + int16_t bS[4]; int qp; if( (edge&1) && IS_8x8DCT(mb_type) ) @@ -7189,8 +7340,8 @@ static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8 int v = 0; for( l = 0; !v && l < 1 + (h->slice_type == B_TYPE); l++ ) { v |= ref2frm[h->ref_cache[l][b_idx]+2] != ref2frm[h->ref_cache[l][bn_idx]+2] || - ABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 || - ABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit; + FFABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 || + FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit; } bS[0] = bS[1] = bS[2] = bS[3] = v; mv_done = 1; @@ -7213,8 +7364,8 @@ static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8 bS[i] = 0; for( l = 0; l < 1 + (h->slice_type == B_TYPE); l++ ) { if( ref2frm[h->ref_cache[l][b_idx]+2] != ref2frm[h->ref_cache[l][bn_idx]+2] || - ABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 || - ABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit ) { + FFABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 || + FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit ) { bS[i] = 1; break; } @@ -7267,7 +7418,7 @@ static int decode_slice(H264Context *h){ align_get_bits( &s->gb ); /* init cabac */ - ff_init_cabac_states( &h->cabac, ff_h264_lps_range, ff_h264_mps_state, ff_h264_lps_state, 64 ); + ff_init_cabac_states( &h->cabac); ff_init_cabac_decoder( &h->cabac, s->gb.buffer + get_bits_count(&s->gb)/8, ( s->gb.size_in_bits - get_bits_count(&s->gb) + 7)/8); @@ -7286,8 +7437,10 @@ static int decode_slice(H264Context *h){ } for(;;){ +//START_TIMER int ret = decode_mb_cabac(h); int eos; +//STOP_TIMER("decode_mb_cabac") if(ret>=0) hl_decode_mb(h); @@ -7301,7 +7454,7 @@ static int decode_slice(H264Context *h){ } eos = get_cabac_terminate( &h->cabac ); - if( ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 1) { + if( ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 2) { av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d, bytestream (%d)\n", s->mb_x, s->mb_y, h->cabac.bytestream_end - h->cabac.bytestream); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask); return -1; @@ -7694,7 +7847,7 @@ static inline int decode_seq_parameter_set(H264Context *h){ #ifndef ALLOW_INTERLACE if(sps->mb_aff) - av_log(h->s.avctx, AV_LOG_ERROR, "MBAFF support not included; enable it compilation time\n"); + av_log(h->s.avctx, AV_LOG_ERROR, "MBAFF support not included; enable it at compile-time.\n"); #endif if(!sps->direct_8x8_inference_flag && sps->mb_aff) av_log(h->s.avctx, AV_LOG_ERROR, "MBAFF + !direct_8x8_inference is not implemented\n"); @@ -8381,7 +8534,7 @@ int main(){ printf("\n");*/ for(j=0; j<16; j++){ - int diff= ABS(src[j] - ref[j]); + int diff= FFABS(src[j] - ref[j]); error+= diff*diff; max_error= FFMAX(max_error, diff); diff --git a/src/libffmpeg/libavcodec/h264data.h b/src/libffmpeg/libavcodec/h264data.h index 1dd9dafe5..2dea3580f 100644 --- a/src/libffmpeg/libavcodec/h264data.h +++ b/src/libffmpeg/libavcodec/h264data.h @@ -2,18 +2,20 @@ * H26L/H264/AVC/JVT/14496-10/... encoder/decoder * Copyright (c) 2003 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -607,23 +609,48 @@ static const int quant_coeff[52][16]={ /* Deblocking filter (p153) */ -static const int alpha_table[52] = { +static const int alpha_table[52*3] = { + 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 5, 6, 7, 8, 9, 10, 12, 13, 15, 17, 20, 22, 25, 28, 32, 36, 40, 45, 50, 56, 63, 71, 80, 90,101,113,127,144,162,182,203,226, - 255, 255 + 255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255, }; -static const int beta_table[52] = { +static const int beta_table[52*3] = { + 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, - 18, 18 + 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, }; -static const int tc0_table[52][3] = { +static const int tc0_table[52*3][3] = { + { 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 }, { 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 }, { 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 }, + { 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 }, { 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 }, { 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 }, { 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 }, @@ -632,7 +659,16 @@ static const int tc0_table[52][3] = { { 1, 1, 2 }, { 1, 2, 3 }, { 1, 2, 3 }, { 2, 2, 3 }, { 2, 2, 4 }, { 2, 3, 4 }, { 2, 3, 4 }, { 3, 3, 5 }, { 3, 4, 6 }, { 3, 4, 6 }, { 4, 5, 7 }, { 4, 5, 8 }, { 4, 6, 9 }, { 5, 7,10 }, { 6, 8,11 }, { 6, 8,13 }, { 7,10,14 }, { 8,11,16 }, - { 9,12,18 }, {10,13,20 }, {11,15,23 }, {13,17,25 } + { 9,12,18 }, {10,13,20 }, {11,15,23 }, {13,17,25 }, + {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, + {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, + {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, + {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, + {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, + {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, + {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, + {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, + {13,17,25 }, {13,17,25 }, {13,17,25 }, {13,17,25 }, }; /* Cabac pre state table */ diff --git a/src/libffmpeg/libavcodec/h264idct.c b/src/libffmpeg/libavcodec/h264idct.c index 3e44385d5..3506418ad 100755 --- a/src/libffmpeg/libavcodec/h264idct.c +++ b/src/libffmpeg/libavcodec/h264idct.c @@ -2,18 +2,20 @@ * H.264 IDCT * Copyright (c) 2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -28,7 +30,7 @@ static always_inline void idct_internal(uint8_t *dst, DCTELEM *block, int stride, int block_stride, int shift, int add){ int i; - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; block[0] += 1<<(shift-1); @@ -72,7 +74,7 @@ void ff_h264_lowres_idct_put_c(uint8_t *dst, int stride, DCTELEM *block){ void ff_h264_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride){ int i; DCTELEM (*src)[8] = (DCTELEM(*)[8])block; - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; block[0] += 32; @@ -143,7 +145,7 @@ void ff_h264_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride){ // assumes all AC coefs are 0 void ff_h264_idct_dc_add_c(uint8_t *dst, DCTELEM *block, int stride){ int i, j; - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; int dc = (block[0] + 32) >> 6; for( j = 0; j < 4; j++ ) { @@ -155,7 +157,7 @@ void ff_h264_idct_dc_add_c(uint8_t *dst, DCTELEM *block, int stride){ void ff_h264_idct8_dc_add_c(uint8_t *dst, DCTELEM *block, int stride){ int i, j; - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; int dc = (block[0] + 32) >> 6; for( j = 0; j < 8; j++ ) { diff --git a/src/libffmpeg/libavcodec/huffyuv.c b/src/libffmpeg/libavcodec/huffyuv.c index d65943fcc..0aefd6d72 100644 --- a/src/libffmpeg/libavcodec/huffyuv.c +++ b/src/libffmpeg/libavcodec/huffyuv.c @@ -3,18 +3,20 @@ * * Copyright (c) 2002-2003 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * see http://www.pcisys.net/~melanson/codecs/huffyuv.txt for a description of @@ -236,6 +238,7 @@ static int generate_bits_table(uint32_t *dst, uint8_t *len_table){ return 0; } +#ifdef CONFIG_ENCODERS static void generate_len_table(uint8_t *dst, uint64_t *stats, int size){ uint64_t counts[2*size]; int up[2*size]; @@ -291,6 +294,7 @@ static void generate_len_table(uint8_t *dst, uint64_t *stats, int size){ if(i==size) break; } } +#endif /* CONFIG_ENCODERS */ static int read_huffman_tables(HYuvContext *s, uint8_t *src, int length){ GetBitContext gb; @@ -375,6 +379,7 @@ static int common_init(AVCodecContext *avctx){ return 0; } +#ifdef CONFIG_DECODERS static int decode_init(AVCodecContext *avctx) { HYuvContext *s = avctx->priv_data; @@ -470,7 +475,9 @@ s->bgr32=1; return 0; } +#endif +#ifdef CONFIG_ENCODERS static int store_table(HYuvContext *s, uint8_t *len, uint8_t *buf){ int i; int index= 0; @@ -612,6 +619,7 @@ static int encode_init(AVCodecContext *avctx) return 0; } +#endif /* CONFIG_ENCODERS */ static void decode_422_bitstream(HYuvContext *s, int count){ int i; @@ -637,6 +645,7 @@ static void decode_gray_bitstream(HYuvContext *s, int count){ } } +#ifdef CONFIG_ENCODERS static int encode_422_bitstream(HYuvContext *s, int count){ int i; @@ -711,6 +720,7 @@ static int encode_gray_bitstream(HYuvContext *s, int count){ } return 0; } +#endif /* CONFIG_ENCODERS */ static void decode_bgr_bitstream(HYuvContext *s, int count){ int i; @@ -748,6 +758,7 @@ static void decode_bgr_bitstream(HYuvContext *s, int count){ } } +#ifdef CONFIG_DECODERS static void draw_slice(HYuvContext *s, int y){ int h, cy; int offset[4]; @@ -1014,6 +1025,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 return (get_bits_count(&s->gb)+31)/32*4 + table_size; } +#endif static int common_end(HYuvContext *s){ int i; @@ -1024,6 +1036,7 @@ static int common_end(HYuvContext *s){ return 0; } +#ifdef CONFIG_DECODERS static int decode_end(AVCodecContext *avctx) { HYuvContext *s = avctx->priv_data; @@ -1038,7 +1051,9 @@ static int decode_end(AVCodecContext *avctx) return 0; } +#endif +#ifdef CONFIG_ENCODERS static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ HYuvContext *s = avctx->priv_data; AVFrame *pict = data; @@ -1218,7 +1233,9 @@ static int encode_end(AVCodecContext *avctx) return 0; } +#endif /* CONFIG_ENCODERS */ +#ifdef CONFIG_DECODERS AVCodec huffyuv_decoder = { "huffyuv", CODEC_TYPE_VIDEO, @@ -1244,6 +1261,7 @@ AVCodec ffvhuff_decoder = { CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND, NULL }; +#endif #ifdef CONFIG_ENCODERS @@ -1255,6 +1273,7 @@ AVCodec huffyuv_encoder = { encode_init, encode_frame, encode_end, + .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV422P, -1}, }; AVCodec ffvhuff_encoder = { @@ -1265,6 +1284,7 @@ AVCodec ffvhuff_encoder = { encode_init, encode_frame, encode_end, + .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, -1}, }; #endif //CONFIG_ENCODERS diff --git a/src/libffmpeg/libavcodec/i386/Makefile.am b/src/libffmpeg/libavcodec/i386/Makefile.am index 0d649ae24..3eae6fe0f 100644 --- a/src/libffmpeg/libavcodec/i386/Makefile.am +++ b/src/libffmpeg/libavcodec/i386/Makefile.am @@ -22,6 +22,8 @@ libavcodec_mmx_src = \ cputest.c \ dsputil_mmx.c \ fdct_mmx.c \ + fft_3dn.c \ + fft_3dn2.c \ fft_sse.c \ idct_mmx.c \ idct_mmx_xvid.c \ diff --git a/src/libffmpeg/libavcodec/i386/cputest.c b/src/libffmpeg/libavcodec/i386/cputest.c index a66bdbe98..262786b71 100644 --- a/src/libffmpeg/libavcodec/i386/cputest.c +++ b/src/libffmpeg/libavcodec/i386/cputest.c @@ -1,9 +1,30 @@ -/* Cpu detection code, extracted from mmx.h ((c)1997-99 by H. Dietz - and R. Fisher). Converted to C and improved by Fabrice Bellard */ +/* + * CPU detection code, extracted from mmx.h + * (c)1997-99 by H. Dietz and R. Fisher + * Converted to C and improved by Fabrice Bellard. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ #include #include "../dsputil.h" +#undef printf + #ifdef ARCH_X86_64 # define REG_b "rbx" # define REG_S "rsi" diff --git a/src/libffmpeg/libavcodec/i386/dsputil_h264_template_mmx.c b/src/libffmpeg/libavcodec/i386/dsputil_h264_template_mmx.c index b49c880a7..e09a1007e 100644 --- a/src/libffmpeg/libavcodec/i386/dsputil_h264_template_mmx.c +++ b/src/libffmpeg/libavcodec/i386/dsputil_h264_template_mmx.c @@ -2,18 +2,20 @@ * Copyright (c) 2005 Zoltan Hidvegi , * Loren Merritt * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/i386/dsputil_mmx.c b/src/libffmpeg/libavcodec/i386/dsputil_mmx.c index a2cbab8ce..673e749c4 100644 --- a/src/libffmpeg/libavcodec/i386/dsputil_mmx.c +++ b/src/libffmpeg/libavcodec/i386/dsputil_mmx.c @@ -3,18 +3,20 @@ * Copyright (c) 2000, 2001 Fabrice Bellard. * Copyright (c) 2002-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * MMX optimization by Nick Kurshev @@ -29,7 +31,6 @@ //#undef NDEBUG //#include -extern const uint8_t ff_h263_loop_filter_strength[32]; extern void ff_idct_xvid_mmx(short *block); extern void ff_idct_xvid_mmx2(short *block); @@ -40,6 +41,9 @@ static const uint64_t mm_bone attribute_used __attribute__ ((aligned(8))) = 0x01 static const uint64_t mm_wone attribute_used __attribute__ ((aligned(8))) = 0x0001000100010001ULL; static const uint64_t mm_wtwo attribute_used __attribute__ ((aligned(8))) = 0x0002000200020002ULL; +static const uint64_t ff_pdw_80000000[2] attribute_used __attribute__ ((aligned(16))) = +{0x8000000080000000ULL, 0x8000000080000000ULL}; + static const uint64_t ff_pw_20 attribute_used __attribute__ ((aligned(8))) = 0x0014001400140014ULL; static const uint64_t ff_pw_3 attribute_used __attribute__ ((aligned(8))) = 0x0003000300030003ULL; static const uint64_t ff_pw_4 attribute_used __attribute__ ((aligned(8))) = 0x0004000400040004ULL; @@ -50,10 +54,15 @@ static const uint64_t ff_pw_32 attribute_used __attribute__ ((aligned(8))) = 0x0 static const uint64_t ff_pw_64 attribute_used __attribute__ ((aligned(8))) = 0x0040004000400040ULL; static const uint64_t ff_pw_15 attribute_used __attribute__ ((aligned(8))) = 0x000F000F000F000FULL; +static const uint64_t ff_pb_1 attribute_used __attribute__ ((aligned(8))) = 0x0101010101010101ULL; +static const uint64_t ff_pb_3 attribute_used __attribute__ ((aligned(8))) = 0x0303030303030303ULL; +static const uint64_t ff_pb_7 attribute_used __attribute__ ((aligned(8))) = 0x0707070707070707ULL; static const uint64_t ff_pb_3F attribute_used __attribute__ ((aligned(8))) = 0x3F3F3F3F3F3F3F3FULL; +static const uint64_t ff_pb_A1 attribute_used __attribute__ ((aligned(8))) = 0xA1A1A1A1A1A1A1A1ULL; +static const uint64_t ff_pb_5F attribute_used __attribute__ ((aligned(8))) = 0x5F5F5F5F5F5F5F5FULL; static const uint64_t ff_pb_FC attribute_used __attribute__ ((aligned(8))) = 0xFCFCFCFCFCFCFCFCULL; -#define JUMPALIGN() __asm __volatile (".balign 8"::) +#define JUMPALIGN() __asm __volatile (ASMALIGN(3)::) #define MOVQ_ZERO(regd) __asm __volatile ("pxor %%" #regd ", %%" #regd ::) #define MOVQ_WONE(regd) \ @@ -201,7 +210,7 @@ static void get_pixels_mmx(DCTELEM *block, const uint8_t *pixels, int line_size) asm volatile( "mov $-128, %%"REG_a" \n\t" "pxor %%mm7, %%mm7 \n\t" - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%0), %%mm0 \n\t" "movq (%0, %2), %%mm2 \n\t" @@ -229,7 +238,7 @@ static inline void diff_pixels_mmx(DCTELEM *block, const uint8_t *s1, const uint asm volatile( "pxor %%mm7, %%mm7 \n\t" "mov $-128, %%"REG_a" \n\t" - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%0), %%mm0 \n\t" "movq (%1), %%mm2 \n\t" @@ -372,7 +381,7 @@ static void put_pixels4_mmx(uint8_t *block, const uint8_t *pixels, int line_size { __asm __volatile( "lea (%3, %3), %%"REG_a" \n\t" - ".balign 8 \n\t" + ASMALIGN(3) "1: \n\t" "movd (%1), %%mm0 \n\t" "movd (%1, %3), %%mm1 \n\t" @@ -398,7 +407,7 @@ static void put_pixels8_mmx(uint8_t *block, const uint8_t *pixels, int line_size { __asm __volatile( "lea (%3, %3), %%"REG_a" \n\t" - ".balign 8 \n\t" + ASMALIGN(3) "1: \n\t" "movq (%1), %%mm0 \n\t" "movq (%1, %3), %%mm1 \n\t" @@ -424,7 +433,7 @@ static void put_pixels16_mmx(uint8_t *block, const uint8_t *pixels, int line_siz { __asm __volatile( "lea (%3, %3), %%"REG_a" \n\t" - ".balign 8 \n\t" + ASMALIGN(3) "1: \n\t" "movq (%1), %%mm0 \n\t" "movq 8(%1), %%mm4 \n\t" @@ -625,22 +634,10 @@ static void h263_v_loop_filter_mmx(uint8_t *src, int stride, int qscale){ static inline void transpose4x4(uint8_t *dst, uint8_t *src, int dst_stride, int src_stride){ asm volatile( //FIXME could save 1 instruction if done as 8x4 ... - "movd %0, %%mm0 \n\t" - "movd %1, %%mm1 \n\t" - "movd %2, %%mm2 \n\t" - - : - : "m" (*(uint32_t*)(src + 0*src_stride)), - "m" (*(uint32_t*)(src + 1*src_stride)), - "m" (*(uint32_t*)(src + 2*src_stride)) - ); - asm volatile( //FIXME could save 1 instruction if done as 8x4 ... - "movd %0, %%mm3 \n\t" - - : - : "m" (*(uint32_t*)(src + 3*src_stride)) - ); - asm volatile( //FIXME could save 1 instruction if done as 8x4 ... + "movd %4, %%mm0 \n\t" + "movd %5, %%mm1 \n\t" + "movd %6, %%mm2 \n\t" + "movd %7, %%mm3 \n\t" "punpcklbw %%mm1, %%mm0 \n\t" "punpcklbw %%mm3, %%mm2 \n\t" "movq %%mm0, %%mm1 \n\t" @@ -657,6 +654,10 @@ static inline void transpose4x4(uint8_t *dst, uint8_t *src, int dst_stride, int "=m" (*(uint32_t*)(dst + 1*dst_stride)), "=m" (*(uint32_t*)(dst + 2*dst_stride)), "=m" (*(uint32_t*)(dst + 3*dst_stride)) + : "m" (*(uint32_t*)(src + 0*src_stride)), + "m" (*(uint32_t*)(src + 1*src_stride)), + "m" (*(uint32_t*)(src + 2*src_stride)), + "m" (*(uint32_t*)(src + 3*src_stride)) ); } @@ -1185,8 +1186,8 @@ static int nsse16_mmx(void *p, uint8_t * pix1, uint8_t * pix2, int line_size, in else score1 = sse16_mmx(c, pix1, pix2, line_size, h); score2= hf_noise16_mmx(pix1, line_size, h) - hf_noise16_mmx(pix2, line_size, h); - if(c) return score1 + ABS(score2)*c->avctx->nsse_weight; - else return score1 + ABS(score2)*8; + if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight; + else return score1 + FFABS(score2)*8; } static int nsse8_mmx(void *p, uint8_t * pix1, uint8_t * pix2, int line_size, int h) { @@ -1194,8 +1195,8 @@ static int nsse8_mmx(void *p, uint8_t * pix1, uint8_t * pix2, int line_size, int int score1= sse8_mmx(c, pix1, pix2, line_size, h); int score2= hf_noise8_mmx(pix1, line_size, h) - hf_noise8_mmx(pix2, line_size, h); - if(c) return score1 + ABS(score2)*c->avctx->nsse_weight; - else return score1 + ABS(score2)*8; + if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight; + else return score1 + FFABS(score2)*8; } static int vsad_intra16_mmx(void *v, uint8_t * pix, uint8_t * dummy, int line_size, int h) { @@ -2403,6 +2404,53 @@ QPEL_OP(put_ , ff_pw_16, _ , PUT_OP, mmx2) QPEL_OP(avg_ , ff_pw_16, _ , AVG_MMX2_OP, mmx2) QPEL_OP(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, mmx2) +/***********************************/ +/* bilinear qpel: not compliant to any spec, only for -lavdopts fast */ + +#define QPEL_2TAP_XY(OPNAME, SIZE, MMX, XY, HPEL)\ +static void OPNAME ## 2tap_qpel ## SIZE ## _mc ## XY ## _ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + OPNAME ## pixels ## SIZE ## HPEL(dst, src, stride, SIZE);\ +} +#define QPEL_2TAP_L3(OPNAME, SIZE, MMX, XY, S0, S1, S2)\ +static void OPNAME ## 2tap_qpel ## SIZE ## _mc ## XY ## _ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + OPNAME ## 2tap_qpel ## SIZE ## _l3_ ## MMX(dst, src+S0, stride, SIZE, S1, S2);\ +} + +#define QPEL_2TAP(OPNAME, SIZE, MMX)\ +QPEL_2TAP_XY(OPNAME, SIZE, MMX, 20, _x2_ ## MMX)\ +QPEL_2TAP_XY(OPNAME, SIZE, MMX, 02, _y2_ ## MMX)\ +QPEL_2TAP_XY(OPNAME, SIZE, MMX, 22, _xy2_mmx)\ +static const qpel_mc_func OPNAME ## 2tap_qpel ## SIZE ## _mc00_ ## MMX =\ + OPNAME ## qpel ## SIZE ## _mc00_ ## MMX;\ +static const qpel_mc_func OPNAME ## 2tap_qpel ## SIZE ## _mc21_ ## MMX =\ + OPNAME ## 2tap_qpel ## SIZE ## _mc20_ ## MMX;\ +static const qpel_mc_func OPNAME ## 2tap_qpel ## SIZE ## _mc12_ ## MMX =\ + OPNAME ## 2tap_qpel ## SIZE ## _mc02_ ## MMX;\ +static void OPNAME ## 2tap_qpel ## SIZE ## _mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + OPNAME ## pixels ## SIZE ## _y2_ ## MMX(dst, src+1, stride, SIZE);\ +}\ +static void OPNAME ## 2tap_qpel ## SIZE ## _mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + OPNAME ## pixels ## SIZE ## _x2_ ## MMX(dst, src+stride, stride, SIZE);\ +}\ +QPEL_2TAP_L3(OPNAME, SIZE, MMX, 10, 0, 1, 0)\ +QPEL_2TAP_L3(OPNAME, SIZE, MMX, 30, 1, -1, 0)\ +QPEL_2TAP_L3(OPNAME, SIZE, MMX, 01, 0, stride, 0)\ +QPEL_2TAP_L3(OPNAME, SIZE, MMX, 03, stride, -stride, 0)\ +QPEL_2TAP_L3(OPNAME, SIZE, MMX, 11, 0, stride, 1)\ +QPEL_2TAP_L3(OPNAME, SIZE, MMX, 31, 1, stride, -1)\ +QPEL_2TAP_L3(OPNAME, SIZE, MMX, 13, stride, -stride, 1)\ +QPEL_2TAP_L3(OPNAME, SIZE, MMX, 33, stride+1, -stride, -1)\ + +QPEL_2TAP(put_, 16, mmx2) +QPEL_2TAP(avg_, 16, mmx2) +QPEL_2TAP(put_, 8, mmx2) +QPEL_2TAP(avg_, 8, mmx2) +QPEL_2TAP(put_, 16, 3dnow) +QPEL_2TAP(avg_, 16, 3dnow) +QPEL_2TAP(put_, 8, 3dnow) +QPEL_2TAP(avg_, 8, 3dnow) + + #if 0 static void just_return() { return; } #endif @@ -2523,9 +2571,10 @@ static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int o "m"(src[stride]), "m"(src[stride+1]), "m"(*r4), "m"(shift2) ); - + asm volatile( "movd %%mm0, %0 \n\t" + : "=m"(dst[x+y*stride]) : ); @@ -2535,10 +2584,11 @@ static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int o } } +#ifdef CONFIG_ENCODERS static int try_8x8basis_mmx(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){ long i=0; - assert(ABS(scale) < 256); + assert(FFABS(scale) < 256); scale<<= 16 + 1 - BASIS_SHIFT + RECON_SHIFT; asm volatile( @@ -2586,7 +2636,7 @@ static int try_8x8basis_mmx(int16_t rem[64], int16_t weight[64], int16_t basis[6 static void add_8x8basis_mmx(int16_t rem[64], int16_t basis[64], int scale){ long i=0; - if(ABS(scale) < 256){ + if(FFABS(scale) < 256){ scale<<= 16 + 1 - BASIS_SHIFT + RECON_SHIFT; asm volatile( "pcmpeqw %%mm6, %%mm6 \n\t" // -1w @@ -2620,9 +2670,10 @@ static void add_8x8basis_mmx(int16_t rem[64], int16_t basis[64], int scale){ } } } +#endif /* CONFIG_ENCODERS */ #define PREFETCH(name, op) \ -void name(void *mem, int stride, int h){\ +static void name(void *mem, int stride, int h){\ const uint8_t *p= mem;\ do{\ asm volatile(#op" %0" :: "m"(*p));\ @@ -2661,6 +2712,7 @@ void ff_vp3_dsp_init_mmx(void); /* XXX: those functions should be suppressed ASAP when all IDCTs are converted */ +#ifdef CONFIG_GPL static void ff_libmpeg2mmx_idct_put(uint8_t *dest, int line_size, DCTELEM *block) { ff_mmx_idct (block); @@ -2681,6 +2733,7 @@ static void ff_libmpeg2mmx2_idct_add(uint8_t *dest, int line_size, DCTELEM *bloc ff_mmxext_idct (block); add_pixels_clamped_mmx(block, dest, line_size); } +#endif static void ff_vp3_idct_put_sse2(uint8_t *dest, int line_size, DCTELEM *block) { ff_vp3_idct_sse2(block); @@ -2701,7 +2754,6 @@ static void ff_vp3_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block) ff_vp3_idct_mmx(block); add_pixels_clamped_mmx(block, dest, line_size); } -#ifdef CONFIG_GPL static void ff_idct_xvid_mmx_put(uint8_t *dest, int line_size, DCTELEM *block) { ff_idct_xvid_mmx (block); @@ -2722,7 +2774,274 @@ static void ff_idct_xvid_mmx2_add(uint8_t *dest, int line_size, DCTELEM *block) ff_idct_xvid_mmx2 (block); add_pixels_clamped_mmx(block, dest, line_size); } -#endif + +static void vorbis_inverse_coupling_3dnow(float *mag, float *ang, int blocksize) +{ + int i; + asm volatile("pxor %%mm7, %%mm7":); + for(i=0; i0) & (a ^ sign(m))) + "movq %%mm3, %1 \n\t" + "movq %%mm0, %0 \n\t" + :"+m"(mag[i]), "+m"(ang[i]) + ::"memory" + ); + } + asm volatile("femms"); +} +static void vorbis_inverse_coupling_sse(float *mag, float *ang, int blocksize) +{ + int i; + + asm volatile( + "movaps %0, %%xmm5 \n\t" + ::"m"(ff_pdw_80000000[0]) + ); + for(i=0; i0) & (a ^ sign(m))) + "movaps %%xmm3, %1 \n\t" + "movaps %%xmm0, %0 \n\t" + :"+m"(mag[i]), "+m"(ang[i]) + ::"memory" + ); + } +} + +static void vector_fmul_3dnow(float *dst, const float *src, int len){ + long i = (len-4)*4; + asm volatile( + "1: \n\t" + "movq (%1,%0), %%mm0 \n\t" + "movq 8(%1,%0), %%mm1 \n\t" + "pfmul (%2,%0), %%mm0 \n\t" + "pfmul 8(%2,%0), %%mm1 \n\t" + "movq %%mm0, (%1,%0) \n\t" + "movq %%mm1, 8(%1,%0) \n\t" + "sub $16, %0 \n\t" + "jge 1b \n\t" + "femms \n\t" + :"+r"(i) + :"r"(dst), "r"(src) + :"memory" + ); +} +static void vector_fmul_sse(float *dst, const float *src, int len){ + long i = (len-8)*4; + asm volatile( + "1: \n\t" + "movaps (%1,%0), %%xmm0 \n\t" + "movaps 16(%1,%0), %%xmm1 \n\t" + "mulps (%2,%0), %%xmm0 \n\t" + "mulps 16(%2,%0), %%xmm1 \n\t" + "movaps %%xmm0, (%1,%0) \n\t" + "movaps %%xmm1, 16(%1,%0) \n\t" + "sub $32, %0 \n\t" + "jge 1b \n\t" + :"+r"(i) + :"r"(dst), "r"(src) + :"memory" + ); +} + +static void vector_fmul_reverse_3dnow2(float *dst, const float *src0, const float *src1, int len){ + long i = len*4-16; + asm volatile( + "1: \n\t" + "pswapd 8(%1), %%mm0 \n\t" + "pswapd (%1), %%mm1 \n\t" + "pfmul (%3,%0), %%mm0 \n\t" + "pfmul 8(%3,%0), %%mm1 \n\t" + "movq %%mm0, (%2,%0) \n\t" + "movq %%mm1, 8(%2,%0) \n\t" + "add $16, %1 \n\t" + "sub $16, %0 \n\t" + "jge 1b \n\t" + :"+r"(i), "+r"(src1) + :"r"(dst), "r"(src0) + ); + asm volatile("femms"); +} +static void vector_fmul_reverse_sse(float *dst, const float *src0, const float *src1, int len){ + long i = len*4-32; + asm volatile( + "1: \n\t" + "movaps 16(%1), %%xmm0 \n\t" + "movaps (%1), %%xmm1 \n\t" + "shufps $0x1b, %%xmm0, %%xmm0 \n\t" + "shufps $0x1b, %%xmm1, %%xmm1 \n\t" + "mulps (%3,%0), %%xmm0 \n\t" + "mulps 16(%3,%0), %%xmm1 \n\t" + "movaps %%xmm0, (%2,%0) \n\t" + "movaps %%xmm1, 16(%2,%0) \n\t" + "add $32, %1 \n\t" + "sub $32, %0 \n\t" + "jge 1b \n\t" + :"+r"(i), "+r"(src1) + :"r"(dst), "r"(src0) + ); +} + +static void vector_fmul_add_add_3dnow(float *dst, const float *src0, const float *src1, + const float *src2, int src3, int len, int step){ + long i = (len-4)*4; + if(step == 2 && src3 == 0){ + dst += (len-4)*2; + asm volatile( + "1: \n\t" + "movq (%2,%0), %%mm0 \n\t" + "movq 8(%2,%0), %%mm1 \n\t" + "pfmul (%3,%0), %%mm0 \n\t" + "pfmul 8(%3,%0), %%mm1 \n\t" + "pfadd (%4,%0), %%mm0 \n\t" + "pfadd 8(%4,%0), %%mm1 \n\t" + "movd %%mm0, (%1) \n\t" + "movd %%mm1, 16(%1) \n\t" + "psrlq $32, %%mm0 \n\t" + "psrlq $32, %%mm1 \n\t" + "movd %%mm0, 8(%1) \n\t" + "movd %%mm1, 24(%1) \n\t" + "sub $32, %1 \n\t" + "sub $16, %0 \n\t" + "jge 1b \n\t" + :"+r"(i), "+r"(dst) + :"r"(src0), "r"(src1), "r"(src2) + :"memory" + ); + } + else if(step == 1 && src3 == 0){ + asm volatile( + "1: \n\t" + "movq (%2,%0), %%mm0 \n\t" + "movq 8(%2,%0), %%mm1 \n\t" + "pfmul (%3,%0), %%mm0 \n\t" + "pfmul 8(%3,%0), %%mm1 \n\t" + "pfadd (%4,%0), %%mm0 \n\t" + "pfadd 8(%4,%0), %%mm1 \n\t" + "movq %%mm0, (%1,%0) \n\t" + "movq %%mm1, 8(%1,%0) \n\t" + "sub $16, %0 \n\t" + "jge 1b \n\t" + :"+r"(i) + :"r"(dst), "r"(src0), "r"(src1), "r"(src2) + :"memory" + ); + } + else + ff_vector_fmul_add_add_c(dst, src0, src1, src2, src3, len, step); + asm volatile("femms"); +} +static void vector_fmul_add_add_sse(float *dst, const float *src0, const float *src1, + const float *src2, int src3, int len, int step){ + long i = (len-8)*4; + if(step == 2 && src3 == 0){ + dst += (len-8)*2; + asm volatile( + "1: \n\t" + "movaps (%2,%0), %%xmm0 \n\t" + "movaps 16(%2,%0), %%xmm1 \n\t" + "mulps (%3,%0), %%xmm0 \n\t" + "mulps 16(%3,%0), %%xmm1 \n\t" + "addps (%4,%0), %%xmm0 \n\t" + "addps 16(%4,%0), %%xmm1 \n\t" + "movss %%xmm0, (%1) \n\t" + "movss %%xmm1, 32(%1) \n\t" + "movhlps %%xmm0, %%xmm2 \n\t" + "movhlps %%xmm1, %%xmm3 \n\t" + "movss %%xmm2, 16(%1) \n\t" + "movss %%xmm3, 48(%1) \n\t" + "shufps $0xb1, %%xmm0, %%xmm0 \n\t" + "shufps $0xb1, %%xmm1, %%xmm1 \n\t" + "movss %%xmm0, 8(%1) \n\t" + "movss %%xmm1, 40(%1) \n\t" + "movhlps %%xmm0, %%xmm2 \n\t" + "movhlps %%xmm1, %%xmm3 \n\t" + "movss %%xmm2, 24(%1) \n\t" + "movss %%xmm3, 56(%1) \n\t" + "sub $64, %1 \n\t" + "sub $32, %0 \n\t" + "jge 1b \n\t" + :"+r"(i), "+r"(dst) + :"r"(src0), "r"(src1), "r"(src2) + :"memory" + ); + } + else if(step == 1 && src3 == 0){ + asm volatile( + "1: \n\t" + "movaps (%2,%0), %%xmm0 \n\t" + "movaps 16(%2,%0), %%xmm1 \n\t" + "mulps (%3,%0), %%xmm0 \n\t" + "mulps 16(%3,%0), %%xmm1 \n\t" + "addps (%4,%0), %%xmm0 \n\t" + "addps 16(%4,%0), %%xmm1 \n\t" + "movaps %%xmm0, (%1,%0) \n\t" + "movaps %%xmm1, 16(%1,%0) \n\t" + "sub $32, %0 \n\t" + "jge 1b \n\t" + :"+r"(i) + :"r"(dst), "r"(src0), "r"(src1), "r"(src2) + :"memory" + ); + } + else + ff_vector_fmul_add_add_c(dst, src0, src1, src2, src3, len, step); +} + +static void float_to_int16_3dnow(int16_t *dst, const float *src, int len){ + // not bit-exact: pf2id uses different rounding than C and SSE + int i; + for(i=0; iidct_add= ff_simple_idct_add_mmx; c->idct = ff_simple_idct_mmx; c->idct_permutation_type= FF_SIMPLE_IDCT_PERM; +#ifdef CONFIG_GPL }else if(idct_algo==FF_IDCT_LIBMPEG2MMX){ if(mm_flags & MM_MMXEXT){ c->idct_put= ff_libmpeg2mmx2_idct_put; @@ -2793,8 +3113,10 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) c->idct = ff_mmx_idct; } c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM; -#if 0 - }else if(idct_algo==FF_IDCT_VP3){ +#endif + }else if(idct_algo==FF_IDCT_VP3 && + avctx->codec->id!=CODEC_ID_THEORA && + !(avctx->flags & CODEC_FLAG_BITEXACT)){ if(mm_flags & MM_SSE2){ c->idct_put= ff_vp3_idct_put_sse2; c->idct_add= ff_vp3_idct_add_sse2; @@ -2807,10 +3129,8 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) c->idct = ff_vp3_idct_mmx; c->idct_permutation_type= FF_PARTTRANS_IDCT_PERM; } -#endif }else if(idct_algo==FF_IDCT_CAVS){ c->idct_permutation_type= FF_TRANSPOSE_IDCT_PERM; -#ifdef CONFIG_GPL }else if(idct_algo==FF_IDCT_XVIDMMX){ if(mm_flags & MM_MMXEXT){ c->idct_put= ff_idct_xvid_mmx2_put; @@ -2821,7 +3141,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) c->idct_add= ff_idct_xvid_mmx_add; c->idct = ff_idct_xvid_mmx; } -#endif } } @@ -3012,6 +3331,11 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) dspfunc(avg_h264_qpel, 0, 16); dspfunc(avg_h264_qpel, 1, 8); dspfunc(avg_h264_qpel, 2, 4); + + dspfunc(put_2tap_qpel, 0, 16); + dspfunc(put_2tap_qpel, 1, 8); + dspfunc(avg_2tap_qpel, 0, 16); + dspfunc(avg_2tap_qpel, 1, 8); #undef dspfunc c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_mmx2; @@ -3024,6 +3348,7 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) c->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_mmx2; c->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_mmx2; c->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_mmx2; + c->h264_loop_filter_strength= h264_loop_filter_strength_mmx2; c->weight_h264_pixels_tab[0]= ff_h264_weight_16x16_mmx2; c->weight_h264_pixels_tab[1]= ff_h264_weight_16x8_mmx2; @@ -3134,6 +3459,11 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) dspfunc(avg_h264_qpel, 1, 8); dspfunc(avg_h264_qpel, 2, 4); + dspfunc(put_2tap_qpel, 0, 16); + dspfunc(put_2tap_qpel, 1, 8); + dspfunc(avg_2tap_qpel, 0, 16); + dspfunc(avg_2tap_qpel, 1, 8); + c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_3dnow; c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_3dnow; } @@ -3150,6 +3480,24 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) c->inner_add_yblock = ff_snow_inner_add_yblock_mmx; } #endif + + if(mm_flags & MM_3DNOW){ + c->vorbis_inverse_coupling = vorbis_inverse_coupling_3dnow; + c->vector_fmul = vector_fmul_3dnow; + if(!(avctx->flags & CODEC_FLAG_BITEXACT)) + c->float_to_int16 = float_to_int16_3dnow; + } + if(mm_flags & MM_3DNOWEXT) + c->vector_fmul_reverse = vector_fmul_reverse_3dnow2; + if(mm_flags & MM_SSE){ + c->vorbis_inverse_coupling = vorbis_inverse_coupling_sse; + c->vector_fmul = vector_fmul_sse; + c->float_to_int16 = float_to_int16_sse; + c->vector_fmul_reverse = vector_fmul_reverse_sse; + c->vector_fmul_add_add = vector_fmul_add_add_sse; + } + if(mm_flags & MM_3DNOW) + c->vector_fmul_add_add = vector_fmul_add_add_3dnow; // faster than sse } #ifdef CONFIG_ENCODERS diff --git a/src/libffmpeg/libavcodec/i386/dsputil_mmx_avg.h b/src/libffmpeg/libavcodec/i386/dsputil_mmx_avg.h index 440c5bb9c..b365cea57 100644 --- a/src/libffmpeg/libavcodec/i386/dsputil_mmx_avg.h +++ b/src/libffmpeg/libavcodec/i386/dsputil_mmx_avg.h @@ -3,18 +3,20 @@ * Copyright (c) 2000, 2001 Fabrice Bellard. * Copyright (c) 2002-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * MMX optimization by Nick Kurshev @@ -754,7 +756,7 @@ static void DEF(avg_pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line "lea (%3, %3), %%"REG_a" \n\t" "movq (%1), %%mm0 \n\t" PAVGB" 1(%1), %%mm0 \n\t" - ".balign 8 \n\t" + ASMALIGN(3) "1: \n\t" "movq (%1, %%"REG_a"), %%mm2 \n\t" "movq (%1, %3), %%mm1 \n\t" @@ -818,3 +820,51 @@ static void DEF(avg_pixels16_xy2)(uint8_t *block, const uint8_t *pixels, int lin DEF(avg_pixels8_xy2)(block+8, pixels+8, line_size, h); } +#define QPEL_2TAP_L3(OPNAME) \ +static void DEF(OPNAME ## 2tap_qpel16_l3)(uint8_t *dst, uint8_t *src, int stride, int h, int off1, int off2){\ + asm volatile(\ + "1: \n\t"\ + "movq (%1,%2), %%mm0 \n\t"\ + "movq 8(%1,%2), %%mm1 \n\t"\ + PAVGB" (%1,%3), %%mm0 \n\t"\ + PAVGB" 8(%1,%3), %%mm1 \n\t"\ + PAVGB" (%1), %%mm0 \n\t"\ + PAVGB" 8(%1), %%mm1 \n\t"\ + STORE_OP( (%1,%4),%%mm0)\ + STORE_OP(8(%1,%4),%%mm1)\ + "movq %%mm0, (%1,%4) \n\t"\ + "movq %%mm1, 8(%1,%4) \n\t"\ + "add %5, %1 \n\t"\ + "decl %0 \n\t"\ + "jnz 1b \n\t"\ + :"+g"(h), "+r"(src)\ + :"r"((long)off1), "r"((long)off2),\ + "r"((long)(dst-src)), "r"((long)stride)\ + :"memory"\ + );\ +}\ +static void DEF(OPNAME ## 2tap_qpel8_l3)(uint8_t *dst, uint8_t *src, int stride, int h, int off1, int off2){\ + asm volatile(\ + "1: \n\t"\ + "movq (%1,%2), %%mm0 \n\t"\ + PAVGB" (%1,%3), %%mm0 \n\t"\ + PAVGB" (%1), %%mm0 \n\t"\ + STORE_OP((%1,%4),%%mm0)\ + "movq %%mm0, (%1,%4) \n\t"\ + "add %5, %1 \n\t"\ + "decl %0 \n\t"\ + "jnz 1b \n\t"\ + :"+g"(h), "+r"(src)\ + :"r"((long)off1), "r"((long)off2),\ + "r"((long)(dst-src)), "r"((long)stride)\ + :"memory"\ + );\ +} + +#define STORE_OP(a,b) PAVGB" "#a","#b" \n\t" +QPEL_2TAP_L3(avg_) +#undef STORE_OP +#define STORE_OP(a,b) +QPEL_2TAP_L3(put_) +#undef STORE_OP +#undef QPEL_2TAP_L3 diff --git a/src/libffmpeg/libavcodec/i386/dsputil_mmx_rnd.h b/src/libffmpeg/libavcodec/i386/dsputil_mmx_rnd.h index 3ecd776b8..f53b34662 100644 --- a/src/libffmpeg/libavcodec/i386/dsputil_mmx_rnd.h +++ b/src/libffmpeg/libavcodec/i386/dsputil_mmx_rnd.h @@ -3,18 +3,20 @@ * Copyright (c) 2000, 2001 Fabrice Bellard. * Copyright (c) 2003-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * MMX optimization by Nick Kurshev @@ -28,7 +30,7 @@ static void DEF(put, pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line MOVQ_BFE(mm6); __asm __volatile( "lea (%3, %3), %%"REG_a" \n\t" - ".balign 8 \n\t" + ASMALIGN(3) "1: \n\t" "movq (%1), %%mm0 \n\t" "movq 1(%1), %%mm1 \n\t" @@ -69,7 +71,7 @@ static void attribute_unused DEF(put, pixels8_l2)(uint8_t *dst, uint8_t *src1, u "movq %%mm4, (%3) \n\t" "add %5, %3 \n\t" "decl %0 \n\t" - ".balign 8 \n\t" + ASMALIGN(3) "1: \n\t" "movq (%1), %%mm0 \n\t" "movq (%2), %%mm1 \n\t" @@ -110,7 +112,7 @@ static void DEF(put, pixels16_x2)(uint8_t *block, const uint8_t *pixels, int lin MOVQ_BFE(mm6); __asm __volatile( "lea (%3, %3), %%"REG_a" \n\t" - ".balign 8 \n\t" + ASMALIGN(3) "1: \n\t" "movq (%1), %%mm0 \n\t" "movq 1(%1), %%mm1 \n\t" @@ -168,7 +170,7 @@ static void attribute_unused DEF(put, pixels16_l2)(uint8_t *dst, uint8_t *src1, "movq %%mm5, 8(%3) \n\t" "add %5, %3 \n\t" "decl %0 \n\t" - ".balign 8 \n\t" + ASMALIGN(3) "1: \n\t" "movq (%1), %%mm0 \n\t" "movq (%2), %%mm1 \n\t" @@ -206,7 +208,7 @@ static void DEF(put, pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line __asm __volatile( "lea (%3, %3), %%"REG_a" \n\t" "movq (%1), %%mm0 \n\t" - ".balign 8 \n\t" + ASMALIGN(3) "1: \n\t" "movq (%1, %3), %%mm1 \n\t" "movq (%1, %%"REG_a"),%%mm2 \n\t" @@ -246,7 +248,7 @@ static void DEF(put, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int lin "paddusw %%mm1, %%mm5 \n\t" "xor %%"REG_a", %%"REG_a" \n\t" "add %3, %1 \n\t" - ".balign 8 \n\t" + ASMALIGN(3) "1: \n\t" "movq (%1, %%"REG_a"), %%mm0 \n\t" "movq 1(%1, %%"REG_a"), %%mm2 \n\t" @@ -458,7 +460,7 @@ static void DEF(avg, pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line __asm __volatile( "lea (%3, %3), %%"REG_a" \n\t" "movq (%1), %%mm0 \n\t" - ".balign 8 \n\t" + ASMALIGN(3) "1: \n\t" "movq (%1, %3), %%mm1 \n\t" "movq (%1, %%"REG_a"), %%mm2 \n\t" @@ -509,7 +511,7 @@ static void DEF(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int lin "paddusw %%mm1, %%mm5 \n\t" "xor %%"REG_a", %%"REG_a" \n\t" "add %3, %1 \n\t" - ".balign 8 \n\t" + ASMALIGN(3) "1: \n\t" "movq (%1, %%"REG_a"), %%mm0 \n\t" "movq 1(%1, %%"REG_a"), %%mm2 \n\t" diff --git a/src/libffmpeg/libavcodec/i386/fdct_mmx.c b/src/libffmpeg/libavcodec/i386/fdct_mmx.c index f6150c83c..2ffbfecf6 100644 --- a/src/libffmpeg/libavcodec/i386/fdct_mmx.c +++ b/src/libffmpeg/libavcodec/i386/fdct_mmx.c @@ -12,6 +12,22 @@ * Also of inspiration: * a page about fdct at http://www.geocities.com/ssavekar/dct.htm * Skal's fdct at http://skal.planet-d.net/coding/dct.html + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "common.h" #include "../dsputil.h" @@ -51,7 +67,7 @@ static const int64_t fdct_one_corr ATTR_ALIGN(8) = 0x0001000100010001LL; static const int32_t fdct_r_row[2] ATTR_ALIGN(8) = {RND_FRW_ROW, RND_FRW_ROW }; -struct +static struct { const int32_t fdct_r_row_sse2[4] ATTR_ALIGN(16); } fdct_r_row_sse2 ATTR_ALIGN(16)= @@ -134,7 +150,7 @@ static const int16_t tab_frw_01234567[] ATTR_ALIGN(8) = { // forward_dct coeff 29692, -12299, 26722, -31521, }; -struct +static struct { const int16_t tab_frw_01234567_sse2[256] ATTR_ALIGN(16); } tab_frw_01234567_sse2 ATTR_ALIGN(16) = @@ -351,60 +367,60 @@ static always_inline void fdct_col(const int16_t *in, int16_t *out, int offset) static always_inline void fdct_row_sse2(const int16_t *in, int16_t *out) { asm volatile( - ".macro FDCT_ROW_SSE2_H1 i t \n\t" - "movq \\i(%0), %%xmm2 \n\t" - "movq \\i+8(%0), %%xmm0 \n\t" - "movdqa \\t+32(%1), %%xmm3 \n\t" - "movdqa \\t+48(%1), %%xmm7 \n\t" - "movdqa \\t(%1), %%xmm4 \n\t" - "movdqa \\t+16(%1), %%xmm5 \n\t" - ".endm \n\t" - ".macro FDCT_ROW_SSE2_H2 i t \n\t" - "movq \\i(%0), %%xmm2 \n\t" - "movq \\i+8(%0), %%xmm0 \n\t" - "movdqa \\t+32(%1), %%xmm3 \n\t" - "movdqa \\t+48(%1), %%xmm7 \n\t" - ".endm \n\t" - ".macro FDCT_ROW_SSE2 i \n\t" - "movq %%xmm2, %%xmm1 \n\t" - "pshuflw $27, %%xmm0, %%xmm0 \n\t" - "paddsw %%xmm0, %%xmm1 \n\t" - "psubsw %%xmm0, %%xmm2 \n\t" - "punpckldq %%xmm2, %%xmm1 \n\t" - "pshufd $78, %%xmm1, %%xmm2 \n\t" - "pmaddwd %%xmm2, %%xmm3 \n\t" - "pmaddwd %%xmm1, %%xmm7 \n\t" - "pmaddwd %%xmm5, %%xmm2 \n\t" - "pmaddwd %%xmm4, %%xmm1 \n\t" - "paddd %%xmm7, %%xmm3 \n\t" - "paddd %%xmm2, %%xmm1 \n\t" - "paddd %%xmm6, %%xmm3 \n\t" - "paddd %%xmm6, %%xmm1 \n\t" - "psrad %3, %%xmm3 \n\t" - "psrad %3, %%xmm1 \n\t" - "packssdw %%xmm3, %%xmm1 \n\t" - "movdqa %%xmm1, \\i(%4) \n\t" - ".endm \n\t" +#define FDCT_ROW_SSE2_H1(i,t) \ + "movq " #i "(%0), %%xmm2 \n\t" \ + "movq " #i "+8(%0), %%xmm0 \n\t" \ + "movdqa " #t "+32(%1), %%xmm3 \n\t" \ + "movdqa " #t "+48(%1), %%xmm7 \n\t" \ + "movdqa " #t "(%1), %%xmm4 \n\t" \ + "movdqa " #t "+16(%1), %%xmm5 \n\t" + +#define FDCT_ROW_SSE2_H2(i,t) \ + "movq " #i "(%0), %%xmm2 \n\t" \ + "movq " #i "+8(%0), %%xmm0 \n\t" \ + "movdqa " #t "+32(%1), %%xmm3 \n\t" \ + "movdqa " #t "+48(%1), %%xmm7 \n\t" + +#define FDCT_ROW_SSE2(i) \ + "movq %%xmm2, %%xmm1 \n\t" \ + "pshuflw $27, %%xmm0, %%xmm0 \n\t" \ + "paddsw %%xmm0, %%xmm1 \n\t" \ + "psubsw %%xmm0, %%xmm2 \n\t" \ + "punpckldq %%xmm2, %%xmm1 \n\t" \ + "pshufd $78, %%xmm1, %%xmm2 \n\t" \ + "pmaddwd %%xmm2, %%xmm3 \n\t" \ + "pmaddwd %%xmm1, %%xmm7 \n\t" \ + "pmaddwd %%xmm5, %%xmm2 \n\t" \ + "pmaddwd %%xmm4, %%xmm1 \n\t" \ + "paddd %%xmm7, %%xmm3 \n\t" \ + "paddd %%xmm2, %%xmm1 \n\t" \ + "paddd %%xmm6, %%xmm3 \n\t" \ + "paddd %%xmm6, %%xmm1 \n\t" \ + "psrad %3, %%xmm3 \n\t" \ + "psrad %3, %%xmm1 \n\t" \ + "packssdw %%xmm3, %%xmm1 \n\t" \ + "movdqa %%xmm1, " #i "(%4) \n\t" + "movdqa (%2), %%xmm6 \n\t" - "FDCT_ROW_SSE2_H1 0 0 \n\t" - "FDCT_ROW_SSE2 0 \n\t" - "FDCT_ROW_SSE2_H2 64 0 \n\t" - "FDCT_ROW_SSE2 64 \n\t" - - "FDCT_ROW_SSE2_H1 16 64 \n\t" - "FDCT_ROW_SSE2 16 \n\t" - "FDCT_ROW_SSE2_H2 112 64 \n\t" - "FDCT_ROW_SSE2 112 \n\t" - - "FDCT_ROW_SSE2_H1 32 128 \n\t" - "FDCT_ROW_SSE2 32 \n\t" - "FDCT_ROW_SSE2_H2 96 128 \n\t" - "FDCT_ROW_SSE2 96 \n\t" - - "FDCT_ROW_SSE2_H1 48 192 \n\t" - "FDCT_ROW_SSE2 48 \n\t" - "FDCT_ROW_SSE2_H2 80 192 \n\t" - "FDCT_ROW_SSE2 80 \n\t" + FDCT_ROW_SSE2_H1(0,0) + FDCT_ROW_SSE2(0) + FDCT_ROW_SSE2_H2(64,0) + FDCT_ROW_SSE2(64) + + FDCT_ROW_SSE2_H1(16,64) + FDCT_ROW_SSE2(16) + FDCT_ROW_SSE2_H2(112,64) + FDCT_ROW_SSE2(112) + + FDCT_ROW_SSE2_H1(32,128) + FDCT_ROW_SSE2(32) + FDCT_ROW_SSE2_H2(96,128) + FDCT_ROW_SSE2(96) + + FDCT_ROW_SSE2_H1(48,192) + FDCT_ROW_SSE2(48) + FDCT_ROW_SSE2_H2(80,192) + FDCT_ROW_SSE2(80) : : "r" (in), "r" (tab_frw_01234567_sse2.tab_frw_01234567_sse2), "r" (fdct_r_row_sse2.fdct_r_row_sse2), "i" (SHIFT_FRW_ROW), "r" (out) ); @@ -504,56 +520,44 @@ static always_inline void fdct_row_mmx(const int16_t *in, int16_t *out, const in void ff_fdct_mmx(int16_t *block) { int64_t align_tmp[16] ATTR_ALIGN(8); - int16_t * const block_tmp= (int16_t*)align_tmp; - int16_t *block1, *out; - const int16_t *table; + int16_t * block1= (int16_t*)align_tmp; + const int16_t *table= tab_frw_01234567; int i; - block1 = block_tmp; fdct_col(block, block1, 0); fdct_col(block, block1, 4); - block1 = block_tmp; - table = tab_frw_01234567; - out = block; for(i=8;i>0;i--) { - fdct_row_mmx(block1, out, table); + fdct_row_mmx(block1, block, table); block1 += 8; table += 32; - out += 8; + block += 8; } } void ff_fdct_mmx2(int16_t *block) { int64_t align_tmp[16] ATTR_ALIGN(8); - int16_t * const block_tmp= (int16_t*)align_tmp; - int16_t *block1, *out; - const int16_t *table; + int16_t *block1= (int16_t*)align_tmp; + const int16_t *table= tab_frw_01234567; int i; - block1 = block_tmp; fdct_col(block, block1, 0); fdct_col(block, block1, 4); - block1 = block_tmp; - table = tab_frw_01234567; - out = block; for(i=8;i>0;i--) { - fdct_row_mmx2(block1, out, table); + fdct_row_mmx2(block1, block, table); block1 += 8; table += 32; - out += 8; + block += 8; } } void ff_fdct_sse2(int16_t *block) { - int64_t align_tmp[16] ATTR_ALIGN(8); - int16_t * const block_tmp= (int16_t*)align_tmp; - int16_t *block1; + int64_t align_tmp[16] ATTR_ALIGN(16); + int16_t * const block1= (int16_t*)align_tmp; - block1 = block_tmp; fdct_col(block, block1, 0); fdct_col(block, block1, 4); diff --git a/src/libffmpeg/libavcodec/i386/fft_3dn.c b/src/libffmpeg/libavcodec/i386/fft_3dn.c new file mode 100644 index 000000000..8087f1932 --- /dev/null +++ b/src/libffmpeg/libavcodec/i386/fft_3dn.c @@ -0,0 +1,125 @@ +/* + * FFT/MDCT transform with 3DNow! optimizations + * Copyright (c) 2006 Zuxy MENG Jie, Loren Merritt + * Based on fft_sse.c copyright (c) 2002 Fabrice Bellard. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include "../dsputil.h" + +static const int p1m1[2] __attribute__((aligned(8))) = + { 0, 1 << 31 }; + +static const int m1p1[2] __attribute__((aligned(8))) = + { 1 << 31, 0 }; + +void ff_fft_calc_3dn(FFTContext *s, FFTComplex *z) +{ + int ln = s->nbits; + long i, j; + long nblocks, nloops; + FFTComplex *p, *cptr; + + asm volatile( + /* FEMMS is not a must here but recommended by AMD */ + "femms \n\t" + "movq %0, %%mm7 \n\t" + ::"m"(*(s->inverse ? m1p1 : p1m1)) + ); + + i = 8 << ln; + asm volatile( + "1: \n\t" + "sub $32, %0 \n\t" + "movq (%0,%1), %%mm0 \n\t" + "movq 16(%0,%1), %%mm1 \n\t" + "movq 8(%0,%1), %%mm2 \n\t" + "movq 24(%0,%1), %%mm3 \n\t" + "movq %%mm0, %%mm4 \n\t" + "movq %%mm1, %%mm5 \n\t" + "pfadd %%mm2, %%mm0 \n\t" + "pfadd %%mm3, %%mm1 \n\t" + "pfsub %%mm2, %%mm4 \n\t" + "pfsub %%mm3, %%mm5 \n\t" + "movq %%mm0, %%mm2 \n\t" + "punpckldq %%mm5, %%mm6 \n\t" + "punpckhdq %%mm6, %%mm5 \n\t" + "movq %%mm4, %%mm3 \n\t" + "pxor %%mm7, %%mm5 \n\t" + "pfadd %%mm1, %%mm0 \n\t" + "pfadd %%mm5, %%mm4 \n\t" + "pfsub %%mm1, %%mm2 \n\t" + "pfsub %%mm5, %%mm3 \n\t" + "movq %%mm0, (%0,%1) \n\t" + "movq %%mm4, 8(%0,%1) \n\t" + "movq %%mm2, 16(%0,%1) \n\t" + "movq %%mm3, 24(%0,%1) \n\t" + "jg 1b \n\t" + :"+r"(i) + :"r"(z) + ); + /* pass 2 .. ln-1 */ + + nblocks = 1 << (ln-3); + nloops = 1 << 2; + cptr = s->exptab1; + do { + p = z; + j = nblocks; + do { + i = nloops*8; + asm volatile( + "1: \n\t" + "sub $16, %0 \n\t" + "movq (%1,%0), %%mm0 \n\t" + "movq 8(%1,%0), %%mm1 \n\t" + "movq (%2,%0), %%mm2 \n\t" + "movq 8(%2,%0), %%mm3 \n\t" + "movq %%mm2, %%mm4 \n\t" + "movq %%mm3, %%mm5 \n\t" + "punpckldq %%mm2, %%mm2 \n\t" + "punpckldq %%mm3, %%mm3 \n\t" + "punpckhdq %%mm4, %%mm4 \n\t" + "punpckhdq %%mm5, %%mm5 \n\t" + "pfmul (%3,%0,2), %%mm2 \n\t" // cre*re cim*re + "pfmul 8(%3,%0,2), %%mm3 \n\t" + "pfmul 16(%3,%0,2), %%mm4 \n\t" // -cim*im cre*im + "pfmul 24(%3,%0,2), %%mm5 \n\t" + "pfadd %%mm2, %%mm4 \n\t" // cre*re-cim*im cim*re+cre*im + "pfadd %%mm3, %%mm5 \n\t" + "movq %%mm0, %%mm2 \n\t" + "movq %%mm1, %%mm3 \n\t" + "pfadd %%mm4, %%mm0 \n\t" + "pfadd %%mm5, %%mm1 \n\t" + "pfsub %%mm4, %%mm2 \n\t" + "pfsub %%mm5, %%mm3 \n\t" + "movq %%mm0, (%1,%0) \n\t" + "movq %%mm1, 8(%1,%0) \n\t" + "movq %%mm2, (%2,%0) \n\t" + "movq %%mm3, 8(%2,%0) \n\t" + "jg 1b \n\t" + :"+r"(i) + :"r"(p), "r"(p + nloops), "r"(cptr) + ); + p += nloops*2; + } while (--j); + cptr += nloops*2; + nblocks >>= 1; + nloops <<= 1; + } while (nblocks != 0); + asm volatile("femms"); +} diff --git a/src/libffmpeg/libavcodec/i386/fft_3dn2.c b/src/libffmpeg/libavcodec/i386/fft_3dn2.c new file mode 100644 index 000000000..a4fe5f0b6 --- /dev/null +++ b/src/libffmpeg/libavcodec/i386/fft_3dn2.c @@ -0,0 +1,210 @@ +/* + * FFT/MDCT transform with Extended 3DNow! optimizations + * Copyright (c) 2006 Zuxy MENG Jie, Loren Merritt + * Based on fft_sse.c copyright (c) 2002 Fabrice Bellard. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include "../dsputil.h" + +static const int p1m1[2] __attribute__((aligned(8))) = + { 0, 1 << 31 }; + +static const int m1p1[2] __attribute__((aligned(8))) = + { 1 << 31, 0 }; + +void ff_fft_calc_3dn2(FFTContext *s, FFTComplex *z) +{ + int ln = s->nbits; + long i, j; + long nblocks, nloops; + FFTComplex *p, *cptr; + + asm volatile( + /* FEMMS is not a must here but recommended by AMD */ + "femms \n\t" + "movq %0, %%mm7 \n\t" + ::"m"(*(s->inverse ? m1p1 : p1m1)) + ); + + i = 8 << ln; + asm volatile( + "1: \n\t" + "sub $32, %0 \n\t" + "movq (%0,%1), %%mm0 \n\t" + "movq 16(%0,%1), %%mm1 \n\t" + "movq 8(%0,%1), %%mm2 \n\t" + "movq 24(%0,%1), %%mm3 \n\t" + "movq %%mm0, %%mm4 \n\t" + "movq %%mm1, %%mm5 \n\t" + "pfadd %%mm2, %%mm0 \n\t" + "pfadd %%mm3, %%mm1 \n\t" + "pfsub %%mm2, %%mm4 \n\t" + "pfsub %%mm3, %%mm5 \n\t" + "movq %%mm0, %%mm2 \n\t" + "pswapd %%mm5, %%mm5 \n\t" + "movq %%mm4, %%mm3 \n\t" + "pxor %%mm7, %%mm5 \n\t" + "pfadd %%mm1, %%mm0 \n\t" + "pfadd %%mm5, %%mm4 \n\t" + "pfsub %%mm1, %%mm2 \n\t" + "pfsub %%mm5, %%mm3 \n\t" + "movq %%mm0, (%0,%1) \n\t" + "movq %%mm4, 8(%0,%1) \n\t" + "movq %%mm2, 16(%0,%1) \n\t" + "movq %%mm3, 24(%0,%1) \n\t" + "jg 1b \n\t" + :"+r"(i) + :"r"(z) + ); + /* pass 2 .. ln-1 */ + + nblocks = 1 << (ln-3); + nloops = 1 << 2; + cptr = s->exptab1; + do { + p = z; + j = nblocks; + do { + i = nloops*8; + asm volatile( + "1: \n\t" + "sub $16, %0 \n\t" + "movq (%1,%0), %%mm0 \n\t" + "movq 8(%1,%0), %%mm1 \n\t" + "movq (%2,%0), %%mm2 \n\t" + "movq 8(%2,%0), %%mm3 \n\t" + "movq (%3,%0,2), %%mm4 \n\t" + "movq 8(%3,%0,2), %%mm5 \n\t" + "pswapd %%mm4, %%mm6 \n\t" // no need for cptr[2] & cptr[3] + "pswapd %%mm5, %%mm7 \n\t" + "pfmul %%mm2, %%mm4 \n\t" // cre*re cim*im + "pfmul %%mm3, %%mm5 \n\t" + "pfmul %%mm2, %%mm6 \n\t" // cim*re cre*im + "pfmul %%mm3, %%mm7 \n\t" + "pfpnacc %%mm6, %%mm4 \n\t" // cre*re-cim*im cim*re+cre*im + "pfpnacc %%mm7, %%mm5 \n\t" + "movq %%mm0, %%mm2 \n\t" + "movq %%mm1, %%mm3 \n\t" + "pfadd %%mm4, %%mm0 \n\t" + "pfadd %%mm5, %%mm1 \n\t" + "pfsub %%mm4, %%mm2 \n\t" + "pfsub %%mm5, %%mm3 \n\t" + "movq %%mm0, (%1,%0) \n\t" + "movq %%mm1, 8(%1,%0) \n\t" + "movq %%mm2, (%2,%0) \n\t" + "movq %%mm3, 8(%2,%0) \n\t" + "jg 1b \n\t" + :"+r"(i) + :"r"(p), "r"(p + nloops), "r"(cptr) + ); + p += nloops*2; + } while (--j); + cptr += nloops*2; + nblocks >>= 1; + nloops <<= 1; + } while (nblocks != 0); + asm volatile("femms"); +} + +void ff_imdct_calc_3dn2(MDCTContext *s, FFTSample *output, + const FFTSample *input, FFTSample *tmp) +{ + long k, n8, n4, n2, n; + const uint16_t *revtab = s->fft.revtab; + const FFTSample *tcos = s->tcos; + const FFTSample *tsin = s->tsin; + const FFTSample *in1, *in2; + FFTComplex *z = (FFTComplex *)tmp; + + n = 1 << s->nbits; + n2 = n >> 1; + n4 = n >> 2; + n8 = n >> 3; + + /* pre rotation */ + in1 = input; + in2 = input + n2 - 1; + for(k = 0; k < n4; k++) { + // FIXME a single block is faster, but gcc 2.95 and 3.4.x on 32bit can't compile it + asm volatile( + "movd %0, %%mm0 \n\t" + "movd %2, %%mm1 \n\t" + "punpckldq %1, %%mm0 \n\t" + "punpckldq %3, %%mm1 \n\t" + "movq %%mm0, %%mm2 \n\t" + "pfmul %%mm1, %%mm0 \n\t" + "pswapd %%mm1, %%mm1 \n\t" + "pfmul %%mm1, %%mm2 \n\t" + "pfpnacc %%mm2, %%mm0 \n\t" + ::"m"(in2[-2*k]), "m"(in1[2*k]), + "m"(tcos[k]), "m"(tsin[k]) + ); + asm volatile( + "movq %%mm0, %0 \n\t" + :"=m"(z[revtab[k]]) + ); + } + + ff_fft_calc(&s->fft, z); + + /* post rotation + reordering */ + for(k = 0; k < n4; k++) { + asm volatile( + "movq %0, %%mm0 \n\t" + "movd %1, %%mm1 \n\t" + "punpckldq %2, %%mm1 \n\t" + "movq %%mm0, %%mm2 \n\t" + "pfmul %%mm1, %%mm0 \n\t" + "pswapd %%mm1, %%mm1 \n\t" + "pfmul %%mm1, %%mm2 \n\t" + "pfpnacc %%mm2, %%mm0 \n\t" + "movq %%mm0, %0 \n\t" + :"+m"(z[k]) + :"m"(tcos[k]), "m"(tsin[k]) + ); + } + + k = n-8; + asm volatile("movd %0, %%mm7" ::"r"(1<<31)); + asm volatile( + "1: \n\t" + "movq (%4,%0), %%mm0 \n\t" // z[n8+k] + "neg %0 \n\t" + "pswapd -8(%4,%0), %%mm1 \n\t" // z[n8-1-k] + "movq %%mm0, %%mm2 \n\t" + "pxor %%mm7, %%mm2 \n\t" + "punpckldq %%mm1, %%mm2 \n\t" + "pswapd %%mm2, %%mm3 \n\t" + "punpckhdq %%mm1, %%mm0 \n\t" + "pswapd %%mm0, %%mm4 \n\t" + "pxor %%mm7, %%mm0 \n\t" + "pxor %%mm7, %%mm4 \n\t" + "movq %%mm3, -8(%3,%0) \n\t" // output[n-2-2*k] = { z[n8-1-k].im, -z[n8+k].re } + "movq %%mm4, -8(%2,%0) \n\t" // output[n2-2-2*k]= { -z[n8-1-k].re, z[n8+k].im } + "neg %0 \n\t" + "movq %%mm0, (%1,%0) \n\t" // output[2*k] = { -z[n8+k].im, z[n8-1-k].re } + "movq %%mm2, (%2,%0) \n\t" // output[n2+2*k] = { -z[n8+k].re, z[n8-1-k].im } + "sub $8, %0 \n\t" + "jge 1b \n\t" + :"+r"(k) + :"r"(output), "r"(output+n2), "r"(output+n), "r"(z+n8) + :"memory" + ); + asm volatile("femms"); +} + diff --git a/src/libffmpeg/libavcodec/i386/fft_sse.c b/src/libffmpeg/libavcodec/i386/fft_sse.c index 631848265..0dc0c61c1 100644 --- a/src/libffmpeg/libavcodec/i386/fft_sse.c +++ b/src/libffmpeg/libavcodec/i386/fft_sse.c @@ -2,26 +2,23 @@ * FFT/MDCT transform with SSE optimizations * Copyright (c) 2002 Fabrice Bellard. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "../dsputil.h" -#include - -#ifdef HAVE_BUILTIN_VECTOR - -#include static const int p1p1p1m1[4] __attribute__((aligned(16))) = { 0, 0, 0, 1 << 31 }; @@ -32,6 +29,12 @@ static const int p1p1m1p1[4] __attribute__((aligned(16))) = static const int p1p1m1m1[4] __attribute__((aligned(16))) = { 0, 0, 1 << 31, 1 << 31 }; +static const int p1m1p1m1[4] __attribute__((aligned(16))) = + { 0, 1 << 31, 0, 1 << 31 }; + +static const int m1m1m1m1[4] __attribute__((aligned(16))) = + { 1 << 31, 1 << 31, 1 << 31, 1 << 31 }; + #if 0 static void print_v4sf(const char *str, __m128 a) { @@ -45,96 +48,200 @@ static void print_v4sf(const char *str, __m128 a) void ff_fft_calc_sse(FFTContext *s, FFTComplex *z) { int ln = s->nbits; - int j, np, np2; - int nblocks, nloops; - register FFTComplex *p, *q; - FFTComplex *cptr, *cptr1; - int k; - - np = 1 << ln; - - { - __m128 *r, a, b, a1, c1, c2; - - r = (__m128 *)&z[0]; - c1 = *(__m128 *)p1p1m1m1; - if (s->inverse) - c2 = *(__m128 *)p1p1m1p1; - else - c2 = *(__m128 *)p1p1p1m1; - - j = (np >> 2); - do { - a = r[0]; - b = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 0, 3, 2)); - a = _mm_xor_ps(a, c1); - /* do the pass 0 butterfly */ - a = _mm_add_ps(a, b); - - a1 = r[1]; - b = _mm_shuffle_ps(a1, a1, _MM_SHUFFLE(1, 0, 3, 2)); - a1 = _mm_xor_ps(a1, c1); - /* do the pass 0 butterfly */ - b = _mm_add_ps(a1, b); - - /* multiply third by -i */ - /* by toggling the sign bit */ - b = _mm_shuffle_ps(b, b, _MM_SHUFFLE(2, 3, 1, 0)); - b = _mm_xor_ps(b, c2); - - /* do the pass 1 butterfly */ - r[0] = _mm_add_ps(a, b); - r[1] = _mm_sub_ps(a, b); - r += 2; - } while (--j != 0); - } + long i, j; + long nblocks, nloops; + FFTComplex *p, *cptr; + + asm volatile( + "movaps %0, %%xmm4 \n\t" + "movaps %1, %%xmm5 \n\t" + ::"m"(*p1p1m1m1), + "m"(*(s->inverse ? p1p1m1p1 : p1p1p1m1)) + ); + + i = 8 << ln; + asm volatile( + "1: \n\t" + "sub $32, %0 \n\t" + /* do the pass 0 butterfly */ + "movaps (%0,%1), %%xmm0 \n\t" + "movaps %%xmm0, %%xmm1 \n\t" + "shufps $0x4E, %%xmm0, %%xmm0 \n\t" + "xorps %%xmm4, %%xmm1 \n\t" + "addps %%xmm1, %%xmm0 \n\t" + "movaps 16(%0,%1), %%xmm2 \n\t" + "movaps %%xmm2, %%xmm3 \n\t" + "shufps $0x4E, %%xmm2, %%xmm2 \n\t" + "xorps %%xmm4, %%xmm3 \n\t" + "addps %%xmm3, %%xmm2 \n\t" + /* multiply third by -i */ + /* by toggling the sign bit */ + "shufps $0xB4, %%xmm2, %%xmm2 \n\t" + "xorps %%xmm5, %%xmm2 \n\t" + /* do the pass 1 butterfly */ + "movaps %%xmm0, %%xmm1 \n\t" + "addps %%xmm2, %%xmm0 \n\t" + "subps %%xmm2, %%xmm1 \n\t" + "movaps %%xmm0, (%0,%1) \n\t" + "movaps %%xmm1, 16(%0,%1) \n\t" + "jg 1b \n\t" + :"+r"(i) + :"r"(z) + ); /* pass 2 .. ln-1 */ - nblocks = np >> 3; + nblocks = 1 << (ln-3); nloops = 1 << 2; - np2 = np >> 1; - - cptr1 = s->exptab1; + cptr = s->exptab1; do { p = z; - q = z + nloops; j = nblocks; do { - cptr = cptr1; - k = nloops >> 1; - do { - __m128 a, b, c, t1, t2; - - a = *(__m128 *)p; - b = *(__m128 *)q; - - /* complex mul */ - c = *(__m128 *)cptr; - /* cre*re cim*re */ - t1 = _mm_mul_ps(c, - _mm_shuffle_ps(b, b, _MM_SHUFFLE(2, 2, 0, 0))); - c = *(__m128 *)(cptr + 2); - /* -cim*im cre*im */ - t2 = _mm_mul_ps(c, - _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 3, 1, 1))); - b = _mm_add_ps(t1, t2); - - /* butterfly */ - *(__m128 *)p = _mm_add_ps(a, b); - *(__m128 *)q = _mm_sub_ps(a, b); - - p += 2; - q += 2; - cptr += 4; - } while (--k); - - p += nloops; - q += nloops; + i = nloops*8; + asm volatile( + "1: \n\t" + "sub $16, %0 \n\t" + "movaps (%2,%0), %%xmm1 \n\t" + "movaps (%1,%0), %%xmm0 \n\t" + "movaps %%xmm1, %%xmm2 \n\t" + "shufps $0xA0, %%xmm1, %%xmm1 \n\t" + "shufps $0xF5, %%xmm2, %%xmm2 \n\t" + "mulps (%3,%0,2), %%xmm1 \n\t" // cre*re cim*re + "mulps 16(%3,%0,2), %%xmm2 \n\t" // -cim*im cre*im + "addps %%xmm2, %%xmm1 \n\t" + "movaps %%xmm0, %%xmm3 \n\t" + "addps %%xmm1, %%xmm0 \n\t" + "subps %%xmm1, %%xmm3 \n\t" + "movaps %%xmm0, (%1,%0) \n\t" + "movaps %%xmm3, (%2,%0) \n\t" + "jg 1b \n\t" + :"+r"(i) + :"r"(p), "r"(p + nloops), "r"(cptr) + ); + p += nloops*2; } while (--j); - cptr1 += nloops * 2; - nblocks = nblocks >> 1; - nloops = nloops << 1; + cptr += nloops*2; + nblocks >>= 1; + nloops <<= 1; } while (nblocks != 0); } -#endif +void ff_imdct_calc_sse(MDCTContext *s, FFTSample *output, + const FFTSample *input, FFTSample *tmp) +{ + long k, n8, n4, n2, n; + const uint16_t *revtab = s->fft.revtab; + const FFTSample *tcos = s->tcos; + const FFTSample *tsin = s->tsin; + const FFTSample *in1, *in2; + FFTComplex *z = (FFTComplex *)tmp; + + n = 1 << s->nbits; + n2 = n >> 1; + n4 = n >> 2; + n8 = n >> 3; + + asm volatile ("movaps %0, %%xmm7\n\t"::"m"(*p1m1p1m1)); + + /* pre rotation */ + in1 = input; + in2 = input + n2 - 4; + + /* Complex multiplication + Two complex products per iteration, we could have 4 with 8 xmm + registers, 8 with 16 xmm registers. + Maybe we should unroll more. + */ + for (k = 0; k < n4; k += 2) { + asm volatile ( + "movaps %0, %%xmm0 \n\t" // xmm0 = r0 X r1 X : in2 + "movaps %1, %%xmm3 \n\t" // xmm3 = X i1 X i0: in1 + "movlps %2, %%xmm1 \n\t" // xmm1 = X X R1 R0: tcos + "movlps %3, %%xmm2 \n\t" // xmm2 = X X I1 I0: tsin + "shufps $95, %%xmm0, %%xmm0 \n\t" // xmm0 = r1 r1 r0 r0 + "shufps $160,%%xmm3, %%xmm3 \n\t" // xmm3 = i1 i1 i0 i0 + "unpcklps %%xmm2, %%xmm1 \n\t" // xmm1 = I1 R1 I0 R0 + "movaps %%xmm1, %%xmm2 \n\t" // xmm2 = I1 R1 I0 R0 + "xorps %%xmm7, %%xmm2 \n\t" // xmm2 = -I1 R1 -I0 R0 + "mulps %%xmm1, %%xmm0 \n\t" // xmm0 = rI rR rI rR + "shufps $177,%%xmm2, %%xmm2 \n\t" // xmm2 = R1 -I1 R0 -I0 + "mulps %%xmm2, %%xmm3 \n\t" // xmm3 = Ri -Ii Ri -Ii + "addps %%xmm3, %%xmm0 \n\t" // xmm0 = result + ::"m"(in2[-2*k]), "m"(in1[2*k]), + "m"(tcos[k]), "m"(tsin[k]) + ); + /* Should be in the same block, hack for gcc2.95 & gcc3 */ + asm ( + "movlps %%xmm0, %0 \n\t" + "movhps %%xmm0, %1 \n\t" + :"=m"(z[revtab[k]]), "=m"(z[revtab[k + 1]]) + ); + } + + ff_fft_calc_sse(&s->fft, z); + + /* Not currently needed, added for safety */ + asm volatile ("movaps %0, %%xmm7\n\t"::"m"(*p1m1p1m1)); + + /* post rotation + reordering */ + for (k = 0; k < n4; k += 2) { + asm ( + "movaps %0, %%xmm0 \n\t" // xmm0 = i1 r1 i0 r0: z + "movlps %1, %%xmm1 \n\t" // xmm1 = X X R1 R0: tcos + "movaps %%xmm0, %%xmm3 \n\t" // xmm3 = i1 r1 i0 r0 + "movlps %2, %%xmm2 \n\t" // xmm2 = X X I1 I0: tsin + "shufps $160,%%xmm0, %%xmm0 \n\t" // xmm0 = r1 r1 r0 r0 + "shufps $245,%%xmm3, %%xmm3 \n\t" // xmm3 = i1 i1 i0 i0 + "unpcklps %%xmm2, %%xmm1 \n\t" // xmm1 = I1 R1 I0 R0 + "movaps %%xmm1, %%xmm2 \n\t" // xmm2 = I1 R1 I0 R0 + "xorps %%xmm7, %%xmm2 \n\t" // xmm2 = -I1 R1 -I0 R0 + "mulps %%xmm1, %%xmm0 \n\t" // xmm0 = rI rR rI rR + "shufps $177,%%xmm2, %%xmm2 \n\t" // xmm2 = R1 -I1 R0 -I0 + "mulps %%xmm2, %%xmm3 \n\t" // xmm3 = Ri -Ii Ri -Ii + "addps %%xmm3, %%xmm0 \n\t" // xmm0 = result + "movaps %%xmm0, %0 \n\t" + :"+m"(z[k]) + :"m"(tcos[k]), "m"(tsin[k]) + ); + } + + /* + Mnemonics: + 0 = z[k].re + 1 = z[k].im + 2 = z[k + 1].re + 3 = z[k + 1].im + 4 = z[-k - 2].re + 5 = z[-k - 2].im + 6 = z[-k - 1].re + 7 = z[-k - 1].im + */ + k = 16-n; + asm volatile("movaps %0, %%xmm7 \n\t"::"m"(*m1m1m1m1)); + asm volatile( + "1: \n\t" + "movaps -16(%4,%0), %%xmm1 \n\t" // xmm1 = 4 5 6 7 = z[-2-k] + "neg %0 \n\t" + "movaps (%4,%0), %%xmm0 \n\t" // xmm0 = 0 1 2 3 = z[k] + "xorps %%xmm7, %%xmm0 \n\t" // xmm0 = -0 -1 -2 -3 + "movaps %%xmm0, %%xmm2 \n\t" // xmm2 = -0 -1 -2 -3 + "shufps $141,%%xmm1, %%xmm0 \n\t" // xmm0 = -1 -3 4 6 + "shufps $216,%%xmm1, %%xmm2 \n\t" // xmm2 = -0 -2 5 7 + "shufps $156,%%xmm0, %%xmm0 \n\t" // xmm0 = -1 6 -3 4 ! + "shufps $156,%%xmm2, %%xmm2 \n\t" // xmm2 = -0 7 -2 5 ! + "movaps %%xmm0, (%1,%0) \n\t" // output[2*k] + "movaps %%xmm2, (%2,%0) \n\t" // output[n2+2*k] + "neg %0 \n\t" + "shufps $27, %%xmm0, %%xmm0 \n\t" // xmm0 = 4 -3 6 -1 + "xorps %%xmm7, %%xmm0 \n\t" // xmm0 = -4 3 -6 1 ! + "shufps $27, %%xmm2, %%xmm2 \n\t" // xmm2 = 5 -2 7 -0 ! + "movaps %%xmm0, -16(%2,%0) \n\t" // output[n2-4-2*k] + "movaps %%xmm2, -16(%3,%0) \n\t" // output[n-4-2*k] + "add $16, %0 \n\t" + "jle 1b \n\t" + :"+r"(k) + :"r"(output), "r"(output+n2), "r"(output+n), "r"(z+n8) + :"memory" + ); +} + diff --git a/src/libffmpeg/libavcodec/i386/h264dsp_mmx.c b/src/libffmpeg/libavcodec/i386/h264dsp_mmx.c index ac4ad6401..40baf199b 100644 --- a/src/libffmpeg/libavcodec/i386/h264dsp_mmx.c +++ b/src/libffmpeg/libavcodec/i386/h264dsp_mmx.c @@ -1,18 +1,20 @@ /* * Copyright (c) 2004-2005 Michael Niedermayer, Loren Merritt * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -174,7 +176,7 @@ static void ff_h264_idct8_add_mmx(uint8_t *dst, int16_t *block, int stride) block[0] += 32; for(i=0; i<2; i++){ - uint64_t tmp; + DECLARE_ALIGNED_8(uint64_t, tmp); h264_idct8_1d(block+4*i); @@ -315,6 +317,17 @@ static void ff_h264_idct8_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride) "por "#t", "#o" \n\t"\ "psubusb "#a", "#o" \n\t" +// out: o = |x-y|>a +// clobbers: t +#define DIFF_GT2_MMX(x,y,a,o,t)\ + "movq "#y", "#t" \n\t"\ + "movq "#x", "#o" \n\t"\ + "psubusb "#x", "#t" \n\t"\ + "psubusb "#y", "#o" \n\t"\ + "psubusb "#a", "#t" \n\t"\ + "psubusb "#a", "#o" \n\t"\ + "pcmpeqb "#t", "#o" \n\t"\ + // in: mm0=p1 mm1=p0 mm2=q0 mm3=q1 // out: mm5=beta-1, mm7=mask // clobbers: mm4,mm6 @@ -335,46 +348,26 @@ static void ff_h264_idct8_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride) // out: mm1=p0' mm2=q0' // clobbers: mm0,3-6 #define H264_DEBLOCK_P0_Q0(pb_01, pb_3f)\ - /* a = q0^p0^((p1-q1)>>2) */\ - "movq %%mm0, %%mm4 \n\t"\ - "psubb %%mm3, %%mm4 \n\t"\ - "psrlw $2, %%mm4 \n\t"\ - "pxor %%mm1, %%mm4 \n\t"\ - "pxor %%mm2, %%mm4 \n\t"\ - /* b = p0^(q1>>2) */\ - "psrlw $2, %%mm3 \n\t"\ - "pand "#pb_3f", %%mm3 \n\t"\ - "movq %%mm1, %%mm5 \n\t"\ - "pxor %%mm3, %%mm5 \n\t"\ - /* c = q0^(p1>>2) */\ - "psrlw $2, %%mm0 \n\t"\ - "pand "#pb_3f", %%mm0 \n\t"\ - "movq %%mm2, %%mm6 \n\t"\ - "pxor %%mm0, %%mm6 \n\t"\ - /* d = (c^b) & ~(b^a) & 1 */\ - "pxor %%mm5, %%mm6 \n\t"\ - "pxor %%mm4, %%mm5 \n\t"\ - "pandn %%mm6, %%mm5 \n\t"\ - "pand "#pb_01", %%mm5 \n\t"\ - /* delta = (avg(q0, p1>>2) + (d&a)) - * - (avg(p0, q1>>2) + (d&~a)) */\ - "pavgb %%mm2, %%mm0 \n\t"\ - "pand %%mm5, %%mm4 \n\t"\ - "paddusb %%mm4, %%mm0 \n\t"\ - "pavgb %%mm1, %%mm3 \n\t"\ - "pxor %%mm5, %%mm4 \n\t"\ - "paddusb %%mm4, %%mm3 \n\t"\ - /* p0 += clip(delta, -tc0, tc0) - * q0 -= clip(delta, -tc0, tc0) */\ - "movq %%mm0, %%mm4 \n\t"\ - "psubusb %%mm3, %%mm0 \n\t"\ - "psubusb %%mm4, %%mm3 \n\t"\ - "pminub %%mm7, %%mm0 \n\t"\ - "pminub %%mm7, %%mm3 \n\t"\ - "paddusb %%mm0, %%mm1 \n\t"\ - "paddusb %%mm3, %%mm2 \n\t"\ - "psubusb %%mm3, %%mm1 \n\t"\ - "psubusb %%mm0, %%mm2 \n\t" + "movq %%mm1 , %%mm5 \n\t"\ + "pxor %%mm2 , %%mm5 \n\t" /* p0^q0*/\ + "pand "#pb_01" , %%mm5 \n\t" /* (p0^q0)&1*/\ + "pcmpeqb %%mm4 , %%mm4 \n\t"\ + "pxor %%mm4 , %%mm3 \n\t"\ + "pavgb %%mm0 , %%mm3 \n\t" /* (p1 - q1 + 256)>>1*/\ + "pavgb "MANGLE(ff_pb_3)" , %%mm3 \n\t" /*(((p1 - q1 + 256)>>1)+4)>>1 = 64+2+(p1-q1)>>2*/\ + "pxor %%mm1 , %%mm4 \n\t"\ + "pavgb %%mm2 , %%mm4 \n\t" /* (q0 - p0 + 256)>>1*/\ + "pavgb %%mm5 , %%mm3 \n\t"\ + "paddusb %%mm4 , %%mm3 \n\t" /* d+128+33*/\ + "movq "MANGLE(ff_pb_A1)" , %%mm6 \n\t"\ + "psubusb %%mm3 , %%mm6 \n\t"\ + "psubusb "MANGLE(ff_pb_A1)" , %%mm3 \n\t"\ + "pminub %%mm7 , %%mm6 \n\t"\ + "pminub %%mm7 , %%mm3 \n\t"\ + "psubusb %%mm6 , %%mm1 \n\t"\ + "psubusb %%mm3 , %%mm2 \n\t"\ + "paddusb %%mm3 , %%mm1 \n\t"\ + "paddusb %%mm6 , %%mm2 \n\t" // in: mm0=p1 mm1=p0 mm2=q0 mm3=q1 mm7=(tc&mask) %8=mm_bone // out: (q1addr) = clip( (q2+((p0+q0+1)>>1))>>1, q1-tc0, q1+tc0 ) @@ -395,10 +388,7 @@ static void ff_h264_idct8_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride) static inline void h264_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alpha1, int beta1, int8_t *tc0) { - uint64_t tmp0; - uint64_t tc = (uint8_t)tc0[1]*0x01010000 | (uint8_t)tc0[0]*0x0101; - // with luma, tc0=0 doesn't mean no filtering, so we need a separate input mask - uint32_t mask[2] = { (tc0[0]>=0)*0xffffffff, (tc0[1]>=0)*0xffffffff }; + DECLARE_ALIGNED_8(uint64_t, tmp0[2]); asm volatile( "movq (%1,%3), %%mm0 \n\t" //p1 @@ -406,45 +396,46 @@ static inline void h264_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alph "movq (%2), %%mm2 \n\t" //q0 "movq (%2,%3), %%mm3 \n\t" //q1 H264_DEBLOCK_MASK(%6, %7) - "pand %5, %%mm7 \n\t" - "movq %%mm7, %0 \n\t" + + "movd %5, %%mm4 \n\t" + "punpcklbw %%mm4, %%mm4 \n\t" + "punpcklwd %%mm4, %%mm4 \n\t" + "pcmpeqb %%mm3, %%mm3 \n\t" + "movq %%mm4, %%mm6 \n\t" + "pcmpgtb %%mm3, %%mm4 \n\t" + "movq %%mm6, 8+%0 \n\t" + "pand %%mm4, %%mm7 \n\t" + "movq %%mm7, %0 \n\t" /* filter p1 */ "movq (%1), %%mm3 \n\t" //p2 - DIFF_GT_MMX(%%mm1, %%mm3, %%mm5, %%mm6, %%mm4) // |p2-p0|>beta-1 - "pandn %%mm7, %%mm6 \n\t" - "pcmpeqb %%mm7, %%mm6 \n\t" + DIFF_GT2_MMX(%%mm1, %%mm3, %%mm5, %%mm6, %%mm4) // |p2-p0|>beta-1 "pand %%mm7, %%mm6 \n\t" // mask & |p2-p0|beta-1 - "pandn %0, %%mm6 \n\t" - "pcmpeqb %0, %%mm6 \n\t" + DIFF_GT2_MMX(%%mm2, %%mm4, %%mm5, %%mm6, %%mm3) // |q2-q0|>beta-1 "pand %0, %%mm6 \n\t" - "pshufw $80, %4, %%mm5 \n\t" + "movq 8+%0, %%mm5 \n\t" // can be merged with the and below but is slower then "pand %%mm6, %%mm5 \n\t" - "pand %8, %%mm6 \n\t" - "paddb %%mm6, %%mm7 \n\t" + "psubb %%mm6, %%mm7 \n\t" "movq (%2,%3), %%mm3 \n\t" H264_DEBLOCK_Q1(%%mm3, %%mm4, "(%2,%3,2)", "(%2,%3)", %%mm5, %%mm6) /* filter p0, q0 */ - H264_DEBLOCK_P0_Q0(%8, %9) + H264_DEBLOCK_P0_Q0(%8, unused) "movq %%mm1, (%1,%3,2) \n\t" "movq %%mm2, (%2) \n\t" - : "=m"(tmp0) + : "=m"(*tmp0) : "r"(pix-3*stride), "r"(pix), "r"((long)stride), - "m"(tc), "m"(*(uint64_t*)mask), "m"(alpha1), "m"(beta1), - "m"(mm_bone), "m"(ff_pb_3F) + "m"(*tmp0/*unused*/), "m"(*(uint32_t*)tc0), "m"(alpha1), "m"(beta1), + "m"(mm_bone) ); } @@ -459,7 +450,7 @@ static void h264_h_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alpha, in { //FIXME: could cut some load/stores by merging transpose with filter // also, it only needs to transpose 6x8 - uint8_t trans[8*8]; + DECLARE_ALIGNED_8(uint8_t, trans[8*8]); int i; for(i=0; i<2; i++, pix+=8*stride, tc0+=2) { if((tc0[0] & tc0[1]) < 0) @@ -503,7 +494,7 @@ static void h264_v_loop_filter_chroma_mmx2(uint8_t *pix, int stride, int alpha, static void h264_h_loop_filter_chroma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) { //FIXME: could cut some load/stores by merging transpose with filter - uint8_t trans[8*4]; + DECLARE_ALIGNED_8(uint8_t, trans[8*4]); transpose4x4(trans, pix-2, 8, stride); transpose4x4(trans+4, pix-2+4*stride, 8, stride); h264_loop_filter_chroma_mmx2(trans+2*8, 8, alpha-1, beta-1, tc0); @@ -553,7 +544,7 @@ static void h264_v_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int a static void h264_h_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int alpha, int beta) { //FIXME: could cut some load/stores by merging transpose with filter - uint8_t trans[8*4]; + DECLARE_ALIGNED_8(uint8_t, trans[8*4]); transpose4x4(trans, pix-2, 8, stride); transpose4x4(trans+4, pix-2+4*stride, 8, stride); h264_loop_filter_chroma_intra_mmx2(trans+2*8, 8, alpha-1, beta-1); @@ -561,6 +552,101 @@ static void h264_h_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int a transpose4x4(pix-2+4*stride, trans+4, stride, 8); } +static void h264_loop_filter_strength_mmx2( int16_t bS[2][4][4], uint8_t nnz[40], int8_t ref[2][40], int16_t mv[2][40][2], + int bidir, int edges, int step, int mask_mv0, int mask_mv1 ) { + int dir; + asm volatile( + "pxor %%mm7, %%mm7 \n\t" + "movq %0, %%mm6 \n\t" + "movq %1, %%mm5 \n\t" + "movq %2, %%mm4 \n\t" + ::"m"(ff_pb_1), "m"(ff_pb_3), "m"(ff_pb_7) + ); + // could do a special case for dir==0 && edges==1, but it only reduces the + // average filter time by 1.2% + for( dir=1; dir>=0; dir-- ) { + const int d_idx = dir ? -8 : -1; + const int mask_mv = dir ? mask_mv1 : mask_mv0; + DECLARE_ALIGNED_8(const uint64_t, mask_dir) = dir ? 0 : 0xffffffffffffffffULL; + int b_idx, edge, l; + for( b_idx=12, edge=0; edge= 0; l-- ) { + asm volatile( + "movd %0, %%mm1 \n\t" + "punpckldq %1, %%mm1 \n\t" + "movq %%mm1, %%mm2 \n\t" + "psrlw $7, %%mm2 \n\t" + "pand %%mm6, %%mm2 \n\t" + "por %%mm2, %%mm1 \n\t" // ref_cache with -2 mapped to -1 + "punpckldq %%mm1, %%mm2 \n\t" + "pcmpeqb %%mm2, %%mm1 \n\t" + "paddb %%mm6, %%mm1 \n\t" + "punpckhbw %%mm7, %%mm1 \n\t" // ref[b] != ref[bn] + "por %%mm1, %%mm0 \n\t" + + "movq %2, %%mm1 \n\t" + "movq %3, %%mm2 \n\t" + "psubw %4, %%mm1 \n\t" + "psubw %5, %%mm2 \n\t" + "packsswb %%mm2, %%mm1 \n\t" + "paddb %%mm5, %%mm1 \n\t" + "pminub %%mm4, %%mm1 \n\t" + "pcmpeqb %%mm4, %%mm1 \n\t" // abs(mv[b] - mv[bn]) >= limit + "por %%mm1, %%mm0 \n\t" + ::"m"(ref[l][b_idx]), + "m"(ref[l][b_idx+d_idx]), + "m"(mv[l][b_idx][0]), + "m"(mv[l][b_idx+2][0]), + "m"(mv[l][b_idx+d_idx][0]), + "m"(mv[l][b_idx+d_idx+2][0]) + ); + } + } + asm volatile( + "movd %0, %%mm1 \n\t" + "por %1, %%mm1 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" + "pcmpgtw %%mm7, %%mm1 \n\t" // nnz[b] || nnz[bn] + ::"m"(nnz[b_idx]), + "m"(nnz[b_idx+d_idx]) + ); + asm volatile( + "pcmpeqw %%mm7, %%mm0 \n\t" + "pcmpeqw %%mm7, %%mm0 \n\t" + "psrlw $15, %%mm0 \n\t" // nonzero -> 1 + "psrlw $14, %%mm1 \n\t" + "movq %%mm0, %%mm2 \n\t" + "por %%mm1, %%mm2 \n\t" + "psrlw $1, %%mm1 \n\t" + "pandn %%mm2, %%mm1 \n\t" + "movq %%mm1, %0 \n\t" + :"=m"(*bS[dir][edge]) + ::"memory" + ); + } + edges = 4; + step = 1; + } + asm volatile( + "movq (%0), %%mm0 \n\t" + "movq 8(%0), %%mm1 \n\t" + "movq 16(%0), %%mm2 \n\t" + "movq 24(%0), %%mm3 \n\t" + TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4) + "movq %%mm0, (%0) \n\t" + "movq %%mm3, 8(%0) \n\t" + "movq %%mm4, 16(%0) \n\t" + "movq %%mm2, 24(%0) \n\t" + ::"r"(bS[0]) + :"memory" + ); +} /***********************************/ /* motion compensation */ diff --git a/src/libffmpeg/libavcodec/i386/idct_mmx.c b/src/libffmpeg/libavcodec/i386/idct_mmx.c index 1c8632fb7..ba595845a 100644 --- a/src/libffmpeg/libavcodec/i386/idct_mmx.c +++ b/src/libffmpeg/libavcodec/i386/idct_mmx.c @@ -1,6 +1,3 @@ -/* - * Note: For libavcodec, this code can also be used under the LGPL license - */ /* * idct_mmx.c * Copyright (C) 1999-2001 Aaron Holtzman diff --git a/src/libffmpeg/libavcodec/i386/idct_mmx_xvid.c b/src/libffmpeg/libavcodec/i386/idct_mmx_xvid.c index a55d4ea07..59b255943 100644 --- a/src/libffmpeg/libavcodec/i386/idct_mmx_xvid.c +++ b/src/libffmpeg/libavcodec/i386/idct_mmx_xvid.c @@ -5,22 +5,23 @@ // * // * Copyright(C) 2001 Peter Ross // * -// * 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 file is part of FFmpeg. // * -// * 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. +// * FFmpeg is free software; you can redistribute it and/or +// * modify it under the terms of the GNU Lesser General Public +// * License as published by the Free Software Foundation; either +// * version 2.1 of the License, or (at your option) any later version. // * -// * 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 -// +// * FFmpeg 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 FFmpeg; if not, write to the Free Software Foundation, +// * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // * -// * $Id: idct_mmx_xvid.c,v 1.3 2006/08/02 07:02:41 tmmm Exp $ +// * $Id: idct_mmx_xvid.c,v 1.4 2006/12/04 22:25:26 miguelfreitas Exp $ // * // ***************************************************************************/ @@ -295,17 +296,17 @@ static const int16_t tab_i_04_xmm[32*4] attribute_used __attribute__ ((aligned(8 "movq 8+" #A1 ",%%mm1 \n\t"/* 1 ; x7 x6 x5 x4*/\ "movq %%mm0,%%mm2 \n\t"/* 2 ; x3 x2 x1 x0*/\ "movq " #A3 ",%%mm3 \n\t"/* 3 ; w05 w04 w01 w00*/\ - "pshufw $0b10001000,%%mm0,%%mm0 \n\t"/* x2 x0 x2 x0*/\ + "pshufw $0x88,%%mm0,%%mm0 \n\t"/* x2 x0 x2 x0*/\ "movq 8+" #A3 ",%%mm4 \n\t"/* 4 ; w07 w06 w03 w02*/\ "movq %%mm1,%%mm5 \n\t"/* 5 ; x7 x6 x5 x4*/\ "pmaddwd %%mm0,%%mm3 \n\t"/* x2*w05+x0*w04 x2*w01+x0*w00*/\ "movq 32+" #A3 ",%%mm6 \n\t"/* 6 ; w21 w20 w17 w16*/\ - "pshufw $0b10001000,%%mm1,%%mm1 \n\t"/* x6 x4 x6 x4*/\ + "pshufw $0x88,%%mm1,%%mm1 \n\t"/* x6 x4 x6 x4*/\ "pmaddwd %%mm1,%%mm4 \n\t"/* x6*w07+x4*w06 x6*w03+x4*w02*/\ "movq 40+" #A3 ",%%mm7 \n\t"/* 7 ; w23 w22 w19 w18*/\ - "pshufw $0b11011101,%%mm2,%%mm2 \n\t"/* x3 x1 x3 x1*/\ + "pshufw $0xdd,%%mm2,%%mm2 \n\t"/* x3 x1 x3 x1*/\ "pmaddwd %%mm2,%%mm6 \n\t"/* x3*w21+x1*w20 x3*w17+x1*w16*/\ - "pshufw $0b11011101,%%mm5,%%mm5 \n\t"/* x7 x5 x7 x5*/\ + "pshufw $0xdd,%%mm5,%%mm5 \n\t"/* x7 x5 x7 x5*/\ "pmaddwd %%mm5,%%mm7 \n\t"/* x7*w23+x5*w22 x7*w19+x5*w18*/\ "paddd " #A4 ",%%mm3 \n\t"/* +%4*/\ "pmaddwd 16+" #A3 ",%%mm0 \n\t"/* x2*w13+x0*w12 x2*w09+x0*w08*/\ @@ -330,7 +331,7 @@ static const int16_t tab_i_04_xmm[32*4] attribute_used __attribute__ ((aligned(8 "packssdw %%mm0,%%mm3 \n\t"/* 0 ; y3 y2 y1 y0*/\ "packssdw %%mm4,%%mm7 \n\t"/* 4 ; y6 y7 y4 y5*/\ "movq %%mm3, " #A2 " \n\t"/* 3 ; save y3 y2 y1 y0*/\ - "pshufw $0b10110001,%%mm7,%%mm7 \n\t"/* y7 y6 y5 y4*/\ + "pshufw $0xb1,%%mm7,%%mm7 \n\t"/* y7 y6 y5 y4*/\ "movq %%mm7,8 +" #A2 "\n\t"/* 7 ; save y7 y6 y5 y4*/\ diff --git a/src/libffmpeg/libavcodec/i386/mmx.h b/src/libffmpeg/libavcodec/i386/mmx.h index eab051341..41aae6c21 100644 --- a/src/libffmpeg/libavcodec/i386/mmx.h +++ b/src/libffmpeg/libavcodec/i386/mmx.h @@ -1,6 +1,22 @@ /* * mmx.h * Copyright (C) 1997-2001 H. Dietz and R. Fisher + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_I386MMX_H #define AVCODEC_I386MMX_H @@ -184,16 +200,16 @@ typedef union { #define mmx_m2ri(op,mem,reg,imm) \ __asm__ __volatile__ (#op " %1, %0, %%" #reg \ : /* nothing */ \ - : "X" (mem), "X" (imm)) + : "m" (mem), "i" (imm)) #define mmx_r2ri(op,regs,regd,imm) \ __asm__ __volatile__ (#op " %0, %%" #regs ", %%" #regd \ : /* nothing */ \ - : "X" (imm) ) + : "i" (imm) ) #define mmx_fetch(mem,hint) \ __asm__ __volatile__ ("prefetch" #hint " %0" \ : /* nothing */ \ - : "X" (mem)) + : "m" (mem)) #define maskmovq(regs,maskreg) mmx_r2ri (maskmovq, regs, maskreg) diff --git a/src/libffmpeg/libavcodec/i386/motion_est_mmx.c b/src/libffmpeg/libavcodec/i386/motion_est_mmx.c index edcabcf38..e33870e0f 100644 --- a/src/libffmpeg/libavcodec/i386/motion_est_mmx.c +++ b/src/libffmpeg/libavcodec/i386/motion_est_mmx.c @@ -3,18 +3,20 @@ * Copyright (c) 2001 Fabrice Bellard. * Copyright (c) 2002-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * mostly by Michael Niedermayer @@ -34,7 +36,7 @@ static inline void sad8_1_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h) { long len= -(stride*h); asm volatile( - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%1, %%"REG_a"), %%mm0 \n\t" "movq (%2, %%"REG_a"), %%mm2 \n\t" @@ -70,7 +72,7 @@ static inline void sad8_1_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h) { long len= -(stride*h); asm volatile( - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%1, %%"REG_a"), %%mm0 \n\t" "movq (%2, %%"REG_a"), %%mm2 \n\t" @@ -92,7 +94,7 @@ static inline void sad8_2_mmx2(uint8_t *blk1a, uint8_t *blk1b, uint8_t *blk2, in { long len= -(stride*h); asm volatile( - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%1, %%"REG_a"), %%mm0 \n\t" "movq (%2, %%"REG_a"), %%mm2 \n\t" @@ -118,7 +120,7 @@ static inline void sad8_4_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h) { //FIXME reuse src long len= -(stride*h); asm volatile( - ".balign 16 \n\t" + ASMALIGN(4) "movq "MANGLE(bone)", %%mm5 \n\t" "1: \n\t" "movq (%1, %%"REG_a"), %%mm0 \n\t" @@ -155,7 +157,7 @@ static inline void sad8_2_mmx(uint8_t *blk1a, uint8_t *blk1b, uint8_t *blk2, int { long len= -(stride*h); asm volatile( - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%1, %%"REG_a"), %%mm0 \n\t" "movq (%2, %%"REG_a"), %%mm1 \n\t" @@ -193,7 +195,7 @@ static inline void sad8_4_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h) { long len= -(stride*h); asm volatile( - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%1, %%"REG_a"), %%mm0 \n\t" "movq (%2, %%"REG_a"), %%mm1 \n\t" diff --git a/src/libffmpeg/libavcodec/i386/mpegvideo_mmx.c b/src/libffmpeg/libavcodec/i386/mpegvideo_mmx.c index c00a602bd..1b7b1c19f 100644 --- a/src/libffmpeg/libavcodec/i386/mpegvideo_mmx.c +++ b/src/libffmpeg/libavcodec/i386/mpegvideo_mmx.c @@ -2,18 +2,20 @@ * The simplest mpeg encoder (well, it was the simplest!) * Copyright (c) 2000,2001 Fabrice Bellard. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Optimized for ia32 cpus by Nick Kurshev @@ -25,7 +27,6 @@ #include "../avcodec.h" #include "x86_cpu.h" -extern uint8_t zigzag_direct_noperm[64]; extern uint16_t inv_zigzag_direct16[64]; static const unsigned long long int mm_wabs __attribute__ ((aligned(8))) = 0xffffffffffffffffULL; @@ -66,7 +67,7 @@ asm volatile( "packssdw %%mm5, %%mm5 \n\t" "psubw %%mm5, %%mm7 \n\t" "pxor %%mm4, %%mm4 \n\t" - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%0, %3), %%mm0 \n\t" "movq 8(%0, %3), %%mm1 \n\t" @@ -129,7 +130,7 @@ asm volatile( "packssdw %%mm5, %%mm5 \n\t" "psubw %%mm5, %%mm7 \n\t" "pxor %%mm4, %%mm4 \n\t" - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%0, %3), %%mm0 \n\t" "movq 8(%0, %3), %%mm1 \n\t" @@ -222,7 +223,7 @@ asm volatile( "packssdw %%mm6, %%mm6 \n\t" "packssdw %%mm6, %%mm6 \n\t" "mov %3, %%"REG_a" \n\t" - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%0, %%"REG_a"), %%mm0 \n\t" "movq 8(%0, %%"REG_a"), %%mm1 \n\t" @@ -285,7 +286,7 @@ asm volatile( "packssdw %%mm6, %%mm6 \n\t" "packssdw %%mm6, %%mm6 \n\t" "mov %3, %%"REG_a" \n\t" - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%0, %%"REG_a"), %%mm0 \n\t" "movq 8(%0, %%"REG_a"), %%mm1 \n\t" @@ -357,7 +358,7 @@ asm volatile( "packssdw %%mm6, %%mm6 \n\t" "packssdw %%mm6, %%mm6 \n\t" "mov %3, %%"REG_a" \n\t" - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%0, %%"REG_a"), %%mm0 \n\t" "movq 8(%0, %%"REG_a"), %%mm1 \n\t" @@ -418,7 +419,7 @@ asm volatile( "packssdw %%mm6, %%mm6 \n\t" "packssdw %%mm6, %%mm6 \n\t" "mov %3, %%"REG_a" \n\t" - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%0, %%"REG_a"), %%mm0 \n\t" "movq 8(%0, %%"REG_a"), %%mm1 \n\t" diff --git a/src/libffmpeg/libavcodec/i386/mpegvideo_mmx_template.c b/src/libffmpeg/libavcodec/i386/mpegvideo_mmx_template.c index de2ef08e5..d59b6efd9 100644 --- a/src/libffmpeg/libavcodec/i386/mpegvideo_mmx_template.c +++ b/src/libffmpeg/libavcodec/i386/mpegvideo_mmx_template.c @@ -3,18 +3,20 @@ * * Copyright (c) 2002 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #undef SPREADW @@ -74,7 +76,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s, asm volatile ( "mul %%ecx \n\t" : "=d" (level), "=a"(dummy) - : "a" ((block[0]>>2) + q), "c" (inverse[q<<1]) + : "a" ((block[0]>>2) + q), "c" (ff_inverse[q<<1]) ); #else asm volatile ( @@ -112,7 +114,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s, "pxor %%mm6, %%mm6 \n\t" "psubw (%3), %%mm6 \n\t" // -bias[0] "mov $-128, %%"REG_a" \n\t" - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "pxor %%mm1, %%mm1 \n\t" // 0 "movq (%1, %%"REG_a"), %%mm0 \n\t" // block[i] @@ -156,7 +158,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s, "pxor %%mm7, %%mm7 \n\t" // 0 "pxor %%mm4, %%mm4 \n\t" // 0 "mov $-128, %%"REG_a" \n\t" - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "pxor %%mm1, %%mm1 \n\t" // 0 "movq (%1, %%"REG_a"), %%mm0 \n\t" // block[i] diff --git a/src/libffmpeg/libavcodec/i386/simple_idct_mmx.c b/src/libffmpeg/libavcodec/i386/simple_idct_mmx.c index b033a12b8..525ef34f7 100644 --- a/src/libffmpeg/libavcodec/i386/simple_idct_mmx.c +++ b/src/libffmpeg/libavcodec/i386/simple_idct_mmx.c @@ -3,18 +3,20 @@ * * Copyright (c) 2001, 2002 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "../dsputil.h" @@ -281,7 +283,7 @@ static inline void idct(int16_t *block) "packssdw %%mm0, %%mm4 \n\t" /* A2-B2 a2-b2 A3-B3 a3-b3 */\ "movq %%mm4, 16+" #dst " \n\t"\ -#define COL_IDCT(src0, src4, src1, src5, dst, rounder, shift) \ +#define COL_IDCT(src0, src4, src1, src5, dst, shift) \ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\ "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\ "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\ @@ -294,10 +296,8 @@ static inline void idct(int16_t *block) "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\ "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\ "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\ - #rounder ", %%mm4 \n\t"\ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\ "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\ - #rounder ", %%mm0 \n\t"\ "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\ "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\ "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\ @@ -458,11 +458,11 @@ DC_COND_ROW_IDCT( 64(%0), 72(%0), 80(%0), 88(%0), 64(%1),paddd (%2), 11) DC_COND_ROW_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11) -//IDCT( src0, src4, src1, src5, dst, rounder, shift) -COL_IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0),/nop, 20) -COL_IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0),/nop, 20) -COL_IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0),/nop, 20) -COL_IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0),/nop, 20) +//IDCT( src0, src4, src1, src5, dst, shift) +COL_IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20) +COL_IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20) +COL_IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20) +COL_IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20) #else @@ -705,7 +705,7 @@ Z_COND_IDCT( 64(%0), 72(%0), 80(%0), 88(%0), 64(%1),paddd (%2), 11, 2f) Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 1f) #undef IDCT -#define IDCT(src0, src4, src1, src5, dst, rounder, shift) \ +#define IDCT(src0, src4, src1, src5, dst, shift) \ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\ "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\ "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\ @@ -718,10 +718,8 @@ Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 1f) "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\ "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\ "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\ - #rounder ", %%mm4 \n\t"\ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\ "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\ - #rounder ", %%mm0 \n\t"\ "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\ "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\ "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\ @@ -782,20 +780,20 @@ Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 1f) "movd %%mm5, 80+" #dst " \n\t" -//IDCT( src0, src4, src1, src5, dst, rounder, shift) -IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0),/nop, 20) -IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0),/nop, 20) -IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0),/nop, 20) -IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0),/nop, 20) +//IDCT( src0, src4, src1, src5, dst, shift) +IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20) +IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20) +IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20) +IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20) "jmp 9f \n\t" - "#.balign 16 \n\t"\ + "#" ASMALIGN(4) \ "4: \n\t" Z_COND_IDCT( 64(%0), 72(%0), 80(%0), 88(%0), 64(%1),paddd (%2), 11, 6f) Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 5f) #undef IDCT -#define IDCT(src0, src4, src1, src5, dst, rounder, shift) \ +#define IDCT(src0, src4, src1, src5, dst, shift) \ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\ "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\ "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\ @@ -807,9 +805,7 @@ Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 5f) "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\ "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\ "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\ - #rounder ", %%mm4 \n\t"\ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\ - #rounder ", %%mm0 \n\t"\ "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\ "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\ "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\ @@ -859,28 +855,26 @@ Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 5f) "movd %%mm1, 64+" #dst " \n\t"\ "movd %%mm5, 80+" #dst " \n\t" -//IDCT( src0, src4, src1, src5, dst, rounder, shift) -IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0),/nop, 20) -IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0),/nop, 20) -IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0),/nop, 20) -IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0),/nop, 20) +//IDCT( src0, src4, src1, src5, dst, shift) +IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20) +IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20) +IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20) +IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20) "jmp 9f \n\t" - "#.balign 16 \n\t"\ + "#" ASMALIGN(4) \ "6: \n\t" Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 7f) #undef IDCT -#define IDCT(src0, src4, src1, src5, dst, rounder, shift) \ +#define IDCT(src0, src4, src1, src5, dst, shift) \ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\ "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\ "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\ "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\ "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\ "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\ - #rounder ", %%mm4 \n\t"\ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\ - #rounder ", %%mm0 \n\t"\ "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\ "movq 56(%2), %%mm1 \n\t" /* C7 C5 C7 C5 */\ "pmaddwd %%mm3, %%mm1 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\ @@ -927,19 +921,19 @@ Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 7f) "movd %%mm5, 80+" #dst " \n\t" -//IDCT( src0, src4, src1, src5, dst, rounder, shift) -IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0),/nop, 20) -IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0),/nop, 20) -IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0),/nop, 20) -IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0),/nop, 20) +//IDCT( src0, src4, src1, src5, dst, shift) +IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20) +IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20) +IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20) +IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20) "jmp 9f \n\t" - "#.balign 16 \n\t"\ + "#" ASMALIGN(4) \ "2: \n\t" Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 3f) #undef IDCT -#define IDCT(src0, src4, src1, src5, dst, rounder, shift) \ +#define IDCT(src0, src4, src1, src5, dst, shift) \ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\ "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\ "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\ @@ -947,10 +941,8 @@ Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 3f) "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\ "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\ "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\ - #rounder ", %%mm4 \n\t"\ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\ "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\ - #rounder ", %%mm0 \n\t"\ "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\ "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\ "movq 56(%2), %%mm1 \n\t" /* C7 C5 C7 C5 */\ @@ -1006,27 +998,25 @@ Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 3f) "movd %%mm4, 64+" #dst " \n\t"\ "movd %%mm5, 80+" #dst " \n\t" -//IDCT( src0, src4, src1, src5, dst, rounder, shift) -IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0),/nop, 20) -IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0),/nop, 20) -IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0),/nop, 20) -IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0),/nop, 20) +//IDCT( src0, src4, src1, src5, dst, shift) +IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20) +IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20) +IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20) +IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20) "jmp 9f \n\t" - "#.balign 16 \n\t"\ + "#" ASMALIGN(4) \ "3: \n\t" #undef IDCT -#define IDCT(src0, src4, src1, src5, dst, rounder, shift) \ +#define IDCT(src0, src4, src1, src5, dst, shift) \ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\ "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\ "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\ "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\ "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\ "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\ - #rounder ", %%mm4 \n\t"\ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\ "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\ - #rounder ", %%mm0 \n\t"\ "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\ "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\ "movq 64(%2), %%mm3 \n\t"\ @@ -1072,17 +1062,17 @@ IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0),/nop, 20) "movd %%mm5, 80+" #dst " \n\t" -//IDCT( src0, src4, src1, src5, dst, rounder, shift) -IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0),/nop, 20) -IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0),/nop, 20) -IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0),/nop, 20) -IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0),/nop, 20) +//IDCT( src0, src4, src1, src5, dst, shift) +IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20) +IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20) +IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20) +IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20) "jmp 9f \n\t" - "#.balign 16 \n\t"\ + "#" ASMALIGN(4) \ "5: \n\t" #undef IDCT -#define IDCT(src0, src4, src1, src5, dst, rounder, shift) \ +#define IDCT(src0, src4, src1, src5, dst, shift) \ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\ "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\ "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\ @@ -1093,10 +1083,8 @@ IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0),/nop, 20) "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\ "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\ "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\ - #rounder ", %%mm4 \n\t"\ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\ "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\ - #rounder ", %%mm0 \n\t"\ "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\ "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\ "paddd %%mm1, %%mm0 \n\t" /* A1 a1 */\ @@ -1110,10 +1098,8 @@ IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0),/nop, 20) "movq 32(%2), %%mm7 \n\t" /* C6 C2 C6 C2 */\ "pmaddwd %%mm3, %%mm7 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\ "pmaddwd 40(%2), %%mm3 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\ - #rounder ", %%mm1 \n\t"\ "paddd %%mm1, %%mm7 \n\t" /* A0 a0 */\ "paddd %%mm1, %%mm1 \n\t" /* 2C0 2c0 */\ - #rounder ", %%mm2 \n\t"\ "psubd %%mm7, %%mm1 \n\t" /* A3 a3 */\ "paddd %%mm2, %%mm3 \n\t" /* A1 a1 */\ "paddd %%mm2, %%mm2 \n\t" /* 2C1 2c1 */\ @@ -1140,18 +1126,18 @@ IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0),/nop, 20) "movq %%mm5, 80+" #dst " \n\t" -//IDCT( src0, src4, src1, src5, dst, rounder, shift) -IDCT( 0(%1), 64(%1), 32(%1), 96(%1), 0(%0),/nop, 20) -//IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0),/nop, 20) -IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0),/nop, 20) -//IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0),/nop, 20) +//IDCT( src0, src4, src1, src5, dst, shift) +IDCT( 0(%1), 64(%1), 32(%1), 96(%1), 0(%0), 20) +//IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20) +IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20) +//IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20) "jmp 9f \n\t" - "#.balign 16 \n\t"\ + "#" ASMALIGN(4) \ "1: \n\t" #undef IDCT -#define IDCT(src0, src4, src1, src5, dst, rounder, shift) \ +#define IDCT(src0, src4, src1, src5, dst, shift) \ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\ "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\ "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\ @@ -1163,10 +1149,8 @@ IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0),/nop, 20) "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\ "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\ "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\ - #rounder ", %%mm4 \n\t"\ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\ "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\ - #rounder ", %%mm0 \n\t"\ "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\ "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\ "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\ @@ -1216,25 +1200,23 @@ IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0),/nop, 20) "movd %%mm5, 80+" #dst " \n\t" -//IDCT( src0, src4, src1, src5, dst, rounder, shift) -IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0),/nop, 20) -IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0),/nop, 20) -IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0),/nop, 20) -IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0),/nop, 20) +//IDCT( src0, src4, src1, src5, dst, shift) +IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20) +IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20) +IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20) +IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20) "jmp 9f \n\t" - "#.balign 16 \n\t" + "#" ASMALIGN(4) "7: \n\t" #undef IDCT -#define IDCT(src0, src4, src1, src5, dst, rounder, shift) \ +#define IDCT(src0, src4, src1, src5, dst, shift) \ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\ "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\ "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\ "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\ "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\ - #rounder ", %%mm4 \n\t"\ - #rounder ", %%mm0 \n\t"\ "psrad $" #shift ", %%mm4 \n\t"\ "psrad $" #shift ", %%mm0 \n\t"\ "movq 8+" #src0 ", %%mm2 \n\t" /* R4 R0 r4 r0 */\ @@ -1243,8 +1225,6 @@ IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0),/nop, 20) "movq 24(%2), %%mm7 \n\t" /* -C4 C4 -C4 C4 */\ "pmaddwd %%mm7, %%mm2 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\ "movq 32(%2), %%mm7 \n\t" /* C6 C2 C6 C2 */\ - #rounder ", %%mm1 \n\t"\ - #rounder ", %%mm2 \n\t"\ "psrad $" #shift ", %%mm1 \n\t"\ "packssdw %%mm1, %%mm4 \n\t" /* A0 a0 */\ "movq %%mm4, " #dst " \n\t"\ @@ -1258,11 +1238,11 @@ IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0),/nop, 20) "movq %%mm4, 64+" #dst " \n\t"\ "movq %%mm0, 80+" #dst " \n\t" -//IDCT( src0, src4, src1, src5, dst, rounder, shift) -IDCT( 0(%1), 64(%1), 32(%1), 96(%1), 0(%0),/nop, 20) -//IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0),/nop, 20) -IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0),/nop, 20) -//IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0),/nop, 20) +//IDCT( src0, src4, src1, src5, dst, shift) +IDCT( 0(%1), 64(%1), 32(%1), 96(%1), 0(%0), 20) +//IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20) +IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20) +//IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20) #endif diff --git a/src/libffmpeg/libavcodec/i386/vp3dsp_mmx.c b/src/libffmpeg/libavcodec/i386/vp3dsp_mmx.c index 0684531ae..f715dc803 100644 --- a/src/libffmpeg/libavcodec/i386/vp3dsp_mmx.c +++ b/src/libffmpeg/libavcodec/i386/vp3dsp_mmx.c @@ -1,18 +1,20 @@ /* * Copyright (C) 2004 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/i386/vp3dsp_sse2.c b/src/libffmpeg/libavcodec/i386/vp3dsp_sse2.c index cf822f7d4..bd2911d59 100644 --- a/src/libffmpeg/libavcodec/i386/vp3dsp_sse2.c +++ b/src/libffmpeg/libavcodec/i386/vp3dsp_sse2.c @@ -1,18 +1,20 @@ /* * Copyright (C) 2004 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/idcinvideo.c b/src/libffmpeg/libavcodec/idcinvideo.c index 7e7e6aab1..112da7bc6 100644 --- a/src/libffmpeg/libavcodec/idcinvideo.c +++ b/src/libffmpeg/libavcodec/idcinvideo.c @@ -2,18 +2,20 @@ * Id Quake II CIN Video Decoder * Copyright (C) 2003 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/imgconvert.c b/src/libffmpeg/libavcodec/imgconvert.c index cc1a825fc..d5b4cdca0 100644 --- a/src/libffmpeg/libavcodec/imgconvert.c +++ b/src/libffmpeg/libavcodec/imgconvert.c @@ -2,18 +2,20 @@ * Misc image convertion routines * Copyright (c) 2001, 2002, 2003 Fabrice Bellard. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -32,7 +34,7 @@ #include "dsputil.h" #ifdef USE_FASTMEMCPY -#include "fastmemcpy.h" +#include "libvo/fastmemcpy.h" #endif #ifdef HAVE_MMX @@ -183,7 +185,7 @@ static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { }, [PIX_FMT_RGB555] = { .name = "rgb555", - .nb_channels = 4, .is_alpha = 1, + .nb_channels = 3, .color_type = FF_COLOR_RGB, .pixel_type = FF_PIXEL_PACKED, .depth = 5, @@ -191,6 +193,20 @@ static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { }, /* gray / mono formats */ + [PIX_FMT_GRAY16BE] = { + .name = "gray16be", + .nb_channels = 1, + .color_type = FF_COLOR_GRAY, + .pixel_type = FF_PIXEL_PLANAR, + .depth = 16, + }, + [PIX_FMT_GRAY16LE] = { + .name = "gray16le", + .nb_channels = 1, + .color_type = FF_COLOR_GRAY, + .pixel_type = FF_PIXEL_PLANAR, + .depth = 16, + }, [PIX_FMT_GRAY8] = { .name = "gray", .nb_channels = 1, @@ -235,6 +251,111 @@ static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { .depth = 8, .x_chroma_shift = 2, .y_chroma_shift = 0, }, + [PIX_FMT_BGR32] = { + .name = "bgr32", + .nb_channels = 4, .is_alpha = 1, + .color_type = FF_COLOR_RGB, + .pixel_type = FF_PIXEL_PACKED, + .depth = 8, + .x_chroma_shift = 0, .y_chroma_shift = 0, + }, + [PIX_FMT_BGR565] = { + .name = "bgr565", + .nb_channels = 3, + .color_type = FF_COLOR_RGB, + .pixel_type = FF_PIXEL_PACKED, + .depth = 5, + .x_chroma_shift = 0, .y_chroma_shift = 0, + }, + [PIX_FMT_BGR555] = { + .name = "bgr555", + .nb_channels = 3, + .color_type = FF_COLOR_RGB, + .pixel_type = FF_PIXEL_PACKED, + .depth = 5, + .x_chroma_shift = 0, .y_chroma_shift = 0, + }, + [PIX_FMT_RGB8] = { + .name = "rgb8", + .nb_channels = 1, + .color_type = FF_COLOR_RGB, + .pixel_type = FF_PIXEL_PACKED, + .depth = 8, + .x_chroma_shift = 0, .y_chroma_shift = 0, + }, + [PIX_FMT_RGB4] = { + .name = "rgb4", + .nb_channels = 1, + .color_type = FF_COLOR_RGB, + .pixel_type = FF_PIXEL_PACKED, + .depth = 4, + .x_chroma_shift = 0, .y_chroma_shift = 0, + }, + [PIX_FMT_RGB4_BYTE] = { + .name = "rgb4_byte", + .nb_channels = 1, + .color_type = FF_COLOR_RGB, + .pixel_type = FF_PIXEL_PACKED, + .depth = 8, + .x_chroma_shift = 0, .y_chroma_shift = 0, + }, + [PIX_FMT_BGR8] = { + .name = "bgr8", + .nb_channels = 1, + .color_type = FF_COLOR_RGB, + .pixel_type = FF_PIXEL_PACKED, + .depth = 8, + .x_chroma_shift = 0, .y_chroma_shift = 0, + }, + [PIX_FMT_BGR4] = { + .name = "bgr4", + .nb_channels = 1, + .color_type = FF_COLOR_RGB, + .pixel_type = FF_PIXEL_PACKED, + .depth = 4, + .x_chroma_shift = 0, .y_chroma_shift = 0, + }, + [PIX_FMT_BGR4_BYTE] = { + .name = "bgr4_byte", + .nb_channels = 1, + .color_type = FF_COLOR_RGB, + .pixel_type = FF_PIXEL_PACKED, + .depth = 8, + .x_chroma_shift = 0, .y_chroma_shift = 0, + }, + [PIX_FMT_NV12] = { + .name = "nv12", + .nb_channels = 2, + .color_type = FF_COLOR_YUV, + .pixel_type = FF_PIXEL_PLANAR, + .depth = 8, + .x_chroma_shift = 1, .y_chroma_shift = 1, + }, + [PIX_FMT_NV21] = { + .name = "nv12", + .nb_channels = 2, + .color_type = FF_COLOR_YUV, + .pixel_type = FF_PIXEL_PLANAR, + .depth = 8, + .x_chroma_shift = 1, .y_chroma_shift = 1, + }, + + [PIX_FMT_BGR32_1] = { + .name = "bgr32_1", + .nb_channels = 4, .is_alpha = 1, + .color_type = FF_COLOR_RGB, + .pixel_type = FF_PIXEL_PACKED, + .depth = 8, + .x_chroma_shift = 0, .y_chroma_shift = 0, + }, + [PIX_FMT_RGB32_1] = { + .name = "rgb32_1", + .nb_channels = 4, .is_alpha = 1, + .color_type = FF_COLOR_RGB, + .pixel_type = FF_PIXEL_PACKED, + .depth = 8, + .x_chroma_shift = 0, .y_chroma_shift = 0, + }, }; void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift) @@ -292,6 +413,18 @@ int avpicture_fill(AVPicture *picture, uint8_t *ptr, picture->linesize[1] = w2; picture->linesize[2] = w2; return size + 2 * size2; + case PIX_FMT_NV12: + case PIX_FMT_NV21: + w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift; + h2 = (height + (1 << pinfo->y_chroma_shift) - 1) >> pinfo->y_chroma_shift; + size2 = w2 * h2 * 2; + picture->data[0] = ptr; + picture->data[1] = picture->data[0] + size; + picture->data[2] = NULL; + picture->linesize[0] = width; + picture->linesize[1] = w2; + picture->linesize[2] = 0; + return size + 2 * size2; case PIX_FMT_RGB24: case PIX_FMT_BGR24: picture->data[0] = ptr; @@ -300,11 +433,18 @@ int avpicture_fill(AVPicture *picture, uint8_t *ptr, picture->linesize[0] = width * 3; return size * 3; case PIX_FMT_RGBA32: + case PIX_FMT_BGR32: + case PIX_FMT_RGB32_1: + case PIX_FMT_BGR32_1: picture->data[0] = ptr; picture->data[1] = NULL; picture->data[2] = NULL; picture->linesize[0] = width * 4; return size * 4; + case PIX_FMT_GRAY16BE: + case PIX_FMT_GRAY16LE: + case PIX_FMT_BGR555: + case PIX_FMT_BGR565: case PIX_FMT_RGB555: case PIX_FMT_RGB565: case PIX_FMT_YUV422: @@ -325,12 +465,23 @@ int avpicture_fill(AVPicture *picture, uint8_t *ptr, picture->data[2] = NULL; picture->linesize[0] = width + width/2; return size + size/2; + case PIX_FMT_RGB8: + case PIX_FMT_BGR8: + case PIX_FMT_RGB4_BYTE: + case PIX_FMT_BGR4_BYTE: case PIX_FMT_GRAY8: picture->data[0] = ptr; picture->data[1] = NULL; picture->data[2] = NULL; picture->linesize[0] = width; return size; + case PIX_FMT_RGB4: + case PIX_FMT_BGR4: + picture->data[0] = ptr; + picture->data[1] = NULL; + picture->data[2] = NULL; + picture->linesize[0] = width / 2; + return size / 2; case PIX_FMT_MONOWHITE: case PIX_FMT_MONOBLACK: picture->data[0] = ptr; @@ -370,6 +521,8 @@ int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height, if (pf->pixel_type == FF_PIXEL_PACKED || pf->pixel_type == FF_PIXEL_PALETTE) { if (pix_fmt == PIX_FMT_YUV422 || pix_fmt == PIX_FMT_UYVY422 || + pix_fmt == PIX_FMT_BGR565 || + pix_fmt == PIX_FMT_BGR555 || pix_fmt == PIX_FMT_RGB565 || pix_fmt == PIX_FMT_RGB555) w = width * 2; @@ -484,6 +637,8 @@ static int avg_bits_per_pixel(int pix_fmt) case PIX_FMT_UYVY422: case PIX_FMT_RGB565: case PIX_FMT_RGB555: + case PIX_FMT_BGR565: + case PIX_FMT_BGR555: bits = 16; break; case PIX_FMT_UYVY411: @@ -602,6 +757,8 @@ void img_copy(AVPicture *dst, const AVPicture *src, case PIX_FMT_UYVY422: case PIX_FMT_RGB565: case PIX_FMT_RGB555: + case PIX_FMT_BGR565: + case PIX_FMT_BGR555: bits = 16; break; case PIX_FMT_UYVY411: @@ -1084,7 +1241,7 @@ static uint8_t c_jpeg_to_ccir[256]; static void img_convert_init(void) { int i; - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; for(i = 0;i < 256; i++) { y_ccir_to_jpeg[i] = Y_CCIR_TO_JPEG(i); @@ -1472,19 +1629,10 @@ static inline unsigned int bitcopy_n(unsigned int a, int n) b = bitcopy_n(v << 3, 3);\ } -#define RGBA_IN(r, g, b, a, s)\ -{\ - unsigned int v = ((const uint16_t *)(s))[0];\ - r = bitcopy_n(v >> (10 - 3), 3);\ - g = bitcopy_n(v >> (5 - 3), 3);\ - b = bitcopy_n(v << 3, 3);\ - a = (-(v >> 15)) & 0xff;\ -} -#define RGBA_OUT(d, r, g, b, a)\ +#define RGB_OUT(d, r, g, b)\ {\ - ((uint16_t *)(d))[0] = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3) | \ - ((a << 8) & 0x8000);\ + ((uint16_t *)(d))[0] = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3);\ } #define BPP 2 @@ -1701,6 +1849,75 @@ static void gray_to_monoblack(AVPicture *dst, const AVPicture *src, gray_to_mono(dst, src, width, height, 0x00); } +static void gray_to_gray16(AVPicture *dst, const AVPicture *src, + int width, int height) +{ + int x, y, src_wrap, dst_wrap; + uint8_t *s, *d; + s = src->data[0]; + src_wrap = src->linesize[0] - width; + d = dst->data[0]; + dst_wrap = dst->linesize[0] - width * 2; + for(y=0; ydata[0]; + src_wrap = src->linesize[0] - width * 2; + d = dst->data[0]; + dst_wrap = dst->linesize[0] - width; + for(y=0; ydata[0]; + src_wrap = (src->linesize[0] - width * 2)/2; + d = dst->data[0]; + dst_wrap = (dst->linesize[0] - width * 2)/2; + for(y=0; y 0;size--) { @@ -2446,7 +2696,7 @@ static void deinterlace_line_inplace(uint8_t *lum_m4, uint8_t *lum_m3, uint8_t * int size) { #ifndef HAVE_MMX - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; int sum; for(;size > 0;size--) { diff --git a/src/libffmpeg/libavcodec/imgconvert_template.h b/src/libffmpeg/libavcodec/imgconvert_template.h index e58b0cae2..4cc898bab 100644 --- a/src/libffmpeg/libavcodec/imgconvert_template.h +++ b/src/libffmpeg/libavcodec/imgconvert_template.h @@ -2,18 +2,20 @@ * Templates for image convertion routines * Copyright (c) 2001, 2002, 2003 Fabrice Bellard. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -27,7 +29,7 @@ static void glue(yuv420p_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src, const uint8_t *y1_ptr, *y2_ptr, *cb_ptr, *cr_ptr; uint8_t *d, *d1, *d2; int w, y, cb, cr, r_add, g_add, b_add, width2; - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; unsigned int r, g, b; d = dst->data[0]; @@ -121,7 +123,7 @@ static void glue(yuvj420p_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src, const uint8_t *y1_ptr, *y2_ptr, *cb_ptr, *cr_ptr; uint8_t *d, *d1, *d2; int w, y, cb, cr, r_add, g_add, b_add, width2; - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; unsigned int r, g, b; d = dst->data[0]; @@ -408,7 +410,8 @@ static void glue(pal8_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src, } } -#if !defined(FMT_RGBA32) && defined(RGBA_OUT) +// RGB24 has optimised routines +#if !defined(FMT_RGBA32) && !defined(FMT_RGB24) /* alpha support */ static void glue(rgba32_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src, @@ -417,7 +420,10 @@ static void glue(rgba32_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src, const uint8_t *s; uint8_t *d; int src_wrap, dst_wrap, j, y; - unsigned int v, r, g, b, a; + unsigned int v, r, g, b; +#ifdef RGBA_OUT + unsigned int a; +#endif s = src->data[0]; src_wrap = src->linesize[0] - width * 4; @@ -428,11 +434,15 @@ static void glue(rgba32_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src, for(y=0;y> 24) & 0xff; r = (v >> 16) & 0xff; g = (v >> 8) & 0xff; b = v & 0xff; +#ifdef RGBA_OUT + a = (v >> 24) & 0xff; RGBA_OUT(d, r, g, b, a); +#else + RGB_OUT(d, r, g, b); +#endif s += 4; d += BPP; } @@ -447,7 +457,10 @@ static void glue(RGB_NAME, _to_rgba32)(AVPicture *dst, const AVPicture *src, const uint8_t *s; uint8_t *d; int src_wrap, dst_wrap, j, y; - unsigned int r, g, b, a; + unsigned int r, g, b; +#ifdef RGBA_IN + unsigned int a; +#endif s = src->data[0]; src_wrap = src->linesize[0] - width * BPP; @@ -457,8 +470,13 @@ static void glue(RGB_NAME, _to_rgba32)(AVPicture *dst, const AVPicture *src, for(y=0;ydata[0]; @@ -570,7 +588,7 @@ static void yuvj444p_to_rgb24(AVPicture *dst, const AVPicture *src, const uint8_t *y1_ptr, *cb_ptr, *cr_ptr; uint8_t *d, *d1; int w, y, cb, cr, r_add, g_add, b_add; - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; unsigned int r, g, b; d = dst->data[0]; diff --git a/src/libffmpeg/libavcodec/imgresample.c b/src/libffmpeg/libavcodec/imgresample.c index 8ffcd7960..ce1a05ce4 100644 --- a/src/libffmpeg/libavcodec/imgresample.c +++ b/src/libffmpeg/libavcodec/imgresample.c @@ -2,18 +2,20 @@ * High quality image resampling with polyphase filters * Copyright (c) 2001 Fabrice Bellard. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -27,7 +29,7 @@ #include "dsputil.h" #ifdef USE_FASTMEMCPY -#include "fastmemcpy.h" +#include "libvo/fastmemcpy.h" #endif #define NB_COMPONENTS 3 @@ -45,6 +47,11 @@ #define LINE_BUF_HEIGHT (NB_TAPS * 4) +struct SwsContext { + struct ImgReSampleContext *resampling_ctx; + enum PixelFormat src_pix_fmt, dst_pix_fmt; +}; + struct ImgReSampleContext { int iwidth, iheight, owidth, oheight; int topBand, bottomBand, leftBand, rightBand; @@ -164,7 +171,7 @@ static void v_resample(uint8_t *dst, int dst_width, const uint8_t *src, src_pos += src_incr;\ } -#define DUMP(reg) movq_r2m(reg, tmp); printf(#reg "=%016Lx\n", tmp.uq); +#define DUMP(reg) movq_r2m(reg, tmp); printf(#reg "=%016"PRIx64"\n", tmp.uq); /* XXX: do four pixels at a time */ static void h_resample_fast4_mmx(uint8_t *dst, int dst_width, @@ -674,6 +681,42 @@ void sws_freeContext(struct SwsContext *ctx) av_free(ctx); } + +/** + * Checks if context is valid or reallocs a new one instead. + * If context is NULL, just calls sws_getContext() to get a new one. + * Otherwise, checks if the parameters are the same already saved in context. + * If that is the case, returns the current context. + * Otherwise, frees context and gets a new one. + * + * Be warned that srcFilter, dstFilter are not checked, they are + * asumed to remain valid. + */ +struct SwsContext *sws_getCachedContext(struct SwsContext *ctx, + int srcW, int srcH, int srcFormat, + int dstW, int dstH, int dstFormat, int flags, + SwsFilter *srcFilter, SwsFilter *dstFilter, double *param) +{ + if (ctx != NULL) { + if ((ctx->resampling_ctx->iwidth != srcW) || + (ctx->resampling_ctx->iheight != srcH) || + (ctx->src_pix_fmt != srcFormat) || + (ctx->resampling_ctx->owidth != dstW) || + (ctx->resampling_ctx->oheight != dstH) || + (ctx->dst_pix_fmt != dstFormat)) + { + sws_freeContext(ctx); + ctx = NULL; + } + } + if (ctx == NULL) { + return sws_getContext(srcW, srcH, srcFormat, + dstW, dstH, dstFormat, flags, + srcFilter, dstFilter, param); + } + return ctx; +} + int sws_scale(struct SwsContext *ctx, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]) { @@ -684,7 +727,7 @@ int sws_scale(struct SwsContext *ctx, uint8_t* src[], int srcStride[], uint8_t *buf1 = NULL, *buf2 = NULL; enum PixelFormat current_pix_fmt; - for (i = 0; i < 3; i++) { + for (i = 0; i < 4; i++) { src_pict.data[i] = src[i]; src_pict.linesize[i] = srcStride[i]; dst_pict.data[i] = dst[i]; diff --git a/src/libffmpeg/libavcodec/indeo2.c b/src/libffmpeg/libavcodec/indeo2.c index 3814e5250..f3917ff3a 100644 --- a/src/libffmpeg/libavcodec/indeo2.c +++ b/src/libffmpeg/libavcodec/indeo2.c @@ -1,19 +1,21 @@ /* - * Indel Indeo 2 codec + * Intel Indeo 2 codec * Copyright (c) 2005 Konstantin Shishkov * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/indeo2data.h b/src/libffmpeg/libavcodec/indeo2data.h index 2430b53c3..71d250af7 100644 --- a/src/libffmpeg/libavcodec/indeo2data.h +++ b/src/libffmpeg/libavcodec/indeo2data.h @@ -1,3 +1,24 @@ +/* + * Intel Indeo 2 codec + * copyright (c) 2005 Konstantin Shishkov + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #define IR2_CODES 143 static const uint16_t ir2_codes[IR2_CODES][2] = { #ifdef ALT_BITSTREAM_READER_LE diff --git a/src/libffmpeg/libavcodec/indeo3.c b/src/libffmpeg/libavcodec/indeo3.c index 90eb37150..33dcff820 100644 --- a/src/libffmpeg/libavcodec/indeo3.c +++ b/src/libffmpeg/libavcodec/indeo3.c @@ -2,18 +2,20 @@ * Intel Indeo 3 (IV31, IV32, etc.) video decoder for ffmpeg * written, produced, and directed by Alan Smithee * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -381,7 +383,7 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s, } else if(cmd == 3) { if(strip->usl7 == 0) { strip->usl7 = 1; - ref_vectors = buf2 + (*buf1 * 2); + ref_vectors = (signed char*)buf2 + (*buf1 * 2); buf1++; continue; } diff --git a/src/libffmpeg/libavcodec/indeo3data.h b/src/libffmpeg/libavcodec/indeo3data.h index 77bbc07ba..e69a09f0e 100644 --- a/src/libffmpeg/libavcodec/indeo3data.h +++ b/src/libffmpeg/libavcodec/indeo3data.h @@ -1,3 +1,23 @@ +/* + * Intel Indeo 3 (IV31, IV32, etc.) video decoder for ffmpeg + * written, produced, and directed by Alan Smithee + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ static const uint32_t correction[] = { 0x00000000, 0x00000202, 0xfffffdfe, 0x000002ff, 0xfffffd01, 0xffffff03, 0x000000fd, 0x00000404, diff --git a/src/libffmpeg/libavcodec/interplayvideo.c b/src/libffmpeg/libavcodec/interplayvideo.c index 73165e795..95059c365 100644 --- a/src/libffmpeg/libavcodec/interplayvideo.c +++ b/src/libffmpeg/libavcodec/interplayvideo.c @@ -2,18 +2,20 @@ * Interplay MVE Video Decoder * Copyright (C) 2003 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/jfdctfst.c b/src/libffmpeg/libavcodec/jfdctfst.c index 804fd5766..38424563d 100644 --- a/src/libffmpeg/libavcodec/jfdctfst.c +++ b/src/libffmpeg/libavcodec/jfdctfst.c @@ -1,9 +1,42 @@ /* * jfdctfst.c * - * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. + * + * The authors make NO WARRANTY or representation, either express or implied, + * with respect to this software, its quality, accuracy, merchantability, or + * fitness for a particular purpose. This software is provided "AS IS", and + * you, its user, assume the entire risk as to its quality and accuracy. + * + * This software is copyright (C) 1994-1996, Thomas G. Lane. + * All Rights Reserved except as specified below. + * + * Permission is hereby granted to use, copy, modify, and distribute this + * software (or portions thereof) for any purpose, without fee, subject to + * these conditions: + * (1) If any part of the source code for this software is distributed, then + * this README file must be included, with this copyright and no-warranty + * notice unaltered; and any additions, deletions, or changes to the original + * files must be clearly indicated in accompanying documentation. + * (2) If only executable code is distributed, then the accompanying + * documentation must state that "this software is based in part on the work + * of the Independent JPEG Group". + * (3) Permission for use of this software is granted only if the user accepts + * full responsibility for any undesirable consequences; the authors accept + * NO LIABILITY for damages of any kind. + * + * These conditions apply to any software derived from or based on the IJG + * code, not just to the unmodified library. If you use our work, you ought + * to acknowledge us. + * + * Permission is NOT granted for the use of any IJG author's name or company + * name in advertising or publicity relating to this software or products + * derived from it. This software may be referred to only as "the Independent + * JPEG Group's software". + * + * We specifically permit and encourage the use of this software as the basis + * of commercial products, provided that all warranty or liability claims are + * assumed by the product vendor. * * This file contains a fast, not so accurate integer implementation of the * forward DCT (Discrete Cosine Transform). diff --git a/src/libffmpeg/libavcodec/jfdctint.c b/src/libffmpeg/libavcodec/jfdctint.c index 41d274991..58f3a1446 100644 --- a/src/libffmpeg/libavcodec/jfdctint.c +++ b/src/libffmpeg/libavcodec/jfdctint.c @@ -1,9 +1,42 @@ /* * jfdctint.c * - * Copyright (C) 1991-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. + * + * The authors make NO WARRANTY or representation, either express or implied, + * with respect to this software, its quality, accuracy, merchantability, or + * fitness for a particular purpose. This software is provided "AS IS", and + * you, its user, assume the entire risk as to its quality and accuracy. + * + * This software is copyright (C) 1991-1996, Thomas G. Lane. + * All Rights Reserved except as specified below. + * + * Permission is hereby granted to use, copy, modify, and distribute this + * software (or portions thereof) for any purpose, without fee, subject to + * these conditions: + * (1) If any part of the source code for this software is distributed, then + * this README file must be included, with this copyright and no-warranty + * notice unaltered; and any additions, deletions, or changes to the original + * files must be clearly indicated in accompanying documentation. + * (2) If only executable code is distributed, then the accompanying + * documentation must state that "this software is based in part on the work + * of the Independent JPEG Group". + * (3) Permission for use of this software is granted only if the user accepts + * full responsibility for any undesirable consequences; the authors accept + * NO LIABILITY for damages of any kind. + * + * These conditions apply to any software derived from or based on the IJG + * code, not just to the unmodified library. If you use our work, you ought + * to acknowledge us. + * + * Permission is NOT granted for the use of any IJG author's name or company + * name in advertising or publicity relating to this software or products + * derived from it. This software may be referred to only as "the Independent + * JPEG Group's software". + * + * We specifically permit and encourage the use of this software as the basis + * of commercial products, provided that all warranty or liability claims are + * assumed by the product vendor. * * This file contains a slow-but-accurate integer implementation of the * forward DCT (Discrete Cosine Transform). diff --git a/src/libffmpeg/libavcodec/jpeg_ls.c b/src/libffmpeg/libavcodec/jpeg_ls.c index 862a3b422..1b4df2b1a 100644 --- a/src/libffmpeg/libavcodec/jpeg_ls.c +++ b/src/libffmpeg/libavcodec/jpeg_ls.c @@ -3,18 +3,20 @@ * Copyright (c) 2003 Michael Niedermayer * Copyright (c) 2006 Konstantin Shishkov * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -75,9 +77,7 @@ static void ls_init_state(JLSState *state){ state->limit = (4 * state->bpp) - state->qbpp; for(i = 0; i < 367; i++) { - state->A[i] = (state->range + 32) >> 6; - if(state->A[i] < 2) - state->A[i] = 2; + state->A[i] = FFMAX((state->range + 32) >> 6, 2); state->N[i] = 1; } @@ -187,6 +187,34 @@ static int decode_lse(MJpegDecodeContext *s) return 0; } +static void inline downscale_state(JLSState *state, int Q){ + if(state->N[Q] == state->reset){ + state->A[Q] >>=1; + state->B[Q] >>=1; + state->N[Q] >>=1; + } + state->N[Q]++; +} + +static inline int update_state_regular(JLSState *state, int Q, int err){ + state->A[Q] += FFABS(err); + err *= state->twonear; + state->B[Q] += err; + + downscale_state(state, Q); + + if(state->B[Q] <= -state->N[Q]) { + state->B[Q]= FFMAX(state->B[Q] + state->N[Q], 1-state->N[Q]); + if(state->C[Q] > -128) + state->C[Q]--; + }else if(state->B[Q] > 0){ + state->B[Q]= FFMIN(state->B[Q] - state->N[Q], 0); + if(state->C[Q] < 127) + state->C[Q]++; + } + + return err; +} /** * Get context-dependent Golomb code, decode it and update context @@ -211,30 +239,7 @@ static inline int ls_get_code_regular(GetBitContext *gb, JLSState *state, int Q) if(!state->near && !k && (2 * state->B[Q] <= -state->N[Q])) ret = -(ret + 1); - state->A[Q] += ABS(ret); - ret *= state->twonear; - state->B[Q] += ret; - - if(state->N[Q] == state->reset) { - state->A[Q] >>= 1; - state->B[Q] >>= 1; - state->N[Q] >>= 1; - } - state->N[Q]++; - - if(state->B[Q] <= -state->N[Q]) { - state->B[Q] += state->N[Q]; - if(state->C[Q] > -128) - state->C[Q]--; - if(state->B[Q] <= -state->N[Q]) - state->B[Q] = -state->N[Q] + 1; - }else if(state->B[Q] > 0){ - state->B[Q] -= state->N[Q]; - if(state->C[Q] < 127) - state->C[Q]++; - if(state->B[Q] > 0) - state->B[Q] = 0; - } + ret= update_state_regular(state, Q, ret); return ret; } @@ -246,10 +251,9 @@ static inline int ls_get_code_runterm(GetBitContext *gb, JLSState *state, int RI int k, ret, temp, map; int Q = 365 + RItype; - if(!RItype) - temp = state->A[Q]; - else - temp = state->A[Q] + (state->N[Q] >> 1); + temp= state->A[Q]; + if(RItype) + temp += state->N[Q] >> 1; for(k = 0; (state->N[Q] << k) < temp; k++); @@ -272,22 +276,19 @@ static inline int ls_get_code_runterm(GetBitContext *gb, JLSState *state, int RI } /* update state */ - state->A[Q] += ABS(ret) - RItype; + state->A[Q] += FFABS(ret) - RItype; ret *= state->twonear; - if(state->N[Q] == state->reset){ - state->A[Q] >>=1; - state->B[Q] >>=1; - state->N[Q] >>=1; - } - state->N[Q]++; + downscale_state(state, Q); return ret; } +#define R(a, i ) (bits == 8 ? ((uint8_t*)(a))[i] : ((uint16_t*)(a))[i] ) +#define W(a, i, v) (bits == 8 ? (((uint8_t*)(a))[i]=v) : (((uint16_t*)(a))[i]=v)) /** * Decode one line of image */ -static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, uint8_t *last, uint8_t *dst, int last2, int w, int stride, int comp){ +static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, void *last, void *dst, int last2, int w, int stride, int comp, int bits){ int i, x = 0; int Ra, Rb, Rc, Rd; int D0, D1, D2; @@ -296,15 +297,15 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, uint8_ int err, pred; /* compute gradients */ - Ra = x ? dst[x - stride] : last[x]; - Rb = last[x]; - Rc = x ? last[x - stride] : last2; - Rd = (x >= w - stride) ? last[x] : last[x + stride]; + Ra = x ? R(dst, x - stride) : R(last, x); + Rb = R(last, x); + Rc = x ? R(last, x - stride) : last2; + Rd = (x >= w - stride) ? R(last, x) : R(last, x + stride); D0 = Rd - Rb; D1 = Rb - Rc; D2 = Rc - Ra; /* run mode */ - if((ABS(D0) <= state->near) && (ABS(D1) <= state->near) && (ABS(D2) <= state->near)) { + if((FFABS(D0) <= state->near) && (FFABS(D1) <= state->near) && (FFABS(D2) <= state->near)) { int r; int RItype; @@ -316,7 +317,7 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, uint8_ r = (w - x) / stride; } for(i = 0; i < r; i++) { - dst[x] = Ra; + W(dst, x, Ra); x += stride; } /* if EOL reached, we stop decoding */ @@ -332,13 +333,13 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, uint8_ if(r) r = get_bits_long(&s->gb, r); for(i = 0; i < r; i++) { - dst[x] = Ra; + W(dst, x, Ra); x += stride; } /* decode run termination value */ - Rb = last[x]; - RItype = (ABS(Ra - Rb) <= state->near) ? 1 : 0; + Rb = R(last, x); + RItype = (FFABS(Ra - Rb) <= state->near) ? 1 : 0; err = ls_get_code_runterm(&s->gb, state, RItype, log2_run[state->run_index[comp]]); if(state->run_index[comp]) state->run_index[comp]--; @@ -351,17 +352,6 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, uint8_ else pred = Rb + err; } - - if(state->near){ - if(pred < -state->near) - pred += state->range * state->twonear; - else if(pred > state->maxval + state->near) - pred -= state->range * state->twonear; - pred = clip(pred, 0, state->maxval); - } - - dst[x] = pred; - x += stride; } else { /* regular mode */ int context, sign; @@ -385,17 +375,18 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, uint8_ /* we have to do something more for near-lossless coding */ pred += err; - if(state->near) { - if(pred < -state->near) - pred += state->range * state->twonear; - else if(pred > state->maxval + state->near) - pred -= state->range * state->twonear; - pred = clip(pred, 0, state->maxval); - } - - dst[x] = pred; - x += stride; } + if(state->near){ + if(pred < -state->near) + pred += state->range * state->twonear; + else if(pred > state->maxval + state->near) + pred -= state->range * state->twonear; + pred = clip(pred, 0, state->maxval); + } + + pred &= state->maxval; + W(dst, x, pred); + x += stride; } } @@ -403,7 +394,7 @@ static int ls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor int i, t = 0; uint8_t *zero, *last, *cur; JLSState *state; - int off, stride, width; + int off = 0, stride = 1, width, shift; zero = av_mallocz(s->picture.linesize[0]); last = zero; @@ -421,6 +412,11 @@ static int ls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor reset_ls_coding_parameters(state, 0); ls_init_state(state); + if(s->bits <= 8) + shift = point_transform + (8 - s->bits); + else + shift = point_transform + (16 - s->bits); + // av_log(s->avctx, AV_LOG_DEBUG, "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n",s->width,s->height,state->near,state->maxval,state->T1,state->T2,state->T3,state->reset,state->limit,state->qbpp, state->range); // av_log(s->avctx, AV_LOG_DEBUG, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n", ilv, point_transform, s->bits, s->cur_scan); if(ilv == 0) { /* separate planes */ @@ -429,8 +425,13 @@ static int ls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor width = s->width * stride; cur += off; for(i = 0; i < s->height; i++) { - ls_decode_line(state, s, last, cur, t, width, stride, off); - t = last[0]; + if(s->bits <= 8){ + ls_decode_line(state, s, last, cur, t, width, stride, off, 8); + t = last[0]; + }else{ + ls_decode_line(state, s, last, cur, t, width, stride, off, 16); + t = *((uint16_t*)last); + } last = cur; cur += s->picture.linesize[0]; @@ -446,7 +447,7 @@ static int ls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor width = s->width * 3; for(i = 0; i < s->height; i++) { for(j = 0; j < 3; j++) { - ls_decode_line(state, s, last + j, cur + j, Rc[j], width, 3, j); + ls_decode_line(state, s, last + j, cur + j, Rc[j], width, 3, j, 8); Rc[j] = last[j]; if (s->restart_interval && !--s->restart_count) { @@ -464,6 +465,31 @@ static int ls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor return -1; } + if(shift){ /* we need to do point transform or normalize samples */ + int x, w; + + w = s->width * s->nb_components; + + if(s->bits <= 8){ + uint8_t *src = s->picture.data[0]; + + for(i = 0; i < s->height; i++){ + for(x = off; x < w; x+= stride){ + src[x] <<= shift; + } + src += s->picture.linesize[0]; + } + }else{ + uint16_t *src = s->picture.data[0]; + + for(i = 0; i < s->height; i++){ + for(x = 0; x < w; x++){ + src[x] <<= shift; + } + src += s->picture.linesize[0]/2; + } + } + } av_free(state); av_free(zero); @@ -489,35 +515,13 @@ static inline void ls_encode_regular(JLSState *state, PutBitContext *pb, int Q, err += state->range; if(err >= ((state->range + 1) >> 1)) { err -= state->range; - val = 2 * ABS(err) - 1 - map; + val = 2 * FFABS(err) - 1 - map; } else val = 2 * err + map; set_ur_golomb_jpegls(pb, val, k, state->limit, state->qbpp); - state->A[Q] += ABS(err); - state->B[Q] += err * state->twonear; - - if(state->N[Q] == state->reset) { - state->A[Q] >>= 1; - state->B[Q] >>= 1; - state->N[Q] >>= 1; - } - state->N[Q]++; - - if(state->B[Q] <= -state->N[Q]) { - state->B[Q] += state->N[Q]; - if(state->C[Q] > -128) - state->C[Q]--; - if(state->B[Q] <= -state->N[Q]) - state->B[Q] = -state->N[Q] + 1; - }else if(state->B[Q] > 0){ - state->B[Q] -= state->N[Q]; - if(state->C[Q] < 127) - state->C[Q]++; - if(state->B[Q] > 0) - state->B[Q] = 0; - } + update_state_regular(state, Q, err); } /** @@ -547,12 +551,7 @@ static inline void ls_encode_runterm(JLSState *state, PutBitContext *pb, int RIt state->B[Q]++; state->A[Q] += (val + 1 - RItype) >> 1; - if(state->N[Q] == state->reset) { - state->A[Q] >>= 1; - state->B[Q] >>= 1; - state->N[Q] >>= 1; - } - state->N[Q]++; + downscale_state(state, Q); } /** @@ -578,7 +577,7 @@ static inline void ls_encode_run(JLSState *state, PutBitContext *pb, int run, in /** * Encode one line of image */ -static inline void ls_encode_line(JLSState *state, PutBitContext *pb, uint8_t *last, uint8_t *cur, int last2, int w, int stride, int comp){ +static inline void ls_encode_line(JLSState *state, PutBitContext *pb, void *last, void *cur, int last2, int w, int stride, int comp, int bits){ int x = 0; int Ra, Rb, Rc, Rd; int D0, D1, D2; @@ -587,32 +586,32 @@ static inline void ls_encode_line(JLSState *state, PutBitContext *pb, uint8_t *l int err, pred, sign; /* compute gradients */ - Ra = x ? cur[x - stride] : last[x]; - Rb = last[x]; - Rc = x ? last[x - stride] : last2; - Rd = (x >= w - stride) ? last[x] : last[x + stride]; + Ra = x ? R(cur, x - stride) : R(last, x); + Rb = R(last, x); + Rc = x ? R(last, x - stride) : last2; + Rd = (x >= w - stride) ? R(last, x) : R(last, x + stride); D0 = Rd - Rb; D1 = Rb - Rc; D2 = Rc - Ra; /* run mode */ - if((ABS(D0) <= state->near) && (ABS(D1) <= state->near) && (ABS(D2) <= state->near)) { + if((FFABS(D0) <= state->near) && (FFABS(D1) <= state->near) && (FFABS(D2) <= state->near)) { int RUNval, RItype, run; run = 0; RUNval = Ra; - while(x < w && (ABS(cur[x] - RUNval) <= state->near)){ + while(x < w && (FFABS(R(cur, x) - RUNval) <= state->near)){ run++; - cur[x] = Ra; + W(cur, x, Ra); x += stride; } ls_encode_run(state, pb, run, comp, x < w); if(x >= w) return; - Rb = last[x]; - RItype = (ABS(Ra - Rb) <= state->near); + Rb = R(last, x); + RItype = (FFABS(Ra - Rb) <= state->near); pred = RItype ? Ra : Rb; - err = cur[x] - pred; + err = R(cur, x) - pred; if(!RItype && Ra > Rb) err = -err; @@ -627,7 +626,7 @@ static inline void ls_encode_line(JLSState *state, PutBitContext *pb, uint8_t *l Ra = clip(pred + err * state->twonear, 0, state->maxval); else Ra = clip(pred - err * state->twonear, 0, state->maxval); - cur[x] = Ra; + W(cur, x, Ra); } if(err < 0) err += state->range; @@ -638,7 +637,6 @@ static inline void ls_encode_line(JLSState *state, PutBitContext *pb, uint8_t *l if(state->run_index[comp] > 0) state->run_index[comp]--; - x += stride; } else { /* regular mode */ int context; @@ -649,11 +647,11 @@ static inline void ls_encode_line(JLSState *state, PutBitContext *pb, uint8_t *l context = -context; sign = 1; pred = clip(pred - state->C[context], 0, state->maxval); - err = pred - cur[x]; + err = pred - R(cur, x); }else{ sign = 0; pred = clip(pred + state->C[context], 0, state->maxval); - err = cur[x] - pred; + err = R(cur, x) - pred; } if(state->near){ @@ -665,12 +663,12 @@ static inline void ls_encode_line(JLSState *state, PutBitContext *pb, uint8_t *l Ra = clip(pred + err * state->twonear, 0, state->maxval); else Ra = clip(pred - err * state->twonear, 0, state->maxval); - cur[x] = Ra; + W(cur, x, Ra); } ls_encode_regular(state, pb, context, err); - x += stride; } + x += stride; } } @@ -678,7 +676,7 @@ static void ls_store_lse(JLSState *state, PutBitContext *pb){ /* Test if we have default params and don't need to store LSE */ JLSState state2; memset(&state2, 0, sizeof(JLSState)); - state2.bpp = 8; + state2.bpp = state->bpp; state2.near = state->near; reset_ls_coding_parameters(&state2, 1); if(state->T1 == state2.T1 && state->T2 == state2.T2 && state->T3 == state2.T3 && state->reset == state2.reset) @@ -715,13 +713,16 @@ static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_ p->pict_type= FF_I_TYPE; p->key_frame= 1; - comps = (avctx->pix_fmt == PIX_FMT_GRAY8) ? 1 : 3; + if(avctx->pix_fmt == PIX_FMT_GRAY8 || avctx->pix_fmt == PIX_FMT_GRAY16) + comps = 1; + else + comps = 3; /* write our own JPEG header, can't use mjpeg_picture_header */ put_marker(&pb, SOI); put_marker(&pb, SOF48); put_bits(&pb, 16, 8 + comps * 3); // header size depends on components - put_bits(&pb, 8, 8); // bpp + put_bits(&pb, 8, (avctx->pix_fmt == PIX_FMT_GRAY16) ? 16 : 8); // bpp put_bits(&pb, 16, avctx->height); put_bits(&pb, 16, avctx->width); put_bits(&pb, 8, comps); // components @@ -745,7 +746,7 @@ static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_ state = av_mallocz(sizeof(JLSState)); /* initialize JPEG-LS state from JPEG parameters */ state->near = near; - state->bpp = 8; + state->bpp = (avctx->pix_fmt == PIX_FMT_GRAY16) ? 16 : 8; reset_ls_coding_parameters(state, 0); ls_init_state(state); @@ -758,11 +759,20 @@ static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_ int t = 0; for(i = 0; i < avctx->height; i++) { - ls_encode_line(state, &pb2, last, cur, t, avctx->width, 1, 0); + ls_encode_line(state, &pb2, last, cur, t, avctx->width, 1, 0, 8); t = last[0]; last = cur; cur += p->linesize[0]; } + }else if(avctx->pix_fmt == PIX_FMT_GRAY16){ + int t = 0; + + for(i = 0; i < avctx->height; i++) { + ls_encode_line(state, &pb2, last, cur, t, avctx->width, 1, 0, 16); + t = *((uint16_t*)last); + last = cur; + cur += p->linesize[0]; + } }else if(avctx->pix_fmt == PIX_FMT_RGB24){ int j, width; int Rc[3] = {0, 0, 0}; @@ -770,7 +780,7 @@ static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_ width = avctx->width * 3; for(i = 0; i < avctx->height; i++) { for(j = 0; j < 3; j++) { - ls_encode_line(state, &pb2, last + j, cur + j, Rc[j], width, 3, j); + ls_encode_line(state, &pb2, last + j, cur + j, Rc[j], width, 3, j, 8); Rc[j] = last[j]; } last = cur; @@ -783,7 +793,7 @@ static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_ width = avctx->width * 3; for(i = 0; i < avctx->height; i++) { for(j = 2; j >= 0; j--) { - ls_encode_line(state, &pb2, last + j, cur + j, Rc[j], width, 3, j); + ls_encode_line(state, &pb2, last + j, cur + j, Rc[j], width, 3, j, 8); Rc[j] = last[j]; } last = cur; @@ -825,7 +835,7 @@ static int encode_init_ls(AVCodecContext *ctx) { c->avctx = ctx; ctx->coded_frame = &c->picture; - if(ctx->pix_fmt != PIX_FMT_GRAY8 && ctx->pix_fmt != PIX_FMT_RGB24 && ctx->pix_fmt != PIX_FMT_BGR24){ + if(ctx->pix_fmt != PIX_FMT_GRAY8 && ctx->pix_fmt != PIX_FMT_GRAY16 && ctx->pix_fmt != PIX_FMT_RGB24 && ctx->pix_fmt != PIX_FMT_BGR24){ av_log(ctx, AV_LOG_ERROR, "Only grayscale and RGB24/BGR24 images are supported\n"); return -1; } @@ -840,6 +850,6 @@ AVCodec jpegls_encoder = { //FIXME avoid MPV_* lossless jpeg shouldnt need them encode_init_ls, encode_picture_ls, NULL, - .pix_fmts= (enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB24, PIX_FMT_GRAY8, -1}, + .pix_fmts= (enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB24, PIX_FMT_GRAY8, PIX_FMT_GRAY16, -1}, }; #endif diff --git a/src/libffmpeg/libavcodec/jrevdct.c b/src/libffmpeg/libavcodec/jrevdct.c index dc2ffaff7..f055cc1ac 100644 --- a/src/libffmpeg/libavcodec/jrevdct.c +++ b/src/libffmpeg/libavcodec/jrevdct.c @@ -1,9 +1,42 @@ /* * jrevdct.c * - * Copyright (C) 1991, 1992, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. + * + * The authors make NO WARRANTY or representation, either express or implied, + * with respect to this software, its quality, accuracy, merchantability, or + * fitness for a particular purpose. This software is provided "AS IS", and + * you, its user, assume the entire risk as to its quality and accuracy. + * + * This software is copyright (C) 1991, 1992, Thomas G. Lane. + * All Rights Reserved except as specified below. + * + * Permission is hereby granted to use, copy, modify, and distribute this + * software (or portions thereof) for any purpose, without fee, subject to + * these conditions: + * (1) If any part of the source code for this software is distributed, then + * this README file must be included, with this copyright and no-warranty + * notice unaltered; and any additions, deletions, or changes to the original + * files must be clearly indicated in accompanying documentation. + * (2) If only executable code is distributed, then the accompanying + * documentation must state that "this software is based in part on the work + * of the Independent JPEG Group". + * (3) Permission for use of this software is granted only if the user accepts + * full responsibility for any undesirable consequences; the authors accept + * NO LIABILITY for damages of any kind. + * + * These conditions apply to any software derived from or based on the IJG + * code, not just to the unmodified library. If you use our work, you ought + * to acknowledge us. + * + * Permission is NOT granted for the use of any IJG author's name or company + * name in advertising or publicity relating to this software or products + * derived from it. This software may be referred to only as "the Independent + * JPEG Group's software". + * + * We specifically permit and encourage the use of this software as the basis + * of commercial products, provided that all warranty or liability claims are + * assumed by the product vendor. * * This file contains the basic inverse-DCT transformation subroutine. * diff --git a/src/libffmpeg/libavcodec/kmvc.c b/src/libffmpeg/libavcodec/kmvc.c index 036efa559..e8f39fca1 100644 --- a/src/libffmpeg/libavcodec/kmvc.c +++ b/src/libffmpeg/libavcodec/kmvc.c @@ -2,18 +2,20 @@ * KMVC decoder * Copyright (c) 2006 Konstantin Shishkov * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -395,10 +397,8 @@ static int decode_end(AVCodecContext * avctx) { KmvcContext *const c = (KmvcContext *) avctx->priv_data; - if (c->frm0) - av_free(c->frm0); - if (c->frm1) - av_free(c->frm1); + av_freep(&c->frm0); + av_freep(&c->frm1); if (c->pic.data[0]) avctx->release_buffer(avctx, &c->pic); diff --git a/src/libffmpeg/libavcodec/lcl.c b/src/libffmpeg/libavcodec/lcl.c index 0bc118af2..b02ea1543 100644 --- a/src/libffmpeg/libavcodec/lcl.c +++ b/src/libffmpeg/libavcodec/lcl.c @@ -2,18 +2,20 @@ * LCL (LossLess Codec Library) Codec * Copyright (c) 2002-2004 Roberto Togni * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -190,7 +192,7 @@ static unsigned int mszh_decomp(unsigned char * srcptr, int srclen, unsigned cha - +#ifdef CONFIG_DECODERS /* * * Decode a frame @@ -544,9 +546,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 /* always report that the buffer was completely consumed */ return buf_size; } +#endif - - +#ifdef CONFIG_ENCODERS /* * * Encode a frame @@ -605,9 +607,9 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, return c->zstream.total_out; #endif } +#endif /* CONFIG_ENCODERS */ - - +#ifdef CONFIG_DECODERS /* * * Init lcl decoder @@ -769,9 +771,9 @@ static int decode_init(AVCodecContext *avctx) return 0; } +#endif /* CONFIG_DECODERS */ - - +#ifdef CONFIG_ENCODERS /* * * Init lcl encoder @@ -839,11 +841,11 @@ static int encode_init(AVCodecContext *avctx) return 0; #endif } +#endif /* CONFIG_ENCODERS */ - - +#ifdef CONFIG_DECODERS /* * * Uninit lcl decoder @@ -861,9 +863,9 @@ static int decode_end(AVCodecContext *avctx) return 0; } +#endif - - +#ifdef CONFIG_ENCODERS /* * * Uninit lcl encoder @@ -881,7 +883,9 @@ static int encode_end(AVCodecContext *avctx) return 0; } +#endif +#ifdef CONFIG_MSZH_DECODER AVCodec mszh_decoder = { "mszh", CODEC_TYPE_VIDEO, @@ -893,8 +897,9 @@ AVCodec mszh_decoder = { decode_frame, CODEC_CAP_DR1, }; +#endif - +#ifdef CONFIG_ZLIB_DECODER AVCodec zlib_decoder = { "zlib", CODEC_TYPE_VIDEO, @@ -906,6 +911,7 @@ AVCodec zlib_decoder = { decode_frame, CODEC_CAP_DR1, }; +#endif #ifdef CONFIG_ENCODERS diff --git a/src/libffmpeg/libavcodec/loco.c b/src/libffmpeg/libavcodec/loco.c index 37f141821..2ec850ed0 100644 --- a/src/libffmpeg/libavcodec/loco.c +++ b/src/libffmpeg/libavcodec/loco.c @@ -2,18 +2,20 @@ * LOCO codec * Copyright (c) 2005 Konstantin Shishkov * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/lzo.c b/src/libffmpeg/libavcodec/lzo.c index d9b42f848..015c80d0d 100644 --- a/src/libffmpeg/libavcodec/lzo.c +++ b/src/libffmpeg/libavcodec/lzo.c @@ -2,18 +2,20 @@ * LZO 1x decompression * Copyright (c) 2006 Reimar Doeffinger * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "common.h" @@ -164,9 +166,9 @@ int lzo1x_decode(void *out, int *outlen, void *in, int *inlen) { int x; LZOContext c; c.in = in; - c.in_end = in + *inlen; + c.in_end = (uint8_t *)in + *inlen; c.out = c.out_start = out; - c.out_end = out + * outlen; + c.out_end = (uint8_t *)out + * outlen; c.error = 0; x = get_byte(&c); if (x > 17) { diff --git a/src/libffmpeg/libavcodec/lzo.h b/src/libffmpeg/libavcodec/lzo.h index dbce13770..4d00dd721 100644 --- a/src/libffmpeg/libavcodec/lzo.h +++ b/src/libffmpeg/libavcodec/lzo.h @@ -1,3 +1,24 @@ +/* + * LZO 1x decompression + * copyright (c) 2006 Reimar Doeffinger + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #ifndef _LZO_H #define LZO_H diff --git a/src/libffmpeg/libavcodec/mace.c b/src/libffmpeg/libavcodec/mace.c index a104fb04e..95839379a 100644 --- a/src/libffmpeg/libavcodec/mace.c +++ b/src/libffmpeg/libavcodec/mace.c @@ -2,18 +2,20 @@ * MACE decoder * Copyright (c) 2002 Laszlo Torok * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -410,18 +412,18 @@ static int mace_decode_frame(AVCodecContext *avctx, #ifdef DEBUG puts("mace_decode_frame[3]()"); #endif - Exp1to3(c, buf, samples, buf_size / 2, avctx->channels, 1); + Exp1to3(c, buf, samples, buf_size / 2 / avctx->channels, avctx->channels, 1); if (avctx->channels == 2) - Exp1to3(c, buf, samples+1, buf_size / 2, 2, 2); + Exp1to3(c, buf, samples+1, buf_size / 2 / 2, 2, 2); *data_size = 2 * 3 * buf_size; break; case CODEC_ID_MACE6: #ifdef DEBUG puts("mace_decode_frame[6]()"); #endif - Exp1to6(c, buf, samples, buf_size, avctx->channels, 1); + Exp1to6(c, buf, samples, buf_size / avctx->channels, avctx->channels, 1); if (avctx->channels == 2) - Exp1to6(c, buf, samples+1, buf_size, 2, 2); + Exp1to6(c, buf, samples+1, buf_size / 2, 2, 2); *data_size = 2 * 6 * buf_size; break; default: diff --git a/src/libffmpeg/libavcodec/mathops.h b/src/libffmpeg/libavcodec/mathops.h new file mode 100644 index 000000000..9ae34d71b --- /dev/null +++ b/src/libffmpeg/libavcodec/mathops.h @@ -0,0 +1,69 @@ +/* + * simple math operations + * Copyright (c) 2001, 2002 Fabrice Bellard. + * Copyright (c) 2006 Michael Niedermayer et al + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef MATHOPS_H +#define MATHOPS_H + +#ifdef ARCH_X86_32 + +#include "i386/mathops.h" + +#elif defined(ARCH_ARMV4L) + +#include "armv4l/mathops.h" + +#elif defined(ARCH_PPC) + +#include "ppc/mathops.h" + +#endif + +/* generic implementation */ + +#ifndef MULL +# define MULL(a,b) (((int64_t)(a) * (int64_t)(b)) >> FRAC_BITS) +#endif + +#ifndef MULH +//gcc 3.4 creates an incredibly bloated mess out of this +//# define MULH(a,b) (((int64_t)(a) * (int64_t)(b))>>32) + +static always_inline int MULH(int a, int b){ + return ((int64_t)(a) * (int64_t)(b))>>32; +} +#endif + +#ifndef MUL64 +# define MUL64(a,b) ((int64_t)(a) * (int64_t)(b)) +#endif + +/* signed 16x16 -> 32 multiply add accumulate */ +#ifndef MAC16 +# define MAC16(rt, ra, rb) rt += (ra) * (rb) +#endif + +/* signed 16x16 -> 32 multiply */ +#ifndef MUL16 +# define MUL16(ra, rb) ((ra) * (rb)) +#endif + +#endif //MATHOPS_H + diff --git a/src/libffmpeg/libavcodec/mdct.c b/src/libffmpeg/libavcodec/mdct.c index 5c3e7b3b1..de3275289 100644 --- a/src/libffmpeg/libavcodec/mdct.c +++ b/src/libffmpeg/libavcodec/mdct.c @@ -2,18 +2,20 @@ * MDCT/IMDCT transforms * Copyright (c) 2002 Fabrice Bellard. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "dsputil.h" diff --git a/src/libffmpeg/libavcodec/mdec.c b/src/libffmpeg/libavcodec/mdec.c index 79caa24c1..ee43b2777 100644 --- a/src/libffmpeg/libavcodec/mdec.c +++ b/src/libffmpeg/libavcodec/mdec.c @@ -2,18 +2,20 @@ * PSX MDEC codec * Copyright (c) 2003 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * based upon code from Sebastian Jedruszkiewicz diff --git a/src/libffmpeg/libavcodec/mem.c b/src/libffmpeg/libavcodec/mem.c deleted file mode 100644 index 24d75e948..000000000 --- a/src/libffmpeg/libavcodec/mem.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * default memory allocator for libavcodec - * Copyright (c) 2002 Fabrice Bellard. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file mem.c - * default memory allocator for libavcodec. - */ - -#include "avcodec.h" - -/* here we can use OS dependant allocation functions */ -#undef malloc -#undef free -#undef realloc - -#ifdef HAVE_MALLOC_H -#include -#endif - -/* you can redefine av_malloc and av_free in your project to use your - memory allocator. You do not need to suppress this file because the - linker will do it automatically */ - -/** - * Memory allocation of size byte with alignment suitable for all - * memory accesses (including vectors if available on the - * CPU). av_malloc(0) must return a non NULL pointer. - */ -void *av_malloc(unsigned int size) -{ - void *ptr; -#ifdef MEMALIGN_HACK - long diff; -#endif - - /* lets disallow possible ambiguous cases */ - if(size > INT_MAX) - return NULL; - -#ifdef MEMALIGN_HACK - ptr = malloc(size+16+1); - diff= ((-(long)ptr - 1)&15) + 1; - ptr += diff; - ((char*)ptr)[-1]= diff; -#elif defined (HAVE_MEMALIGN) - ptr = memalign(16,size); - /* Why 64? - Indeed, we should align it: - on 4 for 386 - on 16 for 486 - on 32 for 586, PPro - k6-III - on 64 for K7 (maybe for P3 too). - Because L1 and L2 caches are aligned on those values. - But I don't want to code such logic here! - */ - /* Why 16? - because some cpus need alignment, for example SSE2 on P4, & most RISC cpus - it will just trigger an exception and the unaligned load will be done in the - exception handler or it will just segfault (SSE2 on P4) - Why not larger? because i didnt see a difference in benchmarks ... - */ - /* benchmarks with p3 - memalign(64)+1 3071,3051,3032 - memalign(64)+2 3051,3032,3041 - memalign(64)+4 2911,2896,2915 - memalign(64)+8 2545,2554,2550 - memalign(64)+16 2543,2572,2563 - memalign(64)+32 2546,2545,2571 - memalign(64)+64 2570,2533,2558 - - btw, malloc seems to do 8 byte alignment by default here - */ -#else - ptr = malloc(size); -#endif - return ptr; -} - -/** - * av_realloc semantics (same as glibc): if ptr is NULL and size > 0, - * identical to malloc(size). If size is zero, it is identical to - * free(ptr) and NULL is returned. - */ -void *av_realloc(void *ptr, unsigned int size) -{ -#ifdef MEMALIGN_HACK - int diff; -#endif - - /* lets disallow possible ambiguous cases */ - if(size > INT_MAX) - return NULL; - -#ifdef MEMALIGN_HACK - //FIXME this isnt aligned correctly though it probably isnt needed - if(!ptr) return av_malloc(size); - diff= ((char*)ptr)[-1]; - return realloc(ptr - diff, size + diff) + diff; -#else - return realloc(ptr, size); -#endif -} - -/** - * Free memory which has been allocated with av_malloc(z)() or av_realloc(). - * NOTE: ptr = NULL is explicetly allowed - * Note2: it is recommanded that you use av_freep() instead - */ -void av_free(void *ptr) -{ - /* XXX: this test should not be needed on most libcs */ - if (ptr) -#ifdef MEMALIGN_HACK - free(ptr - ((char*)ptr)[-1]); -#else - free(ptr); -#endif -} - diff --git a/src/libffmpeg/libavcodec/mjpeg.c b/src/libffmpeg/libavcodec/mjpeg.c index dffd98946..3d8383e7b 100644 --- a/src/libffmpeg/libavcodec/mjpeg.c +++ b/src/libffmpeg/libavcodec/mjpeg.c @@ -4,18 +4,20 @@ * Copyright (c) 2003 Alex Beregszaszi * Copyright (c) 2003-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Support for external huffman table, various fixes (AVID workaround), @@ -34,6 +36,7 @@ #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" +#include "bytestream.h" /* use two quantizer tables (one for luminance and one for chrominance) */ /* not yet working */ @@ -613,7 +616,7 @@ static void encode_block(MpegEncContext *s, DCTELEM *block, int n) uint16_t *huff_code_ac; /* DC coef */ - component = (n <= 3 ? 0 : n - 4 + 1); + component = (n <= 3 ? 0 : (n&1) + 1); dc = block[0]; /* overflow is impossible */ val = dc - s->last_dc[component]; if (n < 4) { @@ -666,9 +669,16 @@ void mjpeg_encode_mb(MpegEncContext *s, DCTELEM block[6][64]) { int i; - for(i=0;i<6;i++) { + for(i=0;i<5;i++) { encode_block(s, block[i], i); } + if (s->chroma_format == CHROMA_420) { + encode_block(s, block[5], 5); + } else { + encode_block(s, block[6], 6); + encode_block(s, block[5], 5); + encode_block(s, block[7], 7); + } } static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ @@ -845,6 +855,7 @@ typedef struct MJpegDecodeContext { int bottom_field; /* true if bottom field */ int lossless; int ls; + int progressive; int rgb; int rct; /* standard rct */ int pegasus_rct; /* pegasus reversible colorspace transform */ @@ -876,6 +887,7 @@ typedef struct MJpegDecodeContext { DECLARE_ALIGNED_8(DCTELEM, block[64]); ScanTable scantable; void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/); + void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/); int restart_interval; int restart_count; @@ -932,6 +944,7 @@ static int mjpeg_decode_init(AVCodecContext *avctx) s->scantable= s2.intra_scantable; s->idct_put= s2.dsp.idct_put; + s->idct_add= s2.dsp.idct_add; s->mpeg_enc_ctx_allocated = 0; s->buffer_size = 0; @@ -1103,7 +1116,7 @@ static int mjpeg_decode_dht(MJpegDecodeContext *s) static int mjpeg_decode_sof(MJpegDecodeContext *s) { - int len, nb_components, i, width, height; + int len, nb_components, i, width, height, pix_fmt_id; /* XXX: verify len field validity */ len = get_bits(&s->gb, 16); @@ -1116,10 +1129,6 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s) av_log(s->avctx, AV_LOG_ERROR, "only 8 bits/component accepted\n"); return -1; } - if (s->bits > 8 && s->ls){ - av_log(s->avctx, AV_LOG_ERROR, "only <= 8 bits/component accepted for JPEG-LS\n"); - return -1; - } height = get_bits(&s->gb, 16); width = get_bits(&s->gb, 16); @@ -1132,6 +1141,10 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s) if (nb_components <= 0 || nb_components > MAX_COMPONENTS) return -1; + if (s->ls && !(s->bits <= 8 || nb_components == 1)){ + av_log(s->avctx, AV_LOG_ERROR, "only <= 8 bits/component or 16-bit gray accepted for JPEG-LS\n"); + return -1; + } s->nb_components = nb_components; s->h_max = 1; s->v_max = 1; @@ -1188,8 +1201,13 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s) return 0; /* XXX: not complete test ! */ - switch((s->h_count[0] << 4) | s->v_count[0]) { - case 0x11: + pix_fmt_id = (s->h_count[0] << 20) | (s->v_count[0] << 16) | + (s->h_count[1] << 12) | (s->v_count[1] << 8) | + (s->h_count[2] << 4) | s->v_count[2]; + dprintf("pix fmt id %x\n", pix_fmt_id); + switch(pix_fmt_id){ + case 0x222222: + case 0x111111: if(s->rgb){ s->avctx->pix_fmt = PIX_FMT_RGBA32; }else if(s->nb_components==3) @@ -1197,19 +1215,22 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s) else s->avctx->pix_fmt = PIX_FMT_GRAY8; break; - case 0x21: + case 0x211111: + case 0x221212: s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV422P : PIX_FMT_YUVJ422P; break; default: - case 0x22: + case 0x221111: s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV420P : PIX_FMT_YUVJ420P; break; } if(s->ls){ if(s->nb_components > 1) s->avctx->pix_fmt = PIX_FMT_RGB24; - else + else if(s->bits <= 8) s->avctx->pix_fmt = PIX_FMT_GRAY8; + else + s->avctx->pix_fmt = PIX_FMT_GRAY16; } if(s->picture.data[0]) @@ -1234,6 +1255,12 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s) dprintf("decode_sof0: error, len(%d) mismatch\n", len); } + /* totally blank picture as progressive JPEG will only add details to it */ + if(s->progressive){ + memset(s->picture.data[0], 0, s->picture.linesize[0] * s->height); + memset(s->picture.data[1], 0, s->picture.linesize[1] * s->height >> (s->v_max - s->v_count[1])); + memset(s->picture.data[2], 0, s->picture.linesize[2] * s->height >> (s->v_max - s->v_count[2])); + } return 0; } @@ -1311,6 +1338,83 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block, return 0; } +/* decode block and dequantize - progressive JPEG version */ +static int decode_block_progressive(MJpegDecodeContext *s, DCTELEM *block, + int component, int dc_index, int ac_index, int16_t *quant_matrix, + int ss, int se, int Ah, int Al, int *EOBRUN) +{ + int code, i, j, level, val, run; + + /* DC coef */ + if(!ss){ + val = mjpeg_decode_dc(s, dc_index); + if (val == 0xffff) { + dprintf("error dc\n"); + return -1; + } + val = (val * quant_matrix[0] << Al) + s->last_dc[component]; + }else + val = 0; + s->last_dc[component] = val; + block[0] = val; + if(!se) return 0; + /* AC coefs */ + if(*EOBRUN){ + (*EOBRUN)--; + return 0; + } + {OPEN_READER(re, &s->gb) + for(i=ss;;i++) { + UPDATE_CACHE(re, &s->gb); + GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2) + /* Progressive JPEG use AC coeffs from zero and this decoder sets offset 16 by default */ + code -= 16; + if(code & 0xF) { + i += ((unsigned) code) >> 4; + code &= 0xf; + if(code > MIN_CACHE_BITS - 16){ + UPDATE_CACHE(re, &s->gb) + } + { + int cache=GET_CACHE(re,&s->gb); + int sign=(~cache)>>31; + level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign; + } + + LAST_SKIP_BITS(re, &s->gb, code) + + if (i >= se) { + if(i == se){ + j = s->scantable.permutated[se]; + block[j] = level * quant_matrix[j] << Al; + break; + } + dprintf("error count: %d\n", i); + return -1; + } + j = s->scantable.permutated[i]; + block[j] = level * quant_matrix[j] << Al; + }else{ + run = ((unsigned) code) >> 4; + if(run == 0xF){// ZRL - skip 15 coefficients + i += 15; + }else{ + val = run; + run = (1 << run); + UPDATE_CACHE(re, &s->gb); + run += (GET_CACHE(re, &s->gb) >> (32 - val)) & (run - 1); + if(val) + LAST_SKIP_BITS(re, &s->gb, val); + *EOBRUN = run - 1; + break; + } + } + } + CLOSE_READER(re, &s->gb)} + + return 0; +} + static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int predictor, int point_transform){ int i, mb_x, mb_y; uint16_t buffer[32768][4]; @@ -1462,10 +1566,11 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point return 0; } -static int mjpeg_decode_scan(MJpegDecodeContext *s){ +static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int ss, int se, int Ah, int Al){ int i, mb_x, mb_y; - const int nb_components=3; + int EOBRUN = 0; + if(Ah) return 0; /* TODO decode refinement planes too */ for(mb_y = 0; mb_y < s->mb_height; mb_y++) { for(mb_x = 0; mb_x < s->mb_width; mb_x++) { if (s->restart_interval && !s->restart_count) @@ -1482,12 +1587,18 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s){ y = 0; for(j=0;jblock, 0, sizeof(s->block)); - if (decode_block(s, s->block, i, + if (!s->progressive && decode_block(s, s->block, i, s->dc_index[i], s->ac_index[i], s->quant_matrixes[ s->quant_index[c] ]) < 0) { dprintf("error y=%d x=%d\n", mb_y, mb_x); return -1; } + if (s->progressive && decode_block_progressive(s, s->block, i, + s->dc_index[i], s->ac_index[i], + s->quant_matrixes[ s->quant_index[c] ], ss, se, Ah, Al, &EOBRUN) < 0) { + dprintf("error y=%d x=%d\n", mb_y, mb_x); + return -1; + } // dprintf("mb: %d %d processed\n", mb_y, mb_x); ptr = s->picture.data[c] + (((s->linesize[c] * (v * mb_y + y) * 8) + @@ -1495,7 +1606,10 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s){ if (s->interlaced && s->bottom_field) ptr += s->linesize[c] >> 1; //av_log(NULL, AV_LOG_DEBUG, "%d %d %d %d %d %d %d %d \n", mb_x, mb_y, x, y, c, s->bottom_field, (v * mb_y + y) * 8, (h * mb_x + x) * 8); - s->idct_put(ptr, s->linesize[c], s->block); + if(!s->progressive) + s->idct_put(ptr, s->linesize[c], s->block); + else + s->idct_add(ptr, s->linesize[c], s->block); if (++x == h) { x = 0; y++; @@ -1520,7 +1634,7 @@ static int mjpeg_decode_sos(MJpegDecodeContext *s) int len, nb_components, i, h, v, predictor, point_transform; int vmax, hmax, index, id; const int block_size= s->lossless ? 1 : 8; - int ilv; + int ilv, prev_shift; /* XXX: verify len field validity */ len = get_bits(&s->gb, 16); @@ -1530,12 +1644,6 @@ static int mjpeg_decode_sos(MJpegDecodeContext *s) dprintf("decode_sos: invalid len (%d)\n", len); return -1; } - /* XXX: only interleaved scan accepted */ - if ((nb_components != s->nb_components) && !s->ls) - { - dprintf("decode_sos: components(%d) mismatch\n", nb_components); - return -1; - } vmax = 0; hmax = 0; for(i=0;igb, 8); /* JPEG Ss / lossless JPEG predictor /JPEG-LS NEAR */ ilv= get_bits(&s->gb, 8); /* JPEG Se / JPEG-LS ILV */ - skip_bits(&s->gb, 4); /* Ah */ + prev_shift = get_bits(&s->gb, 4); /* Ah */ point_transform= get_bits(&s->gb, 4); /* Al */ for(i=0;imb_width = (s->width + s->h_max * block_size - 1) / (s->h_max * block_size); s->mb_height = (s->height + s->v_max * block_size - 1) / (s->v_max * block_size); } else if(!s->ls) { /* skip this for JPEG-LS */ - h = s->h_max / s->h_scount[s->comp_index[0]]; - v = s->v_max / s->v_scount[s->comp_index[0]]; + h = s->h_max / s->h_scount[0]; + v = s->v_max / s->v_scount[0]; s->mb_width = (s->width + h * block_size - 1) / (h * block_size); s->mb_height = (s->height + v * block_size - 1) / (v * block_size); s->nb_blocks[0] = 1; @@ -1631,7 +1739,7 @@ static int mjpeg_decode_sos(MJpegDecodeContext *s) } } }else{ - if(mjpeg_decode_scan(s) < 0) + if(mjpeg_decode_scan(s, nb_components, predictor, ilv, prev_shift, point_transform) < 0) return -1; } emms_c(); @@ -1801,7 +1909,7 @@ static int mjpeg_decode_com(MJpegDecodeContext *s) { int len = get_bits(&s->gb, 16); if (len >= 2 && 8*len - 16 + get_bits_count(&s->gb) <= s->gb.size_in_bits) { - uint8_t *cbuf = av_malloc(len - 1); + char *cbuf = av_malloc(len - 1); if (cbuf) { int i; for (i = 0; i < len - 2; i++) @@ -2020,17 +2128,26 @@ static int mjpeg_decode_frame(AVCodecContext *avctx, break; case SOF0: s->lossless=0; + s->progressive=0; + if (mjpeg_decode_sof(s) < 0) + return -1; + break; + case SOF2: + s->lossless=0; + s->progressive=1; if (mjpeg_decode_sof(s) < 0) return -1; break; case SOF3: s->lossless=1; + s->progressive=0; if (mjpeg_decode_sof(s) < 0) return -1; break; case SOF48: s->lossless=1; s->ls=1; + s->progressive=0; if (mjpeg_decode_sof(s) < 0) return -1; break; @@ -2039,6 +2156,7 @@ static int mjpeg_decode_frame(AVCodecContext *avctx, return -1; break; case EOI: + s->cur_scan = 0; if ((s->buggy_avid && !s->interlaced) || s->restart_interval) break; eoi_parser: @@ -2076,7 +2194,6 @@ eoi_parser: mjpeg_decode_dri(s); break; case SOF1: - case SOF2: case SOF5: case SOF6: case SOF7: @@ -2387,6 +2504,61 @@ static int mjpeg_decode_end(AVCodecContext *avctx) return 0; } +static int mjpega_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, int keyframe) +{ + uint8_t *poutbufp; + int i; + + if (avctx->codec_id != CODEC_ID_MJPEG) { + av_log(avctx, AV_LOG_ERROR, "mjpega bitstream filter only applies to mjpeg codec\n"); + return 0; + } + + *poutbuf_size = 0; + *poutbuf = av_malloc(buf_size + 44 + FF_INPUT_BUFFER_PADDING_SIZE); + poutbufp = *poutbuf; + bytestream_put_byte(&poutbufp, 0xff); + bytestream_put_byte(&poutbufp, SOI); + bytestream_put_byte(&poutbufp, 0xff); + bytestream_put_byte(&poutbufp, APP1); + bytestream_put_be16(&poutbufp, 42); /* size */ + bytestream_put_be32(&poutbufp, 0); + bytestream_put_buffer(&poutbufp, "mjpg", 4); + bytestream_put_be32(&poutbufp, buf_size + 44); /* field size */ + bytestream_put_be32(&poutbufp, buf_size + 44); /* pad field size */ + bytestream_put_be32(&poutbufp, 0); /* next ptr */ + + for (i = 0; i < buf_size - 1; i++) { + if (buf[i] == 0xff) { + switch (buf[i + 1]) { + case DQT: /* quant off */ + case DHT: /* huff off */ + case SOF0: /* image off */ + bytestream_put_be32(&poutbufp, i + 46); + break; + case SOS: + bytestream_put_be32(&poutbufp, i + 46); /* scan off */ + bytestream_put_be32(&poutbufp, i + 46 + BE_16(buf + i + 2)); /* data off */ + bytestream_put_buffer(&poutbufp, buf + 2, buf_size - 2); /* skip already written SOI */ + *poutbuf_size = poutbufp - *poutbuf; + return 1; + case APP1: + if (i + 8 < buf_size && LE_32(buf + i + 8) == ff_get_fourcc("mjpg")) { + av_log(avctx, AV_LOG_ERROR, "bitstream already formatted\n"); + memcpy(*poutbuf, buf, buf_size); + *poutbuf_size = buf_size; + return 1; + } + } + } + } + av_freep(poutbuf); + av_log(avctx, AV_LOG_ERROR, "could not find SOS marker in bitstream\n"); + return 0; +} + AVCodec mjpeg_decoder = { "mjpeg", CODEC_TYPE_VIDEO, @@ -2446,3 +2618,8 @@ AVCodecParser mjpeg_parser = { ff_parse_close, }; +AVBitStreamFilter mjpega_dump_header_bsf = { + "mjpegadump", + 0, + mjpega_dump_header, +}; diff --git a/src/libffmpeg/libavcodec/mlib/dsputil_mlib.c b/src/libffmpeg/libavcodec/mlib/dsputil_mlib.c index c52490592..59c56b1dd 100644 --- a/src/libffmpeg/libavcodec/mlib/dsputil_mlib.c +++ b/src/libffmpeg/libavcodec/mlib/dsputil_mlib.c @@ -2,18 +2,20 @@ * Sun mediaLib optimized DSP utils * Copyright (c) 2001 Fabrice Bellard. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -384,7 +386,7 @@ static void bswap_buf_mlib(uint32_t *dst, uint32_t *src, int w) static void ff_idct_put_mlib(uint8_t *dest, int line_size, DCTELEM *data) { int i; - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; mlib_VideoIDCT8x8_S16_S16 (data, data); @@ -421,7 +423,6 @@ static void ff_fdct_mlib(DCTELEM *data) void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx) { - if (xine_mm_accel() & MM_ACCEL_MLIB) { c->get_pixels = get_pixels_mlib; c->diff_pixels = diff_pixels_mlib; c->add_pixels_clamped = add_pixels_clamped_mlib; @@ -448,12 +449,10 @@ void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx) c->put_no_rnd_pixels_tab[1][0] = put_pixels8_mlib; c->bswap_buf = bswap_buf_mlib; - } } void MPV_common_init_mlib(MpegEncContext *s) { - if (xine_mm_accel() & MM_ACCEL_MLIB) { if(s->avctx->dct_algo==FF_DCT_AUTO || s->avctx->dct_algo==FF_DCT_MLIB){ s->dsp.fdct = ff_fdct_mlib; } @@ -464,5 +463,4 @@ void MPV_common_init_mlib(MpegEncContext *s) s->dsp.idct = ff_idct_mlib; s->dsp.idct_permutation_type= FF_NO_IDCT_PERM; } - } } diff --git a/src/libffmpeg/libavcodec/mmvideo.c b/src/libffmpeg/libavcodec/mmvideo.c index 0cfae83de..07d3f3fc5 100644 --- a/src/libffmpeg/libavcodec/mmvideo.c +++ b/src/libffmpeg/libavcodec/mmvideo.c @@ -2,18 +2,20 @@ * American Laser Games MM Video Decoder * Copyright (c) 2006 Peter Ross * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/motion_est.c b/src/libffmpeg/libavcodec/motion_est.c index c587369f3..0e1504147 100644 --- a/src/libffmpeg/libavcodec/motion_est.c +++ b/src/libffmpeg/libavcodec/motion_est.c @@ -4,18 +4,20 @@ * Copyright (c) 2002-2004 Michael Niedermayer * * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * new Motion Estimation (X1/EPZS) by Michael Niedermayer @@ -297,14 +299,14 @@ static int pix_dev(uint8_t * pix, int line_size, int mean) s = 0; for (i = 0; i < 16; i++) { for (j = 0; j < 16; j += 8) { - s += ABS(pix[0]-mean); - s += ABS(pix[1]-mean); - s += ABS(pix[2]-mean); - s += ABS(pix[3]-mean); - s += ABS(pix[4]-mean); - s += ABS(pix[5]-mean); - s += ABS(pix[6]-mean); - s += ABS(pix[7]-mean); + s += FFABS(pix[0]-mean); + s += FFABS(pix[1]-mean); + s += FFABS(pix[2]-mean); + s += FFABS(pix[3]-mean); + s += FFABS(pix[4]-mean); + s += FFABS(pix[5]-mean); + s += FFABS(pix[6]-mean); + s += FFABS(pix[7]-mean); pix += 8; } pix += line_size - 16; @@ -1179,13 +1181,11 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, vard= check_input_motion(s, mb_x, mb_y, 1); if((vard+128)>>8 < c->avctx->me_threshold){ + int p_score= FFMIN(vard, varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*100); + int i_score= varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*20; pic->mc_mb_var[s->mb_stride * mb_y + mb_x] = (vard+128)>>8; c->mc_mb_var_sum_temp += (vard+128)>>8; - if (vard <= 64<<8 || vard < varc) { //FIXME - c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc); - }else{ - c->scene_change_score+= s->qscale * s->avctx->scenechange_factor; - } + c->scene_change_score+= ff_sqrt(p_score) - ff_sqrt(i_score); return; } if((vard+128)>>8 < c->avctx->mb_threshold) @@ -1272,10 +1272,9 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, varc, s->avg_mb_var, sum, vard, mx - xx, my - yy); #endif if(mb_type){ - if (vard <= 64<<8 || vard < varc) - c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc); - else - c->scene_change_score+= s->qscale * s->avctx->scenechange_factor; + int p_score= FFMIN(vard, varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*100); + int i_score= varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*20; + c->scene_change_score+= ff_sqrt(p_score) - ff_sqrt(i_score); if(mb_type == CANDIDATE_MB_TYPE_INTER){ c->sub_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16); @@ -1293,14 +1292,14 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, interlaced_search(s, 0, s->p_field_mv_table, s->p_field_select_table, mx, my, 1); } }else if(c->avctx->mb_decision > FF_MB_DECISION_SIMPLE){ - if (vard <= 64<<8 || vard < varc) - c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc); - else - c->scene_change_score+= s->qscale * s->avctx->scenechange_factor; + int p_score= FFMIN(vard, varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*100); + int i_score= varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*20; + c->scene_change_score+= ff_sqrt(p_score) - ff_sqrt(i_score); if (vard*2 + 200*256 > varc) mb_type|= CANDIDATE_MB_TYPE_INTRA; - if (varc*2 + 200*256 > vard){ + if (varc*2 + 200*256 > vard || s->qscale > 24){ +// if (varc*2 + 200*256 + 50*(s->lambda2>>FF_LAMBDA_SHIFT) > vard){ mb_type|= CANDIDATE_MB_TYPE_INTER; c->sub_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16); if(s->flags&CODEC_FLAG_MV0) @@ -1399,10 +1398,10 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, }else s->current_picture.mb_type[mb_y*s->mb_stride + mb_x]= 0; - if (vard <= 64<<8 || vard < varc) { //FIXME - c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc); - }else{ - c->scene_change_score+= s->qscale * s->avctx->scenechange_factor; + { + int p_score= FFMIN(vard, varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*100); + int i_score= varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*20; + c->scene_change_score+= ff_sqrt(p_score) - ff_sqrt(i_score); } } @@ -1673,7 +1672,7 @@ static inline int bidir_refine(MpegEncContext * s, int mb_x, int mb_y) } #define CHECK_BIDIR2(a,b,c,d)\ CHECK_BIDIR(a,b,c,d)\ -CHECK_BIDIR(-a,-b,-c,-d) +CHECK_BIDIR(-(a),-(b),-(c),-(d)) #define CHECK_BIDIRR(a,b,c,d)\ CHECK_BIDIR2(a,b,c,d)\ @@ -1790,7 +1789,7 @@ static inline int direct_search(MpegEncContext * s, int mb_x, int mb_y) P_LEFT[1] = clip(mv_table[mot_xy - 1][1], ymin<first_slice_line) { //FIXME maybe allow this over thread boundary as its cliped + if (!s->first_slice_line) { //FIXME maybe allow this over thread boundary as its clipped P_TOP[0] = clip(mv_table[mot_xy - mot_stride ][0], xmin<dsp.me_sub_cmp != s->dsp.mb_cmp; @@ -513,13 +515,13 @@ static int qpel_motion_search(MpegEncContext * s, }\ } -#define CHECK_CLIPED_MV(ax,ay)\ +#define CHECK_CLIPPED_MV(ax,ay)\ {\ - const int x= ax;\ - const int y= ay;\ - const int x2= FFMAX(xmin, FFMIN(x, xmax));\ - const int y2= FFMAX(ymin, FFMIN(y, ymax));\ - CHECK_MV(x2, y2)\ + const int Lx= ax;\ + const int Ly= ay;\ + const int Lx2= FFMAX(xmin, FFMIN(Lx, xmax));\ + const int Ly2= FFMAX(ymin, FFMIN(Ly, ymax));\ + CHECK_MV(Lx2, Ly2)\ } #define CHECK_MV_DIR(x,y,new_dir)\ @@ -637,8 +639,8 @@ static int funny_diamond_search(MpegEncContext * s, int *best, int dmin, { int dx, dy, i; static int stats[8*8]; -dx= ABS(x-best[0]); -dy= ABS(y-best[1]); +dx= FFABS(x-best[0]); +dy= FFABS(y-best[1]); if(dy>dx){ dx^=dy; dy^=dx; dx^=dy; } @@ -656,6 +658,126 @@ if(256*256*256*64 % (stats[0]+1)==0){ return dmin; } +static int hex_search(MpegEncContext * s, int *best, int dmin, + int src_index, int ref_index, int const penalty_factor, + int size, int h, int flags, int dia_size) +{ + MotionEstContext * const c= &s->me; + me_cmp_func cmpf, chroma_cmpf; + LOAD_COMMON + LOAD_COMMON2 + int map_generation= c->map_generation; + int x,y,i,d; + static const int hex[6][2]={{-2, 0}, { 2,0}, {-1,-2}, {1,-2}, {-1,2},{1,2}}; + + cmpf= s->dsp.me_cmp[size]; + chroma_cmpf= s->dsp.me_cmp[size+1]; + + for(;dia_size; dia_size--){ + do{ + x= best[0]; + y= best[1]; + for(i=0; i<6; i++){ + CHECK_CLIPPED_MV(x+hex[i][0]*dia_size, y+hex[i][1]*dia_size); + } + }while(best[0] != x || best[1] != y); + } + + do{ + x= best[0]; + y= best[1]; + CHECK_CLIPPED_MV(x+1, y); + CHECK_CLIPPED_MV(x, y+1); + CHECK_CLIPPED_MV(x-1, y); + CHECK_CLIPPED_MV(x, y-1); + }while(best[0] != x || best[1] != y); + + return dmin; +} + +static int l2s_dia_search(MpegEncContext * s, int *best, int dmin, + int src_index, int ref_index, int const penalty_factor, + int size, int h, int flags) +{ + MotionEstContext * const c= &s->me; + me_cmp_func cmpf, chroma_cmpf; + LOAD_COMMON + LOAD_COMMON2 + int map_generation= c->map_generation; + int x,y,i,d, dia_size; + static const int hex[8][2]={{-2, 0}, {-1,-1}, { 0,-2}, { 1,-1}, + { 2, 0}, { 1, 1}, { 0, 2}, {-1, 1}}; + + cmpf= s->dsp.me_cmp[size]; + chroma_cmpf= s->dsp.me_cmp[size+1]; + + for(dia_size= c->dia_size&0xFF; dia_size; dia_size--){ + do{ + x= best[0]; + y= best[1]; + for(i=0; i<8; i++){ + CHECK_CLIPPED_MV(x+hex[i][0]*dia_size, y+hex[i][1]*dia_size); + } + }while(best[0] != x || best[1] != y); + } + + x= best[0]; + y= best[1]; + CHECK_CLIPPED_MV(x+1, y); + CHECK_CLIPPED_MV(x, y+1); + CHECK_CLIPPED_MV(x-1, y); + CHECK_CLIPPED_MV(x, y-1); + + return dmin; +} + +static int umh_search(MpegEncContext * s, int *best, int dmin, + int src_index, int ref_index, int const penalty_factor, + int size, int h, int flags) +{ + MotionEstContext * const c= &s->me; + me_cmp_func cmpf, chroma_cmpf; + LOAD_COMMON + LOAD_COMMON2 + int map_generation= c->map_generation; + int x,y,x2,y2, i, j, d; + const int dia_size= c->dia_size&0xFE; + static const int hex[16][2]={{-4,-2}, {-4,-1}, {-4, 0}, {-4, 1}, {-4, 2}, + { 4,-2}, { 4,-1}, { 4, 0}, { 4, 1}, { 4, 2}, + {-2, 3}, { 0, 4}, { 2, 3}, + {-2,-3}, { 0,-4}, { 2,-3},}; + + cmpf= s->dsp.me_cmp[size]; + chroma_cmpf= s->dsp.me_cmp[size+1]; + + x= best[0]; + y= best[1]; + for(x2=FFMAX(x-dia_size+1, xmin); x2<=FFMIN(x+dia_size-1,xmax); x2+=2){ + CHECK_MV(x2, y); + } + for(y2=FFMAX(y-dia_size/2+1, ymin); y2<=FFMIN(y+dia_size/2-1,ymax); y2+=2){ + CHECK_MV(x, y2); + } + + x= best[0]; + y= best[1]; + for(y2=FFMAX(y-2, ymin); y2<=FFMIN(y+2,ymax); y2++){ + for(x2=FFMAX(x-2, xmin); x2<=FFMIN(x+2,xmax); x2++){ + CHECK_MV(x2, y2); + } + } + +//FIXME prevent the CLIP stuff + + for(j=1; j<=dia_size/4; j++){ + for(i=0; i<16; i++){ + CHECK_CLIPPED_MV(x+hex[i][0]*j, y+hex[i][1]*j); + } + } + + return hex_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags, 1); +} + #define SAB_CHECK_MV(ax,ay)\ {\ const int key= ((ay)<me; me_cmp_func cmpf, chroma_cmpf; Minima minima[MAX_SAB_SIZE]; - const int minima_count= ABS(c->dia_size); + const int minima_count= FFABS(c->dia_size); int i, j; LOAD_COMMON LOAD_COMMON2 @@ -827,8 +949,8 @@ static int var_diamond_search(MpegEncContext * s, int *best, int dmin, { int dx, dy, i; static int stats[8*8]; -dx= ABS(x-best[0]); -dy= ABS(y-best[1]); +dx= FFABS(x-best[0]); +dy= FFABS(y-best[1]); stats[dy*8 + dx] ++; if(256*256*256*64 % (stats[0]+1)==0){ for(i=0; i<64; i++){ @@ -853,6 +975,12 @@ static always_inline int diamond_search(MpegEncContext * s, int *best, int dmin, return sab_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); else if(c->dia_size<2) return small_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); + else if(c->dia_size>768) + return umh_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); + else if(c->dia_size>512) + return hex_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags, c->dia_size&0xFF); + else if(c->dia_size>256) + return l2s_dia_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); else return var_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); } @@ -893,7 +1021,7 @@ static always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx /* first line */ if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) - CHECK_CLIPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, + CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) }else{ if(dmin<((h*h*s->avctx->mv0_threshold)>>8) @@ -905,27 +1033,29 @@ static always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx c->skip=1; return dmin; } - CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift) - if(dmin>h*h*2){ - CHECK_CLIPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, - (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) - CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift) - CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift) - CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) - } + CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift) + CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1) + CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1) + CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) + CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) ) + CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, + (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) + CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift) + CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift) + CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) } if(dmin>h*h*4){ if(c->pre_pass){ - CHECK_CLIPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16, + CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16) if(!s->first_slice_line) - CHECK_CLIPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, + CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) }else{ - CHECK_CLIPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, + CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1end_mb_y) //FIXME replace at least with last_slice_line - CHECK_CLIPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, + CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } } @@ -1007,26 +1137,24 @@ static int epzs_motion_search4(MpegEncContext * s, /* first line */ if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) - CHECK_CLIPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, + CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) }else{ CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) //FIXME try some early stop - if(dmin>64*2){ - CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift) - CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) - CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift) - CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) - CHECK_CLIPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, - (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) - } + CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift) + CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) + CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift) + CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) + CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, + (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) } if(dmin>64*4){ - CHECK_CLIPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, + CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1end_mb_y) //FIXME replace at least with last_slice_line - CHECK_CLIPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, + CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } @@ -1069,26 +1197,24 @@ static int epzs_motion_search2(MpegEncContext * s, /* first line */ if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) - CHECK_CLIPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, + CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) }else{ CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) //FIXME try some early stop - if(dmin>64*2){ - CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift) - CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) - CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift) - CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) - CHECK_CLIPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, - (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) - } + CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift) + CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) + CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift) + CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) + CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, + (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) } if(dmin>64*4){ - CHECK_CLIPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, + CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1end_mb_y) //FIXME replace at least with last_slice_line - CHECK_CLIPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, + CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } diff --git a/src/libffmpeg/libavcodec/mpeg12.c b/src/libffmpeg/libavcodec/mpeg12.c index c268cf707..e3a4c2da5 100644 --- a/src/libffmpeg/libavcodec/mpeg12.c +++ b/src/libffmpeg/libavcodec/mpeg12.c @@ -3,18 +3,20 @@ * Copyright (c) 2000,2001 Fabrice Bellard. * Copyright (c) 2002-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -90,10 +92,10 @@ extern void XVMC_pack_pblocks(MpegEncContext *s,int cbp); extern void XVMC_init_block(MpegEncContext *s);//set s->block #endif -const enum PixelFormat pixfmt_yuv_420[]= {PIX_FMT_YUV420P,-1}; -const enum PixelFormat pixfmt_yuv_422[]= {PIX_FMT_YUV422P,-1}; -const enum PixelFormat pixfmt_yuv_444[]= {PIX_FMT_YUV444P,-1}; -const enum PixelFormat pixfmt_xvmc_mpg2_420[] = { +static const enum PixelFormat pixfmt_yuv_420[]= {PIX_FMT_YUV420P,-1}; +static const enum PixelFormat pixfmt_yuv_422[]= {PIX_FMT_YUV422P,-1}; +static const enum PixelFormat pixfmt_yuv_444[]= {PIX_FMT_YUV444P,-1}; +static const enum PixelFormat pixfmt_xvmc_mpg2_420[] = { PIX_FMT_XVMC_MPEG2_IDCT, PIX_FMT_XVMC_MPEG2_MC, -1}; @@ -164,7 +166,7 @@ static void init_uni_ac_vlc(RLTable *rl, uint8_t *uni_ac_vlc_len){ for(run=0; run<64; run++){ int len, bits, code; - int alevel= ABS(level); + int alevel= FFABS(level); int sign= (level>>31)&1; if (alevel > rl->max_level[0][run]) @@ -211,7 +213,7 @@ static int find_frame_rate_index(MpegEncContext *s){ int64_t n1= 1001LL*s->avctx->time_base.den; if(s->avctx->strict_std_compliance > FF_COMPLIANCE_INOFFICIAL && i>=9) break; - d = ABS(n0 - n1); + d = FFABS(n0 - n1); if(d < dmin){ dmin=d; s->frame_rate_index= i; @@ -245,6 +247,11 @@ static int encode_init(AVCodecContext *avctx) if(avctx->level == FF_LEVEL_UNKNOWN) avctx->level = s->chroma_format == CHROMA_420 ? 8 : 5; + if((avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE) && s->frame_rate_index != 4){ + av_log(avctx, AV_LOG_ERROR, "Drop frame time code only allowed with 1001/30000 fps\n"); + return -1; + } + return 0; } @@ -284,7 +291,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) else error-= av_q2d(mpeg2_aspect[i])*s->height/s->width; - error= ABS(error); + error= FFABS(error); if(error < best_aspect_error){ best_aspect_error= error; @@ -351,13 +358,20 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) } put_header(s, GOP_START_CODE); - put_bits(&s->pb, 1, 0); /* do drop frame */ + put_bits(&s->pb, 1, !!(s->avctx->flags & CODEC_FLAG2_DROP_FRAME_TIMECODE)); /* drop frame flag */ /* time code : we must convert from the real frame rate to a fake mpeg frame rate in case of low frame rate */ fps = (framerate.num + framerate.den/2)/ framerate.den; - time_code = s->current_picture_ptr->coded_picture_number; - - s->gop_picture_number = time_code; + time_code = s->current_picture_ptr->coded_picture_number + s->avctx->timecode_frame_start; + + s->gop_picture_number = s->current_picture_ptr->coded_picture_number; + if (s->avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE) { + /* only works for NTSC 29.97 */ + int d = time_code / 17982; + int m = time_code % 17982; + //if (m < 2) m += 2; /* not needed since -2,-1 / 1798 in C returns 0 */ + time_code += 18 * d + 2 * ((m - 2) / 1798); + } put_bits(&s->pb, 5, (uint32_t)((time_code / (fps * 3600)) % 24)); put_bits(&s->pb, 6, (uint32_t)((time_code / (fps * 60)) % 60)); put_bits(&s->pb, 1, 1); @@ -811,7 +825,7 @@ void ff_mpeg1_encode_init(MpegEncContext *s) int bits, code; int diff=i; - adiff = ABS(diff); + adiff = FFABS(diff); if(diff<0) diff--; index = av_log2(2*adiff); @@ -2395,10 +2409,12 @@ static void mpeg_decode_picture_coding_extension(MpegEncContext *s) s->chroma_420_type = get_bits1(&s->gb); s->progressive_frame = get_bits1(&s->gb); - if(s->picture_structure == PICT_FRAME) + if(s->picture_structure == PICT_FRAME){ s->first_field=0; - else{ + s->v_edge_pos= 16*s->mb_height; + }else{ s->first_field ^= 1; + s->v_edge_pos= 8*s->mb_height; memset(s->mbskip_table, 0, s->mb_stride*s->mb_height); } @@ -2702,7 +2718,8 @@ static int slice_decode_thread(AVCodecContext *c, void *arg){ s->error_count= 3*(s->end_mb_y - s->start_mb_y)*s->mb_width; for(;;){ - int start_code, ret; + uint32_t start_code; + int ret; ret= mpeg_decode_slice((Mpeg1Context*)s, mb_y, &buf, s->gb.buffer_end - buf); emms_c(); @@ -2996,7 +3013,7 @@ static void mpeg_decode_gop(AVCodecContext *avctx, * finds the end of the current frame in the bitstream. * @return the position of the first byte of the next frame, or -1 */ -int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size) +static int mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size) { int i; uint32_t state= pc->state; @@ -3040,7 +3057,8 @@ static int mpeg_decode_frame(AVCodecContext *avctx, Mpeg1Context *s = avctx->priv_data; const uint8_t *buf_end; const uint8_t *buf_ptr; - int ret, start_code, input_size; + uint32_t start_code; + int ret, input_size; AVFrame *picture = data; MpegEncContext *s2 = &s->mpeg_enc_ctx; dprintf("fill_buffer\n"); @@ -3057,7 +3075,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx, } if(s2->flags&CODEC_FLAG_TRUNCATED){ - int next= ff_mpeg1_find_frame_end(&s2->parse_context, buf, buf_size); + int next= mpeg1_find_frame_end(&s2->parse_context, buf, buf_size); if( ff_combine_frame(&s2->parse_context, next, &buf, &buf_size) < 0 ) return buf_size; @@ -3087,7 +3105,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx, /* find start next code */ start_code = -1; buf_ptr = ff_find_start_code(buf_ptr,buf_end, &start_code); - if (start_code < 0){ + if (start_code > 0x1ff){ if(s2->pict_type != B_TYPE || avctx->skip_frame <= AVDISCARD_DEFAULT){ if(avctx->thread_count > 1){ int i; @@ -3110,93 +3128,93 @@ static int mpeg_decode_frame(AVCodecContext *avctx, av_log(avctx, AV_LOG_DEBUG, "%3X at %zd left %d\n", start_code, buf_ptr-buf, input_size); } - /* prepare data for next start code */ - switch(start_code) { - case SEQ_START_CODE: - mpeg1_decode_sequence(avctx, buf_ptr, - input_size); - break; + /* prepare data for next start code */ + switch(start_code) { + case SEQ_START_CODE: + mpeg1_decode_sequence(avctx, buf_ptr, + input_size); + break; - case PICTURE_START_CODE: - /* we have a complete image : we try to decompress it */ - mpeg1_decode_picture(avctx, - buf_ptr, input_size); - break; - case EXT_START_CODE: - mpeg_decode_extension(avctx, - buf_ptr, input_size); - break; - case USER_START_CODE: - mpeg_decode_user_data(avctx, - buf_ptr, input_size); - break; - case GOP_START_CODE: - s2->first_field=0; - mpeg_decode_gop(avctx, - buf_ptr, input_size); + case PICTURE_START_CODE: + /* we have a complete image : we try to decompress it */ + mpeg1_decode_picture(avctx, + buf_ptr, input_size); + break; + case EXT_START_CODE: + mpeg_decode_extension(avctx, + buf_ptr, input_size); + break; + case USER_START_CODE: + mpeg_decode_user_data(avctx, + buf_ptr, input_size); + break; + case GOP_START_CODE: + s2->first_field=0; + mpeg_decode_gop(avctx, + buf_ptr, input_size); + break; + default: + if (start_code >= SLICE_MIN_START_CODE && + start_code <= SLICE_MAX_START_CODE) { + int mb_y= start_code - SLICE_MIN_START_CODE; + + if(s2->last_picture_ptr==NULL){ + /* skip b frames if we dont have reference frames */ + if(s2->pict_type==B_TYPE) break; + /* skip P frames if we dont have reference frame no valid header */ +// if(s2->pict_type==P_TYPE && s2->first_field && !s2->first_slice) break; + } + /* skip b frames if we are in a hurry */ + if(avctx->hurry_up && s2->pict_type==B_TYPE) break; + if( (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==B_TYPE) + ||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=I_TYPE) + || avctx->skip_frame >= AVDISCARD_ALL) break; - default: - if (start_code >= SLICE_MIN_START_CODE && - start_code <= SLICE_MAX_START_CODE) { - int mb_y= start_code - SLICE_MIN_START_CODE; - - if(s2->last_picture_ptr==NULL){ - /* skip b frames if we dont have reference frames */ - if(s2->pict_type==B_TYPE) break; - /* skip P frames if we dont have reference frame no valid header */ -// if(s2->pict_type==P_TYPE && s2->first_field && !s2->first_slice) break; - } - /* skip b frames if we are in a hurry */ - if(avctx->hurry_up && s2->pict_type==B_TYPE) break; - if( (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==B_TYPE) - ||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=I_TYPE) - || avctx->skip_frame >= AVDISCARD_ALL) - break; - /* skip everything if we are in a hurry>=5 */ - if(avctx->hurry_up>=5) break; - - if (!s->mpeg_enc_ctx_allocated) break; - - if(s2->codec_id == CODEC_ID_MPEG2VIDEO){ - if(mb_y < avctx->skip_top || mb_y >= s2->mb_height - avctx->skip_bottom) - break; - } + /* skip everything if we are in a hurry>=5 */ + if(avctx->hurry_up>=5) break; - if(s2->first_slice){ - s2->first_slice=0; - if(mpeg_field_start(s2) < 0) - return -1; - } + if (!s->mpeg_enc_ctx_allocated) break; - if(avctx->thread_count > 1){ - int threshold= (s2->mb_height*s->slice_count + avctx->thread_count/2) / avctx->thread_count; - if(threshold <= mb_y){ - MpegEncContext *thread_context= s2->thread_context[s->slice_count]; + if(s2->codec_id == CODEC_ID_MPEG2VIDEO){ + if(mb_y < avctx->skip_top || mb_y >= s2->mb_height - avctx->skip_bottom) + break; + } - thread_context->start_mb_y= mb_y; - thread_context->end_mb_y = s2->mb_height; - if(s->slice_count){ - s2->thread_context[s->slice_count-1]->end_mb_y= mb_y; - ff_update_duplicate_context(thread_context, s2); - } - init_get_bits(&thread_context->gb, buf_ptr, input_size*8); - s->slice_count++; - } - buf_ptr += 2; //FIXME add minimum num of bytes per slice - }else{ - ret = mpeg_decode_slice(s, mb_y, &buf_ptr, input_size); - emms_c(); - - if(ret < 0){ - if(s2->resync_mb_x>=0 && s2->resync_mb_y>=0) - ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x, s2->mb_y, AC_ERROR|DC_ERROR|MV_ERROR); - }else{ - ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x-1, s2->mb_y, AC_END|DC_END|MV_END); - } + if(s2->first_slice){ + s2->first_slice=0; + if(mpeg_field_start(s2) < 0) + return -1; + } + + if(avctx->thread_count > 1){ + int threshold= (s2->mb_height*s->slice_count + avctx->thread_count/2) / avctx->thread_count; + if(threshold <= mb_y){ + MpegEncContext *thread_context= s2->thread_context[s->slice_count]; + + thread_context->start_mb_y= mb_y; + thread_context->end_mb_y = s2->mb_height; + if(s->slice_count){ + s2->thread_context[s->slice_count-1]->end_mb_y= mb_y; + ff_update_duplicate_context(thread_context, s2); } + init_get_bits(&thread_context->gb, buf_ptr, input_size*8); + s->slice_count++; + } + buf_ptr += 2; //FIXME add minimum num of bytes per slice + }else{ + ret = mpeg_decode_slice(s, mb_y, &buf_ptr, input_size); + emms_c(); + + if(ret < 0){ + if(s2->resync_mb_x>=0 && s2->resync_mb_y>=0) + ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x, s2->mb_y, AC_ERROR|DC_ERROR|MV_ERROR); + }else{ + ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x-1, s2->mb_y, AC_END|DC_END|MV_END); } - break; } + } + break; + } } } @@ -3313,6 +3331,169 @@ AVCodec mpeg_xvmc_decoder = { #endif +#ifdef CONFIG_MPEGVIDEO_PARSER +static void mpegvideo_extract_headers(AVCodecParserContext *s, + AVCodecContext *avctx, + const uint8_t *buf, int buf_size) +{ + ParseContext1 *pc = s->priv_data; + const uint8_t *buf_end; + uint32_t start_code; + int frame_rate_index, ext_type, bytes_left; + int frame_rate_ext_n, frame_rate_ext_d; + int picture_structure, top_field_first, repeat_first_field, progressive_frame; + int horiz_size_ext, vert_size_ext, bit_rate_ext; +//FIXME replace the crap with get_bits() + s->repeat_pict = 0; + buf_end = buf + buf_size; + while (buf < buf_end) { + start_code= -1; + buf= ff_find_start_code(buf, buf_end, &start_code); + bytes_left = buf_end - buf; + switch(start_code) { + case PICTURE_START_CODE: + if (bytes_left >= 2) { + s->pict_type = (buf[1] >> 3) & 7; + } + break; + case SEQ_START_CODE: + if (bytes_left >= 7) { + pc->width = (buf[0] << 4) | (buf[1] >> 4); + pc->height = ((buf[1] & 0x0f) << 8) | buf[2]; + avcodec_set_dimensions(avctx, pc->width, pc->height); + frame_rate_index = buf[3] & 0xf; + pc->frame_rate.den = avctx->time_base.den = ff_frame_rate_tab[frame_rate_index].num; + pc->frame_rate.num = avctx->time_base.num = ff_frame_rate_tab[frame_rate_index].den; + avctx->bit_rate = ((buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6))*400; + avctx->codec_id = CODEC_ID_MPEG1VIDEO; + avctx->sub_id = 1; + } + break; + case EXT_START_CODE: + if (bytes_left >= 1) { + ext_type = (buf[0] >> 4); + switch(ext_type) { + case 0x1: /* sequence extension */ + if (bytes_left >= 6) { + horiz_size_ext = ((buf[1] & 1) << 1) | (buf[2] >> 7); + vert_size_ext = (buf[2] >> 5) & 3; + bit_rate_ext = ((buf[2] & 0x1F)<<7) | (buf[3]>>1); + frame_rate_ext_n = (buf[5] >> 5) & 3; + frame_rate_ext_d = (buf[5] & 0x1f); + pc->progressive_sequence = buf[1] & (1 << 3); + avctx->has_b_frames= !(buf[5] >> 7); + + pc->width |=(horiz_size_ext << 12); + pc->height |=( vert_size_ext << 12); + avctx->bit_rate += (bit_rate_ext << 18) * 400; + avcodec_set_dimensions(avctx, pc->width, pc->height); + avctx->time_base.den = pc->frame_rate.den * (frame_rate_ext_n + 1); + avctx->time_base.num = pc->frame_rate.num * (frame_rate_ext_d + 1); + avctx->codec_id = CODEC_ID_MPEG2VIDEO; + avctx->sub_id = 2; /* forces MPEG2 */ + } + break; + case 0x8: /* picture coding extension */ + if (bytes_left >= 5) { + picture_structure = buf[2]&3; + top_field_first = buf[3] & (1 << 7); + repeat_first_field = buf[3] & (1 << 1); + progressive_frame = buf[4] & (1 << 7); + + /* check if we must repeat the frame */ + if (repeat_first_field) { + if (pc->progressive_sequence) { + if (top_field_first) + s->repeat_pict = 4; + else + s->repeat_pict = 2; + } else if (progressive_frame) { + s->repeat_pict = 1; + } + } + + /* the packet only represents half a frame + XXX,FIXME maybe find a different solution */ + if(picture_structure != 3) + s->repeat_pict = -1; + } + break; + } + } + break; + case -1: + goto the_end; + default: + /* we stop parsing when we encounter a slice. It ensures + that this function takes a negligible amount of time */ + if (start_code >= SLICE_MIN_START_CODE && + start_code <= SLICE_MAX_START_CODE) + goto the_end; + break; + } + } + the_end: ; +} + +static int mpegvideo_parse(AVCodecParserContext *s, + AVCodecContext *avctx, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size) +{ + ParseContext1 *pc1 = s->priv_data; + ParseContext *pc= &pc1->pc; + int next; + + if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){ + next= buf_size; + }else{ + next= mpeg1_find_frame_end(pc, buf, buf_size); + + if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) { + *poutbuf = NULL; + *poutbuf_size = 0; + return buf_size; + } + + } + /* we have a full frame : we just parse the first few MPEG headers + to have the full timing information. The time take by this + function should be negligible for uncorrupted streams */ + mpegvideo_extract_headers(s, avctx, buf, buf_size); +#if 0 + printf("pict_type=%d frame_rate=%0.3f repeat_pict=%d\n", + s->pict_type, (double)avctx->time_base.den / avctx->time_base.num, s->repeat_pict); +#endif + + *poutbuf = (uint8_t *)buf; + *poutbuf_size = buf_size; + return next; +} + +static int mpegvideo_split(AVCodecContext *avctx, + const uint8_t *buf, int buf_size) +{ + int i; + uint32_t state= -1; + + for(i=0; i= 0x100) + return i-3; + } + return 0; +} + +AVCodecParser mpegvideo_parser = { + { CODEC_ID_MPEG1VIDEO, CODEC_ID_MPEG2VIDEO }, + sizeof(ParseContext1), + NULL, + mpegvideo_parse, + ff_parse1_close, + mpegvideo_split, +}; +#endif /* !CONFIG_MPEGVIDEO_PARSER */ + /* this is ugly i know, but the alternative is too make hundreds of vars global and prefix them with ff_mpeg1_ which is far uglier. */ diff --git a/src/libffmpeg/libavcodec/mpeg12data.h b/src/libffmpeg/libavcodec/mpeg12data.h index e9a10ff3a..6c96a495b 100644 --- a/src/libffmpeg/libavcodec/mpeg12data.h +++ b/src/libffmpeg/libavcodec/mpeg12data.h @@ -1,9 +1,31 @@ +/* + * MPEG1 codec / MPEG2 decoder + * copyright (c) 2000,2001 Fabrice Bellard + * copyright (c) 2002-2004 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + /** * @file mpeg12data.h * MPEG1/2 tables. */ -const int16_t ff_mpeg1_default_intra_matrix[64] = { +const uint16_t ff_mpeg1_default_intra_matrix[64] = { 8, 16, 19, 22, 26, 27, 29, 34, 16, 16, 22, 24, 27, 29, 34, 37, 19, 22, 26, 27, 29, 34, 34, 38, @@ -14,7 +36,7 @@ const int16_t ff_mpeg1_default_intra_matrix[64] = { 27, 29, 35, 38, 46, 56, 69, 83 }; -const int16_t ff_mpeg1_default_non_intra_matrix[64] = { +const uint16_t ff_mpeg1_default_non_intra_matrix[64] = { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, @@ -32,10 +54,10 @@ static const unsigned char vlc_dc_lum_bits[12] = { 3, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9, }; -const uint16_t vlc_dc_chroma_code[12] = { +static const uint16_t vlc_dc_chroma_code[12] = { 0x0, 0x1, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x3fe, 0x3ff, }; -const unsigned char vlc_dc_chroma_bits[12] = { +static const unsigned char vlc_dc_chroma_bits[12] = { 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, }; @@ -367,7 +389,7 @@ const uint8_t ff_mpeg1_dc_scale_table[128]={ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; -const static uint8_t mpeg2_dc_scale_table1[128]={ +static const uint8_t mpeg2_dc_scale_table1[128]={ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, diff --git a/src/libffmpeg/libavcodec/mpeg4data.h b/src/libffmpeg/libavcodec/mpeg4data.h index 804d2ded8..e199c6a14 100644 --- a/src/libffmpeg/libavcodec/mpeg4data.h +++ b/src/libffmpeg/libavcodec/mpeg4data.h @@ -1,3 +1,25 @@ +/* + * copyright (c) 2000,2001 Fabrice Bellard + * H263+ support + * copyright (c) 2002-2004 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + /** * @file mpeg4data.h * mpeg4 tables. diff --git a/src/libffmpeg/libavcodec/mpegaudio.h b/src/libffmpeg/libavcodec/mpegaudio.h index 0ee58240c..3eadf92a8 100644 --- a/src/libffmpeg/libavcodec/mpegaudio.h +++ b/src/libffmpeg/libavcodec/mpegaudio.h @@ -1,3 +1,23 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + /** * @file mpegaudio.h * mpeg audio declarations for both encoder and decoder. @@ -52,7 +72,7 @@ typedef int32_t MPA_INT; #endif int l2_select_table(int bitrate, int nb_channels, int freq, int lsf); -int mpa_decode_header(AVCodecContext *avctx, uint32_t head); +int mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate); void ff_mpa_synth_init(MPA_INT *window); void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, MPA_INT *window, int *dither_state, diff --git a/src/libffmpeg/libavcodec/mpegaudiodec.c b/src/libffmpeg/libavcodec/mpegaudiodec.c index 0d82e3e98..54bcee3b0 100644 --- a/src/libffmpeg/libavcodec/mpegaudiodec.c +++ b/src/libffmpeg/libavcodec/mpegaudiodec.c @@ -2,18 +2,20 @@ * MPEG Audio decoder * Copyright (c) 2001, 2002 Fabrice Bellard. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -36,40 +38,34 @@ /* define USE_HIGHPRECISION to have a bit exact (but slower) mpeg audio decoder */ #ifdef CONFIG_MPEGAUDIO_HP -#define USE_HIGHPRECISION +# define USE_HIGHPRECISION #endif #include "mpegaudio.h" +#include "mathops.h" + #define FRAC_ONE (1 << FRAC_BITS) -#define MULL(a,b) (((int64_t)(a) * (int64_t)(b)) >> FRAC_BITS) -#define MUL64(a,b) ((int64_t)(a) * (int64_t)(b)) #define FIX(a) ((int)((a) * FRAC_ONE)) /* WARNING: only correct for posititive numbers */ #define FIXR(a) ((int)((a) * FRAC_ONE + 0.5)) #define FRAC_RND(a) (((a) + (FRAC_ONE/2)) >> FRAC_BITS) #define FIXHR(a) ((int)((a) * (1LL<<32) + 0.5)) -//#define MULH(a,b) (((int64_t)(a) * (int64_t)(b))>>32) //gcc 3.4 creates an incredibly bloated mess out of this -static always_inline int MULH(int a, int b){ - return ((int64_t)(a) * (int64_t)(b))>>32; -} /****************/ #define HEADER_SIZE 4 #define BACKSTEP_SIZE 512 +#define EXTRABYTES 24 struct GranuleDef; typedef struct MPADecodeContext { - uint8_t inbuf1[2][MPA_MAX_CODED_FRAME_SIZE + BACKSTEP_SIZE]; /* input buffer */ - int inbuf_index; - uint8_t *inbuf_ptr, *inbuf; + DECLARE_ALIGNED_8(uint8_t, last_buf[2*BACKSTEP_SIZE + EXTRABYTES]); + int last_buf_size; int frame_size; - int free_format_frame_size; /* frame size in case of free format - (zero if currently unknown) */ /* next header (used in free format parsing) */ uint32_t free_format_next_header; int error_protection; @@ -77,8 +73,8 @@ typedef struct MPADecodeContext { int sample_rate; int sample_rate_index; /* between 0 and 8 */ int bit_rate; - int old_frame_size; GetBitContext gb; + GetBitContext in_gb; int nb_channels; int mode; int mode_ext; @@ -92,7 +88,8 @@ typedef struct MPADecodeContext { #endif void (*compute_antialias)(struct MPADecodeContext *s, struct GranuleDef *g); int adu_mode; ///< 0 for standard mp3, 1 for adu formatted mp3 - unsigned int dither_state; + int dither_state; + int error_resilience; } MPADecodeContext; /** @@ -141,7 +138,6 @@ static void compute_antialias_float(MPADecodeContext *s, GranuleDef *g); /* vlc structure for decoding layer 3 huffman tables */ static VLC huff_vlc[16]; -static uint8_t *huff_code_table[16]; static VLC huff_quad_vlc[2]; /* computed from band_size_long */ static uint16_t band_index_long[9][23]; @@ -149,6 +145,8 @@ static uint16_t band_index_long[9][23]; #define TABLE_4_3_SIZE (8191 + 16)*4 static int8_t *table_4_3_exp; static uint32_t *table_4_3_value; +static uint32_t exp_table[512]; +static uint32_t expval_table[512][16]; /* intensity stereo coef table */ static int32_t is_table[2][16]; static int32_t is_table_lsf[2][2][16]; @@ -171,7 +169,6 @@ static const int32_t scale_factor_mult2[3][3] = { SCALE_GEN(4.0 / 9.0), /* 9 steps */ }; -void ff_mpa_synth_init(MPA_INT *window); static MPA_INT window[512] __attribute__((aligned(16))); /* layer 1 unscaling */ @@ -309,6 +306,7 @@ static int decode_init(AVCodecContext * avctx) #else avctx->sample_fmt= SAMPLE_FMT_S16; #endif + s->error_resilience= avctx->error_resilience; if(avctx->antialias_algo != FF_AA_FLOAT) s->compute_antialias= compute_antialias_integer; @@ -343,26 +341,30 @@ static int decode_init(AVCodecContext * avctx) ff_mpa_synth_init(window); /* huffman decode tables */ - huff_code_table[0] = NULL; for(i=1;i<16;i++) { const HuffTable *h = &mpa_huff_tables[i]; int xsize, x, y; unsigned int n; - uint8_t *code_table; + uint8_t tmp_bits [512]; + uint16_t tmp_codes[512]; + + memset(tmp_bits , 0, sizeof(tmp_bits )); + memset(tmp_codes, 0, sizeof(tmp_codes)); xsize = h->xsize; n = xsize * xsize; - /* XXX: fail test */ - init_vlc(&huff_vlc[i], 8, n, - h->bits, 1, 1, h->codes, 2, 2, 1); - code_table = av_mallocz(n); j = 0; for(x=0;xbits [j ]; + tmp_codes[(x << 5) | y | ((x&&y)<<4)]= h->codes[j++]; + } } - huff_code_table[i] = code_table; + + /* XXX: fail test */ + init_vlc(&huff_vlc[i], 7, 512, + tmp_bits, 1, 1, tmp_codes, 2, 2, 1); } for(i=0;i<2;i++) { init_vlc(&huff_quad_vlc[i], i == 0 ? 7 : 4, 16, @@ -393,13 +395,20 @@ static int decode_init(AVCodecContext * avctx) f = pow((double)(i/4), 4.0 / 3.0) * pow(2, (i&3)*0.25); fm = frexp(f, &e); m = (uint32_t)(fm*(1LL<<31) + 0.5); - e+= FRAC_BITS - 31 + 5; + e+= FRAC_BITS - 31 + 5 - 100; /* normalized to FRAC_BITS */ table_4_3_value[i] = m; // av_log(NULL, AV_LOG_DEBUG, "%d %d %f\n", i, m, pow((double)i, 4.0 / 3.0)); table_4_3_exp[i] = -e; } + for(i=0; i<512*16; i++){ + int exponent= (i>>4); + double f= pow(i&15, 4.0 / 3.0) * pow(2, (exponent-400)*0.25 + FRAC_BITS + 5); + expval_table[exponent][i&15]= llrint(f); + if((i&15)==1) + exp_table[exponent]= llrint(f); + } for(i=0;i<7;i++) { float f; @@ -498,9 +507,6 @@ static int decode_init(AVCodecContext * avctx) init = 1; } - s->inbuf_index = 0; - s->inbuf = &s->inbuf1[s->inbuf_index][BACKSTEP_SIZE]; - s->inbuf_ptr = s->inbuf; #ifdef DEBUG s->frame_count = 0; #endif @@ -513,62 +519,62 @@ static int decode_init(AVCodecContext * avctx) /* cos(i*pi/64) */ -#define COS0_0 FIXR(0.50060299823519630134) -#define COS0_1 FIXR(0.50547095989754365998) -#define COS0_2 FIXR(0.51544730992262454697) -#define COS0_3 FIXR(0.53104259108978417447) -#define COS0_4 FIXR(0.55310389603444452782) -#define COS0_5 FIXR(0.58293496820613387367) -#define COS0_6 FIXR(0.62250412303566481615) -#define COS0_7 FIXR(0.67480834145500574602) -#define COS0_8 FIXR(0.74453627100229844977) -#define COS0_9 FIXR(0.83934964541552703873) -#define COS0_10 FIXR(0.97256823786196069369) -#define COS0_11 FIXR(1.16943993343288495515) -#define COS0_12 FIXR(1.48416461631416627724) -#define COS0_13 FIXR(2.05778100995341155085) -#define COS0_14 FIXR(3.40760841846871878570) -#define COS0_15 FIXR(10.19000812354805681150) - -#define COS1_0 FIXR(0.50241928618815570551) -#define COS1_1 FIXR(0.52249861493968888062) -#define COS1_2 FIXR(0.56694403481635770368) -#define COS1_3 FIXR(0.64682178335999012954) -#define COS1_4 FIXR(0.78815462345125022473) -#define COS1_5 FIXR(1.06067768599034747134) -#define COS1_6 FIXR(1.72244709823833392782) -#define COS1_7 FIXR(5.10114861868916385802) - -#define COS2_0 FIXR(0.50979557910415916894) -#define COS2_1 FIXR(0.60134488693504528054) -#define COS2_2 FIXR(0.89997622313641570463) -#define COS2_3 FIXR(2.56291544774150617881) - -#define COS3_0 FIXR(0.54119610014619698439) -#define COS3_1 FIXR(1.30656296487637652785) - -#define COS4_0 FIXR(0.70710678118654752439) +#define COS0_0 FIXHR(0.50060299823519630134/2) +#define COS0_1 FIXHR(0.50547095989754365998/2) +#define COS0_2 FIXHR(0.51544730992262454697/2) +#define COS0_3 FIXHR(0.53104259108978417447/2) +#define COS0_4 FIXHR(0.55310389603444452782/2) +#define COS0_5 FIXHR(0.58293496820613387367/2) +#define COS0_6 FIXHR(0.62250412303566481615/2) +#define COS0_7 FIXHR(0.67480834145500574602/2) +#define COS0_8 FIXHR(0.74453627100229844977/2) +#define COS0_9 FIXHR(0.83934964541552703873/2) +#define COS0_10 FIXHR(0.97256823786196069369/2) +#define COS0_11 FIXHR(1.16943993343288495515/4) +#define COS0_12 FIXHR(1.48416461631416627724/4) +#define COS0_13 FIXHR(2.05778100995341155085/8) +#define COS0_14 FIXHR(3.40760841846871878570/8) +#define COS0_15 FIXHR(10.19000812354805681150/32) + +#define COS1_0 FIXHR(0.50241928618815570551/2) +#define COS1_1 FIXHR(0.52249861493968888062/2) +#define COS1_2 FIXHR(0.56694403481635770368/2) +#define COS1_3 FIXHR(0.64682178335999012954/2) +#define COS1_4 FIXHR(0.78815462345125022473/2) +#define COS1_5 FIXHR(1.06067768599034747134/4) +#define COS1_6 FIXHR(1.72244709823833392782/4) +#define COS1_7 FIXHR(5.10114861868916385802/16) + +#define COS2_0 FIXHR(0.50979557910415916894/2) +#define COS2_1 FIXHR(0.60134488693504528054/2) +#define COS2_2 FIXHR(0.89997622313641570463/2) +#define COS2_3 FIXHR(2.56291544774150617881/8) + +#define COS3_0 FIXHR(0.54119610014619698439/2) +#define COS3_1 FIXHR(1.30656296487637652785/4) + +#define COS4_0 FIXHR(0.70710678118654752439/2) /* butterfly operator */ -#define BF(a, b, c)\ +#define BF(a, b, c, s)\ {\ tmp0 = tab[a] + tab[b];\ tmp1 = tab[a] - tab[b];\ tab[a] = tmp0;\ - tab[b] = MULL(tmp1, c);\ + tab[b] = MULH(tmp1<<(s), c);\ } #define BF1(a, b, c, d)\ {\ - BF(a, b, COS4_0);\ - BF(c, d, -COS4_0);\ + BF(a, b, COS4_0, 1);\ + BF(c, d,-COS4_0, 1);\ tab[c] += tab[d];\ } #define BF2(a, b, c, d)\ {\ - BF(a, b, COS4_0);\ - BF(c, d, -COS4_0);\ + BF(a, b, COS4_0, 1);\ + BF(c, d,-COS4_0, 1);\ tab[c] += tab[d];\ tab[a] += tab[c];\ tab[c] += tab[b];\ @@ -583,92 +589,100 @@ static void dct32(int32_t *out, int32_t *tab) int tmp0, tmp1; /* pass 1 */ - BF(0, 31, COS0_0); - BF(1, 30, COS0_1); - BF(2, 29, COS0_2); - BF(3, 28, COS0_3); - BF(4, 27, COS0_4); - BF(5, 26, COS0_5); - BF(6, 25, COS0_6); - BF(7, 24, COS0_7); - BF(8, 23, COS0_8); - BF(9, 22, COS0_9); - BF(10, 21, COS0_10); - BF(11, 20, COS0_11); - BF(12, 19, COS0_12); - BF(13, 18, COS0_13); - BF(14, 17, COS0_14); - BF(15, 16, COS0_15); - + BF( 0, 31, COS0_0 , 1); + BF(15, 16, COS0_15, 5); /* pass 2 */ - BF(0, 15, COS1_0); - BF(1, 14, COS1_1); - BF(2, 13, COS1_2); - BF(3, 12, COS1_3); - BF(4, 11, COS1_4); - BF(5, 10, COS1_5); - BF(6, 9, COS1_6); - BF(7, 8, COS1_7); - - BF(16, 31, -COS1_0); - BF(17, 30, -COS1_1); - BF(18, 29, -COS1_2); - BF(19, 28, -COS1_3); - BF(20, 27, -COS1_4); - BF(21, 26, -COS1_5); - BF(22, 25, -COS1_6); - BF(23, 24, -COS1_7); - + BF( 0, 15, COS1_0 , 1); + BF(16, 31,-COS1_0 , 1); + /* pass 1 */ + BF( 7, 24, COS0_7 , 1); + BF( 8, 23, COS0_8 , 1); + /* pass 2 */ + BF( 7, 8, COS1_7 , 4); + BF(23, 24,-COS1_7 , 4); /* pass 3 */ - BF(0, 7, COS2_0); - BF(1, 6, COS2_1); - BF(2, 5, COS2_2); - BF(3, 4, COS2_3); - - BF(8, 15, -COS2_0); - BF(9, 14, -COS2_1); - BF(10, 13, -COS2_2); - BF(11, 12, -COS2_3); - - BF(16, 23, COS2_0); - BF(17, 22, COS2_1); - BF(18, 21, COS2_2); - BF(19, 20, COS2_3); - - BF(24, 31, -COS2_0); - BF(25, 30, -COS2_1); - BF(26, 29, -COS2_2); - BF(27, 28, -COS2_3); - + BF( 0, 7, COS2_0 , 1); + BF( 8, 15,-COS2_0 , 1); + BF(16, 23, COS2_0 , 1); + BF(24, 31,-COS2_0 , 1); + /* pass 1 */ + BF( 3, 28, COS0_3 , 1); + BF(12, 19, COS0_12, 2); + /* pass 2 */ + BF( 3, 12, COS1_3 , 1); + BF(19, 28,-COS1_3 , 1); + /* pass 1 */ + BF( 4, 27, COS0_4 , 1); + BF(11, 20, COS0_11, 2); + /* pass 2 */ + BF( 4, 11, COS1_4 , 1); + BF(20, 27,-COS1_4 , 1); + /* pass 3 */ + BF( 3, 4, COS2_3 , 3); + BF(11, 12,-COS2_3 , 3); + BF(19, 20, COS2_3 , 3); + BF(27, 28,-COS2_3 , 3); /* pass 4 */ - BF(0, 3, COS3_0); - BF(1, 2, COS3_1); - - BF(4, 7, -COS3_0); - BF(5, 6, -COS3_1); - - BF(8, 11, COS3_0); - BF(9, 10, COS3_1); + BF( 0, 3, COS3_0 , 1); + BF( 4, 7,-COS3_0 , 1); + BF( 8, 11, COS3_0 , 1); + BF(12, 15,-COS3_0 , 1); + BF(16, 19, COS3_0 , 1); + BF(20, 23,-COS3_0 , 1); + BF(24, 27, COS3_0 , 1); + BF(28, 31,-COS3_0 , 1); - BF(12, 15, -COS3_0); - BF(13, 14, -COS3_1); - BF(16, 19, COS3_0); - BF(17, 18, COS3_1); - BF(20, 23, -COS3_0); - BF(21, 22, -COS3_1); - - BF(24, 27, COS3_0); - BF(25, 26, COS3_1); + /* pass 1 */ + BF( 1, 30, COS0_1 , 1); + BF(14, 17, COS0_14, 3); + /* pass 2 */ + BF( 1, 14, COS1_1 , 1); + BF(17, 30,-COS1_1 , 1); + /* pass 1 */ + BF( 6, 25, COS0_6 , 1); + BF( 9, 22, COS0_9 , 1); + /* pass 2 */ + BF( 6, 9, COS1_6 , 2); + BF(22, 25,-COS1_6 , 2); + /* pass 3 */ + BF( 1, 6, COS2_1 , 1); + BF( 9, 14,-COS2_1 , 1); + BF(17, 22, COS2_1 , 1); + BF(25, 30,-COS2_1 , 1); - BF(28, 31, -COS3_0); - BF(29, 30, -COS3_1); + /* pass 1 */ + BF( 2, 29, COS0_2 , 1); + BF(13, 18, COS0_13, 3); + /* pass 2 */ + BF( 2, 13, COS1_2 , 1); + BF(18, 29,-COS1_2 , 1); + /* pass 1 */ + BF( 5, 26, COS0_5 , 1); + BF(10, 21, COS0_10, 1); + /* pass 2 */ + BF( 5, 10, COS1_5 , 2); + BF(21, 26,-COS1_5 , 2); + /* pass 3 */ + BF( 2, 5, COS2_2 , 1); + BF(10, 13,-COS2_2 , 1); + BF(18, 21, COS2_2 , 1); + BF(26, 29,-COS2_2 , 1); + /* pass 4 */ + BF( 1, 2, COS3_1 , 2); + BF( 5, 6,-COS3_1 , 2); + BF( 9, 10, COS3_1 , 2); + BF(13, 14,-COS3_1 , 2); + BF(17, 18, COS3_1 , 2); + BF(21, 22,-COS3_1 , 2); + BF(25, 26, COS3_1 , 2); + BF(29, 30,-COS3_1 , 2); /* pass 5 */ - BF1(0, 1, 2, 3); - BF2(4, 5, 6, 7); - BF1(8, 9, 10, 11); + BF1( 0, 1, 2, 3); + BF2( 4, 5, 6, 7); + BF1( 8, 9, 10, 11); BF2(12, 13, 14, 15); BF1(16, 17, 18, 19); BF2(20, 21, 22, 23); @@ -742,25 +756,11 @@ static inline int round_sample(int *sum) return sum1; } -#if defined(ARCH_POWERPC_405) - /* signed 16x16 -> 32 multiply add accumulate */ -#define MACS(rt, ra, rb) \ - asm ("maclhw %0, %2, %3" : "=r" (rt) : "0" (rt), "r" (ra), "r" (rb)); +#define MACS(rt, ra, rb) MAC16(rt, ra, rb) /* signed 16x16 -> 32 multiply */ -#define MULS(ra, rb) \ - ({ int __rt; asm ("mullhw %0, %1, %2" : "=r" (__rt) : "r" (ra), "r" (rb)); __rt; }) - -#else - -/* signed 16x16 -> 32 multiply add accumulate */ -#define MACS(rt, ra, rb) rt += (ra) * (rb) - -/* signed 16x16 -> 32 multiply */ -#define MULS(ra, rb) ((ra) * (rb)) - -#endif +#define MULS(ra, rb) MUL16(ra, rb) #else @@ -776,8 +776,7 @@ static inline int round_sample(int64_t *sum) return sum1; } -#define MULS(ra, rb) MUL64(ra, rb) - +# define MULS(ra, rb) MUL64(ra, rb) #endif #define SUM8(sum, op, w, p) \ @@ -934,6 +933,19 @@ static const int icos36[9] = { FIXR(5.73685662283492756461), }; +/* 0.5 / cos(pi*(2*i+1)/36) */ +static const int icos36h[9] = { + FIXHR(0.50190991877167369479/2), + FIXHR(0.51763809020504152469/2), //0 + FIXHR(0.55168895948124587824/2), + FIXHR(0.61038729438072803416/2), + FIXHR(0.70710678118654752439/2), //1 + FIXHR(0.87172339781054900991/2), + FIXHR(1.18310079157624925896/4), + FIXHR(1.93185165257813657349/4), //2 +// FIXHR(5.73685662283492756461), +}; + /* 12 points IMDCT. We compute it "by hand" by factorizing obvious cases. */ static void imdct12(int *out, int *in) @@ -950,10 +962,10 @@ static void imdct12(int *out, int *in) in3 += in1; in2= MULH(2*in2, C3); - in3= MULH(2*in3, C3); + in3= MULH(4*in3, C3); t1 = in0 - in4; - t2 = MULL(in1 - in5, icos36[4]); + t2 = MULH(2*(in1 - in5), icos36h[4]); out[ 7]= out[10]= t1 + t2; @@ -962,19 +974,19 @@ static void imdct12(int *out, int *in) in0 += in4>>1; in4 = in0 + in2; - in1 += in5>>1; - in5 = MULL(in1 + in3, icos36[1]); + in5 += 2*in1; + in1 = MULH(in5 + in3, icos36h[1]); out[ 8]= - out[ 9]= in4 + in5; + out[ 9]= in4 + in1; out[ 2]= - out[ 3]= in4 - in5; + out[ 3]= in4 - in1; in0 -= in2; - in1 = MULL(in1 - in3, icos36[7]); + in5 = MULH(2*(in5 - in3), icos36h[7]); out[ 0]= - out[ 5]= in0 - in1; + out[ 5]= in0 - in5; out[ 6]= - out[11]= in0 + in1; + out[11]= in0 + in5; } /* cos(pi*i/18) */ @@ -1068,7 +1080,7 @@ static void imdct36(int *out, int *buf, int *in, int *win) t2 = tmp[i + 1]; t3 = tmp[i + 3]; - s1 = MULL(t3 + t2, icos36[j]); + s1 = MULH(2*(t3 + t2), icos36h[j]); s3 = MULL(t3 - t2, icos36[8 - j]); t0 = s0 + s1; @@ -1088,7 +1100,7 @@ static void imdct36(int *out, int *buf, int *in, int *win) } s0 = tmp[16]; - s1 = MULL(tmp[17], icos36[4]); + s1 = MULH(2*tmp[17], icos36h[4]); t0 = s0 + s1; t1 = s0 - s1; out[(9 + 4)*SBLIMIT] = MULH(t1, win[9 + 4]) + buf[9 + 4]; @@ -1156,26 +1168,7 @@ static int decode_header(MPADecodeContext *s, uint32_t header) s->frame_size = frame_size; } else { /* if no frame size computed, signal it */ - if (!s->free_format_frame_size) - return 1; - /* free format: compute bitrate and real frame size from the - frame size we extracted by reading the bitstream */ - s->frame_size = s->free_format_frame_size; - switch(s->layer) { - case 1: - s->frame_size += padding * 4; - s->bit_rate = (s->frame_size * sample_rate) / 48000; - break; - case 2: - s->frame_size += padding; - s->bit_rate = (s->frame_size * sample_rate) / 144000; - break; - default: - case 3: - s->frame_size += padding; - s->bit_rate = (s->frame_size * (sample_rate << s->lsf)) / 144000; - break; - } + return 1; } #if defined(DEBUG) @@ -1199,10 +1192,9 @@ static int decode_header(MPADecodeContext *s, uint32_t header) /* useful helper to get mpeg audio stream infos. Return -1 if error in header, otherwise the coded frame size in bytes */ -int mpa_decode_header(AVCodecContext *avctx, uint32_t head) +int mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate) { MPADecodeContext s1, *s = &s1; - memset( s, 0, sizeof(MPADecodeContext) ); if (ff_mpa_check_header(head) != 0) return -1; @@ -1227,7 +1219,7 @@ int mpa_decode_header(AVCodecContext *avctx, uint32_t head) break; } - avctx->sample_rate = s->sample_rate; + *sample_rate = s->sample_rate; avctx->channels = s->nb_channels; avctx->bit_rate = s->bit_rate; avctx->sub_id = s->layer; @@ -1533,29 +1525,6 @@ static int mp_decode_layer2(MPADecodeContext *s) return 3 * 12; } -/* - * Seek back in the stream for backstep bytes (at most 511 bytes) - */ -static void seek_to_maindata(MPADecodeContext *s, unsigned int backstep) -{ - uint8_t *ptr; - - /* compute current position in stream */ - ptr = (uint8_t *)(s->gb.buffer + (get_bits_count(&s->gb)>>3)); - - /* copy old data before current one */ - ptr -= backstep; - memcpy(ptr, s->inbuf1[s->inbuf_index ^ 1] + - BACKSTEP_SIZE + s->old_frame_size - backstep, backstep); - /* init get bits again */ - init_get_bits(&s->gb, ptr, (s->frame_size + backstep)*8); - - /* prepare next buffer */ - s->inbuf_index ^= 1; - s->inbuf = &s->inbuf1[s->inbuf_index][BACKSTEP_SIZE]; - s->old_frame_size = s->frame_size; -} - static inline void lsf_sf_expand(int *slen, int sf, int n1, int n2, int n3) { @@ -1591,7 +1560,7 @@ static void exponents_from_scale_factors(MPADecodeContext *s, bstab = band_size_long[s->sample_rate_index]; pretab = mpa_pretab[g->preflag]; for(i=0;ilong_end;i++) { - v0 = gain - ((g->scale_factors[i] + pretab[i]) << shift); + v0 = gain - ((g->scale_factors[i] + pretab[i]) << shift) + 400; len = bstab[i]; for(j=len;j>0;j--) *exp_ptr++ = v0; @@ -1606,7 +1575,7 @@ static void exponents_from_scale_factors(MPADecodeContext *s, for(i=g->short_start;i<13;i++) { len = bstab[i]; for(l=0;l<3;l++) { - v0 = gains[l] - (g->scale_factors[k++] << shift); + v0 = gains[l] - (g->scale_factors[k++] << shift) + 400; for(j=len;j>0;j--) *exp_ptr++ = v0; } @@ -1624,17 +1593,18 @@ static inline int get_bitsz(GetBitContext *s, int n) } static int huffman_decode(MPADecodeContext *s, GranuleDef *g, - int16_t *exponents, int end_pos) + int16_t *exponents, int end_pos2) { int s_index; - int linbits, code, x, y, l, v, i, j, k, pos; - GetBitContext last_gb; + int i; + int last_pos, bits_left; VLC *vlc; - uint8_t *code_table; + int end_pos= FFMIN(end_pos2, s->gb.size_in_bits); /* low frequencies (called big values) */ s_index = 0; for(i=0;i<3;i++) { + int j, k, l, linbits; j = g->region_size[i]; if (j == 0) continue; @@ -1643,83 +1613,152 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g, l = mpa_huff_data[k][0]; linbits = mpa_huff_data[k][1]; vlc = &huff_vlc[l]; - code_table = huff_code_table[l]; + + if(!l){ + memset(&g->sb_hybrid[s_index], 0, sizeof(*g->sb_hybrid)*2*j); + s_index += 2*j; + continue; + } /* read huffcode and compute each couple */ for(;j>0;j--) { - if (get_bits_count(&s->gb) >= end_pos) - break; - if (code_table) { - code = get_vlc2(&s->gb, vlc->table, 8, 3); - if (code < 0) - return -1; - y = code_table[code]; - x = y >> 4; - y = y & 0x0f; - } else { - x = 0; - y = 0; + int exponent, x, y, v; + int pos= get_bits_count(&s->gb); + + if (pos >= end_pos){ +// av_log(NULL, AV_LOG_ERROR, "pos: %d %d %d %d\n", pos, end_pos, end_pos2, s_index); + if(s->in_gb.buffer && pos >= s->gb.size_in_bits){ + s->gb= s->in_gb; + s->in_gb.buffer=NULL; + assert((get_bits_count(&s->gb) & 7) == 0); + skip_bits_long(&s->gb, pos - end_pos); + end_pos2= + end_pos= end_pos2 + get_bits_count(&s->gb) - pos; + pos= get_bits_count(&s->gb); + } +// av_log(NULL, AV_LOG_ERROR, "new pos: %d %d\n", pos, end_pos); + if(pos >= end_pos) + break; } + y = get_vlc2(&s->gb, vlc->table, 7, 3); + + if(!y){ + g->sb_hybrid[s_index ] = + g->sb_hybrid[s_index+1] = 0; + s_index += 2; + continue; + } + + exponent= exponents[s_index]; + dprintf("region=%d n=%d x=%d y=%d exp=%d\n", - i, g->region_size[i] - j, x, y, exponents[s_index]); - if (x) { - if (x == 15) + i, g->region_size[i] - j, x, y, exponent); + if(y&16){ + x = y >> 5; + y = y & 0x0f; + if (x < 15){ + v = expval_table[ exponent ][ x ]; +// v = expval_table[ (exponent&3) ][ x ] >> FFMIN(0 - (exponent>>2), 31); + }else{ x += get_bitsz(&s->gb, linbits); - v = l3_unscale(x, exponents[s_index]); + v = l3_unscale(x, exponent); + } if (get_bits1(&s->gb)) v = -v; - } else { - v = 0; - } - g->sb_hybrid[s_index++] = v; - if (y) { - if (y == 15) + g->sb_hybrid[s_index] = v; + if (y < 15){ + v = expval_table[ exponent ][ y ]; + }else{ y += get_bitsz(&s->gb, linbits); - v = l3_unscale(y, exponents[s_index]); + v = l3_unscale(y, exponent); + } if (get_bits1(&s->gb)) v = -v; - } else { - v = 0; + g->sb_hybrid[s_index+1] = v; + }else{ + x = y >> 5; + y = y & 0x0f; + x += y; + if (x < 15){ + v = expval_table[ exponent ][ x ]; + }else{ + x += get_bitsz(&s->gb, linbits); + v = l3_unscale(x, exponent); + } + if (get_bits1(&s->gb)) + v = -v; + g->sb_hybrid[s_index+!!y] = v; + g->sb_hybrid[s_index+ !y] = 0; } - g->sb_hybrid[s_index++] = v; + s_index+=2; } } /* high frequencies */ vlc = &huff_quad_vlc[g->count1table_select]; - last_gb.buffer = NULL; + last_pos=0; while (s_index <= 572) { + int pos, code; pos = get_bits_count(&s->gb); if (pos >= end_pos) { - if (pos > end_pos && last_gb.buffer != NULL) { + if (pos > end_pos2 && last_pos){ /* some encoders generate an incorrect size for this part. We must go back into the data */ s_index -= 4; - s->gb = last_gb; + skip_bits_long(&s->gb, last_pos - pos); + av_log(NULL, AV_LOG_INFO, "overread, skip %d enddists: %d %d\n", last_pos - pos, end_pos-pos, end_pos2-pos); + if(s->error_resilience >= FF_ER_COMPLIANT) + s_index=0; + break; } - break; +// av_log(NULL, AV_LOG_ERROR, "pos2: %d %d %d %d\n", pos, end_pos, end_pos2, s_index); + if(s->in_gb.buffer && pos >= s->gb.size_in_bits){ + s->gb= s->in_gb; + s->in_gb.buffer=NULL; + assert((get_bits_count(&s->gb) & 7) == 0); + skip_bits_long(&s->gb, pos - end_pos); + end_pos2= + end_pos= end_pos2 + get_bits_count(&s->gb) - pos; + pos= get_bits_count(&s->gb); + } +// av_log(NULL, AV_LOG_ERROR, "new pos2: %d %d %d\n", pos, end_pos, s_index); + if(pos >= end_pos) + break; } - last_gb= s->gb; + last_pos= pos; - code = get_vlc2(&s->gb, vlc->table, vlc->bits, 2); + code = get_vlc2(&s->gb, vlc->table, vlc->bits, 1); dprintf("t=%d code=%d\n", g->count1table_select, code); - if (code < 0) - return -1; - for(i=0;i<4;i++) { - if (code & (8 >> i)) { - /* non zero value. Could use a hand coded function for - 'one' value */ - v = l3_unscale(1, exponents[s_index]); - if(get_bits1(&s->gb)) - v = -v; - } else { - v = 0; - } - g->sb_hybrid[s_index++] = v; + g->sb_hybrid[s_index+0]= + g->sb_hybrid[s_index+1]= + g->sb_hybrid[s_index+2]= + g->sb_hybrid[s_index+3]= 0; + while(code){ + const static int idxtab[16]={3,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0}; + int v; + int pos= s_index+idxtab[code]; + code ^= 8>>idxtab[code]; + v = exp_table[ exponents[pos] ]; +// v = exp_table[ (exponents[pos]&3) ] >> FFMIN(0 - (exponents[pos]>>2), 31); + if(get_bits1(&s->gb)) + v = -v; + g->sb_hybrid[pos] = v; } + s_index+=4; + } + /* skip extension bits */ + bits_left = end_pos - get_bits_count(&s->gb); +//av_log(NULL, AV_LOG_ERROR, "left:%d buf:%p\n", bits_left, s->in_gb.buffer); + if (bits_left < 0 || bits_left > 16) { + av_log(NULL, AV_LOG_ERROR, "bits_left=%d\n", bits_left); + s_index=0; + }else if(bits_left > 0 && s->error_resilience >= FF_ER_AGGRESSIVE){ + av_log(NULL, AV_LOG_ERROR, "bits_left=%d\n", bits_left); + s_index=0; } - while (s_index < 576) - g->sb_hybrid[s_index++] = 0; + memset(&g->sb_hybrid[s_index], 0, sizeof(*g->sb_hybrid)*(576 - s_index)); + skip_bits_long(&s->gb, bits_left); + return 0; } @@ -1728,7 +1767,7 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g, complicated */ static void reorder_block(MPADecodeContext *s, GranuleDef *g) { - int i, j, k, len; + int i, j, len; int32_t *ptr, *dst, *ptr1; int32_t tmp[576]; @@ -1748,14 +1787,15 @@ static void reorder_block(MPADecodeContext *s, GranuleDef *g) for(i=g->short_start;i<13;i++) { len = band_size_short[s->sample_rate_index][i]; ptr1 = ptr; - for(k=0;k<3;k++) { - dst = tmp + k; - for(j=len;j>0;j--) { - *dst = *ptr++; - dst += 3; - } + dst = tmp; + for(j=len;j>0;j--) { + *dst++ = ptr[0*len]; + *dst++ = ptr[1*len]; + *dst++ = ptr[2*len]; + ptr++; } - memcpy(ptr1, tmp, len * 3 * sizeof(int32_t)); + ptr+=2*len; + memcpy(ptr1, tmp, len * 3 * sizeof(*ptr1)); } } @@ -2104,17 +2144,14 @@ void sample_dump(int fnum, int32_t *tab, int n) static int mp_decode_layer3(MPADecodeContext *s) { int nb_granules, main_data_begin, private_bits; - int gr, ch, blocksplit_flag, i, j, k, n, bits_pos, bits_left; + int gr, ch, blocksplit_flag, i, j, k, n, bits_pos; GranuleDef granules[2][2], *g; int16_t exponents[576]; /* read side info */ if (s->lsf) { main_data_begin = get_bits(&s->gb, 8); - if (s->nb_channels == 2) - private_bits = get_bits(&s->gb, 2); - else - private_bits = get_bits(&s->gb, 1); + private_bits = get_bits(&s->gb, s->nb_channels); nb_granules = 1; } else { main_data_begin = get_bits(&s->gb, 9); @@ -2135,6 +2172,11 @@ static int mp_decode_layer3(MPADecodeContext *s) g = &granules[ch][gr]; g->part2_3_length = get_bits(&s->gb, 12); g->big_values = get_bits(&s->gb, 9); + if(g->big_values > 288){ + av_log(NULL, AV_LOG_ERROR, "big_values too big\n"); + return -1; + } + g->global_gain = get_bits(&s->gb, 8); /* if MS stereo only is selected, we precompute the 1/sqrt(2) renormalization factor */ @@ -2148,8 +2190,10 @@ static int mp_decode_layer3(MPADecodeContext *s) blocksplit_flag = get_bits(&s->gb, 1); if (blocksplit_flag) { g->block_type = get_bits(&s->gb, 2); - if (g->block_type == 0) + if (g->block_type == 0){ + av_log(NULL, AV_LOG_ERROR, "invalid block type\n"); return -1; + } g->switch_point = get_bits(&s->gb, 1); for(i=0;i<2;i++) g->table_select[i] = get_bits(&s->gb, 5); @@ -2192,9 +2236,7 @@ static int mp_decode_layer3(MPADecodeContext *s) g->region_size[2] = (576 / 2); j = 0; for(i=0;i<3;i++) { - k = g->region_size[i]; - if (k > g->big_values) - k = g->big_values; + k = FFMIN(g->region_size[i], g->big_values); g->region_size[i] = k - j; j = k; } @@ -2212,10 +2254,7 @@ static int mp_decode_layer3(MPADecodeContext *s) else g->long_end = 4; /* 8000 Hz */ - if (s->sample_rate_index != 8) - g->short_start = 3; - else - g->short_start = 2; + g->short_start = 2 + (s->sample_rate_index != 8); } else { g->long_end = 0; g->short_start = 0; @@ -2236,14 +2275,33 @@ static int mp_decode_layer3(MPADecodeContext *s) } if (!s->adu_mode) { + const uint8_t *ptr = s->gb.buffer + (get_bits_count(&s->gb)>>3); + assert((get_bits_count(&s->gb) & 7) == 0); /* now we get bits from the main_data_begin offset */ dprintf("seekback: %d\n", main_data_begin); - seek_to_maindata(s, main_data_begin); +//av_log(NULL, AV_LOG_ERROR, "backstep:%d, lastbuf:%d\n", main_data_begin, s->last_buf_size); + + memcpy(s->last_buf + s->last_buf_size, ptr, EXTRABYTES); + s->in_gb= s->gb; + init_get_bits(&s->gb, s->last_buf, s->last_buf_size*8); + skip_bits_long(&s->gb, 8*(s->last_buf_size - main_data_begin)); } for(gr=0;grnb_channels;ch++) { g = &granules[ch][gr]; + if(get_bits_count(&s->gb)<0){ + av_log(NULL, AV_LOG_ERROR, "mdb:%d, lastbuf:%d skiping granule %d\n", + main_data_begin, s->last_buf_size, gr); + skip_bits_long(&s->gb, g->part2_3_length); + memset(g->sb_hybrid, 0, sizeof(g->sb_hybrid)); + if(get_bits_count(&s->gb) >= s->gb.size_in_bits && s->in_gb.buffer){ + skip_bits_long(&s->in_gb, get_bits_count(&s->gb) - s->gb.size_in_bits); + s->gb= s->in_gb; + s->in_gb.buffer=NULL; + } + continue; + } bits_pos = get_bits_count(&s->gb); @@ -2258,12 +2316,22 @@ static int mp_decode_layer3(MPADecodeContext *s) if (g->block_type == 2) { n = g->switch_point ? 17 : 18; j = 0; - for(i=0;iscale_factors[j++] = get_bitsz(&s->gb, slen1); - for(i=0;i<18;i++) - g->scale_factors[j++] = get_bitsz(&s->gb, slen2); - for(i=0;i<3;i++) - g->scale_factors[j++] = 0; + if(slen1){ + for(i=0;iscale_factors[j++] = get_bits(&s->gb, slen1); + }else{ + for(i=0;iscale_factors[j++] = 0; + } + if(slen2){ + for(i=0;i<18;i++) + g->scale_factors[j++] = get_bits(&s->gb, slen2); + for(i=0;i<3;i++) + g->scale_factors[j++] = 0; + }else{ + for(i=0;i<21;i++) + g->scale_factors[j++] = 0; + } } else { sc = granules[ch][0].scale_factors; j = 0; @@ -2271,8 +2339,13 @@ static int mp_decode_layer3(MPADecodeContext *s) n = (k == 0 ? 6 : 5); if ((g->scfsi & (0x8 >> k)) == 0) { slen = (k < 2) ? slen1 : slen2; - for(i=0;iscale_factors[j++] = get_bitsz(&s->gb, slen); + if(slen){ + for(i=0;iscale_factors[j++] = get_bits(&s->gb, slen); + }else{ + for(i=0;iscale_factors[j++] = 0; + } } else { /* simply copy from last granule */ for(i=0;iscale_factors[j++] = get_bitsz(&s->gb, sl); + if(sl){ + for(i=0;iscale_factors[j++] = get_bits(&s->gb, sl); + }else{ + for(i=0;iscale_factors[j++] = 0; + } } /* XXX: should compute exact size */ for(;j<40;j++) @@ -2354,25 +2432,10 @@ static int mp_decode_layer3(MPADecodeContext *s) exponents_from_scale_factors(s, g, exponents); /* read Huffman coded residue */ - if (huffman_decode(s, g, exponents, - bits_pos + g->part2_3_length) < 0) - return -1; + huffman_decode(s, g, exponents, bits_pos + g->part2_3_length); #if defined(DEBUG) sample_dump(0, g->sb_hybrid, 576); #endif - - /* skip extension bits */ - bits_left = g->part2_3_length - (get_bits_count(&s->gb) - bits_pos); - if (bits_left < 0) { - dprintf("bits_left=%d\n", bits_left); - return -1; - } - while (bits_left >= 16) { - skip_bits(&s->gb, 16); - bits_left -= 16; - } - if (bits_left > 0) - skip_bits(&s->gb, bits_left); } /* ch */ if (s->nb_channels == 2) @@ -2395,17 +2458,18 @@ static int mp_decode_layer3(MPADecodeContext *s) #endif } } /* gr */ + if(get_bits_count(&s->gb)<0) + skip_bits_long(&s->gb, -get_bits_count(&s->gb)); return nb_granules * 18; } static int mp_decode_frame(MPADecodeContext *s, - OUT_INT *samples) + OUT_INT *samples, const uint8_t *buf, int buf_size) { int i, nb_frames, ch; OUT_INT *samples_ptr; - init_get_bits(&s->gb, s->inbuf + HEADER_SIZE, - (s->inbuf_ptr - s->inbuf - HEADER_SIZE)*8); + init_get_bits(&s->gb, buf + HEADER_SIZE, (buf_size - HEADER_SIZE)*8); /* skip error protection field */ if (s->error_protection) @@ -2422,6 +2486,32 @@ static int mp_decode_frame(MPADecodeContext *s, case 3: default: nb_frames = mp_decode_layer3(s); + + s->last_buf_size=0; + if(s->in_gb.buffer){ + align_get_bits(&s->gb); + i= (s->gb.size_in_bits - get_bits_count(&s->gb))>>3; + if(i >= 0 && i <= BACKSTEP_SIZE){ + memmove(s->last_buf, s->gb.buffer + (get_bits_count(&s->gb)>>3), i); + s->last_buf_size=i; + }else + av_log(NULL, AV_LOG_ERROR, "invalid old backstep %d\n", i); + s->gb= s->in_gb; + s->in_gb.buffer= NULL; + } + + align_get_bits(&s->gb); + assert((get_bits_count(&s->gb) & 7) == 0); + i= (s->gb.size_in_bits - get_bits_count(&s->gb))>>3; + + if(i<0 || i > BACKSTEP_SIZE || nb_frames<0){ + av_log(NULL, AV_LOG_ERROR, "invalid new backstep %d\n", i); + i= FFMIN(BACKSTEP_SIZE, buf_size - HEADER_SIZE); + } + assert(i <= buf_size - HEADER_SIZE && i>= 0); + memcpy(s->last_buf + s->last_buf_size, s->gb.buffer + buf_size - HEADER_SIZE - i, i); + s->last_buf_size += i; + break; } #if defined(DEBUG) @@ -2458,162 +2548,69 @@ static int decode_frame(AVCodecContext * avctx, { MPADecodeContext *s = avctx->priv_data; uint32_t header; - uint8_t *buf_ptr; - int len, out_size; + int out_size; OUT_INT *out_samples = data; - buf_ptr = buf; - while (buf_size > 0) { - len = s->inbuf_ptr - s->inbuf; - if (s->frame_size == 0) { - /* special case for next header for first frame in free - format case (XXX: find a simpler method) */ - if (s->free_format_next_header != 0) { - s->inbuf[0] = s->free_format_next_header >> 24; - s->inbuf[1] = s->free_format_next_header >> 16; - s->inbuf[2] = s->free_format_next_header >> 8; - s->inbuf[3] = s->free_format_next_header; - s->inbuf_ptr = s->inbuf + 4; - s->free_format_next_header = 0; - goto got_header; - } - /* no header seen : find one. We need at least HEADER_SIZE - bytes to parse it */ - len = HEADER_SIZE - len; - if (len > buf_size) - len = buf_size; - if (len > 0) { - memcpy(s->inbuf_ptr, buf_ptr, len); - buf_ptr += len; - buf_size -= len; - s->inbuf_ptr += len; - } - if ((s->inbuf_ptr - s->inbuf) >= HEADER_SIZE) { - got_header: - header = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) | - (s->inbuf[2] << 8) | s->inbuf[3]; - - if (ff_mpa_check_header(header) < 0) { - /* no sync found : move by one byte (inefficient, but simple!) */ - memmove(s->inbuf, s->inbuf + 1, s->inbuf_ptr - s->inbuf - 1); - s->inbuf_ptr--; - dprintf("skip %x\n", header); - /* reset free format frame size to give a chance - to get a new bitrate */ - s->free_format_frame_size = 0; - } else { - if (decode_header(s, header) == 1) { - /* free format: prepare to compute frame size */ - s->frame_size = -1; - } - /* update codec info */ - avctx->sample_rate = s->sample_rate; - avctx->channels = s->nb_channels; - avctx->bit_rate = s->bit_rate; - avctx->sub_id = s->layer; - switch(s->layer) { - case 1: - avctx->frame_size = 384; - break; - case 2: - avctx->frame_size = 1152; - break; - case 3: - if (s->lsf) - avctx->frame_size = 576; - else - avctx->frame_size = 1152; - break; - } - } - } - } else if (s->frame_size == -1) { - /* free format : find next sync to compute frame size */ - len = MPA_MAX_CODED_FRAME_SIZE - len; - if (len > buf_size) - len = buf_size; - if (len == 0) { - /* frame too long: resync */ - s->frame_size = 0; - memmove(s->inbuf, s->inbuf + 1, s->inbuf_ptr - s->inbuf - 1); - s->inbuf_ptr--; - } else { - uint8_t *p, *pend; - uint32_t header1; - int padding; - - memcpy(s->inbuf_ptr, buf_ptr, len); - /* check for header */ - p = s->inbuf_ptr - 3; - pend = s->inbuf_ptr + len - 4; - while (p <= pend) { - header = (p[0] << 24) | (p[1] << 16) | - (p[2] << 8) | p[3]; - header1 = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) | - (s->inbuf[2] << 8) | s->inbuf[3]; - /* check with high probability that we have a - valid header */ - if ((header & SAME_HEADER_MASK) == - (header1 & SAME_HEADER_MASK)) { - /* header found: update pointers */ - len = (p + 4) - s->inbuf_ptr; - buf_ptr += len; - buf_size -= len; - s->inbuf_ptr = p; - /* compute frame size */ - s->free_format_next_header = header; - s->free_format_frame_size = s->inbuf_ptr - s->inbuf; - padding = (header1 >> 9) & 1; - if (s->layer == 1) - s->free_format_frame_size -= padding * 4; - else - s->free_format_frame_size -= padding; - dprintf("free frame size=%d padding=%d\n", - s->free_format_frame_size, padding); - decode_header(s, header1); - goto next_data; - } - p++; - } - /* not found: simply increase pointers */ - buf_ptr += len; - s->inbuf_ptr += len; - buf_size -= len; - } - } else if (len < s->frame_size) { - if (s->frame_size > MPA_MAX_CODED_FRAME_SIZE) - s->frame_size = MPA_MAX_CODED_FRAME_SIZE; - len = s->frame_size - len; - if (len > buf_size) - len = buf_size; - memcpy(s->inbuf_ptr, buf_ptr, len); - buf_ptr += len; - s->inbuf_ptr += len; - buf_size -= len; - } - next_data: - if (s->frame_size > 0 && - (s->inbuf_ptr - s->inbuf) >= s->frame_size) { - if (avctx->parse_only) { - /* simply return the frame data */ - *(uint8_t **)data = s->inbuf; - out_size = s->inbuf_ptr - s->inbuf; - } else { - out_size = mp_decode_frame(s, out_samples); - } - s->inbuf_ptr = s->inbuf; - s->frame_size = 0; - if(out_size>=0) - *data_size = out_size; - else - av_log(avctx, AV_LOG_DEBUG, "Error while decoding mpeg audio frame\n"); //FIXME return -1 / but also return the number of bytes consumed - break; - } +retry: + if(buf_size < HEADER_SIZE) + return -1; + + header = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; + if(ff_mpa_check_header(header) < 0){ + buf++; +// buf_size--; + av_log(avctx, AV_LOG_ERROR, "Header missing skipping one byte.\n"); + goto retry; + } + + if (decode_header(s, header) == 1) { + /* free format: prepare to compute frame size */ + s->frame_size = -1; + return -1; + } + /* update codec info */ + avctx->channels = s->nb_channels; + avctx->bit_rate = s->bit_rate; + avctx->sub_id = s->layer; + switch(s->layer) { + case 1: + avctx->frame_size = 384; + break; + case 2: + avctx->frame_size = 1152; + break; + case 3: + if (s->lsf) + avctx->frame_size = 576; + else + avctx->frame_size = 1152; + break; } - return buf_ptr - buf; + + if(s->frame_size<=0 || s->frame_size > buf_size){ + av_log(avctx, AV_LOG_ERROR, "incomplete frame\n"); + return -1; + }else if(s->frame_size < buf_size){ + av_log(avctx, AV_LOG_ERROR, "incorrect frame size\n"); + } + + out_size = mp_decode_frame(s, out_samples, buf, buf_size); + if(out_size>=0){ + *data_size = out_size; + avctx->sample_rate = s->sample_rate; + //FIXME maybe move the other codec info stuff from above here too + }else + av_log(avctx, AV_LOG_DEBUG, "Error while decoding MPEG audio frame.\n"); //FIXME return -1 / but also return the number of bytes consumed + s->frame_size = 0; + return buf_size; } +static void flush(AVCodecContext *avctx){ + MPADecodeContext *s = avctx->priv_data; + s->last_buf_size= 0; +} +#ifdef CONFIG_MP3ADU_DECODER static int decode_frame_adu(AVCodecContext * avctx, void *data, int *data_size, uint8_t * buf, int buf_size) @@ -2635,12 +2632,8 @@ static int decode_frame_adu(AVCodecContext * avctx, if (len > MPA_MAX_CODED_FRAME_SIZE) len = MPA_MAX_CODED_FRAME_SIZE; - memcpy(s->inbuf, buf, len); - s->inbuf_ptr = s->inbuf + len; - // Get header and restore sync word - header = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) | - (s->inbuf[2] << 8) | s->inbuf[3] | 0xffe00000; + header = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3] | 0xffe00000; if (ff_mpa_check_header(header) < 0) { // Bad header, discard frame *data_size = 0; @@ -2657,18 +2650,17 @@ static int decode_frame_adu(AVCodecContext * avctx, avctx->frame_size=s->frame_size = len; if (avctx->parse_only) { - /* simply return the frame data */ - *(uint8_t **)data = s->inbuf; - out_size = s->inbuf_ptr - s->inbuf; + out_size = buf_size; } else { - out_size = mp_decode_frame(s, out_samples); + out_size = mp_decode_frame(s, out_samples, buf, buf_size); } *data_size = out_size; return buf_size; } +#endif /* CONFIG_MP3ADU_DECODER */ - +#ifdef CONFIG_MP3ON4_DECODER /* Next 3 arrays are indexed by channel config number (passed via codecdata) */ static int mp3Frames[16] = {0,1,1,2,3,3,4,5,2}; /* number of mp3 decoder instances */ static int mp3Channels[16] = {0,1,2,3,4,5,6,8,4}; /* total output channels */ @@ -2724,8 +2716,6 @@ static int decode_init_mp3on4(AVCodecContext * avctx) for (i = 1; i < s->frames; i++) { s->mp3decctx[i] = av_mallocz(sizeof(MPADecodeContext)); s->mp3decctx[i]->compute_antialias = s->mp3decctx[0]->compute_antialias; - s->mp3decctx[i]->inbuf = &s->mp3decctx[i]->inbuf1[0][BACKSTEP_SIZE]; - s->mp3decctx[i]->inbuf_ptr = s->mp3decctx[i]->inbuf; s->mp3decctx[i]->adu_mode = 1; } @@ -2785,13 +2775,9 @@ static int decode_frame_mp3on4(AVCodecContext * avctx, fsize = MPA_MAX_CODED_FRAME_SIZE; m = s->mp3decctx[fr]; assert (m != NULL); - /* copy original to new */ - m->inbuf_ptr = m->inbuf + fsize; - memcpy(m->inbuf, start, fsize); // Get header - header = (m->inbuf[0] << 24) | (m->inbuf[1] << 16) | - (m->inbuf[2] << 8) | m->inbuf[3] | 0xfff00000; + header = (start[0] << 24) | (start[1] << 16) | (start[2] << 8) | start[3] | 0xfff00000; if (ff_mpa_check_header(header) < 0) { // Bad header, discard block *data_size = 0; @@ -2799,7 +2785,7 @@ static int decode_frame_mp3on4(AVCodecContext * avctx, } decode_header(m, header); - mp_decode_frame(m, decoded_buf); + mp_decode_frame(m, decoded_buf, start, fsize); n = MPA_FRAME_SIZE * m->nb_channels; out_size += n * sizeof(OUT_INT); @@ -2831,8 +2817,9 @@ static int decode_frame_mp3on4(AVCodecContext * avctx, *data_size = out_size; return buf_size; } +#endif /* CONFIG_MP3ON4_DECODER */ - +#ifdef CONFIG_MP2_DECODER AVCodec mp2_decoder = { "mp2", @@ -2845,7 +2832,8 @@ AVCodec mp2_decoder = decode_frame, CODEC_CAP_PARSE_ONLY, }; - +#endif +#ifdef CONFIG_MP3_DECODER AVCodec mp3_decoder = { "mp3", @@ -2857,8 +2845,10 @@ AVCodec mp3_decoder = NULL, decode_frame, CODEC_CAP_PARSE_ONLY, + .flush= flush, }; - +#endif +#ifdef CONFIG_MP3ADU_DECODER AVCodec mp3adu_decoder = { "mp3adu", @@ -2870,8 +2860,10 @@ AVCodec mp3adu_decoder = NULL, decode_frame_adu, CODEC_CAP_PARSE_ONLY, + .flush= flush, }; - +#endif +#ifdef CONFIG_MP3ON4_DECODER AVCodec mp3on4_decoder = { "mp3on4", @@ -2882,5 +2874,6 @@ AVCodec mp3on4_decoder = NULL, decode_close_mp3on4, decode_frame_mp3on4, - 0 + .flush= flush, }; +#endif diff --git a/src/libffmpeg/libavcodec/mpegaudiodectab.h b/src/libffmpeg/libavcodec/mpegaudiodectab.h index 572f7acb5..fdd1096fc 100644 --- a/src/libffmpeg/libavcodec/mpegaudiodectab.h +++ b/src/libffmpeg/libavcodec/mpegaudiodectab.h @@ -1,3 +1,24 @@ +/* + * MPEG Audio decoder + * copyright (c) 2002 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + /** * @file mpegaudiodectab.h * mpeg audio layer decoder tables. @@ -221,55 +242,55 @@ static const uint8_t lsf_nsf_table[6][3][4] = { /* mpegaudio layer 3 huffman tables */ -const uint16_t mpa_huffcodes_1[4] = { +static const uint16_t mpa_huffcodes_1[4] = { 0x0001, 0x0001, 0x0001, 0x0000, }; -const uint8_t mpa_huffbits_1[4] = { +static const uint8_t mpa_huffbits_1[4] = { 1, 3, 2, 3, }; -const uint16_t mpa_huffcodes_2[9] = { +static const uint16_t mpa_huffcodes_2[9] = { 0x0001, 0x0002, 0x0001, 0x0003, 0x0001, 0x0001, 0x0003, 0x0002, 0x0000, }; -const uint8_t mpa_huffbits_2[9] = { +static const uint8_t mpa_huffbits_2[9] = { 1, 3, 6, 3, 3, 5, 5, 5, 6, }; -const uint16_t mpa_huffcodes_3[9] = { +static const uint16_t mpa_huffcodes_3[9] = { 0x0003, 0x0002, 0x0001, 0x0001, 0x0001, 0x0001, 0x0003, 0x0002, 0x0000, }; -const uint8_t mpa_huffbits_3[9] = { +static const uint8_t mpa_huffbits_3[9] = { 2, 2, 6, 3, 2, 5, 5, 5, 6, }; -const uint16_t mpa_huffcodes_5[16] = { +static const uint16_t mpa_huffcodes_5[16] = { 0x0001, 0x0002, 0x0006, 0x0005, 0x0003, 0x0001, 0x0004, 0x0004, 0x0007, 0x0005, 0x0007, 0x0001, 0x0006, 0x0001, 0x0001, 0x0000, }; -const uint8_t mpa_huffbits_5[16] = { +static const uint8_t mpa_huffbits_5[16] = { 1, 3, 6, 7, 3, 3, 6, 7, 6, 6, 7, 8, 7, 6, 7, 8, }; -const uint16_t mpa_huffcodes_6[16] = { +static const uint16_t mpa_huffcodes_6[16] = { 0x0007, 0x0003, 0x0005, 0x0001, 0x0006, 0x0002, 0x0003, 0x0002, 0x0005, 0x0004, 0x0004, 0x0001, 0x0003, 0x0003, 0x0002, 0x0000, }; -const uint8_t mpa_huffbits_6[16] = { +static const uint8_t mpa_huffbits_6[16] = { 3, 3, 5, 7, 3, 2, 4, 5, 4, 4, 5, 6, 6, 5, 6, 7, }; -const uint16_t mpa_huffcodes_7[36] = { +static const uint16_t mpa_huffcodes_7[36] = { 0x0001, 0x0002, 0x000a, 0x0013, 0x0010, 0x000a, 0x0003, 0x0003, 0x0007, 0x000a, 0x0005, 0x0003, 0x000b, 0x0004, 0x000d, 0x0011, 0x0008, 0x0004, 0x000c, 0x000b, 0x0012, 0x000f, 0x000b, 0x0002, @@ -277,7 +298,7 @@ const uint16_t mpa_huffcodes_7[36] = { 0x0005, 0x0003, 0x0002, 0x0000, }; -const uint8_t mpa_huffbits_7[36] = { +static const uint8_t mpa_huffbits_7[36] = { 1, 3, 6, 8, 8, 9, 3, 4, 6, 7, 7, 8, 6, 5, 7, 8, 8, 9, 7, 7, 8, 9, 9, 9, @@ -285,7 +306,7 @@ const uint8_t mpa_huffbits_7[36] = { 9, 10, 10, 10, }; -const uint16_t mpa_huffcodes_8[36] = { +static const uint16_t mpa_huffcodes_8[36] = { 0x0003, 0x0004, 0x0006, 0x0012, 0x000c, 0x0005, 0x0005, 0x0001, 0x0002, 0x0010, 0x0009, 0x0003, 0x0007, 0x0003, 0x0005, 0x000e, 0x0007, 0x0003, 0x0013, 0x0011, 0x000f, 0x000d, 0x000a, 0x0004, @@ -293,7 +314,7 @@ const uint16_t mpa_huffcodes_8[36] = { 0x0004, 0x0001, 0x0001, 0x0000, }; -const uint8_t mpa_huffbits_8[36] = { +static const uint8_t mpa_huffbits_8[36] = { 2, 3, 6, 8, 8, 9, 3, 2, 4, 8, 8, 8, 6, 4, 6, 8, 8, 9, 8, 8, 8, 9, 9, 10, @@ -301,7 +322,7 @@ const uint8_t mpa_huffbits_8[36] = { 9, 9, 11, 11, }; -const uint16_t mpa_huffcodes_9[36] = { +static const uint16_t mpa_huffcodes_9[36] = { 0x0007, 0x0005, 0x0009, 0x000e, 0x000f, 0x0007, 0x0006, 0x0004, 0x0005, 0x0005, 0x0006, 0x0007, 0x0007, 0x0006, 0x0008, 0x0008, 0x0008, 0x0005, 0x000f, 0x0006, 0x0009, 0x000a, 0x0005, 0x0001, @@ -309,7 +330,7 @@ const uint16_t mpa_huffcodes_9[36] = { 0x0006, 0x0002, 0x0006, 0x0000, }; -const uint8_t mpa_huffbits_9[36] = { +static const uint8_t mpa_huffbits_9[36] = { 3, 3, 5, 6, 8, 9, 3, 3, 4, 5, 6, 8, 4, 4, 5, 6, 7, 8, 6, 5, 6, 7, 7, 8, @@ -317,7 +338,7 @@ const uint8_t mpa_huffbits_9[36] = { 8, 8, 9, 9, }; -const uint16_t mpa_huffcodes_10[64] = { +static const uint16_t mpa_huffcodes_10[64] = { 0x0001, 0x0002, 0x000a, 0x0017, 0x0023, 0x001e, 0x000c, 0x0011, 0x0003, 0x0003, 0x0008, 0x000c, 0x0012, 0x0015, 0x000c, 0x0007, 0x000b, 0x0009, 0x000f, 0x0015, 0x0020, 0x0028, 0x0013, 0x0006, @@ -328,7 +349,7 @@ const uint16_t mpa_huffcodes_10[64] = { 0x0009, 0x0008, 0x0007, 0x0008, 0x0004, 0x0004, 0x0002, 0x0000, }; -const uint8_t mpa_huffbits_10[64] = { +static const uint8_t mpa_huffbits_10[64] = { 1, 3, 6, 8, 9, 9, 9, 10, 3, 4, 6, 7, 8, 9, 8, 8, 6, 6, 7, 8, 9, 10, 9, 9, @@ -339,7 +360,7 @@ const uint8_t mpa_huffbits_10[64] = { 9, 8, 9, 10, 10, 11, 11, 11, }; -const uint16_t mpa_huffcodes_11[64] = { +static const uint16_t mpa_huffcodes_11[64] = { 0x0003, 0x0004, 0x000a, 0x0018, 0x0022, 0x0021, 0x0015, 0x000f, 0x0005, 0x0003, 0x0004, 0x000a, 0x0020, 0x0011, 0x000b, 0x000a, 0x000b, 0x0007, 0x000d, 0x0012, 0x001e, 0x001f, 0x0014, 0x0005, @@ -350,7 +371,7 @@ const uint16_t mpa_huffcodes_11[64] = { 0x000b, 0x0004, 0x0006, 0x0006, 0x0006, 0x0003, 0x0002, 0x0000, }; -const uint8_t mpa_huffbits_11[64] = { +static const uint8_t mpa_huffbits_11[64] = { 2, 3, 5, 7, 8, 9, 8, 9, 3, 3, 4, 6, 8, 8, 7, 8, 5, 5, 6, 7, 8, 9, 8, 8, @@ -361,7 +382,7 @@ const uint8_t mpa_huffbits_11[64] = { 8, 7, 8, 9, 10, 10, 10, 10, }; -const uint16_t mpa_huffcodes_12[64] = { +static const uint16_t mpa_huffcodes_12[64] = { 0x0009, 0x0006, 0x0010, 0x0021, 0x0029, 0x0027, 0x0026, 0x001a, 0x0007, 0x0005, 0x0006, 0x0009, 0x0017, 0x0010, 0x001a, 0x000b, 0x0011, 0x0007, 0x000b, 0x000e, 0x0015, 0x001e, 0x000a, 0x0007, @@ -372,7 +393,7 @@ const uint16_t mpa_huffcodes_12[64] = { 0x001b, 0x000c, 0x0008, 0x000c, 0x0006, 0x0003, 0x0001, 0x0000, }; -const uint8_t mpa_huffbits_12[64] = { +static const uint8_t mpa_huffbits_12[64] = { 4, 3, 5, 7, 8, 9, 9, 9, 3, 3, 4, 5, 7, 7, 8, 8, 5, 4, 5, 6, 7, 8, 7, 8, @@ -383,7 +404,7 @@ const uint8_t mpa_huffbits_12[64] = { 9, 8, 8, 9, 9, 9, 9, 10, }; -const uint16_t mpa_huffcodes_13[256] = { +static const uint16_t mpa_huffcodes_13[256] = { 0x0001, 0x0005, 0x000e, 0x0015, 0x0022, 0x0033, 0x002e, 0x0047, 0x002a, 0x0034, 0x0044, 0x0034, 0x0043, 0x002c, 0x002b, 0x0013, 0x0003, 0x0004, 0x000c, 0x0013, 0x001f, 0x001a, 0x002c, 0x0021, @@ -418,7 +439,7 @@ const uint16_t mpa_huffcodes_13[256] = { 0x0011, 0x000c, 0x0010, 0x0008, 0x0001, 0x0001, 0x0000, 0x0001, }; -const uint8_t mpa_huffbits_13[256] = { +static const uint8_t mpa_huffbits_13[256] = { 1, 4, 6, 7, 8, 9, 9, 10, 9, 10, 11, 11, 12, 12, 13, 13, 3, 4, 6, 7, 8, 8, 9, 9, @@ -453,7 +474,7 @@ const uint8_t mpa_huffbits_13[256] = { 15, 15, 16, 16, 19, 18, 19, 16, }; -const uint16_t mpa_huffcodes_15[256] = { +static const uint16_t mpa_huffcodes_15[256] = { 0x0007, 0x000c, 0x0012, 0x0035, 0x002f, 0x004c, 0x007c, 0x006c, 0x0059, 0x007b, 0x006c, 0x0077, 0x006b, 0x0051, 0x007a, 0x003f, 0x000d, 0x0005, 0x0010, 0x001b, 0x002e, 0x0024, 0x003d, 0x0033, @@ -488,7 +509,7 @@ const uint16_t mpa_huffcodes_15[256] = { 0x0015, 0x0010, 0x000a, 0x0006, 0x0008, 0x0006, 0x0002, 0x0000, }; -const uint8_t mpa_huffbits_15[256] = { +static const uint8_t mpa_huffbits_15[256] = { 3, 4, 5, 7, 7, 8, 9, 9, 9, 10, 10, 11, 11, 11, 12, 13, 4, 3, 5, 6, 7, 7, 8, 8, @@ -523,7 +544,7 @@ const uint8_t mpa_huffbits_15[256] = { 12, 12, 12, 12, 13, 13, 13, 13, }; -const uint16_t mpa_huffcodes_16[256] = { +static const uint16_t mpa_huffcodes_16[256] = { 0x0001, 0x0005, 0x000e, 0x002c, 0x004a, 0x003f, 0x006e, 0x005d, 0x00ac, 0x0095, 0x008a, 0x00f2, 0x00e1, 0x00c3, 0x0178, 0x0011, 0x0003, 0x0004, 0x000c, 0x0014, 0x0023, 0x003e, 0x0035, 0x002f, @@ -558,7 +579,7 @@ const uint16_t mpa_huffcodes_16[256] = { 0x000d, 0x000c, 0x000a, 0x0007, 0x0005, 0x0003, 0x0001, 0x0003, }; -const uint8_t mpa_huffbits_16[256] = { +static const uint8_t mpa_huffbits_16[256] = { 1, 4, 6, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 12, 13, 9, 3, 4, 6, 7, 8, 9, 9, 9, @@ -593,7 +614,7 @@ const uint8_t mpa_huffbits_16[256] = { 11, 11, 11, 11, 11, 11, 11, 8, }; -const uint16_t mpa_huffcodes_24[256] = { +static const uint16_t mpa_huffcodes_24[256] = { 0x000f, 0x000d, 0x002e, 0x0050, 0x0092, 0x0106, 0x00f8, 0x01b2, 0x01aa, 0x029d, 0x028d, 0x0289, 0x026d, 0x0205, 0x0408, 0x0058, 0x000e, 0x000c, 0x0015, 0x0026, 0x0047, 0x0082, 0x007a, 0x00d8, @@ -628,7 +649,7 @@ const uint16_t mpa_huffcodes_24[256] = { 0x0007, 0x0006, 0x0004, 0x0007, 0x0005, 0x0003, 0x0001, 0x0003, }; -const uint8_t mpa_huffbits_24[256] = { +static const uint8_t mpa_huffbits_24[256] = { 4, 4, 6, 7, 8, 9, 9, 10, 10, 11, 11, 11, 11, 11, 12, 9, 4, 4, 5, 6, 7, 8, 8, 9, @@ -663,7 +684,7 @@ const uint8_t mpa_huffbits_24[256] = { 7, 7, 7, 8, 8, 8, 8, 4, }; -const HuffTable mpa_huff_tables[16] = { +static const HuffTable mpa_huff_tables[16] = { { 1, NULL, NULL }, { 2, mpa_huffbits_1, mpa_huffcodes_1 }, { 3, mpa_huffbits_2, mpa_huffcodes_2 }, @@ -682,7 +703,7 @@ const HuffTable mpa_huff_tables[16] = { { 16, mpa_huffbits_24, mpa_huffcodes_24 }, }; -const uint8_t mpa_huff_data[32][2] = { +static const uint8_t mpa_huff_data[32][2] = { { 0, 0 }, { 1, 0 }, { 2, 0 }, @@ -730,7 +751,7 @@ static const uint8_t mpa_quad_bits[2][16] = { }; /* band size tables */ -const uint8_t band_size_long[9][22] = { +static const uint8_t band_size_long[9][22] = { { 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10, 12, 16, 20, 24, 28, 34, 42, 50, 54, 76, 158, }, /* 44100 */ { 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 10, @@ -751,7 +772,7 @@ const uint8_t band_size_long[9][22] = { 40, 48, 56, 64, 76, 90, 2, 2, 2, 2, 2, }, /* 8000 */ }; -const uint8_t band_size_short[9][13] = { +static const uint8_t band_size_short[9][13] = { { 4, 4, 4, 4, 6, 8, 10, 12, 14, 18, 22, 30, 56, }, /* 44100 */ { 4, 4, 4, 4, 6, 6, 10, 12, 14, 16, 20, 26, 66, }, /* 48000 */ { 4, 4, 4, 4, 6, 8, 12, 16, 20, 26, 34, 42, 12, }, /* 32000 */ @@ -763,12 +784,12 @@ const uint8_t band_size_short[9][13] = { { 8, 8, 8, 12, 16, 20, 24, 28, 36, 2, 2, 2, 26, }, /* 8000 */ }; -const uint8_t mpa_pretab[2][22] = { +static const uint8_t mpa_pretab[2][22] = { { 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, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0 }, }; /* table for alias reduction (XXX: store it as integer !) */ -const float ci_table[8] = { +static const float ci_table[8] = { -0.6, -0.535, -0.33, -0.185, -0.095, -0.041, -0.0142, -0.0037, }; diff --git a/src/libffmpeg/libavcodec/mpegaudiotab.h b/src/libffmpeg/libavcodec/mpegaudiotab.h index 2e7d3372f..8fb37ddff 100644 --- a/src/libffmpeg/libavcodec/mpegaudiotab.h +++ b/src/libffmpeg/libavcodec/mpegaudiotab.h @@ -4,8 +4,21 @@ * * Copyright (c) 2000, 2001 Fabrice Bellard. * - * The licence of this code is contained in file LICENCE found in the - * same archive + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** diff --git a/src/libffmpeg/libavcodec/mpegvideo.c b/src/libffmpeg/libavcodec/mpegvideo.c index f1c1b34bb..a9d877fff 100644 --- a/src/libffmpeg/libavcodec/mpegvideo.c +++ b/src/libffmpeg/libavcodec/mpegvideo.c @@ -3,18 +3,20 @@ * Copyright (c) 2000,2001 Fabrice Bellard. * Copyright (c) 2002-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * 4MV & hq & b-frame encoding stuff by Michael Niedermayer @@ -32,7 +34,7 @@ #include #ifdef USE_FASTMEMCPY -#include "fastmemcpy.h" +#include "libvo/fastmemcpy.h" #endif //#undef NDEBUG @@ -47,7 +49,7 @@ #ifdef CONFIG_ENCODERS -static void encode_picture(MpegEncContext *s, int picture_number); +static int encode_picture(MpegEncContext *s, int picture_number); #endif //CONFIG_ENCODERS static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s, DCTELEM *block, int n, int qscale); @@ -225,7 +227,7 @@ void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_s } #ifdef CONFIG_ENCODERS -void ff_write_quant_matrix(PutBitContext *pb, int16_t *matrix){ +void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix){ int i; if(matrix){ @@ -334,6 +336,7 @@ static void copy_picture(Picture *dst, Picture *src){ dst->type= FF_BUFFER_TYPE_COPY; } +#ifdef CONFIG_ENCODERS static void copy_picture_attributes(MpegEncContext *s, AVFrame *dst, AVFrame *src){ int i; @@ -372,6 +375,7 @@ static void copy_picture_attributes(MpegEncContext *s, AVFrame *dst, AVFrame *sr } } } +#endif /** * allocates a Picture @@ -573,6 +577,7 @@ void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src){ //STOP_TIMER("update_duplicate_context") //about 10k cycles / 0.01 sec for 1000frames on 1ghz with 2 threads } +#ifdef CONFIG_ENCODERS static void update_duplicate_context_after_me(MpegEncContext *dst, MpegEncContext *src){ #define COPY(a) dst->a= src->a COPY(pict_type); @@ -589,6 +594,7 @@ static void update_duplicate_context_after_me(MpegEncContext *dst, MpegEncContex COPY(partitioned_frame); //FIXME don't set in encode_header #undef COPY } +#endif /** * sets the given MpegEncContext to common defaults (same for encoding and decoding). @@ -700,12 +706,12 @@ int MPV_common_init(MpegEncContext *s) yc_size = y_size + 2 * c_size; /* convert fourcc to upper case */ - s->avctx->codec_tag= toupper( s->avctx->codec_tag &0xFF) + s->codec_tag= toupper( s->avctx->codec_tag &0xFF) + (toupper((s->avctx->codec_tag>>8 )&0xFF)<<8 ) + (toupper((s->avctx->codec_tag>>16)&0xFF)<<16) + (toupper((s->avctx->codec_tag>>24)&0xFF)<<24); - s->avctx->stream_codec_tag= toupper( s->avctx->stream_codec_tag &0xFF) + s->stream_codec_tag= toupper( s->avctx->stream_codec_tag &0xFF) + (toupper((s->avctx->stream_codec_tag>>8 )&0xFF)<<8 ) + (toupper((s->avctx->stream_codec_tag>>16)&0xFF)<<16) + (toupper((s->avctx->stream_codec_tag>>24)&0xFF)<<24); @@ -944,7 +950,8 @@ int MPV_encode_init(AVCodecContext *avctx) break; case CODEC_ID_LJPEG: case CODEC_ID_MJPEG: - if(avctx->pix_fmt != PIX_FMT_YUVJ420P && (avctx->pix_fmt != PIX_FMT_YUV420P || avctx->strict_std_compliance>FF_COMPLIANCE_INOFFICIAL)){ + if(avctx->pix_fmt != PIX_FMT_YUVJ420P && avctx->pix_fmt != PIX_FMT_YUVJ422P && + ((avctx->pix_fmt != PIX_FMT_YUV420P && avctx->pix_fmt != PIX_FMT_YUV422P) || avctx->strict_std_compliance>FF_COMPLIANCE_INOFFICIAL)){ av_log(avctx, AV_LOG_ERROR, "colorspace not supported in jpeg\n"); return -1; } @@ -1105,6 +1112,17 @@ int MPV_encode_init(AVCodecContext *avctx) return -1; } + if(s->flags & CODEC_FLAG_LOW_DELAY){ + if (s->codec_id != CODEC_ID_MPEG2VIDEO && s->codec_id != CODEC_ID_MPEG1VIDEO){ + av_log(avctx, AV_LOG_ERROR, "low delay forcing is only available for mpeg1/2\n"); + return -1; + } + if (s->max_b_frames != 0){ + av_log(avctx, AV_LOG_ERROR, "b frames cannot be used with low delay\n"); + return -1; + } + } + if(s->avctx->thread_count > 1 && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO && (s->codec_id != CODEC_ID_H263P || !(s->flags & CODEC_FLAG_H263P_SLICE_STRUCT))){ @@ -1170,14 +1188,12 @@ int MPV_encode_init(AVCodecContext *avctx) switch(avctx->codec->id) { case CODEC_ID_MPEG1VIDEO: s->out_format = FMT_MPEG1; - s->low_delay= 0; //s->max_b_frames ? 0 : 1; + s->low_delay= !!(s->flags & CODEC_FLAG_LOW_DELAY); avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); break; -/* xine: this is never used in either decode or MPEG-1 encode mode */ -#if 0 case CODEC_ID_MPEG2VIDEO: s->out_format = FMT_MPEG1; - s->low_delay= 0; //s->max_b_frames ? 0 : 1; + s->low_delay= !!(s->flags & CODEC_FLAG_LOW_DELAY); avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); s->rtp_mode= 1; break; @@ -1188,22 +1204,28 @@ int MPV_encode_init(AVCodecContext *avctx) s->intra_only = 1; /* force intra only for jpeg */ s->mjpeg_write_tables = avctx->codec->id != CODEC_ID_JPEGLS; s->mjpeg_data_only_frames = 0; /* write all the needed headers */ - s->mjpeg_vsample[0] = 1<mjpeg_vsample[1] = 1; - s->mjpeg_vsample[2] = 1; - s->mjpeg_hsample[0] = 1<mjpeg_hsample[1] = 1; - s->mjpeg_hsample[2] = 1; + s->mjpeg_vsample[0] = 2; + s->mjpeg_vsample[1] = 2>>chroma_v_shift; + s->mjpeg_vsample[2] = 2>>chroma_v_shift; + s->mjpeg_hsample[0] = 2; + s->mjpeg_hsample[1] = 2>>chroma_h_shift; + s->mjpeg_hsample[2] = 2>>chroma_h_shift; if (mjpeg_init(s) < 0) return -1; avctx->delay=0; s->low_delay=1; break; +#ifdef CONFIG_H261_ENCODER case CODEC_ID_H261: + if (ff_h261_get_picture_format(s->width, s->height) < 0) { + av_log(avctx, AV_LOG_ERROR, "The specified picture size of %dx%d is not valid for the H.261 codec.\nValid sizes are 176x144, 352x288\n", s->width, s->height); + return -1; + } s->out_format = FMT_H261; avctx->delay=0; s->low_delay=1; break; +#endif case CODEC_ID_H263: if (h263_get_picture_format(s->width, s->height) == 7) { av_log(avctx, AV_LOG_INFO, "The specified picture size of %dx%d is not valid for the H.263 codec.\nValid sizes are 128x96, 176x144, 352x288, 704x576, and 1408x1152. Try H.263+.\n", s->width, s->height); @@ -1310,7 +1332,6 @@ int MPV_encode_init(AVCodecContext *avctx) avctx->delay=0; s->low_delay=1; break; -#endif /* #if 0 */ default: return -1; } @@ -1326,7 +1347,7 @@ int MPV_encode_init(AVCodecContext *avctx) if(s->modified_quant) s->chroma_qscale_table= ff_h263_chroma_qscale_table; s->progressive_frame= - s->progressive_sequence= !(avctx->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)); + s->progressive_sequence= !(avctx->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN)); s->quant_precision=5; ff_set_cmp(&s->dsp, s->dsp.ildct_cmp, s->avctx->ildct_cmp); @@ -1705,7 +1726,7 @@ void MPV_frame_end(MpegEncContext *s) * @param color color of the arrow */ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, int stride, int color){ - int t, x, y, fr, f; + int x, y, fr, f; sx= clip(sx, 0, w-1); sy= clip(sy, 0, h-1); @@ -1714,10 +1735,10 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h buf[sy*stride + sx]+= color; - if(ABS(ex - sx) > ABS(ey - sy)){ + if(FFABS(ex - sx) > FFABS(ey - sy)){ if(sx > ex){ - t=sx; sx=ex; ex=t; - t=sy; sy=ey; ey=t; + FFSWAP(int, sx, ex); + FFSWAP(int, sy, ey); } buf+= sx + sy*stride; ex-= sx; @@ -1730,8 +1751,8 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h } }else{ if(sy > ey){ - t=sx; sx=ex; ex=t; - t=sy; sy=ey; ey=t; + FFSWAP(int, sx, ex); + FFSWAP(int, sy, ey); } buf+= sx + sy*stride; ey-= sy; @@ -2048,7 +2069,7 @@ static int get_sae(uint8_t *src, int ref, int stride){ for(y=0; y<16; y++){ for(x=0; x<16; x++){ - acc+= ABS(src[x+y*stride] - ref); + acc+= FFABS(src[x+y*stride] - ref); } } @@ -2152,7 +2173,10 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg){ int w= s->width >>h_shift; int h= s->height>>v_shift; uint8_t *src= pic_arg->data[i]; - uint8_t *dst= pic->data[i] + INPLACE_OFFSET; + uint8_t *dst= pic->data[i]; + + if(!s->avctx->rc_buffer_size) + dst +=INPLACE_OFFSET; if(src_stride==dst_stride) memcpy(dst, src, src_stride*h); @@ -2194,9 +2218,9 @@ static int skip_check(MpegEncContext *s, Picture *p, Picture *ref){ switch(s->avctx->frame_skip_exp){ case 0: score= FFMAX(score, v); break; - case 1: score+= ABS(v);break; + case 1: score+= FFABS(v);break; case 2: score+= v*v;break; - case 3: score64+= ABS(v*v*(int64_t)v);break; + case 3: score64+= FFABS(v*v*(int64_t)v);break; case 4: score64+= v*v*(int64_t)(v*v);break; } } @@ -2227,7 +2251,7 @@ static int estimate_best_b_count(MpegEncContext *s){ // emms_c(); p_lambda= s->last_lambda_for[P_TYPE]; //s->next_picture_ptr->quality; - b_lambda= s->last_lambda_for[B_TYPE]; //p_lambda *ABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; + b_lambda= s->last_lambda_for[B_TYPE]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else lambda2= (b_lambda*b_lambda + (1<> FF_LAMBDA_SHIFT; @@ -2341,7 +2365,7 @@ static void select_input_picture(MpegEncContext *s){ if(s->avctx->frame_skip_threshold || s->avctx->frame_skip_factor){ if(s->picture_in_gop_number < s->gop_size && skip_check(s, s->input_picture[0], s->next_picture_ptr)){ //FIXME check that te gop check above is +-1 correct -//av_log(NULL, AV_LOG_DEBUG, "skip %p %Ld\n", s->input_picture[0]->data[0], s->input_picture[0]->pts); +//av_log(NULL, AV_LOG_DEBUG, "skip %p %"PRId64"\n", s->input_picture[0]->data[0], s->input_picture[0]->pts); if(s->input_picture[0]->type == FF_BUFFER_TYPE_SHARED){ for(i=0; i<4; i++) @@ -2451,21 +2475,22 @@ no_output_pic: copy_picture(&s->new_picture, s->reordered_input_picture[0]); - if(s->reordered_input_picture[0]->type == FF_BUFFER_TYPE_SHARED){ + if(s->reordered_input_picture[0]->type == FF_BUFFER_TYPE_SHARED || s->avctx->rc_buffer_size){ // input is a shared pix, so we can't modifiy it -> alloc a new one & ensure that the shared one is reuseable int i= ff_find_unused_picture(s, 0); Picture *pic= &s->picture[i]; + pic->reference = s->reordered_input_picture[0]->reference; + alloc_picture(s, pic, 0); + /* mark us unused / free shared pic */ + if(s->reordered_input_picture[0]->type == FF_BUFFER_TYPE_INTERNAL) + s->avctx->release_buffer(s->avctx, (AVFrame*)s->reordered_input_picture[0]); for(i=0; i<4; i++) s->reordered_input_picture[0]->data[i]= NULL; s->reordered_input_picture[0]->type= 0; - pic->reference = s->reordered_input_picture[0]->reference; - - alloc_picture(s, pic, 0); - copy_picture_attributes(s, (AVFrame*)pic, (AVFrame*)s->reordered_input_picture[0]); s->current_picture_ptr= pic; @@ -2519,8 +2544,9 @@ int MPV_encode_picture(AVCodecContext *avctx, //emms_c(); //printf("qs:%f %f %d\n", s->new_picture.quality, s->current_picture.quality, s->qscale); MPV_frame_start(s, avctx); - - encode_picture(s, s->picture_number); +vbv_retry: + if (encode_picture(s, s->picture_number) < 0) + return -1; avctx->real_pict_num = s->picture_number; avctx->header_bits = s->header_bits; @@ -2540,6 +2566,37 @@ int MPV_encode_picture(AVCodecContext *avctx, mjpeg_picture_trailer(s); #endif /* #if 0 */ + if(avctx->rc_buffer_size){ + RateControlContext *rcc= &s->rc_context; + int max_size= rcc->buffer_index/3; + + if(put_bits_count(&s->pb) > max_size && s->lambda < s->avctx->lmax){ + s->next_lambda= FFMAX(s->lambda+1, s->lambda*(s->qscale+1) / s->qscale); + if(s->adaptive_quant){ + int i; + for(i=0; imb_height*s->mb_stride; i++) + s->lambda_table[i]= FFMAX(s->lambda_table[i]+1, s->lambda_table[i]*(s->qscale+1) / s->qscale); + } + s->mb_skipped = 0; //done in MPV_frame_start() + if(s->pict_type==P_TYPE){ //done in encode_picture() so we must undo it + if(s->flipflop_rounding || s->codec_id == CODEC_ID_H263P || s->codec_id == CODEC_ID_MPEG4) + s->no_rounding ^= 1; + } + if(s->pict_type!=B_TYPE){ + s->time_base= s->last_time_base; + s->last_non_b_time= s->time - s->pp_time; + } +// av_log(NULL, AV_LOG_ERROR, "R:%d ", s->next_lambda); + for(i=0; ithread_count; i++){ + PutBitContext *pb= &s->thread_context[i]->pb; + init_put_bits(pb, pb->buf, pb->buf_end - pb->buf); + } + goto vbv_retry; + } + + assert(s->avctx->rc_max_rate); + } + if(s->flags&CODEC_FLAG_PASS1) ff_write_pass1_stats(s); @@ -3895,7 +3952,7 @@ static always_inline void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM bloc else if (s->h263_pred || s->h263_aic) s->mbintra_table[mb_xy]=1; - if ((s->flags&CODEC_FLAG_PSNR) || !(s->encoding && (s->intra_only || s->pict_type==B_TYPE))) { //FIXME precalc + if ((s->flags&CODEC_FLAG_PSNR) || !(s->encoding && (s->intra_only || s->pict_type==B_TYPE) && s->avctx->mb_decision != FF_MB_DECISION_RD)) { //FIXME precalc uint8_t *dest_y, *dest_cb, *dest_cr; int dct_linesize, dct_offset; op_pixels_func (*op_pix)[4]; @@ -3960,17 +4017,16 @@ static always_inline void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM bloc MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix); } }else{ + op_qpix= s->me.qpel_put; if ((!s->no_rounding) || s->pict_type==B_TYPE){ op_pix = s->dsp.put_pixels_tab; - op_qpix= s->dsp.put_qpel_pixels_tab; }else{ op_pix = s->dsp.put_no_rnd_pixels_tab; - op_qpix= s->dsp.put_no_rnd_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_FORWARD) { MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix, op_qpix); op_pix = s->dsp.avg_pixels_tab; - op_qpix= s->dsp.avg_qpel_pixels_tab; + op_qpix= s->me.qpel_avg; } if (s->mv_dir & MV_DIR_BACKWARD) { MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix, op_qpix); @@ -4134,7 +4190,7 @@ static inline void dct_single_coeff_elimination(MpegEncContext *s, int n, int th for(i=0; i<=last_index; i++){ const int j = s->intra_scantable.permutated[i]; - const int level = ABS(block[j]); + const int level = FFABS(block[j]); if(level==1){ if(skip_dc && i==0) continue; score+= tab[run]; @@ -4738,7 +4794,7 @@ static inline void encode_mb_hq(MpegEncContext *s, MpegEncContext *backup, MpegE } static int sse(MpegEncContext *s, uint8_t *src1, uint8_t *src2, int w, int h, int stride){ - uint32_t *sq = squareTbl + 256; + uint32_t *sq = ff_squareTbl + 256; int acc=0; int x,y; @@ -5219,9 +5275,10 @@ static int encode_thread(AVCodecContext *c, void *arg){ if(s->flags & CODEC_FLAG_QP_RD){ if(best_s.mv_type==MV_TYPE_16X16 && !(best_s.mv_dir&MV_DIRECT)){ const int last_qp= backup_s.qscale; - int dquant, dir, qp, dc[6]; + int qpi, qp, dc[6]; DCTELEM ac[6][16]; const int mvdir= (best_s.mv_dir&MV_DIR_BACKWARD) ? 1 : 0; + static const int dquant_tab[4]={-1,1,-2,2}; assert(backup_s.dquant == 0); @@ -5234,12 +5291,12 @@ static int encode_thread(AVCodecContext *c, void *arg){ s->mv[1][0][0] = best_s.mv[1][0][0]; s->mv[1][0][1] = best_s.mv[1][0][1]; - dir= s->pict_type == B_TYPE ? 2 : 1; - if(last_qp + dir > s->avctx->qmax) dir= -dir; - for(dquant= dir; dquant<=2 && dquant>=-2; dquant += dir){ + qpi = s->pict_type == B_TYPE ? 2 : 0; + for(; qpi<4; qpi++){ + int dquant= dquant_tab[qpi]; qp= last_qp + dquant; if(qp < s->avctx->qmin || qp > s->avctx->qmax) - break; + continue; backup_s.dquant= dquant; if(s->mb_intra && s->dc_val[0]){ for(i=0; i<6; i++){ @@ -5257,11 +5314,6 @@ static int encode_thread(AVCodecContext *c, void *arg){ memcpy(s->ac_val[0][s->block_index[i]], ac[i], sizeof(DCTELEM)*16); } } - if(dir > 0 && dquant==dir){ - dquant= 0; - dir= -dir; - }else - break; } } qp= best_s.qscale; @@ -5514,10 +5566,17 @@ static void merge_context_after_encode(MpegEncContext *dst, MpegEncContext *src) flush_put_bits(&dst->pb); } -static void estimate_qp(MpegEncContext *s, int dry_run){ - if (!s->fixed_qscale) +static int estimate_qp(MpegEncContext *s, int dry_run){ + if (s->next_lambda){ + s->current_picture_ptr->quality= + s->current_picture.quality = s->next_lambda; + if(!dry_run) s->next_lambda= 0; + } else if (!s->fixed_qscale) { s->current_picture_ptr->quality= s->current_picture.quality = ff_rate_estimate_qscale(s, dry_run); + if (s->current_picture.quality < 0) + return -1; + } if(s->adaptive_quant){ /* xine: do not need this for decode or MPEG-1 encoding modes */ @@ -5540,9 +5599,10 @@ static void estimate_qp(MpegEncContext *s, int dry_run){ s->lambda= s->current_picture.quality; //printf("%d %d\n", s->avctx->global_quality, s->current_picture.quality); update_qscale(s); + return 0; } -static void encode_picture(MpegEncContext *s, int picture_number) +static int encode_picture(MpegEncContext *s, int picture_number) { int i; int bits; @@ -5574,7 +5634,8 @@ static void encode_picture(MpegEncContext *s, int picture_number) } if(s->flags & CODEC_FLAG_PASS2){ - estimate_qp(s, 1); + if (estimate_qp(s,1) < 0) + return -1; ff_get_2pass_fcode(s); }else if(!(s->flags & CODEC_FLAG_QSCALE)){ if(s->pict_type==B_TYPE) @@ -5596,7 +5657,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) /* Estimate motion for every MB */ if(s->pict_type != I_TYPE){ s->lambda = (s->lambda * s->avctx->me_penalty_compensation + 128)>>8; - s->lambda2= (s->lambda2* s->avctx->me_penalty_compensation + 128)>>8; + s->lambda2= (s->lambda2* (int64_t)s->avctx->me_penalty_compensation + 128)>>8; if(s->pict_type != B_TYPE && s->avctx->me_threshold==0){ if((s->avctx->pre_me && s->last_non_b_pict_type==I_TYPE) || s->avctx->pre_me==2){ s->avctx->execute(s->avctx, pre_estimate_motion_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count); @@ -5687,7 +5748,8 @@ static void encode_picture(MpegEncContext *s, int picture_number) } #endif /* #if 0 */ - estimate_qp(s, 0); + if (estimate_qp(s, 0) < 0) + return -1; if(s->qscale < 3 && s->max_qcoeff<=128 && s->pict_type==I_TYPE && !(s->flags & CODEC_FLAG_QSCALE)) s->qscale= 3; //reduce clipping problems @@ -5769,10 +5831,9 @@ static void encode_picture(MpegEncContext *s, int picture_number) merge_context_after_encode(s, s->thread_context[i]); } emms_c(); + return 0; } -#endif //CONFIG_ENCODERS - static void denoise_dct_c(MpegEncContext *s, DCTELEM *block){ const int intra= s->mb_intra; int i; @@ -5797,8 +5858,6 @@ static void denoise_dct_c(MpegEncContext *s, DCTELEM *block){ } } -#ifdef CONFIG_ENCODERS - static int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow){ @@ -5917,13 +5976,13 @@ static int dct_quantize_trellis_c(MpegEncContext *s, for(i=start_i; i<=last_non_zero; i++){ int level_index, j; - const int dct_coeff= ABS(block[ scantable[i] ]); + const int dct_coeff= FFABS(block[ scantable[i] ]); const int zero_distoration= dct_coeff*dct_coeff; int best_score=256*256*256*120; for(level_index=0; level_index < coeff_count[i]; level_index++){ int distoration; int level= coeff[level_index][i]; - const int alevel= ABS(level); + const int alevel= FFABS(level); int unquant_coeff; assert(level); @@ -6033,7 +6092,7 @@ static int dct_quantize_trellis_c(MpegEncContext *s, s->coded_score[n] = last_score; - dc= ABS(block[0]); + dc= FFABS(block[0]); last_non_zero= last_i - 1; memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM)); @@ -6046,7 +6105,7 @@ static int dct_quantize_trellis_c(MpegEncContext *s, for(i=0; iout_format == FMT_H263){ @@ -6188,7 +6247,7 @@ STOP_TIMER("memset rem[]")} int qns=4; int w; - w= ABS(weight[i]) + qns*one; + w= FFABS(weight[i]) + qns*one; w= 15 + (48*qns*one + w/2)/w; // 16 .. 63 weight[i] = w; @@ -6312,7 +6371,7 @@ STOP_TIMER("dct")} int score, new_coeff, unquant_change; score=0; - if(s->avctx->quantizer_noise_shaping < 2 && ABS(new_level) > ABS(level)) + if(s->avctx->quantizer_noise_shaping < 2 && FFABS(new_level) > FFABS(level)) continue; if(new_level){ @@ -6332,7 +6391,7 @@ STOP_TIMER("dct")} - last_length[UNI_AC_ENC_INDEX(run, level+64)]; } }else{ - assert(ABS(new_level)==1); + assert(FFABS(new_level)==1); if(analyze_gradient){ int g= d1[ scantable[i] ]; @@ -6365,7 +6424,7 @@ STOP_TIMER("dct")} } }else{ new_coeff=0; - assert(ABS(level)==1); + assert(FFABS(level)==1); if(i < last_non_zero){ int next_i= i + run2 + 1; @@ -6433,7 +6492,7 @@ after_last++; #ifdef REFINE_STATS if(block[j]){ if(block[j] - best_change){ - if(ABS(block[j]) > ABS(block[j] - best_change)){ + if(FFABS(block[j]) > FFABS(block[j] - best_change)){ raise++; }else{ lower++; @@ -6905,7 +6964,7 @@ AVCodec mjpeg_encoder = { MPV_encode_init, MPV_encode_picture, MPV_encode_end, - .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUVJ420P, -1}, + .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, -1}, }; #endif //CONFIG_ENCODERS diff --git a/src/libffmpeg/libavcodec/mpegvideo.h b/src/libffmpeg/libavcodec/mpegvideo.h index 023e65700..011678a42 100644 --- a/src/libffmpeg/libavcodec/mpegvideo.h +++ b/src/libffmpeg/libavcodec/mpegvideo.h @@ -3,18 +3,20 @@ * Copyright (c) 2000, 2001, 2002 Fabrice Bellard. * Copyright (c) 2002-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -28,6 +30,8 @@ #include "dsputil.h" #include "bitstream.h" +#include "ratecontrol.h" +#include "parser.h" #define FRAME_SKIPPED 100 ///< return value for header parsers if frame is not coded @@ -72,60 +76,6 @@ enum OutputFormat { #define INPLACE_OFFSET 16 -typedef struct Predictor{ - double coeff; - double count; - double decay; -} Predictor; - -typedef struct RateControlEntry{ - int pict_type; - float qscale; - int mv_bits; - int i_tex_bits; - int p_tex_bits; - int misc_bits; - int header_bits; - uint64_t expected_bits; - int new_pict_type; - float new_qscale; - int mc_mb_var_sum; - int mb_var_sum; - int i_count; - int skip_count; - int f_code; - int b_code; -}RateControlEntry; - -/** - * rate control context. - */ -typedef struct RateControlContext{ - FILE *stats_file; - int num_entries; ///< number of RateControlEntries - RateControlEntry *entry; - double buffer_index; ///< amount of bits in the video/audio buffer - Predictor pred[5]; - double short_term_qsum; ///< sum of recent qscales - double short_term_qcount; ///< count of recent qscales - double pass1_rc_eq_output_sum;///< sum of the output of the rc equation, this is used for normalization - double pass1_wanted_bits; ///< bits which should have been outputed by the pass1 code (including complexity init) - double last_qscale; - double last_qscale_for[5]; ///< last qscale for a specific pict type, used for max_diff & ipb factor stuff - int last_mc_mb_var_sum; - int last_mb_var_sum; - uint64_t i_cplx_sum[5]; - uint64_t p_cplx_sum[5]; - uint64_t mv_bits_sum[5]; - uint64_t qscale_sum[5]; - int frame_count[5]; - int last_non_b_pict_type; - - void *non_lavc_opaque; ///< context for non lavc rc code (for example xvid) - float dry_run_qscale; ///< for xvid rc - int last_picture_number; ///< for xvid rc -}RateControlContext; - /** * Scantable. */ @@ -193,17 +143,6 @@ typedef struct Picture{ int b_frame_score; /* */ } Picture; -typedef struct ParseContext{ - uint8_t *buffer; - int index; - int last_index; - unsigned int buffer_size; - uint32_t state; ///< contains the last few bytes in MSB order - int frame_start_found; - int overread; ///< the number of bytes which where irreversibly read from the next frame - int overread_index; ///< the index into ParseContext.buffer of the overreaded bytes -} ParseContext; - struct MpegEncContext; /** @@ -286,6 +225,8 @@ typedef struct MpegEncContext { int chroma_elim_threshold; int strict_std_compliance; ///< strictly follow the std (MPEG4, ...) int workaround_bugs; ///< workaround bugs in encoders which cannot be detected automatically + int codec_tag; ///< internal codec_tag upper case converted from avctx codec_tag + int stream_codec_tag; ///< internal stream_codec_tag upper case converted from avctx stream_codec_tag /* the following fields are managed internally by the encoder */ /** bit output */ @@ -372,8 +313,8 @@ typedef struct MpegEncContext { int qscale; ///< QP int chroma_qscale; ///< chroma QP - int lambda; ///< lagrange multipler used in rate distortion - int lambda2; ///< (lambda*lambda) >> FF_LAMBDA_SHIFT + unsigned int lambda; ///< lagrange multipler used in rate distortion + unsigned int lambda2; ///< (lambda*lambda) >> FF_LAMBDA_SHIFT int *lambda_table; int adaptive_quant; ///< use adaptive quantization int dquant; ///< qscale difference to prev qscale @@ -512,6 +453,7 @@ typedef struct MpegEncContext { int64_t wanted_bits; int64_t total_bits; int frame_bits; ///< bits used for the current frame + int next_lambda; ///< next lambda used for retrying to encode a frame RateControlContext rc_context; ///< contains stuff only accessed in ratecontrol.c /* statistics, used for 2-pass encoding */ @@ -767,12 +709,9 @@ void ff_init_scantable(uint8_t *, ScanTable *st, const uint8_t *src_scantable); void ff_draw_horiz_band(MpegEncContext *s, int y, int h); void ff_emulated_edge_mc(uint8_t *buf, uint8_t *src, int linesize, int block_w, int block_h, int src_x, int src_y, int w, int h); -#define END_NOT_FOUND -100 -int ff_combine_frame(ParseContext *pc, int next, uint8_t **buf, int *buf_size); -void ff_parse_close(AVCodecParserContext *s); void ff_mpeg_flush(AVCodecContext *avctx); void ff_print_debug_info(MpegEncContext *s, AVFrame *pict); -void ff_write_quant_matrix(PutBitContext *pb, int16_t *matrix); +void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix); int ff_find_unused_picture(MpegEncContext *s, int shared); void ff_denoise_dct(MpegEncContext *s, DCTELEM *block); void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src); @@ -824,12 +763,12 @@ int ff_pre_estimate_p_frame_motion(MpegEncContext * s, int mb_x, int mb_y); inline int ff_epzs_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale, int size, int h); -int inline ff_get_mb_score(MpegEncContext * s, int mx, int my, int src_index, +inline int ff_get_mb_score(MpegEncContext * s, int mx, int my, int src_index, int ref_index, int size, int h, int add_rate); /* mpeg12.c */ -extern const int16_t ff_mpeg1_default_intra_matrix[64]; -extern const int16_t ff_mpeg1_default_non_intra_matrix[64]; +extern const uint16_t ff_mpeg1_default_intra_matrix[64]; +extern const uint16_t ff_mpeg1_default_non_intra_matrix[64]; extern const uint8_t ff_mpeg1_dc_scale_table[128]; void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number); @@ -839,7 +778,6 @@ void mpeg1_encode_mb(MpegEncContext *s, void ff_mpeg1_encode_init(MpegEncContext *s); void ff_mpeg1_encode_slice_header(MpegEncContext *s); void ff_mpeg1_clean_buffers(MpegEncContext *s); -int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size); /** RLTable. */ @@ -886,6 +824,7 @@ void ff_h261_encode_mb(MpegEncContext *s, int motion_x, int motion_y); void ff_h261_encode_picture_header(MpegEncContext * s, int picture_number); void ff_h261_encode_init(MpegEncContext *s); +int ff_h261_get_picture_format(int width, int height); /* h263.c, h263dec.c */ @@ -909,7 +848,11 @@ void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n, int dir); void ff_set_mpeg4_time(MpegEncContext * s, int picture_number); void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number); +#ifdef CONFIG_ENCODERS void h263_encode_init(MpegEncContext *s); +#else +static void h263_encode_init(MpegEncContext *s) {assert(0);} +#endif void h263_decode_init_vlc(MpegEncContext *s); int h263_decode_picture_header(MpegEncContext *s); int ff_h263_decode_gob_header(MpegEncContext *s); @@ -938,10 +881,10 @@ int ff_mpeg4_decode_partitions(MpegEncContext *s); int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s); int ff_h263_resync(MpegEncContext *s); int ff_h263_get_gob_height(MpegEncContext *s); +void ff_mpeg4_init_direct_mv(MpegEncContext *s); int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my); int ff_h263_round_chroma(int x); void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code); -int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size); /* rv10.c */ @@ -981,21 +924,5 @@ void mjpeg_picture_header(MpegEncContext *s); void mjpeg_picture_trailer(MpegEncContext *s); void ff_mjpeg_stuffing(PutBitContext * pbc); - -/* rate control */ -int ff_rate_control_init(MpegEncContext *s); -float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run); -void ff_write_pass1_stats(MpegEncContext *s); -void ff_rate_control_uninit(MpegEncContext *s); -double ff_eval(char *s, double *const_value, const char **const_name, - double (**func1)(void *, double), const char **func1_name, - double (**func2)(void *, double, double), char **func2_name, - void *opaque); -int ff_vbv_update(MpegEncContext *s, int frame_size); -void ff_get_2pass_fcode(MpegEncContext *s); - -int ff_xvid_rate_control_init(MpegEncContext *s); -void ff_xvid_rate_control_uninit(MpegEncContext *s); -float ff_xvid_rate_estimate_qscale(MpegEncContext *s, int dry_run); - #endif /* AVCODEC_MPEGVIDEO_H */ + diff --git a/src/libffmpeg/libavcodec/msmpeg4.c b/src/libffmpeg/libavcodec/msmpeg4.c index 6d83f5c6c..a8124172b 100644 --- a/src/libffmpeg/libavcodec/msmpeg4.c +++ b/src/libffmpeg/libavcodec/msmpeg4.c @@ -3,18 +3,20 @@ * Copyright (c) 2001 Fabrice Bellard. * Copyright (c) 2002-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * msmpeg4v1 & v2 stuff by Michael Niedermayer @@ -65,10 +67,10 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr); static int msmpeg4_decode_motion(MpegEncContext * s, int *mx_ptr, int *my_ptr); -static void msmpeg4v2_encode_motion(MpegEncContext * s, int val); static void init_h263_dc_for_msmpeg4(void); static inline void msmpeg4_memsetw(short *tab, int val, int n); #ifdef CONFIG_ENCODERS +static void msmpeg4v2_encode_motion(MpegEncContext * s, int val); static int get_size_of_code(MpegEncContext * s, RLTable *rl, int last, int run, int level, int intra); #endif //CONFIG_ENCODERS static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); @@ -627,7 +629,7 @@ static int get_dc(uint8_t *src, int stride, int scale) /* dir = 0: left, dir = 1: top prediction */ static inline int msmpeg4_pred_dc(MpegEncContext * s, int n, - uint16_t **dc_val_ptr, int *dir_ptr) + int16_t **dc_val_ptr, int *dir_ptr) { int a, b, c, wrap, pred, scale; int16_t *dc_val; @@ -657,7 +659,7 @@ static inline int msmpeg4_pred_dc(MpegEncContext * s, int n, necessitate to modify mpegvideo.c. The problem comes from the fact they decided to store the quantized DC (which would lead to problems if Q could vary !) */ -#if (defined(ARCH_X86) || defined(ARCH_X86_64)) && !defined PIC +#if (defined(ARCH_X86)) && !defined PIC asm volatile( "movl %3, %%eax \n\t" "shrl $1, %%eax \n\t" @@ -673,7 +675,7 @@ static inline int msmpeg4_pred_dc(MpegEncContext * s, int n, "mull %4 \n\t" "movl %%edx, %2 \n\t" : "+b" (a), "+c" (b), "+D" (c) - : "g" (scale), "S" (inverse[scale]) + : "g" (scale), "S" (ff_inverse[scale]) : "%eax", "%edx" ); #else @@ -787,7 +789,7 @@ static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int *dir_ptr /* update predictor */ *dc_val= level; }else{ - uint16_t *dc_val; + int16_t *dc_val; pred = msmpeg4_pred_dc(s, n, &dc_val, dir_ptr); /* update predictor */ @@ -1343,6 +1345,7 @@ static inline void msmpeg4_memsetw(short *tab, int val, int n) tab[i] = val; } +#ifdef CONFIG_ENCODERS static void msmpeg4v2_encode_motion(MpegEncContext * s, int val) { int range, bit_size, sign, code, bits; @@ -1375,6 +1378,7 @@ static void msmpeg4v2_encode_motion(MpegEncContext * s, int val) } } } +#endif /* this is identical to h263 except that its range is multiplied by 2 */ static int msmpeg4v2_decode_motion(MpegEncContext * s, int pred, int f_code) @@ -1712,7 +1716,7 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, //printf("level: %d, run: %d at %d %d\n", level, run, s->mb_x, s->mb_y); #if 0 // waste of time / this will detect very few errors { - const int abs_level= ABS(level); + const int abs_level= FFABS(level); const int run1= run - rl->max_run[last][abs_level] - run_diff; if(abs_level<=MAX_LEVEL && run<=MAX_RUN){ if(abs_level <= rl->max_level[last][run]){ @@ -1873,7 +1877,7 @@ static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr) /* update predictor */ *dc_val= level; }else{ - uint16_t *dc_val; + int16_t *dc_val; pred = msmpeg4_pred_dc(s, n, &dc_val, dir_ptr); level += pred; diff --git a/src/libffmpeg/libavcodec/msmpeg4data.h b/src/libffmpeg/libavcodec/msmpeg4data.h index 1fbd8aadf..d1ff70371 100644 --- a/src/libffmpeg/libavcodec/msmpeg4data.h +++ b/src/libffmpeg/libavcodec/msmpeg4data.h @@ -1,3 +1,27 @@ +/* + * MSMPEG4 backend for ffmpeg encoder and decoder + * copyright (c) 2001 Fabrice Bellard + * copyright (c) 2002-2004 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * msmpeg4v1 & v2 stuff by Michael Niedermayer + */ + /** * @file msmpeg4data.h * MSMPEG4 data tables. diff --git a/src/libffmpeg/libavcodec/msrle.c b/src/libffmpeg/libavcodec/msrle.c index 7cdbf7c77..fae5616e5 100644 --- a/src/libffmpeg/libavcodec/msrle.c +++ b/src/libffmpeg/libavcodec/msrle.c @@ -2,18 +2,20 @@ * Micrsoft RLE Video Decoder * Copyright (C) 2003 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/msvideo1.c b/src/libffmpeg/libavcodec/msvideo1.c index e8524b32e..5929e1c63 100644 --- a/src/libffmpeg/libavcodec/msvideo1.c +++ b/src/libffmpeg/libavcodec/msvideo1.c @@ -2,18 +2,20 @@ * Microsoft Video-1 Decoder * Copyright (C) 2003 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/nuv.c b/src/libffmpeg/libavcodec/nuv.c index d31518250..592d3de03 100644 --- a/src/libffmpeg/libavcodec/nuv.c +++ b/src/libffmpeg/libavcodec/nuv.c @@ -2,18 +2,20 @@ * NuppelVideo decoder * Copyright (c) 2006 Reimar Doeffinger * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include diff --git a/src/libffmpeg/libavcodec/opt.c b/src/libffmpeg/libavcodec/opt.c new file mode 100644 index 000000000..a200d9a82 --- /dev/null +++ b/src/libffmpeg/libavcodec/opt.c @@ -0,0 +1,381 @@ +/* + * AVOptions + * Copyright (c) 2005 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/** + * @file opt.c + * AVOptions + * @author Michael Niedermayer + */ + +#include "avcodec.h" +#include "opt.h" +#include "eval.h" + +//FIXME order them and do a bin search +static AVOption *find_opt(void *v, const char *name, const char *unit){ + AVClass *c= *(AVClass**)v; //FIXME silly way of storing AVClass + AVOption *o= c->option; + + for(;o && o->name; o++){ + if(!strcmp(o->name, name) && (!unit || !strcmp(o->unit, unit)) ) + return o; + } + return NULL; +} + +AVOption *av_next_option(void *obj, AVOption *last){ + if(last && last[1].name) return ++last; + else if(last) return NULL; + else return (*(AVClass**)obj)->option; +} + +static AVOption *av_set_number(void *obj, const char *name, double num, int den, int64_t intnum){ + AVOption *o= find_opt(obj, name, NULL); + void *dst; + if(!o || o->offset<=0) + return NULL; + + if(o->max*den < num*intnum || o->min*den > num*intnum) { + av_log(NULL, AV_LOG_ERROR, "Value %lf for parameter '%s' out of range.\n", num, name); + return NULL; + } + + dst= ((uint8_t*)obj) + o->offset; + + switch(o->type){ + case FF_OPT_TYPE_FLAGS: + case FF_OPT_TYPE_INT: *(int *)dst= lrintf(num/den)*intnum; break; + case FF_OPT_TYPE_INT64: *(int64_t *)dst= lrintf(num/den)*intnum; break; + case FF_OPT_TYPE_FLOAT: *(float *)dst= num*intnum/den; break; + case FF_OPT_TYPE_DOUBLE:*(double *)dst= num*intnum/den; break; + case FF_OPT_TYPE_RATIONAL: + if((int)num == num) *(AVRational*)dst= (AVRational){num*intnum, den}; + else *(AVRational*)dst= av_d2q(num*intnum/den, 1<<24); + default: + return NULL; + } + return o; +} + +static AVOption *set_all_opt(void *v, const char *unit, double d){ + AVClass *c= *(AVClass**)v; //FIXME silly way of storing AVClass + AVOption *o= c->option; + AVOption *ret=NULL; + + for(;o && o->name; o++){ + if(o->type != FF_OPT_TYPE_CONST && o->unit && !strcmp(o->unit, unit)){ + double tmp= d; + if(o->type == FF_OPT_TYPE_FLAGS) + tmp= av_get_int(v, o->name, NULL) | (int64_t)d; + + av_set_number(v, o->name, tmp, 1, 1); + ret= o; + } + } + return ret; +} + +static double const_values[]={ + M_PI, + M_E, + FF_QP2LAMBDA, + 0 +}; + +static const char *const_names[]={ + "PI", + "E", + "QP2LAMBDA", + 0 +}; + +AVOption *av_set_string(void *obj, const char *name, const char *val){ + AVOption *o= find_opt(obj, name, NULL); + if(o && o->offset==0 && o->type == FF_OPT_TYPE_CONST && o->unit){ + return set_all_opt(obj, o->unit, o->default_val); + } + if(!o || !val || o->offset<=0) + return NULL; + if(o->type != FF_OPT_TYPE_STRING){ + for(;;){ + int i; + char buf[256]; + int cmd=0; + double d; + char *error = NULL; + + if(*val == '+' || *val == '-') + cmd= *(val++); + + for(i=0; iunit); + if(o_named && o_named->type == FF_OPT_TYPE_CONST) + d= o_named->default_val; + else if(!strcmp(buf, "default")) d= o->default_val; + else if(!strcmp(buf, "max" )) d= o->max; + else if(!strcmp(buf, "min" )) d= o->min; + else { + if (!error) + av_log(NULL, AV_LOG_ERROR, "Unable to parse option value \"%s\": %s\n", val, error); + return NULL; + } + } + if(o->type == FF_OPT_TYPE_FLAGS){ + if (cmd=='+') d= av_get_int(obj, name, NULL) | (int64_t)d; + else if(cmd=='-') d= av_get_int(obj, name, NULL) &~(int64_t)d; + }else if(cmd=='-') + d= -d; + + av_set_number(obj, name, d, 1, 1); + if(!*val) + return o; + } + return NULL; + } + + memcpy(((uint8_t*)obj) + o->offset, val, sizeof(val)); + return o; +} + +AVOption *av_set_double(void *obj, const char *name, double n){ + return av_set_number(obj, name, n, 1, 1); +} + +AVOption *av_set_q(void *obj, const char *name, AVRational n){ + return av_set_number(obj, name, n.num, n.den, 1); +} + +AVOption *av_set_int(void *obj, const char *name, int64_t n){ + return av_set_number(obj, name, 1, 1, n); +} + +/** + * + * @param buf a buffer which is used for returning non string values as strings, can be NULL + * @param buf_len allocated length in bytes of buf + */ +const char *av_get_string(void *obj, const char *name, AVOption **o_out, char *buf, int buf_len){ + AVOption *o= find_opt(obj, name, NULL); + void *dst; + if(!o || o->offset<=0) + return NULL; + if(o->type != FF_OPT_TYPE_STRING && (!buf || !buf_len)) + return NULL; + + dst= ((uint8_t*)obj) + o->offset; + if(o_out) *o_out= o; + + if(o->type == FF_OPT_TYPE_STRING) + return dst; + + switch(o->type){ + case FF_OPT_TYPE_FLAGS: snprintf(buf, buf_len, "0x%08X",*(int *)dst);break; + case FF_OPT_TYPE_INT: snprintf(buf, buf_len, "%d" , *(int *)dst);break; + case FF_OPT_TYPE_INT64: snprintf(buf, buf_len, "%"PRId64, *(int64_t*)dst);break; + case FF_OPT_TYPE_FLOAT: snprintf(buf, buf_len, "%f" , *(float *)dst);break; + case FF_OPT_TYPE_DOUBLE: snprintf(buf, buf_len, "%f" , *(double *)dst);break; + case FF_OPT_TYPE_RATIONAL: snprintf(buf, buf_len, "%d/%d", ((AVRational*)dst)->num, ((AVRational*)dst)->den);break; + default: return NULL; + } + return buf; +} + +static int av_get_number(void *obj, const char *name, AVOption **o_out, double *num, int *den, int64_t *intnum){ + AVOption *o= find_opt(obj, name, NULL); + void *dst; + if(!o || o->offset<=0) + goto error; + + dst= ((uint8_t*)obj) + o->offset; + + if(o_out) *o_out= o; + + switch(o->type){ + case FF_OPT_TYPE_FLAGS: + case FF_OPT_TYPE_INT: *intnum= *(int *)dst;return 0; + case FF_OPT_TYPE_INT64: *intnum= *(int64_t*)dst;return 0; + case FF_OPT_TYPE_FLOAT: *num= *(float *)dst;return 0; + case FF_OPT_TYPE_DOUBLE: *num= *(double *)dst;return 0; + case FF_OPT_TYPE_RATIONAL: *intnum= ((AVRational*)dst)->num; + *den = ((AVRational*)dst)->den; + return 0; + } +error: + *den=*intnum=0; + return -1; +} + +double av_get_double(void *obj, const char *name, AVOption **o_out){ + int64_t intnum=1; + double num=1; + int den=1; + + av_get_number(obj, name, o_out, &num, &den, &intnum); + return num*intnum/den; +} + +AVRational av_get_q(void *obj, const char *name, AVOption **o_out){ + int64_t intnum=1; + double num=1; + int den=1; + + av_get_number(obj, name, o_out, &num, &den, &intnum); + if(num == 1.0 && (int)intnum == intnum) + return (AVRational){intnum, den}; + else + return av_d2q(num*intnum/den, 1<<24); +} + +int64_t av_get_int(void *obj, const char *name, AVOption **o_out){ + int64_t intnum=1; + double num=1; + int den=1; + + av_get_number(obj, name, o_out, &num, &den, &intnum); + return num*intnum/den; +} + +static void opt_list(void *obj, void *av_log_obj, char *unit) +{ + AVOption *opt=NULL; + + while((opt= av_next_option(obj, opt))){ + if(!(opt->flags & (AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM))) + continue; + + /* Don't print CONST's on level one. + * Don't print anything but CONST's on level two. + * Only print items from the requested unit. + */ + if (!unit && opt->type==FF_OPT_TYPE_CONST) + continue; + else if (unit && opt->type!=FF_OPT_TYPE_CONST) + continue; + else if (unit && opt->type==FF_OPT_TYPE_CONST && strcmp(unit, opt->unit)) + continue; + else if (unit && opt->type == FF_OPT_TYPE_CONST) + av_log(av_log_obj, AV_LOG_INFO, " %-15s ", opt->name); + else + av_log(av_log_obj, AV_LOG_INFO, "-%-17s ", opt->name); + + switch( opt->type ) + { + case FF_OPT_TYPE_FLAGS: + av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" ); + break; + case FF_OPT_TYPE_INT: + av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" ); + break; + case FF_OPT_TYPE_INT64: + av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" ); + break; + case FF_OPT_TYPE_DOUBLE: + av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" ); + break; + case FF_OPT_TYPE_FLOAT: + av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" ); + break; + case FF_OPT_TYPE_STRING: + av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" ); + break; + case FF_OPT_TYPE_RATIONAL: + av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" ); + break; + case FF_OPT_TYPE_CONST: + default: + av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" ); + break; + } + av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_ENCODING_PARAM) ? 'E' : '.'); + av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_DECODING_PARAM) ? 'D' : '.'); + av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_VIDEO_PARAM ) ? 'V' : '.'); + av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_AUDIO_PARAM ) ? 'A' : '.'); + av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_SUBTITLE_PARAM) ? 'S' : '.'); + + if(opt->help) + av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help); + av_log(av_log_obj, AV_LOG_INFO, "\n"); + if (opt->unit && opt->type != FF_OPT_TYPE_CONST) { + opt_list(obj, av_log_obj, opt->unit); + } + } +} + +int av_opt_show(void *obj, void *av_log_obj){ + if(!obj) + return -1; + + av_log(av_log_obj, AV_LOG_INFO, "%s AVOptions:\n", (*(AVClass**)obj)->class_name); + + opt_list(obj, av_log_obj, NULL); + + return 0; +} + +/** Set the values of the AVCodecContext or AVFormatContext structure. + * They are set to the defaults specified in the according AVOption options + * array default_val field. + * + * @param s AVCodecContext or AVFormatContext for which the defaults will be set + */ +void av_opt_set_defaults(void *s) +{ + AVOption *opt = NULL; + while ((opt = av_next_option(s, opt)) != NULL) { + switch(opt->type) { + case FF_OPT_TYPE_CONST: + /* Nothing to be done here */ + break; + case FF_OPT_TYPE_FLAGS: + case FF_OPT_TYPE_INT: { + int val; + val = opt->default_val; + av_set_int(s, opt->name, val); + } + break; + case FF_OPT_TYPE_FLOAT: { + double val; + val = opt->default_val; + av_set_double(s, opt->name, val); + } + break; + case FF_OPT_TYPE_RATIONAL: { + AVRational val; + val = av_d2q(opt->default_val, INT_MAX); + av_set_q(s, opt->name, val); + } + break; + case FF_OPT_TYPE_STRING: + /* Cannot set default for string as default_val is of type * double */ + break; + default: + av_log(s, AV_LOG_DEBUG, "AVOption type %d of option %s not implemented yet\n", opt->type, opt->name); + } + } +} + diff --git a/src/libffmpeg/libavcodec/opt.h b/src/libffmpeg/libavcodec/opt.h index 058c6b63a..b8a17031b 100644 --- a/src/libffmpeg/libavcodec/opt.h +++ b/src/libffmpeg/libavcodec/opt.h @@ -1,3 +1,24 @@ +/* + * AVOptions + * copyright (c) 2005 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #ifndef AVOPT_H #define AVOPT_H @@ -57,5 +78,6 @@ int64_t av_get_int(void *obj, const char *name, AVOption **o_out); const char *av_get_string(void *obj, const char *name, AVOption **o_out, char *buf, int buf_len); AVOption *av_next_option(void *obj, AVOption *last); int av_opt_show(void *obj, void *av_log_obj); +void av_opt_set_defaults(void *s); #endif diff --git a/src/libffmpeg/libavcodec/parser.c b/src/libffmpeg/libavcodec/parser.c index 59087cdb8..72a3e55a3 100644 --- a/src/libffmpeg/libavcodec/parser.c +++ b/src/libffmpeg/libavcodec/parser.c @@ -3,23 +3,26 @@ * Copyright (c) 2003 Fabrice Bellard. * Copyright (c) 2003 Michael Niedermayer. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avcodec.h" #include "mpegvideo.h" #include "mpegaudio.h" +#include "parser.h" AVCodecParser *av_first_parser = NULL; @@ -69,8 +72,29 @@ AVCodecParserContext *av_parser_init(int codec_id) return s; } -/* NOTE: buf_size == 0 is used to signal EOF so that the last frame - can be returned if necessary */ +/** + * + * @param buf input + * @param buf_size input length, to signal EOF, this should be 0 (so that the last frame can be output) + * @param pts input presentation timestamp + * @param dts input decoding timestamp + * @param poutbuf will contain a pointer to the first byte of the output frame + * @param poutbuf_size will contain the length of the output frame + * @return the number of bytes of the input bitstream used + * + * Example: + * @code + * while(in_len){ + * len = av_parser_parse(myparser, AVCodecContext, &data, &size, + * in_data, in_len, + * pts, dts); + * in_data += len; + * in_len -= len; + * + * decode_frame(data, size); + * } + * @endcode + */ int av_parser_parse(AVCodecParserContext *s, AVCodecContext *avctx, uint8_t **poutbuf, int *poutbuf_size, @@ -104,7 +128,7 @@ int av_parser_parse(AVCodecParserContext *s, /* WARNING: the returned index can be negative */ index = s->parser->parser_parse(s, avctx, poutbuf, poutbuf_size, buf, buf_size); -//av_log(NULL, AV_LOG_DEBUG, "parser: in:%lld, %lld, out:%lld, %lld, in:%d out:%d id:%d\n", pts, dts, s->last_pts, s->last_dts, buf_size, *poutbuf_size, avctx->codec_id); +//av_log(NULL, AV_LOG_DEBUG, "parser: in:%"PRId64", %"PRId64", out:%"PRId64", %"PRId64", in:%d out:%d id:%d\n", pts, dts, s->last_pts, s->last_dts, buf_size, *poutbuf_size, avctx->codec_id); /* update the file pointer */ if (*poutbuf_size) { /* fill the data for the current frame */ @@ -190,27 +214,6 @@ void av_parser_close(AVCodecParserContext *s) /*****************************************************/ -//#define END_NOT_FOUND (-100) - -#define PICTURE_START_CODE 0x00000100 -#define SEQ_START_CODE 0x000001b3 -#define EXT_START_CODE 0x000001b5 -#define SLICE_MIN_START_CODE 0x00000101 -#define SLICE_MAX_START_CODE 0x000001af - -typedef struct ParseContext1{ - ParseContext pc; -/* XXX/FIXME PC1 vs. PC */ - /* MPEG2 specific */ - int frame_rate; - int progressive_sequence; - int width, height; - - /* XXX: suppress that, needed by MPEG4 */ - MpegEncContext *enc; - int first_picture; -} ParseContext1; - /** * combines the (truncated) bitstream to a complete frame * @returns -1 if no complete frame could be created @@ -273,186 +276,6 @@ int ff_combine_frame(ParseContext *pc, int next, uint8_t **buf, int *buf_size) return 0; } -/* XXX: merge with libavcodec ? */ -#define MPEG1_FRAME_RATE_BASE 1001 - -static const int frame_rate_tab[16] = { - 0, - 24000, - 24024, - 25025, - 30000, - 30030, - 50050, - 60000, - 60060, - // Xing's 15fps: (9) - 15015, - // libmpeg3's "Unofficial economy rates": (10-13) - 5005, - 10010, - 12012, - 15015, - // random, just to avoid segfault !never encode these - 25025, - 25025, -}; - -#ifdef CONFIG_MPEGVIDEO_PARSER -//FIXME move into mpeg12.c -static void mpegvideo_extract_headers(AVCodecParserContext *s, - AVCodecContext *avctx, - const uint8_t *buf, int buf_size) -{ - ParseContext1 *pc = s->priv_data; - const uint8_t *buf_end; - int32_t start_code; - int frame_rate_index, ext_type, bytes_left; - int frame_rate_ext_n, frame_rate_ext_d; - int picture_structure, top_field_first, repeat_first_field, progressive_frame; - int horiz_size_ext, vert_size_ext, bit_rate_ext; -//FIXME replace the crap with get_bits() - s->repeat_pict = 0; - buf_end = buf + buf_size; - while (buf < buf_end) { - start_code= -1; - buf= ff_find_start_code(buf, buf_end, &start_code); - bytes_left = buf_end - buf; - switch(start_code) { - case PICTURE_START_CODE: - if (bytes_left >= 2) { - s->pict_type = (buf[1] >> 3) & 7; - } - break; - case SEQ_START_CODE: - if (bytes_left >= 7) { - pc->width = (buf[0] << 4) | (buf[1] >> 4); - pc->height = ((buf[1] & 0x0f) << 8) | buf[2]; - avcodec_set_dimensions(avctx, pc->width, pc->height); - frame_rate_index = buf[3] & 0xf; - pc->frame_rate = avctx->time_base.den = frame_rate_tab[frame_rate_index]; - avctx->time_base.num = MPEG1_FRAME_RATE_BASE; - avctx->bit_rate = ((buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6))*400; - avctx->codec_id = CODEC_ID_MPEG1VIDEO; - avctx->sub_id = 1; - } - break; - case EXT_START_CODE: - if (bytes_left >= 1) { - ext_type = (buf[0] >> 4); - switch(ext_type) { - case 0x1: /* sequence extension */ - if (bytes_left >= 6) { - horiz_size_ext = ((buf[1] & 1) << 1) | (buf[2] >> 7); - vert_size_ext = (buf[2] >> 5) & 3; - bit_rate_ext = ((buf[2] & 0x1F)<<7) | (buf[3]>>1); - frame_rate_ext_n = (buf[5] >> 5) & 3; - frame_rate_ext_d = (buf[5] & 0x1f); - pc->progressive_sequence = buf[1] & (1 << 3); - avctx->has_b_frames= !(buf[5] >> 7); - - pc->width |=(horiz_size_ext << 12); - pc->height |=( vert_size_ext << 12); - avctx->bit_rate += (bit_rate_ext << 18) * 400; - avcodec_set_dimensions(avctx, pc->width, pc->height); - avctx->time_base.den = pc->frame_rate * (frame_rate_ext_n + 1); - avctx->time_base.num = MPEG1_FRAME_RATE_BASE * (frame_rate_ext_d + 1); - avctx->codec_id = CODEC_ID_MPEG2VIDEO; - avctx->sub_id = 2; /* forces MPEG2 */ - } - break; - case 0x8: /* picture coding extension */ - if (bytes_left >= 5) { - picture_structure = buf[2]&3; - top_field_first = buf[3] & (1 << 7); - repeat_first_field = buf[3] & (1 << 1); - progressive_frame = buf[4] & (1 << 7); - - /* check if we must repeat the frame */ - if (repeat_first_field) { - if (pc->progressive_sequence) { - if (top_field_first) - s->repeat_pict = 4; - else - s->repeat_pict = 2; - } else if (progressive_frame) { - s->repeat_pict = 1; - } - } - - /* the packet only represents half a frame - XXX,FIXME maybe find a different solution */ - if(picture_structure != 3) - s->repeat_pict = -1; - } - break; - } - } - break; - case -1: - goto the_end; - default: - /* we stop parsing when we encounter a slice. It ensures - that this function takes a negligible amount of time */ - if (start_code >= SLICE_MIN_START_CODE && - start_code <= SLICE_MAX_START_CODE) - goto the_end; - break; - } - } - the_end: ; -} - -static int mpegvideo_parse(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size) -{ - ParseContext1 *pc1 = s->priv_data; - ParseContext *pc= &pc1->pc; - int next; - - if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){ - next= buf_size; - }else{ - next= ff_mpeg1_find_frame_end(pc, buf, buf_size); - - if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) { - *poutbuf = NULL; - *poutbuf_size = 0; - return buf_size; - } - - } - /* we have a full frame : we just parse the first few MPEG headers - to have the full timing information. The time take by this - function should be negligible for uncorrupted streams */ - mpegvideo_extract_headers(s, avctx, buf, buf_size); -#if 0 - printf("pict_type=%d frame_rate=%0.3f repeat_pict=%d\n", - s->pict_type, (double)avctx->time_base.den / avctx->time_base.num, s->repeat_pict); -#endif - - *poutbuf = (uint8_t *)buf; - *poutbuf_size = buf_size; - return next; -} - -static int mpegvideo_split(AVCodecContext *avctx, - const uint8_t *buf, int buf_size) -{ - int i; - uint32_t state= -1; - - for(i=0; i= 0x100) - return i-3; - } - return 0; -} -#endif /* CONFIG_MPEGVIDEO_PARSER */ - void ff_parse_close(AVCodecParserContext *s) { ParseContext *pc = s->priv_data; @@ -460,7 +283,7 @@ void ff_parse_close(AVCodecParserContext *s) av_free(pc->buffer); } -static void parse1_close(AVCodecParserContext *s) +void ff_parse1_close(AVCodecParserContext *s) { ParseContext1 *pc1 = s->priv_data; @@ -538,33 +361,7 @@ static int mpeg4video_parse(AVCodecParserContext *s, } #endif -#ifdef CONFIG_CAVSVIDEO_PARSER -static int cavsvideo_parse(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size) -{ - ParseContext *pc = s->priv_data; - int next; - - if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){ - next= buf_size; - }else{ - next= ff_cavs_find_frame_end(pc, buf, buf_size); - - if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) { - *poutbuf = NULL; - *poutbuf_size = 0; - return buf_size; - } - } - *poutbuf = (uint8_t *)buf; - *poutbuf_size = buf_size; - return next; -} -#endif /* CONFIG_CAVSVIDEO_PARSER */ - -static int mpeg4video_split(AVCodecContext *avctx, +int ff_mpeg4video_split(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { int i; @@ -634,9 +431,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1, } /* no header seen : find one. We need at least MPA_HEADER_SIZE bytes to parse it */ - len = MPA_HEADER_SIZE - len; - if (len > buf_size) - len = buf_size; + len = FFMIN(MPA_HEADER_SIZE - len, buf_size); if (len > 0) { memcpy(s->inbuf_ptr, buf_ptr, len); buf_ptr += len; @@ -645,11 +440,10 @@ static int mpegaudio_parse(AVCodecParserContext *s1, } if ((s->inbuf_ptr - s->inbuf) >= MPA_HEADER_SIZE) { got_header: - sr= avctx->sample_rate; header = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) | (s->inbuf[2] << 8) | s->inbuf[3]; - ret = mpa_decode_header(avctx, header); + ret = mpa_decode_header(avctx, header, &sr); if (ret < 0) { s->header_count= -2; /* no sync found : move by one byte (inefficient, but simple!) */ @@ -673,8 +467,8 @@ static int mpegaudio_parse(AVCodecParserContext *s1, } #endif } - if(s->header_count <= 0) - avctx->sample_rate= sr; //FIXME ugly + if(s->header_count > 1) + avctx->sample_rate= sr; } } else #if 0 @@ -736,14 +530,25 @@ static int mpegaudio_parse(AVCodecParserContext *s1, if (len < s->frame_size) { if (s->frame_size > MPA_MAX_CODED_FRAME_SIZE) s->frame_size = MPA_MAX_CODED_FRAME_SIZE; - len = s->frame_size - len; - if (len > buf_size) - len = buf_size; + len = FFMIN(s->frame_size - len, buf_size); memcpy(s->inbuf_ptr, buf_ptr, len); buf_ptr += len; s->inbuf_ptr += len; buf_size -= len; } + + if(s->frame_size > 0 && buf_ptr - buf == s->inbuf_ptr - s->inbuf + && buf_size + buf_ptr - buf >= s->frame_size){ + if(s->header_count > 0){ + *poutbuf = buf; + *poutbuf_size = s->frame_size; + } + buf_ptr = buf + s->frame_size; + s->inbuf_ptr = s->inbuf; + s->frame_size = 0; + break; + } + // next_data: if (s->frame_size > 0 && (s->inbuf_ptr - s->inbuf) >= s->frame_size) { @@ -1016,34 +821,14 @@ static int ac3_parse(AVCodecParserContext *s1, } #endif /* CONFIG_AC3_PARSER || CONFIG_AAC_PARSER */ -#ifdef CONFIG_MPEGVIDEO_PARSER -AVCodecParser mpegvideo_parser = { - { CODEC_ID_MPEG1VIDEO, CODEC_ID_MPEG2VIDEO }, - sizeof(ParseContext1), - NULL, - mpegvideo_parse, - parse1_close, - mpegvideo_split, -}; -#endif #ifdef CONFIG_MPEG4VIDEO_PARSER AVCodecParser mpeg4video_parser = { { CODEC_ID_MPEG4 }, sizeof(ParseContext1), mpeg4video_parse_init, mpeg4video_parse, - parse1_close, - mpeg4video_split, -}; -#endif -#ifdef CONFIG_CAVSVIDEO_PARSER -AVCodecParser cavsvideo_parser = { - { CODEC_ID_CAVS }, - sizeof(ParseContext1), - NULL, - cavsvideo_parse, - parse1_close, - mpeg4video_split, + ff_parse1_close, + ff_mpeg4video_split, }; #endif #ifdef CONFIG_MPEGAUDIO_PARSER diff --git a/src/libffmpeg/libavcodec/parser.h b/src/libffmpeg/libavcodec/parser.h new file mode 100644 index 000000000..3496b341f --- /dev/null +++ b/src/libffmpeg/libavcodec/parser.h @@ -0,0 +1,63 @@ +/* + * AVCodecParser prototypes and definitions + * Copyright (c) 2003 Fabrice Bellard. + * Copyright (c) 2003 Michael Niedermayer. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef FFMPEG_PARSER_H +#define FFMPEG_PARSER_H + +typedef struct ParseContext{ + uint8_t *buffer; + int index; + int last_index; + unsigned int buffer_size; + uint32_t state; ///< contains the last few bytes in MSB order + int frame_start_found; + int overread; ///< the number of bytes which where irreversibly read from the next frame + int overread_index; ///< the index into ParseContext.buffer of the overreaded bytes +} ParseContext; + +struct MpegEncContext; + +typedef struct ParseContext1{ + ParseContext pc; +/* XXX/FIXME PC1 vs. PC */ + /* MPEG2 specific */ + AVRational frame_rate; + int progressive_sequence; + int width, height; + + /* XXX: suppress that, needed by MPEG4 */ + struct MpegEncContext *enc; + int first_picture; +} ParseContext1; + +#define END_NOT_FOUND (-100) + +int ff_combine_frame(ParseContext *pc, int next, uint8_t **buf, int *buf_size); +int ff_mpeg4video_split(AVCodecContext *avctx, const uint8_t *buf, + int buf_size); +void ff_parse_close(AVCodecParserContext *s); +void ff_parse1_close(AVCodecParserContext *s); + +/* h263dec.c */ +int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size); + +#endif /* !FFMPEG_PARSER_H */ diff --git a/src/libffmpeg/libavcodec/pcm.c b/src/libffmpeg/libavcodec/pcm.c index 0b4dd1c86..26c38b329 100644 --- a/src/libffmpeg/libavcodec/pcm.c +++ b/src/libffmpeg/libavcodec/pcm.c @@ -2,18 +2,20 @@ * PCM codecs * Copyright (c) 2001 Fabrice Bellard. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/ppc/dsputil_altivec.c b/src/libffmpeg/libavcodec/ppc/dsputil_altivec.c index 81a32c9e3..6f48893a4 100644 --- a/src/libffmpeg/libavcodec/ppc/dsputil_altivec.c +++ b/src/libffmpeg/libavcodec/ppc/dsputil_altivec.c @@ -3,18 +3,20 @@ * Copyright (c) 2002 Dieter Shirley * Copyright (c) 2003-2004 Romain Dolbeau * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -616,61 +618,28 @@ void diff_pixels_altivec(DCTELEM *restrict block, const uint8_t *s1, } void add_bytes_altivec(uint8_t *dst, uint8_t *src, int w) { -#ifdef ALTIVEC_USE_REFERENCE_C_CODE - int i; - for(i=0; i+7l))) - - ((((*((uint32_t *) (block))) ^ - ((((const struct unaligned_32 *) (pixels))-> - l))) & 0xFEFEFEFEUL) >> 1)); - *((uint32_t *) (block + 4)) = - (((*((uint32_t *) (block + 4))) | - ((((const struct unaligned_32 *) (pixels + 4))->l))) - - ((((*((uint32_t *) (block + 4))) ^ - ((((const struct unaligned_32 *) (pixels + - 4))-> - l))) & 0xFEFEFEFEUL) >> 1)); - pixels += line_size; - block += line_size; - } -POWERPC_PERF_STOP_COUNT(altivec_avg_pixels8_num, 1); - -#else /* ALTIVEC_USE_REFERENCE_C_CODE */ register vector unsigned char pixelsv1, pixelsv2, pixelsv, blockv; int i; @@ -830,52 +755,12 @@ POWERPC_PERF_START_COUNT(altivec_avg_pixels8_num, 1); } POWERPC_PERF_STOP_COUNT(altivec_avg_pixels8_num, 1); - -#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ } /* next one assumes that ((line_size % 8) == 0) */ void put_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h) { POWERPC_PERF_DECLARE(altivec_put_pixels8_xy2_num, 1); -#ifdef ALTIVEC_USE_REFERENCE_C_CODE - int j; -POWERPC_PERF_START_COUNT(altivec_put_pixels8_xy2_num, 1); - for (j = 0; j < 2; j++) { - int i; - const uint32_t a = (((const struct unaligned_32 *) (pixels))->l); - const uint32_t b = - (((const struct unaligned_32 *) (pixels + 1))->l); - uint32_t l0 = - (a & 0x03030303UL) + (b & 0x03030303UL) + 0x02020202UL; - uint32_t h0 = - ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); - uint32_t l1, h1; - pixels += line_size; - for (i = 0; i < h; i += 2) { - uint32_t a = (((const struct unaligned_32 *) (pixels))->l); - uint32_t b = (((const struct unaligned_32 *) (pixels + 1))->l); - l1 = (a & 0x03030303UL) + (b & 0x03030303UL); - h1 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); - *((uint32_t *) block) = - h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); - pixels += line_size; - block += line_size; - a = (((const struct unaligned_32 *) (pixels))->l); - b = (((const struct unaligned_32 *) (pixels + 1))->l); - l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x02020202UL; - h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); - *((uint32_t *) block) = - h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); - pixels += line_size; - block += line_size; - } pixels += 4 - line_size * (h + 1); - block += 4 - line_size * h; - } - -POWERPC_PERF_STOP_COUNT(altivec_put_pixels8_xy2_num, 1); - -#else /* ALTIVEC_USE_REFERENCE_C_CODE */ register int i; register vector unsigned char pixelsv1, pixelsv2, @@ -946,51 +831,12 @@ POWERPC_PERF_START_COUNT(altivec_put_pixels8_xy2_num, 1); } POWERPC_PERF_STOP_COUNT(altivec_put_pixels8_xy2_num, 1); -#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ } /* next one assumes that ((line_size % 8) == 0) */ void put_no_rnd_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h) { POWERPC_PERF_DECLARE(altivec_put_no_rnd_pixels8_xy2_num, 1); -#ifdef ALTIVEC_USE_REFERENCE_C_CODE - int j; -POWERPC_PERF_START_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1); - for (j = 0; j < 2; j++) { - int i; - const uint32_t a = (((const struct unaligned_32 *) (pixels))->l); - const uint32_t b = - (((const struct unaligned_32 *) (pixels + 1))->l); - uint32_t l0 = - (a & 0x03030303UL) + (b & 0x03030303UL) + 0x01010101UL; - uint32_t h0 = - ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); - uint32_t l1, h1; - pixels += line_size; - for (i = 0; i < h; i += 2) { - uint32_t a = (((const struct unaligned_32 *) (pixels))->l); - uint32_t b = (((const struct unaligned_32 *) (pixels + 1))->l); - l1 = (a & 0x03030303UL) + (b & 0x03030303UL); - h1 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); - *((uint32_t *) block) = - h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); - pixels += line_size; - block += line_size; - a = (((const struct unaligned_32 *) (pixels))->l); - b = (((const struct unaligned_32 *) (pixels + 1))->l); - l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x01010101UL; - h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); - *((uint32_t *) block) = - h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); - pixels += line_size; - block += line_size; - } pixels += 4 - line_size * (h + 1); - block += 4 - line_size * h; - } - -POWERPC_PERF_STOP_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1); - -#else /* ALTIVEC_USE_REFERENCE_C_CODE */ register int i; register vector unsigned char pixelsv1, pixelsv2, @@ -1062,51 +908,12 @@ POWERPC_PERF_START_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1); } POWERPC_PERF_STOP_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1); -#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ } /* next one assumes that ((line_size % 16) == 0) */ void put_pixels16_xy2_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h) { POWERPC_PERF_DECLARE(altivec_put_pixels16_xy2_num, 1); -#ifdef ALTIVEC_USE_REFERENCE_C_CODE - int j; -POWERPC_PERF_START_COUNT(altivec_put_pixels16_xy2_num, 1); - for (j = 0; j < 4; j++) { - int i; - const uint32_t a = (((const struct unaligned_32 *) (pixels))->l); - const uint32_t b = - (((const struct unaligned_32 *) (pixels + 1))->l); - uint32_t l0 = - (a & 0x03030303UL) + (b & 0x03030303UL) + 0x02020202UL; - uint32_t h0 = - ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); - uint32_t l1, h1; - pixels += line_size; - for (i = 0; i < h; i += 2) { - uint32_t a = (((const struct unaligned_32 *) (pixels))->l); - uint32_t b = (((const struct unaligned_32 *) (pixels + 1))->l); - l1 = (a & 0x03030303UL) + (b & 0x03030303UL); - h1 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); - *((uint32_t *) block) = - h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); - pixels += line_size; - block += line_size; - a = (((const struct unaligned_32 *) (pixels))->l); - b = (((const struct unaligned_32 *) (pixels + 1))->l); - l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x02020202UL; - h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); - *((uint32_t *) block) = - h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); - pixels += line_size; - block += line_size; - } pixels += 4 - line_size * (h + 1); - block += 4 - line_size * h; - } - -POWERPC_PERF_STOP_COUNT(altivec_put_pixels16_xy2_num, 1); - -#else /* ALTIVEC_USE_REFERENCE_C_CODE */ register int i; register vector unsigned char pixelsv1, pixelsv2, pixelsv3, pixelsv4; @@ -1183,51 +990,12 @@ POWERPC_PERF_START_COUNT(altivec_put_pixels16_xy2_num, 1); } POWERPC_PERF_STOP_COUNT(altivec_put_pixels16_xy2_num, 1); -#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ } /* next one assumes that ((line_size % 16) == 0) */ void put_no_rnd_pixels16_xy2_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h) { POWERPC_PERF_DECLARE(altivec_put_no_rnd_pixels16_xy2_num, 1); -#ifdef ALTIVEC_USE_REFERENCE_C_CODE - int j; -POWERPC_PERF_START_COUNT(altivec_put_no_rnd_pixels16_xy2_num, 1); - for (j = 0; j < 4; j++) { - int i; - const uint32_t a = (((const struct unaligned_32 *) (pixels))->l); - const uint32_t b = - (((const struct unaligned_32 *) (pixels + 1))->l); - uint32_t l0 = - (a & 0x03030303UL) + (b & 0x03030303UL) + 0x01010101UL; - uint32_t h0 = - ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); - uint32_t l1, h1; - pixels += line_size; - for (i = 0; i < h; i += 2) { - uint32_t a = (((const struct unaligned_32 *) (pixels))->l); - uint32_t b = (((const struct unaligned_32 *) (pixels + 1))->l); - l1 = (a & 0x03030303UL) + (b & 0x03030303UL); - h1 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); - *((uint32_t *) block) = - h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); - pixels += line_size; - block += line_size; - a = (((const struct unaligned_32 *) (pixels))->l); - b = (((const struct unaligned_32 *) (pixels + 1))->l); - l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x01010101UL; - h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); - *((uint32_t *) block) = - h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); - pixels += line_size; - block += line_size; - } pixels += 4 - line_size * (h + 1); - block += 4 - line_size * h; - } - -POWERPC_PERF_STOP_COUNT(altivec_put_no_rnd_pixels16_xy2_num, 1); - -#else /* ALTIVEC_USE_REFERENCE_C_CODE */ register int i; register vector unsigned char pixelsv1, pixelsv2, pixelsv3, pixelsv4; @@ -1305,34 +1073,32 @@ POWERPC_PERF_START_COUNT(altivec_put_no_rnd_pixels16_xy2_num, 1); } POWERPC_PERF_STOP_COUNT(altivec_put_no_rnd_pixels16_xy2_num, 1); -#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ } int hadamard8_diff8x8_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h){ POWERPC_PERF_DECLARE(altivec_hadamard8_diff8x8_num, 1); - int sum; - register const_vector unsigned char vzero = (const_vector unsigned char)vec_splat_u8(0); - register vector signed short temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7; + int sum; + register const_vector unsigned char vzero = + (const_vector unsigned char)vec_splat_u8(0); + register vector signed short temp0, temp1, temp2, temp3, temp4, + temp5, temp6, temp7; POWERPC_PERF_START_COUNT(altivec_hadamard8_diff8x8_num, 1); { - register const_vector signed short vprod1 = (const_vector signed short)AVV( 1,-1, 1,-1, 1,-1, 1,-1); - register const_vector signed short vprod2 = (const_vector signed short)AVV( 1, 1,-1,-1, 1, 1,-1,-1); - register const_vector signed short vprod3 = (const_vector signed short)AVV( 1, 1, 1, 1,-1,-1,-1,-1); + register const_vector signed short vprod1 =(const_vector signed short) + AVV( 1,-1, 1,-1, 1,-1, 1,-1); + register const_vector signed short vprod2 =(const_vector signed short) + AVV( 1, 1,-1,-1, 1, 1,-1,-1); + register const_vector signed short vprod3 =(const_vector signed short) + AVV( 1, 1, 1, 1,-1,-1,-1,-1); register const_vector unsigned char perm1 = (const_vector unsigned char) - AVV(0x02, 0x03, 0x00, 0x01, - 0x06, 0x07, 0x04, 0x05, - 0x0A, 0x0B, 0x08, 0x09, - 0x0E, 0x0F, 0x0C, 0x0D); + AVV(0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05, + 0x0A, 0x0B, 0x08, 0x09, 0x0E, 0x0F, 0x0C, 0x0D); register const_vector unsigned char perm2 = (const_vector unsigned char) - AVV(0x04, 0x05, 0x06, 0x07, - 0x00, 0x01, 0x02, 0x03, - 0x0C, 0x0D, 0x0E, 0x0F, - 0x08, 0x09, 0x0A, 0x0B); + AVV(0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03, + 0x0C, 0x0D, 0x0E, 0x0F, 0x08, 0x09, 0x0A, 0x0B); register const_vector unsigned char perm3 = (const_vector unsigned char) - AVV(0x08, 0x09, 0x0A, 0x0B, - 0x0C, 0x0D, 0x0E, 0x0F, - 0x00, 0x01, 0x02, 0x03, - 0x04, 0x05, 0x06, 0x07); + AVV(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07); #define ONEITERBUTTERFLY(i, res) \ { \ @@ -1443,45 +1209,46 @@ POWERPC_PERF_STOP_COUNT(altivec_hadamard8_diff8x8_num, 1); */ static int hadamard8_diff16x8_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h) { - int sum; - register vector signed short - temp0 REG_v(v0), - temp1 REG_v(v1), - temp2 REG_v(v2), - temp3 REG_v(v3), - temp4 REG_v(v4), - temp5 REG_v(v5), - temp6 REG_v(v6), - temp7 REG_v(v7); - register vector signed short - temp0S REG_v(v8), - temp1S REG_v(v9), - temp2S REG_v(v10), - temp3S REG_v(v11), - temp4S REG_v(v12), - temp5S REG_v(v13), - temp6S REG_v(v14), - temp7S REG_v(v15); - register const_vector unsigned char vzero REG_v(v31)= (const_vector unsigned char)vec_splat_u8(0); + int sum; + register vector signed short + temp0 REG_v(v0), + temp1 REG_v(v1), + temp2 REG_v(v2), + temp3 REG_v(v3), + temp4 REG_v(v4), + temp5 REG_v(v5), + temp6 REG_v(v6), + temp7 REG_v(v7); + register vector signed short + temp0S REG_v(v8), + temp1S REG_v(v9), + temp2S REG_v(v10), + temp3S REG_v(v11), + temp4S REG_v(v12), + temp5S REG_v(v13), + temp6S REG_v(v14), + temp7S REG_v(v15); + register const_vector unsigned char vzero REG_v(v31)= + (const_vector unsigned char)vec_splat_u8(0); { - register const_vector signed short vprod1 REG_v(v16)= (const_vector signed short)AVV( 1,-1, 1,-1, 1,-1, 1,-1); - register const_vector signed short vprod2 REG_v(v17)= (const_vector signed short)AVV( 1, 1,-1,-1, 1, 1,-1,-1); - register const_vector signed short vprod3 REG_v(v18)= (const_vector signed short)AVV( 1, 1, 1, 1,-1,-1,-1,-1); - register const_vector unsigned char perm1 REG_v(v19)= (const_vector unsigned char) - AVV(0x02, 0x03, 0x00, 0x01, - 0x06, 0x07, 0x04, 0x05, - 0x0A, 0x0B, 0x08, 0x09, - 0x0E, 0x0F, 0x0C, 0x0D); - register const_vector unsigned char perm2 REG_v(v20)= (const_vector unsigned char) - AVV(0x04, 0x05, 0x06, 0x07, - 0x00, 0x01, 0x02, 0x03, - 0x0C, 0x0D, 0x0E, 0x0F, - 0x08, 0x09, 0x0A, 0x0B); - register const_vector unsigned char perm3 REG_v(v21)= (const_vector unsigned char) - AVV(0x08, 0x09, 0x0A, 0x0B, - 0x0C, 0x0D, 0x0E, 0x0F, - 0x00, 0x01, 0x02, 0x03, - 0x04, 0x05, 0x06, 0x07); + register const_vector signed short vprod1 REG_v(v16)= + (const_vector signed short)AVV( 1,-1, 1,-1, 1,-1, 1,-1); + register const_vector signed short vprod2 REG_v(v17)= + (const_vector signed short)AVV( 1, 1,-1,-1, 1, 1,-1,-1); + register const_vector signed short vprod3 REG_v(v18)= + (const_vector signed short)AVV( 1, 1, 1, 1,-1,-1,-1,-1); + register const_vector unsigned char perm1 REG_v(v19)= + (const_vector unsigned char) + AVV(0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05, + 0x0A, 0x0B, 0x08, 0x09, 0x0E, 0x0F, 0x0C, 0x0D); + register const_vector unsigned char perm2 REG_v(v20)= + (const_vector unsigned char) + AVV(0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03, + 0x0C, 0x0D, 0x0E, 0x0F, 0x08, 0x09, 0x0A, 0x0B); + register const_vector unsigned char perm3 REG_v(v21)= + (const_vector unsigned char) + AVV(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07); #define ONEITERBUTTERFLY(i, res1, res2) \ { \ @@ -1642,27 +1409,27 @@ static int hadamard8_diff16x8_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, int hadamard8_diff16_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h){ POWERPC_PERF_DECLARE(altivec_hadamard8_diff16_num, 1); - int score; + int score; POWERPC_PERF_START_COUNT(altivec_hadamard8_diff16_num, 1); - score = hadamard8_diff16x8_altivec(s, dst, src, stride, 8); - if (h==16) { - dst += 8*stride; - src += 8*stride; - score += hadamard8_diff16x8_altivec(s, dst, src, stride, 8); - } + score = hadamard8_diff16x8_altivec(s, dst, src, stride, 8); + if (h==16) { + dst += 8*stride; + src += 8*stride; + score += hadamard8_diff16x8_altivec(s, dst, src, stride, 8); + } POWERPC_PERF_STOP_COUNT(altivec_hadamard8_diff16_num, 1); - return score; + return score; } int has_altivec(void) { #ifdef __AMIGAOS4__ - ULONG result = 0; - extern struct ExecIFace *IExec; + ULONG result = 0; + extern struct ExecIFace *IExec; - IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE); - if (result == VECTORTYPE_ALTIVEC) return 1; - return 0; + IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE); + if (result == VECTORTYPE_ALTIVEC) return 1; + return 0; #else /* __AMIGAOS4__ */ #ifdef CONFIG_DARWIN @@ -1698,112 +1465,127 @@ int has_altivec(void) #endif /* __AMIGAOS4__ */ } +static void vorbis_inverse_coupling_altivec(float *mag, float *ang, + int blocksize) +{ + int i; + vector float m, a; + vector bool int t0, t1; + const vector unsigned int v_31 = //XXX + vec_add(vec_add(vec_splat_u32(15),vec_splat_u32(15)),vec_splat_u32(1)); + for(i=0; il); - const uint32_t b = (((const struct unaligned_32 *) (pixels + 1))->l); - uint32_t l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x02020202UL; - uint32_t h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); - uint32_t l1, h1; - pixels += line_size; - for (i = 0; i < h; i += 2) { - uint32_t a = (((const struct unaligned_32 *) (pixels))->l); - uint32_t b = (((const struct unaligned_32 *) (pixels + 1))->l); - l1 = (a & 0x03030303UL) + (b & 0x03030303UL); - h1 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); - *((uint32_t *) block) = rnd_avg32(*((uint32_t *) block), h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL)); - pixels += line_size; - block += line_size; - a = (((const struct unaligned_32 *) (pixels))->l); - b = (((const struct unaligned_32 *) (pixels + 1))->l); - l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x02020202UL; - h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); - *((uint32_t *) block) = rnd_avg32(*((uint32_t *) block), h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL)); - pixels += line_size; - block += line_size; - } pixels += 4 - line_size * (h + 1); - block += 4 - line_size * h; - } -POWERPC_PERF_STOP_COUNT(altivec_avg_pixels8_xy2_num, 1); -#else /* ALTIVEC_USE_REFERENCE_C_CODE */ - register int i; - register vector unsigned char - pixelsv1, pixelsv2, - pixelsavg; - register vector unsigned char - blockv, temp1, temp2, blocktemp; - register vector unsigned short - pixelssum1, pixelssum2, temp3; - register const_vector unsigned char vczero = (const_vector unsigned char)vec_splat_u8(0); - register const_vector unsigned short vctwo = (const_vector unsigned short)vec_splat_u16(2); - - temp1 = vec_ld(0, pixels); - temp2 = vec_ld(16, pixels); - pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(0, pixels)); - if ((((unsigned long)pixels) & 0x0000000F) == 0x0000000F) - { - pixelsv2 = temp2; - } - else - { - pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(1, pixels)); - } - pixelsv1 = vec_mergeh(vczero, pixelsv1); - pixelsv2 = vec_mergeh(vczero, pixelsv2); - pixelssum1 = vec_add((vector unsigned short)pixelsv1, - (vector unsigned short)pixelsv2); - pixelssum1 = vec_add(pixelssum1, vctwo); + register int i; + register vector unsigned char pixelsv1, pixelsv2, pixelsavg; + register vector unsigned char blockv, temp1, temp2, blocktemp; + register vector unsigned short pixelssum1, pixelssum2, temp3; + + register const_vector unsigned char vczero = (const_vector unsigned char) + vec_splat_u8(0); + register const_vector unsigned short vctwo = (const_vector unsigned short) + vec_splat_u16(2); + + temp1 = vec_ld(0, pixels); + temp2 = vec_ld(16, pixels); + pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(0, pixels)); + if ((((unsigned long)pixels) & 0x0000000F) == 0x0000000F) { + pixelsv2 = temp2; + } else { + pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(1, pixels)); + } + pixelsv1 = vec_mergeh(vczero, pixelsv1); + pixelsv2 = vec_mergeh(vczero, pixelsv2); + pixelssum1 = vec_add((vector unsigned short)pixelsv1, + (vector unsigned short)pixelsv2); + pixelssum1 = vec_add(pixelssum1, vctwo); POWERPC_PERF_START_COUNT(altivec_avg_pixels8_xy2_num, 1); - for (i = 0; i < h ; i++) { - int rightside = ((unsigned long)block & 0x0000000F); - blockv = vec_ld(0, block); + for (i = 0; i < h ; i++) { + int rightside = ((unsigned long)block & 0x0000000F); + blockv = vec_ld(0, block); + + temp1 = vec_ld(line_size, pixels); + temp2 = vec_ld(line_size + 16, pixels); + pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(line_size, pixels)); + if (((((unsigned long)pixels) + line_size) & 0x0000000F) == 0x0000000F) + { + pixelsv2 = temp2; + } else { + pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(line_size + 1, pixels)); + } + + pixelsv1 = vec_mergeh(vczero, pixelsv1); + pixelsv2 = vec_mergeh(vczero, pixelsv2); + pixelssum2 = vec_add((vector unsigned short)pixelsv1, + (vector unsigned short)pixelsv2); + temp3 = vec_add(pixelssum1, pixelssum2); + temp3 = vec_sra(temp3, vctwo); + pixelssum1 = vec_add(pixelssum2, vctwo); + pixelsavg = vec_packsu(temp3, (vector unsigned short) vczero); + + if (rightside) { + blocktemp = vec_perm(blockv, pixelsavg, vcprm(0, 1, s0, s1)); + } else { + blocktemp = vec_perm(blockv, pixelsavg, vcprm(s0, s1, 2, 3)); + } + + blockv = vec_avg(blocktemp, blockv); + vec_st(blockv, 0, block); - temp1 = vec_ld(line_size, pixels); - temp2 = vec_ld(line_size + 16, pixels); - pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(line_size, pixels)); - if (((((unsigned long)pixels) + line_size) & 0x0000000F) == 0x0000000F) - { - pixelsv2 = temp2; - } - else - { - pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(line_size + 1, pixels)); - } - - pixelsv1 = vec_mergeh(vczero, pixelsv1); - pixelsv2 = vec_mergeh(vczero, pixelsv2); - pixelssum2 = vec_add((vector unsigned short)pixelsv1, - (vector unsigned short)pixelsv2); - temp3 = vec_add(pixelssum1, pixelssum2); - temp3 = vec_sra(temp3, vctwo); - pixelssum1 = vec_add(pixelssum2, vctwo); - pixelsavg = vec_packsu(temp3, (vector unsigned short) vczero); - - if (rightside) - { - blocktemp = vec_perm(blockv, pixelsavg, vcprm(0, 1, s0, s1)); - } - else - { - blocktemp = vec_perm(blockv, pixelsavg, vcprm(s0, s1, 2, 3)); - } - - blockv = vec_avg(blocktemp, blockv); - vec_st(blockv, 0, block); - - block += line_size; - pixels += line_size; - } + block += line_size; + pixels += line_size; + } POWERPC_PERF_STOP_COUNT(altivec_avg_pixels8_xy2_num, 1); -#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ +} + +void dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx) +{ + c->pix_abs[0][1] = sad16_x2_altivec; + c->pix_abs[0][2] = sad16_y2_altivec; + c->pix_abs[0][3] = sad16_xy2_altivec; + c->pix_abs[0][0] = sad16_altivec; + c->pix_abs[1][0] = sad8_altivec; + c->sad[0]= sad16_altivec; + c->sad[1]= sad8_altivec; + c->pix_norm1 = pix_norm1_altivec; + c->sse[1]= sse8_altivec; + c->sse[0]= sse16_altivec; + c->pix_sum = pix_sum_altivec; + c->diff_pixels = diff_pixels_altivec; + c->get_pixels = get_pixels_altivec; + c->add_bytes= add_bytes_altivec; + c->put_pixels_tab[0][0] = put_pixels16_altivec; + /* the two functions do the same thing, so use the same code */ + c->put_no_rnd_pixels_tab[0][0] = put_pixels16_altivec; + c->avg_pixels_tab[0][0] = avg_pixels16_altivec; + c->avg_pixels_tab[1][0] = avg_pixels8_altivec; + c->avg_pixels_tab[1][3] = avg_pixels8_xy2_altivec; + c->put_pixels_tab[1][3] = put_pixels8_xy2_altivec; + c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_altivec; + c->put_pixels_tab[0][3] = put_pixels16_xy2_altivec; + c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_altivec; + + c->hadamard8_diff[0] = hadamard8_diff16_altivec; + c->hadamard8_diff[1] = hadamard8_diff8x8_altivec; +#ifdef CONFIG_VORBIS_DECODER + c->vorbis_inverse_coupling = vorbis_inverse_coupling_altivec; +#endif } diff --git a/src/libffmpeg/libavcodec/ppc/dsputil_altivec.h b/src/libffmpeg/libavcodec/ppc/dsputil_altivec.h index ac54817d0..560d778bb 100644 --- a/src/libffmpeg/libavcodec/ppc/dsputil_altivec.h +++ b/src/libffmpeg/libavcodec/ppc/dsputil_altivec.h @@ -3,18 +3,20 @@ * Copyright (c) 2002 Dieter Shirley * Copyright (c) 2003-2004 Romain Dolbeau * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -25,34 +27,11 @@ #ifdef HAVE_ALTIVEC -extern int sad16_x2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h); -extern int sad16_y2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h); -extern int sad16_xy2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h); -extern int sad16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h); -extern int sad8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h); -extern int pix_norm1_altivec(uint8_t *pix, int line_size); -extern int sse8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h); -extern int sse16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h); -extern int pix_sum_altivec(uint8_t * pix, int line_size); -extern void diff_pixels_altivec(DCTELEM* block, const uint8_t* s1, const uint8_t* s2, int stride); -extern void get_pixels_altivec(DCTELEM* block, const uint8_t * pixels, int line_size); +extern int has_altivec(void); -extern void add_bytes_altivec(uint8_t *dst, uint8_t *src, int w); -extern void put_pixels_clamped_altivec(const DCTELEM *block, uint8_t *restrict pixels, int line_size); -extern void put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h); -extern void avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h); -extern void avg_pixels8_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h); -extern void put_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h); -extern void put_no_rnd_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h); -extern void put_pixels16_xy2_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h); -extern void put_no_rnd_pixels16_xy2_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h); -extern int hadamard8_diff8x8_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h); -extern int hadamard8_diff16_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h); -extern void avg_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h); +void put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h); -extern void gmc1_altivec(uint8_t *dst, uint8_t *src, int stride, int h, int x16, int y16, int rounder); - -extern int has_altivec(void); +void avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h); // used to build registers permutation vectors (vcprm) // the 's' are for words in the _s_econd vector @@ -88,10 +67,40 @@ extern int has_altivec(void); #define vcii(a,b,c,d) (const vector float){FLOAT_ ## a, FLOAT_ ## b, FLOAT_ ## c, FLOAT_ ## d} #endif -#else /* HAVE_ALTIVEC */ -#ifdef ALTIVEC_USE_REFERENCE_C_CODE -#error "I can't use ALTIVEC_USE_REFERENCE_C_CODE if I don't use HAVE_ALTIVEC" -#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ +// Transpose 8x8 matrix of 16-bit elements (in-place) +#define TRANSPOSE8(a,b,c,d,e,f,g,h) \ +do { \ + vector signed short A1, B1, C1, D1, E1, F1, G1, H1; \ + vector signed short A2, B2, C2, D2, E2, F2, G2, H2; \ + \ + A1 = vec_mergeh (a, e); \ + B1 = vec_mergel (a, e); \ + C1 = vec_mergeh (b, f); \ + D1 = vec_mergel (b, f); \ + E1 = vec_mergeh (c, g); \ + F1 = vec_mergel (c, g); \ + G1 = vec_mergeh (d, h); \ + H1 = vec_mergel (d, h); \ + \ + A2 = vec_mergeh (A1, E1); \ + B2 = vec_mergel (A1, E1); \ + C2 = vec_mergeh (B1, F1); \ + D2 = vec_mergel (B1, F1); \ + E2 = vec_mergeh (C1, G1); \ + F2 = vec_mergel (C1, G1); \ + G2 = vec_mergeh (D1, H1); \ + H2 = vec_mergel (D1, H1); \ + \ + a = vec_mergeh (A2, E2); \ + b = vec_mergel (A2, E2); \ + c = vec_mergeh (B2, F2); \ + d = vec_mergel (B2, F2); \ + e = vec_mergeh (C2, G2); \ + f = vec_mergel (C2, G2); \ + g = vec_mergeh (D2, H2); \ + h = vec_mergel (D2, H2); \ +} while (0) + #endif /* HAVE_ALTIVEC */ #endif /* _DSPUTIL_ALTIVEC_ */ diff --git a/src/libffmpeg/libavcodec/ppc/dsputil_ppc.c b/src/libffmpeg/libavcodec/ppc/dsputil_ppc.c index b63c8dd84..9169eaef0 100644 --- a/src/libffmpeg/libavcodec/ppc/dsputil_ppc.c +++ b/src/libffmpeg/libavcodec/ppc/dsputil_ppc.c @@ -3,18 +3,20 @@ * Copyright (c) 2002 Dieter Shirley * Copyright (c) 2003-2004 Romain Dolbeau * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -24,22 +26,21 @@ #ifdef HAVE_ALTIVEC #include "dsputil_altivec.h" -#endif extern void fdct_altivec(int16_t *block); +extern void gmc1_altivec(uint8_t *dst, uint8_t *src, int stride, int h, + int x16, int y16, int rounder); extern void idct_put_altivec(uint8_t *dest, int line_size, int16_t *block); extern void idct_add_altivec(uint8_t *dest, int line_size, int16_t *block); -extern void ff_snow_horizontal_compose97i_altivec(DWTELEM *b, int width); -extern void ff_snow_vertical_compose97i_altivec(DWTELEM *b0, DWTELEM *b1, - DWTELEM *b2, DWTELEM *b3, - DWTELEM *b4, DWTELEM *b5, - int width); -extern void ff_snow_inner_add_yblock_altivec(uint8_t *obmc, const int obmc_stride, - uint8_t * * block, int b_w, int b_h, - int src_x, int src_y, int src_stride, - slice_buffer * sb, int add, - uint8_t * dst8); +void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx); + +void dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx); +void vc1dsp_init_altivec(DSPContext* c, AVCodecContext *avctx); +void snow_init_altivec(DSPContext* c, AVCodecContext *avctx); +void float_init_altivec(DSPContext* c, AVCodecContext *avctx); + +#endif int mm_flags = 0; @@ -100,7 +101,7 @@ void powerpc_display_perf_report(void) { if (perfdata[j][i][powerpc_data_num] != (unsigned long long)0) av_log(NULL, AV_LOG_INFO, - " Function \"%s\" (pmc%d):\n\tmin: %llu\n\tmax: %llu\n\tavg: %1.2lf (%llu)\n", + " Function \"%s\" (pmc%d):\n\tmin: %"PRIu64"\n\tmax: %"PRIu64"\n\tavg: %1.2lf (%"PRIu64")\n", perfname[i], j+1, perfdata[j][i][powerpc_data_min], @@ -174,7 +175,7 @@ POWERPC_PERF_STOP_COUNT(powerpc_clear_blocks_dcbz32, 1); /* same as above, when dcbzl clear a whole 128B cache line i.e. the PPC970 aka G5 */ -#ifndef NO_DCBZL +#ifdef HAVE_DCBZL void clear_blocks_dcbz128_ppc(DCTELEM *blocks) { POWERPC_PERF_DECLARE(powerpc_clear_blocks_dcbz128, 1); @@ -204,7 +205,7 @@ void clear_blocks_dcbz128_ppc(DCTELEM *blocks) } #endif -#ifndef NO_DCBZL +#ifdef HAVE_DCBZL /* check dcbz report how many bytes are set to 0 by dcbz */ /* update 24/06/2003 : replace dcbz by dcbzl to get the intended effect (Apple "fixed" dcbz) @@ -248,69 +249,43 @@ long check_dcbzl_effect(void) } #endif - -void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx); +static void prefetch_ppc(void *mem, int stride, int h) +{ + register const uint8_t *p = mem; + do { + asm volatile ("dcbt 0,%0" : : "r" (p)); + p+= stride; + } while(--h); +} void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx) { // Common optimizations whether Altivec is available or not - - switch (check_dcbzl_effect()) { - case 32: - c->clear_blocks = clear_blocks_dcbz32_ppc; - break; - case 128: - c->clear_blocks = clear_blocks_dcbz128_ppc; - break; - default: - break; - } + c->prefetch = prefetch_ppc; + switch (check_dcbzl_effect()) { + case 32: + c->clear_blocks = clear_blocks_dcbz32_ppc; + break; + case 128: + c->clear_blocks = clear_blocks_dcbz128_ppc; + break; + default: + break; + } #ifdef HAVE_ALTIVEC - dsputil_h264_init_ppc(c, avctx); + if(ENABLE_H264_DECODER) dsputil_h264_init_ppc(c, avctx); if (has_altivec()) { mm_flags |= MM_ALTIVEC; - // Altivec specific optimisations - c->pix_abs[0][1] = sad16_x2_altivec; - c->pix_abs[0][2] = sad16_y2_altivec; - c->pix_abs[0][3] = sad16_xy2_altivec; - c->pix_abs[0][0] = sad16_altivec; - c->pix_abs[1][0] = sad8_altivec; - c->sad[0]= sad16_altivec; - c->sad[1]= sad8_altivec; - c->pix_norm1 = pix_norm1_altivec; - c->sse[1]= sse8_altivec; - c->sse[0]= sse16_altivec; - c->pix_sum = pix_sum_altivec; - c->diff_pixels = diff_pixels_altivec; - c->get_pixels = get_pixels_altivec; -// next one disabled as it's untested. -#if 0 - c->add_bytes= add_bytes_altivec; -#endif /* 0 */ - c->put_pixels_tab[0][0] = put_pixels16_altivec; - /* the two functions do the same thing, so use the same code */ - c->put_no_rnd_pixels_tab[0][0] = put_pixels16_altivec; - c->avg_pixels_tab[0][0] = avg_pixels16_altivec; - c->avg_pixels_tab[1][0] = avg_pixels8_altivec; - c->avg_pixels_tab[1][3] = avg_pixels8_xy2_altivec; - c->put_pixels_tab[1][3] = put_pixels8_xy2_altivec; - c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_altivec; - c->put_pixels_tab[0][3] = put_pixels16_xy2_altivec; - c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_altivec; - + dsputil_init_altivec(c, avctx); + if(ENABLE_SNOW_DECODER) snow_init_altivec(c, avctx); + if(ENABLE_VC1_DECODER || ENABLE_WMV3_DECODER) + vc1dsp_init_altivec(c, avctx); + float_init_altivec(c, avctx); c->gmc1 = gmc1_altivec; - c->hadamard8_diff[0] = hadamard8_diff16_altivec; - c->hadamard8_diff[1] = hadamard8_diff8x8_altivec; - - - c->horizontal_compose97i = ff_snow_horizontal_compose97i_altivec; - c->vertical_compose97i = ff_snow_vertical_compose97i_altivec; - c->inner_add_yblock = ff_snow_inner_add_yblock_altivec; - #ifdef CONFIG_ENCODERS if (avctx->dct_algo == FF_DCT_AUTO || avctx->dct_algo == FF_DCT_ALTIVEC) @@ -319,20 +294,16 @@ void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx) } #endif //CONFIG_ENCODERS - if (avctx->lowres==0) - { + if (avctx->lowres==0) + { if ((avctx->idct_algo == FF_IDCT_AUTO) || (avctx->idct_algo == FF_IDCT_ALTIVEC)) { c->idct_put = idct_put_altivec; c->idct_add = idct_add_altivec; -#ifndef ALTIVEC_USE_REFERENCE_C_CODE c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; -#else /* ALTIVEC_USE_REFERENCE_C_CODE */ - c->idct_permutation_type = FF_NO_IDCT_PERM; -#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ } - } + } #ifdef POWERPC_PERFORMANCE_REPORT { @@ -349,11 +320,6 @@ void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx) } } #endif /* POWERPC_PERFORMANCE_REPORT */ - } else -#endif /* HAVE_ALTIVEC */ - { - // Non-AltiVec PPC optimisations - - // ... pending ... } +#endif /* HAVE_ALTIVEC */ } diff --git a/src/libffmpeg/libavcodec/ppc/dsputil_ppc.h b/src/libffmpeg/libavcodec/ppc/dsputil_ppc.h index 966ffa71a..ab2b05780 100644 --- a/src/libffmpeg/libavcodec/ppc/dsputil_ppc.h +++ b/src/libffmpeg/libavcodec/ppc/dsputil_ppc.h @@ -1,35 +1,26 @@ /* * Copyright (c) 2003-2004 Romain Dolbeau * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _DSPUTIL_PPC_ #define _DSPUTIL_PPC_ -#ifdef CONFIG_DARWIN -/* The Apple assembler shipped w/ gcc-3.3 knows about DCBZL, previous assemblers don't - We assume here that the Darwin GCC is from Apple.... */ -#if (__GNUC__ * 100 + __GNUC_MINOR__ < 303) -#define NO_DCBZL -#endif -#else /* CONFIG_DARWIN */ -/* I don't think any non-Apple assembler knows about DCBZL */ -#define NO_DCBZL -#endif /* CONFIG_DARWIN */ - #ifdef POWERPC_PERFORMANCE_REPORT void powerpc_display_perf_report(void); /* the 604* have 2, the G3* have 4, the G4s have 6, diff --git a/src/libffmpeg/libavcodec/ppc/fdct_altivec.c b/src/libffmpeg/libavcodec/ppc/fdct_altivec.c index f5778c24e..2418c32bb 100644 --- a/src/libffmpeg/libavcodec/ppc/fdct_altivec.c +++ b/src/libffmpeg/libavcodec/ppc/fdct_altivec.c @@ -2,18 +2,20 @@ * AltiVec optimized library for the FFMPEG Multimedia System * Copyright (C) 2003 James Klicman * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -196,12 +198,6 @@ static vector float fdctconsts[3] = { void fdct_altivec(int16_t *block) { POWERPC_PERF_DECLARE(altivec_fdct, 1); -#ifdef ALTIVEC_USE_REFERENCE_C_CODE -POWERPC_PERF_START_COUNT(altivec_fdct, 1); - void ff_jpeg_fdct_islow(int16_t *block); - ff_jpeg_fdct_islow(block); -POWERPC_PERF_STOP_COUNT(altivec_fdct, 1); -#else /* ALTIVEC_USE_REFERENCE_C_CODE */ vector signed short *bp; vector float *cp; vector float b00, b10, b20, b30, b40, b50, b60, b70; @@ -492,7 +488,6 @@ POWERPC_PERF_STOP_COUNT(altivec_fdct, 1); /* }}} */ POWERPC_PERF_STOP_COUNT(altivec_fdct, 1); -#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ } /* vim:set foldmethod=marker foldlevel=0: */ diff --git a/src/libffmpeg/libavcodec/ppc/fft_altivec.c b/src/libffmpeg/libavcodec/ppc/fft_altivec.c index f4ea78359..384a774ff 100644 --- a/src/libffmpeg/libavcodec/ppc/fft_altivec.c +++ b/src/libffmpeg/libavcodec/ppc/fft_altivec.c @@ -4,18 +4,20 @@ * Copyright (c) 2003 Romain Dolbeau * Based on code Copyright (c) 2002 Fabrice Bellard. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "../dsputil.h" @@ -63,88 +65,7 @@ void ff_fft_calc_altivec(FFTContext *s, FFTComplex *z) { POWERPC_PERF_DECLARE(altivec_fft_num, s->nbits >= 6); -#ifdef ALTIVEC_USE_REFERENCE_C_CODE - int ln = s->nbits; - int j, np, np2; - int nblocks, nloops; - register FFTComplex *p, *q; - FFTComplex *exptab = s->exptab; - int l; - FFTSample tmp_re, tmp_im; - -POWERPC_PERF_START_COUNT(altivec_fft_num, s->nbits >= 6); - - np = 1 << ln; - - /* pass 0 */ - - p=&z[0]; - j=(np >> 1); - do { - BF(p[0].re, p[0].im, p[1].re, p[1].im, - p[0].re, p[0].im, p[1].re, p[1].im); - p+=2; - } while (--j != 0); - - /* pass 1 */ - - - p=&z[0]; - j=np >> 2; - if (s->inverse) { - do { - BF(p[0].re, p[0].im, p[2].re, p[2].im, - p[0].re, p[0].im, p[2].re, p[2].im); - BF(p[1].re, p[1].im, p[3].re, p[3].im, - p[1].re, p[1].im, -p[3].im, p[3].re); - p+=4; - } while (--j != 0); - } else { - do { - BF(p[0].re, p[0].im, p[2].re, p[2].im, - p[0].re, p[0].im, p[2].re, p[2].im); - BF(p[1].re, p[1].im, p[3].re, p[3].im, - p[1].re, p[1].im, p[3].im, -p[3].re); - p+=4; - } while (--j != 0); - } - /* pass 2 .. ln-1 */ - - nblocks = np >> 3; - nloops = 1 << 2; - np2 = np >> 1; - do { - p = z; - q = z + nloops; - for (j = 0; j < nblocks; ++j) { - BF(p->re, p->im, q->re, q->im, - p->re, p->im, q->re, q->im); - - p++; - q++; - for(l = nblocks; l < np2; l += nblocks) { - CMUL(tmp_re, tmp_im, exptab[l].re, exptab[l].im, q->re, q->im); - BF(p->re, p->im, q->re, q->im, - p->re, p->im, tmp_re, tmp_im); - p++; - q++; - } - - p += nloops; - q += nloops; - } - nblocks = nblocks >> 1; - nloops = nloops << 1; - } while (nblocks != 0); - -POWERPC_PERF_STOP_COUNT(altivec_fft_num, s->nbits >= 6); - -#else /* ALTIVEC_USE_REFERENCE_C_CODE */ -#ifdef CONFIG_DARWIN - register const vector float vczero = (const vector float)(0.); -#else - register const vector float vczero = (const vector float){0.,0.,0.,0.}; -#endif + register const vector float vczero = (const vector float)vec_splat_u32(0.); int ln = s->nbits; int j, np, np2; @@ -242,6 +163,4 @@ POWERPC_PERF_START_COUNT(altivec_fft_num, s->nbits >= 6); } while (nblocks != 0); POWERPC_PERF_STOP_COUNT(altivec_fft_num, s->nbits >= 6); - -#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ } diff --git a/src/libffmpeg/libavcodec/ppc/gcc_fixes.h b/src/libffmpeg/libavcodec/ppc/gcc_fixes.h index 943905bc5..5a4a55188 100644 --- a/src/libffmpeg/libavcodec/ppc/gcc_fixes.h +++ b/src/libffmpeg/libavcodec/ppc/gcc_fixes.h @@ -2,6 +2,22 @@ * gcc fixes for altivec. * Used to workaround broken gcc (FSF gcc-3 pre gcc-3.3) * and to stay somewhat compatible with Darwin. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _GCC_FIXES_ diff --git a/src/libffmpeg/libavcodec/ppc/gmc_altivec.c b/src/libffmpeg/libavcodec/ppc/gmc_altivec.c index 04978d825..42c936bb3 100644 --- a/src/libffmpeg/libavcodec/ppc/gmc_altivec.c +++ b/src/libffmpeg/libavcodec/ppc/gmc_altivec.c @@ -3,18 +3,20 @@ * AltiVec-enabled * Copyright (c) 2003 Romain Dolbeau * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -32,32 +34,6 @@ void gmc1_altivec(uint8_t *dst /* align 8 */, uint8_t *src /* align1 */, int stride, int h, int x16, int y16, int rounder) { POWERPC_PERF_DECLARE(altivec_gmc1_num, GMC1_PERF_COND); -#ifdef ALTIVEC_USE_REFERENCE_C_CODE - const int A=(16-x16)*(16-y16); - const int B=( x16)*(16-y16); - const int C=(16-x16)*( y16); - const int D=( x16)*( y16); - int i; - -POWERPC_PERF_START_COUNT(altivec_gmc1_num, GMC1_PERF_COND); - - for(i=0; i>8; - dst[1]= (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + rounder)>>8; - dst[2]= (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + rounder)>>8; - dst[3]= (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + rounder)>>8; - dst[4]= (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + rounder)>>8; - dst[5]= (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + rounder)>>8; - dst[6]= (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + rounder)>>8; - dst[7]= (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + rounder)>>8; - dst+= stride; - src+= stride; - } - -POWERPC_PERF_STOP_COUNT(altivec_gmc1_num, GMC1_PERF_COND); - -#else /* ALTIVEC_USE_REFERENCE_C_CODE */ const unsigned short __attribute__ ((aligned(16))) rounder_a[8] = {rounder, rounder, rounder, rounder, rounder, rounder, rounder, rounder}; @@ -167,6 +143,4 @@ POWERPC_PERF_START_COUNT(altivec_gmc1_num, GMC1_PERF_COND); } POWERPC_PERF_STOP_COUNT(altivec_gmc1_num, GMC1_PERF_COND); - -#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ } diff --git a/src/libffmpeg/libavcodec/ppc/idct_altivec.c b/src/libffmpeg/libavcodec/ppc/idct_altivec.c index 93d63cfd3..cee46fc25 100644 --- a/src/libffmpeg/libavcodec/ppc/idct_altivec.c +++ b/src/libffmpeg/libavcodec/ppc/idct_altivec.c @@ -1,18 +1,20 @@ /* * Copyright (c) 2001 Michel Lespinasse * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -167,12 +169,6 @@ static const_vector_s16_t constants[5] = { void idct_put_altivec(uint8_t* dest, int stride, vector_s16_t* block) { POWERPC_PERF_DECLARE(altivec_idct_put_num, 1); -#ifdef ALTIVEC_USE_REFERENCE_C_CODE -POWERPC_PERF_START_COUNT(altivec_idct_put_num, 1); - void simple_idct_put(uint8_t *dest, int line_size, int16_t *block); - simple_idct_put(dest, stride, (int16_t*)block); -POWERPC_PERF_STOP_COUNT(altivec_idct_put_num, 1); -#else /* ALTIVEC_USE_REFERENCE_C_CODE */ vector_u8_t tmp; #ifdef POWERPC_PERFORMANCE_REPORT @@ -195,18 +191,11 @@ POWERPC_PERF_START_COUNT(altivec_idct_put_num, 1); COPY (dest, vx7) POWERPC_PERF_STOP_COUNT(altivec_idct_put_num, 1); -#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ } void idct_add_altivec(uint8_t* dest, int stride, vector_s16_t* block) { POWERPC_PERF_DECLARE(altivec_idct_add_num, 1); -#ifdef ALTIVEC_USE_REFERENCE_C_CODE -POWERPC_PERF_START_COUNT(altivec_idct_add_num, 1); - void simple_idct_add(uint8_t *dest, int line_size, int16_t *block); - simple_idct_add(dest, stride, (int16_t*)block); -POWERPC_PERF_STOP_COUNT(altivec_idct_add_num, 1); -#else /* ALTIVEC_USE_REFERENCE_C_CODE */ vector_u8_t tmp; vector_s16_t tmp2, tmp3; vector_u8_t perm0; @@ -244,6 +233,5 @@ POWERPC_PERF_START_COUNT(altivec_idct_add_num, 1); ADD (dest, vx7, perm1) POWERPC_PERF_STOP_COUNT(altivec_idct_add_num, 1); -#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ } diff --git a/src/libffmpeg/libavcodec/ppc/mpegvideo_altivec.c b/src/libffmpeg/libavcodec/ppc/mpegvideo_altivec.c index 7a771a8ec..3822cb20e 100644 --- a/src/libffmpeg/libavcodec/ppc/mpegvideo_altivec.c +++ b/src/libffmpeg/libavcodec/ppc/mpegvideo_altivec.c @@ -4,18 +4,20 @@ * dct_unquantize_h263_altivec: * Copyright (c) 2003 Romain Dolbeau * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -50,39 +52,6 @@ do { \ d = vec_mergel(_trans_acl, _trans_bdl); \ } while (0) -#define TRANSPOSE8(a,b,c,d,e,f,g,h) \ -do { \ - __typeof__(a) _A1, _B1, _C1, _D1, _E1, _F1, _G1, _H1; \ - __typeof__(a) _A2, _B2, _C2, _D2, _E2, _F2, _G2, _H2; \ - \ - _A1 = vec_mergeh (a, e); \ - _B1 = vec_mergel (a, e); \ - _C1 = vec_mergeh (b, f); \ - _D1 = vec_mergel (b, f); \ - _E1 = vec_mergeh (c, g); \ - _F1 = vec_mergel (c, g); \ - _G1 = vec_mergeh (d, h); \ - _H1 = vec_mergel (d, h); \ - \ - _A2 = vec_mergeh (_A1, _E1); \ - _B2 = vec_mergel (_A1, _E1); \ - _C2 = vec_mergeh (_B1, _F1); \ - _D2 = vec_mergel (_B1, _F1); \ - _E2 = vec_mergeh (_C1, _G1); \ - _F2 = vec_mergel (_C1, _G1); \ - _G2 = vec_mergeh (_D1, _H1); \ - _H2 = vec_mergel (_D1, _H1); \ - \ - a = vec_mergeh (_A2, _E2); \ - b = vec_mergel (_A2, _E2); \ - c = vec_mergeh (_B2, _F2); \ - d = vec_mergel (_B2, _F2); \ - e = vec_mergeh (_C2, _G2); \ - f = vec_mergel (_C2, _G2); \ - g = vec_mergeh (_D2, _H2); \ - h = vec_mergel (_D2, _H2); \ -} while (0) - // Loads a four-byte value (int or float) from the target address // into every element in the target vector. Only works if the @@ -552,19 +521,6 @@ POWERPC_PERF_START_COUNT(altivec_dct_unquantize_h263_num, 1); nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ]; } -#ifdef ALTIVEC_USE_REFERENCE_C_CODE - for(;i<=nCoeffs;i++) { - level = block[i]; - if (level) { - if (level < 0) { - level = level * qmul - qadd; - } else { - level = level * qmul + qadd; - } - block[i] = level; - } - } -#else /* ALTIVEC_USE_REFERENCE_C_CODE */ { register const_vector signed short vczero = (const_vector signed short)vec_splat_s16(0); short __attribute__ ((aligned(16))) qmul8[] = @@ -643,7 +599,5 @@ POWERPC_PERF_START_COUNT(altivec_dct_unquantize_h263_num, 1); block[0] = backup_0; } } -#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ - POWERPC_PERF_STOP_COUNT(altivec_dct_unquantize_h263_num, nCoeffs == 63); } diff --git a/src/libffmpeg/libavcodec/ppc/mpegvideo_ppc.c b/src/libffmpeg/libavcodec/ppc/mpegvideo_ppc.c index b391b4294..c5e822f77 100644 --- a/src/libffmpeg/libavcodec/ppc/mpegvideo_ppc.c +++ b/src/libffmpeg/libavcodec/ppc/mpegvideo_ppc.c @@ -1,18 +1,20 @@ /* * Copyright (c) 2002 Dieter Shirley * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -46,11 +48,7 @@ void MPV_common_init_ppc(MpegEncContext *s) { s->dsp.idct_put = idct_put_altivec; s->dsp.idct_add = idct_add_altivec; -#ifndef ALTIVEC_USE_REFERENCE_C_CODE s->dsp.idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; -#else /* ALTIVEC_USE_REFERENCE_C_CODE */ - s->dsp.idct_permutation_type = FF_NO_IDCT_PERM; -#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ } } diff --git a/src/libffmpeg/libavcodec/qdm2.c b/src/libffmpeg/libavcodec/qdm2.c index 81d548386..b9462f3cb 100644 --- a/src/libffmpeg/libavcodec/qdm2.c +++ b/src/libffmpeg/libavcodec/qdm2.c @@ -5,18 +5,20 @@ * Copyright (c) 2005 Alex Beregszaszi * Copyright (c) 2005 Roberto Togni * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/qdm2data.h b/src/libffmpeg/libavcodec/qdm2data.h index dafd4f490..6d7d07463 100644 --- a/src/libffmpeg/libavcodec/qdm2data.h +++ b/src/libffmpeg/libavcodec/qdm2data.h @@ -5,18 +5,20 @@ * Copyright (c) 2005 Alex Beregszaszi * Copyright (c) 2005 Roberto Togni * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/qdrw.c b/src/libffmpeg/libavcodec/qdrw.c index 846365917..8ebb43c4a 100644 --- a/src/libffmpeg/libavcodec/qdrw.c +++ b/src/libffmpeg/libavcodec/qdrw.c @@ -2,18 +2,20 @@ * QuickDraw (qdrw) codec * Copyright (c) 2004 Konstantin Shishkov * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -136,7 +138,7 @@ static int decode_frame(AVCodecContext *avctx, static int decode_init(AVCodecContext *avctx){ // QdrawContext * const a = avctx->priv_data; - if (avcodec_check_dimensions(avctx, avctx->height, avctx->width) < 0) { + if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) { return 1; } diff --git a/src/libffmpeg/libavcodec/qpeg.c b/src/libffmpeg/libavcodec/qpeg.c index f7323a871..3c597e8df 100644 --- a/src/libffmpeg/libavcodec/qpeg.c +++ b/src/libffmpeg/libavcodec/qpeg.c @@ -2,18 +2,20 @@ * QPEG codec * Copyright (c) 2004 Konstantin Shishkov * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/qtrle.c b/src/libffmpeg/libavcodec/qtrle.c index 0db003146..d4b314d03 100644 --- a/src/libffmpeg/libavcodec/qtrle.c +++ b/src/libffmpeg/libavcodec/qtrle.c @@ -2,18 +2,20 @@ * Quicktime Animation (RLE) Video Decoder * Copyright (C) 2004 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/ra144.c b/src/libffmpeg/libavcodec/ra144.c index 059236dfe..c4f4b813b 100644 --- a/src/libffmpeg/libavcodec/ra144.c +++ b/src/libffmpeg/libavcodec/ra144.c @@ -2,18 +2,20 @@ * Real Audio 1.0 (14.4K) * Copyright (c) 2003 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/ra144.h b/src/libffmpeg/libavcodec/ra144.h index 4ce2df867..6d477b2f8 100644 --- a/src/libffmpeg/libavcodec/ra144.h +++ b/src/libffmpeg/libavcodec/ra144.h @@ -2,18 +2,20 @@ * Real Audio 1.0 (14.4K) * Copyright (c) 2003 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/ra288.c b/src/libffmpeg/libavcodec/ra288.c index e2425974e..9ba5209ab 100644 --- a/src/libffmpeg/libavcodec/ra288.c +++ b/src/libffmpeg/libavcodec/ra288.c @@ -2,18 +2,20 @@ * RealAudio 2.0 (28.8K) * Copyright (c) 2003 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/ra288.h b/src/libffmpeg/libavcodec/ra288.h index 0d67d52bb..8cc290397 100644 --- a/src/libffmpeg/libavcodec/ra288.h +++ b/src/libffmpeg/libavcodec/ra288.h @@ -2,18 +2,20 @@ * RealAudio 2.0 (28.8K) * Copyright (c) 2003 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/rangecoder.c b/src/libffmpeg/libavcodec/rangecoder.c index 4266cf1b3..1f35d0852 100644 --- a/src/libffmpeg/libavcodec/rangecoder.c +++ b/src/libffmpeg/libavcodec/rangecoder.c @@ -2,18 +2,20 @@ * Range coder * Copyright (c) 2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/rangecoder.h b/src/libffmpeg/libavcodec/rangecoder.h index 0f56fad59..68bd3b60e 100644 --- a/src/libffmpeg/libavcodec/rangecoder.h +++ b/src/libffmpeg/libavcodec/rangecoder.h @@ -2,18 +2,20 @@ * Range coder * Copyright (c) 2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/ratecontrol.c b/src/libffmpeg/libavcodec/ratecontrol.c index f4f433add..d96c837e6 100644 --- a/src/libffmpeg/libavcodec/ratecontrol.c +++ b/src/libffmpeg/libavcodec/ratecontrol.c @@ -3,18 +3,20 @@ * * Copyright (c) 2002-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -25,7 +27,9 @@ #include "avcodec.h" #include "dsputil.h" +#include "ratecontrol.h" #include "mpegvideo.h" +#include "eval.h" #undef NDEBUG // allways check asserts, the speed effect is far too small to disable them #include @@ -44,12 +48,70 @@ void ff_write_pass1_stats(MpegEncContext *s){ s->f_code, s->b_code, s->current_picture.mc_mb_var_sum, s->current_picture.mb_var_sum, s->i_count, s->skip_count, s->header_bits); } +static inline double qp2bits(RateControlEntry *rce, double qp){ + if(qp<=0.0){ + av_log(NULL, AV_LOG_ERROR, "qp<=0.0\n"); + } + return rce->qscale * (double)(rce->i_tex_bits + rce->p_tex_bits+1)/ qp; +} + +static inline double bits2qp(RateControlEntry *rce, double bits){ + if(bits<0.9){ + av_log(NULL, AV_LOG_ERROR, "bits<0.9\n"); + } + return rce->qscale * (double)(rce->i_tex_bits + rce->p_tex_bits+1)/ bits; +} + int ff_rate_control_init(MpegEncContext *s) { RateControlContext *rcc= &s->rc_context; int i; + char *error = NULL; + static const char *const_names[]={ + "PI", + "E", + "iTex", + "pTex", + "tex", + "mv", + "fCode", + "iCount", + "mcVar", + "var", + "isI", + "isP", + "isB", + "avgQP", + "qComp", +/* "lastIQP", + "lastPQP", + "lastBQP", + "nextNonBQP",*/ + "avgIITex", + "avgPITex", + "avgPPTex", + "avgBPTex", + "avgTex", + NULL + }; + static double (*func1[])(void *, double)={ + (void *)bits2qp, + (void *)qp2bits, + NULL + }; + static const char *func1_names[]={ + "bits2qp", + "qp2bits", + NULL + }; emms_c(); + rcc->rc_eq_eval = ff_parse(s->avctx->rc_eq, const_names, func1, func1_names, NULL, NULL, &error); + if (!rcc->rc_eq_eval) { + av_log(s->avctx, AV_LOG_ERROR, "Error parsing rc_eq \"%s\": %s\n", s->avctx->rc_eq, error? error : ""); + return -1; + } + for(i=0; i<5; i++){ rcc->pred[i].coeff= FF_QP2LAMBDA * 7.0; rcc->pred[i].count= 1.0; @@ -191,6 +253,7 @@ void ff_rate_control_uninit(MpegEncContext *s) RateControlContext *rcc= &s->rc_context; emms_c(); + ff_eval_free(rcc->rc_eq_eval); av_freep(&rcc->entry); #ifdef CONFIG_XVID @@ -199,20 +262,6 @@ void ff_rate_control_uninit(MpegEncContext *s) #endif } -static inline double qp2bits(RateControlEntry *rce, double qp){ - if(qp<=0.0){ - av_log(NULL, AV_LOG_ERROR, "qp<=0.0\n"); - } - return rce->qscale * (double)(rce->i_tex_bits + rce->p_tex_bits+1)/ qp; -} - -static inline double bits2qp(RateControlEntry *rce, double bits){ - if(bits<0.9){ - av_log(NULL, AV_LOG_ERROR, "bits<0.9\n"); - } - return rce->qscale * (double)(rce->i_tex_bits + rce->p_tex_bits+1)/ bits; -} - int ff_vbv_update(MpegEncContext *s, int frame_size){ RateControlContext *rcc= &s->rc_context; const double fps= 1/av_q2d(s->avctx->time_base); @@ -287,45 +336,12 @@ static double get_qscale(MpegEncContext *s, RateControlEntry *rce, double rate_f (rcc->i_cplx_sum[pict_type] + rcc->p_cplx_sum[pict_type]) / (double)rcc->frame_count[pict_type], 0 }; - static const char *const_names[]={ - "PI", - "E", - "iTex", - "pTex", - "tex", - "mv", - "fCode", - "iCount", - "mcVar", - "var", - "isI", - "isP", - "isB", - "avgQP", - "qComp", -/* "lastIQP", - "lastPQP", - "lastBQP", - "nextNonBQP",*/ - "avgIITex", - "avgPITex", - "avgPPTex", - "avgBPTex", - "avgTex", - NULL - }; - static double (*func1[])(void *, double)={ - (void *)bits2qp, - (void *)qp2bits, - NULL - }; - static const char *func1_names[]={ - "bits2qp", - "qp2bits", - NULL - }; - bits= ff_eval(s->avctx->rc_eq, const_values, const_names, func1, func1_names, NULL, NULL, rce); + bits= ff_parse_eval(rcc->rc_eq_eval, const_values, rce); + if (isnan(bits)) { + av_log(s->avctx, AV_LOG_ERROR, "Error evaluating rc_eq \"%s\"\n", s->avctx->rc_eq); + return -1; + } rcc->pass1_rc_eq_output_sum+= bits; bits*=rate_factor; @@ -363,7 +379,7 @@ static double get_diff_limited_q(MpegEncContext *s, RateControlEntry *rce, doubl const double last_non_b_q= rcc->last_qscale_for[rcc->last_non_b_pict_type]; if (pict_type==I_TYPE && (a->i_quant_factor>0.0 || rcc->last_non_b_pict_type==P_TYPE)) - q= last_p_q *ABS(a->i_quant_factor) + a->i_quant_offset; + q= last_p_q *FFABS(a->i_quant_factor) + a->i_quant_offset; else if(pict_type==B_TYPE && a->b_quant_factor>0.0) q= last_non_b_q* a->b_quant_factor + a->b_quant_offset; @@ -394,11 +410,11 @@ static void get_qminmax(int *qmin_ret, int *qmax_ret, MpegEncContext *s, int pic assert(qmin <= qmax); if(pict_type==B_TYPE){ - qmin= (int)(qmin*ABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset + 0.5); - qmax= (int)(qmax*ABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset + 0.5); + qmin= (int)(qmin*FFABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset + 0.5); + qmax= (int)(qmax*FFABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset + 0.5); }else if(pict_type==I_TYPE){ - qmin= (int)(qmin*ABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset + 0.5); - qmax= (int)(qmax*ABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset + 0.5); + qmin= (int)(qmin*FFABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset + 0.5); + qmax= (int)(qmax*FFABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset + 0.5); } qmin= clip(qmin, 1, FF_LAMBDA_MAX); @@ -726,6 +742,8 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) rate_factor= rcc->pass1_wanted_bits/rcc->pass1_rc_eq_output_sum * br_compensation; q= get_qscale(s, rce, rate_factor, picture_number); + if (q < 0) + return -1; assert(q>0.0); //printf("%f ", q); @@ -790,12 +808,10 @@ static int init_pass2(MpegEncContext *s) { RateControlContext *rcc= &s->rc_context; AVCodecContext *a= s->avctx; - int i; + int i, toobig; double fps= 1/av_q2d(s->avctx->time_base); double complexity[5]={0,0,0,0,0}; // aproximate bits at quant=1 - double avg_quantizer[5]; uint64_t const_bits[5]={0,0,0,0,0}; // quantizer idependant bits - uint64_t available_bits[5]; uint64_t all_const_bits; uint64_t all_available_bits= (uint64_t)(s->bit_rate*(double)rcc->num_entries/fps); double rate_factor=0; @@ -803,7 +819,7 @@ static int init_pass2(MpegEncContext *s) //int last_i_frame=-10000000; const int filter_size= (int)(a->qblur*4) | 1; double expected_bits; - double *qscale, *blured_qscale; + double *qscale, *blured_qscale, qscale_sum; /* find complexity & const_bits & decide the pict_types */ for(i=0; inum_entries; i++){ @@ -821,37 +837,13 @@ static int init_pass2(MpegEncContext *s) all_const_bits= const_bits[I_TYPE] + const_bits[P_TYPE] + const_bits[B_TYPE]; if(all_available_bits < all_const_bits){ - av_log(s->avctx, AV_LOG_ERROR, "requested bitrate is to low\n"); + av_log(s->avctx, AV_LOG_ERROR, "requested bitrate is too low\n"); return -1; } - /* find average quantizers */ - avg_quantizer[P_TYPE]=0; - for(step=256*256; step>0.0000001; step*=0.5){ - double expected_bits=0; - avg_quantizer[P_TYPE]+= step; - - avg_quantizer[I_TYPE]= avg_quantizer[P_TYPE]*ABS(s->avctx->i_quant_factor) + s->avctx->i_quant_offset; - avg_quantizer[B_TYPE]= avg_quantizer[P_TYPE]*ABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; - - expected_bits= - + all_const_bits - + complexity[I_TYPE]/avg_quantizer[I_TYPE] - + complexity[P_TYPE]/avg_quantizer[P_TYPE] - + complexity[B_TYPE]/avg_quantizer[B_TYPE]; - - if(expected_bits < all_available_bits) avg_quantizer[P_TYPE]-= step; -//printf("%f %lld %f\n", expected_bits, all_available_bits, avg_quantizer[P_TYPE]); - } -//printf("qp_i:%f, qp_p:%f, qp_b:%f\n", avg_quantizer[I_TYPE],avg_quantizer[P_TYPE],avg_quantizer[B_TYPE]); - - for(i=0; i<5; i++){ - available_bits[i]= const_bits[i] + complexity[i]/avg_quantizer[i]; - } -//printf("%lld %lld %lld %lld\n", available_bits[I_TYPE], available_bits[P_TYPE], available_bits[B_TYPE], all_available_bits); - qscale= av_malloc(sizeof(double)*rcc->num_entries); blured_qscale= av_malloc(sizeof(double)*rcc->num_entries); + toobig = 0; for(step=256*256; step>0.0000001; step*=0.5){ expected_bits=0; @@ -905,14 +897,46 @@ static int init_pass2(MpegEncContext *s) expected_bits += bits; } -// printf("%f %d %f\n", expected_bits, (int)all_available_bits, rate_factor); - if(expected_bits > all_available_bits) rate_factor-= step; + /* + av_log(s->avctx, AV_LOG_INFO, + "expected_bits: %f all_available_bits: %d rate_factor: %f\n", + expected_bits, (int)all_available_bits, rate_factor); + */ + if(expected_bits > all_available_bits) { + rate_factor-= step; + ++toobig; + } } av_free(qscale); av_free(blured_qscale); - if(fabs(expected_bits/all_available_bits - 1.0) > 0.01 ){ - av_log(s->avctx, AV_LOG_ERROR, "Error: 2pass curve failed to converge\n"); + /* check bitrate calculations and print info */ + qscale_sum = 0.0; + for(i=0; inum_entries; i++){ + /* av_log(s->avctx, AV_LOG_DEBUG, "[lavc rc] entry[%d].new_qscale = %.3f qp = %.3f\n", + i, rcc->entry[i].new_qscale, rcc->entry[i].new_qscale / FF_QP2LAMBDA); */ + qscale_sum += clip(rcc->entry[i].new_qscale / FF_QP2LAMBDA, s->avctx->qmin, s->avctx->qmax); + } + assert(toobig <= 40); + av_log(s->avctx, AV_LOG_DEBUG, + "[lavc rc] requested bitrate: %d bps expected bitrate: %d bps\n", + s->bit_rate, + (int)(expected_bits / ((double)all_available_bits/s->bit_rate))); + av_log(s->avctx, AV_LOG_DEBUG, + "[lavc rc] estimated target average qp: %.3f\n", + (float)qscale_sum / rcc->num_entries); + if (toobig == 0) { + av_log(s->avctx, AV_LOG_INFO, + "[lavc rc] Using all of requested bitrate is not " + "necessary for this video with these parameters.\n"); + } else if (toobig == 40) { + av_log(s->avctx, AV_LOG_ERROR, + "[lavc rc] Error: bitrate too low for this video " + "with these parameters.\n"); + return -1; + } else if (fabs(expected_bits/all_available_bits - 1.0) > 0.01) { + av_log(s->avctx, AV_LOG_ERROR, + "[lavc rc] Error: 2pass curve failed to converge\n"); return -1; } diff --git a/src/libffmpeg/libavcodec/ratecontrol.h b/src/libffmpeg/libavcodec/ratecontrol.h new file mode 100644 index 000000000..c428923a5 --- /dev/null +++ b/src/libffmpeg/libavcodec/ratecontrol.h @@ -0,0 +1,103 @@ +/* + * Ratecontrol + * Copyright (c) 2000, 2001, 2002 Fabrice Bellard. + * Copyright (c) 2002-2004 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_RATECONTROL_H +#define AVCODEC_RATECONTROL_H + +/** + * @file ratecontrol.h + * ratecontrol header. + */ + +#include "eval.h" + +typedef struct Predictor{ + double coeff; + double count; + double decay; +} Predictor; + +typedef struct RateControlEntry{ + int pict_type; + float qscale; + int mv_bits; + int i_tex_bits; + int p_tex_bits; + int misc_bits; + int header_bits; + uint64_t expected_bits; + int new_pict_type; + float new_qscale; + int mc_mb_var_sum; + int mb_var_sum; + int i_count; + int skip_count; + int f_code; + int b_code; +}RateControlEntry; + +/** + * rate control context. + */ +typedef struct RateControlContext{ + FILE *stats_file; + int num_entries; ///< number of RateControlEntries + RateControlEntry *entry; + double buffer_index; ///< amount of bits in the video/audio buffer + Predictor pred[5]; + double short_term_qsum; ///< sum of recent qscales + double short_term_qcount; ///< count of recent qscales + double pass1_rc_eq_output_sum;///< sum of the output of the rc equation, this is used for normalization + double pass1_wanted_bits; ///< bits which should have been outputed by the pass1 code (including complexity init) + double last_qscale; + double last_qscale_for[5]; ///< last qscale for a specific pict type, used for max_diff & ipb factor stuff + int last_mc_mb_var_sum; + int last_mb_var_sum; + uint64_t i_cplx_sum[5]; + uint64_t p_cplx_sum[5]; + uint64_t mv_bits_sum[5]; + uint64_t qscale_sum[5]; + int frame_count[5]; + int last_non_b_pict_type; + + void *non_lavc_opaque; ///< context for non lavc rc code (for example xvid) + float dry_run_qscale; ///< for xvid rc + int last_picture_number; ///< for xvid rc + AVEvalExpr * rc_eq_eval; +}RateControlContext; + +struct MpegEncContext; + +/* rate control */ +int ff_rate_control_init(struct MpegEncContext *s); +float ff_rate_estimate_qscale(struct MpegEncContext *s, int dry_run); +void ff_write_pass1_stats(struct MpegEncContext *s); +void ff_rate_control_uninit(struct MpegEncContext *s); +int ff_vbv_update(struct MpegEncContext *s, int frame_size); +void ff_get_2pass_fcode(struct MpegEncContext *s); + +int ff_xvid_rate_control_init(struct MpegEncContext *s); +void ff_xvid_rate_control_uninit(struct MpegEncContext *s); +float ff_xvid_rate_estimate_qscale(struct MpegEncContext *s, int dry_run); + +#endif /* AVCODEC_RATECONTROL_H */ + diff --git a/src/libffmpeg/libavcodec/raw.c b/src/libffmpeg/libavcodec/raw.c index e777397fe..f4fddf73c 100644 --- a/src/libffmpeg/libavcodec/raw.c +++ b/src/libffmpeg/libavcodec/raw.c @@ -2,18 +2,20 @@ * Raw Video Codec * Copyright (c) 2001 Fabrice Bellard. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -35,9 +37,10 @@ typedef struct PixelFormatTag { unsigned int fourcc; } PixelFormatTag; -const PixelFormatTag pixelFormatTags[] = { +static const PixelFormatTag pixelFormatTags[] = { { PIX_FMT_YUV420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */ { PIX_FMT_YUV420P, MKTAG('I', 'Y', 'U', 'V') }, + { PIX_FMT_YUV420P, MKTAG('Y', 'V', '1', '2') }, { PIX_FMT_YUV410P, MKTAG('Y', 'U', 'V', '9') }, { PIX_FMT_YUV411P, MKTAG('Y', '4', '1', 'B') }, { PIX_FMT_YUV422P, MKTAG('Y', '4', '2', 'B') }, @@ -49,6 +52,10 @@ const PixelFormatTag pixelFormatTags[] = { { PIX_FMT_YUV422, MKTAG('Y', '4', '2', '2') }, { PIX_FMT_UYVY422, MKTAG('U', 'Y', 'V', 'Y') }, { PIX_FMT_GRAY8, MKTAG('G', 'R', 'E', 'Y') }, + { PIX_FMT_RGB555, MKTAG('R', 'G', 'B', 15) }, + { PIX_FMT_BGR555, MKTAG('B', 'G', 'R', 15) }, + { PIX_FMT_RGB565, MKTAG('R', 'G', 'B', 16) }, + { PIX_FMT_BGR565, MKTAG('B', 'G', 'R', 16) }, /* quicktime */ { PIX_FMT_UYVY422, MKTAG('2', 'v', 'u', 'y') }, @@ -90,7 +97,7 @@ static int raw_init_decoder(AVCodecContext *avctx) switch(avctx->bits_per_sample){ case 8: avctx->pix_fmt= PIX_FMT_PAL8 ; break; case 15: avctx->pix_fmt= PIX_FMT_RGB555; break; - case 16: avctx->pix_fmt= PIX_FMT_RGB565; break; + case 16: avctx->pix_fmt= PIX_FMT_RGB555; break; case 24: avctx->pix_fmt= PIX_FMT_BGR24 ; break; case 32: avctx->pix_fmt= PIX_FMT_RGBA32; break; } @@ -141,6 +148,15 @@ static int raw_decode(AVCodecContext *avctx, } flip(avctx, picture); + + if (avctx->codec_tag == MKTAG('Y', 'V', '1', '2')) + { + // swap fields + unsigned char *tmp = picture->data[1]; + picture->data[1] = picture->data[2]; + picture->data[2] = tmp; + } + *data_size = sizeof(AVPicture); return buf_size; } @@ -154,7 +170,7 @@ static int raw_close_decoder(AVCodecContext *avctx) } /* RAW Encoder Implementation */ - +#ifdef CONFIG_RAWVIDEO_ENCODER static int raw_init_encoder(AVCodecContext *avctx) { avctx->coded_frame = (AVFrame *)avctx->priv_data; @@ -172,7 +188,6 @@ static int raw_encode(AVCodecContext *avctx, avctx->height, frame, buf_size); } -#ifdef CONFIG_RAWVIDEO_ENCODER AVCodec rawvideo_encoder = { "rawvideo", CODEC_TYPE_VIDEO, diff --git a/src/libffmpeg/libavcodec/resample2.c b/src/libffmpeg/libavcodec/resample2.c index 11da57651..3ae0ba855 100644 --- a/src/libffmpeg/libavcodec/resample2.c +++ b/src/libffmpeg/libavcodec/resample2.c @@ -2,18 +2,20 @@ * audio resampling * Copyright (c) 2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -213,7 +215,7 @@ int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int if(sample_index < 0){ for(i=0; ifilter_length; i++) - val += src[ABS(sample_index + i) % src_size] * filter[i]; + val += src[FFABS(sample_index + i) % src_size] * filter[i]; }else if(sample_index + c->filter_length > src_size){ break; }else if(c->linear){ diff --git a/src/libffmpeg/libavcodec/roqvideo.c b/src/libffmpeg/libavcodec/roqvideo.c index 462a4cf72..4595b047c 100644 --- a/src/libffmpeg/libavcodec/roqvideo.c +++ b/src/libffmpeg/libavcodec/roqvideo.c @@ -1,18 +1,20 @@ /* * Copyright (C) 2003 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/rpza.c b/src/libffmpeg/libavcodec/rpza.c index 8c0766273..9a996da37 100644 --- a/src/libffmpeg/libavcodec/rpza.c +++ b/src/libffmpeg/libavcodec/rpza.c @@ -2,18 +2,20 @@ * Quicktime Video (RPZA) Video Decoder * Copyright (C) 2003 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/rtjpeg.c b/src/libffmpeg/libavcodec/rtjpeg.c index ebf10886b..dbc6cfd88 100644 --- a/src/libffmpeg/libavcodec/rtjpeg.c +++ b/src/libffmpeg/libavcodec/rtjpeg.c @@ -2,18 +2,20 @@ * RTJpeg decoding functions * Copyright (c) 2006 Reimar Doeffinger * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "common.h" @@ -96,31 +98,32 @@ static inline int get_block(GetBitContext *gb, DCTELEM *block, uint8_t *scan, */ int rtjpeg_decode_frame_yuv420(RTJpegContext *c, AVFrame *f, uint8_t *buf, int buf_size) { + DECLARE_ALIGNED_16(DCTELEM, block[64]); GetBitContext gb; int w = c->w / 16, h = c->h / 16; int x, y; - void *y1 = f->data[0], *y2 = f->data[0] + 8 * f->linesize[0]; - void *u = f->data[1], *v = f->data[2]; + uint8_t *y1 = f->data[0], *y2 = f->data[0] + 8 * f->linesize[0]; + uint8_t *u = f->data[1], *v = f->data[2]; init_get_bits(&gb, buf, buf_size * 8); for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { - if (get_block(&gb, c->block, c->scan, c->lquant)) - c->dsp->idct_put(y1, f->linesize[0], c->block); + if (get_block(&gb, block, c->scan, c->lquant)) + c->dsp->idct_put(y1, f->linesize[0], block); y1 += 8; - if (get_block(&gb, c->block, c->scan, c->lquant)) - c->dsp->idct_put(y1, f->linesize[0], c->block); + if (get_block(&gb, block, c->scan, c->lquant)) + c->dsp->idct_put(y1, f->linesize[0], block); y1 += 8; - if (get_block(&gb, c->block, c->scan, c->lquant)) - c->dsp->idct_put(y2, f->linesize[0], c->block); + if (get_block(&gb, block, c->scan, c->lquant)) + c->dsp->idct_put(y2, f->linesize[0], block); y2 += 8; - if (get_block(&gb, c->block, c->scan, c->lquant)) - c->dsp->idct_put(y2, f->linesize[0], c->block); + if (get_block(&gb, block, c->scan, c->lquant)) + c->dsp->idct_put(y2, f->linesize[0], block); y2 += 8; - if (get_block(&gb, c->block, c->scan, c->cquant)) - c->dsp->idct_put(u, f->linesize[1], c->block); + if (get_block(&gb, block, c->scan, c->cquant)) + c->dsp->idct_put(u, f->linesize[1], block); u += 8; - if (get_block(&gb, c->block, c->scan, c->cquant)) - c->dsp->idct_put(v, f->linesize[2], c->block); + if (get_block(&gb, block, c->scan, c->cquant)) + c->dsp->idct_put(v, f->linesize[2], block); v += 8; } y1 += 2 * 8 * (f->linesize[0] - w); diff --git a/src/libffmpeg/libavcodec/rtjpeg.h b/src/libffmpeg/libavcodec/rtjpeg.h index 1fc2fc934..daecc8a75 100644 --- a/src/libffmpeg/libavcodec/rtjpeg.h +++ b/src/libffmpeg/libavcodec/rtjpeg.h @@ -1,10 +1,30 @@ +/* + * RTJpeg decoding functions + * copyright (c) 2006 Reimar Doeffinger + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #ifndef RTJPEG_H #define RTJPEG_H typedef struct { int w, h; DSPContext *dsp; - DCTELEM block[64]; uint8_t scan[64]; uint32_t lquant[64]; uint32_t cquant[64]; diff --git a/src/libffmpeg/libavcodec/rv10.c b/src/libffmpeg/libavcodec/rv10.c index daec2b85b..4b50609c1 100644 --- a/src/libffmpeg/libavcodec/rv10.c +++ b/src/libffmpeg/libavcodec/rv10.c @@ -3,18 +3,20 @@ * Copyright (c) 2000,2001 Fabrice Bellard. * Copyright (c) 2002-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -383,8 +385,9 @@ static int rv20_decode_picture_header(MpegEncContext *s) av_log(s->avctx, AV_LOG_DEBUG, "\n"); #endif #if 0 + av_log(s->avctx, AV_LOG_DEBUG, "%3dx%03d/%02Xx%02X ", s->width, s->height, s->width/4, s->height/4); for(i=0; iavctx->extradata_size; i++){ - av_log(s->avctx, AV_LOG_DEBUG, "%2X ", ((uint8_t*)s->avctx->extradata)[i]); + av_log(s->avctx, AV_LOG_DEBUG, "%02X ", ((uint8_t*)s->avctx->extradata)[i]); if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " "); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); @@ -431,17 +434,32 @@ static int rv20_decode_picture_header(MpegEncContext *s) } if(s->avctx->has_b_frames){ - int f=9; - int v= s->avctx->extradata_size >= 4 ? ((uint8_t*)s->avctx->extradata)[1] : 0; + int f, new_w, new_h; + int v= s->avctx->extradata_size >= 4 ? 7&((uint8_t*)s->avctx->extradata)[1] : 0; if (get_bits(&s->gb, 1)){ av_log(s->avctx, AV_LOG_ERROR, "unknown bit3 set\n"); // return -1; } - seq= get_bits(&s->gb, 14)<<1; + seq= get_bits(&s->gb, 13)<<2; + + f= get_bits(&s->gb, av_log2(v)+1); - if(v) - f= get_bits(&s->gb, av_log2(v)); + if(f){ + new_w= 4*((uint8_t*)s->avctx->extradata)[6+2*f]; + new_h= 4*((uint8_t*)s->avctx->extradata)[7+2*f]; + }else{ + new_w= s->width; //FIXME wrong we of course must save the original in the context + new_h= s->height; + } + if(new_w != s->width || new_h != s->height){ + av_log(s->avctx, AV_LOG_DEBUG, "attempting to change resolution to %dx%d\n", new_w, new_h); + MPV_common_end(s); + s->width = s->avctx->width = new_w; + s->height = s->avctx->height= new_h; + if (MPV_common_init(s) < 0) + return -1; + } if(s->avctx->debug & FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_DEBUG, "F %d/%d\n", f, v); @@ -473,6 +491,7 @@ static int rv20_decode_picture_header(MpegEncContext *s) av_log(s->avctx, AV_LOG_DEBUG, "messed up order, possible from seeking? skipping current b frame\n"); return FRAME_SKIPPED; } + ff_mpeg4_init_direct_mv(s); } } // printf("%d %d %d %d %d\n", seq, (int)s->time, (int)s->last_non_b_time, s->pp_time, s->pb_time); @@ -515,26 +534,25 @@ static int rv10_decode_init(AVCodecContext *avctx) s->width = avctx->width; s->height = avctx->height; + s->h263_long_vectors= ((uint8_t*)avctx->extradata)[3] & 1; + avctx->sub_id= BE_32((uint8_t*)avctx->extradata + 4); + switch(avctx->sub_id){ case 0x10000000: s->rv10_version= 0; - s->h263_long_vectors=0; s->low_delay=1; break; case 0x10002000: s->rv10_version= 3; - s->h263_long_vectors=1; s->low_delay=1; s->obmc=1; break; case 0x10003000: s->rv10_version= 3; - s->h263_long_vectors=1; s->low_delay=1; break; case 0x10003001: s->rv10_version= 3; - s->h263_long_vectors=0; s->low_delay=1; break; case 0x20001000: /* real rv20 decoder fail on this id */ @@ -594,7 +612,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, uint8_t *buf, int buf_size) { MpegEncContext *s = avctx->priv_data; - int mb_count, mb_pos, left; + int mb_count, mb_pos, left, start_mb_x; init_get_bits(&s->gb, buf, buf_size*8); if(s->codec_id ==CODEC_ID_RV10) @@ -639,8 +657,9 @@ static int rv10_decode_packet(AVCodecContext *avctx, if(s->mb_y==0) s->first_slice_line=1; }else{ s->first_slice_line=1; + s->resync_mb_x= s->mb_x; } - s->resync_mb_x= s->mb_x; + start_mb_x= s->mb_x; s->resync_mb_y= s->mb_y; if(s->h263_aic){ s->y_dc_scale_table= @@ -699,7 +718,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, if(ret == SLICE_END) break; } - ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END); + ff_er_add_slice(s, start_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END); return buf_size; } diff --git a/src/libffmpeg/libavcodec/shorten.c b/src/libffmpeg/libavcodec/shorten.c index fe956bc39..358ecf23f 100644 --- a/src/libffmpeg/libavcodec/shorten.c +++ b/src/libffmpeg/libavcodec/shorten.c @@ -2,18 +2,20 @@ * Shorten decoder * Copyright (c) 2005 Jeff Muizelaar * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -334,7 +336,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, s->nwrap = FFMAX(NWRAP, maxnlpc); if (allocate_buffers(s)) - return -1; + return -1; init_offset(s); diff --git a/src/libffmpeg/libavcodec/simple_idct.c b/src/libffmpeg/libavcodec/simple_idct.c index 8fa83bec7..2c026f08f 100644 --- a/src/libffmpeg/libavcodec/simple_idct.c +++ b/src/libffmpeg/libavcodec/simple_idct.c @@ -3,18 +3,20 @@ * * Copyright (c) 2001 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -182,7 +184,7 @@ static inline void idctSparseColPut (uint8_t *dest, int line_size, DCTELEM * col) { int a0, a1, a2, a3, b0, b1, b2, b3; - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; /* XXX: I did that only to give same values as previous code */ a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4)); @@ -254,7 +256,7 @@ static inline void idctSparseColAdd (uint8_t *dest, int line_size, DCTELEM * col) { int a0, a1, a2, a3, b0, b1, b2, b3; - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; /* XXX: I did that only to give same values as previous code */ a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4)); @@ -429,7 +431,7 @@ void simple_idct(DCTELEM *block) static inline void idct4col(uint8_t *dest, int line_size, const DCTELEM *col) { int c0, c1, c2, c3, a0, a1, a2, a3; - const uint8_t *cm = cropTbl + MAX_NEG_CROP; + const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; a0 = col[8*0]; a1 = col[8*2]; @@ -509,7 +511,7 @@ void simple_idct248_put(uint8_t *dest, int line_size, DCTELEM *block) static inline void idct4col_add(uint8_t *dest, int line_size, const DCTELEM *col) { int c0, c1, c2, c3, a0, a1, a2, a3; - const uint8_t *cm = cropTbl + MAX_NEG_CROP; + const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; a0 = col[8*0]; a1 = col[8*1]; @@ -537,7 +539,7 @@ static inline void idct4col_add(uint8_t *dest, int line_size, const DCTELEM *col static inline void idct4row(DCTELEM *row) { int c0, c1, c2, c3, a0, a1, a2, a3; - //const uint8_t *cm = cropTbl + MAX_NEG_CROP; + //const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; a0 = row[0]; a1 = row[1]; diff --git a/src/libffmpeg/libavcodec/simple_idct.h b/src/libffmpeg/libavcodec/simple_idct.h index 64f410f0d..c4b453329 100644 --- a/src/libffmpeg/libavcodec/simple_idct.h +++ b/src/libffmpeg/libavcodec/simple_idct.h @@ -3,18 +3,20 @@ * * Copyright (c) 2001 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/smacker.c b/src/libffmpeg/libavcodec/smacker.c index 162c68ada..2f2185848 100644 --- a/src/libffmpeg/libavcodec/smacker.c +++ b/src/libffmpeg/libavcodec/smacker.c @@ -2,18 +2,20 @@ * Smacker decoder * Copyright (c) 2006 Konstantin Shishkov * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -520,7 +522,7 @@ static int decode_init(AVCodecContext *avctx) c->pic.data[0] = NULL; - if (avcodec_check_dimensions(avctx, avctx->height, avctx->width) < 0) { + if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) { return 1; } @@ -550,14 +552,10 @@ static int decode_end(AVCodecContext *avctx) { SmackVContext * const smk = (SmackVContext *)avctx->priv_data; - if(smk->mmap_tbl) - av_free(smk->mmap_tbl); - if(smk->mclr_tbl) - av_free(smk->mclr_tbl); - if(smk->full_tbl) - av_free(smk->full_tbl); - if(smk->type_tbl) - av_free(smk->type_tbl); + av_freep(&smk->mmap_tbl); + av_freep(&smk->mclr_tbl); + av_freep(&smk->full_tbl); + av_freep(&smk->type_tbl); if (smk->pic.data[0]) avctx->release_buffer(avctx, &smk->pic); diff --git a/src/libffmpeg/libavcodec/smc.c b/src/libffmpeg/libavcodec/smc.c index a08beeacd..77fae328b 100644 --- a/src/libffmpeg/libavcodec/smc.c +++ b/src/libffmpeg/libavcodec/smc.c @@ -2,18 +2,20 @@ * Quicktime Graphics (SMC) Video Decoder * Copyright (C) 2003 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/snow.c b/src/libffmpeg/libavcodec/snow.c index 05ad44726..346d56861 100644 --- a/src/libffmpeg/libavcodec/snow.c +++ b/src/libffmpeg/libavcodec/snow.c @@ -1,18 +1,20 @@ /* * Copyright (C) 2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -588,7 +590,7 @@ static inline void put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signe int i; if(v){ - const int a= ABS(v); + const int a= FFABS(v); const int e= av_log2(a); #if 1 const int el= FFMIN(e, 10); @@ -1664,7 +1666,7 @@ static int encode_subband_c0run(SnowContext *s, SubBand *b, DWTELEM *src, DWTELE p= parent[px + py*2*stride]; } if(/*ll|*/l|lt|t|rt|p){ - int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt) + ABS(p)); + int context= av_log2(/*FFABS(ll) + */3*FFABS(l) + FFABS(lt) + 2*FFABS(t) + FFABS(rt) + FFABS(p)); put_rac(&s->c, &b->state[0][context], !!v); }else{ @@ -1680,11 +1682,11 @@ static int encode_subband_c0run(SnowContext *s, SubBand *b, DWTELEM *src, DWTELE } } if(v){ - int context= av_log2(/*ABS(ll) + */3*ABS(l) + ABS(lt) + 2*ABS(t) + ABS(rt) + ABS(p)); - int l2= 2*ABS(l) + (l<0); - int t2= 2*ABS(t) + (t<0); + int context= av_log2(/*FFABS(ll) + */3*FFABS(l) + FFABS(lt) + 2*FFABS(t) + FFABS(rt) + FFABS(p)); + int l2= 2*FFABS(l) + (l<0); + int t2= 2*FFABS(t) + (t<0); - put_symbol2(&s->c, b->state[context + 2], ABS(v)-1, context-4); + put_symbol2(&s->c, b->state[context + 2], FFABS(v)-1, context-4); put_rac(&s->c, &b->state[0][16 + 1 + 3 + quant3bA[l2&0xFF] + 3*quant3bA[t2&0xFF]], v<0); } } @@ -1747,7 +1749,7 @@ static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, i } } if(/*ll|*/l|lt|t|rt|p){ - int context= av_log2(/*ABS(ll) + */3*(l>>1) + (lt>>1) + (t&~1) + (rt>>1) + (p>>1)); + int context= av_log2(/*FFABS(ll) + */3*(l>>1) + (lt>>1) + (t&~1) + (rt>>1) + (p>>1)); v=get_rac(&s->c, &b->state[0][context]); if(v){ @@ -1900,7 +1902,7 @@ static int pix_sum(uint8_t * pix, int line_size, int w) static int pix_norm1(uint8_t * pix, int line_size, int w) { int s, i, j; - uint32_t *sq = squareTbl + 256; + uint32_t *sq = ff_squareTbl + 256; s = 0; for (i = 0; i < w; i++) { @@ -2015,8 +2017,8 @@ static int encode_q_branch(SnowContext *s, int level, int x, int y){ const int shift= 1+qpel; MotionEstContext *c= &s->m.me; int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref); - int mx_context= av_log2(2*ABS(left->mx - top->mx)); - int my_context= av_log2(2*ABS(left->my - top->my)); + int mx_context= av_log2(2*FFABS(left->mx - top->mx)); + int my_context= av_log2(2*FFABS(left->my - top->my)); int s_context= 2*left->level + 2*top->level + tl->level + tr->level; int ref, best_ref, ref_score, ref_mx, ref_my; @@ -2229,8 +2231,8 @@ static void encode_q_branch2(SnowContext *s, int level, int x, int y){ int pcr= left->color[2]; int pmx, pmy; int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref); - int mx_context= av_log2(2*ABS(left->mx - top->mx)) + 16*!!b->ref; - int my_context= av_log2(2*ABS(left->my - top->my)) + 16*!!b->ref; + int mx_context= av_log2(2*FFABS(left->mx - top->mx)) + 16*!!b->ref; + int my_context= av_log2(2*FFABS(left->my - top->my)) + 16*!!b->ref; int s_context= 2*left->level + 2*top->level + tl->level + tr->level; if(s->keyframe){ @@ -2293,8 +2295,8 @@ static void decode_q_branch(SnowContext *s, int level, int x, int y){ int my= mid_pred(left->my, top->my, tr->my); int ref = 0; int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref); - int mx_context= av_log2(2*ABS(left->mx - top->mx)) + 0*av_log2(2*ABS(tr->mx - top->mx)); - int my_context= av_log2(2*ABS(left->my - top->my)) + 0*av_log2(2*ABS(tr->my - top->my)); + int mx_context= av_log2(2*FFABS(left->mx - top->mx)) + 0*av_log2(2*FFABS(tr->mx - top->mx)); + int my_context= av_log2(2*FFABS(left->my - top->my)) + 0*av_log2(2*FFABS(tr->my - top->my)); type= get_rac(&s->c, &s->block_state[1 + left->type + top->type]) ? BLOCK_INTRA : 0; @@ -2320,12 +2322,12 @@ static void decode_q_branch(SnowContext *s, int level, int x, int y){ } #ifdef CONFIG_ENCODERS -static void encode_blocks(SnowContext *s){ +static void encode_blocks(SnowContext *s, int search){ int x, y; int w= s->b_width; int h= s->b_height; - if(s->avctx->me_method == ME_ITER && !s->keyframe) + if(s->avctx->me_method == ME_ITER && !s->keyframe && search) iterative_me(s); for(y=0; yavctx->me_method == ME_ITER) + if(s->avctx->me_method == ME_ITER || !search) encode_q_branch2(s, 0, x, y); else encode_q_branch (s, 0, x, y); @@ -2555,137 +2557,7 @@ void ff_snow_inner_add_yblock(uint8_t *obmc, const int obmc_stride, uint8_t * * } //FIXME name clenup (b_w, block_w, b_width stuff) -static always_inline void add_yblock_buffered(SnowContext *s, slice_buffer * sb, DWTELEM *old_dst, uint8_t *dst8, uint8_t *obmc, int src_x, int src_y, int b_w, int b_h, int w, int h, int dst_stride, int src_stride, int obmc_stride, int b_x, int b_y, int add, int plane_index){ - DWTELEM * dst = NULL; - const int b_width = s->b_width << s->block_max_depth; - const int b_height= s->b_height << s->block_max_depth; - const int b_stride= b_width; - BlockNode *lt= &s->block[b_x + b_y*b_stride]; - BlockNode *rt= lt+1; - BlockNode *lb= lt+b_stride; - BlockNode *rb= lb+1; - uint8_t *block[4]; - int tmp_step= src_stride >= 7*MB_SIZE ? MB_SIZE : MB_SIZE*src_stride; - uint8_t tmp[src_stride*7*MB_SIZE]; //FIXME align - uint8_t *ptmp; - int x,y; - - if(b_x<0){ - lt= rt; - lb= rb; - }else if(b_x + 1 >= b_width){ - rt= lt; - rb= lb; - } - if(b_y<0){ - lt= lb; - rt= rb; - }else if(b_y + 1 >= b_height){ - lb= lt; - rb= rt; - } - - if(src_x<0){ //FIXME merge with prev & always round internal width upto *16 - obmc -= src_x; - b_w += src_x; - src_x=0; - }else if(src_x + b_w > w){ - b_w = w - src_x; - } - if(src_y<0){ - obmc -= src_y*obmc_stride; - b_h += src_y; - src_y=0; - }else if(src_y + b_h> h){ - b_h = h - src_y; - } - - if(b_w<=0 || b_h<=0) return; - -assert(src_stride > 2*MB_SIZE + 5); -// old_dst += src_x + src_y*dst_stride; - dst8+= src_x + src_y*src_stride; -// src += src_x + src_y*src_stride; - - ptmp= tmp + 3*tmp_step; - block[0]= ptmp; - ptmp+=tmp_step; - pred_block(s, block[0], tmp, src_stride, src_x, src_y, b_w, b_h, lt, plane_index, w, h); - - if(same_block(lt, rt)){ - block[1]= block[0]; - }else{ - block[1]= ptmp; - ptmp+=tmp_step; - pred_block(s, block[1], tmp, src_stride, src_x, src_y, b_w, b_h, rt, plane_index, w, h); - } - - if(same_block(lt, lb)){ - block[2]= block[0]; - }else if(same_block(rt, lb)){ - block[2]= block[1]; - }else{ - block[2]= ptmp; - ptmp+=tmp_step; - pred_block(s, block[2], tmp, src_stride, src_x, src_y, b_w, b_h, lb, plane_index, w, h); - } - - if(same_block(lt, rb) ){ - block[3]= block[0]; - }else if(same_block(rt, rb)){ - block[3]= block[1]; - }else if(same_block(lb, rb)){ - block[3]= block[2]; - }else{ - block[3]= ptmp; - pred_block(s, block[3], tmp, src_stride, src_x, src_y, b_w, b_h, rb, plane_index, w, h); - } -#if 0 - for(y=0; y>1); - for(x=0; x>1); - for(x=0; x>1); - uint8_t *obmc4= obmc3+ (obmc_stride>>1); - for(x=0; xdsp.inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8); - STOP_TIMER("Inner add y block") -} -#endif -} - -//FIXME name clenup (b_w, block_w, b_width stuff) -static always_inline void add_yblock(SnowContext *s, DWTELEM *dst, uint8_t *dst8, const uint8_t *obmc, int src_x, int src_y, int b_w, int b_h, int w, int h, int dst_stride, int src_stride, int obmc_stride, int b_x, int b_y, int add, int offset_dst, int plane_index){ +static always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer *sb, DWTELEM *dst, uint8_t *dst8, const uint8_t *obmc, int src_x, int src_y, int b_w, int b_h, int w, int h, int dst_stride, int src_stride, int obmc_stride, int b_x, int b_y, int add, int offset_dst, int plane_index){ const int b_width = s->b_width << s->block_max_depth; const int b_height= s->b_height << s->block_max_depth; const int b_stride= b_width; @@ -2717,7 +2589,7 @@ static always_inline void add_yblock(SnowContext *s, DWTELEM *dst, uint8_t *dst8 if(src_x<0){ //FIXME merge with prev & always round internal width upto *16 obmc -= src_x; b_w += src_x; - if(!offset_dst) + if(!sliced && !offset_dst) dst -= src_x; src_x=0; }else if(src_x + b_w > w){ @@ -2726,7 +2598,7 @@ static always_inline void add_yblock(SnowContext *s, DWTELEM *dst, uint8_t *dst8 if(src_y<0){ obmc -= src_y*obmc_stride; b_h += src_y; - if(!offset_dst) + if(!sliced && !offset_dst) dst -= src_y*dst_stride; src_y=0; }else if(src_y + b_h> h){ @@ -2736,7 +2608,7 @@ static always_inline void add_yblock(SnowContext *s, DWTELEM *dst, uint8_t *dst8 if(b_w<=0 || b_h<=0) return; assert(src_stride > 2*MB_SIZE + 5); - if(offset_dst) + if(!sliced && offset_dst) dst += src_x + src_y*dst_stride; dst8+= src_x + src_y*src_stride; // src += src_x + src_y*src_stride; @@ -2808,6 +2680,12 @@ assert(src_stride > 2*MB_SIZE + 5); } } #else + if(sliced){ + START_TIMER + + s->dsp.inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8); + STOP_TIMER("inner_add_yblock") + }else for(y=0; y>1)*obmc_stride)*block_w, NULL, obmc, + add_yblock(s, 0, NULL, dst + ((i&1)+(i>>1)*obmc_stride)*block_w, NULL, obmc, x, y, block_w, block_w, w, h, obmc_stride, ref_stride, obmc_stride, mb_x2, mb_y2, 0, 0, plane_index); for(y2= FFMAX(y, 0); y2block[index-b_stride-1] : left; BlockNode *tr = y && x+wblock[index-b_stride+w] : tl; int dmx, dmy; -// int mx_context= av_log2(2*ABS(left->mx - top->mx)); -// int my_context= av_log2(2*ABS(left->my - top->my)); +// int mx_context= av_log2(2*FFABS(left->mx - top->mx)); +// int my_context= av_log2(2*FFABS(left->my - top->my)); if(x<0 || x>=b_stride || y>=b_height) return 0; @@ -3049,15 +2927,15 @@ static inline int get_block_bits(SnowContext *s, int x, int y, int w){ //FIXME try accurate rate //FIXME intra and inter predictors if surrounding blocks arent the same type if(b->type & BLOCK_INTRA){ - return 3+2*( av_log2(2*ABS(left->color[0] - b->color[0])) - + av_log2(2*ABS(left->color[1] - b->color[1])) - + av_log2(2*ABS(left->color[2] - b->color[2]))); + return 3+2*( av_log2(2*FFABS(left->color[0] - b->color[0])) + + av_log2(2*FFABS(left->color[1] - b->color[1])) + + av_log2(2*FFABS(left->color[2] - b->color[2]))); }else{ pred_mv(s, &dmx, &dmy, b->ref, left, top, tr); dmx-= b->mx; dmy-= b->my; - return 2*(1 + av_log2(2*ABS(dmx)) //FIXME kill the 2* can be merged in lambda - + av_log2(2*ABS(dmy)) + return 2*(1 + av_log2(2*FFABS(dmx)) //FIXME kill the 2* can be merged in lambda + + av_log2(2*FFABS(dmy)) + av_log2(2*b->ref)); } } @@ -3066,7 +2944,6 @@ static int get_block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index, con Plane *p= &s->plane[plane_index]; const int block_size = MB_SIZE >> s->block_max_depth; const int block_w = plane_index ? block_size/2 : block_size; - const uint8_t *obmc = plane_index ? obmc_tab[s->block_max_depth+1] : obmc_tab[s->block_max_depth]; const int obmc_stride= plane_index ? block_size : 2*block_size; const int ref_stride= s->current_picture.linesize[plane_index]; uint8_t *dst= s->current_picture.data[plane_index]; @@ -3167,9 +3044,8 @@ static int get_4block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index){ const int ref_stride= s->current_picture.linesize[plane_index]; uint8_t *dst= s->current_picture.data[plane_index]; uint8_t *src= s-> input_picture.data[plane_index]; - const static DWTELEM zero_dst[4096]; //FIXME + static const DWTELEM zero_dst[4096]; //FIXME const int b_stride = s->b_width << s->block_max_depth; - const int b_height = s->b_height<< s->block_max_depth; const int w= p->width; const int h= p->height; int distortion= 0; @@ -3182,7 +3058,7 @@ static int get_4block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index){ int x= block_w*mb_x2 + block_w/2; int y= block_w*mb_y2 + block_w/2; - add_yblock(s, zero_dst, dst, obmc, + add_yblock(s, 0, NULL, zero_dst, dst, obmc, x, y, block_w, block_w, w, h, /*dst_stride*/0, ref_stride, obmc_stride, mb_x2, mb_y2, 1, 1, plane_index); //FIXME find a cleaner/simpler way to skip the outside stuff @@ -3961,13 +3837,13 @@ static int qscale2qlog(int qscale){ + 61*QROOT/8; //<64 >60 } -static void ratecontrol_1pass(SnowContext *s, AVFrame *pict) +static int ratecontrol_1pass(SnowContext *s, AVFrame *pict) { /* estimate the frame's complexity as a sum of weighted dwt coefs. * FIXME we know exact mv bits at this point, * but ratecontrol isn't set up to include them. */ uint32_t coef_sum= 0; - int level, orientation; + int level, orientation, delta_qlog; for(level=0; levelspatial_decomposition_count; level++){ for(orientation=level ? 1 : 0; orientation<4; orientation++){ @@ -4003,8 +3879,12 @@ static void ratecontrol_1pass(SnowContext *s, AVFrame *pict) } pict->quality= ff_rate_estimate_qscale(&s->m, 1); + if (pict->quality < 0) + return INT_MIN; s->lambda= pict->quality * 3/2; - s->qlog= qscale2qlog(pict->quality); + delta_qlog= qscale2qlog(pict->quality) - s->qlog; + s->qlog+= delta_qlog; + return delta_qlog; } static void calculate_vissual_weight(SnowContext *s, Plane *p){ @@ -4169,6 +4049,8 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, const int width= s->avctx->width; const int height= s->avctx->height; int level, orientation, plane_index, i, y; + uint8_t rc_header_bak[sizeof(s->header_state)]; + uint8_t rc_block_bak[sizeof(s->block_state)]; ff_init_range_encoder(c, buf, buf_size); ff_build_rac_states(c, 0.05*(1LL<<32), 256-8); @@ -4187,8 +4069,11 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, s->m.pict_type = pict->pict_type= s->m.rc_context.entry[avctx->frame_number].new_pict_type; s->keyframe= pict->pict_type==FF_I_TYPE; - if(!(avctx->flags&CODEC_FLAG_QSCALE)) + if(!(avctx->flags&CODEC_FLAG_QSCALE)) { pict->quality= ff_rate_estimate_qscale(&s->m, 0); + if (pict->quality < 0) + return -1; + } }else{ s->keyframe= avctx->gop_size==0 || avctx->frame_number % avctx->gop_size == 0; s->m.pict_type= @@ -4251,6 +4136,11 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, s->dsp= s->m.dsp; } + if(s->pass1_rc){ + memcpy(rc_header_bak, s->header_state, sizeof(s->header_state)); + memcpy(rc_block_bak, s->block_state, sizeof(s->block_state)); + } + redo_frame: s->m.pict_type = pict->pict_type; @@ -4258,7 +4148,7 @@ redo_frame: encode_header(s); s->m.misc_bits = 8*(s->c.bytestream - s->c.bytestream_start); - encode_blocks(s); + encode_blocks(s, 1); s->m.mv_bits = 8*(s->c.bytestream - s->c.bytestream_start) - s->m.misc_bits; for(plane_index=0; plane_index<3; plane_index++){ @@ -4301,8 +4191,19 @@ redo_frame: ff_spatial_dwt(s->spatial_dwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count); - if(s->pass1_rc && plane_index==0) - ratecontrol_1pass(s, pict); + if(s->pass1_rc && plane_index==0){ + int delta_qlog = ratecontrol_1pass(s, pict); + if (delta_qlog <= INT_MIN) + return -1; + if(delta_qlog){ + //reordering qlog in the bitstream would eliminate this reset + ff_init_range_encoder(c, buf, buf_size); + memcpy(s->header_state, rc_header_bak, sizeof(s->header_state)); + memcpy(s->block_state, rc_block_bak, sizeof(s->block_state)); + encode_header(s); + encode_blocks(s, 0); + } + } for(level=0; levelspatial_decomposition_count; level++){ for(orientation=level ? 1 : 0; orientation<4; orientation++){ @@ -4380,10 +4281,15 @@ STOP_TIMER("pred-conv")} s->m.current_picture.quality = pict->quality; s->m.total_bits += 8*(s->c.bytestream - s->c.bytestream_start); if(s->pass1_rc) - ff_rate_estimate_qscale(&s->m, 0); + if (ff_rate_estimate_qscale(&s->m, 0) < 0) + return -1; if(avctx->flags&CODEC_FLAG_PASS1) ff_write_pass1_stats(&s->m); s->m.last_pict_type = s->m.pict_type; + avctx->frame_bits = s->m.frame_bits; + avctx->mv_bits = s->m.mv_bits; + avctx->misc_bits = s->m.misc_bits; + avctx->p_tex_bits = s->m.p_tex_bits; emms_c(); @@ -4671,7 +4577,7 @@ int main(){ ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); for(i=0; i20) printf("fsck: %d %d %d\n",i, buffer[0][i], buffer[1][i]); + if(FFABS(buffer[0][i] - buffer[1][i])>20) printf("fsck: %d %d %d\n",i, buffer[0][i], buffer[1][i]); #if 0 printf("testing AC coder\n"); @@ -4681,7 +4587,7 @@ int main(){ for(i=-256; i<256; i++){ START_TIMER - put_symbol(&s.c, s.header_state, i*i*i/3*ABS(i), 1); + put_symbol(&s.c, s.header_state, i*i*i/3*FFABS(i), 1); STOP_TIMER("put_symbol") } ff_rac_terminate(&s.c); @@ -4695,7 +4601,7 @@ STOP_TIMER("put_symbol") START_TIMER j= get_symbol(&s.c, s.header_state, 1); STOP_TIMER("get_symbol") - if(j!=i*i*i/3*ABS(i)) printf("fsck: %d != %d\n", i, j); + if(j!=i*i*i/3*FFABS(i)) printf("fsck: %d != %d\n", i, j); } #endif { @@ -4724,9 +4630,9 @@ int64_t g=0; for(x=0; x * Copyright (C) 2006 Robert Edele * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -125,9 +127,13 @@ extern void ff_snow_vertical_compose97i(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, D extern void ff_snow_horizontal_compose97i(DWTELEM *b, int width); extern void ff_snow_inner_add_yblock(uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h, int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8); +#ifdef CONFIG_SNOW_ENCODER int w53_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h); int w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h); - +#else +static int w53_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {assert (0);} +static int w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {assert (0);} +#endif /* C bits used by mmx/sse2/altivec */ diff --git a/src/libffmpeg/libavcodec/sp5x.h b/src/libffmpeg/libavcodec/sp5x.h index 72ae1cab1..0d0d3551f 100644 --- a/src/libffmpeg/libavcodec/sp5x.h +++ b/src/libffmpeg/libavcodec/sp5x.h @@ -2,18 +2,20 @@ * Sunplus JPEG tables * Copyright (c) 2003 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/sparc/dsputil_vis.c b/src/libffmpeg/libavcodec/sparc/dsputil_vis.c index f4ac3883d..5e59ce776 100644 --- a/src/libffmpeg/libavcodec/sparc/dsputil_vis.c +++ b/src/libffmpeg/libavcodec/sparc/dsputil_vis.c @@ -2,21 +2,20 @@ * dsputil_vis.c * Copyright (C) 2003 David S. Miller * - * This file is part of ffmpeg, a free MPEG-4 video stream decoder. - * See http://ffmpeg.sourceforge.net/ for updates. + * This file is part of FFmpeg. * - * ffmpeg is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * - * ffmpeg is distributed in the hope that it will be useful, + * FFmpeg 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. + * 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 Lesser GNU General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/sparc/vis.h b/src/libffmpeg/libavcodec/sparc/vis.h index dfdf2f619..d4a8ce092 100644 --- a/src/libffmpeg/libavcodec/sparc/vis.h +++ b/src/libffmpeg/libavcodec/sparc/vis.h @@ -2,21 +2,20 @@ * vis.h * Copyright (C) 2003 David S. Miller * - * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. - * See http://libmpeg2.sourceforge.net/ for updates. + * This file is part of FFmpeg. * - * mpeg2dec 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. + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * - * mpeg2dec is distributed in the hope that it will be useful, + * FFmpeg 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. + * 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 General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/svq1.c b/src/libffmpeg/libavcodec/svq1.c index 98a7a3cd8..5e8616269 100644 --- a/src/libffmpeg/libavcodec/svq1.c +++ b/src/libffmpeg/libavcodec/svq1.c @@ -3,18 +3,20 @@ * Copyright (C) 2002 the xine project * Copyright (C) 2002 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * (SVQ1 Decoder) @@ -617,6 +619,7 @@ static uint16_t svq1_component_checksum (uint16_t *pixels, int pitch, } #endif +#ifdef CONFIG_DECODERS static void svq1_parse_string (GetBitContext *bitbuf, uint8_t *out) { uint8_t seed; int i; @@ -655,9 +658,9 @@ static int svq1_decode_frame_header (GetBitContext *bitbuf,MpegEncContext *s) { } if ((s->f_code ^ 0x10) >= 0x50) { - char msg[256]; + uint8_t msg[256]; - svq1_parse_string (bitbuf, (char *) msg); + svq1_parse_string (bitbuf, msg); av_log(s->avctx, AV_LOG_INFO, "embedded message: \"%s\"\n", (char *) msg); } @@ -879,7 +882,9 @@ static int svq1_decode_end(AVCodecContext *avctx) MPV_common_end(s); return 0; } +#endif /* CONFIG_DECODERS */ +#ifdef CONFIG_ENCODERS static void svq1_write_header(SVQ1Context *s, int frame_type) { int i; @@ -900,7 +905,7 @@ static void svq1_write_header(SVQ1Context *s, int frame_type) /* no embedded string either */ /* output 5 unknown bits (2 + 2 + 1) */ - put_bits(&s->pb, 5, 0); + put_bits(&s->pb, 5, 2); /* 2 needed by quicktime decoder */ for (i = 0; i < 7; i++) { @@ -1081,7 +1086,6 @@ static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *dec return best_score; } -#ifdef CONFIG_ENCODERS static int svq1_encode_plane(SVQ1Context *s, int plane, unsigned char *src_plane, unsigned char *ref_plane, unsigned char *decoded_plane, int width, int height, int src_stride, int stride) @@ -1351,7 +1355,7 @@ static int svq1_encode_frame(AVCodecContext *avctx, unsigned char *buf, init_put_bits(&s->pb, buf, buf_size); *p = *pict; - p->pict_type = avctx->frame_number % avctx->gop_size ? P_TYPE : I_TYPE; + p->pict_type = avctx->gop_size && avctx->frame_number % avctx->gop_size ? P_TYPE : I_TYPE; p->key_frame = p->pict_type == I_TYPE; svq1_write_header(s, p->pict_type); @@ -1395,6 +1399,7 @@ static int svq1_encode_end(AVCodecContext *avctx) #endif //CONFIG_ENCODERS +#ifdef CONFIG_DECODERS AVCodec svq1_decoder = { "svq1", CODEC_TYPE_VIDEO, @@ -1408,6 +1413,7 @@ AVCodec svq1_decoder = { .flush= ff_mpeg_flush, .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV410P, -1}, }; +#endif #ifdef CONFIG_ENCODERS diff --git a/src/libffmpeg/libavcodec/svq1_cb.h b/src/libffmpeg/libavcodec/svq1_cb.h index ef097457e..a0748bd44 100644 --- a/src/libffmpeg/libavcodec/svq1_cb.h +++ b/src/libffmpeg/libavcodec/svq1_cb.h @@ -3,18 +3,20 @@ * Copyright (C) 2002 the xine project * Copyright (C) 2002 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Ported to mplayer by Arpi diff --git a/src/libffmpeg/libavcodec/svq1_vlc.h b/src/libffmpeg/libavcodec/svq1_vlc.h index 4d405334d..56463700f 100644 --- a/src/libffmpeg/libavcodec/svq1_vlc.h +++ b/src/libffmpeg/libavcodec/svq1_vlc.h @@ -1,3 +1,23 @@ +/* + * copyright (C) 2003 the ffmpeg project + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #ifndef SVQ1_VLC_H #define SVQ1_VLC_H diff --git a/src/libffmpeg/libavcodec/svq3.c b/src/libffmpeg/libavcodec/svq3.c index cfe7f7d22..edf3b6714 100644 --- a/src/libffmpeg/libavcodec/svq3.c +++ b/src/libffmpeg/libavcodec/svq3.c @@ -1,18 +1,20 @@ /* * Copyright (c) 2003 The FFmpeg Project. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @@ -145,7 +147,7 @@ static void svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp){ static void svq3_add_idct_c (uint8_t *dst, DCTELEM *block, int stride, int qp, int dc){ const int qmul= svq3_dequant_coeff[qp]; int i; - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; if (dc) { dc = 13*13*((dc == 1) ? 1538*block[0] : ((qmul*(block[0] >> 3)) / 2)); diff --git a/src/libffmpeg/libavcodec/swscale.h b/src/libffmpeg/libavcodec/swscale.h index 5d13f90da..06088b8e4 100644 --- a/src/libffmpeg/libavcodec/swscale.h +++ b/src/libffmpeg/libavcodec/swscale.h @@ -1,6 +1,46 @@ -#ifndef SWSCALE_EMU_H -#define SWSCALE_EMU_H -/* Dummy, only useful for compilation! */ +/* + * Copyright (C) 2001-2003 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SWSCALE_H +#define SWSCALE_H + +/** + * @file swscale.h + * @brief + * external api for the swscale stuff + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#define AV_STRINGIFY(s) AV_TOSTRING(s) +#define AV_TOSTRING(s) #s + +#define LIBSWSCALE_VERSION_INT ((0<<16)+(5<<8)+0) +#define LIBSWSCALE_VERSION 0.5.0 +#define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT + +#define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION) + +/* values for the flags, the stuff on the command line is different */ #define SWS_FAST_BILINEAR 1 #define SWS_BILINEAR 2 #define SWS_BICUBIC 4 @@ -13,20 +53,94 @@ #define SWS_LANCZOS 0x200 #define SWS_SPLINE 0x400 -#define SwsFilter void -struct SwsContext { - struct ImgReSampleContext *resampling_ctx; - enum PixelFormat src_pix_fmt, dst_pix_fmt; -}; +#define SWS_SRC_V_CHR_DROP_MASK 0x30000 +#define SWS_SRC_V_CHR_DROP_SHIFT 16 + +#define SWS_PARAM_DEFAULT 123456 + +#define SWS_PRINT_INFO 0x1000 + +//the following 3 flags are not completly implemented +//internal chrominace subsamling info +#define SWS_FULL_CHR_H_INT 0x2000 +//input subsampling info +#define SWS_FULL_CHR_H_INP 0x4000 +#define SWS_DIRECT_BGR 0x8000 +#define SWS_ACCURATE_RND 0x40000 + +#define SWS_CPU_CAPS_MMX 0x80000000 +#define SWS_CPU_CAPS_MMX2 0x20000000 +#define SWS_CPU_CAPS_3DNOW 0x40000000 +#define SWS_CPU_CAPS_ALTIVEC 0x10000000 + +#define SWS_MAX_REDUCE_CUTOFF 0.002 -struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, - int dstW, int dstH, int dstFormat, - int flags, SwsFilter *srcFilter, - SwsFilter *dstFilter, double *param); +#define SWS_CS_ITU709 1 +#define SWS_CS_FCC 4 +#define SWS_CS_ITU601 5 +#define SWS_CS_ITU624 5 +#define SWS_CS_SMPTE170M 5 +#define SWS_CS_SMPTE240M 7 +#define SWS_CS_DEFAULT 5 -int sws_scale(struct SwsContext *ctx, uint8_t* src[], int srcStride[], - int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]); + + +// when used for filters they must have an odd number of elements +// coeffs cannot be shared between vectors +typedef struct { + double *coeff; + int length; +} SwsVector; + +// vectors can be shared +typedef struct { + SwsVector *lumH; + SwsVector *lumV; + SwsVector *chrH; + SwsVector *chrV; +} SwsFilter; + +struct SwsContext; void sws_freeContext(struct SwsContext *swsContext); -#endif /* SWSCALE_EMU_H */ +struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags, + SwsFilter *srcFilter, SwsFilter *dstFilter, double *param); +int sws_scale(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY, + int srcSliceH, uint8_t* dst[], int dstStride[]); +int sws_scale_ordered(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY, + int srcSliceH, uint8_t* dst[], int dstStride[]); + + +int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation); +int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation); +SwsVector *sws_getGaussianVec(double variance, double quality); +SwsVector *sws_getConstVec(double c, int length); +SwsVector *sws_getIdentityVec(void); +void sws_scaleVec(SwsVector *a, double scalar); +void sws_normalizeVec(SwsVector *a, double height); +void sws_convVec(SwsVector *a, SwsVector *b); +void sws_addVec(SwsVector *a, SwsVector *b); +void sws_subVec(SwsVector *a, SwsVector *b); +void sws_shiftVec(SwsVector *a, int shift); +SwsVector *sws_cloneVec(SwsVector *a); + +void sws_printVec(SwsVector *a); +void sws_freeVec(SwsVector *a); + +SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, + float lumaSarpen, float chromaSharpen, + float chromaHShift, float chromaVShift, + int verbose); +void sws_freeFilter(SwsFilter *filter); + +struct SwsContext *sws_getCachedContext(struct SwsContext *context, + int srcW, int srcH, int srcFormat, + int dstW, int dstH, int dstFormat, int flags, + SwsFilter *srcFilter, SwsFilter *dstFilter, double *param); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/libffmpeg/libavcodec/truemotion1.c b/src/libffmpeg/libavcodec/truemotion1.c index d2c9efbf8..11d9320c0 100644 --- a/src/libffmpeg/libavcodec/truemotion1.c +++ b/src/libffmpeg/libavcodec/truemotion1.c @@ -2,18 +2,20 @@ * Duck TrueMotion 1.0 Decoder * Copyright (C) 2003 Alex Beregszaszi & Mike Melanson * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/truemotion1data.h b/src/libffmpeg/libavcodec/truemotion1data.h index 800bb306b..63d307c65 100644 --- a/src/libffmpeg/libavcodec/truemotion1data.h +++ b/src/libffmpeg/libavcodec/truemotion1data.h @@ -5,6 +5,22 @@ * distributed under the GNU GPL. It is redistributed with ffmpeg under the * GNU LGPL using the common understanding that data tables necessary for * decoding algorithms are not necessarily licensable. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef TRUEMOTION1DATA_H #define TRUEMOTION1DATA_H diff --git a/src/libffmpeg/libavcodec/truemotion2.c b/src/libffmpeg/libavcodec/truemotion2.c index 84b940d42..1b67bd22a 100644 --- a/src/libffmpeg/libavcodec/truemotion2.c +++ b/src/libffmpeg/libavcodec/truemotion2.c @@ -2,18 +2,20 @@ * Duck/ON2 TrueMotion 2 Decoder * Copyright (c) 2005 Konstantin Shishkov * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -822,7 +824,7 @@ static int decode_init(AVCodecContext *avctx){ TM2Context * const l = avctx->priv_data; int i; - if (avcodec_check_dimensions(avctx, avctx->height, avctx->width) < 0) { + if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) { return -1; } if((avctx->width & 3) || (avctx->height & 3)){ diff --git a/src/libffmpeg/libavcodec/truespeech.c b/src/libffmpeg/libavcodec/truespeech.c index dbd29b38f..077e9b037 100644 --- a/src/libffmpeg/libavcodec/truespeech.c +++ b/src/libffmpeg/libavcodec/truespeech.c @@ -2,18 +2,20 @@ * DSP Group TrueSpeech compatible decoder * Copyright (c) 2005 Konstantin Shishkov * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avcodec.h" diff --git a/src/libffmpeg/libavcodec/truespeech_data.h b/src/libffmpeg/libavcodec/truespeech_data.h index 9a9007234..cd8822fde 100644 --- a/src/libffmpeg/libavcodec/truespeech_data.h +++ b/src/libffmpeg/libavcodec/truespeech_data.h @@ -1,3 +1,24 @@ +/* + * DSP Group TrueSpeech compatible decoder + * copyright (c) 2005 Konstantin Shishkov + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #ifndef __TRUESPEECH_DATA__ #define __TRUESPEECH_DATA__ diff --git a/src/libffmpeg/libavcodec/tscc.c b/src/libffmpeg/libavcodec/tscc.c index 19edf3b2e..a24540f37 100644 --- a/src/libffmpeg/libavcodec/tscc.c +++ b/src/libffmpeg/libavcodec/tscc.c @@ -2,18 +2,20 @@ * TechSmith Camtasia decoder * Copyright (c) 2004 Konstantin Shishkov * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -264,7 +266,7 @@ static int decode_init(AVCodecContext *avctx) c->pic.data[0] = NULL; c->height = avctx->height; - if (avcodec_check_dimensions(avctx, avctx->height, avctx->width) < 0) { + if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) { return 1; } diff --git a/src/libffmpeg/libavcodec/tta.c b/src/libffmpeg/libavcodec/tta.c index 979a94a74..82713fb0f 100644 --- a/src/libffmpeg/libavcodec/tta.c +++ b/src/libffmpeg/libavcodec/tta.c @@ -2,18 +2,20 @@ * TTA (The Lossless True Audio) decoder * Copyright (c) 2006 Alex Beregszaszi * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -195,17 +197,6 @@ static int tta_get_unary(GetBitContext *gb) return ret; } -// shamelessly copied from shorten.c -static int inline get_le16(GetBitContext *gb) -{ - return bswap_16(get_bits_long(gb, 16)); -} - -static int inline get_le32(GetBitContext *gb) -{ - return bswap_32(get_bits_long(gb, 32)); -} - static int tta_decode_init(AVCodecContext * avctx) { TTAContext *s = avctx->priv_data; @@ -218,7 +209,7 @@ static int tta_decode_init(AVCodecContext * avctx) return -1; init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size); - if (show_bits_long(&s->gb, 32) == bswap_32(ff_get_fourcc("TTA1"))) + if (show_bits_long(&s->gb, 32) == ff_get_fourcc("TTA1")) { /* signature */ skip_bits(&s->gb, 32); @@ -227,22 +218,22 @@ static int tta_decode_init(AVCodecContext * avctx) // return -1; // } - s->flags = get_le16(&s->gb); + s->flags = get_bits(&s->gb, 16); if (s->flags != 1 && s->flags != 3) { av_log(s->avctx, AV_LOG_ERROR, "Invalid flags\n"); return -1; } s->is_float = (s->flags == FORMAT_FLOAT); - avctx->channels = s->channels = get_le16(&s->gb); - avctx->bits_per_sample = get_le16(&s->gb); + avctx->channels = s->channels = get_bits(&s->gb, 16); + avctx->bits_per_sample = get_bits(&s->gb, 16); s->bps = (avctx->bits_per_sample + 7) / 8; - avctx->sample_rate = get_le32(&s->gb); + avctx->sample_rate = get_bits_long(&s->gb, 32); if(avctx->sample_rate > 1000000){ //prevent FRAME_TIME * avctx->sample_rate from overflowing and sanity check av_log(avctx, AV_LOG_ERROR, "sample_rate too large\n"); return -1; } - s->data_length = get_le32(&s->gb); + s->data_length = get_bits_long(&s->gb, 32); skip_bits(&s->gb, 32); // CRC32 of header if (s->is_float) @@ -361,9 +352,9 @@ static int tta_decode_frame(AVCodecContext *avctx, rice->k0++; } - // extract sign -#define SIGN(x) (((x)&1) ? (++(x)>>1) : (-(x)>>1)) - *p = SIGN(value); + // extract coded value +#define UNFOLD(x) (((x)&1) ? (++(x)>>1) : (-(x)>>1)) + *p = UNFOLD(value); // run hybrid filter ttafilter_process(filter, p, 0); diff --git a/src/libffmpeg/libavcodec/ulti.c b/src/libffmpeg/libavcodec/ulti.c index 484eef7c7..b4028f439 100755 --- a/src/libffmpeg/libavcodec/ulti.c +++ b/src/libffmpeg/libavcodec/ulti.c @@ -2,18 +2,20 @@ * IBM Ultimotion Video Decoder * Copyright (C) 2004 Konstantin Shishkov * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/ulti_cb.h b/src/libffmpeg/libavcodec/ulti_cb.h index 835910f6d..2d8c9082c 100755 --- a/src/libffmpeg/libavcodec/ulti_cb.h +++ b/src/libffmpeg/libavcodec/ulti_cb.h @@ -1,3 +1,24 @@ +/* + * IBM Ultimotion Video Decoder + * copyright (C) 2004 Konstantin Shishkov + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + static const unsigned char ulti_codebook[16384]={ 0x00, 0x01, 0x01, 0x02, 0x00, 0x01, 0x02, 0x03, diff --git a/src/libffmpeg/libavcodec/utils.c b/src/libffmpeg/libavcodec/utils.c index 0f8a4f412..c3661dda7 100644 --- a/src/libffmpeg/libavcodec/utils.c +++ b/src/libffmpeg/libavcodec/utils.c @@ -3,18 +3,20 @@ * Copyright (c) 2001 Fabrice Bellard. * Copyright (c) 2002-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -57,31 +59,6 @@ const uint8_t ff_reverse[256]={ static int volatile entangled_thread_counter=0; -void avcodec_default_free_buffers(AVCodecContext *s); - -void *av_mallocz(unsigned int size) -{ - void *ptr; - - ptr = av_malloc(size); - if (!ptr) - return NULL; - memset(ptr, 0, size); - return ptr; -} - -char *av_strdup(const char *s) -{ - char *ptr; - int len; - len = strlen(s) + 1; - ptr = av_malloc(len); - if (!ptr) - return NULL; - memcpy(ptr, s, len); - return ptr; -} - /** * realloc which does nothing if the block is large enough */ @@ -95,7 +72,6 @@ void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size) return av_realloc(ptr, *size); } - static unsigned int last_static = 0; static unsigned int allocated_static = 0; static void** array_static = NULL; @@ -159,16 +135,6 @@ static void do_free(void) av_free_static(); } -/** - * Frees memory and sets the pointer to NULL. - * @param arg pointer to the pointer which should be freed - */ -void av_freep(void *arg) -{ - void **ptr= (void**)arg; - av_free(*ptr); - *ptr = NULL; -} /* encoder management */ AVCodec *first_avcodec = NULL; @@ -211,6 +177,8 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){ case PIX_FMT_YUV422P: case PIX_FMT_YUV444P: case PIX_FMT_GRAY8: + case PIX_FMT_GRAY16BE: + case PIX_FMT_GRAY16LE: case PIX_FMT_YUVJ420P: case PIX_FMT_YUVJ422P: case PIX_FMT_YUVJ444P: @@ -440,7 +408,7 @@ static const char* context_to_name(void* ptr) { return "NULL"; } -#define OFFSET(x) (int)&((AVCodecContext*)0)->x +#define OFFSET(x) offsetof(AVCodecContext,x) #define DEFAULT 0 //should be NAN but it doesnt work as its not a constant in glibc as required by ANSI/ISO C //these names are too long to be readable #define V AV_OPT_FLAG_VIDEO_PARAM @@ -449,9 +417,11 @@ static const char* context_to_name(void* ptr) { #define E AV_OPT_FLAG_ENCODING_PARAM #define D AV_OPT_FLAG_DECODING_PARAM +#define AV_CODEC_DEFAULT_BITRATE 200*1000 + static const AVOption options[]={ -{"bit_rate", NULL, OFFSET(bit_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|A|E}, -{"bit_rate_tolerance", NULL, OFFSET(bit_rate_tolerance), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"b", "set video bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, AV_CODEC_DEFAULT_BITRATE, INT_MIN, INT_MAX, V|A|E}, +{"bt", "set video bitrate tolerance (in bits/s)", OFFSET(bit_rate_tolerance), FF_OPT_TYPE_INT, AV_CODEC_DEFAULT_BITRATE*20, INT_MIN, INT_MAX, V|E}, {"flags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, V|A|E|D, "flags"}, {"mv4", "use four motion vector by macroblock (mpeg4)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_4MV, INT_MIN, INT_MAX, V|E, "flags"}, {"obmc", "use overlapped block motion compensation (h263+)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_OBMC, INT_MIN, INT_MAX, V|E, "flags"}, @@ -471,7 +441,7 @@ static const AVOption options[]={ {"truncated", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG_TRUNCATED, INT_MIN, INT_MAX, 0, "flags"}, {"naq", "normalize adaptive quantization", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_NORMALIZE_AQP, INT_MIN, INT_MAX, V|E, "flags"}, {"ildct", "use interlaced dct", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_INTERLACED_DCT, INT_MIN, INT_MAX, V|E, "flags"}, -{"low_delay", "force low delay", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_LOW_DELAY, INT_MIN, INT_MAX, V|D, "flags"}, +{"low_delay", "force low delay", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_LOW_DELAY, INT_MIN, INT_MAX, V|D|E, "flags"}, {"alt", "enable alternate scantable (mpeg2/mpeg4)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_ALT_SCAN, INT_MIN, INT_MAX, V|E, "flags"}, {"trell", "use trellis quantization", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_TRELLIS_QUANT, INT_MIN, INT_MAX, V|E, "flags"}, {"global_header", "place global headers in extradata instead of every keyframe", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_GLOBAL_HEADER, INT_MIN, INT_MAX, 0, "flags"}, @@ -490,27 +460,27 @@ static const AVOption options[]={ {"noout", "skip bitstream encoding", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_NO_OUTPUT, INT_MIN, INT_MAX, V|E, "flags2"}, {"local_header", "place global headers at every keyframe instead of in extradata", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_LOCAL_HEADER, INT_MIN, INT_MAX, V|E, "flags2"}, {"sub_id", NULL, OFFSET(sub_id), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -{"me_method", NULL, OFFSET(me_method), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "me_method"}, +{"me_method", "set motion estimation method", OFFSET(me_method), FF_OPT_TYPE_INT, ME_EPZS, INT_MIN, INT_MAX, V|E, "me_method"}, {"extradata_size", NULL, OFFSET(extradata_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"time_base", NULL, OFFSET(time_base), FF_OPT_TYPE_RATIONAL, DEFAULT, INT_MIN, INT_MAX}, -{"gop_size", NULL, OFFSET(gop_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"g", "set the group of picture size", OFFSET(gop_size), FF_OPT_TYPE_INT, 12, INT_MIN, INT_MAX, V|E}, {"rate_emu", NULL, OFFSET(rate_emu), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -{"sample_rate", NULL, OFFSET(sample_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -{"channels", NULL, OFFSET(channels), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, +{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, +{"ac", "set number of audio channels", OFFSET(channels), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"cutoff", "set cutoff bandwidth", OFFSET(cutoff), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|E}, {"frame_size", NULL, OFFSET(frame_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|E}, {"frame_number", NULL, OFFSET(frame_number), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"real_pict_num", NULL, OFFSET(real_pict_num), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"delay", NULL, OFFSET(delay), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -{"qcompress", NULL, OFFSET(qcompress), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, -{"qblur", NULL, OFFSET(qblur), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, -{"qmin", NULL, OFFSET(qmin), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"qmax", NULL, OFFSET(qmax), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"max_qdiff", NULL, OFFSET(max_qdiff), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"max_b_frames", NULL, OFFSET(max_b_frames), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"b_quant_factor", NULL, OFFSET(b_quant_factor), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, -{"rc_strategy", NULL, OFFSET(rc_strategy), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"b_strategy", NULL, OFFSET(b_frame_strategy), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E}, +{"qcomp", "video quantizer scale compression (VBR)", OFFSET(qcompress), FF_OPT_TYPE_FLOAT, 0.5, FLT_MIN, FLT_MAX, V|E}, +{"qblur", "video quantizer scale blur (VBR)", OFFSET(qblur), FF_OPT_TYPE_FLOAT, 0.5, FLT_MIN, FLT_MAX, V|E}, +{"qmin", "min video quantizer scale (VBR)", OFFSET(qmin), FF_OPT_TYPE_INT, 2, 1, 51, V|E}, +{"qmax", "max video quantizer scale (VBR)", OFFSET(qmax), FF_OPT_TYPE_INT, 31, 1, 51, V|E}, +{"qdiff", "max difference between the quantizer scale (VBR)", OFFSET(max_qdiff), FF_OPT_TYPE_INT, 3, INT_MIN, INT_MAX, V|E}, +{"bf", "use 'frames' B frames", OFFSET(max_b_frames), FF_OPT_TYPE_INT, DEFAULT, 0, FF_MAX_B_FRAMES, V|E}, +{"b_qfactor", "qp factor between p and b frames", OFFSET(b_quant_factor), FF_OPT_TYPE_FLOAT, 1.25, FLT_MIN, FLT_MAX, V|E}, +{"rc_strategy", "ratecontrol method", OFFSET(rc_strategy), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E}, {"hurry_up", NULL, OFFSET(hurry_up), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D}, {"rtp_mode", NULL, OFFSET(rtp_mode), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"rtp_payload_size", NULL, OFFSET(rtp_payload_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, @@ -524,32 +494,32 @@ static const AVOption options[]={ {"misc_bits", NULL, OFFSET(misc_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"frame_bits", NULL, OFFSET(frame_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"codec_tag", NULL, OFFSET(codec_tag), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -{"bugs", NULL, OFFSET(workaround_bugs), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D, "bug"}, +{"bug", "workaround not auto detected encoder bugs", OFFSET(workaround_bugs), FF_OPT_TYPE_FLAGS, FF_BUG_AUTODETECT, INT_MIN, INT_MAX, V|D, "bug"}, {"autodetect", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_AUTODETECT, INT_MIN, INT_MAX, V|D, "bug"}, -{"old_msmpeg4", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_OLD_MSMPEG4, INT_MIN, INT_MAX, V|D, "bug"}, -{"xvid_ilace", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_XVID_ILACE, INT_MIN, INT_MAX, V|D, "bug"}, -{"ump4", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_UMP4, INT_MIN, INT_MAX, V|D, "bug"}, -{"no_padding", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_NO_PADDING, INT_MIN, INT_MAX, V|D, "bug"}, +{"old_msmpeg4", "some old lavc generated msmpeg4v3 files (no autodetection)", 0, FF_OPT_TYPE_CONST, FF_BUG_OLD_MSMPEG4, INT_MIN, INT_MAX, V|D, "bug"}, +{"xvid_ilace", "Xvid interlacing bug (autodetected if fourcc==XVIX)", 0, FF_OPT_TYPE_CONST, FF_BUG_XVID_ILACE, INT_MIN, INT_MAX, V|D, "bug"}, +{"ump4", "(autodetected if fourcc==UMP4)", 0, FF_OPT_TYPE_CONST, FF_BUG_UMP4, INT_MIN, INT_MAX, V|D, "bug"}, +{"no_padding", "padding bug (autodetected)", 0, FF_OPT_TYPE_CONST, FF_BUG_NO_PADDING, INT_MIN, INT_MAX, V|D, "bug"}, {"amv", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_AMV, INT_MIN, INT_MAX, V|D, "bug"}, -{"ac_vlc", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_AC_VLC, INT_MIN, INT_MAX, V|D, "bug"}, +{"ac_vlc", "illegal vlc bug (autodetected per fourcc)", 0, FF_OPT_TYPE_CONST, FF_BUG_AC_VLC, INT_MIN, INT_MAX, V|D, "bug"}, {"qpel_chroma", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_QPEL_CHROMA, INT_MIN, INT_MAX, V|D, "bug"}, -{"std_qpel", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_STD_QPEL, INT_MIN, INT_MAX, V|D, "bug"}, +{"std_qpel", "old standard qpel (autodetected per fourcc/version)", 0, FF_OPT_TYPE_CONST, FF_BUG_STD_QPEL, INT_MIN, INT_MAX, V|D, "bug"}, {"qpel_chroma2", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_QPEL_CHROMA2, INT_MIN, INT_MAX, V|D, "bug"}, -{"direct_blocksize", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_DIRECT_BLOCKSIZE, INT_MIN, INT_MAX, V|D, "bug"}, -{"edge", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_EDGE, INT_MIN, INT_MAX, V|D, "bug"}, +{"direct_blocksize", "direct-qpel-blocksize bug (autodetected per fourcc/version)", 0, FF_OPT_TYPE_CONST, FF_BUG_DIRECT_BLOCKSIZE, INT_MIN, INT_MAX, V|D, "bug"}, +{"edge", "edge padding bug (autodetected per fourcc/version)", 0, FF_OPT_TYPE_CONST, FF_BUG_EDGE, INT_MIN, INT_MAX, V|D, "bug"}, {"hpel_chroma", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_HPEL_CHROMA, INT_MIN, INT_MAX, V|D, "bug"}, {"dc_clip", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_DC_CLIP, INT_MIN, INT_MAX, V|D, "bug"}, {"ms", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_MS, INT_MIN, INT_MAX, V|D, "bug"}, {"lelim", "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)", OFFSET(luma_elim_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"celim", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)", OFFSET(chroma_elim_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"strict", NULL, OFFSET(strict_std_compliance), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "strict"}, +{"strict", "how strictly to follow the standards", OFFSET(strict_std_compliance), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "strict"}, {"very", NULL, 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_VERY_STRICT, INT_MIN, INT_MAX, V|E, "strict"}, {"strict", NULL, 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_STRICT, INT_MIN, INT_MAX, V|E, "strict"}, {"normal", NULL, 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_NORMAL, INT_MIN, INT_MAX, V|E, "strict"}, {"inofficial", NULL, 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_INOFFICIAL, INT_MIN, INT_MAX, V|E, "strict"}, {"experimental", NULL, 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_EXPERIMENTAL, INT_MIN, INT_MAX, V|E, "strict"}, -{"b_quant_offset", NULL, OFFSET(b_quant_offset), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, -{"er", NULL, OFFSET(error_resilience), FF_OPT_TYPE_INT, FF_ER_CAREFUL, INT_MIN, INT_MAX, V|D, "er"}, +{"b_qoffset", "qp offset between p and b frames", OFFSET(b_quant_offset), FF_OPT_TYPE_FLOAT, 1.25, FLT_MIN, FLT_MAX, V|E}, +{"er", "set error resilience strategy", OFFSET(error_resilience), FF_OPT_TYPE_INT, FF_ER_CAREFUL, INT_MIN, INT_MAX, V|D, "er"}, {"careful", NULL, 0, FF_OPT_TYPE_CONST, FF_ER_CAREFUL, INT_MIN, INT_MAX, V|D, "er"}, {"compliant", NULL, 0, FF_OPT_TYPE_CONST, FF_ER_COMPLIANT, INT_MIN, INT_MAX, V|D, "er"}, {"aggressive", NULL, 0, FF_OPT_TYPE_CONST, FF_ER_AGGRESSIVE, INT_MIN, INT_MAX, V|D, "er"}, @@ -557,36 +527,36 @@ static const AVOption options[]={ {"has_b_frames", NULL, OFFSET(has_b_frames), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"block_align", NULL, OFFSET(block_align), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"parse_only", NULL, OFFSET(parse_only), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -{"mpeg_quant", NULL, OFFSET(mpeg_quant), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"mpeg_quant", "use MPEG quantizers instead of H.263", OFFSET(mpeg_quant), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"stats_out", NULL, OFFSET(stats_out), FF_OPT_TYPE_STRING, DEFAULT, CHAR_MIN, CHAR_MAX}, {"stats_in", NULL, OFFSET(stats_in), FF_OPT_TYPE_STRING, DEFAULT, CHAR_MIN, CHAR_MAX}, -{"rc_qsquish", NULL, OFFSET(rc_qsquish), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, -{"rc_qmod_amp", NULL, OFFSET(rc_qmod_amp), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, -{"rc_qmod_freq", NULL, OFFSET(rc_qmod_freq), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"qsquish", "how to keep quantizer between qmin and qmax (0 = clip, 1 = use differentiable function)", OFFSET(rc_qsquish), FF_OPT_TYPE_FLOAT, DEFAULT, 0, 99, V|E}, +{"rc_qmod_amp", "experimental quantizer modulation", OFFSET(rc_qmod_amp), FF_OPT_TYPE_FLOAT, DEFAULT, -FLT_MAX, FLT_MAX, V|E}, +{"rc_qmod_freq", "experimental quantizer modulation", OFFSET(rc_qmod_freq), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"rc_override_count", NULL, OFFSET(rc_override_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -{"rc_eq", NULL, OFFSET(rc_eq), FF_OPT_TYPE_STRING, DEFAULT, CHAR_MIN, CHAR_MAX, V|E}, -{"rc_max_rate", NULL, OFFSET(rc_max_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"rc_min_rate", NULL, OFFSET(rc_min_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"rc_buffer_size", NULL, OFFSET(rc_buffer_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"rc_buf_aggressivity", NULL, OFFSET(rc_buffer_aggressivity), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, -{"i_quant_factor", NULL, OFFSET(i_quant_factor), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, -{"i_quant_offset", NULL, OFFSET(i_quant_offset), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, -{"rc_initial_cplx", NULL, OFFSET(rc_initial_cplx), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, -{"dct", NULL, OFFSET(dct_algo), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|E, "dct"}, -{"auto", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_AUTO, INT_MIN, INT_MAX, V|E, "dct"}, -{"fastint", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_FASTINT, INT_MIN, INT_MAX, V|E, "dct"}, -{"int", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_INT, INT_MIN, INT_MAX, V|E, "dct"}, +{"rc_eq", "set rate control equation", OFFSET(rc_eq), FF_OPT_TYPE_STRING, DEFAULT, CHAR_MIN, CHAR_MAX, V|E}, +{"maxrate", "set max video bitrate tolerance (in bits/s)", OFFSET(rc_max_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"minrate", "set min video bitrate tolerance (in bits/s)", OFFSET(rc_min_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"bufsize", "set ratecontrol buffer size (in bits)", OFFSET(rc_buffer_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"rc_buf_aggressivity", "currently useless", OFFSET(rc_buffer_aggressivity), FF_OPT_TYPE_FLOAT, 1.0, FLT_MIN, FLT_MAX, V|E}, +{"i_qfactor", "qp factor between p and i frames", OFFSET(i_quant_factor), FF_OPT_TYPE_FLOAT, -0.8, -FLT_MAX, FLT_MAX, V|E}, +{"i_qoffset", "qp offset between p and i frames", OFFSET(i_quant_offset), FF_OPT_TYPE_FLOAT, 0.0, -FLT_MAX, FLT_MAX, V|E}, +{"rc_init_cplx", "initial complexity for 1-pass encoding", OFFSET(rc_initial_cplx), FF_OPT_TYPE_FLOAT, DEFAULT, -FLT_MAX, FLT_MAX, V|E}, +{"dct", "DCT algorithm", OFFSET(dct_algo), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|E, "dct"}, +{"auto", "autoselect a good one (default)", 0, FF_OPT_TYPE_CONST, FF_DCT_AUTO, INT_MIN, INT_MAX, V|E, "dct"}, +{"fastint", "fast integer", 0, FF_OPT_TYPE_CONST, FF_DCT_FASTINT, INT_MIN, INT_MAX, V|E, "dct"}, +{"int", "accurate integer", 0, FF_OPT_TYPE_CONST, FF_DCT_INT, INT_MIN, INT_MAX, V|E, "dct"}, {"mmx", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_MMX, INT_MIN, INT_MAX, V|E, "dct"}, {"mlib", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_MLIB, INT_MIN, INT_MAX, V|E, "dct"}, {"altivec", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_ALTIVEC, INT_MIN, INT_MAX, V|E, "dct"}, -{"faan", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_FAAN, INT_MIN, INT_MAX, V|E, "dct"}, -{"lumi_mask", "lumimasking", OFFSET(lumi_masking), FF_OPT_TYPE_FLOAT, 0, FLT_MIN, FLT_MAX, V|E}, -{"tcplx_mask", "temporal complexity masking", OFFSET(temporal_cplx_masking), FF_OPT_TYPE_FLOAT, 0, FLT_MIN, FLT_MAX, V|E}, -{"scplx_mask", "spatial complexity masking", OFFSET(spatial_cplx_masking), FF_OPT_TYPE_FLOAT, 0, FLT_MIN, FLT_MAX, V|E}, -{"p_mask", "inter masking", OFFSET(p_masking), FF_OPT_TYPE_FLOAT, 0, FLT_MIN, FLT_MAX, V|E}, -{"dark_mask", "darkness masking", OFFSET(dark_masking), FF_OPT_TYPE_FLOAT, 0, FLT_MIN, FLT_MAX, V|E}, +{"faan", "floating point AAN", 0, FF_OPT_TYPE_CONST, FF_DCT_FAAN, INT_MIN, INT_MAX, V|E, "dct"}, +{"lumi_mask", "compresses bright areas stronger than medium ones", OFFSET(lumi_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E}, +{"tcplx_mask", "temporal complexity masking", OFFSET(temporal_cplx_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E}, +{"scplx_mask", "spatial complexity masking", OFFSET(spatial_cplx_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E}, +{"p_mask", "inter masking", OFFSET(p_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E}, +{"dark_mask", "compresses dark areas stronger than medium ones", OFFSET(dark_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E}, {"unused", NULL, OFFSET(unused), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -{"idct", NULL, OFFSET(idct_algo), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|E|D, "idct"}, +{"idct", "use interlaced DCT", OFFSET(idct_algo), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|E|D, "idct"}, {"auto", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_AUTO, INT_MIN, INT_MAX, V|E|D, "idct"}, {"int", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_INT, INT_MIN, INT_MAX, V|E|D, "idct"}, {"simple", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SIMPLE, INT_MIN, INT_MAX, V|E|D, "idct"}, @@ -598,14 +568,15 @@ static const AVOption options[]={ {"altivec", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_ALTIVEC, INT_MIN, INT_MAX, V|E|D, "idct"}, {"sh4", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SH4, INT_MIN, INT_MAX, V|E|D, "idct"}, {"simplearm", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SIMPLEARM, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"simplearmv5te", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SIMPLEARMV5TE, INT_MIN, INT_MAX, V|E|D, "idct"}, {"h264", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_H264, INT_MIN, INT_MAX, V|E|D, "idct"}, {"vp3", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_VP3, INT_MIN, INT_MAX, V|E|D, "idct"}, {"ipp", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_IPP, INT_MIN, INT_MAX, V|E|D, "idct"}, {"xvidmmx", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_XVIDMMX, INT_MIN, INT_MAX, V|E|D, "idct"}, {"slice_count", NULL, OFFSET(slice_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -{"ec", NULL, OFFSET(error_concealment), FF_OPT_TYPE_FLAGS, 3, INT_MIN, INT_MAX, V|D, "ec"}, -{"guess_mvs", NULL, 0, FF_OPT_TYPE_CONST, FF_EC_GUESS_MVS, INT_MIN, INT_MAX, V|D, "ec"}, -{"deblock", NULL, 0, FF_OPT_TYPE_CONST, FF_EC_DEBLOCK, INT_MIN, INT_MAX, V|D, "ec"}, +{"ec", "set error concealment strategy", OFFSET(error_concealment), FF_OPT_TYPE_FLAGS, 3, INT_MIN, INT_MAX, V|D, "ec"}, +{"guess_mvs", "iterative motion vector (MV) search (slow)", 0, FF_OPT_TYPE_CONST, FF_EC_GUESS_MVS, INT_MIN, INT_MAX, V|D, "ec"}, +{"deblock", "use strong deblock filter for damaged MBs", 0, FF_OPT_TYPE_CONST, FF_EC_DEBLOCK, INT_MIN, INT_MAX, V|D, "ec"}, {"bits_per_sample", NULL, OFFSET(bits_per_sample), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"pred", "prediction method", OFFSET(prediction_method), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "pred"}, {"left", NULL, 0, FF_OPT_TYPE_CONST, FF_PRED_LEFT, INT_MIN, INT_MAX, V|E, "pred"}, @@ -613,58 +584,58 @@ static const AVOption options[]={ {"median", NULL, 0, FF_OPT_TYPE_CONST, FF_PRED_MEDIAN, INT_MIN, INT_MAX, V|E, "pred"}, {"aspect", NULL, OFFSET(sample_aspect_ratio), FF_OPT_TYPE_RATIONAL, DEFAULT, 0, 10, V|E}, {"debug", "print specific debug info", OFFSET(debug), FF_OPT_TYPE_FLAGS, DEFAULT, 0, INT_MAX, V|A|S|E|D, "debug"}, -{"pict", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_PICT_INFO, INT_MIN, INT_MAX, V|D, "debug"}, -{"rc", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_RC, INT_MIN, INT_MAX, V|E, "debug"}, +{"pict", "picture info", 0, FF_OPT_TYPE_CONST, FF_DEBUG_PICT_INFO, INT_MIN, INT_MAX, V|D, "debug"}, +{"rc", "rate control", 0, FF_OPT_TYPE_CONST, FF_DEBUG_RC, INT_MIN, INT_MAX, V|E, "debug"}, {"bitstream", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_BITSTREAM, INT_MIN, INT_MAX, V|D, "debug"}, -{"mb_type", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_MB_TYPE, INT_MIN, INT_MAX, V|D, "debug"}, -{"qp", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_QP, INT_MIN, INT_MAX, V|D, "debug"}, -{"mv", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_MV, INT_MIN, INT_MAX, V|D, "debug"}, +{"mb_type", "macroblock (MB) type", 0, FF_OPT_TYPE_CONST, FF_DEBUG_MB_TYPE, INT_MIN, INT_MAX, V|D, "debug"}, +{"qp", "per-block quantization parameter (QP)", 0, FF_OPT_TYPE_CONST, FF_DEBUG_QP, INT_MIN, INT_MAX, V|D, "debug"}, +{"mv", "motion vector", 0, FF_OPT_TYPE_CONST, FF_DEBUG_MV, INT_MIN, INT_MAX, V|D, "debug"}, {"dct_coeff", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_DCT_COEFF, INT_MIN, INT_MAX, V|D, "debug"}, {"skip", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_SKIP, INT_MIN, INT_MAX, V|D, "debug"}, {"startcode", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_STARTCODE, INT_MIN, INT_MAX, V|D, "debug"}, {"pts", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_PTS, INT_MIN, INT_MAX, V|D, "debug"}, -{"er", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_ER, INT_MIN, INT_MAX, V|D, "debug"}, -{"mmco", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_MMCO, INT_MIN, INT_MAX, V|D, "debug"}, +{"er", "error resilience", 0, FF_OPT_TYPE_CONST, FF_DEBUG_ER, INT_MIN, INT_MAX, V|D, "debug"}, +{"mmco", "memory management control operations (H.264)", 0, FF_OPT_TYPE_CONST, FF_DEBUG_MMCO, INT_MIN, INT_MAX, V|D, "debug"}, {"bugs", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_BUGS, INT_MIN, INT_MAX, V|D, "debug"}, -{"vis_qp", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_QP, INT_MIN, INT_MAX, V|D, "debug"}, -{"vis_mb_type", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MB_TYPE, INT_MIN, INT_MAX, V|D, "debug"}, -{"vismv", "visualize motion vectors", OFFSET(debug_mv), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|D, "debug_mv"}, -{"pf", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_P_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"}, -{"bf", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"}, -{"bb", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_BACK, INT_MIN, INT_MAX, V|D, "debug_mv"}, -{"mb_qmin", NULL, OFFSET(mb_qmin), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"mb_qmax", NULL, OFFSET(mb_qmax), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"vis_qp", "visualize quantization parameter (QP), lower QP are tinted greener", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_QP, INT_MIN, INT_MAX, V|D, "debug"}, +{"vis_mb_type", "visualize block types", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MB_TYPE, INT_MIN, INT_MAX, V|D, "debug"}, +{"vismv", "visualize motion vectors (MVs)", OFFSET(debug_mv), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|D, "debug_mv"}, +{"pf", "forward predicted MVs of P-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_P_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"}, +{"bf", "forward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"}, +{"bb", "backward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_BACK, INT_MIN, INT_MAX, V|D, "debug_mv"}, +{"mb_qmin", "obsolete, use vqmin", OFFSET(mb_qmin), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"mb_qmax", "obsolete, use vqmax", OFFSET(mb_qmax), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"cmp", "full pel me compare function", OFFSET(me_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"}, {"subcmp", "sub pel me compare function", OFFSET(me_sub_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"}, {"mbcmp", "macroblock compare function", OFFSET(mb_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"ildctcmp", "interlaced dct compare function", OFFSET(ildct_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"dia_size", NULL, OFFSET(dia_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"last_pred", NULL, OFFSET(last_predictor_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"preme", NULL, OFFSET(pre_me), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"ildctcmp", "interlaced dct compare function", OFFSET(ildct_cmp), FF_OPT_TYPE_INT, FF_CMP_VSAD, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"dia_size", "diamond type & size for motion estimation", OFFSET(dia_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"last_pred", "amount of motion predictors from the previous frame", OFFSET(last_predictor_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"preme", "pre motion estimation", OFFSET(pre_me), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"precmp", "pre motion estimation compare function", OFFSET(me_pre_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"sad", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_SAD, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"sse", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_SSE, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"satd", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_SATD, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"dct", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_DCT, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"psnr", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_PSNR, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"bit", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_BIT, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"rd", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_RD, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"zero", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_ZERO, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"vsad", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_VSAD, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"vsse", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_VSSE, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"nsse", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_NSSE, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"sad", "sum of absolute differences, fast (default)", 0, FF_OPT_TYPE_CONST, FF_CMP_SAD, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"sse", "sum of squared errors", 0, FF_OPT_TYPE_CONST, FF_CMP_SSE, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"satd", "sum of absolute Hadamard transformed differences", 0, FF_OPT_TYPE_CONST, FF_CMP_SATD, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"dct", "sum of absolute DCT transformed differences", 0, FF_OPT_TYPE_CONST, FF_CMP_DCT, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"psnr", "sum of squared quantization errors (avoid, low quality)", 0, FF_OPT_TYPE_CONST, FF_CMP_PSNR, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"bit", "number of bits needed for the block", 0, FF_OPT_TYPE_CONST, FF_CMP_BIT, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"rd", "rate distortion optimal, slow", 0, FF_OPT_TYPE_CONST, FF_CMP_RD, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"zero", "0", 0, FF_OPT_TYPE_CONST, FF_CMP_ZERO, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"vsad", "sum of absolute vertical differences", 0, FF_OPT_TYPE_CONST, FF_CMP_VSAD, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"vsse","sum of squared vertical differences", 0, FF_OPT_TYPE_CONST, FF_CMP_VSSE, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"nsse", "noise preserving sum of squared differences", 0, FF_OPT_TYPE_CONST, FF_CMP_NSSE, INT_MIN, INT_MAX, V|E, "cmp_func"}, #ifdef CONFIG_SNOW_ENCODER -{"w53", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_W53, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"w97", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_W97, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"w53", "5/3 wavelet, only used in snow", 0, FF_OPT_TYPE_CONST, FF_CMP_W53, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"w97", "9/7 wavelet, only used in snow", 0, FF_OPT_TYPE_CONST, FF_CMP_W97, INT_MIN, INT_MAX, V|E, "cmp_func"}, #endif {"dctmax", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_DCTMAX, INT_MIN, INT_MAX, V|E, "cmp_func"}, {"chroma", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_CHROMA, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"pre_dia_size", NULL, OFFSET(pre_dia_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"subq", "sub pel motion estimation quality", OFFSET(me_subpel_quality), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"pre_dia_size", "diamond type & size for motion estimation pre-pass", OFFSET(pre_dia_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"subq", "sub pel motion estimation quality", OFFSET(me_subpel_quality), FF_OPT_TYPE_INT, 8, INT_MIN, INT_MAX, V|E}, {"dtg_active_format", NULL, OFFSET(dtg_active_format), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -{"me_range", NULL, OFFSET(me_range), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"ibias", NULL, OFFSET(intra_quant_bias), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"pbias", NULL, OFFSET(inter_quant_bias), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"me_range", "limit motion vectors range (1023 for DivX player)", OFFSET(me_range), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"ibias", "intra quant bias", OFFSET(intra_quant_bias), FF_OPT_TYPE_INT, FF_DEFAULT_QUANT_BIAS, INT_MIN, INT_MAX, V|E}, +{"pbias", "inter quant bias", OFFSET(inter_quant_bias), FF_OPT_TYPE_INT, FF_DEFAULT_QUANT_BIAS, INT_MIN, INT_MAX, V|E}, {"color_table_id", NULL, OFFSET(color_table_id), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"internal_buffer_count", NULL, OFFSET(internal_buffer_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"global_quality", NULL, OFFSET(global_quality), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, @@ -674,29 +645,29 @@ static const AVOption options[]={ {"context", "context model", OFFSET(context_model), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"slice_flags", NULL, OFFSET(slice_flags), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"xvmc_acceleration", NULL, OFFSET(xvmc_acceleration), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -{"mbd", NULL, OFFSET(mb_decision), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "mbd"}, -{"simple", NULL, 0, FF_OPT_TYPE_CONST, FF_MB_DECISION_SIMPLE, INT_MIN, INT_MAX, V|E, "mbd"}, -{"bits", NULL, 0, FF_OPT_TYPE_CONST, FF_MB_DECISION_BITS, INT_MIN, INT_MAX, V|E, "mbd"}, -{"rd", NULL, 0, FF_OPT_TYPE_CONST, FF_MB_DECISION_RD, INT_MIN, INT_MAX, V|E, "mbd"}, +{"mbd", "macroblock decision algorithm (high quality mode)", OFFSET(mb_decision), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "mbd"}, +{"simple", "use mbcmp (default)", 0, FF_OPT_TYPE_CONST, FF_MB_DECISION_SIMPLE, INT_MIN, INT_MAX, V|E, "mbd"}, +{"bits", "use fewest bits", 0, FF_OPT_TYPE_CONST, FF_MB_DECISION_BITS, INT_MIN, INT_MAX, V|E, "mbd"}, +{"rd", "use best rate distortion", 0, FF_OPT_TYPE_CONST, FF_MB_DECISION_RD, INT_MIN, INT_MAX, V|E, "mbd"}, {"stream_codec_tag", NULL, OFFSET(stream_codec_tag), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -{"sc_threshold", NULL, OFFSET(scenechange_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"lmin", "min lagrange factor", OFFSET(lmin), FF_OPT_TYPE_INT, 2*FF_QP2LAMBDA, 0, INT_MAX, V|E}, -{"lmax", "max lagrange factor", OFFSET(lmax), FF_OPT_TYPE_INT, 31*FF_QP2LAMBDA, 0, INT_MAX, V|E}, +{"sc_threshold", "scene change threshold", OFFSET(scenechange_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"lmin", "min lagrange factor (VBR)", OFFSET(lmin), FF_OPT_TYPE_INT, 2*FF_QP2LAMBDA, 0, INT_MAX, V|E}, +{"lmax", "max lagrange factor (VBR)", OFFSET(lmax), FF_OPT_TYPE_INT, 31*FF_QP2LAMBDA, 0, INT_MAX, V|E}, {"nr", "noise reduction", OFFSET(noise_reduction), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"rc_init_occupancy", NULL, OFFSET(rc_initial_buffer_occupancy), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"inter_threshold", NULL, OFFSET(inter_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"flags2", NULL, OFFSET(flags2), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, V|A|E|D, "flags2"}, -{"error_rate", NULL, OFFSET(error_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, +{"flags2", NULL, OFFSET(flags2), FF_OPT_TYPE_FLAGS, CODEC_FLAG2_FASTPSKIP, INT_MIN, INT_MAX, V|A|E|D, "flags2"}, +{"error", NULL, OFFSET(error_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"antialias", NULL, OFFSET(antialias_algo), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D, "aa"}, {"auto", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_AUTO, INT_MIN, INT_MAX, V|D, "aa"}, {"fastint", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_FASTINT, INT_MIN, INT_MAX, V|D, "aa"}, {"int", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_INT, INT_MIN, INT_MAX, V|D, "aa"}, {"float", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_FLOAT, INT_MIN, INT_MAX, V|D, "aa"}, {"qns", "quantizer noise shaping", OFFSET(quantizer_noise_shaping), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"thread_count", NULL, OFFSET(thread_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E|D}, +{"threads", NULL, OFFSET(thread_count), FF_OPT_TYPE_INT, 1, INT_MIN, INT_MAX, V|E|D}, {"me_threshold", "motion estimaton threshold", OFFSET(me_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -{"mb_threshold", NULL, OFFSET(mb_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -{"dc", NULL, OFFSET(intra_dc_precision), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"mb_threshold", "macroblock threshold", OFFSET(mb_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"dc", "intra_dc_precision", OFFSET(intra_dc_precision), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E}, {"nssew", "nsse weight", OFFSET(nsse_weight), FF_OPT_TYPE_INT, 8, INT_MIN, INT_MAX, V|E}, {"skip_top", NULL, OFFSET(skip_top), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D}, {"skip_bottom", NULL, OFFSET(skip_bottom), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D}, @@ -704,33 +675,33 @@ static const AVOption options[]={ {"unknown", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "profile"}, {"level", NULL, OFFSET(level), FF_OPT_TYPE_INT, FF_LEVEL_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "level"}, {"unknown", NULL, 0, FF_OPT_TYPE_CONST, FF_LEVEL_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "level"}, -{"lowres", NULL, OFFSET(lowres), FF_OPT_TYPE_INT, 0, 0, INT_MAX, V|D}, -{"frame_skip_threshold", NULL, OFFSET(frame_skip_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"frame_skip_factor", NULL, OFFSET(frame_skip_factor), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"frame_skip_exp", NULL, OFFSET(frame_skip_exp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), FF_OPT_TYPE_INT, 0, 0, INT_MAX, V|D}, +{"skip_threshold", "frame skip threshold", OFFSET(frame_skip_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"skip_factor", "frame skip factor", OFFSET(frame_skip_factor), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"skip_exp", "frame skip exponent", OFFSET(frame_skip_exp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"skipcmp", "frame skip compare function", OFFSET(frame_skip_cmp), FF_OPT_TYPE_INT, FF_CMP_DCTMAX, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"border_mask", NULL, OFFSET(border_masking), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, -{"mb_lmin", NULL, OFFSET(mb_lmin), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"mb_lmax", NULL, OFFSET(mb_lmax), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"me_penalty_compensation", NULL, OFFSET(me_penalty_compensation), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"bidir_refine", NULL, OFFSET(bidir_refine), FF_OPT_TYPE_INT, DEFAULT, 0, 4, V|E}, -{"brd_scale", NULL, OFFSET(brd_scale), FF_OPT_TYPE_INT, DEFAULT, 0, 10, V|E}, -{"crf", NULL, OFFSET(crf), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"cqp", NULL, OFFSET(cqp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"keyint_min", NULL, OFFSET(keyint_min), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"refs", NULL, OFFSET(refs), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"border_mask", "increases the quantizer for macroblocks close to borders", OFFSET(border_masking), FF_OPT_TYPE_FLOAT, DEFAULT, -FLT_MAX, FLT_MAX, V|E}, +{"mblmin", "min macroblock lagrange factor (VBR)", OFFSET(mb_lmin), FF_OPT_TYPE_INT, FF_QP2LAMBDA * 2, 1, FF_LAMBDA_MAX, V|E}, +{"mblmax", "max macroblock lagrange factor (VBR)", OFFSET(mb_lmax), FF_OPT_TYPE_INT, FF_QP2LAMBDA * 31, 1, FF_LAMBDA_MAX, V|E}, +{"mepc", "motion estimation bitrate penalty compensation (1.0 = 256)", OFFSET(me_penalty_compensation), FF_OPT_TYPE_INT, 256, INT_MIN, INT_MAX, V|E}, +{"bidir_refine", "refine the two motion vectors used in bidirectional macroblocks", OFFSET(bidir_refine), FF_OPT_TYPE_INT, DEFAULT, 0, 4, V|E}, +{"brd_scale", "downscales frames for dynamic B-frame decision", OFFSET(brd_scale), FF_OPT_TYPE_INT, DEFAULT, 0, 10, V|E}, +{"crf", "enables constant quality mode, and selects the quality (x264)", OFFSET(crf), FF_OPT_TYPE_FLOAT, DEFAULT, 0, 51, V|E}, +{"cqp", NULL, OFFSET(cqp), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, V|E}, +{"keyint_min", "minimum interval between IDR-frames (x264)", OFFSET(keyint_min), FF_OPT_TYPE_INT, 25, INT_MIN, INT_MAX, V|E}, +{"refs", "reference frames to consider for motion compensation (Snow)", OFFSET(refs), FF_OPT_TYPE_INT, 1, INT_MIN, INT_MAX, V|E}, {"chromaoffset", NULL, OFFSET(chromaoffset), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"bframebias", NULL, OFFSET(bframebias), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"trellis", NULL, OFFSET(trellis), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|A|E}, -{"directpred", NULL, OFFSET(directpred), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"bpyramid", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_BPYRAMID, INT_MIN, INT_MAX, V|E, "flags2"}, +{"trellis", "rate-distortion optimal quantization", OFFSET(trellis), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|A|E}, +{"directpred", NULL, OFFSET(directpred), FF_OPT_TYPE_INT, 2, INT_MIN, INT_MAX, V|E}, +{"bpyramid", "allows B-frames to be used as references for predicting", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_BPYRAMID, INT_MIN, INT_MAX, V|E, "flags2"}, {"wpred", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_WPRED, INT_MIN, INT_MAX, V|E, "flags2"}, {"mixed_refs", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_MIXED_REFS, INT_MIN, INT_MAX, V|E, "flags2"}, {"8x8dct", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_8X8DCT, INT_MIN, INT_MAX, V|E, "flags2"}, {"fastpskip", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_FASTPSKIP, INT_MIN, INT_MAX, V|E, "flags2"}, {"aud", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_AUD, INT_MIN, INT_MAX, V|E, "flags2"}, {"brdo", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_BRDO, INT_MIN, INT_MAX, V|E, "flags2"}, -{"complexityblur", NULL, OFFSET(complexityblur), FF_OPT_TYPE_FLOAT, DEFAULT, FLT_MIN, FLT_MAX, V|E}, +{"complexityblur", NULL, OFFSET(complexityblur), FF_OPT_TYPE_FLOAT, 20.0, FLT_MIN, FLT_MAX, V|E}, {"deblockalpha", NULL, OFFSET(deblockalpha), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"deblockbeta", NULL, OFFSET(deblockbeta), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"partitions", NULL, OFFSET(partitions), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, V|E, "partitions"}, @@ -751,11 +722,17 @@ static const AVOption options[]={ {"prediction_order_method", NULL, OFFSET(prediction_order_method), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, {"min_partition_order", NULL, OFFSET(min_partition_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, {"max_partition_order", NULL, OFFSET(max_partition_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, +{"timecode_frame_start", NULL, OFFSET(timecode_frame_start), FF_OPT_TYPE_INT, 0, 0, INT_MAX, V|E}, +{"drop_frame_timecode", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_DROP_FRAME_TIMECODE, INT_MIN, INT_MAX, V|E, "flags2"}, {NULL}, }; #undef A #undef V +#undef S +#undef E +#undef D +#undef DEFAULT static AVClass av_codec_context_class = { "AVCodecContext", context_to_name, options }; @@ -763,60 +740,19 @@ void avcodec_get_context_defaults(AVCodecContext *s){ memset(s, 0, sizeof(AVCodecContext)); s->av_class= &av_codec_context_class; - s->bit_rate= 800*1000; - s->bit_rate_tolerance= s->bit_rate*10; - s->qmin= 2; - s->qmax= 31; - s->mb_lmin= FF_QP2LAMBDA * 2; - s->mb_lmax= FF_QP2LAMBDA * 31; + + av_opt_set_defaults(s); + s->rc_eq= "tex^qComp"; - s->cqp = -1; - s->refs = 1; - s->directpred = 2; - s->qcompress= 0.5; - s->complexityblur = 20.0; - s->keyint_min = 25; - s->flags2 = CODEC_FLAG2_FASTPSKIP; - s->max_qdiff= 3; - s->b_quant_factor=1.25; - s->b_quant_offset=1.25; - s->i_quant_factor=-0.8; - s->i_quant_offset=0.0; - s->error_concealment= 3; - s->error_resilience= 1; - s->workaround_bugs= FF_BUG_AUTODETECT; s->time_base= (AVRational){0,1}; - s->gop_size= 50; - s->me_method= ME_EPZS; s->get_buffer= avcodec_default_get_buffer; s->release_buffer= avcodec_default_release_buffer; s->get_format= avcodec_default_get_format; s->execute= avcodec_default_execute; - s->thread_count=1; - s->me_subpel_quality=8; - s->lmin= FF_QP2LAMBDA * s->qmin; - s->lmax= FF_QP2LAMBDA * s->qmax; s->sample_aspect_ratio= (AVRational){0,1}; - s->ildct_cmp= FF_CMP_VSAD; - s->profile= FF_PROFILE_UNKNOWN; - s->level= FF_LEVEL_UNKNOWN; - s->me_penalty_compensation= 256; s->pix_fmt= PIX_FMT_NONE; - s->frame_skip_cmp= FF_CMP_DCTMAX; - s->nsse_weight= 8; s->sample_fmt= SAMPLE_FMT_S16; // FIXME: set to NONE - s->mv0_threshold= 256; - s->b_sensitivity= 40; - s->compression_level = FF_COMPRESSION_DEFAULT; - s->use_lpc = -1; - s->min_prediction_order = -1; - s->max_prediction_order = -1; - s->prediction_order_method = -1; - s->min_partition_order = -1; - s->max_partition_order = -1; - - s->intra_quant_bias= FF_DEFAULT_QUANT_BIAS; - s->inter_quant_bias= FF_DEFAULT_QUANT_BIAS; + s->palctrl = NULL; s->reget_buffer= avcodec_default_reget_buffer; } diff --git a/src/libffmpeg/libavcodec/vc1.c b/src/libffmpeg/libavcodec/vc1.c index 731baa4dc..7b385ca47 100644 --- a/src/libffmpeg/libavcodec/vc1.c +++ b/src/libffmpeg/libavcodec/vc1.c @@ -3,18 +3,20 @@ * Copyright (c) 2006 Konstantin Shishkov * Partly based on vc9.c (c) 2005 Anonymous, Alex Beregszaszi, Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -112,7 +114,7 @@ enum MVModes { enum BMVTypes { BMV_TYPE_BACKWARD, BMV_TYPE_FORWARD, - BMV_TYPE_INTERPOLATED = 3 //XXX: ?? + BMV_TYPE_INTERPOLATED }; //@} @@ -209,6 +211,16 @@ enum CodingSet { CS_HIGH_RATE_INTER }; +/** @name Overlap conditions for Advanced Profile */ +//@{ +enum COTypes { + CONDOVER_NONE = 0, + CONDOVER_ALL, + CONDOVER_SELECT +}; +//@} + + /** The VC1 Context * @fixme Change size wherever another size is more efficient * Many members are only used for Advanced Profile @@ -246,6 +258,7 @@ typedef struct VC1Context{ int matrix_coef; ///< 8bits, Color primaries->YCbCr transform matrix int hrd_param_flag; ///< Presence of Hypothetical Reference ///< Decoder parameters + int psf; ///< Progressive Segmented Frame //@} /** Sequence header data for all Profiles @@ -321,6 +334,7 @@ typedef struct VC1Context{ int dmb_is_raw; ///< direct mb plane is raw int skip_is_raw; ///< skip mb plane is not coded uint8_t luty[256], lutuv[256]; // lookup tables used for intensity compensation + int use_ic; ///< use intensity compensation in B-frames int rnd; ///< rounding control /** Frame decoding info for S/M profiles only */ @@ -344,8 +358,10 @@ typedef struct VC1Context{ int hrd_num_leaky_buckets; uint8_t bit_rate_exponent; uint8_t buffer_size_exponent; -// BitPlane ac_pred_plane; ///< AC prediction flags bitplane -// BitPlane over_flags_plane; ///< Overflags bitplane + uint8_t* acpred_plane; ///< AC prediction flags bitplane + int acpred_is_raw; + uint8_t* over_flags_plane; ///< Overflags bitplane + int overflg_is_raw; uint8_t condover; uint16_t *hrd_rate, *hrd_buffer; uint8_t *hrd_fullness; @@ -354,6 +370,9 @@ typedef struct VC1Context{ uint8_t range_mapy; uint8_t range_mapuv; //@} + + int p_frame_skipped; + int bi_type; } VC1Context; /** @@ -546,7 +565,6 @@ static void decode_colskip(uint8_t* plane, int width, int height, int stride, Ge * @param v VC-1 context for bit reading and logging * @return Status * @fixme FIXME: Optimize - * @todo TODO: Decide if a struct is needed */ static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v) { @@ -718,7 +736,6 @@ static int vop_dquant_decoding(VC1Context *v) } /** Put block onto picture - * @todo move to DSPContext */ static void vc1_put_block(VC1Context *v, DCTELEM block[6][64]) { @@ -763,10 +780,20 @@ static void vc1_mc_1mv(VC1Context *v, int dir) if(!v->s.last_picture.data[0])return; - mx = s->mv[0][0][0]; - my = s->mv[0][0][1]; + mx = s->mv[dir][0][0]; + my = s->mv[dir][0][1]; + + // store motion vectors for further use in B frames + if(s->pict_type == P_TYPE) { + s->current_picture.motion_val[1][s->block_index[0]][0] = mx; + s->current_picture.motion_val[1][s->block_index[0]][1] = my; + } uvmx = (mx + ((mx & 3) == 3)) >> 1; uvmy = (my + ((my & 3) == 3)) >> 1; + if(v->fastuvmc) { + uvmx = uvmx + ((uvmx<0)?(uvmx&1):-(uvmx&1)); + uvmy = uvmy + ((uvmy<0)?(uvmy&1):-(uvmy&1)); + } if(!dir) { srcY = s->last_picture.data[0]; srcU = s->last_picture.data[1]; @@ -855,11 +882,6 @@ static void vc1_mc_1mv(VC1Context *v, int dir) srcY += s->mspel * (1 + s->linesize); } - if(v->fastuvmc) { - uvmx = uvmx + ((uvmx<0)?(uvmx&1):-(uvmx&1)); - uvmy = uvmy + ((uvmy<0)?(uvmy&1):-(uvmy&1)); - } - if(s->mspel) { dxy = ((my & 3) << 2) | (mx & 3); dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] , srcY , s->linesize, v->rnd); @@ -867,33 +889,26 @@ static void vc1_mc_1mv(VC1Context *v, int dir) srcY += s->linesize * 8; dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize , srcY , s->linesize, v->rnd); dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd); - } else if(!s->quarter_sample) { // hpel mc - mx >>= 1; - my >>= 1; - dxy = ((my & 1) << 1) | (mx & 1); + } else { // hpel mc - always used for luma + dxy = (my & 2) | ((mx & 2) >> 1); if(!v->rnd) dsp->put_pixels_tab[0][dxy](s->dest[0], srcY, s->linesize, 16); else dsp->put_no_rnd_pixels_tab[0][dxy](s->dest[0], srcY, s->linesize, 16); - } else { - dxy = ((my & 3) << 2) | (mx & 3); - - if(!v->rnd) - dsp->put_qpel_pixels_tab[0][dxy](s->dest[0], srcY, s->linesize); - else - dsp->put_no_rnd_qpel_pixels_tab[0][dxy](s->dest[0], srcY, s->linesize); } if(s->flags & CODEC_FLAG_GRAY) return; - /* Chroma MC always uses qpel blilinear */ + /* Chroma MC always uses qpel bilinear */ uvdxy = ((uvmy & 3) << 2) | (uvmx & 3); + uvmx = (uvmx&3)<<1; + uvmy = (uvmy&3)<<1; if(!v->rnd){ - dsp->put_qpel_pixels_tab[1][uvdxy](s->dest[1], srcU, s->uvlinesize); - dsp->put_qpel_pixels_tab[1][uvdxy](s->dest[2], srcV, s->uvlinesize); + dsp->put_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); + dsp->put_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); }else{ - dsp->put_no_rnd_qpel_pixels_tab[1][uvdxy](s->dest[1], srcU, s->uvlinesize); - dsp->put_no_rnd_qpel_pixels_tab[1][uvdxy](s->dest[2], srcV, s->uvlinesize); + dsp->put_no_rnd_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); + dsp->put_no_rnd_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); } } @@ -922,8 +937,9 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n) srcY += src_y * s->linesize + src_x; - if(v->rangeredfrm || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 8 - s->mspel - || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my&3) - 8 - s->mspel){ + if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP) + || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 8 - s->mspel*2 + || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my&3) - 8 - s->mspel*2){ srcY -= s->mspel * (1 + s->linesize); ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 9+s->mspel*2, 9+s->mspel*2, src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos); @@ -939,28 +955,29 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n) src += s->linesize; } } + /* if we deal with intensity compensation we need to scale source blocks */ + if(v->mv_mode == MV_PMODE_INTENSITY_COMP) { + int i, j; + uint8_t *src; + + src = srcY; + for(j = 0; j < 9 + s->mspel*2; j++) { + for(i = 0; i < 9 + s->mspel*2; i++) src[i] = v->luty[src[i]]; + src += s->linesize; + } + } srcY += s->mspel * (1 + s->linesize); } if(s->mspel) { dxy = ((my & 3) << 2) | (mx & 3); dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize, v->rnd); - } else if(!s->quarter_sample) { // hpel mc - mx >>= 1; - my >>= 1; - dxy = ((my & 1) << 1) | (mx & 1); - + } else { // hpel mc - always used for luma + dxy = (my & 2) | ((mx & 2) >> 1); if(!v->rnd) dsp->put_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize, 8); else dsp->put_no_rnd_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize, 8); - } else { - dxy = ((my & 3) << 2) | (mx & 3); - - if(!v->rnd) - dsp->put_qpel_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize); - else - dsp->put_no_rnd_qpel_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize); } } @@ -1030,8 +1047,14 @@ static void vc1_mc_4mv_chroma(VC1Context *v) } else return; //no need to do MC for inter blocks + s->current_picture.motion_val[1][s->block_index[0]][0] = tx; + s->current_picture.motion_val[1][s->block_index[0]][1] = ty; uvmx = (tx + ((tx&3) == 3)) >> 1; uvmy = (ty + ((ty&3) == 3)) >> 1; + if(v->fastuvmc) { + uvmx = uvmx + ((uvmx<0)?(uvmx&1):-(uvmx&1)); + uvmy = uvmy + ((uvmy<0)?(uvmy&1):-(uvmy&1)); + } uvsrc_x = s->mb_x * 8 + (uvmx >> 2); uvsrc_y = s->mb_y * 8 + (uvmy >> 2); @@ -1040,7 +1063,8 @@ static void vc1_mc_4mv_chroma(VC1Context *v) uvsrc_y = clip(uvsrc_y, -8, s->mb_height * 8); srcU = s->last_picture.data[1] + uvsrc_y * s->uvlinesize + uvsrc_x; srcV = s->last_picture.data[2] + uvsrc_y * s->uvlinesize + uvsrc_x; - if(v->rangeredfrm || (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 9 + if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP) + || (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 9 || (unsigned)uvsrc_y > (s->v_edge_pos >> 1) - 9){ ff_emulated_edge_mc(s->edge_emu_buffer , srcU, s->uvlinesize, 8+1, 8+1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); @@ -1064,24 +1088,38 @@ static void vc1_mc_4mv_chroma(VC1Context *v) src2 += s->uvlinesize; } } - } + /* if we deal with intensity compensation we need to scale source blocks */ + if(v->mv_mode == MV_PMODE_INTENSITY_COMP) { + int i, j; + uint8_t *src, *src2; - if(v->fastuvmc) { - uvmx = uvmx + ((uvmx<0)?(uvmx&1):-(uvmx&1)); - uvmy = uvmy + ((uvmy<0)?(uvmy&1):-(uvmy&1)); + src = srcU; src2 = srcV; + for(j = 0; j < 9; j++) { + for(i = 0; i < 9; i++) { + src[i] = v->lutuv[src[i]]; + src2[i] = v->lutuv[src2[i]]; + } + src += s->uvlinesize; + src2 += s->uvlinesize; + } + } } - /* Chroma MC always uses qpel blilinear */ + /* Chroma MC always uses qpel bilinear */ uvdxy = ((uvmy & 3) << 2) | (uvmx & 3); + uvmx = (uvmx&3)<<1; + uvmy = (uvmy&3)<<1; if(!v->rnd){ - dsp->put_qpel_pixels_tab[1][uvdxy](s->dest[1], srcU, s->uvlinesize); - dsp->put_qpel_pixels_tab[1][uvdxy](s->dest[2], srcV, s->uvlinesize); + dsp->put_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); + dsp->put_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); }else{ - dsp->put_no_rnd_qpel_pixels_tab[1][uvdxy](s->dest[1], srcU, s->uvlinesize); - dsp->put_no_rnd_qpel_pixels_tab[1][uvdxy](s->dest[2], srcV, s->uvlinesize); + dsp->put_no_rnd_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); + dsp->put_no_rnd_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); } } +static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb); + /** * Decode Simple/Main Profiles sequence header * @see Figure 7-8, p16-17 @@ -1093,7 +1131,7 @@ static int decode_sequence_header(AVCodecContext *avctx, GetBitContext *gb) { VC1Context *v = avctx->priv_data; - av_log(avctx, AV_LOG_INFO, "Header: %0X\n", show_bits(gb, 32)); + av_log(avctx, AV_LOG_DEBUG, "Header: %0X\n", show_bits(gb, 32)); v->profile = get_bits(gb, 2); if (v->profile == 2) { @@ -1103,18 +1141,7 @@ static int decode_sequence_header(AVCodecContext *avctx, GetBitContext *gb) if (v->profile == PROFILE_ADVANCED) { - v->level = get_bits(gb, 3); - if(v->level >= 5) - { - av_log(avctx, AV_LOG_ERROR, "Reserved LEVEL %i\n",v->level); - } - v->chromaformat = get_bits(gb, 2); - if (v->chromaformat != 1) - { - av_log(avctx, AV_LOG_ERROR, - "Only 4:2:0 chroma format supported\n"); - return -1; - } + return decode_sequence_header_adv(v, gb); } else { @@ -1138,23 +1165,20 @@ static int decode_sequence_header(AVCodecContext *avctx, GetBitContext *gb) "LOOPFILTER shell not be enabled in simple profile\n"); } - if (v->profile < PROFILE_ADVANCED) + v->res_x8 = get_bits(gb, 1); //reserved + if (v->res_x8) { - v->res_x8 = get_bits(gb, 1); //reserved - if (v->res_x8) - { - av_log(avctx, AV_LOG_ERROR, - "1 for reserved RES_X8 is forbidden\n"); - //return -1; - } - v->multires = get_bits(gb, 1); - v->res_fasttx = get_bits(gb, 1); - if (!v->res_fasttx) - { - av_log(avctx, AV_LOG_ERROR, - "0 for reserved RES_FASTTX is forbidden\n"); - //return -1; - } + av_log(avctx, AV_LOG_ERROR, + "1 for reserved RES_X8 is forbidden\n"); + //return -1; + } + v->multires = get_bits(gb, 1); + v->res_fasttx = get_bits(gb, 1); + if (!v->res_fasttx) + { + av_log(avctx, AV_LOG_ERROR, + "0 for reserved RES_FASTTX is forbidden\n"); + //return -1; } v->fastuvmc = get_bits(gb, 1); //common @@ -1174,44 +1198,38 @@ static int decode_sequence_header(AVCodecContext *avctx, GetBitContext *gb) v->dquant = get_bits(gb, 2); //common v->vstransform = get_bits(gb, 1); //common - if (v->profile < PROFILE_ADVANCED) + v->res_transtab = get_bits(gb, 1); + if (v->res_transtab) { - v->res_transtab = get_bits(gb, 1); - if (v->res_transtab) - { - av_log(avctx, AV_LOG_ERROR, - "1 for reserved RES_TRANSTAB is forbidden\n"); - return -1; - } + av_log(avctx, AV_LOG_ERROR, + "1 for reserved RES_TRANSTAB is forbidden\n"); + return -1; } v->overlap = get_bits(gb, 1); //common - if (v->profile < PROFILE_ADVANCED) + v->s.resync_marker = get_bits(gb, 1); + v->rangered = get_bits(gb, 1); + if (v->rangered && v->profile == PROFILE_SIMPLE) { - v->s.resync_marker = get_bits(gb, 1); - v->rangered = get_bits(gb, 1); - if (v->rangered && v->profile == PROFILE_SIMPLE) - { - av_log(avctx, AV_LOG_INFO, - "RANGERED should be set to 0 in simple profile\n"); - } + av_log(avctx, AV_LOG_INFO, + "RANGERED should be set to 0 in simple profile\n"); } v->s.max_b_frames = avctx->max_b_frames = get_bits(gb, 3); //common v->quantizer_mode = get_bits(gb, 2); //common - if (v->profile < PROFILE_ADVANCED) + v->finterpflag = get_bits(gb, 1); //common + v->res_rtm_flag = get_bits(gb, 1); //reserved + if (!v->res_rtm_flag) { - v->finterpflag = get_bits(gb, 1); //common - v->res_rtm_flag = get_bits(gb, 1); //reserved - if (!v->res_rtm_flag) - { - av_log(avctx, AV_LOG_ERROR, - "0 for reserved RES_RTM_FLAG is forbidden\n"); - //return -1; - } - av_log(avctx, AV_LOG_DEBUG, +// av_log(avctx, AV_LOG_ERROR, +// "0 for reserved RES_RTM_FLAG is forbidden\n"); + av_log(avctx, AV_LOG_ERROR, + "Old WMV3 version detected, only I-frames will be decoded\n"); + //return -1; + } + av_log(avctx, AV_LOG_DEBUG, "Profile %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n" "LoopFilter=%i, MultiRes=%i, FastUVMC=%i, Extended MV=%i\n" "Rangered=%i, VSTransform=%i, Overlap=%i, SyncMarker=%i\n" @@ -1221,11 +1239,128 @@ static int decode_sequence_header(AVCodecContext *avctx, GetBitContext *gb) v->rangered, v->vstransform, v->overlap, v->s.resync_marker, v->dquant, v->quantizer_mode, avctx->max_b_frames ); - return 0; + return 0; +} + +static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb) +{ + v->res_rtm_flag = 1; + v->level = get_bits(gb, 3); + if(v->level >= 5) + { + av_log(v->s.avctx, AV_LOG_ERROR, "Reserved LEVEL %i\n",v->level); } - return -1; + v->chromaformat = get_bits(gb, 2); + if (v->chromaformat != 1) + { + av_log(v->s.avctx, AV_LOG_ERROR, + "Only 4:2:0 chroma format supported\n"); + return -1; + } + + // (fps-2)/4 (->30) + v->frmrtq_postproc = get_bits(gb, 3); //common + // (bitrate-32kbps)/64kbps + v->bitrtq_postproc = get_bits(gb, 5); //common + v->postprocflag = get_bits(gb, 1); //common + + v->s.avctx->coded_width = (get_bits(gb, 12) + 1) << 1; + v->s.avctx->coded_height = (get_bits(gb, 12) + 1) << 1; + v->broadcast = get_bits1(gb); + v->interlace = get_bits1(gb); + v->tfcntrflag = get_bits1(gb); + v->finterpflag = get_bits1(gb); + get_bits1(gb); // reserved + v->psf = get_bits1(gb); + if(v->psf) { //PsF, 6.1.13 + av_log(v->s.avctx, AV_LOG_ERROR, "Progressive Segmented Frame mode: not supported (yet)\n"); + return -1; + } + if(get_bits1(gb)) { //Display Info - decoding is not affected by it + int w, h, ar = 0; + av_log(v->s.avctx, AV_LOG_INFO, "Display extended info:\n"); + w = get_bits(gb, 14); + h = get_bits(gb, 14); + av_log(v->s.avctx, AV_LOG_INFO, "Display dimensions: %ix%i\n", w, h); + //TODO: store aspect ratio in AVCodecContext + if(get_bits1(gb)) + ar = get_bits(gb, 4); + if(ar == 15) { + w = get_bits(gb, 8); + h = get_bits(gb, 8); + } + + if(get_bits1(gb)){ //framerate stuff + if(get_bits1(gb)) { + get_bits(gb, 16); + } else { + get_bits(gb, 8); + get_bits(gb, 4); + } + } + + if(get_bits1(gb)){ + v->color_prim = get_bits(gb, 8); + v->transfer_char = get_bits(gb, 8); + v->matrix_coef = get_bits(gb, 8); + } + } + + v->hrd_param_flag = get_bits1(gb); + if(v->hrd_param_flag) { + int i; + v->hrd_num_leaky_buckets = get_bits(gb, 5); + get_bits(gb, 4); //bitrate exponent + get_bits(gb, 4); //buffer size exponent + for(i = 0; i < v->hrd_num_leaky_buckets; i++) { + get_bits(gb, 16); //hrd_rate[n] + get_bits(gb, 16); //hrd_buffer[n] + } + } + return 0; } +static int decode_entry_point(AVCodecContext *avctx, GetBitContext *gb) +{ + VC1Context *v = avctx->priv_data; + int i; + + av_log(avctx, AV_LOG_DEBUG, "Entry point: %08X\n", show_bits_long(gb, 32)); + get_bits1(gb); // broken link + avctx->max_b_frames = 1 - get_bits1(gb); // 'closed entry' also signalize possible B-frames + v->panscanflag = get_bits1(gb); + get_bits1(gb); // refdist flag + v->s.loop_filter = get_bits1(gb); + v->fastuvmc = get_bits1(gb); + v->extended_mv = get_bits1(gb); + v->dquant = get_bits(gb, 2); + v->vstransform = get_bits1(gb); + v->overlap = get_bits1(gb); + v->quantizer_mode = get_bits(gb, 2); + + if(v->hrd_param_flag){ + for(i = 0; i < v->hrd_num_leaky_buckets; i++) { + get_bits(gb, 8); //hrd_full[n] + } + } + + if(get_bits1(gb)){ + avctx->coded_width = (get_bits(gb, 12)+1)<<1; + avctx->coded_height = (get_bits(gb, 12)+1)<<1; + } + if(v->extended_mv) + v->extended_dmv = get_bits1(gb); + if(get_bits1(gb)) { + av_log(avctx, AV_LOG_ERROR, "Luma scaling is not supported, expect wrong picture\n"); + skip_bits(gb, 3); // Y range, ignored for now + } + if(get_bits1(gb)) { + av_log(avctx, AV_LOG_ERROR, "Chroma scaling is not supported, expect wrong picture\n"); + skip_bits(gb, 3); // UV range, ignored for now + } + + return 0; +} static int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) { @@ -1243,18 +1378,19 @@ static int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) } else v->s.pict_type = P_TYPE; } else v->s.pict_type = v->s.pict_type ? P_TYPE : I_TYPE; - if(v->s.pict_type == I_TYPE) - get_bits(gb, 7); // skip buffer fullness + v->bi_type = 0; if(v->s.pict_type == B_TYPE) { v->bfraction = get_vlc2(gb, vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); v->bfraction = vc1_bfraction_lut[v->bfraction]; - if(v->bfraction == -1) { + if(v->bfraction == 0) { v->s.pict_type = BI_TYPE; } } + if(v->s.pict_type == I_TYPE || v->s.pict_type == BI_TYPE) + get_bits(gb, 7); // skip buffer fullness /* calculate RND */ - if(v->s.pict_type == I_TYPE) + if(v->s.pict_type == I_TYPE || v->s.pict_type == BI_TYPE) v->rnd = 1; if(v->s.pict_type == P_TYPE) v->rnd ^= 1; @@ -1292,7 +1428,8 @@ static int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) //av_log(v->s.avctx, AV_LOG_INFO, "%c Frame: QP=[%i]%i (+%i/2) %i\n", // (v->s.pict_type == P_TYPE) ? 'P' : ((v->s.pict_type == I_TYPE) ? 'I' : 'B'), pqindex, v->pq, v->halfpq, v->rangeredfrm); - //TODO: complete parsing for P/B/BI frames + if(v->s.pict_type == I_TYPE || v->s.pict_type == P_TYPE) v->use_ic = 0; + switch(v->s.pict_type) { case P_TYPE: if (v->pq < 5) v->tt_index = 0; @@ -1307,6 +1444,7 @@ static int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) v->mv_mode2 = mv_pmode_table2[lowquant][get_prefix(gb, 1, 3)]; v->lumscale = get_bits(gb, 6); v->lumshift = get_bits(gb, 6); + v->use_ic = 1; /* fill lookup tables for intensity compensation */ if(!v->lumscale) { scale = -64; @@ -1428,130 +1566,381 @@ static int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) /* DC Syntax */ v->s.dc_table_index = get_bits(gb, 1); + if(v->s.pict_type == BI_TYPE) { + v->s.pict_type = B_TYPE; + v->bi_type = 1; + } return 0; } -/***********************************************************************/ -/** - * @defgroup block VC-1 Block-level functions - * @see 7.1.4, p91 and 8.1.1.7, p(1)04 - * @todo TODO: Integrate to MpegEncContext facilities - * @{ - */ - -/** - * @def GET_MQUANT - * @brief Get macroblock-level quantizer scale - * @warning XXX: qdiff to the frame quant, not previous quant ? - * @fixme XXX: Don't know how to initialize mquant otherwise in last case - */ -#define GET_MQUANT() \ - if (v->dquantfrm) \ - { \ - int edges = 0; \ - if (v->dqprofile == DQPROFILE_ALL_MBS) \ - { \ - if (v->dqbilevel) \ - { \ - mquant = (get_bits(gb, 1)) ? v->altpq : v->pq; \ - } \ - else \ - { \ - mqdiff = get_bits(gb, 3); \ - if (mqdiff != 7) mquant = v->pq + mqdiff; \ - else mquant = get_bits(gb, 5); \ - } \ - } \ - if(v->dqprofile == DQPROFILE_SINGLE_EDGE) \ - edges = 1 << v->dqsbedge; \ - else if(v->dqprofile == DQPROFILE_DOUBLE_EDGES) \ - edges = (3 << v->dqsbedge) % 15; \ - else if(v->dqprofile == DQPROFILE_FOUR_EDGES) \ - edges = 15; \ - if((edges&1) && !s->mb_x) \ - mquant = v->altpq; \ - if((edges&2) && s->first_slice_line) \ - mquant = v->altpq; \ - if((edges&4) && s->mb_x == (s->mb_width - 1)) \ - mquant = v->altpq; \ - if((edges&8) && s->mb_y == (s->mb_height - 1)) \ - mquant = v->altpq; \ - } - -/** - * @def GET_MVDATA(_dmv_x, _dmv_y) - * @brief Get MV differentials - * @see MVDATA decoding from 8.3.5.2, p(1)20 - * @param _dmv_x Horizontal differential for decoded MV - * @param _dmv_y Vertical differential for decoded MV - * @todo TODO: Use MpegEncContext arrays to store them - */ -#define GET_MVDATA(_dmv_x, _dmv_y) \ - index = 1 + get_vlc2(gb, vc1_mv_diff_vlc[s->mv_table_index].table,\ - VC1_MV_DIFF_VLC_BITS, 2); \ - if (index > 36) \ - { \ - mb_has_coeffs = 1; \ - index -= 37; \ - } \ - else mb_has_coeffs = 0; \ - s->mb_intra = 0; \ - if (!index) { _dmv_x = _dmv_y = 0; } \ - else if (index == 35) \ - { \ - _dmv_x = get_bits(gb, v->k_x - 1 + s->quarter_sample); \ - _dmv_y = get_bits(gb, v->k_y - 1 + s->quarter_sample); \ - } \ - else if (index == 36) \ - { \ - _dmv_x = 0; \ - _dmv_y = 0; \ - s->mb_intra = 1; \ - } \ - else \ - { \ - index1 = index%6; \ - if (!s->quarter_sample && index1 == 5) val = 1; \ - else val = 0; \ - if(size_table[index1] - val > 0) \ - val = get_bits(gb, size_table[index1] - val); \ - else val = 0; \ - sign = 0 - (val&1); \ - _dmv_x = (sign ^ ((val>>1) + offset_table[index1])) - sign; \ - \ - index1 = index/6; \ - if (!s->quarter_sample && index1 == 5) val = 1; \ - else val = 0; \ - if(size_table[index1] - val > 0) \ - val = get_bits(gb, size_table[index1] - val); \ - else val = 0; \ - sign = 0 - (val&1); \ - _dmv_y = (sign ^ ((val>>1) + offset_table[index1])) - sign; \ - } - -/** Predict and set motion vector - */ -static inline void vc1_pred_mv(MpegEncContext *s, int n, int dmv_x, int dmv_y, int mv1, int r_x, int r_y, uint8_t* is_intra) +static int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) { - int xy, wrap, off = 0; - int16_t *A, *B, *C; - int px, py; - int sum; - - /* scale MV difference to be quad-pel */ - dmv_x <<= 1 - s->quarter_sample; - dmv_y <<= 1 - s->quarter_sample; + int fcm; + int pqindex, lowquant; + int status; - wrap = s->b8_stride; - xy = s->block_index[n]; + v->p_frame_skipped = 0; - if(s->mb_intra){ - s->mv[0][n][0] = s->current_picture.motion_val[0][xy][0] = 0; - s->mv[0][n][1] = s->current_picture.motion_val[0][xy][1] = 0; - if(mv1) { /* duplicate motion data for 1-MV block */ - s->current_picture.motion_val[0][xy + 1][0] = 0; - s->current_picture.motion_val[0][xy + 1][1] = 0; - s->current_picture.motion_val[0][xy + wrap][0] = 0; + if(v->interlace) + fcm = decode012(gb); + switch(get_prefix(gb, 0, 4)) { + case 0: + v->s.pict_type = P_TYPE; + break; + case 1: + v->s.pict_type = B_TYPE; + break; + case 2: + v->s.pict_type = I_TYPE; + break; + case 3: + v->s.pict_type = BI_TYPE; + break; + case 4: + v->s.pict_type = P_TYPE; // skipped pic + v->p_frame_skipped = 1; + return 0; + } + if(v->tfcntrflag) + get_bits(gb, 8); + if(v->broadcast) { + if(!v->interlace || v->panscanflag) { + get_bits(gb, 2); + } else { + get_bits1(gb); + get_bits1(gb); + } + } + if(v->panscanflag) { + //... + } + v->rnd = get_bits1(gb); + if(v->interlace) + v->uvsamp = get_bits1(gb); + if(v->finterpflag) v->interpfrm = get_bits(gb, 1); + if(v->s.pict_type == B_TYPE) { + v->bfraction = get_vlc2(gb, vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); + v->bfraction = vc1_bfraction_lut[v->bfraction]; + if(v->bfraction == 0) { + v->s.pict_type = BI_TYPE; /* XXX: should not happen here */ + } + } + pqindex = get_bits(gb, 5); + v->pqindex = pqindex; + if (v->quantizer_mode == QUANT_FRAME_IMPLICIT) + v->pq = pquant_table[0][pqindex]; + else + v->pq = pquant_table[1][pqindex]; + + v->pquantizer = 1; + if (v->quantizer_mode == QUANT_FRAME_IMPLICIT) + v->pquantizer = pqindex < 9; + if (v->quantizer_mode == QUANT_NON_UNIFORM) + v->pquantizer = 0; + v->pqindex = pqindex; + if (pqindex < 9) v->halfpq = get_bits(gb, 1); + else v->halfpq = 0; + if (v->quantizer_mode == QUANT_FRAME_EXPLICIT) + v->pquantizer = get_bits(gb, 1); + + switch(v->s.pict_type) { + case I_TYPE: + case BI_TYPE: + status = bitplane_decoding(v->acpred_plane, &v->acpred_is_raw, v); + if (status < 0) return -1; + av_log(v->s.avctx, AV_LOG_DEBUG, "ACPRED plane encoding: " + "Imode: %i, Invert: %i\n", status>>1, status&1); + v->condover = CONDOVER_NONE; + if(v->overlap && v->pq <= 8) { + v->condover = decode012(gb); + if(v->condover == CONDOVER_SELECT) { + status = bitplane_decoding(v->over_flags_plane, &v->overflg_is_raw, v); + if (status < 0) return -1; + av_log(v->s.avctx, AV_LOG_DEBUG, "CONDOVER plane encoding: " + "Imode: %i, Invert: %i\n", status>>1, status&1); + } + } + break; + case P_TYPE: + if(v->postprocflag) + v->postproc = get_bits1(gb); + if (v->extended_mv) v->mvrange = get_prefix(gb, 0, 3); + else v->mvrange = 0; + v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13 + v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11 + v->range_x = 1 << (v->k_x - 1); + v->range_y = 1 << (v->k_y - 1); + + if (v->pq < 5) v->tt_index = 0; + else if(v->pq < 13) v->tt_index = 1; + else v->tt_index = 2; + + lowquant = (v->pq > 12) ? 0 : 1; + v->mv_mode = mv_pmode_table[lowquant][get_prefix(gb, 1, 4)]; + if (v->mv_mode == MV_PMODE_INTENSITY_COMP) + { + int scale, shift, i; + v->mv_mode2 = mv_pmode_table2[lowquant][get_prefix(gb, 1, 3)]; + v->lumscale = get_bits(gb, 6); + v->lumshift = get_bits(gb, 6); + /* fill lookup tables for intensity compensation */ + if(!v->lumscale) { + scale = -64; + shift = (255 - v->lumshift * 2) << 6; + if(v->lumshift > 31) + shift += 128 << 6; + } else { + scale = v->lumscale + 32; + if(v->lumshift > 31) + shift = (v->lumshift - 64) << 6; + else + shift = v->lumshift << 6; + } + for(i = 0; i < 256; i++) { + v->luty[i] = clip_uint8((scale * i + shift + 32) >> 6); + v->lutuv[i] = clip_uint8((scale * (i - 128) + 128*64 + 32) >> 6); + } + } + if(v->mv_mode == MV_PMODE_1MV_HPEL || v->mv_mode == MV_PMODE_1MV_HPEL_BILIN) + v->s.quarter_sample = 0; + else if(v->mv_mode == MV_PMODE_INTENSITY_COMP) { + if(v->mv_mode2 == MV_PMODE_1MV_HPEL || v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN) + v->s.quarter_sample = 0; + else + v->s.quarter_sample = 1; + } else + v->s.quarter_sample = 1; + v->s.mspel = !(v->mv_mode == MV_PMODE_1MV_HPEL_BILIN || (v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN)); + + if ((v->mv_mode == MV_PMODE_INTENSITY_COMP && + v->mv_mode2 == MV_PMODE_MIXED_MV) + || v->mv_mode == MV_PMODE_MIXED_MV) + { + status = bitplane_decoding(v->mv_type_mb_plane, &v->mv_type_is_raw, v); + if (status < 0) return -1; + av_log(v->s.avctx, AV_LOG_DEBUG, "MB MV Type plane encoding: " + "Imode: %i, Invert: %i\n", status>>1, status&1); + } else { + v->mv_type_is_raw = 0; + memset(v->mv_type_mb_plane, 0, v->s.mb_stride * v->s.mb_height); + } + status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); + if (status < 0) return -1; + av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " + "Imode: %i, Invert: %i\n", status>>1, status&1); + + /* Hopefully this is correct for P frames */ + v->s.mv_table_index = get_bits(gb, 2); //but using vc1_ tables + v->cbpcy_vlc = &vc1_cbpcy_p_vlc[get_bits(gb, 2)]; + if (v->dquant) + { + av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); + vop_dquant_decoding(v); + } + + v->ttfrm = 0; //FIXME Is that so ? + if (v->vstransform) + { + v->ttmbf = get_bits(gb, 1); + if (v->ttmbf) + { + v->ttfrm = ttfrm_to_tt[get_bits(gb, 2)]; + } + } else { + v->ttmbf = 1; + v->ttfrm = TT_8X8; + } + break; + case B_TYPE: + if(v->postprocflag) + v->postproc = get_bits1(gb); + if (v->extended_mv) v->mvrange = get_prefix(gb, 0, 3); + else v->mvrange = 0; + v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13 + v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11 + v->range_x = 1 << (v->k_x - 1); + v->range_y = 1 << (v->k_y - 1); + + if (v->pq < 5) v->tt_index = 0; + else if(v->pq < 13) v->tt_index = 1; + else v->tt_index = 2; + + lowquant = (v->pq > 12) ? 0 : 1; + v->mv_mode = get_bits1(gb) ? MV_PMODE_1MV : MV_PMODE_1MV_HPEL_BILIN; + v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV); + v->s.mspel = v->s.quarter_sample; + + status = bitplane_decoding(v->direct_mb_plane, &v->dmb_is_raw, v); + if (status < 0) return -1; + av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: " + "Imode: %i, Invert: %i\n", status>>1, status&1); + status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); + if (status < 0) return -1; + av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " + "Imode: %i, Invert: %i\n", status>>1, status&1); + + v->s.mv_table_index = get_bits(gb, 2); + v->cbpcy_vlc = &vc1_cbpcy_p_vlc[get_bits(gb, 2)]; + + if (v->dquant) + { + av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); + vop_dquant_decoding(v); + } + + v->ttfrm = 0; + if (v->vstransform) + { + v->ttmbf = get_bits(gb, 1); + if (v->ttmbf) + { + v->ttfrm = ttfrm_to_tt[get_bits(gb, 2)]; + } + } else { + v->ttmbf = 1; + v->ttfrm = TT_8X8; + } + break; + } + + /* AC Syntax */ + v->c_ac_table_index = decode012(gb); + if (v->s.pict_type == I_TYPE || v->s.pict_type == BI_TYPE) + { + v->y_ac_table_index = decode012(gb); + } + /* DC Syntax */ + v->s.dc_table_index = get_bits(gb, 1); + if (v->s.pict_type == I_TYPE && v->dquant) { + av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); + vop_dquant_decoding(v); + } + + v->bi_type = 0; + if(v->s.pict_type == BI_TYPE) { + v->s.pict_type = B_TYPE; + v->bi_type = 1; + } + return 0; +} + +/***********************************************************************/ +/** + * @defgroup block VC-1 Block-level functions + * @see 7.1.4, p91 and 8.1.1.7, p(1)04 + * @{ + */ + +/** + * @def GET_MQUANT + * @brief Get macroblock-level quantizer scale + */ +#define GET_MQUANT() \ + if (v->dquantfrm) \ + { \ + int edges = 0; \ + if (v->dqprofile == DQPROFILE_ALL_MBS) \ + { \ + if (v->dqbilevel) \ + { \ + mquant = (get_bits(gb, 1)) ? v->altpq : v->pq; \ + } \ + else \ + { \ + mqdiff = get_bits(gb, 3); \ + if (mqdiff != 7) mquant = v->pq + mqdiff; \ + else mquant = get_bits(gb, 5); \ + } \ + } \ + if(v->dqprofile == DQPROFILE_SINGLE_EDGE) \ + edges = 1 << v->dqsbedge; \ + else if(v->dqprofile == DQPROFILE_DOUBLE_EDGES) \ + edges = (3 << v->dqsbedge) % 15; \ + else if(v->dqprofile == DQPROFILE_FOUR_EDGES) \ + edges = 15; \ + if((edges&1) && !s->mb_x) \ + mquant = v->altpq; \ + if((edges&2) && s->first_slice_line) \ + mquant = v->altpq; \ + if((edges&4) && s->mb_x == (s->mb_width - 1)) \ + mquant = v->altpq; \ + if((edges&8) && s->mb_y == (s->mb_height - 1)) \ + mquant = v->altpq; \ + } + +/** + * @def GET_MVDATA(_dmv_x, _dmv_y) + * @brief Get MV differentials + * @see MVDATA decoding from 8.3.5.2, p(1)20 + * @param _dmv_x Horizontal differential for decoded MV + * @param _dmv_y Vertical differential for decoded MV + */ +#define GET_MVDATA(_dmv_x, _dmv_y) \ + index = 1 + get_vlc2(gb, vc1_mv_diff_vlc[s->mv_table_index].table,\ + VC1_MV_DIFF_VLC_BITS, 2); \ + if (index > 36) \ + { \ + mb_has_coeffs = 1; \ + index -= 37; \ + } \ + else mb_has_coeffs = 0; \ + s->mb_intra = 0; \ + if (!index) { _dmv_x = _dmv_y = 0; } \ + else if (index == 35) \ + { \ + _dmv_x = get_bits(gb, v->k_x - 1 + s->quarter_sample); \ + _dmv_y = get_bits(gb, v->k_y - 1 + s->quarter_sample); \ + } \ + else if (index == 36) \ + { \ + _dmv_x = 0; \ + _dmv_y = 0; \ + s->mb_intra = 1; \ + } \ + else \ + { \ + index1 = index%6; \ + if (!s->quarter_sample && index1 == 5) val = 1; \ + else val = 0; \ + if(size_table[index1] - val > 0) \ + val = get_bits(gb, size_table[index1] - val); \ + else val = 0; \ + sign = 0 - (val&1); \ + _dmv_x = (sign ^ ((val>>1) + offset_table[index1])) - sign; \ + \ + index1 = index/6; \ + if (!s->quarter_sample && index1 == 5) val = 1; \ + else val = 0; \ + if(size_table[index1] - val > 0) \ + val = get_bits(gb, size_table[index1] - val); \ + else val = 0; \ + sign = 0 - (val&1); \ + _dmv_y = (sign ^ ((val>>1) + offset_table[index1])) - sign; \ + } + +/** Predict and set motion vector + */ +static inline void vc1_pred_mv(MpegEncContext *s, int n, int dmv_x, int dmv_y, int mv1, int r_x, int r_y, uint8_t* is_intra) +{ + int xy, wrap, off = 0; + int16_t *A, *B, *C; + int px, py; + int sum; + + /* scale MV difference to be quad-pel */ + dmv_x <<= 1 - s->quarter_sample; + dmv_y <<= 1 - s->quarter_sample; + + wrap = s->b8_stride; + xy = s->block_index[n]; + + if(s->mb_intra){ + s->mv[0][n][0] = s->current_picture.motion_val[0][xy][0] = 0; + s->mv[0][n][1] = s->current_picture.motion_val[0][xy][1] = 0; + if(mv1) { /* duplicate motion data for 1-MV block */ + s->current_picture.motion_val[0][xy + 1][0] = 0; + s->current_picture.motion_val[0][xy + 1][1] = 0; + s->current_picture.motion_val[0][xy + wrap][0] = 0; s->current_picture.motion_val[0][xy + wrap][1] = 0; s->current_picture.motion_val[0][xy + wrap + 1][0] = 0; s->current_picture.motion_val[0][xy + wrap + 1][1] = 0; @@ -1615,9 +2004,9 @@ static inline void vc1_pred_mv(MpegEncContext *s, int n, int dmv_x, int dmv_y, i /* Calculate hybrid prediction as specified in 8.3.5.3.5 */ if((!s->first_slice_line || (n==2 || n==3)) && (s->mb_x || (n==1 || n==3))) { if(is_intra[xy - wrap]) - sum = ABS(px) + ABS(py); + sum = FFABS(px) + FFABS(py); else - sum = ABS(px - A[0]) + ABS(py - A[1]); + sum = FFABS(px - A[0]) + FFABS(py - A[1]); if(sum > 32) { if(get_bits1(&s->gb)) { px = A[0]; @@ -1628,9 +2017,9 @@ static inline void vc1_pred_mv(MpegEncContext *s, int n, int dmv_x, int dmv_y, i } } else { if(is_intra[xy - 1]) - sum = ABS(px) + ABS(py); + sum = FFABS(px) + FFABS(py); else - sum = ABS(px - C[0]) + ABS(py - C[1]); + sum = FFABS(px - C[0]) + FFABS(py - C[1]); if(sum > 32) { if(get_bits1(&s->gb)) { px = A[0]; @@ -1655,44 +2044,346 @@ static inline void vc1_pred_mv(MpegEncContext *s, int n, int dmv_x, int dmv_y, i } } +/** Motion compensation for direct or interpolated blocks in B-frames + */ +static void vc1_interp_mc(VC1Context *v) +{ + MpegEncContext *s = &v->s; + DSPContext *dsp = &v->s.dsp; + uint8_t *srcY, *srcU, *srcV; + int dxy, uvdxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; + + if(!v->s.next_picture.data[0])return; + + mx = s->mv[1][0][0]; + my = s->mv[1][0][1]; + uvmx = (mx + ((mx & 3) == 3)) >> 1; + uvmy = (my + ((my & 3) == 3)) >> 1; + if(v->fastuvmc) { + uvmx = uvmx + ((uvmx<0)?-(uvmx&1):(uvmx&1)); + uvmy = uvmy + ((uvmy<0)?-(uvmy&1):(uvmy&1)); + } + srcY = s->next_picture.data[0]; + srcU = s->next_picture.data[1]; + srcV = s->next_picture.data[2]; + + src_x = s->mb_x * 16 + (mx >> 2); + src_y = s->mb_y * 16 + (my >> 2); + uvsrc_x = s->mb_x * 8 + (uvmx >> 2); + uvsrc_y = s->mb_y * 8 + (uvmy >> 2); + + src_x = clip( src_x, -16, s->mb_width * 16); + src_y = clip( src_y, -16, s->mb_height * 16); + uvsrc_x = clip(uvsrc_x, -8, s->mb_width * 8); + uvsrc_y = clip(uvsrc_y, -8, s->mb_height * 8); + + srcY += src_y * s->linesize + src_x; + srcU += uvsrc_y * s->uvlinesize + uvsrc_x; + srcV += uvsrc_y * s->uvlinesize + uvsrc_x; + + /* for grayscale we should not try to read from unknown area */ + if(s->flags & CODEC_FLAG_GRAY) { + srcU = s->edge_emu_buffer + 18 * s->linesize; + srcV = s->edge_emu_buffer + 18 * s->linesize; + } + + if(v->rangeredfrm + || (unsigned)src_x > s->h_edge_pos - (mx&3) - 16 + || (unsigned)src_y > s->v_edge_pos - (my&3) - 16){ + uint8_t *uvbuf= s->edge_emu_buffer + 19 * s->linesize; + + srcY -= s->mspel * (1 + s->linesize); + ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2, + src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos); + srcY = s->edge_emu_buffer; + ff_emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8+1, 8+1, + uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); + ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1, + uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); + srcU = uvbuf; + srcV = uvbuf + 16; + /* if we deal with range reduction we need to scale source blocks */ + if(v->rangeredfrm) { + int i, j; + uint8_t *src, *src2; + + src = srcY; + for(j = 0; j < 17 + s->mspel*2; j++) { + for(i = 0; i < 17 + s->mspel*2; i++) src[i] = ((src[i] - 128) >> 1) + 128; + src += s->linesize; + } + src = srcU; src2 = srcV; + for(j = 0; j < 9; j++) { + for(i = 0; i < 9; i++) { + src[i] = ((src[i] - 128) >> 1) + 128; + src2[i] = ((src2[i] - 128) >> 1) + 128; + } + src += s->uvlinesize; + src2 += s->uvlinesize; + } + } + srcY += s->mspel * (1 + s->linesize); + } + + mx >>= 1; + my >>= 1; + dxy = ((my & 1) << 1) | (mx & 1); + + dsp->avg_pixels_tab[0][dxy](s->dest[0], srcY, s->linesize, 16); + + if(s->flags & CODEC_FLAG_GRAY) return; + /* Chroma MC always uses qpel blilinear */ + uvdxy = ((uvmy & 3) << 2) | (uvmx & 3); + uvmx = (uvmx&3)<<1; + uvmy = (uvmy&3)<<1; + dsp->avg_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); + dsp->avg_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); +} + +static always_inline int scale_mv(int value, int bfrac, int inv, int qs) +{ + int n = bfrac; + +#if B_FRACTION_DEN==256 + if(inv) + n -= 256; + if(!qs) + return 2 * ((value * n + 255) >> 9); + return (value * n + 128) >> 8; +#else + if(inv) + n -= B_FRACTION_DEN; + if(!qs) + return 2 * ((value * n + B_FRACTION_DEN - 1) / (2 * B_FRACTION_DEN)); + return (value * n + B_FRACTION_DEN/2) / B_FRACTION_DEN; +#endif +} + /** Reconstruct motion vector for B-frame and do motion compensation */ static inline void vc1_b_mc(VC1Context *v, int dmv_x[2], int dmv_y[2], int direct, int mode) +{ + if(v->use_ic) { + v->mv_mode2 = v->mv_mode; + v->mv_mode = MV_PMODE_INTENSITY_COMP; + } + if(direct) { + vc1_mc_1mv(v, 0); + vc1_interp_mc(v); + if(v->use_ic) v->mv_mode = v->mv_mode2; + return; + } + if(mode == BMV_TYPE_INTERPOLATED) { + vc1_mc_1mv(v, 0); + vc1_interp_mc(v); + if(v->use_ic) v->mv_mode = v->mv_mode2; + return; + } + + if(v->use_ic && (mode == BMV_TYPE_BACKWARD)) v->mv_mode = v->mv_mode2; + vc1_mc_1mv(v, (mode == BMV_TYPE_BACKWARD)); + if(v->use_ic) v->mv_mode = v->mv_mode2; +} + +static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int direct, int mvtype) { MpegEncContext *s = &v->s; - int mx[4], my[4], mv_x, mv_y; - int i; + int xy, wrap, off = 0; + int16_t *A, *B, *C; + int px, py; + int sum; + int r_x, r_y; + const uint8_t *is_intra = v->mb_type[0]; + r_x = v->range_x; + r_y = v->range_y; /* scale MV difference to be quad-pel */ dmv_x[0] <<= 1 - s->quarter_sample; dmv_y[0] <<= 1 - s->quarter_sample; dmv_x[1] <<= 1 - s->quarter_sample; dmv_y[1] <<= 1 - s->quarter_sample; - if(direct || mode == BMV_TYPE_INTERPOLATED) { - /* TODO */ + wrap = s->b8_stride; + xy = s->block_index[0]; + + if(s->mb_intra) { + s->current_picture.motion_val[0][xy][0] = + s->current_picture.motion_val[0][xy][1] = + s->current_picture.motion_val[1][xy][0] = + s->current_picture.motion_val[1][xy][1] = 0; + return; + } + s->mv[0][0][0] = scale_mv(s->next_picture.motion_val[1][xy][0], v->bfraction, 0, s->quarter_sample); + s->mv[0][0][1] = scale_mv(s->next_picture.motion_val[1][xy][1], v->bfraction, 0, s->quarter_sample); + s->mv[1][0][0] = scale_mv(s->next_picture.motion_val[1][xy][0], v->bfraction, 1, s->quarter_sample); + s->mv[1][0][1] = scale_mv(s->next_picture.motion_val[1][xy][1], v->bfraction, 1, s->quarter_sample); + if(direct) { + s->current_picture.motion_val[0][xy][0] = s->mv[0][0][0]; + s->current_picture.motion_val[0][xy][1] = s->mv[0][0][1]; + s->current_picture.motion_val[1][xy][0] = s->mv[1][0][0]; + s->current_picture.motion_val[1][xy][1] = s->mv[1][0][1]; return; } - if(mode == BMV_TYPE_BACKWARD) { - for(i = 0; i < 4; i++) { - mx[i] = s->last_picture.motion_val[0][s->block_index[i]][0]; - my[i] = s->last_picture.motion_val[0][s->block_index[i]][1]; + if((mvtype == BMV_TYPE_FORWARD) || (mvtype == BMV_TYPE_INTERPOLATED)) { + C = s->current_picture.motion_val[0][xy - 2]; + A = s->current_picture.motion_val[0][xy - wrap*2]; + off = (s->mb_x == (s->mb_width - 1)) ? -2 : 2; + B = s->current_picture.motion_val[0][xy - wrap*2 + off]; + + if(!s->first_slice_line) { // predictor A is not out of bounds + if(s->mb_width == 1) { + px = A[0]; + py = A[1]; + } else { + px = mid_pred(A[0], B[0], C[0]); + py = mid_pred(A[1], B[1], C[1]); + } + } else if(s->mb_x) { // predictor C is not out of bounds + px = C[0]; + py = C[1]; + } else { + px = py = 0; } - } else { - for(i = 0; i < 4; i++) { - mx[i] = s->next_picture.motion_val[0][s->block_index[i]][0]; - my[i] = s->next_picture.motion_val[0][s->block_index[i]][1]; + /* Pullback MV as specified in 8.3.5.3.4 */ + { + int qx, qy, X, Y; + if(v->profile < PROFILE_ADVANCED) { + qx = (s->mb_x << 5); + qy = (s->mb_y << 5); + X = (s->mb_width << 5) - 4; + Y = (s->mb_height << 5) - 4; + if(qx + px < -28) px = -28 - qx; + if(qy + py < -28) py = -28 - qy; + if(qx + px > X) px = X - qx; + if(qy + py > Y) py = Y - qy; + } else { + qx = (s->mb_x << 6); + qy = (s->mb_y << 6); + X = (s->mb_width << 6) - 4; + Y = (s->mb_height << 6) - 4; + if(qx + px < -60) px = -60 - qx; + if(qy + py < -60) py = -60 - qy; + if(qx + px > X) px = X - qx; + if(qy + py > Y) py = Y - qy; + } + } + /* Calculate hybrid prediction as specified in 8.3.5.3.5 */ + if(0 && !s->first_slice_line && s->mb_x) { + if(is_intra[xy - wrap]) + sum = FFABS(px) + FFABS(py); + else + sum = FFABS(px - A[0]) + FFABS(py - A[1]); + if(sum > 32) { + if(get_bits1(&s->gb)) { + px = A[0]; + py = A[1]; + } else { + px = C[0]; + py = C[1]; + } + } else { + if(is_intra[xy - 2]) + sum = FFABS(px) + FFABS(py); + else + sum = FFABS(px - C[0]) + FFABS(py - C[1]); + if(sum > 32) { + if(get_bits1(&s->gb)) { + px = A[0]; + py = A[1]; + } else { + px = C[0]; + py = C[1]; + } + } + } } + /* store MV using signed modulus of MV range defined in 4.11 */ + s->mv[0][0][0] = ((px + dmv_x[0] + r_x) & ((r_x << 1) - 1)) - r_x; + s->mv[0][0][1] = ((py + dmv_y[0] + r_y) & ((r_y << 1) - 1)) - r_y; } + if((mvtype == BMV_TYPE_BACKWARD) || (mvtype == BMV_TYPE_INTERPOLATED)) { + C = s->current_picture.motion_val[1][xy - 2]; + A = s->current_picture.motion_val[1][xy - wrap*2]; + off = (s->mb_x == (s->mb_width - 1)) ? -2 : 2; + B = s->current_picture.motion_val[1][xy - wrap*2 + off]; + + if(!s->first_slice_line) { // predictor A is not out of bounds + if(s->mb_width == 1) { + px = A[0]; + py = A[1]; + } else { + px = mid_pred(A[0], B[0], C[0]); + py = mid_pred(A[1], B[1], C[1]); + } + } else if(s->mb_x) { // predictor C is not out of bounds + px = C[0]; + py = C[1]; + } else { + px = py = 0; + } + /* Pullback MV as specified in 8.3.5.3.4 */ + { + int qx, qy, X, Y; + if(v->profile < PROFILE_ADVANCED) { + qx = (s->mb_x << 5); + qy = (s->mb_y << 5); + X = (s->mb_width << 5) - 4; + Y = (s->mb_height << 5) - 4; + if(qx + px < -28) px = -28 - qx; + if(qy + py < -28) py = -28 - qy; + if(qx + px > X) px = X - qx; + if(qy + py > Y) py = Y - qy; + } else { + qx = (s->mb_x << 6); + qy = (s->mb_y << 6); + X = (s->mb_width << 6) - 4; + Y = (s->mb_height << 6) - 4; + if(qx + px < -60) px = -60 - qx; + if(qy + py < -60) py = -60 - qy; + if(qx + px > X) px = X - qx; + if(qy + py > Y) py = Y - qy; + } + } + /* Calculate hybrid prediction as specified in 8.3.5.3.5 */ + if(0 && !s->first_slice_line && s->mb_x) { + if(is_intra[xy - wrap]) + sum = FFABS(px) + FFABS(py); + else + sum = FFABS(px - A[0]) + FFABS(py - A[1]); + if(sum > 32) { + if(get_bits1(&s->gb)) { + px = A[0]; + py = A[1]; + } else { + px = C[0]; + py = C[1]; + } + } else { + if(is_intra[xy - 2]) + sum = FFABS(px) + FFABS(py); + else + sum = FFABS(px - C[0]) + FFABS(py - C[1]); + if(sum > 32) { + if(get_bits1(&s->gb)) { + px = A[0]; + py = A[1]; + } else { + px = C[0]; + py = C[1]; + } + } + } + } + /* store MV using signed modulus of MV range defined in 4.11 */ - /* XXX: not right but how to determine 4-MV intra/inter in another frame? */ - mv_x = median4(mx[0], mx[1], mx[2], mx[3]); - mv_y = median4(my[0], my[1], my[2], my[3]); - s->mv[0][0][0] = mv_x; - s->mv[0][0][1] = mv_y; - - vc1_mc_1mv(v, (mode == BMV_TYPE_FORWARD)); + s->mv[1][0][0] = ((px + dmv_x[1] + r_x) & ((r_x << 1) - 1)) - r_x; + s->mv[1][0][1] = ((py + dmv_y[1] + r_y) & ((r_y << 1) - 1)) - r_y; + } + s->current_picture.motion_val[0][xy][0] = s->mv[0][0][0]; + s->current_picture.motion_val[0][xy][1] = s->mv[0][0][1]; + s->current_picture.motion_val[1][xy][0] = s->mv[1][0][0]; + s->current_picture.motion_val[1][xy][1] = s->mv[1][0][1]; } /** Get predicted DC value for I-frames only @@ -1833,7 +2524,6 @@ static inline int vc1_pred_dc(MpegEncContext *s, int overlap, int pq, int n, /** * @defgroup std_mb VC1 Macroblock-level functions in Simple/Main Profiles * @see 7.1.4, p91 and 8.1.1.7, p(1)04 - * @todo TODO: Integrate to MpegEncContext facilities * @{ */ @@ -1968,7 +2658,177 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded { if (v->pq == 1) dcdiff = (dcdiff<<2) + get_bits(gb, 2) - 3; - else if (v->pq == 2) + else if (v->pq == 2) + dcdiff = (dcdiff<<1) + get_bits(gb, 1) - 1; + } + if (get_bits(gb, 1)) + dcdiff = -dcdiff; + } + + /* Prediction */ + dcdiff += vc1_i_pred_dc(&v->s, v->overlap, v->pq, n, &dc_val, &dc_pred_dir); + *dc_val = dcdiff; + + /* Store the quantized DC coeff, used for prediction */ + if (n < 4) { + block[0] = dcdiff * s->y_dc_scale; + } else { + block[0] = dcdiff * s->c_dc_scale; + } + /* Skip ? */ + run_diff = 0; + i = 0; + if (!coded) { + goto not_coded; + } + + //AC Decoding + i = 1; + + { + int last = 0, skip, value; + const int8_t *zz_table; + int scale; + int k; + + scale = v->pq * 2 + v->halfpq; + + if(v->s.ac_pred) { + if(!dc_pred_dir) + zz_table = vc1_horizontal_zz; + else + zz_table = vc1_vertical_zz; + } else + zz_table = vc1_normal_zz; + + ac_val = s->ac_val[0][0] + s->block_index[n] * 16; + ac_val2 = ac_val; + if(dc_pred_dir) //left + ac_val -= 16; + else //top + ac_val -= 16 * s->block_wrap[n]; + + while (!last) { + vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); + i += skip; + if(i > 63) + break; + block[zz_table[i++]] = value; + } + + /* apply AC prediction if needed */ + if(s->ac_pred) { + if(dc_pred_dir) { //left + for(k = 1; k < 8; k++) + block[k << 3] += ac_val[k]; + } else { //top + for(k = 1; k < 8; k++) + block[k] += ac_val[k + 8]; + } + } + /* save AC coeffs for further prediction */ + for(k = 1; k < 8; k++) { + ac_val2[k] = block[k << 3]; + ac_val2[k + 8] = block[k]; + } + + /* scale AC coeffs */ + for(k = 1; k < 64; k++) + if(block[k]) { + block[k] *= scale; + if(!v->pquantizer) + block[k] += (block[k] < 0) ? -v->pq : v->pq; + } + + if(s->ac_pred) i = 63; + } + +not_coded: + if(!coded) { + int k, scale; + ac_val = s->ac_val[0][0] + s->block_index[n] * 16; + ac_val2 = ac_val; + + scale = v->pq * 2 + v->halfpq; + memset(ac_val2, 0, 16 * 2); + if(dc_pred_dir) {//left + ac_val -= 16; + if(s->ac_pred) + memcpy(ac_val2, ac_val, 8 * 2); + } else {//top + ac_val -= 16 * s->block_wrap[n]; + if(s->ac_pred) + memcpy(ac_val2 + 8, ac_val + 8, 8 * 2); + } + + /* apply AC prediction if needed */ + if(s->ac_pred) { + if(dc_pred_dir) { //left + for(k = 1; k < 8; k++) { + block[k << 3] = ac_val[k] * scale; + if(!v->pquantizer && block[k << 3]) + block[k << 3] += (block[k << 3] < 0) ? -v->pq : v->pq; + } + } else { //top + for(k = 1; k < 8; k++) { + block[k] = ac_val[k + 8] * scale; + if(!v->pquantizer && block[k]) + block[k] += (block[k] < 0) ? -v->pq : v->pq; + } + } + i = 63; + } + } + s->block_last_index[n] = i; + + return 0; +} + +/** Decode intra block in intra frames - should be faster than decode_intra_block + * @param v VC1Context + * @param block block to decode + * @param coded are AC coeffs present or not + * @param codingset set of VLC to decode data + */ +static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int coded, int codingset, int mquant) +{ + GetBitContext *gb = &v->s.gb; + MpegEncContext *s = &v->s; + int dc_pred_dir = 0; /* Direction of the DC prediction used */ + int run_diff, i; + int16_t *dc_val; + int16_t *ac_val, *ac_val2; + int dcdiff; + int a_avail = v->a_avail, c_avail = v->c_avail; + int use_pred = s->ac_pred; + int scale; + int q1, q2 = 0; + int mb_pos = s->mb_x + s->mb_y * s->mb_stride; + + /* Get DC differential */ + if (n < 4) { + dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); + } else { + dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); + } + if (dcdiff < 0){ + av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n"); + return -1; + } + if (dcdiff) + { + if (dcdiff == 119 /* ESC index value */) + { + /* TODO: Optimize */ + if (mquant == 1) dcdiff = get_bits(gb, 10); + else if (mquant == 2) dcdiff = get_bits(gb, 9); + else dcdiff = get_bits(gb, 8); + } + else + { + if (mquant == 1) + dcdiff = (dcdiff<<2) + get_bits(gb, 2) - 3; + else if (mquant == 2) dcdiff = (dcdiff<<1) + get_bits(gb, 1) - 1; } if (get_bits(gb, 1)) @@ -1976,7 +2836,7 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded } /* Prediction */ - dcdiff += vc1_i_pred_dc(&v->s, v->overlap, v->pq, n, &dc_val, &dc_pred_dir); + dcdiff += vc1_pred_dc(&v->s, v->overlap, mquant, n, v->a_avail, v->c_avail, &dc_val, &dc_pred_dir); *dc_val = dcdiff; /* Store the quantized DC coeff, used for prediction */ @@ -1988,21 +2848,34 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded /* Skip ? */ run_diff = 0; i = 0; - if (!coded) { - goto not_coded; - } //AC Decoding i = 1; - { + /* check if AC is needed at all and adjust direction if needed */ + if(!a_avail) dc_pred_dir = 1; + if(!c_avail) dc_pred_dir = 0; + if(!a_avail && !c_avail) use_pred = 0; + ac_val = s->ac_val[0][0] + s->block_index[n] * 16; + ac_val2 = ac_val; + + scale = mquant * 2 + v->halfpq; + + if(dc_pred_dir) //left + ac_val -= 16; + else //top + ac_val -= 16 * s->block_wrap[n]; + + q1 = s->current_picture.qscale_table[mb_pos]; + if(dc_pred_dir && c_avail) q2 = s->current_picture.qscale_table[mb_pos - 1]; + if(!dc_pred_dir && a_avail) q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride]; + if(n && n<4) q2 = q1; + + if(coded) { int last = 0, skip, value; const int8_t *zz_table; - int scale; int k; - scale = v->pq * 2 + v->halfpq; - if(v->s.ac_pred) { if(!dc_pred_dir) zz_table = vc1_horizontal_zz; @@ -2011,13 +2884,6 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded } else zz_table = vc1_normal_zz; - ac_val = s->ac_val[0][0] + s->block_index[n] * 16; - ac_val2 = ac_val; - if(dc_pred_dir) //left - ac_val -= 16; - else //top - ac_val -= 16 * s->block_wrap[n]; - while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); i += skip; @@ -2027,13 +2893,27 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded } /* apply AC prediction if needed */ - if(s->ac_pred) { - if(dc_pred_dir) { //left - for(k = 1; k < 8; k++) - block[k << 3] += ac_val[k]; - } else { //top - for(k = 1; k < 8; k++) - block[k] += ac_val[k + 8]; + if(use_pred) { + /* scale predictors if needed*/ + if(q2 && q1!=q2) { + q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; + q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; + + if(dc_pred_dir) { //left + for(k = 1; k < 8; k++) + block[k << 3] += (ac_val[k] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18; + } else { //top + for(k = 1; k < 8; k++) + block[k] += (ac_val[k + 8] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18; + } + } else { + if(dc_pred_dir) { //left + for(k = 1; k < 8; k++) + block[k << 3] += ac_val[k]; + } else { //top + for(k = 1; k < 8; k++) + block[k] += ac_val[k + 8]; + } } } /* save AC coeffs for further prediction */ @@ -2047,43 +2927,49 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded if(block[k]) { block[k] *= scale; if(!v->pquantizer) - block[k] += (block[k] < 0) ? -v->pq : v->pq; + block[k] += (block[k] < 0) ? -mquant : mquant; } - if(s->ac_pred) i = 63; - } - -not_coded: - if(!coded) { - int k, scale; - ac_val = s->ac_val[0][0] + s->block_index[n] * 16; - ac_val2 = ac_val; + if(use_pred) i = 63; + } else { // no AC coeffs + int k; - scale = v->pq * 2 + v->halfpq; memset(ac_val2, 0, 16 * 2); if(dc_pred_dir) {//left - ac_val -= 16; - if(s->ac_pred) + if(use_pred) { memcpy(ac_val2, ac_val, 8 * 2); + if(q2 && q1!=q2) { + q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; + q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; + for(k = 1; k < 8; k++) + ac_val2[k] = (ac_val2[k] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18; + } + } } else {//top - ac_val -= 16 * s->block_wrap[n]; - if(s->ac_pred) + if(use_pred) { memcpy(ac_val2 + 8, ac_val + 8, 8 * 2); + if(q2 && q1!=q2) { + q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; + q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; + for(k = 1; k < 8; k++) + ac_val2[k + 8] = (ac_val2[k + 8] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18; + } + } } /* apply AC prediction if needed */ - if(s->ac_pred) { + if(use_pred) { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) { - block[k << 3] = ac_val[k] * scale; + block[k << 3] = ac_val2[k] * scale; if(!v->pquantizer && block[k << 3]) - block[k << 3] += (block[k << 3] < 0) ? -v->pq : v->pq; + block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant; } } else { //top for(k = 1; k < 8; k++) { - block[k] = ac_val[k + 8] * scale; + block[k] = ac_val2[k + 8] * scale; if(!v->pquantizer && block[k]) - block[k] += (block[k] < 0) ? -v->pq : v->pq; + block[k] += (block[k] < 0) ? -mquant : mquant; } } i = 63; @@ -2209,8 +3095,8 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c if(use_pred) { /* scale predictors if needed*/ if(q2 && q1!=q2) { - q1 = q1 * 2 - 1; - q2 = q2 * 2 - 1; + q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; + q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; if(dc_pred_dir) { //left for(k = 1; k < 8; k++) @@ -2252,8 +3138,8 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c if(use_pred) { memcpy(ac_val2, ac_val, 8 * 2); if(q2 && q1!=q2) { - q1 = q1 * 2 - 1; - q2 = q2 * 2 - 1; + q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; + q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; for(k = 1; k < 8; k++) ac_val2[k] = (ac_val2[k] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18; } @@ -2262,8 +3148,8 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c if(use_pred) { memcpy(ac_val2 + 8, ac_val + 8, 8 * 2); if(q2 && q1!=q2) { - q1 = q1 * 2 - 1; - q2 = q2 * 2 - 1; + q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; + q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; for(k = 1; k < 8; k++) ac_val2[k + 8] = (ac_val2[k + 8] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18; } @@ -2372,7 +3258,10 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan i += skip; if(i > 31) break; - idx = vc1_simple_progressive_8x4_zz[i++]; + if(v->profile < PROFILE_ADVANCED) + idx = vc1_simple_progressive_8x4_zz[i++]; + else + idx = vc1_adv_progressive_8x4_zz[i++]; block[idx + off] = value * scale; if(!v->pquantizer) block[idx + off] += (block[idx + off] < 0) ? -mquant : mquant; @@ -2391,7 +3280,10 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan i += skip; if(i > 31) break; - idx = vc1_simple_progressive_4x8_zz[i++]; + if(v->profile < PROFILE_ADVANCED) + idx = vc1_simple_progressive_4x8_zz[i++]; + else + idx = vc1_adv_progressive_4x8_zz[i++]; block[idx + off] = value * scale; if(!v->pquantizer) block[idx + off] += (block[idx + off] < 0) ? -mquant : mquant; @@ -2406,8 +3298,6 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan /** Decode one P-frame MB (in Simple/Main profile) - * @todo TODO: Extend to AP - * @fixme FIXME: DC value for inter blocks not set */ static int vc1_decode_p_mb(VC1Context *v) { @@ -2449,6 +3339,10 @@ static int vc1_decode_p_mb(VC1Context *v) { GET_MVDATA(dmv_x, dmv_y); + if (s->mb_intra) { + s->current_picture.motion_val[1][s->block_index[0]][0] = 0; + s->current_picture.motion_val[1][s->block_index[0]][1] = 0; + } s->current_picture.mb_type[mb_pos] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16; vc1_pred_mv(s, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0]); @@ -2498,12 +3392,11 @@ static int vc1_decode_p_mb(VC1Context *v) if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; for(j = 0; j < 64; j++) s->block[i][j] += 128; s->dsp.put_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); - /* TODO: proper loop filtering */ if(v->pq >= 9 && v->overlap) { - if(v->a_avail) - s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2), (i<4) ? ((i&1)>>1) : (s->mb_y&1)); if(v->c_avail) - s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2), (i<4) ? (i&1) : (s->mb_x&1)); + s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); + if(v->a_avail) + s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); } } else if(val) { vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block); @@ -2602,12 +3495,11 @@ static int vc1_decode_p_mb(VC1Context *v) if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; for(j = 0; j < 64; j++) s->block[i][j] += 128; s->dsp.put_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize); - /* TODO: proper loop filtering */ if(v->pq >= 9 && v->overlap) { - if(v->a_avail) - s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2), (i<4) ? ((i&1)>>1) : (s->mb_y&1)); if(v->c_avail) - s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2), (i<4) ? (i&1) : (s->mb_x&1)); + s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); + if(v->a_avail) + s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); } } else if(is_coded[i]) { status = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block); @@ -2650,7 +3542,7 @@ static void vc1_decode_b_mb(VC1Context *v) GetBitContext *gb = &s->gb; int i, j; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; - int cbp; /* cbp decoding stuff */ + int cbp = 0; /* cbp decoding stuff */ int mqdiff, mquant; /* MB quantization */ int ttmb = v->ttfrm; /* MB Transform type */ @@ -2663,7 +3555,7 @@ static void vc1_decode_b_mb(VC1Context *v) int dst_idx, off; int skipped, direct; int dmv_x[2], dmv_y[2]; - int bmvtype = BMV_TYPE_BACKWARD; /* XXX: is it so? */ + int bmvtype = BMV_TYPE_BACKWARD; mquant = v->pq; /* Loosy initialization */ s->mb_intra = 0; @@ -2688,6 +3580,8 @@ static void vc1_decode_b_mb(VC1Context *v) if (!direct) { if (!skipped) { GET_MVDATA(dmv_x[0], dmv_y[0]); + dmv_x[1] = dmv_x[0]; + dmv_y[1] = dmv_y[0]; } if(skipped || !s->mb_intra) { bmvtype = decode012(gb); @@ -2700,24 +3594,34 @@ static void vc1_decode_b_mb(VC1Context *v) break; case 2: bmvtype = BMV_TYPE_INTERPOLATED; + dmv_x[0] = dmv_y[0] = 0; } } } + for(i = 0; i < 6; i++) + v->mb_type[0][s->block_index[i]] = s->mb_intra; if (skipped) { + if(direct) bmvtype = BMV_TYPE_INTERPOLATED; + vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); return; } if (direct) { cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); GET_MQUANT(); + s->mb_intra = 0; + mb_has_coeffs = 0; s->current_picture.qscale_table[mb_pos] = mquant; - if(!v->ttmbf && !s->mb_intra && mb_has_coeffs) + if(!v->ttmbf) ttmb = get_vlc2(gb, vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); + dmv_x[0] = dmv_y[0] = dmv_x[1] = dmv_y[1] = 0; + vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); } else { if(!mb_has_coeffs && !s->mb_intra) { /* no coded blocks - effectively skipped */ + vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); return; } @@ -2726,17 +3630,21 @@ static void vc1_decode_b_mb(VC1Context *v) s->current_picture.qscale_table[mb_pos] = mquant; s->ac_pred = get_bits1(gb); cbp = 0; + vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); } else { if(bmvtype == BMV_TYPE_INTERPOLATED) { - GET_MVDATA(dmv_x[1], dmv_y[1]); + GET_MVDATA(dmv_x[0], dmv_y[0]); if(!mb_has_coeffs) { /* interpolated skipped block */ + vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); return; } } - if(!s->mb_intra) + vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); + if(!s->mb_intra) { vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); + } if(s->mb_intra) s->ac_pred = get_bits1(gb); cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); @@ -2768,13 +3676,6 @@ static void vc1_decode_b_mb(VC1Context *v) if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; for(j = 0; j < 64; j++) s->block[i][j] += 128; s->dsp.put_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); - /* TODO: proper loop filtering */ - if(v->pq >= 9 && v->overlap) { - if(v->a_avail) - s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2), (i<4) ? ((i&1)>>1) : (s->mb_y&1)); - if(v->c_avail) - s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2), (i<4) ? (i&1) : (s->mb_x&1)); - } } else if(val) { vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block); if(!v->ttmbf && ttmb < 8) ttmb = -1; @@ -2837,6 +3738,8 @@ static void vc1_decode_i_blocks(VC1Context *v) mb_pos = s->mb_x + s->mb_y * s->mb_width; s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; s->current_picture.qscale_table[mb_pos] = v->pq; + s->current_picture.motion_val[1][s->block_index[0]][0] = 0; + s->current_picture.motion_val[1][s->block_index[0]][1] = 0; // do actual MB decoding and displaying cbp = get_vlc2(&v->s.gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2); @@ -2861,27 +3764,156 @@ static void vc1_decode_i_blocks(VC1Context *v) } vc1_put_block(v, s->block); - if(v->pq >= 9 && v->overlap) { /* XXX: do proper overlapping insted of loop filter */ + if(v->pq >= 9 && v->overlap) { + if(s->mb_x) { + s->dsp.vc1_h_overlap(s->dest[0], s->linesize); + s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); + if(!(s->flags & CODEC_FLAG_GRAY)) { + s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); + s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); + } + } + s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize); + s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); if(!s->first_slice_line) { - s->dsp.vc1_v_overlap(s->dest[0], s->linesize, 0); - s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize, 0); + s->dsp.vc1_v_overlap(s->dest[0], s->linesize); + s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); if(!(s->flags & CODEC_FLAG_GRAY)) { - s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize, s->mb_y&1); - s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize, s->mb_y&1); + s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); + s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); } } - s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize, 1); - s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize, 1); + s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize); + s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); + } + + if(get_bits_count(&s->gb) > v->bits) { + av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits); + return; + } + } + ff_draw_horiz_band(s, s->mb_y * 16, 16); + s->first_slice_line = 0; + } +} + +/** Decode blocks of I-frame for advanced profile + */ +static void vc1_decode_i_blocks_adv(VC1Context *v) +{ + int k, j; + MpegEncContext *s = &v->s; + int cbp, val; + uint8_t *coded_val; + int mb_pos; + int mquant = v->pq; + int mqdiff; + int overlap; + GetBitContext *gb = &s->gb; + + /* select codingmode used for VLC tables selection */ + switch(v->y_ac_table_index){ + case 0: + v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA; + break; + case 1: + v->codingset = CS_HIGH_MOT_INTRA; + break; + case 2: + v->codingset = CS_MID_RATE_INTRA; + break; + } + + switch(v->c_ac_table_index){ + case 0: + v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER; + break; + case 1: + v->codingset2 = CS_HIGH_MOT_INTER; + break; + case 2: + v->codingset2 = CS_MID_RATE_INTER; + break; + } + + //do frame decode + s->mb_x = s->mb_y = 0; + s->mb_intra = 1; + s->first_slice_line = 1; + ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END)); + for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { + for(s->mb_x = 0; s->mb_x < s->mb_width; s->mb_x++) { + ff_init_block_index(s); + ff_update_block_index(s); + s->dsp.clear_blocks(s->block[0]); + mb_pos = s->mb_x + s->mb_y * s->mb_stride; + s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; + s->current_picture.motion_val[1][s->block_index[0]][0] = 0; + s->current_picture.motion_val[1][s->block_index[0]][1] = 0; + + // do actual MB decoding and displaying + cbp = get_vlc2(&v->s.gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2); + if(v->acpred_is_raw) + v->s.ac_pred = get_bits(&v->s.gb, 1); + else + v->s.ac_pred = v->acpred_plane[mb_pos]; + + if(v->condover == CONDOVER_SELECT) { + if(v->overflg_is_raw) + overlap = get_bits(&v->s.gb, 1); + else + overlap = v->over_flags_plane[mb_pos]; + } else + overlap = (v->condover == CONDOVER_ALL); + + GET_MQUANT(); + + s->current_picture.qscale_table[mb_pos] = mquant; + /* Set DC scale - y and c use the same */ + s->y_dc_scale = s->y_dc_scale_table[mquant]; + s->c_dc_scale = s->c_dc_scale_table[mquant]; + + for(k = 0; k < 6; k++) { + val = ((cbp >> (5 - k)) & 1); + + if (k < 4) { + int pred = vc1_coded_block_pred(&v->s, k, &coded_val); + val = val ^ pred; + *coded_val = val; + } + cbp |= val << (5 - k); + + v->a_avail = !s->first_slice_line || (k==2 || k==3); + v->c_avail = !!s->mb_x || (k==1 || k==3); + + vc1_decode_i_block_adv(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2, mquant); + + s->dsp.vc1_inv_trans_8x8(s->block[k]); + for(j = 0; j < 64; j++) s->block[k][j] += 128; + } + + vc1_put_block(v, s->block); + if(overlap) { if(s->mb_x) { - s->dsp.vc1_h_overlap(s->dest[0], s->linesize, 0); - s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize, 0); + s->dsp.vc1_h_overlap(s->dest[0], s->linesize); + s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); + if(!(s->flags & CODEC_FLAG_GRAY)) { + s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); + s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); + } + } + s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize); + s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); + if(!s->first_slice_line) { + s->dsp.vc1_v_overlap(s->dest[0], s->linesize); + s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); if(!(s->flags & CODEC_FLAG_GRAY)) { - s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize, s->mb_x&1); - s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize, s->mb_x&1); + s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); + s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); } } - s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize, 1); - s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize, 1); + s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize); + s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); } if(get_bits_count(&s->gb) > v->bits) { @@ -2990,6 +4022,25 @@ static void vc1_decode_b_blocks(VC1Context *v) } } +static void vc1_decode_skip_blocks(VC1Context *v) +{ + MpegEncContext *s = &v->s; + + ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END)); + s->first_slice_line = 1; + for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { + s->mb_x = 0; + ff_init_block_index(s); + ff_update_block_index(s); + memcpy(s->dest[0], s->last_picture.data[0] + s->mb_y * 16 * s->linesize, s->linesize * 16); + memcpy(s->dest[1], s->last_picture.data[1] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8); + memcpy(s->dest[2], s->last_picture.data[2] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8); + ff_draw_horiz_band(s, s->mb_y * 16, 16); + s->first_slice_line = 0; + } + s->pict_type = P_TYPE; +} + static void vc1_decode_blocks(VC1Context *v) { @@ -2997,13 +4048,22 @@ static void vc1_decode_blocks(VC1Context *v) switch(v->s.pict_type) { case I_TYPE: - vc1_decode_i_blocks(v); + if(v->profile == PROFILE_ADVANCED) + vc1_decode_i_blocks_adv(v); + else + vc1_decode_i_blocks(v); break; case P_TYPE: - vc1_decode_p_blocks(v); + if(v->p_frame_skipped) + vc1_decode_skip_blocks(v); + else + vc1_decode_p_blocks(v); break; case B_TYPE: - vc1_decode_b_blocks(v); + if(v->bi_type) + vc1_decode_i_blocks(v); + else + vc1_decode_b_blocks(v); break; } } @@ -3058,8 +4118,48 @@ static int vc1_decode_init(AVCodecContext *avctx) { av_log(avctx, AV_LOG_INFO, "Read %i bits in overflow\n", -count); } + } else { // VC1/WVC1 + int edata_size = avctx->extradata_size; + uint8_t *edata = avctx->extradata; + + if(avctx->extradata_size < 16) { + av_log(avctx, AV_LOG_ERROR, "Extradata size too small: %i\n", edata_size); + return -1; + } + while(edata_size > 8) { + // test if we've found header + if(BE_32(edata) == 0x0000010F) { + edata += 4; + edata_size -= 4; + break; + } + edata_size--; + edata++; + } + + init_get_bits(&gb, edata, edata_size*8); + + if (decode_sequence_header(avctx, &gb) < 0) + return -1; + + while(edata_size > 8) { + // test if we've found entry point + if(BE_32(edata) == 0x0000010E) { + edata += 4; + edata_size -= 4; + break; + } + edata_size--; + edata++; + } + + init_get_bits(&gb, edata, edata_size*8); + + if (decode_entry_point(avctx, &gb) < 0) + return -1; } avctx->has_b_frames= !!(avctx->max_b_frames); + s->low_delay = !avctx->has_b_frames; s->mb_width = (avctx->coded_width+15)>>4; s->mb_height = (avctx->coded_height+15)>>4; @@ -3067,6 +4167,8 @@ static int vc1_decode_init(AVCodecContext *avctx) /* Allocate mb bitplanes */ v->mv_type_mb_plane = av_malloc(s->mb_stride * s->mb_height); v->direct_mb_plane = av_malloc(s->mb_stride * s->mb_height); + v->acpred_plane = av_malloc(s->mb_stride * s->mb_height); + v->over_flags_plane = av_malloc(s->mb_stride * s->mb_height); /* allocate block type info in that way so it could be used with s->block_index[] */ v->mb_type_base = av_malloc(s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2); @@ -3089,7 +4191,6 @@ static int vc1_decode_init(AVCodecContext *avctx) /** Decode a VC1/WMV3 frame * @todo TODO: Handle VC-1 IDUs (Transport level?) - * @warning Initial try at using MpegEncContext stuff */ static int vc1_decode_frame(AVCodecContext *avctx, void *data, int *data_size, @@ -3098,6 +4199,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; AVFrame *pict = data; + uint8_t *buf2 = NULL; /* no supplementary picture */ if (buf_size == 0) { @@ -3118,29 +4220,61 @@ static int vc1_decode_frame(AVCodecContext *avctx, s->current_picture_ptr= &s->picture[i]; } - avctx->has_b_frames= !s->low_delay; - - init_get_bits(&s->gb, buf, buf_size*8); + //for advanced profile we need to unescape buffer + if (avctx->codec_id == CODEC_ID_VC1) { + int i, buf_size2; + buf2 = av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); + buf_size2 = 0; + for(i = 0; i < buf_size; i++) { + if(buf[i] == 3 && i >= 2 && !buf[i-1] && !buf[i-2] && i < buf_size-1 && buf[i+1] < 4) { + buf2[buf_size2++] = buf[i+1]; + i++; + } else + buf2[buf_size2++] = buf[i]; + } + init_get_bits(&s->gb, buf2, buf_size2*8); + } else + init_get_bits(&s->gb, buf, buf_size*8); // do parse frame header - if(vc1_parse_frame_header(v, &s->gb) == -1) - return -1; + if(v->profile < PROFILE_ADVANCED) { + if(vc1_parse_frame_header(v, &s->gb) == -1) { + av_free(buf2); + return -1; + } + } else { + if(vc1_parse_frame_header_adv(v, &s->gb) == -1) { + av_free(buf2); + return -1; + } + } -// if(s->pict_type != I_TYPE && s->pict_type != P_TYPE)return -1; + if(s->pict_type != I_TYPE && !v->res_rtm_flag){ + av_free(buf2); + return -1; + } // for hurry_up==5 s->current_picture.pict_type= s->pict_type; s->current_picture.key_frame= s->pict_type == I_TYPE; /* skip B-frames if we don't have reference frames */ - if(s->last_picture_ptr==NULL && (s->pict_type==B_TYPE || s->dropable)) return -1;//buf_size; + if(s->last_picture_ptr==NULL && (s->pict_type==B_TYPE || s->dropable)){ + av_free(buf2); + return -1;//buf_size; + } /* skip b frames if we are in a hurry */ if(avctx->hurry_up && s->pict_type==B_TYPE) return -1;//buf_size; if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==B_TYPE) || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=I_TYPE) - || avctx->skip_frame >= AVDISCARD_ALL) + || avctx->skip_frame >= AVDISCARD_ALL) { + av_free(buf2); return buf_size; + } /* skip everything if we are in a hurry>=5 */ - if(avctx->hurry_up>=5) return -1;//buf_size; + if(avctx->hurry_up>=5) { + av_free(buf2); + return -1;//buf_size; + } if(s->next_p_frame_damaged){ if(s->pict_type==B_TYPE) @@ -3149,8 +4283,10 @@ static int vc1_decode_frame(AVCodecContext *avctx, s->next_p_frame_damaged=0; } - if(MPV_frame_start(s, avctx) < 0) + if(MPV_frame_start(s, avctx) < 0) { + av_free(buf2); return -1; + } ff_er_frame_start(s); @@ -3180,6 +4316,7 @@ assert(s->current_picture.pict_type == s->pict_type); /* we substract 1 because it is added on utils.c */ avctx->frame_number = s->picture_number - 1; + av_free(buf2); return buf_size; } @@ -3196,6 +4333,8 @@ static int vc1_decode_end(AVCodecContext *avctx) MPV_common_end(&v->s); av_freep(&v->mv_type_mb_plane); av_freep(&v->direct_mb_plane); + av_freep(&v->acpred_plane); + av_freep(&v->over_flags_plane); av_freep(&v->mb_type_base); return 0; } diff --git a/src/libffmpeg/libavcodec/vc1acdata.h b/src/libffmpeg/libavcodec/vc1acdata.h index ffcc39d64..a6acecd78 100644 --- a/src/libffmpeg/libavcodec/vc1acdata.h +++ b/src/libffmpeg/libavcodec/vc1acdata.h @@ -1,3 +1,24 @@ +/* + * VC-1 and WMV3 decoder + * copyright (c) 2006 Konstantin Shishkov + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #define AC_MODES 8 static const int vc1_ac_sizes[AC_MODES] = { diff --git a/src/libffmpeg/libavcodec/vc1data.h b/src/libffmpeg/libavcodec/vc1data.h index 9f9e21b4a..70e88b525 100644 --- a/src/libffmpeg/libavcodec/vc1data.h +++ b/src/libffmpeg/libavcodec/vc1data.h @@ -1,3 +1,25 @@ +/* + * VC-1 and WMV3 decoder + * copyright (c) 2006 Konstantin Shishkov + * (c) 2005 anonymous, Alex Beregszaszi, Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + /** * @file vc1data.h * VC-1 tables. @@ -6,6 +28,7 @@ #ifndef VC1DATA_H #define VC1DATA_H +#if 0 //original bfraction from vc9data.h, not conforming to standard /* Denominator used for vc1_bfraction_lut */ #define B_FRACTION_DEN 840 @@ -19,7 +42,23 @@ const int16_t vc1_bfraction_lut[23] = { 525 /*5/8*/, 735 /*7/8*/, -1 /*inv.*/, 0 /*BI fm*/ }; -const uint8_t vc1_bfraction_bits[23] = { +#else +/* Denominator used for vc1_bfraction_lut */ +#define B_FRACTION_DEN 256 + +/* pre-computed scales for all bfractions and base=256 */ +static const int16_t vc1_bfraction_lut[23] = { + 128 /*1/2*/, 85 /*1/3*/, 170 /*2/3*/, 64 /*1/4*/, + 192 /*3/4*/, 51 /*1/5*/, 102 /*2/5*/, + 153 /*3/5*/, 204 /*4/5*/, 43 /*1/6*/, 215 /*5/6*/, + 37 /*1/7*/, 74 /*2/7*/, 111 /*3/7*/, 148 /*4/7*/, + 185 /*5/7*/, 222 /*6/7*/, 32 /*1/8*/, 96 /*3/8*/, + 160 /*5/8*/, 224 /*7/8*/, + -1 /*inv.*/, 0 /*BI fm*/ +}; +#endif + +static const uint8_t vc1_bfraction_bits[23] = { 3, 3, 3, 3, 3, 3, 3, 7, 7, 7, 7, @@ -28,7 +67,7 @@ const uint8_t vc1_bfraction_bits[23] = { 7, 7, 7, 7 }; -const uint8_t vc1_bfraction_codes[23] = { +static const uint8_t vc1_bfraction_codes[23] = { 0, 1, 2, 3, 4, 5, 6, 112, 113, 114, 115, diff --git a/src/libffmpeg/libavcodec/vc1dsp.c b/src/libffmpeg/libavcodec/vc1dsp.c index 16fe31b90..9139ffb28 100644 --- a/src/libffmpeg/libavcodec/vc1dsp.c +++ b/src/libffmpeg/libavcodec/vc1dsp.c @@ -2,18 +2,20 @@ * VC-1 and WMV3 decoder - DSP functions * Copyright (c) 2006 Konstantin Shishkov * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -27,43 +29,53 @@ #include "dsputil.h" -/** Apply overlap transform to vertical edge +/** Apply overlap transform to horizontal edge */ -static void vc1_v_overlap_c(uint8_t* src, int stride, int rnd) +static void vc1_v_overlap_c(uint8_t* src, int stride) { int i; int a, b, c, d; + int d1, d2; + int rnd = 1; for(i = 0; i < 8; i++) { a = src[-2*stride]; b = src[-stride]; c = src[0]; d = src[stride]; + d1 = (a - d + 3 + rnd) >> 3; + d2 = (a - d + b - c + 4 - rnd) >> 3; - src[-2*stride] = clip_uint8((7*a + d + 4 - rnd) >> 3); - src[-stride] = clip_uint8((-a + 7*b + c + d + 3 + rnd) >> 3); - src[0] = clip_uint8((a + b + 7*c - d + 4 - rnd) >> 3); - src[stride] = clip_uint8((a + 7*d + 3 + rnd) >> 3); + src[-2*stride] = a - d1; + src[-stride] = b - d2; + src[0] = c + d2; + src[stride] = d + d1; src++; + rnd = !rnd; } } -/** Apply overlap transform to horizontal edge +/** Apply overlap transform to vertical edge */ -static void vc1_h_overlap_c(uint8_t* src, int stride, int rnd) +static void vc1_h_overlap_c(uint8_t* src, int stride) { int i; int a, b, c, d; + int d1, d2; + int rnd = 1; for(i = 0; i < 8; i++) { a = src[-2]; b = src[-1]; c = src[0]; d = src[1]; + d1 = (a - d + 3 + rnd) >> 3; + d2 = (a - d + b - c + 4 - rnd) >> 3; - src[-2] = clip_uint8((7*a + d + 4 - rnd) >> 3); - src[-1] = clip_uint8((-a + 7*b + c + d + 3 + rnd) >> 3); - src[0] = clip_uint8((a + b + 7*c - d + 4 - rnd) >> 3); - src[1] = clip_uint8((a + 7*d + 3 + rnd) >> 3); + src[-2] = a - d1; + src[-1] = b - d2; + src[0] = c + d2; + src[1] = d + d1; src += stride; + rnd = !rnd; } } diff --git a/src/libffmpeg/libavcodec/vcr1.c b/src/libffmpeg/libavcodec/vcr1.c index 6012752eb..62bf12320 100644 --- a/src/libffmpeg/libavcodec/vcr1.c +++ b/src/libffmpeg/libavcodec/vcr1.c @@ -2,18 +2,20 @@ * ATI VCR1 codec * Copyright (c) 2003 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/vmdav.c b/src/libffmpeg/libavcodec/vmdav.c index b850a09f9..a9937144e 100644 --- a/src/libffmpeg/libavcodec/vmdav.c +++ b/src/libffmpeg/libavcodec/vmdav.c @@ -2,18 +2,20 @@ * Sierra VMD Audio & Video Decoders * Copyright (C) 2004 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -92,7 +94,7 @@ static void lz_unpack(unsigned char *src, unsigned char *dest, int dest_len) d_end = d + dest_len; dataleft = LE_32(s); s += 4; - memset(queue, QUEUE_SIZE, 0x20); + memset(queue, 0x20, QUEUE_SIZE); if (LE_32(s) == 0x56781234) { s += 4; qpos = 0x111; @@ -482,10 +484,13 @@ static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, } else { if (s->bits == 16) vmdaudio_decode_audio(s, data, buf, 1); - else + else { /* copy the data but convert it to signed */ - for (i = 0; i < s->block_align; i++) - data[i * 2 + 1] = buf[i] + 0x80; + for (i = 0; i < s->block_align; i++){ + *data++ = buf[i] + 0x80; + *data++ = buf[i] + 0x80; + } + } } } else { bytes_decoded = s->block_align * 2; @@ -498,8 +503,10 @@ static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, vmdaudio_decode_audio(s, data, buf, 0); } else { /* copy the data but convert it to signed */ - for (i = 0; i < s->block_align; i++) - data[i * 2 + 1] = buf[i] + 0x80; + for (i = 0; i < s->block_align; i++){ + *data++ = buf[i] + 0x80; + *data++ = buf[i] + 0x80; + } } } } @@ -512,12 +519,10 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size) { VmdAudioContext *s = (VmdAudioContext *)avctx->priv_data; - unsigned int sound_flags; unsigned char *output_samples = (unsigned char *)data; /* point to the start of the encoded data */ unsigned char *p = buf + 16; - unsigned char *p_end = buf + buf_size; if (buf_size < 16) return buf_size; @@ -526,24 +531,10 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, /* the chunk contains audio */ *data_size = vmdaudio_loadsound(s, output_samples, p, 0); } else if (buf[6] == 2) { - /* the chunk contains audio and silence mixed together */ - sound_flags = LE_32(p); + /* the chunk may contain audio */ p += 4; - - /* do something with extrabufs here? */ - - while (p < p_end) { - if (sound_flags & 0x01) - /* silence */ - *data_size += vmdaudio_loadsound(s, output_samples, p, 1); - else { - /* audio */ - *data_size += vmdaudio_loadsound(s, output_samples, p, 0); - p += s->block_align; - } - output_samples += (s->block_align * s->bits / 8); - sound_flags >>= 1; - } + *data_size = vmdaudio_loadsound(s, output_samples, p, (buf_size == 16)); + output_samples += (s->block_align * s->bits / 8); } else if (buf[6] == 3) { /* silent chunk */ *data_size = vmdaudio_loadsound(s, output_samples, p, 1); diff --git a/src/libffmpeg/libavcodec/vorbis.c b/src/libffmpeg/libavcodec/vorbis.c index de3688c91..ca8d0a956 100644 --- a/src/libffmpeg/libavcodec/vorbis.c +++ b/src/libffmpeg/libavcodec/vorbis.c @@ -3,18 +3,20 @@ * Vorbis I decoder * @author Denes Balatoni ( dbalatoni programozo hu ) - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -43,25 +45,127 @@ #undef NDEBUG #include -/* Helper functions */ - -/** - * reads 0-32 bits when using the ALT_BITSTREAM_READER_LE bitstream reader - */ -static unsigned int get_bits_long_le(GetBitContext *s, int n){ - if(n<=17) return get_bits(s, n); - else{ - int ret= get_bits(s, 16); - return ret | (get_bits(s, n-16) << 16); - } -} +typedef struct { + uint_fast8_t dimensions; + uint_fast8_t lookup_type; + uint_fast8_t maxdepth; + VLC vlc; + float *codevectors; + unsigned int nb_bits; +} vorbis_codebook; + +typedef union vorbis_floor_u vorbis_floor_data; +typedef struct vorbis_floor0_s vorbis_floor0; +typedef struct vorbis_floor1_s vorbis_floor1; +struct vorbis_context_s; +typedef +uint_fast8_t (* vorbis_floor_decode_func) + (struct vorbis_context_s *, vorbis_floor_data *, float *); +typedef struct { + uint_fast8_t floor_type; + vorbis_floor_decode_func decode; + union vorbis_floor_u + { + struct vorbis_floor0_s + { + uint_fast8_t order; + uint_fast16_t rate; + uint_fast16_t bark_map_size; + int_fast32_t * map[2]; + uint_fast32_t map_size[2]; + uint_fast8_t amplitude_bits; + uint_fast8_t amplitude_offset; + uint_fast8_t num_books; + uint_fast8_t * book_list; + float * lsp; + } t0; + struct vorbis_floor1_s + { + uint_fast8_t partitions; + uint_fast8_t maximum_class; + uint_fast8_t partition_class[32]; + uint_fast8_t class_dimensions[16]; + uint_fast8_t class_subclasses[16]; + uint_fast8_t class_masterbook[16]; + int_fast16_t subclass_books[16][8]; + uint_fast8_t multiplier; + uint_fast16_t x_list_dim; + floor1_entry_t * list; + } t1; + } data; +} vorbis_floor; + +typedef struct { + uint_fast16_t type; + uint_fast32_t begin; + uint_fast32_t end; + uint_fast32_t partition_size; + uint_fast8_t classifications; + uint_fast8_t classbook; + int_fast16_t books[64][8]; + uint_fast8_t maxpass; +} vorbis_residue; + +typedef struct { + uint_fast8_t submaps; + uint_fast16_t coupling_steps; + uint_fast8_t *magnitude; + uint_fast8_t *angle; + uint_fast8_t *mux; + uint_fast8_t submap_floor[16]; + uint_fast8_t submap_residue[16]; +} vorbis_mapping; + +typedef struct { + uint_fast8_t blockflag; + uint_fast16_t windowtype; + uint_fast16_t transformtype; + uint_fast8_t mapping; +} vorbis_mode; + +typedef struct vorbis_context_s { + AVCodecContext *avccontext; + GetBitContext gb; + DSPContext dsp; + + MDCTContext mdct[2]; + uint_fast8_t first_frame; + uint_fast32_t version; + uint_fast8_t audio_channels; + uint_fast32_t audio_samplerate; + uint_fast32_t bitrate_maximum; + uint_fast32_t bitrate_nominal; + uint_fast32_t bitrate_minimum; + uint_fast32_t blocksize[2]; + const float * win[2]; + uint_fast16_t codebook_count; + vorbis_codebook *codebooks; + uint_fast8_t floor_count; + vorbis_floor *floors; + uint_fast8_t residue_count; + vorbis_residue *residues; + uint_fast8_t mapping_count; + vorbis_mapping *mappings; + uint_fast8_t mode_count; + vorbis_mode *modes; + uint_fast8_t mode_number; // mode number for the current packet + float *channel_residues; + float *channel_floors; + float *saved; + uint_fast16_t saved_start; + float *ret; + float *buf; + float *buf_tmp; + uint_fast32_t add_bias; // for float->int conversion + uint_fast32_t exp_bias; +} vorbis_context; -#define ilog(i) av_log2(2*(i)) +/* Helper functions */ #define BARK(x) \ (13.1f*atan(0.00074f*(x))+2.24f*atan(1.85e-8f*(x)*(x))+1e-4f*(x)) -static unsigned int nth_root(unsigned int x, unsigned int n) { // x^(1/n) +unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n) { // x^(1/n) unsigned int ret=0, i, j; do { @@ -82,7 +186,7 @@ static float vorbisfloat2float(uint_fast32_t val) { // Generate vlc codes from vorbis huffman code lengths -static int vorbis_len2vlc(vorbis_context *vc, uint_fast8_t *bits, uint_fast32_t *codes, uint_fast32_t num) { +int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, uint_fast32_t num) { uint_fast32_t exit_at_level[33]={404,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,0,0}; @@ -105,12 +209,12 @@ static int vorbis_len2vlc(vorbis_context *vc, uint_fast8_t *bits, uint_fast32_t } #ifdef V_DEBUG - av_log(vc->avccontext, AV_LOG_INFO, " %d. of %d code len %d code %d - ", p, num, bits[p], codes[p]); + av_log(NULL, AV_LOG_INFO, " %d. of %d code len %d code %d - ", p, num, bits[p], codes[p]); init_get_bits(&gb, (uint_fast8_t *)&codes[p], bits[p]); for(i=0;iavccontext, AV_LOG_INFO, "%s", get_bits1(&gb) ? "1" : "0"); + av_log(NULL, AV_LOG_INFO, "%s", get_bits1(&gb) ? "1" : "0"); } - av_log(vc->avccontext, AV_LOG_INFO, "\n"); + av_log(NULL, AV_LOG_INFO, "\n"); #endif ++p; @@ -131,21 +235,53 @@ static int vorbis_len2vlc(vorbis_context *vc, uint_fast8_t *bits, uint_fast32_t codes[p]=code; #ifdef V_DEBUG - av_log(vc->avccontext, AV_LOG_INFO, " %d. code len %d code %d - ", p, bits[p], codes[p]); + av_log(NULL, AV_LOG_INFO, " %d. code len %d code %d - ", p, bits[p], codes[p]); init_get_bits(&gb, (uint_fast8_t *)&codes[p], bits[p]); for(i=0;iavccontext, AV_LOG_INFO, "%s", get_bits1(&gb) ? "1" : "0"); + av_log(NULL, AV_LOG_INFO, "%s", get_bits1(&gb) ? "1" : "0"); } - av_log(vc->avccontext, AV_LOG_INFO, "\n"); + av_log(NULL, AV_LOG_INFO, "\n"); #endif } - //FIXME no exits should be left (underspecified tree - ie. unused valid vlcs - not allowed by SPEC) + //no exits should be left (underspecified tree - ie. unused valid vlcs - not allowed by SPEC) + for (p=1; p<33; p++) + if (exit_at_level[p]) return 1; return 0; } +void ff_vorbis_ready_floor1_list(floor1_entry_t * list, int values) { + int i; + list[0].sort = 0; + list[1].sort = 1; + for (i = 2; i < values; i++) { + int j; + list[i].low = 0; + list[i].high = 1; + list[i].sort = i; + for (j = 2; j < i; j++) { + int tmp = list[j].x; + if (tmp < list[i].x) { + if (tmp > list[list[i].low].x) list[i].low = j; + } else { + if (tmp < list[list[i].high].x) list[i].high = j; + } + } + } + for (i = 0; i < values - 1; i++) { + int j; + for (j = i + 1; j < values; j++) { + if (list[list[i].sort].x > list[list[j].sort].x) { + int tmp = list[i].sort; + list[i].sort = list[j].sort; + list[j].sort = tmp; + } + } + } +} + // Free all allocated memory ----------------------------------------- static void vorbis_free(vorbis_context *vc) { @@ -161,8 +297,8 @@ static void vorbis_free(vorbis_context *vc) { av_freep(&vc->residues); av_freep(&vc->modes); - ff_mdct_end(&vc->mdct0); - ff_mdct_end(&vc->mdct1); + ff_mdct_end(&vc->mdct[0]); + ff_mdct_end(&vc->mdct[1]); for(i=0;icodebook_count;++i) { av_free(vc->codebooks[i].codevectors); @@ -178,10 +314,7 @@ static void vorbis_free(vorbis_context *vc) { av_free(vc->floors[i].data.t0.lsp); } else { - av_free(vc->floors[i].data.t1.x_list); - av_free(vc->floors[i].data.t1.x_list_order); - av_free(vc->floors[i].data.t1.low_neighbour); - av_free(vc->floors[i].data.t1.high_neighbour); + av_free(vc->floors[i].data.t1.list); } } av_freep(&vc->floors); @@ -192,6 +325,11 @@ static void vorbis_free(vorbis_context *vc) { av_free(vc->mappings[i].mux); } av_freep(&vc->mappings); + + if(vc->exp_bias){ + av_freep(&vc->win[0]); + av_freep(&vc->win[1]); + } } // Parse setup header ------------------------------------------------- @@ -200,8 +338,8 @@ static void vorbis_free(vorbis_context *vc) { static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) { uint_fast16_t cb; - uint_fast8_t *tmp_vlc_bits; - uint_fast32_t *tmp_vlc_codes; + uint8_t *tmp_vlc_bits; + uint32_t *tmp_vlc_codes; GetBitContext *gb=&vc->gb; vc->codebook_count=get_bits(gb,8)+1; @@ -209,8 +347,8 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) { AV_DEBUG(" Codebooks: %d \n", vc->codebook_count); vc->codebooks=(vorbis_codebook *)av_mallocz(vc->codebook_count * sizeof(vorbis_codebook)); - tmp_vlc_bits=(uint_fast8_t *)av_mallocz(V_MAX_VLCS * sizeof(uint_fast8_t)); - tmp_vlc_codes=(uint_fast32_t *)av_mallocz(V_MAX_VLCS * sizeof(uint_fast32_t)); + tmp_vlc_bits=(uint8_t *)av_mallocz(V_MAX_VLCS * sizeof(uint8_t)); + tmp_vlc_codes=(uint32_t *)av_mallocz(V_MAX_VLCS * sizeof(uint32_t)); for(cb=0;cbcodebook_count;++cb) { vorbis_codebook *codebook_setup=&vc->codebooks[cb]; @@ -303,11 +441,11 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) { if (codebook_setup->lookup_type==1) { uint_fast16_t i, j, k; - uint_fast16_t codebook_lookup_values=nth_root(entries, codebook_setup->dimensions); + uint_fast16_t codebook_lookup_values=ff_vorbis_nth_root(entries, codebook_setup->dimensions); uint_fast16_t codebook_multiplicands[codebook_lookup_values]; - float codebook_minimum_value=vorbisfloat2float(get_bits_long_le(gb, 32)); - float codebook_delta_value=vorbisfloat2float(get_bits_long_le(gb, 32)); + float codebook_minimum_value=vorbisfloat2float(get_bits_long(gb, 32)); + float codebook_delta_value=vorbisfloat2float(get_bits_long(gb, 32)); uint_fast8_t codebook_value_bits=get_bits(gb, 4)+1; uint_fast8_t codebook_sequence_p=get_bits1(gb); @@ -367,7 +505,7 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) { } // Initialize VLC table - if (vorbis_len2vlc(vc, tmp_vlc_bits, tmp_vlc_codes, entries)) { + if (ff_vorbis_len2vlc(tmp_vlc_bits, tmp_vlc_codes, entries)) { av_log(vc->avccontext, AV_LOG_ERROR, " Invalid code lengths while generating vlcs. \n"); goto error; } @@ -488,57 +626,23 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) { floor_setup->data.t1.x_list_dim+=floor_setup->data.t1.class_dimensions[floor_setup->data.t1.partition_class[j]]; } - floor_setup->data.t1.x_list=(uint_fast16_t *)av_mallocz(floor_setup->data.t1.x_list_dim * sizeof(uint_fast16_t)); - floor_setup->data.t1.x_list_order=(uint_fast16_t *)av_mallocz(floor_setup->data.t1.x_list_dim * sizeof(uint_fast16_t)); - floor_setup->data.t1.low_neighbour=(uint_fast16_t *)av_mallocz(floor_setup->data.t1.x_list_dim * sizeof(uint_fast16_t)); - floor_setup->data.t1.high_neighbour=(uint_fast16_t *)av_mallocz(floor_setup->data.t1.x_list_dim * sizeof(uint_fast16_t)); + floor_setup->data.t1.list=(floor1_entry_t *)av_mallocz(floor_setup->data.t1.x_list_dim * sizeof(floor1_entry_t)); rangebits=get_bits(gb, 4); - floor_setup->data.t1.x_list[0] = 0; - floor_setup->data.t1.x_list[1] = (1<data.t1.list[0].x = 0; + floor_setup->data.t1.list[1].x = (1<data.t1.partitions;++j) { for(k=0;kdata.t1.class_dimensions[floor_setup->data.t1.partition_class[j]];++k,++floor1_values) { - floor_setup->data.t1.x_list[floor1_values]=get_bits(gb, rangebits); + floor_setup->data.t1.list[floor1_values].x=get_bits(gb, rangebits); - AV_DEBUG(" %d. floor1 Y coord. %d \n", floor1_values, floor_setup->data.t1.x_list[floor1_values]); + AV_DEBUG(" %d. floor1 Y coord. %d \n", floor1_values, floor_setup->data.t1.list[floor1_values].x); } } // Precalculate order of x coordinates - needed for decode - - for(k=0;kdata.t1.x_list_dim;++k) { - floor_setup->data.t1.x_list_order[k]=k; - } - - for(k=0;kdata.t1.x_list_dim-1;++k) { // FIXME optimize sorting ? - for(j=k+1;jdata.t1.x_list_dim;++j) { - if(floor_setup->data.t1.x_list[floor_setup->data.t1.x_list_order[k]]>floor_setup->data.t1.x_list[floor_setup->data.t1.x_list_order[j]]) { - uint_fast16_t tmp=floor_setup->data.t1.x_list_order[k]; - floor_setup->data.t1.x_list_order[k]=floor_setup->data.t1.x_list_order[j]; - floor_setup->data.t1.x_list_order[j]=tmp; - } - } - } - -// Precalculate low and high neighbours - - for(k=2;kdata.t1.x_list_dim;++k) { - floor_setup->data.t1.low_neighbour[k]=0; - floor_setup->data.t1.high_neighbour[k]=1; // correct according to SPEC requirements - - for (j=0;jdata.t1.x_list[j]data.t1.x_list[k]) && - (floor_setup->data.t1.x_list[j]>floor_setup->data.t1.x_list[floor_setup->data.t1.low_neighbour[k]])) { - floor_setup->data.t1.low_neighbour[k]=j; - } - if ((floor_setup->data.t1.x_list[j]>floor_setup->data.t1.x_list[k]) && - (floor_setup->data.t1.x_list[j]data.t1.x_list[floor_setup->data.t1.high_neighbour[k]])) { - floor_setup->data.t1.high_neighbour[k]=j; - } - } - } + ff_vorbis_ready_floor1_list(floor_setup->data.t1.list, floor_setup->data.t1.x_list_dim); } else if(floor_setup->floor_type==0) { uint_fast8_t max_codebook_dim=0; @@ -757,7 +861,7 @@ static void create_map( vorbis_context * vc, uint_fast8_t floor_number ) for (blockflag=0;blockflag<2;++blockflag) { - n=(blockflag ? vc->blocksize_1 : vc->blocksize_0) / 2; + n=vc->blocksize[blockflag]/2; floors[floor_number].data.t0.map[blockflag]= av_malloc((n+1) * sizeof(int_fast32_t)); // n+sentinel @@ -855,7 +959,6 @@ static int vorbis_parse_setup_hdr(vorbis_context *vc) { static int vorbis_parse_id_hdr(vorbis_context *vc){ GetBitContext *gb=&vc->gb; uint_fast8_t bl0, bl1; - const float *vwin[8]={ vwin64, vwin128, vwin256, vwin512, vwin1024, vwin2048, vwin4096, vwin8192 }; if ((get_bits(gb, 8)!='v') || (get_bits(gb, 8)!='o') || (get_bits(gb, 8)!='r') || (get_bits(gb, 8)!='b') || @@ -864,53 +967,63 @@ static int vorbis_parse_id_hdr(vorbis_context *vc){ return 1; } - vc->version=get_bits_long_le(gb, 32); //FIXME check 0 + vc->version=get_bits_long(gb, 32); //FIXME check 0 vc->audio_channels=get_bits(gb, 8); //FIXME check >0 - vc->audio_samplerate=get_bits_long_le(gb, 32); //FIXME check >0 - vc->bitrate_maximum=get_bits_long_le(gb, 32); - vc->bitrate_nominal=get_bits_long_le(gb, 32); - vc->bitrate_minimum=get_bits_long_le(gb, 32); + vc->audio_samplerate=get_bits_long(gb, 32); //FIXME check >0 + vc->bitrate_maximum=get_bits_long(gb, 32); + vc->bitrate_nominal=get_bits_long(gb, 32); + vc->bitrate_minimum=get_bits_long(gb, 32); bl0=get_bits(gb, 4); bl1=get_bits(gb, 4); - vc->blocksize_0=(1<blocksize_1=(1<blocksize[0]=(1<blocksize[1]=(1<13 || bl0<6 || bl1>13 || bl1<6 || bl1avccontext, AV_LOG_ERROR, " Vorbis id header packet corrupt (illegal blocksize). \n"); return 3; } // output format int16 - if (vc->blocksize_1/2 * vc->audio_channels * 2 > + if (vc->blocksize[1]/2 * vc->audio_channels * 2 > AVCODEC_MAX_AUDIO_FRAME_SIZE) { av_log(vc->avccontext, AV_LOG_ERROR, "Vorbis channel count makes " "output packets too large.\n"); return 4; } - vc->swin=vwin[bl0-6]; - vc->lwin=vwin[bl1-6]; + vc->win[0]=ff_vorbis_vwin[bl0-6]; + vc->win[1]=ff_vorbis_vwin[bl1-6]; + + if(vc->exp_bias){ + int i, j; + for(j=0; j<2; j++){ + float *win = av_malloc(vc->blocksize[j]/2 * sizeof(float)); + for(i=0; iblocksize[j]/2; i++) + win[i] = vc->win[j][i] * (1<<15); + vc->win[j] = win; + } + } if ((get_bits1(gb)) == 0) { av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis id header packet corrupt (framing flag not set). \n"); return 2; } - vc->channel_residues=(float *)av_malloc((vc->blocksize_1/2)*vc->audio_channels * sizeof(float)); - vc->channel_floors=(float *)av_malloc((vc->blocksize_1/2)*vc->audio_channels * sizeof(float)); - vc->saved=(float *)av_malloc((vc->blocksize_1/2)*vc->audio_channels * sizeof(float)); - vc->ret=(float *)av_malloc((vc->blocksize_1/2)*vc->audio_channels * sizeof(float)); - vc->buf=(float *)av_malloc(vc->blocksize_1 * sizeof(float)); - vc->buf_tmp=(float *)av_malloc(vc->blocksize_1 * sizeof(float)); + vc->channel_residues=(float *)av_malloc((vc->blocksize[1]/2)*vc->audio_channels * sizeof(float)); + vc->channel_floors=(float *)av_malloc((vc->blocksize[1]/2)*vc->audio_channels * sizeof(float)); + vc->saved=(float *)av_malloc((vc->blocksize[1]/2)*vc->audio_channels * sizeof(float)); + vc->ret=(float *)av_malloc((vc->blocksize[1]/2)*vc->audio_channels * sizeof(float)); + vc->buf=(float *)av_malloc(vc->blocksize[1] * sizeof(float)); + vc->buf_tmp=(float *)av_malloc(vc->blocksize[1] * sizeof(float)); vc->saved_start=0; - ff_mdct_init(&vc->mdct0, bl0, 1); - ff_mdct_init(&vc->mdct1, bl1, 1); + ff_mdct_init(&vc->mdct[0], bl0, 1); + ff_mdct_init(&vc->mdct[1], bl1, 1); AV_DEBUG(" vorbis version %d \n audio_channels %d \n audio_samplerate %d \n bitrate_max %d \n bitrate_nom %d \n bitrate_min %d \n blk_0 %d blk_1 %d \n ", - vc->version, vc->audio_channels, vc->audio_samplerate, vc->bitrate_maximum, vc->bitrate_nominal, vc->bitrate_minimum, vc->blocksize_0, vc->blocksize_1); + vc->version, vc->audio_channels, vc->audio_samplerate, vc->bitrate_maximum, vc->bitrate_nominal, vc->bitrate_minimum, vc->blocksize[0], vc->blocksize[1]); /* - BLK=vc->blocksize_0; + BLK=vc->blocksize[0]; for(i=0;iswin[i]=sin(0.5*3.14159265358*(sin(((float)i+0.5)/(float)BLK*3.14159265358))*(sin(((float)i+0.5)/(float)BLK*3.14159265358))); + vc->win[0][i]=sin(0.5*3.14159265358*(sin(((float)i+0.5)/(float)BLK*3.14159265358))*(sin(((float)i+0.5)/(float)BLK*3.14159265358))); } */ @@ -929,6 +1042,15 @@ static int vorbis_decode_init(AVCodecContext *avccontext) { int i, j, hdr_type; vc->avccontext = avccontext; + dsputil_init(&vc->dsp, avccontext); + + if(vc->dsp.float_to_int16 == ff_float_to_int16_c) { + vc->add_bias = 385; + vc->exp_bias = 0; + } else { + vc->add_bias = 0; + vc->exp_bias = 15<<23; + } if (!headers_len) { av_log(avccontext, AV_LOG_ERROR, "Extradata corrupt.\n"); @@ -1110,6 +1232,50 @@ static uint_fast8_t vorbis_floor0_decode(vorbis_context *vc, return 0; } + +static void render_line(int x0, int y0, int x1, int y1, float * buf, int n) { + int dy = y1 - y0; + int adx = x1 - x0; + int ady = FFABS(dy); + int base = dy / adx; + int x = x0; + int y = y0; + int err = 0; + int sy; + if (dy < 0) sy = base - 1; + else sy = base + 1; + ady = ady - FFABS(base) * adx; + if (x >= n) return; + buf[x] = ff_vorbis_floor1_inverse_db_table[y]; + for (x = x0 + 1; x < x1; x++) { + if (x >= n) return; + err += ady; + if (err >= adx) { + err -= adx; + y += sy; + } else { + y += base; + } + buf[x] = ff_vorbis_floor1_inverse_db_table[y]; + } +} + +void ff_vorbis_floor1_render_list(floor1_entry_t * list, int values, uint_fast16_t * y_list, int * flag, int multiplier, float * out, int samples) { + int lx, ly, i; + lx = 0; + ly = y_list[0] * multiplier; + for (i = 1; i < values; i++) { + int pos = list[i].sort; + if (flag[pos]) { + render_line(lx, ly, list[pos].x, y_list[pos] * multiplier, out, samples); + lx = list[pos].x; + ly = y_list[pos] * multiplier; + } + if (lx >= samples) break; + } + if (lx < samples) render_line(lx, ly, samples, ly, out, samples); +} + static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor_data *vfu, float *vec) { vorbis_floor1 * vf=&vfu->t1; GetBitContext *gb=&vc->gb; @@ -1117,7 +1283,7 @@ static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor_data * uint_fast16_t range=range_v[vf->multiplier-1]; uint_fast16_t floor1_Y[vf->x_list_dim]; uint_fast16_t floor1_Y_final[vf->x_list_dim]; - uint_fast8_t floor1_flag[vf->x_list_dim]; + int floor1_flag[vf->x_list_dim]; uint_fast8_t class_; uint_fast8_t cdim; uint_fast8_t cbits; @@ -1126,10 +1292,8 @@ static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor_data * int_fast16_t book; uint_fast16_t offset; uint_fast16_t i,j; - uint_fast16_t *floor_x_sort=vf->x_list_order; /*u*/int_fast16_t adx, ady, off, predicted; // WTF ? dy/adx= (unsigned)dy/adx ? int_fast16_t dy, err; - uint_fast16_t lx,hx, ly, hy=0; if (!get_bits1(gb)) return 1; // silence @@ -1162,14 +1326,14 @@ static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor_data * AV_DEBUG("book %d Cbits %d cval %d bits:%d \n", book, cbits, cval, get_bits_count(gb)); cval=cval>>cbits; - if (book>0) { + if (book>-1) { floor1_Y[offset+j]=get_vlc2(gb, vc->codebooks[book].vlc.table, vc->codebooks[book].nb_bits, 3); } else { floor1_Y[offset+j]=0; } - AV_DEBUG(" floor(%d) = %d \n", vf->x_list[offset+j], floor1_Y[offset+j]); + AV_DEBUG(" floor(%d) = %d \n", vf->list[offset+j].x, floor1_Y[offset+j]); } offset+=cdim; } @@ -1186,13 +1350,13 @@ static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor_data * uint_fast16_t high_neigh_offs; uint_fast16_t low_neigh_offs; - low_neigh_offs=vf->low_neighbour[i]; - high_neigh_offs=vf->high_neighbour[i]; + low_neigh_offs=vf->list[i].low; + high_neigh_offs=vf->list[i].high; dy=floor1_Y_final[high_neigh_offs]-floor1_Y_final[low_neigh_offs]; // render_point begin - adx=vf->x_list[high_neigh_offs]-vf->x_list[low_neigh_offs]; - ady= ABS(dy); - err=ady*(vf->x_list[i]-vf->x_list[low_neigh_offs]); - off=err/adx; + adx=vf->list[high_neigh_offs].x-vf->list[low_neigh_offs].x; + ady= FFABS(dy); + err=ady*(vf->list[i].x-vf->list[low_neigh_offs].x); + off=(int16_t)err/(int16_t)adx; if (dy<0) { predicted=floor1_Y_final[low_neigh_offs]-off; } else { @@ -1229,85 +1393,12 @@ static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor_data * floor1_Y_final[i]=predicted; } - AV_DEBUG(" Decoded floor(%d) = %d / val %d \n", vf->x_list[i], floor1_Y_final[i], val); + AV_DEBUG(" Decoded floor(%d) = %d / val %d \n", vf->list[i].x, floor1_Y_final[i], val); } // Curve synth - connect the calculated dots and convert from dB scale FIXME optimize ? - hx=0; - lx=0; - ly=floor1_Y_final[0]*vf->multiplier; // conforms to SPEC - - vec[0]=floor1_inverse_db_table[ly]; - - for(i=1;ix_list_dim;++i) { - AV_DEBUG(" Looking at post %d \n", i); - - if (floor1_flag[floor_x_sort[i]]) { // SPEC mispelled - int_fast16_t x, y, dy, base, sy; // if uncommented: dy = -32 adx = 2 base = 2blablabla ????? - - hy=floor1_Y_final[floor_x_sort[i]]*vf->multiplier; - hx=vf->x_list[floor_x_sort[i]]; - - dy=hy-ly; - adx=hx-lx; - ady= (dy<0) ? -dy:dy;//ABS(dy); - base=dy/adx; - - AV_DEBUG(" dy %d adx %d base %d = %d \n", dy, adx, base, dy/adx); - - x=lx; - y=ly; - err=0; - if (dy<0) { - sy=base-1; - } else { - sy=base+1; - } - ady=ady-(base<0 ? -base : base)*adx; - vec[x]=floor1_inverse_db_table[y]; - - AV_DEBUG(" vec[ %d ] = %d \n", x, y); - - for(x=lx+1;(xx_list[1]);++x) { - err+=ady; - if (err>=adx) { - err-=adx; - y+=sy; - } else { - y+=base; - } - vec[x]=floor1_inverse_db_table[y]; - - AV_DEBUG(" vec[ %d ] = %d \n", x, y); - } - -/* for(j=1;jx_list[1]) { - vec[lx+j]=floor1_inverse_db_table[predicted]; - } - }*/ - - lx=hx; - ly=hy; - } - } - - if (hxx_list[1]) { - for(i=hx;ix_list[1];++i) { - vec[i]=floor1_inverse_db_table[hy]; - } - } + ff_vorbis_floor1_render_list(vf->list, vf->x_list_dim, floor1_Y_final, floor1_flag, vf->multiplier, vec, vf->list[1].x); AV_DEBUG(" Floor decoded\n"); @@ -1347,6 +1438,7 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa voffset=vr->begin; for(partition_count=0;partition_countclassifications]; for(j_times_ptns_to_read=0, j=0;jcodebooks[vr->classbook].vlc.table, @@ -1358,7 +1450,7 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa for(i=0;iclassifications])>>32; + temp2=(((uint_fast64_t)temp) * inverse_class)>>32; if (partition_count+c_p_c-1-i < ptns_to_read) { classifs[j_times_ptns_to_read+partition_count+c_p_c-1-i]=temp-temp2*vr->classifications; } @@ -1378,15 +1470,17 @@ static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fa if (vqbook>=0) { uint_fast16_t coffs; - uint_fast16_t step=vr->partition_size/vc->codebooks[vqbook].dimensions; + unsigned dim= vc->codebooks[vqbook].dimensions; // not uint_fast8_t: 64bit is slower here on amd64 + uint_fast16_t step= dim==1 ? vr->partition_size + : FASTDIV(vr->partition_size, dim); vorbis_codebook codebook= vc->codebooks[vqbook]; if (vr->type==0) { voffs=voffset+j*vlen; for(k=0;ktype==1) { voffs=voffset+j*vlen; for(k=0;ktype==2 && ch==2 && (voffset&1)==0 && (codebook.dimensions&1)==0) { // most frequent case optimized + else if (vr->type==2 && ch==2 && (voffset&1)==0 && (dim&1)==0) { // most frequent case optimized voffs=voffset>>1; + if(dim==2) { + for(k=0;k0.0) { + if (ang[i]>0.0) { + ang[i]=mag[i]-ang[i]; + } else { + float temp=ang[i]; + ang[i]=mag[i]; + mag[i]+=temp; + } + } else { + if (ang[i]>0.0) { + ang[i]+=mag[i]; + } else { + float temp=ang[i]; + ang[i]=mag[i]; + mag[i]-=temp; + } + } + } +} + // Decode the audio packet using the functions above -#define BIAS 385 static int vorbis_parse_audio_packet(vorbis_context *vc) { GetBitContext *gb=&vc->gb; @@ -1462,6 +1587,7 @@ static int vorbis_parse_audio_packet(vorbis_context *vc) { uint_fast8_t res_num=0; int_fast16_t retlen=0; uint_fast16_t saved_start=0; + float fadd_bias = vc->add_bias; if (get_bits1(gb)) { av_log(vc->avccontext, AV_LOG_ERROR, "Not a Vorbis I audio packet.\n"); @@ -1483,7 +1609,7 @@ static int vorbis_parse_audio_packet(vorbis_context *vc) { next_window=get_bits1(gb); } - blocksize=vc->modes[mode_number].blockflag ? vc->blocksize_1 : vc->blocksize_0; + blocksize=vc->blocksize[vc->modes[mode_number].blockflag]; memset(ch_res_ptr, 0, sizeof(float)*vc->audio_channels*blocksize/2); //FIXME can this be removed ? memset(ch_floor_ptr, 0, sizeof(float)*vc->audio_channels*blocksize/2); //FIXME can this be removed ? @@ -1541,36 +1667,14 @@ static int vorbis_parse_audio_packet(vorbis_context *vc) { mag=vc->channel_residues+res_chan[mapping->magnitude[i]]*blocksize/2; ang=vc->channel_residues+res_chan[mapping->angle[i]]*blocksize/2; - for(j=0;j0.0) { - if (ang[j]>0.0) { - ang[j]=mag[j]-ang[j]; - } else { - temp=ang[j]; - ang[j]=mag[j]; - mag[j]+=temp; - } - } else { - if (ang[j]>0.0) { - ang[j]+=mag[j]; - } else { - temp=ang[j]; - ang[j]=mag[j]; - mag[j]-=temp; - } - } - } + vc->dsp.vorbis_inverse_coupling(mag, ang, blocksize/2); } // Dotproduct for(j=0, ch_floor_ptr=vc->channel_floors;jaudio_channels;++j,ch_floor_ptr+=blocksize/2) { ch_res_ptr=vc->channel_residues+res_chan[j]*blocksize/2; - - for(i=0;idsp.vector_fmul(ch_floor_ptr, ch_res_ptr, blocksize/2); } // MDCT, overlap/add, save data for next overlapping FPMATH @@ -1578,10 +1682,10 @@ static int vorbis_parse_audio_packet(vorbis_context *vc) { for(j=0;jaudio_channels;++j) { uint_fast8_t step=vc->audio_channels; uint_fast16_t k; - float *saved=vc->saved+j*vc->blocksize_1/2; + float *saved=vc->saved+j*vc->blocksize[1]/2; float *ret=vc->ret; - const float *lwin=vc->lwin; - const float *swin=vc->swin; + const float *lwin=vc->win[1]; + const float *swin=vc->win[0]; float *buf=vc->buf; float *buf_tmp=vc->buf_tmp; @@ -1589,61 +1693,56 @@ static int vorbis_parse_audio_packet(vorbis_context *vc) { saved_start=vc->saved_start; - ff_imdct_calc(vc->modes[mode_number].blockflag ? &vc->mdct1 : &vc->mdct0, buf, ch_floor_ptr, buf_tmp); + vc->mdct[0].fft.imdct_calc(&vc->mdct[vc->modes[mode_number].blockflag], buf, ch_floor_ptr, buf_tmp); + //FIXME process channels together, to allow faster simd vector_fmul_add_add? if (vc->modes[mode_number].blockflag) { // -- overlap/add if (previous_window) { - for(k=j, i=0;iblocksize_1/2;++i, k+=step) { - ret[k]=saved[i]+buf[i]*lwin[i]+BIAS; - } - retlen=vc->blocksize_1/2; + vc->dsp.vector_fmul_add_add(ret+j, buf, lwin, saved, vc->add_bias, vc->blocksize[1]/2, step); + retlen=vc->blocksize[1]/2; } else { - buf += (vc->blocksize_1-vc->blocksize_0)/4; - for(k=j, i=0;iblocksize_0/2;++i, k+=step) { - ret[k]=saved[i]+buf[i]*swin[i]+BIAS; - } - buf += vc->blocksize_0/2; - for(i=0;i<(vc->blocksize_1-vc->blocksize_0)/4;++i, k+=step) { - ret[k]=buf[i]+BIAS; + int len = (vc->blocksize[1]-vc->blocksize[0])/4; + buf += len; + vc->dsp.vector_fmul_add_add(ret+j, buf, swin, saved, vc->add_bias, vc->blocksize[0]/2, step); + k = vc->blocksize[0]/2*step + j; + buf += vc->blocksize[0]/2; + if(vc->exp_bias){ + for(i=0; iexp_bias; // ret[k]=buf[i]*(1<buf; - retlen=vc->blocksize_0/2+(vc->blocksize_1-vc->blocksize_0)/4; + retlen=vc->blocksize[0]/2+len; } // -- save if (next_window) { - buf += vc->blocksize_1/2; - lwin += vc->blocksize_1/2-1; - for(i=0;iblocksize_1/2;++i) { - saved[i]=buf[i]*lwin[-i]; - } + buf += vc->blocksize[1]/2; + vc->dsp.vector_fmul_reverse(saved, buf, lwin, vc->blocksize[1]/2); saved_start=0; } else { - saved_start=(vc->blocksize_1-vc->blocksize_0)/4; - buf += vc->blocksize_1/2; - for(i=0;iblocksize_0/2-1; - for(i=0;iblocksize_0/2;++i) { - saved[saved_start+i]=buf[saved_start+i]*swin[-i]; - } + saved_start=(vc->blocksize[1]-vc->blocksize[0])/4; + buf += vc->blocksize[1]/2; + for(i=0; iexp_bias; + vc->dsp.vector_fmul_reverse(saved+saved_start, buf+saved_start, swin, vc->blocksize[0]/2); } } else { // --overlap/add - for(k=j, i=0;iblocksize_0/2;++i, k+=step) { - ret[k]=saved[saved_start+i]+buf[i]*swin[i]+BIAS; + if(vc->add_bias) { + for(k=j, i=0;iblocksize_0/2; + vc->dsp.vector_fmul_add_add(ret+k, buf, swin, saved+saved_start, vc->add_bias, vc->blocksize[0]/2, step); + retlen=saved_start+vc->blocksize[0]/2; // -- save - buf += vc->blocksize_0/2; - swin += vc->blocksize_0/2-1; - for(i=0;iblocksize_0/2;++i) { - saved[i]=buf[i]*swin[-i]; - } + buf += vc->blocksize[0]/2; + vc->dsp.vector_fmul_reverse(saved, buf, swin, vc->blocksize[0]/2); saved_start=0; } } @@ -1661,7 +1760,7 @@ static int vorbis_decode_frame(AVCodecContext *avccontext, vorbis_context *vc = avccontext->priv_data ; GetBitContext *gb = &(vc->gb); - int_fast16_t i, len; + int_fast16_t len; if(!buf_size){ return 0; @@ -1686,16 +1785,7 @@ static int vorbis_decode_frame(AVCodecContext *avccontext, AV_DEBUG("parsed %d bytes %d bits, returned %d samples (*ch*bits) \n", get_bits_count(gb)/8, get_bits_count(gb)%8, len); - for(i=0;iret)[i]; - if(tmp & 0xf0000){ -// tmp= (0x43c0ffff - tmp)>>31; //ask gcc devs why this is slower - if(tmp > 0x43c0ffff) tmp= 0xFFFF; - else tmp= 0; - } - ((int16_t*)data)[i]=tmp - 0x8000; - } - + vc->dsp.float_to_int16(data, vc->ret, len); *data_size=len*2; return buf_size ; diff --git a/src/libffmpeg/libavcodec/vorbis.h b/src/libffmpeg/libavcodec/vorbis.h index c818207d9..cda909aa9 100644 --- a/src/libffmpeg/libavcodec/vorbis.h +++ b/src/libffmpeg/libavcodec/vorbis.h @@ -1,2256 +1,43 @@ -#define ALT_BITSTREAM_READER_LE -#include "avcodec.h" -#include "bitstream.h" -#include "dsputil.h" - -typedef struct { - uint_fast8_t dimensions; - uint_fast8_t lookup_type; - uint_fast8_t maxdepth; - VLC vlc; - float *codevectors; - unsigned int nb_bits; -} vorbis_codebook; - -typedef union vorbis_floor_u vorbis_floor_data; -typedef struct vorbis_floor0_s vorbis_floor0; -typedef struct vorbis_floor1_s vorbis_floor1; -struct vorbis_context_s; -typedef -uint_fast8_t (* vorbis_floor_decode_func) - (struct vorbis_context_s *, vorbis_floor_data *, float *); -typedef struct { - uint_fast8_t floor_type; - vorbis_floor_decode_func decode; - union vorbis_floor_u - { - struct vorbis_floor0_s - { - uint_fast8_t order; - uint_fast16_t rate; - uint_fast16_t bark_map_size; - int_fast32_t * map[2]; - uint_fast32_t map_size[2]; - uint_fast8_t amplitude_bits; - uint_fast8_t amplitude_offset; - uint_fast8_t num_books; - uint_fast8_t * book_list; - float * lsp; - } t0; - struct vorbis_floor1_s - { - uint_fast8_t partitions; - uint_fast8_t maximum_class; - uint_fast8_t partition_class[32]; - uint_fast8_t class_dimensions[16]; - uint_fast8_t class_subclasses[16]; - uint_fast8_t class_masterbook[16]; - int_fast16_t subclass_books[16][8]; - uint_fast8_t multiplier; - uint_fast16_t x_list_dim; - uint_fast16_t *x_list; - uint_fast16_t *x_list_order; - uint_fast16_t *low_neighbour; - uint_fast16_t *high_neighbour; - } t1; - } data; -} vorbis_floor; +/* + * copyright (c) 2006 Oded Shimon + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef VORBIS_H +#define VORBIS_H -typedef struct { - uint_fast16_t type; - uint_fast32_t begin; - uint_fast32_t end; - uint_fast32_t partition_size; - uint_fast8_t classifications; - uint_fast8_t classbook; - int_fast16_t books[64][8]; - uint_fast8_t maxpass; -} vorbis_residue; +#include "avcodec.h" -typedef struct { - uint_fast8_t submaps; - uint_fast16_t coupling_steps; - uint_fast8_t *magnitude; - uint_fast8_t *angle; - uint_fast8_t *mux; - uint_fast8_t submap_floor[16]; - uint_fast8_t submap_residue[16]; -} vorbis_mapping; +extern const float ff_vorbis_floor1_inverse_db_table[256]; +extern const float * ff_vorbis_vwin[8]; typedef struct { - uint_fast8_t blockflag; - uint_fast16_t windowtype; - uint_fast16_t transformtype; - uint_fast8_t mapping; -} vorbis_mode; - -typedef struct vorbis_context_s { - AVCodecContext *avccontext; - GetBitContext gb; - - MDCTContext mdct0; - MDCTContext mdct1; - uint_fast8_t first_frame; - uint_fast32_t version; - uint_fast8_t audio_channels; - uint_fast32_t audio_samplerate; - uint_fast32_t bitrate_maximum; - uint_fast32_t bitrate_nominal; - uint_fast32_t bitrate_minimum; - uint_fast32_t blocksize_0; - uint_fast32_t blocksize_1; - const float * swin; - const float * lwin; - uint_fast16_t codebook_count; - vorbis_codebook *codebooks; - uint_fast8_t floor_count; - vorbis_floor *floors; - uint_fast8_t residue_count; - vorbis_residue *residues; - uint_fast8_t mapping_count; - vorbis_mapping *mappings; - uint_fast8_t mode_count; - vorbis_mode *modes; - uint_fast8_t mode_number; // mode number for the current packet - float *channel_residues; - float *channel_floors; - float *saved; - uint_fast16_t saved_start; - float *ret; - float *buf; - float *buf_tmp; -} vorbis_context; - - - -static const float vwin64[32] = { - 0.0009460463F, 0.0085006468F, 0.0235352254F, 0.0458950567F, - 0.0753351908F, 0.1115073077F, 0.1539457973F, 0.2020557475F, - 0.2551056759F, 0.3122276645F, 0.3724270287F, 0.4346027792F, - 0.4975789974F, 0.5601459521F, 0.6211085051F, 0.6793382689F, - 0.7338252629F, 0.7837245849F, 0.8283939355F, 0.8674186656F, - 0.9006222429F, 0.9280614787F, 0.9500073081F, 0.9669131782F, - 0.9793740220F, 0.9880792941F, 0.9937636139F, 0.9971582668F, - 0.9989462667F, 0.9997230082F, 0.9999638688F, 0.9999995525F, -}; - -static const float vwin128[64] = { - 0.0002365472F, 0.0021280687F, 0.0059065254F, 0.0115626550F, - 0.0190823442F, 0.0284463735F, 0.0396300935F, 0.0526030430F, - 0.0673285281F, 0.0837631763F, 0.1018564887F, 0.1215504095F, - 0.1427789367F, 0.1654677960F, 0.1895342001F, 0.2148867160F, - 0.2414252576F, 0.2690412240F, 0.2976177952F, 0.3270303960F, - 0.3571473350F, 0.3878306189F, 0.4189369387F, 0.4503188188F, - 0.4818259135F, 0.5133064334F, 0.5446086751F, 0.5755826278F, - 0.6060816248F, 0.6359640047F, 0.6650947483F, 0.6933470543F, - 0.7206038179F, 0.7467589810F, 0.7717187213F, 0.7954024542F, - 0.8177436264F, 0.8386902831F, 0.8582053981F, 0.8762669622F, - 0.8928678298F, 0.9080153310F, 0.9217306608F, 0.9340480615F, - 0.9450138200F, 0.9546851041F, 0.9631286621F, 0.9704194171F, - 0.9766389810F, 0.9818741197F, 0.9862151938F, 0.9897546035F, - 0.9925852598F, 0.9947991032F, 0.9964856900F, 0.9977308602F, - 0.9986155015F, 0.9992144193F, 0.9995953200F, 0.9998179155F, - 0.9999331503F, 0.9999825563F, 0.9999977357F, 0.9999999720F, -}; - -static const float vwin256[128] = { - 0.0000591390F, 0.0005321979F, 0.0014780301F, 0.0028960636F, - 0.0047854363F, 0.0071449926F, 0.0099732775F, 0.0132685298F, - 0.0170286741F, 0.0212513119F, 0.0259337111F, 0.0310727950F, - 0.0366651302F, 0.0427069140F, 0.0491939614F, 0.0561216907F, - 0.0634851102F, 0.0712788035F, 0.0794969160F, 0.0881331402F, - 0.0971807028F, 0.1066323515F, 0.1164803426F, 0.1267164297F, - 0.1373318534F, 0.1483173323F, 0.1596630553F, 0.1713586755F, - 0.1833933062F, 0.1957555184F, 0.2084333404F, 0.2214142599F, - 0.2346852280F, 0.2482326664F, 0.2620424757F, 0.2761000481F, - 0.2903902813F, 0.3048975959F, 0.3196059553F, 0.3344988887F, - 0.3495595160F, 0.3647705766F, 0.3801144597F, 0.3955732382F, - 0.4111287047F, 0.4267624093F, 0.4424557009F, 0.4581897696F, - 0.4739456913F, 0.4897044744F, 0.5054471075F, 0.5211546088F, - 0.5368080763F, 0.5523887395F, 0.5678780103F, 0.5832575361F, - 0.5985092508F, 0.6136154277F, 0.6285587300F, 0.6433222619F, - 0.6578896175F, 0.6722449294F, 0.6863729144F, 0.7002589187F, - 0.7138889597F, 0.7272497662F, 0.7403288154F, 0.7531143679F, - 0.7655954985F, 0.7777621249F, 0.7896050322F, 0.8011158947F, - 0.8122872932F, 0.8231127294F, 0.8335866365F, 0.8437043850F, - 0.8534622861F, 0.8628575905F, 0.8718884835F, 0.8805540765F, - 0.8888543947F, 0.8967903616F, 0.9043637797F, 0.9115773078F, - 0.9184344360F, 0.9249394562F, 0.9310974312F, 0.9369141608F, - 0.9423961446F, 0.9475505439F, 0.9523851406F, 0.9569082947F, - 0.9611289005F, 0.9650563408F, 0.9687004405F, 0.9720714191F, - 0.9751798427F, 0.9780365753F, 0.9806527301F, 0.9830396204F, - 0.9852087111F, 0.9871715701F, 0.9889398207F, 0.9905250941F, - 0.9919389832F, 0.9931929973F, 0.9942985174F, 0.9952667537F, - 0.9961087037F, 0.9968351119F, 0.9974564312F, 0.9979827858F, - 0.9984239359F, 0.9987892441F, 0.9990876435F, 0.9993276081F, - 0.9995171241F, 0.9996636648F, 0.9997741654F, 0.9998550016F, - 0.9999119692F, 0.9999502656F, 0.9999744742F, 0.9999885497F, - 0.9999958064F, 0.9999989077F, 0.9999998584F, 0.9999999983F, -}; - -static const float vwin512[256] = { - 0.0000147849F, 0.0001330607F, 0.0003695946F, 0.0007243509F, - 0.0011972759F, 0.0017882983F, 0.0024973285F, 0.0033242588F, - 0.0042689632F, 0.0053312973F, 0.0065110982F, 0.0078081841F, - 0.0092223540F, 0.0107533880F, 0.0124010466F, 0.0141650703F, - 0.0160451800F, 0.0180410758F, 0.0201524373F, 0.0223789233F, - 0.0247201710F, 0.0271757958F, 0.0297453914F, 0.0324285286F, - 0.0352247556F, 0.0381335972F, 0.0411545545F, 0.0442871045F, - 0.0475306997F, 0.0508847676F, 0.0543487103F, 0.0579219038F, - 0.0616036982F, 0.0653934164F, 0.0692903546F, 0.0732937809F, - 0.0774029356F, 0.0816170305F, 0.0859352485F, 0.0903567428F, - 0.0948806375F, 0.0995060259F, 0.1042319712F, 0.1090575056F, - 0.1139816300F, 0.1190033137F, 0.1241214941F, 0.1293350764F, - 0.1346429333F, 0.1400439046F, 0.1455367974F, 0.1511203852F, - 0.1567934083F, 0.1625545735F, 0.1684025537F, 0.1743359881F, - 0.1803534820F, 0.1864536069F, 0.1926349000F, 0.1988958650F, - 0.2052349715F, 0.2116506555F, 0.2181413191F, 0.2247053313F, - 0.2313410275F, 0.2380467105F, 0.2448206500F, 0.2516610835F, - 0.2585662164F, 0.2655342226F, 0.2725632448F, 0.2796513950F, - 0.2867967551F, 0.2939973773F, 0.3012512852F, 0.3085564739F, - 0.3159109111F, 0.3233125375F, 0.3307592680F, 0.3382489922F, - 0.3457795756F, 0.3533488602F, 0.3609546657F, 0.3685947904F, - 0.3762670121F, 0.3839690896F, 0.3916987634F, 0.3994537572F, - 0.4072317788F, 0.4150305215F, 0.4228476653F, 0.4306808783F, - 0.4385278181F, 0.4463861329F, 0.4542534630F, 0.4621274424F, - 0.4700057001F, 0.4778858615F, 0.4857655502F, 0.4936423891F, - 0.5015140023F, 0.5093780165F, 0.5172320626F, 0.5250737772F, - 0.5329008043F, 0.5407107971F, 0.5485014192F, 0.5562703465F, - 0.5640152688F, 0.5717338914F, 0.5794239366F, 0.5870831457F, - 0.5947092801F, 0.6023001235F, 0.6098534829F, 0.6173671907F, - 0.6248391059F, 0.6322671161F, 0.6396491384F, 0.6469831217F, - 0.6542670475F, 0.6614989319F, 0.6686768267F, 0.6757988210F, - 0.6828630426F, 0.6898676592F, 0.6968108799F, 0.7036909564F, - 0.7105061843F, 0.7172549043F, 0.7239355032F, 0.7305464154F, - 0.7370861235F, 0.7435531598F, 0.7499461068F, 0.7562635986F, - 0.7625043214F, 0.7686670148F, 0.7747504721F, 0.7807535410F, - 0.7866751247F, 0.7925141825F, 0.7982697296F, 0.8039408387F, - 0.8095266395F, 0.8150263196F, 0.8204391248F, 0.8257643590F, - 0.8310013848F, 0.8361496236F, 0.8412085555F, 0.8461777194F, - 0.8510567129F, 0.8558451924F, 0.8605428730F, 0.8651495278F, - 0.8696649882F, 0.8740891432F, 0.8784219392F, 0.8826633797F, - 0.8868135244F, 0.8908724888F, 0.8948404441F, 0.8987176157F, - 0.9025042831F, 0.9062007791F, 0.9098074886F, 0.9133248482F, - 0.9167533451F, 0.9200935163F, 0.9233459472F, 0.9265112712F, - 0.9295901680F, 0.9325833632F, 0.9354916263F, 0.9383157705F, - 0.9410566504F, 0.9437151618F, 0.9462922398F, 0.9487888576F, - 0.9512060252F, 0.9535447882F, 0.9558062262F, 0.9579914516F, - 0.9601016078F, 0.9621378683F, 0.9641014348F, 0.9659935361F, - 0.9678154261F, 0.9695683830F, 0.9712537071F, 0.9728727198F, - 0.9744267618F, 0.9759171916F, 0.9773453842F, 0.9787127293F, - 0.9800206298F, 0.9812705006F, 0.9824637665F, 0.9836018613F, - 0.9846862258F, 0.9857183066F, 0.9866995544F, 0.9876314227F, - 0.9885153662F, 0.9893528393F, 0.9901452948F, 0.9908941823F, - 0.9916009470F, 0.9922670279F, 0.9928938570F, 0.9934828574F, - 0.9940354423F, 0.9945530133F, 0.9950369595F, 0.9954886562F, - 0.9959094633F, 0.9963007242F, 0.9966637649F, 0.9969998925F, - 0.9973103939F, 0.9975965351F, 0.9978595598F, 0.9981006885F, - 0.9983211172F, 0.9985220166F, 0.9987045311F, 0.9988697776F, - 0.9990188449F, 0.9991527924F, 0.9992726499F, 0.9993794157F, - 0.9994740570F, 0.9995575079F, 0.9996306699F, 0.9996944099F, - 0.9997495605F, 0.9997969190F, 0.9998372465F, 0.9998712678F, - 0.9998996704F, 0.9999231041F, 0.9999421807F, 0.9999574732F, - 0.9999695157F, 0.9999788026F, 0.9999857885F, 0.9999908879F, - 0.9999944746F, 0.9999968817F, 0.9999984010F, 0.9999992833F, - 0.9999997377F, 0.9999999317F, 0.9999999911F, 0.9999999999F, -}; - -static const float vwin1024[512] = { - 0.0000036962F, 0.0000332659F, 0.0000924041F, 0.0001811086F, - 0.0002993761F, 0.0004472021F, 0.0006245811F, 0.0008315063F, - 0.0010679699F, 0.0013339631F, 0.0016294757F, 0.0019544965F, - 0.0023090133F, 0.0026930125F, 0.0031064797F, 0.0035493989F, - 0.0040217533F, 0.0045235250F, 0.0050546946F, 0.0056152418F, - 0.0062051451F, 0.0068243817F, 0.0074729278F, 0.0081507582F, - 0.0088578466F, 0.0095941655F, 0.0103596863F, 0.0111543789F, - 0.0119782122F, 0.0128311538F, 0.0137131701F, 0.0146242260F, - 0.0155642855F, 0.0165333111F, 0.0175312640F, 0.0185581042F, - 0.0196137903F, 0.0206982797F, 0.0218115284F, 0.0229534910F, - 0.0241241208F, 0.0253233698F, 0.0265511886F, 0.0278075263F, - 0.0290923308F, 0.0304055484F, 0.0317471241F, 0.0331170013F, - 0.0345151222F, 0.0359414274F, 0.0373958560F, 0.0388783456F, - 0.0403888325F, 0.0419272511F, 0.0434935347F, 0.0450876148F, - 0.0467094213F, 0.0483588828F, 0.0500359261F, 0.0517404765F, - 0.0534724575F, 0.0552317913F, 0.0570183983F, 0.0588321971F, - 0.0606731048F, 0.0625410369F, 0.0644359070F, 0.0663576272F, - 0.0683061077F, 0.0702812571F, 0.0722829821F, 0.0743111878F, - 0.0763657775F, 0.0784466526F, 0.0805537129F, 0.0826868561F, - 0.0848459782F, 0.0870309736F, 0.0892417345F, 0.0914781514F, - 0.0937401128F, 0.0960275056F, 0.0983402145F, 0.1006781223F, - 0.1030411101F, 0.1054290568F, 0.1078418397F, 0.1102793336F, - 0.1127414119F, 0.1152279457F, 0.1177388042F, 0.1202738544F, - 0.1228329618F, 0.1254159892F, 0.1280227980F, 0.1306532471F, - 0.1333071937F, 0.1359844927F, 0.1386849970F, 0.1414085575F, - 0.1441550230F, 0.1469242403F, 0.1497160539F, 0.1525303063F, - 0.1553668381F, 0.1582254875F, 0.1611060909F, 0.1640084822F, - 0.1669324936F, 0.1698779549F, 0.1728446939F, 0.1758325362F, - 0.1788413055F, 0.1818708232F, 0.1849209084F, 0.1879913785F, - 0.1910820485F, 0.1941927312F, 0.1973232376F, 0.2004733764F, - 0.2036429541F, 0.2068317752F, 0.2100396421F, 0.2132663552F, - 0.2165117125F, 0.2197755102F, 0.2230575422F, 0.2263576007F, - 0.2296754753F, 0.2330109540F, 0.2363638225F, 0.2397338646F, - 0.2431208619F, 0.2465245941F, 0.2499448389F, 0.2533813719F, - 0.2568339669F, 0.2603023956F, 0.2637864277F, 0.2672858312F, - 0.2708003718F, 0.2743298135F, 0.2778739186F, 0.2814324472F, - 0.2850051576F, 0.2885918065F, 0.2921921485F, 0.2958059366F, - 0.2994329219F, 0.3030728538F, 0.3067254799F, 0.3103905462F, - 0.3140677969F, 0.3177569747F, 0.3214578205F, 0.3251700736F, - 0.3288934718F, 0.3326277513F, 0.3363726468F, 0.3401278914F, - 0.3438932168F, 0.3476683533F, 0.3514530297F, 0.3552469734F, - 0.3590499106F, 0.3628615659F, 0.3666816630F, 0.3705099239F, - 0.3743460698F, 0.3781898204F, 0.3820408945F, 0.3858990095F, - 0.3897638820F, 0.3936352274F, 0.3975127601F, 0.4013961936F, - 0.4052852405F, 0.4091796123F, 0.4130790198F, 0.4169831732F, - 0.4208917815F, 0.4248045534F, 0.4287211965F, 0.4326414181F, - 0.4365649248F, 0.4404914225F, 0.4444206167F, 0.4483522125F, - 0.4522859146F, 0.4562214270F, 0.4601584538F, 0.4640966984F, - 0.4680358644F, 0.4719756548F, 0.4759157726F, 0.4798559209F, - 0.4837958024F, 0.4877351199F, 0.4916735765F, 0.4956108751F, - 0.4995467188F, 0.5034808109F, 0.5074128550F, 0.5113425550F, - 0.5152696149F, 0.5191937395F, 0.5231146336F, 0.5270320028F, - 0.5309455530F, 0.5348549910F, 0.5387600239F, 0.5426603597F, - 0.5465557070F, 0.5504457754F, 0.5543302752F, 0.5582089175F, - 0.5620814145F, 0.5659474793F, 0.5698068262F, 0.5736591704F, - 0.5775042283F, 0.5813417176F, 0.5851713571F, 0.5889928670F, - 0.5928059689F, 0.5966103856F, 0.6004058415F, 0.6041920626F, - 0.6079687761F, 0.6117357113F, 0.6154925986F, 0.6192391705F, - 0.6229751612F, 0.6267003064F, 0.6304143441F, 0.6341170137F, - 0.6378080569F, 0.6414872173F, 0.6451542405F, 0.6488088741F, - 0.6524508681F, 0.6560799742F, 0.6596959469F, 0.6632985424F, - 0.6668875197F, 0.6704626398F, 0.6740236662F, 0.6775703649F, - 0.6811025043F, 0.6846198554F, 0.6881221916F, 0.6916092892F, - 0.6950809269F, 0.6985368861F, 0.7019769510F, 0.7054009085F, - 0.7088085484F, 0.7121996632F, 0.7155740484F, 0.7189315023F, - 0.7222718263F, 0.7255948245F, 0.7289003043F, 0.7321880760F, - 0.7354579530F, 0.7387097518F, 0.7419432921F, 0.7451583966F, - 0.7483548915F, 0.7515326059F, 0.7546913723F, 0.7578310265F, - 0.7609514077F, 0.7640523581F, 0.7671337237F, 0.7701953535F, - 0.7732371001F, 0.7762588195F, 0.7792603711F, 0.7822416178F, - 0.7852024259F, 0.7881426654F, 0.7910622097F, 0.7939609356F, - 0.7968387237F, 0.7996954579F, 0.8025310261F, 0.8053453193F, - 0.8081382324F, 0.8109096638F, 0.8136595156F, 0.8163876936F, - 0.8190941071F, 0.8217786690F, 0.8244412960F, 0.8270819086F, - 0.8297004305F, 0.8322967896F, 0.8348709171F, 0.8374227481F, - 0.8399522213F, 0.8424592789F, 0.8449438672F, 0.8474059356F, - 0.8498454378F, 0.8522623306F, 0.8546565748F, 0.8570281348F, - 0.8593769787F, 0.8617030779F, 0.8640064080F, 0.8662869477F, - 0.8685446796F, 0.8707795899F, 0.8729916682F, 0.8751809079F, - 0.8773473059F, 0.8794908626F, 0.8816115819F, 0.8837094713F, - 0.8857845418F, 0.8878368079F, 0.8898662874F, 0.8918730019F, - 0.8938569760F, 0.8958182380F, 0.8977568194F, 0.8996727552F, - 0.9015660837F, 0.9034368465F, 0.9052850885F, 0.9071108577F, - 0.9089142057F, 0.9106951869F, 0.9124538591F, 0.9141902832F, - 0.9159045233F, 0.9175966464F, 0.9192667228F, 0.9209148257F, - 0.9225410313F, 0.9241454187F, 0.9257280701F, 0.9272890704F, - 0.9288285075F, 0.9303464720F, 0.9318430576F, 0.9333183603F, - 0.9347724792F, 0.9362055158F, 0.9376175745F, 0.9390087622F, - 0.9403791881F, 0.9417289644F, 0.9430582055F, 0.9443670283F, - 0.9456555521F, 0.9469238986F, 0.9481721917F, 0.9494005577F, - 0.9506091252F, 0.9517980248F, 0.9529673894F, 0.9541173540F, - 0.9552480557F, 0.9563596334F, 0.9574522282F, 0.9585259830F, - 0.9595810428F, 0.9606175542F, 0.9616356656F, 0.9626355274F, - 0.9636172915F, 0.9645811114F, 0.9655271425F, 0.9664555414F, - 0.9673664664F, 0.9682600774F, 0.9691365355F, 0.9699960034F, - 0.9708386448F, 0.9716646250F, 0.9724741103F, 0.9732672685F, - 0.9740442683F, 0.9748052795F, 0.9755504729F, 0.9762800205F, - 0.9769940950F, 0.9776928703F, 0.9783765210F, 0.9790452223F, - 0.9796991504F, 0.9803384823F, 0.9809633954F, 0.9815740679F, - 0.9821706784F, 0.9827534063F, 0.9833224312F, 0.9838779332F, - 0.9844200928F, 0.9849490910F, 0.9854651087F, 0.9859683274F, - 0.9864589286F, 0.9869370940F, 0.9874030054F, 0.9878568447F, - 0.9882987937F, 0.9887290343F, 0.9891477481F, 0.9895551169F, - 0.9899513220F, 0.9903365446F, 0.9907109658F, 0.9910747662F, - 0.9914281260F, 0.9917712252F, 0.9921042433F, 0.9924273593F, - 0.9927407516F, 0.9930445982F, 0.9933390763F, 0.9936243626F, - 0.9939006331F, 0.9941680631F, 0.9944268269F, 0.9946770982F, - 0.9949190498F, 0.9951528537F, 0.9953786808F, 0.9955967011F, - 0.9958070836F, 0.9960099963F, 0.9962056061F, 0.9963940787F, - 0.9965755786F, 0.9967502693F, 0.9969183129F, 0.9970798704F, - 0.9972351013F, 0.9973841640F, 0.9975272151F, 0.9976644103F, - 0.9977959036F, 0.9979218476F, 0.9980423932F, 0.9981576901F, - 0.9982678862F, 0.9983731278F, 0.9984735596F, 0.9985693247F, - 0.9986605645F, 0.9987474186F, 0.9988300248F, 0.9989085193F, - 0.9989830364F, 0.9990537085F, 0.9991206662F, 0.9991840382F, - 0.9992439513F, 0.9993005303F, 0.9993538982F, 0.9994041757F, - 0.9994514817F, 0.9994959330F, 0.9995376444F, 0.9995767286F, - 0.9996132960F, 0.9996474550F, 0.9996793121F, 0.9997089710F, - 0.9997365339F, 0.9997621003F, 0.9997857677F, 0.9998076311F, - 0.9998277836F, 0.9998463156F, 0.9998633155F, 0.9998788692F, - 0.9998930603F, 0.9999059701F, 0.9999176774F, 0.9999282586F, - 0.9999377880F, 0.9999463370F, 0.9999539749F, 0.9999607685F, - 0.9999667820F, 0.9999720773F, 0.9999767136F, 0.9999807479F, - 0.9999842344F, 0.9999872249F, 0.9999897688F, 0.9999919127F, - 0.9999937009F, 0.9999951749F, 0.9999963738F, 0.9999973342F, - 0.9999980900F, 0.9999986724F, 0.9999991103F, 0.9999994297F, - 0.9999996543F, 0.9999998049F, 0.9999999000F, 0.9999999552F, - 0.9999999836F, 0.9999999957F, 0.9999999994F, 1.0000000000F, -}; - -static const float vwin2048[1024] = { - 0.0000009241F, 0.0000083165F, 0.0000231014F, 0.0000452785F, - 0.0000748476F, 0.0001118085F, 0.0001561608F, 0.0002079041F, - 0.0002670379F, 0.0003335617F, 0.0004074748F, 0.0004887765F, - 0.0005774661F, 0.0006735427F, 0.0007770054F, 0.0008878533F, - 0.0010060853F, 0.0011317002F, 0.0012646969F, 0.0014050742F, - 0.0015528307F, 0.0017079650F, 0.0018704756F, 0.0020403610F, - 0.0022176196F, 0.0024022497F, 0.0025942495F, 0.0027936173F, - 0.0030003511F, 0.0032144490F, 0.0034359088F, 0.0036647286F, - 0.0039009061F, 0.0041444391F, 0.0043953253F, 0.0046535621F, - 0.0049191472F, 0.0051920781F, 0.0054723520F, 0.0057599664F, - 0.0060549184F, 0.0063572052F, 0.0066668239F, 0.0069837715F, - 0.0073080449F, 0.0076396410F, 0.0079785566F, 0.0083247884F, - 0.0086783330F, 0.0090391871F, 0.0094073470F, 0.0097828092F, - 0.0101655700F, 0.0105556258F, 0.0109529726F, 0.0113576065F, - 0.0117695237F, 0.0121887200F, 0.0126151913F, 0.0130489335F, - 0.0134899422F, 0.0139382130F, 0.0143937415F, 0.0148565233F, - 0.0153265536F, 0.0158038279F, 0.0162883413F, 0.0167800889F, - 0.0172790660F, 0.0177852675F, 0.0182986882F, 0.0188193231F, - 0.0193471668F, 0.0198822141F, 0.0204244594F, 0.0209738974F, - 0.0215305225F, 0.0220943289F, 0.0226653109F, 0.0232434627F, - 0.0238287784F, 0.0244212519F, 0.0250208772F, 0.0256276481F, - 0.0262415582F, 0.0268626014F, 0.0274907711F, 0.0281260608F, - 0.0287684638F, 0.0294179736F, 0.0300745833F, 0.0307382859F, - 0.0314090747F, 0.0320869424F, 0.0327718819F, 0.0334638860F, - 0.0341629474F, 0.0348690586F, 0.0355822122F, 0.0363024004F, - 0.0370296157F, 0.0377638502F, 0.0385050960F, 0.0392533451F, - 0.0400085896F, 0.0407708211F, 0.0415400315F, 0.0423162123F, - 0.0430993552F, 0.0438894515F, 0.0446864926F, 0.0454904698F, - 0.0463013742F, 0.0471191969F, 0.0479439288F, 0.0487755607F, - 0.0496140836F, 0.0504594879F, 0.0513117642F, 0.0521709031F, - 0.0530368949F, 0.0539097297F, 0.0547893979F, 0.0556758894F, - 0.0565691941F, 0.0574693019F, 0.0583762026F, 0.0592898858F, - 0.0602103410F, 0.0611375576F, 0.0620715250F, 0.0630122324F, - 0.0639596688F, 0.0649138234F, 0.0658746848F, 0.0668422421F, - 0.0678164838F, 0.0687973985F, 0.0697849746F, 0.0707792005F, - 0.0717800645F, 0.0727875547F, 0.0738016591F, 0.0748223656F, - 0.0758496620F, 0.0768835359F, 0.0779239751F, 0.0789709668F, - 0.0800244985F, 0.0810845574F, 0.0821511306F, 0.0832242052F, - 0.0843037679F, 0.0853898056F, 0.0864823050F, 0.0875812525F, - 0.0886866347F, 0.0897984378F, 0.0909166480F, 0.0920412513F, - 0.0931722338F, 0.0943095813F, 0.0954532795F, 0.0966033140F, - 0.0977596702F, 0.0989223336F, 0.1000912894F, 0.1012665227F, - 0.1024480185F, 0.1036357616F, 0.1048297369F, 0.1060299290F, - 0.1072363224F, 0.1084489014F, 0.1096676504F, 0.1108925534F, - 0.1121235946F, 0.1133607577F, 0.1146040267F, 0.1158533850F, - 0.1171088163F, 0.1183703040F, 0.1196378312F, 0.1209113812F, - 0.1221909370F, 0.1234764815F, 0.1247679974F, 0.1260654674F, - 0.1273688740F, 0.1286781995F, 0.1299934263F, 0.1313145365F, - 0.1326415121F, 0.1339743349F, 0.1353129866F, 0.1366574490F, - 0.1380077035F, 0.1393637315F, 0.1407255141F, 0.1420930325F, - 0.1434662677F, 0.1448452004F, 0.1462298115F, 0.1476200814F, - 0.1490159906F, 0.1504175195F, 0.1518246482F, 0.1532373569F, - 0.1546556253F, 0.1560794333F, 0.1575087606F, 0.1589435866F, - 0.1603838909F, 0.1618296526F, 0.1632808509F, 0.1647374648F, - 0.1661994731F, 0.1676668546F, 0.1691395880F, 0.1706176516F, - 0.1721010238F, 0.1735896829F, 0.1750836068F, 0.1765827736F, - 0.1780871610F, 0.1795967468F, 0.1811115084F, 0.1826314234F, - 0.1841564689F, 0.1856866221F, 0.1872218600F, 0.1887621595F, - 0.1903074974F, 0.1918578503F, 0.1934131947F, 0.1949735068F, - 0.1965387630F, 0.1981089393F, 0.1996840117F, 0.2012639560F, - 0.2028487479F, 0.2044383630F, 0.2060327766F, 0.2076319642F, - 0.2092359007F, 0.2108445614F, 0.2124579211F, 0.2140759545F, - 0.2156986364F, 0.2173259411F, 0.2189578432F, 0.2205943168F, - 0.2222353361F, 0.2238808751F, 0.2255309076F, 0.2271854073F, - 0.2288443480F, 0.2305077030F, 0.2321754457F, 0.2338475493F, - 0.2355239869F, 0.2372047315F, 0.2388897560F, 0.2405790329F, - 0.2422725350F, 0.2439702347F, 0.2456721043F, 0.2473781159F, - 0.2490882418F, 0.2508024539F, 0.2525207240F, 0.2542430237F, - 0.2559693248F, 0.2576995986F, 0.2594338166F, 0.2611719498F, - 0.2629139695F, 0.2646598466F, 0.2664095520F, 0.2681630564F, - 0.2699203304F, 0.2716813445F, 0.2734460691F, 0.2752144744F, - 0.2769865307F, 0.2787622079F, 0.2805414760F, 0.2823243047F, - 0.2841106637F, 0.2859005227F, 0.2876938509F, 0.2894906179F, - 0.2912907928F, 0.2930943447F, 0.2949012426F, 0.2967114554F, - 0.2985249520F, 0.3003417009F, 0.3021616708F, 0.3039848301F, - 0.3058111471F, 0.3076405901F, 0.3094731273F, 0.3113087266F, - 0.3131473560F, 0.3149889833F, 0.3168335762F, 0.3186811024F, - 0.3205315294F, 0.3223848245F, 0.3242409552F, 0.3260998886F, - 0.3279615918F, 0.3298260319F, 0.3316931758F, 0.3335629903F, - 0.3354354423F, 0.3373104982F, 0.3391881247F, 0.3410682882F, - 0.3429509551F, 0.3448360917F, 0.3467236642F, 0.3486136387F, - 0.3505059811F, 0.3524006575F, 0.3542976336F, 0.3561968753F, - 0.3580983482F, 0.3600020179F, 0.3619078499F, 0.3638158096F, - 0.3657258625F, 0.3676379737F, 0.3695521086F, 0.3714682321F, - 0.3733863094F, 0.3753063055F, 0.3772281852F, 0.3791519134F, - 0.3810774548F, 0.3830047742F, 0.3849338362F, 0.3868646053F, - 0.3887970459F, 0.3907311227F, 0.3926667998F, 0.3946040417F, - 0.3965428125F, 0.3984830765F, 0.4004247978F, 0.4023679403F, - 0.4043124683F, 0.4062583455F, 0.4082055359F, 0.4101540034F, - 0.4121037117F, 0.4140546246F, 0.4160067058F, 0.4179599190F, - 0.4199142277F, 0.4218695956F, 0.4238259861F, 0.4257833627F, - 0.4277416888F, 0.4297009279F, 0.4316610433F, 0.4336219983F, - 0.4355837562F, 0.4375462803F, 0.4395095337F, 0.4414734797F, - 0.4434380815F, 0.4454033021F, 0.4473691046F, 0.4493354521F, - 0.4513023078F, 0.4532696345F, 0.4552373954F, 0.4572055533F, - 0.4591740713F, 0.4611429123F, 0.4631120393F, 0.4650814151F, - 0.4670510028F, 0.4690207650F, 0.4709906649F, 0.4729606651F, - 0.4749307287F, 0.4769008185F, 0.4788708972F, 0.4808409279F, - 0.4828108732F, 0.4847806962F, 0.4867503597F, 0.4887198264F, - 0.4906890593F, 0.4926580213F, 0.4946266753F, 0.4965949840F, - 0.4985629105F, 0.5005304176F, 0.5024974683F, 0.5044640255F, - 0.5064300522F, 0.5083955114F, 0.5103603659F, 0.5123245790F, - 0.5142881136F, 0.5162509328F, 0.5182129997F, 0.5201742774F, - 0.5221347290F, 0.5240943178F, 0.5260530070F, 0.5280107598F, - 0.5299675395F, 0.5319233095F, 0.5338780330F, 0.5358316736F, - 0.5377841946F, 0.5397355596F, 0.5416857320F, 0.5436346755F, - 0.5455823538F, 0.5475287304F, 0.5494737691F, 0.5514174337F, - 0.5533596881F, 0.5553004962F, 0.5572398218F, 0.5591776291F, - 0.5611138821F, 0.5630485449F, 0.5649815818F, 0.5669129570F, - 0.5688426349F, 0.5707705799F, 0.5726967564F, 0.5746211290F, - 0.5765436624F, 0.5784643212F, 0.5803830702F, 0.5822998743F, - 0.5842146984F, 0.5861275076F, 0.5880382669F, 0.5899469416F, - 0.5918534968F, 0.5937578981F, 0.5956601107F, 0.5975601004F, - 0.5994578326F, 0.6013532732F, 0.6032463880F, 0.6051371429F, - 0.6070255039F, 0.6089114372F, 0.6107949090F, 0.6126758856F, - 0.6145543334F, 0.6164302191F, 0.6183035092F, 0.6201741706F, - 0.6220421700F, 0.6239074745F, 0.6257700513F, 0.6276298674F, - 0.6294868903F, 0.6313410873F, 0.6331924262F, 0.6350408745F, - 0.6368864001F, 0.6387289710F, 0.6405685552F, 0.6424051209F, - 0.6442386364F, 0.6460690702F, 0.6478963910F, 0.6497205673F, - 0.6515415682F, 0.6533593625F, 0.6551739194F, 0.6569852082F, - 0.6587931984F, 0.6605978593F, 0.6623991609F, 0.6641970728F, - 0.6659915652F, 0.6677826081F, 0.6695701718F, 0.6713542268F, - 0.6731347437F, 0.6749116932F, 0.6766850461F, 0.6784547736F, - 0.6802208469F, 0.6819832374F, 0.6837419164F, 0.6854968559F, - 0.6872480275F, 0.6889954034F, 0.6907389556F, 0.6924786566F, - 0.6942144788F, 0.6959463950F, 0.6976743780F, 0.6993984008F, - 0.7011184365F, 0.7028344587F, 0.7045464407F, 0.7062543564F, - 0.7079581796F, 0.7096578844F, 0.7113534450F, 0.7130448359F, - 0.7147320316F, 0.7164150070F, 0.7180937371F, 0.7197681970F, - 0.7214383620F, 0.7231042077F, 0.7247657098F, 0.7264228443F, - 0.7280755871F, 0.7297239147F, 0.7313678035F, 0.7330072301F, - 0.7346421715F, 0.7362726046F, 0.7378985069F, 0.7395198556F, - 0.7411366285F, 0.7427488034F, 0.7443563584F, 0.7459592717F, - 0.7475575218F, 0.7491510873F, 0.7507399471F, 0.7523240803F, - 0.7539034661F, 0.7554780839F, 0.7570479136F, 0.7586129349F, - 0.7601731279F, 0.7617284730F, 0.7632789506F, 0.7648245416F, - 0.7663652267F, 0.7679009872F, 0.7694318044F, 0.7709576599F, - 0.7724785354F, 0.7739944130F, 0.7755052749F, 0.7770111035F, - 0.7785118815F, 0.7800075916F, 0.7814982170F, 0.7829837410F, - 0.7844641472F, 0.7859394191F, 0.7874095408F, 0.7888744965F, - 0.7903342706F, 0.7917888476F, 0.7932382124F, 0.7946823501F, - 0.7961212460F, 0.7975548855F, 0.7989832544F, 0.8004063386F, - 0.8018241244F, 0.8032365981F, 0.8046437463F, 0.8060455560F, - 0.8074420141F, 0.8088331080F, 0.8102188253F, 0.8115991536F, - 0.8129740810F, 0.8143435957F, 0.8157076861F, 0.8170663409F, - 0.8184195489F, 0.8197672994F, 0.8211095817F, 0.8224463853F, - 0.8237777001F, 0.8251035161F, 0.8264238235F, 0.8277386129F, - 0.8290478750F, 0.8303516008F, 0.8316497814F, 0.8329424083F, - 0.8342294731F, 0.8355109677F, 0.8367868841F, 0.8380572148F, - 0.8393219523F, 0.8405810893F, 0.8418346190F, 0.8430825345F, - 0.8443248294F, 0.8455614974F, 0.8467925323F, 0.8480179285F, - 0.8492376802F, 0.8504517822F, 0.8516602292F, 0.8528630164F, - 0.8540601391F, 0.8552515928F, 0.8564373733F, 0.8576174766F, - 0.8587918990F, 0.8599606368F, 0.8611236868F, 0.8622810460F, - 0.8634327113F, 0.8645786802F, 0.8657189504F, 0.8668535195F, - 0.8679823857F, 0.8691055472F, 0.8702230025F, 0.8713347503F, - 0.8724407896F, 0.8735411194F, 0.8746357394F, 0.8757246489F, - 0.8768078479F, 0.8778853364F, 0.8789571146F, 0.8800231832F, - 0.8810835427F, 0.8821381942F, 0.8831871387F, 0.8842303777F, - 0.8852679127F, 0.8862997456F, 0.8873258784F, 0.8883463132F, - 0.8893610527F, 0.8903700994F, 0.8913734562F, 0.8923711263F, - 0.8933631129F, 0.8943494196F, 0.8953300500F, 0.8963050083F, - 0.8972742985F, 0.8982379249F, 0.8991958922F, 0.9001482052F, - 0.9010948688F, 0.9020358883F, 0.9029712690F, 0.9039010165F, - 0.9048251367F, 0.9057436357F, 0.9066565195F, 0.9075637946F, - 0.9084654678F, 0.9093615456F, 0.9102520353F, 0.9111369440F, - 0.9120162792F, 0.9128900484F, 0.9137582595F, 0.9146209204F, - 0.9154780394F, 0.9163296248F, 0.9171756853F, 0.9180162296F, - 0.9188512667F, 0.9196808057F, 0.9205048559F, 0.9213234270F, - 0.9221365285F, 0.9229441704F, 0.9237463629F, 0.9245431160F, - 0.9253344404F, 0.9261203465F, 0.9269008453F, 0.9276759477F, - 0.9284456648F, 0.9292100080F, 0.9299689889F, 0.9307226190F, - 0.9314709103F, 0.9322138747F, 0.9329515245F, 0.9336838721F, - 0.9344109300F, 0.9351327108F, 0.9358492275F, 0.9365604931F, - 0.9372665208F, 0.9379673239F, 0.9386629160F, 0.9393533107F, - 0.9400385220F, 0.9407185637F, 0.9413934501F, 0.9420631954F, - 0.9427278141F, 0.9433873208F, 0.9440417304F, 0.9446910576F, - 0.9453353176F, 0.9459745255F, 0.9466086968F, 0.9472378469F, - 0.9478619915F, 0.9484811463F, 0.9490953274F, 0.9497045506F, - 0.9503088323F, 0.9509081888F, 0.9515026365F, 0.9520921921F, - 0.9526768723F, 0.9532566940F, 0.9538316742F, 0.9544018300F, - 0.9549671786F, 0.9555277375F, 0.9560835241F, 0.9566345562F, - 0.9571808513F, 0.9577224275F, 0.9582593027F, 0.9587914949F, - 0.9593190225F, 0.9598419038F, 0.9603601571F, 0.9608738012F, - 0.9613828546F, 0.9618873361F, 0.9623872646F, 0.9628826591F, - 0.9633735388F, 0.9638599227F, 0.9643418303F, 0.9648192808F, - 0.9652922939F, 0.9657608890F, 0.9662250860F, 0.9666849046F, - 0.9671403646F, 0.9675914861F, 0.9680382891F, 0.9684807937F, - 0.9689190202F, 0.9693529890F, 0.9697827203F, 0.9702082347F, - 0.9706295529F, 0.9710466953F, 0.9714596828F, 0.9718685362F, - 0.9722732762F, 0.9726739240F, 0.9730705005F, 0.9734630267F, - 0.9738515239F, 0.9742360134F, 0.9746165163F, 0.9749930540F, - 0.9753656481F, 0.9757343198F, 0.9760990909F, 0.9764599829F, - 0.9768170175F, 0.9771702164F, 0.9775196013F, 0.9778651941F, - 0.9782070167F, 0.9785450909F, 0.9788794388F, 0.9792100824F, - 0.9795370437F, 0.9798603449F, 0.9801800080F, 0.9804960554F, - 0.9808085092F, 0.9811173916F, 0.9814227251F, 0.9817245318F, - 0.9820228343F, 0.9823176549F, 0.9826090160F, 0.9828969402F, - 0.9831814498F, 0.9834625674F, 0.9837403156F, 0.9840147169F, - 0.9842857939F, 0.9845535692F, 0.9848180654F, 0.9850793052F, - 0.9853373113F, 0.9855921062F, 0.9858437127F, 0.9860921535F, - 0.9863374512F, 0.9865796287F, 0.9868187085F, 0.9870547136F, - 0.9872876664F, 0.9875175899F, 0.9877445067F, 0.9879684396F, - 0.9881894112F, 0.9884074444F, 0.9886225619F, 0.9888347863F, - 0.9890441404F, 0.9892506468F, 0.9894543284F, 0.9896552077F, - 0.9898533074F, 0.9900486502F, 0.9902412587F, 0.9904311555F, - 0.9906183633F, 0.9908029045F, 0.9909848019F, 0.9911640779F, - 0.9913407550F, 0.9915148557F, 0.9916864025F, 0.9918554179F, - 0.9920219241F, 0.9921859437F, 0.9923474989F, 0.9925066120F, - 0.9926633054F, 0.9928176012F, 0.9929695218F, 0.9931190891F, - 0.9932663254F, 0.9934112527F, 0.9935538932F, 0.9936942686F, - 0.9938324012F, 0.9939683126F, 0.9941020248F, 0.9942335597F, - 0.9943629388F, 0.9944901841F, 0.9946153170F, 0.9947383593F, - 0.9948593325F, 0.9949782579F, 0.9950951572F, 0.9952100516F, - 0.9953229625F, 0.9954339111F, 0.9955429186F, 0.9956500062F, - 0.9957551948F, 0.9958585056F, 0.9959599593F, 0.9960595769F, - 0.9961573792F, 0.9962533869F, 0.9963476206F, 0.9964401009F, - 0.9965308483F, 0.9966198833F, 0.9967072261F, 0.9967928971F, - 0.9968769164F, 0.9969593041F, 0.9970400804F, 0.9971192651F, - 0.9971968781F, 0.9972729391F, 0.9973474680F, 0.9974204842F, - 0.9974920074F, 0.9975620569F, 0.9976306521F, 0.9976978122F, - 0.9977635565F, 0.9978279039F, 0.9978908736F, 0.9979524842F, - 0.9980127547F, 0.9980717037F, 0.9981293499F, 0.9981857116F, - 0.9982408073F, 0.9982946554F, 0.9983472739F, 0.9983986810F, - 0.9984488947F, 0.9984979328F, 0.9985458132F, 0.9985925534F, - 0.9986381711F, 0.9986826838F, 0.9987261086F, 0.9987684630F, - 0.9988097640F, 0.9988500286F, 0.9988892738F, 0.9989275163F, - 0.9989647727F, 0.9990010597F, 0.9990363938F, 0.9990707911F, - 0.9991042679F, 0.9991368404F, 0.9991685244F, 0.9991993358F, - 0.9992292905F, 0.9992584038F, 0.9992866914F, 0.9993141686F, - 0.9993408506F, 0.9993667526F, 0.9993918895F, 0.9994162761F, - 0.9994399273F, 0.9994628576F, 0.9994850815F, 0.9995066133F, - 0.9995274672F, 0.9995476574F, 0.9995671978F, 0.9995861021F, - 0.9996043841F, 0.9996220573F, 0.9996391352F, 0.9996556310F, - 0.9996715579F, 0.9996869288F, 0.9997017568F, 0.9997160543F, - 0.9997298342F, 0.9997431088F, 0.9997558905F, 0.9997681914F, - 0.9997800236F, 0.9997913990F, 0.9998023292F, 0.9998128261F, - 0.9998229009F, 0.9998325650F, 0.9998418296F, 0.9998507058F, - 0.9998592044F, 0.9998673362F, 0.9998751117F, 0.9998825415F, - 0.9998896358F, 0.9998964047F, 0.9999028584F, 0.9999090066F, - 0.9999148590F, 0.9999204253F, 0.9999257148F, 0.9999307368F, - 0.9999355003F, 0.9999400144F, 0.9999442878F, 0.9999483293F, - 0.9999521472F, 0.9999557499F, 0.9999591457F, 0.9999623426F, - 0.9999653483F, 0.9999681708F, 0.9999708175F, 0.9999732959F, - 0.9999756132F, 0.9999777765F, 0.9999797928F, 0.9999816688F, - 0.9999834113F, 0.9999850266F, 0.9999865211F, 0.9999879009F, - 0.9999891721F, 0.9999903405F, 0.9999914118F, 0.9999923914F, - 0.9999932849F, 0.9999940972F, 0.9999948336F, 0.9999954989F, - 0.9999960978F, 0.9999966349F, 0.9999971146F, 0.9999975411F, - 0.9999979185F, 0.9999982507F, 0.9999985414F, 0.9999987944F, - 0.9999990129F, 0.9999992003F, 0.9999993596F, 0.9999994939F, - 0.9999996059F, 0.9999996981F, 0.9999997732F, 0.9999998333F, - 0.9999998805F, 0.9999999170F, 0.9999999444F, 0.9999999643F, - 0.9999999784F, 0.9999999878F, 0.9999999937F, 0.9999999972F, - 0.9999999990F, 0.9999999997F, 1.0000000000F, 1.0000000000F, -}; - -static const float vwin4096[2048] = { - 0.0000002310F, 0.0000020791F, 0.0000057754F, 0.0000113197F, - 0.0000187121F, 0.0000279526F, 0.0000390412F, 0.0000519777F, - 0.0000667623F, 0.0000833949F, 0.0001018753F, 0.0001222036F, - 0.0001443798F, 0.0001684037F, 0.0001942754F, 0.0002219947F, - 0.0002515616F, 0.0002829761F, 0.0003162380F, 0.0003513472F, - 0.0003883038F, 0.0004271076F, 0.0004677584F, 0.0005102563F, - 0.0005546011F, 0.0006007928F, 0.0006488311F, 0.0006987160F, - 0.0007504474F, 0.0008040251F, 0.0008594490F, 0.0009167191F, - 0.0009758351F, 0.0010367969F, 0.0010996044F, 0.0011642574F, - 0.0012307558F, 0.0012990994F, 0.0013692880F, 0.0014413216F, - 0.0015151998F, 0.0015909226F, 0.0016684898F, 0.0017479011F, - 0.0018291565F, 0.0019122556F, 0.0019971983F, 0.0020839845F, - 0.0021726138F, 0.0022630861F, 0.0023554012F, 0.0024495588F, - 0.0025455588F, 0.0026434008F, 0.0027430847F, 0.0028446103F, - 0.0029479772F, 0.0030531853F, 0.0031602342F, 0.0032691238F, - 0.0033798538F, 0.0034924239F, 0.0036068338F, 0.0037230833F, - 0.0038411721F, 0.0039610999F, 0.0040828664F, 0.0042064714F, - 0.0043319145F, 0.0044591954F, 0.0045883139F, 0.0047192696F, - 0.0048520622F, 0.0049866914F, 0.0051231569F, 0.0052614583F, - 0.0054015953F, 0.0055435676F, 0.0056873748F, 0.0058330166F, - 0.0059804926F, 0.0061298026F, 0.0062809460F, 0.0064339226F, - 0.0065887320F, 0.0067453738F, 0.0069038476F, 0.0070641531F, - 0.0072262899F, 0.0073902575F, 0.0075560556F, 0.0077236838F, - 0.0078931417F, 0.0080644288F, 0.0082375447F, 0.0084124891F, - 0.0085892615F, 0.0087678614F, 0.0089482885F, 0.0091305422F, - 0.0093146223F, 0.0095005281F, 0.0096882592F, 0.0098778153F, - 0.0100691958F, 0.0102624002F, 0.0104574281F, 0.0106542791F, - 0.0108529525F, 0.0110534480F, 0.0112557651F, 0.0114599032F, - 0.0116658618F, 0.0118736405F, 0.0120832387F, 0.0122946560F, - 0.0125078917F, 0.0127229454F, 0.0129398166F, 0.0131585046F, - 0.0133790090F, 0.0136013292F, 0.0138254647F, 0.0140514149F, - 0.0142791792F, 0.0145087572F, 0.0147401481F, 0.0149733515F, - 0.0152083667F, 0.0154451932F, 0.0156838304F, 0.0159242777F, - 0.0161665345F, 0.0164106001F, 0.0166564741F, 0.0169041557F, - 0.0171536443F, 0.0174049393F, 0.0176580401F, 0.0179129461F, - 0.0181696565F, 0.0184281708F, 0.0186884883F, 0.0189506084F, - 0.0192145303F, 0.0194802535F, 0.0197477772F, 0.0200171008F, - 0.0202882236F, 0.0205611449F, 0.0208358639F, 0.0211123801F, - 0.0213906927F, 0.0216708011F, 0.0219527043F, 0.0222364019F, - 0.0225218930F, 0.0228091769F, 0.0230982529F, 0.0233891203F, - 0.0236817782F, 0.0239762259F, 0.0242724628F, 0.0245704880F, - 0.0248703007F, 0.0251719002F, 0.0254752858F, 0.0257804565F, - 0.0260874117F, 0.0263961506F, 0.0267066722F, 0.0270189760F, - 0.0273330609F, 0.0276489263F, 0.0279665712F, 0.0282859949F, - 0.0286071966F, 0.0289301753F, 0.0292549303F, 0.0295814607F, - 0.0299097656F, 0.0302398442F, 0.0305716957F, 0.0309053191F, - 0.0312407135F, 0.0315778782F, 0.0319168122F, 0.0322575145F, - 0.0325999844F, 0.0329442209F, 0.0332902231F, 0.0336379900F, - 0.0339875208F, 0.0343388146F, 0.0346918703F, 0.0350466871F, - 0.0354032640F, 0.0357616000F, 0.0361216943F, 0.0364835458F, - 0.0368471535F, 0.0372125166F, 0.0375796339F, 0.0379485046F, - 0.0383191276F, 0.0386915020F, 0.0390656267F, 0.0394415008F, - 0.0398191231F, 0.0401984927F, 0.0405796086F, 0.0409624698F, - 0.0413470751F, 0.0417334235F, 0.0421215141F, 0.0425113457F, - 0.0429029172F, 0.0432962277F, 0.0436912760F, 0.0440880610F, - 0.0444865817F, 0.0448868370F, 0.0452888257F, 0.0456925468F, - 0.0460979992F, 0.0465051816F, 0.0469140931F, 0.0473247325F, - 0.0477370986F, 0.0481511902F, 0.0485670064F, 0.0489845458F, - 0.0494038074F, 0.0498247899F, 0.0502474922F, 0.0506719131F, - 0.0510980514F, 0.0515259060F, 0.0519554756F, 0.0523867590F, - 0.0528197550F, 0.0532544624F, 0.0536908800F, 0.0541290066F, - 0.0545688408F, 0.0550103815F, 0.0554536274F, 0.0558985772F, - 0.0563452297F, 0.0567935837F, 0.0572436377F, 0.0576953907F, - 0.0581488412F, 0.0586039880F, 0.0590608297F, 0.0595193651F, - 0.0599795929F, 0.0604415117F, 0.0609051202F, 0.0613704170F, - 0.0618374009F, 0.0623060704F, 0.0627764243F, 0.0632484611F, - 0.0637221795F, 0.0641975781F, 0.0646746555F, 0.0651534104F, - 0.0656338413F, 0.0661159469F, 0.0665997257F, 0.0670851763F, - 0.0675722973F, 0.0680610873F, 0.0685515448F, 0.0690436684F, - 0.0695374567F, 0.0700329081F, 0.0705300213F, 0.0710287947F, - 0.0715292269F, 0.0720313163F, 0.0725350616F, 0.0730404612F, - 0.0735475136F, 0.0740562172F, 0.0745665707F, 0.0750785723F, - 0.0755922207F, 0.0761075143F, 0.0766244515F, 0.0771430307F, - 0.0776632505F, 0.0781851092F, 0.0787086052F, 0.0792337371F, - 0.0797605032F, 0.0802889018F, 0.0808189315F, 0.0813505905F, - 0.0818838773F, 0.0824187903F, 0.0829553277F, 0.0834934881F, - 0.0840332697F, 0.0845746708F, 0.0851176899F, 0.0856623252F, - 0.0862085751F, 0.0867564379F, 0.0873059119F, 0.0878569954F, - 0.0884096867F, 0.0889639840F, 0.0895198858F, 0.0900773902F, - 0.0906364955F, 0.0911972000F, 0.0917595019F, 0.0923233995F, - 0.0928888909F, 0.0934559745F, 0.0940246485F, 0.0945949110F, - 0.0951667604F, 0.0957401946F, 0.0963152121F, 0.0968918109F, - 0.0974699893F, 0.0980497454F, 0.0986310773F, 0.0992139832F, - 0.0997984614F, 0.1003845098F, 0.1009721267F, 0.1015613101F, - 0.1021520582F, 0.1027443692F, 0.1033382410F, 0.1039336718F, - 0.1045306597F, 0.1051292027F, 0.1057292990F, 0.1063309466F, - 0.1069341435F, 0.1075388878F, 0.1081451776F, 0.1087530108F, - 0.1093623856F, 0.1099732998F, 0.1105857516F, 0.1111997389F, - 0.1118152597F, 0.1124323121F, 0.1130508939F, 0.1136710032F, - 0.1142926379F, 0.1149157960F, 0.1155404755F, 0.1161666742F, - 0.1167943901F, 0.1174236211F, 0.1180543652F, 0.1186866202F, - 0.1193203841F, 0.1199556548F, 0.1205924300F, 0.1212307078F, - 0.1218704860F, 0.1225117624F, 0.1231545349F, 0.1237988013F, - 0.1244445596F, 0.1250918074F, 0.1257405427F, 0.1263907632F, - 0.1270424667F, 0.1276956512F, 0.1283503142F, 0.1290064537F, - 0.1296640674F, 0.1303231530F, 0.1309837084F, 0.1316457312F, - 0.1323092193F, 0.1329741703F, 0.1336405820F, 0.1343084520F, - 0.1349777782F, 0.1356485582F, 0.1363207897F, 0.1369944704F, - 0.1376695979F, 0.1383461700F, 0.1390241842F, 0.1397036384F, - 0.1403845300F, 0.1410668567F, 0.1417506162F, 0.1424358061F, - 0.1431224240F, 0.1438104674F, 0.1444999341F, 0.1451908216F, - 0.1458831274F, 0.1465768492F, 0.1472719844F, 0.1479685308F, - 0.1486664857F, 0.1493658468F, 0.1500666115F, 0.1507687775F, - 0.1514723422F, 0.1521773031F, 0.1528836577F, 0.1535914035F, - 0.1543005380F, 0.1550110587F, 0.1557229631F, 0.1564362485F, - 0.1571509124F, 0.1578669524F, 0.1585843657F, 0.1593031499F, - 0.1600233024F, 0.1607448205F, 0.1614677017F, 0.1621919433F, - 0.1629175428F, 0.1636444975F, 0.1643728047F, 0.1651024619F, - 0.1658334665F, 0.1665658156F, 0.1672995067F, 0.1680345371F, - 0.1687709041F, 0.1695086050F, 0.1702476372F, 0.1709879978F, - 0.1717296843F, 0.1724726938F, 0.1732170237F, 0.1739626711F, - 0.1747096335F, 0.1754579079F, 0.1762074916F, 0.1769583819F, - 0.1777105760F, 0.1784640710F, 0.1792188642F, 0.1799749529F, - 0.1807323340F, 0.1814910049F, 0.1822509628F, 0.1830122046F, - 0.1837747277F, 0.1845385292F, 0.1853036062F, 0.1860699558F, - 0.1868375751F, 0.1876064613F, 0.1883766114F, 0.1891480226F, - 0.1899206919F, 0.1906946164F, 0.1914697932F, 0.1922462194F, - 0.1930238919F, 0.1938028079F, 0.1945829643F, 0.1953643583F, - 0.1961469868F, 0.1969308468F, 0.1977159353F, 0.1985022494F, - 0.1992897859F, 0.2000785420F, 0.2008685145F, 0.2016597005F, - 0.2024520968F, 0.2032457005F, 0.2040405084F, 0.2048365175F, - 0.2056337247F, 0.2064321269F, 0.2072317211F, 0.2080325041F, - 0.2088344727F, 0.2096376240F, 0.2104419547F, 0.2112474618F, - 0.2120541420F, 0.2128619923F, 0.2136710094F, 0.2144811902F, - 0.2152925315F, 0.2161050301F, 0.2169186829F, 0.2177334866F, - 0.2185494381F, 0.2193665340F, 0.2201847712F, 0.2210041465F, - 0.2218246565F, 0.2226462981F, 0.2234690680F, 0.2242929629F, - 0.2251179796F, 0.2259441147F, 0.2267713650F, 0.2275997272F, - 0.2284291979F, 0.2292597739F, 0.2300914518F, 0.2309242283F, - 0.2317581001F, 0.2325930638F, 0.2334291160F, 0.2342662534F, - 0.2351044727F, 0.2359437703F, 0.2367841431F, 0.2376255875F, - 0.2384681001F, 0.2393116776F, 0.2401563165F, 0.2410020134F, - 0.2418487649F, 0.2426965675F, 0.2435454178F, 0.2443953122F, - 0.2452462474F, 0.2460982199F, 0.2469512262F, 0.2478052628F, - 0.2486603262F, 0.2495164129F, 0.2503735194F, 0.2512316421F, - 0.2520907776F, 0.2529509222F, 0.2538120726F, 0.2546742250F, - 0.2555373760F, 0.2564015219F, 0.2572666593F, 0.2581327845F, - 0.2589998939F, 0.2598679840F, 0.2607370510F, 0.2616070916F, - 0.2624781019F, 0.2633500783F, 0.2642230173F, 0.2650969152F, - 0.2659717684F, 0.2668475731F, 0.2677243257F, 0.2686020226F, - 0.2694806601F, 0.2703602344F, 0.2712407419F, 0.2721221789F, - 0.2730045417F, 0.2738878265F, 0.2747720297F, 0.2756571474F, - 0.2765431760F, 0.2774301117F, 0.2783179508F, 0.2792066895F, - 0.2800963240F, 0.2809868505F, 0.2818782654F, 0.2827705647F, - 0.2836637447F, 0.2845578016F, 0.2854527315F, 0.2863485307F, - 0.2872451953F, 0.2881427215F, 0.2890411055F, 0.2899403433F, - 0.2908404312F, 0.2917413654F, 0.2926431418F, 0.2935457567F, - 0.2944492061F, 0.2953534863F, 0.2962585932F, 0.2971645230F, - 0.2980712717F, 0.2989788356F, 0.2998872105F, 0.3007963927F, - 0.3017063781F, 0.3026171629F, 0.3035287430F, 0.3044411145F, - 0.3053542736F, 0.3062682161F, 0.3071829381F, 0.3080984356F, - 0.3090147047F, 0.3099317413F, 0.3108495414F, 0.3117681011F, - 0.3126874163F, 0.3136074830F, 0.3145282972F, 0.3154498548F, - 0.3163721517F, 0.3172951841F, 0.3182189477F, 0.3191434385F, - 0.3200686525F, 0.3209945856F, 0.3219212336F, 0.3228485927F, - 0.3237766585F, 0.3247054271F, 0.3256348943F, 0.3265650560F, - 0.3274959081F, 0.3284274465F, 0.3293596671F, 0.3302925657F, - 0.3312261382F, 0.3321603804F, 0.3330952882F, 0.3340308574F, - 0.3349670838F, 0.3359039634F, 0.3368414919F, 0.3377796651F, - 0.3387184789F, 0.3396579290F, 0.3405980113F, 0.3415387216F, - 0.3424800556F, 0.3434220091F, 0.3443645779F, 0.3453077578F, - 0.3462515446F, 0.3471959340F, 0.3481409217F, 0.3490865036F, - 0.3500326754F, 0.3509794328F, 0.3519267715F, 0.3528746873F, - 0.3538231759F, 0.3547722330F, 0.3557218544F, 0.3566720357F, - 0.3576227727F, 0.3585740610F, 0.3595258964F, 0.3604782745F, - 0.3614311910F, 0.3623846417F, 0.3633386221F, 0.3642931280F, - 0.3652481549F, 0.3662036987F, 0.3671597548F, 0.3681163191F, - 0.3690733870F, 0.3700309544F, 0.3709890167F, 0.3719475696F, - 0.3729066089F, 0.3738661299F, 0.3748261285F, 0.3757866002F, - 0.3767475406F, 0.3777089453F, 0.3786708100F, 0.3796331302F, - 0.3805959014F, 0.3815591194F, 0.3825227796F, 0.3834868777F, - 0.3844514093F, 0.3854163698F, 0.3863817549F, 0.3873475601F, - 0.3883137810F, 0.3892804131F, 0.3902474521F, 0.3912148933F, - 0.3921827325F, 0.3931509650F, 0.3941195865F, 0.3950885925F, - 0.3960579785F, 0.3970277400F, 0.3979978725F, 0.3989683716F, - 0.3999392328F, 0.4009104516F, 0.4018820234F, 0.4028539438F, - 0.4038262084F, 0.4047988125F, 0.4057717516F, 0.4067450214F, - 0.4077186172F, 0.4086925345F, 0.4096667688F, 0.4106413155F, - 0.4116161703F, 0.4125913284F, 0.4135667854F, 0.4145425368F, - 0.4155185780F, 0.4164949044F, 0.4174715116F, 0.4184483949F, - 0.4194255498F, 0.4204029718F, 0.4213806563F, 0.4223585987F, - 0.4233367946F, 0.4243152392F, 0.4252939281F, 0.4262728566F, - 0.4272520202F, 0.4282314144F, 0.4292110345F, 0.4301908760F, - 0.4311709343F, 0.4321512047F, 0.4331316828F, 0.4341123639F, - 0.4350932435F, 0.4360743168F, 0.4370555794F, 0.4380370267F, - 0.4390186540F, 0.4400004567F, 0.4409824303F, 0.4419645701F, - 0.4429468716F, 0.4439293300F, 0.4449119409F, 0.4458946996F, - 0.4468776014F, 0.4478606418F, 0.4488438162F, 0.4498271199F, - 0.4508105483F, 0.4517940967F, 0.4527777607F, 0.4537615355F, - 0.4547454165F, 0.4557293991F, 0.4567134786F, 0.4576976505F, - 0.4586819101F, 0.4596662527F, 0.4606506738F, 0.4616351687F, - 0.4626197328F, 0.4636043614F, 0.4645890499F, 0.4655737936F, - 0.4665585880F, 0.4675434284F, 0.4685283101F, 0.4695132286F, - 0.4704981791F, 0.4714831570F, 0.4724681577F, 0.4734531766F, - 0.4744382089F, 0.4754232501F, 0.4764082956F, 0.4773933406F, - 0.4783783806F, 0.4793634108F, 0.4803484267F, 0.4813334237F, - 0.4823183969F, 0.4833033419F, 0.4842882540F, 0.4852731285F, - 0.4862579608F, 0.4872427462F, 0.4882274802F, 0.4892121580F, - 0.4901967751F, 0.4911813267F, 0.4921658083F, 0.4931502151F, - 0.4941345427F, 0.4951187863F, 0.4961029412F, 0.4970870029F, - 0.4980709667F, 0.4990548280F, 0.5000385822F, 0.5010222245F, - 0.5020057505F, 0.5029891553F, 0.5039724345F, 0.5049555834F, - 0.5059385973F, 0.5069214716F, 0.5079042018F, 0.5088867831F, - 0.5098692110F, 0.5108514808F, 0.5118335879F, 0.5128155277F, - 0.5137972956F, 0.5147788869F, 0.5157602971F, 0.5167415215F, - 0.5177225555F, 0.5187033945F, 0.5196840339F, 0.5206644692F, - 0.5216446956F, 0.5226247086F, 0.5236045035F, 0.5245840759F, - 0.5255634211F, 0.5265425344F, 0.5275214114F, 0.5285000474F, - 0.5294784378F, 0.5304565781F, 0.5314344637F, 0.5324120899F, - 0.5333894522F, 0.5343665461F, 0.5353433670F, 0.5363199102F, - 0.5372961713F, 0.5382721457F, 0.5392478287F, 0.5402232159F, - 0.5411983027F, 0.5421730845F, 0.5431475569F, 0.5441217151F, - 0.5450955548F, 0.5460690714F, 0.5470422602F, 0.5480151169F, - 0.5489876368F, 0.5499598155F, 0.5509316484F, 0.5519031310F, - 0.5528742587F, 0.5538450271F, 0.5548154317F, 0.5557854680F, - 0.5567551314F, 0.5577244174F, 0.5586933216F, 0.5596618395F, - 0.5606299665F, 0.5615976983F, 0.5625650302F, 0.5635319580F, - 0.5644984770F, 0.5654645828F, 0.5664302709F, 0.5673955370F, - 0.5683603765F, 0.5693247850F, 0.5702887580F, 0.5712522912F, - 0.5722153800F, 0.5731780200F, 0.5741402069F, 0.5751019362F, - 0.5760632034F, 0.5770240042F, 0.5779843341F, 0.5789441889F, - 0.5799035639F, 0.5808624549F, 0.5818208575F, 0.5827787673F, - 0.5837361800F, 0.5846930910F, 0.5856494961F, 0.5866053910F, - 0.5875607712F, 0.5885156324F, 0.5894699703F, 0.5904237804F, - 0.5913770586F, 0.5923298004F, 0.5932820016F, 0.5942336578F, - 0.5951847646F, 0.5961353179F, 0.5970853132F, 0.5980347464F, - 0.5989836131F, 0.5999319090F, 0.6008796298F, 0.6018267713F, - 0.6027733292F, 0.6037192993F, 0.6046646773F, 0.6056094589F, - 0.6065536400F, 0.6074972162F, 0.6084401833F, 0.6093825372F, - 0.6103242736F, 0.6112653884F, 0.6122058772F, 0.6131457359F, - 0.6140849604F, 0.6150235464F, 0.6159614897F, 0.6168987862F, - 0.6178354318F, 0.6187714223F, 0.6197067535F, 0.6206414213F, - 0.6215754215F, 0.6225087501F, 0.6234414028F, 0.6243733757F, - 0.6253046646F, 0.6262352654F, 0.6271651739F, 0.6280943862F, - 0.6290228982F, 0.6299507057F, 0.6308778048F, 0.6318041913F, - 0.6327298612F, 0.6336548105F, 0.6345790352F, 0.6355025312F, - 0.6364252945F, 0.6373473211F, 0.6382686070F, 0.6391891483F, - 0.6401089409F, 0.6410279808F, 0.6419462642F, 0.6428637869F, - 0.6437805452F, 0.6446965350F, 0.6456117524F, 0.6465261935F, - 0.6474398544F, 0.6483527311F, 0.6492648197F, 0.6501761165F, - 0.6510866174F, 0.6519963186F, 0.6529052162F, 0.6538133064F, - 0.6547205854F, 0.6556270492F, 0.6565326941F, 0.6574375162F, - 0.6583415117F, 0.6592446769F, 0.6601470079F, 0.6610485009F, - 0.6619491521F, 0.6628489578F, 0.6637479143F, 0.6646460177F, - 0.6655432643F, 0.6664396505F, 0.6673351724F, 0.6682298264F, - 0.6691236087F, 0.6700165157F, 0.6709085436F, 0.6717996889F, - 0.6726899478F, 0.6735793167F, 0.6744677918F, 0.6753553697F, - 0.6762420466F, 0.6771278190F, 0.6780126832F, 0.6788966357F, - 0.6797796728F, 0.6806617909F, 0.6815429866F, 0.6824232562F, - 0.6833025961F, 0.6841810030F, 0.6850584731F, 0.6859350031F, - 0.6868105894F, 0.6876852284F, 0.6885589168F, 0.6894316510F, - 0.6903034275F, 0.6911742430F, 0.6920440939F, 0.6929129769F, - 0.6937808884F, 0.6946478251F, 0.6955137837F, 0.6963787606F, - 0.6972427525F, 0.6981057560F, 0.6989677678F, 0.6998287845F, - 0.7006888028F, 0.7015478194F, 0.7024058309F, 0.7032628340F, - 0.7041188254F, 0.7049738019F, 0.7058277601F, 0.7066806969F, - 0.7075326089F, 0.7083834929F, 0.7092333457F, 0.7100821640F, - 0.7109299447F, 0.7117766846F, 0.7126223804F, 0.7134670291F, - 0.7143106273F, 0.7151531721F, 0.7159946602F, 0.7168350885F, - 0.7176744539F, 0.7185127534F, 0.7193499837F, 0.7201861418F, - 0.7210212247F, 0.7218552293F, 0.7226881526F, 0.7235199914F, - 0.7243507428F, 0.7251804039F, 0.7260089715F, 0.7268364426F, - 0.7276628144F, 0.7284880839F, 0.7293122481F, 0.7301353040F, - 0.7309572487F, 0.7317780794F, 0.7325977930F, 0.7334163868F, - 0.7342338579F, 0.7350502033F, 0.7358654202F, 0.7366795059F, - 0.7374924573F, 0.7383042718F, 0.7391149465F, 0.7399244787F, - 0.7407328655F, 0.7415401041F, 0.7423461920F, 0.7431511261F, - 0.7439549040F, 0.7447575227F, 0.7455589797F, 0.7463592723F, - 0.7471583976F, 0.7479563532F, 0.7487531363F, 0.7495487443F, - 0.7503431745F, 0.7511364244F, 0.7519284913F, 0.7527193726F, - 0.7535090658F, 0.7542975683F, 0.7550848776F, 0.7558709910F, - 0.7566559062F, 0.7574396205F, 0.7582221314F, 0.7590034366F, - 0.7597835334F, 0.7605624194F, 0.7613400923F, 0.7621165495F, - 0.7628917886F, 0.7636658072F, 0.7644386030F, 0.7652101735F, - 0.7659805164F, 0.7667496292F, 0.7675175098F, 0.7682841556F, - 0.7690495645F, 0.7698137341F, 0.7705766622F, 0.7713383463F, - 0.7720987844F, 0.7728579741F, 0.7736159132F, 0.7743725994F, - 0.7751280306F, 0.7758822046F, 0.7766351192F, 0.7773867722F, - 0.7781371614F, 0.7788862848F, 0.7796341401F, 0.7803807253F, - 0.7811260383F, 0.7818700769F, 0.7826128392F, 0.7833543230F, - 0.7840945263F, 0.7848334471F, 0.7855710833F, 0.7863074330F, - 0.7870424941F, 0.7877762647F, 0.7885087428F, 0.7892399264F, - 0.7899698137F, 0.7906984026F, 0.7914256914F, 0.7921516780F, - 0.7928763607F, 0.7935997375F, 0.7943218065F, 0.7950425661F, - 0.7957620142F, 0.7964801492F, 0.7971969692F, 0.7979124724F, - 0.7986266570F, 0.7993395214F, 0.8000510638F, 0.8007612823F, - 0.8014701754F, 0.8021777413F, 0.8028839784F, 0.8035888849F, - 0.8042924592F, 0.8049946997F, 0.8056956048F, 0.8063951727F, - 0.8070934020F, 0.8077902910F, 0.8084858381F, 0.8091800419F, - 0.8098729007F, 0.8105644130F, 0.8112545774F, 0.8119433922F, - 0.8126308561F, 0.8133169676F, 0.8140017251F, 0.8146851272F, - 0.8153671726F, 0.8160478598F, 0.8167271874F, 0.8174051539F, - 0.8180817582F, 0.8187569986F, 0.8194308741F, 0.8201033831F, - 0.8207745244F, 0.8214442966F, 0.8221126986F, 0.8227797290F, - 0.8234453865F, 0.8241096700F, 0.8247725781F, 0.8254341097F, - 0.8260942636F, 0.8267530385F, 0.8274104334F, 0.8280664470F, - 0.8287210782F, 0.8293743259F, 0.8300261889F, 0.8306766662F, - 0.8313257566F, 0.8319734591F, 0.8326197727F, 0.8332646963F, - 0.8339082288F, 0.8345503692F, 0.8351911167F, 0.8358304700F, - 0.8364684284F, 0.8371049907F, 0.8377401562F, 0.8383739238F, - 0.8390062927F, 0.8396372618F, 0.8402668305F, 0.8408949977F, - 0.8415217626F, 0.8421471245F, 0.8427710823F, 0.8433936354F, - 0.8440147830F, 0.8446345242F, 0.8452528582F, 0.8458697844F, - 0.8464853020F, 0.8470994102F, 0.8477121084F, 0.8483233958F, - 0.8489332718F, 0.8495417356F, 0.8501487866F, 0.8507544243F, - 0.8513586479F, 0.8519614568F, 0.8525628505F, 0.8531628283F, - 0.8537613897F, 0.8543585341F, 0.8549542611F, 0.8555485699F, - 0.8561414603F, 0.8567329315F, 0.8573229832F, 0.8579116149F, - 0.8584988262F, 0.8590846165F, 0.8596689855F, 0.8602519327F, - 0.8608334577F, 0.8614135603F, 0.8619922399F, 0.8625694962F, - 0.8631453289F, 0.8637197377F, 0.8642927222F, 0.8648642821F, - 0.8654344172F, 0.8660031272F, 0.8665704118F, 0.8671362708F, - 0.8677007039F, 0.8682637109F, 0.8688252917F, 0.8693854460F, - 0.8699441737F, 0.8705014745F, 0.8710573485F, 0.8716117953F, - 0.8721648150F, 0.8727164073F, 0.8732665723F, 0.8738153098F, - 0.8743626197F, 0.8749085021F, 0.8754529569F, 0.8759959840F, - 0.8765375835F, 0.8770777553F, 0.8776164996F, 0.8781538162F, - 0.8786897054F, 0.8792241670F, 0.8797572013F, 0.8802888082F, - 0.8808189880F, 0.8813477407F, 0.8818750664F, 0.8824009653F, - 0.8829254375F, 0.8834484833F, 0.8839701028F, 0.8844902961F, - 0.8850090636F, 0.8855264054F, 0.8860423218F, 0.8865568131F, - 0.8870698794F, 0.8875815212F, 0.8880917386F, 0.8886005319F, - 0.8891079016F, 0.8896138479F, 0.8901183712F, 0.8906214719F, - 0.8911231503F, 0.8916234067F, 0.8921222417F, 0.8926196556F, - 0.8931156489F, 0.8936102219F, 0.8941033752F, 0.8945951092F, - 0.8950854244F, 0.8955743212F, 0.8960618003F, 0.8965478621F, - 0.8970325071F, 0.8975157359F, 0.8979975490F, 0.8984779471F, - 0.8989569307F, 0.8994345004F, 0.8999106568F, 0.9003854005F, - 0.9008587323F, 0.9013306526F, 0.9018011623F, 0.9022702619F, - 0.9027379521F, 0.9032042337F, 0.9036691074F, 0.9041325739F, - 0.9045946339F, 0.9050552882F, 0.9055145376F, 0.9059723828F, - 0.9064288246F, 0.9068838638F, 0.9073375013F, 0.9077897379F, - 0.9082405743F, 0.9086900115F, 0.9091380503F, 0.9095846917F, - 0.9100299364F, 0.9104737854F, 0.9109162397F, 0.9113573001F, - 0.9117969675F, 0.9122352430F, 0.9126721275F, 0.9131076219F, - 0.9135417273F, 0.9139744447F, 0.9144057750F, 0.9148357194F, - 0.9152642787F, 0.9156914542F, 0.9161172468F, 0.9165416576F, - 0.9169646877F, 0.9173863382F, 0.9178066102F, 0.9182255048F, - 0.9186430232F, 0.9190591665F, 0.9194739359F, 0.9198873324F, - 0.9202993574F, 0.9207100120F, 0.9211192973F, 0.9215272147F, - 0.9219337653F, 0.9223389504F, 0.9227427713F, 0.9231452290F, - 0.9235463251F, 0.9239460607F, 0.9243444371F, 0.9247414557F, - 0.9251371177F, 0.9255314245F, 0.9259243774F, 0.9263159778F, - 0.9267062270F, 0.9270951264F, 0.9274826774F, 0.9278688814F, - 0.9282537398F, 0.9286372540F, 0.9290194254F, 0.9294002555F, - 0.9297797458F, 0.9301578976F, 0.9305347125F, 0.9309101919F, - 0.9312843373F, 0.9316571503F, 0.9320286323F, 0.9323987849F, - 0.9327676097F, 0.9331351080F, 0.9335012816F, 0.9338661320F, - 0.9342296607F, 0.9345918694F, 0.9349527596F, 0.9353123330F, - 0.9356705911F, 0.9360275357F, 0.9363831683F, 0.9367374905F, - 0.9370905042F, 0.9374422108F, 0.9377926122F, 0.9381417099F, - 0.9384895057F, 0.9388360014F, 0.9391811985F, 0.9395250989F, - 0.9398677043F, 0.9402090165F, 0.9405490371F, 0.9408877680F, - 0.9412252110F, 0.9415613678F, 0.9418962402F, 0.9422298301F, - 0.9425621392F, 0.9428931695F, 0.9432229226F, 0.9435514005F, - 0.9438786050F, 0.9442045381F, 0.9445292014F, 0.9448525971F, - 0.9451747268F, 0.9454955926F, 0.9458151963F, 0.9461335399F, - 0.9464506253F, 0.9467664545F, 0.9470810293F, 0.9473943517F, - 0.9477064238F, 0.9480172474F, 0.9483268246F, 0.9486351573F, - 0.9489422475F, 0.9492480973F, 0.9495527087F, 0.9498560837F, - 0.9501582243F, 0.9504591325F, 0.9507588105F, 0.9510572603F, - 0.9513544839F, 0.9516504834F, 0.9519452609F, 0.9522388186F, - 0.9525311584F, 0.9528222826F, 0.9531121932F, 0.9534008923F, - 0.9536883821F, 0.9539746647F, 0.9542597424F, 0.9545436171F, - 0.9548262912F, 0.9551077667F, 0.9553880459F, 0.9556671309F, - 0.9559450239F, 0.9562217272F, 0.9564972429F, 0.9567715733F, - 0.9570447206F, 0.9573166871F, 0.9575874749F, 0.9578570863F, - 0.9581255236F, 0.9583927890F, 0.9586588849F, 0.9589238134F, - 0.9591875769F, 0.9594501777F, 0.9597116180F, 0.9599719003F, - 0.9602310267F, 0.9604889995F, 0.9607458213F, 0.9610014942F, - 0.9612560206F, 0.9615094028F, 0.9617616433F, 0.9620127443F, - 0.9622627083F, 0.9625115376F, 0.9627592345F, 0.9630058016F, - 0.9632512411F, 0.9634955555F, 0.9637387471F, 0.9639808185F, - 0.9642217720F, 0.9644616100F, 0.9647003349F, 0.9649379493F, - 0.9651744556F, 0.9654098561F, 0.9656441534F, 0.9658773499F, - 0.9661094480F, 0.9663404504F, 0.9665703593F, 0.9667991774F, - 0.9670269071F, 0.9672535509F, 0.9674791114F, 0.9677035909F, - 0.9679269921F, 0.9681493174F, 0.9683705694F, 0.9685907506F, - 0.9688098636F, 0.9690279108F, 0.9692448948F, 0.9694608182F, - 0.9696756836F, 0.9698894934F, 0.9701022503F, 0.9703139569F, - 0.9705246156F, 0.9707342291F, 0.9709428000F, 0.9711503309F, - 0.9713568243F, 0.9715622829F, 0.9717667093F, 0.9719701060F, - 0.9721724757F, 0.9723738210F, 0.9725741446F, 0.9727734490F, - 0.9729717369F, 0.9731690109F, 0.9733652737F, 0.9735605279F, - 0.9737547762F, 0.9739480212F, 0.9741402656F, 0.9743315120F, - 0.9745217631F, 0.9747110216F, 0.9748992901F, 0.9750865714F, - 0.9752728681F, 0.9754581829F, 0.9756425184F, 0.9758258775F, - 0.9760082627F, 0.9761896768F, 0.9763701224F, 0.9765496024F, - 0.9767281193F, 0.9769056760F, 0.9770822751F, 0.9772579193F, - 0.9774326114F, 0.9776063542F, 0.9777791502F, 0.9779510023F, - 0.9781219133F, 0.9782918858F, 0.9784609226F, 0.9786290264F, - 0.9787962000F, 0.9789624461F, 0.9791277676F, 0.9792921671F, - 0.9794556474F, 0.9796182113F, 0.9797798615F, 0.9799406009F, - 0.9801004321F, 0.9802593580F, 0.9804173813F, 0.9805745049F, - 0.9807307314F, 0.9808860637F, 0.9810405046F, 0.9811940568F, - 0.9813467232F, 0.9814985065F, 0.9816494095F, 0.9817994351F, - 0.9819485860F, 0.9820968650F, 0.9822442750F, 0.9823908186F, - 0.9825364988F, 0.9826813184F, 0.9828252801F, 0.9829683868F, - 0.9831106413F, 0.9832520463F, 0.9833926048F, 0.9835323195F, - 0.9836711932F, 0.9838092288F, 0.9839464291F, 0.9840827969F, - 0.9842183351F, 0.9843530464F, 0.9844869337F, 0.9846199998F, - 0.9847522475F, 0.9848836798F, 0.9850142993F, 0.9851441090F, - 0.9852731117F, 0.9854013101F, 0.9855287073F, 0.9856553058F, - 0.9857811087F, 0.9859061188F, 0.9860303388F, 0.9861537717F, - 0.9862764202F, 0.9863982872F, 0.9865193756F, 0.9866396882F, - 0.9867592277F, 0.9868779972F, 0.9869959993F, 0.9871132370F, - 0.9872297131F, 0.9873454304F, 0.9874603918F, 0.9875746001F, - 0.9876880581F, 0.9878007688F, 0.9879127348F, 0.9880239592F, - 0.9881344447F, 0.9882441941F, 0.9883532104F, 0.9884614962F, - 0.9885690546F, 0.9886758883F, 0.9887820001F, 0.9888873930F, - 0.9889920697F, 0.9890960331F, 0.9891992859F, 0.9893018312F, - 0.9894036716F, 0.9895048100F, 0.9896052493F, 0.9897049923F, - 0.9898040418F, 0.9899024006F, 0.9900000717F, 0.9900970577F, - 0.9901933616F, 0.9902889862F, 0.9903839343F, 0.9904782087F, - 0.9905718122F, 0.9906647477F, 0.9907570180F, 0.9908486259F, - 0.9909395742F, 0.9910298658F, 0.9911195034F, 0.9912084899F, - 0.9912968281F, 0.9913845208F, 0.9914715708F, 0.9915579810F, - 0.9916437540F, 0.9917288928F, 0.9918134001F, 0.9918972788F, - 0.9919805316F, 0.9920631613F, 0.9921451707F, 0.9922265626F, - 0.9923073399F, 0.9923875052F, 0.9924670615F, 0.9925460114F, - 0.9926243577F, 0.9927021033F, 0.9927792508F, 0.9928558032F, - 0.9929317631F, 0.9930071333F, 0.9930819167F, 0.9931561158F, - 0.9932297337F, 0.9933027728F, 0.9933752362F, 0.9934471264F, - 0.9935184462F, 0.9935891985F, 0.9936593859F, 0.9937290112F, - 0.9937980771F, 0.9938665864F, 0.9939345418F, 0.9940019460F, - 0.9940688018F, 0.9941351118F, 0.9942008789F, 0.9942661057F, - 0.9943307950F, 0.9943949494F, 0.9944585717F, 0.9945216645F, - 0.9945842307F, 0.9946462728F, 0.9947077936F, 0.9947687957F, - 0.9948292820F, 0.9948892550F, 0.9949487174F, 0.9950076719F, - 0.9950661212F, 0.9951240679F, 0.9951815148F, 0.9952384645F, - 0.9952949196F, 0.9953508828F, 0.9954063568F, 0.9954613442F, - 0.9955158476F, 0.9955698697F, 0.9956234132F, 0.9956764806F, - 0.9957290746F, 0.9957811978F, 0.9958328528F, 0.9958840423F, - 0.9959347688F, 0.9959850351F, 0.9960348435F, 0.9960841969F, - 0.9961330977F, 0.9961815486F, 0.9962295521F, 0.9962771108F, - 0.9963242274F, 0.9963709043F, 0.9964171441F, 0.9964629494F, - 0.9965083228F, 0.9965532668F, 0.9965977840F, 0.9966418768F, - 0.9966855479F, 0.9967287998F, 0.9967716350F, 0.9968140559F, - 0.9968560653F, 0.9968976655F, 0.9969388591F, 0.9969796485F, - 0.9970200363F, 0.9970600250F, 0.9970996170F, 0.9971388149F, - 0.9971776211F, 0.9972160380F, 0.9972540683F, 0.9972917142F, - 0.9973289783F, 0.9973658631F, 0.9974023709F, 0.9974385042F, - 0.9974742655F, 0.9975096571F, 0.9975446816F, 0.9975793413F, - 0.9976136386F, 0.9976475759F, 0.9976811557F, 0.9977143803F, - 0.9977472521F, 0.9977797736F, 0.9978119470F, 0.9978437748F, - 0.9978752593F, 0.9979064029F, 0.9979372079F, 0.9979676768F, - 0.9979978117F, 0.9980276151F, 0.9980570893F, 0.9980862367F, - 0.9981150595F, 0.9981435600F, 0.9981717406F, 0.9981996035F, - 0.9982271511F, 0.9982543856F, 0.9982813093F, 0.9983079246F, - 0.9983342336F, 0.9983602386F, 0.9983859418F, 0.9984113456F, - 0.9984364522F, 0.9984612638F, 0.9984857825F, 0.9985100108F, - 0.9985339507F, 0.9985576044F, 0.9985809743F, 0.9986040624F, - 0.9986268710F, 0.9986494022F, 0.9986716583F, 0.9986936413F, - 0.9987153535F, 0.9987367969F, 0.9987579738F, 0.9987788864F, - 0.9987995366F, 0.9988199267F, 0.9988400587F, 0.9988599348F, - 0.9988795572F, 0.9988989278F, 0.9989180487F, 0.9989369222F, - 0.9989555501F, 0.9989739347F, 0.9989920780F, 0.9990099820F, - 0.9990276487F, 0.9990450803F, 0.9990622787F, 0.9990792460F, - 0.9990959841F, 0.9991124952F, 0.9991287812F, 0.9991448440F, - 0.9991606858F, 0.9991763084F, 0.9991917139F, 0.9992069042F, - 0.9992218813F, 0.9992366471F, 0.9992512035F, 0.9992655525F, - 0.9992796961F, 0.9992936361F, 0.9993073744F, 0.9993209131F, - 0.9993342538F, 0.9993473987F, 0.9993603494F, 0.9993731080F, - 0.9993856762F, 0.9993980559F, 0.9994102490F, 0.9994222573F, - 0.9994340827F, 0.9994457269F, 0.9994571918F, 0.9994684793F, - 0.9994795910F, 0.9994905288F, 0.9995012945F, 0.9995118898F, - 0.9995223165F, 0.9995325765F, 0.9995426713F, 0.9995526029F, - 0.9995623728F, 0.9995719829F, 0.9995814349F, 0.9995907304F, - 0.9995998712F, 0.9996088590F, 0.9996176954F, 0.9996263821F, - 0.9996349208F, 0.9996433132F, 0.9996515609F, 0.9996596656F, - 0.9996676288F, 0.9996754522F, 0.9996831375F, 0.9996906862F, - 0.9996981000F, 0.9997053804F, 0.9997125290F, 0.9997195474F, - 0.9997264371F, 0.9997331998F, 0.9997398369F, 0.9997463500F, - 0.9997527406F, 0.9997590103F, 0.9997651606F, 0.9997711930F, - 0.9997771089F, 0.9997829098F, 0.9997885973F, 0.9997941728F, - 0.9997996378F, 0.9998049936F, 0.9998102419F, 0.9998153839F, - 0.9998204211F, 0.9998253550F, 0.9998301868F, 0.9998349182F, - 0.9998395503F, 0.9998440847F, 0.9998485226F, 0.9998528654F, - 0.9998571146F, 0.9998612713F, 0.9998653370F, 0.9998693130F, - 0.9998732007F, 0.9998770012F, 0.9998807159F, 0.9998843461F, - 0.9998878931F, 0.9998913581F, 0.9998947424F, 0.9998980473F, - 0.9999012740F, 0.9999044237F, 0.9999074976F, 0.9999104971F, - 0.9999134231F, 0.9999162771F, 0.9999190601F, 0.9999217733F, - 0.9999244179F, 0.9999269950F, 0.9999295058F, 0.9999319515F, - 0.9999343332F, 0.9999366519F, 0.9999389088F, 0.9999411050F, - 0.9999432416F, 0.9999453196F, 0.9999473402F, 0.9999493044F, - 0.9999512132F, 0.9999530677F, 0.9999548690F, 0.9999566180F, - 0.9999583157F, 0.9999599633F, 0.9999615616F, 0.9999631116F, - 0.9999646144F, 0.9999660709F, 0.9999674820F, 0.9999688487F, - 0.9999701719F, 0.9999714526F, 0.9999726917F, 0.9999738900F, - 0.9999750486F, 0.9999761682F, 0.9999772497F, 0.9999782941F, - 0.9999793021F, 0.9999802747F, 0.9999812126F, 0.9999821167F, - 0.9999829878F, 0.9999838268F, 0.9999846343F, 0.9999854113F, - 0.9999861584F, 0.9999868765F, 0.9999875664F, 0.9999882287F, - 0.9999888642F, 0.9999894736F, 0.9999900577F, 0.9999906172F, - 0.9999911528F, 0.9999916651F, 0.9999921548F, 0.9999926227F, - 0.9999930693F, 0.9999934954F, 0.9999939015F, 0.9999942883F, - 0.9999946564F, 0.9999950064F, 0.9999953390F, 0.9999956547F, - 0.9999959541F, 0.9999962377F, 0.9999965062F, 0.9999967601F, - 0.9999969998F, 0.9999972260F, 0.9999974392F, 0.9999976399F, - 0.9999978285F, 0.9999980056F, 0.9999981716F, 0.9999983271F, - 0.9999984724F, 0.9999986081F, 0.9999987345F, 0.9999988521F, - 0.9999989613F, 0.9999990625F, 0.9999991562F, 0.9999992426F, - 0.9999993223F, 0.9999993954F, 0.9999994625F, 0.9999995239F, - 0.9999995798F, 0.9999996307F, 0.9999996768F, 0.9999997184F, - 0.9999997559F, 0.9999997895F, 0.9999998195F, 0.9999998462F, - 0.9999998698F, 0.9999998906F, 0.9999999088F, 0.9999999246F, - 0.9999999383F, 0.9999999500F, 0.9999999600F, 0.9999999684F, - 0.9999999754F, 0.9999999811F, 0.9999999858F, 0.9999999896F, - 0.9999999925F, 0.9999999948F, 0.9999999965F, 0.9999999978F, - 0.9999999986F, 0.9999999992F, 0.9999999996F, 0.9999999998F, - 0.9999999999F, 1.0000000000F, 1.0000000000F, 1.0000000000F, -}; + uint_fast16_t x; + uint_fast16_t sort; + uint_fast16_t low; + uint_fast16_t high; +} floor1_entry_t; -static const float vwin8192[4096] = { - 0.0000000578F, 0.0000005198F, 0.0000014438F, 0.0000028299F, - 0.0000046780F, 0.0000069882F, 0.0000097604F, 0.0000129945F, - 0.0000166908F, 0.0000208490F, 0.0000254692F, 0.0000305515F, - 0.0000360958F, 0.0000421021F, 0.0000485704F, 0.0000555006F, - 0.0000628929F, 0.0000707472F, 0.0000790635F, 0.0000878417F, - 0.0000970820F, 0.0001067842F, 0.0001169483F, 0.0001275744F, - 0.0001386625F, 0.0001502126F, 0.0001622245F, 0.0001746984F, - 0.0001876343F, 0.0002010320F, 0.0002148917F, 0.0002292132F, - 0.0002439967F, 0.0002592421F, 0.0002749493F, 0.0002911184F, - 0.0003077493F, 0.0003248421F, 0.0003423967F, 0.0003604132F, - 0.0003788915F, 0.0003978316F, 0.0004172335F, 0.0004370971F, - 0.0004574226F, 0.0004782098F, 0.0004994587F, 0.0005211694F, - 0.0005433418F, 0.0005659759F, 0.0005890717F, 0.0006126292F, - 0.0006366484F, 0.0006611292F, 0.0006860716F, 0.0007114757F, - 0.0007373414F, 0.0007636687F, 0.0007904576F, 0.0008177080F, - 0.0008454200F, 0.0008735935F, 0.0009022285F, 0.0009313250F, - 0.0009608830F, 0.0009909025F, 0.0010213834F, 0.0010523257F, - 0.0010837295F, 0.0011155946F, 0.0011479211F, 0.0011807090F, - 0.0012139582F, 0.0012476687F, 0.0012818405F, 0.0013164736F, - 0.0013515679F, 0.0013871235F, 0.0014231402F, 0.0014596182F, - 0.0014965573F, 0.0015339576F, 0.0015718190F, 0.0016101415F, - 0.0016489251F, 0.0016881698F, 0.0017278754F, 0.0017680421F, - 0.0018086698F, 0.0018497584F, 0.0018913080F, 0.0019333185F, - 0.0019757898F, 0.0020187221F, 0.0020621151F, 0.0021059690F, - 0.0021502837F, 0.0021950591F, 0.0022402953F, 0.0022859921F, - 0.0023321497F, 0.0023787679F, 0.0024258467F, 0.0024733861F, - 0.0025213861F, 0.0025698466F, 0.0026187676F, 0.0026681491F, - 0.0027179911F, 0.0027682935F, 0.0028190562F, 0.0028702794F, - 0.0029219628F, 0.0029741066F, 0.0030267107F, 0.0030797749F, - 0.0031332994F, 0.0031872841F, 0.0032417289F, 0.0032966338F, - 0.0033519988F, 0.0034078238F, 0.0034641089F, 0.0035208539F, - 0.0035780589F, 0.0036357237F, 0.0036938485F, 0.0037524331F, - 0.0038114775F, 0.0038709817F, 0.0039309456F, 0.0039913692F, - 0.0040522524F, 0.0041135953F, 0.0041753978F, 0.0042376599F, - 0.0043003814F, 0.0043635624F, 0.0044272029F, 0.0044913028F, - 0.0045558620F, 0.0046208806F, 0.0046863585F, 0.0047522955F, - 0.0048186919F, 0.0048855473F, 0.0049528619F, 0.0050206356F, - 0.0050888684F, 0.0051575601F, 0.0052267108F, 0.0052963204F, - 0.0053663890F, 0.0054369163F, 0.0055079025F, 0.0055793474F, - 0.0056512510F, 0.0057236133F, 0.0057964342F, 0.0058697137F, - 0.0059434517F, 0.0060176482F, 0.0060923032F, 0.0061674166F, - 0.0062429883F, 0.0063190183F, 0.0063955066F, 0.0064724532F, - 0.0065498579F, 0.0066277207F, 0.0067060416F, 0.0067848205F, - 0.0068640575F, 0.0069437523F, 0.0070239051F, 0.0071045157F, - 0.0071855840F, 0.0072671102F, 0.0073490940F, 0.0074315355F, - 0.0075144345F, 0.0075977911F, 0.0076816052F, 0.0077658768F, - 0.0078506057F, 0.0079357920F, 0.0080214355F, 0.0081075363F, - 0.0081940943F, 0.0082811094F, 0.0083685816F, 0.0084565108F, - 0.0085448970F, 0.0086337401F, 0.0087230401F, 0.0088127969F, - 0.0089030104F, 0.0089936807F, 0.0090848076F, 0.0091763911F, - 0.0092684311F, 0.0093609276F, 0.0094538805F, 0.0095472898F, - 0.0096411554F, 0.0097354772F, 0.0098302552F, 0.0099254894F, - 0.0100211796F, 0.0101173259F, 0.0102139281F, 0.0103109863F, - 0.0104085002F, 0.0105064700F, 0.0106048955F, 0.0107037766F, - 0.0108031133F, 0.0109029056F, 0.0110031534F, 0.0111038565F, - 0.0112050151F, 0.0113066289F, 0.0114086980F, 0.0115112222F, - 0.0116142015F, 0.0117176359F, 0.0118215252F, 0.0119258695F, - 0.0120306686F, 0.0121359225F, 0.0122416312F, 0.0123477944F, - 0.0124544123F, 0.0125614847F, 0.0126690116F, 0.0127769928F, - 0.0128854284F, 0.0129943182F, 0.0131036623F, 0.0132134604F, - 0.0133237126F, 0.0134344188F, 0.0135455790F, 0.0136571929F, - 0.0137692607F, 0.0138817821F, 0.0139947572F, 0.0141081859F, - 0.0142220681F, 0.0143364037F, 0.0144511927F, 0.0145664350F, - 0.0146821304F, 0.0147982791F, 0.0149148808F, 0.0150319355F, - 0.0151494431F, 0.0152674036F, 0.0153858168F, 0.0155046828F, - 0.0156240014F, 0.0157437726F, 0.0158639962F, 0.0159846723F, - 0.0161058007F, 0.0162273814F, 0.0163494142F, 0.0164718991F, - 0.0165948361F, 0.0167182250F, 0.0168420658F, 0.0169663584F, - 0.0170911027F, 0.0172162987F, 0.0173419462F, 0.0174680452F, - 0.0175945956F, 0.0177215974F, 0.0178490504F, 0.0179769545F, - 0.0181053098F, 0.0182341160F, 0.0183633732F, 0.0184930812F, - 0.0186232399F, 0.0187538494F, 0.0188849094F, 0.0190164200F, - 0.0191483809F, 0.0192807923F, 0.0194136539F, 0.0195469656F, - 0.0196807275F, 0.0198149394F, 0.0199496012F, 0.0200847128F, - 0.0202202742F, 0.0203562853F, 0.0204927460F, 0.0206296561F, - 0.0207670157F, 0.0209048245F, 0.0210430826F, 0.0211817899F, - 0.0213209462F, 0.0214605515F, 0.0216006057F, 0.0217411086F, - 0.0218820603F, 0.0220234605F, 0.0221653093F, 0.0223076066F, - 0.0224503521F, 0.0225935459F, 0.0227371879F, 0.0228812779F, - 0.0230258160F, 0.0231708018F, 0.0233162355F, 0.0234621169F, - 0.0236084459F, 0.0237552224F, 0.0239024462F, 0.0240501175F, - 0.0241982359F, 0.0243468015F, 0.0244958141F, 0.0246452736F, - 0.0247951800F, 0.0249455331F, 0.0250963329F, 0.0252475792F, - 0.0253992720F, 0.0255514111F, 0.0257039965F, 0.0258570281F, - 0.0260105057F, 0.0261644293F, 0.0263187987F, 0.0264736139F, - 0.0266288747F, 0.0267845811F, 0.0269407330F, 0.0270973302F, - 0.0272543727F, 0.0274118604F, 0.0275697930F, 0.0277281707F, - 0.0278869932F, 0.0280462604F, 0.0282059723F, 0.0283661287F, - 0.0285267295F, 0.0286877747F, 0.0288492641F, 0.0290111976F, - 0.0291735751F, 0.0293363965F, 0.0294996617F, 0.0296633706F, - 0.0298275231F, 0.0299921190F, 0.0301571583F, 0.0303226409F, - 0.0304885667F, 0.0306549354F, 0.0308217472F, 0.0309890017F, - 0.0311566989F, 0.0313248388F, 0.0314934211F, 0.0316624459F, - 0.0318319128F, 0.0320018220F, 0.0321721732F, 0.0323429663F, - 0.0325142013F, 0.0326858779F, 0.0328579962F, 0.0330305559F, - 0.0332035570F, 0.0333769994F, 0.0335508829F, 0.0337252074F, - 0.0338999728F, 0.0340751790F, 0.0342508259F, 0.0344269134F, - 0.0346034412F, 0.0347804094F, 0.0349578178F, 0.0351356663F, - 0.0353139548F, 0.0354926831F, 0.0356718511F, 0.0358514588F, - 0.0360315059F, 0.0362119924F, 0.0363929182F, 0.0365742831F, - 0.0367560870F, 0.0369383297F, 0.0371210113F, 0.0373041315F, - 0.0374876902F, 0.0376716873F, 0.0378561226F, 0.0380409961F, - 0.0382263077F, 0.0384120571F, 0.0385982443F, 0.0387848691F, - 0.0389719315F, 0.0391594313F, 0.0393473683F, 0.0395357425F, - 0.0397245537F, 0.0399138017F, 0.0401034866F, 0.0402936080F, - 0.0404841660F, 0.0406751603F, 0.0408665909F, 0.0410584576F, - 0.0412507603F, 0.0414434988F, 0.0416366731F, 0.0418302829F, - 0.0420243282F, 0.0422188088F, 0.0424137246F, 0.0426090755F, - 0.0428048613F, 0.0430010819F, 0.0431977371F, 0.0433948269F, - 0.0435923511F, 0.0437903095F, 0.0439887020F, 0.0441875285F, - 0.0443867889F, 0.0445864830F, 0.0447866106F, 0.0449871717F, - 0.0451881661F, 0.0453895936F, 0.0455914542F, 0.0457937477F, - 0.0459964738F, 0.0461996326F, 0.0464032239F, 0.0466072475F, - 0.0468117032F, 0.0470165910F, 0.0472219107F, 0.0474276622F, - 0.0476338452F, 0.0478404597F, 0.0480475056F, 0.0482549827F, - 0.0484628907F, 0.0486712297F, 0.0488799994F, 0.0490891998F, - 0.0492988306F, 0.0495088917F, 0.0497193830F, 0.0499303043F, - 0.0501416554F, 0.0503534363F, 0.0505656468F, 0.0507782867F, - 0.0509913559F, 0.0512048542F, 0.0514187815F, 0.0516331376F, - 0.0518479225F, 0.0520631358F, 0.0522787775F, 0.0524948475F, - 0.0527113455F, 0.0529282715F, 0.0531456252F, 0.0533634066F, - 0.0535816154F, 0.0538002515F, 0.0540193148F, 0.0542388051F, - 0.0544587222F, 0.0546790660F, 0.0548998364F, 0.0551210331F, - 0.0553426561F, 0.0555647051F, 0.0557871801F, 0.0560100807F, - 0.0562334070F, 0.0564571587F, 0.0566813357F, 0.0569059378F, - 0.0571309649F, 0.0573564168F, 0.0575822933F, 0.0578085942F, - 0.0580353195F, 0.0582624689F, 0.0584900423F, 0.0587180396F, - 0.0589464605F, 0.0591753049F, 0.0594045726F, 0.0596342635F, - 0.0598643774F, 0.0600949141F, 0.0603258735F, 0.0605572555F, - 0.0607890597F, 0.0610212862F, 0.0612539346F, 0.0614870049F, - 0.0617204968F, 0.0619544103F, 0.0621887451F, 0.0624235010F, - 0.0626586780F, 0.0628942758F, 0.0631302942F, 0.0633667331F, - 0.0636035923F, 0.0638408717F, 0.0640785710F, 0.0643166901F, - 0.0645552288F, 0.0647941870F, 0.0650335645F, 0.0652733610F, - 0.0655135765F, 0.0657542108F, 0.0659952636F, 0.0662367348F, - 0.0664786242F, 0.0667209316F, 0.0669636570F, 0.0672068000F, - 0.0674503605F, 0.0676943384F, 0.0679387334F, 0.0681835454F, - 0.0684287742F, 0.0686744196F, 0.0689204814F, 0.0691669595F, - 0.0694138536F, 0.0696611637F, 0.0699088894F, 0.0701570307F, - 0.0704055873F, 0.0706545590F, 0.0709039458F, 0.0711537473F, - 0.0714039634F, 0.0716545939F, 0.0719056387F, 0.0721570975F, - 0.0724089702F, 0.0726612565F, 0.0729139563F, 0.0731670694F, - 0.0734205956F, 0.0736745347F, 0.0739288866F, 0.0741836510F, - 0.0744388277F, 0.0746944166F, 0.0749504175F, 0.0752068301F, - 0.0754636543F, 0.0757208899F, 0.0759785367F, 0.0762365946F, - 0.0764950632F, 0.0767539424F, 0.0770132320F, 0.0772729319F, - 0.0775330418F, 0.0777935616F, 0.0780544909F, 0.0783158298F, - 0.0785775778F, 0.0788397349F, 0.0791023009F, 0.0793652755F, - 0.0796286585F, 0.0798924498F, 0.0801566492F, 0.0804212564F, - 0.0806862712F, 0.0809516935F, 0.0812175231F, 0.0814837597F, - 0.0817504031F, 0.0820174532F, 0.0822849097F, 0.0825527724F, - 0.0828210412F, 0.0830897158F, 0.0833587960F, 0.0836282816F, - 0.0838981724F, 0.0841684682F, 0.0844391688F, 0.0847102740F, - 0.0849817835F, 0.0852536973F, 0.0855260150F, 0.0857987364F, - 0.0860718614F, 0.0863453897F, 0.0866193211F, 0.0868936554F, - 0.0871683924F, 0.0874435319F, 0.0877190737F, 0.0879950175F, - 0.0882713632F, 0.0885481105F, 0.0888252592F, 0.0891028091F, - 0.0893807600F, 0.0896591117F, 0.0899378639F, 0.0902170165F, - 0.0904965692F, 0.0907765218F, 0.0910568740F, 0.0913376258F, - 0.0916187767F, 0.0919003268F, 0.0921822756F, 0.0924646230F, - 0.0927473687F, 0.0930305126F, 0.0933140545F, 0.0935979940F, - 0.0938823310F, 0.0941670653F, 0.0944521966F, 0.0947377247F, - 0.0950236494F, 0.0953099704F, 0.0955966876F, 0.0958838007F, - 0.0961713094F, 0.0964592136F, 0.0967475131F, 0.0970362075F, - 0.0973252967F, 0.0976147805F, 0.0979046585F, 0.0981949307F, - 0.0984855967F, 0.0987766563F, 0.0990681093F, 0.0993599555F, - 0.0996521945F, 0.0999448263F, 0.1002378506F, 0.1005312671F, - 0.1008250755F, 0.1011192757F, 0.1014138675F, 0.1017088505F, - 0.1020042246F, 0.1022999895F, 0.1025961450F, 0.1028926909F, - 0.1031896268F, 0.1034869526F, 0.1037846680F, 0.1040827729F, - 0.1043812668F, 0.1046801497F, 0.1049794213F, 0.1052790813F, - 0.1055791294F, 0.1058795656F, 0.1061803894F, 0.1064816006F, - 0.1067831991F, 0.1070851846F, 0.1073875568F, 0.1076903155F, - 0.1079934604F, 0.1082969913F, 0.1086009079F, 0.1089052101F, - 0.1092098975F, 0.1095149699F, 0.1098204270F, 0.1101262687F, - 0.1104324946F, 0.1107391045F, 0.1110460982F, 0.1113534754F, - 0.1116612359F, 0.1119693793F, 0.1122779055F, 0.1125868142F, - 0.1128961052F, 0.1132057781F, 0.1135158328F, 0.1138262690F, - 0.1141370863F, 0.1144482847F, 0.1147598638F, 0.1150718233F, - 0.1153841631F, 0.1156968828F, 0.1160099822F, 0.1163234610F, - 0.1166373190F, 0.1169515559F, 0.1172661714F, 0.1175811654F, - 0.1178965374F, 0.1182122874F, 0.1185284149F, 0.1188449198F, - 0.1191618018F, 0.1194790606F, 0.1197966960F, 0.1201147076F, - 0.1204330953F, 0.1207518587F, 0.1210709976F, 0.1213905118F, - 0.1217104009F, 0.1220306647F, 0.1223513029F, 0.1226723153F, - 0.1229937016F, 0.1233154615F, 0.1236375948F, 0.1239601011F, - 0.1242829803F, 0.1246062319F, 0.1249298559F, 0.1252538518F, - 0.1255782195F, 0.1259029586F, 0.1262280689F, 0.1265535501F, - 0.1268794019F, 0.1272056241F, 0.1275322163F, 0.1278591784F, - 0.1281865099F, 0.1285142108F, 0.1288422805F, 0.1291707190F, - 0.1294995259F, 0.1298287009F, 0.1301582437F, 0.1304881542F, - 0.1308184319F, 0.1311490766F, 0.1314800881F, 0.1318114660F, - 0.1321432100F, 0.1324753200F, 0.1328077955F, 0.1331406364F, - 0.1334738422F, 0.1338074129F, 0.1341413479F, 0.1344756472F, - 0.1348103103F, 0.1351453370F, 0.1354807270F, 0.1358164801F, - 0.1361525959F, 0.1364890741F, 0.1368259145F, 0.1371631167F, - 0.1375006805F, 0.1378386056F, 0.1381768917F, 0.1385155384F, - 0.1388545456F, 0.1391939129F, 0.1395336400F, 0.1398737266F, - 0.1402141724F, 0.1405549772F, 0.1408961406F, 0.1412376623F, - 0.1415795421F, 0.1419217797F, 0.1422643746F, 0.1426073268F, - 0.1429506358F, 0.1432943013F, 0.1436383231F, 0.1439827008F, - 0.1443274342F, 0.1446725229F, 0.1450179667F, 0.1453637652F, - 0.1457099181F, 0.1460564252F, 0.1464032861F, 0.1467505006F, - 0.1470980682F, 0.1474459888F, 0.1477942620F, 0.1481428875F, - 0.1484918651F, 0.1488411942F, 0.1491908748F, 0.1495409065F, - 0.1498912889F, 0.1502420218F, 0.1505931048F, 0.1509445376F, - 0.1512963200F, 0.1516484516F, 0.1520009321F, 0.1523537612F, - 0.1527069385F, 0.1530604638F, 0.1534143368F, 0.1537685571F, - 0.1541231244F, 0.1544780384F, 0.1548332987F, 0.1551889052F, - 0.1555448574F, 0.1559011550F, 0.1562577978F, 0.1566147853F, - 0.1569721173F, 0.1573297935F, 0.1576878135F, 0.1580461771F, - 0.1584048838F, 0.1587639334F, 0.1591233255F, 0.1594830599F, - 0.1598431361F, 0.1602035540F, 0.1605643131F, 0.1609254131F, - 0.1612868537F, 0.1616486346F, 0.1620107555F, 0.1623732160F, - 0.1627360158F, 0.1630991545F, 0.1634626319F, 0.1638264476F, - 0.1641906013F, 0.1645550926F, 0.1649199212F, 0.1652850869F, - 0.1656505892F, 0.1660164278F, 0.1663826024F, 0.1667491127F, - 0.1671159583F, 0.1674831388F, 0.1678506541F, 0.1682185036F, - 0.1685866872F, 0.1689552044F, 0.1693240549F, 0.1696932384F, - 0.1700627545F, 0.1704326029F, 0.1708027833F, 0.1711732952F, - 0.1715441385F, 0.1719153127F, 0.1722868175F, 0.1726586526F, - 0.1730308176F, 0.1734033121F, 0.1737761359F, 0.1741492886F, - 0.1745227698F, 0.1748965792F, 0.1752707164F, 0.1756451812F, - 0.1760199731F, 0.1763950918F, 0.1767705370F, 0.1771463083F, - 0.1775224054F, 0.1778988279F, 0.1782755754F, 0.1786526477F, - 0.1790300444F, 0.1794077651F, 0.1797858094F, 0.1801641771F, - 0.1805428677F, 0.1809218810F, 0.1813012165F, 0.1816808739F, - 0.1820608528F, 0.1824411530F, 0.1828217739F, 0.1832027154F, - 0.1835839770F, 0.1839655584F, 0.1843474592F, 0.1847296790F, - 0.1851122175F, 0.1854950744F, 0.1858782492F, 0.1862617417F, - 0.1866455514F, 0.1870296780F, 0.1874141211F, 0.1877988804F, - 0.1881839555F, 0.1885693461F, 0.1889550517F, 0.1893410721F, - 0.1897274068F, 0.1901140555F, 0.1905010178F, 0.1908882933F, - 0.1912758818F, 0.1916637828F, 0.1920519959F, 0.1924405208F, - 0.1928293571F, 0.1932185044F, 0.1936079625F, 0.1939977308F, - 0.1943878091F, 0.1947781969F, 0.1951688939F, 0.1955598998F, - 0.1959512141F, 0.1963428364F, 0.1967347665F, 0.1971270038F, - 0.1975195482F, 0.1979123990F, 0.1983055561F, 0.1986990190F, - 0.1990927873F, 0.1994868607F, 0.1998812388F, 0.2002759212F, - 0.2006709075F, 0.2010661974F, 0.2014617904F, 0.2018576862F, - 0.2022538844F, 0.2026503847F, 0.2030471865F, 0.2034442897F, - 0.2038416937F, 0.2042393982F, 0.2046374028F, 0.2050357071F, - 0.2054343107F, 0.2058332133F, 0.2062324145F, 0.2066319138F, - 0.2070317110F, 0.2074318055F, 0.2078321970F, 0.2082328852F, - 0.2086338696F, 0.2090351498F, 0.2094367255F, 0.2098385962F, - 0.2102407617F, 0.2106432213F, 0.2110459749F, 0.2114490220F, - 0.2118523621F, 0.2122559950F, 0.2126599202F, 0.2130641373F, - 0.2134686459F, 0.2138734456F, 0.2142785361F, 0.2146839168F, - 0.2150895875F, 0.2154955478F, 0.2159017972F, 0.2163083353F, - 0.2167151617F, 0.2171222761F, 0.2175296780F, 0.2179373670F, - 0.2183453428F, 0.2187536049F, 0.2191621529F, 0.2195709864F, - 0.2199801051F, 0.2203895085F, 0.2207991961F, 0.2212091677F, - 0.2216194228F, 0.2220299610F, 0.2224407818F, 0.2228518850F, - 0.2232632699F, 0.2236749364F, 0.2240868839F, 0.2244991121F, - 0.2249116204F, 0.2253244086F, 0.2257374763F, 0.2261508229F, - 0.2265644481F, 0.2269783514F, 0.2273925326F, 0.2278069911F, - 0.2282217265F, 0.2286367384F, 0.2290520265F, 0.2294675902F, - 0.2298834292F, 0.2302995431F, 0.2307159314F, 0.2311325937F, - 0.2315495297F, 0.2319667388F, 0.2323842207F, 0.2328019749F, - 0.2332200011F, 0.2336382988F, 0.2340568675F, 0.2344757070F, - 0.2348948166F, 0.2353141961F, 0.2357338450F, 0.2361537629F, - 0.2365739493F, 0.2369944038F, 0.2374151261F, 0.2378361156F, - 0.2382573720F, 0.2386788948F, 0.2391006836F, 0.2395227380F, - 0.2399450575F, 0.2403676417F, 0.2407904902F, 0.2412136026F, - 0.2416369783F, 0.2420606171F, 0.2424845185F, 0.2429086820F, - 0.2433331072F, 0.2437577936F, 0.2441827409F, 0.2446079486F, - 0.2450334163F, 0.2454591435F, 0.2458851298F, 0.2463113747F, - 0.2467378779F, 0.2471646389F, 0.2475916573F, 0.2480189325F, - 0.2484464643F, 0.2488742521F, 0.2493022955F, 0.2497305940F, - 0.2501591473F, 0.2505879549F, 0.2510170163F, 0.2514463311F, - 0.2518758989F, 0.2523057193F, 0.2527357916F, 0.2531661157F, - 0.2535966909F, 0.2540275169F, 0.2544585931F, 0.2548899193F, - 0.2553214948F, 0.2557533193F, 0.2561853924F, 0.2566177135F, - 0.2570502822F, 0.2574830981F, 0.2579161608F, 0.2583494697F, - 0.2587830245F, 0.2592168246F, 0.2596508697F, 0.2600851593F, - 0.2605196929F, 0.2609544701F, 0.2613894904F, 0.2618247534F, - 0.2622602586F, 0.2626960055F, 0.2631319938F, 0.2635682230F, - 0.2640046925F, 0.2644414021F, 0.2648783511F, 0.2653155391F, - 0.2657529657F, 0.2661906305F, 0.2666285329F, 0.2670666725F, - 0.2675050489F, 0.2679436616F, 0.2683825101F, 0.2688215940F, - 0.2692609127F, 0.2697004660F, 0.2701402532F, 0.2705802739F, - 0.2710205278F, 0.2714610142F, 0.2719017327F, 0.2723426830F, - 0.2727838644F, 0.2732252766F, 0.2736669191F, 0.2741087914F, - 0.2745508930F, 0.2749932235F, 0.2754357824F, 0.2758785693F, - 0.2763215837F, 0.2767648251F, 0.2772082930F, 0.2776519870F, - 0.2780959066F, 0.2785400513F, 0.2789844207F, 0.2794290143F, - 0.2798738316F, 0.2803188722F, 0.2807641355F, 0.2812096211F, - 0.2816553286F, 0.2821012574F, 0.2825474071F, 0.2829937773F, - 0.2834403673F, 0.2838871768F, 0.2843342053F, 0.2847814523F, - 0.2852289174F, 0.2856765999F, 0.2861244996F, 0.2865726159F, - 0.2870209482F, 0.2874694962F, 0.2879182594F, 0.2883672372F, - 0.2888164293F, 0.2892658350F, 0.2897154540F, 0.2901652858F, - 0.2906153298F, 0.2910655856F, 0.2915160527F, 0.2919667306F, - 0.2924176189F, 0.2928687171F, 0.2933200246F, 0.2937715409F, - 0.2942232657F, 0.2946751984F, 0.2951273386F, 0.2955796856F, - 0.2960322391F, 0.2964849986F, 0.2969379636F, 0.2973911335F, - 0.2978445080F, 0.2982980864F, 0.2987518684F, 0.2992058534F, - 0.2996600409F, 0.3001144305F, 0.3005690217F, 0.3010238139F, - 0.3014788067F, 0.3019339995F, 0.3023893920F, 0.3028449835F, - 0.3033007736F, 0.3037567618F, 0.3042129477F, 0.3046693306F, - 0.3051259102F, 0.3055826859F, 0.3060396572F, 0.3064968236F, - 0.3069541847F, 0.3074117399F, 0.3078694887F, 0.3083274307F, - 0.3087855653F, 0.3092438920F, 0.3097024104F, 0.3101611199F, - 0.3106200200F, 0.3110791103F, 0.3115383902F, 0.3119978592F, - 0.3124575169F, 0.3129173627F, 0.3133773961F, 0.3138376166F, - 0.3142980238F, 0.3147586170F, 0.3152193959F, 0.3156803598F, - 0.3161415084F, 0.3166028410F, 0.3170643573F, 0.3175260566F, - 0.3179879384F, 0.3184500023F, 0.3189122478F, 0.3193746743F, - 0.3198372814F, 0.3203000685F, 0.3207630351F, 0.3212261807F, - 0.3216895048F, 0.3221530069F, 0.3226166865F, 0.3230805430F, - 0.3235445760F, 0.3240087849F, 0.3244731693F, 0.3249377285F, - 0.3254024622F, 0.3258673698F, 0.3263324507F, 0.3267977045F, - 0.3272631306F, 0.3277287286F, 0.3281944978F, 0.3286604379F, - 0.3291265482F, 0.3295928284F, 0.3300592777F, 0.3305258958F, - 0.3309926821F, 0.3314596361F, 0.3319267573F, 0.3323940451F, - 0.3328614990F, 0.3333291186F, 0.3337969033F, 0.3342648525F, - 0.3347329658F, 0.3352012427F, 0.3356696825F, 0.3361382849F, - 0.3366070492F, 0.3370759749F, 0.3375450616F, 0.3380143087F, - 0.3384837156F, 0.3389532819F, 0.3394230071F, 0.3398928905F, - 0.3403629317F, 0.3408331302F, 0.3413034854F, 0.3417739967F, - 0.3422446638F, 0.3427154860F, 0.3431864628F, 0.3436575938F, - 0.3441288782F, 0.3446003158F, 0.3450719058F, 0.3455436478F, - 0.3460155412F, 0.3464875856F, 0.3469597804F, 0.3474321250F, - 0.3479046189F, 0.3483772617F, 0.3488500527F, 0.3493229914F, - 0.3497960774F, 0.3502693100F, 0.3507426887F, 0.3512162131F, - 0.3516898825F, 0.3521636965F, 0.3526376545F, 0.3531117559F, - 0.3535860003F, 0.3540603870F, 0.3545349157F, 0.3550095856F, - 0.3554843964F, 0.3559593474F, 0.3564344381F, 0.3569096680F, - 0.3573850366F, 0.3578605432F, 0.3583361875F, 0.3588119687F, - 0.3592878865F, 0.3597639402F, 0.3602401293F, 0.3607164533F, - 0.3611929117F, 0.3616695038F, 0.3621462292F, 0.3626230873F, - 0.3631000776F, 0.3635771995F, 0.3640544525F, 0.3645318360F, - 0.3650093496F, 0.3654869926F, 0.3659647645F, 0.3664426648F, - 0.3669206930F, 0.3673988484F, 0.3678771306F, 0.3683555390F, - 0.3688340731F, 0.3693127322F, 0.3697915160F, 0.3702704237F, - 0.3707494549F, 0.3712286091F, 0.3717078857F, 0.3721872840F, - 0.3726668037F, 0.3731464441F, 0.3736262047F, 0.3741060850F, - 0.3745860843F, 0.3750662023F, 0.3755464382F, 0.3760267915F, - 0.3765072618F, 0.3769878484F, 0.3774685509F, 0.3779493686F, - 0.3784303010F, 0.3789113475F, 0.3793925076F, 0.3798737809F, - 0.3803551666F, 0.3808366642F, 0.3813182733F, 0.3817999932F, - 0.3822818234F, 0.3827637633F, 0.3832458124F, 0.3837279702F, - 0.3842102360F, 0.3846926093F, 0.3851750897F, 0.3856576764F, - 0.3861403690F, 0.3866231670F, 0.3871060696F, 0.3875890765F, - 0.3880721870F, 0.3885554007F, 0.3890387168F, 0.3895221349F, - 0.3900056544F, 0.3904892748F, 0.3909729955F, 0.3914568160F, - 0.3919407356F, 0.3924247539F, 0.3929088702F, 0.3933930841F, - 0.3938773949F, 0.3943618021F, 0.3948463052F, 0.3953309035F, - 0.3958155966F, 0.3963003838F, 0.3967852646F, 0.3972702385F, - 0.3977553048F, 0.3982404631F, 0.3987257127F, 0.3992110531F, - 0.3996964838F, 0.4001820041F, 0.4006676136F, 0.4011533116F, - 0.4016390976F, 0.4021249710F, 0.4026109313F, 0.4030969779F, - 0.4035831102F, 0.4040693277F, 0.4045556299F, 0.4050420160F, - 0.4055284857F, 0.4060150383F, 0.4065016732F, 0.4069883899F, - 0.4074751879F, 0.4079620665F, 0.4084490252F, 0.4089360635F, - 0.4094231807F, 0.4099103763F, 0.4103976498F, 0.4108850005F, - 0.4113724280F, 0.4118599315F, 0.4123475107F, 0.4128351648F, - 0.4133228934F, 0.4138106959F, 0.4142985716F, 0.4147865201F, - 0.4152745408F, 0.4157626330F, 0.4162507963F, 0.4167390301F, - 0.4172273337F, 0.4177157067F, 0.4182041484F, 0.4186926583F, - 0.4191812359F, 0.4196698805F, 0.4201585915F, 0.4206473685F, - 0.4211362108F, 0.4216251179F, 0.4221140892F, 0.4226031241F, - 0.4230922221F, 0.4235813826F, 0.4240706050F, 0.4245598887F, - 0.4250492332F, 0.4255386379F, 0.4260281022F, 0.4265176256F, - 0.4270072075F, 0.4274968473F, 0.4279865445F, 0.4284762984F, - 0.4289661086F, 0.4294559743F, 0.4299458951F, 0.4304358704F, - 0.4309258996F, 0.4314159822F, 0.4319061175F, 0.4323963050F, - 0.4328865441F, 0.4333768342F, 0.4338671749F, 0.4343575654F, - 0.4348480052F, 0.4353384938F, 0.4358290306F, 0.4363196149F, - 0.4368102463F, 0.4373009241F, 0.4377916478F, 0.4382824168F, - 0.4387732305F, 0.4392640884F, 0.4397549899F, 0.4402459343F, - 0.4407369212F, 0.4412279499F, 0.4417190198F, 0.4422101305F, - 0.4427012813F, 0.4431924717F, 0.4436837010F, 0.4441749686F, - 0.4446662742F, 0.4451576169F, 0.4456489963F, 0.4461404118F, - 0.4466318628F, 0.4471233487F, 0.4476148690F, 0.4481064230F, - 0.4485980103F, 0.4490896302F, 0.4495812821F, 0.4500729654F, - 0.4505646797F, 0.4510564243F, 0.4515481986F, 0.4520400021F, - 0.4525318341F, 0.4530236942F, 0.4535155816F, 0.4540074959F, - 0.4544994365F, 0.4549914028F, 0.4554833941F, 0.4559754100F, - 0.4564674499F, 0.4569595131F, 0.4574515991F, 0.4579437074F, - 0.4584358372F, 0.4589279881F, 0.4594201595F, 0.4599123508F, - 0.4604045615F, 0.4608967908F, 0.4613890383F, 0.4618813034F, - 0.4623735855F, 0.4628658841F, 0.4633581984F, 0.4638505281F, - 0.4643428724F, 0.4648352308F, 0.4653276028F, 0.4658199877F, - 0.4663123849F, 0.4668047940F, 0.4672972143F, 0.4677896451F, - 0.4682820861F, 0.4687745365F, 0.4692669958F, 0.4697594634F, - 0.4702519387F, 0.4707444211F, 0.4712369102F, 0.4717294052F, - 0.4722219056F, 0.4727144109F, 0.4732069204F, 0.4736994336F, - 0.4741919498F, 0.4746844686F, 0.4751769893F, 0.4756695113F, - 0.4761620341F, 0.4766545571F, 0.4771470797F, 0.4776396013F, - 0.4781321213F, 0.4786246392F, 0.4791171544F, 0.4796096663F, - 0.4801021744F, 0.4805946779F, 0.4810871765F, 0.4815796694F, - 0.4820721561F, 0.4825646360F, 0.4830571086F, 0.4835495732F, - 0.4840420293F, 0.4845344763F, 0.4850269136F, 0.4855193407F, - 0.4860117569F, 0.4865041617F, 0.4869965545F, 0.4874889347F, - 0.4879813018F, 0.4884736551F, 0.4889659941F, 0.4894583182F, - 0.4899506268F, 0.4904429193F, 0.4909351952F, 0.4914274538F, - 0.4919196947F, 0.4924119172F, 0.4929041207F, 0.4933963046F, - 0.4938884685F, 0.4943806116F, 0.4948727335F, 0.4953648335F, - 0.4958569110F, 0.4963489656F, 0.4968409965F, 0.4973330032F, - 0.4978249852F, 0.4983169419F, 0.4988088726F, 0.4993007768F, - 0.4997926539F, 0.5002845034F, 0.5007763247F, 0.5012681171F, - 0.5017598801F, 0.5022516132F, 0.5027433157F, 0.5032349871F, - 0.5037266268F, 0.5042182341F, 0.5047098086F, 0.5052013497F, - 0.5056928567F, 0.5061843292F, 0.5066757664F, 0.5071671679F, - 0.5076585330F, 0.5081498613F, 0.5086411520F, 0.5091324047F, - 0.5096236187F, 0.5101147934F, 0.5106059284F, 0.5110970230F, - 0.5115880766F, 0.5120790887F, 0.5125700587F, 0.5130609860F, - 0.5135518700F, 0.5140427102F, 0.5145335059F, 0.5150242566F, - 0.5155149618F, 0.5160056208F, 0.5164962331F, 0.5169867980F, - 0.5174773151F, 0.5179677837F, 0.5184582033F, 0.5189485733F, - 0.5194388931F, 0.5199291621F, 0.5204193798F, 0.5209095455F, - 0.5213996588F, 0.5218897190F, 0.5223797256F, 0.5228696779F, - 0.5233595755F, 0.5238494177F, 0.5243392039F, 0.5248289337F, - 0.5253186063F, 0.5258082213F, 0.5262977781F, 0.5267872760F, - 0.5272767146F, 0.5277660932F, 0.5282554112F, 0.5287446682F, - 0.5292338635F, 0.5297229965F, 0.5302120667F, 0.5307010736F, - 0.5311900164F, 0.5316788947F, 0.5321677079F, 0.5326564554F, - 0.5331451366F, 0.5336337511F, 0.5341222981F, 0.5346107771F, - 0.5350991876F, 0.5355875290F, 0.5360758007F, 0.5365640021F, - 0.5370521327F, 0.5375401920F, 0.5380281792F, 0.5385160939F, - 0.5390039355F, 0.5394917034F, 0.5399793971F, 0.5404670159F, - 0.5409545594F, 0.5414420269F, 0.5419294179F, 0.5424167318F, - 0.5429039680F, 0.5433911261F, 0.5438782053F, 0.5443652051F, - 0.5448521250F, 0.5453389644F, 0.5458257228F, 0.5463123995F, - 0.5467989940F, 0.5472855057F, 0.5477719341F, 0.5482582786F, - 0.5487445387F, 0.5492307137F, 0.5497168031F, 0.5502028063F, - 0.5506887228F, 0.5511745520F, 0.5516602934F, 0.5521459463F, - 0.5526315103F, 0.5531169847F, 0.5536023690F, 0.5540876626F, - 0.5545728649F, 0.5550579755F, 0.5555429937F, 0.5560279189F, - 0.5565127507F, 0.5569974884F, 0.5574821315F, 0.5579666794F, - 0.5584511316F, 0.5589354875F, 0.5594197465F, 0.5599039080F, - 0.5603879716F, 0.5608719367F, 0.5613558026F, 0.5618395689F, - 0.5623232350F, 0.5628068002F, 0.5632902642F, 0.5637736262F, - 0.5642568858F, 0.5647400423F, 0.5652230953F, 0.5657060442F, - 0.5661888883F, 0.5666716272F, 0.5671542603F, 0.5676367870F, - 0.5681192069F, 0.5686015192F, 0.5690837235F, 0.5695658192F, - 0.5700478058F, 0.5705296827F, 0.5710114494F, 0.5714931052F, - 0.5719746497F, 0.5724560822F, 0.5729374023F, 0.5734186094F, - 0.5738997029F, 0.5743806823F, 0.5748615470F, 0.5753422965F, - 0.5758229301F, 0.5763034475F, 0.5767838480F, 0.5772641310F, - 0.5777442960F, 0.5782243426F, 0.5787042700F, 0.5791840778F, - 0.5796637654F, 0.5801433322F, 0.5806227778F, 0.5811021016F, - 0.5815813029F, 0.5820603814F, 0.5825393363F, 0.5830181673F, - 0.5834968737F, 0.5839754549F, 0.5844539105F, 0.5849322399F, - 0.5854104425F, 0.5858885179F, 0.5863664653F, 0.5868442844F, - 0.5873219746F, 0.5877995353F, 0.5882769660F, 0.5887542661F, - 0.5892314351F, 0.5897084724F, 0.5901853776F, 0.5906621500F, - 0.5911387892F, 0.5916152945F, 0.5920916655F, 0.5925679016F, - 0.5930440022F, 0.5935199669F, 0.5939957950F, 0.5944714861F, - 0.5949470396F, 0.5954224550F, 0.5958977317F, 0.5963728692F, - 0.5968478669F, 0.5973227244F, 0.5977974411F, 0.5982720163F, - 0.5987464497F, 0.5992207407F, 0.5996948887F, 0.6001688932F, - 0.6006427537F, 0.6011164696F, 0.6015900405F, 0.6020634657F, - 0.6025367447F, 0.6030098770F, 0.6034828621F, 0.6039556995F, - 0.6044283885F, 0.6049009288F, 0.6053733196F, 0.6058455606F, - 0.6063176512F, 0.6067895909F, 0.6072613790F, 0.6077330152F, - 0.6082044989F, 0.6086758295F, 0.6091470065F, 0.6096180294F, - 0.6100888977F, 0.6105596108F, 0.6110301682F, 0.6115005694F, - 0.6119708139F, 0.6124409011F, 0.6129108305F, 0.6133806017F, - 0.6138502139F, 0.6143196669F, 0.6147889599F, 0.6152580926F, - 0.6157270643F, 0.6161958746F, 0.6166645230F, 0.6171330088F, - 0.6176013317F, 0.6180694910F, 0.6185374863F, 0.6190053171F, - 0.6194729827F, 0.6199404828F, 0.6204078167F, 0.6208749841F, - 0.6213419842F, 0.6218088168F, 0.6222754811F, 0.6227419768F, - 0.6232083032F, 0.6236744600F, 0.6241404465F, 0.6246062622F, - 0.6250719067F, 0.6255373795F, 0.6260026799F, 0.6264678076F, - 0.6269327619F, 0.6273975425F, 0.6278621487F, 0.6283265800F, - 0.6287908361F, 0.6292549163F, 0.6297188201F, 0.6301825471F, - 0.6306460966F, 0.6311094683F, 0.6315726617F, 0.6320356761F, - 0.6324985111F, 0.6329611662F, 0.6334236410F, 0.6338859348F, - 0.6343480472F, 0.6348099777F, 0.6352717257F, 0.6357332909F, - 0.6361946726F, 0.6366558704F, 0.6371168837F, 0.6375777122F, - 0.6380383552F, 0.6384988123F, 0.6389590830F, 0.6394191668F, - 0.6398790631F, 0.6403387716F, 0.6407982916F, 0.6412576228F, - 0.6417167645F, 0.6421757163F, 0.6426344778F, 0.6430930483F, - 0.6435514275F, 0.6440096149F, 0.6444676098F, 0.6449254119F, - 0.6453830207F, 0.6458404356F, 0.6462976562F, 0.6467546820F, - 0.6472115125F, 0.6476681472F, 0.6481245856F, 0.6485808273F, - 0.6490368717F, 0.6494927183F, 0.6499483667F, 0.6504038164F, - 0.6508590670F, 0.6513141178F, 0.6517689684F, 0.6522236185F, - 0.6526780673F, 0.6531323146F, 0.6535863598F, 0.6540402024F, - 0.6544938419F, 0.6549472779F, 0.6554005099F, 0.6558535373F, - 0.6563063598F, 0.6567589769F, 0.6572113880F, 0.6576635927F, - 0.6581155906F, 0.6585673810F, 0.6590189637F, 0.6594703380F, - 0.6599215035F, 0.6603724598F, 0.6608232064F, 0.6612737427F, - 0.6617240684F, 0.6621741829F, 0.6626240859F, 0.6630737767F, - 0.6635232550F, 0.6639725202F, 0.6644215720F, 0.6648704098F, - 0.6653190332F, 0.6657674417F, 0.6662156348F, 0.6666636121F, - 0.6671113731F, 0.6675589174F, 0.6680062445F, 0.6684533538F, - 0.6689002450F, 0.6693469177F, 0.6697933712F, 0.6702396052F, - 0.6706856193F, 0.6711314129F, 0.6715769855F, 0.6720223369F, - 0.6724674664F, 0.6729123736F, 0.6733570581F, 0.6738015194F, - 0.6742457570F, 0.6746897706F, 0.6751335596F, 0.6755771236F, - 0.6760204621F, 0.6764635747F, 0.6769064609F, 0.6773491204F, - 0.6777915525F, 0.6782337570F, 0.6786757332F, 0.6791174809F, - 0.6795589995F, 0.6800002886F, 0.6804413477F, 0.6808821765F, - 0.6813227743F, 0.6817631409F, 0.6822032758F, 0.6826431785F, - 0.6830828485F, 0.6835222855F, 0.6839614890F, 0.6844004585F, - 0.6848391936F, 0.6852776939F, 0.6857159589F, 0.6861539883F, - 0.6865917815F, 0.6870293381F, 0.6874666576F, 0.6879037398F, - 0.6883405840F, 0.6887771899F, 0.6892135571F, 0.6896496850F, - 0.6900855733F, 0.6905212216F, 0.6909566294F, 0.6913917963F, - 0.6918267218F, 0.6922614055F, 0.6926958471F, 0.6931300459F, - 0.6935640018F, 0.6939977141F, 0.6944311825F, 0.6948644066F, - 0.6952973859F, 0.6957301200F, 0.6961626085F, 0.6965948510F, - 0.6970268470F, 0.6974585961F, 0.6978900980F, 0.6983213521F, - 0.6987523580F, 0.6991831154F, 0.6996136238F, 0.7000438828F, - 0.7004738921F, 0.7009036510F, 0.7013331594F, 0.7017624166F, - 0.7021914224F, 0.7026201763F, 0.7030486779F, 0.7034769268F, - 0.7039049226F, 0.7043326648F, 0.7047601531F, 0.7051873870F, - 0.7056143662F, 0.7060410902F, 0.7064675586F, 0.7068937711F, - 0.7073197271F, 0.7077454264F, 0.7081708684F, 0.7085960529F, - 0.7090209793F, 0.7094456474F, 0.7098700566F, 0.7102942066F, - 0.7107180970F, 0.7111417274F, 0.7115650974F, 0.7119882066F, - 0.7124110545F, 0.7128336409F, 0.7132559653F, 0.7136780272F, - 0.7140998264F, 0.7145213624F, 0.7149426348F, 0.7153636433F, - 0.7157843874F, 0.7162048668F, 0.7166250810F, 0.7170450296F, - 0.7174647124F, 0.7178841289F, 0.7183032786F, 0.7187221613F, - 0.7191407765F, 0.7195591239F, 0.7199772030F, 0.7203950135F, - 0.7208125550F, 0.7212298271F, 0.7216468294F, 0.7220635616F, - 0.7224800233F, 0.7228962140F, 0.7233121335F, 0.7237277813F, - 0.7241431571F, 0.7245582604F, 0.7249730910F, 0.7253876484F, - 0.7258019322F, 0.7262159422F, 0.7266296778F, 0.7270431388F, - 0.7274563247F, 0.7278692353F, 0.7282818700F, 0.7286942287F, - 0.7291063108F, 0.7295181160F, 0.7299296440F, 0.7303408944F, - 0.7307518669F, 0.7311625609F, 0.7315729763F, 0.7319831126F, - 0.7323929695F, 0.7328025466F, 0.7332118435F, 0.7336208600F, - 0.7340295955F, 0.7344380499F, 0.7348462226F, 0.7352541134F, - 0.7356617220F, 0.7360690478F, 0.7364760907F, 0.7368828502F, - 0.7372893259F, 0.7376955176F, 0.7381014249F, 0.7385070475F, - 0.7389123849F, 0.7393174368F, 0.7397222029F, 0.7401266829F, - 0.7405308763F, 0.7409347829F, 0.7413384023F, 0.7417417341F, - 0.7421447780F, 0.7425475338F, 0.7429500009F, 0.7433521791F, - 0.7437540681F, 0.7441556674F, 0.7445569769F, 0.7449579960F, - 0.7453587245F, 0.7457591621F, 0.7461593084F, 0.7465591631F, - 0.7469587259F, 0.7473579963F, 0.7477569741F, 0.7481556590F, - 0.7485540506F, 0.7489521486F, 0.7493499526F, 0.7497474623F, - 0.7501446775F, 0.7505415977F, 0.7509382227F, 0.7513345521F, - 0.7517305856F, 0.7521263229F, 0.7525217636F, 0.7529169074F, - 0.7533117541F, 0.7537063032F, 0.7541005545F, 0.7544945076F, - 0.7548881623F, 0.7552815182F, 0.7556745749F, 0.7560673323F, - 0.7564597899F, 0.7568519474F, 0.7572438046F, 0.7576353611F, - 0.7580266166F, 0.7584175708F, 0.7588082235F, 0.7591985741F, - 0.7595886226F, 0.7599783685F, 0.7603678116F, 0.7607569515F, - 0.7611457879F, 0.7615343206F, 0.7619225493F, 0.7623104735F, - 0.7626980931F, 0.7630854078F, 0.7634724171F, 0.7638591209F, - 0.7642455188F, 0.7646316106F, 0.7650173959F, 0.7654028744F, - 0.7657880459F, 0.7661729100F, 0.7665574664F, 0.7669417150F, - 0.7673256553F, 0.7677092871F, 0.7680926100F, 0.7684756239F, - 0.7688583284F, 0.7692407232F, 0.7696228080F, 0.7700045826F, - 0.7703860467F, 0.7707671999F, 0.7711480420F, 0.7715285728F, - 0.7719087918F, 0.7722886989F, 0.7726682938F, 0.7730475762F, - 0.7734265458F, 0.7738052023F, 0.7741835454F, 0.7745615750F, - 0.7749392906F, 0.7753166921F, 0.7756937791F, 0.7760705514F, - 0.7764470087F, 0.7768231508F, 0.7771989773F, 0.7775744880F, - 0.7779496827F, 0.7783245610F, 0.7786991227F, 0.7790733676F, - 0.7794472953F, 0.7798209056F, 0.7801941982F, 0.7805671729F, - 0.7809398294F, 0.7813121675F, 0.7816841869F, 0.7820558873F, - 0.7824272684F, 0.7827983301F, 0.7831690720F, 0.7835394940F, - 0.7839095957F, 0.7842793768F, 0.7846488373F, 0.7850179767F, - 0.7853867948F, 0.7857552914F, 0.7861234663F, 0.7864913191F, - 0.7868588497F, 0.7872260578F, 0.7875929431F, 0.7879595055F, - 0.7883257445F, 0.7886916601F, 0.7890572520F, 0.7894225198F, - 0.7897874635F, 0.7901520827F, 0.7905163772F, 0.7908803468F, - 0.7912439912F, 0.7916073102F, 0.7919703035F, 0.7923329710F, - 0.7926953124F, 0.7930573274F, 0.7934190158F, 0.7937803774F, - 0.7941414120F, 0.7945021193F, 0.7948624991F, 0.7952225511F, - 0.7955822752F, 0.7959416711F, 0.7963007387F, 0.7966594775F, - 0.7970178875F, 0.7973759685F, 0.7977337201F, 0.7980911422F, - 0.7984482346F, 0.7988049970F, 0.7991614292F, 0.7995175310F, - 0.7998733022F, 0.8002287426F, 0.8005838519F, 0.8009386299F, - 0.8012930765F, 0.8016471914F, 0.8020009744F, 0.8023544253F, - 0.8027075438F, 0.8030603298F, 0.8034127831F, 0.8037649035F, - 0.8041166906F, 0.8044681445F, 0.8048192647F, 0.8051700512F, - 0.8055205038F, 0.8058706222F, 0.8062204062F, 0.8065698556F, - 0.8069189702F, 0.8072677499F, 0.8076161944F, 0.8079643036F, - 0.8083120772F, 0.8086595151F, 0.8090066170F, 0.8093533827F, - 0.8096998122F, 0.8100459051F, 0.8103916613F, 0.8107370806F, - 0.8110821628F, 0.8114269077F, 0.8117713151F, 0.8121153849F, - 0.8124591169F, 0.8128025108F, 0.8131455666F, 0.8134882839F, - 0.8138306627F, 0.8141727027F, 0.8145144038F, 0.8148557658F, - 0.8151967886F, 0.8155374718F, 0.8158778154F, 0.8162178192F, - 0.8165574830F, 0.8168968067F, 0.8172357900F, 0.8175744328F, - 0.8179127349F, 0.8182506962F, 0.8185883164F, 0.8189255955F, - 0.8192625332F, 0.8195991295F, 0.8199353840F, 0.8202712967F, - 0.8206068673F, 0.8209420958F, 0.8212769820F, 0.8216115256F, - 0.8219457266F, 0.8222795848F, 0.8226131000F, 0.8229462721F, - 0.8232791009F, 0.8236115863F, 0.8239437280F, 0.8242755260F, - 0.8246069801F, 0.8249380901F, 0.8252688559F, 0.8255992774F, - 0.8259293544F, 0.8262590867F, 0.8265884741F, 0.8269175167F, - 0.8272462141F, 0.8275745663F, 0.8279025732F, 0.8282302344F, - 0.8285575501F, 0.8288845199F, 0.8292111437F, 0.8295374215F, - 0.8298633530F, 0.8301889382F, 0.8305141768F, 0.8308390688F, - 0.8311636141F, 0.8314878124F, 0.8318116637F, 0.8321351678F, - 0.8324583246F, 0.8327811340F, 0.8331035957F, 0.8334257098F, - 0.8337474761F, 0.8340688944F, 0.8343899647F, 0.8347106867F, - 0.8350310605F, 0.8353510857F, 0.8356707624F, 0.8359900904F, - 0.8363090696F, 0.8366276999F, 0.8369459811F, 0.8372639131F, - 0.8375814958F, 0.8378987292F, 0.8382156130F, 0.8385321472F, - 0.8388483316F, 0.8391641662F, 0.8394796508F, 0.8397947853F, - 0.8401095697F, 0.8404240037F, 0.8407380873F, 0.8410518204F, - 0.8413652029F, 0.8416782347F, 0.8419909156F, 0.8423032456F, - 0.8426152245F, 0.8429268523F, 0.8432381289F, 0.8435490541F, - 0.8438596279F, 0.8441698502F, 0.8444797208F, 0.8447892396F, - 0.8450984067F, 0.8454072218F, 0.8457156849F, 0.8460237959F, - 0.8463315547F, 0.8466389612F, 0.8469460154F, 0.8472527170F, - 0.8475590661F, 0.8478650625F, 0.8481707063F, 0.8484759971F, - 0.8487809351F, 0.8490855201F, 0.8493897521F, 0.8496936308F, - 0.8499971564F, 0.8503003286F, 0.8506031474F, 0.8509056128F, - 0.8512077246F, 0.8515094828F, 0.8518108872F, 0.8521119379F, - 0.8524126348F, 0.8527129777F, 0.8530129666F, 0.8533126015F, - 0.8536118822F, 0.8539108087F, 0.8542093809F, 0.8545075988F, - 0.8548054623F, 0.8551029712F, 0.8554001257F, 0.8556969255F, - 0.8559933707F, 0.8562894611F, 0.8565851968F, 0.8568805775F, - 0.8571756034F, 0.8574702743F, 0.8577645902F, 0.8580585509F, - 0.8583521566F, 0.8586454070F, 0.8589383021F, 0.8592308420F, - 0.8595230265F, 0.8598148556F, 0.8601063292F, 0.8603974473F, - 0.8606882098F, 0.8609786167F, 0.8612686680F, 0.8615583636F, - 0.8618477034F, 0.8621366874F, 0.8624253156F, 0.8627135878F, - 0.8630015042F, 0.8632890646F, 0.8635762690F, 0.8638631173F, - 0.8641496096F, 0.8644357457F, 0.8647215257F, 0.8650069495F, - 0.8652920171F, 0.8655767283F, 0.8658610833F, 0.8661450820F, - 0.8664287243F, 0.8667120102F, 0.8669949397F, 0.8672775127F, - 0.8675597293F, 0.8678415894F, 0.8681230929F, 0.8684042398F, - 0.8686850302F, 0.8689654640F, 0.8692455412F, 0.8695252617F, - 0.8698046255F, 0.8700836327F, 0.8703622831F, 0.8706405768F, - 0.8709185138F, 0.8711960940F, 0.8714733174F, 0.8717501840F, - 0.8720266939F, 0.8723028469F, 0.8725786430F, 0.8728540824F, - 0.8731291648F, 0.8734038905F, 0.8736782592F, 0.8739522711F, - 0.8742259261F, 0.8744992242F, 0.8747721653F, 0.8750447496F, - 0.8753169770F, 0.8755888475F, 0.8758603611F, 0.8761315177F, - 0.8764023175F, 0.8766727603F, 0.8769428462F, 0.8772125752F, - 0.8774819474F, 0.8777509626F, 0.8780196209F, 0.8782879224F, - 0.8785558669F, 0.8788234546F, 0.8790906854F, 0.8793575594F, - 0.8796240765F, 0.8798902368F, 0.8801560403F, 0.8804214870F, - 0.8806865768F, 0.8809513099F, 0.8812156863F, 0.8814797059F, - 0.8817433687F, 0.8820066749F, 0.8822696243F, 0.8825322171F, - 0.8827944532F, 0.8830563327F, 0.8833178556F, 0.8835790219F, - 0.8838398316F, 0.8841002848F, 0.8843603815F, 0.8846201217F, - 0.8848795054F, 0.8851385327F, 0.8853972036F, 0.8856555182F, - 0.8859134764F, 0.8861710783F, 0.8864283239F, 0.8866852133F, - 0.8869417464F, 0.8871979234F, 0.8874537443F, 0.8877092090F, - 0.8879643177F, 0.8882190704F, 0.8884734671F, 0.8887275078F, - 0.8889811927F, 0.8892345216F, 0.8894874948F, 0.8897401122F, - 0.8899923738F, 0.8902442798F, 0.8904958301F, 0.8907470248F, - 0.8909978640F, 0.8912483477F, 0.8914984759F, 0.8917482487F, - 0.8919976662F, 0.8922467284F, 0.8924954353F, 0.8927437871F, - 0.8929917837F, 0.8932394252F, 0.8934867118F, 0.8937336433F, - 0.8939802199F, 0.8942264417F, 0.8944723087F, 0.8947178210F, - 0.8949629785F, 0.8952077815F, 0.8954522299F, 0.8956963239F, - 0.8959400634F, 0.8961834486F, 0.8964264795F, 0.8966691561F, - 0.8969114786F, 0.8971534470F, 0.8973950614F, 0.8976363219F, - 0.8978772284F, 0.8981177812F, 0.8983579802F, 0.8985978256F, - 0.8988373174F, 0.8990764556F, 0.8993152405F, 0.8995536720F, - 0.8997917502F, 0.9000294751F, 0.9002668470F, 0.9005038658F, - 0.9007405317F, 0.9009768446F, 0.9012128048F, 0.9014484123F, - 0.9016836671F, 0.9019185693F, 0.9021531191F, 0.9023873165F, - 0.9026211616F, 0.9028546546F, 0.9030877954F, 0.9033205841F, - 0.9035530210F, 0.9037851059F, 0.9040168392F, 0.9042482207F, - 0.9044792507F, 0.9047099293F, 0.9049402564F, 0.9051702323F, - 0.9053998569F, 0.9056291305F, 0.9058580531F, 0.9060866248F, - 0.9063148457F, 0.9065427159F, 0.9067702355F, 0.9069974046F, - 0.9072242233F, 0.9074506917F, 0.9076768100F, 0.9079025782F, - 0.9081279964F, 0.9083530647F, 0.9085777833F, 0.9088021523F, - 0.9090261717F, 0.9092498417F, 0.9094731623F, 0.9096961338F, - 0.9099187561F, 0.9101410295F, 0.9103629540F, 0.9105845297F, - 0.9108057568F, 0.9110266354F, 0.9112471656F, 0.9114673475F, - 0.9116871812F, 0.9119066668F, 0.9121258046F, 0.9123445945F, - 0.9125630367F, 0.9127811314F, 0.9129988786F, 0.9132162785F, - 0.9134333312F, 0.9136500368F, 0.9138663954F, 0.9140824073F, - 0.9142980724F, 0.9145133910F, 0.9147283632F, 0.9149429890F, - 0.9151572687F, 0.9153712023F, 0.9155847900F, 0.9157980319F, - 0.9160109282F, 0.9162234790F, 0.9164356844F, 0.9166475445F, - 0.9168590595F, 0.9170702296F, 0.9172810548F, 0.9174915354F, - 0.9177016714F, 0.9179114629F, 0.9181209102F, 0.9183300134F, - 0.9185387726F, 0.9187471879F, 0.9189552595F, 0.9191629876F, - 0.9193703723F, 0.9195774136F, 0.9197841119F, 0.9199904672F, - 0.9201964797F, 0.9204021495F, 0.9206074767F, 0.9208124616F, - 0.9210171043F, 0.9212214049F, 0.9214253636F, 0.9216289805F, - 0.9218322558F, 0.9220351896F, 0.9222377821F, 0.9224400335F, - 0.9226419439F, 0.9228435134F, 0.9230447423F, 0.9232456307F, - 0.9234461787F, 0.9236463865F, 0.9238462543F, 0.9240457822F, - 0.9242449704F, 0.9244438190F, 0.9246423282F, 0.9248404983F, - 0.9250383293F, 0.9252358214F, 0.9254329747F, 0.9256297896F, - 0.9258262660F, 0.9260224042F, 0.9262182044F, 0.9264136667F, - 0.9266087913F, 0.9268035783F, 0.9269980280F, 0.9271921405F, - 0.9273859160F, 0.9275793546F, 0.9277724566F, 0.9279652221F, - 0.9281576513F, 0.9283497443F, 0.9285415014F, 0.9287329227F, - 0.9289240084F, 0.9291147586F, 0.9293051737F, 0.9294952536F, - 0.9296849987F, 0.9298744091F, 0.9300634850F, 0.9302522266F, - 0.9304406340F, 0.9306287074F, 0.9308164471F, 0.9310038532F, - 0.9311909259F, 0.9313776654F, 0.9315640719F, 0.9317501455F, - 0.9319358865F, 0.9321212951F, 0.9323063713F, 0.9324911155F, - 0.9326755279F, 0.9328596085F, 0.9330433577F, 0.9332267756F, - 0.9334098623F, 0.9335926182F, 0.9337750434F, 0.9339571380F, - 0.9341389023F, 0.9343203366F, 0.9345014409F, 0.9346822155F, - 0.9348626606F, 0.9350427763F, 0.9352225630F, 0.9354020207F, - 0.9355811498F, 0.9357599503F, 0.9359384226F, 0.9361165667F, - 0.9362943830F, 0.9364718716F, 0.9366490327F, 0.9368258666F, - 0.9370023733F, 0.9371785533F, 0.9373544066F, 0.9375299335F, - 0.9377051341F, 0.9378800087F, 0.9380545576F, 0.9382287809F, - 0.9384026787F, 0.9385762515F, 0.9387494993F, 0.9389224223F, - 0.9390950209F, 0.9392672951F, 0.9394392453F, 0.9396108716F, - 0.9397821743F, 0.9399531536F, 0.9401238096F, 0.9402941427F, - 0.9404641530F, 0.9406338407F, 0.9408032061F, 0.9409722495F, - 0.9411409709F, 0.9413093707F, 0.9414774491F, 0.9416452062F, - 0.9418126424F, 0.9419797579F, 0.9421465528F, 0.9423130274F, - 0.9424791819F, 0.9426450166F, 0.9428105317F, 0.9429757274F, - 0.9431406039F, 0.9433051616F, 0.9434694005F, 0.9436333209F, - 0.9437969232F, 0.9439602074F, 0.9441231739F, 0.9442858229F, - 0.9444481545F, 0.9446101691F, 0.9447718669F, 0.9449332481F, - 0.9450943129F, 0.9452550617F, 0.9454154945F, 0.9455756118F, - 0.9457354136F, 0.9458949003F, 0.9460540721F, 0.9462129292F, - 0.9463714719F, 0.9465297003F, 0.9466876149F, 0.9468452157F, - 0.9470025031F, 0.9471594772F, 0.9473161384F, 0.9474724869F, - 0.9476285229F, 0.9477842466F, 0.9479396584F, 0.9480947585F, - 0.9482495470F, 0.9484040243F, 0.9485581906F, 0.9487120462F, - 0.9488655913F, 0.9490188262F, 0.9491717511F, 0.9493243662F, - 0.9494766718F, 0.9496286683F, 0.9497803557F, 0.9499317345F, - 0.9500828047F, 0.9502335668F, 0.9503840209F, 0.9505341673F, - 0.9506840062F, 0.9508335380F, 0.9509827629F, 0.9511316810F, - 0.9512802928F, 0.9514285984F, 0.9515765982F, 0.9517242923F, - 0.9518716810F, 0.9520187646F, 0.9521655434F, 0.9523120176F, - 0.9524581875F, 0.9526040534F, 0.9527496154F, 0.9528948739F, - 0.9530398292F, 0.9531844814F, 0.9533288310F, 0.9534728780F, - 0.9536166229F, 0.9537600659F, 0.9539032071F, 0.9540460470F, - 0.9541885858F, 0.9543308237F, 0.9544727611F, 0.9546143981F, - 0.9547557351F, 0.9548967723F, 0.9550375100F, 0.9551779485F, - 0.9553180881F, 0.9554579290F, 0.9555974714F, 0.9557367158F, - 0.9558756623F, 0.9560143112F, 0.9561526628F, 0.9562907174F, - 0.9564284752F, 0.9565659366F, 0.9567031017F, 0.9568399710F, - 0.9569765446F, 0.9571128229F, 0.9572488061F, 0.9573844944F, - 0.9575198883F, 0.9576549879F, 0.9577897936F, 0.9579243056F, - 0.9580585242F, 0.9581924497F, 0.9583260824F, 0.9584594226F, - 0.9585924705F, 0.9587252264F, 0.9588576906F, 0.9589898634F, - 0.9591217452F, 0.9592533360F, 0.9593846364F, 0.9595156465F, - 0.9596463666F, 0.9597767971F, 0.9599069382F, 0.9600367901F, - 0.9601663533F, 0.9602956279F, 0.9604246143F, 0.9605533128F, - 0.9606817236F, 0.9608098471F, 0.9609376835F, 0.9610652332F, - 0.9611924963F, 0.9613194733F, 0.9614461644F, 0.9615725699F, - 0.9616986901F, 0.9618245253F, 0.9619500757F, 0.9620753418F, - 0.9622003238F, 0.9623250219F, 0.9624494365F, 0.9625735679F, - 0.9626974163F, 0.9628209821F, 0.9629442656F, 0.9630672671F, - 0.9631899868F, 0.9633124251F, 0.9634345822F, 0.9635564585F, - 0.9636780543F, 0.9637993699F, 0.9639204056F, 0.9640411616F, - 0.9641616383F, 0.9642818359F, 0.9644017549F, 0.9645213955F, - 0.9646407579F, 0.9647598426F, 0.9648786497F, 0.9649971797F, - 0.9651154328F, 0.9652334092F, 0.9653511095F, 0.9654685337F, - 0.9655856823F, 0.9657025556F, 0.9658191538F, 0.9659354773F, - 0.9660515263F, 0.9661673013F, 0.9662828024F, 0.9663980300F, - 0.9665129845F, 0.9666276660F, 0.9667420750F, 0.9668562118F, - 0.9669700766F, 0.9670836698F, 0.9671969917F, 0.9673100425F, - 0.9674228227F, 0.9675353325F, 0.9676475722F, 0.9677595422F, - 0.9678712428F, 0.9679826742F, 0.9680938368F, 0.9682047309F, - 0.9683153569F, 0.9684257150F, 0.9685358056F, 0.9686456289F, - 0.9687551853F, 0.9688644752F, 0.9689734987F, 0.9690822564F, - 0.9691907483F, 0.9692989750F, 0.9694069367F, 0.9695146337F, - 0.9696220663F, 0.9697292349F, 0.9698361398F, 0.9699427813F, - 0.9700491597F, 0.9701552754F, 0.9702611286F, 0.9703667197F, - 0.9704720490F, 0.9705771169F, 0.9706819236F, 0.9707864695F, - 0.9708907549F, 0.9709947802F, 0.9710985456F, 0.9712020514F, - 0.9713052981F, 0.9714082859F, 0.9715110151F, 0.9716134862F, - 0.9717156993F, 0.9718176549F, 0.9719193532F, 0.9720207946F, - 0.9721219794F, 0.9722229080F, 0.9723235806F, 0.9724239976F, - 0.9725241593F, 0.9726240661F, 0.9727237183F, 0.9728231161F, - 0.9729222601F, 0.9730211503F, 0.9731197873F, 0.9732181713F, - 0.9733163027F, 0.9734141817F, 0.9735118088F, 0.9736091842F, - 0.9737063083F, 0.9738031814F, 0.9738998039F, 0.9739961760F, - 0.9740922981F, 0.9741881706F, 0.9742837938F, 0.9743791680F, - 0.9744742935F, 0.9745691707F, 0.9746637999F, 0.9747581814F, - 0.9748523157F, 0.9749462029F, 0.9750398435F, 0.9751332378F, - 0.9752263861F, 0.9753192887F, 0.9754119461F, 0.9755043585F, - 0.9755965262F, 0.9756884496F, 0.9757801291F, 0.9758715650F, - 0.9759627575F, 0.9760537071F, 0.9761444141F, 0.9762348789F, - 0.9763251016F, 0.9764150828F, 0.9765048228F, 0.9765943218F, - 0.9766835802F, 0.9767725984F, 0.9768613767F, 0.9769499154F, - 0.9770382149F, 0.9771262755F, 0.9772140976F, 0.9773016815F, - 0.9773890275F, 0.9774761360F, 0.9775630073F, 0.9776496418F, - 0.9777360398F, 0.9778222016F, 0.9779081277F, 0.9779938182F, - 0.9780792736F, 0.9781644943F, 0.9782494805F, 0.9783342326F, - 0.9784187509F, 0.9785030359F, 0.9785870877F, 0.9786709069F, - 0.9787544936F, 0.9788378484F, 0.9789209714F, 0.9790038631F, - 0.9790865238F, 0.9791689538F, 0.9792511535F, 0.9793331232F, - 0.9794148633F, 0.9794963742F, 0.9795776561F, 0.9796587094F, - 0.9797395345F, 0.9798201316F, 0.9799005013F, 0.9799806437F, - 0.9800605593F, 0.9801402483F, 0.9802197112F, 0.9802989483F, - 0.9803779600F, 0.9804567465F, 0.9805353082F, 0.9806136455F, - 0.9806917587F, 0.9807696482F, 0.9808473143F, 0.9809247574F, - 0.9810019778F, 0.9810789759F, 0.9811557519F, 0.9812323064F, - 0.9813086395F, 0.9813847517F, 0.9814606433F, 0.9815363147F, - 0.9816117662F, 0.9816869981F, 0.9817620108F, 0.9818368047F, - 0.9819113801F, 0.9819857374F, 0.9820598769F, 0.9821337989F, - 0.9822075038F, 0.9822809920F, 0.9823542638F, 0.9824273195F, - 0.9825001596F, 0.9825727843F, 0.9826451940F, 0.9827173891F, - 0.9827893700F, 0.9828611368F, 0.9829326901F, 0.9830040302F, - 0.9830751574F, 0.9831460720F, 0.9832167745F, 0.9832872652F, - 0.9833575444F, 0.9834276124F, 0.9834974697F, 0.9835671166F, - 0.9836365535F, 0.9837057806F, 0.9837747983F, 0.9838436071F, - 0.9839122072F, 0.9839805990F, 0.9840487829F, 0.9841167591F, - 0.9841845282F, 0.9842520903F, 0.9843194459F, 0.9843865953F, - 0.9844535389F, 0.9845202771F, 0.9845868101F, 0.9846531383F, - 0.9847192622F, 0.9847851820F, 0.9848508980F, 0.9849164108F, - 0.9849817205F, 0.9850468276F, 0.9851117324F, 0.9851764352F, - 0.9852409365F, 0.9853052366F, 0.9853693358F, 0.9854332344F, - 0.9854969330F, 0.9855604317F, 0.9856237309F, 0.9856868310F, - 0.9857497325F, 0.9858124355F, 0.9858749404F, 0.9859372477F, - 0.9859993577F, 0.9860612707F, 0.9861229871F, 0.9861845072F, - 0.9862458315F, 0.9863069601F, 0.9863678936F, 0.9864286322F, - 0.9864891764F, 0.9865495264F, 0.9866096826F, 0.9866696454F, - 0.9867294152F, 0.9867889922F, 0.9868483769F, 0.9869075695F, - 0.9869665706F, 0.9870253803F, 0.9870839991F, 0.9871424273F, - 0.9872006653F, 0.9872587135F, 0.9873165721F, 0.9873742415F, - 0.9874317222F, 0.9874890144F, 0.9875461185F, 0.9876030348F, - 0.9876597638F, 0.9877163057F, 0.9877726610F, 0.9878288300F, - 0.9878848130F, 0.9879406104F, 0.9879962225F, 0.9880516497F, - 0.9881068924F, 0.9881619509F, 0.9882168256F, 0.9882715168F, - 0.9883260249F, 0.9883803502F, 0.9884344931F, 0.9884884539F, - 0.9885422331F, 0.9885958309F, 0.9886492477F, 0.9887024838F, - 0.9887555397F, 0.9888084157F, 0.9888611120F, 0.9889136292F, - 0.9889659675F, 0.9890181273F, 0.9890701089F, 0.9891219128F, - 0.9891735392F, 0.9892249885F, 0.9892762610F, 0.9893273572F, - 0.9893782774F, 0.9894290219F, 0.9894795911F, 0.9895299853F, - 0.9895802049F, 0.9896302502F, 0.9896801217F, 0.9897298196F, - 0.9897793443F, 0.9898286961F, 0.9898778755F, 0.9899268828F, - 0.9899757183F, 0.9900243823F, 0.9900728753F, 0.9901211976F, - 0.9901693495F, 0.9902173314F, 0.9902651436F, 0.9903127865F, - 0.9903602605F, 0.9904075659F, 0.9904547031F, 0.9905016723F, - 0.9905484740F, 0.9905951086F, 0.9906415763F, 0.9906878775F, - 0.9907340126F, 0.9907799819F, 0.9908257858F, 0.9908714247F, - 0.9909168988F, 0.9909622086F, 0.9910073543F, 0.9910523364F, - 0.9910971552F, 0.9911418110F, 0.9911863042F, 0.9912306351F, - 0.9912748042F, 0.9913188117F, 0.9913626580F, 0.9914063435F, - 0.9914498684F, 0.9914932333F, 0.9915364383F, 0.9915794839F, - 0.9916223703F, 0.9916650981F, 0.9917076674F, 0.9917500787F, - 0.9917923323F, 0.9918344286F, 0.9918763679F, 0.9919181505F, - 0.9919597769F, 0.9920012473F, 0.9920425621F, 0.9920837217F, - 0.9921247263F, 0.9921655765F, 0.9922062724F, 0.9922468145F, - 0.9922872030F, 0.9923274385F, 0.9923675211F, 0.9924074513F, - 0.9924472294F, 0.9924868557F, 0.9925263306F, 0.9925656544F, - 0.9926048275F, 0.9926438503F, 0.9926827230F, 0.9927214461F, - 0.9927600199F, 0.9927984446F, 0.9928367208F, 0.9928748486F, - 0.9929128285F, 0.9929506608F, 0.9929883459F, 0.9930258841F, - 0.9930632757F, 0.9931005211F, 0.9931376207F, 0.9931745747F, - 0.9932113836F, 0.9932480476F, 0.9932845671F, 0.9933209425F, - 0.9933571742F, 0.9933932623F, 0.9934292074F, 0.9934650097F, - 0.9935006696F, 0.9935361874F, 0.9935715635F, 0.9936067982F, - 0.9936418919F, 0.9936768448F, 0.9937116574F, 0.9937463300F, - 0.9937808629F, 0.9938152565F, 0.9938495111F, 0.9938836271F, - 0.9939176047F, 0.9939514444F, 0.9939851465F, 0.9940187112F, - 0.9940521391F, 0.9940854303F, 0.9941185853F, 0.9941516044F, - 0.9941844879F, 0.9942172361F, 0.9942498495F, 0.9942823283F, - 0.9943146729F, 0.9943468836F, 0.9943789608F, 0.9944109047F, - 0.9944427158F, 0.9944743944F, 0.9945059408F, 0.9945373553F, - 0.9945686384F, 0.9945997902F, 0.9946308112F, 0.9946617017F, - 0.9946924621F, 0.9947230926F, 0.9947535937F, 0.9947839656F, - 0.9948142086F, 0.9948443232F, 0.9948743097F, 0.9949041683F, - 0.9949338995F, 0.9949635035F, 0.9949929807F, 0.9950223315F, - 0.9950515561F, 0.9950806549F, 0.9951096282F, 0.9951384764F, - 0.9951671998F, 0.9951957987F, 0.9952242735F, 0.9952526245F, - 0.9952808520F, 0.9953089564F, 0.9953369380F, 0.9953647971F, - 0.9953925340F, 0.9954201491F, 0.9954476428F, 0.9954750153F, - 0.9955022670F, 0.9955293981F, 0.9955564092F, 0.9955833003F, - 0.9956100720F, 0.9956367245F, 0.9956632582F, 0.9956896733F, - 0.9957159703F, 0.9957421494F, 0.9957682110F, 0.9957941553F, - 0.9958199828F, 0.9958456937F, 0.9958712884F, 0.9958967672F, - 0.9959221305F, 0.9959473784F, 0.9959725115F, 0.9959975300F, - 0.9960224342F, 0.9960472244F, 0.9960719011F, 0.9960964644F, - 0.9961209148F, 0.9961452525F, 0.9961694779F, 0.9961935913F, - 0.9962175930F, 0.9962414834F, 0.9962652627F, 0.9962889313F, - 0.9963124895F, 0.9963359377F, 0.9963592761F, 0.9963825051F, - 0.9964056250F, 0.9964286361F, 0.9964515387F, 0.9964743332F, - 0.9964970198F, 0.9965195990F, 0.9965420709F, 0.9965644360F, - 0.9965866946F, 0.9966088469F, 0.9966308932F, 0.9966528340F, - 0.9966746695F, 0.9966964001F, 0.9967180260F, 0.9967395475F, - 0.9967609651F, 0.9967822789F, 0.9968034894F, 0.9968245968F, - 0.9968456014F, 0.9968665036F, 0.9968873037F, 0.9969080019F, - 0.9969285987F, 0.9969490942F, 0.9969694889F, 0.9969897830F, - 0.9970099769F, 0.9970300708F, 0.9970500651F, 0.9970699601F, - 0.9970897561F, 0.9971094533F, 0.9971290522F, 0.9971485531F, - 0.9971679561F, 0.9971872617F, 0.9972064702F, 0.9972255818F, - 0.9972445968F, 0.9972635157F, 0.9972823386F, 0.9973010659F, - 0.9973196980F, 0.9973382350F, 0.9973566773F, 0.9973750253F, - 0.9973932791F, 0.9974114392F, 0.9974295059F, 0.9974474793F, - 0.9974653599F, 0.9974831480F, 0.9975008438F, 0.9975184476F, - 0.9975359598F, 0.9975533806F, 0.9975707104F, 0.9975879495F, - 0.9976050981F, 0.9976221566F, 0.9976391252F, 0.9976560043F, - 0.9976727941F, 0.9976894950F, 0.9977061073F, 0.9977226312F, - 0.9977390671F, 0.9977554152F, 0.9977716759F, 0.9977878495F, - 0.9978039361F, 0.9978199363F, 0.9978358501F, 0.9978516780F, - 0.9978674202F, 0.9978830771F, 0.9978986488F, 0.9979141358F, - 0.9979295383F, 0.9979448566F, 0.9979600909F, 0.9979752417F, - 0.9979903091F, 0.9980052936F, 0.9980201952F, 0.9980350145F, - 0.9980497515F, 0.9980644067F, 0.9980789804F, 0.9980934727F, - 0.9981078841F, 0.9981222147F, 0.9981364649F, 0.9981506350F, - 0.9981647253F, 0.9981787360F, 0.9981926674F, 0.9982065199F, - 0.9982202936F, 0.9982339890F, 0.9982476062F, 0.9982611456F, - 0.9982746074F, 0.9982879920F, 0.9983012996F, 0.9983145304F, - 0.9983276849F, 0.9983407632F, 0.9983537657F, 0.9983666926F, - 0.9983795442F, 0.9983923208F, 0.9984050226F, 0.9984176501F, - 0.9984302033F, 0.9984426827F, 0.9984550884F, 0.9984674208F, - 0.9984796802F, 0.9984918667F, 0.9985039808F, 0.9985160227F, - 0.9985279926F, 0.9985398909F, 0.9985517177F, 0.9985634734F, - 0.9985751583F, 0.9985867727F, 0.9985983167F, 0.9986097907F, - 0.9986211949F, 0.9986325297F, 0.9986437953F, 0.9986549919F, - 0.9986661199F, 0.9986771795F, 0.9986881710F, 0.9986990946F, - 0.9987099507F, 0.9987207394F, 0.9987314611F, 0.9987421161F, - 0.9987527045F, 0.9987632267F, 0.9987736829F, 0.9987840734F, - 0.9987943985F, 0.9988046584F, 0.9988148534F, 0.9988249838F, - 0.9988350498F, 0.9988450516F, 0.9988549897F, 0.9988648641F, - 0.9988746753F, 0.9988844233F, 0.9988941086F, 0.9989037313F, - 0.9989132918F, 0.9989227902F, 0.9989322269F, 0.9989416021F, - 0.9989509160F, 0.9989601690F, 0.9989693613F, 0.9989784931F, - 0.9989875647F, 0.9989965763F, 0.9990055283F, 0.9990144208F, - 0.9990232541F, 0.9990320286F, 0.9990407443F, 0.9990494016F, - 0.9990580008F, 0.9990665421F, 0.9990750257F, 0.9990834519F, - 0.9990918209F, 0.9991001331F, 0.9991083886F, 0.9991165877F, - 0.9991247307F, 0.9991328177F, 0.9991408491F, 0.9991488251F, - 0.9991567460F, 0.9991646119F, 0.9991724232F, 0.9991801801F, - 0.9991878828F, 0.9991955316F, 0.9992031267F, 0.9992106684F, - 0.9992181569F, 0.9992255925F, 0.9992329753F, 0.9992403057F, - 0.9992475839F, 0.9992548101F, 0.9992619846F, 0.9992691076F, - 0.9992761793F, 0.9992832001F, 0.9992901701F, 0.9992970895F, - 0.9993039587F, 0.9993107777F, 0.9993175470F, 0.9993242667F, - 0.9993309371F, 0.9993375583F, 0.9993441307F, 0.9993506545F, - 0.9993571298F, 0.9993635570F, 0.9993699362F, 0.9993762678F, - 0.9993825519F, 0.9993887887F, 0.9993949785F, 0.9994011216F, - 0.9994072181F, 0.9994132683F, 0.9994192725F, 0.9994252307F, - 0.9994311434F, 0.9994370107F, 0.9994428327F, 0.9994486099F, - 0.9994543423F, 0.9994600303F, 0.9994656739F, 0.9994712736F, - 0.9994768294F, 0.9994823417F, 0.9994878105F, 0.9994932363F, - 0.9994986191F, 0.9995039592F, 0.9995092568F, 0.9995145122F, - 0.9995197256F, 0.9995248971F, 0.9995300270F, 0.9995351156F, - 0.9995401630F, 0.9995451695F, 0.9995501352F, 0.9995550604F, - 0.9995599454F, 0.9995647903F, 0.9995695953F, 0.9995743607F, - 0.9995790866F, 0.9995837734F, 0.9995884211F, 0.9995930300F, - 0.9995976004F, 0.9996021324F, 0.9996066263F, 0.9996110822F, - 0.9996155004F, 0.9996198810F, 0.9996242244F, 0.9996285306F, - 0.9996327999F, 0.9996370326F, 0.9996412287F, 0.9996453886F, - 0.9996495125F, 0.9996536004F, 0.9996576527F, 0.9996616696F, - 0.9996656512F, 0.9996695977F, 0.9996735094F, 0.9996773865F, - 0.9996812291F, 0.9996850374F, 0.9996888118F, 0.9996925523F, - 0.9996962591F, 0.9996999325F, 0.9997035727F, 0.9997071798F, - 0.9997107541F, 0.9997142957F, 0.9997178049F, 0.9997212818F, - 0.9997247266F, 0.9997281396F, 0.9997315209F, 0.9997348708F, - 0.9997381893F, 0.9997414767F, 0.9997447333F, 0.9997479591F, - 0.9997511544F, 0.9997543194F, 0.9997574542F, 0.9997605591F, - 0.9997636342F, 0.9997666797F, 0.9997696958F, 0.9997726828F, - 0.9997756407F, 0.9997785698F, 0.9997814703F, 0.9997843423F, - 0.9997871860F, 0.9997900016F, 0.9997927894F, 0.9997955494F, - 0.9997982818F, 0.9998009869F, 0.9998036648F, 0.9998063157F, - 0.9998089398F, 0.9998115373F, 0.9998141082F, 0.9998166529F, - 0.9998191715F, 0.9998216642F, 0.9998241311F, 0.9998265724F, - 0.9998289884F, 0.9998313790F, 0.9998337447F, 0.9998360854F, - 0.9998384015F, 0.9998406930F, 0.9998429602F, 0.9998452031F, - 0.9998474221F, 0.9998496171F, 0.9998517885F, 0.9998539364F, - 0.9998560610F, 0.9998581624F, 0.9998602407F, 0.9998622962F, - 0.9998643291F, 0.9998663394F, 0.9998683274F, 0.9998702932F, - 0.9998722370F, 0.9998741589F, 0.9998760591F, 0.9998779378F, - 0.9998797952F, 0.9998816313F, 0.9998834464F, 0.9998852406F, - 0.9998870141F, 0.9998887670F, 0.9998904995F, 0.9998922117F, - 0.9998939039F, 0.9998955761F, 0.9998972285F, 0.9998988613F, - 0.9999004746F, 0.9999020686F, 0.9999036434F, 0.9999051992F, - 0.9999067362F, 0.9999082544F, 0.9999097541F, 0.9999112354F, - 0.9999126984F, 0.9999141433F, 0.9999155703F, 0.9999169794F, - 0.9999183709F, 0.9999197449F, 0.9999211014F, 0.9999224408F, - 0.9999237631F, 0.9999250684F, 0.9999263570F, 0.9999276289F, - 0.9999288843F, 0.9999301233F, 0.9999313461F, 0.9999325529F, - 0.9999337437F, 0.9999349187F, 0.9999360780F, 0.9999372218F, - 0.9999383503F, 0.9999394635F, 0.9999405616F, 0.9999416447F, - 0.9999427129F, 0.9999437665F, 0.9999448055F, 0.9999458301F, - 0.9999468404F, 0.9999478365F, 0.9999488185F, 0.9999497867F, - 0.9999507411F, 0.9999516819F, 0.9999526091F, 0.9999535230F, - 0.9999544236F, 0.9999553111F, 0.9999561856F, 0.9999570472F, - 0.9999578960F, 0.9999587323F, 0.9999595560F, 0.9999603674F, - 0.9999611666F, 0.9999619536F, 0.9999627286F, 0.9999634917F, - 0.9999642431F, 0.9999649828F, 0.9999657110F, 0.9999664278F, - 0.9999671334F, 0.9999678278F, 0.9999685111F, 0.9999691835F, - 0.9999698451F, 0.9999704960F, 0.9999711364F, 0.9999717662F, - 0.9999723858F, 0.9999729950F, 0.9999735942F, 0.9999741834F, - 0.9999747626F, 0.9999753321F, 0.9999758919F, 0.9999764421F, - 0.9999769828F, 0.9999775143F, 0.9999780364F, 0.9999785495F, - 0.9999790535F, 0.9999795485F, 0.9999800348F, 0.9999805124F, - 0.9999809813F, 0.9999814417F, 0.9999818938F, 0.9999823375F, - 0.9999827731F, 0.9999832005F, 0.9999836200F, 0.9999840316F, - 0.9999844353F, 0.9999848314F, 0.9999852199F, 0.9999856008F, - 0.9999859744F, 0.9999863407F, 0.9999866997F, 0.9999870516F, - 0.9999873965F, 0.9999877345F, 0.9999880656F, 0.9999883900F, - 0.9999887078F, 0.9999890190F, 0.9999893237F, 0.9999896220F, - 0.9999899140F, 0.9999901999F, 0.9999904796F, 0.9999907533F, - 0.9999910211F, 0.9999912830F, 0.9999915391F, 0.9999917896F, - 0.9999920345F, 0.9999922738F, 0.9999925077F, 0.9999927363F, - 0.9999929596F, 0.9999931777F, 0.9999933907F, 0.9999935987F, - 0.9999938018F, 0.9999940000F, 0.9999941934F, 0.9999943820F, - 0.9999945661F, 0.9999947456F, 0.9999949206F, 0.9999950912F, - 0.9999952575F, 0.9999954195F, 0.9999955773F, 0.9999957311F, - 0.9999958807F, 0.9999960265F, 0.9999961683F, 0.9999963063F, - 0.9999964405F, 0.9999965710F, 0.9999966979F, 0.9999968213F, - 0.9999969412F, 0.9999970576F, 0.9999971707F, 0.9999972805F, - 0.9999973871F, 0.9999974905F, 0.9999975909F, 0.9999976881F, - 0.9999977824F, 0.9999978738F, 0.9999979624F, 0.9999980481F, - 0.9999981311F, 0.9999982115F, 0.9999982892F, 0.9999983644F, - 0.9999984370F, 0.9999985072F, 0.9999985750F, 0.9999986405F, - 0.9999987037F, 0.9999987647F, 0.9999988235F, 0.9999988802F, - 0.9999989348F, 0.9999989873F, 0.9999990379F, 0.9999990866F, - 0.9999991334F, 0.9999991784F, 0.9999992217F, 0.9999992632F, - 0.9999993030F, 0.9999993411F, 0.9999993777F, 0.9999994128F, - 0.9999994463F, 0.9999994784F, 0.9999995091F, 0.9999995384F, - 0.9999995663F, 0.9999995930F, 0.9999996184F, 0.9999996426F, - 0.9999996657F, 0.9999996876F, 0.9999997084F, 0.9999997282F, - 0.9999997469F, 0.9999997647F, 0.9999997815F, 0.9999997973F, - 0.9999998123F, 0.9999998265F, 0.9999998398F, 0.9999998524F, - 0.9999998642F, 0.9999998753F, 0.9999998857F, 0.9999998954F, - 0.9999999045F, 0.9999999130F, 0.9999999209F, 0.9999999282F, - 0.9999999351F, 0.9999999414F, 0.9999999472F, 0.9999999526F, - 0.9999999576F, 0.9999999622F, 0.9999999664F, 0.9999999702F, - 0.9999999737F, 0.9999999769F, 0.9999999798F, 0.9999999824F, - 0.9999999847F, 0.9999999868F, 0.9999999887F, 0.9999999904F, - 0.9999999919F, 0.9999999932F, 0.9999999943F, 0.9999999953F, - 0.9999999961F, 0.9999999969F, 0.9999999975F, 0.9999999980F, - 0.9999999985F, 0.9999999988F, 0.9999999991F, 0.9999999993F, - 0.9999999995F, 0.9999999997F, 0.9999999998F, 0.9999999999F, - 0.9999999999F, 1.0000000000F, 1.0000000000F, 1.0000000000F, - 1.0000000000F, 1.0000000000F, 1.0000000000F, 1.0000000000F, -}; +void ff_vorbis_ready_floor1_list(floor1_entry_t * list, int values); +unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n); // x^(1/n) +int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, uint_fast32_t num); +void ff_vorbis_floor1_render_list(floor1_entry_t * list, int values, uint_fast16_t * y_list, int * flag, int multiplier, float * out, int samples); -static const float floor1_inverse_db_table[256]={ - 1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F, - 1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F, - 1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F, - 2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F, - 2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F, - 3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F, - 4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F, - 6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F, - 7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F, - 1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F, - 1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F, - 1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F, - 2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F, - 2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F, - 3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F, - 4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F, - 5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F, - 7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F, - 9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F, - 1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F, - 1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F, - 2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F, - 2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F, - 3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F, - 4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F, - 5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F, - 7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F, - 9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F, - 0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F, - 0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F, - 0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F, - 0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F, - 0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F, - 0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F, - 0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F, - 0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F, - 0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F, - 0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F, - 0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F, - 0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F, - 0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F, - 0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F, - 0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F, - 0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F, - 0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F, - 0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F, - 0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F, - 0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F, - 0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F, - 0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F, - 0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F, - 0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F, - 0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F, - 0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F, - 0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F, - 0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F, - 0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F, - 0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F, - 0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F, - 0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F, - 0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F, - 0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F, - 0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F, - 0.82788260F, 0.88168307F, 0.9389798F, 1.F, -}; +#define ilog(i) av_log2(2*(i)) +#endif diff --git a/src/libffmpeg/libavcodec/vorbis_data.c b/src/libffmpeg/libavcodec/vorbis_data.c new file mode 100644 index 000000000..5dc9c5f00 --- /dev/null +++ b/src/libffmpeg/libavcodec/vorbis_data.c @@ -0,0 +1,2155 @@ +/* + * copyright (c) 2005 Denes Balatoni ( dbalatoni programozo hu ) + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "vorbis.h" + +static const float vwin64[32] = { + 0.0009460463F, 0.0085006468F, 0.0235352254F, 0.0458950567F, + 0.0753351908F, 0.1115073077F, 0.1539457973F, 0.2020557475F, + 0.2551056759F, 0.3122276645F, 0.3724270287F, 0.4346027792F, + 0.4975789974F, 0.5601459521F, 0.6211085051F, 0.6793382689F, + 0.7338252629F, 0.7837245849F, 0.8283939355F, 0.8674186656F, + 0.9006222429F, 0.9280614787F, 0.9500073081F, 0.9669131782F, + 0.9793740220F, 0.9880792941F, 0.9937636139F, 0.9971582668F, + 0.9989462667F, 0.9997230082F, 0.9999638688F, 0.9999995525F, +}; + +static const float vwin128[64] = { + 0.0002365472F, 0.0021280687F, 0.0059065254F, 0.0115626550F, + 0.0190823442F, 0.0284463735F, 0.0396300935F, 0.0526030430F, + 0.0673285281F, 0.0837631763F, 0.1018564887F, 0.1215504095F, + 0.1427789367F, 0.1654677960F, 0.1895342001F, 0.2148867160F, + 0.2414252576F, 0.2690412240F, 0.2976177952F, 0.3270303960F, + 0.3571473350F, 0.3878306189F, 0.4189369387F, 0.4503188188F, + 0.4818259135F, 0.5133064334F, 0.5446086751F, 0.5755826278F, + 0.6060816248F, 0.6359640047F, 0.6650947483F, 0.6933470543F, + 0.7206038179F, 0.7467589810F, 0.7717187213F, 0.7954024542F, + 0.8177436264F, 0.8386902831F, 0.8582053981F, 0.8762669622F, + 0.8928678298F, 0.9080153310F, 0.9217306608F, 0.9340480615F, + 0.9450138200F, 0.9546851041F, 0.9631286621F, 0.9704194171F, + 0.9766389810F, 0.9818741197F, 0.9862151938F, 0.9897546035F, + 0.9925852598F, 0.9947991032F, 0.9964856900F, 0.9977308602F, + 0.9986155015F, 0.9992144193F, 0.9995953200F, 0.9998179155F, + 0.9999331503F, 0.9999825563F, 0.9999977357F, 0.9999999720F, +}; + +static const float vwin256[128] = { + 0.0000591390F, 0.0005321979F, 0.0014780301F, 0.0028960636F, + 0.0047854363F, 0.0071449926F, 0.0099732775F, 0.0132685298F, + 0.0170286741F, 0.0212513119F, 0.0259337111F, 0.0310727950F, + 0.0366651302F, 0.0427069140F, 0.0491939614F, 0.0561216907F, + 0.0634851102F, 0.0712788035F, 0.0794969160F, 0.0881331402F, + 0.0971807028F, 0.1066323515F, 0.1164803426F, 0.1267164297F, + 0.1373318534F, 0.1483173323F, 0.1596630553F, 0.1713586755F, + 0.1833933062F, 0.1957555184F, 0.2084333404F, 0.2214142599F, + 0.2346852280F, 0.2482326664F, 0.2620424757F, 0.2761000481F, + 0.2903902813F, 0.3048975959F, 0.3196059553F, 0.3344988887F, + 0.3495595160F, 0.3647705766F, 0.3801144597F, 0.3955732382F, + 0.4111287047F, 0.4267624093F, 0.4424557009F, 0.4581897696F, + 0.4739456913F, 0.4897044744F, 0.5054471075F, 0.5211546088F, + 0.5368080763F, 0.5523887395F, 0.5678780103F, 0.5832575361F, + 0.5985092508F, 0.6136154277F, 0.6285587300F, 0.6433222619F, + 0.6578896175F, 0.6722449294F, 0.6863729144F, 0.7002589187F, + 0.7138889597F, 0.7272497662F, 0.7403288154F, 0.7531143679F, + 0.7655954985F, 0.7777621249F, 0.7896050322F, 0.8011158947F, + 0.8122872932F, 0.8231127294F, 0.8335866365F, 0.8437043850F, + 0.8534622861F, 0.8628575905F, 0.8718884835F, 0.8805540765F, + 0.8888543947F, 0.8967903616F, 0.9043637797F, 0.9115773078F, + 0.9184344360F, 0.9249394562F, 0.9310974312F, 0.9369141608F, + 0.9423961446F, 0.9475505439F, 0.9523851406F, 0.9569082947F, + 0.9611289005F, 0.9650563408F, 0.9687004405F, 0.9720714191F, + 0.9751798427F, 0.9780365753F, 0.9806527301F, 0.9830396204F, + 0.9852087111F, 0.9871715701F, 0.9889398207F, 0.9905250941F, + 0.9919389832F, 0.9931929973F, 0.9942985174F, 0.9952667537F, + 0.9961087037F, 0.9968351119F, 0.9974564312F, 0.9979827858F, + 0.9984239359F, 0.9987892441F, 0.9990876435F, 0.9993276081F, + 0.9995171241F, 0.9996636648F, 0.9997741654F, 0.9998550016F, + 0.9999119692F, 0.9999502656F, 0.9999744742F, 0.9999885497F, + 0.9999958064F, 0.9999989077F, 0.9999998584F, 0.9999999983F, +}; + +static const float vwin512[256] = { + 0.0000147849F, 0.0001330607F, 0.0003695946F, 0.0007243509F, + 0.0011972759F, 0.0017882983F, 0.0024973285F, 0.0033242588F, + 0.0042689632F, 0.0053312973F, 0.0065110982F, 0.0078081841F, + 0.0092223540F, 0.0107533880F, 0.0124010466F, 0.0141650703F, + 0.0160451800F, 0.0180410758F, 0.0201524373F, 0.0223789233F, + 0.0247201710F, 0.0271757958F, 0.0297453914F, 0.0324285286F, + 0.0352247556F, 0.0381335972F, 0.0411545545F, 0.0442871045F, + 0.0475306997F, 0.0508847676F, 0.0543487103F, 0.0579219038F, + 0.0616036982F, 0.0653934164F, 0.0692903546F, 0.0732937809F, + 0.0774029356F, 0.0816170305F, 0.0859352485F, 0.0903567428F, + 0.0948806375F, 0.0995060259F, 0.1042319712F, 0.1090575056F, + 0.1139816300F, 0.1190033137F, 0.1241214941F, 0.1293350764F, + 0.1346429333F, 0.1400439046F, 0.1455367974F, 0.1511203852F, + 0.1567934083F, 0.1625545735F, 0.1684025537F, 0.1743359881F, + 0.1803534820F, 0.1864536069F, 0.1926349000F, 0.1988958650F, + 0.2052349715F, 0.2116506555F, 0.2181413191F, 0.2247053313F, + 0.2313410275F, 0.2380467105F, 0.2448206500F, 0.2516610835F, + 0.2585662164F, 0.2655342226F, 0.2725632448F, 0.2796513950F, + 0.2867967551F, 0.2939973773F, 0.3012512852F, 0.3085564739F, + 0.3159109111F, 0.3233125375F, 0.3307592680F, 0.3382489922F, + 0.3457795756F, 0.3533488602F, 0.3609546657F, 0.3685947904F, + 0.3762670121F, 0.3839690896F, 0.3916987634F, 0.3994537572F, + 0.4072317788F, 0.4150305215F, 0.4228476653F, 0.4306808783F, + 0.4385278181F, 0.4463861329F, 0.4542534630F, 0.4621274424F, + 0.4700057001F, 0.4778858615F, 0.4857655502F, 0.4936423891F, + 0.5015140023F, 0.5093780165F, 0.5172320626F, 0.5250737772F, + 0.5329008043F, 0.5407107971F, 0.5485014192F, 0.5562703465F, + 0.5640152688F, 0.5717338914F, 0.5794239366F, 0.5870831457F, + 0.5947092801F, 0.6023001235F, 0.6098534829F, 0.6173671907F, + 0.6248391059F, 0.6322671161F, 0.6396491384F, 0.6469831217F, + 0.6542670475F, 0.6614989319F, 0.6686768267F, 0.6757988210F, + 0.6828630426F, 0.6898676592F, 0.6968108799F, 0.7036909564F, + 0.7105061843F, 0.7172549043F, 0.7239355032F, 0.7305464154F, + 0.7370861235F, 0.7435531598F, 0.7499461068F, 0.7562635986F, + 0.7625043214F, 0.7686670148F, 0.7747504721F, 0.7807535410F, + 0.7866751247F, 0.7925141825F, 0.7982697296F, 0.8039408387F, + 0.8095266395F, 0.8150263196F, 0.8204391248F, 0.8257643590F, + 0.8310013848F, 0.8361496236F, 0.8412085555F, 0.8461777194F, + 0.8510567129F, 0.8558451924F, 0.8605428730F, 0.8651495278F, + 0.8696649882F, 0.8740891432F, 0.8784219392F, 0.8826633797F, + 0.8868135244F, 0.8908724888F, 0.8948404441F, 0.8987176157F, + 0.9025042831F, 0.9062007791F, 0.9098074886F, 0.9133248482F, + 0.9167533451F, 0.9200935163F, 0.9233459472F, 0.9265112712F, + 0.9295901680F, 0.9325833632F, 0.9354916263F, 0.9383157705F, + 0.9410566504F, 0.9437151618F, 0.9462922398F, 0.9487888576F, + 0.9512060252F, 0.9535447882F, 0.9558062262F, 0.9579914516F, + 0.9601016078F, 0.9621378683F, 0.9641014348F, 0.9659935361F, + 0.9678154261F, 0.9695683830F, 0.9712537071F, 0.9728727198F, + 0.9744267618F, 0.9759171916F, 0.9773453842F, 0.9787127293F, + 0.9800206298F, 0.9812705006F, 0.9824637665F, 0.9836018613F, + 0.9846862258F, 0.9857183066F, 0.9866995544F, 0.9876314227F, + 0.9885153662F, 0.9893528393F, 0.9901452948F, 0.9908941823F, + 0.9916009470F, 0.9922670279F, 0.9928938570F, 0.9934828574F, + 0.9940354423F, 0.9945530133F, 0.9950369595F, 0.9954886562F, + 0.9959094633F, 0.9963007242F, 0.9966637649F, 0.9969998925F, + 0.9973103939F, 0.9975965351F, 0.9978595598F, 0.9981006885F, + 0.9983211172F, 0.9985220166F, 0.9987045311F, 0.9988697776F, + 0.9990188449F, 0.9991527924F, 0.9992726499F, 0.9993794157F, + 0.9994740570F, 0.9995575079F, 0.9996306699F, 0.9996944099F, + 0.9997495605F, 0.9997969190F, 0.9998372465F, 0.9998712678F, + 0.9998996704F, 0.9999231041F, 0.9999421807F, 0.9999574732F, + 0.9999695157F, 0.9999788026F, 0.9999857885F, 0.9999908879F, + 0.9999944746F, 0.9999968817F, 0.9999984010F, 0.9999992833F, + 0.9999997377F, 0.9999999317F, 0.9999999911F, 0.9999999999F, +}; + +static const float vwin1024[512] = { + 0.0000036962F, 0.0000332659F, 0.0000924041F, 0.0001811086F, + 0.0002993761F, 0.0004472021F, 0.0006245811F, 0.0008315063F, + 0.0010679699F, 0.0013339631F, 0.0016294757F, 0.0019544965F, + 0.0023090133F, 0.0026930125F, 0.0031064797F, 0.0035493989F, + 0.0040217533F, 0.0045235250F, 0.0050546946F, 0.0056152418F, + 0.0062051451F, 0.0068243817F, 0.0074729278F, 0.0081507582F, + 0.0088578466F, 0.0095941655F, 0.0103596863F, 0.0111543789F, + 0.0119782122F, 0.0128311538F, 0.0137131701F, 0.0146242260F, + 0.0155642855F, 0.0165333111F, 0.0175312640F, 0.0185581042F, + 0.0196137903F, 0.0206982797F, 0.0218115284F, 0.0229534910F, + 0.0241241208F, 0.0253233698F, 0.0265511886F, 0.0278075263F, + 0.0290923308F, 0.0304055484F, 0.0317471241F, 0.0331170013F, + 0.0345151222F, 0.0359414274F, 0.0373958560F, 0.0388783456F, + 0.0403888325F, 0.0419272511F, 0.0434935347F, 0.0450876148F, + 0.0467094213F, 0.0483588828F, 0.0500359261F, 0.0517404765F, + 0.0534724575F, 0.0552317913F, 0.0570183983F, 0.0588321971F, + 0.0606731048F, 0.0625410369F, 0.0644359070F, 0.0663576272F, + 0.0683061077F, 0.0702812571F, 0.0722829821F, 0.0743111878F, + 0.0763657775F, 0.0784466526F, 0.0805537129F, 0.0826868561F, + 0.0848459782F, 0.0870309736F, 0.0892417345F, 0.0914781514F, + 0.0937401128F, 0.0960275056F, 0.0983402145F, 0.1006781223F, + 0.1030411101F, 0.1054290568F, 0.1078418397F, 0.1102793336F, + 0.1127414119F, 0.1152279457F, 0.1177388042F, 0.1202738544F, + 0.1228329618F, 0.1254159892F, 0.1280227980F, 0.1306532471F, + 0.1333071937F, 0.1359844927F, 0.1386849970F, 0.1414085575F, + 0.1441550230F, 0.1469242403F, 0.1497160539F, 0.1525303063F, + 0.1553668381F, 0.1582254875F, 0.1611060909F, 0.1640084822F, + 0.1669324936F, 0.1698779549F, 0.1728446939F, 0.1758325362F, + 0.1788413055F, 0.1818708232F, 0.1849209084F, 0.1879913785F, + 0.1910820485F, 0.1941927312F, 0.1973232376F, 0.2004733764F, + 0.2036429541F, 0.2068317752F, 0.2100396421F, 0.2132663552F, + 0.2165117125F, 0.2197755102F, 0.2230575422F, 0.2263576007F, + 0.2296754753F, 0.2330109540F, 0.2363638225F, 0.2397338646F, + 0.2431208619F, 0.2465245941F, 0.2499448389F, 0.2533813719F, + 0.2568339669F, 0.2603023956F, 0.2637864277F, 0.2672858312F, + 0.2708003718F, 0.2743298135F, 0.2778739186F, 0.2814324472F, + 0.2850051576F, 0.2885918065F, 0.2921921485F, 0.2958059366F, + 0.2994329219F, 0.3030728538F, 0.3067254799F, 0.3103905462F, + 0.3140677969F, 0.3177569747F, 0.3214578205F, 0.3251700736F, + 0.3288934718F, 0.3326277513F, 0.3363726468F, 0.3401278914F, + 0.3438932168F, 0.3476683533F, 0.3514530297F, 0.3552469734F, + 0.3590499106F, 0.3628615659F, 0.3666816630F, 0.3705099239F, + 0.3743460698F, 0.3781898204F, 0.3820408945F, 0.3858990095F, + 0.3897638820F, 0.3936352274F, 0.3975127601F, 0.4013961936F, + 0.4052852405F, 0.4091796123F, 0.4130790198F, 0.4169831732F, + 0.4208917815F, 0.4248045534F, 0.4287211965F, 0.4326414181F, + 0.4365649248F, 0.4404914225F, 0.4444206167F, 0.4483522125F, + 0.4522859146F, 0.4562214270F, 0.4601584538F, 0.4640966984F, + 0.4680358644F, 0.4719756548F, 0.4759157726F, 0.4798559209F, + 0.4837958024F, 0.4877351199F, 0.4916735765F, 0.4956108751F, + 0.4995467188F, 0.5034808109F, 0.5074128550F, 0.5113425550F, + 0.5152696149F, 0.5191937395F, 0.5231146336F, 0.5270320028F, + 0.5309455530F, 0.5348549910F, 0.5387600239F, 0.5426603597F, + 0.5465557070F, 0.5504457754F, 0.5543302752F, 0.5582089175F, + 0.5620814145F, 0.5659474793F, 0.5698068262F, 0.5736591704F, + 0.5775042283F, 0.5813417176F, 0.5851713571F, 0.5889928670F, + 0.5928059689F, 0.5966103856F, 0.6004058415F, 0.6041920626F, + 0.6079687761F, 0.6117357113F, 0.6154925986F, 0.6192391705F, + 0.6229751612F, 0.6267003064F, 0.6304143441F, 0.6341170137F, + 0.6378080569F, 0.6414872173F, 0.6451542405F, 0.6488088741F, + 0.6524508681F, 0.6560799742F, 0.6596959469F, 0.6632985424F, + 0.6668875197F, 0.6704626398F, 0.6740236662F, 0.6775703649F, + 0.6811025043F, 0.6846198554F, 0.6881221916F, 0.6916092892F, + 0.6950809269F, 0.6985368861F, 0.7019769510F, 0.7054009085F, + 0.7088085484F, 0.7121996632F, 0.7155740484F, 0.7189315023F, + 0.7222718263F, 0.7255948245F, 0.7289003043F, 0.7321880760F, + 0.7354579530F, 0.7387097518F, 0.7419432921F, 0.7451583966F, + 0.7483548915F, 0.7515326059F, 0.7546913723F, 0.7578310265F, + 0.7609514077F, 0.7640523581F, 0.7671337237F, 0.7701953535F, + 0.7732371001F, 0.7762588195F, 0.7792603711F, 0.7822416178F, + 0.7852024259F, 0.7881426654F, 0.7910622097F, 0.7939609356F, + 0.7968387237F, 0.7996954579F, 0.8025310261F, 0.8053453193F, + 0.8081382324F, 0.8109096638F, 0.8136595156F, 0.8163876936F, + 0.8190941071F, 0.8217786690F, 0.8244412960F, 0.8270819086F, + 0.8297004305F, 0.8322967896F, 0.8348709171F, 0.8374227481F, + 0.8399522213F, 0.8424592789F, 0.8449438672F, 0.8474059356F, + 0.8498454378F, 0.8522623306F, 0.8546565748F, 0.8570281348F, + 0.8593769787F, 0.8617030779F, 0.8640064080F, 0.8662869477F, + 0.8685446796F, 0.8707795899F, 0.8729916682F, 0.8751809079F, + 0.8773473059F, 0.8794908626F, 0.8816115819F, 0.8837094713F, + 0.8857845418F, 0.8878368079F, 0.8898662874F, 0.8918730019F, + 0.8938569760F, 0.8958182380F, 0.8977568194F, 0.8996727552F, + 0.9015660837F, 0.9034368465F, 0.9052850885F, 0.9071108577F, + 0.9089142057F, 0.9106951869F, 0.9124538591F, 0.9141902832F, + 0.9159045233F, 0.9175966464F, 0.9192667228F, 0.9209148257F, + 0.9225410313F, 0.9241454187F, 0.9257280701F, 0.9272890704F, + 0.9288285075F, 0.9303464720F, 0.9318430576F, 0.9333183603F, + 0.9347724792F, 0.9362055158F, 0.9376175745F, 0.9390087622F, + 0.9403791881F, 0.9417289644F, 0.9430582055F, 0.9443670283F, + 0.9456555521F, 0.9469238986F, 0.9481721917F, 0.9494005577F, + 0.9506091252F, 0.9517980248F, 0.9529673894F, 0.9541173540F, + 0.9552480557F, 0.9563596334F, 0.9574522282F, 0.9585259830F, + 0.9595810428F, 0.9606175542F, 0.9616356656F, 0.9626355274F, + 0.9636172915F, 0.9645811114F, 0.9655271425F, 0.9664555414F, + 0.9673664664F, 0.9682600774F, 0.9691365355F, 0.9699960034F, + 0.9708386448F, 0.9716646250F, 0.9724741103F, 0.9732672685F, + 0.9740442683F, 0.9748052795F, 0.9755504729F, 0.9762800205F, + 0.9769940950F, 0.9776928703F, 0.9783765210F, 0.9790452223F, + 0.9796991504F, 0.9803384823F, 0.9809633954F, 0.9815740679F, + 0.9821706784F, 0.9827534063F, 0.9833224312F, 0.9838779332F, + 0.9844200928F, 0.9849490910F, 0.9854651087F, 0.9859683274F, + 0.9864589286F, 0.9869370940F, 0.9874030054F, 0.9878568447F, + 0.9882987937F, 0.9887290343F, 0.9891477481F, 0.9895551169F, + 0.9899513220F, 0.9903365446F, 0.9907109658F, 0.9910747662F, + 0.9914281260F, 0.9917712252F, 0.9921042433F, 0.9924273593F, + 0.9927407516F, 0.9930445982F, 0.9933390763F, 0.9936243626F, + 0.9939006331F, 0.9941680631F, 0.9944268269F, 0.9946770982F, + 0.9949190498F, 0.9951528537F, 0.9953786808F, 0.9955967011F, + 0.9958070836F, 0.9960099963F, 0.9962056061F, 0.9963940787F, + 0.9965755786F, 0.9967502693F, 0.9969183129F, 0.9970798704F, + 0.9972351013F, 0.9973841640F, 0.9975272151F, 0.9976644103F, + 0.9977959036F, 0.9979218476F, 0.9980423932F, 0.9981576901F, + 0.9982678862F, 0.9983731278F, 0.9984735596F, 0.9985693247F, + 0.9986605645F, 0.9987474186F, 0.9988300248F, 0.9989085193F, + 0.9989830364F, 0.9990537085F, 0.9991206662F, 0.9991840382F, + 0.9992439513F, 0.9993005303F, 0.9993538982F, 0.9994041757F, + 0.9994514817F, 0.9994959330F, 0.9995376444F, 0.9995767286F, + 0.9996132960F, 0.9996474550F, 0.9996793121F, 0.9997089710F, + 0.9997365339F, 0.9997621003F, 0.9997857677F, 0.9998076311F, + 0.9998277836F, 0.9998463156F, 0.9998633155F, 0.9998788692F, + 0.9998930603F, 0.9999059701F, 0.9999176774F, 0.9999282586F, + 0.9999377880F, 0.9999463370F, 0.9999539749F, 0.9999607685F, + 0.9999667820F, 0.9999720773F, 0.9999767136F, 0.9999807479F, + 0.9999842344F, 0.9999872249F, 0.9999897688F, 0.9999919127F, + 0.9999937009F, 0.9999951749F, 0.9999963738F, 0.9999973342F, + 0.9999980900F, 0.9999986724F, 0.9999991103F, 0.9999994297F, + 0.9999996543F, 0.9999998049F, 0.9999999000F, 0.9999999552F, + 0.9999999836F, 0.9999999957F, 0.9999999994F, 1.0000000000F, +}; + +static const float vwin2048[1024] = { + 0.0000009241F, 0.0000083165F, 0.0000231014F, 0.0000452785F, + 0.0000748476F, 0.0001118085F, 0.0001561608F, 0.0002079041F, + 0.0002670379F, 0.0003335617F, 0.0004074748F, 0.0004887765F, + 0.0005774661F, 0.0006735427F, 0.0007770054F, 0.0008878533F, + 0.0010060853F, 0.0011317002F, 0.0012646969F, 0.0014050742F, + 0.0015528307F, 0.0017079650F, 0.0018704756F, 0.0020403610F, + 0.0022176196F, 0.0024022497F, 0.0025942495F, 0.0027936173F, + 0.0030003511F, 0.0032144490F, 0.0034359088F, 0.0036647286F, + 0.0039009061F, 0.0041444391F, 0.0043953253F, 0.0046535621F, + 0.0049191472F, 0.0051920781F, 0.0054723520F, 0.0057599664F, + 0.0060549184F, 0.0063572052F, 0.0066668239F, 0.0069837715F, + 0.0073080449F, 0.0076396410F, 0.0079785566F, 0.0083247884F, + 0.0086783330F, 0.0090391871F, 0.0094073470F, 0.0097828092F, + 0.0101655700F, 0.0105556258F, 0.0109529726F, 0.0113576065F, + 0.0117695237F, 0.0121887200F, 0.0126151913F, 0.0130489335F, + 0.0134899422F, 0.0139382130F, 0.0143937415F, 0.0148565233F, + 0.0153265536F, 0.0158038279F, 0.0162883413F, 0.0167800889F, + 0.0172790660F, 0.0177852675F, 0.0182986882F, 0.0188193231F, + 0.0193471668F, 0.0198822141F, 0.0204244594F, 0.0209738974F, + 0.0215305225F, 0.0220943289F, 0.0226653109F, 0.0232434627F, + 0.0238287784F, 0.0244212519F, 0.0250208772F, 0.0256276481F, + 0.0262415582F, 0.0268626014F, 0.0274907711F, 0.0281260608F, + 0.0287684638F, 0.0294179736F, 0.0300745833F, 0.0307382859F, + 0.0314090747F, 0.0320869424F, 0.0327718819F, 0.0334638860F, + 0.0341629474F, 0.0348690586F, 0.0355822122F, 0.0363024004F, + 0.0370296157F, 0.0377638502F, 0.0385050960F, 0.0392533451F, + 0.0400085896F, 0.0407708211F, 0.0415400315F, 0.0423162123F, + 0.0430993552F, 0.0438894515F, 0.0446864926F, 0.0454904698F, + 0.0463013742F, 0.0471191969F, 0.0479439288F, 0.0487755607F, + 0.0496140836F, 0.0504594879F, 0.0513117642F, 0.0521709031F, + 0.0530368949F, 0.0539097297F, 0.0547893979F, 0.0556758894F, + 0.0565691941F, 0.0574693019F, 0.0583762026F, 0.0592898858F, + 0.0602103410F, 0.0611375576F, 0.0620715250F, 0.0630122324F, + 0.0639596688F, 0.0649138234F, 0.0658746848F, 0.0668422421F, + 0.0678164838F, 0.0687973985F, 0.0697849746F, 0.0707792005F, + 0.0717800645F, 0.0727875547F, 0.0738016591F, 0.0748223656F, + 0.0758496620F, 0.0768835359F, 0.0779239751F, 0.0789709668F, + 0.0800244985F, 0.0810845574F, 0.0821511306F, 0.0832242052F, + 0.0843037679F, 0.0853898056F, 0.0864823050F, 0.0875812525F, + 0.0886866347F, 0.0897984378F, 0.0909166480F, 0.0920412513F, + 0.0931722338F, 0.0943095813F, 0.0954532795F, 0.0966033140F, + 0.0977596702F, 0.0989223336F, 0.1000912894F, 0.1012665227F, + 0.1024480185F, 0.1036357616F, 0.1048297369F, 0.1060299290F, + 0.1072363224F, 0.1084489014F, 0.1096676504F, 0.1108925534F, + 0.1121235946F, 0.1133607577F, 0.1146040267F, 0.1158533850F, + 0.1171088163F, 0.1183703040F, 0.1196378312F, 0.1209113812F, + 0.1221909370F, 0.1234764815F, 0.1247679974F, 0.1260654674F, + 0.1273688740F, 0.1286781995F, 0.1299934263F, 0.1313145365F, + 0.1326415121F, 0.1339743349F, 0.1353129866F, 0.1366574490F, + 0.1380077035F, 0.1393637315F, 0.1407255141F, 0.1420930325F, + 0.1434662677F, 0.1448452004F, 0.1462298115F, 0.1476200814F, + 0.1490159906F, 0.1504175195F, 0.1518246482F, 0.1532373569F, + 0.1546556253F, 0.1560794333F, 0.1575087606F, 0.1589435866F, + 0.1603838909F, 0.1618296526F, 0.1632808509F, 0.1647374648F, + 0.1661994731F, 0.1676668546F, 0.1691395880F, 0.1706176516F, + 0.1721010238F, 0.1735896829F, 0.1750836068F, 0.1765827736F, + 0.1780871610F, 0.1795967468F, 0.1811115084F, 0.1826314234F, + 0.1841564689F, 0.1856866221F, 0.1872218600F, 0.1887621595F, + 0.1903074974F, 0.1918578503F, 0.1934131947F, 0.1949735068F, + 0.1965387630F, 0.1981089393F, 0.1996840117F, 0.2012639560F, + 0.2028487479F, 0.2044383630F, 0.2060327766F, 0.2076319642F, + 0.2092359007F, 0.2108445614F, 0.2124579211F, 0.2140759545F, + 0.2156986364F, 0.2173259411F, 0.2189578432F, 0.2205943168F, + 0.2222353361F, 0.2238808751F, 0.2255309076F, 0.2271854073F, + 0.2288443480F, 0.2305077030F, 0.2321754457F, 0.2338475493F, + 0.2355239869F, 0.2372047315F, 0.2388897560F, 0.2405790329F, + 0.2422725350F, 0.2439702347F, 0.2456721043F, 0.2473781159F, + 0.2490882418F, 0.2508024539F, 0.2525207240F, 0.2542430237F, + 0.2559693248F, 0.2576995986F, 0.2594338166F, 0.2611719498F, + 0.2629139695F, 0.2646598466F, 0.2664095520F, 0.2681630564F, + 0.2699203304F, 0.2716813445F, 0.2734460691F, 0.2752144744F, + 0.2769865307F, 0.2787622079F, 0.2805414760F, 0.2823243047F, + 0.2841106637F, 0.2859005227F, 0.2876938509F, 0.2894906179F, + 0.2912907928F, 0.2930943447F, 0.2949012426F, 0.2967114554F, + 0.2985249520F, 0.3003417009F, 0.3021616708F, 0.3039848301F, + 0.3058111471F, 0.3076405901F, 0.3094731273F, 0.3113087266F, + 0.3131473560F, 0.3149889833F, 0.3168335762F, 0.3186811024F, + 0.3205315294F, 0.3223848245F, 0.3242409552F, 0.3260998886F, + 0.3279615918F, 0.3298260319F, 0.3316931758F, 0.3335629903F, + 0.3354354423F, 0.3373104982F, 0.3391881247F, 0.3410682882F, + 0.3429509551F, 0.3448360917F, 0.3467236642F, 0.3486136387F, + 0.3505059811F, 0.3524006575F, 0.3542976336F, 0.3561968753F, + 0.3580983482F, 0.3600020179F, 0.3619078499F, 0.3638158096F, + 0.3657258625F, 0.3676379737F, 0.3695521086F, 0.3714682321F, + 0.3733863094F, 0.3753063055F, 0.3772281852F, 0.3791519134F, + 0.3810774548F, 0.3830047742F, 0.3849338362F, 0.3868646053F, + 0.3887970459F, 0.3907311227F, 0.3926667998F, 0.3946040417F, + 0.3965428125F, 0.3984830765F, 0.4004247978F, 0.4023679403F, + 0.4043124683F, 0.4062583455F, 0.4082055359F, 0.4101540034F, + 0.4121037117F, 0.4140546246F, 0.4160067058F, 0.4179599190F, + 0.4199142277F, 0.4218695956F, 0.4238259861F, 0.4257833627F, + 0.4277416888F, 0.4297009279F, 0.4316610433F, 0.4336219983F, + 0.4355837562F, 0.4375462803F, 0.4395095337F, 0.4414734797F, + 0.4434380815F, 0.4454033021F, 0.4473691046F, 0.4493354521F, + 0.4513023078F, 0.4532696345F, 0.4552373954F, 0.4572055533F, + 0.4591740713F, 0.4611429123F, 0.4631120393F, 0.4650814151F, + 0.4670510028F, 0.4690207650F, 0.4709906649F, 0.4729606651F, + 0.4749307287F, 0.4769008185F, 0.4788708972F, 0.4808409279F, + 0.4828108732F, 0.4847806962F, 0.4867503597F, 0.4887198264F, + 0.4906890593F, 0.4926580213F, 0.4946266753F, 0.4965949840F, + 0.4985629105F, 0.5005304176F, 0.5024974683F, 0.5044640255F, + 0.5064300522F, 0.5083955114F, 0.5103603659F, 0.5123245790F, + 0.5142881136F, 0.5162509328F, 0.5182129997F, 0.5201742774F, + 0.5221347290F, 0.5240943178F, 0.5260530070F, 0.5280107598F, + 0.5299675395F, 0.5319233095F, 0.5338780330F, 0.5358316736F, + 0.5377841946F, 0.5397355596F, 0.5416857320F, 0.5436346755F, + 0.5455823538F, 0.5475287304F, 0.5494737691F, 0.5514174337F, + 0.5533596881F, 0.5553004962F, 0.5572398218F, 0.5591776291F, + 0.5611138821F, 0.5630485449F, 0.5649815818F, 0.5669129570F, + 0.5688426349F, 0.5707705799F, 0.5726967564F, 0.5746211290F, + 0.5765436624F, 0.5784643212F, 0.5803830702F, 0.5822998743F, + 0.5842146984F, 0.5861275076F, 0.5880382669F, 0.5899469416F, + 0.5918534968F, 0.5937578981F, 0.5956601107F, 0.5975601004F, + 0.5994578326F, 0.6013532732F, 0.6032463880F, 0.6051371429F, + 0.6070255039F, 0.6089114372F, 0.6107949090F, 0.6126758856F, + 0.6145543334F, 0.6164302191F, 0.6183035092F, 0.6201741706F, + 0.6220421700F, 0.6239074745F, 0.6257700513F, 0.6276298674F, + 0.6294868903F, 0.6313410873F, 0.6331924262F, 0.6350408745F, + 0.6368864001F, 0.6387289710F, 0.6405685552F, 0.6424051209F, + 0.6442386364F, 0.6460690702F, 0.6478963910F, 0.6497205673F, + 0.6515415682F, 0.6533593625F, 0.6551739194F, 0.6569852082F, + 0.6587931984F, 0.6605978593F, 0.6623991609F, 0.6641970728F, + 0.6659915652F, 0.6677826081F, 0.6695701718F, 0.6713542268F, + 0.6731347437F, 0.6749116932F, 0.6766850461F, 0.6784547736F, + 0.6802208469F, 0.6819832374F, 0.6837419164F, 0.6854968559F, + 0.6872480275F, 0.6889954034F, 0.6907389556F, 0.6924786566F, + 0.6942144788F, 0.6959463950F, 0.6976743780F, 0.6993984008F, + 0.7011184365F, 0.7028344587F, 0.7045464407F, 0.7062543564F, + 0.7079581796F, 0.7096578844F, 0.7113534450F, 0.7130448359F, + 0.7147320316F, 0.7164150070F, 0.7180937371F, 0.7197681970F, + 0.7214383620F, 0.7231042077F, 0.7247657098F, 0.7264228443F, + 0.7280755871F, 0.7297239147F, 0.7313678035F, 0.7330072301F, + 0.7346421715F, 0.7362726046F, 0.7378985069F, 0.7395198556F, + 0.7411366285F, 0.7427488034F, 0.7443563584F, 0.7459592717F, + 0.7475575218F, 0.7491510873F, 0.7507399471F, 0.7523240803F, + 0.7539034661F, 0.7554780839F, 0.7570479136F, 0.7586129349F, + 0.7601731279F, 0.7617284730F, 0.7632789506F, 0.7648245416F, + 0.7663652267F, 0.7679009872F, 0.7694318044F, 0.7709576599F, + 0.7724785354F, 0.7739944130F, 0.7755052749F, 0.7770111035F, + 0.7785118815F, 0.7800075916F, 0.7814982170F, 0.7829837410F, + 0.7844641472F, 0.7859394191F, 0.7874095408F, 0.7888744965F, + 0.7903342706F, 0.7917888476F, 0.7932382124F, 0.7946823501F, + 0.7961212460F, 0.7975548855F, 0.7989832544F, 0.8004063386F, + 0.8018241244F, 0.8032365981F, 0.8046437463F, 0.8060455560F, + 0.8074420141F, 0.8088331080F, 0.8102188253F, 0.8115991536F, + 0.8129740810F, 0.8143435957F, 0.8157076861F, 0.8170663409F, + 0.8184195489F, 0.8197672994F, 0.8211095817F, 0.8224463853F, + 0.8237777001F, 0.8251035161F, 0.8264238235F, 0.8277386129F, + 0.8290478750F, 0.8303516008F, 0.8316497814F, 0.8329424083F, + 0.8342294731F, 0.8355109677F, 0.8367868841F, 0.8380572148F, + 0.8393219523F, 0.8405810893F, 0.8418346190F, 0.8430825345F, + 0.8443248294F, 0.8455614974F, 0.8467925323F, 0.8480179285F, + 0.8492376802F, 0.8504517822F, 0.8516602292F, 0.8528630164F, + 0.8540601391F, 0.8552515928F, 0.8564373733F, 0.8576174766F, + 0.8587918990F, 0.8599606368F, 0.8611236868F, 0.8622810460F, + 0.8634327113F, 0.8645786802F, 0.8657189504F, 0.8668535195F, + 0.8679823857F, 0.8691055472F, 0.8702230025F, 0.8713347503F, + 0.8724407896F, 0.8735411194F, 0.8746357394F, 0.8757246489F, + 0.8768078479F, 0.8778853364F, 0.8789571146F, 0.8800231832F, + 0.8810835427F, 0.8821381942F, 0.8831871387F, 0.8842303777F, + 0.8852679127F, 0.8862997456F, 0.8873258784F, 0.8883463132F, + 0.8893610527F, 0.8903700994F, 0.8913734562F, 0.8923711263F, + 0.8933631129F, 0.8943494196F, 0.8953300500F, 0.8963050083F, + 0.8972742985F, 0.8982379249F, 0.8991958922F, 0.9001482052F, + 0.9010948688F, 0.9020358883F, 0.9029712690F, 0.9039010165F, + 0.9048251367F, 0.9057436357F, 0.9066565195F, 0.9075637946F, + 0.9084654678F, 0.9093615456F, 0.9102520353F, 0.9111369440F, + 0.9120162792F, 0.9128900484F, 0.9137582595F, 0.9146209204F, + 0.9154780394F, 0.9163296248F, 0.9171756853F, 0.9180162296F, + 0.9188512667F, 0.9196808057F, 0.9205048559F, 0.9213234270F, + 0.9221365285F, 0.9229441704F, 0.9237463629F, 0.9245431160F, + 0.9253344404F, 0.9261203465F, 0.9269008453F, 0.9276759477F, + 0.9284456648F, 0.9292100080F, 0.9299689889F, 0.9307226190F, + 0.9314709103F, 0.9322138747F, 0.9329515245F, 0.9336838721F, + 0.9344109300F, 0.9351327108F, 0.9358492275F, 0.9365604931F, + 0.9372665208F, 0.9379673239F, 0.9386629160F, 0.9393533107F, + 0.9400385220F, 0.9407185637F, 0.9413934501F, 0.9420631954F, + 0.9427278141F, 0.9433873208F, 0.9440417304F, 0.9446910576F, + 0.9453353176F, 0.9459745255F, 0.9466086968F, 0.9472378469F, + 0.9478619915F, 0.9484811463F, 0.9490953274F, 0.9497045506F, + 0.9503088323F, 0.9509081888F, 0.9515026365F, 0.9520921921F, + 0.9526768723F, 0.9532566940F, 0.9538316742F, 0.9544018300F, + 0.9549671786F, 0.9555277375F, 0.9560835241F, 0.9566345562F, + 0.9571808513F, 0.9577224275F, 0.9582593027F, 0.9587914949F, + 0.9593190225F, 0.9598419038F, 0.9603601571F, 0.9608738012F, + 0.9613828546F, 0.9618873361F, 0.9623872646F, 0.9628826591F, + 0.9633735388F, 0.9638599227F, 0.9643418303F, 0.9648192808F, + 0.9652922939F, 0.9657608890F, 0.9662250860F, 0.9666849046F, + 0.9671403646F, 0.9675914861F, 0.9680382891F, 0.9684807937F, + 0.9689190202F, 0.9693529890F, 0.9697827203F, 0.9702082347F, + 0.9706295529F, 0.9710466953F, 0.9714596828F, 0.9718685362F, + 0.9722732762F, 0.9726739240F, 0.9730705005F, 0.9734630267F, + 0.9738515239F, 0.9742360134F, 0.9746165163F, 0.9749930540F, + 0.9753656481F, 0.9757343198F, 0.9760990909F, 0.9764599829F, + 0.9768170175F, 0.9771702164F, 0.9775196013F, 0.9778651941F, + 0.9782070167F, 0.9785450909F, 0.9788794388F, 0.9792100824F, + 0.9795370437F, 0.9798603449F, 0.9801800080F, 0.9804960554F, + 0.9808085092F, 0.9811173916F, 0.9814227251F, 0.9817245318F, + 0.9820228343F, 0.9823176549F, 0.9826090160F, 0.9828969402F, + 0.9831814498F, 0.9834625674F, 0.9837403156F, 0.9840147169F, + 0.9842857939F, 0.9845535692F, 0.9848180654F, 0.9850793052F, + 0.9853373113F, 0.9855921062F, 0.9858437127F, 0.9860921535F, + 0.9863374512F, 0.9865796287F, 0.9868187085F, 0.9870547136F, + 0.9872876664F, 0.9875175899F, 0.9877445067F, 0.9879684396F, + 0.9881894112F, 0.9884074444F, 0.9886225619F, 0.9888347863F, + 0.9890441404F, 0.9892506468F, 0.9894543284F, 0.9896552077F, + 0.9898533074F, 0.9900486502F, 0.9902412587F, 0.9904311555F, + 0.9906183633F, 0.9908029045F, 0.9909848019F, 0.9911640779F, + 0.9913407550F, 0.9915148557F, 0.9916864025F, 0.9918554179F, + 0.9920219241F, 0.9921859437F, 0.9923474989F, 0.9925066120F, + 0.9926633054F, 0.9928176012F, 0.9929695218F, 0.9931190891F, + 0.9932663254F, 0.9934112527F, 0.9935538932F, 0.9936942686F, + 0.9938324012F, 0.9939683126F, 0.9941020248F, 0.9942335597F, + 0.9943629388F, 0.9944901841F, 0.9946153170F, 0.9947383593F, + 0.9948593325F, 0.9949782579F, 0.9950951572F, 0.9952100516F, + 0.9953229625F, 0.9954339111F, 0.9955429186F, 0.9956500062F, + 0.9957551948F, 0.9958585056F, 0.9959599593F, 0.9960595769F, + 0.9961573792F, 0.9962533869F, 0.9963476206F, 0.9964401009F, + 0.9965308483F, 0.9966198833F, 0.9967072261F, 0.9967928971F, + 0.9968769164F, 0.9969593041F, 0.9970400804F, 0.9971192651F, + 0.9971968781F, 0.9972729391F, 0.9973474680F, 0.9974204842F, + 0.9974920074F, 0.9975620569F, 0.9976306521F, 0.9976978122F, + 0.9977635565F, 0.9978279039F, 0.9978908736F, 0.9979524842F, + 0.9980127547F, 0.9980717037F, 0.9981293499F, 0.9981857116F, + 0.9982408073F, 0.9982946554F, 0.9983472739F, 0.9983986810F, + 0.9984488947F, 0.9984979328F, 0.9985458132F, 0.9985925534F, + 0.9986381711F, 0.9986826838F, 0.9987261086F, 0.9987684630F, + 0.9988097640F, 0.9988500286F, 0.9988892738F, 0.9989275163F, + 0.9989647727F, 0.9990010597F, 0.9990363938F, 0.9990707911F, + 0.9991042679F, 0.9991368404F, 0.9991685244F, 0.9991993358F, + 0.9992292905F, 0.9992584038F, 0.9992866914F, 0.9993141686F, + 0.9993408506F, 0.9993667526F, 0.9993918895F, 0.9994162761F, + 0.9994399273F, 0.9994628576F, 0.9994850815F, 0.9995066133F, + 0.9995274672F, 0.9995476574F, 0.9995671978F, 0.9995861021F, + 0.9996043841F, 0.9996220573F, 0.9996391352F, 0.9996556310F, + 0.9996715579F, 0.9996869288F, 0.9997017568F, 0.9997160543F, + 0.9997298342F, 0.9997431088F, 0.9997558905F, 0.9997681914F, + 0.9997800236F, 0.9997913990F, 0.9998023292F, 0.9998128261F, + 0.9998229009F, 0.9998325650F, 0.9998418296F, 0.9998507058F, + 0.9998592044F, 0.9998673362F, 0.9998751117F, 0.9998825415F, + 0.9998896358F, 0.9998964047F, 0.9999028584F, 0.9999090066F, + 0.9999148590F, 0.9999204253F, 0.9999257148F, 0.9999307368F, + 0.9999355003F, 0.9999400144F, 0.9999442878F, 0.9999483293F, + 0.9999521472F, 0.9999557499F, 0.9999591457F, 0.9999623426F, + 0.9999653483F, 0.9999681708F, 0.9999708175F, 0.9999732959F, + 0.9999756132F, 0.9999777765F, 0.9999797928F, 0.9999816688F, + 0.9999834113F, 0.9999850266F, 0.9999865211F, 0.9999879009F, + 0.9999891721F, 0.9999903405F, 0.9999914118F, 0.9999923914F, + 0.9999932849F, 0.9999940972F, 0.9999948336F, 0.9999954989F, + 0.9999960978F, 0.9999966349F, 0.9999971146F, 0.9999975411F, + 0.9999979185F, 0.9999982507F, 0.9999985414F, 0.9999987944F, + 0.9999990129F, 0.9999992003F, 0.9999993596F, 0.9999994939F, + 0.9999996059F, 0.9999996981F, 0.9999997732F, 0.9999998333F, + 0.9999998805F, 0.9999999170F, 0.9999999444F, 0.9999999643F, + 0.9999999784F, 0.9999999878F, 0.9999999937F, 0.9999999972F, + 0.9999999990F, 0.9999999997F, 1.0000000000F, 1.0000000000F, +}; + +static const float vwin4096[2048] = { + 0.0000002310F, 0.0000020791F, 0.0000057754F, 0.0000113197F, + 0.0000187121F, 0.0000279526F, 0.0000390412F, 0.0000519777F, + 0.0000667623F, 0.0000833949F, 0.0001018753F, 0.0001222036F, + 0.0001443798F, 0.0001684037F, 0.0001942754F, 0.0002219947F, + 0.0002515616F, 0.0002829761F, 0.0003162380F, 0.0003513472F, + 0.0003883038F, 0.0004271076F, 0.0004677584F, 0.0005102563F, + 0.0005546011F, 0.0006007928F, 0.0006488311F, 0.0006987160F, + 0.0007504474F, 0.0008040251F, 0.0008594490F, 0.0009167191F, + 0.0009758351F, 0.0010367969F, 0.0010996044F, 0.0011642574F, + 0.0012307558F, 0.0012990994F, 0.0013692880F, 0.0014413216F, + 0.0015151998F, 0.0015909226F, 0.0016684898F, 0.0017479011F, + 0.0018291565F, 0.0019122556F, 0.0019971983F, 0.0020839845F, + 0.0021726138F, 0.0022630861F, 0.0023554012F, 0.0024495588F, + 0.0025455588F, 0.0026434008F, 0.0027430847F, 0.0028446103F, + 0.0029479772F, 0.0030531853F, 0.0031602342F, 0.0032691238F, + 0.0033798538F, 0.0034924239F, 0.0036068338F, 0.0037230833F, + 0.0038411721F, 0.0039610999F, 0.0040828664F, 0.0042064714F, + 0.0043319145F, 0.0044591954F, 0.0045883139F, 0.0047192696F, + 0.0048520622F, 0.0049866914F, 0.0051231569F, 0.0052614583F, + 0.0054015953F, 0.0055435676F, 0.0056873748F, 0.0058330166F, + 0.0059804926F, 0.0061298026F, 0.0062809460F, 0.0064339226F, + 0.0065887320F, 0.0067453738F, 0.0069038476F, 0.0070641531F, + 0.0072262899F, 0.0073902575F, 0.0075560556F, 0.0077236838F, + 0.0078931417F, 0.0080644288F, 0.0082375447F, 0.0084124891F, + 0.0085892615F, 0.0087678614F, 0.0089482885F, 0.0091305422F, + 0.0093146223F, 0.0095005281F, 0.0096882592F, 0.0098778153F, + 0.0100691958F, 0.0102624002F, 0.0104574281F, 0.0106542791F, + 0.0108529525F, 0.0110534480F, 0.0112557651F, 0.0114599032F, + 0.0116658618F, 0.0118736405F, 0.0120832387F, 0.0122946560F, + 0.0125078917F, 0.0127229454F, 0.0129398166F, 0.0131585046F, + 0.0133790090F, 0.0136013292F, 0.0138254647F, 0.0140514149F, + 0.0142791792F, 0.0145087572F, 0.0147401481F, 0.0149733515F, + 0.0152083667F, 0.0154451932F, 0.0156838304F, 0.0159242777F, + 0.0161665345F, 0.0164106001F, 0.0166564741F, 0.0169041557F, + 0.0171536443F, 0.0174049393F, 0.0176580401F, 0.0179129461F, + 0.0181696565F, 0.0184281708F, 0.0186884883F, 0.0189506084F, + 0.0192145303F, 0.0194802535F, 0.0197477772F, 0.0200171008F, + 0.0202882236F, 0.0205611449F, 0.0208358639F, 0.0211123801F, + 0.0213906927F, 0.0216708011F, 0.0219527043F, 0.0222364019F, + 0.0225218930F, 0.0228091769F, 0.0230982529F, 0.0233891203F, + 0.0236817782F, 0.0239762259F, 0.0242724628F, 0.0245704880F, + 0.0248703007F, 0.0251719002F, 0.0254752858F, 0.0257804565F, + 0.0260874117F, 0.0263961506F, 0.0267066722F, 0.0270189760F, + 0.0273330609F, 0.0276489263F, 0.0279665712F, 0.0282859949F, + 0.0286071966F, 0.0289301753F, 0.0292549303F, 0.0295814607F, + 0.0299097656F, 0.0302398442F, 0.0305716957F, 0.0309053191F, + 0.0312407135F, 0.0315778782F, 0.0319168122F, 0.0322575145F, + 0.0325999844F, 0.0329442209F, 0.0332902231F, 0.0336379900F, + 0.0339875208F, 0.0343388146F, 0.0346918703F, 0.0350466871F, + 0.0354032640F, 0.0357616000F, 0.0361216943F, 0.0364835458F, + 0.0368471535F, 0.0372125166F, 0.0375796339F, 0.0379485046F, + 0.0383191276F, 0.0386915020F, 0.0390656267F, 0.0394415008F, + 0.0398191231F, 0.0401984927F, 0.0405796086F, 0.0409624698F, + 0.0413470751F, 0.0417334235F, 0.0421215141F, 0.0425113457F, + 0.0429029172F, 0.0432962277F, 0.0436912760F, 0.0440880610F, + 0.0444865817F, 0.0448868370F, 0.0452888257F, 0.0456925468F, + 0.0460979992F, 0.0465051816F, 0.0469140931F, 0.0473247325F, + 0.0477370986F, 0.0481511902F, 0.0485670064F, 0.0489845458F, + 0.0494038074F, 0.0498247899F, 0.0502474922F, 0.0506719131F, + 0.0510980514F, 0.0515259060F, 0.0519554756F, 0.0523867590F, + 0.0528197550F, 0.0532544624F, 0.0536908800F, 0.0541290066F, + 0.0545688408F, 0.0550103815F, 0.0554536274F, 0.0558985772F, + 0.0563452297F, 0.0567935837F, 0.0572436377F, 0.0576953907F, + 0.0581488412F, 0.0586039880F, 0.0590608297F, 0.0595193651F, + 0.0599795929F, 0.0604415117F, 0.0609051202F, 0.0613704170F, + 0.0618374009F, 0.0623060704F, 0.0627764243F, 0.0632484611F, + 0.0637221795F, 0.0641975781F, 0.0646746555F, 0.0651534104F, + 0.0656338413F, 0.0661159469F, 0.0665997257F, 0.0670851763F, + 0.0675722973F, 0.0680610873F, 0.0685515448F, 0.0690436684F, + 0.0695374567F, 0.0700329081F, 0.0705300213F, 0.0710287947F, + 0.0715292269F, 0.0720313163F, 0.0725350616F, 0.0730404612F, + 0.0735475136F, 0.0740562172F, 0.0745665707F, 0.0750785723F, + 0.0755922207F, 0.0761075143F, 0.0766244515F, 0.0771430307F, + 0.0776632505F, 0.0781851092F, 0.0787086052F, 0.0792337371F, + 0.0797605032F, 0.0802889018F, 0.0808189315F, 0.0813505905F, + 0.0818838773F, 0.0824187903F, 0.0829553277F, 0.0834934881F, + 0.0840332697F, 0.0845746708F, 0.0851176899F, 0.0856623252F, + 0.0862085751F, 0.0867564379F, 0.0873059119F, 0.0878569954F, + 0.0884096867F, 0.0889639840F, 0.0895198858F, 0.0900773902F, + 0.0906364955F, 0.0911972000F, 0.0917595019F, 0.0923233995F, + 0.0928888909F, 0.0934559745F, 0.0940246485F, 0.0945949110F, + 0.0951667604F, 0.0957401946F, 0.0963152121F, 0.0968918109F, + 0.0974699893F, 0.0980497454F, 0.0986310773F, 0.0992139832F, + 0.0997984614F, 0.1003845098F, 0.1009721267F, 0.1015613101F, + 0.1021520582F, 0.1027443692F, 0.1033382410F, 0.1039336718F, + 0.1045306597F, 0.1051292027F, 0.1057292990F, 0.1063309466F, + 0.1069341435F, 0.1075388878F, 0.1081451776F, 0.1087530108F, + 0.1093623856F, 0.1099732998F, 0.1105857516F, 0.1111997389F, + 0.1118152597F, 0.1124323121F, 0.1130508939F, 0.1136710032F, + 0.1142926379F, 0.1149157960F, 0.1155404755F, 0.1161666742F, + 0.1167943901F, 0.1174236211F, 0.1180543652F, 0.1186866202F, + 0.1193203841F, 0.1199556548F, 0.1205924300F, 0.1212307078F, + 0.1218704860F, 0.1225117624F, 0.1231545349F, 0.1237988013F, + 0.1244445596F, 0.1250918074F, 0.1257405427F, 0.1263907632F, + 0.1270424667F, 0.1276956512F, 0.1283503142F, 0.1290064537F, + 0.1296640674F, 0.1303231530F, 0.1309837084F, 0.1316457312F, + 0.1323092193F, 0.1329741703F, 0.1336405820F, 0.1343084520F, + 0.1349777782F, 0.1356485582F, 0.1363207897F, 0.1369944704F, + 0.1376695979F, 0.1383461700F, 0.1390241842F, 0.1397036384F, + 0.1403845300F, 0.1410668567F, 0.1417506162F, 0.1424358061F, + 0.1431224240F, 0.1438104674F, 0.1444999341F, 0.1451908216F, + 0.1458831274F, 0.1465768492F, 0.1472719844F, 0.1479685308F, + 0.1486664857F, 0.1493658468F, 0.1500666115F, 0.1507687775F, + 0.1514723422F, 0.1521773031F, 0.1528836577F, 0.1535914035F, + 0.1543005380F, 0.1550110587F, 0.1557229631F, 0.1564362485F, + 0.1571509124F, 0.1578669524F, 0.1585843657F, 0.1593031499F, + 0.1600233024F, 0.1607448205F, 0.1614677017F, 0.1621919433F, + 0.1629175428F, 0.1636444975F, 0.1643728047F, 0.1651024619F, + 0.1658334665F, 0.1665658156F, 0.1672995067F, 0.1680345371F, + 0.1687709041F, 0.1695086050F, 0.1702476372F, 0.1709879978F, + 0.1717296843F, 0.1724726938F, 0.1732170237F, 0.1739626711F, + 0.1747096335F, 0.1754579079F, 0.1762074916F, 0.1769583819F, + 0.1777105760F, 0.1784640710F, 0.1792188642F, 0.1799749529F, + 0.1807323340F, 0.1814910049F, 0.1822509628F, 0.1830122046F, + 0.1837747277F, 0.1845385292F, 0.1853036062F, 0.1860699558F, + 0.1868375751F, 0.1876064613F, 0.1883766114F, 0.1891480226F, + 0.1899206919F, 0.1906946164F, 0.1914697932F, 0.1922462194F, + 0.1930238919F, 0.1938028079F, 0.1945829643F, 0.1953643583F, + 0.1961469868F, 0.1969308468F, 0.1977159353F, 0.1985022494F, + 0.1992897859F, 0.2000785420F, 0.2008685145F, 0.2016597005F, + 0.2024520968F, 0.2032457005F, 0.2040405084F, 0.2048365175F, + 0.2056337247F, 0.2064321269F, 0.2072317211F, 0.2080325041F, + 0.2088344727F, 0.2096376240F, 0.2104419547F, 0.2112474618F, + 0.2120541420F, 0.2128619923F, 0.2136710094F, 0.2144811902F, + 0.2152925315F, 0.2161050301F, 0.2169186829F, 0.2177334866F, + 0.2185494381F, 0.2193665340F, 0.2201847712F, 0.2210041465F, + 0.2218246565F, 0.2226462981F, 0.2234690680F, 0.2242929629F, + 0.2251179796F, 0.2259441147F, 0.2267713650F, 0.2275997272F, + 0.2284291979F, 0.2292597739F, 0.2300914518F, 0.2309242283F, + 0.2317581001F, 0.2325930638F, 0.2334291160F, 0.2342662534F, + 0.2351044727F, 0.2359437703F, 0.2367841431F, 0.2376255875F, + 0.2384681001F, 0.2393116776F, 0.2401563165F, 0.2410020134F, + 0.2418487649F, 0.2426965675F, 0.2435454178F, 0.2443953122F, + 0.2452462474F, 0.2460982199F, 0.2469512262F, 0.2478052628F, + 0.2486603262F, 0.2495164129F, 0.2503735194F, 0.2512316421F, + 0.2520907776F, 0.2529509222F, 0.2538120726F, 0.2546742250F, + 0.2555373760F, 0.2564015219F, 0.2572666593F, 0.2581327845F, + 0.2589998939F, 0.2598679840F, 0.2607370510F, 0.2616070916F, + 0.2624781019F, 0.2633500783F, 0.2642230173F, 0.2650969152F, + 0.2659717684F, 0.2668475731F, 0.2677243257F, 0.2686020226F, + 0.2694806601F, 0.2703602344F, 0.2712407419F, 0.2721221789F, + 0.2730045417F, 0.2738878265F, 0.2747720297F, 0.2756571474F, + 0.2765431760F, 0.2774301117F, 0.2783179508F, 0.2792066895F, + 0.2800963240F, 0.2809868505F, 0.2818782654F, 0.2827705647F, + 0.2836637447F, 0.2845578016F, 0.2854527315F, 0.2863485307F, + 0.2872451953F, 0.2881427215F, 0.2890411055F, 0.2899403433F, + 0.2908404312F, 0.2917413654F, 0.2926431418F, 0.2935457567F, + 0.2944492061F, 0.2953534863F, 0.2962585932F, 0.2971645230F, + 0.2980712717F, 0.2989788356F, 0.2998872105F, 0.3007963927F, + 0.3017063781F, 0.3026171629F, 0.3035287430F, 0.3044411145F, + 0.3053542736F, 0.3062682161F, 0.3071829381F, 0.3080984356F, + 0.3090147047F, 0.3099317413F, 0.3108495414F, 0.3117681011F, + 0.3126874163F, 0.3136074830F, 0.3145282972F, 0.3154498548F, + 0.3163721517F, 0.3172951841F, 0.3182189477F, 0.3191434385F, + 0.3200686525F, 0.3209945856F, 0.3219212336F, 0.3228485927F, + 0.3237766585F, 0.3247054271F, 0.3256348943F, 0.3265650560F, + 0.3274959081F, 0.3284274465F, 0.3293596671F, 0.3302925657F, + 0.3312261382F, 0.3321603804F, 0.3330952882F, 0.3340308574F, + 0.3349670838F, 0.3359039634F, 0.3368414919F, 0.3377796651F, + 0.3387184789F, 0.3396579290F, 0.3405980113F, 0.3415387216F, + 0.3424800556F, 0.3434220091F, 0.3443645779F, 0.3453077578F, + 0.3462515446F, 0.3471959340F, 0.3481409217F, 0.3490865036F, + 0.3500326754F, 0.3509794328F, 0.3519267715F, 0.3528746873F, + 0.3538231759F, 0.3547722330F, 0.3557218544F, 0.3566720357F, + 0.3576227727F, 0.3585740610F, 0.3595258964F, 0.3604782745F, + 0.3614311910F, 0.3623846417F, 0.3633386221F, 0.3642931280F, + 0.3652481549F, 0.3662036987F, 0.3671597548F, 0.3681163191F, + 0.3690733870F, 0.3700309544F, 0.3709890167F, 0.3719475696F, + 0.3729066089F, 0.3738661299F, 0.3748261285F, 0.3757866002F, + 0.3767475406F, 0.3777089453F, 0.3786708100F, 0.3796331302F, + 0.3805959014F, 0.3815591194F, 0.3825227796F, 0.3834868777F, + 0.3844514093F, 0.3854163698F, 0.3863817549F, 0.3873475601F, + 0.3883137810F, 0.3892804131F, 0.3902474521F, 0.3912148933F, + 0.3921827325F, 0.3931509650F, 0.3941195865F, 0.3950885925F, + 0.3960579785F, 0.3970277400F, 0.3979978725F, 0.3989683716F, + 0.3999392328F, 0.4009104516F, 0.4018820234F, 0.4028539438F, + 0.4038262084F, 0.4047988125F, 0.4057717516F, 0.4067450214F, + 0.4077186172F, 0.4086925345F, 0.4096667688F, 0.4106413155F, + 0.4116161703F, 0.4125913284F, 0.4135667854F, 0.4145425368F, + 0.4155185780F, 0.4164949044F, 0.4174715116F, 0.4184483949F, + 0.4194255498F, 0.4204029718F, 0.4213806563F, 0.4223585987F, + 0.4233367946F, 0.4243152392F, 0.4252939281F, 0.4262728566F, + 0.4272520202F, 0.4282314144F, 0.4292110345F, 0.4301908760F, + 0.4311709343F, 0.4321512047F, 0.4331316828F, 0.4341123639F, + 0.4350932435F, 0.4360743168F, 0.4370555794F, 0.4380370267F, + 0.4390186540F, 0.4400004567F, 0.4409824303F, 0.4419645701F, + 0.4429468716F, 0.4439293300F, 0.4449119409F, 0.4458946996F, + 0.4468776014F, 0.4478606418F, 0.4488438162F, 0.4498271199F, + 0.4508105483F, 0.4517940967F, 0.4527777607F, 0.4537615355F, + 0.4547454165F, 0.4557293991F, 0.4567134786F, 0.4576976505F, + 0.4586819101F, 0.4596662527F, 0.4606506738F, 0.4616351687F, + 0.4626197328F, 0.4636043614F, 0.4645890499F, 0.4655737936F, + 0.4665585880F, 0.4675434284F, 0.4685283101F, 0.4695132286F, + 0.4704981791F, 0.4714831570F, 0.4724681577F, 0.4734531766F, + 0.4744382089F, 0.4754232501F, 0.4764082956F, 0.4773933406F, + 0.4783783806F, 0.4793634108F, 0.4803484267F, 0.4813334237F, + 0.4823183969F, 0.4833033419F, 0.4842882540F, 0.4852731285F, + 0.4862579608F, 0.4872427462F, 0.4882274802F, 0.4892121580F, + 0.4901967751F, 0.4911813267F, 0.4921658083F, 0.4931502151F, + 0.4941345427F, 0.4951187863F, 0.4961029412F, 0.4970870029F, + 0.4980709667F, 0.4990548280F, 0.5000385822F, 0.5010222245F, + 0.5020057505F, 0.5029891553F, 0.5039724345F, 0.5049555834F, + 0.5059385973F, 0.5069214716F, 0.5079042018F, 0.5088867831F, + 0.5098692110F, 0.5108514808F, 0.5118335879F, 0.5128155277F, + 0.5137972956F, 0.5147788869F, 0.5157602971F, 0.5167415215F, + 0.5177225555F, 0.5187033945F, 0.5196840339F, 0.5206644692F, + 0.5216446956F, 0.5226247086F, 0.5236045035F, 0.5245840759F, + 0.5255634211F, 0.5265425344F, 0.5275214114F, 0.5285000474F, + 0.5294784378F, 0.5304565781F, 0.5314344637F, 0.5324120899F, + 0.5333894522F, 0.5343665461F, 0.5353433670F, 0.5363199102F, + 0.5372961713F, 0.5382721457F, 0.5392478287F, 0.5402232159F, + 0.5411983027F, 0.5421730845F, 0.5431475569F, 0.5441217151F, + 0.5450955548F, 0.5460690714F, 0.5470422602F, 0.5480151169F, + 0.5489876368F, 0.5499598155F, 0.5509316484F, 0.5519031310F, + 0.5528742587F, 0.5538450271F, 0.5548154317F, 0.5557854680F, + 0.5567551314F, 0.5577244174F, 0.5586933216F, 0.5596618395F, + 0.5606299665F, 0.5615976983F, 0.5625650302F, 0.5635319580F, + 0.5644984770F, 0.5654645828F, 0.5664302709F, 0.5673955370F, + 0.5683603765F, 0.5693247850F, 0.5702887580F, 0.5712522912F, + 0.5722153800F, 0.5731780200F, 0.5741402069F, 0.5751019362F, + 0.5760632034F, 0.5770240042F, 0.5779843341F, 0.5789441889F, + 0.5799035639F, 0.5808624549F, 0.5818208575F, 0.5827787673F, + 0.5837361800F, 0.5846930910F, 0.5856494961F, 0.5866053910F, + 0.5875607712F, 0.5885156324F, 0.5894699703F, 0.5904237804F, + 0.5913770586F, 0.5923298004F, 0.5932820016F, 0.5942336578F, + 0.5951847646F, 0.5961353179F, 0.5970853132F, 0.5980347464F, + 0.5989836131F, 0.5999319090F, 0.6008796298F, 0.6018267713F, + 0.6027733292F, 0.6037192993F, 0.6046646773F, 0.6056094589F, + 0.6065536400F, 0.6074972162F, 0.6084401833F, 0.6093825372F, + 0.6103242736F, 0.6112653884F, 0.6122058772F, 0.6131457359F, + 0.6140849604F, 0.6150235464F, 0.6159614897F, 0.6168987862F, + 0.6178354318F, 0.6187714223F, 0.6197067535F, 0.6206414213F, + 0.6215754215F, 0.6225087501F, 0.6234414028F, 0.6243733757F, + 0.6253046646F, 0.6262352654F, 0.6271651739F, 0.6280943862F, + 0.6290228982F, 0.6299507057F, 0.6308778048F, 0.6318041913F, + 0.6327298612F, 0.6336548105F, 0.6345790352F, 0.6355025312F, + 0.6364252945F, 0.6373473211F, 0.6382686070F, 0.6391891483F, + 0.6401089409F, 0.6410279808F, 0.6419462642F, 0.6428637869F, + 0.6437805452F, 0.6446965350F, 0.6456117524F, 0.6465261935F, + 0.6474398544F, 0.6483527311F, 0.6492648197F, 0.6501761165F, + 0.6510866174F, 0.6519963186F, 0.6529052162F, 0.6538133064F, + 0.6547205854F, 0.6556270492F, 0.6565326941F, 0.6574375162F, + 0.6583415117F, 0.6592446769F, 0.6601470079F, 0.6610485009F, + 0.6619491521F, 0.6628489578F, 0.6637479143F, 0.6646460177F, + 0.6655432643F, 0.6664396505F, 0.6673351724F, 0.6682298264F, + 0.6691236087F, 0.6700165157F, 0.6709085436F, 0.6717996889F, + 0.6726899478F, 0.6735793167F, 0.6744677918F, 0.6753553697F, + 0.6762420466F, 0.6771278190F, 0.6780126832F, 0.6788966357F, + 0.6797796728F, 0.6806617909F, 0.6815429866F, 0.6824232562F, + 0.6833025961F, 0.6841810030F, 0.6850584731F, 0.6859350031F, + 0.6868105894F, 0.6876852284F, 0.6885589168F, 0.6894316510F, + 0.6903034275F, 0.6911742430F, 0.6920440939F, 0.6929129769F, + 0.6937808884F, 0.6946478251F, 0.6955137837F, 0.6963787606F, + 0.6972427525F, 0.6981057560F, 0.6989677678F, 0.6998287845F, + 0.7006888028F, 0.7015478194F, 0.7024058309F, 0.7032628340F, + 0.7041188254F, 0.7049738019F, 0.7058277601F, 0.7066806969F, + 0.7075326089F, 0.7083834929F, 0.7092333457F, 0.7100821640F, + 0.7109299447F, 0.7117766846F, 0.7126223804F, 0.7134670291F, + 0.7143106273F, 0.7151531721F, 0.7159946602F, 0.7168350885F, + 0.7176744539F, 0.7185127534F, 0.7193499837F, 0.7201861418F, + 0.7210212247F, 0.7218552293F, 0.7226881526F, 0.7235199914F, + 0.7243507428F, 0.7251804039F, 0.7260089715F, 0.7268364426F, + 0.7276628144F, 0.7284880839F, 0.7293122481F, 0.7301353040F, + 0.7309572487F, 0.7317780794F, 0.7325977930F, 0.7334163868F, + 0.7342338579F, 0.7350502033F, 0.7358654202F, 0.7366795059F, + 0.7374924573F, 0.7383042718F, 0.7391149465F, 0.7399244787F, + 0.7407328655F, 0.7415401041F, 0.7423461920F, 0.7431511261F, + 0.7439549040F, 0.7447575227F, 0.7455589797F, 0.7463592723F, + 0.7471583976F, 0.7479563532F, 0.7487531363F, 0.7495487443F, + 0.7503431745F, 0.7511364244F, 0.7519284913F, 0.7527193726F, + 0.7535090658F, 0.7542975683F, 0.7550848776F, 0.7558709910F, + 0.7566559062F, 0.7574396205F, 0.7582221314F, 0.7590034366F, + 0.7597835334F, 0.7605624194F, 0.7613400923F, 0.7621165495F, + 0.7628917886F, 0.7636658072F, 0.7644386030F, 0.7652101735F, + 0.7659805164F, 0.7667496292F, 0.7675175098F, 0.7682841556F, + 0.7690495645F, 0.7698137341F, 0.7705766622F, 0.7713383463F, + 0.7720987844F, 0.7728579741F, 0.7736159132F, 0.7743725994F, + 0.7751280306F, 0.7758822046F, 0.7766351192F, 0.7773867722F, + 0.7781371614F, 0.7788862848F, 0.7796341401F, 0.7803807253F, + 0.7811260383F, 0.7818700769F, 0.7826128392F, 0.7833543230F, + 0.7840945263F, 0.7848334471F, 0.7855710833F, 0.7863074330F, + 0.7870424941F, 0.7877762647F, 0.7885087428F, 0.7892399264F, + 0.7899698137F, 0.7906984026F, 0.7914256914F, 0.7921516780F, + 0.7928763607F, 0.7935997375F, 0.7943218065F, 0.7950425661F, + 0.7957620142F, 0.7964801492F, 0.7971969692F, 0.7979124724F, + 0.7986266570F, 0.7993395214F, 0.8000510638F, 0.8007612823F, + 0.8014701754F, 0.8021777413F, 0.8028839784F, 0.8035888849F, + 0.8042924592F, 0.8049946997F, 0.8056956048F, 0.8063951727F, + 0.8070934020F, 0.8077902910F, 0.8084858381F, 0.8091800419F, + 0.8098729007F, 0.8105644130F, 0.8112545774F, 0.8119433922F, + 0.8126308561F, 0.8133169676F, 0.8140017251F, 0.8146851272F, + 0.8153671726F, 0.8160478598F, 0.8167271874F, 0.8174051539F, + 0.8180817582F, 0.8187569986F, 0.8194308741F, 0.8201033831F, + 0.8207745244F, 0.8214442966F, 0.8221126986F, 0.8227797290F, + 0.8234453865F, 0.8241096700F, 0.8247725781F, 0.8254341097F, + 0.8260942636F, 0.8267530385F, 0.8274104334F, 0.8280664470F, + 0.8287210782F, 0.8293743259F, 0.8300261889F, 0.8306766662F, + 0.8313257566F, 0.8319734591F, 0.8326197727F, 0.8332646963F, + 0.8339082288F, 0.8345503692F, 0.8351911167F, 0.8358304700F, + 0.8364684284F, 0.8371049907F, 0.8377401562F, 0.8383739238F, + 0.8390062927F, 0.8396372618F, 0.8402668305F, 0.8408949977F, + 0.8415217626F, 0.8421471245F, 0.8427710823F, 0.8433936354F, + 0.8440147830F, 0.8446345242F, 0.8452528582F, 0.8458697844F, + 0.8464853020F, 0.8470994102F, 0.8477121084F, 0.8483233958F, + 0.8489332718F, 0.8495417356F, 0.8501487866F, 0.8507544243F, + 0.8513586479F, 0.8519614568F, 0.8525628505F, 0.8531628283F, + 0.8537613897F, 0.8543585341F, 0.8549542611F, 0.8555485699F, + 0.8561414603F, 0.8567329315F, 0.8573229832F, 0.8579116149F, + 0.8584988262F, 0.8590846165F, 0.8596689855F, 0.8602519327F, + 0.8608334577F, 0.8614135603F, 0.8619922399F, 0.8625694962F, + 0.8631453289F, 0.8637197377F, 0.8642927222F, 0.8648642821F, + 0.8654344172F, 0.8660031272F, 0.8665704118F, 0.8671362708F, + 0.8677007039F, 0.8682637109F, 0.8688252917F, 0.8693854460F, + 0.8699441737F, 0.8705014745F, 0.8710573485F, 0.8716117953F, + 0.8721648150F, 0.8727164073F, 0.8732665723F, 0.8738153098F, + 0.8743626197F, 0.8749085021F, 0.8754529569F, 0.8759959840F, + 0.8765375835F, 0.8770777553F, 0.8776164996F, 0.8781538162F, + 0.8786897054F, 0.8792241670F, 0.8797572013F, 0.8802888082F, + 0.8808189880F, 0.8813477407F, 0.8818750664F, 0.8824009653F, + 0.8829254375F, 0.8834484833F, 0.8839701028F, 0.8844902961F, + 0.8850090636F, 0.8855264054F, 0.8860423218F, 0.8865568131F, + 0.8870698794F, 0.8875815212F, 0.8880917386F, 0.8886005319F, + 0.8891079016F, 0.8896138479F, 0.8901183712F, 0.8906214719F, + 0.8911231503F, 0.8916234067F, 0.8921222417F, 0.8926196556F, + 0.8931156489F, 0.8936102219F, 0.8941033752F, 0.8945951092F, + 0.8950854244F, 0.8955743212F, 0.8960618003F, 0.8965478621F, + 0.8970325071F, 0.8975157359F, 0.8979975490F, 0.8984779471F, + 0.8989569307F, 0.8994345004F, 0.8999106568F, 0.9003854005F, + 0.9008587323F, 0.9013306526F, 0.9018011623F, 0.9022702619F, + 0.9027379521F, 0.9032042337F, 0.9036691074F, 0.9041325739F, + 0.9045946339F, 0.9050552882F, 0.9055145376F, 0.9059723828F, + 0.9064288246F, 0.9068838638F, 0.9073375013F, 0.9077897379F, + 0.9082405743F, 0.9086900115F, 0.9091380503F, 0.9095846917F, + 0.9100299364F, 0.9104737854F, 0.9109162397F, 0.9113573001F, + 0.9117969675F, 0.9122352430F, 0.9126721275F, 0.9131076219F, + 0.9135417273F, 0.9139744447F, 0.9144057750F, 0.9148357194F, + 0.9152642787F, 0.9156914542F, 0.9161172468F, 0.9165416576F, + 0.9169646877F, 0.9173863382F, 0.9178066102F, 0.9182255048F, + 0.9186430232F, 0.9190591665F, 0.9194739359F, 0.9198873324F, + 0.9202993574F, 0.9207100120F, 0.9211192973F, 0.9215272147F, + 0.9219337653F, 0.9223389504F, 0.9227427713F, 0.9231452290F, + 0.9235463251F, 0.9239460607F, 0.9243444371F, 0.9247414557F, + 0.9251371177F, 0.9255314245F, 0.9259243774F, 0.9263159778F, + 0.9267062270F, 0.9270951264F, 0.9274826774F, 0.9278688814F, + 0.9282537398F, 0.9286372540F, 0.9290194254F, 0.9294002555F, + 0.9297797458F, 0.9301578976F, 0.9305347125F, 0.9309101919F, + 0.9312843373F, 0.9316571503F, 0.9320286323F, 0.9323987849F, + 0.9327676097F, 0.9331351080F, 0.9335012816F, 0.9338661320F, + 0.9342296607F, 0.9345918694F, 0.9349527596F, 0.9353123330F, + 0.9356705911F, 0.9360275357F, 0.9363831683F, 0.9367374905F, + 0.9370905042F, 0.9374422108F, 0.9377926122F, 0.9381417099F, + 0.9384895057F, 0.9388360014F, 0.9391811985F, 0.9395250989F, + 0.9398677043F, 0.9402090165F, 0.9405490371F, 0.9408877680F, + 0.9412252110F, 0.9415613678F, 0.9418962402F, 0.9422298301F, + 0.9425621392F, 0.9428931695F, 0.9432229226F, 0.9435514005F, + 0.9438786050F, 0.9442045381F, 0.9445292014F, 0.9448525971F, + 0.9451747268F, 0.9454955926F, 0.9458151963F, 0.9461335399F, + 0.9464506253F, 0.9467664545F, 0.9470810293F, 0.9473943517F, + 0.9477064238F, 0.9480172474F, 0.9483268246F, 0.9486351573F, + 0.9489422475F, 0.9492480973F, 0.9495527087F, 0.9498560837F, + 0.9501582243F, 0.9504591325F, 0.9507588105F, 0.9510572603F, + 0.9513544839F, 0.9516504834F, 0.9519452609F, 0.9522388186F, + 0.9525311584F, 0.9528222826F, 0.9531121932F, 0.9534008923F, + 0.9536883821F, 0.9539746647F, 0.9542597424F, 0.9545436171F, + 0.9548262912F, 0.9551077667F, 0.9553880459F, 0.9556671309F, + 0.9559450239F, 0.9562217272F, 0.9564972429F, 0.9567715733F, + 0.9570447206F, 0.9573166871F, 0.9575874749F, 0.9578570863F, + 0.9581255236F, 0.9583927890F, 0.9586588849F, 0.9589238134F, + 0.9591875769F, 0.9594501777F, 0.9597116180F, 0.9599719003F, + 0.9602310267F, 0.9604889995F, 0.9607458213F, 0.9610014942F, + 0.9612560206F, 0.9615094028F, 0.9617616433F, 0.9620127443F, + 0.9622627083F, 0.9625115376F, 0.9627592345F, 0.9630058016F, + 0.9632512411F, 0.9634955555F, 0.9637387471F, 0.9639808185F, + 0.9642217720F, 0.9644616100F, 0.9647003349F, 0.9649379493F, + 0.9651744556F, 0.9654098561F, 0.9656441534F, 0.9658773499F, + 0.9661094480F, 0.9663404504F, 0.9665703593F, 0.9667991774F, + 0.9670269071F, 0.9672535509F, 0.9674791114F, 0.9677035909F, + 0.9679269921F, 0.9681493174F, 0.9683705694F, 0.9685907506F, + 0.9688098636F, 0.9690279108F, 0.9692448948F, 0.9694608182F, + 0.9696756836F, 0.9698894934F, 0.9701022503F, 0.9703139569F, + 0.9705246156F, 0.9707342291F, 0.9709428000F, 0.9711503309F, + 0.9713568243F, 0.9715622829F, 0.9717667093F, 0.9719701060F, + 0.9721724757F, 0.9723738210F, 0.9725741446F, 0.9727734490F, + 0.9729717369F, 0.9731690109F, 0.9733652737F, 0.9735605279F, + 0.9737547762F, 0.9739480212F, 0.9741402656F, 0.9743315120F, + 0.9745217631F, 0.9747110216F, 0.9748992901F, 0.9750865714F, + 0.9752728681F, 0.9754581829F, 0.9756425184F, 0.9758258775F, + 0.9760082627F, 0.9761896768F, 0.9763701224F, 0.9765496024F, + 0.9767281193F, 0.9769056760F, 0.9770822751F, 0.9772579193F, + 0.9774326114F, 0.9776063542F, 0.9777791502F, 0.9779510023F, + 0.9781219133F, 0.9782918858F, 0.9784609226F, 0.9786290264F, + 0.9787962000F, 0.9789624461F, 0.9791277676F, 0.9792921671F, + 0.9794556474F, 0.9796182113F, 0.9797798615F, 0.9799406009F, + 0.9801004321F, 0.9802593580F, 0.9804173813F, 0.9805745049F, + 0.9807307314F, 0.9808860637F, 0.9810405046F, 0.9811940568F, + 0.9813467232F, 0.9814985065F, 0.9816494095F, 0.9817994351F, + 0.9819485860F, 0.9820968650F, 0.9822442750F, 0.9823908186F, + 0.9825364988F, 0.9826813184F, 0.9828252801F, 0.9829683868F, + 0.9831106413F, 0.9832520463F, 0.9833926048F, 0.9835323195F, + 0.9836711932F, 0.9838092288F, 0.9839464291F, 0.9840827969F, + 0.9842183351F, 0.9843530464F, 0.9844869337F, 0.9846199998F, + 0.9847522475F, 0.9848836798F, 0.9850142993F, 0.9851441090F, + 0.9852731117F, 0.9854013101F, 0.9855287073F, 0.9856553058F, + 0.9857811087F, 0.9859061188F, 0.9860303388F, 0.9861537717F, + 0.9862764202F, 0.9863982872F, 0.9865193756F, 0.9866396882F, + 0.9867592277F, 0.9868779972F, 0.9869959993F, 0.9871132370F, + 0.9872297131F, 0.9873454304F, 0.9874603918F, 0.9875746001F, + 0.9876880581F, 0.9878007688F, 0.9879127348F, 0.9880239592F, + 0.9881344447F, 0.9882441941F, 0.9883532104F, 0.9884614962F, + 0.9885690546F, 0.9886758883F, 0.9887820001F, 0.9888873930F, + 0.9889920697F, 0.9890960331F, 0.9891992859F, 0.9893018312F, + 0.9894036716F, 0.9895048100F, 0.9896052493F, 0.9897049923F, + 0.9898040418F, 0.9899024006F, 0.9900000717F, 0.9900970577F, + 0.9901933616F, 0.9902889862F, 0.9903839343F, 0.9904782087F, + 0.9905718122F, 0.9906647477F, 0.9907570180F, 0.9908486259F, + 0.9909395742F, 0.9910298658F, 0.9911195034F, 0.9912084899F, + 0.9912968281F, 0.9913845208F, 0.9914715708F, 0.9915579810F, + 0.9916437540F, 0.9917288928F, 0.9918134001F, 0.9918972788F, + 0.9919805316F, 0.9920631613F, 0.9921451707F, 0.9922265626F, + 0.9923073399F, 0.9923875052F, 0.9924670615F, 0.9925460114F, + 0.9926243577F, 0.9927021033F, 0.9927792508F, 0.9928558032F, + 0.9929317631F, 0.9930071333F, 0.9930819167F, 0.9931561158F, + 0.9932297337F, 0.9933027728F, 0.9933752362F, 0.9934471264F, + 0.9935184462F, 0.9935891985F, 0.9936593859F, 0.9937290112F, + 0.9937980771F, 0.9938665864F, 0.9939345418F, 0.9940019460F, + 0.9940688018F, 0.9941351118F, 0.9942008789F, 0.9942661057F, + 0.9943307950F, 0.9943949494F, 0.9944585717F, 0.9945216645F, + 0.9945842307F, 0.9946462728F, 0.9947077936F, 0.9947687957F, + 0.9948292820F, 0.9948892550F, 0.9949487174F, 0.9950076719F, + 0.9950661212F, 0.9951240679F, 0.9951815148F, 0.9952384645F, + 0.9952949196F, 0.9953508828F, 0.9954063568F, 0.9954613442F, + 0.9955158476F, 0.9955698697F, 0.9956234132F, 0.9956764806F, + 0.9957290746F, 0.9957811978F, 0.9958328528F, 0.9958840423F, + 0.9959347688F, 0.9959850351F, 0.9960348435F, 0.9960841969F, + 0.9961330977F, 0.9961815486F, 0.9962295521F, 0.9962771108F, + 0.9963242274F, 0.9963709043F, 0.9964171441F, 0.9964629494F, + 0.9965083228F, 0.9965532668F, 0.9965977840F, 0.9966418768F, + 0.9966855479F, 0.9967287998F, 0.9967716350F, 0.9968140559F, + 0.9968560653F, 0.9968976655F, 0.9969388591F, 0.9969796485F, + 0.9970200363F, 0.9970600250F, 0.9970996170F, 0.9971388149F, + 0.9971776211F, 0.9972160380F, 0.9972540683F, 0.9972917142F, + 0.9973289783F, 0.9973658631F, 0.9974023709F, 0.9974385042F, + 0.9974742655F, 0.9975096571F, 0.9975446816F, 0.9975793413F, + 0.9976136386F, 0.9976475759F, 0.9976811557F, 0.9977143803F, + 0.9977472521F, 0.9977797736F, 0.9978119470F, 0.9978437748F, + 0.9978752593F, 0.9979064029F, 0.9979372079F, 0.9979676768F, + 0.9979978117F, 0.9980276151F, 0.9980570893F, 0.9980862367F, + 0.9981150595F, 0.9981435600F, 0.9981717406F, 0.9981996035F, + 0.9982271511F, 0.9982543856F, 0.9982813093F, 0.9983079246F, + 0.9983342336F, 0.9983602386F, 0.9983859418F, 0.9984113456F, + 0.9984364522F, 0.9984612638F, 0.9984857825F, 0.9985100108F, + 0.9985339507F, 0.9985576044F, 0.9985809743F, 0.9986040624F, + 0.9986268710F, 0.9986494022F, 0.9986716583F, 0.9986936413F, + 0.9987153535F, 0.9987367969F, 0.9987579738F, 0.9987788864F, + 0.9987995366F, 0.9988199267F, 0.9988400587F, 0.9988599348F, + 0.9988795572F, 0.9988989278F, 0.9989180487F, 0.9989369222F, + 0.9989555501F, 0.9989739347F, 0.9989920780F, 0.9990099820F, + 0.9990276487F, 0.9990450803F, 0.9990622787F, 0.9990792460F, + 0.9990959841F, 0.9991124952F, 0.9991287812F, 0.9991448440F, + 0.9991606858F, 0.9991763084F, 0.9991917139F, 0.9992069042F, + 0.9992218813F, 0.9992366471F, 0.9992512035F, 0.9992655525F, + 0.9992796961F, 0.9992936361F, 0.9993073744F, 0.9993209131F, + 0.9993342538F, 0.9993473987F, 0.9993603494F, 0.9993731080F, + 0.9993856762F, 0.9993980559F, 0.9994102490F, 0.9994222573F, + 0.9994340827F, 0.9994457269F, 0.9994571918F, 0.9994684793F, + 0.9994795910F, 0.9994905288F, 0.9995012945F, 0.9995118898F, + 0.9995223165F, 0.9995325765F, 0.9995426713F, 0.9995526029F, + 0.9995623728F, 0.9995719829F, 0.9995814349F, 0.9995907304F, + 0.9995998712F, 0.9996088590F, 0.9996176954F, 0.9996263821F, + 0.9996349208F, 0.9996433132F, 0.9996515609F, 0.9996596656F, + 0.9996676288F, 0.9996754522F, 0.9996831375F, 0.9996906862F, + 0.9996981000F, 0.9997053804F, 0.9997125290F, 0.9997195474F, + 0.9997264371F, 0.9997331998F, 0.9997398369F, 0.9997463500F, + 0.9997527406F, 0.9997590103F, 0.9997651606F, 0.9997711930F, + 0.9997771089F, 0.9997829098F, 0.9997885973F, 0.9997941728F, + 0.9997996378F, 0.9998049936F, 0.9998102419F, 0.9998153839F, + 0.9998204211F, 0.9998253550F, 0.9998301868F, 0.9998349182F, + 0.9998395503F, 0.9998440847F, 0.9998485226F, 0.9998528654F, + 0.9998571146F, 0.9998612713F, 0.9998653370F, 0.9998693130F, + 0.9998732007F, 0.9998770012F, 0.9998807159F, 0.9998843461F, + 0.9998878931F, 0.9998913581F, 0.9998947424F, 0.9998980473F, + 0.9999012740F, 0.9999044237F, 0.9999074976F, 0.9999104971F, + 0.9999134231F, 0.9999162771F, 0.9999190601F, 0.9999217733F, + 0.9999244179F, 0.9999269950F, 0.9999295058F, 0.9999319515F, + 0.9999343332F, 0.9999366519F, 0.9999389088F, 0.9999411050F, + 0.9999432416F, 0.9999453196F, 0.9999473402F, 0.9999493044F, + 0.9999512132F, 0.9999530677F, 0.9999548690F, 0.9999566180F, + 0.9999583157F, 0.9999599633F, 0.9999615616F, 0.9999631116F, + 0.9999646144F, 0.9999660709F, 0.9999674820F, 0.9999688487F, + 0.9999701719F, 0.9999714526F, 0.9999726917F, 0.9999738900F, + 0.9999750486F, 0.9999761682F, 0.9999772497F, 0.9999782941F, + 0.9999793021F, 0.9999802747F, 0.9999812126F, 0.9999821167F, + 0.9999829878F, 0.9999838268F, 0.9999846343F, 0.9999854113F, + 0.9999861584F, 0.9999868765F, 0.9999875664F, 0.9999882287F, + 0.9999888642F, 0.9999894736F, 0.9999900577F, 0.9999906172F, + 0.9999911528F, 0.9999916651F, 0.9999921548F, 0.9999926227F, + 0.9999930693F, 0.9999934954F, 0.9999939015F, 0.9999942883F, + 0.9999946564F, 0.9999950064F, 0.9999953390F, 0.9999956547F, + 0.9999959541F, 0.9999962377F, 0.9999965062F, 0.9999967601F, + 0.9999969998F, 0.9999972260F, 0.9999974392F, 0.9999976399F, + 0.9999978285F, 0.9999980056F, 0.9999981716F, 0.9999983271F, + 0.9999984724F, 0.9999986081F, 0.9999987345F, 0.9999988521F, + 0.9999989613F, 0.9999990625F, 0.9999991562F, 0.9999992426F, + 0.9999993223F, 0.9999993954F, 0.9999994625F, 0.9999995239F, + 0.9999995798F, 0.9999996307F, 0.9999996768F, 0.9999997184F, + 0.9999997559F, 0.9999997895F, 0.9999998195F, 0.9999998462F, + 0.9999998698F, 0.9999998906F, 0.9999999088F, 0.9999999246F, + 0.9999999383F, 0.9999999500F, 0.9999999600F, 0.9999999684F, + 0.9999999754F, 0.9999999811F, 0.9999999858F, 0.9999999896F, + 0.9999999925F, 0.9999999948F, 0.9999999965F, 0.9999999978F, + 0.9999999986F, 0.9999999992F, 0.9999999996F, 0.9999999998F, + 0.9999999999F, 1.0000000000F, 1.0000000000F, 1.0000000000F, +}; + +static const float vwin8192[4096] = { + 0.0000000578F, 0.0000005198F, 0.0000014438F, 0.0000028299F, + 0.0000046780F, 0.0000069882F, 0.0000097604F, 0.0000129945F, + 0.0000166908F, 0.0000208490F, 0.0000254692F, 0.0000305515F, + 0.0000360958F, 0.0000421021F, 0.0000485704F, 0.0000555006F, + 0.0000628929F, 0.0000707472F, 0.0000790635F, 0.0000878417F, + 0.0000970820F, 0.0001067842F, 0.0001169483F, 0.0001275744F, + 0.0001386625F, 0.0001502126F, 0.0001622245F, 0.0001746984F, + 0.0001876343F, 0.0002010320F, 0.0002148917F, 0.0002292132F, + 0.0002439967F, 0.0002592421F, 0.0002749493F, 0.0002911184F, + 0.0003077493F, 0.0003248421F, 0.0003423967F, 0.0003604132F, + 0.0003788915F, 0.0003978316F, 0.0004172335F, 0.0004370971F, + 0.0004574226F, 0.0004782098F, 0.0004994587F, 0.0005211694F, + 0.0005433418F, 0.0005659759F, 0.0005890717F, 0.0006126292F, + 0.0006366484F, 0.0006611292F, 0.0006860716F, 0.0007114757F, + 0.0007373414F, 0.0007636687F, 0.0007904576F, 0.0008177080F, + 0.0008454200F, 0.0008735935F, 0.0009022285F, 0.0009313250F, + 0.0009608830F, 0.0009909025F, 0.0010213834F, 0.0010523257F, + 0.0010837295F, 0.0011155946F, 0.0011479211F, 0.0011807090F, + 0.0012139582F, 0.0012476687F, 0.0012818405F, 0.0013164736F, + 0.0013515679F, 0.0013871235F, 0.0014231402F, 0.0014596182F, + 0.0014965573F, 0.0015339576F, 0.0015718190F, 0.0016101415F, + 0.0016489251F, 0.0016881698F, 0.0017278754F, 0.0017680421F, + 0.0018086698F, 0.0018497584F, 0.0018913080F, 0.0019333185F, + 0.0019757898F, 0.0020187221F, 0.0020621151F, 0.0021059690F, + 0.0021502837F, 0.0021950591F, 0.0022402953F, 0.0022859921F, + 0.0023321497F, 0.0023787679F, 0.0024258467F, 0.0024733861F, + 0.0025213861F, 0.0025698466F, 0.0026187676F, 0.0026681491F, + 0.0027179911F, 0.0027682935F, 0.0028190562F, 0.0028702794F, + 0.0029219628F, 0.0029741066F, 0.0030267107F, 0.0030797749F, + 0.0031332994F, 0.0031872841F, 0.0032417289F, 0.0032966338F, + 0.0033519988F, 0.0034078238F, 0.0034641089F, 0.0035208539F, + 0.0035780589F, 0.0036357237F, 0.0036938485F, 0.0037524331F, + 0.0038114775F, 0.0038709817F, 0.0039309456F, 0.0039913692F, + 0.0040522524F, 0.0041135953F, 0.0041753978F, 0.0042376599F, + 0.0043003814F, 0.0043635624F, 0.0044272029F, 0.0044913028F, + 0.0045558620F, 0.0046208806F, 0.0046863585F, 0.0047522955F, + 0.0048186919F, 0.0048855473F, 0.0049528619F, 0.0050206356F, + 0.0050888684F, 0.0051575601F, 0.0052267108F, 0.0052963204F, + 0.0053663890F, 0.0054369163F, 0.0055079025F, 0.0055793474F, + 0.0056512510F, 0.0057236133F, 0.0057964342F, 0.0058697137F, + 0.0059434517F, 0.0060176482F, 0.0060923032F, 0.0061674166F, + 0.0062429883F, 0.0063190183F, 0.0063955066F, 0.0064724532F, + 0.0065498579F, 0.0066277207F, 0.0067060416F, 0.0067848205F, + 0.0068640575F, 0.0069437523F, 0.0070239051F, 0.0071045157F, + 0.0071855840F, 0.0072671102F, 0.0073490940F, 0.0074315355F, + 0.0075144345F, 0.0075977911F, 0.0076816052F, 0.0077658768F, + 0.0078506057F, 0.0079357920F, 0.0080214355F, 0.0081075363F, + 0.0081940943F, 0.0082811094F, 0.0083685816F, 0.0084565108F, + 0.0085448970F, 0.0086337401F, 0.0087230401F, 0.0088127969F, + 0.0089030104F, 0.0089936807F, 0.0090848076F, 0.0091763911F, + 0.0092684311F, 0.0093609276F, 0.0094538805F, 0.0095472898F, + 0.0096411554F, 0.0097354772F, 0.0098302552F, 0.0099254894F, + 0.0100211796F, 0.0101173259F, 0.0102139281F, 0.0103109863F, + 0.0104085002F, 0.0105064700F, 0.0106048955F, 0.0107037766F, + 0.0108031133F, 0.0109029056F, 0.0110031534F, 0.0111038565F, + 0.0112050151F, 0.0113066289F, 0.0114086980F, 0.0115112222F, + 0.0116142015F, 0.0117176359F, 0.0118215252F, 0.0119258695F, + 0.0120306686F, 0.0121359225F, 0.0122416312F, 0.0123477944F, + 0.0124544123F, 0.0125614847F, 0.0126690116F, 0.0127769928F, + 0.0128854284F, 0.0129943182F, 0.0131036623F, 0.0132134604F, + 0.0133237126F, 0.0134344188F, 0.0135455790F, 0.0136571929F, + 0.0137692607F, 0.0138817821F, 0.0139947572F, 0.0141081859F, + 0.0142220681F, 0.0143364037F, 0.0144511927F, 0.0145664350F, + 0.0146821304F, 0.0147982791F, 0.0149148808F, 0.0150319355F, + 0.0151494431F, 0.0152674036F, 0.0153858168F, 0.0155046828F, + 0.0156240014F, 0.0157437726F, 0.0158639962F, 0.0159846723F, + 0.0161058007F, 0.0162273814F, 0.0163494142F, 0.0164718991F, + 0.0165948361F, 0.0167182250F, 0.0168420658F, 0.0169663584F, + 0.0170911027F, 0.0172162987F, 0.0173419462F, 0.0174680452F, + 0.0175945956F, 0.0177215974F, 0.0178490504F, 0.0179769545F, + 0.0181053098F, 0.0182341160F, 0.0183633732F, 0.0184930812F, + 0.0186232399F, 0.0187538494F, 0.0188849094F, 0.0190164200F, + 0.0191483809F, 0.0192807923F, 0.0194136539F, 0.0195469656F, + 0.0196807275F, 0.0198149394F, 0.0199496012F, 0.0200847128F, + 0.0202202742F, 0.0203562853F, 0.0204927460F, 0.0206296561F, + 0.0207670157F, 0.0209048245F, 0.0210430826F, 0.0211817899F, + 0.0213209462F, 0.0214605515F, 0.0216006057F, 0.0217411086F, + 0.0218820603F, 0.0220234605F, 0.0221653093F, 0.0223076066F, + 0.0224503521F, 0.0225935459F, 0.0227371879F, 0.0228812779F, + 0.0230258160F, 0.0231708018F, 0.0233162355F, 0.0234621169F, + 0.0236084459F, 0.0237552224F, 0.0239024462F, 0.0240501175F, + 0.0241982359F, 0.0243468015F, 0.0244958141F, 0.0246452736F, + 0.0247951800F, 0.0249455331F, 0.0250963329F, 0.0252475792F, + 0.0253992720F, 0.0255514111F, 0.0257039965F, 0.0258570281F, + 0.0260105057F, 0.0261644293F, 0.0263187987F, 0.0264736139F, + 0.0266288747F, 0.0267845811F, 0.0269407330F, 0.0270973302F, + 0.0272543727F, 0.0274118604F, 0.0275697930F, 0.0277281707F, + 0.0278869932F, 0.0280462604F, 0.0282059723F, 0.0283661287F, + 0.0285267295F, 0.0286877747F, 0.0288492641F, 0.0290111976F, + 0.0291735751F, 0.0293363965F, 0.0294996617F, 0.0296633706F, + 0.0298275231F, 0.0299921190F, 0.0301571583F, 0.0303226409F, + 0.0304885667F, 0.0306549354F, 0.0308217472F, 0.0309890017F, + 0.0311566989F, 0.0313248388F, 0.0314934211F, 0.0316624459F, + 0.0318319128F, 0.0320018220F, 0.0321721732F, 0.0323429663F, + 0.0325142013F, 0.0326858779F, 0.0328579962F, 0.0330305559F, + 0.0332035570F, 0.0333769994F, 0.0335508829F, 0.0337252074F, + 0.0338999728F, 0.0340751790F, 0.0342508259F, 0.0344269134F, + 0.0346034412F, 0.0347804094F, 0.0349578178F, 0.0351356663F, + 0.0353139548F, 0.0354926831F, 0.0356718511F, 0.0358514588F, + 0.0360315059F, 0.0362119924F, 0.0363929182F, 0.0365742831F, + 0.0367560870F, 0.0369383297F, 0.0371210113F, 0.0373041315F, + 0.0374876902F, 0.0376716873F, 0.0378561226F, 0.0380409961F, + 0.0382263077F, 0.0384120571F, 0.0385982443F, 0.0387848691F, + 0.0389719315F, 0.0391594313F, 0.0393473683F, 0.0395357425F, + 0.0397245537F, 0.0399138017F, 0.0401034866F, 0.0402936080F, + 0.0404841660F, 0.0406751603F, 0.0408665909F, 0.0410584576F, + 0.0412507603F, 0.0414434988F, 0.0416366731F, 0.0418302829F, + 0.0420243282F, 0.0422188088F, 0.0424137246F, 0.0426090755F, + 0.0428048613F, 0.0430010819F, 0.0431977371F, 0.0433948269F, + 0.0435923511F, 0.0437903095F, 0.0439887020F, 0.0441875285F, + 0.0443867889F, 0.0445864830F, 0.0447866106F, 0.0449871717F, + 0.0451881661F, 0.0453895936F, 0.0455914542F, 0.0457937477F, + 0.0459964738F, 0.0461996326F, 0.0464032239F, 0.0466072475F, + 0.0468117032F, 0.0470165910F, 0.0472219107F, 0.0474276622F, + 0.0476338452F, 0.0478404597F, 0.0480475056F, 0.0482549827F, + 0.0484628907F, 0.0486712297F, 0.0488799994F, 0.0490891998F, + 0.0492988306F, 0.0495088917F, 0.0497193830F, 0.0499303043F, + 0.0501416554F, 0.0503534363F, 0.0505656468F, 0.0507782867F, + 0.0509913559F, 0.0512048542F, 0.0514187815F, 0.0516331376F, + 0.0518479225F, 0.0520631358F, 0.0522787775F, 0.0524948475F, + 0.0527113455F, 0.0529282715F, 0.0531456252F, 0.0533634066F, + 0.0535816154F, 0.0538002515F, 0.0540193148F, 0.0542388051F, + 0.0544587222F, 0.0546790660F, 0.0548998364F, 0.0551210331F, + 0.0553426561F, 0.0555647051F, 0.0557871801F, 0.0560100807F, + 0.0562334070F, 0.0564571587F, 0.0566813357F, 0.0569059378F, + 0.0571309649F, 0.0573564168F, 0.0575822933F, 0.0578085942F, + 0.0580353195F, 0.0582624689F, 0.0584900423F, 0.0587180396F, + 0.0589464605F, 0.0591753049F, 0.0594045726F, 0.0596342635F, + 0.0598643774F, 0.0600949141F, 0.0603258735F, 0.0605572555F, + 0.0607890597F, 0.0610212862F, 0.0612539346F, 0.0614870049F, + 0.0617204968F, 0.0619544103F, 0.0621887451F, 0.0624235010F, + 0.0626586780F, 0.0628942758F, 0.0631302942F, 0.0633667331F, + 0.0636035923F, 0.0638408717F, 0.0640785710F, 0.0643166901F, + 0.0645552288F, 0.0647941870F, 0.0650335645F, 0.0652733610F, + 0.0655135765F, 0.0657542108F, 0.0659952636F, 0.0662367348F, + 0.0664786242F, 0.0667209316F, 0.0669636570F, 0.0672068000F, + 0.0674503605F, 0.0676943384F, 0.0679387334F, 0.0681835454F, + 0.0684287742F, 0.0686744196F, 0.0689204814F, 0.0691669595F, + 0.0694138536F, 0.0696611637F, 0.0699088894F, 0.0701570307F, + 0.0704055873F, 0.0706545590F, 0.0709039458F, 0.0711537473F, + 0.0714039634F, 0.0716545939F, 0.0719056387F, 0.0721570975F, + 0.0724089702F, 0.0726612565F, 0.0729139563F, 0.0731670694F, + 0.0734205956F, 0.0736745347F, 0.0739288866F, 0.0741836510F, + 0.0744388277F, 0.0746944166F, 0.0749504175F, 0.0752068301F, + 0.0754636543F, 0.0757208899F, 0.0759785367F, 0.0762365946F, + 0.0764950632F, 0.0767539424F, 0.0770132320F, 0.0772729319F, + 0.0775330418F, 0.0777935616F, 0.0780544909F, 0.0783158298F, + 0.0785775778F, 0.0788397349F, 0.0791023009F, 0.0793652755F, + 0.0796286585F, 0.0798924498F, 0.0801566492F, 0.0804212564F, + 0.0806862712F, 0.0809516935F, 0.0812175231F, 0.0814837597F, + 0.0817504031F, 0.0820174532F, 0.0822849097F, 0.0825527724F, + 0.0828210412F, 0.0830897158F, 0.0833587960F, 0.0836282816F, + 0.0838981724F, 0.0841684682F, 0.0844391688F, 0.0847102740F, + 0.0849817835F, 0.0852536973F, 0.0855260150F, 0.0857987364F, + 0.0860718614F, 0.0863453897F, 0.0866193211F, 0.0868936554F, + 0.0871683924F, 0.0874435319F, 0.0877190737F, 0.0879950175F, + 0.0882713632F, 0.0885481105F, 0.0888252592F, 0.0891028091F, + 0.0893807600F, 0.0896591117F, 0.0899378639F, 0.0902170165F, + 0.0904965692F, 0.0907765218F, 0.0910568740F, 0.0913376258F, + 0.0916187767F, 0.0919003268F, 0.0921822756F, 0.0924646230F, + 0.0927473687F, 0.0930305126F, 0.0933140545F, 0.0935979940F, + 0.0938823310F, 0.0941670653F, 0.0944521966F, 0.0947377247F, + 0.0950236494F, 0.0953099704F, 0.0955966876F, 0.0958838007F, + 0.0961713094F, 0.0964592136F, 0.0967475131F, 0.0970362075F, + 0.0973252967F, 0.0976147805F, 0.0979046585F, 0.0981949307F, + 0.0984855967F, 0.0987766563F, 0.0990681093F, 0.0993599555F, + 0.0996521945F, 0.0999448263F, 0.1002378506F, 0.1005312671F, + 0.1008250755F, 0.1011192757F, 0.1014138675F, 0.1017088505F, + 0.1020042246F, 0.1022999895F, 0.1025961450F, 0.1028926909F, + 0.1031896268F, 0.1034869526F, 0.1037846680F, 0.1040827729F, + 0.1043812668F, 0.1046801497F, 0.1049794213F, 0.1052790813F, + 0.1055791294F, 0.1058795656F, 0.1061803894F, 0.1064816006F, + 0.1067831991F, 0.1070851846F, 0.1073875568F, 0.1076903155F, + 0.1079934604F, 0.1082969913F, 0.1086009079F, 0.1089052101F, + 0.1092098975F, 0.1095149699F, 0.1098204270F, 0.1101262687F, + 0.1104324946F, 0.1107391045F, 0.1110460982F, 0.1113534754F, + 0.1116612359F, 0.1119693793F, 0.1122779055F, 0.1125868142F, + 0.1128961052F, 0.1132057781F, 0.1135158328F, 0.1138262690F, + 0.1141370863F, 0.1144482847F, 0.1147598638F, 0.1150718233F, + 0.1153841631F, 0.1156968828F, 0.1160099822F, 0.1163234610F, + 0.1166373190F, 0.1169515559F, 0.1172661714F, 0.1175811654F, + 0.1178965374F, 0.1182122874F, 0.1185284149F, 0.1188449198F, + 0.1191618018F, 0.1194790606F, 0.1197966960F, 0.1201147076F, + 0.1204330953F, 0.1207518587F, 0.1210709976F, 0.1213905118F, + 0.1217104009F, 0.1220306647F, 0.1223513029F, 0.1226723153F, + 0.1229937016F, 0.1233154615F, 0.1236375948F, 0.1239601011F, + 0.1242829803F, 0.1246062319F, 0.1249298559F, 0.1252538518F, + 0.1255782195F, 0.1259029586F, 0.1262280689F, 0.1265535501F, + 0.1268794019F, 0.1272056241F, 0.1275322163F, 0.1278591784F, + 0.1281865099F, 0.1285142108F, 0.1288422805F, 0.1291707190F, + 0.1294995259F, 0.1298287009F, 0.1301582437F, 0.1304881542F, + 0.1308184319F, 0.1311490766F, 0.1314800881F, 0.1318114660F, + 0.1321432100F, 0.1324753200F, 0.1328077955F, 0.1331406364F, + 0.1334738422F, 0.1338074129F, 0.1341413479F, 0.1344756472F, + 0.1348103103F, 0.1351453370F, 0.1354807270F, 0.1358164801F, + 0.1361525959F, 0.1364890741F, 0.1368259145F, 0.1371631167F, + 0.1375006805F, 0.1378386056F, 0.1381768917F, 0.1385155384F, + 0.1388545456F, 0.1391939129F, 0.1395336400F, 0.1398737266F, + 0.1402141724F, 0.1405549772F, 0.1408961406F, 0.1412376623F, + 0.1415795421F, 0.1419217797F, 0.1422643746F, 0.1426073268F, + 0.1429506358F, 0.1432943013F, 0.1436383231F, 0.1439827008F, + 0.1443274342F, 0.1446725229F, 0.1450179667F, 0.1453637652F, + 0.1457099181F, 0.1460564252F, 0.1464032861F, 0.1467505006F, + 0.1470980682F, 0.1474459888F, 0.1477942620F, 0.1481428875F, + 0.1484918651F, 0.1488411942F, 0.1491908748F, 0.1495409065F, + 0.1498912889F, 0.1502420218F, 0.1505931048F, 0.1509445376F, + 0.1512963200F, 0.1516484516F, 0.1520009321F, 0.1523537612F, + 0.1527069385F, 0.1530604638F, 0.1534143368F, 0.1537685571F, + 0.1541231244F, 0.1544780384F, 0.1548332987F, 0.1551889052F, + 0.1555448574F, 0.1559011550F, 0.1562577978F, 0.1566147853F, + 0.1569721173F, 0.1573297935F, 0.1576878135F, 0.1580461771F, + 0.1584048838F, 0.1587639334F, 0.1591233255F, 0.1594830599F, + 0.1598431361F, 0.1602035540F, 0.1605643131F, 0.1609254131F, + 0.1612868537F, 0.1616486346F, 0.1620107555F, 0.1623732160F, + 0.1627360158F, 0.1630991545F, 0.1634626319F, 0.1638264476F, + 0.1641906013F, 0.1645550926F, 0.1649199212F, 0.1652850869F, + 0.1656505892F, 0.1660164278F, 0.1663826024F, 0.1667491127F, + 0.1671159583F, 0.1674831388F, 0.1678506541F, 0.1682185036F, + 0.1685866872F, 0.1689552044F, 0.1693240549F, 0.1696932384F, + 0.1700627545F, 0.1704326029F, 0.1708027833F, 0.1711732952F, + 0.1715441385F, 0.1719153127F, 0.1722868175F, 0.1726586526F, + 0.1730308176F, 0.1734033121F, 0.1737761359F, 0.1741492886F, + 0.1745227698F, 0.1748965792F, 0.1752707164F, 0.1756451812F, + 0.1760199731F, 0.1763950918F, 0.1767705370F, 0.1771463083F, + 0.1775224054F, 0.1778988279F, 0.1782755754F, 0.1786526477F, + 0.1790300444F, 0.1794077651F, 0.1797858094F, 0.1801641771F, + 0.1805428677F, 0.1809218810F, 0.1813012165F, 0.1816808739F, + 0.1820608528F, 0.1824411530F, 0.1828217739F, 0.1832027154F, + 0.1835839770F, 0.1839655584F, 0.1843474592F, 0.1847296790F, + 0.1851122175F, 0.1854950744F, 0.1858782492F, 0.1862617417F, + 0.1866455514F, 0.1870296780F, 0.1874141211F, 0.1877988804F, + 0.1881839555F, 0.1885693461F, 0.1889550517F, 0.1893410721F, + 0.1897274068F, 0.1901140555F, 0.1905010178F, 0.1908882933F, + 0.1912758818F, 0.1916637828F, 0.1920519959F, 0.1924405208F, + 0.1928293571F, 0.1932185044F, 0.1936079625F, 0.1939977308F, + 0.1943878091F, 0.1947781969F, 0.1951688939F, 0.1955598998F, + 0.1959512141F, 0.1963428364F, 0.1967347665F, 0.1971270038F, + 0.1975195482F, 0.1979123990F, 0.1983055561F, 0.1986990190F, + 0.1990927873F, 0.1994868607F, 0.1998812388F, 0.2002759212F, + 0.2006709075F, 0.2010661974F, 0.2014617904F, 0.2018576862F, + 0.2022538844F, 0.2026503847F, 0.2030471865F, 0.2034442897F, + 0.2038416937F, 0.2042393982F, 0.2046374028F, 0.2050357071F, + 0.2054343107F, 0.2058332133F, 0.2062324145F, 0.2066319138F, + 0.2070317110F, 0.2074318055F, 0.2078321970F, 0.2082328852F, + 0.2086338696F, 0.2090351498F, 0.2094367255F, 0.2098385962F, + 0.2102407617F, 0.2106432213F, 0.2110459749F, 0.2114490220F, + 0.2118523621F, 0.2122559950F, 0.2126599202F, 0.2130641373F, + 0.2134686459F, 0.2138734456F, 0.2142785361F, 0.2146839168F, + 0.2150895875F, 0.2154955478F, 0.2159017972F, 0.2163083353F, + 0.2167151617F, 0.2171222761F, 0.2175296780F, 0.2179373670F, + 0.2183453428F, 0.2187536049F, 0.2191621529F, 0.2195709864F, + 0.2199801051F, 0.2203895085F, 0.2207991961F, 0.2212091677F, + 0.2216194228F, 0.2220299610F, 0.2224407818F, 0.2228518850F, + 0.2232632699F, 0.2236749364F, 0.2240868839F, 0.2244991121F, + 0.2249116204F, 0.2253244086F, 0.2257374763F, 0.2261508229F, + 0.2265644481F, 0.2269783514F, 0.2273925326F, 0.2278069911F, + 0.2282217265F, 0.2286367384F, 0.2290520265F, 0.2294675902F, + 0.2298834292F, 0.2302995431F, 0.2307159314F, 0.2311325937F, + 0.2315495297F, 0.2319667388F, 0.2323842207F, 0.2328019749F, + 0.2332200011F, 0.2336382988F, 0.2340568675F, 0.2344757070F, + 0.2348948166F, 0.2353141961F, 0.2357338450F, 0.2361537629F, + 0.2365739493F, 0.2369944038F, 0.2374151261F, 0.2378361156F, + 0.2382573720F, 0.2386788948F, 0.2391006836F, 0.2395227380F, + 0.2399450575F, 0.2403676417F, 0.2407904902F, 0.2412136026F, + 0.2416369783F, 0.2420606171F, 0.2424845185F, 0.2429086820F, + 0.2433331072F, 0.2437577936F, 0.2441827409F, 0.2446079486F, + 0.2450334163F, 0.2454591435F, 0.2458851298F, 0.2463113747F, + 0.2467378779F, 0.2471646389F, 0.2475916573F, 0.2480189325F, + 0.2484464643F, 0.2488742521F, 0.2493022955F, 0.2497305940F, + 0.2501591473F, 0.2505879549F, 0.2510170163F, 0.2514463311F, + 0.2518758989F, 0.2523057193F, 0.2527357916F, 0.2531661157F, + 0.2535966909F, 0.2540275169F, 0.2544585931F, 0.2548899193F, + 0.2553214948F, 0.2557533193F, 0.2561853924F, 0.2566177135F, + 0.2570502822F, 0.2574830981F, 0.2579161608F, 0.2583494697F, + 0.2587830245F, 0.2592168246F, 0.2596508697F, 0.2600851593F, + 0.2605196929F, 0.2609544701F, 0.2613894904F, 0.2618247534F, + 0.2622602586F, 0.2626960055F, 0.2631319938F, 0.2635682230F, + 0.2640046925F, 0.2644414021F, 0.2648783511F, 0.2653155391F, + 0.2657529657F, 0.2661906305F, 0.2666285329F, 0.2670666725F, + 0.2675050489F, 0.2679436616F, 0.2683825101F, 0.2688215940F, + 0.2692609127F, 0.2697004660F, 0.2701402532F, 0.2705802739F, + 0.2710205278F, 0.2714610142F, 0.2719017327F, 0.2723426830F, + 0.2727838644F, 0.2732252766F, 0.2736669191F, 0.2741087914F, + 0.2745508930F, 0.2749932235F, 0.2754357824F, 0.2758785693F, + 0.2763215837F, 0.2767648251F, 0.2772082930F, 0.2776519870F, + 0.2780959066F, 0.2785400513F, 0.2789844207F, 0.2794290143F, + 0.2798738316F, 0.2803188722F, 0.2807641355F, 0.2812096211F, + 0.2816553286F, 0.2821012574F, 0.2825474071F, 0.2829937773F, + 0.2834403673F, 0.2838871768F, 0.2843342053F, 0.2847814523F, + 0.2852289174F, 0.2856765999F, 0.2861244996F, 0.2865726159F, + 0.2870209482F, 0.2874694962F, 0.2879182594F, 0.2883672372F, + 0.2888164293F, 0.2892658350F, 0.2897154540F, 0.2901652858F, + 0.2906153298F, 0.2910655856F, 0.2915160527F, 0.2919667306F, + 0.2924176189F, 0.2928687171F, 0.2933200246F, 0.2937715409F, + 0.2942232657F, 0.2946751984F, 0.2951273386F, 0.2955796856F, + 0.2960322391F, 0.2964849986F, 0.2969379636F, 0.2973911335F, + 0.2978445080F, 0.2982980864F, 0.2987518684F, 0.2992058534F, + 0.2996600409F, 0.3001144305F, 0.3005690217F, 0.3010238139F, + 0.3014788067F, 0.3019339995F, 0.3023893920F, 0.3028449835F, + 0.3033007736F, 0.3037567618F, 0.3042129477F, 0.3046693306F, + 0.3051259102F, 0.3055826859F, 0.3060396572F, 0.3064968236F, + 0.3069541847F, 0.3074117399F, 0.3078694887F, 0.3083274307F, + 0.3087855653F, 0.3092438920F, 0.3097024104F, 0.3101611199F, + 0.3106200200F, 0.3110791103F, 0.3115383902F, 0.3119978592F, + 0.3124575169F, 0.3129173627F, 0.3133773961F, 0.3138376166F, + 0.3142980238F, 0.3147586170F, 0.3152193959F, 0.3156803598F, + 0.3161415084F, 0.3166028410F, 0.3170643573F, 0.3175260566F, + 0.3179879384F, 0.3184500023F, 0.3189122478F, 0.3193746743F, + 0.3198372814F, 0.3203000685F, 0.3207630351F, 0.3212261807F, + 0.3216895048F, 0.3221530069F, 0.3226166865F, 0.3230805430F, + 0.3235445760F, 0.3240087849F, 0.3244731693F, 0.3249377285F, + 0.3254024622F, 0.3258673698F, 0.3263324507F, 0.3267977045F, + 0.3272631306F, 0.3277287286F, 0.3281944978F, 0.3286604379F, + 0.3291265482F, 0.3295928284F, 0.3300592777F, 0.3305258958F, + 0.3309926821F, 0.3314596361F, 0.3319267573F, 0.3323940451F, + 0.3328614990F, 0.3333291186F, 0.3337969033F, 0.3342648525F, + 0.3347329658F, 0.3352012427F, 0.3356696825F, 0.3361382849F, + 0.3366070492F, 0.3370759749F, 0.3375450616F, 0.3380143087F, + 0.3384837156F, 0.3389532819F, 0.3394230071F, 0.3398928905F, + 0.3403629317F, 0.3408331302F, 0.3413034854F, 0.3417739967F, + 0.3422446638F, 0.3427154860F, 0.3431864628F, 0.3436575938F, + 0.3441288782F, 0.3446003158F, 0.3450719058F, 0.3455436478F, + 0.3460155412F, 0.3464875856F, 0.3469597804F, 0.3474321250F, + 0.3479046189F, 0.3483772617F, 0.3488500527F, 0.3493229914F, + 0.3497960774F, 0.3502693100F, 0.3507426887F, 0.3512162131F, + 0.3516898825F, 0.3521636965F, 0.3526376545F, 0.3531117559F, + 0.3535860003F, 0.3540603870F, 0.3545349157F, 0.3550095856F, + 0.3554843964F, 0.3559593474F, 0.3564344381F, 0.3569096680F, + 0.3573850366F, 0.3578605432F, 0.3583361875F, 0.3588119687F, + 0.3592878865F, 0.3597639402F, 0.3602401293F, 0.3607164533F, + 0.3611929117F, 0.3616695038F, 0.3621462292F, 0.3626230873F, + 0.3631000776F, 0.3635771995F, 0.3640544525F, 0.3645318360F, + 0.3650093496F, 0.3654869926F, 0.3659647645F, 0.3664426648F, + 0.3669206930F, 0.3673988484F, 0.3678771306F, 0.3683555390F, + 0.3688340731F, 0.3693127322F, 0.3697915160F, 0.3702704237F, + 0.3707494549F, 0.3712286091F, 0.3717078857F, 0.3721872840F, + 0.3726668037F, 0.3731464441F, 0.3736262047F, 0.3741060850F, + 0.3745860843F, 0.3750662023F, 0.3755464382F, 0.3760267915F, + 0.3765072618F, 0.3769878484F, 0.3774685509F, 0.3779493686F, + 0.3784303010F, 0.3789113475F, 0.3793925076F, 0.3798737809F, + 0.3803551666F, 0.3808366642F, 0.3813182733F, 0.3817999932F, + 0.3822818234F, 0.3827637633F, 0.3832458124F, 0.3837279702F, + 0.3842102360F, 0.3846926093F, 0.3851750897F, 0.3856576764F, + 0.3861403690F, 0.3866231670F, 0.3871060696F, 0.3875890765F, + 0.3880721870F, 0.3885554007F, 0.3890387168F, 0.3895221349F, + 0.3900056544F, 0.3904892748F, 0.3909729955F, 0.3914568160F, + 0.3919407356F, 0.3924247539F, 0.3929088702F, 0.3933930841F, + 0.3938773949F, 0.3943618021F, 0.3948463052F, 0.3953309035F, + 0.3958155966F, 0.3963003838F, 0.3967852646F, 0.3972702385F, + 0.3977553048F, 0.3982404631F, 0.3987257127F, 0.3992110531F, + 0.3996964838F, 0.4001820041F, 0.4006676136F, 0.4011533116F, + 0.4016390976F, 0.4021249710F, 0.4026109313F, 0.4030969779F, + 0.4035831102F, 0.4040693277F, 0.4045556299F, 0.4050420160F, + 0.4055284857F, 0.4060150383F, 0.4065016732F, 0.4069883899F, + 0.4074751879F, 0.4079620665F, 0.4084490252F, 0.4089360635F, + 0.4094231807F, 0.4099103763F, 0.4103976498F, 0.4108850005F, + 0.4113724280F, 0.4118599315F, 0.4123475107F, 0.4128351648F, + 0.4133228934F, 0.4138106959F, 0.4142985716F, 0.4147865201F, + 0.4152745408F, 0.4157626330F, 0.4162507963F, 0.4167390301F, + 0.4172273337F, 0.4177157067F, 0.4182041484F, 0.4186926583F, + 0.4191812359F, 0.4196698805F, 0.4201585915F, 0.4206473685F, + 0.4211362108F, 0.4216251179F, 0.4221140892F, 0.4226031241F, + 0.4230922221F, 0.4235813826F, 0.4240706050F, 0.4245598887F, + 0.4250492332F, 0.4255386379F, 0.4260281022F, 0.4265176256F, + 0.4270072075F, 0.4274968473F, 0.4279865445F, 0.4284762984F, + 0.4289661086F, 0.4294559743F, 0.4299458951F, 0.4304358704F, + 0.4309258996F, 0.4314159822F, 0.4319061175F, 0.4323963050F, + 0.4328865441F, 0.4333768342F, 0.4338671749F, 0.4343575654F, + 0.4348480052F, 0.4353384938F, 0.4358290306F, 0.4363196149F, + 0.4368102463F, 0.4373009241F, 0.4377916478F, 0.4382824168F, + 0.4387732305F, 0.4392640884F, 0.4397549899F, 0.4402459343F, + 0.4407369212F, 0.4412279499F, 0.4417190198F, 0.4422101305F, + 0.4427012813F, 0.4431924717F, 0.4436837010F, 0.4441749686F, + 0.4446662742F, 0.4451576169F, 0.4456489963F, 0.4461404118F, + 0.4466318628F, 0.4471233487F, 0.4476148690F, 0.4481064230F, + 0.4485980103F, 0.4490896302F, 0.4495812821F, 0.4500729654F, + 0.4505646797F, 0.4510564243F, 0.4515481986F, 0.4520400021F, + 0.4525318341F, 0.4530236942F, 0.4535155816F, 0.4540074959F, + 0.4544994365F, 0.4549914028F, 0.4554833941F, 0.4559754100F, + 0.4564674499F, 0.4569595131F, 0.4574515991F, 0.4579437074F, + 0.4584358372F, 0.4589279881F, 0.4594201595F, 0.4599123508F, + 0.4604045615F, 0.4608967908F, 0.4613890383F, 0.4618813034F, + 0.4623735855F, 0.4628658841F, 0.4633581984F, 0.4638505281F, + 0.4643428724F, 0.4648352308F, 0.4653276028F, 0.4658199877F, + 0.4663123849F, 0.4668047940F, 0.4672972143F, 0.4677896451F, + 0.4682820861F, 0.4687745365F, 0.4692669958F, 0.4697594634F, + 0.4702519387F, 0.4707444211F, 0.4712369102F, 0.4717294052F, + 0.4722219056F, 0.4727144109F, 0.4732069204F, 0.4736994336F, + 0.4741919498F, 0.4746844686F, 0.4751769893F, 0.4756695113F, + 0.4761620341F, 0.4766545571F, 0.4771470797F, 0.4776396013F, + 0.4781321213F, 0.4786246392F, 0.4791171544F, 0.4796096663F, + 0.4801021744F, 0.4805946779F, 0.4810871765F, 0.4815796694F, + 0.4820721561F, 0.4825646360F, 0.4830571086F, 0.4835495732F, + 0.4840420293F, 0.4845344763F, 0.4850269136F, 0.4855193407F, + 0.4860117569F, 0.4865041617F, 0.4869965545F, 0.4874889347F, + 0.4879813018F, 0.4884736551F, 0.4889659941F, 0.4894583182F, + 0.4899506268F, 0.4904429193F, 0.4909351952F, 0.4914274538F, + 0.4919196947F, 0.4924119172F, 0.4929041207F, 0.4933963046F, + 0.4938884685F, 0.4943806116F, 0.4948727335F, 0.4953648335F, + 0.4958569110F, 0.4963489656F, 0.4968409965F, 0.4973330032F, + 0.4978249852F, 0.4983169419F, 0.4988088726F, 0.4993007768F, + 0.4997926539F, 0.5002845034F, 0.5007763247F, 0.5012681171F, + 0.5017598801F, 0.5022516132F, 0.5027433157F, 0.5032349871F, + 0.5037266268F, 0.5042182341F, 0.5047098086F, 0.5052013497F, + 0.5056928567F, 0.5061843292F, 0.5066757664F, 0.5071671679F, + 0.5076585330F, 0.5081498613F, 0.5086411520F, 0.5091324047F, + 0.5096236187F, 0.5101147934F, 0.5106059284F, 0.5110970230F, + 0.5115880766F, 0.5120790887F, 0.5125700587F, 0.5130609860F, + 0.5135518700F, 0.5140427102F, 0.5145335059F, 0.5150242566F, + 0.5155149618F, 0.5160056208F, 0.5164962331F, 0.5169867980F, + 0.5174773151F, 0.5179677837F, 0.5184582033F, 0.5189485733F, + 0.5194388931F, 0.5199291621F, 0.5204193798F, 0.5209095455F, + 0.5213996588F, 0.5218897190F, 0.5223797256F, 0.5228696779F, + 0.5233595755F, 0.5238494177F, 0.5243392039F, 0.5248289337F, + 0.5253186063F, 0.5258082213F, 0.5262977781F, 0.5267872760F, + 0.5272767146F, 0.5277660932F, 0.5282554112F, 0.5287446682F, + 0.5292338635F, 0.5297229965F, 0.5302120667F, 0.5307010736F, + 0.5311900164F, 0.5316788947F, 0.5321677079F, 0.5326564554F, + 0.5331451366F, 0.5336337511F, 0.5341222981F, 0.5346107771F, + 0.5350991876F, 0.5355875290F, 0.5360758007F, 0.5365640021F, + 0.5370521327F, 0.5375401920F, 0.5380281792F, 0.5385160939F, + 0.5390039355F, 0.5394917034F, 0.5399793971F, 0.5404670159F, + 0.5409545594F, 0.5414420269F, 0.5419294179F, 0.5424167318F, + 0.5429039680F, 0.5433911261F, 0.5438782053F, 0.5443652051F, + 0.5448521250F, 0.5453389644F, 0.5458257228F, 0.5463123995F, + 0.5467989940F, 0.5472855057F, 0.5477719341F, 0.5482582786F, + 0.5487445387F, 0.5492307137F, 0.5497168031F, 0.5502028063F, + 0.5506887228F, 0.5511745520F, 0.5516602934F, 0.5521459463F, + 0.5526315103F, 0.5531169847F, 0.5536023690F, 0.5540876626F, + 0.5545728649F, 0.5550579755F, 0.5555429937F, 0.5560279189F, + 0.5565127507F, 0.5569974884F, 0.5574821315F, 0.5579666794F, + 0.5584511316F, 0.5589354875F, 0.5594197465F, 0.5599039080F, + 0.5603879716F, 0.5608719367F, 0.5613558026F, 0.5618395689F, + 0.5623232350F, 0.5628068002F, 0.5632902642F, 0.5637736262F, + 0.5642568858F, 0.5647400423F, 0.5652230953F, 0.5657060442F, + 0.5661888883F, 0.5666716272F, 0.5671542603F, 0.5676367870F, + 0.5681192069F, 0.5686015192F, 0.5690837235F, 0.5695658192F, + 0.5700478058F, 0.5705296827F, 0.5710114494F, 0.5714931052F, + 0.5719746497F, 0.5724560822F, 0.5729374023F, 0.5734186094F, + 0.5738997029F, 0.5743806823F, 0.5748615470F, 0.5753422965F, + 0.5758229301F, 0.5763034475F, 0.5767838480F, 0.5772641310F, + 0.5777442960F, 0.5782243426F, 0.5787042700F, 0.5791840778F, + 0.5796637654F, 0.5801433322F, 0.5806227778F, 0.5811021016F, + 0.5815813029F, 0.5820603814F, 0.5825393363F, 0.5830181673F, + 0.5834968737F, 0.5839754549F, 0.5844539105F, 0.5849322399F, + 0.5854104425F, 0.5858885179F, 0.5863664653F, 0.5868442844F, + 0.5873219746F, 0.5877995353F, 0.5882769660F, 0.5887542661F, + 0.5892314351F, 0.5897084724F, 0.5901853776F, 0.5906621500F, + 0.5911387892F, 0.5916152945F, 0.5920916655F, 0.5925679016F, + 0.5930440022F, 0.5935199669F, 0.5939957950F, 0.5944714861F, + 0.5949470396F, 0.5954224550F, 0.5958977317F, 0.5963728692F, + 0.5968478669F, 0.5973227244F, 0.5977974411F, 0.5982720163F, + 0.5987464497F, 0.5992207407F, 0.5996948887F, 0.6001688932F, + 0.6006427537F, 0.6011164696F, 0.6015900405F, 0.6020634657F, + 0.6025367447F, 0.6030098770F, 0.6034828621F, 0.6039556995F, + 0.6044283885F, 0.6049009288F, 0.6053733196F, 0.6058455606F, + 0.6063176512F, 0.6067895909F, 0.6072613790F, 0.6077330152F, + 0.6082044989F, 0.6086758295F, 0.6091470065F, 0.6096180294F, + 0.6100888977F, 0.6105596108F, 0.6110301682F, 0.6115005694F, + 0.6119708139F, 0.6124409011F, 0.6129108305F, 0.6133806017F, + 0.6138502139F, 0.6143196669F, 0.6147889599F, 0.6152580926F, + 0.6157270643F, 0.6161958746F, 0.6166645230F, 0.6171330088F, + 0.6176013317F, 0.6180694910F, 0.6185374863F, 0.6190053171F, + 0.6194729827F, 0.6199404828F, 0.6204078167F, 0.6208749841F, + 0.6213419842F, 0.6218088168F, 0.6222754811F, 0.6227419768F, + 0.6232083032F, 0.6236744600F, 0.6241404465F, 0.6246062622F, + 0.6250719067F, 0.6255373795F, 0.6260026799F, 0.6264678076F, + 0.6269327619F, 0.6273975425F, 0.6278621487F, 0.6283265800F, + 0.6287908361F, 0.6292549163F, 0.6297188201F, 0.6301825471F, + 0.6306460966F, 0.6311094683F, 0.6315726617F, 0.6320356761F, + 0.6324985111F, 0.6329611662F, 0.6334236410F, 0.6338859348F, + 0.6343480472F, 0.6348099777F, 0.6352717257F, 0.6357332909F, + 0.6361946726F, 0.6366558704F, 0.6371168837F, 0.6375777122F, + 0.6380383552F, 0.6384988123F, 0.6389590830F, 0.6394191668F, + 0.6398790631F, 0.6403387716F, 0.6407982916F, 0.6412576228F, + 0.6417167645F, 0.6421757163F, 0.6426344778F, 0.6430930483F, + 0.6435514275F, 0.6440096149F, 0.6444676098F, 0.6449254119F, + 0.6453830207F, 0.6458404356F, 0.6462976562F, 0.6467546820F, + 0.6472115125F, 0.6476681472F, 0.6481245856F, 0.6485808273F, + 0.6490368717F, 0.6494927183F, 0.6499483667F, 0.6504038164F, + 0.6508590670F, 0.6513141178F, 0.6517689684F, 0.6522236185F, + 0.6526780673F, 0.6531323146F, 0.6535863598F, 0.6540402024F, + 0.6544938419F, 0.6549472779F, 0.6554005099F, 0.6558535373F, + 0.6563063598F, 0.6567589769F, 0.6572113880F, 0.6576635927F, + 0.6581155906F, 0.6585673810F, 0.6590189637F, 0.6594703380F, + 0.6599215035F, 0.6603724598F, 0.6608232064F, 0.6612737427F, + 0.6617240684F, 0.6621741829F, 0.6626240859F, 0.6630737767F, + 0.6635232550F, 0.6639725202F, 0.6644215720F, 0.6648704098F, + 0.6653190332F, 0.6657674417F, 0.6662156348F, 0.6666636121F, + 0.6671113731F, 0.6675589174F, 0.6680062445F, 0.6684533538F, + 0.6689002450F, 0.6693469177F, 0.6697933712F, 0.6702396052F, + 0.6706856193F, 0.6711314129F, 0.6715769855F, 0.6720223369F, + 0.6724674664F, 0.6729123736F, 0.6733570581F, 0.6738015194F, + 0.6742457570F, 0.6746897706F, 0.6751335596F, 0.6755771236F, + 0.6760204621F, 0.6764635747F, 0.6769064609F, 0.6773491204F, + 0.6777915525F, 0.6782337570F, 0.6786757332F, 0.6791174809F, + 0.6795589995F, 0.6800002886F, 0.6804413477F, 0.6808821765F, + 0.6813227743F, 0.6817631409F, 0.6822032758F, 0.6826431785F, + 0.6830828485F, 0.6835222855F, 0.6839614890F, 0.6844004585F, + 0.6848391936F, 0.6852776939F, 0.6857159589F, 0.6861539883F, + 0.6865917815F, 0.6870293381F, 0.6874666576F, 0.6879037398F, + 0.6883405840F, 0.6887771899F, 0.6892135571F, 0.6896496850F, + 0.6900855733F, 0.6905212216F, 0.6909566294F, 0.6913917963F, + 0.6918267218F, 0.6922614055F, 0.6926958471F, 0.6931300459F, + 0.6935640018F, 0.6939977141F, 0.6944311825F, 0.6948644066F, + 0.6952973859F, 0.6957301200F, 0.6961626085F, 0.6965948510F, + 0.6970268470F, 0.6974585961F, 0.6978900980F, 0.6983213521F, + 0.6987523580F, 0.6991831154F, 0.6996136238F, 0.7000438828F, + 0.7004738921F, 0.7009036510F, 0.7013331594F, 0.7017624166F, + 0.7021914224F, 0.7026201763F, 0.7030486779F, 0.7034769268F, + 0.7039049226F, 0.7043326648F, 0.7047601531F, 0.7051873870F, + 0.7056143662F, 0.7060410902F, 0.7064675586F, 0.7068937711F, + 0.7073197271F, 0.7077454264F, 0.7081708684F, 0.7085960529F, + 0.7090209793F, 0.7094456474F, 0.7098700566F, 0.7102942066F, + 0.7107180970F, 0.7111417274F, 0.7115650974F, 0.7119882066F, + 0.7124110545F, 0.7128336409F, 0.7132559653F, 0.7136780272F, + 0.7140998264F, 0.7145213624F, 0.7149426348F, 0.7153636433F, + 0.7157843874F, 0.7162048668F, 0.7166250810F, 0.7170450296F, + 0.7174647124F, 0.7178841289F, 0.7183032786F, 0.7187221613F, + 0.7191407765F, 0.7195591239F, 0.7199772030F, 0.7203950135F, + 0.7208125550F, 0.7212298271F, 0.7216468294F, 0.7220635616F, + 0.7224800233F, 0.7228962140F, 0.7233121335F, 0.7237277813F, + 0.7241431571F, 0.7245582604F, 0.7249730910F, 0.7253876484F, + 0.7258019322F, 0.7262159422F, 0.7266296778F, 0.7270431388F, + 0.7274563247F, 0.7278692353F, 0.7282818700F, 0.7286942287F, + 0.7291063108F, 0.7295181160F, 0.7299296440F, 0.7303408944F, + 0.7307518669F, 0.7311625609F, 0.7315729763F, 0.7319831126F, + 0.7323929695F, 0.7328025466F, 0.7332118435F, 0.7336208600F, + 0.7340295955F, 0.7344380499F, 0.7348462226F, 0.7352541134F, + 0.7356617220F, 0.7360690478F, 0.7364760907F, 0.7368828502F, + 0.7372893259F, 0.7376955176F, 0.7381014249F, 0.7385070475F, + 0.7389123849F, 0.7393174368F, 0.7397222029F, 0.7401266829F, + 0.7405308763F, 0.7409347829F, 0.7413384023F, 0.7417417341F, + 0.7421447780F, 0.7425475338F, 0.7429500009F, 0.7433521791F, + 0.7437540681F, 0.7441556674F, 0.7445569769F, 0.7449579960F, + 0.7453587245F, 0.7457591621F, 0.7461593084F, 0.7465591631F, + 0.7469587259F, 0.7473579963F, 0.7477569741F, 0.7481556590F, + 0.7485540506F, 0.7489521486F, 0.7493499526F, 0.7497474623F, + 0.7501446775F, 0.7505415977F, 0.7509382227F, 0.7513345521F, + 0.7517305856F, 0.7521263229F, 0.7525217636F, 0.7529169074F, + 0.7533117541F, 0.7537063032F, 0.7541005545F, 0.7544945076F, + 0.7548881623F, 0.7552815182F, 0.7556745749F, 0.7560673323F, + 0.7564597899F, 0.7568519474F, 0.7572438046F, 0.7576353611F, + 0.7580266166F, 0.7584175708F, 0.7588082235F, 0.7591985741F, + 0.7595886226F, 0.7599783685F, 0.7603678116F, 0.7607569515F, + 0.7611457879F, 0.7615343206F, 0.7619225493F, 0.7623104735F, + 0.7626980931F, 0.7630854078F, 0.7634724171F, 0.7638591209F, + 0.7642455188F, 0.7646316106F, 0.7650173959F, 0.7654028744F, + 0.7657880459F, 0.7661729100F, 0.7665574664F, 0.7669417150F, + 0.7673256553F, 0.7677092871F, 0.7680926100F, 0.7684756239F, + 0.7688583284F, 0.7692407232F, 0.7696228080F, 0.7700045826F, + 0.7703860467F, 0.7707671999F, 0.7711480420F, 0.7715285728F, + 0.7719087918F, 0.7722886989F, 0.7726682938F, 0.7730475762F, + 0.7734265458F, 0.7738052023F, 0.7741835454F, 0.7745615750F, + 0.7749392906F, 0.7753166921F, 0.7756937791F, 0.7760705514F, + 0.7764470087F, 0.7768231508F, 0.7771989773F, 0.7775744880F, + 0.7779496827F, 0.7783245610F, 0.7786991227F, 0.7790733676F, + 0.7794472953F, 0.7798209056F, 0.7801941982F, 0.7805671729F, + 0.7809398294F, 0.7813121675F, 0.7816841869F, 0.7820558873F, + 0.7824272684F, 0.7827983301F, 0.7831690720F, 0.7835394940F, + 0.7839095957F, 0.7842793768F, 0.7846488373F, 0.7850179767F, + 0.7853867948F, 0.7857552914F, 0.7861234663F, 0.7864913191F, + 0.7868588497F, 0.7872260578F, 0.7875929431F, 0.7879595055F, + 0.7883257445F, 0.7886916601F, 0.7890572520F, 0.7894225198F, + 0.7897874635F, 0.7901520827F, 0.7905163772F, 0.7908803468F, + 0.7912439912F, 0.7916073102F, 0.7919703035F, 0.7923329710F, + 0.7926953124F, 0.7930573274F, 0.7934190158F, 0.7937803774F, + 0.7941414120F, 0.7945021193F, 0.7948624991F, 0.7952225511F, + 0.7955822752F, 0.7959416711F, 0.7963007387F, 0.7966594775F, + 0.7970178875F, 0.7973759685F, 0.7977337201F, 0.7980911422F, + 0.7984482346F, 0.7988049970F, 0.7991614292F, 0.7995175310F, + 0.7998733022F, 0.8002287426F, 0.8005838519F, 0.8009386299F, + 0.8012930765F, 0.8016471914F, 0.8020009744F, 0.8023544253F, + 0.8027075438F, 0.8030603298F, 0.8034127831F, 0.8037649035F, + 0.8041166906F, 0.8044681445F, 0.8048192647F, 0.8051700512F, + 0.8055205038F, 0.8058706222F, 0.8062204062F, 0.8065698556F, + 0.8069189702F, 0.8072677499F, 0.8076161944F, 0.8079643036F, + 0.8083120772F, 0.8086595151F, 0.8090066170F, 0.8093533827F, + 0.8096998122F, 0.8100459051F, 0.8103916613F, 0.8107370806F, + 0.8110821628F, 0.8114269077F, 0.8117713151F, 0.8121153849F, + 0.8124591169F, 0.8128025108F, 0.8131455666F, 0.8134882839F, + 0.8138306627F, 0.8141727027F, 0.8145144038F, 0.8148557658F, + 0.8151967886F, 0.8155374718F, 0.8158778154F, 0.8162178192F, + 0.8165574830F, 0.8168968067F, 0.8172357900F, 0.8175744328F, + 0.8179127349F, 0.8182506962F, 0.8185883164F, 0.8189255955F, + 0.8192625332F, 0.8195991295F, 0.8199353840F, 0.8202712967F, + 0.8206068673F, 0.8209420958F, 0.8212769820F, 0.8216115256F, + 0.8219457266F, 0.8222795848F, 0.8226131000F, 0.8229462721F, + 0.8232791009F, 0.8236115863F, 0.8239437280F, 0.8242755260F, + 0.8246069801F, 0.8249380901F, 0.8252688559F, 0.8255992774F, + 0.8259293544F, 0.8262590867F, 0.8265884741F, 0.8269175167F, + 0.8272462141F, 0.8275745663F, 0.8279025732F, 0.8282302344F, + 0.8285575501F, 0.8288845199F, 0.8292111437F, 0.8295374215F, + 0.8298633530F, 0.8301889382F, 0.8305141768F, 0.8308390688F, + 0.8311636141F, 0.8314878124F, 0.8318116637F, 0.8321351678F, + 0.8324583246F, 0.8327811340F, 0.8331035957F, 0.8334257098F, + 0.8337474761F, 0.8340688944F, 0.8343899647F, 0.8347106867F, + 0.8350310605F, 0.8353510857F, 0.8356707624F, 0.8359900904F, + 0.8363090696F, 0.8366276999F, 0.8369459811F, 0.8372639131F, + 0.8375814958F, 0.8378987292F, 0.8382156130F, 0.8385321472F, + 0.8388483316F, 0.8391641662F, 0.8394796508F, 0.8397947853F, + 0.8401095697F, 0.8404240037F, 0.8407380873F, 0.8410518204F, + 0.8413652029F, 0.8416782347F, 0.8419909156F, 0.8423032456F, + 0.8426152245F, 0.8429268523F, 0.8432381289F, 0.8435490541F, + 0.8438596279F, 0.8441698502F, 0.8444797208F, 0.8447892396F, + 0.8450984067F, 0.8454072218F, 0.8457156849F, 0.8460237959F, + 0.8463315547F, 0.8466389612F, 0.8469460154F, 0.8472527170F, + 0.8475590661F, 0.8478650625F, 0.8481707063F, 0.8484759971F, + 0.8487809351F, 0.8490855201F, 0.8493897521F, 0.8496936308F, + 0.8499971564F, 0.8503003286F, 0.8506031474F, 0.8509056128F, + 0.8512077246F, 0.8515094828F, 0.8518108872F, 0.8521119379F, + 0.8524126348F, 0.8527129777F, 0.8530129666F, 0.8533126015F, + 0.8536118822F, 0.8539108087F, 0.8542093809F, 0.8545075988F, + 0.8548054623F, 0.8551029712F, 0.8554001257F, 0.8556969255F, + 0.8559933707F, 0.8562894611F, 0.8565851968F, 0.8568805775F, + 0.8571756034F, 0.8574702743F, 0.8577645902F, 0.8580585509F, + 0.8583521566F, 0.8586454070F, 0.8589383021F, 0.8592308420F, + 0.8595230265F, 0.8598148556F, 0.8601063292F, 0.8603974473F, + 0.8606882098F, 0.8609786167F, 0.8612686680F, 0.8615583636F, + 0.8618477034F, 0.8621366874F, 0.8624253156F, 0.8627135878F, + 0.8630015042F, 0.8632890646F, 0.8635762690F, 0.8638631173F, + 0.8641496096F, 0.8644357457F, 0.8647215257F, 0.8650069495F, + 0.8652920171F, 0.8655767283F, 0.8658610833F, 0.8661450820F, + 0.8664287243F, 0.8667120102F, 0.8669949397F, 0.8672775127F, + 0.8675597293F, 0.8678415894F, 0.8681230929F, 0.8684042398F, + 0.8686850302F, 0.8689654640F, 0.8692455412F, 0.8695252617F, + 0.8698046255F, 0.8700836327F, 0.8703622831F, 0.8706405768F, + 0.8709185138F, 0.8711960940F, 0.8714733174F, 0.8717501840F, + 0.8720266939F, 0.8723028469F, 0.8725786430F, 0.8728540824F, + 0.8731291648F, 0.8734038905F, 0.8736782592F, 0.8739522711F, + 0.8742259261F, 0.8744992242F, 0.8747721653F, 0.8750447496F, + 0.8753169770F, 0.8755888475F, 0.8758603611F, 0.8761315177F, + 0.8764023175F, 0.8766727603F, 0.8769428462F, 0.8772125752F, + 0.8774819474F, 0.8777509626F, 0.8780196209F, 0.8782879224F, + 0.8785558669F, 0.8788234546F, 0.8790906854F, 0.8793575594F, + 0.8796240765F, 0.8798902368F, 0.8801560403F, 0.8804214870F, + 0.8806865768F, 0.8809513099F, 0.8812156863F, 0.8814797059F, + 0.8817433687F, 0.8820066749F, 0.8822696243F, 0.8825322171F, + 0.8827944532F, 0.8830563327F, 0.8833178556F, 0.8835790219F, + 0.8838398316F, 0.8841002848F, 0.8843603815F, 0.8846201217F, + 0.8848795054F, 0.8851385327F, 0.8853972036F, 0.8856555182F, + 0.8859134764F, 0.8861710783F, 0.8864283239F, 0.8866852133F, + 0.8869417464F, 0.8871979234F, 0.8874537443F, 0.8877092090F, + 0.8879643177F, 0.8882190704F, 0.8884734671F, 0.8887275078F, + 0.8889811927F, 0.8892345216F, 0.8894874948F, 0.8897401122F, + 0.8899923738F, 0.8902442798F, 0.8904958301F, 0.8907470248F, + 0.8909978640F, 0.8912483477F, 0.8914984759F, 0.8917482487F, + 0.8919976662F, 0.8922467284F, 0.8924954353F, 0.8927437871F, + 0.8929917837F, 0.8932394252F, 0.8934867118F, 0.8937336433F, + 0.8939802199F, 0.8942264417F, 0.8944723087F, 0.8947178210F, + 0.8949629785F, 0.8952077815F, 0.8954522299F, 0.8956963239F, + 0.8959400634F, 0.8961834486F, 0.8964264795F, 0.8966691561F, + 0.8969114786F, 0.8971534470F, 0.8973950614F, 0.8976363219F, + 0.8978772284F, 0.8981177812F, 0.8983579802F, 0.8985978256F, + 0.8988373174F, 0.8990764556F, 0.8993152405F, 0.8995536720F, + 0.8997917502F, 0.9000294751F, 0.9002668470F, 0.9005038658F, + 0.9007405317F, 0.9009768446F, 0.9012128048F, 0.9014484123F, + 0.9016836671F, 0.9019185693F, 0.9021531191F, 0.9023873165F, + 0.9026211616F, 0.9028546546F, 0.9030877954F, 0.9033205841F, + 0.9035530210F, 0.9037851059F, 0.9040168392F, 0.9042482207F, + 0.9044792507F, 0.9047099293F, 0.9049402564F, 0.9051702323F, + 0.9053998569F, 0.9056291305F, 0.9058580531F, 0.9060866248F, + 0.9063148457F, 0.9065427159F, 0.9067702355F, 0.9069974046F, + 0.9072242233F, 0.9074506917F, 0.9076768100F, 0.9079025782F, + 0.9081279964F, 0.9083530647F, 0.9085777833F, 0.9088021523F, + 0.9090261717F, 0.9092498417F, 0.9094731623F, 0.9096961338F, + 0.9099187561F, 0.9101410295F, 0.9103629540F, 0.9105845297F, + 0.9108057568F, 0.9110266354F, 0.9112471656F, 0.9114673475F, + 0.9116871812F, 0.9119066668F, 0.9121258046F, 0.9123445945F, + 0.9125630367F, 0.9127811314F, 0.9129988786F, 0.9132162785F, + 0.9134333312F, 0.9136500368F, 0.9138663954F, 0.9140824073F, + 0.9142980724F, 0.9145133910F, 0.9147283632F, 0.9149429890F, + 0.9151572687F, 0.9153712023F, 0.9155847900F, 0.9157980319F, + 0.9160109282F, 0.9162234790F, 0.9164356844F, 0.9166475445F, + 0.9168590595F, 0.9170702296F, 0.9172810548F, 0.9174915354F, + 0.9177016714F, 0.9179114629F, 0.9181209102F, 0.9183300134F, + 0.9185387726F, 0.9187471879F, 0.9189552595F, 0.9191629876F, + 0.9193703723F, 0.9195774136F, 0.9197841119F, 0.9199904672F, + 0.9201964797F, 0.9204021495F, 0.9206074767F, 0.9208124616F, + 0.9210171043F, 0.9212214049F, 0.9214253636F, 0.9216289805F, + 0.9218322558F, 0.9220351896F, 0.9222377821F, 0.9224400335F, + 0.9226419439F, 0.9228435134F, 0.9230447423F, 0.9232456307F, + 0.9234461787F, 0.9236463865F, 0.9238462543F, 0.9240457822F, + 0.9242449704F, 0.9244438190F, 0.9246423282F, 0.9248404983F, + 0.9250383293F, 0.9252358214F, 0.9254329747F, 0.9256297896F, + 0.9258262660F, 0.9260224042F, 0.9262182044F, 0.9264136667F, + 0.9266087913F, 0.9268035783F, 0.9269980280F, 0.9271921405F, + 0.9273859160F, 0.9275793546F, 0.9277724566F, 0.9279652221F, + 0.9281576513F, 0.9283497443F, 0.9285415014F, 0.9287329227F, + 0.9289240084F, 0.9291147586F, 0.9293051737F, 0.9294952536F, + 0.9296849987F, 0.9298744091F, 0.9300634850F, 0.9302522266F, + 0.9304406340F, 0.9306287074F, 0.9308164471F, 0.9310038532F, + 0.9311909259F, 0.9313776654F, 0.9315640719F, 0.9317501455F, + 0.9319358865F, 0.9321212951F, 0.9323063713F, 0.9324911155F, + 0.9326755279F, 0.9328596085F, 0.9330433577F, 0.9332267756F, + 0.9334098623F, 0.9335926182F, 0.9337750434F, 0.9339571380F, + 0.9341389023F, 0.9343203366F, 0.9345014409F, 0.9346822155F, + 0.9348626606F, 0.9350427763F, 0.9352225630F, 0.9354020207F, + 0.9355811498F, 0.9357599503F, 0.9359384226F, 0.9361165667F, + 0.9362943830F, 0.9364718716F, 0.9366490327F, 0.9368258666F, + 0.9370023733F, 0.9371785533F, 0.9373544066F, 0.9375299335F, + 0.9377051341F, 0.9378800087F, 0.9380545576F, 0.9382287809F, + 0.9384026787F, 0.9385762515F, 0.9387494993F, 0.9389224223F, + 0.9390950209F, 0.9392672951F, 0.9394392453F, 0.9396108716F, + 0.9397821743F, 0.9399531536F, 0.9401238096F, 0.9402941427F, + 0.9404641530F, 0.9406338407F, 0.9408032061F, 0.9409722495F, + 0.9411409709F, 0.9413093707F, 0.9414774491F, 0.9416452062F, + 0.9418126424F, 0.9419797579F, 0.9421465528F, 0.9423130274F, + 0.9424791819F, 0.9426450166F, 0.9428105317F, 0.9429757274F, + 0.9431406039F, 0.9433051616F, 0.9434694005F, 0.9436333209F, + 0.9437969232F, 0.9439602074F, 0.9441231739F, 0.9442858229F, + 0.9444481545F, 0.9446101691F, 0.9447718669F, 0.9449332481F, + 0.9450943129F, 0.9452550617F, 0.9454154945F, 0.9455756118F, + 0.9457354136F, 0.9458949003F, 0.9460540721F, 0.9462129292F, + 0.9463714719F, 0.9465297003F, 0.9466876149F, 0.9468452157F, + 0.9470025031F, 0.9471594772F, 0.9473161384F, 0.9474724869F, + 0.9476285229F, 0.9477842466F, 0.9479396584F, 0.9480947585F, + 0.9482495470F, 0.9484040243F, 0.9485581906F, 0.9487120462F, + 0.9488655913F, 0.9490188262F, 0.9491717511F, 0.9493243662F, + 0.9494766718F, 0.9496286683F, 0.9497803557F, 0.9499317345F, + 0.9500828047F, 0.9502335668F, 0.9503840209F, 0.9505341673F, + 0.9506840062F, 0.9508335380F, 0.9509827629F, 0.9511316810F, + 0.9512802928F, 0.9514285984F, 0.9515765982F, 0.9517242923F, + 0.9518716810F, 0.9520187646F, 0.9521655434F, 0.9523120176F, + 0.9524581875F, 0.9526040534F, 0.9527496154F, 0.9528948739F, + 0.9530398292F, 0.9531844814F, 0.9533288310F, 0.9534728780F, + 0.9536166229F, 0.9537600659F, 0.9539032071F, 0.9540460470F, + 0.9541885858F, 0.9543308237F, 0.9544727611F, 0.9546143981F, + 0.9547557351F, 0.9548967723F, 0.9550375100F, 0.9551779485F, + 0.9553180881F, 0.9554579290F, 0.9555974714F, 0.9557367158F, + 0.9558756623F, 0.9560143112F, 0.9561526628F, 0.9562907174F, + 0.9564284752F, 0.9565659366F, 0.9567031017F, 0.9568399710F, + 0.9569765446F, 0.9571128229F, 0.9572488061F, 0.9573844944F, + 0.9575198883F, 0.9576549879F, 0.9577897936F, 0.9579243056F, + 0.9580585242F, 0.9581924497F, 0.9583260824F, 0.9584594226F, + 0.9585924705F, 0.9587252264F, 0.9588576906F, 0.9589898634F, + 0.9591217452F, 0.9592533360F, 0.9593846364F, 0.9595156465F, + 0.9596463666F, 0.9597767971F, 0.9599069382F, 0.9600367901F, + 0.9601663533F, 0.9602956279F, 0.9604246143F, 0.9605533128F, + 0.9606817236F, 0.9608098471F, 0.9609376835F, 0.9610652332F, + 0.9611924963F, 0.9613194733F, 0.9614461644F, 0.9615725699F, + 0.9616986901F, 0.9618245253F, 0.9619500757F, 0.9620753418F, + 0.9622003238F, 0.9623250219F, 0.9624494365F, 0.9625735679F, + 0.9626974163F, 0.9628209821F, 0.9629442656F, 0.9630672671F, + 0.9631899868F, 0.9633124251F, 0.9634345822F, 0.9635564585F, + 0.9636780543F, 0.9637993699F, 0.9639204056F, 0.9640411616F, + 0.9641616383F, 0.9642818359F, 0.9644017549F, 0.9645213955F, + 0.9646407579F, 0.9647598426F, 0.9648786497F, 0.9649971797F, + 0.9651154328F, 0.9652334092F, 0.9653511095F, 0.9654685337F, + 0.9655856823F, 0.9657025556F, 0.9658191538F, 0.9659354773F, + 0.9660515263F, 0.9661673013F, 0.9662828024F, 0.9663980300F, + 0.9665129845F, 0.9666276660F, 0.9667420750F, 0.9668562118F, + 0.9669700766F, 0.9670836698F, 0.9671969917F, 0.9673100425F, + 0.9674228227F, 0.9675353325F, 0.9676475722F, 0.9677595422F, + 0.9678712428F, 0.9679826742F, 0.9680938368F, 0.9682047309F, + 0.9683153569F, 0.9684257150F, 0.9685358056F, 0.9686456289F, + 0.9687551853F, 0.9688644752F, 0.9689734987F, 0.9690822564F, + 0.9691907483F, 0.9692989750F, 0.9694069367F, 0.9695146337F, + 0.9696220663F, 0.9697292349F, 0.9698361398F, 0.9699427813F, + 0.9700491597F, 0.9701552754F, 0.9702611286F, 0.9703667197F, + 0.9704720490F, 0.9705771169F, 0.9706819236F, 0.9707864695F, + 0.9708907549F, 0.9709947802F, 0.9710985456F, 0.9712020514F, + 0.9713052981F, 0.9714082859F, 0.9715110151F, 0.9716134862F, + 0.9717156993F, 0.9718176549F, 0.9719193532F, 0.9720207946F, + 0.9721219794F, 0.9722229080F, 0.9723235806F, 0.9724239976F, + 0.9725241593F, 0.9726240661F, 0.9727237183F, 0.9728231161F, + 0.9729222601F, 0.9730211503F, 0.9731197873F, 0.9732181713F, + 0.9733163027F, 0.9734141817F, 0.9735118088F, 0.9736091842F, + 0.9737063083F, 0.9738031814F, 0.9738998039F, 0.9739961760F, + 0.9740922981F, 0.9741881706F, 0.9742837938F, 0.9743791680F, + 0.9744742935F, 0.9745691707F, 0.9746637999F, 0.9747581814F, + 0.9748523157F, 0.9749462029F, 0.9750398435F, 0.9751332378F, + 0.9752263861F, 0.9753192887F, 0.9754119461F, 0.9755043585F, + 0.9755965262F, 0.9756884496F, 0.9757801291F, 0.9758715650F, + 0.9759627575F, 0.9760537071F, 0.9761444141F, 0.9762348789F, + 0.9763251016F, 0.9764150828F, 0.9765048228F, 0.9765943218F, + 0.9766835802F, 0.9767725984F, 0.9768613767F, 0.9769499154F, + 0.9770382149F, 0.9771262755F, 0.9772140976F, 0.9773016815F, + 0.9773890275F, 0.9774761360F, 0.9775630073F, 0.9776496418F, + 0.9777360398F, 0.9778222016F, 0.9779081277F, 0.9779938182F, + 0.9780792736F, 0.9781644943F, 0.9782494805F, 0.9783342326F, + 0.9784187509F, 0.9785030359F, 0.9785870877F, 0.9786709069F, + 0.9787544936F, 0.9788378484F, 0.9789209714F, 0.9790038631F, + 0.9790865238F, 0.9791689538F, 0.9792511535F, 0.9793331232F, + 0.9794148633F, 0.9794963742F, 0.9795776561F, 0.9796587094F, + 0.9797395345F, 0.9798201316F, 0.9799005013F, 0.9799806437F, + 0.9800605593F, 0.9801402483F, 0.9802197112F, 0.9802989483F, + 0.9803779600F, 0.9804567465F, 0.9805353082F, 0.9806136455F, + 0.9806917587F, 0.9807696482F, 0.9808473143F, 0.9809247574F, + 0.9810019778F, 0.9810789759F, 0.9811557519F, 0.9812323064F, + 0.9813086395F, 0.9813847517F, 0.9814606433F, 0.9815363147F, + 0.9816117662F, 0.9816869981F, 0.9817620108F, 0.9818368047F, + 0.9819113801F, 0.9819857374F, 0.9820598769F, 0.9821337989F, + 0.9822075038F, 0.9822809920F, 0.9823542638F, 0.9824273195F, + 0.9825001596F, 0.9825727843F, 0.9826451940F, 0.9827173891F, + 0.9827893700F, 0.9828611368F, 0.9829326901F, 0.9830040302F, + 0.9830751574F, 0.9831460720F, 0.9832167745F, 0.9832872652F, + 0.9833575444F, 0.9834276124F, 0.9834974697F, 0.9835671166F, + 0.9836365535F, 0.9837057806F, 0.9837747983F, 0.9838436071F, + 0.9839122072F, 0.9839805990F, 0.9840487829F, 0.9841167591F, + 0.9841845282F, 0.9842520903F, 0.9843194459F, 0.9843865953F, + 0.9844535389F, 0.9845202771F, 0.9845868101F, 0.9846531383F, + 0.9847192622F, 0.9847851820F, 0.9848508980F, 0.9849164108F, + 0.9849817205F, 0.9850468276F, 0.9851117324F, 0.9851764352F, + 0.9852409365F, 0.9853052366F, 0.9853693358F, 0.9854332344F, + 0.9854969330F, 0.9855604317F, 0.9856237309F, 0.9856868310F, + 0.9857497325F, 0.9858124355F, 0.9858749404F, 0.9859372477F, + 0.9859993577F, 0.9860612707F, 0.9861229871F, 0.9861845072F, + 0.9862458315F, 0.9863069601F, 0.9863678936F, 0.9864286322F, + 0.9864891764F, 0.9865495264F, 0.9866096826F, 0.9866696454F, + 0.9867294152F, 0.9867889922F, 0.9868483769F, 0.9869075695F, + 0.9869665706F, 0.9870253803F, 0.9870839991F, 0.9871424273F, + 0.9872006653F, 0.9872587135F, 0.9873165721F, 0.9873742415F, + 0.9874317222F, 0.9874890144F, 0.9875461185F, 0.9876030348F, + 0.9876597638F, 0.9877163057F, 0.9877726610F, 0.9878288300F, + 0.9878848130F, 0.9879406104F, 0.9879962225F, 0.9880516497F, + 0.9881068924F, 0.9881619509F, 0.9882168256F, 0.9882715168F, + 0.9883260249F, 0.9883803502F, 0.9884344931F, 0.9884884539F, + 0.9885422331F, 0.9885958309F, 0.9886492477F, 0.9887024838F, + 0.9887555397F, 0.9888084157F, 0.9888611120F, 0.9889136292F, + 0.9889659675F, 0.9890181273F, 0.9890701089F, 0.9891219128F, + 0.9891735392F, 0.9892249885F, 0.9892762610F, 0.9893273572F, + 0.9893782774F, 0.9894290219F, 0.9894795911F, 0.9895299853F, + 0.9895802049F, 0.9896302502F, 0.9896801217F, 0.9897298196F, + 0.9897793443F, 0.9898286961F, 0.9898778755F, 0.9899268828F, + 0.9899757183F, 0.9900243823F, 0.9900728753F, 0.9901211976F, + 0.9901693495F, 0.9902173314F, 0.9902651436F, 0.9903127865F, + 0.9903602605F, 0.9904075659F, 0.9904547031F, 0.9905016723F, + 0.9905484740F, 0.9905951086F, 0.9906415763F, 0.9906878775F, + 0.9907340126F, 0.9907799819F, 0.9908257858F, 0.9908714247F, + 0.9909168988F, 0.9909622086F, 0.9910073543F, 0.9910523364F, + 0.9910971552F, 0.9911418110F, 0.9911863042F, 0.9912306351F, + 0.9912748042F, 0.9913188117F, 0.9913626580F, 0.9914063435F, + 0.9914498684F, 0.9914932333F, 0.9915364383F, 0.9915794839F, + 0.9916223703F, 0.9916650981F, 0.9917076674F, 0.9917500787F, + 0.9917923323F, 0.9918344286F, 0.9918763679F, 0.9919181505F, + 0.9919597769F, 0.9920012473F, 0.9920425621F, 0.9920837217F, + 0.9921247263F, 0.9921655765F, 0.9922062724F, 0.9922468145F, + 0.9922872030F, 0.9923274385F, 0.9923675211F, 0.9924074513F, + 0.9924472294F, 0.9924868557F, 0.9925263306F, 0.9925656544F, + 0.9926048275F, 0.9926438503F, 0.9926827230F, 0.9927214461F, + 0.9927600199F, 0.9927984446F, 0.9928367208F, 0.9928748486F, + 0.9929128285F, 0.9929506608F, 0.9929883459F, 0.9930258841F, + 0.9930632757F, 0.9931005211F, 0.9931376207F, 0.9931745747F, + 0.9932113836F, 0.9932480476F, 0.9932845671F, 0.9933209425F, + 0.9933571742F, 0.9933932623F, 0.9934292074F, 0.9934650097F, + 0.9935006696F, 0.9935361874F, 0.9935715635F, 0.9936067982F, + 0.9936418919F, 0.9936768448F, 0.9937116574F, 0.9937463300F, + 0.9937808629F, 0.9938152565F, 0.9938495111F, 0.9938836271F, + 0.9939176047F, 0.9939514444F, 0.9939851465F, 0.9940187112F, + 0.9940521391F, 0.9940854303F, 0.9941185853F, 0.9941516044F, + 0.9941844879F, 0.9942172361F, 0.9942498495F, 0.9942823283F, + 0.9943146729F, 0.9943468836F, 0.9943789608F, 0.9944109047F, + 0.9944427158F, 0.9944743944F, 0.9945059408F, 0.9945373553F, + 0.9945686384F, 0.9945997902F, 0.9946308112F, 0.9946617017F, + 0.9946924621F, 0.9947230926F, 0.9947535937F, 0.9947839656F, + 0.9948142086F, 0.9948443232F, 0.9948743097F, 0.9949041683F, + 0.9949338995F, 0.9949635035F, 0.9949929807F, 0.9950223315F, + 0.9950515561F, 0.9950806549F, 0.9951096282F, 0.9951384764F, + 0.9951671998F, 0.9951957987F, 0.9952242735F, 0.9952526245F, + 0.9952808520F, 0.9953089564F, 0.9953369380F, 0.9953647971F, + 0.9953925340F, 0.9954201491F, 0.9954476428F, 0.9954750153F, + 0.9955022670F, 0.9955293981F, 0.9955564092F, 0.9955833003F, + 0.9956100720F, 0.9956367245F, 0.9956632582F, 0.9956896733F, + 0.9957159703F, 0.9957421494F, 0.9957682110F, 0.9957941553F, + 0.9958199828F, 0.9958456937F, 0.9958712884F, 0.9958967672F, + 0.9959221305F, 0.9959473784F, 0.9959725115F, 0.9959975300F, + 0.9960224342F, 0.9960472244F, 0.9960719011F, 0.9960964644F, + 0.9961209148F, 0.9961452525F, 0.9961694779F, 0.9961935913F, + 0.9962175930F, 0.9962414834F, 0.9962652627F, 0.9962889313F, + 0.9963124895F, 0.9963359377F, 0.9963592761F, 0.9963825051F, + 0.9964056250F, 0.9964286361F, 0.9964515387F, 0.9964743332F, + 0.9964970198F, 0.9965195990F, 0.9965420709F, 0.9965644360F, + 0.9965866946F, 0.9966088469F, 0.9966308932F, 0.9966528340F, + 0.9966746695F, 0.9966964001F, 0.9967180260F, 0.9967395475F, + 0.9967609651F, 0.9967822789F, 0.9968034894F, 0.9968245968F, + 0.9968456014F, 0.9968665036F, 0.9968873037F, 0.9969080019F, + 0.9969285987F, 0.9969490942F, 0.9969694889F, 0.9969897830F, + 0.9970099769F, 0.9970300708F, 0.9970500651F, 0.9970699601F, + 0.9970897561F, 0.9971094533F, 0.9971290522F, 0.9971485531F, + 0.9971679561F, 0.9971872617F, 0.9972064702F, 0.9972255818F, + 0.9972445968F, 0.9972635157F, 0.9972823386F, 0.9973010659F, + 0.9973196980F, 0.9973382350F, 0.9973566773F, 0.9973750253F, + 0.9973932791F, 0.9974114392F, 0.9974295059F, 0.9974474793F, + 0.9974653599F, 0.9974831480F, 0.9975008438F, 0.9975184476F, + 0.9975359598F, 0.9975533806F, 0.9975707104F, 0.9975879495F, + 0.9976050981F, 0.9976221566F, 0.9976391252F, 0.9976560043F, + 0.9976727941F, 0.9976894950F, 0.9977061073F, 0.9977226312F, + 0.9977390671F, 0.9977554152F, 0.9977716759F, 0.9977878495F, + 0.9978039361F, 0.9978199363F, 0.9978358501F, 0.9978516780F, + 0.9978674202F, 0.9978830771F, 0.9978986488F, 0.9979141358F, + 0.9979295383F, 0.9979448566F, 0.9979600909F, 0.9979752417F, + 0.9979903091F, 0.9980052936F, 0.9980201952F, 0.9980350145F, + 0.9980497515F, 0.9980644067F, 0.9980789804F, 0.9980934727F, + 0.9981078841F, 0.9981222147F, 0.9981364649F, 0.9981506350F, + 0.9981647253F, 0.9981787360F, 0.9981926674F, 0.9982065199F, + 0.9982202936F, 0.9982339890F, 0.9982476062F, 0.9982611456F, + 0.9982746074F, 0.9982879920F, 0.9983012996F, 0.9983145304F, + 0.9983276849F, 0.9983407632F, 0.9983537657F, 0.9983666926F, + 0.9983795442F, 0.9983923208F, 0.9984050226F, 0.9984176501F, + 0.9984302033F, 0.9984426827F, 0.9984550884F, 0.9984674208F, + 0.9984796802F, 0.9984918667F, 0.9985039808F, 0.9985160227F, + 0.9985279926F, 0.9985398909F, 0.9985517177F, 0.9985634734F, + 0.9985751583F, 0.9985867727F, 0.9985983167F, 0.9986097907F, + 0.9986211949F, 0.9986325297F, 0.9986437953F, 0.9986549919F, + 0.9986661199F, 0.9986771795F, 0.9986881710F, 0.9986990946F, + 0.9987099507F, 0.9987207394F, 0.9987314611F, 0.9987421161F, + 0.9987527045F, 0.9987632267F, 0.9987736829F, 0.9987840734F, + 0.9987943985F, 0.9988046584F, 0.9988148534F, 0.9988249838F, + 0.9988350498F, 0.9988450516F, 0.9988549897F, 0.9988648641F, + 0.9988746753F, 0.9988844233F, 0.9988941086F, 0.9989037313F, + 0.9989132918F, 0.9989227902F, 0.9989322269F, 0.9989416021F, + 0.9989509160F, 0.9989601690F, 0.9989693613F, 0.9989784931F, + 0.9989875647F, 0.9989965763F, 0.9990055283F, 0.9990144208F, + 0.9990232541F, 0.9990320286F, 0.9990407443F, 0.9990494016F, + 0.9990580008F, 0.9990665421F, 0.9990750257F, 0.9990834519F, + 0.9990918209F, 0.9991001331F, 0.9991083886F, 0.9991165877F, + 0.9991247307F, 0.9991328177F, 0.9991408491F, 0.9991488251F, + 0.9991567460F, 0.9991646119F, 0.9991724232F, 0.9991801801F, + 0.9991878828F, 0.9991955316F, 0.9992031267F, 0.9992106684F, + 0.9992181569F, 0.9992255925F, 0.9992329753F, 0.9992403057F, + 0.9992475839F, 0.9992548101F, 0.9992619846F, 0.9992691076F, + 0.9992761793F, 0.9992832001F, 0.9992901701F, 0.9992970895F, + 0.9993039587F, 0.9993107777F, 0.9993175470F, 0.9993242667F, + 0.9993309371F, 0.9993375583F, 0.9993441307F, 0.9993506545F, + 0.9993571298F, 0.9993635570F, 0.9993699362F, 0.9993762678F, + 0.9993825519F, 0.9993887887F, 0.9993949785F, 0.9994011216F, + 0.9994072181F, 0.9994132683F, 0.9994192725F, 0.9994252307F, + 0.9994311434F, 0.9994370107F, 0.9994428327F, 0.9994486099F, + 0.9994543423F, 0.9994600303F, 0.9994656739F, 0.9994712736F, + 0.9994768294F, 0.9994823417F, 0.9994878105F, 0.9994932363F, + 0.9994986191F, 0.9995039592F, 0.9995092568F, 0.9995145122F, + 0.9995197256F, 0.9995248971F, 0.9995300270F, 0.9995351156F, + 0.9995401630F, 0.9995451695F, 0.9995501352F, 0.9995550604F, + 0.9995599454F, 0.9995647903F, 0.9995695953F, 0.9995743607F, + 0.9995790866F, 0.9995837734F, 0.9995884211F, 0.9995930300F, + 0.9995976004F, 0.9996021324F, 0.9996066263F, 0.9996110822F, + 0.9996155004F, 0.9996198810F, 0.9996242244F, 0.9996285306F, + 0.9996327999F, 0.9996370326F, 0.9996412287F, 0.9996453886F, + 0.9996495125F, 0.9996536004F, 0.9996576527F, 0.9996616696F, + 0.9996656512F, 0.9996695977F, 0.9996735094F, 0.9996773865F, + 0.9996812291F, 0.9996850374F, 0.9996888118F, 0.9996925523F, + 0.9996962591F, 0.9996999325F, 0.9997035727F, 0.9997071798F, + 0.9997107541F, 0.9997142957F, 0.9997178049F, 0.9997212818F, + 0.9997247266F, 0.9997281396F, 0.9997315209F, 0.9997348708F, + 0.9997381893F, 0.9997414767F, 0.9997447333F, 0.9997479591F, + 0.9997511544F, 0.9997543194F, 0.9997574542F, 0.9997605591F, + 0.9997636342F, 0.9997666797F, 0.9997696958F, 0.9997726828F, + 0.9997756407F, 0.9997785698F, 0.9997814703F, 0.9997843423F, + 0.9997871860F, 0.9997900016F, 0.9997927894F, 0.9997955494F, + 0.9997982818F, 0.9998009869F, 0.9998036648F, 0.9998063157F, + 0.9998089398F, 0.9998115373F, 0.9998141082F, 0.9998166529F, + 0.9998191715F, 0.9998216642F, 0.9998241311F, 0.9998265724F, + 0.9998289884F, 0.9998313790F, 0.9998337447F, 0.9998360854F, + 0.9998384015F, 0.9998406930F, 0.9998429602F, 0.9998452031F, + 0.9998474221F, 0.9998496171F, 0.9998517885F, 0.9998539364F, + 0.9998560610F, 0.9998581624F, 0.9998602407F, 0.9998622962F, + 0.9998643291F, 0.9998663394F, 0.9998683274F, 0.9998702932F, + 0.9998722370F, 0.9998741589F, 0.9998760591F, 0.9998779378F, + 0.9998797952F, 0.9998816313F, 0.9998834464F, 0.9998852406F, + 0.9998870141F, 0.9998887670F, 0.9998904995F, 0.9998922117F, + 0.9998939039F, 0.9998955761F, 0.9998972285F, 0.9998988613F, + 0.9999004746F, 0.9999020686F, 0.9999036434F, 0.9999051992F, + 0.9999067362F, 0.9999082544F, 0.9999097541F, 0.9999112354F, + 0.9999126984F, 0.9999141433F, 0.9999155703F, 0.9999169794F, + 0.9999183709F, 0.9999197449F, 0.9999211014F, 0.9999224408F, + 0.9999237631F, 0.9999250684F, 0.9999263570F, 0.9999276289F, + 0.9999288843F, 0.9999301233F, 0.9999313461F, 0.9999325529F, + 0.9999337437F, 0.9999349187F, 0.9999360780F, 0.9999372218F, + 0.9999383503F, 0.9999394635F, 0.9999405616F, 0.9999416447F, + 0.9999427129F, 0.9999437665F, 0.9999448055F, 0.9999458301F, + 0.9999468404F, 0.9999478365F, 0.9999488185F, 0.9999497867F, + 0.9999507411F, 0.9999516819F, 0.9999526091F, 0.9999535230F, + 0.9999544236F, 0.9999553111F, 0.9999561856F, 0.9999570472F, + 0.9999578960F, 0.9999587323F, 0.9999595560F, 0.9999603674F, + 0.9999611666F, 0.9999619536F, 0.9999627286F, 0.9999634917F, + 0.9999642431F, 0.9999649828F, 0.9999657110F, 0.9999664278F, + 0.9999671334F, 0.9999678278F, 0.9999685111F, 0.9999691835F, + 0.9999698451F, 0.9999704960F, 0.9999711364F, 0.9999717662F, + 0.9999723858F, 0.9999729950F, 0.9999735942F, 0.9999741834F, + 0.9999747626F, 0.9999753321F, 0.9999758919F, 0.9999764421F, + 0.9999769828F, 0.9999775143F, 0.9999780364F, 0.9999785495F, + 0.9999790535F, 0.9999795485F, 0.9999800348F, 0.9999805124F, + 0.9999809813F, 0.9999814417F, 0.9999818938F, 0.9999823375F, + 0.9999827731F, 0.9999832005F, 0.9999836200F, 0.9999840316F, + 0.9999844353F, 0.9999848314F, 0.9999852199F, 0.9999856008F, + 0.9999859744F, 0.9999863407F, 0.9999866997F, 0.9999870516F, + 0.9999873965F, 0.9999877345F, 0.9999880656F, 0.9999883900F, + 0.9999887078F, 0.9999890190F, 0.9999893237F, 0.9999896220F, + 0.9999899140F, 0.9999901999F, 0.9999904796F, 0.9999907533F, + 0.9999910211F, 0.9999912830F, 0.9999915391F, 0.9999917896F, + 0.9999920345F, 0.9999922738F, 0.9999925077F, 0.9999927363F, + 0.9999929596F, 0.9999931777F, 0.9999933907F, 0.9999935987F, + 0.9999938018F, 0.9999940000F, 0.9999941934F, 0.9999943820F, + 0.9999945661F, 0.9999947456F, 0.9999949206F, 0.9999950912F, + 0.9999952575F, 0.9999954195F, 0.9999955773F, 0.9999957311F, + 0.9999958807F, 0.9999960265F, 0.9999961683F, 0.9999963063F, + 0.9999964405F, 0.9999965710F, 0.9999966979F, 0.9999968213F, + 0.9999969412F, 0.9999970576F, 0.9999971707F, 0.9999972805F, + 0.9999973871F, 0.9999974905F, 0.9999975909F, 0.9999976881F, + 0.9999977824F, 0.9999978738F, 0.9999979624F, 0.9999980481F, + 0.9999981311F, 0.9999982115F, 0.9999982892F, 0.9999983644F, + 0.9999984370F, 0.9999985072F, 0.9999985750F, 0.9999986405F, + 0.9999987037F, 0.9999987647F, 0.9999988235F, 0.9999988802F, + 0.9999989348F, 0.9999989873F, 0.9999990379F, 0.9999990866F, + 0.9999991334F, 0.9999991784F, 0.9999992217F, 0.9999992632F, + 0.9999993030F, 0.9999993411F, 0.9999993777F, 0.9999994128F, + 0.9999994463F, 0.9999994784F, 0.9999995091F, 0.9999995384F, + 0.9999995663F, 0.9999995930F, 0.9999996184F, 0.9999996426F, + 0.9999996657F, 0.9999996876F, 0.9999997084F, 0.9999997282F, + 0.9999997469F, 0.9999997647F, 0.9999997815F, 0.9999997973F, + 0.9999998123F, 0.9999998265F, 0.9999998398F, 0.9999998524F, + 0.9999998642F, 0.9999998753F, 0.9999998857F, 0.9999998954F, + 0.9999999045F, 0.9999999130F, 0.9999999209F, 0.9999999282F, + 0.9999999351F, 0.9999999414F, 0.9999999472F, 0.9999999526F, + 0.9999999576F, 0.9999999622F, 0.9999999664F, 0.9999999702F, + 0.9999999737F, 0.9999999769F, 0.9999999798F, 0.9999999824F, + 0.9999999847F, 0.9999999868F, 0.9999999887F, 0.9999999904F, + 0.9999999919F, 0.9999999932F, 0.9999999943F, 0.9999999953F, + 0.9999999961F, 0.9999999969F, 0.9999999975F, 0.9999999980F, + 0.9999999985F, 0.9999999988F, 0.9999999991F, 0.9999999993F, + 0.9999999995F, 0.9999999997F, 0.9999999998F, 0.9999999999F, + 0.9999999999F, 1.0000000000F, 1.0000000000F, 1.0000000000F, + 1.0000000000F, 1.0000000000F, 1.0000000000F, 1.0000000000F, +}; + +const float ff_vorbis_floor1_inverse_db_table[256]={ + 1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F, + 1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F, + 1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F, + 2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F, + 2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F, + 3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F, + 4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F, + 6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F, + 7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F, + 1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F, + 1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F, + 1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F, + 2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F, + 2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F, + 3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F, + 4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F, + 5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F, + 7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F, + 9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F, + 1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F, + 1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F, + 2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F, + 2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F, + 3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F, + 4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F, + 5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F, + 7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F, + 9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F, + 0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F, + 0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F, + 0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F, + 0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F, + 0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F, + 0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F, + 0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F, + 0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F, + 0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F, + 0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F, + 0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F, + 0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F, + 0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F, + 0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F, + 0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F, + 0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F, + 0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F, + 0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F, + 0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F, + 0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F, + 0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F, + 0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F, + 0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F, + 0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F, + 0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F, + 0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F, + 0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F, + 0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F, + 0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F, + 0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F, + 0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F, + 0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F, + 0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F, + 0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F, + 0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F, + 0.82788260F, 0.88168307F, 0.9389798F, 1.F, +}; + +const float * ff_vorbis_vwin[8] = { vwin64, vwin128, vwin256, vwin512, vwin1024, vwin2048, vwin4096, vwin8192 }; + diff --git a/src/libffmpeg/libavcodec/vp3.c b/src/libffmpeg/libavcodec/vp3.c index b5cfbb02c..6a398693a 100644 --- a/src/libffmpeg/libavcodec/vp3.c +++ b/src/libffmpeg/libavcodec/vp3.c @@ -1,18 +1,20 @@ /* * Copyright (C) 2003-2004 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -315,7 +317,7 @@ typedef struct Vp3DecodeContext { int last_coded_c_fragment; uint8_t edge_emu_buffer[9*2048]; //FIXME dynamic alloc - uint8_t qscale_table[2048]; //FIXME dynamic alloc (width+15)/16 + int8_t qscale_table[2048]; //FIXME dynamic alloc (width+15)/16 /* Huffman decode */ int hti; @@ -607,7 +609,7 @@ static void init_dequantizer(Vp3DecodeContext *s) { int ac_scale_factor = s->coded_ac_scale_factor[s->quality_index]; int dc_scale_factor = s->coded_dc_scale_factor[s->quality_index]; - int i, j, plane, inter, qri, bmi, bmj, qistart; + int i, plane, inter, qri, bmi, bmj, qistart; debug_vp3(" vp3: initializing dequantization tables\n"); @@ -1327,7 +1329,7 @@ static void reverse_dc_prediction(Vp3DecodeContext *s, int x, y; int i = first_fragment; - short predicted_dc; + int predicted_dc; /* DC values for the left, up-left, up, and up-right fragments */ int vl, vul, vu, vur; @@ -1453,11 +1455,11 @@ static void reverse_dc_prediction(Vp3DecodeContext *s, /* check for outranging on the [ul u l] and * [ul u ur l] predictors */ if ((transform == 13) || (transform == 15)) { - if (ABS(predicted_dc - vu) > 128) + if (FFABS(predicted_dc - vu) > 128) predicted_dc = vu; - else if (ABS(predicted_dc - vl) > 128) + else if (FFABS(predicted_dc - vl) > 128) predicted_dc = vl; - else if (ABS(predicted_dc - vul) > 128) + else if (FFABS(predicted_dc - vul) > 128) predicted_dc = vul; } @@ -1525,7 +1527,7 @@ static void render_slice(Vp3DecodeContext *s, int slice) if (!s->flipped_image) stride = -stride; - if(ABS(stride) > 2048) + if(FFABS(stride) > 2048) return; //various tables are fixed size /* for each fragment row in the slice (both of them)... */ @@ -2015,18 +2017,14 @@ static int vp3_decode_init(AVCodecContext *avctx) if (!s->theora_tables) { - for (i = 0; i < 64; i++) + for (i = 0; i < 64; i++) { s->coded_dc_scale_factor[i] = vp31_dc_scale_factor[i]; - for (i = 0; i < 64; i++) s->coded_ac_scale_factor[i] = vp31_ac_scale_factor[i]; - for (i = 0; i < 64; i++) s->base_matrix[0][i] = vp31_intra_y_dequant[i]; - for (i = 0; i < 64; i++) s->base_matrix[1][i] = vp31_intra_c_dequant[i]; - for (i = 0; i < 64; i++) s->base_matrix[2][i] = vp31_inter_dequant[i]; - for (i = 0; i < 64; i++) s->filter_limit_values[i] = vp31_filter_limit_values[i]; + } for(inter=0; inter<2; inter++){ for(plane=0; plane<3; plane++){ diff --git a/src/libffmpeg/libavcodec/vp3data.h b/src/libffmpeg/libavcodec/vp3data.h index 51cbae8db..d69ddfa28 100644 --- a/src/libffmpeg/libavcodec/vp3data.h +++ b/src/libffmpeg/libavcodec/vp3data.h @@ -1,3 +1,23 @@ +/* + * copyright (C) 2003 the ffmpeg project + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #ifndef VP3DATA_H #define VP3DATA_H diff --git a/src/libffmpeg/libavcodec/vp3dsp.c b/src/libffmpeg/libavcodec/vp3dsp.c index f5a1fb6ff..a48515a5e 100644 --- a/src/libffmpeg/libavcodec/vp3dsp.c +++ b/src/libffmpeg/libavcodec/vp3dsp.c @@ -1,18 +1,20 @@ /* * Copyright (C) 2004 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -40,7 +42,7 @@ static always_inline void idct(uint8_t *dst, int stride, int16_t *input, int type) { int16_t *ip = input; - uint8_t *cm = cropTbl + MAX_NEG_CROP; + uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; int A, B, C, D, Ad, Bd, Cd, Dd, E, F, G, H; int Ed, Gd, Add, Bdd, Fd, Hd; diff --git a/src/libffmpeg/libavcodec/vqavideo.c b/src/libffmpeg/libavcodec/vqavideo.c index 7f0c95206..912ced0df 100644 --- a/src/libffmpeg/libavcodec/vqavideo.c +++ b/src/libffmpeg/libavcodec/vqavideo.c @@ -2,18 +2,20 @@ * Westwood Studios VQA Video Decoder * Copyright (C) 2003 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -21,8 +23,8 @@ /** * @file vqavideo.c * VQA Video Decoder by Mike Melanson (melanson@pcisys.net) - * For more information about the RPZA format, visit: - * http://www.pcisys.net/~melanson/codecs/ + * For more information about the VQA format, visit: + * http://wiki.multimedia.cx/index.php?title=VQA * * The VQA video decoder outputs PAL8 or RGB555 colorspace data, depending * on the type of data in the file. @@ -107,7 +109,7 @@ typedef struct VqaContext { unsigned char *buf; int size; - unsigned int palette[PALETTE_COUNT]; + uint32_t palette[PALETTE_COUNT]; int width; /* width of a frame */ int height; /* height of a frame */ @@ -469,7 +471,22 @@ static void vqa_decode_chunk(VqaContext *s) case 1: /* still need sample media for this case (only one game, "Legend of * Kyrandia III : Malcolm's Revenge", is known to use this version) */ - lines = 0; + lobyte = s->decode_buffer[lobytes * 2]; + hibyte = s->decode_buffer[(lobytes * 2) + 1]; + vector_index = ((hibyte << 8) | lobyte) >> 3; + vector_index <<= index_shift; + lines = s->vector_height; + /* uniform color fill - a quick hack */ + if (hibyte == 0xFF) { + while (lines--) { + s->frame.data[0][pixel_ptr + 0] = 255 - lobyte; + s->frame.data[0][pixel_ptr + 1] = 255 - lobyte; + s->frame.data[0][pixel_ptr + 2] = 255 - lobyte; + s->frame.data[0][pixel_ptr + 3] = 255 - lobyte; + pixel_ptr += s->frame.linesize[0]; + } + lines=0; + } break; case 2: diff --git a/src/libffmpeg/libavcodec/wmadata.h b/src/libffmpeg/libavcodec/wmadata.h index e12c4792e..35e545ce6 100644 --- a/src/libffmpeg/libavcodec/wmadata.h +++ b/src/libffmpeg/libavcodec/wmadata.h @@ -1,3 +1,24 @@ +/* + * WMA compatible decoder + * copyright (c) 2002 The FFmpeg Project + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + /** * @file wmadata.h * Various WMA tables. diff --git a/src/libffmpeg/libavcodec/wmadec.c b/src/libffmpeg/libavcodec/wmadec.c index 227c9695b..684aea2c8 100644 --- a/src/libffmpeg/libavcodec/wmadec.c +++ b/src/libffmpeg/libavcodec/wmadec.c @@ -2,18 +2,20 @@ * WMA compatible decoder * Copyright (c) 2002 The FFmpeg Project. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -130,6 +132,7 @@ typedef struct WMADecodeContext { float lsp_pow_e_table[256]; float lsp_pow_m_table1[(1 << LSP_POW_BITS)]; float lsp_pow_m_table2[(1 << LSP_POW_BITS)]; + DSPContext dsp; #ifdef TRACE int frame_count; @@ -228,6 +231,8 @@ static int wma_decode_init(AVCodecContext * avctx) s->bit_rate = avctx->bit_rate; s->block_align = avctx->block_align; + dsputil_init(&s->dsp, avctx); + if (avctx->codec->id == CODEC_ID_WMAV1) { s->version = 1; } else { @@ -712,13 +717,8 @@ static int wma_decode_block(WMADecodeContext *s) { int n, v, a, ch, code, bsize; int coef_nb_bits, total_gain, parse_exponents; - float window[BLOCK_MAX_SIZE * 2]; -// XXX: FIXME!! there's a bug somewhere which makes this mandatory under altivec -#ifdef HAVE_ALTIVEC - volatile int nb_coefs[MAX_CHANNELS] __attribute__((aligned(16))); -#else + DECLARE_ALIGNED_16(float, window[BLOCK_MAX_SIZE * 2]); int nb_coefs[MAX_CHANNELS]; -#endif float mdct_norm; #ifdef TRACE @@ -873,7 +873,7 @@ static int wma_decode_block(WMADecodeContext *s) VLC *coef_vlc; int level, run, sign, tindex; int16_t *ptr, *eptr; - const int16_t *level_table, *run_table; + const uint16_t *level_table, *run_table; /* special VLC tables are used for ms stereo because there is potentially less energy there */ @@ -1109,36 +1109,26 @@ static int wma_decode_block(WMADecodeContext *s) if (s->channel_coded[ch]) { DECLARE_ALIGNED_16(FFTSample, output[BLOCK_MAX_SIZE * 2]); float *ptr; - int i, n4, index, n; + int n4, index, n; n = s->block_len; n4 = s->block_len / 2; - ff_imdct_calc(&s->mdct_ctx[bsize], + s->mdct_ctx[bsize].fft.imdct_calc(&s->mdct_ctx[bsize], output, s->coefs[ch], s->mdct_tmp); /* XXX: optimize all that by build the window and multipying/adding at the same time */ - /* multiply by the window */ - for(i=0;iframe_len / 2) + s->block_pos - n4; ptr = &s->frame_out[ch][index]; - for(i=0;idsp.vector_fmul_add_add(ptr,window,output,ptr,0,2*n,1); /* specific fast case for ms-stereo : add to second channel if it is not coded */ if (s->ms_stereo && !s->channel_coded[1]) { ptr = &s->frame_out[1][index]; - for(i=0;idsp.vector_fmul_add_add(ptr,window,output,ptr,0,2*n,1); } } } diff --git a/src/libffmpeg/libavcodec/wmv2.c b/src/libffmpeg/libavcodec/wmv2.c index 3f405af4f..5abc51775 100644 --- a/src/libffmpeg/libavcodec/wmv2.c +++ b/src/libffmpeg/libavcodec/wmv2.c @@ -1,18 +1,20 @@ /* * Copyright (c) 2002 The FFmpeg Project. * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -511,7 +513,7 @@ static int16_t *wmv2_pred_motion(Wmv2Context *w, int *px, int *py){ C = s->current_picture.motion_val[0][xy + 2 - wrap]; if(s->mb_x && !s->first_slice_line && !s->mspel && w->top_left_mv_flag) - diff= FFMAX(ABS(A[0] - B[0]), ABS(A[1] - B[1])); + diff= FFMAX(FFABS(A[0] - B[0]), FFABS(A[1] - B[1])); else diff=0; @@ -848,5 +850,6 @@ AVCodec wmv2_encoder = { wmv2_encode_init, MPV_encode_picture, MPV_encode_end, + .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1}, }; #endif diff --git a/src/libffmpeg/libavcodec/wnv1.c b/src/libffmpeg/libavcodec/wnv1.c index 335a04f35..46b31a5c5 100644 --- a/src/libffmpeg/libavcodec/wnv1.c +++ b/src/libffmpeg/libavcodec/wnv1.c @@ -2,18 +2,20 @@ * Winnov WNV1 codec * Copyright (c) 2005 Konstantin Shishkov * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/ws-snd1.c b/src/libffmpeg/libavcodec/ws-snd1.c index aa85b4526..eb4fe81d3 100644 --- a/src/libffmpeg/libavcodec/ws-snd1.c +++ b/src/libffmpeg/libavcodec/ws-snd1.c @@ -2,18 +2,20 @@ * Westwood SNDx codecs * Copyright (c) 2005 Konstantin Shishkov * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avcodec.h" @@ -27,9 +29,6 @@ * http://www.multimedia.cx */ -typedef struct { -} WSSNDContext; - static const char ws_adpcm_2bit[] = { -2, -1, 0, 1}; static const char ws_adpcm_4bit[] = { -9, -8, -6, -5, -4, -3, -2, -1, @@ -137,7 +136,7 @@ AVCodec ws_snd1_decoder = { "ws_snd1", CODEC_TYPE_AUDIO, CODEC_ID_WESTWOOD_SND1, - sizeof(WSSNDContext), + 0, ws_snd_decode_init, NULL, NULL, diff --git a/src/libffmpeg/libavcodec/xan.c b/src/libffmpeg/libavcodec/xan.c index 7ccc65c00..56ce87a95 100644 --- a/src/libffmpeg/libavcodec/xan.c +++ b/src/libffmpeg/libavcodec/xan.c @@ -2,18 +2,20 @@ * Wing Commander/Xan Video Decoder * Copyright (C) 2003 the ffmpeg project * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavcodec/xl.c b/src/libffmpeg/libavcodec/xl.c index d626ff12a..67ad237e1 100644 --- a/src/libffmpeg/libavcodec/xl.c +++ b/src/libffmpeg/libavcodec/xl.c @@ -2,18 +2,20 @@ * Miro VideoXL codec * Copyright (c) 2004 Konstantin Shishkov * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -31,7 +33,7 @@ typedef struct VideoXLContext{ AVFrame pic; } VideoXLContext; -const int xl_table[32] = { +static const int xl_table[32] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 15, 20, 25, 34, 46, 64, 82, 94, 103, 108, 113, 116, 119, diff --git a/src/libffmpeg/libavcodec/zmbv.c b/src/libffmpeg/libavcodec/zmbv.c index fd8497dd3..fe3745e09 100644 --- a/src/libffmpeg/libavcodec/zmbv.c +++ b/src/libffmpeg/libavcodec/zmbv.c @@ -2,18 +2,20 @@ * Zip Motion Blocks Video (ZMBV) decoder * Copyright (c) 2006 Konstantin Shishkov * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -616,7 +618,7 @@ static int decode_init(AVCodecContext *avctx) c->width = avctx->width; c->height = avctx->height; - if (avcodec_check_dimensions(avctx, avctx->height, avctx->width) < 0) { + if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) { return 1; } c->bpp = avctx->bits_per_sample; @@ -671,10 +673,8 @@ static int decode_end(AVCodecContext *avctx) #ifdef CONFIG_ZLIB inflateEnd(&(c->zstream)); #endif - if(c->cur) - av_freep(&c->cur); - if(c->prev) - av_freep(&c->prev); + av_freep(&c->cur); + av_freep(&c->prev); return 0; } diff --git a/src/libffmpeg/libavutil/Makefile.am b/src/libffmpeg/libavutil/Makefile.am index 13f645957..76340cf14 100644 --- a/src/libffmpeg/libavutil/Makefile.am +++ b/src/libffmpeg/libavutil/Makefile.am @@ -14,6 +14,7 @@ libavutil_la_SOURCES = \ log.c \ mathematics.c \ md5.c \ + mem.c \ rational.c libavutil_la_LDFLAGS = -avoid-version -module diff --git a/src/libffmpeg/libavutil/adler32.c b/src/libffmpeg/libavutil/adler32.c index e185a77c4..50d57470b 100644 --- a/src/libffmpeg/libavutil/adler32.c +++ b/src/libffmpeg/libavutil/adler32.c @@ -1,6 +1,24 @@ /* adler32.c -- compute the Adler-32 checksum of a data stream + * This is a modified version based on adler32.c from the zlib library. + * * Copyright (C) 1995 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * */ #include "common.h" diff --git a/src/libffmpeg/libavutil/adler32.h b/src/libffmpeg/libavutil/adler32.h index 4b035dcdf..f56d416fb 100644 --- a/src/libffmpeg/libavutil/adler32.h +++ b/src/libffmpeg/libavutil/adler32.h @@ -1,3 +1,23 @@ +/* + * copyright (c) 2006 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #ifndef ADLER32_H #define ADLER32_H diff --git a/src/libffmpeg/libavutil/avutil.h b/src/libffmpeg/libavutil/avutil.h index 6f66fbb07..08cc61567 100644 --- a/src/libffmpeg/libavutil/avutil.h +++ b/src/libffmpeg/libavutil/avutil.h @@ -1,3 +1,23 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #ifndef AVUTIL_H #define AVUTIL_H @@ -14,8 +34,8 @@ extern "C" { #define AV_STRINGIFY(s) AV_TOSTRING(s) #define AV_TOSTRING(s) #s -#define LIBAVUTIL_VERSION_INT ((49<<16)+(0<<8)+0) -#define LIBAVUTIL_VERSION 49.0.0 +#define LIBAVUTIL_VERSION_INT ((49<<16)+(1<<8)+0) +#define LIBAVUTIL_VERSION 49.1.0 #define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT #define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) @@ -31,7 +51,7 @@ extern "C" { /** * Pixel format. Notes: * - * PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA + * PIX_FMT_RGB32 is handled in an endian-specific manner. A RGBA * color is put together as: * (A << 24) | (R << 16) | (G << 8) | B * This is stored as BGRA on little endian CPU architectures and ARGB on @@ -40,7 +60,7 @@ extern "C" { * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized * image data is stored in AVFrame.data[0]. The palette is transported in * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is - * formatted the same as in PIX_FMT_RGBA32 described above (i.e., it is + * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is * also endian-specific). Note also that the individual RGB palette * components stored in AVFrame.data[1] should be in the range 0..255. * This is important as many custom PAL8 video codecs that were designed @@ -48,31 +68,68 @@ extern "C" { */ enum PixelFormat { PIX_FMT_NONE= -1, - PIX_FMT_YUV420P, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples) - PIX_FMT_YUV422, ///< Packed pixel, Y0 Cb Y1 Cr - PIX_FMT_RGB24, ///< Packed pixel, 3 bytes per pixel, RGBRGB... - PIX_FMT_BGR24, ///< Packed pixel, 3 bytes per pixel, BGRBGR... - PIX_FMT_YUV422P, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples) - PIX_FMT_YUV444P, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples) - PIX_FMT_RGBA32, ///< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness - PIX_FMT_YUV410P, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples) - PIX_FMT_YUV411P, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples) - PIX_FMT_RGB565, ///< always stored in cpu endianness - PIX_FMT_RGB555, ///< always stored in cpu endianness, most significant bit to 1 - PIX_FMT_GRAY8, - PIX_FMT_MONOWHITE, ///< 0 is white - PIX_FMT_MONOBLACK, ///< 0 is black - PIX_FMT_PAL8, ///< 8 bit with RGBA palette - PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0 full scale (jpeg) - PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2 full scale (jpeg) - PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4 full scale (jpeg) + PIX_FMT_YUV420P, ///< Planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) + PIX_FMT_YUYV422, ///< Packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr + PIX_FMT_RGB24, ///< Packed RGB 8:8:8, 24bpp, RGBRGB... + PIX_FMT_BGR24, ///< Packed RGB 8:8:8, 24bpp, BGRBGR... + PIX_FMT_YUV422P, ///< Planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + PIX_FMT_YUV444P, ///< Planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) + PIX_FMT_RGB32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in cpu endianness + PIX_FMT_YUV410P, ///< Planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) + PIX_FMT_YUV411P, ///< Planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) + PIX_FMT_RGB565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in cpu endianness + PIX_FMT_RGB555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in cpu endianness most significant bit to 0 + PIX_FMT_GRAY8, ///< Y , 8bpp + PIX_FMT_MONOWHITE, ///< Y , 1bpp, 1 is white + PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black + PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette + PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0, 12bpp, full scale (jpeg) + PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2, 16bpp, full scale (jpeg) + PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4, 24bpp, full scale (jpeg) PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h) PIX_FMT_XVMC_MPEG2_IDCT, - PIX_FMT_UYVY422, ///< Packed pixel, Cb Y0 Cr Y1 - PIX_FMT_UYVY411, ///< Packed pixel, Cb Y0 Y1 Cr Y2 Y3 - PIX_FMT_NB, + PIX_FMT_UYVY422, ///< Packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 + PIX_FMT_UYYVYY411, ///< Packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 + PIX_FMT_BGR32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in cpu endianness + PIX_FMT_BGR565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in cpu endianness + PIX_FMT_BGR555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in cpu endianness most significant bit to 1 + PIX_FMT_BGR8, ///< Packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) + PIX_FMT_BGR4, ///< Packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) + PIX_FMT_BGR4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) + PIX_FMT_RGB8, ///< Packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_RGB4, ///< Packed RGB 1:2:1, 4bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_RGB4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_NV12, ///< Planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV + PIX_FMT_NV21, ///< as above, but U and V bytes are swapped + + PIX_FMT_RGB32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in cpu endianness + PIX_FMT_BGR32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in cpu endianness + + PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian + PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian + PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions }; +#ifdef WORDS_BIGENDIAN +#define PIX_FMT_RGBA PIX_FMT_RGB32_1 +#define PIX_FMT_BGRA PIX_FMT_BGR32_1 +#define PIX_FMT_ARGB PIX_FMT_RGB32 +#define PIX_FMT_ABGR PIX_FMT_BGR32 +#define PIX_FMT_GRAY16 PIX_FMT_GRAY16BE +#else +#define PIX_FMT_RGBA PIX_FMT_BGR32 +#define PIX_FMT_BGRA PIX_FMT_RGB32 +#define PIX_FMT_ARGB PIX_FMT_BGR32_1 +#define PIX_FMT_ABGR PIX_FMT_RGB32_1 +#define PIX_FMT_GRAY16 PIX_FMT_GRAY16LE +#endif + +#if LIBAVUTIL_VERSION_INT < (50<<16) +#define PIX_FMT_UYVY411 PIX_FMT_UYYVYY411 +#define PIX_FMT_RGBA32 PIX_FMT_RGB32 +#define PIX_FMT_YUV422 PIX_FMT_YUYV422 +#endif + #ifdef __cplusplus } #endif diff --git a/src/libffmpeg/libavutil/bswap.h b/src/libffmpeg/libavutil/bswap.h index 25d418c69..4614c9045 100644 --- a/src/libffmpeg/libavutil/bswap.h +++ b/src/libffmpeg/libavutil/bswap.h @@ -1,3 +1,23 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + /** * @file bswap.h * byte swap. @@ -16,7 +36,7 @@ # define LEGACY_REGS "=q" #endif -#if defined(ARCH_X86) || defined(ARCH_X86_64) +#if defined(ARCH_X86) static always_inline uint16_t bswap_16(uint16_t x) { __asm("rorw $8, %0" : @@ -129,7 +149,7 @@ static inline uint64_t bswap_64(uint64_t x) return r.ll; #endif } -#endif /* !ARCH_X86 */ +#endif /* defined(ARCH_X86) */ #endif /* !HAVE_BYTESWAP_H */ diff --git a/src/libffmpeg/libavutil/common.h b/src/libffmpeg/libavutil/common.h index b26c821f8..d167404b6 100644 --- a/src/libffmpeg/libavutil/common.h +++ b/src/libffmpeg/libavutil/common.h @@ -1,3 +1,23 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + /** * @file common.h * common internal and external api header. @@ -56,18 +76,15 @@ #endif #endif -#ifndef EMULATE_INTTYPES -# include +#ifndef attribute_deprecated +#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) +# define attribute_deprecated __attribute__((deprecated)) #else - typedef signed char int8_t; - typedef signed short int16_t; - typedef signed int int32_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; - typedef signed long long int64_t; - typedef unsigned long long uint64_t; -#endif /* EMULATE_INTTYPES */ +# define attribute_deprecated +#endif +#endif + +# include #ifndef PRId64 #define PRId64 "lld" @@ -81,6 +98,10 @@ #define PRIx64 "llx" #endif +#ifndef PRIX64 +#define PRIX64 "llX" +#endif + #ifndef PRId32 #define PRId32 "d" #endif @@ -125,16 +146,6 @@ #define UINT64_MAX uint64_t_C(0xFFFFFFFFFFFFFFFF) #endif -#ifdef EMULATE_FAST_INT -typedef signed char int_fast8_t; -typedef signed int int_fast16_t; -typedef signed int int_fast32_t; -typedef unsigned char uint_fast8_t; -typedef unsigned int uint_fast16_t; -typedef unsigned int uint_fast32_t; -typedef uint64_t uint_fast64_t; -#endif - #ifndef INT_BIT # if INT_MAX != 2147483647 # define INT_BIT 64 @@ -164,11 +175,14 @@ typedef uint64_t uint_fast64_t; #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) /* assume b>0 */ #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) -#define ABS(a) ((a) >= 0 ? (a) : (-(a))) +#define FFABS(a) ((a) >= 0 ? (a) : (-(a))) +#define FFSIGN(a) ((a) > 0 ? 1 : -1) #define FFMAX(a,b) ((a) > (b) ? (a) : (b)) #define FFMIN(a,b) ((a) > (b) ? (b) : (a)) +#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) + /* misc math functions */ extern FF_IMPORT_ATTR const uint8_t ff_log2_tab[256]; @@ -207,7 +221,21 @@ static inline int av_log2_16bit(unsigned int v) /* median of 3 */ static inline int mid_pred(int a, int b, int c) { -#if 0 +#if HAVE_CMOV + int i=b; + asm volatile( + "cmp %2, %1 \n\t" + "cmovg %1, %0 \n\t" + "cmovg %2, %1 \n\t" + "cmp %3, %1 \n\t" + "cmovl %3, %1 \n\t" + "cmp %1, %0 \n\t" + "cmovg %1, %0 \n\t" + :"+&r"(i), "+&r"(a) + :"r"(b), "r"(c) + ); + return i; +#elif 0 int t= (a-b)&((a-b)>>31); a-=t; b+=t; @@ -236,7 +264,7 @@ static inline int mid_pred(int a, int b, int c) * @param a value to clip * @param amin minimum value of the clip range * @param amax maximum value of the clip range - * @return cliped value + * @return clipped value */ static inline int clip(int a, int amin, int amax) { @@ -248,7 +276,7 @@ static inline int clip(int a, int amin, int amax) /** * clip a signed integer value into the 0-255 range * @param a value to clip - * @return cliped value + * @return clipped value */ static inline uint8_t clip_uint8(int a) { @@ -273,7 +301,19 @@ static inline int ff_get_fourcc(const char *s){ #define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24)) #define MKBETAG(a,b,c,d) (d | (c << 8) | (b << 16) | (a << 24)) - +/*! + * \def GET_UTF8(val, GET_BYTE, ERROR) + * converts a utf-8 character (up to 4 bytes long) to its 32-bit ucs-4 encoded form + * \param val is the output and should be of type uint32_t. It holds the converted + * ucs-4 character and should be a left value. + * \param GET_BYTE gets utf-8 encoded bytes from any proper source. It can be + * a function or a statement whose return value or evaluated value is of type + * uint8_t. It will be executed up to 4 times for values in the valid utf-8 range, + * and up to 7 times in the general case. + * \param ERROR action that should be taken when an invalid utf-8 byte is returned + * from GET_BYTE. It should be a statement that jumps out of the macro, + * like exit(), goto, return, break, or continue. + */ #define GET_UTF8(val, GET_BYTE, ERROR)\ val= GET_BYTE;\ {\ @@ -289,7 +329,43 @@ static inline int ff_get_fourcc(const char *s){ }\ } -#if defined(ARCH_X86) || defined(ARCH_X86_64) || defined(ARCH_POWERPC) +/*! + * \def PUT_UTF8(val, tmp, PUT_BYTE) + * converts a 32-bit unicode character to its utf-8 encoded form (up to 4 bytes long). + * \param val is an input only argument and should be of type uint32_t. It holds + * a ucs4 encoded unicode character that is to be converted to utf-8. If + * val is given as a function it's executed only once. + * \param tmp is a temporary variable and should be of type uint8_t. It + * represents an intermediate value during conversion that is to be + * outputted by PUT_BYTE. + * \param PUT_BYTE writes the converted utf-8 bytes to any proper destination. + * It could be a function or a statement, and uses tmp as the input byte. + * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be + * executed up to 4 times for values in the valid utf-8 range and up to + * 7 times in the general case, depending on the length of the converted + * unicode character. + */ +#define PUT_UTF8(val, tmp, PUT_BYTE)\ + {\ + int bytes, shift;\ + uint32_t in = val;\ + if (in < 0x80) {\ + tmp = in;\ + PUT_BYTE\ + } else {\ + bytes = (av_log2(in) + 4) / 5;\ + shift = (bytes - 1) * 6;\ + tmp = (256 - (256 >> bytes)) | (in >> shift);\ + PUT_BYTE\ + while (shift >= 6) {\ + shift -= 6;\ + tmp = 0x80 | ((in >> shift) & 0x3f);\ + PUT_BYTE\ + }\ + }\ + } + +#if defined(ARCH_X86) || defined(ARCH_POWERPC) #if defined(ARCH_X86_64) static inline uint64_t read_time(void) { @@ -344,7 +420,7 @@ tend= read_time();\ tcount++;\ }else\ tskip_count++;\ - if(256*256*256*64%(tcount+tskip_count)==0){\ + if(((tcount+tskip_count)&(tcount+tskip_count-1))==0){\ av_log(NULL, AV_LOG_DEBUG, "%"PRIu64" dezicycles in %s, %d runs, %d skips\n", tsum*10/tcount, id, tcount, tskip_count);\ }\ } @@ -353,11 +429,23 @@ tend= read_time();\ #define STOP_TIMER(id) {} #endif +/* memory */ + +#ifdef __GNUC__ + #define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n))) +#else + #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v +#endif + /* memory */ void *av_malloc(unsigned int size); void *av_realloc(void *ptr, unsigned int size); void av_free(void *ptr); +void *av_mallocz(unsigned int size); +char *av_strdup(const char *s); +void av_freep(void *ptr); + /* xine: inline causes trouble for debug compiling */ #ifdef DISABLE_INLINE # ifdef inline @@ -370,4 +458,11 @@ void av_free(void *ptr); # define always_inline #endif +/* xine: define ASMALIGN here since it's cleaner that generating it in the configure */ +#if HAVE_ASMALIGN_POT +# define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\n\t" +#else +# define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\n\t" +#endif + #endif /* COMMON_H */ diff --git a/src/libffmpeg/libavutil/crc.c b/src/libffmpeg/libavutil/crc.c index 13be2020d..baa605d32 100644 --- a/src/libffmpeg/libavutil/crc.c +++ b/src/libffmpeg/libavutil/crc.c @@ -1,3 +1,23 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #include "common.h" #include "crc.h" diff --git a/src/libffmpeg/libavutil/crc.h b/src/libffmpeg/libavutil/crc.h index c5b217017..e739c309b 100644 --- a/src/libffmpeg/libavutil/crc.h +++ b/src/libffmpeg/libavutil/crc.h @@ -1,3 +1,23 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #ifndef CRC_H #define CRC_H diff --git a/src/libffmpeg/libavutil/integer.c b/src/libffmpeg/libavutil/integer.c index 1820dbf59..5c7b71530 100644 --- a/src/libffmpeg/libavutil/integer.c +++ b/src/libffmpeg/libavutil/integer.c @@ -2,18 +2,20 @@ * arbitrary precision integers * Copyright (c) 2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavutil/integer.h b/src/libffmpeg/libavutil/integer.h index 523752912..a50ad9bae 100644 --- a/src/libffmpeg/libavutil/integer.h +++ b/src/libffmpeg/libavutil/integer.h @@ -2,18 +2,20 @@ * arbitrary precision integers * Copyright (c) 2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavutil/internal.h b/src/libffmpeg/libavutil/internal.h index 266976c94..7d850141b 100644 --- a/src/libffmpeg/libavutil/internal.h +++ b/src/libffmpeg/libavutil/internal.h @@ -1,3 +1,23 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + /** * @file internal.h * common internal api header. @@ -10,32 +30,17 @@ # define PIC #endif -# ifndef ENODATA -# define ENODATA 61 -# endif +#ifndef ENODATA +# define ENODATA 61 +#endif #include "bswap.h" #include #ifndef offsetof -# define offsetof(T,F) ((unsigned int)((char *)&((T *)0)->F)) +# define offsetof(T,F) ((unsigned int)((char *)&((T *)0)->F)) #endif -#define AVOPTION_CODEC_BOOL(name, help, field) \ - { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_BOOL } -#define AVOPTION_CODEC_DOUBLE(name, help, field, minv, maxv, defval) \ - { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_DOUBLE, minv, maxv, defval } -#define AVOPTION_CODEC_FLAG(name, help, field, flag, defval) \ - { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_FLAG, flag, 0, defval } -#define AVOPTION_CODEC_INT(name, help, field, minv, maxv, defval) \ - { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_INT, minv, maxv, defval } -#define AVOPTION_CODEC_STRING(name, help, field, str, val) \ - { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_STRING, .defval = val, .defstr = str } -#define AVOPTION_CODEC_RCOVERRIDE(name, help, field) \ - { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_RCOVERRIDE, .defval = 0, .defstr = NULL } -#define AVOPTION_SUB(ptr) { .name = NULL, .help = (const char*)ptr } -#define AVOPTION_END() AVOPTION_SUB(NULL) - #ifdef __MINGW32__ # ifdef _DEBUG # define DEBUG @@ -46,44 +51,45 @@ # ifdef CONFIG_WINCE # define perror(a) +# define abort() # endif /* __MINGW32__ end */ #elif defined (CONFIG_OS2) /* OS/2 EMX */ -#include +# include #endif /* !__MINGW32__ && CONFIG_OS2 */ -# ifdef USE_FASTMEMCPY -# include "fastmemcpy.h" -# endif +#ifdef USE_FASTMEMCPY +# include "libvo/fastmemcpy.h" +#endif // Use rip-relative addressing if compiling PIC code on x86-64. -# if defined(__MINGW32__) || defined(__CYGWIN__) || \ - defined(__OS2__) || (defined (__OpenBSD__) && !defined(__ELF__)) -# if defined(ARCH_X86_64) && defined(PIC) -# define MANGLE(a) "_" #a"(%%rip)" -# else -# define MANGLE(a) "_" #a -# endif +#if defined(__MINGW32__) || defined(__CYGWIN__) || \ + defined(__OS2__) || (defined (__OpenBSD__) && !defined(__ELF__)) +# if defined(ARCH_X86_64) && defined(PIC) +# define MANGLE(a) "_" #a"(%%rip)" # else -# if defined(ARCH_X86_64) && defined(PIC) -# define MANGLE(a) #a"(%%rip)" -# elif defined(CONFIG_DARWIN) -# define MANGLE(a) "_" #a -# else -# define MANGLE(a) #a -# endif +# define MANGLE(a) "_" #a +# endif +#else +# if defined(ARCH_X86_64) && defined(PIC) +# define MANGLE(a) #a"(%%rip)" +# elif defined(CONFIG_DARWIN) +# define MANGLE(a) "_" #a +# else +# define MANGLE(a) #a # endif +#endif /* debug stuff */ -# if !defined(DEBUG) && !defined(NDEBUG) -# define NDEBUG -# endif -# include +#if !defined(DEBUG) && !defined(NDEBUG) +# define NDEBUG +#endif +#include /* dprintf macros */ # ifdef DEBUG @@ -96,32 +102,40 @@ # define dprintf(fmt,...) # endif -# ifdef CONFIG_WINCE -# define abort() -# endif +#define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0) -# define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0) +/* math */ -extern const uint32_t inverse[256]; +extern const uint32_t ff_inverse[256]; -#if defined(ARCH_X86) || defined(ARCH_X86_64) +#if defined(ARCH_X86) # define FASTDIV(a,b) \ ({\ int ret,dmy;\ asm volatile(\ "mull %3"\ :"=d"(ret),"=a"(dmy)\ - :"1"(a),"g"(inverse[b])\ + :"1"(a),"g"(ff_inverse[b])\ + );\ + ret;\ + }) +#elif defined(ARCH_ARMV4L) +# define FASTDIV(a,b) \ + ({\ + int ret,dmy;\ + asm volatile(\ + "umull %1, %0, %2, %3"\ + :"=&r"(ret),"=&r"(dmy)\ + :"r"(a),"r"(ff_inverse[b])\ );\ ret;\ }) #elif defined(CONFIG_FASTDIV) -# define FASTDIV(a,b) ((uint32_t)((((uint64_t)a)*inverse[b])>>32)) +# define FASTDIV(a,b) ((uint32_t)((((uint64_t)a)*ff_inverse[b])>>32)) #else # define FASTDIV(a,b) ((a)/(b)) #endif -/* math */ extern FF_IMPORT_ATTR const uint8_t ff_sqrt_tab[128]; static inline int ff_sqrt(int a) @@ -142,7 +156,7 @@ static inline int ff_sqrt(int a) return ret; } -#if defined(ARCH_X86) || defined(ARCH_X86_64) +#if defined(ARCH_X86) #define MASK_ABS(mask, level)\ asm volatile(\ "cdq \n\t"\ @@ -156,7 +170,7 @@ static inline int ff_sqrt(int a) level= (level^mask)-mask; #endif -#if __CPU__ >= 686 && !defined(RUNTIME_CPUDETECT) +#ifdef HAVE_CMOV #define COPY3_IF_LT(x,y,a,b,c,d)\ asm volatile (\ "cmpl %0, %3 \n\t"\ @@ -205,7 +219,7 @@ if((y)<(x)){\ static always_inline long int lrintf(float x) { #ifdef __MINGW32__ -# ifdef ARCH_X86 +# ifdef ARCH_X86_32 int32_t i; asm volatile( "fistpl %0\n\t" @@ -215,7 +229,7 @@ static always_inline long int lrintf(float x) # else /* XXX: incorrect, but make it compile */ return (int)(x + (x < 0 ? -0.5 : 0.5)); -# endif /* ARCH_X86 */ +# endif /* ARCH_X86_32 */ #else return (int)(rint(x)); #endif /* __MINGW32__ */ diff --git a/src/libffmpeg/libavutil/intfloat_readwrite.h b/src/libffmpeg/libavutil/intfloat_readwrite.h index 33e4c636c..c535b64c8 100644 --- a/src/libffmpeg/libavutil/intfloat_readwrite.h +++ b/src/libffmpeg/libavutil/intfloat_readwrite.h @@ -1,3 +1,23 @@ +/* + * copyright (c) 2005 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #ifndef INTFLOAT_READWRITE_H #define INTFLOAT_READWRITE_H diff --git a/src/libffmpeg/libavutil/lls.c b/src/libffmpeg/libavutil/lls.c index 6bf4d9278..aa9467dce 100644 --- a/src/libffmpeg/libavutil/lls.c +++ b/src/libffmpeg/libavutil/lls.c @@ -3,18 +3,20 @@ * * Copyright (c) 2006 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavutil/lls.h b/src/libffmpeg/libavutil/lls.h index 944fba75d..59ad2e958 100644 --- a/src/libffmpeg/libavutil/lls.h +++ b/src/libffmpeg/libavutil/lls.h @@ -3,18 +3,20 @@ * * Copyright (c) 2006 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavutil/log.c b/src/libffmpeg/libavutil/log.c index f43593ad9..8b2dc6f6d 100644 --- a/src/libffmpeg/libavutil/log.c +++ b/src/libffmpeg/libavutil/log.c @@ -2,18 +2,20 @@ * log functions * Copyright (c) 2003 Michel Bardiaux * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavutil/log.h b/src/libffmpeg/libavutil/log.h index 13366064e..0ff1f9fcf 100644 --- a/src/libffmpeg/libavutil/log.h +++ b/src/libffmpeg/libavutil/log.h @@ -1,3 +1,23 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #ifndef LOG_H #define LOG_H @@ -13,7 +33,7 @@ struct AVCLASS { or AVFormatContext, which begin with an AVClass. Needed because av_log is in libavcodec and has no visibility of AVIn/OutputFormat */ - struct AVOption *option; + const struct AVOption *option; }; /* av_log API */ diff --git a/src/libffmpeg/libavutil/mathematics.c b/src/libffmpeg/libavutil/mathematics.c index 951324e99..4be027d9d 100644 --- a/src/libffmpeg/libavutil/mathematics.c +++ b/src/libffmpeg/libavutil/mathematics.c @@ -1,18 +1,20 @@ /* * Copyright (c) 2005 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -129,7 +131,7 @@ main(){ if((double)a * (double)b / (double)c > (1LL<<63)) continue; - if(d!=e) printf("%Ld*%Ld/%Ld= %Ld=%Ld\n", a, b, c, d, e); + if(d!=e) printf("%"PRId64"*%"PRId64"/%"PRId64"= %"PRId64"=%"PRId64"\n", a, b, c, d, e); } } } diff --git a/src/libffmpeg/libavutil/mathematics.h b/src/libffmpeg/libavutil/mathematics.h index 0cf726cbe..0b74b254b 100644 --- a/src/libffmpeg/libavutil/mathematics.h +++ b/src/libffmpeg/libavutil/mathematics.h @@ -1,3 +1,23 @@ +/* + * copyright (c) 2005 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #ifndef MATHEMATICS_H #define MATHEMATICS_H diff --git a/src/libffmpeg/libavutil/md5.c b/src/libffmpeg/libavutil/md5.c index 32eca3a8e..d33ad1483 100644 --- a/src/libffmpeg/libavutil/md5.c +++ b/src/libffmpeg/libavutil/md5.c @@ -2,18 +2,20 @@ * Copyright (C) 2006 Michael Niedermayer (michaelni@gmx.at) * Copyright (C) 2003-2005 by Christopher R. Hertel (crh@ubiqx.mn.org) * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * References: @@ -174,11 +176,11 @@ main(){ uint8_t in[1000]; for(i=0; i<1000; i++) in[i]= i*i; - av_md5_sum( (uint8_t*)&md5val, in, 1000); printf("%lld\n", md5val); - av_md5_sum( (uint8_t*)&md5val, in, 63); printf("%lld\n", md5val); - av_md5_sum( (uint8_t*)&md5val, in, 64); printf("%lld\n", md5val); - av_md5_sum( (uint8_t*)&md5val, in, 65); printf("%lld\n", md5val); + av_md5_sum( (uint8_t*)&md5val, in, 1000); printf("%"PRId64"\n", md5val); + av_md5_sum( (uint8_t*)&md5val, in, 63); printf("%"PRId64"\n", md5val); + av_md5_sum( (uint8_t*)&md5val, in, 64); printf("%"PRId64"\n", md5val); + av_md5_sum( (uint8_t*)&md5val, in, 65); printf("%"PRId64"\n", md5val); for(i=0; i<1000; i++) in[i]= i % 127; - av_md5_sum( (uint8_t*)&md5val, in, 999); printf("%lld\n", md5val); + av_md5_sum( (uint8_t*)&md5val, in, 999); printf("%"PRId64"\n", md5val); } #endif diff --git a/src/libffmpeg/libavutil/md5.h b/src/libffmpeg/libavutil/md5.h index c8144b4cc..8d1b4b5fe 100644 --- a/src/libffmpeg/libavutil/md5.h +++ b/src/libffmpeg/libavutil/md5.h @@ -1,3 +1,23 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #ifndef MD5_H #define MD5_H diff --git a/src/libffmpeg/libavutil/mem.c b/src/libffmpeg/libavutil/mem.c new file mode 100644 index 000000000..f43fb5420 --- /dev/null +++ b/src/libffmpeg/libavutil/mem.c @@ -0,0 +1,171 @@ +/* + * default memory allocator for libavutil + * Copyright (c) 2002 Fabrice Bellard. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file mem.c + * default memory allocator for libavutil. + */ + +#include "common.h" + +/* here we can use OS dependant allocation functions */ +#undef malloc +#undef free +#undef realloc + +#ifdef HAVE_MALLOC_H +#include +#endif + +/* you can redefine av_malloc and av_free in your project to use your + memory allocator. You do not need to suppress this file because the + linker will do it automatically */ + +/** + * Memory allocation of size byte with alignment suitable for all + * memory accesses (including vectors if available on the + * CPU). av_malloc(0) must return a non NULL pointer. + */ +void *av_malloc(unsigned int size) +{ + void *ptr; +#ifdef CONFIG_MEMALIGN_HACK + long diff; +#endif + + /* let's disallow possible ambiguous cases */ + if(size > (INT_MAX-16) ) + return NULL; + +#ifdef CONFIG_MEMALIGN_HACK + ptr = malloc(size+16); + if(!ptr) + return ptr; + diff= ((-(long)ptr - 1)&15) + 1; + ptr += diff; + ((char*)ptr)[-1]= diff; +#elif defined (HAVE_MEMALIGN) + ptr = memalign(16,size); + /* Why 64? + Indeed, we should align it: + on 4 for 386 + on 16 for 486 + on 32 for 586, PPro - k6-III + on 64 for K7 (maybe for P3 too). + Because L1 and L2 caches are aligned on those values. + But I don't want to code such logic here! + */ + /* Why 16? + because some cpus need alignment, for example SSE2 on P4, & most RISC cpus + it will just trigger an exception and the unaligned load will be done in the + exception handler or it will just segfault (SSE2 on P4) + Why not larger? because i didnt see a difference in benchmarks ... + */ + /* benchmarks with p3 + memalign(64)+1 3071,3051,3032 + memalign(64)+2 3051,3032,3041 + memalign(64)+4 2911,2896,2915 + memalign(64)+8 2545,2554,2550 + memalign(64)+16 2543,2572,2563 + memalign(64)+32 2546,2545,2571 + memalign(64)+64 2570,2533,2558 + + btw, malloc seems to do 8 byte alignment by default here + */ +#else + ptr = malloc(size); +#endif + return ptr; +} + +/** + * av_realloc semantics (same as glibc): if ptr is NULL and size > 0, + * identical to malloc(size). If size is zero, it is identical to + * free(ptr) and NULL is returned. + */ +void *av_realloc(void *ptr, unsigned int size) +{ +#ifdef CONFIG_MEMALIGN_HACK + int diff; +#endif + + /* let's disallow possible ambiguous cases */ + if(size > (INT_MAX-16) ) + return NULL; + +#ifdef CONFIG_MEMALIGN_HACK + //FIXME this isn't aligned correctly, though it probably isn't needed + if(!ptr) return av_malloc(size); + diff= ((char*)ptr)[-1]; + return realloc(ptr - diff, size + diff) + diff; +#else + return realloc(ptr, size); +#endif +} + +/** + * Free memory which has been allocated with av_malloc(z)() or av_realloc(). + * NOTE: ptr = NULL is explicetly allowed + * Note2: it is recommended that you use av_freep() instead + */ +void av_free(void *ptr) +{ + /* XXX: this test should not be needed on most libcs */ + if (ptr) +#ifdef CONFIG_MEMALIGN_HACK + free(ptr - ((char*)ptr)[-1]); +#else + free(ptr); +#endif +} + +/** + * Frees memory and sets the pointer to NULL. + * @param arg pointer to the pointer which should be freed + */ +void av_freep(void *arg) +{ + void **ptr= (void**)arg; + av_free(*ptr); + *ptr = NULL; +} + +void *av_mallocz(unsigned int size) +{ + void *ptr; + + ptr = av_malloc(size); + if (ptr) + memset(ptr, 0, size); + return ptr; +} + +char *av_strdup(const char *s) +{ + char *ptr; + int len; + len = strlen(s) + 1; + ptr = av_malloc(len); + if (ptr) + memcpy(ptr, s, len); + return ptr; +} + diff --git a/src/libffmpeg/libavutil/rational.c b/src/libffmpeg/libavutil/rational.c index 4a7b0edf7..0e018c41b 100644 --- a/src/libffmpeg/libavutil/rational.c +++ b/src/libffmpeg/libavutil/rational.c @@ -2,18 +2,20 @@ * Rational numbers * Copyright (c) 2003 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ @@ -34,22 +36,29 @@ int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max){ AVRational a0={0,1}, a1={1,0}; int sign= (nom<0) ^ (den<0); - int64_t gcd= ff_gcd(ABS(nom), ABS(den)); + int64_t gcd= ff_gcd(FFABS(nom), FFABS(den)); - nom = ABS(nom)/gcd; - den = ABS(den)/gcd; + nom = FFABS(nom)/gcd; + den = FFABS(den)/gcd; if(nom<=max && den<=max){ a1= (AVRational){nom, den}; den=0; } while(den){ - int64_t x = nom / den; + uint64_t x = nom / den; int64_t next_den= nom - den*x; int64_t a2n= x*a1.num + a0.num; int64_t a2d= x*a1.den + a0.den; - if(a2n > max || a2d > max) break; + if(a2n > max || a2d > max){ + if(a1.num) x= (max - a0.num) / a1.num; + if(a1.den) x= FFMIN(x, (max - a0.den) / a1.den); + + if (den*(2*x*a1.den + a0.den) > nom*a1.den) + a1 = (AVRational){x*a1.num + a0.num, x*a1.den + a0.den}; + break; + } a0= a1; a1= (AVRational){a2n, a2d}; diff --git a/src/libffmpeg/libavutil/rational.h b/src/libffmpeg/libavutil/rational.h index 0fbe0d29d..43fc22114 100644 --- a/src/libffmpeg/libavutil/rational.h +++ b/src/libffmpeg/libavutil/rational.h @@ -2,18 +2,20 @@ * Rational numbers * Copyright (c) 2003 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg 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 + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ diff --git a/src/libffmpeg/libavutil/x86_cpu.h b/src/libffmpeg/libavutil/x86_cpu.h index 8fd5f8600..3d54b2a60 100644 --- a/src/libffmpeg/libavutil/x86_cpu.h +++ b/src/libffmpeg/libavutil/x86_cpu.h @@ -1,3 +1,23 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #ifndef AVUTIL_X86CPU_H #define AVUTIL_X86CPU_H @@ -15,6 +35,7 @@ # define REGBP rbp # define REGa rax # define REGb rbx +# define REGc rcx # define REGSP rsp #else @@ -32,6 +53,7 @@ # define REGBP ebp # define REGa eax # define REGb ebx +# define REGc ecx # define REGSP esp #endif diff --git a/src/libffmpeg/xine_decoder.c b/src/libffmpeg/xine_decoder.c index 10f420997..02d19cc1a 100644 --- a/src/libffmpeg/xine_decoder.c +++ b/src/libffmpeg/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.171 2006/10/11 12:53:12 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.172 2006/12/04 22:25:13 miguelfreitas Exp $ * * xine decoder plugin using ffmpeg * @@ -108,8 +108,8 @@ void avcodec_register_all(void) register_avcodec(&vmdvideo_decoder); register_avcodec(&vmdaudio_decoder); register_avcodec(&truemotion1_decoder); - register_avcodec(&mszh_decoder); - register_avcodec(&zlib_decoder); + //register_avcodec(&mszh_decoder); + //register_avcodec(&zlib_decoder); register_avcodec(&xan_dpcm_decoder); register_avcodec(&asv1_decoder); register_avcodec(&asv2_decoder); @@ -142,7 +142,7 @@ void avcodec_register_all(void) register_avcodec(&nuv_decoder); register_avcodec(&kmvc_decoder); register_avcodec(&flashsv_decoder); - register_avcodec(&cavs_decoder); + //register_avcodec(&cavs_decoder); register_avcodec(&cook_decoder); register_avcodec(&truespeech_decoder); register_avcodec(&tta_decoder); -- cgit v1.2.3 From 3321b7ae77daede398739a832e75c5dfba7de22e Mon Sep 17 00:00:00 2001 From: Matthias Hopf Date: Fri, 8 Dec 2006 16:19:17 +0000 Subject: Fixed duplicate and nonspecified postincrement due to macro call. CVS patchset: 8406 CVS date: 2006/12/08 16:19:17 --- src/demuxers/demux_iff.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_iff.c b/src/demuxers/demux_iff.c index 213ac4c99..4775158b7 100644 --- a/src/demuxers/demux_iff.c +++ b/src/demuxers/demux_iff.c @@ -36,7 +36,7 @@ * * ANIM (Animations) * - Animation works fine, without seeking. * - * $Id: demux_iff.c,v 1.17 2006/07/10 22:08:13 dgp85 Exp $ + * $Id: demux_iff.c,v 1.18 2006/12/08 16:19:17 mshopf Exp $ */ #ifdef HAVE_CONFIG_H @@ -827,7 +827,8 @@ static int demux_iff_send_chunk(demux_plugin_t *this_gen) { } } else { for (j = 0, k = (interleave_index / 2); j < (buf->size / 2); j += this->audio_channels) { - zw_16 = BE_16(&pointer16_from[k++]); + zw_16 = BE_16(&pointer16_from[k]); + k++; zw_rescale = zw_16; zw_rescale *= this->audio_volume_left; zw_rescale /= max_volume; @@ -856,7 +857,8 @@ static int demux_iff_send_chunk(demux_plugin_t *this_gen) { } } else { for (j = 1; j < (buf->size / 2); j += this->audio_channels) { - zw_16 = BE_16(&pointer16_from[k++]); + zw_16 = BE_16(&pointer16_from[k]); + k++; zw_rescale = zw_16; zw_rescale *= this->audio_volume_left; zw_rescale /= max_volume; -- cgit v1.2.3 From 4169f9efdaeda8a60b5cfd464bd39b80a9dd2032 Mon Sep 17 00:00:00 2001 From: Matthias Hopf Date: Fri, 8 Dec 2006 16:26:10 +0000 Subject: Fix wrong length specification for strncat() calls. Consolidated multiple strncat() calls to snprintf(). CVS patchset: 8407 CVS date: 2006/12/08 16:26:10 --- src/input/input_http.c | 21 ++++++++------------- src/input/libdvdnav/remap.c | 7 ++----- src/input/vcd/libcdio/iso9660_fs.c | 8 +++----- src/input/vcd/libvcd/vcd.c | 6 +++--- src/libsputext/demux_sputext.c | 5 +++-- src/libw32dll/wine/module.c | 4 +--- 6 files changed, 20 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/input/input_http.c b/src/input/input_http.c index 0ba143091..9011fba7f 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -19,7 +19,7 @@ * * input plugin for http network streams * - * $Id: input_http.c,v 1.124 2006/11/30 10:54:18 dgp85 Exp $ + * $Id: input_http.c,v 1.125 2006/12/08 16:26:10 mshopf Exp $ */ #ifdef HAVE_CONFIG_H @@ -335,12 +335,9 @@ static int http_plugin_read_metainf (http_input_plugin_t *this) { /* prepares the event */ radio = _x_meta_info_get(this->stream, XINE_META_INFO_ALBUM); if (radio) { - int len = strlen(radio); - strncpy(data.str, radio, sizeof(data.str)); - strncat(data.str, " - ", sizeof(data.str) - len); - strncat(data.str, songtitle, sizeof(data.str) - len - 3); + snprintf (data.str, sizeof(data.str), "%s - %s", radio, songtitle); } else { - strncpy(data.str, songtitle, sizeof(data.str)); + strncpy(data.str, songtitle, sizeof(data.str)-1); } data.str[sizeof(data.str) - 1] = '\0'; data.str_len = strlen(data.str) + 1; @@ -766,13 +763,11 @@ static int http_plugin_open (input_plugin_t *this_gen ) { } snprintf(this->buf + buflen, BUFSIZE - buflen, - "User-Agent: xine/%s\015\012", VERSION); - buflen = strlen(this->buf); - strncat (this->buf, "Accept: */*\015\012", BUFSIZE - buflen); - buflen = strlen(this->buf); - strncat (this->buf, "Icy-MetaData: 1\015\012", BUFSIZE - buflen); - buflen = strlen(this->buf); - strncat (this->buf, "\015\012", BUFSIZE - buflen); + "User-Agent: xine/%s\015\012" + "Accept: */*\015\012" + "Icy-MetaData: 1\015\012" + "\015\012", + VERSION); buflen = strlen(this->buf); if (_x_io_tcp_write (this->stream, this->fh, this->buf, buflen) != buflen) { _x_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "couldn't send request", NULL); diff --git a/src/input/libdvdnav/remap.c b/src/input/libdvdnav/remap.c index 86cf3a4ad..f2049ac06 100644 --- a/src/input/libdvdnav/remap.c +++ b/src/input/libdvdnav/remap.c @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: remap.c,v 1.5 2006/09/17 13:01:08 valtri Exp $ + * $Id: remap.c,v 1.6 2006/12/08 16:26:10 mshopf Exp $ */ #include @@ -193,10 +193,7 @@ remap_t* remap_loadmap( char *title) { /* Build the map filename */ home = getenv("HOME"); assert(home); - strncpy(fname, home, sizeof(fname)); - strncat(fname, "/.dvdnav/", sizeof(fname)); - strncat(fname, title, sizeof(fname)); - strncat(fname, ".map", sizeof(fname)); + snprintf (fname, sizeof(fname), "%s/.dvdnav/%s.map", home, title); /* Open the map file */ fp = fopen( fname, "r"); diff --git a/src/input/vcd/libcdio/iso9660_fs.c b/src/input/vcd/libcdio/iso9660_fs.c index 0a2de8fa1..fff12cd7c 100644 --- a/src/input/vcd/libcdio/iso9660_fs.c +++ b/src/input/vcd/libcdio/iso9660_fs.c @@ -1,5 +1,5 @@ /* - $Id: iso9660_fs.c,v 1.6 2006/09/28 08:19:14 dgp85 Exp $ + $Id: iso9660_fs.c,v 1.7 2006/12/08 16:26:10 mshopf Exp $ Copyright (C) 2001 Herbert Valerio Riedel Copyright (C) 2003, 2004 Rocky Bernstein @@ -51,7 +51,7 @@ #include -static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.6 2006/09/28 08:19:14 dgp85 Exp $"; +static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.7 2006/12/08 16:26:10 mshopf Exp $"; /* Implementation of iso9660_t type */ struct _iso9660 { @@ -1200,9 +1200,7 @@ find_fs_lsn_recurse (CdIo *p_cdio, const char pathname[], lsn_t lsn) char _fullname[4096] = { 0, }; char *filename = (char *) statbuf->filename; - snprintf (_fullname, sizeof (_fullname), "%s%s", pathname, filename); - - strncat (_fullname, "/", sizeof (_fullname)); + snprintf (_fullname, sizeof (_fullname), "%s%s/", pathname, filename); if (statbuf->type == _STAT_DIR && strcmp ((char *) statbuf->filename, ".") diff --git a/src/input/vcd/libvcd/vcd.c b/src/input/vcd/libvcd/vcd.c index e9618a7d7..0772149ec 100644 --- a/src/input/vcd/libvcd/vcd.c +++ b/src/input/vcd/libvcd/vcd.c @@ -1,5 +1,5 @@ /* - $Id: vcd.c,v 1.3 2005/01/01 02:43:59 rockyb Exp $ + $Id: vcd.c,v 1.4 2006/12/08 16:26:10 mshopf Exp $ Copyright (C) 2000, 2004 Herbert Valerio Riedel @@ -49,7 +49,7 @@ #include "util.h" #include "vcd.h" -static const char _rcsid[] = "$Id: vcd.c,v 1.3 2005/01/01 02:43:59 rockyb Exp $"; +static const char _rcsid[] = "$Id: vcd.c,v 1.4 2006/12/08 16:26:10 mshopf Exp $"; static const char zero[CDIO_CD_FRAMESIZE_RAW] = { 0, }; @@ -1664,7 +1664,7 @@ _write_sequence (VcdObj *obj, int track_idx) track->info->ahdr[i].bitrate / 1024, _mode_str[track->info->ahdr[i].mode]); - strncat (buf2, buf, sizeof(buf)); + strncat (buf2, buf, sizeof(buf2) - strlen(buf2) - 1); } vcd_info ("writing track %d, %s, %s, %s...", track_idx + 2, diff --git a/src/libsputext/demux_sputext.c b/src/libsputext/demux_sputext.c index d5c591212..db0b826de 100644 --- a/src/libsputext/demux_sputext.c +++ b/src/libsputext/demux_sputext.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_sputext.c,v 1.49 2006/07/10 22:08:30 dgp85 Exp $ + * $Id: demux_sputext.c,v 1.50 2006/12/08 16:26:10 mshopf Exp $ * * code based on old libsputext/xine_decoder.c * @@ -915,7 +915,8 @@ static subtitle_t *sub_read_line_jacobsub(demux_sputext_t *this, subtitle_t *cur return NULL; trail_space(directive); strncat(line2, directive, - (LINE_LEN > 511) ? LINE_LEN : 511); + ((LINE_LEN > 511) ? LINE_LEN-1 : 511) + - strlen(line2)); break; } default: diff --git a/src/libw32dll/wine/module.c b/src/libw32dll/wine/module.c index 6e9235584..c37073d18 100644 --- a/src/libw32dll/wine/module.c +++ b/src/libw32dll/wine/module.c @@ -389,9 +389,7 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) strncpy(path, libname, sizeof(path) - 1); } else { /* check default user path */ - strncpy(path, win32_def_path, sizeof(path) - 2); - strcat(path, "/"); - strncat(path, libname, sizeof(path) - strlen(libname)); + snprintf(path, sizeof(path), "%s/%s", win32_def_path, libname); } wm = MODULE_LoadLibraryExA( path, hfile, flags ); -- cgit v1.2.3 From 5503c1f3bf18cc0f74913040f7fc91ad7a70daf6 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Fri, 8 Dec 2006 22:26:22 +0000 Subject: Prevent segfaults on out-of-range last_channel. CVS patchset: 8408 CVS date: 2006/12/08 22:26:22 --- src/input/input_dvb.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 8d06cb61e..dbec9ff17 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -3183,15 +3183,14 @@ static char **dvb_class_get_autoplay_list(input_class_t * this_gen, } if (lastchannel_enable.num_value){ - if (lastchannel.num_value>-1) /* plugin has been used before - channel is valid */ - sprintf(foobuffer,"dvb://%s",channels[lastchannel.num_value].name); - else /* set a reasonable default - the first channel */ - sprintf(foobuffer,"dvb://%s",channels[lastchannel_enable.num_value].name); - if(class->autoplaylist[0]) - free(class->autoplaylist[0]); - class->autoplaylist[0]=xine_xmalloc(128); - _x_assert(class->autoplaylist[0] != NULL); - class->autoplaylist[0]=strdup(foobuffer); + if (lastchannel.num_value > -1 && lastchannel.num_value < num_channels) + /* plugin has been used before - channel is valid */ + sprintf (foobuffer, "dvb://%s", channels[lastchannel.num_value].name); + else + /* set a reasonable default - the first channel */ + sprintf (foobuffer, "dvb://%s", num_channels ? channels[0].name : "0"); + free(class->autoplaylist[0]); + class->autoplaylist[0]=strdup(foobuffer); } free(tmpbuffer); -- cgit v1.2.3 From b3dfbb54c0dd53f0da0c6c2672562c646e6cdda6 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Wed, 13 Dec 2006 10:36:58 +0000 Subject: Added support for OSD layers with inverted alpha (e.g. Unichrome). CVS patchset: 8410 CVS date: 2006/12/13 10:36:58 --- src/video_out/video_out_directfb.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/video_out/video_out_directfb.c b/src/video_out/video_out_directfb.c index 960bcdbf4..a51940952 100644 --- a/src/video_out/video_out_directfb.c +++ b/src/video_out/video_out_directfb.c @@ -1444,7 +1444,14 @@ static void init_subpicture (directfb_driver_t *this) { config.flags = DLCONF_PIXELFORMAT | DLCONF_OPTIONS; config.pixelformat = DSPF_ARGB; config.options = DLOP_ALPHACHANNEL; + ret = this->underlay->SetConfiguration (this->underlay, &config); + if (ret) { + /* try AiRGB if the previous failed */ + config.pixelformat = DSPF_AiRGB; + ret = this->underlay->SetConfiguration (this->underlay, &config); + } + if (ret == DFB_OK) { this->underlay->AddRef (this->underlay); this->spic_layer = this->underlay; -- cgit v1.2.3 From 952847b799797174c03ad074f5651210f1c6ebb2 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 13 Dec 2006 18:30:30 +0000 Subject: Lock the log buffer while updating it. CVS patchset: 8411 CVS date: 2006/12/13 18:30:30 --- src/xine-engine/scratch.c | 30 ++++++++++++++++++++---------- src/xine-engine/scratch.h | 4 +++- src/xine-engine/xine.c | 21 +++++++++++++++------ src/xine-engine/xine_internal.h | 3 ++- 4 files changed, 40 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/xine-engine/scratch.c b/src/xine-engine/scratch.c index eac5eee63..d750a8a07 100644 --- a/src/xine-engine/scratch.c +++ b/src/xine-engine/scratch.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: scratch.c,v 1.22 2006/10/18 18:46:17 hadess Exp $ + * $Id: scratch.c,v 1.23 2006/12/13 18:30:30 dsalt Exp $ * * top-level xine functions * @@ -47,6 +47,8 @@ static void __attribute__((__format__(__printf__, 2, 0))) struct tm tm; size_t l; + pthread_mutex_lock (&this->lock); + time (&t); localtime_r (&t, &tm); @@ -61,37 +63,46 @@ static void __attribute__((__format__(__printf__, 2, 0))) lprintf ("printing format %s to line %d\n", format, this->cur); this->cur = (this->cur + 1) % this->num_lines; + + pthread_mutex_unlock (&this->lock); } static const char **scratch_get_content (scratch_buffer_t *this) { int i, j; + pthread_mutex_lock (&this->lock); + for(i = 0, j = (this->cur - 1); i < this->num_lines; i++, j--) { if(j < 0) j = (this->num_lines - 1); - this->ordered[i] = this->lines[j]; + free (this->ordered[i]); + this->ordered[i] = this->lines[j] ? strdup (this->lines[j]) : NULL; lprintf ("line %d contains >%s<\n", i , this->lines[j]); } + pthread_mutex_unlock (&this->lock); return this->ordered; } static void scratch_dispose (scratch_buffer_t *this) { - char *mem; int i; - mem = (char *) this->lines[0]; - + pthread_mutex_lock (&this->lock); + for(i = 0; i < this->num_lines; i++ ) { + free(this->ordered[i]); free(this->lines[i]); - this->lines[i] = NULL; } free (this->lines); free (this->ordered); + + pthread_mutex_unlock (&this->lock); + pthread_mutex_destroy (&this->lock); + free (this); } @@ -104,16 +115,15 @@ scratch_buffer_t *_x_new_scratch_buffer (int num_lines) { this->lines = xine_xmalloc (sizeof (char *) * (num_lines + 1)); this->ordered = xine_xmalloc (sizeof (char *) * (num_lines + 1)); - for (i = 0; i < num_lines; i++) - this->lines[i] = NULL; + for (i = 0; i <= num_lines; i++) + this->lines[i] = this->ordered[i] = NULL; - this->ordered[i] = NULL; - this->lines[i] = NULL; this->scratch_printf = scratch_printf; this->get_content = scratch_get_content; this->dispose = scratch_dispose; this->num_lines = num_lines; this->cur = 0; + pthread_mutex_init (&this->lock, NULL); return this; } diff --git a/src/xine-engine/scratch.h b/src/xine-engine/scratch.h index d23d68503..719a9f8d9 100644 --- a/src/xine-engine/scratch.h +++ b/src/xine-engine/scratch.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: scratch.h,v 1.11 2006/09/26 05:19:49 dgp85 Exp $ + * $Id: scratch.h,v 1.12 2006/12/13 18:30:30 dsalt Exp $ * * scratch buffer for log output * @@ -27,6 +27,7 @@ #define HAVE_SCRATCH_H #include +#include typedef struct scratch_buffer_s scratch_buffer_t; @@ -50,6 +51,7 @@ struct scratch_buffer_s { int num_lines; int cur; + pthread_mutex_t lock; }; scratch_buffer_t *_x_new_scratch_buffer (int num_lines) XINE_PROTECTED; diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 78476a768..2440e2d95 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine.c,v 1.335 2006/10/16 22:18:24 valtri Exp $ + * $Id: xine.c,v 1.336 2006/12/13 18:30:30 dsalt Exp $ */ /* @@ -1604,9 +1604,10 @@ void xine_init (xine_t *this) { this->streams = xine_list_new(); /* - * streams lock + * locks */ pthread_mutex_init (&this->streams_lock, NULL); + pthread_mutex_init (&this->log_lock, NULL); /* * start metronom clock @@ -1951,12 +1952,21 @@ const char *const *xine_get_log_names (xine_t *this) { return log_sections; } +static inline void check_log_alloc (xine_t *this, int buf) +{ + pthread_mutex_lock (&this->log_lock); + + if ( ! this->log_buffers[buf] ) + this->log_buffers[buf] = _x_new_scratch_buffer(150); + + pthread_mutex_unlock (&this->log_lock); +} + void xine_log (xine_t *this, int buf, const char *format, ...) { va_list argp; char buffer[SCRATCH_LINE_LEN_MAX]; - if ( ! this->log_buffers[buf] ) - this->log_buffers[buf] = _x_new_scratch_buffer(150); + check_log_alloc (this, buf); va_start (argp, format); this->log_buffers[buf]->scratch_printf (this->log_buffers[buf], format, argp); @@ -1973,8 +1983,7 @@ void xine_log (xine_t *this, int buf, const char *format, ...) { void xine_vlog(xine_t *this, int buf, const char *format, va_list args) { - if ( ! this->log_buffers[buf] ) - this->log_buffers[buf] = _x_new_scratch_buffer(150); + check_log_alloc (this, buf); this->log_buffers[buf]->scratch_printf(this->log_buffers[buf], format, args); } diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index 8ee5d8219..e25339c46 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_internal.h,v 1.179 2006/10/02 15:56:06 valtri Exp $ + * $Id: xine_internal.h,v 1.180 2006/12/13 18:30:30 dsalt Exp $ * */ @@ -118,6 +118,7 @@ struct xine_s { #ifdef XINE_ENGINE_INTERNAL xine_ticket_t *port_ticket; + pthread_mutex_t log_lock; #endif }; -- cgit v1.2.3 From 42b4630389962e4865ea1d45a01baa5a9eb86b12 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 13 Dec 2006 19:14:19 +0000 Subject: Close the device if it was opened but the content isn't that of a VCD. Holding it open prevents eject from working. CVS patchset: 8412 CVS date: 2006/12/13 19:14:19 --- src/input/vcd/vcdio.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/input/vcd/vcdio.c b/src/input/vcd/vcdio.c index 7fee5a0db..31cc0cd49 100644 --- a/src/input/vcd/vcdio.c +++ b/src/input/vcd/vcdio.c @@ -1,5 +1,5 @@ /* - $Id: vcdio.c,v 1.7 2005/06/14 17:27:12 rockyb Exp $ + $Id: vcdio.c,v 1.8 2006/12/13 19:14:19 dsalt Exp $ Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein @@ -103,9 +103,21 @@ vcdio_open(vcdplayer_t *p_vcdplayer, char *intended_vcd_device) } } - if ( vcdinfo_open(&p_vcdplayer->vcd, &intended_vcd_device, DRIVER_UNKNOWN, - NULL) != VCDINFO_OPEN_VCD) { - return false; + switch ( vcdinfo_open(&p_vcdplayer->vcd, &intended_vcd_device, + DRIVER_UNKNOWN, NULL)) + { + case VCDINFO_OPEN_ERROR: + /* Failed to open the device => return failure */ + return false; + + case VCDINFO_OPEN_VCD: + /* Opened the device, and it's a VCD => proceed */ + break; + + default: + /* Opened the device, but it's not a VCD => close it & return failure */ + vcdinfo_close(p_vcdplayer->vcd); + return false; } p_vcdinfo = p_vcdplayer->vcd; -- cgit v1.2.3 From 66a3c5bcaaf6f4ac936554ebf39eaaec4535e034 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 13 Dec 2006 19:21:10 +0000 Subject: Close the device after building the MRL list if it wasn't previously open. Holding it open prevents eject from working. CVS patchset: 8413 CVS date: 2006/12/13 19:21:10 --- src/input/vcd/xineplug_inp_vcd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/input/vcd/xineplug_inp_vcd.c b/src/input/vcd/xineplug_inp_vcd.c index baa6b0d9a..c5cd7c031 100644 --- a/src/input/vcd/xineplug_inp_vcd.c +++ b/src/input/vcd/xineplug_inp_vcd.c @@ -1,5 +1,5 @@ /* - $Id: xineplug_inp_vcd.c,v 1.50 2006/07/10 22:08:29 dgp85 Exp $ + $Id: xineplug_inp_vcd.c,v 1.51 2006/12/13 19:21:10 dsalt Exp $ Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein @@ -322,6 +322,7 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device) unsigned int n, i=0; unsigned int i_entries; vcdinfo_obj_t *p_vcdinfo; + int was_open; if (NULL == class) { LOG_MSG("%s", _("was passed a null class parameter")); @@ -331,7 +332,7 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device) vcdplayer = &(my_vcd.player); /* If VCD already open, we gotta close and stop it. */ - if (vcdplayer->b_opened) { + if ((was_open = vcdplayer->b_opened)) { vcd_close(class); } @@ -374,6 +375,8 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device) if (NULL == class->mrls) { LOG_ERR("Can't calloc %d MRL entries", class->num_mrls); class->num_mrls = 0; + if (!was_open) + vcdio_close(vcdplayer); return false; } @@ -445,6 +448,8 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device) class->mrl_track_offset, class->mrl_entry_offset, class->mrl_play_offset, class->mrl_segment_offset); + if (!was_open) + vcdio_close(vcdplayer); return true; } -- cgit v1.2.3 From 25d5d0647f9da129576373972ad53e107743eeb4 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 13 Dec 2006 20:52:27 +0000 Subject: Don't leak directory handles when reading DVDs or DVD images. Does not affect access via DVD device or image. CVS patchset: 8414 CVS date: 2006/12/13 20:52:27 --- src/input/libdvdnav/dvd_reader.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/input/libdvdnav/dvd_reader.c b/src/input/libdvdnav/dvd_reader.c index e71d6ca42..7ecd8f1ba 100644 --- a/src/input/libdvdnav/dvd_reader.c +++ b/src/input/libdvdnav/dvd_reader.c @@ -603,10 +603,12 @@ static int findDirFile( const char *path, const char *file, char *filename ) sprintf( filename, "%s%s%s", path, ( ( path[ strlen( path ) - 1 ] == '/' ) ? "" : "/" ), ent->d_name ); + closedir (dir); return 0; } } + closedir (dir); return -1; } -- cgit v1.2.3 From 60736763897ef57e53327f5b2cdc4b4208deb6b0 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Thu, 14 Dec 2006 10:14:48 +0000 Subject: Added configure option --enable-antialing (disabled by default because RLE encoded antialiased fonts don't look good). CVS patchset: 8415 CVS date: 2006/12/14 10:14:48 --- src/xine-engine/osd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index b5f45d0af..210bcf26e 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -102,6 +102,12 @@ # define KERNING_DEFAULT ft_kerning_default #endif +#ifdef ENABLE_ANTIALIASING +# define FT_LOAD_FLAGS FT_LOAD_DEFAULT +#else +# define FT_LOAD_FLAGS (FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING) +#endif + typedef struct osd_fontchar_s { uint16_t code; uint16_t width; @@ -1171,7 +1177,7 @@ static int osd_render_text (osd_object_t *osd, int x1, int y1, } previous = i; - if (FT_Load_Glyph(osd->ft2->face, i, FT_LOAD_DEFAULT)) { + if (FT_Load_Glyph(osd->ft2->face, i, FT_LOAD_FLAGS)) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("osd: error loading glyph\n")); continue; } -- cgit v1.2.3 From 74d71e190c2a7013ca4727b254eac23e63fdfec2 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Thu, 14 Dec 2006 18:29:02 +0000 Subject: Fixed video codec parsing (NOTE: we need vp6 codec from ffmpeg). Added support for audio packet demuxing. Added support for seeking. CVS patchset: 8416 CVS date: 2006/12/14 18:29:02 --- src/demuxers/demux_flv.c | 431 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 313 insertions(+), 118 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 57f83e002..5bc09905f 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -20,11 +20,11 @@ /* * Flash Video (.flv) File Demuxer - * by Mike Melanson (melanson@pcisys.net) + * by Mike Melanson (melanson@pcisys.net) and Claudio Ciccani (klan@directfb.org) * For more information on the FLV file format, visit: * http://download.macromedia.com/pub/flash/flash_file_format_specification.pdf * - * $Id: demux_flv.c,v 1.9 2006/07/10 22:08:13 dgp85 Exp $ + * $Id: demux_flv.c,v 1.10 2006/12/14 18:29:02 klan Exp $ */ #ifdef HAVE_CONFIG_H @@ -53,101 +53,232 @@ typedef struct { demux_plugin_t demux_plugin; + xine_t *xine; xine_stream_t *stream; fifo_buffer_t *video_fifo; fifo_buffer_t *audio_fifo; input_plugin_t *input; int status; - unsigned int video_type; - unsigned int audio_type; - - off_t data_start; - off_t data_size; - - unsigned char bih[sizeof(xine_bmiheader)]; - xine_waveformatex wave; - + unsigned char flags; + unsigned int movie_start; + + unsigned char got_video; + unsigned char got_audio; + + unsigned int cur_pts; + + int64_t last_pts[2]; + int send_newpts; + int buf_flag_seek; } demux_flv_t ; typedef struct { demux_class_t demux_class; } demux_flv_class_t; + +#define FLV_FLAG_HAS_VIDEO 0x01 +#define FLV_FLAG_HAS_AUDIO 0x04 + +#define FLV_TAG_TYPE_AUDIO 0x08 +#define FLV_TAG_TYPE_VIDEO 0x09 +#define FLV_TAG_TYPE_SCRIPT 0x12 + +#define FLV_SOUND_FORMAT_PCM_BE 0x00 +#define FLV_SOUND_FORMAT_ADPCM 0x01 +#define FLV_SOUND_FORMAT_MP3 0x02 +#define FLV_SOUND_FORMAT_PCM_LE 0x03 +#define FLV_SOUND_FORMAT_NELLY8 0x05 /* Nellymoser 8KHz */ +#define FLV_SOUND_FORMAT_NELLY 0x06 /* Nellymoser */ + +#define FLV_VIDEO_FORMAT_FLV1 0x02 /* Sorenson H.263 */ +#define FLV_VIDEO_FORMAT_SCREEN 0x03 +#define FLV_VIDEO_FORMAT_VP6 0x04 /* On2 VP6 */ +#define FLV_VIDEO_FORMAT_VP6A 0x05 /* On2 VP6 with alphachannel */ +#define FLV_VIDEO_FORMAT_SCREEN2 0x06 + + +/* redefine abs as macro to handle 64-bit diffs. + i guess llabs may not be available everywhere */ +#define abs(x) ( ((x)<0) ? -(x) : (x) ) + +#define WRAP_THRESHOLD 220000 +#define PTS_AUDIO 0 +#define PTS_VIDEO 1 + +static void check_newpts(demux_flv_t *this, int64_t pts, int video) { + int64_t diff; + + diff = pts - this->last_pts[video]; + lprintf ("check_newpts %lld\n", pts); + + if (pts && (this->send_newpts || (this->last_pts[video] && abs(diff)>WRAP_THRESHOLD))) { + lprintf ("diff=%lld\n", diff); + + if (this->buf_flag_seek) { + _x_demux_control_newpts(this->stream, pts, BUF_FLAG_SEEK); + this->buf_flag_seek = 0; + } else { + _x_demux_control_newpts(this->stream, pts, 0); + } + this->send_newpts = 0; + this->last_pts[1-video] = 0; + } + + if (pts) + this->last_pts[video] = pts; +} + /* returns 1 if the FLV file was opened successfully, 0 otherwise */ static int open_flv_file(demux_flv_t *this) { + unsigned char buffer[9]; - unsigned char buffer[4]; - off_t first_offset; - - if (_x_demux_read_header(this->input, buffer, 4) != 4) + if (_x_demux_read_header(this->input, buffer, 9) != 9) return 0; if ((buffer[0] != 'F') || (buffer[1] != 'L') || (buffer[2] != 'V')) return 0; + + if (buffer[3] != 0x01) { + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("unsupported FLV version (%d).\n"), buffer[3]); + return 0; + } - this->video_type = this->audio_type = 0; - if (buffer[3] & 0x1) - this->video_type = BUF_VIDEO_FLV1; -/* buffer[3] * 0x4 indicates audio, possibly always MP3; deal with - that later */ - - /* file is qualified at this point; position to start of first packet */ - this->input->seek(this->input, 5, SEEK_SET); - if (this->input->read(this->input, buffer, 4) != 4) + this->flags = buffer[4]; + if ((this->flags & (FLV_FLAG_HAS_VIDEO | FLV_FLAG_HAS_AUDIO)) == 0) { + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("neither video nor audio stream in this file.\n")); return 0; + } - first_offset = BE_32(buffer); - this->input->seek(this->input, first_offset, SEEK_SET); + this->movie_start = BE_32(&buffer[5]); + this->input->seek(this->input, this->movie_start, SEEK_SET); + lprintf(" qualified FLV file, repositioned @ offset 0x%" PRIxMAX "\n", - (intmax_t)first_offset); + (intmax_t)this->movie_start); return 1; } -static int demux_flv_send_chunk(demux_plugin_t *this_gen) { - - demux_flv_t *this = (demux_flv_t *) this_gen; - buf_element_t *buf = NULL; - unsigned int remaining_bytes; - unsigned char chunk_type, sub_type; - int64_t pts; - - unsigned char buffer[12]; - - lprintf (" sending FLV chunk...\n"); - this->input->seek(this->input, 4, SEEK_CUR); - if (this->input->read(this->input, buffer, 12) != 12) { - this->status = DEMUX_FINISHED; - return this->status; - } +static int read_flv_packet(demux_flv_t *this) { + fifo_buffer_t *fifo = NULL; + buf_element_t *buf = NULL; + unsigned char buffer[12]; + unsigned char tag_type; + unsigned int remaining_bytes; + unsigned int buf_type = 0; + int64_t pts; + + while (1) { + lprintf (" reading FLV tag...\n"); + this->input->seek(this->input, 4, SEEK_CUR); + if (this->input->read(this->input, buffer, 11) != 11) { + this->status = DEMUX_FINISHED; + return this->status; + } - chunk_type = buffer[0]; - remaining_bytes = BE_32(&buffer[0]); - remaining_bytes &= 0x00FFFFFF; - pts = BE_32(&buffer[3]); - pts &= 0x00FFFFFF; - sub_type = buffer[11]; - - /* Flash timestamps are in milliseconds; multiply by 90 to get xine pts */ - pts *= 90; - - lprintf (" chunk_type = %X, 0x%X -1 bytes, pts %lld, sub-type = %X\n", - chunk_type, remaining_bytes, pts, sub_type); - - /* only handle the chunk right now if chunk type is 9 and lower nibble - * of sub-type is 2 */ - if ((chunk_type != 9) || ((sub_type & 0x0F) != 2)) { - this->input->seek(this->input, remaining_bytes - 1, SEEK_CUR); - } else { - /* send the chunk off to the video demuxer */ - remaining_bytes--; /* sub-type byte does not count */ + tag_type = buffer[0]; + remaining_bytes = BE_24(&buffer[1]); + pts = BE_24(&buffer[4]) | (buffer[7] << 24); + + lprintf(" tag_type = 0x%02X, 0x%X bytes, pts %lld\n", + tag_type, remaining_bytes, pts/90); + + switch (tag_type) { + case FLV_TAG_TYPE_AUDIO: + lprintf(" got audio tag..\n"); + if (this->input->read(this->input, buffer, 1) != 1) { + this->status = DEMUX_FINISHED; + return this->status; + } + remaining_bytes--; + + switch (buffer[0] >> 4) { + case FLV_SOUND_FORMAT_PCM_BE: + buf_type = BUF_AUDIO_LPCM_BE; + break; + case FLV_SOUND_FORMAT_MP3: + buf_type = BUF_AUDIO_MPEG; + break; + case FLV_SOUND_FORMAT_PCM_LE: + buf_type = BUF_AUDIO_LPCM_LE; + break; + default: + lprintf(" unsupported audio format (%d)...\n", buffer[0] >> 4); + buf_type = BUF_AUDIO_UNKNOWN; + break; + } + + fifo = this->audio_fifo; + if (!this->got_audio) { + /* send init info to audio decoder */ + buf = fifo->buffer_pool_alloc(fifo); + buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END; + buf->decoder_info[0] = 0; + buf->decoder_info[1] = 44100 >> (3 - ((buffer[0] >> 2) & 3)); /* samplerate */ + buf->decoder_info[2] = (buffer[0] & 2) ? 16 : 8; /* bits per sample */ + buf->decoder_info[3] = (buffer[0] & 1) + 1; /* channels */ + buf->size = 0; /* no extra data */ + buf->type = buf_type; + fifo->put(fifo, buf); + this->got_audio = 1; + } + break; + + case FLV_TAG_TYPE_VIDEO: + lprintf(" got video tag..\n"); + if (this->input->read(this->input, buffer, 1) != 1) { + this->status = DEMUX_FINISHED; + return this->status; + } + remaining_bytes--; + + switch (buffer[0] & 0x0F) { + case FLV_VIDEO_FORMAT_FLV1: + buf_type = BUF_VIDEO_FLV1; + break; + case FLV_VIDEO_FORMAT_VP6: + buf_type = BUF_VIDEO_VP6; + break; + default: + lprintf(" unsupported video format (%d)...\n", buffer[0] & 0x0F); + buf_type = BUF_VIDEO_UNKNOWN; + break; + } + + fifo = this->video_fifo; + if (!this->got_video) { + /* send init info to video decoder; send the bitmapinfo header to the decoder + * primarily as a formality since there is no real data inside */ + buf = fifo->buffer_pool_alloc(fifo); + buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END; + buf->decoder_info[0] = 7470; /* initial duration */ + buf->size = 0; + buf->type = buf_type; + fifo->put(fifo, buf); + this->got_video = 1; + } + break; + + default: + lprintf(" skipping packet...\n"); + this->input->seek(this->input, remaining_bytes, SEEK_CUR); + continue; + } + while (remaining_bytes) { - buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->type = BUF_VIDEO_FLV1; - if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * - 65535 / this->input->get_length (this->input) ); + buf = fifo->buffer_pool_alloc(fifo); + buf->type = buf_type; + buf->pts = (int64_t) pts * 90; + check_newpts(this, buf->pts, (tag_type == FLV_TAG_TYPE_VIDEO)); + + buf->extra_info->input_time = pts; + if (this->input->get_length(this->input)) { + buf->extra_info->input_normpos = (int)( (double)this->input->get_current_pos(this->input) * + 65535 / this->input->get_length(this->input) ); + } if (remaining_bytes > buf->max_size) buf->size = buf->max_size; @@ -158,25 +289,93 @@ static int demux_flv_send_chunk(demux_plugin_t *this_gen) { if (!remaining_bytes) buf->decoder_flags |= BUF_FLAG_FRAME_END; - if (this->input->read(this->input, buf->content, buf->size) != - buf->size) { + if (this->input->read(this->input, buf->content, buf->size) != buf->size) { buf->free_buffer(buf); this->status = DEMUX_FINISHED; break; } - buf->pts = pts; - buf->extra_info->input_time = buf->pts / 90; - this->video_fifo->put(this->video_fifo, buf); + fifo->put(fifo, buf); } + + this->cur_pts = pts; + break; } + + return this->status; +} + +static int seek_flv_file(demux_flv_t *this, int seek_pts) { + unsigned char buffer[16]; + int next_tag = 0; + int do_rewind = (seek_pts < this->cur_pts); + + if (this->cur_pts == seek_pts) + return this->status; + + if (seek_pts == 0) { + this->input->seek(this->input, this->movie_start, SEEK_SET); + this->cur_pts = 0; + return this->status; + } + + lprintf(" seeking %s to %d...\n", + do_rewind ? "backward" : "forward", seek_pts); + + while (do_rewind ? (seek_pts < this->cur_pts) : (seek_pts > this->cur_pts)) { + unsigned char tag_type; + int data_size; + int ptag_size; + unsigned int pts; + + if (next_tag) + this->input->seek(this->input, next_tag, SEEK_CUR); + + if (this->input->read(this->input, buffer, 16) != 16) { + this->status = DEMUX_FINISHED; + return this->status; + } + + ptag_size = BE_32(&buffer[0]); + tag_type = buffer[4]; + data_size = BE_24(&buffer[5]); + pts = BE_24(&buffer[8]) | (buffer[11] << 24); + + if (do_rewind) { + if (!ptag_size) break; + next_tag = -(ptag_size + 16 + 4); + } + else { + next_tag = data_size - 1; + } + + if (this->flags & FLV_FLAG_HAS_VIDEO) { + /* sync to video key frame */ + if (tag_type != FLV_TAG_TYPE_VIDEO || (buffer[15] >> 4) != 0x01) + continue; + lprintf(" video keyframe found at %d...\n", pts); + } + this->cur_pts = pts; + } + + /* seek back to the beginning of the tag */ + this->input->seek(this->input, -16, SEEK_CUR); + + lprintf( " seeked to %d.\n", this->cur_pts); return this->status; } + +static int demux_flv_send_chunk(demux_plugin_t *this_gen) { + demux_flv_t *this = (demux_flv_t *) this_gen; + + return read_flv_packet(this); +} + static void demux_flv_send_headers(demux_plugin_t *this_gen) { demux_flv_t *this = (demux_flv_t *) this_gen; - buf_element_t *buf; + int i; this->video_fifo = this->stream->video_fifo; this->audio_fifo = this->stream->audio_fifo; @@ -185,24 +384,23 @@ static void demux_flv_send_headers(demux_plugin_t *this_gen) { /* load stream information */ _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, - (this->video_type ? 1 : 0)); + (this->flags & FLV_FLAG_HAS_VIDEO) ? 1 : 0); _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, - (this->audio_type ? 1 : 0)); + (this->flags & FLV_FLAG_HAS_AUDIO) ? 1 : 0); /* send start buffers */ _x_demux_control_start(this->stream); - /* send init info to decoders; send the bitmapinfo header to the decoder - * primarily as a formality since there is no real data inside */ - buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAMERATE| - BUF_FLAG_FRAME_END; - buf->decoder_info[0] = 7470; /* initial duration */ - memcpy(buf->content, this->bih, sizeof(xine_bmiheader)); - buf->size = sizeof(xine_bmiheader); - buf->type = BUF_VIDEO_FLV1; - this->video_fifo->put (this->video_fifo, buf); - + /* find first audio/video packets and send headers */ + for (i = 0; i < 20; i++) { + if (read_flv_packet(this) != DEMUX_OK) + break; + if (((this->flags & FLV_FLAG_HAS_VIDEO) && this->got_video) && + ((this->flags & FLV_FLAG_HAS_AUDIO) && this->got_audio)) { + lprintf(" headers sent...\n"); + break; + } + } } static int demux_flv_seek (demux_plugin_t *this_gen, @@ -210,10 +408,16 @@ static int demux_flv_seek (demux_plugin_t *this_gen, demux_flv_t *this = (demux_flv_t *) this_gen; - /* if thread is not running, initialize demuxer */ - if( !playing ) { - this->status = DEMUX_OK; - } + this->status = DEMUX_OK; + + if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) { + seek_flv_file(this, start_time); + + if (playing) { + this->buf_flag_seek = 1; + _x_demux_flush_engine(this->stream); + } + } return this->status; } @@ -247,10 +451,10 @@ static int demux_flv_get_optional_data(demux_plugin_t *this_gen, static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *stream, input_plugin_t *input) { - - demux_flv_t *this; + demux_flv_t *this; this = xine_xmalloc (sizeof (demux_flv_t)); + this->xine = stream->xine; this->stream = stream; this->input = input; @@ -267,33 +471,24 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->status = DEMUX_FINISHED; switch (stream->content_detection_method) { + case METHOD_BY_EXTENSION: + if (!_x_demux_check_extension(input->get_mrl(input), "flv")) { + free (this); + return NULL; + } + + /* falling through is intended */ + case METHOD_BY_CONTENT: + case METHOD_EXPLICIT: + if (!open_flv_file(this)) { + free (this); + return NULL; + } + break; - case METHOD_BY_EXTENSION: { - char *extensions, *mrl; - - mrl = input->get_mrl (input); - extensions = class_gen->get_extensions (class_gen); - - if (!_x_demux_check_extension (mrl, extensions)) { - free (this); - return NULL; - } - } - /* falling through is intended */ - - case METHOD_BY_CONTENT: - case METHOD_EXPLICIT: - - if (!open_flv_file(this)) { + default: free (this); return NULL; - } - - break; - - default: - free (this); - return NULL; } return &this->demux_plugin; @@ -312,7 +507,7 @@ static char *get_extensions (demux_class_t *this_gen) { } static char *get_mimetypes (demux_class_t *this_gen) { - return NULL; + return "video/x-flv"; } static void class_dispose (demux_class_t *this_gen) { -- cgit v1.2.3 From d5030fca994e66508095b50b7d88237afe16d9ca Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Fri, 15 Dec 2006 09:39:40 +0000 Subject: Parse script objects and extract stream information. CVS patchset: 8417 CVS date: 2006/12/15 09:39:40 --- src/demuxers/demux_flv.c | 204 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 168 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 5bc09905f..290bd4ed9 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -24,7 +24,7 @@ * For more information on the FLV file format, visit: * http://download.macromedia.com/pub/flash/flash_file_format_specification.pdf * - * $Id: demux_flv.c,v 1.10 2006/12/14 18:29:02 klan Exp $ + * $Id: demux_flv.c,v 1.11 2006/12/15 09:39:40 klan Exp $ */ #ifdef HAVE_CONFIG_H @@ -61,7 +61,9 @@ typedef struct { int status; unsigned char flags; - unsigned int movie_start; + off_t start; /* in bytes */ + off_t size; /* in bytes */ + unsigned int length; /* in ms */ unsigned char got_video; unsigned char got_audio; @@ -98,6 +100,18 @@ typedef struct { #define FLV_VIDEO_FORMAT_VP6A 0x05 /* On2 VP6 with alphachannel */ #define FLV_VIDEO_FORMAT_SCREEN2 0x06 +#define FLV_DATA_TYPE_NUMBER 0x00 +#define FLV_DATA_TYPE_BOOL 0x01 +#define FLV_DATA_TYPE_STRING 0x02 +#define FLV_DATA_TYPE_OBJECT 0x03 +#define FLC_DATA_TYPE_CLIP 0x04 +#define FLV_DATA_TYPE_REFERENCE 0x07 +#define FLV_DATA_TYPE_ECMARRAY 0x08 +#define FLV_DATA_TYPE_ENDOBJECT 0x09 +#define FLV_DATA_TYPE_ARRAY 0x0a +#define FLV_DATA_TYPE_DATE 0x0b +#define FLV_DATA_TYPE_LONGSTRING 0x0c + /* redefine abs as macro to handle 64-bit diffs. i guess llabs may not be available everywhere */ @@ -153,8 +167,10 @@ static int open_flv_file(demux_flv_t *this) { return 0; } - this->movie_start = BE_32(&buffer[5]); - this->input->seek(this->input, this->movie_start, SEEK_SET); + this->start = BE_32(&buffer[5]); + this->size = this->input->get_length(this->input); + + this->input->seek(this->input, this->start, SEEK_SET); lprintf(" qualified FLV file, repositioned @ offset 0x%" PRIxMAX "\n", (intmax_t)this->movie_start); @@ -162,6 +178,114 @@ static int open_flv_file(demux_flv_t *this) { return 1; } +#define BE_F64(buf) ({\ + union { uint64_t q; double d; } _tmp;\ + _tmp.q = BE_64(buf);\ + _tmp.d;\ +})\ + +static int parse_flv_var(demux_flv_t *this, unsigned char *buf, int size, char *key) { + unsigned char *tmp = buf; + unsigned char *end = buf + size; + char *str; + unsigned char type; + int len, num; + + if (size < 1) + return 0; + + type = *tmp++; + + switch (type) { + case FLV_DATA_TYPE_NUMBER: + lprintf(" got number (%f)\n", BE_F64(tmp)); + if (key) { + double val = BE_F64(tmp); + if (!strcmp(key, "duration")) { + this->length = val * 1000.0; + } + else if (!strcmp(key, "width")) { + _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, val); + } + else if (!strcmp(key, "height")) { + _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, val); + } + } + tmp += 8; + break; + case FLV_DATA_TYPE_BOOL: + lprintf(" got bool (%d)\n", *tmp); + tmp++; + break; + case FLV_DATA_TYPE_STRING: + lprintf(" got string (%s)\n", tmp+2); + len = BE_16(tmp); + tmp += len + 2; + break; + case FLV_DATA_TYPE_OBJECT: + while ((len = BE_16(tmp)) && tmp < end) { + lprintf(" got object var (%s)\n", tmp+2); + str = tmp + 2; + tmp += len + 2; + len = parse_flv_var(this, tmp, end-tmp, str); + tmp += len; + } + break; + case FLV_DATA_TYPE_ECMARRAY: + lprintf(" got EMCA array (%d indices)\n", BE_32(tmp)); + num = BE_32(tmp); + tmp += 4; + while (num-- && tmp < end) { + lprintf(" got array key (%s)\n", tmp+2); + len = BE_16(tmp); + str = tmp + 2; + tmp += len + 2; + len = parse_flv_var(this, tmp, end-tmp, str); + tmp += len; + } + break; + case FLV_DATA_TYPE_ARRAY: + lprintf(" got array (%d indices)\n", BE_32(tmp)); + num = BE_32(tmp); + tmp += 4; + while (num-- && tmp < end) { + len = parse_flv_var(this, tmp, end-tmp, NULL); + tmp += len; + } + break; + case FLV_DATA_TYPE_DATE: + lprintf(" got date (%lld, %d)\n", BE_64(tmp), BE_16(tmp+8)); + tmp += 10; + break; + default: + lprintf(" got type %d\n", type); + break; + } + + return (tmp - buf); +} + +static void parse_flv_script(demux_flv_t *this, int size) { + unsigned char *buf = xine_xmalloc(size); + unsigned char *tmp = buf; + unsigned char *end = buf + size; + int len; + + if (this->input->read(this->input, buf, size ) != size) { + this->status = DEMUX_FINISHED; + return; + } + + while (tmp < end) { + len = parse_flv_var(this, tmp, end-tmp, NULL); + if (len < 1) + break; + tmp += len; + } + + free(buf); +} + static int read_flv_packet(demux_flv_t *this) { fifo_buffer_t *fifo = NULL; buf_element_t *buf = NULL; @@ -240,8 +364,9 @@ static int read_flv_packet(demux_flv_t *this) { buf_type = BUF_VIDEO_FLV1; break; case FLV_VIDEO_FORMAT_VP6: - buf_type = BUF_VIDEO_VP6; - break; + /* FIXME: we need ffmpeg's vp6 codec */ + /*buf_type = BUF_VIDEO_VP6; + break;*/ default: lprintf(" unsupported video format (%d)...\n", buffer[0] & 0x0F); buf_type = BUF_VIDEO_UNKNOWN; @@ -255,13 +380,18 @@ static int read_flv_packet(demux_flv_t *this) { buf = fifo->buffer_pool_alloc(fifo); buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END; buf->decoder_info[0] = 7470; /* initial duration */ - buf->size = 0; + buf->size = 0; /* no extra data */ buf->type = buf_type; fifo->put(fifo, buf); this->got_video = 1; } break; + case FLV_TAG_TYPE_SCRIPT: + lprintf(" got script tag...\n"); + parse_flv_script(this, remaining_bytes); + continue; + default: lprintf(" skipping packet...\n"); this->input->seek(this->input, remaining_bytes, SEEK_CUR); @@ -276,8 +406,8 @@ static int read_flv_packet(demux_flv_t *this) { buf->extra_info->input_time = pts; if (this->input->get_length(this->input)) { - buf->extra_info->input_normpos = (int)( (double)this->input->get_current_pos(this->input) * - 65535 / this->input->get_length(this->input) ); + buf->extra_info->input_normpos = + (int)((double)this->input->get_current_pos(this->input) * 65535.0 / this->size); } if (remaining_bytes > buf->max_size) @@ -305,44 +435,43 @@ static int read_flv_packet(demux_flv_t *this) { return this->status; } -static int seek_flv_file(demux_flv_t *this, int seek_pts) { +static void seek_flv_file(demux_flv_t *this, int seek_pts) { unsigned char buffer[16]; - int next_tag = 0; + unsigned int pts = this->cur_pts; + int len = 0; + int next_tag = 0; int do_rewind = (seek_pts < this->cur_pts); - - if (this->cur_pts == seek_pts) - return this->status; - + + lprintf(" seeking %s to %d...\n", + do_rewind ? "backward" : "forward", seek_pts); + if (seek_pts == 0) { - this->input->seek(this->input, this->movie_start, SEEK_SET); + this->input->seek(this->input, this->start, SEEK_SET); this->cur_pts = 0; - return this->status; + return; } - - lprintf(" seeking %s to %d...\n", - do_rewind ? "backward" : "forward", seek_pts); while (do_rewind ? (seek_pts < this->cur_pts) : (seek_pts > this->cur_pts)) { unsigned char tag_type; int data_size; int ptag_size; - unsigned int pts; if (next_tag) this->input->seek(this->input, next_tag, SEEK_CUR); - if (this->input->read(this->input, buffer, 16) != 16) { - this->status = DEMUX_FINISHED; - return this->status; + len = this->input->read(this->input, buffer, 16); + if (len != 16) { + len = (len < 0) ? 0 : len; + break; } - + ptag_size = BE_32(&buffer[0]); tag_type = buffer[4]; data_size = BE_24(&buffer[5]); pts = BE_24(&buffer[8]) | (buffer[11] << 24); if (do_rewind) { - if (!ptag_size) break; + if (!ptag_size) break; /* beginning of movie */ next_tag = -(ptag_size + 16 + 4); } else { @@ -359,11 +488,9 @@ static int seek_flv_file(demux_flv_t *this, int seek_pts) { } /* seek back to the beginning of the tag */ - this->input->seek(this->input, -16, SEEK_CUR); + this->input->seek(this->input, -len, SEEK_CUR); - lprintf( " seeked to %d.\n", this->cur_pts); - - return this->status; + lprintf( " seeked to %d.\n", pts); } @@ -411,11 +538,16 @@ static int demux_flv_seek (demux_plugin_t *this_gen, this->status = DEMUX_OK; if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) { - seek_flv_file(this, start_time); + if (start_pos && !start_time) + start_time = (int64_t) this->length * start_pos / 65535; + + if (!this->length || start_time < this->length) { + seek_flv_file(this, start_time); - if (playing) { - this->buf_flag_seek = 1; - _x_demux_flush_engine(this->stream); + if (playing) { + this->buf_flag_seek = 1; + _x_demux_flush_engine(this->stream); + } } } @@ -435,9 +567,9 @@ static int demux_flv_get_status (demux_plugin_t *this_gen) { } static int demux_flv_get_stream_length (demux_plugin_t *this_gen) { -/* demux_flv_t *this = (demux_flv_t *) this_gen;*/ + demux_flv_t *this = (demux_flv_t *) this_gen; - return 0; + return this->length; } static uint32_t demux_flv_get_capabilities(demux_plugin_t *this_gen) { -- cgit v1.2.3 From 1f4418dd9bfbc4110cd761afb6b832f261acf516 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Fri, 15 Dec 2006 11:31:28 +0000 Subject: Added BUF_AUDIO_FLVADPCM (Flash ADPCM). CVS patchset: 8418 CVS date: 2006/12/15 11:31:28 --- src/demuxers/demux_flv.c | 6 +++++- src/libffmpeg/audio_decoder.c | 4 +++- src/xine-engine/buffer.h | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 290bd4ed9..64aa23b53 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -24,7 +24,7 @@ * For more information on the FLV file format, visit: * http://download.macromedia.com/pub/flash/flash_file_format_specification.pdf * - * $Id: demux_flv.c,v 1.11 2006/12/15 09:39:40 klan Exp $ + * $Id: demux_flv.c,v 1.12 2006/12/15 11:31:28 klan Exp $ */ #ifdef HAVE_CONFIG_H @@ -273,6 +273,7 @@ static void parse_flv_script(demux_flv_t *this, int size) { if (this->input->read(this->input, buf, size ) != size) { this->status = DEMUX_FINISHED; + free(buf); return; } @@ -323,6 +324,9 @@ static int read_flv_packet(demux_flv_t *this) { case FLV_SOUND_FORMAT_PCM_BE: buf_type = BUF_AUDIO_LPCM_BE; break; + case FLV_SOUND_FORMAT_ADPCM: + buf_type = BUF_AUDIO_FLVADPCM; + break; case FLV_SOUND_FORMAT_MP3: buf_type = BUF_AUDIO_MPEG; break; diff --git a/src/libffmpeg/audio_decoder.c b/src/libffmpeg/audio_decoder.c index c0a4503e2..16d2bc234 100644 --- a/src/libffmpeg/audio_decoder.c +++ b/src/libffmpeg/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.29 2006/10/13 21:41:30 dgp85 Exp $ + * $Id: audio_decoder.c,v 1.30 2006/12/15 11:31:29 klan Exp $ * * xine audio decoder plugin using ffmpeg * @@ -107,6 +107,7 @@ static const ff_codec_t ff_audio_lookup[] = { {BUF_AUDIO_TRUESPEECH, CODEC_ID_TRUESPEECH, "TrueSpeech (ffmpeg)"}, {BUF_AUDIO_TTA, CODEC_ID_TTA, "True Audio Lossless (ffmpeg)"}, {BUF_AUDIO_SMACKER, CODEC_ID_SMACKAUDIO, "Smacker (ffmpeg)"}, + {BUF_AUDIO_FLVADPCM, CODEC_ID_ADPCM_SWF, "Flash ADPCM (ffmpeg)"}, }; @@ -472,6 +473,7 @@ static uint32_t supported_audio_types[] = { BUF_AUDIO_TRUESPEECH, BUF_AUDIO_TTA, BUF_AUDIO_SMACKER, + BUF_AUDIO_FLVADPCM, 0 }; diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h index fa8d96388..cb6b6e4cb 100644 --- a/src/xine-engine/buffer.h +++ b/src/xine-engine/buffer.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: buffer.h,v 1.159 2006/11/14 14:11:59 dgp85 Exp $ + * $Id: buffer.h,v 1.160 2006/12/15 11:31:29 klan Exp $ * * * contents: @@ -255,6 +255,7 @@ extern "C" { #define BUF_AUDIO_TRUESPEECH 0x03390000 #define BUF_AUDIO_TTA 0x033A0000 #define BUF_AUDIO_SMACKER 0x033B0000 +#define BUF_AUDIO_FLVADPCM 0x033C0000 /* spu buffer types: */ -- cgit v1.2.3 From e2b5111f4a099c85b1b6c5269e1e85e0bf3b7a1b Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Fri, 15 Dec 2006 14:33:20 +0000 Subject: Parse framerate information. Send bitmap info header to the decoder. Notify decoder about key frames. CVS patchset: 8419 CVS date: 2006/12/15 14:33:20 --- src/demuxers/demux_flv.c | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 64aa23b53..0567da426 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -24,7 +24,7 @@ * For more information on the FLV file format, visit: * http://download.macromedia.com/pub/flash/flash_file_format_specification.pdf * - * $Id: demux_flv.c,v 1.12 2006/12/15 11:31:28 klan Exp $ + * $Id: demux_flv.c,v 1.13 2006/12/15 14:33:20 klan Exp $ */ #ifdef HAVE_CONFIG_H @@ -63,11 +63,15 @@ typedef struct { unsigned char flags; off_t start; /* in bytes */ off_t size; /* in bytes */ - unsigned int length; /* in ms */ unsigned char got_video; unsigned char got_audio; + unsigned int length; /* in ms */ + int width; + int height; + double framerate; + unsigned int cur_pts; int64_t last_pts[2]; @@ -205,10 +209,15 @@ static int parse_flv_var(demux_flv_t *this, unsigned char *buf, int size, char * this->length = val * 1000.0; } else if (!strcmp(key, "width")) { - _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, val); + this->width = val; + _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, this->width); } else if (!strcmp(key, "height")) { - _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, val); + this->height = val; + _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, this->height); + } + else if (!strcmp(key, "framerate")) { + this->framerate = val; } } tmp += 8; @@ -294,6 +303,7 @@ static int read_flv_packet(demux_flv_t *this) { unsigned char tag_type; unsigned int remaining_bytes; unsigned int buf_type = 0; + unsigned int buf_flags = 0; int64_t pts; while (1) { @@ -351,6 +361,7 @@ static int read_flv_packet(demux_flv_t *this) { buf->size = 0; /* no extra data */ buf->type = buf_type; fifo->put(fifo, buf); + this->got_audio = 1; } break; @@ -377,16 +388,27 @@ static int read_flv_packet(demux_flv_t *this) { break; } + if ((buffer[0] >> 4) == 0x01) + buf_flags = BUF_FLAG_KEYFRAME; + fifo = this->video_fifo; if (!this->got_video) { + xine_bmiheader *bih; /* send init info to video decoder; send the bitmapinfo header to the decoder - * primarily as a formality since there is no real data inside */ + * primarily as a formality since there is no real data inside */ buf = fifo->buffer_pool_alloc(fifo); - buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END; - buf->decoder_info[0] = 7470; /* initial duration */ - buf->size = 0; /* no extra data */ + buf->decoder_flags = BUF_FLAG_HEADER | BUF_FLAG_STDHEADER | + BUF_FLAG_FRAMERATE | BUF_FLAG_FRAME_END; + buf->decoder_info[0] = 90000.0 / (this->framerate ? : 12.0); + bih = (xine_bmiheader *) buf->content; + memset(bih, 0, sizeof(xine_bmiheader)); + bih->biSize = sizeof(xine_bmiheader); + bih->biWidth = this->width; + bih->biHeight = this->height; + buf->size = sizeof(xine_bmiheader); buf->type = buf_type; fifo->put(fifo, buf); + this->got_video = 1; } break; @@ -420,6 +442,7 @@ static int read_flv_packet(demux_flv_t *this) { buf->size = remaining_bytes; remaining_bytes -= buf->size; + buf->decoder_flags = buf_flags; if (!remaining_bytes) buf->decoder_flags |= BUF_FLAG_FRAME_END; -- cgit v1.2.3 From e5832a7524780c1604ac43047705fee6688d6fde Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Mon, 18 Dec 2006 18:32:44 +0000 Subject: Automatically flush lprintf() output. CVS patchset: 8420 CVS date: 2006/12/18 18:32:44 --- src/xine-utils/xineutils.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index 15f771da0..9c8ba507d 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xineutils.h,v 1.105 2006/10/16 22:18:24 valtri Exp $ + * $Id: xineutils.h,v 1.106 2006/12/18 18:32:44 klan Exp $ * */ #ifndef XINEUTILS_H @@ -847,6 +847,7 @@ void xine_hexdump (const char *buf, int length) XINE_PROTECTED; do { \ LONG_LOG_MODULE_STRING \ printf(fmt, ##args); \ + fflush(stdout); \ } while(0) #else /* __GNUC__ */ #ifdef _MSC_VER @@ -854,12 +855,14 @@ void xine_hexdump (const char *buf, int length) XINE_PROTECTED; do { \ LONG_LOG_MODULE_STRING \ printf("%s", fmtargs); \ + fflush(stdout); \ } while(0) #else /* _MSC_VER */ #define lprintf(fmt, ...) \ do { \ LONG_LOG_MODULE_STRING \ printf(__VA_ARGS__); \ + fflush(stdout); \ } while(0) #endif /* _MSC_VER */ #endif /* __GNUC__ */ -- cgit v1.2.3 From 8eae85edce64a5454036be7ffa5c526dc7e1f92e Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Mon, 18 Dec 2006 21:22:45 +0000 Subject: Added INPUT_CAP_NOCACHE: disable usage of internal input cache by default. CVS patchset: 8421 CVS date: 2006/12/18 21:22:45 --- src/input/input_plugin.h | 11 ++++++++++- src/xine-engine/xine.c | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h index 2e9f0dca6..146207e76 100644 --- a/src/input/input_plugin.h +++ b/src/input/input_plugin.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_plugin.h,v 1.60 2005/10/14 21:02:16 miguelfreitas Exp $ + * $Id: input_plugin.h,v 1.61 2006/12/18 21:22:45 klan Exp $ */ #ifndef HAVE_INPUT_PLUGIN_H @@ -297,6 +297,15 @@ struct input_plugin_s { #define INPUT_CAP_RIP_FORBIDDEN 0x00000100 +/* + * INPUT_CAP_NOCACHE: + * means that buffered input must not be used. + * (i.e. disable input_cache internal plugin) + */ + +#define INPUT_CAP_NOCACHE 0x00000200 + + #define INPUT_IS_SEEKABLE(input) (((input)->get_capabilities(input) & INPUT_CAP_SEEKABLE) != 0) #define INPUT_OPTIONAL_UNSUPPORTED 0 diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 2440e2d95..6149675f7 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine.c,v 1.336 2006/12/13 18:30:30 dsalt Exp $ + * $Id: xine.c,v 1.337 2006/12/18 21:22:45 klan Exp $ */ /* @@ -769,6 +769,9 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { return 0; } + if (stream->input_plugin->get_capabilities(stream->input_plugin) & INPUT_CAP_NOCACHE) + no_cache = 1; + if (*stream_setup) { while (stream_setup && *stream_setup && *(++stream_setup)) { -- cgit v1.2.3 From 25665d389818fca81eefaf83b217c0061b482551 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Mon, 18 Dec 2006 21:31:47 +0000 Subject: Partially implemented RTSP seekability: support starting the playback at an optional time by delaying the PLAY request upon the first call to rtsp_session_read() and setting the playback start time via input_plugin->seek_time(). CVS patchset: 8422 CVS date: 2006/12/18 21:31:47 --- src/demuxers/demux_real.c | 16 +++++++++++++--- src/input/input_rtsp.c | 26 ++++++++++++++++++-------- src/input/libreal/real.c | 6 +----- src/input/librtsp/rtsp_session.c | 30 +++++++++++++++++++++++++++--- src/input/librtsp/rtsp_session.h | 4 +++- 5 files changed, 62 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index 7441c8619..90852c25c 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -31,7 +31,7 @@ * * Based on FFmpeg's libav/rm.c. * - * $Id: demux_real.c,v 1.109 2006/07/10 22:08:13 dgp85 Exp $ + * $Id: demux_real.c,v 1.110 2006/12/18 21:31:47 klan Exp $ */ #ifdef HAVE_CONFIG_H @@ -1409,12 +1409,15 @@ static int demux_real_seek (demux_plugin_t *this_gen, real_index_entry_t *index, *other_index = NULL; int i = 0, entries; - start_pos = (off_t) ( (double) start_pos / 65535 * - this->input->get_length (this->input) ); + lprintf("seek start_pos=%d, start_time=%d, playing=%d\n", + (int)start_pos, start_time, playing); if((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) && ((this->audio_stream && this->audio_stream->index) || (this->video_stream && this->video_stream->index))) { + + start_pos = (off_t) ( (double) start_pos / 65535 * + this->input->get_length (this->input) ); /* video index has priority over audio index */ if(this->video_stream && this->video_stream->index) { @@ -1453,6 +1456,13 @@ static int demux_real_seek (demux_plugin_t *this_gen, _x_demux_flush_engine(this->stream); } } + else if (this->input->seek_time != NULL) { + /* RTSP supports only time based seek */ + if (start_pos && !start_time) + start_time = (int64_t) this->duration * start_pos / 65535; + + this->input->seek_time(this->input, start_time, SEEK_SET); + } this->send_newpts = 1; this->old_seqnum = -1; diff --git a/src/input/input_rtsp.c b/src/input/input_rtsp.c index 0256edc8d..bcbc19555 100644 --- a/src/input/input_rtsp.c +++ b/src/input/input_rtsp.c @@ -134,6 +134,18 @@ static off_t rtsp_plugin_seek (input_plugin_t *this_gen, off_t offset, int origi return this->curpos; } +static off_t rtsp_plugin_seek_time (input_plugin_t *this_gen, int time_offset, int origin) { + + rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; + + lprintf ("seek_time %d msec, origin %d\n", time_offset, origin); + + if (origin == SEEK_SET) + rtsp_session_set_start_time (this->rtsp, time_offset); + + return this->curpos; +} + static off_t rtsp_plugin_get_length (input_plugin_t *this_gen) { /* @@ -145,7 +157,7 @@ static off_t rtsp_plugin_get_length (input_plugin_t *this_gen) { } static uint32_t rtsp_plugin_get_capabilities (input_plugin_t *this_gen) { - return INPUT_CAP_PREVIEW | INPUT_CAP_RIP_FORBIDDEN; + return INPUT_CAP_PREVIEW | INPUT_CAP_RIP_FORBIDDEN | INPUT_CAP_NOCACHE; } static uint32_t rtsp_plugin_get_blocksize (input_plugin_t *this_gen) { @@ -212,7 +224,7 @@ static int rtsp_plugin_open (input_plugin_t *this_gen) { lprintf ("trying to open '%s'\n", this->mrl); - rtsp = rtsp_session_start(this->stream,this->mrl); + rtsp = rtsp_session_start(this->stream, this->mrl); if (!rtsp) { lprintf ("returning null.\n"); @@ -226,22 +238,19 @@ static int rtsp_plugin_open (input_plugin_t *this_gen) { } static input_plugin_t *rtsp_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, - const char *data) { + const char *mrl) { /* rtsp_input_class_t *cls = (rtsp_input_class_t *) cls_gen; */ rtsp_input_plugin_t *this; - char *mrl = strdup(data); - if (strncasecmp (mrl, "rtsp://", 6)) { - free (mrl); + if (strncasecmp (mrl, "rtsp://", 6)) return NULL; - } this = (rtsp_input_plugin_t *) xine_xmalloc (sizeof (rtsp_input_plugin_t)); this->stream = stream; this->rtsp = NULL; - this->mrl = mrl; + this->mrl = strdup (mrl); /* since we handle only real streams yet, we can savely add * an .rm extention to force handling by demux_real. */ @@ -255,6 +264,7 @@ static input_plugin_t *rtsp_class_get_instance (input_class_t *cls_gen, xine_str this->input_plugin.read = rtsp_plugin_read; this->input_plugin.read_block = rtsp_plugin_read_block; this->input_plugin.seek = rtsp_plugin_seek; + this->input_plugin.seek_time = rtsp_plugin_seek_time; this->input_plugin.get_current_pos = rtsp_plugin_get_current_pos; this->input_plugin.get_length = rtsp_plugin_get_length; this->input_plugin.get_blocksize = rtsp_plugin_get_blocksize; diff --git a/src/input/libreal/real.c b/src/input/libreal/real.c index 270fd16e4..c3d39fab3 100644 --- a/src/input/libreal/real.c +++ b/src/input/libreal/real.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real.c,v 1.24 2006/11/29 19:43:01 dgp85 Exp $ + * $Id: real.c,v 1.25 2006/12/18 21:31:47 klan Exp $ * * special functions for real streams. * adopted from joschkas real tools. @@ -715,10 +715,6 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid rtsp_schedule_field(rtsp_session, subscribe); rtsp_request_setparameter(rtsp_session,NULL); - /* and finally send a play request */ - rtsp_schedule_field(rtsp_session, "Range: npt=0-"); - rtsp_request_play(rtsp_session,NULL); - xine_buffer_free(subscribe); xine_buffer_free(buf); return h; diff --git a/src/input/librtsp/rtsp_session.c b/src/input/librtsp/rtsp_session.c index 6f06693a9..8a5135ac3 100644 --- a/src/input/librtsp/rtsp_session.c +++ b/src/input/librtsp/rtsp_session.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: rtsp_session.c,v 1.16 2004/04/24 16:55:42 miguelfreitas Exp $ + * $Id: rtsp_session.c,v 1.17 2006/12/18 21:31:47 klan Exp $ * * high level interface to rtsp servers. */ @@ -53,7 +53,7 @@ struct rtsp_session_s { rtsp_t *s; /* receive buffer */ - uint8_t *recv; + uint8_t *recv; int recv_size; int recv_read; @@ -62,11 +62,13 @@ struct rtsp_session_s { int header_len; int header_read; + int playing; + int start_time; }; rtsp_session_t *rtsp_session_start(xine_stream_t *stream, char *mrl) { - rtsp_session_t *rtsp_session = malloc(sizeof(rtsp_session_t)); + rtsp_session_t *rtsp_session = xine_xmalloc(sizeof(rtsp_session_t)); char *server; char *mrl_line=strdup(mrl); rmff_header_t *h; @@ -144,6 +146,23 @@ connect: return rtsp_session; } +void rtsp_session_set_start_time (rtsp_session_t *this, int start_time) { + + if (start_time >= 0) + this->start_time = start_time; +} + +static void rtsp_session_play (rtsp_session_t *this) { + + char buf[256]; + + snprintf (buf, sizeof(buf), "Range: npt=%d.%03d-", + this->start_time/1000, this->start_time%1000); + + rtsp_schedule_field (this->s, buf); + rtsp_request_play (this->s,NULL); +} + int rtsp_session_read (rtsp_session_t *this, char *data, int len) { int to_copy=len; @@ -154,6 +173,11 @@ int rtsp_session_read (rtsp_session_t *this, char *data, int len) { if (len < 0) return 0; while (to_copy > fill) { + if (!this->playing) { + rtsp_session_play (this); + this->playing = 1; + } + memcpy(dest, source, fill); to_copy -= fill; dest += fill; diff --git a/src/input/librtsp/rtsp_session.h b/src/input/librtsp/rtsp_session.h index 140d09a0a..649842e7a 100644 --- a/src/input/librtsp/rtsp_session.h +++ b/src/input/librtsp/rtsp_session.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: rtsp_session.h,v 1.6 2003/12/09 00:02:31 f1rmb Exp $ + * $Id: rtsp_session.h,v 1.7 2006/12/18 21:31:47 klan Exp $ * * high level interface to rtsp servers. */ @@ -29,6 +29,8 @@ typedef struct rtsp_session_s rtsp_session_t; rtsp_session_t *rtsp_session_start(xine_stream_t *stream, char *mrl); +void rtsp_session_set_start_time(rtsp_session_t *this, int start_time); + int rtsp_session_read(rtsp_session_t *session, char *data, int len); int rtsp_session_peek_header(rtsp_session_t *this, char *buf, int maxsize); -- cgit v1.2.3 From 2cef6b4c46d7c84dfc4d8bad98731728b33bd9b9 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Tue, 19 Dec 2006 11:15:14 +0000 Subject: Privilege "max_bitrate" over "length" to compute the byterate (because the file may be truncated). CVS patchset: 8423 CVS date: 2006/12/19 11:15:14 --- src/demuxers/demux_asf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index ba31d6e51..c4c873515 100644 --- a/src/demuxers/demux_asf.c +++ b/src/demuxers/demux_asf.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_asf.c,v 1.188 2006/11/29 21:26:52 dgp85 Exp $ + * $Id: demux_asf.c,v 1.189 2006/12/19 11:15:14 klan Exp $ * * demultiplexer for asf streams * @@ -408,7 +408,9 @@ static int asf_read_header (demux_asf_t *this) { this->length = 0; /* compute average byterate (needed for seeking) */ - if (this->length) + if (this->asf_header->file->max_bitrate) + this->rate = this->asf_header->file->max_bitrate >> 3; + else if (this->length) this->rate = (int64_t) this->input->get_length(this->input) * 1000 / this->length; _x_stream_info_set(this->stream, XINE_STREAM_INFO_BITRATE, this->asf_header->file->max_bitrate); -- cgit v1.2.3 From b69b939bc672c639696bd1862808ade41e9aedbc Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Tue, 19 Dec 2006 14:10:35 +0000 Subject: Added some cleanup code to make some calls cancelable (at least xine_open can be safely canceled now). CVS patchset: 8424 CVS date: 2006/12/19 14:10:35 --- src/xine-engine/xine.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 6149675f7..07d9455e1 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine.c,v 1.337 2006/12/18 21:22:45 klan Exp $ + * $Id: xine.c,v 1.338 2006/12/19 14:10:35 klan Exp $ */ /* @@ -78,6 +78,10 @@ #endif /* WIN32 */ +static void mutex_cleanup (void *mutex) { + pthread_mutex_unlock ((pthread_mutex_t *) mutex); +} + void _x_handle_stream_end (xine_stream_t *stream, int non_user) { if (stream->status == XINE_STATUS_QUIT) @@ -294,6 +298,7 @@ static void stop_internal (xine_stream_t *stream) { void xine_stop (xine_stream_t *stream) { pthread_mutex_lock (&stream->frontend_lock); + pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock); /* make sure that other threads cannot change the speed, especially pauseing the stream */ pthread_mutex_lock(&stream->speed_change_lock); @@ -320,6 +325,7 @@ void xine_stop (xine_stream_t *stream) { stream->xine->port_ticket->release(stream->xine->port_ticket, 1); stream->ignore_speed_change = 0; + pthread_cleanup_pop (0); pthread_mutex_unlock (&stream->frontend_lock); } @@ -395,6 +401,7 @@ static void close_internal (xine_stream_t *stream) { void xine_close (xine_stream_t *stream) { pthread_mutex_lock (&stream->frontend_lock); + pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock); close_internal (stream); @@ -408,6 +415,7 @@ void xine_close (xine_stream_t *stream) { if (stream->status != XINE_STATUS_QUIT) stream->status = XINE_STATUS_IDLE; + pthread_cleanup_pop (0); pthread_mutex_unlock (&stream->frontend_lock); } @@ -1134,11 +1142,13 @@ int xine_open (xine_stream_t *stream, const char *mrl) { int ret; pthread_mutex_lock (&stream->frontend_lock); + pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock); lprintf ("open MRL:%s\n", mrl); ret = open_internal (stream, mrl); + pthread_cleanup_pop (0); pthread_mutex_unlock (&stream->frontend_lock); return ret; @@ -1266,6 +1276,7 @@ int xine_play (xine_stream_t *stream, int start_pos, int start_time) { int ret; pthread_mutex_lock (&stream->frontend_lock); + pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock); stream->delay_finish_event = 0; @@ -1275,6 +1286,7 @@ int xine_play (xine_stream_t *stream, int start_pos, int start_time) { stream->gapless_switch = 0; + pthread_cleanup_pop (0); pthread_mutex_unlock (&stream->frontend_lock); return ret; @@ -1288,6 +1300,7 @@ int xine_eject (xine_stream_t *stream) { return 0; pthread_mutex_lock (&stream->frontend_lock); + pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock); status = 0; /* only eject, if we are stopped OR a different input plugin is playing */ @@ -1298,7 +1311,9 @@ int xine_eject (xine_stream_t *stream) { status = stream->eject_class->eject_media (stream->eject_class); } + pthread_cleanup_pop (0); pthread_mutex_unlock (&stream->frontend_lock); + return status; } -- cgit v1.2.3 From ace000d3a03181607b130c28da69652f5f60f7d6 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Tue, 19 Dec 2006 19:10:50 +0000 Subject: Mark string-type configuration items according to whether they're plain strings or names of files, device nodes or directories. This information is available to front ends (via .num_value) so that they can present file/dir-open dialogue boxes if they so choose. Subtitle font selection is split up due to this. CVS patchset: 8425 CVS date: 2006/12/19 19:10:50 --- src/audio_out/audio_sun_out.c | 5 +-- src/input/input_cdda.c | 10 +++--- src/input/input_dvd.c | 13 ++++---- src/input/input_file.c | 6 ++-- src/input/input_pvr.c | 6 ++-- src/input/input_v4l.c | 8 ++--- src/input/input_vcd.c | 4 +-- src/input/vcd/xineplug_inp_vcd.c | 6 ++-- src/libreal/audio_decoder.c | 5 +-- src/libreal/xine_decoder.c | 5 +-- src/libsputext/xine_decoder.c | 68 ++++++++++++++++++++++++++++++++++------ src/libw32dll/common.c | 2 +- src/video_out/video_out_fb.c | 4 +-- src/video_out/video_out_syncfb.c | 5 +-- src/video_out/video_out_vidix.c | 4 +-- src/xine-engine/configfile.c | 51 +++++++++++++++++++++++------- src/xine-engine/configfile.h | 12 ++++++- src/xine-engine/xine.c | 6 ++-- src/xine-engine/xine_interface.c | 18 ++++++++++- 19 files changed, 174 insertions(+), 64 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_sun_out.c b/src/audio_out/audio_sun_out.c index 95e38d811..15bd3b72d 100644 --- a/src/audio_out/audio_sun_out.c +++ b/src/audio_out/audio_sun_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_sun_out.c,v 1.45 2006/07/16 16:18:09 dsalt Exp $ + * $Id: audio_sun_out.c,v 1.46 2006/12/19 19:10:51 dsalt Exp $ */ #ifdef HAVE_CONFIG_H @@ -888,9 +888,10 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v audiodev = getenv("AUDIODEV"); /* This config entry is security critical, is it really necessary? */ - devname = config->register_string(config, + devname = config->register_filename(config, "audio.device.sun_audio_device", audiodev && *audiodev ? audiodev : "/dev/audio", + XINE_CONFIG_STRING_IS_DEVICE_NAME, _("Sun audio device name"), _("Specifies the file name for the Sun audio device " "to be used.\nThis setting is security critical, " diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index f51ffc646..7ee2e7899 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -20,7 +20,7 @@ * Compact Disc Digital Audio (CDDA) Input Plugin * by Mike Melanson (melanson@pcisys.net) * - * $Id: input_cdda.c,v 1.90 2006/08/11 21:40:02 dsalt Exp $ + * $Id: input_cdda.c,v 1.91 2006/12/19 19:10:51 dsalt Exp $ */ #ifdef HAVE_CONFIG_H @@ -2675,8 +2675,8 @@ static void *init_plugin (xine_t *xine, void *data) { this->mrls_allocated_entries = 0; this->ip = NULL; - this->cdda_device = config->register_string(config, "media.audio_cd.device", - DEFAULT_CDDA_DEVICE, + this->cdda_device = config->register_filename(config, "media.audio_cd.device", + DEFAULT_CDDA_DEVICE, XINE_CONFIG_STRING_IS_DEVICE_NAME, _("device used for CD audio"), _("The path to the device, usually a " "CD or DVD drive, which you intend to use " @@ -2704,8 +2704,8 @@ static void *init_plugin (xine_t *xine, void *data) { "title and track information from."), XINE_CONFIG_SECURITY, port_changed_cb, (void *) this); - config->register_string(config, "media.audio_cd.cddb_cachedir", - (_cdda_cddb_get_default_location()), + config->register_filename(config, "media.audio_cd.cddb_cachedir", + (_cdda_cddb_get_default_location()), XINE_CONFIG_STRING_IS_DIRECTORY_NAME, _("CDDB cache directory"), _("The replies from the CDDB server will be " "cached in this directory.\nThis setting is security critical, because files " "with uncontrollable names will be created in this directory. Be sure to use " diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index 26eb67e24..ddc3fe964 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_dvd.c,v 1.211 2006/10/29 19:39:39 hadess Exp $ + * $Id: input_dvd.c,v 1.212 2006/12/19 19:10:51 dsalt Exp $ * */ @@ -1779,9 +1779,9 @@ static void *init_class (xine_t *xine, void *data) { this->ip = NULL; - this->dvd_device = config->register_string(config, + this->dvd_device = config->register_filename(config, "media.dvd.device", - DVD_PATH, + DVD_PATH, XINE_CONFIG_STRING_IS_DEVICE_NAME, _("device used for DVD playback"), _("The path to the device, usually a " "DVD drive, which you intend to use for playing DVDs."), @@ -1799,8 +1799,9 @@ static void *init_class (xine_t *xine, void *data) { char *css_cache_default, *css_cache; int mode; - raw_device = config->register_string(config, "media.dvd.raw_device", - RDVD_PATH, _("raw device set up for DVD access"), + raw_device = config->register_filename(config, "media.dvd.raw_device", + RDVD_PATH, XINE_CONFIG_STRING_IS_DEVICE_NAME, + _("raw device set up for DVD access"), _("If this points to a raw device connected to your " "DVD device, xine will use the raw device for playback. " "This has the advantage of being slightly faster and " @@ -1822,7 +1823,7 @@ static void *init_class (xine_t *xine, void *data) { css_cache_default = (char *)malloc(strlen(xine_get_homedir()) + 10); sprintf(css_cache_default, "%s/.dvdcss/", xine_get_homedir()); - css_cache = config->register_string(config, "media.dvd.css_cache_path", css_cache_default, + css_cache = config->register_filename(config, "media.dvd.css_cache_path", css_cache_default, XINE_CONFIG_STRING_IS_DIRECTORY_NAME, _("path to the title key cache"), _("Since cracking the copy protection of scrambled DVDs can " "be quite time consuming, libdvdcss will cache the cracked " diff --git a/src/input/input_file.c b/src/input/input_file.c index 93d208c4e..db7937956 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_file.c,v 1.117 2006/10/01 20:14:43 dgp85 Exp $ + * $Id: input_file.c,v 1.118 2006/12/19 19:10:51 dsalt Exp $ */ #ifdef HAVE_CONFIG_H @@ -1027,8 +1027,8 @@ static void *init_plugin (xine_t *xine, void *data) { if(getcwd(current_dir, sizeof(current_dir)) == NULL) strcpy(current_dir, "."); - this->origin_path = config->register_string(config, "media.files.origin_path", - current_dir, + this->origin_path = config->register_filename(config, "media.files.origin_path", + current_dir, XINE_CONFIG_STRING_IS_DIRECTORY_NAME, _("file browsing start location"), _("The browser to select the file to play will " "start at this location."), diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c index 1461d0f9e..f47bfe890 100644 --- a/src/input/input_pvr.c +++ b/src/input/input_pvr.c @@ -38,7 +38,7 @@ * usage: * xine pvr:/\!\! * - * $Id: input_pvr.c,v 1.62 2006/07/10 22:08:15 dgp85 Exp $ + * $Id: input_pvr.c,v 1.63 2006/12/19 19:10:51 dsalt Exp $ */ /************************************************************************** @@ -1548,9 +1548,9 @@ static void *init_plugin (xine_t *xine, void *data) { this->xine = xine; this->config = xine->config; - this->devname = this->config->register_string(this->config, + this->devname = this->config->register_filename(this->config, "media.wintv_pvr.device", - PVR_DEVICE, + PVR_DEVICE, XINE_CONFIG_STRING_IS_DEVICE_NAME, _("device used for WinTV-PVR 250/350 (pvr plugin)"), _("The path to the device of your WinTV card."), 10, NULL, diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c index 1dfde167f..8143c6b13 100644 --- a/src/input/input_v4l.c +++ b/src/input/input_v4l.c @@ -1907,8 +1907,8 @@ static void *init_video_class (xine_t *xine, void *data) this->input_class.dispose = v4l_class_dispose; this->input_class.eject_media = NULL; - config->register_string (config, "media.video4linux.video_device", - VIDEO_DEV, + config->register_filename (config, "media.video4linux.video_device", + VIDEO_DEV, XINE_CONFIG_STRING_IS_DEVICE_NAME, _("v4l video device"), _("The path to your Video4Linux video device."), 10, NULL, NULL); @@ -1933,8 +1933,8 @@ static void *init_radio_class (xine_t *xine, void *data) this->input_class.dispose = v4l_class_dispose; this->input_class.eject_media = NULL; - config->register_string (config, "media.video4linux.radio_device", - RADIO_DEV, + config->register_filename (config, "media.video4linux.radio_device", + RADIO_DEV, XINE_CONFIG_STRING_IS_DEVICE_NAME, _("v4l radio device"), _("The path to your Video4Linux radio device."), 10, NULL, NULL); diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index 0103027bf..ab0715e96 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_vcd.c,v 1.85 2006/07/10 22:08:16 dgp85 Exp $ + * $Id: input_vcd.c,v 1.86 2006/12/19 19:10:51 dsalt Exp $ * */ @@ -1094,7 +1094,7 @@ static void *init_class (xine_t *xine, void *data) { this->input_class.dispose = vcd_class_dispose; this->input_class.eject_media = vcd_class_eject_media; - this->device = config->register_string (config, "media.vcd.device", CDROM, + this->device = config->register_filename (config, "media.vcd.device", CDROM, XINE_CONFIG_STRING_IS_DEVICE_NAME, _("device used for VCD playback"), _("The path to the device, usually a CD or DVD drive, " "you intend to play your VideoCDs with."), diff --git a/src/input/vcd/xineplug_inp_vcd.c b/src/input/vcd/xineplug_inp_vcd.c index c5cd7c031..87b442acd 100644 --- a/src/input/vcd/xineplug_inp_vcd.c +++ b/src/input/vcd/xineplug_inp_vcd.c @@ -1,5 +1,5 @@ /* - $Id: xineplug_inp_vcd.c,v 1.51 2006/12/13 19:21:10 dsalt Exp $ + $Id: xineplug_inp_vcd.c,v 1.52 2006/12/19 19:10:51 dsalt Exp $ Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein @@ -1829,9 +1829,9 @@ _("The VCD play unit to use when none is specified in an MRL, e.g. " class->vcd_device = - strdup (config->register_string(config, + strdup (config->register_filename(config, "media.vcd.device", - "", + "", XINE_CONFIG_STRING_IS_DEVICE_NAME, _("CD-ROM drive used for VCD when none given"), _("What to use if no drive specified. If the setting is empty, xine will scan for CD drives."), 20, diff --git a/src/libreal/audio_decoder.c b/src/libreal/audio_decoder.c index d5b2b2d26..105c91fe3 100644 --- a/src/libreal/audio_decoder.c +++ b/src/libreal/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.49 2006/07/10 22:08:30 dgp85 Exp $ + * $Id: audio_decoder.c,v 1.50 2006/12/19 19:10:51 dsalt Exp $ * * thin layer to use real binary-only codecs in xine * @@ -740,8 +740,9 @@ static void *init_class (xine_t *xine, void *data) { if (!stat ("/usr/lib/win32/drv3.so.6.0", &s)) default_real_codec_path = "/usr/lib/win32"; - real_codec_path = config->register_string (config, "decoder.external.real_codecs_path", + real_codec_path = config->register_filename (config, "decoder.external.real_codecs_path", default_real_codec_path, + XINE_CONFIG_STRING_IS_DIRECTORY_NAME, _("path to RealPlayer codecs"), _("If you have RealPlayer installed, specify the path " "to its codec directory here. You can easily find " diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c index 0ed7f12d8..d1f5ce1c0 100644 --- a/src/libreal/xine_decoder.c +++ b/src/libreal/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.83 2006/07/10 22:08:30 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.84 2006/12/19 19:10:51 dsalt Exp $ * * thin layer to use real binary-only codecs in xine * @@ -633,8 +633,9 @@ static void *init_class (xine_t *xine, void *data) { if (!stat ("/usr/lib/win32/drv3.so.6.0", &s)) default_real_codec_path = "/usr/lib/win32"; - real_codec_path = config->register_string (config, "decoder.external.real_codecs_path", + real_codec_path = config->register_filename (config, "decoder.external.real_codecs_path", default_real_codec_path, + XINE_CONFIG_STRING_IS_DIRECTORY_NAME, _("path to RealPlayer codecs"), _("If you have RealPlayer installed, specify the path " "to its codec directory here. You can easily find " diff --git a/src/libsputext/xine_decoder.c b/src/libsputext/xine_decoder.c index 851a9af93..8c976671f 100644 --- a/src/libsputext/xine_decoder.c +++ b/src/libsputext/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.96 2006/09/26 02:36:55 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.97 2006/12/19 19:10:51 dsalt Exp $ * */ @@ -64,6 +64,10 @@ typedef struct sputext_class_s { subtitle_size subtitle_size; /* size of subtitles */ int vertical_offset; char font[FONTNAME_SIZE]; /* subtitle font */ +#ifdef HAVE_FT2 + char font_ft[FILENAME_MAX]; /* subtitle font */ + int use_font_ft; /* use Freetype */ +#endif char *src_encoding; /* encoding of subtitle file */ int use_unscaled; /* use unscaled OSD if possible */ @@ -87,7 +91,7 @@ typedef struct sputext_decoder_s { */ subtitle_size subtitle_size; /* size of subtitles */ int vertical_offset; - char font[FONTNAME_SIZE]; /* subtitle font */ + char font[FILENAME_MAX]; /* subtitle font */ char *buf_encoding; /* encoding of subtitle buffer */ int width; /* frame width */ @@ -107,6 +111,14 @@ typedef struct sputext_decoder_s { int last_lines; /* number of lines of the previous subtitle */ } sputext_decoder_t; +static inline char *get_font (sputext_class_t *class) +{ +#ifdef HAVE_FT2 + return class->use_font_ft ? class->font_ft : class->font; +#else + return class->font; +#endif +} static void update_font_size (sputext_decoder_t *this, int force_update) { static int sizes[SUBTITLE_SIZE_NUM] = { 16, 20, 24, 32, 48, 64 }; @@ -138,7 +150,7 @@ static void update_font_size (sputext_decoder_t *this, int force_update) { this->width, SUB_MAX_TEXT * this->line_height); - this->renderer->set_font (this->osd, this->class->font, this->font_size); + this->renderer->set_font (this->osd, get_font (this->class), this->font_size); this->renderer->set_position (this->osd, 0, y); } } @@ -338,6 +350,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su int line, y; int font_size; + char *font; _x_assert(this->renderer != NULL); if ( ! this->renderer ) @@ -345,10 +358,11 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su update_font_size(this, 0); - if( strcmp(this->font, this->class->font) ) { - strncpy(this->font, this->class->font, FONTNAME_SIZE); - this->font[FONTNAME_SIZE - 1] = '\0'; - this->renderer->set_font (this->osd, this->class->font, this->font_size); + font = get_font (this->class); + if( strcmp(this->font, font) ) { + strncpy(this->font, font, FILENAME_MAX); + this->font[FILENAME_MAX - 1] = '\0'; + this->renderer->set_font (this->osd, font, this->font_size); } font_size = this->font_size; @@ -546,7 +560,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su if( w > this->width && font_size > 16 ) { font_size -= 4; - this->renderer->set_font (this->osd, this->class->font, font_size); + this->renderer->set_font (this->osd, get_font (this->class), font_size); } else { break; } @@ -561,7 +575,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su } if( font_size != this->font_size ) - this->renderer->set_font (this->osd, this->class->font, this->font_size); + this->renderer->set_font (this->osd, get_font (this->class), this->font_size); if( this->last_subtitle_end && sub_start < this->last_subtitle_end ) { sub_start = this->last_subtitle_end; @@ -824,6 +838,27 @@ static void update_osd_font(void *class_gen, xine_cfg_entry_t *entry) xprintf(class->xine, XINE_VERBOSITY_DEBUG, "libsputext: spu_font = %s\n", class->font ); } +#ifdef HAVE_FT2 +static void update_osd_font_ft(void *class_gen, xine_cfg_entry_t *entry) +{ + sputext_class_t *class = (sputext_class_t *)class_gen; + + strncpy(class->font_ft, entry->str_value, FILENAME_MAX); + class->font_ft[FILENAME_MAX - 1] = '\0'; + + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "libsputext: spu_font_ft = %s\n", class->font_ft); +} + +static void update_osd_use_font_ft(void *class_gen, xine_cfg_entry_t *entry) +{ + sputext_class_t *class = (sputext_class_t *)class_gen; + + class->use_font_ft = entry->num_value; + + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "libsputext: spu_use_font_ft = %d\n", class->use_font_ft); +} +#endif + static void update_subtitle_size(void *class_gen, xine_cfg_entry_t *entry) { sputext_class_t *class = (sputext_class_t *)class_gen; @@ -929,6 +964,21 @@ static void *init_spu_decoder_plugin (xine_t *xine, void *data) { "subtitle text."), 10, update_osd_font, this), FONTNAME_SIZE); this->font[FONTNAME_SIZE - 1] = '\0'; +#ifdef HAVE_FT2 + strncpy(this->font_ft, xine->config->register_filename(xine->config, + "subtitles.separate.font_freetype", + "", XINE_CONFIG_STRING_IS_FILENAME, + _("font for subtitles"), + _("An outline font file (e.g. a .ttf) to be used for the subtitle text."), + 10, update_osd_font_ft, this), FILENAME_MAX); + this->font_ft[FILENAME_MAX - 1] = '\0'; + this->use_font_ft = xine->config->register_bool(xine->config, + "subtitles.separate.font_use_freetype", + 0, + _("whether to use a freetype font"), + NULL, + 10, update_osd_use_font_ft, this); +#endif this->src_encoding = xine->config->register_string(xine->config, "subtitles.separate.src_encoding", xine_guess_spu_encoding(), diff --git a/src/libw32dll/common.c b/src/libw32dll/common.c index 1f42288c2..35fe41941 100644 --- a/src/libw32dll/common.c +++ b/src/libw32dll/common.c @@ -13,7 +13,7 @@ static char *get_win32_codecs_path(config_values_t *cfg) { NULL }; int i = 0; - cfgpath = cfg->register_string (cfg, "decoder.external.win32_codecs_path", WIN32_PATH, + cfgpath = cfg->register_filename (cfg, "decoder.external.win32_codecs_path", WIN32_PATH, XINE_CONFIG_STRING_IS_DIRECTORY_NAME, _("path to Win32 codecs"), _("If you have the Windows or Apple Quicktime codec packs " "installed, specify the path the codec directory here. " diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c index 808092a03..e88def112 100644 --- a/src/video_out/video_out_fb.c +++ b/src/video_out/video_out_fb.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_fb.c,v 1.48 2006/07/10 22:08:44 dgp85 Exp $ + * $Id: video_out_fb.c,v 1.49 2006/12/19 19:10:51 dsalt Exp $ * * video_out_fb.c, frame buffer xine driver by Miguel Freitas * @@ -848,7 +848,7 @@ static int open_fb_device(config_values_t *config, xine_t *xine) /* This config entry is security critical, is it really necessary * or is a number enough? */ - device_name = config->register_string(config, devkey, "", + device_name = config->register_filename(config, devkey, "", XINE_CONFIG_STRING_IS_DEVICE_NAME, _("framebuffer device name"), _("Specifies the file name for the framebuffer device " "to be used.\nThis setting is security critical, " diff --git a/src/video_out/video_out_syncfb.c b/src/video_out/video_out_syncfb.c index 9760105c2..f03d0ea97 100644 --- a/src/video_out/video_out_syncfb.c +++ b/src/video_out/video_out_syncfb.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_syncfb.c,v 1.107 2006/09/02 01:10:46 dgp85 Exp $ + * $Id: video_out_syncfb.c,v 1.108 2006/12/19 19:10:51 dsalt Exp $ * * video_out_syncfb.c, SyncFB (for Matrox G200/G400 cards) interface for xine * @@ -1073,7 +1073,8 @@ static void *init_class (xine_t *xine, void *visual_gen) { char* device_name; int fd; - device_name = xine->config->register_string(xine->config, "video.device.syncfb_device", "/dev/syncfb", + device_name = xine->config->register_filename(xine->config, "video.device.syncfb_device", "/dev/syncfb", + XINE_CONFIG_STRING_IS_DEVICE_NAME, _("SyncFB device name"), _("Specifies the file name for the SyncFB (TeleTux) device " "to be used.\nThis setting is security critical, " diff --git a/src/video_out/video_out_vidix.c b/src/video_out/video_out_vidix.c index 188b5271a..b90a162ca 100644 --- a/src/video_out/video_out_vidix.c +++ b/src/video_out/video_out_vidix.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_vidix.c,v 1.74 2006/07/10 22:08:44 dgp85 Exp $ + * $Id: video_out_vidix.c,v 1.75 2006/12/19 19:10:51 dsalt Exp $ * * video_out_vidix.c * @@ -1235,7 +1235,7 @@ static vo_driver_t *vidixfb_open_plugin (video_driver_class_t *class_gen, const this->visual_type = XINE_VISUAL_TYPE_FB; /* Register config option for fb device */ - device = config->register_string(config, "video.device.vidixfb_device", "/dev/fb0", + device = config->register_filename(config, "video.device.vidixfb_device", "/dev/fb0", XINE_CONFIG_STRING_IS_DEVICE_NAME, _("framebuffer device name"), _("Specifies the file name for the framebuffer device to be used.\n" "This setting is security critical, because when changed to a different file, xine " diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index 21ebfd5be..5d552f8f1 100644 --- a/src/xine-engine/configfile.c +++ b/src/xine-engine/configfile.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: configfile.c,v 1.81 2006/09/26 21:51:11 dgp85 Exp $ + * $Id: configfile.c,v 1.82 2006/12/19 19:10:52 dsalt Exp $ * * config object (was: file) management - implementation * @@ -491,14 +491,15 @@ static cfg_entry_t *config_register_key (config_values_t *this, return entry; } -static char *config_register_string (config_values_t *this, - const char *key, - const char *def_value, - const char *description, - const char *help, - int exp_level, - xine_config_cb_t changed_cb, - void *cb_data) { +static cfg_entry_t *config_register_string_internal (config_values_t *this, + const char *key, + const char *def_value, + int num_value, + const char *description, + const char *help, + int exp_level, + xine_config_cb_t changed_cb, + void *cb_data) { cfg_entry_t *entry; _x_assert(this); @@ -512,7 +513,7 @@ static char *config_register_string (config_values_t *this, if (entry->type != XINE_CONFIG_TYPE_UNKNOWN) { lprintf("config entry already registered: %s\n", key); pthread_mutex_unlock(&this->config_lock); - return entry->str_value; + return entry; } config_reset_value(entry); @@ -525,13 +526,40 @@ static char *config_register_string (config_values_t *this, else entry->str_value = strdup(def_value); + entry->num_value = num_value; + /* fill out rest of struct */ entry->str_default = strdup(def_value); entry->description = (description) ? strdup(description) : NULL; entry->help = (help) ? strdup(help) : NULL; pthread_mutex_unlock(&this->config_lock); - return entry->str_value; + return entry; +} + +static char *config_register_string (config_values_t *this, + const char *key, + const char *def_value, + const char *description, + const char *help, + int exp_level, + xine_config_cb_t changed_cb, + void *cb_data) { + return config_register_string_internal (this, key, def_value, 0, description, + help, exp_level, changed_cb, cb_data)->str_value; +} + +static char *config_register_filename (config_values_t *this, + const char *key, + const char *def_value, + int req_type, + const char *description, + const char *help, + int exp_level, + xine_config_cb_t changed_cb, + void *cb_data) { + return config_register_string_internal (this, key, def_value, req_type, description, + help, exp_level, changed_cb, cb_data)->str_value; } static int config_register_num (config_values_t *this, @@ -1184,6 +1212,7 @@ config_values_t *_x_config_init (void) { pthread_mutex_init(&this->config_lock, &attr); this->register_string = config_register_string; + this->register_filename = config_register_filename; this->register_range = config_register_range; this->register_enum = config_register_enum; this->register_num = config_register_num; diff --git a/src/xine-engine/configfile.h b/src/xine-engine/configfile.h index 2a98be9f1..29413610c 100644 --- a/src/xine-engine/configfile.h +++ b/src/xine-engine/configfile.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: configfile.h,v 1.38 2006/09/26 05:19:48 dgp85 Exp $ + * $Id: configfile.h,v 1.39 2006/12/19 19:10:52 dsalt Exp $ * * config file management * @@ -108,6 +108,16 @@ struct config_values_s { xine_config_cb_t changed_cb, void *cb_data); + char* (*register_filename) (config_values_t *self, + const char *key, + const char *def_value, + int req_type, + const char *description, + const char *help, + int exp_level, + xine_config_cb_t changed_cb, + void *cb_data); + int (*register_range) (config_values_t *self, const char *key, int def_value, diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 07d9455e1..63afc86d3 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine.c,v 1.338 2006/12/19 14:10:35 klan Exp $ + * $Id: xine.c,v 1.339 2006/12/19 19:10:52 dsalt Exp $ */ /* @@ -1579,9 +1579,9 @@ void xine_init (xine_t *this) { /* * save directory */ - this->save_path = this->config->register_string ( + this->save_path = this->config->register_filename ( this->config, - "media.capture.save_dir", "", + "media.capture.save_dir", "", XINE_CONFIG_STRING_IS_DIRECTORY_NAME, _("directory for saving streams"), _("When using the stream save feature, files will be written only into this directory.\n" "This setting is security critical, because when changed to a different directory, xine " diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c index d0dc0e4a5..7e7527de7 100644 --- a/src/xine-engine/xine_interface.c +++ b/src/xine-engine/xine_interface.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_interface.c,v 1.99 2006/10/16 06:29:38 dgp85 Exp $ + * $Id: xine_interface.c,v 1.100 2006/12/19 19:10:52 dsalt Exp $ * * convenience/abstraction layer, functions to implement * libxine's public interface @@ -100,7 +100,23 @@ const char* xine_config_register_string (xine_t *self, cb_data); } + +const char* xine_config_register_filename (xine_t *self, + const char *key, + const char *def_value, + int req_type, + const char *description, + const char *help, + int exp_level, + xine_config_cb_t changed_cb, + void *cb_data) { + return self->config->register_filename (self->config, + key, def_value, req_type, + description, help, exp_level, + changed_cb, cb_data); +} + int xine_config_register_range (xine_t *self, const char *key, int def_value, -- cgit v1.2.3 From 67534e2d8ca6a618952adcfa7dfc6d02deb49693 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Thu, 21 Dec 2006 00:11:31 +0000 Subject: Improve the compiler optimisation failure workaround. CVS patchset: 8430 CVS date: 2006/12/21 00:11:31 --- src/libffmpeg/libavcodec/i386/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libffmpeg/libavcodec/i386/Makefile.am b/src/libffmpeg/libavcodec/i386/Makefile.am index 3eae6fe0f..15ab4db89 100644 --- a/src/libffmpeg/libavcodec/i386/Makefile.am +++ b/src/libffmpeg/libavcodec/i386/Makefile.am @@ -9,7 +9,7 @@ CFLAGS := `echo @CFLAGS@ | sed -e 's/-funroll-loops//g'` AM_CPPFLAGS = $(LIBFFMPEG_CPPFLAGS) -I$(top_srcdir)/src/libffmpeg/libavutil # Avoid "can't find register" failures with -O1 and higher -dsputil_mmx.o dsputil_mmx.lo: CFLAGS=`echo @CFLAGS@ | sed -e 's/-funroll-loops//g; s/-O[0-9]/-Os/g'` +dsputil_mmx.o dsputil_mmx.lo: CFLAGS=$(shell echo @CFLAGS@ | sed -e 's/-funroll-loops//g; s/$$/ -Os/') # Avoid errors on (at least) amd64 with -O0 fdct_mmx.o fdct_mmx.lo: CFLAGS=`echo @CFLAGS@ | sed -e 's/^/-Os /; s/-O0\?\s/-Os /g'` -- cgit v1.2.3 From 4d3ead5b20de46118087552ea6db715720f8374e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 21 Dec 2006 09:54:44 +0000 Subject: Apply the textrel patch from Gentoo, thanks to PaX team for providing it. The patch was applied and tested for a while in Gentoo and Pardus, and solves also Debian's problems with non-PIC code. If problems will arise, they'll be debugged. CVS patchset: 8431 CVS date: 2006/12/21 09:54:44 --- src/libw32dll/Makefile.am | 6 +- src/libw32dll/wine/module.c | 12 ++-- src/libw32dll/wine/stubs.s | 3 + src/libw32dll/wine/wrapper.S | 52 +++++++++----- src/libw32dll/wine/wrapper.h | 4 -- .../deinterlace/plugins/greedy2frame_template.c | 33 +++++---- src/post/deinterlace/plugins/greedyh.asm | 66 ++++++++++-------- .../plugins/tomsmocomp/SearchLoop0A.inc | 4 +- .../plugins/tomsmocomp/SearchLoopBottom.inc | 53 ++++++++------ .../plugins/tomsmocomp/SearchLoopTop.inc | 64 +++++++++-------- .../deinterlace/plugins/tomsmocomp/StrangeBob.inc | 80 +++++++++++----------- .../plugins/tomsmocomp/TomsMoCompAll.inc | 6 +- .../deinterlace/plugins/tomsmocomp/WierdBob.inc | 40 +++++------ .../plugins/tomsmocomp/tomsmocompmacros.h | 12 ++-- 14 files changed, 237 insertions(+), 198 deletions(-) (limited to 'src') diff --git a/src/libw32dll/Makefile.am b/src/libw32dll/Makefile.am index aa42cd8e3..67af8a8d3 100644 --- a/src/libw32dll/Makefile.am +++ b/src/libw32dll/Makefile.am @@ -16,8 +16,7 @@ lib_LTLIBRARIES = $(w32dll_codec) $(qt_codec) EXTRA_DIST = common.c xineplug_decode_w32dll_la_SOURCES = w32codec.c -xineplug_decode_w32dll_la_LDFLAGS = -avoid-version -module \ - @IMPURE_TEXT_LDFLAGS@ +xineplug_decode_w32dll_la_LDFLAGS = -avoid-version -module xineplug_decode_w32dll_la_LIBADD = \ $(top_builddir)/src/libw32dll/wine/libwine.la \ $(XINE_LIB) \ @@ -26,8 +25,7 @@ xineplug_decode_w32dll_la_LIBADD = \ @KSTAT_LIBS@ xineplug_decode_qt_la_SOURCES = qt_decoder.c -xineplug_decode_qt_la_LDFLAGS = -avoid-version -module \ - IMPURE_TEXT_LDFLAGS@ +xineplug_decode_qt_la_LDFLAGS = -avoid-version -module xineplug_decode_qt_la_LIBADD = \ $(top_builddir)/src/libw32dll/wine/libwine.la \ $(XINE_LIB) \ diff --git a/src/libw32dll/wine/module.c b/src/libw32dll/wine/module.c index c37073d18..0331f141f 100644 --- a/src/libw32dll/wine/module.c +++ b/src/libw32dll/wine/module.c @@ -39,8 +39,8 @@ #ifdef EMU_QTX_API #include "wrapper.h" -static int report_func(void *stack_base, int stack_size, reg386_t *reg, u_int32_t *flags); -static int report_func_ret(void *stack_base, int stack_size, reg386_t *reg, u_int32_t *flags); +int report_func(void *stack_base, int stack_size, reg386_t *reg, u_int32_t *flags); +int report_func_ret(void *stack_base, int stack_size, reg386_t *reg, u_int32_t *flags); #endif //#undef TRACE @@ -519,8 +519,6 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) printf ("wine/module: QuickTime.qts patched!!! old entry=%p\n",ptr[0]); #ifdef EMU_QTX_API - report_entry = report_func; - report_ret = report_func_ret; wrapper_target=ptr[0]; ptr[0]=wrapper; #endif @@ -683,7 +681,7 @@ static int dump_component(char* name,int type,void* _orig, ComponentParameters * static u_int32_t ret_array[4096]; static int ret_i=0; -static int report_func(void *stack_base, int stack_size, reg386_t *reg, u_int32_t *flags) +int report_func(void *stack_base, int stack_size, reg386_t *reg, u_int32_t *flags) { #ifdef DEBUG_QTX_API int i; @@ -882,7 +880,7 @@ static int report_func(void *stack_base, int stack_size, reg386_t *reg, u_int32_ return 0; } -static int report_func_ret(void *stack_base, int stack_size, reg386_t *reg, u_int32_t *flags) +int report_func_ret(void *stack_base, int stack_size, reg386_t *reg, u_int32_t *flags) { #ifdef DEBUG_QTX_API int i; @@ -997,8 +995,6 @@ FARPROC MODULE_GetProcAddress( // || !strcmp(function,"_CallComponent") ){ fprintf(stderr,"theQuickTimeDispatcher caught -> %p\n",retproc); - report_entry = report_func; - report_ret = report_func_ret; wrapper_target=(void *)retproc; retproc=(void *)wrapper; } diff --git a/src/libw32dll/wine/stubs.s b/src/libw32dll/wine/stubs.s index 6aa90ee9d..2c6270616 100644 --- a/src/libw32dll/wine/stubs.s +++ b/src/libw32dll/wine/stubs.s @@ -33,3 +33,6 @@ exp_EH_prolog: leal 12(%esp), %ebp pushl %eax ret + +.section .note.GNU-stack,"",@progbits + diff --git a/src/libw32dll/wine/wrapper.S b/src/libw32dll/wine/wrapper.S index fe2d85619..2e781787e 100644 --- a/src/libw32dll/wine/wrapper.S +++ b/src/libw32dll/wine/wrapper.S @@ -1,17 +1,19 @@ .section .data -.globl caller_return caller_return: .long 0 -.globl report_entry -report_entry: - .long null_call -.globl report_ret -report_ret: - .long null_call .global wrapper_target wrapper_target: .long null_call +#undef __i686 /* gcc define gets in our way */ + .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits +.globl __i686.get_pc_thunk.bx + .hidden __i686.get_pc_thunk.bx + .type __i686.get_pc_thunk.bx,@function +__i686.get_pc_thunk.bx: + movl (%esp), %ebx + ret + .section .text .globl null_call .type null_call, @function @@ -22,46 +24,60 @@ null_call: .type wrapper, @function .balign 16,0x90 wrapper: + pushl $0 pusha # store registers (EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI) pushf # store flags push %ebp # set up a stack frame movl %esp, %ebp + call __i686.get_pc_thunk.bx + addl $_GLOBAL_OFFSET_TABLE_, %ebx + leal 4(%ebp), %eax # push flags addr push %eax leal 8(%ebp), %eax # push registers addr push %eax - leal 40(%ebp), %edx + leal 44(%ebp), %edx movl (%ebp), %eax subl %edx, %eax push %eax push %edx - call *report_entry # report entry + call report_func@PLT # report entry test %eax, %eax jnz .Ldone + movl 44(%ebp), %eax # switch return addresses + movl %eax, caller_return@GOTOFF(%ebx) + leal .Lwrapper_return@GOTOFF(%ebx), %eax + movl %eax, 40(%ebp) + + movl wrapper_target@GOTOFF(%ebx), %eax + mov %eax, 40(%ebp) # wrapper_target should return at .Lwrapper_return + leave # restore %esp, %ebp popf # restore flags popa # restore registers - - popl caller_return # switch return addresses - pushl $.Lwrapper_return - - jmp *wrapper_target # wrapper_target should return at .Lwrapper_return + + ret # fake 'return' to wrapper_target actually .balign 16, 0x90 .Lwrapper_return: - pushl caller_return # restore the original return address + pushl $0 pusha # more for reference sake here pushf push %ebp # set up a stack frame movl %esp, %ebp + call __i686.get_pc_thunk.bx + addl $_GLOBAL_OFFSET_TABLE_, %ebx + movl caller_return@GOTOFF(%ebx), %eax + movl %eax, 40(%ebp) # restore the original return address + leal 4(%ebp), %eax # push flags addr push %eax leal 8(%ebp), %eax # push registers addr @@ -73,11 +89,13 @@ wrapper: push %eax push %edx - call *report_ret # report the return information (same args) + call report_func_ret@PLT# report the return information (same args) .Ldone: leave popf popa ret - + +.section .note.GNU-stack,"",@progbits + diff --git a/src/libw32dll/wine/wrapper.h b/src/libw32dll/wine/wrapper.h index a9943ce78..5e2cf804e 100644 --- a/src/libw32dll/wine/wrapper.h +++ b/src/libw32dll/wine/wrapper.h @@ -11,10 +11,6 @@ typedef struct { u_int32_t edi, esi, ebp, esp, ebx, edx, ecx, eax; } reg386_t; -typedef int (*wrapper_func_t)(void *stack_base, int stack_size, reg386_t *reg, u_int32_t *flags); - -extern wrapper_func_t report_entry, report_ret; - extern void (*wrapper_target)(void); extern int wrapper(void); diff --git a/src/post/deinterlace/plugins/greedy2frame_template.c b/src/post/deinterlace/plugins/greedy2frame_template.c index 42c575f58..728bceed5 100644 --- a/src/post/deinterlace/plugins/greedy2frame_template.c +++ b/src/post/deinterlace/plugins/greedy2frame_template.c @@ -1,5 +1,5 @@ /***************************************************************************** -** $Id: greedy2frame_template.c,v 1.9 2006/02/04 14:06:29 miguelfreitas Exp $ +** $Id: greedy2frame_template.c,v 1.10 2006/12/21 09:54:45 dgp85 Exp $ ****************************************************************************** ** Copyright (c) 2000 John Adcock, Tom Barry, Steve Grimm All rights reserved. ** port copyright (c) 2003 Miguel Freitas @@ -19,6 +19,9 @@ ** CVS Log ** ** $Log: greedy2frame_template.c,v $ +** Revision 1.10 2006/12/21 09:54:45 dgp85 +** Apply the textrel patch from Gentoo, thanks to PaX team for providing it. The patch was applied and tested for a while in Gentoo and Pardus, and solves also Debian's problems with non-PIC code. If problems will arise, they'll be debugged. +** ** Revision 1.9 2006/02/04 14:06:29 miguelfreitas ** Enable AMD64 mmx/sse support in some plugins (tvtime, libmpeg2, goom...) ** patch by dani3l @@ -187,7 +190,7 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, * See above for a description of the algorithm. */ ".align 8 \n\t" - "movq "MANGLE(Mask)", %%mm6 \n\t" + "movq %4, %%mm6 \n\t" "movq %0, %%mm1 \n\t" // T1 "movq %1, %%mm0 \n\t" // M1 @@ -195,7 +198,7 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, "movq %3, %%mm2 \n\t" // M0 : /* no output */ : "m" (*T1), "m" (*M1), - "m" (*B1), "m" (*M0) ); + "m" (*B1), "m" (*M0), "m" (Mask) ); asm volatile( @@ -252,10 +255,10 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, #endif /* if |M1-M0| > Threshold we want dword worth of twos */ - "pcmpgtb "MANGLE(qwGreedyTwoFrameThreshold)", %%mm4 \n\t" - "pand "MANGLE(Mask)", %%mm4 \n\t" /* get rid of sign bit */ - "pcmpgtd "MANGLE(DwordOne)", %%mm4 \n\t" /* do we want to bob */ - "pandn "MANGLE(DwordTwo)", %%mm4 \n\t" + "pcmpgtb %3, %%mm4 \n\t" + "pand %4, %%mm4 \n\t" /* get rid of sign bit */ + "pcmpgtd %5, %%mm4 \n\t" /* do we want to bob */ + "pandn %6, %%mm4 \n\t" "movq %1, %%mm2 \n\t" /* mm2 = T0 */ @@ -268,11 +271,11 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, "pand %%mm6, %%mm5 \n\t" /* if |T1-T0| > Threshold we want dword worth of ones */ - "pcmpgtb "MANGLE(qwGreedyTwoFrameThreshold)", %%mm5 \n\t" + "pcmpgtb %3, %%mm5 \n\t" "pand %%mm6, %%mm5 \n\t" /* get rid of sign bit */ - "pcmpgtd "MANGLE(DwordOne)", %%mm5 \n\t" - "pandn "MANGLE(DwordOne)", %%mm5 \n\t" + "pcmpgtd %5, %%mm5 \n\t" + "pandn %5, %%mm5 \n\t" "paddd %%mm5, %%mm4 \n\t" "movq %2, %%mm2 \n\t" /* B0 */ @@ -286,13 +289,13 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, "pand %%mm6, %%mm5 \n\t" /* if |B1-B0| > Threshold we want dword worth of ones */ - "pcmpgtb "MANGLE(qwGreedyTwoFrameThreshold)", %%mm5 \n\t" + "pcmpgtb %3, %%mm5 \n\t" "pand %%mm6, %%mm5 \n\t" /* get rid of any sign bit */ - "pcmpgtd "MANGLE(DwordOne)", %%mm5 \n\t" - "pandn "MANGLE(DwordOne)", %%mm5 \n\t" + "pcmpgtd %5, %%mm5 \n\t" + "pandn %5, %%mm5 \n\t" "paddd %%mm5, %%mm4 \n\t" - "pcmpgtd "MANGLE(DwordTwo)", %%mm4 \n\t" + "pcmpgtd %6, %%mm4 \n\t" /* debugging feature * output the value of mm4 at this point which is pink where we will weave @@ -318,7 +321,7 @@ static void DeinterlaceGreedy2Frame_MMX(uint8_t *output, int outstride, #endif : "=m" (*Dest2) - : "m" (*T0), "m" (*B0) ); + : "m" (*T0), "m" (*B0), "m" (qwGreedyTwoFrameThreshold), "m" (Mask), "m" (DwordOne), "m" (DwordTwo) ); /* Advance to the next set of pixels. */ T1 += 8; diff --git a/src/post/deinterlace/plugins/greedyh.asm b/src/post/deinterlace/plugins/greedyh.asm index 0bbd745aa..11b28ca76 100644 --- a/src/post/deinterlace/plugins/greedyh.asm +++ b/src/post/deinterlace/plugins/greedyh.asm @@ -43,7 +43,6 @@ static void FUNCT_NAME(uint8_t *output, int outstride, int Line; long LoopCtr; - long oldbx; unsigned int Pitch = stride*2; int FieldHeight = height / 2; @@ -52,6 +51,7 @@ static void FUNCT_NAME(uint8_t *output, int outstride, unsigned char* L3; // ptr to Line3 unsigned char* L2P; // ptr to prev Line2 + unsigned char* temp; unsigned char* Dest = output; int64_t LastAvg=0; //interp value from left qword @@ -121,25 +121,21 @@ static void FUNCT_NAME(uint8_t *output, int outstride, #define asmLastAvg "%0" #define asmL1 "%1" #define asmL3 "%2" -#define asmL2P "%3" +#define asmtemp "%3" #define asmL2 "%4" #define asmDest "%5" #define asmLoopCtr "%6" -#define asmoldbx "%7" #endif // For ease of reading, the comments below assume that we're operating on an odd // field (i.e., that InfoIsOdd is true). Assume the obvious for even lines.. + temp = L2P; __asm__ __volatile__ ( - // save ebx (-fPIC) - MOVX" %%"XBX", "asmoldbx"\n\t" - MOVX" "asmL1", %%"XAX"\n\t" - LEAX" 8(%%"XAX"), %%"XBX"\n\t" // next qword needed by DJR + LEAX" 8(%%"XAX"), %%"XDX"\n\t" // next qword needed by DJR MOVX" "asmL3", %%"XCX"\n\t" SUBX" %%"XAX", %%"XCX"\n\t" // carry L3 addr as an offset - MOVX" "asmL2P", %%"XDX"\n\t" MOVX" "asmL2", %%"XSI"\n\t" MOVX" "asmDest", %%"XDI"\n\t" // DL1 if Odd or DL2 if Even @@ -148,11 +144,14 @@ static void FUNCT_NAME(uint8_t *output, int outstride, "movq (%%"XSI"), %%mm0\n\t" // L2 - the newest weave pixel value "movq (%%"XAX"), %%mm1\n\t" // L1 - the top pixel + PUSHX" %%"XDX "\n\t" + MOVX" "asmtemp", %%"XDX"\n\t" "movq (%%"XDX"), %%mm2\n\t" // L2P - the prev weave pixel + POPX" %%"XDX "\n\t" "movq (%%"XAX", %%"XCX"), %%mm3\n\t" // L3, next odd row "movq %%mm1, %%mm6\n\t" // L1 - get simple single pixel interp // pavgb mm6, mm3 // use macro below - V_PAVGB ("%%mm6", "%%mm3", "%%mm4", MANGLE(ShiftMask)) + V_PAVGB ("%%mm6", "%%mm3", "%%mm4", "%8") // DJR - Diagonal Jaggie Reduction // In the event that we are going to use an average (Bob) pixel we do not want a jagged @@ -166,24 +165,24 @@ static void FUNCT_NAME(uint8_t *output, int outstride, "psllq $16, %%mm7\n\t" // left justify 3 pixels "por %%mm7, %%mm4\n\t" // and combine - "movq (%%"XBX"), %%mm5\n\t" // next horiz qword from L1 + "movq (%%"XDX"), %%mm5\n\t" // next horiz qword from L1 // pavgb mm5, qword ptr[ebx+ecx] // next horiz qword from L3, use macro below - V_PAVGB ("%%mm5", "(%%"XBX",%%"XCX")", "%%mm7", MANGLE(ShiftMask)) + V_PAVGB ("%%mm5", "(%%"XDX",%%"XCX")", "%%mm7", "%8") "psllq $48, %%mm5\n\t" // left just 1 pixel "movq %%mm6, %%mm7\n\t" // another copy of simple bob pixel "psrlq $16, %%mm7\n\t" // right just 3 pixels "por %%mm7, %%mm5\n\t" // combine // pavgb mm4, mm5 // avg of forward and prev by 1 pixel, use macro - V_PAVGB ("%%mm4", "%%mm5", "%%mm5", MANGLE(ShiftMask)) // mm5 gets modified if MMX + V_PAVGB ("%%mm4", "%%mm5", "%%mm5", "%8") // mm5 gets modified if MMX // pavgb mm6, mm4 // avg of center and surround interp vals, use macro - V_PAVGB ("%%mm6", "%%mm4", "%%mm7", MANGLE(ShiftMask)) + V_PAVGB ("%%mm6", "%%mm4", "%%mm7", "%8") // Don't do any more averaging than needed for mmx. It hurts performance and causes rounding errors. #ifndef IS_MMX // pavgb mm4, mm6 // 1/4 center, 3/4 adjacent - V_PAVGB ("%%mm4", "%%mm6", "%%mm7", MANGLE(ShiftMask)) + V_PAVGB ("%%mm4", "%%mm6", "%%mm7", "%8") // pavgb mm6, mm4 // 3/8 center, 5/8 adjacent - V_PAVGB ("%%mm6", "%%mm4", "%%mm7", MANGLE(ShiftMask)) + V_PAVGB ("%%mm6", "%%mm4", "%%mm7", "%8") #endif // get abs value of possible L2 comb @@ -236,64 +235,71 @@ static void FUNCT_NAME(uint8_t *output, int outstride, // pminub mm5, mm3 // now = Min(L1,L3), use macro V_PMINUB ("%%mm5", "%%mm3", "%%mm7") // allow the value to be above the high or below the low by amt of MaxComb - "psubusb "MANGLE(MaxComb)", %%mm5\n\t" // lower min by diff - "paddusb "MANGLE(MaxComb)", %%mm2\n\t" // increase max by diff + "psubusb %9, %%mm5\n\t" // lower min by diff + "paddusb %9, %%mm2\n\t" // increase max by diff // pmaxub mm4, mm5 // now = Max(best,Min(L1,L3) use macro V_PMAXUB ("%%mm4", "%%mm5") // pminub mm4, mm2 // now = Min( Max(best, Min(L1,L3), L2 )=L2 clipped V_PMINUB ("%%mm4", "%%mm2", "%%mm7") // Blend weave pixel with bob pixel, depending on motion val in mm0 - "psubusb "MANGLE(MotionThreshold)", %%mm0\n\t"// test Threshold, clear chroma change >>>?? - "pmullw "MANGLE(MotionSense)", %%mm0\n\t" // mul by user factor, keep low 16 bits - "movq "MANGLE(QW256)", %%mm7\n\t" + "psubusb %10, %%mm0\n\t"// test Threshold, clear chroma change >>>?? + "pmullw %11, %%mm0\n\t" // mul by user factor, keep low 16 bits + "movq %12, %%mm7\n\t" #ifdef IS_SSE "pminsw %%mm7, %%mm0\n\t" // max = 256 #else - "paddusw "MANGLE(QW256B)", %%mm0\n\t" // add, may sat at fff.. - "psubusw "MANGLE(QW256B)", %%mm0\n\t" // now = Min(L1,256) + "paddusw %13, %%mm0\n\t" // add, may sat at fff.. + "psubusw %13, %%mm0\n\t" // now = Min(L1,256) #endif "psubusw %%mm0, %%mm7\n\t" // so the 2 sum to 256, weighted avg "movq %%mm4, %%mm2\n\t" // save weave chroma info before trashing - "pand "MANGLE(YMask)", %%mm4\n\t" // keep only luma from calc'd value + "pand %14, %%mm4\n\t" // keep only luma from calc'd value "pmullw %%mm7, %%mm4\n\t" // use more weave for less motion - "pand "MANGLE(YMask)", %%mm6\n\t" // keep only luma from calc'd value + "pand %14, %%mm6\n\t" // keep only luma from calc'd value "pmullw %%mm0, %%mm6\n\t" // use more bob for large motion "paddusw %%mm6, %%mm4\n\t" // combine "psrlw $8, %%mm4\n\t" // div by 256 to get weighted avg // chroma comes from weave pixel - "pand "MANGLE(UVMask)", %%mm2\n\t" // keep chroma + "pand %15, %%mm2\n\t" // keep chroma "por %%mm4, %%mm2\n\t" // and combine V_MOVNTQ ("(%%"XDI")", "%%mm2") // move in our clipped best, use macro // bump ptrs and loop LEAX" 8(%%"XAX"), %%"XAX"\n\t" - LEAX" 8(%%"XBX"), %%"XBX"\n\t" LEAX" 8(%%"XDX"), %%"XDX"\n\t" + ADDX" $8, "asmtemp"\n\t" LEAX" 8(%%"XDI"), %%"XDI"\n\t" LEAX" 8(%%"XSI"), %%"XSI"\n\t" DECX" "asmLoopCtr"\n\t" "jg 1b\n\t" // loop if not to last line // note P-III default assumes backward branches taken "jl 1f\n\t" // done - MOVX" %%"XAX", %%"XBX"\n\t" // sharpness lookahead 1 byte only, be wrong on 1 + MOVX" %%"XAX", %%"XDX"\n\t" // sharpness lookahead 1 byte only, be wrong on 1 "jmp 1b\n\t" "1:\n\t" - MOVX" "asmoldbx", %%"XBX"\n\t" : /* no outputs */ : "m"(LastAvg), "m"(L1), "m"(L3), - "m"(L2P), + "m"(temp), "m"(L2), "m"(Dest), "m"(LoopCtr), - "m"(oldbx) + "m"(temp), + "m"(ShiftMask), + "m"(MaxComb), + "m"(MotionThreshold), + "m"(MotionSense), + "m"(QW256), + "m"(QW256B), + "m"(YMask), + "m"(UVMask) : XAX, XCX, XDX, XSI, XDI, #ifdef ARCH_X86 diff --git a/src/post/deinterlace/plugins/tomsmocomp/SearchLoop0A.inc b/src/post/deinterlace/plugins/tomsmocomp/SearchLoop0A.inc index 844c6f91a..b1d9aeca7 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/SearchLoop0A.inc +++ b/src/post/deinterlace/plugins/tomsmocomp/SearchLoop0A.inc @@ -7,9 +7,9 @@ // up by a little, and adjust later #ifdef IS_SSE2 - "paddusb "MANGLE(ONES)", %%xmm7\n\t" // bias toward no motion + "paddusb "_ONES", %%xmm7\n\t" // bias toward no motion #else - "paddusb "MANGLE(ONES)", %%mm7\n\t" // bias toward no motion + "paddusb "_ONES", %%mm7\n\t" // bias toward no motion #endif MERGE4PIXavg("(%%"XDI", %%"XCX")", "(%%"XSI", %%"XCX")") // center, in old and new diff --git a/src/post/deinterlace/plugins/tomsmocomp/SearchLoopBottom.inc b/src/post/deinterlace/plugins/tomsmocomp/SearchLoopBottom.inc index 63755d1fc..72a2782a2 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/SearchLoopBottom.inc +++ b/src/post/deinterlace/plugins/tomsmocomp/SearchLoopBottom.inc @@ -18,7 +18,7 @@ // Use the best weave if diffs less than 10 as that // means the image is still or moving cleanly // if there is motion we will clip which will catch anything - "psubusb "MANGLE(FOURS)", %%mm7\n\t" // sets bits to zero if weave diff < 4 + "psubusb "_FOURS", %%mm7\n\t" // sets bits to zero if weave diff < 4 "pxor %%mm0, %%mm0\n\t" "pcmpeqb %%mm0, %%mm7\n\t" // all ff where weave better, else 00 "pcmpeqb %%mm7, %%mm0\n\t" // all ff where bob better, else 00 @@ -28,10 +28,10 @@ #else // Use the better of bob or weave // pminub mm4, TENS // the most we care about - V_PMINUB ("%%mm4", MANGLE(TENS), "%%mm0") // the most we care about + V_PMINUB ("%%mm4", _TENS, "%%mm0") // the most we care about "psubusb %%mm4, %%mm7\n\t" // foregive that much from weave est? - "psubusb "MANGLE(FOURS)", %%mm7\n\t" // bias it a bit toward weave + "psubusb "_FOURS", %%mm7\n\t" // bias it a bit toward weave "pxor %%mm0, %%mm0\n\t" "pcmpeqb %%mm0, %%mm7\n\t" // all ff where weave better, else 00 "pcmpeqb %%mm7, %%mm0\n\t" // all ff where bob better, else 00 @@ -42,9 +42,9 @@ // pminub mm0, Max_Vals // but clip to catch the stray error -// V_PMINUB ("%%mm0", MANGLE(Max_Vals), "%%mm1") // but clip to catch the stray error +// V_PMINUB ("%%mm0", _Max_Vals, "%%mm1") // but clip to catch the stray error // pmaxub mm0, Min_Vals -// V_PMAXUB ("%%mm0", MANGLE(Min_Vals)) +// V_PMAXUB ("%%mm0", _Min_Vals) #endif @@ -53,28 +53,29 @@ #ifdef USE_VERTICAL_FILTER "movq %%mm0, %%mm1\n\t" - // pavgb mm0, qword ptr["XBX"] - V_PAVGB ("%%mm0", "(%%"XBX")", "%%mm2", MANGLE(ShiftMask)) - // movntq qword ptr["XAX"+"XDX"], mm0 - V_MOVNTQ ("(%"XAX", %%"XDX")", "%%mm0") - // pavgb mm1, qword ptr["XBX"+"XCX"] - V_PAVGB ("%%mm1", "(%%"XBX", %%"XCX")", "%%mm2", MANGLE(ShiftMask)) - "addq "_dst_pitchw", %%"XBX - // movntq qword ptr["XAX"+"XDX"], mm1 - V_MOVNTQ ("(%%"XAX", %%"XDX")", "%%mm1") + // pavgb mm0, qword ptr["XDX"] + V_PAVGB ("%%mm0", "(%%"XDX")", "%%mm2", _ShiftMask) + // movntq qword ptr["XAX"+"olddx"], mm0 + ADDX" "_olddx", %%"XAX"\n\t" + V_MOVNTQ ("(%%"XAX")", "%%mm0") + // pavgb mm1, qword ptr["XDX"+"XCX"] + V_PAVGB ("%%mm1", "(%%"XDX", %%"XCX")", "%%mm2", _ShiftMask) + "addq "_dst_pitchw", %%"XDX + // movntq qword ptr["XAX"+"olddx"], mm1 + V_MOVNTQ ("(%%"XAX")", "%%mm1") #else - // movntq qword ptr["XAX"+"XDX"], mm0 - V_MOVNTQ ("(%%"XAX", %%"XDX")", "%%mm0") + // movntq qword ptr["XAX"+"olddx"], mm0 + ADDX" "_olddx", %%"XAX"\n\t" + V_MOVNTQ ("(%%"XAX")", "%%mm0") #endif - LEAX" 8(%%"XDX"), %%"XDX"\n\t" // bump offset pointer - CMPX" "_Last8", %%"XDX"\n\t" // done with line? + ADDX" $8, "_olddx"\n\t" // bump offset pointer + MOVX" "_olddx", %%"XAX"\n\t" + CMPX" "_Last8", %%"XAX"\n\t" // done with line? "jb 1b\n\t" // y #endif - MOVX" "_oldbx", %%"XBX"\n\t" - : /* no outputs */ : "m"(pBob), @@ -85,7 +86,17 @@ "m"(pSrc), "m"(pSrcP), "m"(pBobP), - "m"(oldbx) + "m"(olddx), + "m"(UVMask), + "m"(ShiftMask), + "m"(FOURS), + "m"(TENS), + "m"(Max_Vals), + "m"(Min_Vals), + "m"(YMask), + "m"(Max_Mov), + "m"(ONES), + "m"(DiffThres) : XAX, XCX, XDX, XSI, XDI, #ifdef ARCH_X86 diff --git a/src/post/deinterlace/plugins/tomsmocomp/SearchLoopTop.inc b/src/post/deinterlace/plugins/tomsmocomp/SearchLoopTop.inc index 5e9f7f04a..4504be1d1 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/SearchLoopTop.inc +++ b/src/post/deinterlace/plugins/tomsmocomp/SearchLoopTop.inc @@ -66,7 +66,17 @@ long dst_pitchw = dst_pitch; // local stor so asm can ref #define _pSrc "%5" #define _pSrcP "%6" #define _pBobP "%7" -#define _oldbx "%8" +#define _olddx "%8" +#define _UVMask "%9" +#define _ShiftMask "%10" +#define _FOURS "%11" +#define _TENS "%12" +#define _Max_Vals "%13" +#define _Min_Vals "%14" +#define _YMask "%15" +#define _Max_Mov "%16" +#define _ONES "%17" +#define _DiffThres "%18" #endif for (y=1; y < FldHeight-1; y++) @@ -77,75 +87,73 @@ long dst_pitchw = dst_pitch; // local stor so asm can ref // Loop general reg usage // // XAX - pBobP, then pDest - // XBX - pBob + // XDX - pBob // XCX - src_pitch2 - // XDX - current offset + // _olddx - current offset // XDI - prev weave pixels, 1 line up // XSI - next weave pixels, 1 line up - // Save "XBX" (-fPIC) - MOVX" %%"XBX", "_oldbx"\n\t" - #ifdef IS_SSE2 // sse2 code deleted for now #else // simple bob first 8 bytes - MOVX" "_pBob", %%"XBX"\n\t" + MOVX" "_pBob", %%"XDX"\n\t" MOVX" "_src_pitch2", %%"XCX"\n\t" #ifdef USE_VERTICAL_FILTER - "movq (%%"XBX"), %%mm0\n\t" - "movq (%%"XBX", %%"XCX"), %%mm1\n\t" //, qword ptr["XBX"+"XCX"] + "movq (%%"XDX"), %%mm0\n\t" + "movq (%%"XDX", %%"XCX"), %%mm1\n\t" //, qword ptr["XDX"+"XCX"] "movq %%mm0, %%mm2\n\t" - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // halfway between - V_PAVGB ("%%mm0", "%%mm2", "%%mm3", MANGLE(ShiftMask)) // 1/4 way - V_PAVGB ("%%mm1", "%%mm2", "%%mm3", MANGLE(ShiftMask)) // 3/4 way + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // halfway between + V_PAVGB ("%%mm0", "%%mm2", "%%mm3", _ShiftMask) // 1/4 way + V_PAVGB ("%%mm1", "%%mm2", "%%mm3", _ShiftMask) // 3/4 way MOVX" "_pDest", %%"XDI"\n\t" MOVX" "_dst_pitchw", %%"XAX"\n\t" V_MOVNTQ ("(%%"XDI")", "%%mm0") V_MOVNTQ ("(%%"XDI", %%"XAX")", "%%mm1") // qword ptr["XDI"+"XAX"], mm1 // simple bob last 8 bytes - MOVX" "_Last8", %%"XDX"\n\t" - LEAX" (%%"XBX", %%"XDX"), %%"XSI"\n\t" // ["XBX"+"XDX"] + MOVX" "_Last8", %%"XSI"\n\t" + ADDX" %%"XDX", %%"XSI"\n\t" // ["XDX"+"olddx"] "movq (%%"XSI"), %%mm0\n\t" "movq (%%"XSI", %%"XCX"), %%mm1\n\t" // qword ptr["XSI"+"XCX"] "movq %%mm0, %%mm2\n\t" - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // halfway between - V_PAVGB ("%%mm0", "%%mm2", "%%mm3", MANGLE(ShiftMask)) // 1/4 way - V_PAVGB ("%%mm1", "%%mm2", "%%mm3", MANGLE(ShiftMask)) // 3/4 way - ADDX" %%"XDX", %%"XDI"\n\t" // last 8 bytes of dest + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // halfway between + V_PAVGB ("%%mm0", "%%mm2", "%%mm3", _ShiftMask) // 1/4 way + V_PAVGB ("%%mm1", "%%mm2", "%%mm3", _ShiftMask) // 3/4 way + ADDX" "_olddx", %%"XDI"\n\t" // last 8 bytes of dest V_MOVNTQ ("%%"XDI"", "%%mm0") V_MOVNTQ ("(%%"XDI", %%"XAX")", "%%mm1") // qword ptr["XDI"+"XAX"], mm1) #else - "movq (%%"XBX"), %%mm0\n\t" - // pavgb mm0, qword ptr["XBX"+"XCX"] - V_PAVGB ("%%mm0", "(%%"XBX", %%"XCX")", "%%mm2", MANGLE(ShiftMask)) // qword ptr["XBX"+"XCX"], mm2, ShiftMask) + "movq (%%"XDX"), %%mm0\n\t" + // pavgb mm0, qword ptr["XDX"+"XCX"] + V_PAVGB ("%%mm0", "(%%"XDX", %%"XCX")", "%%mm2", _ShiftMask) // qword ptr["XDX"+"XCX"], mm2, ShiftMask) MOVX" "_pDest", %%"XDI"\n\t" V_MOVNTQ ("(%%"XDI")", "%%mm0") // simple bob last 8 bytes - MOVX" "_Last8", %%"XDX"\n\t" - LEAX" (%%"XBX", %%"XDX"), %%"XSI"\n\t" //"XSI", ["XBX"+"XDX"] + MOVX" "_Last8", %%"XSI"\n\t" + ADDX" %%"XDX", %%"XSI"\n\t" //"XSI", ["XDX"+"olddx"] "movq (%%"XSI"), %%mm0\n\t" // pavgb mm0, qword ptr["XSI"+"XCX"] - V_PAVGB ("%%mm0", "(%%"XSI", %%"XCX")", "%%mm2", MANGLE(ShiftMask)) // qword ptr["XSI"+"XCX"], mm2, ShiftMask) - V_MOVNTQ ("(%%"XDI", %%"XDX")", "%%mm0") // qword ptr["XDI"+"XDX"], mm0) + V_PAVGB ("%%mm0", "(%%"XSI", %%"XCX")", "%%mm2", _ShiftMask) // qword ptr["XSI"+"XCX"], mm2, ShiftMask) + ADDX" "_olddx", %%"XDI"\n\t" + V_MOVNTQ ("(%%"XDI")", "%%mm0") // qword ptr["XDI"+"olddx"], mm0) #endif // now loop and get the middle qwords MOVX" "_pSrc", %%"XSI"\n\t" MOVX" "_pSrcP", %%"XDI"\n\t" - MOVX" $8, %%"XDX"\n\t" // curr offset longo all lines + MOVX" $8, "_olddx"\n\t" // curr offset longo all lines "1:\n\t" MOVX" "_pBobP", %%"XAX"\n\t" ADDX" $8, %%"XDI"\n\t" ADDX" $8, %%"XSI"\n\t" - ADDX" $8, %%"XBX"\n\t" - ADDX" %%"XDX", %%"XAX"\n\t" + ADDX" $8, %%"XDX"\n\t" + ADDX" "_olddx", %%"XAX"\n\t" #ifdef USE_STRANGE_BOB #include "StrangeBob.inc" diff --git a/src/post/deinterlace/plugins/tomsmocomp/StrangeBob.inc b/src/post/deinterlace/plugins/tomsmocomp/StrangeBob.inc index 5ca5b85bb..9d02ebc11 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/StrangeBob.inc +++ b/src/post/deinterlace/plugins/tomsmocomp/StrangeBob.inc @@ -31,22 +31,22 @@ "pxor %%mm6, %%mm6\n\t" "pxor %%mm7, %%mm7\n\t" - "movq -2(%%"XBX"), %%mm0\n\t" // value a from top left - "movq -4(%%"XBX", %%"XCX"), %%mm1\n\t" // value m from bottom right + "movq -2(%%"XDX"), %%mm0\n\t" // value a from top left + "movq -4(%%"XDX", %%"XCX"), %%mm1\n\t" // value m from bottom right "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm3\n\t" "psubusb %%mm0, %%mm1\n\t" "por %%mm1, %%mm3\n\t" // abs(a,m) - "psubusb "MANGLE(DiffThres)", %%mm3\n\t" // nonzero where abs(a,m) > Thres else 0 + "psubusb "_DiffThres", %%mm3\n\t" // nonzero where abs(a,m) > Thres else 0 "pxor %%mm4, %%mm4\n\t" "pcmpeqb %%mm4, %%mm3\n\t" // now ff where abs(a,m) < Thres, else 00 "pcmpeqb %%mm3, %%mm4\n\t" // here ff where abs(a,m) > Thres, else 00 - "movq -4(%%"XBX"), %%mm0\n\t" // value j - "movq 4(%%"XBX", %%"XCX"), %%mm1\n\t" // value n + "movq -4(%%"XDX"), %%mm0\n\t" // value j + "movq 4(%%"XDX", %%"XCX"), %%mm1\n\t" // value n "movq %%mm0, %%mm2\n\t" "pavgb %%mm1, %%mm2\n\t" // avg(j,n) "movq %%mm0, %%mm3\n\t" @@ -55,7 +55,7 @@ "por %%mm1, %%mm0\n\t" // abs(j,n) "movq %%mm0, %%mm1\n\t" - "psubusb "MANGLE(DiffThres)", %%mm1\n\t" // nonzero where abs(j,n) > Thres else 0 + "psubusb "_DiffThres", %%mm1\n\t" // nonzero where abs(j,n) > Thres else 0 "pxor %%mm3, %%mm3\n\t" "pcmpeqb %%mm3, %%mm1\n\t" // now ff where abs(j,n) < Thres, else 00 @@ -75,31 +75,31 @@ "por %%mm0, %%mm7\n\t" // k & m - "movq 2(%%"XBX"), %%mm0\n\t" // value c from top left - "movq 4(%%"XBX", %%"XCX"), %%mm1\n\t" // value n from bottom right + "movq 2(%%"XDX"), %%mm0\n\t" // value c from top left + "movq 4(%%"XDX", %%"XCX"), %%mm1\n\t" // value n from bottom right "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm3\n\t" "psubusb %%mm0, %%mm1\n\t" "por %%mm1, %%mm3\n\t" // abs(c,n) - "psubusb "MANGLE(DiffThres)", %%mm3\n\t" // nonzero where abs(c,n) > Thres else 0 + "psubusb "_DiffThres", %%mm3\n\t" // nonzero where abs(c,n) > Thres else 0 "pxor %%mm4, %%mm4\n\t" "pcmpeqb %%mm4, %%mm3\n\t" // now ff where abs(c,n) < Thres, else 00 "pcmpeqb %%mm3, %%mm4\n\t" // here ff where abs(c,n) > Thres, else 00 - "movq 4(%%"XBX"), %%mm0\n\t" // value k - "movq -4(%%"XBX", %%"XCX"), %%mm1\n\t" // value m + "movq 4(%%"XDX"), %%mm0\n\t" // value k + "movq -4(%%"XDX", %%"XCX"), %%mm1\n\t" // value m "movq %%mm0, %%mm2\n\t" - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // avg(k,m) + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(k,m) "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm0\n\t" "psubusb %%mm3, %%mm1\n\t" "por %%mm1, %%mm0\n\t" // abs(k,m) "movq %%mm0, %%mm1\n\t" - "psubusb "MANGLE(DiffThres)", %%mm1\n\t" // nonzero where abs(k,m) > Thres else 0 + "psubusb "_DiffThres", %%mm1\n\t" // nonzero where abs(k,m) > Thres else 0 "pxor %%mm3, %%mm3\n\t" "pcmpeqb %%mm3, %%mm1\n\t" // now ff where abs(k,m) < Thres, else 00 @@ -120,30 +120,30 @@ // c & d - "movq (%%"XBX"), %%mm0\n\t" // value b from top left - "movq 2(%%"XBX", %%"XCX"), %%mm1\n\t" // value f from bottom right + "movq (%%"XDX"), %%mm0\n\t" // value b from top left + "movq 2(%%"XDX", %%"XCX"), %%mm1\n\t" // value f from bottom right "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm3\n\t" "psubusb %%mm0, %%mm1\n\t" "por %%mm1, %%mm3\n\t" // abs(b,f) - "psubusb "MANGLE(DiffThres)", %%mm3\n\t" // nonzero where abs(b,f) > Thres else 0 + "psubusb "_DiffThres", %%mm3\n\t" // nonzero where abs(b,f) > Thres else 0 "pxor %%mm4, %%mm4\n\t" "pcmpeqb %%mm4, %%mm3\n\t" // now ff where abs(b,f) < Thres, else 00 "pcmpeqb %%mm3, %%mm4\n\t" // here ff where abs(b,f) > Thres, else 00 - "movq 2(%%"XBX"), %%mm0\n\t" // value c - "movq -2(%%"XBX", %%"XCX"), %%mm1\n\t" // value d + "movq 2(%%"XDX"), %%mm0\n\t" // value c + "movq -2(%%"XDX", %%"XCX"), %%mm1\n\t" // value d "movq %%mm0, %%mm2\n\t" - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // avg(c,d) + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(c,d) "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm0\n\t" "psubusb %%mm3, %%mm1\n\t" "por %%mm1, %%mm0\n\t" // abs(c,d) "movq %%mm0, %%mm1\n\t" - "psubusb "MANGLE(DiffThres)", %%mm1\n\t" // nonzero where abs(c,d) > Thres else 0 + "psubusb "_DiffThres", %%mm1\n\t" // nonzero where abs(c,d) > Thres else 0 "pxor %%mm3, %%mm3\n\t" "pcmpeqb %%mm3, %%mm1\n\t" // now ff where abs(c,d) < Thres, else 00 @@ -163,30 +163,30 @@ "por %%mm0, %%mm7\n\t" // a & f - "movq (%%"XBX"), %%mm0\n\t" // value b from top left - "movq -2(%%"XBX", %%"XCX"), %%mm1\n\t" // value d from bottom right + "movq (%%"XDX"), %%mm0\n\t" // value b from top left + "movq -2(%%"XDX", %%"XCX"), %%mm1\n\t" // value d from bottom right "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm3\n\t" "psubusb %%mm0, %%mm1\n\t" "por %%mm1, %%mm3\n\t" // abs(b,d) - "psubusb "MANGLE(DiffThres)", %%mm3\n\t" // nonzero where abs(b,d) > Thres else 0 + "psubusb "_DiffThres", %%mm3\n\t" // nonzero where abs(b,d) > Thres else 0 "pxor %%mm4, %%mm4\n\t" "pcmpeqb %%mm4, %%mm3\n\t" // now ff where abs(b,d) < Thres, else 00 "pcmpeqb %%mm3, %%mm4\n\t" // here ff where abs(b,d) > Thres, else 00 - "movq -2(%%"XBX"), %%mm0\n\t" // value a - "movq 2(%%"XBX", %%"XCX"), %%mm1\n\t" // value f + "movq -2(%%"XDX"), %%mm0\n\t" // value a + "movq 2(%%"XDX", %%"XCX"), %%mm1\n\t" // value f "movq %%mm0, %%mm2\n\t" - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // avg(a,f) + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(a,f) "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm0\n\t" "psubusb %%mm3, %%mm1\n\t" "por %%mm1, %%mm0\n\t" // abs(a,f) "movq %%mm0, %%mm1\n\t" - "psubusb "MANGLE(DiffThres)", %%mm1\n\t" // nonzero where abs(a,f) > Thres else 0 + "psubusb "_DiffThres", %%mm1\n\t" // nonzero where abs(a,f) > Thres else 0 "pxor %%mm3, %%mm3\n\t" "pcmpeqb %%mm3, %%mm1\n\t" // now ff where abs(a,f) < Thres, else 00 @@ -205,22 +205,22 @@ "por %%mm2, %%mm6\n\t" "por %%mm0, %%mm7\n\t" - "pand "MANGLE(YMask)", %%mm5\n\t" // mask out chroma from here - "pand "MANGLE(YMask)", %%mm6\n\t" // mask out chroma from here - "pand "MANGLE(YMask)", %%mm7\n\t" // mask out chroma from here + "pand "_YMask", %%mm5\n\t" // mask out chroma from here + "pand "_YMask", %%mm6\n\t" // mask out chroma from here + "pand "_YMask", %%mm7\n\t" // mask out chroma from here // b,e - "movq (%%"XBX"), %%mm0\n\t" // value b from top - "movq (%%"XBX", %%"XCX"), %%mm1\n\t" // value e from bottom + "movq (%%"XDX"), %%mm0\n\t" // value b from top + "movq (%%"XDX", %%"XCX"), %%mm1\n\t" // value e from bottom "movq %%mm0, %%mm2\n\t" - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // avg(b,e) + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(b,e) "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm0\n\t" "psubusb %%mm3, %%mm1\n\t" "por %%mm1, %%mm0\n\t" // abs(b,e) "movq %%mm0, %%mm1\n\t" - "psubusb "MANGLE(DiffThres)", %%mm1\n\t" // nonzero where abs(b,e) > Thres else 0 + "psubusb "_DiffThres", %%mm1\n\t" // nonzero where abs(b,e) > Thres else 0 "pxor %%mm3, %%mm3\n\t" "pcmpeqb %%mm3, %%mm1\n\t" // now ff where abs(b,e) < Thres, else 00 @@ -238,8 +238,8 @@ "por %%mm0, %%mm7\n\t" // bob in any leftovers - "movq (%%"XBX"), %%mm0\n\t" // value b from top - "movq (%%"XBX", %%"XCX"), %%mm1\n\t" // value e from bottom + "movq (%%"XDX"), %%mm0\n\t" // value b from top + "movq (%%"XDX", %%"XCX"), %%mm1\n\t" // value e from bottom // We will also calc here the max/min values to later limit comb @@ -271,7 +271,7 @@ "por %%mm2, %%mm3\n\t" // abs diff // pmaxub %%mm3, %%mm4 // top or bottom pixel moved most V_PMAXUB ("%%mm3", "%%mm4") // top or bottom pixel moved most - "psubusb "MANGLE(DiffThres)", %%mm3\n\t" // moved more than allowed? or goes to 0? + "psubusb "_DiffThres", %%mm3\n\t" // moved more than allowed? or goes to 0? "pxor %%mm4, %%mm4\n\t" "pcmpeqb %%mm4, %%mm3\n\t" // now ff where low motion, else high motion @@ -283,19 +283,19 @@ V_PMAXUB ("%%mm6", "%%mm2") "psubusb %%mm3, %%mm2\n\t" // maybe decrease it to 0000.. if no surround motion -// "movq %%mm2, "MANGLE(Min_Vals)"\n\t" +// "movq %%mm2, "_Min_Vals"\n\t" "movq %%mm0, %%mm2\n\t" V_PMAXUB ("%%mm2", "%%mm1") // pminub %%mm6, %%mm2 // clip our current results so far to be below this V_PMINUB ("%%mm6", "%%mm2", "%%mm4") "paddusb %%mm3, %%mm2\n\t" // maybe increase it to ffffff if no surround motion -// "movq %%mm2, "MANGLE(Max_Vals)"\n\t" +// "movq %%mm2, "_Max_Vals"\n\t" #endif "movq %%mm0, %%mm2\n\t" // pavgb %%mm2, %%mm1 // avg(b,e) - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // avg(b,e) + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(b,e) "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm3\n\t" diff --git a/src/post/deinterlace/plugins/tomsmocomp/TomsMoCompAll.inc b/src/post/deinterlace/plugins/tomsmocomp/TomsMoCompAll.inc index 5870d77be..a3b139691 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/TomsMoCompAll.inc +++ b/src/post/deinterlace/plugins/tomsmocomp/TomsMoCompAll.inc @@ -33,8 +33,8 @@ static const int64_t __attribute__((__used__)) TENS = 0x0a0a0a0a0a0a0a0aull static const int64_t __attribute__((__used__)) FOURS = 0x0404040404040404ull; static const int64_t __attribute__((__used__)) ONES = 0x0101010101010101ull; static const int64_t __attribute__((__used__)) ShiftMask = 0xfefffefffefffeffull; -//static int64_t Min_Vals = 0x0000000000000000ull; -//static int64_t Max_Vals = 0x0000000000000000ull; +static int64_t Min_Vals = 0x0000000000000000ull; +static int64_t Max_Vals = 0x0000000000000000ull; #endif #ifndef TopFirst @@ -69,7 +69,7 @@ static void FUNCT_NAME(uint8_t *output, int outstride, int rowsize; int FldHeight; int stride = (width*2); - long oldbx; + long olddx; src_pitch = stride*2; diff --git a/src/post/deinterlace/plugins/tomsmocomp/WierdBob.inc b/src/post/deinterlace/plugins/tomsmocomp/WierdBob.inc index 11614879a..9aa53b119 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/WierdBob.inc +++ b/src/post/deinterlace/plugins/tomsmocomp/WierdBob.inc @@ -14,22 +14,22 @@ // selected for the smallest of abs(a,f), abs(c,d), or abs(b,e), etc. // a,f - "movq -2(%%"XBX"), %%mm0\n\t" // value a from top left - "movq 2(%%"XBX", %%"XCX"), %%mm1\n\t" // value f from bottom right + "movq -2(%%"XDX"), %%mm0\n\t" // value a from top left + "movq 2(%%"XDX", %%"XCX"), %%mm1\n\t" // value f from bottom right "movq %%mm0, %%mm6\n\t" // pavgb %%mm6, %%mm1 // avg(a,f), also best so far - V_PAVGB ("%%mm6", "%%mm1", "%%mm7", MANGLE(ShiftMask)) // avg(a,f), also best so far + V_PAVGB ("%%mm6", "%%mm1", "%%mm7", _ShiftMask) // avg(a,f), also best so far "movq %%mm0, %%mm7\n\t" "psubusb %%mm1, %%mm7\n\t" "psubusb %%mm0, %%mm1\n\t" "por %%mm1, %%mm7\n\t" // abs diff, also best so far // c,d - "movq 2(%%"XBX"), %%mm0\n\t" // value a from top left - "movq -2(%%"XBX", %%"XCX"), %%mm1\n\t" // value f from bottom right + "movq 2(%%"XDX"), %%mm0\n\t" // value a from top left + "movq -2(%%"XDX", %%"XCX"), %%mm1\n\t" // value f from bottom right "movq %%mm0, %%mm2\n\t" // pavgb %%mm2, %%mm1 // avg(c,d) - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // avg(c,d) + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(c,d) "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm3\n\t" "psubusb %%mm0, %%mm1\n\t" @@ -49,15 +49,15 @@ "por %%mm2, %%mm6\n\t" // and merge new & old vals keeping best "por %%mm1, %%mm7\n\t" - "por "MANGLE(UVMask)", %%mm7\n\t" // but we know chroma is worthless so far - "pand "MANGLE(YMask)", %%mm5\n\t" // mask out chroma from here also + "por "_UVMask", %%mm7\n\t" // but we know chroma is worthless so far + "pand "_YMask", %%mm5\n\t" // mask out chroma from here also // j,n - "movq -4(%%"XBX"), %%mm0\n\t" // value j from top left - "movq 4(%%"XBX", %%"XCX"), %%mm1\n\t" // value n from bottom right + "movq -4(%%"XDX"), %%mm0\n\t" // value j from top left + "movq 4(%%"XDX", %%"XCX"), %%mm1\n\t" // value n from bottom right "movq %%mm0, %%mm2\n\t" // pavgb %%mm2, %%mm1 // avg(j,n) - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // avg(j,n) + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(j,n) "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm3\n\t" "psubusb %%mm0, %%mm1\n\t" @@ -79,11 +79,11 @@ "por %%mm1, %%mm7\n\t" // " // k, m - "movq 4(%%"XBX"), %%mm0\n\t" // value k from top right - "movq -4(%%"XBX", %%"XCX"), %%mm1\n\t" // value n from bottom left + "movq 4(%%"XDX"), %%mm0\n\t" // value k from top right + "movq -4(%%"XDX", %%"XCX"), %%mm1\n\t" // value n from bottom left "movq %%mm0, %%mm4\n\t" // pavgb %%mm4, %%mm1 // avg(k,m) - V_PAVGB ("%%mm4", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // avg(k,m) + V_PAVGB ("%%mm4", "%%mm1", "%%mm3", _ShiftMask) // avg(k,m) "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm3\n\t" @@ -108,8 +108,8 @@ "por %%mm1, %%mm7\n\t" // " // b,e - "movq (%%"XBX"), %%mm0\n\t" // value b from top - "movq (%%"XBX", %%"XCX"), %%mm1\n\t" // value e from bottom + "movq (%%"XDX"), %%mm0\n\t" // value b from top + "movq (%%"XDX", %%"XCX"), %%mm1\n\t" // value e from bottom // We will also calc here the max/min values to later limit comb // so the max excursion will not exceed the Max_Comb constant @@ -140,7 +140,7 @@ "por %%mm2, %%mm3\n\t" // abs diff // pmaxub %%mm3, %%mm4 // top or bottom pixel moved most V_PMAXUB ("%%mm3", "%%mm4") // top or bottom pixel moved most - "psubusb "MANGLE(Max_Mov)", %%mm3\n\t" // moved more than allowed? or goes to 0? + "psubusb "_Max_Mov", %%mm3\n\t" // moved more than allowed? or goes to 0? "pxor %%mm4, %%mm4\n\t" "pcmpeqb %%mm4, %%mm3\n\t" // now ff where low motion, else high motion @@ -152,19 +152,19 @@ V_PMAXUB ("%%mm6", "%%mm2") "psubusb %%mm3, %%mm2\n\t" // maybe decrease it to 0000.. if no surround motion -// "movq %%mm2, "MANGLE(Min_Vals)"\n\t" +// "movq %%mm2, "_Min_Vals"\n\t" "movq %%mm0, %%mm2\n\t" V_PMAXUB ("%%mm2", "%%mm1") // pminub %%mm6, %%mm2 // clip our current results so far to be below this V_PMINUB ("%%mm6", "%%mm2", "%%mm4") "paddusb %%mm3, %%mm2\n\t" // maybe increase it to ffffff if no surround motion -// "movq %%mm2, "MANGLE(Max_Vals)"\n\t" +// "movq %%mm2, "_Max_Vals"\n\t" #endif "movq %%mm0, %%mm2\n\t" // pavgb %%mm2, %%mm1 // avg(b,e) - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // avg(b,e) + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(b,e) "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm3\n\t" diff --git a/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h b/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h index 3d7ae308e..fc1e2f66d 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h +++ b/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h @@ -114,7 +114,7 @@ "por %%xmm0, %%xmm5\n\t" /* and merge new & old vals */ \ "por %%xmm2, %%xmm7\n\t" -#define RESET_CHROMA "por "MANGLE(UVMask)", %%xmm7\n\t" +#define RESET_CHROMA "por "_UVMask", %%xmm7\n\t" #else // ifdef IS_SSE2 @@ -126,7 +126,7 @@ "psubusb %%mm1, %%mm2\n\t" \ "psubusb %%mm0, %%mm3\n\t" \ "por %%mm3, %%mm2\n\t" \ - V_PAVGB ("%%mm0", "%%mm1", "%%mm3", MANGLE(ShiftMask)) /* avg of 2 pixels */ \ + V_PAVGB ("%%mm0", "%%mm1", "%%mm3", _ShiftMask) /* avg of 2 pixels */ \ "movq %%mm2, %%mm3\n\t" /* another copy of our our weights */ \ "pxor %%mm1, %%mm1\n\t" \ "psubusb %%mm7, %%mm3\n\t" /* nonzero where old weights lower, else 0 */ \ @@ -144,14 +144,14 @@ "movq "PADDR2A", %%mm1\n\t" /* our pixel2 value */ \ "movq "PADDR1B", %%mm2\n\t" /* our 4 pixels */ \ "movq "PADDR2B", %%mm3\n\t" /* our pixel2 value */ \ - V_PAVGB("%%mm0", "%%mm2", "%%mm2", MANGLE(ShiftMask)) \ - V_PAVGB("%%mm1", "%%mm3", "%%mm3", MANGLE(ShiftMask)) \ + V_PAVGB("%%mm0", "%%mm2", "%%mm2", _ShiftMask) \ + V_PAVGB("%%mm1", "%%mm3", "%%mm3", _ShiftMask) \ "movq %%mm0, %%mm2\n\t" /* another copy of our pixel1 value */ \ "movq %%mm1, %%mm3\n\t" /* another copy of our pixel1 value */ \ "psubusb %%mm1, %%mm2\n\t" \ "psubusb %%mm0, %%mm3\n\t" \ "por %%mm3, %%mm2\n\t" \ - V_PAVGB("%%mm0", "%%mm1", "%%mm3", MANGLE(ShiftMask)) /* avg of 2 pixels */ \ + V_PAVGB("%%mm0", "%%mm1", "%%mm3", _ShiftMask) /* avg of 2 pixels */ \ "movq %%mm2, %%mm3\n\t" /* another copy of our our weights */ \ "pxor %%mm1, %%mm1\n\t" \ "psubusb %%mm7, %%mm3\n\t" /* nonzero where old weights lower, else 0 */ \ @@ -164,7 +164,7 @@ "por %%mm0, %%mm5\n\t" /* and merge new & old vals */ \ "por %%mm2, %%mm7\n\t" -#define RESET_CHROMA "por "MANGLE(UVMask)", %%mm7\n\t" +#define RESET_CHROMA "por "_UVMask", %%mm7\n\t" #endif -- cgit v1.2.3 From efab2aab1e401c4a7ed564ab5535ba367bce29ed Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Fri, 22 Dec 2006 16:38:15 +0000 Subject: Removed INPUT_CAP_NOCACHE. CVS patchset: 8432 CVS date: 2006/12/22 16:38:15 --- src/input/input_plugin.h | 10 +--------- src/xine-engine/xine.c | 5 +---- 2 files changed, 2 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h index 146207e76..f686f2227 100644 --- a/src/input/input_plugin.h +++ b/src/input/input_plugin.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_plugin.h,v 1.61 2006/12/18 21:22:45 klan Exp $ + * $Id: input_plugin.h,v 1.62 2006/12/22 16:38:15 klan Exp $ */ #ifndef HAVE_INPUT_PLUGIN_H @@ -297,14 +297,6 @@ struct input_plugin_s { #define INPUT_CAP_RIP_FORBIDDEN 0x00000100 -/* - * INPUT_CAP_NOCACHE: - * means that buffered input must not be used. - * (i.e. disable input_cache internal plugin) - */ - -#define INPUT_CAP_NOCACHE 0x00000200 - #define INPUT_IS_SEEKABLE(input) (((input)->get_capabilities(input) & INPUT_CAP_SEEKABLE) != 0) diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 63afc86d3..f5583a52f 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine.c,v 1.339 2006/12/19 19:10:52 dsalt Exp $ + * $Id: xine.c,v 1.340 2006/12/22 16:38:15 klan Exp $ */ /* @@ -777,9 +777,6 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { return 0; } - if (stream->input_plugin->get_capabilities(stream->input_plugin) & INPUT_CAP_NOCACHE) - no_cache = 1; - if (*stream_setup) { while (stream_setup && *stream_setup && *(++stream_setup)) { -- cgit v1.2.3 From 40df4b4fb7b470895f1e73e9eb66df177f9e910b Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Fri, 22 Dec 2006 16:42:20 +0000 Subject: Removed INPUT_CAP_NOCACHE. Modified rtsp_session_read() to break reading after the end of the header. Support user-specified bandwidth via the "media.network.bandwidth" config option. CVS patchset: 8433 CVS date: 2006/12/22 16:42:20 --- src/input/input_rtsp.c | 2 +- src/input/librtsp/rtsp_session.c | 43 +++++++++++++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/input/input_rtsp.c b/src/input/input_rtsp.c index bcbc19555..fec7b9713 100644 --- a/src/input/input_rtsp.c +++ b/src/input/input_rtsp.c @@ -157,7 +157,7 @@ static off_t rtsp_plugin_get_length (input_plugin_t *this_gen) { } static uint32_t rtsp_plugin_get_capabilities (input_plugin_t *this_gen) { - return INPUT_CAP_PREVIEW | INPUT_CAP_RIP_FORBIDDEN | INPUT_CAP_NOCACHE; + return INPUT_CAP_PREVIEW | INPUT_CAP_RIP_FORBIDDEN; } static uint32_t rtsp_plugin_get_blocksize (input_plugin_t *this_gen) { diff --git a/src/input/librtsp/rtsp_session.c b/src/input/librtsp/rtsp_session.c index 8a5135ac3..1b19421c3 100644 --- a/src/input/librtsp/rtsp_session.c +++ b/src/input/librtsp/rtsp_session.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: rtsp_session.c,v 1.17 2006/12/18 21:31:47 klan Exp $ + * $Id: rtsp_session.c,v 1.18 2006/12/22 16:42:20 klan Exp $ * * high level interface to rtsp servers. */ @@ -60,19 +60,42 @@ struct rtsp_session_s { /* header buffer */ uint8_t header[HEADER_SIZE]; int header_len; - int header_read; + int header_left; int playing; int start_time; }; +/* network bandwidth */ +const uint32_t rtsp_bandwidths[]={14400,19200,28800,33600,34430,57600, + 115200,262200,393216,524300,1544000,10485800}; + +const char *rtsp_bandwidth_strs[]={"14.4 Kbps (Modem)", "19.2 Kbps (Modem)", + "28.8 Kbps (Modem)", "33.6 Kbps (Modem)", + "34.4 Kbps (Modem)", "57.6 Kbps (Modem)", + "115.2 Kbps (ISDN)", "262.2 Kbps (Cable/DSL)", + "393.2 Kbps (Cable/DSL)","524.3 Kbps (Cable/DSL)", + "1.5 Mbps (T1)", "10.5 Mbps (LAN)", NULL}; + + rtsp_session_t *rtsp_session_start(xine_stream_t *stream, char *mrl) { rtsp_session_t *rtsp_session = xine_xmalloc(sizeof(rtsp_session_t)); + xine_t *xine = stream->xine; char *server; char *mrl_line=strdup(mrl); rmff_header_t *h; - uint32_t bandwidth=10485800; + int bandwidth_id; + uint32_t bandwidth; + + bandwidth_id = xine->config->register_enum(xine->config, "media.network.bandwidth", 10, + (char **)rtsp_bandwidth_strs, + _("network bandwidth"), + _("Specify the bandwidth of your internet connection here. " + "This will be used when streaming servers offer different versions " + "with different bandwidth requirements of the same stream."), + 0, NULL, NULL); + bandwidth = rtsp_bandwidths[bandwidth_id]; rtsp_session->recv = xine_buffer_init(BUF_SIZE); @@ -125,7 +148,8 @@ connect: } } - rtsp_session->header_len=rmff_dump_header(h,rtsp_session->header,1024); + rtsp_session->header_left = + rtsp_session->header_len = rmff_dump_header(h,rtsp_session->header,HEADER_SIZE); xine_buffer_copyin(rtsp_session->recv, 0, rtsp_session->header, rtsp_session->header_len); rtsp_session->recv_size = rtsp_session->header_len; @@ -170,7 +194,16 @@ int rtsp_session_read (rtsp_session_t *this, char *data, int len) { char *source=this->recv + this->recv_read; int fill=this->recv_size - this->recv_read; - if (len < 0) return 0; + if (len < 0) + return 0; + + if (this->header_left) { + if (to_copy > this->header_left) + to_copy = this->header_left; + + this->header_left -= to_copy; + } + while (to_copy > fill) { if (!this->playing) { -- cgit v1.2.3 From 3d56d04596432b38df459892f39105722d49aa56 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Fri, 22 Dec 2006 16:45:44 +0000 Subject: Check whether or not we are playing before calling input_plugin->seek_time(). CVS patchset: 8434 CVS date: 2006/12/22 16:45:44 --- src/demuxers/demux_real.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index 90852c25c..8dfb7b679 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -31,7 +31,7 @@ * * Based on FFmpeg's libav/rm.c. * - * $Id: demux_real.c,v 1.110 2006/12/18 21:31:47 klan Exp $ + * $Id: demux_real.c,v 1.111 2006/12/22 16:45:44 klan Exp $ */ #ifdef HAVE_CONFIG_H @@ -1456,7 +1456,7 @@ static int demux_real_seek (demux_plugin_t *this_gen, _x_demux_flush_engine(this->stream); } } - else if (this->input->seek_time != NULL) { + else if (!playing && this->input->seek_time != NULL) { /* RTSP supports only time based seek */ if (start_pos && !start_time) start_time = (int64_t) this->duration * start_pos / 65535; -- cgit v1.2.3 From e3d7457a7cd9555e1f8a618ecad38e3f565e614e Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Fri, 22 Dec 2006 18:08:10 +0000 Subject: In rtsp_session_read(): return the actual amount of bytes read. CVS patchset: 8435 CVS date: 2006/12/22 18:08:10 --- src/input/librtsp/rtsp_session.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/input/librtsp/rtsp_session.c b/src/input/librtsp/rtsp_session.c index 1b19421c3..66de10584 100644 --- a/src/input/librtsp/rtsp_session.c +++ b/src/input/librtsp/rtsp_session.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: rtsp_session.c,v 1.18 2006/12/22 16:42:20 klan Exp $ + * $Id: rtsp_session.c,v 1.19 2006/12/22 18:08:10 klan Exp $ * * high level interface to rtsp servers. */ @@ -189,7 +189,7 @@ static void rtsp_session_play (rtsp_session_t *this) { int rtsp_session_read (rtsp_session_t *this, char *data, int len) { - int to_copy=len; + int to_copy; char *dest=data; char *source=this->recv + this->recv_read; int fill=this->recv_size - this->recv_read; @@ -198,12 +198,13 @@ int rtsp_session_read (rtsp_session_t *this, char *data, int len) { return 0; if (this->header_left) { - if (to_copy > this->header_left) - to_copy = this->header_left; + if (len > this->header_left) + len = this->header_left; - this->header_left -= to_copy; + this->header_left -= len; } + to_copy = len; while (to_copy > fill) { if (!this->playing) { -- cgit v1.2.3 From 28b6e56a42b8845cb0c462c0a5a6915ff722c427 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Sat, 23 Dec 2006 14:43:16 +0000 Subject: Fixed mimetype description string. CVS patchset: 8436 CVS date: 2006/12/23 14:43:16 --- src/demuxers/demux_flv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 0567da426..3e8837800 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -24,7 +24,7 @@ * For more information on the FLV file format, visit: * http://download.macromedia.com/pub/flash/flash_file_format_specification.pdf * - * $Id: demux_flv.c,v 1.13 2006/12/15 14:33:20 klan Exp $ + * $Id: demux_flv.c,v 1.14 2006/12/23 14:43:16 klan Exp $ */ #ifdef HAVE_CONFIG_H @@ -666,7 +666,7 @@ static char *get_extensions (demux_class_t *this_gen) { } static char *get_mimetypes (demux_class_t *this_gen) { - return "video/x-flv"; + return "video/x-flv: flv: Flash video;"; } static void class_dispose (demux_class_t *this_gen) { -- cgit v1.2.3 From e1c221ba977a17e1cd47cc1eb78d4ffc967dec3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Dec 2006 15:07:51 +0000 Subject: Fix race condition in audio_out by using a recursive mutex; patch by Reinhard Nissl. [bug #1551911] CVS patchset: 8437 CVS date: 2006/12/25 15:07:51 --- src/xine-engine/audio_out.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index ce8cbe536..90a139010 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -17,7 +17,7 @@ * along with self program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_out.c,v 1.207 2006/11/04 23:30:14 dsalt Exp $ + * $Id: audio_out.c,v 1.208 2006/12/25 15:07:52 dgp85 Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe @@ -1055,9 +1055,7 @@ static void *ao_loop (void *this_gen) { delay = this->driver->delay(this->driver); while (delay < 0 && this->audio_loop_running) { /* Get the audio card into RUNNING state. */ - pthread_mutex_unlock( &this->driver_lock ); ao_fill_gap (this, 10000); /* FIXME, this PTS of 1000 should == period size */ - pthread_mutex_lock( &this->driver_lock ); delay = this->driver->delay(this->driver); } pthread_mutex_unlock( &this->driver_lock ); @@ -1200,7 +1198,7 @@ static void *ao_loop (void *this_gen) { if (this->driver_open) { pthread_mutex_lock( &this->driver_lock ); - result = this->driver->write (this->driver, out_buf->mem, out_buf->num_frames ); + result = this->driver_open ? this->driver->write (this->driver, out_buf->mem, out_buf->num_frames ) : 0; pthread_mutex_unlock( &this->driver_lock ); } else { result = 0; @@ -1984,6 +1982,7 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, aos_t *this; int i, err; pthread_attr_t pth_attrs; + pthread_mutexattr_t attr; static const char* resample_modes[] = {"auto", "off", "on", NULL}; static const char* av_sync_methods[] = {"metronom feedback", "resample", NULL}; @@ -1994,8 +1993,14 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, this->clock = xine->clock; this->streams = xine_list_new(); + /* warning: driver_lock is a recursive mutex. it must NOT be + * used with neither pthread_cond_wait() or pthread_cond_timedwait() + */ + pthread_mutexattr_init( &attr ); + pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE ); + pthread_mutex_init( &this->streams_lock, NULL ); - pthread_mutex_init( &this->driver_lock, NULL ); + pthread_mutex_init( &this->driver_lock, &attr ); pthread_mutex_init( &this->driver_action_lock, NULL ); this->ao.open = ao_open; -- cgit v1.2.3 From dd3d85290c6254c33de0399e1e3b6c457869363c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Dec 2006 15:16:33 +0000 Subject: * Allow building with Sun CC by fixing the lprintf variadic macro; patch by Taso N. Devetzis. [bug #1614406] CVS patchset: 8438 CVS date: 2006/12/25 15:16:33 --- src/xine-utils/xineutils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index 9c8ba507d..03c5f689a 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xineutils.h,v 1.106 2006/12/18 18:32:44 klan Exp $ + * $Id: xineutils.h,v 1.107 2006/12/25 15:16:33 dgp85 Exp $ * */ #ifndef XINEUTILS_H @@ -858,7 +858,7 @@ void xine_hexdump (const char *buf, int length) XINE_PROTECTED; fflush(stdout); \ } while(0) #else /* _MSC_VER */ - #define lprintf(fmt, ...) \ + #define lprintf(...) \ do { \ LONG_LOG_MODULE_STRING \ printf(__VA_ARGS__); \ -- cgit v1.2.3 From 0c85985f26591e391f62297fd943dd1f5645b18e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Dec 2006 15:19:51 +0000 Subject: * Fix disposing of image buffers in video_out_xv when SHM get disabled by exhaustion of memory; patch by Matthias Drochner. [bug #1620339] CVS patchset: 8439 CVS date: 2006/12/25 15:19:51 --- src/video_out/video_out_xv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index 64533a88f..3dc62920d 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xv.c,v 1.220 2006/10/28 18:51:08 miguelfreitas Exp $ + * $Id: video_out_xv.c,v 1.221 2006/12/25 15:19:51 dgp85 Exp $ * * video_out_xv.c, X11 video extension interface for xine * @@ -187,7 +187,7 @@ static void xv_frame_dispose (vo_frame_t *vo_img) { if (frame->image) { - if (this->use_shm) { + if (frame->shminfo.shmaddr) { LOCK_DISPLAY(this); XShmDetach (this->display, &frame->shminfo); XFree (frame->image); @@ -382,6 +382,7 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, image = XvCreateImage (this->display, this->xv_port, xv_format, data, width, height); + shminfo->shmaddr = 0; } return image; } @@ -391,7 +392,7 @@ static void dispose_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, XvImage *myimage) { - if (this->use_shm) { + if (shminfo->shmaddr) { XShmDetach (this->display, shminfo); XFree (myimage); -- cgit v1.2.3 From 1b7896d7d05f339e7317b45c93dda651475c66ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Dec 2006 15:39:31 +0000 Subject: * Fix invalid memory access in Real Media ASM parser; reported by Roland Kay. [bug #1603503] CVS patchset: 8440 CVS date: 2006/12/25 15:39:31 --- src/input/libreal/asmrp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/input/libreal/asmrp.c b/src/input/libreal/asmrp.c index 5fd5ae798..8afc19df6 100644 --- a/src/input/libreal/asmrp.c +++ b/src/input/libreal/asmrp.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: asmrp.c,v 1.9 2006/11/29 19:43:01 dgp85 Exp $ + * $Id: asmrp.c,v 1.10 2006/12/25 15:39:31 dgp85 Exp $ * * a parser for real's asm rules * @@ -417,7 +417,9 @@ static int asmrp_operand (asmrp_t *p) { i = asmrp_find_id (p, p->str); if (i<0) { - lprintf ("error: unknown identifier %s\n", p->str); + printf ("error: unknown identifier %s\n", p->str); + ret = 0; + break; } ret = p->sym_tab[i].v; -- cgit v1.2.3 From 3a375f89ea4f1e10b847a2313311531eeb6c3b22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Dec 2006 16:12:16 +0000 Subject: * Fix program termination due to invalid Real Media SDP; reported by Roland Kay. [bug #1602663] CVS patchset: 8441 CVS date: 2006/12/25 16:12:16 --- src/input/libreal/sdpplin.c | 51 +++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c index e77781253..dc83c3ee1 100644 --- a/src/input/libreal/sdpplin.c +++ b/src/input/libreal/sdpplin.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: sdpplin.c,v 1.6 2006/06/20 01:07:58 dgp85 Exp $ + * $Id: sdpplin.c,v 1.7 2006/12/25 16:12:17 dgp85 Exp $ * * sdp/sdpplin parser. * @@ -71,8 +71,9 @@ static char *b64_decode(const char *in, char *out, int *size) int c = in[i+j]; if (dtable[c] & 0x80) { - printf("Illegal character '%c' in input.\n", c); - exit(1); + fprintf(stderr, "Illegal character '%c' in input.\n", c); + *size = 0; + return NULL; } a[i] = (char) c; b[i] = (char) dtable[c]; @@ -200,11 +201,13 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) { if(filter(*data,"a=OpaqueData:buffer;",&buf)) { decoded = b64_decode(buf, decoded, &(desc->mlti_data_size)); - desc->mlti_data = malloc(sizeof(char)*desc->mlti_data_size); - memcpy(desc->mlti_data, decoded, desc->mlti_data_size); - handled=1; - *data=nl(*data); - lprintf("mlti_data_size: %i\n", desc->mlti_data_size); + if ( decoded != NULL ) { + desc->mlti_data = malloc(sizeof(char)*desc->mlti_data_size); + memcpy(desc->mlti_data, decoded, desc->mlti_data_size); + handled=1; + *data=nl(*data); + lprintf("mlti_data_size: %i\n", desc->mlti_data_size); + } } if(filter(*data,"a=ASMRuleBook:string;",&buf)) { @@ -252,30 +255,38 @@ sdpplin_t *sdpplin_parse(char *data) { if(filter(data,"a=Title:buffer;",&buf)) { decoded=b64_decode(buf, decoded, &len); - desc->title=strdup(decoded); - handled=1; - data=nl(data); + if ( decoded != NULL ) { + desc->title=strdup(decoded); + handled=1; + data=nl(data); + } } if(filter(data,"a=Author:buffer;",&buf)) { decoded=b64_decode(buf, decoded, &len); - desc->author=strdup(decoded); - handled=1; - data=nl(data); + if ( decoded != NULL ) { + desc->author=strdup(decoded); + handled=1; + data=nl(data); + } } if(filter(data,"a=Copyright:buffer;",&buf)) { decoded=b64_decode(buf, decoded, &len); - desc->copyright=strdup(decoded); - handled=1; - data=nl(data); + if ( decoded != NULL ) { + desc->copyright=strdup(decoded); + handled=1; + data=nl(data); + } } if(filter(data,"a=Abstract:buffer;",&buf)) { decoded=b64_decode(buf, decoded, &len); - desc->abstract=strdup(decoded); - handled=1; - data=nl(data); + if ( decoded != NULL ) { + desc->abstract=strdup(decoded); + handled=1; + data=nl(data); + } } if(filter(data,"a=StreamCount:integer;",&buf)) { -- cgit v1.2.3 From 1ac605341958564ce84a3c9784a746920c7148a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Dec 2006 16:21:56 +0000 Subject: * Fix invalid memory access in Real Media SDP with tailored stream; reported by Roland Kay. [bug #1602631] CVS patchset: 8442 CVS date: 2006/12/25 16:21:56 --- src/input/libreal/sdpplin.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c index dc83c3ee1..019237243 100644 --- a/src/input/libreal/sdpplin.c +++ b/src/input/libreal/sdpplin.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: sdpplin.c,v 1.7 2006/12/25 16:12:17 dgp85 Exp $ + * $Id: sdpplin.c,v 1.8 2006/12/25 16:21:56 dgp85 Exp $ * * sdp/sdpplin parser. * @@ -242,11 +242,17 @@ sdpplin_t *sdpplin_parse(char *data) { int handled; int len; + desc->stream = NULL; + while (data && *data) { handled=0; if (filter(data, "m=", &buf)) { + if ( ! desc->stream ) { + fprintf(stderr, "sdpplin.c: stream identifier found before stream count, skipping."); + continue; + } stream=sdpplin_parse_stream(&data); lprintf("got data for stream id %u\n", stream->stream_id); desc->stream[stream->stream_id]=stream; -- cgit v1.2.3 From fae8a7ffbc1d7f59fc82c133d3e54ec3ae5c5580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Dec 2006 16:54:56 +0000 Subject: * Fix Shorten demuxer: the whole ajkg signature has to be found, not only one character of it. [bug #1601134] CVS patchset: 8444 CVS date: 2006/12/25 16:54:56 --- src/demuxers/demux_shn.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_shn.c b/src/demuxers/demux_shn.c index 8e3602634..e7b7f36be 100644 --- a/src/demuxers/demux_shn.c +++ b/src/demuxers/demux_shn.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_shn.c,v 1.2 2006/09/28 22:27:52 dgp85 Exp $ + * $Id: demux_shn.c,v 1.3 2006/12/25 16:54:56 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -67,8 +67,8 @@ static int open_shn_file(demux_shn_t *this) { if (_x_demux_read_header(this->input, peak, 4) != 4) return 0; - if ((peak[0] != 'a') && (peak[1] != 'j') && - (peak[2] != 'k') && (peak[3] != 'g')) { + if ((peak[0] != 'a') || (peak[1] != 'j') || + (peak[2] != 'k') || (peak[3] != 'g')) { return 0; } -- cgit v1.2.3 From 0a48883b044c3b9b4f1f00a338b1439bfba1ebcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Dec 2006 17:39:39 +0000 Subject: * Implement at least a partial content-based detection of ModPlug-decoded module files, using the magic numbers from GNU file. This allows to open module files based on content rather than on their extension only. [bug #1445746] CVS patchset: 8445 CVS date: 2006/12/25 17:39:39 --- src/demuxers/demux_mod.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src') diff --git a/src/demuxers/demux_mod.c b/src/demuxers/demux_mod.c index 185ef5c97..7e0d99556 100644 --- a/src/demuxers/demux_mod.c +++ b/src/demuxers/demux_mod.c @@ -50,6 +50,7 @@ #include "demux.h" #include "group_audio.h" #include "modplug.h" +#include "bswap.h" #define MOD_SAMPLERATE 44100 #define MOD_BITS 16 @@ -89,6 +90,43 @@ typedef struct { demux_class_t demux_class; } demux_mod_class_t; +#define FOURCC_32(a, b, c, d) (d + (c<<8) + (b<<16) + (a<<24)) + +/** + * @brief Probes if the given file can be demuxed using modplug or not + * @retval 0 The file is not a valid modplug file (or the probe isn't complete yet) + * @retval 1 The file has been identified as a valid modplug file + * @todo Just Protracker files are detected right now. + */ +static int probe_mod_file(demux_mod_t *this) { + /* We need the value present at offset 1080, of size 4 */ + union { + uint8_t buffer[1080+4]; /* The raw buffer */ + uint32_t values[(1080+4)/sizeof(uint32_t)]; + } header; + + if (_x_demux_read_header(this->input, header.buffer, 1080+4) != 1080+4) + return 0; + + /* Magic numbers taken from GNU file's magic description */ + switch( ABE_32(header.values + (1080/sizeof(uint32_t))) ) { + case FOURCC_32('M', '.', 'K', '.'): /* 4-channel Protracker module sound data */ + case FOURCC_32('M', '!', 'K', '!'): /* 4-channel Protracker module sound data */ + case FOURCC_32('F', 'L', 'T', '4'): /* 4-channel Startracker module sound data */ + case FOURCC_32('F', 'L', 'T', '8'): /* 8-channel Startracker module sound data */ + case FOURCC_32('4', 'C', 'H', 'N'): /* 4-channel Fasttracker module sound data */ + case FOURCC_32('6', 'C', 'H', 'N'): /* 6-channel Fasttracker module sound data */ + case FOURCC_32('8', 'C', 'H', 'N'): /* 8-channel Fasttracker module sound data */ + case FOURCC_32('C', 'D', '8', '1'): /* 8-channel Octalyser module sound data */ + case FOURCC_32('O', 'K', 'T', 'A'): /* 8-channel Oktalyzer module sound data */ + case FOURCC_32('1', '6', 'C', 'N'): /* 16-channel Taketracker module sound data */ + case FOURCC_32('3', '2', 'C', 'N'): /* 32-channel Taketracker module sound data */ + return 1; + } + + return 0; +} + /* returns 1 if the MOD file was opened successfully, 0 otherwise */ static int open_mod_file(demux_mod_t *this) { int total_read; @@ -306,6 +344,9 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str break; case METHOD_BY_CONTENT: + if (probe_mod_file(this) && open_mod_file(this)) + break; + default: free (this); return NULL; -- cgit v1.2.3 From a2bdad28270b35136aaa3241bd6f0b85b6a51339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Dec 2006 18:32:54 +0000 Subject: The alsa audio output plugin uses threads, so link it correctly. CVS patchset: 8446 CVS date: 2006/12/25 18:32:54 --- src/audio_out/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/audio_out/Makefile.am b/src/audio_out/Makefile.am index 445622765..3a5c78147 100644 --- a/src/audio_out/Makefile.am +++ b/src/audio_out/Makefile.am @@ -94,7 +94,7 @@ xineplug_ao_out_oss_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_ao_out_oss_la_LDFLAGS = -avoid-version -module xineplug_ao_out_alsa_la_SOURCES = audio_alsa_out.c -xineplug_ao_out_alsa_la_LIBADD = $(ALSA_LIBS) $(XINE_LIB) +xineplug_ao_out_alsa_la_LIBADD = $(ALSA_LIBS) $(XINE_LIB) $(THREAD_LIBS) xineplug_ao_out_alsa_la_CFLAGS = $(VISIBILITY_FLAG) $(ALSA_CFLAGS) xineplug_ao_out_alsa_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From 4d34c18da473ae72f03841808cc3b1554c77c0f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Dec 2006 18:34:07 +0000 Subject: The dvd input plugin uses dlopen-related functions, link to the correct library. CVS patchset: 8447 CVS date: 2006/12/25 18:34:07 --- src/input/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/input/Makefile.am b/src/input/Makefile.am index c0924f829..d4a445743 100644 --- a/src/input/Makefile.am +++ b/src/input/Makefile.am @@ -77,7 +77,7 @@ xineplug_inp_file_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_file_la_LDFLAGS = -avoid-version -module xineplug_inp_dvd_la_SOURCES = input_dvd.c media_helper.c -xineplug_inp_dvd_la_LIBADD = $(XINE_LIB) $(link_dvdnav) $(THREAD_LIBS) +xineplug_inp_dvd_la_LIBADD = $(XINE_LIB) $(link_dvdnav) $(THREAD_LIBS) $(DYNAMIC_LD_LIBS) xineplug_inp_dvd_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_dvd_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From 405f1b981b60db61ff20a44927abcae679dd42bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Dec 2006 18:35:53 +0000 Subject: The mpeg2 decoding plugin uses ceil(), so link it to libm. CVS patchset: 8448 CVS date: 2006/12/25 18:35:53 --- src/libmpeg2/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libmpeg2/Makefile.am b/src/libmpeg2/Makefile.am index cbc79fabd..550ce581f 100644 --- a/src/libmpeg2/Makefile.am +++ b/src/libmpeg2/Makefile.am @@ -26,7 +26,7 @@ xineplug_decode_mpeg2_la_SOURCES = \ xine_decoder.c \ libmpeg2_accel.c -xineplug_decode_mpeg2_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) +xineplug_decode_mpeg2_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) -lm xineplug_decode_mpeg2_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_decode_mpeg2_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From fe54f9ca1da10981a470bc13f188c96b4dc96d2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Dec 2006 18:37:17 +0000 Subject: The nsf decoding plugin uses math functions, link it to libm. CVS patchset: 8449 CVS date: 2006/12/25 18:37:17 --- src/libxineadec/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libxineadec/Makefile.am b/src/libxineadec/Makefile.am index edd259f8f..7f34b4bfd 100644 --- a/src/libxineadec/Makefile.am +++ b/src/libxineadec/Makefile.am @@ -20,7 +20,7 @@ xineplug_decode_gsm610_la_LIBADD = \ xineplug_decode_nsf_la_SOURCES = nsf.c xineplug_decode_nsf_la_CFLAGS = $(VISIBILITY_FLAG) -DNSF_PLAYER -fno-strict-aliasing xineplug_decode_nsf_la_LDFLAGS = -avoid-version -module -xineplug_decode_nsf_la_LIBADD = \ +xineplug_decode_nsf_la_LIBADD = -lm \ $(XINE_LIB) \ $(top_builddir)/src/libxineadec/nosefart/libnosefart.la -- cgit v1.2.3 From 69d69e3637078ca684b036fd505137be037db8fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Dec 2006 18:38:15 +0000 Subject: The faad decoding plugin uses math functions, link it to libm. CVS patchset: 8450 CVS date: 2006/12/25 18:38:15 --- src/libfaad/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libfaad/Makefile.am b/src/libfaad/Makefile.am index cef72a4ce..dcc57792a 100644 --- a/src/libfaad/Makefile.am +++ b/src/libfaad/Makefile.am @@ -55,7 +55,7 @@ xineplug_decode_faad_la_SOURCES = \ xine_decoder.c xineplug_decode_faad_la_LDFLAGS = -avoid-version -module -xineplug_decode_faad_la_LIBADD = $(XINE_LIB) +xineplug_decode_faad_la_LIBADD = -lm $(XINE_LIB) noinst_HEADERS = \ analysis.h \ -- cgit v1.2.3 From a6d39ca03836cfe8fbbcd221212d49caf3522c25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Dec 2006 18:40:36 +0000 Subject: Goom postplugin use math functions, link to libm. CVS patchset: 8451 CVS date: 2006/12/25 18:40:36 --- src/post/goom/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/post/goom/Makefile.am b/src/post/goom/Makefile.am index 5905c16cf..564e64604 100644 --- a/src/post/goom/Makefile.am +++ b/src/post/goom/Makefile.am @@ -28,7 +28,7 @@ xineplug_post_goom_la_SOURCES = $(extra_files) xine_goom.c \ gfontlib.c goom_core.c goom_tools.c goomsl.c goomsl_hash.c goomsl_heap.c \ goomsl_lex.c goomsl_yacc.c graphic.c ifs.c lines.c \ plugin_info.c sound_tester.c surf3d.c tentacle3d.c v3d.c -xineplug_post_goom_la_LIBADD = $(XINE_LIB) $(GOOM_LIBS) $(THREAD_LIBS) +xineplug_post_goom_la_LIBADD = $(XINE_LIB) $(GOOM_LIBS) $(THREAD_LIBS) -lm xineplug_post_goom_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_post_goom_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From ef9e52f5031dc0042f30d368f707926aeaa2b4a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Dec 2006 18:43:38 +0000 Subject: Correctly export _x_post_frame_u_turn. CVS patchset: 8452 CVS date: 2006/12/25 18:43:38 --- src/xine-engine/post.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-engine/post.h b/src/xine-engine/post.h index f8aba5cef..521fae9e5 100644 --- a/src/xine-engine/post.h +++ b/src/xine-engine/post.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: post.h,v 1.23 2006/09/26 05:19:49 dgp85 Exp $ + * $Id: post.h,v 1.24 2006/12/25 18:43:38 dgp85 Exp $ * * post plugin definitions * @@ -259,7 +259,7 @@ void _x_post_frame_copy_up(vo_frame_t *to, vo_frame_t *from) XINE_PROTECTED; /* when you shortcut a frames usual draw() travel so that it will never reach * the draw() function of the original issuer, you still have to do some * housekeeping on the frame, before returning control up the pipe */ -void _x_post_frame_u_turn(vo_frame_t *frame, xine_stream_t *stream); +void _x_post_frame_u_turn(vo_frame_t *frame, xine_stream_t *stream) XINE_PROTECTED; /* use this to create a new, trivially decorated overlay manager in which * port functions can be replaced with own implementations */ -- cgit v1.2.3 From 3fb9e4c425b7dfcc7ffe65441a4a8d85d8951a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Dec 2006 19:22:00 +0000 Subject: * Make the libFLAC-based decoder and demuxer for FLAC files work with recent FLAC release 1.1.3. CVS patchset: 8455 CVS date: 2006/12/25 19:22:00 --- src/libflac/decoder_flac.c | 24 ++++++++++++++++++++++ src/libflac/demux_flac.c | 51 +++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 72 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/libflac/decoder_flac.c b/src/libflac/decoder_flac.c index b62286eaa..095555e1d 100644 --- a/src/libflac/decoder_flac.c +++ b/src/libflac/decoder_flac.c @@ -30,6 +30,13 @@ #include +#if !defined FLAC_API_VERSION_CURRENT || FLAC_API_VERSION_CURRENT < 8 +#include +#define LEGACY_FLAC +#else +#undef LEGACY_FLAC +#endif + #define LOG_MODULE "flac_decoder" #define LOG_VERBOSE @@ -344,6 +351,7 @@ open_plugin (audio_decoder_class_t *class_gen, xine_stream_t *stream) { this->flac_decoder = FLAC__stream_decoder_new(); +#ifdef LEGACY_FLAC FLAC__stream_decoder_set_read_callback (this->flac_decoder, flac_read_callback); FLAC__stream_decoder_set_write_callback (this->flac_decoder, @@ -359,6 +367,22 @@ open_plugin (audio_decoder_class_t *class_gen, xine_stream_t *stream) { free (this); return NULL; } +#else + if ( FLAC__stream_decoder_init_stream (this->flac_decoder, + flac_read_callback, + NULL, /* seek */ + NULL, /* tell */ + NULL, /* length */ + NULL, /* eof */ + flac_write_callback, + NULL, /* metadata */ + flac_error_callback, + this + ) != FLAC__STREAM_DECODER_INIT_STATUS_OK ) { + free (this); + return NULL; + } +#endif return (audio_decoder_t *) this; } diff --git a/src/libflac/demux_flac.c b/src/libflac/demux_flac.c index efee0b179..43ee17d5c 100644 --- a/src/libflac/demux_flac.c +++ b/src/libflac/demux_flac.c @@ -441,7 +441,11 @@ demux_flac_dispose (demux_plugin_t *this_gen) { lprintf("demux_flac_dispose\n"); if (this->flac_decoder) +#ifdef LEGACY_FLAC FLAC__seekable_stream_decoder_delete (this->flac_decoder); +#else + FLAC__stream_decoder_delete (this->flac_decoder); +#endif free(this); return; @@ -494,8 +498,13 @@ demux_flac_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int } target_sample = (uint64_t)(distance * this->total_samples); +#ifdef LEGACY_FLAC s = FLAC__seekable_stream_decoder_seek_absolute (this->flac_decoder, target_sample); +#else + s = FLAC__stream_decoder_seek_absolute (this->flac_decoder, + target_sample); +#endif if (s) { lprintf ("Seek to: %d successfull!\n", start_time); @@ -618,9 +627,6 @@ open_plugin (demux_class_t *class_gen, /* Get a new FLAC decoder and hook up callbacks */ #ifdef LEGACY_FLAC this->flac_decoder = FLAC__seekable_stream_decoder_new(); -#else - this->flac_decoder = FLAC__stream_decoder_new(); -#endif lprintf("this->flac_decoder: %p\n", this->flac_decoder); FLAC__seekable_stream_decoder_set_md5_checking (this->flac_decoder, false); @@ -644,6 +650,37 @@ open_plugin (demux_class_t *class_gen, this); FLAC__seekable_stream_decoder_init (this->flac_decoder); +#else + this->flac_decoder = FLAC__stream_decoder_new(); + lprintf("this->flac_decoder: %p\n", this->flac_decoder); + + if ( ! this->flac_decoder ) { + free(this); + return NULL; + } + + FLAC__stream_decoder_set_md5_checking (this->flac_decoder, false); + + if ( FLAC__stream_decoder_init_stream(this->flac_decoder, + flac_read_callback, + flac_seek_callback, + flac_tell_callback, + flac_length_callback, + flac_eof_callback, + flac_write_callback, + flac_metadata_callback, + flac_error_callback, + this + ) != FLAC__STREAM_DECODER_INIT_STATUS_OK ) { +#ifdef LEGACY_FLAC + FLAC__seekable_stream_decoder_delete (this->flac_decoder); +#else + FLAC__stream_decoder_delete (this->flac_decoder); +#endif + free(this); + return NULL; + } +#endif /* Get some stream info */ this->data_size = this->input->get_length (this->input); @@ -653,13 +690,21 @@ open_plugin (demux_class_t *class_gen, * this flac stream */ this->status = DEMUX_OK; +#ifdef LEGACY_FLAC FLAC__seekable_stream_decoder_process_until_end_of_metadata (this->flac_decoder); +#else + FLAC__stream_decoder_process_until_end_of_metadata (this->flac_decoder); +#endif lprintf("Processed file until end of metadata: %s\n", this->status == DEMUX_OK ? "success" : "failure"); if (this->status != DEMUX_OK) { +#ifdef LEGACY_FLAC FLAC__seekable_stream_decoder_delete (this->flac_decoder); +#else + FLAC__stream_decoder_delete (this->flac_decoder); +#endif free (this); return NULL; } -- cgit v1.2.3 From fdaeeb0c00f879c3703a1372ee4689bd6739c1fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Dec 2006 20:04:17 +0000 Subject: * Replace --enable-flac configure option with --with-libflac, as the FLAC support is always built-in through the audio demuxer plugin and the FFmpeg decoder plugin, the option only controls the extra FLAC plugin that uses libFLAC both for demuxing and decoding. CVS patchset: 8457 CVS date: 2006/12/25 20:04:17 --- src/libflac/Makefile.am | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/libflac/Makefile.am b/src/libflac/Makefile.am index 12304ff84..6449820bc 100644 --- a/src/libflac/Makefile.am +++ b/src/libflac/Makefile.am @@ -1,12 +1,10 @@ include $(top_srcdir)/misc/Makefile.common -if HAVE_FLAC -flac_module = xineplug_flac.la -endif - libdir = $(XINE_PLUGINDIR) -lib_LTLIBRARIES = $(flac_module) +if HAVE_LIBFLAC +lib_LTLIBRARIES = xineplug_flac.la +endif xineplug_flac_la_SOURCES = demux_flac.c decoder_flac.c xineplug_flac_la_LIBADD = $(LIBFLAC_LIBS) $(XINE_LIB) -- cgit v1.2.3 From ec4bff004365df1851af20a669929a2d90670856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Dec 2006 21:59:32 +0000 Subject: Fix a grammar error, and mark the error message for translation. CVS patchset: 8458 CVS date: 2006/12/25 21:59:32 --- src/xine-engine/buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-engine/buffer.c b/src/xine-engine/buffer.c index c36e97877..389146dcb 100644 --- a/src/xine-engine/buffer.c +++ b/src/xine-engine/buffer.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: buffer.c,v 1.36 2006/06/20 00:35:07 dgp85 Exp $ + * $Id: buffer.c,v 1.37 2006/12/25 21:59:32 dgp85 Exp $ * * * contents: @@ -64,7 +64,7 @@ static void buffer_pool_free (buf_element_t *element) { this->buffer_pool_num_free++; if (this->buffer_pool_num_free > this->buffer_pool_capacity) { - printf("xine-lib:buffer: Their has been a fatal error: TOO MANY FREE's\n"); + fprintf(stderr, _("xine-lib: buffer.c: There has been a fatal error: TOO MANY FREE's\n")); _x_abort(); } -- cgit v1.2.3 From 081af23420456da89e8a75ab7aad2b88d9868d3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 26 Dec 2006 03:18:56 +0000 Subject: Add WavPack to the list of supported audio buffers. CVS patchset: 8459 CVS date: 2006/12/26 03:18:56 --- src/xine-engine/buffer.h | 3 ++- src/xine-engine/buffer_types.c | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h index cb6b6e4cb..22e1a7a04 100644 --- a/src/xine-engine/buffer.h +++ b/src/xine-engine/buffer.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: buffer.h,v 1.160 2006/12/15 11:31:29 klan Exp $ + * $Id: buffer.h,v 1.161 2006/12/26 03:18:56 dgp85 Exp $ * * * contents: @@ -256,6 +256,7 @@ extern "C" { #define BUF_AUDIO_TTA 0x033A0000 #define BUF_AUDIO_SMACKER 0x033B0000 #define BUF_AUDIO_FLVADPCM 0x033C0000 +#define BUF_AUDIO_WAVPACK 0x033D0000 /* spu buffer types: */ diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c index ea8d58842..161ec70a9 100644 --- a/src/xine-engine/buffer_types.c +++ b/src/xine-engine/buffer_types.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: buffer_types.c,v 1.106 2006/10/02 15:56:06 valtri Exp $ + * $Id: buffer_types.c,v 1.107 2006/12/26 03:18:56 dgp85 Exp $ * * * contents: @@ -1114,6 +1114,13 @@ static audio_db_t audio_db[] = { BUF_AUDIO_MPC, "Musepack" }, +{ + { + 0 + }, + BUF_AUDIO_WAVPACK, + "Wavpack" +}, { { 0 }, 0, "last entry" } }; -- cgit v1.2.3 From 11029c08c224c4393de0ec69436bb2078b154e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 26 Dec 2006 03:20:12 +0000 Subject: Add WavPack to the list of supported audio streams FFmpeg can decode. CVS patchset: 8460 CVS date: 2006/12/26 03:20:12 --- src/libffmpeg/audio_decoder.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libffmpeg/audio_decoder.c b/src/libffmpeg/audio_decoder.c index 16d2bc234..22f567e9c 100644 --- a/src/libffmpeg/audio_decoder.c +++ b/src/libffmpeg/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.30 2006/12/15 11:31:29 klan Exp $ + * $Id: audio_decoder.c,v 1.31 2006/12/26 03:20:12 dgp85 Exp $ * * xine audio decoder plugin using ffmpeg * @@ -108,6 +108,7 @@ static const ff_codec_t ff_audio_lookup[] = { {BUF_AUDIO_TTA, CODEC_ID_TTA, "True Audio Lossless (ffmpeg)"}, {BUF_AUDIO_SMACKER, CODEC_ID_SMACKAUDIO, "Smacker (ffmpeg)"}, {BUF_AUDIO_FLVADPCM, CODEC_ID_ADPCM_SWF, "Flash ADPCM (ffmpeg)"}, + {BUF_AUDIO_WAVPACK, CODEC_ID_WAVPACK, "WavPack (ffmpeg)"}, }; @@ -474,6 +475,7 @@ static uint32_t supported_audio_types[] = { BUF_AUDIO_TTA, BUF_AUDIO_SMACKER, BUF_AUDIO_FLVADPCM, + BUF_AUDIO_WAVPACK, 0 }; -- cgit v1.2.3 From 7e060e7877f4f03609fd57ad9cbd75d69790a966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 26 Dec 2006 03:22:28 +0000 Subject: * Implement a WavPack files demuxer, using WavPack library (only for demuxing as the decoding is left entirely to FFmpeg); it's still in its infancy, but it should be possible to remove WavPack dependency entirely in the future. CVS patchset: 8461 CVS date: 2006/12/26 03:22:28 --- src/demuxers/Makefile.am | 10 ++ src/demuxers/demux_wavpack.c | 413 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 423 insertions(+) create mode 100644 src/demuxers/demux_wavpack.c (limited to 'src') diff --git a/src/demuxers/Makefile.am b/src/demuxers/Makefile.am index 4523afc27..0c008946e 100644 --- a/src/demuxers/Makefile.am +++ b/src/demuxers/Makefile.am @@ -12,6 +12,10 @@ if HAVE_VORBIS ogg_module = xineplug_dmx_ogg.la endif +if HAVE_WAVPACK +wavpack_module = xineplug_dmx_wavpack.la +endif + if BUILD_ASF asf_module = xineplug_dmx_asf.la endif @@ -30,6 +34,7 @@ endif # All of xine demuxer plugins should be named like the scheme "xineplug_dmx_" lib_LTLIBRARIES = $(ogg_module) $(asf_module) $(mng_module) $(image_module) \ + $(wavpack_module) \ xineplug_dmx_games.la \ xineplug_dmx_audio.la \ xineplug_dmx_mpeg_ts.la \ @@ -129,6 +134,11 @@ xineplug_dmx_audio_la_SOURCES = group_audio.c demux_aud.c demux_aiff.c \ xineplug_dmx_audio_la_LIBADD = $(XINE_LIB) $(LIBMODPLUG_LIBS) xineplug_dmx_audio_la_LDFLAGS = -avoid-version -module +xineplug_dmx_wavpack_la_SOURCES = demux_wavpack.c +xineplug_dmx_wavpack_la_CFLAGS = $(WAVPACK_CFLAGS) +xineplug_dmx_wavpack_la_LIBADD = $(XINE_LIB) $(WAVPACK_LIBS) +xineplug_dmx_wavpack_la_LDFLAGS = -avoid-version -module + xineplug_dmx_yuv_frames_la_SOURCES = demux_yuv_frames.c xineplug_dmx_yuv_frames_la_LIBADD = $(XINE_LIB) xineplug_dmx_yuv_frames_la_LDFLAGS = -avoid-version -module diff --git a/src/demuxers/demux_wavpack.c b/src/demuxers/demux_wavpack.c new file mode 100644 index 000000000..fad89b864 --- /dev/null +++ b/src/demuxers/demux_wavpack.c @@ -0,0 +1,413 @@ +/* + * Copyright (C) 2006 the xine project + * + * This file is part of xine, a free video player. + * + * xine 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. + * + * xine 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * xine interface to libwavpack by Diego Pettenò + * + * $Id: demux_wavpack.c,v 1.1 2006/12/26 03:22:28 dgp85 Exp $ + */ + +#define LOG_MODULE "wv_demuxer" +#define LOG_VERBOSE + +#include "xine_internal.h" +#include "xineutils.h" +#include "demux.h" +#include "bswap.h" +#include "group_audio.h" + +#include + +typedef struct { + char idcode[4]; /* This should always be the string "wvpk" */ + uint32_t block_size; /* Size of the rest of the frame */ + uint16_t wv_version; /* Version of the wavpack, 0x0403 should be latest */ + uint8_t track; /* Unused, has to be 0 */ + uint8_t index; /* Unused, has to be 0 */ + uint32_t file_samples; /* (uint32_t)-1 if unknown, else the total number + of samples for the file */ + uint32_t samples_index; /* Index of the first sample in block, from the + start of the file */ + uint32_t samples_count; /* Count of samples in the current frame */ + uint32_t flags; /* Misc flags */ + uint32_t decoded_crc32; /* CRC32 of the decoded data */ +} wvheader_t; + +typedef struct { + demux_plugin_t demux_plugin; + + xine_stream_t *stream; + fifo_buffer_t *audio_fifo; + input_plugin_t *input; + int status; + + union { + wvheader_t wv; + uint8_t buffer[sizeof(wvheader_t)]; + } header; + + uint32_t current_sample; + uint32_t samples; + uint32_t samplerate; + uint32_t bits_per_sample; + uint32_t channels; + unsigned int length; +} demux_wv_t; + +typedef struct { + demux_class_t demux_class; +} demux_wv_class_t; + +#ifndef __unused +# ifdef SUPPORT_ATTRIBUTE_UNUSED +# define __unused __attribute__((unused)) +# else +# define __unused +# endif +#endif + +static int32_t xine_input_read_bytes(input_plugin_t *this, void *data, int32_t bcount) { + return this->read(this, data, bcount); +} + +static uint32_t xine_input_get_pos(input_plugin_t *this) { + return this->get_current_pos(this); +} + +static int xine_input_set_pos_abs(input_plugin_t *this, uint32_t pos) { + return this->seek(this, pos, SEEK_SET); +} + +static int xine_input_set_pos_rel(input_plugin_t *this, int32_t delta, int mode) { + return this->seek(this, delta, mode); +} + +static int xine_input_push_back_byte(input_plugin_t *this, int c) { + if ( this->seek(this, -1, SEEK_CUR) ) { + return c; + } else { + lprintf("xine_input_push_back_byte: unable to seek.\n"); + return EOF; + } +} + +static uint32_t xine_input_get_length(input_plugin_t *this) { + return this->get_length(this); +} + +static int xine_input_can_seek(input_plugin_t *this) { + return INPUT_IS_SEEKABLE(this); +} + +static int32_t xine_input_write_bytes(__unused void *id, __unused void *data, __unused int32_t bcount) { + lprintf("xine_input_write_bytes: acces is read-only.\n"); + return 0; +} + +static const WavpackStreamReader wavpack_input_reader = { + .read_bytes = xine_input_read_bytes, + .get_pos = xine_input_get_pos, + .set_pos_abs = xine_input_set_pos_abs, + .set_pos_rel = xine_input_set_pos_rel, + .push_back_byte = xine_input_push_back_byte, + .get_length = xine_input_get_length, + .can_seek = xine_input_can_seek, + .write_bytes = xine_input_write_bytes +}; + +static int open_wv_file(demux_wv_t *this) { + WavpackContext *ctx = NULL; + char error[256]; /* Current version of wavpack (4.31) does not write more than this */ + + /* Right now we don't support non-seekable streams */ + if (! INPUT_IS_SEEKABLE(this->input) ) { + lprintf("open_wv_file: non-seekable inputs aren't supported yet.\n"); + return 0; + } + + /* Read the file header */ + if (_x_demux_read_header(this->input, this->header.buffer, sizeof(wvheader_t)) != sizeof(wvheader_t)) + return 0; + + /* Validate header, we currently support only Wavpack 4 */ + if ( memcmp(this->header.wv.idcode, "wvpk", 4) != 0 || (le2me_16(this->header.wv.wv_version) >> 8) != 4 ) + return 0; + + /* Rewind */ + this->input->seek(this->input, 0 - sizeof(wvheader_t), SEEK_CUR); + + ctx = WavpackOpenFileInputEx(&wavpack_input_reader, this->input, NULL, error, 0, 0); + if ( ! ctx ) { + lprintf("xine_open_wavpack_input: unable to open the stream: %s\n", error); + return 0; + } + + this->current_sample = 0; + this->samples = WavpackGetNumSamples(ctx); + lprintf("number of samples: %u\n", this->samples); + this->samplerate = WavpackGetSampleRate(ctx); + lprintf("samplerate: %u Hz\n", this->samplerate); + this->bits_per_sample = WavpackGetBitsPerSample(ctx); + lprintf("bits_per_sample: %u\n", this->bits_per_sample); + this->channels = WavpackGetNumChannels(ctx); + lprintf("channels: %u\n", this->channels); + this->length = this->samples / this->samplerate; + + _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, ME_32(this->header.buffer)); + + WavpackCloseFile(ctx); + this->input->seek(this->input, SEEK_SET, 0); + + return 1; +} + +static int demux_wv_send_chunk(demux_plugin_t *this_gen) { + demux_wv_t *this = (demux_wv_t *) this_gen; + uint32_t bytes_to_read; + + /* Check if we've finished */ + if (this->current_sample >= this->samples) { + lprintf("all frames read\n"); + this->status = DEMUX_FINISHED; + return this->status; + } + + lprintf("current sample: %u\n", this->current_sample); + + /* For some reason, FFmpeg requires to send it the latter 12 bytes of the header.. don't ask! */ + if ( this->input->read(this->input, this->header.buffer, sizeof(wvheader_t)-12) != sizeof(wvheader_t)-12 ) { + this->status = DEMUX_FINISHED; + return this->status; + } + + /* The size of the block is «of course» minus 8, and + it also includes the size of the header, but we need + to give FFmpeg the 12 extra bytes (for some reason), + so the amount of bytes to read is the following. + */ + bytes_to_read = le2me_32(this->header.wv.block_size) + 8 - (sizeof(wvheader_t)-12); + + lprintf("demux_wavpack: going to read %u bytes.\n", bytes_to_read); + + while(bytes_to_read) { + off_t bytes_read = 0; + buf_element_t *buf = NULL; + + /* Get a buffer */ + buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); + buf->type = BUF_AUDIO_WAVPACK; + buf->pts = 0; + buf->extra_info->total_time = this->length; + buf->decoder_flags = 0; + + /* Set normalised position */ + buf->extra_info->input_normpos = + (int) ((double) this->input->get_current_pos(this->input) * 65535 / + this->input->get_length(this->input)); + + /* Set time */ + buf->extra_info->input_time = this->current_sample / this->samplerate; + + bytes_read = this->input->read(this->input, buf->content, ( bytes_to_read > buf->max_size ) ? buf->max_size : bytes_to_read); + + buf->size = bytes_read; + + bytes_to_read -= bytes_read; + + if ( bytes_to_read <= 0 ) + buf->decoder_flags |= BUF_FLAG_FRAME_END; + + this->audio_fifo->put(this->audio_fifo, buf); + } + + this->current_sample += this->header.wv.samples_count; + + return this->status; +} + +static void demux_wv_send_headers(demux_plugin_t *this_gen) { + demux_wv_t *this = (demux_wv_t *) this_gen; + buf_element_t *buf; + + this->audio_fifo = this->stream->audio_fifo; + + this->status = DEMUX_OK; + + /* Send start buffers */ + _x_demux_control_start(this->stream); + + /* Send header to decoder */ + if (this->audio_fifo) { + buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); + + buf->type = BUF_AUDIO_WAVPACK; + buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END; + buf->decoder_info[0] = this->input->get_length(this->input); + buf->decoder_info[1] = this->samplerate; + buf->decoder_info[2] = this->bits_per_sample; + buf->decoder_info[3] = this->channels; + + /* Copy the header */ + buf->size = sizeof(xine_waveformatex) + sizeof(wvheader_t); + memcpy(buf->content+sizeof(xine_waveformatex), this->header.buffer, buf->size); + + this->audio_fifo->put (this->audio_fifo, buf); + } +} + +static int demux_wv_seek (demux_plugin_t *this_gen, + off_t start_pos, int start_time, int playing) { + demux_wv_t *this = (demux_wv_t *) this_gen; + + /* If thread is not running, initialize demuxer */ + if( !playing ) { + + /* send new pts */ + _x_demux_control_newpts(this->stream, 0, 0); + + this->status = DEMUX_OK; + } + + return this->status; +} + +static void demux_wv_dispose (demux_plugin_t *this_gen) { + demux_wv_t *this = (demux_wv_t *) this_gen; + + free(this); +} + +static int demux_wv_get_status (demux_plugin_t *this_gen) { + demux_wv_t *this = (demux_wv_t *) this_gen; + + return this->status; +} + +static int demux_wv_get_stream_length (demux_plugin_t *this_gen) { +// demux_wv_t *this = (demux_wv_t *) this_gen; + + return 0; +} + +static uint32_t demux_wv_get_capabilities(demux_plugin_t *this_gen) { + return DEMUX_CAP_NOCAP; +} + +static int demux_wv_get_optional_data(demux_plugin_t *this_gen, + void *data, int data_type) { + return DEMUX_OPTIONAL_UNSUPPORTED; +} + +static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *stream, + input_plugin_t *input) { + demux_wv_t *this; + this = xine_xmalloc (sizeof (demux_wv_t)); + this->stream = stream; + this->input = input; + + this->demux_plugin.send_headers = demux_wv_send_headers; + this->demux_plugin.send_chunk = demux_wv_send_chunk; + this->demux_plugin.seek = demux_wv_seek; + this->demux_plugin.dispose = demux_wv_dispose; + this->demux_plugin.get_status = demux_wv_get_status; + this->demux_plugin.get_stream_length = demux_wv_get_stream_length; + this->demux_plugin.get_capabilities = demux_wv_get_capabilities; + this->demux_plugin.get_optional_data = demux_wv_get_optional_data; + this->demux_plugin.demux_class = class_gen; + + this->status = DEMUX_FINISHED; + switch (stream->content_detection_method) { + + case METHOD_BY_EXTENSION: { + char *extensions, *mrl; + + mrl = input->get_mrl (input); + extensions = class_gen->get_extensions (class_gen); + + if (!_x_demux_check_extension (mrl, extensions)) { + free (this); + return NULL; + } + } + /* Falling through is intended */ + + case METHOD_BY_CONTENT: + case METHOD_EXPLICIT: + + if (!open_wv_file(this)) { + free (this); + return NULL; + } + + break; + + default: + free (this); + return NULL; + } + + return &this->demux_plugin; +} + +static char *get_description (demux_class_t *this_gen) { + return "Wavpack demux plugin"; +} + +static char *get_identifier (demux_class_t *this_gen) { + return "Wavpack"; +} + +static char *get_extensions (demux_class_t *this_gen) { + return "wv"; +} + +static char *get_mimetypes (demux_class_t *this_gen) { + return NULL; +} + +static void class_dispose (demux_class_t *this_gen) { + demux_wv_class_t *this = (demux_wv_class_t *) this_gen; + + free (this); +} + +static void *demux_wv_init_plugin (xine_t *xine, void *data) { + demux_wv_class_t *this; + + this = xine_xmalloc (sizeof (demux_wv_class_t)); + + this->demux_class.open_plugin = open_plugin; + this->demux_class.get_description = get_description; + this->demux_class.get_identifier = get_identifier; + this->demux_class.get_mimetypes = get_mimetypes; + this->demux_class.get_extensions = get_extensions; + this->demux_class.dispose = class_dispose; + + return this; +} + +static const demuxer_info_t demux_info_wv = { + 0 /* priority */ +}; + +const plugin_info_t xine_plugin_info[] EXPORTED = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_DEMUX, 26, "wavpack", XINE_VERSION_CODE, &demux_info_wv, demux_wv_init_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; -- cgit v1.2.3 From dd95dbcec03fb69411cbbd2ec52fca3c6eb3331f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 26 Dec 2006 14:28:48 +0000 Subject: Fix LOG_MODULE definition to be the same as the name of the unit file. CVS patchset: 8462 CVS date: 2006/12/26 14:28:48 --- src/demuxers/demux_wavpack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_wavpack.c b/src/demuxers/demux_wavpack.c index fad89b864..7bde518e9 100644 --- a/src/demuxers/demux_wavpack.c +++ b/src/demuxers/demux_wavpack.c @@ -19,10 +19,10 @@ * * xine interface to libwavpack by Diego Pettenò * - * $Id: demux_wavpack.c,v 1.1 2006/12/26 03:22:28 dgp85 Exp $ + * $Id: demux_wavpack.c,v 1.2 2006/12/26 14:28:48 dgp85 Exp $ */ -#define LOG_MODULE "wv_demuxer" +#define LOG_MODULE "demux_wavpack" #define LOG_VERBOSE #include "xine_internal.h" -- cgit v1.2.3 From e8c7abc1cbe6112a55becd59a381c03708eb3f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 26 Dec 2006 16:59:55 +0000 Subject: * Implement a True Audio files demuxer. [bug #1586381] CVS patchset: 8463 CVS date: 2006/12/26 16:59:55 --- src/demuxers/Makefile.am | 3 +- src/demuxers/demux_tta.c | 321 +++++++++++++++++++++++++++++++++++++++++++++ src/demuxers/group_audio.c | 7 +- src/demuxers/group_audio.h | 3 +- 4 files changed, 331 insertions(+), 3 deletions(-) create mode 100644 src/demuxers/demux_tta.c (limited to 'src') diff --git a/src/demuxers/Makefile.am b/src/demuxers/Makefile.am index 0c008946e..07996b2c7 100644 --- a/src/demuxers/Makefile.am +++ b/src/demuxers/Makefile.am @@ -130,7 +130,8 @@ xineplug_dmx_audio_la_SOURCES = group_audio.c demux_aud.c demux_aiff.c \ demux_realaudio.c demux_snd.c demux_voc.c \ demux_vox.c demux_wav.c demux_ac3.c id3.c \ demux_aac.c demux_mod.c demux_flac.c \ - demux_mpc.c demux_dts.c demux_shn.c + demux_mpc.c demux_dts.c demux_shn.c \ + demux_tta.c xineplug_dmx_audio_la_LIBADD = $(XINE_LIB) $(LIBMODPLUG_LIBS) xineplug_dmx_audio_la_LDFLAGS = -avoid-version -module diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c new file mode 100644 index 000000000..111c38071 --- /dev/null +++ b/src/demuxers/demux_tta.c @@ -0,0 +1,321 @@ +/* + * Copyright (C) 2006 the xine project + * + * This file is part of xine, a free video player. + * + * xine 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. + * + * xine 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * True Audio demuxer by Diego Pettenò + * Inspired by tta libavformat demuxer by Alex Beregszaszi + * + * $Id: demux_tta.c,v 1.1 2006/12/26 16:59:55 dgp85 Exp $ + */ + +#define LOG_MODULE "demux_tta" +#define LOG_VERBOSE + +#include "xine_internal.h" +#include "xineutils.h" +#include "demux.h" +#include "buffer.h" +#include "bswap.h" +#include "group_audio.h" + +typedef struct { + demux_plugin_t demux_plugin; + + xine_stream_t *stream; + fifo_buffer_t *video_fifo; + fifo_buffer_t *audio_fifo; + input_plugin_t *input; + int status; + + union { + struct tta_header { + uint32_t signature; /* TTA1 */ + uint16_t flags; /* Skipped */ + uint16_t channels; + uint16_t bits_per_sample; + uint32_t samplerate; + uint32_t data_length; + uint32_t crc32; + } __attribute__((__packed__)) tta; + uint8_t buffer[22]; /* This is the size of the header */ + } header; + + uint32_t totalframes; + uint32_t currentframe; + uint32_t *seektable; +} demux_tta_t; + +typedef struct { + demux_class_t demux_class; +} demux_tta_class_t; + +#define FOURCC_32(a, b, c, d) (d + (c<<8) + (b<<16) + (a<<24)) + +static int open_tta_file(demux_tta_t *this) { + uint8_t peek[4]; + uint32_t framelen; int i; + + if (_x_demux_read_header(this->input, peek, 4) != 4) + return 0; + + if ( BE_32(peek) != FOURCC_32('T', 'T', 'A', '1') ) + return 0; + + if ( this->input->read(this->input, this->header.buffer, sizeof(this->header)) != sizeof(this->header) ) + return 0; + + framelen = 1.04489795918367346939 * le2me_32(this->header.tta.samplerate); + this->totalframes = le2me_32(this->header.tta.data_length) / framelen + ((le2me_32(this->header.tta.data_length) % framelen) ? 1 : 0); + this->currentframe = 0; + + if(this->totalframes >= UINT_MAX/sizeof(uint32_t)) { + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, _("demux_tta: total frames count too high\n")); + return 0; + } + + this->seektable = xine_xmalloc(sizeof(uint32_t)*this->totalframes); + this->input->read(this->input, this->seektable, sizeof(uint32_t)*this->totalframes); + + /* Skip the CRC32 */ + this->input->seek(this->input, 4, SEEK_CUR); + + return 1; +} + +static int demux_tta_send_chunk(demux_plugin_t *this_gen) { + demux_tta_t *this = (demux_tta_t *) this_gen; + uint32_t bytes_to_read; + + if ( this->currentframe > this->totalframes ) { + this->status = DEMUX_FINISHED; + return this->status; + } + + bytes_to_read = le2me_32(this->seektable[this->currentframe]); + + while(bytes_to_read) { + off_t bytes_read = 0; + buf_element_t *buf = NULL; + + /* Get a buffer */ + buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); + buf->type = BUF_AUDIO_TTA; + buf->pts = 0; + buf->extra_info->total_time = this->totalframes; + buf->decoder_flags = 0; + + /* Set normalised position */ + buf->extra_info->input_normpos = + (int) ((double) this->currentframe * 65535 / this->totalframes); + + /* Set time */ + /* buf->extra_info->input_time = this->current_sample / this->samplerate; */ + + bytes_read = this->input->read(this->input, buf->content, ( bytes_to_read > buf->max_size ) ? buf->max_size : bytes_to_read); + + buf->size = bytes_read; + + bytes_to_read -= bytes_read; + + if ( bytes_to_read <= 0 ) + buf->decoder_flags |= BUF_FLAG_FRAME_END; + + this->audio_fifo->put(this->audio_fifo, buf); + } + + this->currentframe++; + + return this->status; +} + +static void demux_tta_send_headers(demux_plugin_t *this_gen) { + demux_tta_t *this = (demux_tta_t *) this_gen; + buf_element_t *buf; + + this->audio_fifo = this->stream->audio_fifo; + + this->status = DEMUX_OK; + + _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 0); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_CHANNELS, + le2me_16(this->header.tta.channels)); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, + le2me_32(this->header.tta.samplerate)); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITS, + le2me_16(this->header.tta.bits_per_sample)); + + /* send start buffers */ + _x_demux_control_start(this->stream); + + /* send init info to decoders */ + if (this->audio_fifo) { + xine_waveformatex wave; + + buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); + buf->type = BUF_AUDIO_TTA; + buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END; + buf->decoder_info[0] = 0; + buf->decoder_info[1] = le2me_32(this->header.tta.samplerate); + buf->decoder_info[2] = le2me_16(this->header.tta.bits_per_sample); + buf->decoder_info[3] = le2me_16(this->header.tta.channels); + + buf->size = sizeof(xine_waveformatex) + sizeof(this->header) + sizeof(uint32_t)*this->totalframes; + memcpy(buf->content+sizeof(xine_waveformatex), this->header.buffer, sizeof(this->header)); + memcpy(buf->content+sizeof(xine_waveformatex)+sizeof(this->header), this->seektable, sizeof(uint32_t)*this->totalframes); + + wave.cbSize = buf->size - sizeof(xine_waveformatex); + memcpy(buf->content, &wave, sizeof(wave)); + + this->audio_fifo->put (this->audio_fifo, buf); + } +} + +static int demux_tta_seek (demux_plugin_t *this_gen, + off_t start_pos, int start_time, int playing) { + demux_tta_t *this = (demux_tta_t *) this_gen; + + /* if thread is not running, initialize demuxer */ + if( !playing ) { + + /* send new pts */ + _x_demux_control_newpts(this->stream, 0, 0); + + this->status = DEMUX_OK; + } + + return this->status; +} + +static void demux_tta_dispose (demux_plugin_t *this_gen) { + demux_tta_t *this = (demux_tta_t *) this_gen; + + free(this); +} + +static int demux_tta_get_status (demux_plugin_t *this_gen) { + demux_tta_t *this = (demux_tta_t *) this_gen; + + return this->status; +} + +static int demux_tta_get_stream_length (demux_plugin_t *this_gen) { +// demux_tta_t *this = (demux_tta_t *) this_gen; + + return 0; +} + +static uint32_t demux_tta_get_capabilities(demux_plugin_t *this_gen) { + return DEMUX_CAP_NOCAP; +} + +static int demux_tta_get_optional_data(demux_plugin_t *this_gen, + void *data, int data_type) { + return DEMUX_OPTIONAL_UNSUPPORTED; +} + +static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *stream, + input_plugin_t *input) { + + demux_tta_t *this; + + this = xine_xmalloc (sizeof (demux_tta_t)); + this->stream = stream; + this->input = input; + + this->demux_plugin.send_headers = demux_tta_send_headers; + this->demux_plugin.send_chunk = demux_tta_send_chunk; + this->demux_plugin.seek = demux_tta_seek; + this->demux_plugin.dispose = demux_tta_dispose; + this->demux_plugin.get_status = demux_tta_get_status; + this->demux_plugin.get_stream_length = demux_tta_get_stream_length; + this->demux_plugin.get_capabilities = demux_tta_get_capabilities; + this->demux_plugin.get_optional_data = demux_tta_get_optional_data; + this->demux_plugin.demux_class = class_gen; + + this->status = DEMUX_FINISHED; + + this->seektable = NULL; + + switch (stream->content_detection_method) { + + case METHOD_BY_EXTENSION: { + char *extensions, *mrl; + + mrl = input->get_mrl (input); + extensions = class_gen->get_extensions (class_gen); + + if (!_x_demux_check_extension (mrl, extensions)) { + free (this); + return NULL; + } + } + /* Falling through is intended */ + + case METHOD_BY_CONTENT: + case METHOD_EXPLICIT: + if (!open_tta_file(this)) { + free (this); + return NULL; + } + break; + + default: + free (this); + return NULL; + } + + return &this->demux_plugin; +} + +static char *get_description (demux_class_t *this_gen) { + return "True Audio demux plugin"; +} + +static char *get_identifier (demux_class_t *this_gen) { + return "True Audio"; +} + +static char *get_extensions (demux_class_t *this_gen) { + return "tta"; +} + +static char *get_mimetypes (demux_class_t *this_gen) { + return NULL; +} + +static void class_dispose (demux_class_t *this_gen) { + demux_tta_class_t *this = (demux_tta_class_t *) this_gen; + + free (this); +} + +void *demux_tta_init_plugin (xine_t *xine, void *data) { + demux_tta_class_t *this; + + this = xine_xmalloc (sizeof (demux_tta_class_t)); + + this->demux_class.open_plugin = open_plugin; + this->demux_class.get_description = get_description; + this->demux_class.get_identifier = get_identifier; + this->demux_class.get_mimetypes = get_mimetypes; + this->demux_class.get_extensions = get_extensions; + this->demux_class.dispose = class_dispose; + + return this; +} diff --git a/src/demuxers/group_audio.c b/src/demuxers/group_audio.c index 7139ee5b9..bd8a291bb 100644 --- a/src/demuxers/group_audio.c +++ b/src/demuxers/group_audio.c @@ -19,7 +19,7 @@ * * This file contains plugin entries for several demuxers used in games * - * $Id: group_audio.c,v 1.24 2006/07/10 22:08:13 dgp85 Exp $ + * $Id: group_audio.c,v 1.25 2006/12/26 16:59:55 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -87,6 +87,10 @@ static const demuxer_info_t demux_info_snd = { 10 /* priority */ }; +static const demuxer_info_t demux_info_tta = { + 10 /* priority */ +}; + static const demuxer_info_t demux_info_voc = { 10 /* priority */ }; @@ -120,6 +124,7 @@ const plugin_info_t xine_plugin_info[] EXPORTED = { { PLUGIN_DEMUX, 26, "realaudio", XINE_VERSION_CODE, &demux_info_realaudio, demux_realaudio_init_plugin }, { PLUGIN_DEMUX, 26, "shn", XINE_VERSION_CODE, &demux_info_shn, demux_shn_init_plugin }, { PLUGIN_DEMUX, 26, "snd", XINE_VERSION_CODE, &demux_info_snd, demux_snd_init_plugin }, + { PLUGIN_DEMUX, 26, "tta", XINE_VERSION_CODE, &demux_info_tta, demux_tta_init_plugin }, { PLUGIN_DEMUX, 26, "voc", XINE_VERSION_CODE, &demux_info_voc, demux_voc_init_plugin }, { PLUGIN_DEMUX, 26, "vox", XINE_VERSION_CODE, &demux_info_vox, demux_vox_init_plugin }, { PLUGIN_DEMUX, 26, "wav", XINE_VERSION_CODE, &demux_info_wav, demux_wav_init_plugin }, diff --git a/src/demuxers/group_audio.h b/src/demuxers/group_audio.h index fba22cffa..7f1fccc5e 100644 --- a/src/demuxers/group_audio.h +++ b/src/demuxers/group_audio.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: group_audio.h,v 1.8 2005/05/29 19:20:48 jstembridge Exp $ + * $Id: group_audio.h,v 1.9 2006/12/26 16:59:55 dgp85 Exp $ */ #ifndef HAVE_GROUP_AUDIO_H @@ -38,6 +38,7 @@ void *demux_nsf_init_plugin (xine_t *xine, void *data); void *demux_realaudio_init_plugin (xine_t *xine, void *data); void *demux_shn_init_plugin (xine_t *xine, void *data); void *demux_snd_init_plugin (xine_t *xine, void *data); +void *demux_tta_init_plugin (xine_t *xine, void *data); void *demux_voc_init_plugin (xine_t *xine, void *data); void *demux_vox_init_plugin (xine_t *xine, void *data); void *demux_wav_init_plugin (xine_t *xine, void *data); -- cgit v1.2.3 From 2e646cd8b83e3c0a1e95f9ed100f2285a65edf02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 26 Dec 2006 17:40:37 +0000 Subject: * Allow decoding of MusePack SV 7.x files (7.1 files at least play fine). CVS patchset: 8464 CVS date: 2006/12/26 17:40:37 --- src/demuxers/demux_mpc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_mpc.c b/src/demuxers/demux_mpc.c index ab2ef511d..deaebd375 100644 --- a/src/demuxers/demux_mpc.c +++ b/src/demuxers/demux_mpc.c @@ -24,7 +24,7 @@ * APE tag reading * Seeking?? * - * $Id: demux_mpc.c,v 1.3 2005/03/06 11:41:00 jstembridge Exp $ + * $Id: demux_mpc.c,v 1.4 2006/12/26 17:40:37 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -119,11 +119,11 @@ static int open_mpc_file(demux_mpc_t *this) { } } - /* Validate signature - We only support SV7 at the moment */ + /* Validate signature - We only support SV 7.x at the moment */ if ((this->header[0] != 'M') || (this->header[1] != 'P') || (this->header[2] != '+') || - (this->header[3] != 0x07)) + ((this->header[3]&0x0f) != 0x07)) return 0; /* Get frame count */ -- cgit v1.2.3 From b8a5182e6866201f6c21e727197404d75a1aa899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Wed, 27 Dec 2006 22:14:45 +0000 Subject: Link to libxine when needed. CVS patchset: 8465 CVS date: 2006/12/27 22:14:45 --- src/audio_out/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/audio_out/Makefile.am b/src/audio_out/Makefile.am index 3a5c78147..918f4829e 100644 --- a/src/audio_out/Makefile.am +++ b/src/audio_out/Makefile.am @@ -104,6 +104,7 @@ xineplug_ao_out_esd_la_CFLAGS = $(VISIBILITY_FLAG) $(ESD_CFLAGS) xineplug_ao_out_esd_la_LDFLAGS = -avoid-version -module xineplug_ao_out_sun_la_SOURCES = audio_sun_out.c +xineplug_ao_out_sun_la_LIBADD = $(XINE_LIB) xineplug_ao_out_sun_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_ao_out_sun_la_LDFLAGS = -avoid-version -module @@ -113,7 +114,7 @@ xineplug_ao_out_sun_la_LDFLAGS = -avoid-version -module #xineplug_ao_out_irixal_la_LDFLAGS = -avoid-version -module xineplug_ao_out_arts_la_SOURCES = audio_arts_out.c -xineplug_ao_out_arts_la_LIBADD = $(ARTS_LIBS) +xineplug_ao_out_arts_la_LIBADD = $(ARTS_LIBS) $(XINE_LIB) xineplug_ao_out_arts_la_CFLAGS = $(VISIBILITY_FLAG) $(ARTS_CFLAGS) xineplug_ao_out_arts_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From dfa9febb60b0eab190051336b11aa8066446125b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Wed, 27 Dec 2006 22:32:29 +0000 Subject: Link to the dlopen-providing library. CVS patchset: 8467 CVS date: 2006/12/27 22:32:29 --- src/video_out/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index 2121c009d..0b20182c4 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -113,7 +113,7 @@ xineplug_vo_out_xxmc_la_LDFLAGS = -avoid-version -module xineplug_vo_out_opengl_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ video_out_opengl.c myglext.h $(X11OSD) xineplug_vo_out_opengl_la_LIBADD = $(MLIB_LIBS) $(OPENGL_LIBS) $(GLUT_LIBS) \ - $(GLU_LIBS) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) + $(GLU_LIBS) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) $(DYNAMIC_LD_LIBS) xineplug_vo_out_opengl_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(MLIB_CFLAGS) -fno-strict-aliasing xineplug_vo_out_opengl_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From 0e085515c869e2a16044a23005c80e0a8243610e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Wed, 27 Dec 2006 23:15:45 +0000 Subject: Link to X libraries when buidling the SDL plugin with X support. CVS patchset: 8469 CVS date: 2006/12/27 23:15:45 --- src/video_out/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index 0b20182c4..8a9ddd0dc 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -162,7 +162,7 @@ xineplug_vo_out_directfb_la_CFLAGS = $(VISIBILITY_FLAG) $(DIRECTFB_CFLAGS) -fno- xineplug_vo_out_directfb_la_LDFLAGS = -avoid-version -module xineplug_vo_out_sdl_la_SOURCES = video_out_sdl.c -xineplug_vo_out_sdl_la_LIBADD = $(SDL_LIBS) $(XINE_LIB) $(THREAD_LIBS) +xineplug_vo_out_sdl_la_LIBADD = $(SDL_LIBS) $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_sdl_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(SDL_CFLAGS) xineplug_vo_out_sdl_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From 10e1041c8ab06d144b8e0c67d8d2bde4a64bd6c7 Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Thu, 28 Dec 2006 09:54:37 +0000 Subject: Link to libxine when needed CVS patchset: 8471 CVS date: 2006/12/28 09:54:37 --- src/dxr3/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/dxr3/Makefile.am b/src/dxr3/Makefile.am index f364a375e..53d798bb9 100644 --- a/src/dxr3/Makefile.am +++ b/src/dxr3/Makefile.am @@ -22,7 +22,7 @@ endif lib_LTLIBRARIES = $(dxr3_modules) xineplug_decode_dxr3_video_la_SOURCES = dxr3_decode_video.c -xineplug_decode_dxr3_video_la_LIBADD = $(XINE_LIB) +xineplug_decode_dxr3_video_la_LIBADD = $(XINE_LIB) xineplug_decode_dxr3_video_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_decode_dxr3_video_la_LDFLAGS = -avoid-version -module @@ -44,7 +44,7 @@ xineplug_vo_out_dxr3_la_SOURCES = \ dxr3_scr.c \ video_out_dxr3.c -xineplug_vo_out_dxr3_la_LIBADD = $(link_fame) $(link_rte) $(link_x_libs) $(XINE_LIB) +xineplug_vo_out_dxr3_la_LIBADD = $(link_fame) $(link_rte) $(link_x_libs) $(XINE_LIB) $(DYNAMIC_LD_LIBS) xineplug_vo_out_dxr3_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_vo_out_dxr3_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From 3b65b4170f87a571e242cb29b8485e3008fc0b21 Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Thu, 28 Dec 2006 09:56:01 +0000 Subject: Link to threading providing libs and -lm. THIS PROBABLY NEEDS REVIEW! (but makes xine-lib build at least on debian/i386 systems) CVS patchset: 8472 CVS date: 2006/12/28 09:56:01 --- src/libw32dll/Makefile.am | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/libw32dll/Makefile.am b/src/libw32dll/Makefile.am index 67af8a8d3..289106cce 100644 --- a/src/libw32dll/Makefile.am +++ b/src/libw32dll/Makefile.am @@ -20,6 +20,8 @@ xineplug_decode_w32dll_la_LDFLAGS = -avoid-version -module xineplug_decode_w32dll_la_LIBADD = \ $(top_builddir)/src/libw32dll/wine/libwine.la \ $(XINE_LIB) \ + $(THREAD_LIBS) \ + -lm \ $(top_builddir)/src/libw32dll/DirectShow/libds_filter.la \ $(top_builddir)/src/libw32dll/dmo/libdmo_filter.la \ @KSTAT_LIBS@ @@ -29,6 +31,8 @@ xineplug_decode_qt_la_LDFLAGS = -avoid-version -module xineplug_decode_qt_la_LIBADD = \ $(top_builddir)/src/libw32dll/wine/libwine.la \ $(XINE_LIB) \ + $(THREAD_LIBS) \ + -lm \ @KSTAT_LIBS@ noinst_HEADERS = libwin32.h w32codec.h -- cgit v1.2.3 From edf8a19a4660c58a088a7047a2975de99127b1f1 Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Thu, 28 Dec 2006 09:57:02 +0000 Subject: Link to thread libs when needed CVS patchset: 8473 CVS date: 2006/12/28 09:57:02 --- src/video_out/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index 8a9ddd0dc..67da04358 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -140,13 +140,13 @@ xineplug_vo_out_vidix_la_CFLAGS = $(VISIBILITY_FLAG) $(VIDIX_CFLAGS) $(X_CFLAGS) xineplug_vo_out_vidix_la_LDFLAGS = -avoid-version -module xineplug_vo_out_aa_la_SOURCES = video_out_aa.c -xineplug_vo_out_aa_la_LIBADD = $(AALIB_LIBS) $(THREAD_LIBS) +xineplug_vo_out_aa_la_LIBADD = $(AALIB_LIBS) $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_aa_la_CFLAGS = $(VISIBILITY_FLAG) $(AALIB_CFLAGS) xineplug_vo_out_aa_la_LDFLAGS = -avoid-version -module xineplug_vo_out_caca_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ video_out_caca.c -xineplug_vo_out_caca_la_LIBADD = $(CACA_LIBS) $(THREAD_LIBS) +xineplug_vo_out_caca_la_LIBADD = $(CACA_LIBS) $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_caca_la_CFLAGS = $(VISIBILITY_FLAG) $(CACA_CFLAGS) xineplug_vo_out_caca_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From 44a7ce25beefbbb99de7b94757625accdb885976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 28 Dec 2006 21:38:32 +0000 Subject: Link to pthreads for the pvr input plugin. CVS patchset: 8474 CVS date: 2006/12/28 21:38:32 --- src/input/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/input/Makefile.am b/src/input/Makefile.am index d4a445743..a867463ff 100644 --- a/src/input/Makefile.am +++ b/src/input/Makefile.am @@ -147,7 +147,7 @@ xineplug_inp_smb_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_smb_la_LDFLAGS = -avoid-version -module xineplug_inp_pvr_la_SOURCES = input_pvr.c -xineplug_inp_pvr_la_LIBADD = $(XINE_LIB) +xineplug_inp_pvr_la_LIBADD = $(XINE_LIB) $(THREADS_LIBS) xineplug_inp_pvr_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_pvr_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From 4995b2206abf464ee7442f44be56867a1199cd6a Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sat, 30 Dec 2006 19:54:32 +0000 Subject: Link against libm (missing symbols). CVS patchset: 8476 CVS date: 2006/12/30 19:54:32 --- src/dxr3/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/dxr3/Makefile.am b/src/dxr3/Makefile.am index 53d798bb9..8bf9c9427 100644 --- a/src/dxr3/Makefile.am +++ b/src/dxr3/Makefile.am @@ -44,7 +44,7 @@ xineplug_vo_out_dxr3_la_SOURCES = \ dxr3_scr.c \ video_out_dxr3.c -xineplug_vo_out_dxr3_la_LIBADD = $(link_fame) $(link_rte) $(link_x_libs) $(XINE_LIB) $(DYNAMIC_LD_LIBS) +xineplug_vo_out_dxr3_la_LIBADD = $(link_fame) $(link_rte) $(link_x_libs) $(XINE_LIB) $(DYNAMIC_LD_LIBS) -lm xineplug_vo_out_dxr3_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_vo_out_dxr3_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From f6a2ee782d1631fc2e3b587061d2f1e8f020c632 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sat, 30 Dec 2006 20:28:23 +0000 Subject: Link against libm (missing symbols). CVS patchset: 8477 CVS date: 2006/12/30 20:28:23 --- src/liba52/Makefile.am | 2 +- src/libdts/Makefile.am | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/liba52/Makefile.am b/src/liba52/Makefile.am index 40532479f..f296a0ef3 100644 --- a/src/liba52/Makefile.am +++ b/src/liba52/Makefile.am @@ -26,7 +26,7 @@ xineplug_decode_a52_la_SOURCES = \ if EXTERNAL_A52DEC xineplug_decode_a52_la_LIBADD = $(XINE_LIB) -la52 -lm else -xineplug_decode_a52_la_LIBADD = $(XINE_LIB) +xineplug_decode_a52_la_LIBADD = $(XINE_LIB) -lm endif xineplug_decode_a52_la_CFLAGS = $(VISIBILITY_FLAG) diff --git a/src/libdts/Makefile.am b/src/libdts/Makefile.am index c2d86e073..4cf54884f 100644 --- a/src/libdts/Makefile.am +++ b/src/libdts/Makefile.am @@ -21,9 +21,9 @@ xineplug_decode_dts_la_CFLAGS = $(LIBDTS_CFLAGS) $(VISIBILITY_FLAG) $(fnsa) xineplug_decode_dts_la_LDFLAGS = -avoid-version -module if EXTERNAL_LIBDTS -xineplug_decode_dts_la_LIBADD = $(XINE_LIB) $(LIBDTS_LIBS) +xineplug_decode_dts_la_LIBADD = $(XINE_LIB) $(LIBDTS_LIBS) -lm else -xineplug_decode_dts_la_LIBADD = $(XINE_LIB) +xineplug_decode_dts_la_LIBADD = $(XINE_LIB) -lm endif noinst_HEADERS = bitstream.h dts.h dts_internal.h tables.h tables_adpcm.h \ -- cgit v1.2.3 From 9933f7b36c7e2218888d40b577ec93952015d1c3 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sat, 30 Dec 2006 22:25:04 +0000 Subject: When building encoders, mjpeg is needed too. Otherwise we get a link error about mjpeg_init being missing. CVS patchset: 8478 CVS date: 2006/12/30 22:25:04 --- src/libffmpeg/diff_to_ffmpeg_cvs.txt | 19 +++++++++++++++++++ src/libffmpeg/libavcodec/mjpeg.c | 7 +++++++ 2 files changed, 26 insertions(+) (limited to 'src') diff --git a/src/libffmpeg/diff_to_ffmpeg_cvs.txt b/src/libffmpeg/diff_to_ffmpeg_cvs.txt index 3dfb43dc3..7e19e643c 100644 --- a/src/libffmpeg/diff_to_ffmpeg_cvs.txt +++ b/src/libffmpeg/diff_to_ffmpeg_cvs.txt @@ -64,6 +64,25 @@ Index: libavcodec/motion_est.c } + +#endif /* CONFIG_ENCODERS */ +Index: libavcodec/mjpeg.c +=================================================================== +diff -u -r1.38 mjpeg.c +--- libavcodec/mjpeg.c 4 Dec 2006 22:25:19 -0000 1.38 ++++ libavcodec/mjpeg.c 30 Dec 2006 22:21:34 -0000 +@@ -38,6 +38,13 @@ + #include "mpegvideo.h" + #include "bytestream.h" + ++/* if xine's MPEG encoder is enabled, enable the encoding features in ++ * this particular module */ ++#if defined(XINE_MPEG_ENCODER) && !defined(CONFIG_ENCODERS) ++#define CONFIG_ENCODERS ++#endif ++ ++ + /* use two quantizer tables (one for luminance and one for chrominance) */ + /* not yet working */ + #undef TWOMATRIXES Index: libavcodec/mpeg12.c =================================================================== --- libavcodec/mpeg12.c (revision 7221) diff --git a/src/libffmpeg/libavcodec/mjpeg.c b/src/libffmpeg/libavcodec/mjpeg.c index 3d8383e7b..8352782c4 100644 --- a/src/libffmpeg/libavcodec/mjpeg.c +++ b/src/libffmpeg/libavcodec/mjpeg.c @@ -38,6 +38,13 @@ #include "mpegvideo.h" #include "bytestream.h" +/* if xine's MPEG encoder is enabled, enable the encoding features in + * this particular module */ +#if defined(XINE_MPEG_ENCODER) && !defined(CONFIG_ENCODERS) +#define CONFIG_ENCODERS +#endif + + /* use two quantizer tables (one for luminance and one for chrominance) */ /* not yet working */ #undef TWOMATRIXES -- cgit v1.2.3 From 7bcefb3382ff28894560e0caed8697e8aa8a3f5a Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 31 Dec 2006 12:17:00 +0000 Subject: Link against libm (missing symbols). CVS patchset: 8479 CVS date: 2006/12/31 12:17:00 --- src/input/vcd/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/input/vcd/Makefile.am b/src/input/vcd/Makefile.am index deb30e78f..98903aac8 100644 --- a/src/input/vcd/Makefile.am +++ b/src/input/vcd/Makefile.am @@ -18,7 +18,7 @@ xineplug_inp_vcd_la_LDFLAGS = -avoid-version -module if HAVE_VCDNAV xineplug_inp_vcd_la_LIBADD = $(XINE_LIB) $(LIBVCDINFO_LIBS) else -xineplug_inp_vcd_la_LIBADD = $(XINE_LIB) $(LIBVCD_LIBS) $(LIBVCDINFO_LIBS) +xineplug_inp_vcd_la_LIBADD = $(XINE_LIB) $(LIBVCD_LIBS) $(LIBVCDINFO_LIBS) -lm endif endif -- cgit v1.2.3 From 98377d46f237e11fbb0ec6466d392e8b4497ce7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sun, 31 Dec 2006 12:34:21 +0000 Subject: Fix typo.. CVS patchset: 8480 CVS date: 2006/12/31 12:34:21 --- src/input/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/input/Makefile.am b/src/input/Makefile.am index a867463ff..a3635ccad 100644 --- a/src/input/Makefile.am +++ b/src/input/Makefile.am @@ -147,7 +147,7 @@ xineplug_inp_smb_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_smb_la_LDFLAGS = -avoid-version -module xineplug_inp_pvr_la_SOURCES = input_pvr.c -xineplug_inp_pvr_la_LIBADD = $(XINE_LIB) $(THREADS_LIBS) +xineplug_inp_pvr_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) xineplug_inp_pvr_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_pvr_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From 1ff9a7e622991d93e7e5385950e93f73dfa53bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sun, 31 Dec 2006 15:00:54 +0000 Subject: Add missing links to $(XINE_LIB). CVS patchset: 8482 CVS date: 2006/12/31 15:00:54 --- src/video_out/Makefile.am | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index 67da04358..037950906 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -123,17 +123,17 @@ xineplug_vo_out_syncfb_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_vo_out_syncfb_la_LDFLAGS = -avoid-version -module xineplug_vo_out_pgx64_la_SOURCES = video_out_pgx64.c -xineplug_vo_out_pgx64_la_LIBADD = $(X_LIBS) $(SUNDGA_LIBS) $(THREAD_LIBS) +xineplug_vo_out_pgx64_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(SUNDGA_LIBS) $(THREAD_LIBS) xineplug_vo_out_pgx64_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_vo_out_pgx64_la_LDFLAGS = -avoid-version -module xineplug_vo_out_pgx32_la_SOURCES = video_out_pgx32.c -xineplug_vo_out_pgx32_la_LIBADD = $(X_LIBS) $(SUNDGA_LIBS) $(THREAD_LIBS) +xineplug_vo_out_pgx32_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(SUNDGA_LIBS) $(THREAD_LIBS) xineplug_vo_out_pgx32_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_vo_out_pgx32_la_LDFLAGS = -avoid-version -module xineplug_vo_out_vidix_la_SOURCES = video_out_vidix.c $(X11OSD) -xineplug_vo_out_vidix_la_LIBADD = $(X_LIBS) \ +xineplug_vo_out_vidix_la_LIBADD = $(XINE_LIB) $(X_LIBS) \ $(top_builddir)/src/video_out/vidix/libvidix.la \ $(top_builddir)/src/video_out/libdha/libdha.la $(THREAD_LIBS) xineplug_vo_out_vidix_la_CFLAGS = $(VISIBILITY_FLAG) $(VIDIX_CFLAGS) $(X_CFLAGS) -fno-strict-aliasing @@ -157,7 +157,7 @@ xineplug_vo_out_fb_la_CFLAGS = $(VISIBILITY_FLAG) $(MLIB_CFLAGS) xineplug_vo_out_fb_la_LDFLAGS = -avoid-version -module xineplug_vo_out_directfb_la_SOURCES = video_out_directfb.c $(X11OSD) -xineplug_vo_out_directfb_la_LIBADD = $(DIRECTFB_LIBS) $(X_LIBS) $(THREAD_LIBS) +xineplug_vo_out_directfb_la_LIBADD = $(XINE_LIB) $(DIRECTFB_LIBS) $(X_LIBS) $(THREAD_LIBS) xineplug_vo_out_directfb_la_CFLAGS = $(VISIBILITY_FLAG) $(DIRECTFB_CFLAGS) -fno-strict-aliasing xineplug_vo_out_directfb_la_LDFLAGS = -avoid-version -module @@ -167,7 +167,7 @@ xineplug_vo_out_sdl_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(SDL_CFLAGS) xineplug_vo_out_sdl_la_LDFLAGS = -avoid-version -module xineplug_vo_out_stk_la_SOURCES = video_out_stk.c -xineplug_vo_out_stk_la_LIBADD = $(LIBSTK_LIBS) $(THREAD_LIBS) +xineplug_vo_out_stk_la_LIBADD = $(XINE_LIB) $(LIBSTK_LIBS) $(THREAD_LIBS) xineplug_vo_out_stk_la_CFLAGS = $(VISIBILITY_FLAG) $(LIBSTK_CFLAGS) xineplug_vo_out_stk_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From f520a8933ac659d52b66049b2bb2402a9d50c48b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sun, 31 Dec 2006 17:23:36 +0000 Subject: Link to libdha as suggested by Jason Tackaberry, this should be the last linking error. CVS patchset: 8483 CVS date: 2006/12/31 17:23:36 --- src/video_out/vidix/drivers/Makefile.am | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/video_out/vidix/drivers/Makefile.am b/src/video_out/vidix/drivers/Makefile.am index 9e31be6cb..55bb51f2f 100644 --- a/src/video_out/vidix/drivers/Makefile.am +++ b/src/video_out/vidix/drivers/Makefile.am @@ -23,45 +23,53 @@ endif lib_LTLIBRARIES = $(vidix_drivers) radeon_vid_la_SOURCES = radeon_vid.c -radeon_vid_la_LIBADD = -lm +radeon_vid_la_LIBADD = -lm $(top_builddir)/src/video_out/vidix/libdha.la radeon_vid_la_LDFLAGS = -avoid-version -module rage128_vid_la_SOURCES = radeon_vid.c +rage128_vid_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la rage128_vid_la_LDFLAGS = -avoid-version -module rage128_vid_la_CFLAGS = -DRAGE128 $(AM_CFLAGS) pm2_vid_la_SOURCES = pm2_vid.c +pm2_vid_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la pm2_vid_la_LDFLAGS = -avoid-version -module pm3_vid_la_SOURCES = pm3_vid.c +pm3_vid_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la pm3_vid_la_LDFLAGS = -avoid-version -module mach64_vid_la_SOURCES = mach64_vid.c +mach64_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la mach64_vid_la_LDFLAGS = -avoid-version -module mga_vid_la_SOURCES = mga_vid.c -mga_vid_la_LIBADD = -lm +mga_vid_la_LIBADD = -lm $(top_builddir)/src/video_out/vidix/libdha.la mga_vid_la_LDFLAGS = -avoid-version -module mga_crtc2_vid_la_SOURCES = mga_vid.c -mga_crtc2_vid_la_LIBADD = -lm +mga_crtc2_vid_la_LIBADD = -lm $(top_builddir)/src/video_out/vidix/libdha.la mga_crtc2_vid_la_LDFLAGS = -avoid-version -module mga_crtc2_vid_la_CFLAGS = -DCRTC2 $(AM_CFLAGS) cyberblade_vid_la_SOURCES = cyberblade_vid.c +cyberblade_vid_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la cyberblade_vid_la_LDFLAGS = -avoid-version -module unichrome_vid_la_SOURCES = unichrome_vid.c +unichrome_vid_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la unichrome_vid_la_LDFLAGS = -avoid-version -module nvidia_vid_la_SOURCES = nvidia_vid.c +nvidia_vid_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la nvidia_vid_la_LDFLAGS = -avoid-version -module sis_vid_la_SOURCES = sis_vid.c sis_bridge.c +sis_vid_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la sis_vid_la_LDFLAGS = -avoid-version -module savage_vid_la_SOURCES = savage_vid.c -savage_vid_la_LIBADD = -lm +savage_vid_la_LIBADD = -lm $(top_builddir)/src/video_out/vidix/libdha.la savage_vid_la_LDFLAGS = -avoid-version -module noinst_HEADERS = mach64.h glint_regs.h pm3_regs.h radeon.h savage_regs.h \ -- cgit v1.2.3 From 35374893f50c163e0cae77dc4801c0d1b7af4d08 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Wed, 3 Jan 2007 15:09:42 +0000 Subject: Added support for setting the playback start time (same as the RTSP plugin). Actually this is only implemented for the MMST protocol. CVS patchset: 8484 CVS date: 2007/01/03 15:09:42 --- src/input/input_mms.c | 26 +++++++++++++++++++++- src/input/mms.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++-- src/input/mms.h | 4 +++- 3 files changed, 87 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/input/input_mms.c b/src/input/input_mms.c index d4f6cb940..6ef256ea3 100644 --- a/src/input/input_mms.c +++ b/src/input/input_mms.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_mms.c,v 1.64 2006/10/23 21:18:18 hadess Exp $ + * $Id: input_mms.c,v 1.65 2007/01/03 15:09:42 klan Exp $ * * mms input plugin based on work from major mms */ @@ -201,6 +201,26 @@ static off_t mms_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin return curpos; } +static off_t mms_plugin_seek_time (input_plugin_t *this_gen, int time_offset, int origin) { + mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; + off_t curpos = 0; + + lprintf ("seek_time %d msec, origin %d\n", time_offset, origin); + + switch (this->protocol) { + case PROTOCOL_MMST: + if (origin == SEEK_SET) + mms_set_start_time (this->mms, time_offset); + curpos = mms_get_current_pos (this->mms); + break; + case PROTOCOL_MMSH: + curpos = mmsh_get_current_pos (this->mmsh); + break; + } + + return curpos; +} + static off_t mms_plugin_get_length (input_plugin_t *this_gen) { mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; off_t length = 0; @@ -356,6 +376,10 @@ static int mms_plugin_open (input_plugin_t *this_gen) { this->mms = mms; this->mmsh = mmsh; + if (this->protocol == PROTOCOL_MMST) { + this->input_plugin.seek_time = mms_plugin_seek_time; + } + return 1; } diff --git a/src/input/mms.c b/src/input/mms.c index 86317a1ee..370b20759 100644 --- a/src/input/mms.c +++ b/src/input/mms.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: mms.c,v 1.63 2006/09/16 08:13:51 tmattern Exp $ + * $Id: mms.c,v 1.64 2007/01/03 15:09:42 klan Exp $ * * MMS over TCP protocol * based on work from major mms @@ -144,9 +144,19 @@ struct mms_s { int eos; uint8_t live_flag; + + uint8_t playing; + double start_time; }; +#define D2Q(d) ({\ + union { double db; long long qw; } _tmp;\ + _tmp.db = d;\ + _tmp.qw;\ +})\ + + static void mms_buffer_init (mms_buffer_t *mms_buffer, char *buffer) { mms_buffer->buffer = (uint8_t*)buffer; mms_buffer->pos = 0; @@ -179,6 +189,20 @@ static void mms_buffer_put_32 (mms_buffer_t *mms_buffer, uint32_t value) { mms_buffer->pos += 4; } +static void mms_buffer_put_64 (mms_buffer_t *mms_buffer, uint64_t value) { + + mms_buffer->buffer[mms_buffer->pos] = value & 0xff; + mms_buffer->buffer[mms_buffer->pos + 1] = (value >> 8) & 0xff; + mms_buffer->buffer[mms_buffer->pos + 2] = (value >> 16) & 0xff; + mms_buffer->buffer[mms_buffer->pos + 3] = (value >> 24) & 0xff; + mms_buffer->buffer[mms_buffer->pos + 4] = (value >> 32) & 0xff; + mms_buffer->buffer[mms_buffer->pos + 5] = (value >> 40) & 0xff; + mms_buffer->buffer[mms_buffer->pos + 6] = (value >> 48) & 0xff; + mms_buffer->buffer[mms_buffer->pos + 7] = (value >> 56) & 0xff; + + mms_buffer->pos += 8; +} + static void print_command (char *data, int len) { @@ -839,11 +863,13 @@ mms_t *mms_connect (xine_stream_t *stream, const char *url, int bandwidth) { report_progress (stream, 80); /* command 0x07 */ + /* moved to mms_read() */ +#if 0 { mms_buffer_t command_buffer; mms_buffer_init(&command_buffer, this->scmd_body); mms_buffer_put_32 (&command_buffer, 0x00000000); /* 64 byte float timestamp */ - mms_buffer_put_32 (&command_buffer, 0x00000000); + mms_buffer_put_32 (&command_buffer, 0x00000000); mms_buffer_put_32 (&command_buffer, 0xFFFFFFFF); /* ?? */ mms_buffer_put_32 (&command_buffer, 0xFFFFFFFF); /* first packet sequence */ mms_buffer_put_8 (&command_buffer, 0xFF); /* max stream time limit (3 bytes) */ @@ -857,6 +883,7 @@ mms_t *mms_connect (xine_stream_t *stream, const char *url, int bandwidth) { goto fail; } } +#endif report_progress (stream, 100); @@ -1052,9 +1079,33 @@ int mms_read (mms_t *this, char *data, int len) { this->asf_header_read += n; total += n; this->current_pos += n; + + if (this->asf_header_read == this->asf_header_len) + break; } else { int n, bytes_left ; + + if (!this->playing) { + /* send command 0x07 with initial timestamp */ + mms_buffer_t command_buffer; + mms_buffer_init(&command_buffer, this->scmd_body); + mms_buffer_put_64 (&command_buffer, D2Q(this->start_time)); /* 64 byte float timestamp */ + mms_buffer_put_32 (&command_buffer, 0xFFFFFFFF); /* ?? */ + mms_buffer_put_32 (&command_buffer, 0xFFFFFFFF); /* first packet sequence */ + mms_buffer_put_8 (&command_buffer, 0xFF); /* max stream time limit (3 bytes) */ + mms_buffer_put_8 (&command_buffer, 0xFF); + mms_buffer_put_8 (&command_buffer, 0xFF); + mms_buffer_put_8 (&command_buffer, 0x00); /* stream time limit flag */ + mms_buffer_put_32 (&command_buffer, ASF_MEDIA_PACKET_ID_TYPE); /* asf media packet id type */ + if (!send_command (this, 0x07, 1, 0x0001FFFF, command_buffer.pos)) { + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + "libmms: failed to send command 0x07\n"); + this->eos = 1; + break; + } + this->playing = 1; + } bytes_left = this->buf_size - this->buf_read; if (bytes_left == 0) { @@ -1111,3 +1162,9 @@ uint32_t mms_get_length (mms_t *this) { off_t mms_get_current_pos (mms_t *this) { return this->current_pos; } + +void mms_set_start_time (mms_t *this, int time_offset) { + if (time_offset >= 0) + this->start_time = (double) time_offset / 1000.0; +} + diff --git a/src/input/mms.h b/src/input/mms.h index f4b2928cd..310a6d0cc 100644 --- a/src/input/mms.h +++ b/src/input/mms.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: mms.h,v 1.12 2006/06/20 01:46:41 dgp85 Exp $ + * $Id: mms.h,v 1.13 2007/01/03 15:09:42 klan Exp $ * * libmms public header */ @@ -41,5 +41,7 @@ size_t mms_peek_header (mms_t *this, char *data, size_t maxsize); off_t mms_get_current_pos (mms_t *this); +void mms_set_start_time (mms_t *this, int time_offset); + #endif -- cgit v1.2.3 From eb1296dd868a7e50b6d146cce14b0fb2cedb3021 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Wed, 3 Jan 2007 15:12:37 +0000 Subject: Support setting the playback start time over MMS. CVS patchset: 8485 CVS date: 2007/01/03 15:12:37 --- src/demuxers/demux_asf.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index c4c873515..1ea394356 100644 --- a/src/demuxers/demux_asf.c +++ b/src/demuxers/demux_asf.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_asf.c,v 1.189 2006/12/19 11:15:14 klan Exp $ + * $Id: demux_asf.c,v 1.190 2007/01/03 15:12:37 klan Exp $ * * demultiplexer for asf streams * @@ -1791,10 +1791,6 @@ static int demux_asf_seek (demux_plugin_t *this_gen, int i, state; int64_t ts; - start_time /= 1000; - start_pos = (off_t) ( (double) start_pos / 65535 * - this->input->get_length (this->input) ); - lprintf ("demux_asf_seek: start_pos=%lld, start_time=%d\n", start_pos, start_time); @@ -1826,6 +1822,10 @@ static int demux_asf_seek (demux_plugin_t *this_gen, _x_demux_flush_engine(this->stream); + start_time /= 1000; + start_pos = (off_t) ( (double) start_pos / 65535 * + this->input->get_length (this->input) ); + if ( (!start_pos) && (start_time)) start_pos = start_time * this->rate; @@ -1953,6 +1953,22 @@ static int demux_asf_seek (demux_plugin_t *this_gen, this->streams[this->audio_stream].resync = 1; this->streams[this->audio_stream].skip = 1; } + } else if (!playing && this->input->seek_time != NULL) { + if (start_pos && !start_time) + start_time = this->length * start_pos / 65535; + + this->input->seek_time (this->input, start_time, SEEK_SET); + + this->keyframe_ts = 0; + this->keyframe_found = 0; /* means next keyframe */ + if (this->video_stream >= 0) { + this->streams[this->video_stream].resync = 1; + this->streams[this->video_stream].skip = 1; + } + if (this->audio_stream >= 0) { + this->streams[this->audio_stream].resync = 0; + this->streams[this->audio_stream].skip = 0; + } } else { /* "streaming" mode */ this->keyframe_ts = 0; -- cgit v1.2.3 From 23767f63d5227f631b6efe6a722891bdc3e35831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 6 Jan 2007 16:23:05 +0000 Subject: Link libdha into libvidix, this should close the last linking (and runtime) issue. CVS patchset: 8487 CVS date: 2007/01/06 16:23:05 --- src/video_out/vidix/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/video_out/vidix/Makefile.am b/src/video_out/vidix/Makefile.am index e2f8665be..2ca8f168a 100644 --- a/src/video_out/vidix/Makefile.am +++ b/src/video_out/vidix/Makefile.am @@ -13,7 +13,7 @@ endif noinst_LTLIBRARIES = $(vidix_lib) libvidix_la_SOURCES = vidixlib.c -libvidix_la_LIBADD = $(DYNAMIC_LD_LIBS) +libvidix_la_LIBADD = $(DYNAMIC_LD_LIBS) $(top_builddir)/src/video_out/libdha/libdha.la noinst_HEADERS = fourcc.h vidix.h vidixlib.h -- cgit v1.2.3 From d3ef731119e486081d9581670c7e34c94b94879d Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sat, 6 Jan 2007 16:46:56 +0000 Subject: Fix a silly naming error. Should fix linkage problems where vidix is enabled. CVS patchset: 8488 CVS date: 2007/01/06 16:46:56 --- src/video_out/vidix/drivers/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/video_out/vidix/drivers/Makefile.am b/src/video_out/vidix/drivers/Makefile.am index 55bb51f2f..62853a4f9 100644 --- a/src/video_out/vidix/drivers/Makefile.am +++ b/src/video_out/vidix/drivers/Makefile.am @@ -40,7 +40,7 @@ pm3_vid_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la pm3_vid_la_LDFLAGS = -avoid-version -module mach64_vid_la_SOURCES = mach64_vid.c -mach64_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la +mach64_vid_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la mach64_vid_la_LDFLAGS = -avoid-version -module mga_vid_la_SOURCES = mga_vid.c -- cgit v1.2.3 From efad160d4a056a71f975d058b8b345a62e32c981 Mon Sep 17 00:00:00 2001 From: Mathieu Olivier Date: Sun, 7 Jan 2007 12:33:50 +0000 Subject: Fix demuxing of uncompressed VobSub subtitles in Matroska files CVS patchset: 8490 CVS date: 2007/01/07 12:33:50 --- src/demuxers/demux_matroska.c | 263 +++++++++++++++++++++++++++++++++++------- src/demuxers/matroska.h | 13 ++- 2 files changed, 232 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index bcc5f52ea..98d2136a0 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2005 the xine project + * Copyright (C) 2000-2007 the xine project * * This file is part of xine, a free video player. * @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_matroska.c,v 1.49 2006/11/14 14:17:31 dgp85 Exp $ + * $Id: demux_matroska.c,v 1.50 2007/01/07 12:33:50 molivier Exp $ * * demultiplexer for matroska streams * @@ -362,6 +362,140 @@ static int parse_audio_track (demux_matroska_t *this, matroska_audio_track_t *at } +static int parse_content_compression (demux_matroska_t *this, matroska_track_t *track) { + ebml_parser_t *ebml = this->ebml; + int next_level = 6; + + while (next_level == 6) { + ebml_elem_t elem; + uint64_t val; + + if (!ebml_read_elem_head(ebml, &elem)) + return 0; + + switch (elem.id) { + case MATROSKA_ID_CE_COMPALGO: + lprintf("ContentCompAlgo\n"); + if (!ebml_read_uint(ebml, &elem, &val)) + return 0; + switch (val) + { + case MATROSKA_COMPRESS_ZLIB: + case MATROSKA_COMPRESS_BZLIB: + case MATROSKA_COMPRESS_LZO1X: + case MATROSKA_COMPRESS_HEADER_STRIP: + track->compress_algo = val; + break; + default: + track->compress_algo = MATROSKA_COMPRESS_UNKNOWN; + break; + } + break; + case MATROSKA_ID_CE_COMPSETTINGS: + lprintf("ContentCompSettings (UNSUPPORTED)\n"); + if (!ebml_skip(ebml, &elem)) + return 0; + break; + default: + lprintf("Unhandled ID: 0x%x\n", elem.id); + if (!ebml_skip(ebml, &elem)) + return 0; + } + next_level = ebml_get_next_level(ebml, &elem); + } + return 1; +} + + +static int parse_content_encoding (demux_matroska_t *this, matroska_track_t *track) { + ebml_parser_t *ebml = this->ebml; + int next_level = 5; + + while (next_level == 5) { + ebml_elem_t elem; + uint64_t val; + + if (!ebml_read_elem_head(ebml, &elem)) + return 0; + + switch (elem.id) { + case MATROSKA_ID_CE_ORDER: + lprintf("ContentEncodingOrder\n"); + if (!ebml_read_uint(ebml, &elem, &val)) + return 0; + if (val != 0) { // multiple content encoding isn't supported + lprintf(" warning: a non-zero encoding order is UNSUPPORTED\n"); + return 0; + } + break; + case MATROSKA_ID_CE_SCOPE: + lprintf("ContentEncodingScope\n"); + if (!ebml_read_uint(ebml, &elem, &val)) + return 0; + if (val != 1) { // 1 (all frame contents) is the only supported option + lprintf(" warning: UNSUPPORTED encoding scope (%" PRId64 ")\n", val); + return 0; + } + break; + case MATROSKA_ID_CE_TYPE: + lprintf("ContentEncodingType\n"); + if (!ebml_read_uint(ebml, &elem, &val)) + return 0; + if (val != 0) // only compression (0) is supported + return 0; + break; + case MATROSKA_ID_CE_COMPRESSION: + lprintf("ContentCompression\n"); + if (!ebml_read_master (ebml, &elem)) + return 0; + if ((elem.len > 0) && !parse_content_compression(this, track)) + return 0; + break; + case MATROSKA_ID_CE_ENCRYPTION: + lprintf("ContentEncryption (UNSUPPORTED)\n"); + if (!ebml_skip(ebml, &elem)) + return 0; + break; + default: + lprintf("Unhandled ID: 0x%x\n", elem.id); + if (!ebml_skip(ebml, &elem)) + return 0; + } + next_level = ebml_get_next_level(ebml, &elem); + } + return 1; +} + + +static int parse_content_encodings (demux_matroska_t *this, matroska_track_t *track) { + ebml_parser_t *ebml = this->ebml; + int next_level = 4; + + while (next_level == 4) { + ebml_elem_t elem; + + if (!ebml_read_elem_head(ebml, &elem)) + return 0; + + switch (elem.id) { + case MATROSKA_ID_CONTENTENCODING: + lprintf("ContentEncoding\n"); + if (!ebml_read_master (ebml, &elem)) + return 0; + if ((elem.len > 0) && !parse_content_encoding(this, track)) + return 0; + break; + default: + lprintf("Unhandled ID: 0x%x\n", elem.id); + if (!ebml_skip(ebml, &elem)) + return 0; + } + next_level = ebml_get_next_level(ebml, &elem); + } + return 1; +} + + static void init_codec_video(demux_matroska_t *this, matroska_track_t *track) { buf_element_t *buf; @@ -937,45 +1071,67 @@ static void handle_vobsub (demux_plugin_t *this_gen, matroska_track_t *track, int input_normpos, int input_time) { demux_matroska_t *this = (demux_matroska_t *) this_gen; buf_element_t *buf; - z_stream zstream; - uint8_t *dest; - int old_data_len, result; - - old_data_len = data_len; - zstream.zalloc = (alloc_func) 0; - zstream.zfree = (free_func) 0; - zstream.opaque = (voidpf) 0; - if (inflateInit (&zstream) != Z_OK) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "demux_matroska: VobSub: zlib inflateInit failed.\n"); - return; - } - zstream.next_in = (Bytef *)data; - zstream.avail_in = data_len; - dest = (uint8_t *)malloc(data_len); - zstream.avail_out = data_len; - do { - data_len += 4000; - dest = (uint8_t *)realloc(dest, data_len); - zstream.next_out = (Bytef *)(dest + zstream.total_out); - result = inflate (&zstream, Z_NO_FLUSH); - if ((result != Z_OK) && (result != Z_STREAM_END)) { + if (track->compress_algo == MATROSKA_COMPRESS_ZLIB || + track->compress_algo == MATROSKA_COMPRESS_UNKNOWN) { + z_stream zstream; + uint8_t *dest; + int old_data_len, result; + + old_data_len = data_len; + zstream.zalloc = (alloc_func) 0; + zstream.zfree = (free_func) 0; + zstream.opaque = (voidpf) 0; + if (inflateInit (&zstream) != Z_OK) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "demux_matroska: VobSub: zlib decompression failed.\n"); - free(dest); - inflateEnd(&zstream); + "demux_matroska: VobSub: zlib inflateInit failed.\n"); return; } - zstream.avail_out += 4000; - } while ((zstream.avail_out == 4000) && - (zstream.avail_in != 0) && (result != Z_STREAM_END)); - - data_len = zstream.total_out; - inflateEnd(&zstream); - - lprintf("VobSub: decompression for track %d from %d to %d\n", - (int)track->track_num, old_data_len, data_len); + zstream.next_in = (Bytef *)data; + zstream.avail_in = data_len; + + dest = (uint8_t *)malloc(data_len); + zstream.avail_out = data_len; + do { + data_len += 4000; + dest = (uint8_t *)realloc(dest, data_len); + zstream.next_out = (Bytef *)(dest + zstream.total_out); + result = inflate (&zstream, Z_NO_FLUSH); + if ((result != Z_OK) && (result != Z_STREAM_END)) { + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + "demux_matroska: VobSub: zlib decompression failed for track %d (result = %d).\n", + (int)track->track_num, result); + free(dest); + inflateEnd(&zstream); + + if (result == Z_DATA_ERROR && track->compress_algo == MATROSKA_COMPRESS_UNKNOWN) { + track->compress_algo = MATROSKA_COMPRESS_NONE; + data_len = old_data_len; + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + "demux_matroska: VobSub: falling back to uncompressed mode.\n"); + break; + } + return; + } + zstream.avail_out += 4000; + } while ((zstream.avail_out == 4000) && + (zstream.avail_in != 0) && (result != Z_STREAM_END)); + + if (track->compress_algo != MATROSKA_COMPRESS_NONE) { + data_len = zstream.total_out; + inflateEnd(&zstream); + + data = dest; + track->compress_algo = MATROSKA_COMPRESS_ZLIB; + lprintf("VobSub: decompression for track %d from %d to %d\n", + (int)track->track_num, old_data_len, data_len); + } + } + else + { + lprintf("VobSub: track %d isn't compressed (%d bytes)\n", + (int)track->track_num, data_len); + } buf = track->fifo->buffer_pool_alloc(track->fifo); @@ -986,8 +1142,8 @@ static void handle_vobsub (demux_plugin_t *this_gen, matroska_track_t *track, buf->decoder_info[2] = SPU_DVD_SUBTYPE_VOBSUB_PACKAGE; buf->type = track->buf_type; - xine_fast_memcpy(buf->content, dest, data_len); - + xine_fast_memcpy(buf->content, data, data_len); + buf->extra_info->input_normpos = input_normpos; buf->extra_info->input_time = input_time; @@ -1000,7 +1156,8 @@ static void handle_vobsub (demux_plugin_t *this_gen, matroska_track_t *track, buf->free_buffer(buf); } - free(dest); + if (track->compress_algo == MATROSKA_COMPRESS_ZLIB) + free(data); } static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { @@ -1104,6 +1261,15 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { } break; + case MATROSKA_ID_CONTENTENCODINGS: { + lprintf("ContentEncodings\n"); + if (!ebml_read_master (ebml, &elem)) + return 0; + if ((elem.len > 0) && !parse_content_encodings(this, track)) + return 0; + } + break; + case MATROSKA_ID_TR_UID: case MATROSKA_ID_TR_FLAGENABLED: case MATROSKA_ID_TR_FLAGLACING: @@ -1289,6 +1455,14 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { track->buf_type = BUF_SPU_DVD; track->handle_content = handle_vobsub; init_codec = init_codec_vobsub; + + /* Enable autodetection of the zlib compression, unless it was + * explicitely set. Most vobsubs are compressed with zlib but + * are not declared as such. + */ + if (track->compress_algo == MATROSKA_COMPRESS_NONE) { + track->compress_algo = MATROSKA_COMPRESS_UNKNOWN; + } } else { lprintf("unknown codec\n"); } @@ -1339,12 +1513,17 @@ static int parse_tracks(demux_matroska_t *this) { switch (elem.id) { case MATROSKA_ID_TR_ENTRY: { + matroska_track_t *track; + /* alloc and initialize a track with 0 */ - this->tracks[this->num_tracks] = xine_xmalloc(sizeof(matroska_track_t)); + track = xine_xmalloc(sizeof(matroska_track_t)); + track->compress_algo = MATROSKA_COMPRESS_NONE; + this->tracks[this->num_tracks] = track; + lprintf("TrackEntry\n"); if (!ebml_read_master (ebml, &elem)) return 0; - if ((elem.len > 0) && !parse_track_entry(this, this->tracks[this->num_tracks])) + if ((elem.len > 0) && !parse_track_entry(this, track)) return 0; this->num_tracks++; } diff --git a/src/demuxers/matroska.h b/src/demuxers/matroska.h index 926d6d0a6..3bfdbdc0c 100644 --- a/src/demuxers/matroska.h +++ b/src/demuxers/matroska.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2003 the xine project + * Copyright (C) 2000-2007 the xine project * * This file is part of xine, a free video player. * @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: matroska.h,v 1.10 2006/11/14 07:09:46 molivier Exp $ + * $Id: matroska.h,v 1.11 2007/01/07 12:33:50 molivier Exp $ * */ #ifndef MATROSKA_H @@ -224,6 +224,7 @@ struct matroska_track_s { uint8_t *codec_private; uint32_t codec_private_len; int default_flag; + uint32_t compress_algo; uint32_t buf_type; fifo_buffer_t *fifo; @@ -305,4 +306,12 @@ struct matroska_track_s { #define MATROSKA_TRACK_SUBTITLE 0x11 #define MATROSKA_TRACK_CONTROL 0x20 +/* compression algorithms */ +#define MATROSKA_COMPRESS_ZLIB 0x00 +#define MATROSKA_COMPRESS_BZLIB 0x01 +#define MATROSKA_COMPRESS_LZO1X 0x02 +#define MATROSKA_COMPRESS_HEADER_STRIP 0x03 +#define MATROSKA_COMPRESS_UNKNOWN 0xFFFFFFFE /* Xine internal type */ +#define MATROSKA_COMPRESS_NONE 0xFFFFFFFF /* Xine internal type */ + #endif /* MATROSKA_H */ -- cgit v1.2.3 From 994f6c9f96a720e1caa94485029f321059a63c8e Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Sun, 7 Jan 2007 20:26:23 +0000 Subject: Wrap the seek_time() and get_current_time() methods when supported by the real input plugin. CVS patchset: 8491 CVS date: 2007/01/07 20:26:23 --- src/xine-engine/input_rip.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xine-engine/input_rip.c b/src/xine-engine/input_rip.c index bb6548bc2..bdcc1ce50 100644 --- a/src/xine-engine/input_rip.c +++ b/src/xine-engine/input_rip.c @@ -29,7 +29,7 @@ * - it's possible speeder saving streams in the xine without playing: * xine stream_mrl#save:file.raw\;noaudio\;novideo * - * $Id: input_rip.c,v 1.31 2006/06/20 00:35:07 dgp85 Exp $ + * $Id: input_rip.c,v 1.32 2007/01/07 20:26:23 klan Exp $ */ /* TODO: @@ -430,6 +430,14 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) return this->curpos; } +static off_t rip_plugin_seek_time(input_plugin_t *this_gen, int time_offset, int origin) { + rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen; + + lprintf("seek_time, time_offset: %d, origin: %d\n", time_offset, origin); + + return this->main_input_plugin->seek_time(this->main_input_plugin, time_offset, origin); +} + /* * return current position, * check values for debug build @@ -448,6 +456,12 @@ static off_t rip_plugin_get_current_pos(input_plugin_t *this_gen) { return this->curpos; } +static int rip_plugin_get_current_time(input_plugin_t *this_gen) { + rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen; + + return this->main_input_plugin->get_current_time(this->main_input_plugin); +} + static off_t rip_plugin_get_length (input_plugin_t *this_gen) { rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen; off_t length; @@ -655,7 +669,11 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f this->input_plugin.read = rip_plugin_read; this->input_plugin.read_block = rip_plugin_read_block; this->input_plugin.seek = rip_plugin_seek; + if(this->main_input_plugin->seek_time) + this->input_plugin.seek_time = rip_plugin_seek_time; this->input_plugin.get_current_pos = rip_plugin_get_current_pos; + if(this->main_input_plugin->get_current_time) + this->input_plugin.get_current_time = rip_plugin_get_current_time; this->input_plugin.get_length = rip_plugin_get_length; this->input_plugin.get_blocksize = rip_plugin_get_blocksize; this->input_plugin.get_mrl = rip_plugin_get_mrl; -- cgit v1.2.3 From 652638b4bf1141c9e5c7ed0278f0aecbb0f85282 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Mon, 8 Jan 2007 22:21:01 +0000 Subject: trying to fix broken Makefile CVS patchset: 8492 CVS date: 2007/01/08 22:21:01 --- src/video_out/vidix/drivers/Makefile.am | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/video_out/vidix/drivers/Makefile.am b/src/video_out/vidix/drivers/Makefile.am index 62853a4f9..ad270bca9 100644 --- a/src/video_out/vidix/drivers/Makefile.am +++ b/src/video_out/vidix/drivers/Makefile.am @@ -23,53 +23,53 @@ endif lib_LTLIBRARIES = $(vidix_drivers) radeon_vid_la_SOURCES = radeon_vid.c -radeon_vid_la_LIBADD = -lm $(top_builddir)/src/video_out/vidix/libdha.la -radeon_vid_la_LDFLAGS = -avoid-version -module +radeon_vid_la_LIBADD = $(top_builddir)/src/video_out/libdha/libdha.la +radeon_vid_la_LDFLAGS = -avoid-version -module -lm rage128_vid_la_SOURCES = radeon_vid.c -rage128_vid_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la -rage128_vid_la_LDFLAGS = -avoid-version -module +rage128_vid_la_LIBADD = $(top_builddir)/src/video_out/libdha/libdha.la +rage128_vid_la_LDFLAGS = -avoid-version -module -lm rage128_vid_la_CFLAGS = -DRAGE128 $(AM_CFLAGS) pm2_vid_la_SOURCES = pm2_vid.c -pm2_vid_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la +pm2_vid_la_LIBADD = $(top_builddir)/src/video_out/libdha/libdha.la pm2_vid_la_LDFLAGS = -avoid-version -module pm3_vid_la_SOURCES = pm3_vid.c -pm3_vid_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la +pm3_vid_la_LIBADD = $(top_builddir)/src/video_out/libdha/libdha.la pm3_vid_la_LDFLAGS = -avoid-version -module mach64_vid_la_SOURCES = mach64_vid.c -mach64_vid_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la +mach64_vid_la_LIBADD = $(top_builddir)/src/video_out/libdha/libdha.la mach64_vid_la_LDFLAGS = -avoid-version -module mga_vid_la_SOURCES = mga_vid.c -mga_vid_la_LIBADD = -lm $(top_builddir)/src/video_out/vidix/libdha.la +mga_vid_la_LIBADD = -lm $(top_builddir)/src/video_out/libdha/libdha.la mga_vid_la_LDFLAGS = -avoid-version -module mga_crtc2_vid_la_SOURCES = mga_vid.c -mga_crtc2_vid_la_LIBADD = -lm $(top_builddir)/src/video_out/vidix/libdha.la +mga_crtc2_vid_la_LIBADD = -lm $(top_builddir)/src/video_out/libdha/libdha.la mga_crtc2_vid_la_LDFLAGS = -avoid-version -module mga_crtc2_vid_la_CFLAGS = -DCRTC2 $(AM_CFLAGS) cyberblade_vid_la_SOURCES = cyberblade_vid.c -cyberblade_vid_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la +cyberblade_vid_la_LIBADD = $(top_builddir)/src/video_out/libdha/libdha.la cyberblade_vid_la_LDFLAGS = -avoid-version -module unichrome_vid_la_SOURCES = unichrome_vid.c -unichrome_vid_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la +unichrome_vid_la_LIBADD = $(top_builddir)/src/video_out/libdha/libdha.la unichrome_vid_la_LDFLAGS = -avoid-version -module nvidia_vid_la_SOURCES = nvidia_vid.c -nvidia_vid_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la +nvidia_vid_la_LIBADD = $(top_builddir)/src/video_out/libdha/libdha.la nvidia_vid_la_LDFLAGS = -avoid-version -module sis_vid_la_SOURCES = sis_vid.c sis_bridge.c -sis_vid_la_LIBADD = $(top_builddir)/src/video_out/vidix/libdha.la +sis_vid_la_LIBADD = $(top_builddir)/src/video_out/libdha/libdha.la sis_vid_la_LDFLAGS = -avoid-version -module savage_vid_la_SOURCES = savage_vid.c -savage_vid_la_LIBADD = -lm $(top_builddir)/src/video_out/vidix/libdha.la +savage_vid_la_LIBADD = -lm $(top_builddir)/src/video_out/libdha/libdha.la savage_vid_la_LDFLAGS = -avoid-version -module noinst_HEADERS = mach64.h glint_regs.h pm3_regs.h radeon.h savage_regs.h \ -- cgit v1.2.3 From 639fe2bde8fa8dda1571b91adba193c6a52dce18 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Mon, 8 Jan 2007 23:03:19 +0000 Subject: more build fixes (libdha is already included into libvidix) CVS patchset: 8493 CVS date: 2007/01/08 23:03:19 --- src/video_out/Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index 037950906..148030dec 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -134,8 +134,7 @@ xineplug_vo_out_pgx32_la_LDFLAGS = -avoid-version -module xineplug_vo_out_vidix_la_SOURCES = video_out_vidix.c $(X11OSD) xineplug_vo_out_vidix_la_LIBADD = $(XINE_LIB) $(X_LIBS) \ - $(top_builddir)/src/video_out/vidix/libvidix.la \ - $(top_builddir)/src/video_out/libdha/libdha.la $(THREAD_LIBS) + $(top_builddir)/src/video_out/vidix/libvidix.la $(THREAD_LIBS) xineplug_vo_out_vidix_la_CFLAGS = $(VISIBILITY_FLAG) $(VIDIX_CFLAGS) $(X_CFLAGS) -fno-strict-aliasing xineplug_vo_out_vidix_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From fbabd49f7b8a90c111833fa2627473146d60de2e Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Tue, 9 Jan 2007 20:50:59 +0000 Subject: Support setting the start time over MMSH protocol. CVS patchset: 8494 CVS date: 2007/01/09 20:50:59 --- src/input/input_mms.c | 9 ++-- src/input/mmsh.c | 118 ++++++++++++++++++++++++++++++++------------------ src/input/mmsh.h | 6 ++- 3 files changed, 84 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/input/input_mms.c b/src/input/input_mms.c index 6ef256ea3..5704e78b6 100644 --- a/src/input/input_mms.c +++ b/src/input/input_mms.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_mms.c,v 1.65 2007/01/03 15:09:42 klan Exp $ + * $Id: input_mms.c,v 1.66 2007/01/09 20:50:59 klan Exp $ * * mms input plugin based on work from major mms */ @@ -214,6 +214,8 @@ static off_t mms_plugin_seek_time (input_plugin_t *this_gen, int time_offset, in curpos = mms_get_current_pos (this->mms); break; case PROTOCOL_MMSH: + if (origin == SEEK_SET) + mmsh_set_start_time (this->mmsh, time_offset); curpos = mmsh_get_current_pos (this->mmsh); break; } @@ -376,10 +378,6 @@ static int mms_plugin_open (input_plugin_t *this_gen) { this->mms = mms; this->mmsh = mmsh; - if (this->protocol == PROTOCOL_MMST) { - this->input_plugin.seek_time = mms_plugin_seek_time; - } - return 1; } @@ -424,6 +422,7 @@ static input_plugin_t *mms_class_get_instance (input_class_t *cls_gen, xine_stre this->input_plugin.read = mms_plugin_read; this->input_plugin.read_block = mms_plugin_read_block; this->input_plugin.seek = mms_plugin_seek; + this->input_plugin.seek_time = mms_plugin_seek_time; this->input_plugin.get_current_pos = mms_plugin_get_current_pos; this->input_plugin.get_length = mms_plugin_get_length; this->input_plugin.get_blocksize = mms_plugin_get_blocksize; diff --git a/src/input/mmsh.c b/src/input/mmsh.c index 889596cf7..cf8ab8a6b 100644 --- a/src/input/mmsh.c +++ b/src/input/mmsh.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: mmsh.c,v 1.40 2006/11/11 00:05:22 dgp85 Exp $ + * $Id: mmsh.c,v 1.41 2007/01/09 20:50:59 klan Exp $ * * MMS over HTTP protocol * written by Thibaut Mattern @@ -99,7 +99,7 @@ "Pragma: no-cache,rate=1.000000,stream-time=%u,stream-offset=%u:%u,request-context=%u,max-duration=%u\r\n" \ CLIENTGUID \ "Pragma: xPlayStrm=1\r\n" \ - "Pragma: stream-switch-coun t=%d\r\n" \ + "Pragma: stream-switch-count=%d\r\n" \ "Pragma: stream-switch-entry=%s\r\n" /* ffff:1:0 ffff:2:0 */ \ "Connection: Close\r\n\r\n" @@ -180,9 +180,15 @@ struct mmsh_s { uint32_t asf_header_len; uint32_t asf_header_read; int seq_num; + + int video_stream; + int audio_stream; off_t current_pos; - int user_bandwitdh; + int user_bandwidth; + + int playing; + unsigned int start_time; }; static int send_command (mmsh_t *this, char *cmd) { @@ -382,7 +388,6 @@ static int get_header (mmsh_t *this) { lprintf("get_header\n"); this->asf_header_len = 0; - this->asf_header_read = 0; /* read chunk */ while (1) { @@ -514,13 +519,10 @@ static int mmsh_tcp_connect(mmsh_t *this) { return 0; } - +/* + * firts http request + */ static int mmsh_connect_int(mmsh_t *this, int bandwidth) { - int i; - char stream_selection[10 * ASF_MAX_NUM_STREAMS]; /* 10 chars per stream */ - int offset; - int audio_stream, video_stream; - /* * let the negotiations begin... */ @@ -532,29 +534,44 @@ static int mmsh_connect_int(mmsh_t *this, int bandwidth) { this->host, this->port, 1); if (!send_command (this, this->str)) - goto fail; + return 0; if (!get_answer (this)) - goto fail; + return 0; - get_header(this); /* FIXME: it returns 0 */ + get_header (this); /* FIXME: it returns 0 */ - if (!interp_header(this)) - goto fail; + if (!interp_header (this)) + return 0; - close(this->s); + close (this->s); report_progress (this->stream, 20); - asf_header_choose_streams (this->asf_header, bandwidth, &video_stream, &audio_stream); + asf_header_choose_streams (this->asf_header, bandwidth, + &this->video_stream, &this->audio_stream); - lprintf("audio stream %d, video stream %d\n", audio_stream, video_stream); + lprintf("audio stream %d, video stream %d\n", + this->audio_stream, this->video_stream); + + asf_header_disable_streams (this->asf_header, + this->video_stream, this->audio_stream); + + return 1; +} + +/* + * second http request + */ +static int mmsh_connect_int2(mmsh_t *this, int bandwidth) { + int i; + char stream_selection[10 * ASF_MAX_NUM_STREAMS]; /* 10 chars per stream */ + int offset; /* second request */ lprintf("second http request\n"); - - if (mmsh_tcp_connect(this)) { - goto fail; - } + + if (mmsh_tcp_connect(this)) + return 0; /* stream selection string */ /* The same selection is done with mmst */ @@ -563,8 +580,8 @@ static int mmsh_connect_int(mmsh_t *this, int bandwidth) { offset = 0; for (i = 0; i < this->asf_header->stream_count; i++) { int size; - if ((i == audio_stream) || - (i == video_stream)) { + if ((i == this->audio_stream) || + (i == this->video_stream)) { size = snprintf(stream_selection + offset, sizeof(stream_selection) - offset, "ffff:%d:0 ", this->asf_header->streams[i]->stream_number); } else { @@ -573,14 +590,15 @@ static int mmsh_connect_int(mmsh_t *this, int bandwidth) { size = snprintf(stream_selection + offset, sizeof(stream_selection) - offset, "ffff:%d:2 ", this->asf_header->streams[i]->stream_number); } - if (size < 0) goto fail; + if (size < 0) + return 0; offset += size; } switch (this->stream_type) { case MMSH_SEEKABLE: snprintf (this->str, SCRATCH_SIZE, mmsh_SeekableRequest, this->uri, - this->host, this->port, 0, 0, 0, 2, 0, + this->host, this->port, this->start_time, 0, 0, 2, 0, this->asf_header->stream_count, stream_selection); break; case MMSH_LIVE: @@ -591,25 +609,25 @@ static int mmsh_connect_int(mmsh_t *this, int bandwidth) { } if (!send_command (this, this->str)) - goto fail; + return 0; lprintf("before read \n"); if (!get_answer (this)) - goto fail; - - if (!get_header(this)) - goto fail; - - if (!interp_header(this)) - goto fail; + return 0; - asf_header_disable_streams (this->asf_header, video_stream, audio_stream); + if (!get_header (this)) + return 0; + +#if 0 + if (!interp_header (this)) + return 0; + + asf_header_disable_streams (this->asf_header, + this->video_stream, this->audio_stream); +#endif return 1; - -fail: - return 0; } mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) { @@ -630,7 +648,7 @@ mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) { this->buf_size = 0; this->buf_read = 0; this->current_pos = 0; - this->user_bandwitdh = bandwidth; + this->user_bandwidth = bandwidth; report_progress (stream, 0); @@ -650,7 +668,7 @@ mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) { report_progress (stream, 30); - if (!mmsh_connect_int(this, this->user_bandwitdh)) + if (!mmsh_connect_int(this, this->user_bandwidth)) goto fail; report_progress (stream, 100); @@ -709,8 +727,10 @@ static int get_media_packet (mmsh_t *this) { if (mmsh_tcp_connect(this)) return 0; - if (!mmsh_connect_int(this, this->user_bandwitdh)) + if (!mmsh_connect_int(this, this->user_bandwidth)) return 0; + + this->playing = 0; /* mmsh_connect_int reads the first data packet */ /* this->buf_size is set by mmsh_connect_int */ @@ -784,7 +804,7 @@ int mmsh_read (mmsh_t *this, char *data, int len) { if (this->asf_header_read < this->asf_header_len) { int n, bytes_left ; - bytes_left = this->asf_header_len - this->asf_header_read ; + bytes_left = this->asf_header_len - this->asf_header_read; if ((len-total) < bytes_left) n = len-total; @@ -796,9 +816,18 @@ int mmsh_read (mmsh_t *this, char *data, int len) { this->asf_header_read += n; total += n; this->current_pos += n; + + if (this->asf_header_read == this->asf_header_len) + break; } else { int n, bytes_left ; + + if (!this->playing) { + if (!mmsh_connect_int2 (this, this->user_bandwidth)) + break; + this->playing = 1; + } bytes_left = this->buf_size - this->buf_read; @@ -867,3 +896,8 @@ uint32_t mmsh_get_length (mmsh_t *this) { off_t mmsh_get_current_pos (mmsh_t *this) { return this->current_pos; } + +void mmsh_set_start_time (mmsh_t *this, int time_offset) { + if (time_offset >= 0) + this->start_time = time_offset; +} diff --git a/src/input/mmsh.h b/src/input/mmsh.h index 8aee808f0..1ded6295a 100644 --- a/src/input/mmsh.h +++ b/src/input/mmsh.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: mmsh.h,v 1.5 2006/06/20 01:46:41 dgp85 Exp $ + * $Id: mmsh.h,v 1.6 2007/01/09 20:51:00 klan Exp $ * * libmmsh public header */ @@ -31,7 +31,7 @@ typedef struct mmsh_s mmsh_t; char* mmsh_connect_common(int *s ,int *port, char *url, char **host, char **path, char **file); -mmsh_t* mmsh_connect (xine_stream_t *stream, const char *url_, int bandwidth); +mmsh_t* mmsh_connect (xine_stream_t *stream, const char *url_, int bandwidth); int mmsh_read (mmsh_t *this, char *data, int len); uint32_t mmsh_get_length (mmsh_t *this); @@ -41,4 +41,6 @@ size_t mmsh_peek_header (mmsh_t *this, char *data, size_t maxsize); off_t mmsh_get_current_pos (mmsh_t *this); +void mmsh_set_start_time (mmsh_t *this, int time_offset); + #endif -- cgit v1.2.3 From dac1c574d51ce8f6e37f0100cc05e49a39ab860d Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Wed, 10 Jan 2007 20:13:14 +0000 Subject: make number of frames configurable (nothing to see here, i'm just testing xine latency in some realtime experiments...) CVS patchset: 8496 CVS date: 2007/01/10 20:13:14 --- src/xine-engine/video_out.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 19d635d76..446ba0a45 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out.c,v 1.225 2006/03/25 01:26:34 dsalt Exp $ + * $Id: video_out.c,v 1.226 2007/01/10 20:13:14 miguelfreitas Exp $ * * frame allocation / queuing / scheduling / output functions */ @@ -1783,11 +1783,23 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon this->frame_drop_limit = 3; this->frame_drop_cpt = 0; - num_frame_buffers = driver->get_property (driver, VO_PROP_MAX_NUM_FRAMES); - - if (!num_frame_buffers) - num_frame_buffers = NUM_FRAME_BUFFERS; /* default */ - else if (num_frame_buffers<5) + /* default number of video frames from config */ + num_frame_buffers = xine->config->register_num (xine->config, + "engine.buffers.video_num_frames", + NUM_FRAME_BUFFERS, /* default */ + _("default number of video frames"), + _("The default number of video frames to request " + "from xine video out driver. Some drivers will " + "override this setting with their own values."), + 20, NULL, NULL); + + /* check driver's limit and use the smaller value */ + i = driver->get_property (driver, VO_PROP_MAX_NUM_FRAMES); + if (i && i < num_frame_buffers) + num_frame_buffers = i; + + /* we need at least 5 frames */ + if (num_frame_buffers<5) num_frame_buffers = 5; this->extra_info_base = calloc (num_frame_buffers, -- cgit v1.2.3 From ad5f987c2e5b2be240b114461a47fe52c479ab9f Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Thu, 11 Jan 2007 16:20:55 +0000 Subject: Reconnect to the server just after the first request. CVS patchset: 8497 CVS date: 2007/01/11 16:20:55 --- src/input/mmsh.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/input/mmsh.c b/src/input/mmsh.c index cf8ab8a6b..30c16001d 100644 --- a/src/input/mmsh.c +++ b/src/input/mmsh.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: mmsh.c,v 1.41 2007/01/09 20:50:59 klan Exp $ + * $Id: mmsh.c,v 1.42 2007/01/11 16:20:55 klan Exp $ * * MMS over HTTP protocol * written by Thibaut Mattern @@ -555,6 +555,9 @@ static int mmsh_connect_int(mmsh_t *this, int bandwidth) { asf_header_disable_streams (this->asf_header, this->video_stream, this->audio_stream); + + if (mmsh_tcp_connect(this)) + return 0; return 1; } @@ -569,9 +572,6 @@ static int mmsh_connect_int2(mmsh_t *this, int bandwidth) { /* second request */ lprintf("second http request\n"); - - if (mmsh_tcp_connect(this)) - return 0; /* stream selection string */ /* The same selection is done with mmst */ -- cgit v1.2.3 From 2f5905081ee2040537f043fe4afabbb66d26354e Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sat, 13 Jan 2007 17:17:59 +0000 Subject: Fix vidix compilation (for those who enable it). CVS patchset: 8498 CVS date: 2007/01/13 17:17:59 --- src/video_out/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index 148030dec..58c6b96ad 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -133,7 +133,7 @@ xineplug_vo_out_pgx32_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_vo_out_pgx32_la_LDFLAGS = -avoid-version -module xineplug_vo_out_vidix_la_SOURCES = video_out_vidix.c $(X11OSD) -xineplug_vo_out_vidix_la_LIBADD = $(XINE_LIB) $(X_LIBS) \ +xineplug_vo_out_vidix_la_LIBADD = $(XINE_LIB) $(X_LIBS) -lXext \ $(top_builddir)/src/video_out/vidix/libvidix.la $(THREAD_LIBS) xineplug_vo_out_vidix_la_CFLAGS = $(VISIBILITY_FLAG) $(VIDIX_CFLAGS) $(X_CFLAGS) -fno-strict-aliasing xineplug_vo_out_vidix_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From 6e8ff6e5c232de4b8235626af31ab85345120a93 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sat, 13 Jan 2007 21:19:52 +0000 Subject: * ffmpeg update to 51.28.0 * Workaround ffmpeg buggy codecs that don't release their DR1 frames. * Fix several segfaults and freezing problem with H264 streams that use a lot of reference frames (eg. 15) * Initial support to enable/disable ffmpeg codecs. Codecs may be disabled in groups by --disable-ffmpeg-uncommon-codecs/--disable-ffmpeg-popular-codecs Think of "uncommon" codecs what people would never want to play with their PDAs (they will save memory by removing them). Note: currently both uncommon/popular codecs are _build_ but disabled. that is, build system still need some improvements to really save memory. warning: non-autoconf guru playing with the build system, likely breakage. CVS patchset: 8499 CVS date: 2007/01/13 21:19:52 --- src/libffmpeg/audio_decoder.c | 90 +- src/libffmpeg/diff_to_ffmpeg_cvs.txt | 416 ++++---- src/libffmpeg/libavcodec/Makefile.am | 17 +- src/libffmpeg/libavcodec/armv4l/Makefile.am | 7 +- src/libffmpeg/libavcodec/armv4l/dsputil_arm_s.S | 696 ++++++++++++ src/libffmpeg/libavcodec/armv4l/dsputil_iwmmxt.c | 188 ++++ .../libavcodec/armv4l/dsputil_iwmmxt_rnd.h | 1114 ++++++++++++++++++++ src/libffmpeg/libavcodec/armv4l/mathops.h | 49 + .../libavcodec/armv4l/mpegvideo_armv5te.c | 213 ++++ src/libffmpeg/libavcodec/armv4l/mpegvideo_iwmmxt.c | 119 +++ .../libavcodec/armv4l/simple_idct_armv5te.S | 718 +++++++++++++ src/libffmpeg/libavcodec/avcodec.h | 30 +- src/libffmpeg/libavcodec/bitstream.h | 6 +- src/libffmpeg/libavcodec/bytestream.h | 20 +- src/libffmpeg/libavcodec/cabac.h | 4 +- src/libffmpeg/libavcodec/cinepak.c | 36 +- src/libffmpeg/libavcodec/cook.c | 26 +- src/libffmpeg/libavcodec/cscd.c | 4 +- src/libffmpeg/libavcodec/dsputil.c | 28 + src/libffmpeg/libavcodec/dsputil.h | 32 +- src/libffmpeg/libavcodec/dv.c | 14 +- src/libffmpeg/libavcodec/faandct.c | 2 +- src/libffmpeg/libavcodec/ffv1.c | 2 +- src/libffmpeg/libavcodec/h263.c | 18 +- src/libffmpeg/libavcodec/h264.c | 190 +--- src/libffmpeg/libavcodec/h264data.h | 27 +- src/libffmpeg/libavcodec/h264idct.c | 2 +- src/libffmpeg/libavcodec/i386/Makefile.am | 6 +- src/libffmpeg/libavcodec/i386/cputest.c | 6 +- src/libffmpeg/libavcodec/i386/fdct_mmx.c | 8 +- src/libffmpeg/libavcodec/i386/mathops.h | 41 + src/libffmpeg/libavcodec/jfdctfst.c | 2 +- src/libffmpeg/libavcodec/jfdctint.c | 2 +- src/libffmpeg/libavcodec/jpeg_ls.c | 9 +- src/libffmpeg/libavcodec/mathops.h | 2 +- src/libffmpeg/libavcodec/motion_est.c | 38 +- src/libffmpeg/libavcodec/motion_est_template.c | 56 +- src/libffmpeg/libavcodec/mpeg12.c | 2 +- src/libffmpeg/libavcodec/mpegaudiodec.c | 4 +- src/libffmpeg/libavcodec/mpegvideo.c | 111 +- src/libffmpeg/libavcodec/mpegvideo.h | 3 + src/libffmpeg/libavcodec/parser.c | 3 +- src/libffmpeg/libavcodec/ppc/Makefile.am | 12 +- src/libffmpeg/libavcodec/ppc/float_altivec.c | 194 ++++ src/libffmpeg/libavcodec/ppc/h264_altivec.c | 565 ++++++++++ .../libavcodec/ppc/h264_template_altivec.c | 719 +++++++++++++ src/libffmpeg/libavcodec/ppc/mathops.h | 33 + src/libffmpeg/libavcodec/ppc/snow_altivec.c | 788 ++++++++++++++ src/libffmpeg/libavcodec/ppc/types_altivec.h | 41 + src/libffmpeg/libavcodec/ppc/vc1dsp_altivec.c | 338 ++++++ src/libffmpeg/libavcodec/smacker.c | 4 +- src/libffmpeg/libavcodec/snow.c | 76 +- src/libffmpeg/libavcodec/snow.h | 8 +- src/libffmpeg/libavcodec/utils.c | 73 +- src/libffmpeg/libavcodec/vc1.c | 6 +- src/libffmpeg/libavcodec/vc1dsp.c | 2 +- src/libffmpeg/libavcodec/vp3dsp.c | 2 +- src/libffmpeg/libavcodec/vp5.c | 290 +++++ src/libffmpeg/libavcodec/vp56.c | 665 ++++++++++++ src/libffmpeg/libavcodec/vp56.h | 249 +++++ src/libffmpeg/libavcodec/vp56data.c | 66 ++ src/libffmpeg/libavcodec/vp56data.h | 248 +++++ src/libffmpeg/libavcodec/vp5data.h | 173 +++ src/libffmpeg/libavcodec/vp6.c | 537 ++++++++++ src/libffmpeg/libavcodec/vp6data.h | 300 ++++++ src/libffmpeg/libavcodec/wmadec.c | 14 +- src/libffmpeg/libavcodec/wmv2.c | 6 + src/libffmpeg/libavutil/Makefile.am | 3 +- src/libffmpeg/libavutil/bswap.h | 14 +- src/libffmpeg/libavutil/common.h | 129 +-- src/libffmpeg/libavutil/internal.h | 93 +- src/libffmpeg/libavutil/intreadwrite.h | 42 + src/libffmpeg/libavutil/rational.c | 8 +- src/libffmpeg/video_decoder.c | 223 +++- src/libffmpeg/xine_decoder.c | 364 +++++-- 75 files changed, 9773 insertions(+), 873 deletions(-) create mode 100644 src/libffmpeg/libavcodec/armv4l/dsputil_arm_s.S create mode 100644 src/libffmpeg/libavcodec/armv4l/dsputil_iwmmxt.c create mode 100644 src/libffmpeg/libavcodec/armv4l/dsputil_iwmmxt_rnd.h create mode 100644 src/libffmpeg/libavcodec/armv4l/mathops.h create mode 100644 src/libffmpeg/libavcodec/armv4l/mpegvideo_armv5te.c create mode 100644 src/libffmpeg/libavcodec/armv4l/mpegvideo_iwmmxt.c create mode 100644 src/libffmpeg/libavcodec/armv4l/simple_idct_armv5te.S create mode 100644 src/libffmpeg/libavcodec/i386/mathops.h create mode 100644 src/libffmpeg/libavcodec/ppc/float_altivec.c create mode 100644 src/libffmpeg/libavcodec/ppc/h264_altivec.c create mode 100644 src/libffmpeg/libavcodec/ppc/h264_template_altivec.c create mode 100644 src/libffmpeg/libavcodec/ppc/mathops.h create mode 100644 src/libffmpeg/libavcodec/ppc/snow_altivec.c create mode 100644 src/libffmpeg/libavcodec/ppc/types_altivec.h create mode 100644 src/libffmpeg/libavcodec/ppc/vc1dsp_altivec.c create mode 100644 src/libffmpeg/libavcodec/vp5.c create mode 100644 src/libffmpeg/libavcodec/vp56.c create mode 100644 src/libffmpeg/libavcodec/vp56.h create mode 100644 src/libffmpeg/libavcodec/vp56data.c create mode 100644 src/libffmpeg/libavcodec/vp56data.h create mode 100644 src/libffmpeg/libavcodec/vp5data.h create mode 100644 src/libffmpeg/libavcodec/vp6.c create mode 100644 src/libffmpeg/libavcodec/vp6data.h create mode 100644 src/libffmpeg/libavutil/intreadwrite.h (limited to 'src') diff --git a/src/libffmpeg/audio_decoder.c b/src/libffmpeg/audio_decoder.c index 22f567e9c..8f0425775 100644 --- a/src/libffmpeg/audio_decoder.c +++ b/src/libffmpeg/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.31 2006/12/26 03:20:12 dgp85 Exp $ + * $Id: audio_decoder.c,v 1.32 2007/01/13 21:19:52 miguelfreitas Exp $ * * xine audio decoder plugin using ffmpeg * @@ -25,6 +25,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" +#include "ffmpeg_config.h" #endif #include @@ -107,8 +108,8 @@ static const ff_codec_t ff_audio_lookup[] = { {BUF_AUDIO_TRUESPEECH, CODEC_ID_TRUESPEECH, "TrueSpeech (ffmpeg)"}, {BUF_AUDIO_TTA, CODEC_ID_TTA, "True Audio Lossless (ffmpeg)"}, {BUF_AUDIO_SMACKER, CODEC_ID_SMACKAUDIO, "Smacker (ffmpeg)"}, - {BUF_AUDIO_FLVADPCM, CODEC_ID_ADPCM_SWF, "Flash ADPCM (ffmpeg)"}, - {BUF_AUDIO_WAVPACK, CODEC_ID_WAVPACK, "WavPack (ffmpeg)"}, + {BUF_AUDIO_FLVADPCM, CODEC_ID_ADPCM_SWF, "Flash ADPCM (ffmpeg)"}, + {BUF_AUDIO_WAVPACK, CODEC_ID_WAVPACK, "WavPack (ffmpeg)"}, }; @@ -443,39 +444,106 @@ void *init_audio_plugin (xine_t *xine, void *data) { } static uint32_t supported_audio_types[] = { + #ifdef CONFIG_WMAV1_DECODER BUF_AUDIO_WMAV1, + #endif + #ifdef CONFIG_WMAV2_DECODER BUF_AUDIO_WMAV2, + #endif + #ifdef CONFIG_RA_144_DECODER BUF_AUDIO_14_4, + #endif + #ifdef CONFIG_RA_288_DECODER BUF_AUDIO_28_8, - BUF_AUDIO_MULAW, - BUF_AUDIO_ALAW, + #endif + #ifdef CONFIG_MP3_DECODER + BUF_AUDIO_MPEG, + #endif + #ifdef CONFIG_ADPCM_MS_DECODER BUF_AUDIO_MSADPCM, + #endif + #ifdef CONFIG_ADPCM_IMA_QT_DECODER BUF_AUDIO_QTIMAADPCM, + #endif + #ifdef CONFIG_ADPCM_IMA_WAV_DECODER BUF_AUDIO_MSIMAADPCM, + #endif + #ifdef CONFIG_ADPCM_IMA_DK3_DECODER BUF_AUDIO_DK3ADPCM, + #endif + #ifdef CONFIG_ADPCM_IMA_DK4_DECODER BUF_AUDIO_DK4ADPCM, + #endif + #ifdef CONFIG_ADPCM_IMA_WS_DECODER + BUF_AUDIO_VQA_IMA, + #endif + #ifdef CONFIG_ADPCM_IMA_SMJPEG_DECODER + BUF_AUDIO_SMJPEG_IMA, + #endif + #ifdef CONFIG_ADPCM_XA_DECODER BUF_AUDIO_XA_ADPCM, + #endif + #ifdef CONFIG_ADPCM_4XM_DECODER + BUF_AUDIO_4X_ADPCM, + #endif + #ifdef CONFIG_ADPCM_EA_DECODER + BUF_AUDIO_EA_ADPCM, + #endif + #ifdef CONFIG_PCM_MULAW_DECODER + BUF_AUDIO_MULAW, + #endif + #ifdef CONFIG_PCM_ALAW_DECODER + BUF_AUDIO_ALAW, + #endif + #ifdef CONFIG_ROQ_DPCM_DECODER BUF_AUDIO_ROQ, + #endif + #ifdef CONFIG_INTERPLAY_DPCM_DECODER BUF_AUDIO_INTERPLAY, - BUF_AUDIO_VQA_IMA, - BUF_AUDIO_4X_ADPCM, + #endif + #ifdef CONFIG_MACE3_DECODER BUF_AUDIO_MAC3, + #endif + #ifdef CONFIG_MACE6_DECODER BUF_AUDIO_MAC6, + #endif + #ifdef CONFIG_XAN_DPCM_DECODER BUF_AUDIO_XAN_DPCM, + #endif + #ifdef CONFIG_VMDAUDIO_DECODER BUF_AUDIO_VMD, - BUF_AUDIO_EA_ADPCM, - BUF_AUDIO_SMJPEG_IMA, + #endif + #ifdef CONFIG_FLAC_DECODER BUF_AUDIO_FLAC, - BUF_AUDIO_ALAC, + #endif + #ifdef CONFIG_SHORTEN_DECODER BUF_AUDIO_SHORTEN, - BUF_AUDIO_MPEG, + #endif + #ifdef CONFIG_ALAC_DECODER + BUF_AUDIO_ALAC, + #endif + #ifdef CONFIG_QDM2_DECODER BUF_AUDIO_QDESIGN2, + #endif + #ifdef CONFIG_COOK_DECODER BUF_AUDIO_COOK, + #endif + #ifdef CONFIG_TRUESPEECH_DECODER BUF_AUDIO_TRUESPEECH, + #endif + #ifdef CONFIG_TTA_DECODER BUF_AUDIO_TTA, + #endif + #ifdef CONFIG_SMACKAUDIO_DECODER BUF_AUDIO_SMACKER, + #endif + #ifdef CONFIG_ADPCM_SWF_DECODER BUF_AUDIO_FLVADPCM, + #endif + #ifdef CONFIG_WAVPACK_DECODER BUF_AUDIO_WAVPACK, + #endif + 0 }; diff --git a/src/libffmpeg/diff_to_ffmpeg_cvs.txt b/src/libffmpeg/diff_to_ffmpeg_cvs.txt index 7e19e643c..b813b3ab2 100644 --- a/src/libffmpeg/diff_to_ffmpeg_cvs.txt +++ b/src/libffmpeg/diff_to_ffmpeg_cvs.txt @@ -1,74 +1,79 @@ -Index: libavcodec/avcodec.h +Index: libavutil/internal.h =================================================================== ---- libavcodec/avcodec.h (revision 7221) -+++ libavcodec/avcodec.h (working copy) -@@ -47,6 +47,13 @@ - #define AV_TIME_BASE 1000000 - #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} +--- libavutil/internal.h (revision 7433) ++++ libavutil/internal.h (working copy) +@@ -181,11 +181,15 @@ + #include -+/* FIXME: We cannot use ffmpeg's XvMC capabilities, since that would require -+ * linking the ffmpeg plugin against XvMC libraries, which is a bad thing, -+ * since they are output dependend. -+ * The correct fix would be to reimplement the XvMC functions libavcodec uses -+ * and do the necessary talking with our XvMC output plugin there. */ -+#undef HAVE_XVMC -+ - enum CodecID { - CODEC_ID_NONE, - CODEC_ID_MPEG1VIDEO, -@@ -2686,6 +2693,13 @@ + /* dprintf macros */ +-#ifdef DEBUG +-# define dprintf(fmt,...) av_log(NULL, AV_LOG_DEBUG, fmt, __VA_ARGS__) +-#else +-# define dprintf(fmt,...) +-#endif ++# ifdef DEBUG ++# ifdef __GNUC__ ++# define dprintf(fmt,args...) av_log(NULL, AV_LOG_DEBUG, fmt, ##args) ++# else ++# define dprintf(fmt,...) av_log(NULL, AV_LOG_DEBUG, fmt, __VA_ARGS__) ++# endif ++# else ++# define dprintf(fmt,...) ++# endif - extern unsigned int av_xiphlacing(unsigned char *s, unsigned int v); + #define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0) -+/* unused static macro */ -+#if defined(__GNUC__) && !defined(DEBUG) -+/* since we do not compile the encoder part of ffmpeg, some static -+ * functions will be unused; this is ok, the compiler will take care */ -+# define static static __attribute__((__unused__)) -+#endif -+ - #ifdef __cplusplus - } - #endif -Index: libavcodec/dsputil.h +Index: libavutil/integer.c =================================================================== ---- libavcodec/dsputil.h (revision 7221) -+++ libavcodec/dsputil.h (working copy) -@@ -33,6 +33,9 @@ - #include "common.h" - #include "avcodec.h" - -+#if defined(ARCH_X86) || defined(ARCH_X86_64) -+#define HAVE_MMX 1 -+#endif +--- libavutil/integer.c (revision 7433) ++++ libavutil/integer.c (working copy) +@@ -126,8 +126,8 @@ + AVInteger quot_temp; + if(!quot) quot = "_temp; - //#define DEBUG - /* dct code */ -Index: libavcodec/motion_est.c +- assert((int16_t)a[AV_INTEGER_SIZE-1] >= 0 && (int16_t)b[AV_INTEGER_SIZE-1] >= 0); +- assert(av_log2(b)>=0); ++ assert((int16_t)a.v[AV_INTEGER_SIZE-1] >= 0 && (int16_t)b.v[AV_INTEGER_SIZE-1] >= 0); ++ assert(av_log2_i(b)>=0); + + if(i > 0) + b= av_shr_i(b, -i); +Index: libavutil/common.h =================================================================== ---- libavcodec/motion_est.c (revision 7221) -+++ libavcodec/motion_est.c (working copy) -@@ -23,6 +23,9 @@ - * new Motion Estimation (X1/EPZS) by Michael Niedermayer - */ +--- libavutil/common.h (revision 7433) ++++ libavutil/common.h (working copy) +@@ -345,4 +345,27 @@ + char *av_strdup(const char *s); + void av_freep(void *ptr); -+/* motion estimation only needed for encoders */ -+#ifdef CONFIG_ENCODERS ++/* xine: inline causes trouble for debug compiling */ ++#ifdef DISABLE_INLINE ++# ifdef inline ++# undef inline ++# endif ++# ifdef always_inline ++# undef always_inline ++# endif ++# define inline ++# define always_inline ++#endif + - /** - * @file motion_est.c - * Motion estimation. -@@ -2112,3 +2115,5 @@ - } - } - } ++/* xine: define ASMALIGN here since it's cleaner that generating it in the configure */ ++#if HAVE_ASMALIGN_POT ++# define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\n\t" ++#else ++# define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\n\t" ++#endif ++ ++/* xine: another config.h with codecs to use */ ++#include "ffmpeg_config.h" ++ + #endif /* COMMON_H */ + -+#endif /* CONFIG_ENCODERS */ Index: libavcodec/mjpeg.c =================================================================== -diff -u -r1.38 mjpeg.c ---- libavcodec/mjpeg.c 4 Dec 2006 22:25:19 -0000 1.38 -+++ libavcodec/mjpeg.c 30 Dec 2006 22:21:34 -0000 +--- libavcodec/mjpeg.c (revision 7433) ++++ libavcodec/mjpeg.c (working copy) @@ -38,6 +38,13 @@ #include "mpegvideo.h" #include "bytestream.h" @@ -83,27 +88,61 @@ diff -u -r1.38 mjpeg.c /* use two quantizer tables (one for luminance and one for chrominance) */ /* not yet working */ #undef TWOMATRIXES -Index: libavcodec/mpeg12.c +Index: libavcodec/i386/dsputil_mmx.c =================================================================== ---- libavcodec/mpeg12.c (revision 7221) -+++ libavcodec/mpeg12.c (working copy) -@@ -36,6 +36,13 @@ - //#include - - -+/* if xine's MPEG encoder is enabled, enable the encoding features in -+ * this particular module */ -+#if defined(XINE_MPEG_ENCODER) && !defined(CONFIG_ENCODERS) -+#define CONFIG_ENCODERS -+#endif +--- libavcodec/i386/dsputil_mmx.c (revision 7433) ++++ libavcodec/i386/dsputil_mmx.c (working copy) +@@ -2545,33 +2545,39 @@ + "pmullw %%mm5, %%mm2 \n\t" // (s-dx)*dy + "pmullw %%mm4, %%mm1 \n\t" // dx*(s-dy) + +- "movd %4, %%mm5 \n\t" +- "movd %3, %%mm4 \n\t" ++ "movd %3, %%mm5 \n\t" ++ "movd %2, %%mm4 \n\t" + "punpcklbw %%mm7, %%mm5 \n\t" + "punpcklbw %%mm7, %%mm4 \n\t" + "pmullw %%mm5, %%mm3 \n\t" // src[1,1] * dx*dy + "pmullw %%mm4, %%mm2 \n\t" // src[0,1] * (s-dx)*dy + +- "movd %2, %%mm5 \n\t" +- "movd %1, %%mm4 \n\t" ++ "movd %1, %%mm5 \n\t" ++ "movd %0, %%mm4 \n\t" + "punpcklbw %%mm7, %%mm5 \n\t" + "punpcklbw %%mm7, %%mm4 \n\t" + "pmullw %%mm5, %%mm1 \n\t" // src[1,0] * dx*(s-dy) + "pmullw %%mm4, %%mm0 \n\t" // src[0,0] * (s-dx)*(s-dy) +- "paddw %5, %%mm1 \n\t" ++ "paddw %4, %%mm1 \n\t" + "paddw %%mm3, %%mm2 \n\t" + "paddw %%mm1, %%mm0 \n\t" + "paddw %%mm2, %%mm0 \n\t" + +- "psrlw %6, %%mm0 \n\t" ++ "psrlw %5, %%mm0 \n\t" + "packuswb %%mm0, %%mm0 \n\t" +- "movd %%mm0, %0 \n\t" + +- : "=m"(dst[x+y*stride]) ++ : + : "m"(src[0]), "m"(src[1]), + "m"(src[stride]), "m"(src[stride+1]), + "m"(*r4), "m"(shift2) + ); ++ ++ asm volatile( ++ "movd %%mm0, %0 \n\t" + -+ - /* Start codes. */ - #define SEQ_END_CODE 0x000001b7 - #define SEQ_START_CODE 0x000001b3 ++ : "=m"(dst[x+y*stride]) ++ : ++ ); + src += stride; + } + src += 4-h*stride; Index: libavcodec/mpegvideo.c =================================================================== ---- libavcodec/mpegvideo.c (revision 7221) +--- libavcodec/mpegvideo.c (revision 7433) +++ libavcodec/mpegvideo.c (working copy) @@ -40,6 +40,14 @@ //#undef NDEBUG @@ -163,7 +202,7 @@ Index: libavcodec/mpegvideo.c if(avctx->rc_buffer_size){ RateControlContext *rcc= &s->rc_context; -@@ -4575,6 +4593,8 @@ +@@ -4574,6 +4592,8 @@ case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: mpeg1_encode_mb(s, s->block, motion_x, motion_y); break; @@ -172,7 +211,7 @@ Index: libavcodec/mpegvideo.c case CODEC_ID_MPEG4: mpeg4_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_MSMPEG4V2: -@@ -4595,6 +4615,7 @@ +@@ -4594,6 +4614,7 @@ h263_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_MJPEG: mjpeg_encode_mb(s, s->block); break; @@ -180,7 +219,7 @@ Index: libavcodec/mpegvideo.c default: assert(0); } -@@ -4816,6 +4837,8 @@ +@@ -4815,6 +4836,8 @@ +sse(s, s->new_picture.data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[2], w>>1, h>>1, s->uvlinesize); } @@ -189,7 +228,7 @@ Index: libavcodec/mpegvideo.c static int pre_estimate_motion_thread(AVCodecContext *c, void *arg){ MpegEncContext *s= arg; -@@ -4859,6 +4882,7 @@ +@@ -4860,6 +4883,7 @@ } return 0; } @@ -197,7 +236,7 @@ Index: libavcodec/mpegvideo.c static int mb_var_thread(AVCodecContext *c, void *arg){ MpegEncContext *s= arg; -@@ -4883,6 +4907,8 @@ +@@ -4886,6 +4910,8 @@ } static void write_slice_end(MpegEncContext *s){ @@ -206,7 +245,7 @@ Index: libavcodec/mpegvideo.c if(s->codec_id==CODEC_ID_MPEG4){ if(s->partitioned_frame){ ff_mpeg4_merge_partitions(s); -@@ -4892,6 +4918,7 @@ +@@ -4895,6 +4921,7 @@ }else if(s->out_format == FMT_MJPEG){ ff_mjpeg_stuffing(&s->pb); } @@ -214,7 +253,7 @@ Index: libavcodec/mpegvideo.c align_put_bits(&s->pb); flush_put_bits(&s->pb); -@@ -4945,10 +4972,13 @@ +@@ -4950,10 +4977,13 @@ case CODEC_ID_FLV1: s->gob_index = ff_h263_get_gob_height(s); break; @@ -228,7 +267,7 @@ Index: libavcodec/mpegvideo.c } s->resync_mb_x=0; -@@ -5021,9 +5051,12 @@ +@@ -5026,9 +5056,12 @@ if(s->start_mb_y != mb_y || mb_x!=0){ write_slice_end(s); @@ -241,7 +280,7 @@ Index: libavcodec/mpegvideo.c } assert((put_bits_count(&s->pb)&7) == 0); -@@ -5047,19 +5080,25 @@ +@@ -5052,19 +5085,25 @@ } switch(s->codec_id){ @@ -267,18 +306,18 @@ Index: libavcodec/mpegvideo.c } if(s->flags&CODEC_FLAG_PASS1){ -@@ -5172,7 +5211,10 @@ - +@@ -5286,7 +5325,10 @@ + backup_s.dquant = 0; s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; s->mb_intra= 0; +/* xine: do not need this for decode or MPEG-1 encoding modes */ +#if 0 - ff_mpeg4_set_direct_mv(s, mx, my); + ff_mpeg4_set_direct_mv(s, 0, 0); +#endif /* #if 0 */ encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb, - &dmin, &next_block, mx, my); + &dmin, &next_block, 0, 0); } -@@ -5354,7 +5396,10 @@ +@@ -5400,7 +5442,10 @@ s->mb_intra= 0; motion_x=s->b_direct_mv_table[xy][0]; motion_y=s->b_direct_mv_table[xy][1]; @@ -287,9 +326,9 @@ Index: libavcodec/mpegvideo.c ff_mpeg4_set_direct_mv(s, motion_x, motion_y); +#endif /* #if 0 */ break; - case CANDIDATE_MB_TYPE_BIDIR: - s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; -@@ -5462,8 +5507,11 @@ + case CANDIDATE_MB_TYPE_DIRECT0: + s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; +@@ -5513,8 +5558,11 @@ } //not beautiful here but we must write it before flushing so it has to be here @@ -301,7 +340,7 @@ Index: libavcodec/mpegvideo.c write_slice_end(s); -@@ -5531,6 +5579,8 @@ +@@ -5582,6 +5630,8 @@ } if(s->adaptive_quant){ @@ -310,7 +349,7 @@ Index: libavcodec/mpegvideo.c switch(s->codec_id){ case CODEC_ID_MPEG4: ff_clean_mpeg4_qscales(s); -@@ -5541,6 +5591,7 @@ +@@ -5592,6 +5642,7 @@ ff_clean_h263_qscales(s); break; } @@ -318,7 +357,7 @@ Index: libavcodec/mpegvideo.c s->lambda= s->lambda_table[0]; //FIXME broken -@@ -5562,10 +5613,13 @@ +@@ -5613,10 +5664,13 @@ s->me.mb_var_sum_temp = s->me.mc_mb_var_sum_temp = 0; @@ -332,7 +371,7 @@ Index: libavcodec/mpegvideo.c s->me.scene_change_score=0; -@@ -5596,6 +5650,8 @@ +@@ -5647,6 +5701,8 @@ ff_update_duplicate_context(s->thread_context[i], s); } @@ -341,7 +380,7 @@ Index: libavcodec/mpegvideo.c ff_init_me(s); /* Estimate motion for every MB */ -@@ -5610,6 +5666,8 @@ +@@ -5661,6 +5717,8 @@ s->avctx->execute(s->avctx, estimate_motion_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count); }else /* if(s->pict_type == I_TYPE) */{ @@ -350,7 +389,7 @@ Index: libavcodec/mpegvideo.c /* I-Frame */ for(i=0; imb_stride*s->mb_height; i++) s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA; -@@ -5633,6 +5691,8 @@ +@@ -5684,6 +5742,8 @@ //printf("Scene change detected, encoding as I Frame %d %d\n", s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum); } @@ -359,7 +398,7 @@ Index: libavcodec/mpegvideo.c if(!s->umvplus){ if(s->pict_type==P_TYPE || s->pict_type==S_TYPE) { s->f_code= ff_get_best_fcode(s, s->p_mv_table, CANDIDATE_MB_TYPE_INTER); -@@ -5686,6 +5746,7 @@ +@@ -5737,6 +5797,7 @@ } } } @@ -367,7 +406,7 @@ Index: libavcodec/mpegvideo.c if (estimate_qp(s, 0) < 0) return -1; -@@ -5717,6 +5778,8 @@ +@@ -5768,6 +5829,8 @@ s->last_bits= put_bits_count(&s->pb); switch(s->out_format) { @@ -376,7 +415,7 @@ Index: libavcodec/mpegvideo.c case FMT_MJPEG: mjpeg_picture_header(s); break; -@@ -5745,11 +5808,15 @@ +@@ -5796,11 +5859,15 @@ else h263_encode_picture_header(s, picture_number); break; @@ -392,11 +431,49 @@ Index: libavcodec/mpegvideo.c default: assert(0); } +Index: libavcodec/mpeg12.c +=================================================================== +--- libavcodec/mpeg12.c (revision 7433) ++++ libavcodec/mpeg12.c (working copy) +@@ -36,6 +36,13 @@ + //#include + + ++/* if xine's MPEG encoder is enabled, enable the encoding features in ++ * this particular module */ ++#if defined(XINE_MPEG_ENCODER) && !defined(CONFIG_ENCODERS) ++#define CONFIG_ENCODERS ++#endif ++ ++ + /* Start codes. */ + #define SEQ_END_CODE 0x000001b7 + #define SEQ_START_CODE 0x000001b3 +Index: libavcodec/motion_est.c +=================================================================== +--- libavcodec/motion_est.c (revision 7433) ++++ libavcodec/motion_est.c (working copy) +@@ -23,6 +23,9 @@ + * new Motion Estimation (X1/EPZS) by Michael Niedermayer + */ + ++/* motion estimation only needed for encoders */ ++#ifdef CONFIG_ENCODERS ++ + /** + * @file motion_est.c + * Motion estimation. +@@ -2142,3 +2145,5 @@ + } + } + } ++ ++#endif /* CONFIG_ENCODERS */ Index: libavcodec/snow.c =================================================================== ---- libavcodec/snow.c (revision 7221) +--- libavcodec/snow.c (revision 7433) +++ libavcodec/snow.c (working copy) -@@ -1977,6 +1977,7 @@ +@@ -1982,6 +1982,7 @@ #define P_MV1 P[9] #define FLAG_QPEL 1 //must be 1 @@ -404,15 +481,15 @@ Index: libavcodec/snow.c static int encode_q_branch(SnowContext *s, int level, int x, int y){ uint8_t p_buffer[1024]; uint8_t i_buffer[1024]; -@@ -2205,6 +2206,7 @@ +@@ -2210,6 +2211,7 @@ return score; } } +#endif - static always_inline int same_block(BlockNode *a, BlockNode *b){ + static av_always_inline int same_block(BlockNode *a, BlockNode *b){ if((a->type&BLOCK_INTRA) && (b->type&BLOCK_INTRA)){ -@@ -2319,6 +2321,7 @@ +@@ -2322,6 +2324,7 @@ } } @@ -420,7 +497,7 @@ Index: libavcodec/snow.c static void encode_blocks(SnowContext *s, int search){ int x, y; int w= s->b_width; -@@ -2340,6 +2343,7 @@ +@@ -2343,6 +2346,7 @@ } } } @@ -428,7 +505,7 @@ Index: libavcodec/snow.c static void decode_blocks(SnowContext *s){ int x, y; -@@ -3910,6 +3914,7 @@ +@@ -3931,6 +3935,7 @@ } } @@ -436,7 +513,7 @@ Index: libavcodec/snow.c static int encode_init(AVCodecContext *avctx) { SnowContext *s = avctx->priv_data; -@@ -3997,6 +4002,7 @@ +@@ -4018,6 +4023,7 @@ return 0; } @@ -444,7 +521,7 @@ Index: libavcodec/snow.c static int frame_start(SnowContext *s){ AVFrame tmp; -@@ -4035,6 +4041,7 @@ +@@ -4056,6 +4062,7 @@ return 0; } @@ -452,7 +529,7 @@ Index: libavcodec/snow.c static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ SnowContext *s = avctx->priv_data; RangeCoder * const c= &s->c; -@@ -4288,6 +4295,7 @@ +@@ -4308,6 +4315,7 @@ return ff_rac_terminate(c); } @@ -460,7 +537,7 @@ Index: libavcodec/snow.c static void common_end(SnowContext *s){ int plane_index, level, orientation, i; -@@ -4319,6 +4327,7 @@ +@@ -4339,6 +4347,7 @@ } } @@ -468,7 +545,7 @@ Index: libavcodec/snow.c static int encode_end(AVCodecContext *avctx) { SnowContext *s = avctx->priv_data; -@@ -4328,6 +4337,7 @@ +@@ -4348,6 +4357,7 @@ return 0; } @@ -476,86 +553,9 @@ Index: libavcodec/snow.c static int decode_init(AVCodecContext *avctx) { -Index: libavutil/common.h -=================================================================== ---- libavutil/common.h (revision 7221) -+++ libavutil/common.h (working copy) -@@ -375,7 +375,7 @@ - ); - return (d << 32) | (a & 0xffffffff); - } --#elif defined(ARCH_X86_32) -+#elif defined(ARCH_X86) - static inline long long read_time(void) - { - long long l; -@@ -446,4 +446,23 @@ - char *av_strdup(const char *s); - void av_freep(void *ptr); - -+/* xine: inline causes trouble for debug compiling */ -+#ifdef DISABLE_INLINE -+# ifdef inline -+# undef inline -+# endif -+# ifdef always_inline -+# undef always_inline -+# endif -+# define inline -+# define always_inline -+#endif -+ -+/* xine: define ASMALIGN here since it's cleaner that generating it in the configure */ -+#if HAVE_ASMALIGN_POT -+# define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\n\t" -+#else -+# define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\n\t" -+#endif -+ - #endif /* COMMON_H */ -Index: libavutil/integer.c -=================================================================== ---- libavutil/integer.c (revision 7221) -+++ libavutil/integer.c (working copy) -@@ -126,8 +126,8 @@ - AVInteger quot_temp; - if(!quot) quot = "_temp; - -- assert((int16_t)a[AV_INTEGER_SIZE-1] >= 0 && (int16_t)b[AV_INTEGER_SIZE-1] >= 0); -- assert(av_log2(b)>=0); -+ assert((int16_t)a.v[AV_INTEGER_SIZE-1] >= 0 && (int16_t)b.v[AV_INTEGER_SIZE-1] >= 0); -+ assert(av_log2_i(b)>=0); - - if(i > 0) - b= av_shr_i(b, -i); -Index: libavutil/internal.h -=================================================================== ---- libavutil/internal.h (revision 7221) -+++ libavutil/internal.h (working copy) -@@ -93,11 +93,15 @@ - #include - - /* dprintf macros */ --#ifdef DEBUG --# define dprintf(fmt,...) av_log(NULL, AV_LOG_DEBUG, fmt, __VA_ARGS__) --#else --# define dprintf(fmt,...) --#endif -+# ifdef DEBUG -+# ifdef __GNUC__ -+# define dprintf(fmt,args...) av_log(NULL, AV_LOG_DEBUG, fmt, ##args) -+# else -+# define dprintf(fmt,...) av_log(NULL, AV_LOG_DEBUG, fmt, __VA_ARGS__) -+# endif -+# else -+# define dprintf(fmt,...) -+# endif - - #define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0) - Index: libavcodec/mlib/dsputil_mlib.c =================================================================== ---- libavcodec/mlib/dsputil_mlib.c (revision 7221) +--- libavcodec/mlib/dsputil_mlib.c (revision 7433) +++ libavcodec/mlib/dsputil_mlib.c (working copy) @@ -22,6 +22,8 @@ #include "../dsputil.h" @@ -566,3 +566,35 @@ Index: libavcodec/mlib/dsputil_mlib.c #include #include #include +Index: libavcodec/avcodec.h +=================================================================== +--- libavcodec/avcodec.h (revision 7433) ++++ libavcodec/avcodec.h (working copy) +@@ -47,6 +47,13 @@ + #define AV_TIME_BASE 1000000 + #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} + ++/* FIXME: We cannot use ffmpeg's XvMC capabilities, since that would require ++ * linking the ffmpeg plugin against XvMC libraries, which is a bad thing, ++ * since they are output dependend. ++ * The correct fix would be to reimplement the XvMC functions libavcodec uses ++ * and do the necessary talking with our XvMC output plugin there. */ ++#undef HAVE_XVMC ++ + enum CodecID { + CODEC_ID_NONE, + CODEC_ID_MPEG1VIDEO, +@@ -2688,6 +2695,13 @@ + + extern unsigned int av_xiphlacing(unsigned char *s, unsigned int v); + ++/* unused static macro */ ++#if defined(__GNUC__) && !defined(DEBUG) ++/* since we do not compile the encoder part of ffmpeg, some static ++ * functions will be unused; this is ok, the compiler will take care */ ++# define static static __attribute__((__unused__)) ++#endif ++ + #ifdef __cplusplus + } + #endif diff --git a/src/libffmpeg/libavcodec/Makefile.am b/src/libffmpeg/libavcodec/Makefile.am index cf34b0d28..cae72eeff 100644 --- a/src/libffmpeg/libavcodec/Makefile.am +++ b/src/libffmpeg/libavcodec/Makefile.am @@ -4,14 +4,15 @@ SUBDIRS = armv4l i386 mlib alpha ppc sparc libpostproc # some of ffmpeg's decoders are not used by xine yet EXTRA_DIST = motion_est_template.c \ - adx.c cljr.c fdctref.c ffv1.c g726.c jpeg_ls.c mdec.c raw.c snow.c svq3.c wmv2.c + adx.c cljr.c fdctref.c ffv1.c g726.c jpeg_ls.c mdec.c raw.c svq3.c wmv2.c # we need to compile everything in debug mode, including the encoders, # otherwise we get unresolved symbols, because some unsatisfied function calls # are not optimized away with debug optimization -AM_CFLAGS = `test "$(CFLAGS)" = "$(DEBUG_CFLAGS)" && echo -DCONFIG_ENCODERS` -fno-strict-aliasing -DCONFIG_VC1_DECODER +#AM_CFLAGS = `test "$(CFLAGS)" = "$(DEBUG_CFLAGS)" && echo -DCONFIG_ENCODERS` -fno-strict-aliasing +AM_CFLAGS = `test "$(CFLAGS)" = "$(DEBUG_CFLAGS)"` -fno-strict-aliasing AM_CPPFLAGS = $(ZLIB_CPPFLAGS) $(LIBFFMPEG_CPPFLAGS) \ - -I$(top_srcdir)/src/libffmpeg/libavutil + -I$(top_srcdir)/src/libffmpeg/libavutil -I$(top_srcdir)/src/libffmpeg ASFLAGS = noinst_LTLIBRARIES = libavcodec.la @@ -94,6 +95,7 @@ libavcodec_la_SOURCES = \ simple_idct.c \ smacker.c \ smc.c \ + snow.c \ svq1.c \ tscc.c \ truemotion1.c \ @@ -110,7 +112,12 @@ libavcodec_la_SOURCES = \ vorbis_data.c \ vp3.c \ vp3dsp.c \ + vp5.c \ + vp56.c \ + vp56data.c \ + vp6.c \ vqavideo.c \ + wavpack.c \ wmadec.c \ wnv1.c \ xan.c \ @@ -175,4 +182,8 @@ noinst_HEADERS = \ vc1acdata.h \ vc1data.h \ vp3data.h \ + vp56.h \ + vp56data.h \ + vp5data.h \ + vp6data.h \ wmadata.h diff --git a/src/libffmpeg/libavcodec/armv4l/Makefile.am b/src/libffmpeg/libavcodec/armv4l/Makefile.am index 0f3d230f6..33e0882c9 100644 --- a/src/libffmpeg/libavcodec/armv4l/Makefile.am +++ b/src/libffmpeg/libavcodec/armv4l/Makefile.am @@ -6,7 +6,12 @@ ASFLAGS = noinst_LTLIBRARIES = libavcodec_armv4l.la -libavcodec_armv4l_src = dsputil_arm.c jrevdct_arm.S mpegvideo_arm.c simple_idct_arm.S +libavcodec_armv4l_src = dsputil_arm.c jrevdct_arm.S mpegvideo_arm.c simple_idct_arm.S \ + dsputil_arm_s.S dsputil_iwmmxt.c dsputil_iwmmxt_rnd.h \ + mpegvideo_armv5te.c mpegvideo_iwmmxt.c simple_idct_armv5te.S + +noinst_HEADERS = mathops.h + libavcodec_armv4l_dummy = libavcodec_armv4l_dummy.c EXTRA_DIST = $(libavcodec_armv4l_src) $(libavcodec_armv4l_dummy) diff --git a/src/libffmpeg/libavcodec/armv4l/dsputil_arm_s.S b/src/libffmpeg/libavcodec/armv4l/dsputil_arm_s.S new file mode 100644 index 000000000..2a3ee9c50 --- /dev/null +++ b/src/libffmpeg/libavcodec/armv4l/dsputil_arm_s.S @@ -0,0 +1,696 @@ +@ +@ ARMv4L optimized DSP utils +@ Copyright (c) 2004 AGAWA Koji +@ +@ This file is part of FFmpeg. +@ +@ FFmpeg is free software; you can redistribute it and/or +@ modify it under the terms of the GNU Lesser General Public +@ License as published by the Free Software Foundation; either +@ version 2.1 of the License, or (at your option) any later version. +@ +@ FFmpeg 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 FFmpeg; if not, write to the Free Software +@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +@ + +.macro ADJ_ALIGN_QUADWORD_D shift, Rd0, Rd1, Rd2, Rd3, Rn0, Rn1, Rn2, Rn3, Rn4 + mov \Rd0, \Rn0, lsr #(\shift * 8) + mov \Rd1, \Rn1, lsr #(\shift * 8) + mov \Rd2, \Rn2, lsr #(\shift * 8) + mov \Rd3, \Rn3, lsr #(\shift * 8) + orr \Rd0, \Rd0, \Rn1, lsl #(32 - \shift * 8) + orr \Rd1, \Rd1, \Rn2, lsl #(32 - \shift * 8) + orr \Rd2, \Rd2, \Rn3, lsl #(32 - \shift * 8) + orr \Rd3, \Rd3, \Rn4, lsl #(32 - \shift * 8) +.endm +.macro ADJ_ALIGN_DOUBLEWORD shift, R0, R1, R2 + mov \R0, \R0, lsr #(\shift * 8) + orr \R0, \R0, \R1, lsl #(32 - \shift * 8) + mov \R1, \R1, lsr #(\shift * 8) + orr \R1, \R1, \R2, lsl #(32 - \shift * 8) +.endm +.macro ADJ_ALIGN_DOUBLEWORD_D shift, Rdst0, Rdst1, Rsrc0, Rsrc1, Rsrc2 + mov \Rdst0, \Rsrc0, lsr #(\shift * 8) + mov \Rdst1, \Rsrc1, lsr #(\shift * 8) + orr \Rdst0, \Rdst0, \Rsrc1, lsl #(32 - (\shift * 8)) + orr \Rdst1, \Rdst1, \Rsrc2, lsl #(32 - (\shift * 8)) +.endm + +.macro RND_AVG32 Rd0, Rd1, Rn0, Rn1, Rm0, Rm1, Rmask + @ Rd = (Rn | Rm) - (((Rn ^ Rm) & ~0x01010101) >> 1) + @ Rmask = 0xFEFEFEFE + @ Rn = destroy + eor \Rd0, \Rn0, \Rm0 + eor \Rd1, \Rn1, \Rm1 + orr \Rn0, \Rn0, \Rm0 + orr \Rn1, \Rn1, \Rm1 + and \Rd0, \Rd0, \Rmask + and \Rd1, \Rd1, \Rmask + sub \Rd0, \Rn0, \Rd0, lsr #1 + sub \Rd1, \Rn1, \Rd1, lsr #1 +.endm + +.macro NO_RND_AVG32 Rd0, Rd1, Rn0, Rn1, Rm0, Rm1, Rmask + @ Rd = (Rn & Rm) - (((Rn ^ Rm) & ~0x01010101) >> 1) + @ Rmask = 0xFEFEFEFE + @ Rn = destroy + eor \Rd0, \Rn0, \Rm0 + eor \Rd1, \Rn1, \Rm1 + and \Rn0, \Rn0, \Rm0 + and \Rn1, \Rn1, \Rm1 + and \Rd0, \Rd0, \Rmask + and \Rd1, \Rd1, \Rmask + add \Rd0, \Rn0, \Rd0, lsr #1 + add \Rd1, \Rn1, \Rd1, lsr #1 +.endm + +@ ---------------------------------------------------------------- + .align 8 + .global put_pixels16_arm +put_pixels16_arm: + @ void func(uint8_t *block, const uint8_t *pixels, int line_size, int h) + @ block = word aligned, pixles = unaligned + pld [r1] + stmfd sp!, {r4-r11, lr} @ R14 is also called LR + adr r5, 5f + ands r4, r1, #3 + bic r1, r1, #3 + add r5, r5, r4, lsl #2 + ldrne pc, [r5] +1: + ldmia r1, {r4-r7} + add r1, r1, r2 + stmia r0, {r4-r7} + pld [r1] + subs r3, r3, #1 + add r0, r0, r2 + bne 1b + ldmfd sp!, {r4-r11, pc} + .align 8 +2: + ldmia r1, {r4-r8} + add r1, r1, r2 + ADJ_ALIGN_QUADWORD_D 1, r9, r10, r11, r12, r4, r5, r6, r7, r8 + pld [r1] + subs r3, r3, #1 + stmia r0, {r9-r12} + add r0, r0, r2 + bne 2b + ldmfd sp!, {r4-r11, pc} + .align 8 +3: + ldmia r1, {r4-r8} + add r1, r1, r2 + ADJ_ALIGN_QUADWORD_D 2, r9, r10, r11, r12, r4, r5, r6, r7, r8 + pld [r1] + subs r3, r3, #1 + stmia r0, {r9-r12} + add r0, r0, r2 + bne 3b + ldmfd sp!, {r4-r11, pc} + .align 8 +4: + ldmia r1, {r4-r8} + add r1, r1, r2 + ADJ_ALIGN_QUADWORD_D 3, r9, r10, r11, r12, r4, r5, r6, r7, r8 + pld [r1] + subs r3, r3, #1 + stmia r0, {r9-r12} + add r0, r0, r2 + bne 4b + ldmfd sp!, {r4-r11,pc} + .align 8 +5: + .word 1b + .word 2b + .word 3b + .word 4b + +@ ---------------------------------------------------------------- + .align 8 + .global put_pixels8_arm +put_pixels8_arm: + @ void func(uint8_t *block, const uint8_t *pixels, int line_size, int h) + @ block = word aligned, pixles = unaligned + pld [r1] + stmfd sp!, {r4-r5,lr} @ R14 is also called LR + adr r5, 5f + ands r4, r1, #3 + bic r1, r1, #3 + add r5, r5, r4, lsl #2 + ldrne pc, [r5] +1: + ldmia r1, {r4-r5} + add r1, r1, r2 + subs r3, r3, #1 + pld [r1] + stmia r0, {r4-r5} + add r0, r0, r2 + bne 1b + ldmfd sp!, {r4-r5,pc} + .align 8 +2: + ldmia r1, {r4-r5, r12} + add r1, r1, r2 + ADJ_ALIGN_DOUBLEWORD 1, r4, r5, r12 + pld [r1] + subs r3, r3, #1 + stmia r0, {r4-r5} + add r0, r0, r2 + bne 2b + ldmfd sp!, {r4-r5,pc} + .align 8 +3: + ldmia r1, {r4-r5, r12} + add r1, r1, r2 + ADJ_ALIGN_DOUBLEWORD 2, r4, r5, r12 + pld [r1] + subs r3, r3, #1 + stmia r0, {r4-r5} + add r0, r0, r2 + bne 3b + ldmfd sp!, {r4-r5,pc} + .align 8 +4: + ldmia r1, {r4-r5, r12} + add r1, r1, r2 + ADJ_ALIGN_DOUBLEWORD 3, r4, r5, r12 + pld [r1] + subs r3, r3, #1 + stmia r0, {r4-r5} + add r0, r0, r2 + bne 4b + ldmfd sp!, {r4-r5,pc} + .align 8 +5: + .word 1b + .word 2b + .word 3b + .word 4b + +@ ---------------------------------------------------------------- + .align 8 + .global put_pixels8_x2_arm +put_pixels8_x2_arm: + @ void func(uint8_t *block, const uint8_t *pixels, int line_size, int h) + @ block = word aligned, pixles = unaligned + pld [r1] + stmfd sp!, {r4-r10,lr} @ R14 is also called LR + adr r5, 5f + ands r4, r1, #3 + ldr r12, [r5] + add r5, r5, r4, lsl #2 + bic r1, r1, #3 + ldrne pc, [r5] +1: + ldmia r1, {r4-r5, r10} + add r1, r1, r2 + ADJ_ALIGN_DOUBLEWORD_D 1, r6, r7, r4, r5, r10 + pld [r1] + RND_AVG32 r8, r9, r4, r5, r6, r7, r12 + subs r3, r3, #1 + stmia r0, {r8-r9} + add r0, r0, r2 + bne 1b + ldmfd sp!, {r4-r10,pc} + .align 8 +2: + ldmia r1, {r4-r5, r10} + add r1, r1, r2 + ADJ_ALIGN_DOUBLEWORD_D 1, r6, r7, r4, r5, r10 + ADJ_ALIGN_DOUBLEWORD_D 2, r8, r9, r4, r5, r10 + pld [r1] + RND_AVG32 r4, r5, r6, r7, r8, r9, r12 + subs r3, r3, #1 + stmia r0, {r4-r5} + add r0, r0, r2 + bne 2b + ldmfd sp!, {r4-r10,pc} + .align 8 +3: + ldmia r1, {r4-r5, r10} + add r1, r1, r2 + ADJ_ALIGN_DOUBLEWORD_D 2, r6, r7, r4, r5, r10 + ADJ_ALIGN_DOUBLEWORD_D 3, r8, r9, r4, r5, r10 + pld [r1] + RND_AVG32 r4, r5, r6, r7, r8, r9, r12 + subs r3, r3, #1 + stmia r0, {r4-r5} + add r0, r0, r2 + bne 3b + ldmfd sp!, {r4-r10,pc} + .align 8 +4: + ldmia r1, {r4-r5, r10} + add r1, r1, r2 + ADJ_ALIGN_DOUBLEWORD_D 3, r6, r7, r4, r5, r10 + pld [r1] + RND_AVG32 r8, r9, r6, r7, r5, r10, r12 + subs r3, r3, #1 + stmia r0, {r8-r9} + add r0, r0, r2 + bne 4b + ldmfd sp!, {r4-r10,pc} @@ update PC with LR content. + .align 8 +5: + .word 0xFEFEFEFE + .word 2b + .word 3b + .word 4b + + .align 8 + .global put_no_rnd_pixels8_x2_arm +put_no_rnd_pixels8_x2_arm: + @ void func(uint8_t *block, const uint8_t *pixels, int line_size, int h) + @ block = word aligned, pixles = unaligned + pld [r1] + stmfd sp!, {r4-r10,lr} @ R14 is also called LR + adr r5, 5f + ands r4, r1, #3 + ldr r12, [r5] + add r5, r5, r4, lsl #2 + bic r1, r1, #3 + ldrne pc, [r5] +1: + ldmia r1, {r4-r5, r10} + add r1, r1, r2 + ADJ_ALIGN_DOUBLEWORD_D 1, r6, r7, r4, r5, r10 + pld [r1] + NO_RND_AVG32 r8, r9, r4, r5, r6, r7, r12 + subs r3, r3, #1 + stmia r0, {r8-r9} + add r0, r0, r2 + bne 1b + ldmfd sp!, {r4-r10,pc} + .align 8 +2: + ldmia r1, {r4-r5, r10} + add r1, r1, r2 + ADJ_ALIGN_DOUBLEWORD_D 1, r6, r7, r4, r5, r10 + ADJ_ALIGN_DOUBLEWORD_D 2, r8, r9, r4, r5, r10 + pld [r1] + NO_RND_AVG32 r4, r5, r6, r7, r8, r9, r12 + subs r3, r3, #1 + stmia r0, {r4-r5} + add r0, r0, r2 + bne 2b + ldmfd sp!, {r4-r10,pc} + .align 8 +3: + ldmia r1, {r4-r5, r10} + add r1, r1, r2 + ADJ_ALIGN_DOUBLEWORD_D 2, r6, r7, r4, r5, r10 + ADJ_ALIGN_DOUBLEWORD_D 3, r8, r9, r4, r5, r10 + pld [r1] + NO_RND_AVG32 r4, r5, r6, r7, r8, r9, r12 + subs r3, r3, #1 + stmia r0, {r4-r5} + add r0, r0, r2 + bne 3b + ldmfd sp!, {r4-r10,pc} + .align 8 +4: + ldmia r1, {r4-r5, r10} + add r1, r1, r2 + ADJ_ALIGN_DOUBLEWORD_D 3, r6, r7, r4, r5, r10 + pld [r1] + NO_RND_AVG32 r8, r9, r6, r7, r5, r10, r12 + subs r3, r3, #1 + stmia r0, {r8-r9} + add r0, r0, r2 + bne 4b + ldmfd sp!, {r4-r10,pc} @@ update PC with LR content. + .align 8 +5: + .word 0xFEFEFEFE + .word 2b + .word 3b + .word 4b + + +@ ---------------------------------------------------------------- + .align 8 + .global put_pixels8_y2_arm +put_pixels8_y2_arm: + @ void func(uint8_t *block, const uint8_t *pixels, int line_size, int h) + @ block = word aligned, pixles = unaligned + pld [r1] + stmfd sp!, {r4-r11,lr} @ R14 is also called LR + adr r5, 5f + ands r4, r1, #3 + mov r3, r3, lsr #1 + ldr r12, [r5] + add r5, r5, r4, lsl #2 + bic r1, r1, #3 + ldrne pc, [r5] +1: + ldmia r1, {r4-r5} + add r1, r1, r2 +6: ldmia r1, {r6-r7} + add r1, r1, r2 + pld [r1] + RND_AVG32 r8, r9, r4, r5, r6, r7, r12 + ldmia r1, {r4-r5} + add r1, r1, r2 + stmia r0, {r8-r9} + add r0, r0, r2 + pld [r1] + RND_AVG32 r8, r9, r6, r7, r4, r5, r12 + subs r3, r3, #1 + stmia r0, {r8-r9} + add r0, r0, r2 + bne 6b + ldmfd sp!, {r4-r11,pc} + .align 8 +2: + ldmia r1, {r4-r6} + add r1, r1, r2 + pld [r1] + ADJ_ALIGN_DOUBLEWORD 1, r4, r5, r6 +6: ldmia r1, {r7-r9} + add r1, r1, r2 + pld [r1] + ADJ_ALIGN_DOUBLEWORD 1, r7, r8, r9 + RND_AVG32 r10, r11, r4, r5, r7, r8, r12 + stmia r0, {r10-r11} + add r0, r0, r2 + ldmia r1, {r4-r6} + add r1, r1, r2 + pld [r1] + ADJ_ALIGN_DOUBLEWORD 1, r4, r5, r6 + subs r3, r3, #1 + RND_AVG32 r10, r11, r7, r8, r4, r5, r12 + stmia r0, {r10-r11} + add r0, r0, r2 + bne 6b + ldmfd sp!, {r4-r11,pc} + .align 8 +3: + ldmia r1, {r4-r6} + add r1, r1, r2 + pld [r1] + ADJ_ALIGN_DOUBLEWORD 2, r4, r5, r6 +6: ldmia r1, {r7-r9} + add r1, r1, r2 + pld [r1] + ADJ_ALIGN_DOUBLEWORD 2, r7, r8, r9 + RND_AVG32 r10, r11, r4, r5, r7, r8, r12 + stmia r0, {r10-r11} + add r0, r0, r2 + ldmia r1, {r4-r6} + add r1, r1, r2 + pld [r1] + ADJ_ALIGN_DOUBLEWORD 2, r4, r5, r6 + subs r3, r3, #1 + RND_AVG32 r10, r11, r7, r8, r4, r5, r12 + stmia r0, {r10-r11} + add r0, r0, r2 + bne 6b + ldmfd sp!, {r4-r11,pc} + .align 8 +4: + ldmia r1, {r4-r6} + add r1, r1, r2 + pld [r1] + ADJ_ALIGN_DOUBLEWORD 3, r4, r5, r6 +6: ldmia r1, {r7-r9} + add r1, r1, r2 + pld [r1] + ADJ_ALIGN_DOUBLEWORD 3, r7, r8, r9 + RND_AVG32 r10, r11, r4, r5, r7, r8, r12 + stmia r0, {r10-r11} + add r0, r0, r2 + ldmia r1, {r4-r6} + add r1, r1, r2 + pld [r1] + ADJ_ALIGN_DOUBLEWORD 3, r4, r5, r6 + subs r3, r3, #1 + RND_AVG32 r10, r11, r7, r8, r4, r5, r12 + stmia r0, {r10-r11} + add r0, r0, r2 + bne 6b + ldmfd sp!, {r4-r11,pc} + + .align 8 +5: + .word 0xFEFEFEFE + .word 2b + .word 3b + .word 4b + + .align 8 + .global put_no_rnd_pixels8_y2_arm +put_no_rnd_pixels8_y2_arm: + @ void func(uint8_t *block, const uint8_t *pixels, int line_size, int h) + @ block = word aligned, pixles = unaligned + pld [r1] + stmfd sp!, {r4-r11,lr} @ R14 is also called LR + adr r5, 5f + ands r4, r1, #3 + mov r3, r3, lsr #1 + ldr r12, [r5] + add r5, r5, r4, lsl #2 + bic r1, r1, #3 + ldrne pc, [r5] +1: + ldmia r1, {r4-r5} + add r1, r1, r2 +6: ldmia r1, {r6-r7} + add r1, r1, r2 + pld [r1] + NO_RND_AVG32 r8, r9, r4, r5, r6, r7, r12 + ldmia r1, {r4-r5} + add r1, r1, r2 + stmia r0, {r8-r9} + add r0, r0, r2 + pld [r1] + NO_RND_AVG32 r8, r9, r6, r7, r4, r5, r12 + subs r3, r3, #1 + stmia r0, {r8-r9} + add r0, r0, r2 + bne 6b + ldmfd sp!, {r4-r11,pc} + .align 8 +2: + ldmia r1, {r4-r6} + add r1, r1, r2 + pld [r1] + ADJ_ALIGN_DOUBLEWORD 1, r4, r5, r6 +6: ldmia r1, {r7-r9} + add r1, r1, r2 + pld [r1] + ADJ_ALIGN_DOUBLEWORD 1, r7, r8, r9 + NO_RND_AVG32 r10, r11, r4, r5, r7, r8, r12 + stmia r0, {r10-r11} + add r0, r0, r2 + ldmia r1, {r4-r6} + add r1, r1, r2 + pld [r1] + ADJ_ALIGN_DOUBLEWORD 1, r4, r5, r6 + subs r3, r3, #1 + NO_RND_AVG32 r10, r11, r7, r8, r4, r5, r12 + stmia r0, {r10-r11} + add r0, r0, r2 + bne 6b + ldmfd sp!, {r4-r11,pc} + .align 8 +3: + ldmia r1, {r4-r6} + add r1, r1, r2 + pld [r1] + ADJ_ALIGN_DOUBLEWORD 2, r4, r5, r6 +6: ldmia r1, {r7-r9} + add r1, r1, r2 + pld [r1] + ADJ_ALIGN_DOUBLEWORD 2, r7, r8, r9 + NO_RND_AVG32 r10, r11, r4, r5, r7, r8, r12 + stmia r0, {r10-r11} + add r0, r0, r2 + ldmia r1, {r4-r6} + add r1, r1, r2 + pld [r1] + ADJ_ALIGN_DOUBLEWORD 2, r4, r5, r6 + subs r3, r3, #1 + NO_RND_AVG32 r10, r11, r7, r8, r4, r5, r12 + stmia r0, {r10-r11} + add r0, r0, r2 + bne 6b + ldmfd sp!, {r4-r11,pc} + .align 8 +4: + ldmia r1, {r4-r6} + add r1, r1, r2 + pld [r1] + ADJ_ALIGN_DOUBLEWORD 3, r4, r5, r6 +6: ldmia r1, {r7-r9} + add r1, r1, r2 + pld [r1] + ADJ_ALIGN_DOUBLEWORD 3, r7, r8, r9 + NO_RND_AVG32 r10, r11, r4, r5, r7, r8, r12 + stmia r0, {r10-r11} + add r0, r0, r2 + ldmia r1, {r4-r6} + add r1, r1, r2 + pld [r1] + ADJ_ALIGN_DOUBLEWORD 3, r4, r5, r6 + subs r3, r3, #1 + NO_RND_AVG32 r10, r11, r7, r8, r4, r5, r12 + stmia r0, {r10-r11} + add r0, r0, r2 + bne 6b + ldmfd sp!, {r4-r11,pc} + .align 8 +5: + .word 0xFEFEFEFE + .word 2b + .word 3b + .word 4b + +@ ---------------------------------------------------------------- +.macro RND_XY2_IT align, rnd + @ l1= (a & 0x03030303) + (b & 0x03030303) ?(+ 0x02020202) + @ h1= ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2) +.if \align == 0 + ldmia r1, {r6-r8} +.elseif \align == 3 + ldmia r1, {r5-r7} +.else + ldmia r1, {r8-r10} +.endif + add r1, r1, r2 + pld [r1] +.if \align == 0 + ADJ_ALIGN_DOUBLEWORD_D 1, r4, r5, r6, r7, r8 +.elseif \align == 1 + ADJ_ALIGN_DOUBLEWORD_D 1, r4, r5, r8, r9, r10 + ADJ_ALIGN_DOUBLEWORD_D 2, r6, r7, r8, r9, r10 +.elseif \align == 2 + ADJ_ALIGN_DOUBLEWORD_D 2, r4, r5, r8, r9, r10 + ADJ_ALIGN_DOUBLEWORD_D 3, r6, r7, r8, r9, r10 +.elseif \align == 3 + ADJ_ALIGN_DOUBLEWORD_D 3, r4, r5, r5, r6, r7 +.endif + ldr r14, [r12, #0] @ 0x03030303 + tst r3, #1 + and r8, r4, r14 + and r9, r5, r14 + and r10, r6, r14 + and r11, r7, r14 +.if \rnd == 1 + ldreq r14, [r12, #16] @ 0x02020202 +.else + ldreq r14, [r12, #28] @ 0x01010101 +.endif + add r8, r8, r10 + add r9, r9, r11 + addeq r8, r8, r14 + addeq r9, r9, r14 + ldr r14, [r12, #20] @ 0xFCFCFCFC >> 2 + and r4, r14, r4, lsr #2 + and r5, r14, r5, lsr #2 + and r6, r14, r6, lsr #2 + and r7, r14, r7, lsr #2 + add r10, r4, r6 + add r11, r5, r7 +.endm + +.macro RND_XY2_EXPAND align, rnd + RND_XY2_IT \align, \rnd +6: stmfd sp!, {r8-r11} + RND_XY2_IT \align, \rnd + ldmfd sp!, {r4-r7} + add r4, r4, r8 + add r5, r5, r9 + add r6, r6, r10 + add r7, r7, r11 + ldr r14, [r12, #24] @ 0x0F0F0F0F + and r4, r14, r4, lsr #2 + and r5, r14, r5, lsr #2 + add r4, r4, r6 + add r5, r5, r7 + subs r3, r3, #1 + stmia r0, {r4-r5} + add r0, r0, r2 + bne 6b + ldmfd sp!, {r4-r11,pc} +.endm + + .align 8 + .global put_pixels8_xy2_arm +put_pixels8_xy2_arm: + @ void func(uint8_t *block, const uint8_t *pixels, int line_size, int h) + @ block = word aligned, pixles = unaligned + pld [r1] + stmfd sp!, {r4-r11,lr} @ R14 is also called LR + adrl r12, 5f + ands r4, r1, #3 + add r5, r12, r4, lsl #2 + bic r1, r1, #3 + ldrne pc, [r5] +1: + RND_XY2_EXPAND 0, 1 + + .align 8 +2: + RND_XY2_EXPAND 1, 1 + + .align 8 +3: + RND_XY2_EXPAND 2, 1 + + .align 8 +4: + RND_XY2_EXPAND 3, 1 + +5: + .word 0x03030303 + .word 2b + .word 3b + .word 4b + .word 0x02020202 + .word 0xFCFCFCFC >> 2 + .word 0x0F0F0F0F + .word 0x01010101 + + .align 8 + .global put_no_rnd_pixels8_xy2_arm +put_no_rnd_pixels8_xy2_arm: + @ void func(uint8_t *block, const uint8_t *pixels, int line_size, int h) + @ block = word aligned, pixles = unaligned + pld [r1] + stmfd sp!, {r4-r11,lr} @ R14 is also called LR + adrl r12, 5f + ands r4, r1, #3 + add r5, r12, r4, lsl #2 + bic r1, r1, #3 + ldrne pc, [r5] +1: + RND_XY2_EXPAND 0, 0 + + .align 8 +2: + RND_XY2_EXPAND 1, 0 + + .align 8 +3: + RND_XY2_EXPAND 2, 0 + + .align 8 +4: + RND_XY2_EXPAND 3, 0 + +5: + .word 0x03030303 + .word 2b + .word 3b + .word 4b + .word 0x02020202 + .word 0xFCFCFCFC >> 2 + .word 0x0F0F0F0F + .word 0x01010101 diff --git a/src/libffmpeg/libavcodec/armv4l/dsputil_iwmmxt.c b/src/libffmpeg/libavcodec/armv4l/dsputil_iwmmxt.c new file mode 100644 index 000000000..d7401e760 --- /dev/null +++ b/src/libffmpeg/libavcodec/armv4l/dsputil_iwmmxt.c @@ -0,0 +1,188 @@ +/* + * iWMMXt optimized DSP utils + * Copyright (c) 2004 AGAWA Koji + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "../dsputil.h" + +#define DEF(x, y) x ## _no_rnd_ ## y ##_iwmmxt +#define SET_RND(regd) __asm__ __volatile__ ("mov r12, #1 \n\t tbcsth " #regd ", r12":::"r12"); +#define WAVG2B "wavg2b" +#include "dsputil_iwmmxt_rnd.h" +#undef DEF +#undef SET_RND +#undef WAVG2B + +#define DEF(x, y) x ## _ ## y ##_iwmmxt +#define SET_RND(regd) __asm__ __volatile__ ("mov r12, #2 \n\t tbcsth " #regd ", r12":::"r12"); +#define WAVG2B "wavg2br" +#include "dsputil_iwmmxt_rnd.h" +#undef DEF +#undef SET_RND +#undef WAVG2BR + +// need scheduling +#define OP(AVG) \ + asm volatile ( \ + /* alignment */ \ + "and r12, %[pixels], #7 \n\t" \ + "bic %[pixels], %[pixels], #7 \n\t" \ + "tmcr wcgr1, r12 \n\t" \ + \ + "wldrd wr0, [%[pixels]] \n\t" \ + "wldrd wr1, [%[pixels], #8] \n\t" \ + "add %[pixels], %[pixels], %[line_size] \n\t" \ + "walignr1 wr4, wr0, wr1 \n\t" \ + \ + "1: \n\t" \ + \ + "wldrd wr2, [%[pixels]] \n\t" \ + "wldrd wr3, [%[pixels], #8] \n\t" \ + "add %[pixels], %[pixels], %[line_size] \n\t" \ + "pld [%[pixels]] \n\t" \ + "walignr1 wr5, wr2, wr3 \n\t" \ + AVG " wr6, wr4, wr5 \n\t" \ + "wstrd wr6, [%[block]] \n\t" \ + "add %[block], %[block], %[line_size] \n\t" \ + \ + "wldrd wr0, [%[pixels]] \n\t" \ + "wldrd wr1, [%[pixels], #8] \n\t" \ + "add %[pixels], %[pixels], %[line_size] \n\t" \ + "walignr1 wr4, wr0, wr1 \n\t" \ + "pld [%[pixels]] \n\t" \ + AVG " wr6, wr4, wr5 \n\t" \ + "wstrd wr6, [%[block]] \n\t" \ + "add %[block], %[block], %[line_size] \n\t" \ + \ + "subs %[h], %[h], #2 \n\t" \ + "bne 1b \n\t" \ + : [block]"+r"(block), [pixels]"+r"(pixels), [h]"+r"(h) \ + : [line_size]"r"(line_size) \ + : "memory", "r12"); +void put_pixels8_y2_iwmmxt(uint8_t *block, const uint8_t *pixels, const int line_size, int h) +{ + OP("wavg2br"); +} +void put_no_rnd_pixels8_y2_iwmmxt(uint8_t *block, const uint8_t *pixels, const int line_size, int h) +{ + OP("wavg2b"); +} +#undef OP + +void add_pixels_clamped_iwmmxt(const DCTELEM *block, uint8_t *pixels, int line_size) +{ + uint8_t *pixels2 = pixels + line_size; + + __asm__ __volatile__ ( + "mov r12, #4 \n\t" + "1: \n\t" + "pld [%[pixels], %[line_size2]] \n\t" + "pld [%[pixels2], %[line_size2]] \n\t" + "wldrd wr4, [%[pixels]] \n\t" + "wldrd wr5, [%[pixels2]] \n\t" + "pld [%[block], #32] \n\t" + "wunpckelub wr6, wr4 \n\t" + "wldrd wr0, [%[block]] \n\t" + "wunpckehub wr7, wr4 \n\t" + "wldrd wr1, [%[block], #8] \n\t" + "wunpckelub wr8, wr5 \n\t" + "wldrd wr2, [%[block], #16] \n\t" + "wunpckehub wr9, wr5 \n\t" + "wldrd wr3, [%[block], #24] \n\t" + "add %[block], %[block], #32 \n\t" + "waddhss wr10, wr0, wr6 \n\t" + "waddhss wr11, wr1, wr7 \n\t" + "waddhss wr12, wr2, wr8 \n\t" + "waddhss wr13, wr3, wr9 \n\t" + "wpackhus wr14, wr10, wr11 \n\t" + "wpackhus wr15, wr12, wr13 \n\t" + "wstrd wr14, [%[pixels]] \n\t" + "add %[pixels], %[pixels], %[line_size2] \n\t" + "subs r12, r12, #1 \n\t" + "wstrd wr15, [%[pixels2]] \n\t" + "add %[pixels2], %[pixels2], %[line_size2] \n\t" + "bne 1b \n\t" + : [block]"+r"(block), [pixels]"+r"(pixels), [pixels2]"+r"(pixels2) + : [line_size2]"r"(line_size << 1) + : "cc", "memory", "r12"); +} + +static void nop(uint8_t *block, const uint8_t *pixels, int line_size, int h) +{ + return; +} + +int mm_flags; /* multimedia extension flags */ + +int mm_support(void) +{ + return 0; /* TODO, implement proper detection */ +} + +void dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx) +{ + mm_flags = mm_support(); + + if (avctx->dsp_mask) { + if (avctx->dsp_mask & FF_MM_FORCE) + mm_flags |= (avctx->dsp_mask & 0xffff); + else + mm_flags &= ~(avctx->dsp_mask & 0xffff); + } + + if (!(mm_flags & MM_IWMMXT)) return; + + c->add_pixels_clamped = add_pixels_clamped_iwmmxt; + + c->put_pixels_tab[0][0] = put_pixels16_iwmmxt; + c->put_pixels_tab[0][1] = put_pixels16_x2_iwmmxt; + c->put_pixels_tab[0][2] = put_pixels16_y2_iwmmxt; + c->put_pixels_tab[0][3] = put_pixels16_xy2_iwmmxt; + c->put_no_rnd_pixels_tab[0][0] = put_pixels16_iwmmxt; + c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_iwmmxt; + c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_iwmmxt; + c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_iwmmxt; + + c->put_pixels_tab[1][0] = put_pixels8_iwmmxt; + c->put_pixels_tab[1][1] = put_pixels8_x2_iwmmxt; + c->put_pixels_tab[1][2] = put_pixels8_y2_iwmmxt; + c->put_pixels_tab[1][3] = put_pixels8_xy2_iwmmxt; + c->put_no_rnd_pixels_tab[1][0] = put_pixels8_iwmmxt; + c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_iwmmxt; + c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_iwmmxt; + c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_iwmmxt; + + c->avg_pixels_tab[0][0] = avg_pixels16_iwmmxt; + c->avg_pixels_tab[0][1] = avg_pixels16_x2_iwmmxt; + c->avg_pixels_tab[0][2] = avg_pixels16_y2_iwmmxt; + c->avg_pixels_tab[0][3] = avg_pixels16_xy2_iwmmxt; + c->avg_no_rnd_pixels_tab[0][0] = avg_pixels16_iwmmxt; + c->avg_no_rnd_pixels_tab[0][1] = avg_no_rnd_pixels16_x2_iwmmxt; + c->avg_no_rnd_pixels_tab[0][2] = avg_no_rnd_pixels16_y2_iwmmxt; + c->avg_no_rnd_pixels_tab[0][3] = avg_no_rnd_pixels16_xy2_iwmmxt; + + c->avg_pixels_tab[1][0] = avg_pixels8_iwmmxt; + c->avg_pixels_tab[1][1] = avg_pixels8_x2_iwmmxt; + c->avg_pixels_tab[1][2] = avg_pixels8_y2_iwmmxt; + c->avg_pixels_tab[1][3] = avg_pixels8_xy2_iwmmxt; + c->avg_no_rnd_pixels_tab[1][0] = avg_no_rnd_pixels8_iwmmxt; + c->avg_no_rnd_pixels_tab[1][1] = avg_no_rnd_pixels8_x2_iwmmxt; + c->avg_no_rnd_pixels_tab[1][2] = avg_no_rnd_pixels8_y2_iwmmxt; + c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels8_xy2_iwmmxt; +} diff --git a/src/libffmpeg/libavcodec/armv4l/dsputil_iwmmxt_rnd.h b/src/libffmpeg/libavcodec/armv4l/dsputil_iwmmxt_rnd.h new file mode 100644 index 000000000..51ba61c47 --- /dev/null +++ b/src/libffmpeg/libavcodec/armv4l/dsputil_iwmmxt_rnd.h @@ -0,0 +1,1114 @@ +/* + * iWMMXt optimized DSP utils + * copyright (c) 2004 AGAWA Koji + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +void DEF(put, pixels8)(uint8_t *block, const uint8_t *pixels, const int line_size, int h) +{ + int stride = line_size; + __asm__ __volatile__ ( + "and r12, %[pixels], #7 \n\t" + "bic %[pixels], %[pixels], #7 \n\t" + "tmcr wcgr1, r12 \n\t" + "add r4, %[pixels], %[line_size] \n\t" + "add r5, %[block], %[line_size] \n\t" + "mov %[line_size], %[line_size], lsl #1 \n\t" + "1: \n\t" + "wldrd wr0, [%[pixels]] \n\t" + "subs %[h], %[h], #2 \n\t" + "wldrd wr1, [%[pixels], #8] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "wldrd wr3, [r4] \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "wldrd wr4, [r4, #8] \n\t" + "add r4, r4, %[line_size] \n\t" + "walignr1 wr8, wr0, wr1 \n\t" + "pld [r4] \n\t" + "pld [r4, #32] \n\t" + "walignr1 wr10, wr3, wr4 \n\t" + "wstrd wr8, [%[block]] \n\t" + "add %[block], %[block], %[line_size] \n\t" + "wstrd wr10, [r5] \n\t" + "add r5, r5, %[line_size] \n\t" + "bne 1b \n\t" + : [block]"+r"(block), [pixels]"+r"(pixels), [line_size]"+r"(stride), [h]"+r"(h) + : + : "memory", "r4", "r5", "r12"); +} + +void DEF(avg, pixels8)(uint8_t *block, const uint8_t *pixels, const int line_size, int h) +{ + int stride = line_size; + __asm__ __volatile__ ( + "and r12, %[pixels], #7 \n\t" + "bic %[pixels], %[pixels], #7 \n\t" + "tmcr wcgr1, r12 \n\t" + "add r4, %[pixels], %[line_size] \n\t" + "add r5, %[block], %[line_size] \n\t" + "mov %[line_size], %[line_size], lsl #1 \n\t" + "1: \n\t" + "wldrd wr0, [%[pixels]] \n\t" + "subs %[h], %[h], #2 \n\t" + "wldrd wr1, [%[pixels], #8] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "wldrd wr3, [r4] \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "wldrd wr4, [r4, #8] \n\t" + "add r4, r4, %[line_size] \n\t" + "walignr1 wr8, wr0, wr1 \n\t" + "wldrd wr0, [%[block]] \n\t" + "wldrd wr2, [r5] \n\t" + "pld [r4] \n\t" + "pld [r4, #32] \n\t" + "walignr1 wr10, wr3, wr4 \n\t" + WAVG2B" wr8, wr8, wr0 \n\t" + WAVG2B" wr10, wr10, wr2 \n\t" + "wstrd wr8, [%[block]] \n\t" + "add %[block], %[block], %[line_size] \n\t" + "wstrd wr10, [r5] \n\t" + "pld [%[block]] \n\t" + "pld [%[block], #32] \n\t" + "add r5, r5, %[line_size] \n\t" + "pld [r5] \n\t" + "pld [r5, #32] \n\t" + "bne 1b \n\t" + : [block]"+r"(block), [pixels]"+r"(pixels), [line_size]"+r"(stride), [h]"+r"(h) + : + : "memory", "r4", "r5", "r12"); +} + +void DEF(put, pixels16)(uint8_t *block, const uint8_t *pixels, const int line_size, int h) +{ + int stride = line_size; + __asm__ __volatile__ ( + "and r12, %[pixels], #7 \n\t" + "bic %[pixels], %[pixels], #7 \n\t" + "tmcr wcgr1, r12 \n\t" + "add r4, %[pixels], %[line_size] \n\t" + "add r5, %[block], %[line_size] \n\t" + "mov %[line_size], %[line_size], lsl #1 \n\t" + "1: \n\t" + "wldrd wr0, [%[pixels]] \n\t" + "wldrd wr1, [%[pixels], #8] \n\t" + "subs %[h], %[h], #2 \n\t" + "wldrd wr2, [%[pixels], #16] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "wldrd wr3, [r4] \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "walignr1 wr8, wr0, wr1 \n\t" + "wldrd wr4, [r4, #8] \n\t" + "walignr1 wr9, wr1, wr2 \n\t" + "wldrd wr5, [r4, #16] \n\t" + "add r4, r4, %[line_size] \n\t" + "pld [r4] \n\t" + "pld [r4, #32] \n\t" + "walignr1 wr10, wr3, wr4 \n\t" + "wstrd wr8, [%[block]] \n\t" + "walignr1 wr11, wr4, wr5 \n\t" + "wstrd wr9, [%[block], #8] \n\t" + "add %[block], %[block], %[line_size] \n\t" + "wstrd wr10, [r5] \n\t" + "wstrd wr11, [r5, #8] \n\t" + "add r5, r5, %[line_size] \n\t" + "bne 1b \n\t" + : [block]"+r"(block), [pixels]"+r"(pixels), [line_size]"+r"(stride), [h]"+r"(h) + : + : "memory", "r4", "r5", "r12"); +} + +void DEF(avg, pixels16)(uint8_t *block, const uint8_t *pixels, const int line_size, int h) +{ + int stride = line_size; + __asm__ __volatile__ ( + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "pld [%[block]] \n\t" + "pld [%[block], #32] \n\t" + "and r12, %[pixels], #7 \n\t" + "bic %[pixels], %[pixels], #7 \n\t" + "tmcr wcgr1, r12 \n\t" + "add r4, %[pixels], %[line_size]\n\t" + "add r5, %[block], %[line_size] \n\t" + "mov %[line_size], %[line_size], lsl #1 \n\t" + "1: \n\t" + "wldrd wr0, [%[pixels]] \n\t" + "wldrd wr1, [%[pixels], #8] \n\t" + "subs %[h], %[h], #2 \n\t" + "wldrd wr2, [%[pixels], #16] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "wldrd wr3, [r4] \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "walignr1 wr8, wr0, wr1 \n\t" + "wldrd wr4, [r4, #8] \n\t" + "walignr1 wr9, wr1, wr2 \n\t" + "wldrd wr5, [r4, #16] \n\t" + "add r4, r4, %[line_size] \n\t" + "wldrd wr0, [%[block]] \n\t" + "pld [r4] \n\t" + "wldrd wr1, [%[block], #8] \n\t" + "pld [r4, #32] \n\t" + "wldrd wr2, [r5] \n\t" + "walignr1 wr10, wr3, wr4 \n\t" + "wldrd wr3, [r5, #8] \n\t" + WAVG2B" wr8, wr8, wr0 \n\t" + WAVG2B" wr9, wr9, wr1 \n\t" + WAVG2B" wr10, wr10, wr2 \n\t" + "wstrd wr8, [%[block]] \n\t" + "walignr1 wr11, wr4, wr5 \n\t" + WAVG2B" wr11, wr11, wr3 \n\t" + "wstrd wr9, [%[block], #8] \n\t" + "add %[block], %[block], %[line_size] \n\t" + "wstrd wr10, [r5] \n\t" + "pld [%[block]] \n\t" + "pld [%[block], #32] \n\t" + "wstrd wr11, [r5, #8] \n\t" + "add r5, r5, %[line_size] \n\t" + "pld [r5] \n\t" + "pld [r5, #32] \n\t" + "bne 1b \n\t" + : [block]"+r"(block), [pixels]"+r"(pixels), [line_size]"+r"(stride), [h]"+r"(h) + : + : "memory", "r4", "r5", "r12"); +} + +void DEF(put, pixels8_x2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h) +{ + int stride = line_size; + // [wr0 wr1 wr2 wr3] for previous line + // [wr4 wr5 wr6 wr7] for current line + SET_RND(wr15); // =2 for rnd and =1 for no_rnd version + __asm__ __volatile__( + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "and r12, %[pixels], #7 \n\t" + "bic %[pixels], %[pixels], #7 \n\t" + "tmcr wcgr1, r12 \n\t" + "add r12, r12, #1 \n\t" + "add r4, %[pixels], %[line_size]\n\t" + "tmcr wcgr2, r12 \n\t" + "add r5, %[block], %[line_size] \n\t" + "mov %[line_size], %[line_size], lsl #1 \n\t" + + "1: \n\t" + "wldrd wr10, [%[pixels]] \n\t" + "cmp r12, #8 \n\t" + "wldrd wr11, [%[pixels], #8] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "wldrd wr13, [r4] \n\t" + "pld [%[pixels]] \n\t" + "wldrd wr14, [r4, #8] \n\t" + "pld [%[pixels], #32] \n\t" + "add r4, r4, %[line_size] \n\t" + "walignr1 wr0, wr10, wr11 \n\t" + "pld [r4] \n\t" + "pld [r4, #32] \n\t" + "walignr1 wr2, wr13, wr14 \n\t" + "wmoveq wr4, wr11 \n\t" + "wmoveq wr6, wr14 \n\t" + "walignr2ne wr4, wr10, wr11 \n\t" + "walignr2ne wr6, wr13, wr14 \n\t" + WAVG2B" wr0, wr0, wr4 \n\t" + WAVG2B" wr2, wr2, wr6 \n\t" + "wstrd wr0, [%[block]] \n\t" + "subs %[h], %[h], #2 \n\t" + "wstrd wr2, [r5] \n\t" + "add %[block], %[block], %[line_size] \n\t" + "add r5, r5, %[line_size] \n\t" + "bne 1b \n\t" + : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride) + : + : "r4", "r5", "r12", "memory"); +} + +void DEF(put, pixels16_x2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h) +{ + int stride = line_size; + // [wr0 wr1 wr2 wr3] for previous line + // [wr4 wr5 wr6 wr7] for current line + SET_RND(wr15); // =2 for rnd and =1 for no_rnd version + __asm__ __volatile__( + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "and r12, %[pixels], #7 \n\t" + "bic %[pixels], %[pixels], #7 \n\t" + "tmcr wcgr1, r12 \n\t" + "add r12, r12, #1 \n\t" + "add r4, %[pixels], %[line_size]\n\t" + "tmcr wcgr2, r12 \n\t" + "add r5, %[block], %[line_size] \n\t" + "mov %[line_size], %[line_size], lsl #1 \n\t" + + "1: \n\t" + "wldrd wr10, [%[pixels]] \n\t" + "cmp r12, #8 \n\t" + "wldrd wr11, [%[pixels], #8] \n\t" + "wldrd wr12, [%[pixels], #16] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "wldrd wr13, [r4] \n\t" + "pld [%[pixels]] \n\t" + "wldrd wr14, [r4, #8] \n\t" + "pld [%[pixels], #32] \n\t" + "wldrd wr15, [r4, #16] \n\t" + "add r4, r4, %[line_size] \n\t" + "walignr1 wr0, wr10, wr11 \n\t" + "pld [r4] \n\t" + "pld [r4, #32] \n\t" + "walignr1 wr1, wr11, wr12 \n\t" + "walignr1 wr2, wr13, wr14 \n\t" + "walignr1 wr3, wr14, wr15 \n\t" + "wmoveq wr4, wr11 \n\t" + "wmoveq wr5, wr12 \n\t" + "wmoveq wr6, wr14 \n\t" + "wmoveq wr7, wr15 \n\t" + "walignr2ne wr4, wr10, wr11 \n\t" + "walignr2ne wr5, wr11, wr12 \n\t" + "walignr2ne wr6, wr13, wr14 \n\t" + "walignr2ne wr7, wr14, wr15 \n\t" + WAVG2B" wr0, wr0, wr4 \n\t" + WAVG2B" wr1, wr1, wr5 \n\t" + "wstrd wr0, [%[block]] \n\t" + WAVG2B" wr2, wr2, wr6 \n\t" + "wstrd wr1, [%[block], #8] \n\t" + WAVG2B" wr3, wr3, wr7 \n\t" + "add %[block], %[block], %[line_size] \n\t" + "wstrd wr2, [r5] \n\t" + "subs %[h], %[h], #2 \n\t" + "wstrd wr3, [r5, #8] \n\t" + "add r5, r5, %[line_size] \n\t" + "bne 1b \n\t" + : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride) + : + : "r4", "r5", "r12", "memory"); +} + +void DEF(avg, pixels8_x2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h) +{ + int stride = line_size; + // [wr0 wr1 wr2 wr3] for previous line + // [wr4 wr5 wr6 wr7] for current line + SET_RND(wr15); // =2 for rnd and =1 for no_rnd version + __asm__ __volatile__( + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "pld [%[block]] \n\t" + "pld [%[block], #32] \n\t" + "and r12, %[pixels], #7 \n\t" + "bic %[pixels], %[pixels], #7 \n\t" + "tmcr wcgr1, r12 \n\t" + "add r12, r12, #1 \n\t" + "add r4, %[pixels], %[line_size]\n\t" + "tmcr wcgr2, r12 \n\t" + "add r5, %[block], %[line_size] \n\t" + "mov %[line_size], %[line_size], lsl #1 \n\t" + "pld [r5] \n\t" + "pld [r5, #32] \n\t" + + "1: \n\t" + "wldrd wr10, [%[pixels]] \n\t" + "cmp r12, #8 \n\t" + "wldrd wr11, [%[pixels], #8] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "wldrd wr13, [r4] \n\t" + "pld [%[pixels]] \n\t" + "wldrd wr14, [r4, #8] \n\t" + "pld [%[pixels], #32] \n\t" + "add r4, r4, %[line_size] \n\t" + "walignr1 wr0, wr10, wr11 \n\t" + "pld [r4] \n\t" + "pld [r4, #32] \n\t" + "walignr1 wr2, wr13, wr14 \n\t" + "wmoveq wr4, wr11 \n\t" + "wmoveq wr6, wr14 \n\t" + "walignr2ne wr4, wr10, wr11 \n\t" + "wldrd wr10, [%[block]] \n\t" + "walignr2ne wr6, wr13, wr14 \n\t" + "wldrd wr12, [r5] \n\t" + WAVG2B" wr0, wr0, wr4 \n\t" + WAVG2B" wr2, wr2, wr6 \n\t" + WAVG2B" wr0, wr0, wr10 \n\t" + WAVG2B" wr2, wr2, wr12 \n\t" + "wstrd wr0, [%[block]] \n\t" + "subs %[h], %[h], #2 \n\t" + "wstrd wr2, [r5] \n\t" + "add %[block], %[block], %[line_size] \n\t" + "add r5, r5, %[line_size] \n\t" + "pld [%[block]] \n\t" + "pld [%[block], #32] \n\t" + "pld [r5] \n\t" + "pld [r5, #32] \n\t" + "bne 1b \n\t" + : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride) + : + : "r4", "r5", "r12", "memory"); +} + +void DEF(avg, pixels16_x2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h) +{ + int stride = line_size; + // [wr0 wr1 wr2 wr3] for previous line + // [wr4 wr5 wr6 wr7] for current line + SET_RND(wr15); // =2 for rnd and =1 for no_rnd version + __asm__ __volatile__( + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "pld [%[block]] \n\t" + "pld [%[block], #32] \n\t" + "and r12, %[pixels], #7 \n\t" + "bic %[pixels], %[pixels], #7 \n\t" + "tmcr wcgr1, r12 \n\t" + "add r12, r12, #1 \n\t" + "add r4, %[pixels], %[line_size]\n\t" + "tmcr wcgr2, r12 \n\t" + "add r5, %[block], %[line_size] \n\t" + "mov %[line_size], %[line_size], lsl #1 \n\t" + "pld [r5] \n\t" + "pld [r5, #32] \n\t" + + "1: \n\t" + "wldrd wr10, [%[pixels]] \n\t" + "cmp r12, #8 \n\t" + "wldrd wr11, [%[pixels], #8] \n\t" + "wldrd wr12, [%[pixels], #16] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "wldrd wr13, [r4] \n\t" + "pld [%[pixels]] \n\t" + "wldrd wr14, [r4, #8] \n\t" + "pld [%[pixels], #32] \n\t" + "wldrd wr15, [r4, #16] \n\t" + "add r4, r4, %[line_size] \n\t" + "walignr1 wr0, wr10, wr11 \n\t" + "pld [r4] \n\t" + "pld [r4, #32] \n\t" + "walignr1 wr1, wr11, wr12 \n\t" + "walignr1 wr2, wr13, wr14 \n\t" + "walignr1 wr3, wr14, wr15 \n\t" + "wmoveq wr4, wr11 \n\t" + "wmoveq wr5, wr12 \n\t" + "wmoveq wr6, wr14 \n\t" + "wmoveq wr7, wr15 \n\t" + "walignr2ne wr4, wr10, wr11 \n\t" + "walignr2ne wr5, wr11, wr12 \n\t" + "walignr2ne wr6, wr13, wr14 \n\t" + "walignr2ne wr7, wr14, wr15 \n\t" + "wldrd wr10, [%[block]] \n\t" + WAVG2B" wr0, wr0, wr4 \n\t" + "wldrd wr11, [%[block], #8] \n\t" + WAVG2B" wr1, wr1, wr5 \n\t" + "wldrd wr12, [r5] \n\t" + WAVG2B" wr2, wr2, wr6 \n\t" + "wldrd wr13, [r5, #8] \n\t" + WAVG2B" wr3, wr3, wr7 \n\t" + WAVG2B" wr0, wr0, wr10 \n\t" + WAVG2B" wr1, wr1, wr11 \n\t" + WAVG2B" wr2, wr2, wr12 \n\t" + WAVG2B" wr3, wr3, wr13 \n\t" + "wstrd wr0, [%[block]] \n\t" + "subs %[h], %[h], #2 \n\t" + "wstrd wr1, [%[block], #8] \n\t" + "add %[block], %[block], %[line_size] \n\t" + "wstrd wr2, [r5] \n\t" + "pld [%[block]] \n\t" + "wstrd wr3, [r5, #8] \n\t" + "add r5, r5, %[line_size] \n\t" + "pld [%[block], #32] \n\t" + "pld [r5] \n\t" + "pld [r5, #32] \n\t" + "bne 1b \n\t" + : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride) + : + :"r4", "r5", "r12", "memory"); +} + +void DEF(avg, pixels8_y2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h) +{ + int stride = line_size; + // [wr0 wr1 wr2 wr3] for previous line + // [wr4 wr5 wr6 wr7] for current line + __asm__ __volatile__( + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "and r12, %[pixels], #7 \n\t" + "tmcr wcgr1, r12 \n\t" + "bic %[pixels], %[pixels], #7 \n\t" + + "wldrd wr10, [%[pixels]] \n\t" + "wldrd wr11, [%[pixels], #8] \n\t" + "pld [%[block]] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "walignr1 wr0, wr10, wr11 \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + + "1: \n\t" + "wldrd wr10, [%[pixels]] \n\t" + "wldrd wr11, [%[pixels], #8] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "walignr1 wr4, wr10, wr11 \n\t" + "wldrd wr10, [%[block]] \n\t" + WAVG2B" wr8, wr0, wr4 \n\t" + WAVG2B" wr8, wr8, wr10 \n\t" + "wstrd wr8, [%[block]] \n\t" + "add %[block], %[block], %[line_size] \n\t" + + "wldrd wr10, [%[pixels]] \n\t" + "wldrd wr11, [%[pixels], #8] \n\t" + "pld [%[block]] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "walignr1 wr0, wr10, wr11 \n\t" + "wldrd wr10, [%[block]] \n\t" + WAVG2B" wr8, wr0, wr4 \n\t" + WAVG2B" wr8, wr8, wr10 \n\t" + "wstrd wr8, [%[block]] \n\t" + "add %[block], %[block], %[line_size] \n\t" + + "subs %[h], %[h], #2 \n\t" + "pld [%[block]] \n\t" + "bne 1b \n\t" + : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride) + : + : "cc", "memory", "r12"); +} + +void DEF(put, pixels16_y2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h) +{ + int stride = line_size; + // [wr0 wr1 wr2 wr3] for previous line + // [wr4 wr5 wr6 wr7] for current line + __asm__ __volatile__( + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "and r12, %[pixels], #7 \n\t" + "tmcr wcgr1, r12 \n\t" + "bic %[pixels], %[pixels], #7 \n\t" + + "wldrd wr10, [%[pixels]] \n\t" + "wldrd wr11, [%[pixels], #8] \n\t" + "wldrd wr12, [%[pixels], #16] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "walignr1 wr0, wr10, wr11 \n\t" + "walignr1 wr1, wr11, wr12 \n\t" + + "1: \n\t" + "wldrd wr10, [%[pixels]] \n\t" + "wldrd wr11, [%[pixels], #8] \n\t" + "wldrd wr12, [%[pixels], #16] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "walignr1 wr4, wr10, wr11 \n\t" + "walignr1 wr5, wr11, wr12 \n\t" + WAVG2B" wr8, wr0, wr4 \n\t" + WAVG2B" wr9, wr1, wr5 \n\t" + "wstrd wr8, [%[block]] \n\t" + "wstrd wr9, [%[block], #8] \n\t" + "add %[block], %[block], %[line_size] \n\t" + + "wldrd wr10, [%[pixels]] \n\t" + "wldrd wr11, [%[pixels], #8] \n\t" + "wldrd wr12, [%[pixels], #16] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "walignr1 wr0, wr10, wr11 \n\t" + "walignr1 wr1, wr11, wr12 \n\t" + WAVG2B" wr8, wr0, wr4 \n\t" + WAVG2B" wr9, wr1, wr5 \n\t" + "wstrd wr8, [%[block]] \n\t" + "wstrd wr9, [%[block], #8] \n\t" + "add %[block], %[block], %[line_size] \n\t" + + "subs %[h], %[h], #2 \n\t" + "bne 1b \n\t" + : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride) + : + : "r4", "r5", "r12", "memory"); +} + +void DEF(avg, pixels16_y2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h) +{ + int stride = line_size; + // [wr0 wr1 wr2 wr3] for previous line + // [wr4 wr5 wr6 wr7] for current line + __asm__ __volatile__( + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "and r12, %[pixels], #7 \n\t" + "tmcr wcgr1, r12 \n\t" + "bic %[pixels], %[pixels], #7 \n\t" + + "wldrd wr10, [%[pixels]] \n\t" + "wldrd wr11, [%[pixels], #8] \n\t" + "pld [%[block]] \n\t" + "wldrd wr12, [%[pixels], #16] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "walignr1 wr0, wr10, wr11 \n\t" + "walignr1 wr1, wr11, wr12 \n\t" + + "1: \n\t" + "wldrd wr10, [%[pixels]] \n\t" + "wldrd wr11, [%[pixels], #8] \n\t" + "wldrd wr12, [%[pixels], #16] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "walignr1 wr4, wr10, wr11 \n\t" + "walignr1 wr5, wr11, wr12 \n\t" + "wldrd wr10, [%[block]] \n\t" + "wldrd wr11, [%[block], #8] \n\t" + WAVG2B" wr8, wr0, wr4 \n\t" + WAVG2B" wr9, wr1, wr5 \n\t" + WAVG2B" wr8, wr8, wr10 \n\t" + WAVG2B" wr9, wr9, wr11 \n\t" + "wstrd wr8, [%[block]] \n\t" + "wstrd wr9, [%[block], #8] \n\t" + "add %[block], %[block], %[line_size] \n\t" + + "wldrd wr10, [%[pixels]] \n\t" + "wldrd wr11, [%[pixels], #8] \n\t" + "pld [%[block]] \n\t" + "wldrd wr12, [%[pixels], #16] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "walignr1 wr0, wr10, wr11 \n\t" + "walignr1 wr1, wr11, wr12 \n\t" + "wldrd wr10, [%[block]] \n\t" + "wldrd wr11, [%[block], #8] \n\t" + WAVG2B" wr8, wr0, wr4 \n\t" + WAVG2B" wr9, wr1, wr5 \n\t" + WAVG2B" wr8, wr8, wr10 \n\t" + WAVG2B" wr9, wr9, wr11 \n\t" + "wstrd wr8, [%[block]] \n\t" + "wstrd wr9, [%[block], #8] \n\t" + "add %[block], %[block], %[line_size] \n\t" + + "subs %[h], %[h], #2 \n\t" + "pld [%[block]] \n\t" + "bne 1b \n\t" + : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride) + : + : "r4", "r5", "r12", "memory"); +} + +void DEF(put, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h) +{ + // [wr0 wr1 wr2 wr3] for previous line + // [wr4 wr5 wr6 wr7] for current line + SET_RND(wr15); // =2 for rnd and =1 for no_rnd version + __asm__ __volatile__( + "pld [%[pixels]] \n\t" + "mov r12, #2 \n\t" + "pld [%[pixels], #32] \n\t" + "tmcr wcgr0, r12 \n\t" /* for shift value */ + "and r12, %[pixels], #7 \n\t" + "bic %[pixels], %[pixels], #7 \n\t" + "tmcr wcgr1, r12 \n\t" + + // [wr0 wr1 wr2 wr3] <= * + // [wr4 wr5 wr6 wr7] + "wldrd wr12, [%[pixels]] \n\t" + "add r12, r12, #1 \n\t" + "wldrd wr13, [%[pixels], #8] \n\t" + "tmcr wcgr2, r12 \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "cmp r12, #8 \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "walignr1 wr2, wr12, wr13 \n\t" + "wmoveq wr10, wr13 \n\t" + "walignr2ne wr10, wr12, wr13 \n\t" + "wunpckelub wr0, wr2 \n\t" + "wunpckehub wr1, wr2 \n\t" + "wunpckelub wr8, wr10 \n\t" + "wunpckehub wr9, wr10 \n\t" + "waddhus wr0, wr0, wr8 \n\t" + "waddhus wr1, wr1, wr9 \n\t" + + "1: \n\t" + // [wr0 wr1 wr2 wr3] + // [wr4 wr5 wr6 wr7] <= * + "wldrd wr12, [%[pixels]] \n\t" + "cmp r12, #8 \n\t" + "wldrd wr13, [%[pixels], #8] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "walignr1 wr6, wr12, wr13 \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "wmoveq wr10, wr13 \n\t" + "walignr2ne wr10, wr12, wr13 \n\t" + "wunpckelub wr4, wr6 \n\t" + "wunpckehub wr5, wr6 \n\t" + "wunpckelub wr8, wr10 \n\t" + "wunpckehub wr9, wr10 \n\t" + "waddhus wr4, wr4, wr8 \n\t" + "waddhus wr5, wr5, wr9 \n\t" + "waddhus wr8, wr0, wr4 \n\t" + "waddhus wr9, wr1, wr5 \n\t" + "waddhus wr8, wr8, wr15 \n\t" + "waddhus wr9, wr9, wr15 \n\t" + "wsrlhg wr8, wr8, wcgr0 \n\t" + "wsrlhg wr9, wr9, wcgr0 \n\t" + "wpackhus wr8, wr8, wr9 \n\t" + "wstrd wr8, [%[block]] \n\t" + "add %[block], %[block], %[line_size] \n\t" + + // [wr0 wr1 wr2 wr3] <= * + // [wr4 wr5 wr6 wr7] + "wldrd wr12, [%[pixels]] \n\t" + "wldrd wr13, [%[pixels], #8] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "walignr1 wr2, wr12, wr13 \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "wmoveq wr10, wr13 \n\t" + "walignr2ne wr10, wr12, wr13 \n\t" + "wunpckelub wr0, wr2 \n\t" + "wunpckehub wr1, wr2 \n\t" + "wunpckelub wr8, wr10 \n\t" + "wunpckehub wr9, wr10 \n\t" + "waddhus wr0, wr0, wr8 \n\t" + "waddhus wr1, wr1, wr9 \n\t" + "waddhus wr8, wr0, wr4 \n\t" + "waddhus wr9, wr1, wr5 \n\t" + "waddhus wr8, wr8, wr15 \n\t" + "waddhus wr9, wr9, wr15 \n\t" + "wsrlhg wr8, wr8, wcgr0 \n\t" + "wsrlhg wr9, wr9, wcgr0 \n\t" + "wpackhus wr8, wr8, wr9 \n\t" + "subs %[h], %[h], #2 \n\t" + "wstrd wr8, [%[block]] \n\t" + "add %[block], %[block], %[line_size] \n\t" + "bne 1b \n\t" + : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block) + : [line_size]"r"(line_size) + : "r12", "memory"); +} + +void DEF(put, pixels16_xy2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h) +{ + // [wr0 wr1 wr2 wr3] for previous line + // [wr4 wr5 wr6 wr7] for current line + SET_RND(wr15); // =2 for rnd and =1 for no_rnd version + __asm__ __volatile__( + "pld [%[pixels]] \n\t" + "mov r12, #2 \n\t" + "pld [%[pixels], #32] \n\t" + "tmcr wcgr0, r12 \n\t" /* for shift value */ + /* alignment */ + "and r12, %[pixels], #7 \n\t" + "bic %[pixels], %[pixels], #7 \n\t" + "tmcr wcgr1, r12 \n\t" + "add r12, r12, #1 \n\t" + "tmcr wcgr2, r12 \n\t" + + // [wr0 wr1 wr2 wr3] <= * + // [wr4 wr5 wr6 wr7] + "wldrd wr12, [%[pixels]] \n\t" + "cmp r12, #8 \n\t" + "wldrd wr13, [%[pixels], #8] \n\t" + "wldrd wr14, [%[pixels], #16] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "pld [%[pixels]] \n\t" + "walignr1 wr2, wr12, wr13 \n\t" + "pld [%[pixels], #32] \n\t" + "walignr1 wr3, wr13, wr14 \n\t" + "wmoveq wr10, wr13 \n\t" + "wmoveq wr11, wr14 \n\t" + "walignr2ne wr10, wr12, wr13 \n\t" + "walignr2ne wr11, wr13, wr14 \n\t" + "wunpckelub wr0, wr2 \n\t" + "wunpckehub wr1, wr2 \n\t" + "wunpckelub wr2, wr3 \n\t" + "wunpckehub wr3, wr3 \n\t" + "wunpckelub wr8, wr10 \n\t" + "wunpckehub wr9, wr10 \n\t" + "wunpckelub wr10, wr11 \n\t" + "wunpckehub wr11, wr11 \n\t" + "waddhus wr0, wr0, wr8 \n\t" + "waddhus wr1, wr1, wr9 \n\t" + "waddhus wr2, wr2, wr10 \n\t" + "waddhus wr3, wr3, wr11 \n\t" + + "1: \n\t" + // [wr0 wr1 wr2 wr3] + // [wr4 wr5 wr6 wr7] <= * + "wldrd wr12, [%[pixels]] \n\t" + "cmp r12, #8 \n\t" + "wldrd wr13, [%[pixels], #8] \n\t" + "wldrd wr14, [%[pixels], #16] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "walignr1 wr6, wr12, wr13 \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "walignr1 wr7, wr13, wr14 \n\t" + "wmoveq wr10, wr13 \n\t" + "wmoveq wr11, wr14 \n\t" + "walignr2ne wr10, wr12, wr13 \n\t" + "walignr2ne wr11, wr13, wr14 \n\t" + "wunpckelub wr4, wr6 \n\t" + "wunpckehub wr5, wr6 \n\t" + "wunpckelub wr6, wr7 \n\t" + "wunpckehub wr7, wr7 \n\t" + "wunpckelub wr8, wr10 \n\t" + "wunpckehub wr9, wr10 \n\t" + "wunpckelub wr10, wr11 \n\t" + "wunpckehub wr11, wr11 \n\t" + "waddhus wr4, wr4, wr8 \n\t" + "waddhus wr5, wr5, wr9 \n\t" + "waddhus wr6, wr6, wr10 \n\t" + "waddhus wr7, wr7, wr11 \n\t" + "waddhus wr8, wr0, wr4 \n\t" + "waddhus wr9, wr1, wr5 \n\t" + "waddhus wr10, wr2, wr6 \n\t" + "waddhus wr11, wr3, wr7 \n\t" + "waddhus wr8, wr8, wr15 \n\t" + "waddhus wr9, wr9, wr15 \n\t" + "waddhus wr10, wr10, wr15 \n\t" + "waddhus wr11, wr11, wr15 \n\t" + "wsrlhg wr8, wr8, wcgr0 \n\t" + "wsrlhg wr9, wr9, wcgr0 \n\t" + "wsrlhg wr10, wr10, wcgr0 \n\t" + "wsrlhg wr11, wr11, wcgr0 \n\t" + "wpackhus wr8, wr8, wr9 \n\t" + "wpackhus wr9, wr10, wr11 \n\t" + "wstrd wr8, [%[block]] \n\t" + "wstrd wr9, [%[block], #8] \n\t" + "add %[block], %[block], %[line_size] \n\t" + + // [wr0 wr1 wr2 wr3] <= * + // [wr4 wr5 wr6 wr7] + "wldrd wr12, [%[pixels]] \n\t" + "wldrd wr13, [%[pixels], #8] \n\t" + "wldrd wr14, [%[pixels], #16] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "walignr1 wr2, wr12, wr13 \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "walignr1 wr3, wr13, wr14 \n\t" + "wmoveq wr10, wr13 \n\t" + "wmoveq wr11, wr14 \n\t" + "walignr2ne wr10, wr12, wr13 \n\t" + "walignr2ne wr11, wr13, wr14 \n\t" + "wunpckelub wr0, wr2 \n\t" + "wunpckehub wr1, wr2 \n\t" + "wunpckelub wr2, wr3 \n\t" + "wunpckehub wr3, wr3 \n\t" + "wunpckelub wr8, wr10 \n\t" + "wunpckehub wr9, wr10 \n\t" + "wunpckelub wr10, wr11 \n\t" + "wunpckehub wr11, wr11 \n\t" + "waddhus wr0, wr0, wr8 \n\t" + "waddhus wr1, wr1, wr9 \n\t" + "waddhus wr2, wr2, wr10 \n\t" + "waddhus wr3, wr3, wr11 \n\t" + "waddhus wr8, wr0, wr4 \n\t" + "waddhus wr9, wr1, wr5 \n\t" + "waddhus wr10, wr2, wr6 \n\t" + "waddhus wr11, wr3, wr7 \n\t" + "waddhus wr8, wr8, wr15 \n\t" + "waddhus wr9, wr9, wr15 \n\t" + "waddhus wr10, wr10, wr15 \n\t" + "waddhus wr11, wr11, wr15 \n\t" + "wsrlhg wr8, wr8, wcgr0 \n\t" + "wsrlhg wr9, wr9, wcgr0 \n\t" + "wsrlhg wr10, wr10, wcgr0 \n\t" + "wsrlhg wr11, wr11, wcgr0 \n\t" + "wpackhus wr8, wr8, wr9 \n\t" + "wpackhus wr9, wr10, wr11 \n\t" + "wstrd wr8, [%[block]] \n\t" + "wstrd wr9, [%[block], #8] \n\t" + "add %[block], %[block], %[line_size] \n\t" + + "subs %[h], %[h], #2 \n\t" + "bne 1b \n\t" + : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block) + : [line_size]"r"(line_size) + : "r12", "memory"); +} + +void DEF(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h) +{ + // [wr0 wr1 wr2 wr3] for previous line + // [wr4 wr5 wr6 wr7] for current line + SET_RND(wr15); // =2 for rnd and =1 for no_rnd version + __asm__ __volatile__( + "pld [%[block]] \n\t" + "pld [%[block], #32] \n\t" + "pld [%[pixels]] \n\t" + "mov r12, #2 \n\t" + "pld [%[pixels], #32] \n\t" + "tmcr wcgr0, r12 \n\t" /* for shift value */ + "and r12, %[pixels], #7 \n\t" + "bic %[pixels], %[pixels], #7 \n\t" + "tmcr wcgr1, r12 \n\t" + + // [wr0 wr1 wr2 wr3] <= * + // [wr4 wr5 wr6 wr7] + "wldrd wr12, [%[pixels]] \n\t" + "add r12, r12, #1 \n\t" + "wldrd wr13, [%[pixels], #8] \n\t" + "tmcr wcgr2, r12 \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "cmp r12, #8 \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "walignr1 wr2, wr12, wr13 \n\t" + "wmoveq wr10, wr13 \n\t" + "walignr2ne wr10, wr12, wr13 \n\t" + "wunpckelub wr0, wr2 \n\t" + "wunpckehub wr1, wr2 \n\t" + "wunpckelub wr8, wr10 \n\t" + "wunpckehub wr9, wr10 \n\t" + "waddhus wr0, wr0, wr8 \n\t" + "waddhus wr1, wr1, wr9 \n\t" + + "1: \n\t" + // [wr0 wr1 wr2 wr3] + // [wr4 wr5 wr6 wr7] <= * + "wldrd wr12, [%[pixels]] \n\t" + "cmp r12, #8 \n\t" + "wldrd wr13, [%[pixels], #8] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "walignr1 wr6, wr12, wr13 \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "wmoveq wr10, wr13 \n\t" + "walignr2ne wr10, wr12, wr13 \n\t" + "wunpckelub wr4, wr6 \n\t" + "wunpckehub wr5, wr6 \n\t" + "wunpckelub wr8, wr10 \n\t" + "wunpckehub wr9, wr10 \n\t" + "waddhus wr4, wr4, wr8 \n\t" + "waddhus wr5, wr5, wr9 \n\t" + "waddhus wr8, wr0, wr4 \n\t" + "waddhus wr9, wr1, wr5 \n\t" + "waddhus wr8, wr8, wr15 \n\t" + "waddhus wr9, wr9, wr15 \n\t" + "wldrd wr12, [%[block]] \n\t" + "wsrlhg wr8, wr8, wcgr0 \n\t" + "wsrlhg wr9, wr9, wcgr0 \n\t" + "wpackhus wr8, wr8, wr9 \n\t" + WAVG2B" wr8, wr8, wr12 \n\t" + "wstrd wr8, [%[block]] \n\t" + "add %[block], %[block], %[line_size] \n\t" + "wldrd wr12, [%[pixels]] \n\t" + "pld [%[block]] \n\t" + "pld [%[block], #32] \n\t" + + // [wr0 wr1 wr2 wr3] <= * + // [wr4 wr5 wr6 wr7] + "wldrd wr13, [%[pixels], #8] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "walignr1 wr2, wr12, wr13 \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "wmoveq wr10, wr13 \n\t" + "walignr2ne wr10, wr12, wr13 \n\t" + "wunpckelub wr0, wr2 \n\t" + "wunpckehub wr1, wr2 \n\t" + "wunpckelub wr8, wr10 \n\t" + "wunpckehub wr9, wr10 \n\t" + "waddhus wr0, wr0, wr8 \n\t" + "waddhus wr1, wr1, wr9 \n\t" + "waddhus wr8, wr0, wr4 \n\t" + "waddhus wr9, wr1, wr5 \n\t" + "waddhus wr8, wr8, wr15 \n\t" + "waddhus wr9, wr9, wr15 \n\t" + "wldrd wr12, [%[block]] \n\t" + "wsrlhg wr8, wr8, wcgr0 \n\t" + "wsrlhg wr9, wr9, wcgr0 \n\t" + "wpackhus wr8, wr8, wr9 \n\t" + "subs %[h], %[h], #2 \n\t" + WAVG2B" wr8, wr8, wr12 \n\t" + "wstrd wr8, [%[block]] \n\t" + "add %[block], %[block], %[line_size] \n\t" + "pld [%[block]] \n\t" + "pld [%[block], #32] \n\t" + "bne 1b \n\t" + : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block) + : [line_size]"r"(line_size) + : "r12", "memory"); +} + +void DEF(avg, pixels16_xy2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h) +{ + // [wr0 wr1 wr2 wr3] for previous line + // [wr4 wr5 wr6 wr7] for current line + SET_RND(wr15); // =2 for rnd and =1 for no_rnd version + __asm__ __volatile__( + "pld [%[block]] \n\t" + "pld [%[block], #32] \n\t" + "pld [%[pixels]] \n\t" + "mov r12, #2 \n\t" + "pld [%[pixels], #32] \n\t" + "tmcr wcgr0, r12 \n\t" /* for shift value */ + /* alignment */ + "and r12, %[pixels], #7 \n\t" + "bic %[pixels], %[pixels], #7 \n\t" + "tmcr wcgr1, r12 \n\t" + "add r12, r12, #1 \n\t" + "tmcr wcgr2, r12 \n\t" + + // [wr0 wr1 wr2 wr3] <= * + // [wr4 wr5 wr6 wr7] + "wldrd wr12, [%[pixels]] \n\t" + "cmp r12, #8 \n\t" + "wldrd wr13, [%[pixels], #8] \n\t" + "wldrd wr14, [%[pixels], #16] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "pld [%[pixels]] \n\t" + "walignr1 wr2, wr12, wr13 \n\t" + "pld [%[pixels], #32] \n\t" + "walignr1 wr3, wr13, wr14 \n\t" + "wmoveq wr10, wr13 \n\t" + "wmoveq wr11, wr14 \n\t" + "walignr2ne wr10, wr12, wr13 \n\t" + "walignr2ne wr11, wr13, wr14 \n\t" + "wunpckelub wr0, wr2 \n\t" + "wunpckehub wr1, wr2 \n\t" + "wunpckelub wr2, wr3 \n\t" + "wunpckehub wr3, wr3 \n\t" + "wunpckelub wr8, wr10 \n\t" + "wunpckehub wr9, wr10 \n\t" + "wunpckelub wr10, wr11 \n\t" + "wunpckehub wr11, wr11 \n\t" + "waddhus wr0, wr0, wr8 \n\t" + "waddhus wr1, wr1, wr9 \n\t" + "waddhus wr2, wr2, wr10 \n\t" + "waddhus wr3, wr3, wr11 \n\t" + + "1: \n\t" + // [wr0 wr1 wr2 wr3] + // [wr4 wr5 wr6 wr7] <= * + "wldrd wr12, [%[pixels]] \n\t" + "cmp r12, #8 \n\t" + "wldrd wr13, [%[pixels], #8] \n\t" + "wldrd wr14, [%[pixels], #16] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "walignr1 wr6, wr12, wr13 \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "walignr1 wr7, wr13, wr14 \n\t" + "wmoveq wr10, wr13 \n\t" + "wmoveq wr11, wr14 \n\t" + "walignr2ne wr10, wr12, wr13 \n\t" + "walignr2ne wr11, wr13, wr14 \n\t" + "wunpckelub wr4, wr6 \n\t" + "wunpckehub wr5, wr6 \n\t" + "wunpckelub wr6, wr7 \n\t" + "wunpckehub wr7, wr7 \n\t" + "wunpckelub wr8, wr10 \n\t" + "wunpckehub wr9, wr10 \n\t" + "wunpckelub wr10, wr11 \n\t" + "wunpckehub wr11, wr11 \n\t" + "waddhus wr4, wr4, wr8 \n\t" + "waddhus wr5, wr5, wr9 \n\t" + "waddhus wr6, wr6, wr10 \n\t" + "waddhus wr7, wr7, wr11 \n\t" + "waddhus wr8, wr0, wr4 \n\t" + "waddhus wr9, wr1, wr5 \n\t" + "waddhus wr10, wr2, wr6 \n\t" + "waddhus wr11, wr3, wr7 \n\t" + "waddhus wr8, wr8, wr15 \n\t" + "waddhus wr9, wr9, wr15 \n\t" + "waddhus wr10, wr10, wr15 \n\t" + "waddhus wr11, wr11, wr15 \n\t" + "wsrlhg wr8, wr8, wcgr0 \n\t" + "wsrlhg wr9, wr9, wcgr0 \n\t" + "wldrd wr12, [%[block]] \n\t" + "wldrd wr13, [%[block], #8] \n\t" + "wsrlhg wr10, wr10, wcgr0 \n\t" + "wsrlhg wr11, wr11, wcgr0 \n\t" + "wpackhus wr8, wr8, wr9 \n\t" + "wpackhus wr9, wr10, wr11 \n\t" + WAVG2B" wr8, wr8, wr12 \n\t" + WAVG2B" wr9, wr9, wr13 \n\t" + "wstrd wr8, [%[block]] \n\t" + "wstrd wr9, [%[block], #8] \n\t" + "add %[block], %[block], %[line_size] \n\t" + + // [wr0 wr1 wr2 wr3] <= * + // [wr4 wr5 wr6 wr7] + "wldrd wr12, [%[pixels]] \n\t" + "pld [%[block]] \n\t" + "wldrd wr13, [%[pixels], #8] \n\t" + "pld [%[block], #32] \n\t" + "wldrd wr14, [%[pixels], #16] \n\t" + "add %[pixels], %[pixels], %[line_size] \n\t" + "walignr1 wr2, wr12, wr13 \n\t" + "pld [%[pixels]] \n\t" + "pld [%[pixels], #32] \n\t" + "walignr1 wr3, wr13, wr14 \n\t" + "wmoveq wr10, wr13 \n\t" + "wmoveq wr11, wr14 \n\t" + "walignr2ne wr10, wr12, wr13 \n\t" + "walignr2ne wr11, wr13, wr14 \n\t" + "wunpckelub wr0, wr2 \n\t" + "wunpckehub wr1, wr2 \n\t" + "wunpckelub wr2, wr3 \n\t" + "wunpckehub wr3, wr3 \n\t" + "wunpckelub wr8, wr10 \n\t" + "wunpckehub wr9, wr10 \n\t" + "wunpckelub wr10, wr11 \n\t" + "wunpckehub wr11, wr11 \n\t" + "waddhus wr0, wr0, wr8 \n\t" + "waddhus wr1, wr1, wr9 \n\t" + "waddhus wr2, wr2, wr10 \n\t" + "waddhus wr3, wr3, wr11 \n\t" + "waddhus wr8, wr0, wr4 \n\t" + "waddhus wr9, wr1, wr5 \n\t" + "waddhus wr10, wr2, wr6 \n\t" + "waddhus wr11, wr3, wr7 \n\t" + "waddhus wr8, wr8, wr15 \n\t" + "waddhus wr9, wr9, wr15 \n\t" + "waddhus wr10, wr10, wr15 \n\t" + "waddhus wr11, wr11, wr15 \n\t" + "wsrlhg wr8, wr8, wcgr0 \n\t" + "wsrlhg wr9, wr9, wcgr0 \n\t" + "wldrd wr12, [%[block]] \n\t" + "wldrd wr13, [%[block], #8] \n\t" + "wsrlhg wr10, wr10, wcgr0 \n\t" + "wsrlhg wr11, wr11, wcgr0 \n\t" + "wpackhus wr8, wr8, wr9 \n\t" + "wpackhus wr9, wr10, wr11 \n\t" + WAVG2B" wr8, wr8, wr12 \n\t" + WAVG2B" wr9, wr9, wr13 \n\t" + "wstrd wr8, [%[block]] \n\t" + "wstrd wr9, [%[block], #8] \n\t" + "add %[block], %[block], %[line_size] \n\t" + "subs %[h], %[h], #2 \n\t" + "pld [%[block]] \n\t" + "pld [%[block], #32] \n\t" + "bne 1b \n\t" + : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block) + : [line_size]"r"(line_size) + : "r12", "memory"); +} diff --git a/src/libffmpeg/libavcodec/armv4l/mathops.h b/src/libffmpeg/libavcodec/armv4l/mathops.h new file mode 100644 index 000000000..7ddd0ec6e --- /dev/null +++ b/src/libffmpeg/libavcodec/armv4l/mathops.h @@ -0,0 +1,49 @@ +/* + * simple math operations + * Copyright (c) 2006 Michael Niedermayer et al + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifdef FRAC_BITS +# define MULL(a, b) \ + ({ int lo, hi;\ + asm("smull %0, %1, %2, %3 \n\t"\ + "mov %0, %0, lsr %4\n\t"\ + "add %1, %0, %1, lsl %5\n\t"\ + : "=&r"(lo), "=&r"(hi)\ + : "r"(b), "r"(a), "i"(FRAC_BITS), "i"(32-FRAC_BITS));\ + hi; }) +#endif + +#define MULH(a, b) \ + ({ int lo, hi;\ + asm ("smull %0, %1, %2, %3" : "=&r"(lo), "=&r"(hi) : "r"(b), "r"(a));\ + hi; }) + +#if defined(HAVE_ARMV5TE) + +/* signed 16x16 -> 32 multiply add accumulate */ +# define MAC16(rt, ra, rb) \ + asm ("smlabb %0, %2, %3, %0" : "=r" (rt) : "0" (rt), "r" (ra), "r" (rb)); +/* signed 16x16 -> 32 multiply */ +# define MUL16(ra, rb) \ + ({ int __rt; \ + asm ("smulbb %0, %1, %2" : "=r" (__rt) : "r" (ra), "r" (rb)); \ + __rt; }) + +#endif diff --git a/src/libffmpeg/libavcodec/armv4l/mpegvideo_armv5te.c b/src/libffmpeg/libavcodec/armv4l/mpegvideo_armv5te.c new file mode 100644 index 000000000..a8d09b8ce --- /dev/null +++ b/src/libffmpeg/libavcodec/armv4l/mpegvideo_armv5te.c @@ -0,0 +1,213 @@ +/* + * Optimization of some functions from mpegvideo.c for armv5te + * Copyright (c) 2007 Siarhei Siamashka + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * Some useful links for those who may be interested in optimizing code for ARM. + * ARM Architecture Reference Manual: http://www.arm.com/community/academy/resources.html + * Instructions timings and optimization guide for ARM9E: http://www.arm.com/pdfs/DDI0222B_9EJS_r1p2.pdf + */ + +#include "../dsputil.h" +#include "../mpegvideo.h" +#include "../avcodec.h" + + +#ifdef ENABLE_ARM_TESTS +/** + * h263 dequantizer supplementary function, it is performance critical and needs to + * have optimized implementations for each architecture. Is also used as a reference + * implementation in regression tests + */ +static inline void dct_unquantize_h263_helper_c(DCTELEM *block, int qmul, int qadd, int count) +{ + int i, level; + for (i = 0; i < count; i++) { + level = block[i]; + if (level) { + if (level < 0) { + level = level * qmul - qadd; + } else { + level = level * qmul + qadd; + } + block[i] = level; + } + } +} +#endif + +/* GCC 3.1 or higher is required to support symbolic names in assembly code */ +#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)) + +/** + * Special optimized version of dct_unquantize_h263_helper_c, it requires the block + * to be at least 8 bytes aligned, and may process more elements than requested. + * But it is guaranteed to never process more than 64 elements provided that + * xxcount argument is <= 64, so it is safe. This macro is optimized for a common + * distribution of values for nCoeffs (they are mostly multiple of 8 plus one or + * two extra elements). So this macro processes data as 8 elements per loop iteration + * and contains optional 2 elements processing in the end. + * + * Inner loop should take 6 cycles per element on arm926ej-s (Nokia 770) + */ +#define dct_unquantize_h263_special_helper_armv5te(xxblock, xxqmul, xxqadd, xxcount) \ +({ DCTELEM *xblock = xxblock; \ + int xqmul = xxqmul, xqadd = xxqadd, xcount = xxcount, xtmp; \ + int xdata1, xdata2; \ +__asm__ __volatile__( \ + "subs %[count], #2 \n\t" \ + "ble 2f \n\t" \ + "ldrd r4, [%[block], #0] \n\t" \ + "1: \n\t" \ + "ldrd r6, [%[block], #8] \n\t" \ +\ + "rsbs %[data1], %[zero], r4, asr #16 \n\t" \ + "addgt %[data1], %[qadd], #0 \n\t" \ + "rsblt %[data1], %[qadd], #0 \n\t" \ + "smlatbne %[data1], r4, %[qmul], %[data1] \n\t" \ +\ + "rsbs %[data2], %[zero], r5, asr #16 \n\t" \ + "addgt %[data2], %[qadd], #0 \n\t" \ + "rsblt %[data2], %[qadd], #0 \n\t" \ + "smlatbne %[data2], r5, %[qmul], %[data2] \n\t" \ +\ + "rsbs %[tmp], %[zero], r4, asl #16 \n\t" \ + "addgt %[tmp], %[qadd], #0 \n\t" \ + "rsblt %[tmp], %[qadd], #0 \n\t" \ + "smlabbne r4, r4, %[qmul], %[tmp] \n\t" \ +\ + "rsbs %[tmp], %[zero], r5, asl #16 \n\t" \ + "addgt %[tmp], %[qadd], #0 \n\t" \ + "rsblt %[tmp], %[qadd], #0 \n\t" \ + "smlabbne r5, r5, %[qmul], %[tmp] \n\t" \ +\ + "strh r4, [%[block]], #2 \n\t" \ + "strh %[data1], [%[block]], #2 \n\t" \ + "strh r5, [%[block]], #2 \n\t" \ + "strh %[data2], [%[block]], #2 \n\t" \ +\ + "rsbs %[data1], %[zero], r6, asr #16 \n\t" \ + "addgt %[data1], %[qadd], #0 \n\t" \ + "rsblt %[data1], %[qadd], #0 \n\t" \ + "smlatbne %[data1], r6, %[qmul], %[data1] \n\t" \ +\ + "rsbs %[data2], %[zero], r7, asr #16 \n\t" \ + "addgt %[data2], %[qadd], #0 \n\t" \ + "rsblt %[data2], %[qadd], #0 \n\t" \ + "smlatbne %[data2], r7, %[qmul], %[data2] \n\t" \ +\ + "rsbs %[tmp], %[zero], r6, asl #16 \n\t" \ + "addgt %[tmp], %[qadd], #0 \n\t" \ + "rsblt %[tmp], %[qadd], #0 \n\t" \ + "smlabbne r6, r6, %[qmul], %[tmp] \n\t" \ +\ + "rsbs %[tmp], %[zero], r7, asl #16 \n\t" \ + "addgt %[tmp], %[qadd], #0 \n\t" \ + "rsblt %[tmp], %[qadd], #0 \n\t" \ + "smlabbne r7, r7, %[qmul], %[tmp] \n\t" \ +\ + "strh r6, [%[block]], #2 \n\t" \ + "strh %[data1], [%[block]], #2 \n\t" \ + "strh r7, [%[block]], #2 \n\t" \ + "strh %[data2], [%[block]], #2 \n\t" \ +\ + "subs %[count], #8 \n\t" \ + "ldrgtd r4, [%[block], #0] \n\t" /* load data early to avoid load/use pipeline stall */ \ + "bgt 1b \n\t" \ +\ + "adds %[count], #2 \n\t" \ + "ble 3f \n\t" \ + "2: \n\t" \ + "ldrsh %[data1], [%[block], #0] \n\t" \ + "ldrsh %[data2], [%[block], #2] \n\t" \ + "mov %[tmp], %[qadd] \n\t" \ + "cmp %[data1], #0 \n\t" \ + "rsblt %[tmp], %[qadd], #0 \n\t" \ + "smlabbne %[data1], %[data1], %[qmul], %[tmp] \n\t" \ + "mov %[tmp], %[qadd] \n\t" \ + "cmp %[data2], #0 \n\t" \ + "rsblt %[tmp], %[qadd], #0 \n\t" \ + "smlabbne %[data2], %[data2], %[qmul], %[tmp] \n\t" \ + "strh %[data1], [%[block]], #2 \n\t" \ + "strh %[data2], [%[block]], #2 \n\t" \ + "3: \n\t" \ + : [block] "+&r" (xblock), [count] "+&r" (xcount), [tmp] "=&r" (xtmp), \ + [data1] "=&r" (xdata1), [data2] "=&r" (xdata2) \ + : [qmul] "r" (xqmul), [qadd] "r" (xqadd), [zero] "r" (0) \ + : "r4", "r5", "r6", "r7", "cc", "memory" \ +); \ +}) + +static void dct_unquantize_h263_intra_armv5te(MpegEncContext *s, + DCTELEM *block, int n, int qscale) +{ + int i, level, qmul, qadd; + int nCoeffs; + + assert(s->block_last_index[n]>=0); + + qmul = qscale << 1; + + if (!s->h263_aic) { + if (n < 4) + level = block[0] * s->y_dc_scale; + else + level = block[0] * s->c_dc_scale; + qadd = (qscale - 1) | 1; + }else{ + qadd = 0; + level = block[0]; + } + if(s->ac_pred) + nCoeffs=63; + else + nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; + + dct_unquantize_h263_special_helper_armv5te(block, qmul, qadd, nCoeffs + 1); + block[0] = level; +} + +static void dct_unquantize_h263_inter_armv5te(MpegEncContext *s, + DCTELEM *block, int n, int qscale) +{ + int i, level, qmul, qadd; + int nCoeffs; + + assert(s->block_last_index[n]>=0); + + qadd = (qscale - 1) | 1; + qmul = qscale << 1; + + nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; + + dct_unquantize_h263_special_helper_armv5te(block, qmul, qadd, nCoeffs + 1); +} + +#define HAVE_DCT_UNQUANTIZE_H263_ARMV5TE_OPTIMIZED + +#endif + +void MPV_common_init_armv5te(MpegEncContext *s) +{ +#ifdef HAVE_DCT_UNQUANTIZE_H263_ARMV5TE_OPTIMIZED + s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_armv5te; + s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_armv5te; +#endif +} diff --git a/src/libffmpeg/libavcodec/armv4l/mpegvideo_iwmmxt.c b/src/libffmpeg/libavcodec/armv4l/mpegvideo_iwmmxt.c new file mode 100644 index 000000000..1336ac5f8 --- /dev/null +++ b/src/libffmpeg/libavcodec/armv4l/mpegvideo_iwmmxt.c @@ -0,0 +1,119 @@ +/* + * copyright (c) 2004 AGAWA Koji + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "../dsputil.h" +#include "../mpegvideo.h" +#include "../avcodec.h" + +static void dct_unquantize_h263_intra_iwmmxt(MpegEncContext *s, + DCTELEM *block, int n, int qscale) +{ + int level, qmul, qadd; + int nCoeffs; + DCTELEM *block_orig = block; + + assert(s->block_last_index[n]>=0); + + qmul = qscale << 1; + + if (!s->h263_aic) { + if (n < 4) + level = block[0] * s->y_dc_scale; + else + level = block[0] * s->c_dc_scale; + qadd = (qscale - 1) | 1; + }else{ + qadd = 0; + level = block[0]; + } + if(s->ac_pred) + nCoeffs=63; + else + nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; + + __asm__ __volatile__ ( +/* "movd %1, %%mm6 \n\t" //qmul */ +/* "packssdw %%mm6, %%mm6 \n\t" */ +/* "packssdw %%mm6, %%mm6 \n\t" */ + "tbcsth wr6, %[qmul] \n\t" +/* "movd %2, %%mm5 \n\t" //qadd */ +/* "packssdw %%mm5, %%mm5 \n\t" */ +/* "packssdw %%mm5, %%mm5 \n\t" */ + "tbcsth wr5, %[qadd] \n\t" + "wzero wr7 \n\t" /* "pxor %%mm7, %%mm7 \n\t" */ + "wzero wr4 \n\t" /* "pxor %%mm4, %%mm4 \n\t" */ + "wsubh wr7, wr5, wr7 \n\t" /* "psubw %%mm5, %%mm7 \n\t" */ + "1: \n\t" + "wldrd wr2, [%[block]] \n\t" /* "movq (%0, %3), %%mm0 \n\t" */ + "wldrd wr3, [%[block], #8] \n\t" /* "movq 8(%0, %3), %%mm1 \n\t" */ + "wmulsl wr0, wr6, wr2 \n\t" /* "pmullw %%mm6, %%mm0 \n\t" */ + "wmulsl wr1, wr6, wr3 \n\t" /* "pmullw %%mm6, %%mm1 \n\t" */ +/* "movq (%0, %3), %%mm2 \n\t" */ +/* "movq 8(%0, %3), %%mm3 \n\t" */ + "wcmpgtsh wr2, wr4, wr2 \n\t" /* "pcmpgtw %%mm4, %%mm2 \n\t" // block[i] < 0 ? -1 : 0 */ + "wcmpgtsh wr3, wr4, wr2 \n\t" /* "pcmpgtw %%mm4, %%mm3 \n\t" // block[i] < 0 ? -1 : 0 */ + "wxor wr0, wr2, wr0 \n\t" /* "pxor %%mm2, %%mm0 \n\t" */ + "wxor wr1, wr3, wr1 \n\t" /* "pxor %%mm3, %%mm1 \n\t" */ + "waddh wr0, wr7, wr0 \n\t" /* "paddw %%mm7, %%mm0 \n\t" */ + "waddh wr1, wr7, wr1 \n\t" /* "paddw %%mm7, %%mm1 \n\t" */ + "wxor wr2, wr0, wr2 \n\t" /* "pxor %%mm0, %%mm2 \n\t" */ + "wxor wr3, wr1, wr3 \n\t" /* "pxor %%mm1, %%mm3 \n\t" */ + "wcmpeqh wr0, wr7, wr0 \n\t" /* "pcmpeqw %%mm7, %%mm0 \n\t" // block[i] == 0 ? -1 : 0 */ + "wcmpeqh wr1, wr7, wr1 \n\t" /* "pcmpeqw %%mm7, %%mm1 \n\t" // block[i] == 0 ? -1 : 0 */ + "wandn wr0, wr2, wr0 \n\t" /* "pandn %%mm2, %%mm0 \n\t" */ + "wandn wr1, wr3, wr1 \n\t" /* "pandn %%mm3, %%mm1 \n\t" */ + "wstrd wr0, [%[block]] \n\t" /* "movq %%mm0, (%0, %3) \n\t" */ + "wstrd wr1, [%[block], #8] \n\t" /* "movq %%mm1, 8(%0, %3) \n\t" */ + "add %[block], %[block], #16 \n\t" /* "addl $16, %3 \n\t" */ + "subs %[i], %[i], #1 \n\t" + "bne 1b \n\t" /* "jng 1b \n\t" */ + :[block]"+r"(block) + :[i]"r"((nCoeffs + 8) / 8), [qmul]"r"(qmul), [qadd]"r"(qadd) + :"memory"); + + block_orig[0] = level; +} + +#if 0 +static void dct_unquantize_h263_inter_iwmmxt(MpegEncContext *s, + DCTELEM *block, int n, int qscale) +{ + int nCoeffs; + + assert(s->block_last_index[n]>=0); + + if(s->ac_pred) + nCoeffs=63; + else + nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; + + ippiQuantInvInter_Compact_H263_16s_I(block, nCoeffs+1, qscale); +} +#endif + +void MPV_common_init_iwmmxt(MpegEncContext *s) +{ + if (!(mm_flags & MM_IWMMXT)) return; + + s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_iwmmxt; +#if 0 + s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_iwmmxt; +#endif +} diff --git a/src/libffmpeg/libavcodec/armv4l/simple_idct_armv5te.S b/src/libffmpeg/libavcodec/armv4l/simple_idct_armv5te.S new file mode 100644 index 000000000..28bee0643 --- /dev/null +++ b/src/libffmpeg/libavcodec/armv4l/simple_idct_armv5te.S @@ -0,0 +1,718 @@ +/* + * Simple IDCT + * + * Copyright (c) 2001 Michael Niedermayer + * Copyright (c) 2006 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#define W1 22725 /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */ +#define W2 21407 /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */ +#define W3 19266 /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */ +#define W4 16383 /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */ +#define W5 12873 /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */ +#define W6 8867 /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */ +#define W7 4520 /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */ +#define ROW_SHIFT 11 +#define COL_SHIFT 20 + +#define W13 (W1 | (W3 << 16)) +#define W26 (W2 | (W6 << 16)) +#define W57 (W5 | (W7 << 16)) + + .text + .align +w13: .long W13 +w26: .long W26 +w57: .long W57 + + .align + .func idct_row_armv5te +idct_row_armv5te: + str lr, [sp, #-4]! + + ldrd v1, [a1, #8] + ldrd a3, [a1] /* a3 = row[1:0], a4 = row[3:2] */ + orrs v1, v1, v2 + cmpeq v1, a4 + cmpeq v1, a3, lsr #16 + beq row_dc_only + + mov v1, #(1<<(ROW_SHIFT-1)) + mov ip, #16384 + sub ip, ip, #1 /* ip = W4 */ + smlabb v1, ip, a3, v1 /* v1 = W4*row[0]+(1<<(RS-1)) */ + ldr ip, [pc, #(w26-.-8)] /* ip = W2 | (W6 << 16) */ + smultb a2, ip, a4 + smulbb lr, ip, a4 + add v2, v1, a2 + sub v3, v1, a2 + sub v4, v1, lr + add v1, v1, lr + + ldr ip, [pc, #(w13-.-8)] /* ip = W1 | (W3 << 16) */ + ldr lr, [pc, #(w57-.-8)] /* lr = W5 | (W7 << 16) */ + smulbt v5, ip, a3 + smultt v6, lr, a4 + smlatt v5, ip, a4, v5 + smultt a2, ip, a3 + smulbt v7, lr, a3 + sub v6, v6, a2 + smulbt a2, ip, a4 + smultt fp, lr, a3 + sub v7, v7, a2 + smulbt a2, lr, a4 + ldrd a3, [a1, #8] /* a3=row[5:4] a4=row[7:6] */ + sub fp, fp, a2 + + orrs a2, a3, a4 + beq 1f + + smlabt v5, lr, a3, v5 + smlabt v6, ip, a3, v6 + smlatt v5, lr, a4, v5 + smlabt v6, lr, a4, v6 + smlatt v7, lr, a3, v7 + smlatt fp, ip, a3, fp + smulbt a2, ip, a4 + smlatt v7, ip, a4, v7 + sub fp, fp, a2 + + ldr ip, [pc, #(w26-.-8)] /* ip = W2 | (W6 << 16) */ + mov a2, #16384 + sub a2, a2, #1 /* a2 = W4 */ + smulbb a2, a2, a3 /* a2 = W4*row[4] */ + smultb lr, ip, a4 /* lr = W6*row[6] */ + add v1, v1, a2 /* v1 += W4*row[4] */ + add v1, v1, lr /* v1 += W6*row[6] */ + add v4, v4, a2 /* v4 += W4*row[4] */ + sub v4, v4, lr /* v4 -= W6*row[6] */ + smulbb lr, ip, a4 /* lr = W2*row[6] */ + sub v2, v2, a2 /* v2 -= W4*row[4] */ + sub v2, v2, lr /* v2 -= W2*row[6] */ + sub v3, v3, a2 /* v3 -= W4*row[4] */ + add v3, v3, lr /* v3 += W2*row[6] */ + +1: add a2, v1, v5 + mov a3, a2, lsr #11 + bic a3, a3, #0x1f0000 + sub a2, v2, v6 + mov a2, a2, lsr #11 + add a3, a3, a2, lsl #16 + add a2, v3, v7 + mov a4, a2, lsr #11 + bic a4, a4, #0x1f0000 + add a2, v4, fp + mov a2, a2, lsr #11 + add a4, a4, a2, lsl #16 + strd a3, [a1] + + sub a2, v4, fp + mov a3, a2, lsr #11 + bic a3, a3, #0x1f0000 + sub a2, v3, v7 + mov a2, a2, lsr #11 + add a3, a3, a2, lsl #16 + add a2, v2, v6 + mov a4, a2, lsr #11 + bic a4, a4, #0x1f0000 + sub a2, v1, v5 + mov a2, a2, lsr #11 + add a4, a4, a2, lsl #16 + strd a3, [a1, #8] + + ldr pc, [sp], #4 + +row_dc_only: + orr a3, a3, a3, lsl #16 + bic a3, a3, #0xe000 + mov a3, a3, lsl #3 + mov a4, a3 + strd a3, [a1] + strd a3, [a1, #8] + + ldr pc, [sp], #4 + .endfunc + + .macro idct_col + ldr a4, [a1] /* a4 = col[1:0] */ + mov ip, #16384 + sub ip, ip, #1 /* ip = W4 */ +#if 0 + mov v1, #(1<<(COL_SHIFT-1)) + smlabt v2, ip, a4, v1 /* v2 = W4*col[1] + (1<<(COL_SHIFT-1)) */ + smlabb v1, ip, a4, v1 /* v1 = W4*col[0] + (1<<(COL_SHIFT-1)) */ + ldr a4, [a1, #(16*4)] +#else + mov v1, #((1<<(COL_SHIFT-1))/W4) /* this matches the C version */ + add v2, v1, a4, asr #16 + rsb v2, v2, v2, lsl #14 + mov a4, a4, lsl #16 + add v1, v1, a4, asr #16 + ldr a4, [a1, #(16*4)] + rsb v1, v1, v1, lsl #14 +#endif + + smulbb lr, ip, a4 + smulbt a3, ip, a4 + sub v3, v1, lr + sub v5, v1, lr + add v7, v1, lr + add v1, v1, lr + sub v4, v2, a3 + sub v6, v2, a3 + add fp, v2, a3 + ldr ip, [pc, #(w26-.-8)] + ldr a4, [a1, #(16*2)] + add v2, v2, a3 + + smulbb lr, ip, a4 + smultb a3, ip, a4 + add v1, v1, lr + sub v7, v7, lr + add v3, v3, a3 + sub v5, v5, a3 + smulbt lr, ip, a4 + smultt a3, ip, a4 + add v2, v2, lr + sub fp, fp, lr + add v4, v4, a3 + ldr a4, [a1, #(16*6)] + sub v6, v6, a3 + + smultb lr, ip, a4 + smulbb a3, ip, a4 + add v1, v1, lr + sub v7, v7, lr + sub v3, v3, a3 + add v5, v5, a3 + smultt lr, ip, a4 + smulbt a3, ip, a4 + add v2, v2, lr + sub fp, fp, lr + sub v4, v4, a3 + add v6, v6, a3 + + stmfd sp!, {v1, v2, v3, v4, v5, v6, v7, fp} + + ldr ip, [pc, #(w13-.-8)] + ldr a4, [a1, #(16*1)] + ldr lr, [pc, #(w57-.-8)] + smulbb v1, ip, a4 + smultb v3, ip, a4 + smulbb v5, lr, a4 + smultb v7, lr, a4 + smulbt v2, ip, a4 + smultt v4, ip, a4 + smulbt v6, lr, a4 + smultt fp, lr, a4 + rsb v4, v4, #0 + ldr a4, [a1, #(16*3)] + rsb v3, v3, #0 + + smlatb v1, ip, a4, v1 + smlatb v3, lr, a4, v3 + smulbb a3, ip, a4 + smulbb a2, lr, a4 + sub v5, v5, a3 + sub v7, v7, a2 + smlatt v2, ip, a4, v2 + smlatt v4, lr, a4, v4 + smulbt a3, ip, a4 + smulbt a2, lr, a4 + sub v6, v6, a3 + ldr a4, [a1, #(16*5)] + sub fp, fp, a2 + + smlabb v1, lr, a4, v1 + smlabb v3, ip, a4, v3 + smlatb v5, lr, a4, v5 + smlatb v7, ip, a4, v7 + smlabt v2, lr, a4, v2 + smlabt v4, ip, a4, v4 + smlatt v6, lr, a4, v6 + ldr a3, [a1, #(16*7)] + smlatt fp, ip, a4, fp + + smlatb v1, lr, a3, v1 + smlabb v3, lr, a3, v3 + smlatb v5, ip, a3, v5 + smulbb a4, ip, a3 + smlatt v2, lr, a3, v2 + sub v7, v7, a4 + smlabt v4, lr, a3, v4 + smulbt a4, ip, a3 + smlatt v6, ip, a3, v6 + sub fp, fp, a4 + .endm + + .align + .func idct_col_armv5te +idct_col_armv5te: + str lr, [sp, #-4]! + + idct_col + + ldmfd sp!, {a3, a4} + adds a2, a3, v1 + mov a2, a2, lsr #20 + orrmi a2, a2, #0xf000 + add ip, a4, v2 + mov ip, ip, asr #20 + orr a2, a2, ip, lsl #16 + str a2, [a1] + subs a3, a3, v1 + mov a2, a3, lsr #20 + orrmi a2, a2, #0xf000 + sub a4, a4, v2 + mov a4, a4, asr #20 + orr a2, a2, a4, lsl #16 + ldmfd sp!, {a3, a4} + str a2, [a1, #(16*7)] + + subs a2, a3, v3 + mov a2, a2, lsr #20 + orrmi a2, a2, #0xf000 + sub ip, a4, v4 + mov ip, ip, asr #20 + orr a2, a2, ip, lsl #16 + str a2, [a1, #(16*1)] + adds a3, a3, v3 + mov a2, a3, lsr #20 + orrmi a2, a2, #0xf000 + add a4, a4, v4 + mov a4, a4, asr #20 + orr a2, a2, a4, lsl #16 + ldmfd sp!, {a3, a4} + str a2, [a1, #(16*6)] + + adds a2, a3, v5 + mov a2, a2, lsr #20 + orrmi a2, a2, #0xf000 + add ip, a4, v6 + mov ip, ip, asr #20 + orr a2, a2, ip, lsl #16 + str a2, [a1, #(16*2)] + subs a3, a3, v5 + mov a2, a3, lsr #20 + orrmi a2, a2, #0xf000 + sub a4, a4, v6 + mov a4, a4, asr #20 + orr a2, a2, a4, lsl #16 + ldmfd sp!, {a3, a4} + str a2, [a1, #(16*5)] + + adds a2, a3, v7 + mov a2, a2, lsr #20 + orrmi a2, a2, #0xf000 + add ip, a4, fp + mov ip, ip, asr #20 + orr a2, a2, ip, lsl #16 + str a2, [a1, #(16*3)] + subs a3, a3, v7 + mov a2, a3, lsr #20 + orrmi a2, a2, #0xf000 + sub a4, a4, fp + mov a4, a4, asr #20 + orr a2, a2, a4, lsl #16 + str a2, [a1, #(16*4)] + + ldr pc, [sp], #4 + .endfunc + + .align + .func idct_col_put_armv5te +idct_col_put_armv5te: + str lr, [sp, #-4]! + + idct_col + + ldmfd sp!, {a3, a4} + ldr lr, [sp, #32] + add a2, a3, v1 + movs a2, a2, asr #20 + movmi a2, #0 + cmp a2, #255 + movgt a2, #255 + add ip, a4, v2 + movs ip, ip, asr #20 + movmi ip, #0 + cmp ip, #255 + movgt ip, #255 + orr a2, a2, ip, lsl #8 + sub a3, a3, v1 + movs a3, a3, asr #20 + movmi a3, #0 + cmp a3, #255 + movgt a3, #255 + sub a4, a4, v2 + movs a4, a4, asr #20 + movmi a4, #0 + cmp a4, #255 + ldr v1, [sp, #28] + movgt a4, #255 + strh a2, [v1] + add a2, v1, #2 + str a2, [sp, #28] + orr a2, a3, a4, lsl #8 + rsb v2, lr, lr, lsl #3 + ldmfd sp!, {a3, a4} + strh a2, [v2, v1]! + + sub a2, a3, v3 + movs a2, a2, asr #20 + movmi a2, #0 + cmp a2, #255 + movgt a2, #255 + sub ip, a4, v4 + movs ip, ip, asr #20 + movmi ip, #0 + cmp ip, #255 + movgt ip, #255 + orr a2, a2, ip, lsl #8 + strh a2, [v1, lr]! + add a3, a3, v3 + movs a2, a3, asr #20 + movmi a2, #0 + cmp a2, #255 + movgt a2, #255 + add a4, a4, v4 + movs a4, a4, asr #20 + movmi a4, #0 + cmp a4, #255 + movgt a4, #255 + orr a2, a2, a4, lsl #8 + ldmfd sp!, {a3, a4} + strh a2, [v2, -lr]! + + add a2, a3, v5 + movs a2, a2, asr #20 + movmi a2, #0 + cmp a2, #255 + movgt a2, #255 + add ip, a4, v6 + movs ip, ip, asr #20 + movmi ip, #0 + cmp ip, #255 + movgt ip, #255 + orr a2, a2, ip, lsl #8 + strh a2, [v1, lr]! + sub a3, a3, v5 + movs a2, a3, asr #20 + movmi a2, #0 + cmp a2, #255 + movgt a2, #255 + sub a4, a4, v6 + movs a4, a4, asr #20 + movmi a4, #0 + cmp a4, #255 + movgt a4, #255 + orr a2, a2, a4, lsl #8 + ldmfd sp!, {a3, a4} + strh a2, [v2, -lr]! + + add a2, a3, v7 + movs a2, a2, asr #20 + movmi a2, #0 + cmp a2, #255 + movgt a2, #255 + add ip, a4, fp + movs ip, ip, asr #20 + movmi ip, #0 + cmp ip, #255 + movgt ip, #255 + orr a2, a2, ip, lsl #8 + strh a2, [v1, lr] + sub a3, a3, v7 + movs a2, a3, asr #20 + movmi a2, #0 + cmp a2, #255 + movgt a2, #255 + sub a4, a4, fp + movs a4, a4, asr #20 + movmi a4, #0 + cmp a4, #255 + movgt a4, #255 + orr a2, a2, a4, lsl #8 + strh a2, [v2, -lr] + + ldr pc, [sp], #4 + .endfunc + + .align + .func idct_col_add_armv5te +idct_col_add_armv5te: + str lr, [sp, #-4]! + + idct_col + + ldr lr, [sp, #36] + + ldmfd sp!, {a3, a4} + ldrh ip, [lr] + add a2, a3, v1 + mov a2, a2, asr #20 + sub a3, a3, v1 + and v1, ip, #255 + adds a2, a2, v1 + movmi a2, #0 + cmp a2, #255 + movgt a2, #255 + add v1, a4, v2 + mov v1, v1, asr #20 + adds v1, v1, ip, lsr #8 + movmi v1, #0 + cmp v1, #255 + movgt v1, #255 + orr a2, a2, v1, lsl #8 + ldr v1, [sp, #32] + sub a4, a4, v2 + rsb v2, v1, v1, lsl #3 + ldrh ip, [v2, lr]! + strh a2, [lr] + mov a3, a3, asr #20 + and a2, ip, #255 + adds a3, a3, a2 + movmi a3, #0 + cmp a3, #255 + movgt a3, #255 + mov a4, a4, asr #20 + adds a4, a4, ip, lsr #8 + movmi a4, #0 + cmp a4, #255 + movgt a4, #255 + add a2, lr, #2 + str a2, [sp, #28] + orr a2, a3, a4, lsl #8 + strh a2, [v2] + + ldmfd sp!, {a3, a4} + ldrh ip, [lr, v1]! + sub a2, a3, v3 + mov a2, a2, asr #20 + add a3, a3, v3 + and v3, ip, #255 + adds a2, a2, v3 + movmi a2, #0 + cmp a2, #255 + movgt a2, #255 + sub v3, a4, v4 + mov v3, v3, asr #20 + adds v3, v3, ip, lsr #8 + movmi v3, #0 + cmp v3, #255 + movgt v3, #255 + orr a2, a2, v3, lsl #8 + add a4, a4, v4 + ldrh ip, [v2, -v1]! + strh a2, [lr] + mov a3, a3, asr #20 + and a2, ip, #255 + adds a3, a3, a2 + movmi a3, #0 + cmp a3, #255 + movgt a3, #255 + mov a4, a4, asr #20 + adds a4, a4, ip, lsr #8 + movmi a4, #0 + cmp a4, #255 + movgt a4, #255 + orr a2, a3, a4, lsl #8 + strh a2, [v2] + + ldmfd sp!, {a3, a4} + ldrh ip, [lr, v1]! + add a2, a3, v5 + mov a2, a2, asr #20 + sub a3, a3, v5 + and v3, ip, #255 + adds a2, a2, v3 + movmi a2, #0 + cmp a2, #255 + movgt a2, #255 + add v3, a4, v6 + mov v3, v3, asr #20 + adds v3, v3, ip, lsr #8 + movmi v3, #0 + cmp v3, #255 + movgt v3, #255 + orr a2, a2, v3, lsl #8 + sub a4, a4, v6 + ldrh ip, [v2, -v1]! + strh a2, [lr] + mov a3, a3, asr #20 + and a2, ip, #255 + adds a3, a3, a2 + movmi a3, #0 + cmp a3, #255 + movgt a3, #255 + mov a4, a4, asr #20 + adds a4, a4, ip, lsr #8 + movmi a4, #0 + cmp a4, #255 + movgt a4, #255 + orr a2, a3, a4, lsl #8 + strh a2, [v2] + + ldmfd sp!, {a3, a4} + ldrh ip, [lr, v1]! + add a2, a3, v7 + mov a2, a2, asr #20 + sub a3, a3, v7 + and v3, ip, #255 + adds a2, a2, v3 + movmi a2, #0 + cmp a2, #255 + movgt a2, #255 + add v3, a4, fp + mov v3, v3, asr #20 + adds v3, v3, ip, lsr #8 + movmi v3, #0 + cmp v3, #255 + movgt v3, #255 + orr a2, a2, v3, lsl #8 + sub a4, a4, fp + ldrh ip, [v2, -v1]! + strh a2, [lr] + mov a3, a3, asr #20 + and a2, ip, #255 + adds a3, a3, a2 + movmi a3, #0 + cmp a3, #255 + movgt a3, #255 + mov a4, a4, asr #20 + adds a4, a4, ip, lsr #8 + movmi a4, #0 + cmp a4, #255 + movgt a4, #255 + orr a2, a3, a4, lsl #8 + strh a2, [v2] + + ldr pc, [sp], #4 + .endfunc + + .align + .global simple_idct_armv5te + .func simple_idct_armv5te +simple_idct_armv5te: + stmfd sp!, {v1, v2, v3, v4, v5, v6, v7, fp, lr} + + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + + sub a1, a1, #(16*7) + + bl idct_col_armv5te + add a1, a1, #4 + bl idct_col_armv5te + add a1, a1, #4 + bl idct_col_armv5te + add a1, a1, #4 + bl idct_col_armv5te + + ldmfd sp!, {v1, v2, v3, v4, v5, v6, v7, fp, pc} + .endfunc + + .align + .global simple_idct_add_armv5te + .func simple_idct_add_armv5te +simple_idct_add_armv5te: + stmfd sp!, {a1, a2, v1, v2, v3, v4, v5, v6, v7, fp, lr} + + mov a1, a3 + + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + + sub a1, a1, #(16*7) + + bl idct_col_add_armv5te + add a1, a1, #4 + bl idct_col_add_armv5te + add a1, a1, #4 + bl idct_col_add_armv5te + add a1, a1, #4 + bl idct_col_add_armv5te + + add sp, sp, #8 + ldmfd sp!, {v1, v2, v3, v4, v5, v6, v7, fp, pc} + .endfunc + + .align + .global simple_idct_put_armv5te + .func simple_idct_put_armv5te +simple_idct_put_armv5te: + stmfd sp!, {a1, a2, v1, v2, v3, v4, v5, v6, v7, fp, lr} + + mov a1, a3 + + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + add a1, a1, #16 + bl idct_row_armv5te + + sub a1, a1, #(16*7) + + bl idct_col_put_armv5te + add a1, a1, #4 + bl idct_col_put_armv5te + add a1, a1, #4 + bl idct_col_put_armv5te + add a1, a1, #4 + bl idct_col_put_armv5te + + add sp, sp, #8 + ldmfd sp!, {v1, v2, v3, v4, v5, v6, v7, fp, pc} + .endfunc diff --git a/src/libffmpeg/libavcodec/avcodec.h b/src/libffmpeg/libavcodec/avcodec.h index d8090ed32..7d7678455 100644 --- a/src/libffmpeg/libavcodec/avcodec.h +++ b/src/libffmpeg/libavcodec/avcodec.h @@ -37,13 +37,13 @@ extern "C" { #define AV_STRINGIFY(s) AV_TOSTRING(s) #define AV_TOSTRING(s) #s -#define LIBAVCODEC_VERSION_INT ((51<<16)+(25<<8)+0) -#define LIBAVCODEC_VERSION 51.25.0 +#define LIBAVCODEC_VERSION_INT ((51<<16)+(28<<8)+0) +#define LIBAVCODEC_VERSION 51.28.0 #define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT #define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) -#define AV_NOPTS_VALUE int64_t_C(0x8000000000000000) +#define AV_NOPTS_VALUE INT64_C(0x8000000000000000) #define AV_TIME_BASE 1000000 #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} @@ -156,6 +156,7 @@ enum CodecID { CODEC_ID_TIERTEXSEQVIDEO, CODEC_ID_TIFF, CODEC_ID_GIF, + CODEC_ID_FFH264, /* various pcm "codecs" */ CODEC_ID_PCM_S16LE= 0x10000, @@ -243,6 +244,7 @@ enum CodecID { CODEC_ID_WAVPACK, CODEC_ID_DSICINAUDIO, CODEC_ID_IMC, + CODEC_ID_MUSEPACK7, /* subtitle codecs */ CODEC_ID_DVD_SUBTITLE= 0x17000, @@ -372,7 +374,7 @@ typedef struct RcOverride{ #define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< place global headers at every keyframe instead of in extradata #define CODEC_FLAG2_BPYRAMID 0x00000010 ///< H.264 allow b-frames to be used as references #define CODEC_FLAG2_WPRED 0x00000020 ///< H.264 weighted biprediction for b-frames -#define CODEC_FLAG2_MIXED_REFS 0x00000040 ///< H.264 multiple references per partition +#define CODEC_FLAG2_MIXED_REFS 0x00000040 ///< H.264 one reference per partition, as opposed to one reference per macroblock #define CODEC_FLAG2_8X8DCT 0x00000080 ///< H.264 high profile 8x8 transform #define CODEC_FLAG2_FASTPSKIP 0x00000100 ///< H.264 fast pskip #define CODEC_FLAG2_AUD 0x00000200 ///< H.264 access unit delimiters @@ -380,6 +382,7 @@ typedef struct RcOverride{ #define CODEC_FLAG2_INTRA_VLC 0x00000800 ///< use MPEG-2 intra VLC table #define CODEC_FLAG2_MEMC_ONLY 0x00001000 ///< only do ME/MC (I frames -> ref, P frame -> ME+MC) #define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format +#define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skiping /* Unsupported options : * Syntax Arithmetic coding (SAC) @@ -2090,9 +2093,6 @@ typedef struct AVCodec { int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, uint8_t *buf, int buf_size); int capabilities; -#if LIBAVCODEC_VERSION_INT < ((50<<16)+(0<<8)+0) - void *dummy; // FIXME remove next time we break binary compatibility -#endif struct AVCodec *next; void (*flush)(AVCodecContext *); const AVRational *supported_framerates; ///array of supported framerates, or NULL if any, array is terminated by {0,0} @@ -2310,6 +2310,7 @@ extern AVCodec libgsm_decoder; extern AVCodec bmp_decoder; extern AVCodec mmvideo_decoder; extern AVCodec zmbv_decoder; +extern AVCodec zmbv_encoder; extern AVCodec avs_decoder; extern AVCodec smacker_decoder; extern AVCodec smackaud_decoder; @@ -2324,6 +2325,7 @@ extern AVCodec dsicinaudio_decoder; extern AVCodec tiertexseqvideo_decoder; extern AVCodec tiff_decoder; extern AVCodec imc_decoder; +extern AVCodec mpc7_decoder; /* pcm codecs */ #define PCM_CODEC(id, name) \ @@ -2691,20 +2693,6 @@ int img_crop(AVPicture *dst, const AVPicture *src, int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt, int padtop, int padbottom, int padleft, int padright, int *color); -/* endian macros */ -#if !defined(BE_16) || !defined(BE_32) || !defined(LE_16) || !defined(LE_32) -#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) -#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ - (((uint8_t*)(x))[1] << 16) | \ - (((uint8_t*)(x))[2] << 8) | \ - ((uint8_t*)(x))[3]) -#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) -#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ - (((uint8_t*)(x))[2] << 16) | \ - (((uint8_t*)(x))[1] << 8) | \ - ((uint8_t*)(x))[0]) -#endif - extern unsigned int av_xiphlacing(unsigned char *s, unsigned int v); /* unused static macro */ diff --git a/src/libffmpeg/libavcodec/bitstream.h b/src/libffmpeg/libavcodec/bitstream.h index af25b6dcf..29e0f441e 100644 --- a/src/libffmpeg/libavcodec/bitstream.h +++ b/src/libffmpeg/libavcodec/bitstream.h @@ -187,12 +187,12 @@ static inline uint##x##_t unaligned##x(const void *v) { \ } # elif defined(__DECC) # define unaligned(x) \ -static inline uint##x##_t unaligned##x##(const void *v) { \ +static inline uint##x##_t unaligned##x(const void *v) { \ return *(const __unaligned uint##x##_t *) v; \ } # else # define unaligned(x) \ -static inline uint##x##_t unaligned##x##(const void *v) { \ +static inline uint##x##_t unaligned##x(const void *v) { \ return *(const uint##x##_t *) v; \ } # endif @@ -877,7 +877,7 @@ void free_vlc(VLC *vlc); * read the longest vlc code * = (max_vlc_length + bits - 1) / bits */ -static always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], +static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], int bits, int max_depth) { int code; diff --git a/src/libffmpeg/libavcodec/bytestream.h b/src/libffmpeg/libavcodec/bytestream.h index 25c457fe4..a742fa1c1 100644 --- a/src/libffmpeg/libavcodec/bytestream.h +++ b/src/libffmpeg/libavcodec/bytestream.h @@ -22,32 +22,32 @@ #ifndef FFMPEG_BYTESTREAM_H #define FFMPEG_BYTESTREAM_H -static always_inline unsigned int bytestream_get_le32(uint8_t **b) +static av_always_inline unsigned int bytestream_get_le32(uint8_t **b) { (*b) += 4; return LE_32(*b - 4); } -static always_inline unsigned int bytestream_get_le16(uint8_t **b) +static av_always_inline unsigned int bytestream_get_le16(uint8_t **b) { (*b) += 2; return LE_16(*b - 2); } -static always_inline unsigned int bytestream_get_byte(uint8_t **b) +static av_always_inline unsigned int bytestream_get_byte(uint8_t **b) { (*b)++; return (*b)[-1]; } -static always_inline unsigned int bytestream_get_buffer(uint8_t **b, uint8_t *dst, unsigned int size) +static av_always_inline unsigned int bytestream_get_buffer(uint8_t **b, uint8_t *dst, unsigned int size) { memcpy(dst, *b, size); (*b) += size; return size; } -static always_inline void bytestream_put_be32(uint8_t **b, const unsigned int value) +static av_always_inline void bytestream_put_be32(uint8_t **b, const unsigned int value) { *(*b)++ = value >> 24; *(*b)++ = value >> 16; @@ -55,13 +55,13 @@ static always_inline void bytestream_put_be32(uint8_t **b, const unsigned int va *(*b)++ = value; }; -static always_inline void bytestream_put_be16(uint8_t **b, const unsigned int value) +static av_always_inline void bytestream_put_be16(uint8_t **b, const unsigned int value) { *(*b)++ = value >> 8; *(*b)++ = value; } -static always_inline void bytestream_put_le32(uint8_t **b, const unsigned int value) +static av_always_inline void bytestream_put_le32(uint8_t **b, const unsigned int value) { *(*b)++ = value; *(*b)++ = value >> 8; @@ -69,18 +69,18 @@ static always_inline void bytestream_put_le32(uint8_t **b, const unsigned int va *(*b)++ = value >> 24; } -static always_inline void bytestream_put_le16(uint8_t **b, const unsigned int value) +static av_always_inline void bytestream_put_le16(uint8_t **b, const unsigned int value) { *(*b)++ = value; *(*b)++ = value >> 8; } -static always_inline void bytestream_put_byte(uint8_t **b, const unsigned int value) +static av_always_inline void bytestream_put_byte(uint8_t **b, const unsigned int value) { *(*b)++ = value; } -static always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size) +static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size) { memcpy(*b, src, size); (*b) += size; diff --git a/src/libffmpeg/libavcodec/cabac.h b/src/libffmpeg/libavcodec/cabac.h index 43fe78e3b..f47406a9e 100644 --- a/src/libffmpeg/libavcodec/cabac.h +++ b/src/libffmpeg/libavcodec/cabac.h @@ -363,7 +363,7 @@ static inline void renorm_cabac_decoder_once(CABACContext *c){ refill(c); } -static int always_inline get_cabac_inline(CABACContext *c, uint8_t * const state){ +static int av_always_inline get_cabac_inline(CABACContext *c, uint8_t * const state){ //FIXME gcc generates duplicate load/stores for c->low and c->range #define LOW "0" #define RANGE "4" @@ -631,7 +631,7 @@ static int get_cabac_bypass(CABACContext *c){ } -static always_inline int get_cabac_bypass_sign(CABACContext *c, int val){ +static av_always_inline int get_cabac_bypass_sign(CABACContext *c, int val){ #if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) asm volatile( "movl "RANGE "(%1), %%ebx \n\t" diff --git a/src/libffmpeg/libavcodec/cinepak.c b/src/libffmpeg/libavcodec/cinepak.c index e137377e5..fd95b739e 100644 --- a/src/libffmpeg/libavcodec/cinepak.c +++ b/src/libffmpeg/libavcodec/cinepak.c @@ -26,6 +26,8 @@ * by Ewald Snel * For more information on the Cinepak algorithm, visit: * http://www.csse.monash.edu.au/~timf/ + * For more information on the quirky data inside Sega FILM/CPK files, visit: + * http://wiki.multimedia.cx/index.php?title=Sega_FILM */ #include @@ -67,6 +69,8 @@ typedef struct CinepakContext { int palette_video; cvid_strip_t strips[MAX_STRIPS]; + int sega_film_skip_bytes; + } CinepakContext; static void cinepak_decode_codebook (cvid_codebook_t *codebook, @@ -319,8 +323,6 @@ static int cinepak_decode (CinepakContext *s) int i, result, strip_size, frame_flags, num_strips; int y0 = 0; int encoded_buf_size; - /* if true, Cinepak data is from a Sega FILM/CPK file */ - int sega_film_data = 0; if (s->size < 10) return -1; @@ -328,12 +330,29 @@ static int cinepak_decode (CinepakContext *s) frame_flags = s->data[0]; num_strips = BE_16 (&s->data[8]); encoded_buf_size = ((s->data[1] << 16) | BE_16 (&s->data[2])); - if (encoded_buf_size != s->size) - sega_film_data = 1; - if (sega_film_data) - s->data += 12; - else - s->data += 10; + + /* if this is the first frame, check for deviant Sega FILM data */ + if (s->sega_film_skip_bytes == -1) { + if (encoded_buf_size != s->size) { + /* If the encoded frame size differs from the frame size as indicated + * by the container file, this data likely comes from a Sega FILM/CPK file. + * If the frame header is followed by the bytes FE 00 00 06 00 00 then + * this is probably one of the two known files that have 6 extra bytes + * after the frame header. Else, assume 2 extra bytes. */ + if ((s->data[10] == 0xFE) && + (s->data[11] == 0x00) && + (s->data[12] == 0x00) && + (s->data[13] == 0x06) && + (s->data[14] == 0x00) && + (s->data[15] == 0x00)) + s->sega_film_skip_bytes = 6; + else + s->sega_film_skip_bytes = 2; + } else + s->sega_film_skip_bytes = 0; + } + + s->data += 10 + s->sega_film_skip_bytes; if (num_strips > MAX_STRIPS) num_strips = MAX_STRIPS; @@ -377,6 +396,7 @@ static int cinepak_decode_init(AVCodecContext *avctx) s->avctx = avctx; s->width = (avctx->width + 3) & ~3; s->height = (avctx->height + 3) & ~3; + s->sega_film_skip_bytes = -1; /* uninitialized state */ // check for paletted data if ((avctx->palctrl == NULL) || (avctx->bits_per_sample == 40)) { diff --git a/src/libffmpeg/libavcodec/cook.c b/src/libffmpeg/libavcodec/cook.c index 47d9ce2c3..943addb89 100644 --- a/src/libffmpeg/libavcodec/cook.c +++ b/src/libffmpeg/libavcodec/cook.c @@ -312,7 +312,7 @@ static int cook_decode_close(AVCodecContext *avctx) { int i; COOKContext *q = avctx->priv_data; - av_log(NULL,AV_LOG_DEBUG, "Deallocating memory.\n"); + av_log(avctx,AV_LOG_DEBUG, "Deallocating memory.\n"); /* Free allocated memory buffers. */ av_free(q->mlt_window); @@ -1160,12 +1160,12 @@ static int cook_decode_init(AVCodecContext *avctx) /* Take care of the codec specific extradata. */ if (avctx->extradata_size <= 0) { - av_log(NULL,AV_LOG_ERROR,"Necessary extradata missing!\n"); + av_log(avctx,AV_LOG_ERROR,"Necessary extradata missing!\n"); return -1; } else { /* 8 for mono, 16 for stereo, ? for multichannel Swap to right endianness so we don't need to care later on. */ - av_log(NULL,AV_LOG_DEBUG,"codecdata_length=%d\n",avctx->extradata_size); + av_log(avctx,AV_LOG_DEBUG,"codecdata_length=%d\n",avctx->extradata_size); if (avctx->extradata_size >= 8){ e->cookversion = be2me_32(e->cookversion); e->samples_per_frame = be2me_16(e->samples_per_frame); @@ -1201,24 +1201,24 @@ static int cook_decode_init(AVCodecContext *avctx) switch (e->cookversion) { case MONO_COOK1: if (q->nb_channels != 1) { - av_log(NULL,AV_LOG_ERROR,"Container channels != 1, report sample!\n"); + av_log(avctx,AV_LOG_ERROR,"Container channels != 1, report sample!\n"); return -1; } - av_log(NULL,AV_LOG_DEBUG,"MONO_COOK1\n"); + av_log(avctx,AV_LOG_DEBUG,"MONO_COOK1\n"); break; case MONO_COOK2: if (q->nb_channels != 1) { q->joint_stereo = 0; q->bits_per_subpacket = q->bits_per_subpacket/2; } - av_log(NULL,AV_LOG_DEBUG,"MONO_COOK2\n"); + av_log(avctx,AV_LOG_DEBUG,"MONO_COOK2\n"); break; case JOINT_STEREO: if (q->nb_channels != 2) { - av_log(NULL,AV_LOG_ERROR,"Container channels != 2, report sample!\n"); + av_log(avctx,AV_LOG_ERROR,"Container channels != 2, report sample!\n"); return -1; } - av_log(NULL,AV_LOG_DEBUG,"JOINT_STEREO\n"); + av_log(avctx,AV_LOG_DEBUG,"JOINT_STEREO\n"); if (avctx->extradata_size >= 16){ q->total_subbands = q->subbands + e->js_subband_start; q->js_subband_start = e->js_subband_start; @@ -1233,11 +1233,11 @@ static int cook_decode_init(AVCodecContext *avctx) } break; case MC_COOK: - av_log(NULL,AV_LOG_ERROR,"MC_COOK not supported!\n"); + av_log(avctx,AV_LOG_ERROR,"MC_COOK not supported!\n"); return -1; break; default: - av_log(NULL,AV_LOG_ERROR,"Unknown Cook version, report sample!\n"); + av_log(avctx,AV_LOG_ERROR,"Unknown Cook version, report sample!\n"); return -1; break; } @@ -1280,16 +1280,16 @@ static int cook_decode_init(AVCodecContext *avctx) /* Try to catch some obviously faulty streams, othervise it might be exploitable */ if (q->total_subbands > 53) { - av_log(NULL,AV_LOG_ERROR,"total_subbands > 53, report sample!\n"); + av_log(avctx,AV_LOG_ERROR,"total_subbands > 53, report sample!\n"); return -1; } if (q->subbands > 50) { - av_log(NULL,AV_LOG_ERROR,"subbands > 50, report sample!\n"); + av_log(avctx,AV_LOG_ERROR,"subbands > 50, report sample!\n"); return -1; } if ((q->samples_per_channel == 256) || (q->samples_per_channel == 512) || (q->samples_per_channel == 1024)) { } else { - av_log(NULL,AV_LOG_ERROR,"unknown amount of samples_per_channel = %d, report sample!\n",q->samples_per_channel); + av_log(avctx,AV_LOG_ERROR,"unknown amount of samples_per_channel = %d, report sample!\n",q->samples_per_channel); return -1; } diff --git a/src/libffmpeg/libavcodec/cscd.c b/src/libffmpeg/libavcodec/cscd.c index e4257f4c0..d8733d6dd 100644 --- a/src/libffmpeg/libavcodec/cscd.c +++ b/src/libffmpeg/libavcodec/cscd.c @@ -220,12 +220,12 @@ static int decode_init(AVCodecContext *avctx) { } avctx->has_b_frames = 0; switch (avctx->bits_per_sample) { - case 16: avctx->pix_fmt = PIX_FMT_RGB565; break; + case 16: avctx->pix_fmt = PIX_FMT_RGB555; break; case 24: avctx->pix_fmt = PIX_FMT_BGR24; break; case 32: avctx->pix_fmt = PIX_FMT_RGBA32; break; default: av_log(avctx, AV_LOG_ERROR, - "CamStudio codec error: unvalid depth %i bpp\n", + "CamStudio codec error: invalid depth %i bpp\n", avctx->bits_per_sample); return 1; } diff --git a/src/libffmpeg/libavcodec/dsputil.c b/src/libffmpeg/libavcodec/dsputil.c index 51eddbc60..916d8658c 100644 --- a/src/libffmpeg/libavcodec/dsputil.c +++ b/src/libffmpeg/libavcodec/dsputil.c @@ -2549,6 +2549,11 @@ void ff_put_vc1_mspel_mc00_c(uint8_t *dst, uint8_t *src, int stride, int rnd) { } #endif /* CONFIG_VC1_DECODER||CONFIG_WMV3_DECODER */ +#if defined(CONFIG_H264_ENCODER) +/* H264 specific */ +void ff_h264dsp_init(DSPContext* c, AVCodecContext *avctx); +#endif /* CONFIG_H264_ENCODER */ + static void wmv2_mspel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int w){ uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; int i; @@ -3801,11 +3806,31 @@ void dsputil_static_init(void) for(i=0; i<64; i++) inv_zigzag_direct16[ff_zigzag_direct[i]]= i+1; } +int ff_check_alignment(void){ + static int did_fail=0; + DECLARE_ALIGNED_16(int, aligned); + + if((int)&aligned & 15){ + if(!did_fail){ +#if defined(HAVE_MMX) || defined(HAVE_ALTIVEC) + av_log(NULL, AV_LOG_ERROR, + "Compiler did not align stack variables. Libavcodec has been miscompiled\n" + "and may be very slow or crash. This is not a bug in libavcodec,\n" + "but in the compiler. Do not report crashes to FFmpeg developers.\n"); +#endif + did_fail=1; + } + return -1; + } + return 0; +} void dsputil_init(DSPContext* c, AVCodecContext *avctx) { int i; + ff_check_alignment(); + #ifdef CONFIG_ENCODERS if(avctx->dct_algo==FF_DCT_FASTINT) { c->fdct = fdct_ifast; @@ -4006,6 +4031,9 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx) #if defined(CONFIG_VC1_DECODER) || defined(CONFIG_WMV3_DECODER) ff_vc1dsp_init(c,avctx); #endif +#if defined(CONFIG_H264_ENCODER) + ff_h264dsp_init(c,avctx); +#endif c->put_mspel_pixels_tab[0]= put_mspel8_mc00_c; c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c; diff --git a/src/libffmpeg/libavcodec/dsputil.h b/src/libffmpeg/libavcodec/dsputil.h index de3c1d564..78109f7b9 100644 --- a/src/libffmpeg/libavcodec/dsputil.h +++ b/src/libffmpeg/libavcodec/dsputil.h @@ -33,9 +33,6 @@ #include "common.h" #include "avcodec.h" -#if defined(ARCH_X86) || defined(ARCH_X86_64) -#define HAVE_MMX 1 -#endif //#define DEBUG /* dct code */ @@ -381,10 +378,12 @@ typedef struct DSPContext { #define BASIS_SHIFT 16 #define RECON_SHIFT 6 + /* h264 functions */ void (*h264_idct_add)(uint8_t *dst, DCTELEM *block, int stride); void (*h264_idct8_add)(uint8_t *dst, DCTELEM *block, int stride); void (*h264_idct_dc_add)(uint8_t *dst, DCTELEM *block, int stride); void (*h264_idct8_dc_add)(uint8_t *dst, DCTELEM *block, int stride); + void (*h264_dct)(DCTELEM block[4][4]); /* snow wavelet */ void (*vertical_compose97i)(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, DWTELEM *b3, DWTELEM *b4, DWTELEM *b5, int width); @@ -411,6 +410,8 @@ typedef struct DSPContext { void dsputil_static_init(void); void dsputil_init(DSPContext* p, AVCodecContext *avctx); +int ff_check_alignment(void); + /** * permute block according to permuatation. * @param last last non zero element in scantable order @@ -483,6 +484,7 @@ int mm_support(void); #define MM_SSE2 0x0010 /* PIV SSE2 functions */ #define MM_3DNOWEXT 0x0020 /* AMD 3DNowExt */ #define MM_SSE3 0x0040 /* Prescott SSE3 functions */ +#define MM_SSSE3 0x0080 /* Conroe SSSE3 functions */ extern int mm_flags; @@ -593,30 +595,6 @@ void dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx); #endif -#ifdef __GNUC__ - -struct unaligned_64 { uint64_t l; } __attribute__((packed)); -struct unaligned_32 { uint32_t l; } __attribute__((packed)); -struct unaligned_16 { uint16_t l; } __attribute__((packed)); - -#define LD16(a) (((const struct unaligned_16 *) (a))->l) -#define LD32(a) (((const struct unaligned_32 *) (a))->l) -#define LD64(a) (((const struct unaligned_64 *) (a))->l) - -#define ST16(a, b) (((struct unaligned_16 *) (a))->l) = (b) -#define ST32(a, b) (((struct unaligned_32 *) (a))->l) = (b) - -#else /* __GNUC__ */ - -#define LD16(a) (*((uint16_t*)(a))) -#define LD32(a) (*((uint32_t*)(a))) -#define LD64(a) (*((uint64_t*)(a))) - -#define ST16(a, b) *((uint16_t*)(a)) = (b) -#define ST32(a, b) *((uint32_t*)(a)) = (b) - -#endif /* !__GNUC__ */ - /* PSNR */ void get_psnr(uint8_t *orig_image[3], uint8_t *coded_image[3], int orig_linesize[3], int coded_linesize, diff --git a/src/libffmpeg/libavcodec/dv.c b/src/libffmpeg/libavcodec/dv.c index 76095a481..803d3502d 100644 --- a/src/libffmpeg/libavcodec/dv.c +++ b/src/libffmpeg/libavcodec/dv.c @@ -560,7 +560,7 @@ static inline void dv_decode_video_segment(DVVideoContext *s, #ifdef DV_CODEC_TINY_TARGET /* Converts run and level (where level != 0) pair into vlc, returning bit size */ -static always_inline int dv_rl2vlc(int run, int level, int sign, uint32_t* vlc) +static av_always_inline int dv_rl2vlc(int run, int level, int sign, uint32_t* vlc) { int size; if (run < DV_VLC_MAP_RUN_SIZE && level < DV_VLC_MAP_LEV_SIZE) { @@ -585,7 +585,7 @@ static always_inline int dv_rl2vlc(int run, int level, int sign, uint32_t* vlc) return size; } -static always_inline int dv_rl2vlc_size(int run, int level) +static av_always_inline int dv_rl2vlc_size(int run, int level) { int size; @@ -601,13 +601,13 @@ static always_inline int dv_rl2vlc_size(int run, int level) return size; } #else -static always_inline int dv_rl2vlc(int run, int l, int sign, uint32_t* vlc) +static av_always_inline int dv_rl2vlc(int run, int l, int sign, uint32_t* vlc) { *vlc = dv_vlc_map[run][l].vlc | sign; return dv_vlc_map[run][l].size; } -static always_inline int dv_rl2vlc_size(int run, int l) +static av_always_inline int dv_rl2vlc_size(int run, int l) { return dv_vlc_map[run][l].size; } @@ -627,7 +627,7 @@ typedef struct EncBlockInfo { uint32_t partial_bit_buffer; /* we can't use uint16_t here */ } EncBlockInfo; -static always_inline PutBitContext* dv_encode_ac(EncBlockInfo* bi, PutBitContext* pb_pool, +static av_always_inline PutBitContext* dv_encode_ac(EncBlockInfo* bi, PutBitContext* pb_pool, PutBitContext* pb_end) { int prev; @@ -670,7 +670,7 @@ static always_inline PutBitContext* dv_encode_ac(EncBlockInfo* bi, PutBitContext return pb; } -static always_inline void dv_set_class_number(DCTELEM* blk, EncBlockInfo* bi, +static av_always_inline void dv_set_class_number(DCTELEM* blk, EncBlockInfo* bi, const uint8_t* zigzag_scan, const int *weight, int bias) { int i, area; @@ -742,7 +742,7 @@ static always_inline void dv_set_class_number(DCTELEM* blk, EncBlockInfo* bi, //FIXME replace this by dsputil #define SC(x, y) ((s[x] - s[y]) ^ ((s[x] - s[y]) >> 7)) -static always_inline int dv_guess_dct_mode(DCTELEM *blk) { +static av_always_inline int dv_guess_dct_mode(DCTELEM *blk) { DCTELEM *s; int score88 = 0; int score248 = 0; diff --git a/src/libffmpeg/libavcodec/faandct.c b/src/libffmpeg/libavcodec/faandct.c index e3c0d84a2..6f73ee5e9 100644 --- a/src/libffmpeg/libavcodec/faandct.c +++ b/src/libffmpeg/libavcodec/faandct.c @@ -70,7 +70,7 @@ B6*B0, B6*B1, B6*B2, B6*B3, B6*B4, B6*B5, B6*B6, B6*B7, B7*B0, B7*B1, B7*B2, B7*B3, B7*B4, B7*B5, B7*B6, B7*B7, }; -static always_inline void row_fdct(FLOAT temp[64], DCTELEM * data) +static av_always_inline void row_fdct(FLOAT temp[64], DCTELEM * data) { FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; FLOAT tmp10, tmp11, tmp12, tmp13; diff --git a/src/libffmpeg/libavcodec/ffv1.c b/src/libffmpeg/libavcodec/ffv1.c index 62623e591..1ca18a4e8 100644 --- a/src/libffmpeg/libavcodec/ffv1.c +++ b/src/libffmpeg/libavcodec/ffv1.c @@ -186,7 +186,7 @@ typedef struct FFV1Context{ DSPContext dsp; }FFV1Context; -static always_inline int fold(int diff, int bits){ +static av_always_inline int fold(int diff, int bits){ if(bits==8) diff= (int8_t)diff; else{ diff --git a/src/libffmpeg/libavcodec/h263.c b/src/libffmpeg/libavcodec/h263.c index ba51c245a..af5fa50e6 100644 --- a/src/libffmpeg/libavcodec/h263.c +++ b/src/libffmpeg/libavcodec/h263.c @@ -486,6 +486,20 @@ static inline void restore_ac_coeffs(MpegEncContext * s, DCTELEM block[6][64], i } } +/** + * init s->current_picture.qscale_table from s->lambda_table + */ +static void ff_init_qscale_tab(MpegEncContext *s){ + int8_t * const qscale_table= s->current_picture.qscale_table; + int i; + + for(i=0; imb_num; i++){ + unsigned int lam= s->lambda_table[ s->mb_index2xy[i] ]; + int qp= (lam*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7); + qscale_table[ s->mb_index2xy[i] ]= clip(qp, s->avctx->qmin, s->avctx->qmax); + } +} + /** * modify qscale so that encoding is acually possible in h263 (limit difference to -2..2) */ @@ -493,6 +507,8 @@ void ff_clean_h263_qscales(MpegEncContext *s){ int i; int8_t * const qscale_table= s->current_picture.qscale_table; + ff_init_qscale_tab(s); + for(i=1; imb_num; i++){ if(qscale_table[ s->mb_index2xy[i] ] - qscale_table[ s->mb_index2xy[i-1] ] >2) qscale_table[ s->mb_index2xy[i] ]= qscale_table[ s->mb_index2xy[i-1] ]+2; @@ -507,7 +523,6 @@ void ff_clean_h263_qscales(MpegEncContext *s){ int mb_xy= s->mb_index2xy[i]; if(qscale_table[mb_xy] != qscale_table[s->mb_index2xy[i-1]] && (s->mb_type[mb_xy]&CANDIDATE_MB_TYPE_INTER4V)){ - s->mb_type[mb_xy]&= ~CANDIDATE_MB_TYPE_INTER4V; s->mb_type[mb_xy]|= CANDIDATE_MB_TYPE_INTER; } } @@ -546,7 +561,6 @@ void ff_clean_mpeg4_qscales(MpegEncContext *s){ for(i=1; imb_num; i++){ int mb_xy= s->mb_index2xy[i]; if(qscale_table[mb_xy] != qscale_table[s->mb_index2xy[i-1]] && (s->mb_type[mb_xy]&CANDIDATE_MB_TYPE_DIRECT)){ - s->mb_type[mb_xy]&= ~CANDIDATE_MB_TYPE_DIRECT; s->mb_type[mb_xy]|= CANDIDATE_MB_TYPE_BIDIR; } } diff --git a/src/libffmpeg/libavcodec/h264.c b/src/libffmpeg/libavcodec/h264.c index ad23ae120..d7c48bd4a 100644 --- a/src/libffmpeg/libavcodec/h264.c +++ b/src/libffmpeg/libavcodec/h264.c @@ -165,20 +165,6 @@ typedef struct H264Context{ MpegEncContext s; int nal_ref_idc; int nal_unit_type; -#define NAL_SLICE 1 -#define NAL_DPA 2 -#define NAL_DPB 3 -#define NAL_DPC 4 -#define NAL_IDR_SLICE 5 -#define NAL_SEI 6 -#define NAL_SPS 7 -#define NAL_PPS 8 -#define NAL_AUD 9 -#define NAL_END_SEQUENCE 10 -#define NAL_END_STREAM 11 -#define NAL_FILLER_DATA 12 -#define NAL_SPS_EXT 13 -#define NAL_AUXILIARY_SLICE 19 uint8_t *rbsp_buffer; unsigned int rbsp_buffer_size; @@ -414,7 +400,7 @@ static void svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, in static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize); static void filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize); -static always_inline uint32_t pack16to32(int a, int b){ +static av_always_inline uint32_t pack16to32(int a, int b){ #ifdef WORDS_BIGENDIAN return (b&0xFFFF) + (a<<16); #else @@ -422,13 +408,22 @@ static always_inline uint32_t pack16to32(int a, int b){ #endif } +const uint8_t ff_rem6[52]={ +0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, +}; + +const uint8_t ff_div6[52]={ +0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, +}; + + /** * fill a rectangle. * @param h height of the rectangle, should be a constant * @param w width of the rectangle, should be a constant * @param size the size of val (1 or 4), should be a constant */ -static always_inline void fill_rectangle(void *vp, int w, int h, int stride, uint32_t val, int size){ +static av_always_inline void fill_rectangle(void *vp, int w, int h, int stride, uint32_t val, int size){ uint8_t *p= (uint8_t*)vp; assert(size==1 || size==4); assert(w<=4); @@ -1808,81 +1803,6 @@ static uint8_t *decode_nal(H264Context *h, uint8_t *src, int *dst_length, int *c return dst; } -#if 0 -/** - * @param src the data which should be escaped - * @param dst the target buffer, dst+1 == src is allowed as a special case - * @param length the length of the src data - * @param dst_length the length of the dst array - * @returns length of escaped data in bytes or -1 if an error occured - */ -static int encode_nal(H264Context *h, uint8_t *dst, uint8_t *src, int length, int dst_length){ - int i, escape_count, si, di; - uint8_t *temp; - - assert(length>=0); - assert(dst_length>0); - - dst[0]= (h->nal_ref_idc<<5) + h->nal_unit_type; - - if(length==0) return 1; - - escape_count= 0; - for(i=0; i0 && src[i-1]==0) - i--; - if(i+2 dst_length) - return -1; - - //this should be damn rare (hopefully) - - h->rbsp_buffer= av_fast_realloc(h->rbsp_buffer, &h->rbsp_buffer_size, length + escape_count); - temp= h->rbsp_buffer; -//printf("encoding esc\n"); - - si= 0; - di= 0; - while(si < length){ - if(si+2>2; } -static void pred16x16_vertical_c(uint8_t *src, int stride){ +void ff_pred16x16_vertical_c(uint8_t *src, int stride){ int i; const uint32_t a= ((uint32_t*)(src-stride))[0]; const uint32_t b= ((uint32_t*)(src-stride))[1]; @@ -2372,7 +2256,7 @@ static void pred16x16_vertical_c(uint8_t *src, int stride){ } } -static void pred16x16_horizontal_c(uint8_t *src, int stride){ +void ff_pred16x16_horizontal_c(uint8_t *src, int stride){ int i; for(i=0; i<16; i++){ @@ -2383,7 +2267,7 @@ static void pred16x16_horizontal_c(uint8_t *src, int stride){ } } -static void pred16x16_dc_c(uint8_t *src, int stride){ +void ff_pred16x16_dc_c(uint8_t *src, int stride){ int i, dc=0; for(i=0;i<16; i++){ @@ -2437,7 +2321,7 @@ static void pred16x16_top_dc_c(uint8_t *src, int stride){ } } -static void pred16x16_128_dc_c(uint8_t *src, int stride){ +void ff_pred16x16_128_dc_c(uint8_t *src, int stride){ int i; for(i=0; i<16; i++){ @@ -2488,11 +2372,11 @@ static inline void pred16x16_plane_compat_c(uint8_t *src, int stride, const int } } -static void pred16x16_plane_c(uint8_t *src, int stride){ +void ff_pred16x16_plane_c(uint8_t *src, int stride){ pred16x16_plane_compat_c(src, stride, 0); } -static void pred8x8_vertical_c(uint8_t *src, int stride){ +void ff_pred8x8_vertical_c(uint8_t *src, int stride){ int i; const uint32_t a= ((uint32_t*)(src-stride))[0]; const uint32_t b= ((uint32_t*)(src-stride))[1]; @@ -2503,7 +2387,7 @@ static void pred8x8_vertical_c(uint8_t *src, int stride){ } } -static void pred8x8_horizontal_c(uint8_t *src, int stride){ +void ff_pred8x8_horizontal_c(uint8_t *src, int stride){ int i; for(i=0; i<8; i++){ @@ -2512,7 +2396,7 @@ static void pred8x8_horizontal_c(uint8_t *src, int stride){ } } -static void pred8x8_128_dc_c(uint8_t *src, int stride){ +void ff_pred8x8_128_dc_c(uint8_t *src, int stride){ int i; for(i=0; i<8; i++){ @@ -2566,7 +2450,7 @@ static void pred8x8_top_dc_c(uint8_t *src, int stride){ } -static void pred8x8_dc_c(uint8_t *src, int stride){ +void ff_pred8x8_dc_c(uint8_t *src, int stride){ int i; int dc0, dc1, dc2, dc3; @@ -2591,7 +2475,7 @@ static void pred8x8_dc_c(uint8_t *src, int stride){ } } -static void pred8x8_plane_c(uint8_t *src, int stride){ +void ff_pred8x8_plane_c(uint8_t *src, int stride){ int j, k; int a; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; @@ -3220,21 +3104,21 @@ static void init_pred_ptrs(H264Context *h){ h->pred8x8l[TOP_DC_PRED ]= pred8x8l_top_dc_c; h->pred8x8l[DC_128_PRED ]= pred8x8l_128_dc_c; - h->pred8x8[DC_PRED8x8 ]= pred8x8_dc_c; - h->pred8x8[VERT_PRED8x8 ]= pred8x8_vertical_c; - h->pred8x8[HOR_PRED8x8 ]= pred8x8_horizontal_c; - h->pred8x8[PLANE_PRED8x8 ]= pred8x8_plane_c; + h->pred8x8[DC_PRED8x8 ]= ff_pred8x8_dc_c; + h->pred8x8[VERT_PRED8x8 ]= ff_pred8x8_vertical_c; + h->pred8x8[HOR_PRED8x8 ]= ff_pred8x8_horizontal_c; + h->pred8x8[PLANE_PRED8x8 ]= ff_pred8x8_plane_c; h->pred8x8[LEFT_DC_PRED8x8]= pred8x8_left_dc_c; h->pred8x8[TOP_DC_PRED8x8 ]= pred8x8_top_dc_c; - h->pred8x8[DC_128_PRED8x8 ]= pred8x8_128_dc_c; + h->pred8x8[DC_128_PRED8x8 ]= ff_pred8x8_128_dc_c; - h->pred16x16[DC_PRED8x8 ]= pred16x16_dc_c; - h->pred16x16[VERT_PRED8x8 ]= pred16x16_vertical_c; - h->pred16x16[HOR_PRED8x8 ]= pred16x16_horizontal_c; - h->pred16x16[PLANE_PRED8x8 ]= pred16x16_plane_c; + h->pred16x16[DC_PRED8x8 ]= ff_pred16x16_dc_c; + h->pred16x16[VERT_PRED8x8 ]= ff_pred16x16_vertical_c; + h->pred16x16[HOR_PRED8x8 ]= ff_pred16x16_horizontal_c; + h->pred16x16[PLANE_PRED8x8 ]= ff_pred16x16_plane_c; h->pred16x16[LEFT_DC_PRED8x8]= pred16x16_left_dc_c; h->pred16x16[TOP_DC_PRED8x8 ]= pred16x16_top_dc_c; - h->pred16x16[DC_128_PRED8x8 ]= pred16x16_128_dc_c; + h->pred16x16[DC_128_PRED8x8 ]= ff_pred16x16_128_dc_c; } static void free_tables(H264Context *h){ @@ -3269,8 +3153,8 @@ static void init_dequant8_coeff_table(H264Context *h){ } for(q=0; q<52; q++){ - int shift = div6[q]; - int idx = rem6[q]; + int shift = ff_div6[q]; + int idx = ff_rem6[q]; for(x=0; x<64; x++) h->dequant8_coeff[i][q][transpose ? (x>>3)|((x&7)<<3) : x] = ((uint32_t)dequant8_coeff_init[idx][ dequant8_coeff_init_scan[((x>>1)&12) | (x&3)] ] * @@ -3294,8 +3178,8 @@ static void init_dequant4_coeff_table(H264Context *h){ continue; for(q=0; q<52; q++){ - int shift = div6[q] + 2; - int idx = rem6[q]; + int shift = ff_div6[q] + 2; + int idx = ff_rem6[q]; for(x=0; x<16; x++) h->dequant4_coeff[i][q][transpose ? (x>>2)|((x<<2)&0xF) : x] = ((uint32_t)dequant4_coeff_init[idx][(x&1) + ((x>>2)&1)] * @@ -4972,6 +4856,10 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in if(total_coeff==0) return 0; + if(total_coeff<0) { + av_log(h->s.avctx, AV_LOG_ERROR, "corrupted macroblock %d %d (total_coeff<0)\n", s->mb_x, s->mb_y); + return -1; + } trailing_ones= coeff_token&3; tprintf("trailing:%d, total:%d\n", trailing_ones, total_coeff); diff --git a/src/libffmpeg/libavcodec/h264data.h b/src/libffmpeg/libavcodec/h264data.h index 2dea3580f..74e720421 100644 --- a/src/libffmpeg/libavcodec/h264data.h +++ b/src/libffmpeg/libavcodec/h264data.h @@ -53,6 +53,24 @@ #define EXTENDED_SAR 255 +/* NAL unit types */ +enum { +NAL_SLICE=1, +NAL_DPA, +NAL_DPB, +NAL_DPC, +NAL_IDR_SLICE, +NAL_SEI, +NAL_SPS, +NAL_PPS, +NAL_AUD, +NAL_END_SEQUENCE, +NAL_END_STREAM, +NAL_FILLER_DATA, +NAL_SPS_EXT, +NAL_AUXILIARY_SLICE=19 +}; + static const AVRational pixel_aspect[14]={ {0, 1}, {1, 1}, @@ -488,15 +506,6 @@ static const PMbInfo b_sub_mb_type_info[13]={ {MB_TYPE_8x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 4, }, }; - -static const uint8_t rem6[52]={ -0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, -}; - -static const uint8_t div6[52]={ -0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, -}; - static const uint8_t default_scaling4[2][16]={ { 6,13,20,28, 13,20,28,32, diff --git a/src/libffmpeg/libavcodec/h264idct.c b/src/libffmpeg/libavcodec/h264idct.c index 3506418ad..a6a56d33a 100755 --- a/src/libffmpeg/libavcodec/h264idct.c +++ b/src/libffmpeg/libavcodec/h264idct.c @@ -28,7 +28,7 @@ #include "dsputil.h" -static always_inline void idct_internal(uint8_t *dst, DCTELEM *block, int stride, int block_stride, int shift, int add){ +static av_always_inline void idct_internal(uint8_t *dst, DCTELEM *block, int stride, int block_stride, int shift, int add){ int i; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; diff --git a/src/libffmpeg/libavcodec/i386/Makefile.am b/src/libffmpeg/libavcodec/i386/Makefile.am index 15ab4db89..ee170efd5 100644 --- a/src/libffmpeg/libavcodec/i386/Makefile.am +++ b/src/libffmpeg/libavcodec/i386/Makefile.am @@ -6,7 +6,7 @@ AM_CFLAGS = -fomit-frame-pointer -fno-strict-aliasing # CFLAGS is here to filter out -funroll-loops because it causes bad # behavior of libavcodec CFLAGS := `echo @CFLAGS@ | sed -e 's/-funroll-loops//g'` -AM_CPPFLAGS = $(LIBFFMPEG_CPPFLAGS) -I$(top_srcdir)/src/libffmpeg/libavutil +AM_CPPFLAGS = $(LIBFFMPEG_CPPFLAGS) -I$(top_srcdir)/src/libffmpeg/libavutil -I$(top_srcdir)/src/libffmpeg # Avoid "can't find register" failures with -O1 and higher dsputil_mmx.o dsputil_mmx.lo: CFLAGS=$(shell echo @CFLAGS@ | sed -e 's/-funroll-loops//g; s/$$/ -Os/') @@ -42,10 +42,10 @@ EXTRA_DIST = \ h264dsp_mmx.c \ mpegvideo_mmx_template.c -if HAVE_FFMMX +if HAVE_MMX mmx_modules = $(libavcodec_mmx_src) endif libavcodec_mmx_la_SOURCES = $(mmx_modules) $(libavcodec_mmx_dummy) -noinst_HEADERS = dsputil_mmx_avg.h dsputil_mmx_rnd.h mmx.h +noinst_HEADERS = dsputil_mmx_avg.h dsputil_mmx_rnd.h mathops.h mmx.h diff --git a/src/libffmpeg/libavcodec/i386/cputest.c b/src/libffmpeg/libavcodec/i386/cputest.c index 262786b71..0705ab3e5 100644 --- a/src/libffmpeg/libavcodec/i386/cputest.c +++ b/src/libffmpeg/libavcodec/i386/cputest.c @@ -87,6 +87,8 @@ int mm_support(void) rval |= MM_SSE2; if (ecx & 1) rval |= MM_SSE3; + if (ecx & 0x00000200 ) + rval |= MM_SSSE3; } cpuid(0x80000000, max_ext_level, ebx, ecx, edx); @@ -104,11 +106,13 @@ int mm_support(void) } #if 0 - av_log(NULL, AV_LOG_DEBUG, "%s%s%s%s%s%s\n", + av_log(NULL, AV_LOG_DEBUG, "%s%s%s%s%s%s%s%s\n", (rval&MM_MMX) ? "MMX ":"", (rval&MM_MMXEXT) ? "MMX2 ":"", (rval&MM_SSE) ? "SSE ":"", (rval&MM_SSE2) ? "SSE2 ":"", + (rval&MM_SSE3) ? "SSE3 ":"", + (rval&MM_SSSE3) ? "SSSE3 ":"", (rval&MM_3DNOW) ? "3DNow ":"", (rval&MM_3DNOWEXT) ? "3DNowExt ":""); #endif diff --git a/src/libffmpeg/libavcodec/i386/fdct_mmx.c b/src/libffmpeg/libavcodec/i386/fdct_mmx.c index 2ffbfecf6..7e2682a4a 100644 --- a/src/libffmpeg/libavcodec/i386/fdct_mmx.c +++ b/src/libffmpeg/libavcodec/i386/fdct_mmx.c @@ -284,7 +284,7 @@ TABLE_SSE2 }}; -static always_inline void fdct_col(const int16_t *in, int16_t *out, int offset) +static av_always_inline void fdct_col(const int16_t *in, int16_t *out, int offset) { movq_m2r(*(in + offset + 1 * 8), mm0); movq_m2r(*(in + offset + 6 * 8), mm1); @@ -364,7 +364,7 @@ static always_inline void fdct_col(const int16_t *in, int16_t *out, int offset) } -static always_inline void fdct_row_sse2(const int16_t *in, int16_t *out) +static av_always_inline void fdct_row_sse2(const int16_t *in, int16_t *out) { asm volatile( #define FDCT_ROW_SSE2_H1(i,t) \ @@ -426,7 +426,7 @@ static always_inline void fdct_row_sse2(const int16_t *in, int16_t *out) ); } -static always_inline void fdct_row_mmx2(const int16_t *in, int16_t *out, const int16_t *table) +static av_always_inline void fdct_row_mmx2(const int16_t *in, int16_t *out, const int16_t *table) { pshufw_m2r(*(in + 4), mm5, 0x1B); movq_m2r(*(in + 0), mm0); @@ -469,7 +469,7 @@ static always_inline void fdct_row_mmx2(const int16_t *in, int16_t *out, const i movq_r2m(mm7, *(out + 4)); } -static always_inline void fdct_row_mmx(const int16_t *in, int16_t *out, const int16_t *table) +static av_always_inline void fdct_row_mmx(const int16_t *in, int16_t *out, const int16_t *table) { //FIXME reorder (i dont have a old mmx only cpu here to benchmark ...) movd_m2r(*(in + 6), mm1); diff --git a/src/libffmpeg/libavcodec/i386/mathops.h b/src/libffmpeg/libavcodec/i386/mathops.h new file mode 100644 index 000000000..3553a4025 --- /dev/null +++ b/src/libffmpeg/libavcodec/i386/mathops.h @@ -0,0 +1,41 @@ +/* + * simple math operations + * Copyright (c) 2006 Michael Niedermayer et al + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifdef FRAC_BITS +# define MULL(ra, rb) \ + ({ int rt, dummy; asm (\ + "imull %3 \n\t"\ + "shrdl %4, %%edx, %%eax \n\t"\ + : "=a"(rt), "=d"(dummy)\ + : "a" (ra), "rm" (rb), "i"(FRAC_BITS));\ + rt; }) +#endif + +#define MULH(ra, rb) \ + ({ int rt, dummy;\ + asm ("imull %3\n\t" : "=d"(rt), "=a"(dummy): "a" (ra), "rm" (rb));\ + rt; }) + +#define MUL64(ra, rb) \ + ({ int64_t rt;\ + asm ("imull %2\n\t" : "=A"(rt) : "a" (ra), "g" (rb));\ + rt; }) + diff --git a/src/libffmpeg/libavcodec/jfdctfst.c b/src/libffmpeg/libavcodec/jfdctfst.c index 38424563d..a9dcfab82 100644 --- a/src/libffmpeg/libavcodec/jfdctfst.c +++ b/src/libffmpeg/libavcodec/jfdctfst.c @@ -145,7 +145,7 @@ #define MULTIPLY(var,const) ((DCTELEM) DESCALE((var) * (const), CONST_BITS)) -static always_inline void row_fdct(DCTELEM * data){ +static av_always_inline void row_fdct(DCTELEM * data){ int_fast16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int_fast16_t tmp10, tmp11, tmp12, tmp13; int_fast16_t z1, z2, z3, z4, z5, z11, z13; diff --git a/src/libffmpeg/libavcodec/jfdctint.c b/src/libffmpeg/libavcodec/jfdctint.c index 58f3a1446..250312467 100644 --- a/src/libffmpeg/libavcodec/jfdctint.c +++ b/src/libffmpeg/libavcodec/jfdctint.c @@ -181,7 +181,7 @@ #endif -static always_inline void row_fdct(DCTELEM * data){ +static av_always_inline void row_fdct(DCTELEM * data){ int_fast32_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int_fast32_t tmp10, tmp11, tmp12, tmp13; int_fast32_t z1, z2, z3, z4, z5; diff --git a/src/libffmpeg/libavcodec/jpeg_ls.c b/src/libffmpeg/libavcodec/jpeg_ls.c index 1b4df2b1a..4629176ad 100644 --- a/src/libffmpeg/libavcodec/jpeg_ls.c +++ b/src/libffmpeg/libavcodec/jpeg_ls.c @@ -804,11 +804,16 @@ static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_ av_free(zero); av_free(state); + // the specification says that after doing 0xff escaping unused bits in the + // last byte must be set to 0, so just append 7 "optional" zero-bits to + // avoid special-casing. + put_bits(&pb2, 7, 0); + size = put_bits_count(&pb2); flush_put_bits(&pb2); /* do escape coding */ - size = put_bits_count(&pb2) >> 3; init_get_bits(&gb, buf2, size); - while(get_bits_count(&gb) < size * 8){ + size -= 7; + while(get_bits_count(&gb) < size){ int v; v = get_bits(&gb, 8); put_bits(&pb, 8, v); diff --git a/src/libffmpeg/libavcodec/mathops.h b/src/libffmpeg/libavcodec/mathops.h index 9ae34d71b..c6ec70597 100644 --- a/src/libffmpeg/libavcodec/mathops.h +++ b/src/libffmpeg/libavcodec/mathops.h @@ -46,7 +46,7 @@ //gcc 3.4 creates an incredibly bloated mess out of this //# define MULH(a,b) (((int64_t)(a) * (int64_t)(b))>>32) -static always_inline int MULH(int a, int b){ +static av_always_inline int MULH(int a, int b){ return ((int64_t)(a) * (int64_t)(b))>>32; } #endif diff --git a/src/libffmpeg/libavcodec/motion_est.c b/src/libffmpeg/libavcodec/motion_est.c index 0e1504147..a11787bac 100644 --- a/src/libffmpeg/libavcodec/motion_est.c +++ b/src/libffmpeg/libavcodec/motion_est.c @@ -106,7 +106,7 @@ static int get_flags(MotionEstContext *c, int direct, int chroma){ + (chroma ? FLAG_CHROMA : 0); } -static always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, +static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ MotionEstContext * const c= &s->me; @@ -122,6 +122,7 @@ static always_inline int cmp(MpegEncContext *s, const int x, const int y, const int d; //FIXME check chroma 4mv, (no crashes ...) if(flags&FLAG_DIRECT){ + assert(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)); if(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)){ const int time_pp= s->pp_time; const int time_pb= s->pb_time; @@ -233,8 +234,14 @@ static void zero_hpel(uint8_t *a, const uint8_t *b, int stride, int h){ void ff_init_me(MpegEncContext *s){ MotionEstContext * const c= &s->me; + int cache_size= FFMIN(ME_MAP_SIZE>>ME_MAP_SHIFT, 1<avctx->dia_size)&255, FFABS(s->avctx->pre_dia_size)&255); c->avctx= s->avctx; + if(cache_size < 2*dia_size && !c->stride){ + av_log(s->avctx, AV_LOG_INFO, "ME_MAP size may be a little small for the selected diamond size\n"); + } + ff_set_cmp(&s->dsp, s->dsp.me_pre_cmp, c->avctx->me_pre_cmp); ff_set_cmp(&s->dsp, s->dsp.me_cmp, c->avctx->me_cmp); ff_set_cmp(&s->dsp, s->dsp.me_sub_cmp, c->avctx->me_sub_cmp); @@ -692,6 +699,7 @@ static inline void set_p_mv_tables(MpegEncContext * s, int mx, int my, int mv4) static inline void get_limits(MpegEncContext *s, int x, int y) { MotionEstContext * const c= &s->me; + int range= c->avctx->me_range >> (1 + !!(c->flags&FLAG_QPEL)); /* if(c->avctx->me_range) c->range= c->avctx->me_range >> 1; else c->range= 16; @@ -713,6 +721,12 @@ static inline void get_limits(MpegEncContext *s, int x, int y) c->xmax = - x + s->mb_width *16 - 16; c->ymax = - y + s->mb_height*16 - 16; } + if(range){ + c->xmin = FFMAX(c->xmin,-range); + c->xmax = FFMIN(c->xmax, range); + c->ymin = FFMAX(c->ymin,-range); + c->ymax = FFMIN(c->ymax, range); + } } static inline void init_mv4_ref(MotionEstContext *c){ @@ -1148,7 +1162,9 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, { MotionEstContext * const c= &s->me; uint8_t *pix, *ppix; - int sum, varc, vard, mx, my, dmin; + int sum, mx, my, dmin; + int varc; ///< the variance of the block (sum of squared (p[y][x]-average)) + int vard; ///< sum of squared differences with the estimated motion vector int P[10][2]; const int shift= 1+s->quarter_sample; int mb_type=0; @@ -1810,8 +1826,8 @@ static inline int direct_search(MpegEncContext * s, int mb_x, int mb_y) get_limits(s, 16*mb_x, 16*mb_y); //restore c->?min/max, maybe not needed - s->b_direct_mv_table[mot_xy][0]= mx; - s->b_direct_mv_table[mot_xy][1]= my; + mv_table[mot_xy][0]= mx; + mv_table[mot_xy][1]= my; c->flags &= ~FLAG_DIRECT; c->sub_flags &= ~FLAG_DIRECT; @@ -1831,6 +1847,18 @@ void ff_estimate_b_frame_motion(MpegEncContext * s, get_limits(s, 16*mb_x, 16*mb_y); c->skip=0; + + if(s->codec_id == CODEC_ID_MPEG4 && s->next_picture.mbskip_table[xy]){ + int score= direct_search(s, mb_x, mb_y); //FIXME just check 0,0 + + score= ((unsigned)(score*score + 128*256))>>16; + c->mc_mb_var_sum_temp += score; + s->current_picture.mc_mb_var[mb_y*s->mb_stride + mb_x] = score; //FIXME use SSE + s->mb_type[mb_y*s->mb_stride + mb_x]= CANDIDATE_MB_TYPE_DIRECT0; + + return; + } + if(c->avctx->me_threshold){ int vard= check_input_motion(s, mb_x, mb_y, 0); @@ -1953,6 +1981,8 @@ void ff_estimate_b_frame_motion(MpegEncContext * s, } //FIXME something smarter if(dmin>256*256*16) type&= ~CANDIDATE_MB_TYPE_DIRECT; //dont try direct mode if its invalid for this MB + if(s->codec_id == CODEC_ID_MPEG4 && type&CANDIDATE_MB_TYPE_DIRECT && s->flags&CODEC_FLAG_MV0 && *(uint32_t*)s->b_direct_mv_table[xy]) + type |= CANDIDATE_MB_TYPE_DIRECT0; #if 0 if(s->out_format == FMT_MPEG1) type |= CANDIDATE_MB_TYPE_INTRA; diff --git a/src/libffmpeg/libavcodec/motion_est_template.c b/src/libffmpeg/libavcodec/motion_est_template.c index d8feaff5a..897c08e3d 100644 --- a/src/libffmpeg/libavcodec/motion_est_template.c +++ b/src/libffmpeg/libavcodec/motion_est_template.c @@ -555,7 +555,7 @@ if( (y)>(ymax<<(S)) ) printf("%d %d %d %d %d ymax" #v, ymax, (x), (y), s->mb_x, const int qpel= flags&FLAG_QPEL;\ const int shift= 1+qpel;\ -static always_inline int small_diamond_search(MpegEncContext * s, int *best, int dmin, +static av_always_inline int small_diamond_search(MpegEncContext * s, int *best, int dmin, int src_index, int ref_index, int const penalty_factor, int size, int h, int flags) { @@ -667,31 +667,28 @@ static int hex_search(MpegEncContext * s, int *best, int dmin, LOAD_COMMON LOAD_COMMON2 int map_generation= c->map_generation; - int x,y,i,d; - static const int hex[6][2]={{-2, 0}, { 2,0}, {-1,-2}, {1,-2}, {-1,2},{1,2}}; + int x,y,d; + const int dec= dia_size & (dia_size-1); cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; - for(;dia_size; dia_size--){ + for(;dia_size; dia_size= dec ? dia_size-1 : dia_size>>1){ do{ x= best[0]; y= best[1]; - for(i=0; i<6; i++){ - CHECK_CLIPPED_MV(x+hex[i][0]*dia_size, y+hex[i][1]*dia_size); + + CHECK_CLIPPED_MV(x -dia_size , y); + CHECK_CLIPPED_MV(x+ dia_size , y); + CHECK_CLIPPED_MV(x+( dia_size>>1), y+dia_size); + CHECK_CLIPPED_MV(x+( dia_size>>1), y-dia_size); + if(dia_size>1){ + CHECK_CLIPPED_MV(x+(-dia_size>>1), y+dia_size); + CHECK_CLIPPED_MV(x+(-dia_size>>1), y-dia_size); } }while(best[0] != x || best[1] != y); } - do{ - x= best[0]; - y= best[1]; - CHECK_CLIPPED_MV(x+1, y); - CHECK_CLIPPED_MV(x, y+1); - CHECK_CLIPPED_MV(x-1, y); - CHECK_CLIPPED_MV(x, y-1); - }while(best[0] != x || best[1] != y); - return dmin; } @@ -704,14 +701,16 @@ static int l2s_dia_search(MpegEncContext * s, int *best, int dmin, LOAD_COMMON LOAD_COMMON2 int map_generation= c->map_generation; - int x,y,i,d, dia_size; + int x,y,i,d; + int dia_size= c->dia_size&0xFF; + const int dec= dia_size & (dia_size-1); static const int hex[8][2]={{-2, 0}, {-1,-1}, { 0,-2}, { 1,-1}, { 2, 0}, { 1, 1}, { 0, 2}, {-1, 1}}; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; - for(dia_size= c->dia_size&0xFF; dia_size; dia_size--){ + for(; dia_size; dia_size= dec ? dia_size-1 : dia_size>>1){ do{ x= best[0]; y= best[1]; @@ -775,7 +774,7 @@ static int umh_search(MpegEncContext * s, int *best, int dmin, } } - return hex_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags, 1); + return hex_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags, 2); } #define SAB_CHECK_MV(ax,ay)\ @@ -824,20 +823,27 @@ static int sab_diamond_search(MpegEncContext * s, int *best, int dmin, cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; - for(j=i=0; i>=ME_MAP_MV_BITS; minima[j].y= key & ((1< xmax || minima[j].x < xmin + || minima[j].y > ymax || minima[j].y < ymin) + continue; + minima[j].checked=0; if(minima[j].x || minima[j].y) minima[j].height+= (mv_penalty[((minima[j].x)<me; @@ -985,7 +991,7 @@ static always_inline int diamond_search(MpegEncContext * s, int *best, int dmin, return var_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); } -static always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr, +static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale, int flags, int size, int h) { @@ -1018,6 +1024,10 @@ static always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx map[0]= map_generation; score_map[0]= dmin; + //FIXME precalc first term below? + if((s->pict_type == B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0) + dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor; + /* first line */ if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) diff --git a/src/libffmpeg/libavcodec/mpeg12.c b/src/libffmpeg/libavcodec/mpeg12.c index e3a4c2da5..8af7bdfa7 100644 --- a/src/libffmpeg/libavcodec/mpeg12.c +++ b/src/libffmpeg/libavcodec/mpeg12.c @@ -515,7 +515,7 @@ static inline void put_mb_modes(MpegEncContext *s, int n, int bits, } } -static always_inline void mpeg1_encode_mb_internal(MpegEncContext *s, +static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s, DCTELEM block[6][64], int motion_x, int motion_y, int mb_block_count) diff --git a/src/libffmpeg/libavcodec/mpegaudiodec.c b/src/libffmpeg/libavcodec/mpegaudiodec.c index 54bcee3b0..367400581 100644 --- a/src/libffmpeg/libavcodec/mpegaudiodec.c +++ b/src/libffmpeg/libavcodec/mpegaudiodec.c @@ -327,7 +327,7 @@ static int decode_init(AVCodecContext * avctx) for(i=0;i<15;i++) { int n, norm; n = i + 2; - norm = ((int64_t_C(1) << n) * FRAC_ONE) / ((1 << n) - 1); + norm = ((INT64_C(1) << n) * FRAC_ONE) / ((1 << n) - 1); scale_factor_mult[i][0] = MULL(FIXR(1.0 * 2.0), norm); scale_factor_mult[i][1] = MULL(FIXR(0.7937005259 * 2.0), norm); scale_factor_mult[i][2] = MULL(FIXR(0.6299605249 * 2.0), norm); @@ -1749,7 +1749,7 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g, /* skip extension bits */ bits_left = end_pos - get_bits_count(&s->gb); //av_log(NULL, AV_LOG_ERROR, "left:%d buf:%p\n", bits_left, s->in_gb.buffer); - if (bits_left < 0 || bits_left > 16) { + if (bits_left < 0 || bits_left > 500) { av_log(NULL, AV_LOG_ERROR, "bits_left=%d\n", bits_left); s_index=0; }else if(bits_left > 0 && s->error_resilience >= FF_ER_AGGRESSIVE){ diff --git a/src/libffmpeg/libavcodec/mpegvideo.c b/src/libffmpeg/libavcodec/mpegvideo.c index a9d877fff..a33485549 100644 --- a/src/libffmpeg/libavcodec/mpegvideo.c +++ b/src/libffmpeg/libavcodec/mpegvideo.c @@ -140,7 +140,7 @@ static void convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[ /* (1<<36)/19952 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */ /* 3444240 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= 275 */ - qmat[qscale][i] = (int)((uint64_t_C(1) << QMAT_SHIFT) / + qmat[qscale][i] = (int)((UINT64_C(1) << QMAT_SHIFT) / (qscale * quant_matrix[j])); } } else if (dsp->fdct == fdct_ifast @@ -155,7 +155,7 @@ static void convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[ /* (1<<36)/19952 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */ /* 3444240 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= 275 */ - qmat[qscale][i] = (int)((uint64_t_C(1) << (QMAT_SHIFT + 14)) / + qmat[qscale][i] = (int)((UINT64_C(1) << (QMAT_SHIFT + 14)) / (aanscales[i] * qscale * quant_matrix[j])); } } else { @@ -166,7 +166,7 @@ static void convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[ so (1<<19) / 16 >= (1<<19) / (qscale * quant_matrix[i]) >= (1<<19) / 7905 so 32768 >= (1<<19) / (qscale * quant_matrix[i]) >= 67 */ - qmat[qscale][i] = (int)((uint64_t_C(1) << QMAT_SHIFT) / (qscale * quant_matrix[j])); + qmat[qscale][i] = (int)((UINT64_C(1) << QMAT_SHIFT) / (qscale * quant_matrix[j])); // qmat [qscale][i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[i]); qmat16[qscale][0][i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[j]); @@ -2964,7 +2964,7 @@ static inline int hpel_motion_lowres(MpegEncContext *s, } /* apply one mpeg motion vector to the three components */ -static always_inline void mpeg_motion(MpegEncContext *s, +static av_always_inline void mpeg_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int field_based, int bottom_field, int field_select, uint8_t **ref_picture, op_pixels_func (*pix_op)[4], @@ -3081,7 +3081,7 @@ if(s->quarter_sample) } /* apply one mpeg motion vector to the three components */ -static always_inline void mpeg_motion_lowres(MpegEncContext *s, +static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int field_based, int bottom_field, int field_select, uint8_t **ref_picture, h264_chroma_mc_func *pix_op, @@ -3913,7 +3913,7 @@ void ff_clean_intra_table_entries(MpegEncContext *s) s->mv : motion vector s->interlaced_dct : true if interlaced dct used (mpeg2) */ -static always_inline void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64], int lowres_flag) +static av_always_inline void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64], int lowres_flag) { int mb_x, mb_y; const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; @@ -4336,7 +4336,7 @@ static void get_vissual_weight(int16_t *weight, uint8_t *ptr, int stride){ } } -static always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count) +static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count) { int16_t weight[8][64]; DCTELEM orig[8][64]; @@ -4348,7 +4348,7 @@ static always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, in uint8_t *ptr_y, *ptr_cb, *ptr_cr; int wrap_y, wrap_c; - for(i=0; iskipdct; if(s->adaptive_quant){ const int last_qp= s->qscale; @@ -4358,17 +4358,16 @@ static always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, in update_qscale(s); if(!(s->flags&CODEC_FLAG_QP_RD)){ + s->qscale= s->current_picture_ptr->qscale_table[mb_xy]; s->dquant= s->qscale - last_qp; if(s->out_format==FMT_H263){ - s->dquant= clip(s->dquant, -2, 2); //FIXME RD + s->dquant= clip(s->dquant, -2, 2); if(s->codec_id==CODEC_ID_MPEG4){ if(!s->mb_intra){ if(s->pict_type == B_TYPE){ - if(s->dquant&1) - s->dquant= (s->dquant/2)*2; - if(s->mv_dir&MV_DIRECT) + if(s->dquant&1 || s->mv_dir&MV_DIRECT) s->dquant= 0; } if(s->mv_type==MV_TYPE_8X8) @@ -4621,7 +4620,7 @@ static always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, in } } -static always_inline void encode_mb(MpegEncContext *s, int motion_x, int motion_y) +static av_always_inline void encode_mb(MpegEncContext *s, int motion_x, int motion_y) { if (s->chroma_format == CHROMA_420) encode_mb_internal(s, motion_x, motion_y, 8, 6); else encode_mb_internal(s, motion_x, motion_y, 16, 8); @@ -4861,6 +4860,8 @@ static int pre_estimate_motion_thread(AVCodecContext *c, void *arg){ static int estimate_motion_thread(AVCodecContext *c, void *arg){ MpegEncContext *s= arg; + ff_check_alignment(); + s->me.dia_size= s->avctx->dia_size; s->first_slice_line=1; for(s->mb_y= s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) { @@ -4888,6 +4889,8 @@ static int mb_var_thread(AVCodecContext *c, void *arg){ MpegEncContext *s= arg; int mb_x, mb_y; + ff_check_alignment(); + for(mb_y=s->start_mb_y; mb_y < s->end_mb_y; mb_y++) { for(mb_x=0; mb_x < s->mb_width; mb_x++) { int xx = mb_x * 16; @@ -4938,6 +4941,8 @@ static int encode_thread(AVCodecContext *c, void *arg){ PutBitContext pb[2], pb2[2], tex_pb[2]; //printf("%d->%d\n", s->resync_mb_y, s->end_mb_y); + ff_check_alignment(); + for(i=0; i<2; i++){ init_put_bits(&pb [i], bit_buf [i], MAX_MB_BYTES); init_put_bits(&pb2 [i], bit_buf2 [i], MAX_MB_BYTES); @@ -5205,19 +5210,6 @@ static int encode_thread(AVCodecContext *c, void *arg){ encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BIDIR, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } - if(mb_type&CANDIDATE_MB_TYPE_DIRECT){ - int mx= s->b_direct_mv_table[xy][0]; - int my= s->b_direct_mv_table[xy][1]; - - s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; - s->mb_intra= 0; -/* xine: do not need this for decode or MPEG-1 encoding modes */ -#if 0 - ff_mpeg4_set_direct_mv(s, mx, my); -#endif /* #if 0 */ - encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb, - &dmin, &next_block, mx, my); - } if(mb_type&CANDIDATE_MB_TYPE_FORWARD_I){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_FIELD; @@ -5272,8 +5264,8 @@ static int encode_thread(AVCodecContext *c, void *arg){ } } - if(s->flags & CODEC_FLAG_QP_RD){ - if(best_s.mv_type==MV_TYPE_16X16 && !(best_s.mv_dir&MV_DIRECT)){ + if((s->flags & CODEC_FLAG_QP_RD) && dmin < INT_MAX){ + if(best_s.mv_type==MV_TYPE_16X16){ //FIXME move 4mv after QPRD const int last_qp= backup_s.qscale; int qpi, qp, dc[6]; DCTELEM ac[6][16]; @@ -5316,10 +5308,64 @@ static int encode_thread(AVCodecContext *c, void *arg){ } } } - qp= best_s.qscale; - s->current_picture.qscale_table[xy]= qp; } } + if(mb_type&CANDIDATE_MB_TYPE_DIRECT){ + int mx= s->b_direct_mv_table[xy][0]; + int my= s->b_direct_mv_table[xy][1]; + + backup_s.dquant = 0; + s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; + s->mb_intra= 0; + ff_mpeg4_set_direct_mv(s, mx, my); + encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb, + &dmin, &next_block, mx, my); + } + if(mb_type&CANDIDATE_MB_TYPE_DIRECT0){ + backup_s.dquant = 0; + s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; + s->mb_intra= 0; +/* xine: do not need this for decode or MPEG-1 encoding modes */ +#if 0 + ff_mpeg4_set_direct_mv(s, 0, 0); +#endif /* #if 0 */ + encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb, + &dmin, &next_block, 0, 0); + } + if(!best_s.mb_intra && s->flags2&CODEC_FLAG2_SKIP_RD){ + int coded=0; + for(i=0; i<6; i++) + coded |= s->block_last_index[i]; + if(coded){ + int mx,my; + memcpy(s->mv, best_s.mv, sizeof(s->mv)); + if(best_s.mv_dir & MV_DIRECT){ + mx=my=0; //FIXME find the one we actually used + ff_mpeg4_set_direct_mv(s, mx, my); + }else if(best_s.mv_dir&MV_DIR_BACKWARD){ + mx= s->mv[1][0][0]; + my= s->mv[1][0][1]; + }else{ + mx= s->mv[0][0][0]; + my= s->mv[0][0][1]; + } + + s->mv_dir= best_s.mv_dir; + s->mv_type = best_s.mv_type; + s->mb_intra= 0; +/* s->mv[0][0][0] = best_s.mv[0][0][0]; + s->mv[0][0][1] = best_s.mv[0][0][1]; + s->mv[1][0][0] = best_s.mv[1][0][0]; + s->mv[1][0][1] = best_s.mv[1][0][1];*/ + backup_s.dquant= 0; + s->skipdct=1; + encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER /* wrong but unused */, pb, pb2, tex_pb, + &dmin, &next_block, mx, my); + s->skipdct=0; + } + } + + s->current_picture.qscale_table[xy]= best_s.qscale; copy_context_after_encode(s, &best_s, -1); @@ -5401,6 +5447,11 @@ static int encode_thread(AVCodecContext *c, void *arg){ ff_mpeg4_set_direct_mv(s, motion_x, motion_y); #endif /* #if 0 */ break; + case CANDIDATE_MB_TYPE_DIRECT0: + s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; + s->mb_intra= 0; + ff_mpeg4_set_direct_mv(s, 0, 0); + break; case CANDIDATE_MB_TYPE_BIDIR: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mb_intra= 0; diff --git a/src/libffmpeg/libavcodec/mpegvideo.h b/src/libffmpeg/libavcodec/mpegvideo.h index 011678a42..ed02759ae 100644 --- a/src/libffmpeg/libavcodec/mpegvideo.h +++ b/src/libffmpeg/libavcodec/mpegvideo.h @@ -324,6 +324,7 @@ typedef struct MpegEncContext { int dropable; int frame_rate_index; int last_lambda_for[5]; ///< last lambda for a specific pict type + int skipdct; ///< skip dct and code zero residual /* motion compensation */ int unrestricted_mv; ///< mv can point outside of the coded picture @@ -402,6 +403,8 @@ typedef struct MpegEncContext { #define CANDIDATE_MB_TYPE_BACKWARD_I 0x400 #define CANDIDATE_MB_TYPE_BIDIR_I 0x800 +#define CANDIDATE_MB_TYPE_DIRECT0 0x1000 + int block_index[6]; ///< index to current MB in block based arrays with edges int block_wrap[6]; uint8_t *dest[3]; diff --git a/src/libffmpeg/libavcodec/parser.c b/src/libffmpeg/libavcodec/parser.c index 72a3e55a3..740ad855c 100644 --- a/src/libffmpeg/libavcodec/parser.c +++ b/src/libffmpeg/libavcodec/parser.c @@ -91,7 +91,8 @@ AVCodecParserContext *av_parser_init(int codec_id) * in_data += len; * in_len -= len; * - * decode_frame(data, size); + * if(size) + * decode_frame(data, size); * } * @endcode */ diff --git a/src/libffmpeg/libavcodec/ppc/Makefile.am b/src/libffmpeg/libavcodec/ppc/Makefile.am index 00e796f6d..d52cc481e 100644 --- a/src/libffmpeg/libavcodec/ppc/Makefile.am +++ b/src/libffmpeg/libavcodec/ppc/Makefile.am @@ -12,14 +12,17 @@ noinst_LTLIBRARIES = libavcodec_ppc.la libavcodec_ppc_src = dsputil_altivec.c \ dsputil_ppc.c \ - dsputil_h264_altivec.c \ - dsputil_h264_template_altivec.c \ + h264_altivec.c \ + h264_template_altivec.c \ fdct_altivec.c \ fft_altivec.c \ + float_altivec.c \ idct_altivec.c \ gmc_altivec.c \ mpegvideo_altivec.c \ - mpegvideo_ppc.c + mpegvideo_ppc.c \ + snow_altivec.c \ + vc1dsp_altivec.c libavcodec_ppc_dummy = libavcodec_ppc_dummy.c EXTRA_DIST = $(libavcodec_ppc_src) $(libavcodec_ppc_dummy) @@ -28,7 +31,6 @@ EXTRA_DIST = $(libavcodec_ppc_src) $(libavcodec_ppc_dummy) #ppc_modules = $(libavcodec_ppc_src) #endif - libavcodec_ppc_la_SOURCES = $(ppc_modules) $(libavcodec_ppc_dummy) -noinst_HEADERS = dsputil_altivec.h dsputil_ppc.h gcc_fixes.h +noinst_HEADERS = dsputil_altivec.h dsputil_ppc.h gcc_fixes.h mathops.h types_altivec.h diff --git a/src/libffmpeg/libavcodec/ppc/float_altivec.c b/src/libffmpeg/libavcodec/ppc/float_altivec.c new file mode 100644 index 000000000..c6e43dec2 --- /dev/null +++ b/src/libffmpeg/libavcodec/ppc/float_altivec.c @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2006 Luca Barbato + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "../dsputil.h" + +#include "gcc_fixes.h" + +#include "dsputil_altivec.h" + +static void vector_fmul_altivec(float *dst, const float *src, int len) +{ + int i; + vector float d0, d1, s, zero = (vector float)vec_splat_u32(0); + for(i=0; ivector_fmul = vector_fmul_altivec; + c->vector_fmul_reverse = vector_fmul_reverse_altivec; + c->vector_fmul_add_add = vector_fmul_add_add_altivec; + if(!(avctx->flags & CODEC_FLAG_BITEXACT)) + c->float_to_int16 = float_to_int16_altivec; +} diff --git a/src/libffmpeg/libavcodec/ppc/h264_altivec.c b/src/libffmpeg/libavcodec/ppc/h264_altivec.c new file mode 100644 index 000000000..bac620e82 --- /dev/null +++ b/src/libffmpeg/libavcodec/ppc/h264_altivec.c @@ -0,0 +1,565 @@ +/* + * Copyright (c) 2004 Romain Dolbeau + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "../dsputil.h" + +#include "gcc_fixes.h" + +#include "dsputil_altivec.h" +#include "types_altivec.h" + +#define PUT_OP_U8_ALTIVEC(d, s, dst) d = s +#define AVG_OP_U8_ALTIVEC(d, s, dst) d = vec_avg(dst, s) + +#define OP_U8_ALTIVEC PUT_OP_U8_ALTIVEC +#define PREFIX_h264_chroma_mc8_altivec put_h264_chroma_mc8_altivec +#define PREFIX_h264_chroma_mc8_num altivec_put_h264_chroma_mc8_num +#define PREFIX_h264_qpel16_h_lowpass_altivec put_h264_qpel16_h_lowpass_altivec +#define PREFIX_h264_qpel16_h_lowpass_num altivec_put_h264_qpel16_h_lowpass_num +#define PREFIX_h264_qpel16_v_lowpass_altivec put_h264_qpel16_v_lowpass_altivec +#define PREFIX_h264_qpel16_v_lowpass_num altivec_put_h264_qpel16_v_lowpass_num +#define PREFIX_h264_qpel16_hv_lowpass_altivec put_h264_qpel16_hv_lowpass_altivec +#define PREFIX_h264_qpel16_hv_lowpass_num altivec_put_h264_qpel16_hv_lowpass_num +#include "h264_template_altivec.c" +#undef OP_U8_ALTIVEC +#undef PREFIX_h264_chroma_mc8_altivec +#undef PREFIX_h264_chroma_mc8_num +#undef PREFIX_h264_qpel16_h_lowpass_altivec +#undef PREFIX_h264_qpel16_h_lowpass_num +#undef PREFIX_h264_qpel16_v_lowpass_altivec +#undef PREFIX_h264_qpel16_v_lowpass_num +#undef PREFIX_h264_qpel16_hv_lowpass_altivec +#undef PREFIX_h264_qpel16_hv_lowpass_num + +#define OP_U8_ALTIVEC AVG_OP_U8_ALTIVEC +#define PREFIX_h264_chroma_mc8_altivec avg_h264_chroma_mc8_altivec +#define PREFIX_h264_chroma_mc8_num altivec_avg_h264_chroma_mc8_num +#define PREFIX_h264_qpel16_h_lowpass_altivec avg_h264_qpel16_h_lowpass_altivec +#define PREFIX_h264_qpel16_h_lowpass_num altivec_avg_h264_qpel16_h_lowpass_num +#define PREFIX_h264_qpel16_v_lowpass_altivec avg_h264_qpel16_v_lowpass_altivec +#define PREFIX_h264_qpel16_v_lowpass_num altivec_avg_h264_qpel16_v_lowpass_num +#define PREFIX_h264_qpel16_hv_lowpass_altivec avg_h264_qpel16_hv_lowpass_altivec +#define PREFIX_h264_qpel16_hv_lowpass_num altivec_avg_h264_qpel16_hv_lowpass_num +#include "h264_template_altivec.c" +#undef OP_U8_ALTIVEC +#undef PREFIX_h264_chroma_mc8_altivec +#undef PREFIX_h264_chroma_mc8_num +#undef PREFIX_h264_qpel16_h_lowpass_altivec +#undef PREFIX_h264_qpel16_h_lowpass_num +#undef PREFIX_h264_qpel16_v_lowpass_altivec +#undef PREFIX_h264_qpel16_v_lowpass_num +#undef PREFIX_h264_qpel16_hv_lowpass_altivec +#undef PREFIX_h264_qpel16_hv_lowpass_num + +#define H264_MC(OPNAME, SIZE, CODETYPE) \ +static void OPNAME ## h264_qpel ## SIZE ## _mc00_ ## CODETYPE (uint8_t *dst, uint8_t *src, int stride){\ + OPNAME ## pixels ## SIZE ## _ ## CODETYPE(dst, src, stride, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc10_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){ \ + DECLARE_ALIGNED_16(uint8_t, half[SIZE*SIZE]);\ + put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(half, src, SIZE, stride);\ + OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src, half, stride, stride, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc20_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ + OPNAME ## h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(dst, src, stride, stride);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc30_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED_16(uint8_t, half[SIZE*SIZE]);\ + put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(half, src, SIZE, stride);\ + OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src+1, half, stride, stride, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc01_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED_16(uint8_t, half[SIZE*SIZE]);\ + put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(half, src, SIZE, stride);\ + OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src, half, stride, stride, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc02_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ + OPNAME ## h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(dst, src, stride, stride);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED_16(uint8_t, half[SIZE*SIZE]);\ + put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(half, src, SIZE, stride);\ + OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src+stride, half, stride, stride, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc11_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED_16(uint8_t, halfH[SIZE*SIZE]);\ + DECLARE_ALIGNED_16(uint8_t, halfV[SIZE*SIZE]);\ + put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, SIZE, stride);\ + put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, SIZE, stride);\ + OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc31_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED_16(uint8_t, halfH[SIZE*SIZE]);\ + DECLARE_ALIGNED_16(uint8_t, halfV[SIZE*SIZE]);\ + put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, SIZE, stride);\ + put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, SIZE, stride);\ + OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc13_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED_16(uint8_t, halfH[SIZE*SIZE]);\ + DECLARE_ALIGNED_16(uint8_t, halfV[SIZE*SIZE]);\ + put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + stride, SIZE, stride);\ + put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, SIZE, stride);\ + OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc33_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED_16(uint8_t, halfH[SIZE*SIZE]);\ + DECLARE_ALIGNED_16(uint8_t, halfV[SIZE*SIZE]);\ + put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + stride, SIZE, stride);\ + put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, SIZE, stride);\ + OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc22_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED_16(int16_t, tmp[SIZE*(SIZE+8)]);\ + OPNAME ## h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(dst, tmp, src, stride, SIZE, stride);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc21_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED_16(uint8_t, halfH[SIZE*SIZE]);\ + DECLARE_ALIGNED_16(uint8_t, halfHV[SIZE*SIZE]);\ + DECLARE_ALIGNED_16(int16_t, tmp[SIZE*(SIZE+8)]);\ + put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, SIZE, stride);\ + put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\ + OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfHV, stride, SIZE, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc23_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED_16(uint8_t, halfH[SIZE*SIZE]);\ + DECLARE_ALIGNED_16(uint8_t, halfHV[SIZE*SIZE]);\ + DECLARE_ALIGNED_16(int16_t, tmp[SIZE*(SIZE+8)]);\ + put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + stride, SIZE, stride);\ + put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\ + OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfHV, stride, SIZE, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc12_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED_16(uint8_t, halfV[SIZE*SIZE]);\ + DECLARE_ALIGNED_16(uint8_t, halfHV[SIZE*SIZE]);\ + DECLARE_ALIGNED_16(int16_t, tmp[SIZE*(SIZE+8)]);\ + put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, SIZE, stride);\ + put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\ + OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfV, halfHV, stride, SIZE, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED_16(uint8_t, halfV[SIZE*SIZE]);\ + DECLARE_ALIGNED_16(uint8_t, halfHV[SIZE*SIZE]);\ + DECLARE_ALIGNED_16(int16_t, tmp[SIZE*(SIZE+8)]);\ + put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, SIZE, stride);\ + put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\ + OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfV, halfHV, stride, SIZE, SIZE);\ +}\ + +/* this code assume that stride % 16 == 0 */ +void put_no_rnd_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, int stride, int h, int x, int y) { + signed int ABCD[4] __attribute__((aligned(16))) = + {((8 - x) * (8 - y)), + ((x) * (8 - y)), + ((8 - x) * (y)), + ((x) * (y))}; + register int i; + vector unsigned char fperm; + const vector signed int vABCD = vec_ld(0, ABCD); + const vector signed short vA = vec_splat((vector signed short)vABCD, 1); + const vector signed short vB = vec_splat((vector signed short)vABCD, 3); + const vector signed short vC = vec_splat((vector signed short)vABCD, 5); + const vector signed short vD = vec_splat((vector signed short)vABCD, 7); + const vector signed int vzero = vec_splat_s32(0); + const vector signed short v28ss = vec_sub(vec_sl(vec_splat_s16(1),vec_splat_u16(5)),vec_splat_s16(4)); + const vector unsigned short v6us = vec_splat_u16(6); + register int loadSecond = (((unsigned long)src) % 16) <= 7 ? 0 : 1; + register int reallyBadAlign = (((unsigned long)src) % 16) == 15 ? 1 : 0; + + vector unsigned char vsrcAuc, vsrcBuc, vsrcperm0, vsrcperm1; + vector unsigned char vsrc0uc, vsrc1uc; + vector signed short vsrc0ssH, vsrc1ssH; + vector unsigned char vsrcCuc, vsrc2uc, vsrc3uc; + vector signed short vsrc2ssH, vsrc3ssH, psum; + vector unsigned char vdst, ppsum, fsum; + + if (((unsigned long)dst) % 16 == 0) { + fperm = (vector unsigned char)AVV(0x10, 0x11, 0x12, 0x13, + 0x14, 0x15, 0x16, 0x17, + 0x08, 0x09, 0x0A, 0x0B, + 0x0C, 0x0D, 0x0E, 0x0F); + } else { + fperm = (vector unsigned char)AVV(0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x18, 0x19, 0x1A, 0x1B, + 0x1C, 0x1D, 0x1E, 0x1F); + } + + vsrcAuc = vec_ld(0, src); + + if (loadSecond) + vsrcBuc = vec_ld(16, src); + vsrcperm0 = vec_lvsl(0, src); + vsrcperm1 = vec_lvsl(1, src); + + vsrc0uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm0); + if (reallyBadAlign) + vsrc1uc = vsrcBuc; + else + vsrc1uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm1); + + vsrc0ssH = (vector signed short)vec_mergeh((vector unsigned char)vzero, + (vector unsigned char)vsrc0uc); + vsrc1ssH = (vector signed short)vec_mergeh((vector unsigned char)vzero, + (vector unsigned char)vsrc1uc); + + if (!loadSecond) {// -> !reallyBadAlign + for (i = 0 ; i < h ; i++) { + + + vsrcCuc = vec_ld(stride + 0, src); + + vsrc2uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0); + vsrc3uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1); + + vsrc2ssH = (vector signed short)vec_mergeh((vector unsigned char)vzero, + (vector unsigned char)vsrc2uc); + vsrc3ssH = (vector signed short)vec_mergeh((vector unsigned char)vzero, + (vector unsigned char)vsrc3uc); + + psum = vec_mladd(vA, vsrc0ssH, vec_splat_s16(0)); + psum = vec_mladd(vB, vsrc1ssH, psum); + psum = vec_mladd(vC, vsrc2ssH, psum); + psum = vec_mladd(vD, vsrc3ssH, psum); + psum = vec_add(v28ss, psum); + psum = vec_sra(psum, v6us); + + vdst = vec_ld(0, dst); + ppsum = (vector unsigned char)vec_packsu(psum, psum); + fsum = vec_perm(vdst, ppsum, fperm); + + vec_st(fsum, 0, dst); + + vsrc0ssH = vsrc2ssH; + vsrc1ssH = vsrc3ssH; + + dst += stride; + src += stride; + } + } else { + vector unsigned char vsrcDuc; + for (i = 0 ; i < h ; i++) { + vsrcCuc = vec_ld(stride + 0, src); + vsrcDuc = vec_ld(stride + 16, src); + + vsrc2uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0); + if (reallyBadAlign) + vsrc3uc = vsrcDuc; + else + vsrc3uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1); + + vsrc2ssH = (vector signed short)vec_mergeh((vector unsigned char)vzero, + (vector unsigned char)vsrc2uc); + vsrc3ssH = (vector signed short)vec_mergeh((vector unsigned char)vzero, + (vector unsigned char)vsrc3uc); + + psum = vec_mladd(vA, vsrc0ssH, vec_splat_s16(0)); + psum = vec_mladd(vB, vsrc1ssH, psum); + psum = vec_mladd(vC, vsrc2ssH, psum); + psum = vec_mladd(vD, vsrc3ssH, psum); + psum = vec_add(v28ss, psum); + psum = vec_sr(psum, v6us); + + vdst = vec_ld(0, dst); + ppsum = (vector unsigned char)vec_pack(psum, psum); + fsum = vec_perm(vdst, ppsum, fperm); + + vec_st(fsum, 0, dst); + + vsrc0ssH = vsrc2ssH; + vsrc1ssH = vsrc3ssH; + + dst += stride; + src += stride; + } + } +} + +static inline void put_pixels16_l2_altivec( uint8_t * dst, const uint8_t * src1, + const uint8_t * src2, int dst_stride, + int src_stride1, int h) +{ + int i; + vector unsigned char a, b, d, tmp1, tmp2, mask, mask_, edges, align; + + mask_ = vec_lvsl(0, src2); + + for (i = 0; i < h; i++) { + + tmp1 = vec_ld(i * src_stride1, src1); + mask = vec_lvsl(i * src_stride1, src1); + tmp2 = vec_ld(i * src_stride1 + 15, src1); + + a = vec_perm(tmp1, tmp2, mask); + + tmp1 = vec_ld(i * 16, src2); + tmp2 = vec_ld(i * 16 + 15, src2); + + b = vec_perm(tmp1, tmp2, mask_); + + tmp1 = vec_ld(0, dst); + mask = vec_lvsl(0, dst); + tmp2 = vec_ld(15, dst); + + d = vec_avg(a, b); + + edges = vec_perm(tmp2, tmp1, mask); + + align = vec_lvsr(0, dst); + + tmp2 = vec_perm(d, edges, align); + tmp1 = vec_perm(edges, d, align); + + vec_st(tmp2, 15, dst); + vec_st(tmp1, 0 , dst); + + dst += dst_stride; + } +} + +static inline void avg_pixels16_l2_altivec( uint8_t * dst, const uint8_t * src1, + const uint8_t * src2, int dst_stride, + int src_stride1, int h) +{ + int i; + vector unsigned char a, b, d, tmp1, tmp2, mask, mask_, edges, align; + + mask_ = vec_lvsl(0, src2); + + for (i = 0; i < h; i++) { + + tmp1 = vec_ld(i * src_stride1, src1); + mask = vec_lvsl(i * src_stride1, src1); + tmp2 = vec_ld(i * src_stride1 + 15, src1); + + a = vec_perm(tmp1, tmp2, mask); + + tmp1 = vec_ld(i * 16, src2); + tmp2 = vec_ld(i * 16 + 15, src2); + + b = vec_perm(tmp1, tmp2, mask_); + + tmp1 = vec_ld(0, dst); + mask = vec_lvsl(0, dst); + tmp2 = vec_ld(15, dst); + + d = vec_avg(vec_perm(tmp1, tmp2, mask), vec_avg(a, b)); + + edges = vec_perm(tmp2, tmp1, mask); + + align = vec_lvsr(0, dst); + + tmp2 = vec_perm(d, edges, align); + tmp1 = vec_perm(edges, d, align); + + vec_st(tmp2, 15, dst); + vec_st(tmp1, 0 , dst); + + dst += dst_stride; + } +} + +/* Implemented but could be faster +#define put_pixels16_l2_altivec(d,s1,s2,ds,s1s,h) put_pixels16_l2(d,s1,s2,ds,s1s,16,h) +#define avg_pixels16_l2_altivec(d,s1,s2,ds,s1s,h) avg_pixels16_l2(d,s1,s2,ds,s1s,16,h) + */ + + H264_MC(put_, 16, altivec) + H264_MC(avg_, 16, altivec) + + +/**************************************************************************** + * IDCT transform: + ****************************************************************************/ + +#define IDCT8_1D_ALTIVEC(s0, s1, s2, s3, s4, s5, s6, s7, d0, d1, d2, d3, d4, d5, d6, d7) {\ + /* a0 = SRC(0) + SRC(4); */ \ + vec_s16_t a0v = vec_add(s0, s4); \ + /* a2 = SRC(0) - SRC(4); */ \ + vec_s16_t a2v = vec_sub(s0, s4); \ + /* a4 = (SRC(2)>>1) - SRC(6); */ \ + vec_s16_t a4v = vec_sub(vec_sra(s2, onev), s6); \ + /* a6 = (SRC(6)>>1) + SRC(2); */ \ + vec_s16_t a6v = vec_add(vec_sra(s6, onev), s2); \ + /* b0 = a0 + a6; */ \ + vec_s16_t b0v = vec_add(a0v, a6v); \ + /* b2 = a2 + a4; */ \ + vec_s16_t b2v = vec_add(a2v, a4v); \ + /* b4 = a2 - a4; */ \ + vec_s16_t b4v = vec_sub(a2v, a4v); \ + /* b6 = a0 - a6; */ \ + vec_s16_t b6v = vec_sub(a0v, a6v); \ + /* a1 = SRC(5) - SRC(3) - SRC(7) - (SRC(7)>>1); */ \ + /* a1 = (SRC(5)-SRC(3)) - (SRC(7) + (SRC(7)>>1)); */ \ + vec_s16_t a1v = vec_sub( vec_sub(s5, s3), vec_add(s7, vec_sra(s7, onev)) ); \ + /* a3 = SRC(7) + SRC(1) - SRC(3) - (SRC(3)>>1); */ \ + /* a3 = (SRC(7)+SRC(1)) - (SRC(3) + (SRC(3)>>1)); */ \ + vec_s16_t a3v = vec_sub( vec_add(s7, s1), vec_add(s3, vec_sra(s3, onev)) );\ + /* a5 = SRC(7) - SRC(1) + SRC(5) + (SRC(5)>>1); */ \ + /* a5 = (SRC(7)-SRC(1)) + SRC(5) + (SRC(5)>>1); */ \ + vec_s16_t a5v = vec_add( vec_sub(s7, s1), vec_add(s5, vec_sra(s5, onev)) );\ + /* a7 = SRC(5)+SRC(3) + SRC(1) + (SRC(1)>>1); */ \ + vec_s16_t a7v = vec_add( vec_add(s5, s3), vec_add(s1, vec_sra(s1, onev)) );\ + /* b1 = (a7>>2) + a1; */ \ + vec_s16_t b1v = vec_add( vec_sra(a7v, twov), a1v); \ + /* b3 = a3 + (a5>>2); */ \ + vec_s16_t b3v = vec_add(a3v, vec_sra(a5v, twov)); \ + /* b5 = (a3>>2) - a5; */ \ + vec_s16_t b5v = vec_sub( vec_sra(a3v, twov), a5v); \ + /* b7 = a7 - (a1>>2); */ \ + vec_s16_t b7v = vec_sub( a7v, vec_sra(a1v, twov)); \ + /* DST(0, b0 + b7); */ \ + d0 = vec_add(b0v, b7v); \ + /* DST(1, b2 + b5); */ \ + d1 = vec_add(b2v, b5v); \ + /* DST(2, b4 + b3); */ \ + d2 = vec_add(b4v, b3v); \ + /* DST(3, b6 + b1); */ \ + d3 = vec_add(b6v, b1v); \ + /* DST(4, b6 - b1); */ \ + d4 = vec_sub(b6v, b1v); \ + /* DST(5, b4 - b3); */ \ + d5 = vec_sub(b4v, b3v); \ + /* DST(6, b2 - b5); */ \ + d6 = vec_sub(b2v, b5v); \ + /* DST(7, b0 - b7); */ \ + d7 = vec_sub(b0v, b7v); \ +} + +#define ALTIVEC_STORE_SUM_CLIP(dest, idctv, perm_ldv, perm_stv, sel) { \ + /* unaligned load */ \ + vec_u8_t hv = vec_ld( 0, dest ); \ + vec_u8_t lv = vec_ld( 7, dest ); \ + vec_u8_t dstv = vec_perm( hv, lv, (vec_u8_t)perm_ldv ); \ + vec_s16_t idct_sh6 = vec_sra(idctv, sixv); \ + vec_u16_t dst16 = (vec_u16_t)vec_mergeh(zero_u8v, dstv); \ + vec_s16_t idstsum = vec_adds(idct_sh6, (vec_s16_t)dst16); \ + vec_u8_t idstsum8 = vec_packsu(zero_s16v, idstsum); \ + vec_u8_t edgehv; \ + /* unaligned store */ \ + vec_u8_t bodyv = vec_perm( idstsum8, idstsum8, perm_stv );\ + vec_u8_t edgelv = vec_perm( sel, zero_u8v, perm_stv ); \ + lv = vec_sel( lv, bodyv, edgelv ); \ + vec_st( lv, 7, dest ); \ + hv = vec_ld( 0, dest ); \ + edgehv = vec_perm( zero_u8v, sel, perm_stv ); \ + hv = vec_sel( hv, bodyv, edgehv ); \ + vec_st( hv, 0, dest ); \ + } + +void ff_h264_idct8_add_altivec( uint8_t *dst, DCTELEM *dct, int stride ) { + vec_s16_t s0, s1, s2, s3, s4, s5, s6, s7; + vec_s16_t d0, d1, d2, d3, d4, d5, d6, d7; + vec_s16_t idct0, idct1, idct2, idct3, idct4, idct5, idct6, idct7; + + vec_u8_t perm_ldv = vec_lvsl(0, dst); + vec_u8_t perm_stv = vec_lvsr(8, dst); + + const vec_u16_t onev = vec_splat_u16(1); + const vec_u16_t twov = vec_splat_u16(2); + const vec_u16_t sixv = vec_splat_u16(6); + + const vec_u8_t sel = (vec_u8_t) AVV(0,0,0,0,0,0,0,0, + -1,-1,-1,-1,-1,-1,-1,-1); + LOAD_ZERO; + + dct[0] += 32; // rounding for the >>6 at the end + + s0 = vec_ld(0x00, (int16_t*)dct); + s1 = vec_ld(0x10, (int16_t*)dct); + s2 = vec_ld(0x20, (int16_t*)dct); + s3 = vec_ld(0x30, (int16_t*)dct); + s4 = vec_ld(0x40, (int16_t*)dct); + s5 = vec_ld(0x50, (int16_t*)dct); + s6 = vec_ld(0x60, (int16_t*)dct); + s7 = vec_ld(0x70, (int16_t*)dct); + + IDCT8_1D_ALTIVEC(s0, s1, s2, s3, s4, s5, s6, s7, + d0, d1, d2, d3, d4, d5, d6, d7); + + TRANSPOSE8( d0, d1, d2, d3, d4, d5, d6, d7 ); + + IDCT8_1D_ALTIVEC(d0, d1, d2, d3, d4, d5, d6, d7, + idct0, idct1, idct2, idct3, idct4, idct5, idct6, idct7); + + ALTIVEC_STORE_SUM_CLIP(&dst[0*stride], idct0, perm_ldv, perm_stv, sel); + ALTIVEC_STORE_SUM_CLIP(&dst[1*stride], idct1, perm_ldv, perm_stv, sel); + ALTIVEC_STORE_SUM_CLIP(&dst[2*stride], idct2, perm_ldv, perm_stv, sel); + ALTIVEC_STORE_SUM_CLIP(&dst[3*stride], idct3, perm_ldv, perm_stv, sel); + ALTIVEC_STORE_SUM_CLIP(&dst[4*stride], idct4, perm_ldv, perm_stv, sel); + ALTIVEC_STORE_SUM_CLIP(&dst[5*stride], idct5, perm_ldv, perm_stv, sel); + ALTIVEC_STORE_SUM_CLIP(&dst[6*stride], idct6, perm_ldv, perm_stv, sel); + ALTIVEC_STORE_SUM_CLIP(&dst[7*stride], idct7, perm_ldv, perm_stv, sel); +} + +void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx) { + +#ifdef HAVE_ALTIVEC + if (has_altivec()) { + c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_altivec; + c->put_no_rnd_h264_chroma_pixels_tab[0] = put_no_rnd_h264_chroma_mc8_altivec; + c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_altivec; + c->h264_idct8_add = ff_h264_idct8_add_altivec; + +#define dspfunc(PFX, IDX, NUM) \ + c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_altivec; \ + c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_altivec; \ + c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_altivec; \ + c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_altivec; \ + c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_altivec; \ + c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_altivec; \ + c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_altivec; \ + c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_altivec; \ + c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_altivec; \ + c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_altivec; \ + c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_altivec; \ + c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_altivec; \ + c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_altivec; \ + c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_altivec; \ + c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_altivec; \ + c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_altivec + + dspfunc(put_h264_qpel, 0, 16); + dspfunc(avg_h264_qpel, 0, 16); +#undef dspfunc + + } else +#endif /* HAVE_ALTIVEC */ + { + // Non-AltiVec PPC optimisations + + // ... pending ... + } +} diff --git a/src/libffmpeg/libavcodec/ppc/h264_template_altivec.c b/src/libffmpeg/libavcodec/ppc/h264_template_altivec.c new file mode 100644 index 000000000..e8ad67f2f --- /dev/null +++ b/src/libffmpeg/libavcodec/ppc/h264_template_altivec.c @@ -0,0 +1,719 @@ +/* + * Copyright (c) 2004 Romain Dolbeau + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* this code assume that stride % 16 == 0 */ +void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, int stride, int h, int x, int y) { + POWERPC_PERF_DECLARE(PREFIX_h264_chroma_mc8_num, 1); + signed int ABCD[4] __attribute__((aligned(16))) = + {((8 - x) * (8 - y)), + ((x) * (8 - y)), + ((8 - x) * (y)), + ((x) * (y))}; + register int i; + vector unsigned char fperm; + const vector signed int vABCD = vec_ld(0, ABCD); + const vector signed short vA = vec_splat((vector signed short)vABCD, 1); + const vector signed short vB = vec_splat((vector signed short)vABCD, 3); + const vector signed short vC = vec_splat((vector signed short)vABCD, 5); + const vector signed short vD = vec_splat((vector signed short)vABCD, 7); + const vector signed int vzero = vec_splat_s32(0); + const vector signed short v32ss = vec_sl(vec_splat_s16(1),vec_splat_u16(5)); + const vector unsigned short v6us = vec_splat_u16(6); + register int loadSecond = (((unsigned long)src) % 16) <= 7 ? 0 : 1; + register int reallyBadAlign = (((unsigned long)src) % 16) == 15 ? 1 : 0; + + vector unsigned char vsrcAuc, vsrcBuc, vsrcperm0, vsrcperm1; + vector unsigned char vsrc0uc, vsrc1uc; + vector signed short vsrc0ssH, vsrc1ssH; + vector unsigned char vsrcCuc, vsrc2uc, vsrc3uc; + vector signed short vsrc2ssH, vsrc3ssH, psum; + vector unsigned char vdst, ppsum, vfdst, fsum; + + POWERPC_PERF_START_COUNT(PREFIX_h264_chroma_mc8_num, 1); + + if (((unsigned long)dst) % 16 == 0) { + fperm = (vector unsigned char)AVV(0x10, 0x11, 0x12, 0x13, + 0x14, 0x15, 0x16, 0x17, + 0x08, 0x09, 0x0A, 0x0B, + 0x0C, 0x0D, 0x0E, 0x0F); + } else { + fperm = (vector unsigned char)AVV(0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x18, 0x19, 0x1A, 0x1B, + 0x1C, 0x1D, 0x1E, 0x1F); + } + + vsrcAuc = vec_ld(0, src); + + if (loadSecond) + vsrcBuc = vec_ld(16, src); + vsrcperm0 = vec_lvsl(0, src); + vsrcperm1 = vec_lvsl(1, src); + + vsrc0uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm0); + if (reallyBadAlign) + vsrc1uc = vsrcBuc; + else + vsrc1uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm1); + + vsrc0ssH = (vector signed short)vec_mergeh((vector unsigned char)vzero, + (vector unsigned char)vsrc0uc); + vsrc1ssH = (vector signed short)vec_mergeh((vector unsigned char)vzero, + (vector unsigned char)vsrc1uc); + + if (!loadSecond) {// -> !reallyBadAlign + for (i = 0 ; i < h ; i++) { + + + vsrcCuc = vec_ld(stride + 0, src); + + vsrc2uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0); + vsrc3uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1); + + vsrc2ssH = (vector signed short)vec_mergeh((vector unsigned char)vzero, + (vector unsigned char)vsrc2uc); + vsrc3ssH = (vector signed short)vec_mergeh((vector unsigned char)vzero, + (vector unsigned char)vsrc3uc); + + psum = vec_mladd(vA, vsrc0ssH, vec_splat_s16(0)); + psum = vec_mladd(vB, vsrc1ssH, psum); + psum = vec_mladd(vC, vsrc2ssH, psum); + psum = vec_mladd(vD, vsrc3ssH, psum); + psum = vec_add(v32ss, psum); + psum = vec_sra(psum, v6us); + + vdst = vec_ld(0, dst); + ppsum = (vector unsigned char)vec_packsu(psum, psum); + vfdst = vec_perm(vdst, ppsum, fperm); + + OP_U8_ALTIVEC(fsum, vfdst, vdst); + + vec_st(fsum, 0, dst); + + vsrc0ssH = vsrc2ssH; + vsrc1ssH = vsrc3ssH; + + dst += stride; + src += stride; + } + } else { + vector unsigned char vsrcDuc; + for (i = 0 ; i < h ; i++) { + vsrcCuc = vec_ld(stride + 0, src); + vsrcDuc = vec_ld(stride + 16, src); + + vsrc2uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0); + if (reallyBadAlign) + vsrc3uc = vsrcDuc; + else + vsrc3uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1); + + vsrc2ssH = (vector signed short)vec_mergeh((vector unsigned char)vzero, + (vector unsigned char)vsrc2uc); + vsrc3ssH = (vector signed short)vec_mergeh((vector unsigned char)vzero, + (vector unsigned char)vsrc3uc); + + psum = vec_mladd(vA, vsrc0ssH, vec_splat_s16(0)); + psum = vec_mladd(vB, vsrc1ssH, psum); + psum = vec_mladd(vC, vsrc2ssH, psum); + psum = vec_mladd(vD, vsrc3ssH, psum); + psum = vec_add(v32ss, psum); + psum = vec_sr(psum, v6us); + + vdst = vec_ld(0, dst); + ppsum = (vector unsigned char)vec_pack(psum, psum); + vfdst = vec_perm(vdst, ppsum, fperm); + + OP_U8_ALTIVEC(fsum, vfdst, vdst); + + vec_st(fsum, 0, dst); + + vsrc0ssH = vsrc2ssH; + vsrc1ssH = vsrc3ssH; + + dst += stride; + src += stride; + } + } + POWERPC_PERF_STOP_COUNT(PREFIX_h264_chroma_mc8_num, 1); +} + +/* this code assume stride % 16 == 0 */ +static void PREFIX_h264_qpel16_h_lowpass_altivec(uint8_t * dst, uint8_t * src, int dstStride, int srcStride) { + POWERPC_PERF_DECLARE(PREFIX_h264_qpel16_h_lowpass_num, 1); + register int i; + + const vector signed int vzero = vec_splat_s32(0); + const vector unsigned char permM2 = vec_lvsl(-2, src); + const vector unsigned char permM1 = vec_lvsl(-1, src); + const vector unsigned char permP0 = vec_lvsl(+0, src); + const vector unsigned char permP1 = vec_lvsl(+1, src); + const vector unsigned char permP2 = vec_lvsl(+2, src); + const vector unsigned char permP3 = vec_lvsl(+3, src); + const vector signed short v5ss = vec_splat_s16(5); + const vector unsigned short v5us = vec_splat_u16(5); + const vector signed short v20ss = vec_sl(vec_splat_s16(5),vec_splat_u16(2)); + const vector signed short v16ss = vec_sl(vec_splat_s16(1),vec_splat_u16(4)); + const vector unsigned char dstperm = vec_lvsr(0, dst); + const vector unsigned char neg1 = + (const vector unsigned char) vec_splat_s8(-1); + + const vector unsigned char dstmask = + vec_perm((const vector unsigned char)vzero, + neg1, dstperm); + + vector unsigned char srcM2, srcM1, srcP0, srcP1, srcP2, srcP3; + + register int align = ((((unsigned long)src) - 2) % 16); + + vector signed short srcP0A, srcP0B, srcP1A, srcP1B, + srcP2A, srcP2B, srcP3A, srcP3B, + srcM1A, srcM1B, srcM2A, srcM2B, + sum1A, sum1B, sum2A, sum2B, sum3A, sum3B, + pp1A, pp1B, pp2A, pp2B, pp3A, pp3B, + psumA, psumB, sumA, sumB; + + vector unsigned char sum, dst1, dst2, vdst, fsum, + rsum, fdst1, fdst2; + + POWERPC_PERF_START_COUNT(PREFIX_h264_qpel16_h_lowpass_num, 1); + + for (i = 0 ; i < 16 ; i ++) { + vector unsigned char srcR1 = vec_ld(-2, src); + vector unsigned char srcR2 = vec_ld(14, src); + + switch (align) { + default: { + srcM2 = vec_perm(srcR1, srcR2, permM2); + srcM1 = vec_perm(srcR1, srcR2, permM1); + srcP0 = vec_perm(srcR1, srcR2, permP0); + srcP1 = vec_perm(srcR1, srcR2, permP1); + srcP2 = vec_perm(srcR1, srcR2, permP2); + srcP3 = vec_perm(srcR1, srcR2, permP3); + } break; + case 11: { + srcM2 = vec_perm(srcR1, srcR2, permM2); + srcM1 = vec_perm(srcR1, srcR2, permM1); + srcP0 = vec_perm(srcR1, srcR2, permP0); + srcP1 = vec_perm(srcR1, srcR2, permP1); + srcP2 = vec_perm(srcR1, srcR2, permP2); + srcP3 = srcR2; + } break; + case 12: { + vector unsigned char srcR3 = vec_ld(30, src); + srcM2 = vec_perm(srcR1, srcR2, permM2); + srcM1 = vec_perm(srcR1, srcR2, permM1); + srcP0 = vec_perm(srcR1, srcR2, permP0); + srcP1 = vec_perm(srcR1, srcR2, permP1); + srcP2 = srcR2; + srcP3 = vec_perm(srcR2, srcR3, permP3); + } break; + case 13: { + vector unsigned char srcR3 = vec_ld(30, src); + srcM2 = vec_perm(srcR1, srcR2, permM2); + srcM1 = vec_perm(srcR1, srcR2, permM1); + srcP0 = vec_perm(srcR1, srcR2, permP0); + srcP1 = srcR2; + srcP2 = vec_perm(srcR2, srcR3, permP2); + srcP3 = vec_perm(srcR2, srcR3, permP3); + } break; + case 14: { + vector unsigned char srcR3 = vec_ld(30, src); + srcM2 = vec_perm(srcR1, srcR2, permM2); + srcM1 = vec_perm(srcR1, srcR2, permM1); + srcP0 = srcR2; + srcP1 = vec_perm(srcR2, srcR3, permP1); + srcP2 = vec_perm(srcR2, srcR3, permP2); + srcP3 = vec_perm(srcR2, srcR3, permP3); + } break; + case 15: { + vector unsigned char srcR3 = vec_ld(30, src); + srcM2 = vec_perm(srcR1, srcR2, permM2); + srcM1 = srcR2; + srcP0 = vec_perm(srcR2, srcR3, permP0); + srcP1 = vec_perm(srcR2, srcR3, permP1); + srcP2 = vec_perm(srcR2, srcR3, permP2); + srcP3 = vec_perm(srcR2, srcR3, permP3); + } break; + } + + srcP0A = (vector signed short) + vec_mergeh((vector unsigned char)vzero, srcP0); + srcP0B = (vector signed short) + vec_mergel((vector unsigned char)vzero, srcP0); + srcP1A = (vector signed short) + vec_mergeh((vector unsigned char)vzero, srcP1); + srcP1B = (vector signed short) + vec_mergel((vector unsigned char)vzero, srcP1); + + srcP2A = (vector signed short) + vec_mergeh((vector unsigned char)vzero, srcP2); + srcP2B = (vector signed short) + vec_mergel((vector unsigned char)vzero, srcP2); + srcP3A = (vector signed short) + vec_mergeh((vector unsigned char)vzero, srcP3); + srcP3B = (vector signed short) + vec_mergel((vector unsigned char)vzero, srcP3); + + srcM1A = (vector signed short) + vec_mergeh((vector unsigned char)vzero, srcM1); + srcM1B = (vector signed short) + vec_mergel((vector unsigned char)vzero, srcM1); + srcM2A = (vector signed short) + vec_mergeh((vector unsigned char)vzero, srcM2); + srcM2B = (vector signed short) + vec_mergel((vector unsigned char)vzero, srcM2); + + sum1A = vec_adds(srcP0A, srcP1A); + sum1B = vec_adds(srcP0B, srcP1B); + sum2A = vec_adds(srcM1A, srcP2A); + sum2B = vec_adds(srcM1B, srcP2B); + sum3A = vec_adds(srcM2A, srcP3A); + sum3B = vec_adds(srcM2B, srcP3B); + + pp1A = vec_mladd(sum1A, v20ss, v16ss); + pp1B = vec_mladd(sum1B, v20ss, v16ss); + + pp2A = vec_mladd(sum2A, v5ss, (vector signed short)vzero); + pp2B = vec_mladd(sum2B, v5ss, (vector signed short)vzero); + + pp3A = vec_add(sum3A, pp1A); + pp3B = vec_add(sum3B, pp1B); + + psumA = vec_sub(pp3A, pp2A); + psumB = vec_sub(pp3B, pp2B); + + sumA = vec_sra(psumA, v5us); + sumB = vec_sra(psumB, v5us); + + sum = vec_packsu(sumA, sumB); + + dst1 = vec_ld(0, dst); + dst2 = vec_ld(16, dst); + vdst = vec_perm(dst1, dst2, vec_lvsl(0, dst)); + + OP_U8_ALTIVEC(fsum, sum, vdst); + + rsum = vec_perm(fsum, fsum, dstperm); + fdst1 = vec_sel(dst1, rsum, dstmask); + fdst2 = vec_sel(rsum, dst2, dstmask); + + vec_st(fdst1, 0, dst); + vec_st(fdst2, 16, dst); + + src += srcStride; + dst += dstStride; + } +POWERPC_PERF_STOP_COUNT(PREFIX_h264_qpel16_h_lowpass_num, 1); +} + +/* this code assume stride % 16 == 0 */ +static void PREFIX_h264_qpel16_v_lowpass_altivec(uint8_t * dst, uint8_t * src, int dstStride, int srcStride) { + POWERPC_PERF_DECLARE(PREFIX_h264_qpel16_v_lowpass_num, 1); + + register int i; + + const vector signed int vzero = vec_splat_s32(0); + const vector unsigned char perm = vec_lvsl(0, src); + const vector signed short v20ss = vec_sl(vec_splat_s16(5),vec_splat_u16(2)); + const vector unsigned short v5us = vec_splat_u16(5); + const vector signed short v5ss = vec_splat_s16(5); + const vector signed short v16ss = vec_sl(vec_splat_s16(1),vec_splat_u16(4)); + const vector unsigned char dstperm = vec_lvsr(0, dst); + const vector unsigned char neg1 = (const vector unsigned char)vec_splat_s8(-1); + const vector unsigned char dstmask = vec_perm((const vector unsigned char)vzero, neg1, dstperm); + + uint8_t *srcbis = src - (srcStride * 2); + + const vector unsigned char srcM2a = vec_ld(0, srcbis); + const vector unsigned char srcM2b = vec_ld(16, srcbis); + const vector unsigned char srcM2 = vec_perm(srcM2a, srcM2b, perm); +// srcbis += srcStride; + const vector unsigned char srcM1a = vec_ld(0, srcbis += srcStride); + const vector unsigned char srcM1b = vec_ld(16, srcbis); + const vector unsigned char srcM1 = vec_perm(srcM1a, srcM1b, perm); +// srcbis += srcStride; + const vector unsigned char srcP0a = vec_ld(0, srcbis += srcStride); + const vector unsigned char srcP0b = vec_ld(16, srcbis); + const vector unsigned char srcP0 = vec_perm(srcP0a, srcP0b, perm); +// srcbis += srcStride; + const vector unsigned char srcP1a = vec_ld(0, srcbis += srcStride); + const vector unsigned char srcP1b = vec_ld(16, srcbis); + const vector unsigned char srcP1 = vec_perm(srcP1a, srcP1b, perm); +// srcbis += srcStride; + const vector unsigned char srcP2a = vec_ld(0, srcbis += srcStride); + const vector unsigned char srcP2b = vec_ld(16, srcbis); + const vector unsigned char srcP2 = vec_perm(srcP2a, srcP2b, perm); +// srcbis += srcStride; + + vector signed short srcM2ssA = (vector signed short) + vec_mergeh((vector unsigned char)vzero, srcM2); + vector signed short srcM2ssB = (vector signed short) + vec_mergel((vector unsigned char)vzero, srcM2); + vector signed short srcM1ssA = (vector signed short) + vec_mergeh((vector unsigned char)vzero, srcM1); + vector signed short srcM1ssB = (vector signed short) + vec_mergel((vector unsigned char)vzero, srcM1); + vector signed short srcP0ssA = (vector signed short) + vec_mergeh((vector unsigned char)vzero, srcP0); + vector signed short srcP0ssB = (vector signed short) + vec_mergel((vector unsigned char)vzero, srcP0); + vector signed short srcP1ssA = (vector signed short) + vec_mergeh((vector unsigned char)vzero, srcP1); + vector signed short srcP1ssB = (vector signed short) + vec_mergel((vector unsigned char)vzero, srcP1); + vector signed short srcP2ssA = (vector signed short) + vec_mergeh((vector unsigned char)vzero, srcP2); + vector signed short srcP2ssB = (vector signed short) + vec_mergel((vector unsigned char)vzero, srcP2); + + vector signed short pp1A, pp1B, pp2A, pp2B, pp3A, pp3B, + psumA, psumB, sumA, sumB, + srcP3ssA, srcP3ssB, + sum1A, sum1B, sum2A, sum2B, sum3A, sum3B; + + vector unsigned char sum, dst1, dst2, vdst, fsum, rsum, fdst1, fdst2, + srcP3a, srcP3b, srcP3; + + POWERPC_PERF_START_COUNT(PREFIX_h264_qpel16_v_lowpass_num, 1); + + for (i = 0 ; i < 16 ; i++) { + srcP3a = vec_ld(0, srcbis += srcStride); + srcP3b = vec_ld(16, srcbis); + srcP3 = vec_perm(srcP3a, srcP3b, perm); + srcP3ssA = (vector signed short) + vec_mergeh((vector unsigned char)vzero, srcP3); + srcP3ssB = (vector signed short) + vec_mergel((vector unsigned char)vzero, srcP3); +// srcbis += srcStride; + + sum1A = vec_adds(srcP0ssA, srcP1ssA); + sum1B = vec_adds(srcP0ssB, srcP1ssB); + sum2A = vec_adds(srcM1ssA, srcP2ssA); + sum2B = vec_adds(srcM1ssB, srcP2ssB); + sum3A = vec_adds(srcM2ssA, srcP3ssA); + sum3B = vec_adds(srcM2ssB, srcP3ssB); + + srcM2ssA = srcM1ssA; + srcM2ssB = srcM1ssB; + srcM1ssA = srcP0ssA; + srcM1ssB = srcP0ssB; + srcP0ssA = srcP1ssA; + srcP0ssB = srcP1ssB; + srcP1ssA = srcP2ssA; + srcP1ssB = srcP2ssB; + srcP2ssA = srcP3ssA; + srcP2ssB = srcP3ssB; + + pp1A = vec_mladd(sum1A, v20ss, v16ss); + pp1B = vec_mladd(sum1B, v20ss, v16ss); + + pp2A = vec_mladd(sum2A, v5ss, (vector signed short)vzero); + pp2B = vec_mladd(sum2B, v5ss, (vector signed short)vzero); + + pp3A = vec_add(sum3A, pp1A); + pp3B = vec_add(sum3B, pp1B); + + psumA = vec_sub(pp3A, pp2A); + psumB = vec_sub(pp3B, pp2B); + + sumA = vec_sra(psumA, v5us); + sumB = vec_sra(psumB, v5us); + + sum = vec_packsu(sumA, sumB); + + dst1 = vec_ld(0, dst); + dst2 = vec_ld(16, dst); + vdst = vec_perm(dst1, dst2, vec_lvsl(0, dst)); + + OP_U8_ALTIVEC(fsum, sum, vdst); + + rsum = vec_perm(fsum, fsum, dstperm); + fdst1 = vec_sel(dst1, rsum, dstmask); + fdst2 = vec_sel(rsum, dst2, dstmask); + + vec_st(fdst1, 0, dst); + vec_st(fdst2, 16, dst); + + dst += dstStride; + } + POWERPC_PERF_STOP_COUNT(PREFIX_h264_qpel16_v_lowpass_num, 1); +} + +/* this code assume stride % 16 == 0 *and* tmp is properly aligned */ +static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp, uint8_t * src, int dstStride, int tmpStride, int srcStride) { + POWERPC_PERF_DECLARE(PREFIX_h264_qpel16_hv_lowpass_num, 1); + register int i; + const vector signed int vzero = vec_splat_s32(0); + const vector unsigned char permM2 = vec_lvsl(-2, src); + const vector unsigned char permM1 = vec_lvsl(-1, src); + const vector unsigned char permP0 = vec_lvsl(+0, src); + const vector unsigned char permP1 = vec_lvsl(+1, src); + const vector unsigned char permP2 = vec_lvsl(+2, src); + const vector unsigned char permP3 = vec_lvsl(+3, src); + const vector signed short v20ss = vec_sl(vec_splat_s16(5),vec_splat_u16(2)); + const vector unsigned int v10ui = vec_splat_u32(10); + const vector signed short v5ss = vec_splat_s16(5); + const vector signed short v1ss = vec_splat_s16(1); + const vector signed int v512si = vec_sl(vec_splat_s32(1),vec_splat_u32(9)); + const vector unsigned int v16ui = vec_sl(vec_splat_u32(1),vec_splat_u32(4)); + + register int align = ((((unsigned long)src) - 2) % 16); + + const vector unsigned char neg1 = (const vector unsigned char) + vec_splat_s8(-1); + + vector signed short srcP0A, srcP0B, srcP1A, srcP1B, + srcP2A, srcP2B, srcP3A, srcP3B, + srcM1A, srcM1B, srcM2A, srcM2B, + sum1A, sum1B, sum2A, sum2B, sum3A, sum3B, + pp1A, pp1B, pp2A, pp2B, psumA, psumB; + + const vector unsigned char dstperm = vec_lvsr(0, dst); + + const vector unsigned char dstmask = vec_perm((const vector unsigned char)vzero, neg1, dstperm); + + const vector unsigned char mperm = (const vector unsigned char) + AVV(0x00, 0x08, 0x01, 0x09, 0x02, 0x0A, 0x03, 0x0B, + 0x04, 0x0C, 0x05, 0x0D, 0x06, 0x0E, 0x07, 0x0F); + int16_t *tmpbis = tmp; + + vector signed short tmpM1ssA, tmpM1ssB, tmpM2ssA, tmpM2ssB, + tmpP0ssA, tmpP0ssB, tmpP1ssA, tmpP1ssB, + tmpP2ssA, tmpP2ssB; + + vector signed int pp1Ae, pp1Ao, pp1Be, pp1Bo, pp2Ae, pp2Ao, pp2Be, pp2Bo, + pp3Ae, pp3Ao, pp3Be, pp3Bo, pp1cAe, pp1cAo, pp1cBe, pp1cBo, + pp32Ae, pp32Ao, pp32Be, pp32Bo, sumAe, sumAo, sumBe, sumBo, + ssumAe, ssumAo, ssumBe, ssumBo; + vector unsigned char fsum, sumv, sum, dst1, dst2, vdst, + rsum, fdst1, fdst2; + vector signed short ssume, ssumo; + + POWERPC_PERF_START_COUNT(PREFIX_h264_qpel16_hv_lowpass_num, 1); + src -= (2 * srcStride); + for (i = 0 ; i < 21 ; i ++) { + vector unsigned char srcM2, srcM1, srcP0, srcP1, srcP2, srcP3; + vector unsigned char srcR1 = vec_ld(-2, src); + vector unsigned char srcR2 = vec_ld(14, src); + + switch (align) { + default: { + srcM2 = vec_perm(srcR1, srcR2, permM2); + srcM1 = vec_perm(srcR1, srcR2, permM1); + srcP0 = vec_perm(srcR1, srcR2, permP0); + srcP1 = vec_perm(srcR1, srcR2, permP1); + srcP2 = vec_perm(srcR1, srcR2, permP2); + srcP3 = vec_perm(srcR1, srcR2, permP3); + } break; + case 11: { + srcM2 = vec_perm(srcR1, srcR2, permM2); + srcM1 = vec_perm(srcR1, srcR2, permM1); + srcP0 = vec_perm(srcR1, srcR2, permP0); + srcP1 = vec_perm(srcR1, srcR2, permP1); + srcP2 = vec_perm(srcR1, srcR2, permP2); + srcP3 = srcR2; + } break; + case 12: { + vector unsigned char srcR3 = vec_ld(30, src); + srcM2 = vec_perm(srcR1, srcR2, permM2); + srcM1 = vec_perm(srcR1, srcR2, permM1); + srcP0 = vec_perm(srcR1, srcR2, permP0); + srcP1 = vec_perm(srcR1, srcR2, permP1); + srcP2 = srcR2; + srcP3 = vec_perm(srcR2, srcR3, permP3); + } break; + case 13: { + vector unsigned char srcR3 = vec_ld(30, src); + srcM2 = vec_perm(srcR1, srcR2, permM2); + srcM1 = vec_perm(srcR1, srcR2, permM1); + srcP0 = vec_perm(srcR1, srcR2, permP0); + srcP1 = srcR2; + srcP2 = vec_perm(srcR2, srcR3, permP2); + srcP3 = vec_perm(srcR2, srcR3, permP3); + } break; + case 14: { + vector unsigned char srcR3 = vec_ld(30, src); + srcM2 = vec_perm(srcR1, srcR2, permM2); + srcM1 = vec_perm(srcR1, srcR2, permM1); + srcP0 = srcR2; + srcP1 = vec_perm(srcR2, srcR3, permP1); + srcP2 = vec_perm(srcR2, srcR3, permP2); + srcP3 = vec_perm(srcR2, srcR3, permP3); + } break; + case 15: { + vector unsigned char srcR3 = vec_ld(30, src); + srcM2 = vec_perm(srcR1, srcR2, permM2); + srcM1 = srcR2; + srcP0 = vec_perm(srcR2, srcR3, permP0); + srcP1 = vec_perm(srcR2, srcR3, permP1); + srcP2 = vec_perm(srcR2, srcR3, permP2); + srcP3 = vec_perm(srcR2, srcR3, permP3); + } break; + } + + srcP0A = (vector signed short) + vec_mergeh((vector unsigned char)vzero, srcP0); + srcP0B = (vector signed short) + vec_mergel((vector unsigned char)vzero, srcP0); + srcP1A = (vector signed short) + vec_mergeh((vector unsigned char)vzero, srcP1); + srcP1B = (vector signed short) + vec_mergel((vector unsigned char)vzero, srcP1); + + srcP2A = (vector signed short) + vec_mergeh((vector unsigned char)vzero, srcP2); + srcP2B = (vector signed short) + vec_mergel((vector unsigned char)vzero, srcP2); + srcP3A = (vector signed short) + vec_mergeh((vector unsigned char)vzero, srcP3); + srcP3B = (vector signed short) + vec_mergel((vector unsigned char)vzero, srcP3); + + srcM1A = (vector signed short) + vec_mergeh((vector unsigned char)vzero, srcM1); + srcM1B = (vector signed short) + vec_mergel((vector unsigned char)vzero, srcM1); + srcM2A = (vector signed short) + vec_mergeh((vector unsigned char)vzero, srcM2); + srcM2B = (vector signed short) + vec_mergel((vector unsigned char)vzero, srcM2); + + sum1A = vec_adds(srcP0A, srcP1A); + sum1B = vec_adds(srcP0B, srcP1B); + sum2A = vec_adds(srcM1A, srcP2A); + sum2B = vec_adds(srcM1B, srcP2B); + sum3A = vec_adds(srcM2A, srcP3A); + sum3B = vec_adds(srcM2B, srcP3B); + + pp1A = vec_mladd(sum1A, v20ss, sum3A); + pp1B = vec_mladd(sum1B, v20ss, sum3B); + + pp2A = vec_mladd(sum2A, v5ss, (vector signed short)vzero); + pp2B = vec_mladd(sum2B, v5ss, (vector signed short)vzero); + + psumA = vec_sub(pp1A, pp2A); + psumB = vec_sub(pp1B, pp2B); + + vec_st(psumA, 0, tmp); + vec_st(psumB, 16, tmp); + + src += srcStride; + tmp += tmpStride; /* int16_t*, and stride is 16, so it's OK here */ + } + + tmpM2ssA = vec_ld(0, tmpbis); + tmpM2ssB = vec_ld(16, tmpbis); + tmpbis += tmpStride; + tmpM1ssA = vec_ld(0, tmpbis); + tmpM1ssB = vec_ld(16, tmpbis); + tmpbis += tmpStride; + tmpP0ssA = vec_ld(0, tmpbis); + tmpP0ssB = vec_ld(16, tmpbis); + tmpbis += tmpStride; + tmpP1ssA = vec_ld(0, tmpbis); + tmpP1ssB = vec_ld(16, tmpbis); + tmpbis += tmpStride; + tmpP2ssA = vec_ld(0, tmpbis); + tmpP2ssB = vec_ld(16, tmpbis); + tmpbis += tmpStride; + + for (i = 0 ; i < 16 ; i++) { + const vector signed short tmpP3ssA = vec_ld(0, tmpbis); + const vector signed short tmpP3ssB = vec_ld(16, tmpbis); + + const vector signed short sum1A = vec_adds(tmpP0ssA, tmpP1ssA); + const vector signed short sum1B = vec_adds(tmpP0ssB, tmpP1ssB); + const vector signed short sum2A = vec_adds(tmpM1ssA, tmpP2ssA); + const vector signed short sum2B = vec_adds(tmpM1ssB, tmpP2ssB); + const vector signed short sum3A = vec_adds(tmpM2ssA, tmpP3ssA); + const vector signed short sum3B = vec_adds(tmpM2ssB, tmpP3ssB); + + tmpbis += tmpStride; + + tmpM2ssA = tmpM1ssA; + tmpM2ssB = tmpM1ssB; + tmpM1ssA = tmpP0ssA; + tmpM1ssB = tmpP0ssB; + tmpP0ssA = tmpP1ssA; + tmpP0ssB = tmpP1ssB; + tmpP1ssA = tmpP2ssA; + tmpP1ssB = tmpP2ssB; + tmpP2ssA = tmpP3ssA; + tmpP2ssB = tmpP3ssB; + + pp1Ae = vec_mule(sum1A, v20ss); + pp1Ao = vec_mulo(sum1A, v20ss); + pp1Be = vec_mule(sum1B, v20ss); + pp1Bo = vec_mulo(sum1B, v20ss); + + pp2Ae = vec_mule(sum2A, v5ss); + pp2Ao = vec_mulo(sum2A, v5ss); + pp2Be = vec_mule(sum2B, v5ss); + pp2Bo = vec_mulo(sum2B, v5ss); + + pp3Ae = vec_sra((vector signed int)sum3A, v16ui); + pp3Ao = vec_mulo(sum3A, v1ss); + pp3Be = vec_sra((vector signed int)sum3B, v16ui); + pp3Bo = vec_mulo(sum3B, v1ss); + + pp1cAe = vec_add(pp1Ae, v512si); + pp1cAo = vec_add(pp1Ao, v512si); + pp1cBe = vec_add(pp1Be, v512si); + pp1cBo = vec_add(pp1Bo, v512si); + + pp32Ae = vec_sub(pp3Ae, pp2Ae); + pp32Ao = vec_sub(pp3Ao, pp2Ao); + pp32Be = vec_sub(pp3Be, pp2Be); + pp32Bo = vec_sub(pp3Bo, pp2Bo); + + sumAe = vec_add(pp1cAe, pp32Ae); + sumAo = vec_add(pp1cAo, pp32Ao); + sumBe = vec_add(pp1cBe, pp32Be); + sumBo = vec_add(pp1cBo, pp32Bo); + + ssumAe = vec_sra(sumAe, v10ui); + ssumAo = vec_sra(sumAo, v10ui); + ssumBe = vec_sra(sumBe, v10ui); + ssumBo = vec_sra(sumBo, v10ui); + + ssume = vec_packs(ssumAe, ssumBe); + ssumo = vec_packs(ssumAo, ssumBo); + + sumv = vec_packsu(ssume, ssumo); + sum = vec_perm(sumv, sumv, mperm); + + dst1 = vec_ld(0, dst); + dst2 = vec_ld(16, dst); + vdst = vec_perm(dst1, dst2, vec_lvsl(0, dst)); + + OP_U8_ALTIVEC(fsum, sum, vdst); + + rsum = vec_perm(fsum, fsum, dstperm); + fdst1 = vec_sel(dst1, rsum, dstmask); + fdst2 = vec_sel(rsum, dst2, dstmask); + + vec_st(fdst1, 0, dst); + vec_st(fdst2, 16, dst); + + dst += dstStride; + } + POWERPC_PERF_STOP_COUNT(PREFIX_h264_qpel16_hv_lowpass_num, 1); +} diff --git a/src/libffmpeg/libavcodec/ppc/mathops.h b/src/libffmpeg/libavcodec/ppc/mathops.h new file mode 100644 index 000000000..6af23f246 --- /dev/null +++ b/src/libffmpeg/libavcodec/ppc/mathops.h @@ -0,0 +1,33 @@ +/* + * simple math operations + * Copyright (c) 2001, 2002 Fabrice Bellard. + * Copyright (c) 2006 Michael Niedermayer et al + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#if defined(ARCH_POWERPC_405) +/* signed 16x16 -> 32 multiply add accumulate */ +# define MAC16(rt, ra, rb) \ + asm ("maclhw %0, %2, %3" : "=r" (rt) : "0" (rt), "r" (ra), "r" (rb)); + +/* signed 16x16 -> 32 multiply */ +# define MUL16(ra, rb) \ + ({ int __rt; + asm ("mullhw %0, %1, %2" : "=r" (__rt) : "r" (ra), "r" (rb)); + __rt; }) +#endif diff --git a/src/libffmpeg/libavcodec/ppc/snow_altivec.c b/src/libffmpeg/libavcodec/ppc/snow_altivec.c new file mode 100644 index 000000000..b15672ffe --- /dev/null +++ b/src/libffmpeg/libavcodec/ppc/snow_altivec.c @@ -0,0 +1,788 @@ +/* + * Altivec optimized snow DSP utils + * Copyright (c) 2006 Luca Barbato + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * + */ + +#include "../dsputil.h" + +#include "gcc_fixes.h" +#include "dsputil_altivec.h" +#include "../snow.h" + +#undef NDEBUG +#include + + + +//FIXME remove this replication +#define slice_buffer_get_line(slice_buf, line_num) ((slice_buf)->line[line_num] ? (slice_buf)->line[line_num] : slice_buffer_load_line((slice_buf), (line_num))) + +static DWTELEM * slice_buffer_load_line(slice_buffer * buf, int line) +{ + int offset; + DWTELEM * buffer; + +// av_log(NULL, AV_LOG_DEBUG, "Cache hit: %d\n", line); + + assert(buf->data_stack_top >= 0); +// assert(!buf->line[line]); + if (buf->line[line]) + return buf->line[line]; + + offset = buf->line_width * line; + buffer = buf->data_stack[buf->data_stack_top]; + buf->data_stack_top--; + buf->line[line] = buffer; + +// av_log(NULL, AV_LOG_DEBUG, "slice_buffer_load_line: line: %d remaining: %d\n", line, buf->data_stack_top + 1); + + return buffer; +} + + +//altivec code + +void ff_snow_horizontal_compose97i_altivec(DWTELEM *b, int width) +{ + const int w2= (width+1)>>1; + DECLARE_ALIGNED_16(DWTELEM, temp[(width>>1)]); + const int w_l= (width>>1); + const int w_r= w2 - 1; + int i; + vector signed int t1, t2, x, y, tmp1, tmp2; + vector signed int *vbuf, *vtmp; + vector unsigned char align; + + + + { // Lift 0 + DWTELEM * const ref = b + w2 - 1; + DWTELEM b_0 = b[0]; + vbuf = (vector signed int *)b; + + tmp1 = vec_ld (0, ref); + align = vec_lvsl (0, ref); + tmp2 = vec_ld (15, ref); + t1= vec_perm(tmp1, tmp2, align); + + i = 0; + + for (i=0; i> 3); + b[i+1] = b[i+1] - ((3 * (ref[i+1] + ref[i+2]) + 4) >> 3); + b[i+2] = b[i+2] - ((3 * (ref[i+2] + ref[i+3]) + 4) >> 3); + b[i+3] = b[i+3] - ((3 * (ref[i+3] + ref[i+4]) + 4) >> 3); +#else + + tmp1 = vec_ld (0, ref+4+i); + tmp2 = vec_ld (15, ref+4+i); + + t2 = vec_perm(tmp1, tmp2, align); + + y = vec_add(t1,vec_sld(t1,t2,4)); + y = vec_add(vec_add(y,y),y); + + tmp1 = vec_ld (0, ref+8+i); + + y = vec_add(y, vec_splat_s32(4)); + y = vec_sra(y, vec_splat_u32(3)); + + tmp2 = vec_ld (15, ref+8+i); + + *vbuf = vec_sub(*vbuf, y); + + t1=t2; + + vbuf++; + + t2 = vec_perm(tmp1, tmp2, align); + + y = vec_add(t1,vec_sld(t1,t2,4)); + y = vec_add(vec_add(y,y),y); + + tmp1 = vec_ld (0, ref+12+i); + + y = vec_add(y, vec_splat_s32(4)); + y = vec_sra(y, vec_splat_u32(3)); + + tmp2 = vec_ld (15, ref+12+i); + + *vbuf = vec_sub(*vbuf, y); + + t1=t2; + + vbuf++; + + t2 = vec_perm(tmp1, tmp2, align); + + y = vec_add(t1,vec_sld(t1,t2,4)); + y = vec_add(vec_add(y,y),y); + + tmp1 = vec_ld (0, ref+16+i); + + y = vec_add(y, vec_splat_s32(4)); + y = vec_sra(y, vec_splat_u32(3)); + + tmp2 = vec_ld (15, ref+16+i); + + *vbuf = vec_sub(*vbuf, y); + + t1=t2; + + t2 = vec_perm(tmp1, tmp2, align); + + y = vec_add(t1,vec_sld(t1,t2,4)); + y = vec_add(vec_add(y,y),y); + + vbuf++; + + y = vec_add(y, vec_splat_s32(4)); + y = vec_sra(y, vec_splat_u32(3)); + *vbuf = vec_sub(*vbuf, y); + + t1=t2; + + vbuf++; + +#endif + } + + snow_horizontal_compose_lift_lead_out(i, b, b, ref, width, w_l, 0, W_DM, W_DO, W_DS); + b[0] = b_0 - ((W_DM * 2 * ref[1]+W_DO)>>W_DS); + } + + { // Lift 1 + DWTELEM * const dst = b+w2; + + i = 0; + for(; (((long)&dst[i]) & 0xF) && i> 4); + b[i+1] = b[i+1] - (((8 -(ref[i+1] + ref[i+2])) - (b[i+1]<<2)) >> 4); + b[i+2] = b[i+2] - (((8 -(ref[i+2] + ref[i+3])) - (b[i+2]<<2)) >> 4); + b[i+3] = b[i+3] - (((8 -(ref[i+3] + ref[i+4])) - (b[i+3]<<2)) >> 4); +#else + tmp1 = vec_ld (0, ref+4+i); + tmp2 = vec_ld (15, ref+4+i); + + t2 = vec_perm(tmp1, tmp2, align); + + y = vec_add(t1,vec_sld(t1,t2,4)); + y = vec_sub(vec_splat_s32(8),y); + + tmp1 = vec_ld (0, ref+8+i); + + x = vec_sl(*vbuf,vec_splat_u32(2)); + y = vec_sra(vec_sub(y,x),vec_splat_u32(4)); + + tmp2 = vec_ld (15, ref+8+i); + + *vbuf = vec_sub( *vbuf, y); + + t1 = t2; + + vbuf++; + + t2 = vec_perm(tmp1, tmp2, align); + + y = vec_add(t1,vec_sld(t1,t2,4)); + y = vec_sub(vec_splat_s32(8),y); + + tmp1 = vec_ld (0, ref+12+i); + + x = vec_sl(*vbuf,vec_splat_u32(2)); + y = vec_sra(vec_sub(y,x),vec_splat_u32(4)); + + tmp2 = vec_ld (15, ref+12+i); + + *vbuf = vec_sub( *vbuf, y); + + t1 = t2; + + vbuf++; + + t2 = vec_perm(tmp1, tmp2, align); + + y = vec_add(t1,vec_sld(t1,t2,4)); + y = vec_sub(vec_splat_s32(8),y); + + tmp1 = vec_ld (0, ref+16+i); + + x = vec_sl(*vbuf,vec_splat_u32(2)); + y = vec_sra(vec_sub(y,x),vec_splat_u32(4)); + + tmp2 = vec_ld (15, ref+16+i); + + *vbuf = vec_sub( *vbuf, y); + + t1 = t2; + + vbuf++; + + t2 = vec_perm(tmp1, tmp2, align); + + y = vec_add(t1,vec_sld(t1,t2,4)); + y = vec_sub(vec_splat_s32(8),y); + + t1 = t2; + + x = vec_sl(*vbuf,vec_splat_u32(2)); + y = vec_sra(vec_sub(y,x),vec_splat_u32(4)); + *vbuf = vec_sub( *vbuf, y); + + vbuf++; + +#endif + } + + snow_horizontal_compose_liftS_lead_out(i, b, b, ref, width, w_l); + b[0] = b_0 - (((-2 * ref[1] + W_BO) - 4 * b_0) >> W_BS); + } + + { // Lift 3 + DWTELEM * const src = b+w2; + + vbuf = (vector signed int *)b; + vtmp = (vector signed int *)temp; + + i = 0; + align = vec_lvsl(0, src); + + for (; i>1); + temp[i+1] = src[i+1] - ((-3*(b[i+1] + b[i+2]))>>1); + temp[i+2] = src[i+2] - ((-3*(b[i+2] + b[i+3]))>>1); + temp[i+3] = src[i+3] - ((-3*(b[i+3] + b[i+4]))>>1); +#else + tmp1 = vec_ld(0,src+i); + t1 = vec_add(vbuf[0],vec_sld(vbuf[0],vbuf[1],4)); + tmp2 = vec_ld(15,src+i); + t1 = vec_sub(vec_splat_s32(0),t1); //bad! + t1 = vec_add(t1,vec_add(t1,t1)); + t2 = vec_perm(tmp1 ,tmp2 ,align); + t1 = vec_sra(t1,vec_splat_u32(1)); + vbuf++; + *vtmp = vec_sub(t2,t1); + vtmp++; + +#endif + + } + + snow_horizontal_compose_lift_lead_out(i, temp, src, b, width, w_r, 1, -3, 0, 1); + } + + { + //Interleave + int a; + vector signed int *t = (vector signed int *)temp, + *v = (vector signed int *)b; + + snow_interleave_line_header(&i, width, b, temp); + + for (; (i & 0xE) != 0xE; i-=2){ + b[i+1] = temp[i>>1]; + b[i] = b[i>>1]; + } + for (i-=14; i>=0; i-=16){ + a=i/4; + + v[a+3]=vec_mergel(v[(a>>1)+1],t[(a>>1)+1]); + v[a+2]=vec_mergeh(v[(a>>1)+1],t[(a>>1)+1]); + v[a+1]=vec_mergel(v[a>>1],t[a>>1]); + v[a]=vec_mergeh(v[a>>1],t[a>>1]); + + } + + } +} + +void ff_snow_vertical_compose97i_altivec(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, DWTELEM *b3, DWTELEM *b4, DWTELEM *b5, int width) +{ + int i, w4 = width/4; + vector signed int *v0, *v1,*v2,*v3,*v4,*v5; + vector signed int t1, t2; + + v0=(vector signed int *)b0; + v1=(vector signed int *)b1; + v2=(vector signed int *)b2; + v3=(vector signed int *)b3; + v4=(vector signed int *)b4; + v5=(vector signed int *)b5; + + for (i=0; i< w4;i++) + { + + #if 0 + b4[i] -= (3*(b3[i] + b5[i])+4)>>3; + b3[i] -= ((b2[i] + b4[i])); + b2[i] += ((b1[i] + b3[i])+4*b2[i]+8)>>4; + b1[i] += (3*(b0[i] + b2[i]))>>1; + #else + t1 = vec_add(v3[i], v5[i]); + t2 = vec_add(t1, vec_add(t1,t1)); + t1 = vec_add(t2, vec_splat_s32(4)); + v4[i] = vec_sub(v4[i], vec_sra(t1,vec_splat_u32(3))); + + v3[i] = vec_sub(v3[i], vec_add(v2[i], v4[i])); + + t1 = vec_add(vec_splat_s32(8), vec_add(v1[i], v3[i])); + t2 = vec_sl(v2[i], vec_splat_u32(2)); + v2[i] = vec_add(v2[i], vec_sra(vec_add(t1,t2),vec_splat_u32(4))); + t1 = vec_add(v0[i], v2[i]); + t2 = vec_add(t1, vec_add(t1,t1)); + v1[i] = vec_add(v1[i], vec_sra(t2,vec_splat_u32(1))); + + #endif + } + + for(i*=4; i < width; i++) + { + b4[i] -= (W_DM*(b3[i] + b5[i])+W_DO)>>W_DS; + b3[i] -= (W_CM*(b2[i] + b4[i])+W_CO)>>W_CS; + b2[i] += (W_BM*(b1[i] + b3[i])+4*b2[i]+W_BO)>>W_BS; + b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS; + } +} + +#define LOAD_BLOCKS \ + tmp1 = vec_ld(0, &block[3][y*src_stride]);\ + align = vec_lvsl(0, &block[3][y*src_stride]);\ + tmp2 = vec_ld(15, &block[3][y*src_stride]);\ +\ + b3 = vec_perm(tmp1,tmp2,align);\ +\ + tmp1 = vec_ld(0, &block[2][y*src_stride]);\ + align = vec_lvsl(0, &block[2][y*src_stride]);\ + tmp2 = vec_ld(15, &block[2][y*src_stride]);\ +\ + b2 = vec_perm(tmp1,tmp2,align);\ +\ + tmp1 = vec_ld(0, &block[1][y*src_stride]);\ + align = vec_lvsl(0, &block[1][y*src_stride]);\ + tmp2 = vec_ld(15, &block[1][y*src_stride]);\ +\ + b1 = vec_perm(tmp1,tmp2,align);\ +\ + tmp1 = vec_ld(0, &block[0][y*src_stride]);\ + align = vec_lvsl(0, &block[0][y*src_stride]);\ + tmp2 = vec_ld(15, &block[0][y*src_stride]);\ +\ + b0 = vec_perm(tmp1,tmp2,align); + +#define LOAD_OBMCS \ + tmp1 = vec_ld(0, obmc1);\ + align = vec_lvsl(0, obmc1);\ + tmp2 = vec_ld(15, obmc1);\ +\ + ob1 = vec_perm(tmp1,tmp2,align);\ +\ + tmp1 = vec_ld(0, obmc2);\ + align = vec_lvsl(0, obmc2);\ + tmp2 = vec_ld(15, obmc2);\ +\ + ob2 = vec_perm(tmp1,tmp2,align);\ +\ + tmp1 = vec_ld(0, obmc3);\ + align = vec_lvsl(0, obmc3);\ + tmp2 = vec_ld(15, obmc3);\ +\ + ob3 = vec_perm(tmp1,tmp2,align);\ +\ + tmp1 = vec_ld(0, obmc4);\ + align = vec_lvsl(0, obmc4);\ + tmp2 = vec_ld(15, obmc4);\ +\ + ob4 = vec_perm(tmp1,tmp2,align); + +/* interleave logic + * h1 <- [ a,b,a,b, a,b,a,b, a,b,a,b, a,b,a,b ] + * h2 <- [ c,d,c,d, c,d,c,d, c,d,c,d, c,d,c,d ] + * h <- [ a,b,c,d, a,b,c,d, a,b,c,d, a,b,c,d ] + */ + +#define STEPS_0_1\ + h1 = (vector unsigned short)\ + vec_mergeh(ob1, ob2);\ +\ + h2 = (vector unsigned short)\ + vec_mergeh(ob3, ob4);\ +\ + ih = (vector unsigned char)\ + vec_mergeh(h1,h2);\ +\ + l1 = (vector unsigned short) vec_mergeh(b3, b2);\ +\ + ih1 = (vector unsigned char) vec_mergel(h1, h2);\ +\ + l2 = (vector unsigned short) vec_mergeh(b1, b0);\ +\ + il = (vector unsigned char) vec_mergeh(l1, l2);\ +\ + v[0] = (vector signed int) vec_msum(ih, il, vec_splat_u32(0));\ +\ + il1 = (vector unsigned char) vec_mergel(l1, l2);\ +\ + v[1] = (vector signed int) vec_msum(ih1, il1, vec_splat_u32(0)); + +#define FINAL_STEP_SCALAR\ + for(x=0; x> FRAC_BITS;\ + if(vbuf[x]&(~255)) vbuf[x]= ~(vbuf[x]>>31);\ + dst8[x + y*src_stride] = vbuf[x];\ + }else{\ + dst[x + src_x] -= vbuf[x];\ + } + +static void inner_add_yblock_bw_8_obmc_16_altivec(uint8_t *obmc, + const int obmc_stride, + uint8_t * * block, int b_w, + int b_h, int src_x, int src_y, + int src_stride, slice_buffer * sb, + int add, uint8_t * dst8) +{ + int y, x; + DWTELEM * dst; + vector unsigned short h1, h2, l1, l2; + vector unsigned char ih, il, ih1, il1, tmp1, tmp2, align; + vector unsigned char b0,b1,b2,b3; + vector unsigned char ob1,ob2,ob3,ob4; + + DECLARE_ALIGNED_16(int, vbuf[16]); + vector signed int *v = (vector signed int *)vbuf, *d; + + for(y=0; y>1); + uint8_t *obmc3= obmc1+ obmc_stride*(obmc_stride>>1); + uint8_t *obmc4= obmc3+ (obmc_stride>>1); + + dst = slice_buffer_get_line(sb, src_y + y); + d = (vector signed int *)(dst + src_x); + +//FIXME i could avoid some loads! + + // load blocks + LOAD_BLOCKS + + // load obmcs + LOAD_OBMCS + + // steps 0 1 + STEPS_0_1 + + FINAL_STEP_SCALAR + + } + +} + +#define STEPS_2_3\ + h1 = (vector unsigned short) vec_mergel(ob1, ob2);\ +\ + h2 = (vector unsigned short) vec_mergel(ob3, ob4);\ +\ + ih = (vector unsigned char) vec_mergeh(h1,h2);\ +\ + l1 = (vector unsigned short) vec_mergel(b3, b2);\ +\ + l2 = (vector unsigned short) vec_mergel(b1, b0);\ +\ + ih1 = (vector unsigned char) vec_mergel(h1,h2);\ +\ + il = (vector unsigned char) vec_mergeh(l1,l2);\ +\ + v[2] = (vector signed int) vec_msum(ih, il, vec_splat_u32(0));\ +\ + il1 = (vector unsigned char) vec_mergel(l1,l2);\ +\ + v[3] = (vector signed int) vec_msum(ih1, il1, vec_splat_u32(0)); + + +static void inner_add_yblock_bw_16_obmc_32_altivec(uint8_t *obmc, + const int obmc_stride, + uint8_t * * block, int b_w, + int b_h, int src_x, int src_y, + int src_stride, slice_buffer * sb, + int add, uint8_t * dst8) +{ + int y, x; + DWTELEM * dst; + vector unsigned short h1, h2, l1, l2; + vector unsigned char ih, il, ih1, il1, tmp1, tmp2, align; + vector unsigned char b0,b1,b2,b3; + vector unsigned char ob1,ob2,ob3,ob4; + DECLARE_ALIGNED_16(int, vbuf[b_w]); + vector signed int *v = (vector signed int *)vbuf, *d; + + for(y=0; y>1); + uint8_t *obmc3= obmc1+ obmc_stride*(obmc_stride>>1); + uint8_t *obmc4= obmc3+ (obmc_stride>>1); + + dst = slice_buffer_get_line(sb, src_y + y); + d = (vector signed int *)(dst + src_x); + + // load blocks + LOAD_BLOCKS + + // load obmcs + LOAD_OBMCS + + // steps 0 1 2 3 + STEPS_0_1 + + STEPS_2_3 + + FINAL_STEP_SCALAR + + } +} + +#define FINAL_STEP_VEC \ +\ + if(add)\ + {\ + for(x=0; x>1); + uint8_t *obmc3= obmc1+ obmc_stride*(obmc_stride>>1); + uint8_t *obmc4= obmc3+ (obmc_stride>>1); + + dst = slice_buffer_get_line(sb, src_y + y); + d = (vector signed int *)(dst + src_x); + +//FIXME i could avoid some loads! + + // load blocks + LOAD_BLOCKS + + // load obmcs + LOAD_OBMCS + + // steps 0 1 + STEPS_0_1 + + FINAL_STEP_VEC + + } + +} + +static void inner_add_yblock_a_bw_16_obmc_32_altivec(uint8_t *obmc, + const int obmc_stride, + uint8_t * * block, int b_w, + int b_h, int src_x, int src_y, + int src_stride, slice_buffer * sb, + int add, uint8_t * dst8) +{ + int y, x; + DWTELEM * dst; + vector bool int mask; + vector signed int vs; + vector unsigned short h1, h2, l1, l2; + vector unsigned char ih, il, ih1, il1, tmp1, tmp2, align; + vector unsigned char b0,b1,b2,b3; + vector unsigned char ob1,ob2,ob3,ob4; + DECLARE_ALIGNED_16(int, vbuf[b_w]); + vector signed int *v = (vector signed int *)vbuf, *d; + + for(y=0; y>1); + uint8_t *obmc3= obmc1+ obmc_stride*(obmc_stride>>1); + uint8_t *obmc4= obmc3+ (obmc_stride>>1); + + dst = slice_buffer_get_line(sb, src_y + y); + d = (vector signed int *)(dst + src_x); + + // load blocks + LOAD_BLOCKS + + // load obmcs + LOAD_OBMCS + + // steps 0 1 2 3 + STEPS_0_1 + + STEPS_2_3 + + FINAL_STEP_VEC + + } +} + + +void ff_snow_inner_add_yblock_altivec(uint8_t *obmc, const int obmc_stride, + uint8_t * * block, int b_w, int b_h, + int src_x, int src_y, int src_stride, + slice_buffer * sb, int add, + uint8_t * dst8) +{ + if (src_x&15) { + if (b_w == 16) + inner_add_yblock_bw_16_obmc_32_altivec(obmc, obmc_stride, block, + b_w, b_h, src_x, src_y, + src_stride, sb, add, dst8); + else if (b_w == 8) + inner_add_yblock_bw_8_obmc_16_altivec(obmc, obmc_stride, block, + b_w, b_h, src_x, src_y, + src_stride, sb, add, dst8); + else + ff_snow_inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x, + src_y, src_stride, sb, add, dst8); + } else { + if (b_w == 16) + inner_add_yblock_a_bw_16_obmc_32_altivec(obmc, obmc_stride, block, + b_w, b_h, src_x, src_y, + src_stride, sb, add, dst8); + else if (b_w == 8) + inner_add_yblock_a_bw_8_obmc_16_altivec(obmc, obmc_stride, block, + b_w, b_h, src_x, src_y, + src_stride, sb, add, dst8); + else + ff_snow_inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x, + src_y, src_stride, sb, add, dst8); + } +} + + +void snow_init_altivec(DSPContext* c, AVCodecContext *avctx) +{ + c->horizontal_compose97i = ff_snow_horizontal_compose97i_altivec; + c->vertical_compose97i = ff_snow_vertical_compose97i_altivec; + c->inner_add_yblock = ff_snow_inner_add_yblock_altivec; +} diff --git a/src/libffmpeg/libavcodec/ppc/types_altivec.h b/src/libffmpeg/libavcodec/ppc/types_altivec.h new file mode 100644 index 000000000..f29026e04 --- /dev/null +++ b/src/libffmpeg/libavcodec/ppc/types_altivec.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2006 Guillaume Poirier + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/*********************************************************************** + * Vector types + **********************************************************************/ +#define vec_u8_t vector unsigned char +#define vec_s8_t vector signed char +#define vec_u16_t vector unsigned short +#define vec_s16_t vector signed short +#define vec_u32_t vector unsigned int +#define vec_s32_t vector signed int + +/*********************************************************************** + * Null vector + **********************************************************************/ +#define LOAD_ZERO const vec_u8_t zerov = vec_splat_u8( 0 ) + +#define zero_u8v (vec_u8_t) zerov +#define zero_s8v (vec_s8_t) zerov +#define zero_u16v (vec_u16_t) zerov +#define zero_s16v (vec_s16_t) zerov +#define zero_u32v (vec_u32_t) zerov +#define zero_s32v (vec_s32_t) zerov diff --git a/src/libffmpeg/libavcodec/ppc/vc1dsp_altivec.c b/src/libffmpeg/libavcodec/ppc/vc1dsp_altivec.c new file mode 100644 index 000000000..114c9d41f --- /dev/null +++ b/src/libffmpeg/libavcodec/ppc/vc1dsp_altivec.c @@ -0,0 +1,338 @@ +/* + * VC-1 and WMV3 decoder - DSP functions AltiVec-optimized + * Copyright (c) 2006 Konstantin Shishkov + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "../dsputil.h" + +#include "gcc_fixes.h" + +#include "dsputil_altivec.h" + +// main steps of 8x8 transform +#define STEP8(s0, s1, s2, s3, s4, s5, s6, s7, vec_rnd) \ +do { \ + t0 = vec_sl(vec_add(s0, s4), vec_2); \ + t0 = vec_add(vec_sl(t0, vec_1), t0); \ + t0 = vec_add(t0, vec_rnd); \ + t1 = vec_sl(vec_sub(s0, s4), vec_2); \ + t1 = vec_add(vec_sl(t1, vec_1), t1); \ + t1 = vec_add(t1, vec_rnd); \ + t2 = vec_add(vec_sl(s6, vec_2), vec_sl(s6, vec_1)); \ + t2 = vec_add(t2, vec_sl(s2, vec_4)); \ + t3 = vec_add(vec_sl(s2, vec_2), vec_sl(s2, vec_1)); \ + t3 = vec_sub(t3, vec_sl(s6, vec_4)); \ + t4 = vec_add(t0, t2); \ + t5 = vec_add(t1, t3); \ + t6 = vec_sub(t1, t3); \ + t7 = vec_sub(t0, t2); \ +\ + t0 = vec_sl(vec_add(s1, s3), vec_4); \ + t0 = vec_add(t0, vec_sl(s5, vec_3)); \ + t0 = vec_add(t0, vec_sl(s7, vec_2)); \ + t0 = vec_add(t0, vec_sub(s5, s3)); \ +\ + t1 = vec_sl(vec_sub(s1, s5), vec_4); \ + t1 = vec_sub(t1, vec_sl(s7, vec_3)); \ + t1 = vec_sub(t1, vec_sl(s3, vec_2)); \ + t1 = vec_sub(t1, vec_add(s1, s7)); \ +\ + t2 = vec_sl(vec_sub(s7, s3), vec_4); \ + t2 = vec_add(t2, vec_sl(s1, vec_3)); \ + t2 = vec_add(t2, vec_sl(s5, vec_2)); \ + t2 = vec_add(t2, vec_sub(s1, s7)); \ +\ + t3 = vec_sl(vec_sub(s5, s7), vec_4); \ + t3 = vec_sub(t3, vec_sl(s3, vec_3)); \ + t3 = vec_add(t3, vec_sl(s1, vec_2)); \ + t3 = vec_sub(t3, vec_add(s3, s5)); \ +\ + s0 = vec_add(t4, t0); \ + s1 = vec_add(t5, t1); \ + s2 = vec_add(t6, t2); \ + s3 = vec_add(t7, t3); \ + s4 = vec_sub(t7, t3); \ + s5 = vec_sub(t6, t2); \ + s6 = vec_sub(t5, t1); \ + s7 = vec_sub(t4, t0); \ +}while(0) + +#define SHIFT_HOR8(s0, s1, s2, s3, s4, s5, s6, s7) \ +do { \ + s0 = vec_sra(s0, vec_3); \ + s1 = vec_sra(s1, vec_3); \ + s2 = vec_sra(s2, vec_3); \ + s3 = vec_sra(s3, vec_3); \ + s4 = vec_sra(s4, vec_3); \ + s5 = vec_sra(s5, vec_3); \ + s6 = vec_sra(s6, vec_3); \ + s7 = vec_sra(s7, vec_3); \ +}while(0) + +#define SHIFT_VERT8(s0, s1, s2, s3, s4, s5, s6, s7) \ +do { \ + s0 = vec_sra(s0, vec_7); \ + s1 = vec_sra(s1, vec_7); \ + s2 = vec_sra(s2, vec_7); \ + s3 = vec_sra(s3, vec_7); \ + s4 = vec_sra(vec_add(s4, vec_1s), vec_7); \ + s5 = vec_sra(vec_add(s5, vec_1s), vec_7); \ + s6 = vec_sra(vec_add(s6, vec_1s), vec_7); \ + s7 = vec_sra(vec_add(s7, vec_1s), vec_7); \ +}while(0) + +/* main steps of 4x4 transform */ +#define STEP4(s0, s1, s2, s3, vec_rnd) \ +do { \ + t1 = vec_add(vec_sl(s0, vec_4), s0); \ + t1 = vec_add(t1, vec_rnd); \ + t2 = vec_add(vec_sl(s2, vec_4), s2); \ + t0 = vec_add(t1, t2); \ + t1 = vec_sub(t1, t2); \ + t3 = vec_sl(vec_sub(s3, s1), vec_1); \ + t3 = vec_add(t3, vec_sl(t3, vec_2)); \ + t2 = vec_add(t3, vec_sl(s1, vec_5)); \ + t3 = vec_add(t3, vec_sl(s3, vec_3)); \ + t3 = vec_add(t3, vec_sl(s3, vec_2)); \ + s0 = vec_add(t0, t2); \ + s1 = vec_sub(t1, t3); \ + s2 = vec_add(t1, t3); \ + s3 = vec_sub(t0, t2); \ +}while (0) + +#define SHIFT_HOR4(s0, s1, s2, s3) \ + s0 = vec_sra(s0, vec_3); \ + s1 = vec_sra(s1, vec_3); \ + s2 = vec_sra(s2, vec_3); \ + s3 = vec_sra(s3, vec_3); + +#define SHIFT_VERT4(s0, s1, s2, s3) \ + s0 = vec_sra(s0, vec_7); \ + s1 = vec_sra(s1, vec_7); \ + s2 = vec_sra(s2, vec_7); \ + s3 = vec_sra(s3, vec_7); + +/** Do inverse transform on 8x8 block +*/ +static void vc1_inv_trans_8x8_altivec(DCTELEM block[64]) +{ + vector signed short src0, src1, src2, src3, src4, src5, src6, src7; + vector signed int s0, s1, s2, s3, s4, s5, s6, s7; + vector signed int s8, s9, sA, sB, sC, sD, sE, sF; + vector signed int t0, t1, t2, t3, t4, t5, t6, t7; + const vector signed int vec_64 = vec_sl(vec_splat_s32(4), vec_splat_u32(4)); + const vector unsigned int vec_7 = vec_splat_u32(7); + const vector unsigned int vec_5 = vec_splat_u32(5); + const vector unsigned int vec_4 = vec_splat_u32(4); + const vector signed int vec_4s = vec_splat_s32(4); + const vector unsigned int vec_3 = vec_splat_u32(3); + const vector unsigned int vec_2 = vec_splat_u32(2); + const vector signed int vec_1s = vec_splat_s32(1); + const vector unsigned int vec_1 = vec_splat_u32(1); + + + src0 = vec_ld( 0, block); + src1 = vec_ld( 16, block); + src2 = vec_ld( 32, block); + src3 = vec_ld( 48, block); + src4 = vec_ld( 64, block); + src5 = vec_ld( 80, block); + src6 = vec_ld( 96, block); + src7 = vec_ld(112, block); + + TRANSPOSE8(src0, src1, src2, src3, src4, src5, src6, src7); + s0 = vec_unpackl(src0); + s1 = vec_unpackl(src1); + s2 = vec_unpackl(src2); + s3 = vec_unpackl(src3); + s4 = vec_unpackl(src4); + s5 = vec_unpackl(src5); + s6 = vec_unpackl(src6); + s7 = vec_unpackl(src7); + s8 = vec_unpackh(src0); + s9 = vec_unpackh(src1); + sA = vec_unpackh(src2); + sB = vec_unpackh(src3); + sC = vec_unpackh(src4); + sD = vec_unpackh(src5); + sE = vec_unpackh(src6); + sF = vec_unpackh(src7); + STEP8(s0, s1, s2, s3, s4, s5, s6, s7, vec_4s); + SHIFT_HOR8(s0, s1, s2, s3, s4, s5, s6, s7); + STEP8(s8, s9, sA, sB, sC, sD, sE, sF, vec_4s); + SHIFT_HOR8(s8, s9, sA, sB, sC, sD, sE, sF); + src0 = vec_pack(s8, s0); + src1 = vec_pack(s9, s1); + src2 = vec_pack(sA, s2); + src3 = vec_pack(sB, s3); + src4 = vec_pack(sC, s4); + src5 = vec_pack(sD, s5); + src6 = vec_pack(sE, s6); + src7 = vec_pack(sF, s7); + TRANSPOSE8(src0, src1, src2, src3, src4, src5, src6, src7); + + s0 = vec_unpackl(src0); + s1 = vec_unpackl(src1); + s2 = vec_unpackl(src2); + s3 = vec_unpackl(src3); + s4 = vec_unpackl(src4); + s5 = vec_unpackl(src5); + s6 = vec_unpackl(src6); + s7 = vec_unpackl(src7); + s8 = vec_unpackh(src0); + s9 = vec_unpackh(src1); + sA = vec_unpackh(src2); + sB = vec_unpackh(src3); + sC = vec_unpackh(src4); + sD = vec_unpackh(src5); + sE = vec_unpackh(src6); + sF = vec_unpackh(src7); + STEP8(s0, s1, s2, s3, s4, s5, s6, s7, vec_64); + SHIFT_VERT8(s0, s1, s2, s3, s4, s5, s6, s7); + STEP8(s8, s9, sA, sB, sC, sD, sE, sF, vec_64); + SHIFT_VERT8(s8, s9, sA, sB, sC, sD, sE, sF); + src0 = vec_pack(s8, s0); + src1 = vec_pack(s9, s1); + src2 = vec_pack(sA, s2); + src3 = vec_pack(sB, s3); + src4 = vec_pack(sC, s4); + src5 = vec_pack(sD, s5); + src6 = vec_pack(sE, s6); + src7 = vec_pack(sF, s7); + + vec_st(src0, 0, block); + vec_st(src1, 16, block); + vec_st(src2, 32, block); + vec_st(src3, 48, block); + vec_st(src4, 64, block); + vec_st(src5, 80, block); + vec_st(src6, 96, block); + vec_st(src7,112, block); +} + +/** Do inverse transform on 8x4 part of block +*/ +static void vc1_inv_trans_8x4_altivec(DCTELEM block[64], int n) +{ + vector signed short src0, src1, src2, src3, src4, src5, src6, src7; + vector signed int s0, s1, s2, s3, s4, s5, s6, s7; + vector signed int s8, s9, sA, sB, sC, sD, sE, sF; + vector signed int t0, t1, t2, t3, t4, t5, t6, t7; + const vector signed int vec_64 = vec_sl(vec_splat_s32(4), vec_splat_u32(4)); + const vector unsigned int vec_7 = vec_splat_u32(7); + const vector unsigned int vec_5 = vec_splat_u32(5); + const vector unsigned int vec_4 = vec_splat_u32(4); + const vector signed int vec_4s = vec_splat_s32(4); + const vector unsigned int vec_3 = vec_splat_u32(3); + const vector unsigned int vec_2 = vec_splat_u32(2); + const vector unsigned int vec_1 = vec_splat_u32(1); + + src0 = vec_ld( 0, block); + src1 = vec_ld( 16, block); + src2 = vec_ld( 32, block); + src3 = vec_ld( 48, block); + src4 = vec_ld( 64, block); + src5 = vec_ld( 80, block); + src6 = vec_ld( 96, block); + src7 = vec_ld(112, block); + + TRANSPOSE8(src0, src1, src2, src3, src4, src5, src6, src7); + s0 = vec_unpackl(src0); + s1 = vec_unpackl(src1); + s2 = vec_unpackl(src2); + s3 = vec_unpackl(src3); + s4 = vec_unpackl(src4); + s5 = vec_unpackl(src5); + s6 = vec_unpackl(src6); + s7 = vec_unpackl(src7); + s8 = vec_unpackh(src0); + s9 = vec_unpackh(src1); + sA = vec_unpackh(src2); + sB = vec_unpackh(src3); + sC = vec_unpackh(src4); + sD = vec_unpackh(src5); + sE = vec_unpackh(src6); + sF = vec_unpackh(src7); + STEP8(s0, s1, s2, s3, s4, s5, s6, s7, vec_4s); + SHIFT_HOR8(s0, s1, s2, s3, s4, s5, s6, s7); + STEP8(s8, s9, sA, sB, sC, sD, sE, sF, vec_4s); + SHIFT_HOR8(s8, s9, sA, sB, sC, sD, sE, sF); + src0 = vec_pack(s8, s0); + src1 = vec_pack(s9, s1); + src2 = vec_pack(sA, s2); + src3 = vec_pack(sB, s3); + src4 = vec_pack(sC, s4); + src5 = vec_pack(sD, s5); + src6 = vec_pack(sE, s6); + src7 = vec_pack(sF, s7); + TRANSPOSE8(src0, src1, src2, src3, src4, src5, src6, src7); + + if(!n){ // upper half of block + s0 = vec_unpackh(src0); + s1 = vec_unpackh(src1); + s2 = vec_unpackh(src2); + s3 = vec_unpackh(src3); + s8 = vec_unpackl(src0); + s9 = vec_unpackl(src1); + sA = vec_unpackl(src2); + sB = vec_unpackl(src3); + STEP4(s0, s1, s2, s3, vec_64); + SHIFT_VERT4(s0, s1, s2, s3); + STEP4(s8, s9, sA, sB, vec_64); + SHIFT_VERT4(s8, s9, sA, sB); + src0 = vec_pack(s0, s8); + src1 = vec_pack(s1, s9); + src2 = vec_pack(s2, sA); + src3 = vec_pack(s3, sB); + + vec_st(src0, 0, block); + vec_st(src1, 16, block); + vec_st(src2, 32, block); + vec_st(src3, 48, block); + } else { //lower half of block + s0 = vec_unpackh(src4); + s1 = vec_unpackh(src5); + s2 = vec_unpackh(src6); + s3 = vec_unpackh(src7); + s8 = vec_unpackl(src4); + s9 = vec_unpackl(src5); + sA = vec_unpackl(src6); + sB = vec_unpackl(src7); + STEP4(s0, s1, s2, s3, vec_64); + SHIFT_VERT4(s0, s1, s2, s3); + STEP4(s8, s9, sA, sB, vec_64); + SHIFT_VERT4(s8, s9, sA, sB); + src4 = vec_pack(s0, s8); + src5 = vec_pack(s1, s9); + src6 = vec_pack(s2, sA); + src7 = vec_pack(s3, sB); + + vec_st(src4, 64, block); + vec_st(src5, 80, block); + vec_st(src6, 96, block); + vec_st(src7,112, block); + } +} + + +void vc1dsp_init_altivec(DSPContext* dsp, AVCodecContext *avctx) { + dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_altivec; + dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_altivec; +} diff --git a/src/libffmpeg/libavcodec/smacker.c b/src/libffmpeg/libavcodec/smacker.c index 2f2185848..2e1784075 100644 --- a/src/libffmpeg/libavcodec/smacker.c +++ b/src/libffmpeg/libavcodec/smacker.c @@ -320,12 +320,12 @@ static int decode_header_trees(SmackVContext *smk) { return 0; } -static always_inline void last_reset(int *recode, int *last) { +static av_always_inline void last_reset(int *recode, int *last) { recode[last[0]] = recode[last[1]] = recode[last[2]] = 0; } /* get code and update history */ -static always_inline int smk_get_code(GetBitContext *gb, int *recode, int *last) { +static av_always_inline int smk_get_code(GetBitContext *gb, int *recode, int *last) { register int *table = recode; int v, b; diff --git a/src/libffmpeg/libavcodec/snow.c b/src/libffmpeg/libavcodec/snow.c index 346d56861..5e93d40a1 100644 --- a/src/libffmpeg/libavcodec/snow.c +++ b/src/libffmpeg/libavcodec/snow.c @@ -439,6 +439,7 @@ typedef struct SnowContext{ int always_reset; int version; int spatial_decomposition_type; + int last_spatial_decomposition_type; int temporal_decomposition_type; int spatial_decomposition_count; int temporal_decomposition_count; @@ -452,15 +453,19 @@ typedef struct SnowContext{ int chroma_v_shift; int spatial_scalability; int qlog; + int last_qlog; int lambda; int lambda2; int pass1_rc; int mv_scale; + int last_mv_scale; int qbias; + int last_qbias; #define QBIAS_SHIFT 3 int b_width; int b_height; int block_max_depth; + int last_block_max_depth; Plane plane[MAX_PLANES]; BlockNode *block; #define ME_CACHE_SIZE 1024 @@ -709,7 +714,7 @@ static inline int get_symbol2(RangeCoder *c, uint8_t *state, int log2){ return v; } -static always_inline void lift(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, int dst_step, int src_step, int ref_step, int width, int mul, int add, int shift, int highpass, int inverse){ +static av_always_inline void lift(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, int dst_step, int src_step, int ref_step, int width, int mul, int add, int shift, int highpass, int inverse){ const int mirror_left= !highpass; const int mirror_right= (width&1) ^ highpass; const int w= (width>>1) - 1 + (highpass & width); @@ -732,7 +737,7 @@ static always_inline void lift(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, int dst } #ifndef lift5 -static always_inline void lift5(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, int dst_step, int src_step, int ref_step, int width, int mul, int add, int shift, int highpass, int inverse){ +static av_always_inline void lift5(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, int dst_step, int src_step, int ref_step, int width, int mul, int add, int shift, int highpass, int inverse){ const int mirror_left= !highpass; const int mirror_right= (width&1) ^ highpass; const int w= (width>>1) - 1 + (highpass & width); @@ -764,7 +769,7 @@ static always_inline void lift5(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, int ds #endif #ifndef liftS -static always_inline void liftS(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, int dst_step, int src_step, int ref_step, int width, int mul, int add, int shift, int highpass, int inverse){ +static av_always_inline void liftS(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, int dst_step, int src_step, int ref_step, int width, int mul, int add, int shift, int highpass, int inverse){ const int mirror_left= !highpass; const int mirror_right= (width&1) ^ highpass; const int w= (width>>1) - 1 + (highpass & width); @@ -1849,7 +1854,7 @@ static inline void decode_subband_slice_buffered(SnowContext *s, SubBand *b, sli return; } -static void reset_contexts(SnowContext *s){ +static void reset_contexts(SnowContext *s){ //FIXME better initial contexts int plane_index, level, orientation; for(plane_index=0; plane_index<3; plane_index++){ @@ -2208,7 +2213,7 @@ static int encode_q_branch(SnowContext *s, int level, int x, int y){ } #endif -static always_inline int same_block(BlockNode *a, BlockNode *b){ +static av_always_inline int same_block(BlockNode *a, BlockNode *b){ if((a->type&BLOCK_INTRA) && (b->type&BLOCK_INTRA)){ return !((a->color[0] - b->color[0]) | (a->color[1] - b->color[1]) | (a->color[2] - b->color[2])); }else{ @@ -2287,12 +2292,10 @@ static void decode_q_branch(SnowContext *s, int level, int x, int y){ } if(level==s->block_max_depth || get_rac(&s->c, &s->block_state[4 + s_context])){ - int type; + int type, mx, my; int l = left->color[0]; int cb= left->color[1]; int cr= left->color[2]; - int mx= mid_pred(left->mx, top->mx, tr->mx); - int my= mid_pred(left->my, top->my, tr->my); int ref = 0; int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref); int mx_context= av_log2(2*FFABS(left->mx - top->mx)) + 0*av_log2(2*FFABS(tr->mx - top->mx)); @@ -2557,7 +2560,7 @@ void ff_snow_inner_add_yblock(uint8_t *obmc, const int obmc_stride, uint8_t * * } //FIXME name clenup (b_w, block_w, b_width stuff) -static always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer *sb, DWTELEM *dst, uint8_t *dst8, const uint8_t *obmc, int src_x, int src_y, int b_w, int b_h, int w, int h, int dst_stride, int src_stride, int obmc_stride, int b_x, int b_y, int add, int offset_dst, int plane_index){ +static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer *sb, DWTELEM *dst, uint8_t *dst8, const uint8_t *obmc, int src_x, int src_y, int b_w, int b_h, int w, int h, int dst_stride, int src_stride, int obmc_stride, int b_x, int b_y, int add, int offset_dst, int plane_index){ const int b_width = s->b_width << s->block_max_depth; const int b_height= s->b_height << s->block_max_depth; const int b_stride= b_width; @@ -2716,7 +2719,7 @@ assert(src_stride > 2*MB_SIZE + 5); #endif } -static always_inline void predict_slice_buffered(SnowContext *s, slice_buffer * sb, DWTELEM * old_buffer, int plane_index, int add, int mb_y){ +static av_always_inline void predict_slice_buffered(SnowContext *s, slice_buffer * sb, DWTELEM * old_buffer, int plane_index, int add, int mb_y){ Plane *p= &s->plane[plane_index]; const int mb_w= s->b_width << s->block_max_depth; const int mb_h= s->b_height << s->block_max_depth; @@ -2783,7 +2786,7 @@ static always_inline void predict_slice_buffered(SnowContext *s, slice_buffer * STOP_TIMER("predict_slice") } -static always_inline void predict_slice(SnowContext *s, DWTELEM *buf, int plane_index, int add, int mb_y){ +static av_always_inline void predict_slice(SnowContext *s, DWTELEM *buf, int plane_index, int add, int mb_y){ Plane *p= &s->plane[plane_index]; const int mb_w= s->b_width << s->block_max_depth; const int mb_h= s->b_height << s->block_max_depth; @@ -2840,7 +2843,7 @@ static always_inline void predict_slice(SnowContext *s, DWTELEM *buf, int plane_ STOP_TIMER("predict_slice") } -static always_inline void predict_plane(SnowContext *s, DWTELEM *buf, int plane_index, int add){ +static av_always_inline void predict_plane(SnowContext *s, DWTELEM *buf, int plane_index, int add){ const int mb_h= s->b_height << s->block_max_depth; int mb_y; for(mb_y=0; mb_y<=mb_h; mb_y++) @@ -3098,7 +3101,7 @@ static int get_4block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index){ return distortion + rate*penalty_factor; } -static always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int p[3], int intra, const uint8_t *obmc_edged, int *best_rd){ +static av_always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int p[3], int intra, const uint8_t *obmc_edged, int *best_rd){ const int b_stride= s->b_width << s->block_max_depth; BlockNode *block= &s->block[mb_x + mb_y * b_stride]; BlockNode backup= *block; @@ -3137,12 +3140,12 @@ static always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int p[3 } /* special case for int[2] args we discard afterward, fixes compilation prob with gcc 2.95 */ -static always_inline int check_block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, const uint8_t *obmc_edged, int *best_rd){ +static av_always_inline int check_block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, const uint8_t *obmc_edged, int *best_rd){ int p[2] = {p0, p1}; return check_block(s, mb_x, mb_y, p, 0, obmc_edged, best_rd); } -static always_inline int check_4block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, int ref, int *best_rd){ +static av_always_inline int check_4block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, int ref, int *best_rd){ const int b_stride= s->b_width << s->block_max_depth; BlockNode *block= &s->block[mb_x + mb_y * b_stride]; BlockNode backup[4]= {block[0], block[1], block[b_stride], block[b_stride+1]}; @@ -3607,8 +3610,14 @@ static void encode_header(SnowContext *s){ memset(kstate, MID_STATE, sizeof(kstate)); put_rac(&s->c, kstate, s->keyframe); - if(s->keyframe || s->always_reset) + if(s->keyframe || s->always_reset){ reset_contexts(s); + s->last_spatial_decomposition_type= + s->last_qlog= + s->last_qbias= + s->last_mv_scale= + s->last_block_max_depth= 0; + } if(s->keyframe){ put_symbol(&s->c, s->header_state, s->version, 0); put_rac(&s->c, s->header_state, s->always_reset); @@ -3631,11 +3640,17 @@ static void encode_header(SnowContext *s){ } } } - put_symbol(&s->c, s->header_state, s->spatial_decomposition_type, 0); - put_symbol(&s->c, s->header_state, s->qlog, 1); - put_symbol(&s->c, s->header_state, s->mv_scale, 0); - put_symbol(&s->c, s->header_state, s->qbias, 1); - put_symbol(&s->c, s->header_state, s->block_max_depth, 0); + put_symbol(&s->c, s->header_state, s->spatial_decomposition_type - s->last_spatial_decomposition_type, 1); + put_symbol(&s->c, s->header_state, s->qlog - s->last_qlog , 1); + put_symbol(&s->c, s->header_state, s->mv_scale - s->last_mv_scale, 1); + put_symbol(&s->c, s->header_state, s->qbias - s->last_qbias , 1); + put_symbol(&s->c, s->header_state, s->block_max_depth - s->last_block_max_depth, 1); + + s->last_spatial_decomposition_type= s->spatial_decomposition_type; + s->last_qlog = s->qlog; + s->last_qbias = s->qbias; + s->last_mv_scale = s->mv_scale; + s->last_block_max_depth = s->block_max_depth; } static int decode_header(SnowContext *s){ @@ -3645,8 +3660,14 @@ static int decode_header(SnowContext *s){ memset(kstate, MID_STATE, sizeof(kstate)); s->keyframe= get_rac(&s->c, kstate); - if(s->keyframe || s->always_reset) + if(s->keyframe || s->always_reset){ reset_contexts(s); + s->spatial_decomposition_type= + s->qlog= + s->qbias= + s->mv_scale= + s->block_max_depth= 0; + } if(s->keyframe){ s->version= get_symbol(&s->c, s->header_state, 0); if(s->version>0){ @@ -3677,16 +3698,16 @@ static int decode_header(SnowContext *s){ } } - s->spatial_decomposition_type= get_symbol(&s->c, s->header_state, 0); + s->spatial_decomposition_type+= get_symbol(&s->c, s->header_state, 1); if(s->spatial_decomposition_type > 2){ av_log(s->avctx, AV_LOG_ERROR, "spatial_decomposition_type %d not supported", s->spatial_decomposition_type); return -1; } - s->qlog= get_symbol(&s->c, s->header_state, 1); - s->mv_scale= get_symbol(&s->c, s->header_state, 0); - s->qbias= get_symbol(&s->c, s->header_state, 1); - s->block_max_depth= get_symbol(&s->c, s->header_state, 0); + s->qlog += get_symbol(&s->c, s->header_state, 1); + s->mv_scale += get_symbol(&s->c, s->header_state, 1); + s->qbias += get_symbol(&s->c, s->header_state, 1); + s->block_max_depth+= get_symbol(&s->c, s->header_state, 1); if(s->block_max_depth > 1 || s->block_max_depth < 0){ av_log(s->avctx, AV_LOG_ERROR, "block_max_depth= %d is too large", s->block_max_depth); s->block_max_depth= 0; @@ -4177,7 +4198,6 @@ redo_frame: pict->pict_type= FF_I_TYPE; s->keyframe=1; s->current_picture.key_frame=1; - reset_contexts(s); goto redo_frame; } diff --git a/src/libffmpeg/libavcodec/snow.h b/src/libffmpeg/libavcodec/snow.h index f7cee131a..6794d2c5a 100644 --- a/src/libffmpeg/libavcodec/snow.h +++ b/src/libffmpeg/libavcodec/snow.h @@ -137,7 +137,7 @@ static int w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int /* C bits used by mmx/sse2/altivec */ -static always_inline void snow_interleave_line_header(int * i, int width, DWTELEM * low, DWTELEM * high){ +static av_always_inline void snow_interleave_line_header(int * i, int width, DWTELEM * low, DWTELEM * high){ (*i) = (width) - 2; if (width & 1){ @@ -146,14 +146,14 @@ static always_inline void snow_interleave_line_header(int * i, int width, DWTELE } } -static always_inline void snow_interleave_line_footer(int * i, DWTELEM * low, DWTELEM * high){ +static av_always_inline void snow_interleave_line_footer(int * i, DWTELEM * low, DWTELEM * high){ for (; (*i)>=0; (*i)-=2){ low[(*i)+1] = high[(*i)>>1]; low[*i] = low[(*i)>>1]; } } -static always_inline void snow_horizontal_compose_lift_lead_out(int i, DWTELEM * dst, DWTELEM * src, DWTELEM * ref, int width, int w, int lift_high, int mul, int add, int shift){ +static av_always_inline void snow_horizontal_compose_lift_lead_out(int i, DWTELEM * dst, DWTELEM * src, DWTELEM * ref, int width, int w, int lift_high, int mul, int add, int shift){ for(; i> shift); } @@ -163,7 +163,7 @@ static always_inline void snow_horizontal_compose_lift_lead_out(int i, DWTELEM * } } -static always_inline void snow_horizontal_compose_liftS_lead_out(int i, DWTELEM * dst, DWTELEM * src, DWTELEM * ref, int width, int w){ +static av_always_inline void snow_horizontal_compose_liftS_lead_out(int i, DWTELEM * dst, DWTELEM * src, DWTELEM * ref, int width, int w){ for(; i> W_BS); } diff --git a/src/libffmpeg/libavcodec/utils.c b/src/libffmpeg/libavcodec/utils.c index c3661dda7..36dcc7746 100644 --- a/src/libffmpeg/libavcodec/utils.c +++ b/src/libffmpeg/libavcodec/utils.c @@ -421,7 +421,7 @@ static const char* context_to_name(void* ptr) { static const AVOption options[]={ {"b", "set video bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, AV_CODEC_DEFAULT_BITRATE, INT_MIN, INT_MAX, V|A|E}, -{"bt", "set video bitrate tolerance (in bits/s)", OFFSET(bit_rate_tolerance), FF_OPT_TYPE_INT, AV_CODEC_DEFAULT_BITRATE*20, INT_MIN, INT_MAX, V|E}, +{"bt", "set video bitrate tolerance (in bits/s)", OFFSET(bit_rate_tolerance), FF_OPT_TYPE_INT, AV_CODEC_DEFAULT_BITRATE*20, 1, INT_MAX, V|E}, {"flags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, V|A|E|D, "flags"}, {"mv4", "use four motion vector by macroblock (mpeg4)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_4MV, INT_MIN, INT_MAX, V|E, "flags"}, {"obmc", "use overlapped block motion compensation (h263+)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_OBMC, INT_MIN, INT_MAX, V|E, "flags"}, @@ -464,7 +464,7 @@ static const AVOption options[]={ {"extradata_size", NULL, OFFSET(extradata_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"time_base", NULL, OFFSET(time_base), FF_OPT_TYPE_RATIONAL, DEFAULT, INT_MIN, INT_MAX}, {"g", "set the group of picture size", OFFSET(gop_size), FF_OPT_TYPE_INT, 12, INT_MIN, INT_MAX, V|E}, -{"rate_emu", NULL, OFFSET(rate_emu), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, +{"rate_emu", "frame rate emulation", OFFSET(rate_emu), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"ac", "set number of audio channels", OFFSET(channels), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"cutoff", "set cutoff bandwidth", OFFSET(cutoff), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|E}, @@ -509,15 +509,15 @@ static const AVOption options[]={ {"edge", "edge padding bug (autodetected per fourcc/version)", 0, FF_OPT_TYPE_CONST, FF_BUG_EDGE, INT_MIN, INT_MAX, V|D, "bug"}, {"hpel_chroma", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_HPEL_CHROMA, INT_MIN, INT_MAX, V|D, "bug"}, {"dc_clip", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_DC_CLIP, INT_MIN, INT_MAX, V|D, "bug"}, -{"ms", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_MS, INT_MIN, INT_MAX, V|D, "bug"}, +{"ms", "workaround various bugs in microsofts broken decoders", 0, FF_OPT_TYPE_CONST, FF_BUG_MS, INT_MIN, INT_MAX, V|D, "bug"}, {"lelim", "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)", OFFSET(luma_elim_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"celim", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)", OFFSET(chroma_elim_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"strict", "how strictly to follow the standards", OFFSET(strict_std_compliance), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "strict"}, -{"very", NULL, 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_VERY_STRICT, INT_MIN, INT_MAX, V|E, "strict"}, -{"strict", NULL, 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_STRICT, INT_MIN, INT_MAX, V|E, "strict"}, +{"very", "strictly conform to a older more strict version of the spec or reference software", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_VERY_STRICT, INT_MIN, INT_MAX, V|E, "strict"}, +{"strict", "strictly conform to all the things in the spec no matter what consequences", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_STRICT, INT_MIN, INT_MAX, V|E, "strict"}, {"normal", NULL, 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_NORMAL, INT_MIN, INT_MAX, V|E, "strict"}, -{"inofficial", NULL, 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_INOFFICIAL, INT_MIN, INT_MAX, V|E, "strict"}, -{"experimental", NULL, 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_EXPERIMENTAL, INT_MIN, INT_MAX, V|E, "strict"}, +{"inofficial", "allow inofficial extensions", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_INOFFICIAL, INT_MIN, INT_MAX, V|E, "strict"}, +{"experimental", "allow non standarized experimental things", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_EXPERIMENTAL, INT_MIN, INT_MAX, V|E, "strict"}, {"b_qoffset", "qp offset between p and b frames", OFFSET(b_quant_offset), FF_OPT_TYPE_FLOAT, 1.25, FLT_MIN, FLT_MAX, V|E}, {"er", "set error resilience strategy", OFFSET(error_resilience), FF_OPT_TYPE_INT, FF_ER_CAREFUL, INT_MIN, INT_MAX, V|D, "er"}, {"careful", NULL, 0, FF_OPT_TYPE_CONST, FF_ER_CAREFUL, INT_MIN, INT_MAX, V|D, "er"}, @@ -549,14 +549,14 @@ static const AVOption options[]={ {"mmx", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_MMX, INT_MIN, INT_MAX, V|E, "dct"}, {"mlib", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_MLIB, INT_MIN, INT_MAX, V|E, "dct"}, {"altivec", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_ALTIVEC, INT_MIN, INT_MAX, V|E, "dct"}, -{"faan", "floating point AAN", 0, FF_OPT_TYPE_CONST, FF_DCT_FAAN, INT_MIN, INT_MAX, V|E, "dct"}, +{"faan", "floating point AAN DCT", 0, FF_OPT_TYPE_CONST, FF_DCT_FAAN, INT_MIN, INT_MAX, V|E, "dct"}, {"lumi_mask", "compresses bright areas stronger than medium ones", OFFSET(lumi_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E}, {"tcplx_mask", "temporal complexity masking", OFFSET(temporal_cplx_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E}, {"scplx_mask", "spatial complexity masking", OFFSET(spatial_cplx_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E}, {"p_mask", "inter masking", OFFSET(p_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E}, {"dark_mask", "compresses dark areas stronger than medium ones", OFFSET(dark_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E}, {"unused", NULL, OFFSET(unused), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -{"idct", "use interlaced DCT", OFFSET(idct_algo), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|E|D, "idct"}, +{"idct", "select IDCT implementation", OFFSET(idct_algo), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|E|D, "idct"}, {"auto", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_AUTO, INT_MIN, INT_MAX, V|E|D, "idct"}, {"int", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_INT, INT_MIN, INT_MAX, V|E|D, "idct"}, {"simple", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SIMPLE, INT_MIN, INT_MAX, V|E|D, "idct"}, @@ -582,7 +582,7 @@ static const AVOption options[]={ {"left", NULL, 0, FF_OPT_TYPE_CONST, FF_PRED_LEFT, INT_MIN, INT_MAX, V|E, "pred"}, {"plane", NULL, 0, FF_OPT_TYPE_CONST, FF_PRED_PLANE, INT_MIN, INT_MAX, V|E, "pred"}, {"median", NULL, 0, FF_OPT_TYPE_CONST, FF_PRED_MEDIAN, INT_MIN, INT_MAX, V|E, "pred"}, -{"aspect", NULL, OFFSET(sample_aspect_ratio), FF_OPT_TYPE_RATIONAL, DEFAULT, 0, 10, V|E}, +{"aspect", "sample aspect ratio", OFFSET(sample_aspect_ratio), FF_OPT_TYPE_RATIONAL, DEFAULT, 0, 10, V|E}, {"debug", "print specific debug info", OFFSET(debug), FF_OPT_TYPE_FLAGS, DEFAULT, 0, INT_MAX, V|A|S|E|D, "debug"}, {"pict", "picture info", 0, FF_OPT_TYPE_CONST, FF_DEBUG_PICT_INFO, INT_MIN, INT_MAX, V|D, "debug"}, {"rc", "rate control", 0, FF_OPT_TYPE_CONST, FF_DEBUG_RC, INT_MIN, INT_MAX, V|E, "debug"}, @@ -603,8 +603,8 @@ static const AVOption options[]={ {"pf", "forward predicted MVs of P-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_P_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"}, {"bf", "forward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"}, {"bb", "backward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_BACK, INT_MIN, INT_MAX, V|D, "debug_mv"}, -{"mb_qmin", "obsolete, use vqmin", OFFSET(mb_qmin), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"mb_qmax", "obsolete, use vqmax", OFFSET(mb_qmax), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"mb_qmin", "obsolete, use qmin", OFFSET(mb_qmin), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"mb_qmax", "obsolete, use qmax", OFFSET(mb_qmax), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"cmp", "full pel me compare function", OFFSET(me_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"}, {"subcmp", "sub pel me compare function", OFFSET(me_sub_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"}, {"mbcmp", "macroblock compare function", OFFSET(mb_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"}, @@ -654,11 +654,11 @@ static const AVOption options[]={ {"lmin", "min lagrange factor (VBR)", OFFSET(lmin), FF_OPT_TYPE_INT, 2*FF_QP2LAMBDA, 0, INT_MAX, V|E}, {"lmax", "max lagrange factor (VBR)", OFFSET(lmax), FF_OPT_TYPE_INT, 31*FF_QP2LAMBDA, 0, INT_MAX, V|E}, {"nr", "noise reduction", OFFSET(noise_reduction), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"rc_init_occupancy", NULL, OFFSET(rc_initial_buffer_occupancy), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"rc_init_occupancy", "number of bits which should be loaded into the rc buffer before decoding starts", OFFSET(rc_initial_buffer_occupancy), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"inter_threshold", NULL, OFFSET(inter_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"flags2", NULL, OFFSET(flags2), FF_OPT_TYPE_FLAGS, CODEC_FLAG2_FASTPSKIP, INT_MIN, INT_MAX, V|A|E|D, "flags2"}, {"error", NULL, OFFSET(error_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"antialias", NULL, OFFSET(antialias_algo), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D, "aa"}, +{"antialias", "MP3 antialias algorithm", OFFSET(antialias_algo), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D, "aa"}, {"auto", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_AUTO, INT_MIN, INT_MAX, V|D, "aa"}, {"fastint", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_FASTINT, INT_MIN, INT_MAX, V|D, "aa"}, {"int", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_INT, INT_MIN, INT_MAX, V|D, "aa"}, @@ -669,8 +669,8 @@ static const AVOption options[]={ {"mb_threshold", "macroblock threshold", OFFSET(mb_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"dc", "intra_dc_precision", OFFSET(intra_dc_precision), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E}, {"nssew", "nsse weight", OFFSET(nsse_weight), FF_OPT_TYPE_INT, 8, INT_MIN, INT_MAX, V|E}, -{"skip_top", NULL, OFFSET(skip_top), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D}, -{"skip_bottom", NULL, OFFSET(skip_bottom), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D}, +{"skip_top", "number of macroblock rows at the top which are skipped", OFFSET(skip_top), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D}, +{"skip_bottom", "number of macroblock rows at the bottom which are skipped", OFFSET(skip_bottom), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D}, {"profile", NULL, OFFSET(profile), FF_OPT_TYPE_INT, FF_PROFILE_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "profile"}, {"unknown", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "profile"}, {"level", NULL, OFFSET(level), FF_OPT_TYPE_INT, FF_LEVEL_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "level"}, @@ -687,42 +687,43 @@ static const AVOption options[]={ {"bidir_refine", "refine the two motion vectors used in bidirectional macroblocks", OFFSET(bidir_refine), FF_OPT_TYPE_INT, DEFAULT, 0, 4, V|E}, {"brd_scale", "downscales frames for dynamic B-frame decision", OFFSET(brd_scale), FF_OPT_TYPE_INT, DEFAULT, 0, 10, V|E}, {"crf", "enables constant quality mode, and selects the quality (x264)", OFFSET(crf), FF_OPT_TYPE_FLOAT, DEFAULT, 0, 51, V|E}, -{"cqp", NULL, OFFSET(cqp), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, V|E}, +{"cqp", "constant quantization parameter rate control method", OFFSET(cqp), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, V|E}, {"keyint_min", "minimum interval between IDR-frames (x264)", OFFSET(keyint_min), FF_OPT_TYPE_INT, 25, INT_MIN, INT_MAX, V|E}, {"refs", "reference frames to consider for motion compensation (Snow)", OFFSET(refs), FF_OPT_TYPE_INT, 1, INT_MIN, INT_MAX, V|E}, -{"chromaoffset", NULL, OFFSET(chromaoffset), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"bframebias", NULL, OFFSET(bframebias), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"chromaoffset", "chroma qp offset from luma", OFFSET(chromaoffset), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, +{"bframebias", "influences how often B-frames are used", OFFSET(bframebias), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"trellis", "rate-distortion optimal quantization", OFFSET(trellis), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|A|E}, -{"directpred", NULL, OFFSET(directpred), FF_OPT_TYPE_INT, 2, INT_MIN, INT_MAX, V|E}, +{"directpred", "direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal)", OFFSET(directpred), FF_OPT_TYPE_INT, 2, INT_MIN, INT_MAX, V|E}, {"bpyramid", "allows B-frames to be used as references for predicting", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_BPYRAMID, INT_MIN, INT_MAX, V|E, "flags2"}, -{"wpred", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_WPRED, INT_MIN, INT_MAX, V|E, "flags2"}, -{"mixed_refs", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_MIXED_REFS, INT_MIN, INT_MAX, V|E, "flags2"}, -{"8x8dct", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_8X8DCT, INT_MIN, INT_MAX, V|E, "flags2"}, -{"fastpskip", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_FASTPSKIP, INT_MIN, INT_MAX, V|E, "flags2"}, -{"aud", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_AUD, INT_MIN, INT_MAX, V|E, "flags2"}, -{"brdo", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_BRDO, INT_MIN, INT_MAX, V|E, "flags2"}, -{"complexityblur", NULL, OFFSET(complexityblur), FF_OPT_TYPE_FLOAT, 20.0, FLT_MIN, FLT_MAX, V|E}, -{"deblockalpha", NULL, OFFSET(deblockalpha), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"deblockbeta", NULL, OFFSET(deblockbeta), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"partitions", NULL, OFFSET(partitions), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, V|E, "partitions"}, +{"wpred", "weighted biprediction for b-frames (H.264)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_WPRED, INT_MIN, INT_MAX, V|E, "flags2"}, +{"mixed_refs", "one reference per partition, as opposed to one reference per macroblock", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_MIXED_REFS, INT_MIN, INT_MAX, V|E, "flags2"}, +{"8x8dct", "high profile 8x8 transform (H.264)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_8X8DCT, INT_MIN, INT_MAX, V|E, "flags2"}, +{"fastpskip", "fast pskip (H.264)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_FASTPSKIP, INT_MIN, INT_MAX, V|E, "flags2"}, +{"aud", "access unit delimiters (H.264)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_AUD, INT_MIN, INT_MAX, V|E, "flags2"}, +{"brdo", "b-frame rate-distortion optimization", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_BRDO, INT_MIN, INT_MAX, V|E, "flags2"}, +{"skiprd", "RD optimal MB level residual skiping", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_SKIP_RD, INT_MIN, INT_MAX, V|E, "flags2"}, +{"complexityblur", "reduce fluctuations in qp (before curve compression)", OFFSET(complexityblur), FF_OPT_TYPE_FLOAT, 20.0, FLT_MIN, FLT_MAX, V|E}, +{"deblockalpha", "in-loop deblocking filter alphac0 parameter", OFFSET(deblockalpha), FF_OPT_TYPE_INT, DEFAULT, -6, 6, V|E}, +{"deblockbeta", "in-loop deblocking filter beta parameter", OFFSET(deblockbeta), FF_OPT_TYPE_INT, DEFAULT, -6, 6, V|E}, +{"partitions", "macroblock subpartition sizes to consider", OFFSET(partitions), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, V|E, "partitions"}, {"parti4x4", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_I4X4, INT_MIN, INT_MAX, V|E, "partitions"}, {"parti8x8", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_I8X8, INT_MIN, INT_MAX, V|E, "partitions"}, {"partp4x4", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_P4X4, INT_MIN, INT_MAX, V|E, "partitions"}, {"partp8x8", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_P8X8, INT_MIN, INT_MAX, V|E, "partitions"}, {"partb8x8", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_B8X8, INT_MIN, INT_MAX, V|E, "partitions"}, -{"sc_factor", NULL, OFFSET(scenechange_factor), FF_OPT_TYPE_INT, 6, 0, INT_MAX, V|E}, +{"sc_factor", "multiplied by qscale for each frame and added to scene_change_score", OFFSET(scenechange_factor), FF_OPT_TYPE_INT, 6, 0, INT_MAX, V|E}, {"mv0_threshold", NULL, OFFSET(mv0_threshold), FF_OPT_TYPE_INT, 256, 0, INT_MAX, V|E}, {"ivlc", "intra vlc table", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_INTRA_VLC, INT_MIN, INT_MAX, V|E, "flags2"}, -{"b_sensitivity", NULL, OFFSET(b_sensitivity), FF_OPT_TYPE_INT, 40, 1, INT_MAX, V|E}, +{"b_sensitivity", "adjusts sensitivity of b_frame_strategy 1", OFFSET(b_sensitivity), FF_OPT_TYPE_INT, 40, 1, INT_MAX, V|E}, {"compression_level", NULL, OFFSET(compression_level), FF_OPT_TYPE_INT, FF_COMPRESSION_DEFAULT, INT_MIN, INT_MAX, V|A|E}, -{"use_lpc", NULL, OFFSET(use_lpc), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, -{"lpc_coeff_precision", NULL, OFFSET(lpc_coeff_precision), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, A|E}, +{"use_lpc", "sets whether to use LPC mode (FLAC)", OFFSET(use_lpc), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, +{"lpc_coeff_precision", "LPC coefficient precision (FLAC)", OFFSET(lpc_coeff_precision), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, A|E}, {"min_prediction_order", NULL, OFFSET(min_prediction_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, {"max_prediction_order", NULL, OFFSET(max_prediction_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, -{"prediction_order_method", NULL, OFFSET(prediction_order_method), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, +{"prediction_order_method", "search method for selecting prediction order", OFFSET(prediction_order_method), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, {"min_partition_order", NULL, OFFSET(min_partition_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, {"max_partition_order", NULL, OFFSET(max_partition_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, -{"timecode_frame_start", NULL, OFFSET(timecode_frame_start), FF_OPT_TYPE_INT, 0, 0, INT_MAX, V|E}, +{"timecode_frame_start", "GOP timecode frame start number, in non drop frame format", OFFSET(timecode_frame_start), FF_OPT_TYPE_INT, 0, 0, INT_MAX, V|E}, {"drop_frame_timecode", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_DROP_FRAME_TIMECODE, INT_MIN, INT_MAX, V|E, "flags2"}, {NULL}, }; diff --git a/src/libffmpeg/libavcodec/vc1.c b/src/libffmpeg/libavcodec/vc1.c index 7b385ca47..231f3ca26 100644 --- a/src/libffmpeg/libavcodec/vc1.c +++ b/src/libffmpeg/libavcodec/vc1.c @@ -2140,7 +2140,7 @@ static void vc1_interp_mc(VC1Context *v) dsp->avg_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); } -static always_inline int scale_mv(int value, int bfrac, int inv, int qs) +static av_always_inline int scale_mv(int value, int bfrac, int inv, int qs) { int n = bfrac; @@ -3072,8 +3072,8 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c ac_val -= 16 * s->block_wrap[n]; q1 = s->current_picture.qscale_table[mb_pos]; - if(dc_pred_dir && c_avail) q2 = s->current_picture.qscale_table[mb_pos - 1]; - if(!dc_pred_dir && a_avail) q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride]; + if(dc_pred_dir && c_avail && mb_pos) q2 = s->current_picture.qscale_table[mb_pos - 1]; + if(!dc_pred_dir && a_avail && mb_pos >= s->mb_stride) q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride]; if(n && n<4) q2 = q1; if(coded) { diff --git a/src/libffmpeg/libavcodec/vc1dsp.c b/src/libffmpeg/libavcodec/vc1dsp.c index 9139ffb28..f19f266d1 100644 --- a/src/libffmpeg/libavcodec/vc1dsp.c +++ b/src/libffmpeg/libavcodec/vc1dsp.c @@ -326,7 +326,7 @@ static void vc1_inv_trans_4x4_c(DCTELEM block[64], int n) /** Filter used to interpolate fractional pel values */ -static always_inline int vc1_mspel_filter(const uint8_t *src, int stride, int mode, int r) +static av_always_inline int vc1_mspel_filter(const uint8_t *src, int stride, int mode, int r) { switch(mode){ case 0: //no shift diff --git a/src/libffmpeg/libavcodec/vp3dsp.c b/src/libffmpeg/libavcodec/vp3dsp.c index a48515a5e..bb9fed091 100644 --- a/src/libffmpeg/libavcodec/vp3dsp.c +++ b/src/libffmpeg/libavcodec/vp3dsp.c @@ -39,7 +39,7 @@ #define M(a,b) (((a) * (b))>>16) -static always_inline void idct(uint8_t *dst, int stride, int16_t *input, int type) +static av_always_inline void idct(uint8_t *dst, int stride, int16_t *input, int type) { int16_t *ip = input; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; diff --git a/src/libffmpeg/libavcodec/vp5.c b/src/libffmpeg/libavcodec/vp5.c new file mode 100644 index 000000000..ac953c7aa --- /dev/null +++ b/src/libffmpeg/libavcodec/vp5.c @@ -0,0 +1,290 @@ +/** + * @file vp5.c + * VP5 compatible video decoder + * + * Copyright (C) 2006 Aurelien Jacobs + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include + +#include "avcodec.h" +#include "dsputil.h" +#include "bitstream.h" +#include "mpegvideo.h" + +#include "vp56.h" +#include "vp56data.h" +#include "vp5data.h" + + +static int vp5_parse_header(vp56_context_t *s, uint8_t *buf, int buf_size, + int *golden_frame) +{ + vp56_range_coder_t *c = &s->c; + int rows, cols; + + vp56_init_range_decoder(&s->c, buf, buf_size); + s->frames[VP56_FRAME_CURRENT].key_frame = !vp56_rac_get(c); + vp56_rac_get(c); + vp56_init_dequant(s, vp56_rac_gets(c, 6)); + if (s->frames[VP56_FRAME_CURRENT].key_frame) + { + vp56_rac_gets(c, 8); + if(vp56_rac_gets(c, 5) > 5) + return 0; + vp56_rac_gets(c, 2); + if (vp56_rac_get(c)) { + av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n"); + return 0; + } + rows = vp56_rac_gets(c, 8); /* number of stored macroblock rows */ + cols = vp56_rac_gets(c, 8); /* number of stored macroblock cols */ + vp56_rac_gets(c, 8); /* number of displayed macroblock rows */ + vp56_rac_gets(c, 8); /* number of displayed macroblock cols */ + vp56_rac_gets(c, 2); + if (16*cols != s->avctx->coded_width || + 16*rows != s->avctx->coded_height) { + avcodec_set_dimensions(s->avctx, 16*cols, 16*rows); + return 2; + } + } + return 1; +} + +/* Gives very similar result than the vp6 version except in a few cases */ +static int vp5_adjust(int v, int t) +{ + int s2, s1 = v >> 31; + v ^= s1; + v -= s1; + v *= v < 2*t; + v -= t; + s2 = v >> 31; + v ^= s2; + v -= s2; + v = t - v; + v += s1; + v ^= s1; + return v; +} + +static void vp5_parse_vector_adjustment(vp56_context_t *s, vp56_mv_t *vect) +{ + vp56_range_coder_t *c = &s->c; + int comp, di; + + for (comp=0; comp<2; comp++) { + int delta = 0; + if (vp56_rac_get_prob(c, s->vector_model_dct[comp])) { + int sign = vp56_rac_get_prob(c, s->vector_model_sig[comp]); + di = vp56_rac_get_prob(c, s->vector_model_pdi[comp][0]); + di |= vp56_rac_get_prob(c, s->vector_model_pdi[comp][1]) << 1; + delta = vp56_rac_get_tree(c, vp56_pva_tree, + s->vector_model_pdv[comp]); + delta = di | (delta << 2); + delta = (delta ^ -sign) + sign; + } + if (!comp) + vect->x = delta; + else + vect->y = delta; + } +} + +static void vp5_parse_vector_models(vp56_context_t *s) +{ + vp56_range_coder_t *c = &s->c; + int comp, node; + + for (comp=0; comp<2; comp++) { + if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][0])) + s->vector_model_dct[comp] = vp56_rac_gets_nn(c, 7); + if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][1])) + s->vector_model_sig[comp] = vp56_rac_gets_nn(c, 7); + if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][2])) + s->vector_model_pdi[comp][0] = vp56_rac_gets_nn(c, 7); + if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][3])) + s->vector_model_pdi[comp][1] = vp56_rac_gets_nn(c, 7); + } + + for (comp=0; comp<2; comp++) + for (node=0; node<7; node++) + if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][4 + node])) + s->vector_model_pdv[comp][node] = vp56_rac_gets_nn(c, 7); +} + +static void vp5_parse_coeff_models(vp56_context_t *s) +{ + vp56_range_coder_t *c = &s->c; + uint8_t def_prob[11]; + int node, cg, ctx; + int ct; /* code type */ + int pt; /* plane type (0 for Y, 1 for U or V) */ + + memset(def_prob, 0x80, sizeof(def_prob)); + + for (pt=0; pt<2; pt++) + for (node=0; node<11; node++) + if (vp56_rac_get_prob(c, vp5_dccv_pct[pt][node])) { + def_prob[node] = vp56_rac_gets_nn(c, 7); + s->coeff_model_dccv[pt][node] = def_prob[node]; + } else if (s->frames[VP56_FRAME_CURRENT].key_frame) { + s->coeff_model_dccv[pt][node] = def_prob[node]; + } + + for (ct=0; ct<3; ct++) + for (pt=0; pt<2; pt++) + for (cg=0; cg<6; cg++) + for (node=0; node<11; node++) + if (vp56_rac_get_prob(c, vp5_ract_pct[ct][pt][cg][node])) { + def_prob[node] = vp56_rac_gets_nn(c, 7); + s->coeff_model_ract[pt][ct][cg][node] = def_prob[node]; + } else if (s->frames[VP56_FRAME_CURRENT].key_frame) { + s->coeff_model_ract[pt][ct][cg][node] = def_prob[node]; + } + + /* coeff_model_dcct is a linear combination of coeff_model_dccv */ + for (pt=0; pt<2; pt++) + for (ctx=0; ctx<36; ctx++) + for (node=0; node<5; node++) + s->coeff_model_dcct[pt][ctx][node] = clip(((s->coeff_model_dccv[pt][node] * vp5_dccv_lc[node][ctx][0] + 128) >> 8) + vp5_dccv_lc[node][ctx][1], 1, 254); + + /* coeff_model_acct is a linear combination of coeff_model_ract */ + for (ct=0; ct<3; ct++) + for (pt=0; pt<2; pt++) + for (cg=0; cg<3; cg++) + for (ctx=0; ctx<6; ctx++) + for (node=0; node<5; node++) + s->coeff_model_acct[pt][ct][cg][ctx][node] = clip(((s->coeff_model_ract[pt][ct][cg][node] * vp5_ract_lc[ct][cg][node][ctx][0] + 128) >> 8) + vp5_ract_lc[ct][cg][node][ctx][1], 1, 254); +} + +static void vp5_parse_coeff(vp56_context_t *s) +{ + vp56_range_coder_t *c = &s->c; + uint8_t *permute = s->scantable.permutated; + uint8_t *model, *model2; + int coeff, sign, coeff_idx; + int b, i, cg, idx, ctx, ctx_last; + int pt = 0; /* plane type (0 for Y, 1 for U or V) */ + + for (b=0; b<6; b++) { + int ct = 1; /* code type */ + + if (b > 3) pt = 1; + + ctx = 6*s->coeff_ctx[vp56_b6to4[b]][0] + + s->above_blocks[s->above_block_idx[b]].not_null_dc; + model = s->coeff_model_dccv[pt]; + model2 = s->coeff_model_dcct[pt][ctx]; + + for (coeff_idx=0; coeff_idx<64; ) { + if (vp56_rac_get_prob(c, model2[0])) { + if (vp56_rac_get_prob(c, model2[2])) { + if (vp56_rac_get_prob(c, model2[3])) { + s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 4; + idx = vp56_rac_get_tree(c, vp56_pc_tree, model); + sign = vp56_rac_get(c); + coeff = vp56_coeff_bias[idx]; + for (i=vp56_coeff_bit_length[idx]; i>=0; i--) + coeff += vp56_rac_get_prob(c, vp56_coeff_parse_table[idx][i]) << i; + } else { + if (vp56_rac_get_prob(c, model2[4])) { + coeff = 3 + vp56_rac_get_prob(c, model[5]); + s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 3; + } else { + coeff = 2; + s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 2; + } + sign = vp56_rac_get(c); + } + ct = 2; + } else { + ct = 1; + s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 1; + sign = vp56_rac_get(c); + coeff = 1; + } + coeff = (coeff ^ -sign) + sign; + if (coeff_idx) + coeff *= s->dequant_ac; + s->block_coeff[b][permute[coeff_idx]] = coeff; + } else { + if (ct && !vp56_rac_get_prob(c, model2[1])) + break; + ct = 0; + s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 0; + } + + cg = vp5_coeff_groups[++coeff_idx]; + ctx = s->coeff_ctx[vp56_b6to4[b]][coeff_idx]; + model = s->coeff_model_ract[pt][ct][cg]; + model2 = cg > 2 ? model : s->coeff_model_acct[pt][ct][cg][ctx]; + } + + ctx_last = FFMIN(s->coeff_ctx_last[vp56_b6to4[b]], 24); + s->coeff_ctx_last[vp56_b6to4[b]] = coeff_idx; + if (coeff_idx < ctx_last) + for (i=coeff_idx; i<=ctx_last; i++) + s->coeff_ctx[vp56_b6to4[b]][i] = 5; + s->above_blocks[s->above_block_idx[b]].not_null_dc = s->coeff_ctx[vp56_b6to4[b]][0]; + } +} + +static void vp5_default_models_init(vp56_context_t *s) +{ + int i; + + for (i=0; i<2; i++) { + s->vector_model_sig[i] = 0x80; + s->vector_model_dct[i] = 0x80; + s->vector_model_pdi[i][0] = 0x55; + s->vector_model_pdi[i][1] = 0x80; + } + memcpy(s->mb_types_stats, vp56_def_mb_types_stats, sizeof(s->mb_types_stats)); + memset(s->vector_model_pdv, 0x80, sizeof(s->vector_model_pdv)); +} + +static int vp5_decode_init(AVCodecContext *avctx) +{ + vp56_context_t *s = avctx->priv_data; + + vp56_init(s, avctx, 1); + s->vp56_coord_div = vp5_coord_div; + s->parse_vector_adjustment = vp5_parse_vector_adjustment; + s->adjust = vp5_adjust; + s->parse_coeff = vp5_parse_coeff; + s->default_models_init = vp5_default_models_init; + s->parse_vector_models = vp5_parse_vector_models; + s->parse_coeff_models = vp5_parse_coeff_models; + s->parse_header = vp5_parse_header; + + return 0; +} + +AVCodec vp5_decoder = { + "vp5", + CODEC_TYPE_VIDEO, + CODEC_ID_VP5, + sizeof(vp56_context_t), + vp5_decode_init, + NULL, + vp56_free, + vp56_decode_frame, +}; diff --git a/src/libffmpeg/libavcodec/vp56.c b/src/libffmpeg/libavcodec/vp56.c new file mode 100644 index 000000000..eb78d02e4 --- /dev/null +++ b/src/libffmpeg/libavcodec/vp56.c @@ -0,0 +1,665 @@ +/** + * @file vp56.c + * VP5 and VP6 compatible video decoder (common features) + * + * Copyright (C) 2006 Aurelien Jacobs + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avcodec.h" + +#include "vp56.h" +#include "vp56data.h" + + +void vp56_init_dequant(vp56_context_t *s, int quantizer) +{ + s->quantizer = quantizer; + s->dequant_dc = vp56_dc_dequant[quantizer] << 2; + s->dequant_ac = vp56_ac_dequant[quantizer] << 2; +} + +static int vp56_get_vectors_predictors(vp56_context_t *s, int row, int col, + vp56_frame_t ref_frame) +{ + int nb_pred = 0; + vp56_mv_t vect[2] = {{0,0}, {0,0}}; + int pos, offset; + vp56_mv_t mvp; + + for (pos=0; pos<12; pos++) { + mvp.x = col + vp56_candidate_predictor_pos[pos][0]; + mvp.y = row + vp56_candidate_predictor_pos[pos][1]; + if (mvp.x < 0 || mvp.x >= s->mb_width || + mvp.y < 0 || mvp.y >= s->mb_height) + continue; + offset = mvp.x + s->mb_width*mvp.y; + + if (vp56_reference_frame[s->macroblocks[offset].type] != ref_frame) + continue; + if ((s->macroblocks[offset].mv.x == vect[0].x && + s->macroblocks[offset].mv.y == vect[0].y) || + (s->macroblocks[offset].mv.x == 0 && + s->macroblocks[offset].mv.y == 0)) + continue; + + vect[nb_pred++] = s->macroblocks[offset].mv; + if (nb_pred > 1) { + nb_pred = -1; + break; + } + s->vector_candidate_pos = pos; + } + + s->vector_candidate[0] = vect[0]; + s->vector_candidate[1] = vect[1]; + + return nb_pred+1; +} + +static void vp56_parse_mb_type_models(vp56_context_t *s) +{ + vp56_range_coder_t *c = &s->c; + int i, ctx, type; + + for (ctx=0; ctx<3; ctx++) { + if (vp56_rac_get_prob(c, 174)) { + int idx = vp56_rac_gets(c, 4); + memcpy(s->mb_types_stats[ctx],vp56_pre_def_mb_type_stats[idx][ctx], + sizeof(s->mb_types_stats[ctx])); + } + if (vp56_rac_get_prob(c, 254)) { + for (type=0; type<10; type++) { + for(i=0; i<2; i++) { + if (vp56_rac_get_prob(c, 205)) { + int delta, sign = vp56_rac_get(c); + + delta = vp56_rac_get_tree(c, vp56_pmbtm_tree, + vp56_mb_type_model_model); + if (!delta) + delta = 4 * vp56_rac_gets(c, 7); + s->mb_types_stats[ctx][type][i] += (delta ^ -sign) + sign; + } + } + } + } + } + + /* compute MB type probability tables based on previous MB type */ + for (ctx=0; ctx<3; ctx++) { + int p[10]; + + for (type=0; type<10; type++) + p[type] = 100 * s->mb_types_stats[ctx][type][1]; + + for (type=0; type<10; type++) { + int p02, p34, p0234, p17, p56, p89, p5689, p156789; + + /* conservative MB type probability */ + s->mb_type_model[ctx][type][0] = 255 - (255 * s->mb_types_stats[ctx][type][0]) / (1 + s->mb_types_stats[ctx][type][0] + s->mb_types_stats[ctx][type][1]); + + p[type] = 0; /* same MB type => weight is null */ + + /* binary tree parsing probabilities */ + p02 = p[0] + p[2]; + p34 = p[3] + p[4]; + p0234 = p02 + p34; + p17 = p[1] + p[7]; + p56 = p[5] + p[6]; + p89 = p[8] + p[9]; + p5689 = p56 + p89; + p156789 = p17 + p5689; + + s->mb_type_model[ctx][type][1] = 1 + 255 * p0234/(1+p0234+p156789); + s->mb_type_model[ctx][type][2] = 1 + 255 * p02 / (1+p0234); + s->mb_type_model[ctx][type][3] = 1 + 255 * p17 / (1+p156789); + s->mb_type_model[ctx][type][4] = 1 + 255 * p[0] / (1+p02); + s->mb_type_model[ctx][type][5] = 1 + 255 * p[3] / (1+p34); + s->mb_type_model[ctx][type][6] = 1 + 255 * p[1] / (1+p17); + s->mb_type_model[ctx][type][7] = 1 + 255 * p56 / (1+p5689); + s->mb_type_model[ctx][type][8] = 1 + 255 * p[5] / (1+p56); + s->mb_type_model[ctx][type][9] = 1 + 255 * p[8] / (1+p89); + + /* restore initial value */ + p[type] = 100 * s->mb_types_stats[ctx][type][1]; + } + } +} + +static vp56_mb_t vp56_parse_mb_type(vp56_context_t *s, + vp56_mb_t prev_type, int ctx) +{ + uint8_t *mb_type_model = s->mb_type_model[ctx][prev_type]; + vp56_range_coder_t *c = &s->c; + + if (vp56_rac_get_prob(c, mb_type_model[0])) + return prev_type; + else + return vp56_rac_get_tree(c, vp56_pmbt_tree, mb_type_model); +} + +static void vp56_decode_4mv(vp56_context_t *s, int row, int col) +{ + vp56_mv_t mv = {0,0}; + int type[4]; + int b; + + /* parse each block type */ + for (b=0; b<4; b++) { + type[b] = vp56_rac_gets(&s->c, 2); + if (type[b]) + type[b]++; /* only returns 0, 2, 3 or 4 (all INTER_PF) */ + } + + /* get vectors */ + for (b=0; b<4; b++) { + switch (type[b]) { + case VP56_MB_INTER_NOVEC_PF: + s->mv[b] = (vp56_mv_t) {0,0}; + break; + case VP56_MB_INTER_DELTA_PF: + s->parse_vector_adjustment(s, &s->mv[b]); + break; + case VP56_MB_INTER_V1_PF: + s->mv[b] = s->vector_candidate[0]; + break; + case VP56_MB_INTER_V2_PF: + s->mv[b] = s->vector_candidate[1]; + break; + } + mv.x += s->mv[b].x; + mv.y += s->mv[b].y; + } + + /* this is the one selected for the whole MB for prediction */ + s->macroblocks[row * s->mb_width + col].mv = s->mv[3]; + + /* chroma vectors are average luma vectors */ + if (s->avctx->codec->id == CODEC_ID_VP5) { + s->mv[4].x = s->mv[5].x = RSHIFT(mv.x,2); + s->mv[4].y = s->mv[5].y = RSHIFT(mv.y,2); + } else { + s->mv[4] = s->mv[5] = (vp56_mv_t) {mv.x/4, mv.y/4}; + } +} + +static vp56_mb_t vp56_decode_mv(vp56_context_t *s, int row, int col) +{ + vp56_mv_t *mv, vect = {0,0}; + int ctx, b; + + ctx = vp56_get_vectors_predictors(s, row, col, VP56_FRAME_PREVIOUS); + s->mb_type = vp56_parse_mb_type(s, s->mb_type, ctx); + s->macroblocks[row * s->mb_width + col].type = s->mb_type; + + switch (s->mb_type) { + case VP56_MB_INTER_V1_PF: + mv = &s->vector_candidate[0]; + break; + + case VP56_MB_INTER_V2_PF: + mv = &s->vector_candidate[1]; + break; + + case VP56_MB_INTER_V1_GF: + vp56_get_vectors_predictors(s, row, col, VP56_FRAME_GOLDEN); + mv = &s->vector_candidate[0]; + break; + + case VP56_MB_INTER_V2_GF: + vp56_get_vectors_predictors(s, row, col, VP56_FRAME_GOLDEN); + mv = &s->vector_candidate[1]; + break; + + case VP56_MB_INTER_DELTA_PF: + s->parse_vector_adjustment(s, &vect); + mv = &vect; + break; + + case VP56_MB_INTER_DELTA_GF: + vp56_get_vectors_predictors(s, row, col, VP56_FRAME_GOLDEN); + s->parse_vector_adjustment(s, &vect); + mv = &vect; + break; + + case VP56_MB_INTER_4V: + vp56_decode_4mv(s, row, col); + return s->mb_type; + + default: + mv = &vect; + break; + } + + s->macroblocks[row*s->mb_width + col].mv = *mv; + + /* same vector for all blocks */ + for (b=0; b<6; b++) + s->mv[b] = *mv; + + return s->mb_type; +} + +static void vp56_add_predictors_dc(vp56_context_t *s, vp56_frame_t ref_frame) +{ + int idx = s->scantable.permutated[0]; + int i; + + for (i=0; i<6; i++) { + vp56_ref_dc_t *ab = &s->above_blocks[s->above_block_idx[i]]; + vp56_ref_dc_t *lb = &s->left_block[vp56_b6to4[i]]; + int count = 0; + int dc = 0; + + if (ref_frame == lb->ref_frame) { + dc += lb->dc_coeff; + count++; + } + if (ref_frame == ab->ref_frame) { + dc += ab->dc_coeff; + count++; + } + if (s->avctx->codec->id == CODEC_ID_VP5) { + if (count < 2 && ref_frame == ab[-1].ref_frame) { + dc += ab[-1].dc_coeff; + count++; + } + if (count < 2 && ref_frame == ab[1].ref_frame) { + dc += ab[1].dc_coeff; + count++; + } + } + if (count == 0) + dc = s->prev_dc[vp56_b6to3[i]][ref_frame]; + else if (count == 2) + dc /= 2; + + s->block_coeff[i][idx] += dc; + s->prev_dc[vp56_b6to3[i]][ref_frame] = s->block_coeff[i][idx]; + ab->dc_coeff = s->block_coeff[i][idx]; + ab->ref_frame = ref_frame; + lb->dc_coeff = s->block_coeff[i][idx]; + lb->ref_frame = ref_frame; + s->block_coeff[i][idx] *= s->dequant_dc; + } +} + +static void vp56_edge_filter(vp56_context_t *s, uint8_t *yuv, + int pix_inc, int line_inc, int t) +{ + int pix2_inc = 2 * pix_inc; + int i, v; + + for (i=0; i<12; i++) { + v = (yuv[-pix2_inc] + 3*(yuv[0]-yuv[-pix_inc]) - yuv[pix_inc] + 4) >>3; + v = s->adjust(v, t); + yuv[-pix_inc] = clip_uint8(yuv[-pix_inc] + v); + yuv[0] = clip_uint8(yuv[0] - v); + yuv += line_inc; + } +} + +static void vp56_deblock_filter(vp56_context_t *s, uint8_t *yuv, + int stride, int dx, int dy) +{ + int t = vp56_filter_threshold[s->quantizer]; + if (dx) vp56_edge_filter(s, yuv + 10-dx , 1, stride, t); + if (dy) vp56_edge_filter(s, yuv + stride*(10-dy), stride, 1, t); +} + +static void vp56_mc(vp56_context_t *s, int b, uint8_t *src, + int stride, int x, int y) +{ + int plane = vp56_b6to3[b]; + uint8_t *dst= s->frames[VP56_FRAME_CURRENT].data[plane]+s->block_offset[b]; + uint8_t *src_block; + int src_offset; + int overlap_offset = 0; + int mask = s->vp56_coord_div[b] - 1; + int deblock_filtering = s->deblock_filtering; + int dx; + int dy; + + if (s->avctx->skip_loop_filter >= AVDISCARD_ALL || + (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY + && !s->frames[VP56_FRAME_CURRENT].key_frame)) + deblock_filtering = 0; + + dx = s->mv[b].x / s->vp56_coord_div[b]; + dy = s->mv[b].y / s->vp56_coord_div[b]; + + if (b >= 4) { + x /= 2; + y /= 2; + } + x += dx - 2; + y += dy - 2; + + if (x<0 || x+12>=s->plane_width[plane] || + y<0 || y+12>=s->plane_height[plane]) { + ff_emulated_edge_mc(s->edge_emu_buffer, + src + s->block_offset[b] + (dy-2)*stride + (dx-2), + stride, 12, 12, x, y, + s->plane_width[plane], + s->plane_height[plane]); + src_block = s->edge_emu_buffer; + src_offset = 2 + 2*stride; + } else if (deblock_filtering) { + /* only need a 12x12 block, but there is no such dsp function, */ + /* so copy a 16x12 block */ + s->dsp.put_pixels_tab[0][0](s->edge_emu_buffer, + src + s->block_offset[b] + (dy-2)*stride + (dx-2), + stride, 12); + src_block = s->edge_emu_buffer; + src_offset = 2 + 2*stride; + } else { + src_block = src; + src_offset = s->block_offset[b] + dy*stride + dx; + } + + if (deblock_filtering) + vp56_deblock_filter(s, src_block, stride, dx&7, dy&7); + + if (s->mv[b].x & mask) + overlap_offset += (s->mv[b].x > 0) ? 1 : -1; + if (s->mv[b].y & mask) + overlap_offset += (s->mv[b].y > 0) ? stride : -stride; + + if (overlap_offset) { + if (s->filter) + s->filter(s, dst, src_block, src_offset, src_offset+overlap_offset, + stride, s->mv[b], mask, s->filter_selection, b<4); + else + s->dsp.put_no_rnd_pixels_l2[1](dst, src_block+src_offset, + src_block+src_offset+overlap_offset, + stride, 8); + } else { + s->dsp.put_pixels_tab[1][0](dst, src_block+src_offset, stride, 8); + } +} + +static void vp56_decode_mb(vp56_context_t *s, int row, int col) +{ + AVFrame *frame_current, *frame_ref; + vp56_mb_t mb_type; + vp56_frame_t ref_frame; + int b, plan, off; + + if (s->frames[VP56_FRAME_CURRENT].key_frame) + mb_type = VP56_MB_INTRA; + else + mb_type = vp56_decode_mv(s, row, col); + ref_frame = vp56_reference_frame[mb_type]; + + memset(s->block_coeff, 0, sizeof(s->block_coeff)); + + s->parse_coeff(s); + + vp56_add_predictors_dc(s, ref_frame); + + frame_current = &s->frames[VP56_FRAME_CURRENT]; + frame_ref = &s->frames[ref_frame]; + + switch (mb_type) { + case VP56_MB_INTRA: + for (b=0; b<6; b++) { + plan = vp56_b6to3[b]; + s->dsp.idct_put(frame_current->data[plan] + s->block_offset[b], + s->stride[plan], s->block_coeff[b]); + } + break; + + case VP56_MB_INTER_NOVEC_PF: + case VP56_MB_INTER_NOVEC_GF: + for (b=0; b<6; b++) { + plan = vp56_b6to3[b]; + off = s->block_offset[b]; + s->dsp.put_pixels_tab[1][0](frame_current->data[plan] + off, + frame_ref->data[plan] + off, + s->stride[plan], 8); + s->dsp.idct_add(frame_current->data[plan] + off, + s->stride[plan], s->block_coeff[b]); + } + break; + + case VP56_MB_INTER_DELTA_PF: + case VP56_MB_INTER_V1_PF: + case VP56_MB_INTER_V2_PF: + case VP56_MB_INTER_DELTA_GF: + case VP56_MB_INTER_4V: + case VP56_MB_INTER_V1_GF: + case VP56_MB_INTER_V2_GF: + for (b=0; b<6; b++) { + int x_off = b==1 || b==3 ? 8 : 0; + int y_off = b==2 || b==3 ? 8 : 0; + plan = vp56_b6to3[b]; + vp56_mc(s, b, frame_ref->data[plan], s->stride[plan], + 16*col+x_off, 16*row+y_off); + s->dsp.idct_add(frame_current->data[plan] + s->block_offset[b], + s->stride[plan], s->block_coeff[b]); + } + break; + } +} + +static int vp56_size_changed(AVCodecContext *avctx, vp56_context_t *s) +{ + int stride = s->frames[VP56_FRAME_CURRENT].linesize[0]; + int i; + + s->plane_width[0] = s->avctx->coded_width; + s->plane_width[1] = s->plane_width[2] = s->avctx->coded_width/2; + s->plane_height[0] = s->avctx->coded_height; + s->plane_height[1] = s->plane_height[2] = s->avctx->coded_height/2; + + for (i=0; i<3; i++) + s->stride[i] = s->flip * s->frames[VP56_FRAME_CURRENT].linesize[i]; + + s->mb_width = (s->avctx->coded_width+15) / 16; + s->mb_height = (s->avctx->coded_height+15) / 16; + + if (s->mb_width > 1000 || s->mb_height > 1000) { + av_log(avctx, AV_LOG_ERROR, "picture too big\n"); + return -1; + } + + s->above_blocks = av_realloc(s->above_blocks, + (4*s->mb_width+6) * sizeof(*s->above_blocks)); + s->macroblocks = av_realloc(s->macroblocks, + s->mb_width*s->mb_height*sizeof(*s->macroblocks)); + av_free(s->edge_emu_buffer_alloc); + s->edge_emu_buffer_alloc = av_malloc(16*stride); + s->edge_emu_buffer = s->edge_emu_buffer_alloc; + if (s->flip < 0) + s->edge_emu_buffer += 15 * stride; + + return 0; +} + +int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size, + uint8_t *buf, int buf_size) +{ + vp56_context_t *s = avctx->priv_data; + AVFrame *const p = &s->frames[VP56_FRAME_CURRENT]; + AVFrame *picture = data; + int mb_row, mb_col, mb_row_flip, mb_offset = 0; + int block, y, uv, stride_y, stride_uv; + int golden_frame = 0; + int res; + + res = s->parse_header(s, buf, buf_size, &golden_frame); + if (!res) + return -1; + + p->reference = 1; + if (avctx->get_buffer(avctx, p) < 0) { + av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + return -1; + } + + if (res == 2) + if (vp56_size_changed(avctx, s)) { + avctx->release_buffer(avctx, p); + return -1; + } + + if (p->key_frame) { + p->pict_type = FF_I_TYPE; + s->default_models_init(s); + for (block=0; blockmb_height*s->mb_width; block++) + s->macroblocks[block].type = VP56_MB_INTRA; + } else { + p->pict_type = FF_P_TYPE; + vp56_parse_mb_type_models(s); + s->parse_vector_models(s); + s->mb_type = VP56_MB_INTER_NOVEC_PF; + } + + s->parse_coeff_models(s); + + memset(s->prev_dc, 0, sizeof(s->prev_dc)); + s->prev_dc[1][VP56_FRAME_CURRENT] = 128; + s->prev_dc[2][VP56_FRAME_CURRENT] = 128; + + for (block=0; block < 4*s->mb_width+6; block++) { + s->above_blocks[block].ref_frame = -1; + s->above_blocks[block].dc_coeff = 0; + s->above_blocks[block].not_null_dc = 0; + } + s->above_blocks[2*s->mb_width + 2].ref_frame = 0; + s->above_blocks[3*s->mb_width + 4].ref_frame = 0; + + stride_y = p->linesize[0]; + stride_uv = p->linesize[1]; + + if (s->flip < 0) + mb_offset = 7; + + /* main macroblocks loop */ + for (mb_row=0; mb_rowmb_height; mb_row++) { + if (s->flip < 0) + mb_row_flip = s->mb_height - mb_row - 1; + else + mb_row_flip = mb_row; + + for (block=0; block<4; block++) { + s->left_block[block].ref_frame = -1; + s->left_block[block].dc_coeff = 0; + s->left_block[block].not_null_dc = 0; + memset(s->coeff_ctx[block], 0, 64*sizeof(s->coeff_ctx[block][0])); + } + memset(s->coeff_ctx_last, 24, sizeof(s->coeff_ctx_last)); + + s->above_block_idx[0] = 1; + s->above_block_idx[1] = 2; + s->above_block_idx[2] = 1; + s->above_block_idx[3] = 2; + s->above_block_idx[4] = 2*s->mb_width + 2 + 1; + s->above_block_idx[5] = 3*s->mb_width + 4 + 1; + + s->block_offset[s->frbi] = (mb_row_flip*16 + mb_offset) * stride_y; + s->block_offset[s->srbi] = s->block_offset[s->frbi] + 8*stride_y; + s->block_offset[1] = s->block_offset[0] + 8; + s->block_offset[3] = s->block_offset[2] + 8; + s->block_offset[4] = (mb_row_flip*8 + mb_offset) * stride_uv; + s->block_offset[5] = s->block_offset[4]; + + for (mb_col=0; mb_colmb_width; mb_col++) { + vp56_decode_mb(s, mb_row, mb_col); + + for (y=0; y<4; y++) { + s->above_block_idx[y] += 2; + s->block_offset[y] += 16; + } + + for (uv=4; uv<6; uv++) { + s->above_block_idx[uv] += 1; + s->block_offset[uv] += 8; + } + } + } + + if (s->frames[VP56_FRAME_PREVIOUS].data[0] + && (s->frames[VP56_FRAME_PREVIOUS].data[0] + != s->frames[VP56_FRAME_GOLDEN].data[0])) { + avctx->release_buffer(avctx, &s->frames[VP56_FRAME_PREVIOUS]); + } + if (p->key_frame || golden_frame) { + if (s->frames[VP56_FRAME_GOLDEN].data[0]) + avctx->release_buffer(avctx, &s->frames[VP56_FRAME_GOLDEN]); + s->frames[VP56_FRAME_GOLDEN] = *p; + } + s->frames[VP56_FRAME_PREVIOUS] = *p; + + *picture = *p; + *data_size = sizeof(AVPicture); + + return buf_size; +} + +void vp56_init(vp56_context_t *s, AVCodecContext *avctx, int flip) +{ + int i; + + s->avctx = avctx; + avctx->pix_fmt = PIX_FMT_YUV420P; + + if (s->avctx->idct_algo == FF_IDCT_AUTO) + s->avctx->idct_algo = FF_IDCT_VP3; + dsputil_init(&s->dsp, s->avctx); + ff_init_scantable(s->dsp.idct_permutation, &s->scantable,ff_zigzag_direct); + + avcodec_set_dimensions(s->avctx, 0, 0); + + for (i=0; i<3; i++) + s->frames[i].data[0] = NULL; + s->edge_emu_buffer_alloc = NULL; + + s->above_blocks = NULL; + s->macroblocks = NULL; + s->quantizer = -1; + s->deblock_filtering = 1; + + s->filter = NULL; + + if (flip) { + s->flip = -1; + s->frbi = 2; + s->srbi = 0; + } else { + s->flip = 1; + s->frbi = 0; + s->srbi = 2; + } +} + +int vp56_free(AVCodecContext *avctx) +{ + vp56_context_t *s = avctx->priv_data; + + av_free(s->above_blocks); + av_free(s->macroblocks); + av_free(s->edge_emu_buffer_alloc); + if (s->frames[VP56_FRAME_GOLDEN].data[0] + && (s->frames[VP56_FRAME_PREVIOUS].data[0] + != s->frames[VP56_FRAME_GOLDEN].data[0])) + avctx->release_buffer(avctx, &s->frames[VP56_FRAME_GOLDEN]); + if (s->frames[VP56_FRAME_PREVIOUS].data[0]) + avctx->release_buffer(avctx, &s->frames[VP56_FRAME_PREVIOUS]); + return 0; +} diff --git a/src/libffmpeg/libavcodec/vp56.h b/src/libffmpeg/libavcodec/vp56.h new file mode 100644 index 000000000..f8b3a8e4b --- /dev/null +++ b/src/libffmpeg/libavcodec/vp56.h @@ -0,0 +1,249 @@ +/** + * @file vp56.h + * VP5 and VP6 compatible video decoder (common features) + * + * Copyright (C) 2006 Aurelien Jacobs + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef VP56_H +#define VP56_H + +#include "vp56data.h" +#include "dsputil.h" +#include "mpegvideo.h" + + +typedef struct vp56_context vp56_context_t; +typedef struct vp56_mv vp56_mv_t; + +typedef void (*vp56_parse_vector_adjustment_t)(vp56_context_t *s, + vp56_mv_t *vect); +typedef int (*vp56_adjust_t)(int v, int t); +typedef void (*vp56_filter_t)(vp56_context_t *s, uint8_t *dst, uint8_t *src, + int offset1, int offset2, int stride, + vp56_mv_t mv, int mask, int select, int luma); +typedef void (*vp56_parse_coeff_t)(vp56_context_t *s); +typedef void (*vp56_default_models_init_t)(vp56_context_t *s); +typedef void (*vp56_parse_vector_models_t)(vp56_context_t *s); +typedef void (*vp56_parse_coeff_models_t)(vp56_context_t *s); +typedef int (*vp56_parse_header_t)(vp56_context_t *s, uint8_t *buf, + int buf_size, int *golden_frame); + +typedef struct { + int high; + int bits; + const uint8_t *buffer; + unsigned long code_word; +} vp56_range_coder_t; + +typedef struct { + uint8_t not_null_dc; + vp56_frame_t ref_frame; + DCTELEM dc_coeff; +} vp56_ref_dc_t; + +struct vp56_mv { + int x; + int y; +}; + +typedef struct { + uint8_t type; + vp56_mv_t mv; +} vp56_macroblock_t; + +struct vp56_context { + AVCodecContext *avctx; + DSPContext dsp; + ScanTable scantable; + AVFrame frames[3]; + uint8_t *edge_emu_buffer_alloc; + uint8_t *edge_emu_buffer; + vp56_range_coder_t c; + int sub_version; + + /* frame info */ + int plane_width[3]; + int plane_height[3]; + int mb_width; /* number of horizontal MB */ + int mb_height; /* number of vertical MB */ + int block_offset[6]; + + int quantizer; + uint16_t dequant_dc; + uint16_t dequant_ac; + + /* DC predictors management */ + vp56_ref_dc_t *above_blocks; + vp56_ref_dc_t left_block[4]; + int above_block_idx[6]; + DCTELEM prev_dc[3][3]; /* [plan][ref_frame] */ + + /* blocks / macroblock */ + vp56_mb_t mb_type; + vp56_macroblock_t *macroblocks; + DECLARE_ALIGNED_16(DCTELEM, block_coeff[6][64]); + uint8_t coeff_reorder[64]; /* used in vp6 only */ + uint8_t coeff_index_to_pos[64]; /* used in vp6 only */ + + /* motion vectors */ + vp56_mv_t mv[6]; /* vectors for each block in MB */ + vp56_mv_t vector_candidate[2]; + int vector_candidate_pos; + + /* filtering hints */ + int deblock_filtering; + int filter_selection; + int filter_mode; + int max_vector_length; + int sample_variance_threshold; + + /* AC models */ + uint8_t vector_model_sig[2]; /* delta sign */ + uint8_t vector_model_dct[2]; /* delta coding types */ + uint8_t vector_model_pdi[2][2]; /* predefined delta init */ + uint8_t vector_model_pdv[2][7]; /* predefined delta values */ + uint8_t vector_model_fdv[2][8]; /* 8 bit delta value definition */ + uint8_t mb_type_model[3][10][10]; /* model for decoding MB type */ + uint8_t coeff_model_dccv[2][11]; /* DC coeff value */ + uint8_t coeff_model_ract[2][3][6][11]; /* Run/AC coding type and AC coeff value */ + uint8_t coeff_model_acct[2][3][3][6][5];/* vp5 only AC coding type for coding group < 3 */ + uint8_t coeff_model_dcct[2][36][5]; /* DC coeff coding type */ + uint8_t coeff_model_runv[2][14]; /* run value (vp6 only) */ + uint8_t mb_types_stats[3][10][2]; /* contextual, next MB type stats */ + uint8_t coeff_ctx[4][64]; /* used in vp5 only */ + uint8_t coeff_ctx_last[4]; /* used in vp5 only */ + + /* upside-down flipping hints */ + int flip; /* are we flipping ? */ + int frbi; /* first row block index in MB */ + int srbi; /* second row block index in MB */ + int stride[3]; /* stride for each plan */ + + const uint8_t *vp56_coord_div; + vp56_parse_vector_adjustment_t parse_vector_adjustment; + vp56_adjust_t adjust; + vp56_filter_t filter; + vp56_parse_coeff_t parse_coeff; + vp56_default_models_init_t default_models_init; + vp56_parse_vector_models_t parse_vector_models; + vp56_parse_coeff_models_t parse_coeff_models; + vp56_parse_header_t parse_header; +}; + + +void vp56_init(vp56_context_t *s, AVCodecContext *avctx, int flip); +int vp56_free(AVCodecContext *avctx); +void vp56_init_dequant(vp56_context_t *s, int quantizer); +int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size, + uint8_t *buf, int buf_size); + + +/** + * vp56 specific range coder implementation + */ + +static inline void vp56_init_range_decoder(vp56_range_coder_t *c, + const uint8_t *buf, int buf_size) +{ + c->high = 255; + c->bits = 8; + c->buffer = buf; + c->code_word = *c->buffer++ << 8; + c->code_word |= *c->buffer++; +} + +static inline int vp56_rac_get_prob(vp56_range_coder_t *c, uint8_t prob) +{ + unsigned int low = 1 + (((c->high - 1) * prob) / 256); + unsigned int low_shift = low << 8; + int bit = c->code_word >= low_shift; + + if (bit) { + c->high -= low; + c->code_word -= low_shift; + } else { + c->high = low; + } + + /* normalize */ + while (c->high < 128) { + c->high <<= 1; + c->code_word <<= 1; + if (--c->bits == 0) { + c->bits = 8; + c->code_word |= *c->buffer++; + } + } + return bit; +} + +static inline int vp56_rac_get(vp56_range_coder_t *c) +{ + /* equiprobable */ + int low = (c->high + 1) >> 1; + unsigned int low_shift = low << 8; + int bit = c->code_word >= low_shift; + if (bit) { + c->high = (c->high - low) << 1; + c->code_word -= low_shift; + } else { + c->high = low << 1; + } + + /* normalize */ + c->code_word <<= 1; + if (--c->bits == 0) { + c->bits = 8; + c->code_word |= *c->buffer++; + } + return bit; +} + +static inline int vp56_rac_gets(vp56_range_coder_t *c, int bits) +{ + int value = 0; + + while (bits--) { + value = (value << 1) | vp56_rac_get(c); + } + + return value; +} + +static inline int vp56_rac_gets_nn(vp56_range_coder_t *c, int bits) +{ + int v = vp56_rac_gets(c, 7) << 1; + return v + !v; +} + +static inline int vp56_rac_get_tree(vp56_range_coder_t *c, + const vp56_tree_t *tree, + const uint8_t *probs) +{ + while (tree->val > 0) { + if (vp56_rac_get_prob(c, probs[tree->prob_idx])) + tree += tree->val; + else + tree++; + } + return -tree->val; +} + +#endif /* VP56_H */ diff --git a/src/libffmpeg/libavcodec/vp56data.c b/src/libffmpeg/libavcodec/vp56data.c new file mode 100644 index 000000000..e75c6d1ce --- /dev/null +++ b/src/libffmpeg/libavcodec/vp56data.c @@ -0,0 +1,66 @@ +/** + * @file vp56data.c + * VP5 and VP6 compatible video decoder (common data) + * + * Copyright (C) 2006 Aurelien Jacobs + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "vp56data.h" + +const uint8_t vp56_b6to3[] = { 0, 0, 0, 0, 1, 2 }; +const uint8_t vp56_b6to4[] = { 0, 0, 1, 1, 2, 3 }; + +const uint8_t vp56_coeff_parse_table[6][11] = { + { 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 145, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 140, 148, 173, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 135, 140, 155, 176, 0, 0, 0, 0, 0, 0, 0 }, + { 130, 134, 141, 157, 180, 0, 0, 0, 0, 0, 0 }, + { 129, 130, 133, 140, 153, 177, 196, 230, 243, 254, 254 }, +}; + +const uint8_t vp56_def_mb_types_stats[3][10][2] = { + { { 69, 42 }, { 1, 2 }, { 1, 7 }, { 44, 42 }, { 6, 22 }, + { 1, 3 }, { 0, 2 }, { 1, 5 }, { 0, 1 }, { 0, 0 }, }, + { { 229, 8 }, { 1, 1 }, { 0, 8 }, { 0, 0 }, { 0, 0 }, + { 1, 2 }, { 0, 1 }, { 0, 0 }, { 1, 1 }, { 0, 0 }, }, + { { 122, 35 }, { 1, 1 }, { 1, 6 }, { 46, 34 }, { 0, 0 }, + { 1, 2 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 }, }, +}; + +const vp56_tree_t vp56_pva_tree[] = { + { 8, 0}, + { 4, 1}, + { 2, 2}, {-0}, {-1}, + { 2, 3}, {-2}, {-3}, + { 4, 4}, + { 2, 5}, {-4}, {-5}, + { 2, 6}, {-6}, {-7}, +}; + +const vp56_tree_t vp56_pc_tree[] = { + { 4, 6}, + { 2, 7}, {-0}, {-1}, + { 4, 8}, + { 2, 9}, {-2}, {-3}, + { 2,10}, {-4}, {-5}, +}; + +const uint8_t vp56_coeff_bias[] = { 5, 7, 11, 19, 35, 67 }; +const uint8_t vp56_coeff_bit_length[] = { 0, 1, 2, 3, 4, 10 }; diff --git a/src/libffmpeg/libavcodec/vp56data.h b/src/libffmpeg/libavcodec/vp56data.h new file mode 100644 index 000000000..dbf92dd68 --- /dev/null +++ b/src/libffmpeg/libavcodec/vp56data.h @@ -0,0 +1,248 @@ +/** + * @file vp56data.h + * VP5 and VP6 compatible video decoder (common data) + * + * Copyright (C) 2006 Aurelien Jacobs + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef VP56DATA_H +#define VP56DATA_H + +#include "common.h" + +typedef enum { + VP56_FRAME_CURRENT = 0, + VP56_FRAME_PREVIOUS = 1, + VP56_FRAME_GOLDEN = 2, +} vp56_frame_t; + +typedef enum { + VP56_MB_INTER_NOVEC_PF = 0, /**< Inter MB, no vector, from previous frame */ + VP56_MB_INTRA = 1, /**< Intra MB */ + VP56_MB_INTER_DELTA_PF = 2, /**< Inter MB, above/left vector + delta, from previous frame */ + VP56_MB_INTER_V1_PF = 3, /**< Inter MB, first vector, from previous frame */ + VP56_MB_INTER_V2_PF = 4, /**< Inter MB, second vector, from previous frame */ + VP56_MB_INTER_NOVEC_GF = 5, /**< Inter MB, no vector, from golden frame */ + VP56_MB_INTER_DELTA_GF = 6, /**< Inter MB, above/left vector + delta, from golden frame */ + VP56_MB_INTER_4V = 7, /**< Inter MB, 4 vectors, from previous frame */ + VP56_MB_INTER_V1_GF = 8, /**< Inter MB, first vector, from golden frame */ + VP56_MB_INTER_V2_GF = 9, /**< Inter MB, second vector, from golden frame */ +} vp56_mb_t; + +typedef struct { + int8_t val; + int8_t prob_idx; +} vp56_tree_t; + +extern const uint8_t vp56_b6to3[]; +extern const uint8_t vp56_b6to4[]; +extern const uint8_t vp56_coeff_parse_table[6][11]; +extern const uint8_t vp56_def_mb_types_stats[3][10][2]; +extern const vp56_tree_t vp56_pva_tree[]; +extern const vp56_tree_t vp56_pc_tree[]; +extern const uint8_t vp56_coeff_bias[]; +extern const uint8_t vp56_coeff_bit_length[]; + +static const vp56_frame_t vp56_reference_frame[] = { + VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_NOVEC_PF */ + VP56_FRAME_CURRENT, /* VP56_MB_INTRA */ + VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_DELTA_PF */ + VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_V1_PF */ + VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_V2_PF */ + VP56_FRAME_GOLDEN, /* VP56_MB_INTER_NOVEC_GF */ + VP56_FRAME_GOLDEN, /* VP56_MB_INTER_DELTA_GF */ + VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_4V */ + VP56_FRAME_GOLDEN, /* VP56_MB_INTER_V1_GF */ + VP56_FRAME_GOLDEN, /* VP56_MB_INTER_V2_GF */ +}; + +static const uint8_t vp56_ac_dequant[64] = { + 94, 92, 90, 88, 86, 82, 78, 74, + 70, 66, 62, 58, 54, 53, 52, 51, + 50, 49, 48, 47, 46, 45, 44, 43, + 42, 40, 39, 37, 36, 35, 34, 33, + 32, 31, 30, 29, 28, 27, 26, 25, + 24, 23, 22, 21, 20, 19, 18, 17, + 16, 15, 14, 13, 12, 11, 10, 9, + 8, 7, 6, 5, 4, 3, 2, 1, +}; + +static const uint8_t vp56_dc_dequant[64] = { + 47, 47, 47, 47, 45, 43, 43, 43, + 43, 43, 42, 41, 41, 40, 40, 40, + 40, 35, 35, 35, 35, 33, 33, 33, + 33, 32, 32, 32, 27, 27, 26, 26, + 25, 25, 24, 24, 23, 23, 19, 19, + 19, 19, 18, 18, 17, 16, 16, 16, + 16, 16, 15, 11, 11, 11, 10, 10, + 9, 8, 7, 5, 3, 3, 2, 2, +}; + +static const uint8_t vp56_pre_def_mb_type_stats[16][3][10][2] = { + { { { 9, 15 }, { 32, 25 }, { 7, 19 }, { 9, 21 }, { 1, 12 }, + { 14, 12 }, { 3, 18 }, { 14, 23 }, { 3, 10 }, { 0, 4 }, }, + { { 41, 22 }, { 1, 0 }, { 1, 31 }, { 0, 0 }, { 0, 0 }, + { 0, 1 }, { 1, 7 }, { 0, 1 }, { 98, 25 }, { 4, 10 }, }, + { { 2, 3 }, { 2, 3 }, { 0, 2 }, { 0, 2 }, { 0, 0 }, + { 11, 4 }, { 1, 4 }, { 0, 2 }, { 3, 2 }, { 0, 4 }, }, }, + { { { 48, 39 }, { 1, 2 }, { 11, 27 }, { 29, 44 }, { 7, 27 }, + { 1, 4 }, { 0, 3 }, { 1, 6 }, { 1, 2 }, { 0, 0 }, }, + { { 123, 37 }, { 6, 4 }, { 1, 27 }, { 0, 0 }, { 0, 0 }, + { 5, 8 }, { 1, 7 }, { 0, 1 }, { 12, 10 }, { 0, 2 }, }, + { { 49, 46 }, { 3, 4 }, { 7, 31 }, { 42, 41 }, { 0, 0 }, + { 2, 6 }, { 1, 7 }, { 1, 4 }, { 2, 4 }, { 0, 1 }, }, }, + { { { 21, 32 }, { 1, 2 }, { 4, 10 }, { 32, 43 }, { 6, 23 }, + { 2, 3 }, { 1, 19 }, { 1, 6 }, { 12, 21 }, { 0, 7 }, }, + { { 26, 14 }, { 14, 12 }, { 0, 24 }, { 0, 0 }, { 0, 0 }, + { 55, 17 }, { 1, 9 }, { 0, 36 }, { 5, 7 }, { 1, 3 }, }, + { { 26, 25 }, { 1, 1 }, { 2, 10 }, { 67, 39 }, { 0, 0 }, + { 1, 1 }, { 0, 14 }, { 0, 2 }, { 31, 26 }, { 1, 6 }, }, }, + { { { 69, 83 }, { 0, 0 }, { 0, 2 }, { 10, 29 }, { 3, 12 }, + { 0, 1 }, { 0, 3 }, { 0, 3 }, { 2, 2 }, { 0, 0 }, }, + { { 209, 5 }, { 0, 0 }, { 0, 27 }, { 0, 0 }, { 0, 0 }, + { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, }, + { { 103, 46 }, { 1, 2 }, { 2, 10 }, { 33, 42 }, { 0, 0 }, + { 1, 4 }, { 0, 3 }, { 0, 1 }, { 1, 3 }, { 0, 0 }, }, }, + { { { 11, 20 }, { 1, 4 }, { 18, 36 }, { 43, 48 }, { 13, 35 }, + { 0, 2 }, { 0, 5 }, { 3, 12 }, { 1, 2 }, { 0, 0 }, }, + { { 2, 5 }, { 4, 5 }, { 0, 121 }, { 0, 0 }, { 0, 0 }, + { 0, 3 }, { 2, 4 }, { 1, 4 }, { 2, 2 }, { 0, 1 }, }, + { { 14, 31 }, { 9, 13 }, { 14, 54 }, { 22, 29 }, { 0, 0 }, + { 2, 6 }, { 4, 18 }, { 6, 13 }, { 1, 5 }, { 0, 1 }, }, }, + { { { 70, 44 }, { 0, 1 }, { 2, 10 }, { 37, 46 }, { 8, 26 }, + { 0, 2 }, { 0, 2 }, { 0, 2 }, { 0, 1 }, { 0, 0 }, }, + { { 175, 5 }, { 0, 1 }, { 0, 48 }, { 0, 0 }, { 0, 0 }, + { 0, 2 }, { 0, 1 }, { 0, 2 }, { 0, 1 }, { 0, 0 }, }, + { { 85, 39 }, { 0, 0 }, { 1, 9 }, { 69, 40 }, { 0, 0 }, + { 0, 1 }, { 0, 3 }, { 0, 1 }, { 2, 3 }, { 0, 0 }, }, }, + { { { 8, 15 }, { 0, 1 }, { 8, 21 }, { 74, 53 }, { 22, 42 }, + { 0, 1 }, { 0, 2 }, { 0, 3 }, { 1, 2 }, { 0, 0 }, }, + { { 83, 5 }, { 2, 3 }, { 0, 102 }, { 0, 0 }, { 0, 0 }, + { 1, 3 }, { 0, 2 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, }, + { { 31, 28 }, { 0, 0 }, { 3, 14 }, { 130, 34 }, { 0, 0 }, + { 0, 1 }, { 0, 3 }, { 0, 1 }, { 3, 3 }, { 0, 1 }, }, }, + { { { 141, 42 }, { 0, 0 }, { 1, 4 }, { 11, 24 }, { 1, 11 }, + { 0, 1 }, { 0, 1 }, { 0, 2 }, { 0, 0 }, { 0, 0 }, }, + { { 233, 6 }, { 0, 0 }, { 0, 8 }, { 0, 0 }, { 0, 0 }, + { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 1 }, { 0, 0 }, }, + { { 171, 25 }, { 0, 0 }, { 1, 5 }, { 25, 21 }, { 0, 0 }, + { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, }, }, + { { { 8, 19 }, { 4, 10 }, { 24, 45 }, { 21, 37 }, { 9, 29 }, + { 0, 3 }, { 1, 7 }, { 11, 25 }, { 0, 2 }, { 0, 1 }, }, + { { 34, 16 }, { 112, 21 }, { 1, 28 }, { 0, 0 }, { 0, 0 }, + { 6, 8 }, { 1, 7 }, { 0, 3 }, { 2, 5 }, { 0, 2 }, }, + { { 17, 21 }, { 68, 29 }, { 6, 15 }, { 13, 22 }, { 0, 0 }, + { 6, 12 }, { 3, 14 }, { 4, 10 }, { 1, 7 }, { 0, 3 }, }, }, + { { { 46, 42 }, { 0, 1 }, { 2, 10 }, { 54, 51 }, { 10, 30 }, + { 0, 2 }, { 0, 2 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, }, + { { 159, 35 }, { 2, 2 }, { 0, 25 }, { 0, 0 }, { 0, 0 }, + { 3, 6 }, { 0, 5 }, { 0, 1 }, { 4, 4 }, { 0, 1 }, }, + { { 51, 39 }, { 0, 1 }, { 2, 12 }, { 91, 44 }, { 0, 0 }, + { 0, 2 }, { 0, 3 }, { 0, 1 }, { 2, 3 }, { 0, 1 }, }, }, + { { { 28, 32 }, { 0, 0 }, { 3, 10 }, { 75, 51 }, { 14, 33 }, + { 0, 1 }, { 0, 2 }, { 0, 1 }, { 1, 2 }, { 0, 0 }, }, + { { 75, 39 }, { 5, 7 }, { 2, 48 }, { 0, 0 }, { 0, 0 }, + { 3, 11 }, { 2, 16 }, { 1, 4 }, { 7, 10 }, { 0, 2 }, }, + { { 81, 25 }, { 0, 0 }, { 2, 9 }, { 106, 26 }, { 0, 0 }, + { 0, 1 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 }, }, }, + { { { 100, 46 }, { 0, 1 }, { 3, 9 }, { 21, 37 }, { 5, 20 }, + { 0, 1 }, { 0, 2 }, { 1, 2 }, { 0, 1 }, { 0, 0 }, }, + { { 212, 21 }, { 0, 1 }, { 0, 9 }, { 0, 0 }, { 0, 0 }, + { 1, 2 }, { 0, 2 }, { 0, 0 }, { 2, 2 }, { 0, 0 }, }, + { { 140, 37 }, { 0, 1 }, { 1, 8 }, { 24, 33 }, { 0, 0 }, + { 1, 2 }, { 0, 2 }, { 0, 1 }, { 1, 2 }, { 0, 0 }, }, }, + { { { 27, 29 }, { 0, 1 }, { 9, 25 }, { 53, 51 }, { 12, 34 }, + { 0, 1 }, { 0, 3 }, { 1, 5 }, { 0, 2 }, { 0, 0 }, }, + { { 4, 2 }, { 0, 0 }, { 0, 172 }, { 0, 0 }, { 0, 0 }, + { 0, 1 }, { 0, 2 }, { 0, 0 }, { 2, 0 }, { 0, 0 }, }, + { { 14, 23 }, { 1, 3 }, { 11, 53 }, { 90, 31 }, { 0, 0 }, + { 0, 3 }, { 1, 5 }, { 2, 6 }, { 1, 2 }, { 0, 0 }, }, }, + { { { 80, 38 }, { 0, 0 }, { 1, 4 }, { 69, 33 }, { 5, 16 }, + { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 1 }, { 0, 0 }, }, + { { 187, 22 }, { 1, 1 }, { 0, 17 }, { 0, 0 }, { 0, 0 }, + { 3, 6 }, { 0, 4 }, { 0, 1 }, { 4, 4 }, { 0, 1 }, }, + { { 123, 29 }, { 0, 0 }, { 1, 7 }, { 57, 30 }, { 0, 0 }, + { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, }, }, + { { { 16, 20 }, { 0, 0 }, { 2, 8 }, { 104, 49 }, { 15, 33 }, + { 0, 1 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 }, }, + { { 133, 6 }, { 1, 2 }, { 1, 70 }, { 0, 0 }, { 0, 0 }, + { 0, 2 }, { 0, 4 }, { 0, 3 }, { 1, 1 }, { 0, 0 }, }, + { { 13, 14 }, { 0, 0 }, { 4, 20 }, { 175, 20 }, { 0, 0 }, + { 0, 1 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 }, }, }, + { { { 194, 16 }, { 0, 0 }, { 1, 1 }, { 1, 9 }, { 1, 3 }, + { 0, 0 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, }, + { { 251, 1 }, { 0, 0 }, { 0, 2 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, }, + { { 202, 23 }, { 0, 0 }, { 1, 3 }, { 2, 9 }, { 0, 0 }, + { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, }, }, +}; + +static const uint8_t vp56_filter_threshold[] = { + 14, 14, 13, 13, 12, 12, 10, 10, + 10, 10, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 7, 7, 7, 7, + 7, 7, 6, 6, 6, 6, 6, 6, + 5, 5, 5, 5, 4, 4, 4, 4, + 4, 4, 4, 3, 3, 3, 3, 2, +}; + +static const uint8_t vp56_mb_type_model_model[] = { + 171, 83, 199, 140, 125, 104, +}; + +static const vp56_tree_t vp56_pmbtm_tree[] = { + { 4, 0}, + { 2, 1}, {-8}, {-4}, + { 8, 2}, + { 6, 3}, + { 4, 4}, + { 2, 5}, {-24}, {-20}, {-16}, {-12}, {-0}, +}; + +static const vp56_tree_t vp56_pmbt_tree[] = { + { 8, 1}, + { 4, 2}, + { 2, 4}, {-VP56_MB_INTER_NOVEC_PF}, {-VP56_MB_INTER_DELTA_PF}, + { 2, 5}, {-VP56_MB_INTER_V1_PF}, {-VP56_MB_INTER_V2_PF}, + { 4, 3}, + { 2, 6}, {-VP56_MB_INTRA}, {-VP56_MB_INTER_4V}, + { 4, 7}, + { 2, 8}, {-VP56_MB_INTER_NOVEC_GF}, {-VP56_MB_INTER_DELTA_GF}, + { 2, 9}, {-VP56_MB_INTER_V1_GF}, {-VP56_MB_INTER_V2_GF}, +}; + +/* relative pos of surrounding blocks, from closest to farthest */ +static const int8_t vp56_candidate_predictor_pos[12][2] = { + { 0, -1 }, + { -1, 0 }, + { -1, -1 }, + { 1, -1 }, + { 0, -2 }, + { -2, 0 }, + { -2, -1 }, + { -1, -2 }, + { 1, -2 }, + { 2, -1 }, + { -2, -2 }, + { 2, -2 }, +}; + +#endif /* VP56DATA */ diff --git a/src/libffmpeg/libavcodec/vp5data.h b/src/libffmpeg/libavcodec/vp5data.h new file mode 100644 index 000000000..effc17c2c --- /dev/null +++ b/src/libffmpeg/libavcodec/vp5data.h @@ -0,0 +1,173 @@ +/** + * @file vp5data.h + * VP5 compatible video decoder + * + * Copyright (C) 2006 Aurelien Jacobs + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef VP5DATA_H +#define VP5DATA_H + +static const uint8_t vp5_coeff_groups[] = { + -1, 0, 1, 1, 2, 1, 1, 2, + 2, 1, 1, 2, 2, 2, 1, 2, + 2, 2, 2, 2, 1, 1, 2, 2, + 3, 3, 4, 3, 4, 4, 4, 3, + 3, 3, 3, 3, 4, 3, 3, 3, + 4, 4, 4, 4, 4, 3, 3, 4, + 4, 4, 3, 4, 4, 4, 4, 4, + 4, 4, 5, 5, 5, 5, 5, 5, +}; + +static const uint8_t vp5_vmc_pct[2][11] = { + { 243, 220, 251, 253, 237, 232, 241, 245, 247, 251, 253 }, + { 235, 211, 246, 249, 234, 231, 248, 249, 252, 252, 254 }, +}; + +static const uint8_t vp5_dccv_pct[2][11] = { + { 146, 197, 181, 207, 232, 243, 238, 251, 244, 250, 249 }, + { 179, 219, 214, 240, 250, 254, 244, 254, 254, 254, 254 }, +}; + +static const uint8_t vp5_ract_pct[3][2][6][11] = { + { { { 227, 246, 230, 247, 244, 254, 254, 254, 254, 254, 254 }, + { 202, 254, 209, 231, 231, 249, 249, 253, 254, 254, 254 }, + { 206, 254, 225, 242, 241, 251, 253, 254, 254, 254, 254 }, + { 235, 254, 241, 253, 252, 254, 254, 254, 254, 254, 254 }, + { 234, 254, 248, 254, 254, 254, 254, 254, 254, 254, 254 }, + { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } }, + { { 240, 254, 248, 254, 254, 254, 254, 254, 254, 254, 254 }, + { 238, 254, 240, 253, 254, 254, 254, 254, 254, 254, 254 }, + { 244, 254, 251, 254, 254, 254, 254, 254, 254, 254, 254 }, + { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }, + { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }, + { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } } }, + { { { 206, 203, 227, 239, 247, 254, 253, 254, 254, 254, 254 }, + { 207, 199, 220, 236, 243, 252, 252, 254, 254, 254, 254 }, + { 212, 219, 230, 243, 244, 253, 252, 254, 254, 254, 254 }, + { 236, 237, 247, 252, 253, 254, 254, 254, 254, 254, 254 }, + { 240, 240, 248, 254, 254, 254, 254, 254, 254, 254, 254 }, + { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } }, + { { 230, 233, 249, 254, 254, 254, 254, 254, 254, 254, 254 }, + { 238, 238, 250, 254, 254, 254, 254, 254, 254, 254, 254 }, + { 248, 251, 254, 254, 254, 254, 254, 254, 254, 254, 254 }, + { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }, + { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }, + { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } } }, + { { { 225, 239, 227, 231, 244, 253, 243, 254, 254, 253, 254 }, + { 232, 234, 224, 228, 242, 249, 242, 252, 251, 251, 254 }, + { 235, 249, 238, 240, 251, 254, 249, 254, 253, 253, 254 }, + { 249, 253, 251, 250, 254, 254, 254, 254, 254, 254, 254 }, + { 251, 250, 249, 254, 254, 254, 254, 254, 254, 254, 254 }, + { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } }, + { { 243, 244, 250, 250, 254, 254, 254, 254, 254, 254, 254 }, + { 249, 248, 250, 253, 254, 254, 254, 254, 254, 254, 254 }, + { 253, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }, + { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }, + { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }, + { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } } }, +}; + +static const int16_t vp5_dccv_lc[5][36][2] = { + { {154, 61}, {141, 54}, { 90, 45}, { 54, 34}, { 54, 13}, {128, 109}, + {136, 54}, {148, 45}, { 92, 41}, { 54, 33}, { 51, 15}, { 87, 113}, + { 87, 44}, { 97, 40}, { 67, 36}, { 46, 29}, { 41, 15}, { 64, 80}, + { 59, 33}, { 61, 31}, { 51, 28}, { 44, 22}, { 33, 12}, { 49, 63}, + { 69, 12}, { 59, 16}, { 46, 14}, { 31, 13}, { 26, 6}, { 92, 26}, + {128, 108}, { 77, 119}, { 54, 84}, { 26, 71}, { 87, 19}, { 95, 155} }, + { {154, 4}, {182, 0}, {159, -8}, {128, -5}, {143, -5}, {187, 55}, + {182, 0}, {228, -3}, {187, -7}, {174, -9}, {189, -11}, {169, 79}, + {161, -9}, {192, -8}, {187, -9}, {169, -10}, {136, -9}, {184, 40}, + {164, -11}, {179, -10}, {174, -10}, {161, -10}, {115, -7}, {197, 20}, + {195, -11}, {195, -11}, {146, -10}, {110, -6}, { 95, -4}, {195, 39}, + {182, 55}, {172, 77}, {177, 37}, {169, 29}, {172, 52}, { 92, 162} }, + { {174, 80}, {164, 80}, { 95, 80}, { 46, 66}, { 56, 24}, { 36, 193}, + {164, 80}, {166, 77}, {105, 76}, { 49, 68}, { 46, 31}, { 49, 186}, + { 97, 78}, {110, 74}, { 72, 72}, { 44, 60}, { 33, 30}, { 69, 131}, + { 61, 61}, { 69, 63}, { 51, 57}, { 31, 48}, { 26, 27}, { 64, 89}, + { 67, 23}, { 51, 32}, { 36, 33}, { 26, 28}, { 20, 12}, { 44, 68}, + { 26, 197}, { 41, 189}, { 61, 129}, { 28, 103}, { 49, 52}, {-12, 245} }, + { {102, 141}, { 79, 166}, { 72, 162}, { 97, 125}, {179, 4}, {307, 0}, + { 72, 168}, { 69, 175}, { 84, 160}, {105, 127}, {148, 34}, {310, 0}, + { 84, 151}, { 82, 161}, { 87, 153}, { 87, 135}, {115, 51}, {317, 0}, + { 97, 125}, {102, 131}, {105, 125}, { 87, 122}, { 84, 64}, { 54, 184}, + {166, 18}, {146, 43}, {125, 51}, { 90, 64}, { 95, 7}, { 38, 154}, + {294, 0}, { 13, 225}, { 10, 225}, { 67, 168}, { 0, 167}, {161, 94} }, + { {172, 76}, {172, 75}, {136, 80}, { 64, 98}, { 74, 67}, {315, 0}, + {169, 76}, {207, 56}, {164, 66}, { 97, 80}, { 67, 72}, {328, 0}, + {136, 80}, {187, 53}, {154, 62}, { 72, 85}, { -2, 105}, {305, 0}, + { 74, 91}, {128, 64}, {113, 64}, { 61, 77}, { 41, 75}, {259, 0}, + { 46, 84}, { 51, 81}, { 28, 89}, { 31, 78}, { 23, 77}, {202, 0}, + {323, 0}, {323, 0}, {300, 0}, {236, 0}, {195, 0}, {328, 0} }, +}; + +static const int16_t vp5_ract_lc[3][3][5][6][2] = { + { { { {276, 0}, {238, 0}, {195, 0}, {156, 0}, {113, 0}, {274, 0} }, + { { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1} }, + { {192, 59}, {182, 50}, {141, 48}, {110, 40}, { 92, 19}, {125,128} }, + { {169, 87}, {169, 83}, {184, 62}, {220, 16}, {184, 0}, {264, 0} }, + { {212, 40}, {212, 36}, {169, 49}, {174, 27}, { 8,120}, {182, 71} } }, + { { {259, 10}, {197, 19}, {143, 22}, {123, 16}, {110, 8}, {133, 88} }, + { { 0, 1}, {256, 0}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1} }, + { {207, 46}, {187, 50}, { 97, 83}, { 23,100}, { 41, 56}, { 56,188} }, + { {166, 90}, {146,108}, {161, 88}, {136, 95}, {174, 0}, {266, 0} }, + { {264, 7}, {243, 18}, {184, 43}, {-14,154}, { 20,112}, { 20,199} } }, + { { {230, 26}, {197, 22}, {159, 20}, {146, 12}, {136, 4}, { 54,162} }, + { { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1} }, + { {192, 59}, {156, 72}, { 84,101}, { 49,101}, { 79, 47}, { 79,167} }, + { {138,115}, {136,116}, {166, 80}, {238, 0}, {195, 0}, {261, 0} }, + { {225, 33}, {205, 42}, {159, 61}, { 79, 96}, { 92, 66}, { 28,195} } }, + }, { + { { {200, 37}, {197, 18}, {159, 13}, {143, 7}, {102, 5}, {123,126} }, + { {197, 3}, {220, -9}, {210,-12}, {187, -6}, {151, -2}, {174, 80} }, + { {200, 53}, {187, 47}, {159, 40}, {118, 38}, {100, 18}, {141,111} }, + { {179, 78}, {166, 86}, {197, 50}, {207, 27}, {187, 0}, {115,139} }, + { {218, 34}, {220, 29}, {174, 46}, {128, 61}, { 54, 89}, {187, 65} } }, + { { {238, 14}, {197, 18}, {125, 26}, { 90, 25}, { 82, 13}, {161, 86} }, + { {189, 1}, {205, -2}, {156, -4}, {143, -4}, {146, -4}, {172, 72} }, + { {230, 31}, {192, 45}, {102, 76}, { 38, 85}, { 56, 41}, { 64,173} }, + { {166, 91}, {141,111}, {128,116}, {118,109}, {177, 0}, { 23,222} }, + { {253, 14}, {236, 21}, {174, 49}, { 33,118}, { 44, 93}, { 23,187} } }, + { { {218, 28}, {179, 28}, {118, 35}, { 95, 30}, { 72, 24}, {128,108} }, + { {187, 1}, {174, -1}, {125, -1}, {110, -1}, {108, -1}, {202, 52} }, + { {197, 53}, {146, 75}, { 46,118}, { 33,103}, { 64, 50}, {118,126} }, + { {138,114}, {128,122}, {161, 86}, {243, -6}, {195, 0}, { 38,210} }, + { {215, 39}, {179, 58}, { 97,101}, { 95, 85}, { 87, 70}, { 69,152} } }, + }, { + { { {236, 24}, {205, 18}, {172, 12}, {154, 6}, {125, 1}, {169, 75} }, + { {187, 4}, {230, -2}, {228, -4}, {236, -4}, {241, -2}, {192, 66} }, + { {200, 46}, {187, 42}, {159, 34}, {136, 25}, {105, 10}, {179, 62} }, + { {207, 55}, {192, 63}, {192, 54}, {195, 36}, {177, 1}, {143, 98} }, + { {225, 27}, {207, 34}, {200, 30}, {131, 57}, { 97, 60}, {197, 45} } }, + { { {271, 8}, {218, 13}, {133, 19}, { 90, 19}, { 72, 7}, {182, 51} }, + { {179, 1}, {225, -1}, {154, -2}, {110, -1}, { 92, 0}, {195, 41} }, + { {241, 26}, {189, 40}, { 82, 64}, { 33, 60}, { 67, 17}, {120, 94} }, + { {192, 68}, {151, 94}, {146, 90}, {143, 72}, {161, 0}, {113,128} }, + { {256, 12}, {218, 29}, {166, 48}, { 44, 99}, { 31, 87}, {148, 78} } }, + { { {238, 20}, {184, 22}, {113, 27}, { 90, 22}, { 74, 9}, {192, 37} }, + { {184, 0}, {215, -1}, {141, -1}, { 97, 0}, { 49, 0}, {264, 13} }, + { {182, 51}, {138, 61}, { 95, 63}, { 54, 59}, { 64, 25}, {200, 45} }, + { {179, 75}, {156, 87}, {174, 65}, {177, 44}, {174, 0}, {164, 85} }, + { {195, 45}, {148, 65}, {105, 79}, { 95, 72}, { 87, 60}, {169, 63} } }, + } +}; + +static const uint8_t vp5_coord_div[] = { 2, 2, 2, 2, 4, 4 }; + +#endif /* VP5DATA_H */ diff --git a/src/libffmpeg/libavcodec/vp6.c b/src/libffmpeg/libavcodec/vp6.c new file mode 100644 index 000000000..381fcc8ee --- /dev/null +++ b/src/libffmpeg/libavcodec/vp6.c @@ -0,0 +1,537 @@ +/** + * @file vp6.c + * VP6 compatible video decoder + * + * Copyright (C) 2006 Aurelien Jacobs + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * + * The VP6F decoder accept an optional 1 byte extradata. It is composed of: + * - upper 4bits: difference between encoded width and visible width + * - lower 4bits: difference between encoded height and visible height + */ + +#include + +#include "avcodec.h" +#include "dsputil.h" +#include "bitstream.h" +#include "mpegvideo.h" + +#include "vp56.h" +#include "vp56data.h" +#include "vp6data.h" + + +static int vp6_parse_header(vp56_context_t *s, uint8_t *buf, int buf_size, + int *golden_frame) +{ + vp56_range_coder_t *c = &s->c; + int parse_filter_info = 0; + int vrt_shift = 0; + int sub_version; + int rows, cols; + int res = 1; + + if (buf[0] & 1) + return 0; + + s->frames[VP56_FRAME_CURRENT].key_frame = !(buf[0] & 0x80); + vp56_init_dequant(s, (buf[0] >> 1) & 0x3F); + + if (s->frames[VP56_FRAME_CURRENT].key_frame) { + sub_version = buf[1] >> 3; + if (sub_version > 8) + return 0; + if ((buf[1] & 0x06) != 0x06) + return 0; + if (buf[1] & 1) { + av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n"); + return 0; + } + + rows = buf[2]; /* number of stored macroblock rows */ + cols = buf[3]; /* number of stored macroblock cols */ + /* buf[4] is number of displayed macroblock rows */ + /* buf[5] is number of displayed macroblock cols */ + + if (16*cols != s->avctx->coded_width || + 16*rows != s->avctx->coded_height) { + avcodec_set_dimensions(s->avctx, 16*cols, 16*rows); + if (s->avctx->extradata_size == 1) { + s->avctx->width -= s->avctx->extradata[0] >> 4; + s->avctx->height -= s->avctx->extradata[0] & 0x0F; + } + res = 2; + } + + vp56_init_range_decoder(c, buf+6, buf_size-6); + vp56_rac_gets(c, 2); + + parse_filter_info = 1; + if (sub_version < 8) + vrt_shift = 5; + s->sub_version = sub_version; + } else { + if (!s->sub_version) + return 0; + + vp56_init_range_decoder(c, buf+1, buf_size-1); + + *golden_frame = vp56_rac_get(c); + s->deblock_filtering = vp56_rac_get(c); + if (s->deblock_filtering) + vp56_rac_get(c); + if (s->sub_version > 7) + parse_filter_info = vp56_rac_get(c); + } + + if (parse_filter_info) { + if (vp56_rac_get(c)) { + s->filter_mode = 2; + s->sample_variance_threshold = vp56_rac_gets(c, 5) << vrt_shift; + s->max_vector_length = 2 << vp56_rac_gets(c, 3); + } else if (vp56_rac_get(c)) { + s->filter_mode = 1; + } else { + s->filter_mode = 0; + } + if (s->sub_version > 7) + s->filter_selection = vp56_rac_gets(c, 4); + else + s->filter_selection = 16; + } + + vp56_rac_get(c); + return res; +} + +static void vp6_coeff_order_table_init(vp56_context_t *s) +{ + int i, pos, idx = 1; + + s->coeff_index_to_pos[0] = 0; + for (i=0; i<16; i++) + for (pos=1; pos<64; pos++) + if (s->coeff_reorder[pos] == i) + s->coeff_index_to_pos[idx++] = pos; +} + +static void vp6_default_models_init(vp56_context_t *s) +{ + s->vector_model_dct[0] = 0xA2; + s->vector_model_dct[1] = 0xA4; + s->vector_model_sig[0] = 0x80; + s->vector_model_sig[1] = 0x80; + + memcpy(s->mb_types_stats, vp56_def_mb_types_stats, sizeof(s->mb_types_stats)); + memcpy(s->vector_model_fdv, vp6_def_fdv_vector_model, sizeof(s->vector_model_fdv)); + memcpy(s->vector_model_pdv, vp6_def_pdv_vector_model, sizeof(s->vector_model_pdv)); + memcpy(s->coeff_model_runv, vp6_def_runv_coeff_model, sizeof(s->coeff_model_runv)); + memcpy(s->coeff_reorder, vp6_def_coeff_reorder, sizeof(s->coeff_reorder)); + + vp6_coeff_order_table_init(s); +} + +static void vp6_parse_vector_models(vp56_context_t *s) +{ + vp56_range_coder_t *c = &s->c; + int comp, node; + + for (comp=0; comp<2; comp++) { + if (vp56_rac_get_prob(c, vp6_sig_dct_pct[comp][0])) + s->vector_model_dct[comp] = vp56_rac_gets_nn(c, 7); + if (vp56_rac_get_prob(c, vp6_sig_dct_pct[comp][1])) + s->vector_model_sig[comp] = vp56_rac_gets_nn(c, 7); + } + + for (comp=0; comp<2; comp++) + for (node=0; node<7; node++) + if (vp56_rac_get_prob(c, vp6_pdv_pct[comp][node])) + s->vector_model_pdv[comp][node] = vp56_rac_gets_nn(c, 7); + + for (comp=0; comp<2; comp++) + for (node=0; node<8; node++) + if (vp56_rac_get_prob(c, vp6_fdv_pct[comp][node])) + s->vector_model_fdv[comp][node] = vp56_rac_gets_nn(c, 7); +} + +static void vp6_parse_coeff_models(vp56_context_t *s) +{ + vp56_range_coder_t *c = &s->c; + int def_prob[11]; + int node, cg, ctx, pos; + int ct; /* code type */ + int pt; /* plane type (0 for Y, 1 for U or V) */ + + memset(def_prob, 0x80, sizeof(def_prob)); + + for (pt=0; pt<2; pt++) + for (node=0; node<11; node++) + if (vp56_rac_get_prob(c, vp6_dccv_pct[pt][node])) { + def_prob[node] = vp56_rac_gets_nn(c, 7); + s->coeff_model_dccv[pt][node] = def_prob[node]; + } else if (s->frames[VP56_FRAME_CURRENT].key_frame) { + s->coeff_model_dccv[pt][node] = def_prob[node]; + } + + if (vp56_rac_get(c)) { + for (pos=1; pos<64; pos++) + if (vp56_rac_get_prob(c, vp6_coeff_reorder_pct[pos])) + s->coeff_reorder[pos] = vp56_rac_gets(c, 4); + vp6_coeff_order_table_init(s); + } + + for (cg=0; cg<2; cg++) + for (node=0; node<14; node++) + if (vp56_rac_get_prob(c, vp6_runv_pct[cg][node])) + s->coeff_model_runv[cg][node] = vp56_rac_gets_nn(c, 7); + + for (ct=0; ct<3; ct++) + for (pt=0; pt<2; pt++) + for (cg=0; cg<6; cg++) + for (node=0; node<11; node++) + if (vp56_rac_get_prob(c, vp6_ract_pct[ct][pt][cg][node])) { + def_prob[node] = vp56_rac_gets_nn(c, 7); + s->coeff_model_ract[pt][ct][cg][node] = def_prob[node]; + } else if (s->frames[VP56_FRAME_CURRENT].key_frame) { + s->coeff_model_ract[pt][ct][cg][node] = def_prob[node]; + } + + /* coeff_model_dcct is a linear combination of coeff_model_dccv */ + for (pt=0; pt<2; pt++) + for (ctx=0; ctx<3; ctx++) + for (node=0; node<5; node++) + s->coeff_model_dcct[pt][ctx][node] = clip(((s->coeff_model_dccv[pt][node] * vp6_dccv_lc[ctx][node][0] + 128) >> 8) + vp6_dccv_lc[ctx][node][1], 1, 255); +} + +static void vp6_parse_vector_adjustment(vp56_context_t *s, vp56_mv_t *vect) +{ + vp56_range_coder_t *c = &s->c; + int comp; + + *vect = (vp56_mv_t) {0,0}; + if (s->vector_candidate_pos < 2) + *vect = s->vector_candidate[0]; + + for (comp=0; comp<2; comp++) { + int i, delta = 0; + + if (vp56_rac_get_prob(c, s->vector_model_dct[comp])) { + static const uint8_t prob_order[] = {0, 1, 2, 7, 6, 5, 4}; + for (i=0; ivector_model_fdv[comp][j])<vector_model_fdv[comp][3])<<3; + else + delta |= 8; + } else { + delta = vp56_rac_get_tree(c, vp56_pva_tree, + s->vector_model_pdv[comp]); + } + + if (delta && vp56_rac_get_prob(c, s->vector_model_sig[comp])) + delta = -delta; + + if (!comp) + vect->x += delta; + else + vect->y += delta; + } +} + +static void vp6_parse_coeff(vp56_context_t *s) +{ + vp56_range_coder_t *c = &s->c; + uint8_t *permute = s->scantable.permutated; + uint8_t *model, *model2, *model3; + int coeff, sign, coeff_idx; + int b, i, cg, idx, ctx; + int pt = 0; /* plane type (0 for Y, 1 for U or V) */ + + for (b=0; b<6; b++) { + int ct = 1; /* code type */ + int run = 1; + + if (b > 3) pt = 1; + + ctx = s->left_block[vp56_b6to4[b]].not_null_dc + + s->above_blocks[s->above_block_idx[b]].not_null_dc; + model = s->coeff_model_dccv[pt]; + model2 = s->coeff_model_dcct[pt][ctx]; + + for (coeff_idx=0; coeff_idx<64; ) { + if ((coeff_idx>1 && ct==0) || vp56_rac_get_prob(c, model2[0])) { + /* parse a coeff */ + if (coeff_idx == 0) { + s->left_block[vp56_b6to4[b]].not_null_dc = 1; + s->above_blocks[s->above_block_idx[b]].not_null_dc = 1; + } + + if (vp56_rac_get_prob(c, model2[2])) { + if (vp56_rac_get_prob(c, model2[3])) { + idx = vp56_rac_get_tree(c, vp56_pc_tree, model); + coeff = vp56_coeff_bias[idx]; + for (i=vp56_coeff_bit_length[idx]; i>=0; i--) + coeff += vp56_rac_get_prob(c, vp56_coeff_parse_table[idx][i]) << i; + } else { + if (vp56_rac_get_prob(c, model2[4])) + coeff = 3 + vp56_rac_get_prob(c, model[5]); + else + coeff = 2; + } + ct = 2; + } else { + ct = 1; + coeff = 1; + } + sign = vp56_rac_get(c); + coeff = (coeff ^ -sign) + sign; + if (coeff_idx) + coeff *= s->dequant_ac; + idx = s->coeff_index_to_pos[coeff_idx]; + s->block_coeff[b][permute[idx]] = coeff; + run = 1; + } else { + /* parse a run */ + ct = 0; + if (coeff_idx == 0) { + s->left_block[vp56_b6to4[b]].not_null_dc = 0; + s->above_blocks[s->above_block_idx[b]].not_null_dc = 0; + } else { + if (!vp56_rac_get_prob(c, model2[1])) + break; + + model3 = s->coeff_model_runv[coeff_idx >= 6]; + run = vp56_rac_get_tree(c, vp6_pcr_tree, model3); + if (!run) + for (run=9, i=0; i<6; i++) + run += vp56_rac_get_prob(c, model3[i+8]) << i; + } + } + + cg = vp6_coeff_groups[coeff_idx+=run]; + model = model2 = s->coeff_model_ract[pt][ct][cg]; + } + } +} + +static int vp6_adjust(int v, int t) +{ + int V = v, s = v >> 31; + V ^= s; + V -= s; + if (V-t-1 >= (unsigned)(t-1)) + return v; + V = 2*t - V; + V += s; + V ^= s; + return V; +} + +static int vp6_block_variance(uint8_t *src, int stride) +{ + int sum = 0, square_sum = 0; + int y, x; + + for (y=0; y<8; y+=2) { + for (x=0; x<8; x+=2) { + sum += src[x]; + square_sum += src[x]*src[x]; + } + src += 2*stride; + } + return (16*square_sum - sum*sum) >> 8; +} + +static void vp6_filter_hv2(vp56_context_t *s, uint8_t *dst, uint8_t *src, + int stride, int delta, int16_t weight) +{ + s->dsp.put_pixels_tab[1][0](dst, src, stride, 8); + s->dsp.biweight_h264_pixels_tab[3](dst, src+delta, stride, 2, + 8-weight, weight, 0); +} + +static void vp6_filter_hv4(uint8_t *dst, uint8_t *src, int stride, + int delta, const int16_t *weights) +{ + int x, y; + + for (y=0; y<8; y++) { + for (x=0; x<8; x++) { + dst[x] = clip_uint8(( src[x-delta ] * weights[0] + + src[x ] * weights[1] + + src[x+delta ] * weights[2] + + src[x+2*delta] * weights[3] + 64) >> 7); + } + src += stride; + dst += stride; + } +} + +static void vp6_filter_diag2(vp56_context_t *s, uint8_t *dst, uint8_t *src, + int stride, int h_weight, int v_weight) +{ + uint8_t *tmp = s->edge_emu_buffer+16; + int x, xmax; + + s->dsp.put_pixels_tab[1][0](tmp, src, stride, 8); + s->dsp.biweight_h264_pixels_tab[3](tmp, src+1, stride, 2, + 8-h_weight, h_weight, 0); + /* we need a 8x9 block to do vertical filter, so compute one more line */ + for (x=8*stride, xmax=x+8; x> 3; + + s->dsp.put_pixels_tab[1][0](dst, tmp, stride, 8); + s->dsp.biweight_h264_pixels_tab[3](dst, tmp+stride, stride, 2, + 8-v_weight, v_weight, 0); +} + +static void vp6_filter_diag4(uint8_t *dst, uint8_t *src, int stride, + const int16_t *h_weights,const int16_t *v_weights) +{ + int x, y; + int tmp[8*11]; + int *t = tmp; + + src -= stride; + + for (y=0; y<11; y++) { + for (x=0; x<8; x++) { + t[x] = clip_uint8(( src[x-1] * h_weights[0] + + src[x ] * h_weights[1] + + src[x+1] * h_weights[2] + + src[x+2] * h_weights[3] + 64) >> 7); + } + src += stride; + t += 8; + } + + t = tmp + 8; + for (y=0; y<8; y++) { + for (x=0; x<8; x++) { + dst[x] = clip_uint8(( t[x-8 ] * v_weights[0] + + t[x ] * v_weights[1] + + t[x+8 ] * v_weights[2] + + t[x+16] * v_weights[3] + 64) >> 7); + } + dst += stride; + t += 8; + } +} + +static void vp6_filter(vp56_context_t *s, uint8_t *dst, uint8_t *src, + int offset1, int offset2, int stride, + vp56_mv_t mv, int mask, int select, int luma) +{ + int filter4 = 0; + int x8 = mv.x & mask; + int y8 = mv.y & mask; + + if (luma) { + x8 *= 2; + y8 *= 2; + filter4 = s->filter_mode; + if (filter4 == 2) { + if (s->max_vector_length && + (FFABS(mv.x) > s->max_vector_length || + FFABS(mv.y) > s->max_vector_length)) { + filter4 = 0; + } else if (s->sample_variance_threshold + && (vp6_block_variance(src+offset1, stride) + < s->sample_variance_threshold)) { + filter4 = 0; + } + } + } + + if ((y8 && (offset2-offset1)*s->flip<0) || (!y8 && offset1 > offset2)) { + offset1 = offset2; + } + + if (filter4) { + if (!y8) { /* left or right combine */ + vp6_filter_hv4(dst, src+offset1, stride, 1, + vp6_block_copy_filter[select][x8]); + } else if (!x8) { /* above or below combine */ + vp6_filter_hv4(dst, src+offset1, stride, stride, + vp6_block_copy_filter[select][y8]); + } else if ((mv.x^mv.y) >> 31) { /* lower-left or upper-right combine */ + vp6_filter_diag4(dst, src+offset1-1, stride, + vp6_block_copy_filter[select][x8], + vp6_block_copy_filter[select][y8]); + } else { /* lower-right or upper-left combine */ + vp6_filter_diag4(dst, src+offset1, stride, + vp6_block_copy_filter[select][x8], + vp6_block_copy_filter[select][y8]); + } + } else { + if (!y8) { /* left or right combine */ + vp6_filter_hv2(s, dst, src+offset1, stride, 1, x8); + } else if (!x8) { /* above or below combine */ + vp6_filter_hv2(s, dst, src+offset1, stride, stride, y8); + } else if ((mv.x^mv.y) >> 31) { /* lower-left or upper-right combine */ + vp6_filter_diag2(s, dst, src+offset1-1, stride, x8, y8); + } else { /* lower-right or upper-left combine */ + vp6_filter_diag2(s, dst, src+offset1, stride, x8, y8); + } + } +} + +static int vp6_decode_init(AVCodecContext *avctx) +{ + vp56_context_t *s = avctx->priv_data; + + vp56_init(s, avctx, avctx->codec->id == CODEC_ID_VP6); + s->vp56_coord_div = vp6_coord_div; + s->parse_vector_adjustment = vp6_parse_vector_adjustment; + s->adjust = vp6_adjust; + s->filter = vp6_filter; + s->parse_coeff = vp6_parse_coeff; + s->default_models_init = vp6_default_models_init; + s->parse_vector_models = vp6_parse_vector_models; + s->parse_coeff_models = vp6_parse_coeff_models; + s->parse_header = vp6_parse_header; + + return 0; +} + +AVCodec vp6_decoder = { + "vp6", + CODEC_TYPE_VIDEO, + CODEC_ID_VP6, + sizeof(vp56_context_t), + vp6_decode_init, + NULL, + vp56_free, + vp56_decode_frame, +}; + +/* flash version, not flipped upside-down */ +AVCodec vp6f_decoder = { + "vp6f", + CODEC_TYPE_VIDEO, + CODEC_ID_VP6F, + sizeof(vp56_context_t), + vp6_decode_init, + NULL, + vp56_free, + vp56_decode_frame, +}; diff --git a/src/libffmpeg/libavcodec/vp6data.h b/src/libffmpeg/libavcodec/vp6data.h new file mode 100644 index 000000000..0545a9d66 --- /dev/null +++ b/src/libffmpeg/libavcodec/vp6data.h @@ -0,0 +1,300 @@ +/** + * @file vp6data.h + * VP6 compatible video decoder + * + * Copyright (C) 2006 Aurelien Jacobs + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef VP6DATA_H +#define VP6DATA_H + +#include "vp56data.h" + +static const uint8_t vp6_def_fdv_vector_model[2][8] = { + { 247, 210, 135, 68, 138, 220, 239, 246 }, + { 244, 184, 201, 44, 173, 221, 239, 253 }, +}; + +static const uint8_t vp6_def_pdv_vector_model[2][7] = { + { 225, 146, 172, 147, 214, 39, 156 }, + { 204, 170, 119, 235, 140, 230, 228 }, +}; + +static const uint8_t vp6_def_coeff_reorder[] = { + 0, 0, 1, 1, 1, 2, 2, 2, + 2, 2, 2, 3, 3, 4, 4, 4, + 5, 5, 5, 5, 6, 6, 7, 7, + 7, 7, 7, 8, 8, 9, 9, 9, + 9, 9, 9, 10, 10, 11, 11, 11, + 11, 11, 11, 12, 12, 12, 12, 12, + 12, 13, 13, 13, 13, 13, 14, 14, + 14, 14, 15, 15, 15, 15, 15, 15, +}; + +static const uint8_t vp6_def_runv_coeff_model[2][14] = { + { 198, 197, 196, 146, 198, 204, 169, 142, 130, 136, 149, 149, 191, 249 }, + { 135, 201, 181, 154, 98, 117, 132, 126, 146, 169, 184, 240, 246, 254 }, +}; + +static const uint8_t vp6_sig_dct_pct[2][2] = { + { 237, 246 }, + { 231, 243 }, +}; + +static const uint8_t vp6_pdv_pct[2][7] = { + { 253, 253, 254, 254, 254, 254, 254 }, + { 245, 253, 254, 254, 254, 254, 254 }, +}; + +static const uint8_t vp6_fdv_pct[2][8] = { + { 254, 254, 254, 254, 254, 250, 250, 252 }, + { 254, 254, 254, 254, 254, 251, 251, 254 }, +}; + +static const uint8_t vp6_dccv_pct[2][11] = { + { 146, 255, 181, 207, 232, 243, 238, 251, 244, 250, 249 }, + { 179, 255, 214, 240, 250, 255, 244, 255, 255, 255, 255 }, +}; + +static const uint8_t vp6_coeff_reorder_pct[] = { + 255, 132, 132, 159, 153, 151, 161, 170, + 164, 162, 136, 110, 103, 114, 129, 118, + 124, 125, 132, 136, 114, 110, 142, 135, + 134, 123, 143, 126, 153, 183, 166, 161, + 171, 180, 179, 164, 203, 218, 225, 217, + 215, 206, 203, 217, 229, 241, 248, 243, + 253, 255, 253, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, +}; + +static const uint8_t vp6_runv_pct[2][14] = { + { 219, 246, 238, 249, 232, 239, 249, 255, 248, 253, 239, 244, 241, 248 }, + { 198, 232, 251, 253, 219, 241, 253, 255, 248, 249, 244, 238, 251, 255 }, +}; + +static const uint8_t vp6_ract_pct[3][2][6][11] = { + { { { 227, 246, 230, 247, 244, 255, 255, 255, 255, 255, 255 }, + { 255, 255, 209, 231, 231, 249, 249, 253, 255, 255, 255 }, + { 255, 255, 225, 242, 241, 251, 253, 255, 255, 255, 255 }, + { 255, 255, 241, 253, 252, 255, 255, 255, 255, 255, 255 }, + { 255, 255, 248, 255, 255, 255, 255, 255, 255, 255, 255 }, + { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } }, + { { 240, 255, 248, 255, 255, 255, 255, 255, 255, 255, 255 }, + { 255, 255, 240, 253, 255, 255, 255, 255, 255, 255, 255 }, + { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, + { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, + { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, + { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } } }, + { { { 206, 203, 227, 239, 247, 255, 253, 255, 255, 255, 255 }, + { 207, 199, 220, 236, 243, 252, 252, 255, 255, 255, 255 }, + { 212, 219, 230, 243, 244, 253, 252, 255, 255, 255, 255 }, + { 236, 237, 247, 252, 253, 255, 255, 255, 255, 255, 255 }, + { 240, 240, 248, 255, 255, 255, 255, 255, 255, 255, 255 }, + { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } }, + { { 230, 233, 249, 255, 255, 255, 255, 255, 255, 255, 255 }, + { 238, 238, 250, 255, 255, 255, 255, 255, 255, 255, 255 }, + { 248, 251, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, + { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, + { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, + { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } } }, + { { { 225, 239, 227, 231, 244, 253, 243, 255, 255, 253, 255 }, + { 232, 234, 224, 228, 242, 249, 242, 252, 251, 251, 255 }, + { 235, 249, 238, 240, 251, 255, 249, 255, 253, 253, 255 }, + { 249, 253, 251, 250, 255, 255, 255, 255, 255, 255, 255 }, + { 251, 250, 249, 255, 255, 255, 255, 255, 255, 255, 255 }, + { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } }, + { { 243, 244, 250, 250, 255, 255, 255, 255, 255, 255, 255 }, + { 249, 248, 250, 253, 255, 255, 255, 255, 255, 255, 255 }, + { 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, + { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, + { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, + { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } } } +}; + +static const int vp6_dccv_lc[3][5][2] = { + { { 122, 133 }, { 0, 1 }, { 78, 171 }, { 139, 117 }, { 168, 79 } }, + { { 133, 51 }, { 0, 1 }, { 169, 71 }, { 214, 44 }, { 210, 38 } }, + { { 142, -16 }, { 0, 1 }, { 221, -30 }, { 246, -3 }, { 203, 17 } }, +}; + +static const uint8_t vp6_coeff_groups[] = { + 0, 0, 1, 1, 1, 2, 2, 2, + 2, 2, 2, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, +}; + +static const int16_t vp6_block_copy_filter[17][8][4] = { + { { 0, 128, 0, 0 }, /* 0 */ + { -3, 122, 9, 0 }, + { -4, 109, 24, -1 }, + { -5, 91, 45, -3 }, + { -4, 68, 68, -4 }, + { -3, 45, 91, -5 }, + { -1, 24, 109, -4 }, + { 0, 9, 122, -3 } }, + { { 0, 128, 0, 0 }, /* 1 */ + { -4, 124, 9, -1 }, + { -5, 110, 25, -2 }, + { -6, 91, 46, -3 }, + { -5, 69, 69, -5 }, + { -3, 46, 91, -6 }, + { -2, 25, 110, -5 }, + { -1, 9, 124, -4 } }, + { { 0, 128, 0, 0 }, /* 2 */ + { -4, 123, 10, -1 }, + { -6, 110, 26, -2 }, + { -7, 92, 47, -4 }, + { -6, 70, 70, -6 }, + { -4, 47, 92, -7 }, + { -2, 26, 110, -6 }, + { -1, 10, 123, -4 } }, + { { 0, 128, 0, 0 }, /* 3 */ + { -5, 124, 10, -1 }, + { -7, 110, 27, -2 }, + { -7, 91, 48, -4 }, + { -6, 70, 70, -6 }, + { -4, 48, 92, -8 }, + { -2, 27, 110, -7 }, + { -1, 10, 124, -5 } }, + { { 0, 128, 0, 0 }, /* 4 */ + { -6, 124, 11, -1 }, + { -8, 111, 28, -3 }, + { -8, 92, 49, -5 }, + { -7, 71, 71, -7 }, + { -5, 49, 92, -8 }, + { -3, 28, 111, -8 }, + { -1, 11, 124, -6 } }, + { { 0, 128, 0, 0 }, /* 5 */ + { -6, 123, 12, -1 }, + { -9, 111, 29, -3 }, + { -9, 93, 50, -6 }, + { -8, 72, 72, -8 }, + { -6, 50, 93, -9 }, + { -3, 29, 111, -9 }, + { -1, 12, 123, -6 } }, + { { 0, 128, 0, 0 }, /* 6 */ + { -7, 124, 12, -1 }, + { -10, 111, 30, -3 }, + { -10, 93, 51, -6 }, + { -9, 73, 73, -9 }, + { -6, 51, 93, -10 }, + { -3, 30, 111, -10 }, + { -1, 12, 124, -7 } }, + { { 0, 128, 0, 0 }, /* 7 */ + { -7, 123, 13, -1 }, + { -11, 112, 31, -4 }, + { -11, 94, 52, -7 }, + { -10, 74, 74, -10 }, + { -7, 52, 94, -11 }, + { -4, 31, 112, -11 }, + { -1, 13, 123, -7 } }, + { { 0, 128, 0, 0 }, /* 8 */ + { -8, 124, 13, -1 }, + { -12, 112, 32, -4 }, + { -12, 94, 53, -7 }, + { -10, 74, 74, -10 }, + { -7, 53, 94, -12 }, + { -4, 32, 112, -12 }, + { -1, 13, 124, -8 } }, + { { 0, 128, 0, 0 }, /* 9 */ + { -9, 124, 14, -1 }, + { -13, 112, 33, -4 }, + { -13, 95, 54, -8 }, + { -11, 75, 75, -11 }, + { -8, 54, 95, -13 }, + { -4, 33, 112, -13 }, + { -1, 14, 124, -9 } }, + { { 0, 128, 0, 0 }, /* 10 */ + { -9, 123, 15, -1 }, + { -14, 113, 34, -5 }, + { -14, 95, 55, -8 }, + { -12, 76, 76, -12 }, + { -8, 55, 95, -14 }, + { -5, 34, 112, -13 }, + { -1, 15, 123, -9 } }, + { { 0, 128, 0, 0 }, /* 11 */ + { -10, 124, 15, -1 }, + { -14, 113, 34, -5 }, + { -15, 96, 56, -9 }, + { -13, 77, 77, -13 }, + { -9, 56, 96, -15 }, + { -5, 34, 113, -14 }, + { -1, 15, 124, -10 } }, + { { 0, 128, 0, 0 }, /* 12 */ + { -10, 123, 16, -1 }, + { -15, 113, 35, -5 }, + { -16, 98, 56, -10 }, + { -14, 78, 78, -14 }, + { -10, 56, 98, -16 }, + { -5, 35, 113, -15 }, + { -1, 16, 123, -10 } }, + { { 0, 128, 0, 0 }, /* 13 */ + { -11, 124, 17, -2 }, + { -16, 113, 36, -5 }, + { -17, 98, 57, -10 }, + { -14, 78, 78, -14 }, + { -10, 57, 98, -17 }, + { -5, 36, 113, -16 }, + { -2, 17, 124, -11 } }, + { { 0, 128, 0, 0 }, /* 14 */ + { -12, 125, 17, -2 }, + { -17, 114, 37, -6 }, + { -18, 99, 58, -11 }, + { -15, 79, 79, -15 }, + { -11, 58, 99, -18 }, + { -6, 37, 114, -17 }, + { -2, 17, 125, -12 } }, + { { 0, 128, 0, 0 }, /* 15 */ + { -12, 124, 18, -2 }, + { -18, 114, 38, -6 }, + { -19, 99, 59, -11 }, + { -16, 80, 80, -16 }, + { -11, 59, 99, -19 }, + { -6, 38, 114, -18 }, + { -2, 18, 124, -12 } }, + { { 0, 128, 0, 0 }, /* 16 */ + { -4, 118, 16, -2 }, + { -7, 106, 34, -5 }, + { -8, 90, 53, -7 }, + { -8, 72, 72, -8 }, + { -7, 53, 90, -8 }, + { -5, 34, 106, -7 }, + { -2, 16, 118, -4 } }, +}; + +static const vp56_tree_t vp6_pcr_tree[] = { + { 8, 0}, + { 4, 1}, + { 2, 2}, {-1}, {-2}, + { 2, 3}, {-3}, {-4}, + { 8, 4}, + { 4, 5}, + { 2, 6}, {-5}, {-6}, + { 2, 7}, {-7}, {-8}, + {-0}, +}; + +static const uint8_t vp6_coord_div[] = { 4, 4, 4, 4, 8, 8 }; + +#endif /* VP6DATA_H */ diff --git a/src/libffmpeg/libavcodec/wmadec.c b/src/libffmpeg/libavcodec/wmadec.c index 684aea2c8..bbf4970ce 100644 --- a/src/libffmpeg/libavcodec/wmadec.c +++ b/src/libffmpeg/libavcodec/wmadec.c @@ -115,6 +115,8 @@ typedef struct WMADecodeContext { float max_exponent[MAX_CHANNELS]; int16_t coefs1[MAX_CHANNELS][BLOCK_MAX_SIZE]; DECLARE_ALIGNED_16(float, coefs[MAX_CHANNELS][BLOCK_MAX_SIZE]); + DECLARE_ALIGNED_16(FFTSample, output[BLOCK_MAX_SIZE * 2]); + DECLARE_ALIGNED_16(float, window[BLOCK_MAX_SIZE * 2]); MDCTContext mdct_ctx[BLOCK_NB_SIZES]; float *windows[BLOCK_NB_SIZES]; DECLARE_ALIGNED_16(FFTSample, mdct_tmp[BLOCK_MAX_SIZE]); /* temporary storage for imdct */ @@ -717,7 +719,6 @@ static int wma_decode_block(WMADecodeContext *s) { int n, v, a, ch, code, bsize; int coef_nb_bits, total_gain, parse_exponents; - DECLARE_ALIGNED_16(float, window[BLOCK_MAX_SIZE * 2]); int nb_coefs[MAX_CHANNELS]; float mdct_norm; @@ -1072,7 +1073,7 @@ static int wma_decode_block(WMADecodeContext *s) next_block_len = 1 << s->next_block_len_bits; /* right part */ - wptr = window + block_len; + wptr = s->window + block_len; if (block_len <= next_block_len) { for(i=0;iwindows[bsize][i]; @@ -1088,7 +1089,7 @@ static int wma_decode_block(WMADecodeContext *s) } /* left part */ - wptr = window + block_len; + wptr = s->window + block_len; if (block_len <= prev_block_len) { for(i=0;iwindows[bsize][i]; @@ -1107,14 +1108,13 @@ static int wma_decode_block(WMADecodeContext *s) for(ch = 0; ch < s->nb_channels; ch++) { if (s->channel_coded[ch]) { - DECLARE_ALIGNED_16(FFTSample, output[BLOCK_MAX_SIZE * 2]); float *ptr; int n4, index, n; n = s->block_len; n4 = s->block_len / 2; s->mdct_ctx[bsize].fft.imdct_calc(&s->mdct_ctx[bsize], - output, s->coefs[ch], s->mdct_tmp); + s->output, s->coefs[ch], s->mdct_tmp); /* XXX: optimize all that by build the window and multipying/adding at the same time */ @@ -1122,13 +1122,13 @@ static int wma_decode_block(WMADecodeContext *s) /* multiply by the window and add in the frame */ index = (s->frame_len / 2) + s->block_pos - n4; ptr = &s->frame_out[ch][index]; - s->dsp.vector_fmul_add_add(ptr,window,output,ptr,0,2*n,1); + s->dsp.vector_fmul_add_add(ptr,s->window,s->output,ptr,0,2*n,1); /* specific fast case for ms-stereo : add to second channel if it is not coded */ if (s->ms_stereo && !s->channel_coded[1]) { ptr = &s->frame_out[1][index]; - s->dsp.vector_fmul_add_add(ptr,window,output,ptr,0,2*n,1); + s->dsp.vector_fmul_add_add(ptr,s->window,s->output,ptr,0,2*n,1); } } } diff --git a/src/libffmpeg/libavcodec/wmv2.c b/src/libffmpeg/libavcodec/wmv2.c index 5abc51775..f3d4f0f23 100644 --- a/src/libffmpeg/libavcodec/wmv2.c +++ b/src/libffmpeg/libavcodec/wmv2.c @@ -643,6 +643,12 @@ void ff_mspel_motion(MpegEncContext *s, v_edge_pos = s->v_edge_pos; src_x = clip(src_x, -16, s->width); src_y = clip(src_y, -16, s->height); + + if(src_x<=-16 || src_x >= s->width) + dxy &= ~3; + if(src_y<=-16 || src_y >= s->height) + dxy &= ~4; + linesize = s->linesize; uvlinesize = s->uvlinesize; ptr = ref_picture[0] + (src_y * linesize) + src_x; diff --git a/src/libffmpeg/libavutil/Makefile.am b/src/libffmpeg/libavutil/Makefile.am index 76340cf14..6e507cb67 100644 --- a/src/libffmpeg/libavutil/Makefile.am +++ b/src/libffmpeg/libavutil/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/misc/Makefile.common -AM_CPPFLAGS = $(LIBFFMPEG_CPPFLAGS) +AM_CPPFLAGS = $(LIBFFMPEG_CPPFLAGS) -I$(top_srcdir)/src/libffmpeg AM_CFLAGS = -fno-strict-aliasing ASFLAGS = @@ -28,6 +28,7 @@ noinst_HEADERS = \ integer.h \ internal.h \ intfloat_readwrite.h \ + intreadwrite.h \ lls.h \ log.h \ mathematics.h \ diff --git a/src/libffmpeg/libavutil/bswap.h b/src/libffmpeg/libavutil/bswap.h index 4614c9045..03d613db2 100644 --- a/src/libffmpeg/libavutil/bswap.h +++ b/src/libffmpeg/libavutil/bswap.h @@ -37,7 +37,7 @@ #endif #if defined(ARCH_X86) -static always_inline uint16_t bswap_16(uint16_t x) +static av_always_inline uint16_t bswap_16(uint16_t x) { __asm("rorw $8, %0" : LEGACY_REGS (x) : @@ -45,7 +45,7 @@ static always_inline uint16_t bswap_16(uint16_t x) return x; } -static always_inline uint32_t bswap_32(uint32_t x) +static av_always_inline uint32_t bswap_32(uint32_t x) { #if __CPU__ != 386 __asm("bswap %0": @@ -82,12 +82,12 @@ static inline uint64_t bswap_64(uint64_t x) #elif defined(ARCH_SH4) -static always_inline uint16_t bswap_16(uint16_t x) { +static av_always_inline uint16_t bswap_16(uint16_t x) { __asm__("swap.b %0,%0":"=r"(x):"0"(x)); return x; } -static always_inline uint32_t bswap_32(uint32_t x) { +static av_always_inline uint32_t bswap_32(uint32_t x) { __asm__( "swap.b %0,%0\n" "swap.w %0,%0\n" @@ -110,12 +110,12 @@ static inline uint64_t bswap_64(uint64_t x) } #else -static always_inline uint16_t bswap_16(uint16_t x){ +static av_always_inline uint16_t bswap_16(uint16_t x){ return (x>>8) | (x<<8); } #ifdef ARCH_ARM -static always_inline uint32_t bswap_32(uint32_t x){ +static av_always_inline uint32_t bswap_32(uint32_t x){ uint32_t t; __asm__ ( "eor %1, %0, %0, ror #16 \n\t" @@ -126,7 +126,7 @@ static always_inline uint32_t bswap_32(uint32_t x){ return x; } #else -static always_inline uint32_t bswap_32(uint32_t x){ +static av_always_inline uint32_t bswap_32(uint32_t x){ x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); return (x>>16) | (x<<16); } diff --git a/src/libffmpeg/libavutil/common.h b/src/libffmpeg/libavutil/common.h index d167404b6..0e093616c 100644 --- a/src/libffmpeg/libavutil/common.h +++ b/src/libffmpeg/libavutil/common.h @@ -26,9 +26,7 @@ #ifndef COMMON_H #define COMMON_H -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif +#include #ifdef HAVE_AV_CONFIG_H /* only include the following when compiling package */ @@ -47,34 +45,17 @@ # include #endif /* HAVE_AV_CONFIG_H */ -/* Suppress restrict if it was not defined in config.h. */ -#ifndef restrict -# define restrict -#endif - -#ifndef always_inline -#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) -# define always_inline __attribute__((always_inline)) inline -#else -# define always_inline inline -#endif -#endif - -#ifndef attribute_used +#ifndef av_always_inline #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) -# define attribute_used __attribute__((used)) +# define av_always_inline __attribute__((always_inline)) inline #else -# define attribute_used +# define av_always_inline inline #endif #endif -#ifndef attribute_unused -#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) -# define attribute_unused __attribute__((unused)) -#else -# define attribute_unused -#endif -#endif +#ifdef HAVE_AV_CONFIG_H +# include "internal.h" +#endif /* HAVE_AV_CONFIG_H */ #ifndef attribute_deprecated #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) @@ -84,91 +65,9 @@ #endif #endif -# include - -#ifndef PRId64 -#define PRId64 "lld" -#endif - -#ifndef PRIu64 -#define PRIu64 "llu" -#endif - -#ifndef PRIx64 -#define PRIx64 "llx" -#endif - -#ifndef PRIX64 -#define PRIX64 "llX" -#endif - -#ifndef PRId32 -#define PRId32 "d" -#endif - -#ifndef PRIdFAST16 -#define PRIdFAST16 PRId32 -#endif - -#ifndef PRIdFAST32 -#define PRIdFAST32 PRId32 -#endif - -#ifndef INT16_MIN -#define INT16_MIN (-0x7fff-1) -#endif - -#ifndef INT16_MAX -#define INT16_MAX 0x7fff -#endif - -#ifndef INT32_MIN -#define INT32_MIN (-0x7fffffff-1) -#endif - -#ifndef INT32_MAX -#define INT32_MAX 0x7fffffff -#endif - -#ifndef UINT32_MAX -#define UINT32_MAX 0xffffffff -#endif - -#ifndef INT64_MIN -#define INT64_MIN (-0x7fffffffffffffffLL-1) -#endif - -#ifndef INT64_MAX -#define INT64_MAX int64_t_C(9223372036854775807) -#endif - -#ifndef UINT64_MAX -#define UINT64_MAX uint64_t_C(0xFFFFFFFFFFFFFFFF) -#endif - -#ifndef INT_BIT -# if INT_MAX != 2147483647 -# define INT_BIT 64 -# else -# define INT_BIT 32 -# endif -#endif - -#ifndef int64_t_C -#define int64_t_C(c) (c ## LL) -#define uint64_t_C(c) (c ## ULL) -#endif - -#if defined(__MINGW32__) && !defined(BUILD_AVUTIL) && defined(BUILD_SHARED_AV) -# define FF_IMPORT_ATTR __declspec(dllimport) -#else -# define FF_IMPORT_ATTR -#endif - - -#ifdef HAVE_AV_CONFIG_H -/* only include the following when compiling package */ -# include "internal.h" +#ifndef INT64_C +#define INT64_C(c) (c ## LL) +#define UINT64_C(c) (c ## ULL) #endif //rounded divison & shift @@ -184,7 +83,7 @@ #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) /* misc math functions */ -extern FF_IMPORT_ATTR const uint8_t ff_log2_tab[256]; +extern const uint8_t ff_log2_tab[256]; static inline int av_log2(unsigned int v) { @@ -375,7 +274,7 @@ static inline uint64_t read_time(void) ); return (d << 32) | (a & 0xffffffff); } -#elif defined(ARCH_X86) +#elif defined(ARCH_X86_32) static inline long long read_time(void) { long long l; @@ -465,4 +364,8 @@ void av_freep(void *ptr); # define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\n\t" #endif +/* xine: another config.h with codecs to use */ +#include "ffmpeg_config.h" + #endif /* COMMON_H */ + diff --git a/src/libffmpeg/libavutil/internal.h b/src/libffmpeg/libavutil/internal.h index 7d850141b..0c4b44170 100644 --- a/src/libffmpeg/libavutil/internal.h +++ b/src/libffmpeg/libavutil/internal.h @@ -26,6 +26,94 @@ #ifndef INTERNAL_H #define INTERNAL_H +#ifndef attribute_used +#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) +# define attribute_used __attribute__((used)) +#else +# define attribute_used +#endif +#endif + +#ifndef attribute_unused +#if defined(__GNUC__) +# define attribute_unused __attribute__((unused)) +#else +# define attribute_unused +#endif +#endif + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +#ifndef PRId64 +#define PRId64 "lld" +#endif + +#ifndef PRIu64 +#define PRIu64 "llu" +#endif + +#ifndef PRIx64 +#define PRIx64 "llx" +#endif + +#ifndef PRIX64 +#define PRIX64 "llX" +#endif + +#ifndef PRId32 +#define PRId32 "d" +#endif + +#ifndef PRIdFAST16 +#define PRIdFAST16 PRId32 +#endif + +#ifndef PRIdFAST32 +#define PRIdFAST32 PRId32 +#endif + +#ifndef INT16_MIN +#define INT16_MIN (-0x7fff-1) +#endif + +#ifndef INT16_MAX +#define INT16_MAX 0x7fff +#endif + +#ifndef INT32_MIN +#define INT32_MIN (-0x7fffffff-1) +#endif + +#ifndef INT32_MAX +#define INT32_MAX 0x7fffffff +#endif + +#ifndef UINT32_MAX +#define UINT32_MAX 0xffffffff +#endif + +#ifndef INT64_MIN +#define INT64_MIN (-0x7fffffffffffffffLL-1) +#endif + +#ifndef INT64_MAX +#define INT64_MAX INT64_C(9223372036854775807) +#endif + +#ifndef UINT64_MAX +#define UINT64_MAX UINT64_C(0xFFFFFFFFFFFFFFFF) +#endif + +#ifndef INT_BIT +# if INT_MAX != 2147483647 +# define INT_BIT 64 +# else +# define INT_BIT 32 +# endif +#endif + #if ( defined(__PIC__) || defined(__pic__) ) && ! defined(PIC) # define PIC #endif @@ -34,6 +122,7 @@ # define ENODATA 61 #endif +#include "intreadwrite.h" #include "bswap.h" #include @@ -136,7 +225,7 @@ extern const uint32_t ff_inverse[256]; # define FASTDIV(a,b) ((a)/(b)) #endif -extern FF_IMPORT_ATTR const uint8_t ff_sqrt_tab[128]; +extern const uint8_t ff_sqrt_tab[128]; static inline int ff_sqrt(int a) { @@ -216,7 +305,7 @@ if((y)<(x)){\ /* XXX: add ISOC specific test to avoid specific BSD testing. */ /* better than nothing implementation. */ /* btw, rintf() is existing on fbsd too -- alex */ -static always_inline long int lrintf(float x) +static av_always_inline long int lrintf(float x) { #ifdef __MINGW32__ # ifdef ARCH_X86_32 diff --git a/src/libffmpeg/libavutil/intreadwrite.h b/src/libffmpeg/libavutil/intreadwrite.h new file mode 100644 index 000000000..c43f9d651 --- /dev/null +++ b/src/libffmpeg/libavutil/intreadwrite.h @@ -0,0 +1,42 @@ +#ifndef INTREADWRITE_H +#define INTREADWRITE_H + +#ifdef __GNUC__ + +struct unaligned_64 { uint64_t l; } __attribute__((packed)); +struct unaligned_32 { uint32_t l; } __attribute__((packed)); +struct unaligned_16 { uint16_t l; } __attribute__((packed)); + +#define LD16(a) (((const struct unaligned_16 *) (a))->l) +#define LD32(a) (((const struct unaligned_32 *) (a))->l) +#define LD64(a) (((const struct unaligned_64 *) (a))->l) + +#define ST16(a, b) (((struct unaligned_16 *) (a))->l) = (b) +#define ST32(a, b) (((struct unaligned_32 *) (a))->l) = (b) + +#else /* __GNUC__ */ + +#define LD16(a) (*((uint16_t*)(a))) +#define LD32(a) (*((uint32_t*)(a))) +#define LD64(a) (*((uint64_t*)(a))) + +#define ST16(a, b) *((uint16_t*)(a)) = (b) +#define ST32(a, b) *((uint32_t*)(a)) = (b) + +#endif /* !__GNUC__ */ + +/* endian macros */ +#if !defined(BE_16) || !defined(BE_32) || !defined(LE_16) || !defined(LE_32) +#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) +#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ + (((uint8_t*)(x))[1] << 16) | \ + (((uint8_t*)(x))[2] << 8) | \ + ((uint8_t*)(x))[3]) +#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) +#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ + (((uint8_t*)(x))[2] << 16) | \ + (((uint8_t*)(x))[1] << 8) | \ + ((uint8_t*)(x))[0]) +#endif + +#endif /* INTREADWRITE_H */ diff --git a/src/libffmpeg/libavutil/rational.c b/src/libffmpeg/libavutil/rational.c index 0e018c41b..0480aa882 100644 --- a/src/libffmpeg/libavutil/rational.c +++ b/src/libffmpeg/libavutil/rational.c @@ -38,8 +38,10 @@ int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max) int sign= (nom<0) ^ (den<0); int64_t gcd= ff_gcd(FFABS(nom), FFABS(den)); - nom = FFABS(nom)/gcd; - den = FFABS(den)/gcd; + if(gcd){ + nom = FFABS(nom)/gcd; + den = FFABS(den)/gcd; + } if(nom<=max && den<=max){ a1= (AVRational){nom, den}; den=0; @@ -65,7 +67,7 @@ int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max) nom= den; den= next_den; } - assert(ff_gcd(a1.num, a1.den) == 1); + assert(ff_gcd(a1.num, a1.den) <= 1U); *dst_nom = sign ? -a1.num : a1.num; *dst_den = a1.den; diff --git a/src/libffmpeg/video_decoder.c b/src/libffmpeg/video_decoder.c index ad2bc99b4..b019d52d3 100644 --- a/src/libffmpeg/video_decoder.c +++ b/src/libffmpeg/video_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_decoder.c,v 1.64 2006/12/02 21:06:18 miguelfreitas Exp $ + * $Id: video_decoder.c,v 1.65 2007/01/13 21:19:52 miguelfreitas Exp $ * * xine video decoder plugin using ffmpeg * @@ -25,6 +25,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" +#include "ffmpeg_config.h" #endif #include @@ -116,6 +117,8 @@ struct ff_video_decoder_s { int is_direct_rendering_disabled; AVPaletteControl palette_control; + + xine_list_t *dr1_frames; }; @@ -203,16 +206,25 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){ av_frame->type= FF_BUFFER_TYPE_USER; + xine_list_push_back(this->dr1_frames, av_frame); + return 0; } static void release_buffer(struct AVCodecContext *context, AVFrame *av_frame){ + ff_video_decoder_t *this = (ff_video_decoder_t *)context->opaque; if (av_frame->type == FF_BUFFER_TYPE_USER) { vo_frame_t *img = (vo_frame_t *)av_frame->opaque; + xine_list_iterator_t it; assert(av_frame->opaque); img->free(img); + + it = xine_list_find(this->dr1_frames, av_frame); + assert(it); + if( it != NULL ) + xine_list_remove(this->dr1_frames, it); } else { avcodec_default_release_buffer(context, av_frame); } @@ -249,6 +261,8 @@ static const ff_codec_t ff_video_lookup[] = { {BUF_VIDEO_DV, CODEC_ID_DVVIDEO, "DV (ffmpeg)"}, {BUF_VIDEO_HUFFYUV, CODEC_ID_HUFFYUV, "HuffYUV (ffmpeg)"}, {BUF_VIDEO_VP31, CODEC_ID_VP3, "On2 VP3.1 (ffmpeg)"}, + {BUF_VIDEO_VP5, CODEC_ID_VP5, "On2 VP5 (ffmpeg)"}, + {BUF_VIDEO_VP6, CODEC_ID_VP6, "On2 VP6 (ffmpeg)"}, {BUF_VIDEO_4XM, CODEC_ID_4XM, "4X Video (ffmpeg)"}, {BUF_VIDEO_CINEPAK, CODEC_ID_CINEPAK, "Cinepak (ffmpeg)"}, {BUF_VIDEO_MSVC, CODEC_ID_MSVIDEO1, "Microsoft Video 1 (ffmpeg)"}, @@ -376,7 +390,7 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) /* enable direct rendering by default */ this->output_format = XINE_IMGFMT_YV12; #ifdef ENABLE_DIRECT_RENDERING - if( this->codec->capabilities & CODEC_CAP_DR1 ) { + if( this->codec->capabilities & CODEC_CAP_DR1 && this->codec->id != CODEC_ID_H264 ) { this->context->get_buffer = get_buffer; this->context->release_buffer = release_buffer; xprintf(this->stream->xine, XINE_VERBOSITY_LOG, @@ -801,7 +815,7 @@ static void ff_check_bufsize (ff_video_decoder_t *this, int size) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_video_dec: increasing buffer to %d to avoid overflow.\n"), this->bufsize); - this->buf = realloc(this->buf, this->bufsize); + this->buf = realloc(this->buf, this->bufsize + FF_INPUT_BUFFER_PADDING_SIZE ); } } @@ -826,7 +840,7 @@ static void ff_handle_header_buffer (ff_video_decoder_t *this, buf_element_t *bu lprintf ("header buffer\n"); /* accumulate data */ - ff_check_bufsize(this, this->size + buf->size + FF_INPUT_BUFFER_PADDING_SIZE); + ff_check_bufsize(this, this->size + buf->size); xine_fast_memcpy (&this->buf[this->size], buf->content, buf->size); this->size += buf->size; @@ -1102,7 +1116,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { lprintf("no memcpy needed to accumulate data\n"); } else { /* copy data into our internal buffer */ - ff_check_bufsize(this, this->size + buf->size + FF_INPUT_BUFFER_PADDING_SIZE); + ff_check_bufsize(this, this->size + buf->size); chunk_buf = this->buf; /* ff_check_bufsize might realloc this->buf */ xine_fast_memcpy (&this->buf[this->size], buf->content, buf->size); @@ -1122,7 +1136,13 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { int codec_type = buf->type & 0xFFFF0000; /* pad input data */ - chunk_buf[this->size] = 0; + /* note: bitstream, alt bitstream reader or something will cause + * severe mpeg4 artifacts if padding is less than 32 bits. + */ + chunk_buf[this->size+0] = 0; + chunk_buf[this->size+1] = 0; + chunk_buf[this->size+2] = 0; + chunk_buf[this->size+3] = 0; while (this->size > 0) { @@ -1150,7 +1170,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { this->size -= len; if (this->size > 0) { - ff_check_bufsize(this, this->size + FF_INPUT_BUFFER_PADDING_SIZE); + ff_check_bufsize(this, this->size); memmove (this->buf, &chunk_buf[offset], this->size); chunk_buf = this->buf; } @@ -1256,7 +1276,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { img->crop_bottom = this->crop_bottom; this->skipframes = img->draw(img, this->stream); - + if(free_img) img->free(img); } @@ -1360,12 +1380,23 @@ static void ff_dispose (video_decoder_t *this_gen) { ff_video_decoder_t *this = (ff_video_decoder_t *) this_gen; lprintf ("ff_dispose\n"); - + if (this->decoder_ok) { + xine_list_iterator_t it; + AVFrame *av_frame; + pthread_mutex_lock(&ffmpeg_lock); avcodec_close (this->context); pthread_mutex_unlock(&ffmpeg_lock); - + + /* frame garbage collector here - workaround for buggy ffmpeg codecs that + * don't release their DR1 frames */ + while( (it = xine_list_front(this->dr1_frames)) != NULL ) + { + av_frame = (AVFrame *)xine_list_get_value(this->dr1_frames, it); + release_buffer(this->context, av_frame); + } + this->stream->video_out->close(this->stream->video_out, this->stream); this->decoder_ok = 0; } @@ -1394,6 +1425,8 @@ static void ff_dispose (video_decoder_t *this_gen) { if(this->pp_mode) pp_free_mode(this->pp_mode); + + xine_list_delete(this->dr1_frames); free (this_gen); } @@ -1433,6 +1466,8 @@ static video_decoder_t *ff_video_open_plugin (video_decoder_class_t *class_gen, this->pp_context = NULL; this->pp_mode = NULL; + this->dr1_frames = xine_list_new(); + mpeg_parser_init(&this->mpeg_parser); return &this->video_decoder; @@ -1483,73 +1518,223 @@ void *init_video_plugin (xine_t *xine, void *data) { } static uint32_t supported_video_types[] = { - BUF_VIDEO_MSMPEG4_V1, + #ifdef CONFIG_MSMPEG4V1_DECODER + BUF_VIDEO_MSMPEG4_V1, + #endif + #ifdef CONFIG_MSMPEG4V2_DECODER BUF_VIDEO_MSMPEG4_V2, - BUF_VIDEO_MSMPEG4_V3, - BUF_VIDEO_WMV7, + #endif + #ifdef CONFIG_MSMPEG4V3_DECODER + BUF_VIDEO_MSMPEG4_V3, + #endif + #ifdef CONFIG_WMV1_DECODER + BUF_VIDEO_WMV7, + #endif + #ifdef CONFIG_WMV2_DECODER + BUF_VIDEO_WMV8, + #endif + #ifdef CONFIG_WMV3_DECODER + BUF_VIDEO_WMV9, + #endif + #ifdef CONFIG_MPEG4_DECODER BUF_VIDEO_MPEG4, - BUF_VIDEO_XVID, - BUF_VIDEO_DIVX5, + #endif + #ifdef CONFIG_MPEG4_DECODER + BUF_VIDEO_XVID, + #endif + #ifdef CONFIG_MPEG4_DECODER + BUF_VIDEO_DIVX5, + #endif + #ifdef CONFIG_MPEG4_DECODER BUF_VIDEO_3IVX, + #endif + #ifdef CONFIG_MJPEG_DECODER + BUF_VIDEO_JPEG, + #endif + #ifdef CONFIG_MJPEG_DECODER BUF_VIDEO_MJPEG, + #endif + #ifdef CONFIG_MJPEGB_DECODER BUF_VIDEO_MJPEG_B, + #endif + #ifdef CONFIG_H263I_DECODER + BUF_VIDEO_I263, + #endif + #ifdef CONFIG_H263_DECODER BUF_VIDEO_H263, + #endif + #ifdef CONFIG_RV10_DECODER BUF_VIDEO_RV10, + #endif + #ifdef CONFIG_RV20_DECODER BUF_VIDEO_RV20, + #endif + #ifdef CONFIG_INDEO3_DECODER BUF_VIDEO_IV31, + #endif + #ifdef CONFIG_INDEO3_DECODER BUF_VIDEO_IV32, + #endif + #ifdef CONFIG_SVQ1_DECODER BUF_VIDEO_SORENSON_V1, + #endif + #ifdef CONFIG_SVQ3_DECODER BUF_VIDEO_SORENSON_V3, - BUF_VIDEO_JPEG, - BUF_VIDEO_MPEG, + #endif + #ifdef CONFIG_DVVIDEO_DECODER BUF_VIDEO_DV, + #endif + #ifdef CONFIG_HUFFYUV_DECODER BUF_VIDEO_HUFFYUV, + #endif + #ifdef CONFIG_VP3_DECODER BUF_VIDEO_VP31, + #endif + #ifdef CONFIG_VP5_DECODER + BUF_VIDEO_VP5, + #endif + #ifdef CONFIG_VP6_DECODER + BUF_VIDEO_VP6, + #endif + #ifdef CONFIG_4XM_DECODER BUF_VIDEO_4XM, + #endif + #ifdef CONFIG_CINEPAK_DECODER BUF_VIDEO_CINEPAK, + #endif + #ifdef CONFIG_MSVIDEO1_DECODER BUF_VIDEO_MSVC, + #endif + #ifdef CONFIG_MSRLE_DECODER BUF_VIDEO_MSRLE, + #endif + #ifdef CONFIG_RPZA_DECODER BUF_VIDEO_RPZA, + #endif + #ifdef CONFIG_CYUV_DECODER BUF_VIDEO_CYUV, + #endif + #ifdef CONFIG_ROQ_DECODER BUF_VIDEO_ROQ, + #endif + #ifdef CONFIG_IDCIN_DECODER BUF_VIDEO_IDCIN, + #endif + #ifdef CONFIG_XAN_WC3_DECODER BUF_VIDEO_WC3, + #endif + #ifdef CONFIG_WS_VQA_DECODER BUF_VIDEO_VQA, + #endif + #ifdef CONFIG_INTERPLAY_VIDEO_DECODER BUF_VIDEO_INTERPLAY, + #endif + #ifdef CONFIG_FLIC_DECODER BUF_VIDEO_FLI, + #endif + #ifdef CONFIG_8BPS_DECODER BUF_VIDEO_8BPS, + #endif + #ifdef CONFIG_SMC_DECODER BUF_VIDEO_SMC, - BUF_VIDEO_VMD, + #endif + #ifdef CONFIG_TRUEMOTION1_DECODER BUF_VIDEO_DUCKTM1, + #endif + #ifdef CONFIG_TRUEMOTION2_DECODER BUF_VIDEO_DUCKTM2, + #endif + #ifdef CONFIG_VMDVIDEO_DECODER + BUF_VIDEO_VMD, + #endif + #ifdef CONFIG_ZLIB_DECODER BUF_VIDEO_ZLIB, + #endif + #ifdef CONFIG_MSZH_DECODER BUF_VIDEO_MSZH, + #endif + #ifdef CONFIG_ASV1_DECODER BUF_VIDEO_ASV1, + #endif + #ifdef CONFIG_ASV2_DECODER BUF_VIDEO_ASV2, + #endif + #ifdef CONFIG_VCR1_DECODER BUF_VIDEO_ATIVCR1, + #endif + #ifdef CONFIG_FLV1_DECODER BUF_VIDEO_FLV1, + #endif + #ifdef CONFIG_QTRLE_DECODER BUF_VIDEO_QTRLE, + #endif + #ifdef CONFIG_H264_DECODER BUF_VIDEO_H264, + #endif + #ifdef CONFIG_H261_DECODER BUF_VIDEO_H261, + #endif + #ifdef CONFIG_AASC_DECODER BUF_VIDEO_AASC, + #endif + #ifdef CONFIG_LOCO_DECODER BUF_VIDEO_LOCO, + #endif + #ifdef CONFIG_QDRAW_DECODER BUF_VIDEO_QDRW, + #endif + #ifdef CONFIG_QPEG_DECODER BUF_VIDEO_QPEG, + #endif + #ifdef CONFIG_TSCC_DECODER BUF_VIDEO_TSCC, + #endif + #ifdef CONFIG_ULTI_DECODER BUF_VIDEO_ULTI, + #endif + #ifdef CONFIG_WNV1_DECODER BUF_VIDEO_WNV1, + #endif + #ifdef CONFIG_VIXL_DECODER BUF_VIDEO_XL, + #endif + #ifdef CONFIG_INDEO2_DECODER BUF_VIDEO_RT21, + #endif + #ifdef CONFIG_FRAPS_DECODER BUF_VIDEO_FPS1, + #endif + #ifdef CONFIG_MPEG1VIDEO_DECODER + BUF_VIDEO_MPEG, + #endif + #ifdef CONFIG_CSCD_DECODER BUF_VIDEO_CSCD, + #endif + #ifdef CONFIG_AVS_DECODER + BUF_VIDEO_AVS, + #endif + #ifdef CONFIG_MMVIDEO_DECODER BUF_VIDEO_ALGMM, + #endif + #ifdef CONFIG_ZMBV_DECODER BUF_VIDEO_ZMBV, - BUF_VIDEO_AVS, + #endif + #ifdef CONFIG_SMACKVIDEO_DECODER BUF_VIDEO_SMACKER, + #endif + #ifdef CONFIG_NUV_DECODER BUF_VIDEO_NUV, + #endif + #ifdef CONFIG_KMVC_DECODER BUF_VIDEO_KMVC, + #endif + #ifdef CONFIG_FLASHSV_DECODER BUF_VIDEO_FLASHSV, + #endif + #ifdef CONFIG_CAVS_DECODER BUF_VIDEO_CAVS, + #endif + 0 }; diff --git a/src/libffmpeg/xine_decoder.c b/src/libffmpeg/xine_decoder.c index 02d19cc1a..2eeb9746b 100644 --- a/src/libffmpeg/xine_decoder.c +++ b/src/libffmpeg/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.172 2006/12/04 22:25:13 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.173 2007/01/13 21:19:52 miguelfreitas Exp $ * * xine decoder plugin using ffmpeg * @@ -25,6 +25,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" +#include "ffmpeg_config.h" #endif #include "xine_internal.h" @@ -39,114 +40,273 @@ pthread_once_t once_control = PTHREAD_ONCE_INIT; pthread_mutex_t ffmpeg_lock; #ifndef HAVE_FFMPEG + +#define REGISTER_ENCODER(X,x) \ + if(ENABLE_##X##_ENCODER) register_avcodec(&x##_encoder) +#define REGISTER_DECODER(X,x) \ + if(ENABLE_##X##_DECODER) register_avcodec(&x##_decoder) +#define REGISTER_ENCDEC(X,x) REGISTER_ENCODER(X,x); REGISTER_DECODER(X,x) + +#define REGISTER_PARSER(X,x) \ + if(ENABLE_##X##_PARSER) av_register_codec_parser(&x##_parser) + +/* If you do not call this function, then you can select exactly which + formats you want to support */ + +/** + * simple call to register all the codecs. + */ void avcodec_register_all(void) { static int inited = 0; - + if (inited != 0) - return; + return; inited = 1; - /* decoders */ - register_avcodec(&h263_decoder); - register_avcodec(&mpeg4_decoder); - register_avcodec(&msmpeg4v1_decoder); - register_avcodec(&msmpeg4v2_decoder); - register_avcodec(&msmpeg4v3_decoder); - register_avcodec(&wmv1_decoder); - register_avcodec(&wmv2_decoder); - register_avcodec(&h263i_decoder); - register_avcodec(&rv10_decoder); - register_avcodec(&rv20_decoder); - register_avcodec(&svq1_decoder); - register_avcodec(&svq3_decoder); - register_avcodec(&wmav1_decoder); - register_avcodec(&wmav2_decoder); - register_avcodec(&indeo3_decoder); - register_avcodec(&mpeg1video_decoder); - register_avcodec(&dvvideo_decoder); - register_avcodec(&pcm_s16le_decoder); - register_avcodec(&mjpeg_decoder); - register_avcodec(&mjpegb_decoder); - register_avcodec(&mp2_decoder); - register_avcodec(&mp3_decoder); - register_avcodec(&mace3_decoder); - register_avcodec(&mace6_decoder); - register_avcodec(&huffyuv_decoder); - register_avcodec(&cyuv_decoder); - register_avcodec(&h264_decoder); - register_avcodec(&vp3_decoder); - register_avcodec(&fourxm_decoder); - register_avcodec(&ra_144_decoder); - register_avcodec(&ra_288_decoder); - register_avcodec(&adpcm_ms_decoder); - register_avcodec(&adpcm_ima_qt_decoder); - register_avcodec(&adpcm_ima_wav_decoder); - register_avcodec(&adpcm_ima_dk3_decoder); - register_avcodec(&adpcm_ima_dk4_decoder); - register_avcodec(&adpcm_ima_ws_decoder); - register_avcodec(&adpcm_ima_smjpeg_decoder); - register_avcodec(&adpcm_xa_decoder); - register_avcodec(&adpcm_4xm_decoder); - register_avcodec(&adpcm_ea_decoder); - register_avcodec(&pcm_alaw_decoder); - register_avcodec(&pcm_mulaw_decoder); - register_avcodec(&roq_dpcm_decoder); - register_avcodec(&interplay_dpcm_decoder); - register_avcodec(&cinepak_decoder); - register_avcodec(&msvideo1_decoder); - register_avcodec(&msrle_decoder); - register_avcodec(&rpza_decoder); - register_avcodec(&roq_decoder); - register_avcodec(&idcin_decoder); - register_avcodec(&xan_wc3_decoder); - register_avcodec(&vqa_decoder); - register_avcodec(&interplay_video_decoder); - register_avcodec(&flic_decoder); - register_avcodec(&smc_decoder); - register_avcodec(&eightbps_decoder); - register_avcodec(&vmdvideo_decoder); - register_avcodec(&vmdaudio_decoder); - register_avcodec(&truemotion1_decoder); - //register_avcodec(&mszh_decoder); - //register_avcodec(&zlib_decoder); - register_avcodec(&xan_dpcm_decoder); - register_avcodec(&asv1_decoder); - register_avcodec(&asv2_decoder); - register_avcodec(&vcr1_decoder); - register_avcodec(&flv_decoder); - register_avcodec(&qtrle_decoder); - register_avcodec(&flac_decoder); - register_avcodec(&aasc_decoder); - register_avcodec(&alac_decoder); - register_avcodec(&h261_decoder); - register_avcodec(&loco_decoder); - register_avcodec(&qdraw_decoder); - register_avcodec(&qpeg_decoder); - register_avcodec(&tscc_decoder); - register_avcodec(&ulti_decoder); - register_avcodec(&wnv1_decoder); - register_avcodec(&xl_decoder); - register_avcodec(&indeo2_decoder); - register_avcodec(&fraps_decoder); - register_avcodec(&shorten_decoder); - register_avcodec(&qdm2_decoder); - register_avcodec(&truemotion2_decoder); - register_avcodec(&wmv3_decoder); - register_avcodec(&cscd_decoder); - register_avcodec(&mmvideo_decoder); - register_avcodec(&zmbv_decoder); - register_avcodec(&avs_decoder); - register_avcodec(&smacker_decoder); - register_avcodec(&smackaud_decoder); - register_avcodec(&nuv_decoder); - register_avcodec(&kmvc_decoder); - register_avcodec(&flashsv_decoder); - //register_avcodec(&cavs_decoder); - register_avcodec(&cook_decoder); - register_avcodec(&truespeech_decoder); - register_avcodec(&tta_decoder); + /* video codecs */ + REGISTER_DECODER(AASC, aasc); + REGISTER_ENCDEC (ASV1, asv1); + REGISTER_ENCDEC (ASV2, asv2); + REGISTER_DECODER(AVS, avs); + REGISTER_DECODER(BMP, bmp); + REGISTER_DECODER(CAVS, cavs); + REGISTER_DECODER(CINEPAK, cinepak); + REGISTER_DECODER(CLJR, cljr); + REGISTER_DECODER(CSCD, cscd); + REGISTER_DECODER(CYUV, cyuv); + REGISTER_DECODER(DSICINVIDEO, dsicinvideo); + REGISTER_ENCDEC (DVVIDEO, dvvideo); + REGISTER_DECODER(EIGHTBPS, eightbps); + REGISTER_ENCDEC (FFV1, ffv1); + REGISTER_ENCDEC (FFVHUFF, ffvhuff); + REGISTER_DECODER(FLASHSV, flashsv); + REGISTER_DECODER(FLIC, flic); + REGISTER_ENCDEC (FLV, flv); + REGISTER_DECODER(FOURXM, fourxm); + REGISTER_DECODER(FRAPS, fraps); + REGISTER_ENCDEC (GIF, gif); + REGISTER_ENCDEC (H261, h261); + REGISTER_ENCDEC (H263, h263); + REGISTER_DECODER(H263I, h263i); + REGISTER_ENCODER(H263P, h263p); + REGISTER_DECODER(H264, h264); + REGISTER_ENCDEC (HUFFYUV, huffyuv); + REGISTER_DECODER(IDCIN, idcin); + REGISTER_DECODER(INDEO2, indeo2); + REGISTER_DECODER(INDEO3, indeo3); + REGISTER_DECODER(INTERPLAY_VIDEO, interplay_video); + REGISTER_ENCODER(JPEGLS, jpegls); + REGISTER_DECODER(KMVC, kmvc); + REGISTER_ENCODER(LJPEG, ljpeg); + REGISTER_DECODER(LOCO, loco); + REGISTER_DECODER(MDEC, mdec); + REGISTER_ENCDEC (MJPEG, mjpeg); + REGISTER_DECODER(MJPEGB, mjpegb); + REGISTER_DECODER(MMVIDEO, mmvideo); +#ifdef HAVE_XVMC + REGISTER_DECODER(MPEG_XVMC, mpeg_xvmc); +#endif + REGISTER_ENCDEC (MPEG1VIDEO, mpeg1video); + REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video); + REGISTER_ENCDEC (MPEG4, mpeg4); + REGISTER_DECODER(MPEGVIDEO, mpegvideo); + REGISTER_ENCDEC (MSMPEG4V1, msmpeg4v1); + REGISTER_ENCDEC (MSMPEG4V2, msmpeg4v2); + REGISTER_ENCDEC (MSMPEG4V3, msmpeg4v3); + REGISTER_DECODER(MSRLE, msrle); + REGISTER_DECODER(MSVIDEO1, msvideo1); + REGISTER_DECODER(MSZH, mszh); + REGISTER_DECODER(NUV, nuv); + REGISTER_ENCODER(PAM, pam); + REGISTER_ENCODER(PBM, pbm); + REGISTER_ENCODER(PGM, pgm); + REGISTER_ENCODER(PGMYUV, pgmyuv); +#ifdef CONFIG_ZLIB + REGISTER_ENCDEC (PNG, png); +#endif + REGISTER_ENCODER(PPM, ppm); + REGISTER_DECODER(QDRAW, qdraw); + REGISTER_DECODER(QPEG, qpeg); + REGISTER_DECODER(QTRLE, qtrle); + REGISTER_ENCDEC (RAWVIDEO, rawvideo); + REGISTER_DECODER(ROQ, roq); + REGISTER_DECODER(RPZA, rpza); + REGISTER_ENCDEC (RV10, rv10); + REGISTER_ENCDEC (RV20, rv20); + REGISTER_DECODER(SMACKER, smacker); + REGISTER_DECODER(SMC, smc); + REGISTER_ENCDEC (SNOW, snow); + REGISTER_DECODER(SP5X, sp5x); + REGISTER_ENCDEC (SVQ1, svq1); + REGISTER_DECODER(SVQ3, svq3); + REGISTER_DECODER(TARGA, targa); + REGISTER_DECODER(THEORA, theora); + REGISTER_DECODER(TIERTEXSEQVIDEO, tiertexseqvideo); + REGISTER_DECODER(TIFF, tiff); + REGISTER_DECODER(TRUEMOTION1, truemotion1); + REGISTER_DECODER(TRUEMOTION2, truemotion2); + REGISTER_DECODER(TSCC, tscc); + REGISTER_DECODER(ULTI, ulti); + REGISTER_DECODER(VC1, vc1); + REGISTER_DECODER(VCR1, vcr1); + REGISTER_DECODER(VMDVIDEO, vmdvideo); + REGISTER_DECODER(VMNC, vmnc); + REGISTER_DECODER(VP3, vp3); + REGISTER_DECODER(VP5, vp5); + REGISTER_DECODER(VP6, vp6); + REGISTER_DECODER(VP6F, vp6f); + REGISTER_DECODER(VQA, vqa); + REGISTER_ENCDEC (WMV1, wmv1); + REGISTER_ENCDEC (WMV2, wmv2); + REGISTER_DECODER(WMV3, wmv3); + REGISTER_DECODER(WNV1, wnv1); +#ifdef CONFIG_X264 + REGISTER_ENCODER(X264, x264); +#endif + REGISTER_DECODER(XAN_WC3, xan_wc3); + REGISTER_DECODER(XL, xl); +#ifdef CONFIG_XVID + REGISTER_ENCODER(XVID, xvid); +#endif + REGISTER_ENCDEC (ZLIB, zlib); +#ifdef CONFIG_ZLIB + REGISTER_ENCDEC (ZMBV, zmbv); +#endif + + /* audio codecs */ +#ifdef CONFIG_LIBFAAD + REGISTER_DECODER(AAC, aac); + REGISTER_DECODER(MPEG4AAC, mpeg4aac); +#endif +#ifdef CONFIG_LIBA52 + REGISTER_DECODER(AC3, ac3); +#endif + REGISTER_ENCODER(AC3, ac3); + REGISTER_DECODER(ALAC, alac); +#if defined(CONFIG_AMR_NB) || defined(CONFIG_AMR_NB_FIXED) + REGISTER_ENCDEC (AMR_NB, amr_nb); +#endif +#ifdef CONFIG_AMR_WB + REGISTER_ENCDEC (AMR_WB, amr_wb); +#endif + REGISTER_DECODER(COOK, cook); + REGISTER_DECODER(DSICINAUDIO, dsicinaudio); +#ifdef CONFIG_LIBDTS + REGISTER_DECODER(DTS, dts); +#endif +#ifdef CONFIG_LIBFAAC + REGISTER_ENCODER(FAAC, faac); +#endif + REGISTER_ENCDEC (FLAC, flac); + REGISTER_DECODER(IMC, imc); +#ifdef CONFIG_LIBGSM + REGISTER_ENCDEC (LIBGSM, libgsm); +#endif + REGISTER_DECODER(MACE3, mace3); + REGISTER_DECODER(MACE6, mace6); + REGISTER_ENCDEC (MP2, mp2); + REGISTER_DECODER(MP3, mp3); + REGISTER_DECODER(MP3ADU, mp3adu); +#ifdef CONFIG_LIBMP3LAME + REGISTER_ENCODER(MP3LAME, mp3lame); +#endif + REGISTER_DECODER(MP3ON4, mp3on4); + REGISTER_DECODER(MPC7, mpc7); +#ifdef CONFIG_LIBVORBIS + if (!ENABLE_VORBIS_ENCODER) REGISTER_ENCODER(OGGVORBIS, oggvorbis); + if (!ENABLE_VORBIS_DECODER) REGISTER_DECODER(OGGVORBIS, oggvorbis); +#endif + REGISTER_DECODER(QDM2, qdm2); + REGISTER_DECODER(RA_144, ra_144); + REGISTER_DECODER(RA_288, ra_288); + REGISTER_DECODER(SHORTEN, shorten); + REGISTER_DECODER(SMACKAUD, smackaud); + REGISTER_ENCDEC (SONIC, sonic); + REGISTER_ENCODER(SONIC_LS, sonic_ls); + REGISTER_DECODER(TRUESPEECH, truespeech); + REGISTER_DECODER(TTA, tta); + REGISTER_DECODER(VMDAUDIO, vmdaudio); + REGISTER_ENCDEC (VORBIS, vorbis); + REGISTER_DECODER(WAVPACK, wavpack); + REGISTER_DECODER(WMAV1, wmav1); + REGISTER_DECODER(WMAV2, wmav2); + REGISTER_DECODER(WS_SND1, ws_snd1); + + /* pcm codecs */ + REGISTER_ENCDEC (PCM_ALAW, pcm_alaw); + REGISTER_ENCDEC (PCM_MULAW, pcm_mulaw); + REGISTER_ENCDEC (PCM_S8, pcm_s8); + REGISTER_ENCDEC (PCM_S16BE, pcm_s16be); + REGISTER_ENCDEC (PCM_S16LE, pcm_s16le); + REGISTER_ENCDEC (PCM_S24BE, pcm_s24be); + REGISTER_ENCDEC (PCM_S24DAUD, pcm_s24daud); + REGISTER_ENCDEC (PCM_S24LE, pcm_s24le); + REGISTER_ENCDEC (PCM_S32BE, pcm_s32be); + REGISTER_ENCDEC (PCM_S32LE, pcm_s32le); + REGISTER_ENCDEC (PCM_U8, pcm_u8); + REGISTER_ENCDEC (PCM_U16BE, pcm_u16be); + REGISTER_ENCDEC (PCM_U16LE, pcm_u16le); + REGISTER_ENCDEC (PCM_U24BE, pcm_u24be); + REGISTER_ENCDEC (PCM_U24LE, pcm_u24le); + REGISTER_ENCDEC (PCM_U32BE, pcm_u32be); + REGISTER_ENCDEC (PCM_U32LE, pcm_u32le); + + /* dpcm codecs */ + REGISTER_DECODER(INTERPLAY_DPCM, interplay_dpcm); + REGISTER_DECODER(ROQ_DPCM, roq_dpcm); + REGISTER_DECODER(SOL_DPCM, sol_dpcm); + REGISTER_DECODER(XAN_DPCM, xan_dpcm); + + /* adpcm codecs */ + REGISTER_ENCDEC (ADPCM_4XM, adpcm_4xm); + REGISTER_ENCDEC (ADPCM_ADX, adpcm_adx); + REGISTER_ENCDEC (ADPCM_CT, adpcm_ct); + REGISTER_ENCDEC (ADPCM_EA, adpcm_ea); + REGISTER_ENCDEC (ADPCM_G726, adpcm_g726); + REGISTER_ENCDEC (ADPCM_IMA_DK3, adpcm_ima_dk3); + REGISTER_ENCDEC (ADPCM_IMA_DK4, adpcm_ima_dk4); + REGISTER_ENCDEC (ADPCM_IMA_QT, adpcm_ima_qt); + REGISTER_ENCDEC (ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg); + REGISTER_ENCDEC (ADPCM_IMA_WAV, adpcm_ima_wav); + REGISTER_ENCDEC (ADPCM_IMA_WS, adpcm_ima_ws); + REGISTER_ENCDEC (ADPCM_MS, adpcm_ms); + REGISTER_ENCDEC (ADPCM_SBPRO_2, adpcm_sbpro_2); + REGISTER_ENCDEC (ADPCM_SBPRO_3, adpcm_sbpro_3); + REGISTER_ENCDEC (ADPCM_SBPRO_4, adpcm_sbpro_4); + REGISTER_ENCDEC (ADPCM_SWF, adpcm_swf); + REGISTER_ENCDEC (ADPCM_XA, adpcm_xa); + REGISTER_ENCDEC (ADPCM_YAMAHA, adpcm_yamaha); + + /* subtitles */ + REGISTER_ENCDEC (DVBSUB, dvbsub); + REGISTER_ENCDEC (DVDSUB, dvdsub); + + /* parsers */ + REGISTER_PARSER (AAC, aac); + REGISTER_PARSER (AC3, ac3); + REGISTER_PARSER (CAVSVIDEO, cavsvideo); + REGISTER_PARSER (DVBSUB, dvbsub); + REGISTER_PARSER (DVDSUB, dvdsub); + REGISTER_PARSER (H261, h261); + REGISTER_PARSER (H263, h263); + REGISTER_PARSER (H264, h264); + REGISTER_PARSER (MJPEG, mjpeg); + REGISTER_PARSER (MPEG4VIDEO, mpeg4video); + REGISTER_PARSER (MPEGAUDIO, mpegaudio); + REGISTER_PARSER (MPEGVIDEO, mpegvideo); + REGISTER_PARSER (PNM, pnm); + + /* + av_register_bitstream_filter(&dump_extradata_bsf); + av_register_bitstream_filter(&remove_extradata_bsf); + av_register_bitstream_filter(&noise_bsf); + av_register_bitstream_filter(&mp3_header_compress_bsf); + av_register_bitstream_filter(&mp3_header_decompress_bsf); + av_register_bitstream_filter(&mjpega_dump_header_bsf); + */ } + #endif void init_once_routine(void) { -- cgit v1.2.3 From 3ba7b3ce9a3054747976525c00cd91d8df4801bf Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sat, 13 Jan 2007 22:14:56 +0000 Subject: build fixes related to last ffmpeg sync changes CVS patchset: 8500 CVS date: 2007/01/13 22:14:56 --- src/post/goom/Makefile.am | 3 +-- src/post/goom/mmx.c | 2 ++ src/post/goom/xmmx.c | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/post/goom/Makefile.am b/src/post/goom/Makefile.am index 564e64604..4031f4f93 100644 --- a/src/post/goom/Makefile.am +++ b/src/post/goom/Makefile.am @@ -18,9 +18,8 @@ lib_LTLIBRARIES = xineplug_post_goom.la #AM_CPPFLAGS = -DCPU_POWERPC #endif -if HAVE_FFMMX +if HAVE_MMX extra_files = mmx.c xmmx.c -AM_CPPFLAGS = -DHAVE_MMX endif xineplug_post_goom_la_SOURCES = $(extra_files) xine_goom.c \ diff --git a/src/post/goom/mmx.c b/src/post/goom/mmx.c index 5f887cf77..e2f25b47d 100644 --- a/src/post/goom/mmx.c +++ b/src/post/goom/mmx.c @@ -1,3 +1,5 @@ +#include "config.h" + #ifdef HAVE_MMX #define BUFFPOINTNB 16 diff --git a/src/post/goom/xmmx.c b/src/post/goom/xmmx.c index 7fc9acfc8..0048a20e8 100644 --- a/src/post/goom/xmmx.c +++ b/src/post/goom/xmmx.c @@ -1,3 +1,4 @@ +#include "config.h" #ifdef HAVE_MMX -- cgit v1.2.3 From 82929f55b2e99b55cff355e592d25df4eda2a797 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 14 Jan 2007 00:08:00 +0000 Subject: Add another CONFIG_ENCODERS guard to kill an implicit fn declaration warning. CVS patchset: 8504 CVS date: 2007/01/14 00:08:00 --- src/libffmpeg/diff_to_ffmpeg_cvs.txt | 26 ++++++++++++++++++++++++++ src/libffmpeg/libavcodec/snow.c | 4 ++++ 2 files changed, 30 insertions(+) (limited to 'src') diff --git a/src/libffmpeg/diff_to_ffmpeg_cvs.txt b/src/libffmpeg/diff_to_ffmpeg_cvs.txt index b813b3ab2..0b8a3946a 100644 --- a/src/libffmpeg/diff_to_ffmpeg_cvs.txt +++ b/src/libffmpeg/diff_to_ffmpeg_cvs.txt @@ -473,6 +473,16 @@ Index: libavcodec/snow.c =================================================================== --- libavcodec/snow.c (revision 7433) +++ libavcodec/snow.c (working copy) +@@ -487,7 +487,9 @@ + #define slice_buffer_get_line(slice_buf, line_num) ((slice_buf)->line[line_num] ? (slice_buf)->line[line_num] : slice_buffer_load_line((slice_buf), (line_num))) + //#define slice_buffer_get_line(slice_buf, line_num) (slice_buffer_load_line((slice_buf), (line_num))) + ++#ifdef CONFIG_ENCODERS + static void iterative_me(SnowContext *s); ++#endif + + static void slice_buffer_init(slice_buffer * buf, int line_count, int max_allocated_lines, int line_width, DWTELEM * base_buffer) + { @@ -1982,6 +1982,7 @@ #define P_MV1 P[9] #define FLAG_QPEL 1 //must be 1 @@ -505,6 +515,22 @@ Index: libavcodec/snow.c static void decode_blocks(SnowContext *s){ int x, y; +@@ -3182,6 +3184,7 @@ + } + } + ++#ifdef CONFIG_ENCODERS + static void iterative_me(SnowContext *s){ + int pass, mb_x, mb_y; + const int b_width = s->b_width << s->block_max_depth; +@@ -3406,6 +3409,7 @@ + av_log(NULL, AV_LOG_ERROR, "pass:4mv changed:%d\n", change*4); + } + } ++#endif + + static void quantize(SnowContext *s, SubBand *b, DWTELEM *src, int stride, int bias){ + const int level= b->level; @@ -3931,6 +3935,7 @@ } } diff --git a/src/libffmpeg/libavcodec/snow.c b/src/libffmpeg/libavcodec/snow.c index 5e93d40a1..aec0375f6 100644 --- a/src/libffmpeg/libavcodec/snow.c +++ b/src/libffmpeg/libavcodec/snow.c @@ -487,7 +487,9 @@ typedef struct { #define slice_buffer_get_line(slice_buf, line_num) ((slice_buf)->line[line_num] ? (slice_buf)->line[line_num] : slice_buffer_load_line((slice_buf), (line_num))) //#define slice_buffer_get_line(slice_buf, line_num) (slice_buffer_load_line((slice_buf), (line_num))) +#ifdef CONFIG_ENCODERS static void iterative_me(SnowContext *s); +#endif static void slice_buffer_init(slice_buffer * buf, int line_count, int max_allocated_lines, int line_width, DWTELEM * base_buffer) { @@ -3182,6 +3184,7 @@ static av_always_inline int check_4block_inter(SnowContext *s, int mb_x, int mb_ } } +#ifdef CONFIG_ENCODERS static void iterative_me(SnowContext *s){ int pass, mb_x, mb_y; const int b_width = s->b_width << s->block_max_depth; @@ -3406,6 +3409,7 @@ static void iterative_me(SnowContext *s){ av_log(NULL, AV_LOG_ERROR, "pass:4mv changed:%d\n", change*4); } } +#endif static void quantize(SnowContext *s, SubBand *b, DWTELEM *src, int stride, int bias){ const int level= b->level; -- cgit v1.2.3 From 05ffdfcd8eebaeba4f7ba08e0b88453f18626464 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sun, 14 Jan 2007 02:45:40 +0000 Subject: ops, missing file CVS patchset: 8505 CVS date: 2007/01/14 02:45:40 --- src/libffmpeg/libavcodec/wavpack.c | 556 +++++++++++++++++++++++++++++++++++++ 1 file changed, 556 insertions(+) create mode 100644 src/libffmpeg/libavcodec/wavpack.c (limited to 'src') diff --git a/src/libffmpeg/libavcodec/wavpack.c b/src/libffmpeg/libavcodec/wavpack.c new file mode 100644 index 000000000..18544831e --- /dev/null +++ b/src/libffmpeg/libavcodec/wavpack.c @@ -0,0 +1,556 @@ +/* + * WavPack lossless audio decoder + * Copyright (c) 2006 Konstantin Shishkov + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#define ALT_BITSTREAM_READER_LE +#include "avcodec.h" +#include "bitstream.h" + +/** + * @file wavpack.c + * WavPack lossless audio decoder + */ + +#define WV_JOINT 0x0010 + +enum WP_ID_Flags{ + WP_IDF_MASK = 0x1F, + WP_IDF_IGNORE = 0x20, + WP_IDF_ODD = 0x40, + WP_IDF_LONG = 0x80 +}; + +enum WP_ID{ + WP_ID_DUMMY = 0, + WP_ID_ENCINFO, + WP_ID_DECTERMS, + WP_ID_DECWEIGHTS, + WP_ID_DECSAMPLES, + WP_ID_ENTROPY, + WP_ID_HYBRID, + WP_ID_SHAPING, + WP_ID_FLOATINFO, + WP_ID_INT32INFO, + WP_ID_DATA, + WP_ID_CORR, + WP_ID_FLT, + WP_ID_CHANINFO +}; + +#define MAX_TERMS 16 + +typedef struct Decorr { + int delta; + int value; + int weightA; + int weightB; + int samplesA[8]; + int samplesB[8]; +} Decorr; + +typedef struct WavpackContext { + AVCodecContext *avctx; + int stereo; + int joint; + uint32_t CRC; + GetBitContext gb; + int data_size; // in bits + int samples; + int median[6]; + int terms; + Decorr decorr[MAX_TERMS]; + int zero, one, zeroes; +} WavpackContext; + +// exponent table copied from WavPack source +static const uint8_t wp_exp2_table [256] = { + 0x00, 0x01, 0x01, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x06, 0x07, 0x08, 0x08, 0x09, 0x0a, 0x0b, + 0x0b, 0x0c, 0x0d, 0x0e, 0x0e, 0x0f, 0x10, 0x10, 0x11, 0x12, 0x13, 0x13, 0x14, 0x15, 0x16, 0x16, + 0x17, 0x18, 0x19, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1d, 0x1e, 0x1f, 0x20, 0x20, 0x21, 0x22, 0x23, + 0x24, 0x24, 0x25, 0x26, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3a, 0x3b, 0x3c, 0x3d, + 0x3e, 0x3f, 0x40, 0x41, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x48, 0x49, 0x4a, 0x4b, + 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, + 0x5b, 0x5c, 0x5d, 0x5e, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, + 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, + 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x87, 0x88, 0x89, 0x8a, + 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, + 0x9c, 0x9d, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, + 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, + 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc8, 0xc9, 0xca, 0xcb, 0xcd, 0xce, 0xcf, 0xd0, 0xd2, 0xd3, 0xd4, + 0xd6, 0xd7, 0xd8, 0xd9, 0xdb, 0xdc, 0xdd, 0xde, 0xe0, 0xe1, 0xe2, 0xe4, 0xe5, 0xe6, 0xe8, 0xe9, + 0xea, 0xec, 0xed, 0xee, 0xf0, 0xf1, 0xf2, 0xf4, 0xf5, 0xf6, 0xf8, 0xf9, 0xfa, 0xfc, 0xfd, 0xff +}; + +static av_always_inline int wp_exp2(int16_t val) +{ + int res, neg = 0; + + if(val < 0){ + val = -val; + neg = 1; + } + + res = wp_exp2_table[val & 0xFF] | 0x100; + val >>= 8; + res = (val > 9) ? (res << (val - 9)) : (res >> (9 - val)); + return neg ? -res : res; +} + +static inline int get_unary(GetBitContext *gb){ + int r=0; + while(get_bits1(gb) && r<33)r++; + return r; +} + +// macros for manipulating median values +#define GET_MED(n) ((median[n] >> 4) + 1) +#define DEC_MED(n) median[n] -= ((median[n] + (128>>n) - 2) / (128>>n)) * 2 +#define INC_MED(n) median[n] += ((median[n] + (128>>n)) / (128>>n)) * 5 + +// macros for applying weight +#define UPDATE_WEIGHT_CLIP(weight, delta, samples, in) \ + if(samples && in){ \ + if((samples ^ in) < 0){ \ + weight -= delta; \ + if(weight < -1024) weight = -1024; \ + }else{ \ + weight += delta; \ + if(weight > 1024) weight = 1024; \ + } \ + } + + +static av_always_inline int get_tail(GetBitContext *gb, int k) +{ + int p, e, res; + + if(k<1 || k>65535)return 0; + p = av_log2_16bit(k); + e = (1 << (p + 1)) - k - 1; + res = p ? get_bits(gb, p) : 0; + if(res >= e){ + res = (res<<1) - e + get_bits1(gb); + } + return res; +} + +static int wv_get_value(WavpackContext *ctx, GetBitContext *gb, int *median, int *last) +{ + int t, t2; + int sign, base, add, ret; + + *last = 0; + + if((ctx->median[0] < 2U) && (ctx->median[3] < 2U) && !ctx->zero && !ctx->one){ + if(ctx->zeroes){ + ctx->zeroes--; + if(ctx->zeroes) + return 0; + }else{ + t = get_unary(gb); + if(t >= 2) t = get_bits(gb, t - 1) | (1 << (t-1)); + ctx->zeroes = t; + if(ctx->zeroes){ + memset(ctx->median, 0, sizeof(ctx->median)); + return 0; + } + } + } + + if(get_bits_count(gb) >= ctx->data_size){ + *last = 1; + return 0; + } + + if(ctx->zero){ + t = 0; + ctx->zero = 0; + }else{ + t = get_unary(gb); + if(get_bits_count(gb) >= ctx->data_size){ + *last = 1; + return 0; + } + if(t == 16) { + t2 = get_unary(gb); + if(t2 < 2) t += t2; + else t += get_bits(gb, t2 - 1) | (1 << (t2 - 1)); + } + + if(ctx->one){ + ctx->one = t&1; + t = (t>>1) + 1; + }else{ + ctx->one = t&1; + t >>= 1; + } + ctx->zero = !ctx->one; + } + + if(!t){ + base = 0; + add = GET_MED(0) - 1; + DEC_MED(0); + }else if(t == 1){ + base = GET_MED(0); + add = GET_MED(1) - 1; + INC_MED(0); + DEC_MED(1); + }else if(t == 2){ + base = GET_MED(0) + GET_MED(1); + add = GET_MED(2) - 1; + INC_MED(0); + INC_MED(1); + DEC_MED(2); + }else{ + base = GET_MED(0) + GET_MED(1) + GET_MED(2) * (t - 2); + add = GET_MED(2) - 1; + INC_MED(0); + INC_MED(1); + INC_MED(2); + } + ret = base + get_tail(gb, add); + sign = get_bits1(gb); + return sign ? ~ret : ret; +} + +static int wv_unpack_stereo(WavpackContext *s, GetBitContext *gb, int16_t *dst) +{ + int i, j, count = 0; + int last, t; + int A, B, L, L2, R, R2; + int pos = 0; + uint32_t crc = 0xFFFFFFFF; + + s->one = s->zero = s->zeroes = 0; + do{ + L = wv_get_value(s, gb, s->median, &last); + if(last) break; + R = wv_get_value(s, gb, s->median + 3, &last); + if(last) break; + for(i = 0; i < s->terms; i++){ + t = s->decorr[i].value; + j = 0; + if(t > 0){ + if(t > 8){ + if(t & 1){ + A = 2 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1]; + B = 2 * s->decorr[i].samplesB[0] - s->decorr[i].samplesB[1]; + }else{ + A = (3 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1]) >> 1; + B = (3 * s->decorr[i].samplesB[0] - s->decorr[i].samplesB[1]) >> 1; + } + s->decorr[i].samplesA[1] = s->decorr[i].samplesA[0]; + s->decorr[i].samplesB[1] = s->decorr[i].samplesB[0]; + j = 0; + }else{ + A = s->decorr[i].samplesA[pos]; + B = s->decorr[i].samplesB[pos]; + j = (pos + t) & 7; + } + L2 = L + ((s->decorr[i].weightA * A + 512) >> 10); + R2 = R + ((s->decorr[i].weightB * B + 512) >> 10); + if(A && L) s->decorr[i].weightA -= ((((L ^ A) >> 30) & 2) - 1) * s->decorr[i].delta; + if(B && R) s->decorr[i].weightB -= ((((R ^ B) >> 30) & 2) - 1) * s->decorr[i].delta; + s->decorr[i].samplesA[j] = L = L2; + s->decorr[i].samplesB[j] = R = R2; + }else if(t == -1){ + L2 = L + ((s->decorr[i].weightA * s->decorr[i].samplesA[0] + 512) >> 10); + UPDATE_WEIGHT_CLIP(s->decorr[i].weightA, s->decorr[i].delta, s->decorr[i].samplesA[0], L); + L = L2; + R2 = R + ((s->decorr[i].weightB * L2 + 512) >> 10); + UPDATE_WEIGHT_CLIP(s->decorr[i].weightB, s->decorr[i].delta, L2, R); + R = R2; + s->decorr[i].samplesA[0] = R; + }else{ + R2 = R + ((s->decorr[i].weightB * s->decorr[i].samplesB[0] + 512) >> 10); + UPDATE_WEIGHT_CLIP(s->decorr[i].weightB, s->decorr[i].delta, s->decorr[i].samplesB[0], R); + R = R2; + + if(t == -3){ + R2 = s->decorr[i].samplesA[0]; + s->decorr[i].samplesA[0] = R; + } + + L2 = L + ((s->decorr[i].weightA * R2 + 512) >> 10); + UPDATE_WEIGHT_CLIP(s->decorr[i].weightA, s->decorr[i].delta, R2, L); + L = L2; + s->decorr[i].samplesB[0] = L; + } + } + pos = (pos + 1) & 7; + if(s->joint) + L += (R -= (L >> 1)); + crc = (crc * 3 + L) * 3 + R; + *dst++ = L; + *dst++ = R; + + count++; + }while(!last && count < s->samples); + + if(crc != s->CRC){ + av_log(s->avctx, AV_LOG_ERROR, "CRC error\n"); + return -1; + } + return count * 2; +} + +static int wv_unpack_mono(WavpackContext *s, GetBitContext *gb, int16_t *dst) +{ + int i, j, count = 0; + int last, t; + int A, S, T; + int pos = 0; + uint32_t crc = 0xFFFFFFFF; + + s->one = s->zero = s->zeroes = 0; + do{ + T = wv_get_value(s, gb, s->median, &last); + S = 0; + if(last) break; + for(i = 0; i < s->terms; i++){ + t = s->decorr[i].value; + if(t > 8){ + if(t & 1) + A = 2 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1]; + else + A = (3 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1]) >> 1; + s->decorr[i].samplesA[1] = s->decorr[i].samplesA[0]; + j = 0; + }else{ + A = s->decorr[i].samplesA[pos]; + j = (pos + t) & 7; + } + S = T + ((s->decorr[i].weightA * A + 512) >> 10); + if(A && T) s->decorr[i].weightA -= ((((T ^ A) >> 30) & 2) - 1) * s->decorr[i].delta; + s->decorr[i].samplesA[j] = T = S; + } + pos = (pos + 1) & 7; + crc = crc * 3 + S; + *dst++ = S; + count++; + }while(!last && count < s->samples); + + if(crc != s->CRC){ + av_log(s->avctx, AV_LOG_ERROR, "CRC error\n"); + return -1; + } + return count; +} + +static int wavpack_decode_init(AVCodecContext *avctx) +{ + WavpackContext *s = avctx->priv_data; + + s->avctx = avctx; + s->stereo = (avctx->channels == 2); + + return 0; +} + +static int wavpack_decode_close(AVCodecContext *avctx) +{ +// WavpackContext *s = avctx->priv_data; + + return 0; +} + +static int wavpack_decode_frame(AVCodecContext *avctx, + void *data, int *data_size, + uint8_t *buf, int buf_size) +{ + WavpackContext *s = avctx->priv_data; + int16_t *samples = data; + int samplecount; + int got_terms = 0, got_weights = 0, got_samples = 0, got_entropy = 0, got_bs = 0; + uint8_t* buf_end = buf + buf_size; + int i, j, id, size, ssize, weights, t; + + if (buf_size == 0) return 0; + + memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr)); + + s->samples = LE_32(buf); buf += 4; + if(!s->samples) return buf_size; + /* should not happen but who knows */ + if(s->samples * 2 * avctx->channels > AVCODEC_MAX_AUDIO_FRAME_SIZE){ + av_log(avctx, AV_LOG_ERROR, "Packet size is too big to be handled in lavc!\n"); + return -1; + } + s->joint = LE_32(buf) & WV_JOINT; buf += 4; + s->CRC = LE_32(buf); buf += 4; + // parse metadata blocks + while(buf < buf_end){ + id = *buf++; + size = *buf++; + if(id & WP_IDF_LONG) { + size |= (*buf++) << 8; + size |= (*buf++) << 16; + } + size <<= 1; // size is specified in words + ssize = size; + if(id & WP_IDF_ODD) size--; + if(size < 0){ + av_log(avctx, AV_LOG_ERROR, "Got incorrect block %02X with size %i\n", id, size); + break; + } + if(buf + ssize > buf_end){ + av_log(avctx, AV_LOG_ERROR, "Block size %i is out of bounds\n", size); + break; + } + if(id & WP_IDF_IGNORE){ + buf += ssize; + continue; + } + switch(id & WP_IDF_MASK){ + case WP_ID_DECTERMS: + s->terms = size; + if(s->terms > MAX_TERMS){ + av_log(avctx, AV_LOG_ERROR, "Too many decorrelation terms\n"); + buf += ssize; + continue; + } + for(i = 0; i < s->terms; i++) { + s->decorr[s->terms - i - 1].value = (*buf & 0x1F) - 5; + s->decorr[s->terms - i - 1].delta = *buf >> 5; + buf++; + } + got_terms = 1; + break; + case WP_ID_DECWEIGHTS: + if(!got_terms){ + av_log(avctx, AV_LOG_ERROR, "No decorrelation terms met\n"); + continue; + } + weights = size >> s->stereo; + if(weights > MAX_TERMS || weights > s->terms){ + av_log(avctx, AV_LOG_ERROR, "Too many decorrelation weights\n"); + buf += ssize; + continue; + } + for(i = 0; i < weights; i++) { + t = (int8_t)(*buf++); + s->decorr[s->terms - i - 1].weightA = t << 3; + if(s->decorr[s->terms - i - 1].weightA > 0) + s->decorr[s->terms - i - 1].weightA += (s->decorr[s->terms - i - 1].weightA + 64) >> 7; + if(s->stereo){ + t = (int8_t)(*buf++); + s->decorr[s->terms - i - 1].weightB = t << 3; + if(s->decorr[s->terms - i - 1].weightB > 0) + s->decorr[s->terms - i - 1].weightB += (s->decorr[s->terms - i - 1].weightB + 64) >> 7; + } + } + got_weights = 1; + break; + case WP_ID_DECSAMPLES: + if(!got_terms){ + av_log(avctx, AV_LOG_ERROR, "No decorrelation terms met\n"); + continue; + } + t = 0; + for(i = s->terms - 1; (i >= 0) && (t < size); i--) { + if(s->decorr[i].value > 8){ + s->decorr[i].samplesA[0] = wp_exp2(LE_16(buf)); buf += 2; + s->decorr[i].samplesA[1] = wp_exp2(LE_16(buf)); buf += 2; + if(s->stereo){ + s->decorr[i].samplesB[0] = wp_exp2(LE_16(buf)); buf += 2; + s->decorr[i].samplesB[1] = wp_exp2(LE_16(buf)); buf += 2; + t += 4; + } + t += 4; + }else if(s->decorr[i].value < 0){ + s->decorr[i].samplesA[0] = wp_exp2(LE_16(buf)); buf += 2; + s->decorr[i].samplesB[0] = wp_exp2(LE_16(buf)); buf += 2; + t += 4; + }else{ + for(j = 0; j < s->decorr[i].value; j++){ + s->decorr[i].samplesA[j] = wp_exp2(LE_16(buf)); buf += 2; + if(s->stereo){ + s->decorr[i].samplesB[j] = wp_exp2(LE_16(buf)); buf += 2; + } + } + t += s->decorr[i].value * 2 * avctx->channels; + } + } + got_samples = 1; + break; + case WP_ID_ENTROPY: + if(size != 6 * avctx->channels){ + av_log(avctx, AV_LOG_ERROR, "Entropy vars size should be %i, got %i", 6 * avctx->channels, size); + buf += ssize; + continue; + } + for(i = 0; i < 3 * avctx->channels; i++){ + s->median[i] = wp_exp2(LE_16(buf)); + buf += 2; + } + got_entropy = 1; + break; + case WP_ID_DATA: + init_get_bits(&s->gb, buf, size * 8); + s->data_size = size * 8; + buf += size; + got_bs = 1; + break; + default: + buf += size; + } + if(id & WP_IDF_ODD) buf++; + } + if(!got_terms){ + av_log(avctx, AV_LOG_ERROR, "No block with decorrelation terms\n"); + return -1; + } + if(!got_weights){ + av_log(avctx, AV_LOG_ERROR, "No block with decorrelation weights\n"); + return -1; + } + if(!got_samples){ + av_log(avctx, AV_LOG_ERROR, "No block with decorrelation samples\n"); + return -1; + } + if(!got_entropy){ + av_log(avctx, AV_LOG_ERROR, "No block with entropy info\n"); + return -1; + } + if(!got_bs){ + av_log(avctx, AV_LOG_ERROR, "Packed samples not found\n"); + return -1; + } + + if(s->stereo) + samplecount = wv_unpack_stereo(s, &s->gb, samples); + else + samplecount = wv_unpack_mono(s, &s->gb, samples); + *data_size = samplecount * 2; + + return buf_size; +} + +AVCodec wavpack_decoder = { + "wavpack", + CODEC_TYPE_AUDIO, + CODEC_ID_WAVPACK, + sizeof(WavpackContext), + wavpack_decode_init, + NULL, + wavpack_decode_close, + wavpack_decode_frame, +}; -- cgit v1.2.3 From bca4db4fc122805b7de468f8962e2e0a37a250b7 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 14 Jan 2007 16:48:46 +0000 Subject: Link fix for the directfb plugin. CVS patchset: 8506 CVS date: 2007/01/14 16:48:46 --- src/video_out/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index 58c6b96ad..ecb6add29 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -156,7 +156,7 @@ xineplug_vo_out_fb_la_CFLAGS = $(VISIBILITY_FLAG) $(MLIB_CFLAGS) xineplug_vo_out_fb_la_LDFLAGS = -avoid-version -module xineplug_vo_out_directfb_la_SOURCES = video_out_directfb.c $(X11OSD) -xineplug_vo_out_directfb_la_LIBADD = $(XINE_LIB) $(DIRECTFB_LIBS) $(X_LIBS) $(THREAD_LIBS) +xineplug_vo_out_directfb_la_LIBADD = $(XINE_LIB) $(DIRECTFB_LIBS) $(X_LIBS) -lXext $(THREAD_LIBS) xineplug_vo_out_directfb_la_CFLAGS = $(VISIBILITY_FLAG) $(DIRECTFB_CFLAGS) -fno-strict-aliasing xineplug_vo_out_directfb_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From 793816cfd30d99a2aacc914cd71922c17cad1d37 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Sun, 14 Jan 2007 16:53:37 +0000 Subject: Added BUF_VIDEO_VP6F (Flash VP6). The only difference with the standard VP6 codec is that the image is not flipped upside-down. CVS patchset: 8507 CVS date: 2007/01/14 16:53:37 --- src/libffmpeg/video_decoder.c | 4 +++- src/xine-engine/buffer.h | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libffmpeg/video_decoder.c b/src/libffmpeg/video_decoder.c index b019d52d3..f4bde4cde 100644 --- a/src/libffmpeg/video_decoder.c +++ b/src/libffmpeg/video_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_decoder.c,v 1.65 2007/01/13 21:19:52 miguelfreitas Exp $ + * $Id: video_decoder.c,v 1.66 2007/01/14 16:53:37 klan Exp $ * * xine video decoder plugin using ffmpeg * @@ -263,6 +263,7 @@ static const ff_codec_t ff_video_lookup[] = { {BUF_VIDEO_VP31, CODEC_ID_VP3, "On2 VP3.1 (ffmpeg)"}, {BUF_VIDEO_VP5, CODEC_ID_VP5, "On2 VP5 (ffmpeg)"}, {BUF_VIDEO_VP6, CODEC_ID_VP6, "On2 VP6 (ffmpeg)"}, + {BUF_VIDEO_VP6F, CODEC_ID_VP6F, "On2 VP6 (ffmepg)"}, {BUF_VIDEO_4XM, CODEC_ID_4XM, "4X Video (ffmpeg)"}, {BUF_VIDEO_CINEPAK, CODEC_ID_CINEPAK, "Cinepak (ffmpeg)"}, {BUF_VIDEO_MSVC, CODEC_ID_MSVIDEO1, "Microsoft Video 1 (ffmpeg)"}, @@ -1595,6 +1596,7 @@ static uint32_t supported_video_types[] = { #endif #ifdef CONFIG_VP6_DECODER BUF_VIDEO_VP6, + BUF_VIDEO_VP6F, #endif #ifdef CONFIG_4XM_DECODER BUF_VIDEO_4XM, diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h index 22e1a7a04..64fe52a20 100644 --- a/src/xine-engine/buffer.h +++ b/src/xine-engine/buffer.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: buffer.h,v 1.161 2006/12/26 03:18:56 dgp85 Exp $ + * $Id: buffer.h,v 1.162 2007/01/14 16:53:37 klan Exp $ * * * contents: @@ -190,6 +190,7 @@ extern "C" { #define BUF_VIDEO_KMVC 0x02600000 #define BUF_VIDEO_FLASHSV 0x02610000 #define BUF_VIDEO_CAVS 0x02620000 +#define BUF_VIDEO_VP6F 0x02630000 /* audio buffer types: (please keep in sync with buffer_types.c) */ -- cgit v1.2.3 From e940b37e15c0b3510eb04f7642c71cc1a7ad9de2 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Sun, 14 Jan 2007 16:55:25 +0000 Subject: Support VP6 video. CVS patchset: 8508 CVS date: 2007/01/14 16:55:25 --- src/demuxers/demux_flv.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 3e8837800..5de179142 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -20,11 +20,13 @@ /* * Flash Video (.flv) File Demuxer - * by Mike Melanson (melanson@pcisys.net) and Claudio Ciccani (klan@directfb.org) + * by Mike Melanson (melanson@pcisys.net) and + * Claudio Ciccani (klan@directfb.org) + * * For more information on the FLV file format, visit: * http://download.macromedia.com/pub/flash/flash_file_format_specification.pdf * - * $Id: demux_flv.c,v 1.14 2006/12/23 14:43:16 klan Exp $ + * $Id: demux_flv.c,v 1.15 2007/01/14 16:55:25 klan Exp $ */ #ifdef HAVE_CONFIG_H @@ -42,7 +44,6 @@ /* #define LOG */ - #include "xine_internal.h" #include "xineutils.h" #include "compat.h" @@ -177,7 +178,7 @@ static int open_flv_file(demux_flv_t *this) { this->input->seek(this->input, this->start, SEEK_SET); lprintf(" qualified FLV file, repositioned @ offset 0x%" PRIxMAX "\n", - (intmax_t)this->movie_start); + (intmax_t)this->start); return 1; } @@ -239,6 +240,8 @@ static int parse_flv_var(demux_flv_t *this, unsigned char *buf, int size, char * len = parse_flv_var(this, tmp, end-tmp, str); tmp += len; } + if (*tmp++ != FLV_DATA_TYPE_ENDOBJECT) + return 0; break; case FLV_DATA_TYPE_ECMARRAY: lprintf(" got EMCA array (%d indices)\n", BE_32(tmp)); @@ -379,9 +382,21 @@ static int read_flv_packet(demux_flv_t *this) { buf_type = BUF_VIDEO_FLV1; break; case FLV_VIDEO_FORMAT_VP6: - /* FIXME: we need ffmpeg's vp6 codec */ - /*buf_type = BUF_VIDEO_VP6; - break;*/ + buf_type = BUF_VIDEO_VP6F; + /* skip VP6 packet header */ + if (remaining_bytes >= 1) { + this->input->seek (this->input, 1, SEEK_CUR); + remaining_bytes--; + } + break; + case FLV_VIDEO_FORMAT_VP6A: + buf_type = BUF_VIDEO_VP6F; + /* skip VP6A packet header */ + if (remaining_bytes >= 4) { + this->input->seek (this->input, 4, SEEK_CUR); + remaining_bytes -= 4; + } + break; default: lprintf(" unsupported video format (%d)...\n", buffer[0] & 0x0F); buf_type = BUF_VIDEO_UNKNOWN; -- cgit v1.2.3 From de1fe205c416eacd62b515d98f198403f32cc8f2 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 14 Jan 2007 17:16:14 +0000 Subject: Remove ffmpeg_config.h on "make distclean". CVS patchset: 8509 CVS date: 2007/01/14 17:16:14 --- src/libffmpeg/Makefile.am | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/libffmpeg/Makefile.am b/src/libffmpeg/Makefile.am index bcae2c505..9fef0b59c 100644 --- a/src/libffmpeg/Makefile.am +++ b/src/libffmpeg/Makefile.am @@ -12,6 +12,9 @@ link_ffmpeg = \ SUBDIRS = libavcodec libavutil endif +# ffmpeg_config.h is generated by configure +DISTCLEANFILES = ffmpeg_config.h + # this must always be included, even if the current machine has no DXR3... EXTRA_DIST = xine_encoder.c diff_to_ffmpeg_cvs.txt -- cgit v1.2.3 From f566f68582d98325035a4e1bac4f273bdb93c88d Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 14 Jan 2007 19:16:18 +0000 Subject: Fix build on amd64 - both ARCH_X86 and ARCH_X86_64 are defined. CVS patchset: 8510 CVS date: 2007/01/14 19:16:18 --- src/post/deinterlace/plugins/x86-64_macros.inc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/post/deinterlace/plugins/x86-64_macros.inc b/src/post/deinterlace/plugins/x86-64_macros.inc index 3dfd9b63a..b52227763 100644 --- a/src/post/deinterlace/plugins/x86-64_macros.inc +++ b/src/post/deinterlace/plugins/x86-64_macros.inc @@ -34,8 +34,7 @@ #ifndef XAX -#if defined (ARCH_X86) - +#if defined (ARCH_X86) && !defined (ARCH_X86_64) #define XAX "eax" #define XBX "ebx" #define XCX "ecx" @@ -55,7 +54,6 @@ #define SUBX "subl" #elif defined (ARCH_X86_64) - #define XAX "rax" #define XBX "rbx" #define XCX "rcx" -- cgit v1.2.3 From 24c2ff9afebbcc577c6bd42b27146f28ae3f0636 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Mon, 15 Jan 2007 21:27:34 +0000 Subject: this->context may be NULL - avoid dereferencing it (and segfaulting) if it is. CVS patchset: 8511 CVS date: 2007/01/15 21:27:34 --- src/libffmpeg/video_decoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libffmpeg/video_decoder.c b/src/libffmpeg/video_decoder.c index f4bde4cde..467575187 100644 --- a/src/libffmpeg/video_decoder.c +++ b/src/libffmpeg/video_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_decoder.c,v 1.66 2007/01/14 16:53:37 klan Exp $ + * $Id: video_decoder.c,v 1.67 2007/01/15 21:27:34 dsalt Exp $ * * xine video decoder plugin using ffmpeg * @@ -430,7 +430,7 @@ static void pp_change_quality (ff_video_decoder_t *this) { this->pp_quality = this->class->pp_quality; if(this->pp_available && this->pp_quality) { - if(!this->pp_context) + if(!this->pp_context && this->context) this->pp_context = pp_get_context(this->context->width, this->context->height, this->pp_flags); if(this->pp_mode) -- cgit v1.2.3 From 88c6126310edffa4d5b7813c2fad08ef2fd21e16 Mon Sep 17 00:00:00 2001 From: Mathieu Olivier Date: Mon, 15 Jan 2007 22:52:33 +0000 Subject: Fixed a couple of typos CVS patchset: 8512 CVS date: 2007/01/15 22:52:33 --- src/libffmpeg/video_decoder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/libffmpeg/video_decoder.c b/src/libffmpeg/video_decoder.c index 467575187..3dabdf59c 100644 --- a/src/libffmpeg/video_decoder.c +++ b/src/libffmpeg/video_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_decoder.c,v 1.67 2007/01/15 21:27:34 dsalt Exp $ + * $Id: video_decoder.c,v 1.68 2007/01/15 22:52:33 molivier Exp $ * * xine video decoder plugin using ffmpeg * @@ -249,7 +249,7 @@ static const ff_codec_t ff_video_lookup[] = { {BUF_VIDEO_3IVX, CODEC_ID_MPEG4, "ISO MPEG-4 (3ivx, ffmpeg)"}, {BUF_VIDEO_JPEG, CODEC_ID_MJPEG, "Motion JPEG (ffmpeg)"}, {BUF_VIDEO_MJPEG, CODEC_ID_MJPEG, "Motion JPEG (ffmpeg)"}, - {BUF_VIDEO_MJPEG_B, CODEC_ID_MJPEGB, "Motion JPEG B (ffmpeg"}, + {BUF_VIDEO_MJPEG_B, CODEC_ID_MJPEGB, "Motion JPEG B (ffmpeg)"}, {BUF_VIDEO_I263, CODEC_ID_H263I, "ITU H.263 (ffmpeg)"}, {BUF_VIDEO_H263, CODEC_ID_H263, "H.263 (ffmpeg)"}, {BUF_VIDEO_RV10, CODEC_ID_RV10, "Real Video 1.0 (ffmpeg)"}, @@ -263,7 +263,7 @@ static const ff_codec_t ff_video_lookup[] = { {BUF_VIDEO_VP31, CODEC_ID_VP3, "On2 VP3.1 (ffmpeg)"}, {BUF_VIDEO_VP5, CODEC_ID_VP5, "On2 VP5 (ffmpeg)"}, {BUF_VIDEO_VP6, CODEC_ID_VP6, "On2 VP6 (ffmpeg)"}, - {BUF_VIDEO_VP6F, CODEC_ID_VP6F, "On2 VP6 (ffmepg)"}, + {BUF_VIDEO_VP6F, CODEC_ID_VP6F, "On2 VP6 (ffmpeg)"}, {BUF_VIDEO_4XM, CODEC_ID_4XM, "4X Video (ffmpeg)"}, {BUF_VIDEO_CINEPAK, CODEC_ID_CINEPAK, "Cinepak (ffmpeg)"}, {BUF_VIDEO_MSVC, CODEC_ID_MSVIDEO1, "Microsoft Video 1 (ffmpeg)"}, -- cgit v1.2.3 From 22bb23b9d3ed75affddc3d9277c54adb4b01ff22 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Tue, 16 Jan 2007 16:00:26 +0000 Subject: avoid division by zero. still need to investigate the cause, might be due to pause when using net_buf_ctrl CVS patchset: 8513 CVS date: 2007/01/16 16:00:26 --- src/xine-engine/video_out.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 446ba0a45..f6788d6b2 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out.c,v 1.226 2007/01/10 20:13:14 miguelfreitas Exp $ + * $Id: video_out.c,v 1.227 2007/01/16 16:00:26 miguelfreitas Exp $ * * frame allocation / queuing / scheduling / output functions */ @@ -1195,7 +1195,7 @@ static void *video_out_loop (void *this_gen) { if (this->clock->speed == XINE_SPEED_PAUSE) paused_loop (this, vpts); - if (next_frame_vpts) { + if (next_frame_vpts && this->clock->speed > 0) { usec_to_sleep = (next_frame_vpts - vpts) * 100 * XINE_FINE_SPEED_NORMAL / (9 * this->clock->speed); } else { /* we don't know when the next frame is due, only wait a little */ -- cgit v1.2.3 From c859b8ced3df97eb2c6f09213062449569510f7a Mon Sep 17 00:00:00 2001 From: Matthias Hopf Date: Thu, 18 Jan 2007 11:57:16 +0000 Subject: Fix comparing char* pointer with a string literal. CVS patchset: 8515 CVS date: 2007/01/18 11:57:16 --- src/libsputext/demux_sputext.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libsputext/demux_sputext.c b/src/libsputext/demux_sputext.c index db0b826de..13fbd1db1 100644 --- a/src/libsputext/demux_sputext.c +++ b/src/libsputext/demux_sputext.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_sputext.c,v 1.50 2006/12/08 16:26:10 mshopf Exp $ + * $Id: demux_sputext.c,v 1.51 2007/01/18 11:57:16 mshopf Exp $ * * code based on old libsputext/xine_decoder.c * @@ -727,7 +727,7 @@ static subtitle_t *sub_read_line_aqt (demux_sputext_t *this, subtitle_t *current sub_readtext((char *) &line,¤t->text[1]); current->lines = 2; - if ((current->text[0]=="") && (current->text[1]=="")) { + if ((current->text[0][0]==0) && (current->text[1][0]==0)) { return NULL; } -- cgit v1.2.3 From c1211fe2afb92756a911e82d4471daa662c11778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 18 Jan 2007 21:06:26 +0000 Subject: Mark pointers as const wherever possible, as an extra safety. Code generation isn't changing. CVS patchset: 8517 CVS date: 2007/01/18 21:06:26 --- src/demuxers/demux_wavpack.c | 91 ++++++++++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_wavpack.c b/src/demuxers/demux_wavpack.c index 7bde518e9..c1433a956 100644 --- a/src/demuxers/demux_wavpack.c +++ b/src/demuxers/demux_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò * - * $Id: demux_wavpack.c,v 1.2 2006/12/26 14:28:48 dgp85 Exp $ + * $Id: demux_wavpack.c,v 1.3 2007/01/18 21:06:26 dgp85 Exp $ */ #define LOG_MODULE "demux_wavpack" @@ -81,23 +81,30 @@ typedef struct { # endif #endif -static int32_t xine_input_read_bytes(input_plugin_t *this, void *data, int32_t bcount) { +static int32_t xine_input_read_bytes(void *const this_gen, void *const data, + const int32_t bcount) { + input_plugin_t *const this = (input_plugin_t*)this_gen; return this->read(this, data, bcount); } -static uint32_t xine_input_get_pos(input_plugin_t *this) { +static uint32_t xine_input_get_pos(void *const this_gen) { + input_plugin_t *const this = (input_plugin_t*)this_gen; return this->get_current_pos(this); } -static int xine_input_set_pos_abs(input_plugin_t *this, uint32_t pos) { +static int xine_input_set_pos_abs(void *const this_gen, const uint32_t pos) { + input_plugin_t *const this = (input_plugin_t*)this_gen; return this->seek(this, pos, SEEK_SET); } -static int xine_input_set_pos_rel(input_plugin_t *this, int32_t delta, int mode) { +static int xine_input_set_pos_rel(void *const this_gen, const int32_t delta, + const int mode) { + input_plugin_t *const this = (input_plugin_t*)this_gen; return this->seek(this, delta, mode); } -static int xine_input_push_back_byte(input_plugin_t *this, int c) { +static int xine_input_push_back_byte(void *const this_gen, const int c) { + input_plugin_t *const this = (input_plugin_t*)this_gen; if ( this->seek(this, -1, SEEK_CUR) ) { return c; } else { @@ -106,20 +113,24 @@ static int xine_input_push_back_byte(input_plugin_t *this, int c) { } } -static uint32_t xine_input_get_length(input_plugin_t *this) { +static uint32_t xine_input_get_length(void *const this_gen) { + input_plugin_t *const this = (input_plugin_t*)this_gen; return this->get_length(this); } -static int xine_input_can_seek(input_plugin_t *this) { +static int xine_input_can_seek(void *const this_gen) { + input_plugin_t *const this = (input_plugin_t*)this_gen; return INPUT_IS_SEEKABLE(this); } -static int32_t xine_input_write_bytes(__unused void *id, __unused void *data, __unused int32_t bcount) { +static int32_t xine_input_write_bytes(__unused void *const id, + __unused void *const data, + __unused const int32_t bcount) { lprintf("xine_input_write_bytes: acces is read-only.\n"); return 0; } -static const WavpackStreamReader wavpack_input_reader = { +static WavpackStreamReader wavpack_input_reader = { .read_bytes = xine_input_read_bytes, .get_pos = xine_input_get_pos, .set_pos_abs = xine_input_set_pos_abs, @@ -130,7 +141,7 @@ static const WavpackStreamReader wavpack_input_reader = { .write_bytes = xine_input_write_bytes }; -static int open_wv_file(demux_wv_t *this) { +static int open_wv_file(demux_wv_t *const this) { WavpackContext *ctx = NULL; char error[256]; /* Current version of wavpack (4.31) does not write more than this */ @@ -177,8 +188,8 @@ static int open_wv_file(demux_wv_t *this) { return 1; } -static int demux_wv_send_chunk(demux_plugin_t *this_gen) { - demux_wv_t *this = (demux_wv_t *) this_gen; +static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { + demux_wv_t *const this = (demux_wv_t *) this_gen; uint32_t bytes_to_read; /* Check if we've finished */ @@ -241,8 +252,8 @@ static int demux_wv_send_chunk(demux_plugin_t *this_gen) { return this->status; } -static void demux_wv_send_headers(demux_plugin_t *this_gen) { - demux_wv_t *this = (demux_wv_t *) this_gen; +static void demux_wv_send_headers(demux_plugin_t *const this_gen) { + demux_wv_t *const this = (demux_wv_t *) this_gen; buf_element_t *buf; this->audio_fifo = this->stream->audio_fifo; @@ -273,7 +284,7 @@ static void demux_wv_send_headers(demux_plugin_t *this_gen) { static int demux_wv_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { - demux_wv_t *this = (demux_wv_t *) this_gen; + demux_wv_t *const this = (demux_wv_t *) this_gen; /* If thread is not running, initialize demuxer */ if( !playing ) { @@ -287,37 +298,37 @@ static int demux_wv_seek (demux_plugin_t *this_gen, return this->status; } -static void demux_wv_dispose (demux_plugin_t *this_gen) { - demux_wv_t *this = (demux_wv_t *) this_gen; +static void demux_wv_dispose (demux_plugin_t *const this_gen) { + demux_wv_t *const this = (demux_wv_t *) this_gen; free(this); } -static int demux_wv_get_status (demux_plugin_t *this_gen) { - demux_wv_t *this = (demux_wv_t *) this_gen; +static int demux_wv_get_status (demux_plugin_t *const this_gen) { + const demux_wv_t *const this = (const demux_wv_t *) this_gen; return this->status; } -static int demux_wv_get_stream_length (demux_plugin_t *this_gen) { +static int demux_wv_get_stream_length (demux_plugin_t *const this_gen) { // demux_wv_t *this = (demux_wv_t *) this_gen; return 0; } -static uint32_t demux_wv_get_capabilities(demux_plugin_t *this_gen) { +static uint32_t demux_wv_get_capabilities(demux_plugin_t *const this_gen) { return DEMUX_CAP_NOCAP; } -static int demux_wv_get_optional_data(demux_plugin_t *this_gen, - void *data, int data_type) { +static int demux_wv_get_optional_data(demux_plugin_t *const this_gen, + void *data, const int data_type) { return DEMUX_OPTIONAL_UNSUPPORTED; } -static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *stream, - input_plugin_t *input) { - demux_wv_t *this; - this = xine_xmalloc (sizeof (demux_wv_t)); +static demux_plugin_t *open_plugin (demux_class_t *const class_gen, + xine_stream_t *const stream, + input_plugin_t *const input) { + demux_wv_t *const this = xine_xmalloc (sizeof (demux_wv_t)); this->stream = stream; this->input = input; @@ -335,10 +346,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; - - mrl = input->get_mrl (input); - extensions = class_gen->get_extensions (class_gen); + char *const mrl = input->get_mrl (input); + char *const extensions = class_gen->get_extensions (class_gen); if (!_x_demux_check_extension (mrl, extensions)) { free (this); @@ -365,32 +374,30 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static char *get_description (demux_class_t *const this_gen) { return "Wavpack demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static char *get_identifier (demux_class_t *const this_gen) { return "Wavpack"; } -static char *get_extensions (demux_class_t *this_gen) { +static char *get_extensions (demux_class_t *const this_gen) { return "wv"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static char *get_mimetypes (demux_class_t *const this_gen) { return NULL; } -static void class_dispose (demux_class_t *this_gen) { - demux_wv_class_t *this = (demux_wv_class_t *) this_gen; +static void class_dispose (demux_class_t *const this_gen) { + demux_wv_class_t *const this = (demux_wv_class_t *) this_gen; free (this); } -static void *demux_wv_init_plugin (xine_t *xine, void *data) { - demux_wv_class_t *this; - - this = xine_xmalloc (sizeof (demux_wv_class_t)); +static void *demux_wv_init_plugin (xine_t *const xine, void *const data) { + demux_wv_class_t *const this = xine_xmalloc (sizeof (demux_wv_class_t)); this->demux_class.open_plugin = open_plugin; this->demux_class.get_description = get_description; -- cgit v1.2.3 From 4c76831ce7f58c28b4fc07e3879e5334142e073c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 18 Jan 2007 21:34:10 +0000 Subject: __attribute__(packed) is used on the struct, not on its members. CVS patchset: 8518 CVS date: 2007/01/18 21:34:10 --- src/libxineadec/nosefart/nsf.h | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/libxineadec/nosefart/nsf.h b/src/libxineadec/nosefart/nsf.h index 61cc14f60..163e2f62f 100644 --- a/src/libxineadec/nosefart/nsf.h +++ b/src/libxineadec/nosefart/nsf.h @@ -20,7 +20,7 @@ ** nsf.h ** ** NSF loading/saving related defines / prototypes -** $Id: nsf.h,v 1.2 2003/12/05 15:55:01 f1rmb Exp $ +** $Id: nsf.h,v 1.3 2007/01/18 21:34:10 dgp85 Exp $ */ #ifndef _NSF_H_ @@ -66,22 +66,22 @@ enum typedef struct nsf_s { /* NESM header */ - uint8 id[5] __PACKED__; /* NESM\x1A */ - uint8 version __PACKED__; /* spec version */ - uint8 num_songs __PACKED__; /* total num songs */ - uint8 start_song __PACKED__; /* first song */ - uint16 load_addr __PACKED__; /* loc to load code */ - uint16 init_addr __PACKED__; /* init call address */ - uint16 play_addr __PACKED__; /* play call address */ - uint8 song_name[32] __PACKED__; /* name of song */ - uint8 artist_name[32] __PACKED__; /* artist name */ - uint8 copyright[32] __PACKED__; /* copyright info */ - uint16 ntsc_speed __PACKED__; /* playback speed (if NTSC) */ - uint8 bankswitch_info[8] __PACKED__; /* initial code banking */ - uint16 pal_speed __PACKED__; /* playback speed (if PAL) */ - uint8 pal_ntsc_bits __PACKED__; /* NTSC/PAL determination bits */ - uint8 ext_sound_type __PACKED__; /* type of external sound gen. */ - uint8 reserved[4] __PACKED__; /* reserved */ + uint8 id[5]; /* NESM\x1A */ + uint8 version; /* spec version */ + uint8 num_songs; /* total num songs */ + uint8 start_song; /* first song */ + uint16 load_addr; /* loc to load code */ + uint16 init_addr; /* init call address */ + uint16 play_addr; /* play call address */ + uint8 song_name[32]; /* name of song */ + uint8 artist_name[32]; /* artist name */ + uint8 copyright[32]; /* copyright info */ + uint16 ntsc_speed; /* playback speed (if NTSC) */ + uint8 bankswitch_info[8]; /* initial code banking */ + uint16 pal_speed; /* playback speed (if PAL) */ + uint8 pal_ntsc_bits; /* NTSC/PAL determination bits */ + uint8 ext_sound_type; /* type of external sound gen. */ + uint8 reserved[4]; /* reserved */ /* things that the NSF player needs */ uint8 *data; /* actual NSF data */ @@ -96,7 +96,7 @@ typedef struct nsf_s /* our main processing routine, calls all external mixing routines */ void (*process)(void *buffer, int num_samples); -} nsf_t; +} __PACKED__ nsf_t; /* Function prototypes */ extern void nsf_init(void); @@ -114,6 +114,9 @@ extern void nsf_setfilter(nsf_t *nsf, int filter_type); /* ** $Log: nsf.h,v $ +** Revision 1.3 2007/01/18 21:34:10 dgp85 +** __attribute__(packed) is used on the struct, not on its members. +** ** Revision 1.2 2003/12/05 15:55:01 f1rmb ** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... ** -- cgit v1.2.3 From 45c71725f5672cd446652f93184a8a6c48c8b0e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 18 Jan 2007 23:02:18 +0000 Subject: Make get_description function return a const char * rather than just a char *, so that 'return "something"' is valid. Note that _()/gettext() returns a char * but statically allocated, that the documentation considers constant. CVS patchset: 8519 CVS date: 2007/01/18 23:02:18 --- src/input/input_cdda.c | 4 ++-- src/input/input_dvb.c | 2 +- src/input/input_dvd.c | 4 ++-- src/input/input_file.c | 4 ++-- src/input/input_gnome_vfs.c | 4 ++-- src/input/input_http.c | 4 ++-- src/input/input_mms.c | 4 ++-- src/input/input_net.c | 4 ++-- src/input/input_plugin.h | 4 ++-- src/input/input_pnm.c | 2 +- src/input/input_pvr.c | 4 ++-- src/input/input_rtp.c | 2 +- src/input/input_rtsp.c | 2 +- src/input/input_stdin_fifo.c | 4 ++-- src/input/input_vcd.c | 4 ++-- 15 files changed, 26 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index 7ee2e7899..3733172e5 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -20,7 +20,7 @@ * Compact Disc Digital Audio (CDDA) Input Plugin * by Mike Melanson (melanson@pcisys.net) * - * $Id: input_cdda.c,v 1.91 2006/12/19 19:10:51 dsalt Exp $ + * $Id: input_cdda.c,v 1.92 2007/01/18 23:02:18 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -2623,7 +2623,7 @@ static const char *cdda_class_get_identifier (input_class_t *this_gen) { return "cdda"; } -static char *cdda_class_get_description (input_class_t *this_gen) { +static const char *cdda_class_get_description (input_class_t *this_gen) { return _("CD Digital Audio (aka. CDDA)"); } diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index dbec9ff17..3bc9008a7 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -3085,7 +3085,7 @@ static input_plugin_t *dvb_class_get_instance (input_class_t *class_gen, * dvb input plugin class stuff */ -static char *dvb_class_get_description (input_class_t *this_gen) { +static const char *dvb_class_get_description (input_class_t *this_gen) { return _("DVB (Digital TV) input plugin"); } diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index ddc3fe964..6a8315ce1 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_dvd.c,v 1.212 2006/12/19 19:10:51 dsalt Exp $ + * $Id: input_dvd.c,v 1.213 2007/01/18 23:02:18 dgp85 Exp $ * */ @@ -1680,7 +1680,7 @@ static input_plugin_t *dvd_class_get_instance (input_class_t *class_gen, xine_st return &this->input_plugin; } -static char *dvd_class_get_description (input_class_t *this_gen) { +static const char *dvd_class_get_description (input_class_t *this_gen) { trace_print("Called\n"); return "DVD Navigator"; diff --git a/src/input/input_file.c b/src/input/input_file.c index db7937956..dd2f078f9 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_file.c,v 1.118 2006/12/19 19:10:51 dsalt Exp $ + * $Id: input_file.c,v 1.119 2007/01/18 23:02:18 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -659,7 +659,7 @@ static off_t get_file_size(char *filepathname, char *origin) { return pstat.st_size; } -static char *file_class_get_description (input_class_t *this_gen) { +static const char *file_class_get_description (input_class_t *this_gen) { return _("file input plugin"); } diff --git a/src/input/input_gnome_vfs.c b/src/input/input_gnome_vfs.c index 3ada09d19..8948abe54 100644 --- a/src/input/input_gnome_vfs.c +++ b/src/input/input_gnome_vfs.c @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_gnome_vfs.c,v 1.32 2006/09/08 06:20:37 tmattern Exp $ + * $Id: input_gnome_vfs.c,v 1.33 2007/01/18 23:02:18 dgp85 Exp $ */ @@ -212,7 +212,7 @@ gnomevfs_plugin_get_mrl (input_plugin_t *this_gen) return this->mrl; } -static char +static const char *gnomevfs_klass_get_description (input_class_t *this_gen) { return _("gnome-vfs input plugin as shipped with xine"); diff --git a/src/input/input_http.c b/src/input/input_http.c index 9011fba7f..18990e2bf 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -19,7 +19,7 @@ * * input plugin for http network streams * - * $Id: input_http.c,v 1.125 2006/12/08 16:26:10 mshopf Exp $ + * $Id: input_http.c,v 1.126 2007/01/18 23:02:18 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -990,7 +990,7 @@ static input_plugin_t *http_class_get_instance (input_class_t *cls_gen, xine_str return &this->input_plugin; } -static char *http_class_get_description (input_class_t *this_gen) { +static const char *http_class_get_description (input_class_t *this_gen) { return _("http input plugin"); } diff --git a/src/input/input_mms.c b/src/input/input_mms.c index 5704e78b6..350958d89 100644 --- a/src/input/input_mms.c +++ b/src/input/input_mms.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_mms.c,v 1.66 2007/01/09 20:50:59 klan Exp $ + * $Id: input_mms.c,v 1.67 2007/01/18 23:02:18 dgp85 Exp $ * * mms input plugin based on work from major mms */ @@ -439,7 +439,7 @@ static input_plugin_t *mms_class_get_instance (input_class_t *cls_gen, xine_stre * mms input plugin class stuff */ -static char *mms_class_get_description (input_class_t *this_gen) { +static const char *mms_class_get_description (input_class_t *this_gen) { return _("mms streaming input plugin"); } diff --git a/src/input/input_net.c b/src/input/input_net.c index 19326c301..1baa8c3c6 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -20,7 +20,7 @@ * Read from a tcp network stream over a lan (put a tweaked mp1e encoder the * other end and you can watch tv anywhere in the house ..) * - * $Id: input_net.c,v 1.68 2006/07/10 22:08:15 dgp85 Exp $ + * $Id: input_net.c,v 1.69 2007/01/18 23:02:18 dgp85 Exp $ * * how to set up mp1e for use with this plugin: * @@ -506,7 +506,7 @@ static input_plugin_t *net_class_get_instance (input_class_t *cls_gen, xine_stre * net plugin class */ -static char *net_class_get_description (input_class_t *this_gen) { +static const char *net_class_get_description (input_class_t *this_gen) { return _("net input plugin as shipped with xine"); } diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h index f686f2227..aebbd08e7 100644 --- a/src/input/input_plugin.h +++ b/src/input/input_plugin.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_plugin.h,v 1.62 2006/12/22 16:38:15 klan Exp $ + * $Id: input_plugin.h,v 1.63 2007/01/18 23:02:18 dgp85 Exp $ */ #ifndef HAVE_INPUT_PLUGIN_H @@ -60,7 +60,7 @@ struct input_class_s { * return human readable (verbose = 1 line) description for * this plugin class */ - char* (*get_description) (input_class_t *this); + const char* (*get_description) (input_class_t *this); /* * ls function, optional: may be NULL diff --git a/src/input/input_pnm.c b/src/input/input_pnm.c index 26fdd350e..c847ca767 100644 --- a/src/input/input_pnm.c +++ b/src/input/input_pnm.c @@ -258,7 +258,7 @@ static input_plugin_t *pnm_class_get_instance (input_class_t *cls_gen, xine_stre * pnm input plugin class stuff */ -static char *pnm_class_get_description (input_class_t *this_gen) { +static const char *pnm_class_get_description (input_class_t *this_gen) { return _("pnm streaming input plugin"); } diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c index f47bfe890..93af332f4 100644 --- a/src/input/input_pvr.c +++ b/src/input/input_pvr.c @@ -38,7 +38,7 @@ * usage: * xine pvr:/\!\! * - * $Id: input_pvr.c,v 1.63 2006/12/19 19:10:51 dsalt Exp $ + * $Id: input_pvr.c,v 1.64 2007/01/18 23:02:18 dgp85 Exp $ */ /************************************************************************** @@ -1524,7 +1524,7 @@ static input_plugin_t *pvr_class_get_instance (input_class_t *cls_gen, xine_stre * plugin class functions */ -static char *pvr_class_get_description (input_class_t *this_gen) { +static const char *pvr_class_get_description (input_class_t *this_gen) { return _("WinTV-PVR 250/350 input plugin"); } diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c index b23ecb895..da6bad281 100644 --- a/src/input/input_rtp.c +++ b/src/input/input_rtp.c @@ -739,7 +739,7 @@ static input_plugin_t *rtp_class_get_instance (input_class_t *cls_gen, * net plugin class */ -static char *rtp_class_get_description (input_class_t *this_gen) { +static const char *rtp_class_get_description (input_class_t *this_gen) { return _("RTP and UDP input plugin as shipped with xine"); } diff --git a/src/input/input_rtsp.c b/src/input/input_rtsp.c index fec7b9713..5a7cc6c7f 100644 --- a/src/input/input_rtsp.c +++ b/src/input/input_rtsp.c @@ -280,7 +280,7 @@ static input_plugin_t *rtsp_class_get_instance (input_class_t *cls_gen, xine_str * rtsp input plugin class stuff */ -static char *rtsp_class_get_description (input_class_t *this_gen) { +static const char *rtsp_class_get_description (input_class_t *this_gen) { return _("rtsp streaming input plugin"); } diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c index 3780a1cef..435bf795b 100644 --- a/src/input/input_stdin_fifo.c +++ b/src/input/input_stdin_fifo.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_stdin_fifo.c,v 1.67 2006/07/10 22:08:16 dgp85 Exp $ + * $Id: input_stdin_fifo.c,v 1.68 2007/01/18 23:02:18 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -346,7 +346,7 @@ static input_plugin_t *stdin_class_get_instance (input_class_t *class_gen, * stdin input plugin class stuff */ -static char *stdin_class_get_description (input_class_t *this_gen) { +static const char *stdin_class_get_description (input_class_t *this_gen) { return _("stdin streaming input plugin"); } diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index ab0715e96..06b6707f9 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_vcd.c,v 1.86 2006/12/19 19:10:51 dsalt Exp $ + * $Id: input_vcd.c,v 1.87 2007/01/18 23:02:18 dgp85 Exp $ * */ @@ -919,7 +919,7 @@ static input_plugin_t *vcd_class_get_instance (input_class_t *cls_gen, xine_stre * vcd input plugin class stuff */ -static char *vcd_class_get_description (input_class_t *this_gen) { +static const char *vcd_class_get_description (input_class_t *this_gen) { return _("Video CD input plugin"); } -- cgit v1.2.3 From ab3e2144196d0881e7984d053e6a01cc2bf65392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 18 Jan 2007 23:28:46 +0000 Subject: Make _x_demux_check_extension() accept constant strings. CVS patchset: 8520 CVS date: 2007/01/18 23:28:46 --- src/xine-engine/demux.c | 4 ++-- src/xine-engine/xine_internal.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index 2178ccb71..d1bd2bc1d 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -20,7 +20,7 @@ * Demuxer helper functions * hide some xine engine details from demuxers and reduce code duplication * - * $Id: demux.c,v 1.65 2006/12/03 19:23:16 miguelfreitas Exp $ + * $Id: demux.c,v 1.66 2007/01/18 23:28:46 dgp85 Exp $ */ @@ -448,7 +448,7 @@ int _x_demux_read_header( input_plugin_t *input, unsigned char *buffer, off_t si return read_size; } -int _x_demux_check_extension (char *mrl, char *extensions){ +int _x_demux_check_extension (const char *mrl, const char *extensions){ char *last_dot, *e, *ext_copy, *ext_work; ext_copy = strdup(extensions); diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index e25339c46..30899a4b3 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_internal.h,v 1.180 2006/12/13 18:30:30 dsalt Exp $ + * $Id: xine_internal.h,v 1.181 2007/01/18 23:28:46 dgp85 Exp $ * */ @@ -416,7 +416,7 @@ void _x_demux_control_end (xine_stream_t *stream, uint32_t flags) XINE_ int _x_demux_start_thread (xine_stream_t *stream) XINE_PROTECTED; int _x_demux_stop_thread (xine_stream_t *stream) XINE_PROTECTED; int _x_demux_read_header (input_plugin_t *input, unsigned char *buffer, off_t size) XINE_PROTECTED; -int _x_demux_check_extension (char *mrl, char *extensions) XINE_PROTECTED; +int _x_demux_check_extension (const char *mrl, const char *extensions) XINE_PROTECTED; off_t _x_read_abort (xine_stream_t *stream, int fd, char *buf, off_t todo) XINE_PROTECTED; -- cgit v1.2.3 From bfc1b44063ed6cfbc97da722803d6da90de0cf53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 18 Jan 2007 23:30:18 +0000 Subject: Handle strings coming from plugins as constants. CVS patchset: 8521 CVS date: 2007/01/18 23:30:18 --- src/xine-engine/load_plugins.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 62f4705fa..25325aae1 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: load_plugins.c,v 1.228 2006/11/23 21:05:31 klan Exp $ + * $Id: load_plugins.c,v 1.229 2007/01/18 23:30:18 dgp85 Exp $ * * * Load input/demux/audio_out/video_out/codec plugins @@ -2375,14 +2375,14 @@ char *xine_get_file_extensions (xine_t *self) { list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_DEMUX - 1]); for (list_id = 0; list_id < list_size; list_id++) { demux_class_t *cls; - char *exts; + const char *exts; node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id); if (node->plugin_class || _load_plugin_class(self, node, NULL)) { cls = (demux_class_t *)node->plugin_class; - if((exts = cls->get_extensions(cls)) && strlen(exts)) + if((exts = cls->get_extensions(cls)) && *exts) len += strlen(exts) + 1; } } @@ -2394,7 +2394,7 @@ char *xine_get_file_extensions (xine_t *self) { list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_DEMUX - 1]); for (list_id = 0; list_id < list_size; list_id++) { demux_class_t *cls; - char *e; + const char *e; int l; node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id); @@ -2402,7 +2402,7 @@ char *xine_get_file_extensions (xine_t *self) { cls = (demux_class_t *)node->plugin_class; - if((e = cls->get_extensions (cls)) && strlen(e)) { + if((e = cls->get_extensions (cls)) && *e) { l = strlen(e); memcpy (&str[pos], e, l); @@ -2444,7 +2444,7 @@ char *xine_get_mime_types (xine_t *self) { for (list_id = 0; list_id < list_size; list_id++) { demux_class_t *cls; - char *s; + const char *s; node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id); if (node->plugin_class || _load_plugin_class(self, node, NULL)) { @@ -2466,7 +2466,7 @@ char *xine_get_mime_types (xine_t *self) { for (list_id = 0; list_id < list_size; list_id++) { demux_class_t *cls; - char *s; + const char *s; int l; node = xine_sarray_get (catalog->plugin_lists[PLUGIN_DEMUX - 1], list_id); @@ -2503,6 +2503,7 @@ char *xine_get_demux_for_mime_type (xine_t *self, const char *mime_type) { char *id = NULL; char *mime_arg, *mime_demux; char *s; + const char *mt; int list_id, list_size; /* create a copy and convert to lower case */ @@ -2522,9 +2523,9 @@ char *xine_get_demux_for_mime_type (xine_t *self, const char *mime_type) { cls = (demux_class_t *)node->plugin_class; - s = cls->get_mimetypes (cls); - if (s) { - mime_demux = strdup(s); + mt = cls->get_mimetypes (cls); + if (mt) { + mime_demux = strdup(mt); for(s=mime_demux; *s; s++) *s = tolower(*s); -- cgit v1.2.3 From 703ba00e157e08035262393e8af9bb4b4d979c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 19 Jan 2007 00:12:22 +0000 Subject: Fix constant on ordered attribute. CVS patchset: 8522 CVS date: 2007/01/19 00:12:22 --- src/xine-engine/scratch.c | 4 ++-- src/xine-engine/scratch.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/xine-engine/scratch.c b/src/xine-engine/scratch.c index d750a8a07..67281b041 100644 --- a/src/xine-engine/scratch.c +++ b/src/xine-engine/scratch.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: scratch.c,v 1.23 2006/12/13 18:30:30 dsalt Exp $ + * $Id: scratch.c,v 1.24 2007/01/19 00:12:22 dgp85 Exp $ * * top-level xine functions * @@ -67,7 +67,7 @@ static void __attribute__((__format__(__printf__, 2, 0))) pthread_mutex_unlock (&this->lock); } -static const char **scratch_get_content (scratch_buffer_t *this) { +static char **scratch_get_content (scratch_buffer_t *this) { int i, j; pthread_mutex_lock (&this->lock); diff --git a/src/xine-engine/scratch.h b/src/xine-engine/scratch.h index 719a9f8d9..bcfe815c3 100644 --- a/src/xine-engine/scratch.h +++ b/src/xine-engine/scratch.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: scratch.h,v 1.12 2006/12/13 18:30:30 dsalt Exp $ + * $Id: scratch.h,v 1.13 2007/01/19 00:12:22 dgp85 Exp $ * * scratch buffer for log output * @@ -41,12 +41,12 @@ struct scratch_buffer_s { #endif (*scratch_printf) (scratch_buffer_t *this, const char *format, va_list ap); - const char **(*get_content) (scratch_buffer_t *this); + char **(*get_content) (scratch_buffer_t *this); void (*dispose) (scratch_buffer_t *this); char **lines; - const char **ordered; + char **ordered; int num_lines; int cur; -- cgit v1.2.3 From 700b5abb9bfad24a141241bc2c0c2e19b4722318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 19 Jan 2007 00:26:39 +0000 Subject: Make get_description get_identifier get_extensions get_mimetypes return a constant string, and make the extensions and mrl vaiables usually declared when testing extension demux strategy constants too. CVS patchset: 8523 CVS date: 2007/01/19 00:26:39 --- src/demuxers/demux.h | 10 +++++----- src/demuxers/demux_4xm.c | 12 ++++++------ src/demuxers/demux_aac.c | 12 ++++++------ src/demuxers/demux_ac3.c | 12 ++++++------ src/demuxers/demux_aiff.c | 12 ++++++------ src/demuxers/demux_asf.c | 10 +++++----- src/demuxers/demux_aud.c | 12 ++++++------ src/demuxers/demux_avi.c | 12 ++++++------ src/demuxers/demux_cdda.c | 10 +++++----- src/demuxers/demux_dts.c | 12 ++++++------ src/demuxers/demux_eawve.c | 12 ++++++------ src/demuxers/demux_elem.c | 12 ++++++------ src/demuxers/demux_film.c | 12 ++++++------ src/demuxers/demux_flac.c | 12 ++++++------ src/demuxers/demux_fli.c | 12 ++++++------ src/demuxers/demux_flv.c | 10 +++++----- src/demuxers/demux_idcin.c | 12 ++++++------ src/demuxers/demux_iff.c | 12 ++++++------ src/demuxers/demux_image.c | 12 ++++++------ src/demuxers/demux_ipmovie.c | 12 ++++++------ src/demuxers/demux_matroska.c | 16 +++++++--------- src/demuxers/demux_mng.c | 12 ++++++------ src/demuxers/demux_mod.c | 10 +++++----- src/demuxers/demux_mpc.c | 12 ++++++------ src/demuxers/demux_mpeg.c | 12 ++++++------ src/demuxers/demux_mpeg_block.c | 10 +++++----- src/demuxers/demux_mpeg_pes.c | 10 +++++----- src/demuxers/demux_mpgaudio.c | 14 +++++++------- src/demuxers/demux_nsf.c | 12 ++++++------ src/demuxers/demux_nsv.c | 12 ++++++------ src/demuxers/demux_ogg.c | 22 +++++++++++----------- src/demuxers/demux_pva.c | 12 ++++++------ src/demuxers/demux_qt.c | 10 +++++----- src/demuxers/demux_rawdv.c | 12 ++++++------ src/demuxers/demux_real.c | 12 ++++++------ src/demuxers/demux_realaudio.c | 12 ++++++------ src/demuxers/demux_roq.c | 12 ++++++------ src/demuxers/demux_shn.c | 12 ++++++------ src/demuxers/demux_slave.c | 10 +++++----- src/demuxers/demux_smjpeg.c | 12 ++++++------ src/demuxers/demux_snd.c | 12 ++++++------ src/demuxers/demux_str.c | 12 ++++++------ src/demuxers/demux_ts.c | 16 +++++++--------- src/demuxers/demux_tta.c | 12 ++++++------ src/demuxers/demux_vmd.c | 12 ++++++------ src/demuxers/demux_voc.c | 12 ++++++------ src/demuxers/demux_vox.c | 12 ++++++------ src/demuxers/demux_vqa.c | 12 ++++++------ src/demuxers/demux_wav.c | 12 ++++++------ src/demuxers/demux_wavpack.c | 14 +++++++------- src/demuxers/demux_wc3movie.c | 12 ++++++------ src/demuxers/demux_yuv4mpeg2.c | 12 ++++++------ src/demuxers/demux_yuv_frames.c | 10 +++++----- src/libsputext/demux_sputext.c | 10 +++++----- 54 files changed, 322 insertions(+), 326 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux.h b/src/demuxers/demux.h index 0ce33b090..157519a87 100644 --- a/src/demuxers/demux.h +++ b/src/demuxers/demux.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux.h,v 1.39 2005/02/06 15:26:00 tmattern Exp $ + * $Id: demux.h,v 1.40 2007/01/19 00:26:39 dgp85 Exp $ */ #ifndef HAVE_DEMUX_H @@ -58,19 +58,19 @@ struct demux_class_s { /* * return human readable (verbose = 1 line) description for this plugin */ - char* (*get_description) (demux_class_t *this); + const char* (*get_description) (demux_class_t *this); /* * return human readable identifier for this plugin */ - char* (*get_identifier) (demux_class_t *this); + const char* (*get_identifier) (demux_class_t *this); /* * return MIME types supported for this plugin */ - char* (*get_mimetypes) (demux_class_t *this); + const char* (*get_mimetypes) (demux_class_t *this); /* * return ' ' seperated list of file extensions this @@ -79,7 +79,7 @@ struct demux_class_s { * file selection dialogs) */ - char* (*get_extensions) (demux_class_t *this); + const char* (*get_extensions) (demux_class_t *this); /* * close down, free all resources diff --git a/src/demuxers/demux_4xm.c b/src/demuxers/demux_4xm.c index c6d2d3f0e..56360542c 100644 --- a/src/demuxers/demux_4xm.c +++ b/src/demuxers/demux_4xm.c @@ -23,7 +23,7 @@ * For more information on the 4xm file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_4xm.c,v 1.15 2004/06/13 21:28:52 miguelfreitas Exp $ + * $Id: demux_4xm.c,v 1.16 2007/01/19 00:26:39 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -493,7 +493,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -523,19 +523,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "4X Technologies (4xm) demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "4X Technologies"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "4xm"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_aac.c b/src/demuxers/demux_aac.c index b9e4c4084..3a81404c1 100644 --- a/src/demuxers/demux_aac.c +++ b/src/demuxers/demux_aac.c @@ -21,7 +21,7 @@ * This demuxer detects ADIF and ADTS headers in AAC files. * Then it shovels buffer-sized chunks over to the AAC decoder. * - * $Id: demux_aac.c,v 1.12 2006/11/14 21:51:32 dsalt Exp $ + * $Id: demux_aac.c,v 1.13 2007/01/19 00:26:39 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -255,7 +255,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -283,19 +283,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "ADIF/ADTS AAC demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "AAC"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "aac"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_ac3.c b/src/demuxers/demux_ac3.c index fa2dddfed..f81fef5d7 100644 --- a/src/demuxers/demux_ac3.c +++ b/src/demuxers/demux_ac3.c @@ -23,7 +23,7 @@ * This demuxer detects raw AC3 data in a file and shovels AC3 data * directly to the AC3 decoder. * - * $Id: demux_ac3.c,v 1.19 2005/06/04 20:32:08 jstembridge Exp $ + * $Id: demux_ac3.c,v 1.20 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -441,7 +441,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -471,19 +471,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Raw AC3 demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "AC3"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "ac3"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_aiff.c b/src/demuxers/demux_aiff.c index 253827454..f88c58572 100644 --- a/src/demuxers/demux_aiff.c +++ b/src/demuxers/demux_aiff.c @@ -21,7 +21,7 @@ /* * AIFF File Demuxer by Mike Melanson (melanson@pcisys.net) * - * $Id: demux_aiff.c,v 1.40 2004/12/15 21:03:02 mroi Exp $ + * $Id: demux_aiff.c,v 1.41 2007/01/19 00:26:40 dgp85 Exp $ * */ @@ -359,7 +359,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -389,19 +389,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "AIFF file demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "AIFF"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "aif aiff"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return "audio/x-aiff: aif, aiff: AIFF audio;" "audio/aiff: aif, aiff: AIFF audio;" "audio/x-pn-aiff: aif, aiff: AIFF audio;"; diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index 1ea394356..1bdea2fd7 100644 --- a/src/demuxers/demux_asf.c +++ b/src/demuxers/demux_asf.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_asf.c,v 1.190 2007/01/03 15:12:37 klan Exp $ + * $Id: demux_asf.c,v 1.191 2007/01/19 00:26:40 dgp85 Exp $ * * demultiplexer for asf streams * @@ -2123,20 +2123,20 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "ASF demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "ASF"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { /* asx, wvx, wax are metafile or playlist */ return "asf wmv wma asx wvx wax"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return "video/x-ms-asf: asf: ASF stream;" "video/x-ms-wmv: wmv: Windows Media Video;" diff --git a/src/demuxers/demux_aud.c b/src/demuxers/demux_aud.c index 5ebf25e13..ea57a6939 100644 --- a/src/demuxers/demux_aud.c +++ b/src/demuxers/demux_aud.c @@ -34,7 +34,7 @@ * data. This makes seeking conceptually impossible. Upshot: Random * seeking is not supported. * - * $Id: demux_aud.c,v 1.19 2004/06/13 21:28:52 miguelfreitas Exp $ + * $Id: demux_aud.c,v 1.20 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -292,7 +292,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str case METHOD_BY_CONTENT: /* no reliable detection */ case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -320,19 +320,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Westwood Studios AUD file demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "Westwood Studios AUD"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "aud"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index 4f4cbc428..e0ed1a915 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_avi.c,v 1.228 2006/07/10 22:08:13 dgp85 Exp $ + * $Id: demux_avi.c,v 1.229 2007/01/19 00:26:40 dgp85 Exp $ * * demultiplexer for avi streams * @@ -2259,7 +2259,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str break; case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -2316,19 +2316,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str * demux avi class */ -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "AVI/RIFF demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "AVI"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "avi"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return "video/msvideo: avi: AVI video;" "video/x-msvideo: avi: AVI video;"; } diff --git a/src/demuxers/demux_cdda.c b/src/demuxers/demux_cdda.c index 3790ee6b9..d92a8ba23 100644 --- a/src/demuxers/demux_cdda.c +++ b/src/demuxers/demux_cdda.c @@ -24,7 +24,7 @@ * linear PCM "decoder" (which in turn sends them directly to the audio * output target; this is a really fancy CD-playing architecture). * - * $Id: demux_cdda.c,v 1.19 2004/06/13 21:28:52 miguelfreitas Exp $ + * $Id: demux_cdda.c,v 1.20 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -227,19 +227,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "CD Digital Audio demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "CDDA"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return NULL; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_dts.c b/src/demuxers/demux_dts.c index 16f14211d..98726a569 100644 --- a/src/demuxers/demux_dts.c +++ b/src/demuxers/demux_dts.c @@ -19,7 +19,7 @@ * * Raw DTS Demuxer by James Stembridge (jstembridge@gmail.com) * - * $Id: demux_dts.c,v 1.6 2005/06/04 20:32:08 jstembridge Exp $ + * $Id: demux_dts.c,v 1.7 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -368,7 +368,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -396,19 +396,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Raw DTS demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "DTS"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "dts"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_eawve.c b/src/demuxers/demux_eawve.c index 7d7cc922a..67c087208 100644 --- a/src/demuxers/demux_eawve.c +++ b/src/demuxers/demux_eawve.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_eawve.c,v 1.28 2004/06/13 21:28:52 miguelfreitas Exp $ + * $Id: demux_eawve.c,v 1.29 2007/01/19 00:26:40 dgp85 Exp $ * * demux_eawve.c, Demuxer plugin for Electronic Arts' WVE file format * @@ -370,7 +370,7 @@ static demux_plugin_t* open_plugin(demux_class_t *class_gen, xine_stream_t *stre switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -400,19 +400,19 @@ static demux_plugin_t* open_plugin(demux_class_t *class_gen, xine_stream_t *stre return &this->demux_plugin; } -static char *get_description(demux_class_t *this_gen){ +static const char *get_description(demux_class_t *this_gen){ return "Electronics Arts WVE format demux plugin"; } -static char *get_identifier(demux_class_t *this_gen){ +static const char *get_identifier(demux_class_t *this_gen){ return "EA WVE"; } -static char *get_extensions(demux_class_t *this_gen){ +static const char *get_extensions(demux_class_t *this_gen){ return "wve"; } -static char *get_mimetypes(demux_class_t *this_gen){ +static const char *get_mimetypes(demux_class_t *this_gen){ return NULL; } diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c index 2645992bc..f0bfe4c16 100644 --- a/src/demuxers/demux_elem.c +++ b/src/demuxers/demux_elem.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_elem.c,v 1.89 2006/07/10 22:08:13 dgp85 Exp $ + * $Id: demux_elem.c,v 1.90 2007/01/19 00:26:40 dgp85 Exp $ * * demultiplexer for elementary mpeg streams */ @@ -225,7 +225,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str break; case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -261,19 +261,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Elementary MPEG stream demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "MPEG_ELEM"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "mpv"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c index f4a27c22b..d3cedc0e1 100644 --- a/src/demuxers/demux_film.c +++ b/src/demuxers/demux_film.c @@ -21,7 +21,7 @@ * For more information on the FILM file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_film.c,v 1.81 2006/11/19 16:07:50 dgp85 Exp $ + * $Id: demux_film.c,v 1.82 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -874,7 +874,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -904,19 +904,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "FILM (CPK) demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "FILM (CPK)"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "cpk cak film"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c index bd5c19350..0af3ef8f4 100644 --- a/src/demuxers/demux_flac.c +++ b/src/demuxers/demux_flac.c @@ -23,7 +23,7 @@ * For more information on the FLAC file format, visit: * http://flac.sourceforge.net/ * - * $Id: demux_flac.c,v 1.12 2006/11/09 23:51:29 dgp85 Exp $ + * $Id: demux_flac.c,v 1.13 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -524,7 +524,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -554,19 +554,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Free Lossless Audio Codec (flac) demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "FLAC"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "flac"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_fli.c b/src/demuxers/demux_fli.c index e17e47258..c9cc26cf1 100644 --- a/src/demuxers/demux_fli.c +++ b/src/demuxers/demux_fli.c @@ -24,7 +24,7 @@ * avoid while programming a FLI decoder, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_fli.c,v 1.59 2006/07/10 22:08:13 dgp85 Exp $ + * $Id: demux_fli.c,v 1.60 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -324,7 +324,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -354,19 +354,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Autodesk Animator FLI/FLC demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "FLI/FLC"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "fli flc"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return "video/x-flic: fli,flc: Autodesk FLIC files;"; } diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 5de179142..e88e527e2 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -26,7 +26,7 @@ * For more information on the FLV file format, visit: * http://download.macromedia.com/pub/flash/flash_file_format_specification.pdf * - * $Id: demux_flv.c,v 1.15 2007/01/14 16:55:25 klan Exp $ + * $Id: demux_flv.c,v 1.16 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -668,19 +668,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Flash Video file demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "FLV"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "flv"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return "video/x-flv: flv: Flash video;"; } diff --git a/src/demuxers/demux_idcin.c b/src/demuxers/demux_idcin.c index a778d4c6f..8397e3e6d 100644 --- a/src/demuxers/demux_idcin.c +++ b/src/demuxers/demux_idcin.c @@ -65,7 +65,7 @@ * - if any bytes exceed 63, do not shift the bytes at all before * transmitting them to the video decoder * - * $Id: demux_idcin.c,v 1.53 2005/11/21 10:28:18 valtri Exp $ + * $Id: demux_idcin.c,v 1.54 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -493,7 +493,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -524,19 +524,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Id Quake II Cinematic file demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "Id CIN"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "cin"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_iff.c b/src/demuxers/demux_iff.c index 4775158b7..cc4df0c85 100644 --- a/src/demuxers/demux_iff.c +++ b/src/demuxers/demux_iff.c @@ -36,7 +36,7 @@ * * ANIM (Animations) * - Animation works fine, without seeking. * - * $Id: demux_iff.c,v 1.18 2006/12/08 16:19:17 mshopf Exp $ + * $Id: demux_iff.c,v 1.19 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -1255,7 +1255,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -1285,19 +1285,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "IFF demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "IFF"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "iff svx 8svx 16sv ilbm ham ham6 ham8 anim anim3 anim5 anim7 anim8"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return "audio/x-8svx: 8svx: IFF-8SVX Audio;" "audio/8svx: 8svx: IFF-8SVX Audio;" "audio/x-16sv: 16sv: IFF-16SV Audio;" diff --git a/src/demuxers/demux_image.c b/src/demuxers/demux_image.c index 727d80a29..d799c2324 100644 --- a/src/demuxers/demux_image.c +++ b/src/demuxers/demux_image.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_image.c,v 1.25 2006/08/13 23:51:33 miguelfreitas Exp $ + * $Id: demux_image.c,v 1.26 2007/01/19 00:26:40 dgp85 Exp $ * * image dummy demultiplexer */ @@ -177,7 +177,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, break; case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -225,19 +225,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, * image demuxer class */ -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "image demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "imagedmx"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "png gif jpg jpeg"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_ipmovie.c b/src/demuxers/demux_ipmovie.c index 20c1c3118..992612f62 100644 --- a/src/demuxers/demux_ipmovie.c +++ b/src/demuxers/demux_ipmovie.c @@ -23,7 +23,7 @@ * For more information regarding the Interplay MVE file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_ipmovie.c,v 1.25 2004/06/13 21:28:53 miguelfreitas Exp $ + * $Id: demux_ipmovie.c,v 1.26 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -693,7 +693,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -723,19 +723,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Interplay MVE Movie demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "Interplay MVE"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "mve mv8"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index 98d2136a0..39b887d54 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_matroska.c,v 1.50 2007/01/07 12:33:50 molivier Exp $ + * $Id: demux_matroska.c,v 1.51 2007/01/19 00:26:40 dgp85 Exp $ * * demultiplexer for matroska streams * @@ -2802,13 +2802,11 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str break; case METHOD_BY_EXTENSION: { - char *mrl = input->get_mrl(input); - char *extensions; + const char *const mrl = input->get_mrl(input); + const char *const extensions = class_gen->get_extensions (class_gen);; lprintf ("stage by extension %s\n", mrl); - extensions = class_gen->get_extensions (class_gen); - if (!_x_demux_check_extension (mrl, extensions)) return NULL; @@ -2866,22 +2864,22 @@ error: * demux matroska class */ -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "matroska demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "matroska"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "mkv"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return "video/mkv: mkv: matroska;"; } diff --git a/src/demuxers/demux_mng.c b/src/demuxers/demux_mng.c index 7f7b5bd84..e2ab1e4ea 100644 --- a/src/demuxers/demux_mng.c +++ b/src/demuxers/demux_mng.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_mng.c,v 1.28 2006/07/10 22:08:13 dgp85 Exp $ + * $Id: demux_mng.c,v 1.29 2007/01/19 00:26:40 dgp85 Exp $ * * demux_mng.c, Demuxer plugin for Multiple-image Network Graphics format * @@ -288,7 +288,7 @@ static demux_plugin_t* open_plugin(demux_class_t *class_gen, xine_stream_t *stre break; case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl(input); extensions = class_gen->get_extensions (class_gen); @@ -336,19 +336,19 @@ static demux_plugin_t* open_plugin(demux_class_t *class_gen, xine_stream_t *stre return &this->demux_plugin; } -static char *get_description(demux_class_t *this_gen){ +static const char *get_description(demux_class_t *this_gen){ return "Multiple-image Network Graphics demux plugin"; } -static char *get_identifier(demux_class_t *this_gen){ +static const char *get_identifier(demux_class_t *this_gen){ return "MNG"; } -static char *get_extensions(demux_class_t *this_gen){ +static const char *get_extensions(demux_class_t *this_gen){ return "png mng"; } -static char *get_mimetypes(demux_class_t *this_gen){ +static const char *get_mimetypes(demux_class_t *this_gen){ return "image/png: png: PNG image;" "image/x-png: png: PNG image;" "video/mng: mng: MNG animation;" diff --git a/src/demuxers/demux_mod.c b/src/demuxers/demux_mod.c index 7e0d99556..37e066b13 100644 --- a/src/demuxers/demux_mod.c +++ b/src/demuxers/demux_mod.c @@ -327,7 +327,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str case METHOD_EXPLICIT: case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -355,19 +355,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "ModPlug Amiga MOD Music file demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "mod"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "mod it stm s3m 669 amf med mdl xm"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_mpc.c b/src/demuxers/demux_mpc.c index deaebd375..e1a3f28b9 100644 --- a/src/demuxers/demux_mpc.c +++ b/src/demuxers/demux_mpc.c @@ -24,7 +24,7 @@ * APE tag reading * Seeking?? * - * $Id: demux_mpc.c,v 1.4 2006/12/26 17:40:37 dgp85 Exp $ + * $Id: demux_mpc.c,v 1.5 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -344,7 +344,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -374,19 +374,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Musepack demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "Musepack"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "mpc mp+"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c index 61d7cc3ca..1ed0addcf 100644 --- a/src/demuxers/demux_mpeg.c +++ b/src/demuxers/demux_mpeg.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_mpeg.c,v 1.150 2006/07/10 22:08:13 dgp85 Exp $ + * $Id: demux_mpeg.c,v 1.151 2007/01/19 00:26:40 dgp85 Exp $ * * demultiplexer for mpeg 1/2 program streams * reads streams of variable blocksizes @@ -1199,7 +1199,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str } case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -1222,19 +1222,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "MPEG program stream demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "MPEG"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "mpg mpeg"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return "video/mpeg: mpeg, mpg, mpe: MPEG animation;" "video/x-mpeg: mpeg, mpg, mpe: MPEG animation;"; } diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index ef17ac948..760f8a6d1 100644 --- a/src/demuxers/demux_mpeg_block.c +++ b/src/demuxers/demux_mpeg_block.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpeg_block.c,v 1.217 2006/10/16 22:18:24 valtri Exp $ + * $Id: demux_mpeg_block.c,v 1.218 2007/01/19 00:26:40 dgp85 Exp $ * * demultiplexer for mpeg 1/2 program streams * used with fixed blocksize devices (like dvd/vcd) @@ -1516,19 +1516,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "DVD/VOB demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "MPEG_BLOCK"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "vob"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c index cb9732e53..e9b7b8e52 100644 --- a/src/demuxers/demux_mpeg_pes.c +++ b/src/demuxers/demux_mpeg_pes.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpeg_pes.c,v 1.37 2006/10/16 22:18:24 valtri Exp $ + * $Id: demux_mpeg_pes.c,v 1.38 2007/01/19 00:26:40 dgp85 Exp $ * * demultiplexer for mpeg 2 PES (Packetized Elementary Streams) * reads streams of variable blocksizes @@ -1630,19 +1630,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "mpeg pes demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "MPEG_PES"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "pes"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 13724026c..2db1336a0 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpgaudio.c,v 1.145 2006/09/03 02:03:21 dgp85 Exp $ + * $Id: demux_mpgaudio.c,v 1.146 2007/01/19 00:26:40 dgp85 Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -1016,8 +1016,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str break; case METHOD_BY_EXTENSION: { - char *mrl = input->get_mrl(input); - char *extensions = class_gen->get_extensions (class_gen); + const char *const mrl = input->get_mrl(input); + const char *const extensions = class_gen->get_extensions (class_gen); lprintf ("stage by extension %s\n", mrl); @@ -1058,15 +1058,15 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str * demux mpegaudio class */ -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "MPEG audio demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "MPEGAUDIO"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { demux_mpgaudio_class_t *this = (demux_mpgaudio_class_t *) this_gen; if( _x_decoder_available(this->xine, BUF_AUDIO_MPEG) ) @@ -1075,7 +1075,7 @@ static char *get_extensions (demux_class_t *this_gen) { return ""; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { demux_mpgaudio_class_t *this = (demux_mpgaudio_class_t *) this_gen; if( _x_decoder_available(this->xine, BUF_AUDIO_MPEG) ) diff --git a/src/demuxers/demux_nsf.c b/src/demuxers/demux_nsf.c index dae756d8d..f5c42238f 100644 --- a/src/demuxers/demux_nsf.c +++ b/src/demuxers/demux_nsf.c @@ -30,7 +30,7 @@ * For more information regarding the NSF format, visit: * http://www.tripoint.org/kevtris/nes/nsfspec.txt * - * $Id: demux_nsf.c,v 1.22 2004/06/13 21:28:54 miguelfreitas Exp $ + * $Id: demux_nsf.c,v 1.23 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -322,7 +322,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -352,19 +352,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "NES Music file demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "NSF"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "nsf"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_nsv.c b/src/demuxers/demux_nsv.c index 6f71a6264..6d43b247c 100644 --- a/src/demuxers/demux_nsv.c +++ b/src/demuxers/demux_nsv.c @@ -23,7 +23,7 @@ * For more information regarding the NSV file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_nsv.c,v 1.24 2006/07/10 22:08:13 dgp85 Exp $ + * $Id: demux_nsv.c,v 1.25 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -615,7 +615,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -645,19 +645,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Nullsoft Video demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "Nullsoft NSV"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "nsv"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index 3ea07306b..0911e7618 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_ogg.c,v 1.171 2006/11/10 14:53:23 dgp85 Exp $ + * $Id: demux_ogg.c,v 1.172 2007/01/19 00:26:40 dgp85 Exp $ * * demultiplexer for ogg streams * @@ -1926,7 +1926,7 @@ static int detect_ogg_content (int detection_method, demux_class_t *class_gen, } case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -1988,7 +1988,7 @@ static int detect_anx_content (int detection_method, demux_class_t *class_gen, #undef ANNODEX_SIGNATURE_SEARCH case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -2099,19 +2099,19 @@ static demux_plugin_t *ogg_open_plugin (demux_class_t *class_gen, * Annodex demuxer class */ -static char *anx_get_description (demux_class_t *this_gen) { +static const char *anx_get_description (demux_class_t *this_gen) { return "Annodex demux plugin"; } -static char *anx_get_identifier (demux_class_t *this_gen) { +static const char *anx_get_identifier (demux_class_t *this_gen) { return "Annodex"; } -static char *anx_get_extensions (demux_class_t *this_gen) { +static const char *anx_get_extensions (demux_class_t *this_gen) { return "anx axa axv"; } -static char *anx_get_mimetypes (demux_class_t *this_gen) { +static const char *anx_get_mimetypes (demux_class_t *this_gen) { return "application/x-annodex: ogg: Annodex media;"; } @@ -2140,19 +2140,19 @@ static void *anx_init_class (xine_t *xine, void *data) { * ogg demuxer class */ -static char *ogg_get_description (demux_class_t *this_gen) { +static const char *ogg_get_description (demux_class_t *this_gen) { return "OGG demux plugin"; } -static char *ogg_get_identifier (demux_class_t *this_gen) { +static const char *ogg_get_identifier (demux_class_t *this_gen) { return "OGG"; } -static char *ogg_get_extensions (demux_class_t *this_gen) { +static const char *ogg_get_extensions (demux_class_t *this_gen) { return "ogg ogm spx"; } -static char *ogg_get_mimetypes (demux_class_t *this_gen) { +static const char *ogg_get_mimetypes (demux_class_t *this_gen) { return "audio/x-ogg: ogg: OggVorbis Audio;" "audio/x-speex: ogg: Speex Audio;" "application/x-ogg: ogg: OggVorbis Audio;"; diff --git a/src/demuxers/demux_pva.c b/src/demuxers/demux_pva.c index 44e5112c6..55b1f7644 100644 --- a/src/demuxers/demux_pva.c +++ b/src/demuxers/demux_pva.c @@ -23,7 +23,7 @@ * For more information regarding the PVA file format, refer to this PDF: * http://www.technotrend.de/download/av_format_v1.pdf * - * $Id: demux_pva.c,v 1.24 2006/07/10 22:08:13 dgp85 Exp $ + * $Id: demux_pva.c,v 1.25 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -451,7 +451,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -480,19 +480,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "TechnoTrend PVA demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "TechnoTrend PVA"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "pva"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index b4646b3e5..3b7874cb1 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -30,7 +30,7 @@ * build_frame_table * free_qt_info * - * $Id: demux_qt.c,v 1.212 2006/11/11 12:23:44 molivier Exp $ + * $Id: demux_qt.c,v 1.213 2007/01/19 00:26:40 dgp85 Exp $ * */ @@ -3041,19 +3041,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Apple Quicktime (MOV) and MPEG-4 demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "MOV/MPEG-4"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "mov qt mp4 m4a m4b"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return "video/quicktime: mov,qt: Quicktime animation;" "video/x-quicktime: mov,qt: Quicktime animation;" "audio/x-m4a: m4a,m4b: MPEG-4 audio;" diff --git a/src/demuxers/demux_rawdv.c b/src/demuxers/demux_rawdv.c index 6c7d672e8..7a4cbaec9 100644 --- a/src/demuxers/demux_rawdv.c +++ b/src/demuxers/demux_rawdv.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_rawdv.c,v 1.29 2006/08/08 03:15:02 miguelfreitas Exp $ + * $Id: demux_rawdv.c,v 1.30 2007/01/19 00:26:40 dgp85 Exp $ * * demultiplexer for raw dv streams */ @@ -385,7 +385,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str break; case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -413,19 +413,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Raw DV Video stream"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "raw_dv"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "dv dif"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index 8dfb7b679..f15eb8840 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -31,7 +31,7 @@ * * Based on FFmpeg's libav/rm.c. * - * $Id: demux_real.c,v 1.111 2006/12/22 16:45:44 klan Exp $ + * $Id: demux_real.c,v 1.112 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -1565,7 +1565,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str break; case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -1618,19 +1618,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "RealMedia file demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "Real"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "rm rmvb ram"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return "audio/x-pn-realaudio: ra, rm, ram: Real Media file;" "audio/x-pn-realaudio-plugin: rpm: Real Media plugin file;" "audio/x-real-audio: ra, rm, ram: Real Media file;" diff --git a/src/demuxers/demux_realaudio.c b/src/demuxers/demux_realaudio.c index d1de83015..0b692f185 100644 --- a/src/demuxers/demux_realaudio.c +++ b/src/demuxers/demux_realaudio.c @@ -22,7 +22,7 @@ * RealAudio File Demuxer by Mike Melanson (melanson@pcisys.net) * improved by James Stembridge (jstembridge@users.sourceforge.net) * - * $Id: demux_realaudio.c,v 1.32 2004/06/13 21:28:54 miguelfreitas Exp $ + * $Id: demux_realaudio.c,v 1.33 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -355,7 +355,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -385,19 +385,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "RealAudio file demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "RA"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "ra"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return "audio/x-realaudio: ra: RealAudio File;"; } diff --git a/src/demuxers/demux_roq.c b/src/demuxers/demux_roq.c index ed261d728..0e7c93b97 100644 --- a/src/demuxers/demux_roq.c +++ b/src/demuxers/demux_roq.c @@ -23,7 +23,7 @@ * For more information regarding the RoQ file format, visit: * http://www.csse.monash.edu.au/~timf/ * - * $Id: demux_roq.c,v 1.53 2004/06/13 21:28:54 miguelfreitas Exp $ + * $Id: demux_roq.c,v 1.54 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -432,7 +432,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -462,19 +462,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Id RoQ file demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "RoQ"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "roq"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_shn.c b/src/demuxers/demux_shn.c index e7b7f36be..3db568aab 100644 --- a/src/demuxers/demux_shn.c +++ b/src/demuxers/demux_shn.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_shn.c,v 1.3 2006/12/25 16:54:56 dgp85 Exp $ + * $Id: demux_shn.c,v 1.4 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -202,7 +202,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -230,19 +230,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Shorten demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "Shorten"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "shn"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_slave.c b/src/demuxers/demux_slave.c index 306b14ed4..c49b44f3d 100644 --- a/src/demuxers/demux_slave.c +++ b/src/demuxers/demux_slave.c @@ -21,7 +21,7 @@ */ /* - * $Id: demux_slave.c,v 1.21 2006/07/10 22:08:13 dgp85 Exp $ + * $Id: demux_slave.c,v 1.22 2007/01/19 00:26:40 dgp85 Exp $ * * demuxer for slave "protocol" * master xine must be started with XINE_PARAM_BROADCASTER_PORT set, that is, @@ -393,19 +393,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return ""; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "slave"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return ""; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_smjpeg.c b/src/demuxers/demux_smjpeg.c index afe28328d..9c86314c5 100644 --- a/src/demuxers/demux_smjpeg.c +++ b/src/demuxers/demux_smjpeg.c @@ -23,7 +23,7 @@ * For more information on the SMJPEG file format, visit: * http://www.lokigames.com/development/smjpeg.php3 * - * $Id: demux_smjpeg.c,v 1.50 2004/06/13 21:28:54 miguelfreitas Exp $ + * $Id: demux_smjpeg.c,v 1.51 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -421,7 +421,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -451,19 +451,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "SMJPEG file demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "SMJPEG"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "mjpg"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_snd.c b/src/demuxers/demux_snd.c index c1925bc71..99415890a 100644 --- a/src/demuxers/demux_snd.c +++ b/src/demuxers/demux_snd.c @@ -21,7 +21,7 @@ /* * SND/AU File Demuxer by Mike Melanson (melanson@pcisys.net) * - * $Id: demux_snd.c,v 1.40 2004/10/18 18:20:32 miguelfreitas Exp $ + * $Id: demux_snd.c,v 1.41 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -339,7 +339,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -369,19 +369,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "SND/AU file demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "SND/AU"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "snd au"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return "audio/basic: snd,au: ULAW (Sun) audio;" "audio/x-basic: snd,au: ULAW (Sun) audio;" "audio/x-pn-au: snd,au: ULAW (Sun) audio;"; diff --git a/src/demuxers/demux_str.c b/src/demuxers/demux_str.c index ddb800260..90dbf2117 100644 --- a/src/demuxers/demux_str.c +++ b/src/demuxers/demux_str.c @@ -24,7 +24,7 @@ * This demuxer handles either raw STR files (which are just a concatenation * of raw compact disc sectors) or STR files with RIFF headers. * - * $Id: demux_str.c,v 1.25 2004/06/13 21:28:54 miguelfreitas Exp $ + * $Id: demux_str.c,v 1.26 2007/01/19 00:26:40 dgp85 Exp $ */ /* @@ -576,7 +576,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -605,20 +605,20 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Sony Playstation STR file demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "PSX STR"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { /* also .mov, but we don't want to hijack that extension */ return "str iki ik2 dps dat xa xa1 xa2 xas xap"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index ef68cb698..99bc486a0 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_ts.c,v 1.123 2006/08/08 03:58:15 miguelfreitas Exp $ + * $Id: demux_ts.c,v 1.124 2007/01/19 00:26:40 dgp85 Exp $ * * Demultiplexer for MPEG2 Transport Streams. * @@ -2089,12 +2089,10 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, break; case METHOD_BY_EXTENSION: { - char *extensions, *mrl; - - mrl = input->get_mrl (input); + const char *const mrl = input->get_mrl (input); /* check extension */ - extensions = class_gen->get_extensions (class_gen); + const char *const extensions = class_gen->get_extensions (class_gen); if (_x_demux_check_extension (mrl, extensions)) break; @@ -2190,19 +2188,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, * ts demuxer class */ -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "MPEG Transport Stream demuxer"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "MPEG_TS"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "ts m2t trp"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index 111c38071..c16ed798c 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -20,7 +20,7 @@ * True Audio demuxer by Diego Pettenò * Inspired by tta libavformat demuxer by Alex Beregszaszi * - * $Id: demux_tta.c,v 1.1 2006/12/26 16:59:55 dgp85 Exp $ + * $Id: demux_tta.c,v 1.2 2007/01/19 00:26:40 dgp85 Exp $ */ #define LOG_MODULE "demux_tta" @@ -255,7 +255,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -283,19 +283,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "True Audio demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "True Audio"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "tta"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_vmd.c b/src/demuxers/demux_vmd.c index fb7174031..e2b68fbb1 100644 --- a/src/demuxers/demux_vmd.c +++ b/src/demuxers/demux_vmd.c @@ -28,7 +28,7 @@ * checking the first 2 bytes, which are 0x2E 0x03 in a Sierra VMD file. * There is a 1/65536 chance of a false positive using this method. * - * $Id: demux_vmd.c,v 1.3 2004/06/13 21:28:54 miguelfreitas Exp $ + * $Id: demux_vmd.c,v 1.4 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -442,7 +442,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -472,19 +472,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Sierra VMD file demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "VMD"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "vmd"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_voc.c b/src/demuxers/demux_voc.c index cfd67a9e6..1c1675b92 100644 --- a/src/demuxers/demux_voc.c +++ b/src/demuxers/demux_voc.c @@ -25,7 +25,7 @@ * It will only play that block if it is PCM data. More variations will be * supported as they are encountered. * - * $Id: demux_voc.c,v 1.40 2005/12/24 00:08:42 tmmm Exp $ + * $Id: demux_voc.c,v 1.41 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -317,7 +317,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -347,19 +347,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "VOC file demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "VOC"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "voc"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_vox.c b/src/demuxers/demux_vox.c index 53e8d2399..c772e4978 100644 --- a/src/demuxers/demux_vox.c +++ b/src/demuxers/demux_vox.c @@ -22,7 +22,7 @@ * VOX Demuxer by Mike Melanson (melanson@pcisys.net) * This a demuxer for .vox files containing raw Dialogic ADPCM data. * - * $Id: demux_vox.c,v 1.13 2004/06/13 21:28:54 miguelfreitas Exp $ + * $Id: demux_vox.c,v 1.14 2007/01/19 00:26:40 dgp85 Exp $ * */ @@ -192,7 +192,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str case METHOD_BY_CONTENT: case METHOD_EXPLICIT: case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -225,19 +225,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Dialogic VOX file demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "VOX"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "vox"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_vqa.c b/src/demuxers/demux_vqa.c index 41209ce75..56fbde7d1 100644 --- a/src/demuxers/demux_vqa.c +++ b/src/demuxers/demux_vqa.c @@ -29,7 +29,7 @@ * block needs information from the previous audio block in order to be * decoded, thus making random seeking difficult. * - * $Id: demux_vqa.c,v 1.41 2004/06/13 21:28:55 miguelfreitas Exp $ + * $Id: demux_vqa.c,v 1.42 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -355,7 +355,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -385,19 +385,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Westwood Studios VQA file demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "VQA"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "vqa"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_wav.c b/src/demuxers/demux_wav.c index e23f43aa5..145212eda 100644 --- a/src/demuxers/demux_wav.c +++ b/src/demuxers/demux_wav.c @@ -22,7 +22,7 @@ * MS WAV File Demuxer by Mike Melanson (melanson@pcisys.net) * based on WAV specs that are available far and wide * - * $Id: demux_wav.c,v 1.63 2005/06/04 20:29:16 jstembridge Exp $ + * $Id: demux_wav.c,v 1.64 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -365,7 +365,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -404,19 +404,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "WAV file demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "WAV"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "wav"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return "audio/x-wav: wav: WAV audio;" "audio/wav: wav: WAV audio;" "audio/x-pn-wav: wav: WAV audio;" diff --git a/src/demuxers/demux_wavpack.c b/src/demuxers/demux_wavpack.c index c1433a956..96d517a9f 100644 --- a/src/demuxers/demux_wavpack.c +++ b/src/demuxers/demux_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò * - * $Id: demux_wavpack.c,v 1.3 2007/01/18 21:06:26 dgp85 Exp $ + * $Id: demux_wavpack.c,v 1.4 2007/01/19 00:26:40 dgp85 Exp $ */ #define LOG_MODULE "demux_wavpack" @@ -346,8 +346,8 @@ static demux_plugin_t *open_plugin (demux_class_t *const class_gen, switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *const mrl = input->get_mrl (input); - char *const extensions = class_gen->get_extensions (class_gen); + const char *const mrl = input->get_mrl (input); + const char *const extensions = class_gen->get_extensions (class_gen); if (!_x_demux_check_extension (mrl, extensions)) { free (this); @@ -374,19 +374,19 @@ static demux_plugin_t *open_plugin (demux_class_t *const class_gen, return &this->demux_plugin; } -static char *get_description (demux_class_t *const this_gen) { +static const char *get_description (demux_class_t *const this_gen) { return "Wavpack demux plugin"; } -static char *get_identifier (demux_class_t *const this_gen) { +static const char *get_identifier (demux_class_t *const this_gen) { return "Wavpack"; } -static char *get_extensions (demux_class_t *const this_gen) { +static const char *get_extensions (demux_class_t *const this_gen) { return "wv"; } -static char *get_mimetypes (demux_class_t *const this_gen) { +static const char *get_mimetypes (demux_class_t *const this_gen) { return NULL; } diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c index a41637ba1..fa1cfb17d 100644 --- a/src/demuxers/demux_wc3movie.c +++ b/src/demuxers/demux_wc3movie.c @@ -24,7 +24,7 @@ * For more information on the MVE file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_wc3movie.c,v 1.53 2005/07/26 22:10:40 tmattern Exp $ + * $Id: demux_wc3movie.c,v 1.54 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -688,7 +688,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -718,19 +718,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "Wing Commander III Movie (MVE) demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "WC3 Movie"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "mve"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_yuv4mpeg2.c b/src/demuxers/demux_yuv4mpeg2.c index 126370453..4e0bb1069 100644 --- a/src/demuxers/demux_yuv4mpeg2.c +++ b/src/demuxers/demux_yuv4mpeg2.c @@ -24,7 +24,7 @@ * tools, visit: * http://mjpeg.sourceforge.net/ * - * $Id: demux_yuv4mpeg2.c,v 1.43 2006/07/10 22:08:13 dgp85 Exp $ + * $Id: demux_yuv4mpeg2.c,v 1.44 2007/01/19 00:26:40 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -424,7 +424,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *extensions, *mrl; + const char *extensions, *mrl; mrl = input->get_mrl (input); extensions = class_gen->get_extensions (class_gen); @@ -454,19 +454,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "YUV4MPEG2 file demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "YUV4MPEG2"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return "y4m"; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/demuxers/demux_yuv_frames.c b/src/demuxers/demux_yuv_frames.c index 06115a4d3..421ad6d27 100644 --- a/src/demuxers/demux_yuv_frames.c +++ b/src/demuxers/demux_yuv_frames.c @@ -20,7 +20,7 @@ */ /* - * $Id: demux_yuv_frames.c,v 1.22 2006/07/10 22:08:13 dgp85 Exp $ + * $Id: demux_yuv_frames.c,v 1.23 2007/01/19 00:26:41 dgp85 Exp $ * * dummy demultiplexer for raw yuv frames (delivered by v4l) */ @@ -232,19 +232,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, * demuxer class */ -static char *get_description (demux_class_t *this_gen) { +static const char *get_description (demux_class_t *this_gen) { return "YUV frames dummy demux plugin"; } -static char *get_identifier (demux_class_t *this_gen) { +static const char *get_identifier (demux_class_t *this_gen) { return "YUV_FRAMES"; } -static char *get_extensions (demux_class_t *this_gen) { +static const char *get_extensions (demux_class_t *this_gen) { return NULL; } -static char *get_mimetypes (demux_class_t *this_gen) { +static const char *get_mimetypes (demux_class_t *this_gen) { return NULL; } diff --git a/src/libsputext/demux_sputext.c b/src/libsputext/demux_sputext.c index 13fbd1db1..33d446458 100644 --- a/src/libsputext/demux_sputext.c +++ b/src/libsputext/demux_sputext.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_sputext.c,v 1.51 2007/01/18 11:57:16 mshopf Exp $ + * $Id: demux_sputext.c,v 1.52 2007/01/19 00:26:41 dgp85 Exp $ * * code based on old libsputext/xine_decoder.c * @@ -1452,19 +1452,19 @@ static demux_plugin_t *open_demux_plugin (demux_class_t *class_gen, xine_stream_ return NULL; } -static char *get_demux_description (demux_class_t *this_gen) { +static const char *get_demux_description (demux_class_t *this_gen) { return "sputext demuxer plugin"; } -static char *get_demux_identifier (demux_class_t *this_gen) { +static const char *get_demux_identifier (demux_class_t *this_gen) { return "sputext"; } -static char *get_demux_extensions (demux_class_t *this_gen) { +static const char *get_demux_extensions (demux_class_t *this_gen) { return "asc txt sub srt smi ssa"; } -static char *get_demux_mimetypes (demux_class_t *this_gen) { +static const char *get_demux_mimetypes (demux_class_t *this_gen) { return NULL; /* do not report this mimetype, it might confuse browsers. */ -- cgit v1.2.3 From 17d470f75b57265107c7f164334dbc53489124cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 19 Jan 2007 01:05:24 +0000 Subject: Make get_mrl return a const char * too. CVS patchset: 8524 CVS date: 2007/01/19 01:05:24 --- src/demuxers/demux_asf.c | 16 ++++------------ src/demuxers/demux_mpeg_block.c | 6 +++--- src/demuxers/demux_mpeg_pes.c | 9 +++------ src/demuxers/demux_qt.c | 9 +++------ src/demuxers/demux_slave.c | 6 ++---- src/demuxers/demux_yuv_frames.c | 6 ++---- src/input/input_cdda.c | 4 ++-- src/input/input_dvb.c | 2 +- src/input/input_dvd.c | 4 ++-- src/input/input_file.c | 4 ++-- src/input/input_gnome_vfs.c | 4 ++-- src/input/input_http.c | 4 ++-- src/input/input_mms.c | 4 ++-- src/input/input_net.c | 4 ++-- src/input/input_plugin.h | 4 ++-- src/input/input_pnm.c | 2 +- src/input/input_pvr.c | 4 ++-- src/input/input_rtp.c | 2 +- src/input/input_rtsp.c | 2 +- src/input/input_stdin_fifo.c | 4 ++-- src/input/input_v4l.c | 2 +- src/input/input_vcd.c | 4 ++-- src/libsputext/demux_sputext.c | 8 +++----- src/xine-engine/input_cache.c | 4 ++-- src/xine-engine/input_rip.c | 4 ++-- 25 files changed, 51 insertions(+), 71 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index 1bdea2fd7..bd48d9466 100644 --- a/src/demuxers/demux_asf.c +++ b/src/demuxers/demux_asf.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_asf.c,v 1.191 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_asf.c,v 1.192 2007/01/19 01:05:24 dgp85 Exp $ * * demultiplexer for asf streams * @@ -1356,7 +1356,6 @@ static int demux_asf_parse_http_references( demux_asf_t *this) { int buf_used = 0; int len; char *href = NULL; - char *mrl; int free_href = 0; /* read file to memory. @@ -1381,7 +1380,7 @@ static int demux_asf_parse_http_references( demux_asf_t *this) { ptr = buf; if (!strncmp(ptr, "[Reference]", 11)) { - mrl = this->input->get_mrl(this->input); + const char *const mrl = this->input->get_mrl(this->input); if (!strncmp(mrl, "http", 4)) { /* never trust a ms server, reopen the same mrl with the mms input plugin * some servers are badly configured and return a incorrect reference. @@ -2052,15 +2051,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, break; case METHOD_BY_EXTENSION: { - char *ending, *mrl; - - mrl = input->get_mrl (input); - - /* - * check extension - */ - - ending = strrchr (mrl, '.'); + const char *const mrl = input->get_mrl (input); + const char *const ending = strrchr (mrl, '.'); if (!ending) return NULL; diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index 760f8a6d1..e149e027a 100644 --- a/src/demuxers/demux_mpeg_block.c +++ b/src/demuxers/demux_mpeg_block.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpeg_block.c,v 1.218 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_mpeg_block.c,v 1.219 2007/01/19 01:05:24 dgp85 Exp $ * * demultiplexer for mpeg 1/2 program streams * used with fixed blocksize devices (like dvd/vcd) @@ -1456,9 +1456,9 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str break; case METHOD_BY_EXTENSION: { - char *ending, *mrl; + char *ending; - mrl = input->get_mrl (input); + const char *const mrl = input->get_mrl (input); if(!strncmp(mrl, "vcd:", 4)) { this->blocksize = 2324; diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c index e9b7b8e52..0e0a3501d 100644 --- a/src/demuxers/demux_mpeg_pes.c +++ b/src/demuxers/demux_mpeg_pes.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpeg_pes.c,v 1.38 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_mpeg_pes.c,v 1.39 2007/01/19 01:05:24 dgp85 Exp $ * * demultiplexer for mpeg 2 PES (Packetized Elementary Streams) * reads streams of variable blocksizes @@ -1594,11 +1594,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str break; case METHOD_BY_EXTENSION: { - char *ending, *mrl; - - mrl = input->get_mrl (input); - - ending = strrchr(mrl, '.'); + const char *const mrl = input->get_mrl (input); + const char *const ending = strrchr(mrl, '.'); if (!ending) { free (this->scratch_base); diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 3b7874cb1..4144f3049 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -30,7 +30,7 @@ * build_frame_table * free_qt_info * - * $Id: demux_qt.c,v 1.213 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_qt.c,v 1.214 2007/01/19 01:05:24 dgp85 Exp $ * */ @@ -2993,11 +2993,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str break; case METHOD_BY_EXTENSION: { - char *ending, *mrl; - - mrl = input->get_mrl (input); - - ending = strrchr(mrl, '.'); + const char *const mrl = input->get_mrl (input); + const char *const ending = strrchr(mrl, '.'); if (!ending) { free (this); diff --git a/src/demuxers/demux_slave.c b/src/demuxers/demux_slave.c index c49b44f3d..a00ad0661 100644 --- a/src/demuxers/demux_slave.c +++ b/src/demuxers/demux_slave.c @@ -21,7 +21,7 @@ */ /* - * $Id: demux_slave.c,v 1.22 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_slave.c,v 1.23 2007/01/19 01:05:24 dgp85 Exp $ * * demuxer for slave "protocol" * master xine must be started with XINE_PARAM_BROADCASTER_PORT set, that is, @@ -338,9 +338,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *mrl; - - mrl = input->get_mrl (input); + const char *const mrl = input->get_mrl (input); if(!strncmp(mrl, "slave://", 8)) break; diff --git a/src/demuxers/demux_yuv_frames.c b/src/demuxers/demux_yuv_frames.c index 421ad6d27..3866f0437 100644 --- a/src/demuxers/demux_yuv_frames.c +++ b/src/demuxers/demux_yuv_frames.c @@ -20,7 +20,7 @@ */ /* - * $Id: demux_yuv_frames.c,v 1.23 2007/01/19 00:26:41 dgp85 Exp $ + * $Id: demux_yuv_frames.c,v 1.24 2007/01/19 01:05:24 dgp85 Exp $ * * dummy demultiplexer for raw yuv frames (delivered by v4l) */ @@ -185,9 +185,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, break; case METHOD_BY_EXTENSION: { - char *mrl; - - mrl = input->get_mrl (input); + const char *const mrl = input->get_mrl (input); if (strncmp (mrl, "v4l:/", 5)) return NULL; diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index 3733172e5..632ca3252 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -20,7 +20,7 @@ * Compact Disc Digital Audio (CDDA) Input Plugin * by Mike Melanson (melanson@pcisys.net) * - * $Id: input_cdda.c,v 1.92 2007/01/18 23:02:18 dgp85 Exp $ + * $Id: input_cdda.c,v 1.93 2007/01/19 01:05:24 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -2270,7 +2270,7 @@ static uint32_t cdda_plugin_get_blocksize (input_plugin_t *this_gen) { return CD_RAW_FRAME_SIZE; } -static char* cdda_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* cdda_plugin_get_mrl (input_plugin_t *this_gen) { cdda_input_plugin_t *this = (cdda_input_plugin_t *) this_gen; return this->mrl; diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 3bc9008a7..39507ac15 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -2651,7 +2651,7 @@ static void dvb_plugin_dispose (input_plugin_t *this_gen) { free (this); } -static char* dvb_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* dvb_plugin_get_mrl (input_plugin_t *this_gen) { dvb_input_plugin_t *this = (dvb_input_plugin_t *) this_gen; return this->mrl; diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index 6a8315ce1..c132bdb04 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_dvd.c,v 1.213 2007/01/18 23:02:18 dgp85 Exp $ + * $Id: input_dvd.c,v 1.214 2007/01/19 01:05:25 dgp85 Exp $ * */ @@ -930,7 +930,7 @@ static uint32_t dvd_plugin_get_blocksize (input_plugin_t *this_gen) { return DVD_BLOCK_SIZE; } -static char* dvd_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* dvd_plugin_get_mrl (input_plugin_t *this_gen) { dvd_input_plugin_t *this = (dvd_input_plugin_t*)this_gen; trace_print("Called\n"); diff --git a/src/input/input_file.c b/src/input/input_file.c index dd2f078f9..82e317492 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_file.c,v 1.119 2007/01/18 23:02:18 dgp85 Exp $ + * $Id: input_file.c,v 1.120 2007/01/19 01:05:25 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -299,7 +299,7 @@ static int is_a_dir(char *filepathname) { return (S_ISDIR(pstat.st_mode)); } -static char* file_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* file_plugin_get_mrl (input_plugin_t *this_gen) { file_input_plugin_t *this = (file_input_plugin_t *) this_gen; return this->mrl; diff --git a/src/input/input_gnome_vfs.c b/src/input/input_gnome_vfs.c index 8948abe54..b9f516931 100644 --- a/src/input/input_gnome_vfs.c +++ b/src/input/input_gnome_vfs.c @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_gnome_vfs.c,v 1.33 2007/01/18 23:02:18 dgp85 Exp $ + * $Id: input_gnome_vfs.c,v 1.34 2007/01/19 01:05:25 dgp85 Exp $ */ @@ -204,7 +204,7 @@ gnomevfs_plugin_get_blocksize (input_plugin_t *this_gen) return 32 * 1024; } -static char* +static const char* gnomevfs_plugin_get_mrl (input_plugin_t *this_gen) { gnomevfs_input_t *this = (gnomevfs_input_t *) this_gen; diff --git a/src/input/input_http.c b/src/input/input_http.c index 18990e2bf..8555e3bc8 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -19,7 +19,7 @@ * * input plugin for http network streams * - * $Id: input_http.c,v 1.126 2007/01/18 23:02:18 dgp85 Exp $ + * $Id: input_http.c,v 1.127 2007/01/19 01:05:25 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -574,7 +574,7 @@ static off_t http_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin return this->curpos; } -static char* http_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* http_plugin_get_mrl (input_plugin_t *this_gen) { http_input_plugin_t *this = (http_input_plugin_t *) this_gen; return this->mrl; diff --git a/src/input/input_mms.c b/src/input/input_mms.c index 350958d89..52a0d4bab 100644 --- a/src/input/input_mms.c +++ b/src/input/input_mms.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_mms.c,v 1.67 2007/01/18 23:02:18 dgp85 Exp $ + * $Id: input_mms.c,v 1.68 2007/01/19 01:05:25 dgp85 Exp $ * * mms input plugin based on work from major mms */ @@ -292,7 +292,7 @@ static void mms_plugin_dispose (input_plugin_t *this_gen) { free (this); } -static char* mms_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* mms_plugin_get_mrl (input_plugin_t *this_gen) { mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; return this->mrl; diff --git a/src/input/input_net.c b/src/input/input_net.c index 1baa8c3c6..0ce2e1340 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -20,7 +20,7 @@ * Read from a tcp network stream over a lan (put a tweaked mp1e encoder the * other end and you can watch tv anywhere in the house ..) * - * $Id: input_net.c,v 1.69 2007/01/18 23:02:18 dgp85 Exp $ + * $Id: input_net.c,v 1.70 2007/01/19 01:05:25 dgp85 Exp $ * * how to set up mp1e for use with this plugin: * @@ -367,7 +367,7 @@ static off_t net_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin } -static char* net_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* net_plugin_get_mrl (input_plugin_t *this_gen) { net_input_plugin_t *this = (net_input_plugin_t *) this_gen; return this->mrl; diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h index aebbd08e7..370dc6a71 100644 --- a/src/input/input_plugin.h +++ b/src/input/input_plugin.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_plugin.h,v 1.63 2007/01/18 23:02:18 dgp85 Exp $ + * $Id: input_plugin.h,v 1.64 2007/01/19 01:05:25 dgp85 Exp $ */ #ifndef HAVE_INPUT_PLUGIN_H @@ -201,7 +201,7 @@ struct input_plugin_s { /* * return current MRL */ - char * (*get_mrl) (input_plugin_t *this); + const char * (*get_mrl) (input_plugin_t *this); /* diff --git a/src/input/input_pnm.c b/src/input/input_pnm.c index c847ca767..af860ac1e 100644 --- a/src/input/input_pnm.c +++ b/src/input/input_pnm.c @@ -181,7 +181,7 @@ static void pnm_plugin_dispose (input_plugin_t *this_gen) { free (this); } -static char* pnm_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* pnm_plugin_get_mrl (input_plugin_t *this_gen) { pnm_input_plugin_t *this = (pnm_input_plugin_t *) this_gen; return this->mrl; diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c index 93af332f4..bcf93af2b 100644 --- a/src/input/input_pvr.c +++ b/src/input/input_pvr.c @@ -38,7 +38,7 @@ * usage: * xine pvr:/\!\! * - * $Id: input_pvr.c,v 1.64 2007/01/18 23:02:18 dgp85 Exp $ + * $Id: input_pvr.c,v 1.65 2007/01/19 01:05:25 dgp85 Exp $ */ /************************************************************************** @@ -1317,7 +1317,7 @@ static uint32_t pvr_plugin_get_blocksize (input_plugin_t *this_gen) { return PVR_BLOCK_SIZE; } -static char* pvr_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* pvr_plugin_get_mrl (input_plugin_t *this_gen) { pvr_input_plugin_t *this = (pvr_input_plugin_t *) this_gen; return this->mrl; diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c index da6bad281..cd5d89686 100644 --- a/src/input/input_rtp.c +++ b/src/input/input_rtp.c @@ -559,7 +559,7 @@ static uint32_t rtp_plugin_get_blocksize (input_plugin_t *this_gen) { /* * */ -static char* rtp_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* rtp_plugin_get_mrl (input_plugin_t *this_gen) { rtp_input_plugin_t *this = (rtp_input_plugin_t *) this_gen; return this->mrl; diff --git a/src/input/input_rtsp.c b/src/input/input_rtsp.c index 5a7cc6c7f..c23c761cc 100644 --- a/src/input/input_rtsp.c +++ b/src/input/input_rtsp.c @@ -196,7 +196,7 @@ static void rtsp_plugin_dispose (input_plugin_t *this_gen) { free (this); } -static char* rtsp_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* rtsp_plugin_get_mrl (input_plugin_t *this_gen) { rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; return this->public_mrl; diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c index 435bf795b..654e5d1a2 100644 --- a/src/input/input_stdin_fifo.c +++ b/src/input/input_stdin_fifo.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_stdin_fifo.c,v 1.68 2007/01/18 23:02:18 dgp85 Exp $ + * $Id: input_stdin_fifo.c,v 1.69 2007/01/19 01:05:25 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -202,7 +202,7 @@ static off_t stdin_plugin_get_current_pos (input_plugin_t *this_gen){ return this->curpos; } -static char* stdin_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* stdin_plugin_get_mrl (input_plugin_t *this_gen) { stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen; return this->mrl; diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c index 8143c6b13..17c4223a2 100644 --- a/src/input/input_v4l.c +++ b/src/input/input_v4l.c @@ -1628,7 +1628,7 @@ static void v4l_plugin_dispose (input_plugin_t *this_gen) { * * Get the current MRL used by the plugin. */ -static char* v4l_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* v4l_plugin_get_mrl (input_plugin_t *this_gen) { v4l_input_plugin_t *this = (v4l_input_plugin_t *) this_gen; return this->mrl; diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index 06b6707f9..82c1b53d9 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_vcd.c,v 1.87 2007/01/18 23:02:18 dgp85 Exp $ + * $Id: input_vcd.c,v 1.88 2007/01/19 01:05:25 dgp85 Exp $ * */ @@ -813,7 +813,7 @@ static void vcd_plugin_dispose (input_plugin_t *this_gen ) { free (this); } -static char* vcd_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* vcd_plugin_get_mrl (input_plugin_t *this_gen) { vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; return this->mrl; diff --git a/src/libsputext/demux_sputext.c b/src/libsputext/demux_sputext.c index 33d446458..c17dde6c8 100644 --- a/src/libsputext/demux_sputext.c +++ b/src/libsputext/demux_sputext.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_sputext.c,v 1.52 2007/01/19 00:26:41 dgp85 Exp $ + * $Id: demux_sputext.c,v 1.53 2007/01/19 01:05:25 dgp85 Exp $ * * code based on old libsputext/xine_decoder.c * @@ -1404,10 +1404,8 @@ static demux_plugin_t *open_demux_plugin (demux_class_t *class_gen, xine_stream_ switch (stream->content_detection_method) { case METHOD_BY_EXTENSION: { - char *mrl, *ending; - - mrl = input->get_mrl(input); - ending = strrchr(mrl, '.'); + const char *const mrl = input->get_mrl(input); + const char *const ending = strrchr(mrl, '.'); if (!ending || ( (strncasecmp(ending, ".asc", 4) != 0) && diff --git a/src/xine-engine/input_cache.c b/src/xine-engine/input_cache.c index 33b8b47da..be5b005ec 100644 --- a/src/xine-engine/input_cache.c +++ b/src/xine-engine/input_cache.c @@ -22,7 +22,7 @@ * The goal of this input plugin is to reduce * the number of calls to the real input plugin. * - * $Id: input_cache.c,v 1.12 2006/09/08 06:20:37 tmattern Exp $ + * $Id: input_cache.c,v 1.13 2007/01/19 01:05:25 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -304,7 +304,7 @@ static uint32_t cache_plugin_get_blocksize(input_plugin_t *this_gen) { return this->main_input_plugin->get_blocksize(this->main_input_plugin); } -static char* cache_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* cache_plugin_get_mrl (input_plugin_t *this_gen) { cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen; return this->main_input_plugin->get_mrl(this->main_input_plugin); diff --git a/src/xine-engine/input_rip.c b/src/xine-engine/input_rip.c index bdcc1ce50..d7a0c46ca 100644 --- a/src/xine-engine/input_rip.c +++ b/src/xine-engine/input_rip.c @@ -29,7 +29,7 @@ * - it's possible speeder saving streams in the xine without playing: * xine stream_mrl#save:file.raw\;noaudio\;novideo * - * $Id: input_rip.c,v 1.32 2007/01/07 20:26:23 klan Exp $ + * $Id: input_rip.c,v 1.33 2007/01/19 01:05:25 dgp85 Exp $ */ /* TODO: @@ -479,7 +479,7 @@ static uint32_t rip_plugin_get_blocksize(input_plugin_t *this_gen) { return this->main_input_plugin->get_blocksize(this->main_input_plugin); } -static char* rip_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* rip_plugin_get_mrl (input_plugin_t *this_gen) { rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen; return this->main_input_plugin->get_mrl(this->main_input_plugin); -- cgit v1.2.3 From 724368ce004ce59b82a8aa0dfdccc0ab31acdac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 19 Jan 2007 01:14:19 +0000 Subject: Make iterator variables constant when used with constant tables. CVS patchset: 8525 CVS date: 2007/01/19 01:14:19 --- src/libmpeg2/slice.c | 26 +++++++++++++------------- src/libmpeg2/slice_xvmc.c | 36 ++++++++++++++++++------------------ 2 files changed, 31 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/libmpeg2/slice.c b/src/libmpeg2/slice.c index f214f1f25..8cb5c33b6 100644 --- a/src/libmpeg2/slice.c +++ b/src/libmpeg2/slice.c @@ -45,7 +45,7 @@ static inline int get_macroblock_modes (picture_t * picture) #define bits (picture->bitstream_bits) #define bit_ptr (picture->bitstream_ptr) int macroblock_modes; - MBtab * tab; + const MBtab * tab; switch (picture->picture_coding_type) { case I_TYPE: @@ -160,7 +160,7 @@ static inline int get_motion_delta (picture_t * picture, int f_code) int delta; int sign; - MVtab * tab; + const MVtab * tab; if (bit_buf & 0x80000000) { DUMPBITS (bit_buf, bits, 1); @@ -230,7 +230,7 @@ static inline int get_dmv (picture_t * picture) #define bits (picture->bitstream_bits) #define bit_ptr (picture->bitstream_ptr) - DMVtab * tab; + const DMVtab * tab; tab = DMV_2 + UBITS (bit_buf, 2); DUMPBITS (bit_buf, bits, tab->len); @@ -246,7 +246,7 @@ static inline int get_coded_block_pattern (picture_t * picture) #define bits (picture->bitstream_bits) #define bit_ptr (picture->bitstream_ptr) - CBPtab * tab; + const CBPtab * tab; NEEDBITS (bit_buf, bits, bit_ptr); @@ -273,7 +273,7 @@ static inline int get_luma_dc_dct_diff (picture_t * picture) #define bit_buf (picture->bitstream_buf) #define bits (picture->bitstream_bits) #define bit_ptr (picture->bitstream_ptr) - DCtab * tab; + const DCtab * tab; int size; int dc_diff; @@ -310,7 +310,7 @@ static inline int get_chroma_dc_dct_diff (picture_t * picture) #define bit_buf (picture->bitstream_buf) #define bits (picture->bitstream_bits) #define bit_ptr (picture->bitstream_ptr) - DCtab * tab; + const DCtab * tab; int size; int dc_diff; @@ -357,7 +357,7 @@ static void get_intra_block_B14 (picture_t * picture) uint8_t * quant_matrix = picture->intra_quantizer_matrix; int quantizer_scale = picture->quantizer_scale; int mismatch; - DCTtab * tab; + const DCTtab * tab; uint32_t bit_buf; int bits; uint8_t * bit_ptr; @@ -471,7 +471,7 @@ static void get_intra_block_B15 (picture_t * picture) uint8_t * quant_matrix = picture->intra_quantizer_matrix; int quantizer_scale = picture->quantizer_scale; int mismatch; - DCTtab * tab; + const DCTtab * tab; uint32_t bit_buf; int bits; uint8_t * bit_ptr; @@ -584,7 +584,7 @@ static void get_non_intra_block (picture_t * picture) uint8_t * quant_matrix = picture->non_intra_quantizer_matrix; int quantizer_scale = picture->quantizer_scale; int mismatch; - DCTtab * tab; + const DCTtab * tab; uint32_t bit_buf; int bits; uint8_t * bit_ptr; @@ -706,7 +706,7 @@ static void get_mpeg1_intra_block (picture_t * picture) uint8_t * scan = picture->scan; uint8_t * quant_matrix = picture->intra_quantizer_matrix; int quantizer_scale = picture->quantizer_scale; - DCTtab * tab; + const DCTtab * tab; uint32_t bit_buf; int bits; uint8_t * bit_ptr; @@ -825,7 +825,7 @@ static void get_mpeg1_non_intra_block (picture_t * picture) uint8_t * scan = picture->scan; uint8_t * quant_matrix = picture->non_intra_quantizer_matrix; int quantizer_scale = picture->quantizer_scale; - DCTtab * tab; + const DCTtab * tab; uint32_t bit_buf; int bits; uint8_t * bit_ptr; @@ -1463,7 +1463,7 @@ static inline int slice_init (picture_t * picture, int code) int offset, height; struct vo_frame_s * forward_reference_frame; struct vo_frame_s * backward_reference_frame; - MBAtab * mba; + const MBAtab * mba; offset = picture->picture_structure == BOTTOM_FIELD; picture->pitches[0] = picture->current_frame->pitches[0]; @@ -1634,7 +1634,7 @@ void mpeg2_slice (picture_t * picture, int code, uint8_t * buffer) while (1) { int macroblock_modes; int mba_inc; - MBAtab * mba; + const MBAtab * mba; NEEDBITS (bit_buf, bits, bit_ptr); diff --git a/src/libmpeg2/slice_xvmc.c b/src/libmpeg2/slice_xvmc.c index 4aa383b9a..e21b1eb98 100644 --- a/src/libmpeg2/slice_xvmc.c +++ b/src/libmpeg2/slice_xvmc.c @@ -96,7 +96,7 @@ static inline int get_xvmc_macroblock_modes (picture_t * picture) #define bits (picture->bitstream_bits) #define bit_ptr (picture->bitstream_ptr) int macroblock_modes; - MBtab * tab; + const MBtab * tab; switch (picture->picture_coding_type) { case I_TYPE: @@ -211,7 +211,7 @@ static inline int get_xvmc_motion_delta (picture_t * picture, int f_code) int delta; int sign; - MVtab * tab; + const MVtab * tab; if (bit_buf & 0x80000000) { DUMPBITS (bit_buf, bits, 1); @@ -281,7 +281,7 @@ static inline int get_xvmc_dmv (picture_t * picture) #define bits (picture->bitstream_bits) #define bit_ptr (picture->bitstream_ptr) - DMVtab * tab; + const DMVtab * tab; tab = DMV_2 + UBITS (bit_buf, 2); DUMPBITS (bit_buf, bits, tab->len); @@ -297,7 +297,7 @@ static inline int get_xvmc_coded_block_pattern (picture_t * picture) #define bits (picture->bitstream_bits) #define bit_ptr (picture->bitstream_ptr) - CBPtab * tab; + const CBPtab * tab; NEEDBITS (bit_buf, bits, bit_ptr); @@ -324,7 +324,7 @@ static inline int get_xvmc_luma_dc_dct_diff (picture_t * picture) #define bit_buf (picture->bitstream_buf) #define bits (picture->bitstream_bits) #define bit_ptr (picture->bitstream_ptr) - DCtab * tab; + const DCtab * tab; int size; int dc_diff; @@ -361,7 +361,7 @@ static inline int get_xvmc_chroma_dc_dct_diff (picture_t * picture) #define bit_buf (picture->bitstream_buf) #define bits (picture->bitstream_bits) #define bit_ptr (picture->bitstream_ptr) - DCtab * tab; + const DCtab * tab; int size; int dc_diff; @@ -405,12 +405,12 @@ static void get_xvmc_intra_block_B14 (picture_t * picture) int j; int l; int val; - uint8_t * scan = picture->scan; + const uint8_t * scan = picture->scan; uint8_t * scan_ptable = mpeg2_scan_orig_ptable; uint8_t * quant_matrix = picture->intra_quantizer_matrix; int quantizer_scale = picture->quantizer_scale; int mismatch; - DCTtab * tab; + const DCTtab * tab; uint32_t bit_buf; int bits; uint8_t * bit_ptr; @@ -534,12 +534,12 @@ static void get_xvmc_intra_block_B15 (picture_t * picture) int j; int l; int val; - uint8_t * scan = picture->scan; + const uint8_t * scan = picture->scan; uint8_t * scan_ptable = mpeg2_scan_orig_ptable; uint8_t * quant_matrix = picture->intra_quantizer_matrix; int quantizer_scale = picture->quantizer_scale; int mismatch; - DCTtab * tab; + const DCTtab * tab; uint32_t bit_buf; int bits; uint8_t * bit_ptr; @@ -661,12 +661,12 @@ static void get_xvmc_non_intra_block (picture_t * picture) int j; int l; int val; - uint8_t * scan = picture->scan; + const uint8_t * scan = picture->scan; uint8_t * scan_ptable = mpeg2_scan_orig_ptable; uint8_t * quant_matrix = picture->non_intra_quantizer_matrix; int quantizer_scale = picture->quantizer_scale; int mismatch; - DCTtab * tab; + const DCTtab * tab; uint32_t bit_buf; int bits; uint8_t * bit_ptr; @@ -797,11 +797,11 @@ static void get_xvmc_mpeg1_intra_block (picture_t * picture) int j; int l; int val; - uint8_t * scan = picture->scan; + const uint8_t * scan = picture->scan; uint8_t * scan_ptable = mpeg2_scan_orig_ptable; uint8_t * quant_matrix = picture->intra_quantizer_matrix; int quantizer_scale = picture->quantizer_scale; - DCTtab * tab; + const DCTtab * tab; uint32_t bit_buf; int bits; uint8_t * bit_ptr; @@ -929,11 +929,11 @@ static void get_xvmc_mpeg1_non_intra_block (picture_t * picture) int j; int l; int val; - uint8_t * scan = picture->scan; + const uint8_t * scan = picture->scan; uint8_t * scan_ptable = mpeg2_scan_orig_ptable; uint8_t * quant_matrix = picture->non_intra_quantizer_matrix; int quantizer_scale = picture->quantizer_scale; - DCTtab * tab; + const DCTtab * tab; uint32_t bit_buf; int bits; uint8_t * bit_ptr; @@ -1473,7 +1473,7 @@ static inline int slice_xvmc_init (picture_t * picture, int code) int offset, height; struct vo_frame_s * forward_reference_frame; struct vo_frame_s * backward_reference_frame; - MBAtab * mba; + const MBAtab * mba; offset = picture->picture_structure == BOTTOM_FIELD; picture->pitches[0] = picture->current_frame->pitches[0]; @@ -1664,7 +1664,7 @@ void mpeg2_xvmc_slice (mpeg2dec_accel_t *accel, picture_t * picture, int code, u while (1) { int macroblock_modes; int mba_inc; - MBAtab * mba; + const MBAtab * mba; NEEDBITS (bit_buf, bits, bit_ptr); -- cgit v1.2.3 From 1fd15c0a4b22302656d29123c07ba23d811235f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 19 Jan 2007 01:16:46 +0000 Subject: Fix possible strict aliasing breakage. CVS patchset: 8526 CVS date: 2007/01/19 01:16:46 --- src/input/libreal/real.c | 17 +++++++---------- src/xine-engine/broadcaster.c | 15 +++++++++------ 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/input/libreal/real.c b/src/input/libreal/real.c index c3d39fab3..dc0c001bd 100644 --- a/src/input/libreal/real.c +++ b/src/input/libreal/real.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real.c,v 1.25 2006/12/18 21:31:47 klan Exp $ + * $Id: real.c,v 1.26 2007/01/19 01:19:06 dgp85 Exp $ * * special functions for real streams. * adopted from joschkas real tools. @@ -289,18 +289,15 @@ static void calc_response (char *result, char *field) { static void calc_response_string (char *result, char *challenge) { - char field[128]; + char field[128] = { + 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, + 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; char zres[20]; int i; - /* initialize our field */ - BE_32C (field, 0x01234567); - BE_32C ((field+4), 0x89ABCDEF); - BE_32C ((field+8), 0xFEDCBA98); - BE_32C ((field+12), 0x76543210); - BE_32C ((field+16), 0x00000000); - BE_32C ((field+20), 0x00000000); - /* calculate response */ call_hash(field, challenge, 64); calc_response(zres,field); diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c index edf52e474..fab99cf55 100644 --- a/src/xine-engine/broadcaster.c +++ b/src/xine-engine/broadcaster.c @@ -19,7 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: broadcaster.c,v 1.12 2006/06/20 00:18:44 dgp85 Exp $ + * $Id: broadcaster.c,v 1.13 2007/01/19 01:16:46 dgp85 Exp $ * * broadcaster.c - xine network broadcaster * @@ -305,7 +305,10 @@ static void audio_put_cb (fifo_buffer_t *fifo, buf_element_t *buf, void *this_ge broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port) { broadcaster_t *this; - struct sockaddr_in servAddr; + union { + struct sockaddr_in in; + struct sockaddr sa; + } servAddr; int msock, err; msock = socket(PF_INET, SOCK_STREAM, 0); @@ -314,11 +317,11 @@ broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port) xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: error opening master socket.\n"); return NULL; } - servAddr.sin_family = AF_INET; - servAddr.sin_addr.s_addr = htonl(INADDR_ANY); - servAddr.sin_port = htons(port); + servAddr.in.sin_family = AF_INET; + servAddr.in.sin_addr.s_addr = htonl(INADDR_ANY); + servAddr.in.sin_port = htons(port); - if(bind(msock, (struct sockaddr *) &servAddr, sizeof(servAddr))<0) + if(bind(msock, &servAddr.sa, sizeof(servAddr))<0) { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: error binding to port %d\n", port); return NULL; -- cgit v1.2.3 From 7f9137760dac9a965b11c63ee677e7f49b2a588b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 19 Jan 2007 01:21:25 +0000 Subject: Extra safety, although it should be good anyway. CVS patchset: 8527 CVS date: 2007/01/19 01:21:25 --- src/xine-engine/broadcaster.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c index fab99cf55..fc70df7b1 100644 --- a/src/xine-engine/broadcaster.c +++ b/src/xine-engine/broadcaster.c @@ -19,7 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: broadcaster.c,v 1.13 2007/01/19 01:16:46 dgp85 Exp $ + * $Id: broadcaster.c,v 1.14 2007/01/19 01:21:25 dgp85 Exp $ * * broadcaster.c - xine network broadcaster * @@ -321,7 +321,7 @@ broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port) servAddr.in.sin_addr.s_addr = htonl(INADDR_ANY); servAddr.in.sin_port = htons(port); - if(bind(msock, &servAddr.sa, sizeof(servAddr))<0) + if(bind(msock, &servAddr.sa, sizeof(servAddr.sa))<0) { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: error binding to port %d\n", port); return NULL; -- cgit v1.2.3 From 91a936809d488528b7cf8a6c35c0c3494a3d5687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 19 Jan 2007 01:23:06 +0000 Subject: Err no it was the other way around. CVS patchset: 8528 CVS date: 2007/01/19 01:23:06 --- src/xine-engine/broadcaster.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c index fc70df7b1..3beacb226 100644 --- a/src/xine-engine/broadcaster.c +++ b/src/xine-engine/broadcaster.c @@ -19,7 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: broadcaster.c,v 1.14 2007/01/19 01:21:25 dgp85 Exp $ + * $Id: broadcaster.c,v 1.15 2007/01/19 01:23:06 dgp85 Exp $ * * broadcaster.c - xine network broadcaster * @@ -321,7 +321,7 @@ broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port) servAddr.in.sin_addr.s_addr = htonl(INADDR_ANY); servAddr.in.sin_port = htons(port); - if(bind(msock, &servAddr.sa, sizeof(servAddr.sa))<0) + if(bind(msock, &servAddr.sa, sizeof(servAddr.in))<0) { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "broadcaster: error binding to port %d\n", port); return NULL; -- cgit v1.2.3 From f5b453ed52b4648189d0618d8d023a579330cd66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 19 Jan 2007 01:25:24 +0000 Subject: Fix possible strict aliasing breakage. CVS patchset: 8529 CVS date: 2007/01/19 01:25:24 --- src/input/input_rtp.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c index cd5d89686..d4ba804c6 100644 --- a/src/input/input_rtp.c +++ b/src/input/input_rtp.c @@ -174,7 +174,10 @@ static int host_connect_attempt(struct in_addr ia, int port, const char *interface, xine_t *xine) { int s=socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); - struct sockaddr_in sin; + union { + struct sockaddr_in in; + struct sockaddr sa; + } saddr; int optval; int multicast = 0; /* boolean, assume unicast */ @@ -183,12 +186,12 @@ static int host_connect_attempt(struct in_addr ia, int port, return -1; } - sin.sin_family = AF_INET; - sin.sin_addr = ia; - sin.sin_port = htons(port); + saddr.in.sin_family = AF_INET; + saddr.in.sin_addr = ia; + saddr.in.sin_port = htons(port); /* Is it a multicast address? */ - if ((ntohl(sin.sin_addr.s_addr) >> 28) == 0xe) { + if ((ntohl(saddr.in.sin_addr.s_addr) >> 28) == 0xe) { LOG_MSG(xine, _("IP address specified is multicast\n")); multicast = 1; /* boolean true */ } @@ -205,14 +208,14 @@ static int host_connect_attempt(struct in_addr ia, int port, /* If multicast we allow multiple readers to open the same address */ if (multicast) { if ((setsockopt(s, SOL_SOCKET, SO_REUSEADDR, - &sin, sizeof(sin))) < 0) { + &saddr.in, sizeof(saddr.in))) < 0) { LOG_MSG(xine, _("setsockopt(SO_REUSEADDR): %s.\n"), strerror(errno)); return -1; } } /* datagram socket */ - if (bind(s, (struct sockaddr *)&sin, sizeof(sin))) { + if (bind(s, &saddr.sa, sizeof(saddr.in))) { LOG_MSG(xine, _("bind(): %s.\n"), strerror(errno)); return -1; } @@ -240,7 +243,7 @@ static int host_connect_attempt(struct in_addr ia, int port, } /* struct ip_mreq mreq; */ - mreq.imr_multiaddr.s_addr = sin.sin_addr.s_addr; + mreq.imr_multiaddr.s_addr = saddr.in.sin_addr.s_addr; if (interface == NULL) { mreq.imr_interface.s_addr = htonl(INADDR_ANY); } -- cgit v1.2.3 From 528c2f2246d52a89cb99906193f434d58781a2eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 19 Jan 2007 01:48:05 +0000 Subject: Fix warning and dubious correctness. CVS patchset: 8530 CVS date: 2007/01/19 01:48:05 --- src/libspeex/xine_decoder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/libspeex/xine_decoder.c b/src/libspeex/xine_decoder.c index e324eb3ed..b729dc3bb 100644 --- a/src/libspeex/xine_decoder.c +++ b/src/libspeex/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.21 2006/09/14 02:07:01 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.22 2007/01/19 01:48:05 dgp85 Exp $ * * (ogg/)speex audio decoder plugin (libspeex wrapper) for xine */ @@ -298,7 +298,7 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { int bitrate; ogg_int16_t * ptr = audio_buffer->mem; - ret = speex_decode (this->st, &this->bits, (short *) this->output); + ret = speex_decode (this->st, &this->bits, this->output); if (ret==-1) break; @@ -312,7 +312,7 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { } if (this->channels == 2) { - speex_decode_stereo ( (short *) this->output, this->frame_size, &this->stereo); + speex_decode_stereo (this->output, this->frame_size, &this->stereo); } speex_decoder_ctl (this->st, SPEEX_GET_BITRATE, &bitrate); -- cgit v1.2.3 From a0044b6bea994ea4f32ad049bd5fcccc5216e2be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 19 Jan 2007 02:32:00 +0000 Subject: Make supported_types a pointer to constant. CVS patchset: 8531 CVS date: 2007/01/19 02:32:00 --- src/xine-engine/xine_plugin.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-engine/xine_plugin.h b/src/xine-engine/xine_plugin.h index f55c5be63..1a6ebe04e 100644 --- a/src/xine-engine/xine_plugin.h +++ b/src/xine-engine/xine_plugin.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_plugin.h,v 1.21 2006/09/26 05:19:49 dgp85 Exp $ + * $Id: xine_plugin.h,v 1.22 2007/01/19 02:32:00 dgp85 Exp $ * * generic plugin definitions * @@ -73,7 +73,7 @@ typedef struct { /* special_info for a decoder plugin */ typedef struct { - uint32_t *supported_types; /* streamtypes this decoder can handle */ + const uint32_t *supported_types; /* streamtypes this decoder can handle */ int priority; } decoder_info_t; -- cgit v1.2.3 From 2af57b46d30cea316a9f245cc2ecf826e756dbf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 19 Jan 2007 02:35:36 +0000 Subject: Add --disable-musepack and --with-external-libmpcdec parameters to configure, now users can decide if they want musepack support and whether to use an external copy of libmpcdec. CVS patchset: 8532 CVS date: 2007/01/19 02:35:36 --- src/libmusepack/Makefile.am | 17 +++++++++++++++-- src/libmusepack/xine_decoder.c | 8 ++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/libmusepack/Makefile.am b/src/libmusepack/Makefile.am index 477dc31f9..021ec0985 100644 --- a/src/libmusepack/Makefile.am +++ b/src/libmusepack/Makefile.am @@ -6,11 +6,24 @@ EXTRA_DIST = diff_against_svn.patch libdir = $(XINE_PLUGINDIR) +if MUSEPACK lib_LTLIBRARIES = xineplug_decode_mpc.la +endif -xineplug_decode_mpc_la_SOURCES = huffsv46.c huffsv7.c idtag.c mpc_decoder.c \ - mpc_reader.c requant.c streaminfo.c synth_filter.c xine_decoder.c +if EXTERNAL_MPCDEC +internal_sources = +else +internal_sources = huffsv46.c huffsv7.c idtag.c mpc_decoder.c \ + mpc_reader.c requant.c streaminfo.c synth_filter.c +endif + +if EXTERNAL_MPCDEC +xineplug_decode_mpc_la_LIBADD = $(XINE_LIB) -lmpcdec +else xineplug_decode_mpc_la_LIBADD = $(XINE_LIB) +endif + +xineplug_decode_mpc_la_SOURCES = $(internal_sources) xine_decoder.c xineplug_decode_mpc_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_decode_mpc_la_LDFLAGS = -avoid-version -module diff --git a/src/libmusepack/xine_decoder.c b/src/libmusepack/xine_decoder.c index 03d43fb63..26c2eddf5 100644 --- a/src/libmusepack/xine_decoder.c +++ b/src/libmusepack/xine_decoder.c @@ -23,7 +23,7 @@ * 32bit float output * Seeking?? * - * $Id: xine_decoder.c,v 1.9 2006/07/10 22:08:29 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.10 2007/01/19 02:35:36 dgp85 Exp $ */ #include @@ -43,7 +43,11 @@ #include "buffer.h" #include "xineutils.h" -#include "musepack/musepack.h" +#ifdef HAVE_MPCDEC_MPCDEC_H +# include +#else +# include "musepack/musepack.h" +#endif #define MPC_DECODER_MEMSIZE 65536 #define MPC_DECODER_MEMSIZE2 (MPC_DECODER_MEMSIZE/2) -- cgit v1.2.3 From 84ef7559e5b19931e0c61209c1c0d7b4035a438d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 19 Jan 2007 02:49:31 +0000 Subject: Revert, and remember to flush cache. CVS patchset: 8534 CVS date: 2007/01/19 02:49:31 --- src/xine-engine/xine_plugin.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-engine/xine_plugin.h b/src/xine-engine/xine_plugin.h index 1a6ebe04e..4ddb65eda 100644 --- a/src/xine-engine/xine_plugin.h +++ b/src/xine-engine/xine_plugin.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_plugin.h,v 1.22 2007/01/19 02:32:00 dgp85 Exp $ + * $Id: xine_plugin.h,v 1.23 2007/01/19 02:49:31 dgp85 Exp $ * * generic plugin definitions * @@ -73,7 +73,7 @@ typedef struct { /* special_info for a decoder plugin */ typedef struct { - const uint32_t *supported_types; /* streamtypes this decoder can handle */ + uint32_t *supported_types; /* streamtypes this decoder can handle */ int priority; } decoder_info_t; -- cgit v1.2.3 From f194e1555776dd8dd85e6fddde42ef6d1daf72c6 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Sun, 21 Jan 2007 15:12:21 +0000 Subject: CONFIG_FLV1_DECODER should be CONFIG_FLV_DECODER. CVS patchset: 8537 CVS date: 2007/01/21 15:12:21 --- src/libffmpeg/video_decoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libffmpeg/video_decoder.c b/src/libffmpeg/video_decoder.c index 3dabdf59c..446a6ca9e 100644 --- a/src/libffmpeg/video_decoder.c +++ b/src/libffmpeg/video_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_decoder.c,v 1.68 2007/01/15 22:52:33 molivier Exp $ + * $Id: video_decoder.c,v 1.69 2007/01/21 15:12:21 klan Exp $ * * xine video decoder plugin using ffmpeg * @@ -1664,7 +1664,7 @@ static uint32_t supported_video_types[] = { #ifdef CONFIG_VCR1_DECODER BUF_VIDEO_ATIVCR1, #endif - #ifdef CONFIG_FLV1_DECODER + #ifdef CONFIG_FLV_DECODER BUF_VIDEO_FLV1, #endif #ifdef CONFIG_QTRLE_DECODER -- cgit v1.2.3 From 70162717634e517a45c7162d123902da55734997 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Mon, 22 Jan 2007 16:25:08 +0000 Subject: Parse the keyframes list for faster seek. CVS patchset: 8540 CVS date: 2007/01/22 16:25:08 --- src/demuxers/demux_flv.c | 112 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 90 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index e88e527e2..0c43b51ab 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -26,7 +26,7 @@ * For more information on the FLV file format, visit: * http://download.macromedia.com/pub/flash/flash_file_format_specification.pdf * - * $Id: demux_flv.c,v 1.16 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_flv.c,v 1.17 2007/01/22 16:25:08 klan Exp $ */ #ifdef HAVE_CONFIG_H @@ -51,6 +51,11 @@ #include "bswap.h" #include "group_games.h" +typedef struct { + unsigned int pts; + unsigned int offset; +} flv_index_entry_t; + typedef struct { demux_plugin_t demux_plugin; @@ -73,6 +78,9 @@ typedef struct { int height; double framerate; + flv_index_entry_t *index; + int num_indices; + unsigned int cur_pts; int64_t last_pts[2]; @@ -175,7 +183,10 @@ static int open_flv_file(demux_flv_t *this) { this->start = BE_32(&buffer[5]); this->size = this->input->get_length(this->input); - this->input->seek(this->input, this->start, SEEK_SET); + if (INPUT_IS_SEEKABLE(this->input)) + this->input->seek(this->input, this->start, SEEK_SET); + else if (this->start > 9) + this->input->seek(this->input, this->start-9, SEEK_CUR); lprintf(" qualified FLV file, repositioned @ offset 0x%" PRIxMAX "\n", (intmax_t)this->start); @@ -206,18 +217,18 @@ static int parse_flv_var(demux_flv_t *this, unsigned char *buf, int size, char * lprintf(" got number (%f)\n", BE_F64(tmp)); if (key) { double val = BE_F64(tmp); - if (!strcmp(key, "duration")) { + if (!strncmp(key, "duration", 8)) { this->length = val * 1000.0; } - else if (!strcmp(key, "width")) { + else if (!strncmp(key, "width", 5)) { this->width = val; _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, this->width); } - else if (!strcmp(key, "height")) { + else if (!strncmp(key, "height", 6)) { this->height = val; _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, this->height); } - else if (!strcmp(key, "framerate")) { + else if (!strncmp(key, "framerate", 9)) { this->framerate = val; } } @@ -260,6 +271,32 @@ static int parse_flv_var(demux_flv_t *this, unsigned char *buf, int size, char * lprintf(" got array (%d indices)\n", BE_32(tmp)); num = BE_32(tmp); tmp += 4; + if (!strncmp (key, "times", 5)) { + if (this->index) + free (this->index); + this->index = xine_xmalloc(num*sizeof(flv_index_entry_t)); + this->num_indices = num; + for (num = 0; num < this->num_indices && tmp < end; num++) { + if (*tmp++ == FLV_DATA_TYPE_NUMBER) { + lprintf(" got number (%f)\n", BE_F64(tmp)); + this->index[num].pts = BE_F64(tmp) * 1000.0; + tmp += 8; + } + } + break; + } + if (!strncmp (key, "filepositions", 13)) { + if (this->index && this->num_indices == num) { + for (num = 0; num < this->num_indices && tmp < end; num++) { + if (*tmp++ == FLV_DATA_TYPE_NUMBER) { + lprintf(" got number (%f)\n", BE_F64(tmp)); + this->index[num].offset = BE_F64(tmp); + tmp += 8; + } + } + break; + } + } while (num-- && tmp < end) { len = parse_flv_var(this, tmp, end-tmp, NULL); tmp += len; @@ -363,6 +400,7 @@ static int read_flv_packet(demux_flv_t *this) { buf->decoder_info[3] = (buffer[0] & 1) + 1; /* channels */ buf->size = 0; /* no extra data */ buf->type = buf_type; + fifo->put(fifo, buf); this->got_audio = 1; @@ -377,25 +415,24 @@ static int read_flv_packet(demux_flv_t *this) { } remaining_bytes--; + if ((buffer[0] >> 4) == 0x01) + buf_flags = BUF_FLAG_KEYFRAME; + switch (buffer[0] & 0x0F) { case FLV_VIDEO_FORMAT_FLV1: buf_type = BUF_VIDEO_FLV1; break; case FLV_VIDEO_FORMAT_VP6: buf_type = BUF_VIDEO_VP6F; - /* skip VP6 packet header */ - if (remaining_bytes >= 1) { - this->input->seek (this->input, 1, SEEK_CUR); - remaining_bytes--; - } + /* VP6 extra header */ + this->input->read(this->input, buffer, 1 ); + remaining_bytes--; break; case FLV_VIDEO_FORMAT_VP6A: buf_type = BUF_VIDEO_VP6F; - /* skip VP6A packet header */ - if (remaining_bytes >= 4) { - this->input->seek (this->input, 4, SEEK_CUR); - remaining_bytes -= 4; - } + /* VP6A extra header */ + this->input->read(this->input, buffer, 4); + remaining_bytes -= 4; break; default: lprintf(" unsupported video format (%d)...\n", buffer[0] & 0x0F); @@ -403,9 +440,6 @@ static int read_flv_packet(demux_flv_t *this) { break; } - if ((buffer[0] >> 4) == 0x01) - buf_flags = BUF_FLAG_KEYFRAME; - fifo = this->video_fifo; if (!this->got_video) { xine_bmiheader *bih; @@ -414,7 +448,7 @@ static int read_flv_packet(demux_flv_t *this) { buf = fifo->buffer_pool_alloc(fifo); buf->decoder_flags = BUF_FLAG_HEADER | BUF_FLAG_STDHEADER | BUF_FLAG_FRAMERATE | BUF_FLAG_FRAME_END; - buf->decoder_info[0] = 90000.0 / (this->framerate ? : 12.0); + buf->decoder_info[0] = 90000.0 / (this->framerate ? : 12.0); bih = (xine_bmiheader *) buf->content; memset(bih, 0, sizeof(xine_bmiheader)); bih->biSize = sizeof(xine_bmiheader); @@ -422,6 +456,12 @@ static int read_flv_packet(demux_flv_t *this) { bih->biHeight = this->height; buf->size = sizeof(xine_bmiheader); buf->type = buf_type; + if (buf_type == BUF_VIDEO_VP6F) { + *((unsigned char *)buf->content+buf->size) = buffer[0]; + bih->biSize++; + buf->size++; + } + fifo->put(fifo, buf); this->got_video = 1; @@ -492,7 +532,33 @@ static void seek_flv_file(demux_flv_t *this, int seek_pts) { this->cur_pts = 0; return; } + + if (this->index) { + int i; + + if (do_rewind) { + for (i = this->num_indices-1; i > 0; i--) { + if (this->index[i-1].pts < seek_pts) + break; + } + } + else { + for (i = 0; i < (this->num_indices-1); i++) { + if (this->index[i+1].pts > seek_pts) + break; + } + } + + if (this->index[i].offset >= this->start+4) { + lprintf(" seeking to index entry %d (pts:%u, offset:%u).\n", + i, this->index[i].pts, this->index[i].offset); + this->input->seek(this->input, this->index[i].offset-4, SEEK_SET); + this->cur_pts = this->index[i].pts; + return; + } + } + while (do_rewind ? (seek_pts < this->cur_pts) : (seek_pts > this->cur_pts)) { unsigned char tag_type; int data_size; @@ -579,7 +645,7 @@ static int demux_flv_seek (demux_plugin_t *this_gen, this->status = DEMUX_OK; - if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) { + if (INPUT_IS_SEEKABLE(this->input)) { if (start_pos && !start_time) start_time = (int64_t) this->length * start_pos / 65535; @@ -599,6 +665,8 @@ static int demux_flv_seek (demux_plugin_t *this_gen, static void demux_flv_dispose (demux_plugin_t *this_gen) { demux_flv_t *this = (demux_flv_t *) this_gen; + if (this->index) + free(this->index); free(this); } @@ -627,7 +695,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str input_plugin_t *input) { demux_flv_t *this; - this = xine_xmalloc (sizeof (demux_flv_t)); + this = xine_xmalloc(sizeof (demux_flv_t)); this->xine = stream->xine; this->stream = stream; this->input = input; -- cgit v1.2.3 From 0f18a567e67670983681f2a6ae66ea6c3c42b942 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Mon, 22 Jan 2007 17:07:08 +0000 Subject: Must check whether "key" is NULL when parsing flash vars. CVS patchset: 8541 CVS date: 2007/01/22 17:07:08 --- src/demuxers/demux_flv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 0c43b51ab..129fb40fb 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -26,7 +26,7 @@ * For more information on the FLV file format, visit: * http://download.macromedia.com/pub/flash/flash_file_format_specification.pdf * - * $Id: demux_flv.c,v 1.17 2007/01/22 16:25:08 klan Exp $ + * $Id: demux_flv.c,v 1.18 2007/01/22 17:07:08 klan Exp $ */ #ifdef HAVE_CONFIG_H @@ -271,7 +271,7 @@ static int parse_flv_var(demux_flv_t *this, unsigned char *buf, int size, char * lprintf(" got array (%d indices)\n", BE_32(tmp)); num = BE_32(tmp); tmp += 4; - if (!strncmp (key, "times", 5)) { + if (key && !strncmp (key, "times", 5)) { if (this->index) free (this->index); this->index = xine_xmalloc(num*sizeof(flv_index_entry_t)); @@ -285,7 +285,7 @@ static int parse_flv_var(demux_flv_t *this, unsigned char *buf, int size, char * } break; } - if (!strncmp (key, "filepositions", 13)) { + if (key && !strncmp (key, "filepositions", 13)) { if (this->index && this->num_indices == num) { for (num = 0; num < this->num_indices && tmp < end; num++) { if (*tmp++ == FLV_DATA_TYPE_NUMBER) { -- cgit v1.2.3 From 0d2cc3cd75999059c38ec2cc20c83b985eb6d885 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani Date: Mon, 22 Jan 2007 17:33:35 +0000 Subject: Added mimetype application/ogg. Use a more generic description for application/(x-)ogg mimetype (i.e. "Ogg Stream"). CVS patchset: 8542 CVS date: 2007/01/22 17:33:35 --- src/demuxers/demux_ogg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index 0911e7618..a042bc7ec 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_ogg.c,v 1.172 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_ogg.c,v 1.173 2007/01/22 17:33:35 klan Exp $ * * demultiplexer for ogg streams * @@ -2155,7 +2155,8 @@ static const char *ogg_get_extensions (demux_class_t *this_gen) { static const char *ogg_get_mimetypes (demux_class_t *this_gen) { return "audio/x-ogg: ogg: OggVorbis Audio;" "audio/x-speex: ogg: Speex Audio;" - "application/x-ogg: ogg: OggVorbis Audio;"; + "application/x-ogg: ogg: Ogg Stream;" + "application/ogg: ogg: Ogg Stream;"; } static void ogg_class_dispose (demux_class_t *this_gen) { -- cgit v1.2.3 From c5fe63cf42883e5b859c8f585a7b194c9b48f8a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 23 Jan 2007 15:05:58 +0000 Subject: Set audio channels, samplerate and bits per sample properties. CVS patchset: 8543 CVS date: 2007/01/23 15:05:58 --- src/demuxers/demux_wavpack.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_wavpack.c b/src/demuxers/demux_wavpack.c index 96d517a9f..246cab7e2 100644 --- a/src/demuxers/demux_wavpack.c +++ b/src/demuxers/demux_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò * - * $Id: demux_wavpack.c,v 1.4 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_wavpack.c,v 1.5 2007/01/23 15:05:58 dgp85 Exp $ */ #define LOG_MODULE "demux_wavpack" @@ -180,7 +180,14 @@ static int open_wv_file(demux_wv_t *const this) { this->length = this->samples / this->samplerate; _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, ME_32(this->header.buffer)); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, + ME_32(this->header.buffer)); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_CHANNELS, + this->channels); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, + this->samplerate); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITS, + this->bits_per_sample); WavpackCloseFile(ctx); this->input->seek(this->input, SEEK_SET, 0); @@ -293,6 +300,7 @@ static int demux_wv_seek (demux_plugin_t *this_gen, _x_demux_control_newpts(this->stream, 0, 0); this->status = DEMUX_OK; + } return this->status; -- cgit v1.2.3 From ffb6f4e28097a28e68522b4c8ace48b132dcbb7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 23 Jan 2007 15:09:39 +0000 Subject: Return the correct length for the stream. CVS patchset: 8544 CVS date: 2007/01/23 15:09:39 --- src/demuxers/demux_wavpack.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_wavpack.c b/src/demuxers/demux_wavpack.c index 246cab7e2..7b4b6b899 100644 --- a/src/demuxers/demux_wavpack.c +++ b/src/demuxers/demux_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò * - * $Id: demux_wavpack.c,v 1.5 2007/01/23 15:05:58 dgp85 Exp $ + * $Id: demux_wavpack.c,v 1.6 2007/01/23 15:09:39 dgp85 Exp $ */ #define LOG_MODULE "demux_wavpack" @@ -319,9 +319,9 @@ static int demux_wv_get_status (demux_plugin_t *const this_gen) { } static int demux_wv_get_stream_length (demux_plugin_t *const this_gen) { -// demux_wv_t *this = (demux_wv_t *) this_gen; + const demux_wv_t *const this = (demux_wv_t *) this_gen; - return 0; + return this->length * 1000; } static uint32_t demux_wv_get_capabilities(demux_plugin_t *const this_gen) { -- cgit v1.2.3 From 35a7bc136917635a08e89a11836a697f95af82db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 23 Jan 2007 15:42:15 +0000 Subject: Correctly report the current progress of the song, and remove this->length attribute, as it's just used once. CVS patchset: 8545 CVS date: 2007/01/23 15:42:15 --- src/demuxers/demux_wavpack.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_wavpack.c b/src/demuxers/demux_wavpack.c index 7b4b6b899..bfbe41688 100644 --- a/src/demuxers/demux_wavpack.c +++ b/src/demuxers/demux_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò * - * $Id: demux_wavpack.c,v 1.6 2007/01/23 15:09:39 dgp85 Exp $ + * $Id: demux_wavpack.c,v 1.7 2007/01/23 15:42:15 dgp85 Exp $ */ #define LOG_MODULE "demux_wavpack" @@ -66,7 +66,6 @@ typedef struct { uint32_t samplerate; uint32_t bits_per_sample; uint32_t channels; - unsigned int length; } demux_wv_t; typedef struct { @@ -177,7 +176,6 @@ static int open_wv_file(demux_wv_t *const this) { lprintf("bits_per_sample: %u\n", this->bits_per_sample); this->channels = WavpackGetNumChannels(ctx); lprintf("channels: %u\n", this->channels); - this->length = this->samples / this->samplerate; _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, @@ -226,12 +224,12 @@ static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { while(bytes_to_read) { off_t bytes_read = 0; buf_element_t *buf = NULL; + int64_t input_time_guess; /* Get a buffer */ buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); - buf->type = BUF_AUDIO_WAVPACK; buf->pts = 0; - buf->extra_info->total_time = this->length; + buf->type = BUF_AUDIO_WAVPACK; buf->decoder_flags = 0; /* Set normalised position */ @@ -240,7 +238,12 @@ static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { this->input->get_length(this->input)); /* Set time */ - buf->extra_info->input_time = this->current_sample / this->samplerate; + input_time_guess = this->samples; + input_time_guess /= this->samplerate; + input_time_guess *= 1000; + input_time_guess *= buf->extra_info->input_normpos; + input_time_guess /= 65535; + buf->extra_info->input_time = input_time_guess; bytes_read = this->input->read(this->input, buf->content, ( bytes_to_read > buf->max_size ) ? buf->max_size : bytes_to_read); @@ -321,7 +324,7 @@ static int demux_wv_get_status (demux_plugin_t *const this_gen) { static int demux_wv_get_stream_length (demux_plugin_t *const this_gen) { const demux_wv_t *const this = (demux_wv_t *) this_gen; - return this->length * 1000; + return (this->samples*1000) / this->samplerate; } static uint32_t demux_wv_get_capabilities(demux_plugin_t *const this_gen) { -- cgit v1.2.3 From 01ef002ace693476f29d0cd7ffff816c90570137 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Tue, 23 Jan 2007 23:20:23 +0000 Subject: - Don't try to print " / <chapter>" if there's no title, avoid things like "(null) / Chapter 1" when the title isn't available (and a possible crasher on non-Linux platforms) CVS patchset: 8547 CVS date: 2007/01/23 23:20:23 --- src/demuxers/demux_ogg.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index a042bc7ec..218728e1b 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_ogg.c,v 1.173 2007/01/22 17:33:35 klan Exp $ + * $Id: demux_ogg.c,v 1.174 2007/01/23 23:20:23 hadess Exp $ * * demultiplexer for ogg streams * @@ -536,7 +536,11 @@ static void update_chapter_display (demux_ogg_t *this, int stream_num, ogg_packe if (chapter >= 0) { char t_title[256]; - snprintf(t_title, sizeof (t_title), "%s / %s", this->title, this->chapter_info->entries[chapter].name); + if (this->title) { + snprintf(t_title, sizeof (t_title), "%s / %s", this->title, this->chapter_info->entries[chapter].name); + } else { + snprintf(t_title, sizeof (t_title), "%s", this->chapter_info->entries[chapter].name); + } title = t_title; } else { title = this->title; -- cgit v1.2.3 From 5b037e760306c6f4c90aa133a083cacbcd38c2d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Wed, 24 Jan 2007 04:49:41 +0000 Subject: Remove demux_wavpack.c from here, as it's being moved in a different directory. CVS patchset: 8550 CVS date: 2007/01/24 04:49:41 --- src/demuxers/Makefile.am | 10 - src/demuxers/demux_wavpack.c | 431 ------------------------------------------- 2 files changed, 441 deletions(-) delete mode 100644 src/demuxers/demux_wavpack.c (limited to 'src') diff --git a/src/demuxers/Makefile.am b/src/demuxers/Makefile.am index 07996b2c7..68136e217 100644 --- a/src/demuxers/Makefile.am +++ b/src/demuxers/Makefile.am @@ -12,10 +12,6 @@ if HAVE_VORBIS ogg_module = xineplug_dmx_ogg.la endif -if HAVE_WAVPACK -wavpack_module = xineplug_dmx_wavpack.la -endif - if BUILD_ASF asf_module = xineplug_dmx_asf.la endif @@ -34,7 +30,6 @@ endif # All of xine demuxer plugins should be named like the scheme "xineplug_dmx_" lib_LTLIBRARIES = $(ogg_module) $(asf_module) $(mng_module) $(image_module) \ - $(wavpack_module) \ xineplug_dmx_games.la \ xineplug_dmx_audio.la \ xineplug_dmx_mpeg_ts.la \ @@ -135,11 +130,6 @@ xineplug_dmx_audio_la_SOURCES = group_audio.c demux_aud.c demux_aiff.c \ xineplug_dmx_audio_la_LIBADD = $(XINE_LIB) $(LIBMODPLUG_LIBS) xineplug_dmx_audio_la_LDFLAGS = -avoid-version -module -xineplug_dmx_wavpack_la_SOURCES = demux_wavpack.c -xineplug_dmx_wavpack_la_CFLAGS = $(WAVPACK_CFLAGS) -xineplug_dmx_wavpack_la_LIBADD = $(XINE_LIB) $(WAVPACK_LIBS) -xineplug_dmx_wavpack_la_LDFLAGS = -avoid-version -module - xineplug_dmx_yuv_frames_la_SOURCES = demux_yuv_frames.c xineplug_dmx_yuv_frames_la_LIBADD = $(XINE_LIB) xineplug_dmx_yuv_frames_la_LDFLAGS = -avoid-version -module diff --git a/src/demuxers/demux_wavpack.c b/src/demuxers/demux_wavpack.c deleted file mode 100644 index bfbe41688..000000000 --- a/src/demuxers/demux_wavpack.c +++ /dev/null @@ -1,431 +0,0 @@ -/* - * Copyright (C) 2006 the xine project - * - * This file is part of xine, a free video player. - * - * xine 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. - * - * xine 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - * xine interface to libwavpack by Diego Pettenò <flameeyes@gentoo.org> - * - * $Id: demux_wavpack.c,v 1.7 2007/01/23 15:42:15 dgp85 Exp $ - */ - -#define LOG_MODULE "demux_wavpack" -#define LOG_VERBOSE - -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "bswap.h" -#include "group_audio.h" - -#include <wavpack/wavpack.h> - -typedef struct { - char idcode[4]; /* This should always be the string "wvpk" */ - uint32_t block_size; /* Size of the rest of the frame */ - uint16_t wv_version; /* Version of the wavpack, 0x0403 should be latest */ - uint8_t track; /* Unused, has to be 0 */ - uint8_t index; /* Unused, has to be 0 */ - uint32_t file_samples; /* (uint32_t)-1 if unknown, else the total number - of samples for the file */ - uint32_t samples_index; /* Index of the first sample in block, from the - start of the file */ - uint32_t samples_count; /* Count of samples in the current frame */ - uint32_t flags; /* Misc flags */ - uint32_t decoded_crc32; /* CRC32 of the decoded data */ -} wvheader_t; - -typedef struct { - demux_plugin_t demux_plugin; - - xine_stream_t *stream; - fifo_buffer_t *audio_fifo; - input_plugin_t *input; - int status; - - union { - wvheader_t wv; - uint8_t buffer[sizeof(wvheader_t)]; - } header; - - uint32_t current_sample; - uint32_t samples; - uint32_t samplerate; - uint32_t bits_per_sample; - uint32_t channels; -} demux_wv_t; - -typedef struct { - demux_class_t demux_class; -} demux_wv_class_t; - -#ifndef __unused -# ifdef SUPPORT_ATTRIBUTE_UNUSED -# define __unused __attribute__((unused)) -# else -# define __unused -# endif -#endif - -static int32_t xine_input_read_bytes(void *const this_gen, void *const data, - const int32_t bcount) { - input_plugin_t *const this = (input_plugin_t*)this_gen; - return this->read(this, data, bcount); -} - -static uint32_t xine_input_get_pos(void *const this_gen) { - input_plugin_t *const this = (input_plugin_t*)this_gen; - return this->get_current_pos(this); -} - -static int xine_input_set_pos_abs(void *const this_gen, const uint32_t pos) { - input_plugin_t *const this = (input_plugin_t*)this_gen; - return this->seek(this, pos, SEEK_SET); -} - -static int xine_input_set_pos_rel(void *const this_gen, const int32_t delta, - const int mode) { - input_plugin_t *const this = (input_plugin_t*)this_gen; - return this->seek(this, delta, mode); -} - -static int xine_input_push_back_byte(void *const this_gen, const int c) { - input_plugin_t *const this = (input_plugin_t*)this_gen; - if ( this->seek(this, -1, SEEK_CUR) ) { - return c; - } else { - lprintf("xine_input_push_back_byte: unable to seek.\n"); - return EOF; - } -} - -static uint32_t xine_input_get_length(void *const this_gen) { - input_plugin_t *const this = (input_plugin_t*)this_gen; - return this->get_length(this); -} - -static int xine_input_can_seek(void *const this_gen) { - input_plugin_t *const this = (input_plugin_t*)this_gen; - return INPUT_IS_SEEKABLE(this); -} - -static int32_t xine_input_write_bytes(__unused void *const id, - __unused void *const data, - __unused const int32_t bcount) { - lprintf("xine_input_write_bytes: acces is read-only.\n"); - return 0; -} - -static WavpackStreamReader wavpack_input_reader = { - .read_bytes = xine_input_read_bytes, - .get_pos = xine_input_get_pos, - .set_pos_abs = xine_input_set_pos_abs, - .set_pos_rel = xine_input_set_pos_rel, - .push_back_byte = xine_input_push_back_byte, - .get_length = xine_input_get_length, - .can_seek = xine_input_can_seek, - .write_bytes = xine_input_write_bytes -}; - -static int open_wv_file(demux_wv_t *const this) { - WavpackContext *ctx = NULL; - char error[256]; /* Current version of wavpack (4.31) does not write more than this */ - - /* Right now we don't support non-seekable streams */ - if (! INPUT_IS_SEEKABLE(this->input) ) { - lprintf("open_wv_file: non-seekable inputs aren't supported yet.\n"); - return 0; - } - - /* Read the file header */ - if (_x_demux_read_header(this->input, this->header.buffer, sizeof(wvheader_t)) != sizeof(wvheader_t)) - return 0; - - /* Validate header, we currently support only Wavpack 4 */ - if ( memcmp(this->header.wv.idcode, "wvpk", 4) != 0 || (le2me_16(this->header.wv.wv_version) >> 8) != 4 ) - return 0; - - /* Rewind */ - this->input->seek(this->input, 0 - sizeof(wvheader_t), SEEK_CUR); - - ctx = WavpackOpenFileInputEx(&wavpack_input_reader, this->input, NULL, error, 0, 0); - if ( ! ctx ) { - lprintf("xine_open_wavpack_input: unable to open the stream: %s\n", error); - return 0; - } - - this->current_sample = 0; - this->samples = WavpackGetNumSamples(ctx); - lprintf("number of samples: %u\n", this->samples); - this->samplerate = WavpackGetSampleRate(ctx); - lprintf("samplerate: %u Hz\n", this->samplerate); - this->bits_per_sample = WavpackGetBitsPerSample(ctx); - lprintf("bits_per_sample: %u\n", this->bits_per_sample); - this->channels = WavpackGetNumChannels(ctx); - lprintf("channels: %u\n", this->channels); - - _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, - ME_32(this->header.buffer)); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_CHANNELS, - this->channels); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, - this->samplerate); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITS, - this->bits_per_sample); - - WavpackCloseFile(ctx); - this->input->seek(this->input, SEEK_SET, 0); - - return 1; -} - -static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { - demux_wv_t *const this = (demux_wv_t *) this_gen; - uint32_t bytes_to_read; - - /* Check if we've finished */ - if (this->current_sample >= this->samples) { - lprintf("all frames read\n"); - this->status = DEMUX_FINISHED; - return this->status; - } - - lprintf("current sample: %u\n", this->current_sample); - - /* For some reason, FFmpeg requires to send it the latter 12 bytes of the header.. don't ask! */ - if ( this->input->read(this->input, this->header.buffer, sizeof(wvheader_t)-12) != sizeof(wvheader_t)-12 ) { - this->status = DEMUX_FINISHED; - return this->status; - } - - /* The size of the block is «of course» minus 8, and - it also includes the size of the header, but we need - to give FFmpeg the 12 extra bytes (for some reason), - so the amount of bytes to read is the following. - */ - bytes_to_read = le2me_32(this->header.wv.block_size) + 8 - (sizeof(wvheader_t)-12); - - lprintf("demux_wavpack: going to read %u bytes.\n", bytes_to_read); - - while(bytes_to_read) { - off_t bytes_read = 0; - buf_element_t *buf = NULL; - int64_t input_time_guess; - - /* Get a buffer */ - buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); - buf->pts = 0; - buf->type = BUF_AUDIO_WAVPACK; - buf->decoder_flags = 0; - - /* Set normalised position */ - buf->extra_info->input_normpos = - (int) ((double) this->input->get_current_pos(this->input) * 65535 / - this->input->get_length(this->input)); - - /* Set time */ - input_time_guess = this->samples; - input_time_guess /= this->samplerate; - input_time_guess *= 1000; - input_time_guess *= buf->extra_info->input_normpos; - input_time_guess /= 65535; - buf->extra_info->input_time = input_time_guess; - - bytes_read = this->input->read(this->input, buf->content, ( bytes_to_read > buf->max_size ) ? buf->max_size : bytes_to_read); - - buf->size = bytes_read; - - bytes_to_read -= bytes_read; - - if ( bytes_to_read <= 0 ) - buf->decoder_flags |= BUF_FLAG_FRAME_END; - - this->audio_fifo->put(this->audio_fifo, buf); - } - - this->current_sample += this->header.wv.samples_count; - - return this->status; -} - -static void demux_wv_send_headers(demux_plugin_t *const this_gen) { - demux_wv_t *const this = (demux_wv_t *) this_gen; - buf_element_t *buf; - - this->audio_fifo = this->stream->audio_fifo; - - this->status = DEMUX_OK; - - /* Send start buffers */ - _x_demux_control_start(this->stream); - - /* Send header to decoder */ - if (this->audio_fifo) { - buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - - buf->type = BUF_AUDIO_WAVPACK; - buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END; - buf->decoder_info[0] = this->input->get_length(this->input); - buf->decoder_info[1] = this->samplerate; - buf->decoder_info[2] = this->bits_per_sample; - buf->decoder_info[3] = this->channels; - - /* Copy the header */ - buf->size = sizeof(xine_waveformatex) + sizeof(wvheader_t); - memcpy(buf->content+sizeof(xine_waveformatex), this->header.buffer, buf->size); - - this->audio_fifo->put (this->audio_fifo, buf); - } -} - -static int demux_wv_seek (demux_plugin_t *this_gen, - off_t start_pos, int start_time, int playing) { - demux_wv_t *const this = (demux_wv_t *) this_gen; - - /* If thread is not running, initialize demuxer */ - if( !playing ) { - - /* send new pts */ - _x_demux_control_newpts(this->stream, 0, 0); - - this->status = DEMUX_OK; - - } - - return this->status; -} - -static void demux_wv_dispose (demux_plugin_t *const this_gen) { - demux_wv_t *const this = (demux_wv_t *) this_gen; - - free(this); -} - -static int demux_wv_get_status (demux_plugin_t *const this_gen) { - const demux_wv_t *const this = (const demux_wv_t *) this_gen; - - return this->status; -} - -static int demux_wv_get_stream_length (demux_plugin_t *const this_gen) { - const demux_wv_t *const this = (demux_wv_t *) this_gen; - - return (this->samples*1000) / this->samplerate; -} - -static uint32_t demux_wv_get_capabilities(demux_plugin_t *const this_gen) { - return DEMUX_CAP_NOCAP; -} - -static int demux_wv_get_optional_data(demux_plugin_t *const this_gen, - void *data, const int data_type) { - return DEMUX_OPTIONAL_UNSUPPORTED; -} - -static demux_plugin_t *open_plugin (demux_class_t *const class_gen, - xine_stream_t *const stream, - input_plugin_t *const input) { - demux_wv_t *const this = xine_xmalloc (sizeof (demux_wv_t)); - this->stream = stream; - this->input = input; - - this->demux_plugin.send_headers = demux_wv_send_headers; - this->demux_plugin.send_chunk = demux_wv_send_chunk; - this->demux_plugin.seek = demux_wv_seek; - this->demux_plugin.dispose = demux_wv_dispose; - this->demux_plugin.get_status = demux_wv_get_status; - this->demux_plugin.get_stream_length = demux_wv_get_stream_length; - this->demux_plugin.get_capabilities = demux_wv_get_capabilities; - this->demux_plugin.get_optional_data = demux_wv_get_optional_data; - this->demux_plugin.demux_class = class_gen; - - this->status = DEMUX_FINISHED; - switch (stream->content_detection_method) { - - case METHOD_BY_EXTENSION: { - const char *const mrl = input->get_mrl (input); - const char *const extensions = class_gen->get_extensions (class_gen); - - if (!_x_demux_check_extension (mrl, extensions)) { - free (this); - return NULL; - } - } - /* Falling through is intended */ - - case METHOD_BY_CONTENT: - case METHOD_EXPLICIT: - - if (!open_wv_file(this)) { - free (this); - return NULL; - } - - break; - - default: - free (this); - return NULL; - } - - return &this->demux_plugin; -} - -static const char *get_description (demux_class_t *const this_gen) { - return "Wavpack demux plugin"; -} - -static const char *get_identifier (demux_class_t *const this_gen) { - return "Wavpack"; -} - -static const char *get_extensions (demux_class_t *const this_gen) { - return "wv"; -} - -static const char *get_mimetypes (demux_class_t *const this_gen) { - return NULL; -} - -static void class_dispose (demux_class_t *const this_gen) { - demux_wv_class_t *const this = (demux_wv_class_t *) this_gen; - - free (this); -} - -static void *demux_wv_init_plugin (xine_t *const xine, void *const data) { - demux_wv_class_t *const this = xine_xmalloc (sizeof (demux_wv_class_t)); - - this->demux_class.open_plugin = open_plugin; - this->demux_class.get_description = get_description; - this->demux_class.get_identifier = get_identifier; - this->demux_class.get_mimetypes = get_mimetypes; - this->demux_class.get_extensions = get_extensions; - this->demux_class.dispose = class_dispose; - - return this; -} - -static const demuxer_info_t demux_info_wv = { - 0 /* priority */ -}; - -const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 26, "wavpack", XINE_VERSION_CODE, &demux_info_wv, demux_wv_init_plugin }, - { PLUGIN_NONE, 0, "", 0, NULL, NULL } -}; -- cgit v1.2.3 From 36b6f72e271737a87464c34e5a123d22f1ed09be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Wed, 24 Jan 2007 04:57:26 +0000 Subject: Create a new wavpack plugin with both the old demuxer and a new decoder. To simplify categorising, I've created a new combined directory to put plugins like wavpack (or libflac) that carries both a demuxer and a decoder in a single bundle -- I expect it being used more in the future. CVS patchset: 8551 CVS date: 2007/01/24 04:57:26 --- src/Makefile.am | 3 +- src/combined/.cvsignore | 6 + src/combined/Makefile.am | 12 ++ src/combined/combined_wavpack.c | 48 +++++ src/combined/combined_wavpack.h | 47 +++++ src/combined/decoder_wavpack.c | 358 +++++++++++++++++++++++++++++++++++ src/combined/demux_wavpack.c | 410 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 883 insertions(+), 1 deletion(-) create mode 100644 src/combined/.cvsignore create mode 100644 src/combined/Makefile.am create mode 100644 src/combined/combined_wavpack.c create mode 100644 src/combined/combined_wavpack.h create mode 100644 src/combined/decoder_wavpack.c create mode 100644 src/combined/demux_wavpack.c (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 67fbc38b8..0d5621593 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -30,4 +30,5 @@ SUBDIRS = \ libfaad \ libflac \ libmusepack \ - post + post \ + combined diff --git a/src/combined/.cvsignore b/src/combined/.cvsignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/combined/.cvsignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/combined/Makefile.am b/src/combined/Makefile.am new file mode 100644 index 000000000..34915b24c --- /dev/null +++ b/src/combined/Makefile.am @@ -0,0 +1,12 @@ +include $(top_srcdir)/misc/Makefile.common + +if HAVE_WAVPACK +xineplug_wavpack = xineplug_wavpack.la +endif + +xineplug_LTLIBRARIES = $(xineplug_wavpack) + +xineplug_wavpack_la_SOURCES = demux_wavpack.c decoder_wavpack.c combined_wavpack.c combined_wavpack.h +xineplug_wavpack_la_CFLAGS = $(WAVPACK_CFLAGS) +xineplug_wavpack_la_LIBADD = $(XINE_LIB) $(WAVPACK_LIBS) +xineplug_wavpack_la_LDFLAGS = -avoid-version -module diff --git a/src/combined/combined_wavpack.c b/src/combined/combined_wavpack.c new file mode 100644 index 000000000..00a1ba85f --- /dev/null +++ b/src/combined/combined_wavpack.c @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2007 the xine project + * + * This file is part of xine, a free video player. + * + * xine 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. + * + * xine 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * xine interface to libwavpack by Diego Pettenò <flameeyes@gentoo.org> + * + * $Id: combined_wavpack.c,v 1.1 2007/01/24 04:57:26 dgp85 Exp $ + */ + +#include "xine_internal.h" + +extern void *demux_wv_init_plugin (xine_t *const xine, void *const data); +extern void *decoder_wavpack_init_plugin (xine_t *xine, void *data); + +static const demuxer_info_t demux_info_wv = { + 0 /* priority */ +}; + +static uint32_t audio_types[] = { + BUF_AUDIO_WAVPACK, 0 + }; + +static const decoder_info_t decoder_info_wv = { + audio_types, /* supported types */ + 7 /* priority */ +}; + +const plugin_info_t xine_plugin_info[] EXPORTED = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_DEMUX, 26, "wavpack", XINE_VERSION_CODE, &demux_info_wv, demux_wv_init_plugin }, + { PLUGIN_AUDIO_DECODER, 15, "wavpackdec", XINE_VERSION_CODE, &decoder_info_wv, decoder_wavpack_init_plugin }, + { PLUGIN_NONE, 0, NULL, 0, NULL, NULL } +}; diff --git a/src/combined/combined_wavpack.h b/src/combined/combined_wavpack.h new file mode 100644 index 000000000..7ab8877be --- /dev/null +++ b/src/combined/combined_wavpack.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2007 the xine project + * + * This file is part of xine, a free video player. + * + * xine 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. + * + * xine 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * xine interface to libwavpack by Diego Pettenò <flameeyes@gentoo.org> + * + * $Id: combined_wavpack.h,v 1.1 2007/01/24 04:57:27 dgp85 Exp $ + */ + +#include "os_types.h" +#include "bswap.h" + +typedef struct { + uint32_t idcode; /* This should always be the string "wvpk" */ + uint32_t block_size; /* Size of the rest of the frame */ + uint16_t wv_version; /* Version of the wavpack, 0x0403 should be latest */ + uint8_t track; /* Unused, has to be 0 */ + uint8_t index; /* Unused, has to be 0 */ + uint32_t file_samples; /* (uint32_t)-1 if unknown, else the total number + of samples for the file */ + uint32_t samples_index; /* Index of the first sample in block, from the + start of the file */ + uint32_t samples_count; /* Count of samples in the current frame */ + uint32_t flags; /* Misc flags */ + uint32_t decoded_crc32; /* CRC32 of the decoded data */ +} __attribute__((packed)) wvheader_t; + +#ifdef WORDS_BIGENDIAN +static const uint32_t wvpk_signature = ('k' + ('p' << 8) + ('v' << 16) + ('w' << 24)); +#else +static const uint32_t wvpk_signature = ('w' + ('v' << 8) + ('p' << 16) + ('k' << 24)); +#endif diff --git a/src/combined/decoder_wavpack.c b/src/combined/decoder_wavpack.c new file mode 100644 index 000000000..38a1b2bbe --- /dev/null +++ b/src/combined/decoder_wavpack.c @@ -0,0 +1,358 @@ +/* + * Copyright (C) 2007 the xine project + * + * This file is part of xine, a free video player. + * + * xine 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. + * + * xine 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * xine interface to libwavpack by Diego Pettenò <flameeyes@gentoo.org> + * + * $Id: decoder_wavpack.c,v 1.1 2007/01/24 04:57:27 dgp85 Exp $ + */ + +#define LOG_MODULE "decode_wavpack" +#define LOG_VERBOSE + +#include "xine_internal.h" + +#include <wavpack/wavpack.h> +#include "combined_wavpack.h" + +typedef struct { + audio_decoder_class_t decoder_class; +} wavpack_class_t; + +typedef struct { + audio_decoder_t audio_decoder; + + xine_stream_t *stream; + + int output_open; + + int sample_rate; + int bits_per_sample; + int channels; + + uint8_t *buf; + size_t buf_size; + size_t buf_pos; +} wavpack_decoder_t; + +#ifndef __unused +# ifdef SUPPORT_ATTRIBUTE_UNUSED +# define __unused __attribute__((unused)) +# else +# define __unused +# endif +#endif + +/* Wrapper functions for Wavpack */ +static int32_t xine_buffer_read_bytes(void *const this_gen, void *const data, + int32_t bcount) { + wavpack_decoder_t *const this = (wavpack_decoder_t*)this_gen; + + if ( bcount <= 0 ) + return 0; + + if ( bcount > (this->buf_size - this->buf_pos) ) + bcount = (this->buf_size - this->buf_pos); + + xine_fast_memcpy(data, this->buf + this->buf_pos, bcount); + this->buf_pos += bcount; + + return bcount; +} + +static uint32_t xine_buffer_get_pos(void *const this_gen) { + wavpack_decoder_t *const this = (wavpack_decoder_t*)this_gen; + return this->buf_pos; +} + +static int xine_buffer_set_pos_rel(void *const this_gen, const int32_t delta, + const int mode) { + wavpack_decoder_t *const this = (wavpack_decoder_t*)this_gen; + + switch(mode) { + case SEEK_SET: + if ( delta < 0 || delta > this->buf_size ) + return -1; + + this->buf_pos = delta; + return 0; + case SEEK_CUR: + if ( (this->buf_pos+delta) < 0 || (this->buf_pos+delta) > this->buf_size ) + return -1; + + this->buf_pos += delta; + return 0; + case SEEK_END: + if ( delta < 0 || delta > this->buf_size ) + return -1; + + this->buf_pos = this->buf_size - delta; + + return 0; + } +} + +static int xine_buffer_set_pos_abs(void *const this_gen, const uint32_t pos) { + return xine_buffer_set_pos_rel(this_gen, pos, SEEK_SET); +} + +static int xine_buffer_push_back_byte(void *const this_gen, const int c) { + if ( ! xine_buffer_set_pos_rel(this_gen, -1, SEEK_CUR) ) + return EOF; + return c; +} + +static uint32_t xine_buffer_get_length(void *const this_gen) { + wavpack_decoder_t *const this = (wavpack_decoder_t*)this_gen; + return this->buf_size; +} + +static int xine_buffer_can_seek(void *const this_gen) { + wavpack_decoder_t *const this = (wavpack_decoder_t*)this_gen; + return 1; +} + +static int32_t xine_buffer_write_bytes(__unused void *const id, + __unused void *const data, + __unused const int32_t bcount) { + lprintf("xine_buffer_write_bytes: acces is read-only.\n"); + return 0; +} + +/* Wavpack plugin functions */ +static void wavpack_reset (audio_decoder_t *const this_gen) +{ + wavpack_decoder_t *const this = (wavpack_decoder_t *) this_gen; + + this->buf_pos = 0; +} + +static void wavpack_discontinuity (audio_decoder_t *const this_gen) +{ + wavpack_decoder_t *this = (wavpack_decoder_t *) this_gen; + + lprintf("Discontinuity!\n"); +} + +static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t *const buf) +{ + wavpack_decoder_t *const this = (wavpack_decoder_t *) this_gen; + int ret = 1; + + /* We are getting the stream header, open up the audio + * device, and collect information about the stream + */ + if (buf->decoder_flags & BUF_FLAG_STDHEADER) + { + int mode = AO_CAP_MODE_MONO; + + this->sample_rate = buf->decoder_info[1]; + this->bits_per_sample = buf->decoder_info[2]; + this->channels = buf->decoder_info[3]; + + mode = _x_ao_channels2mode(this->channels); + + _x_meta_info_set(this->stream, XINE_META_INFO_AUDIOCODEC, + "WavPack"); + + if (!this->output_open) + { + this->output_open = this->stream->audio_out->open ( + this->stream->audio_out, + this->stream, + this->bits_per_sample, + this->sample_rate, + mode); + } + this->buf_pos = 0; + } else if (this->output_open) { + /* This isn't a header frame and we have opened the output device */ + + /* First time, we prepend the header, so that Wavpack library can open it. + * As FFmpeg requires the last 12 bytes of the header for its stream, create + * the rest of the header when the frame ended (so we have its size). + */ + if ( ! this->buf ) + this->buf = xine_xmalloc(this->buf_size = sizeof(wvheader_t)-12); + if ( this->buf_pos == 0 ) + this->buf_pos = sizeof(wvheader_t)-12; + + /* What we have buffered so far, and what is coming in + * is larger than our buffer + */ + if (this->buf_pos + buf->size > this->buf_size) + { + this->buf_size += 2 * buf->size; + this->buf = realloc (this->buf, this->buf_size); + lprintf("reallocating buffer to %zd\n", this->buf_size); + } + + xine_fast_memcpy (&this->buf[this->buf_pos], buf->content, buf->size); + this->buf_pos += buf->size; + + if ( buf->decoder_flags & BUF_FLAG_FRAME_END ) { + static WavpackStreamReader wavpack_buffer_reader = { + .read_bytes = xine_buffer_read_bytes, + .get_pos = xine_buffer_get_pos, + .set_pos_abs = xine_buffer_set_pos_abs, + .set_pos_rel = xine_buffer_set_pos_rel, + .push_back_byte = xine_buffer_push_back_byte, + .get_length = xine_buffer_get_length, + .can_seek = xine_buffer_can_seek, + .write_bytes = xine_buffer_write_bytes + }; + + WavpackContext *ctx = NULL; + char error[256]; /* Current version of wavpack (4.31) does not write more than this */ + int32_t samples_left; uint32_t samples_total; + wvheader_t *header = (wvheader_t*)this->buf; + + header->idcode = wvpk_signature; +#ifdef WORDS_BIGENDIAN + header->block_size = bswap_32(this->buf_size-sizeof(wvheader_t)); + header->wv_version = bswap_16(0x0406); +#else + header->block_size = this->buf_pos-8; + header->wv_version = 0x0406; +#endif + header->track = 0; header->index = 0; + header->file_samples = (uint32_t)-1; + header->samples_index = 0; + + this->buf_pos = 0; + + if ( header->samples_count == 0 ) return; + + ctx = WavpackOpenFileInputEx(&wavpack_buffer_reader, this, NULL, error, OPEN_STREAMING, 0); + if ( ! ctx ) { + lprintf("unable to open the stream: %s\n", error); + this->buf_pos = 0; + return; + } + + samples_left = samples_total = header->samples_count; + while ( samples_left > 0 ) { + uint32_t buf_samples, decoded_count; + audio_buffer_t *audio_buffer = this->stream->audio_out->get_buffer(this->stream->audio_out); + int32_t *decoded; + int i; + + buf_samples = audio_buffer->mem_size / (this->channels * (this->bits_per_sample/8)); + if ( buf_samples > samples_left ) buf_samples = samples_left; + if ( buf_samples > 4096 ) buf_samples = 4096; + + decoded = alloca(buf_samples * this->channels * sizeof(int32_t)); + + decoded_count = WavpackUnpackSamples(ctx, decoded, buf_samples); + if ( decoded_count == 0 && *error ) { + fprintf(stderr, "Error during decode: %s\n", error); + break; + } + + if ( decoded_count == 0 ) { + lprintf("Finished decoding, but still %"PRId64" samples left?\n", samples_left); + break; + } + + lprintf("Decoded %d samples\n", buf_samples); + + samples_left -= decoded_count; + + audio_buffer->num_frames = decoded_count; + audio_buffer->vpts = 0; /* TODO: Fix the pts calculation */ + // audio_buffer->vpts = (buf->pts * (samples_total-samples_left)) / samples_total; + lprintf("Audio buffer with pts %"PRId64"\n", audio_buffer->vpts); + + switch(this->bits_per_sample) { + case 8: { + int8_t *data8 = (int8_t*)audio_buffer->mem; + for(i = 0; i < decoded_count*this->channels; i++) + data8[i] = decoded[i]; + } + break; + case 16: { + int16_t *data16 = (int16_t*)audio_buffer->mem; + for(i = 0; i < decoded_count*this->channels; i++) + data16[i] = decoded[i]; + } + } + + this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream); + } + + WavpackCloseFile(ctx); + this->buf_pos = 0; + } + } else + return; +} + +static void wavpack_dispose (audio_decoder_t *this_gen) { + wavpack_decoder_t *this = (wavpack_decoder_t *) this_gen; + + if (this->output_open) + this->stream->audio_out->close (this->stream->audio_out, this->stream); + + free(this->buf); + + free (this_gen); +} + +static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stream_t *stream) { + wavpack_decoder_t * const this = (wavpack_decoder_t *) xine_xmalloc (sizeof (wavpack_decoder_t)); + + this->audio_decoder.decode_data = wavpack_decode_data; + this->audio_decoder.reset = wavpack_reset; + this->audio_decoder.discontinuity = wavpack_discontinuity; + this->audio_decoder.dispose = wavpack_dispose; + this->stream = stream; + + this->buf = NULL; + this->buf_size = 0; + + return (audio_decoder_t *) this; +} + +/* + * wavpack plugin class + */ + +static char *get_identifier (audio_decoder_class_t *this) { + return "wavpackdec"; +} + +static char *get_description (audio_decoder_class_t *this) { + return "wavpack audio decoder plugin"; +} + +static void dispose_class (audio_decoder_class_t *this) { + free (this); +} + +void *decoder_wavpack_init_plugin (xine_t *xine, void *data) { + wavpack_class_t *this; + + this = (wavpack_class_t *) xine_xmalloc (sizeof (wavpack_class_t)); + + this->decoder_class.open_plugin = open_plugin; + this->decoder_class.get_identifier = get_identifier; + this->decoder_class.get_description = get_description; + this->decoder_class.dispose = dispose_class; + + return this; +} diff --git a/src/combined/demux_wavpack.c b/src/combined/demux_wavpack.c new file mode 100644 index 000000000..ffb3641f5 --- /dev/null +++ b/src/combined/demux_wavpack.c @@ -0,0 +1,410 @@ +/* + * Copyright (C) 2006-2007 the xine project + * + * This file is part of xine, a free video player. + * + * xine 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. + * + * xine 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * xine interface to libwavpack by Diego Pettenò <flameeyes@gentoo.org> + * + * $Id: demux_wavpack.c,v 1.1 2007/01/24 04:57:27 dgp85 Exp $ + */ + +#define LOG_MODULE "demux_wavpack" +#define LOG_VERBOSE + +#include "xine_internal.h" +#include "xineutils.h" +#include "demux.h" +#include "bswap.h" +#include "group_audio.h" + +#include <wavpack/wavpack.h> + +#include "combined_wavpack.h" + +typedef struct { + demux_plugin_t demux_plugin; + + xine_stream_t *stream; + fifo_buffer_t *audio_fifo; + input_plugin_t *input; + int status; + + union { + wvheader_t wv; + uint8_t buffer[sizeof(wvheader_t)]; + } header; + + uint32_t current_sample; + uint32_t samples; + uint32_t samplerate; + uint32_t bits_per_sample; + uint32_t channels; +} demux_wv_t; + +typedef struct { + demux_class_t demux_class; +} demux_wv_class_t; + +#ifndef __unused +# ifdef SUPPORT_ATTRIBUTE_UNUSED +# define __unused __attribute__((unused)) +# else +# define __unused +# endif +#endif + +static int32_t xine_input_read_bytes(void *const this_gen, void *const data, + const int32_t bcount) { + input_plugin_t *const this = (input_plugin_t*)this_gen; + return this->read(this, data, bcount); +} + +static uint32_t xine_input_get_pos(void *const this_gen) { + input_plugin_t *const this = (input_plugin_t*)this_gen; + return this->get_current_pos(this); +} + +static int xine_input_set_pos_abs(void *const this_gen, const uint32_t pos) { + input_plugin_t *const this = (input_plugin_t*)this_gen; + return this->seek(this, pos, SEEK_SET); +} + +static int xine_input_set_pos_rel(void *const this_gen, const int32_t delta, + const int mode) { + input_plugin_t *const this = (input_plugin_t*)this_gen; + return this->seek(this, delta, mode); +} + +static int xine_input_push_back_byte(void *const this_gen, const int c) { + input_plugin_t *const this = (input_plugin_t*)this_gen; + if ( this->seek(this, -1, SEEK_CUR) ) { + return c; + } else { + lprintf("xine_input_push_back_byte: unable to seek.\n"); + return EOF; + } +} + +static uint32_t xine_input_get_length(void *const this_gen) { + input_plugin_t *const this = (input_plugin_t*)this_gen; + return this->get_length(this); +} + +static int xine_input_can_seek(void *const this_gen) { + input_plugin_t *const this = (input_plugin_t*)this_gen; + return INPUT_IS_SEEKABLE(this); +} + +static int32_t xine_input_write_bytes(__unused void *const id, + __unused void *const data, + __unused const int32_t bcount) { + lprintf("xine_input_write_bytes: acces is read-only.\n"); + return 0; +} + +static WavpackStreamReader wavpack_input_reader = { + .read_bytes = xine_input_read_bytes, + .get_pos = xine_input_get_pos, + .set_pos_abs = xine_input_set_pos_abs, + .set_pos_rel = xine_input_set_pos_rel, + .push_back_byte = xine_input_push_back_byte, + .get_length = xine_input_get_length, + .can_seek = xine_input_can_seek, + .write_bytes = xine_input_write_bytes +}; + +static int open_wv_file(demux_wv_t *const this) { + WavpackContext *ctx = NULL; + char error[256]; /* Current version of wavpack (4.31) does not write more than this */ + + /* Right now we don't support non-seekable streams */ + if (! INPUT_IS_SEEKABLE(this->input) ) { + lprintf("open_wv_file: non-seekable inputs aren't supported yet.\n"); + return 0; + } + + /* Read the file header */ + if (_x_demux_read_header(this->input, this->header.buffer, sizeof(wvheader_t)) != sizeof(wvheader_t)) + return 0; + + /* Validate header, we currently support only Wavpack 4 */ + if ( this->header.wv.idcode != wvpk_signature || (le2me_16(this->header.wv.wv_version) >> 8) != 4 ) + return 0; + + /* Rewind */ + this->input->seek(this->input, 0 - sizeof(wvheader_t), SEEK_CUR); + + ctx = WavpackOpenFileInputEx(&wavpack_input_reader, this->input, NULL, error, 0, 0); + if ( ! ctx ) { + lprintf("xine_open_wavpack_input: unable to open the stream: %s\n", error); + return 0; + } + + this->current_sample = 0; + this->samples = WavpackGetNumSamples(ctx); + lprintf("number of samples: %u\n", this->samples); + this->samplerate = WavpackGetSampleRate(ctx); + lprintf("samplerate: %u Hz\n", this->samplerate); + this->bits_per_sample = WavpackGetBitsPerSample(ctx); + lprintf("bits_per_sample: %u\n", this->bits_per_sample); + this->channels = WavpackGetNumChannels(ctx); + lprintf("channels: %u\n", this->channels); + + _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, + ME_32(this->header.buffer)); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_CHANNELS, + this->channels); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, + this->samplerate); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITS, + this->bits_per_sample); + + WavpackCloseFile(ctx); + this->input->seek(this->input, SEEK_SET, 0); + + return 1; +} + +static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { + demux_wv_t *const this = (demux_wv_t *) this_gen; + uint32_t bytes_to_read; + + /* Check if we've finished */ + if (this->current_sample >= this->samples) { + lprintf("all frames read\n"); + this->status = DEMUX_FINISHED; + return this->status; + } + + lprintf("current sample: %u\n", this->current_sample); + + /* For some reason, FFmpeg requires to send it the latter 12 bytes of the header.. don't ask! */ + if ( this->input->read(this->input, this->header.buffer, sizeof(wvheader_t)-12) != sizeof(wvheader_t)-12 ) { + this->status = DEMUX_FINISHED; + return this->status; + } + + /* The size of the block is «of course» minus 8, and + it also includes the size of the header, but we need + to give FFmpeg the 12 extra bytes (for some reason), + so the amount of bytes to read is the following. + */ + bytes_to_read = le2me_32(this->header.wv.block_size) + 8 - (sizeof(wvheader_t)-12); + + lprintf("demux_wavpack: going to read %u bytes.\n", bytes_to_read); + + while(bytes_to_read) { + off_t bytes_read = 0; + buf_element_t *buf = NULL; + int64_t input_time_guess; + + /* Get a buffer */ + buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); + buf->type = BUF_AUDIO_WAVPACK; + buf->decoder_flags = 0; + + /* Set normalised position */ + buf->extra_info->input_normpos = + (int) ((double) this->input->get_current_pos(this->input) * 65535 / + this->input->get_length(this->input)); + + buf->pts = (((this->current_sample) / this->samplerate)-1)*90000; + lprintf("Sending buffer with PTS %d\n", buf->pts); + + /* Set time */ + input_time_guess = this->samples; + input_time_guess /= this->samplerate; + input_time_guess *= 1000; + input_time_guess *= buf->extra_info->input_normpos; + input_time_guess /= 65535; + buf->extra_info->input_time = input_time_guess; + + bytes_read = this->input->read(this->input, buf->content, ( bytes_to_read > buf->max_size ) ? buf->max_size : bytes_to_read); + + buf->size = bytes_read; + + bytes_to_read -= bytes_read; + + if ( bytes_to_read <= 0 ) + buf->decoder_flags |= BUF_FLAG_FRAME_END; + + this->audio_fifo->put(this->audio_fifo, buf); + } + + this->current_sample += this->header.wv.samples_count; + + return this->status; +} + +static void demux_wv_send_headers(demux_plugin_t *const this_gen) { + demux_wv_t *const this = (demux_wv_t *) this_gen; + buf_element_t *buf; + + this->audio_fifo = this->stream->audio_fifo; + + this->status = DEMUX_OK; + + /* Send start buffers */ + _x_demux_control_start(this->stream); + + /* Send header to decoder */ + if (this->audio_fifo) { + buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); + + buf->type = BUF_AUDIO_WAVPACK; + buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END; + buf->decoder_info[0] = this->input->get_length(this->input); + buf->decoder_info[1] = this->samplerate; + buf->decoder_info[2] = this->bits_per_sample; + buf->decoder_info[3] = this->channels; + + /* Copy the header */ + buf->size = sizeof(xine_waveformatex) + sizeof(wvheader_t); + memcpy(buf->content+sizeof(xine_waveformatex), this->header.buffer, buf->size); + + this->audio_fifo->put (this->audio_fifo, buf); + } +} + +static int demux_wv_seek (demux_plugin_t *this_gen, + off_t start_pos, int start_time, int playing) { + demux_wv_t *const this = (demux_wv_t *) this_gen; + + /* If thread is not running, initialize demuxer */ + if( !playing ) { + + /* send new pts */ + _x_demux_control_newpts(this->stream, 0, 0); + + this->status = DEMUX_OK; + + } + + return this->status; +} + +static void demux_wv_dispose (demux_plugin_t *const this_gen) { + demux_wv_t *const this = (demux_wv_t *) this_gen; + + free(this); +} + +static int demux_wv_get_status (demux_plugin_t *const this_gen) { + const demux_wv_t *const this = (const demux_wv_t *) this_gen; + + return this->status; +} + +static int demux_wv_get_stream_length (demux_plugin_t *const this_gen) { + const demux_wv_t *const this = (demux_wv_t *) this_gen; + + return (this->samples*1000) / this->samplerate; +} + +static uint32_t demux_wv_get_capabilities(demux_plugin_t *const this_gen) { + return DEMUX_CAP_NOCAP; +} + +static int demux_wv_get_optional_data(demux_plugin_t *const this_gen, + void *data, const int data_type) { + return DEMUX_OPTIONAL_UNSUPPORTED; +} + +static demux_plugin_t *open_plugin (demux_class_t *const class_gen, + xine_stream_t *const stream, + input_plugin_t *const input) { + demux_wv_t *const this = xine_xmalloc (sizeof (demux_wv_t)); + this->stream = stream; + this->input = input; + + this->demux_plugin.send_headers = demux_wv_send_headers; + this->demux_plugin.send_chunk = demux_wv_send_chunk; + this->demux_plugin.seek = demux_wv_seek; + this->demux_plugin.dispose = demux_wv_dispose; + this->demux_plugin.get_status = demux_wv_get_status; + this->demux_plugin.get_stream_length = demux_wv_get_stream_length; + this->demux_plugin.get_capabilities = demux_wv_get_capabilities; + this->demux_plugin.get_optional_data = demux_wv_get_optional_data; + this->demux_plugin.demux_class = class_gen; + + this->status = DEMUX_FINISHED; + switch (stream->content_detection_method) { + + case METHOD_BY_EXTENSION: { + const char *const mrl = input->get_mrl (input); + const char *const extensions = class_gen->get_extensions (class_gen); + + if (!_x_demux_check_extension (mrl, extensions)) { + free (this); + return NULL; + } + } + /* Falling through is intended */ + + case METHOD_BY_CONTENT: + case METHOD_EXPLICIT: + + if (!open_wv_file(this)) { + free (this); + return NULL; + } + + break; + + default: + free (this); + return NULL; + } + + return &this->demux_plugin; +} + +static const char *get_description (demux_class_t *const this_gen) { + return "Wavpack demux plugin"; +} + +static const char *get_identifier (demux_class_t *const this_gen) { + return "Wavpack"; +} + +static const char *get_extensions (demux_class_t *const this_gen) { + return "wv"; +} + +static const char *get_mimetypes (demux_class_t *const this_gen) { + return NULL; +} + +static void class_dispose (demux_class_t *const this_gen) { + demux_wv_class_t *const this = (demux_wv_class_t *) this_gen; + + free (this); +} + +void *demux_wv_init_plugin (xine_t *const xine, void *const data) { + demux_wv_class_t *const this = xine_xmalloc (sizeof (demux_wv_class_t)); + + this->demux_class.open_plugin = open_plugin; + this->demux_class.get_description = get_description; + this->demux_class.get_identifier = get_identifier; + this->demux_class.get_mimetypes = get_mimetypes; + this->demux_class.get_extensions = get_extensions; + this->demux_class.dispose = class_dispose; + + return this; +} -- cgit v1.2.3 From aafabdb94aca0ef5f2e982824a4d82ca838468d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Wed, 24 Jan 2007 05:04:26 +0000 Subject: Add missing include directive. CVS patchset: 8552 CVS date: 2007/01/24 05:04:26 --- src/combined/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/combined/Makefile.am b/src/combined/Makefile.am index 34915b24c..9733481e3 100644 --- a/src/combined/Makefile.am +++ b/src/combined/Makefile.am @@ -7,6 +7,6 @@ endif xineplug_LTLIBRARIES = $(xineplug_wavpack) xineplug_wavpack_la_SOURCES = demux_wavpack.c decoder_wavpack.c combined_wavpack.c combined_wavpack.h -xineplug_wavpack_la_CFLAGS = $(WAVPACK_CFLAGS) +xineplug_wavpack_la_CFLAGS = $(WAVPACK_CFLAGS) -I$(srcdir)/../demuxers xineplug_wavpack_la_LIBADD = $(XINE_LIB) $(WAVPACK_LIBS) xineplug_wavpack_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From 251a82b13acb4196726ab5803ba15367bf512aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Wed, 24 Jan 2007 05:05:11 +0000 Subject: Don't include audio_group.h, this demuxer is not part of that. CVS patchset: 8553 CVS date: 2007/01/24 05:05:11 --- src/combined/demux_wavpack.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/combined/demux_wavpack.c b/src/combined/demux_wavpack.c index ffb3641f5..c1d60f979 100644 --- a/src/combined/demux_wavpack.c +++ b/src/combined/demux_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gentoo.org> * - * $Id: demux_wavpack.c,v 1.1 2007/01/24 04:57:27 dgp85 Exp $ + * $Id: demux_wavpack.c,v 1.2 2007/01/24 05:05:11 dgp85 Exp $ */ #define LOG_MODULE "demux_wavpack" @@ -29,7 +29,6 @@ #include "xineutils.h" #include "demux.h" #include "bswap.h" -#include "group_audio.h" #include <wavpack/wavpack.h> -- cgit v1.2.3 From a485c6783bc7d32a89b3b99d65f4e110313c7ab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Wed, 24 Jan 2007 20:40:11 +0000 Subject: Remove the workaround for FFmpeg decoding, pass the complete header to the decoder, this way the WavPack decoder can be fixed to support multichannel streams. CVS patchset: 8554 CVS date: 2007/01/24 20:40:11 --- src/combined/decoder_wavpack.c | 29 ++++------------------------- src/combined/demux_wavpack.c | 32 +++++++++++++++++++------------- 2 files changed, 23 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/combined/decoder_wavpack.c b/src/combined/decoder_wavpack.c index 38a1b2bbe..9c8942e5b 100644 --- a/src/combined/decoder_wavpack.c +++ b/src/combined/decoder_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gentoo.org> * - * $Id: decoder_wavpack.c,v 1.1 2007/01/24 04:57:27 dgp85 Exp $ + * $Id: decoder_wavpack.c,v 1.2 2007/01/24 20:40:11 dgp85 Exp $ */ #define LOG_MODULE "decode_wavpack" @@ -183,15 +183,6 @@ static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t } else if (this->output_open) { /* This isn't a header frame and we have opened the output device */ - /* First time, we prepend the header, so that Wavpack library can open it. - * As FFmpeg requires the last 12 bytes of the header for its stream, create - * the rest of the header when the frame ended (so we have its size). - */ - if ( ! this->buf ) - this->buf = xine_xmalloc(this->buf_size = sizeof(wvheader_t)-12); - if ( this->buf_pos == 0 ) - this->buf_pos = sizeof(wvheader_t)-12; - /* What we have buffered so far, and what is coming in * is larger than our buffer */ @@ -218,25 +209,13 @@ static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t }; WavpackContext *ctx = NULL; - char error[256]; /* Current version of wavpack (4.31) does not write more than this */ + char error[256]; /* Current version of wavpack (4.40) does not write more than this */ int32_t samples_left; uint32_t samples_total; - wvheader_t *header = (wvheader_t*)this->buf; - - header->idcode = wvpk_signature; -#ifdef WORDS_BIGENDIAN - header->block_size = bswap_32(this->buf_size-sizeof(wvheader_t)); - header->wv_version = bswap_16(0x0406); -#else - header->block_size = this->buf_pos-8; - header->wv_version = 0x0406; -#endif - header->track = 0; header->index = 0; - header->file_samples = (uint32_t)-1; - header->samples_index = 0; + const wvheader_t *header = (const wvheader_t*)this->buf; this->buf_pos = 0; - if ( header->samples_count == 0 ) return; + if ( le2me_32(header->samples_count) == 0 ) return; ctx = WavpackOpenFileInputEx(&wavpack_buffer_reader, this, NULL, error, OPEN_STREAMING, 0); if ( ! ctx ) { diff --git a/src/combined/demux_wavpack.c b/src/combined/demux_wavpack.c index c1d60f979..8f95718d0 100644 --- a/src/combined/demux_wavpack.c +++ b/src/combined/demux_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gentoo.org> * - * $Id: demux_wavpack.c,v 1.2 2007/01/24 05:05:11 dgp85 Exp $ + * $Id: demux_wavpack.c,v 1.3 2007/01/24 20:40:11 dgp85 Exp $ */ #define LOG_MODULE "demux_wavpack" @@ -181,7 +181,8 @@ static int open_wv_file(demux_wv_t *const this) { static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { demux_wv_t *const this = (demux_wv_t *) this_gen; - uint32_t bytes_to_read; + uint32_t bytes_to_read; uint8_t header_sent = 0; + wvheader_t header; /* Check if we've finished */ if (this->current_sample >= this->samples) { @@ -192,23 +193,20 @@ static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { lprintf("current sample: %u\n", this->current_sample); - /* For some reason, FFmpeg requires to send it the latter 12 bytes of the header.. don't ask! */ - if ( this->input->read(this->input, this->header.buffer, sizeof(wvheader_t)-12) != sizeof(wvheader_t)-12 ) { + if ( this->input->read(this->input, &header, sizeof(wvheader_t)) != sizeof(wvheader_t) ) { this->status = DEMUX_FINISHED; return this->status; } /* The size of the block is «of course» minus 8, and - it also includes the size of the header, but we need - to give FFmpeg the 12 extra bytes (for some reason), - so the amount of bytes to read is the following. + it also includes the size of the header. */ - bytes_to_read = le2me_32(this->header.wv.block_size) + 8 - (sizeof(wvheader_t)-12); + bytes_to_read = le2me_32(header.block_size) + 8 - sizeof(wvheader_t); lprintf("demux_wavpack: going to read %u bytes.\n", bytes_to_read); while(bytes_to_read) { - off_t bytes_read = 0; + off_t bytes_read = 0, bytes_to_read_now, offset = 0; buf_element_t *buf = NULL; int64_t input_time_guess; @@ -222,7 +220,7 @@ static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { (int) ((double) this->input->get_current_pos(this->input) * 65535 / this->input->get_length(this->input)); - buf->pts = (((this->current_sample) / this->samplerate)-1)*90000; + buf->pts = (((this->current_sample) / this->samplerate))*90000; lprintf("Sending buffer with PTS %d\n", buf->pts); /* Set time */ @@ -233,9 +231,17 @@ static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { input_time_guess /= 65535; buf->extra_info->input_time = input_time_guess; - bytes_read = this->input->read(this->input, buf->content, ( bytes_to_read > buf->max_size ) ? buf->max_size : bytes_to_read); + bytes_to_read_now = ( bytes_to_read > buf->max_size ) ? buf->max_size : bytes_to_read; + if ( ! header_sent ) { + bytes_to_read_now -= (offset = sizeof(wvheader_t)); - buf->size = bytes_read; + header_sent = 1; + xine_fast_memcpy(buf->content, &header, sizeof(wvheader_t)); + } + + bytes_read = this->input->read(this->input, &buf->content[offset], bytes_to_read_now); + + buf->size = offset + bytes_read; bytes_to_read -= bytes_read; @@ -245,7 +251,7 @@ static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { this->audio_fifo->put(this->audio_fifo, buf); } - this->current_sample += this->header.wv.samples_count; + this->current_sample += le2me_32(header.samples_count); return this->status; } -- cgit v1.2.3 From 902e954ca9fb849e67d1a7086d5d4f596af67f3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Wed, 24 Jan 2007 20:47:31 +0000 Subject: There's no need to pass one of the frame's headers around, so just send the standard header, and remove the copy in the instance structure. CVS patchset: 8555 CVS date: 2007/01/24 20:47:31 --- src/combined/demux_wavpack.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/combined/demux_wavpack.c b/src/combined/demux_wavpack.c index 8f95718d0..629576a3a 100644 --- a/src/combined/demux_wavpack.c +++ b/src/combined/demux_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gentoo.org> * - * $Id: demux_wavpack.c,v 1.3 2007/01/24 20:40:11 dgp85 Exp $ + * $Id: demux_wavpack.c,v 1.4 2007/01/24 20:47:31 dgp85 Exp $ */ #define LOG_MODULE "demux_wavpack" @@ -42,11 +42,6 @@ typedef struct { input_plugin_t *input; int status; - union { - wvheader_t wv; - uint8_t buffer[sizeof(wvheader_t)]; - } header; - uint32_t current_sample; uint32_t samples; uint32_t samplerate; @@ -129,6 +124,7 @@ static WavpackStreamReader wavpack_input_reader = { static int open_wv_file(demux_wv_t *const this) { WavpackContext *ctx = NULL; char error[256]; /* Current version of wavpack (4.31) does not write more than this */ + wvheader_t header; /* Right now we don't support non-seekable streams */ if (! INPUT_IS_SEEKABLE(this->input) ) { @@ -137,11 +133,11 @@ static int open_wv_file(demux_wv_t *const this) { } /* Read the file header */ - if (_x_demux_read_header(this->input, this->header.buffer, sizeof(wvheader_t)) != sizeof(wvheader_t)) + if (_x_demux_read_header(this->input, (uint8_t*)(&header), sizeof(wvheader_t)) != sizeof(wvheader_t)) return 0; /* Validate header, we currently support only Wavpack 4 */ - if ( this->header.wv.idcode != wvpk_signature || (le2me_16(this->header.wv.wv_version) >> 8) != 4 ) + if ( header.idcode != wvpk_signature || (le2me_16(header.wv_version) >> 8) != 4 ) return 0; /* Rewind */ @@ -165,7 +161,7 @@ static int open_wv_file(demux_wv_t *const this) { _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, - ME_32(this->header.buffer)); + wvpk_signature); _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_CHANNELS, this->channels); _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, @@ -193,7 +189,7 @@ static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { lprintf("current sample: %u\n", this->current_sample); - if ( this->input->read(this->input, &header, sizeof(wvheader_t)) != sizeof(wvheader_t) ) { + if ( this->input->read(this->input, (uint8_t*)(&header), sizeof(wvheader_t)) != sizeof(wvheader_t) ) { this->status = DEMUX_FINISHED; return this->status; } @@ -278,9 +274,7 @@ static void demux_wv_send_headers(demux_plugin_t *const this_gen) { buf->decoder_info[2] = this->bits_per_sample; buf->decoder_info[3] = this->channels; - /* Copy the header */ - buf->size = sizeof(xine_waveformatex) + sizeof(wvheader_t); - memcpy(buf->content+sizeof(xine_waveformatex), this->header.buffer, buf->size); + buf->size = 0; this->audio_fifo->put (this->audio_fifo, buf); } -- cgit v1.2.3 From cf15dea964b7a81a3566d03eb3ef2370e49d78c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Wed, 24 Jan 2007 20:51:04 +0000 Subject: Replace my email address with a more generic one. CVS patchset: 8556 CVS date: 2007/01/24 20:51:04 --- src/combined/combined_wavpack.c | 4 ++-- src/combined/combined_wavpack.h | 4 ++-- src/combined/decoder_wavpack.c | 4 ++-- src/combined/demux_wavpack.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/combined/combined_wavpack.c b/src/combined/combined_wavpack.c index 00a1ba85f..f99070818 100644 --- a/src/combined/combined_wavpack.c +++ b/src/combined/combined_wavpack.c @@ -17,9 +17,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * xine interface to libwavpack by Diego Pettenò <flameeyes@gentoo.org> + * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: combined_wavpack.c,v 1.1 2007/01/24 04:57:26 dgp85 Exp $ + * $Id: combined_wavpack.c,v 1.2 2007/01/24 20:51:04 dgp85 Exp $ */ #include "xine_internal.h" diff --git a/src/combined/combined_wavpack.h b/src/combined/combined_wavpack.h index 7ab8877be..68541e921 100644 --- a/src/combined/combined_wavpack.h +++ b/src/combined/combined_wavpack.h @@ -17,9 +17,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * xine interface to libwavpack by Diego Pettenò <flameeyes@gentoo.org> + * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: combined_wavpack.h,v 1.1 2007/01/24 04:57:27 dgp85 Exp $ + * $Id: combined_wavpack.h,v 1.2 2007/01/24 20:51:04 dgp85 Exp $ */ #include "os_types.h" diff --git a/src/combined/decoder_wavpack.c b/src/combined/decoder_wavpack.c index 9c8942e5b..17e28e22d 100644 --- a/src/combined/decoder_wavpack.c +++ b/src/combined/decoder_wavpack.c @@ -17,9 +17,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * xine interface to libwavpack by Diego Pettenò <flameeyes@gentoo.org> + * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: decoder_wavpack.c,v 1.2 2007/01/24 20:40:11 dgp85 Exp $ + * $Id: decoder_wavpack.c,v 1.3 2007/01/24 20:51:04 dgp85 Exp $ */ #define LOG_MODULE "decode_wavpack" diff --git a/src/combined/demux_wavpack.c b/src/combined/demux_wavpack.c index 629576a3a..92936c192 100644 --- a/src/combined/demux_wavpack.c +++ b/src/combined/demux_wavpack.c @@ -17,9 +17,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * xine interface to libwavpack by Diego Pettenò <flameeyes@gentoo.org> + * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: demux_wavpack.c,v 1.4 2007/01/24 20:47:31 dgp85 Exp $ + * $Id: demux_wavpack.c,v 1.5 2007/01/24 20:51:04 dgp85 Exp $ */ #define LOG_MODULE "demux_wavpack" -- cgit v1.2.3 From 7be6530537c8c63e65ed96814c7826117e8d7242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Wed, 24 Jan 2007 21:41:30 +0000 Subject: Actually rewind to the start. CVS patchset: 8557 CVS date: 2007/01/24 21:41:30 --- src/combined/demux_wavpack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/combined/demux_wavpack.c b/src/combined/demux_wavpack.c index 92936c192..1369bcca1 100644 --- a/src/combined/demux_wavpack.c +++ b/src/combined/demux_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: demux_wavpack.c,v 1.5 2007/01/24 20:51:04 dgp85 Exp $ + * $Id: demux_wavpack.c,v 1.6 2007/01/24 21:41:30 dgp85 Exp $ */ #define LOG_MODULE "demux_wavpack" @@ -141,7 +141,7 @@ static int open_wv_file(demux_wv_t *const this) { return 0; /* Rewind */ - this->input->seek(this->input, 0 - sizeof(wvheader_t), SEEK_CUR); + this->input->seek(this->input, 0, SEEK_SET); ctx = WavpackOpenFileInputEx(&wavpack_input_reader, this->input, NULL, error, 0, 0); if ( ! ctx ) { -- cgit v1.2.3 From e6fccfb4acfe2aaf0e852deda3db671cf379c35b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Wed, 24 Jan 2007 21:42:21 +0000 Subject: Zero out the error array, so that we don't have false positives. CVS patchset: 8558 CVS date: 2007/01/24 21:42:21 --- src/combined/decoder_wavpack.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/combined/decoder_wavpack.c b/src/combined/decoder_wavpack.c index 17e28e22d..372998461 100644 --- a/src/combined/decoder_wavpack.c +++ b/src/combined/decoder_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: decoder_wavpack.c,v 1.3 2007/01/24 20:51:04 dgp85 Exp $ + * $Id: decoder_wavpack.c,v 1.4 2007/01/24 21:42:21 dgp85 Exp $ */ #define LOG_MODULE "decode_wavpack" @@ -209,7 +209,8 @@ static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t }; WavpackContext *ctx = NULL; - char error[256]; /* Current version of wavpack (4.40) does not write more than this */ + /* Current version of wavpack (4.40) does not write more than this */ + char error[256] = { 0, }; int32_t samples_left; uint32_t samples_total; const wvheader_t *header = (const wvheader_t*)this->buf; -- cgit v1.2.3 From a235b0f4ae70be82f719ca595681fd2914cf87ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Wed, 24 Jan 2007 21:44:06 +0000 Subject: Don't limit to 4096 samples if there's space to decode more, avoid more loops and more mallocs. CVS patchset: 8559 CVS date: 2007/01/24 21:44:06 --- src/combined/decoder_wavpack.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/combined/decoder_wavpack.c b/src/combined/decoder_wavpack.c index 372998461..4afbe85f0 100644 --- a/src/combined/decoder_wavpack.c +++ b/src/combined/decoder_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: decoder_wavpack.c,v 1.4 2007/01/24 21:42:21 dgp85 Exp $ + * $Id: decoder_wavpack.c,v 1.5 2007/01/24 21:44:06 dgp85 Exp $ */ #define LOG_MODULE "decode_wavpack" @@ -234,7 +234,6 @@ static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t buf_samples = audio_buffer->mem_size / (this->channels * (this->bits_per_sample/8)); if ( buf_samples > samples_left ) buf_samples = samples_left; - if ( buf_samples > 4096 ) buf_samples = 4096; decoded = alloca(buf_samples * this->channels * sizeof(int32_t)); -- cgit v1.2.3 From db1ac5310e3bd2012dc0530e9d8f9484a80f9c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Wed, 24 Jan 2007 22:03:41 +0000 Subject: Put a non-stream buffer when there's an error, so that xine does not lock on invald streams. CVS patchset: 8560 CVS date: 2007/01/24 22:03:41 --- src/combined/decoder_wavpack.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/combined/decoder_wavpack.c b/src/combined/decoder_wavpack.c index 4afbe85f0..72c17ac4e 100644 --- a/src/combined/decoder_wavpack.c +++ b/src/combined/decoder_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: decoder_wavpack.c,v 1.5 2007/01/24 21:44:06 dgp85 Exp $ + * $Id: decoder_wavpack.c,v 1.6 2007/01/24 22:03:41 dgp85 Exp $ */ #define LOG_MODULE "decode_wavpack" @@ -239,12 +239,14 @@ static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t decoded_count = WavpackUnpackSamples(ctx, decoded, buf_samples); if ( decoded_count == 0 && *error ) { - fprintf(stderr, "Error during decode: %s\n", error); + lprintf("Error during decode: %s\n", error); + this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, NULL); break; } if ( decoded_count == 0 ) { lprintf("Finished decoding, but still %"PRId64" samples left?\n", samples_left); + this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, NULL); break; } -- cgit v1.2.3 From fc897e74d6d2a6ba8abd62af85dc9d00fb0b607f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Wed, 24 Jan 2007 22:05:09 +0000 Subject: Send multichannel data in a single frame, stop reading and send the buffer when the final block is found. CVS patchset: 8561 CVS date: 2007/01/24 22:05:09 --- src/combined/demux_wavpack.c | 106 ++++++++++++++++++++++--------------------- 1 file changed, 55 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/combined/demux_wavpack.c b/src/combined/demux_wavpack.c index 1369bcca1..99b94ce6d 100644 --- a/src/combined/demux_wavpack.c +++ b/src/combined/demux_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: demux_wavpack.c,v 1.6 2007/01/24 21:41:30 dgp85 Exp $ + * $Id: demux_wavpack.c,v 1.7 2007/01/24 22:05:09 dgp85 Exp $ */ #define LOG_MODULE "demux_wavpack" @@ -180,72 +180,76 @@ static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { uint32_t bytes_to_read; uint8_t header_sent = 0; wvheader_t header; + lprintf("new frame\n"); + /* Check if we've finished */ if (this->current_sample >= this->samples) { lprintf("all frames read\n"); this->status = DEMUX_FINISHED; return this->status; } - + lprintf("current sample: %u\n", this->current_sample); - if ( this->input->read(this->input, (uint8_t*)(&header), sizeof(wvheader_t)) != sizeof(wvheader_t) ) { + do { + if ( this->input->read(this->input, (uint8_t*)(&header), sizeof(wvheader_t)) != sizeof(wvheader_t) ) { this->status = DEMUX_FINISHED; return this->status; - } - - /* The size of the block is «of course» minus 8, and - it also includes the size of the header. - */ - bytes_to_read = le2me_32(header.block_size) + 8 - sizeof(wvheader_t); - - lprintf("demux_wavpack: going to read %u bytes.\n", bytes_to_read); - - while(bytes_to_read) { - off_t bytes_read = 0, bytes_to_read_now, offset = 0; - buf_element_t *buf = NULL; - int64_t input_time_guess; - - /* Get a buffer */ - buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); - buf->type = BUF_AUDIO_WAVPACK; - buf->decoder_flags = 0; - - /* Set normalised position */ - buf->extra_info->input_normpos = - (int) ((double) this->input->get_current_pos(this->input) * 65535 / - this->input->get_length(this->input)); - - buf->pts = (((this->current_sample) / this->samplerate))*90000; - lprintf("Sending buffer with PTS %d\n", buf->pts); - - /* Set time */ - input_time_guess = this->samples; - input_time_guess /= this->samplerate; - input_time_guess *= 1000; - input_time_guess *= buf->extra_info->input_normpos; - input_time_guess /= 65535; - buf->extra_info->input_time = input_time_guess; - - bytes_to_read_now = ( bytes_to_read > buf->max_size ) ? buf->max_size : bytes_to_read; - if ( ! header_sent ) { - bytes_to_read_now -= (offset = sizeof(wvheader_t)); - - header_sent = 1; - xine_fast_memcpy(buf->content, &header, sizeof(wvheader_t)); } - bytes_read = this->input->read(this->input, &buf->content[offset], bytes_to_read_now); + /* The size of the block is «of course» minus 8, and + it also includes the size of the header. + */ + bytes_to_read = le2me_32(header.block_size) + 8 - sizeof(wvheader_t); + + lprintf("demux_wavpack: going to read %u bytes.\n", bytes_to_read); + + while(bytes_to_read) { + off_t bytes_read = 0, bytes_to_read_now, offset = 0; + buf_element_t *buf = NULL; + int64_t input_time_guess; + + /* Get a buffer */ + buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); + buf->type = BUF_AUDIO_WAVPACK; + buf->decoder_flags = 0; - buf->size = offset + bytes_read; + /* Set normalised position */ + buf->extra_info->input_normpos = + (int) ((double) this->input->get_current_pos(this->input) * 65535 / + this->input->get_length(this->input)); - bytes_to_read -= bytes_read; + buf->pts = (((this->current_sample) / this->samplerate))*90000; + lprintf("Sending buffer with PTS %"PRId64"\n", buf->pts); - if ( bytes_to_read <= 0 ) - buf->decoder_flags |= BUF_FLAG_FRAME_END; + /* Set time */ + input_time_guess = this->samples; + input_time_guess /= this->samplerate; + input_time_guess *= 1000; + input_time_guess *= buf->extra_info->input_normpos; + input_time_guess /= 65535; + buf->extra_info->input_time = input_time_guess; + + bytes_to_read_now = ( bytes_to_read > buf->max_size ) ? buf->max_size : bytes_to_read; + if ( ! header_sent ) { + bytes_to_read_now -= (offset = sizeof(wvheader_t)); + + header_sent = 1; + xine_fast_memcpy(buf->content, &header, sizeof(wvheader_t)); + } + + bytes_read = this->input->read(this->input, &buf->content[offset], bytes_to_read_now); + + buf->size = offset + bytes_read; + + bytes_to_read -= bytes_read; + + if ( bytes_to_read <= 0 && (le2me_32(header.flags) & FINAL_BLOCK) == FINAL_BLOCK) + buf->decoder_flags |= BUF_FLAG_FRAME_END; - this->audio_fifo->put(this->audio_fifo, buf); - } + this->audio_fifo->put(this->audio_fifo, buf); + } + } while ( (le2me_32(header.flags) & FINAL_BLOCK) != FINAL_BLOCK ); this->current_sample += le2me_32(header.samples_count); -- cgit v1.2.3 From 03efcdd7e7e3c10cc76a42f9caabd837d8e15fb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= <valtri@users.sourceforge.net> Date: Thu, 25 Jan 2007 18:44:55 +0000 Subject: Fixed build for srcdir != builddir. CVS patchset: 8562 CVS date: 2007/01/25 18:44:55 --- src/libffmpeg/libavcodec/Makefile.am | 3 ++- src/libffmpeg/libavcodec/i386/Makefile.am | 2 +- src/libffmpeg/libavutil/Makefile.am | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/libffmpeg/libavcodec/Makefile.am b/src/libffmpeg/libavcodec/Makefile.am index cae72eeff..a5e6cd650 100644 --- a/src/libffmpeg/libavcodec/Makefile.am +++ b/src/libffmpeg/libavcodec/Makefile.am @@ -12,7 +12,8 @@ EXTRA_DIST = motion_est_template.c \ #AM_CFLAGS = `test "$(CFLAGS)" = "$(DEBUG_CFLAGS)" && echo -DCONFIG_ENCODERS` -fno-strict-aliasing AM_CFLAGS = `test "$(CFLAGS)" = "$(DEBUG_CFLAGS)"` -fno-strict-aliasing AM_CPPFLAGS = $(ZLIB_CPPFLAGS) $(LIBFFMPEG_CPPFLAGS) \ - -I$(top_srcdir)/src/libffmpeg/libavutil -I$(top_srcdir)/src/libffmpeg + -I$(top_srcdir)/src/libffmpeg/libavutil -I$(top_srcdir)/src/libffmpeg \ + -I$(top_builddir)/src/libffmpeg ASFLAGS = noinst_LTLIBRARIES = libavcodec.la diff --git a/src/libffmpeg/libavcodec/i386/Makefile.am b/src/libffmpeg/libavcodec/i386/Makefile.am index ee170efd5..e3285d9cd 100644 --- a/src/libffmpeg/libavcodec/i386/Makefile.am +++ b/src/libffmpeg/libavcodec/i386/Makefile.am @@ -6,7 +6,7 @@ AM_CFLAGS = -fomit-frame-pointer -fno-strict-aliasing # CFLAGS is here to filter out -funroll-loops because it causes bad # behavior of libavcodec CFLAGS := `echo @CFLAGS@ | sed -e 's/-funroll-loops//g'` -AM_CPPFLAGS = $(LIBFFMPEG_CPPFLAGS) -I$(top_srcdir)/src/libffmpeg/libavutil -I$(top_srcdir)/src/libffmpeg +AM_CPPFLAGS = $(LIBFFMPEG_CPPFLAGS) -I$(top_srcdir)/src/libffmpeg/libavutil -I$(top_srcdir)/src/libffmpeg -I$(top_builddir)/src/libffmpeg # Avoid "can't find register" failures with -O1 and higher dsputil_mmx.o dsputil_mmx.lo: CFLAGS=$(shell echo @CFLAGS@ | sed -e 's/-funroll-loops//g; s/$$/ -Os/') diff --git a/src/libffmpeg/libavutil/Makefile.am b/src/libffmpeg/libavutil/Makefile.am index 6e507cb67..6010a8134 100644 --- a/src/libffmpeg/libavutil/Makefile.am +++ b/src/libffmpeg/libavutil/Makefile.am @@ -1,6 +1,7 @@ include $(top_srcdir)/misc/Makefile.common -AM_CPPFLAGS = $(LIBFFMPEG_CPPFLAGS) -I$(top_srcdir)/src/libffmpeg +AM_CPPFLAGS = $(LIBFFMPEG_CPPFLAGS) -I$(top_srcdir)/src/libffmpeg \ + -I$(top_builddir)/src/libffmpeg AM_CFLAGS = -fno-strict-aliasing ASFLAGS = -- cgit v1.2.3 From fc26ad8e82ad04611909cdf08a390bc91582dc9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 26 Jan 2007 17:06:05 +0000 Subject: Don't set get_blocksize to NULL, or the Samba access plugin will _never_ work. Thanks Timothy Redaelli for helping me diagnose it. CVS patchset: 8564 CVS date: 2007/01/26 17:06:05 --- src/input/input_smb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/input/input_smb.c b/src/input/input_smb.c index 21b45fa73..1b1f15565 100644 --- a/src/input/input_smb.c +++ b/src/input/input_smb.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_smb.c,v 1.15 2006/07/10 22:08:16 dgp85 Exp $ + * $Id: input_smb.c,v 1.16 2007/01/26 17:06:05 dgp85 Exp $ */ @@ -148,6 +148,10 @@ smb_plugin_get_mrl (input_plugin_t *this_gen) return this->mrl; } +static uint32_t smb_plugin_get_blocksize (input_plugin_t *this_gen) { + return 0; +} + static char *smb_class_get_description (input_class_t *this_gen) { @@ -485,7 +489,7 @@ smb_class_get_instance (input_class_t *class_gen, xine_stream_t *stream, this->input_plugin.seek = smb_plugin_seek; this->input_plugin.get_current_pos = smb_plugin_get_current_pos; this->input_plugin.get_length = smb_plugin_get_length; - this->input_plugin.get_blocksize = NULL; + this->input_plugin.get_blocksize = smb_plugin_get_blocksize; this->input_plugin.get_mrl = smb_plugin_get_mrl; this->input_plugin.get_optional_data = smb_plugin_get_optional_data; -- cgit v1.2.3 From 7c7551ce86b6b34405c69ffe0520a8655e2f7769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 26 Jan 2007 18:23:06 +0000 Subject: Fix warning with LOG enabled. CVS patchset: 8568 CVS date: 2007/01/26 18:23:06 --- src/combined/decoder_wavpack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/combined/decoder_wavpack.c b/src/combined/decoder_wavpack.c index 72c17ac4e..c52e47478 100644 --- a/src/combined/decoder_wavpack.c +++ b/src/combined/decoder_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: decoder_wavpack.c,v 1.6 2007/01/24 22:03:41 dgp85 Exp $ + * $Id: decoder_wavpack.c,v 1.7 2007/01/26 18:23:06 dgp85 Exp $ */ #define LOG_MODULE "decode_wavpack" @@ -245,7 +245,7 @@ static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t } if ( decoded_count == 0 ) { - lprintf("Finished decoding, but still %"PRId64" samples left?\n", samples_left); + lprintf("Finished decoding, but still %d samples left?\n", samples_left); this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, NULL); break; } -- cgit v1.2.3 From a56793d61e8152be10f485a1750ec608cd595a41 Mon Sep 17 00:00:00 2001 From: Miguel Freitas <miguelfreitas@users.sourceforge.net> Date: Sun, 28 Jan 2007 17:12:59 +0000 Subject: revert part of the PaX team's patch which broke tomsmocomp (segfault) CVS patchset: 8570 CVS date: 2007/01/28 17:12:59 --- .../plugins/tomsmocomp/SearchLoop0A.inc | 4 +- .../plugins/tomsmocomp/SearchLoopBottom.inc | 53 ++++++-------- .../plugins/tomsmocomp/SearchLoopTop.inc | 64 ++++++++--------- .../deinterlace/plugins/tomsmocomp/StrangeBob.inc | 80 +++++++++++----------- .../plugins/tomsmocomp/TomsMoCompAll.inc | 6 +- .../deinterlace/plugins/tomsmocomp/WierdBob.inc | 40 +++++------ .../plugins/tomsmocomp/tomsmocompmacros.h | 12 ++-- 7 files changed, 120 insertions(+), 139 deletions(-) (limited to 'src') diff --git a/src/post/deinterlace/plugins/tomsmocomp/SearchLoop0A.inc b/src/post/deinterlace/plugins/tomsmocomp/SearchLoop0A.inc index b1d9aeca7..844c6f91a 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/SearchLoop0A.inc +++ b/src/post/deinterlace/plugins/tomsmocomp/SearchLoop0A.inc @@ -7,9 +7,9 @@ // up by a little, and adjust later #ifdef IS_SSE2 - "paddusb "_ONES", %%xmm7\n\t" // bias toward no motion + "paddusb "MANGLE(ONES)", %%xmm7\n\t" // bias toward no motion #else - "paddusb "_ONES", %%mm7\n\t" // bias toward no motion + "paddusb "MANGLE(ONES)", %%mm7\n\t" // bias toward no motion #endif MERGE4PIXavg("(%%"XDI", %%"XCX")", "(%%"XSI", %%"XCX")") // center, in old and new diff --git a/src/post/deinterlace/plugins/tomsmocomp/SearchLoopBottom.inc b/src/post/deinterlace/plugins/tomsmocomp/SearchLoopBottom.inc index 72a2782a2..63755d1fc 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/SearchLoopBottom.inc +++ b/src/post/deinterlace/plugins/tomsmocomp/SearchLoopBottom.inc @@ -18,7 +18,7 @@ // Use the best weave if diffs less than 10 as that // means the image is still or moving cleanly // if there is motion we will clip which will catch anything - "psubusb "_FOURS", %%mm7\n\t" // sets bits to zero if weave diff < 4 + "psubusb "MANGLE(FOURS)", %%mm7\n\t" // sets bits to zero if weave diff < 4 "pxor %%mm0, %%mm0\n\t" "pcmpeqb %%mm0, %%mm7\n\t" // all ff where weave better, else 00 "pcmpeqb %%mm7, %%mm0\n\t" // all ff where bob better, else 00 @@ -28,10 +28,10 @@ #else // Use the better of bob or weave // pminub mm4, TENS // the most we care about - V_PMINUB ("%%mm4", _TENS, "%%mm0") // the most we care about + V_PMINUB ("%%mm4", MANGLE(TENS), "%%mm0") // the most we care about "psubusb %%mm4, %%mm7\n\t" // foregive that much from weave est? - "psubusb "_FOURS", %%mm7\n\t" // bias it a bit toward weave + "psubusb "MANGLE(FOURS)", %%mm7\n\t" // bias it a bit toward weave "pxor %%mm0, %%mm0\n\t" "pcmpeqb %%mm0, %%mm7\n\t" // all ff where weave better, else 00 "pcmpeqb %%mm7, %%mm0\n\t" // all ff where bob better, else 00 @@ -42,9 +42,9 @@ // pminub mm0, Max_Vals // but clip to catch the stray error -// V_PMINUB ("%%mm0", _Max_Vals, "%%mm1") // but clip to catch the stray error +// V_PMINUB ("%%mm0", MANGLE(Max_Vals), "%%mm1") // but clip to catch the stray error // pmaxub mm0, Min_Vals -// V_PMAXUB ("%%mm0", _Min_Vals) +// V_PMAXUB ("%%mm0", MANGLE(Min_Vals)) #endif @@ -53,29 +53,28 @@ #ifdef USE_VERTICAL_FILTER "movq %%mm0, %%mm1\n\t" - // pavgb mm0, qword ptr["XDX"] - V_PAVGB ("%%mm0", "(%%"XDX")", "%%mm2", _ShiftMask) - // movntq qword ptr["XAX"+"olddx"], mm0 - ADDX" "_olddx", %%"XAX"\n\t" - V_MOVNTQ ("(%%"XAX")", "%%mm0") - // pavgb mm1, qword ptr["XDX"+"XCX"] - V_PAVGB ("%%mm1", "(%%"XDX", %%"XCX")", "%%mm2", _ShiftMask) - "addq "_dst_pitchw", %%"XDX - // movntq qword ptr["XAX"+"olddx"], mm1 - V_MOVNTQ ("(%%"XAX")", "%%mm1") + // pavgb mm0, qword ptr["XBX"] + V_PAVGB ("%%mm0", "(%%"XBX")", "%%mm2", MANGLE(ShiftMask)) + // movntq qword ptr["XAX"+"XDX"], mm0 + V_MOVNTQ ("(%"XAX", %%"XDX")", "%%mm0") + // pavgb mm1, qword ptr["XBX"+"XCX"] + V_PAVGB ("%%mm1", "(%%"XBX", %%"XCX")", "%%mm2", MANGLE(ShiftMask)) + "addq "_dst_pitchw", %%"XBX + // movntq qword ptr["XAX"+"XDX"], mm1 + V_MOVNTQ ("(%%"XAX", %%"XDX")", "%%mm1") #else - // movntq qword ptr["XAX"+"olddx"], mm0 - ADDX" "_olddx", %%"XAX"\n\t" - V_MOVNTQ ("(%%"XAX")", "%%mm0") + // movntq qword ptr["XAX"+"XDX"], mm0 + V_MOVNTQ ("(%%"XAX", %%"XDX")", "%%mm0") #endif - ADDX" $8, "_olddx"\n\t" // bump offset pointer - MOVX" "_olddx", %%"XAX"\n\t" - CMPX" "_Last8", %%"XAX"\n\t" // done with line? + LEAX" 8(%%"XDX"), %%"XDX"\n\t" // bump offset pointer + CMPX" "_Last8", %%"XDX"\n\t" // done with line? "jb 1b\n\t" // y #endif + MOVX" "_oldbx", %%"XBX"\n\t" + : /* no outputs */ : "m"(pBob), @@ -86,17 +85,7 @@ "m"(pSrc), "m"(pSrcP), "m"(pBobP), - "m"(olddx), - "m"(UVMask), - "m"(ShiftMask), - "m"(FOURS), - "m"(TENS), - "m"(Max_Vals), - "m"(Min_Vals), - "m"(YMask), - "m"(Max_Mov), - "m"(ONES), - "m"(DiffThres) + "m"(oldbx) : XAX, XCX, XDX, XSI, XDI, #ifdef ARCH_X86 diff --git a/src/post/deinterlace/plugins/tomsmocomp/SearchLoopTop.inc b/src/post/deinterlace/plugins/tomsmocomp/SearchLoopTop.inc index 4504be1d1..5e9f7f04a 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/SearchLoopTop.inc +++ b/src/post/deinterlace/plugins/tomsmocomp/SearchLoopTop.inc @@ -66,17 +66,7 @@ long dst_pitchw = dst_pitch; // local stor so asm can ref #define _pSrc "%5" #define _pSrcP "%6" #define _pBobP "%7" -#define _olddx "%8" -#define _UVMask "%9" -#define _ShiftMask "%10" -#define _FOURS "%11" -#define _TENS "%12" -#define _Max_Vals "%13" -#define _Min_Vals "%14" -#define _YMask "%15" -#define _Max_Mov "%16" -#define _ONES "%17" -#define _DiffThres "%18" +#define _oldbx "%8" #endif for (y=1; y < FldHeight-1; y++) @@ -87,73 +77,75 @@ long dst_pitchw = dst_pitch; // local stor so asm can ref // Loop general reg usage // // XAX - pBobP, then pDest - // XDX - pBob + // XBX - pBob // XCX - src_pitch2 - // _olddx - current offset + // XDX - current offset // XDI - prev weave pixels, 1 line up // XSI - next weave pixels, 1 line up + // Save "XBX" (-fPIC) + MOVX" %%"XBX", "_oldbx"\n\t" + #ifdef IS_SSE2 // sse2 code deleted for now #else // simple bob first 8 bytes - MOVX" "_pBob", %%"XDX"\n\t" + MOVX" "_pBob", %%"XBX"\n\t" MOVX" "_src_pitch2", %%"XCX"\n\t" #ifdef USE_VERTICAL_FILTER - "movq (%%"XDX"), %%mm0\n\t" - "movq (%%"XDX", %%"XCX"), %%mm1\n\t" //, qword ptr["XDX"+"XCX"] + "movq (%%"XBX"), %%mm0\n\t" + "movq (%%"XBX", %%"XCX"), %%mm1\n\t" //, qword ptr["XBX"+"XCX"] "movq %%mm0, %%mm2\n\t" - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // halfway between - V_PAVGB ("%%mm0", "%%mm2", "%%mm3", _ShiftMask) // 1/4 way - V_PAVGB ("%%mm1", "%%mm2", "%%mm3", _ShiftMask) // 3/4 way + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // halfway between + V_PAVGB ("%%mm0", "%%mm2", "%%mm3", MANGLE(ShiftMask)) // 1/4 way + V_PAVGB ("%%mm1", "%%mm2", "%%mm3", MANGLE(ShiftMask)) // 3/4 way MOVX" "_pDest", %%"XDI"\n\t" MOVX" "_dst_pitchw", %%"XAX"\n\t" V_MOVNTQ ("(%%"XDI")", "%%mm0") V_MOVNTQ ("(%%"XDI", %%"XAX")", "%%mm1") // qword ptr["XDI"+"XAX"], mm1 // simple bob last 8 bytes - MOVX" "_Last8", %%"XSI"\n\t" - ADDX" %%"XDX", %%"XSI"\n\t" // ["XDX"+"olddx"] + MOVX" "_Last8", %%"XDX"\n\t" + LEAX" (%%"XBX", %%"XDX"), %%"XSI"\n\t" // ["XBX"+"XDX"] "movq (%%"XSI"), %%mm0\n\t" "movq (%%"XSI", %%"XCX"), %%mm1\n\t" // qword ptr["XSI"+"XCX"] "movq %%mm0, %%mm2\n\t" - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // halfway between - V_PAVGB ("%%mm0", "%%mm2", "%%mm3", _ShiftMask) // 1/4 way - V_PAVGB ("%%mm1", "%%mm2", "%%mm3", _ShiftMask) // 3/4 way - ADDX" "_olddx", %%"XDI"\n\t" // last 8 bytes of dest + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // halfway between + V_PAVGB ("%%mm0", "%%mm2", "%%mm3", MANGLE(ShiftMask)) // 1/4 way + V_PAVGB ("%%mm1", "%%mm2", "%%mm3", MANGLE(ShiftMask)) // 3/4 way + ADDX" %%"XDX", %%"XDI"\n\t" // last 8 bytes of dest V_MOVNTQ ("%%"XDI"", "%%mm0") V_MOVNTQ ("(%%"XDI", %%"XAX")", "%%mm1") // qword ptr["XDI"+"XAX"], mm1) #else - "movq (%%"XDX"), %%mm0\n\t" - // pavgb mm0, qword ptr["XDX"+"XCX"] - V_PAVGB ("%%mm0", "(%%"XDX", %%"XCX")", "%%mm2", _ShiftMask) // qword ptr["XDX"+"XCX"], mm2, ShiftMask) + "movq (%%"XBX"), %%mm0\n\t" + // pavgb mm0, qword ptr["XBX"+"XCX"] + V_PAVGB ("%%mm0", "(%%"XBX", %%"XCX")", "%%mm2", MANGLE(ShiftMask)) // qword ptr["XBX"+"XCX"], mm2, ShiftMask) MOVX" "_pDest", %%"XDI"\n\t" V_MOVNTQ ("(%%"XDI")", "%%mm0") // simple bob last 8 bytes - MOVX" "_Last8", %%"XSI"\n\t" - ADDX" %%"XDX", %%"XSI"\n\t" //"XSI", ["XDX"+"olddx"] + MOVX" "_Last8", %%"XDX"\n\t" + LEAX" (%%"XBX", %%"XDX"), %%"XSI"\n\t" //"XSI", ["XBX"+"XDX"] "movq (%%"XSI"), %%mm0\n\t" // pavgb mm0, qword ptr["XSI"+"XCX"] - V_PAVGB ("%%mm0", "(%%"XSI", %%"XCX")", "%%mm2", _ShiftMask) // qword ptr["XSI"+"XCX"], mm2, ShiftMask) - ADDX" "_olddx", %%"XDI"\n\t" - V_MOVNTQ ("(%%"XDI")", "%%mm0") // qword ptr["XDI"+"olddx"], mm0) + V_PAVGB ("%%mm0", "(%%"XSI", %%"XCX")", "%%mm2", MANGLE(ShiftMask)) // qword ptr["XSI"+"XCX"], mm2, ShiftMask) + V_MOVNTQ ("(%%"XDI", %%"XDX")", "%%mm0") // qword ptr["XDI"+"XDX"], mm0) #endif // now loop and get the middle qwords MOVX" "_pSrc", %%"XSI"\n\t" MOVX" "_pSrcP", %%"XDI"\n\t" - MOVX" $8, "_olddx"\n\t" // curr offset longo all lines + MOVX" $8, %%"XDX"\n\t" // curr offset longo all lines "1:\n\t" MOVX" "_pBobP", %%"XAX"\n\t" ADDX" $8, %%"XDI"\n\t" ADDX" $8, %%"XSI"\n\t" - ADDX" $8, %%"XDX"\n\t" - ADDX" "_olddx", %%"XAX"\n\t" + ADDX" $8, %%"XBX"\n\t" + ADDX" %%"XDX", %%"XAX"\n\t" #ifdef USE_STRANGE_BOB #include "StrangeBob.inc" diff --git a/src/post/deinterlace/plugins/tomsmocomp/StrangeBob.inc b/src/post/deinterlace/plugins/tomsmocomp/StrangeBob.inc index 9d02ebc11..5ca5b85bb 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/StrangeBob.inc +++ b/src/post/deinterlace/plugins/tomsmocomp/StrangeBob.inc @@ -31,22 +31,22 @@ "pxor %%mm6, %%mm6\n\t" "pxor %%mm7, %%mm7\n\t" - "movq -2(%%"XDX"), %%mm0\n\t" // value a from top left - "movq -4(%%"XDX", %%"XCX"), %%mm1\n\t" // value m from bottom right + "movq -2(%%"XBX"), %%mm0\n\t" // value a from top left + "movq -4(%%"XBX", %%"XCX"), %%mm1\n\t" // value m from bottom right "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm3\n\t" "psubusb %%mm0, %%mm1\n\t" "por %%mm1, %%mm3\n\t" // abs(a,m) - "psubusb "_DiffThres", %%mm3\n\t" // nonzero where abs(a,m) > Thres else 0 + "psubusb "MANGLE(DiffThres)", %%mm3\n\t" // nonzero where abs(a,m) > Thres else 0 "pxor %%mm4, %%mm4\n\t" "pcmpeqb %%mm4, %%mm3\n\t" // now ff where abs(a,m) < Thres, else 00 "pcmpeqb %%mm3, %%mm4\n\t" // here ff where abs(a,m) > Thres, else 00 - "movq -4(%%"XDX"), %%mm0\n\t" // value j - "movq 4(%%"XDX", %%"XCX"), %%mm1\n\t" // value n + "movq -4(%%"XBX"), %%mm0\n\t" // value j + "movq 4(%%"XBX", %%"XCX"), %%mm1\n\t" // value n "movq %%mm0, %%mm2\n\t" "pavgb %%mm1, %%mm2\n\t" // avg(j,n) "movq %%mm0, %%mm3\n\t" @@ -55,7 +55,7 @@ "por %%mm1, %%mm0\n\t" // abs(j,n) "movq %%mm0, %%mm1\n\t" - "psubusb "_DiffThres", %%mm1\n\t" // nonzero where abs(j,n) > Thres else 0 + "psubusb "MANGLE(DiffThres)", %%mm1\n\t" // nonzero where abs(j,n) > Thres else 0 "pxor %%mm3, %%mm3\n\t" "pcmpeqb %%mm3, %%mm1\n\t" // now ff where abs(j,n) < Thres, else 00 @@ -75,31 +75,31 @@ "por %%mm0, %%mm7\n\t" // k & m - "movq 2(%%"XDX"), %%mm0\n\t" // value c from top left - "movq 4(%%"XDX", %%"XCX"), %%mm1\n\t" // value n from bottom right + "movq 2(%%"XBX"), %%mm0\n\t" // value c from top left + "movq 4(%%"XBX", %%"XCX"), %%mm1\n\t" // value n from bottom right "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm3\n\t" "psubusb %%mm0, %%mm1\n\t" "por %%mm1, %%mm3\n\t" // abs(c,n) - "psubusb "_DiffThres", %%mm3\n\t" // nonzero where abs(c,n) > Thres else 0 + "psubusb "MANGLE(DiffThres)", %%mm3\n\t" // nonzero where abs(c,n) > Thres else 0 "pxor %%mm4, %%mm4\n\t" "pcmpeqb %%mm4, %%mm3\n\t" // now ff where abs(c,n) < Thres, else 00 "pcmpeqb %%mm3, %%mm4\n\t" // here ff where abs(c,n) > Thres, else 00 - "movq 4(%%"XDX"), %%mm0\n\t" // value k - "movq -4(%%"XDX", %%"XCX"), %%mm1\n\t" // value m + "movq 4(%%"XBX"), %%mm0\n\t" // value k + "movq -4(%%"XBX", %%"XCX"), %%mm1\n\t" // value m "movq %%mm0, %%mm2\n\t" - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(k,m) + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // avg(k,m) "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm0\n\t" "psubusb %%mm3, %%mm1\n\t" "por %%mm1, %%mm0\n\t" // abs(k,m) "movq %%mm0, %%mm1\n\t" - "psubusb "_DiffThres", %%mm1\n\t" // nonzero where abs(k,m) > Thres else 0 + "psubusb "MANGLE(DiffThres)", %%mm1\n\t" // nonzero where abs(k,m) > Thres else 0 "pxor %%mm3, %%mm3\n\t" "pcmpeqb %%mm3, %%mm1\n\t" // now ff where abs(k,m) < Thres, else 00 @@ -120,30 +120,30 @@ // c & d - "movq (%%"XDX"), %%mm0\n\t" // value b from top left - "movq 2(%%"XDX", %%"XCX"), %%mm1\n\t" // value f from bottom right + "movq (%%"XBX"), %%mm0\n\t" // value b from top left + "movq 2(%%"XBX", %%"XCX"), %%mm1\n\t" // value f from bottom right "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm3\n\t" "psubusb %%mm0, %%mm1\n\t" "por %%mm1, %%mm3\n\t" // abs(b,f) - "psubusb "_DiffThres", %%mm3\n\t" // nonzero where abs(b,f) > Thres else 0 + "psubusb "MANGLE(DiffThres)", %%mm3\n\t" // nonzero where abs(b,f) > Thres else 0 "pxor %%mm4, %%mm4\n\t" "pcmpeqb %%mm4, %%mm3\n\t" // now ff where abs(b,f) < Thres, else 00 "pcmpeqb %%mm3, %%mm4\n\t" // here ff where abs(b,f) > Thres, else 00 - "movq 2(%%"XDX"), %%mm0\n\t" // value c - "movq -2(%%"XDX", %%"XCX"), %%mm1\n\t" // value d + "movq 2(%%"XBX"), %%mm0\n\t" // value c + "movq -2(%%"XBX", %%"XCX"), %%mm1\n\t" // value d "movq %%mm0, %%mm2\n\t" - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(c,d) + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // avg(c,d) "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm0\n\t" "psubusb %%mm3, %%mm1\n\t" "por %%mm1, %%mm0\n\t" // abs(c,d) "movq %%mm0, %%mm1\n\t" - "psubusb "_DiffThres", %%mm1\n\t" // nonzero where abs(c,d) > Thres else 0 + "psubusb "MANGLE(DiffThres)", %%mm1\n\t" // nonzero where abs(c,d) > Thres else 0 "pxor %%mm3, %%mm3\n\t" "pcmpeqb %%mm3, %%mm1\n\t" // now ff where abs(c,d) < Thres, else 00 @@ -163,30 +163,30 @@ "por %%mm0, %%mm7\n\t" // a & f - "movq (%%"XDX"), %%mm0\n\t" // value b from top left - "movq -2(%%"XDX", %%"XCX"), %%mm1\n\t" // value d from bottom right + "movq (%%"XBX"), %%mm0\n\t" // value b from top left + "movq -2(%%"XBX", %%"XCX"), %%mm1\n\t" // value d from bottom right "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm3\n\t" "psubusb %%mm0, %%mm1\n\t" "por %%mm1, %%mm3\n\t" // abs(b,d) - "psubusb "_DiffThres", %%mm3\n\t" // nonzero where abs(b,d) > Thres else 0 + "psubusb "MANGLE(DiffThres)", %%mm3\n\t" // nonzero where abs(b,d) > Thres else 0 "pxor %%mm4, %%mm4\n\t" "pcmpeqb %%mm4, %%mm3\n\t" // now ff where abs(b,d) < Thres, else 00 "pcmpeqb %%mm3, %%mm4\n\t" // here ff where abs(b,d) > Thres, else 00 - "movq -2(%%"XDX"), %%mm0\n\t" // value a - "movq 2(%%"XDX", %%"XCX"), %%mm1\n\t" // value f + "movq -2(%%"XBX"), %%mm0\n\t" // value a + "movq 2(%%"XBX", %%"XCX"), %%mm1\n\t" // value f "movq %%mm0, %%mm2\n\t" - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(a,f) + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // avg(a,f) "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm0\n\t" "psubusb %%mm3, %%mm1\n\t" "por %%mm1, %%mm0\n\t" // abs(a,f) "movq %%mm0, %%mm1\n\t" - "psubusb "_DiffThres", %%mm1\n\t" // nonzero where abs(a,f) > Thres else 0 + "psubusb "MANGLE(DiffThres)", %%mm1\n\t" // nonzero where abs(a,f) > Thres else 0 "pxor %%mm3, %%mm3\n\t" "pcmpeqb %%mm3, %%mm1\n\t" // now ff where abs(a,f) < Thres, else 00 @@ -205,22 +205,22 @@ "por %%mm2, %%mm6\n\t" "por %%mm0, %%mm7\n\t" - "pand "_YMask", %%mm5\n\t" // mask out chroma from here - "pand "_YMask", %%mm6\n\t" // mask out chroma from here - "pand "_YMask", %%mm7\n\t" // mask out chroma from here + "pand "MANGLE(YMask)", %%mm5\n\t" // mask out chroma from here + "pand "MANGLE(YMask)", %%mm6\n\t" // mask out chroma from here + "pand "MANGLE(YMask)", %%mm7\n\t" // mask out chroma from here // b,e - "movq (%%"XDX"), %%mm0\n\t" // value b from top - "movq (%%"XDX", %%"XCX"), %%mm1\n\t" // value e from bottom + "movq (%%"XBX"), %%mm0\n\t" // value b from top + "movq (%%"XBX", %%"XCX"), %%mm1\n\t" // value e from bottom "movq %%mm0, %%mm2\n\t" - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(b,e) + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // avg(b,e) "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm0\n\t" "psubusb %%mm3, %%mm1\n\t" "por %%mm1, %%mm0\n\t" // abs(b,e) "movq %%mm0, %%mm1\n\t" - "psubusb "_DiffThres", %%mm1\n\t" // nonzero where abs(b,e) > Thres else 0 + "psubusb "MANGLE(DiffThres)", %%mm1\n\t" // nonzero where abs(b,e) > Thres else 0 "pxor %%mm3, %%mm3\n\t" "pcmpeqb %%mm3, %%mm1\n\t" // now ff where abs(b,e) < Thres, else 00 @@ -238,8 +238,8 @@ "por %%mm0, %%mm7\n\t" // bob in any leftovers - "movq (%%"XDX"), %%mm0\n\t" // value b from top - "movq (%%"XDX", %%"XCX"), %%mm1\n\t" // value e from bottom + "movq (%%"XBX"), %%mm0\n\t" // value b from top + "movq (%%"XBX", %%"XCX"), %%mm1\n\t" // value e from bottom // We will also calc here the max/min values to later limit comb @@ -271,7 +271,7 @@ "por %%mm2, %%mm3\n\t" // abs diff // pmaxub %%mm3, %%mm4 // top or bottom pixel moved most V_PMAXUB ("%%mm3", "%%mm4") // top or bottom pixel moved most - "psubusb "_DiffThres", %%mm3\n\t" // moved more than allowed? or goes to 0? + "psubusb "MANGLE(DiffThres)", %%mm3\n\t" // moved more than allowed? or goes to 0? "pxor %%mm4, %%mm4\n\t" "pcmpeqb %%mm4, %%mm3\n\t" // now ff where low motion, else high motion @@ -283,19 +283,19 @@ V_PMAXUB ("%%mm6", "%%mm2") "psubusb %%mm3, %%mm2\n\t" // maybe decrease it to 0000.. if no surround motion -// "movq %%mm2, "_Min_Vals"\n\t" +// "movq %%mm2, "MANGLE(Min_Vals)"\n\t" "movq %%mm0, %%mm2\n\t" V_PMAXUB ("%%mm2", "%%mm1") // pminub %%mm6, %%mm2 // clip our current results so far to be below this V_PMINUB ("%%mm6", "%%mm2", "%%mm4") "paddusb %%mm3, %%mm2\n\t" // maybe increase it to ffffff if no surround motion -// "movq %%mm2, "_Max_Vals"\n\t" +// "movq %%mm2, "MANGLE(Max_Vals)"\n\t" #endif "movq %%mm0, %%mm2\n\t" // pavgb %%mm2, %%mm1 // avg(b,e) - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(b,e) + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // avg(b,e) "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm3\n\t" diff --git a/src/post/deinterlace/plugins/tomsmocomp/TomsMoCompAll.inc b/src/post/deinterlace/plugins/tomsmocomp/TomsMoCompAll.inc index a3b139691..5870d77be 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/TomsMoCompAll.inc +++ b/src/post/deinterlace/plugins/tomsmocomp/TomsMoCompAll.inc @@ -33,8 +33,8 @@ static const int64_t __attribute__((__used__)) TENS = 0x0a0a0a0a0a0a0a0aull static const int64_t __attribute__((__used__)) FOURS = 0x0404040404040404ull; static const int64_t __attribute__((__used__)) ONES = 0x0101010101010101ull; static const int64_t __attribute__((__used__)) ShiftMask = 0xfefffefffefffeffull; -static int64_t Min_Vals = 0x0000000000000000ull; -static int64_t Max_Vals = 0x0000000000000000ull; +//static int64_t Min_Vals = 0x0000000000000000ull; +//static int64_t Max_Vals = 0x0000000000000000ull; #endif #ifndef TopFirst @@ -69,7 +69,7 @@ static void FUNCT_NAME(uint8_t *output, int outstride, int rowsize; int FldHeight; int stride = (width*2); - long olddx; + long oldbx; src_pitch = stride*2; diff --git a/src/post/deinterlace/plugins/tomsmocomp/WierdBob.inc b/src/post/deinterlace/plugins/tomsmocomp/WierdBob.inc index 9aa53b119..11614879a 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/WierdBob.inc +++ b/src/post/deinterlace/plugins/tomsmocomp/WierdBob.inc @@ -14,22 +14,22 @@ // selected for the smallest of abs(a,f), abs(c,d), or abs(b,e), etc. // a,f - "movq -2(%%"XDX"), %%mm0\n\t" // value a from top left - "movq 2(%%"XDX", %%"XCX"), %%mm1\n\t" // value f from bottom right + "movq -2(%%"XBX"), %%mm0\n\t" // value a from top left + "movq 2(%%"XBX", %%"XCX"), %%mm1\n\t" // value f from bottom right "movq %%mm0, %%mm6\n\t" // pavgb %%mm6, %%mm1 // avg(a,f), also best so far - V_PAVGB ("%%mm6", "%%mm1", "%%mm7", _ShiftMask) // avg(a,f), also best so far + V_PAVGB ("%%mm6", "%%mm1", "%%mm7", MANGLE(ShiftMask)) // avg(a,f), also best so far "movq %%mm0, %%mm7\n\t" "psubusb %%mm1, %%mm7\n\t" "psubusb %%mm0, %%mm1\n\t" "por %%mm1, %%mm7\n\t" // abs diff, also best so far // c,d - "movq 2(%%"XDX"), %%mm0\n\t" // value a from top left - "movq -2(%%"XDX", %%"XCX"), %%mm1\n\t" // value f from bottom right + "movq 2(%%"XBX"), %%mm0\n\t" // value a from top left + "movq -2(%%"XBX", %%"XCX"), %%mm1\n\t" // value f from bottom right "movq %%mm0, %%mm2\n\t" // pavgb %%mm2, %%mm1 // avg(c,d) - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(c,d) + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // avg(c,d) "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm3\n\t" "psubusb %%mm0, %%mm1\n\t" @@ -49,15 +49,15 @@ "por %%mm2, %%mm6\n\t" // and merge new & old vals keeping best "por %%mm1, %%mm7\n\t" - "por "_UVMask", %%mm7\n\t" // but we know chroma is worthless so far - "pand "_YMask", %%mm5\n\t" // mask out chroma from here also + "por "MANGLE(UVMask)", %%mm7\n\t" // but we know chroma is worthless so far + "pand "MANGLE(YMask)", %%mm5\n\t" // mask out chroma from here also // j,n - "movq -4(%%"XDX"), %%mm0\n\t" // value j from top left - "movq 4(%%"XDX", %%"XCX"), %%mm1\n\t" // value n from bottom right + "movq -4(%%"XBX"), %%mm0\n\t" // value j from top left + "movq 4(%%"XBX", %%"XCX"), %%mm1\n\t" // value n from bottom right "movq %%mm0, %%mm2\n\t" // pavgb %%mm2, %%mm1 // avg(j,n) - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(j,n) + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // avg(j,n) "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm3\n\t" "psubusb %%mm0, %%mm1\n\t" @@ -79,11 +79,11 @@ "por %%mm1, %%mm7\n\t" // " // k, m - "movq 4(%%"XDX"), %%mm0\n\t" // value k from top right - "movq -4(%%"XDX", %%"XCX"), %%mm1\n\t" // value n from bottom left + "movq 4(%%"XBX"), %%mm0\n\t" // value k from top right + "movq -4(%%"XBX", %%"XCX"), %%mm1\n\t" // value n from bottom left "movq %%mm0, %%mm4\n\t" // pavgb %%mm4, %%mm1 // avg(k,m) - V_PAVGB ("%%mm4", "%%mm1", "%%mm3", _ShiftMask) // avg(k,m) + V_PAVGB ("%%mm4", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // avg(k,m) "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm3\n\t" @@ -108,8 +108,8 @@ "por %%mm1, %%mm7\n\t" // " // b,e - "movq (%%"XDX"), %%mm0\n\t" // value b from top - "movq (%%"XDX", %%"XCX"), %%mm1\n\t" // value e from bottom + "movq (%%"XBX"), %%mm0\n\t" // value b from top + "movq (%%"XBX", %%"XCX"), %%mm1\n\t" // value e from bottom // We will also calc here the max/min values to later limit comb // so the max excursion will not exceed the Max_Comb constant @@ -140,7 +140,7 @@ "por %%mm2, %%mm3\n\t" // abs diff // pmaxub %%mm3, %%mm4 // top or bottom pixel moved most V_PMAXUB ("%%mm3", "%%mm4") // top or bottom pixel moved most - "psubusb "_Max_Mov", %%mm3\n\t" // moved more than allowed? or goes to 0? + "psubusb "MANGLE(Max_Mov)", %%mm3\n\t" // moved more than allowed? or goes to 0? "pxor %%mm4, %%mm4\n\t" "pcmpeqb %%mm4, %%mm3\n\t" // now ff where low motion, else high motion @@ -152,19 +152,19 @@ V_PMAXUB ("%%mm6", "%%mm2") "psubusb %%mm3, %%mm2\n\t" // maybe decrease it to 0000.. if no surround motion -// "movq %%mm2, "_Min_Vals"\n\t" +// "movq %%mm2, "MANGLE(Min_Vals)"\n\t" "movq %%mm0, %%mm2\n\t" V_PMAXUB ("%%mm2", "%%mm1") // pminub %%mm6, %%mm2 // clip our current results so far to be below this V_PMINUB ("%%mm6", "%%mm2", "%%mm4") "paddusb %%mm3, %%mm2\n\t" // maybe increase it to ffffff if no surround motion -// "movq %%mm2, "_Max_Vals"\n\t" +// "movq %%mm2, "MANGLE(Max_Vals)"\n\t" #endif "movq %%mm0, %%mm2\n\t" // pavgb %%mm2, %%mm1 // avg(b,e) - V_PAVGB ("%%mm2", "%%mm1", "%%mm3", _ShiftMask) // avg(b,e) + V_PAVGB ("%%mm2", "%%mm1", "%%mm3", MANGLE(ShiftMask)) // avg(b,e) "movq %%mm0, %%mm3\n\t" "psubusb %%mm1, %%mm3\n\t" diff --git a/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h b/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h index fc1e2f66d..3d7ae308e 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h +++ b/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h @@ -114,7 +114,7 @@ "por %%xmm0, %%xmm5\n\t" /* and merge new & old vals */ \ "por %%xmm2, %%xmm7\n\t" -#define RESET_CHROMA "por "_UVMask", %%xmm7\n\t" +#define RESET_CHROMA "por "MANGLE(UVMask)", %%xmm7\n\t" #else // ifdef IS_SSE2 @@ -126,7 +126,7 @@ "psubusb %%mm1, %%mm2\n\t" \ "psubusb %%mm0, %%mm3\n\t" \ "por %%mm3, %%mm2\n\t" \ - V_PAVGB ("%%mm0", "%%mm1", "%%mm3", _ShiftMask) /* avg of 2 pixels */ \ + V_PAVGB ("%%mm0", "%%mm1", "%%mm3", MANGLE(ShiftMask)) /* avg of 2 pixels */ \ "movq %%mm2, %%mm3\n\t" /* another copy of our our weights */ \ "pxor %%mm1, %%mm1\n\t" \ "psubusb %%mm7, %%mm3\n\t" /* nonzero where old weights lower, else 0 */ \ @@ -144,14 +144,14 @@ "movq "PADDR2A", %%mm1\n\t" /* our pixel2 value */ \ "movq "PADDR1B", %%mm2\n\t" /* our 4 pixels */ \ "movq "PADDR2B", %%mm3\n\t" /* our pixel2 value */ \ - V_PAVGB("%%mm0", "%%mm2", "%%mm2", _ShiftMask) \ - V_PAVGB("%%mm1", "%%mm3", "%%mm3", _ShiftMask) \ + V_PAVGB("%%mm0", "%%mm2", "%%mm2", MANGLE(ShiftMask)) \ + V_PAVGB("%%mm1", "%%mm3", "%%mm3", MANGLE(ShiftMask)) \ "movq %%mm0, %%mm2\n\t" /* another copy of our pixel1 value */ \ "movq %%mm1, %%mm3\n\t" /* another copy of our pixel1 value */ \ "psubusb %%mm1, %%mm2\n\t" \ "psubusb %%mm0, %%mm3\n\t" \ "por %%mm3, %%mm2\n\t" \ - V_PAVGB("%%mm0", "%%mm1", "%%mm3", _ShiftMask) /* avg of 2 pixels */ \ + V_PAVGB("%%mm0", "%%mm1", "%%mm3", MANGLE(ShiftMask)) /* avg of 2 pixels */ \ "movq %%mm2, %%mm3\n\t" /* another copy of our our weights */ \ "pxor %%mm1, %%mm1\n\t" \ "psubusb %%mm7, %%mm3\n\t" /* nonzero where old weights lower, else 0 */ \ @@ -164,7 +164,7 @@ "por %%mm0, %%mm5\n\t" /* and merge new & old vals */ \ "por %%mm2, %%mm7\n\t" -#define RESET_CHROMA "por "_UVMask", %%mm7\n\t" +#define RESET_CHROMA "por "MANGLE(UVMask)", %%mm7\n\t" #endif -- cgit v1.2.3 From 15fe686025e855b0d7fd0c3a9b72730088b7191e Mon Sep 17 00:00:00 2001 From: Miguel Freitas <miguelfreitas@users.sourceforge.net> Date: Sun, 28 Jan 2007 17:17:56 +0000 Subject: disabled "-Wl,-z,defs": it breaks compilation for vidix drivers. no, linking twice to libdha.a is not an acceptable solution. CVS patchset: 8571 CVS date: 2007/01/28 17:17:56 --- src/video_out/vidix/drivers/Makefile.am | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/video_out/vidix/drivers/Makefile.am b/src/video_out/vidix/drivers/Makefile.am index ad270bca9..3c0369af7 100644 --- a/src/video_out/vidix/drivers/Makefile.am +++ b/src/video_out/vidix/drivers/Makefile.am @@ -23,54 +23,42 @@ endif lib_LTLIBRARIES = $(vidix_drivers) radeon_vid_la_SOURCES = radeon_vid.c -radeon_vid_la_LIBADD = $(top_builddir)/src/video_out/libdha/libdha.la radeon_vid_la_LDFLAGS = -avoid-version -module -lm rage128_vid_la_SOURCES = radeon_vid.c -rage128_vid_la_LIBADD = $(top_builddir)/src/video_out/libdha/libdha.la rage128_vid_la_LDFLAGS = -avoid-version -module -lm rage128_vid_la_CFLAGS = -DRAGE128 $(AM_CFLAGS) pm2_vid_la_SOURCES = pm2_vid.c -pm2_vid_la_LIBADD = $(top_builddir)/src/video_out/libdha/libdha.la pm2_vid_la_LDFLAGS = -avoid-version -module pm3_vid_la_SOURCES = pm3_vid.c -pm3_vid_la_LIBADD = $(top_builddir)/src/video_out/libdha/libdha.la pm3_vid_la_LDFLAGS = -avoid-version -module mach64_vid_la_SOURCES = mach64_vid.c -mach64_vid_la_LIBADD = $(top_builddir)/src/video_out/libdha/libdha.la mach64_vid_la_LDFLAGS = -avoid-version -module mga_vid_la_SOURCES = mga_vid.c -mga_vid_la_LIBADD = -lm $(top_builddir)/src/video_out/libdha/libdha.la -mga_vid_la_LDFLAGS = -avoid-version -module +mga_vid_la_LDFLAGS = -avoid-version -module -lm mga_crtc2_vid_la_SOURCES = mga_vid.c -mga_crtc2_vid_la_LIBADD = -lm $(top_builddir)/src/video_out/libdha/libdha.la -mga_crtc2_vid_la_LDFLAGS = -avoid-version -module +mga_crtc2_vid_la_LDFLAGS = -avoid-version -module -lm mga_crtc2_vid_la_CFLAGS = -DCRTC2 $(AM_CFLAGS) cyberblade_vid_la_SOURCES = cyberblade_vid.c -cyberblade_vid_la_LIBADD = $(top_builddir)/src/video_out/libdha/libdha.la cyberblade_vid_la_LDFLAGS = -avoid-version -module unichrome_vid_la_SOURCES = unichrome_vid.c -unichrome_vid_la_LIBADD = $(top_builddir)/src/video_out/libdha/libdha.la unichrome_vid_la_LDFLAGS = -avoid-version -module nvidia_vid_la_SOURCES = nvidia_vid.c -nvidia_vid_la_LIBADD = $(top_builddir)/src/video_out/libdha/libdha.la nvidia_vid_la_LDFLAGS = -avoid-version -module sis_vid_la_SOURCES = sis_vid.c sis_bridge.c -sis_vid_la_LIBADD = $(top_builddir)/src/video_out/libdha/libdha.la sis_vid_la_LDFLAGS = -avoid-version -module savage_vid_la_SOURCES = savage_vid.c -savage_vid_la_LIBADD = -lm $(top_builddir)/src/video_out/libdha/libdha.la -savage_vid_la_LDFLAGS = -avoid-version -module +savage_vid_la_LDFLAGS = -avoid-version -module -lm noinst_HEADERS = mach64.h glint_regs.h pm3_regs.h radeon.h savage_regs.h \ cyberblade_regs.h unichrome_regs.h sis_defs.h sis_regs.h -- cgit v1.2.3 From 9add5e858c10b369eb44fe7ab618efb37eb3c585 Mon Sep 17 00:00:00 2001 From: Miguel Freitas <miguelfreitas@users.sourceforge.net> Date: Sun, 28 Jan 2007 17:35:01 +0000 Subject: some additional fixes in case "-Wl,-z,defs" gets enabled again. btw, i don't dislike checking undefined symbols at buildtime, i think it is a good idea to catch common errors. but 5.5MB of useless bloat on vidix drivers is not worth it. CVS patchset: 8572 CVS date: 2007/01/28 17:35:01 --- src/video_out/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index ecb6add29..45b5dac8c 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -118,7 +118,7 @@ xineplug_vo_out_opengl_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(MLIB_CFLAGS) xineplug_vo_out_opengl_la_LDFLAGS = -avoid-version -module xineplug_vo_out_syncfb_la_SOURCES = video_out_syncfb.c -xineplug_vo_out_syncfb_la_LIBADD = $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) +xineplug_vo_out_syncfb_la_LIBADD = $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_syncfb_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_vo_out_syncfb_la_LDFLAGS = -avoid-version -module @@ -133,7 +133,7 @@ xineplug_vo_out_pgx32_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_vo_out_pgx32_la_LDFLAGS = -avoid-version -module xineplug_vo_out_vidix_la_SOURCES = video_out_vidix.c $(X11OSD) -xineplug_vo_out_vidix_la_LIBADD = $(XINE_LIB) $(X_LIBS) -lXext \ +xineplug_vo_out_vidix_la_LIBADD = $(XINE_LIB) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 \ $(top_builddir)/src/video_out/vidix/libvidix.la $(THREAD_LIBS) xineplug_vo_out_vidix_la_CFLAGS = $(VISIBILITY_FLAG) $(VIDIX_CFLAGS) $(X_CFLAGS) -fno-strict-aliasing xineplug_vo_out_vidix_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From 7c3728d769962d288b73cc945c3143ae68726984 Mon Sep 17 00:00:00 2001 From: Miguel Freitas <miguelfreitas@users.sourceforge.net> Date: Sun, 28 Jan 2007 18:38:32 +0000 Subject: another ffmpeg sync to include h264 security fixes CVS patchset: 8573 CVS date: 2007/01/28 18:38:32 --- src/libffmpeg/audio_decoder.c | 5 +- src/libffmpeg/libavcodec/adpcm.c | 10 +- src/libffmpeg/libavcodec/alac.c | 12 +- src/libffmpeg/libavcodec/armv4l/mpegvideo_arm.c | 3 + src/libffmpeg/libavcodec/avcodec.h | 373 ++++++++++++------------ src/libffmpeg/libavcodec/avs.c | 4 +- src/libffmpeg/libavcodec/bytestream.h | 4 +- src/libffmpeg/libavcodec/cabac.h | 22 +- src/libffmpeg/libavcodec/cinepak.c | 20 +- src/libffmpeg/libavcodec/cook.c | 114 ++++++-- src/libffmpeg/libavcodec/dpcm.c | 10 +- src/libffmpeg/libavcodec/dv.c | 9 +- src/libffmpeg/libavcodec/dvdata.h | 6 +- src/libffmpeg/libavcodec/eval.c | 2 +- src/libffmpeg/libavcodec/flac.c | 14 +- src/libffmpeg/libavcodec/flashsv.c | 20 +- src/libffmpeg/libavcodec/flicvideo.c | 48 +-- src/libffmpeg/libavcodec/fraps.c | 8 +- src/libffmpeg/libavcodec/h263.c | 4 + src/libffmpeg/libavcodec/h263dec.c | 2 +- src/libffmpeg/libavcodec/h264.c | 256 +++++++++++----- src/libffmpeg/libavcodec/i386/idct_mmx.c | 2 +- src/libffmpeg/libavcodec/imgconvert.c | 51 ++-- src/libffmpeg/libavcodec/imgresample.c | 2 + src/libffmpeg/libavcodec/kmvc.c | 4 +- src/libffmpeg/libavcodec/loco.c | 8 +- src/libffmpeg/libavcodec/lzo.c | 74 ++++- src/libffmpeg/libavcodec/lzo.h | 4 +- src/libffmpeg/libavcodec/mjpeg.c | 4 +- src/libffmpeg/libavcodec/mmvideo.c | 4 +- src/libffmpeg/libavcodec/mpeg12.c | 4 + src/libffmpeg/libavcodec/mpegvideo.c | 40 +-- src/libffmpeg/libavcodec/msvideo1.c | 16 +- src/libffmpeg/libavcodec/nuv.c | 4 +- src/libffmpeg/libavcodec/opt.c | 48 +-- src/libffmpeg/libavcodec/opt.h | 18 +- src/libffmpeg/libavcodec/parser.c | 91 ++++-- src/libffmpeg/libavcodec/pcm.c | 4 +- src/libffmpeg/libavcodec/ppc/dsputil_altivec.c | 6 +- src/libffmpeg/libavcodec/ppc/float_altivec.c | 3 +- src/libffmpeg/libavcodec/qdm2.c | 16 +- src/libffmpeg/libavcodec/qdrw.c | 6 +- src/libffmpeg/libavcodec/qtrle.c | 34 +-- src/libffmpeg/libavcodec/rangecoder.c | 30 +- src/libffmpeg/libavcodec/rpza.c | 10 +- src/libffmpeg/libavcodec/rv10.c | 2 +- src/libffmpeg/libavcodec/smacker.c | 10 +- src/libffmpeg/libavcodec/smc.c | 6 +- src/libffmpeg/libavcodec/snow.c | 62 ++-- src/libffmpeg/libavcodec/svq3.c | 7 +- src/libffmpeg/libavcodec/truemotion1.c | 6 +- src/libffmpeg/libavcodec/truemotion2.c | 16 +- src/libffmpeg/libavcodec/truespeech.c | 16 +- src/libffmpeg/libavcodec/tscc.c | 8 +- src/libffmpeg/libavcodec/utils.c | 32 +- src/libffmpeg/libavcodec/vc1.c | 41 ++- src/libffmpeg/libavcodec/vmdav.c | 14 +- src/libffmpeg/libavcodec/vp3.c | 2 - src/libffmpeg/libavcodec/vp56.h | 3 + src/libffmpeg/libavcodec/vp6.c | 43 ++- src/libffmpeg/libavcodec/vqavideo.c | 30 +- src/libffmpeg/libavcodec/wavpack.c | 28 +- src/libffmpeg/libavcodec/ws-snd1.c | 4 +- src/libffmpeg/libavcodec/xan.c | 10 +- src/libffmpeg/libavcodec/xl.c | 2 +- src/libffmpeg/libavcodec/zmbv.c | 6 +- src/libffmpeg/libavutil/avutil.h | 4 +- src/libffmpeg/libavutil/common.h | 2 +- src/libffmpeg/libavutil/intreadwrite.h | 35 ++- src/libffmpeg/libavutil/log.c | 2 +- src/libffmpeg/libavutil/log.h | 40 +++ 71 files changed, 1110 insertions(+), 750 deletions(-) (limited to 'src') diff --git a/src/libffmpeg/audio_decoder.c b/src/libffmpeg/audio_decoder.c index 8f0425775..7ab1f56b4 100644 --- a/src/libffmpeg/audio_decoder.c +++ b/src/libffmpeg/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.32 2007/01/13 21:19:52 miguelfreitas Exp $ + * $Id: audio_decoder.c,v 1.33 2007/01/28 18:38:33 miguelfreitas Exp $ * * xine audio decoder plugin using ffmpeg * @@ -291,7 +291,8 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) offset = 0; while (this->size>0) { - bytes_consumed = avcodec_decode_audio (this->context, + decode_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE; + bytes_consumed = avcodec_decode_audio2 (this->context, (int16_t *)this->decode_buffer, &decode_buffer_size, &this->buf[offset], diff --git a/src/libffmpeg/libavcodec/adpcm.c b/src/libffmpeg/libavcodec/adpcm.c index ec3fe6f6e..9be4c2274 100644 --- a/src/libffmpeg/libavcodec/adpcm.c +++ b/src/libffmpeg/libavcodec/adpcm.c @@ -1100,19 +1100,19 @@ static int adpcm_decode_frame(AVCodecContext *avctx, } break; case CODEC_ID_ADPCM_EA: - samples_in_chunk = LE_32(src); + samples_in_chunk = AV_RL32(src); if (samples_in_chunk >= ((buf_size - 12) * 2)) { src += buf_size; break; } src += 4; - current_left_sample = (int16_t)LE_16(src); + current_left_sample = (int16_t)AV_RL16(src); src += 2; - previous_left_sample = (int16_t)LE_16(src); + previous_left_sample = (int16_t)AV_RL16(src); src += 2; - current_right_sample = (int16_t)LE_16(src); + current_right_sample = (int16_t)AV_RL16(src); src += 2; - previous_right_sample = (int16_t)LE_16(src); + previous_right_sample = (int16_t)AV_RL16(src); src += 2; for (count1 = 0; count1 < samples_in_chunk/28;count1++) { diff --git a/src/libffmpeg/libavcodec/alac.c b/src/libffmpeg/libavcodec/alac.c index 793f71a11..cc87c81e5 100644 --- a/src/libffmpeg/libavcodec/alac.c +++ b/src/libffmpeg/libavcodec/alac.c @@ -110,11 +110,11 @@ static int alac_set_info(ALACContext *alac) ptr += 4; /* alac */ ptr += 4; /* 0 ? */ - if(BE_32(ptr) >= UINT_MAX/4){ + if(AV_RB32(ptr) >= UINT_MAX/4){ av_log(alac->avctx, AV_LOG_ERROR, "setinfo_max_samples_per_frame too large\n"); return -1; } - alac->setinfo_max_samples_per_frame = BE_32(ptr); /* buffer size / 2 ? */ + alac->setinfo_max_samples_per_frame = AV_RB32(ptr); /* buffer size / 2 ? */ ptr += 4; alac->setinfo_7a = *ptr++; alac->setinfo_sample_size = *ptr++; @@ -122,13 +122,13 @@ static int alac_set_info(ALACContext *alac) alac->setinfo_rice_initialhistory = *ptr++; alac->setinfo_rice_kmodifier = *ptr++; alac->setinfo_7f = *ptr++; // channels? - alac->setinfo_80 = BE_16(ptr); + alac->setinfo_80 = AV_RB16(ptr); ptr += 2; - alac->setinfo_82 = BE_32(ptr); // max coded frame size + alac->setinfo_82 = AV_RB32(ptr); // max coded frame size ptr += 4; - alac->setinfo_86 = BE_32(ptr); // bitrate ? + alac->setinfo_86 = AV_RB32(ptr); // bitrate ? ptr += 4; - alac->setinfo_8a_rate = BE_32(ptr); // samplerate + alac->setinfo_8a_rate = AV_RB32(ptr); // samplerate ptr += 4; allocate_buffers(alac); diff --git a/src/libffmpeg/libavcodec/armv4l/mpegvideo_arm.c b/src/libffmpeg/libavcodec/armv4l/mpegvideo_arm.c index 10a005cd3..ca972e6ed 100644 --- a/src/libffmpeg/libavcodec/armv4l/mpegvideo_arm.c +++ b/src/libffmpeg/libavcodec/armv4l/mpegvideo_arm.c @@ -24,10 +24,13 @@ #include "../avcodec.h" extern void MPV_common_init_iwmmxt(MpegEncContext *s); +extern void MPV_common_init_armv5te(MpegEncContext *s); void MPV_common_init_armv4l(MpegEncContext *s) { #ifdef HAVE_IWMMXT MPV_common_init_iwmmxt(s); +#elif defined(HAVE_ARMV5TE) + MPV_common_init_armv5te(s); #endif } diff --git a/src/libffmpeg/libavcodec/avcodec.h b/src/libffmpeg/libavcodec/avcodec.h index 7d7678455..ee4eb0122 100644 --- a/src/libffmpeg/libavcodec/avcodec.h +++ b/src/libffmpeg/libavcodec/avcodec.h @@ -37,8 +37,8 @@ extern "C" { #define AV_STRINGIFY(s) AV_TOSTRING(s) #define AV_TOSTRING(s) #s -#define LIBAVCODEC_VERSION_INT ((51<<16)+(28<<8)+0) -#define LIBAVCODEC_VERSION 51.28.0 +#define LIBAVCODEC_VERSION_INT ((51<<16)+(29<<8)+0) +#define LIBAVCODEC_VERSION 51.29.0 #define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT #define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) @@ -872,7 +872,7 @@ typedef struct AVCodecContext { int qmax; /** - * maximum quantizer difference etween frames. + * maximum quantizer difference between frames. * - encoding: set by user. * - decoding: unused */ @@ -2150,242 +2150,244 @@ typedef struct AVSubtitle { } AVSubtitle; extern AVCodec ac3_encoder; -extern AVCodec mp2_encoder; -extern AVCodec mp3lame_encoder; -extern AVCodec oggvorbis_encoder; +extern AVCodec amr_nb_encoder; +extern AVCodec amr_wb_encoder; +extern AVCodec asv1_encoder; +extern AVCodec asv2_encoder; +extern AVCodec dvvideo_encoder; extern AVCodec faac_encoder; +extern AVCodec ffv1_encoder; +extern AVCodec ffvhuff_encoder; extern AVCodec flac_encoder; +extern AVCodec flashsv_encoder; +extern AVCodec flv_encoder; extern AVCodec gif_encoder; -extern AVCodec xvid_encoder; -extern AVCodec mpeg1video_encoder; -extern AVCodec mpeg2video_encoder; extern AVCodec h261_encoder; extern AVCodec h263_encoder; extern AVCodec h263p_encoder; -extern AVCodec flv_encoder; -extern AVCodec rv10_encoder; -extern AVCodec rv20_encoder; -extern AVCodec dvvideo_encoder; -extern AVCodec mjpeg_encoder; -extern AVCodec ljpeg_encoder; +extern AVCodec h264_encoder; +extern AVCodec huffyuv_encoder; extern AVCodec jpegls_encoder; -extern AVCodec png_encoder; -extern AVCodec ppm_encoder; -extern AVCodec pgm_encoder; -extern AVCodec pgmyuv_encoder; -extern AVCodec pbm_encoder; -extern AVCodec pam_encoder; +extern AVCodec libgsm_encoder; +extern AVCodec libtheora_encoder; +extern AVCodec ljpeg_encoder; +extern AVCodec mdec_encoder; +extern AVCodec mjpeg_encoder; +extern AVCodec mp2_encoder; +extern AVCodec mp3lame_encoder; +extern AVCodec mpeg1video_encoder; +extern AVCodec mpeg2video_encoder; extern AVCodec mpeg4_encoder; extern AVCodec msmpeg4v1_encoder; extern AVCodec msmpeg4v2_encoder; extern AVCodec msmpeg4v3_encoder; -extern AVCodec wmv1_encoder; -extern AVCodec wmv2_encoder; -extern AVCodec huffyuv_encoder; -extern AVCodec ffvhuff_encoder; -extern AVCodec h264_encoder; -extern AVCodec asv1_encoder; -extern AVCodec asv2_encoder; -extern AVCodec vcr1_encoder; -extern AVCodec ffv1_encoder; +extern AVCodec oggvorbis_encoder; +extern AVCodec pam_encoder; +extern AVCodec pbm_encoder; +extern AVCodec pgm_encoder; +extern AVCodec pgmyuv_encoder; +extern AVCodec png_encoder; +extern AVCodec ppm_encoder; +extern AVCodec rv10_encoder; +extern AVCodec rv20_encoder; extern AVCodec snow_encoder; -extern AVCodec vorbis_encoder; -extern AVCodec mdec_encoder; -extern AVCodec zlib_encoder; extern AVCodec sonic_encoder; extern AVCodec sonic_ls_encoder; extern AVCodec svq1_encoder; +extern AVCodec vcr1_encoder; +extern AVCodec vorbis_encoder; +extern AVCodec wmv1_encoder; +extern AVCodec wmv2_encoder; extern AVCodec x264_encoder; +extern AVCodec xvid_encoder; +extern AVCodec zlib_encoder; +extern AVCodec zmbv_encoder; +extern AVCodec aac_decoder; +extern AVCodec aasc_decoder; +extern AVCodec alac_decoder; +extern AVCodec amr_nb_decoder; +extern AVCodec amr_wb_decoder; +extern AVCodec asv1_decoder; +extern AVCodec asv2_decoder; +extern AVCodec avs_decoder; +extern AVCodec bmp_decoder; +extern AVCodec cavs_decoder; +extern AVCodec cinepak_decoder; +extern AVCodec cljr_decoder; +extern AVCodec cook_decoder; +extern AVCodec cscd_decoder; +extern AVCodec cyuv_decoder; +extern AVCodec dsicinaudio_decoder; +extern AVCodec dsicinvideo_decoder; +extern AVCodec dvvideo_decoder; +extern AVCodec eightbps_decoder; +extern AVCodec ffv1_decoder; +extern AVCodec ffvhuff_decoder; +extern AVCodec flac_decoder; +extern AVCodec flashsv_decoder; +extern AVCodec flic_decoder; +extern AVCodec flv_decoder; +extern AVCodec fourxm_decoder; +extern AVCodec fraps_decoder; extern AVCodec gif_decoder; -extern AVCodec h263_decoder; extern AVCodec h261_decoder; -extern AVCodec mpeg4_decoder; -extern AVCodec msmpeg4v1_decoder; -extern AVCodec msmpeg4v2_decoder; -extern AVCodec msmpeg4v3_decoder; -extern AVCodec wmv1_decoder; -extern AVCodec wmv2_decoder; -extern AVCodec vc1_decoder; -extern AVCodec wmv3_decoder; -extern AVCodec mpeg1video_decoder; -extern AVCodec mpeg2video_decoder; -extern AVCodec mpegvideo_decoder; -extern AVCodec mpeg_xvmc_decoder; +extern AVCodec h263_decoder; extern AVCodec h263i_decoder; -extern AVCodec flv_decoder; -extern AVCodec rv10_decoder; -extern AVCodec rv20_decoder; -extern AVCodec rv30_decoder; -extern AVCodec rv40_decoder; -extern AVCodec svq1_decoder; -extern AVCodec svq3_decoder; -extern AVCodec dvvideo_decoder; -extern AVCodec wmav1_decoder; -extern AVCodec wmav2_decoder; +extern AVCodec h264_decoder; +extern AVCodec huffyuv_decoder; +extern AVCodec idcin_decoder; +extern AVCodec imc_decoder; +extern AVCodec indeo2_decoder; +extern AVCodec indeo3_decoder; +extern AVCodec interplay_dpcm_decoder; +extern AVCodec interplay_video_decoder; +extern AVCodec kmvc_decoder; +extern AVCodec libgsm_decoder; +extern AVCodec loco_decoder; +extern AVCodec mace3_decoder; +extern AVCodec mace6_decoder; +extern AVCodec mdec_decoder; extern AVCodec mjpeg_decoder; extern AVCodec mjpegb_decoder; -extern AVCodec sp5x_decoder; -extern AVCodec png_decoder; +extern AVCodec mmvideo_decoder; extern AVCodec mp2_decoder; extern AVCodec mp3_decoder; extern AVCodec mp3adu_decoder; extern AVCodec mp3on4_decoder; -extern AVCodec qdm2_decoder; -extern AVCodec cook_decoder; -extern AVCodec truespeech_decoder; -extern AVCodec tta_decoder; -extern AVCodec mace3_decoder; -extern AVCodec mace6_decoder; -extern AVCodec huffyuv_decoder; -extern AVCodec ffvhuff_decoder; -extern AVCodec oggvorbis_decoder; -extern AVCodec cyuv_decoder; -extern AVCodec h264_decoder; -extern AVCodec indeo3_decoder; -extern AVCodec vp3_decoder; -extern AVCodec theora_decoder; -extern AVCodec vp5_decoder; -extern AVCodec vp6_decoder; -extern AVCodec vp6f_decoder; -extern AVCodec amr_nb_decoder; -extern AVCodec amr_nb_encoder; -extern AVCodec amr_wb_encoder; -extern AVCodec amr_wb_decoder; -extern AVCodec aac_decoder; +extern AVCodec mpc7_decoder; +extern AVCodec mpeg1video_decoder; +extern AVCodec mpeg2video_decoder; +extern AVCodec mpeg4_decoder; extern AVCodec mpeg4aac_decoder; -extern AVCodec asv1_decoder; -extern AVCodec asv2_decoder; -extern AVCodec vcr1_decoder; -extern AVCodec cljr_decoder; -extern AVCodec ffv1_decoder; -extern AVCodec snow_decoder; -extern AVCodec fourxm_decoder; -extern AVCodec mdec_decoder; -extern AVCodec roq_decoder; -extern AVCodec interplay_video_decoder; -extern AVCodec xan_wc3_decoder; -extern AVCodec rpza_decoder; -extern AVCodec cinepak_decoder; +extern AVCodec mpeg_xvmc_decoder; +extern AVCodec mpegvideo_decoder; +extern AVCodec msmpeg4v1_decoder; +extern AVCodec msmpeg4v2_decoder; +extern AVCodec msmpeg4v3_decoder; extern AVCodec msrle_decoder; extern AVCodec msvideo1_decoder; -extern AVCodec vqa_decoder; -extern AVCodec idcin_decoder; -extern AVCodec eightbps_decoder; -extern AVCodec smc_decoder; -extern AVCodec flic_decoder; -extern AVCodec vmdvideo_decoder; -extern AVCodec vmdaudio_decoder; -extern AVCodec truemotion1_decoder; -extern AVCodec truemotion2_decoder; extern AVCodec mszh_decoder; -extern AVCodec zlib_decoder; +extern AVCodec nuv_decoder; +extern AVCodec oggvorbis_decoder; +extern AVCodec png_decoder; +extern AVCodec qdm2_decoder; +extern AVCodec qdraw_decoder; +extern AVCodec qpeg_decoder; +extern AVCodec qtrle_decoder; extern AVCodec ra_144_decoder; extern AVCodec ra_288_decoder; +extern AVCodec roq_decoder; extern AVCodec roq_dpcm_decoder; -extern AVCodec interplay_dpcm_decoder; -extern AVCodec xan_dpcm_decoder; +extern AVCodec rpza_decoder; +extern AVCodec rv10_decoder; +extern AVCodec rv20_decoder; +extern AVCodec rv30_decoder; +extern AVCodec rv40_decoder; +extern AVCodec shorten_decoder; +extern AVCodec smackaud_decoder; +extern AVCodec smacker_decoder; +extern AVCodec smc_decoder; +extern AVCodec snow_decoder; extern AVCodec sol_dpcm_decoder; extern AVCodec sonic_decoder; -extern AVCodec qtrle_decoder; -extern AVCodec flac_decoder; +extern AVCodec sp5x_decoder; +extern AVCodec svq1_decoder; +extern AVCodec svq3_decoder; +extern AVCodec targa_decoder; +extern AVCodec theora_decoder; +extern AVCodec tiertexseqvideo_decoder; +extern AVCodec tiff_decoder; +extern AVCodec truemotion1_decoder; +extern AVCodec truemotion2_decoder; +extern AVCodec truespeech_decoder; extern AVCodec tscc_decoder; -extern AVCodec cscd_decoder; -extern AVCodec nuv_decoder; +extern AVCodec tta_decoder; extern AVCodec ulti_decoder; -extern AVCodec qdraw_decoder; -extern AVCodec xl_decoder; -extern AVCodec qpeg_decoder; -extern AVCodec shorten_decoder; -extern AVCodec loco_decoder; +extern AVCodec vc1_decoder; +extern AVCodec vcr1_decoder; +extern AVCodec vmdaudio_decoder; +extern AVCodec vmdvideo_decoder; +extern AVCodec vmnc_decoder; +extern AVCodec vorbis_decoder; +extern AVCodec vp3_decoder; +extern AVCodec vp5_decoder; +extern AVCodec vp6_decoder; +extern AVCodec vp6f_decoder; +extern AVCodec vqa_decoder; +extern AVCodec wavpack_decoder; +extern AVCodec wmav1_decoder; +extern AVCodec wmav2_decoder; +extern AVCodec wmv1_decoder; +extern AVCodec wmv2_decoder; +extern AVCodec wmv3_decoder; extern AVCodec wnv1_decoder; -extern AVCodec aasc_decoder; -extern AVCodec alac_decoder; extern AVCodec ws_snd1_decoder; -extern AVCodec indeo2_decoder; -extern AVCodec vorbis_decoder; -extern AVCodec fraps_decoder; -extern AVCodec libgsm_encoder; -extern AVCodec libgsm_decoder; -extern AVCodec bmp_decoder; -extern AVCodec mmvideo_decoder; +extern AVCodec xan_dpcm_decoder; +extern AVCodec xan_wc3_decoder; +extern AVCodec xl_decoder; +extern AVCodec zlib_decoder; extern AVCodec zmbv_decoder; -extern AVCodec zmbv_encoder; -extern AVCodec avs_decoder; -extern AVCodec smacker_decoder; -extern AVCodec smackaud_decoder; -extern AVCodec kmvc_decoder; -extern AVCodec flashsv_decoder; -extern AVCodec cavs_decoder; -extern AVCodec vmnc_decoder; -extern AVCodec wavpack_decoder; -extern AVCodec targa_decoder; -extern AVCodec dsicinvideo_decoder; -extern AVCodec dsicinaudio_decoder; -extern AVCodec tiertexseqvideo_decoder; -extern AVCodec tiff_decoder; -extern AVCodec imc_decoder; -extern AVCodec mpc7_decoder; /* pcm codecs */ #define PCM_CODEC(id, name) \ extern AVCodec name ## _decoder; \ extern AVCodec name ## _encoder -PCM_CODEC(CODEC_ID_PCM_S32LE, pcm_s32le); -PCM_CODEC(CODEC_ID_PCM_S32BE, pcm_s32be); -PCM_CODEC(CODEC_ID_PCM_U32LE, pcm_u32le); -PCM_CODEC(CODEC_ID_PCM_U32BE, pcm_u32be); -PCM_CODEC(CODEC_ID_PCM_S24LE, pcm_s24le); -PCM_CODEC(CODEC_ID_PCM_S24BE, pcm_s24be); -PCM_CODEC(CODEC_ID_PCM_U24LE, pcm_u24le); -PCM_CODEC(CODEC_ID_PCM_U24BE, pcm_u24be); +PCM_CODEC(CODEC_ID_PCM_ALAW, pcm_alaw); +PCM_CODEC(CODEC_ID_PCM_MULAW, pcm_mulaw); +PCM_CODEC(CODEC_ID_PCM_S8, pcm_s8); +PCM_CODEC(CODEC_ID_PCM_S16BE, pcm_s16be); +PCM_CODEC(CODEC_ID_PCM_S16LE, pcm_s16le); +PCM_CODEC(CODEC_ID_PCM_S24BE, pcm_s24be); PCM_CODEC(CODEC_ID_PCM_S24DAUD, pcm_s24daud); -PCM_CODEC(CODEC_ID_PCM_S16LE, pcm_s16le); -PCM_CODEC(CODEC_ID_PCM_S16BE, pcm_s16be); -PCM_CODEC(CODEC_ID_PCM_U16LE, pcm_u16le); -PCM_CODEC(CODEC_ID_PCM_U16BE, pcm_u16be); -PCM_CODEC(CODEC_ID_PCM_S8, pcm_s8); -PCM_CODEC(CODEC_ID_PCM_U8, pcm_u8); -PCM_CODEC(CODEC_ID_PCM_ALAW, pcm_alaw); -PCM_CODEC(CODEC_ID_PCM_MULAW, pcm_mulaw); +PCM_CODEC(CODEC_ID_PCM_S24LE, pcm_s24le); +PCM_CODEC(CODEC_ID_PCM_S32BE, pcm_s32be); +PCM_CODEC(CODEC_ID_PCM_S32LE, pcm_s32le); +PCM_CODEC(CODEC_ID_PCM_U8, pcm_u8); +PCM_CODEC(CODEC_ID_PCM_U16BE, pcm_u16be); +PCM_CODEC(CODEC_ID_PCM_U16LE, pcm_u16le); +PCM_CODEC(CODEC_ID_PCM_U24BE, pcm_u24be); +PCM_CODEC(CODEC_ID_PCM_U24LE, pcm_u24le); +PCM_CODEC(CODEC_ID_PCM_U32BE, pcm_u32be); +PCM_CODEC(CODEC_ID_PCM_U32LE, pcm_u32le); /* adpcm codecs */ -PCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt); -PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav); +PCM_CODEC(CODEC_ID_ADPCM_4XM, adpcm_4xm); +PCM_CODEC(CODEC_ID_ADPCM_ADX, adpcm_adx); +PCM_CODEC(CODEC_ID_ADPCM_CT, adpcm_ct); +PCM_CODEC(CODEC_ID_ADPCM_EA, adpcm_ea); +PCM_CODEC(CODEC_ID_ADPCM_G726, adpcm_g726); PCM_CODEC(CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3); PCM_CODEC(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4); -PCM_CODEC(CODEC_ID_ADPCM_IMA_WS, adpcm_ima_ws); -PCM_CODEC(CODEC_ID_ADPCM_SMJPEG, adpcm_ima_smjpeg); -PCM_CODEC(CODEC_ID_ADPCM_MS, adpcm_ms); -PCM_CODEC(CODEC_ID_ADPCM_4XM, adpcm_4xm); -PCM_CODEC(CODEC_ID_ADPCM_XA, adpcm_xa); -PCM_CODEC(CODEC_ID_ADPCM_ADX, adpcm_adx); -PCM_CODEC(CODEC_ID_ADPCM_EA, adpcm_ea); -PCM_CODEC(CODEC_ID_ADPCM_G726, adpcm_g726); -PCM_CODEC(CODEC_ID_ADPCM_CT, adpcm_ct); -PCM_CODEC(CODEC_ID_ADPCM_SWF, adpcm_swf); -PCM_CODEC(CODEC_ID_ADPCM_YAMAHA, adpcm_yamaha); -PCM_CODEC(CODEC_ID_ADPCM_SBPRO_4, adpcm_sbpro_4); -PCM_CODEC(CODEC_ID_ADPCM_SBPRO_3, adpcm_sbpro_3); +PCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt); +PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav); +PCM_CODEC(CODEC_ID_ADPCM_IMA_WS, adpcm_ima_ws); +PCM_CODEC(CODEC_ID_ADPCM_MS, adpcm_ms); PCM_CODEC(CODEC_ID_ADPCM_SBPRO_2, adpcm_sbpro_2); +PCM_CODEC(CODEC_ID_ADPCM_SBPRO_3, adpcm_sbpro_3); +PCM_CODEC(CODEC_ID_ADPCM_SBPRO_4, adpcm_sbpro_4); +PCM_CODEC(CODEC_ID_ADPCM_SMJPEG, adpcm_ima_smjpeg); +PCM_CODEC(CODEC_ID_ADPCM_SWF, adpcm_swf); +PCM_CODEC(CODEC_ID_ADPCM_XA, adpcm_xa); +PCM_CODEC(CODEC_ID_ADPCM_YAMAHA, adpcm_yamaha); #undef PCM_CODEC /* dummy raw video codec */ -extern AVCodec rawvideo_encoder; extern AVCodec rawvideo_decoder; +extern AVCodec rawvideo_encoder; /* the following codecs use external GPL libs */ extern AVCodec ac3_decoder; extern AVCodec dts_decoder; /* subtitles */ -extern AVCodec dvdsub_encoder; -extern AVCodec dvdsub_decoder; -extern AVCodec dvbsub_encoder; extern AVCodec dvbsub_decoder; +extern AVCodec dvbsub_encoder; +extern AVCodec dvdsub_decoder; +extern AVCodec dvdsub_encoder; /* resample.c */ @@ -2518,18 +2520,21 @@ int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, v */ int avcodec_open(AVCodecContext *avctx, AVCodec *codec); + +attribute_deprecated int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples, + int *frame_size_ptr, + uint8_t *buf, int buf_size); /** * Decode an audio frame. * * @param avctx the codec context. * @param samples output buffer, 16 byte aligned - * @param frame_size_ptr the output buffer size in bytes, zero if no frame could be compressed + * @param frame_size_ptr the output buffer size in bytes (you MUST set this to the allocated size before calling avcodec_decode_audio2()), zero if no frame could be compressed * @param buf input buffer, 16 byte aligned * @param buf_size the input buffer size * @return 0 if successful, -1 if not. */ - -int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples, +int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, uint8_t *buf, int buf_size); int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, @@ -2625,19 +2630,19 @@ int av_parser_change(AVCodecParserContext *s, const uint8_t *buf, int buf_size, int keyframe); void av_parser_close(AVCodecParserContext *s); -extern AVCodecParser mpegvideo_parser; -extern AVCodecParser mpeg4video_parser; +extern AVCodecParser aac_parser; +extern AVCodecParser ac3_parser; extern AVCodecParser cavsvideo_parser; +extern AVCodecParser dvbsub_parser; +extern AVCodecParser dvdsub_parser; extern AVCodecParser h261_parser; extern AVCodecParser h263_parser; extern AVCodecParser h264_parser; extern AVCodecParser mjpeg_parser; -extern AVCodecParser pnm_parser; +extern AVCodecParser mpeg4video_parser; extern AVCodecParser mpegaudio_parser; -extern AVCodecParser ac3_parser; -extern AVCodecParser dvdsub_parser; -extern AVCodecParser dvbsub_parser; -extern AVCodecParser aac_parser; +extern AVCodecParser mpegvideo_parser; +extern AVCodecParser pnm_parser; typedef struct AVBitStreamFilterContext { diff --git a/src/libffmpeg/libavcodec/avs.c b/src/libffmpeg/libavcodec/avs.c index 953aea1be..ebfa8adb7 100644 --- a/src/libffmpeg/libavcodec/avs.c +++ b/src/libffmpeg/libavcodec/avs.c @@ -74,8 +74,8 @@ avs_decode_frame(AVCodecContext * avctx, int first, last; uint32_t *pal = (uint32_t *) avs->picture.data[1]; - first = LE_16(buf); - last = first + LE_16(buf + 2); + first = AV_RL16(buf); + last = first + AV_RL16(buf + 2); buf += 4; for (i=first; i<last; i++, buf+=3) pal[i] = (buf[0] << 18) | (buf[1] << 10) | (buf[2] << 2); diff --git a/src/libffmpeg/libavcodec/bytestream.h b/src/libffmpeg/libavcodec/bytestream.h index a742fa1c1..ae5438b49 100644 --- a/src/libffmpeg/libavcodec/bytestream.h +++ b/src/libffmpeg/libavcodec/bytestream.h @@ -25,13 +25,13 @@ static av_always_inline unsigned int bytestream_get_le32(uint8_t **b) { (*b) += 4; - return LE_32(*b - 4); + return AV_RL32(*b - 4); } static av_always_inline unsigned int bytestream_get_le16(uint8_t **b) { (*b) += 2; - return LE_16(*b - 2); + return AV_RL16(*b - 2); } static av_always_inline unsigned int bytestream_get_byte(uint8_t **b) diff --git a/src/libffmpeg/libavcodec/cabac.h b/src/libffmpeg/libavcodec/cabac.h index f47406a9e..b990014f6 100644 --- a/src/libffmpeg/libavcodec/cabac.h +++ b/src/libffmpeg/libavcodec/cabac.h @@ -462,7 +462,7 @@ static int av_always_inline get_cabac_inline(CABACContext *c, uint8_t * const st #else /* BRANCHLESS_CABAC_DECODER */ -#if defined CMOV_IS_FAST +#if defined HAVE_FAST_CMOV #define BRANCHLESS_GET_CABAC_UPDATE(ret, cabac, statep, low, lowword, range, tmp, tmpbyte)\ "mov "tmp" , %%ecx \n\t"\ "shl $17 , "tmp" \n\t"\ @@ -472,7 +472,7 @@ static int av_always_inline get_cabac_inline(CABACContext *c, uint8_t * const st "and %%ecx , "tmp" \n\t"\ "sub "tmp" , "low" \n\t"\ "xor %%ecx , "ret" \n\t" -#else /* CMOV_IS_FAST */ +#else /* HAVE_FAST_CMOV */ #define BRANCHLESS_GET_CABAC_UPDATE(ret, cabac, statep, low, lowword, range, tmp, tmpbyte)\ "mov "tmp" , %%ecx \n\t"\ "shl $17 , "tmp" \n\t"\ @@ -485,7 +485,7 @@ static int av_always_inline get_cabac_inline(CABACContext *c, uint8_t * const st "and "tmp" , %%ecx \n\t"\ "sub %%ecx , "low" \n\t"\ "xor "tmp" , "ret" \n\t" -#endif /* CMOV_IS_FAST */ +#endif /* HAVE_FAST_CMOV */ #define BRANCHLESS_GET_CABAC(ret, cabac, statep, low, lowword, range, tmp, tmpbyte)\ @@ -539,26 +539,26 @@ static int av_always_inline get_cabac_inline(CABACContext *c, uint8_t * const st c->range -= RangeLPS; #ifndef BRANCHLESS_CABAC_DECODER - if(c->low < (c->range<<17)){ + if(c->low < (c->range<<(CABAC_BITS+1))){ bit= s&1; *state= ff_h264_mps_state[s]; renorm_cabac_decoder_once(c); }else{ bit= ff_h264_norm_shift[RangeLPS]; - c->low -= (c->range<<17); + c->low -= (c->range<<(CABAC_BITS+1)); *state= ff_h264_lps_state[s]; c->range = RangeLPS<<bit; c->low <<= bit; bit= (s&1)^1; - if(!(c->low & 0xFFFF)){ + if(!(c->low & CABAC_MASK)){ refill2(c); } } #else /* BRANCHLESS_CABAC_DECODER */ - lps_mask= ((c->range<<17) - c->low)>>31; + lps_mask= ((c->range<<(CABAC_BITS+1)) - c->low)>>31; - c->low -= (c->range<<17) & lps_mask; + c->low -= (c->range<<(CABAC_BITS+1)) & lps_mask; c->range += (RangeLPS - c->range) & lps_mask; s^=lps_mask; @@ -620,7 +620,7 @@ static int get_cabac_bypass(CABACContext *c){ if(!(c->low & CABAC_MASK)) refill(c); - range= c->range<<17; + range= c->range<<(CABAC_BITS+1); if(c->low < range){ return 0; }else{ @@ -669,7 +669,7 @@ static av_always_inline int get_cabac_bypass_sign(CABACContext *c, int val){ if(!(c->low & CABAC_MASK)) refill(c); - range= c->range<<17; + range= c->range<<(CABAC_BITS+1); c->low -= range; mask= c->low >> 31; range &= mask; @@ -794,7 +794,7 @@ static int decode_significance_8x8_x86(CABACContext *c, uint8_t *significant_coe */ static int get_cabac_terminate(CABACContext *c){ c->range -= 2; - if(c->low < c->range<<17){ + if(c->low < c->range<<(CABAC_BITS+1)){ renorm_cabac_decoder_once(c); return 0; }else{ diff --git a/src/libffmpeg/libavcodec/cinepak.c b/src/libffmpeg/libavcodec/cinepak.c index fd95b739e..db0519b5d 100644 --- a/src/libffmpeg/libavcodec/cinepak.c +++ b/src/libffmpeg/libavcodec/cinepak.c @@ -90,7 +90,7 @@ static void cinepak_decode_codebook (cvid_codebook_t *codebook, if ((data + 4) > eod) break; - flag = BE_32 (data); + flag = AV_RB32 (data); data += 4; mask = 0x80000000; } @@ -152,7 +152,7 @@ static int cinepak_decode_vectors (CinepakContext *s, cvid_strip_t *strip, if ((data + 4) > eod) return -1; - flag = BE_32 (data); + flag = AV_RB32 (data); data += 4; mask = 0x80000000; } @@ -162,7 +162,7 @@ static int cinepak_decode_vectors (CinepakContext *s, cvid_strip_t *strip, if ((data + 4) > eod) return -1; - flag = BE_32 (data); + flag = AV_RB32 (data); data += 4; mask = 0x80000000; } @@ -278,8 +278,8 @@ static int cinepak_decode_strip (CinepakContext *s, return -1; while ((data + 4) <= eod) { - chunk_id = BE_16 (&data[0]); - chunk_size = BE_16 (&data[2]) - 4; + chunk_id = AV_RB16 (&data[0]); + chunk_size = AV_RB16 (&data[2]) - 4; if(chunk_size < 0) return -1; @@ -328,8 +328,8 @@ static int cinepak_decode (CinepakContext *s) return -1; frame_flags = s->data[0]; - num_strips = BE_16 (&s->data[8]); - encoded_buf_size = ((s->data[1] << 16) | BE_16 (&s->data[2])); + num_strips = AV_RB16 (&s->data[8]); + encoded_buf_size = ((s->data[1] << 16) | AV_RB16 (&s->data[2])); /* if this is the first frame, check for deviant Sega FILM data */ if (s->sega_film_skip_bytes == -1) { @@ -361,13 +361,13 @@ static int cinepak_decode (CinepakContext *s) if ((s->data + 12) > eod) return -1; - s->strips[i].id = BE_16 (s->data); + s->strips[i].id = AV_RB16 (s->data); s->strips[i].y1 = y0; s->strips[i].x1 = 0; - s->strips[i].y2 = y0 + BE_16 (&s->data[8]); + s->strips[i].y2 = y0 + AV_RB16 (&s->data[8]); s->strips[i].x2 = s->avctx->width; - strip_size = BE_16 (&s->data[2]) - 12; + strip_size = AV_RB16 (&s->data[2]) - 12; s->data += 12; strip_size = ((s->data + strip_size) > eod) ? (eod - s->data) : strip_size; diff --git a/src/libffmpeg/libavcodec/cook.c b/src/libffmpeg/libavcodec/cook.c index 943addb89..a5bd0a26a 100644 --- a/src/libffmpeg/libavcodec/cook.c +++ b/src/libffmpeg/libavcodec/cook.c @@ -54,8 +54,8 @@ #include "cookdata.h" /* the different Cook versions */ -#define MONO_COOK1 0x1000001 -#define MONO_COOK2 0x1000002 +#define MONO 0x1000001 +#define STEREO 0x1000002 #define JOINT_STEREO 0x1000003 #define MC_COOK 0x2000000 //multichannel Cook, not supported @@ -277,16 +277,30 @@ static int init_cook_mlt(COOKContext *q) { /** * Cook indata decoding, every 32 bits are XORed with 0x37c511f2. * Why? No idea, some checksum/error detection method maybe. + * + * Out buffer size: extra bytes are needed to cope with + * padding/missalignment. + * Subpackets passed to the decoder can contain two, consecutive + * half-subpackets, of identical but arbitrary size. + * 1234 1234 1234 1234 extraA extraB + * Case 1: AAAA BBBB 0 0 + * Case 2: AAAA ABBB BB-- 3 3 + * Case 3: AAAA AABB BBBB 2 2 + * Case 4: AAAA AAAB BBBB BB-- 1 5 + * * Nice way to waste CPU cycles. * - * @param in pointer to 32bit array of indata - * @param bits amount of bits - * @param out pointer to 32bit array of outdata + * @param inbuffer pointer to byte array of indata + * @param out pointer to byte array of outdata + * @param bytes number of bytes */ +#define DECODE_BYTES_PAD1(bytes) (3 - ((bytes)+3) % 4) +#define DECODE_BYTES_PAD2(bytes) ((bytes) % 4 + DECODE_BYTES_PAD1(2 * (bytes))) -static inline void decode_bytes(uint8_t* inbuffer, uint8_t* out, int bytes){ - int i; - uint32_t* buf = (uint32_t*) inbuffer; +static inline int decode_bytes(uint8_t* inbuffer, uint8_t* out, int bytes){ + int i, off; + uint32_t c; + uint32_t* buf; uint32_t* obuf = (uint32_t*) out; /* FIXME: 64 bit platforms would be able to do 64 bits at a time. * I'm too lazy though, should be something like @@ -294,14 +308,14 @@ static inline void decode_bytes(uint8_t* inbuffer, uint8_t* out, int bytes){ * (int64_t)out[i] = 0x37c511f237c511f2^be2me_64(int64_t)in[i]); * Buffer alignment needs to be checked. */ + off = (uint32_t)inbuffer % 4; + buf = (uint32_t*) (inbuffer - off); + c = be2me_32((0x37c511f2 >> (off*8)) | (0x37c511f2 << (32-(off*8)))); + bytes += 3 + off; + for (i = 0; i < bytes/4; i++) + obuf[i] = c ^ buf[i]; - for(i=0 ; i<bytes/4 ; i++){ -#ifdef WORDS_BIGENDIAN - obuf[i] = 0x37c511f2^buf[i]; -#else - obuf[i] = 0xf211c537^buf[i]; -#endif - } + return off; } /** @@ -947,6 +961,28 @@ static void joint_decode(COOKContext *q, float* mlt_buffer1, } } +/** + * First part of subpacket decoding: + * decode raw stream bytes and read gain info. + * + * @param q pointer to the COOKContext + * @param inbuffer pointer to raw stream data + * @param gain_ptr array of current/prev gain pointers + */ + +static inline void +decode_bytes_and_gain(COOKContext *q, uint8_t *inbuffer, COOKgain *gain_ptr) +{ + int offset; + + offset = decode_bytes(inbuffer, q->decoded_bytes_buffer, + q->bits_per_subpacket/8); + init_get_bits(&q->gb, q->decoded_bytes_buffer + offset, + q->bits_per_subpacket); + decode_gain_info(&q->gb, gain_ptr); +} + + /** * Cook subpacket decoding. This function returns one decoded subpacket, * usually 1024 samples per channel. @@ -970,11 +1006,9 @@ static int decode_subpacket(COOKContext *q, uint8_t *inbuffer, // } // av_log(NULL, AV_LOG_ERROR, "\n"); - decode_bytes(inbuffer, q->decoded_bytes_buffer, sub_packet_size); - init_get_bits(&q->gb, q->decoded_bytes_buffer, sub_packet_size*8); - decode_gain_info(&q->gb, &q->gain_current); - if(q->nb_channels==2 && q->joint_stereo==1){ + decode_bytes_and_gain(q, inbuffer, &q->gain_current); + joint_decode(q, q->decode_buf_ptr[0], q->decode_buf_ptr[2]); /* Swap buffer pointers. */ @@ -1014,6 +1048,8 @@ static int decode_subpacket(COOKContext *q, uint8_t *inbuffer, } else if (q->nb_channels==2 && q->joint_stereo==0) { /* channel 0 */ + decode_bytes_and_gain(q, inbuffer, &q->gain_current); + mono_decode(q, q->decode_buf_ptr2[0]); tmp_ptr = q->decode_buf_ptr2[0]; @@ -1035,17 +1071,17 @@ static int decode_subpacket(COOKContext *q, uint8_t *inbuffer, value = lrintf(q->mono_mdct_output[j]); if(value < -32768) value = -32768; else if(value > 32767) value = 32767; - outbuffer[2*j+1] = value; + outbuffer[2*j] = value; } /* channel 1 */ //av_log(NULL,AV_LOG_ERROR,"bits = %d\n",get_bits_count(&q->gb)); - init_get_bits(&q->gb, q->decoded_bytes_buffer, sub_packet_size*8+q->bits_per_subpacket); + decode_bytes_and_gain(q, inbuffer + sub_packet_size/2, + &q->gain_channel2[0]); q->gain_now_ptr = &q->gain_channel2[0]; q->gain_previous_ptr = &q->gain_channel2[1]; - decode_gain_info(&q->gb, &q->gain_channel2[0]); mono_decode(q, q->decode_buf_ptr[0]); tmp_ptr = q->decode_buf_ptr[0]; @@ -1067,10 +1103,12 @@ static int decode_subpacket(COOKContext *q, uint8_t *inbuffer, value = lrintf(q->mono_mdct_output[j]); if(value < -32768) value = -32768; else if(value > 32767) value = 32767; - outbuffer[2*j] = value; + outbuffer[2*j+1] = value; } } else { + decode_bytes_and_gain(q, inbuffer, &q->gain_current); + mono_decode(q, q->decode_buf_ptr[0]); /* Swap buffer pointers. */ @@ -1127,7 +1165,7 @@ static void dump_cook_context(COOKContext *q, COOKextradata *e) #define PRINT(a,b) av_log(NULL,AV_LOG_ERROR," %s = %d\n", a, b); av_log(NULL,AV_LOG_ERROR,"COOKextradata\n"); av_log(NULL,AV_LOG_ERROR,"cookversion=%x\n",e->cookversion); - if (e->cookversion > MONO_COOK2) { + if (e->cookversion > STEREO) { PRINT("js_subband_start",e->js_subband_start); PRINT("js_vlc_bits",e->js_vlc_bits); } @@ -1155,7 +1193,7 @@ static void dump_cook_context(COOKContext *q, COOKextradata *e) static int cook_decode_init(AVCodecContext *avctx) { - COOKextradata *e = avctx->extradata; + COOKextradata *e = (COOKextradata *)avctx->extradata; COOKContext *q = avctx->priv_data; /* Take care of the codec specific extradata. */ @@ -1199,19 +1237,19 @@ static int cook_decode_init(AVCodecContext *avctx) /* Initialize version-dependent variables */ av_log(NULL,AV_LOG_DEBUG,"e->cookversion=%x\n",e->cookversion); switch (e->cookversion) { - case MONO_COOK1: + case MONO: if (q->nb_channels != 1) { av_log(avctx,AV_LOG_ERROR,"Container channels != 1, report sample!\n"); return -1; } - av_log(avctx,AV_LOG_DEBUG,"MONO_COOK1\n"); + av_log(avctx,AV_LOG_DEBUG,"MONO\n"); break; - case MONO_COOK2: + case STEREO: if (q->nb_channels != 1) { q->joint_stereo = 0; q->bits_per_subpacket = q->bits_per_subpacket/2; } - av_log(avctx,AV_LOG_DEBUG,"MONO_COOK2\n"); + av_log(avctx,AV_LOG_DEBUG,"STEREO\n"); break; case JOINT_STEREO: if (q->nb_channels != 2) { @@ -1258,9 +1296,21 @@ static int cook_decode_init(AVCodecContext *avctx) if(avctx->block_align >= UINT_MAX/2) return -1; - /* Pad the databuffer with FF_INPUT_BUFFER_PADDING_SIZE, - this is for the bitstreamreader. */ - if ((q->decoded_bytes_buffer = av_mallocz((avctx->block_align+(4-avctx->block_align%4) + FF_INPUT_BUFFER_PADDING_SIZE)*sizeof(uint8_t))) == NULL) + /* Pad the databuffer with: + DECODE_BYTES_PAD1 or DECODE_BYTES_PAD2 for decode_bytes(), + FF_INPUT_BUFFER_PADDING_SIZE, for the bitstreamreader. */ + if (q->nb_channels==2 && q->joint_stereo==0) { + q->decoded_bytes_buffer = + av_mallocz(avctx->block_align/2 + + DECODE_BYTES_PAD2(avctx->block_align/2) + + FF_INPUT_BUFFER_PADDING_SIZE); + } else { + q->decoded_bytes_buffer = + av_mallocz(avctx->block_align + + DECODE_BYTES_PAD1(avctx->block_align) + + FF_INPUT_BUFFER_PADDING_SIZE); + } + if (q->decoded_bytes_buffer == NULL) return -1; q->decode_buf_ptr[0] = q->decode_buffer_1; diff --git a/src/libffmpeg/libavcodec/dpcm.c b/src/libffmpeg/libavcodec/dpcm.c index 99c0cac64..6243881de 100644 --- a/src/libffmpeg/libavcodec/dpcm.c +++ b/src/libffmpeg/libavcodec/dpcm.c @@ -179,7 +179,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, case CODEC_ID_ROQ_DPCM: if (s->channels == 1) - predictor[0] = LE_16(&buf[6]); + predictor[0] = AV_RL16(&buf[6]); else { predictor[0] = buf[7] << 8; predictor[1] = buf[6] << 8; @@ -200,12 +200,12 @@ static int dpcm_decode_frame(AVCodecContext *avctx, case CODEC_ID_INTERPLAY_DPCM: in = 6; /* skip over the stream mask and stream length */ - predictor[0] = LE_16(&buf[in]); + predictor[0] = AV_RL16(&buf[in]); in += 2; SE_16BIT(predictor[0]) output_samples[out++] = predictor[0]; if (s->channels == 2) { - predictor[1] = LE_16(&buf[in]); + predictor[1] = AV_RL16(&buf[in]); in += 2; SE_16BIT(predictor[1]) output_samples[out++] = predictor[1]; @@ -225,11 +225,11 @@ static int dpcm_decode_frame(AVCodecContext *avctx, case CODEC_ID_XAN_DPCM: in = 0; shift[0] = shift[1] = 4; - predictor[0] = LE_16(&buf[in]); + predictor[0] = AV_RL16(&buf[in]); in += 2; SE_16BIT(predictor[0]); if (s->channels == 2) { - predictor[1] = LE_16(&buf[in]); + predictor[1] = AV_RL16(&buf[in]); in += 2; SE_16BIT(predictor[1]); } diff --git a/src/libffmpeg/libavcodec/dv.c b/src/libffmpeg/libavcodec/dv.c index 803d3502d..505c88d49 100644 --- a/src/libffmpeg/libavcodec/dv.c +++ b/src/libffmpeg/libavcodec/dv.c @@ -1229,6 +1229,10 @@ static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size, static int dvvideo_close(AVCodecContext *c) { + DVVideoContext *s = c->priv_data; + + if(s->picture.data[0]) + c->release_buffer(c, &s->picture); return 0; } @@ -1242,10 +1246,7 @@ AVCodec dvvideo_encoder = { sizeof(DVVideoContext), dvvideo_init, dvvideo_encode_frame, - dvvideo_close, - NULL, - CODEC_CAP_DR1, - NULL + .pix_fmts = (enum PixelFormat[]) {PIX_FMT_YUV411P, PIX_FMT_YUV422P, PIX_FMT_YUV420P, -1}, }; #endif // CONFIG_DVVIDEO_ENCODER diff --git a/src/libffmpeg/libavcodec/dvdata.h b/src/libffmpeg/libavcodec/dvdata.h index dce4aba98..e688ffbb0 100644 --- a/src/libffmpeg/libavcodec/dvdata.h +++ b/src/libffmpeg/libavcodec/dvdata.h @@ -49,7 +49,7 @@ typedef struct DVprofile { /* for 48Khz, 44.1Khz and 32Khz */ int audio_samples_dist[5];/* how many samples are supposed to be */ /* in each frame in a 5 frames window */ - const uint16_t (*audio_shuffle)[9]; /* PCM shuffling table */ + const uint8_t (*audio_shuffle)[9]; /* PCM shuffling table */ } DVprofile; #define NB_DV_VLC 409 @@ -2504,7 +2504,7 @@ static const int dv_iweight_248[64] = { 22017, 25191, 24457, 27962, 22733, 24600, 25971, 29642, }; -static const uint16_t dv_audio_shuffle525[10][9] = { +static const uint8_t dv_audio_shuffle525[10][9] = { { 0, 30, 60, 20, 50, 80, 10, 40, 70 }, /* 1st channel */ { 6, 36, 66, 26, 56, 86, 16, 46, 76 }, { 12, 42, 72, 2, 32, 62, 22, 52, 82 }, @@ -2518,7 +2518,7 @@ static const uint16_t dv_audio_shuffle525[10][9] = { { 25, 55, 85, 15, 45, 75, 5, 35, 65 }, }; -static const uint16_t dv_audio_shuffle625[12][9] = { +static const uint8_t dv_audio_shuffle625[12][9] = { { 0, 36, 72, 26, 62, 98, 16, 52, 88}, /* 1st channel */ { 6, 42, 78, 32, 68, 104, 22, 58, 94}, { 12, 48, 84, 2, 38, 74, 28, 64, 100}, diff --git a/src/libffmpeg/libavcodec/eval.c b/src/libffmpeg/libavcodec/eval.c index 961c8b5ac..6ec706991 100644 --- a/src/libffmpeg/libavcodec/eval.c +++ b/src/libffmpeg/libavcodec/eval.c @@ -110,7 +110,7 @@ static double av_strtod(const char *name, char **tail) { if(*next=='B') { d*=8; - *next++; + next++; } } /* if requested, fill in tail with the position after the last parsed diff --git a/src/libffmpeg/libavcodec/flac.c b/src/libffmpeg/libavcodec/flac.c index 6c64ad0a1..1016ed47f 100644 --- a/src/libffmpeg/libavcodec/flac.c +++ b/src/libffmpeg/libavcodec/flac.c @@ -225,6 +225,10 @@ static int decode_residuals(FLACContext *s, int channel, int pred_order) rice_order = get_bits(&s->gb, 4); samples= s->blocksize >> rice_order; + if (pred_order > samples) { + av_log(s->avctx, AV_LOG_ERROR, "invalid predictor order: %i > %i\n", pred_order, samples); + return -1; + } sample= i= pred_order; @@ -454,7 +458,7 @@ static inline int decode_subframe(FLACContext *s, int channel) return 0; } -static int decode_frame(FLACContext *s) +static int decode_frame(FLACContext *s, int alloc_data_size) { int blocksize_code, sample_rate_code, sample_size_code, assignment, i, crc8; int decorrelation, bps, blocksize, samplerate; @@ -516,6 +520,9 @@ static int decode_frame(FLACContext *s) return -1; } + if(blocksize * s->channels * sizeof(int16_t) > alloc_data_size) + return -1; + if (sample_rate_code == 0){ samplerate= s->samplerate; }else if ((sample_rate_code > 3) && (sample_rate_code < 12)) @@ -579,6 +586,9 @@ static int flac_decode_frame(AVCodecContext *avctx, FLACContext *s = avctx->priv_data; int tmp = 0, i, j = 0, input_buf_size = 0; int16_t *samples = data; + int alloc_data_size= *data_size; + + *data_size=0; if(s->max_framesize == 0){ s->max_framesize= 65536; // should hopefully be enough for the first header @@ -617,7 +627,7 @@ static int flac_decode_frame(AVCodecContext *avctx, goto end; // we may not have enough bits left to decode a frame, so try next time } skip_bits(&s->gb, 16); - if (decode_frame(s) < 0){ + if (decode_frame(s, alloc_data_size) < 0){ av_log(s->avctx, AV_LOG_ERROR, "decode_frame() failed\n"); s->bitstream_size=0; s->bitstream_index=0; diff --git a/src/libffmpeg/libavcodec/flashsv.c b/src/libffmpeg/libavcodec/flashsv.c index fea8e2224..9e4aa951a 100644 --- a/src/libffmpeg/libavcodec/flashsv.c +++ b/src/libffmpeg/libavcodec/flashsv.c @@ -54,9 +54,7 @@ #include "avcodec.h" #include "bitstream.h" -#ifdef CONFIG_ZLIB #include <zlib.h> -#endif typedef struct FlashSVContext { AVCodecContext *avctx; @@ -65,9 +63,7 @@ typedef struct FlashSVContext { int block_width, block_height; uint8_t* tmpblock; int block_size; -#ifdef CONFIG_ZLIB z_stream zstream; -#endif } FlashSVContext; @@ -90,7 +86,6 @@ static int flashsv_decode_init(AVCodecContext *avctx) int zret; // Zlib return code s->avctx = avctx; -#ifdef CONFIG_ZLIB s->zstream.zalloc = Z_NULL; s->zstream.zfree = Z_NULL; s->zstream.opaque = Z_NULL; @@ -99,10 +94,6 @@ static int flashsv_decode_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret); return 1; } -#else - av_log(avctx, AV_LOG_ERROR, "Zlib support not compiled. Needed for the decoder.\n"); - return 1; -#endif avctx->pix_fmt = PIX_FMT_BGR24; avctx->has_b_frames = 0; s->frame.data[0] = NULL; @@ -145,12 +136,12 @@ static int flashsv_decode_frame(AVCodecContext *avctx, if(s->block_size < s->block_width*s->block_height) { if (s->tmpblock != NULL) av_free(s->tmpblock); - s->block_size = s->block_width*s->block_height; - if ((s->tmpblock = av_malloc(3*s->block_size)) == NULL) { + if ((s->tmpblock = av_malloc(3*s->block_width*s->block_height)) == NULL) { av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); return -1; } } + s->block_size = s->block_width*s->block_height; /* init the image size once */ if((avctx->width==0) && (avctx->height==0)){ @@ -198,7 +189,6 @@ static int flashsv_decode_frame(AVCodecContext *avctx, /* no change, don't do anything */ } else { /* decompress block */ -#ifdef CONFIG_ZLIB int ret = inflateReset(&(s->zstream)); if (ret != Z_OK) { @@ -222,10 +212,6 @@ static int flashsv_decode_frame(AVCodecContext *avctx, av_log(avctx, AV_LOG_ERROR, "error in decompression of block %dx%d: %d\n", i, j, ret); /* return -1; */ } -#else - av_log(avctx, AV_LOG_ERROR, "Zlib support not compiled in.\n"); - return -1; -#endif copy_region(s->tmpblock, s->frame.data[0], s->image_height-(hp+hs+1), wp, hs, ws, s->frame.linesize[0]); skip_bits(&gb, 8*size); /* skip the consumed bits */ } @@ -247,9 +233,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, static int flashsv_decode_end(AVCodecContext *avctx) { FlashSVContext *s = (FlashSVContext *)avctx->priv_data; -#ifdef CONFIG_ZLIB inflateEnd(&(s->zstream)); -#endif /* release the frame if needed */ if (s->frame.data[0]) avctx->release_buffer(avctx, &s->frame); diff --git a/src/libffmpeg/libavcodec/flicvideo.c b/src/libffmpeg/libavcodec/flicvideo.c index 95cb26ce4..78506eee8 100644 --- a/src/libffmpeg/libavcodec/flicvideo.c +++ b/src/libffmpeg/libavcodec/flicvideo.c @@ -87,8 +87,8 @@ static int flic_decode_init(AVCodecContext *avctx) s->avctx = avctx; avctx->has_b_frames = 0; - s->fli_type = LE_16(&fli_header[4]); /* Might be overridden if a Magic Carpet FLC */ - depth = LE_16(&fli_header[12]); + s->fli_type = AV_RL16(&fli_header[4]); /* Might be overridden if a Magic Carpet FLC */ + depth = AV_RL16(&fli_header[12]); if (depth == 0) { depth = 8; /* Some FLC generators set depth to zero, when they mean 8Bpp. Fix up here */ @@ -172,18 +172,18 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, pixels = s->frame.data[0]; pixel_limit = s->avctx->height * s->frame.linesize[0]; - frame_size = LE_32(&buf[stream_ptr]); + frame_size = AV_RL32(&buf[stream_ptr]); stream_ptr += 6; /* skip the magic number */ - num_chunks = LE_16(&buf[stream_ptr]); + num_chunks = AV_RL16(&buf[stream_ptr]); stream_ptr += 10; /* skip padding */ frame_size -= 16; /* iterate through the chunks */ while ((frame_size > 0) && (num_chunks > 0)) { - chunk_size = LE_32(&buf[stream_ptr]); + chunk_size = AV_RL32(&buf[stream_ptr]); stream_ptr += 4; - chunk_type = LE_16(&buf[stream_ptr]); + chunk_type = AV_RL16(&buf[stream_ptr]); stream_ptr += 2; switch (chunk_type) { @@ -200,7 +200,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, else color_shift = 2; /* set up the palette */ - color_packets = LE_16(&buf[stream_ptr]); + color_packets = AV_RL16(&buf[stream_ptr]); stream_ptr += 2; palette_ptr = 0; for (i = 0; i < color_packets; i++) { @@ -241,10 +241,10 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, case FLI_DELTA: y_ptr = 0; - compressed_lines = LE_16(&buf[stream_ptr]); + compressed_lines = AV_RL16(&buf[stream_ptr]); stream_ptr += 2; while (compressed_lines > 0) { - line_packets = LE_16(&buf[stream_ptr]); + line_packets = AV_RL16(&buf[stream_ptr]); stream_ptr += 2; if ((line_packets & 0xC000) == 0xC000) { // line skip opcode @@ -290,12 +290,12 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, case FLI_LC: /* line compressed */ - starting_line = LE_16(&buf[stream_ptr]); + starting_line = AV_RL16(&buf[stream_ptr]); stream_ptr += 2; y_ptr = 0; y_ptr += starting_line * s->frame.linesize[0]; - compressed_lines = LE_16(&buf[stream_ptr]); + compressed_lines = AV_RL16(&buf[stream_ptr]); stream_ptr += 2; while (compressed_lines > 0) { pixel_ptr = y_ptr; @@ -466,18 +466,18 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, pixels = s->frame.data[0]; pixel_limit = s->avctx->height * s->frame.linesize[0]; - frame_size = LE_32(&buf[stream_ptr]); + frame_size = AV_RL32(&buf[stream_ptr]); stream_ptr += 6; /* skip the magic number */ - num_chunks = LE_16(&buf[stream_ptr]); + num_chunks = AV_RL16(&buf[stream_ptr]); stream_ptr += 10; /* skip padding */ frame_size -= 16; /* iterate through the chunks */ while ((frame_size > 0) && (num_chunks > 0)) { - chunk_size = LE_32(&buf[stream_ptr]); + chunk_size = AV_RL32(&buf[stream_ptr]); stream_ptr += 4; - chunk_type = LE_16(&buf[stream_ptr]); + chunk_type = AV_RL16(&buf[stream_ptr]); stream_ptr += 2; switch (chunk_type) { @@ -492,10 +492,10 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, case FLI_DELTA: case FLI_DTA_LC: y_ptr = 0; - compressed_lines = LE_16(&buf[stream_ptr]); + compressed_lines = AV_RL16(&buf[stream_ptr]); stream_ptr += 2; while (compressed_lines > 0) { - line_packets = LE_16(&buf[stream_ptr]); + line_packets = AV_RL16(&buf[stream_ptr]); stream_ptr += 2; if (line_packets < 0) { line_packets = -line_packets; @@ -512,7 +512,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, byte_run = (signed char)(buf[stream_ptr++]); if (byte_run < 0) { byte_run = -byte_run; - pixel = LE_16(&buf[stream_ptr]); + pixel = AV_RL16(&buf[stream_ptr]); stream_ptr += 2; CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++, pixel_countdown -= 2) { @@ -522,7 +522,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, } else { CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++, pixel_countdown--) { - *((signed short*)(&pixels[pixel_ptr])) = LE_16(&buf[stream_ptr]); + *((signed short*)(&pixels[pixel_ptr])) = AV_RL16(&buf[stream_ptr]); stream_ptr += 2; pixel_ptr += 2; } @@ -586,12 +586,12 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, * a second pass over the line here, swapping the bytes. */ pixel = 0xFF00; - if (0xFF00 != LE_16(&pixel)) /* Check if its not an LE Target */ + if (0xFF00 != AV_RL16(&pixel)) /* Check if its not an LE Target */ { pixel_ptr = y_ptr; pixel_countdown = s->avctx->width; while (pixel_countdown > 0) { - *((signed short*)(&pixels[pixel_ptr])) = LE_16(&buf[pixel_ptr]); + *((signed short*)(&pixels[pixel_ptr])) = AV_RL16(&buf[pixel_ptr]); pixel_ptr += 2; } } @@ -611,7 +611,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, while (pixel_countdown > 0) { byte_run = (signed char)(buf[stream_ptr++]); if (byte_run > 0) { - pixel = LE_16(&buf[stream_ptr]); + pixel = AV_RL16(&buf[stream_ptr]); stream_ptr += 2; CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++) { @@ -626,7 +626,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, byte_run = -byte_run; CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++) { - *((signed short*)(&pixels[pixel_ptr])) = LE_16(&buf[stream_ptr]); + *((signed short*)(&pixels[pixel_ptr])) = AV_RL16(&buf[stream_ptr]); stream_ptr += 2; pixel_ptr += 2; pixel_countdown--; @@ -656,7 +656,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, pixel_countdown = s->avctx->width; pixel_ptr = 0; while (pixel_countdown > 0) { - *((signed short*)(&pixels[y_ptr + pixel_ptr])) = LE_16(&buf[stream_ptr+pixel_ptr]); + *((signed short*)(&pixels[y_ptr + pixel_ptr])) = AV_RL16(&buf[stream_ptr+pixel_ptr]); pixel_ptr += 2; pixel_countdown--; } diff --git a/src/libffmpeg/libavcodec/fraps.c b/src/libffmpeg/libavcodec/fraps.c index 18d270049..0a4567d05 100644 --- a/src/libffmpeg/libavcodec/fraps.c +++ b/src/libffmpeg/libavcodec/fraps.c @@ -138,7 +138,7 @@ static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w, for(i = 0; i < 256; i++){ s->nodes[i].sym = i; - s->nodes[i].count = LE_32(src); + s->nodes[i].count = AV_RL32(src); s->nodes[i].n0 = -2; if(s->nodes[i].count < 0) { av_log(s->avctx, AV_LOG_ERROR, "Symbol count < 0\n"); @@ -215,7 +215,7 @@ static int decode_frame(AVCodecContext *avctx, int i, is_chroma, planes; - header = LE_32(buf); + header = AV_RL32(buf); version = header & 0xff; header_size = (header & (1<<30))? 8 : 4; /* bit 30 means pad to 8 bytes */ @@ -337,12 +337,12 @@ static int decode_frame(AVCodecContext *avctx, } f->pict_type = FF_I_TYPE; f->key_frame = 1; - if ((LE_32(buf) != FPS_TAG)||(buf_size < (planes*1024 + 24))) { + if ((AV_RL32(buf) != FPS_TAG)||(buf_size < (planes*1024 + 24))) { av_log(avctx, AV_LOG_ERROR, "Fraps: error in data stream\n"); return -1; } for(i = 0; i < planes; i++) { - offs[i] = LE_32(buf + 4 + i * 4); + offs[i] = AV_RL32(buf + 4 + i * 4); if(offs[i] >= buf_size || (i && offs[i] <= offs[i - 1] + 1024)) { av_log(avctx, AV_LOG_ERROR, "Fraps: plane %i offset is out of bounds\n", i); return -1; diff --git a/src/libffmpeg/libavcodec/h263.c b/src/libffmpeg/libavcodec/h263.c index af5fa50e6..27b66a0c8 100644 --- a/src/libffmpeg/libavcodec/h263.c +++ b/src/libffmpeg/libavcodec/h263.c @@ -5928,6 +5928,10 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){ - ROUNDED_DIV(s->last_non_b_time - s->pp_time, s->t_frame))*2; s->pb_field_time= ( ROUNDED_DIV(s->time, s->t_frame) - ROUNDED_DIV(s->last_non_b_time - s->pp_time, s->t_frame))*2; + if(!s->progressive_sequence){ + if(s->pp_field_time <= s->pb_field_time || s->pb_field_time <= 1) + return FRAME_SKIPPED; + } } //av_log(s->avctx, AV_LOG_DEBUG, "last nonb %"PRId64" last_base %d time %"PRId64" pp %d pb %d t %d ppf %d pbf %d\n", s->last_non_b_time, s->last_time_base, s->time, s->pp_time, s->pb_time, s->t_frame, s->pp_field_time, s->pb_field_time); diff --git a/src/libffmpeg/libavcodec/h263dec.c b/src/libffmpeg/libavcodec/h263dec.c index 66370c179..9246b5217 100644 --- a/src/libffmpeg/libavcodec/h263dec.c +++ b/src/libffmpeg/libavcodec/h263dec.c @@ -729,7 +729,7 @@ retry: decode_slice(s); while(s->mb_y<s->mb_height){ if(s->msmpeg4_version){ - if(s->mb_x!=0 || (s->mb_y%s->slice_height)!=0 || get_bits_count(&s->gb) > s->gb.size_in_bits) + if(s->slice_height==0 || s->mb_x!=0 || (s->mb_y%s->slice_height)!=0 || get_bits_count(&s->gb) > s->gb.size_in_bits) break; }else{ if(ff_h263_resync(s)<0) diff --git a/src/libffmpeg/libavcodec/h264.c b/src/libffmpeg/libavcodec/h264.c index d7c48bd4a..d696676f0 100644 --- a/src/libffmpeg/libavcodec/h264.c +++ b/src/libffmpeg/libavcodec/h264.c @@ -117,12 +117,12 @@ typedef struct SPS{ * Picture parameter set */ typedef struct PPS{ - int sps_id; + unsigned int sps_id; int cabac; ///< entropy_coding_mode_flag int pic_order_present; ///< pic_order_present_flag int slice_group_count; ///< num_slice_groups_minus1 + 1 int mb_slice_group_map_type; - int ref_count[2]; ///< num_ref_idx_l0/1_active_minus1 + 1 + unsigned int ref_count[2]; ///< num_ref_idx_l0/1_active_minus1 + 1 int weighted_pred; ///< weighted_pred_flag int weighted_bipred_idc; int init_qp; ///< pic_init_qp_minus26 + 26 @@ -274,7 +274,7 @@ typedef struct H264Context{ int mb_field_decoding_flag; int mb_mbaff; ///< mb_aff_frame && mb_field_decoding_flag - int sub_mb_type[4]; + unsigned int sub_mb_type[4]; //POC stuff int poc_lsb; @@ -325,12 +325,12 @@ typedef struct H264Context{ /** * num_ref_idx_l0/1_active_minus1 + 1 */ - int ref_count[2]; ///< counts frames or fields, depending on current mb mode + unsigned int ref_count[2]; ///< counts frames or fields, depending on current mb mode Picture *short_ref[32]; Picture *long_ref[32]; Picture default_ref_list[2][32]; Picture ref_list[2][48]; ///< 0..15: frame refs, 16..47: mbaff field refs - Picture *delayed_pic[16]; //FIXME size? + Picture *delayed_pic[18]; //FIXME size? Picture *delayed_output_pic; /** @@ -349,6 +349,7 @@ typedef struct H264Context{ GetBitContext *inter_gb_ptr; DECLARE_ALIGNED_8(DCTELEM, mb[16*24]); + DCTELEM mb_padding[256]; ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either check that i is not to large or ensure that there is some unused stuff after mb /** * Cabac @@ -1398,7 +1399,7 @@ static inline void pred_direct_motion(H264Context * const h, int *mb_type){ const int8_t *l1ref0 = &h->ref_list[1][0].ref_index[0][b8_xy]; const int8_t *l1ref1 = &h->ref_list[1][0].ref_index[1][b8_xy]; const int is_b8x8 = IS_8X8(*mb_type); - int sub_mb_type; + unsigned int sub_mb_type; int i8, i4; #define MB_TYPE_16x16_OR_INTRA (MB_TYPE_16x16|MB_TYPE_INTRA4x4|MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM) @@ -1780,6 +1781,10 @@ static uint8_t *decode_nal(H264Context *h, uint8_t *src, int *dst_length, int *c h->rbsp_buffer= av_fast_realloc(h->rbsp_buffer, &h->rbsp_buffer_size, length); dst= h->rbsp_buffer; + if (dst == NULL){ + return NULL; + } + //printf("decoding esc\n"); si=di=0; while(si<length){ @@ -2768,7 +2773,7 @@ static inline void mc_dir_part(H264Context *h, Picture *pic, int n, int square, const int pic_width = 16*s->mb_width; const int pic_height = 16*s->mb_height >> MB_MBAFF; - if(!pic->data[0]) + if(!pic->data[0]) //FIXME this is unacceptable, some senseable error concealment must be done for missing reference frames return; if(mx&7) extra_width -= 3; @@ -3912,8 +3917,8 @@ static int decode_ref_pic_list_reordering(H264Context *h){ int pred= h->curr_pic_num; for(index=0; ; index++){ - int reordering_of_pic_nums_idc= get_ue_golomb(&s->gb); - int pic_id; + unsigned int reordering_of_pic_nums_idc= get_ue_golomb(&s->gb); + unsigned int pic_id; int i; Picture *ref = NULL; @@ -3927,7 +3932,7 @@ static int decode_ref_pic_list_reordering(H264Context *h){ if(reordering_of_pic_nums_idc<3){ if(reordering_of_pic_nums_idc<2){ - const int abs_diff_pic_num= get_ue_golomb(&s->gb) + 1; + const unsigned int abs_diff_pic_num= get_ue_golomb(&s->gb) + 1; if(abs_diff_pic_num >= h->max_pic_num){ av_log(h->s.avctx, AV_LOG_ERROR, "abs_diff_pic_num overflow\n"); @@ -3949,11 +3954,19 @@ static int decode_ref_pic_list_reordering(H264Context *h){ ref->pic_id= ref->frame_num; }else{ pic_id= get_ue_golomb(&s->gb); //long_term_pic_idx + if(pic_id>31){ + av_log(h->s.avctx, AV_LOG_ERROR, "long_term_pic_idx overflow\n"); + return -1; + } ref = h->long_ref[pic_id]; - ref->pic_id= pic_id; - assert(ref->reference == 3); - assert(ref->long_ref); - i=0; + if(ref){ + ref->pic_id= pic_id; + assert(ref->reference == 3); + assert(ref->long_ref); + i=0; + }else{ + i=-1; + } } if (i < 0) { @@ -4259,8 +4272,10 @@ static int execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){ if(pic) unreference_pic(h, pic); h->long_ref[ mmco[i].long_index ]= remove_short(h, mmco[i].short_frame_num); - h->long_ref[ mmco[i].long_index ]->long_ref=1; - h->long_ref_count++; + if (h->long_ref[ mmco[i].long_index ]){ + h->long_ref[ mmco[i].long_index ]->long_ref=1; + h->long_ref_count++; + } break; case MMCO_LONG2UNUSED: pic= remove_long(h, mmco[i].long_index); @@ -4290,7 +4305,7 @@ static int execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){ case MMCO_RESET: while(h->short_ref_count){ pic= remove_short(h, h->short_ref[0]->frame_num); - unreference_pic(h, pic); + if(pic) unreference_pic(h, pic); } for(j = 0; j < 16; j++) { pic= remove_long(h, j); @@ -4348,14 +4363,15 @@ static int decode_ref_pic_marking(H264Context *h){ }*/ } if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){ - h->mmco[i].long_index= get_ue_golomb(&s->gb); - if(/*h->mmco[i].long_index >= h->long_ref_count || h->long_ref[ h->mmco[i].long_index ] == NULL*/ h->mmco[i].long_index >= 16){ + unsigned int long_index= get_ue_golomb(&s->gb); + if(/*h->mmco[i].long_index >= h->long_ref_count || h->long_ref[ h->mmco[i].long_index ] == NULL*/ long_index >= 16){ av_log(h->s.avctx, AV_LOG_ERROR, "illegal long ref in memory management control operation %d\n", opcode); return -1; } + h->mmco[i].long_index= long_index; } - if(opcode > MMCO_LONG){ + if(opcode > (unsigned)MMCO_LONG){ av_log(h->s.avctx, AV_LOG_ERROR, "illegal memory management control operation %d\n", opcode); return -1; } @@ -4473,10 +4489,11 @@ static int init_poc(H264Context *h){ */ static int decode_slice_header(H264Context *h){ MpegEncContext * const s = &h->s; - int first_mb_in_slice, pps_id; + unsigned int first_mb_in_slice; + unsigned int pps_id; int num_ref_idx_active_override_flag; static const uint8_t slice_type_map[5]= {P_TYPE, B_TYPE, I_TYPE, SP_TYPE, SI_TYPE}; - int slice_type; + unsigned int slice_type, tmp; int default_ref_list_done = 0; s->current_picture.reference= h->nal_ref_idc != 0; @@ -4505,7 +4522,7 @@ static int decode_slice_header(H264Context *h){ s->pict_type= h->slice_type; // to make a few old func happy, it's wrong though pps_id= get_ue_golomb(&s->gb); - if(pps_id>255){ + if(pps_id>=MAX_PPS_COUNT){ av_log(h->s.avctx, AV_LOG_ERROR, "pps_id out of range\n"); return -1; } @@ -4629,12 +4646,15 @@ static int decode_slice_header(H264Context *h){ h->mb_aff_frame = h->sps.mb_aff; } } - - s->resync_mb_x = s->mb_x = first_mb_in_slice % s->mb_width; - s->resync_mb_y = s->mb_y = (first_mb_in_slice / s->mb_width) << h->mb_aff_frame; - if(s->mb_y >= s->mb_height){ + assert(s->mb_num == s->mb_width * s->mb_height); + if(first_mb_in_slice << h->mb_aff_frame >= s->mb_num || + first_mb_in_slice >= s->mb_num){ + av_log(h->s.avctx, AV_LOG_ERROR, "first_mb_in_slice overflow\n"); return -1; } + s->resync_mb_x = s->mb_x = first_mb_in_slice % s->mb_width; + s->resync_mb_y = s->mb_y = (first_mb_in_slice / s->mb_width) << h->mb_aff_frame; + assert(s->mb_y < s->mb_height); if(s->picture_structure==PICT_FRAME){ h->curr_pic_num= h->frame_num; @@ -4688,6 +4708,7 @@ static int decode_slice_header(H264Context *h){ if(h->ref_count[0] > 32 || h->ref_count[1] > 32){ av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow\n"); + h->ref_count[0]= h->ref_count[1]= 1; return -1; } } @@ -4714,15 +4735,22 @@ static int decode_slice_header(H264Context *h){ if(FRAME_MBAFF) fill_mbaff_ref_list(h); - if( h->slice_type != I_TYPE && h->slice_type != SI_TYPE && h->pps.cabac ) - h->cabac_init_idc = get_ue_golomb(&s->gb); + if( h->slice_type != I_TYPE && h->slice_type != SI_TYPE && h->pps.cabac ){ + tmp = get_ue_golomb(&s->gb); + if(tmp > 2){ + av_log(s->avctx, AV_LOG_ERROR, "cabac_init_idc overflow\n"); + return -1; + } + h->cabac_init_idc= tmp; + } h->last_qscale_diff = 0; - s->qscale = h->pps.init_qp + get_se_golomb(&s->gb); - if(s->qscale<0 || s->qscale>51){ - av_log(s->avctx, AV_LOG_ERROR, "QP %d out of range\n", s->qscale); + tmp = h->pps.init_qp + get_se_golomb(&s->gb); + if(tmp>51){ + av_log(s->avctx, AV_LOG_ERROR, "QP %u out of range\n", tmp); return -1; } + s->qscale= tmp; h->chroma_qp = get_chroma_qp(h->pps.chroma_qp_index_offset, s->qscale); //FIXME qscale / qp ... stuff if(h->slice_type == SP_TYPE){ @@ -4736,7 +4764,12 @@ static int decode_slice_header(H264Context *h){ h->slice_alpha_c0_offset = 0; h->slice_beta_offset = 0; if( h->pps.deblocking_filter_parameters_present ) { - h->deblocking_filter= get_ue_golomb(&s->gb); + tmp= get_ue_golomb(&s->gb); + if(tmp > 2){ + av_log(s->avctx, AV_LOG_ERROR, "deblocking_filter_idc %u out of range\n", tmp); + return -1; + } + h->deblocking_filter= tmp; if(h->deblocking_filter < 2) h->deblocking_filter^= 1; // 1<->0 @@ -4762,7 +4795,7 @@ static int decode_slice_header(H264Context *h){ h->emu_edge_height= FRAME_MBAFF ? 0 : h->emu_edge_width; if(s->avctx->debug&FF_DEBUG_PICT_INFO){ - av_log(h->s.avctx, AV_LOG_DEBUG, "slice:%d %s mb:%d %c pps:%d frame:%d poc:%d/%d ref:%d/%d qp:%d loop:%d:%d:%d weight:%d%s\n", + av_log(h->s.avctx, AV_LOG_DEBUG, "slice:%d %s mb:%d %c pps:%u frame:%d poc:%d/%d ref:%d/%d qp:%d loop:%d:%d:%d weight:%d%s\n", h->slice_num, (s->picture_structure==PICT_FRAME ? "F" : s->picture_structure==PICT_TOP_FIELD ? "T" : "B"), first_mb_in_slice, @@ -4856,8 +4889,8 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in if(total_coeff==0) return 0; - if(total_coeff<0) { - av_log(h->s.avctx, AV_LOG_ERROR, "corrupted macroblock %d %d (total_coeff<0)\n", s->mb_x, s->mb_y); + if(total_coeff > (unsigned)max_coeff) { + av_log(h->s.avctx, AV_LOG_ERROR, "corrupted macroblock %d %d (total_coeff=%d)\n", s->mb_x, s->mb_y, total_coeff); return -1; } @@ -5033,7 +5066,8 @@ static void decode_mb_skip(H264Context *h){ static int decode_mb_cavlc(H264Context *h){ MpegEncContext * const s = &h->s; const int mb_xy= s->mb_x + s->mb_y*s->mb_stride; - int mb_type, partition_count, cbp; + int partition_count; + unsigned int mb_type, cbp; int dct8x8_allowed= h->pps.transform_8x8_mode; s->dsp.clear_blocks(h->mb); //FIXME avoid if already clear (move after skip handlong? @@ -5147,6 +5181,7 @@ decode_intra_mb: //mb_pred if(IS_INTRA(mb_type)){ + int pred_mode; // init_top_left_availability(h); if(IS_INTRA4x4(mb_type)){ int i; @@ -5178,11 +5213,11 @@ decode_intra_mb: if(h->intra16x16_pred_mode < 0) return -1; } - h->chroma_pred_mode= get_ue_golomb(&s->gb); - h->chroma_pred_mode= check_intra_pred_mode(h, h->chroma_pred_mode); - if(h->chroma_pred_mode < 0) + pred_mode= check_intra_pred_mode(h, get_ue_golomb(&s->gb)); + if(pred_mode < 0) return -1; + h->chroma_pred_mode= pred_mode; }else if(partition_count==4){ int i, j, sub_partition_count[4], list, ref[2][4]; @@ -5190,7 +5225,7 @@ decode_intra_mb: for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb(&s->gb); if(h->sub_mb_type[i] >=13){ - av_log(h->s.avctx, AV_LOG_ERROR, "B sub_mb_type %d out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); + av_log(h->s.avctx, AV_LOG_ERROR, "B sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); return -1; } sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; @@ -5209,7 +5244,7 @@ decode_intra_mb: for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb(&s->gb); if(h->sub_mb_type[i] >=4){ - av_log(h->s.avctx, AV_LOG_ERROR, "P sub_mb_type %d out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); + av_log(h->s.avctx, AV_LOG_ERROR, "P sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); return -1; } sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; @@ -5223,7 +5258,12 @@ decode_intra_mb: for(i=0; i<4; i++){ if(IS_DIRECT(h->sub_mb_type[i])) continue; if(IS_DIR(h->sub_mb_type[i], 0, list)){ - ref[list][i] = get_te0_golomb(&s->gb, ref_count); //FIXME init to 0 before and skip? + unsigned int tmp = get_te0_golomb(&s->gb, ref_count); //FIXME init to 0 before and skip? + if(tmp>=ref_count){ + av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", tmp); + return -1; + } + ref[list][i]= tmp; }else{ //FIXME ref[list][i] = -1; @@ -5292,7 +5332,11 @@ decode_intra_mb: for(list=0; list<2; list++){ if(h->ref_count[list]>0){ if(IS_DIR(mb_type, 0, list)){ - const int val= get_te0_golomb(&s->gb, h->ref_count[list]); + unsigned int val= get_te0_golomb(&s->gb, h->ref_count[list]); + if(val >= h->ref_count[list]){ + av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); + return -1; + } fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, val, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, (LIST_NOT_USED&0xFF), 1); @@ -5315,7 +5359,11 @@ decode_intra_mb: if(h->ref_count[list]>0){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ - const int val= get_te0_golomb(&s->gb, h->ref_count[list]); + unsigned int val= get_te0_golomb(&s->gb, h->ref_count[list]); + if(val >= h->ref_count[list]){ + av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); + return -1; + } fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1); @@ -5341,7 +5389,11 @@ decode_intra_mb: if(h->ref_count[list]>0){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ //FIXME optimize - const int val= get_te0_golomb(&s->gb, h->ref_count[list]); + unsigned int val= get_te0_golomb(&s->gb, h->ref_count[list]); + if(val >= h->ref_count[list]){ + av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); + return -1; + } fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1); @@ -5370,7 +5422,7 @@ decode_intra_mb: if(!IS_INTRA16x16(mb_type)){ cbp= get_ue_golomb(&s->gb); if(cbp > 47){ - av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%d) at %d %d\n", cbp, s->mb_x, s->mb_y); + av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%u) at %d %d\n", cbp, s->mb_x, s->mb_y); return -1; } @@ -5852,6 +5904,10 @@ static int decode_cabac_mb_ref( H264Context *h, int list, int n ) { ctx = 4; else ctx = 5; + if(ref >= 32 /*h->ref_list[list]*/){ + av_log(h->s.avctx, AV_LOG_ERROR, "overflow in decode_cabac_mb_ref\n"); + return 0; //FIXME we should return -1 and check the return everywhere + } } return ref; } @@ -5885,6 +5941,10 @@ static int decode_cabac_mb_mvd( H264Context *h, int list, int n, int l ) { while( get_cabac_bypass( &h->cabac ) ) { mvd += 1 << k; k++; + if(k>24){ + av_log(h->s.avctx, AV_LOG_ERROR, "overflow in decode_cabac_mb_mvd\n"); + return INT_MIN; + } } while( k-- ) { if( get_cabac_bypass( &h->cabac ) ) @@ -6224,7 +6284,10 @@ decode_intra_mb: // FIXME The two following lines get the bitstream position in the cabac // decode, I think it should be done by a function in cabac.h (or cabac.c). ptr= h->cabac.bytestream; - if (h->cabac.low&0x1) ptr-=CABAC_BITS/8; + if(h->cabac.low&0x1) ptr--; + if(CABAC_BITS==16){ + if(h->cabac.low&0x1FF) ptr--; + } // The pixels are stored in the same order as levels in h->mb array. for(y=0; y<16; y++){ @@ -6271,7 +6334,7 @@ decode_intra_mb: fill_caches(h, mb_type, 0); if( IS_INTRA( mb_type ) ) { - int i; + int i, pred_mode; if( IS_INTRA4x4( mb_type ) ) { if( dct8x8_allowed && decode_cabac_mb_transform_size( h ) ) { mb_type |= MB_TYPE_8x8DCT; @@ -6295,10 +6358,11 @@ decode_intra_mb: if( h->intra16x16_pred_mode < 0 ) return -1; } h->chroma_pred_mode_table[mb_xy] = - h->chroma_pred_mode = decode_cabac_mb_chroma_pre_mode( h ); + pred_mode = decode_cabac_mb_chroma_pre_mode( h ); - h->chroma_pred_mode= check_intra_pred_mode( h, h->chroma_pred_mode ); - if( h->chroma_pred_mode < 0 ) return -1; + pred_mode= check_intra_pred_mode( h, pred_mode ); + if( pred_mode < 0 ) return -1; + h->chroma_pred_mode= pred_mode; } else if( partition_count == 4 ) { int i, j, sub_partition_count[4], list, ref[2][4]; @@ -7547,7 +7611,8 @@ static inline void decode_hrd_parameters(H264Context *h, SPS *sps){ static inline int decode_vui_parameters(H264Context *h, SPS *sps){ MpegEncContext * const s = &h->s; - int aspect_ratio_info_present_flag, aspect_ratio_idc; + int aspect_ratio_info_present_flag; + unsigned int aspect_ratio_idc; int nal_hrd_parameters_present_flag, vcl_hrd_parameters_present_flag; aspect_ratio_info_present_flag= get_bits1(&s->gb); @@ -7607,13 +7672,21 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){ sps->bitstream_restriction_flag = get_bits1(&s->gb); if(sps->bitstream_restriction_flag){ + unsigned int num_reorder_frames; get_bits1(&s->gb); /* motion_vectors_over_pic_boundaries_flag */ get_ue_golomb(&s->gb); /* max_bytes_per_pic_denom */ get_ue_golomb(&s->gb); /* max_bits_per_mb_denom */ get_ue_golomb(&s->gb); /* log2_max_mv_length_horizontal */ get_ue_golomb(&s->gb); /* log2_max_mv_length_vertical */ - sps->num_reorder_frames = get_ue_golomb(&s->gb); - get_ue_golomb(&s->gb); /* max_dec_frame_buffering */ + num_reorder_frames= get_ue_golomb(&s->gb); + get_ue_golomb(&s->gb); /*max_dec_frame_buffering*/ + + if(num_reorder_frames > 16 /*max_dec_frame_buffering || max_dec_frame_buffering > 16*/){ + av_log(h->s.avctx, AV_LOG_ERROR, "illegal num_reorder_frames %d\n", num_reorder_frames); + return -1; + } + + sps->num_reorder_frames= num_reorder_frames; } return 0; @@ -7669,7 +7742,8 @@ static void decode_scaling_matrices(H264Context *h, SPS *sps, PPS *pps, int is_s static inline int decode_seq_parameter_set(H264Context *h){ MpegEncContext * const s = &h->s; int profile_idc, level_idc; - int sps_id, i; + unsigned int sps_id, tmp, mb_width, mb_height; + int i; SPS *sps; profile_idc= get_bits(&s->gb, 8); @@ -7681,6 +7755,12 @@ static inline int decode_seq_parameter_set(H264Context *h){ level_idc= get_bits(&s->gb, 8); sps_id= get_ue_golomb(&s->gb); + if (sps_id >= MAX_SPS_COUNT){ + // ok it has gone out of hand, someone is sending us bad stuff. + av_log(h->s.avctx, AV_LOG_ERROR, "illegal sps_id (%d)\n", sps_id); + return -1; + } + sps= &h->sps_buffer[ sps_id ]; sps->profile_idc= profile_idc; sps->level_idc= level_idc; @@ -7704,26 +7784,36 @@ static inline int decode_seq_parameter_set(H264Context *h){ sps->delta_pic_order_always_zero_flag= get_bits1(&s->gb); sps->offset_for_non_ref_pic= get_se_golomb(&s->gb); sps->offset_for_top_to_bottom_field= get_se_golomb(&s->gb); - sps->poc_cycle_length= get_ue_golomb(&s->gb); + tmp= get_ue_golomb(&s->gb); + + if(tmp >= sizeof(sps->offset_for_ref_frame) / sizeof(sps->offset_for_ref_frame[0])){ + av_log(h->s.avctx, AV_LOG_ERROR, "poc_cycle_length overflow %u\n", tmp); + return -1; + } + sps->poc_cycle_length= tmp; for(i=0; i<sps->poc_cycle_length; i++) sps->offset_for_ref_frame[i]= get_se_golomb(&s->gb); - } - if(sps->poc_type > 2){ + }else if(sps->poc_type != 2){ av_log(h->s.avctx, AV_LOG_ERROR, "illegal POC type %d\n", sps->poc_type); return -1; } - sps->ref_frame_count= get_ue_golomb(&s->gb); - if(sps->ref_frame_count > MAX_PICTURE_COUNT-2){ + tmp= get_ue_golomb(&s->gb); + if(tmp > MAX_PICTURE_COUNT-2){ av_log(h->s.avctx, AV_LOG_ERROR, "too many reference frames\n"); } + sps->ref_frame_count= tmp; sps->gaps_in_frame_num_allowed_flag= get_bits1(&s->gb); - sps->mb_width= get_ue_golomb(&s->gb) + 1; - sps->mb_height= get_ue_golomb(&s->gb) + 1; - if((unsigned)sps->mb_width >= INT_MAX/16 || (unsigned)sps->mb_height >= INT_MAX/16 || - avcodec_check_dimensions(NULL, 16*sps->mb_width, 16*sps->mb_height)) + mb_width= get_ue_golomb(&s->gb) + 1; + mb_height= get_ue_golomb(&s->gb) + 1; + if(mb_width >= INT_MAX/16 || mb_height >= INT_MAX/16 || + avcodec_check_dimensions(NULL, 16*mb_width, 16*mb_height)){ + av_log(h->s.avctx, AV_LOG_ERROR, "mb_width/height overflow\n"); return -1; + } + sps->mb_width = mb_width; + sps->mb_height= mb_height; sps->frame_mbs_only_flag= get_bits1(&s->gb); if(!sps->frame_mbs_only_flag) @@ -7761,7 +7851,7 @@ static inline int decode_seq_parameter_set(H264Context *h){ decode_vui_parameters(h, sps); if(s->avctx->debug&FF_DEBUG_PICT_INFO){ - av_log(h->s.avctx, AV_LOG_DEBUG, "sps:%d profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%d/%d/%d/%d %s\n", + av_log(h->s.avctx, AV_LOG_DEBUG, "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%d/%d/%d/%d %s\n", sps_id, sps->profile_idc, sps->level_idc, sps->poc_type, sps->ref_frame_count, @@ -7778,10 +7868,22 @@ static inline int decode_seq_parameter_set(H264Context *h){ static inline int decode_picture_parameter_set(H264Context *h, int bit_length){ MpegEncContext * const s = &h->s; - int pps_id= get_ue_golomb(&s->gb); - PPS *pps= &h->pps_buffer[pps_id]; + unsigned int tmp, pps_id= get_ue_golomb(&s->gb); + PPS *pps; + + if(pps_id>=MAX_PPS_COUNT){ + av_log(h->s.avctx, AV_LOG_ERROR, "pps_id out of range\n"); + return -1; + } + pps = &h->pps_buffer[pps_id]; + + tmp= get_ue_golomb(&s->gb); + if(tmp>=MAX_SPS_COUNT){ + av_log(h->s.avctx, AV_LOG_ERROR, "sps_id out of range\n"); + return -1; + } + pps->sps_id= tmp; - pps->sps_id= get_ue_golomb(&s->gb); pps->cabac= get_bits1(&s->gb); pps->pic_order_present= get_bits1(&s->gb); pps->slice_group_count= get_ue_golomb(&s->gb) + 1; @@ -7826,6 +7928,7 @@ static inline int decode_picture_parameter_set(H264Context *h, int bit_length){ pps->ref_count[1]= get_ue_golomb(&s->gb) + 1; if(pps->ref_count[0] > 32 || pps->ref_count[1] > 32){ av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow (pps)\n"); + pps->ref_count[0]= pps->ref_count[1]= 1; return -1; } @@ -7850,7 +7953,7 @@ static inline int decode_picture_parameter_set(H264Context *h, int bit_length){ } if(s->avctx->debug&FF_DEBUG_PICT_INFO){ - av_log(h->s.avctx, AV_LOG_DEBUG, "pps:%d sps:%d %s slice_groups:%d ref:%d/%d %s qp:%d/%d/%d %s %s %s %s\n", + av_log(h->s.avctx, AV_LOG_DEBUG, "pps:%u sps:%u %s slice_groups:%d ref:%d/%d %s qp:%d/%d/%d %s %s %s %s\n", pps_id, pps->sps_id, pps->cabac ? "CABAC" : "CAVLC", pps->slice_group_count, @@ -7984,7 +8087,7 @@ static int decode_nal_units(H264Context *h, uint8_t *buf, int buf_size){ nalsize = 0; for(i = 0; i < h->nal_length_size; i++) nalsize = (nalsize << 8) | buf[buf_index++]; - if(nalsize <= 1){ + if(nalsize <= 1 || nalsize > buf_size){ if(nalsize == 1){ buf_index++; continue; @@ -8007,6 +8110,9 @@ static int decode_nal_units(H264Context *h, uint8_t *buf, int buf_size){ } ptr= decode_nal(h, buf + buf_index, &dst_length, &consumed, h->is_avc ? nalsize : buf_size - buf_index); + if (ptr==NULL || dst_length <= 0){ + return -1; + } while(ptr[dst_length - 1] == 0 && dst_length > 1) dst_length--; bit_length= 8*dst_length - decode_rbsp_trailing(ptr + dst_length - 1); @@ -8064,6 +8170,7 @@ static int decode_nal_units(H264Context *h, uint8_t *buf, int buf_size){ h->inter_gb_ptr= &h->inter_gb; if(h->redundant_pic_count==0 && h->intra_gb_ptr && s->data_partitioning + && s->context_initialized && s->hurry_up < 5 && (avctx->skip_frame < AVDISCARD_NONREF || h->nal_ref_idc) && (avctx->skip_frame < AVDISCARD_BIDIR || h->slice_type!=B_TYPE) @@ -8184,7 +8291,7 @@ static int decode_frame(AVCodecContext *avctx, cnt = *(p+5) & 0x1f; // Number of sps p += 6; for (i = 0; i < cnt; i++) { - nalsize = BE_16(p) + 2; + nalsize = AV_RB16(p) + 2; if(decode_nal_units(h, p, nalsize) < 0) { av_log(avctx, AV_LOG_ERROR, "Decoding sps %d from avcC failed\n", i); return -1; @@ -8194,7 +8301,7 @@ static int decode_frame(AVCodecContext *avctx, // Decode pps from avcC cnt = *(p++); // Number of pps for (i = 0; i < cnt; i++) { - nalsize = BE_16(p) + 2; + nalsize = AV_RB16(p) + 2; if(decode_nal_units(h, p, nalsize) != nalsize) { av_log(avctx, AV_LOG_ERROR, "Decoding pps %d from avcC failed\n", i); return -1; @@ -8242,6 +8349,9 @@ static int decode_frame(AVCodecContext *avctx, pics = 0; while(h->delayed_pic[pics]) pics++; + + assert(pics+1 < sizeof(h->delayed_pic) / sizeof(h->delayed_pic[0])); + h->delayed_pic[pics++] = cur; if(cur->reference == 0) cur->reference = 1; diff --git a/src/libffmpeg/libavcodec/i386/idct_mmx.c b/src/libffmpeg/libavcodec/i386/idct_mmx.c index ba595845a..4c548fdce 100644 --- a/src/libffmpeg/libavcodec/i386/idct_mmx.c +++ b/src/libffmpeg/libavcodec/i386/idct_mmx.c @@ -15,7 +15,7 @@ * 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 + * along with mpeg2dec; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/src/libffmpeg/libavcodec/imgconvert.c b/src/libffmpeg/libavcodec/imgconvert.c index d5b4cdca0..b2305cd63 100644 --- a/src/libffmpeg/libavcodec/imgconvert.c +++ b/src/libffmpeg/libavcodec/imgconvert.c @@ -2252,48 +2252,61 @@ int img_crop(AVPicture *dst, const AVPicture *src, /** * Pad image */ -int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt, - int padtop, int padbottom, int padleft, int padright, int *color) +int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, + int pix_fmt, int padtop, int padbottom, int padleft, int padright, + int *color) { - uint8_t *optr, *iptr; + uint8_t *optr; int y_shift; int x_shift; int yheight; int i, y; - if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB || !is_yuv_planar(&pix_fmt_info[pix_fmt])) - return -1; + if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB || + !is_yuv_planar(&pix_fmt_info[pix_fmt])) return -1; for (i = 0; i < 3; i++) { x_shift = i ? pix_fmt_info[pix_fmt].x_chroma_shift : 0; y_shift = i ? pix_fmt_info[pix_fmt].y_chroma_shift : 0; if (padtop || padleft) { - memset(dst->data[i], color[i], dst->linesize[i] * (padtop >> y_shift) + (padleft >> x_shift)); + memset(dst->data[i], color[i], + dst->linesize[i] * (padtop >> y_shift) + (padleft >> x_shift)); } - if (padleft || padright || src) { - if (src) { /* first line */ - iptr = src->data[i]; - optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) + (padleft >> x_shift); - memcpy(optr, iptr, src->linesize[i]); - iptr += src->linesize[i]; + if (padleft || padright) { + optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) + + (dst->linesize[i] - (padright >> x_shift)); + yheight = (height - 1 - (padtop + padbottom)) >> y_shift; + for (y = 0; y < yheight; y++) { + memset(optr, color[i], (padleft + padright) >> x_shift); + optr += dst->linesize[i]; } - optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) + (dst->linesize[i] - (padright >> x_shift)); + } + + if (src) { /* first line */ + uint8_t *iptr = src->data[i]; + optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) + + (padleft >> x_shift); + memcpy(optr, iptr, src->linesize[i]); + iptr += src->linesize[i]; + optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) + + (dst->linesize[i] - (padright >> x_shift)); yheight = (height - 1 - (padtop + padbottom)) >> y_shift; for (y = 0; y < yheight; y++) { memset(optr, color[i], (padleft + padright) >> x_shift); - if (src) { - memcpy(optr + ((padleft + padright) >> x_shift), iptr, src->linesize[i]); - iptr += src->linesize[i]; - } + memcpy(optr + ((padleft + padright) >> x_shift), iptr, + src->linesize[i]); + iptr += src->linesize[i]; optr += dst->linesize[i]; } } if (padbottom || padright) { - optr = dst->data[i] + dst->linesize[i] * ((height - padbottom) >> y_shift) - (padright >> x_shift); - memset(optr, color[i], dst->linesize[i] * (padbottom >> y_shift) + (padright >> x_shift)); + optr = dst->data[i] + dst->linesize[i] * + ((height - padbottom) >> y_shift) - (padright >> x_shift); + memset(optr, color[i],dst->linesize[i] * + (padbottom >> y_shift) + (padright >> x_shift)); } } return 0; diff --git a/src/libffmpeg/libavcodec/imgresample.c b/src/libffmpeg/libavcodec/imgresample.c index ce1a05ce4..adcfd0481 100644 --- a/src/libffmpeg/libavcodec/imgresample.c +++ b/src/libffmpeg/libavcodec/imgresample.c @@ -672,6 +672,8 @@ struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, void sws_freeContext(struct SwsContext *ctx) { + if (!ctx) + return; if ((ctx->resampling_ctx->iwidth != ctx->resampling_ctx->owidth) || (ctx->resampling_ctx->iheight != ctx->resampling_ctx->oheight)) { img_resample_close(ctx->resampling_ctx); diff --git a/src/libffmpeg/libavcodec/kmvc.c b/src/libffmpeg/libavcodec/kmvc.c index e8f39fca1..28dc01483 100644 --- a/src/libffmpeg/libavcodec/kmvc.c +++ b/src/libffmpeg/libavcodec/kmvc.c @@ -368,13 +368,13 @@ static int decode_init(AVCodecContext * avctx) av_log(NULL, 0, "Extradata missing, decoding may not work properly...\n"); c->palsize = 127; } else { - c->palsize = LE_16(avctx->extradata + 10); + c->palsize = AV_RL16(avctx->extradata + 10); } if (avctx->extradata_size == 1036) { // palette in extradata uint8_t *src = avctx->extradata + 12; for (i = 0; i < 256; i++) { - c->pal[i] = LE_32(src); + c->pal[i] = AV_RL32(src); src += 4; } c->setpal = 1; diff --git a/src/libffmpeg/libavcodec/loco.c b/src/libffmpeg/libavcodec/loco.c index 2ec850ed0..b1f99f425 100644 --- a/src/libffmpeg/libavcodec/loco.c +++ b/src/libffmpeg/libavcodec/loco.c @@ -237,20 +237,20 @@ static int decode_init(AVCodecContext *avctx){ avctx->extradata_size); return -1; } - version = LE_32(avctx->extradata); + version = AV_RL32(avctx->extradata); switch(version) { case 1: l->lossy = 0; break; case 2: - l->lossy = LE_32(avctx->extradata + 8); + l->lossy = AV_RL32(avctx->extradata + 8); break; default: - l->lossy = LE_32(avctx->extradata + 8); + l->lossy = AV_RL32(avctx->extradata + 8); av_log(avctx, AV_LOG_INFO, "This is LOCO codec version %i, please upload file for study\n", version); } - l->mode = LE_32(avctx->extradata + 4); + l->mode = AV_RL32(avctx->extradata + 4); switch(l->mode) { case LOCO_CYUY2: case LOCO_YUY2: case LOCO_UYVY: avctx->pix_fmt = PIX_FMT_YUV422P; diff --git a/src/libffmpeg/libavcodec/lzo.c b/src/libffmpeg/libavcodec/lzo.c index 015c80d0d..0ee7eca04 100644 --- a/src/libffmpeg/libavcodec/lzo.c +++ b/src/libffmpeg/libavcodec/lzo.c @@ -26,7 +26,7 @@ //! define if we may write up to 12 bytes beyond the output buffer #define OUTBUF_PADDED 1 -//! define if we may read up to 4 bytes beyond the input buffer +//! define if we may read up to 8 bytes beyond the input buffer #define INBUF_PADDED 1 typedef struct LZOContext { uint8_t *in, *in_end; @@ -45,6 +45,12 @@ static inline int get_byte(LZOContext *c) { return 1; } +#ifdef INBUF_PADDED +#define GETB(c) (*(c).in++) +#else +#define GETB(c) get_byte(&(c)) +#endif + /** * \brief decode a length value in the coding used by lzo * \param x previous byte value @@ -67,11 +73,11 @@ static inline int get_len(LZOContext *c, int x, int mask) { static inline void copy(LZOContext *c, int cnt) { register uint8_t *src = c->in; register uint8_t *dst = c->out; - if (src + cnt > c->in_end) { + if (src + cnt > c->in_end || src + cnt < src) { cnt = c->in_end - src; c->error |= LZO_INPUT_DEPLETED; } - if (dst + cnt > c->out_end) { + if (dst + cnt > c->out_end || dst + cnt < dst) { cnt = c->out_end - dst; c->error |= LZO_OUTPUT_FULL; } @@ -101,11 +107,11 @@ static inline void copy(LZOContext *c, int cnt) { static inline void copy_backptr(LZOContext *c, int back, int cnt) { register uint8_t *src = &c->out[-back]; register uint8_t *dst = c->out; - if (src < c->out_start) { + if (src < c->out_start || src > dst) { c->error |= LZO_INVALID_BACKPTR; return; } - if (dst + cnt > c->out_end) { + if (dst + cnt > c->out_end || dst + cnt < dst) { cnt = c->out_end - dst; c->error |= LZO_OUTPUT_FULL; } @@ -170,10 +176,10 @@ int lzo1x_decode(void *out, int *outlen, void *in, int *inlen) { c.out = c.out_start = out; c.out_end = (uint8_t *)out + * outlen; c.error = 0; - x = get_byte(&c); + x = GETB(c); if (x > 17) { copy(&c, x - 17); - x = get_byte(&c); + x = GETB(c); if (x < 16) c.error |= LZO_ERROR; } while (!c.error) { @@ -181,16 +187,16 @@ int lzo1x_decode(void *out, int *outlen, void *in, int *inlen) { if (x >> 4) { if (x >> 6) { cnt = (x >> 5) - 1; - back = (get_byte(&c) << 3) + ((x >> 2) & 7) + 1; + back = (GETB(c) << 3) + ((x >> 2) & 7) + 1; } else if (x >> 5) { cnt = get_len(&c, x, 31); - x = get_byte(&c); - back = (get_byte(&c) << 6) + (x >> 2) + 1; + x = GETB(c); + back = (GETB(c) << 6) + (x >> 2) + 1; } else { cnt = get_len(&c, x, 7); back = (1 << 14) + ((x & 8) << 11); - x = get_byte(&c); - back += (get_byte(&c) << 6) + (x >> 2); + x = GETB(c); + back += (GETB(c) << 6) + (x >> 2); if (back == (1 << 14)) { if (cnt != 1) c.error |= LZO_ERROR; @@ -202,15 +208,15 @@ int lzo1x_decode(void *out, int *outlen, void *in, int *inlen) { case COPY: cnt = get_len(&c, x, 15); copy(&c, cnt + 3); - x = get_byte(&c); + x = GETB(c); if (x >> 4) continue; cnt = 1; - back = (1 << 11) + (get_byte(&c) << 2) + (x >> 2) + 1; + back = (1 << 11) + (GETB(c) << 2) + (x >> 2) + 1; break; case BACKPTR: cnt = 0; - back = (get_byte(&c) << 2) + (x >> 2) + 1; + back = (GETB(c) << 2) + (x >> 2) + 1; break; } copy_backptr(&c, back, cnt + 2); @@ -218,9 +224,45 @@ int lzo1x_decode(void *out, int *outlen, void *in, int *inlen) { state = cnt ? BACKPTR : COPY; if (cnt) copy(&c, cnt); - x = get_byte(&c); + x = GETB(c); + if (c.in > c.in_end) + c.error |= LZO_INPUT_DEPLETED; } *inlen = c.in_end - c.in; + if (c.in > c.in_end) + *inlen = 0; *outlen = c.out_end - c.out; return c.error; } + +#ifdef TEST +#include <stdio.h> +#include <lzo/lzo1x.h> +#include "log.h" +#define MAXSZ (10*1024*1024) +int main(int argc, char *argv[]) { + FILE *in = fopen(argv[1], "rb"); + uint8_t *orig = av_malloc(MAXSZ + 16); + uint8_t *comp = av_malloc(2*MAXSZ + 16); + uint8_t *decomp = av_malloc(MAXSZ + 16); + size_t s = fread(orig, 1, MAXSZ, in); + lzo_uint clen = 0; + long tmp[LZO1X_MEM_COMPRESS]; + int inlen, outlen; + int i; + av_log_level = AV_LOG_DEBUG; + lzo1x_999_compress(orig, s, comp, &clen, tmp); + for (i = 0; i < 300; i++) { +START_TIMER + inlen = clen; outlen = MAXSZ; + if (lzo1x_decode(decomp, &outlen, comp, &inlen)) + av_log(NULL, AV_LOG_ERROR, "decompression error\n"); +STOP_TIMER("lzod") + } + if (memcmp(orig, decomp, s)) + av_log(NULL, AV_LOG_ERROR, "decompression incorrect\n"); + else + av_log(NULL, AV_LOG_ERROR, "decompression ok\n"); + return 0; +} +#endif diff --git a/src/libffmpeg/libavcodec/lzo.h b/src/libffmpeg/libavcodec/lzo.h index 4d00dd721..5b3d98f40 100644 --- a/src/libffmpeg/libavcodec/lzo.h +++ b/src/libffmpeg/libavcodec/lzo.h @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _LZO_H +#ifndef LZO_H #define LZO_H #define LZO_INPUT_DEPLETED 1 @@ -27,7 +27,7 @@ #define LZO_INVALID_BACKPTR 4 #define LZO_ERROR 8 -#define LZO_INPUT_PADDING 4 +#define LZO_INPUT_PADDING 8 #define LZO_OUTPUT_PADDING 12 int lzo1x_decode(void *out, int *outlen, void *in, int *inlen); diff --git a/src/libffmpeg/libavcodec/mjpeg.c b/src/libffmpeg/libavcodec/mjpeg.c index 8352782c4..3d4dd9cc4 100644 --- a/src/libffmpeg/libavcodec/mjpeg.c +++ b/src/libffmpeg/libavcodec/mjpeg.c @@ -2547,12 +2547,12 @@ static int mjpega_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *av break; case SOS: bytestream_put_be32(&poutbufp, i + 46); /* scan off */ - bytestream_put_be32(&poutbufp, i + 46 + BE_16(buf + i + 2)); /* data off */ + bytestream_put_be32(&poutbufp, i + 46 + AV_RB16(buf + i + 2)); /* data off */ bytestream_put_buffer(&poutbufp, buf + 2, buf_size - 2); /* skip already written SOI */ *poutbuf_size = poutbufp - *poutbuf; return 1; case APP1: - if (i + 8 < buf_size && LE_32(buf + i + 8) == ff_get_fourcc("mjpg")) { + if (i + 8 < buf_size && AV_RL32(buf + i + 8) == ff_get_fourcc("mjpg")) { av_log(avctx, AV_LOG_ERROR, "bitstream already formatted\n"); memcpy(*poutbuf, buf, buf_size); *poutbuf_size = buf_size; diff --git a/src/libffmpeg/libavcodec/mmvideo.c b/src/libffmpeg/libavcodec/mmvideo.c index 07d3f3fc5..7ba1321cb 100644 --- a/src/libffmpeg/libavcodec/mmvideo.c +++ b/src/libffmpeg/libavcodec/mmvideo.c @@ -110,7 +110,7 @@ static void mm_decode_intra(MmContext * s, int half_horiz, int half_vert, const static void mm_decode_inter(MmContext * s, int half_horiz, int half_vert, const uint8_t *buf, int buf_size) { - const int data_ptr = 2 + LE_16(&buf[0]); + const int data_ptr = 2 + AV_RL16(&buf[0]); int d, r, y; d = data_ptr; r = 2; y = 0; @@ -162,7 +162,7 @@ static int mm_decode_frame(AVCodecContext *avctx, palette_control->palette_changed = 0; } - type = LE_16(&buf[0]); + type = AV_RL16(&buf[0]); buf += MM_PREAMBLE_SIZE; buf_size -= MM_PREAMBLE_SIZE; diff --git a/src/libffmpeg/libavcodec/mpeg12.c b/src/libffmpeg/libavcodec/mpeg12.c index 8af7bdfa7..63fb00feb 100644 --- a/src/libffmpeg/libavcodec/mpeg12.c +++ b/src/libffmpeg/libavcodec/mpeg12.c @@ -3185,6 +3185,10 @@ static int mpeg_decode_frame(AVCodecContext *avctx, if(mpeg_field_start(s2) < 0) return -1; } + if(!s2->current_picture_ptr){ + av_log(avctx, AV_LOG_ERROR, "current_picture not initalized\n"); + return -1; + } if(avctx->thread_count > 1){ int threshold= (s2->mb_height*s->slice_count + avctx->thread_count/2) / avctx->thread_count; diff --git a/src/libffmpeg/libavcodec/mpegvideo.c b/src/libffmpeg/libavcodec/mpegvideo.c index a33485549..87c913efa 100644 --- a/src/libffmpeg/libavcodec/mpegvideo.c +++ b/src/libffmpeg/libavcodec/mpegvideo.c @@ -1103,7 +1103,7 @@ int MPV_encode_init(AVCodecContext *avctx) } if(s->avctx->scenechange_threshold < 1000000000 && (s->flags & CODEC_FLAG_CLOSED_GOP)){ - av_log(avctx, AV_LOG_ERROR, "closed gop with scene change detection arent supported yet\n"); + av_log(avctx, AV_LOG_ERROR, "closed gop with scene change detection arent supported yet, set threshold to 1000000000\n"); return -1; } @@ -1553,6 +1553,7 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) /* mark&release old frames */ if (s->pict_type != B_TYPE && s->last_picture_ptr && s->last_picture_ptr != s->next_picture_ptr && s->last_picture_ptr->data[0]) { + if(s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3){ avctx->release_buffer(avctx, (AVFrame*)s->last_picture_ptr); /* release forgotten pictures */ @@ -1565,6 +1566,7 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) } } } + } } alloc: if(!s->encoding){ @@ -1602,7 +1604,6 @@ alloc: copy_picture(&s->current_picture, s->current_picture_ptr); - if(s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3){ if (s->pict_type != B_TYPE) { s->last_picture_ptr= s->next_picture_ptr; if(!s->dropable) @@ -1617,7 +1618,7 @@ alloc: if(s->last_picture_ptr) copy_picture(&s->last_picture, s->last_picture_ptr); if(s->next_picture_ptr) copy_picture(&s->next_picture, s->next_picture_ptr); - if(s->pict_type != I_TYPE && (s->last_picture_ptr==NULL || s->last_picture_ptr->data[0]==NULL)){ + if(s->pict_type != I_TYPE && (s->last_picture_ptr==NULL || s->last_picture_ptr->data[0]==NULL) && !s->dropable){ av_log(avctx, AV_LOG_ERROR, "warning: first frame is no keyframe\n"); assert(s->pict_type != B_TYPE); //these should have been dropped if we don't have a reference goto alloc; @@ -1636,7 +1637,6 @@ alloc: s->next_picture.linesize[i] *=2; } } - } s->hurry_up= s->avctx->hurry_up; s->error_resilience= avctx->error_resilience; @@ -2275,15 +2275,6 @@ static int estimate_best_b_count(MpegEncContext *s){ int csize= (c->width/2)*(c->height/2); Picture pre_input, *pre_input_ptr= i ? s->input_picture[i-1] : s->next_picture_ptr; - if(pre_input_ptr) - pre_input= *pre_input_ptr; - - if(pre_input.type != FF_BUFFER_TYPE_SHARED && i){ - pre_input.data[0]+=INPLACE_OFFSET; - pre_input.data[1]+=INPLACE_OFFSET; - pre_input.data[2]+=INPLACE_OFFSET; - } - avcodec_get_frame_defaults(&input[i]); input[i].data[0]= av_malloc(ysize + 2*csize); input[i].data[1]= input[i].data[0] + ysize; @@ -2292,7 +2283,15 @@ static int estimate_best_b_count(MpegEncContext *s){ input[i].linesize[1]= input[i].linesize[2]= c->width/2; - if(!i || s->input_picture[i-1]){ + if(pre_input_ptr && (!i || s->input_picture[i-1])) { + pre_input= *pre_input_ptr; + + if(pre_input.type != FF_BUFFER_TYPE_SHARED && i) { + pre_input.data[0]+=INPLACE_OFFSET; + pre_input.data[1]+=INPLACE_OFFSET; + pre_input.data[2]+=INPLACE_OFFSET; + } + s->dsp.shrink[scale](input[i].data[0], input[i].linesize[0], pre_input.data[0], pre_input.linesize[0], c->width, c->height); s->dsp.shrink[scale](input[i].data[1], input[i].linesize[1], pre_input.data[1], pre_input.linesize[1], c->width>>1, c->height>>1); s->dsp.shrink[scale](input[i].data[2], input[i].linesize[2], pre_input.data[2], pre_input.linesize[2], c->width>>1, c->height>>1); @@ -4651,6 +4650,7 @@ void ff_mpeg_flush(AVCodecContext *avctx){ s->parse_context.index= 0; s->parse_context.last_index= 0; s->bitstream_buffer_size=0; + s->pp_time=0; } #ifdef CONFIG_ENCODERS @@ -5399,7 +5399,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ if(s->avctx->mb_decision == FF_MB_DECISION_BITS) MPV_decode_mb(s, s->block); } else { - int motion_x, motion_y; + int motion_x = 0, motion_y = 0; s->mv_type=MV_TYPE_16X16; // only one MB-Type possible @@ -5425,7 +5425,6 @@ static int encode_thread(AVCodecContext *c, void *arg){ s->mv[0][i][0] = s->p_field_mv_table[i][j][xy][0]; s->mv[0][i][1] = s->p_field_mv_table[i][j][xy][1]; } - motion_x = motion_y = 0; break; case CANDIDATE_MB_TYPE_INTER4V: s->mv_dir = MV_DIR_FORWARD; @@ -5435,7 +5434,6 @@ static int encode_thread(AVCodecContext *c, void *arg){ s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0]; s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1]; } - motion_x= motion_y= 0; break; case CANDIDATE_MB_TYPE_DIRECT: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; @@ -5455,8 +5453,6 @@ static int encode_thread(AVCodecContext *c, void *arg){ case CANDIDATE_MB_TYPE_BIDIR: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mb_intra= 0; - motion_x=0; - motion_y=0; s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0]; @@ -5484,7 +5480,6 @@ static int encode_thread(AVCodecContext *c, void *arg){ s->mv[0][i][0] = s->b_field_mv_table[0][i][j][xy][0]; s->mv[0][i][1] = s->b_field_mv_table[0][i][j][xy][1]; } - motion_x=motion_y=0; break; case CANDIDATE_MB_TYPE_BACKWARD_I: s->mv_dir = MV_DIR_BACKWARD; @@ -5495,7 +5490,6 @@ static int encode_thread(AVCodecContext *c, void *arg){ s->mv[1][i][0] = s->b_field_mv_table[1][i][j][xy][0]; s->mv[1][i][1] = s->b_field_mv_table[1][i][j][xy][1]; } - motion_x=motion_y=0; break; case CANDIDATE_MB_TYPE_BIDIR_I: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; @@ -5508,10 +5502,8 @@ static int encode_thread(AVCodecContext *c, void *arg){ s->mv[dir][i][1] = s->b_field_mv_table[dir][i][j][xy][1]; } } - motion_x=motion_y=0; break; default: - motion_x=motion_y=0; //gcc warning fix av_log(s->avctx, AV_LOG_ERROR, "illegal MB type\n"); } @@ -6236,7 +6228,7 @@ static int dct_quantize_refine(MpegEncContext *s, //FIXME breaks denoise? uint8_t * length; uint8_t * last_length; int lambda; - int rle_index, run, q, sum; + int rle_index, run, q = 1, sum; //q is only used when s->mb_intra is true #ifdef REFINE_STATS static int count=0; static int after_last=0; diff --git a/src/libffmpeg/libavcodec/msvideo1.c b/src/libffmpeg/libavcodec/msvideo1.c index 5929e1c63..1e3f6cce2 100644 --- a/src/libffmpeg/libavcodec/msvideo1.c +++ b/src/libffmpeg/libavcodec/msvideo1.c @@ -245,25 +245,25 @@ static void msvideo1_decode_16bit(Msvideo1Context *s) flags = (byte_b << 8) | byte_a; CHECK_STREAM_PTR(4); - colors[0] = LE_16(&s->buf[stream_ptr]); + colors[0] = AV_RL16(&s->buf[stream_ptr]); stream_ptr += 2; - colors[1] = LE_16(&s->buf[stream_ptr]); + colors[1] = AV_RL16(&s->buf[stream_ptr]); stream_ptr += 2; if (colors[0] & 0x8000) { /* 8-color encoding */ CHECK_STREAM_PTR(12); - colors[2] = LE_16(&s->buf[stream_ptr]); + colors[2] = AV_RL16(&s->buf[stream_ptr]); stream_ptr += 2; - colors[3] = LE_16(&s->buf[stream_ptr]); + colors[3] = AV_RL16(&s->buf[stream_ptr]); stream_ptr += 2; - colors[4] = LE_16(&s->buf[stream_ptr]); + colors[4] = AV_RL16(&s->buf[stream_ptr]); stream_ptr += 2; - colors[5] = LE_16(&s->buf[stream_ptr]); + colors[5] = AV_RL16(&s->buf[stream_ptr]); stream_ptr += 2; - colors[6] = LE_16(&s->buf[stream_ptr]); + colors[6] = AV_RL16(&s->buf[stream_ptr]); stream_ptr += 2; - colors[7] = LE_16(&s->buf[stream_ptr]); + colors[7] = AV_RL16(&s->buf[stream_ptr]); stream_ptr += 2; for (pixel_y = 0; pixel_y < 4; pixel_y++) { diff --git a/src/libffmpeg/libavcodec/nuv.c b/src/libffmpeg/libavcodec/nuv.c index 592d3de03..19e343056 100644 --- a/src/libffmpeg/libavcodec/nuv.c +++ b/src/libffmpeg/libavcodec/nuv.c @@ -64,9 +64,9 @@ static int get_quant(AVCodecContext *avctx, NuvContext *c, return -1; } for (i = 0; i < 64; i++, buf += 4) - c->lq[i] = LE_32(buf); + c->lq[i] = AV_RL32(buf); for (i = 0; i < 64; i++, buf += 4) - c->cq[i] = LE_32(buf); + c->cq[i] = AV_RL32(buf); return 0; } diff --git a/src/libffmpeg/libavcodec/opt.c b/src/libffmpeg/libavcodec/opt.c index a200d9a82..70babd587 100644 --- a/src/libffmpeg/libavcodec/opt.c +++ b/src/libffmpeg/libavcodec/opt.c @@ -31,9 +31,9 @@ #include "eval.h" //FIXME order them and do a bin search -static AVOption *find_opt(void *v, const char *name, const char *unit){ +static const AVOption *find_opt(void *v, const char *name, const char *unit){ AVClass *c= *(AVClass**)v; //FIXME silly way of storing AVClass - AVOption *o= c->option; + const AVOption *o= c->option; for(;o && o->name; o++){ if(!strcmp(o->name, name) && (!unit || !strcmp(o->unit, unit)) ) @@ -42,14 +42,14 @@ static AVOption *find_opt(void *v, const char *name, const char *unit){ return NULL; } -AVOption *av_next_option(void *obj, AVOption *last){ +const AVOption *av_next_option(void *obj, const AVOption *last){ if(last && last[1].name) return ++last; else if(last) return NULL; else return (*(AVClass**)obj)->option; } -static AVOption *av_set_number(void *obj, const char *name, double num, int den, int64_t intnum){ - AVOption *o= find_opt(obj, name, NULL); +static const AVOption *av_set_number(void *obj, const char *name, double num, int den, int64_t intnum){ + const AVOption *o= find_opt(obj, name, NULL); void *dst; if(!o || o->offset<=0) return NULL; @@ -76,10 +76,10 @@ static AVOption *av_set_number(void *obj, const char *name, double num, int den, return o; } -static AVOption *set_all_opt(void *v, const char *unit, double d){ +static const AVOption *set_all_opt(void *v, const char *unit, double d){ AVClass *c= *(AVClass**)v; //FIXME silly way of storing AVClass - AVOption *o= c->option; - AVOption *ret=NULL; + const AVOption *o= c->option; + const AVOption *ret=NULL; for(;o && o->name; o++){ if(o->type != FF_OPT_TYPE_CONST && o->unit && !strcmp(o->unit, unit)){ @@ -108,8 +108,8 @@ static const char *const_names[]={ 0 }; -AVOption *av_set_string(void *obj, const char *name, const char *val){ - AVOption *o= find_opt(obj, name, NULL); +const AVOption *av_set_string(void *obj, const char *name, const char *val){ + const AVOption *o= find_opt(obj, name, NULL); if(o && o->offset==0 && o->type == FF_OPT_TYPE_CONST && o->unit){ return set_all_opt(obj, o->unit, o->default_val); } @@ -133,7 +133,7 @@ AVOption *av_set_string(void *obj, const char *name, const char *val){ d = ff_eval2(buf, const_values, const_names, NULL, NULL, NULL, NULL, NULL, &error); if(isnan(d)) { - AVOption *o_named= find_opt(obj, buf, o->unit); + const AVOption *o_named= find_opt(obj, buf, o->unit); if(o_named && o_named->type == FF_OPT_TYPE_CONST) d= o_named->default_val; else if(!strcmp(buf, "default")) d= o->default_val; @@ -162,15 +162,15 @@ AVOption *av_set_string(void *obj, const char *name, const char *val){ return o; } -AVOption *av_set_double(void *obj, const char *name, double n){ +const AVOption *av_set_double(void *obj, const char *name, double n){ return av_set_number(obj, name, n, 1, 1); } -AVOption *av_set_q(void *obj, const char *name, AVRational n){ +const AVOption *av_set_q(void *obj, const char *name, AVRational n){ return av_set_number(obj, name, n.num, n.den, 1); } -AVOption *av_set_int(void *obj, const char *name, int64_t n){ +const AVOption *av_set_int(void *obj, const char *name, int64_t n){ return av_set_number(obj, name, 1, 1, n); } @@ -179,8 +179,8 @@ AVOption *av_set_int(void *obj, const char *name, int64_t n){ * @param buf a buffer which is used for returning non string values as strings, can be NULL * @param buf_len allocated length in bytes of buf */ -const char *av_get_string(void *obj, const char *name, AVOption **o_out, char *buf, int buf_len){ - AVOption *o= find_opt(obj, name, NULL); +const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len){ + const AVOption *o= find_opt(obj, name, NULL); void *dst; if(!o || o->offset<=0) return NULL; @@ -205,8 +205,8 @@ const char *av_get_string(void *obj, const char *name, AVOption **o_out, char *b return buf; } -static int av_get_number(void *obj, const char *name, AVOption **o_out, double *num, int *den, int64_t *intnum){ - AVOption *o= find_opt(obj, name, NULL); +static int av_get_number(void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum){ + const AVOption *o= find_opt(obj, name, NULL); void *dst; if(!o || o->offset<=0) goto error; @@ -230,7 +230,7 @@ error: return -1; } -double av_get_double(void *obj, const char *name, AVOption **o_out){ +double av_get_double(void *obj, const char *name, const AVOption **o_out){ int64_t intnum=1; double num=1; int den=1; @@ -239,7 +239,7 @@ double av_get_double(void *obj, const char *name, AVOption **o_out){ return num*intnum/den; } -AVRational av_get_q(void *obj, const char *name, AVOption **o_out){ +AVRational av_get_q(void *obj, const char *name, const AVOption **o_out){ int64_t intnum=1; double num=1; int den=1; @@ -251,7 +251,7 @@ AVRational av_get_q(void *obj, const char *name, AVOption **o_out){ return av_d2q(num*intnum/den, 1<<24); } -int64_t av_get_int(void *obj, const char *name, AVOption **o_out){ +int64_t av_get_int(void *obj, const char *name, const AVOption **o_out){ int64_t intnum=1; double num=1; int den=1; @@ -260,9 +260,9 @@ int64_t av_get_int(void *obj, const char *name, AVOption **o_out){ return num*intnum/den; } -static void opt_list(void *obj, void *av_log_obj, char *unit) +static void opt_list(void *obj, void *av_log_obj, const char *unit) { - AVOption *opt=NULL; + const AVOption *opt=NULL; while((opt= av_next_option(obj, opt))){ if(!(opt->flags & (AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM))) @@ -345,7 +345,7 @@ int av_opt_show(void *obj, void *av_log_obj){ */ void av_opt_set_defaults(void *s) { - AVOption *opt = NULL; + const AVOption *opt = NULL; while ((opt = av_next_option(s, opt)) != NULL) { switch(opt->type) { case FF_OPT_TYPE_CONST: diff --git a/src/libffmpeg/libavcodec/opt.h b/src/libffmpeg/libavcodec/opt.h index b8a17031b..ff65456d8 100644 --- a/src/libffmpeg/libavcodec/opt.h +++ b/src/libffmpeg/libavcodec/opt.h @@ -68,15 +68,15 @@ typedef struct AVOption { } AVOption; -AVOption *av_set_string(void *obj, const char *name, const char *val); -AVOption *av_set_double(void *obj, const char *name, double n); -AVOption *av_set_q(void *obj, const char *name, AVRational n); -AVOption *av_set_int(void *obj, const char *name, int64_t n); -double av_get_double(void *obj, const char *name, AVOption **o_out); -AVRational av_get_q(void *obj, const char *name, AVOption **o_out); -int64_t av_get_int(void *obj, const char *name, AVOption **o_out); -const char *av_get_string(void *obj, const char *name, AVOption **o_out, char *buf, int buf_len); -AVOption *av_next_option(void *obj, AVOption *last); +const AVOption *av_set_string(void *obj, const char *name, const char *val); +const AVOption *av_set_double(void *obj, const char *name, double n); +const AVOption *av_set_q(void *obj, const char *name, AVRational n); +const AVOption *av_set_int(void *obj, const char *name, int64_t n); +double av_get_double(void *obj, const char *name, const AVOption **o_out); +AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); +int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); +const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); +const AVOption *av_next_option(void *obj, const AVOption *last); int av_opt_show(void *obj, void *av_log_obj); void av_opt_set_defaults(void *s); diff --git a/src/libffmpeg/libavcodec/parser.c b/src/libffmpeg/libavcodec/parser.c index 740ad855c..62a95c1a4 100644 --- a/src/libffmpeg/libavcodec/parser.c +++ b/src/libffmpeg/libavcodec/parser.c @@ -632,9 +632,14 @@ static const int ac3_bitrates[64] = { 384, 448, 448, 512, 512, 576, 576, 640, 640, }; -static const int ac3_channels[8] = { +static const uint8_t ac3_channels[8] = { 2, 1, 2, 3, 3, 4, 4, 5 }; + +static const uint8_t eac3_blocks[4] = { + 1, 2, 3, 6 +}; + #endif /* CONFIG_AC3_PARSER */ #ifdef CONFIG_AAC_PARSER @@ -653,6 +658,7 @@ static int ac3_sync(const uint8_t *buf, int *channels, int *sample_rate, int *bit_rate, int *samples) { unsigned int fscod, frmsizecod, acmod, bsid, lfeon; + unsigned int strmtyp, substreamid, frmsiz, fscod2, numblkscod; GetBitContext bits; init_get_bits(&bits, buf, AC3_HEADER_SIZE * 8); @@ -660,32 +666,67 @@ static int ac3_sync(const uint8_t *buf, int *channels, int *sample_rate, if(get_bits(&bits, 16) != 0x0b77) return 0; - skip_bits(&bits, 16); /* crc */ - fscod = get_bits(&bits, 2); - frmsizecod = get_bits(&bits, 6); + bsid = show_bits_long(&bits, 29) & 0x1f; + if(bsid <= 8) { /* Normal AC-3 */ + skip_bits(&bits, 16); /* crc */ + fscod = get_bits(&bits, 2); + frmsizecod = get_bits(&bits, 6); + + if(fscod == 3) + return 0; + + skip_bits(&bits, 5); /* bsid */ + skip_bits(&bits, 3); /* bsmod */ + acmod = get_bits(&bits, 3); + if(acmod & 1 && acmod != 1) + skip_bits(&bits, 2); /* cmixlev */ + if(acmod & 4) + skip_bits(&bits, 2); /* surmixlev */ + if(acmod & 2) + skip_bits(&bits, 2); /* dsurmod */ + lfeon = get_bits1(&bits); + + *sample_rate = ac3_sample_rates[fscod]; + *bit_rate = ac3_bitrates[frmsizecod] * 1000; + *channels = ac3_channels[acmod] + lfeon; + *samples = 6 * 256; + + return ac3_frame_sizes[frmsizecod][fscod] * 2; + } else if (bsid >= 10 && bsid <= 16) { /* Enhanced AC-3 */ + strmtyp = get_bits(&bits, 2); + substreamid = get_bits(&bits, 3); + + if (strmtyp != 0 || substreamid != 0) + return 0; /* Currently don't support additional streams */ + + frmsiz = get_bits(&bits, 11) + 1; + fscod = get_bits(&bits, 2); + if (fscod == 3) { + fscod2 = get_bits(&bits, 2); + numblkscod = 3; + + if(fscod2 == 3) + return 0; + + *sample_rate = ac3_sample_rates[fscod2] / 2; + } else { + numblkscod = get_bits(&bits, 2); - if(!ac3_sample_rates[fscod]) - return 0; + *sample_rate = ac3_sample_rates[fscod]; + } - bsid = get_bits(&bits, 5); - if(bsid > 8) - return 0; - skip_bits(&bits, 3); /* bsmod */ - acmod = get_bits(&bits, 3); - if(acmod & 1 && acmod != 1) - skip_bits(&bits, 2); /* cmixlev */ - if(acmod & 4) - skip_bits(&bits, 2); /* surmixlev */ - if(acmod & 2) - skip_bits(&bits, 2); /* dsurmod */ - lfeon = get_bits1(&bits); - - *sample_rate = ac3_sample_rates[fscod]; - *bit_rate = ac3_bitrates[frmsizecod] * 1000; - *channels = ac3_channels[acmod] + lfeon; - *samples = 6 * 256; - - return ac3_frame_sizes[frmsizecod][fscod] * 2; + acmod = get_bits(&bits, 3); + lfeon = get_bits1(&bits); + + *samples = eac3_blocks[numblkscod] * 256; + *bit_rate = frmsiz * (*sample_rate) * 16 / (*samples); + *channels = ac3_channels[acmod] + lfeon; + + return frmsiz * 2; + } + + /* Unsupported bitstream version */ + return 0; } #endif /* CONFIG_AC3_PARSER */ diff --git a/src/libffmpeg/libavcodec/pcm.c b/src/libffmpeg/libavcodec/pcm.c index 26c38b329..4011ed3b5 100644 --- a/src/libffmpeg/libavcodec/pcm.c +++ b/src/libffmpeg/libavcodec/pcm.c @@ -410,8 +410,8 @@ static int pcm_decode_frame(AVCodecContext *avctx, samples = data; src = buf; - if(buf_size > AVCODEC_MAX_AUDIO_FRAME_SIZE/2) - buf_size = AVCODEC_MAX_AUDIO_FRAME_SIZE/2; + buf_size= FFMIN(buf_size, *data_size/2); + *data_size=0; switch(avctx->codec->id) { case CODEC_ID_PCM_S32LE: diff --git a/src/libffmpeg/libavcodec/ppc/dsputil_altivec.c b/src/libffmpeg/libavcodec/ppc/dsputil_altivec.c index 6f48893a4..bbc53d761 100644 --- a/src/libffmpeg/libavcodec/ppc/dsputil_altivec.c +++ b/src/libffmpeg/libavcodec/ppc/dsputil_altivec.c @@ -1107,12 +1107,10 @@ POWERPC_PERF_START_COUNT(altivec_hadamard8_diff8x8_num, 1); register vector signed short srcV, dstV; \ register vector signed short but0, but1, but2, op1, op2, op3; \ src1 = vec_ld(stride * i, src); \ - if ((((stride * i) + (unsigned long)src) & 0x0000000F) > 8) \ - src2 = vec_ld((stride * i) + 16, src); \ + src2 = vec_ld((stride * i) + 15, src); \ srcO = vec_perm(src1, src2, vec_lvsl(stride * i, src)); \ dst1 = vec_ld(stride * i, dst); \ - if ((((stride * i) + (unsigned long)dst) & 0x0000000F) > 8) \ - dst2 = vec_ld((stride * i) + 16, dst); \ + dst2 = vec_ld((stride * i) + 15, dst); \ dstO = vec_perm(dst1, dst2, vec_lvsl(stride * i, dst)); \ /* promote the unsigned chars to signed shorts */ \ /* we're in the 8x8 function, we only care for the first 8 */ \ diff --git a/src/libffmpeg/libavcodec/ppc/float_altivec.c b/src/libffmpeg/libavcodec/ppc/float_altivec.c index c6e43dec2..22c2de61a 100644 --- a/src/libffmpeg/libavcodec/ppc/float_altivec.c +++ b/src/libffmpeg/libavcodec/ppc/float_altivec.c @@ -76,7 +76,6 @@ static void vector_fmul_add_add_altivec(float *dst, const float *src0, vector unsigned char align = vec_lvsr(0,dst), mask = vec_lvsl(0, dst); - t0 = vec_ld(0, dst); #if 0 //FIXME: there is still something wrong if (step == 2) { int y; @@ -134,6 +133,7 @@ static void vector_fmul_add_add_altivec(float *dst, const float *src0, #endif if (step == 1 && src3 == 0) for (i=0; i<len-3; i+=4) { + t0 = vec_ld(0, dst+i); t1 = vec_ld(15, dst+i); s0 = vec_ld(0, src0+i); s1 = vec_ld(0, src1+i); @@ -144,7 +144,6 @@ static void vector_fmul_add_add_altivec(float *dst, const float *src0, t0 = vec_perm(edges, d, align); vec_st(t1, 15, dst+i); vec_st(t0, 0, dst+i); - t0 = t1; } else ff_vector_fmul_add_add_c(dst, src0, src1, src2, src3, len, step); diff --git a/src/libffmpeg/libavcodec/qdm2.c b/src/libffmpeg/libavcodec/qdm2.c index b9462f3cb..a2630fe7f 100644 --- a/src/libffmpeg/libavcodec/qdm2.c +++ b/src/libffmpeg/libavcodec/qdm2.c @@ -1836,7 +1836,7 @@ static int qdm2_decode_init(AVCodecContext *avctx) extradata += 8; extradata_size -= 8; - size = BE_32(extradata); + size = AV_RB32(extradata); if(size > extradata_size){ av_log(avctx, AV_LOG_ERROR, "extradata size too small, %i < %i\n", @@ -1846,29 +1846,29 @@ static int qdm2_decode_init(AVCodecContext *avctx) extradata += 4; av_log(avctx, AV_LOG_DEBUG, "size: %d\n", size); - if (BE_32(extradata) != MKBETAG('Q','D','C','A')) { + if (AV_RB32(extradata) != MKBETAG('Q','D','C','A')) { av_log(avctx, AV_LOG_ERROR, "invalid extradata, expecting QDCA\n"); return -1; } extradata += 8; - avctx->channels = s->nb_channels = s->channels = BE_32(extradata); + avctx->channels = s->nb_channels = s->channels = AV_RB32(extradata); extradata += 4; - avctx->sample_rate = BE_32(extradata); + avctx->sample_rate = AV_RB32(extradata); extradata += 4; - avctx->bit_rate = BE_32(extradata); + avctx->bit_rate = AV_RB32(extradata); extradata += 4; - s->group_size = BE_32(extradata); + s->group_size = AV_RB32(extradata); extradata += 4; - s->fft_size = BE_32(extradata); + s->fft_size = AV_RB32(extradata); extradata += 4; - s->checksum_size = BE_32(extradata); + s->checksum_size = AV_RB32(extradata); extradata += 4; s->fft_order = av_log2(s->fft_size) + 1; diff --git a/src/libffmpeg/libavcodec/qdrw.c b/src/libffmpeg/libavcodec/qdrw.c index 8ebb43c4a..664be2f4f 100644 --- a/src/libffmpeg/libavcodec/qdrw.c +++ b/src/libffmpeg/libavcodec/qdrw.c @@ -58,7 +58,7 @@ static int decode_frame(AVCodecContext *avctx, outdata = a->pic.data[0]; buf += 0x68; /* jump to palette */ - colors = BE_32(buf); + colors = AV_RB32(buf); buf += 4; if(colors < 0 || colors > 256) { @@ -68,7 +68,7 @@ static int decode_frame(AVCodecContext *avctx, for (i = 0; i <= colors; i++) { unsigned int idx; - idx = BE_16(buf); /* color index */ + idx = AV_RB16(buf); /* color index */ buf += 2; if (idx > 255) { @@ -93,7 +93,7 @@ static int decode_frame(AVCodecContext *avctx, /* decode line */ out = outdata; - size = BE_16(buf); /* size of packed line */ + size = AV_RB16(buf); /* size of packed line */ buf += 2; left = size; next = buf + size; diff --git a/src/libffmpeg/libavcodec/qtrle.c b/src/libffmpeg/libavcodec/qtrle.c index d4b314d03..0ccca28c6 100644 --- a/src/libffmpeg/libavcodec/qtrle.c +++ b/src/libffmpeg/libavcodec/qtrle.c @@ -96,15 +96,15 @@ static void qtrle_decode_4bpp(QtrleContext *s) /* fetch the header */ CHECK_STREAM_PTR(2); - header = BE_16(&s->buf[stream_ptr]); + header = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 2; /* if a header is present, fetch additional decoding parameters */ if (header & 0x0008) { CHECK_STREAM_PTR(8); - start_line = BE_16(&s->buf[stream_ptr]); + start_line = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 4; - lines_to_change = BE_16(&s->buf[stream_ptr]); + lines_to_change = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 4; } else { start_line = 0; @@ -187,15 +187,15 @@ static void qtrle_decode_8bpp(QtrleContext *s) /* fetch the header */ CHECK_STREAM_PTR(2); - header = BE_16(&s->buf[stream_ptr]); + header = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 2; /* if a header is present, fetch additional decoding parameters */ if (header & 0x0008) { CHECK_STREAM_PTR(8); - start_line = BE_16(&s->buf[stream_ptr]); + start_line = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 4; - lines_to_change = BE_16(&s->buf[stream_ptr]); + lines_to_change = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 4; } else { start_line = 0; @@ -269,15 +269,15 @@ static void qtrle_decode_16bpp(QtrleContext *s) /* fetch the header */ CHECK_STREAM_PTR(2); - header = BE_16(&s->buf[stream_ptr]); + header = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 2; /* if a header is present, fetch additional decoding parameters */ if (header & 0x0008) { CHECK_STREAM_PTR(8); - start_line = BE_16(&s->buf[stream_ptr]); + start_line = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 4; - lines_to_change = BE_16(&s->buf[stream_ptr]); + lines_to_change = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 4; } else { start_line = 0; @@ -299,7 +299,7 @@ static void qtrle_decode_16bpp(QtrleContext *s) /* decode the run length code */ rle_code = -rle_code; CHECK_STREAM_PTR(2); - rgb16 = BE_16(&s->buf[stream_ptr]); + rgb16 = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 2; CHECK_PIXEL_PTR(rle_code * 2); @@ -314,7 +314,7 @@ static void qtrle_decode_16bpp(QtrleContext *s) /* copy pixels directly to output */ while (rle_code--) { - rgb16 = BE_16(&s->buf[stream_ptr]); + rgb16 = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 2; *(unsigned short *)(&rgb[pixel_ptr]) = rgb16; pixel_ptr += 2; @@ -347,15 +347,15 @@ static void qtrle_decode_24bpp(QtrleContext *s) /* fetch the header */ CHECK_STREAM_PTR(2); - header = BE_16(&s->buf[stream_ptr]); + header = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 2; /* if a header is present, fetch additional decoding parameters */ if (header & 0x0008) { CHECK_STREAM_PTR(8); - start_line = BE_16(&s->buf[stream_ptr]); + start_line = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 4; - lines_to_change = BE_16(&s->buf[stream_ptr]); + lines_to_change = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 4; } else { start_line = 0; @@ -427,15 +427,15 @@ static void qtrle_decode_32bpp(QtrleContext *s) /* fetch the header */ CHECK_STREAM_PTR(2); - header = BE_16(&s->buf[stream_ptr]); + header = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 2; /* if a header is present, fetch additional decoding parameters */ if (header & 0x0008) { CHECK_STREAM_PTR(8); - start_line = BE_16(&s->buf[stream_ptr]); + start_line = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 4; - lines_to_change = BE_16(&s->buf[stream_ptr]); + lines_to_change = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 4; } else { start_line = 0; diff --git a/src/libffmpeg/libavcodec/rangecoder.c b/src/libffmpeg/libavcodec/rangecoder.c index 1f35d0852..fcd564ace 100644 --- a/src/libffmpeg/libavcodec/rangecoder.c +++ b/src/libffmpeg/libavcodec/rangecoder.c @@ -66,28 +66,6 @@ void ff_build_rac_states(RangeCoder *c, int factor, int max_p){ memset(c->zero_state, 0, sizeof(c->zero_state)); memset(c-> one_state, 0, sizeof(c-> one_state)); -#if 0 - for(i=1; i<256; i++){ - if(c->one_state[i]) - continue; - - p= (i*one + 128) >> 8; - last_p8= i; - for(;;){ - p+= ((one-p)*factor + one/2) >> 32; - p8= (256*p + one/2) >> 32; //FIXME try without the one - if(p8 <= last_p8) p8= last_p8+1; - if(p8 > max_p) p8= max_p; - if(p8 < last_p8) - break; - c->one_state[last_p8]= p8; - if(p8 == last_p8) - break; - last_p8= p8; - } - } -#endif -#if 1 last_p8= 0; p= one/2; for(i=0; i<128; i++){ @@ -99,7 +77,7 @@ void ff_build_rac_states(RangeCoder *c, int factor, int max_p){ p+= ((one-p)*factor + one/2) >> 32; last_p8= p8; } -#endif + for(i=256-max_p; i<=max_p; i++){ if(c->one_state[i]) continue; @@ -114,10 +92,6 @@ void ff_build_rac_states(RangeCoder *c, int factor, int max_p){ for(i=1; i<255; i++) c->zero_state[i]= 256-c->one_state[256-i]; -#if 0 - for(i=0; i<256; i++) - av_log(NULL, AV_LOG_DEBUG, "%3d %3d\n", i, c->one_state[i]); -#endif } /** @@ -155,7 +129,6 @@ int main(){ r[i]= random()%7; } - for(i=0; i<SIZE; i++){ START_TIMER put_rac(&c, state, r[i]&1); @@ -177,5 +150,4 @@ STOP_TIMER("get_rac") return 0; } - #endif diff --git a/src/libffmpeg/libavcodec/rpza.c b/src/libffmpeg/libavcodec/rpza.c index 9a996da37..8ab5dbb92 100644 --- a/src/libffmpeg/libavcodec/rpza.c +++ b/src/libffmpeg/libavcodec/rpza.c @@ -98,7 +98,7 @@ static void rpza_decode_stream(RpzaContext *s) s->buf[stream_ptr]); /* Get chunk size, ingnoring first byte */ - chunk_size = BE_32(&s->buf[stream_ptr]) & 0x00FFFFFF; + chunk_size = AV_RB32(&s->buf[stream_ptr]) & 0x00FFFFFF; stream_ptr += 4; /* If length mismatch use size from MOV file and try to decode anyway */ @@ -140,7 +140,7 @@ static void rpza_decode_stream(RpzaContext *s) /* Fill blocks with one color */ case 0xa0: - colorA = BE_16 (&s->buf[stream_ptr]); + colorA = AV_RB16 (&s->buf[stream_ptr]); stream_ptr += 2; while (n_blocks--) { block_ptr = row_ptr + pixel_ptr; @@ -157,10 +157,10 @@ static void rpza_decode_stream(RpzaContext *s) /* Fill blocks with 4 colors */ case 0xc0: - colorA = BE_16 (&s->buf[stream_ptr]); + colorA = AV_RB16 (&s->buf[stream_ptr]); stream_ptr += 2; case 0x20: - colorB = BE_16 (&s->buf[stream_ptr]); + colorB = AV_RB16 (&s->buf[stream_ptr]); stream_ptr += 2; /* sort out the colors */ @@ -209,7 +209,7 @@ static void rpza_decode_stream(RpzaContext *s) for (pixel_x = 0; pixel_x < 4; pixel_x++){ /* We already have color of upper left pixel */ if ((pixel_y != 0) || (pixel_x !=0)) { - colorA = BE_16 (&s->buf[stream_ptr]); + colorA = AV_RB16 (&s->buf[stream_ptr]); stream_ptr += 2; } pixels[block_ptr] = colorA; diff --git a/src/libffmpeg/libavcodec/rv10.c b/src/libffmpeg/libavcodec/rv10.c index 4b50609c1..af438a34b 100644 --- a/src/libffmpeg/libavcodec/rv10.c +++ b/src/libffmpeg/libavcodec/rv10.c @@ -535,7 +535,7 @@ static int rv10_decode_init(AVCodecContext *avctx) s->height = avctx->height; s->h263_long_vectors= ((uint8_t*)avctx->extradata)[3] & 1; - avctx->sub_id= BE_32((uint8_t*)avctx->extradata + 4); + avctx->sub_id= AV_RB32((uint8_t*)avctx->extradata + 4); switch(avctx->sub_id){ case 0x10000000: diff --git a/src/libffmpeg/libavcodec/smacker.c b/src/libffmpeg/libavcodec/smacker.c index 2e1784075..0bdbc7977 100644 --- a/src/libffmpeg/libavcodec/smacker.c +++ b/src/libffmpeg/libavcodec/smacker.c @@ -277,10 +277,10 @@ static int decode_header_trees(SmackVContext *smk) { GetBitContext gb; int mmap_size, mclr_size, full_size, type_size; - mmap_size = LE_32(smk->avctx->extradata); - mclr_size = LE_32(smk->avctx->extradata + 4); - full_size = LE_32(smk->avctx->extradata + 8); - type_size = LE_32(smk->avctx->extradata + 12); + mmap_size = AV_RL32(smk->avctx->extradata); + mclr_size = AV_RL32(smk->avctx->extradata + 4); + full_size = AV_RL32(smk->avctx->extradata + 8); + type_size = AV_RL32(smk->avctx->extradata + 12); init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); @@ -584,7 +584,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, int bits, stereo; int pred[2] = {0, 0}; - unp_size = LE_32(buf); + unp_size = AV_RL32(buf); init_get_bits(&gb, buf + 4, (buf_size - 4) * 8); diff --git a/src/libffmpeg/libavcodec/smc.c b/src/libffmpeg/libavcodec/smc.c index 77fae328b..349e5f81c 100644 --- a/src/libffmpeg/libavcodec/smc.c +++ b/src/libffmpeg/libavcodec/smc.c @@ -120,7 +120,7 @@ static void smc_decode_stream(SmcContext *s) s->avctx->palctrl->palette_changed = 0; } - chunk_size = BE_32(&s->buf[stream_ptr]) & 0x00FFFFFF; + chunk_size = AV_RB32(&s->buf[stream_ptr]) & 0x00FFFFFF; stream_ptr += 4; if (chunk_size != s->size) av_log(s->avctx, AV_LOG_INFO, "warning: MOV chunk size != encoded chunk size (%d != %d); using MOV chunk size\n", @@ -278,7 +278,7 @@ static void smc_decode_stream(SmcContext *s) color_table_index = CPAIR * s->buf[stream_ptr++]; while (n_blocks--) { - color_flags = BE_16(&s->buf[stream_ptr]); + color_flags = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 2; flag_mask = 0x8000; block_ptr = row_ptr + pixel_ptr; @@ -321,7 +321,7 @@ static void smc_decode_stream(SmcContext *s) color_table_index = CQUAD * s->buf[stream_ptr++]; while (n_blocks--) { - color_flags = BE_32(&s->buf[stream_ptr]); + color_flags = AV_RB32(&s->buf[stream_ptr]); stream_ptr += 4; /* flag mask actually acts as a bit shift count here */ flag_mask = 30; diff --git a/src/libffmpeg/libavcodec/snow.c b/src/libffmpeg/libavcodec/snow.c index aec0375f6..03e634bf1 100644 --- a/src/libffmpeg/libavcodec/snow.c +++ b/src/libffmpeg/libavcodec/snow.c @@ -1961,18 +1961,18 @@ static inline void init_ref(MotionEstContext *c, uint8_t *src[3], uint8_t *ref[3 } static inline void pred_mv(SnowContext *s, int *mx, int *my, int ref, - BlockNode *left, BlockNode *top, BlockNode *tr){ + const BlockNode *left, const BlockNode *top, const BlockNode *tr){ if(s->ref_frames == 1){ *mx = mid_pred(left->mx, top->mx, tr->mx); *my = mid_pred(left->my, top->my, tr->my); }else{ const int *scale = scale_mv_ref[ref]; - *mx = mid_pred(left->mx * scale[left->ref] + 128 >>8, - top ->mx * scale[top ->ref] + 128 >>8, - tr ->mx * scale[tr ->ref] + 128 >>8); - *my = mid_pred(left->my * scale[left->ref] + 128 >>8, - top ->my * scale[top ->ref] + 128 >>8, - tr ->my * scale[tr ->ref] + 128 >>8); + *mx = mid_pred((left->mx * scale[left->ref] + 128) >>8, + (top ->mx * scale[top ->ref] + 128) >>8, + (tr ->mx * scale[tr ->ref] + 128) >>8); + *my = mid_pred((left->my * scale[left->ref] + 128) >>8, + (top ->my * scale[top ->ref] + 128) >>8, + (tr ->my * scale[tr ->ref] + 128) >>8); } } @@ -2001,12 +2001,12 @@ static int encode_q_branch(SnowContext *s, int level, int x, int y){ const int block_w= 1<<(LOG2_MB_SIZE - level); int trx= (x+1)<<rem_depth; int try= (y+1)<<rem_depth; - BlockNode *left = x ? &s->block[index-1] : &null_block; - BlockNode *top = y ? &s->block[index-w] : &null_block; - BlockNode *right = trx<w ? &s->block[index+1] : &null_block; - BlockNode *bottom= try<h ? &s->block[index+w] : &null_block; - BlockNode *tl = y && x ? &s->block[index-w-1] : left; - BlockNode *tr = y && trx<w && ((x&1)==0 || level==0) ? &s->block[index-w+(1<<rem_depth)] : tl; //FIXME use lt + const BlockNode *left = x ? &s->block[index-1] : &null_block; + const BlockNode *top = y ? &s->block[index-w] : &null_block; + const BlockNode *right = trx<w ? &s->block[index+1] : &null_block; + const BlockNode *bottom= try<h ? &s->block[index+w] : &null_block; + const BlockNode *tl = y && x ? &s->block[index-w-1] : left; + const BlockNode *tr = y && trx<w && ((x&1)==0 || level==0) ? &s->block[index-w+(1<<rem_depth)] : tl; //FIXME use lt int pl = left->color[0]; int pcb= left->color[1]; int pcr= left->color[2]; @@ -2054,10 +2054,10 @@ static int encode_q_branch(SnowContext *s, int level, int x, int y){ s->m.mb_stride=2; s->m.mb_x= s->m.mb_y= 0; - s->m.me.skip= 0; + c->skip= 0; - assert(s->m.me. stride == stride); - assert(s->m.me.uvstride == uvstride); + assert(c-> stride == stride); + assert(c->uvstride == uvstride); c->penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp); c->sub_penalty_factor= get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_sub_cmp); @@ -2101,7 +2101,7 @@ static int encode_q_branch(SnowContext *s, int level, int x, int y){ assert(ref_my >= c->ymin); assert(ref_my <= c->ymax); - ref_score= s->m.me.sub_motion_search(&s->m, &ref_mx, &ref_my, ref_score, 0, 0, level-LOG2_MB_SIZE+4, block_w); + ref_score= c->sub_motion_search(&s->m, &ref_mx, &ref_my, ref_score, 0, 0, level-LOG2_MB_SIZE+4, block_w); ref_score= ff_get_mb_score(&s->m, ref_mx, ref_my, 0, 0, level-LOG2_MB_SIZE+4, block_w, 0); ref_score+= 2*av_log2(2*ref)*c->penalty_factor; if(s->ref_mvs[ref]){ @@ -2229,10 +2229,10 @@ static void encode_q_branch2(SnowContext *s, int level, int x, int y){ const int index= (x + y*w) << rem_depth; int trx= (x+1)<<rem_depth; BlockNode *b= &s->block[index]; - BlockNode *left = x ? &s->block[index-1] : &null_block; - BlockNode *top = y ? &s->block[index-w] : &null_block; - BlockNode *tl = y && x ? &s->block[index-w-1] : left; - BlockNode *tr = y && trx<w && ((x&1)==0 || level==0) ? &s->block[index-w+(1<<rem_depth)] : tl; //FIXME use lt + const BlockNode *left = x ? &s->block[index-1] : &null_block; + const BlockNode *top = y ? &s->block[index-w] : &null_block; + const BlockNode *tl = y && x ? &s->block[index-w-1] : left; + const BlockNode *tr = y && trx<w && ((x&1)==0 || level==0) ? &s->block[index-w+(1<<rem_depth)] : tl; //FIXME use lt int pl = left->color[0]; int pcb= left->color[1]; int pcr= left->color[2]; @@ -2282,10 +2282,10 @@ static void decode_q_branch(SnowContext *s, int level, int x, int y){ const int rem_depth= s->block_max_depth - level; const int index= (x + y*w) << rem_depth; int trx= (x+1)<<rem_depth; - BlockNode *left = x ? &s->block[index-1] : &null_block; - BlockNode *top = y ? &s->block[index-w] : &null_block; - BlockNode *tl = y && x ? &s->block[index-w-1] : left; - BlockNode *tr = y && trx<w && ((x&1)==0 || level==0) ? &s->block[index-w+(1<<rem_depth)] : tl; //FIXME use lt + const BlockNode *left = x ? &s->block[index-1] : &null_block; + const BlockNode *top = y ? &s->block[index-w] : &null_block; + const BlockNode *tl = y && x ? &s->block[index-w-1] : left; + const BlockNode *tr = y && trx<w && ((x&1)==0 || level==0) ? &s->block[index-w+(1<<rem_depth)] : tl; //FIXME use lt int s_context= 2*left->level + 2*top->level + tl->level + tr->level; if(s->keyframe){ @@ -2911,11 +2911,11 @@ static inline int get_block_bits(SnowContext *s, int x, int y, int w){ const int b_stride = s->b_width << s->block_max_depth; const int b_height = s->b_height<< s->block_max_depth; int index= x + y*b_stride; - BlockNode *b = &s->block[index]; - BlockNode *left = x ? &s->block[index-1] : &null_block; - BlockNode *top = y ? &s->block[index-b_stride] : &null_block; - BlockNode *tl = y && x ? &s->block[index-b_stride-1] : left; - BlockNode *tr = y && x+w<b_stride ? &s->block[index-b_stride+w] : tl; + const BlockNode *b = &s->block[index]; + const BlockNode *left = x ? &s->block[index-1] : &null_block; + const BlockNode *top = y ? &s->block[index-b_stride] : &null_block; + const BlockNode *tl = y && x ? &s->block[index-b_stride-1] : left; + const BlockNode *tr = y && x+w<b_stride ? &s->block[index-b_stride+w] : tl; int dmx, dmy; // int mx_context= av_log2(2*FFABS(left->mx - top->mx)); // int my_context= av_log2(2*FFABS(left->my - top->my)); @@ -3555,7 +3555,7 @@ static void correlate_slice_buffered(SnowContext *s, slice_buffer * sb, SubBand // START_TIMER - DWTELEM * line; + DWTELEM * line=0; // silence silly "could be used without having been initialized" warning DWTELEM * prev; if (start_y != 0) diff --git a/src/libffmpeg/libavcodec/svq3.c b/src/libffmpeg/libavcodec/svq3.c index edf3b6714..e02981e61 100644 --- a/src/libffmpeg/libavcodec/svq3.c +++ b/src/libffmpeg/libavcodec/svq3.c @@ -826,11 +826,11 @@ static int svq3_decode_frame (AVCodecContext *avctx, } /* if a match was found, parse the extra data */ - if (!memcmp (extradata, "SEQH", 4)) { + if (extradata && !memcmp (extradata, "SEQH", 4)) { GetBitContext gb; - size = BE_32(&extradata[4]); + size = AV_RB32(&extradata[4]); init_get_bits (&gb, extradata + 8, size*8); /* 'frame size code' and optional 'width, height' */ @@ -910,7 +910,8 @@ static int svq3_decode_frame (AVCodecContext *avctx, s->next_p_frame_damaged = 0; } - frame_start (h); + if (frame_start (h) < 0) + return -1; if (s->pict_type == B_TYPE) { h->frame_num_offset = (h->slice_num - h->prev_frame_num); diff --git a/src/libffmpeg/libavcodec/truemotion1.c b/src/libffmpeg/libavcodec/truemotion1.c index 11d9320c0..4b7aa976d 100644 --- a/src/libffmpeg/libavcodec/truemotion1.c +++ b/src/libffmpeg/libavcodec/truemotion1.c @@ -348,9 +348,9 @@ static int truemotion1_decode_header(TrueMotion1Context *s) header.compression = header_buffer[0]; header.deltaset = header_buffer[1]; header.vectable = header_buffer[2]; - header.ysize = LE_16(&header_buffer[3]); - header.xsize = LE_16(&header_buffer[5]); - header.checksum = LE_16(&header_buffer[7]); + header.ysize = AV_RL16(&header_buffer[3]); + header.xsize = AV_RL16(&header_buffer[5]); + header.checksum = AV_RL16(&header_buffer[7]); header.version = header_buffer[9]; header.header_type = header_buffer[10]; header.flags = header_buffer[11]; diff --git a/src/libffmpeg/libavcodec/truemotion2.c b/src/libffmpeg/libavcodec/truemotion2.c index 1b67bd22a..e9bc6b7cb 100644 --- a/src/libffmpeg/libavcodec/truemotion2.c +++ b/src/libffmpeg/libavcodec/truemotion2.c @@ -208,7 +208,7 @@ static inline int tm2_read_header(TM2Context *ctx, uint8_t *buf) obuf = buf; - magic = LE_32(buf); + magic = AV_RL32(buf); buf += 4; if(magic == 0x00000100) { /* old header */ @@ -217,7 +217,7 @@ static inline int tm2_read_header(TM2Context *ctx, uint8_t *buf) } else if(magic == 0x00000101) { /* new header */ int w, h, size, flags, xr, yr; - length = LE_32(buf); + length = AV_RL32(buf); buf += 4; init_get_bits(&ctx->gb, buf, 32 * 8); @@ -270,17 +270,17 @@ static int tm2_read_stream(TM2Context *ctx, uint8_t *buf, int stream_id) { TM2Codes codes; /* get stream length in dwords */ - len = BE_32(buf); buf += 4; cur += 4; + len = AV_RB32(buf); buf += 4; cur += 4; skip = len * 4 + 4; if(len == 0) return 4; - toks = BE_32(buf); buf += 4; cur += 4; + toks = AV_RB32(buf); buf += 4; cur += 4; if(toks & 1) { - len = BE_32(buf); buf += 4; cur += 4; + len = AV_RB32(buf); buf += 4; cur += 4; if(len == TM2_ESCAPE) { - len = BE_32(buf); buf += 4; cur += 4; + len = AV_RB32(buf); buf += 4; cur += 4; } if(len > 0) { init_get_bits(&ctx->gb, buf, (skip - cur) * 8); @@ -291,7 +291,7 @@ static int tm2_read_stream(TM2Context *ctx, uint8_t *buf, int stream_id) { } } /* skip unused fields */ - if(BE_32(buf) == TM2_ESCAPE) { + if(AV_RB32(buf) == TM2_ESCAPE) { buf += 4; cur += 4; /* some unknown length - could be escaped too */ } buf += 4; cur += 4; @@ -312,7 +312,7 @@ static int tm2_read_stream(TM2Context *ctx, uint8_t *buf, int stream_id) { } ctx->tokens[stream_id] = av_realloc(ctx->tokens[stream_id], toks * sizeof(int)); ctx->tok_lens[stream_id] = toks; - len = BE_32(buf); buf += 4; cur += 4; + len = AV_RB32(buf); buf += 4; cur += 4; if(len > 0) { init_get_bits(&ctx->gb, buf, (skip - cur) * 8); for(i = 0; i < toks; i++) diff --git a/src/libffmpeg/libavcodec/truespeech.c b/src/libffmpeg/libavcodec/truespeech.c index 077e9b037..d37aa9454 100644 --- a/src/libffmpeg/libavcodec/truespeech.c +++ b/src/libffmpeg/libavcodec/truespeech.c @@ -62,7 +62,7 @@ static void truespeech_read_frame(TSContext *dec, uint8_t *input) uint32_t t; /* first dword */ - t = LE_32(input); + t = AV_RL32(input); input += 4; dec->flag = t & 1; @@ -77,7 +77,7 @@ static void truespeech_read_frame(TSContext *dec, uint8_t *input) dec->vector[7] = ts_codebook[7][(t >> 29) & 0x7]; /* second dword */ - t = LE_32(input); + t = AV_RL32(input); input += 4; dec->offset2[0] = (t >> 0) & 0x7F; @@ -88,7 +88,7 @@ static void truespeech_read_frame(TSContext *dec, uint8_t *input) dec->offset1[0] = ((t >> 28) & 0xF) << 4; /* third dword */ - t = LE_32(input); + t = AV_RL32(input); input += 4; dec->pulseval[0] = (t >> 0) & 0x3FFF; @@ -97,7 +97,7 @@ static void truespeech_read_frame(TSContext *dec, uint8_t *input) dec->offset1[1] = (t >> 28) & 0x0F; /* fourth dword */ - t = LE_32(input); + t = AV_RL32(input); input += 4; dec->pulseval[2] = (t >> 0) & 0x3FFF; @@ -106,7 +106,7 @@ static void truespeech_read_frame(TSContext *dec, uint8_t *input) dec->offset1[1] |= ((t >> 28) & 0x0F) << 4; /* fifth dword */ - t = LE_32(input); + t = AV_RL32(input); input += 4; dec->pulsepos[0] = (t >> 4) & 0x7FFFFFF; @@ -116,7 +116,7 @@ static void truespeech_read_frame(TSContext *dec, uint8_t *input) dec->offset1[0] |= (t >> 31) & 1; /* sixth dword */ - t = LE_32(input); + t = AV_RL32(input); input += 4; dec->pulsepos[1] = (t >> 4) & 0x7FFFFFF; @@ -126,7 +126,7 @@ static void truespeech_read_frame(TSContext *dec, uint8_t *input) dec->offset1[0] |= ((t >> 31) & 1) << 1; /* seventh dword */ - t = LE_32(input); + t = AV_RL32(input); input += 4; dec->pulsepos[2] = (t >> 4) & 0x7FFFFFF; @@ -136,7 +136,7 @@ static void truespeech_read_frame(TSContext *dec, uint8_t *input) dec->offset1[0] |= ((t >> 31) & 1) << 2; /* eighth dword */ - t = LE_32(input); + t = AV_RL32(input); input += 4; dec->pulsepos[3] = (t >> 4) & 0x7FFFFFF; diff --git a/src/libffmpeg/libavcodec/tscc.c b/src/libffmpeg/libavcodec/tscc.c index a24540f37..e379abbbf 100644 --- a/src/libffmpeg/libavcodec/tscc.c +++ b/src/libffmpeg/libavcodec/tscc.c @@ -121,14 +121,14 @@ static int decode_rle(CamtasiaContext *c, unsigned int srcsize) } } else if (c->bpp == 16) { for(i = 0; i < p2; i++) { - pix16 = LE_16(src); + pix16 = AV_RL16(src); src += 2; *(uint16_t*)output = pix16; output += 2; } } else if (c->bpp == 32) { for(i = 0; i < p2; i++) { - pix32 = LE_32(src); + pix32 = AV_RL32(src); src += 4; *(uint32_t*)output = pix32; output += 4; @@ -140,7 +140,7 @@ static int decode_rle(CamtasiaContext *c, unsigned int srcsize) switch(c->bpp){ case 8: pix[0] = *src++; break; - case 16: pix16 = LE_16(src); + case 16: pix16 = AV_RL16(src); src += 2; *(uint16_t*)pix = pix16; break; @@ -148,7 +148,7 @@ static int decode_rle(CamtasiaContext *c, unsigned int srcsize) pix[1] = *src++; pix[2] = *src++; break; - case 32: pix32 = LE_32(src); + case 32: pix32 = AV_RL32(src); src += 4; *(uint32_t*)pix = pix32; break; diff --git a/src/libffmpeg/libavcodec/utils.c b/src/libffmpeg/libavcodec/utils.c index 36dcc7746..f6f061360 100644 --- a/src/libffmpeg/libavcodec/utils.c +++ b/src/libffmpeg/libavcodec/utils.c @@ -512,14 +512,14 @@ static const AVOption options[]={ {"ms", "workaround various bugs in microsofts broken decoders", 0, FF_OPT_TYPE_CONST, FF_BUG_MS, INT_MIN, INT_MAX, V|D, "bug"}, {"lelim", "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)", OFFSET(luma_elim_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"celim", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)", OFFSET(chroma_elim_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, -{"strict", "how strictly to follow the standards", OFFSET(strict_std_compliance), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "strict"}, +{"strict", "how strictly to follow the standards", OFFSET(strict_std_compliance), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|V|D, "strict"}, {"very", "strictly conform to a older more strict version of the spec or reference software", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_VERY_STRICT, INT_MIN, INT_MAX, V|E, "strict"}, {"strict", "strictly conform to all the things in the spec no matter what consequences", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_STRICT, INT_MIN, INT_MAX, V|E, "strict"}, {"normal", NULL, 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_NORMAL, INT_MIN, INT_MAX, V|E, "strict"}, {"inofficial", "allow inofficial extensions", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_INOFFICIAL, INT_MIN, INT_MAX, V|E, "strict"}, {"experimental", "allow non standarized experimental things", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_EXPERIMENTAL, INT_MIN, INT_MAX, V|E, "strict"}, {"b_qoffset", "qp offset between p and b frames", OFFSET(b_quant_offset), FF_OPT_TYPE_FLOAT, 1.25, FLT_MIN, FLT_MAX, V|E}, -{"er", "set error resilience strategy", OFFSET(error_resilience), FF_OPT_TYPE_INT, FF_ER_CAREFUL, INT_MIN, INT_MAX, V|D, "er"}, +{"er", "set error resilience strategy", OFFSET(error_resilience), FF_OPT_TYPE_INT, FF_ER_CAREFUL, INT_MIN, INT_MAX, A|V|D, "er"}, {"careful", NULL, 0, FF_OPT_TYPE_CONST, FF_ER_CAREFUL, INT_MIN, INT_MAX, V|D, "er"}, {"compliant", NULL, 0, FF_OPT_TYPE_CONST, FF_ER_COMPLIANT, INT_MIN, INT_MAX, V|D, "er"}, {"aggressive", NULL, 0, FF_OPT_TYPE_CONST, FF_ER_AGGRESSIVE, INT_MIN, INT_MAX, V|D, "er"}, @@ -918,22 +918,44 @@ int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, *number of bytes used. If no frame could be decompressed, *frame_size_ptr is zero. Otherwise, it is the decompressed frame *size in BYTES. */ -int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples, +int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, uint8_t *buf, int buf_size) { int ret; - *frame_size_ptr= 0; + //FIXME remove the check below _after_ ensuring that all audio check that the available space is enough + if(*frame_size_ptr < AVCODEC_MAX_AUDIO_FRAME_SIZE){ + av_log(avctx, AV_LOG_ERROR, "buffer smaller then AVCODEC_MAX_AUDIO_FRAME_SIZE\n"); + return -1; + } + if(*frame_size_ptr < FF_MIN_BUFFER_SIZE || + *frame_size_ptr < avctx->channels * avctx->frame_size * sizeof(int16_t) || + *frame_size_ptr < buf_size){ + av_log(avctx, AV_LOG_ERROR, "buffer too small\n"); + return -1; + } if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){ ret = avctx->codec->decode(avctx, samples, frame_size_ptr, buf, buf_size); avctx->frame_number++; - }else + }else{ ret= 0; + *frame_size_ptr=0; + } return ret; } +#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) +int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples, + int *frame_size_ptr, + uint8_t *buf, int buf_size){ + *frame_size_ptr= AVCODEC_MAX_AUDIO_FRAME_SIZE; + return avcodec_decode_audio2(avctx, samples, frame_size_ptr, buf, buf_size); +} +#endif + + /* decode a subtitle message. return -1 if error, otherwise return the *number of bytes used. If no subtitle could be decompressed, *got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. */ diff --git a/src/libffmpeg/libavcodec/vc1.c b/src/libffmpeg/libavcodec/vc1.c index 231f3ca26..40b79b326 100644 --- a/src/libffmpeg/libavcodec/vc1.c +++ b/src/libffmpeg/libavcodec/vc1.c @@ -1268,9 +1268,23 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb) v->s.avctx->coded_height = (get_bits(gb, 12) + 1) << 1; v->broadcast = get_bits1(gb); v->interlace = get_bits1(gb); + if(v->interlace){ + av_log(v->s.avctx, AV_LOG_ERROR, "Interlaced mode not supported (yet)\n"); + return -1; + } v->tfcntrflag = get_bits1(gb); v->finterpflag = get_bits1(gb); get_bits1(gb); // reserved + + av_log(v->s.avctx, AV_LOG_DEBUG, + "Advanced Profile level %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n" + "LoopFilter=%i, ChromaFormat=%i, Pulldown=%i, Interlace: %i\n" + "TFCTRflag=%i, FINTERPflag=%i\n", + v->level, v->frmrtq_postproc, v->bitrtq_postproc, + v->s.loop_filter, v->chromaformat, v->broadcast, v->interlace, + v->tfcntrflag, v->finterpflag + ); + v->psf = get_bits1(gb); if(v->psf) { //PsF, 6.1.13 av_log(v->s.avctx, AV_LOG_ERROR, "Progressive Segmented Frame mode: not supported (yet)\n"); @@ -1279,15 +1293,17 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb) if(get_bits1(gb)) { //Display Info - decoding is not affected by it int w, h, ar = 0; av_log(v->s.avctx, AV_LOG_INFO, "Display extended info:\n"); - w = get_bits(gb, 14); - h = get_bits(gb, 14); + w = get_bits(gb, 14) + 1; + h = get_bits(gb, 14) + 1; av_log(v->s.avctx, AV_LOG_INFO, "Display dimensions: %ix%i\n", w, h); - //TODO: store aspect ratio in AVCodecContext if(get_bits1(gb)) ar = get_bits(gb, 4); - if(ar == 15) { + if(ar && ar < 14){ + v->s.avctx->sample_aspect_ratio = vc1_pixel_aspect[ar]; + }else if(ar == 15){ w = get_bits(gb, 8); h = get_bits(gb, 8); + v->s.avctx->sample_aspect_ratio = (AVRational){w, h}; } if(get_bits1(gb)){ //framerate stuff @@ -1323,13 +1339,13 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb) static int decode_entry_point(AVCodecContext *avctx, GetBitContext *gb) { VC1Context *v = avctx->priv_data; - int i; + int i, blink, refdist; av_log(avctx, AV_LOG_DEBUG, "Entry point: %08X\n", show_bits_long(gb, 32)); - get_bits1(gb); // broken link + blink = get_bits1(gb); // broken link avctx->max_b_frames = 1 - get_bits1(gb); // 'closed entry' also signalize possible B-frames v->panscanflag = get_bits1(gb); - get_bits1(gb); // refdist flag + refdist = get_bits1(gb); // refdist flag v->s.loop_filter = get_bits1(gb); v->fastuvmc = get_bits1(gb); v->extended_mv = get_bits1(gb); @@ -1359,6 +1375,13 @@ static int decode_entry_point(AVCodecContext *avctx, GetBitContext *gb) skip_bits(gb, 3); // UV range, ignored for now } + av_log(avctx, AV_LOG_DEBUG, "Entry point info:\n" + "BrokenLink=%i, ClosedEntry=%i, PanscanFlag=%i\n" + "RefDist=%i, Postproc=%i, FastUVMC=%i, ExtMV=%i\n" + "DQuant=%i, VSTransform=%i, Overlap=%i, Qmode=%i\n", + blink, 1 - avctx->max_b_frames, v->panscanflag, refdist, v->s.loop_filter, + v->fastuvmc, v->extended_mv, v->dquant, v->vstransform, v->overlap, v->quantizer_mode); + return 0; } @@ -4128,7 +4151,7 @@ static int vc1_decode_init(AVCodecContext *avctx) } while(edata_size > 8) { // test if we've found header - if(BE_32(edata) == 0x0000010F) { + if(AV_RB32(edata) == 0x0000010F) { edata += 4; edata_size -= 4; break; @@ -4144,7 +4167,7 @@ static int vc1_decode_init(AVCodecContext *avctx) while(edata_size > 8) { // test if we've found entry point - if(BE_32(edata) == 0x0000010E) { + if(AV_RB32(edata) == 0x0000010E) { edata += 4; edata_size -= 4; break; diff --git a/src/libffmpeg/libavcodec/vmdav.c b/src/libffmpeg/libavcodec/vmdav.c index a9937144e..e0f958cbe 100644 --- a/src/libffmpeg/libavcodec/vmdav.c +++ b/src/libffmpeg/libavcodec/vmdav.c @@ -92,10 +92,10 @@ static void lz_unpack(unsigned char *src, unsigned char *dest, int dest_len) s = src; d = dest; d_end = d + dest_len; - dataleft = LE_32(s); + dataleft = AV_RL32(s); s += 4; memset(queue, 0x20, QUEUE_SIZE); - if (LE_32(s) == 0x56781234) { + if (AV_RL32(s) == 0x56781234) { s += 4; qpos = 0x111; speclen = 0xF + 3; @@ -204,10 +204,10 @@ static void vmd_decode(VmdVideoContext *s) int frame_width, frame_height; int dp_size; - frame_x = LE_16(&s->buf[6]); - frame_y = LE_16(&s->buf[8]); - frame_width = LE_16(&s->buf[10]) - frame_x + 1; - frame_height = LE_16(&s->buf[12]) - frame_y + 1; + frame_x = AV_RL16(&s->buf[6]); + frame_y = AV_RL16(&s->buf[8]); + frame_width = AV_RL16(&s->buf[10]) - frame_x + 1; + frame_height = AV_RL16(&s->buf[12]) - frame_y + 1; /* if only a certain region will be updated, copy the entire previous * frame before the decode */ @@ -339,7 +339,7 @@ static int vmdvideo_decode_init(AVCodecContext *avctx) } vmd_header = (unsigned char *)avctx->extradata; - s->unpack_buffer_size = LE_32(&vmd_header[800]); + s->unpack_buffer_size = AV_RL32(&vmd_header[800]); s->unpack_buffer = av_malloc(s->unpack_buffer_size); if (!s->unpack_buffer) return -1; diff --git a/src/libffmpeg/libavcodec/vp3.c b/src/libffmpeg/libavcodec/vp3.c index 6a398693a..f02215407 100644 --- a/src/libffmpeg/libavcodec/vp3.c +++ b/src/libffmpeg/libavcodec/vp3.c @@ -2643,7 +2643,6 @@ AVCodec vp3_decoder = { NULL }; -#ifndef CONFIG_LIBTHEORA AVCodec theora_decoder = { "theora", CODEC_TYPE_VIDEO, @@ -2656,4 +2655,3 @@ AVCodec theora_decoder = { 0, NULL }; -#endif diff --git a/src/libffmpeg/libavcodec/vp56.h b/src/libffmpeg/libavcodec/vp56.h index f8b3a8e4b..50e201550 100644 --- a/src/libffmpeg/libavcodec/vp56.h +++ b/src/libffmpeg/libavcodec/vp56.h @@ -76,6 +76,8 @@ struct vp56_context { uint8_t *edge_emu_buffer_alloc; uint8_t *edge_emu_buffer; vp56_range_coder_t c; + vp56_range_coder_t cc; + vp56_range_coder_t *ccp; int sub_version; /* frame info */ @@ -108,6 +110,7 @@ struct vp56_context { int vector_candidate_pos; /* filtering hints */ + int filter_header; /* used in vp6 only */ int deblock_filtering; int filter_selection; int filter_mode; diff --git a/src/libffmpeg/libavcodec/vp6.c b/src/libffmpeg/libavcodec/vp6.c index 381fcc8ee..df4ebf87d 100644 --- a/src/libffmpeg/libavcodec/vp6.c +++ b/src/libffmpeg/libavcodec/vp6.c @@ -43,13 +43,12 @@ static int vp6_parse_header(vp56_context_t *s, uint8_t *buf, int buf_size, { vp56_range_coder_t *c = &s->c; int parse_filter_info = 0; + int coeff_offset = 0; int vrt_shift = 0; int sub_version; int rows, cols; int res = 1; - - if (buf[0] & 1) - return 0; + int separated_coeff = buf[0] & 1; s->frames[VP56_FRAME_CURRENT].key_frame = !(buf[0] & 0x80); vp56_init_dequant(s, (buf[0] >> 1) & 0x3F); @@ -58,12 +57,16 @@ static int vp6_parse_header(vp56_context_t *s, uint8_t *buf, int buf_size, sub_version = buf[1] >> 3; if (sub_version > 8) return 0; - if ((buf[1] & 0x06) != 0x06) - return 0; + s->filter_header = buf[1] & 0x06; if (buf[1] & 1) { av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n"); return 0; } + if (separated_coeff || !s->filter_header) { + coeff_offset = AV_RB16(buf+2) - 2; + buf += 2; + buf_size -= 2; + } rows = buf[2]; /* number of stored macroblock rows */ cols = buf[3]; /* number of stored macroblock cols */ @@ -83,7 +86,7 @@ static int vp6_parse_header(vp56_context_t *s, uint8_t *buf, int buf_size, vp56_init_range_decoder(c, buf+6, buf_size-6); vp56_rac_gets(c, 2); - parse_filter_info = 1; + parse_filter_info = s->filter_header; if (sub_version < 8) vrt_shift = 5; s->sub_version = sub_version; @@ -91,14 +94,21 @@ static int vp6_parse_header(vp56_context_t *s, uint8_t *buf, int buf_size, if (!s->sub_version) return 0; + if (separated_coeff || !s->filter_header) { + coeff_offset = AV_RB16(buf+1) - 2; + buf += 2; + buf_size -= 2; + } vp56_init_range_decoder(c, buf+1, buf_size-1); *golden_frame = vp56_rac_get(c); - s->deblock_filtering = vp56_rac_get(c); - if (s->deblock_filtering) - vp56_rac_get(c); - if (s->sub_version > 7) - parse_filter_info = vp56_rac_get(c); + if (s->filter_header) { + s->deblock_filtering = vp56_rac_get(c); + if (s->deblock_filtering) + vp56_rac_get(c); + if (s->sub_version > 7) + parse_filter_info = vp56_rac_get(c); + } } if (parse_filter_info) { @@ -118,6 +128,15 @@ static int vp6_parse_header(vp56_context_t *s, uint8_t *buf, int buf_size, } vp56_rac_get(c); + + if (coeff_offset) { + vp56_init_range_decoder(&s->cc, buf+coeff_offset, + buf_size-coeff_offset); + s->ccp = &s->cc; + } else { + s->ccp = &s->c; + } + return res; } @@ -259,7 +278,7 @@ static void vp6_parse_vector_adjustment(vp56_context_t *s, vp56_mv_t *vect) static void vp6_parse_coeff(vp56_context_t *s) { - vp56_range_coder_t *c = &s->c; + vp56_range_coder_t *c = s->ccp; uint8_t *permute = s->scantable.permutated; uint8_t *model, *model2, *model3; int coeff, sign, coeff_idx; diff --git a/src/libffmpeg/libavcodec/vqavideo.c b/src/libffmpeg/libavcodec/vqavideo.c index 912ced0df..57fe6cf44 100644 --- a/src/libffmpeg/libavcodec/vqavideo.c +++ b/src/libffmpeg/libavcodec/vqavideo.c @@ -151,8 +151,8 @@ static int vqa_decode_init(AVCodecContext *avctx) /* load up the VQA parameters from the header */ vqa_header = (unsigned char *)s->avctx->extradata; s->vqa_version = vqa_header[0]; - s->width = LE_16(&vqa_header[6]); - s->height = LE_16(&vqa_header[8]); + s->width = AV_RL16(&vqa_header[6]); + s->height = AV_RL16(&vqa_header[8]); if(avcodec_check_dimensions(avctx, s->width, s->height)){ s->width= s->height= 0; return -1; @@ -232,9 +232,9 @@ static void decode_format80(unsigned char *src, int src_size, if (src[src_index] == 0xFF) { src_index++; - count = LE_16(&src[src_index]); + count = AV_RL16(&src[src_index]); src_index += 2; - src_pos = LE_16(&src[src_index]); + src_pos = AV_RL16(&src[src_index]); src_index += 2; vqa_debug("(1) copy %X bytes from absolute pos %X\n", count, src_pos); CHECK_COUNT(); @@ -245,7 +245,7 @@ static void decode_format80(unsigned char *src, int src_size, } else if (src[src_index] == 0xFE) { src_index++; - count = LE_16(&src[src_index]); + count = AV_RL16(&src[src_index]); src_index += 2; color = src[src_index++]; vqa_debug("(2) set %X bytes to %02X\n", count, color); @@ -256,7 +256,7 @@ static void decode_format80(unsigned char *src, int src_size, } else if ((src[src_index] & 0xC0) == 0xC0) { count = (src[src_index++] & 0x3F) + 3; - src_pos = LE_16(&src[src_index]); + src_pos = AV_RL16(&src[src_index]); src_index += 2; vqa_debug("(3) copy %X bytes from absolute pos %X\n", count, src_pos); CHECK_COUNT(); @@ -276,7 +276,7 @@ static void decode_format80(unsigned char *src, int src_size, } else { count = ((src[src_index] & 0x70) >> 4) + 3; - src_pos = BE_16(&src[src_index]) & 0x0FFF; + src_pos = AV_RB16(&src[src_index]) & 0x0FFF; src_index += 2; vqa_debug("(5) copy %X bytes from relpos %X\n", count, src_pos); CHECK_COUNT(); @@ -326,8 +326,8 @@ static void vqa_decode_chunk(VqaContext *s) /* first, traverse through the frame and find the subchunks */ while (index < s->size) { - chunk_type = BE_32(&s->buf[index]); - chunk_size = BE_32(&s->buf[index + 4]); + chunk_type = AV_RB32(&s->buf[index]); + chunk_size = AV_RB32(&s->buf[index + 4]); switch (chunk_type) { @@ -391,7 +391,7 @@ static void vqa_decode_chunk(VqaContext *s) /* convert the RGB palette into the machine's endian format */ if (cpl0_chunk != -1) { - chunk_size = BE_32(&s->buf[cpl0_chunk + 4]); + chunk_size = AV_RB32(&s->buf[cpl0_chunk + 4]); /* sanity check the palette size */ if (chunk_size / 3 > 256) { av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: found a palette chunk with %d colors\n", @@ -419,7 +419,7 @@ static void vqa_decode_chunk(VqaContext *s) /* decompress the full codebook chunk */ if (cbfz_chunk != -1) { - chunk_size = BE_32(&s->buf[cbfz_chunk + 4]); + chunk_size = AV_RB32(&s->buf[cbfz_chunk + 4]); cbfz_chunk += CHUNK_PREAMBLE_SIZE; decode_format80(&s->buf[cbfz_chunk], chunk_size, s->codebook, s->codebook_size, 0); @@ -428,7 +428,7 @@ static void vqa_decode_chunk(VqaContext *s) /* copy a full codebook */ if (cbf0_chunk != -1) { - chunk_size = BE_32(&s->buf[cbf0_chunk + 4]); + chunk_size = AV_RB32(&s->buf[cbf0_chunk + 4]); /* sanity check the full codebook size */ if (chunk_size > MAX_CODEBOOK_SIZE) { av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: CBF0 chunk too large (0x%X bytes)\n", @@ -448,7 +448,7 @@ static void vqa_decode_chunk(VqaContext *s) return; } - chunk_size = BE_32(&s->buf[vptz_chunk + 4]); + chunk_size = AV_RB32(&s->buf[vptz_chunk + 4]); vptz_chunk += CHUNK_PREAMBLE_SIZE; decode_format80(&s->buf[vptz_chunk], chunk_size, s->decode_buffer, s->decode_buffer_size, 1); @@ -522,7 +522,7 @@ static void vqa_decode_chunk(VqaContext *s) if (cbp0_chunk != -1) { - chunk_size = BE_32(&s->buf[cbp0_chunk + 4]); + chunk_size = AV_RB32(&s->buf[cbp0_chunk + 4]); cbp0_chunk += CHUNK_PREAMBLE_SIZE; /* accumulate partial codebook */ @@ -545,7 +545,7 @@ static void vqa_decode_chunk(VqaContext *s) if (cbpz_chunk != -1) { - chunk_size = BE_32(&s->buf[cbpz_chunk + 4]); + chunk_size = AV_RB32(&s->buf[cbpz_chunk + 4]); cbpz_chunk += CHUNK_PREAMBLE_SIZE; /* accumulate partial codebook */ diff --git a/src/libffmpeg/libavcodec/wavpack.c b/src/libffmpeg/libavcodec/wavpack.c index 18544831e..b462174da 100644 --- a/src/libffmpeg/libavcodec/wavpack.c +++ b/src/libffmpeg/libavcodec/wavpack.c @@ -141,8 +141,8 @@ static av_always_inline int get_tail(GetBitContext *gb, int k) { int p, e, res; - if(k<1 || k>65535)return 0; - p = av_log2_16bit(k); + if(k<1)return 0; + p = av_log2(k); e = (1 << (p + 1)) - k - 1; res = p ? get_bits(gb, p) : 0; if(res >= e){ @@ -387,15 +387,15 @@ static int wavpack_decode_frame(AVCodecContext *avctx, memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr)); - s->samples = LE_32(buf); buf += 4; + s->samples = AV_RL32(buf); buf += 4; if(!s->samples) return buf_size; /* should not happen but who knows */ if(s->samples * 2 * avctx->channels > AVCODEC_MAX_AUDIO_FRAME_SIZE){ av_log(avctx, AV_LOG_ERROR, "Packet size is too big to be handled in lavc!\n"); return -1; } - s->joint = LE_32(buf) & WV_JOINT; buf += 4; - s->CRC = LE_32(buf); buf += 4; + s->joint = AV_RL32(buf) & WV_JOINT; buf += 4; + s->CRC = AV_RL32(buf); buf += 4; // parse metadata blocks while(buf < buf_end){ id = *buf++; @@ -467,23 +467,23 @@ static int wavpack_decode_frame(AVCodecContext *avctx, t = 0; for(i = s->terms - 1; (i >= 0) && (t < size); i--) { if(s->decorr[i].value > 8){ - s->decorr[i].samplesA[0] = wp_exp2(LE_16(buf)); buf += 2; - s->decorr[i].samplesA[1] = wp_exp2(LE_16(buf)); buf += 2; + s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2; + s->decorr[i].samplesA[1] = wp_exp2(AV_RL16(buf)); buf += 2; if(s->stereo){ - s->decorr[i].samplesB[0] = wp_exp2(LE_16(buf)); buf += 2; - s->decorr[i].samplesB[1] = wp_exp2(LE_16(buf)); buf += 2; + s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2; + s->decorr[i].samplesB[1] = wp_exp2(AV_RL16(buf)); buf += 2; t += 4; } t += 4; }else if(s->decorr[i].value < 0){ - s->decorr[i].samplesA[0] = wp_exp2(LE_16(buf)); buf += 2; - s->decorr[i].samplesB[0] = wp_exp2(LE_16(buf)); buf += 2; + s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2; + s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2; t += 4; }else{ for(j = 0; j < s->decorr[i].value; j++){ - s->decorr[i].samplesA[j] = wp_exp2(LE_16(buf)); buf += 2; + s->decorr[i].samplesA[j] = wp_exp2(AV_RL16(buf)); buf += 2; if(s->stereo){ - s->decorr[i].samplesB[j] = wp_exp2(LE_16(buf)); buf += 2; + s->decorr[i].samplesB[j] = wp_exp2(AV_RL16(buf)); buf += 2; } } t += s->decorr[i].value * 2 * avctx->channels; @@ -498,7 +498,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, continue; } for(i = 0; i < 3 * avctx->channels; i++){ - s->median[i] = wp_exp2(LE_16(buf)); + s->median[i] = wp_exp2(AV_RL16(buf)); buf += 2; } got_entropy = 1; diff --git a/src/libffmpeg/libavcodec/ws-snd1.c b/src/libffmpeg/libavcodec/ws-snd1.c index eb4fe81d3..3624909a3 100644 --- a/src/libffmpeg/libavcodec/ws-snd1.c +++ b/src/libffmpeg/libavcodec/ws-snd1.c @@ -57,9 +57,9 @@ static int ws_snd_decode_frame(AVCodecContext *avctx, if (!buf_size) return 0; - out_size = LE_16(&buf[0]); + out_size = AV_RL16(&buf[0]); *data_size = out_size * 2; - in_size = LE_16(&buf[2]); + in_size = AV_RL16(&buf[2]); buf += 4; if (in_size == out_size) { diff --git a/src/libffmpeg/libavcodec/xan.c b/src/libffmpeg/libavcodec/xan.c index 56ce87a95..f697514a0 100644 --- a/src/libffmpeg/libavcodec/xan.c +++ b/src/libffmpeg/libavcodec/xan.c @@ -296,10 +296,10 @@ static void xan_wc3_decode_frame(XanContext *s) { unsigned char *vector_segment; unsigned char *imagedata_segment; - huffman_segment = s->buf + LE_16(&s->buf[0]); - size_segment = s->buf + LE_16(&s->buf[2]); - vector_segment = s->buf + LE_16(&s->buf[4]); - imagedata_segment = s->buf + LE_16(&s->buf[6]); + huffman_segment = s->buf + AV_RL16(&s->buf[0]); + size_segment = s->buf + AV_RL16(&s->buf[2]); + vector_segment = s->buf + AV_RL16(&s->buf[4]); + imagedata_segment = s->buf + AV_RL16(&s->buf[6]); xan_huffman_decode(opcode_buffer, huffman_segment, opcode_buffer_size); @@ -350,7 +350,7 @@ static void xan_wc3_decode_frame(XanContext *s) { case 10: case 20: - size = BE_16(&size_segment[0]); + size = AV_RB16(&size_segment[0]); size_segment += 2; break; diff --git a/src/libffmpeg/libavcodec/xl.c b/src/libffmpeg/libavcodec/xl.c index 67ad237e1..8a011d887 100644 --- a/src/libffmpeg/libavcodec/xl.c +++ b/src/libffmpeg/libavcodec/xl.c @@ -73,7 +73,7 @@ static int decode_frame(AVCodecContext *avctx, for (j = 0; j < avctx->width; j += 4) { /* value is stored in LE dword with word swapped */ - val = LE_32(buf); + val = AV_RL32(buf); buf -= 4; val = ((val >> 16) & 0xFFFF) | ((val & 0xFFFF) << 16); diff --git a/src/libffmpeg/libavcodec/zmbv.c b/src/libffmpeg/libavcodec/zmbv.c index fe3745e09..3b87c7db1 100644 --- a/src/libffmpeg/libavcodec/zmbv.c +++ b/src/libffmpeg/libavcodec/zmbv.c @@ -545,7 +545,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 case ZMBV_FMT_15BPP: for(j = 0; j < c->height; j++) { for(i = 0; i < c->width; i++) { - uint16_t tmp = LE_16(src); + uint16_t tmp = AV_RL16(src); src += 2; out[i * 3 + 0] = (tmp & 0x7C00) >> 7; out[i * 3 + 1] = (tmp & 0x03E0) >> 2; @@ -557,7 +557,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 case ZMBV_FMT_16BPP: for(j = 0; j < c->height; j++) { for(i = 0; i < c->width; i++) { - uint16_t tmp = LE_16(src); + uint16_t tmp = AV_RL16(src); src += 2; out[i * 3 + 0] = (tmp & 0xF800) >> 8; out[i * 3 + 1] = (tmp & 0x07E0) >> 3; @@ -578,7 +578,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 case ZMBV_FMT_32BPP: for(j = 0; j < c->height; j++) { for(i = 0; i < c->width; i++) { - uint32_t tmp = LE_32(src); + uint32_t tmp = AV_RL32(src); src += 4; out[i * 3 + 0] = tmp >> 16; out[i * 3 + 1] = tmp >> 8; diff --git a/src/libffmpeg/libavutil/avutil.h b/src/libffmpeg/libavutil/avutil.h index 08cc61567..d5a4570dc 100644 --- a/src/libffmpeg/libavutil/avutil.h +++ b/src/libffmpeg/libavutil/avutil.h @@ -34,8 +34,8 @@ extern "C" { #define AV_STRINGIFY(s) AV_TOSTRING(s) #define AV_TOSTRING(s) #s -#define LIBAVUTIL_VERSION_INT ((49<<16)+(1<<8)+0) -#define LIBAVUTIL_VERSION 49.1.0 +#define LIBAVUTIL_VERSION_INT ((49<<16)+(2<<8)+0) +#define LIBAVUTIL_VERSION 49.2.0 #define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT #define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) diff --git a/src/libffmpeg/libavutil/common.h b/src/libffmpeg/libavutil/common.h index 0e093616c..0c77aa26a 100644 --- a/src/libffmpeg/libavutil/common.h +++ b/src/libffmpeg/libavutil/common.h @@ -120,7 +120,7 @@ static inline int av_log2_16bit(unsigned int v) /* median of 3 */ static inline int mid_pred(int a, int b, int c) { -#if HAVE_CMOV +#ifdef HAVE_CMOV int i=b; asm volatile( "cmp %2, %1 \n\t" diff --git a/src/libffmpeg/libavutil/intreadwrite.h b/src/libffmpeg/libavutil/intreadwrite.h index c43f9d651..e6db5ce6f 100644 --- a/src/libffmpeg/libavutil/intreadwrite.h +++ b/src/libffmpeg/libavutil/intreadwrite.h @@ -26,17 +26,40 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed)); #endif /* !__GNUC__ */ /* endian macros */ -#if !defined(BE_16) || !defined(BE_32) || !defined(LE_16) || !defined(LE_32) -#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) -#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ +#define AV_RB8(x) (((uint8_t*)(x))[0]) +#define AV_WB8(p, i, d) { ((uint8_t*)(p))[(i)] = (d); } + +#define AV_RB16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) +#define AV_WB16(p, i, d) { \ + ((uint8_t*)(p))[(i)+1] = (d); \ + ((uint8_t*)(p))[(i)] = (d)>>8; } + +#define AV_RB32(x) ((((uint8_t*)(x))[0] << 24) | \ (((uint8_t*)(x))[1] << 16) | \ (((uint8_t*)(x))[2] << 8) | \ ((uint8_t*)(x))[3]) -#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) -#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ +#define AV_WB32(p, i, d) { \ + ((uint8_t*)(p))[(i)+3] = (d); \ + ((uint8_t*)(p))[(i)+2] = (d)>>8; \ + ((uint8_t*)(p))[(i)+1] = (d)>>16; \ + ((uint8_t*)(p))[(i)] = (d)>>24; } + +#define AV_RL8(x) AV_RB8(x) +#define AV_WL8(p, i, d) AV_WB8(p, i, d) + +#define AV_RL16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) +#define AV_WL16(p, i, d) { \ + ((uint8_t*)(p))[(i)] = (d); \ + ((uint8_t*)(p))[(i)+1] = (d)>>8; } + +#define AV_RL32(x) ((((uint8_t*)(x))[3] << 24) | \ (((uint8_t*)(x))[2] << 16) | \ (((uint8_t*)(x))[1] << 8) | \ ((uint8_t*)(x))[0]) -#endif +#define AV_WL32(p, i, d) { \ + ((uint8_t*)(p))[(i)] = (d); \ + ((uint8_t*)(p))[(i)+1] = (d)>>8; \ + ((uint8_t*)(p))[(i)+2] = (d)>>16; \ + ((uint8_t*)(p))[(i)+3] = (d)>>24; } #endif /* INTREADWRITE_H */ diff --git a/src/libffmpeg/libavutil/log.c b/src/libffmpeg/libavutil/log.c index 8b2dc6f6d..4fd503d0d 100644 --- a/src/libffmpeg/libavutil/log.c +++ b/src/libffmpeg/libavutil/log.c @@ -28,7 +28,7 @@ int av_log_level = AV_LOG_INFO; -static void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) +void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) { static int print_prefix=1; AVClass* avc= ptr ? *(AVClass**)ptr : NULL; diff --git a/src/libffmpeg/libavutil/log.h b/src/libffmpeg/libavutil/log.h index 0ff1f9fcf..56ca01289 100644 --- a/src/libffmpeg/libavutil/log.h +++ b/src/libffmpeg/libavutil/log.h @@ -38,10 +38,49 @@ struct AVCLASS { /* av_log API */ +#if LIBAVUTIL_VERSION_INT < (50<<16) #define AV_LOG_QUIET -1 +#define AV_LOG_FATAL 0 #define AV_LOG_ERROR 0 +#define AV_LOG_WARNING 1 #define AV_LOG_INFO 1 +#define AV_LOG_VERBOSE 1 #define AV_LOG_DEBUG 2 +#else +#define AV_LOG_QUIET -8 + +/** + * something went really wrong and we will crash now + */ +#define AV_LOG_PANIC 0 + +/** + * something went wrong and recovery is not possible + * like no header in a format which depends on it or a combination + * of parameters which are not allowed + */ +#define AV_LOG_FATAL 8 + +/** + * something went wrong and cannot losslessly be recovered + * but not all future data is affected + */ +#define AV_LOG_ERROR 16 + +/** + * something somehow does not look correct / something which may or may not + * lead to some problems like use of -vstrict -2 + */ +#define AV_LOG_WARNING 24 + +#define AV_LOG_INFO 32 +#define AV_LOG_VERBOSE 40 + +/** + * stuff which is only useful for libav* developers + */ +#define AV_LOG_DEBUG 48 +#endif extern int av_log_level; #ifdef __GNUC__ @@ -55,6 +94,7 @@ extern void av_vlog(void*, int level, const char *fmt, va_list); extern int av_log_get_level(void); extern void av_log_set_level(int); extern void av_log_set_callback(void (*)(void*, int, const char*, va_list)); +extern void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl); #else extern void (*av_vlog)(void*, int, const char*, va_list); #endif -- cgit v1.2.3 From 37563812bfe7a5e59910ccc1274275574b8fe674 Mon Sep 17 00:00:00 2001 From: Miguel Freitas <miguelfreitas@users.sourceforge.net> Date: Sun, 28 Jan 2007 22:46:07 +0000 Subject: fix integer/double mistake. funny because the "more accurate" frame duration calculation actually broke a/v sync for ntsc dvds. tsc tsc ;-) fixes #1544349, #1589644 CVS patchset: 8574 CVS date: 2007/01/28 22:46:07 --- src/libmpeg2/decode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index f20698520..a2bb868df 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -130,7 +130,7 @@ static inline void get_frame_duration (mpeg2dec_t * mpeg2dec, vo_frame_t *frame) (mpeg2dec->rff_pattern & 0xff) == 0x55) && !mpeg2dec->picture->progressive_sequence ) { /* special case for ntsc 3:2 pulldown */ - duration *= 5 / 4; + duration *= 5.0 / 4.0; } else { @@ -139,7 +139,7 @@ static inline void get_frame_duration (mpeg2dec_t * mpeg2dec, vo_frame_t *frame) frame->progressive_frame ) { /* decoder should output 3 fields, so adjust duration to count on this extra field time */ - duration *= 3 / 2; + duration *= 3.0 / 2.0; } else if( mpeg2dec->picture->progressive_sequence ) { /* for progressive sequences the output should repeat the frame 1 or 2 times depending on top_field_first flag. */ -- cgit v1.2.3 From 3478c4f76e3c2c1c280476852ca32f0a8052d8c5 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani <klan@users.sourceforge.net> Date: Mon, 29 Jan 2007 14:39:59 +0000 Subject: Release stream and playback in ao_fusionsound_exit(). CVS patchset: 8578 CVS date: 2007/01/29 14:39:59 --- src/audio_out/audio_fusionsound_out.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/audio_out/audio_fusionsound_out.c b/src/audio_out/audio_fusionsound_out.c index 1a6f44972..71a17f6e6 100644 --- a/src/audio_out/audio_fusionsound_out.c +++ b/src/audio_out/audio_fusionsound_out.c @@ -262,6 +262,12 @@ static uint32_t ao_fusionsound_get_capabilities(ao_driver_t *ao_driver) { static void ao_fusionsound_exit(ao_driver_t *ao_driver) { fusionsound_driver_t *this = (fusionsound_driver_t *) ao_driver; + if (this->playback) + this->playback->Release (this->playback); + + if (this->stream) + this->stream->Release (this->stream); + if (this->sound) this->sound->Release (this->sound); -- cgit v1.2.3 From 0bc8ceaec5d62bac80808240f04f93170fd93316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 2 Feb 2007 23:36:57 +0000 Subject: Make use of threaded mainloop rather than calling it manually, this makes xine not lock up if a pulseaudio connection can't be established. CVS patchset: 8579 CVS date: 2007/02/02 23:36:57 --- src/audio_out/audio_pulse_out.c | 62 ++++++++++++----------------------------- 1 file changed, 18 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c index 2cef1992d..8b6d52040 100644 --- a/src/audio_out/audio_pulse_out.c +++ b/src/audio_out/audio_pulse_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_pulse_out.c,v 1.5 2006/11/10 12:10:54 dgp85 Exp $ + * $Id: audio_pulse_out.c,v 1.6 2007/02/02 23:36:57 dgp85 Exp $ * * ao plugin for pulseaudio (rename of polypaudio): * http://0pointer.de/lennart/projects/pulsaudio/ @@ -44,8 +44,6 @@ #include <pthread.h> #include <pulse/pulseaudio.h> -#include <pulse/error.h> -#include <pulse/mainloop.h> #include "xine_internal.h" #include "xineutils.h" @@ -76,7 +74,7 @@ typedef struct pulse_driver_s { struct pa_context *context; /** Main event loop object */ - struct pa_mainloop *mainloop; + struct pa_threaded_mainloop *mainloop; pa_volume_t swvolume; pa_cvolume cvolume; @@ -101,34 +99,18 @@ typedef struct { xine_t *xine; } pulse_class_t; +int wait_for_operation(pulse_driver_t *this, pa_operation *o) +{ + assert(this && o && this->mainloop); -/** Make sure that the connection context doesn't starve to death */ -static void keep_alive(pulse_driver_t *this) { - assert(this->context && this->mainloop); - - while (pa_mainloop_iterate(this->mainloop, 0, NULL) > 0); -} - -/** Wait until no further actions are pending on the connection context */ -static void wait_for_completion(pulse_driver_t *this) { - assert(this->context && this->mainloop); - - while (pa_context_is_pending(this->context)) { - int r = pa_mainloop_iterate(this->mainloop, 1, NULL); - assert(r >= 0); - } -} - -/** Wait until the specified operation completes */ -static void wait_for_operation(pulse_driver_t *this, struct pa_operation *o) { - assert(o && this->context && this->mainloop); - - while (pa_operation_get_state(o) == PA_OPERATION_RUNNING) { - int r = pa_mainloop_iterate(this->mainloop, 1, NULL); - assert(r >= 0); - } + pa_threaded_mainloop_lock(this->mainloop); + + while (pa_operation_get_state(o) == PA_OPERATION_RUNNING) + pa_threaded_mainloop_wait(this->mainloop); + + pa_threaded_mainloop_unlock(this->mainloop); - pa_operation_unref(o); + return 0; } /* @@ -189,16 +171,15 @@ static int ao_pulse_open(ao_driver_t *this_gen, goto fail; } - this->mainloop = pa_mainloop_new(); - assert(this->mainloop); + this->mainloop = pa_threaded_mainloop_new(); + pa_threaded_mainloop_start(this->mainloop); + _x_assert(this->mainloop); - this->context = pa_context_new(pa_mainloop_get_api(this->mainloop), __progname); - assert(this->context); + this->context = pa_context_new(pa_threaded_mainloop_get_api(this->mainloop), __progname); + _x_assert(this->context); pa_context_connect(this->context, this->host, 1, NULL); - wait_for_completion(this); - if (pa_context_get_state(this->context) != PA_CONTEXT_READY) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: Failed to connect to server: %s\n", pa_strerror(pa_context_errno(this->context))); @@ -218,8 +199,6 @@ static int ao_pulse_open(ao_driver_t *this_gen, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE, &this->cvolume, NULL); - wait_for_completion(this); - if (pa_stream_get_state(this->stream) != PA_STREAM_READY) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: Failed to connect to server: %s\n", pa_strerror(pa_context_errno(this->context))); @@ -271,13 +250,10 @@ static int ao_pulse_write(ao_driver_t *this_gen, int16_t *data, while (size > 0) { size_t l; - keep_alive(this); - while (!(l = pa_stream_writable_size(this->stream))) { pthread_mutex_unlock(&this->lock); xine_usec_sleep (10000); pthread_mutex_lock(&this->lock); - keep_alive(this); } if (l > size) @@ -316,7 +292,6 @@ static int ao_pulse_delay (ao_driver_t *this_gen) if (pa_context_errno(this->context) != PA_ERR_NODATA) { /* error */ } - keep_alive(this); } pthread_mutex_unlock(&this->lock); @@ -350,7 +325,7 @@ static void ao_pulse_close(ao_driver_t *this_gen) } if (this->mainloop) { - pa_mainloop_free(this->mainloop); + pa_threaded_mainloop_free(this->mainloop); this->mainloop = NULL; } pthread_mutex_unlock(&this->lock); @@ -451,7 +426,6 @@ static int ao_pulse_ctrl(ao_driver_t *this_gen, int cmd, ...) { assert(o1 && o2); wait_for_operation(this,o1); wait_for_operation(this,o2); - wait_for_completion(this); } break; -- cgit v1.2.3 From 2b3e16c2ea777daaac4875e0566871f499bbf21c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 2 Feb 2007 23:43:01 +0000 Subject: We don't need to lock anymore as we're using the threaded mainloop, that already is taking care of serialising calls. CVS patchset: 8580 CVS date: 2007/02/02 23:43:01 --- src/audio_out/audio_pulse_out.c | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c index 8b6d52040..a5f7b5b8e 100644 --- a/src/audio_out/audio_pulse_out.c +++ b/src/audio_out/audio_pulse_out.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2006 the xine project + * Copyright (C) 2000-2007 the xine project * * This file is part of xine, a free video player. * @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_pulse_out.c,v 1.6 2007/02/02 23:36:57 dgp85 Exp $ + * $Id: audio_pulse_out.c,v 1.7 2007/02/02 23:43:01 dgp85 Exp $ * * ao plugin for pulseaudio (rename of polypaudio): * http://0pointer.de/lennart/projects/pulsaudio/ @@ -89,8 +89,6 @@ typedef struct pulse_driver_s { uint32_t frames_written; - pthread_mutex_t lock; - } pulse_driver_t; typedef struct { @@ -164,8 +162,6 @@ static int ao_pulse_open(ao_driver_t *this_gen, break; } - pthread_mutex_lock(&this->lock); - if (!pa_sample_spec_valid(&ss)) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: Invalid sample spec\n"); goto fail; @@ -204,14 +200,11 @@ static int ao_pulse_open(ao_driver_t *this_gen, pa_strerror(pa_context_errno(this->context))); goto fail; } - pthread_mutex_unlock(&this->lock); - this->frames_written = 0; return this->sample_rate; fail: - pthread_mutex_unlock(&this->lock); this_gen->close(this_gen); return 0; } @@ -243,17 +236,13 @@ static int ao_pulse_write(ao_driver_t *this_gen, int16_t *data, assert(this->stream && this->context); - pthread_mutex_lock(&this->lock); - if (pa_stream_get_state(this->stream) == PA_STREAM_READY) { while (size > 0) { size_t l; while (!(l = pa_stream_writable_size(this->stream))) { - pthread_mutex_unlock(&this->lock); xine_usec_sleep (10000); - pthread_mutex_lock(&this->lock); } if (l > size) @@ -271,7 +260,6 @@ static int ao_pulse_write(ao_driver_t *this_gen, int16_t *data, if (pa_stream_get_state(this->stream) == PA_STREAM_READY) ret = 1; } - pthread_mutex_unlock(&this->lock); return ret; } @@ -283,8 +271,6 @@ static int ao_pulse_delay (ao_driver_t *this_gen) pa_usec_t latency = 0; int delay_frames; - pthread_mutex_lock(&this->lock); - for (;;) { if (pa_stream_get_latency(this->stream, &latency, NULL) >= 0) break; @@ -294,8 +280,6 @@ static int ao_pulse_delay (ao_driver_t *this_gen) } } - pthread_mutex_unlock(&this->lock); - /* convert latency (us) to frame units. */ delay_frames = (int)(latency * this->sample_rate / 1000000); @@ -309,7 +293,6 @@ static void ao_pulse_close(ao_driver_t *this_gen) { pulse_driver_t *this = (pulse_driver_t *) this_gen; - pthread_mutex_lock(&this->lock); if (this->stream) { if (pa_stream_get_state(this->stream) == PA_STREAM_READY) wait_for_operation(this, pa_stream_drain(this->stream, NULL, NULL)); @@ -328,7 +311,6 @@ static void ao_pulse_close(ao_driver_t *this_gen) pa_threaded_mainloop_free(this->mainloop); this->mainloop = NULL; } - pthread_mutex_unlock(&this->lock); } static uint32_t ao_pulse_get_capabilities (ao_driver_t *this_gen) { @@ -368,11 +350,9 @@ static int ao_pulse_get_property (ao_driver_t *this_gen, int property) { switch(property) { case AO_PROP_PCM_VOL: case AO_PROP_MIXER_VOL: - pthread_mutex_lock(&this->lock); if( this->stream && this->context ) wait_for_operation(this, pa_context_get_sink_input_info(this->context, pa_stream_get_index(this->stream), info_func, this)); - pthread_mutex_unlock(&this->lock); return (int) (pa_sw_volume_to_linear(this->swvolume)*100); break; case AO_PROP_MUTE_VOL: @@ -388,7 +368,6 @@ static int ao_pulse_set_property (ao_driver_t *this_gen, int property, int value switch(property) { case AO_PROP_PCM_VOL: case AO_PROP_MIXER_VOL: - pthread_mutex_lock(&this->lock); this->swvolume = pa_sw_volume_from_linear((double)value/100.0); if( this->stream && this->context ) { pa_cvolume_set(&this->cvolume, pa_stream_get_sample_spec(this->stream)->channels, this->swvolume); @@ -396,7 +375,6 @@ static int ao_pulse_set_property (ao_driver_t *this_gen, int property, int value pa_context_set_sink_input_volume(this->context, pa_stream_get_index(this->stream), &this->cvolume, NULL, NULL)); } - pthread_mutex_unlock(&this->lock); break; case AO_PROP_MUTE_VOL: break; @@ -408,7 +386,6 @@ static int ao_pulse_set_property (ao_driver_t *this_gen, int property, int value static int ao_pulse_ctrl(ao_driver_t *this_gen, int cmd, ...) { pulse_driver_t *this = (pulse_driver_t *) this_gen; - pthread_mutex_lock(&this->lock); switch (cmd) { case AO_CTRL_PLAY_PAUSE: @@ -436,7 +413,6 @@ static int ao_pulse_ctrl(ao_driver_t *this_gen, int cmd, ...) { this->frames_written = 0; break; } - pthread_mutex_unlock(&this->lock); return 0; } @@ -505,8 +481,6 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da xprintf (class->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: host %s sink %s\n", this->host ? this->host : "(null)", this->sink ? this->sink : "(null)"); - pthread_mutex_init (&this->lock, NULL); - /* test pulseaudio connection */ if( this->ao_driver.open(&this->ao_driver, 16, 44100, AO_CAP_MODE_STEREO) != 0 ) { this->ao_driver.close(&this->ao_driver); -- cgit v1.2.3 From 47300569d5a7b9f09ffae8ff7fdd2fe4fea2f3fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 2 Feb 2007 23:45:23 +0000 Subject: Replace assert() calls with _x_assert(). CVS patchset: 8581 CVS date: 2007/02/02 23:45:23 --- src/audio_out/audio_pulse_out.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c index a5f7b5b8e..88dc25e0b 100644 --- a/src/audio_out/audio_pulse_out.c +++ b/src/audio_out/audio_pulse_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_pulse_out.c,v 1.7 2007/02/02 23:43:01 dgp85 Exp $ + * $Id: audio_pulse_out.c,v 1.8 2007/02/02 23:45:23 dgp85 Exp $ * * ao plugin for pulseaudio (rename of polypaudio): * http://0pointer.de/lennart/projects/pulsaudio/ @@ -40,7 +40,6 @@ #include <math.h> #include <unistd.h> #include <inttypes.h> -#include <assert.h> #include <pthread.h> #include <pulse/pulseaudio.h> @@ -99,7 +98,7 @@ typedef struct { int wait_for_operation(pulse_driver_t *this, pa_operation *o) { - assert(this && o && this->mainloop); + _x_assert(this && o && this->mainloop); pa_threaded_mainloop_lock(this->mainloop); @@ -183,7 +182,7 @@ static int ao_pulse_open(ao_driver_t *this_gen, } this->stream = pa_stream_new(this->context, "audio stream", &ss, NULL); - assert(this->stream); + _x_assert(this->stream); a.maxlength = pa_bytes_per_second(&ss)*1; a.tlength = a.maxlength*9/10; @@ -234,7 +233,7 @@ static int ao_pulse_write(ao_driver_t *this_gen, int16_t *data, int size = num_frames * this->bytes_per_frame; int ret = 0; - assert(this->stream && this->context); + _x_assert(this->stream && this->context); if (pa_stream_get_state(this->stream) == PA_STREAM_READY) { @@ -389,25 +388,25 @@ static int ao_pulse_ctrl(ao_driver_t *this_gen, int cmd, ...) { switch (cmd) { case AO_CTRL_PLAY_PAUSE: - assert(this->stream && this->context ); + _x_assert(this->stream && this->context ); if(pa_stream_get_state(this->stream) == PA_STREAM_READY) wait_for_operation(this,pa_stream_cork(this->stream, 1, NULL, NULL)); break; case AO_CTRL_PLAY_RESUME: - assert(this->stream && this->context); + _x_assert(this->stream && this->context); if(pa_stream_get_state(this->stream) == PA_STREAM_READY) { struct pa_operation *o2, *o1; o1 = pa_stream_prebuf(this->stream, NULL, NULL); o2 = pa_stream_cork(this->stream, 0, NULL, NULL); - assert(o1 && o2); + _x_assert(o1 && o2); wait_for_operation(this,o1); wait_for_operation(this,o2); } break; case AO_CTRL_FLUSH_BUFFERS: - assert(this->stream && this->context); + _x_assert(this->stream && this->context); if(pa_stream_get_state(this->stream) == PA_STREAM_READY) wait_for_operation(this,pa_stream_flush(this->stream, NULL, NULL)); this->frames_written = 0; -- cgit v1.2.3 From 9d1bb205475c5e2287d94c23d738c89204105415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 3 Feb 2007 10:41:09 +0000 Subject: Restructure the plugin a bit: create the mainloop and the context immediately on class load, this way they will be shared by all PulseAudio outputs; connect to the context when opening the output device, rather than the first time you play the stream (this way avoids latency while playing multiple tracks). The result is only one connection is present for xine instance, even if multiple streams are called on it. CVS patchset: 8582 CVS date: 2007/02/03 10:41:09 --- src/audio_out/audio_pulse_out.c | 237 ++++++++++++++++++++++++++++------------ 1 file changed, 169 insertions(+), 68 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c index 88dc25e0b..8f0c6aab5 100644 --- a/src/audio_out/audio_pulse_out.c +++ b/src/audio_out/audio_pulse_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_pulse_out.c,v 1.8 2007/02/02 23:45:23 dgp85 Exp $ + * $Id: audio_pulse_out.c,v 1.9 2007/02/03 10:41:09 dgp85 Exp $ * * ao plugin for pulseaudio (rename of polypaudio): * http://0pointer.de/lennart/projects/pulsaudio/ @@ -94,9 +94,115 @@ typedef struct { audio_driver_class_t driver_class; xine_t *xine; + + /** Pulseaudio connection context */ + struct pa_context *context; + + /** Main event loop object */ + struct pa_threaded_mainloop *mainloop; } pulse_class_t; -int wait_for_operation(pulse_driver_t *this, pa_operation *o) +/** + * @brief Callback function called when the status of the PulseAudio + * context changes + * @param ctx Context that changed (same as class->context) + * @param class_gen pulse_class_t pointer for the PulseAudio output + * instance. + */ +static void __xine_pa_ctx_state_callback(pa_context *const ctx, void *const class_gen) +{ + pulse_class_t *const class = (pulse_class_t*)class_gen; + + _x_assert(ctx); _x_assert(class); + _x_assert(ctx == class->context); + + pa_threaded_mainloop_signal(class->mainloop, 0); +} + +/** + * @brief Callback function called when the status of the PulseAudio + * stream changes + * @param stream Stream that changed (same as this->stream) + * @param this_gen pulse_driver_t pointer for the PulseAudio output + * instance. + */ +static void __xine_pa_stream_state_callback(pa_stream *const stream, void *const this_gen) +{ + pulse_driver_t *const this = (pulse_driver_t*)this_gen; + + _x_assert(stream); _x_assert(this); + _x_assert(stream == this->stream); + + pa_threaded_mainloop_signal(this->mainloop, 0); +} + +/** + * @brief Callback function called when a stream operation succeed + * @param stream Stream which operation has succeeded + * @param success The success value for the operation (ignored) + * @param this_Gen pulse_driver_t pointer for the PulseAudio output + * instance. + */ +static void __xine_pa_stream_success_callback(pa_stream *const stream, const int success, + void *const this_gen) +{ + pulse_driver_t *const this = (pulse_driver_t*)this_gen; + + _x_assert(stream); _x_assert(this); + _x_assert(stream == this->stream); + + pa_threaded_mainloop_signal(this->mainloop, 0); +} + +/** + * @brief Callback function called when a context operation succeed + * @param ctx Context which operation has succeeded + * @param success The success value for the operation (ignored) + * @param this_gen pulse_driver_t pointer for the PulseAudio output + * instance. + */ +static void __xine_pa_context_success_callback(pa_context *const ctx, const int success, + void *const this_gen) +{ + pulse_driver_t *const this = (pulse_driver_t*)this_gen; + + _x_assert(ctx); _x_assert(this); + _x_assert(ctx == this->context); + + pa_threaded_mainloop_signal(this->mainloop, 0); +} + +/** + * @brief Callback function called when the information on the + * context's sink is retrieved. + * @param ctx Context which operation has succeeded + * @param info Structure containing the sink's information + * @param this_gen pulse_driver_t pointer for the PulseAudio output + * instance. + * + * This function saves the volume field of the passed structure to the + * @c cvolume variable of the output instance. + */ +static void __xine_pa_sink_info_callback(pa_context *const ctx, const pa_sink_input_info *const info, + const int is_last, void *const userdata) { + + pulse_driver_t *const this = (pulse_driver_t *) userdata; + + if (is_last < 0) { + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: Failed to get sink input info: %s\n", + pa_strerror(pa_context_errno(this->context))); + return; + } + + if (!info) + return; + + this->cvolume = info->volume; + + __xine_pa_context_success_callback(ctx, 0, this); +} + +static int wait_for_operation(pulse_driver_t *this, pa_operation *o) { _x_assert(this && o && this->mainloop); @@ -119,6 +225,7 @@ static int ao_pulse_open(ao_driver_t *this_gen, pulse_driver_t *this = (pulse_driver_t *) this_gen; struct pa_sample_spec ss; struct pa_buffer_attr a; + pa_stream_state_t streamstate; xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode); @@ -166,24 +273,11 @@ static int ao_pulse_open(ao_driver_t *this_gen, goto fail; } - this->mainloop = pa_threaded_mainloop_new(); - pa_threaded_mainloop_start(this->mainloop); - _x_assert(this->mainloop); - - this->context = pa_context_new(pa_threaded_mainloop_get_api(this->mainloop), __progname); - _x_assert(this->context); - - pa_context_connect(this->context, this->host, 1, NULL); - - if (pa_context_get_state(this->context) != PA_CONTEXT_READY) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: Failed to connect to server: %s\n", - pa_strerror(pa_context_errno(this->context))); - goto fail; - } - this->stream = pa_stream_new(this->context, "audio stream", &ss, NULL); _x_assert(this->stream); + pa_stream_set_state_callback(this->stream, __xine_pa_stream_state_callback, this); + a.maxlength = pa_bytes_per_second(&ss)*1; a.tlength = a.maxlength*9/10; a.prebuf = a.tlength/2; @@ -194,8 +288,15 @@ static int ao_pulse_open(ao_driver_t *this_gen, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE, &this->cvolume, NULL); - if (pa_stream_get_state(this->stream) != PA_STREAM_READY) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: Failed to connect to server: %s\n", + do { + xine_usec_sleep (100); + + streamstate = pa_stream_get_state(this->stream); + fprintf(stderr, "PulseAudio stream state: %d\n", streamstate); + } while (streamstate < PA_STREAM_READY); + + if (streamstate != PA_STREAM_READY) { + xprintf (this->xine, XINE_VERBOSITY_LOG, "audio_pulse_out: Failed to connect to server: %s\n", pa_strerror(pa_context_errno(this->context))); goto fail; } @@ -250,8 +351,6 @@ static int ao_pulse_write(ao_driver_t *this_gen, int16_t *data, pa_stream_write(this->stream, data, l, NULL, 0, PA_SEEK_RELATIVE); data = (int16_t *) ((uint8_t*) data + l); size -= l; - - wait_for_completion(this); } this->frames_written += num_frames; @@ -294,22 +393,11 @@ static void ao_pulse_close(ao_driver_t *this_gen) if (this->stream) { if (pa_stream_get_state(this->stream) == PA_STREAM_READY) - wait_for_operation(this, pa_stream_drain(this->stream, NULL, NULL)); + wait_for_operation(this, pa_stream_drain(this->stream, __xine_pa_stream_success_callback, this)); pa_stream_disconnect(this->stream); pa_stream_unref(this->stream); this->stream = NULL; } - - if (this->context) { - pa_context_disconnect(this->context); - pa_context_unref(this->context); - this->context = NULL; - } - - if (this->mainloop) { - pa_threaded_mainloop_free(this->mainloop); - this->mainloop = NULL; - } } static uint32_t ao_pulse_get_capabilities (ao_driver_t *this_gen) { @@ -324,25 +412,6 @@ static void ao_pulse_exit(ao_driver_t *this_gen) free (this); } -/** A callback function that is called when the - * pa_context_get_sink_input_info() operation completes. Saves the - * volume field of the specified structure to the global variable volume. */ -static void info_func(struct pa_context *c, const struct pa_sink_input_info *i, int is_last, void *userdata) { - - pulse_driver_t *this = (pulse_driver_t *) userdata; - if (is_last < 0) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: Failed to get sink input info: %s\n", - pa_strerror(pa_context_errno(this->context))); - return; - } - - if (!i) - return; - - this->cvolume = i->volume; -} - - static int ao_pulse_get_property (ao_driver_t *this_gen, int property) { pulse_driver_t *this = (pulse_driver_t *) this_gen; @@ -351,7 +420,8 @@ static int ao_pulse_get_property (ao_driver_t *this_gen, int property) { case AO_PROP_MIXER_VOL: if( this->stream && this->context ) wait_for_operation(this, - pa_context_get_sink_input_info(this->context, pa_stream_get_index(this->stream), info_func, this)); + pa_context_get_sink_input_info(this->context, pa_stream_get_index(this->stream), + __xine_pa_sink_info_callback, this)); return (int) (pa_sw_volume_to_linear(this->swvolume)*100); break; case AO_PROP_MUTE_VOL: @@ -372,7 +442,7 @@ static int ao_pulse_set_property (ao_driver_t *this_gen, int property, int value pa_cvolume_set(&this->cvolume, pa_stream_get_sample_spec(this->stream)->channels, this->swvolume); wait_for_operation(this, pa_context_set_sink_input_volume(this->context, pa_stream_get_index(this->stream), - &this->cvolume, NULL, NULL)); + &this->cvolume, __xine_pa_context_success_callback, this)); } break; case AO_PROP_MUTE_VOL: @@ -390,25 +460,25 @@ static int ao_pulse_ctrl(ao_driver_t *this_gen, int cmd, ...) { case AO_CTRL_PLAY_PAUSE: _x_assert(this->stream && this->context ); if(pa_stream_get_state(this->stream) == PA_STREAM_READY) - wait_for_operation(this,pa_stream_cork(this->stream, 1, NULL, NULL)); + wait_for_operation(this,pa_stream_cork(this->stream, 1, __xine_pa_stream_success_callback, this)); break; case AO_CTRL_PLAY_RESUME: _x_assert(this->stream && this->context); if(pa_stream_get_state(this->stream) == PA_STREAM_READY) { struct pa_operation *o2, *o1; - o1 = pa_stream_prebuf(this->stream, NULL, NULL); - o2 = pa_stream_cork(this->stream, 0, NULL, NULL); - _x_assert(o1 && o2); - wait_for_operation(this,o1); - wait_for_operation(this,o2); + o1 = pa_stream_prebuf(this->stream, __xine_pa_stream_success_callback, this); + _x_assert(o1); wait_for_operation(this, o1); + + o2 = pa_stream_cork(this->stream, 0, __xine_pa_stream_success_callback, this); + _x_assert(o2); wait_for_operation(this,o2); } break; case AO_CTRL_FLUSH_BUFFERS: _x_assert(this->stream && this->context); if(pa_stream_get_state(this->stream) == PA_STREAM_READY) - wait_for_operation(this,pa_stream_flush(this->stream, NULL, NULL)); + wait_for_operation(this,pa_stream_flush(this->stream, __xine_pa_stream_success_callback, this)); this->frames_written = 0; break; } @@ -421,6 +491,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da pulse_driver_t *this; char hn[128]; char *device; + pa_context_state_t ctxstate; lprintf ("audio_pulse_out: open_plugin called\n"); @@ -480,16 +551,31 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da xprintf (class->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: host %s sink %s\n", this->host ? this->host : "(null)", this->sink ? this->sink : "(null)"); - /* test pulseaudio connection */ - if( this->ao_driver.open(&this->ao_driver, 16, 44100, AO_CAP_MODE_STEREO) != 0 ) { - this->ao_driver.close(&this->ao_driver); - } else { - free(this); - xprintf (class->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: open_plugin failed.\n"); - return NULL; + this->mainloop = class->mainloop; + this->context = class->context; + + if ( pa_context_get_state(this->context) != PA_CONTEXT_READY ){ + pa_context_connect(this->context, this->host, 1, NULL); + + do { + xine_usec_sleep (100); + + ctxstate = pa_context_get_state(this->context); + } while (ctxstate < PA_CONTEXT_READY); + + if (ctxstate != PA_CONTEXT_READY) { + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: Failed to connect to server: %s\n", + pa_strerror(pa_context_errno(this->context))); + goto fail; + } } return &this->ao_driver; + + fail: + free(this); + xprintf (class->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: open_plugin failed.\n"); + return NULL; } /* @@ -508,6 +594,11 @@ static void dispose_class (audio_driver_class_t *this_gen) { pulse_class_t *this = (pulse_class_t *) this_gen; + pa_context_unref(this->context); + + pa_threaded_mainloop_stop(this->mainloop); + pa_threaded_mainloop_free(this->mainloop); + free (this); } @@ -528,6 +619,16 @@ static void *init_class (xine_t *xine, void *data) { this->xine = xine; + this->mainloop = pa_threaded_mainloop_new(); + _x_assert(this->mainloop); + + pa_threaded_mainloop_start(this->mainloop); + + this->context = pa_context_new(pa_threaded_mainloop_get_api(this->mainloop), __progname); + _x_assert(this->context); + + pa_context_set_state_callback(this->context, __xine_pa_ctx_state_callback, this); + return this; } -- cgit v1.2.3 From 3bdbac87849cdb158ca3e963c3659d84c6323a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 3 Feb 2007 10:45:02 +0000 Subject: Remove the state callbacks, it's simpler to just wait a bit for the connection, as that's just what is going on those given moments, and avoids stray signals along the way. CVS patchset: 8583 CVS date: 2007/02/03 10:45:02 --- src/audio_out/audio_pulse_out.c | 40 +--------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c index 8f0c6aab5..834429d10 100644 --- a/src/audio_out/audio_pulse_out.c +++ b/src/audio_out/audio_pulse_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_pulse_out.c,v 1.9 2007/02/03 10:41:09 dgp85 Exp $ + * $Id: audio_pulse_out.c,v 1.10 2007/02/03 10:45:02 dgp85 Exp $ * * ao plugin for pulseaudio (rename of polypaudio): * http://0pointer.de/lennart/projects/pulsaudio/ @@ -102,40 +102,6 @@ typedef struct { struct pa_threaded_mainloop *mainloop; } pulse_class_t; -/** - * @brief Callback function called when the status of the PulseAudio - * context changes - * @param ctx Context that changed (same as class->context) - * @param class_gen pulse_class_t pointer for the PulseAudio output - * instance. - */ -static void __xine_pa_ctx_state_callback(pa_context *const ctx, void *const class_gen) -{ - pulse_class_t *const class = (pulse_class_t*)class_gen; - - _x_assert(ctx); _x_assert(class); - _x_assert(ctx == class->context); - - pa_threaded_mainloop_signal(class->mainloop, 0); -} - -/** - * @brief Callback function called when the status of the PulseAudio - * stream changes - * @param stream Stream that changed (same as this->stream) - * @param this_gen pulse_driver_t pointer for the PulseAudio output - * instance. - */ -static void __xine_pa_stream_state_callback(pa_stream *const stream, void *const this_gen) -{ - pulse_driver_t *const this = (pulse_driver_t*)this_gen; - - _x_assert(stream); _x_assert(this); - _x_assert(stream == this->stream); - - pa_threaded_mainloop_signal(this->mainloop, 0); -} - /** * @brief Callback function called when a stream operation succeed * @param stream Stream which operation has succeeded @@ -276,8 +242,6 @@ static int ao_pulse_open(ao_driver_t *this_gen, this->stream = pa_stream_new(this->context, "audio stream", &ss, NULL); _x_assert(this->stream); - pa_stream_set_state_callback(this->stream, __xine_pa_stream_state_callback, this); - a.maxlength = pa_bytes_per_second(&ss)*1; a.tlength = a.maxlength*9/10; a.prebuf = a.tlength/2; @@ -627,8 +591,6 @@ static void *init_class (xine_t *xine, void *data) { this->context = pa_context_new(pa_threaded_mainloop_get_api(this->mainloop), __progname); _x_assert(this->context); - pa_context_set_state_callback(this->context, __xine_pa_ctx_state_callback, this); - return this; } -- cgit v1.2.3 From 77280e7059f4bd9f52ac606a2190af78a1b55c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 3 Feb 2007 10:46:14 +0000 Subject: Remove a debug output. CVS patchset: 8584 CVS date: 2007/02/03 10:46:14 --- src/audio_out/audio_pulse_out.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c index 834429d10..d04856c61 100644 --- a/src/audio_out/audio_pulse_out.c +++ b/src/audio_out/audio_pulse_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_pulse_out.c,v 1.10 2007/02/03 10:45:02 dgp85 Exp $ + * $Id: audio_pulse_out.c,v 1.11 2007/02/03 10:46:14 dgp85 Exp $ * * ao plugin for pulseaudio (rename of polypaudio): * http://0pointer.de/lennart/projects/pulsaudio/ @@ -256,7 +256,6 @@ static int ao_pulse_open(ao_driver_t *this_gen, xine_usec_sleep (100); streamstate = pa_stream_get_state(this->stream); - fprintf(stderr, "PulseAudio stream state: %d\n", streamstate); } while (streamstate < PA_STREAM_READY); if (streamstate != PA_STREAM_READY) { -- cgit v1.2.3 From 514a9684972102eccf5a8a85c65febcc3966e21f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 3 Feb 2007 11:06:40 +0000 Subject: =?UTF-8?q?Fix=20for=20libflac=20<1.1.3,=20thanks=20to=20Ville=20S?= =?UTF-8?q?kytt=C3=A4=20for=20reporting,=20closes=20bug=20#1627321.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CVS patchset: 8586 CVS date: 2007/02/03 11:06:40 --- src/libflac/decoder_flac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libflac/decoder_flac.c b/src/libflac/decoder_flac.c index 095555e1d..9b77cc27d 100644 --- a/src/libflac/decoder_flac.c +++ b/src/libflac/decoder_flac.c @@ -363,7 +363,7 @@ open_plugin (audio_decoder_class_t *class_gen, xine_stream_t *stream) { FLAC__stream_decoder_set_client_data (this->flac_decoder, this); - if (FLAC__stream_decoder_init (this->flac_decoder) == FLAC__STREAM_DECODER_SEARCH_FOR_METADATA) { + if (FLAC__stream_decoder_init (this->flac_decoder) != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA) { free (this); return NULL; } -- cgit v1.2.3 From 46a9c8c8821582ded1157d8a221638327f0bbaf8 Mon Sep 17 00:00:00 2001 From: Darren Salt <linux@youmustbejoking.demon.co.uk> Date: Sat, 3 Feb 2007 16:31:55 +0000 Subject: A few const-correctness fixes. CVS patchset: 8587 CVS date: 2007/02/03 16:31:55 --- src/xine-engine/alphablend.c | 2 +- src/xine-engine/xine_interface.c | 4 ++-- src/xine-utils/array.c | 6 +++--- src/xine-utils/array.h | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/xine-engine/alphablend.c b/src/xine-engine/alphablend.c index a0ff6ccf3..9947da365 100644 --- a/src/xine-engine/alphablend.c +++ b/src/xine-engine/alphablend.c @@ -66,7 +66,7 @@ static void mem_blend24(uint8_t *mem, uint8_t r, uint8_t g, uint8_t b, } } -static void mem_blend32(uint8_t *mem, uint8_t *src, uint8_t o, int len) { +static void mem_blend32(uint8_t *mem, const uint8_t *src, uint8_t o, int len) { uint8_t *limit = mem + len*4; while (mem < limit) { *mem = BLEND_BYTE(*mem, src[0], o); diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c index 7e7527de7..afbd15051 100644 --- a/src/xine-engine/xine_interface.c +++ b/src/xine-engine/xine_interface.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_interface.c,v 1.100 2006/12/19 19:10:52 dsalt Exp $ + * $Id: xine_interface.c,v 1.101 2007/02/03 16:31:55 dsalt Exp $ * * convenience/abstraction layer, functions to implement * libxine's public interface @@ -929,7 +929,7 @@ int _x_message(xine_stream_t *stream, int type, ...) { va_list ap; char *s, *params; char *args[1025]; - static char *std_explanation[] = { + static const char *std_explanation[] = { "", N_("Warning:"), N_("Unknown host:"), diff --git a/src/xine-utils/array.c b/src/xine-utils/array.c index 4fcecbb4b..ed529515b 100644 --- a/src/xine-utils/array.c +++ b/src/xine-utils/array.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: array.c,v 1.3 2006/09/26 05:19:49 dgp85 Exp $ + * $Id: array.c,v 1.4 2007/02/03 16:31:55 dsalt Exp $ * */ #ifdef HAVE_CONFIG_H @@ -78,7 +78,7 @@ void xine_array_delete(xine_array_t *array) { free(array); } -size_t xine_array_size(xine_array_t *array) { +size_t xine_array_size(const xine_array_t *array) { return array->size; } @@ -116,7 +116,7 @@ void xine_array_remove(xine_array_t *array, unsigned int position) { } } -void *xine_array_get(xine_array_t *array, unsigned int position) { +void *xine_array_get(const xine_array_t *array, unsigned int position) { if (position < array->size) return array->chunk[position]; else diff --git a/src/xine-utils/array.h b/src/xine-utils/array.h index 45fc7b137..80b7d3c9b 100644 --- a/src/xine-utils/array.h +++ b/src/xine-utils/array.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: array.h,v 1.2 2006/09/26 05:19:49 dgp85 Exp $ + * $Id: array.h,v 1.3 2007/02/03 16:31:55 dsalt Exp $ * * Array that can grow automatically when you add elements. * Inserting an element in the middle of the array implies memory moves. @@ -35,7 +35,7 @@ xine_array_t *xine_array_new(size_t initial_size) XINE_PROTECTED; void xine_array_delete(xine_array_t *array) XINE_PROTECTED; /* Returns the number of element stored in the array */ -size_t xine_array_size(xine_array_t *array) XINE_PROTECTED; +size_t xine_array_size(const xine_array_t *array) XINE_PROTECTED; /* Removes all elements from an array */ void xine_array_clear(xine_array_t *array) XINE_PROTECTED; @@ -50,7 +50,7 @@ void xine_array_insert(xine_array_t *array, unsigned int position, void *value) void xine_array_remove(xine_array_t *array, unsigned int position) XINE_PROTECTED; /* Get the element at the position specified */ -void *xine_array_get(xine_array_t *array, unsigned int position) XINE_PROTECTED; +void *xine_array_get(const xine_array_t *array, unsigned int position) XINE_PROTECTED; /* Set the element at the position specified */ void xine_array_set(xine_array_t *array, unsigned int position, void *value) XINE_PROTECTED; -- cgit v1.2.3 From 8f8c8599f637cabb9a3c617934023fd854647cc9 Mon Sep 17 00:00:00 2001 From: Darren Salt <linux@youmustbejoking.demon.co.uk> Date: Sat, 3 Feb 2007 23:56:32 +0000 Subject: Broken MIME type. CVS patchset: 8588 CVS date: 2007/02/03 23:56:32 --- src/demuxers/demux_mpgaudio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 2db1336a0..346ed4093 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpgaudio.c,v 1.146 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_mpgaudio.c,v 1.147 2007/02/03 23:56:32 dsalt Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -1085,7 +1085,7 @@ static const char *get_mimetypes (demux_class_t *this_gen) { "audio/x-mpeg3: mp3: MPEG audio;" "audio/mpeg: mpa,abs,mpega: MPEG audio;" "audio/x-mpeg: mpa,abs,mpega: MPEG audio;" - "x-mpegurl: mp3: MPEG audio;" + "audio/x-mpegurl: mp3: MPEG audio;" "audio/mpegurl: mp3: MPEG audio;" "audio/mp3: mp3: MPEG audio;" "audio/x-mp3: mp3: MPEG audio;"; -- cgit v1.2.3 From e418c1e04f612664164841c297ddb97a0f3135bf Mon Sep 17 00:00:00 2001 From: Darren Salt <linux@youmustbejoking.demon.co.uk> Date: Thu, 8 Feb 2007 02:40:22 +0000 Subject: Remove any possibility of strcpy/sprintf overflows wrt front ends requesting language & subtitle strings (given a buffer of >= XINE_LANG_MAX bytes). Also fixes an off-by-one buffer termination in the TS code. (Note: compile-tested only.) CVS patchset: 8592 CVS date: 2007/02/08 02:40:22 --- src/demuxers/demux_ogg.c | 6 ++---- src/demuxers/demux_ts.c | 11 ++++++----- src/input/input_dvd.c | 8 ++++---- src/input/vcd/xineplug_inp_vcd.c | 8 ++++---- 4 files changed, 16 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index 218728e1b..59ede919b 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_ogg.c,v 1.174 2007/01/23 23:20:23 hadess Exp $ + * $Id: demux_ogg.c,v 1.175 2007/02/08 02:40:22 dsalt Exp $ * * demultiplexer for ogg streams * @@ -1865,9 +1865,7 @@ static int format_lang_string (demux_ogg_t * this, uint32_t buf_mask, uint32_t b for (stream_num=0; stream_num<this->num_streams; stream_num++) { if ((this->si[stream_num]->buf_types & buf_mask) == buf_type) { if (this->si[stream_num]->language) { - strncpy (str, this->si[stream_num]->language, XINE_LANG_MAX); - str[XINE_LANG_MAX - 1] = '\0'; - if (strlen(this->si[stream_num]->language) >= XINE_LANG_MAX) + if (snprintf (str, XINE_LANG_MAX, "%s", this->si[stream_num]->language) >= XINE_LANG_MAX) /* the string got truncated */ str[XINE_LANG_MAX - 2] = str[XINE_LANG_MAX - 3] = str[XINE_LANG_MAX - 4] = '.'; /* TODO: provide long version in XINE_META_INFO_FULL_LANG */ diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 99bc486a0..da2c37625 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_ts.c,v 1.124 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_ts.c,v 1.125 2007/02/08 02:40:22 dsalt Exp $ * * Demultiplexer for MPEG2 Transport Streams. * @@ -2015,11 +2015,12 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen, case DEMUX_OPTIONAL_DATA_AUDIOLANG: if (this->audioLang[0]) { - strcpy(str, this->audioLang); + strncpy(str, this->audioLang, XINE_LANG_MAX - 1); + str[XINE_LANG_MAX - 1] = 0; } else { - sprintf(str, "%3i", _x_get_audio_channel(this->stream)); + snprintf(str, XINE_LANG_MAX, "%3i", _x_get_audio_channel(this->stream)); } return DEMUX_OPTIONAL_SUCCESS; @@ -2028,7 +2029,7 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen, && this->current_spu_channel < this->no_spu_langs) { memcpy(str, this->spu_langs[this->current_spu_channel].desc.lang, 3); - str[4] = 0; + str[3] = 0; } else if (this->current_spu_channel == -1) { @@ -2036,7 +2037,7 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen, } else { - sprintf(str, "%3i", this->current_spu_channel); + snprintf(str, XINE_LANG_MAX, "%3i", this->current_spu_channel); } return DEMUX_OPTIONAL_SUCCESS; diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index c132bdb04..a8100a063 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_dvd.c,v 1.214 2007/01/19 01:05:25 dgp85 Exp $ + * $Id: input_dvd.c,v 1.215 2007/02/08 02:40:23 dsalt Exp $ * */ @@ -1278,7 +1278,7 @@ static int dvd_plugin_get_optional_data (input_plugin_t *this_gen, if(this && this->stream && this->dvdnav) { if(!(dvdnav_is_domain_vts(this->dvdnav))) { - sprintf(data, "%s", "menu"); + strcpy(data, "menu"); if (channel <= 0) return INPUT_OPTIONAL_SUCCESS; else @@ -1297,11 +1297,11 @@ static int dvd_plugin_get_optional_data (input_plugin_t *this_gen, sprintf(data, " %c%c", lang >> 8, lang & 0xff); /* TODO: provide long version in XINE_META_INFO_FULL_LANG */ else - sprintf(data, " %c%c", '?', '?'); + strcpy(data, " ??"); return INPUT_OPTIONAL_SUCCESS; } else { if (channel == -1) { - sprintf(data, "%s", "none"); + strcpy(data, "none"); return INPUT_OPTIONAL_SUCCESS; } } diff --git a/src/input/vcd/xineplug_inp_vcd.c b/src/input/vcd/xineplug_inp_vcd.c index 87b442acd..920b5c1d8 100644 --- a/src/input/vcd/xineplug_inp_vcd.c +++ b/src/input/vcd/xineplug_inp_vcd.c @@ -1,5 +1,5 @@ /* - $Id: xineplug_inp_vcd.c,v 1.52 2006/12/19 19:10:51 dsalt Exp $ + $Id: xineplug_inp_vcd.c,v 1.53 2007/02/08 02:40:23 dsalt Exp $ Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> @@ -1295,7 +1295,7 @@ vcd_get_optional_data (input_plugin_t *this_gen, dbg_print(INPUT_DBG_EXT, "AUDIO CHANNEL = %d\n", channel); if (channel == (uint8_t)-1) { - sprintf(data, " %s", "auto"); + strcpy(data, "auto"); } else { const vcdinfo_obj_t *p_vcdinfo= my_vcd.player.vcd; unsigned int audio_type; @@ -1320,9 +1320,9 @@ vcd_get_optional_data (input_plugin_t *this_gen, channel = (int8_t) _x_get_spu_channel(my_vcd.stream); dbg_print(INPUT_DBG_EXT, "SPU CHANNEL = %d\n", channel); if (-1 == channel) { - sprintf(data, " %s", "auto"); + strcpy(data, "auto"); } else { - sprintf(data, " %1d", channel); + sprintf(data, "%1d", channel); } } -- cgit v1.2.3 From a84c775aa8fb66edfb6f2955f58599196f97d256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 15 Feb 2007 15:19:32 +0000 Subject: Commit the XCB output plugins by Christoph Pfister after testing on Gentoo packages for about ten days. CVS patchset: 8595 CVS date: 2007/02/15 15:19:32 --- src/video_out/Makefile.am | 24 +- src/video_out/video_out_xcbshm.c | 1274 ++++++++++++++++++++++++++++++ src/video_out/video_out_xcbxv.c | 1598 ++++++++++++++++++++++++++++++++++++++ src/video_out/video_out_xshm.c | 9 +- src/video_out/xcbosd.c | 546 +++++++++++++ src/video_out/xcbosd.h | 55 ++ 6 files changed, 3497 insertions(+), 9 deletions(-) create mode 100644 src/video_out/video_out_xcbshm.c create mode 100644 src/video_out/video_out_xcbxv.c create mode 100644 src/video_out/xcbosd.c create mode 100644 src/video_out/xcbosd.h (limited to 'src') diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index 45b5dac8c..041184e8c 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -37,6 +37,16 @@ endif endif endif +if HAVE_XCB +XCBOSD = xcbosd.c +if HAVE_XCBSHM +xcbshm_module = xineplug_vo_out_xcbshm.la +endif +if HAVE_XCBXV +xcbxv_module = xineplug_vo_out_xcbxv.la +endif +endif + if HAVE_VIDIX vidix_module = xineplug_vo_out_vidix.la endif @@ -86,8 +96,20 @@ lib_LTLIBRARIES = $(xshm_module) $(xv_module) $(xvmc_module) \ $(caca_module) \ $(macosx_module) \ $(xxmc_module) \ + $(xcbshm_module) \ + $(xcbxv_module) \ xineplug_vo_out_none.la +xineplug_vo_out_xcbshm_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c video_out_xcbshm.c $(XCBOSD) +xineplug_vo_out_xcbshm_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) $(THREAD_LIBS) $(XCB_LIBS) $(XCBSHM_LIBS) +xineplug_vo_out_xcbshm_la_CFLAGS = $(VISIBILITY_FLAG) $(MLIB_CFLAGS) $(XCB_CFLAGS) $(XCBSHM_CFLAGS) +xineplug_vo_out_xcbshm_la_LDFLAGS = -avoid-version -module + +xineplug_vo_out_xcbxv_la_SOURCES = deinterlace.c video_out_xcbxv.c $(XCBOSD) +xineplug_vo_out_xcbxv_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) $(XCBXV_LIBS) $(XCB_LIBS) +xineplug_vo_out_xcbxv_la_CFLAGS = $(VISIBILITY_FLAG) $(XCB_CFLAGS) $(XCBXV_CFLAGS) +xineplug_vo_out_xcbxv_la_LDFLAGS = -avoid-version -module + xineplug_vo_out_xshm_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ video_out_xshm.c $(X11OSD) xineplug_vo_out_xshm_la_LIBADD = $(MLIB_LIBS) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) @@ -192,4 +214,4 @@ xineplug_vo_out_macosx_la_LDFLAGS = -avoid-version -module \ -Wl,-framework -Wl,Cocoa -framework Cocoa -framework OpenGL noinst_HEADERS = deinterlace.h video_out_syncfb.h \ - yuv2rgb.h x11osd.h + yuv2rgb.h x11osd.h xcbosd.h diff --git a/src/video_out/video_out_xcbshm.c b/src/video_out/video_out_xcbshm.c new file mode 100644 index 000000000..3e45c7fdb --- /dev/null +++ b/src/video_out/video_out_xcbshm.c @@ -0,0 +1,1274 @@ +/* + * Copyright (C) 2000-2003, 2007 the xine project + * + * This file is part of xine, a free video player. + * + * xine 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. + * + * xine 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * $Id: video_out_xcbshm.c,v 1.1 2007/02/15 15:19:33 dgp85 Exp $ + * + * video_out_xcbshm.c, X11 shared memory extension interface for xine + * + * based on mpeg2dec code from + * Aaron Holtzman <aholtzma@ess.engr.uvic.ca> + * + * xine-specific code by Guenter Bartsch <bartscgr@studbox.uni-stuttgart.de> + * + * ported to xcb by Christoph Pfister - Feb 2007 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> + +#include "xine.h" +#include "video_out.h" + +#include <errno.h> + +#include <xcb/shm.h> + +#include <sys/ipc.h> +#include <sys/shm.h> +#include <sys/time.h> + +#include <pthread.h> +#include <netinet/in.h> + +#define LOG_MODULE "video_out_xcbshm" +#define LOG_VERBOSE +/* +#define LOG +*/ + +#include "xine_internal.h" +#include "yuv2rgb.h" +#include "xineutils.h" +#include "vo_scale.h" +#include "xcbosd.h" + +typedef struct { + vo_frame_t vo_frame; + + /* frame properties as delivered by the decoder: */ + /* obs: for width/height use vo_scale_t struct */ + int format; + int flags; + + vo_scale_t sc; + + uint8_t *image; + int bytes_per_line; + xcb_shm_seg_t shmseg; + + uint8_t *chunk[3]; /* mem alloc by xmalloc_aligned */ + + yuv2rgb_t *yuv2rgb; /* yuv2rgb converter set up for this frame */ + uint8_t *rgb_dst; + +} xshm_frame_t; + +typedef struct { + + vo_driver_t vo_driver; + + /* xcb / shm related stuff */ + xcb_connection_t *connection; + xcb_screen_t *screen; + xcb_window_t window; + xcb_gcontext_t gc; + int depth; + int bpp; + int scanline_pad; + int use_shm; + + int yuv2rgb_brightness; + int yuv2rgb_contrast; + int yuv2rgb_saturation; + uint8_t *yuv2rgb_cmap; + yuv2rgb_factory_t *yuv2rgb_factory; + + vo_scale_t sc; + + xshm_frame_t *cur_frame; + xcbosd *xoverlay; + int ovl_changed; + + xine_t *xine; + + alphablend_t alphablend_extra_data; + + pthread_mutex_t main_mutex; + +} xshm_driver_t; + +typedef struct { + video_driver_class_t driver_class; + + config_values_t *config; + xine_t *xine; +} xshm_class_t; + + +/* + * allocate an XImage, try XShm first but fall back to + * plain X11 if XShm should fail + */ +static void create_ximage(xshm_driver_t *this, xshm_frame_t *frame, int width, int height) +{ + frame->bytes_per_line = ((this->bpp * width + this->scanline_pad - 1) & + (~(this->scanline_pad - 1))) >> 3; + + if (this->use_shm) { + int shmid; + xcb_void_cookie_t shm_attach_cookie; + xcb_generic_error_t *generic_error; + + /* + * try shm + */ + + shmid = shmget(IPC_PRIVATE, frame->bytes_per_line * height, IPC_CREAT | 0777); + + if (shmid < 0) { + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_xshm: %s: allocating image\n" + "video_out_xshm: => not using MIT Shared Memory extension.\n"), strerror(errno)); + goto shm_fail1; + } + + frame->image = shmat(shmid, 0, 0); + + if (frame->image == ((void *) -1)) { + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_xshm: shared memory error (address error) when allocating image \n" + "video_out_xshm: => not using MIT Shared Memory extension.\n")); + goto shm_fail2; + } + + frame->shmseg = xcb_generate_id(this->connection); + shm_attach_cookie = xcb_shm_attach_checked(this->connection, frame->shmseg, shmid, 0); + generic_error = xcb_request_check(this->connection, shm_attach_cookie); + + if (generic_error != NULL) { + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_xshm: x11 error during shared memory XImage creation\n" + "video_out_xshm: => not using MIT Shared Memory extension.\n")); + free(generic_error); + goto shm_fail3; + } + + /* + * Now that the Xserver has learned about and attached to the + * shared memory segment, delete it. It's actually deleted by + * the kernel when all users of that segment have detached from + * it. Gives an automatic shared memory cleanup in case we crash. + */ + + shmctl(shmid, IPC_RMID, 0); + + return; + + shm_fail3: + frame->shmseg = 0; + shmdt(frame->image); + shm_fail2: + shmctl(shmid, IPC_RMID, 0); + shm_fail1: + this->use_shm = 0; + } + + /* + * fall back to plain X11 if necessary + */ + + frame->image = malloc(frame->bytes_per_line * height); +} + +static void dispose_ximage(xshm_driver_t *this, xshm_frame_t *frame) +{ + if (frame->shmseg) { + xcb_shm_detach(this->connection, frame->shmseg); + frame->shmseg = 0; + shmdt(frame->image); + } else + free(frame->image); + frame->image = NULL; +} + + +/* + * and now, the driver functions + */ + +static uint32_t xshm_get_capabilities (vo_driver_t *this_gen) { + xshm_driver_t *this = (xshm_driver_t *) this_gen; + uint32_t capabilities = VO_CAP_YV12 | VO_CAP_YUY2; + + if( this->xoverlay ) + capabilities |= VO_CAP_UNSCALED_OVERLAY; + + return capabilities; +} + +static void xshm_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { + xshm_frame_t *frame = (xshm_frame_t *) vo_img ; + /*xshm_driver_t *this = (xshm_driver_t *) vo_img->driver; */ + + vo_img->proc_called = 1; + + if( frame->vo_frame.crop_left || frame->vo_frame.crop_top || + frame->vo_frame.crop_right || frame->vo_frame.crop_bottom ) + { + /* we don't support crop, so don't even waste cpu cycles. + * cropping will be performed by video_out.c + */ + return; + } + + lprintf ("copy... (format %d)\n", frame->format); + + if (frame->format == XINE_IMGFMT_YV12) + frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst, + src[0], src[1], src[2]); + else + frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, + src[0]); + + lprintf ("copy...done\n"); +} + +static void xshm_frame_field (vo_frame_t *vo_img, int which_field) { + xshm_frame_t *frame = (xshm_frame_t *) vo_img ; + /* xshm_driver_t *this = (xshm_driver_t *) vo_img->driver; */ + + switch (which_field) { + case VO_TOP_FIELD: + frame->rgb_dst = frame->image; + break; + case VO_BOTTOM_FIELD: + frame->rgb_dst = frame->image + frame->bytes_per_line; + break; + case VO_BOTH_FIELDS: + frame->rgb_dst = frame->image; + break; + } + + frame->yuv2rgb->next_slice (frame->yuv2rgb, NULL); +} + +static void xshm_frame_dispose (vo_frame_t *vo_img) { + xshm_frame_t *frame = (xshm_frame_t *) vo_img ; + xshm_driver_t *this = (xshm_driver_t *) vo_img->driver; + + if (frame->image) { + pthread_mutex_lock(&this->main_mutex); + dispose_ximage(this, frame); + pthread_mutex_unlock(&this->main_mutex); + } + + frame->yuv2rgb->dispose (frame->yuv2rgb); + + free (frame->chunk[0]); + free (frame->chunk[1]); + free (frame->chunk[2]); + free (frame); +} + + +static vo_frame_t *xshm_alloc_frame (vo_driver_t *this_gen) { + xshm_frame_t *frame; + xshm_driver_t *this = (xshm_driver_t *) this_gen; + + frame = (xshm_frame_t *) xine_xmalloc (sizeof (xshm_frame_t)); + if (!frame) + return NULL; + + memcpy (&frame->sc, &this->sc, sizeof(vo_scale_t)); + + pthread_mutex_init (&frame->vo_frame.mutex, NULL); + + /* + * supply required functions/fields + */ + + frame->vo_frame.proc_slice = xshm_frame_proc_slice; + frame->vo_frame.proc_frame = NULL; + frame->vo_frame.field = xshm_frame_field; + frame->vo_frame.dispose = xshm_frame_dispose; + frame->vo_frame.driver = this_gen; + + /* + * colorspace converter for this frame + */ + + frame->yuv2rgb = this->yuv2rgb_factory->create_converter (this->yuv2rgb_factory); + + return (vo_frame_t *) frame; +} + +static void xshm_compute_ideal_size (xshm_driver_t *this, xshm_frame_t *frame) { + _x_vo_scale_compute_ideal_size( &frame->sc ); +} + +static void xshm_compute_rgb_size (xshm_driver_t *this, xshm_frame_t *frame) { + _x_vo_scale_compute_output_size( &frame->sc ); + + /* avoid problems in yuv2rgb */ + if (frame->sc.output_height < 1) + frame->sc.output_height = 1; + if (frame->sc.output_width < 8) + frame->sc.output_width = 8; + if (frame->sc.output_width & 1) /* yuv2rgb_mlib needs an even YUV2 width */ + frame->sc.output_width++; + + lprintf("frame source (%d) %d x %d => screen output %d x %d%s\n", + frame->vo_frame.id, + frame->sc.delivered_width, frame->sc.delivered_height, + frame->sc.output_width, frame->sc.output_height, + ( frame->sc.delivered_width != frame->sc.output_width + || frame->sc.delivered_height != frame->sc.output_height + ? ", software scaling" + : "" ) + ); +} + +static void xshm_update_frame_format (vo_driver_t *this_gen, + vo_frame_t *frame_gen, + uint32_t width, uint32_t height, + double ratio, int format, int flags) { + xshm_driver_t *this = (xshm_driver_t *) this_gen; + xshm_frame_t *frame = (xshm_frame_t *) frame_gen; + int do_adapt; + int gui_width; + int gui_height; + double gui_pixel_aspect; + + flags &= VO_BOTH_FIELDS; + + /* ask gui what output size we'll have for this frame */ + /* get the gui_pixel_aspect before calling xshm_compute_ideal_size() */ + /* note: gui_width and gui_height may be bogus because we may have not yet*/ + /* updated video_pixel_aspect (see _x_vo_scale_compute_ideal_size). */ + frame->sc.dest_size_cb (frame->sc.user_data, width, height, + frame->sc.video_pixel_aspect, + &gui_width, &gui_height, + &gui_pixel_aspect); + + /* find out if we need to adapt this frame */ + do_adapt = 0; + + if ((width != frame->sc.delivered_width) + || (height != frame->sc.delivered_height) + || (ratio != frame->sc.delivered_ratio) + || (flags != frame->flags) + || (format != frame->format) + || (gui_pixel_aspect != frame->sc.gui_pixel_aspect) + || (this->sc.user_ratio != frame->sc.user_ratio)) { + + do_adapt = 1; + + lprintf ("frame format (from decoder) has changed => adapt\n"); + + frame->sc.delivered_width = width; + frame->sc.delivered_height = height; + frame->sc.delivered_ratio = ratio; + frame->sc.gui_pixel_aspect = gui_pixel_aspect; + frame->flags = flags; + frame->format = format; + frame->sc.user_ratio = this->sc.user_ratio; + + xshm_compute_ideal_size (this, frame); + + /* now we have updated video_aspect_pixel we use the callback */ + /* again to obtain the correct gui_width and gui_height values. */ + frame->sc.dest_size_cb (frame->sc.user_data, width, height, + frame->sc.video_pixel_aspect, + &gui_width, &gui_height, + &gui_pixel_aspect); + } + + if ((frame->sc.gui_width != gui_width) || + (frame->sc.gui_height != gui_height) || + do_adapt) { + + do_adapt = 1; + frame->sc.gui_width = gui_width; + frame->sc.gui_height = gui_height; + + xshm_compute_rgb_size (this, frame); + + lprintf ("gui_size has changed => adapt\n"); + } + + + /* ok, now do what we have to do */ + + if (do_adapt) { + + lprintf ("updating frame to %d x %d\n", + frame->sc.output_width, frame->sc.output_height); + + pthread_mutex_lock(&this->main_mutex); + + /* + * (re-) allocate XImage + */ + + if (frame->image) { + + dispose_ximage(this, frame); + + if (frame->chunk[0]){ + free (frame->chunk[0]); + frame->chunk[0] = NULL; + } + if (frame->chunk[1]) { + free (frame->chunk[1]); + frame->chunk[1] = NULL; + } + if (frame->chunk[2]) { + free (frame->chunk[2]); + frame->chunk[2] = NULL; + } + } + + create_ximage(this, frame, frame->sc.output_width, frame->sc.output_height); + + pthread_mutex_unlock(&this->main_mutex); + + if (format == XINE_IMGFMT_YV12) { + frame->vo_frame.pitches[0] = 8*((width + 7) / 8); + frame->vo_frame.pitches[1] = 8*((width + 15) / 16); + frame->vo_frame.pitches[2] = 8*((width + 15) / 16); + frame->vo_frame.base[0] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[0] * height, (void **) &frame->chunk[0]); + frame->vo_frame.base[1] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[1] * ((height+1)/2), (void **) &frame->chunk[1]); + frame->vo_frame.base[2] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[2] * ((height+1)/2), (void **) &frame->chunk[2]); + } else { + frame->vo_frame.pitches[0] = 8*((width + 3) / 4); + frame->vo_frame.base[0] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[0] * height, (void **) &frame->chunk[0]); + frame->chunk[1] = NULL; + frame->chunk[2] = NULL; + } + + lprintf ("stripe out_ht=%i, deliv_ht=%i\n", + frame->sc.output_height, frame->sc.delivered_height); + + /* + * set up colorspace converter + */ + + switch (flags) { + case VO_TOP_FIELD: + case VO_BOTTOM_FIELD: + frame->yuv2rgb->configure (frame->yuv2rgb, + frame->sc.delivered_width, + frame->sc.delivered_height, + 2*frame->vo_frame.pitches[0], + 2*frame->vo_frame.pitches[1], + frame->sc.output_width, + frame->sc.output_height, + frame->bytes_per_line*2); + break; + case VO_BOTH_FIELDS: + frame->yuv2rgb->configure (frame->yuv2rgb, + frame->sc.delivered_width, + frame->sc.delivered_height, + frame->vo_frame.pitches[0], + frame->vo_frame.pitches[1], + frame->sc.output_width, + frame->sc.output_height, + frame->bytes_per_line); + break; + } + } + + xshm_frame_field ((vo_frame_t *)frame, flags); +} + +static void xshm_overlay_clut_yuv2rgb(xshm_driver_t *this, vo_overlay_t *overlay, + xshm_frame_t *frame) { + size_t i; + clut_t* clut = (clut_t*) overlay->color; + + if (!overlay->rgb_clut) { + for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { + *((uint32_t *)&clut[i]) = + frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb, + clut[i].y, clut[i].cb, clut[i].cr); + } + overlay->rgb_clut++; + } + if (!overlay->hili_rgb_clut) { + clut = (clut_t*) overlay->hili_color; + for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { + *((uint32_t *)&clut[i]) = + frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb, + clut[i].y, clut[i].cb, clut[i].cr); + } + overlay->hili_rgb_clut++; + } +} + +static void xshm_overlay_begin (vo_driver_t *this_gen, + vo_frame_t *frame_gen, int changed) { + xshm_driver_t *this = (xshm_driver_t *) this_gen; + + this->ovl_changed += changed; + + if( this->ovl_changed && this->xoverlay ) { + pthread_mutex_lock(&this->main_mutex); + xcbosd_clear(this->xoverlay); + pthread_mutex_unlock(&this->main_mutex); + } + + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; + this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; +} + +static void xshm_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) { + xshm_driver_t *this = (xshm_driver_t *) this_gen; + + if( this->ovl_changed && this->xoverlay ) { + pthread_mutex_lock(&this->main_mutex); + xcbosd_expose(this->xoverlay); + pthread_mutex_unlock(&this->main_mutex); + } + + this->ovl_changed = 0; +} + +static void xshm_overlay_blend (vo_driver_t *this_gen, + vo_frame_t *frame_gen, vo_overlay_t *overlay) { + xshm_driver_t *this = (xshm_driver_t *) this_gen; + xshm_frame_t *frame = (xshm_frame_t *) frame_gen; + + /* Alpha Blend here */ + if (overlay->rle) { + if( overlay->unscaled ) { + if( this->ovl_changed && this->xoverlay ) { + pthread_mutex_lock(&this->main_mutex); + xcbosd_blend(this->xoverlay, overlay); + pthread_mutex_unlock(&this->main_mutex); + } + } else { + if (!overlay->rgb_clut || !overlay->hili_rgb_clut) + xshm_overlay_clut_yuv2rgb (this, overlay, frame); + + switch (this->bpp) { + case 16: + _x_blend_rgb16(frame->image, overlay, + frame->sc.output_width, frame->sc.output_height, + frame->sc.delivered_width, frame->sc.delivered_height, + &this->alphablend_extra_data); + break; + case 24: + _x_blend_rgb24(frame->image, overlay, + frame->sc.output_width, frame->sc.output_height, + frame->sc.delivered_width, frame->sc.delivered_height, + &this->alphablend_extra_data); + break; + case 32: + _x_blend_rgb32(frame->image, overlay, + frame->sc.output_width, frame->sc.output_height, + frame->sc.delivered_width, frame->sc.delivered_height, + &this->alphablend_extra_data); + break; + default: + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:video_out_xshm:xshm_overlay_blend: Cannot blend bpp:%i\n", this->bpp); + /* it should never get here, unless a user tries to play in bpp:8 */ + break; + } + } + } +} + +static void clean_output_area (xshm_driver_t *this, xshm_frame_t *frame) { + int i; + xcb_rectangle_t rects[4]; + int rects_count = 0; + + memcpy( this->sc.border, frame->sc.border, sizeof(this->sc.border) ); + + pthread_mutex_lock(&this->main_mutex); + + for( i = 0; i < 4; i++ ) { + if( this->sc.border[i].w && this->sc.border[i].h ) + rects[rects_count].x = this->sc.border[i].x; + rects[rects_count].y = this->sc.border[i].y; + rects[rects_count].width = this->sc.border[i].w; + rects[rects_count].height = this->sc.border[i].h; + rects_count++; + } + + if (rects_count > 0) + xcb_poly_fill_rectangle(this->connection, this->window, this->gc, rects_count, rects); + + if (this->xoverlay) { + xcbosd_resize(this->xoverlay, this->sc.gui_width, this->sc.gui_height); + this->ovl_changed = 1; + } + + pthread_mutex_unlock(&this->main_mutex); +} + +static int xshm_redraw_needed (vo_driver_t *this_gen) { + xshm_driver_t *this = (xshm_driver_t *) this_gen; + int ret = 0; + + if( this->cur_frame ) { + this->sc.delivered_height = this->cur_frame->sc.delivered_height; + this->sc.delivered_width = this->cur_frame->sc.delivered_width; + this->sc.video_pixel_aspect = this->cur_frame->sc.video_pixel_aspect; + if( _x_vo_scale_redraw_needed( &this->sc ) ) { + + clean_output_area (this, this->cur_frame); + ret = 1; + } + } + else + ret = 1; + + return ret; +} + +static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { + xshm_driver_t *this = (xshm_driver_t *) this_gen; + xshm_frame_t *frame = (xshm_frame_t *) frame_gen; + + lprintf ("display frame...\n"); + lprintf ("about to draw frame (%d) %d x %d...\n", + frame->vo_frame.id, + frame->sc.output_width, frame->sc.output_height); + + /* + * tell gui that we are about to display a frame, + * ask for offset + */ + + this->sc.delivered_height = frame->sc.delivered_height; + this->sc.delivered_width = frame->sc.delivered_width; + this->sc.video_pixel_aspect = frame->sc.video_pixel_aspect; + if( _x_vo_scale_redraw_needed( &this->sc ) ) { + + clean_output_area (this, frame); + } + + if (this->cur_frame) { + + if ( (this->cur_frame->sc.output_width != frame->sc.output_width) + || (this->cur_frame->sc.output_height != frame->sc.output_height) + || (this->cur_frame->sc.output_xoffset != frame->sc.output_xoffset) + || (this->cur_frame->sc.output_yoffset != frame->sc.output_yoffset) ) + clean_output_area (this, frame); + + this->cur_frame->vo_frame.free (&this->cur_frame->vo_frame); + } + + this->cur_frame = frame; + + pthread_mutex_lock(&this->main_mutex); + lprintf ("display locked...\n"); + + if (frame->shmseg) { + + lprintf ("put image (shm)\n"); + xcb_shm_put_image(this->connection, this->window, this->gc, this->cur_frame->sc.output_width, + this->cur_frame->sc.output_height, 0, 0, this->cur_frame->sc.output_width, + this->cur_frame->sc.output_height, this->cur_frame->sc.output_xoffset, + this->cur_frame->sc.output_yoffset, this->depth, XCB_IMAGE_FORMAT_Z_PIXMAP, + 0, this->cur_frame->shmseg, 0); + + } else { + + lprintf ("put image (plain/remote)\n"); + xcb_put_image(this->connection, XCB_IMAGE_FORMAT_Z_PIXMAP, this->window, this->gc, + frame->sc.output_width, frame->sc.output_height, frame->sc.output_xoffset, frame->sc.output_yoffset, + 0, this->depth, frame->bytes_per_line * frame->sc.output_height, frame->image); + + } + xcb_flush(this->connection); + pthread_mutex_unlock(&this->main_mutex); + + lprintf ("display frame done\n"); +} + +static int xshm_get_property (vo_driver_t *this_gen, int property) { + xshm_driver_t *this = (xshm_driver_t *) this_gen; + + switch (property) { + case VO_PROP_ASPECT_RATIO: + return this->sc.user_ratio; + case VO_PROP_MAX_NUM_FRAMES: + return 15; + case VO_PROP_BRIGHTNESS: + return this->yuv2rgb_brightness; + case VO_PROP_CONTRAST: + return this->yuv2rgb_contrast; + case VO_PROP_SATURATION: + return this->yuv2rgb_saturation; + case VO_PROP_WINDOW_WIDTH: + return this->sc.gui_width; + case VO_PROP_WINDOW_HEIGHT: + return this->sc.gui_height; + default: + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_xshm: tried to get unsupported property %d\n", property); + } + + return 0; +} + +static int xshm_set_property (vo_driver_t *this_gen, + int property, int value) { + xshm_driver_t *this = (xshm_driver_t *) this_gen; + + if ( property == VO_PROP_ASPECT_RATIO) { + + if (value>=XINE_VO_ASPECT_NUM_RATIOS) + value = XINE_VO_ASPECT_AUTO; + this->sc.user_ratio = value; + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_xshm: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); + + } else if (property == VO_PROP_BRIGHTNESS) { + + this->yuv2rgb_brightness = value; + this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, + this->yuv2rgb_brightness, + this->yuv2rgb_contrast, + this->yuv2rgb_saturation); + + this->sc.force_redraw = 1; + + } else if (property == VO_PROP_CONTRAST) { + + this->yuv2rgb_contrast = value; + this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, + this->yuv2rgb_brightness, + this->yuv2rgb_contrast, + this->yuv2rgb_saturation); + + this->sc.force_redraw = 1; + + } else if (property == VO_PROP_SATURATION) { + + this->yuv2rgb_saturation = value; + this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, + this->yuv2rgb_brightness, + this->yuv2rgb_contrast, + this->yuv2rgb_saturation); + + this->sc.force_redraw = 1; + + } else { + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_xshm: tried to set unsupported property %d\n", property); + } + + return value; +} + +static void xshm_get_property_min_max (vo_driver_t *this_gen, + int property, int *min, int *max) { + /* xshm_driver_t *this = (xshm_driver_t *) this_gen; */ + + if (property == VO_PROP_BRIGHTNESS) { + *min = -128; + *max = +127; + } else if (property == VO_PROP_CONTRAST) { + *min = 0; + *max = 255; + } else if (property == VO_PROP_SATURATION) { + *min = 0; + *max = 255; + } else { + *min = 0; + *max = 0; + } +} + +static int xshm_gui_data_exchange (vo_driver_t *this_gen, + int data_type, void *data) { + xshm_driver_t *this = (xshm_driver_t *) this_gen; + + switch (data_type) { +#ifndef XINE_DISABLE_DEPRECATED_FEATURES + case XINE_GUI_SEND_COMPLETION_EVENT: + break; +#endif + + case XINE_GUI_SEND_EXPOSE_EVENT: + + lprintf ("expose event\n"); + + if (this->cur_frame) { + xcb_expose_event_t *xev = (xcb_expose_event_t *) data; + + if (xev && xev->count == 0) { + int i; + xcb_rectangle_t rects[4]; + int rects_count = 0; + + pthread_mutex_lock(&this->main_mutex); + if (this->cur_frame->shmseg) + xcb_shm_put_image(this->connection, this->window, this->gc, this->cur_frame->sc.output_width, + this->cur_frame->sc.output_height, 0, 0, this->cur_frame->sc.output_width, + this->cur_frame->sc.output_height, this->cur_frame->sc.output_xoffset, + this->cur_frame->sc.output_yoffset, this->depth, XCB_IMAGE_FORMAT_Z_PIXMAP, + 0, this->cur_frame->shmseg, 0); + else + xcb_put_image(this->connection, XCB_IMAGE_FORMAT_Z_PIXMAP, this->window, this->gc, + this->cur_frame->sc.output_width, this->cur_frame->sc.output_height, + this->cur_frame->sc.output_xoffset, this->cur_frame->sc.output_yoffset, + 0, this->depth, this->cur_frame->bytes_per_line * this->cur_frame->sc.output_height, + this->cur_frame->image); + + for( i = 0; i < 4; i++ ) { + if( this->sc.border[i].w && this->sc.border[i].h ) + rects[rects_count].x = this->sc.border[i].x; + rects[rects_count].y = this->sc.border[i].y; + rects[rects_count].width = this->sc.border[i].w; + rects[rects_count].height = this->sc.border[i].h; + rects_count++; + } + + if (rects_count > 0) + xcb_poly_fill_rectangle(this->connection, this->window, this->gc, rects_count, rects); + + if(this->xoverlay) + xcbosd_expose(this->xoverlay); + + xcb_flush(this->connection); + pthread_mutex_unlock(&this->main_mutex); + } + } + break; + + case XINE_GUI_SEND_DRAWABLE_CHANGED: + this->window = (xcb_window_t) data; + + pthread_mutex_lock(&this->main_mutex); + xcb_free_gc(this->connection, this->gc); + this->gc = xcb_generate_id(this->connection); + xcb_create_gc(this->connection, this->gc, this->window, XCB_GC_FOREGROUND, &this->screen->black_pixel); + if(this->xoverlay) + xcbosd_drawable_changed(this->xoverlay, this->window); + this->ovl_changed = 1; + pthread_mutex_unlock(&this->main_mutex); + break; + + case XINE_GUI_SEND_TRANSLATE_GUI_TO_VIDEO: + + if (this->cur_frame) { + x11_rectangle_t *rect = data; + int x1, y1, x2, y2; + + _x_vo_scale_translate_gui2video(&this->cur_frame->sc, + rect->x, rect->y, + &x1, &y1); + _x_vo_scale_translate_gui2video(&this->cur_frame->sc, + rect->x + rect->w, rect->y + rect->h, + &x2, &y2); + rect->x = x1; + rect->y = y1; + rect->w = x2-x1; + rect->h = y2-y1; + } + break; + + default: + return -1; + } + + return 0; +} + +static void xshm_dispose (vo_driver_t *this_gen) { + xshm_driver_t *this = (xshm_driver_t *) this_gen; + + if (this->cur_frame) + this->cur_frame->vo_frame.dispose (&this->cur_frame->vo_frame); + + this->yuv2rgb_factory->dispose (this->yuv2rgb_factory); + + pthread_mutex_lock(&this->main_mutex); + xcb_free_gc(this->connection, this->gc); + pthread_mutex_unlock(&this->main_mutex); + + if( this->xoverlay ) { + pthread_mutex_lock(&this->main_mutex); + xcbosd_destroy(this->xoverlay); + pthread_mutex_unlock(&this->main_mutex); + } + + pthread_mutex_destroy(&this->main_mutex); + + _x_alphablend_free(&this->alphablend_extra_data); + + free (this); +} + +static int ImlibPaletteLUTGet(xshm_driver_t *this) { + static const xcb_atom_t CARDINAL = 6; + + xcb_intern_atom_cookie_t atom_cookie; + xcb_intern_atom_reply_t *atom_reply; + + xcb_get_property_cookie_t prop_cookie; + xcb_get_property_reply_t *prop_reply; + + atom_cookie = xcb_intern_atom(this->connection, 0, sizeof("_IMLIB_COLORMAP"), "_IMLIB_COLORMAP"); + atom_reply = xcb_intern_atom_reply(this->connection, atom_cookie, NULL); + + if (atom_reply == NULL) + return 0; + + prop_cookie = xcb_get_property(this->connection, 0, this->window, atom_reply->atom, CARDINAL, 0, 0x7fffffff); + prop_reply = xcb_get_property_reply(this->connection, prop_cookie, NULL); + + free(atom_reply); + + if (prop_reply == NULL) + return 0; + + if (prop_reply->format == 8) { + unsigned int i; + unsigned long j; + int num_ret = xcb_get_property_value_length(prop_reply); + char *retval = xcb_get_property_value(prop_reply); + + j = 1 + retval[0]*4; + this->yuv2rgb_cmap = malloc(sizeof(uint8_t) * 32 * 32 * 32); + for (i = 0; i < 32 * 32 * 32 && j < num_ret; i++) + this->yuv2rgb_cmap[i] = retval[1+4*retval[j++]+3]; + + free(prop_reply); + return 1; + } + + free(prop_reply); + return 0; +} + + +static char *visual_class_name(xcb_visualtype_t *visual) { + + switch (visual->_class) { + case XCB_VISUAL_CLASS_STATIC_GRAY: + return "StaticGray"; + case XCB_VISUAL_CLASS_GRAY_SCALE: + return "GrayScale"; + case XCB_VISUAL_CLASS_STATIC_COLOR: + return "StaticColor"; + case XCB_VISUAL_CLASS_PSEUDO_COLOR: + return "PseudoColor"; + case XCB_VISUAL_CLASS_TRUE_COLOR: + return "TrueColor"; + case XCB_VISUAL_CLASS_DIRECT_COLOR: + return "DirectColor"; + default: + return "unknown visual class"; + } +} + +static vo_driver_t *xshm_open_plugin(video_driver_class_t *class_gen, const void *visual_gen) { + xshm_class_t *class = (xshm_class_t *) class_gen; + config_values_t *config = class->config; + xcb_visual_t *visual = (xcb_visual_t *) visual_gen; + xshm_driver_t *this; + xcb_visualtype_t *visualtype; + int mode; + int swapped; + int cpu_byte_order; + int image_byte_order; + + xcb_get_window_attributes_cookie_t window_attrs_cookie; + xcb_get_window_attributes_reply_t *window_attrs_reply; + + xcb_get_geometry_cookie_t geometry_cookie; + xcb_get_geometry_reply_t *geometry_reply; + + const xcb_query_extension_reply_t *query_extension_reply; + + this = (xshm_driver_t *) xine_xmalloc (sizeof (xshm_driver_t)); + + if (!this) + return NULL; + + pthread_mutex_init(&this->main_mutex, NULL); + + _x_alphablend_init(&this->alphablend_extra_data, class->xine); + + this->connection = visual->connection; + this->screen = visual->screen; + this->window = visual->window; + + _x_vo_scale_init( &this->sc, 0, 0, config ); + this->sc.frame_output_cb = visual->frame_output_cb; + this->sc.dest_size_cb = visual->dest_size_cb; + this->sc.user_data = visual->user_data; + + this->sc.user_ratio = XINE_VO_ASPECT_AUTO; + + this->cur_frame = NULL; + this->gc = xcb_generate_id(this->connection); + xcb_create_gc(this->connection, this->gc, this->window, XCB_GC_FOREGROUND, &this->screen->black_pixel); + this->xoverlay = NULL; + this->ovl_changed = 0; + + this->xine = class->xine; + + this->vo_driver.get_capabilities = xshm_get_capabilities; + this->vo_driver.alloc_frame = xshm_alloc_frame; + this->vo_driver.update_frame_format = xshm_update_frame_format; + this->vo_driver.overlay_begin = xshm_overlay_begin; + this->vo_driver.overlay_blend = xshm_overlay_blend; + this->vo_driver.overlay_end = xshm_overlay_end; + this->vo_driver.display_frame = xshm_display_frame; + this->vo_driver.get_property = xshm_get_property; + this->vo_driver.set_property = xshm_set_property; + this->vo_driver.get_property_min_max = xshm_get_property_min_max; + this->vo_driver.gui_data_exchange = xshm_gui_data_exchange; + this->vo_driver.dispose = xshm_dispose; + this->vo_driver.redraw_needed = xshm_redraw_needed; + + /* + * + * depth in X11 terminology land is the number of bits used to + * actually represent the colour. + * + * bpp in X11 land means how many bits in the frame buffer per + * pixel. + * + * ex. 15 bit color is 15 bit depth and 16 bpp. Also 24 bit + * color is 24 bit depth, but can be 24 bpp or 32 bpp. + */ + + window_attrs_cookie = xcb_get_window_attributes(this->connection, this->window); + geometry_cookie = xcb_get_geometry(this->connection, this->window); + xcb_prefetch_extension_data(this->connection, &xcb_shm_id); + + window_attrs_reply = xcb_get_window_attributes_reply(this->connection, window_attrs_cookie, NULL); + + visualtype = NULL; + { + xcb_depth_t *depth = xcb_screen_allowed_depths_iterator(this->screen).data; + xcb_visualtype_t *vis = xcb_depth_visuals(depth); + xcb_visualtype_t *vis_end = vis + xcb_depth_visuals_length(depth); + + for (; vis != vis_end; ++vis) + if (window_attrs_reply->visual == vis->visual_id) { + visualtype = vis; + break; + } + } + + free(window_attrs_reply); + + geometry_reply = xcb_get_geometry_reply(this->connection, geometry_cookie, NULL); + + this->depth = geometry_reply->depth; + + free(geometry_reply); + + if (this->depth>16) + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("\n\nWARNING: current display depth is %d. For better performance\n" + "a depth of 16 bpp is recommended!\n\n"), this->depth); + + /* + * check for X shared memory support + */ + + query_extension_reply = xcb_get_extension_data(this->connection, &xcb_shm_id); + if (query_extension_reply && query_extension_reply->present) { + this->use_shm = 1; + } + else { + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_xshm: MIT shared memory extension not present on display.\n")); + this->use_shm = 0; + } + + { + const xcb_setup_t *setup = xcb_get_setup(this->connection); + xcb_format_t *fmt = xcb_setup_pixmap_formats(setup); + xcb_format_t *fmt_end = fmt + xcb_setup_pixmap_formats_length(setup); + + for (; fmt != fmt_end; ++fmt) + if(fmt->depth == this->depth) { + this->bpp = fmt->bits_per_pixel; + this->scanline_pad = fmt->scanline_pad; + break; + } + + if (fmt == fmt_end) { + if (this->depth <= 4) + this->bpp = 4; + else if (this->depth <= 8) + this->bpp = 8; + else if (this->depth <= 16) + this->bpp = 16; + else + this->bpp = 32; + this->scanline_pad = setup->bitmap_format_scanline_pad; + } + + image_byte_order = setup->image_byte_order; + } + + /* + * Is the same byte order in use on the X11 client and server? + */ + cpu_byte_order = htonl(1) == 1 ? XCB_IMAGE_ORDER_MSB_FIRST : XCB_IMAGE_ORDER_LSB_FIRST; + swapped = cpu_byte_order != image_byte_order; + + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_xshm: video mode depth is %d (%d bpp), %s, %sswapped,\n" + "\tred: %08x, green: %08x, blue: %08x\n", + this->depth, this->bpp, + visual_class_name(visualtype), + swapped ? "" : "not ", + visualtype->red_mask, visualtype->green_mask, visualtype->blue_mask); + + mode = 0; + + switch (visualtype->_class) { + case XCB_VISUAL_CLASS_TRUE_COLOR: + switch (this->depth) { + case 24: + case 32: + if (this->bpp == 32) { + if (visualtype->red_mask == 0x00ff0000) + mode = MODE_32_RGB; + else + mode = MODE_32_BGR; + } else { + if (visualtype->red_mask == 0x00ff0000) + mode = MODE_24_RGB; + else + mode = MODE_24_BGR; + } + break; + case 16: + if (visualtype->red_mask == 0xf800) + mode = MODE_16_RGB; + else + mode = MODE_16_BGR; + break; + case 15: + if (visualtype->red_mask == 0x7C00) + mode = MODE_15_RGB; + else + mode = MODE_15_BGR; + break; + case 8: + if (visualtype->red_mask == 0xE0) + mode = MODE_8_RGB; /* Solaris x86: RGB332 */ + else + mode = MODE_8_BGR; /* XFree86: BGR233 */ + break; + } + break; + + case XCB_VISUAL_CLASS_STATIC_GRAY: + if (this->depth == 8) + mode = MODE_8_GRAY; + break; + + case XCB_VISUAL_CLASS_PSEUDO_COLOR: + case XCB_VISUAL_CLASS_GRAY_SCALE: + if (this->depth <= 8 && ImlibPaletteLUTGet(this)) + mode = MODE_PALETTE; + break; + } + + if (!mode) { + xprintf (this->xine, XINE_VERBOSITY_LOG, + _("video_out_xshm: your video mode was not recognized, sorry :-(\n")); + return NULL; + } + + this->yuv2rgb_brightness = 0; + this->yuv2rgb_contrast = 128; + this->yuv2rgb_saturation = 128; + + this->yuv2rgb_factory = yuv2rgb_factory_init (mode, swapped, + this->yuv2rgb_cmap); + this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, + this->yuv2rgb_brightness, + this->yuv2rgb_contrast, + this->yuv2rgb_saturation); + + this->xoverlay = xcbosd_create(this->xine, this->connection, this->screen, + this->window, XCBOSD_SHAPED); + + return &this->vo_driver; +} + +/* + * class functions + */ + +static char* xshm_get_identifier (video_driver_class_t *this_gen) { + return "XShm"; +} + +static char* xshm_get_description (video_driver_class_t *this_gen) { + return _("xine video output plugin using the MIT X shared memory extension"); +} + +static void xshm_dispose_class (video_driver_class_t *this_gen) { + xshm_class_t *this = (xshm_class_t *) this_gen; + + free (this); +} + +static void *xshm_init_class (xine_t *xine, void *visual_gen) { + xshm_class_t *this = (xshm_class_t *) xine_xmalloc (sizeof (xshm_class_t)); + + this->driver_class.open_plugin = xshm_open_plugin; + this->driver_class.get_identifier = xshm_get_identifier; + this->driver_class.get_description = xshm_get_description; + this->driver_class.dispose = xshm_dispose_class; + this->config = xine->config; + this->xine = xine; + + return this; +} + + +static const vo_info_t vo_info_xshm = { + 6, /* priority */ + XINE_VISUAL_TYPE_XCB /* visual type */ +}; + + +/* + * exported plugin catalog entry + */ + +const plugin_info_t xine_plugin_info[] EXPORTED = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_OUT, 21, "xshm", XINE_VERSION_CODE, &vo_info_xshm, xshm_init_class }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/video_out/video_out_xcbxv.c b/src/video_out/video_out_xcbxv.c new file mode 100644 index 000000000..6b8bc3919 --- /dev/null +++ b/src/video_out/video_out_xcbxv.c @@ -0,0 +1,1598 @@ +/* + * Copyright (C) 2000-2004, 2007 the xine project + * + * This file is part of xine, a free video player. + * + * xine 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. + * + * xine 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * $Id: video_out_xcbxv.c,v 1.1 2007/02/15 15:19:33 dgp85 Exp $ + * + * video_out_xcbxv.c, X11 video extension interface for xine + * + * based on mpeg2dec code from + * Aaron Holtzman <aholtzma@ess.engr.uvic.ca> + * + * Xv image support by Gerd Knorr <kraxel@goldbach.in-berlin.de> + * + * xine-specific code by Guenter Bartsch <bartscgr@studbox.uni-stuttgart.de> + * + * overlay support by James Courtier-Dutton <James@superbug.demon.co.uk> - July 2001 + * X11 unscaled overlay support by Miguel Freitas - Nov 2003 + * ported to xcb by Christoph Pfister - Feb 2007 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_XV + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <math.h> + +#include <sys/types.h> +#if defined(__FreeBSD__) +#include <machine/param.h> +#endif +#include <sys/ipc.h> +#include <sys/shm.h> +#include <sys/time.h> + +#include <xcb/xv.h> + +#define LOG_MODULE "video_out_xcbxv" +#define LOG_VERBOSE +/* +#define LOG +*/ + +#include "xine.h" +#include "video_out.h" +#include "xine_internal.h" +/* #include "overlay.h" */ +#include "deinterlace.h" +#include "xineutils.h" +#include "vo_scale.h" +#include "xcbosd.h" + +typedef struct xv_driver_s xv_driver_t; + +typedef struct { + int value; + int min; + int max; + xcb_atom_t atom; + + cfg_entry_t *entry; + + xv_driver_t *this; +} xv_property_t; + +typedef struct { + char *name; + int value; +} xv_portattribute_t; + +typedef struct { + vo_frame_t vo_frame; + + int width, height, format; + double ratio; + + uint8_t *image; + xcb_shm_seg_t shmseg; + unsigned int xv_format; + unsigned int xv_data_size; + unsigned int xv_width; + unsigned int xv_height; + unsigned int xv_pitches[3]; + unsigned int xv_offsets[3]; + +} xv_frame_t; + + +struct xv_driver_s { + + vo_driver_t vo_driver; + + config_values_t *config; + + /* xcb / xv related stuff */ + xcb_connection_t *connection; + xcb_screen_t *screen; + xcb_window_t window; + unsigned int xv_format_yv12; + unsigned int xv_format_yuy2; + xcb_gc_t gc; + xcb_xv_port_t xv_port; + + int use_shm; + int use_pitch_alignment; + xv_property_t props[VO_NUM_PROPERTIES]; + uint32_t capabilities; + + xv_frame_t *recent_frames[VO_NUM_RECENT_FRAMES]; + xv_frame_t *cur_frame; + xcbosd *xoverlay; + int ovl_changed; + + /* all scaling information goes here */ + vo_scale_t sc; + + xv_frame_t deinterlace_frame; + int deinterlace_method; + int deinterlace_enabled; + + int use_colorkey; + uint32_t colorkey; + + /* hold initial port attributes values to restore on exit */ + xine_list_t *port_attributes; + + xine_t *xine; + + alphablend_t alphablend_extra_data; + + pthread_mutex_t main_mutex; + +}; + +typedef struct { + video_driver_class_t driver_class; + + config_values_t *config; + xine_t *xine; +} xv_class_t; + +static uint32_t xv_get_capabilities (vo_driver_t *this_gen) { + xv_driver_t *this = (xv_driver_t *) this_gen; + + return this->capabilities; +} + +static void xv_frame_field (vo_frame_t *vo_img, int which_field) { + /* not needed for Xv */ +} + +static void xv_frame_dispose (vo_frame_t *vo_img) { + xv_frame_t *frame = (xv_frame_t *) vo_img ; + xv_driver_t *this = (xv_driver_t *) vo_img->driver; + + if (frame->shmseg) { + pthread_mutex_lock(&this->main_mutex); + xcb_shm_detach(this->connection, frame->shmseg); + frame->shmseg = 0; + pthread_mutex_unlock(&this->main_mutex); + shmdt(frame->image); + } + else + free(frame->image); + + free (frame); +} + +static vo_frame_t *xv_alloc_frame (vo_driver_t *this_gen) { + /* xv_driver_t *this = (xv_driver_t *) this_gen; */ + xv_frame_t *frame ; + + frame = (xv_frame_t *) xine_xmalloc (sizeof (xv_frame_t)); + if (!frame) + return NULL; + + pthread_mutex_init (&frame->vo_frame.mutex, NULL); + + /* + * supply required functions + */ + frame->vo_frame.proc_slice = NULL; + frame->vo_frame.proc_frame = NULL; + frame->vo_frame.field = xv_frame_field; + frame->vo_frame.dispose = xv_frame_dispose; + frame->vo_frame.driver = this_gen; + + return (vo_frame_t *) frame; +} + +static void create_ximage(xv_driver_t *this, xv_frame_t *frame, int width, int height, int format) +{ + xcb_xv_query_image_attributes_cookie_t query_attributes_cookie; + xcb_xv_query_image_attributes_reply_t *query_attributes_reply; + + unsigned int length; + + if (this->use_pitch_alignment) { + width = (width + 7) & ~0x7; + } + + switch (format) { + case XINE_IMGFMT_YV12: + frame->xv_format = this->xv_format_yv12; + break; + case XINE_IMGFMT_YUY2: + frame->xv_format = this->xv_format_yuy2; + break; + default: + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "create_ximage: unknown format %08x\n",format); + _x_abort(); + } + + query_attributes_cookie = xcb_xv_query_image_attributes(this->connection, this->xv_port, frame->xv_format, width, height); + query_attributes_reply = xcb_xv_query_image_attributes_reply(this->connection, query_attributes_cookie, NULL); + + if (query_attributes_reply == NULL) + return; + + frame->xv_data_size = query_attributes_reply->data_size; + frame->xv_width = query_attributes_reply->width; + frame->xv_height = query_attributes_reply->height; + + length = xcb_xv_query_image_attributes_pitches_length(query_attributes_reply); + if (length > 3) + length = 3; + memcpy(frame->xv_pitches, xcb_xv_query_image_attributes_pitches(query_attributes_reply), length * sizeof(frame->xv_pitches[0])); + + length = xcb_xv_query_image_attributes_offsets_length(query_attributes_reply); + if (length > 3) + length = 3; + memcpy(frame->xv_offsets, xcb_xv_query_image_attributes_offsets(query_attributes_reply), length * sizeof(frame->xv_offsets[0])); + + free(query_attributes_reply); + + if (this->use_shm) { + int shmid; + xcb_void_cookie_t shm_attach_cookie; + xcb_generic_error_t *generic_error; + + /* + * try shm + */ + + if (frame->xv_data_size == 0) { + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_xv: XvShmCreateImage returned a zero size\n" + "video_out_xv: => not using MIT Shared Memory extension.\n")); + goto shm_fail1; + } + + shmid = shmget(IPC_PRIVATE, frame->xv_data_size, IPC_CREAT | 0777); + + if (shmid < 0 ) { + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_xv: shared memory error in shmget: %s\n" + "video_out_xv: => not using MIT Shared Memory extension.\n"), strerror(errno)); + goto shm_fail1; + } + + frame->image = shmat(shmid, 0, 0); + + if (frame->image == ((void *) -1)) { + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_xv: shared memory error (address error)\n"); + goto shm_fail2; + } + + frame->shmseg = xcb_generate_id(this->connection); + shm_attach_cookie = xcb_shm_attach_checked(this->connection, frame->shmseg, shmid, 0); + generic_error = xcb_request_check(this->connection, shm_attach_cookie); + + if (generic_error != NULL) { + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_xv: x11 error during shared memory XImage creation\n" + "video_out_xv: => not using MIT Shared Memory extension.\n")); + free(generic_error); + goto shm_fail3; + } + + /* + * Now that the Xserver has learned about and attached to the + * shared memory segment, delete it. It's actually deleted by + * the kernel when all users of that segment have detached from + * it. Gives an automatic shared memory cleanup in case we crash. + */ + + shmctl(shmid, IPC_RMID, 0); + + return; + + shm_fail3: + frame->shmseg = 0; + shmdt(frame->image); + shm_fail2: + shmctl(shmid, IPC_RMID, 0); + shm_fail1: + this->use_shm = 0; + } + + /* + * fall back to plain Xv if necessary + */ + + switch (format) { + case XINE_IMGFMT_YV12: + frame->image = malloc(width * height * 3/2); + break; + case XINE_IMGFMT_YUY2: + frame->image = malloc(width * height * 2); + break; + default: + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "create_ximage: unknown format %08x\n",format); + _x_abort(); + } +} + +static void dispose_ximage(xv_driver_t *this, xv_frame_t *frame) +{ + if (frame->shmseg) { + xcb_shm_detach(this->connection, frame->shmseg); + frame->shmseg = 0; + shmdt(frame->image); + } else + free(frame->image); + frame->image = NULL; +} + +static void xv_update_frame_format (vo_driver_t *this_gen, + vo_frame_t *frame_gen, + uint32_t width, uint32_t height, + double ratio, int format, int flags) { + xv_driver_t *this = (xv_driver_t *) this_gen; + xv_frame_t *frame = (xv_frame_t *) frame_gen; + + if (this->use_pitch_alignment) { + width = (width + 7) & ~0x7; + } + + if ((frame->width != width) + || (frame->height != height) + || (frame->format != format)) { + + /* printf ("video_out_xv: updating frame to %d x %d (ratio=%d, format=%08x)\n",width,height,ratio_code,format); */ + + pthread_mutex_lock(&this->main_mutex); + + /* + * (re-) allocate xvimage + */ + + if (frame->image) + dispose_ximage(this, frame); + + create_ximage(this, frame, width, height, format); + + if(format == XINE_IMGFMT_YUY2) { + frame->vo_frame.pitches[0] = frame->xv_pitches[0]; + frame->vo_frame.base[0] = frame->image + frame->xv_offsets[0]; + } + else { + frame->vo_frame.pitches[0] = frame->xv_pitches[0]; + frame->vo_frame.pitches[1] = frame->xv_pitches[2]; + frame->vo_frame.pitches[2] = frame->xv_pitches[1]; + frame->vo_frame.base[0] = frame->image + frame->xv_offsets[0]; + frame->vo_frame.base[1] = frame->image + frame->xv_offsets[2]; + frame->vo_frame.base[2] = frame->image + frame->xv_offsets[1]; + } + + frame->width = width; + frame->height = height; + frame->format = format; + + pthread_mutex_unlock(&this->main_mutex); + } + + frame->ratio = ratio; +} + +#define DEINTERLACE_CROMA +static void xv_deinterlace_frame (xv_driver_t *this) { + uint8_t *recent_bitmaps[VO_NUM_RECENT_FRAMES]; + xv_frame_t *frame = this->recent_frames[0]; + int i; + int xvscaling; + + xvscaling = (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) ? 2 : 1; + + if (!this->deinterlace_frame.image + || (frame->width != this->deinterlace_frame.width) + || (frame->height != this->deinterlace_frame.height ) + || (frame->format != this->deinterlace_frame.format) + || (frame->ratio != this->deinterlace_frame.ratio)) { + pthread_mutex_lock(&this->main_mutex); + + if(this->deinterlace_frame.image) + dispose_ximage(this, &this->deinterlace_frame); + + create_ximage(this, &this->deinterlace_frame, frame->width, frame->height / xvscaling, frame->format); + this->deinterlace_frame.width = frame->width; + this->deinterlace_frame.height = frame->height; + this->deinterlace_frame.format = frame->format; + this->deinterlace_frame.ratio = frame->ratio; + + pthread_mutex_unlock(&this->main_mutex); + } + + + if ( this->deinterlace_method != DEINTERLACE_ONEFIELDXV ) { +#ifdef DEINTERLACE_CROMA + + /* I don't think this is the right way to do it (deinterlacing croma by croma info). + DScaler deinterlaces croma together with luma, but it's easier for them because + they have that components 1:1 at the same table. + */ + for( i = 0; i < VO_NUM_RECENT_FRAMES; i++ ) + if( this->recent_frames[i] && this->recent_frames[i]->width == frame->width && + this->recent_frames[i]->height == frame->height ) + recent_bitmaps[i] = this->recent_frames[i]->image + frame->width*frame->height; + else + recent_bitmaps[i] = NULL; + + deinterlace_yuv( this->deinterlace_frame.image+frame->width*frame->height, + recent_bitmaps, frame->width/2, frame->height/2, this->deinterlace_method ); + for( i = 0; i < VO_NUM_RECENT_FRAMES; i++ ) + if( this->recent_frames[i] && this->recent_frames[i]->width == frame->width && + this->recent_frames[i]->height == frame->height ) + recent_bitmaps[i] = this->recent_frames[i]->image + frame->width*frame->height*5/4; + else + recent_bitmaps[i] = NULL; + + deinterlace_yuv( this->deinterlace_frame.image+frame->width*frame->height*5/4, + recent_bitmaps, frame->width/2, frame->height/2, this->deinterlace_method ); + +#else + + /* know bug: we are not deinterlacing Cb and Cr */ + xine_fast_memcpy(this->deinterlace_frame.image + frame->width*frame->height, + frame->image + frame->width*frame->height, + frame->width*frame->height*1/2); + +#endif + + for( i = 0; i < VO_NUM_RECENT_FRAMES; i++ ) + if( this->recent_frames[i] && this->recent_frames[i]->width == frame->width && + this->recent_frames[i]->height == frame->height ) + recent_bitmaps[i] = this->recent_frames[i]->image; + else + recent_bitmaps[i] = NULL; + + deinterlace_yuv( this->deinterlace_frame.image, recent_bitmaps, + frame->width, frame->height, this->deinterlace_method ); + } + else { + /* + dirty and cheap deinterlace method: we give half of the lines to xv + driver and let it scale for us. + note that memcpy's below don't seem to impact much on performance, + specially when fast memcpys are available. + */ + uint8_t *dst, *src; + + dst = this->deinterlace_frame.image; + src = this->recent_frames[0]->image; + for( i = 0; i < frame->height; i+=2 ) { + xine_fast_memcpy(dst,src,frame->width); + dst += frame->width; + src += 2 * frame->width; + } + + dst = this->deinterlace_frame.image + frame->width * frame->height / 2; + src = this->recent_frames[0]->image + frame->width * frame->height; + for( i = 0; i < frame->height; i+=4 ) { + xine_fast_memcpy(dst,src,frame->width / 2); + dst += frame->width / 2; + src += frame->width; + } + + dst = this->deinterlace_frame.image + frame->width * frame->height * 5 / 8; + src = this->recent_frames[0]->image + frame->width * frame->height * 5 / 4; + for( i = 0; i < frame->height; i+=4 ) { + xine_fast_memcpy(dst,src,frame->width / 2); + dst += frame->width / 2; + src += frame->width; + } + } + + this->cur_frame = &this->deinterlace_frame; +} + +static void xv_clean_output_area (xv_driver_t *this) { + int i; + xcb_rectangle_t rects[4]; + int rects_count = 0; + + pthread_mutex_lock(&this->main_mutex); + + xcb_change_gc(this->connection, this->gc, XCB_GC_FOREGROUND, &this->screen->black_pixel); + + for( i = 0; i < 4; i++ ) { + if( this->sc.border[i].w && this->sc.border[i].h ) { + rects[rects_count].x = this->sc.border[i].x; + rects[rects_count].y = this->sc.border[i].y; + rects[rects_count].width = this->sc.border[i].w; + rects[rects_count].height = this->sc.border[i].h; + rects_count++; + } + } + + if (rects_count > 0) + xcb_poly_fill_rectangle(this->connection, this->window, this->gc, rects_count, rects); + + if (this->use_colorkey) { + xcb_change_gc(this->connection, this->gc, XCB_GC_FOREGROUND, &this->colorkey); + xcb_rectangle_t rectangle = { this->sc.output_xoffset, this->sc.output_yoffset, + this->sc.output_width, this->sc.output_height }; + xcb_poly_fill_rectangle(this->connection, this->window, this->gc, 1, &rectangle); + } + + if (this->xoverlay) { + xcbosd_resize(this->xoverlay, this->sc.gui_width, this->sc.gui_height); + this->ovl_changed = 1; + } + + pthread_mutex_unlock(&this->main_mutex); +} + +/* + * convert delivered height/width to ideal width/height + * taking into account aspect ratio and zoom factor + */ + +static void xv_compute_ideal_size (xv_driver_t *this) { + _x_vo_scale_compute_ideal_size( &this->sc ); +} + + +/* + * make ideal width/height "fit" into the gui + */ + +static void xv_compute_output_size (xv_driver_t *this) { + + _x_vo_scale_compute_output_size( &this->sc ); + + /* onefield_xv divide by 2 the number of lines */ + if (this->deinterlace_enabled + && (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) + && this->cur_frame && (this->cur_frame->format == XINE_IMGFMT_YV12)) { + this->sc.displayed_height = this->sc.displayed_height / 2 - 1; + this->sc.displayed_yoffset = this->sc.displayed_yoffset / 2; + } +} + +static void xv_overlay_begin (vo_driver_t *this_gen, + vo_frame_t *frame_gen, int changed) { + xv_driver_t *this = (xv_driver_t *) this_gen; + + this->ovl_changed += changed; + + if( this->ovl_changed && this->xoverlay ) { + pthread_mutex_lock(&this->main_mutex); + xcbosd_clear(this->xoverlay); + pthread_mutex_unlock(&this->main_mutex); + } + + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; + this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; +} + +static void xv_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) { + xv_driver_t *this = (xv_driver_t *) this_gen; + + if( this->ovl_changed && this->xoverlay ) { + pthread_mutex_lock(&this->main_mutex); + xcbosd_expose(this->xoverlay); + pthread_mutex_unlock(&this->main_mutex); + } + + this->ovl_changed = 0; +} + +static void xv_overlay_blend (vo_driver_t *this_gen, + vo_frame_t *frame_gen, vo_overlay_t *overlay) { + xv_driver_t *this = (xv_driver_t *) this_gen; + xv_frame_t *frame = (xv_frame_t *) frame_gen; + + if (overlay->rle) { + if( overlay->unscaled ) { + if( this->ovl_changed && this->xoverlay ) { + pthread_mutex_lock(&this->main_mutex); + xcbosd_blend(this->xoverlay, overlay); + pthread_mutex_unlock(&this->main_mutex); + } + } else { + if (frame->format == XINE_IMGFMT_YV12) + _x_blend_yuv(frame->vo_frame.base, overlay, + frame->width, frame->height, frame->vo_frame.pitches, + &this->alphablend_extra_data); + else + _x_blend_yuy2(frame->vo_frame.base[0], overlay, + frame->width, frame->height, frame->vo_frame.pitches[0], + &this->alphablend_extra_data); + } + } +} + +static void xv_add_recent_frame (xv_driver_t *this, xv_frame_t *frame) { + int i; + + i = VO_NUM_RECENT_FRAMES-1; + if( this->recent_frames[i] ) + this->recent_frames[i]->vo_frame.free + (&this->recent_frames[i]->vo_frame); + + for( ; i ; i-- ) + this->recent_frames[i] = this->recent_frames[i-1]; + + this->recent_frames[0] = frame; +} + +/* currently not used - we could have a method to call this from video loop */ +#if 0 +static void xv_flush_recent_frames (xv_driver_t *this) { + int i; + + for( i=0; i < VO_NUM_RECENT_FRAMES; i++ ) { + if( this->recent_frames[i] ) + this->recent_frames[i]->vo_frame.free + (&this->recent_frames[i]->vo_frame); + this->recent_frames[i] = NULL; + } +} +#endif + +static int xv_redraw_needed (vo_driver_t *this_gen) { + xv_driver_t *this = (xv_driver_t *) this_gen; + int ret = 0; + + if( this->cur_frame ) { + + this->sc.delivered_height = this->cur_frame->height; + this->sc.delivered_width = this->cur_frame->width; + this->sc.delivered_ratio = this->cur_frame->ratio; + + this->sc.crop_left = this->cur_frame->vo_frame.crop_left; + this->sc.crop_right = this->cur_frame->vo_frame.crop_right; + this->sc.crop_top = this->cur_frame->vo_frame.crop_top; + this->sc.crop_bottom = this->cur_frame->vo_frame.crop_bottom; + + xv_compute_ideal_size(this); + + if( _x_vo_scale_redraw_needed( &this->sc ) ) { + + xv_compute_output_size (this); + + xv_clean_output_area (this); + + ret = 1; + } + } + else + ret = 1; + + return ret; +} + +static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { + xv_driver_t *this = (xv_driver_t *) this_gen; + xv_frame_t *frame = (xv_frame_t *) frame_gen; + /* + printf ("video_out_xv: xv_display_frame...\n"); + */ + + /* + * queue frames (deinterlacing) + * free old frames + */ + + xv_add_recent_frame (this, frame); /* deinterlacing */ + + this->cur_frame = frame; + + /* + * let's see if this frame is different in size / aspect + * ratio from the previous one + */ + if ( (frame->width != this->sc.delivered_width) + || (frame->height != this->sc.delivered_height) + || (frame->ratio != this->sc.delivered_ratio) ) { + lprintf("frame format changed\n"); + this->sc.force_redraw = 1; /* trigger re-calc of output size */ + } + + /* + * deinterlace frame if necessary + * (currently only working for YUV images) + */ + + if (this->deinterlace_enabled && this->deinterlace_method + && frame->format == XINE_IMGFMT_YV12 + && (deinterlace_yuv_supported( this->deinterlace_method ) == 1 + || this->deinterlace_method == DEINTERLACE_ONEFIELDXV)) + xv_deinterlace_frame (this); + + /* + * tell gui that we are about to display a frame, + * ask for offset and output size + */ + xv_redraw_needed (this_gen); + + pthread_mutex_lock(&this->main_mutex); + + if (this->cur_frame->shmseg) { + xcb_xv_shm_put_image(this->connection, this->xv_port, this->window, this->gc, + this->cur_frame->shmseg, this->cur_frame->xv_format, 0, + this->sc.displayed_xoffset, this->sc.displayed_yoffset, + this->sc.displayed_width, this->sc.displayed_height, + this->sc.output_xoffset, this->sc.output_yoffset, + this->sc.output_width, this->sc.output_height, + this->cur_frame->xv_width, this->cur_frame->xv_height, 0); + + } else { + xcb_xv_put_image(this->connection, this->xv_port, this->window, this->gc, + this->cur_frame->xv_format, + this->sc.displayed_xoffset, this->sc.displayed_yoffset, + this->sc.displayed_width, this->sc.displayed_height, + this->sc.output_xoffset, this->sc.output_yoffset, + this->sc.output_width, this->sc.output_height, + this->cur_frame->xv_width, this->cur_frame->xv_height, + this->cur_frame->xv_data_size, this->cur_frame->image); + } + + xcb_flush(this->connection); + + pthread_mutex_unlock(&this->main_mutex); + + /* + printf ("video_out_xv: xv_display_frame... done\n"); + */ +} + +static int xv_get_property (vo_driver_t *this_gen, int property) { + xv_driver_t *this = (xv_driver_t *) this_gen; + + switch (property) { + case VO_PROP_WINDOW_WIDTH: + this->props[property].value = this->sc.gui_width; + break; + case VO_PROP_WINDOW_HEIGHT: + this->props[property].value = this->sc.gui_height; + break; + } + + lprintf("video_out_xv: property #%d = %d\n", property, this->props[property].value); + + return this->props[property].value; +} + +static void xv_property_callback (void *property_gen, xine_cfg_entry_t *entry) { + xv_property_t *property = (xv_property_t *) property_gen; + xv_driver_t *this = property->this; + + pthread_mutex_lock(&this->main_mutex); + xcb_xv_set_port_attribute(this->connection, this->xv_port, + property->atom, entry->num_value); + pthread_mutex_unlock(&this->main_mutex); +} + +static int xv_set_property (vo_driver_t *this_gen, + int property, int value) { + xv_driver_t *this = (xv_driver_t *) this_gen; + + if (this->props[property].atom != XCB_NONE) { + xcb_xv_get_port_attribute_cookie_t get_attribute_cookie; + xcb_xv_get_port_attribute_reply_t *get_attribute_reply; + + /* value is out of bound */ + if((value < this->props[property].min) || (value > this->props[property].max)) + value = (this->props[property].min + this->props[property].max) >> 1; + + pthread_mutex_lock(&this->main_mutex); + xcb_xv_set_port_attribute(this->connection, this->xv_port, + this->props[property].atom, value); + + get_attribute_cookie = xcb_xv_get_port_attribute(this->connection, this->xv_port, this->props[property].atom); + get_attribute_reply = xcb_xv_get_port_attribute_reply(this->connection, get_attribute_cookie, NULL); + this->props[property].value = get_attribute_reply->value; + free(get_attribute_reply); + + pthread_mutex_unlock(&this->main_mutex); + + if (this->props[property].entry) + this->props[property].entry->num_value = this->props[property].value; + + return this->props[property].value; + } + else { + switch (property) { + + case VO_PROP_INTERLACED: + this->props[property].value = value; + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_xv: VO_PROP_INTERLACED(%d)\n", this->props[property].value); + this->deinterlace_enabled = value; + if (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) { + xv_compute_ideal_size (this); + xv_compute_output_size (this); + } + break; + + case VO_PROP_ASPECT_RATIO: + if (value>=XINE_VO_ASPECT_NUM_RATIOS) + value = XINE_VO_ASPECT_AUTO; + + this->props[property].value = value; + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_xv: VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value); + this->sc.user_ratio = value; + + xv_compute_ideal_size (this); + + this->sc.force_redraw = 1; /* trigger re-calc of output size */ + break; + + case VO_PROP_ZOOM_X: + if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { + this->props[property].value = value; + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_xv: VO_PROP_ZOOM_X = %d\n", this->props[property].value); + + this->sc.zoom_factor_x = (double)value / (double)XINE_VO_ZOOM_STEP; + + xv_compute_ideal_size (this); + + this->sc.force_redraw = 1; /* trigger re-calc of output size */ + } + break; + + case VO_PROP_ZOOM_Y: + if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { + this->props[property].value = value; + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_xv: VO_PROP_ZOOM_Y = %d\n", this->props[property].value); + + this->sc.zoom_factor_y = (double)value / (double)XINE_VO_ZOOM_STEP; + + xv_compute_ideal_size (this); + + this->sc.force_redraw = 1; /* trigger re-calc of output size */ + } + break; + } + } + + return value; +} + +static void xv_get_property_min_max (vo_driver_t *this_gen, + int property, int *min, int *max) { + xv_driver_t *this = (xv_driver_t *) this_gen; + + *min = this->props[property].min; + *max = this->props[property].max; +} + +static int xv_gui_data_exchange (vo_driver_t *this_gen, + int data_type, void *data) { + xv_driver_t *this = (xv_driver_t *) this_gen; + + switch (data_type) { +#ifndef XINE_DISABLE_DEPRECATED_FEATURES + case XINE_GUI_SEND_COMPLETION_EVENT: + break; +#endif + + case XINE_GUI_SEND_EXPOSE_EVENT: { + /* XExposeEvent * xev = (XExposeEvent *) data; */ + + if (this->cur_frame) { + + pthread_mutex_lock(&this->main_mutex); + + if (this->cur_frame->shmseg) { + xcb_xv_shm_put_image(this->connection, this->xv_port, this->window, this->gc, + this->cur_frame->shmseg, this->cur_frame->xv_format, 0, + this->sc.displayed_xoffset, this->sc.displayed_yoffset, + this->sc.displayed_width, this->sc.displayed_height, + this->sc.output_xoffset, this->sc.output_yoffset, + this->sc.output_width, this->sc.output_height, + this->cur_frame->xv_width, this->cur_frame->xv_height, 0); + } else { + xcb_xv_put_image(this->connection, this->xv_port, this->window, this->gc, + this->cur_frame->xv_format, + this->sc.displayed_xoffset, this->sc.displayed_yoffset, + this->sc.displayed_width, this->sc.displayed_height, + this->sc.output_xoffset, this->sc.output_yoffset, + this->sc.output_width, this->sc.output_height, + this->cur_frame->xv_width, this->cur_frame->xv_height, + this->cur_frame->xv_data_size, this->cur_frame->image); + } + + if(this->xoverlay) + xcbosd_expose(this->xoverlay); + + xcb_flush(this->connection); + pthread_mutex_unlock(&this->main_mutex); + } + } + break; + + case XINE_GUI_SEND_DRAWABLE_CHANGED: + pthread_mutex_lock(&this->main_mutex); + this->window = (xcb_window_t) data; + xcb_free_gc(this->connection, this->gc); + this->gc = xcb_generate_id(this->connection); + xcb_create_gc(this->connection, this->gc, this->window, 0, NULL); + if(this->xoverlay) + xcbosd_drawable_changed(this->xoverlay, this->window); + this->ovl_changed = 1; + pthread_mutex_unlock(&this->main_mutex); + this->sc.force_redraw = 1; + break; + + case XINE_GUI_SEND_TRANSLATE_GUI_TO_VIDEO: + { + int x1, y1, x2, y2; + x11_rectangle_t *rect = data; + + _x_vo_scale_translate_gui2video(&this->sc, rect->x, rect->y, + &x1, &y1); + _x_vo_scale_translate_gui2video(&this->sc, rect->x + rect->w, rect->y + rect->h, + &x2, &y2); + rect->x = x1; + rect->y = y1; + rect->w = x2-x1; + rect->h = y2-y1; + + /* onefield_xv divide by 2 the number of lines */ + if (this->deinterlace_enabled + && (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) + && (this->cur_frame->format == XINE_IMGFMT_YV12)) { + rect->y = rect->y * 2; + rect->h = rect->h * 2; + } + + } + break; + + default: + return -1; + } + + return 0; +} + +static void xv_store_port_attribute(xv_driver_t *this, char *name) { + xv_portattribute_t *attr; + + xcb_intern_atom_cookie_t atom_cookie; + xcb_intern_atom_reply_t *atom_reply; + + xcb_xv_get_port_attribute_cookie_t get_attribute_cookie; + xcb_xv_get_port_attribute_reply_t *get_attribute_reply; + + attr = (xv_portattribute_t *)malloc( sizeof(xv_portattribute_t) ); + attr->name = strdup(name); + + pthread_mutex_lock(&this->main_mutex); + atom_cookie = xcb_intern_atom(this->connection, 0, strlen(attr->name), attr->name); + atom_reply = xcb_intern_atom_reply(this->connection, atom_cookie, NULL); + get_attribute_cookie = xcb_xv_get_port_attribute(this->connection, this->xv_port, atom_reply->atom); + get_attribute_reply = xcb_xv_get_port_attribute_reply(this->connection, get_attribute_cookie, NULL); + attr->value = get_attribute_reply->value; + free(atom_reply); + free(get_attribute_reply); + pthread_mutex_unlock(&this->main_mutex); + + xine_list_push_back (this->port_attributes, attr); +} + +static void xv_restore_port_attributes(xv_driver_t *this) { + xine_list_iterator_t ite; + + xcb_intern_atom_cookie_t atom_cookie; + xcb_intern_atom_reply_t *atom_reply; + + while ((ite = xine_list_front(this->port_attributes)) != NULL) { + xv_portattribute_t *attr = xine_list_get_value(this->port_attributes, ite); + xine_list_remove (this->port_attributes, ite); + + pthread_mutex_lock(&this->main_mutex); + atom_cookie = xcb_intern_atom(this->connection, 0, strlen(attr->name), attr->name); + atom_reply = xcb_intern_atom_reply(this->connection, atom_cookie, NULL); + xcb_xv_set_port_attribute(this->connection, this->xv_port, atom_reply->atom, attr->value); + free(atom_reply); + pthread_mutex_unlock(&this->main_mutex); + + free( attr->name ); + free( attr ); + } + + pthread_mutex_lock(&this->main_mutex); + xcb_flush(this->connection); + pthread_mutex_unlock(&this->main_mutex); + + xine_list_delete( this->port_attributes ); +} + +static void xv_dispose (vo_driver_t *this_gen) { + xv_driver_t *this = (xv_driver_t *) this_gen; + int i; + + /* restore port attributes to their initial values */ + xv_restore_port_attributes(this); + + if (this->deinterlace_frame.image) { + pthread_mutex_lock(&this->main_mutex); + dispose_ximage(this, &this->deinterlace_frame); + pthread_mutex_unlock(&this->main_mutex); + } + + pthread_mutex_lock(&this->main_mutex); + xcb_xv_ungrab_port(this->connection, this->xv_port, XCB_CURRENT_TIME); + xcb_free_gc(this->connection, this->gc); + pthread_mutex_unlock(&this->main_mutex); + + for( i=0; i < VO_NUM_RECENT_FRAMES; i++ ) { + if( this->recent_frames[i] ) + this->recent_frames[i]->vo_frame.dispose + (&this->recent_frames[i]->vo_frame); + this->recent_frames[i] = NULL; + } + + if( this->xoverlay ) { + pthread_mutex_lock(&this->main_mutex); + xcbosd_destroy(this->xoverlay); + pthread_mutex_unlock(&this->main_mutex); + } + + pthread_mutex_destroy(&this->main_mutex); + + _x_alphablend_free(&this->alphablend_extra_data); + + free (this); +} + +static int xv_check_yv12(xcb_connection_t *connection, xcb_xv_port_t port) { + xcb_xv_list_image_formats_cookie_t list_formats_cookie; + xcb_xv_list_image_formats_reply_t *list_formats_reply; + + xcb_xv_image_format_info_iterator_t format_it; + + list_formats_cookie = xcb_xv_list_image_formats(connection, port); + list_formats_reply = xcb_xv_list_image_formats_reply(connection, list_formats_cookie, NULL); + format_it = xcb_xv_list_image_formats_format_iterator(list_formats_reply); + + for (; format_it.rem; xcb_xv_image_format_info_next(&format_it)) + if ((format_it.data->id == XINE_IMGFMT_YV12) && + (! (strcmp ((char *) format_it.data->guid, "YV12")))) { + free(list_formats_reply); + return 0; + } + + free(list_formats_reply); + return 1; +} + +static void xv_check_capability (xv_driver_t *this, + int property, xcb_xv_attribute_info_t *attr, + int base_id, + char *config_name, + char *config_desc, + char *config_help) { + int int_default; + cfg_entry_t *entry; + char *str_prop = xcb_xv_attribute_info_name(attr); + + xcb_xv_get_port_attribute_cookie_t get_attribute_cookie; + xcb_xv_get_port_attribute_reply_t *get_attribute_reply; + + xcb_intern_atom_cookie_t atom_cookie; + xcb_intern_atom_reply_t *atom_reply; + + /* + * some Xv drivers (Gatos ATI) report some ~0 as max values, this is confusing. + */ + if (VO_PROP_COLORKEY && (attr->max == ~0)) + attr->max = 2147483615; + + atom_cookie = xcb_intern_atom(this->connection, 0, strlen(str_prop), str_prop); + atom_reply = xcb_intern_atom_reply(this->connection, atom_cookie, NULL); + + this->props[property].min = attr->min; + this->props[property].max = attr->max; + this->props[property].atom = atom_reply->atom; + + free(atom_reply); + + get_attribute_cookie = xcb_xv_get_port_attribute(this->connection, this->xv_port, this->props[property].atom); + get_attribute_reply = xcb_xv_get_port_attribute_reply(this->connection, get_attribute_cookie, NULL); + + int_default = get_attribute_reply->value; + + free(get_attribute_reply); + + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_xv: port attribute %s (%d) value is %d\n", str_prop, property, int_default); + + /* disable autopaint colorkey by default */ + /* might be overridden using config entry */ + if(strcmp(str_prop, "XV_AUTOPAINT_COLORKEY") == 0) + int_default = 0; + + if (config_name) { + /* is this a boolean property ? */ + if ((attr->min == 0) && (attr->max == 1)) { + this->config->register_bool (this->config, config_name, int_default, + config_desc, + config_help, 20, xv_property_callback, &this->props[property]); + + } else { + this->config->register_range (this->config, config_name, int_default, + this->props[property].min, this->props[property].max, + config_desc, + config_help, 20, xv_property_callback, &this->props[property]); + } + + entry = this->config->lookup_entry (this->config, config_name); + + if((entry->num_value < this->props[property].min) || + (entry->num_value > this->props[property].max)) { + + this->config->update_num(this->config, config_name, + ((this->props[property].min + this->props[property].max) >> 1)); + + entry = this->config->lookup_entry (this->config, config_name); + } + + this->props[property].entry = entry; + + xv_set_property (&this->vo_driver, property, entry->num_value); + + if (strcmp(str_prop, "XV_COLORKEY") == 0) { + this->use_colorkey |= 1; + this->colorkey = entry->num_value; + } else if(strcmp(str_prop, "XV_AUTOPAINT_COLORKEY") == 0) { + if(entry->num_value==1) + this->use_colorkey |= 2; /* colorkey is autopainted */ + } + } else + this->props[property].value = int_default; + +} + +static void xv_update_deinterlace(void *this_gen, xine_cfg_entry_t *entry) { + xv_driver_t *this = (xv_driver_t *) this_gen; + + this->deinterlace_method = entry->num_value; +} + +static void xv_update_XV_FILTER(void *this_gen, xine_cfg_entry_t *entry) { + xv_driver_t *this = (xv_driver_t *) this_gen; + int xv_filter; + + xcb_intern_atom_cookie_t atom_cookie; + xcb_intern_atom_reply_t *atom_reply; + + xv_filter = entry->num_value; + + pthread_mutex_lock(&this->main_mutex); + atom_cookie = xcb_intern_atom(this->connection, 0, sizeof("XV_FILTER"), "XV_FILTER"); + atom_reply = xcb_intern_atom_reply(this->connection, atom_cookie, NULL); + xcb_xv_set_port_attribute(this->connection, this->xv_port, atom_reply->atom, xv_filter); + free(atom_reply); + pthread_mutex_unlock(&this->main_mutex); + + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_xv: bilinear scaling mode (XV_FILTER) = %d\n",xv_filter); +} + +static void xv_update_XV_DOUBLE_BUFFER(void *this_gen, xine_cfg_entry_t *entry) { + xv_driver_t *this = (xv_driver_t *) this_gen; + int xv_double_buffer; + + xcb_intern_atom_cookie_t atom_cookie; + xcb_intern_atom_reply_t *atom_reply; + + xv_double_buffer = entry->num_value; + + pthread_mutex_lock(&this->main_mutex); + atom_cookie = xcb_intern_atom(this->connection, 0, sizeof("XV_DOUBLE_BUFFER"), "XV_DOUBLE_BUFFER"); + atom_reply = xcb_intern_atom_reply(this->connection, atom_cookie, NULL); + xcb_xv_set_port_attribute(this->connection, this->xv_port, atom_reply->atom, xv_double_buffer); + free(atom_reply); + pthread_mutex_unlock(&this->main_mutex); + + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_xv: double buffering mode = %d\n", xv_double_buffer); +} + +static void xv_update_xv_pitch_alignment(void *this_gen, xine_cfg_entry_t *entry) { + xv_driver_t *this = (xv_driver_t *) this_gen; + + this->use_pitch_alignment = entry->num_value; +} + +static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *visual_gen) { + xv_class_t *class = (xv_class_t *) class_gen; + config_values_t *config = class->config; + xv_driver_t *this; + int i; + xcb_visual_t *visual = (xcb_visual_t *) visual_gen; + unsigned int j; + xcb_xv_port_t xv_port; + + const xcb_query_extension_reply_t *query_extension_reply; + + xcb_xv_query_adaptors_cookie_t query_adaptors_cookie; + xcb_xv_query_adaptors_reply_t *query_adaptors_reply; + xcb_xv_query_port_attributes_cookie_t query_attributes_cookie; + xcb_xv_query_port_attributes_reply_t *query_attributes_reply; + xcb_xv_list_image_formats_cookie_t list_formats_cookie; + xcb_xv_list_image_formats_reply_t *list_formats_reply; + + xcb_xv_adaptor_info_iterator_t adaptor_it; + xcb_xv_image_format_info_iterator_t format_it; + + this = (xv_driver_t *) xine_xmalloc (sizeof (xv_driver_t)); + if (!this) + return NULL; + + pthread_mutex_init(&this->main_mutex, NULL); + + _x_alphablend_init(&this->alphablend_extra_data, class->xine); + + this->connection = visual->connection; + this->screen = visual->screen; + this->window = visual->window; + this->config = config; + + /* + * check for Xvideo support + */ + + query_extension_reply = xcb_get_extension_data(this->connection, &xcb_xv_id); + if (!query_extension_reply || !query_extension_reply->present) { + xprintf (class->xine, XINE_VERBOSITY_LOG, _("video_out_xv: Xv extension not present.\n")); + return NULL; + } + + /* + * check adaptors, search for one that supports (at least) yuv12 + */ + + query_adaptors_cookie = xcb_xv_query_adaptors(this->connection, this->window); + query_adaptors_reply = xcb_xv_query_adaptors_reply(this->connection, query_adaptors_cookie, NULL); + + if (!query_adaptors_reply) { + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: XvQueryAdaptors failed.\n"); + return NULL; + } + + adaptor_it = xcb_xv_query_adaptors_info_iterator(query_adaptors_reply); + + xv_port = 0; + + for (; adaptor_it.rem && !xv_port; xcb_xv_adaptor_info_next(&adaptor_it)) { + + if (adaptor_it.data->type & XCB_XV_TYPE_IMAGE_MASK) { + + for (j = 0; j < adaptor_it.data->num_ports; j++) + if (!xv_check_yv12(this->connection, adaptor_it.data->base_id + j)) { + xcb_xv_grab_port_cookie_t grab_port_cookie; + xcb_xv_grab_port_reply_t *grab_port_reply; + grab_port_cookie = xcb_xv_grab_port(this->connection, adaptor_it.data->base_id + j, XCB_CURRENT_TIME); + grab_port_reply = xcb_xv_grab_port_reply(this->connection, grab_port_cookie, NULL); + if (grab_port_reply && (grab_port_reply->result == XCB_GRAB_STATUS_SUCCESS)) { + free(grab_port_reply); + xv_port = adaptor_it.data->base_id + j; + break; + } + free(grab_port_reply); + } + } + } + + if (!xv_port) { + xprintf(class->xine, XINE_VERBOSITY_LOG, + _("video_out_xv: Xv extension is present but I couldn't find a usable yuv12 port.\n" + " Looks like your graphics hardware driver doesn't support Xv?!\n")); + + /* XvFreeAdaptorInfo (adaptor_info); this crashed on me (gb)*/ + return NULL; + } + else + xprintf(class->xine, XINE_VERBOSITY_LOG, + _("video_out_xv: using Xv port %d from adaptor %s for hardware " + "colorspace conversion and scaling.\n"), xv_port, + xcb_xv_adaptor_info_name(adaptor_it.data)); + + this->xv_port = xv_port; + + _x_vo_scale_init (&this->sc, 1, 0, config ); + this->sc.frame_output_cb = visual->frame_output_cb; + this->sc.user_data = visual->user_data; + + this->gc = xcb_generate_id(this->connection); + xcb_create_gc(this->connection, this->gc, this->window, 0, NULL); + this->capabilities = VO_CAP_CROP; + this->use_shm = 1; + this->deinterlace_method = 0; + this->deinterlace_frame.image = NULL; + this->use_colorkey = 0; + this->colorkey = 0; + this->xoverlay = NULL; + this->ovl_changed = 0; + this->xine = class->xine; + + this->vo_driver.get_capabilities = xv_get_capabilities; + this->vo_driver.alloc_frame = xv_alloc_frame; + this->vo_driver.update_frame_format = xv_update_frame_format; + this->vo_driver.overlay_begin = xv_overlay_begin; + this->vo_driver.overlay_blend = xv_overlay_blend; + this->vo_driver.overlay_end = xv_overlay_end; + this->vo_driver.display_frame = xv_display_frame; + this->vo_driver.get_property = xv_get_property; + this->vo_driver.set_property = xv_set_property; + this->vo_driver.get_property_min_max = xv_get_property_min_max; + this->vo_driver.gui_data_exchange = xv_gui_data_exchange; + this->vo_driver.dispose = xv_dispose; + this->vo_driver.redraw_needed = xv_redraw_needed; + + /* + * init properties + */ + + for (i = 0; i < VO_NUM_PROPERTIES; i++) { + this->props[i].value = 0; + this->props[i].min = 0; + this->props[i].max = 0; + this->props[i].atom = XCB_NONE; + this->props[i].entry = NULL; + this->props[i].this = this; + } + + this->props[VO_PROP_INTERLACED].value = 0; + this->sc.user_ratio = + this->props[VO_PROP_ASPECT_RATIO].value = XINE_VO_ASPECT_AUTO; + this->props[VO_PROP_ZOOM_X].value = 100; + this->props[VO_PROP_ZOOM_Y].value = 100; + + /* + * check this adaptor's capabilities + */ + this->port_attributes = xine_list_new(); + + query_attributes_cookie = xcb_xv_query_port_attributes(this->connection, xv_port); + query_attributes_reply = xcb_xv_query_port_attributes_reply(this->connection, query_attributes_cookie, NULL); + if(query_attributes_reply) { + xcb_xv_attribute_info_iterator_t attribute_it; + attribute_it = xcb_xv_query_port_attributes_attributes_iterator(query_attributes_reply); + + for (; attribute_it.rem; xcb_xv_attribute_info_next(&attribute_it)) { + if ((attribute_it.data->flags & XCB_XV_ATTRIBUTE_FLAG_SETTABLE) && (attribute_it.data->flags & XCB_XV_ATTRIBUTE_FLAG_GETTABLE)) { + /* store initial port attribute value */ + xv_store_port_attribute(this, xcb_xv_attribute_info_name(attribute_it.data)); + + if(!strcmp(xcb_xv_attribute_info_name(attribute_it.data), "XV_HUE")) { + if (!strncmp(xcb_xv_adaptor_info_name(adaptor_it.data), "NV", 2)) { + xprintf (this->xine, XINE_VERBOSITY_NONE, "video_out_xv: ignoring broken XV_HUE settings on NVidia cards"); + } else { + xv_check_capability (this, VO_PROP_HUE, attribute_it.data, + adaptor_it.data->base_id, + NULL, NULL, NULL); + } + } else if(!strcmp(xcb_xv_attribute_info_name(attribute_it.data), "XV_SATURATION")) { + xv_check_capability (this, VO_PROP_SATURATION, attribute_it.data, + adaptor_it.data->base_id, + NULL, NULL, NULL); + + } else if(!strcmp(xcb_xv_attribute_info_name(attribute_it.data), "XV_BRIGHTNESS")) { + xv_check_capability (this, VO_PROP_BRIGHTNESS, attribute_it.data, + adaptor_it.data->base_id, + NULL, NULL, NULL); + + } else if(!strcmp(xcb_xv_attribute_info_name(attribute_it.data), "XV_CONTRAST")) { + xv_check_capability (this, VO_PROP_CONTRAST, attribute_it.data, + adaptor_it.data->base_id, + NULL, NULL, NULL); + + } else if(!strcmp(xcb_xv_attribute_info_name(attribute_it.data), "XV_COLORKEY")) { + xv_check_capability (this, VO_PROP_COLORKEY, attribute_it.data, + adaptor_it.data->base_id, + "video.device.xv_colorkey", + _("video overlay colour key"), + _("The colour key is used to tell the graphics card where to " + "overlay the video image. Try different values, if you experience " + "windows becoming transparent.")); + + } else if(!strcmp(xcb_xv_attribute_info_name(attribute_it.data), "XV_AUTOPAINT_COLORKEY")) { + xv_check_capability (this, VO_PROP_AUTOPAINT_COLORKEY, attribute_it.data, + adaptor_it.data->base_id, + "video.device.xv_autopaint_colorkey", + _("autopaint colour key"), + _("Make Xv autopaint its colorkey.")); + + } else if(!strcmp(xcb_xv_attribute_info_name(attribute_it.data), "XV_FILTER")) { + int xv_filter; + /* This setting is specific to Permedia 2/3 cards. */ + xv_filter = config->register_range (config, "video.device.xv_filter", 0, + attribute_it.data->min, attribute_it.data->max, + _("bilinear scaling mode"), + _("Selects the bilinear scaling mode for Permedia cards. " + "The individual values are:\n\n" + "Permedia 2\n" + "0 - disable bilinear filtering\n" + "1 - enable bilinear filtering\n\n" + "Permedia 3\n" + "0 - disable bilinear filtering\n" + "1 - horizontal linear filtering\n" + "2 - enable full bilinear filtering"), + 20, xv_update_XV_FILTER, this); + config->update_num(config,"video.device.xv_filter",xv_filter); + } else if(!strcmp(xcb_xv_attribute_info_name(attribute_it.data), "XV_DOUBLE_BUFFER")) { + int xv_double_buffer; + xv_double_buffer = + config->register_bool (config, "video.device.xv_double_buffer", 1, + _("enable double buffering"), + _("Double buffering will synchronize the update of the video image to the " + "repainting of the entire screen (\"vertical retrace\"). This eliminates " + "flickering and tearing artifacts, but will use more graphics memory."), + 20, xv_update_XV_DOUBLE_BUFFER, this); + config->update_num(config,"video.device.xv_double_buffer",xv_double_buffer); + } + } + } + free(query_attributes_reply); + } + else + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: no port attributes defined.\n"); + free(query_adaptors_reply); + + /* + * check supported image formats + */ + + list_formats_cookie = xcb_xv_list_image_formats(this->connection, xv_port); + list_formats_reply = xcb_xv_list_image_formats_reply(this->connection, list_formats_cookie, NULL); + + format_it = xcb_xv_list_image_formats_format_iterator(list_formats_reply); + + this->xv_format_yv12 = 0; + this->xv_format_yuy2 = 0; + + for (; format_it.rem; xcb_xv_image_format_info_next(&format_it)) { + lprintf ("Xv image format: 0x%x (%4.4s) %s\n", + format_it.data->id, (char*)&format_it.data->id, + (format_it.data->format == XvPacked) ? "packed" : "planar"); + + if (format_it.data->id == XINE_IMGFMT_YV12) { + this->xv_format_yv12 = format_it.data->id; + this->capabilities |= VO_CAP_YV12; + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_xv: this adaptor supports the yv12 format.\n")); + } else if (format_it.data->id == XINE_IMGFMT_YUY2) { + this->xv_format_yuy2 = format_it.data->id; + this->capabilities |= VO_CAP_YUY2; + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_xv: this adaptor supports the yuy2 format.\n")); + } + } + + free(list_formats_reply); + + this->use_pitch_alignment = + config->register_bool (config, "video.device.xv_pitch_alignment", 0, + _("pitch alignment workaround"), + _("Some buggy video drivers need a workaround to function properly."), + 10, xv_update_xv_pitch_alignment, this); + + this->deinterlace_method = + config->register_enum (config, "video.output.xv_deinterlace_method", 4, + deinterlace_methods, + _("deinterlace method (deprecated)"), + _("This config setting is deprecated. You should use the new deinterlacing " + "post processing settings instead.\n\n" + "From the old days of analog television, where the even and odd numbered " + "lines of a video frame would be displayed at different times comes the " + "idea to increase motion smoothness by also recording the lines at " + "different times. This is called \"interlacing\". But unfortunately, " + "todays displays show the even and odd numbered lines as one complete frame " + "all at the same time (called \"progressive display\"), which results in " + "ugly frame errors known as comb artifacts. Software deinterlacing is an " + "approach to reduce these artifacts. The individual values are:\n\n" + "none\n" + "Disables software deinterlacing.\n\n" + "bob\n" + "Interpolates between the lines for moving parts of the image.\n\n" + "weave\n" + "Similar to bob, but with a tendency to preserve the full resolution, " + "better for high detail in low movement scenes.\n\n" + "greedy\n" + "Very good adaptive deinterlacer, but needs a lot of CPU power.\n\n" + "onefield\n" + "Always interpolates and reduces vertical resolution.\n\n" + "onefieldxv\n" + "Same as onefield, but does the interpolation in hardware.\n\n" + "linearblend\n" + "Applies a slight vertical blur to remove the comb artifacts. Good results " + "with medium CPU usage."), + 10, xv_update_deinterlace, this); + this->deinterlace_enabled = 0; + + if(this->use_colorkey==1) { + this->xoverlay = xcbosd_create(this->xine, this->connection, this->screen, + this->window, XCBOSD_COLORKEY); + if(this->xoverlay) + xcbosd_colorkey(this->xoverlay, this->colorkey, &this->sc); + } else { + this->xoverlay = xcbosd_create(this->xine, this->connection, this->screen, + this->window, XCBOSD_SHAPED); + } + + if( this->xoverlay ) + this->capabilities |= VO_CAP_UNSCALED_OVERLAY; + + return &this->vo_driver; +} + +/* + * class functions + */ + +static char* get_identifier (video_driver_class_t *this_gen) { + return "Xv"; +} + +static char* get_description (video_driver_class_t *this_gen) { + return _("xine video output plugin using the MIT X video extension"); +} + +static void dispose_class (video_driver_class_t *this_gen) { + xv_class_t *this = (xv_class_t *) this_gen; + + free (this); +} + +static void *init_class (xine_t *xine, void *visual_gen) { + xv_class_t *this = (xv_class_t *) xine_xmalloc (sizeof (xv_class_t)); + + this->driver_class.open_plugin = open_plugin; + this->driver_class.get_identifier = get_identifier; + this->driver_class.get_description = get_description; + this->driver_class.dispose = dispose_class; + + this->config = xine->config; + this->xine = xine; + + return this; +} + +static const vo_info_t vo_info_xv = { + 9, /* priority */ + XINE_VISUAL_TYPE_XCB /* visual type */ +}; + +/* + * exported plugin catalog entry + */ + +const plugin_info_t xine_plugin_info[] EXPORTED = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_OUT, 21, "xv", XINE_VERSION_CODE, &vo_info_xv, init_class }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; + +#endif diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index d109fb455..579189825 100644 --- a/src/video_out/video_out_xshm.c +++ b/src/video_out/video_out_xshm.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xshm.c,v 1.148 2006/10/28 18:51:08 miguelfreitas Exp $ + * $Id: video_out_xshm.c,v 1.149 2007/02/15 15:19:33 dgp85 Exp $ * * video_out_xshm.c, X11 shared memory extension interface for xine * @@ -87,7 +87,6 @@ typedef struct { yuv2rgb_t *yuv2rgb; /* yuv2rgb converter set up for this frame */ uint8_t *rgb_dst; - int yuv_stride; } xshm_frame_t; @@ -105,8 +104,6 @@ typedef struct { int use_shm; XColor black; - int yuv2rgb_mode; - int yuv2rgb_swap; int yuv2rgb_brightness; int yuv2rgb_contrast; int yuv2rgb_saturation; @@ -585,7 +582,6 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, frame->sc.output_width, frame->sc.output_height, frame->image->bytes_per_line*2); - frame->yuv_stride = frame->image->bytes_per_line*2; break; case VO_BOTH_FIELDS: frame->yuv2rgb->configure (frame->yuv2rgb, @@ -596,7 +592,6 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, frame->sc.output_width, frame->sc.output_height, frame->image->bytes_per_line); - frame->yuv_stride = frame->image->bytes_per_line; break; } } @@ -1255,8 +1250,6 @@ static vo_driver_t *xshm_open_plugin_2 (video_driver_class_t *class_gen, const v return NULL; } - this->yuv2rgb_mode = mode; - this->yuv2rgb_swap = swapped; this->yuv2rgb_brightness = 0; this->yuv2rgb_contrast = 128; this->yuv2rgb_saturation = 128; diff --git a/src/video_out/xcbosd.c b/src/video_out/xcbosd.c new file mode 100644 index 000000000..9013bab10 --- /dev/null +++ b/src/video_out/xcbosd.c @@ -0,0 +1,546 @@ +/* + * Copyright (C) 2003, 2007 the xine project + * + * This file is part of xine, a free video player. + * + * xine 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. + * + * xine 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * $Id: xcbosd.c,v 1.1 2007/02/15 15:19:33 dgp85 Exp $ + * + * xcbosd.c, use X11 Nonrectangular Window Shape Extension to draw xine OSD + * + * Nov 2003 - Miguel Freitas + * Feb 2007 - ported to xcb by Christoph Pfister + * + * based on ideas and code of + * xosd Copyright (c) 2000 Andre Renaud (andre@ignavus.net) + * + * colorkey support by Yann Vernier + */ + +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <signal.h> +#include <time.h> + +#include <assert.h> + +#include <netinet/in.h> + +#include <xcb/shape.h> + +#define LOG_MODULE "xcbosd" +#define LOG_VERBOSE + +/* +#define LOG +*/ + +#include "xine_internal.h" +#include "xcbosd.h" + +struct xcbosd +{ + xcb_connection_t *connection; + xcb_screen_t *screen; + enum xcbosd_mode mode; + + union { + struct { + xcb_window_t window; + xcb_pixmap_t mask_bitmap; + xcb_gc_t mask_gc; + xcb_gc_t mask_gc_back; + int mapped; + } shaped; + struct { + uint32_t colorkey; + vo_scale_t *sc; + } colorkey; + } u; + xcb_window_t window; + unsigned int depth; + xcb_pixmap_t bitmap; + xcb_visualid_t visual; + xcb_colormap_t cmap; + + xcb_gc_t gc; + + int width; + int height; + int x; + int y; + enum {DRAWN, WIPED, UNDEFINED} clean; + xine_t *xine; +}; + + +void xcbosd_expose(xcbosd *osd) +{ + assert (osd); + + lprintf("expose (state:%d)\n", osd->clean ); + + switch (osd->mode) { + case XCBOSD_SHAPED: + xcb_shape_mask(osd->connection, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, + osd->u.shaped.window, 0, 0, osd->u.shaped.mask_bitmap); + if( osd->clean==DRAWN ) { + + if( !osd->u.shaped.mapped ) { + unsigned int stack_mode = XCB_STACK_MODE_ABOVE; + xcb_configure_window(osd->connection, osd->u.shaped.window, XCB_CONFIG_WINDOW_STACK_MODE, &stack_mode); + xcb_map_window(osd->connection, osd->u.shaped.window); + } + osd->u.shaped.mapped = 1; + + xcb_copy_area(osd->connection, osd->bitmap, osd->u.shaped.window, + osd->gc, 0, 0, 0, 0, osd->width, osd->height); + } else { + if( osd->u.shaped.mapped ) + xcb_unmap_window(osd->connection, osd->u.shaped.window); + osd->u.shaped.mapped = 0; + } + break; + case XCBOSD_COLORKEY: + if( osd->clean!=UNDEFINED ) + xcb_copy_area(osd->connection, osd->bitmap, osd->window, osd->gc, 0, 0, + 0, 0, osd->width, osd->height); + } +} + + +void xcbosd_resize(xcbosd *osd, int width, int height) +{ + assert (osd); + assert (width); + assert (height); + + lprintf("resize old:%dx%d new:%dx%d\n", osd->width, osd->height, width, height ); + + osd->width = width; + osd->height = height; + + xcb_free_pixmap(osd->connection, osd->bitmap); + switch(osd->mode) { + case XCBOSD_SHAPED: { + unsigned int window_config[] = { osd->width, osd->height }; + xcb_configure_window(osd->connection, osd->u.shaped.window, XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, window_config); + xcb_free_pixmap(osd->connection, osd->u.shaped.mask_bitmap); + osd->u.shaped.mask_bitmap = xcb_generate_id(osd->connection); + xcb_create_pixmap(osd->connection, 1, osd->u.shaped.mask_bitmap, osd->u.shaped.window, osd->width, osd->height); + osd->bitmap = xcb_generate_id(osd->connection); + xcb_create_pixmap(osd->connection, osd->depth, osd->bitmap, osd->u.shaped.window, osd->width, osd->height); + break; + } + case XCBOSD_COLORKEY: + osd->bitmap = xcb_generate_id(osd->connection); + xcb_create_pixmap(osd->connection, osd->depth, osd->bitmap, osd->window, osd->width, osd->height); + break; + } + + osd->clean = UNDEFINED; + xcbosd_clear(osd); +} + +void xcbosd_drawable_changed(xcbosd *osd, xcb_window_t window) +{ + xcb_get_geometry_cookie_t get_geometry_cookie; + xcb_get_geometry_reply_t *get_geometry_reply; + + assert (osd); + + lprintf("drawable changed\n"); + +/* + Do I need to recreate the GC's?? + + XFreeGC (osd->display, osd->gc); + XFreeGC (osd->display, osd->mask_gc); + XFreeGC (osd->display, osd->mask_gc_back); +*/ + xcb_free_pixmap(osd->connection, osd->bitmap); + xcb_free_colormap(osd->connection, osd->cmap); + + /* we need to call XSync(), because otherwise, calling XDestroyWindow() + on the parent window could destroy our OSD window twice !! */ + /* XSync (osd->display, False); FIXME don't think that we need that --pfister */ + + osd->window = window; + + get_geometry_cookie = xcb_get_geometry(osd->connection, osd->window); + get_geometry_reply = xcb_get_geometry_reply(osd->connection, get_geometry_cookie, NULL); + osd->depth = get_geometry_reply->depth; + osd->width = get_geometry_reply->width; + osd->height = get_geometry_reply->height; + free(get_geometry_reply); + + assert(osd->width); + assert(osd->height); + + switch(osd->mode) { + case XCBOSD_SHAPED: { + xcb_free_pixmap(osd->connection, osd->u.shaped.mask_bitmap); + xcb_destroy_window(osd->connection, osd->u.shaped.window); + + unsigned int window_params[] = { osd->screen->black_pixel, 1, XCB_EVENT_MASK_EXPOSURE }; + osd->u.shaped.window = xcb_generate_id(osd->connection); + xcb_create_window(osd->connection, XCB_COPY_FROM_PARENT, osd->u.shaped.window, + osd->window, 0, 0, osd->width, osd->height, 0, XCB_COPY_FROM_PARENT, + XCB_COPY_FROM_PARENT, XCB_CW_BACK_PIXEL | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK, + window_params); + + osd->u.shaped.mapped = 0; + + osd->u.shaped.mask_bitmap = xcb_generate_id(osd->connection); + xcb_create_pixmap(osd->connection, 1, osd->u.shaped.mask_bitmap, osd->u.shaped.window, osd->width, osd->height); + + osd->bitmap = xcb_generate_id(osd->connection); + xcb_create_pixmap(osd->connection, osd->depth, osd->bitmap, osd->u.shaped.window, osd->width, osd->height); + + osd->cmap = xcb_generate_id(osd->connection); + xcb_create_colormap(osd->connection, XCB_COLORMAP_ALLOC_NONE, osd->cmap, osd->u.shaped.window, osd->visual); + break; + } + case XCBOSD_COLORKEY: + osd->bitmap = xcb_generate_id(osd->connection); + xcb_create_pixmap(osd->connection, osd->depth, osd->bitmap, osd->window, osd->width, osd->height); + osd->cmap = xcb_generate_id(osd->connection); + xcb_create_colormap(osd->connection, XCB_COLORMAP_ALLOC_NONE, osd->cmap, osd->window, osd->visual); + + break; + } + + osd->clean = UNDEFINED; + /* do not xcbosd_clear() here: osd->u.colorkey.sc has not being updated yet */ +} + +xcbosd *xcbosd_create(xine_t *xine, xcb_connection_t *connection, xcb_screen_t *screen, xcb_window_t window, enum xcbosd_mode mode) +{ + xcbosd *osd; + + xcb_get_geometry_cookie_t get_geometry_cookie; + xcb_get_geometry_reply_t *get_geometry_reply; + + xcb_void_cookie_t generic_cookie; + xcb_generic_error_t *generic_error; + + osd = xine_xmalloc (sizeof (xcbosd)); + if (!osd) + return NULL; + + osd->mode = mode; + osd->xine = xine; + osd->connection = connection; + osd->screen = screen; + osd->window = window; + + osd->visual = osd->screen->root_visual; + + get_geometry_cookie = xcb_get_geometry(osd->connection, osd->window); + get_geometry_reply = xcb_get_geometry_reply(osd->connection, get_geometry_cookie, NULL); + osd->depth = get_geometry_reply->depth; + osd->width = get_geometry_reply->width; + osd->height = get_geometry_reply->height; + free(get_geometry_reply); + + assert(osd->width); + assert(osd->height); + + switch (mode) { + case XCBOSD_SHAPED: { + const xcb_query_extension_reply_t *query_extension_reply = xcb_get_extension_data(osd->connection, &xcb_shape_id); + + if (!query_extension_reply || !query_extension_reply->present) { + xprintf(osd->xine, XINE_VERBOSITY_LOG, _("x11osd: XShape extension not available. unscaled overlay disabled.\n")); + goto error2; + } + + unsigned int window_params[] = { osd->screen->black_pixel, 1, XCB_EVENT_MASK_EXPOSURE }; + osd->u.shaped.window = xcb_generate_id(osd->connection); + generic_cookie = xcb_create_window_checked(osd->connection, XCB_COPY_FROM_PARENT, osd->u.shaped.window, + osd->window, 0, 0, osd->width, osd->height, 0, XCB_COPY_FROM_PARENT, + XCB_COPY_FROM_PARENT, XCB_CW_BACK_PIXEL | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK, + window_params); + generic_error = xcb_request_check(osd->connection, generic_cookie); + + if (generic_error != NULL) { + xprintf(osd->xine, XINE_VERBOSITY_LOG, _("x11osd: error creating window. unscaled overlay disabled.\n")); + free(generic_error); + goto error_window; + } + + osd->u.shaped.mask_bitmap = xcb_generate_id(osd->connection); + generic_cookie = xcb_create_pixmap_checked(osd->connection, 1, osd->u.shaped.mask_bitmap, osd->u.shaped.window, osd->width, osd->height); + generic_error = xcb_request_check(osd->connection, generic_cookie); + + if (generic_error != NULL) { + xprintf(osd->xine, XINE_VERBOSITY_LOG, _("x11osd: error creating pixmap. unscaled overlay disabled.\n")); + free(generic_error); + goto error_aftermaskbitmap; + } + + osd->bitmap = xcb_generate_id(osd->connection); + xcb_create_pixmap(osd->connection, osd->depth, osd->bitmap, osd->u.shaped.window, osd->width, osd->height); + osd->gc = xcb_generate_id(osd->connection); + xcb_create_gc(osd->connection, osd->gc, osd->u.shaped.window, 0, NULL); + + osd->u.shaped.mask_gc = xcb_generate_id(osd->connection); + xcb_create_gc(osd->connection, osd->u.shaped.mask_gc, osd->u.shaped.mask_bitmap, XCB_GC_FOREGROUND, &osd->screen->white_pixel); + + osd->u.shaped.mask_gc_back = xcb_generate_id(osd->connection); + xcb_create_gc(osd->connection, osd->u.shaped.mask_gc_back, osd->u.shaped.mask_bitmap, XCB_GC_FOREGROUND, &osd->screen->black_pixel); + + osd->u.shaped.mapped = 0; + osd->cmap = xcb_generate_id(osd->connection); + xcb_create_colormap(osd->connection, XCB_COLORMAP_ALLOC_NONE, osd->cmap, osd->u.shaped.window, osd->visual); + break; + } + case XCBOSD_COLORKEY: + osd->bitmap = xcb_generate_id(osd->connection); + xcb_create_pixmap(osd->connection, osd->depth, osd->bitmap, osd->window, osd->width, osd->height); + osd->gc = xcb_generate_id(osd->connection); + xcb_create_gc(osd->connection, osd->gc, osd->window, 0, NULL); + osd->cmap = xcb_generate_id(osd->connection); + xcb_create_colormap(osd->connection, XCB_COLORMAP_ALLOC_NONE, osd->cmap, osd->window, osd->visual); + /* FIXME: the expose event doesn't seem to happen? */ + /*XSelectInput (osd->display, osd->window, ExposureMask);*/ + break; + default: + goto error2; + } + + osd->clean = UNDEFINED; + xcbosd_expose(osd); + + xprintf(osd->xine, XINE_VERBOSITY_DEBUG, + _("x11osd: unscaled overlay created (%s mode).\n"), + (mode==XCBOSD_SHAPED) ? "XShape" : "Colorkey" ); + + return osd; + +/* + XFreeGC (osd->display, osd->gc); + XFreeGC (osd->display, osd->mask_gc); + XFreeGC (osd->display, osd->mask_gc_back); +*/ + +error_aftermaskbitmap: + if(mode==XCBOSD_SHAPED) + xcb_free_pixmap(osd->connection, osd->u.shaped.mask_bitmap); +error_window: + if(mode==XCBOSD_SHAPED) + xcb_destroy_window(osd->connection, osd->u.shaped.window); +error2: + free (osd); + return NULL; +} + +void xcbosd_colorkey(xcbosd *osd, uint32_t colorkey, vo_scale_t *scaling) +{ + assert (osd); + assert (osd->mode==XCBOSD_COLORKEY); + + osd->u.colorkey.colorkey=colorkey; + osd->u.colorkey.sc=scaling; + osd->clean = UNDEFINED; + xcbosd_clear(osd); + xcbosd_expose(osd); +} + +void xcbosd_destroy(xcbosd *osd) +{ + + assert (osd); + + xcb_free_gc(osd->connection, osd->gc); + xcb_free_pixmap(osd->connection, osd->bitmap); + xcb_free_colormap(osd->connection, osd->cmap); + if(osd->mode==XCBOSD_SHAPED) { + xcb_free_gc(osd->connection, osd->u.shaped.mask_gc); + xcb_free_gc(osd->connection, osd->u.shaped.mask_gc_back); + xcb_free_pixmap(osd->connection, osd->u.shaped.mask_bitmap); + xcb_destroy_window(osd->connection, osd->u.shaped.window); + } + + free (osd); +} + +void xcbosd_clear(xcbosd *osd) +{ + int i; + + lprintf("clear (state:%d)\n", osd->clean ); + + if( osd->clean != WIPED ) + switch (osd->mode) { + case XCBOSD_SHAPED: { + xcb_rectangle_t rectangle = { 0, 0, osd->width, osd->height }; + xcb_poly_fill_rectangle(osd->connection, osd->u.shaped.mask_bitmap, osd->u.shaped.mask_gc_back, 1, &rectangle); + break; + } + case XCBOSD_COLORKEY: + xcb_change_gc(osd->connection, osd->gc, XCB_GC_FOREGROUND, &osd->u.colorkey.colorkey); + if(osd->u.colorkey.sc) { + xcb_rectangle_t rectangle = { osd->u.colorkey.sc->output_xoffset, osd->u.colorkey.sc->output_yoffset, + osd->u.colorkey.sc->output_width, osd->u.colorkey.sc->output_height }; + xcb_poly_fill_rectangle(osd->connection, osd->bitmap, osd->gc, 1, &rectangle); + xcb_change_gc(osd->connection, osd->gc, XCB_GC_FOREGROUND, &osd->screen->black_pixel); + + xcb_rectangle_t rects[4]; + int rects_count = 0; + + for( i = 0; i < 4; i++ ) { + if( osd->u.colorkey.sc->border[i].w && osd->u.colorkey.sc->border[i].h ) { + rects[rects_count].x = osd->u.colorkey.sc->border[i].x; + rects[rects_count].y = osd->u.colorkey.sc->border[i].y; + rects[rects_count].width = osd->u.colorkey.sc->border[i].w; + rects[rects_count].height = osd->u.colorkey.sc->border[i].h; + rects_count++; + } + + if (rects_count > 0) + xcb_poly_fill_rectangle(osd->connection, osd->bitmap, osd->gc, rects_count, rects); + } + } else { + xcb_rectangle_t rectangle = { 0, 0, osd->width, osd->height }; + xcb_poly_fill_rectangle(osd->connection, osd->bitmap, osd->gc, 1, &rectangle); + } + break; + } + osd->clean = WIPED; +} + +#define TRANSPARENT 0xffffffff + +#define saturate(n, l, u) ((n) < (l) ? (l) : ((n) > (u) ? (u) : (n))) + +void xcbosd_blend(xcbosd *osd, vo_overlay_t *overlay) +{ + xcb_alloc_color_cookie_t alloc_color_cookie; + xcb_alloc_color_reply_t *alloc_color_reply; + + if (osd->clean==UNDEFINED) + xcbosd_clear(osd); /* Workaround. Colorkey mode needs sc data before the clear. */ + + if (overlay->rle) { + int i, x, y, len, width; + int use_clip_palette, max_palette_colour[2]; + uint32_t palette[2][OVL_PALETTE_SIZE]; + + max_palette_colour[0] = -1; + max_palette_colour[1] = -1; + + for (i=0, x=0, y=0; i<overlay->num_rle; i++) { + len = overlay->rle[i].len; + + while (len > 0) { + use_clip_palette = 0; + if (len > overlay->width) { + width = overlay->width; + len -= overlay->width; + } + else { + width = len; + len = 0; + } + if ((y >= overlay->hili_top) && (y <= overlay->hili_bottom) && (x <= overlay->hili_right)) { + if ((x < overlay->hili_left) && (x + width - 1 >= overlay->hili_left)) { + width -= overlay->hili_left - x; + len += overlay->hili_left - x; + } + else if (x > overlay->hili_left) { + use_clip_palette = 1; + if (x + width - 1 > overlay->hili_right) { + width -= overlay->hili_right - x; + len += overlay->hili_right - x; + } + } + } + + if (overlay->rle[i].color > max_palette_colour[use_clip_palette]) { + int j; + clut_t *src_clut; + uint8_t *src_trans; + + if (use_clip_palette) { + src_clut = (clut_t *)&overlay->hili_color; + src_trans = (uint8_t *)&overlay->hili_trans; + } + else { + src_clut = (clut_t *)&overlay->color; + src_trans = (uint8_t *)&overlay->trans; + } + for (j=max_palette_colour[use_clip_palette]+1; j<=overlay->rle[i].color; j++) { + if (src_trans[j]) { + if (1) { + int red, green, blue; + int y, u, v, r, g, b; + + y = saturate(src_clut[j].y, 16, 235); + u = saturate(src_clut[j].cb, 16, 240); + v = saturate(src_clut[j].cr, 16, 240); + y = (9 * y) / 8; + r = y + (25 * v) / 16 - 218; + red = (65536 * saturate(r, 0, 255)) / 256; + g = y + (-13 * v) / 16 + (-25 * u) / 64 + 136; + green = (65536 * saturate(g, 0, 255)) / 256; + b = y + 2 * u - 274; + blue = (65536 * saturate(b, 0, 255)) / 256; + + alloc_color_cookie = xcb_alloc_color(osd->connection, osd->cmap, red, green, blue); + alloc_color_reply = xcb_alloc_color_reply(osd->connection, alloc_color_cookie, NULL); + + palette[use_clip_palette][j] = alloc_color_reply->pixel; + free(alloc_color_reply); + } + else { + if (src_clut[j].y > 127) { + palette[use_clip_palette][j] = osd->screen->white_pixel; + } + else { + palette[use_clip_palette][j] = osd->screen->black_pixel; + } + } + } + else { + palette[use_clip_palette][j] = TRANSPARENT; + } + } + max_palette_colour[use_clip_palette] = overlay->rle[i].color; + } + + if(palette[use_clip_palette][overlay->rle[i].color] != TRANSPARENT) { + xcb_change_gc(osd->connection, osd->gc, XCB_GC_FOREGROUND, &palette[use_clip_palette][overlay->rle[i].color]); + xcb_rectangle_t rectangle = { overlay->x + x, overlay->y + y, width, 1 }; + xcb_poly_fill_rectangle(osd->connection, osd->bitmap, osd->gc, 1, &rectangle); + if(osd->mode==XCBOSD_SHAPED) + xcb_poly_fill_rectangle(osd->connection, osd->u.shaped.mask_bitmap, osd->u.shaped.mask_gc, 1, &rectangle); + } + + x += width; + if (x == overlay->width) { + x = 0; + y++; + } + } + } + osd->clean = DRAWN; + } +} + diff --git a/src/video_out/xcbosd.h b/src/video_out/xcbosd.h new file mode 100644 index 000000000..f948c9baf --- /dev/null +++ b/src/video_out/xcbosd.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2003, 2007 the xine project + * + * This file is part of xine, a free video player. + * + * xine 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. + * + * xine 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * $Id: xcbosd.h,v 1.1 2007/02/15 15:19:33 dgp85 Exp $ + * + * xcbosd.h, use X11 Nonrectangular Window Shape Extension to draw xine OSD + * + * Nov 2003 - Miguel Freitas + * Feb 2007 - ported to xcb by Christoph Pfister + * + * based on ideas and code of + * xosd Copyright (c) 2000 Andre Renaud (andre@ignavus.net) + */ + +#ifndef XCBOSD_H +#define XCBOSD_H + +#include "vo_scale.h" + +typedef struct xcbosd xcbosd; +enum xcbosd_mode {XCBOSD_SHAPED, XCBOSD_COLORKEY}; + +xcbosd *xcbosd_create(xine_t *xine, xcb_connection_t *connection, xcb_screen_t *screen, xcb_window_t window, enum xcbosd_mode mode); + +void xcbosd_colorkey(xcbosd *osd, uint32_t colorkey, vo_scale_t *scaling); + +void xcbosd_destroy(xcbosd *osd); + +void xcbosd_expose(xcbosd *osd); + +void xcbosd_resize(xcbosd *osd, int width, int height); + +void xcbosd_drawable_changed(xcbosd *osd, xcb_window_t window); + +void xcbosd_clear(xcbosd *osd); + +void xcbosd_blend(xcbosd *osd, vo_overlay_t *overlay); + +#endif -- cgit v1.2.3 From 3d21103d1bc98e8198fb52f748c15862d5204a15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 15 Feb 2007 18:26:55 +0000 Subject: Properly repaint the whole surface during expose events. Patch by Christoph Pfister. CVS patchset: 8596 CVS date: 2007/02/15 18:26:55 --- src/video_out/video_out_xcbxv.c | 20 +++++++++++++++++++- src/video_out/video_out_xv.c | 13 ++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/video_out/video_out_xcbxv.c b/src/video_out/video_out_xcbxv.c index 6b8bc3919..bbc9b4adb 100644 --- a/src/video_out/video_out_xcbxv.c +++ b/src/video_out/video_out_xcbxv.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xcbxv.c,v 1.1 2007/02/15 15:19:33 dgp85 Exp $ + * $Id: video_out_xcbxv.c,v 1.2 2007/02/15 18:26:55 dgp85 Exp $ * * video_out_xcbxv.c, X11 video extension interface for xine * @@ -898,6 +898,9 @@ static int xv_gui_data_exchange (vo_driver_t *this_gen, /* XExposeEvent * xev = (XExposeEvent *) data; */ if (this->cur_frame) { + int i; + xcb_rectangle_t rects[4]; + int rects_count = 0; pthread_mutex_lock(&this->main_mutex); @@ -920,6 +923,21 @@ static int xv_gui_data_exchange (vo_driver_t *this_gen, this->cur_frame->xv_data_size, this->cur_frame->image); } + xcb_change_gc(this->connection, this->gc, XCB_GC_FOREGROUND, &this->screen->black_pixel); + + for( i = 0; i < 4; i++ ) { + if( this->sc.border[i].w && this->sc.border[i].h ) { + rects[rects_count].x = this->sc.border[i].x; + rects[rects_count].y = this->sc.border[i].y; + rects[rects_count].width = this->sc.border[i].w; + rects[rects_count].height = this->sc.border[i].h; + rects_count++; + } + } + + if (rects_count > 0) + xcb_poly_fill_rectangle(this->connection, this->window, this->gc, rects_count, rects); + if(this->xoverlay) xcbosd_expose(this->xoverlay); diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index 3dc62920d..75a4a37e2 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xv.c,v 1.221 2006/12/25 15:19:51 dgp85 Exp $ + * $Id: video_out_xv.c,v 1.222 2007/02/15 18:26:55 dgp85 Exp $ * * video_out_xv.c, X11 video extension interface for xine * @@ -953,6 +953,7 @@ static int xv_gui_data_exchange (vo_driver_t *this_gen, /* XExposeEvent * xev = (XExposeEvent *) data; */ if (this->cur_frame) { + int i; LOCK_DISPLAY(this); @@ -972,6 +973,16 @@ static int xv_gui_data_exchange (vo_driver_t *this_gen, this->sc.output_width, this->sc.output_height); } + XSetForeground (this->display, this->gc, this->black.pixel); + + for( i = 0; i < 4; i++ ) { + if( this->sc.border[i].w && this->sc.border[i].h ) { + XFillRectangle(this->display, this->drawable, this->gc, + this->sc.border[i].x, this->sc.border[i].y, + this->sc.border[i].w, this->sc.border[i].h); + } + } + if(this->xoverlay) x11osd_expose(this->xoverlay); -- cgit v1.2.3 From 9c51cd609b52ddb8d55105caa70440385e583837 Mon Sep 17 00:00:00 2001 From: Reinhard Tartler <siretart@tauware.de> Date: Sat, 17 Feb 2007 22:39:26 +0000 Subject: fix ffmpeg includes for sparc, see http://permalink.gmane.org/gmane.comp.video.xine.devel/16362 for details CVS patchset: 8597 CVS date: 2007/02/17 22:39:26 --- src/libffmpeg/libavcodec/sparc/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libffmpeg/libavcodec/sparc/Makefile.am b/src/libffmpeg/libavcodec/sparc/Makefile.am index 4f464e682..c3973f2ea 100644 --- a/src/libffmpeg/libavcodec/sparc/Makefile.am +++ b/src/libffmpeg/libavcodec/sparc/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/misc/Makefile.common -AM_CPPFLAGS = $(LIBFFMPEG_CPPFLAGS) -I$(top_srcdir)/src/libffmpeg/libavutil +AM_CPPFLAGS = $(LIBFFMPEG_CPPFLAGS) -I$(top_srcdir)/src/libffmpeg/libavutil -I$(top_srcdir)/src/libffmpeg AM_CFLAGS = -fno-strict-aliasing ASFLAGS = -- cgit v1.2.3 From f5525b1f3a0a257c8cd7e844144c19fa6f631c28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Mon, 19 Feb 2007 22:22:32 +0000 Subject: Fix building with LOG enabled by changing an the Xlib constant XvPacked into the proper XCB enum. CVS patchset: 8599 CVS date: 2007/02/19 22:22:32 --- src/video_out/video_out_xcbxv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/video_out/video_out_xcbxv.c b/src/video_out/video_out_xcbxv.c index bbc9b4adb..68af4d9bd 100644 --- a/src/video_out/video_out_xcbxv.c +++ b/src/video_out/video_out_xcbxv.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xcbxv.c,v 1.2 2007/02/15 18:26:55 dgp85 Exp $ + * $Id: video_out_xcbxv.c,v 1.3 2007/02/19 22:22:32 dgp85 Exp $ * * video_out_xcbxv.c, X11 video extension interface for xine * @@ -1494,7 +1494,8 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis for (; format_it.rem; xcb_xv_image_format_info_next(&format_it)) { lprintf ("Xv image format: 0x%x (%4.4s) %s\n", format_it.data->id, (char*)&format_it.data->id, - (format_it.data->format == XvPacked) ? "packed" : "planar"); + (format_it.data->format == XCB_XV_IMAGE_FORMAT_INFO_FORMAT_PACKED) + ? "packed" : "planar"); if (format_it.data->id == XINE_IMGFMT_YV12) { this->xv_format_yv12 = format_it.data->id; -- cgit v1.2.3 From 7cb91f8dcbe3b01bfd3516b76ff62de3396f5e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Mon, 19 Feb 2007 23:20:19 +0000 Subject: Fix warning about incompatible pointer type. CVS patchset: 8600 CVS date: 2007/02/19 23:20:19 --- src/xine-engine/xine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index f5583a52f..600169121 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine.c,v 1.340 2006/12/22 16:38:15 klan Exp $ + * $Id: xine.c,v 1.341 2007/02/19 23:20:19 dgp85 Exp $ */ /* @@ -2003,7 +2003,7 @@ void xine_vlog(xine_t *this, int buf, const char *format, this->log_buffers[buf]->scratch_printf(this->log_buffers[buf], format, args); } -const char *const *xine_get_log (xine_t *this, int buf) { +char *const *xine_get_log (xine_t *this, int buf) { if(buf >= XINE_LOG_NUM) return NULL; -- cgit v1.2.3 From 8173333f753f6dbaeffc21fd9425825ab2b659fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Mon, 19 Feb 2007 23:33:33 +0000 Subject: Fix building with LOG enabled. CVS patchset: 8602 CVS date: 2007/02/19 23:33:33 --- src/xine-engine/load_plugins.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 25325aae1..d35eba736 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: load_plugins.c,v 1.229 2007/01/18 23:30:18 dgp85 Exp $ + * $Id: load_plugins.c,v 1.230 2007/02/19 23:33:33 dgp85 Exp $ * * * Load input/demux/audio_out/video_out/codec plugins @@ -1989,18 +1989,19 @@ int _x_decoder_available (xine_t *xine, uint32_t buftype) return 0; } - #ifdef LOG static void _display_file_plugin_list (xine_list_t *list, plugin_file_t *file) { - plugin_node_t *node; + xine_list_iterator_t ite = xine_list_front(list); + + while (ite) { + plugin_node_t *node = xine_list_get_value(list, ite); - node = xine_list_first_content(list); - while (node) { if ((node->file == file) && (node->ref)) { printf(" plugin: %s, class: %p , %d instance(s)\n", node->info->id, node->plugin_class, node->ref); } - node = xine_list_next_content(list); + + ite = xine_list_next(list, ite); } } #endif -- cgit v1.2.3 From 4016687297fc9869847749dddc1e7e04134140a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Mon, 19 Feb 2007 23:34:32 +0000 Subject: Fix the example to actually use an existing function. CVS patchset: 8603 CVS date: 2007/02/19 23:34:32 --- src/xine-utils/list.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-utils/list.h b/src/xine-utils/list.h index 9b9506a84..8273d30f1 100644 --- a/src/xine-utils/list.h +++ b/src/xine-utils/list.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: list.h,v 1.4 2006/09/26 05:19:49 dgp85 Exp $ + * $Id: list.h,v 1.5 2007/02/19 23:34:32 dgp85 Exp $ * * Doubly-linked linked list. * @@ -33,7 +33,7 @@ * xine_list_iterator_t ite = xine_list_front(list); * while (ite) { * _useful code here_ - * ite = xine_list_iterator_next(ite); + * ite = xine_list_next(list, ite); * } * * The list elements are managed using memory chunks and a free list. The first -- cgit v1.2.3 From 828ab12ab770b1258bc89086f3337b497f9268fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Mon, 19 Feb 2007 23:53:40 +0000 Subject: Make the enum functions accept the strict parameter, const char* array rather than char* array. CVS patchset: 8605 CVS date: 2007/02/19 23:53:40 --- src/xine-engine/configfile.c | 4 ++-- src/xine-engine/configfile.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index 5d552f8f1..3a523c936 100644 --- a/src/xine-engine/configfile.c +++ b/src/xine-engine/configfile.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: configfile.c,v 1.82 2006/12/19 19:10:52 dsalt Exp $ + * $Id: configfile.c,v 1.83 2007/02/19 23:53:40 dgp85 Exp $ * * config object (was: file) management - implementation * @@ -717,7 +717,7 @@ static int config_parse_enum (const char *str, char **values) { static int config_register_enum (config_values_t *this, const char *key, int def_value, - char **values, + const char **values, const char *description, const char *help, int exp_level, diff --git a/src/xine-engine/configfile.h b/src/xine-engine/configfile.h index 29413610c..9dd368d5a 100644 --- a/src/xine-engine/configfile.h +++ b/src/xine-engine/configfile.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: configfile.h,v 1.39 2006/12/19 19:10:52 dsalt Exp $ + * $Id: configfile.h,v 1.40 2007/02/19 23:53:40 dgp85 Exp $ * * config file management * @@ -131,7 +131,7 @@ struct config_values_s { int (*register_enum) (config_values_t *self, const char *key, int def_value, - char **values, + const char **values, const char *description, const char *help, int exp_level, -- cgit v1.2.3 From 2802ec520af5d4ef87d2030789f7df7a2a0da0c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Tue, 20 Feb 2007 00:01:19 +0000 Subject: Reduce warnings to one, that seems to be caused by GCC counting compatibility wrong. CVS patchset: 8606 CVS date: 2007/02/20 00:01:19 --- src/xine-engine/configfile.c | 9 +++++---- src/xine-engine/configfile.h | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index 3a523c936..cdbcae4fb 100644 --- a/src/xine-engine/configfile.c +++ b/src/xine-engine/configfile.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: configfile.c,v 1.83 2007/02/19 23:53:40 dgp85 Exp $ + * $Id: configfile.c,v 1.84 2007/02/20 00:01:19 dgp85 Exp $ * * config object (was: file) management - implementation * @@ -689,9 +689,9 @@ static int config_register_range (config_values_t *this, return entry->num_value; } -static int config_parse_enum (const char *str, char **values) { +static int config_parse_enum (const char *str, const char **values) { - char **value; + const char **value; int i; @@ -725,7 +725,8 @@ static int config_register_enum (config_values_t *this, void *cb_data) { cfg_entry_t *entry; - char **value_src, **value_dest; + const char **value_src; + char **value_dest; int value_count; diff --git a/src/xine-engine/configfile.h b/src/xine-engine/configfile.h index 9dd368d5a..3fb1124b4 100644 --- a/src/xine-engine/configfile.h +++ b/src/xine-engine/configfile.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: configfile.h,v 1.40 2007/02/19 23:53:40 dgp85 Exp $ + * $Id: configfile.h,v 1.41 2007/02/20 00:01:19 dgp85 Exp $ * * config file management * @@ -163,7 +163,7 @@ struct config_values_s { void (*update_string) (config_values_t *self, const char *key, const char *value); /* small utility function for enum handling */ - int (*parse_enum) (const char *str, char **values); + int (*parse_enum) (const char *str, const char **values); /* * lookup config entries -- cgit v1.2.3 From 71bd3ff4ab60d4ae510b1d7fb8d0ffe80f8c227d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Tue, 20 Feb 2007 00:04:50 +0000 Subject: Mark speaker arrangement array constant. CVS patchset: 8607 CVS date: 2007/02/20 00:04:50 --- src/audio_out/audio_alsa_out.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index da8b87fc5..24d597d50 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -26,7 +26,7 @@ * (c) 2001 James Courtier-Dutton <James@superbug.demon.co.uk> * * - * $Id: audio_alsa_out.c,v 1.165 2006/09/08 20:40:34 miguelfreitas Exp $ + * $Id: audio_alsa_out.c,v 1.166 2007/02/20 00:04:50 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -1321,7 +1321,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da char *pcm_device; snd_pcm_hw_params_t *params; /* for usability reasons, keep this in sync with audio_oss_out.c */ - static char *speaker_arrangement[] = {"Mono 1.0", "Stereo 2.0", "Headphones 2.0", "Stereo 2.1", + static const char *speaker_arrangement[] = {"Mono 1.0", "Stereo 2.0", "Headphones 2.0", "Stereo 2.1", "Surround 3.0", "Surround 4.0", "Surround 4.1", "Surround 5.0", "Surround 5.1", "Surround 6.0", "Surround 6.1", "Surround 7.1", "Pass Through", NULL}; #define MONO 0 -- cgit v1.2.3 From 780908b7567d712ebd866081760b91abcb03017c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Tue, 20 Feb 2007 00:34:55 +0000 Subject: Fix a lot of format warnings in lprintf calls (mostly %ldd -> %"PRId64"). CVS patchset: 8608 CVS date: 2007/02/20 00:34:55 --- src/demuxers/demux_asf.c | 28 +++++++++++------------ src/demuxers/demux_avi.c | 4 ++-- src/demuxers/demux_elem.c | 6 ++--- src/demuxers/demux_flac.c | 10 ++++----- src/demuxers/demux_flv.c | 10 ++++----- src/demuxers/demux_idcin.c | 6 ++--- src/demuxers/demux_ipmovie.c | 6 ++--- src/demuxers/demux_matroska.c | 4 ++-- src/demuxers/demux_mpeg.c | 4 ++-- src/demuxers/demux_mpeg_block.c | 14 ++++++------ src/demuxers/demux_mpeg_pes.c | 14 ++++++------ src/demuxers/demux_mpgaudio.c | 20 ++++++++--------- src/demuxers/demux_ogg.c | 4 ++-- src/demuxers/demux_real.c | 16 ++++++------- src/input/input_http.c | 8 +++---- src/input/input_mms.c | 10 ++++----- src/input/input_pnm.c | 6 ++--- src/input/input_rtsp.c | 8 +++---- src/input/input_stdin_fifo.c | 10 ++++----- src/input/mms.c | 4 ++-- src/liba52/xine_decoder.c | 4 ++-- src/libdts/xine_decoder.c | 4 ++-- src/libfaad/xine_decoder.c | 8 +++---- src/libreal/audio_decoder.c | 4 ++-- src/libreal/xine_decoder.c | 8 +++---- src/libsputext/xine_decoder.c | 4 ++-- src/xine-engine/audio_decoder.c | 4 ++-- src/xine-engine/input_cache.c | 8 +++---- src/xine-engine/input_rip.c | 50 ++++++++++++++++++++--------------------- src/xine-engine/metronom.c | 6 ++--- src/xine-engine/osd.c | 4 ++-- src/xine-engine/video_decoder.c | 4 ++-- 32 files changed, 150 insertions(+), 150 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index bd48d9466..067889ad5 100644 --- a/src/demuxers/demux_asf.c +++ b/src/demuxers/demux_asf.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_asf.c,v 1.192 2007/01/19 01:05:24 dgp85 Exp $ + * $Id: demux_asf.c,v 1.193 2007/02/20 00:34:55 dgp85 Exp $ * * demultiplexer for asf streams * @@ -641,15 +641,15 @@ static void check_newpts (demux_asf_t *this, int64_t pts, int video, int frame_e #ifdef LOG if (pts) { if (video) { - printf ("demux_asf: VIDEO: pts = %8lld, diff = %8lld\n", pts, pts - this->last_pts[video]); + printf ("demux_asf: VIDEO: pts = %8"PRId64", diff = %8"PRId64"\n", pts, pts - this->last_pts[video]); } else { - printf ("demux_asf: AUDIO: pts = %8lld, diff = %8lld\n", pts, pts - this->last_pts[video]); + printf ("demux_asf: AUDIO: pts = %8"PRId64", diff = %8"PRId64"\n", pts, pts - this->last_pts[video]); } } #endif if (pts && (this->send_newpts || (this->last_pts[video] && abs(diff) > WRAP_THRESHOLD))) { - lprintf ("sending newpts %lld (video = %d diff = %lld)\n", pts, video, diff); + lprintf ("sending newpts %"PRId64" (video = %d diff = %"PRId64")\n", pts, video, diff); if (this->buf_flag_seek) { _x_demux_control_newpts(this->stream, pts, BUF_FLAG_SEEK); @@ -676,7 +676,7 @@ static void asf_send_buffer_nodefrag (demux_asf_t *this, asf_demux_stream_t *str int bufsize; int package_done; - lprintf ("pts=%lld, off=%d, len=%d, total=%d\n", + lprintf ("pts=%"PRId64", off=%d, len=%d, total=%d\n", timestamp * 90, frag_offset, frag_len, stream->payload_size); if (frag_offset == 0) { @@ -760,7 +760,7 @@ static void asf_send_buffer_defrag (demux_asf_t *this, asf_demux_stream_t *strea printf("asf_send_buffer seq=%d frag_offset=%d frag_len=%d\n", seq, frag_offset, frag_len ); */ - lprintf ("asf_send_buffer_defrag: timestamp=%lld, pts=%lld\n", timestamp, timestamp * 90); + lprintf ("asf_send_buffer_defrag: timestamp=%"PRId64", pts=%"PRId64"\n", timestamp, timestamp * 90); if (frag_offset == 0) { /* new packet */ @@ -866,11 +866,11 @@ static int asf_parse_packet_align(demux_asf_t *this) { /* check packet_count */ packet_num = (packet_pos - this->first_packet_pos) / this->packet_size; - lprintf("packet_num=%lld, packet_count=%lld\n", packet_num, this->packet_count); + lprintf("packet_num=%"PRId64", packet_count=%"PRId64"\n", packet_num, this->packet_count); if (packet_num >= this->packet_count) { /* end of payload data */ current_pos = this->input->get_current_pos (this->input); - lprintf("end of payload data, current_pos=%lld\n", current_pos); + lprintf("end of payload data, current_pos=%"PRId64"\n", current_pos); { /* check new asf header */ if (get_guid(this) == GUID_ASF_HEADER) { @@ -1000,7 +1000,7 @@ static int asf_parse_packet_payload_header(demux_asf_t *this, uint32_t p_hdr_siz timestamp = get_le32(this); p_hdr_size += 4; duration = get_le16(this); p_hdr_size += 2; - lprintf ("timestamp=%lld, duration=%lld\n", timestamp, duration); + lprintf ("timestamp=%"PRId64", duration=%"PRId64"\n", timestamp, duration); if ((this->packet_len_flags >> 5) & 3) { /* absolute data size */ @@ -1790,7 +1790,7 @@ static int demux_asf_seek (demux_plugin_t *this_gen, int i, state; int64_t ts; - lprintf ("demux_asf_seek: start_pos=%lld, start_time=%d\n", + lprintf ("demux_asf_seek: start_pos=%"PRId64", start_time=%d\n", start_pos, start_time); this->status = DEMUX_OK; @@ -1911,13 +1911,13 @@ static int demux_asf_seek (demux_plugin_t *this_gen, } state = 1; /* search an audio packet with pts < this->keyframe_pts */ - lprintf ("demux_asf_seek: keyframe found at %lld, timestamp = %lld\n", start_pos, ts); + lprintf ("demux_asf_seek: keyframe found at %"PRId64", timestamp = %"PRId64"\n", start_pos, ts); check_newpts (this, ts * 90, 1, 0); } } else if (state == 1) { if ((this->audio_stream != -1 && stream_id == this->asf_header->streams[this->audio_stream]->stream_number) && ts && (ts <= this->keyframe_ts)) { - lprintf ("demux_asf_seek: audio packet found at %lld, ts = %lld\n", start_pos, ts); + lprintf ("demux_asf_seek: audio packet found at %"PRId64", ts = %"PRId64"\n", start_pos, ts); state = 5; /* end */ break; @@ -1928,7 +1928,7 @@ static int demux_asf_seek (demux_plugin_t *this_gen, this->keyframe_ts = ts; state = 5; /* end */ - lprintf ("demux_asf_seek: audio packet found at %lld, timestamp = %lld\n", start_pos, ts); + lprintf ("demux_asf_seek: audio packet found at %"PRId64", timestamp = %"PRId64"\n", start_pos, ts); check_newpts (this, ts * 90, 0, 0); } } @@ -1942,7 +1942,7 @@ static int demux_asf_seek (demux_plugin_t *this_gen, } else { this->input->seek (this->input, start_pos + this->packet_size, SEEK_SET); } - lprintf ("demux_asf_seek: keyframe_found=%d, keyframe_ts=%lld\n", + lprintf ("demux_asf_seek: keyframe_found=%d, keyframe_ts=%"PRId64"\n", this->keyframe_found, this->keyframe_ts); if (this->video_stream >= 0) { this->streams[this->video_stream].resync = 1; diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index e0ed1a915..86af5eec5 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_avi.c,v 1.229 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_avi.c,v 1.230 2007/02/20 00:34:55 dgp85 Exp $ * * demultiplexer for avi streams * @@ -1392,7 +1392,7 @@ static avi_t *AVI_init(demux_avi_t *this) { AVI->video_posf = 0; AVI->video_posb = 0; - lprintf("done, pos=%lld, AVI->movi_start=%" PRIdMAX "\n", this->input->get_current_pos(this->input), (intmax_t)AVI->movi_start); + lprintf("done, pos=%"PRId64", AVI->movi_start=%" PRIdMAX "\n", this->input->get_current_pos(this->input), (intmax_t)AVI->movi_start); return AVI; } diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c index f0bfe4c16..be86b32ed 100644 --- a/src/demuxers/demux_elem.c +++ b/src/demuxers/demux_elem.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_elem.c,v 1.90 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_elem.c,v 1.91 2007/02/20 00:34:55 dgp85 Exp $ * * demultiplexer for elementary mpeg streams */ @@ -73,7 +73,7 @@ static int demux_mpeg_elem_next (demux_mpeg_elem_t *this, int preview_mode) { buf = this->video_fifo->buffer_pool_alloc(this->video_fifo); blocksize = (this->blocksize ? this->blocksize : buf->max_size); done = this->input->read(this->input, buf->mem, blocksize); - lprintf ("read size = %lld\n", done); + lprintf ("read size = %"PRId64"\n", done); if (done <= 0) { buf->free_buffer (buf); @@ -160,7 +160,7 @@ static int demux_mpeg_elem_seek (demux_plugin_t *this_gen, this->status = DEMUX_FINISHED; return this->status; } - lprintf ("seeking to %lld\n", start_pos); + lprintf ("seeking to %"PRId64"\n", start_pos); } /* diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c index 0af3ef8f4..ce6f30165 100644 --- a/src/demuxers/demux_flac.c +++ b/src/demuxers/demux_flac.c @@ -23,7 +23,7 @@ * For more information on the FLAC file format, visit: * http://flac.sourceforge.net/ * - * $Id: demux_flac.c,v 1.13 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_flac.c,v 1.14 2007/02/20 00:34:55 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -166,7 +166,7 @@ static int open_flac_file(demux_flac_t *flac) { flac->bits_per_sample = ((flac->sample_rate >> 4) & 0x1F) + 1; flac->sample_rate >>= 12; flac->total_samples = BE_64(&streaminfo[10]) & UINT64_C(0x0FFFFFFFFF); /* 36 bits */ - lprintf ("%d Hz, %d bits, %d channels, %lld total samples\n", + lprintf ("%d Hz, %d bits, %d channels, %"PRId64" total samples\n", flac->sample_rate, flac->bits_per_sample, flac->channels, flac->total_samples); break; @@ -193,15 +193,15 @@ static int open_flac_file(demux_flac_t *flac) { if (flac->input->read(flac->input, buffer, FLAC_SEEKPOINT_SIZE) != FLAC_SEEKPOINT_SIZE) return 0; flac->seekpoints[i].sample_number = BE_64(&buffer[0]); - lprintf (" %d: sample %lld, ", i, flac->seekpoints[i].sample_number); + lprintf (" %d: sample %"PRId64", ", i, flac->seekpoints[i].sample_number); flac->seekpoints[i].offset = BE_64(&buffer[8]); flac->seekpoints[i].size = BE_16(&buffer[16]); - lprintf ("@ 0x%llX, size = %d bytes, ", + lprintf ("@ 0x%"PRIX64", size = %d bytes, ", flac->seekpoints[i].offset, flac->seekpoints[i].size); flac->seekpoints[i].pts = flac->seekpoints[i].sample_number; flac->seekpoints[i].pts *= 90000; flac->seekpoints[i].pts /= flac->sample_rate; - lprintf ("pts = %lld\n", flac->seekpoints[i].pts); + lprintf ("pts = %"PRId64"\n", flac->seekpoints[i].pts); } break; diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 129fb40fb..9efe1b182 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -26,7 +26,7 @@ * For more information on the FLV file format, visit: * http://download.macromedia.com/pub/flash/flash_file_format_specification.pdf * - * $Id: demux_flv.c,v 1.18 2007/01/22 17:07:08 klan Exp $ + * $Id: demux_flv.c,v 1.19 2007/02/20 00:34:55 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -138,10 +138,10 @@ static void check_newpts(demux_flv_t *this, int64_t pts, int video) { int64_t diff; diff = pts - this->last_pts[video]; - lprintf ("check_newpts %lld\n", pts); + lprintf ("check_newpts %"PRId64"\n", pts); if (pts && (this->send_newpts || (this->last_pts[video] && abs(diff)>WRAP_THRESHOLD))) { - lprintf ("diff=%lld\n", diff); + lprintf ("diff=%"PRId64"\n", diff); if (this->buf_flag_seek) { _x_demux_control_newpts(this->stream, pts, BUF_FLAG_SEEK); @@ -303,7 +303,7 @@ static int parse_flv_var(demux_flv_t *this, unsigned char *buf, int size, char * } break; case FLV_DATA_TYPE_DATE: - lprintf(" got date (%lld, %d)\n", BE_64(tmp), BE_16(tmp+8)); + lprintf(" got date (%"PRId64", %d)\n", BE_64(tmp), BE_16(tmp+8)); tmp += 10; break; default: @@ -358,7 +358,7 @@ static int read_flv_packet(demux_flv_t *this) { remaining_bytes = BE_24(&buffer[1]); pts = BE_24(&buffer[4]) | (buffer[7] << 24); - lprintf(" tag_type = 0x%02X, 0x%X bytes, pts %lld\n", + lprintf(" tag_type = 0x%02X, 0x%X bytes, pts %"PRId64"\n", tag_type, remaining_bytes, pts/90); switch (tag_type) { diff --git a/src/demuxers/demux_idcin.c b/src/demuxers/demux_idcin.c index 8397e3e6d..461771425 100644 --- a/src/demuxers/demux_idcin.c +++ b/src/demuxers/demux_idcin.c @@ -65,7 +65,7 @@ * - if any bytes exceed 63, do not shift the bytes at all before * transmitting them to the video decoder * - * $Id: demux_idcin.c,v 1.54 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_idcin.c,v 1.55 2007/02/20 00:34:55 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -222,7 +222,7 @@ static int demux_idcin_send_chunk(demux_plugin_t *this_gen) { if (!remaining_sample_bytes) buf->decoder_flags |= BUF_FLAG_FRAME_END; - lprintf("sending video buf with %d bytes, %lld pts\n", buf->size, buf->pts); + lprintf("sending video buf with %d bytes, %"PRId64" pts\n", buf->size, buf->pts); this->video_fifo->put(this->video_fifo, buf); } @@ -263,7 +263,7 @@ static int demux_idcin_send_chunk(demux_plugin_t *this_gen) { if (!remaining_sample_bytes) buf->decoder_flags |= BUF_FLAG_FRAME_END; - lprintf("sending audio buf with %d bytes, %lld pts\n", buf->size, buf->pts); + lprintf("sending audio buf with %d bytes, %"PRId64" pts\n", buf->size, buf->pts); this->audio_fifo->put(this->audio_fifo, buf); } } diff --git a/src/demuxers/demux_ipmovie.c b/src/demuxers/demux_ipmovie.c index 992612f62..6fe185b1a 100644 --- a/src/demuxers/demux_ipmovie.c +++ b/src/demuxers/demux_ipmovie.c @@ -23,7 +23,7 @@ * For more information regarding the Interplay MVE file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_ipmovie.c,v 1.26 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_ipmovie.c,v 1.27 2007/02/20 00:34:55 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -326,7 +326,7 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { audio_pts *= this->audio_frame_count; audio_pts /= this->wave.nSamplesPerSec; - lprintf("sending audio frame with pts %lld (%d audio frames)\n", + lprintf("sending audio frame with pts %"PRId64" (%d audio frames)\n", audio_pts, this->audio_frame_count); if(this->audio_fifo) { @@ -432,7 +432,7 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { lprintf("set video data\n"); current_file_pos = this->input->get_current_pos(this->input); - lprintf("sending video data with pts %lld\n", + lprintf("sending video data with pts %"PRId64"\n", this->video_pts); /* send off any new palette data */ diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index 39b887d54..3cc36942a 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_matroska.c,v 1.51 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_matroska.c,v 1.52 2007/02/20 00:34:55 dgp85 Exp $ * * demultiplexer for matroska streams * @@ -1257,7 +1257,7 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { if (!ebml_read_uint(ebml, &elem, &val)) return 0; track->default_duration = val; - lprintf("Default Duration: %lld\n", track->default_duration); + lprintf("Default Duration: %"PRIu64"\n", track->default_duration); } break; diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c index 1ed0addcf..c9d49efa2 100644 --- a/src/demuxers/demux_mpeg.c +++ b/src/demuxers/demux_mpeg.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_mpeg.c,v 1.151 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_mpeg.c,v 1.152 2007/02/20 00:34:55 dgp85 Exp $ * * demultiplexer for mpeg 1/2 program streams * reads streams of variable blocksizes @@ -310,7 +310,7 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr) check_newpts( this, this->pts, PTS_VIDEO ); */ this->video_fifo->put (this->video_fifo, buf); - lprintf ("SPU SVCD PACK (pts: %lld, spu id: %d) put on FIFO\n", + lprintf ("SPU SVCD PACK (pts: %"PRId64", spu id: %d) put on FIFO\n", buf->pts, spu_id); return; diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index e149e027a..7083d33d9 100644 --- a/src/demuxers/demux_mpeg_block.c +++ b/src/demuxers/demux_mpeg_block.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpeg_block.c,v 1.219 2007/01/19 01:05:24 dgp85 Exp $ + * $Id: demux_mpeg_block.c,v 1.220 2007/02/20 00:34:55 dgp85 Exp $ * * demultiplexer for mpeg 1/2 program streams * used with fixed blocksize devices (like dvd/vcd) @@ -458,7 +458,7 @@ static int32_t parse_program_stream_pack_header(demux_mpeg_block_t *this, uint8_ this->scr += ( (p[8] & 0x03 << 7) | (p[9] & 0xFE >> 1) ); */ - lprintf ("SCR=%lld\n", this->scr); + lprintf ("SCR=%"PRId64"\n", this->scr); /* mux_rate */ @@ -525,7 +525,7 @@ static int32_t parse_private_stream_2(demux_mpeg_block_t *this, uint8_t *p, buf_ this->last_begin_time = buf->extra_info->input_time; } - lprintf ("NAV packet, start pts = %lld, end_pts = %lld\n", + lprintf ("NAV packet, start pts = %"PRId64", end_pts = %"PRId64"\n", start_pts, end_pts); if (this->nav_last_end_pts != start_pts && !this->preview_mode) { @@ -664,7 +664,7 @@ static int32_t parse_pes_for_pts(demux_mpeg_block_t *this, uint8_t *p, buf_eleme this->pts |= p[12] << 7 ; this->pts |= (p[13] & 0xFE) >> 1 ; - lprintf ("pts = %lld\n", this->pts); + lprintf ("pts = %"PRId64"\n", this->pts); } else this->pts = 0; @@ -731,7 +731,7 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_ check_newpts( this, this->pts, PTS_VIDEO ); */ this->video_fifo->put (this->video_fifo, buf); - lprintf ("SPU SVCD PACK (%lld, %d) put on fifo\n", this->pts, spu_id); + lprintf ("SPU SVCD PACK (%"PRId64", %d) put on fifo\n", this->pts, spu_id); return -1; } @@ -749,7 +749,7 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_ check_newpts( this, this->pts, PTS_VIDEO ); */ this->video_fifo->put (this->video_fifo, buf); - lprintf ("SPU CVD PACK (%lld, %d) put on fifo\n", this->pts, spu_id); + lprintf ("SPU CVD PACK (%"PRId64", %d) put on fifo\n", this->pts, spu_id); return -1; } @@ -1146,7 +1146,7 @@ static int demux_mpeg_block_estimate_rate (demux_mpeg_block_t *this) { count ++; /* - printf ("demux_mpeg_block: stream_id %02x, pos: %lld, pts: %d, cur_rate = %d, overall rate : %d\n", + printf ("demux_mpeg_block: stream_id %02x, pos: %"PRId64", pts: %d, cur_rate = %d, overall rate : %d\n", stream_id, pos, pts, cur_rate, rate); */ } diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c index 0e0a3501d..3eceb8fa7 100644 --- a/src/demuxers/demux_mpeg_pes.c +++ b/src/demuxers/demux_mpeg_pes.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpeg_pes.c,v 1.39 2007/01/19 01:05:24 dgp85 Exp $ + * $Id: demux_mpeg_pes.c,v 1.40 2007/02/20 00:34:56 dgp85 Exp $ * * demultiplexer for mpeg 2 PES (Packetized Elementary Streams) * reads streams of variable blocksizes @@ -572,7 +572,7 @@ static int32_t parse_program_stream_pack_header(demux_mpeg_pes_t *this, uint8_t this->scr += ( (p[8] & 0x03 << 7) | (p[9] & 0xFE >> 1) ); */ - lprintf ("SCR=%lld\n", this->scr); + lprintf ("SCR=%"PRId64"\n", this->scr); /* mux_rate */ @@ -649,7 +649,7 @@ static int32_t parse_private_stream_2(demux_mpeg_pes_t *this, uint8_t *p, buf_el this->last_begin_time = buf->extra_info->input_time; } - lprintf ("NAV packet, start pts = %lld, end_pts = %lld\n", + lprintf ("NAV packet, start pts = %"PRId64", end_pts = %"PRId64"\n", start_pts, end_pts); if (this->nav_last_end_pts != start_pts && !this->preview_mode) { @@ -795,7 +795,7 @@ static int32_t parse_pes_for_pts(demux_mpeg_pes_t *this, uint8_t *p, buf_element this->pts |= (int64_t) p[12] << 7 ; this->pts |= (int64_t) (p[13] & 0xFE) >> 1 ; - lprintf ("pts = %lld\n", this->pts); + lprintf ("pts = %"PRId64"\n", this->pts); } else this->pts = 0; @@ -862,7 +862,7 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el check_newpts( this, this->pts, PTS_VIDEO ); */ this->video_fifo->put (this->video_fifo, buf); - lprintf ("SPU SVCD PACK (%lld, %d) put on fifo\n", this->pts, spu_id); + lprintf ("SPU SVCD PACK (%"PRId64", %d) put on fifo\n", this->pts, spu_id); return this->packet_len + result; } @@ -880,7 +880,7 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el check_newpts( this, this->pts, PTS_VIDEO ); */ this->video_fifo->put (this->video_fifo, buf); - lprintf ("SPU CVD PACK (%lld, %d) put on fifo\n", this->pts, spu_id); + lprintf ("SPU CVD PACK (%"PRId64", %d) put on fifo\n", this->pts, spu_id); return this->packet_len + result; } @@ -1283,7 +1283,7 @@ static int demux_mpeg_pes_estimate_rate (demux_mpeg_pes_t *this) { count ++; /* - printf ("demux_mpeg_pes: stream_id %02x, pos: %lld, pts: %d, cur_rate = %d, overall rate : %d\n", + printf ("demux_mpeg_pes: stream_id %02x, pos: %"PRId64", pts: %d, cur_rate = %d, overall rate : %d\n", stream_id, pos, pts, cur_rate, rate); */ } diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 346ed4093..452c53703 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpgaudio.c,v 1.147 2007/02/03 23:56:32 dsalt Exp $ + * $Id: demux_mpgaudio.c,v 1.148 2007/02/20 00:34:56 dgp85 Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -437,7 +437,7 @@ static vbri_header_t* parse_vbri_header(mpg_audio_frame_t *frame, for (i = 0; i <= vbri->toc_entries; i++) { toc_stream_size += vbri->toc[i]; } - lprintf("stream size from toc: %lld\n", toc_stream_size); + lprintf("stream size from toc: %"PRId64"\n", toc_stream_size); } return vbri; @@ -460,7 +460,7 @@ static int parse_frame_payload(demux_mpgaudio_t *this, uint64_t pts = 0; frame_pos = this->input->get_current_pos(this->input) - 4; - lprintf("frame_pos = %lld\n", frame_pos); + lprintf("frame_pos = %"PRId64"\n", frame_pos); buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); @@ -510,7 +510,7 @@ static int parse_frame_payload(demux_mpgaudio_t *this, buf->decoder_flags = decoder_flags|BUF_FLAG_FRAME_END; this->audio_fifo->put(this->audio_fifo, buf); - lprintf("send buffer: pts=%lld\n", pts); + lprintf("send buffer: pts=%"PRId64"\n", pts); this->cur_time += this->cur_frame.duration; return 1; } @@ -823,9 +823,9 @@ static void demux_mpgaudio_send_headers (demux_plugin_t *this_gen) { _x_stream_info_set(this->stream, XINE_STREAM_INFO_BITRATE, this->br); _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, this->br); - lprintf("frame_start: %lld, frame_end: %lld\n", + lprintf("frame_start: %"PRId64", frame_end: %"PRId64"\n", this->mpg_frame_start, this->mpg_frame_end); - lprintf("stream size: %lld, mp3 size: %lld\n", + lprintf("stream size: %"PRId64", mp3 size: %"PRId64"\n", this->input->get_length(this->input), this->mpg_size); lprintf("stream_length: %d ms\n", this->stream_length); @@ -939,7 +939,7 @@ static int demux_mpgaudio_seek (demux_plugin_t *this_gen, /* Convert position seek to time seek */ if (!start_time) { start_time = (int)((double)start_pos * (double)this->stream_length / 65535.0f); - lprintf("position seek: start_pos=%lld => start_time=%d\n", start_pos, start_time); + lprintf("position seek: start_pos=%"PRId64" => start_time=%d\n", start_pos, start_time); } if (start_time < 0) @@ -951,14 +951,14 @@ static int demux_mpgaudio_seek (demux_plugin_t *this_gen, if (this->xing_header && (this->xing_header->flags & (XING_TOC_FLAG | XING_BYTES_FLAG))) { seek_pos += xing_get_seek_point(this->xing_header, start_time, this->stream_length); - lprintf("time seek: xing: time=%d, pos=%lld\n", start_time, seek_pos); + lprintf("time seek: xing: time=%d, pos=%"PRId64"\n", start_time, seek_pos); } else if (this->vbri_header) { seek_pos += vbri_get_seek_point(this->vbri_header, start_time, this->stream_length); - lprintf("time seek: vbri: time=%d, pos=%lld\n", start_time, seek_pos); + lprintf("time seek: vbri: time=%d, pos=%"PRId64"\n", start_time, seek_pos); } else { /* cbr */ seek_pos += ((double)start_time / 1000.0) * ((double)this->br / 8.0); - lprintf("time seek: cbr: time=%d, pos=%lld\n", start_time, seek_pos); + lprintf("time seek: cbr: time=%d, pos=%"PRId64"\n", start_time, seek_pos); } } /* assume seeking is always perfect... */ diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index 59ede919b..f35ce7935 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_ogg.c,v 1.175 2007/02/08 02:40:22 dsalt Exp $ + * $Id: demux_ogg.c,v 1.176 2007/02/20 00:34:56 dgp85 Exp $ * * demultiplexer for ogg streams * @@ -718,7 +718,7 @@ static void send_ogg_buf (demux_ogg_t *this, buf->size = 12 + op->bytes + 1; - lprintf ("CMML stream %d (bytes=%ld): PTS %lld: %s\n", + lprintf ("CMML stream %d (bytes=%ld): PTS %"PRId64": %s\n", stream_num, op->bytes, buf->pts, str); this->video_fifo->put (this->video_fifo, buf); diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index f15eb8840..11b0dbf38 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -31,7 +31,7 @@ * * Based on FFmpeg's libav/rm.c. * - * $Id: demux_real.c,v 1.112 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_real.c,v 1.113 2007/02/20 00:34:56 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -181,7 +181,7 @@ static void real_parse_index(demux_real_t *this) { real_index_entry_t **index; while(next_index_chunk) { - lprintf("reading index chunk at %llX\n", next_index_chunk); + lprintf("reading index chunk at %"PRIX64"\n", next_index_chunk); /* Seek to index chunk */ this->input->seek(this->input, next_index_chunk, SEEK_SET); @@ -401,9 +401,9 @@ static void real_parse_headers (demux_real_t *this) { this->avg_bitrate = BE_32(&chunk_buffer[6]); lprintf("PROP: duration: %d ms\n", this->duration); - lprintf("PROP: index start: %llX\n", this->index_start); - lprintf("PROP: data start: %llX\n", this->data_start); - lprintf("PROP: average bit rate: %lld\n", this->avg_bitrate); + lprintf("PROP: index start: %"PRIX64"\n", this->index_start); + lprintf("PROP: data start: %"PRIX64"\n", this->data_start); + lprintf("PROP: average bit rate: %"PRId64"\n", this->avg_bitrate); if (this->avg_bitrate<1) this->avg_bitrate = 1; @@ -854,12 +854,12 @@ static void check_newpts (demux_real_t *this, int64_t pts, int video, int previe int64_t diff; diff = pts - this->last_pts[video]; - lprintf ("check_newpts %lld\n", pts); + lprintf ("check_newpts %"PRId64"\n", pts); if (!preview && pts && (this->send_newpts || (this->last_pts[video] && abs(diff)>WRAP_THRESHOLD) ) ) { - lprintf ("diff=%lld\n", diff); + lprintf ("diff=%"PRId64"\n", diff); if (this->buf_flag_seek) { _x_demux_control_newpts(this->stream, pts, BUF_FLAG_SEEK); @@ -1012,7 +1012,7 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { size--; } - lprintf ("packet of stream %d, 0x%X bytes @ %llX, pts = %lld%s\n", + lprintf ("packet of stream %d, 0x%X bytes @ %"PRIX64", pts = %"PRId64"%s\n", stream, size, offset, pts, keyframe ? ", keyframe" : ""); if (this->video_stream && (stream == this->video_stream->mdpr->stream_number)) { diff --git a/src/input/input_http.c b/src/input/input_http.c index 8555e3bc8..a9bcee0d5 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -19,7 +19,7 @@ * * input plugin for http network streams * - * $Id: input_http.c,v 1.127 2007/01/19 01:05:25 dgp85 Exp $ + * $Id: input_http.c,v 1.128 2007/02/20 00:34:56 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -363,7 +363,7 @@ static off_t http_plugin_read_int (http_input_plugin_t *this, int read_bytes = 0; int nlen; - lprintf("total=%lld\n", total); + lprintf("total=%"PRId64"\n", total); while (total) { nlen = total; if (this->shoutcast_mode && @@ -415,7 +415,7 @@ static off_t http_plugin_read (input_plugin_t *this_gen, else n = nlen; - lprintf ("%lld bytes from preview (which has %lld bytes)\n", n, this->preview_size); + lprintf ("%"PRId64" bytes from preview (which has %"PRId64" bytes)\n", n, this->preview_size); memcpy (buf, &this->preview[this->curpos], n); num_bytes += n; @@ -942,7 +942,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { return -12; } - lprintf("preview_size=%lld\n", this->preview_size); + lprintf("preview_size=%"PRId64"\n", this->preview_size); this->curpos = 0; return 1; diff --git a/src/input/input_mms.c b/src/input/input_mms.c index 52a0d4bab..758ad770d 100644 --- a/src/input/input_mms.c +++ b/src/input/input_mms.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_mms.c,v 1.68 2007/01/19 01:05:25 dgp85 Exp $ + * $Id: input_mms.c,v 1.69 2007/02/20 00:34:56 dgp85 Exp $ * * mms input plugin based on work from major mms */ @@ -102,7 +102,7 @@ static off_t mms_plugin_read (input_plugin_t *this_gen, mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; off_t n = 0; - lprintf ("mms_plugin_read: %lld bytes ...\n", len); + lprintf ("mms_plugin_read: %"PRId64" bytes ...\n", len); switch (this->protocol) { case PROTOCOL_MMST: @@ -122,7 +122,7 @@ static buf_element_t *mms_plugin_read_block (input_plugin_t *this_gen, buf_element_t *buf = fifo->buffer_pool_alloc (fifo); int total_bytes; - lprintf ("mms_plugin_read_block: %lld bytes...\n", todo); + lprintf ("mms_plugin_read_block: %"PRId64" bytes...\n", todo); buf->content = buf->mem; buf->type = BUF_DEMUX_BLOCK; @@ -144,7 +144,7 @@ static off_t mms_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin off_t dest = 0; off_t curpos = 0; - lprintf ("mms_plugin_seek: %lld offset, %d origin...\n", offset, origin); + lprintf ("mms_plugin_seek: %"PRId64" offset, %d origin...\n", offset, origin); switch (this->protocol) { @@ -239,7 +239,7 @@ static off_t mms_plugin_get_length (input_plugin_t *this_gen) { break; } - lprintf ("length is %lld\n", length); + lprintf ("length is %"PRId64"\n", length); return length; diff --git a/src/input/input_pnm.c b/src/input/input_pnm.c index af860ac1e..e1413b0f7 100644 --- a/src/input/input_pnm.c +++ b/src/input/input_pnm.c @@ -80,7 +80,7 @@ static off_t pnm_plugin_read (input_plugin_t *this_gen, pnm_input_plugin_t *this = (pnm_input_plugin_t *) this_gen; off_t n; - lprintf ("pnm_plugin_read: %lld bytes ...\n", len); + lprintf ("pnm_plugin_read: %"PRId64" bytes ...\n", len); nbc_check_buffers (this->nbc); @@ -96,7 +96,7 @@ static buf_element_t *pnm_plugin_read_block (input_plugin_t *this_gen, buf_element_t *buf = fifo->buffer_pool_alloc (fifo); int total_bytes; - lprintf ("pnm_plugin_read_block: %lld bytes...\n", todo); + lprintf ("pnm_plugin_read_block: %"PRId64" bytes...\n", todo); buf->content = buf->mem; buf->type = BUF_DEMUX_BLOCK; @@ -156,7 +156,7 @@ static off_t pnm_plugin_get_current_pos (input_plugin_t *this_gen){ pnm_input_plugin_t *this = (pnm_input_plugin_t *) this_gen; /* - printf ("current pos is %lld\n", this->curpos); + printf ("current pos is %"PRId64"\n", this->curpos); */ return this->curpos; diff --git a/src/input/input_rtsp.c b/src/input/input_rtsp.c index c23c761cc..693e8af66 100644 --- a/src/input/input_rtsp.c +++ b/src/input/input_rtsp.c @@ -81,7 +81,7 @@ static off_t rtsp_plugin_read (input_plugin_t *this_gen, rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; off_t n; - lprintf ("rtsp_plugin_read: %lld bytes ...\n", len); + lprintf ("rtsp_plugin_read: %"PRId64" bytes ...\n", len); nbc_check_buffers (this->nbc); @@ -97,7 +97,7 @@ static buf_element_t *rtsp_plugin_read_block (input_plugin_t *this_gen, buf_element_t *buf = fifo->buffer_pool_alloc (fifo); int total_bytes; - lprintf ("rtsp_plugin_read_block: %lld bytes...\n", todo); + lprintf ("rtsp_plugin_read_block: %"PRId64" bytes...\n", todo); buf->content = buf->mem; buf->type = BUF_DEMUX_BLOCK; @@ -118,7 +118,7 @@ static off_t rtsp_plugin_seek (input_plugin_t *this_gen, off_t offset, int origi rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; - lprintf ("seek %lld bytes, origin %d\n", offset, origin); + lprintf ("seek %"PRId64" bytes, origin %d\n", offset, origin); /* only realtive forward-seeking is implemented */ @@ -168,7 +168,7 @@ static off_t rtsp_plugin_get_current_pos (input_plugin_t *this_gen){ rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; /* - printf ("current pos is %lld\n", this->curpos); + printf ("current pos is %"PRId64"\n", this->curpos); */ return this->curpos; diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c index 654e5d1a2..939f56f25 100644 --- a/src/input/input_stdin_fifo.c +++ b/src/input/input_stdin_fifo.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_stdin_fifo.c,v 1.69 2007/01/19 01:05:25 dgp85 Exp $ + * $Id: input_stdin_fifo.c,v 1.70 2007/02/20 00:34:56 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -86,14 +86,14 @@ static off_t stdin_plugin_read (input_plugin_t *this_gen, stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen; off_t n, total; - lprintf ("reading %lld bytes...\n", len); + lprintf ("reading %"PRId64" bytes...\n", len); total=0; if (this->curpos < this->preview_size) { n = this->preview_size - this->curpos; if (n > (len - total)) n = len - total; - lprintf ("%lld bytes from preview (which has %lld bytes)\n", n, this->preview_size); + lprintf ("%"PRId64" bytes from preview (which has %"PRId64" bytes)\n", n, this->preview_size); memcpy (&buf[total], &this->preview[this->curpos], n); this->curpos += n; @@ -103,7 +103,7 @@ static off_t stdin_plugin_read (input_plugin_t *this_gen, if( (len-total) > 0 ) { n = _x_io_file_read (this->stream, this->fh, &buf[total], len - total); - lprintf ("got %lld bytes (%lld/%lld bytes read)\n", n,total,len); + lprintf ("got %"PRId64" bytes (%"PRId64"/%"PRId64" bytes read)\n", n,total,len); if (n < 0) { _x_message(this->stream, XINE_MSG_READ_ERROR, NULL); @@ -143,7 +143,7 @@ static off_t stdin_plugin_seek (input_plugin_t *this_gen, off_t offset, int orig stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen; - lprintf ("seek %lld offset, %d origin...\n", offset, origin); + lprintf ("seek %"PRId64" offset, %d origin...\n", offset, origin); if ((origin == SEEK_CUR) && (offset >= 0)) { diff --git a/src/input/mms.c b/src/input/mms.c index 370b20759..74087f7c5 100644 --- a/src/input/mms.c +++ b/src/input/mms.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: mms.c,v 1.64 2007/01/03 15:09:42 klan Exp $ + * $Id: mms.c,v 1.65 2007/02/20 00:34:56 dgp85 Exp $ * * MMS over TCP protocol * based on work from major mms @@ -385,7 +385,7 @@ static int get_packet_header (mms_t *this, mms_packet_header_t *header) { return packet_type; error: - lprintf("read error, len=%d\n", len); + lprintf("read error, len=%zd\n", len); return MMS_PACKET_ERR; } diff --git a/src/liba52/xine_decoder.c b/src/liba52/xine_decoder.c index 9c770fbbc..5435e9664 100644 --- a/src/liba52/xine_decoder.c +++ b/src/liba52/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.80 2006/07/10 22:08:29 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.81 2007/02/20 00:34:57 dgp85 Exp $ * * stuff needed to turn liba52 into a xine decoder plugin */ @@ -425,7 +425,7 @@ static void a52dec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { uint16_t crc16; uint16_t crc16_result; - lprintf ("decode data %d bytes of type %08x, pts=%lld\n", + lprintf ("decode data %d bytes of type %08x, pts=%"PRId64"\n", buf->size, buf->type, buf->pts); lprintf ("decode data decoder_info=%d, %d\n",buf->decoder_info[1],buf->decoder_info[2]); diff --git a/src/libdts/xine_decoder.c b/src/libdts/xine_decoder.c index a97ee1a9b..902d8c5b6 100644 --- a/src/libdts/xine_decoder.c +++ b/src/libdts/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.66 2006/07/10 22:08:29 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.67 2007/02/20 00:34:57 dgp85 Exp $ * * 04-09-2001 DTS passtrough (C) Joachim Koenig * 09-12-2001 DTS passthrough inprovements (C) James Courtier-Dutton @@ -201,7 +201,7 @@ static void dts_decode_frame (dts_decoder_t *this, int64_t pts, int preview_mode } #endif - lprintf("length=%d pts=%lld\n",this->ac5_pcm_length,audio_buffer->vpts); + lprintf("length=%d pts=%"PRId64"\n",this->ac5_pcm_length,audio_buffer->vpts); audio_buffer->num_frames = this->ac5_pcm_length; diff --git a/src/libfaad/xine_decoder.c b/src/libfaad/xine_decoder.c index bf6e9183c..aa528a34d 100644 --- a/src/libfaad/xine_decoder.c +++ b/src/libfaad/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.48 2006/07/10 22:08:29 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.49 2007/02/20 00:34:57 dgp85 Exp $ * */ @@ -140,7 +140,7 @@ static int faad_open_dec( faad_decoder_t *this ) { _("libfaad: libfaad NeAACDecInit2 failed.\n")); this->faac_failed++; } else - lprintf( "NeAACDecInit2 returned rate=%ld channels=%d\n", + lprintf( "NeAACDecInit2 returned rate=%"PRId32" channels=%d\n", this->rate, this->num_channels ); } else { used = NeAACDecInit(this->faac_dec, this->buf, this->size, @@ -151,7 +151,7 @@ static int faad_open_dec( faad_decoder_t *this ) { _("libfaad: libfaad NeAACDecInit failed.\n")); this->faac_failed++; } else { - lprintf( "NeAACDecInit() returned rate=%ld channels=%d (used=%d)\n", + lprintf( "NeAACDecInit() returned rate=%"PRId32" channels=%d (used=%d)\n", this->rate, this->num_channels, used); this->size -= used; @@ -239,7 +239,7 @@ static void faad_decode_audio ( faad_decoder_t *this, int end_frame ) { this->num_channels = this->faac_finfo.channels; this->rate = this->faac_finfo.samplerate; - lprintf("faacDecDecode() returned rate=%ld channels=%d used=%d\n", + lprintf("faacDecDecode() returned rate=%"PRId32" channels=%d used=%d\n", this->rate, this->num_channels, used); this->stream->audio_out->close (this->stream->audio_out, this->stream); diff --git a/src/libreal/audio_decoder.c b/src/libreal/audio_decoder.c index 105c91fe3..8b8e40126 100644 --- a/src/libreal/audio_decoder.c +++ b/src/libreal/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.50 2006/12/19 19:10:51 dsalt Exp $ + * $Id: audio_decoder.c,v 1.51 2007/02/20 00:34:57 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -443,7 +443,7 @@ static unsigned char sipr_swaps[38][2]={ static void realdec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { realdec_decoder_t *this = (realdec_decoder_t *) this_gen; - lprintf ("decode_data %d bytes, flags=0x%08x, pts=%lld ...\n", + lprintf ("decode_data %d bytes, flags=0x%08x, pts=%"PRId64" ...\n", buf->size, buf->decoder_flags, buf->pts); if (buf->decoder_flags & BUF_FLAG_PREVIEW) { diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c index d1f5ce1c0..ffd89178b 100644 --- a/src/libreal/xine_decoder.c +++ b/src/libreal/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.84 2006/12/19 19:10:51 dsalt Exp $ + * $Id: xine_decoder.c,v 1.85 2007/02/20 00:34:57 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -262,7 +262,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { this->duration = 90000.0 / this->fps; #endif - lprintf("this->ratio=%d\n", this->ratio); + lprintf("this->ratio=%f\n", this->ratio); lprintf ("init_data.w=%d(0x%x), init_data.h=%d(0x%x)," "this->width=%d(0x%x), this->height=%d(0x%x)\n", @@ -338,7 +338,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { realdec_decoder_t *this = (realdec_decoder_t *) this_gen; - lprintf ("decode_data, flags=0x%08x, len=%d, pts=%lld ...\n", + lprintf ("decode_data, flags=0x%08x, len=%d, pts=%"PRId64" ...\n", buf->decoder_flags, buf->size, buf->pts); if (buf->decoder_flags & BUF_FLAG_PREVIEW) { @@ -374,7 +374,7 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) this->chunk_buffer_size = 0; this->pts = buf->pts; - lprintf ("new frame starting, pts=%lld\n", this->pts); + lprintf ("new frame starting, pts=%"PRId64"\n", this->pts); } if ((this->chunk_buffer_size + buf->size) > this->chunk_buffer_max) { diff --git a/src/libsputext/xine_decoder.c b/src/libsputext/xine_decoder.c index 8c976671f..f8e50ffd4 100644 --- a/src/libsputext/xine_decoder.c +++ b/src/libsputext/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.97 2006/12/19 19:10:51 dsalt Exp $ + * $Id: xine_decoder.c,v 1.98 2007/02/20 00:34:57 dgp85 Exp $ * */ @@ -591,7 +591,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su this->renderer->hide (this->osd, sub_end); - lprintf ("scheduling subtitle >%s< at %lld until %lld, current time is %lld\n", + lprintf ("scheduling subtitle >%s< at %"PRId64" until %"PRId64", current time is %"PRId64"\n", this->text[0], sub_start, sub_end, this->stream->xine->clock->get_current_time (this->stream->xine->clock)); } diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c index d504d9511..549c19b02 100644 --- a/src/xine-engine/audio_decoder.c +++ b/src/xine-engine/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.138 2006/09/08 21:11:29 miguelfreitas Exp $ + * $Id: audio_decoder.c,v 1.139 2007/02/20 00:34:57 dgp85 Exp $ * * * functions that implement audio decoding @@ -67,7 +67,7 @@ static void *audio_decoder_loop (void *stream_gen) { if( !replaying_headers ) buf = stream->audio_fifo->get (stream->audio_fifo); - lprintf ("audio_loop: got package pts = %lld, type = %08x\n", buf->pts, buf->type); + lprintf ("audio_loop: got package pts = %"PRId64", type = %08x\n", buf->pts, buf->type); _x_extra_info_merge( stream->audio_decoder_extra_info, buf->extra_info ); stream->audio_decoder_extra_info->seek_count = stream->video_seek_count; diff --git a/src/xine-engine/input_cache.c b/src/xine-engine/input_cache.c index be5b005ec..a566e1f84 100644 --- a/src/xine-engine/input_cache.c +++ b/src/xine-engine/input_cache.c @@ -22,7 +22,7 @@ * The goal of this input plugin is to reduce * the number of calls to the real input plugin. * - * $Id: input_cache.c,v 1.13 2007/01/19 01:05:25 dgp85 Exp $ + * $Id: input_cache.c,v 1.14 2007/02/20 00:34:57 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -67,7 +67,7 @@ static off_t cache_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { off_t read_len = 0; off_t main_read; - lprintf("cache_plugin_read: len=%lld\n", len); + lprintf("cache_plugin_read: len=%"PRId64"\n", len); this->read_call++; /* optimized for common cases */ @@ -205,7 +205,7 @@ static off_t cache_plugin_seek(input_plugin_t *this_gen, off_t offset, int origi off_t rel_offset; off_t new_buf_pos; - lprintf("offset: %lld, origin: %d\n", offset, origin); + lprintf("offset: %"PRId64", origin: %d\n", offset, origin); this->seek_call++; if( !this->buf_len ) { @@ -236,7 +236,7 @@ static off_t cache_plugin_seek(input_plugin_t *this_gen, off_t offset, int origi } new_buf_pos = (off_t)this->buf_pos + rel_offset; - lprintf("buf_len: %d, rel_offset=%lld, new_buf_pos=%lld\n", + lprintf("buf_len: %d, rel_offset=%"PRId64", new_buf_pos=%"PRId64"\n", this->buf_len, rel_offset, new_buf_pos); if ((new_buf_pos < 0) || (new_buf_pos >= this->buf_len)) { diff --git a/src/xine-engine/input_rip.c b/src/xine-engine/input_rip.c index d7a0c46ca..d8715fb85 100644 --- a/src/xine-engine/input_rip.c +++ b/src/xine-engine/input_rip.c @@ -29,7 +29,7 @@ * - it's possible speeder saving streams in the xine without playing: * xine stream_mrl#save:file.raw\;noaudio\;novideo * - * $Id: input_rip.c,v 1.33 2007/01/19 01:05:25 dgp85 Exp $ + * $Id: input_rip.c,v 1.34 2007/02/20 00:34:57 dgp85 Exp $ */ /* TODO: @@ -103,7 +103,7 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen; off_t retlen, npreview, nread, nwrite, nread_orig, nread_file; - lprintf("reading %lld bytes (curpos = %lld, savepos = %lld)\n", len, this->curpos, this->savepos); + lprintf("reading %"PRId64" bytes (curpos = %"PRId64", savepos = %"PRId64")\n", len, this->curpos, this->savepos); if (len < 0) return -1; @@ -117,7 +117,7 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { nread = min_off(this->savepos - this->preview_size, len - npreview); } - lprintf(" => get %lld bytes from preview (%lld bytes)\n", npreview, this->preview_size); + lprintf(" => get %"PRId64" bytes from preview (%"PRId64" bytes)\n", npreview, this->preview_size); memcpy(buf, &this->preview[this->curpos], npreview); } else { @@ -134,7 +134,7 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { /* re-reading from file */ if (nread_file) { - lprintf(" => read %lld bytes from file\n", nread_file); + lprintf(" => read %"PRId64" bytes from file\n", nread_file); if (fread(&buf[npreview], nread_file, 1, this->file) != 1) { xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: reading of saved data failed: %s\n"), strerror(errno)); return -1; @@ -143,11 +143,11 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { /* really to read/catch */ if (nread_orig + nwrite) { - lprintf(" => read %lld bytes from input plugin\n", nread_orig + nwrite); + lprintf(" => read %"PRId64" bytes from input plugin\n", nread_orig + nwrite); /* read from main input plugin */ retlen = this->main_input_plugin->read(this->main_input_plugin, &buf[npreview + nread_file], nread_orig + nwrite); - lprintf("%s => returned %lld" CLR_RST "\n", retlen == nread_orig + nwrite ? "" : CLR_FAIL, retlen); + lprintf("%s => returned %"PRId64"" CLR_RST "\n", retlen == nread_orig + nwrite ? "" : CLR_FAIL, retlen); if (retlen < 0) { xine_log(this->stream->xine, XINE_LOG_MSG, @@ -163,7 +163,7 @@ static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) { return -1; } this->savepos += nwrite; - lprintf(" => saved %lld bytes\n", nwrite); + lprintf(" => saved %"PRId64" bytes\n", nwrite); } else nwrite = 0; } @@ -212,7 +212,7 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe buf_element_t *buf = NULL; off_t retlen, npreview, nread, nwrite, nread_orig, nread_file; - lprintf("reading %lld bytes (curpos = %lld, savepos = %lld) (block)\n", todo, this->curpos, this->savepos); + lprintf("reading %"PRId64" bytes (curpos = %"PRId64", savepos = %"PRId64") (block)\n", todo, this->curpos, this->savepos); if (todo <= 0) return NULL; @@ -226,7 +226,7 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe nread = min_off(this->savepos - this->preview_size, todo - npreview); } - lprintf(" => get %lld bytes from preview (%lld bytes) (block)\n", npreview, this->preview_size); + lprintf(" => get %"PRId64" bytes from preview (%"PRId64" bytes) (block)\n", npreview, this->preview_size); } else { npreview = 0; nread = min_off(this->savepos - this->curpos, todo); @@ -247,13 +247,13 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe /* get data from preview */ if (npreview) { - lprintf(" => get %lld bytes from the preview (block)\n", npreview); + lprintf(" => get %"PRId64" bytes from the preview (block)\n", npreview); memcpy(buf->content, &this->preview[this->curpos], npreview); } /* re-reading from the file */ if (nread_file) { - lprintf(" => read %lld bytes from the file (block)\n", nread_file); + lprintf(" => read %"PRId64" bytes from the file (block)\n", nread_file); if (fread(&buf->content[npreview], nread_file, 1, this->file) != 1) { xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: reading of saved data failed: %s\n"), @@ -267,10 +267,10 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe if (nread_orig + nwrite) { /* read from main input plugin */ if (buf) { - lprintf(" => read %lld bytes from input plugin (block)\n", nread_orig + nwrite); + lprintf(" => read %"PRId64" bytes from input plugin (block)\n", nread_orig + nwrite); retlen = this->main_input_plugin->read(this->main_input_plugin, &buf->content[npreview + nread_file], nread_orig + nwrite); } else { - lprintf(" => read block of %lld bytes from input plugin (block)\n", nread_orig + nwrite); + lprintf(" => read block of %"PRId64" bytes from input plugin (block)\n", nread_orig + nwrite); buf = this->main_input_plugin->read_block(this->main_input_plugin, fifo, nread_orig + nwrite); if (buf) retlen = buf->size; else { @@ -279,7 +279,7 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe } } if (retlen != nread_orig + nwrite) { - lprintf(CLR_FAIL " => returned %lld" CLR_RST "\n", retlen); + lprintf(CLR_FAIL " => returned %"PRId64"" CLR_RST "\n", retlen); return NULL; } @@ -293,7 +293,7 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe return NULL; } this->savepos += nwrite; - lprintf(" => saved %lld bytes\n", nwrite); + lprintf(" => saved %"PRId64" bytes\n", nwrite); } else nwrite = 0; } @@ -307,7 +307,7 @@ static buf_element_t *rip_plugin_read_block(input_plugin_t *this_gen, fifo_buffe static off_t rip_seek_original(rip_input_plugin_t *this, off_t reqpos) { off_t pos; - lprintf(" => seeking original input plugin to %lld\n", reqpos); + lprintf(" => seeking original input plugin to %"PRId64"\n", reqpos); pos = this->main_input_plugin->seek(this->main_input_plugin, reqpos, SEEK_SET); if (pos == -1) { @@ -316,7 +316,7 @@ static off_t rip_seek_original(rip_input_plugin_t *this, off_t reqpos) { } #ifdef LOG if (pos != reqpos) { - lprintf(CLR_FAIL " => reqested position %lld differs from result position %lld" CLR_RST "\n", reqpos, pos); + lprintf(CLR_FAIL " => reqested position %"PRId64" differs from result position %"PRId64"" CLR_RST "\n", reqpos, pos); } #endif @@ -339,7 +339,7 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) struct timeval time1, time2; double interval = 0; - lprintf("seek, offset %lld, origin %d (curpos %lld, savepos %lld)\n", offset, origin, this->curpos, this->savepos); + lprintf("seek, offset %"PRId64", origin %d (curpos %"PRId64", savepos %"PRId64")\n", offset, origin, this->curpos, this->savepos); switch (origin) { case SEEK_SET: newpos = offset; break; @@ -355,7 +355,7 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) blocksize = 0; if (newpos < this->savepos) { - lprintf(" => virtual seeking from %lld to %lld\n", this->curpos, newpos); + lprintf(" => virtual seeking from %"PRId64" to %"PRId64"\n", this->curpos, newpos); /* don't seek into preview area */ if (this->preview && newpos < this->preview_size) { @@ -366,7 +366,7 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) if (this->regular) { if (reqpos != this->savepos) { - lprintf(" => seeking file to %lld\n", reqpos); + lprintf(" => seeking file to %"PRId64"\n", reqpos); if (fseeko(this->file, reqpos, SEEK_SET) != 0) { xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: seeking failed: %s\n"), strerror(errno)); return -1; @@ -382,9 +382,9 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) } if (this->curpos < this->savepos) { - lprintf(" => seeking to end: %lld\n", this->savepos); + lprintf(" => seeking to end: %"PRId64"\n", this->savepos); if (this->regular) { - lprintf(" => seeking file to end: %lld\n", this->savepos); + lprintf(" => seeking file to end: %"PRId64"\n", this->savepos); if (fseeko(this->file, this->savepos, SEEK_SET) != 0) { xine_log(this->stream->xine, XINE_LOG_MSG, _("input_rip: seeking failed: %s\n"), strerror(errno)); return -1; @@ -425,7 +425,7 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) + (double)(time2.tv_usec - time1.tv_usec) / 1000000; } - lprintf(" => new position %lld\n", this->curpos); + lprintf(" => new position %"PRId64"\n", this->curpos); return this->curpos; } @@ -449,7 +449,7 @@ static off_t rip_plugin_get_current_pos(input_plugin_t *this_gen) { pos = this->main_input_plugin->get_current_pos(this->main_input_plugin); if (pos != this->curpos) { - lprintf(CLR_FAIL "position: computed = %lld, input plugin = %lld" CLR_RST "\n", this->curpos, pos); + lprintf(CLR_FAIL "position: computed = %"PRId64", input plugin = %"PRId64"" CLR_RST "\n", this->curpos, pos); } #endif @@ -660,7 +660,7 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f free(this); return NULL; } - lprintf(" => saved %lld bytes (preview)\n", this->preview_size); + lprintf(" => saved %"PRId64" bytes (preview)\n", this->preview_size); this->savepos = this->preview_size; } diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c index 809204af9..fa33da9e1 100644 --- a/src/xine-engine/metronom.c +++ b/src/xine-engine/metronom.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: metronom.c,v 1.143 2006/01/27 22:35:07 dsalt Exp $ + * $Id: metronom.c,v 1.144 2007/02/20 00:34:57 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -524,7 +524,7 @@ static void metronom_got_video_frame (metronom_t *this, vo_frame_t *img) { img->vpts = this->video_vpts + this->av_offset; if (this->video_mode == VIDEO_PREDICTION_MODE) { - lprintf("video vpts for %10lld : %10lld (duration:%d drift:%" PRId64 " step:%" PRId64 ")\n", + lprintf("video vpts for %10"PRId64" : %10"PRId64" (duration:%d drift:%" PRId64 " step:%" PRId64 ")\n", pts, this->video_vpts, img->duration, this->video_drift, this->video_drift_step ); if (this->video_drift * this->video_drift_step > 0) { @@ -681,7 +681,7 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts, this->audio_samples += nsamples; this->vpts_offset += nsamples * this->audio_drift_step / AUDIO_SAMPLE_NUM; - lprintf("audio vpts for %10lld : %10lld\n", pts, vpts); + lprintf("audio vpts for %10"PRId64" : %10"PRId64"\n", pts, vpts); pthread_mutex_unlock (&this->lock); diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index 210bcf26e..229a9ad37 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -200,7 +200,7 @@ static int _osd_show (osd_object_t *osd, int64_t vpts, int unscaled ) { int x, y, required; uint8_t *c; - lprintf("osd=%p vpts=%lld\n", osd, vpts); + lprintf("osd=%p vpts=%"PRId64"\n", osd, vpts); this->stream->xine->port_ticket->acquire(this->stream->xine->port_ticket, 1); @@ -347,7 +347,7 @@ static int _osd_hide (osd_object_t *osd, int64_t vpts) { osd_renderer_t *this = osd->renderer; video_overlay_manager_t *ovl_manager; - lprintf("osd=%p vpts=%lld\n",osd, vpts); + lprintf("osd=%p vpts=%"PRId64"\n",osd, vpts); if( osd->handle < 0 ) return 0; diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index 8f6b82faa..fee75ec76 100644 --- a/src/xine-engine/video_decoder.c +++ b/src/xine-engine/video_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_decoder.c,v 1.162 2006/12/03 19:23:16 miguelfreitas Exp $ + * $Id: video_decoder.c,v 1.163 2007/02/20 00:34:58 dgp85 Exp $ * */ @@ -308,7 +308,7 @@ static void *video_decoder_loop (void *stream_gen) { break; case BUF_CONTROL_NEWPTS: - lprintf ("new pts %lld\n", buf->disc_off); + lprintf ("new pts %"PRId64"\n", buf->disc_off); if (stream->video_decoder_plugin) { running_ticket->acquire(running_ticket, 0); -- cgit v1.2.3 From 2dcf8f38edd30609269a6fd2607757fb127635de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Tue, 20 Feb 2007 00:36:08 +0000 Subject: const++ CVS patchset: 8609 CVS date: 2007/02/20 00:36:08 --- src/xine-engine/xine.c | 6 +++--- src/xine-utils/memcpy.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 600169121..f49a988c9 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine.c,v 1.341 2007/02/19 23:20:19 dgp85 Exp $ + * $Id: xine.c,v 1.342 2007/02/20 00:37:02 dgp85 Exp $ */ /* @@ -1535,8 +1535,8 @@ static void config_save_cb (void *this_gen, xine_cfg_entry_t *entry) { } void xine_init (xine_t *this) { - static char *demux_strategies[] = {"default", "reverse", "content", - "extension", NULL}; + static const char *demux_strategies[] = {"default", "reverse", "content", + "extension", NULL}; /* initialize color conversion tables and functions */ init_yuv_conversion(); diff --git a/src/xine-utils/memcpy.c b/src/xine-utils/memcpy.c index 15301f108..539f4c8dd 100644 --- a/src/xine-utils/memcpy.c +++ b/src/xine-utils/memcpy.c @@ -461,7 +461,7 @@ void xine_probe_fast_memcpy(xine_t *xine) char *buf1, *buf2; int i, j, best; int config_flags = -1; - static char *memcpy_methods[] = { + static const char *memcpy_methods[] = { "probe", "libc", #if (defined(ARCH_X86) || defined(ARCH_X86_64)) && !defined(_MSC_VER) "kernel", "mmx", "mmxext", "sse", -- cgit v1.2.3 From 484c1150d9efa76f11e4f6fbaf953f10948cddb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Tue, 20 Feb 2007 00:43:06 +0000 Subject: Again changes so to accept the strict case (constants). CVS patchset: 8610 CVS date: 2007/02/20 00:43:06 --- src/xine-engine/xine_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c index afbd15051..0dd48081e 100644 --- a/src/xine-engine/xine_interface.c +++ b/src/xine-engine/xine_interface.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_interface.c,v 1.101 2007/02/03 16:31:55 dsalt Exp $ + * $Id: xine_interface.c,v 1.102 2007/02/20 00:43:06 dgp85 Exp $ * * convenience/abstraction layer, functions to implement * libxine's public interface @@ -136,7 +136,7 @@ int xine_config_register_range (xine_t *self, int xine_config_register_enum (xine_t *self, const char *key, int def_value, - char **values, + const char **values, const char *description, const char *help, int exp_level, -- cgit v1.2.3 From 0fdd8797a4b25239416386861c133b99148d7caa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Tue, 20 Feb 2007 00:47:55 +0000 Subject: Make deinterlace_methods a static constant rather than an extern, as it's just an array of strings. CVS patchset: 8611 CVS date: 2007/02/20 00:47:55 --- src/video_out/deinterlace.c | 12 ------------ src/video_out/deinterlace.h | 11 ++++++++++- 2 files changed, 10 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/video_out/deinterlace.c b/src/video_out/deinterlace.c index 347185b2f..1fda3d733 100644 --- a/src/video_out/deinterlace.c +++ b/src/video_out/deinterlace.c @@ -845,15 +845,3 @@ int deinterlace_yuv_supported ( int method ) return 0; } -char *deinterlace_methods[] = { - "none", - "bob", - "weave", - "greedy", - "onefield", - "onefield_xv", - "linearblend", - NULL -}; - - diff --git a/src/video_out/deinterlace.h b/src/video_out/deinterlace.h index e4a1329c3..a9904b42a 100644 --- a/src/video_out/deinterlace.h +++ b/src/video_out/deinterlace.h @@ -41,6 +41,15 @@ void deinterlace_yuv( uint8_t *pdst, uint8_t *psrc[], #define DEINTERLACE_ONEFIELDXV 5 #define DEINTERLACE_LINEARBLEND 6 -extern char *deinterlace_methods[]; +static const char *deinterlace_methods[] = { + "none", + "bob", + "weave", + "greedy", + "onefield", + "onefield_xv", + "linearblend", + NULL +}; #endif -- cgit v1.2.3 From 35c39badb1b0b66a16da10e510eb755eed1afb25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Tue, 20 Feb 2007 00:51:39 +0000 Subject: Mark a fwe arrays static and avoid casts that are not needed. CVS patchset: 8612 CVS date: 2007/02/20 00:51:39 --- src/input/input_mms.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/input/input_mms.c b/src/input/input_mms.c index 758ad770d..05c0b168b 100644 --- a/src/input/input_mms.c +++ b/src/input/input_mms.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_mms.c,v 1.69 2007/02/20 00:34:56 dgp85 Exp $ + * $Id: input_mms.c,v 1.70 2007/02/20 00:51:39 dgp85 Exp $ * * mms input plugin based on work from major mms */ @@ -56,18 +56,18 @@ #define PROTOCOL_MMSH 2 /* network bandwidth */ -const uint32_t mms_bandwidths[]={14400,19200,28800,33600,34430,57600, - 115200,262200,393216,524300,1544000,10485800}; +static const uint32_t mms_bandwidths[]={14400,19200,28800,33600,34430,57600, + 115200,262200,393216,524300,1544000,10485800}; -const char * mms_bandwidth_strs[]={"14.4 Kbps (Modem)", "19.2 Kbps (Modem)", - "28.8 Kbps (Modem)", "33.6 Kbps (Modem)", - "34.4 Kbps (Modem)", "57.6 Kbps (Modem)", - "115.2 Kbps (ISDN)", "262.2 Kbps (Cable/DSL)", - "393.2 Kbps (Cable/DSL)","524.3 Kbps (Cable/DSL)", - "1.5 Mbps (T1)", "10.5 Mbps (LAN)", NULL}; +static const char * mms_bandwidth_strs[]={"14.4 Kbps (Modem)", "19.2 Kbps (Modem)", + "28.8 Kbps (Modem)", "33.6 Kbps (Modem)", + "34.4 Kbps (Modem)", "57.6 Kbps (Modem)", + "115.2 Kbps (ISDN)", "262.2 Kbps (Cable/DSL)", + "393.2 Kbps (Cable/DSL)","524.3 Kbps (Cable/DSL)", + "1.5 Mbps (T1)", "10.5 Mbps (LAN)", NULL}; /* connection methods */ -const char *mms_protocol_strs[]={"auto", "TCP", "HTTP", NULL}; +static const char *mms_protocol_strs[]={"auto", "TCP", "HTTP", NULL}; typedef struct { input_plugin_t input_plugin; @@ -475,7 +475,7 @@ static void *init_class (xine_t *xine, void *data) { this->input_class.eject_media = NULL; xine->config->register_enum(xine->config, "media.network.bandwidth", 10, - (char **)mms_bandwidth_strs, + mms_bandwidth_strs, _("network bandwidth"), _("Specify the bandwidth of your internet connection here. " "This will be used when streaming servers offer different versions " @@ -485,7 +485,7 @@ static void *init_class (xine_t *xine, void *data) { this->protocol = xine->config->register_enum(xine->config, "media.network.mms_protocol", 0, - (char **)mms_protocol_strs, + mms_protocol_strs, _("MMS protocol"), _("Select the protocol to encapsulate MMS.\nTCP is better but you may need HTTP behind a firewall."), 20, -- cgit v1.2.3 From 0e447cf72eb6d7c44dad3647ea21c7567742cf1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Tue, 20 Feb 2007 00:56:36 +0000 Subject: Make cc_schemes a static const array, rather than an exported one. CVS patchset: 8613 CVS date: 2007/02/20 00:56:36 --- src/libspucc/cc_decoder.c | 9 +-------- src/libspucc/cc_decoder.h | 8 ++++++-- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/libspucc/cc_decoder.c b/src/libspucc/cc_decoder.c index 4acd2cf0e..ba688accf 100644 --- a/src/libspucc/cc_decoder.c +++ b/src/libspucc/cc_decoder.c @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: cc_decoder.c,v 1.27 2005/09/25 00:44:04 miguelfreitas Exp $ + * $Id: cc_decoder.c,v 1.28 2007/02/20 00:56:36 dgp85 Exp $ * * stuff needed to provide closed captioning decoding and display * @@ -213,13 +213,6 @@ static uint8_t *cc_alpha_palettes[NUM_CC_PALETTES] = { cc_text_solid_alpha }; - -char *cc_schemes[NUM_CC_PALETTES + 1] = { - "White/Gray/Translucent", - "White/Black/Solid", - NULL -}; - /* --------------------- misc. EIA 608 definitions -------------------*/ #define TRANSP_SPACE 0x19 /* code for transparent space, essentially diff --git a/src/libspucc/cc_decoder.h b/src/libspucc/cc_decoder.h index 1e298515e..0e7fb69a5 100644 --- a/src/libspucc/cc_decoder.h +++ b/src/libspucc/cc_decoder.h @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: cc_decoder.h,v 1.7 2004/05/05 17:36:48 mroi Exp $ + * $Id: cc_decoder.h,v 1.8 2007/02/20 00:56:36 dgp85 Exp $ * * stuff needed to provide closed captioning decoding and display * @@ -33,7 +33,11 @@ typedef struct cc_decoder_s cc_decoder_t; typedef struct cc_renderer_s cc_renderer_t; #define NUM_CC_PALETTES 2 -extern char *cc_schemes[NUM_CC_PALETTES + 1]; +static const char *cc_schemes[NUM_CC_PALETTES + 1] = { + "White/Gray/Translucent", + "White/Black/Solid", + NULL +}; #define CC_FONT_MAX 256 -- cgit v1.2.3 From 86b77e33f11dc24b53f22170d957f5cb1eadf843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Tue, 20 Feb 2007 00:58:51 +0000 Subject: Remove the cast as register_enum now accept consts. CVS patchset: 8614 CVS date: 2007/02/20 00:58:51 --- src/post/goom/xine_goom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/post/goom/xine_goom.c b/src/post/goom/xine_goom.c index e4f55068b..5871618e0 100644 --- a/src/post/goom/xine_goom.c +++ b/src/post/goom/xine_goom.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_goom.c,v 1.64 2006/12/02 22:35:18 miguelfreitas Exp $ + * $Id: xine_goom.c,v 1.65 2007/02/20 00:58:51 dgp85 Exp $ * * GOOM post plugin. * @@ -218,7 +218,7 @@ static void *goom_init_plugin(xine_t *xine, void *data) cfg->register_enum (cfg, "effects.goom.csc_method", 0, - (char **)goom_csc_methods, + goom_csc_methods, _("colorspace conversion method"), _("You can choose the colorspace conversion method used by goom.\n" "The available selections should be self-explaining."), -- cgit v1.2.3 From 2f2f62ae7c066e01b8d14b4ffc52ac86a9871d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Tue, 20 Feb 2007 01:02:47 +0000 Subject: Avoid casts as they are now unnecessary. CVS patchset: 8615 CVS date: 2007/02/20 01:02:47 --- src/xine-engine/post.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-engine/post.h b/src/xine-engine/post.h index 521fae9e5..739a50f0a 100644 --- a/src/xine-engine/post.h +++ b/src/xine-engine/post.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: post.h,v 1.24 2006/12/25 18:43:38 dgp85 Exp $ + * $Id: post.h,v 1.25 2007/02/20 01:02:47 dgp85 Exp $ * * post plugin definitions * @@ -380,7 +380,7 @@ static xine_post_api_parameter_t temp_p[] = { #define PARAM_ITEM( param_type, var, enumv, min, max, readonly, descr ) \ { param_type, #var, sizeof(temp_s.var), \ - (char *)&temp_s.var-(char *)&temp_s, enumv, min, max, readonly, descr }, + &temp_s.var-&temp_s, enumv, min, max, readonly, descr }, #define END_PARAM_DESCR( name ) \ { POST_PARAM_TYPE_LAST, NULL, 0, 0, NULL, 0, 0, 1, NULL } \ -- cgit v1.2.3 From 7b7f11b8e9dcfa069ccd447c4054dd8d832f628c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Tue, 20 Feb 2007 01:04:07 +0000 Subject: const++ CVS patchset: 8616 CVS date: 2007/02/20 01:04:07 --- src/input/input_dvd.c | 10 +++++----- src/libsputext/xine_decoder.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index a8100a063..944ae88bd 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_dvd.c,v 1.215 2007/02/08 02:40:23 dsalt Exp $ + * $Id: input_dvd.c,v 1.216 2007/02/20 01:04:07 dgp85 Exp $ * */ @@ -1749,9 +1749,9 @@ static void *init_class (xine_t *xine, void *data) { dvd_input_class_t *this; config_values_t *config = xine->config; void *dvdcss; - static char *skip_modes[] = {"skip program", "skip part", "skip title", NULL}; - static char *seek_modes[] = {"seek in program chain", "seek in program", NULL}; - static char *play_single_chapter_modes[] = {"entire dvd", "one chapter", NULL}; + static const char *skip_modes[] = {"skip program", "skip part", "skip title", NULL}; + static const char *seek_modes[] = {"seek in program chain", "seek in program", NULL}; + static const char *play_single_chapter_modes[] = {"entire dvd", "one chapter", NULL}; trace_print("Called\n"); #ifdef INPUT_DEBUG @@ -1795,7 +1795,7 @@ static void *init_class (xine_t *xine, void *data) { { /* we have found libdvdcss, enable the specific config options */ char *raw_device; - static char *decrypt_modes[] = { "key", "disc", "title", NULL }; + static const char *decrypt_modes[] = { "key", "disc", "title", NULL }; char *css_cache_default, *css_cache; int mode; diff --git a/src/libsputext/xine_decoder.c b/src/libsputext/xine_decoder.c index f8e50ffd4..e8ef631ca 100644 --- a/src/libsputext/xine_decoder.c +++ b/src/libsputext/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.98 2007/02/20 00:34:57 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.99 2007/02/20 01:04:07 dgp85 Exp $ * */ @@ -925,7 +925,7 @@ static void update_src_encoding(void *class_gen, xine_cfg_entry_t *entry) static void *init_spu_decoder_plugin (xine_t *xine, void *data) { - static char *subtitle_size_strings[] = { + static const char *subtitle_size_strings[] = { "tiny", "small", "normal", "large", "very large", "huge", NULL }; sputext_class_t *this ; -- cgit v1.2.3 From 1806b4fbeee52df73f7a431adc2279264c17cead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Tue, 20 Feb 2007 01:13:08 +0000 Subject: Revert, got the wrong warning line. CVS patchset: 8617 CVS date: 2007/02/20 01:13:08 --- src/xine-engine/post.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-engine/post.h b/src/xine-engine/post.h index 739a50f0a..bcdc3c54b 100644 --- a/src/xine-engine/post.h +++ b/src/xine-engine/post.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: post.h,v 1.25 2007/02/20 01:02:47 dgp85 Exp $ + * $Id: post.h,v 1.26 2007/02/20 01:13:08 dgp85 Exp $ * * post plugin definitions * @@ -380,7 +380,7 @@ static xine_post_api_parameter_t temp_p[] = { #define PARAM_ITEM( param_type, var, enumv, min, max, readonly, descr ) \ { param_type, #var, sizeof(temp_s.var), \ - &temp_s.var-&temp_s, enumv, min, max, readonly, descr }, + (char*)&temp_s.var-(char*)&temp_s, enumv, min, max, readonly, descr }, #define END_PARAM_DESCR( name ) \ { POST_PARAM_TYPE_LAST, NULL, 0, 0, NULL, 0, 0, 1, NULL } \ -- cgit v1.2.3 From 5b46a65efaea9902516ba88503b258c140ad4fc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Wed, 21 Feb 2007 23:07:45 +0000 Subject: Make -Wl,-z,defs an opt-in ldflag, if available. The $(xineplug_ldflags) variable can be injected in _LDFLAGS for the xine plugins, and already provides -avoid-version -module and -Wl,-z,defs if supported. Right now only wavpack plugin actually make use of this but that can be fixed as the Makefiles are edited. CVS patchset: 8618 CVS date: 2007/02/21 23:07:45 --- src/combined/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/combined/Makefile.am b/src/combined/Makefile.am index 9733481e3..37bff5dcd 100644 --- a/src/combined/Makefile.am +++ b/src/combined/Makefile.am @@ -9,4 +9,4 @@ xineplug_LTLIBRARIES = $(xineplug_wavpack) xineplug_wavpack_la_SOURCES = demux_wavpack.c decoder_wavpack.c combined_wavpack.c combined_wavpack.h xineplug_wavpack_la_CFLAGS = $(WAVPACK_CFLAGS) -I$(srcdir)/../demuxers xineplug_wavpack_la_LIBADD = $(XINE_LIB) $(WAVPACK_LIBS) -xineplug_wavpack_la_LDFLAGS = -avoid-version -module +xineplug_wavpack_la_LDFLAGS = $(xineplug_ldflags) -- cgit v1.2.3 From ccff0b02565287e40e5eb90024f4fc4141804477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Wed, 21 Feb 2007 23:17:14 +0000 Subject: Declare vcdinfo_get_seg_resolution function in vcdplayer.c where it is used, but note that it's not exported by libvcd so it is unsafe to use. CVS patchset: 8619 CVS date: 2007/02/21 23:17:14 --- src/input/vcd/vcdplayer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/input/vcd/vcdplayer.c b/src/input/vcd/vcdplayer.c index 27f726e3c..502d736cc 100644 --- a/src/input/vcd/vcdplayer.c +++ b/src/input/vcd/vcdplayer.c @@ -1,5 +1,5 @@ /* - $Id: vcdplayer.c,v 1.19 2005/06/20 02:17:41 rockyb Exp $ + $Id: vcdplayer.c,v 1.20 2007/02/21 23:17:14 dgp85 Exp $ Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> @@ -46,6 +46,12 @@ #include "vcdplayer.h" #include "vcdio.h" +/* This function is _not_ exported by libvcd, its usage should be avoided, most + * likely. + */ +void vcdinfo_get_seg_resolution(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg, + /*out*/ uint16_t *max_x, /*out*/ uint16_t *max_y); + #define LOG_ERR(p_vcdplayer, s, args...) \ if (p_vcdplayer != NULL && p_vcdplayer->log_err != NULL) \ p_vcdplayer->log_err("%s: "s, __func__ , ##args) -- cgit v1.2.3 From d6a20a1e70a3334750e3d166461523d343a57dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 22 Feb 2007 15:49:16 +0000 Subject: Revert the const mark on xine_config_register_enum, as that breaks C++ frontends (like Kaffeine). Thanks to Christoph Pfister for reporting. This change introduces a few warnings of incompatible pointers internally in configfile.c. These are non-fatal (in C) and they just tell the compiler to handle more stuff as const internally without changing the function interface. CVS patchset: 8620 CVS date: 2007/02/22 15:49:16 --- src/xine-engine/configfile.c | 4 ++-- src/xine-engine/configfile.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index cdbcae4fb..28b44fd51 100644 --- a/src/xine-engine/configfile.c +++ b/src/xine-engine/configfile.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: configfile.c,v 1.84 2007/02/20 00:01:19 dgp85 Exp $ + * $Id: configfile.c,v 1.85 2007/02/22 15:49:16 dgp85 Exp $ * * config object (was: file) management - implementation * @@ -717,7 +717,7 @@ static int config_parse_enum (const char *str, const char **values) { static int config_register_enum (config_values_t *this, const char *key, int def_value, - const char **values, + char **values, const char *description, const char *help, int exp_level, diff --git a/src/xine-engine/configfile.h b/src/xine-engine/configfile.h index 3fb1124b4..859214d1c 100644 --- a/src/xine-engine/configfile.h +++ b/src/xine-engine/configfile.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: configfile.h,v 1.41 2007/02/20 00:01:19 dgp85 Exp $ + * $Id: configfile.h,v 1.42 2007/02/22 15:49:16 dgp85 Exp $ * * config file management * @@ -131,7 +131,7 @@ struct config_values_s { int (*register_enum) (config_values_t *self, const char *key, int def_value, - const char **values, + char **values, const char *description, const char *help, int exp_level, -- cgit v1.2.3 From 32a2731bd211c57df9f18f140646b03956231e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 22 Feb 2007 16:04:45 +0000 Subject: This one should have been with the previous commit. CVS patchset: 8621 CVS date: 2007/02/22 16:04:45 --- src/xine-engine/xine_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c index 0dd48081e..1861df7c0 100644 --- a/src/xine-engine/xine_interface.c +++ b/src/xine-engine/xine_interface.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_interface.c,v 1.102 2007/02/20 00:43:06 dgp85 Exp $ + * $Id: xine_interface.c,v 1.103 2007/02/22 16:04:45 dgp85 Exp $ * * convenience/abstraction layer, functions to implement * libxine's public interface @@ -136,7 +136,7 @@ int xine_config_register_range (xine_t *self, int xine_config_register_enum (xine_t *self, const char *key, int def_value, - const char **values, + char **values, const char *description, const char *help, int exp_level, -- cgit v1.2.3 From dd68f6fecd2f8f1195747d7afcbe62c958440ba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sun, 25 Feb 2007 17:34:48 +0000 Subject: Instead of replicating it over and over, define __unused in attributes.h so that it can be used whenever necessary. CVS patchset: 8622 CVS date: 2007/02/25 17:34:48 --- src/combined/decoder_wavpack.c | 11 ++--------- src/combined/demux_wavpack.c | 11 ++--------- src/xine-utils/attributes.h | 8 ++++++++ 3 files changed, 12 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/combined/decoder_wavpack.c b/src/combined/decoder_wavpack.c index c52e47478..ea843cd16 100644 --- a/src/combined/decoder_wavpack.c +++ b/src/combined/decoder_wavpack.c @@ -19,13 +19,14 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: decoder_wavpack.c,v 1.7 2007/01/26 18:23:06 dgp85 Exp $ + * $Id: decoder_wavpack.c,v 1.8 2007/02/25 17:34:48 dgp85 Exp $ */ #define LOG_MODULE "decode_wavpack" #define LOG_VERBOSE #include "xine_internal.h" +#include "attributes.h" #include <wavpack/wavpack.h> #include "combined_wavpack.h" @@ -50,14 +51,6 @@ typedef struct { size_t buf_pos; } wavpack_decoder_t; -#ifndef __unused -# ifdef SUPPORT_ATTRIBUTE_UNUSED -# define __unused __attribute__((unused)) -# else -# define __unused -# endif -#endif - /* Wrapper functions for Wavpack */ static int32_t xine_buffer_read_bytes(void *const this_gen, void *const data, int32_t bcount) { diff --git a/src/combined/demux_wavpack.c b/src/combined/demux_wavpack.c index 99b94ce6d..bb43a590c 100644 --- a/src/combined/demux_wavpack.c +++ b/src/combined/demux_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: demux_wavpack.c,v 1.7 2007/01/24 22:05:09 dgp85 Exp $ + * $Id: demux_wavpack.c,v 1.8 2007/02/25 17:34:48 dgp85 Exp $ */ #define LOG_MODULE "demux_wavpack" @@ -29,6 +29,7 @@ #include "xineutils.h" #include "demux.h" #include "bswap.h" +#include "attributes.h" #include <wavpack/wavpack.h> @@ -53,14 +54,6 @@ typedef struct { demux_class_t demux_class; } demux_wv_class_t; -#ifndef __unused -# ifdef SUPPORT_ATTRIBUTE_UNUSED -# define __unused __attribute__((unused)) -# else -# define __unused -# endif -#endif - static int32_t xine_input_read_bytes(void *const this_gen, void *const data, const int32_t bcount) { input_plugin_t *const this = (input_plugin_t*)this_gen; diff --git a/src/xine-utils/attributes.h b/src/xine-utils/attributes.h index dd70d4309..c2936a2a4 100644 --- a/src/xine-utils/attributes.h +++ b/src/xine-utils/attributes.h @@ -59,4 +59,12 @@ # define XINE_SENTINEL #endif +#ifndef __unused +# ifdef SUPPORT_ATTRIBUTE_UNUSED +# define __unused __attribute__((unused)) +# else +# define __unused +# endif +#endif + #endif /* ATTRIBUTE_H_ */ -- cgit v1.2.3 From 12ebf363662fc26599ca0ee5a34f2c622f2362a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sun, 25 Feb 2007 17:52:16 +0000 Subject: Use a bitmask, and ensure that the values reported by wavpack for bits_per_sample and channels (that have sane limits) are inside the boundaries, this way we don't end up eating memory in the case of a malformed wavpack file. While we're at it, also try to compact the size of the wavpack structures. CVS patchset: 8623 CVS date: 2007/02/25 17:52:16 --- src/combined/decoder_wavpack.c | 16 +++++++++------- src/combined/demux_wavpack.c | 19 ++++++++++++------- 2 files changed, 21 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/combined/decoder_wavpack.c b/src/combined/decoder_wavpack.c index ea843cd16..60bd13bca 100644 --- a/src/combined/decoder_wavpack.c +++ b/src/combined/decoder_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: decoder_wavpack.c,v 1.8 2007/02/25 17:34:48 dgp85 Exp $ + * $Id: decoder_wavpack.c,v 1.9 2007/02/25 17:52:16 dgp85 Exp $ */ #define LOG_MODULE "decode_wavpack" @@ -40,11 +40,11 @@ typedef struct { xine_stream_t *stream; - int output_open; - int sample_rate; - int bits_per_sample; - int channels; + uint16_t bits_per_sample:6; + uint16_t channels:4; + + uint16_t output_open:1; uint8_t *buf; size_t buf_size; @@ -123,7 +123,7 @@ static int xine_buffer_can_seek(void *const this_gen) { static int32_t xine_buffer_write_bytes(__unused void *const id, __unused void *const data, __unused const int32_t bcount) { - lprintf("xine_buffer_write_bytes: acces is read-only.\n"); + lprintf("xine_buffer_write_bytes: access is read-only.\n"); return 0; } @@ -155,7 +155,9 @@ static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t int mode = AO_CAP_MODE_MONO; this->sample_rate = buf->decoder_info[1]; + _x_assert(buf->decoder_info[2] <= 32); this->bits_per_sample = buf->decoder_info[2]; + _x_assert(buf->decoder_info[3] <= 8); this->channels = buf->decoder_info[3]; mode = _x_ao_channels2mode(this->channels); @@ -170,7 +172,7 @@ static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t this->stream, this->bits_per_sample, this->sample_rate, - mode); + mode) ? 1 : 0; } this->buf_pos = 0; } else if (this->output_open) { diff --git a/src/combined/demux_wavpack.c b/src/combined/demux_wavpack.c index bb43a590c..6f5cf68ff 100644 --- a/src/combined/demux_wavpack.c +++ b/src/combined/demux_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: demux_wavpack.c,v 1.8 2007/02/25 17:34:48 dgp85 Exp $ + * $Id: demux_wavpack.c,v 1.9 2007/02/25 17:52:16 dgp85 Exp $ */ #define LOG_MODULE "demux_wavpack" @@ -46,8 +46,8 @@ typedef struct { uint32_t current_sample; uint32_t samples; uint32_t samplerate; - uint32_t bits_per_sample; - uint32_t channels; + uint16_t bits_per_sample:6; + uint16_t channels:4; } demux_wv_t; typedef struct { @@ -118,6 +118,7 @@ static int open_wv_file(demux_wv_t *const this) { WavpackContext *ctx = NULL; char error[256]; /* Current version of wavpack (4.31) does not write more than this */ wvheader_t header; + uint32_t tmp; /* Right now we don't support non-seekable streams */ if (! INPUT_IS_SEEKABLE(this->input) ) { @@ -147,10 +148,14 @@ static int open_wv_file(demux_wv_t *const this) { lprintf("number of samples: %u\n", this->samples); this->samplerate = WavpackGetSampleRate(ctx); lprintf("samplerate: %u Hz\n", this->samplerate); - this->bits_per_sample = WavpackGetBitsPerSample(ctx); - lprintf("bits_per_sample: %u\n", this->bits_per_sample); - this->channels = WavpackGetNumChannels(ctx); - lprintf("channels: %u\n", this->channels); + + tmp = WavpackGetBitsPerSample(ctx); _x_assert(tmp <= 32); + lprintf("bits_per_sample: %u\n", tmp); + this->bits_per_sample = tmp; + + tmp = WavpackGetNumChannels(ctx); _x_assert(tmp <= 8); + lprintf("channels: %u\n", tmp); + this->channels = tmp; _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, -- cgit v1.2.3 From 80e426e728a52fee8c947700ad0cf08767af0016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sun, 25 Feb 2007 17:53:51 +0000 Subject: Remove a pointless else clause. CVS patchset: 8624 CVS date: 2007/02/25 17:53:51 --- src/combined/decoder_wavpack.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/combined/decoder_wavpack.c b/src/combined/decoder_wavpack.c index 60bd13bca..a6a543407 100644 --- a/src/combined/decoder_wavpack.c +++ b/src/combined/decoder_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: decoder_wavpack.c,v 1.9 2007/02/25 17:52:16 dgp85 Exp $ + * $Id: decoder_wavpack.c,v 1.10 2007/02/25 17:53:51 dgp85 Exp $ */ #define LOG_MODULE "decode_wavpack" @@ -274,8 +274,7 @@ static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t WavpackCloseFile(ctx); this->buf_pos = 0; } - } else - return; + } } static void wavpack_dispose (audio_decoder_t *this_gen) { -- cgit v1.2.3 From d565bed934ab0ea5ebd44620e0df0256f8fa0c7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sun, 25 Feb 2007 17:57:04 +0000 Subject: Cleanup unused variables. CVS patchset: 8625 CVS date: 2007/02/25 17:57:04 --- src/combined/decoder_wavpack.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/combined/decoder_wavpack.c b/src/combined/decoder_wavpack.c index a6a543407..f425c58a9 100644 --- a/src/combined/decoder_wavpack.c +++ b/src/combined/decoder_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: decoder_wavpack.c,v 1.10 2007/02/25 17:53:51 dgp85 Exp $ + * $Id: decoder_wavpack.c,v 1.11 2007/02/25 17:57:04 dgp85 Exp $ */ #define LOG_MODULE "decode_wavpack" @@ -116,7 +116,6 @@ static uint32_t xine_buffer_get_length(void *const this_gen) { } static int xine_buffer_can_seek(void *const this_gen) { - wavpack_decoder_t *const this = (wavpack_decoder_t*)this_gen; return 1; } @@ -137,7 +136,7 @@ static void wavpack_reset (audio_decoder_t *const this_gen) static void wavpack_discontinuity (audio_decoder_t *const this_gen) { - wavpack_decoder_t *this = (wavpack_decoder_t *) this_gen; + /* wavpack_decoder_t *this = (wavpack_decoder_t *) this_gen; */ lprintf("Discontinuity!\n"); } @@ -145,7 +144,6 @@ static void wavpack_discontinuity (audio_decoder_t *const this_gen) static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t *const buf) { wavpack_decoder_t *const this = (wavpack_decoder_t *) this_gen; - int ret = 1; /* We are getting the stream header, open up the audio * device, and collect information about the stream -- cgit v1.2.3 From e8023bb88716ed8fac7ef7fc59e273639132f059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sun, 25 Feb 2007 18:02:13 +0000 Subject: Instead of __unused, use __attr_unused, to avoid possible collisions with other libraries. CVS patchset: 8626 CVS date: 2007/02/25 18:02:13 --- src/combined/decoder_wavpack.c | 8 ++++---- src/combined/demux_wavpack.c | 8 ++++---- src/xine-utils/attributes.h | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/combined/decoder_wavpack.c b/src/combined/decoder_wavpack.c index f425c58a9..6b0d035e4 100644 --- a/src/combined/decoder_wavpack.c +++ b/src/combined/decoder_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: decoder_wavpack.c,v 1.11 2007/02/25 17:57:04 dgp85 Exp $ + * $Id: decoder_wavpack.c,v 1.12 2007/02/25 18:02:13 dgp85 Exp $ */ #define LOG_MODULE "decode_wavpack" @@ -119,9 +119,9 @@ static int xine_buffer_can_seek(void *const this_gen) { return 1; } -static int32_t xine_buffer_write_bytes(__unused void *const id, - __unused void *const data, - __unused const int32_t bcount) { +static int32_t xine_buffer_write_bytes(__attr_unused void *const id, + __attr_unused void *const data, + __attr_unused const int32_t bcount) { lprintf("xine_buffer_write_bytes: access is read-only.\n"); return 0; } diff --git a/src/combined/demux_wavpack.c b/src/combined/demux_wavpack.c index 6f5cf68ff..d0dce82a2 100644 --- a/src/combined/demux_wavpack.c +++ b/src/combined/demux_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: demux_wavpack.c,v 1.9 2007/02/25 17:52:16 dgp85 Exp $ + * $Id: demux_wavpack.c,v 1.10 2007/02/25 18:02:13 dgp85 Exp $ */ #define LOG_MODULE "demux_wavpack" @@ -96,9 +96,9 @@ static int xine_input_can_seek(void *const this_gen) { return INPUT_IS_SEEKABLE(this); } -static int32_t xine_input_write_bytes(__unused void *const id, - __unused void *const data, - __unused const int32_t bcount) { +static int32_t xine_input_write_bytes(__attr_unused void *const id, + __attr_unused void *const data, + __attr_unused const int32_t bcount) { lprintf("xine_input_write_bytes: acces is read-only.\n"); return 0; } diff --git a/src/xine-utils/attributes.h b/src/xine-utils/attributes.h index c2936a2a4..0328493aa 100644 --- a/src/xine-utils/attributes.h +++ b/src/xine-utils/attributes.h @@ -59,11 +59,11 @@ # define XINE_SENTINEL #endif -#ifndef __unused +#ifndef __attr_unused # ifdef SUPPORT_ATTRIBUTE_UNUSED -# define __unused __attribute__((unused)) +# define __attr_unused __attribute__((unused)) # else -# define __unused +# define __attr_unused # endif #endif -- cgit v1.2.3 From 295f5b05da6ab6246632f26fe31a22283faf8326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sun, 25 Feb 2007 18:04:08 +0000 Subject: Remove unused code. CVS patchset: 8627 CVS date: 2007/02/25 18:04:08 --- src/input/input_file.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src') diff --git a/src/input/input_file.c b/src/input/input_file.c index 82e317492..567a41c9f 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_file.c,v 1.120 2007/01/19 01:05:25 dgp85 Exp $ + * $Id: input_file.c,v 1.121 2007/02/25 18:04:08 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -280,11 +280,6 @@ static off_t file_plugin_get_length (input_plugin_t *this_gen) { } static uint32_t file_plugin_get_blocksize (input_plugin_t *this_gen) { - file_input_plugin_t *this = (file_input_plugin_t *) this_gen; -#if 0 && defined(HAVE_MMAP) - if ( check_mmap_file(this) ) - return this->mmap_len; -#endif return 0; } -- cgit v1.2.3 From c3d9a974c66f867a48a4b24d5d0ca485bbcdbeb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sun, 25 Feb 2007 18:04:57 +0000 Subject: Remove unused variable. CVS patchset: 8628 CVS date: 2007/02/25 18:04:57 --- src/demuxers/demux_tta.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index c16ed798c..aec6becae 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -20,7 +20,7 @@ * True Audio demuxer by Diego Pettenò <flameeyes@gentoo.org> * Inspired by tta libavformat demuxer by Alex Beregszaszi * - * $Id: demux_tta.c,v 1.2 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_tta.c,v 1.3 2007/02/25 18:04:57 dgp85 Exp $ */ #define LOG_MODULE "demux_tta" @@ -68,7 +68,7 @@ typedef struct { static int open_tta_file(demux_tta_t *this) { uint8_t peek[4]; - uint32_t framelen; int i; + uint32_t framelen; if (_x_demux_read_header(this->input, peek, 4) != 4) return 0; -- cgit v1.2.3 From 1c71b178c70bb1712667c4238d3ab3e4345a3c04 Mon Sep 17 00:00:00 2001 From: Miguel Freitas <miguelfreitas@users.sourceforge.net> Date: Sun, 25 Feb 2007 21:54:03 +0000 Subject: Fix race condition in alsa audio out driver. thanks Kirill Belokurov and Matthias Kretz CVS patchset: 8629 CVS date: 2007/02/25 21:54:03 --- src/audio_out/audio_alsa_out.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index 24d597d50..1f3ec700d 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -26,7 +26,7 @@ * (c) 2001 James Courtier-Dutton <James@superbug.demon.co.uk> * * - * $Id: audio_alsa_out.c,v 1.166 2007/02/20 00:04:50 dgp85 Exp $ + * $Id: audio_alsa_out.c,v 1.167 2007/02/25 21:54:04 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -162,7 +162,6 @@ static int my_snd_mixer_wait(snd_mixer_t *mixer, int timeout) { static void *ao_alsa_handle_event_thread(void *data) { alsa_driver_t *this = (alsa_driver_t *) data; - this->mixer.running = 1; do { if(my_snd_mixer_wait(this->mixer.handle, 333) > 0) { @@ -1292,6 +1291,8 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { if (send_events && found) { pthread_attr_t pth_attrs; struct sched_param pth_params; + + this->mixer.running = 1; pthread_attr_init(&pth_attrs); -- cgit v1.2.3 From 49da4ad331daa0a943397f408695b033f2b8aaa9 Mon Sep 17 00:00:00 2001 From: Miguel Freitas <miguelfreitas@users.sourceforge.net> Date: Sun, 25 Feb 2007 22:33:25 +0000 Subject: alsa patches from Julian Scheel and Matthias Kretz CVS patchset: 8630 CVS date: 2007/02/25 22:33:25 --- src/audio_out/audio_alsa_out.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index 1f3ec700d..3651d21da 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -26,7 +26,7 @@ * (c) 2001 James Courtier-Dutton <James@superbug.demon.co.uk> * * - * $Id: audio_alsa_out.c,v 1.167 2007/02/25 21:54:04 miguelfreitas Exp $ + * $Id: audio_alsa_out.c,v 1.168 2007/02/25 22:33:25 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -664,6 +664,15 @@ static int ao_alsa_delay (ao_driver_t *this_gen) { printf("audio_alsa_out:delay:ENTERED\n"); #endif err=snd_pcm_delay( this->audio_fd, &delay ); + + int state = snd_pcm_state(this->audio_fd); + + /* check for idle states, which need to be handled as delay=0 */ + if(state == SND_PCM_STATE_PREPARED || state == SND_PCM_STATE_PAUSED || + state == SND_PCM_STATE_OPEN || SND_PCM_STATE_XRUN) { + return 0; + } + #ifdef LOG_DEBUG printf("audio_alsa_out:delay:delay all=%ld err=%d\n",delay, err); gettimeofday(&now, 0); @@ -1505,6 +1514,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da this->capabilities |= AO_CAP_FLOAT32; xprintf(class->xine, XINE_VERBOSITY_LOG, _("32bit ")); } + if (0 == (this->capabilities & (AO_CAP_FLOAT32 | AO_CAP_24BITS | AO_CAP_16BITS | AO_CAP_8BITS))) { + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "\naudio_alsa_out: no supported PCM format found\n"); + snd_pcm_close(this->audio_fd); + free(this); + return NULL; + } if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 1))) { this->capabilities |= AO_CAP_MODE_MONO; xprintf(class->xine, XINE_VERBOSITY_LOG, _("mono ")); -- cgit v1.2.3 From cee06643c91eb698d2ea619ee4cf2c63b3fc841c Mon Sep 17 00:00:00 2001 From: Darren Salt <linux@youmustbejoking.demon.co.uk> Date: Mon, 26 Feb 2007 19:15:15 +0000 Subject: Fix a possible crash in the eq2 plugin. The wrong width value was used for the U and V parts of the image. CVS patchset: 8631 CVS date: 2007/02/26 19:15:15 --- src/post/planar/eq2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/post/planar/eq2.c b/src/post/planar/eq2.c index 806a4ea6c..489733c9b 100644 --- a/src/post/planar/eq2.c +++ b/src/post/planar/eq2.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: eq2.c,v 1.16 2006/03/26 14:45:41 valtri Exp $ + * $Id: eq2.c,v 1.17 2007/02/26 19:15:15 dsalt Exp $ * * mplayer's eq2 (soft video equalizer) * Software equalizer (brightness, contrast, gamma, saturation) @@ -599,12 +599,12 @@ static int eq2_draw(vo_frame_t *frame, xine_stream_t *stream) pthread_mutex_lock (&this->lock); for (i = 0; i < 3; i++) { - int height; + int height, width; height = (i==0) ? frame->height : frame->height/2; - + width = (i==0) ? frame->width : frame->width/2; if (eq2->param[i].adjust != NULL) { eq2->param[i].adjust (&eq2->param[i], out_frame->base[i], yv12_frame->base[i], - frame->width, height, out_frame->pitches[i], yv12_frame->pitches[i]); + width, height, out_frame->pitches[i], yv12_frame->pitches[i]); } else { xine_fast_memcpy(out_frame->base[i],yv12_frame->base[i], -- cgit v1.2.3 From 18771879b638629eab26644c85e6a962b3faf5b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 2 Mar 2007 20:07:33 +0000 Subject: Fixed content type detection for AAC (seekable) streams with ID3v2 tags prefixed clobbering the preview buffer, by skipping over the tag. CVS patchset: 8632 CVS date: 2007/03/02 20:07:33 --- src/demuxers/demux_aac.c | 61 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_aac.c b/src/demuxers/demux_aac.c index 3a81404c1..26a273017 100644 --- a/src/demuxers/demux_aac.c +++ b/src/demuxers/demux_aac.c @@ -21,7 +21,7 @@ * This demuxer detects ADIF and ADTS headers in AAC files. * Then it shovels buffer-sized chunks over to the AAC decoder. * - * $Id: demux_aac.c,v 1.13 2007/01/19 00:26:39 dgp85 Exp $ + * $Id: demux_aac.c,v 1.14 2007/03/02 20:07:33 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -37,9 +37,9 @@ #define LOG_MODULE "demux_aac" #define LOG_VERBOSE -/* + #define LOG -*/ + #include "xine_internal.h" #include "xineutils.h" @@ -57,7 +57,6 @@ typedef struct { input_plugin_t *input; int status; - off_t data_start; off_t data_size; int seek_flag; /* this is set when a seek just occurred */ @@ -72,11 +71,30 @@ static int open_aac_file(demux_aac_t *this) { int i; uint8_t peak[MAX_PREVIEW_SIZE]; uint16_t syncword = 0; + uint32_t id3size = 0; + off_t data_start; /* Check for an ADIF header - should be at the start of the file */ if (_x_demux_read_header(this->input, peak, 4) != 4) return 0; + /* Skip the ID3v2 tag at the start */ + if ( peak[0] == 'I' && peak[1] == 'D' && peak[2] == '3' ) { + + this->input->seek(this->input, 6, SEEK_SET); + if ( this->input->read(this->input, peak, 4) != 4 ) + return 0; + + id3size = (peak[0] << 7*3) + (peak[1] << 7*2) + (peak[2] << 7) + peak[3] + 10; + + lprintf("ID3v2 tag encountered, skipping %u bytes.\n", id3size); + + this->input->seek(this->input, id3size-10, SEEK_CUR); + + if ( this->input->read(this->input, peak, 4) != 4 ) + return 0; + } + if ((peak[0] == 'A') && (peak[1] == 'D') && (peak[2] == 'I') && (peak[3] == 'F')) { lprintf("found ADIF header\n"); @@ -84,13 +102,22 @@ static int open_aac_file(demux_aac_t *this) { } /* Look for an ADTS header - might not be at the start of the file */ - if (_x_demux_read_header(this->input, peak, MAX_PREVIEW_SIZE) != - MAX_PREVIEW_SIZE) + if ( id3size != 0 && this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE ) { + lprintf("Getting a buffer of size %u starting from %u\n", MAX_PREVIEW_SIZE, id3size); + + this->input->seek(this->input, id3size, SEEK_SET); + if ( this->input->read(this->input, peak, MAX_PREVIEW_SIZE) != MAX_PREVIEW_SIZE ) + return 0; + this->input->seek(this->input, 0, SEEK_SET); + } else if (_x_demux_read_header(this->input, peak, MAX_PREVIEW_SIZE) != + MAX_PREVIEW_SIZE) return 0; + data_start = 0; + for (i=0; i<MAX_PREVIEW_SIZE; i++) { if ((syncword & 0xfff6) == 0xfff0) { - this->data_start = i - 2; + data_start = i - 2; lprintf("found ADTS header at offset %d\n", i-2); break; } @@ -99,27 +126,27 @@ static int open_aac_file(demux_aac_t *this) { } /* Look for second ADTS header to confirm it's really aac */ - if (this->data_start + 5 < MAX_PREVIEW_SIZE) { - int frame_size = ((peak[this->data_start+3] & 0x03) << 11) | - (peak[this->data_start+4] << 3) | - ((peak[this->data_start+5] & 0xe0) >> 5); + if (data_start + 5 < MAX_PREVIEW_SIZE) { + int frame_size = ((peak[data_start+3] & 0x03) << 11) | + (peak[data_start+4] << 3) | + ((peak[data_start+5] & 0xe0) >> 5); lprintf("first frame size %d\n", frame_size); if ((frame_size > 0) && - (this->data_start+frame_size < MAX_PREVIEW_SIZE-1) && + (data_start+frame_size < MAX_PREVIEW_SIZE-1) && /* first 28 bits must be identical */ - (peak[this->data_start ] ==peak[this->data_start+frame_size ]) && - (peak[this->data_start+1] ==peak[this->data_start+frame_size+1]) && - (peak[this->data_start+2] ==peak[this->data_start+frame_size+2]) && - (peak[this->data_start+3]>>4==peak[this->data_start+frame_size+3]>>4)) + (peak[data_start ] ==peak[data_start+frame_size ]) && + (peak[data_start+1] ==peak[data_start+frame_size+1]) && + (peak[data_start+2] ==peak[data_start+frame_size+2]) && + (peak[data_start+3]>>4==peak[data_start+frame_size+3]>>4)) { lprintf("found second ADTS header\n"); _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 0); _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); - this->input->seek(this->input, this->data_start, SEEK_SET); + this->input->seek(this->input, data_start+id3size, SEEK_SET); return 1; } } -- cgit v1.2.3 From 4a546e25607aea02d99c2eab00d2230ab7e2cf17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 2 Mar 2007 23:46:29 +0000 Subject: Simplify a lot the code for ID3v2 skip. CVS patchset: 8633 CVS date: 2007/03/02 23:46:29 --- src/demuxers/demux_flac.c | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c index ce6f30165..259f4d4e9 100644 --- a/src/demuxers/demux_flac.c +++ b/src/demuxers/demux_flac.c @@ -23,7 +23,7 @@ * For more information on the FLAC file format, visit: * http://flac.sourceforge.net/ * - * $Id: demux_flac.c,v 1.14 2007/02/20 00:34:55 dgp85 Exp $ + * $Id: demux_flac.c,v 1.15 2007/03/02 23:46:29 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -90,25 +90,17 @@ static int open_flac_file(demux_flac_t *flac) { flac->seekpoints = NULL; /* fetch the file signature */ - if (_x_demux_read_header(flac->input, preamble, 4) != 4) + if ( flac->input->read(flac->input, preamble, 4) != 4 ) return 0; - /* validate signature */ - if ((preamble[0] != 'f') || - (preamble[1] != 'L') || - (preamble[2] != 'a') || - (preamble[3] != 'C')) { - + /* Unfortunately some FLAC files have an ID3 flag prefixed on them + * before the actual FLAC headers... these are barely legal, but + * users use them and want them working, so check and skip the ID3 + * tag if present. + */ + if ( preamble[0] == 'I' && preamble[1] == 'D' && preamble[2] == '3' ) { uint32_t id3size; - /* Unfortunately some FLAC files have an ID3 flag prefixed on them - * before the actual FLAC headers... these are barely legal, but - * users use them and want them working, so check and skip the ID3 - * tag if present. - */ - if ( preamble[0] != 'I' || preamble[1] != 'D' || preamble[2] != '3' ) - return 0; - /* First 3 bytes are the ID3 signature as above, then comes two bytes * encoding the major and minor version of ID3 used, that we can ignore * as long as we don't try to read the metadata; after those there's a @@ -121,19 +113,19 @@ static int open_flac_file(demux_flac_t *flac) { if ( flac->input->read(flac->input, preamble, 4) != 4 ) return 0; - id3size = (preamble[0] << 7*3) + (preamble[1] << 7*2) + (preamble[2] << 7) + preamble[3]; - + id3size = (preamble[0] << 7*3) + (preamble[1] << 7*2) + + (preamble[2] << 7) + preamble[3]; + flac->input->seek(flac->input, id3size, SEEK_CUR); if ( flac->input->read(flac->input, preamble, 4) != 4 ) return 0; - - if ( preamble[0] != 'f' || preamble[1] != 'L' || preamble[2] != 'a' || preamble[3] != 'C' ) + } + + /* validate signature */ + if ((preamble[0] != 'f') || (preamble[1] != 'L') || + (preamble[2] != 'a') || (preamble[3] != 'C')) return 0; - - } else - /* file is qualified; skip over the signature bytes in the stream */ - flac->input->seek(flac->input, 4, SEEK_SET); /* loop through the metadata blocks; use a do-while construct since there * will always be 1 metadata block */ -- cgit v1.2.3 From d9015de7fe7b4cf8aefd8c6da22944595a5ec9c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 3 Mar 2007 00:02:30 +0000 Subject: Use LOG_MODULE in the log messages, so that during copy and paste I don't end up leaving demux_mpgaudio in demux_flac or demux_aac. CVS patchset: 8634 CVS date: 2007/03/03 00:02:30 --- src/demuxers/demux_mpgaudio.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 452c53703..fd79e4215 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpgaudio.c,v 1.148 2007/02/20 00:34:56 dgp85 Exp $ + * $Id: demux_mpgaudio.c,v 1.149 2007/03/03 00:02:30 dgp85 Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -608,10 +608,10 @@ static int demux_mpgaudio_next (demux_mpgaudio_t *this, int decoder_flags, int s } else if ((BE_32(header_buf)) == ID3V22_TAG) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "demux_mpgaudio: ID3V2.2 tag\n"); + LOG_MODULE ": ID3V2.2 tag\n"); if (!id3v22_parse_tag(this->input, this->stream, header_buf)) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "demux_mpgaudio: ID3V2.2 tag parsing error\n"); + LOG_MODULE ": ID3V2.2 tag parsing error\n"); bytes = 1; /* resync */ } else { bytes = 4; @@ -619,10 +619,10 @@ static int demux_mpgaudio_next (demux_mpgaudio_t *this, int decoder_flags, int s } else if ((BE_32(header_buf)) == ID3V23_TAG) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "demux_mpgaudio: ID3V2.3 tag\n"); + LOG_MODULE ": ID3V2.3 tag\n"); if (!id3v23_parse_tag(this->input, this->stream, header_buf)) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "demux_mpgaudio: ID3V2.3 tag parsing error\n"); + LOG_MODULE ": ID3V2.3 tag parsing error\n"); bytes = 1; /* resync */ } else { bytes = 4; @@ -630,10 +630,10 @@ static int demux_mpgaudio_next (demux_mpgaudio_t *this, int decoder_flags, int s } else if ((BE_32(header_buf)) == ID3V24_TAG) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "demux_mpgaudio: ID3V2.4 tag\n"); + LOG_MODULE ": ID3V2.4 tag\n"); if (!id3v24_parse_tag(this->input, this->stream, header_buf)) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "demux_mpgaudio: ID3V2.4 tag parsing error\n"); + LOG_MODULE ": ID3V2.4 tag parsing error\n"); bytes = 1; /* resync */ } else { bytes = 4; -- cgit v1.2.3 From 834fb11173a04fb9febc30e8c0e6c08722114f80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 3 Mar 2007 00:33:51 +0000 Subject: Instead of blindly ignoring the ID3v2 tags, try to parse them. The switch block is repetitive as almost the same is implemented in demux_mpgaudio, so I'll work on that now. CVS patchset: 8635 CVS date: 2007/03/03 00:33:51 --- src/demuxers/demux_aac.c | 64 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_aac.c b/src/demuxers/demux_aac.c index 26a273017..fa7f86b72 100644 --- a/src/demuxers/demux_aac.c +++ b/src/demuxers/demux_aac.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2005 the xine project + * Copyright (C) 2001-2007 the xine project * * This file is part of xine, a free video player. * @@ -21,7 +21,7 @@ * This demuxer detects ADIF and ADTS headers in AAC files. * Then it shovels buffer-sized chunks over to the AAC decoder. * - * $Id: demux_aac.c,v 1.14 2007/03/02 20:07:33 dgp85 Exp $ + * $Id: demux_aac.c,v 1.15 2007/03/03 00:33:51 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -48,6 +48,8 @@ #include "bswap.h" #include "group_audio.h" +#include "id3.h" + typedef struct { demux_plugin_t demux_plugin; @@ -72,29 +74,59 @@ static int open_aac_file(demux_aac_t *this) { uint8_t peak[MAX_PREVIEW_SIZE]; uint16_t syncword = 0; uint32_t id3size = 0; - off_t data_start; + off_t data_start = 0; - /* Check for an ADIF header - should be at the start of the file */ - if (_x_demux_read_header(this->input, peak, 4) != 4) + _x_assert(MAX_PREVIEW_SIZE > 10); + + /* Get enough data to be able to check the size of ID3 tag */ + if (_x_demux_read_header(this->input, peak, 10) != 10) return 0; - /* Skip the ID3v2 tag at the start */ + /* Check if there's an ID3v2 tag at the start */ if ( peak[0] == 'I' && peak[1] == 'D' && peak[2] == '3' ) { + id3size = (peak[6] << 7*3) + (peak[7] << 7*2) + (peak[8] << 7) + peak[9] + 10; + + this->input->seek(this->input, 4, SEEK_SET); + + /* Now parse the tag */ + switch(peak[3]) { + case 2: /* ID3v2.2 */ + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + LOG_MODULE ": ID3V2.2 tag\n"); + if ( ! id3v22_parse_tag(this->input, this->stream, peak) ) + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + LOG_MODULE ": ID3V2.2 tag parsing error\n"); + return 0; + break; - this->input->seek(this->input, 6, SEEK_SET); - if ( this->input->read(this->input, peak, 4) != 4 ) - return 0; - - id3size = (peak[0] << 7*3) + (peak[1] << 7*2) + (peak[2] << 7) + peak[3] + 10; + case 3: /* ID3v2.3 */ + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + LOG_MODULE ": ID3V2.3 tag\n"); + if ( ! id3v23_parse_tag(this->input, this->stream, peak) ) + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + LOG_MODULE ": ID3V2.3 tag parsing error\n"); + break; - lprintf("ID3v2 tag encountered, skipping %u bytes.\n", id3size); + case 4: /* ID3v2.4 */ + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + LOG_MODULE ": ID3V2.4 tag\n"); + if ( ! id3v24_parse_tag(this->input, this->stream, peak) ) + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + LOG_MODULE ": ID3V2.4 tag parsing error\n"); + break; - this->input->seek(this->input, id3size-10, SEEK_CUR); + default: + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + LOG_MODULE ": Unknown ID3v2 version: 0x%02x.\n", peak[3]); + } - if ( this->input->read(this->input, peak, 4) != 4 ) - return 0; + lprintf("ID3v2 tag encountered, skipping %u bytes.\n", id3size); } + if ( this->input->read(this->input, peak, 4) != 4 ) + return 0; + + /* Check for an ADIF header - should be at the start of the file */ if ((peak[0] == 'A') && (peak[1] == 'D') && (peak[2] == 'I') && (peak[3] == 'F')) { lprintf("found ADIF header\n"); @@ -113,8 +145,6 @@ static int open_aac_file(demux_aac_t *this) { MAX_PREVIEW_SIZE) return 0; - data_start = 0; - for (i=0; i<MAX_PREVIEW_SIZE; i++) { if ((syncword & 0xfff6) == 0xfff0) { data_start = i - 2; -- cgit v1.2.3 From 6a16b385d3c32e412e23f9f5d44140d7afd9af79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 3 Mar 2007 00:58:52 +0000 Subject: Add a function to parse a generic ID3v2 tag, and make both demux_aac and demux_mpgaudio use it without repeating the same code. CVS patchset: 8636 CVS date: 2007/03/03 00:58:52 --- src/demuxers/demux_aac.c | 38 ++++---------------------------------- src/demuxers/demux_mpgaudio.c | 33 ++++----------------------------- src/demuxers/id3.c | 32 +++++++++++++++++++++++++++++++- src/demuxers/id3.h | 8 +++++++- 4 files changed, 46 insertions(+), 65 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_aac.c b/src/demuxers/demux_aac.c index fa7f86b72..dedcaca8a 100644 --- a/src/demuxers/demux_aac.c +++ b/src/demuxers/demux_aac.c @@ -21,7 +21,7 @@ * This demuxer detects ADIF and ADTS headers in AAC files. * Then it shovels buffer-sized chunks over to the AAC decoder. * - * $Id: demux_aac.c,v 1.15 2007/03/03 00:33:51 dgp85 Exp $ + * $Id: demux_aac.c,v 1.16 2007/03/03 00:58:52 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -37,9 +37,9 @@ #define LOG_MODULE "demux_aac" #define LOG_VERBOSE - +/* #define LOG - +*/ #include "xine_internal.h" #include "xineutils.h" @@ -88,37 +88,7 @@ static int open_aac_file(demux_aac_t *this) { this->input->seek(this->input, 4, SEEK_SET); - /* Now parse the tag */ - switch(peak[3]) { - case 2: /* ID3v2.2 */ - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - LOG_MODULE ": ID3V2.2 tag\n"); - if ( ! id3v22_parse_tag(this->input, this->stream, peak) ) - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - LOG_MODULE ": ID3V2.2 tag parsing error\n"); - return 0; - break; - - case 3: /* ID3v2.3 */ - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - LOG_MODULE ": ID3V2.3 tag\n"); - if ( ! id3v23_parse_tag(this->input, this->stream, peak) ) - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - LOG_MODULE ": ID3V2.3 tag parsing error\n"); - break; - - case 4: /* ID3v2.4 */ - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - LOG_MODULE ": ID3V2.4 tag\n"); - if ( ! id3v24_parse_tag(this->input, this->stream, peak) ) - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - LOG_MODULE ": ID3V2.4 tag parsing error\n"); - break; - - default: - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - LOG_MODULE ": Unknown ID3v2 version: 0x%02x.\n", peak[3]); - } + id3v2_parse_tag(this->input, this->stream, peak); lprintf("ID3v2 tag encountered, skipping %u bytes.\n", id3size); } diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index fd79e4215..b9f35c17d 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpgaudio.c,v 1.149 2007/03/03 00:02:30 dgp85 Exp $ + * $Id: demux_mpgaudio.c,v 1.150 2007/03/03 00:58:52 dgp85 Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -606,39 +606,14 @@ static int demux_mpgaudio_next (demux_mpgaudio_t *this, int decoder_flags, int s return parse_frame_payload(this, header_buf, decoder_flags); - } else if ((BE_32(header_buf)) == ID3V22_TAG) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - LOG_MODULE ": ID3V2.2 tag\n"); - if (!id3v22_parse_tag(this->input, this->stream, header_buf)) { + } else if ( header_buf[0] == 'I' && header_buf[1] == 'D' && header_buf[2] == '3' ) { + if (!id3v2_parse_tag(this->input, this->stream, header_buf)) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - LOG_MODULE ": ID3V2.2 tag parsing error\n"); + LOG_MODULE ": ID3V2 tag parsing error\n"); bytes = 1; /* resync */ } else { bytes = 4; } - - } else if ((BE_32(header_buf)) == ID3V23_TAG) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - LOG_MODULE ": ID3V2.3 tag\n"); - if (!id3v23_parse_tag(this->input, this->stream, header_buf)) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - LOG_MODULE ": ID3V2.3 tag parsing error\n"); - bytes = 1; /* resync */ - } else { - bytes = 4; - } - - } else if ((BE_32(header_buf)) == ID3V24_TAG) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - LOG_MODULE ": ID3V2.4 tag\n"); - if (!id3v24_parse_tag(this->input, this->stream, header_buf)) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - LOG_MODULE ": ID3V2.4 tag parsing error\n"); - bytes = 1; /* resync */ - } else { - bytes = 4; - } - } else { /* skip */ bytes = 1; diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index ffa022a59..b707166b6 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -29,7 +29,7 @@ * * ID3v2 specs: http://www.id3.org/ * - * $Id: id3.c,v 1.12 2006/04/05 22:12:18 valtri Exp $ + * $Id: id3.c,v 1.13 2007/03/03 00:58:52 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -878,3 +878,33 @@ int id3v24_parse_tag(input_plugin_t *input, return 0; } } + +int id3v2_parse_tag(input_plugin_t *input, + xine_stream_t *stream, + int8_t *mp3_frame_header) { + _x_assert(mp3_frame_header[0] == 'I' && mp3_frame_header[1] == 'D' && mp3_frame_header[2] == '3'); + + int result = 0; + + switch(mp3_frame_header[3]) { + case 2: + xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.2 tag\n"); + result = id3v22_parse_tag(input, stream, mp3_frame_header); + break; + + case 3: + xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.3 tag\n"); + result = id3v23_parse_tag(input, stream, mp3_frame_header); + break; + + case 4: + xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.3 tag\n"); + result = id3v24_parse_tag(input, stream, mp3_frame_header); + break; + + default: + xprintf(stream->xine, XINE_VERBOSITY_LOG, "Unknown ID3v2 version: 0x%02x.\n", mp3_frame_header[3]); + } + + return result; +} diff --git a/src/demuxers/id3.h b/src/demuxers/id3.h index 2d8970ea7..394488858 100644 --- a/src/demuxers/id3.h +++ b/src/demuxers/id3.h @@ -21,7 +21,7 @@ * * Supported versions: v1, v1.1, v2.2, v2.3, v2.4 * - * $Id: id3.h,v 1.4 2005/09/15 18:45:15 tmattern Exp $ + * $Id: id3.h,v 1.5 2007/03/03 00:58:52 dgp85 Exp $ */ #ifndef ID3_H @@ -38,6 +38,7 @@ #define ID3V24_TAG FOURCC_TAG('I', 'D', '3', 4) /* id3 v2.4 header tag */ #define ID3V24_FOOTER_TAG FOURCC_TAG('3', 'D', 'I', 0) /* id3 v2.4 footer tag */ + /* * ID3 v2.2 */ @@ -164,4 +165,9 @@ int id3v24_parse_tag(input_plugin_t *input, xine_stream_t *stream, int8_t *mp3_frame_header); +/* Generic function that switch between the three above */ +int id3v2_parse_tag(input_plugin_t *input, + xine_stream_t *stream, + int8_t *mp3_frame_header); + #endif /* ID3_H */ -- cgit v1.2.3 From 5ff2be1b878d481cbfcce5f41a5fb679c45824ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 3 Mar 2007 01:41:16 +0000 Subject: Add two extra functions (inline as they are just a return statement) that checks if a preamble is of an ID3v2 tag, and that calculate the size of the tag (to avoid repeating the same code over and over and over; the size of the shared object is reduced. Also make demux_flac use the id3.c functions to parse the eventual ID3 header. CVS patchset: 8637 CVS date: 2007/03/03 01:41:16 --- src/demuxers/demux_aac.c | 6 +++--- src/demuxers/demux_flac.c | 26 +++++++++++++------------- src/demuxers/demux_mpgaudio.c | 11 ++++------- src/demuxers/id3.h | 19 +++++++++++++++++-- 4 files changed, 37 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_aac.c b/src/demuxers/demux_aac.c index dedcaca8a..ab71e8382 100644 --- a/src/demuxers/demux_aac.c +++ b/src/demuxers/demux_aac.c @@ -21,7 +21,7 @@ * This demuxer detects ADIF and ADTS headers in AAC files. * Then it shovels buffer-sized chunks over to the AAC decoder. * - * $Id: demux_aac.c,v 1.16 2007/03/03 00:58:52 dgp85 Exp $ + * $Id: demux_aac.c,v 1.17 2007/03/03 01:41:16 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -83,8 +83,8 @@ static int open_aac_file(demux_aac_t *this) { return 0; /* Check if there's an ID3v2 tag at the start */ - if ( peak[0] == 'I' && peak[1] == 'D' && peak[2] == '3' ) { - id3size = (peak[6] << 7*3) + (peak[7] << 7*2) + (peak[8] << 7) + peak[9] + 10; + if ( id3v2_istag(peak) ) { + id3size = id3v2_tagsize(&peak[6]); this->input->seek(this->input, 4, SEEK_SET); diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c index 259f4d4e9..c9e3f911a 100644 --- a/src/demuxers/demux_flac.c +++ b/src/demuxers/demux_flac.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2004 the xine project + * Copyright (C) 2000-2007 the xine project * * This file is part of xine, a free video player. * @@ -23,7 +23,7 @@ * For more information on the FLAC file format, visit: * http://flac.sourceforge.net/ * - * $Id: demux_flac.c,v 1.15 2007/03/02 23:46:29 dgp85 Exp $ + * $Id: demux_flac.c,v 1.16 2007/03/03 01:41:16 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -49,6 +49,7 @@ #include "bswap.h" #include "group_audio.h" +#include "id3.h" #include "flacutils.h" typedef struct { @@ -81,7 +82,7 @@ typedef struct { * It returns 1 if flac file was opened successfully. */ static int open_flac_file(demux_flac_t *flac) { - unsigned char preamble[4]; + unsigned char preamble[10]; unsigned int block_length; unsigned char buffer[FLAC_SEEKPOINT_SIZE]; unsigned char *streaminfo = flac->streaminfo + sizeof(xine_waveformatex); @@ -89,8 +90,9 @@ static int open_flac_file(demux_flac_t *flac) { flac->seekpoints = NULL; - /* fetch the file signature */ - if ( flac->input->read(flac->input, preamble, 4) != 4 ) + /* fetch the file signature, get enough bytes so that id3 can also + be skipped and/or parsed */ + if (_x_demux_read_header(flac->input, preamble, 10) != 10) return 0; /* Unfortunately some FLAC files have an ID3 flag prefixed on them @@ -98,7 +100,7 @@ static int open_flac_file(demux_flac_t *flac) { * users use them and want them working, so check and skip the ID3 * tag if present. */ - if ( preamble[0] == 'I' && preamble[1] == 'D' && preamble[2] == '3' ) { + if ( id3v2_istag(preamble) ) { uint32_t id3size; /* First 3 bytes are the ID3 signature as above, then comes two bytes @@ -109,18 +111,16 @@ static int open_flac_file(demux_flac_t *flac) { * is encoded as four bytes.. but only 7 out of 8 bits of every byte is * used... don't ask. */ - flac->input->seek(flac->input, 6, SEEK_SET); - if ( flac->input->read(flac->input, preamble, 4) != 4 ) - return 0; + id3size = id3v2_tagsize(&preamble[6]); - id3size = (preamble[0] << 7*3) + (preamble[1] << 7*2) + - (preamble[2] << 7) + preamble[3]; + id3v2_parse_tag(flac->input, flac->stream, preamble); - flac->input->seek(flac->input, id3size, SEEK_CUR); + flac->input->seek(flac->input, id3size, SEEK_SET); if ( flac->input->read(flac->input, preamble, 4) != 4 ) return 0; - } + } else + flac->input->seek(flac->input, 4, SEEK_SET); /* validate signature */ if ((preamble[0] != 'f') || (preamble[1] != 'L') || diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index b9f35c17d..6c0b6031c 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2003 the xine project + * Copyright (C) 2000-2007 the xine project * * This file is part of xine, a free video player. * @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpgaudio.c,v 1.150 2007/03/03 00:58:52 dgp85 Exp $ + * $Id: demux_mpgaudio.c,v 1.151 2007/03/03 01:41:16 dgp85 Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -606,7 +606,7 @@ static int demux_mpgaudio_next (demux_mpgaudio_t *this, int decoder_flags, int s return parse_frame_payload(this, header_buf, decoder_flags); - } else if ( header_buf[0] == 'I' && header_buf[1] == 'D' && header_buf[2] == '3' ) { + } else if ( id3v2_istag(header_buf) ) { if (!id3v2_parse_tag(this->input, this->stream, header_buf)) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": ID3V2 tag parsing error\n"); @@ -693,10 +693,7 @@ static int detect_mpgaudio_file(input_plugin_t *input) { * flac files can contain id3v2 tags */ uint8_t *ptr = &buf[6]; - uint32_t tag_size = ((uint32_t)ptr[0] << 21) + - ((uint32_t)ptr[1] << 14) + - ((uint32_t)ptr[2] << 7) + - (uint32_t)ptr[3]; + uint32_t tag_size = id3v2_tagsize(ptr); lprintf("try to skip id3v2 tag (%d bytes)\n", tag_size); if ((10 + tag_size) >= preview_len) { lprintf("cannot skip id3v2 tag\n"); diff --git a/src/demuxers/id3.h b/src/demuxers/id3.h index 394488858..9d08f6817 100644 --- a/src/demuxers/id3.h +++ b/src/demuxers/id3.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2003 the xine project + * Copyright (C) 2000-2007 the xine project * * This file is part of xine, a free video player. * @@ -21,7 +21,7 @@ * * Supported versions: v1, v1.1, v2.2, v2.3, v2.4 * - * $Id: id3.h,v 1.5 2007/03/03 00:58:52 dgp85 Exp $ + * $Id: id3.h,v 1.6 2007/03/03 01:41:16 dgp85 Exp $ */ #ifndef ID3_H @@ -170,4 +170,19 @@ int id3v2_parse_tag(input_plugin_t *input, xine_stream_t *stream, int8_t *mp3_frame_header); +static inline int id3v2_istag(uint8_t *ptr) { + return + (ptr[0] == 'I') && + (ptr[1] == 'D') && + (ptr[2] == '3'); +} + +static inline uint32_t id3v2_tagsize(uint8_t *ptr) { + return + ((uint32_t)ptr[0] << 21) + + ((uint32_t)ptr[1] << 14) + + ((uint32_t)ptr[2] << 7) + + (uint32_t)ptr[3]; +} + #endif /* ID3_H */ -- cgit v1.2.3 From 6405b0b5dcf375b3369285ae0bbf457d58fe13c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 3 Mar 2007 02:06:09 +0000 Subject: Reduce priority of aac demuxer, so that it doesn't crash when playing online streams that are mp3s (as well as other nasty things that happened before). CVS patchset: 8638 CVS date: 2007/03/03 02:06:09 --- src/demuxers/group_audio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/group_audio.c b/src/demuxers/group_audio.c index bd8a291bb..b8f0e1ed4 100644 --- a/src/demuxers/group_audio.c +++ b/src/demuxers/group_audio.c @@ -19,7 +19,7 @@ * * This file contains plugin entries for several demuxers used in games * - * $Id: group_audio.c,v 1.25 2006/12/26 16:59:55 dgp85 Exp $ + * $Id: group_audio.c,v 1.26 2007/03/03 02:06:09 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -36,7 +36,7 @@ */ static const demuxer_info_t demux_info_aac = { - 0 /* priority */ + -1 /* priority */ }; static const demuxer_info_t demux_info_ac3 = { -- cgit v1.2.3 From 3b912e24785aff75d9dbbb8d31840e094ee95c14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 3 Mar 2007 13:33:34 +0000 Subject: Instead of using a padding of arbitrary 32-bits by hand, use memset with the constant used to provide the padding size. CVS patchset: 8640 CVS date: 2007/03/03 13:33:34 --- src/libffmpeg/video_decoder.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/libffmpeg/video_decoder.c b/src/libffmpeg/video_decoder.c index 446a6ca9e..ddab37264 100644 --- a/src/libffmpeg/video_decoder.c +++ b/src/libffmpeg/video_decoder.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2004 the xine project + * Copyright (C) 2001-2007 the xine project * * This file is part of xine, a free video player. * @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_decoder.c,v 1.69 2007/01/21 15:12:21 klan Exp $ + * $Id: video_decoder.c,v 1.70 2007/03/03 13:33:34 dgp85 Exp $ * * xine video decoder plugin using ffmpeg * @@ -1140,10 +1140,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { /* note: bitstream, alt bitstream reader or something will cause * severe mpeg4 artifacts if padding is less than 32 bits. */ - chunk_buf[this->size+0] = 0; - chunk_buf[this->size+1] = 0; - chunk_buf[this->size+2] = 0; - chunk_buf[this->size+3] = 0; + memset(&chunk_buf[this->size], 0, FF_INPUT_BUFFER_PADDING_SIZE); while (this->size > 0) { -- cgit v1.2.3 From 58b8867f0e7e20ae37cb8343bcb8ea912a0d1ae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 3 Mar 2007 14:12:50 +0000 Subject: Free the FreeType object when freeing the OSD object, should solve a possible memory leak. CVS patchset: 8641 CVS date: 2007/03/03 14:12:50 --- src/xine-engine/osd.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index 229a9ad37..3d4f9dabf 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -1481,7 +1481,14 @@ static void osd_free_object (osd_object_t *osd_to_close) { while( osd ) { if ( osd == osd_to_close ) { free( osd->area ); - if( osd->ft2 ) free( osd->ft2 ); + + if( osd->ft2 ) { + if ( osd->ft2->library ) + FT_Done_FreeType(osd->ft2->library); + + free( osd->ft2 ); + } + osd_free_encoding(osd); if( last ) -- cgit v1.2.3 From 47ac04e99dbcebf8d7d1f8e7f96ee20d8fe66317 Mon Sep 17 00:00:00 2001 From: Darren Salt <linux@youmustbejoking.demon.co.uk> Date: Sat, 3 Mar 2007 22:59:37 +0000 Subject: Fix a build error, introduced in the previous commit, which bites when building without Freetype support. CVS patchset: 8642 CVS date: 2007/03/03 22:59:37 --- src/xine-engine/osd.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index 3d4f9dabf..b33d81f6e 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -1482,12 +1482,14 @@ static void osd_free_object (osd_object_t *osd_to_close) { if ( osd == osd_to_close ) { free( osd->area ); +#ifdef HAVE_FT2 if( osd->ft2 ) { if ( osd->ft2->library ) FT_Done_FreeType(osd->ft2->library); free( osd->ft2 ); } +#endif osd_free_encoding(osd); -- cgit v1.2.3 From 0f487297ae72bc48e33b4b5923921a1b43eb445f Mon Sep 17 00:00:00 2001 From: Bastien Nocera <hadess@users.sourceforge.net> Date: Sun, 4 Mar 2007 16:19:12 +0000 Subject: - commit documentation, and header changes for the relicensing of the xine-lib XML parser to GNU LGPL CVS patchset: 8643 CVS date: 2007/03/04 16:19:12 --- src/xine-utils/xmllexer.c | 35 +++++++++++++++++++++-------------- src/xine-utils/xmllexer.h | 31 ++++++++++++++++++------------- src/xine-utils/xmlparser.c | 41 +++++++++++++++++++++++------------------ src/xine-utils/xmlparser.h | 34 ++++++++++++++++++++-------------- 4 files changed, 82 insertions(+), 59 deletions(-) (limited to 'src') diff --git a/src/xine-utils/xmllexer.c b/src/xine-utils/xmllexer.c index cc112b64a..575c37611 100644 --- a/src/xine-utils/xmllexer.c +++ b/src/xine-utils/xmllexer.c @@ -1,23 +1,24 @@ /* - * Copyright (C) 2002-2003 the xine project + * Copyright (C) 2002-2003,2007 the xine project * * This file is part of xine, a free video player. * - * xine 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. - * - * xine 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. + * The xine-lib XML parser is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * The xine-lib XML parser 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 + * Library General Public License for more details. * - * $Id: xmllexer.c,v 1.12 2006/06/20 00:35:08 dgp85 Exp $ + * You should have received a copy of the GNU Library General Public + * License along with the Gnome Library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * $Id: xmllexer.c,v 1.13 2007/03/04 16:19:12 hadess Exp $ * */ @@ -27,11 +28,17 @@ #define LOG */ +#ifdef XINE_COMPILE #include "xineutils.h" +#else +#define lprintf(...) +#define xine_xmalloc malloc +#endif #include "xmllexer.h" #include <stdio.h> #include <ctype.h> #include <string.h> +#include <stdlib.h> /* private constants*/ #define NORMAL 0 /* normal lex mode */ diff --git a/src/xine-utils/xmllexer.h b/src/xine-utils/xmllexer.h index bd69204ff..5a217fcd8 100644 --- a/src/xine-utils/xmllexer.h +++ b/src/xine-utils/xmllexer.h @@ -1,23 +1,24 @@ /* - * Copyright (C) 2002-2003 the xine project + * Copyright (C) 2002-2003,2007 the xine project * * This file is part of xine, a free video player. * - * xine 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. + * The xine-lib XML parser is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * - * xine 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. + * The xine-lib XML parser 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 + * Library 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * You should have received a copy of the GNU Library General Public + * License along with the Gnome Library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. * - * $Id: xmllexer.h,v 1.7 2006/09/26 05:19:49 dgp85 Exp $ + * $Id: xmllexer.h,v 1.8 2007/03/04 16:19:12 hadess Exp $ * */ @@ -25,6 +26,10 @@ #ifndef XML_LEXER_H #define XML_LEXER_H +#ifndef XINE_PROTECTED +#define XINE_PROTECTED +#endif + /* public constants */ #define T_ERROR -1 /* lexer error */ #define T_EOF 0 /* end of file */ diff --git a/src/xine-utils/xmlparser.c b/src/xine-utils/xmlparser.c index 2e8c84ae0..47096705a 100644 --- a/src/xine-utils/xmlparser.c +++ b/src/xine-utils/xmlparser.c @@ -1,24 +1,24 @@ /* - * Copyright (C) 2002-2003 the xine project + * Copyright (C) 2002-2003,2007 the xine project * * This file is part of xine, a free video player. - * This file is part of gxine, a free video player. * - * xine 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. + * The xine-lib XML parser is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * - * xine 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. + * The xine-lib XML parser 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 + * Library 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * You should have received a copy of the GNU Library General Public + * License along with the Gnome Library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. * - * $Id: xmlparser.c,v 1.15 2006/02/14 02:25:01 dsalt Exp $ + * $Id: xmlparser.c,v 1.16 2007/03/04 16:19:12 hadess Exp $ * */ @@ -35,7 +35,12 @@ #define LOG */ +#ifdef XINE_COMPILE #include "xineutils.h" +#else +#define lprintf(...) +#define xine_xmalloc malloc +#endif #include "xmllexer.h" #include "xmlparser.h" @@ -466,7 +471,7 @@ int xml_parser_build_tree(xml_node_t **root_node) { return res; } -char *xml_parser_get_property (const xml_node_t *node, const char *name) { +const char *xml_parser_get_property (const xml_node_t *node, const char *name) { xml_property_t *prop; @@ -489,8 +494,8 @@ char *xml_parser_get_property (const xml_node_t *node, const char *name) { int xml_parser_get_property_int (const xml_node_t *node, const char *name, int def_value) { - char *v; - int ret; + const char *v; + int ret; v = xml_parser_get_property (node, name); @@ -506,7 +511,7 @@ int xml_parser_get_property_int (const xml_node_t *node, const char *name, int xml_parser_get_property_bool (const xml_node_t *node, const char *name, int def_value) { - char *v; + const char *v; v = xml_parser_get_property (node, name); diff --git a/src/xine-utils/xmlparser.h b/src/xine-utils/xmlparser.h index a19c81ec3..f202ca28d 100644 --- a/src/xine-utils/xmlparser.h +++ b/src/xine-utils/xmlparser.h @@ -1,28 +1,34 @@ /* - * Copyright (C) 2002-2003 the xine project + * Copyright (C) 2002-2003,2007 the xine project * * This file is part of xine, a free video player. * - * xine 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. + * The xine-lib XML parser is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. * - * xine 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. + * The xine-lib XML parser 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 + * Library 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * You should have received a copy of the GNU Library General Public + * License along with the Gnome Library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. * - * $Id: xmlparser.h,v 1.5 2006/09/26 05:19:49 dgp85 Exp $ + * $Id: xmlparser.h,v 1.6 2007/03/04 16:19:12 hadess Exp $ * */ + #ifndef XML_PARSER_H #define XML_PARSER_H +#ifndef XINE_PROTECTED +#define XINE_PROTECTED +#endif + /* parser modes */ #define XML_PARSER_CASE_INSENSITIVE 0 #define XML_PARSER_CASE_SENSITIVE 1 @@ -54,7 +60,7 @@ int xml_parser_build_tree(xml_node_t **root_node) XINE_PROTECTED; void xml_parser_free_tree(xml_node_t *root_node) XINE_PROTECTED; -char *xml_parser_get_property (const xml_node_t *node, const char *name) XINE_PROTECTED; +const char *xml_parser_get_property (const xml_node_t *node, const char *name) XINE_PROTECTED; int xml_parser_get_property_int (const xml_node_t *node, const char *name, int def_value) XINE_PROTECTED; int xml_parser_get_property_bool (const xml_node_t *node, const char *name, -- cgit v1.2.3 From 2a8f6c603154dd97d4aa82a649d66e3b0156a79d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 9 Mar 2007 23:18:19 +0000 Subject: Test presence of alloca.h and include it if present; suggested by a patch from Albert Lee. The check is needed to work on FreeBSD. CVS patchset: 8644 CVS date: 2007/03/09 23:18:19 --- src/demuxers/demux_asf.c | 5 ++++- src/libw32dll/wine/pe_image.c | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index 067889ad5..65838138f 100644 --- a/src/demuxers/demux_asf.c +++ b/src/demuxers/demux_asf.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_asf.c,v 1.193 2007/02/20 00:34:55 dgp85 Exp $ + * $Id: demux_asf.c,v 1.194 2007/03/09 23:18:19 dgp85 Exp $ * * demultiplexer for asf streams * @@ -38,6 +38,9 @@ #include <unistd.h> #include <string.h> #include <stdlib.h> +#ifdef HAVE_ALLOCA_H +#include <alloca.h> +#endif #define LOG_MODULE "demux_asf" #define LOG_VERBOSE diff --git a/src/libw32dll/wine/pe_image.c b/src/libw32dll/wine/pe_image.c index 92017f906..aa29098c1 100644 --- a/src/libw32dll/wine/pe_image.c +++ b/src/libw32dll/wine/pe_image.c @@ -47,6 +47,9 @@ #ifdef HAVE_SYS_MMAN_H #include <sys/mman.h> #endif +#ifdef HAVE_ALLOCA_H +#include <alloca.h> +#endif #include "windef.h" #include "winbase.h" #include "winerror.h" -- cgit v1.2.3 From 82ad2e8f5b9c80e6696d9298cda365c9ff6421a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 9 Mar 2007 23:49:35 +0000 Subject: Declare sysi86() function only if it's not declared already. Patch by Albert Lee. CVS patchset: 8648 CVS date: 2007/03/09 23:49:35 --- src/libw32dll/wine/ldt_keeper.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libw32dll/wine/ldt_keeper.c b/src/libw32dll/wine/ldt_keeper.c index 11711ce62..7f7169b86 100644 --- a/src/libw32dll/wine/ldt_keeper.c +++ b/src/libw32dll/wine/ldt_keeper.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: ldt_keeper.c,v 1.15 2006/05/07 09:31:57 valtri Exp $ + * $Id: ldt_keeper.c,v 1.16 2007/03/09 23:49:35 dgp85 Exp $ * * * contents: @@ -54,6 +54,7 @@ /* applied some modification to make make our xine friend more happy */ #include "ldt_keeper.h" +#include "config.h" #include <string.h> #include <stdlib.h> @@ -90,6 +91,7 @@ int modify_ldt(int func, void *ptr, unsigned long bytecount); #include <sys/sysi86.h> /* solaris x86: add missing prototype for sysi86() */ +#ifndef HAVE_SYSI86 #ifdef __cplusplus extern "C" { #endif @@ -97,6 +99,7 @@ int sysi86(int, void*); #ifdef __cplusplus } #endif +#endif #ifndef NUMSYSLDTS /* SunOS 2.5.1 does not define NUMSYSLDTS */ #define NUMSYSLDTS 6 /* Let's hope the SunOS 5.8 value is OK */ -- cgit v1.2.3 From 2e838fda7362ad4d2d42f545d585992a91cbd429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 9 Mar 2007 23:53:06 +0000 Subject: Fix X11 linkage for pgx modules. Patch by Albert Lee. CVS patchset: 8649 CVS date: 2007/03/09 23:53:06 --- src/video_out/Makefile.am | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index 041184e8c..f25495495 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -145,13 +145,13 @@ xineplug_vo_out_syncfb_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_vo_out_syncfb_la_LDFLAGS = -avoid-version -module xineplug_vo_out_pgx64_la_SOURCES = video_out_pgx64.c -xineplug_vo_out_pgx64_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(SUNDGA_LIBS) $(THREAD_LIBS) -xineplug_vo_out_pgx64_la_CFLAGS = $(VISIBILITY_FLAG) +xineplug_vo_out_pgx64_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(X_PRE_LIBS) -lX11 $(SUNDGA_LIBS) $(THREAD_LIBS) +xineplug_vo_out_pgx64_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) xineplug_vo_out_pgx64_la_LDFLAGS = -avoid-version -module xineplug_vo_out_pgx32_la_SOURCES = video_out_pgx32.c -xineplug_vo_out_pgx32_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(SUNDGA_LIBS) $(THREAD_LIBS) -xineplug_vo_out_pgx32_la_CFLAGS = $(VISIBILITY_FLAG) +xineplug_vo_out_pgx32_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(X_PRE_LIBS) -lX11 $(SUNDGA_LIBS) $(THREAD_LIBS) +xineplug_vo_out_pgx32_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) xineplug_vo_out_pgx32_la_LDFLAGS = -avoid-version -module xineplug_vo_out_vidix_la_SOURCES = video_out_vidix.c $(X11OSD) -- cgit v1.2.3 From 4598c665000ac50dc8a4da4fbf05d655b7ea7084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 9 Mar 2007 23:55:18 +0000 Subject: Properly pass XV_CFLAGS where needed. Patch by Albert Lee. CVS patchset: 8650 CVS date: 2007/03/09 23:55:18 --- src/video_out/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index f25495495..7c163e37d 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -118,18 +118,18 @@ xineplug_vo_out_xshm_la_LDFLAGS = -avoid-version -module xineplug_vo_out_xv_la_SOURCES = $(X11OSD) deinterlace.c video_out_xv.c xineplug_vo_out_xv_la_LIBADD = $(XV_LIBS) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) -xineplug_vo_out_xv_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) -fno-strict-aliasing +xineplug_vo_out_xv_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(XV_CFLAGS) -fno-strict-aliasing xineplug_vo_out_xv_la_LDFLAGS = -avoid-version -module xineplug_vo_out_xvmc_la_SOURCES = deinterlace.c video_out_xvmc.c xineplug_vo_out_xvmc_la_LIBADD = $(XVMC_LIBS) $(XV_LIBS) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) -xineplug_vo_out_xvmc_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) +xineplug_vo_out_xvmc_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(XV_CFLAGS) xineplug_vo_out_xvmc_la_LDFLAGS = -avoid-version -module xineplug_vo_out_xxmc_la_SOURCES = $(X11OSD) deinterlace.c video_out_xxmc.c\ xvmc_mocomp.c xvmc_vld.c xxmc.h xineplug_vo_out_xxmc_la_LIBADD = $(XXMC_LIBS) $(XV_LIBS) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) -xineplug_vo_out_xxmc_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) -fno-strict-aliasing +xineplug_vo_out_xxmc_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(XV_CFLAGS) -fno-strict-aliasing xineplug_vo_out_xxmc_la_LDFLAGS = -avoid-version -module xineplug_vo_out_opengl_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ -- cgit v1.2.3 From dc9b368b5535812336b715656f809f7f4fa63456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 9 Mar 2007 23:56:42 +0000 Subject: Use OSS 3.0 API, and retain compatibility with older versions. Patch by Albert Lee. CVS patchset: 8651 CVS date: 2007/03/09 23:56:42 --- src/audio_out/audio_oss_out.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c index 366fa250c..ccb142eb5 100644 --- a/src/audio_out/audio_oss_out.c +++ b/src/audio_out/audio_oss_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_oss_out.c,v 1.117 2006/07/16 16:18:09 dsalt Exp $ + * $Id: audio_oss_out.c,v 1.118 2007/03/09 23:56:42 dgp85 Exp $ * * 20-8-2001 First implementation of Audio sync and Audio driver separation. * Copyright (C) 2001 James Courtier-Dutton James@superbug.demon.co.uk @@ -75,6 +75,16 @@ #include <sys/time.h> +#ifndef SNDCTL_DSP_SETFMT +/* Deprecated OSS API */ +#define SNDCTL_DSP_SETFMT SOUND_PCM_SETFMT +#endif + +#ifndef SNDCTL_DSP_SPEED +/* Deprecated OSS API */ +#define SNDCTL_DSP_SPEED SOUND_PCM_WRITE_RATE +#endif + #ifndef AFMT_S16_NE # if defined(sparc) || defined(__sparc__) || defined(PPC) /* Big endian machines */ @@ -789,9 +799,9 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da */ arg = AFMT_S16_NE; - status = ioctl(audio_fd, SOUND_PCM_SETFMT, &arg); + status = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &arg); arg = 44100; - status = ioctl(audio_fd, SOUND_PCM_WRITE_RATE, &arg); + status = ioctl(audio_fd, SNDCTL_DSP_SPEED, &arg); /* * find out which sync method to use @@ -903,12 +913,12 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da this->capabilities = 0; arg = AFMT_U8; - if( ioctl(audio_fd, SOUND_PCM_SETFMT, &arg) != -1 && arg == AFMT_U8) + if( ioctl(audio_fd, SNDCTL_DSP_SETFMT, &arg) != -1 && arg == AFMT_U8) this->capabilities |= AO_CAP_8BITS; /* switch back to 16bits, because some soundcards otherwise do not report all their capabilities */ arg = AFMT_S16_NE; - if (ioctl(audio_fd, SOUND_PCM_SETFMT, &arg) == -1 || arg != AFMT_S16_NE) { + if (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &arg) == -1 || arg != AFMT_S16_NE) { xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: switching the soundcard to 16 bits mode failed\n"); free(this); close(audio_fd); -- cgit v1.2.3 From 2441582907d74b286f4d9157b5953f6bdb99a491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 10 Mar 2007 00:12:21 +0000 Subject: Use xineplug_LTLIBRARIES rather than lib_LTLIBRARIES so there's no need to rewrite libdir, and set AM_LDFLAGS to $(xineplug_ldflags) so that -Wl,-z,defs will be used, for the xine plugins only (libdha's plugins won't be touched by this). In the case vidix is still getting failures (no way to test here), just set back _LDFLAGS for *that* plugin as they were before, and it would be skipped. CVS patchset: 8652 CVS date: 2007/03/10 00:12:21 --- src/video_out/Makefile.am | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index 7c163e37d..41db59fe5 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -1,6 +1,7 @@ include $(top_srcdir)/misc/Makefile.common AM_CPPFLAGS = -DXINE_COMPILE +AM_LDFLAGS = $(xineplug_ldflags) SUBDIRS = libdha vidix macosx @@ -9,8 +10,6 @@ EXTRA_DIST = video_out_directfb.c video_out_directx.c video_out_macosx.m VIDIX_CFLAGS = -I$(top_builddir)/src/video_out/vidix \ -I$(top_srcdir)/src/video_out/vidix -libdir = $(XINE_PLUGINDIR) - if HAVE_X11 X11OSD = x11osd.c xshm_module = xineplug_vo_out_xshm.la @@ -83,7 +82,7 @@ if HAVE_MACOSX_VIDEO macosx_module = xineplug_vo_out_macosx.la endif -lib_LTLIBRARIES = $(xshm_module) $(xv_module) $(xvmc_module) \ +xineplug_LTLIBRARIES = $(xshm_module) $(xv_module) $(xvmc_module) \ $(opengl_module) \ $(syncfb_module) \ $(pgx64_module) $(pgx32_module)\ @@ -103,105 +102,86 @@ lib_LTLIBRARIES = $(xshm_module) $(xv_module) $(xvmc_module) \ xineplug_vo_out_xcbshm_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c video_out_xcbshm.c $(XCBOSD) xineplug_vo_out_xcbshm_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) $(THREAD_LIBS) $(XCB_LIBS) $(XCBSHM_LIBS) xineplug_vo_out_xcbshm_la_CFLAGS = $(VISIBILITY_FLAG) $(MLIB_CFLAGS) $(XCB_CFLAGS) $(XCBSHM_CFLAGS) -xineplug_vo_out_xcbshm_la_LDFLAGS = -avoid-version -module xineplug_vo_out_xcbxv_la_SOURCES = deinterlace.c video_out_xcbxv.c $(XCBOSD) xineplug_vo_out_xcbxv_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) $(XCBXV_LIBS) $(XCB_LIBS) xineplug_vo_out_xcbxv_la_CFLAGS = $(VISIBILITY_FLAG) $(XCB_CFLAGS) $(XCBXV_CFLAGS) -xineplug_vo_out_xcbxv_la_LDFLAGS = -avoid-version -module xineplug_vo_out_xshm_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ video_out_xshm.c $(X11OSD) xineplug_vo_out_xshm_la_LIBADD = $(MLIB_LIBS) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_xshm_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(MLIB_CFLAGS) -fno-strict-aliasing -xineplug_vo_out_xshm_la_LDFLAGS = -avoid-version -module xineplug_vo_out_xv_la_SOURCES = $(X11OSD) deinterlace.c video_out_xv.c xineplug_vo_out_xv_la_LIBADD = $(XV_LIBS) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_xv_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(XV_CFLAGS) -fno-strict-aliasing -xineplug_vo_out_xv_la_LDFLAGS = -avoid-version -module xineplug_vo_out_xvmc_la_SOURCES = deinterlace.c video_out_xvmc.c xineplug_vo_out_xvmc_la_LIBADD = $(XVMC_LIBS) $(XV_LIBS) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_xvmc_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(XV_CFLAGS) -xineplug_vo_out_xvmc_la_LDFLAGS = -avoid-version -module xineplug_vo_out_xxmc_la_SOURCES = $(X11OSD) deinterlace.c video_out_xxmc.c\ xvmc_mocomp.c xvmc_vld.c xxmc.h xineplug_vo_out_xxmc_la_LIBADD = $(XXMC_LIBS) $(XV_LIBS) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_xxmc_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(XV_CFLAGS) -fno-strict-aliasing -xineplug_vo_out_xxmc_la_LDFLAGS = -avoid-version -module xineplug_vo_out_opengl_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ video_out_opengl.c myglext.h $(X11OSD) xineplug_vo_out_opengl_la_LIBADD = $(MLIB_LIBS) $(OPENGL_LIBS) $(GLUT_LIBS) \ $(GLU_LIBS) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) $(DYNAMIC_LD_LIBS) xineplug_vo_out_opengl_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(MLIB_CFLAGS) -fno-strict-aliasing -xineplug_vo_out_opengl_la_LDFLAGS = -avoid-version -module xineplug_vo_out_syncfb_la_SOURCES = video_out_syncfb.c xineplug_vo_out_syncfb_la_LIBADD = $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_syncfb_la_CFLAGS = $(VISIBILITY_FLAG) -xineplug_vo_out_syncfb_la_LDFLAGS = -avoid-version -module xineplug_vo_out_pgx64_la_SOURCES = video_out_pgx64.c xineplug_vo_out_pgx64_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(X_PRE_LIBS) -lX11 $(SUNDGA_LIBS) $(THREAD_LIBS) xineplug_vo_out_pgx64_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) -xineplug_vo_out_pgx64_la_LDFLAGS = -avoid-version -module xineplug_vo_out_pgx32_la_SOURCES = video_out_pgx32.c xineplug_vo_out_pgx32_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(X_PRE_LIBS) -lX11 $(SUNDGA_LIBS) $(THREAD_LIBS) xineplug_vo_out_pgx32_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) -xineplug_vo_out_pgx32_la_LDFLAGS = -avoid-version -module xineplug_vo_out_vidix_la_SOURCES = video_out_vidix.c $(X11OSD) xineplug_vo_out_vidix_la_LIBADD = $(XINE_LIB) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 \ $(top_builddir)/src/video_out/vidix/libvidix.la $(THREAD_LIBS) xineplug_vo_out_vidix_la_CFLAGS = $(VISIBILITY_FLAG) $(VIDIX_CFLAGS) $(X_CFLAGS) -fno-strict-aliasing -xineplug_vo_out_vidix_la_LDFLAGS = -avoid-version -module xineplug_vo_out_aa_la_SOURCES = video_out_aa.c xineplug_vo_out_aa_la_LIBADD = $(AALIB_LIBS) $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_aa_la_CFLAGS = $(VISIBILITY_FLAG) $(AALIB_CFLAGS) -xineplug_vo_out_aa_la_LDFLAGS = -avoid-version -module xineplug_vo_out_caca_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ video_out_caca.c xineplug_vo_out_caca_la_LIBADD = $(CACA_LIBS) $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_caca_la_CFLAGS = $(VISIBILITY_FLAG) $(CACA_CFLAGS) -xineplug_vo_out_caca_la_LDFLAGS = -avoid-version -module xineplug_vo_out_fb_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ video_out_fb.c xineplug_vo_out_fb_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_fb_la_CFLAGS = $(VISIBILITY_FLAG) $(MLIB_CFLAGS) -xineplug_vo_out_fb_la_LDFLAGS = -avoid-version -module xineplug_vo_out_directfb_la_SOURCES = video_out_directfb.c $(X11OSD) xineplug_vo_out_directfb_la_LIBADD = $(XINE_LIB) $(DIRECTFB_LIBS) $(X_LIBS) -lXext $(THREAD_LIBS) xineplug_vo_out_directfb_la_CFLAGS = $(VISIBILITY_FLAG) $(DIRECTFB_CFLAGS) -fno-strict-aliasing -xineplug_vo_out_directfb_la_LDFLAGS = -avoid-version -module xineplug_vo_out_sdl_la_SOURCES = video_out_sdl.c xineplug_vo_out_sdl_la_LIBADD = $(SDL_LIBS) $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_sdl_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(SDL_CFLAGS) -xineplug_vo_out_sdl_la_LDFLAGS = -avoid-version -module xineplug_vo_out_stk_la_SOURCES = video_out_stk.c xineplug_vo_out_stk_la_LIBADD = $(XINE_LIB) $(LIBSTK_LIBS) $(THREAD_LIBS) xineplug_vo_out_stk_la_CFLAGS = $(VISIBILITY_FLAG) $(LIBSTK_CFLAGS) -xineplug_vo_out_stk_la_LDFLAGS = -avoid-version -module xineplug_vo_out_directx_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c video_out_directx.c xineplug_vo_out_directx_la_CPPFLAGS = $(DIRECTX_CPPFLAGS) xineplug_vo_out_directx_la_LIBADD = $(DIRECTX_VIDEO_LIBS) $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_directx_la_CFLAGS = $(VISIBILITY_FLAG) -xineplug_vo_out_directx_la_LDFLAGS = -avoid-version -module xineplug_vo_out_none_la_SOURCES = video_out_none.c xineplug_vo_out_none_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_none_la_CFLAGS = $(VISIBILITY_FLAG) -xineplug_vo_out_none_la_LDFLAGS = -avoid-version -module xineplug_vo_out_macosx_la_SOURCES = video_out_macosx.m xineplug_vo_out_macosx_la_CPPFLAGS = $(X_CFLAGS) $(MLIB_CFLAGS) @@ -210,7 +190,7 @@ xineplug_vo_out_macosx_la_LIBADD = $(MLIB_LIBS) $(OPENGL_LIBS) $(GLUT_LIBS) \ $(GLU_LIBS) $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) # The "-Wl,-framework -Wl,Cocoa" is needed for libtool versions before # 1.5.x (1.257): the default version that ships with Mac OS X is 1.5 (1.1220) -xineplug_vo_out_macosx_la_LDFLAGS = -avoid-version -module \ +xineplug_vo_out_macosx_la_LDFLAGS = $(AM_LDFLAGS) \ -Wl,-framework -Wl,Cocoa -framework Cocoa -framework OpenGL noinst_HEADERS = deinterlace.h video_out_syncfb.h \ -- cgit v1.2.3 From 16d24d778d4c96158658c12b66c1d99020b77154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 10 Mar 2007 00:41:34 +0000 Subject: * Security fixes: - Fix heap overflow in DMO loader. (CVE-2007-1246) [bug #1676925] Thanks to Kees Cook for reporting. CVS patchset: 8656 CVS date: 2007/03/10 00:41:34 --- src/libw32dll/DirectShow/DS_VideoDecoder.c | 1 + src/libw32dll/dmo/DMO_VideoDecoder.c | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/libw32dll/DirectShow/DS_VideoDecoder.c b/src/libw32dll/DirectShow/DS_VideoDecoder.c index e34659f91..44c6d26d7 100644 --- a/src/libw32dll/DirectShow/DS_VideoDecoder.c +++ b/src/libw32dll/DirectShow/DS_VideoDecoder.c @@ -110,6 +110,7 @@ DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEAD this->iv.m_bh = (BITMAPINFOHEADER*)malloc(bihs); memcpy(this->iv.m_bh, format, bihs); + this->iv.m_bh->biSize = bihs; this->iv.m_State = STOP; //this->iv.m_pFrame = 0; diff --git a/src/libw32dll/dmo/DMO_VideoDecoder.c b/src/libw32dll/dmo/DMO_VideoDecoder.c index 564c26ec8..3ad85645a 100644 --- a/src/libw32dll/dmo/DMO_VideoDecoder.c +++ b/src/libw32dll/dmo/DMO_VideoDecoder.c @@ -118,6 +118,7 @@ DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHE this->iv.m_bh = (BITMAPINFOHEADER*)malloc(bihs); memcpy(this->iv.m_bh, format, bihs); + this->iv.m_bh->biSize = bihs; this->iv.m_State = STOP; //this->iv.m_pFrame = 0; -- cgit v1.2.3 From 3fe8885e89f19942f57f4de3fd5cc2e3d9cdb016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 10 Mar 2007 00:48:59 +0000 Subject: Add support for NetBSD to src/input/input_cdda.c, patch by Sergey Svishchev. CVS patchset: 8657 CVS date: 2007/03/10 00:48:59 --- src/input/input_cdda.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 85 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index 632ca3252..d21c8e4db 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -20,7 +20,7 @@ * Compact Disc Digital Audio (CDDA) Input Plugin * by Mike Melanson (melanson@pcisys.net) * - * $Id: input_cdda.c,v 1.93 2007/01/19 01:05:24 dgp85 Exp $ + * $Id: input_cdda.c,v 1.94 2007/03/10 00:48:59 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -86,6 +86,7 @@ #define CD_FRAMES_PER_SECOND 75 #define CD_RAW_FRAME_SIZE 2352 #define CD_LEADOUT_TRACK 0xAA +#define CD_BLOCK_OFFSET 150 typedef struct _cdrom_toc_entry { int track_mode; @@ -613,14 +614,20 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f return 0; } -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__NetBSD__) #include <sys/cdio.h> +#include <sys/scsiio.h> static int read_cdrom_toc(int fd, cdrom_toc *toc) { struct ioc_toc_header tochdr; +#if defined(__FreeBSD__) struct ioc_read_toc_single_entry tocentry; +#elif defined(__NetBSD__) + struct ioc_read_toc_entry tocentry; + struct cd_toc_entry data; +#endif int i; /* fetch the table of contents */ @@ -646,13 +653,26 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) { memset(&tocentry, 0, sizeof(tocentry)); +#if defined(__FreeBSD__) tocentry.track = i; tocentry.address_format = CD_MSF_FORMAT; if (ioctl(fd, CDIOREADTOCENTRY, &tocentry) == -1) { perror("CDIOREADTOCENTRY"); return -1; } +#elif defined(__NetBSD__) + memset(&data, 0, sizeof(data)); + tocentry.data_len = sizeof(data); + tocentry.data = &data; + tocentry.starting_track = i; + tocentry.address_format = CD_MSF_FORMAT; + if (ioctl(fd, CDIOREADTOCENTRYS, &tocentry) == -1) { + perror("CDIOREADTOCENTRYS"); + return -1; + } +#endif +#if defined(__FreeBSD__) toc->toc_entries[i-1].track_mode = (tocentry.entry.control & 0x04) ? 1 : 0; toc->toc_entries[i-1].first_frame_minute = tocentry.entry.addr.msf.minute; toc->toc_entries[i-1].first_frame_second = tocentry.entry.addr.msf.second; @@ -661,18 +681,41 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) { (tocentry.entry.addr.msf.minute * CD_SECONDS_PER_MINUTE * CD_FRAMES_PER_SECOND) + (tocentry.entry.addr.msf.second * CD_FRAMES_PER_SECOND) + tocentry.entry.addr.msf.frame; +#elif defined(__NetBSD__) + toc->toc_entries[i-1].track_mode = (tocentry.data->control & 0x04) ? 1 : 0; + toc->toc_entries[i-1].first_frame_minute = tocentry.data->addr.msf.minute; + toc->toc_entries[i-1].first_frame_second = tocentry.data->addr.msf.second; + toc->toc_entries[i-1].first_frame_frame = tocentry.data->addr.msf.frame; + toc->toc_entries[i-1].first_frame = + (tocentry.data->addr.msf.minute * CD_SECONDS_PER_MINUTE * CD_FRAMES_PER_SECOND) + + (tocentry.data->addr.msf.second * CD_FRAMES_PER_SECOND) + + tocentry.data->addr.msf.frame - CD_BLOCK_OFFSET; +#endif } /* fetch the leadout as well */ memset(&tocentry, 0, sizeof(tocentry)); +#if defined(__FreeBSD__) tocentry.track = CD_LEADOUT_TRACK; tocentry.address_format = CD_MSF_FORMAT; if (ioctl(fd, CDIOREADTOCENTRY, &tocentry) == -1) { perror("CDIOREADTOCENTRY"); return -1; } +#elif defined(__NetBSD__) + memset(&data, 0, sizeof(data)); + tocentry.data_len = sizeof(data); + tocentry.data = &data; + tocentry.starting_track = CD_LEADOUT_TRACK; + tocentry.address_format = CD_MSF_FORMAT; + if (ioctl(fd, CDIOREADTOCENTRYS, &tocentry) == -1) { + perror("CDIOREADTOCENTRYS"); + return -1; + } +#endif +#if defined(__FreeBSD__) toc->leadout_track.track_mode = (tocentry.entry.control & 0x04) ? 1 : 0; toc->leadout_track.first_frame_minute = tocentry.entry.addr.msf.minute; toc->leadout_track.first_frame_second = tocentry.entry.addr.msf.second; @@ -681,6 +724,16 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) { (tocentry.entry.addr.msf.minute * CD_SECONDS_PER_MINUTE * CD_FRAMES_PER_SECOND) + (tocentry.entry.addr.msf.second * CD_FRAMES_PER_SECOND) + tocentry.entry.addr.msf.frame; +#elif defined(__NetBSD__) + toc->leadout_track.track_mode = (tocentry.data->control & 0x04) ? 1 : 0; + toc->leadout_track.first_frame_minute = tocentry.data->addr.msf.minute; + toc->leadout_track.first_frame_second = tocentry.data->addr.msf.second; + toc->leadout_track.first_frame_frame = tocentry.data->addr.msf.frame; + toc->leadout_track.first_frame = + (tocentry.data->addr.msf.minute * CD_SECONDS_PER_MINUTE * CD_FRAMES_PER_SECOND) + + (tocentry.data->addr.msf.second * CD_FRAMES_PER_SECOND) + + tocentry.data->addr.msf.frame - CD_BLOCK_OFFSET; +#endif return 0; } @@ -689,12 +742,12 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f unsigned char *data) { int fd = this_gen->fd; -#if __FreeBSD_version < 501106 - struct ioc_read_audio cdda; -#endif while( num_frames ) { +#if defined(__FreeBSD__) #if __FreeBSD_version < 501106 + struct ioc_read_audio cdda; + cdda.address_format = CD_MSF_FORMAT; cdda.address.msf.minute = frame / CD_SECONDS_PER_MINUTE / CD_FRAMES_PER_SECOND; cdda.address.msf.second = (frame / CD_FRAMES_PER_SECOND) % CD_SECONDS_PER_MINUTE; @@ -712,6 +765,33 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f perror("CDIOCREADAUDIO"); return -1; } +#elif defined(__NetBSD__) + scsireq_t req; + int nblocks = 1; + + memset(&req, 0, sizeof(req)); + req.cmd[0] = 0xbe; + req.cmd[1] = 0; + req.cmd[2] = (frame >> 24) & 0xff; + req.cmd[3] = (frame >> 16) & 0xff; + req.cmd[4] = (frame >> 8) & 0xff; + req.cmd[5] = (frame >> 0) & 0xff; + req.cmd[6] = (nblocks >> 16) & 0xff; + req.cmd[7] = (nblocks >> 8) & 0xff; + req.cmd[8] = (nblocks >> 0) & 0xff; + req.cmd[9] = 0x78; + req.cmdlen = 10; + + req.datalen = nblocks * CD_RAW_FRAME_SIZE; + req.databuf = data; + req.timeout = 10000; + req.flags = SCCMD_READ; + + if(ioctl(fd, SCIOCCOMMAND, &req) < 0) { + perror("SCIOCCOMMAND"); + return -1; + } +#endif data += CD_RAW_FRAME_SIZE; frame++; -- cgit v1.2.3 From daa2eb3c9c1fad22c9b361f4713ca130cab33ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 10 Mar 2007 00:55:14 +0000 Subject: Don't use Solaris workarounds on other OSes (namely NetBSD). Patch by Sergey Svishchev, see bug #1667848. CVS patchset: 8658 CVS date: 2007/03/10 00:55:14 --- src/audio_out/audio_sun_out.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_sun_out.c b/src/audio_out/audio_sun_out.c index 15bd3b72d..93361d2f3 100644 --- a/src/audio_out/audio_sun_out.c +++ b/src/audio_out/audio_sun_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_sun_out.c,v 1.46 2006/12/19 19:10:51 dsalt Exp $ + * $Id: audio_sun_out.c,v 1.47 2007/03/10 00:55:14 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -41,13 +41,20 @@ #ifdef __svr4__ #include <stropts.h> #endif +#include <sys/param.h> + +#if (defined(BSD) && BSD >= 199306) +typedef unsigned uint_t; +#endif #include "xine_internal.h" #include "xineutils.h" #include "audio_out.h" +#ifdef __svr4__ #define CS4231_WORKAROUND 1 /* enable workaround for audiocs play.samples bug */ #define SW_SAMPLE_COUNT 1 +#endif #ifndef AUDIO_CHANNELS_MONO @@ -89,7 +96,9 @@ typedef struct sun_driver_s { uint32_t num_channels; int bytes_per_frame; +#ifdef __svr4__ uint32_t frames_in_buffer; /* number of frames writen to audio hardware */ +#endif enum { RTSC_UNKNOWN = 0, @@ -114,12 +123,14 @@ typedef struct sun_driver_s { unsigned buf_len; #endif +#ifdef __svr4__ #if SW_SAMPLE_COUNT struct timeval tv0; uint_t sample0; #endif uint_t last_samplecnt; +#endif } sun_driver_t; @@ -129,6 +140,7 @@ typedef struct sun_driver_s { */ static int realtime_samplecounter_available(xine_t *xine, char *dev) { +#ifdef __svr4__ int fd = -1; audio_info_t info; int rtsc_ok = RTSC_DISABLED; @@ -247,6 +259,9 @@ error: } return rtsc_ok; +#else + return RTSC_ENABLED; +#endif } @@ -430,7 +445,9 @@ static int ao_sun_open(ao_driver_t *this_gen, this->mode = mode; this->input_sample_rate = rate; +#ifdef __svr4__ this->frames_in_buffer = 0; +#endif /* * open audio device @@ -462,6 +479,9 @@ static int ao_sun_open(ao_driver_t *this_gen, info.play.sample_rate = this->input_sample_rate; info.play.eof = 0; info.play.samples = 0; +#ifndef __svr4__ + info.blocksize = 1024; +#endif this->convert_u8_s8 = 0; @@ -523,7 +543,9 @@ static int ao_sun_open(ao_driver_t *this_gen, return 0; } +#ifdef __svr4__ this->last_samplecnt = 0; +#endif this->output_sample_rate = info.play.sample_rate; this->num_channels = info.play.channels; @@ -564,6 +586,7 @@ static int ao_sun_delay(ao_driver_t *this_gen) sun_driver_t *this = (sun_driver_t *) this_gen; audio_info_t info; +#ifdef __svr4__ if (ioctl(this->audio_fd, AUDIO_GETINFO, &info) == 0 && (this->frames_in_buffer == 0 || info.play.samples > 0)) { @@ -610,6 +633,10 @@ static int ao_sun_delay(ao_driver_t *this_gen) } #endif } +#else + if (ioctl(this->audio_fd, AUDIO_GETINFO, &info) == 0) + return info.play.seek / this->bytes_per_frame; +#endif return NOT_REAL_TIME; } @@ -718,7 +745,9 @@ static int ao_sun_write(ao_driver_t *this_gen, if (num_written > 0) { int buffered_samples; +#ifdef __svr4__ this->frames_in_buffer += num_written / this->bytes_per_frame; +#endif /* * Avoid storing too much data in the sound driver's buffers. @@ -861,6 +890,9 @@ static int ao_sun_ctrl(ao_driver_t *this_gen, int cmd, ...) { this->frames_in_buffer = 0; this->last_samplecnt = 0; +#endif +#ifdef __NetBSD__ + ioctl(this->audio_fd, AUDIO_FLUSH); #endif break; } @@ -946,7 +978,10 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v */ this->capabilities = AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO | AO_CAP_8BITS - | AO_CAP_PCM_VOL | AO_CAP_MUTE_VOL; + | AO_CAP_16BITS | AO_CAP_PCM_VOL; +#ifdef __svr4__ + this->capabilities |= AO_CAP_MUTE_VOL; +#endif /* * get initial mixer volume -- cgit v1.2.3 From 4d2180de7a9255ae90a753922b72d7958bccd923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 10 Mar 2007 00:57:00 +0000 Subject: Use two-step lookup of wrapper_local to fix assembler errors. Patch by Albert Lee. CVS patchset: 8659 CVS date: 2007/03/10 00:57:00 --- src/libw32dll/wine/wrapper.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libw32dll/wine/wrapper.S b/src/libw32dll/wine/wrapper.S index 2e781787e..72b4dfe8f 100644 --- a/src/libw32dll/wine/wrapper.S +++ b/src/libw32dll/wine/wrapper.S @@ -55,7 +55,8 @@ wrapper: leal .Lwrapper_return@GOTOFF(%ebx), %eax movl %eax, 40(%ebp) - movl wrapper_target@GOTOFF(%ebx), %eax + movl wrapper_target@GOT(%ebx), %eax + movl (%eax), %eax mov %eax, 40(%ebp) # wrapper_target should return at .Lwrapper_return leave # restore %esp, %ebp -- cgit v1.2.3 From e7b7ee301659be9bf81f0f86310fb31e8a154e60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 10 Mar 2007 00:57:30 +0000 Subject: When hstrerror() is found in libresolv, link it where it is used. Patch by Albert Lee. CVS patchset: 8660 CVS date: 2007/03/10 00:57:30 --- src/input/Makefile.am | 6 +++--- src/xine-engine/Makefile.am | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/input/Makefile.am b/src/input/Makefile.am index a3635ccad..f8e17ae61 100644 --- a/src/input/Makefile.am +++ b/src/input/Makefile.am @@ -82,7 +82,7 @@ xineplug_inp_dvd_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_dvd_la_LDFLAGS = -avoid-version -module xineplug_inp_net_la_SOURCES = input_net.c net_buf_ctrl.c -xineplug_inp_net_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) +xineplug_inp_net_la_LIBADD = $(XINE_LIB) $(NET_LIBS) $(THREAD_LIBS) xineplug_inp_net_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_net_la_LDFLAGS = -avoid-version -module @@ -102,12 +102,12 @@ xineplug_inp_stdin_fifo_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_stdin_fifo_la_LDFLAGS = -avoid-version -module xineplug_inp_rtp_la_SOURCES = input_rtp.c net_buf_ctrl.c -xineplug_inp_rtp_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) +xineplug_inp_rtp_la_LIBADD = $(XINE_LIB) $(NET_LIBS) $(THREAD_LIBS) xineplug_inp_rtp_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_rtp_la_LDFLAGS = -avoid-version -module xineplug_inp_http_la_SOURCES = input_http.c net_buf_ctrl.c http_helper.c -xineplug_inp_http_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) +xineplug_inp_http_la_LIBADD = $(XINE_LIB) $(NET_LIBS) $(THREAD_LIBS) xineplug_inp_http_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_http_la_LDFLAGS = -avoid-version -module diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am index 2b317d2aa..97fb6a033 100644 --- a/src/xine-engine/Makefile.am +++ b/src/xine-engine/Makefile.am @@ -28,7 +28,7 @@ libxine_la_DEPENDENCIES = $(XINEUTILS_LIB) \ $(pthread_dep) $(LIBXINEPOSIX) libxine_la_LIBADD = $(THREAD_LIBS) $(DYNAMIC_LD_LIBS) $(LTLIBINTL) $(ZLIB_LIBS) \ -lm $(XINEUTILS_LIB) $(LIBICONV) $(FT2_LIBS) $(FONTCONFIG_LIBS) \ - $(LIBXINEPOSIX) $(RT_LIBS) + $(LIBXINEPOSIX) $(RT_LIBS) $(NET_LIBS) libxine_la_LDFLAGS = \ -version-info $(XINE_LT_CURRENT):$(XINE_LT_REVISION):$(XINE_LT_AGE) \ -- cgit v1.2.3 From 72928459779cb82cfe4e6544fe523f885ab0a15e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 10 Mar 2007 17:25:13 +0000 Subject: Add unistd.h include for the write() function. Thanks to Manfred Tremmel for reporting. CVS patchset: 8662 CVS date: 2007/03/10 17:25:13 --- src/dxr3/dxr3_mpeg_encoders.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/dxr3/dxr3_mpeg_encoders.c b/src/dxr3/dxr3_mpeg_encoders.c index 6fe2ff397..cba47aad4 100644 --- a/src/dxr3/dxr3_mpeg_encoders.c +++ b/src/dxr3/dxr3_mpeg_encoders.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: dxr3_mpeg_encoders.c,v 1.24 2005/11/28 12:24:57 valtri Exp $ + * $Id: dxr3_mpeg_encoders.c,v 1.25 2007/03/10 17:25:13 dgp85 Exp $ */ /* mpeg encoders for the dxr3 video out plugin. @@ -44,6 +44,7 @@ #include <fcntl.h> #include <errno.h> #include <math.h> +#include <unistd.h> #define LOG_MODULE "dxr3_mpeg_encoder" /* #define LOG_VERBOSE */ -- cgit v1.2.3 From 644477a8a0b9e511514b8b9bde9cba5e0ca2430b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Mon, 12 Mar 2007 16:27:21 +0000 Subject: Allow DTS audio tracks in Matroska files. Sample reported by Stefan Monov. CVS patchset: 8663 CVS date: 2007/03/12 16:27:21 --- src/demuxers/demux_matroska.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index 3cc36942a..2bd8f3540 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_matroska.c,v 1.52 2007/02/20 00:34:55 dgp85 Exp $ + * $Id: demux_matroska.c,v 1.53 2007/03/12 16:27:21 dgp85 Exp $ * * demultiplexer for matroska streams * @@ -1396,6 +1396,10 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { init_codec = init_codec_audio; } else if (!strcmp(track->codec_id, MATROSKA_CODEC_ID_A_DTS)) { + lprintf("MATROSKA_CODEC_ID_A_DTS\n"); + track->buf_type = BUF_AUDIO_DTS; + init_codec = init_codec_audio; + } else if (!strcmp(track->codec_id, MATROSKA_CODEC_ID_A_VORBIS)) { lprintf("MATROSKA_CODEC_ID_A_VORBIS\n"); -- cgit v1.2.3 From c66b9bd972e41ee66dbe56a29a74cf81cda02e3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 00:01:31 +0000 Subject: Collapse X_LIBS, X_PRE_LIBS, -lXext and -lX11 in a single X_LIBS variable when using non-pkg-config based discovery of X11 libraries; also check for xext together with x11 with pkg-config. This reduces the list of libraries to add to _LIBADD for video output plugins, and should solve the problems with -lXext being linked in with X disabled. CVS patchset: 8666 CVS date: 2007/03/16 00:01:31 --- src/video_out/Makefile.am | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index 41db59fe5..e11140ddb 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -109,42 +109,42 @@ xineplug_vo_out_xcbxv_la_CFLAGS = $(VISIBILITY_FLAG) $(XCB_CFLAGS) $(XCBXV_CFLAG xineplug_vo_out_xshm_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ video_out_xshm.c $(X11OSD) -xineplug_vo_out_xshm_la_LIBADD = $(MLIB_LIBS) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) +xineplug_vo_out_xshm_la_LIBADD = $(MLIB_LIBS) $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_xshm_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(MLIB_CFLAGS) -fno-strict-aliasing xineplug_vo_out_xv_la_SOURCES = $(X11OSD) deinterlace.c video_out_xv.c -xineplug_vo_out_xv_la_LIBADD = $(XV_LIBS) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) +xineplug_vo_out_xv_la_LIBADD = $(XV_LIBS) $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_xv_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(XV_CFLAGS) -fno-strict-aliasing xineplug_vo_out_xvmc_la_SOURCES = deinterlace.c video_out_xvmc.c -xineplug_vo_out_xvmc_la_LIBADD = $(XVMC_LIBS) $(XV_LIBS) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) +xineplug_vo_out_xvmc_la_LIBADD = $(XVMC_LIBS) $(XV_LIBS) $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_xvmc_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(XV_CFLAGS) xineplug_vo_out_xxmc_la_SOURCES = $(X11OSD) deinterlace.c video_out_xxmc.c\ xvmc_mocomp.c xvmc_vld.c xxmc.h -xineplug_vo_out_xxmc_la_LIBADD = $(XXMC_LIBS) $(XV_LIBS) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) +xineplug_vo_out_xxmc_la_LIBADD = $(XXMC_LIBS) $(XV_LIBS) $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_xxmc_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(XV_CFLAGS) -fno-strict-aliasing xineplug_vo_out_opengl_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ video_out_opengl.c myglext.h $(X11OSD) xineplug_vo_out_opengl_la_LIBADD = $(MLIB_LIBS) $(OPENGL_LIBS) $(GLUT_LIBS) \ - $(GLU_LIBS) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) $(DYNAMIC_LD_LIBS) + $(GLU_LIBS) $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) $(DYNAMIC_LD_LIBS) xineplug_vo_out_opengl_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(MLIB_CFLAGS) -fno-strict-aliasing xineplug_vo_out_syncfb_la_SOURCES = video_out_syncfb.c -xineplug_vo_out_syncfb_la_LIBADD = $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 $(XINE_LIB) $(THREAD_LIBS) +xineplug_vo_out_syncfb_la_LIBADD = $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_syncfb_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_vo_out_pgx64_la_SOURCES = video_out_pgx64.c -xineplug_vo_out_pgx64_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(X_PRE_LIBS) -lX11 $(SUNDGA_LIBS) $(THREAD_LIBS) +xineplug_vo_out_pgx64_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(SUNDGA_LIBS) $(THREAD_LIBS) xineplug_vo_out_pgx64_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) xineplug_vo_out_pgx32_la_SOURCES = video_out_pgx32.c -xineplug_vo_out_pgx32_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(X_PRE_LIBS) -lX11 $(SUNDGA_LIBS) $(THREAD_LIBS) +xineplug_vo_out_pgx32_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(SUNDGA_LIBS) $(THREAD_LIBS) xineplug_vo_out_pgx32_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) xineplug_vo_out_vidix_la_SOURCES = video_out_vidix.c $(X11OSD) -xineplug_vo_out_vidix_la_LIBADD = $(XINE_LIB) $(X_LIBS) -lXext $(X_PRE_LIBS) -lX11 \ +xineplug_vo_out_vidix_la_LIBADD = $(XINE_LIB) $(X_LIBS) \ $(top_builddir)/src/video_out/vidix/libvidix.la $(THREAD_LIBS) xineplug_vo_out_vidix_la_CFLAGS = $(VISIBILITY_FLAG) $(VIDIX_CFLAGS) $(X_CFLAGS) -fno-strict-aliasing @@ -163,7 +163,7 @@ xineplug_vo_out_fb_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_fb_la_CFLAGS = $(VISIBILITY_FLAG) $(MLIB_CFLAGS) xineplug_vo_out_directfb_la_SOURCES = video_out_directfb.c $(X11OSD) -xineplug_vo_out_directfb_la_LIBADD = $(XINE_LIB) $(DIRECTFB_LIBS) $(X_LIBS) -lXext $(THREAD_LIBS) +xineplug_vo_out_directfb_la_LIBADD = $(XINE_LIB) $(DIRECTFB_LIBS) $(X_LIBS) $(THREAD_LIBS) xineplug_vo_out_directfb_la_CFLAGS = $(VISIBILITY_FLAG) $(DIRECTFB_CFLAGS) -fno-strict-aliasing xineplug_vo_out_sdl_la_SOURCES = video_out_sdl.c -- cgit v1.2.3 From 46dd1a8031362a79fb790d3020801bbd41ab295a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 16:32:58 +0000 Subject: Move netinet/in.h include down the block; this is currently patched by FreeBSD ports, and makes no functional change of sort on Linux. CVS patchset: 8675 CVS date: 2007/03/16 16:32:58 --- src/input/input_vcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index 82c1b53d9..bcd50ecc1 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_vcd.c,v 1.88 2007/01/19 01:05:25 dgp85 Exp $ + * $Id: input_vcd.c,v 1.89 2007/03/16 16:32:58 dgp85 Exp $ * */ @@ -25,7 +25,6 @@ #include "config.h" #endif -#include <netinet/in.h> #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> @@ -34,6 +33,7 @@ #include <fcntl.h> #include <sys/ioctl.h> #include <string.h> +#include <netinet/in.h> #ifdef HAVE_LINUX_CDROM_H # include <linux/cdrom.h> #endif -- cgit v1.2.3 From 701d89533d14c303fa2ba880f2b6b3cc24562f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 17:13:57 +0000 Subject: Fix FreeBSD PR 91728 (problem with ioctl() request parameter being unsigned long rather than int). This patch is less invasive and portable. CVS patchset: 8676 CVS date: 2007/03/16 17:13:57 --- src/audio_out/audio_oss_out.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c index ccb142eb5..12a52b997 100644 --- a/src/audio_out/audio_oss_out.c +++ b/src/audio_out/audio_oss_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_oss_out.c,v 1.118 2007/03/09 23:56:42 dgp85 Exp $ + * $Id: audio_oss_out.c,v 1.119 2007/03/16 17:13:57 dgp85 Exp $ * * 20-8-2001 First implementation of Audio sync and Audio driver separation. * Copyright (C) 2001 James Courtier-Dutton James@superbug.demon.co.uk @@ -115,6 +115,13 @@ #define OSS_SYNC_SOFTSYNC 3 #define OSS_SYNC_PROBEBUFFER 4 +/* On FreeBSD the request type is unsigned long rather than int */ +#ifdef __FreeBSD__ +typedef unsigned long ioctl_request_t; +#else +typedef int ioctl_request_t; +#endif + typedef struct oss_driver_s { ao_driver_t ao_driver; @@ -525,7 +532,7 @@ static int ao_oss_get_property (ao_driver_t *this_gen, int property) { if(!this->mixer.mute) { if(this->mixer.fd != -1) { - int cmd = 0; + ioctl_request_t cmd = 0; int v; ioctl(this->mixer.fd, SOUND_MIXER_READ_DEVMASK, &audio_devs); @@ -564,7 +571,7 @@ static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value) if(!this->mixer.mute) { if(this->mixer.fd != -1) { - int cmd = 0; + ioctl_request_t cmd = 0; int v; ioctl(this->mixer.fd, SOUND_MIXER_READ_DEVMASK, &audio_devs); @@ -593,7 +600,7 @@ static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value) if(this->mixer.mute) { if(this->mixer.fd != -1) { - int cmd = 0; + ioctl_request_t cmd = 0; int v = 0; ioctl(this->mixer.fd, SOUND_MIXER_READ_DEVMASK, &audio_devs); -- cgit v1.2.3 From 8255b3f2fc3d31bf42e786c472a2b4252511bec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 17:15:56 +0000 Subject: Use stdlib.h rather than malloc.h. CVS patchset: 8677 CVS date: 2007/03/16 17:15:56 --- src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h b/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h index 3d7ae308e..a3b92a51c 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h +++ b/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h @@ -1,8 +1,6 @@ #include <string.h> #include <math.h> -#ifdef HAVE_MALLOC_H -#include <malloc.h> -#endif +#include <stdlib.h> #define USE_FOR_DSCALER -- cgit v1.2.3 From 51d097f9144193c98d881f14c4e4bd6b579574f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 19:31:57 +0000 Subject: There's no need to check if the shared object to open is 32 or 64 bits, as dlopen() will not load a codec if it's not loadable in the current process (which means it won't load 64-bit codecs on 32-bit xine, or 32-bit codecs on 64-bit xine). CVS patchset: 8678 CVS date: 2007/03/16 19:31:57 --- src/libreal/audio_decoder.c | 54 +-------------------------------------------- src/libreal/xine_decoder.c | 54 +-------------------------------------------- 2 files changed, 2 insertions(+), 106 deletions(-) (limited to 'src') diff --git a/src/libreal/audio_decoder.c b/src/libreal/audio_decoder.c index 8b8e40126..d60e8f8e1 100644 --- a/src/libreal/audio_decoder.c +++ b/src/libreal/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.51 2007/02/20 00:34:57 dgp85 Exp $ + * $Id: audio_decoder.c,v 1.52 2007/03/16 19:31:57 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -32,9 +32,6 @@ #include <fcntl.h> #include <unistd.h> #include <dlfcn.h> -#ifdef __x86_64__ - #include <elf.h> -#endif #define LOG_MODULE "real_audio_decoder" #define LOG_VERBOSE @@ -121,49 +118,6 @@ void __builtin_delete (void *foo) { free (foo); } -#ifdef __x86_64__ -/* (gb) quick-n-dirty check to be run natively */ -static int is_x86_64_object_(FILE *f) -{ - Elf64_Ehdr *hdr = malloc(sizeof(Elf64_Ehdr)); - if (hdr == NULL) - return 0; - - if (fseek(f, 0, SEEK_SET) != 0) { - free(hdr); - return 0; - } - - if (fread(hdr, sizeof(Elf64_Ehdr), 1, f) != 1) { - free(hdr); - return 0; - } - - if (hdr->e_ident[EI_MAG0] != ELFMAG0 || - hdr->e_ident[EI_MAG1] != ELFMAG1 || - hdr->e_ident[EI_MAG2] != ELFMAG2 || - hdr->e_ident[EI_MAG3] != ELFMAG3) { - free(hdr); - return 0; - } - - return hdr->e_machine == EM_X86_64; -} - -static inline int is_x86_64_object(const char *filename) -{ - FILE *f; - int ret; - - if ((f = fopen(filename, "r")) == NULL) - return 0; - - ret = is_x86_64_object_(f); - fclose(f); - return ret; -} -#endif - static int load_syms_linux (realdec_decoder_t *this, char *codec_name, const char *alt_codec_name) { @@ -176,12 +130,6 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name, if (stat(path, &sb)) snprintf (path, sizeof(path), "%s/%s", entry->str_value, alt_codec_name); -#ifdef __x86_64__ - /* check whether it's a real x86-64 library */ - if (!is_x86_64_object(path)) - return 0; -#endif - lprintf ("(audio) opening shared obj '%s'\n", path); this->ra_handle = dlopen (path, RTLD_LAZY); diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c index ffd89178b..28770636b 100644 --- a/src/libreal/xine_decoder.c +++ b/src/libreal/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.85 2007/02/20 00:34:57 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.86 2007/03/16 19:31:57 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -32,9 +32,6 @@ #include <fcntl.h> #include <unistd.h> #include <dlfcn.h> -#ifdef __x86_64__ - #include <elf.h> -#endif #define LOG_MODULE "real_decoder" #define LOG_VERBOSE @@ -106,49 +103,6 @@ void *__builtin_vec_new(uint32_t size); void __builtin_vec_delete(void *mem); void __pure_virtual(void); -#ifdef __x86_64__ -/* (gb) quick-n-dirty check to be run natively */ -static int is_x86_64_object_(FILE *f) -{ - Elf64_Ehdr *hdr = malloc(sizeof(Elf64_Ehdr)); - if (hdr == NULL) - return 0; - - if (fseek(f, 0, SEEK_SET) != 0) { - free(hdr); - return 0; - } - - if (fread(hdr, sizeof(Elf64_Ehdr), 1, f) != 1) { - free(hdr); - return 0; - } - - if (hdr->e_ident[EI_MAG0] != ELFMAG0 || - hdr->e_ident[EI_MAG1] != ELFMAG1 || - hdr->e_ident[EI_MAG2] != ELFMAG2 || - hdr->e_ident[EI_MAG3] != ELFMAG3) { - free(hdr); - return 0; - } - - return hdr->e_machine == EM_X86_64; -} - -static inline int is_x86_64_object(const char *filename) -{ - FILE *f; - int ret; - - if ((f = fopen(filename, "r")) == NULL) - return 0; - - ret = is_x86_64_object_(f); - fclose(f); - return ret; -} -#endif - /* * real codec loader */ @@ -165,12 +119,6 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name, if (stat(path, &sb)) snprintf (path, sizeof(path), "%s/%s", entry->str_value, alt_codec_name); -#ifdef __x86_64__ - /* check whether it's a real x86-64 library */ - if (!is_x86_64_object(path)) - return 0; -#endif - lprintf ("opening shared obj '%s'\n", path); this->rv_handle = dlopen (path, RTLD_LAZY); -- cgit v1.2.3 From f07c6cb7930d9f6e9842cc671ed86f687d456e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 20:02:33 +0000 Subject: Move the __builtin functions in a different unit, and define them only on Alpha as that's the only architecture for which the binary codecs available on MPlayer site are needing them. Newer versions needs not these symbols, and for safety, I'd rather avoid messing with the global namespace. CVS patchset: 8679 CVS date: 2007/03/16 20:02:33 --- src/libreal/Makefile.am | 12 ++++------ src/libreal/audio_decoder.c | 36 +--------------------------- src/libreal/real_common.c | 57 +++++++++++++++++++++++++++++++++++++++++++++ src/libreal/real_common.h | 47 +++++++++++++++++++++++++++++++++++++ src/libreal/xine_decoder.c | 18 +------------- 5 files changed, 111 insertions(+), 59 deletions(-) create mode 100644 src/libreal/real_common.c create mode 100644 src/libreal/real_common.h (limited to 'src') diff --git a/src/libreal/Makefile.am b/src/libreal/Makefile.am index 72dac45a1..4c46db78c 100644 --- a/src/libreal/Makefile.am +++ b/src/libreal/Makefile.am @@ -1,15 +1,13 @@ include $(top_srcdir)/misc/Makefile.common -libdir = $(XINE_PLUGINDIR) +xineplug_LTLIBRARIES = xineplug_decode_real.la xineplug_decode_real_audio.la -lib_LTLIBRARIES = xineplug_decode_real.la xineplug_decode_real_audio.la - -xineplug_decode_real_la_SOURCES = xine_decoder.c +xineplug_decode_real_la_SOURCES = xine_decoder.c real_common.c xineplug_decode_real_la_LIBADD = $(XINE_LIB) $(DYNAMIC_LD_LIBS) xineplug_decode_real_la_CFLAGS = $(VISIBILITY_FLAG) -xineplug_decode_real_la_LDFLAGS = -avoid-version -module +xineplug_decode_real_la_LDFLAGS = $(xineplug_ldflags) -xineplug_decode_real_audio_la_SOURCES = audio_decoder.c +xineplug_decode_real_audio_la_SOURCES = audio_decoder.c real_common.c xineplug_decode_real_audio_la_LIBADD = $(XINE_LIB) $(DYNAMIC_LD_LIBS) xineplug_decode_real_audio_la_CFLAGS = $(VISIBILITY_FLAG) -xineplug_decode_real_audio_la_LDFLAGS = -avoid-version -module +xineplug_decode_real_audio_la_LDFLAGS = $(xineplug_ldflags) diff --git a/src/libreal/audio_decoder.c b/src/libreal/audio_decoder.c index d60e8f8e1..ebffce31d 100644 --- a/src/libreal/audio_decoder.c +++ b/src/libreal/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.52 2007/03/16 19:31:57 dgp85 Exp $ + * $Id: audio_decoder.c,v 1.53 2007/03/16 20:02:33 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -102,22 +102,6 @@ typedef struct { void *extras; } ra_init_t; -void *__builtin_new(unsigned long size); -void __builtin_delete (void *foo); -void *__builtin_vec_new(unsigned long size); -void __builtin_vec_delete(void *mem); -void __pure_virtual(void); - - -void *__builtin_new(unsigned long size) { - return malloc(size); -} - -void __builtin_delete (void *foo) { - /* printf ("libareal: __builtin_delete called\n"); */ - free (foo); -} - static int load_syms_linux (realdec_decoder_t *this, char *codec_name, const char *alt_codec_name) { @@ -626,24 +610,6 @@ static void dispose_class (audio_decoder_class_t *this) { free (this); } -/* - * some fake functions to make real codecs happy - */ -void *__builtin_vec_new(unsigned long size) EXPORTED; -void __builtin_vec_delete(void *mem) EXPORTED; -void __pure_virtual(void) EXPORTED; - -void *__builtin_vec_new(unsigned long size) { - return malloc(size); -} -void __builtin_vec_delete(void *mem) { - free(mem); -} -void __pure_virtual(void) { - lprintf("libareal: FATAL: __pure_virtual() called!\n"); - /* exit(1); */ -} - /* * real audio codec loader */ diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c new file mode 100644 index 000000000..9df428106 --- /dev/null +++ b/src/libreal/real_common.c @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2000-2007 the xine project + * + * This file is part of xine, a free video player. + * + * xine 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. + * + * xine 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * $Id: real_common.c,v 1.1 2007/03/16 20:02:33 dgp85 Exp $ + * + * Common function for the thin layer to use Real binary-only codecs in xine + */ + +#define LOG_MODULE "real_common" +#define LOG_VERBOSE +/* +#define LOG +*/ + +#include "real_common.h" + +#ifdef __alpha__ + +void *__builtin_new(size_t size) { + return malloc(size); +} + +void __builtin_delete (void *foo) { + /* printf ("libareal: __builtin_delete called\n"); */ + free (foo); +} + +void *__builtin_vec_new(size_t size) { + return malloc(size); +} + +void __builtin_vec_delete(void *mem) { + free(mem); +} + +void __pure_virtual(void) { + lprintf("libreal: FATAL: __pure_virtual() called!\n"); + /* exit(1); */ +} + +#endif diff --git a/src/libreal/real_common.h b/src/libreal/real_common.h new file mode 100644 index 000000000..83336a809 --- /dev/null +++ b/src/libreal/real_common.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2000-2007 the xine project + * + * This file is part of xine, a free video player. + * + * xine 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. + * + * xine 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * $Id: real_common.h,v 1.1 2007/03/16 20:02:33 dgp85 Exp $ + * + * Common function for the thin layer to use Real binary-only codecs in xine + */ + +#ifndef __REAL_COMMON_H__ +#define __REAL_COMMON_H__ + +#include "xine_internal.h" + +/* + * some fake functions to make real codecs happy + * These are, on current date (20070316) needed only for Alpha + * codecs. + * As they are far from being proper replacements, define them only there + * until new codecs are available there too. + */ +#ifdef __alpha__ + +void *__builtin_new(size_t size); +void __builtin_delete (void *foo); +void *__builtin_vec_new(size_t size) EXPORTED; +void __builtin_vec_delete(void *mem) EXPORTED; +void __pure_virtual(void) EXPORTED; + +#endif + +#endif diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c index 28770636b..779f577e2 100644 --- a/src/libreal/xine_decoder.c +++ b/src/libreal/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.86 2007/03/16 19:31:57 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.87 2007/03/16 20:02:33 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -522,23 +522,7 @@ static void dispose_class (video_decoder_class_t *this) { free (this); } -/* - * some fake functions to make real codecs happy - */ -void *__builtin_vec_new(uint32_t size) EXPORTED; -void __builtin_vec_delete(void *mem) EXPORTED; -void __pure_virtual(void) EXPORTED; -void *__builtin_vec_new(uint32_t size) { - return malloc(size); -} -void __builtin_vec_delete(void *mem) { - free(mem); -} -void __pure_virtual(void) { - lprintf("libreal: FATAL: __pure_virtual() called!\n"); - /* exit(1); */ -} static void *init_class (xine_t *xine, void *data) { -- cgit v1.2.3 From 066220e7145c94fd6751c0631374ef3b34dc983c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 20:21:40 +0000 Subject: For FreeBSD support, alias the __environ and stderr symbols, unavailable there, to their equivalent symbols. This could be improved by adding a configure-time check for this. CVS patchset: 8681 CVS date: 2007/03/16 20:21:40 --- src/libreal/real_common.c | 7 ++++++- src/libreal/real_common.h | 12 +++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index 9df428106..c4afcbeea 100644 --- a/src/libreal/real_common.c +++ b/src/libreal/real_common.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real_common.c,v 1.1 2007/03/16 20:02:33 dgp85 Exp $ + * $Id: real_common.c,v 1.2 2007/03/16 20:21:40 dgp85 Exp $ * * Common function for the thin layer to use Real binary-only codecs in xine */ @@ -55,3 +55,8 @@ void __pure_virtual(void) { } #endif + +#ifdef __FreeBSD__ /* TODO: alias them if at all possible */ +void ___brk_addr(void) { exit(0); } +void __ctype_b(void) { exit(0); } +#endif diff --git a/src/libreal/real_common.h b/src/libreal/real_common.h index 83336a809..2d4c1dee0 100644 --- a/src/libreal/real_common.h +++ b/src/libreal/real_common.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real_common.h,v 1.1 2007/03/16 20:02:33 dgp85 Exp $ + * $Id: real_common.h,v 1.2 2007/03/16 20:21:40 dgp85 Exp $ * * Common function for the thin layer to use Real binary-only codecs in xine */ @@ -44,4 +44,14 @@ void __pure_virtual(void) EXPORTED; #endif +#ifdef __FreeBSD__ + #ifdef SUPPORT_ATTRIBUTE_ALIAS +char **__environ __attribute__((weak, alias("environ"))); +FILE *stderr __attribute__((weak, alias("__stderrp"))); + + #endif +void ___brk_addr(void) EXPORTED; +void __ctype_b(void) EXPORTED; +#endif + #endif -- cgit v1.2.3 From f39902b9cf71081aa1701e9c7a857f1215982199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 20:45:21 +0000 Subject: Move autodetection of Real codecs path to the common code unit, and rewrite to a) minimise the number of stat() calls happening; b) support FreeBSD paths. CVS patchset: 8682 CVS date: 2007/03/16 20:45:21 --- src/libreal/audio_decoder.c | 47 ++++----------------------------------------- src/libreal/real_common.c | 47 ++++++++++++++++++++++++++++++++++++++++++++- src/libreal/real_common.h | 4 +++- src/libreal/xine_decoder.c | 47 ++++----------------------------------------- 4 files changed, 57 insertions(+), 88 deletions(-) (limited to 'src') diff --git a/src/libreal/audio_decoder.c b/src/libreal/audio_decoder.c index ebffce31d..a6a0c551f 100644 --- a/src/libreal/audio_decoder.c +++ b/src/libreal/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.53 2007/03/16 20:02:33 dgp85 Exp $ + * $Id: audio_decoder.c,v 1.54 2007/03/16 20:45:21 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -45,6 +45,8 @@ #include "buffer.h" #include "xineutils.h" +#include "real_common.h" + typedef struct { audio_decoder_class_t decoder_class; @@ -618,9 +620,6 @@ static void *init_class (xine_t *xine, void *data) { real_class_t *this; config_values_t *config = xine->config; - char *real_codec_path; - char *default_real_codec_path = ""; - struct stat s; this = (real_class_t *) xine_xmalloc (sizeof (real_class_t)); @@ -629,45 +628,7 @@ static void *init_class (xine_t *xine, void *data) { this->decoder_class.get_description = get_description; this->decoder_class.dispose = dispose_class; - /* try some auto-detection */ - - if (!stat ("/usr/local/RealPlayer8/Codecs/drv3.so.6.0", &s)) - default_real_codec_path = "/usr/local/RealPlayer8/Codecs"; - if (!stat ("/usr/RealPlayer8/Codecs/drv3.so.6.0", &s)) - default_real_codec_path = "/usr/RealPlayer8/Codecs"; - if (!stat ("/usr/lib/RealPlayer8/Codecs/drv3.so.6.0", &s)) - default_real_codec_path = "/usr/lib/RealPlayer8/Codecs"; - if (!stat ("/opt/RealPlayer8/Codecs/drv3.so.6.0", &s)) - default_real_codec_path = "/opt/RealPlayer8/Codecs"; - if (!stat ("/usr/lib/RealPlayer9/users/Real/Codecs/drv3.so.6.0", &s)) - default_real_codec_path = "/usr/lib/RealPlayer9/users/Real/Codecs"; - if (!stat ("/usr/lib/RealPlayer10/codecs/drvc.so", &s)) - default_real_codec_path = "/usr/lib/RealPlayer10/codecs"; - if (!stat ("/usr/lib64/RealPlayer8/Codecs/drv3.so.6.0", &s)) - default_real_codec_path = "/usr/lib64/RealPlayer8/Codecs"; - if (!stat ("/usr/lib64/RealPlayer9/users/Real/Codecs/drv3.so.6.0", &s)) - default_real_codec_path = "/usr/lib64/RealPlayer9/users/Real/Codecs"; - if (!stat ("/usr/lib64/RealPlayer10/codecs/drvc.so", &s)) - default_real_codec_path = "/usr/lib64/RealPlayer10/codecs"; - if (!stat ("/usr/lib/codecs/drv3.so.6.0", &s)) - default_real_codec_path = "/usr/lib/codecs"; - if (!stat ("/usr/lib/win32/drv3.so.6.0", &s)) - default_real_codec_path = "/usr/lib/win32"; - - real_codec_path = config->register_filename (config, "decoder.external.real_codecs_path", - default_real_codec_path, - XINE_CONFIG_STRING_IS_DIRECTORY_NAME, - _("path to RealPlayer codecs"), - _("If you have RealPlayer installed, specify the path " - "to its codec directory here. You can easily find " - "the codec directory by looking for a file named " - "\"drv3.so.6.0\" in it. If xine can find the RealPlayer " - "codecs, it will use them to decode RealPlayer content " - "for you. Consult the xine FAQ for more information on " - "how to install the codecs."), - 10, NULL, this); - - lprintf ("real codec path : %s\n", real_codec_path); + _x_real_codecs_init(xine); return this; } diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index c4afcbeea..f1f47fb6b 100644 --- a/src/libreal/real_common.c +++ b/src/libreal/real_common.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real_common.c,v 1.2 2007/03/16 20:21:40 dgp85 Exp $ + * $Id: real_common.c,v 1.3 2007/03/16 20:45:21 dgp85 Exp $ * * Common function for the thin layer to use Real binary-only codecs in xine */ @@ -28,6 +28,8 @@ #define LOG */ +#include <sys/stat.h> + #include "real_common.h" #ifdef __alpha__ @@ -60,3 +62,46 @@ void __pure_virtual(void) { void ___brk_addr(void) { exit(0); } void __ctype_b(void) { exit(0); } #endif + +void _x_real_codecs_init(xine_t *const xine) { + const char *default_real_codecs_path = ""; + const char *real_codecs_path = NULL; + struct stat s; + +#define try_real_path(path) \ + if (!stat (path "/dvr3.so.6.0", &s)) \ + default_real_codecs_path = path; +#define try_real_subpath(path) \ + try_real_path("/usr/" path) \ + else try_real_path("/usr/local" path) \ + else try_real_path("/opt" path) + + /* The priority is for the first found */ + try_real_subpath("lib/win32") + else try_real_subpath("lib/codecs") + else try_real_subpath("lib64/RealPlayer10/codecs") + else try_real_subpath("lib/RealPlayer10/codecs") + else try_real_subpath("lib64/RealPlayer9/users/Real/Codecs") + else try_real_subpath("lib/RealPlayer9/users/Real/Codecs") + else try_real_subpath("lib/RealPlayer8/Codecs") + else try_real_subpath("RealPlayer8/Codecs"); + +#undef try_real_path +#undef try_real_subpath + + real_codecs_path = + xine->config->register_filename (xine->config, "decoder.external.real_codecs_path", + default_real_codecs_path, + XINE_CONFIG_STRING_IS_DIRECTORY_NAME, + _("path to RealPlayer codecs"), + _("If you have RealPlayer installed, specify the path " + "to its codec directory here. You can easily find " + "the codec directory by looking for a file named " + "\"drv3.so.6.0\" in it. If xine can find the RealPlayer " + "codecs, it will use them to decode RealPlayer content " + "for you. Consult the xine FAQ for more information on " + "how to install the codecs."), + 10, NULL, NULL); + + lprintf ("real codecs path : %s\n", real_codec_path); +} diff --git a/src/libreal/real_common.h b/src/libreal/real_common.h index 2d4c1dee0..717c80168 100644 --- a/src/libreal/real_common.h +++ b/src/libreal/real_common.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real_common.h,v 1.2 2007/03/16 20:21:40 dgp85 Exp $ + * $Id: real_common.h,v 1.3 2007/03/16 20:45:21 dgp85 Exp $ * * Common function for the thin layer to use Real binary-only codecs in xine */ @@ -54,4 +54,6 @@ void ___brk_addr(void) EXPORTED; void __ctype_b(void) EXPORTED; #endif +void _x_real_codecs_init(xine_t *const xine); + #endif diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c index 779f577e2..9cf49a2db 100644 --- a/src/libreal/xine_decoder.c +++ b/src/libreal/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.87 2007/03/16 20:02:33 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.88 2007/03/16 20:45:21 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -44,6 +44,8 @@ #include "buffer.h" #include "xineutils.h" +#include "real_common.h" + typedef struct { video_decoder_class_t decoder_class; @@ -529,9 +531,6 @@ static void *init_class (xine_t *xine, void *data) { real_class_t *this; config_values_t *config = xine->config; - char *real_codec_path; - char *default_real_codec_path = ""; - struct stat s; this = (real_class_t *) xine_xmalloc (sizeof (real_class_t)); @@ -540,45 +539,7 @@ static void *init_class (xine_t *xine, void *data) { this->decoder_class.get_description = get_description; this->decoder_class.dispose = dispose_class; - /* try some auto-detection */ - - if (!stat ("/usr/local/RealPlayer8/Codecs/drv3.so.6.0", &s)) - default_real_codec_path = "/usr/local/RealPlayer8/Codecs"; - if (!stat ("/usr/RealPlayer8/Codecs/drv3.so.6.0", &s)) - default_real_codec_path = "/usr/RealPlayer8/Codecs"; - if (!stat ("/usr/lib/RealPlayer8/Codecs/drv3.so.6.0", &s)) - default_real_codec_path = "/usr/lib/RealPlayer8/Codecs"; - if (!stat ("/opt/RealPlayer8/Codecs/drv3.so.6.0", &s)) - default_real_codec_path = "/opt/RealPlayer8/Codecs"; - if (!stat ("/usr/lib/RealPlayer9/users/Real/Codecs/drv3.so.6.0", &s)) - default_real_codec_path = "/usr/lib/RealPlayer9/users/Real/Codecs"; - if (!stat ("/usr/lib/RealPlayer10/codecs/drvc.so", &s)) - default_real_codec_path = "/usr/lib/RealPlayer10/codecs"; - if (!stat ("/usr/lib64/RealPlayer8/Codecs/drv3.so.6.0", &s)) - default_real_codec_path = "/usr/lib64/RealPlayer8/Codecs"; - if (!stat ("/usr/lib64/RealPlayer9/users/Real/Codecs/drv3.so.6.0", &s)) - default_real_codec_path = "/usr/lib64/RealPlayer9/users/Real/Codecs"; - if (!stat ("/usr/lib64/RealPlayer10/codecs/drvc.so", &s)) - default_real_codec_path = "/usr/lib64/RealPlayer10/codecs"; - if (!stat ("/usr/lib/codecs/drv3.so.6.0", &s)) - default_real_codec_path = "/usr/lib/codecs"; - if (!stat ("/usr/lib/win32/drv3.so.6.0", &s)) - default_real_codec_path = "/usr/lib/win32"; - - real_codec_path = config->register_filename (config, "decoder.external.real_codecs_path", - default_real_codec_path, - XINE_CONFIG_STRING_IS_DIRECTORY_NAME, - _("path to RealPlayer codecs"), - _("If you have RealPlayer installed, specify the path " - "to its codec directory here. You can easily find " - "the codec directory by looking for a file named " - "\"drv3.so.6.0\" in it. If xine can find the RealPlayer " - "codecs, it will use them to decode RealPlayer content " - "for you. Consult the xine FAQ for more information on " - "how to install the codecs."), - 10, NULL, this); - - lprintf ("real codec path : %s\n", real_codec_path); + _x_real_codecs_init(); return this; } -- cgit v1.2.3 From 92e7af754617240646c35482f62a34603e6c50e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 21:37:58 +0000 Subject: Move the wrapper to open the real codecs in the common unit, and assume that the alternative name is always the same with .6.0 at the end. Prefer the full name to the reduced one. CVS patchset: 8683 CVS date: 2007/03/16 21:37:58 --- src/libreal/audio_decoder.c | 41 +++++++++++++---------------------------- src/libreal/real_common.c | 37 ++++++++++++++++++++++++++++++++++++- src/libreal/real_common.h | 4 +++- src/libreal/xine_decoder.c | 37 +++++++++++-------------------------- 4 files changed, 63 insertions(+), 56 deletions(-) (limited to 'src') diff --git a/src/libreal/audio_decoder.c b/src/libreal/audio_decoder.c index a6a0c551f..b2e000a3a 100644 --- a/src/libreal/audio_decoder.c +++ b/src/libreal/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.54 2007/03/16 20:45:21 dgp85 Exp $ + * $Id: audio_decoder.c,v 1.55 2007/03/16 21:37:58 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -104,29 +104,14 @@ typedef struct { void *extras; } ra_init_t; -static int load_syms_linux (realdec_decoder_t *this, char *codec_name, - const char *alt_codec_name) { +static int load_syms_linux (realdec_decoder_t *this, const char *codec_name) { + cfg_entry_t* entry = + this->stream->xine->config->lookup_entry(this->stream->xine->config, + "decoder.external.real_codecs_path"); - cfg_entry_t* entry = this->stream->xine->config->lookup_entry( - this->stream->xine->config, "decoder.external.real_codecs_path"); - char path[1024]; - struct stat sb; - - snprintf (path, sizeof(path), "%s/%s", entry->str_value, codec_name); - if (stat(path, &sb)) - snprintf (path, sizeof(path), "%s/%s", entry->str_value, alt_codec_name); - - lprintf ("(audio) opening shared obj '%s'\n", path); - - this->ra_handle = dlopen (path, RTLD_LAZY); - - if (!this->ra_handle) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libareal: error: %s\n", dlerror()); - _x_message(this->stream, XINE_MSG_LIBRARY_LOAD_ERROR, - codec_name, NULL); + if ( (this->ra_handle = _x_real_codec_open(this->stream, entry->str_value, codec_name)) == NULL ) return 0; - } - + this->raCloseCodec = dlsym (this->ra_handle, "RACloseCodec"); this->raDecode = dlsym (this->ra_handle, "RADecode"); this->raFlush = dlsym (this->ra_handle, "RAFlush"); @@ -142,7 +127,7 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name, !this->raGetFlavorProperty || !this->raOpenCodec2 || !this->raSetFlavor || /*!raSetDLLAccessPath ||*/ !this->raInitDecoder){ xprintf (this->stream->xine, XINE_VERBOSITY_LOG, - _("libareal: (audio) Cannot resolve symbols - incompatible dll: %s\n"), path); + _("libareal: (audio) Cannot resolve symbols - incompatible dll: %s\n"), codec_name); return 0; } @@ -231,32 +216,32 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { switch (buf->type) { case BUF_AUDIO_COOK: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Cook"); - if (!load_syms_linux (this, "cook.so", "cook.so.6.0")) + if (!load_syms_linux (this, "cook.so")) return 0; break; case BUF_AUDIO_ATRK: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Atrac"); - if (!load_syms_linux (this, "atrc.so", "atrc.so.6.0")) + if (!load_syms_linux (this, "atrc.so")) return 0; this->block_align = 384; break; case BUF_AUDIO_14_4: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Real 14.4"); - if (!load_syms_linux (this, "14_4.so", "14_4.so.6.0")) + if (!load_syms_linux (this, "14_4.so")) return 0; break; case BUF_AUDIO_28_8: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Real 28.8"); - if (!load_syms_linux (this, "28_8.so", "28_8.so.6.0")) + if (!load_syms_linux (this, "28_8.so")) return 0; break; case BUF_AUDIO_SIPRO: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Sipro"); - if (!load_syms_linux (this, "sipr.so", "sipr.so.6.0")) + if (!load_syms_linux (this, "sipr.so")) return 0; /* this->block_align = 19; */ break; diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index f1f47fb6b..d2fccd28d 100644 --- a/src/libreal/real_common.c +++ b/src/libreal/real_common.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real_common.c,v 1.3 2007/03/16 20:45:21 dgp85 Exp $ + * $Id: real_common.c,v 1.4 2007/03/16 21:37:58 dgp85 Exp $ * * Common function for the thin layer to use Real binary-only codecs in xine */ @@ -28,7 +28,11 @@ #define LOG */ +#include "config.h" + #include <sys/stat.h> +#include <string.h> +#include <dlfcn.h> #include "real_common.h" @@ -105,3 +109,34 @@ void _x_real_codecs_init(xine_t *const xine) { lprintf ("real codecs path : %s\n", real_codec_path); } + +void *_x_real_codec_open(xine_stream_t *const stream, const char *const path, + const char *const codec_name) { + char *codecpath = NULL; + void *codecmodule = NULL; + + asprintf(&codecpath, "%s/%s.6.0", path, codec_name); + if ( (codecmodule = dlopen(codecpath, RTLD_NOW)) ) { + free(codecpath); + return codecmodule; + } + + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, + LOG_MODULE ": error loading %s: %s\n", codecpath, dlerror()); + + free(codecpath); + asprintf(&codecpath, "%s/%s", path, codec_name); + if ( (codecmodule = dlopen(codecpath, RTLD_NOW)) ) { + free(codecpath); + return codecmodule; + } + + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, + LOG_MODULE ": error loading %s: %s\n", codecpath, dlerror()); + + free(codecpath); + + _x_message(stream, XINE_MSG_LIBRARY_LOAD_ERROR, codec_name, NULL); + + return NULL; +} diff --git a/src/libreal/real_common.h b/src/libreal/real_common.h index 717c80168..fd27ce5cf 100644 --- a/src/libreal/real_common.h +++ b/src/libreal/real_common.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real_common.h,v 1.3 2007/03/16 20:45:21 dgp85 Exp $ + * $Id: real_common.h,v 1.4 2007/03/16 21:37:58 dgp85 Exp $ * * Common function for the thin layer to use Real binary-only codecs in xine */ @@ -55,5 +55,7 @@ void __ctype_b(void) EXPORTED; #endif void _x_real_codecs_init(xine_t *const xine); +void *_x_real_codec_open(xine_stream_t *const stream, const char *const path, + const char *const codec_name); #endif diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c index 9cf49a2db..b08222a9a 100644 --- a/src/libreal/xine_decoder.c +++ b/src/libreal/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.88 2007/03/16 20:45:21 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.89 2007/03/16 21:37:58 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -109,29 +109,14 @@ void __pure_virtual(void); * real codec loader */ -static int load_syms_linux (realdec_decoder_t *this, char *codec_name, - const char *alt_codec_name) { +static int load_syms_linux (realdec_decoder_t *this, const char *codec_name) { + cfg_entry_t* entry = + this->stream->xine->config->lookup_entry(this->stream->xine->config, + "decoder.external.real_codecs_path"); - cfg_entry_t* entry = this->stream->xine->config->lookup_entry( - this->stream->xine->config, "decoder.external.real_codecs_path"); - char path[1024]; - struct stat sb; - - snprintf (path, sizeof(path), "%s/%s", entry->str_value, codec_name); - if (stat(path, &sb)) - snprintf (path, sizeof(path), "%s/%s", entry->str_value, alt_codec_name); - - lprintf ("opening shared obj '%s'\n", path); - - this->rv_handle = dlopen (path, RTLD_LAZY); - - if (!this->rv_handle) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libreal: error: %s\n", dlerror()); - _x_message(this->stream, XINE_MSG_LIBRARY_LOAD_ERROR, - codec_name, NULL); + if ( (this->rv_handle = _x_real_codec_open(this->stream, entry->str_value, codec_name)) == NULL ) return 0; - } - + this->rvyuv_custom_message = dlsym (this->rv_handle, "RV20toYUV420CustomMessage"); this->rvyuv_free = dlsym (this->rv_handle, "RV20toYUV420Free"); this->rvyuv_hive_message = dlsym (this->rv_handle, "RV20toYUV420HiveMessage"); @@ -173,17 +158,17 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { switch (buf->type) { case BUF_VIDEO_RV20: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Real Video 2.0"); - if (!load_syms_linux (this, "drv2.so", "drv2.so.6.0")) + if (!load_syms_linux (this, "drv2.so")) return 0; break; case BUF_VIDEO_RV30: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Real Video 3.0"); - if (!load_syms_linux (this, "drvc.so", "drv3.so.6.0")) + if (!load_syms_linux (this, "drvc.so")) return 0; break; case BUF_VIDEO_RV40: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Real Video 4.0"); - if (!load_syms_linux(this, "drvc.so", "drv4.so.6.0")) + if (!load_syms_linux(this, "drvc.so")) return 0; break; default: @@ -539,7 +524,7 @@ static void *init_class (xine_t *xine, void *data) { this->decoder_class.get_description = get_description; this->decoder_class.dispose = dispose_class; - _x_real_codecs_init(); + _x_real_codecs_init(xine); return this; } -- cgit v1.2.3 From 675677d25d11feb67ae5697395abf9deaf9469ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 22:14:57 +0000 Subject: If REAL_CODEC_PATH is defined, use that as only default path, so that distributions can reduce the code used in their packages, and limit the path where to load the drivers by default. CVS patchset: 8684 CVS date: 2007/03/16 22:14:57 --- src/libreal/real_common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index d2fccd28d..01d644cb8 100644 --- a/src/libreal/real_common.c +++ b/src/libreal/real_common.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real_common.c,v 1.4 2007/03/16 21:37:58 dgp85 Exp $ + * $Id: real_common.c,v 1.5 2007/03/16 22:14:57 dgp85 Exp $ * * Common function for the thin layer to use Real binary-only codecs in xine */ @@ -68,6 +68,9 @@ void __ctype_b(void) { exit(0); } #endif void _x_real_codecs_init(xine_t *const xine) { +#ifdef REAL_CODEC_PATH + const char *const default_real_codecs_path = REAL_CODEC_PATH; +#else const char *default_real_codecs_path = ""; const char *real_codecs_path = NULL; struct stat s; @@ -92,6 +95,7 @@ void _x_real_codecs_init(xine_t *const xine) { #undef try_real_path #undef try_real_subpath +#endif real_codecs_path = xine->config->register_filename (xine->config, "decoder.external.real_codecs_path", -- cgit v1.2.3 From 5c20c1161c36cc97478c5527576961013e5dc8e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 22:26:54 +0000 Subject: Don't check only for drv3.so.6.0, as that is not present for x86-64 or PowerPC Real codecs. CVS patchset: 8685 CVS date: 2007/03/16 22:26:54 --- src/libreal/real_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index 01d644cb8..08d7aec7e 100644 --- a/src/libreal/real_common.c +++ b/src/libreal/real_common.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real_common.c,v 1.5 2007/03/16 22:14:57 dgp85 Exp $ + * $Id: real_common.c,v 1.6 2007/03/16 22:26:54 dgp85 Exp $ * * Common function for the thin layer to use Real binary-only codecs in xine */ @@ -76,7 +76,7 @@ void _x_real_codecs_init(xine_t *const xine) { struct stat s; #define try_real_path(path) \ - if (!stat (path "/dvr3.so.6.0", &s)) \ + if ( !stat (path "/dvr3.so.6.0", &s) || !stat (path "/dvrc.so", &s) ) \ default_real_codecs_path = path; #define try_real_subpath(path) \ try_real_path("/usr/" path) \ -- cgit v1.2.3 From 3e10669d9230636fe5ef56f05c5b8748414ed383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 22:28:25 +0000 Subject: real_codecs_path has always to be declared. CVS patchset: 8686 CVS date: 2007/03/16 22:28:25 --- src/libreal/real_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index 08d7aec7e..ea2336f95 100644 --- a/src/libreal/real_common.c +++ b/src/libreal/real_common.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real_common.c,v 1.6 2007/03/16 22:26:54 dgp85 Exp $ + * $Id: real_common.c,v 1.7 2007/03/16 22:28:25 dgp85 Exp $ * * Common function for the thin layer to use Real binary-only codecs in xine */ @@ -68,11 +68,11 @@ void __ctype_b(void) { exit(0); } #endif void _x_real_codecs_init(xine_t *const xine) { -#ifdef REAL_CODEC_PATH + const char *real_codecs_path = NULL; +src/libreal/#ifdef REAL_CODEC_PATH const char *const default_real_codecs_path = REAL_CODEC_PATH; #else const char *default_real_codecs_path = ""; - const char *real_codecs_path = NULL; struct stat s; #define try_real_path(path) \ -- cgit v1.2.3 From 3173cb680cabe292d6d6512d3638484545ba4601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 22:28:48 +0000 Subject: Sigh, remove wrong paste. CVS patchset: 8687 CVS date: 2007/03/16 22:28:48 --- src/libreal/real_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index ea2336f95..29aacbd8c 100644 --- a/src/libreal/real_common.c +++ b/src/libreal/real_common.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real_common.c,v 1.7 2007/03/16 22:28:25 dgp85 Exp $ + * $Id: real_common.c,v 1.8 2007/03/16 22:28:48 dgp85 Exp $ * * Common function for the thin layer to use Real binary-only codecs in xine */ @@ -69,7 +69,7 @@ void __ctype_b(void) { exit(0); } void _x_real_codecs_init(xine_t *const xine) { const char *real_codecs_path = NULL; -src/libreal/#ifdef REAL_CODEC_PATH +#ifdef REAL_CODEC_PATH const char *const default_real_codecs_path = REAL_CODEC_PATH; #else const char *default_real_codecs_path = ""; -- cgit v1.2.3 From 9c8d1c5851fbe93e986bbf7e0fbe16c7592b58fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 22:32:13 +0000 Subject: Add proper support for disabling Real binary codecs support and add a parameter to define a codecs path during configure stage, rather than probing at runtime. CVS patchset: 8688 CVS date: 2007/03/16 22:32:13 --- src/libreal/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/libreal/Makefile.am b/src/libreal/Makefile.am index 4c46db78c..21c2e47ba 100644 --- a/src/libreal/Makefile.am +++ b/src/libreal/Makefile.am @@ -1,6 +1,8 @@ include $(top_srcdir)/misc/Makefile.common +if ENABLE_REAL xineplug_LTLIBRARIES = xineplug_decode_real.la xineplug_decode_real_audio.la +endif xineplug_decode_real_la_SOURCES = xine_decoder.c real_common.c xineplug_decode_real_la_LIBADD = $(XINE_LIB) $(DYNAMIC_LD_LIBS) -- cgit v1.2.3 From 38dcab246c58c2088c3ec2aed6e632dae6a8467d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 22:46:49 +0000 Subject: Actually, drv3.so.6.0 is still needed to be checked for the Alpha codecs, but as those are the oldest ones, check drvc.so for autodetection, only. CVS patchset: 8689 CVS date: 2007/03/16 22:46:49 --- src/libreal/real_common.c | 20 ++++++++++++++++---- src/libreal/real_common.h | 5 +++-- src/libreal/xine_decoder.c | 10 +++++----- 3 files changed, 24 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index 29aacbd8c..28c37c33e 100644 --- a/src/libreal/real_common.c +++ b/src/libreal/real_common.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real_common.c,v 1.8 2007/03/16 22:28:48 dgp85 Exp $ + * $Id: real_common.c,v 1.9 2007/03/16 22:46:49 dgp85 Exp $ * * Common function for the thin layer to use Real binary-only codecs in xine */ @@ -76,7 +76,7 @@ void _x_real_codecs_init(xine_t *const xine) { struct stat s; #define try_real_path(path) \ - if ( !stat (path "/dvr3.so.6.0", &s) || !stat (path "/dvrc.so", &s) ) \ + if (!stat (path "/dvrc.so", &s)) \ default_real_codecs_path = path; #define try_real_subpath(path) \ try_real_path("/usr/" path) \ @@ -105,7 +105,7 @@ void _x_real_codecs_init(xine_t *const xine) { _("If you have RealPlayer installed, specify the path " "to its codec directory here. You can easily find " "the codec directory by looking for a file named " - "\"drv3.so.6.0\" in it. If xine can find the RealPlayer " + "\"drvc.so\" in it. If xine can find the RealPlayer " "codecs, it will use them to decode RealPlayer content " "for you. Consult the xine FAQ for more information on " "how to install the codecs."), @@ -115,7 +115,8 @@ void _x_real_codecs_init(xine_t *const xine) { } void *_x_real_codec_open(xine_stream_t *const stream, const char *const path, - const char *const codec_name) { + const char *const codec_name, + const char *const codec_alternate) { char *codecpath = NULL; void *codecmodule = NULL; @@ -140,6 +141,17 @@ void *_x_real_codec_open(xine_stream_t *const stream, const char *const path, free(codecpath); + if ( codec_alternate ) { + asprintf(&codecpath, "%s/%s", path, codec_alternate); + if ( (codecmodule = dlopen(codecpath, RTLD_NOW)) ) { + free(codecpath); + return codecmodule; + } + + xprintf (stream->xine, XINE_VERBOSITY_DEBUG, + LOG_MODULE ": error loading %s: %s\n", codecpath, dlerror()); + } + _x_message(stream, XINE_MSG_LIBRARY_LOAD_ERROR, codec_name, NULL); return NULL; diff --git a/src/libreal/real_common.h b/src/libreal/real_common.h index fd27ce5cf..86cf4a63f 100644 --- a/src/libreal/real_common.h +++ b/src/libreal/real_common.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real_common.h,v 1.4 2007/03/16 21:37:58 dgp85 Exp $ + * $Id: real_common.h,v 1.5 2007/03/16 22:46:49 dgp85 Exp $ * * Common function for the thin layer to use Real binary-only codecs in xine */ @@ -56,6 +56,7 @@ void __ctype_b(void) EXPORTED; void _x_real_codecs_init(xine_t *const xine); void *_x_real_codec_open(xine_stream_t *const stream, const char *const path, - const char *const codec_name); + const char *const codec_name, + const char *const codec_alternate); #endif diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c index b08222a9a..761b4bfc2 100644 --- a/src/libreal/xine_decoder.c +++ b/src/libreal/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.89 2007/03/16 21:37:58 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.90 2007/03/16 22:46:49 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -109,12 +109,12 @@ void __pure_virtual(void); * real codec loader */ -static int load_syms_linux (realdec_decoder_t *this, const char *codec_name) { +static int load_syms_linux (realdec_decoder_t *this, const char *codec_name, const char *const codec_alternate = NULL) { cfg_entry_t* entry = this->stream->xine->config->lookup_entry(this->stream->xine->config, "decoder.external.real_codecs_path"); - if ( (this->rv_handle = _x_real_codec_open(this->stream, entry->str_value, codec_name)) == NULL ) + if ( (this->rv_handle = _x_real_codec_open(this->stream, entry->str_value, codec_name, codec_alternate)) == NULL ) return 0; this->rvyuv_custom_message = dlsym (this->rv_handle, "RV20toYUV420CustomMessage"); @@ -163,12 +163,12 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { break; case BUF_VIDEO_RV30: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Real Video 3.0"); - if (!load_syms_linux (this, "drvc.so")) + if (!load_syms_linux (this, "drvc.so", "drv3.so.6.0")) return 0; break; case BUF_VIDEO_RV40: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Real Video 4.0"); - if (!load_syms_linux(this, "drvc.so")) + if (!load_syms_linux(this, "drvc.so", "drv3.so.6.0")) return 0; break; default: -- cgit v1.2.3 From 2cfb08e9cc94e0707056edd5432a1c0ca66eeca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 22:49:16 +0000 Subject: Always pass alternate, and avoid checking for .6.0. CVS patchset: 8690 CVS date: 2007/03/16 22:49:16 --- src/libreal/real_common.c | 12 +----------- src/libreal/xine_decoder.c | 6 +++--- 2 files changed, 4 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index 28c37c33e..dbe528ee0 100644 --- a/src/libreal/real_common.c +++ b/src/libreal/real_common.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real_common.c,v 1.9 2007/03/16 22:46:49 dgp85 Exp $ + * $Id: real_common.c,v 1.10 2007/03/16 22:49:16 dgp85 Exp $ * * Common function for the thin layer to use Real binary-only codecs in xine */ @@ -120,16 +120,6 @@ void *_x_real_codec_open(xine_stream_t *const stream, const char *const path, char *codecpath = NULL; void *codecmodule = NULL; - asprintf(&codecpath, "%s/%s.6.0", path, codec_name); - if ( (codecmodule = dlopen(codecpath, RTLD_NOW)) ) { - free(codecpath); - return codecmodule; - } - - xprintf (stream->xine, XINE_VERBOSITY_DEBUG, - LOG_MODULE ": error loading %s: %s\n", codecpath, dlerror()); - - free(codecpath); asprintf(&codecpath, "%s/%s", path, codec_name); if ( (codecmodule = dlopen(codecpath, RTLD_NOW)) ) { free(codecpath); diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c index 761b4bfc2..8c5ac00d2 100644 --- a/src/libreal/xine_decoder.c +++ b/src/libreal/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.90 2007/03/16 22:46:49 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.91 2007/03/16 22:49:16 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -109,7 +109,7 @@ void __pure_virtual(void); * real codec loader */ -static int load_syms_linux (realdec_decoder_t *this, const char *codec_name, const char *const codec_alternate = NULL) { +static int load_syms_linux (realdec_decoder_t *this, const char *codec_name, const char *const codec_alternate) { cfg_entry_t* entry = this->stream->xine->config->lookup_entry(this->stream->xine->config, "decoder.external.real_codecs_path"); @@ -158,7 +158,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { switch (buf->type) { case BUF_VIDEO_RV20: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Real Video 2.0"); - if (!load_syms_linux (this, "drv2.so")) + if (!load_syms_linux (this, "drv2.so", "drv2.so.6.0")) return 0; break; case BUF_VIDEO_RV30: -- cgit v1.2.3 From e73dbe5c0e49246dde3facec3872b2afe8a6878e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 22:54:06 +0000 Subject: Fix real audio codecs. CVS patchset: 8691 CVS date: 2007/03/16 22:54:06 --- src/libreal/audio_decoder.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/libreal/audio_decoder.c b/src/libreal/audio_decoder.c index b2e000a3a..cea08d90d 100644 --- a/src/libreal/audio_decoder.c +++ b/src/libreal/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.55 2007/03/16 21:37:58 dgp85 Exp $ + * $Id: audio_decoder.c,v 1.56 2007/03/16 22:54:06 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -216,32 +216,32 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { switch (buf->type) { case BUF_AUDIO_COOK: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Cook"); - if (!load_syms_linux (this, "cook.so")) + if (!load_syms_linux (this, "cook.so", "cook.so.6.0")) return 0; break; case BUF_AUDIO_ATRK: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Atrac"); - if (!load_syms_linux (this, "atrc.so")) + if (!load_syms_linux (this, "atrc.so", "atrc.so.6.0")) return 0; this->block_align = 384; break; case BUF_AUDIO_14_4: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Real 14.4"); - if (!load_syms_linux (this, "14_4.so")) + if (!load_syms_linux (this, "14_4.so", "14_4.so.6.0")) return 0; break; case BUF_AUDIO_28_8: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Real 28.8"); - if (!load_syms_linux (this, "28_8.so")) + if (!load_syms_linux (this, "28_8.so", "28_8.so.6.0")) return 0; break; case BUF_AUDIO_SIPRO: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "Sipro"); - if (!load_syms_linux (this, "sipr.so")) + if (!load_syms_linux (this, "sipr.so", "sipr.so.6.0")) return 0; /* this->block_align = 19; */ break; -- cgit v1.2.3 From fc6878e4c03032b9f905cf922465427c52061faa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 22:54:56 +0000 Subject: Remember to save before C-x v v CVS patchset: 8692 CVS date: 2007/03/16 22:54:56 --- src/libreal/audio_decoder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/libreal/audio_decoder.c b/src/libreal/audio_decoder.c index cea08d90d..678da6926 100644 --- a/src/libreal/audio_decoder.c +++ b/src/libreal/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.56 2007/03/16 22:54:06 dgp85 Exp $ + * $Id: audio_decoder.c,v 1.57 2007/03/16 22:54:56 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -104,12 +104,12 @@ typedef struct { void *extras; } ra_init_t; -static int load_syms_linux (realdec_decoder_t *this, const char *codec_name) { +static int load_syms_linux (realdec_decoder_t *this, const char *const codec_name, const char *const codec_alternate) { cfg_entry_t* entry = this->stream->xine->config->lookup_entry(this->stream->xine->config, "decoder.external.real_codecs_path"); - if ( (this->ra_handle = _x_real_codec_open(this->stream, entry->str_value, codec_name)) == NULL ) + if ( (this->ra_handle = _x_real_codec_open(this->stream, entry->str_value, codec_name, codec_alternate)) == NULL ) return 0; this->raCloseCodec = dlsym (this->ra_handle, "RACloseCodec"); -- cgit v1.2.3 From cdb82e61cac586c497dd77fd61696b7c2113c98d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Fri, 16 Mar 2007 23:22:13 +0000 Subject: Import the changes for 64-bit safety from MPlayer, this way Real Video and Real Audio binary codecs can be used on x86-64 and Alpha too. CVS patchset: 8693 CVS date: 2007/03/16 23:22:13 --- src/libreal/xine_decoder.c | 68 ++++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c index 8c5ac00d2..8bc6e4561 100644 --- a/src/libreal/xine_decoder.c +++ b/src/libreal/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.91 2007/03/16 22:49:16 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.92 2007/03/16 23:22:13 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -63,11 +63,11 @@ typedef struct realdec_decoder_s { void *rv_handle; - uint32_t (*rvyuv_custom_message)(uint32_t*, void*); + uint32_t (*rvyuv_custom_message)(void*, void*); uint32_t (*rvyuv_free)(void*); uint32_t (*rvyuv_hive_message)(uint32_t, uint32_t); uint32_t (*rvyuv_init)(void*, void*); /* initdata,context */ - uint32_t (*rvyuv_transform)(char*, char*, uint32_t*, uint32_t*,void*); + uint32_t (*rvyuv_transform)(char*, char*, void*, uint32_t*,void*); void *context; @@ -100,10 +100,27 @@ typedef struct { int32_t format; } rv_init_t; - -void *__builtin_vec_new(uint32_t size); -void __builtin_vec_delete(void *mem); -void __pure_virtual(void); +/* + * Structures for data packets. These used to be tables of unsigned ints, but + * that does not work on 64 bit platforms (e.g. Alpha). The entries that are + * pointers get truncated. Pointers on 64 bit platforms are 8 byte longs. + * So we have to use structures so the compiler will assign the proper space + * for the pointer. + */ +typedef struct cmsg_data_s { + uint32_t data1; + uint32_t data2; + uint32_t* dimensions; +} cmsg_data_t; + +typedef struct transform_in_s { + uint32_t len; + uint32_t unknown1; + uint32_t chunks; + uint32_t* extra; + uint32_t unknown2; + uint32_t timestamp; +} transform_in_t; /* * real codec loader @@ -233,20 +250,14 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { /* setup rv30 codec (codec sub-type and image dimensions): */ if ((init_data.format>=0x20200002) && (buf->type != BUF_VIDEO_RV40)) { int i, j; - uint32_t *cmsg24; - uint32_t cmsg_data[9]; + uint32_t cmsg24[(buf->size - 34 + 2) * sizeof(uint32_t)]; + cmsg_data_t cmsg_data = { 0x24, 1 + ((init_data.subformat >> 16) & 7), &cmsg24[0] }; - cmsg24 = xine_xmalloc((buf->size - 34 + 2) * sizeof(uint32_t)); - cmsg24[0] = this->width; cmsg24[1] = this->height; for(i = 2, j = 34; j < buf->size; i++, j++) cmsg24[i] = 4 * buf->content[j]; - cmsg_data[0] = 0x24; - cmsg_data[1] = 1 + ((init_data.subformat >> 16) & 7); - cmsg_data[2] = (uint32_t) cmsg24; - #ifdef LOG printf ("libreal: CustomMessage cmsg_data:\n"); xine_hexdump ((uint8_t *) cmsg_data, sizeof (cmsg_data)); @@ -254,9 +265,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { xine_hexdump ((uint8_t *) cmsg24, (buf->size - 34 + 2) * sizeof(uint32_t)); #endif - this->rvyuv_custom_message (cmsg_data, this->context); - - free(cmsg24); + this->rvyuv_custom_message (&cmsg_data, this->context); } this->stream->video_out->open(this->stream->video_out, this->stream); @@ -336,16 +345,23 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) vo_frame_t *img; uint32_t transform_out[5]; - uint32_t transform_in[6]; + transform_in_t transform_in = { + this->chunk_buffer_size, + /* length of the packet (sub-packets appended) */ + 0, + /* unknown, seems to be unused */ + buf->decoder_info[2], + /* number of sub-packets - 1 */ + buf->decoder_info_ptr[2], + /* table of sub-packet offsets */ + 0, + /* unknown, seems to be unused */ + this->pts / 90 + /* timestamp (the integer value from the stream) */ + }; lprintf ("chunk table\n"); - transform_in[0] = this->chunk_buffer_size; /* length of the packet (sub-packets appended) */ - transform_in[1] = 0; /* unknown, seems to be unused */ - transform_in[2] = buf->decoder_info[2]; /* number of sub-packets - 1 */ - transform_in[3] = (uint32_t) buf->decoder_info_ptr[2]; /* table of sub-packet offsets */ - transform_in[4] = 0; /* unknown, seems to be unused */ - transform_in[5] = this->pts / 90; /* timestamp (the integer value from the stream) */ #ifdef LOG printf ("libreal: got %d chunks\n", @@ -364,7 +380,7 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) result = this->rvyuv_transform (this->chunk_buffer, this->frame_buffer, - transform_in, + &transform_in, transform_out, this->context); -- cgit v1.2.3 From 34b5a8c6d29bc613e7c00ba56c2eccdad182af27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 17 Mar 2007 00:28:41 +0000 Subject: Boost the priority of the real audio decoder over FFmpeg's, as demux_real does not provide a suitable extradata for FFmpeg. CVS patchset: 8695 CVS date: 2007/03/17 00:28:41 --- src/libreal/audio_decoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libreal/audio_decoder.c b/src/libreal/audio_decoder.c index 678da6926..c4447e232 100644 --- a/src/libreal/audio_decoder.c +++ b/src/libreal/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.57 2007/03/16 22:54:56 dgp85 Exp $ + * $Id: audio_decoder.c,v 1.58 2007/03/17 00:28:41 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -628,7 +628,7 @@ static uint32_t audio_types[] = { static const decoder_info_t dec_info_audio = { audio_types, /* supported types */ - 5 /* priority */ + 7 /* priority */ }; const plugin_info_t xine_plugin_info[] EXPORTED = { -- cgit v1.2.3 From 75fd3688f52f3d9574cf7204fd74c9eb9f2a639b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 17 Mar 2007 06:11:30 +0000 Subject: Instead of relying on FreeBSD being the only system not having __environ stderr ___brk_addr and __ctype_b, look for them during ./configure stage. Also check for alternatives, and check for compiler's weak aliasing support only if it's actually going to be used. CVS patchset: 8696 CVS date: 2007/03/17 06:11:30 --- src/libreal/real_common.c | 7 +++++-- src/libreal/real_common.h | 28 +++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index dbe528ee0..7110198db 100644 --- a/src/libreal/real_common.c +++ b/src/libreal/real_common.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real_common.c,v 1.10 2007/03/16 22:49:16 dgp85 Exp $ + * $Id: real_common.c,v 1.11 2007/03/17 06:11:30 dgp85 Exp $ * * Common function for the thin layer to use Real binary-only codecs in xine */ @@ -62,8 +62,11 @@ void __pure_virtual(void) { #endif -#ifdef __FreeBSD__ /* TODO: alias them if at all possible */ +#ifndef HAVE____BRK_ADDR void ___brk_addr(void) { exit(0); } +#endif + +#ifndef HAVE___CTYPE_B void __ctype_b(void) { exit(0); } #endif diff --git a/src/libreal/real_common.h b/src/libreal/real_common.h index 86cf4a63f..7fcd1c4fa 100644 --- a/src/libreal/real_common.h +++ b/src/libreal/real_common.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real_common.h,v 1.5 2007/03/16 22:46:49 dgp85 Exp $ + * $Id: real_common.h,v 1.6 2007/03/17 06:11:31 dgp85 Exp $ * * Common function for the thin layer to use Real binary-only codecs in xine */ @@ -44,13 +44,31 @@ void __pure_virtual(void) EXPORTED; #endif -#ifdef __FreeBSD__ - #ifdef SUPPORT_ATTRIBUTE_ALIAS -char **__environ __attribute__((weak, alias("environ"))); +#ifndef HAVE___ENVIRON +# ifdef HAVE__ENVIRON + char **__environ __attribute__((weak, alias("_environ"))); +# elif defined(HAVE_ENVIRON) + char **__environ __attribute__((weak, alias("environ"))); +# else + char **fake__environ = { NULL }; + char **__environ __attribute__((weak, alias("fake__environ"))); +# endif +#endif + +#ifndef HAVE_STDERR +# ifdef HAVE___STDERRP +# undef stderr FILE *stderr __attribute__((weak, alias("__stderrp"))); +# else +# error Your stderr alias is not supported, please report to xine developers. +# endif +#endif - #endif +#ifndef HAVE____BRK_ADDR void ___brk_addr(void) EXPORTED; +#endif + +#ifndef HAVE___CTYPE_B void __ctype_b(void) EXPORTED; #endif -- cgit v1.2.3 From 2fa61afb4e8d575c3d5facf4072e91187945e163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 17 Mar 2007 06:59:31 +0000 Subject: Clean up configure checks for OSS support. Check for the various soundcard.h headers, and then include the best one that has been found on the system. Check for definition of SNDCTL_DSP_SETFRAGMENT in those headers. Check for the correct request parameter type for ioctl(), as also modern Linux uses unsigned long. Don't list all the big endian machines (as they aren't reliable to list anyway, some of them might work with both endians), use WORDS_BIGENDIAN instead. CVS patchset: 8697 CVS date: 2007/03/17 06:59:31 --- src/audio_out/audio_oss_out.c | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c index 12a52b997..793b47650 100644 --- a/src/audio_out/audio_oss_out.c +++ b/src/audio_out/audio_oss_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_oss_out.c,v 1.119 2007/03/16 17:13:57 dgp85 Exp $ + * $Id: audio_oss_out.c,v 1.120 2007/03/17 06:59:31 dgp85 Exp $ * * 20-8-2001 First implementation of Audio sync and Audio driver separation. * Copyright (C) 2001 James Courtier-Dutton James@superbug.demon.co.uk @@ -48,20 +48,19 @@ #include <fcntl.h> #include <math.h> #include <unistd.h> -#if defined(__OpenBSD__) -# include <soundcard.h> -#elif defined (__FreeBSD__) -# if __FreeBSD__ < 4 -# include <machine/soundcard.h> -# else -# include <sys/soundcard.h> -# endif -#else -# include <sys/soundcard.h> -#endif #include <sys/ioctl.h> #include <inttypes.h> +#ifdef HAVE_SYS_SOUNDCARD_H +# include <sys/soundcard.h> +#endif +#ifdef HAVE_MACHINE_SOUNDCARD_H +# include <sys/soundcard.h> +#endif +#ifdef HAVE_SOUNDCARD_H +# include <soundcard.h> +#endif + #define LOG_MODULE "audio_oss_out" #define LOG_VERBOSE /* @@ -86,8 +85,7 @@ #endif #ifndef AFMT_S16_NE -# if defined(sparc) || defined(__sparc__) || defined(PPC) -/* Big endian machines */ +# ifdef WORDS_BIGENDIAN # define AFMT_S16_NE AFMT_S16_BE # else # define AFMT_S16_NE AFMT_S16_LE @@ -115,13 +113,6 @@ #define OSS_SYNC_SOFTSYNC 3 #define OSS_SYNC_PROBEBUFFER 4 -/* On FreeBSD the request type is unsigned long rather than int */ -#ifdef __FreeBSD__ -typedef unsigned long ioctl_request_t; -#else -typedef int ioctl_request_t; -#endif - typedef struct oss_driver_s { ao_driver_t ao_driver; @@ -532,7 +523,7 @@ static int ao_oss_get_property (ao_driver_t *this_gen, int property) { if(!this->mixer.mute) { if(this->mixer.fd != -1) { - ioctl_request_t cmd = 0; + IOCTL_REQUEST_TYPE cmd = 0; int v; ioctl(this->mixer.fd, SOUND_MIXER_READ_DEVMASK, &audio_devs); @@ -571,7 +562,7 @@ static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value) if(!this->mixer.mute) { if(this->mixer.fd != -1) { - ioctl_request_t cmd = 0; + IOCTL_REQUEST_TYPE cmd = 0; int v; ioctl(this->mixer.fd, SOUND_MIXER_READ_DEVMASK, &audio_devs); @@ -600,7 +591,7 @@ static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value) if(this->mixer.mute) { if(this->mixer.fd != -1) { - ioctl_request_t cmd = 0; + IOCTL_REQUEST_TYPE cmd = 0; int v = 0; ioctl(this->mixer.fd, SOUND_MIXER_READ_DEVMASK, &audio_devs); -- cgit v1.2.3 From 3b941f626de9be7f7570ab8acdfe27451ea61576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 17 Mar 2007 07:34:02 +0000 Subject: Cleanup wavpack plugin, include config.h when needed, declare demuxer/decoder init functions in the combined_wavpack.h header. CVS patchset: 8699 CVS date: 2007/03/17 07:34:02 --- src/combined/combined_wavpack.c | 6 ++---- src/combined/combined_wavpack.h | 6 ++++-- src/combined/decoder_wavpack.c | 7 ++++++- src/combined/demux_wavpack.c | 7 +++++-- 4 files changed, 17 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/combined/combined_wavpack.c b/src/combined/combined_wavpack.c index f99070818..7a334b15c 100644 --- a/src/combined/combined_wavpack.c +++ b/src/combined/combined_wavpack.c @@ -19,13 +19,11 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: combined_wavpack.c,v 1.2 2007/01/24 20:51:04 dgp85 Exp $ + * $Id: combined_wavpack.c,v 1.3 2007/03/17 07:34:02 dgp85 Exp $ */ #include "xine_internal.h" - -extern void *demux_wv_init_plugin (xine_t *const xine, void *const data); -extern void *decoder_wavpack_init_plugin (xine_t *xine, void *data); +#include "combined_wavpack.h" static const demuxer_info_t demux_info_wv = { 0 /* priority */ diff --git a/src/combined/combined_wavpack.h b/src/combined/combined_wavpack.h index 68541e921..b7bf32acb 100644 --- a/src/combined/combined_wavpack.h +++ b/src/combined/combined_wavpack.h @@ -19,11 +19,10 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: combined_wavpack.h,v 1.2 2007/01/24 20:51:04 dgp85 Exp $ + * $Id: combined_wavpack.h,v 1.3 2007/03/17 07:34:02 dgp85 Exp $ */ #include "os_types.h" -#include "bswap.h" typedef struct { uint32_t idcode; /* This should always be the string "wvpk" */ @@ -45,3 +44,6 @@ static const uint32_t wvpk_signature = ('k' + ('p' << 8) + ('v' << 16) + ('w' << #else static const uint32_t wvpk_signature = ('w' + ('v' << 8) + ('p' << 16) + ('k' << 24)); #endif + +void *demux_wv_init_plugin (xine_t *const xine, void *const data); +void *decoder_wavpack_init_plugin (xine_t *xine, void *data); diff --git a/src/combined/decoder_wavpack.c b/src/combined/decoder_wavpack.c index 6b0d035e4..1d51ecd1d 100644 --- a/src/combined/decoder_wavpack.c +++ b/src/combined/decoder_wavpack.c @@ -19,14 +19,19 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: decoder_wavpack.c,v 1.12 2007/02/25 18:02:13 dgp85 Exp $ + * $Id: decoder_wavpack.c,v 1.13 2007/03/17 07:34:02 dgp85 Exp $ */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #define LOG_MODULE "decode_wavpack" #define LOG_VERBOSE #include "xine_internal.h" #include "attributes.h" +#include "bswap.h" #include <wavpack/wavpack.h> #include "combined_wavpack.h" diff --git a/src/combined/demux_wavpack.c b/src/combined/demux_wavpack.c index d0dce82a2..6a0e33e19 100644 --- a/src/combined/demux_wavpack.c +++ b/src/combined/demux_wavpack.c @@ -19,9 +19,13 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: demux_wavpack.c,v 1.10 2007/02/25 18:02:13 dgp85 Exp $ + * $Id: demux_wavpack.c,v 1.11 2007/03/17 07:34:02 dgp85 Exp $ */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #define LOG_MODULE "demux_wavpack" #define LOG_VERBOSE @@ -32,7 +36,6 @@ #include "attributes.h" #include <wavpack/wavpack.h> - #include "combined_wavpack.h" typedef struct { -- cgit v1.2.3 From 43eb2263dd8821bae542d940834255d8e5e62f01 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani <klan@users.sourceforge.net> Date: Sat, 17 Mar 2007 09:17:19 +0000 Subject: Do not send duration extra info when framerate is not known. CVS patchset: 8700 CVS date: 2007/03/17 09:17:19 --- src/demuxers/demux_flv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 9efe1b182..dcde65fc0 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -26,7 +26,7 @@ * For more information on the FLV file format, visit: * http://download.macromedia.com/pub/flash/flash_file_format_specification.pdf * - * $Id: demux_flv.c,v 1.19 2007/02/20 00:34:55 dgp85 Exp $ + * $Id: demux_flv.c,v 1.20 2007/03/17 09:17:19 klan Exp $ */ #ifdef HAVE_CONFIG_H @@ -344,7 +344,7 @@ static int read_flv_packet(demux_flv_t *this) { unsigned int remaining_bytes; unsigned int buf_type = 0; unsigned int buf_flags = 0; - int64_t pts; + unsigned int pts; while (1) { lprintf (" reading FLV tag...\n"); @@ -358,7 +358,7 @@ static int read_flv_packet(demux_flv_t *this) { remaining_bytes = BE_24(&buffer[1]); pts = BE_24(&buffer[4]) | (buffer[7] << 24); - lprintf(" tag_type = 0x%02X, 0x%X bytes, pts %"PRId64"\n", + lprintf(" tag_type = 0x%02X, 0x%X bytes, pts %u\n", tag_type, remaining_bytes, pts/90); switch (tag_type) { @@ -448,7 +448,7 @@ static int read_flv_packet(demux_flv_t *this) { buf = fifo->buffer_pool_alloc(fifo); buf->decoder_flags = BUF_FLAG_HEADER | BUF_FLAG_STDHEADER | BUF_FLAG_FRAMERATE | BUF_FLAG_FRAME_END; - buf->decoder_info[0] = 90000.0 / (this->framerate ? : 12.0); + buf->decoder_info[0] = this->framerate ? (90000.0/this->framerate) : 0; bih = (xine_bmiheader *) buf->content; memset(bih, 0, sizeof(xine_bmiheader)); bih->biSize = sizeof(xine_bmiheader); -- cgit v1.2.3 From e576b147725ab51707bf3c05a4079991ff23f6d1 Mon Sep 17 00:00:00 2001 From: Claudio Ciccani <klan@users.sourceforge.net> Date: Sat, 17 Mar 2007 11:29:43 +0000 Subject: When parsing flv metadata, do not assume that keywords are zero-terminated and compare the keyword's length too. CVS patchset: 8701 CVS date: 2007/03/17 11:29:43 --- src/demuxers/demux_flv.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index dcde65fc0..0588b408e 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -26,7 +26,7 @@ * For more information on the FLV file format, visit: * http://download.macromedia.com/pub/flash/flash_file_format_specification.pdf * - * $Id: demux_flv.c,v 1.20 2007/03/17 09:17:19 klan Exp $ + * $Id: demux_flv.c,v 1.21 2007/03/17 11:29:43 klan Exp $ */ #ifdef HAVE_CONFIG_H @@ -200,7 +200,8 @@ static int open_flv_file(demux_flv_t *this) { _tmp.d;\ })\ -static int parse_flv_var(demux_flv_t *this, unsigned char *buf, int size, char *key) { +static int parse_flv_var(demux_flv_t *this, + unsigned char *buf, int size, char *key, int keylen) { unsigned char *tmp = buf; unsigned char *end = buf + size; char *str; @@ -217,20 +218,23 @@ static int parse_flv_var(demux_flv_t *this, unsigned char *buf, int size, char * lprintf(" got number (%f)\n", BE_F64(tmp)); if (key) { double val = BE_F64(tmp); - if (!strncmp(key, "duration", 8)) { + if (keylen == 8 && !strncmp(key, "duration", 8)) { this->length = val * 1000.0; } - else if (!strncmp(key, "width", 5)) { + else if (keylen == 5 && !strncmp(key, "width", 5)) { this->width = val; _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, this->width); } - else if (!strncmp(key, "height", 6)) { + else if (keylen == 6 && !strncmp(key, "height", 6)) { this->height = val; _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, this->height); } - else if (!strncmp(key, "framerate", 9)) { + else if (keylen == 9 && !strncmp(key, "framerate", 9)) { this->framerate = val; } + else if (keylen == 13 && !strncmp(key, "videodatarate", 13)) { + _x_stream_info_set(this->stream, XINE_STREAM_INFO_BITRATE, val*1000.0); + } } tmp += 8; break; @@ -248,7 +252,7 @@ static int parse_flv_var(demux_flv_t *this, unsigned char *buf, int size, char * lprintf(" got object var (%s)\n", tmp+2); str = tmp + 2; tmp += len + 2; - len = parse_flv_var(this, tmp, end-tmp, str); + len = parse_flv_var(this, tmp, end-tmp, str, len); tmp += len; } if (*tmp++ != FLV_DATA_TYPE_ENDOBJECT) @@ -263,7 +267,7 @@ static int parse_flv_var(demux_flv_t *this, unsigned char *buf, int size, char * len = BE_16(tmp); str = tmp + 2; tmp += len + 2; - len = parse_flv_var(this, tmp, end-tmp, str); + len = parse_flv_var(this, tmp, end-tmp, str, len); tmp += len; } break; @@ -271,7 +275,7 @@ static int parse_flv_var(demux_flv_t *this, unsigned char *buf, int size, char * lprintf(" got array (%d indices)\n", BE_32(tmp)); num = BE_32(tmp); tmp += 4; - if (key && !strncmp (key, "times", 5)) { + if (key && keylen == 5 && !strncmp(key, "times", 5)) { if (this->index) free (this->index); this->index = xine_xmalloc(num*sizeof(flv_index_entry_t)); @@ -285,7 +289,7 @@ static int parse_flv_var(demux_flv_t *this, unsigned char *buf, int size, char * } break; } - if (key && !strncmp (key, "filepositions", 13)) { + if (key && keylen == 13 && !strncmp(key, "filepositions", 13)) { if (this->index && this->num_indices == num) { for (num = 0; num < this->num_indices && tmp < end; num++) { if (*tmp++ == FLV_DATA_TYPE_NUMBER) { @@ -298,7 +302,7 @@ static int parse_flv_var(demux_flv_t *this, unsigned char *buf, int size, char * } } while (num-- && tmp < end) { - len = parse_flv_var(this, tmp, end-tmp, NULL); + len = parse_flv_var(this, tmp, end-tmp, NULL, 0); tmp += len; } break; @@ -327,7 +331,7 @@ static void parse_flv_script(demux_flv_t *this, int size) { } while (tmp < end) { - len = parse_flv_var(this, tmp, end-tmp, NULL); + len = parse_flv_var(this, tmp, end-tmp, NULL, 0); if (len < 1) break; tmp += len; -- cgit v1.2.3 From 30252f3b08858d383f4d61651b916f53df48115a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 17 Mar 2007 15:17:24 +0000 Subject: Simplfiy the Makefile.am, set AM_LDFLAGS rather than repeating it all over, use -Wl,-z,defs if supported, pass libraries' CFLAGS variables only to the relevant demuxers, correctly pass AM_CFLAGS (VISIBILITY_FLAG) to the demuxers that also pass extra CFLAGS. CVS patchset: 8702 CVS date: 2007/03/17 15:17:24 --- src/demuxers/Makefile.am | 45 +++++++++++---------------------------------- 1 file changed, 11 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/demuxers/Makefile.am b/src/demuxers/Makefile.am index 68136e217..b571c18e4 100644 --- a/src/demuxers/Makefile.am +++ b/src/demuxers/Makefile.am @@ -1,12 +1,7 @@ include $(top_srcdir)/misc/Makefile.common -AM_CFLAGS = $(VORBIS_CFLAGS) $(THEORA_CFLAGS) $(SPEEX_CFLAGS) \ - $(LIBMODPLUG_CFLAGS) $(VISIBILITY_FLAG) -AM_CPPFLAGS = $(ZLIB_CPPFLAGS) - -libdir = $(XINE_PLUGINDIR) - -# Sensing of OGG/VORBIS, ZLIB and ASF is broken in cvscompile.sh. +AM_CFLAGS = $(VISIBILITY_FLAG) +AM_LDFLAGS = $(xineplug_ldflags) if HAVE_VORBIS ogg_module = xineplug_dmx_ogg.la @@ -29,7 +24,7 @@ endif # --------- # All of xine demuxer plugins should be named like the scheme "xineplug_dmx_" -lib_LTLIBRARIES = $(ogg_module) $(asf_module) $(mng_module) $(image_module) \ +xineplug_LTLIBRARIES = $(ogg_module) $(asf_module) $(mng_module) $(image_module) \ xineplug_dmx_games.la \ xineplug_dmx_audio.la \ xineplug_dmx_mpeg_ts.la \ @@ -52,65 +47,53 @@ lib_LTLIBRARIES = $(ogg_module) $(asf_module) $(mng_module) $(image_module) \ xineplug_dmx_flv.la xineplug_dmx_ogg_la_SOURCES = demux_ogg.c -xineplug_dmx_ogg_la_LIBADD = $(VORBIS_LIBS) $(SPEEX_LIBS) $(THEORA_LIBS) $(OGG_LIBS) $(XINE_LIB) -xineplug_dmx_ogg_la_LDFLAGS = -avoid-version -module +xineplug_dmx_ogg_la_LIBADD = $(VORBIS_LIBS) $(SPEEX_LIBS) $(THEORA_LIBS) $(OGG_LIBS) $(XINE_LIB) +xineplug_dmx_ogg_la_CFLAGS = $(AM_CFLAGS) $(VORBIS_CFLAGS) $(SPEEX_CFLAGS) $(THEORA_CFLAGS) $(OGG_CFLAGS) xineplug_dmx_avi_la_SOURCES = demux_avi.c xineplug_dmx_avi_la_LIBADD = $(XINE_LIB) -xineplug_dmx_avi_la_LDFLAGS = -avoid-version -module xineplug_dmx_mpeg_block_la_SOURCES = demux_mpeg_block.c xineplug_dmx_mpeg_block_la_LIBADD = $(XINE_LIB) -xineplug_dmx_mpeg_block_la_LDFLAGS = -avoid-version -module xineplug_dmx_mpeg_la_SOURCES = demux_mpeg.c xineplug_dmx_mpeg_la_LIBADD = $(XINE_LIB) -xineplug_dmx_mpeg_la_LDFLAGS = -avoid-version -module xineplug_dmx_mpeg_elem_la_SOURCES = demux_elem.c xineplug_dmx_mpeg_elem_la_LIBADD = $(XINE_LIB) -xineplug_dmx_mpeg_elem_la_LDFLAGS = -avoid-version -module xineplug_dmx_mpeg_pes_la_SOURCES = demux_mpeg_pes.c xineplug_dmx_mpeg_pes_la_LIBADD = $(XINE_LIB) -xineplug_dmx_mpeg_pes_la_LDFLAGS = -avoid-version -module xineplug_dmx_mpeg_ts_la_SOURCES = demux_ts.c xineplug_dmx_mpeg_ts_la_LIBADD = $(XINE_LIB) -xineplug_dmx_mpeg_ts_la_LDFLAGS = -avoid-version -module xineplug_dmx_qt_la_SOURCES = demux_qt.c xineplug_dmx_qt_la_LIBADD = $(XINE_LIB) $(ZLIB_LIBS) -xineplug_dmx_qt_la_LDFLAGS = -avoid-version -module +xineplug_dmx_qt_la_CPPFLAGS = $(ZLIB_CPPFLAGS) xineplug_dmx_asf_la_SOURCES = demux_asf.c asfheader.c xineplug_dmx_asf_la_LIBADD = $(XINE_LIB) -xineplug_dmx_asf_la_CFLAGS = -fno-strict-aliasing -xineplug_dmx_asf_la_LDFLAGS = -avoid-version -module +xineplug_dmx_asf_la_CFLAGS = $(AM_CFLAGS) -fno-strict-aliasing xineplug_dmx_fli_la_SOURCES = demux_fli.c xineplug_dmx_fli_la_LIBADD = $(XINE_LIB) -xineplug_dmx_fli_la_LDFLAGS = -avoid-version -module xineplug_dmx_yuv4mpeg2_la_SOURCES = demux_yuv4mpeg2.c xineplug_dmx_yuv4mpeg2_la_LIBADD = $(XINE_LIB) -xineplug_dmx_yuv4mpeg2_la_LDFLAGS = -avoid-version -module xineplug_dmx_real_la_SOURCES = demux_real.c xineplug_dmx_real_la_LIBADD = $(XINE_LIB) -xineplug_dmx_real_la_LDFLAGS = -avoid-version -module xineplug_dmx_rawdv_la_SOURCES = demux_rawdv.c xineplug_dmx_rawdv_la_LIBADD = $(XINE_LIB) -xineplug_dmx_rawdv_la_LDFLAGS = -avoid-version -module xineplug_dmx_mng_la_SOURCES = demux_mng.c xineplug_dmx_mng_la_LIBADD = $(XINE_LIB) $(ZLIB_LIBS) $(MNG_LIBS) -xineplug_dmx_mng_la_LDFLAGS = -avoid-version -module +xineplug_dmx_mng_la_CPPFLAGS = $(ZLIB_CPPFLAGS) xineplug_dmx_pva_la_SOURCES = demux_pva.c xineplug_dmx_pva_la_LIBADD = $(XINE_LIB) -xineplug_dmx_pva_la_LDFLAGS = -avoid-version -module xineplug_dmx_games_la_SOURCES = group_games.c demux_eawve.c \ demux_idcin.c demux_ipmovie.c demux_roq.c \ @@ -128,36 +111,30 @@ xineplug_dmx_audio_la_SOURCES = group_audio.c demux_aud.c demux_aiff.c \ demux_mpc.c demux_dts.c demux_shn.c \ demux_tta.c xineplug_dmx_audio_la_LIBADD = $(XINE_LIB) $(LIBMODPLUG_LIBS) -xineplug_dmx_audio_la_LDFLAGS = -avoid-version -module +xineplug_dmx_audio_la_CFLAGS = $(AM_CFLAGS) $(LIBMODPLUG_CFLAGS) xineplug_dmx_yuv_frames_la_SOURCES = demux_yuv_frames.c xineplug_dmx_yuv_frames_la_LIBADD = $(XINE_LIB) -xineplug_dmx_yuv_frames_la_LDFLAGS = -avoid-version -module xineplug_dmx_slave_la_SOURCES = demux_slave.c xineplug_dmx_slave_la_LIBADD = $(XINE_LIB) -xineplug_dmx_slave_la_LDFLAGS = -avoid-version -module xineplug_dmx_image_la_SOURCES = demux_image.c xineplug_dmx_image_la_LIBADD = $(XINE_LIB) -xineplug_dmx_image_la_LDFLAGS = -avoid-version -module xineplug_dmx_nsv_la_SOURCES = demux_nsv.c xineplug_dmx_nsv_la_LIBADD = $(XINE_LIB) -xineplug_dmx_nsv_la_LDFLAGS = -avoid-version -module xineplug_dmx_matroska_la_SOURCES = demux_matroska.c ebml.c xineplug_dmx_matroska_la_LIBADD = $(XINE_LIB) $(ZLIB_LIBS) -xineplug_dmx_matroska_la_CFLAGS = -fno-strict-aliasing -xineplug_dmx_matroska_la_LDFLAGS = -avoid-version -module +xineplug_dmx_matroska_la_CPPFLAGS = $(ZLIB_CPPFLAGS) +xineplug_dmx_matroska_la_CFLAGS = $(AM_CFLAGS) -fno-strict-aliasing xineplug_dmx_iff_la_SOURCES = demux_iff.c xineplug_dmx_iff_la_LIBADD = $(XINE_LIB) -xineplug_dmx_iff_la_LDFLAGS = -avoid-version -module xineplug_dmx_flv_la_SOURCES = demux_flv.c xineplug_dmx_flv_la_LIBADD = $(XINE_LIB) -xineplug_dmx_flv_la_LDFLAGS = -avoid-version -module include_HEADERS = demux.h noinst_HEADERS = asfheader.h qtpalette.h group_games.h group_audio.h id3.h ebml.h matroska.h iff.h flacutils.h -- cgit v1.2.3 From 7c80aed9bc8e76f02de7afabccaf7dc535181e8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 17 Mar 2007 15:45:37 +0000 Subject: Merge the two real binary codecs plugins in a single plugin that handles both audio and video. CVS patchset: 8703 CVS date: 2007/03/17 15:45:37 --- src/libreal/Makefile.am | 9 +++------ src/libreal/audio_decoder.c | 16 +++------------- src/libreal/real_common.c | 9 ++++++++- src/libreal/real_common.h | 8 +++++++- src/libreal/xine_decoder.c | 15 +++------------ 5 files changed, 24 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/libreal/Makefile.am b/src/libreal/Makefile.am index 21c2e47ba..114a473a7 100644 --- a/src/libreal/Makefile.am +++ b/src/libreal/Makefile.am @@ -1,15 +1,12 @@ include $(top_srcdir)/misc/Makefile.common if ENABLE_REAL -xineplug_LTLIBRARIES = xineplug_decode_real.la xineplug_decode_real_audio.la +xineplug_LTLIBRARIES = xineplug_decode_real.la endif -xineplug_decode_real_la_SOURCES = xine_decoder.c real_common.c +xineplug_decode_real_la_SOURCES = xine_decoder.c real_common.c audio_decoder.c xineplug_decode_real_la_LIBADD = $(XINE_LIB) $(DYNAMIC_LD_LIBS) xineplug_decode_real_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_decode_real_la_LDFLAGS = $(xineplug_ldflags) -xineplug_decode_real_audio_la_SOURCES = audio_decoder.c real_common.c -xineplug_decode_real_audio_la_LIBADD = $(XINE_LIB) $(DYNAMIC_LD_LIBS) -xineplug_decode_real_audio_la_CFLAGS = $(VISIBILITY_FLAG) -xineplug_decode_real_audio_la_LDFLAGS = $(xineplug_ldflags) +noinst_HEADERS = real_common.h diff --git a/src/libreal/audio_decoder.c b/src/libreal/audio_decoder.c index c4447e232..d1bb94230 100644 --- a/src/libreal/audio_decoder.c +++ b/src/libreal/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.58 2007/03/17 00:28:41 dgp85 Exp $ + * $Id: audio_decoder.c,v 1.59 2007/03/17 15:45:41 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -597,11 +597,7 @@ static void dispose_class (audio_decoder_class_t *this) { free (this); } -/* - * real audio codec loader - */ - -static void *init_class (xine_t *xine, void *data) { +void *init_realadec (xine_t *xine, void *data) { real_class_t *this; config_values_t *config = xine->config; @@ -626,13 +622,7 @@ static uint32_t audio_types[] = { BUF_AUDIO_COOK, BUF_AUDIO_ATRK, /* BUF_AUDIO_14_4, BUF_AUDIO_28_8, */ BUF_AUDIO_SIPRO, 0 }; -static const decoder_info_t dec_info_audio = { +const decoder_info_t dec_info_realaudio = { audio_types, /* supported types */ 7 /* priority */ }; - -const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ - { PLUGIN_AUDIO_DECODER | PLUGIN_MUST_PRELOAD, 15, "realadec", XINE_VERSION_CODE, &dec_info_audio, init_class }, - { PLUGIN_NONE, 0, "", 0, NULL, NULL } -}; diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index 7110198db..925a5cc71 100644 --- a/src/libreal/real_common.c +++ b/src/libreal/real_common.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real_common.c,v 1.11 2007/03/17 06:11:30 dgp85 Exp $ + * $Id: real_common.c,v 1.12 2007/03/17 15:45:41 dgp85 Exp $ * * Common function for the thin layer to use Real binary-only codecs in xine */ @@ -149,3 +149,10 @@ void *_x_real_codec_open(xine_stream_t *const stream, const char *const path, return NULL; } + +const plugin_info_t xine_plugin_info[] EXPORTED = { + /* type, API, "name", version, special_info, init_function */ + { PLUGIN_VIDEO_DECODER | PLUGIN_MUST_PRELOAD, 18, "realvdec", XINE_VERSION_CODE, &dec_info_realvideo, init_realvdec }, + { PLUGIN_AUDIO_DECODER | PLUGIN_MUST_PRELOAD, 15, "realadec", XINE_VERSION_CODE, &dec_info_realaudio, init_realadec }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/libreal/real_common.h b/src/libreal/real_common.h index 7fcd1c4fa..232bf2a4d 100644 --- a/src/libreal/real_common.h +++ b/src/libreal/real_common.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real_common.h,v 1.6 2007/03/17 06:11:31 dgp85 Exp $ + * $Id: real_common.h,v 1.7 2007/03/17 15:45:41 dgp85 Exp $ * * Common function for the thin layer to use Real binary-only codecs in xine */ @@ -77,4 +77,10 @@ void *_x_real_codec_open(xine_stream_t *const stream, const char *const path, const char *const codec_name, const char *const codec_alternate); +const decoder_info_t dec_info_realvideo; +void *init_realvdec (xine_t *xine, void *data); + +const decoder_info_t dec_info_realaudio; +void *init_realadec (xine_t *xine, void *data); + #endif diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c index 8bc6e4561..ea1fc8c54 100644 --- a/src/libreal/xine_decoder.c +++ b/src/libreal/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.92 2007/03/16 23:22:13 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.93 2007/03/17 15:45:41 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -525,10 +525,7 @@ static void dispose_class (video_decoder_class_t *this) { free (this); } - - - -static void *init_class (xine_t *xine, void *data) { +void *init_realvdec (xine_t *xine, void *data) { real_class_t *this; config_values_t *config = xine->config; @@ -554,13 +551,7 @@ static uint32_t supported_types[] = { BUF_VIDEO_RV20, BUF_VIDEO_RV40, 0 }; -static const decoder_info_t dec_info_real = { +const decoder_info_t dec_info_realvideo = { supported_types, /* supported types */ 7 /* priority */ }; - -const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER | PLUGIN_MUST_PRELOAD, 18, "real", XINE_VERSION_CODE, &dec_info_real, init_class }, - { PLUGIN_NONE, 0, "", 0, NULL, NULL } -}; -- cgit v1.2.3 From e8555194fdacd3cd1a3d931d5c8e6e1deca27079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 17 Mar 2007 16:22:38 +0000 Subject: Pass the visibility flag when building the plugin. CVS patchset: 8704 CVS date: 2007/03/17 16:22:38 --- src/combined/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/combined/Makefile.am b/src/combined/Makefile.am index 37bff5dcd..0d27f71c0 100644 --- a/src/combined/Makefile.am +++ b/src/combined/Makefile.am @@ -7,6 +7,6 @@ endif xineplug_LTLIBRARIES = $(xineplug_wavpack) xineplug_wavpack_la_SOURCES = demux_wavpack.c decoder_wavpack.c combined_wavpack.c combined_wavpack.h -xineplug_wavpack_la_CFLAGS = $(WAVPACK_CFLAGS) -I$(srcdir)/../demuxers +xineplug_wavpack_la_CFLAGS = $(VISIBILITY_FLAG) $(WAVPACK_CFLAGS) -I$(srcdir)/../demuxers xineplug_wavpack_la_LIBADD = $(XINE_LIB) $(WAVPACK_LIBS) xineplug_wavpack_la_LDFLAGS = $(xineplug_ldflags) -- cgit v1.2.3 From fa01477d6d284d2af32927c42908394954f56260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 17 Mar 2007 16:26:39 +0000 Subject: Cleanup makefile, use the -Wl,-z,defs option if supported, use visibility flag, removes three symbols from bitplane plugin. CVS patchset: 8705 CVS date: 2007/03/17 16:26:39 --- src/libxinevdec/Makefile.am | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/libxinevdec/Makefile.am b/src/libxinevdec/Makefile.am index 8783b6530..903399cbb 100644 --- a/src/libxinevdec/Makefile.am +++ b/src/libxinevdec/Makefile.am @@ -1,5 +1,8 @@ include $(top_srcdir)/misc/Makefile.common +AM_CFLAGS = $(VISIBILITY_FLAG) +AM_LDFLAGS = $(xineplug_ldflags) + EXTRA_DIST = foovideo.c if HAVE_WAND @@ -10,9 +13,7 @@ if HAVE_GDK_PIXBUF gdkpixbuf_module = xineplug_decode_gdk_pixbuf.la endif -libdir = $(XINE_PLUGINDIR) - -lib_LTLIBRARIES = $(image_module) \ +xineplug_LTLIBRARIES = $(image_module) \ $(gdkpixbuf_module) \ xineplug_decode_bitplane.la \ xineplug_decode_rgb.la \ @@ -20,23 +21,18 @@ lib_LTLIBRARIES = $(image_module) \ xineplug_decode_bitplane_la_SOURCES = bitplane.c xineplug_decode_bitplane_la_LIBADD = $(XINE_LIB) -xineplug_decode_bitplane_la_LDFLAGS = -avoid-version -module xineplug_decode_rgb_la_SOURCES = rgb.c xineplug_decode_rgb_la_LIBADD = $(XINE_LIB) -xineplug_decode_rgb_la_LDFLAGS = -avoid-version -module xineplug_decode_yuv_la_SOURCES = yuv.c xineplug_decode_yuv_la_LIBADD = $(XINE_LIB) -xineplug_decode_yuv_la_LDFLAGS = -avoid-version -module xineplug_decode_image_la_SOURCES = image.c -xineplug_decode_image_la_CFLAGS = $(WAND_CFLAGS) +xineplug_decode_image_la_CFLAGS = $(AM_CFLAGS) $(WAND_CFLAGS) xineplug_decode_image_la_LIBADD = $(XINE_LIB) $(DYNAMIC_LD_LIBS) $(WAND_LIBS) -xineplug_decode_image_la_LDFLAGS = -avoid-version -module xineplug_decode_gdk_pixbuf_la_SOURCES = gdkpixbuf.c -xineplug_decode_gdk_pixbuf_la_CFLAGS = $(GDK_PIXBUF_CFLAGS) +xineplug_decode_gdk_pixbuf_la_CFLAGS = $(AM_CFLAGS) $(GDK_PIXBUF_CFLAGS) xineplug_decode_gdk_pixbuf_la_LIBADD = $(XINE_LIB) $(DYNAMIC_LD_LIBS) $(GDK_PIXBUF_LIBS) -xineplug_decode_gdk_pixbuf_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From 01f379bf544c35cf3c17d3dacfbb2eec2cc6d7d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 17 Mar 2007 16:47:16 +0000 Subject: Some servers does not send a human-readable http status description, for those, check only the status code. This fixes WikipediaWeekly podcasts for instance. CVS patchset: 8706 CVS date: 2007/03/17 16:47:16 --- src/input/input_http.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/input/input_http.c b/src/input/input_http.c index a9bcee0d5..3adbc836b 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -19,7 +19,7 @@ * * input plugin for http network streams * - * $Id: input_http.c,v 1.128 2007/02/20 00:34:56 dgp85 Exp $ + * $Id: input_http.c,v 1.129 2007/03/17 16:47:16 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -804,18 +804,20 @@ static int http_plugin_open (input_plugin_t *this_gen ) { if (linenum == 1) { int httpver, httpsub; - char httpstatus[51]; - - if (sscanf(this->buf, "HTTP/%d.%d %d %50[^\015\012]", &httpver, &httpsub, - &httpcode, httpstatus) != 4) { - - /* icecast 1 ? */ - if (sscanf(this->buf, "ICY %d %50[^\015\012]", &httpcode, httpstatus) != 2) { + char httpstatus[51] = { 0, }; + + if ( + (sscanf(this->buf, "HTTP/%d.%d %d %50[^\015\012]", &httpver, &httpsub, + &httpcode, httpstatus) != 4) && + (sscanf(this->buf, "HTTP/%d.%d %d", &httpver, &httpsub, + &httpcode) != 3) && + (sscanf(this->buf, "ICY %d %50[^\015\012]", /* icecast 1 ? */ + &httpcode, httpstatus) != 2) + ) { _x_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "invalid http answer", NULL); xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: invalid http answer\n")); return -6; - } } if (httpcode >= 300 && httpcode < 400) { -- cgit v1.2.3 From fa60bd19a16595b147477d49215f2aefde5b0d5b Mon Sep 17 00:00:00 2001 From: Darren Salt <linux@youmustbejoking.demon.co.uk> Date: Sat, 17 Mar 2007 19:15:58 +0000 Subject: Avoid a possible floating-point exception when starting stream playback. CVS patchset: 8707 CVS date: 2007/03/17 19:15:58 --- src/input/net_buf_ctrl.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c index 75743a070..86514cdea 100644 --- a/src/input/net_buf_ctrl.c +++ b/src/input/net_buf_ctrl.c @@ -149,7 +149,7 @@ static void nbc_compute_fifo_length(nbc_t *this, fifo_buffer_t *fifo, buf_element_t *buf, int action) { - int fifo_free, fifo_fill; + int fifo_free, fifo_fill, fifo_div; int64_t video_br, audio_br, diff; int has_video, has_audio; @@ -160,10 +160,13 @@ static void nbc_compute_fifo_length(nbc_t *this, fifo_free = fifo->buffer_pool_num_free; fifo_fill = fifo->fifo_size; + fifo_div = fifo_fill + fifo_free - 1; + if (fifo_div == 0) + fifo_div = 1; /* avoid a possible divide-by-zero */ if (fifo == this->video_fifo) { this->video_fifo_free = fifo_free; - this->video_fifo_fill = (100 * fifo_fill) / (fifo_fill + fifo_free - 1); + this->video_fifo_fill = (100 * fifo_fill) / fifo_div; this->video_fifo_size = fifo->fifo_data_size; if (buf->pts && (this->video_in_disc == 0)) { @@ -196,7 +199,7 @@ static void nbc_compute_fifo_length(nbc_t *this, } else { this->audio_fifo_free = fifo_free; - this->audio_fifo_fill = (100 * fifo_fill) / (fifo_fill + fifo_free - 1); + this->audio_fifo_fill = (100 * fifo_fill) / fifo_div; this->audio_fifo_size = fifo->fifo_data_size; if (buf->pts && (this->audio_in_disc == 0)) { -- cgit v1.2.3 From 8a5c8d14f4a9788d256dd3d727ec107a6e3c0220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 17 Mar 2007 20:57:04 +0000 Subject: Use memcmp to check for the WAV signature; use xine_xmalloc rather than simply malloc. CVS patchset: 8708 CVS date: 2007/03/17 20:57:04 --- src/demuxers/demux_wav.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_wav.c b/src/demuxers/demux_wav.c index 145212eda..1e46d8526 100644 --- a/src/demuxers/demux_wav.c +++ b/src/demuxers/demux_wav.c @@ -22,7 +22,7 @@ * MS WAV File Demuxer by Mike Melanson (melanson@pcisys.net) * based on WAV specs that are available far and wide * - * $Id: demux_wav.c,v 1.64 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_wav.c,v 1.65 2007/03/17 20:57:04 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -86,18 +86,7 @@ static int open_wav_file(demux_wav_t *this) { if (_x_demux_read_header(this->input, signature, WAV_SIGNATURE_SIZE) != WAV_SIGNATURE_SIZE) return 0; - if ((signature[0] != 'R') || - (signature[1] != 'I') || - (signature[2] != 'F') || - (signature[3] != 'F') || - (signature[8] != 'W') || - (signature[9] != 'A') || - (signature[10] != 'V') || - (signature[11] != 'E') || - (signature[12] != 'f') || - (signature[13] != 'm') || - (signature[14] != 't') || - (signature[15] != ' ')) + if (memcmp(signature, "RIFF", 4) || memcmp(&signature[8], "WAVEfmt ", 8) ) return 0; /* file is qualified; skip over the header bytes in the stream */ @@ -108,7 +97,7 @@ static int open_wav_file(demux_wav_t *this) { (unsigned char *)&this->wave_size, 4) != 4) return 0; this->wave_size = le2me_32(this->wave_size); - this->wave = (xine_waveformatex *) malloc( this->wave_size ); + this->wave = xine_xmalloc( this->wave_size ); if (this->input->read(this->input, (void *)this->wave, this->wave_size) != this->wave_size) { -- cgit v1.2.3 From 5ffabbd9b6ad0cc31b6316d3239326f40ed2db11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 17 Mar 2007 20:57:59 +0000 Subject: Use the Native Endian variants for 16 and 32 bit samples. CVS patchset: 8709 CVS date: 2007/03/17 20:57:59 --- src/audio_out/audio_pulse_out.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c index d04856c61..214ad9725 100644 --- a/src/audio_out/audio_pulse_out.c +++ b/src/audio_out/audio_pulse_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_pulse_out.c,v 1.11 2007/02/03 10:46:14 dgp85 Exp $ + * $Id: audio_pulse_out.c,v 1.12 2007/03/17 20:57:59 dgp85 Exp $ * * ao plugin for pulseaudio (rename of polypaudio): * http://0pointer.de/lennart/projects/pulsaudio/ @@ -223,14 +223,10 @@ static int ao_pulse_open(ao_driver_t *this_gen, ss.format = PA_SAMPLE_U8; break; case 16: -#ifdef WORDS_BIGENDIAN - ss.format = PA_SAMPLE_S16BE; -#else - ss.format = PA_SAMPLE_S16LE; -#endif + ss.format = PA_SAMPLE_S16NE; break; case 32: - ss.format = PA_SAMPLE_FLOAT32; + ss.format = PA_SAMPLE_FLOAT32NE; break; } -- cgit v1.2.3 From dbc7e973b2e7762774a9bd3f298aa8886e48fb4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 17 Mar 2007 20:59:36 +0000 Subject: As 24-bit waves are reduced to 16-bit for output (most output plugins don't support 24 bit output), reduce it accordingly. CVS patchset: 8710 CVS date: 2007/03/17 20:59:36 --- src/liblpcm/xine_decoder.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/liblpcm/xine_decoder.c b/src/liblpcm/xine_decoder.c index 65ec012d7..43bea4cbf 100644 --- a/src/liblpcm/xine_decoder.c +++ b/src/liblpcm/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.61 2006/07/10 22:08:29 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.62 2007/03/17 20:59:36 dgp85 Exp $ * * 31-8-2001 Added LPCM rate sensing. * (c) 2001 James Courtier-Dutton James@superbug.demon.co.uk @@ -191,20 +191,16 @@ static void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { int n = buf->size; while (n >= 0) { - *d++ = s[8]; - *d++ = s[0]; - - *d++ = s[9]; - *d++ = s[2]; - - *d++ = s[10]; - *d++ = s[4]; - - *d++ = s[11]; - *d++ = s[6]; + if ( stream_be ) { + *d++ = s[0]; + *d++ = s[1]; + } else { + *d++ = s[1]; + *d++ = s[2]; + } - s += 12; - n -= 12; + s += 3; + n -= 3; } } else { memcpy (audio_buffer->mem, sample_buffer, buf->size); -- cgit v1.2.3 From 47570caa9246581fc158606fd6701cc4e8f9475c Mon Sep 17 00:00:00 2001 From: Darren Salt <linux@youmustbejoking.demon.co.uk> Date: Sun, 18 Mar 2007 14:47:19 +0000 Subject: Added centre-cutout (4:3 in 16:9) to the expand plugin. Patch by Reinhard Nissl. CVS patchset: 8712 CVS date: 2007/03/18 14:47:19 --- src/post/planar/expand.c | 111 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 99 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/post/planar/expand.c b/src/post/planar/expand.c index 51cc4eac2..cf288921f 100644 --- a/src/post/planar/expand.c +++ b/src/post/planar/expand.c @@ -21,7 +21,8 @@ * * expand video filter by James Stembridge 24/05/2003 * improved by Michael Roitzsch - * + * centre_crop_out_mode by Reinhard Nissl + * * based on invert.c * */ @@ -52,6 +53,11 @@ * This way, the decoder (or any other post plugin up the tree) will only * see the frame area between the black bars and by that modify the * enlarged version directly. No need for later copying. + * + * When centre_crop_out_mode is enabled, the plugin will detect the black + * bars to the left and right of the image and will then set up cropping + * to efficiently remove the black border around the 4:3 image, which the + * plugin would produce otherwise for this case. */ @@ -63,6 +69,7 @@ typedef struct expand_parameters_s { int enable_automatic_shift; int overlay_y_offset; double aspect; + int centre_cut_out_mode; } expand_parameters_t; START_PARAM_DESCR(expand_parameters_t) @@ -72,6 +79,8 @@ PARAM_ITEM(POST_PARAM_TYPE_INT, overlay_y_offset, NULL, -500, 500, 0, "manually shift the overlay vertically") PARAM_ITEM(POST_PARAM_TYPE_DOUBLE, aspect, NULL, 1.0, 3.5, 0, "target aspect ratio") +PARAM_ITEM(POST_PARAM_TYPE_BOOL, centre_cut_out_mode, NULL, 0, 1, 0, + "cut out centred 4:3 image contained in 16:9 frame") END_PARAM_DESCR(expand_param_descr) typedef struct post_expand_s { @@ -83,6 +92,8 @@ typedef struct post_expand_s { int overlay_y_offset; double aspect; int top_bar_height; + int centre_cut_out_mode; + int cropping_active; } post_expand_t; /* plugin class functions */ @@ -106,6 +117,8 @@ static char *expand_get_help (void); static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width, uint32_t height, double ratio, int format, int flags); + +/* replaced vo_frame functions */ static int expand_draw(vo_frame_t *frame, xine_stream_t *stream); /* overlay manager intercept check */ @@ -153,6 +166,8 @@ static post_plugin_t *expand_open_plugin(post_class_t *class_gen, int inputs, this->enable_automatic_shift = 0; this->overlay_y_offset = 0; this->aspect = 4.0 / 3.0; + this->centre_cut_out_mode = 0; + this->cropping_active = 0; port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output); port->new_port.get_frame = expand_get_frame; @@ -166,8 +181,8 @@ static post_plugin_t *expand_open_plugin(post_class_t *class_gen, int inputs, input_param->data = &post_api; xine_list_push_back(this->post.input, input_param); - input->xine_in.name = "video"; - output->xine_out.name = "expanded video"; + input->xine_in.name = "video"; + output->xine_out.name = "expanded video"; this->post.xine_post.video_input[0] = &port->new_port; @@ -214,6 +229,8 @@ static int expand_set_parameters(xine_post_t *this_gen, void *param_gen) this->enable_automatic_shift = param->enable_automatic_shift; this->overlay_y_offset = param->overlay_y_offset; this->aspect = param->aspect; + this->centre_cut_out_mode = param->centre_cut_out_mode; + return 1; } @@ -225,6 +242,8 @@ static int expand_get_parameters(xine_post_t *this_gen, void *param_gen) param->enable_automatic_shift = this->enable_automatic_shift; param->overlay_y_offset = this->overlay_y_offset; param->aspect = this->aspect; + param->centre_cut_out_mode = this->centre_cut_out_mode; + return 1; } @@ -238,22 +257,86 @@ static char *expand_get_help(void) { " Enable_automatic_shift: Enable automatic overlay shifting\n" " Overlay_y_offset: Manually shift the overlay vertically\n" " aspect: The target aspect ratio (default 4:3)\n" + " Centre_cut_out_mode: extracts 4:3 image contained in 16:9 frame\n" "\n" ); } +static int is_pixel_black(vo_frame_t *frame, int x, int y) +{ + int Y = 0x00, Cr = 0x00, Cb = 0x00; + + if (x < 0) x = 0; + if (x >= frame->width) x = frame->width - 1; + if (y < 0) y = 0; + if (y >= frame->height) y = frame->height - 1; + + switch (frame->format) + { + case XINE_IMGFMT_YV12: + Y = *(frame->base[ 0 ] + frame->pitches[ 0 ] * y + x); + Cr = *(frame->base[ 1 ] + frame->pitches[ 1 ] * y / 2 + x / 2); + Cb = *(frame->base[ 2 ] + frame->pitches[ 2 ] * y / 2 + x / 2); + break; + + case XINE_IMGFMT_YUY2: + Y = *(frame->base[ 0 ] + frame->pitches[ 0 ] * y + x * 2 + 0); + x &= ~1; + Cr = *(frame->base[ 0 ] + frame->pitches[ 0 ] * y + x * 2 + 1); + Cb = *(frame->base[ 0 ] + frame->pitches[ 0 ] * y + x * 2 + 3); + break; + } + + return (Y == 0x10 && Cr == 0x80 && Cb == 0x80); +} + + static int expand_draw(vo_frame_t *frame, xine_stream_t *stream) { - post_video_port_t *port = (post_video_port_t *)frame->port; - post_expand_t *this = (post_expand_t *)port->post; - int skip; - - frame->ratio = this->aspect; - _x_post_frame_copy_down(frame, frame->next); - skip = frame->next->draw(frame->next, stream); - _x_post_frame_copy_up(frame, frame->next); - return skip; + post_video_port_t *port = (post_video_port_t *)frame->port; + post_expand_t *this = (post_expand_t *)port->post; + int skip; + + if (this->centre_cut_out_mode && !frame->bad_frame) + { + /* expected area of inner 4:3 image */ + int centre_width = frame->width * (9 * 4) / (16 * 3); + int centre_left = (frame->width - centre_width ) / 2; + + /* centre point for detecting a black frame */ + int centre_x = frame->width / 2; + int centre_y = frame->height / 2; + + /* ignore a black frame as it could lead to wrong results */ + if (!is_pixel_black(frame, centre_x, centre_y)) + { + /* coordinates for testing black border near the centre area */ + int test_left = centre_left - 16; + int test_right = centre_left + 16 + centre_width; + + /* enable cropping when these pixels are black */ + this->cropping_active = is_pixel_black(frame, test_left, centre_y) + && is_pixel_black(frame, test_right, centre_y); + } + + /* crop frame */ + if (this->centre_cut_out_mode && this->cropping_active) { + frame->crop_left += centre_left; + frame->crop_right += centre_left; + + /* get_frame() allocated an extra high frame */ + frame->crop_top += (frame->next->height - frame->height) / 2; + frame->crop_bottom += (frame->next->height - frame->height) / 2; + } + } + + frame->ratio = this->aspect; + _x_post_frame_copy_down(frame, frame->next); + skip = frame->next->draw(frame->next, stream); + _x_post_frame_copy_up(frame, frame->next); + + return skip; } @@ -338,6 +421,10 @@ static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width, static int expand_intercept_ovl(post_video_port_t *port) { + post_expand_t *this = (post_expand_t *)port->post; + + if (this->centre_cut_out_mode && this->cropping_active) return 0; + /* we always intercept overlay manager */ return 1; } -- cgit v1.2.3 From a926bc137b195d5fa9d2fa52914c9f87eba6568a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Mon, 19 Mar 2007 16:42:32 +0000 Subject: Cleanup block-based support in AC3 and DTS demuxers. Original patch by Matthias Kretz. CVS patchset: 8713 CVS date: 2007/03/19 16:42:32 --- src/demuxers/demux_ac3.c | 40 +++++++++++++++++----------------------- src/demuxers/demux_dts.c | 38 +++++++++++++++++--------------------- 2 files changed, 34 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ac3.c b/src/demuxers/demux_ac3.c index f81fef5d7..7f3dadeb7 100644 --- a/src/demuxers/demux_ac3.c +++ b/src/demuxers/demux_ac3.c @@ -23,7 +23,7 @@ * This demuxer detects raw AC3 data in a file and shovels AC3 data * directly to the AC3 decoder. * - * $Id: demux_ac3.c,v 1.20 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_ac3.c,v 1.21 2007/03/19 16:42:32 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -51,7 +51,6 @@ #include "group_audio.h" #define DATA_TAG 0x61746164 -#define PEAK_SIZE 7056 /* 3 raw cd frames */ typedef struct { demux_plugin_t demux_plugin; @@ -129,31 +128,29 @@ static const struct frmsize_s frmsizecod_tbl[64] = static int open_ac3_file(demux_ac3_t *this) { int i; int offset = 0; - int peak_size = 0; + size_t peak_size = 0; int spdif_mode = 0; uint32_t syncword = 0; uint32_t blocksize; - uint8_t peak[PEAK_SIZE]; + uint8_t *peak; - lprintf("open_ac3_file\n"); - - /* block based demuxer (i.e. cdda) will only allow reads in block - * sized pieces */ blocksize = this->input->get_blocksize(this->input); - if (blocksize && INPUT_IS_SEEKABLE(this->input)) { - int read; - + if (blocksize) { this->input->seek(this->input, 0, SEEK_SET); - while (peak_size < PEAK_SIZE) { - read = this->input->read(this->input, &peak[peak_size], blocksize); - if (read) - peak_size += read; - else - break; - } + buf_element_t *buf = this->input->read_block(this->input, + this->audio_fifo, + blocksize); this->input->seek(this->input, 0, SEEK_SET); + + if (!buf) + return 0; + + peak = alloca(peak_size = buf->size); + xine_fast_memcpy(peak, buf->content, peak_size); + + buf->free_buffer(buf); } else { - peak_size = MAX_PREVIEW_SIZE; + peak = alloca(peak_size = MAX_PREVIEW_SIZE); if (_x_demux_read_header(this->input, peak, peak_size) != peak_size) return 0; @@ -163,10 +160,7 @@ static int open_ac3_file(demux_ac3_t *this) { /* Check for wav header, as we'll handle AC3 with a wav header shoved * on the front for CD burning */ - if ((peak[0] == 'R') && (peak[1] == 'I') && (peak[2] == 'F') && - (peak[3] == 'F') && (peak[8] == 'W') && (peak[9] == 'A') && - (peak[10] == 'V') && (peak[11] == 'E') && (peak[12] == 'f') && - (peak[13] == 'm') && (peak[14] == 't') && (peak[15] == ' ')) { + if ( memcmp(peak, "RIFF", 4) == 0 || memcmp(&peak[8], "WAVEfmt ", 8) == 0 ) { /* Check this looks like a cd audio wav */ unsigned int audio_type; xine_waveformatex *wave = (xine_waveformatex *) &peak[20]; diff --git a/src/demuxers/demux_dts.c b/src/demuxers/demux_dts.c index 98726a569..7baeae377 100644 --- a/src/demuxers/demux_dts.c +++ b/src/demuxers/demux_dts.c @@ -19,7 +19,7 @@ * * Raw DTS Demuxer by James Stembridge (jstembridge@gmail.com) * - * $Id: demux_dts.c,v 1.7 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_dts.c,v 1.8 2007/03/19 16:42:32 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -47,7 +47,6 @@ #include "group_audio.h" #define DATA_TAG 0x61746164 -#define PEAK_SIZE 7056 /* 3 raw cd frames */ typedef struct { demux_plugin_t demux_plugin; @@ -79,29 +78,29 @@ static const int dts_sample_rates[] = static int open_dts_file(demux_dts_t *this) { int i, offset = 0; uint32_t syncword = 0; - int peak_size = 0; + size_t peak_size = 0; uint32_t blocksize; - uint8_t peak[PEAK_SIZE]; + uint8_t *peak; lprintf("open_dts_file\n"); - /* block based demuxer (i.e. cdda) will only allow reads in block - * sized pieces */ blocksize = this->input->get_blocksize(this->input); - if (blocksize && INPUT_IS_SEEKABLE(this->input)) { - int read; - + if (blocksize) { this->input->seek(this->input, 0, SEEK_SET); - while (peak_size < PEAK_SIZE) { - read = this->input->read(this->input, &peak[peak_size], blocksize); - if (read) - peak_size += read; - else - break; - } + buf_element_t *buf = this->input->read_block(this->input, + this->audio_fifo, + blocksize); this->input->seek(this->input, 0, SEEK_SET); + + if (!buf) + return 0; + + peak = alloca(peak_size = buf->size); + xine_fast_memcpy(peak, buf->content, peak_size); + + buf->free_buffer(buf); } else { - peak_size = MAX_PREVIEW_SIZE; + peak = alloca(peak_size = MAX_PREVIEW_SIZE); if (_x_demux_read_header(this->input, peak, peak_size) != peak_size) return 0; @@ -111,10 +110,7 @@ static int open_dts_file(demux_dts_t *this) { /* Check for wav header, as we'll handle DTS with a wav header shoved * on the front for CD burning */ - if ((peak[0] == 'R') && (peak[1] == 'I') && (peak[2] == 'F') && - (peak[3] == 'F') && (peak[8] == 'W') && (peak[9] == 'A') && - (peak[10] == 'V') && (peak[11] == 'E') && (peak[12] == 'f') && - (peak[13] == 'm') && (peak[14] == 't') && (peak[15] == ' ')) { + if ( memcmp(peak, "RIFF", 4) == 0 || memcmp(&peak[8], "WAVEfmt ", 8) == 0 ) { /* Check this looks like a cd audio wav */ unsigned int audio_type; xine_waveformatex *wave = (xine_waveformatex *) &peak[20]; -- cgit v1.2.3 From 1faa9f0138196c10ffee925a9398bd4562f8f2e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Mon, 19 Mar 2007 23:48:58 +0000 Subject: Don't assume that CoreAudio output is Big Endian (it is not on newer Mac based on Intel CPUs). Patch by Martin Aumueller. CVS patchset: 8723 CVS date: 2007/03/19 23:48:58 --- src/audio_out/audio_coreaudio_out.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/audio_out/audio_coreaudio_out.c b/src/audio_out/audio_coreaudio_out.c index 80cab6d71..22f53c0ef 100644 --- a/src/audio_out/audio_coreaudio_out.c +++ b/src/audio_out/audio_coreaudio_out.c @@ -265,7 +265,9 @@ static int ao_coreaudio_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate format.mSampleRate = rate; format.mFormatID = kAudioFormatLinearPCM; format.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger +#ifdef WORDS_BIGENDIAN | kLinearPCMFormatFlagIsBigEndian +#endif | kLinearPCMFormatFlagIsPacked; format.mBitsPerChannel = this->bits_per_sample; format.mChannelsPerFrame = this->num_channels; -- cgit v1.2.3 From fe90824d32eac6e47c6520c6d77d9956c82187fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Tue, 20 Mar 2007 00:35:29 +0000 Subject: Add B2N macros for OSX. Patch by Martin Aumueller. Also add to the diff from CVS as needs to be submitted. CVS patchset: 8727 CVS date: 2007/03/20 00:35:29 --- src/input/libdvdnav/bswap.h | 6 ++++++ src/input/libdvdnav/diff_against_cvs.patch | 13 +++++++++++++ 2 files changed, 19 insertions(+) (limited to 'src') diff --git a/src/input/libdvdnav/bswap.h b/src/input/libdvdnav/bswap.h index 7d7acd556..c1fc7a045 100644 --- a/src/input/libdvdnav/bswap.h +++ b/src/input/libdvdnav/bswap.h @@ -41,6 +41,12 @@ #define B2N_32(x) x = bswap_32(x) #define B2N_64(x) x = bswap_64(x) +#elif defined(__APPLE__) +#include <libkern/OSByteOrder.h> +#define B2N_16(x) x = OSSwapBigToHostInt16(x) +#define B2N_32(x) x = OSSwapBigToHostInt32(x) +#define B2N_64(x) x = OSSwapBigToHostInt64(x) + #elif defined(__NetBSD__) #include <sys/endian.h> #define B2N_16(x) BE16TOH(x) diff --git a/src/input/libdvdnav/diff_against_cvs.patch b/src/input/libdvdnav/diff_against_cvs.patch index 6afca3a98..202474fef 100644 --- a/src/input/libdvdnav/diff_against_cvs.patch +++ b/src/input/libdvdnav/diff_against_cvs.patch @@ -263,6 +263,19 @@ diff -u -p -u -r1.3 bswap.h #include <byteswap.h> #define B2N_16(x) x = bswap_16(x) #define B2N_32(x) x = bswap_32(x) +@@ -41,6 +41,12 @@ + #define B2N_32(x) x = bswap_32(x) + #define B2N_64(x) x = bswap_64(x) + ++#elif defined(__APPLE__) ++#include <libkern/OSByteOrder.h> ++#define B2N_16(x) x = OSSwapBigToHostInt16(x) ++#define B2N_32(x) x = OSSwapBigToHostInt32(x) ++#define B2N_64(x) x = OSSwapBigToHostInt64(x) ++ + #elif defined(__NetBSD__) + #include <sys/endian.h> + #define B2N_16(x) BE16TOH(x) Index: src/input/libdvdnav/dvd_reader.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/input/libdvdnav/dvd_reader.c,v -- cgit v1.2.3 From b0c43b2899bcfdc8e5e42ef9227f85b482936dee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Tue, 20 Mar 2007 00:46:06 +0000 Subject: There's no point in this. CVS patchset: 8728 CVS date: 2007/03/20 00:46:06 --- src/video_out/macosx/Makefile.am | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/video_out/macosx/Makefile.am b/src/video_out/macosx/Makefile.am index 76968ceab..29236e004 100644 --- a/src/video_out/macosx/Makefile.am +++ b/src/video_out/macosx/Makefile.am @@ -18,7 +18,6 @@ libxineMacOSXVideo_la_LDFLAGS = -version-info \ $(XINE_LT_CURRENT):$(XINE_LT_REVISION):$(XINE_LT_AGE) \ -Wl,-framework -Wl,Cocoa -framework Cocoa \ -Wl,-framework -Wl,OpenGL -framework OpenGL -libxine_MacOSXVideo_la_OBJCFLAGS = $(OBJCFLAGS) include_HEADERS = video_window.h XineOpenGLView.h XineVideoWindow.h -- cgit v1.2.3 From a1d41e0046a141ab9b24b14fc04e6d7a0e9e966c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Tue, 20 Mar 2007 00:47:04 +0000 Subject: Fix Makefile so that the CPPFLAGS in AM_CPPFLAGS are not ingored for directx and macosx plugins. Also pass the VISIBILITY_FLAG to the correct set of OBJCFLAGS variable (even if it's a moot point, OS X has no visibility support as it is). Patch by Martin Aumueller. CVS patchset: 8729 CVS date: 2007/03/20 00:47:04 --- src/video_out/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index e11140ddb..87a110f4f 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -175,7 +175,7 @@ xineplug_vo_out_stk_la_LIBADD = $(XINE_LIB) $(LIBSTK_LIBS) $(THREAD_LIBS) xineplug_vo_out_stk_la_CFLAGS = $(VISIBILITY_FLAG) $(LIBSTK_CFLAGS) xineplug_vo_out_directx_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c video_out_directx.c -xineplug_vo_out_directx_la_CPPFLAGS = $(DIRECTX_CPPFLAGS) +xineplug_vo_out_directx_la_CPPFLAGS = $(AM_CPPFLAGS) $(DIRECTX_CPPFLAGS) xineplug_vo_out_directx_la_LIBADD = $(DIRECTX_VIDEO_LIBS) $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_directx_la_CFLAGS = $(VISIBILITY_FLAG) @@ -184,8 +184,8 @@ xineplug_vo_out_none_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_none_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_vo_out_macosx_la_SOURCES = video_out_macosx.m -xineplug_vo_out_macosx_la_CPPFLAGS = $(X_CFLAGS) $(MLIB_CFLAGS) -xineplug_vo_out_macosx_la_CFLAGS = $(VISIBILITY_FLAG) +xineplug_vo_out_macosx_la_CPPFLAGS = $(AM_CPPFLAGS) $(X_CFLAGS) $(MLIB_CFLAGS) +xineplug_vo_out_macosx_la_OBJCFLAGS = $(VISIBILITY_FLAG) xineplug_vo_out_macosx_la_LIBADD = $(MLIB_LIBS) $(OPENGL_LIBS) $(GLUT_LIBS) \ $(GLU_LIBS) $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) # The "-Wl,-framework -Wl,Cocoa" is needed for libtool versions before -- cgit v1.2.3 From 07849a7ff002d20238583eae194fb6056c90e073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Tue, 20 Mar 2007 01:34:08 +0000 Subject: We're building xine even when we're building the Mac OS X video helper. CVS patchset: 8733 CVS date: 2007/03/20 01:34:08 --- src/video_out/macosx/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/video_out/macosx/Makefile.am b/src/video_out/macosx/Makefile.am index 29236e004..0a70d9220 100644 --- a/src/video_out/macosx/Makefile.am +++ b/src/video_out/macosx/Makefile.am @@ -1,5 +1,7 @@ include $(top_srcdir)/misc/Makefile.common +AM_CPPFLAGS = -DXINE_COMPILE + EXTRA_DIST = \ video_window.h \ XineOpenGLView.m \ -- cgit v1.2.3 From 89db20fe174c88f784b44743064ca1a9ba4b42f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Tue, 20 Mar 2007 01:40:34 +0000 Subject: Another couple of fixes for OSX support by Martin Aumueller, although Win32 support seems to still not work there. CVS patchset: 8734 CVS date: 2007/03/20 01:40:34 --- src/libw32dll/wine/pshpack1.h | 2 +- src/libw32dll/wine/pshpack2.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libw32dll/wine/pshpack1.h b/src/libw32dll/wine/pshpack1.h index 659b2ed67..15876039c 100644 --- a/src/libw32dll/wine/pshpack1.h +++ b/src/libw32dll/wine/pshpack1.h @@ -2,7 +2,7 @@ #define __WINE_PSHPACK_H 1 #if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) || defined(__ICC) -//#pragma pack(1) +#pragma pack(1) #elif !defined(RC_INVOKED) #error "1 as alignment isn't supported by the compiler" #endif /* defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) ; !defined(RC_INVOKED) */ diff --git a/src/libw32dll/wine/pshpack2.h b/src/libw32dll/wine/pshpack2.h index a0830be0b..0145d8b13 100644 --- a/src/libw32dll/wine/pshpack2.h +++ b/src/libw32dll/wine/pshpack2.h @@ -2,7 +2,7 @@ #define __WINE_PSHPACK_H 2 #if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) || defined(__ICC) -//#pragma pack(2) +#pragma pack(2) #elif !defined(RC_INVOKED) #error "2 as alignment isn't supported by the compiler" #endif /* defined(__GNUC__) || defined(__SUNPRO_CC) ; !defined(RC_INVOKED) */ -- cgit v1.2.3 From 63f41055e2031631c01aee2539fa1a6027513078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 22 Mar 2007 17:37:17 +0000 Subject: Instead of rewriting the install and uninstall rules for headers, simply change their class to xineinclude, and set xineincludedir in Makefile.common. CVS patchset: 8737 CVS date: 2007/03/22 17:37:17 --- src/demuxers/Makefile.am | 2 +- src/input/Makefile.am | 2 +- src/video_out/macosx/Makefile.am | 2 +- src/xine-engine/Makefile.am | 2 +- src/xine-utils/Makefile.am | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/demuxers/Makefile.am b/src/demuxers/Makefile.am index b571c18e4..8a931c2d6 100644 --- a/src/demuxers/Makefile.am +++ b/src/demuxers/Makefile.am @@ -136,5 +136,5 @@ xineplug_dmx_iff_la_LIBADD = $(XINE_LIB) xineplug_dmx_flv_la_SOURCES = demux_flv.c xineplug_dmx_flv_la_LIBADD = $(XINE_LIB) -include_HEADERS = demux.h +xineinclude_HEADERS = demux.h noinst_HEADERS = asfheader.h qtpalette.h group_games.h group_audio.h id3.h ebml.h matroska.h iff.h flacutils.h diff --git a/src/input/Makefile.am b/src/input/Makefile.am index f8e17ae61..dbe9d97dc 100644 --- a/src/input/Makefile.am +++ b/src/input/Makefile.am @@ -151,6 +151,6 @@ xineplug_inp_pvr_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) xineplug_inp_pvr_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_pvr_la_LDFLAGS = -avoid-version -module -include_HEADERS = input_plugin.h +xineinclude_HEADERS = input_plugin.h noinst_HEADERS = net_buf_ctrl.h mms.h mmsh.h pnm.h media_helper.h videodev2.h http_helper.h diff --git a/src/video_out/macosx/Makefile.am b/src/video_out/macosx/Makefile.am index 0a70d9220..a69f30dc5 100644 --- a/src/video_out/macosx/Makefile.am +++ b/src/video_out/macosx/Makefile.am @@ -21,7 +21,7 @@ libxineMacOSXVideo_la_LDFLAGS = -version-info \ -Wl,-framework -Wl,Cocoa -framework Cocoa \ -Wl,-framework -Wl,OpenGL -framework OpenGL -include_HEADERS = video_window.h XineOpenGLView.h XineVideoWindow.h +xineinclude_HEADERS = video_window.h XineOpenGLView.h XineVideoWindow.h endif diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am index 97fb6a033..acda9424e 100644 --- a/src/xine-engine/Makefile.am +++ b/src/xine-engine/Makefile.am @@ -35,7 +35,7 @@ libxine_la_LDFLAGS = \ $(def_ldflags) -include_HEADERS = buffer.h metronom.h configfile.h vo_scale.h \ +xineinclude_HEADERS = buffer.h metronom.h configfile.h vo_scale.h \ audio_out.h resample.h video_out.h xine_internal.h spu_decoder.h \ video_overlay.h osd.h scratch.h xine_plugin.h xineintl.h \ plugin_catalog.h audio_decoder.h video_decoder.h post.h \ diff --git a/src/xine-utils/Makefile.am b/src/xine-utils/Makefile.am index 7406abf86..95de06b9e 100644 --- a/src/xine-utils/Makefile.am +++ b/src/xine-utils/Makefile.am @@ -32,7 +32,7 @@ libxineutils_la_SOURCES = $(pppc_files) \ pool.c \ ring_buffer.c -include_HEADERS = \ +xineinclude_HEADERS = \ attributes.h \ compat.h \ xine_buffer.h \ -- cgit v1.2.3 From 62b1bb0c213c37b58e5a7bb8359f41168c34f817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 22 Mar 2007 20:44:58 +0000 Subject: Fix crosscompile to use build and host definition from autoconf, rather than using hacksaround. Also replace the whole pthread check with an improved macro originally written for XCB, this way it's not going to try linking the fake -lpthread on Darwin, and it also does not force a -I/usr/local/include on FreeBSD. The new macro respects the same variables set by ports, so that it's even more transparent to FreeBSD users. CVS patchset: 8739 CVS date: 2007/03/22 20:44:58 --- src/audio_out/Makefile.am | 4 ++-- src/input/Makefile.am | 22 ++++++++++---------- src/input/libdvdnav/Makefile.am | 2 +- src/libffmpeg/Makefile.am | 2 +- src/libspudec/Makefile.am | 4 ++-- src/libspudvb/Makefile.am | 2 +- src/libw32dll/Makefile.am | 4 ++-- src/post/audio/Makefile.am | 2 +- src/post/goom/Makefile.am | 2 +- src/post/mosaico/Makefile.am | 4 ++-- src/post/planar/Makefile.am | 2 +- src/post/visualizations/Makefile.am | 2 +- src/video_out/Makefile.am | 40 ++++++++++++++++++------------------- src/xine-engine/Makefile.am | 2 +- 14 files changed, 47 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/audio_out/Makefile.am b/src/audio_out/Makefile.am index 918f4829e..d52f700f3 100644 --- a/src/audio_out/Makefile.am +++ b/src/audio_out/Makefile.am @@ -94,7 +94,7 @@ xineplug_ao_out_oss_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_ao_out_oss_la_LDFLAGS = -avoid-version -module xineplug_ao_out_alsa_la_SOURCES = audio_alsa_out.c -xineplug_ao_out_alsa_la_LIBADD = $(ALSA_LIBS) $(XINE_LIB) $(THREAD_LIBS) +xineplug_ao_out_alsa_la_LIBADD = $(ALSA_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) xineplug_ao_out_alsa_la_CFLAGS = $(VISIBILITY_FLAG) $(ALSA_CFLAGS) xineplug_ao_out_alsa_la_LDFLAGS = -avoid-version -module @@ -141,7 +141,7 @@ xineplug_ao_out_pulseaudio_la_LDFLAGS = -avoid-version -module xineplug_ao_out_directx2_la_SOURCES = audio_directx2_out.c xineplug_ao_out_directx2_la_CPPFLAGS = $(DIRECTX_CPPFLAGS) -xineplug_ao_out_directx2_la_LIBADD = $(XINE_LIB) $(DIRECTX_AUDIO_LIBS) $(THREAD_LIBS) +xineplug_ao_out_directx2_la_LIBADD = $(XINE_LIB) $(DIRECTX_AUDIO_LIBS) $(PTHREAD_LIBS) xineplug_ao_out_directx2_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_ao_out_directx2_la_LDFLAGS = -avoid-version -module diff --git a/src/input/Makefile.am b/src/input/Makefile.am index dbe9d97dc..68adf84be 100644 --- a/src/input/Makefile.am +++ b/src/input/Makefile.am @@ -77,17 +77,17 @@ xineplug_inp_file_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_file_la_LDFLAGS = -avoid-version -module xineplug_inp_dvd_la_SOURCES = input_dvd.c media_helper.c -xineplug_inp_dvd_la_LIBADD = $(XINE_LIB) $(link_dvdnav) $(THREAD_LIBS) $(DYNAMIC_LD_LIBS) +xineplug_inp_dvd_la_LIBADD = $(XINE_LIB) $(link_dvdnav) $(PTHREAD_LIBS) $(DYNAMIC_LD_LIBS) xineplug_inp_dvd_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_dvd_la_LDFLAGS = -avoid-version -module xineplug_inp_net_la_SOURCES = input_net.c net_buf_ctrl.c -xineplug_inp_net_la_LIBADD = $(XINE_LIB) $(NET_LIBS) $(THREAD_LIBS) +xineplug_inp_net_la_LIBADD = $(XINE_LIB) $(NET_LIBS) $(PTHREAD_LIBS) xineplug_inp_net_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_net_la_LDFLAGS = -avoid-version -module xineplug_inp_mms_la_SOURCES = input_mms.c net_buf_ctrl.c mms.c mmsh.c http_helper.c ../demuxers/asfheader.c -xineplug_inp_mms_la_LIBADD = $(XINE_LIB) @LIBICONV@ $(THREAD_LIBS) +xineplug_inp_mms_la_LIBADD = $(XINE_LIB) @LIBICONV@ $(PTHREAD_LIBS) xineplug_inp_mms_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_mms_la_LDFLAGS = -avoid-version -module @@ -97,32 +97,32 @@ xineplug_inp_vcdo_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_vcdo_la_LDFLAGS = -avoid-version -module xineplug_inp_stdin_fifo_la_SOURCES = input_stdin_fifo.c net_buf_ctrl.c -xineplug_inp_stdin_fifo_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) +xineplug_inp_stdin_fifo_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) xineplug_inp_stdin_fifo_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_stdin_fifo_la_LDFLAGS = -avoid-version -module xineplug_inp_rtp_la_SOURCES = input_rtp.c net_buf_ctrl.c -xineplug_inp_rtp_la_LIBADD = $(XINE_LIB) $(NET_LIBS) $(THREAD_LIBS) +xineplug_inp_rtp_la_LIBADD = $(XINE_LIB) $(NET_LIBS) $(PTHREAD_LIBS) xineplug_inp_rtp_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_rtp_la_LDFLAGS = -avoid-version -module xineplug_inp_http_la_SOURCES = input_http.c net_buf_ctrl.c http_helper.c -xineplug_inp_http_la_LIBADD = $(XINE_LIB) $(NET_LIBS) $(THREAD_LIBS) +xineplug_inp_http_la_LIBADD = $(XINE_LIB) $(NET_LIBS) $(PTHREAD_LIBS) xineplug_inp_http_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_http_la_LDFLAGS = -avoid-version -module xineplug_inp_pnm_la_SOURCES = input_pnm.c net_buf_ctrl.c pnm.c -xineplug_inp_pnm_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) +xineplug_inp_pnm_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) xineplug_inp_pnm_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_pnm_la_LDFLAGS = -avoid-version -module xineplug_inp_dvb_la_SOURCES = input_dvb.c net_buf_ctrl.c -xineplug_inp_dvb_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) +xineplug_inp_dvb_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) xineplug_inp_dvb_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_dvb_la_LDFLAGS = -avoid-version -module xineplug_inp_rtsp_la_SOURCES = input_rtsp.c net_buf_ctrl.c -xineplug_inp_rtsp_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) libreal/libreal.la librtsp/librtsp.la +xineplug_inp_rtsp_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) libreal/libreal.la librtsp/librtsp.la xineplug_inp_rtsp_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_rtsp_la_LDFLAGS = -avoid-version -module @@ -137,7 +137,7 @@ xineplug_inp_v4l_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_v4l_la_LDFLAGS = -avoid-version -module xineplug_inp_gnome_vfs_la_SOURCES = input_gnome_vfs.c net_buf_ctrl.c -xineplug_inp_gnome_vfs_la_LIBADD = $(GNOME_VFS_LIBS) $(XINE_LIB) $(THREAD_LIBS) +xineplug_inp_gnome_vfs_la_LIBADD = $(GNOME_VFS_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) xineplug_inp_gnome_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_gnome_vfs_la_LDFLAGS = -avoid-version -module @@ -147,7 +147,7 @@ xineplug_inp_smb_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_smb_la_LDFLAGS = -avoid-version -module xineplug_inp_pvr_la_SOURCES = input_pvr.c -xineplug_inp_pvr_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) +xineplug_inp_pvr_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) xineplug_inp_pvr_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_pvr_la_LDFLAGS = -avoid-version -module diff --git a/src/input/libdvdnav/Makefile.am b/src/input/libdvdnav/Makefile.am index 2aadb3588..412828261 100644 --- a/src/input/libdvdnav/Makefile.am +++ b/src/input/libdvdnav/Makefile.am @@ -22,7 +22,7 @@ libdvdnav_la_SOURCES = \ dvd_reader.c \ dvd_input.c \ dvd_udf.c -libdvdnav_la_LIBADD = $(THREAD_LIBS) +libdvdnav_la_LIBADD = $(PTHREAD_LIBS) libdvdnav_la_CFLAGS = $(VISIBILITY_FLAG) libdvdnav_la_LDFLAGS = -avoid-version -module diff --git a/src/libffmpeg/Makefile.am b/src/libffmpeg/Makefile.am index 9fef0b59c..5f08ea20e 100644 --- a/src/libffmpeg/Makefile.am +++ b/src/libffmpeg/Makefile.am @@ -38,7 +38,7 @@ endif xineplug_decode_ff_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_decode_ff_la_LDFLAGS = -avoid-version -module @IMPURE_TEXT_LDFLAGS@ xineplug_decode_ff_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) -lm $(ZLIB_LIBS) \ - $(link_ffmpeg) $(THREAD_LIBS) + $(link_ffmpeg) $(PTHREAD_LIBS) xineplug_decode_dvaudio_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_decode_dvaudio_la_LDFLAGS = -avoid-version -module diff --git a/src/libspudec/Makefile.am b/src/libspudec/Makefile.am index aedfb2e71..d50c49ca6 100644 --- a/src/libspudec/Makefile.am +++ b/src/libspudec/Makefile.am @@ -9,7 +9,7 @@ if HAVE_DVDNAV xineplug_decode_spu_la_SOURCES = \ spu.c \ xine_decoder.c -xineplug_decode_spu_la_LIBADD = $(XINE_LIB) $(DVDNAV_LIBS) $(THREAD_LIBS) +xineplug_decode_spu_la_LIBADD = $(XINE_LIB) $(DVDNAV_LIBS) $(PTHREAD_LIBS) else @@ -18,7 +18,7 @@ xineplug_decode_spu_la_SOURCES = \ spu.c \ xine_decoder.c AM_CPPFLAGS = -I$(top_srcdir)/src/input/libdvdnav -xineplug_decode_spu_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) +xineplug_decode_spu_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) endif diff --git a/src/libspudvb/Makefile.am b/src/libspudvb/Makefile.am index 704d085c5..1efc8252f 100644 --- a/src/libspudvb/Makefile.am +++ b/src/libspudvb/Makefile.am @@ -5,6 +5,6 @@ libdir = $(XINE_PLUGINDIR) lib_LTLIBRARIES = xineplug_decode_spudvb.la xineplug_decode_spudvb_la_SOURCES = xine_decoder.c -xineplug_decode_spudvb_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) +xineplug_decode_spudvb_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) xineplug_decode_spudvb_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_decode_spudvb_la_LDFLAGS = -avoid-version -module diff --git a/src/libw32dll/Makefile.am b/src/libw32dll/Makefile.am index 289106cce..46027d0f1 100644 --- a/src/libw32dll/Makefile.am +++ b/src/libw32dll/Makefile.am @@ -20,7 +20,7 @@ xineplug_decode_w32dll_la_LDFLAGS = -avoid-version -module xineplug_decode_w32dll_la_LIBADD = \ $(top_builddir)/src/libw32dll/wine/libwine.la \ $(XINE_LIB) \ - $(THREAD_LIBS) \ + $(PTHREAD_LIBS) \ -lm \ $(top_builddir)/src/libw32dll/DirectShow/libds_filter.la \ $(top_builddir)/src/libw32dll/dmo/libdmo_filter.la \ @@ -31,7 +31,7 @@ xineplug_decode_qt_la_LDFLAGS = -avoid-version -module xineplug_decode_qt_la_LIBADD = \ $(top_builddir)/src/libw32dll/wine/libwine.la \ $(XINE_LIB) \ - $(THREAD_LIBS) \ + $(PTHREAD_LIBS) \ -lm \ @KSTAT_LIBS@ diff --git a/src/post/audio/Makefile.am b/src/post/audio/Makefile.am index 7ed37bc5b..9cb93dd5a 100644 --- a/src/post/audio/Makefile.am +++ b/src/post/audio/Makefile.am @@ -8,7 +8,7 @@ lib_LTLIBRARIES = xineplug_post_audio_filters.la xineplug_post_audio_filters_la_SOURCES = \ upmix.c upmix_mono.c filter.c window.c stretch.c volnorm.c audio_filters.c -xineplug_post_audio_filters_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) -lm +xineplug_post_audio_filters_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) -lm xineplug_post_audio_filters_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_post_audio_filters_la_LDFLAGS = -avoid-version -module diff --git a/src/post/goom/Makefile.am b/src/post/goom/Makefile.am index 4031f4f93..4aeda8f04 100644 --- a/src/post/goom/Makefile.am +++ b/src/post/goom/Makefile.am @@ -27,7 +27,7 @@ xineplug_post_goom_la_SOURCES = $(extra_files) xine_goom.c \ gfontlib.c goom_core.c goom_tools.c goomsl.c goomsl_hash.c goomsl_heap.c \ goomsl_lex.c goomsl_yacc.c graphic.c ifs.c lines.c \ plugin_info.c sound_tester.c surf3d.c tentacle3d.c v3d.c -xineplug_post_goom_la_LIBADD = $(XINE_LIB) $(GOOM_LIBS) $(THREAD_LIBS) -lm +xineplug_post_goom_la_LIBADD = $(XINE_LIB) $(GOOM_LIBS) $(PTHREAD_LIBS) -lm xineplug_post_goom_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_post_goom_la_LDFLAGS = -avoid-version -module diff --git a/src/post/mosaico/Makefile.am b/src/post/mosaico/Makefile.am index aefb290c6..f5497b1af 100644 --- a/src/post/mosaico/Makefile.am +++ b/src/post/mosaico/Makefile.am @@ -5,11 +5,11 @@ libdir = $(XINE_PLUGINDIR)/post lib_LTLIBRARIES = xineplug_post_mosaico.la xineplug_post_switch.la xineplug_post_mosaico_la_SOURCES = mosaico.c -xineplug_post_mosaico_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) +xineplug_post_mosaico_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) xineplug_post_mosaico_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_post_mosaico_la_LDFLAGS = -avoid-version -module xineplug_post_switch_la_SOURCES = switch.c -xineplug_post_switch_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) +xineplug_post_switch_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) xineplug_post_switch_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_post_switch_la_LDFLAGS = -avoid-version -module diff --git a/src/post/planar/Makefile.am b/src/post/planar/Makefile.am index 3440ff6ec..2e60671b5 100644 --- a/src/post/planar/Makefile.am +++ b/src/post/planar/Makefile.am @@ -22,7 +22,7 @@ lib_LTLIBRARIES = xineplug_post_planar.la xineplug_post_planar_la_SOURCES = planar.c invert.c expand.c fill.c boxblur.c \ denoise3d.c eq.c eq2.c unsharp.c pp.c noise.c xineplug_post_planar_la_DEPENDENCIES = $(postproc_dep) -xineplug_post_planar_la_LIBADD = $(XINE_LIB) $(postproc_lib) -lm $(THREAD_LIBS) +xineplug_post_planar_la_LIBADD = $(XINE_LIB) $(postproc_lib) -lm $(PTHREAD_LIBS) xineplug_post_planar_la_LDFLAGS = -avoid-version -module \ @IMPURE_TEXT_LDFLAGS@ xineplug_post_planar_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) diff --git a/src/post/visualizations/Makefile.am b/src/post/visualizations/Makefile.am index 8891b1c53..dc7679103 100644 --- a/src/post/visualizations/Makefile.am +++ b/src/post/visualizations/Makefile.am @@ -8,7 +8,7 @@ lib_LTLIBRARIES = xineplug_post_visualizations.la xineplug_post_visualizations_la_SOURCES = \ visualizations.c fft.c fftscope.c oscope.c fftgraph.c -xineplug_post_visualizations_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) -lm +xineplug_post_visualizations_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) -lm xineplug_post_visualizations_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_post_visualizations_la_LDFLAGS = -avoid-version -module diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index 87a110f4f..34971377c 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -100,94 +100,94 @@ xineplug_LTLIBRARIES = $(xshm_module) $(xv_module) $(xvmc_module) \ xineplug_vo_out_none.la xineplug_vo_out_xcbshm_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c video_out_xcbshm.c $(XCBOSD) -xineplug_vo_out_xcbshm_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) $(THREAD_LIBS) $(XCB_LIBS) $(XCBSHM_LIBS) +xineplug_vo_out_xcbshm_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(XCB_LIBS) $(XCBSHM_LIBS) xineplug_vo_out_xcbshm_la_CFLAGS = $(VISIBILITY_FLAG) $(MLIB_CFLAGS) $(XCB_CFLAGS) $(XCBSHM_CFLAGS) xineplug_vo_out_xcbxv_la_SOURCES = deinterlace.c video_out_xcbxv.c $(XCBOSD) -xineplug_vo_out_xcbxv_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) $(XCBXV_LIBS) $(XCB_LIBS) +xineplug_vo_out_xcbxv_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(XCBXV_LIBS) $(XCB_LIBS) xineplug_vo_out_xcbxv_la_CFLAGS = $(VISIBILITY_FLAG) $(XCB_CFLAGS) $(XCBXV_CFLAGS) xineplug_vo_out_xshm_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ video_out_xshm.c $(X11OSD) -xineplug_vo_out_xshm_la_LIBADD = $(MLIB_LIBS) $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) +xineplug_vo_out_xshm_la_LIBADD = $(MLIB_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) xineplug_vo_out_xshm_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(MLIB_CFLAGS) -fno-strict-aliasing xineplug_vo_out_xv_la_SOURCES = $(X11OSD) deinterlace.c video_out_xv.c -xineplug_vo_out_xv_la_LIBADD = $(XV_LIBS) $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) +xineplug_vo_out_xv_la_LIBADD = $(XV_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) xineplug_vo_out_xv_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(XV_CFLAGS) -fno-strict-aliasing xineplug_vo_out_xvmc_la_SOURCES = deinterlace.c video_out_xvmc.c -xineplug_vo_out_xvmc_la_LIBADD = $(XVMC_LIBS) $(XV_LIBS) $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) +xineplug_vo_out_xvmc_la_LIBADD = $(XVMC_LIBS) $(XV_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) xineplug_vo_out_xvmc_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(XV_CFLAGS) xineplug_vo_out_xxmc_la_SOURCES = $(X11OSD) deinterlace.c video_out_xxmc.c\ xvmc_mocomp.c xvmc_vld.c xxmc.h -xineplug_vo_out_xxmc_la_LIBADD = $(XXMC_LIBS) $(XV_LIBS) $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) +xineplug_vo_out_xxmc_la_LIBADD = $(XXMC_LIBS) $(XV_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) xineplug_vo_out_xxmc_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(XV_CFLAGS) -fno-strict-aliasing xineplug_vo_out_opengl_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ video_out_opengl.c myglext.h $(X11OSD) xineplug_vo_out_opengl_la_LIBADD = $(MLIB_LIBS) $(OPENGL_LIBS) $(GLUT_LIBS) \ - $(GLU_LIBS) $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) $(DYNAMIC_LD_LIBS) + $(GLU_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(DYNAMIC_LD_LIBS) xineplug_vo_out_opengl_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(MLIB_CFLAGS) -fno-strict-aliasing xineplug_vo_out_syncfb_la_SOURCES = video_out_syncfb.c -xineplug_vo_out_syncfb_la_LIBADD = $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) +xineplug_vo_out_syncfb_la_LIBADD = $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) xineplug_vo_out_syncfb_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_vo_out_pgx64_la_SOURCES = video_out_pgx64.c -xineplug_vo_out_pgx64_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(SUNDGA_LIBS) $(THREAD_LIBS) +xineplug_vo_out_pgx64_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(SUNDGA_LIBS) $(PTHREAD_LIBS) xineplug_vo_out_pgx64_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) xineplug_vo_out_pgx32_la_SOURCES = video_out_pgx32.c -xineplug_vo_out_pgx32_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(SUNDGA_LIBS) $(THREAD_LIBS) +xineplug_vo_out_pgx32_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(SUNDGA_LIBS) $(PTHREAD_LIBS) xineplug_vo_out_pgx32_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) xineplug_vo_out_vidix_la_SOURCES = video_out_vidix.c $(X11OSD) xineplug_vo_out_vidix_la_LIBADD = $(XINE_LIB) $(X_LIBS) \ - $(top_builddir)/src/video_out/vidix/libvidix.la $(THREAD_LIBS) + $(top_builddir)/src/video_out/vidix/libvidix.la $(PTHREAD_LIBS) xineplug_vo_out_vidix_la_CFLAGS = $(VISIBILITY_FLAG) $(VIDIX_CFLAGS) $(X_CFLAGS) -fno-strict-aliasing xineplug_vo_out_aa_la_SOURCES = video_out_aa.c -xineplug_vo_out_aa_la_LIBADD = $(AALIB_LIBS) $(XINE_LIB) $(THREAD_LIBS) +xineplug_vo_out_aa_la_LIBADD = $(AALIB_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) xineplug_vo_out_aa_la_CFLAGS = $(VISIBILITY_FLAG) $(AALIB_CFLAGS) xineplug_vo_out_caca_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ video_out_caca.c -xineplug_vo_out_caca_la_LIBADD = $(CACA_LIBS) $(XINE_LIB) $(THREAD_LIBS) +xineplug_vo_out_caca_la_LIBADD = $(CACA_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) xineplug_vo_out_caca_la_CFLAGS = $(VISIBILITY_FLAG) $(CACA_CFLAGS) xineplug_vo_out_fb_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ video_out_fb.c -xineplug_vo_out_fb_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) $(THREAD_LIBS) +xineplug_vo_out_fb_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) xineplug_vo_out_fb_la_CFLAGS = $(VISIBILITY_FLAG) $(MLIB_CFLAGS) xineplug_vo_out_directfb_la_SOURCES = video_out_directfb.c $(X11OSD) -xineplug_vo_out_directfb_la_LIBADD = $(XINE_LIB) $(DIRECTFB_LIBS) $(X_LIBS) $(THREAD_LIBS) +xineplug_vo_out_directfb_la_LIBADD = $(XINE_LIB) $(DIRECTFB_LIBS) $(X_LIBS) $(PTHREAD_LIBS) xineplug_vo_out_directfb_la_CFLAGS = $(VISIBILITY_FLAG) $(DIRECTFB_CFLAGS) -fno-strict-aliasing xineplug_vo_out_sdl_la_SOURCES = video_out_sdl.c -xineplug_vo_out_sdl_la_LIBADD = $(SDL_LIBS) $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) +xineplug_vo_out_sdl_la_LIBADD = $(SDL_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) xineplug_vo_out_sdl_la_CFLAGS = $(VISIBILITY_FLAG) $(X_CFLAGS) $(SDL_CFLAGS) xineplug_vo_out_stk_la_SOURCES = video_out_stk.c -xineplug_vo_out_stk_la_LIBADD = $(XINE_LIB) $(LIBSTK_LIBS) $(THREAD_LIBS) +xineplug_vo_out_stk_la_LIBADD = $(XINE_LIB) $(LIBSTK_LIBS) $(PTHREAD_LIBS) xineplug_vo_out_stk_la_CFLAGS = $(VISIBILITY_FLAG) $(LIBSTK_CFLAGS) xineplug_vo_out_directx_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c video_out_directx.c xineplug_vo_out_directx_la_CPPFLAGS = $(AM_CPPFLAGS) $(DIRECTX_CPPFLAGS) -xineplug_vo_out_directx_la_LIBADD = $(DIRECTX_VIDEO_LIBS) $(XINE_LIB) $(THREAD_LIBS) +xineplug_vo_out_directx_la_LIBADD = $(DIRECTX_VIDEO_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) xineplug_vo_out_directx_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_vo_out_none_la_SOURCES = video_out_none.c -xineplug_vo_out_none_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) +xineplug_vo_out_none_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) xineplug_vo_out_none_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_vo_out_macosx_la_SOURCES = video_out_macosx.m xineplug_vo_out_macosx_la_CPPFLAGS = $(AM_CPPFLAGS) $(X_CFLAGS) $(MLIB_CFLAGS) xineplug_vo_out_macosx_la_OBJCFLAGS = $(VISIBILITY_FLAG) xineplug_vo_out_macosx_la_LIBADD = $(MLIB_LIBS) $(OPENGL_LIBS) $(GLUT_LIBS) \ - $(GLU_LIBS) $(X_LIBS) $(XINE_LIB) $(THREAD_LIBS) + $(GLU_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) # The "-Wl,-framework -Wl,Cocoa" is needed for libtool versions before # 1.5.x (1.257): the default version that ships with Mac OS X is 1.5 (1.1220) xineplug_vo_out_macosx_la_LDFLAGS = $(AM_LDFLAGS) \ diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am index acda9424e..ecd1968f2 100644 --- a/src/xine-engine/Makefile.am +++ b/src/xine-engine/Makefile.am @@ -26,7 +26,7 @@ EXTRA_DIST = lrb.c lrb.h accel_xvmc.h libxine_la_DEPENDENCIES = $(XINEUTILS_LIB) \ $(pthread_dep) $(LIBXINEPOSIX) -libxine_la_LIBADD = $(THREAD_LIBS) $(DYNAMIC_LD_LIBS) $(LTLIBINTL) $(ZLIB_LIBS) \ +libxine_la_LIBADD = $(PTHREAD_LIBS) $(DYNAMIC_LD_LIBS) $(LTLIBINTL) $(ZLIB_LIBS) \ -lm $(XINEUTILS_LIB) $(LIBICONV) $(FT2_LIBS) $(FONTCONFIG_LIBS) \ $(LIBXINEPOSIX) $(RT_LIBS) $(NET_LIBS) -- cgit v1.2.3 From 4d0e0a887efb69fcd9a21db83d169cf99de1892d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 22 Mar 2007 23:32:05 +0000 Subject: Instead of defining HAVE_ASMALIGN_POT during configure and then creating the macro ASMALIGN(ZEROBITS) in ffmpeg's code, define it directly at configure, this way it can be used for the planar postplugin, that will then build with Apple's AS. CVS patchset: 8742 CVS date: 2007/03/22 23:32:05 --- src/libffmpeg/diff_to_ffmpeg_cvs.txt | 9 +-------- src/libffmpeg/libavutil/common.h | 7 ------- src/post/planar/eq.c | 4 ++-- src/post/planar/eq2.c | 4 ++-- src/post/planar/noise.c | 8 ++++---- 5 files changed, 9 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/libffmpeg/diff_to_ffmpeg_cvs.txt b/src/libffmpeg/diff_to_ffmpeg_cvs.txt index 0b8a3946a..2e374cfd0 100644 --- a/src/libffmpeg/diff_to_ffmpeg_cvs.txt +++ b/src/libffmpeg/diff_to_ffmpeg_cvs.txt @@ -42,7 +42,7 @@ Index: libavutil/common.h =================================================================== --- libavutil/common.h (revision 7433) +++ libavutil/common.h (working copy) -@@ -345,4 +345,27 @@ +@@ -345,4 +345,20 @@ char *av_strdup(const char *s); void av_freep(void *ptr); @@ -58,13 +58,6 @@ Index: libavutil/common.h +# define always_inline +#endif + -+/* xine: define ASMALIGN here since it's cleaner that generating it in the configure */ -+#if HAVE_ASMALIGN_POT -+# define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\n\t" -+#else -+# define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\n\t" -+#endif -+ +/* xine: another config.h with codecs to use */ +#include "ffmpeg_config.h" + diff --git a/src/libffmpeg/libavutil/common.h b/src/libffmpeg/libavutil/common.h index 0c77aa26a..0d4346048 100644 --- a/src/libffmpeg/libavutil/common.h +++ b/src/libffmpeg/libavutil/common.h @@ -357,13 +357,6 @@ void av_freep(void *ptr); # define always_inline #endif -/* xine: define ASMALIGN here since it's cleaner that generating it in the configure */ -#if HAVE_ASMALIGN_POT -# define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\n\t" -#else -# define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\n\t" -#endif - /* xine: another config.h with codecs to use */ #include "ffmpeg_config.h" diff --git a/src/post/planar/eq.c b/src/post/planar/eq.c index 50fd03b7f..8c7b00e4b 100644 --- a/src/post/planar/eq.c +++ b/src/post/planar/eq.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: eq.c,v 1.14 2006/02/04 14:06:52 miguelfreitas Exp $ + * $Id: eq.c,v 1.15 2007/03/22 23:32:05 dgp85 Exp $ * * mplayer's eq (soft video equalizer) * Copyright (C) Richard Felker @@ -52,7 +52,7 @@ static void process_MMX(unsigned char *dest, int dstride, unsigned char *src, in "movq (%6), %%mm4 \n\t" "pxor %%mm0, %%mm0 \n\t" "movl %4, %%eax\n\t" - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%0), %%mm1 \n\t" "movq (%0), %%mm2 \n\t" diff --git a/src/post/planar/eq2.c b/src/post/planar/eq2.c index 489733c9b..38f9117db 100644 --- a/src/post/planar/eq2.c +++ b/src/post/planar/eq2.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: eq2.c,v 1.17 2007/02/26 19:15:15 dsalt Exp $ + * $Id: eq2.c,v 1.18 2007/03/22 23:32:05 dgp85 Exp $ * * mplayer's eq2 (soft video equalizer) * Software equalizer (brightness, contrast, gamma, saturation) @@ -128,7 +128,7 @@ void affine_1d_MMX (eq2_param_t *par, unsigned char *dst, unsigned char *src, "movq (%6), %%mm4 \n\t" "pxor %%mm0, %%mm0 \n\t" "movl %4, %%eax\n\t" - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%0), %%mm1 \n\t" "movq (%0), %%mm2 \n\t" diff --git a/src/post/planar/noise.c b/src/post/planar/noise.c index 1b46825db..154d5f8cc 100644 --- a/src/post/planar/noise.c +++ b/src/post/planar/noise.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: noise.c,v 1.3 2006/03/26 14:45:41 valtri Exp $ + * $Id: noise.c,v 1.4 2007/03/22 23:32:05 dgp85 Exp $ * * mplayer's noise filter, ported by Jason Tackaberry. Original filter * is copyright 2002 Michael Niedermayer <michaelni@gmx.at> @@ -159,7 +159,7 @@ static inline void lineNoise_MMX(uint8_t *dst, uint8_t *src, int8_t *noise, int "pcmpeqb %%mm7, %%mm7 \n\t" "psllw $15, %%mm7 \n\t" "packsswb %%mm7, %%mm7 \n\t" - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%0, %%"REG_a"), %%mm0 \n\t" "movq (%1, %%"REG_a"), %%mm1 \n\t" @@ -186,7 +186,7 @@ static inline void lineNoise_MMX2(uint8_t *dst, uint8_t *src, int8_t *noise, int "pcmpeqb %%mm7, %%mm7 \n\t" "psllw $15, %%mm7 \n\t" "packsswb %%mm7, %%mm7 \n\t" - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%0, %%"REG_a"), %%mm0 \n\t" "movq (%1, %%"REG_a"), %%mm1 \n\t" @@ -225,7 +225,7 @@ static inline void lineNoiseAvg_MMX(uint8_t *dst, uint8_t *src, int len, int8_t asm volatile( "mov %5, %%"REG_a" \n\t" - ".balign 16 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%1, %%"REG_a"), %%mm1 \n\t" "movq (%0, %%"REG_a"), %%mm0 \n\t" -- cgit v1.2.3 From 28f03eec2826b61adc58e545a642d3d14163cf91 Mon Sep 17 00:00:00 2001 From: Darren Salt <linux@youmustbejoking.demon.co.uk> Date: Fri, 23 Mar 2007 21:47:31 +0000 Subject: Fix closing the vcd device if the disc is not a video CD. libvcdinfo 0.7.23 closes the device in this case whereas the built-in version did not, and this was causing double frees due to my previous fix which addressed only the built-in version (which needs to be either updated to 0.7.23 or dropped). CVS patchset: 8743 CVS date: 2007/03/23 21:47:31 --- src/input/vcd/libvcd/info.c | 16 +++++++--------- src/input/vcd/vcdio.c | 5 ++--- 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/input/vcd/libvcd/info.c b/src/input/vcd/libvcd/info.c index d178968a8..b01bd6eee 100644 --- a/src/input/vcd/libvcd/info.c +++ b/src/input/vcd/libvcd/info.c @@ -1,5 +1,5 @@ /* - $Id: info.c,v 1.7 2006/09/26 22:29:39 dgp85 Exp $ + $Id: info.c,v 1.8 2007/03/23 21:47:31 dsalt Exp $ Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com> @@ -59,7 +59,7 @@ #include <stddef.h> #include <errno.h> -static const char _rcsid[] = "$Id: info.c,v 1.7 2006/09/26 22:29:39 dgp85 Exp $"; +static const char _rcsid[] = "$Id: info.c,v 1.8 2007/03/23 21:47:31 dsalt Exp $"; #define BUF_COUNT 16 #define BUF_SIZE 80 @@ -1904,14 +1904,12 @@ vcdinfo_open(vcdinfo_obj_t **obj_p, char *source_name[], strlen (ISO_XA_MARKER_STRING)); } - if (!read_info(obj->img, &(obj->info), &(obj->vcd_type))) - return VCDINFO_OPEN_OTHER; - - if (vcdinfo_get_format_version (obj) == VCD_TYPE_INVALID) - return VCDINFO_OPEN_OTHER; - - if (!read_entries(obj->img, &(obj->entries))) + if (!read_info(obj->img, &(obj->info), &(obj->vcd_type)) || + vcdinfo_get_format_version (obj) == VCD_TYPE_INVALID || + !read_entries(obj->img, &(obj->entries))) { + free (obj); /* match 0.7.23's behaviour */ return VCDINFO_OPEN_OTHER; + } { size_t len = strlen(*source_name)+1; diff --git a/src/input/vcd/vcdio.c b/src/input/vcd/vcdio.c index 31cc0cd49..387397cf4 100644 --- a/src/input/vcd/vcdio.c +++ b/src/input/vcd/vcdio.c @@ -1,5 +1,5 @@ /* - $Id: vcdio.c,v 1.8 2006/12/13 19:14:19 dsalt Exp $ + $Id: vcdio.c,v 1.9 2007/03/23 21:47:31 dsalt Exp $ Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> @@ -115,8 +115,7 @@ vcdio_open(vcdplayer_t *p_vcdplayer, char *intended_vcd_device) break; default: - /* Opened the device, but it's not a VCD => close it & return failure */ - vcdinfo_close(p_vcdplayer->vcd); + /* Opened the device, but it's not a VCD => is closed, return failure */ return false; } -- cgit v1.2.3 From 53fc98d09198a2058aa933c8848921ecd211861f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 24 Mar 2007 02:36:52 +0000 Subject: Improve tests for visibility attribute support; Mach-O supports default visibility but not protected (as the default is actually kinda like protected), thanks to Matt Messier in bug #1686194 for pointing me at that. CVS patchset: 8744 CVS date: 2007/03/24 02:36:52 --- src/xine-utils/attributes.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xine-utils/attributes.h b/src/xine-utils/attributes.h index 0328493aa..4d22226ac 100644 --- a/src/xine-utils/attributes.h +++ b/src/xine-utils/attributes.h @@ -47,8 +47,10 @@ #endif /* Export protected only for libxine functions */ -#if defined(XINE_LIBRARY_COMPILE) && defined(SUPPORT_ATTRIBUTE_VISIBILITY) +#if defined(XINE_LIBRARY_COMPILE) && defined(SUPPORT_ATTRIBUTE_VISIBILITY_PROTECTED) # define XINE_PROTECTED __attribute__((visibility("protected"))) +#elif defined(XINE_LIBRARY_COMPILE) && defined(SUPPORT_ATTRIBUTE_VISIBILITY_DEFAULT) +# define XINE_PROTECTED __attribute__((visibility("default"))) #else # define XINE_PROTECTED #endif -- cgit v1.2.3 From 8cac01f82450b409212859c33d867b75abc5131e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 24 Mar 2007 03:14:15 +0000 Subject: Make sure that the big tables are both static and const, so that they don't get loaded into shared memory for copy-on-write. CVS patchset: 8745 CVS date: 2007/03/24 03:14:15 --- src/demuxers/demux_mpgaudio.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 6c0b6031c..7f0a448d9 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpgaudio.c,v 1.151 2007/03/03 01:41:16 dgp85 Exp $ + * $Id: demux_mpgaudio.c,v 1.152 2007/03/24 03:14:15 dgp85 Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -166,7 +166,7 @@ typedef struct { /* bitrate table[mpeg version][layer][bitrate index] * values stored in kbps */ -const int mp3_bitrates[3][3][16] = { +static const int mp3_bitrates[3][3][16] = { { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448,}, {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384,}, {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320,} }, @@ -179,21 +179,21 @@ const int mp3_bitrates[3][3][16] = { }; /* frequency table[mpeg version][frequence index] (in KHz) */ -static int mp3_freqs[3][3] = { +static const int mp3_freqs[3][3] = { { 44100, 48000, 32000 }, { 22050, 24000, 16000 }, { 11025, 12000, 8000 } }; /* samples per frame table[mpeg version][layer] */ -static int mp3_samples[3][3] = { +static const int mp3_samples[3][3] = { { 384, 1152, 1152 }, { 384, 1152, 576 }, { 384, 1152, 576 } }; /* samples per frame table[layer][padding bit] */ -static int mp3_paddings[3][2] = { +static const int mp3_paddings[3][2] = { { 0, 4 }, { 0, 1 }, { 0, 1 } -- cgit v1.2.3 From c5a6f1cd5b1fa705a485b99ad0b2c84357f4ca73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sun, 25 Mar 2007 23:07:23 +0000 Subject: Fix messages for video out modules. Patch by Reinhard Nissl. CVS patchset: 8746 CVS date: 2007/03/25 23:07:23 --- src/video_out/video_out_xcbshm.c | 28 ++++++++++---------- src/video_out/video_out_xcbxv.c | 56 ++++++++++++++++++++-------------------- src/video_out/video_out_xvmc.c | 6 ++--- 3 files changed, 45 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/video_out/video_out_xcbshm.c b/src/video_out/video_out_xcbshm.c index 3e45c7fdb..38f7956b2 100644 --- a/src/video_out/video_out_xcbshm.c +++ b/src/video_out/video_out_xcbshm.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xcbshm.c,v 1.1 2007/02/15 15:19:33 dgp85 Exp $ + * $Id: video_out_xcbshm.c,v 1.2 2007/03/25 23:07:23 dgp85 Exp $ * * video_out_xcbshm.c, X11 shared memory extension interface for xine * @@ -149,8 +149,8 @@ static void create_ximage(xshm_driver_t *this, xshm_frame_t *frame, int width, i if (shmid < 0) { xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_xshm: %s: allocating image\n" - "video_out_xshm: => not using MIT Shared Memory extension.\n"), strerror(errno)); + _("video_out_xcbshm: %s: allocating image\n" + "video_out_xcbshm: => not using MIT Shared Memory extension.\n"), strerror(errno)); goto shm_fail1; } @@ -158,8 +158,8 @@ static void create_ximage(xshm_driver_t *this, xshm_frame_t *frame, int width, i if (frame->image == ((void *) -1)) { xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_xshm: shared memory error (address error) when allocating image \n" - "video_out_xshm: => not using MIT Shared Memory extension.\n")); + _("video_out_xcbshm: shared memory error (address error) when allocating image \n" + "video_out_xcbshm: => not using MIT Shared Memory extension.\n")); goto shm_fail2; } @@ -169,8 +169,8 @@ static void create_ximage(xshm_driver_t *this, xshm_frame_t *frame, int width, i if (generic_error != NULL) { xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_xshm: x11 error during shared memory XImage creation\n" - "video_out_xshm: => not using MIT Shared Memory extension.\n")); + _("video_out_xcbshm: x11 error during shared memory XImage creation\n" + "video_out_xcbshm: => not using MIT Shared Memory extension.\n")); free(generic_error); goto shm_fail3; } @@ -593,7 +593,7 @@ static void xshm_overlay_blend (vo_driver_t *this_gen, break; default: xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "xine-lib:video_out_xshm:xshm_overlay_blend: Cannot blend bpp:%i\n", this->bpp); + "xine-lib:video_out_xcbshm:xshm_overlay_blend: Cannot blend bpp:%i\n", this->bpp); /* it should never get here, unless a user tries to play in bpp:8 */ break; } @@ -731,7 +731,7 @@ static int xshm_get_property (vo_driver_t *this_gen, int property) { return this->sc.gui_height; default: xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_xshm: tried to get unsupported property %d\n", property); + "video_out_xcbshm: tried to get unsupported property %d\n", property); } return 0; @@ -747,7 +747,7 @@ static int xshm_set_property (vo_driver_t *this_gen, value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_xshm: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); + "video_out_xcbshm: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); } else if (property == VO_PROP_BRIGHTNESS) { @@ -781,7 +781,7 @@ static int xshm_set_property (vo_driver_t *this_gen, } else { xprintf (this->xine, XINE_VERBOSITY_DEBUG, - "video_out_xshm: tried to set unsupported property %d\n", property); + "video_out_xcbshm: tried to set unsupported property %d\n", property); } return value; @@ -1105,7 +1105,7 @@ static vo_driver_t *xshm_open_plugin(video_driver_class_t *class_gen, const void } else { xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_xshm: MIT shared memory extension not present on display.\n")); + _("video_out_xcbshm: MIT shared memory extension not present on display.\n")); this->use_shm = 0; } @@ -1143,7 +1143,7 @@ static vo_driver_t *xshm_open_plugin(video_driver_class_t *class_gen, const void swapped = cpu_byte_order != image_byte_order; xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_xshm: video mode depth is %d (%d bpp), %s, %sswapped,\n" + "video_out_xcbshm: video mode depth is %d (%d bpp), %s, %sswapped,\n" "\tred: %08x, green: %08x, blue: %08x\n", this->depth, this->bpp, visual_class_name(visualtype), @@ -1204,7 +1204,7 @@ static vo_driver_t *xshm_open_plugin(video_driver_class_t *class_gen, const void if (!mode) { xprintf (this->xine, XINE_VERBOSITY_LOG, - _("video_out_xshm: your video mode was not recognized, sorry :-(\n")); + _("video_out_xcbshm: your video mode was not recognized, sorry :-(\n")); return NULL; } diff --git a/src/video_out/video_out_xcbxv.c b/src/video_out/video_out_xcbxv.c index 68af4d9bd..231efc9ec 100644 --- a/src/video_out/video_out_xcbxv.c +++ b/src/video_out/video_out_xcbxv.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xcbxv.c,v 1.3 2007/02/19 22:22:32 dgp85 Exp $ + * $Id: video_out_xcbxv.c,v 1.4 2007/03/25 23:07:23 dgp85 Exp $ * * video_out_xcbxv.c, X11 video extension interface for xine * @@ -264,8 +264,8 @@ static void create_ximage(xv_driver_t *this, xv_frame_t *frame, int width, int h if (frame->xv_data_size == 0) { xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_xv: XvShmCreateImage returned a zero size\n" - "video_out_xv: => not using MIT Shared Memory extension.\n")); + _("video_out_xcbxv: XvShmCreateImage returned a zero size\n" + "video_out_xcbxv: => not using MIT Shared Memory extension.\n")); goto shm_fail1; } @@ -273,8 +273,8 @@ static void create_ximage(xv_driver_t *this, xv_frame_t *frame, int width, int h if (shmid < 0 ) { xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_xv: shared memory error in shmget: %s\n" - "video_out_xv: => not using MIT Shared Memory extension.\n"), strerror(errno)); + _("video_out_xcbxv: shared memory error in shmget: %s\n" + "video_out_xcbxv: => not using MIT Shared Memory extension.\n"), strerror(errno)); goto shm_fail1; } @@ -282,7 +282,7 @@ static void create_ximage(xv_driver_t *this, xv_frame_t *frame, int width, int h if (frame->image == ((void *) -1)) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_xv: shared memory error (address error)\n"); + "video_out_xcbxv: shared memory error (address error)\n"); goto shm_fail2; } @@ -292,8 +292,8 @@ static void create_ximage(xv_driver_t *this, xv_frame_t *frame, int width, int h if (generic_error != NULL) { xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_xv: x11 error during shared memory XImage creation\n" - "video_out_xv: => not using MIT Shared Memory extension.\n")); + _("video_out_xcbxv: x11 error during shared memory XImage creation\n" + "video_out_xcbxv: => not using MIT Shared Memory extension.\n")); free(generic_error); goto shm_fail3; } @@ -361,7 +361,7 @@ static void xv_update_frame_format (vo_driver_t *this_gen, || (frame->height != height) || (frame->format != format)) { - /* printf ("video_out_xv: updating frame to %d x %d (ratio=%d, format=%08x)\n",width,height,ratio_code,format); */ + /* printf ("video_out_xcbxv: updating frame to %d x %d (ratio=%d, format=%08x)\n",width,height,ratio_code,format); */ pthread_mutex_lock(&this->main_mutex); @@ -689,7 +689,7 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { xv_driver_t *this = (xv_driver_t *) this_gen; xv_frame_t *frame = (xv_frame_t *) frame_gen; /* - printf ("video_out_xv: xv_display_frame...\n"); + printf ("video_out_xcbxv: xv_display_frame...\n"); */ /* @@ -756,7 +756,7 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { pthread_mutex_unlock(&this->main_mutex); /* - printf ("video_out_xv: xv_display_frame... done\n"); + printf ("video_out_xcbxv: xv_display_frame... done\n"); */ } @@ -772,7 +772,7 @@ static int xv_get_property (vo_driver_t *this_gen, int property) { break; } - lprintf("video_out_xv: property #%d = %d\n", property, this->props[property].value); + lprintf("video_out_xcbxv: property #%d = %d\n", property, this->props[property].value); return this->props[property].value; } @@ -821,7 +821,7 @@ static int xv_set_property (vo_driver_t *this_gen, case VO_PROP_INTERLACED: this->props[property].value = value; xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xv: VO_PROP_INTERLACED(%d)\n", this->props[property].value); + "video_out_xcbxv: VO_PROP_INTERLACED(%d)\n", this->props[property].value); this->deinterlace_enabled = value; if (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) { xv_compute_ideal_size (this); @@ -835,7 +835,7 @@ static int xv_set_property (vo_driver_t *this_gen, this->props[property].value = value; xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xv: VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value); + "video_out_xcbxv: VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value); this->sc.user_ratio = value; xv_compute_ideal_size (this); @@ -847,7 +847,7 @@ static int xv_set_property (vo_driver_t *this_gen, if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { this->props[property].value = value; xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xv: VO_PROP_ZOOM_X = %d\n", this->props[property].value); + "video_out_xcbxv: VO_PROP_ZOOM_X = %d\n", this->props[property].value); this->sc.zoom_factor_x = (double)value / (double)XINE_VO_ZOOM_STEP; @@ -861,7 +861,7 @@ static int xv_set_property (vo_driver_t *this_gen, if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { this->props[property].value = value; xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xv: VO_PROP_ZOOM_Y = %d\n", this->props[property].value); + "video_out_xcbxv: VO_PROP_ZOOM_Y = %d\n", this->props[property].value); this->sc.zoom_factor_y = (double)value / (double)XINE_VO_ZOOM_STEP; @@ -1143,7 +1143,7 @@ static void xv_check_capability (xv_driver_t *this, free(get_attribute_reply); xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_xv: port attribute %s (%d) value is %d\n", str_prop, property, int_default); + "video_out_xcbxv: port attribute %s (%d) value is %d\n", str_prop, property, int_default); /* disable autopaint colorkey by default */ /* might be overridden using config entry */ @@ -1214,7 +1214,7 @@ static void xv_update_XV_FILTER(void *this_gen, xine_cfg_entry_t *entry) { pthread_mutex_unlock(&this->main_mutex); xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_xv: bilinear scaling mode (XV_FILTER) = %d\n",xv_filter); + "video_out_xcbxv: bilinear scaling mode (XV_FILTER) = %d\n",xv_filter); } static void xv_update_XV_DOUBLE_BUFFER(void *this_gen, xine_cfg_entry_t *entry) { @@ -1234,7 +1234,7 @@ static void xv_update_XV_DOUBLE_BUFFER(void *this_gen, xine_cfg_entry_t *entry) pthread_mutex_unlock(&this->main_mutex); xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_xv: double buffering mode = %d\n", xv_double_buffer); + "video_out_xcbxv: double buffering mode = %d\n", xv_double_buffer); } static void xv_update_xv_pitch_alignment(void *this_gen, xine_cfg_entry_t *entry) { @@ -1283,7 +1283,7 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis query_extension_reply = xcb_get_extension_data(this->connection, &xcb_xv_id); if (!query_extension_reply || !query_extension_reply->present) { - xprintf (class->xine, XINE_VERBOSITY_LOG, _("video_out_xv: Xv extension not present.\n")); + xprintf (class->xine, XINE_VERBOSITY_LOG, _("video_out_xcbxv: Xv extension not present.\n")); return NULL; } @@ -1295,7 +1295,7 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis query_adaptors_reply = xcb_xv_query_adaptors_reply(this->connection, query_adaptors_cookie, NULL); if (!query_adaptors_reply) { - xprintf(class->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: XvQueryAdaptors failed.\n"); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, "video_out_xcbxv: XvQueryAdaptors failed.\n"); return NULL; } @@ -1325,15 +1325,15 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis if (!xv_port) { xprintf(class->xine, XINE_VERBOSITY_LOG, - _("video_out_xv: Xv extension is present but I couldn't find a usable yuv12 port.\n" - " Looks like your graphics hardware driver doesn't support Xv?!\n")); + _("video_out_xcbxv: Xv extension is present but I couldn't find a usable yuv12 port.\n" + " Looks like your graphics hardware driver doesn't support Xv?!\n")); /* XvFreeAdaptorInfo (adaptor_info); this crashed on me (gb)*/ return NULL; } else xprintf(class->xine, XINE_VERBOSITY_LOG, - _("video_out_xv: using Xv port %d from adaptor %s for hardware " + _("video_out_xcbxv: using Xv port %d from adaptor %s for hardware " "colorspace conversion and scaling.\n"), xv_port, xcb_xv_adaptor_info_name(adaptor_it.data)); @@ -1406,7 +1406,7 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis if(!strcmp(xcb_xv_attribute_info_name(attribute_it.data), "XV_HUE")) { if (!strncmp(xcb_xv_adaptor_info_name(adaptor_it.data), "NV", 2)) { - xprintf (this->xine, XINE_VERBOSITY_NONE, "video_out_xv: ignoring broken XV_HUE settings on NVidia cards"); + xprintf (this->xine, XINE_VERBOSITY_NONE, "video_out_xcbxv: ignoring broken XV_HUE settings on NVidia cards"); } else { xv_check_capability (this, VO_PROP_HUE, attribute_it.data, adaptor_it.data->base_id, @@ -1476,7 +1476,7 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis free(query_attributes_reply); } else - xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: no port attributes defined.\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xcbxv: no port attributes defined.\n"); free(query_adaptors_reply); /* @@ -1501,12 +1501,12 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis this->xv_format_yv12 = format_it.data->id; this->capabilities |= VO_CAP_YV12; xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_xv: this adaptor supports the yv12 format.\n")); + _("video_out_xcbxv: this adaptor supports the yv12 format.\n")); } else if (format_it.data->id == XINE_IMGFMT_YUY2) { this->xv_format_yuy2 = format_it.data->id; this->capabilities |= VO_CAP_YUY2; xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_xv: this adaptor supports the yuy2 format.\n")); + _("video_out_xcbxv: this adaptor supports the yuy2 format.\n")); } } diff --git a/src/video_out/video_out_xvmc.c b/src/video_out/video_out_xvmc.c index fd0299435..53d09b7d5 100644 --- a/src/video_out/video_out_xvmc.c +++ b/src/video_out/video_out_xvmc.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xvmc.c,v 1.28 2006/07/10 22:08:44 dgp85 Exp $ + * $Id: video_out_xvmc.c,v 1.29 2007/03/25 23:07:23 dgp85 Exp $ * * video_out_xvmc.c, X11 video motion compensation extension interface for xine * @@ -1074,7 +1074,7 @@ static int xvmc_set_property (vo_driver_t *this_gen, if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { this->props[property].value = value; xprintf (this->xine, XINE_VERBOSITY_DEBUG, - "video_out_xv: VO_PROP_ZOOM_X = %d\n", this->props[property].value); + "video_out_xvmc: VO_PROP_ZOOM_X = %d\n", this->props[property].value); this->sc.zoom_factor_x = (double)value / (double)XINE_VO_ZOOM_STEP; xvmc_compute_ideal_size (this); @@ -1086,7 +1086,7 @@ static int xvmc_set_property (vo_driver_t *this_gen, if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { this->props[property].value = value; xprintf (this->xine, XINE_VERBOSITY_DEBUG, - "video_out_xv: VO_PROP_ZOOM_Y = %d\n", this->props[property].value); + "video_out_xvmc: VO_PROP_ZOOM_Y = %d\n", this->props[property].value); this->sc.zoom_factor_y = (double)value / (double)XINE_VO_ZOOM_STEP; xvmc_compute_ideal_size (this); -- cgit v1.2.3 From f365c4d88b2110300e6f4b050c69f4ebea935e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sun, 25 Mar 2007 23:09:42 +0000 Subject: Fix amp muting when level is still at 100. Patch by Reinhard Nissl. CVS patchset: 8747 CVS date: 2007/03/25 23:09:42 --- src/xine-engine/audio_out.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index 90a139010..a3cf4d8ea 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -17,7 +17,7 @@ * along with self program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_out.c,v 1.208 2006/12/25 15:07:52 dgp85 Exp $ + * $Id: audio_out.c,v 1.209 2007/03/25 23:09:42 dgp85 Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe <andy@alsaplayer.org> @@ -1760,13 +1760,15 @@ static int ao_set_property (xine_audio_port_t *this_gen, int property, int value this->amp_factor = (double) value / 100.0; - this->do_amp = (this->amp_factor != 1.0); + this->do_amp = (this->amp_factor != 1.0 || this->amp_mute); ret = this->amp_factor*100; break; case AO_PROP_AMP_MUTE: ret = this->amp_mute = value; + + this->do_amp = (this->amp_factor != 1.0 || this->amp_mute); break; case AO_PROP_EQ_30HZ: -- cgit v1.2.3 From 91f91ec1332e1bc2a1434a1658d825a16ed56ff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sun, 25 Mar 2007 23:13:53 +0000 Subject: =?UTF-8?q?Create=20at=20least=20a=201=C3=971=20shared=20image=20w?= =?UTF-8?q?hen=20the=20first=20frame=20is=20skipped=20(and=20thus=20report?= =?UTF-8?q?ed=20as=200=C3=970),=20to=20avoid=20disabling=20shared=20memory?= =?UTF-8?q?=20for=20all=20others.=20Patch=20by=20Reinhard=20Nissl.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CVS patchset: 8748 CVS date: 2007/03/25 23:13:53 --- src/video_out/video_out_xcbshm.c | 7 ++++++- src/video_out/video_out_xcbxv.c | 7 ++++++- src/video_out/video_out_xshm.c | 7 ++++++- src/video_out/video_out_xv.c | 7 ++++++- src/video_out/video_out_xxmc.c | 7 ++++++- 5 files changed, 30 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/video_out/video_out_xcbshm.c b/src/video_out/video_out_xcbshm.c index 38f7956b2..5b4eb1fa3 100644 --- a/src/video_out/video_out_xcbshm.c +++ b/src/video_out/video_out_xcbshm.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xcbshm.c,v 1.2 2007/03/25 23:07:23 dgp85 Exp $ + * $Id: video_out_xcbshm.c,v 1.3 2007/03/25 23:13:53 dgp85 Exp $ * * video_out_xcbshm.c, X11 shared memory extension interface for xine * @@ -133,6 +133,11 @@ typedef struct { */ static void create_ximage(xshm_driver_t *this, xshm_frame_t *frame, int width, int height) { + if (width <= 0) + width = 1; + if (height <= 0) + height = 1; + frame->bytes_per_line = ((this->bpp * width + this->scanline_pad - 1) & (~(this->scanline_pad - 1))) >> 3; diff --git a/src/video_out/video_out_xcbxv.c b/src/video_out/video_out_xcbxv.c index 231efc9ec..52fd0fb6c 100644 --- a/src/video_out/video_out_xcbxv.c +++ b/src/video_out/video_out_xcbxv.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xcbxv.c,v 1.4 2007/03/25 23:07:23 dgp85 Exp $ + * $Id: video_out_xcbxv.c,v 1.5 2007/03/25 23:13:53 dgp85 Exp $ * * video_out_xcbxv.c, X11 video extension interface for xine * @@ -215,6 +215,11 @@ static void create_ximage(xv_driver_t *this, xv_frame_t *frame, int width, int h unsigned int length; + if (width <= 0) + width = 1; + if (height <= 0) + height = 1; + if (this->use_pitch_alignment) { width = (width + 7) & ~0x7; } diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index 579189825..00d3bee1c 100644 --- a/src/video_out/video_out_xshm.c +++ b/src/video_out/video_out_xshm.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xshm.c,v 1.149 2007/02/15 15:19:33 dgp85 Exp $ + * $Id: video_out_xshm.c,v 1.150 2007/03/25 23:13:53 dgp85 Exp $ * * video_out_xshm.c, X11 shared memory extension interface for xine * @@ -175,6 +175,11 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, int width, int height) { XImage *myimage = NULL; + if (width <= 0) + width = 1; + if (height <= 0) + height = 1; + if (this->use_shm) { /* diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index 75a4a37e2..19b57bc27 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xv.c,v 1.222 2007/02/15 18:26:55 dgp85 Exp $ + * $Id: video_out_xv.c,v 1.223 2007/03/25 23:13:53 dgp85 Exp $ * * video_out_xv.c, X11 video extension interface for xine * @@ -258,6 +258,11 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, unsigned int xv_format; XvImage *image = NULL; + if (width <= 0) + width = 1; + if (height <= 0) + height = 1; + if (this->use_pitch_alignment) { width = (width + 7) & ~0x7; } diff --git a/src/video_out/video_out_xxmc.c b/src/video_out/video_out_xxmc.c index 4292ca0b6..0abe2f0fc 100644 --- a/src/video_out/video_out_xxmc.c +++ b/src/video_out/video_out_xxmc.c @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xxmc.c,v 1.22 2006/07/10 22:08:44 dgp85 Exp $ + * $Id: video_out_xxmc.c,v 1.23 2007/03/25 23:13:53 dgp85 Exp $ * * video_out_xxmc.c, X11 decoding accelerated video extension interface for xine * @@ -608,6 +608,11 @@ static XvImage *create_ximage (xxmc_driver_t *this, XShmSegmentInfo *shminfo, unsigned int xv_format; XvImage *image = NULL; + if (width <= 0) + width = 1; + if (height <= 0) + height = 1; + if (this->use_pitch_alignment) { width = (width + 7) & ~0x7; } -- cgit v1.2.3 From 0f40cfbc8e2ce03b42ce2cf732388b9e8cf50e75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Mon, 26 Mar 2007 11:48:00 +0000 Subject: Send an event when the amp value or amp mute change. Patch by reinhard Nissl. Also bump the libtool version info. CVS patchset: 8749 CVS date: 2007/03/26 11:48:00 --- src/xine-engine/xine_interface.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c index 1861df7c0..e58d9ed61 100644 --- a/src/xine-engine/xine_interface.c +++ b/src/xine-engine/xine_interface.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_interface.c,v 1.103 2007/02/22 16:04:45 dgp85 Exp $ + * $Id: xine_interface.c,v 1.104 2007/03/26 11:48:01 dgp85 Exp $ * * convenience/abstraction layer, functions to implement * libxine's public interface @@ -341,6 +341,24 @@ int xine_port_send_gui_data (xine_video_port_t *vo, type, data); } +static void send_audio_amp_event_internal(xine_stream_t *stream) +{ + xine_event_t event; + xine_audio_level_data_t data; + + data.left + = data.right + = stream->audio_out->get_property (stream->audio_out, AO_PROP_AMP); + data.mute + = stream->audio_out->get_property (stream->audio_out, AO_PROP_AMP_MUTE); + + event.type = XINE_EVENT_AUDIO_AMP_LEVEL; + event.data = &data; + event.data_length = sizeof (data); + + xine_event_send(stream, &event); +} + void xine_set_param (xine_stream_t *stream, int param, int value) { /* Avoid crashing */ if ( ! stream ) { @@ -412,15 +430,21 @@ void xine_set_param (xine_stream_t *stream, int param, int value) { case XINE_PARAM_AUDIO_AMP_LEVEL: stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0); - if (stream->audio_out) - stream->audio_out->set_property (stream->audio_out, AO_PROP_AMP, value); + if (stream->audio_out) { + int old_value = stream->audio_out->get_property (stream->audio_out, AO_PROP_AMP); + if (old_value != stream->audio_out->set_property (stream->audio_out, AO_PROP_AMP, value)) + send_audio_amp_event_internal(stream); + } stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; case XINE_PARAM_AUDIO_AMP_MUTE: stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0); - if (stream->audio_out) - stream->audio_out->set_property (stream->audio_out, AO_PROP_AMP_MUTE, value); + if (stream->audio_out) { + int old_value = stream->audio_out->get_property (stream->audio_out, AO_PROP_AMP_MUTE); + if (old_value != stream->audio_out->set_property (stream->audio_out, AO_PROP_AMP_MUTE, value)) + send_audio_amp_event_internal(stream); + } stream->xine->port_ticket->release(stream->xine->port_ticket, 0); break; -- cgit v1.2.3 From a2a39bb90c9b02a7715d96cf1fb185c7a9e10b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Mon, 26 Mar 2007 21:06:32 +0000 Subject: Add support for H.264 video stream in PES packets. Patch by Reinhard Nissl. CVS patchset: 8752 CVS date: 2007/03/26 21:06:32 --- src/demuxers/demux_mpeg_pes.c | 119 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 109 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c index 3eceb8fa7..8b1a3d2e9 100644 --- a/src/demuxers/demux_mpeg_pes.c +++ b/src/demuxers/demux_mpeg_pes.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpeg_pes.c,v 1.40 2007/02/20 00:34:56 dgp85 Exp $ + * $Id: demux_mpeg_pes.c,v 1.41 2007/03/26 21:06:32 dgp85 Exp $ * * demultiplexer for mpeg 2 PES (Packetized Elementary Streams) * reads streams of variable blocksizes @@ -91,6 +91,7 @@ typedef struct demux_mpeg_pes_s { uint32_t stream_id; int32_t mpeg1; int32_t wait_for_program_stream_pack_header; + int mpeg12_h264_detected; int64_t last_cell_time; off_t last_cell_pos; @@ -417,6 +418,9 @@ static int32_t parse_padding_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_elem done += i; } + /* trigger detection of MPEG 1/2 respectively H.264 content */ + this->mpeg12_h264_detected = 0; + buf->free_buffer(buf); return this->packet_len + 6; } @@ -1062,21 +1066,102 @@ static int32_t parse_video_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_elemen uint32_t todo_length=0; uint32_t i; uint32_t chunk_length; + int buf_type = BUF_VIDEO_MPEG; + int payload_size; result = parse_pes_for_pts(this, p, buf); if (result < 0) return -1; p += result; - buf->content = p; + buf->content = p; + payload_size = buf->max_size - result; + if (payload_size > this->packet_len) + payload_size = this->packet_len; + + /* H.264 broadcasts via DVB-S use standard video PES packets, + so there is no way other than scanning the video data to + detect whether BUF_VIDEO_H264 needs to be used. + For performance reasons, this is not a general scanner for + H.264 content, as this kind of data format is likely to be + used only by VDR and VDR will ensure that an AUD-NAL unit + will be at the beginning of the PES packet's payload. + To minimize false hits, the whole payload is scanned for + MPEG 1/2 start codes, so there is only a little chance left + that a MPEG 1/2 slice 9 start code will be considered as a + H.264 access unit delimiter (should only happen after a seek). + + Meaning of bit 0 and 1 of mpeg12_h264_detected: + Bit 0: H.264 access unit delimiter seen + Bit 1: H.264 AUD seen again or MPEG 1/2 start code seen + + For performance reasons, the scanner is only active until + a H.264 AUD has been seen a second time or a MPEG 1/2 start + code has been seen. The scanner get's activated initially + (e. g. when opening the stream), after seeking or when VDR + sends a padding packet. + Until the scanner is convinced of it's decision by setting + bit 1, the default behaviour is to assume MPEG 1/2 unless + an AUD has been found at the beginning of the payload. + */ + if (this->mpeg12_h264_detected < 2) { + uint8_t *pp = p + 2, *pp_limit = p + payload_size - 1; + while (0 < pp && pp < pp_limit) { + if (pp[0] == 0x01 && pp[-1] == 0x00 && pp[-2] == 0x00) { + if (pp[1] >= 0x80) { /* MPEG 1/2 start code */ + this->mpeg12_h264_detected = 2; + break; + } else { + int nal_type_code = pp[1] & 0x1f; + if (nal_type_code == 9 && pp == (p + 2)) { /* access unit delimiter */ + if (this->mpeg12_h264_detected == 1) { + this->mpeg12_h264_detected = 3; + break; + } + this->mpeg12_h264_detected = 1; + } + } + } + pp++; + pp = memchr(pp, 0x01, pp_limit - pp); + } + lprintf("%s%c\n", (this->mpeg12_h264_detected & 1) ? "H.264" : "MPEG1/2", (this->mpeg12_h264_detected & 2) ? '!' : '?'); + } - if (this->packet_len <= (buf->max_size - 6)) { - buf->size = this->packet_len; + /* when an H.264 AUD is seen, we first need to tell the decoder that the + previous frame was complete. + */ + if (this->mpeg12_h264_detected & 1) { + buf_type = BUF_VIDEO_H264; + int nal_type_code = -1; + if (payload_size >= 4 && p[2] == 0x01 && p[1] == 0x00 && p[0] == 0x00) + nal_type_code = p[3] & 0x1f; + if (nal_type_code == 9) { /* access unit delimiter */ + buf_element_t *b = this->video_fifo->buffer_pool_alloc (this->video_fifo); + b->content = b->mem; + b->size = 0; + b->pts = 0; + b->type = buf_type; + b->decoder_flags = BUF_FLAG_FRAME_END; + this->video_fifo->put (this->video_fifo, b); + } + } + + if (this->packet_len <= (buf->max_size - result)) { + buf->size = this->packet_len; + /* VDR ensures that H.264 still images end with an end of sequence NAL unit. We + need to detect this to inform the decoder that the current frame is complete. + */ + if (this->mpeg12_h264_detected & 1) { + uint8_t *t = buf->content + buf->size; + if (buf->size >=4 && t[-1] == 10 && t[-2] == 0x01 && t[-3] == 0x00 && t[-4] == 0x00) /* end of sequence */ + buf->decoder_flags = BUF_FLAG_FRAME_END; + } } else { - buf->size = buf->max_size - result; - todo_length = this->packet_len - buf->size; + buf->size = buf->max_size - result; + todo_length = this->packet_len - buf->size; } - buf->type = BUF_VIDEO_MPEG; + buf->type = buf_type; buf->pts = this->pts; buf->decoder_info[0] = this->pts - this->dts; if( !this->preview_mode ) @@ -1098,10 +1183,20 @@ static int32_t parse_video_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_elemen } buf->content = buf->mem; buf->size = chunk_length; - buf->type = BUF_VIDEO_MPEG; + buf->type = buf_type; buf->pts = 0; - this->video_fifo->put (this->video_fifo, buf); todo_length -= chunk_length; + + /* VDR ensures that H.264 still images end with an end of sequence NAL unit. We + need to detect this to inform the decoder that the current frame is complete. + */ + if ((this->mpeg12_h264_detected & 1) && todo_length <= 0) { + uint8_t *t = buf->content + buf->size; + if (buf->size >= 4 && t[-1] == 10 && t[-2] == 0x01 && t[-3] == 0x00 && t[-4] == 0x00) /* end of sequence */ + buf->decoder_flags = BUF_FLAG_FRAME_END; + } + + this->video_fifo->put (this->video_fifo, buf); } lprintf ("MPEG Video PACK put on fifo\n"); @@ -1426,6 +1521,8 @@ static int demux_mpeg_pes_seek (demux_plugin_t *this_gen, } else { this->buf_flag_seek = 1; this->nav_last_end_pts = this->nav_last_start_pts = 0; + /* trigger detection of MPEG 1/2 respectively H.264 content */ + this->mpeg12_h264_detected = 0; _x_demux_flush_engine(this->stream); } @@ -1500,7 +1597,9 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->status = DEMUX_FINISHED; /* Don't start demuxing stream until we see a program_stream_pack_header */ /* We need to system header in order to identify is the stream is mpeg1 or mpeg2. */ - this->wait_for_program_stream_pack_header=1; + this->wait_for_program_stream_pack_header = 1; + /* trigger detection of MPEG 1/2 respectively H.264 content */ + this->mpeg12_h264_detected = 0; this->preview_size = 0; -- cgit v1.2.3 From 53ac3806716cfab072241bb157cd4a6120fa8f75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Mon, 26 Mar 2007 21:18:52 +0000 Subject: Optimise the demux_mpeg_pes_t structure a bit, instead of using two int32_t as boolean, and one int for just two LSBs, use a 1/1/2 bitmask, saves 11 bytes of memory (and probably also cpu instructions as there is almost no arithmetic done with it, but just logic that can be easily used bitwise. CVS patchset: 8753 CVS date: 2007/03/26 21:18:52 --- src/demuxers/demux_mpeg_pes.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c index 8b1a3d2e9..486b220f8 100644 --- a/src/demuxers/demux_mpeg_pes.c +++ b/src/demuxers/demux_mpeg_pes.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpeg_pes.c,v 1.41 2007/03/26 21:06:32 dgp85 Exp $ + * $Id: demux_mpeg_pes.c,v 1.42 2007/03/26 21:18:52 dgp85 Exp $ * * demultiplexer for mpeg 2 PES (Packetized Elementary Streams) * reads streams of variable blocksizes @@ -89,10 +89,10 @@ typedef struct demux_mpeg_pes_s { int64_t pts; int64_t dts; uint32_t stream_id; - int32_t mpeg1; - int32_t wait_for_program_stream_pack_header; - int mpeg12_h264_detected; - + uint8_t mpeg1:1; + uint8_t wait_for_program_stream_pack_header:1; + uint8_t mpeg12_h264_detected:2; + int64_t last_cell_time; off_t last_cell_pos; int last_begin_time; -- cgit v1.2.3 From 15ad76099c947512bbc5ff1b0bf5bb8a17c4bb9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Mon, 26 Mar 2007 21:52:12 +0000 Subject: More bitmasks, this might be interesting, as it reduces the size quite a bit, padding or no padding. CVS patchset: 8754 CVS date: 2007/03/26 21:52:12 --- src/demuxers/demux_mpgaudio.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 7f0a448d9..884c66dba 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpgaudio.c,v 1.152 2007/03/24 03:14:15 dgp85 Exp $ + * $Id: demux_mpgaudio.c,v 1.153 2007/03/26 21:52:12 dgp85 Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -80,21 +80,21 @@ typedef struct { /* header */ uint16_t frame_sync; - uint8_t mpeg25_bit; - uint8_t lsf_bit; uint8_t layer; - uint8_t protection_bit; - uint8_t bitrate_idx; - uint8_t freq_idx; - uint8_t padding_bit; - uint8_t private_bit; - uint8_t channel_mode; - uint8_t mode_extension; - uint8_t copyright; - uint8_t original; - uint8_t emphasis; - - uint8_t version_idx; /* 0: mpeg1, 1: mpeg2, 2: mpeg2.5 */ + uint32_t mpeg25_bit:1; + uint32_t lsf_bit:1; + uint32_t bitrate_idx:4; + uint32_t freq_idx:3; + uint32_t protection_bit:1; + uint32_t padding_bit:1; + uint32_t private_bit:1; + uint32_t channel_mode:3; + uint32_t mode_extension:3; + uint32_t copyright:1; + uint32_t original:1; + uint32_t emphasis:3; + + uint32_t version_idx:2; /* 0: mpeg1, 1: mpeg2, 2: mpeg2.5 */ int bitrate; /* in bit per second */ int freq; /* in Hz */ int samples; /* samples per frame */ -- cgit v1.2.3 From 7b3a83b54ea83066cffc6169d5ecf2d24959c5c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 16:01:30 +0000 Subject: Code cleanup: don't export all the bits read in the header to the whole plugin, only a subset of the information is needed, so hide the rest in an anonymous structure inside the parsing function. This reduces the header structure size to 24 rather than 40 (of the version already reduced by using bitmasks) and allows it to stay in a single cacheline. Also, don't consider those flags that we don't use; leave the code in place so that if they need to be parsed in the future they can, but under #if 0 so that it's not compiled. Move the tables for mp3's magic constants inside the parsing function, to hide them from the global namespace, and resize them to use uint16_t rather than int. Use memcpy rather than copying the bytes one by one for the xing header. CVS patchset: 8755 CVS date: 2007/03/29 16:01:30 --- src/demuxers/demux_mpgaudio.c | 193 ++++++++++++++++++++++-------------------- 1 file changed, 99 insertions(+), 94 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 884c66dba..29a0de95b 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpgaudio.c,v 1.153 2007/03/26 21:52:12 dgp85 Exp $ + * $Id: demux_mpgaudio.c,v 1.154 2007/03/29 16:01:30 dgp85 Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -79,28 +79,16 @@ /* mp3 frame struct */ typedef struct { /* header */ - uint16_t frame_sync; - uint8_t layer; - uint32_t mpeg25_bit:1; - uint32_t lsf_bit:1; - uint32_t bitrate_idx:4; - uint32_t freq_idx:3; - uint32_t protection_bit:1; - uint32_t padding_bit:1; - uint32_t private_bit:1; - uint32_t channel_mode:3; - uint32_t mode_extension:3; - uint32_t copyright:1; - uint32_t original:1; - uint32_t emphasis:3; - - uint32_t version_idx:2; /* 0: mpeg1, 1: mpeg2, 2: mpeg2.5 */ - int bitrate; /* in bit per second */ - int freq; /* in Hz */ - int samples; /* samples per frame */ - int padding; /* padding bytes (0, 1 or 4)*/ - int size; /* in bytes */ - double duration; /* in xine pts */ + double duration; + uint32_t size; /* in bytes */ + uint16_t freq; /* in Hz */ + uint16_t bitrate; /* in bit per second */ + + uint8_t layer; + + uint8_t version_idx:2; /* 0: mpeg1, 1: mpeg2, 2: mpeg2.5 */ + uint8_t lsf_bit:1; + uint8_t channel_mode:3; } mpg_audio_frame_t; /* Xing Vbr Header struct */ @@ -163,61 +151,72 @@ typedef struct { } demux_mpgaudio_class_t; -/* bitrate table[mpeg version][layer][bitrate index] - * values stored in kbps - */ -static const int mp3_bitrates[3][3][16] = { - { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448,}, - {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384,}, - {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320,} }, - { {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256,}, - {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,}, - {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,} }, - { {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256,}, - {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,}, - {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,} } -}; - -/* frequency table[mpeg version][frequence index] (in KHz) */ -static const int mp3_freqs[3][3] = { - { 44100, 48000, 32000 }, - { 22050, 24000, 16000 }, - { 11025, 12000, 8000 } -}; - -/* samples per frame table[mpeg version][layer] */ -static const int mp3_samples[3][3] = { - { 384, 1152, 1152 }, - { 384, 1152, 576 }, - { 384, 1152, 576 } -}; - -/* samples per frame table[layer][padding bit] */ -static const int mp3_paddings[3][2] = { - { 0, 4 }, - { 0, 1 }, - { 0, 1 } -}; - /* * Parse a mp3 frame * return 1 on success */ -static int parse_frame_header(mpg_audio_frame_t *frame, uint8_t *buf) { - uint32_t head; +static int parse_frame_header(mpg_audio_frame_t *const frame, const uint8_t *const buf) { + /* bitrate table[mpeg version][layer][bitrate index] + * values stored in kbps + */ + static const uint16_t mp3_bitrates[3][3][16] = { + { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448,}, + {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384,}, + {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320,} }, + { {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256,}, + {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,}, + {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,} }, + { {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256,}, + {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,}, + {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,} } + }; + + /* frequency table[mpeg version][frequence index] (in KHz) */ + static const uint16_t mp3_freqs[3][3] = { + { 44100, 48000, 32000 }, + { 22050, 24000, 16000 }, + { 11025, 12000, 8000 } + }; + + /* samples per frame table[mpeg version][layer] */ + static const uint16_t mp3_samples[3][3] = { + { 384, 1152, 1152 }, + { 384, 1152, 576 }, + { 384, 1152, 576 } + }; + + struct { + uint16_t mpeg25_bit:1; + uint16_t bitrate_idx:4; + uint16_t freq_idx:3; + uint16_t padding_bit:1; + uint16_t channel_mode:3; + +#if 0 /* Unused */ + uint16_t protection_bit:1; + uint16_t private_bit:1; + uint16_t mode_extension:3; + uint16_t copyright:1; + uint16_t original:1; +#endif - head = BE_32(buf); +#if defined(OPT_STRICT) + uint16_t emphasis:3; +#endif + } frame_header; + + const uint32_t head = BE_32(buf); + const uint16_t frame_sync = head >> 21; lprintf("header: %08X\n", head); - frame->frame_sync = head >> 21; - if (frame->frame_sync != 0x7ff) { + if (frame_sync != 0x7ff) { lprintf("invalid frame sync\n"); return 0; } - frame->mpeg25_bit = (head >> 20) & 0x1; + frame_header.mpeg25_bit = (head >> 20) & 0x1; frame->lsf_bit = (head >> 19) & 0x1; - if (!frame->mpeg25_bit) { + if (!frame_header.mpeg25_bit) { if (frame->lsf_bit) { lprintf("reserved mpeg25 lsf combination\n"); return 0; @@ -236,54 +235,60 @@ static int parse_frame_header(mpg_audio_frame_t *frame, uint8_t *buf) { return 0; } - frame->protection_bit = (head >> 16) & 0x1; - frame->bitrate_idx = (head >> 12) & 0xf; - if ((frame->bitrate_idx == 0) || (frame->bitrate_idx == 15)) { + frame_header.bitrate_idx = (head >> 12) & 0xf; + if ((frame_header.bitrate_idx == 0) || (frame_header.bitrate_idx == 15)) { lprintf("invalid bitrate index\n"); return 0; } - frame->freq_idx = (head >> 10) & 0x3; - if (frame->freq_idx == 3) { + frame_header.freq_idx = (head >> 10) & 0x3; + if (frame_header.freq_idx == 3) { lprintf("invalid frequence index\n"); return 0; } - frame->padding_bit = (head >> 9) & 0x1; - frame->private_bit = (head >> 8) & 0x1; - frame->channel_mode = (head >> 6) & 0x3; - frame->mode_extension = (head >> 4) & 0x3; - frame->copyright = (head >> 3) & 0x1; - frame->original = (head >> 2) & 0x1; - frame->emphasis = head & 0x3; + frame_header.padding_bit = (head >> 9) & 0x1; + frame_header.channel_mode = (head >> 6) & 0x3; + +#if 0 /* Unused */ + frame_header.protection_bit = (head >> 16) & 0x1; + frame_header.private_bit = (head >> 8) & 0x1; + frame_header.mode_extension = (head >> 4) & 0x3; + frame_header.copyright = (head >> 3) & 0x1; + frame_header.original = (head >> 2) & 0x1; +#endif #if defined(OPT_STRICT) + frame_header.emphasis = head & 0x3; + /* * ISO/IEC 11172-3 says this is a reserved emphasis value, but * streams exist which use it anyway. Since the value is not important * to the decoder proper, we allow it unless OPT_STRICT is defined. */ - if (frame->emphasis == 2) { + if (frame_header.emphasis == 2) { lprintf("reserved emphasis\n"); return 0; } #endif - frame->bitrate = mp3_bitrates[frame->version_idx][frame->layer - 1][frame->bitrate_idx] * 1000; - frame->freq = mp3_freqs[frame->version_idx][frame->freq_idx]; - frame->samples = mp3_samples[frame->version_idx][frame->layer - 1]; - frame->padding = mp3_paddings[frame->layer - 1][frame->padding_bit]; + { + const uint16_t samples = mp3_samples[frame->version_idx][frame->layer - 1]; + frame->bitrate = mp3_bitrates[frame->version_idx][frame->layer - 1][frame_header.bitrate_idx] * 1000; + frame->freq = mp3_freqs[frame->version_idx][frame_header.freq_idx]; - frame->size = frame->samples * (frame->bitrate / 8); - frame->size /= frame->freq; - frame->size += frame->padding; + frame->size = samples * (frame->bitrate / 8); + frame->size /= frame->freq; + /* Padding: only if padding_bit is set; 4 bytes for Layer 1 and 1 byte for others */ + frame->size += ( frame_header.padding_bit ? ( frame->layer == 1 ? 4 : 1 ) : 0 ); - frame->duration = 1000.0f * (double)frame->samples / (double)frame->freq; + frame->duration = 1000.0f * (double)samples / (double)frame->freq; + } lprintf("mpeg %d, layer %d\n", frame->version_idx + 1, frame->layer); lprintf("bitrate: %d bps, samplerate: %d Hz\n", frame->bitrate, frame->freq); lprintf("length: %d bytes, %f ms\n", frame->size, frame->duration); - lprintf("padding: %d bytes\n", frame->padding); + lprintf("padding: %d bytes\n", ( frame_header.padding_bit ? ( frame->layer == 1 ? 4 : 1 ) : 0 )); return 1; } @@ -294,7 +299,9 @@ static int parse_frame_header(mpg_audio_frame_t *frame, uint8_t *buf) { static xing_header_t* parse_xing_header(mpg_audio_frame_t *frame, uint8_t *buf, int bufsize) { +#ifdef LOG int i; +#endif uint8_t *ptr = buf; xing_header_t *xing; @@ -338,14 +345,12 @@ static xing_header_t* parse_xing_header(mpg_audio_frame_t *frame, lprintf("toc found\n"); if (ptr >= (buf + bufsize - XING_TOC_LENGTH)) return 0; - for (i = 0; i < XING_TOC_LENGTH; i++) { - xing->toc[i] = *(ptr + i); + memcpy(xing->toc, ptr, XING_TOC_LENGTH); #ifdef LOG - printf("%d ", xing->toc[i]); -#endif + for (i = 0; i < XING_TOC_LENGTH; i++) { + lprintf("%d ", xing->toc[i]); } -#ifdef LOG - printf("\n"); + lprintf("\n"); #endif ptr += XING_TOC_LENGTH; } -- cgit v1.2.3 From 25ab6844cf166b2549889796edbfd4950a1a795a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 16:21:48 +0000 Subject: Bitrate has to be 32-bit, or it overruns. CVS patchset: 8756 CVS date: 2007/03/29 16:21:48 --- src/demuxers/demux_mpgaudio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 29a0de95b..a60c14271 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpgaudio.c,v 1.154 2007/03/29 16:01:30 dgp85 Exp $ + * $Id: demux_mpgaudio.c,v 1.155 2007/03/29 16:21:48 dgp85 Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -38,9 +38,9 @@ #define LOG_MODULE "demux_mpeg_audio" #define LOG_VERBOSE -/* + #define LOG -*/ + #include "xine_internal.h" #include "xineutils.h" #include "demux.h" @@ -81,8 +81,8 @@ typedef struct { /* header */ double duration; uint32_t size; /* in bytes */ + uint32_t bitrate; /* in bit per second */ uint16_t freq; /* in Hz */ - uint16_t bitrate; /* in bit per second */ uint8_t layer; -- cgit v1.2.3 From 9ee932c7454a766ff430f122328e09120ba479dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 16:32:12 +0000 Subject: Disable logging that I've left enabled by mistake. CVS patchset: 8757 CVS date: 2007/03/29 16:32:12 --- src/demuxers/demux_mpgaudio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index a60c14271..31b2d33ff 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpgaudio.c,v 1.155 2007/03/29 16:21:48 dgp85 Exp $ + * $Id: demux_mpgaudio.c,v 1.156 2007/03/29 16:32:12 dgp85 Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -38,9 +38,9 @@ #define LOG_MODULE "demux_mpeg_audio" #define LOG_VERBOSE - +/* #define LOG - +*/ #include "xine_internal.h" #include "xineutils.h" #include "demux.h" -- cgit v1.2.3 From 311ab0560b4a7052f60ed7db632a6bc226f10c6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 16:46:23 +0000 Subject: Reorder demux_tta_t structure so that all the important pointers and variables fall into the same cacheline, while the header can simply remain on a different one, as it's needed only at the begin of the encoding. CVS patchset: 8758 CVS date: 2007/03/29 16:46:23 --- src/demuxers/demux_tta.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index aec6becae..2e4808b9c 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -20,7 +20,7 @@ * True Audio demuxer by Diego Pettenò <flameeyes@gentoo.org> * Inspired by tta libavformat demuxer by Alex Beregszaszi * - * $Id: demux_tta.c,v 1.3 2007/02/25 18:04:57 dgp85 Exp $ + * $Id: demux_tta.c,v 1.4 2007/03/29 16:46:23 dgp85 Exp $ */ #define LOG_MODULE "demux_tta" @@ -40,6 +40,11 @@ typedef struct { fifo_buffer_t *video_fifo; fifo_buffer_t *audio_fifo; input_plugin_t *input; + + uint32_t *seektable; + uint32_t totalframes; + uint32_t currentframe; + int status; union { @@ -54,10 +59,6 @@ typedef struct { } __attribute__((__packed__)) tta; uint8_t buffer[22]; /* This is the size of the header */ } header; - - uint32_t totalframes; - uint32_t currentframe; - uint32_t *seektable; } demux_tta_t; typedef struct { -- cgit v1.2.3 From 430e79b7287e00a0fa69700f745c4c87e46c66a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 16:52:23 +0000 Subject: Move streaminfo at the end of the structure to avoid padding. CVS patchset: 8759 CVS date: 2007/03/29 16:52:23 --- src/demuxers/demux_flac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c index c9e3f911a..f52da4d03 100644 --- a/src/demuxers/demux_flac.c +++ b/src/demuxers/demux_flac.c @@ -23,7 +23,7 @@ * For more information on the FLAC file format, visit: * http://flac.sourceforge.net/ * - * $Id: demux_flac.c,v 1.16 2007/03/03 01:41:16 dgp85 Exp $ + * $Id: demux_flac.c,v 1.17 2007/03/29 16:52:23 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -67,10 +67,10 @@ typedef struct { off_t data_start; off_t data_size; - unsigned char streaminfo[sizeof(xine_waveformatex) + FLAC_STREAMINFO_SIZE]; flac_seekpoint_t *seekpoints; int seekpoint_count; + unsigned char streaminfo[sizeof(xine_waveformatex) + FLAC_STREAMINFO_SIZE]; } demux_flac_t; typedef struct { -- cgit v1.2.3 From 0c747c320b563bd6c9489d1cfd1a9b24a0d94d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 17:00:32 +0000 Subject: Remove unused bytes_per_sec attribute on demux_ra_t. Move block_align and make seek_flag a 1-bit field. This reduces as much as possible the padding. Note that block_align should remain on the same cacheline as the fifo pointers, as it's used at every chunk, while the rest of the fields are used only when seeking. CVS patchset: 8760 CVS date: 2007/03/29 17:00:32 --- src/demuxers/demux_realaudio.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_realaudio.c b/src/demuxers/demux_realaudio.c index 0b692f185..bf8de0dad 100644 --- a/src/demuxers/demux_realaudio.c +++ b/src/demuxers/demux_realaudio.c @@ -22,7 +22,7 @@ * RealAudio File Demuxer by Mike Melanson (melanson@pcisys.net) * improved by James Stembridge (jstembridge@users.sourceforge.net) * - * $Id: demux_realaudio.c,v 1.33 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_realaudio.c,v 1.34 2007/03/29 17:00:32 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -57,16 +57,15 @@ typedef struct { unsigned int fourcc; unsigned int audio_type; + unsigned short block_align; + + uint8_t seek_flag:1; /* this is set when a seek just occurred */ + off_t data_start; off_t data_size; - unsigned short block_align; - unsigned int bytes_per_sec; - unsigned char *header; unsigned int header_size; - - int seek_flag; /* this is set when a seek just occurred */ } demux_ra_t; typedef struct { @@ -316,10 +315,7 @@ static int demux_ra_get_status (demux_plugin_t *this_gen) { static int demux_ra_get_stream_length (demux_plugin_t *this_gen) { demux_ra_t *this = (demux_ra_t *) this_gen; - if(this->bytes_per_sec) - return (int)((int64_t) this->data_size * 1000 / this->bytes_per_sec); - else - return 0; + return 0; } static uint32_t demux_ra_get_capabilities(demux_plugin_t *this_gen) { -- cgit v1.2.3 From 7f36eacc6f98f07d9a5eacc1eb3fd2d78668534a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 17:03:06 +0000 Subject: Reorder fields to remove a 4+4 bytes holes. CVS patchset: 8761 CVS date: 2007/03/29 17:03:06 --- src/demuxers/demux_nsf.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_nsf.c b/src/demuxers/demux_nsf.c index f5c42238f..7408274d5 100644 --- a/src/demuxers/demux_nsf.c +++ b/src/demuxers/demux_nsf.c @@ -30,7 +30,7 @@ * For more information regarding the NSF format, visit: * http://www.tripoint.org/kevtris/nes/nsfspec.txt * - * $Id: demux_nsf.c,v 1.23 2007/01/19 00:26:40 dgp85 Exp $ + * $Id: demux_nsf.c,v 1.24 2007/03/29 17:03:06 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -71,12 +71,14 @@ typedef struct { input_plugin_t *input; int status; - char *title; - char *artist; - char *copyright; int total_songs; int current_song; int new_song; /* indicates song change */ + + char *title; + char *artist; + char *copyright; + off_t filesize; int64_t current_pts; -- cgit v1.2.3 From 5e2c7a341772e55867b5a096cf0520339fb1c86d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 17:11:36 +0000 Subject: A little more reodering, and convert a few more fields to 1-bit flags. CVS patchset: 8762 CVS date: 2007/03/29 17:11:36 --- src/demuxers/demux_mpeg_pes.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c index 486b220f8..c5769e3e3 100644 --- a/src/demuxers/demux_mpeg_pes.c +++ b/src/demuxers/demux_mpeg_pes.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpeg_pes.c,v 1.42 2007/03/26 21:18:52 dgp85 Exp $ + * $Id: demux_mpeg_pes.c,v 1.43 2007/03/29 17:11:36 dgp85 Exp $ * * demultiplexer for mpeg 2 PES (Packetized Elementary Streams) * reads streams of variable blocksizes @@ -81,21 +81,23 @@ typedef struct demux_mpeg_pes_s { int64_t nav_last_end_pts; int64_t nav_last_start_pts; int64_t last_pts[2]; - int send_newpts; - int preview_mode; - int buf_flag_seek; int64_t scr; uint32_t packet_len; + uint32_t stream_id; + int64_t pts; int64_t dts; - uint32_t stream_id; + + uint8_t send_newpts:1; + uint8_t buf_flag_seek:1; + uint8_t preview_mode:1; uint8_t mpeg1:1; uint8_t wait_for_program_stream_pack_header:1; uint8_t mpeg12_h264_detected:2; + int last_begin_time; int64_t last_cell_time; off_t last_cell_pos; - int last_begin_time; uint8_t preview_data[ MAX_PREVIEW_SIZE ]; off_t preview_size, preview_done; -- cgit v1.2.3 From 12865d9947dbf9a0ecc91447032795558610e213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 17:31:43 +0000 Subject: Allocate chunk_buffer when initialising the parser, rather than having it inline the ff_video_decoder_t struct. CVS patchset: 8763 CVS date: 2007/03/29 17:31:43 --- src/libffmpeg/mpeg_parser.c | 3 ++- src/libffmpeg/mpeg_parser.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/libffmpeg/mpeg_parser.c b/src/libffmpeg/mpeg_parser.c index d9ee602b2..4ac6f0780 100644 --- a/src/libffmpeg/mpeg_parser.c +++ b/src/libffmpeg/mpeg_parser.c @@ -20,7 +20,7 @@ * Simple MPEG-ES parser/framer by Thibaut Mattern (tmattern@noos.fr) * based on libmpeg2 decoder. * - * $Id: mpeg_parser.c,v 1.4 2006/09/26 01:19:31 dgp85 Exp $ + * $Id: mpeg_parser.c,v 1.5 2007/03/29 17:31:43 dgp85 Exp $ */ #define LOG_MODULE "mpeg_parser" #define LOG_VERBOSE @@ -52,6 +52,7 @@ static const int frame_rate_tab[][2] = { void mpeg_parser_init (mpeg_parser_t *parser) { + parser->chunk_buffer = xine_xmalloc(BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); mpeg_parser_reset(parser); } diff --git a/src/libffmpeg/mpeg_parser.h b/src/libffmpeg/mpeg_parser.h index 9cc12f380..449130c92 100644 --- a/src/libffmpeg/mpeg_parser.h +++ b/src/libffmpeg/mpeg_parser.h @@ -20,7 +20,7 @@ * Simple MPEG-ES parser/framer by Thibaut Mattern (tmattern@noos.fr) * based on libmpeg2 decoder. * - * $Id: mpeg_parser.h,v 1.2 2004/09/21 19:27:18 tmattern Exp $ + * $Id: mpeg_parser.h,v 1.3 2007/03/29 17:31:43 dgp85 Exp $ */ #ifndef HAVE_MPEG_PARSER_H #define HAVE_MPEG_PARSER_H @@ -39,7 +39,7 @@ typedef struct mpeg_parser_s { uint32_t shift; int is_sequence_needed; - uint8_t chunk_buffer[BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; + uint8_t *chunk_buffer; uint8_t *chunk_ptr; uint8_t *chunk_start; int buffer_size; -- cgit v1.2.3 From 3d11a3233eb1f20705787b3fd663acd8661f5276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 17:48:34 +0000 Subject: Collapse seven integers used as boolean into 1-bit fields. Helps also reducing the holes. CVS patchset: 8764 CVS date: 2007/03/29 17:48:34 --- src/libffmpeg/video_decoder.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/libffmpeg/video_decoder.c b/src/libffmpeg/video_decoder.c index ddab37264..b47c6c59f 100644 --- a/src/libffmpeg/video_decoder.c +++ b/src/libffmpeg/video_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_decoder.c,v 1.70 2007/03/03 13:33:34 dgp85 Exp $ + * $Id: video_decoder.c,v 1.71 2007/03/29 17:48:34 dgp85 Exp $ * * xine video decoder plugin using ffmpeg * @@ -79,8 +79,14 @@ struct ff_video_decoder_s { xine_stream_t *stream; int64_t pts; int video_step; - int decoder_ok; - int decoder_init_mode; + + uint8_t decoder_ok:1; + uint8_t decoder_init_mode:1; + uint8_t is_mpeg12:1; + uint8_t pp_available:1; + uint8_t yuv_init:1; + uint8_t is_direct_rendering_disabled:1; + uint8_t cs_convert_init:1; xine_bmiheader bih; unsigned char *buf; @@ -94,7 +100,6 @@ struct ff_video_decoder_s { AVCodecContext *context; AVCodec *codec; - int pp_available; int pp_quality; int pp_flags; pp_context_t *pp_context; @@ -102,7 +107,6 @@ struct ff_video_decoder_s { /* mpeg-es parsing */ mpeg_parser_t mpeg_parser; - int is_mpeg12; double aspect_ratio; int aspect_ratio_prio; @@ -111,10 +115,6 @@ struct ff_video_decoder_s { int output_format; yuv_planes_t yuv; - int yuv_init; - - int cs_convert_init; - int is_direct_rendering_disabled; AVPaletteControl palette_control; -- cgit v1.2.3 From 13f031f44d75faabcdf21cf75ab08c8d66c61b5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 17:59:35 +0000 Subject: Add a dispose function to clean the allocated buffer. CVS patchset: 8765 CVS date: 2007/03/29 17:59:35 --- src/libffmpeg/mpeg_parser.c | 9 ++++++++- src/libffmpeg/mpeg_parser.h | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libffmpeg/mpeg_parser.c b/src/libffmpeg/mpeg_parser.c index 4ac6f0780..3c0370cfa 100644 --- a/src/libffmpeg/mpeg_parser.c +++ b/src/libffmpeg/mpeg_parser.c @@ -20,7 +20,7 @@ * Simple MPEG-ES parser/framer by Thibaut Mattern (tmattern@noos.fr) * based on libmpeg2 decoder. * - * $Id: mpeg_parser.c,v 1.5 2007/03/29 17:31:43 dgp85 Exp $ + * $Id: mpeg_parser.c,v 1.6 2007/03/29 17:59:35 dgp85 Exp $ */ #define LOG_MODULE "mpeg_parser" #define LOG_VERBOSE @@ -56,6 +56,13 @@ void mpeg_parser_init (mpeg_parser_t *parser) mpeg_parser_reset(parser); } +void mpeg_parser_dispose (mpeg_parser_t *parser) +{ + if ( parser == NULL ) return; + + free(parser->chunk_buffer); +} + void mpeg_parser_reset (mpeg_parser_t *parser) { parser->shift = 0xffffff00; diff --git a/src/libffmpeg/mpeg_parser.h b/src/libffmpeg/mpeg_parser.h index 449130c92..0b93b21e0 100644 --- a/src/libffmpeg/mpeg_parser.h +++ b/src/libffmpeg/mpeg_parser.h @@ -20,7 +20,7 @@ * Simple MPEG-ES parser/framer by Thibaut Mattern (tmattern@noos.fr) * based on libmpeg2 decoder. * - * $Id: mpeg_parser.h,v 1.3 2007/03/29 17:31:43 dgp85 Exp $ + * $Id: mpeg_parser.h,v 1.4 2007/03/29 17:59:35 dgp85 Exp $ */ #ifndef HAVE_MPEG_PARSER_H #define HAVE_MPEG_PARSER_H @@ -62,6 +62,9 @@ typedef struct mpeg_parser_s { /* parser initialization */ void mpeg_parser_init (mpeg_parser_t *parser); +/* parser disposal */ +void mpeg_parser_dispose (mpeg_parser_t *parser); + /* read a frame * return a pointer to the first byte of the next frame * or NULL if more bytes are needed -- cgit v1.2.3 From 6afd42f5c2fc8272cd1308584c6f794f91a07c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 18:00:23 +0000 Subject: Create and initialise the mpeg parser only when actually needed, and dispose it on instance disposal. CVS patchset: 8766 CVS date: 2007/03/29 18:00:23 --- src/libffmpeg/video_decoder.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/libffmpeg/video_decoder.c b/src/libffmpeg/video_decoder.c index b47c6c59f..8cbc38eb9 100644 --- a/src/libffmpeg/video_decoder.c +++ b/src/libffmpeg/video_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_decoder.c,v 1.71 2007/03/29 17:48:34 dgp85 Exp $ + * $Id: video_decoder.c,v 1.72 2007/03/29 18:00:23 dgp85 Exp $ * * xine video decoder plugin using ffmpeg * @@ -106,7 +106,7 @@ struct ff_video_decoder_s { pp_mode_t *pp_mode; /* mpeg-es parsing */ - mpeg_parser_t mpeg_parser; + mpeg_parser_t *mpeg_parser; double aspect_ratio; int aspect_ratio_prio; @@ -523,7 +523,7 @@ static int ff_handle_mpeg_sequence(ff_video_decoder_t *this, mpeg_parser_t *pars data.pan_scan = 0; xine_event_send(this->stream, &event); } - this->video_step = this->mpeg_parser.frame_duration; + this->video_step = this->mpeg_parser->frame_duration; return 1; } @@ -826,8 +826,14 @@ static void ff_handle_preview_buffer (ff_video_decoder_t *this, buf_element_t *b lprintf ("preview buffer\n"); codec_type = buf->type & 0xFFFF0000; - if (codec_type == BUF_VIDEO_MPEG) + if (codec_type == BUF_VIDEO_MPEG) { this->is_mpeg12 = 1; + if ( this->mpeg_parser == NULL ) { + this->mpeg_parser = xine_xmalloc(sizeof(mpeg_parser_t)); + mpeg_parser_init(this->mpeg_parser); + this->decoder_init_mode = 0; + } + } if (this->decoder_init_mode && !this->is_mpeg12) { init_video_codec(this, codec_type); @@ -980,7 +986,7 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_t *this, buf_element_t *bu got_picture = 0; if (!flush) { - current = mpeg_parser_decode_data(&this->mpeg_parser, + current = mpeg_parser_decode_data(this->mpeg_parser, buf->content + offset, buf->content + offset + size, &next_flush); } else { @@ -992,8 +998,8 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_t *this, buf_element_t *bu return; } - if (this->mpeg_parser.has_sequence) { - ff_handle_mpeg_sequence(this, &this->mpeg_parser); + if (this->mpeg_parser->has_sequence) { + ff_handle_mpeg_sequence(this, this->mpeg_parser); } if (!this->decoder_ok) @@ -1002,16 +1008,16 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_t *this, buf_element_t *bu if (flush) { lprintf("flush lavc buffers\n"); /* hack: ffmpeg outputs the last frame if size=0 */ - this->mpeg_parser.buffer_size = 0; + this->mpeg_parser->buffer_size = 0; } /* skip decoding b frames if too late */ this->context->hurry_up = (this->skipframes > 0); - lprintf("avcodec_decode_video: size=%d\n", this->mpeg_parser.buffer_size); + lprintf("avcodec_decode_video: size=%d\n", this->mpeg_parser->buffer_size); len = avcodec_decode_video (this->context, this->av_frame, - &got_picture, this->mpeg_parser.chunk_buffer, - this->mpeg_parser.buffer_size); + &got_picture, this->mpeg_parser->chunk_buffer, + this->mpeg_parser->buffer_size); lprintf("avcodec_decode_video: decoded_size=%d, got_picture=%d\n", len, got_picture); len = current - buf->content - offset; @@ -1364,7 +1370,7 @@ static void ff_reset (video_decoder_t *this_gen) { avcodec_flush_buffers(this->context); if (this->is_mpeg12) - mpeg_parser_reset(&this->mpeg_parser); + mpeg_parser_reset(this->mpeg_parser); } static void ff_discontinuity (video_decoder_t *this_gen) { @@ -1423,6 +1429,8 @@ static void ff_dispose (video_decoder_t *this_gen) { if(this->pp_mode) pp_free_mode(this->pp_mode); + + mpeg_parser_dispose(this->mpeg_parser); xine_list_delete(this->dr1_frames); @@ -1464,9 +1472,9 @@ static video_decoder_t *ff_video_open_plugin (video_decoder_class_t *class_gen, this->pp_context = NULL; this->pp_mode = NULL; - this->dr1_frames = xine_list_new(); + this->mpeg_parser = NULL; - mpeg_parser_init(&this->mpeg_parser); + this->dr1_frames = xine_list_new(); return &this->video_decoder; } -- cgit v1.2.3 From ff8a10b32cb82ad28a772cc3a0c448032936445c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 18:41:02 +0000 Subject: A little more reordering sparing a 4 bytes hole. CVS patchset: 8768 CVS date: 2007/03/29 18:41:02 --- src/libffmpeg/video_decoder.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/libffmpeg/video_decoder.c b/src/libffmpeg/video_decoder.c index 8cbc38eb9..38cf160c5 100644 --- a/src/libffmpeg/video_decoder.c +++ b/src/libffmpeg/video_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_decoder.c,v 1.72 2007/03/29 18:00:23 dgp85 Exp $ + * $Id: video_decoder.c,v 1.73 2007/03/29 18:41:02 dgp85 Exp $ * * xine video decoder plugin using ffmpeg * @@ -114,11 +114,12 @@ struct ff_video_decoder_s { int crop_right, crop_bottom; int output_format; + + xine_list_t *dr1_frames; + yuv_planes_t yuv; AVPaletteControl palette_control; - - xine_list_t *dr1_frames; }; -- cgit v1.2.3 From 71e00d9d010f9b6a9cfd531efb87f7757859833b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 18:52:45 +0000 Subject: Reorder fields, use a bitmask to reduce the size, and change width and height to uint16_t (they are read as 12-bit values). CVS patchset: 8769 CVS date: 2007/03/29 18:52:45 --- src/libffmpeg/mpeg_parser.c | 5 ++--- src/libffmpeg/mpeg_parser.h | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/libffmpeg/mpeg_parser.c b/src/libffmpeg/mpeg_parser.c index 3c0370cfa..14a08a456 100644 --- a/src/libffmpeg/mpeg_parser.c +++ b/src/libffmpeg/mpeg_parser.c @@ -20,7 +20,7 @@ * Simple MPEG-ES parser/framer by Thibaut Mattern (tmattern@noos.fr) * based on libmpeg2 decoder. * - * $Id: mpeg_parser.c,v 1.6 2007/03/29 17:59:35 dgp85 Exp $ + * $Id: mpeg_parser.c,v 1.7 2007/03/29 18:52:45 dgp85 Exp $ */ #define LOG_MODULE "mpeg_parser" #define LOG_VERBOSE @@ -170,8 +170,7 @@ static int parse_chunk (mpeg_parser_t *parser, int code, uint8_t *buffer, int le case 0xb3: /* sequence_header_code */ { int value; - int width; - int height; + uint16_t width, height; if (parser->is_sequence_needed) { parser->is_sequence_needed = 0; diff --git a/src/libffmpeg/mpeg_parser.h b/src/libffmpeg/mpeg_parser.h index 0b93b21e0..859a0fcec 100644 --- a/src/libffmpeg/mpeg_parser.h +++ b/src/libffmpeg/mpeg_parser.h @@ -20,7 +20,7 @@ * Simple MPEG-ES parser/framer by Thibaut Mattern (tmattern@noos.fr) * based on libmpeg2 decoder. * - * $Id: mpeg_parser.h,v 1.4 2007/03/29 17:59:35 dgp85 Exp $ + * $Id: mpeg_parser.h,v 1.5 2007/03/29 18:52:45 dgp85 Exp $ */ #ifndef HAVE_MPEG_PARSER_H #define HAVE_MPEG_PARSER_H @@ -37,23 +37,26 @@ #define D_TYPE 4 typedef struct mpeg_parser_s { - uint32_t shift; - int is_sequence_needed; uint8_t *chunk_buffer; uint8_t *chunk_ptr; uint8_t *chunk_start; + uint32_t shift; int buffer_size; uint8_t code; uint8_t picture_coding_type; - int rate_code; + + uint8_t is_sequence_needed:1; + uint8_t is_mpeg1:1; /* public */ + uint8_t has_sequence:1; /* public */ + uint8_t in_slice:1; + + uint8_t rate_code:4; + int aspect_ratio_info; - int in_slice; /* public properties */ - int is_mpeg1; - int has_sequence; - int width; - int height; + uint16_t width; + uint16_t height; int frame_duration; double frame_aspect_ratio; -- cgit v1.2.3 From 435aa8dea95582b9c35cdfafe803e23b72322747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 18:58:21 +0000 Subject: Reorder to fill hole. CVS patchset: 8770 CVS date: 2007/03/29 18:58:21 --- src/video_out/video_out_xcbxv.c | 4 ++-- src/video_out/video_out_xv.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/video_out/video_out_xcbxv.c b/src/video_out/video_out_xcbxv.c index 52fd0fb6c..db4be14fa 100644 --- a/src/video_out/video_out_xcbxv.c +++ b/src/video_out/video_out_xcbxv.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xcbxv.c,v 1.5 2007/03/25 23:13:53 dgp85 Exp $ + * $Id: video_out_xcbxv.c,v 1.6 2007/03/29 18:58:21 dgp85 Exp $ * * video_out_xcbxv.c, X11 video extension interface for xine * @@ -123,8 +123,8 @@ struct xv_driver_s { int use_shm; int use_pitch_alignment; - xv_property_t props[VO_NUM_PROPERTIES]; uint32_t capabilities; + xv_property_t props[VO_NUM_PROPERTIES]; xv_frame_t *recent_frames[VO_NUM_RECENT_FRAMES]; xv_frame_t *cur_frame; diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index 19b57bc27..55340a9e7 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xv.c,v 1.223 2007/03/25 23:13:53 dgp85 Exp $ + * $Id: video_out_xv.c,v 1.224 2007/03/29 19:01:03 dgp85 Exp $ * * video_out_xv.c, X11 video extension interface for xine * @@ -130,10 +130,10 @@ struct xv_driver_s { xv_property_t props[VO_NUM_PROPERTIES]; uint32_t capabilities; + int ovl_changed; xv_frame_t *recent_frames[VO_NUM_RECENT_FRAMES]; xv_frame_t *cur_frame; x11osd *xoverlay; - int ovl_changed; /* all scaling information goes here */ vo_scale_t sc; -- cgit v1.2.3 From b4f1f6e878c5a11bdc3c11425399a251d2ab66ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 19:07:00 +0000 Subject: Reorder a few fields to, well, fill some holes. CVS patchset: 8771 CVS date: 2007/03/29 19:07:00 --- src/demuxers/demux_avi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index 86af5eec5..71f5ac888 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_avi.c,v 1.230 2007/02/20 00:34:55 dgp85 Exp $ + * $Id: demux_avi.c,v 1.231 2007/03/29 19:07:00 dgp85 Exp $ * * demultiplexer for avi streams * @@ -194,8 +194,8 @@ typedef struct{ uint32_t audio_posb; /* Audio position: byte within chunk */ + int wavex_len; xine_waveformatex *wavex; - int wavex_len; audio_index_t audio_idx; @@ -251,13 +251,13 @@ typedef struct demux_avi_s { input_plugin_t *input; int status; - avi_t *avi; - int no_audio; uint32_t video_step; uint32_t AVI_errno; + avi_t *avi; + idx_grow_t idx_grow; int streaming; -- cgit v1.2.3 From f5bb625b3f4d6375027a2e9446feccb887487820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 19:24:18 +0000 Subject: Reorder fields and make use of a bitmask for boolean flags. CVS patchset: 8772 CVS date: 2007/03/29 19:24:18 --- src/demuxers/demux_avi.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index 71f5ac888..fe324c2f4 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_avi.c,v 1.231 2007/03/29 19:07:00 dgp85 Exp $ + * $Id: demux_avi.c,v 1.232 2007/03/29 19:24:18 dgp85 Exp $ * * demultiplexer for avi streams * @@ -251,28 +251,27 @@ typedef struct demux_avi_s { input_plugin_t *input; int status; - int no_audio; - uint32_t video_step; uint32_t AVI_errno; + /* seeking args backup */ + int seek_start_time; + off_t seek_start_pos; + avi_t *avi; idx_grow_t idx_grow; - int streaming; - int last_index_entry_type; - int has_index; - - /* seeking args backup */ - int seek_request; - off_t seek_start_pos; - int seek_start_time; + uint8_t no_audio:1; + + uint8_t streaming:1; + uint8_t has_index:1; + + uint8_t seek_request:1; /* discontinuity detection (only at seek) */ - int send_newpts; - int buf_flag_seek; - + uint8_t buf_flag_seek:1; + uint8_t send_newpts:1; } demux_avi_t ; typedef struct { -- cgit v1.2.3 From ad4d2c7452061fd2c7ef6d73c3ebd48546fb1f0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 19:38:51 +0000 Subject: More reordering to reduce padding. CVS patchset: 8773 CVS date: 2007/03/29 19:38:51 --- src/demuxers/demux_ogg.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index f35ce7935..f868018af 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_ogg.c,v 1.176 2007/02/20 00:34:56 dgp85 Exp $ + * $Id: demux_ogg.c,v 1.177 2007/03/29 19:38:51 dgp85 Exp $ * * demultiplexer for ogg streams * @@ -126,17 +126,20 @@ typedef struct demux_ogg_s { input_plugin_t *input; int status; + int frame_duration; + #ifdef HAVE_THEORA theora_info t_info; theora_comment t_comment; #endif - int frame_duration; - ogg_sync_state oy; ogg_page og; int64_t start_pts; + int64_t last_pts[2]; + + int time_length; int num_streams; stream_info_t *si[MAX_STREAMS]; /* stream info */ @@ -148,16 +151,14 @@ typedef struct demux_ogg_s { off_t avg_bitrate; - int64_t last_pts[2]; - int send_newpts; - int buf_flag_seek; - int keyframe_needed; - int ignore_keyframes; - int time_length; - char *title; chapter_info_t *chapter_info; xine_event_queue_t *event_queue; + + uint8_t send_newpts:1; + uint8_t buf_flag_seek:1; + uint8_t keyframe_needed:1; + uint8_t ignore_keyframes:1; } demux_ogg_t ; typedef struct { -- cgit v1.2.3 From de8b70199d639a9d33a1a9efc3aecc8f705f88ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Thu, 29 Mar 2007 19:45:33 +0000 Subject: Reorder fields to fill hole. CVS patchset: 8774 CVS date: 2007/03/29 19:45:33 --- src/combined/decoder_wavpack.c | 9 +++++---- src/input/input_file.c | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/combined/decoder_wavpack.c b/src/combined/decoder_wavpack.c index 1d51ecd1d..ec14dfbf5 100644 --- a/src/combined/decoder_wavpack.c +++ b/src/combined/decoder_wavpack.c @@ -19,7 +19,7 @@ * * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> * - * $Id: decoder_wavpack.c,v 1.13 2007/03/17 07:34:02 dgp85 Exp $ + * $Id: decoder_wavpack.c,v 1.14 2007/03/29 19:45:33 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -45,15 +45,16 @@ typedef struct { xine_stream_t *stream; + uint8_t *buf; + size_t buf_size; + size_t buf_pos; + int sample_rate; uint16_t bits_per_sample:6; uint16_t channels:4; uint16_t output_open:1; - uint8_t *buf; - size_t buf_size; - size_t buf_pos; } wavpack_decoder_t; /* Wrapper functions for Wavpack */ diff --git a/src/input/input_file.c b/src/input/input_file.c index 567a41c9f..fd2b0e733 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_file.c,v 1.121 2007/02/25 18:04:08 dgp85 Exp $ + * $Id: input_file.c,v 1.122 2007/03/29 19:47:17 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -66,8 +66,8 @@ typedef struct { xine_t *xine; config_values_t *config; - int show_hidden_files; char *origin_path; + int show_hidden_files; int mrls_allocated_entries; xine_mrl_t **mrls; -- cgit v1.2.3 From d69b1376b70acc5b721e2bea1cb8a92cb97b8735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 31 Mar 2007 20:58:51 +0000 Subject: Add a mutex on all PulseAudio operations, PA is thread-safe by itself, but xine's plugin wasn't, this caused race conditions similar to the old ones with ALSA output. Also instead of copying two pointers (three with the mutex) from the class to the output instance, just copy a pointer to the class. CVS patchset: 8775 CVS date: 2007/03/31 20:58:51 --- src/audio_out/audio_pulse_out.c | 145 +++++++++++++++++++++++----------------- 1 file changed, 82 insertions(+), 63 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c index 214ad9725..5fa945f3d 100644 --- a/src/audio_out/audio_pulse_out.c +++ b/src/audio_out/audio_pulse_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_pulse_out.c,v 1.12 2007/03/17 20:57:59 dgp85 Exp $ + * $Id: audio_pulse_out.c,v 1.13 2007/03/31 20:58:51 dgp85 Exp $ * * ao plugin for pulseaudio (rename of polypaudio): * http://0pointer.de/lennart/projects/pulsaudio/ @@ -54,54 +54,40 @@ /* CHECKME: should this be conditional on autotools? */ extern const char *__progname; -typedef struct pulse_driver_s { - - ao_driver_t ao_driver; - - xine_t *xine; - - /** The host to connect to */ - char *host; +typedef struct { + audio_driver_class_t driver_class; + xine_t *xine; - /** The sink to connect to */ - char *sink; + pthread_mutex_t pa_mutex; /*< Mutex controlling PulseAudio access. */ + struct pa_context *context; /*< Pulseaudio connection context */ + struct pa_threaded_mainloop *mainloop; /*< Main event loop object */ +} pulse_class_t; - /** Pulseaudio playback stream object */ - struct pa_stream *stream; +typedef struct pulse_driver_s { + ao_driver_t ao_driver; + xine_t *xine; - /** Pulseaudio connection context */ - struct pa_context *context; + pulse_class_t *pa_class; - /** Main event loop object */ - struct pa_threaded_mainloop *mainloop; + char *host; /*< The host to connect to */ + char *sink; /*< The sink to connect to */ + struct pa_stream *stream; /*< Pulseaudio playback stream object */ - pa_volume_t swvolume; - pa_cvolume cvolume; + pa_volume_t swvolume; + pa_cvolume cvolume; - int capabilities; - int mode; + int capabilities; + int mode; - int32_t sample_rate; - uint32_t num_channels; - uint32_t bits_per_sample; - uint32_t bytes_per_frame; + int32_t sample_rate; + uint32_t num_channels; + uint32_t bits_per_sample; + uint32_t bytes_per_frame; - uint32_t frames_written; + uint32_t frames_written; } pulse_driver_t; -typedef struct { - audio_driver_class_t driver_class; - - xine_t *xine; - - /** Pulseaudio connection context */ - struct pa_context *context; - - /** Main event loop object */ - struct pa_threaded_mainloop *mainloop; -} pulse_class_t; - /** * @brief Callback function called when a stream operation succeed * @param stream Stream which operation has succeeded @@ -117,7 +103,7 @@ static void __xine_pa_stream_success_callback(pa_stream *const stream, const int _x_assert(stream); _x_assert(this); _x_assert(stream == this->stream); - pa_threaded_mainloop_signal(this->mainloop, 0); + pa_threaded_mainloop_signal(this->pa_class->mainloop, 0); } /** @@ -133,9 +119,9 @@ static void __xine_pa_context_success_callback(pa_context *const ctx, const int pulse_driver_t *const this = (pulse_driver_t*)this_gen; _x_assert(ctx); _x_assert(this); - _x_assert(ctx == this->context); + _x_assert(ctx == this->pa_class->context); - pa_threaded_mainloop_signal(this->mainloop, 0); + pa_threaded_mainloop_signal(this->pa_class->mainloop, 0); } /** @@ -156,7 +142,7 @@ static void __xine_pa_sink_info_callback(pa_context *const ctx, const pa_sink_in if (is_last < 0) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: Failed to get sink input info: %s\n", - pa_strerror(pa_context_errno(this->context))); + pa_strerror(pa_context_errno(this->pa_class->context))); return; } @@ -170,14 +156,14 @@ static void __xine_pa_sink_info_callback(pa_context *const ctx, const pa_sink_in static int wait_for_operation(pulse_driver_t *this, pa_operation *o) { - _x_assert(this && o && this->mainloop); + _x_assert(this && o && this->pa_class->mainloop); - pa_threaded_mainloop_lock(this->mainloop); + pa_threaded_mainloop_lock(this->pa_class->mainloop); while (pa_operation_get_state(o) == PA_OPERATION_RUNNING) - pa_threaded_mainloop_wait(this->mainloop); + pa_threaded_mainloop_wait(this->pa_class->mainloop); - pa_threaded_mainloop_unlock(this->mainloop); + pa_threaded_mainloop_unlock(this->pa_class->mainloop); return 0; } @@ -235,7 +221,7 @@ static int ao_pulse_open(ao_driver_t *this_gen, goto fail; } - this->stream = pa_stream_new(this->context, "audio stream", &ss, NULL); + this->stream = pa_stream_new(this->pa_class->context, "audio stream", &ss, NULL); _x_assert(this->stream); a.maxlength = pa_bytes_per_second(&ss)*1; @@ -256,7 +242,7 @@ static int ao_pulse_open(ao_driver_t *this_gen, if (streamstate != PA_STREAM_READY) { xprintf (this->xine, XINE_VERBOSITY_LOG, "audio_pulse_out: Failed to connect to server: %s\n", - pa_strerror(pa_context_errno(this->context))); + pa_strerror(pa_context_errno(this->pa_class->context))); goto fail; } this->frames_written = 0; @@ -293,7 +279,7 @@ static int ao_pulse_write(ao_driver_t *this_gen, int16_t *data, int size = num_frames * this->bytes_per_frame; int ret = 0; - _x_assert(this->stream && this->context); + _x_assert(this->stream && this->pa_class->context); if (pa_stream_get_state(this->stream) == PA_STREAM_READY) { @@ -332,7 +318,7 @@ static int ao_pulse_delay (ao_driver_t *this_gen) if (pa_stream_get_latency(this->stream, &latency, NULL) >= 0) break; - if (pa_context_errno(this->context) != PA_ERR_NODATA) { + if (pa_context_errno(this->pa_class->context) != PA_ERR_NODATA) { /* error */ } } @@ -351,11 +337,15 @@ static void ao_pulse_close(ao_driver_t *this_gen) pulse_driver_t *this = (pulse_driver_t *) this_gen; if (this->stream) { + pthread_mutex_lock(&this->pa_class->pa_mutex); + if (pa_stream_get_state(this->stream) == PA_STREAM_READY) wait_for_operation(this, pa_stream_drain(this->stream, __xine_pa_stream_success_callback, this)); pa_stream_disconnect(this->stream); pa_stream_unref(this->stream); this->stream = NULL; + + pthread_mutex_unlock(&this->pa_class->pa_mutex); } } @@ -377,12 +367,16 @@ static int ao_pulse_get_property (ao_driver_t *this_gen, int property) { switch(property) { case AO_PROP_PCM_VOL: case AO_PROP_MIXER_VOL: - if( this->stream && this->context ) + if( this->stream && this->pa_class->context ) { + pthread_mutex_lock(&this->pa_class->pa_mutex); wait_for_operation(this, - pa_context_get_sink_input_info(this->context, pa_stream_get_index(this->stream), + pa_context_get_sink_input_info(this->pa_class->context, pa_stream_get_index(this->stream), __xine_pa_sink_info_callback, this)); + pthread_mutex_unlock(&this->pa_class->pa_mutex); + } return (int) (pa_sw_volume_to_linear(this->swvolume)*100); break; + case AO_PROP_MUTE_VOL: break; } @@ -397,11 +391,13 @@ static int ao_pulse_set_property (ao_driver_t *this_gen, int property, int value case AO_PROP_PCM_VOL: case AO_PROP_MIXER_VOL: this->swvolume = pa_sw_volume_from_linear((double)value/100.0); - if( this->stream && this->context ) { + if( this->stream && this->pa_class->context ) { + pthread_mutex_lock(&this->pa_class->pa_mutex); pa_cvolume_set(&this->cvolume, pa_stream_get_sample_spec(this->stream)->channels, this->swvolume); wait_for_operation(this, - pa_context_set_sink_input_volume(this->context, pa_stream_get_index(this->stream), + pa_context_set_sink_input_volume(this->pa_class->context, pa_stream_get_index(this->stream), &this->cvolume, __xine_pa_context_success_callback, this)); + pthread_mutex_unlock(&this->pa_class->pa_mutex); } break; case AO_PROP_MUTE_VOL: @@ -417,13 +413,19 @@ static int ao_pulse_ctrl(ao_driver_t *this_gen, int cmd, ...) { switch (cmd) { case AO_CTRL_PLAY_PAUSE: - _x_assert(this->stream && this->context ); + _x_assert(this->stream && this->pa_class->context ); + + pthread_mutex_lock(&this->pa_class->pa_mutex); if(pa_stream_get_state(this->stream) == PA_STREAM_READY) wait_for_operation(this,pa_stream_cork(this->stream, 1, __xine_pa_stream_success_callback, this)); + pthread_mutex_unlock(&this->pa_class->pa_mutex); + break; case AO_CTRL_PLAY_RESUME: - _x_assert(this->stream && this->context); + _x_assert(this->stream && this->pa_class->context); + + pthread_mutex_lock(&this->pa_class->pa_mutex); if(pa_stream_get_state(this->stream) == PA_STREAM_READY) { struct pa_operation *o2, *o1; o1 = pa_stream_prebuf(this->stream, __xine_pa_stream_success_callback, this); @@ -432,13 +434,20 @@ static int ao_pulse_ctrl(ao_driver_t *this_gen, int cmd, ...) { o2 = pa_stream_cork(this->stream, 0, __xine_pa_stream_success_callback, this); _x_assert(o2); wait_for_operation(this,o2); } + pthread_mutex_unlock(&this->pa_class->pa_mutex); + break; case AO_CTRL_FLUSH_BUFFERS: - _x_assert(this->stream && this->context); + _x_assert(this->stream && this->pa_class->context); + + pthread_mutex_lock(&this->pa_class->pa_mutex); if(pa_stream_get_state(this->stream) == PA_STREAM_READY) wait_for_operation(this,pa_stream_flush(this->stream, __xine_pa_stream_success_callback, this)); + pthread_mutex_unlock(&this->pa_class->pa_mutex); + this->frames_written = 0; + break; } @@ -510,28 +519,30 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da xprintf (class->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: host %s sink %s\n", this->host ? this->host : "(null)", this->sink ? this->sink : "(null)"); - this->mainloop = class->mainloop; - this->context = class->context; + this->pa_class = class; - if ( pa_context_get_state(this->context) != PA_CONTEXT_READY ){ - pa_context_connect(this->context, this->host, 1, NULL); + pthread_mutex_lock(&this->pa_class->pa_mutex); + if ( pa_context_get_state(this->pa_class->context) != PA_CONTEXT_READY ){ + pa_context_connect(this->pa_class->context, this->host, 1, NULL); do { xine_usec_sleep (100); - ctxstate = pa_context_get_state(this->context); + ctxstate = pa_context_get_state(this->pa_class->context); } while (ctxstate < PA_CONTEXT_READY); if (ctxstate != PA_CONTEXT_READY) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: Failed to connect to server: %s\n", - pa_strerror(pa_context_errno(this->context))); + pa_strerror(pa_context_errno(this->pa_class->context))); goto fail; } } + pthread_mutex_unlock(&this->pa_class->pa_mutex); return &this->ao_driver; fail: + pthread_mutex_lock(&this->pa_class->pa_mutex); free(this); xprintf (class->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: open_plugin failed.\n"); return NULL; @@ -553,11 +564,14 @@ static void dispose_class (audio_driver_class_t *this_gen) { pulse_class_t *this = (pulse_class_t *) this_gen; + pthread_mutex_lock(&this->pa_mutex); + pa_context_unref(this->context); pa_threaded_mainloop_stop(this->mainloop); pa_threaded_mainloop_free(this->mainloop); + pthread_mutex_destroy(&this->pa_mutex); free (this); } @@ -578,6 +592,9 @@ static void *init_class (xine_t *xine, void *data) { this->xine = xine; + pthread_mutex_init(&this->pa_mutex, NULL); + pthread_mutex_lock(&this->pa_mutex); + this->mainloop = pa_threaded_mainloop_new(); _x_assert(this->mainloop); @@ -586,6 +603,8 @@ static void *init_class (xine_t *xine, void *data) { this->context = pa_context_new(pa_threaded_mainloop_get_api(this->mainloop), __progname); _x_assert(this->context); + pthread_mutex_unlock(&this->pa_mutex); + return this; } -- cgit v1.2.3 From a0c5680524d41ff0971b5cc2c7790ac32c15f800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 31 Mar 2007 21:16:22 +0000 Subject: Implement AO_PROP_MUTE_VOL (both set and get), and cleanup the setter and getter methods, returning the correct value in case the property is not implemented. CVS patchset: 8776 CVS date: 2007/03/31 21:16:22 --- src/audio_out/audio_pulse_out.c | 60 ++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c index 5fa945f3d..9221cbe5a 100644 --- a/src/audio_out/audio_pulse_out.c +++ b/src/audio_out/audio_pulse_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_pulse_out.c,v 1.13 2007/03/31 20:58:51 dgp85 Exp $ + * $Id: audio_pulse_out.c,v 1.14 2007/03/31 21:16:22 dgp85 Exp $ * * ao plugin for pulseaudio (rename of polypaudio): * http://0pointer.de/lennart/projects/pulsaudio/ @@ -363,48 +363,70 @@ static void ao_pulse_exit(ao_driver_t *this_gen) static int ao_pulse_get_property (ao_driver_t *this_gen, int property) { pulse_driver_t *this = (pulse_driver_t *) this_gen; + int result = 0; + if ( ! this->stream || ! this->pa_class->context ) + return 0; + + pthread_mutex_lock(&this->pa_class->pa_mutex); + switch(property) { case AO_PROP_PCM_VOL: case AO_PROP_MIXER_VOL: - if( this->stream && this->pa_class->context ) { - pthread_mutex_lock(&this->pa_class->pa_mutex); - wait_for_operation(this, - pa_context_get_sink_input_info(this->pa_class->context, pa_stream_get_index(this->stream), - __xine_pa_sink_info_callback, this)); - pthread_mutex_unlock(&this->pa_class->pa_mutex); - } - return (int) (pa_sw_volume_to_linear(this->swvolume)*100); + wait_for_operation(this, + pa_context_get_sink_input_info(this->pa_class->context, pa_stream_get_index(this->stream), + __xine_pa_sink_info_callback, this)); + result = (pa_sw_volume_to_linear(this->swvolume)*100); break; case AO_PROP_MUTE_VOL: + result = pa_cvolume_is_muted(&this->cvolume); break; } - return 0; + pthread_mutex_unlock(&this->pa_class->pa_mutex); + + return result; } static int ao_pulse_set_property (ao_driver_t *this_gen, int property, int value) { pulse_driver_t *this = (pulse_driver_t *) this_gen; + int result = ~value; + + if ( ! this->stream || ! this->pa_class->context ) + return result; + + pthread_mutex_lock(&this->pa_class->pa_mutex); switch(property) { case AO_PROP_PCM_VOL: case AO_PROP_MIXER_VOL: this->swvolume = pa_sw_volume_from_linear((double)value/100.0); - if( this->stream && this->pa_class->context ) { - pthread_mutex_lock(&this->pa_class->pa_mutex); - pa_cvolume_set(&this->cvolume, pa_stream_get_sample_spec(this->stream)->channels, this->swvolume); - wait_for_operation(this, - pa_context_set_sink_input_volume(this->pa_class->context, pa_stream_get_index(this->stream), - &this->cvolume, __xine_pa_context_success_callback, this)); - pthread_mutex_unlock(&this->pa_class->pa_mutex); - } + pa_cvolume_set(&this->cvolume, pa_stream_get_sample_spec(this->stream)->channels, this->swvolume); + wait_for_operation(this, + pa_context_set_sink_input_volume(this->pa_class->context, pa_stream_get_index(this->stream), + &this->cvolume, __xine_pa_context_success_callback, this)); + + result = value; break; + case AO_PROP_MUTE_VOL: + if ( value ) + pa_cvolume_mute(&this->cvolume, pa_stream_get_sample_spec(this->stream)->channels); + else + pa_cvolume_set(&this->cvolume, pa_stream_get_sample_spec(this->stream)->channels, this->swvolume); + + wait_for_operation(this, + pa_context_set_sink_input_volume(this->pa_class->context, pa_stream_get_index(this->stream), + &this->cvolume, __xine_pa_context_success_callback, this)); + + result = value; break; } - return 0; + pthread_mutex_unlock(&this->pa_class->pa_mutex); + + return result; } static int ao_pulse_ctrl(ao_driver_t *this_gen, int cmd, ...) { -- cgit v1.2.3 From 356c822e295cb4417fe5f4f821a36e17ea24e73c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 31 Mar 2007 21:22:58 +0000 Subject: Lock/Unlock on opening. CVS patchset: 8777 CVS date: 2007/03/31 21:22:58 --- src/audio_out/audio_pulse_out.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c index 9221cbe5a..f0b4d659a 100644 --- a/src/audio_out/audio_pulse_out.c +++ b/src/audio_out/audio_pulse_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_pulse_out.c,v 1.14 2007/03/31 21:16:22 dgp85 Exp $ + * $Id: audio_pulse_out.c,v 1.15 2007/03/31 21:22:58 dgp85 Exp $ * * ao plugin for pulseaudio (rename of polypaudio): * http://0pointer.de/lennart/projects/pulsaudio/ @@ -229,11 +229,15 @@ static int ao_pulse_open(ao_driver_t *this_gen, a.prebuf = a.tlength/2; a.minreq = a.tlength/10; + pthread_mutex_lock(&this->pa_class->pa_mutex); + pa_cvolume_set(&this->cvolume, pa_stream_get_sample_spec(this->stream)->channels, this->swvolume); pa_stream_connect_playback(this->stream, this->sink, &a, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE, &this->cvolume, NULL); + pthread_mutex_unlock(&this->pa_class->pa_mutex); + do { xine_usec_sleep (100); -- cgit v1.2.3 From fc47d546f3ddf86f117a331ff870316511e5505d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sat, 31 Mar 2007 22:06:54 +0000 Subject: Set the volume of the stream to 100% by default. CVS patchset: 8778 CVS date: 2007/03/31 22:06:54 --- src/audio_out/audio_pulse_out.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c index f0b4d659a..dbfc4b9f0 100644 --- a/src/audio_out/audio_pulse_out.c +++ b/src/audio_out/audio_pulse_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_pulse_out.c,v 1.15 2007/03/31 21:22:58 dgp85 Exp $ + * $Id: audio_pulse_out.c,v 1.16 2007/03/31 22:06:54 dgp85 Exp $ * * ao plugin for pulseaudio (rename of polypaudio): * http://0pointer.de/lennart/projects/pulsaudio/ @@ -231,12 +231,9 @@ static int ao_pulse_open(ao_driver_t *this_gen, pthread_mutex_lock(&this->pa_class->pa_mutex); - pa_cvolume_set(&this->cvolume, pa_stream_get_sample_spec(this->stream)->channels, this->swvolume); pa_stream_connect_playback(this->stream, this->sink, &a, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE, - &this->cvolume, NULL); - - pthread_mutex_unlock(&this->pa_class->pa_mutex); + NULL, NULL); do { xine_usec_sleep (100); @@ -244,6 +241,8 @@ static int ao_pulse_open(ao_driver_t *this_gen, streamstate = pa_stream_get_state(this->stream); } while (streamstate < PA_STREAM_READY); + pthread_mutex_unlock(&this->pa_class->pa_mutex); + if (streamstate != PA_STREAM_READY) { xprintf (this->xine, XINE_VERBOSITY_LOG, "audio_pulse_out: Failed to connect to server: %s\n", pa_strerror(pa_context_errno(this->pa_class->context))); @@ -251,6 +250,8 @@ static int ao_pulse_open(ao_driver_t *this_gen, } this->frames_written = 0; + this->ao_driver.set_property(this, AO_PROP_PCM_VOL, 100); + return this->sample_rate; fail: @@ -504,7 +505,6 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da AO_CAP_16BITS | AO_CAP_FLOAT32; this->sample_rate = 0; - this->swvolume = PA_VOLUME_NORM; this->ao_driver.get_capabilities = ao_pulse_get_capabilities; this->ao_driver.get_property = ao_pulse_get_property; -- cgit v1.2.3 From b622467479eebe6efc02374f0f7e08fcc2caaae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sun, 1 Apr 2007 00:32:29 +0000 Subject: Try to improve response when the plugin can't connect to PulseAudio. Unfortunately if the server dies during playback xine will be too messed up to recover. This is the same issue as unplugged USB devices, it requires a proper generic handling of these cases. CVS patchset: 8779 CVS date: 2007/04/01 00:32:29 --- src/audio_out/audio_pulse_out.c | 165 +++++++++++++++++++++++++++------------- 1 file changed, 113 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c index dbfc4b9f0..9e6089730 100644 --- a/src/audio_out/audio_pulse_out.c +++ b/src/audio_out/audio_pulse_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_pulse_out.c,v 1.16 2007/03/31 22:06:54 dgp85 Exp $ + * $Id: audio_pulse_out.c,v 1.17 2007/04/01 00:32:29 dgp85 Exp $ * * ao plugin for pulseaudio (rename of polypaudio): * http://0pointer.de/lennart/projects/pulsaudio/ @@ -106,6 +106,34 @@ static void __xine_pa_stream_success_callback(pa_stream *const stream, const int pa_threaded_mainloop_signal(this->pa_class->mainloop, 0); } +/** + * @brief Callback function called when the state of the context is changed + * @param ctx Context which operation has succeeded + * @param this_gen pulse_driver_t pointer for the PulseAudio output + * instance. + */ +static void __xine_pa_context_status_callback(pa_context *const ctx, void *const this_gen) +{ + pulse_driver_t *const this = (pulse_driver_t*)this_gen; + + _x_assert(ctx); _x_assert(this); + _x_assert(ctx == this->pa_class->context); + + switch (pa_context_get_state(ctx)) { + case PA_CONTEXT_READY: + case PA_CONTEXT_TERMINATED: + case PA_CONTEXT_FAILED: + pa_threaded_mainloop_signal(this->pa_class->mainloop, 0); + break; + + case PA_CONTEXT_CONNECTING: + case PA_CONTEXT_UNCONNECTED: + case PA_CONTEXT_AUTHORIZING: + case PA_CONTEXT_SETTING_NAME: + break; + } +} + /** * @brief Callback function called when a context operation succeed * @param ctx Context which operation has succeeded @@ -221,6 +249,39 @@ static int ao_pulse_open(ao_driver_t *this_gen, goto fail; } + pthread_mutex_lock(&this->pa_class->pa_mutex); + if ( this->pa_class->context && pa_context_get_state(this->pa_class->context) > PA_CONTEXT_READY ) { + pa_context_unref(this->pa_class->context); + this->pa_class->context = NULL; + } + + if ( this->pa_class->context == NULL ) { + this->pa_class->context = pa_context_new(pa_threaded_mainloop_get_api(this->pa_class->mainloop), + __progname); + } + + pa_context_ref(this->pa_class->context); + + if ( pa_context_get_state(this->pa_class->context) == PA_CONTEXT_UNCONNECTED ) { + int ret; + + pa_threaded_mainloop_lock(this->pa_class->mainloop); + ret = pa_context_connect(this->pa_class->context, this->host, 1, NULL); + if ( ret < 0 ) + goto fail; + + pa_context_set_state_callback(this->pa_class->context, __xine_pa_context_status_callback, this); + + pa_threaded_mainloop_wait(this->pa_class->mainloop); + pa_threaded_mainloop_unlock(this->pa_class->mainloop); + } + + if (pa_context_get_state(this->pa_class->context) != PA_CONTEXT_READY) { + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: Failed to connect to server: %s\n", + pa_strerror(pa_context_errno(this->pa_class->context))); + goto fail; + } + this->stream = pa_stream_new(this->pa_class->context, "audio stream", &ss, NULL); _x_assert(this->stream); @@ -229,8 +290,6 @@ static int ao_pulse_open(ao_driver_t *this_gen, a.prebuf = a.tlength/2; a.minreq = a.tlength/10; - pthread_mutex_lock(&this->pa_class->pa_mutex); - pa_stream_connect_playback(this->stream, this->sink, &a, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE, NULL, NULL); @@ -255,6 +314,8 @@ static int ao_pulse_open(ao_driver_t *this_gen, return this->sample_rate; fail: + pa_threaded_mainloop_unlock(this->pa_class->mainloop); + pthread_mutex_unlock(&this->pa_class->pa_mutex); this_gen->close(this_gen); return 0; } @@ -284,10 +345,11 @@ static int ao_pulse_write(ao_driver_t *this_gen, int16_t *data, int size = num_frames * this->bytes_per_frame; int ret = 0; - _x_assert(this->stream && this->pa_class->context); - - if (pa_stream_get_state(this->stream) == PA_STREAM_READY) { + if ( !this->stream || !this->pa_class->context) + return -1; + switch( pa_stream_get_state(this->stream) ) { + case PA_STREAM_READY: while (size > 0) { size_t l; @@ -307,6 +369,8 @@ static int ao_pulse_write(ao_driver_t *this_gen, int16_t *data, if (pa_stream_get_state(this->stream) == PA_STREAM_READY) ret = 1; + + break; } return ret; @@ -319,15 +383,25 @@ static int ao_pulse_delay (ao_driver_t *this_gen) pa_usec_t latency = 0; int delay_frames; - for (;;) { - if (pa_stream_get_latency(this->stream, &latency, NULL) >= 0) - break; + if ( ! this->stream ) return this->frames_written; - if (pa_context_errno(this->pa_class->context) != PA_ERR_NODATA) { - /* error */ - } + pthread_mutex_lock(&this->pa_class->pa_mutex); + + if (pa_stream_get_latency(this->stream, &latency, NULL) < 0) { + pa_context_unref(this->pa_class->context); + this->pa_class->context = NULL; + + pa_stream_disconnect(this->stream); + pa_stream_unref(this->stream); + this->stream = NULL; + + pthread_mutex_unlock(&this->pa_class->pa_mutex); + + return 0; } + pthread_mutex_unlock(&this->pa_class->pa_mutex); + /* convert latency (us) to frame units. */ delay_frames = (int)(latency * this->sample_rate / 1000000); @@ -350,6 +424,8 @@ static void ao_pulse_close(ao_driver_t *this_gen) pa_stream_unref(this->stream); this->stream = NULL; + pa_context_unref(this->pa_class->context); + pthread_mutex_unlock(&this->pa_class->pa_mutex); } } @@ -378,10 +454,15 @@ static int ao_pulse_get_property (ao_driver_t *this_gen, int property) { switch(property) { case AO_PROP_PCM_VOL: case AO_PROP_MIXER_VOL: - wait_for_operation(this, - pa_context_get_sink_input_info(this->pa_class->context, pa_stream_get_index(this->stream), - __xine_pa_sink_info_callback, this)); - result = (pa_sw_volume_to_linear(this->swvolume)*100); + { + pa_operation *o = pa_context_get_sink_input_info(this->pa_class->context, + pa_stream_get_index(this->stream), + __xine_pa_sink_info_callback, this); + if ( ! o ) return 0; + wait_for_operation(this, o); + + result = (pa_sw_volume_to_linear(this->swvolume)*100); + } break; case AO_PROP_MUTE_VOL: @@ -437,6 +518,8 @@ static int ao_pulse_set_property (ao_driver_t *this_gen, int property, int value static int ao_pulse_ctrl(ao_driver_t *this_gen, int cmd, ...) { pulse_driver_t *this = (pulse_driver_t *) this_gen; + if ( ! this->stream ) return 0; + switch (cmd) { case AO_CTRL_PLAY_PAUSE: @@ -484,9 +567,7 @@ static int ao_pulse_ctrl(ao_driver_t *this_gen, int cmd, ...) { static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data) { pulse_class_t *class = (pulse_class_t *) class_gen; pulse_driver_t *this; - char hn[128]; char *device; - pa_context_state_t ctxstate; lprintf ("audio_pulse_out: open_plugin called\n"); @@ -505,6 +586,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da AO_CAP_16BITS | AO_CAP_FLOAT32; this->sample_rate = 0; + this->host = NULL; + this->sink = NULL; this->ao_driver.get_capabilities = ao_pulse_get_capabilities; this->ao_driver.get_property = ao_pulse_get_property; @@ -528,18 +611,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da 10, NULL, NULL); - if (device && strlen(device)) { - int i = strcspn(device, ":"); - if (i >= sizeof(hn)) - i = sizeof(hn)-1; - - if (i > 0) { - strncpy(this->host = hn, device, i); - hn[i] = 0; - } - - if (device[i] == ':') - this->sink = device+i+1; + if (device && *device) { + char *sep = strchr(device, ':'); + if ( sep ) { + this->host = strndup(device, sep-device); + this->sink = strdup(&sep[1]); + } else + this->host = strdup(device); } xprintf (class->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: host %s sink %s\n", @@ -547,28 +625,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da this->pa_class = class; - pthread_mutex_lock(&this->pa_class->pa_mutex); - if ( pa_context_get_state(this->pa_class->context) != PA_CONTEXT_READY ){ - pa_context_connect(this->pa_class->context, this->host, 1, NULL); - - do { - xine_usec_sleep (100); - - ctxstate = pa_context_get_state(this->pa_class->context); - } while (ctxstate < PA_CONTEXT_READY); - - if (ctxstate != PA_CONTEXT_READY) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: Failed to connect to server: %s\n", - pa_strerror(pa_context_errno(this->pa_class->context))); - goto fail; - } - } - - pthread_mutex_unlock(&this->pa_class->pa_mutex); return &this->ao_driver; fail: - pthread_mutex_lock(&this->pa_class->pa_mutex); + pthread_mutex_unlock(&this->pa_class->pa_mutex); free(this); xprintf (class->xine, XINE_VERBOSITY_DEBUG, "audio_pulse_out: open_plugin failed.\n"); return NULL; @@ -592,7 +652,8 @@ static void dispose_class (audio_driver_class_t *this_gen) { pthread_mutex_lock(&this->pa_mutex); - pa_context_unref(this->context); + if ( this->context ) + pa_context_unref(this->context); pa_threaded_mainloop_stop(this->mainloop); pa_threaded_mainloop_free(this->mainloop); @@ -626,8 +687,7 @@ static void *init_class (xine_t *xine, void *data) { pa_threaded_mainloop_start(this->mainloop); - this->context = pa_context_new(pa_threaded_mainloop_get_api(this->mainloop), __progname); - _x_assert(this->context); + this->context = NULL; pthread_mutex_unlock(&this->pa_mutex); @@ -648,3 +708,4 @@ const plugin_info_t xine_plugin_info[] EXPORTED = { { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; + -- cgit v1.2.3 From 50cddc72b09abfac690caa55daf88a5daa5dbdd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sun, 1 Apr 2007 00:52:36 +0000 Subject: Reorder and use bitmasks to reduce the holes in the structure. This is a private structure so it's not part of the ABI. CVS patchset: 8780 CVS date: 2007/04/01 00:52:36 --- src/xine-engine/audio_out.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index a3cf4d8ea..cd87c2947 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -17,7 +17,7 @@ * along with self program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_out.c,v 1.209 2007/03/25 23:09:42 dgp85 Exp $ + * $Id: audio_out.c,v 1.210 2007/04/01 00:52:36 dgp85 Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe <andy@alsaplayer.org> @@ -204,36 +204,45 @@ typedef struct { /* private stuff */ ao_driver_t *driver; pthread_mutex_t driver_lock; - int driver_open; - pthread_mutex_t driver_action_lock; /* protects num_driver_actions */ + + uint32_t driver_open:1; + uint32_t audio_loop_running:1; + uint32_t audio_thread_created:1; + uint32_t grab_only:1; /* => do not start thread, frontend will consume samples */ + uint32_t do_resample:1; + uint32_t do_compress:1; + uint32_t do_amp:1; + uint32_t amp_mute:1; + uint32_t do_equ:1; + int num_driver_actions; /* number of threads, that wish to call * functions needing driver_lock */ + pthread_mutex_t driver_action_lock; /* protects num_driver_actions */ + metronom_clock_t *clock; xine_t *xine; xine_list_t *streams; pthread_mutex_t streams_lock; - int audio_loop_running; - int grab_only; /* => do not start thread, frontend will consume samples */ pthread_t audio_thread; - int audio_thread_created; int64_t audio_step; /* pts per 32 768 samples (sample = #bytes/2) */ int32_t frames_per_kpts; /* frames per 1024/90000 sec */ - ao_format_t input, output; /* format conversion done at audio_out.c */ - double frame_rate_factor; - double output_frame_excess; /* used to keep track of 'half' frames */ - int av_sync_method_conf; resample_sync_t resample_sync_info; - int resample_sync_method; /* fix sound card clock drift by resampling */ double resample_sync_factor; /* correct buffer length by this factor * to sync audio hardware to (dxr3) clock */ + int resample_sync_method; /* fix sound card clock drift by resampling */ + + int gap_tolerance; + + ao_format_t input, output; /* format conversion done at audio_out.c */ + double frame_rate_factor; + double output_frame_excess; /* used to keep track of 'half' frames */ + int resample_conf; uint32_t force_rate; /* force audio output rate to this value if non-zero */ - int do_resample; - int gap_tolerance; audio_fifo_t *free_fifo; audio_fifo_t *out_fifo; int64_t last_audio_vpts; @@ -247,22 +256,18 @@ typedef struct { int64_t passthrough_offset; int flush_audio_driver; + int discard_buffers; pthread_mutex_t flush_audio_driver_lock; pthread_cond_t flush_audio_driver_reached; - int discard_buffers; /* some built-in audio filters */ - int do_compress; double compression_factor; /* current compression */ double compression_factor_max; /* user limit on compression */ - int do_amp; - int amp_mute; double amp_factor; /* 10-band equalizer */ - int do_equ; int eq_gain[EQ_BANDS]; int eq_preamp; int eq_i; -- cgit v1.2.3 From a8b440d0846010d613fee8093bc922b0dff98a10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sun, 1 Apr 2007 01:03:06 +0000 Subject: Reorder and use bitmasks to reduce the holes in the structure. This is a private structure so it's not part of the ABI. CVS patchset: 8781 CVS date: 2007/04/01 01:03:06 --- src/xine-engine/video_out.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index f6788d6b2..2a3ee1980 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out.c,v 1.227 2007/01/16 16:00:26 miguelfreitas Exp $ + * $Id: video_out.c,v 1.228 2007/04/01 01:03:06 dgp85 Exp $ * * frame allocation / queuing / scheduling / output functions */ @@ -93,11 +93,20 @@ typedef struct { vo_frame_t *last_frame; vo_frame_t *img_backup; - int redraw_needed; + + uint32_t video_loop_running:1; + uint32_t video_opened:1; + + uint32_t overlay_enabled:1; + + uint32_t warn_threshold_event_sent:1; + + /* do we true real-time output or is this a grab only instance ? */ + uint32_t grab_only:1; + + uint32_t redraw_needed:3; int discard_frames; - int video_loop_running; - int video_opened; pthread_t video_thread; int num_frames_delivered; @@ -108,17 +117,12 @@ typedef struct { int warn_skipped_threshold; int warn_discarded_threshold; int warn_threshold_exceeded; - int warn_threshold_event_sent; /* pts value when decoder delivered last video frame */ int64_t last_delivery_pts; video_overlay_manager_t *overlay_source; - int overlay_enabled; - - /* do we true real-time output or is this a grab only instance ? */ - int grab_only; extra_info_t *extra_info_base; /* used to free mem chunk */ @@ -600,7 +604,7 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { */ send_event = (this->warn_threshold_exceeded == 5 && !this->warn_threshold_event_sent); - this->warn_threshold_event_sent += send_event; + this->warn_threshold_event_sent = send_event; pthread_mutex_lock(&this->streams_lock); for (ite = xine_list_front(this->streams); ite; -- cgit v1.2.3 From 80cde7663b1661cba488a961ed088f4bcdaa5004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sun, 1 Apr 2007 22:49:07 +0000 Subject: Support multiple audio PID in MPEG TS. Patch by Julian Scheel (slightly modified). CVS patchset: 8784 CVS date: 2007/04/01 22:49:07 --- src/demuxers/demux_ts.c | 180 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 124 insertions(+), 56 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index da2c37625..b6bf5870c 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_ts.c,v 1.125 2007/02/08 02:40:22 dsalt Exp $ + * $Id: demux_ts.c,v 1.126 2007/04/01 22:49:07 dgp85 Exp $ * * Demultiplexer for MPEG2 Transport Streams. * @@ -262,6 +262,14 @@ typedef struct { int media_index; } demux_ts_spu_lang; +/* Audio Channels */ +#define MAX_AUDIO_TRACKS 16 + +typedef struct { + int pid; + int media_index; + char lang[4]; +} demux_ts_audio_track; typedef struct { /* @@ -299,10 +307,10 @@ typedef struct { unsigned int pid; unsigned int pid_count; unsigned int videoPid; - unsigned int audioPid; unsigned int videoMedia; - unsigned int audioMedia; - char audioLang[4]; + + demux_ts_audio_track audio_tracks[MAX_AUDIO_TRACKS]; + int audio_tracks_count; int send_end_buffers; int64_t last_pts[2]; @@ -627,7 +635,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, /* force PMT reparsing when pmt_pid changes */ if (this->pmt_pid[program_count] != pmt_pid) { this->pmt_pid[program_count] = pmt_pid; - this->audioPid = INVALID_PID; + this->audio_tracks_count = 0; this->videoPid = INVALID_PID; this->spu_pid = INVALID_PID; } @@ -737,7 +745,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, (p[0] == 0x0B && p[1] == 0x77)) { /* ac3 - syncword */ m->content = p; m->size = packet_len; - m->type = BUF_AUDIO_A52; + m->type |= BUF_AUDIO_A52; return 1; } else if (m->descriptor_tag == 0x06 @@ -761,7 +769,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, m->content = p+4; m->size = packet_len - 4; - m->type = BUF_AUDIO_A52 + track; + m->type |= BUF_AUDIO_A52 + track; return 1; } else if ((p[0]&0xf0) == 0xa0) { @@ -777,7 +785,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, m->content = p+pcm_offset; m->size = packet_len-pcm_offset; - m->type = BUF_AUDIO_LPCM_BE + track; + m->type |= BUF_AUDIO_LPCM_BE + track; return 1; } @@ -818,16 +826,16 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, case ISO_11172_AUDIO: case ISO_13818_AUDIO: lprintf ("demux_ts: found MPEG audio track.\n"); - m->type = BUF_AUDIO_MPEG + track; + m->type |= BUF_AUDIO_MPEG + track; break; case ISO_13818_PART7_AUDIO: case ISO_14496_PART3_AUDIO: lprintf ("demux_ts: found AAC audio track.\n"); - m->type = BUF_AUDIO_AAC + track; + m->type |= BUF_AUDIO_AAC + track; break; default: lprintf ("demux_ts: unknown audio type: %d, defaulting to MPEG.\n", m->descriptor_tag); - m->type = BUF_AUDIO_MPEG + track; + m->type |= BUF_AUDIO_MPEG + track; break; } return 1; @@ -1248,15 +1256,26 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num case ISO_13818_AUDIO: case ISO_13818_PART7_AUDIO: case ISO_14496_PART3_AUDIO: - if (this->audioPid == INVALID_PID) { + if (this->audio_tracks_count < MAX_AUDIO_TRACKS) { + int i, found = 0; + for(i = 0; i < this->audio_tracks_count; i++) { + if(this->audio_tracks[i].pid == pid) { + found = 1; + break; + } + } + if(!found) { #ifdef TS_PMT_LOG - printf ("demux_ts: PMT audio pid 0x%.4x\n", pid); + printf ("demux_ts: PMT audio pid 0x%.4x\n", pid); #endif - demux_ts_pes_new(this, this->media_num, pid, this->audio_fifo,stream[0]); - this->audioPid = pid; - this->audioMedia = this->media_num; - demux_ts_get_lang_desc(this, this->audioLang, + demux_ts_pes_new(this, this->media_num, pid, this->audio_fifo,stream[0]); + this->audio_tracks[this->audio_tracks_count].pid = pid; + this->audio_tracks[this->audio_tracks_count].media_index = this->media_num; + this->media[this->media_num].type = this->audio_tracks_count; + demux_ts_get_lang_desc(this, this->audio_tracks[this->audio_tracks_count].lang, stream + 5, stream_info_length); + this->audio_tracks_count++; + } } break; case ISO_13818_PRIVATE: @@ -1275,10 +1294,18 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num break; case ISO_13818_PES_PRIVATE: for (i = 5; i < coded_length; i += stream[i+1] + 2) { - if ((stream[i] == 0x6a) && (this->audioPid == INVALID_PID)) { + if ((stream[i] == 0x6a) && (this->audio_tracks_count < MAX_AUDIO_TRACKS)) { uint32_t format_identifier=0; + int i, found = 0; + for(i = 0; i < this->audio_tracks_count; i++) { + if(this->audio_tracks[i].pid == pid) { + found = 1; + break; + } + } + if(!found) { #ifdef TS_PMT_LOG - printf ("demux_ts: PMT AC3 audio pid 0x%.4x\n", pid); + printf ("demux_ts: PMT AC3 audio pid 0x%.4x\n", pid); #endif demux_ts_get_reg_desc(this, &format_identifier, stream + 5, stream_info_length); @@ -1292,13 +1319,15 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num demux_ts_pes_new(this, this->media_num, pid, this->audio_fifo,stream[0]); - this->audioPid = pid; - this->audioMedia = this->media_num; - demux_ts_get_lang_desc(this, this->audioLang, - stream + 5, stream_info_length); + this->audio_tracks[this->audio_tracks_count].pid = pid; + this->audio_tracks[this->audio_tracks_count].media_index = this->media_num; + this->media[this->media_num].type = this->audio_tracks_count; + demux_ts_get_lang_desc(this, this->audio_tracks[this->audio_tracks_count].lang, + stream + 5, stream_info_length); + this->audio_tracks_count++; break; + } } - /* Teletext */ else if (stream[i] == 0x56) { @@ -1356,18 +1385,30 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num * if is does, we tag this as an audio stream. * FIXME: This will need expanding if we ever see a DTS or other media format here. */ - if (this->audioPid == INVALID_PID && (stream[0] >= 0x80) ) { - uint32_t format_identifier=0; - demux_ts_get_reg_desc(this, &format_identifier, - stream + 5, stream_info_length); - /* If no format identifier, assume A52 */ - if ((format_identifier == 0x41432d33) || (format_identifier == 0)) { - demux_ts_pes_new(this, this->media_num, pid, this->audio_fifo, stream[0]); - this->audioPid = pid; - this->audioMedia = this->media_num; - demux_ts_get_lang_desc(this, this->audioLang, - stream + 5, stream_info_length); - break; + if ((this->audio_tracks_count < MAX_AUDIO_TRACKS) && (stream[0] >= 0x80) ) { + int i, found = 0; + for(i = 0; i < this->audio_tracks_count; i++) { + if(this->audio_tracks[i].pid == pid) { + found = 1; + break; + } + } + if(!found) { + uint32_t format_identifier=0; + demux_ts_get_reg_desc(this, &format_identifier, + stream + 5, stream_info_length); + /* If no format identifier, assume A52 */ + if ((format_identifier == 0x41432d33) || (format_identifier == 0)) { + printf("ADD APID: %d\n", pid); + demux_ts_pes_new(this, this->media_num, pid, this->audio_fifo, stream[0]); + this->audio_tracks[this->audio_tracks_count].pid = pid; + this->audio_tracks[this->audio_tracks_count].media_index = this->media_num; + this->media[this->media_num].type = this->audio_tracks_count; + demux_ts_get_lang_desc(this, this->audio_tracks[this->audio_tracks_count].lang, + stream + 5, stream_info_length); + this->audio_tracks_count++; + break; + } } } else { #ifdef TS_PMT_LOG @@ -1612,6 +1653,16 @@ static int64_t demux_ts_adaptation_field_parse(uint8_t *data, return PCR; } +/* check if an apid is in the list of known apids */ +static int apid_check(demux_ts_t*this, unsigned int pid) { + int i; + for(i=0; i<this->audio_tracks_count; i++) { + if(this->audio_tracks[i].pid == pid) + return i; + } + return -1; +} + /* transport stream packet layer */ static void demux_ts_parse_packet (demux_ts_t*this) { @@ -1753,15 +1804,27 @@ static void demux_ts_parse_packet (demux_ts_t*this) { demux_ts_pes_new(this, this->media_num++, pid, this->video_fifo, pes_stream_id); } } else if ( (pes_stream_id >= AUDIO_STREAM_S) && (pes_stream_id <= AUDIO_STREAM_E) ) { - if ( this->audioPid == INVALID_PID) { - - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, - "demux_ts: auto-detected audio pid 0x%.4x\n", pid); - - this->audioPid = pid; - this->audioMedia = this->media_num; - demux_ts_pes_new(this, this->media_num++, pid, this->audio_fifo, pes_stream_id); - } + if (this->audio_tracks_count < MAX_AUDIO_TRACKS) { + int i, found = 0; + for(i = 0; i < this->audio_tracks_count; i++) { + if(this->audio_tracks[i].pid == pid) { + found = 1; + break; + } + } + if(!found) { +#ifdef TS_PMT_LOG + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts: auto-detected audio pid 0x%.4x\n", pid); +#endif + this->audio_tracks[this->audio_tracks_count].pid = pid; + this->audio_tracks[this->audio_tracks_count].media_index = this->media_num; + this->media[this->media_num].type = this->audio_tracks_count; + demux_ts_pes_new(this, this->media_num++, pid, + this->audio_fifo,pes_stream_id); + this->audio_tracks_count++; + } + } } } @@ -1775,6 +1838,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) { /* * Do the demuxing in descending order of packet frequency! */ + int index; if (pid == this->videoPid) { #ifdef TS_LOG printf ("demux_ts: Video pid: 0x%.4x\n", pid); @@ -1785,12 +1849,13 @@ static void demux_ts_parse_packet (demux_ts_t*this) { data_len); return; } - else if (pid == this->audioPid) { + else if ((index = apid_check(this, pid)) > -1) { #ifdef TS_LOG printf ("demux_ts: Audio pid: 0x%.4x\n", pid); #endif - check_newpts(this, this->media[this->audioMedia].pts, PTS_AUDIO); - demux_ts_buffer_pes (this, originalPkt+data_offset, this->audioMedia, + check_newpts(this, this->media[this->audio_tracks[index].media_index].pts, PTS_AUDIO); + demux_ts_buffer_pes (this, originalPkt+data_offset, + this->audio_tracks[index].media_index, payload_unit_start_indicator, continuity_counter, data_len); return; @@ -1830,7 +1895,7 @@ static void demux_ts_event_handler (demux_ts_t *this) { case XINE_EVENT_PIDS_CHANGE: this->videoPid = INVALID_PID; - this->audioPid = INVALID_PID; + this->audio_tracks_count = 0; this->media_num = 0; this->send_newpts = 1; this->spu_pid = INVALID_PID; @@ -1909,7 +1974,7 @@ static void demux_ts_send_headers (demux_plugin_t *this_gen) { */ this->videoPid = INVALID_PID; - this->audioPid = INVALID_PID; + this->audio_tracks_count = 0; this->media_num= 0; _x_demux_control_start (this->stream); @@ -2005,6 +2070,8 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen, { demux_ts_t *this = (demux_ts_t *) this_gen; char *str = data; + int channel = *((int *)data); + int track_num; /* be a bit paranoid */ if (this == NULL || this->stream == NULL) @@ -2013,11 +2080,12 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen, switch (data_type) { case DEMUX_OPTIONAL_DATA_AUDIOLANG: - if (this->audioLang[0]) - { - strncpy(str, this->audioLang, XINE_LANG_MAX - 1); - str[XINE_LANG_MAX - 1] = 0; - } + if ((channel >= 0) && (channel < this->audio_tracks_count)) { + if(this->audio_tracks[channel].lang) + strcpy(str, this->audio_tracks[channel].lang); + else + sprintf(str, "%3i", _x_get_audio_channel(this->stream)); + } else { snprintf(str, XINE_LANG_MAX, "%3i", _x_get_audio_channel(this->stream)); @@ -2162,7 +2230,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, this->pcrPid = INVALID_PID; this->scrambled_npids = 0; this->videoPid = INVALID_PID; - this->audioPid = INVALID_PID; + this->audio_tracks_count = 0; this->rate = 16000; /* FIXME */ -- cgit v1.2.3 From 291b0f9557c3db75a672a3ea85fadf2727890ebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Sun, 1 Apr 2007 22:52:34 +0000 Subject: Fix MANGLE macro for libpostproc on Darwin (applied on FFmpeg already). Thanks to Matt Messier for his work on OS X portability. CVS patchset: 8785 CVS date: 2007/04/01 22:52:34 --- src/libffmpeg/libavcodec/libpostproc/mangle.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/libffmpeg/libavcodec/libpostproc/mangle.h b/src/libffmpeg/libavcodec/libpostproc/mangle.h index aa09cd6bf..46480ab43 100644 --- a/src/libffmpeg/libavcodec/libpostproc/mangle.h +++ b/src/libffmpeg/libavcodec/libpostproc/mangle.h @@ -19,6 +19,8 @@ #else #if defined(ARCH_X86_64) && defined(PIC) #define MANGLE(a) #a"(%%rip)" +#elif defined(CONFIG_DARWIN) +#define MANGLE(a) "_" #a #else #define MANGLE(a) #a #endif -- cgit v1.2.3 From 9ffc18a77a9140444cacdbc64f259b809d32b05e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Mon, 2 Apr 2007 09:51:53 +0000 Subject: Remove extraneous debug printf(). CVS patchset: 8786 CVS date: 2007/04/02 09:51:53 --- src/demuxers/demux_ts.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index b6bf5870c..438c00517 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_ts.c,v 1.126 2007/04/01 22:49:07 dgp85 Exp $ + * $Id: demux_ts.c,v 1.127 2007/04/02 09:51:53 dgp85 Exp $ * * Demultiplexer for MPEG2 Transport Streams. * @@ -1399,7 +1399,6 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num stream + 5, stream_info_length); /* If no format identifier, assume A52 */ if ((format_identifier == 0x41432d33) || (format_identifier == 0)) { - printf("ADD APID: %d\n", pid); demux_ts_pes_new(this, this->media_num, pid, this->audio_fifo, stream[0]); this->audio_tracks[this->audio_tracks_count].pid = pid; this->audio_tracks[this->audio_tracks_count].media_index = this->media_num; -- cgit v1.2.3 From 451f0515f1cf26159ded82a0c39a4ef87c3fd6f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Mon, 2 Apr 2007 10:13:02 +0000 Subject: Rename no_spu_tracks to spu_tracks_count and MAX_NO_SPU_TRACKS to MAX_SPU_TRACKS. Beside the fact that a MAX value is, well, always for the max number of tracks, the abbrevation "number" -> "no" is ambiguous as one could read it as "there are no spu tracks". CVS patchset: 8787 CVS date: 2007/04/02 10:13:02 --- src/demuxers/demux_ts.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 438c00517..7d871faaa 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_ts.c,v 1.127 2007/04/02 09:51:53 dgp85 Exp $ + * $Id: demux_ts.c,v 1.128 2007/04/02 10:13:02 dgp85 Exp $ * * Demultiplexer for MPEG2 Transport Streams. * @@ -254,7 +254,7 @@ typedef struct { } demux_ts_media; /* DVBSUB */ -#define MAX_NO_SPU_LANGS 16 +#define MAX_SPU_LANGS 16 typedef struct { spu_dvb_descriptor_t desc; @@ -327,8 +327,8 @@ typedef struct { /* DVBSUB */ unsigned int spu_pid; unsigned int spu_media; - demux_ts_spu_lang spu_langs[MAX_NO_SPU_LANGS]; - int no_spu_langs; + demux_ts_spu_lang spu_langs[MAX_SPU_LANGS]; + int spu_langs_count; int current_spu_channel; /* dvb */ @@ -465,7 +465,7 @@ static void demux_ts_update_spu_channel(demux_ts_t *this) buf->size = 0; if (this->current_spu_channel >= 0 - && this->current_spu_channel < this->no_spu_langs) + && this->current_spu_channel < this->spu_langs_count) { demux_ts_spu_lang *lang = &this->spu_langs[this->current_spu_channel]; @@ -1220,7 +1220,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num /* * Extract the elementary streams. */ - this->no_spu_langs = 0; + this->spu_langs_count = 0; while (section_length > 0) { unsigned int stream_info_length; @@ -1347,13 +1347,13 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num int pos; for (pos = i + 2; pos + 8 <= i + 2 + stream[i + 1] - && this->no_spu_langs < MAX_NO_SPU_LANGS; + && this->spu_langs_count < MAX_SPU_LANGS; pos += 8) { - int no = this->no_spu_langs; + int no = this->spu_langs_count; demux_ts_spu_lang *lang = &this->spu_langs[no]; - this->no_spu_langs++; + this->spu_langs_count++; memcpy(lang->desc.lang, &stream[pos], 3); lang->desc.lang[3] = 0; @@ -1899,7 +1899,7 @@ static void demux_ts_event_handler (demux_ts_t *this) { this->send_newpts = 1; this->spu_pid = INVALID_PID; this->spu_media = 0; - this->no_spu_langs= 0; + this->spu_langs_count= 0; _x_demux_control_start (this->stream); break; @@ -1991,7 +1991,7 @@ static void demux_ts_send_headers (demux_plugin_t *this_gen) { /* DVBSUB */ this->spu_pid = INVALID_PID; - this->no_spu_langs = 0; + this->spu_langs_count = 0; this->current_spu_channel = this->stream->spu_channel; /* FIXME ? */ @@ -2093,7 +2093,7 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen, case DEMUX_OPTIONAL_DATA_SPULANG: if (this->current_spu_channel >= 0 - && this->current_spu_channel < this->no_spu_langs) + && this->current_spu_channel < this->spu_langs_count) { memcpy(str, this->spu_langs[this->current_spu_channel].desc.lang, 3); str[3] = 0; @@ -2243,7 +2243,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, /* DVBSUB */ this->spu_pid = INVALID_PID; - this->no_spu_langs = 0; + this->spu_langs_count = 0; this->current_spu_channel = this->stream->spu_channel; /* dvb */ -- cgit v1.2.3 From c69723f808ec19299e61ba389b512175f084fb4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Mon, 2 Apr 2007 10:46:08 +0000 Subject: Assume that the audio stream is AC3 on PMTs with ID 0x6a, rather than doing extra checks. If there are cases where the stream is not AC3, it would be nicer to blacklist them, rather than whitelist the cases where it's correct. Patch by Julian Scheel. CVS patchset: 8788 CVS date: 2007/04/02 10:46:08 --- src/demuxers/demux_ts.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 7d871faaa..aea0c8ca1 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_ts.c,v 1.128 2007/04/02 10:13:02 dgp85 Exp $ + * $Id: demux_ts.c,v 1.129 2007/04/02 10:46:08 dgp85 Exp $ * * Demultiplexer for MPEG2 Transport Streams. * @@ -1307,17 +1307,8 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num #ifdef TS_PMT_LOG printf ("demux_ts: PMT AC3 audio pid 0x%.4x\n", pid); #endif - demux_ts_get_reg_desc(this, &format_identifier, - stream + 5, stream_info_length); - if (format_identifier == 0x41432d33) /* AC-3 */ - demux_ts_pes_new(this, this->media_num, pid, - this->audio_fifo, 0x81); - else if((stream[i+1]>1) && (stream[i+2] & 0x80 ) && (stream[3] & 0x40)) /* AC3 Full Service */ - demux_ts_pes_new(this, this->media_num, pid, - this->audio_fifo, 0x81); - else - demux_ts_pes_new(this, this->media_num, pid, - this->audio_fifo,stream[0]); + demux_ts_pes_new(this, this->media_num, pid, + this->audio_fifo, 0x81); this->audio_tracks[this->audio_tracks_count].pid = pid; this->audio_tracks[this->audio_tracks_count].media_index = this->media_num; -- cgit v1.2.3 From 6ff7b823ea37c8baa725fad659b06b23e1d92d57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= <flameeyes@gmail.com> Date: Mon, 2 Apr 2007 20:44:04 +0200 Subject: Migrate all .cvsignore files to .hgignore. --HG-- rename : .cvsignore => .hgignore rename : doc/.cvsignore => doc/.hgignore rename : doc/faq/.cvsignore => doc/faq/.hgignore rename : doc/hackersguide/.cvsignore => doc/hackersguide/.hgignore rename : doc/man/.cvsignore => doc/man/.hgignore rename : doc/man/en/.cvsignore => doc/man/en/.hgignore rename : include/.cvsignore => include/.hgignore rename : intl/.cvsignore => intl/.hgignore rename : lib/.cvsignore => lib/.hgignore rename : m4/.cvsignore => m4/.hgignore rename : misc/.cvsignore => misc/.hgignore rename : misc/fonts/.cvsignore => misc/fonts/.hgignore rename : po/.cvsignore => po/.hgignore rename : src/.cvsignore => src/.hgignore rename : src/audio_out/.cvsignore => src/audio_out/.hgignore rename : src/combined/.cvsignore => src/combined/.hgignore rename : src/demuxers/.cvsignore => src/demuxers/.hgignore rename : src/dxr3/.cvsignore => src/dxr3/.hgignore rename : src/input/.cvsignore => src/input/.hgignore rename : src/input/dvb/.cvsignore => src/input/dvb/.hgignore rename : src/input/libdvdnav/.cvsignore => src/input/libdvdnav/.hgignore rename : src/input/libreal/.cvsignore => src/input/libreal/.hgignore rename : src/input/librtsp/.cvsignore => src/input/librtsp/.hgignore rename : src/input/vcd/.cvsignore => src/input/vcd/.hgignore rename : src/input/vcd/libcdio/.cvsignore => src/input/vcd/libcdio/.hgignore rename : src/input/vcd/libcdio/MSWindows/.cvsignore => src/input/vcd/libcdio/MSWindows/.hgignore rename : src/input/vcd/libcdio/cdio/.cvsignore => src/input/vcd/libcdio/cdio/.hgignore rename : src/input/vcd/libcdio/image/.cvsignore => src/input/vcd/libcdio/image/.hgignore rename : src/input/vcd/libvcd/.cvsignore => src/input/vcd/libvcd/.hgignore rename : src/input/vcd/libvcd/libvcd/.cvsignore => src/input/vcd/libvcd/libvcd/.hgignore rename : src/liba52/.cvsignore => src/liba52/.hgignore rename : src/libdts/.cvsignore => src/libdts/.hgignore rename : src/libfaad/.cvsignore => src/libfaad/.hgignore rename : src/libfaad/codebook/.cvsignore => src/libfaad/codebook/.hgignore rename : src/libffmpeg/.cvsignore => src/libffmpeg/.hgignore rename : src/libffmpeg/libavcodec/.cvsignore => src/libffmpeg/libavcodec/.hgignore rename : src/libffmpeg/libavcodec/alpha/.cvsignore => src/libffmpeg/libavcodec/alpha/.hgignore rename : src/libffmpeg/libavcodec/armv4l/.cvsignore => src/libffmpeg/libavcodec/armv4l/.hgignore rename : src/libffmpeg/libavcodec/i386/.cvsignore => src/libffmpeg/libavcodec/i386/.hgignore rename : src/libffmpeg/libavcodec/libpostproc/.cvsignore => src/libffmpeg/libavcodec/libpostproc/.hgignore rename : src/libffmpeg/libavcodec/mlib/.cvsignore => src/libffmpeg/libavcodec/mlib/.hgignore rename : src/libffmpeg/libavcodec/ppc/.cvsignore => src/libffmpeg/libavcodec/ppc/.hgignore rename : src/libffmpeg/libavcodec/sparc/.cvsignore => src/libffmpeg/libavcodec/sparc/.hgignore rename : src/libffmpeg/libavutil/.cvsignore => src/libffmpeg/libavutil/.hgignore rename : src/libflac/.cvsignore => src/libflac/.hgignore rename : src/liblpcm/.cvsignore => src/liblpcm/.hgignore rename : src/libmad/.cvsignore => src/libmad/.hgignore rename : src/libmpeg2/.cvsignore => src/libmpeg2/.hgignore rename : src/libmpeg2new/.cvsignore => src/libmpeg2new/.hgignore rename : src/libmpeg2new/include/.cvsignore => src/libmpeg2new/include/.hgignore rename : src/libmpeg2new/libmpeg2/.cvsignore => src/libmpeg2new/libmpeg2/.hgignore rename : src/libmusepack/.cvsignore => src/libmusepack/.hgignore rename : src/libmusepack/musepack/.cvsignore => src/libmusepack/musepack/.hgignore rename : src/libreal/.cvsignore => src/libreal/.hgignore rename : src/libspeex/.cvsignore => src/libspeex/.hgignore rename : src/libspucc/.cvsignore => src/libspucc/.hgignore rename : src/libspucmml/.cvsignore => src/libspucmml/.hgignore rename : src/libspudec/.cvsignore => src/libspudec/.hgignore rename : src/libspudvb/.cvsignore => src/libspudvb/.hgignore rename : src/libsputext/.cvsignore => src/libsputext/.hgignore rename : src/libtheora/.cvsignore => src/libtheora/.hgignore rename : src/libvorbis/.cvsignore => src/libvorbis/.hgignore rename : src/libw32dll/.cvsignore => src/libw32dll/.hgignore rename : src/libw32dll/DirectShow/.cvsignore => src/libw32dll/DirectShow/.hgignore rename : src/libw32dll/dmo/.cvsignore => src/libw32dll/dmo/.hgignore rename : src/libw32dll/qtx/.cvsignore => src/libw32dll/qtx/.hgignore rename : src/libw32dll/qtx/qtxsdk/.cvsignore => src/libw32dll/qtx/qtxsdk/.hgignore rename : src/libw32dll/wine/.cvsignore => src/libw32dll/wine/.hgignore rename : src/libxineadec/.cvsignore => src/libxineadec/.hgignore rename : src/libxineadec/gsm610/.cvsignore => src/libxineadec/gsm610/.hgignore rename : src/libxineadec/nosefart/.cvsignore => src/libxineadec/nosefart/.hgignore rename : src/libxinevdec/.cvsignore => src/libxinevdec/.hgignore rename : src/post/.cvsignore => src/post/.hgignore rename : src/post/audio/.cvsignore => src/post/audio/.hgignore rename : src/post/deinterlace/.cvsignore => src/post/deinterlace/.hgignore rename : src/post/deinterlace/plugins/.cvsignore => src/post/deinterlace/plugins/.hgignore rename : src/post/goom/.cvsignore => src/post/goom/.hgignore rename : src/post/mosaico/.cvsignore => src/post/mosaico/.hgignore rename : src/post/planar/.cvsignore => src/post/planar/.hgignore rename : src/post/visualizations/.cvsignore => src/post/visualizations/.hgignore rename : src/video_out/.cvsignore => src/video_out/.hgignore rename : src/video_out/libdha/.cvsignore => src/video_out/libdha/.hgignore rename : src/video_out/libdha/bin/.cvsignore => src/video_out/libdha/bin/.hgignore rename : src/video_out/libdha/kernelhelper/.cvsignore => src/video_out/libdha/kernelhelper/.hgignore rename : src/video_out/libdha/oth/.cvsignore => src/video_out/libdha/oth/.hgignore rename : src/video_out/libdha/sysdep/.cvsignore => src/video_out/libdha/sysdep/.hgignore rename : src/video_out/macosx/.cvsignore => src/video_out/macosx/.hgignore rename : src/video_out/vidix/.cvsignore => src/video_out/vidix/.hgignore rename : src/video_out/vidix/drivers/.cvsignore => src/video_out/vidix/drivers/.hgignore rename : src/xine-engine/.cvsignore => src/xine-engine/.hgignore rename : src/xine-utils/.cvsignore => src/xine-utils/.hgignore rename : win32/.cvsignore => win32/.hgignore rename : win32/include/.cvsignore => win32/include/.hgignore --- src/.cvsignore | 2 -- src/.hgignore | 2 ++ src/audio_out/.cvsignore | 6 ------ src/audio_out/.hgignore | 6 ++++++ src/combined/.cvsignore | 6 ------ src/combined/.hgignore | 6 ++++++ src/demuxers/.cvsignore | 6 ------ src/demuxers/.hgignore | 6 ++++++ src/dxr3/.cvsignore | 6 ------ src/dxr3/.hgignore | 6 ++++++ src/input/.cvsignore | 6 ------ src/input/.hgignore | 6 ++++++ src/input/dvb/.cvsignore | 2 -- src/input/dvb/.hgignore | 2 ++ src/input/libdvdnav/.cvsignore | 6 ------ src/input/libdvdnav/.hgignore | 6 ++++++ src/input/libreal/.cvsignore | 6 ------ src/input/libreal/.hgignore | 6 ++++++ src/input/librtsp/.cvsignore | 6 ------ src/input/librtsp/.hgignore | 6 ++++++ src/input/vcd/.cvsignore | 6 ------ src/input/vcd/.hgignore | 6 ++++++ src/input/vcd/libcdio/.cvsignore | 6 ------ src/input/vcd/libcdio/.hgignore | 6 ++++++ src/input/vcd/libcdio/MSWindows/.cvsignore | 2 -- src/input/vcd/libcdio/MSWindows/.hgignore | 2 ++ src/input/vcd/libcdio/cdio/.cvsignore | 2 -- src/input/vcd/libcdio/cdio/.hgignore | 2 ++ src/input/vcd/libcdio/image/.cvsignore | 2 -- src/input/vcd/libcdio/image/.hgignore | 2 ++ src/input/vcd/libvcd/.cvsignore | 6 ------ src/input/vcd/libvcd/.hgignore | 6 ++++++ src/input/vcd/libvcd/libvcd/.cvsignore | 2 -- src/input/vcd/libvcd/libvcd/.hgignore | 2 ++ src/liba52/.cvsignore | 6 ------ src/liba52/.hgignore | 6 ++++++ src/libdts/.cvsignore | 6 ------ src/libdts/.hgignore | 6 ++++++ src/libfaad/.cvsignore | 6 ------ src/libfaad/.hgignore | 6 ++++++ src/libfaad/codebook/.cvsignore | 2 -- src/libfaad/codebook/.hgignore | 2 ++ src/libffmpeg/.cvsignore | 6 ------ src/libffmpeg/.hgignore | 6 ++++++ src/libffmpeg/libavcodec/.cvsignore | 6 ------ src/libffmpeg/libavcodec/.hgignore | 6 ++++++ src/libffmpeg/libavcodec/alpha/.cvsignore | 6 ------ src/libffmpeg/libavcodec/alpha/.hgignore | 6 ++++++ src/libffmpeg/libavcodec/armv4l/.cvsignore | 6 ------ src/libffmpeg/libavcodec/armv4l/.hgignore | 6 ++++++ src/libffmpeg/libavcodec/i386/.cvsignore | 6 ------ src/libffmpeg/libavcodec/i386/.hgignore | 6 ++++++ src/libffmpeg/libavcodec/libpostproc/.cvsignore | 6 ------ src/libffmpeg/libavcodec/libpostproc/.hgignore | 6 ++++++ src/libffmpeg/libavcodec/mlib/.cvsignore | 6 ------ src/libffmpeg/libavcodec/mlib/.hgignore | 6 ++++++ src/libffmpeg/libavcodec/ppc/.cvsignore | 6 ------ src/libffmpeg/libavcodec/ppc/.hgignore | 6 ++++++ src/libffmpeg/libavcodec/sparc/.cvsignore | 6 ------ src/libffmpeg/libavcodec/sparc/.hgignore | 6 ++++++ src/libffmpeg/libavutil/.cvsignore | 6 ------ src/libffmpeg/libavutil/.hgignore | 6 ++++++ src/libflac/.cvsignore | 6 ------ src/libflac/.hgignore | 6 ++++++ src/liblpcm/.cvsignore | 6 ------ src/liblpcm/.hgignore | 6 ++++++ src/libmad/.cvsignore | 6 ------ src/libmad/.hgignore | 6 ++++++ src/libmpeg2/.cvsignore | 6 ------ src/libmpeg2/.hgignore | 6 ++++++ src/libmpeg2new/.cvsignore | 6 ------ src/libmpeg2new/.hgignore | 6 ++++++ src/libmpeg2new/include/.cvsignore | 2 -- src/libmpeg2new/include/.hgignore | 2 ++ src/libmpeg2new/libmpeg2/.cvsignore | 6 ------ src/libmpeg2new/libmpeg2/.hgignore | 6 ++++++ src/libmusepack/.cvsignore | 6 ------ src/libmusepack/.hgignore | 6 ++++++ src/libmusepack/musepack/.cvsignore | 2 -- src/libmusepack/musepack/.hgignore | 2 ++ src/libreal/.cvsignore | 6 ------ src/libreal/.hgignore | 6 ++++++ src/libspeex/.cvsignore | 6 ------ src/libspeex/.hgignore | 6 ++++++ src/libspucc/.cvsignore | 6 ------ src/libspucc/.hgignore | 6 ++++++ src/libspucmml/.cvsignore | 6 ------ src/libspucmml/.hgignore | 6 ++++++ src/libspudec/.cvsignore | 6 ------ src/libspudec/.hgignore | 6 ++++++ src/libspudvb/.cvsignore | 6 ------ src/libspudvb/.hgignore | 6 ++++++ src/libsputext/.cvsignore | 6 ------ src/libsputext/.hgignore | 6 ++++++ src/libtheora/.cvsignore | 6 ------ src/libtheora/.hgignore | 6 ++++++ src/libvorbis/.cvsignore | 6 ------ src/libvorbis/.hgignore | 6 ++++++ src/libw32dll/.cvsignore | 6 ------ src/libw32dll/.hgignore | 6 ++++++ src/libw32dll/DirectShow/.cvsignore | 6 ------ src/libw32dll/DirectShow/.hgignore | 6 ++++++ src/libw32dll/dmo/.cvsignore | 6 ------ src/libw32dll/dmo/.hgignore | 6 ++++++ src/libw32dll/qtx/.cvsignore | 3 --- src/libw32dll/qtx/.hgignore | 3 +++ src/libw32dll/qtx/qtxsdk/.cvsignore | 2 -- src/libw32dll/qtx/qtxsdk/.hgignore | 2 ++ src/libw32dll/wine/.cvsignore | 6 ------ src/libw32dll/wine/.hgignore | 6 ++++++ src/libxineadec/.cvsignore | 6 ------ src/libxineadec/.hgignore | 6 ++++++ src/libxineadec/gsm610/.cvsignore | 6 ------ src/libxineadec/gsm610/.hgignore | 6 ++++++ src/libxineadec/nosefart/.cvsignore | 6 ------ src/libxineadec/nosefart/.hgignore | 6 ++++++ src/libxinevdec/.cvsignore | 6 ------ src/libxinevdec/.hgignore | 6 ++++++ src/post/.cvsignore | 2 -- src/post/.hgignore | 2 ++ src/post/audio/.cvsignore | 6 ------ src/post/audio/.hgignore | 6 ++++++ src/post/deinterlace/.cvsignore | 6 ------ src/post/deinterlace/.hgignore | 6 ++++++ src/post/deinterlace/plugins/.cvsignore | 6 ------ src/post/deinterlace/plugins/.hgignore | 6 ++++++ src/post/goom/.cvsignore | 6 ------ src/post/goom/.hgignore | 6 ++++++ src/post/mosaico/.cvsignore | 6 ------ src/post/mosaico/.hgignore | 6 ++++++ src/post/planar/.cvsignore | 6 ------ src/post/planar/.hgignore | 6 ++++++ src/post/visualizations/.cvsignore | 6 ------ src/post/visualizations/.hgignore | 6 ++++++ src/video_out/.cvsignore | 6 ------ src/video_out/.hgignore | 6 ++++++ src/video_out/libdha/.cvsignore | 11 ----------- src/video_out/libdha/.hgignore | 11 +++++++++++ src/video_out/libdha/bin/.cvsignore | 6 ------ src/video_out/libdha/bin/.hgignore | 6 ++++++ src/video_out/libdha/kernelhelper/.cvsignore | 6 ------ src/video_out/libdha/kernelhelper/.hgignore | 6 ++++++ src/video_out/libdha/oth/.cvsignore | 6 ------ src/video_out/libdha/oth/.hgignore | 6 ++++++ src/video_out/libdha/sysdep/.cvsignore | 6 ------ src/video_out/libdha/sysdep/.hgignore | 6 ++++++ src/video_out/macosx/.cvsignore | 6 ------ src/video_out/macosx/.hgignore | 6 ++++++ src/video_out/vidix/.cvsignore | 6 ------ src/video_out/vidix/.hgignore | 6 ++++++ src/video_out/vidix/drivers/.cvsignore | 6 ------ src/video_out/vidix/drivers/.hgignore | 6 ++++++ src/xine-engine/.cvsignore | 6 ------ src/xine-engine/.hgignore | 6 ++++++ src/xine-utils/.cvsignore | 6 ------ src/xine-utils/.hgignore | 6 ++++++ 156 files changed, 426 insertions(+), 426 deletions(-) delete mode 100644 src/.cvsignore create mode 100644 src/.hgignore delete mode 100644 src/audio_out/.cvsignore create mode 100644 src/audio_out/.hgignore delete mode 100644 src/combined/.cvsignore create mode 100644 src/combined/.hgignore delete mode 100644 src/demuxers/.cvsignore create mode 100644 src/demuxers/.hgignore delete mode 100644 src/dxr3/.cvsignore create mode 100644 src/dxr3/.hgignore delete mode 100644 src/input/.cvsignore create mode 100644 src/input/.hgignore delete mode 100644 src/input/dvb/.cvsignore create mode 100644 src/input/dvb/.hgignore delete mode 100644 src/input/libdvdnav/.cvsignore create mode 100644 src/input/libdvdnav/.hgignore delete mode 100644 src/input/libreal/.cvsignore create mode 100644 src/input/libreal/.hgignore delete mode 100644 src/input/librtsp/.cvsignore create mode 100644 src/input/librtsp/.hgignore delete mode 100644 src/input/vcd/.cvsignore create mode 100644 src/input/vcd/.hgignore delete mode 100644 src/input/vcd/libcdio/.cvsignore create mode 100644 src/input/vcd/libcdio/.hgignore delete mode 100644 src/input/vcd/libcdio/MSWindows/.cvsignore create mode 100644 src/input/vcd/libcdio/MSWindows/.hgignore delete mode 100644 src/input/vcd/libcdio/cdio/.cvsignore create mode 100644 src/input/vcd/libcdio/cdio/.hgignore delete mode 100644 src/input/vcd/libcdio/image/.cvsignore create mode 100644 src/input/vcd/libcdio/image/.hgignore delete mode 100644 src/input/vcd/libvcd/.cvsignore create mode 100644 src/input/vcd/libvcd/.hgignore delete mode 100644 src/input/vcd/libvcd/libvcd/.cvsignore create mode 100644 src/input/vcd/libvcd/libvcd/.hgignore delete mode 100644 src/liba52/.cvsignore create mode 100644 src/liba52/.hgignore delete mode 100644 src/libdts/.cvsignore create mode 100644 src/libdts/.hgignore delete mode 100644 src/libfaad/.cvsignore create mode 100644 src/libfaad/.hgignore delete mode 100644 src/libfaad/codebook/.cvsignore create mode 100644 src/libfaad/codebook/.hgignore delete mode 100644 src/libffmpeg/.cvsignore create mode 100644 src/libffmpeg/.hgignore delete mode 100644 src/libffmpeg/libavcodec/.cvsignore create mode 100644 src/libffmpeg/libavcodec/.hgignore delete mode 100644 src/libffmpeg/libavcodec/alpha/.cvsignore create mode 100644 src/libffmpeg/libavcodec/alpha/.hgignore delete mode 100644 src/libffmpeg/libavcodec/armv4l/.cvsignore create mode 100644 src/libffmpeg/libavcodec/armv4l/.hgignore delete mode 100644 src/libffmpeg/libavcodec/i386/.cvsignore create mode 100644 src/libffmpeg/libavcodec/i386/.hgignore delete mode 100644 src/libffmpeg/libavcodec/libpostproc/.cvsignore create mode 100644 src/libffmpeg/libavcodec/libpostproc/.hgignore delete mode 100644 src/libffmpeg/libavcodec/mlib/.cvsignore create mode 100644 src/libffmpeg/libavcodec/mlib/.hgignore delete mode 100644 src/libffmpeg/libavcodec/ppc/.cvsignore create mode 100644 src/libffmpeg/libavcodec/ppc/.hgignore delete mode 100644 src/libffmpeg/libavcodec/sparc/.cvsignore create mode 100644 src/libffmpeg/libavcodec/sparc/.hgignore delete mode 100644 src/libffmpeg/libavutil/.cvsignore create mode 100644 src/libffmpeg/libavutil/.hgignore delete mode 100644 src/libflac/.cvsignore create mode 100644 src/libflac/.hgignore delete mode 100644 src/liblpcm/.cvsignore create mode 100644 src/liblpcm/.hgignore delete mode 100644 src/libmad/.cvsignore create mode 100644 src/libmad/.hgignore delete mode 100644 src/libmpeg2/.cvsignore create mode 100644 src/libmpeg2/.hgignore delete mode 100644 src/libmpeg2new/.cvsignore create mode 100644 src/libmpeg2new/.hgignore delete mode 100644 src/libmpeg2new/include/.cvsignore create mode 100644 src/libmpeg2new/include/.hgignore delete mode 100644 src/libmpeg2new/libmpeg2/.cvsignore create mode 100644 src/libmpeg2new/libmpeg2/.hgignore delete mode 100644 src/libmusepack/.cvsignore create mode 100644 src/libmusepack/.hgignore delete mode 100644 src/libmusepack/musepack/.cvsignore create mode 100644 src/libmusepack/musepack/.hgignore delete mode 100644 src/libreal/.cvsignore create mode 100644 src/libreal/.hgignore delete mode 100644 src/libspeex/.cvsignore create mode 100644 src/libspeex/.hgignore delete mode 100644 src/libspucc/.cvsignore create mode 100644 src/libspucc/.hgignore delete mode 100644 src/libspucmml/.cvsignore create mode 100644 src/libspucmml/.hgignore delete mode 100644 src/libspudec/.cvsignore create mode 100644 src/libspudec/.hgignore delete mode 100644 src/libspudvb/.cvsignore create mode 100644 src/libspudvb/.hgignore delete mode 100644 src/libsputext/.cvsignore create mode 100644 src/libsputext/.hgignore delete mode 100644 src/libtheora/.cvsignore create mode 100644 src/libtheora/.hgignore delete mode 100644 src/libvorbis/.cvsignore create mode 100644 src/libvorbis/.hgignore delete mode 100644 src/libw32dll/.cvsignore create mode 100644 src/libw32dll/.hgignore delete mode 100644 src/libw32dll/DirectShow/.cvsignore create mode 100644 src/libw32dll/DirectShow/.hgignore delete mode 100644 src/libw32dll/dmo/.cvsignore create mode 100644 src/libw32dll/dmo/.hgignore delete mode 100644 src/libw32dll/qtx/.cvsignore create mode 100644 src/libw32dll/qtx/.hgignore delete mode 100644 src/libw32dll/qtx/qtxsdk/.cvsignore create mode 100644 src/libw32dll/qtx/qtxsdk/.hgignore delete mode 100644 src/libw32dll/wine/.cvsignore create mode 100644 src/libw32dll/wine/.hgignore delete mode 100644 src/libxineadec/.cvsignore create mode 100644 src/libxineadec/.hgignore delete mode 100644 src/libxineadec/gsm610/.cvsignore create mode 100644 src/libxineadec/gsm610/.hgignore delete mode 100644 src/libxineadec/nosefart/.cvsignore create mode 100644 src/libxineadec/nosefart/.hgignore delete mode 100644 src/libxinevdec/.cvsignore create mode 100644 src/libxinevdec/.hgignore delete mode 100644 src/post/.cvsignore create mode 100644 src/post/.hgignore delete mode 100644 src/post/audio/.cvsignore create mode 100644 src/post/audio/.hgignore delete mode 100644 src/post/deinterlace/.cvsignore create mode 100644 src/post/deinterlace/.hgignore delete mode 100644 src/post/deinterlace/plugins/.cvsignore create mode 100644 src/post/deinterlace/plugins/.hgignore delete mode 100644 src/post/goom/.cvsignore create mode 100644 src/post/goom/.hgignore delete mode 100644 src/post/mosaico/.cvsignore create mode 100644 src/post/mosaico/.hgignore delete mode 100644 src/post/planar/.cvsignore create mode 100644 src/post/planar/.hgignore delete mode 100644 src/post/visualizations/.cvsignore create mode 100644 src/post/visualizations/.hgignore delete mode 100644 src/video_out/.cvsignore create mode 100644 src/video_out/.hgignore delete mode 100644 src/video_out/libdha/.cvsignore create mode 100644 src/video_out/libdha/.hgignore delete mode 100644 src/video_out/libdha/bin/.cvsignore create mode 100644 src/video_out/libdha/bin/.hgignore delete mode 100644 src/video_out/libdha/kernelhelper/.cvsignore create mode 100644 src/video_out/libdha/kernelhelper/.hgignore delete mode 100644 src/video_out/libdha/oth/.cvsignore create mode 100644 src/video_out/libdha/oth/.hgignore delete mode 100644 src/video_out/libdha/sysdep/.cvsignore create mode 100644 src/video_out/libdha/sysdep/.hgignore delete mode 100644 src/video_out/macosx/.cvsignore create mode 100644 src/video_out/macosx/.hgignore delete mode 100644 src/video_out/vidix/.cvsignore create mode 100644 src/video_out/vidix/.hgignore delete mode 100644 src/video_out/vidix/drivers/.cvsignore create mode 100644 src/video_out/vidix/drivers/.hgignore delete mode 100644 src/xine-engine/.cvsignore create mode 100644 src/xine-engine/.hgignore delete mode 100644 src/xine-utils/.cvsignore create mode 100644 src/xine-utils/.hgignore (limited to 'src') diff --git a/src/.cvsignore b/src/.cvsignore deleted file mode 100644 index 282522db0..000000000 --- a/src/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/src/.hgignore b/src/.hgignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/src/.hgignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/src/audio_out/.cvsignore b/src/audio_out/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/audio_out/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/audio_out/.hgignore b/src/audio_out/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/audio_out/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/combined/.cvsignore b/src/combined/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/combined/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/combined/.hgignore b/src/combined/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/combined/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/demuxers/.cvsignore b/src/demuxers/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/demuxers/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/demuxers/.hgignore b/src/demuxers/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/demuxers/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/dxr3/.cvsignore b/src/dxr3/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/dxr3/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/dxr3/.hgignore b/src/dxr3/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/dxr3/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/input/.cvsignore b/src/input/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/input/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/input/.hgignore b/src/input/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/input/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/input/dvb/.cvsignore b/src/input/dvb/.cvsignore deleted file mode 100644 index 282522db0..000000000 --- a/src/input/dvb/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/src/input/dvb/.hgignore b/src/input/dvb/.hgignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/src/input/dvb/.hgignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/src/input/libdvdnav/.cvsignore b/src/input/libdvdnav/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/input/libdvdnav/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/input/libdvdnav/.hgignore b/src/input/libdvdnav/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/input/libdvdnav/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/input/libreal/.cvsignore b/src/input/libreal/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/input/libreal/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/input/libreal/.hgignore b/src/input/libreal/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/input/libreal/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/input/librtsp/.cvsignore b/src/input/librtsp/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/input/librtsp/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/input/librtsp/.hgignore b/src/input/librtsp/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/input/librtsp/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/input/vcd/.cvsignore b/src/input/vcd/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/input/vcd/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/input/vcd/.hgignore b/src/input/vcd/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/input/vcd/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/input/vcd/libcdio/.cvsignore b/src/input/vcd/libcdio/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/input/vcd/libcdio/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/input/vcd/libcdio/.hgignore b/src/input/vcd/libcdio/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/input/vcd/libcdio/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/input/vcd/libcdio/MSWindows/.cvsignore b/src/input/vcd/libcdio/MSWindows/.cvsignore deleted file mode 100644 index 282522db0..000000000 --- a/src/input/vcd/libcdio/MSWindows/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/src/input/vcd/libcdio/MSWindows/.hgignore b/src/input/vcd/libcdio/MSWindows/.hgignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/src/input/vcd/libcdio/MSWindows/.hgignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/src/input/vcd/libcdio/cdio/.cvsignore b/src/input/vcd/libcdio/cdio/.cvsignore deleted file mode 100644 index 282522db0..000000000 --- a/src/input/vcd/libcdio/cdio/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/src/input/vcd/libcdio/cdio/.hgignore b/src/input/vcd/libcdio/cdio/.hgignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/src/input/vcd/libcdio/cdio/.hgignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/src/input/vcd/libcdio/image/.cvsignore b/src/input/vcd/libcdio/image/.cvsignore deleted file mode 100644 index 282522db0..000000000 --- a/src/input/vcd/libcdio/image/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/src/input/vcd/libcdio/image/.hgignore b/src/input/vcd/libcdio/image/.hgignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/src/input/vcd/libcdio/image/.hgignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/src/input/vcd/libvcd/.cvsignore b/src/input/vcd/libvcd/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/input/vcd/libvcd/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/input/vcd/libvcd/.hgignore b/src/input/vcd/libvcd/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/input/vcd/libvcd/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/input/vcd/libvcd/libvcd/.cvsignore b/src/input/vcd/libvcd/libvcd/.cvsignore deleted file mode 100644 index 282522db0..000000000 --- a/src/input/vcd/libvcd/libvcd/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/src/input/vcd/libvcd/libvcd/.hgignore b/src/input/vcd/libvcd/libvcd/.hgignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/src/input/vcd/libvcd/libvcd/.hgignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/src/liba52/.cvsignore b/src/liba52/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/liba52/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/liba52/.hgignore b/src/liba52/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/liba52/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libdts/.cvsignore b/src/libdts/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libdts/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libdts/.hgignore b/src/libdts/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libdts/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libfaad/.cvsignore b/src/libfaad/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libfaad/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libfaad/.hgignore b/src/libfaad/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libfaad/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libfaad/codebook/.cvsignore b/src/libfaad/codebook/.cvsignore deleted file mode 100644 index 282522db0..000000000 --- a/src/libfaad/codebook/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/src/libfaad/codebook/.hgignore b/src/libfaad/codebook/.hgignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/src/libfaad/codebook/.hgignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/src/libffmpeg/.cvsignore b/src/libffmpeg/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libffmpeg/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libffmpeg/.hgignore b/src/libffmpeg/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libffmpeg/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libffmpeg/libavcodec/.cvsignore b/src/libffmpeg/libavcodec/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libffmpeg/libavcodec/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libffmpeg/libavcodec/.hgignore b/src/libffmpeg/libavcodec/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libffmpeg/libavcodec/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libffmpeg/libavcodec/alpha/.cvsignore b/src/libffmpeg/libavcodec/alpha/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libffmpeg/libavcodec/alpha/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libffmpeg/libavcodec/alpha/.hgignore b/src/libffmpeg/libavcodec/alpha/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libffmpeg/libavcodec/alpha/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libffmpeg/libavcodec/armv4l/.cvsignore b/src/libffmpeg/libavcodec/armv4l/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libffmpeg/libavcodec/armv4l/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libffmpeg/libavcodec/armv4l/.hgignore b/src/libffmpeg/libavcodec/armv4l/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libffmpeg/libavcodec/armv4l/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libffmpeg/libavcodec/i386/.cvsignore b/src/libffmpeg/libavcodec/i386/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libffmpeg/libavcodec/i386/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libffmpeg/libavcodec/i386/.hgignore b/src/libffmpeg/libavcodec/i386/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libffmpeg/libavcodec/i386/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libffmpeg/libavcodec/libpostproc/.cvsignore b/src/libffmpeg/libavcodec/libpostproc/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libffmpeg/libavcodec/libpostproc/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libffmpeg/libavcodec/libpostproc/.hgignore b/src/libffmpeg/libavcodec/libpostproc/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libffmpeg/libavcodec/libpostproc/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libffmpeg/libavcodec/mlib/.cvsignore b/src/libffmpeg/libavcodec/mlib/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libffmpeg/libavcodec/mlib/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libffmpeg/libavcodec/mlib/.hgignore b/src/libffmpeg/libavcodec/mlib/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libffmpeg/libavcodec/mlib/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libffmpeg/libavcodec/ppc/.cvsignore b/src/libffmpeg/libavcodec/ppc/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libffmpeg/libavcodec/ppc/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libffmpeg/libavcodec/ppc/.hgignore b/src/libffmpeg/libavcodec/ppc/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libffmpeg/libavcodec/ppc/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libffmpeg/libavcodec/sparc/.cvsignore b/src/libffmpeg/libavcodec/sparc/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libffmpeg/libavcodec/sparc/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libffmpeg/libavcodec/sparc/.hgignore b/src/libffmpeg/libavcodec/sparc/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libffmpeg/libavcodec/sparc/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libffmpeg/libavutil/.cvsignore b/src/libffmpeg/libavutil/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libffmpeg/libavutil/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libffmpeg/libavutil/.hgignore b/src/libffmpeg/libavutil/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libffmpeg/libavutil/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libflac/.cvsignore b/src/libflac/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libflac/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libflac/.hgignore b/src/libflac/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libflac/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/liblpcm/.cvsignore b/src/liblpcm/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/liblpcm/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/liblpcm/.hgignore b/src/liblpcm/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/liblpcm/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libmad/.cvsignore b/src/libmad/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libmad/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libmad/.hgignore b/src/libmad/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libmad/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libmpeg2/.cvsignore b/src/libmpeg2/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libmpeg2/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libmpeg2/.hgignore b/src/libmpeg2/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libmpeg2/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libmpeg2new/.cvsignore b/src/libmpeg2new/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libmpeg2new/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libmpeg2new/.hgignore b/src/libmpeg2new/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libmpeg2new/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libmpeg2new/include/.cvsignore b/src/libmpeg2new/include/.cvsignore deleted file mode 100644 index 282522db0..000000000 --- a/src/libmpeg2new/include/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/src/libmpeg2new/include/.hgignore b/src/libmpeg2new/include/.hgignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/src/libmpeg2new/include/.hgignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/src/libmpeg2new/libmpeg2/.cvsignore b/src/libmpeg2new/libmpeg2/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libmpeg2new/libmpeg2/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libmpeg2new/libmpeg2/.hgignore b/src/libmpeg2new/libmpeg2/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libmpeg2new/libmpeg2/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libmusepack/.cvsignore b/src/libmusepack/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libmusepack/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libmusepack/.hgignore b/src/libmusepack/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libmusepack/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libmusepack/musepack/.cvsignore b/src/libmusepack/musepack/.cvsignore deleted file mode 100644 index 282522db0..000000000 --- a/src/libmusepack/musepack/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/src/libmusepack/musepack/.hgignore b/src/libmusepack/musepack/.hgignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/src/libmusepack/musepack/.hgignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/src/libreal/.cvsignore b/src/libreal/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libreal/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libreal/.hgignore b/src/libreal/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libreal/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libspeex/.cvsignore b/src/libspeex/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libspeex/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libspeex/.hgignore b/src/libspeex/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libspeex/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libspucc/.cvsignore b/src/libspucc/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libspucc/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libspucc/.hgignore b/src/libspucc/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libspucc/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libspucmml/.cvsignore b/src/libspucmml/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libspucmml/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libspucmml/.hgignore b/src/libspucmml/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libspucmml/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libspudec/.cvsignore b/src/libspudec/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libspudec/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libspudec/.hgignore b/src/libspudec/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libspudec/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libspudvb/.cvsignore b/src/libspudvb/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libspudvb/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libspudvb/.hgignore b/src/libspudvb/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libspudvb/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libsputext/.cvsignore b/src/libsputext/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libsputext/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libsputext/.hgignore b/src/libsputext/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libsputext/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libtheora/.cvsignore b/src/libtheora/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libtheora/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libtheora/.hgignore b/src/libtheora/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libtheora/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libvorbis/.cvsignore b/src/libvorbis/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libvorbis/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libvorbis/.hgignore b/src/libvorbis/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libvorbis/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libw32dll/.cvsignore b/src/libw32dll/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libw32dll/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libw32dll/.hgignore b/src/libw32dll/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libw32dll/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libw32dll/DirectShow/.cvsignore b/src/libw32dll/DirectShow/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libw32dll/DirectShow/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libw32dll/DirectShow/.hgignore b/src/libw32dll/DirectShow/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libw32dll/DirectShow/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libw32dll/dmo/.cvsignore b/src/libw32dll/dmo/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libw32dll/dmo/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libw32dll/dmo/.hgignore b/src/libw32dll/dmo/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libw32dll/dmo/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libw32dll/qtx/.cvsignore b/src/libw32dll/qtx/.cvsignore deleted file mode 100644 index 22a4e7292..000000000 --- a/src/libw32dll/qtx/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -Makefile -Makefile.in - diff --git a/src/libw32dll/qtx/.hgignore b/src/libw32dll/qtx/.hgignore new file mode 100644 index 000000000..22a4e7292 --- /dev/null +++ b/src/libw32dll/qtx/.hgignore @@ -0,0 +1,3 @@ +Makefile +Makefile.in + diff --git a/src/libw32dll/qtx/qtxsdk/.cvsignore b/src/libw32dll/qtx/qtxsdk/.cvsignore deleted file mode 100644 index 282522db0..000000000 --- a/src/libw32dll/qtx/qtxsdk/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/src/libw32dll/qtx/qtxsdk/.hgignore b/src/libw32dll/qtx/qtxsdk/.hgignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/src/libw32dll/qtx/qtxsdk/.hgignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/src/libw32dll/wine/.cvsignore b/src/libw32dll/wine/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libw32dll/wine/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libw32dll/wine/.hgignore b/src/libw32dll/wine/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libw32dll/wine/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libxineadec/.cvsignore b/src/libxineadec/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libxineadec/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libxineadec/.hgignore b/src/libxineadec/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libxineadec/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libxineadec/gsm610/.cvsignore b/src/libxineadec/gsm610/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libxineadec/gsm610/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libxineadec/gsm610/.hgignore b/src/libxineadec/gsm610/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libxineadec/gsm610/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libxineadec/nosefart/.cvsignore b/src/libxineadec/nosefart/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libxineadec/nosefart/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libxineadec/nosefart/.hgignore b/src/libxineadec/nosefart/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libxineadec/nosefart/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/libxinevdec/.cvsignore b/src/libxinevdec/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libxinevdec/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libxinevdec/.hgignore b/src/libxinevdec/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/libxinevdec/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/post/.cvsignore b/src/post/.cvsignore deleted file mode 100644 index 282522db0..000000000 --- a/src/post/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/src/post/.hgignore b/src/post/.hgignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/src/post/.hgignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/src/post/audio/.cvsignore b/src/post/audio/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/post/audio/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/post/audio/.hgignore b/src/post/audio/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/post/audio/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/post/deinterlace/.cvsignore b/src/post/deinterlace/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/post/deinterlace/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/post/deinterlace/.hgignore b/src/post/deinterlace/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/post/deinterlace/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/post/deinterlace/plugins/.cvsignore b/src/post/deinterlace/plugins/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/post/deinterlace/plugins/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/post/deinterlace/plugins/.hgignore b/src/post/deinterlace/plugins/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/post/deinterlace/plugins/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/post/goom/.cvsignore b/src/post/goom/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/post/goom/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/post/goom/.hgignore b/src/post/goom/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/post/goom/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/post/mosaico/.cvsignore b/src/post/mosaico/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/post/mosaico/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/post/mosaico/.hgignore b/src/post/mosaico/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/post/mosaico/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/post/planar/.cvsignore b/src/post/planar/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/post/planar/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/post/planar/.hgignore b/src/post/planar/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/post/planar/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/post/visualizations/.cvsignore b/src/post/visualizations/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/post/visualizations/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/post/visualizations/.hgignore b/src/post/visualizations/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/post/visualizations/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/video_out/.cvsignore b/src/video_out/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/video_out/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/video_out/.hgignore b/src/video_out/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/video_out/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/video_out/libdha/.cvsignore b/src/video_out/libdha/.cvsignore deleted file mode 100644 index ac32e12c7..000000000 --- a/src/video_out/libdha/.cvsignore +++ /dev/null @@ -1,11 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la -pci_dev_ids.c -pci_ids.h -pci_names.c -pci_names.h -pci_vendors.h diff --git a/src/video_out/libdha/.hgignore b/src/video_out/libdha/.hgignore new file mode 100644 index 000000000..ac32e12c7 --- /dev/null +++ b/src/video_out/libdha/.hgignore @@ -0,0 +1,11 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la +pci_dev_ids.c +pci_ids.h +pci_names.c +pci_names.h +pci_vendors.h diff --git a/src/video_out/libdha/bin/.cvsignore b/src/video_out/libdha/bin/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/video_out/libdha/bin/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/video_out/libdha/bin/.hgignore b/src/video_out/libdha/bin/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/video_out/libdha/bin/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/video_out/libdha/kernelhelper/.cvsignore b/src/video_out/libdha/kernelhelper/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/video_out/libdha/kernelhelper/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/video_out/libdha/kernelhelper/.hgignore b/src/video_out/libdha/kernelhelper/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/video_out/libdha/kernelhelper/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/video_out/libdha/oth/.cvsignore b/src/video_out/libdha/oth/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/video_out/libdha/oth/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/video_out/libdha/oth/.hgignore b/src/video_out/libdha/oth/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/video_out/libdha/oth/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/video_out/libdha/sysdep/.cvsignore b/src/video_out/libdha/sysdep/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/video_out/libdha/sysdep/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/video_out/libdha/sysdep/.hgignore b/src/video_out/libdha/sysdep/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/video_out/libdha/sysdep/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/video_out/macosx/.cvsignore b/src/video_out/macosx/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/video_out/macosx/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/video_out/macosx/.hgignore b/src/video_out/macosx/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/video_out/macosx/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/video_out/vidix/.cvsignore b/src/video_out/vidix/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/video_out/vidix/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/video_out/vidix/.hgignore b/src/video_out/vidix/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/video_out/vidix/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/video_out/vidix/drivers/.cvsignore b/src/video_out/vidix/drivers/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/video_out/vidix/drivers/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/video_out/vidix/drivers/.hgignore b/src/video_out/vidix/drivers/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/video_out/vidix/drivers/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/xine-engine/.cvsignore b/src/xine-engine/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/xine-engine/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/xine-engine/.hgignore b/src/xine-engine/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/xine-engine/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la diff --git a/src/xine-utils/.cvsignore b/src/xine-utils/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/xine-utils/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/xine-utils/.hgignore b/src/xine-utils/.hgignore new file mode 100644 index 000000000..7d926a554 --- /dev/null +++ b/src/xine-utils/.hgignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la -- cgit v1.2.3