Originally committed as revision 4749 to svn://svn.ffmpeg.org/ffmpeg/trunktags/v0.5
| @@ -146,7 +146,7 @@ such a program is covered only if its contents constitute a work based | |||
| on the Library (independent of the use of the Library in a tool for | |||
| writing it). Whether that is true depends on what the Library does | |||
| and what the program that uses the Library does. | |||
| 1. You may copy and distribute verbatim copies of the Library's | |||
| complete source code as you receive it, in any medium, provided that | |||
| you conspicuously and appropriately publish on each copy an | |||
| @@ -11,7 +11,7 @@ version <next> | |||
| - Nullsoft Video (NSV) file demuxer | |||
| - Shorten audio decoder | |||
| - LOCO video decoder | |||
| - Apple Lossless Audio Codec (ALAC) decoder | |||
| - Apple Lossless Audio Codec (ALAC) decoder | |||
| - Winnov WNV1 video decoder | |||
| - Autodesk Animator Studio Codec (AASC) decoder | |||
| - Indeo 2 video decoder | |||
| @@ -1,6 +1,6 @@ | |||
| 1) Type './configure' create the configuration (use './configure | |||
| --help' to have the configure options). | |||
| --help' to have the configure options). | |||
| 'configure' can be launched from another directory than the ffmpeg | |||
| sources to put the objects at that place. In that case, use an | |||
| @@ -7,7 +7,7 @@ include config.mak | |||
| VPATH=$(SRC_PATH) | |||
| CFLAGS=$(OPTFLAGS) -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavutil -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE | |||
| LDFLAGS+= -g | |||
| LDFLAGS+= -g | |||
| ifeq ($(TARGET_GPROF),yes) | |||
| CFLAGS+=-p | |||
| @@ -75,7 +75,7 @@ ffmpeg$(EXESUF): ffmpeg_g$(EXESUF) | |||
| $(STRIP) $@ | |||
| ffserver$(EXESUF): ffserver.o .libs | |||
| $(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS) | |||
| $(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS) | |||
| ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs | |||
| $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS) | |||
| @@ -94,10 +94,10 @@ cws2fws$(EXESUF): cws2fws.c | |||
| $(CC) $(SRC_PATH)/cws2fws.c -o cws2fws$(EXESUF) -lz | |||
| ffplay.o: ffplay.c | |||
| $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $< | |||
| $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $< | |||
| %.o: %.c | |||
| $(CC) $(CFLAGS) -c -o $@ $< | |||
| $(CC) $(CFLAGS) -c -o $@ $< | |||
| videohook: .libs | |||
| $(MAKE) -C vhook all | |||
| @@ -11,7 +11,7 @@ FFmpeg README | |||
| * Read the file COPYING. ffmpeg and the associated libraries EXCEPT | |||
| liba52 and libpostproc are licensed under the Lesser GNU General | |||
| Public License. | |||
| Public License. | |||
| * liba52 and libpostproc are distributed under the GNU General Public | |||
| License and their compilation and use is optional in ffmpeg. | |||
| @@ -8,37 +8,37 @@ | |||
| #ifdef ENOENT | |||
| #undef ENOENT | |||
| #endif | |||
| #endif | |||
| #define ENOENT 2 | |||
| #ifdef EINTR | |||
| #undef EINTR | |||
| #endif | |||
| #endif | |||
| #define EINTR 4 | |||
| #ifdef EIO | |||
| #undef EIO | |||
| #endif | |||
| #endif | |||
| #define EIO 5 | |||
| #ifdef EAGAIN | |||
| #undef EAGAIN | |||
| #endif | |||
| #endif | |||
| #define EAGAIN 11 | |||
| #ifdef ENOMEM | |||
| #undef ENOMEM | |||
| #endif | |||
| #endif | |||
| #define ENOMEM 12 | |||
| #ifdef EINVAL | |||
| #undef EINVAL | |||
| #endif | |||
| #endif | |||
| #define EINVAL 22 | |||
| #ifdef EPIPE | |||
| #undef EPIPE | |||
| #endif | |||
| #endif | |||
| #define EPIPE 32 | |||
| #endif /* BERRNO_H */ | |||
| @@ -7,4 +7,3 @@ sed 's/unsigned//g' |\ | |||
| sed 's/TYPE_AVRATIONAL/TYPE_RATIONAL/g'|\ | |||
| sed 's/FLOAT_M/FLT_M/g'|\ | |||
| sed 's/FF_OPT_TYPE_CHAR/FF_OPT_TYPE_STRING/g' | |||
| @@ -64,7 +64,7 @@ void parse_options(int argc, char **argv, const OptionDef *options) | |||
| optindex = 1; | |||
| while (optindex < argc) { | |||
| opt = argv[optindex++]; | |||
| if (opt[0] == '-' && opt[1] != '\0') { | |||
| po= find_option(options, opt + 1); | |||
| if (!po->name) | |||
| @@ -111,7 +111,7 @@ void print_error(const char *filename, int err) | |||
| fprintf(stderr, "%s: Incorrect image filename syntax.\n" | |||
| "Use '%%d' to specify the image number:\n" | |||
| " for img1.jpg, img2.jpg, ..., use 'img%%d.jpg';\n" | |||
| " for img001.jpg, img002.jpg, ..., use 'img%%03d.jpg'.\n", | |||
| " for img001.jpg, img002.jpg, ..., use 'img%%03d.jpg'.\n", | |||
| filename); | |||
| break; | |||
| case AVERROR_INVALIDDATA: | |||
| @@ -555,7 +555,7 @@ for opt do | |||
| --enable-amr_nb-fixed) amr_nb_fixed="yes" | |||
| ;; | |||
| --enable-amr_wb) amr_wb="yes" | |||
| ;; | |||
| ;; | |||
| --enable-amr_if2) amr_if2="yes" | |||
| ;; | |||
| --enable-sunmlib) sunmlib="yes" | |||
| @@ -629,13 +629,13 @@ if test "$gpl" != "yes"; then | |||
| echo "libdts is under GPL and --enable-gpl is not specified." | |||
| fail="yes" | |||
| fi | |||
| if test "$faad" != "no" -o "$faadbin" != "no"; then | |||
| cat > $TMPC << EOF | |||
| #include <faad.h> | |||
| int main( void ) { return 0; } | |||
| EOF | |||
| if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then | |||
| cat > $TMPC << EOF | |||
| #include <faad.h> | |||
| @@ -654,7 +654,7 @@ EOF | |||
| echo "FAAD test failed." | |||
| fi | |||
| fi | |||
| if test "$fail" = "yes"; then | |||
| exit 1 | |||
| @@ -673,7 +673,7 @@ fi | |||
| # check iwmmxt support | |||
| if test $iwmmxt = "default" -a $cpu = "armv4l"; then | |||
| cat > $TMPC << EOF | |||
| int main(void) { | |||
| int main(void) { | |||
| __asm__ __volatile__ ("wunpckelub wr6, wr4"); | |||
| } | |||
| EOF | |||
| @@ -692,7 +692,7 @@ if test $targetos = Darwin; then | |||
| else | |||
| gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`" | |||
| case "$gcc_version" in | |||
| *2.95*) | |||
| *2.95*) | |||
| CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer" | |||
| ;; | |||
| *[34].*) | |||
| @@ -784,7 +784,7 @@ if test $tune != "generic"; then | |||
| esac | |||
| fi | |||
| # AltiVec flags: The FSF version of GCC differs from the Apple version | |||
| # AltiVec flags: The FSF version of GCC differs from the Apple version | |||
| if test $cpu = "powerpc"; then | |||
| if test $altivec = "yes"; then | |||
| if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then | |||
| @@ -1009,7 +1009,7 @@ done | |||
| # currently only used on i386 for MMX builtins | |||
| cat > $TMPC << EOF | |||
| #include <xmmintrin.h> | |||
| int main(void) { | |||
| int main(void) { | |||
| #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2) | |||
| return 0; | |||
| #else | |||
| @@ -1812,7 +1812,7 @@ includedir=\${prefix}/include | |||
| Name: libavutil | |||
| Description: FFmpeg utility library | |||
| Version: $lavu_version | |||
| Requires: | |||
| Requires: | |||
| Conflicts: | |||
| Libs: -L\${libdir} -lavutil | |||
| Cflags: -I\${includedir} -I\${includedir}/ffmpeg | |||
| @@ -1827,7 +1827,7 @@ includedir=\${pcfiledir}/libavutil | |||
| Name: libavutil | |||
| Description: FFmpeg utility library | |||
| Version: $lavu_version | |||
| Requires: | |||
| Requires: | |||
| Conflicts: | |||
| Libs: \${libdir}/${LIBPREF}avutil${LIBSUF} | |||
| Cflags: -I\${includedir} | |||
| @@ -1906,7 +1906,7 @@ includedir=\${prefix}/include | |||
| Name: libpostproc | |||
| Description: FFmpeg post processing library | |||
| Version: $lavc_version | |||
| Requires: | |||
| Requires: | |||
| Conflicts: | |||
| Libs: -L\${libdir} -lpostproc | |||
| Cflags: -I\${includedir} -I\${includedir}/postproc | |||
| @@ -1921,7 +1921,7 @@ includedir=\${pcfiledir}/libavcodec/libpostproc | |||
| Name: libpostproc | |||
| Description: FFmpeg post processing library | |||
| Version: $lavc_version | |||
| Requires: | |||
| Requires: | |||
| Conflicts: | |||
| Libs: \${libdir}/${LIBPREF}postproc${LIBSUF} | |||
| Cflags: -I\${includedir} | |||
| @@ -28,7 +28,7 @@ main(int argc, char *argv[]) | |||
| printf("Usage: %s <infile.swf> <outfile.swf>\n", argv[0]); | |||
| exit(1); | |||
| } | |||
| fd_in = open(argv[1], O_RDONLY); | |||
| if (fd_in < 0) | |||
| { | |||
| @@ -43,7 +43,7 @@ main(int argc, char *argv[]) | |||
| close(fd_in); | |||
| exit(1); | |||
| } | |||
| if (read(fd_in, &buf_in, 8) != 8) | |||
| { | |||
| printf("Header error\n"); | |||
| @@ -51,7 +51,7 @@ main(int argc, char *argv[]) | |||
| close(fd_out); | |||
| exit(1); | |||
| } | |||
| if (buf_in[0] != 'C' || buf_in[1] != 'W' || buf_in[2] != 'S') | |||
| { | |||
| printf("Not a compressed flash file\n"); | |||
| @@ -61,7 +61,7 @@ main(int argc, char *argv[]) | |||
| fstat(fd_in, &statbuf); | |||
| comp_len = statbuf.st_size; | |||
| uncomp_len = buf_in[4] | (buf_in[5] << 8) | (buf_in[6] << 16) | (buf_in[7] << 24); | |||
| printf("Compressed size: %d Uncompressed size: %d\n", comp_len-4, uncomp_len-4); | |||
| // write out modified header | |||
| @@ -72,20 +72,20 @@ main(int argc, char *argv[]) | |||
| zstream.zfree = NULL; | |||
| zstream.opaque = NULL; | |||
| inflateInit(&zstream); | |||
| for (i = 0; i < comp_len-4;) | |||
| { | |||
| int ret, len = read(fd_in, &buf_in, 1024); | |||
| dbgprintf("read %d bytes\n", len); | |||
| last_out = zstream.total_out; | |||
| zstream.next_in = &buf_in[0]; | |||
| zstream.avail_in = len; | |||
| zstream.next_out = &buf_out[0]; | |||
| zstream.avail_out = 1024; | |||
| ret = inflate(&zstream, Z_SYNC_FLUSH); | |||
| if (ret == Z_STREAM_END || ret == Z_BUF_ERROR) | |||
| break; | |||
| @@ -95,16 +95,16 @@ main(int argc, char *argv[]) | |||
| inflateEnd(&zstream); | |||
| exit(1); | |||
| } | |||
| dbgprintf("a_in: %d t_in: %d a_out: %d t_out: %d -- %d out\n", | |||
| zstream.avail_in, zstream.total_in, zstream.avail_out, zstream.total_out, | |||
| zstream.total_out-last_out); | |||
| write(fd_out, &buf_out, zstream.total_out-last_out); | |||
| i += len; | |||
| } | |||
| if (zstream.total_out != uncomp_len-8) | |||
| { | |||
| printf("Size mismatch (%d != %d), updating header...\n", | |||
| @@ -114,11 +114,11 @@ main(int argc, char *argv[]) | |||
| buf_in[1] = (zstream.total_out+8 >> 8) & 0xff; | |||
| buf_in[2] = (zstream.total_out+8 >> 16) & 0xff; | |||
| buf_in[3] = (zstream.total_out+8 >> 24) & 0xff; | |||
| lseek(fd_out, 4, SEEK_SET); | |||
| write(fd_out, &buf_in, 4); | |||
| } | |||
| inflateEnd(&zstream); | |||
| close(fd_in); | |||
| close(fd_out); | |||
| @@ -5,13 +5,13 @@ Fabrice's TODO list: (unordered) | |||
| ------------------- | |||
| Short term: | |||
| - av_read_frame() API | |||
| - av_read_frame() API | |||
| - seeking API and example in ffplay | |||
| - parse_only mode | |||
| - use AVFMTCTX_DISCARD_PKT in ffplay so that DV has a chance to work | |||
| - add RTSP regression test (both client and server) | |||
| - make ffserver allocate AVFormatContext | |||
| - clean up (incompatible change, for 0.5.0): | |||
| - clean up (incompatible change, for 0.5.0): | |||
| * AVStream -> AVComponent | |||
| * AVFormatContext -> AVInputStream/AVOutputStream | |||
| * suppress rate_emu from AVCodecContext | |||
| @@ -54,7 +54,7 @@ Francois' TODO list: (unordered, without any timeframe) | |||
| Philip'a TODO list: (alphabetically ordered) (please help) | |||
| ------------------ | |||
| - Add a multi-ffm filetype so that feeds can be recorded into multiple files rather | |||
| than one big file. | |||
| than one big file. | |||
| - Authenticated users support -- where the authentication is in the URL | |||
| - Change ASF files so that the embedded timestamp in the frames is right rather | |||
| than being an offset from the start of the stream | |||
| @@ -53,7 +53,7 @@ Use @file{-} as filename. | |||
| @section Why does ffmpeg not decode audio in VOB files ? | |||
| The audio is AC3 (a.k.a. A/52). AC3 decoding is an optional component in ffmpeg | |||
| as the component that handles AC3 decoding (liba52) is currently released under | |||
| as the component that handles AC3 decoding (liba52) is currently released under | |||
| the GPL. If you have liba52 installed on your system, enable AC3 decoding | |||
| with @code{./configure --enable-a52}. Take care: by | |||
| enabling AC3, you automatically change the license of libavcodec from | |||
| @@ -61,7 +61,7 @@ LGPL to GPL. | |||
| @section Which codecs are supported by Windows ? | |||
| Windows does not support standard formats like MPEG very well, unless you | |||
| Windows does not support standard formats like MPEG very well, unless you | |||
| install some additional codecs | |||
| The following list of video codecs should work on most Windows systems: | |||
| @@ -79,8 +79,8 @@ only if you have some MPEG-4 codec installed like ffdshow or XviD | |||
| @item mpeg1 | |||
| .mpg only | |||
| @end table | |||
| Note, ASF files often have .wmv or .wma extensions in Windows. It should also | |||
| be mentioned that Microsoft claims a patent on the ASF format, and may sue | |||
| Note, ASF files often have .wmv or .wma extensions in Windows. It should also | |||
| be mentioned that Microsoft claims a patent on the ASF format, and may sue | |||
| or threaten users who create ASF files with non-Microsoft software. It is | |||
| strongly advised to avoid ASF where possible. | |||
| @@ -95,7 +95,7 @@ if some MP3 codec like LAME is installed | |||
| @section Why does the chrominance data seem to be sampled at a different time from the luminance data on bt8x8 captures on Linux? | |||
| This is a well-known bug in the bt8x8 driver. For 2.4.26 there is a patch at | |||
| This is a well-known bug in the bt8x8 driver. For 2.4.26 there is a patch at | |||
| (@url{http://www.mplayerhq.hu/~michael/bttv-420-2.4.26.patch}). This may also | |||
| apply cleanly to other 2.4-series kernels. | |||
| @@ -132,8 +132,8 @@ Both XviD and DivX (version 4+) are implementations of the ISO MPEG-4 | |||
| standard (note that there are many other coding formats that use this | |||
| same standard). Thus, use '-vcodec mpeg4' to encode these formats. The | |||
| default fourcc stored in an MPEG-4-coded file will be 'FMP4'. If you want | |||
| a different fourcc, use the '-vtag' option. E.g., '-vtag xvid' will | |||
| force the fourcc 'xvid' to be stored as the video fourcc rather than the | |||
| a different fourcc, use the '-vtag' option. E.g., '-vtag xvid' will | |||
| force the fourcc 'xvid' to be stored as the video fourcc rather than the | |||
| default. | |||
| @chapter Development | |||
| @@ -149,7 +149,7 @@ it implemented is to undertake the task yourself. | |||
| @section Are there examples illustrating how to use the FFmpeg libraries, particularly libavcodec and libavformat ? | |||
| Yes. Read the Developers Guide of the FFmpeg documentation. Alternatively, | |||
| examine the source code for one of the many open source projects that | |||
| examine the source code for one of the many open source projects that | |||
| already incorporate ffmpeg at (@url{projects.php}). | |||
| @section Can you support my C compiler XXX ? | |||
| @@ -174,7 +174,7 @@ terms of portability. | |||
| @section Why not rewrite ffmpeg in object-oriented C++ ? | |||
| ffmpeg is already organized in a highly modular manner and does not need to | |||
| be rewritten in a formal object language. Further, many of the developers | |||
| be rewritten in a formal object language. Further, many of the developers | |||
| favor straight C; it works for them. For more arguments on this matter, | |||
| read "Programming Religion" at (@url{http://lkml.org/faq/lkmlfaq-15.html}). | |||
| @@ -12,7 +12,7 @@ | |||
| FFmpeg is a very fast video and audio converter. It can also grab from | |||
| a live audio/video source. | |||
| The command line interface is designed to be intuitive, in the sense | |||
| that FFmpeg tries to figure out all parameters that can possibly be | |||
| derived automatically. You usually only have to specify the target | |||
| @@ -30,7 +30,7 @@ FFmpeg can use a video4linux compatible video source and any Open Sound | |||
| System audio source: | |||
| @example | |||
| ffmpeg /tmp/out.mpg | |||
| ffmpeg /tmp/out.mpg | |||
| @end example | |||
| Note that you must activate the right video source and channel before | |||
| @@ -48,10 +48,10 @@ Examples: | |||
| * You can use YUV files as input: | |||
| @example | |||
| ffmpeg -i /tmp/test%d.Y /tmp/out.mpg | |||
| ffmpeg -i /tmp/test%d.Y /tmp/out.mpg | |||
| @end example | |||
| It will use the files: | |||
| It will use the files: | |||
| @example | |||
| /tmp/test0.Y, /tmp/test0.U, /tmp/test0.V, | |||
| /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc... | |||
| @@ -130,7 +130,7 @@ NOTE: To see the supported input formats, use @code{ffmpeg -formats}. | |||
| The generic syntax is: | |||
| @example | |||
| @example | |||
| @c man begin SYNOPSIS | |||
| ffmpeg [[infile options][@option{-i} @var{infile}]]... @{[outfile options] @var{outfile}@}... | |||
| @c man end | |||
| @@ -161,16 +161,16 @@ Show help. | |||
| @item -formats | |||
| Show available formats, codecs, protocols, ... | |||
| @item -f fmt | |||
| @item -f fmt | |||
| Force format. | |||
| @item -i filename | |||
| @item -i filename | |||
| input filename | |||
| @item -y | |||
| @item -y | |||
| Overwrite output files. | |||
| @item -t duration | |||
| @item -t duration | |||
| Set the recording time in seconds. | |||
| @code{hh:mm:ss[.xxx]} syntax is also supported. | |||
| @@ -178,16 +178,16 @@ Set the recording time in seconds. | |||
| Seek to given time position in seconds. | |||
| @code{hh:mm:ss[.xxx]} syntax is also supported. | |||
| @item -title string | |||
| @item -title string | |||
| Set the title. | |||
| @item -author string | |||
| @item -author string | |||
| Set the author. | |||
| @item -copyright string | |||
| @item -copyright string | |||
| Set the copyright. | |||
| @item -comment string | |||
| @item -comment string | |||
| Set the comment. | |||
| @item -target type | |||
| @@ -224,9 +224,9 @@ streams are delayed by 'offset' seconds. | |||
| @table @option | |||
| @item -b bitrate | |||
| Set the video bitrate in kbit/s (default = 200 kb/s). | |||
| @item -r fps | |||
| @item -r fps | |||
| Set frame rate (default = 25). | |||
| @item -s size | |||
| @item -s size | |||
| Set frame size. The format is @samp{wxh} (default = 160x128). | |||
| The following abbreviations are recognized: | |||
| @table @samp | |||
| @@ -265,7 +265,7 @@ represent red, the middle two digits green and last two digits | |||
| blue (default = 000000 (black)). | |||
| @item -vn | |||
| Disable video recording. | |||
| @item -bt tolerance | |||
| @item -bt tolerance | |||
| Set video bitrate tolerance (in kbit/s). | |||
| @item -maxrate bitrate | |||
| Set max video bitrate tolerance (in kbit/s). | |||
| @@ -273,19 +273,19 @@ Set max video bitrate tolerance (in kbit/s). | |||
| Set min video bitrate tolerance (in kbit/s). | |||
| @item -bufsize size | |||
| Set rate control buffer size (in kbit). | |||
| @item -vcodec codec | |||
| @item -vcodec codec | |||
| Force video codec to @var{codec}. Use the @code{copy} special value to | |||
| tell that the raw codec data must be copied as is. | |||
| @item -sameq | |||
| Use same video quality as source (implies VBR). | |||
| @item -pass n | |||
| @item -pass n | |||
| Select the pass number (1 or 2). It is useful to do two pass | |||
| encoding. The statistics of the video are recorded in the first | |||
| pass and the video is generated at the exact requested bitrate | |||
| in the second pass. | |||
| @item -passlogfile file | |||
| @item -passlogfile file | |||
| Set two pass logfile name to @var{file}. | |||
| @end table | |||
| @@ -293,21 +293,21 @@ Set two pass logfile name to @var{file}. | |||
| @section Advanced Video Options | |||
| @table @option | |||
| @item -g gop_size | |||
| @item -g gop_size | |||
| Set the group of pictures size. | |||
| @item -intra | |||
| @item -intra | |||
| Use only intra frames. | |||
| @item -qscale q | |||
| @item -qscale q | |||
| Use fixed video quantiser scale (VBR). | |||
| @item -qmin q | |||
| @item -qmin q | |||
| minimum video quantiser scale (VBR) | |||
| @item -qmax q | |||
| @item -qmax q | |||
| maximum video quantiser scale (VBR) | |||
| @item -qdiff q | |||
| @item -qdiff q | |||
| maximum difference between the quantiser scales (VBR) | |||
| @item -qblur blur | |||
| @item -qblur blur | |||
| video quantiser scale blur (VBR) | |||
| @item -qcomp compression | |||
| @item -qcomp compression | |||
| video quantiser scale compression (VBR) | |||
| @item -rc_init_cplx complexity | |||
| @@ -363,31 +363,31 @@ Set IDCT algorithm to @var{algo}. Available values are: | |||
| @item 0 | |||
| FF_IDCT_AUTO (default) | |||
| @item 1 | |||
| FF_IDCT_INT | |||
| FF_IDCT_INT | |||
| @item 2 | |||
| FF_IDCT_SIMPLE | |||
| FF_IDCT_SIMPLE | |||
| @item 3 | |||
| FF_IDCT_SIMPLEMMX | |||
| FF_IDCT_SIMPLEMMX | |||
| @item 4 | |||
| FF_IDCT_LIBMPEG2MMX | |||
| FF_IDCT_LIBMPEG2MMX | |||
| @item 5 | |||
| FF_IDCT_PS2 | |||
| FF_IDCT_PS2 | |||
| @item 6 | |||
| FF_IDCT_MLIB | |||
| FF_IDCT_MLIB | |||
| @item 7 | |||
| FF_IDCT_ARM | |||
| FF_IDCT_ARM | |||
| @item 8 | |||
| FF_IDCT_ALTIVEC | |||
| FF_IDCT_ALTIVEC | |||
| @item 9 | |||
| FF_IDCT_SH4 | |||
| FF_IDCT_SH4 | |||
| @item 10 | |||
| FF_IDCT_SIMPLEARM | |||
| FF_IDCT_SIMPLEARM | |||
| @end table | |||
| @item -er n | |||
| Set error resilience to @var{n}. | |||
| @table @samp | |||
| @item 1 | |||
| @item 1 | |||
| FF_ER_CAREFUL (default) | |||
| @item 2 | |||
| FF_ER_COMPLIANT | |||
| @@ -453,9 +453,9 @@ name and its parameters separated by spaces. | |||
| @section Audio Options | |||
| @table @option | |||
| @item -ar freq | |||
| @item -ar freq | |||
| Set the audio sampling frequency (default = 44100 Hz). | |||
| @item -ab bitrate | |||
| @item -ab bitrate | |||
| Set the audio bitrate in kbit/s (default = 64). | |||
| @item -ac channels | |||
| Set the number of audio channels (default = 1). | |||
| @@ -484,13 +484,13 @@ Set audio device (e.g. @file{/dev/dsp}). | |||
| @section Advanced options | |||
| @table @option | |||
| @item -map file:stream | |||
| @item -map file:stream | |||
| Set input stream mapping. | |||
| @item -debug | |||
| Print specific debug info. | |||
| @item -benchmark | |||
| @item -benchmark | |||
| Add timings for benchmarking. | |||
| @item -hex | |||
| @item -hex | |||
| Dump each input packet. | |||
| @item -bitexact | |||
| Only use bit exact algorithms (for codec testing). | |||
| @@ -510,7 +510,7 @@ Repeatedly loop output for formats that support looping such as animated GIF | |||
| @section FFmpeg formula evaluator | |||
| When evaluating a rate control string, FFmpeg uses an internal formula | |||
| evaluator. | |||
| evaluator. | |||
| The following binary operators are available: @code{+}, @code{-}, | |||
| @code{*}, @code{/}, @code{^}. | |||
| @@ -650,26 +650,26 @@ library: | |||
| @tab also known as @code{VOB} file | |||
| @item MPEG-2 TS @tab @tab X | |||
| @tab also known as DVB Transport Stream | |||
| @item ASF@tab X @tab X | |||
| @item AVI@tab X @tab X | |||
| @item WAV@tab X @tab X | |||
| @item ASF@tab X @tab X | |||
| @item AVI@tab X @tab X | |||
| @item WAV@tab X @tab X | |||
| @item Macromedia Flash@tab X @tab X | |||
| @tab Only embedded audio is decoded. | |||
| @item FLV @tab X @tab X | |||
| @tab Macromedia Flash video files | |||
| @item Real Audio and Video @tab X @tab X | |||
| @item Raw AC3 @tab X @tab X | |||
| @item Raw MJPEG @tab X @tab X | |||
| @item Raw MPEG video @tab X @tab X | |||
| @item Raw PCM8/16 bits, mulaw/Alaw@tab X @tab X | |||
| @item Raw CRI ADX audio @tab X @tab X | |||
| @item Raw Shorten audio @tab @tab X | |||
| @item SUN AU format @tab X @tab X | |||
| @item Real Audio and Video @tab X @tab X | |||
| @item Raw AC3 @tab X @tab X | |||
| @item Raw MJPEG @tab X @tab X | |||
| @item Raw MPEG video @tab X @tab X | |||
| @item Raw PCM8/16 bits, mulaw/Alaw@tab X @tab X | |||
| @item Raw CRI ADX audio @tab X @tab X | |||
| @item Raw Shorten audio @tab @tab X | |||
| @item SUN AU format @tab X @tab X | |||
| @item NUT @tab X @tab X @tab NUT Open Container Format | |||
| @item QuickTime @tab X @tab X | |||
| @item QuickTime @tab X @tab X | |||
| @item MPEG-4 @tab X @tab X | |||
| @tab MPEG-4 is a variant of QuickTime. | |||
| @item Raw MPEG4 video @tab X @tab X | |||
| @item Raw MPEG4 video @tab X @tab X | |||
| @item DV @tab X @tab X | |||
| @item 4xm @tab @tab X | |||
| @tab 4X Technologies format, used in some games. | |||
| @@ -707,7 +707,7 @@ following image formats are supported: | |||
| @multitable @columnfractions .4 .1 .1 .4 | |||
| @item Supported Image Format @tab Encoding @tab Decoding @tab Comments | |||
| @item PGM, PPM @tab X @tab X | |||
| @item PGM, PPM @tab X @tab X | |||
| @item PAM @tab X @tab X @tab PAM is a PNM extension with alpha support. | |||
| @item PGMYUV @tab X @tab X @tab PGM with U and V components in YUV 4:2:0 | |||
| @item JPEG @tab X @tab X @tab Progressive JPEG is not supported. | |||
| @@ -734,11 +734,11 @@ following image formats are supported: | |||
| @item H.261 @tab X @tab X | |||
| @item H.263(+) @tab X @tab X @tab also known as RealVideo 1.0 | |||
| @item H.264 @tab @tab X | |||
| @item MJPEG @tab X @tab X | |||
| @item MJPEG @tab X @tab X | |||
| @item lossless MJPEG @tab X @tab X | |||
| @item Apple MJPEG-B @tab @tab X | |||
| @item Sunplus MJPEG @tab @tab X @tab fourcc: SP5X | |||
| @item DV @tab X @tab X | |||
| @item DV @tab X @tab X | |||
| @item HuffYUV @tab X @tab X | |||
| @item FFmpeg Video 1 @tab X @tab X @tab experimental lossless codec (fourcc: FFV1) | |||
| @item FFmpeg Snow @tab X @tab X @tab experimental wavelet codec (fourcc: SNOW) | |||
| @@ -755,7 +755,7 @@ following image formats are supported: | |||
| @item ATI VCR2 @tab @tab X @tab fourcc: VCR2 | |||
| @item Cirrus Logic AccuPak @tab @tab X @tab fourcc: CLJR | |||
| @item 4X Video @tab @tab X @tab Used in certain computer games. | |||
| @item Sony Playstation MDEC @tab @tab X | |||
| @item Sony Playstation MDEC @tab @tab X | |||
| @item Id RoQ @tab @tab X @tab Used in Quake III, Jedi Knight 2, other computer games. | |||
| @item Xan/WC3 @tab @tab X @tab Used in Wing Commander III .MVE files. | |||
| @item Interplay Video @tab @tab X @tab Used in Interplay .MVE files. | |||
| @@ -779,10 +779,10 @@ following image formats are supported: | |||
| @item IBM Ultimotion @tab @tab X @tab fourcc: ULTI | |||
| @item Miro VideoXL @tab @tab X @tab fourcc: VIXL | |||
| @item QPEG @tab @tab X @tab fourccs: QPEG, Q1.0, Q1.1 | |||
| @item LOCO @tab @tab X @tab | |||
| @item Winnov WNV1 @tab @tab X @tab | |||
| @item LOCO @tab @tab X @tab | |||
| @item Winnov WNV1 @tab @tab X @tab | |||
| @item Autodesk Animator Studio Codec @tab @tab X @tab fourcc: AASC | |||
| @item Fraps FPS1 @tab @tab X @tab | |||
| @item Fraps FPS1 @tab @tab X @tab | |||
| @end multitable | |||
| @code{X} means that encoding (resp. decoding) is supported. | |||
| @@ -795,7 +795,7 @@ other implementations. | |||
| @multitable @columnfractions .4 .1 .1 .1 .7 | |||
| @item Supported Codec @tab Encoding @tab Decoding @tab Comments | |||
| @item MPEG audio layer 2 @tab IX @tab IX | |||
| @item MPEG audio layer 2 @tab IX @tab IX | |||
| @item MPEG audio layer 1/3 @tab IX @tab IX | |||
| @tab MP3 encoding is supported through the external library LAME. | |||
| @item AC3 @tab IX @tab IX | |||
| @@ -890,7 +890,7 @@ directory. Edit the @file{sdl-config} script so that it gives the | |||
| correct SDL directory when invoked. | |||
| @item Extract the current version of FFmpeg. | |||
| @item Start the MSYS shell (file @file{msys.bat}). | |||
| @item Change to the FFmpeg directory and follow | |||
| @@ -905,7 +905,7 @@ you launch @file{ffplay} from. | |||
| @end itemize | |||
| Notes: | |||
| Notes: | |||
| @itemize | |||
| @item The target @file{make wininstaller} can be used to create a | |||
| @@ -916,7 +916,7 @@ installer. | |||
| @item By using @code{./configure --enable-shared} when configuring FFmpeg, | |||
| you can build @file{avcodec.dll} and @file{avformat.dll}. With | |||
| @code{make install} you install the FFmpeg DLLs and the associated | |||
| headers in @file{Program Files/FFmpeg}. | |||
| headers in @file{Program Files/FFmpeg}. | |||
| @item Visual C++ compatibility: If you used @code{./configure --enable-shared} | |||
| when configuring FFmpeg, FFmpeg tries to use the Microsoft Visual | |||
| @@ -1068,13 +1068,13 @@ Old stuff: | |||
| François Revol - revol at free dot fr - April 2002 | |||
| The configure script should guess the configuration itself, | |||
| The configure script should guess the configuration itself, | |||
| however I still didn't test building on the net_server version of BeOS. | |||
| FFserver is broken (needs poll() implementation). | |||
| There are still issues with errno codes, which are negative in BeOS, and | |||
| that FFmpeg negates when returning. This ends up turning errors into | |||
| that FFmpeg negates when returning. This ends up turning errors into | |||
| valid results, then crashes. | |||
| (To be fixed) | |||
| @@ -1180,33 +1180,33 @@ int myfunc(int my_parameter) | |||
| ... | |||
| @end example | |||
| fprintf and printf are forbidden in libavformat and libavcodec, | |||
| fprintf and printf are forbidden in libavformat and libavcodec, | |||
| please use av_log() instead. | |||
| @node CVS Policy | |||
| @section CVS Policy | |||
| @enumerate | |||
| @item | |||
| @item | |||
| You must not commit code which breaks FFmpeg! (Meaning unfinished but | |||
| enabled code which breaks compilation or compiles but does not work or | |||
| breaks the regression tests) | |||
| You can commit unfinished stuff (for testing etc), but it must be disabled | |||
| (#ifdef etc) by default so it does not interfere with other developers' | |||
| work. | |||
| @item | |||
| @item | |||
| You don't have to over-test things. If it works for you, and you think it | |||
| should work for others, then commit. If your code has problems | |||
| (portability, triggers compiler bugs, unusual environment etc) they will be | |||
| reported and eventually fixed. | |||
| @item | |||
| @item | |||
| Do not commit unrelated changes together, split them into self-contained | |||
| pieces. | |||
| @item | |||
| Do not change behavior of the program (renaming options etc) without | |||
| first discussing it on the ffmpeg-devel mailing list. Do not remove | |||
| functionality from the code. Just improve! | |||
| Note: Redundant code can be removed. | |||
| @item | |||
| Do not commit changes to the build system (Makefiles, configure script) | |||
| @@ -1227,7 +1227,7 @@ please use av_log() instead. | |||
| changes. | |||
| NOTE: If you had to put if()@{ .. @} over a large (> 5 lines) chunk of code, | |||
| then either do NOT change the indentation of the inner part within (don't | |||
| then either do NOT change the indentation of the inner part within (don't | |||
| move it to the right)! or do so in a separate commit | |||
| @item | |||
| Always fill out the commit log message. Describe in a few lines what you | |||
| @@ -1281,7 +1281,7 @@ When you submit your patch, try to send a unified diff (diff '-up' | |||
| option). I cannot read other diffs :-) | |||
| Also please do not submit patches which contain several unrelated changes. | |||
| Split them into individual self-contained patches; this makes reviewing | |||
| Split them into individual self-contained patches; this makes reviewing | |||
| them much easier. | |||
| Run the regression tests before submitting a patch so that you can | |||
| @@ -1289,7 +1289,7 @@ verify that there are no big problems. | |||
| Patches should be posted as base64 encoded attachments (or any other | |||
| encoding which ensures that the patch won't be trashed during | |||
| transmission) to the ffmpeg-devel mailing list, see | |||
| transmission) to the ffmpeg-devel mailing list, see | |||
| @url{http://www1.mplayerhq.hu/mailman/listinfo/ffmpeg-devel} | |||
| It also helps quite a bit if you tell us what the patch does (for example | |||
| @@ -158,6 +158,6 @@ V) Enabling the PMC on Linux | |||
| I don't know how to do it, sorry :-) Any idea very much welcome. | |||
| -- | |||
| Romain Dolbeau | |||
| <romain@dolbeau.org> | |||
| @@ -19,7 +19,7 @@ various FFmpeg APIs. | |||
| @chapter Invocation | |||
| @section Syntax | |||
| @example | |||
| @example | |||
| @c man begin SYNOPSIS | |||
| ffplay [options] @file{input_file} | |||
| @c man end | |||
| @@ -64,13 +64,13 @@ have a V4L video capture card): | |||
| @end example | |||
| At this point you should be able to go to your Windows machine and fire up | |||
| Windows Media Player (WMP). Go to Open URL and enter | |||
| Windows Media Player (WMP). Go to Open URL and enter | |||
| @example | |||
| http://<linuxbox>:8090/test.asf | |||
| @end example | |||
| You should (after a short delay) see video and hear audio. | |||
| You should (after a short delay) see video and hear audio. | |||
| WARNING: trying to stream test1.mpg doesn't work with WMP as it tries to | |||
| transfer the entire file before starting to play. | |||
| @@ -78,7 +78,7 @@ The same is true of AVI files. | |||
| @section What happens next? | |||
| You should edit the ffserver.conf file to suit your needs (in terms of | |||
| You should edit the ffserver.conf file to suit your needs (in terms of | |||
| frame rates etc). Then install ffserver and ffmpeg, write a script to start | |||
| them up, and off you go. | |||
| @@ -89,10 +89,10 @@ them up, and off you go. | |||
| Maybe you didn't install LAME, or got your ./configure statement wrong. Check | |||
| the ffmpeg output to see if a line referring to MP3 is present. If not, then | |||
| your configuration was incorrect. If it is, then maybe your wiring is not | |||
| set up correctly. Maybe the sound card is not getting data from the right | |||
| set up correctly. Maybe the sound card is not getting data from the right | |||
| input source. Maybe you have a really awful audio interface (like I do) | |||
| that only captures in stereo and also requires that one channel be flipped. | |||
| If you are one of these people, then export 'AUDIO_FLIP_LEFT=1' before | |||
| that only captures in stereo and also requires that one channel be flipped. | |||
| If you are one of these people, then export 'AUDIO_FLIP_LEFT=1' before | |||
| starting ffmpeg. | |||
| @subsection The audio and video loose sync after a while. | |||
| @@ -114,7 +114,7 @@ I suspect that the new one is not available unless you have installed WMP 7]. | |||
| @section What else can it do? | |||
| You can replay video from .ffm files that was recorded earlier. | |||
| However, there are a number of caveats, including the fact that the | |||
| However, there are a number of caveats, including the fact that the | |||
| ffserver parameters must match the original parameters used to record the | |||
| file. If they do not, then ffserver deletes the file before recording into it. | |||
| (Now that I write this, it seems broken). | |||
| @@ -129,7 +129,7 @@ in browsers. These files are actually redirections to the underlying ASF | |||
| or RM file. The reason for this is that the browser often fetches the | |||
| entire file before starting up the external viewer. The redirection files | |||
| are very small and can be transferred quickly. [The stream itself is | |||
| often 'infinite' and thus the browser tries to download it and never | |||
| often 'infinite' and thus the browser tries to download it and never | |||
| finishes.] | |||
| @section Tips | |||
| @@ -140,7 +140,7 @@ signal continuously. However, ffserver (by default) starts sending data | |||
| in realtime. This means that there is a pause of a few seconds while the | |||
| buffering is being done by the player. The good news is that this can be | |||
| cured by adding a '?buffer=5' to the end of the URL. This means that the | |||
| stream should start 5 seconds in the past -- and so the first 5 seconds | |||
| stream should start 5 seconds in the past -- and so the first 5 seconds | |||
| of the stream are sent as fast as the network will allow. It will then | |||
| slow down to real time. This noticeably improves the startup experience. | |||
| @@ -161,14 +161,14 @@ means that the timestamp in the encoded data stream gets behind realtime. | |||
| This means that if you say 'Preroll 10', then when the stream gets 10 | |||
| or more seconds behind, there is no Preroll left. | |||
| Fixing this requires a change in the internals of how timestamps are | |||
| Fixing this requires a change in the internals of how timestamps are | |||
| handled. | |||
| @section Does the @code{?date=} stuff work. | |||
| Yes (subject to the limitation outlined above). Also note that whenever you | |||
| start ffserver, it deletes the ffm file (if any parameters have changed), | |||
| thus wiping out what you had recorded before. | |||
| thus wiping out what you had recorded before. | |||
| The format of the @code{?date=xxxxxx} is fairly flexible. You should use one | |||
| of the following formats (the 'T' is literal): | |||
| @@ -178,7 +178,7 @@ of the following formats (the 'T' is literal): | |||
| * YYYY-MM-DDTHH:MM:SSZ (UTC) | |||
| @end example | |||
| You can omit the YYYY-MM-DD, and then it refers to the current day. However | |||
| You can omit the YYYY-MM-DD, and then it refers to the current day. However | |||
| note that @samp{?date=16:00:00} refers to 16:00 on the current day -- this | |||
| may be in the future and so is unlikely to be useful. | |||
| @@ -187,7 +187,7 @@ For example: @samp{http://localhost:8080/test.asf?date=2002-07-26T23:05:00}. | |||
| @chapter Invocation | |||
| @section Syntax | |||
| @example | |||
| @example | |||
| @c man begin SYNOPSIS | |||
| ffserver [options] | |||
| @c man end | |||
| @@ -34,7 +34,7 @@ NoDaemon | |||
| # You must use 'ffmpeg' to send a live feed to ffserver. In this | |||
| # example, you can type: | |||
| # | |||
| # | |||
| # ffmpeg http://localhost:8090/feed1.ffm | |||
| # ffserver can also do time shifting. It means that it can stream any | |||
| @@ -88,7 +88,7 @@ Feed feed1.ffm | |||
| Format mpeg | |||
| # Bitrate for the audio stream. Codecs usually support only a few | |||
| # different bitrates. | |||
| # different bitrates. | |||
| AudioBitRate 32 | |||
| # Number of audio channels: 1 = mono, 2 = stereo | |||
| @@ -123,7 +123,7 @@ VideoGopSize 12 | |||
| # VideoHighQuality | |||
| # Video4MotionVector | |||
| # Choose your codecs: | |||
| # Choose your codecs: | |||
| #AudioCodec mp2 | |||
| #VideoCodec mpeg1video | |||
| @@ -153,7 +153,7 @@ VideoGopSize 12 | |||
| # stream basis. The first match defines the action. If there are no matches, | |||
| # then the default is the inverse of the last ACL statement. | |||
| # | |||
| # Thus 'ACL allow localhost' only allows access from localhost. | |||
| # Thus 'ACL allow localhost' only allows access from localhost. | |||
| # 'ACL deny 1.0.0.0 1.255.255.255' would deny the whole of network 1 and | |||
| # allow everybody else. | |||
| @@ -181,7 +181,7 @@ VideoGopSize 12 | |||
| #<Stream test.jpg> | |||
| #Feed feed1.ffm | |||
| #Format jpeg | |||
| #VideoFrameRate 2 | |||
| #VideoFrameRate 2 | |||
| #VideoIntraOnly | |||
| ##VideoSize 352x240 | |||
| #NoAudio | |||
| @@ -215,7 +215,7 @@ StartSendOnKey | |||
| </Stream> | |||
| # MP3 audio | |||
| # MP3 audio | |||
| #<Stream test.mp3> | |||
| #Feed feed1.ffm | |||
| @@ -310,7 +310,7 @@ StartSendOnKey | |||
| # 'sdp' extension to the stream name (here | |||
| # http://localhost:8090/test1-sdp.sdp). You should usually give this | |||
| # file to your player to play the stream. | |||
| # | |||
| # | |||
| # The 'NoLoop' option can be used to avoid looping when the stream is | |||
| # terminated. | |||
| @@ -18,7 +18,7 @@ Any number of hook modules can be placed inline, and they are run in the | |||
| order that they were specified on the ffmpeg command line. | |||
| Three modules are provided and are described below. They are all intended to | |||
| be used as a base for your own modules. | |||
| be used as a base for your own modules. | |||
| Modules are loaded using the -vhook option to ffmpeg. The value of this parameter | |||
| is a space separated list of arguments. The first is the module name, and the rest | |||
| @@ -229,7 +229,7 @@ while(<$inf>) { | |||
| $inf = gensym(); | |||
| # Try cwd and $ibase. | |||
| open($inf, "<" . $1) | |||
| open($inf, "<" . $1) | |||
| or open($inf, "<" . $ibase . "/" . $1) | |||
| or die "cannot open $1 or $ibase/$1: $!\n"; | |||
| next; | |||
| @@ -32,14 +32,14 @@ | |||
| #define INCL_DOS | |||
| #include <os2.h> | |||
| #include <stdio.h> | |||
| void MorphToPM() | |||
| { | |||
| PPIB pib; | |||
| PTIB tib; | |||
| DosGetInfoBlocks(&tib, &pib); | |||
| // Change flag from VIO to PM: | |||
| if (pib->pib_ultype==2) pib->pib_ultype = 3; | |||
| } | |||
| @@ -122,11 +122,11 @@ typedef struct VideoState { | |||
| int dtg_active_format; | |||
| int audio_stream; | |||
| int av_sync_type; | |||
| double external_clock; /* external clock base */ | |||
| int64_t external_clock_time; | |||
| double audio_clock; | |||
| double audio_diff_cum; /* used for AV difference average computation */ | |||
| double audio_diff_avg_coef; | |||
| @@ -137,18 +137,18 @@ typedef struct VideoState { | |||
| int audio_hw_buf_size; | |||
| /* samples output by the codec. we reserve more space for avsync | |||
| compensation */ | |||
| uint8_t audio_buf[(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2]; | |||
| uint8_t audio_buf[(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2]; | |||
| unsigned int audio_buf_size; /* in bytes */ | |||
| int audio_buf_index; /* in bytes */ | |||
| AVPacket audio_pkt; | |||
| uint8_t *audio_pkt_data; | |||
| int audio_pkt_size; | |||
| int show_audio; /* if true, display audio samples */ | |||
| int16_t sample_array[SAMPLE_ARRAY_SIZE]; | |||
| int sample_array_index; | |||
| int last_i_start; | |||
| SDL_Thread *subtitle_tid; | |||
| int subtitle_stream; | |||
| int subtitle_stream_changed; | |||
| @@ -158,11 +158,11 @@ typedef struct VideoState { | |||
| int subpq_size, subpq_rindex, subpq_windex; | |||
| SDL_mutex *subpq_mutex; | |||
| SDL_cond *subpq_cond; | |||
| double frame_timer; | |||
| double frame_last_pts; | |||
| double frame_last_delay; | |||
| double video_clock; ///<pts of last decoded frame / predicted pts of next decoded frame | |||
| double video_clock; ///<pts of last decoded frame / predicted pts of next decoded frame | |||
| int video_stream; | |||
| AVStream *video_st; | |||
| PacketQueue videoq; | |||
| @@ -172,7 +172,7 @@ typedef struct VideoState { | |||
| int pictq_size, pictq_rindex, pictq_windex; | |||
| SDL_mutex *pictq_mutex; | |||
| SDL_cond *pictq_cond; | |||
| SDL_mutex *video_decoder_mutex; | |||
| SDL_mutex *audio_decoder_mutex; | |||
| SDL_mutex *subtitle_decoder_mutex; | |||
| @@ -264,7 +264,7 @@ static int packet_queue_put(PacketQueue *q, AVPacket *pkt) | |||
| /* duplicate the packet */ | |||
| if (av_dup_packet(pkt) < 0) | |||
| return -1; | |||
| pkt1 = av_malloc(sizeof(AVPacketList)); | |||
| if (!pkt1) | |||
| return -1; | |||
| @@ -294,7 +294,7 @@ static void packet_queue_abort(PacketQueue *q) | |||
| SDL_LockMutex(q->mutex); | |||
| q->abort_request = 1; | |||
| SDL_CondSignal(q->cond); | |||
| SDL_UnlockMutex(q->mutex); | |||
| @@ -313,7 +313,7 @@ static int packet_queue_get(PacketQueue *q, AVPacket *pkt, int block) | |||
| ret = -1; | |||
| break; | |||
| } | |||
| pkt1 = q->first_pkt; | |||
| if (pkt1) { | |||
| q->first_pkt = pkt1->next; | |||
| @@ -336,7 +336,7 @@ static int packet_queue_get(PacketQueue *q, AVPacket *pkt, int block) | |||
| return ret; | |||
| } | |||
| static inline void fill_rectangle(SDL_Surface *screen, | |||
| static inline void fill_rectangle(SDL_Surface *screen, | |||
| int x, int y, int w, int h, int color) | |||
| { | |||
| SDL_Rect rect; | |||
| @@ -366,19 +366,19 @@ void fill_border(VideoState *s, int x, int y, int w, int h, int color) | |||
| h2 = s->height - (y + h); | |||
| if (h2 < 0) | |||
| h2 = 0; | |||
| fill_rectangle(screen, | |||
| s->xleft, s->ytop, | |||
| w1, s->height, | |||
| fill_rectangle(screen, | |||
| s->xleft, s->ytop, | |||
| w1, s->height, | |||
| color); | |||
| fill_rectangle(screen, | |||
| s->xleft + s->width - w2, s->ytop, | |||
| w2, s->height, | |||
| fill_rectangle(screen, | |||
| s->xleft + s->width - w2, s->ytop, | |||
| w2, s->height, | |||
| color); | |||
| fill_rectangle(screen, | |||
| s->xleft + w1, s->ytop, | |||
| s->width - w1 - w2, h1, | |||
| fill_rectangle(screen, | |||
| s->xleft + w1, s->ytop, | |||
| s->width - w1 - w2, h1, | |||
| color); | |||
| fill_rectangle(screen, | |||
| fill_rectangle(screen, | |||
| s->xleft + w1, s->ytop + s->height - h2, | |||
| s->width - w1 - w2, h2, | |||
| color); | |||
| @@ -450,12 +450,12 @@ static void blend_subrect(AVPicture *dst, const AVSubtitleRect *rect) | |||
| wrap3 = rect->linesize; | |||
| p = rect->bitmap; | |||
| pal = rect->rgba_palette; /* Now in YCrCb! */ | |||
| if (rect->y & 1) { | |||
| lum += rect->x; | |||
| cb += skip2; | |||
| cr += skip2; | |||
| if (rect->x & 1) { | |||
| YUVA_IN(y, u, v, a, p, pal); | |||
| lum[0] = ALPHA_BLEND(a, lum[0], y, 0); | |||
| @@ -500,7 +500,7 @@ static void blend_subrect(AVPicture *dst, const AVSubtitleRect *rect) | |||
| lum += rect->x; | |||
| cb += skip2; | |||
| cr += skip2; | |||
| if (rect->x & 1) { | |||
| YUVA_IN(y, u, v, a, p, pal); | |||
| u1 = u; | |||
| @@ -586,7 +586,7 @@ static void blend_subrect(AVPicture *dst, const AVSubtitleRect *rect) | |||
| lum += rect->x; | |||
| cb += skip2; | |||
| cr += skip2; | |||
| if (rect->x & 1) { | |||
| YUVA_IN(y, u, v, a, p, pal); | |||
| lum[0] = ALPHA_BLEND(a, lum[0], y, 0); | |||
| @@ -628,15 +628,15 @@ static void blend_subrect(AVPicture *dst, const AVSubtitleRect *rect) | |||
| static void free_subpicture(SubPicture *sp) | |||
| { | |||
| int i; | |||
| for (i = 0; i < sp->sub.num_rects; i++) | |||
| { | |||
| av_free(sp->sub.rects[i].bitmap); | |||
| av_free(sp->sub.rects[i].rgba_palette); | |||
| } | |||
| av_free(sp->sub.rects); | |||
| memset(&sp->sub, 0, sizeof(AVSubtitle)); | |||
| } | |||
| @@ -653,13 +653,13 @@ static void video_image_display(VideoState *is) | |||
| vp = &is->pictq[is->pictq_rindex]; | |||
| if (vp->bmp) { | |||
| /* XXX: use variable in the frame */ | |||
| if (is->video_st->codec->sample_aspect_ratio.num == 0) | |||
| if (is->video_st->codec->sample_aspect_ratio.num == 0) | |||
| aspect_ratio = 0; | |||
| else | |||
| aspect_ratio = av_q2d(is->video_st->codec->sample_aspect_ratio) | |||
| aspect_ratio = av_q2d(is->video_st->codec->sample_aspect_ratio) | |||
| * is->video_st->codec->width / is->video_st->codec->height;; | |||
| if (aspect_ratio <= 0.0) | |||
| aspect_ratio = (float)is->video_st->codec->width / | |||
| aspect_ratio = (float)is->video_st->codec->width / | |||
| (float)is->video_st->codec->height; | |||
| /* if an active format is indicated, then it overrides the | |||
| mpeg format */ | |||
| @@ -745,8 +745,8 @@ static void video_image_display(VideoState *is) | |||
| SDL_DisplayYUVOverlay(vp->bmp, &rect); | |||
| } else { | |||
| #if 0 | |||
| fill_rectangle(screen, | |||
| is->xleft, is->ytop, is->width, is->height, | |||
| fill_rectangle(screen, | |||
| is->xleft, is->ytop, is->width, is->height, | |||
| QERGB(0x00, 0x00, 0x00)); | |||
| #endif | |||
| } | |||
| @@ -755,7 +755,7 @@ static void video_image_display(VideoState *is) | |||
| static inline int compute_mod(int a, int b) | |||
| { | |||
| a = a % b; | |||
| if (a >= 0) | |||
| if (a >= 0) | |||
| return a; | |||
| else | |||
| return a + b; | |||
| @@ -766,7 +766,7 @@ static void video_audio_display(VideoState *s) | |||
| int i, i_start, x, y1, y, ys, delay, n, nb_display_channels; | |||
| int ch, channels, h, h2, bgcolor, fgcolor; | |||
| int16_t time_diff; | |||
| /* compute display index : center on currently output samples */ | |||
| channels = s->audio_st->codec->channels; | |||
| nb_display_channels = channels; | |||
| @@ -774,14 +774,14 @@ static void video_audio_display(VideoState *s) | |||
| n = 2 * channels; | |||
| delay = audio_write_get_buf_size(s); | |||
| delay /= n; | |||
| /* to be more precise, we take into account the time spent since | |||
| the last buffer computation */ | |||
| if (audio_callback_time) { | |||
| time_diff = av_gettime() - audio_callback_time; | |||
| delay += (time_diff * s->audio_st->codec->sample_rate) / 1000000; | |||
| } | |||
| delay -= s->width / 2; | |||
| if (delay < s->width) | |||
| delay = s->width; | |||
| @@ -792,8 +792,8 @@ static void video_audio_display(VideoState *s) | |||
| } | |||
| bgcolor = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00); | |||
| fill_rectangle(screen, | |||
| s->xleft, s->ytop, s->width, s->height, | |||
| fill_rectangle(screen, | |||
| s->xleft, s->ytop, s->width, s->height, | |||
| bgcolor); | |||
| fgcolor = SDL_MapRGB(screen->format, 0xff, 0xff, 0xff); | |||
| @@ -813,8 +813,8 @@ static void video_audio_display(VideoState *s) | |||
| } else { | |||
| ys = y1; | |||
| } | |||
| fill_rectangle(screen, | |||
| s->xleft + x, ys, 1, y, | |||
| fill_rectangle(screen, | |||
| s->xleft + x, ys, 1, y, | |||
| fgcolor); | |||
| i += channels; | |||
| if (i >= SAMPLE_ARRAY_SIZE) | |||
| @@ -826,8 +826,8 @@ static void video_audio_display(VideoState *s) | |||
| for(ch = 1;ch < nb_display_channels; ch++) { | |||
| y = s->ytop + ch * h; | |||
| fill_rectangle(screen, | |||
| s->xleft, y, s->width, 1, | |||
| fill_rectangle(screen, | |||
| s->xleft, y, s->width, 1, | |||
| fgcolor); | |||
| } | |||
| SDL_UpdateRect(screen, s->xleft, s->ytop, s->width, s->height); | |||
| @@ -836,7 +836,7 @@ static void video_audio_display(VideoState *s) | |||
| /* display the current picture, if any */ | |||
| static void video_display(VideoState *is) | |||
| { | |||
| if (is->audio_st && is->show_audio) | |||
| if (is->audio_st && is->show_audio) | |||
| video_audio_display(is); | |||
| else if (is->video_st) | |||
| video_image_display(is); | |||
| @@ -866,7 +866,7 @@ static double get_audio_clock(VideoState *is) | |||
| hw_buf_size = audio_write_get_buf_size(is); | |||
| bytes_per_sec = 0; | |||
| if (is->audio_st) { | |||
| bytes_per_sec = is->audio_st->codec->sample_rate * | |||
| bytes_per_sec = is->audio_st->codec->sample_rate * | |||
| 2 * is->audio_st->codec->channels; | |||
| } | |||
| if (bytes_per_sec) | |||
| @@ -971,7 +971,7 @@ static void video_refresh_timer(void *opaque) | |||
| duplicating or deleting a frame */ | |||
| ref_clock = get_master_clock(is); | |||
| diff = vp->pts - ref_clock; | |||
| /* skip or repeat frame. We take into account the | |||
| delay to compute the threshold. I still don't know | |||
| if it is the best guess */ | |||
| @@ -998,21 +998,21 @@ static void video_refresh_timer(void *opaque) | |||
| schedule_refresh(is, (int)(actual_delay * 1000 + 0.5)); | |||
| #if defined(DEBUG_SYNC) | |||
| printf("video: delay=%0.3f actual_delay=%0.3f pts=%0.3f A-V=%f\n", | |||
| printf("video: delay=%0.3f actual_delay=%0.3f pts=%0.3f A-V=%f\n", | |||
| delay, actual_delay, vp->pts, -diff); | |||
| #endif | |||
| if(is->subtitle_st) { | |||
| if (is->subtitle_stream_changed) { | |||
| SDL_LockMutex(is->subpq_mutex); | |||
| while (is->subpq_size) { | |||
| free_subpicture(&is->subpq[is->subpq_rindex]); | |||
| /* update queue size and signal for next picture */ | |||
| if (++is->subpq_rindex == SUBPICTURE_QUEUE_SIZE) | |||
| is->subpq_rindex = 0; | |||
| is->subpq_size--; | |||
| } | |||
| is->subtitle_stream_changed = 0; | |||
| @@ -1048,11 +1048,11 @@ static void video_refresh_timer(void *opaque) | |||
| /* display picture */ | |||
| video_display(is); | |||
| /* update queue size and signal for next picture */ | |||
| if (++is->pictq_rindex == VIDEO_PICTURE_QUEUE_SIZE) | |||
| is->pictq_rindex = 0; | |||
| SDL_LockMutex(is->pictq_mutex); | |||
| is->pictq_size--; | |||
| SDL_CondSignal(is->pictq_cond); | |||
| @@ -1065,7 +1065,7 @@ static void video_refresh_timer(void *opaque) | |||
| /* if only audio stream, then display the audio bars (better | |||
| than nothing, just to test the implementation */ | |||
| /* display picture */ | |||
| video_display(is); | |||
| } else { | |||
| @@ -1076,7 +1076,7 @@ static void video_refresh_timer(void *opaque) | |||
| int64_t cur_time; | |||
| int aqsize, vqsize, sqsize; | |||
| double av_diff; | |||
| cur_time = av_gettime(); | |||
| if (!last_time || (cur_time - last_time) >= 500 * 1000) { | |||
| aqsize = 0; | |||
| @@ -1091,7 +1091,7 @@ static void video_refresh_timer(void *opaque) | |||
| av_diff = 0; | |||
| if (is->audio_st && is->video_st) | |||
| av_diff = get_audio_clock(is) - get_video_clock(is); | |||
| printf("%7.2f A-V:%7.3f aq=%5dKB vq=%5dKB sq=%5dB \r", | |||
| printf("%7.2f A-V:%7.3f aq=%5dKB vq=%5dKB sq=%5dB \r", | |||
| get_master_clock(is), av_diff, aqsize / 1024, vqsize / 1024, sqsize); | |||
| fflush(stdout); | |||
| last_time = cur_time; | |||
| @@ -1130,7 +1130,7 @@ static void alloc_picture(void *opaque) | |||
| #endif | |||
| vp->bmp = SDL_CreateYUVOverlay(is->video_st->codec->width, | |||
| is->video_st->codec->height, | |||
| SDL_YV12_OVERLAY, | |||
| SDL_YV12_OVERLAY, | |||
| screen); | |||
| vp->width = is->video_st->codec->width; | |||
| vp->height = is->video_st->codec->height; | |||
| @@ -1150,7 +1150,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts) | |||
| VideoPicture *vp; | |||
| int dst_pix_fmt; | |||
| AVPicture pict; | |||
| /* wait until we have space to put a new picture */ | |||
| SDL_LockMutex(is->pictq_mutex); | |||
| while (is->pictq_size >= VIDEO_PICTURE_QUEUE_SIZE && | |||
| @@ -1158,14 +1158,14 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts) | |||
| SDL_CondWait(is->pictq_cond, is->pictq_mutex); | |||
| } | |||
| SDL_UnlockMutex(is->pictq_mutex); | |||
| if (is->videoq.abort_request) | |||
| return -1; | |||
| vp = &is->pictq[is->pictq_windex]; | |||
| /* alloc or resize hardware picture buffer */ | |||
| if (!vp->bmp || | |||
| if (!vp->bmp || | |||
| vp->width != is->video_st->codec->width || | |||
| vp->height != is->video_st->codec->height) { | |||
| SDL_Event event; | |||
| @@ -1177,7 +1177,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts) | |||
| event.type = FF_ALLOC_EVENT; | |||
| event.user.data1 = is; | |||
| SDL_PushEvent(&event); | |||
| /* wait until the picture is allocated */ | |||
| SDL_LockMutex(is->pictq_mutex); | |||
| while (!vp->allocated && !is->videoq.abort_request) { | |||
| @@ -1202,8 +1202,8 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts) | |||
| pict.linesize[0] = vp->bmp->pitches[0]; | |||
| pict.linesize[1] = vp->bmp->pitches[2]; | |||
| pict.linesize[2] = vp->bmp->pitches[1]; | |||
| img_convert(&pict, dst_pix_fmt, | |||
| (AVPicture *)src_frame, is->video_st->codec->pix_fmt, | |||
| img_convert(&pict, dst_pix_fmt, | |||
| (AVPicture *)src_frame, is->video_st->codec->pix_fmt, | |||
| is->video_st->codec->width, is->video_st->codec->height); | |||
| /* update the bitmap content */ | |||
| SDL_UnlockYUVOverlay(vp->bmp); | |||
| @@ -1220,14 +1220,14 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts) | |||
| return 0; | |||
| } | |||
| /** | |||
| * compute the exact PTS for the picture if it is omitted in the stream | |||
| /** | |||
| * compute the exact PTS for the picture if it is omitted in the stream | |||
| * @param pts1 the dts of the pkt / pts of the frame | |||
| */ | |||
| static int output_picture2(VideoState *is, AVFrame *src_frame, double pts1) | |||
| { | |||
| double frame_delay, pts; | |||
| pts = pts1; | |||
| if (pts != 0) { | |||
| @@ -1252,7 +1252,7 @@ static int output_picture2(VideoState *is, AVFrame *src_frame, double pts1) | |||
| ftype = 'I'; | |||
| else | |||
| ftype = 'P'; | |||
| printf("frame_type=%c clock=%0.3f pts=%0.3f\n", | |||
| printf("frame_type=%c clock=%0.3f pts=%0.3f\n", | |||
| ftype, pts, pts1); | |||
| } | |||
| #endif | |||
| @@ -1280,8 +1280,8 @@ static int video_thread(void *arg) | |||
| pts = av_q2d(is->video_st->time_base)*pkt->dts; | |||
| SDL_LockMutex(is->video_decoder_mutex); | |||
| len1 = avcodec_decode_video(is->video_st->codec, | |||
| frame, &got_picture, | |||
| len1 = avcodec_decode_video(is->video_st->codec, | |||
| frame, &got_picture, | |||
| pkt->data, pkt->size); | |||
| SDL_UnlockMutex(is->video_decoder_mutex); | |||
| // if (len1 < 0) | |||
| @@ -1291,7 +1291,7 @@ static int video_thread(void *arg) | |||
| goto the_end; | |||
| } | |||
| av_free_packet(pkt); | |||
| if (step) | |||
| if (step) | |||
| if (cur_stream) | |||
| stream_pause(cur_stream); | |||
| } | |||
| @@ -1316,17 +1316,17 @@ static int subtitle_thread(void *arg) | |||
| } | |||
| if (packet_queue_get(&is->subtitleq, pkt, 1) < 0) | |||
| break; | |||
| SDL_LockMutex(is->subpq_mutex); | |||
| while (is->subpq_size >= SUBPICTURE_QUEUE_SIZE && | |||
| !is->subtitleq.abort_request) { | |||
| SDL_CondWait(is->subpq_cond, is->subpq_mutex); | |||
| } | |||
| SDL_UnlockMutex(is->subpq_mutex); | |||
| if (is->subtitleq.abort_request) | |||
| goto the_end; | |||
| sp = &is->subpq[is->subpq_windex]; | |||
| /* NOTE: ipts is the PTS of the _first_ picture beginning in | |||
| @@ -1336,15 +1336,15 @@ static int subtitle_thread(void *arg) | |||
| pts = av_q2d(is->subtitle_st->time_base)*pkt->pts; | |||
| SDL_LockMutex(is->subtitle_decoder_mutex); | |||
| len1 = avcodec_decode_subtitle(is->subtitle_st->codec, | |||
| &sp->sub, &got_subtitle, | |||
| len1 = avcodec_decode_subtitle(is->subtitle_st->codec, | |||
| &sp->sub, &got_subtitle, | |||
| pkt->data, pkt->size); | |||
| SDL_UnlockMutex(is->subtitle_decoder_mutex); | |||
| // if (len1 < 0) | |||
| // break; | |||
| if (got_subtitle && sp->sub.format == 0) { | |||
| sp->pts = pts; | |||
| for (i = 0; i < sp->sub.num_rects; i++) | |||
| { | |||
| for (j = 0; j < sp->sub.rects[i].nb_colors; j++) | |||
| @@ -1365,7 +1365,7 @@ static int subtitle_thread(void *arg) | |||
| SDL_UnlockMutex(is->subpq_mutex); | |||
| } | |||
| av_free_packet(pkt); | |||
| // if (step) | |||
| // if (step) | |||
| // if (cur_stream) | |||
| // stream_pause(cur_stream); | |||
| } | |||
| @@ -1396,12 +1396,12 @@ static void update_sample_display(VideoState *is, short *samples, int samples_si | |||
| /* return the new audio buffer size (samples can be added or deleted | |||
| to get better sync if video or external master clock) */ | |||
| static int synchronize_audio(VideoState *is, short *samples, | |||
| static int synchronize_audio(VideoState *is, short *samples, | |||
| int samples_size1, double pts) | |||
| { | |||
| int n, samples_size; | |||
| double ref_clock; | |||
| n = 2 * is->audio_st->codec->channels; | |||
| samples_size = samples_size1; | |||
| @@ -1410,10 +1410,10 @@ static int synchronize_audio(VideoState *is, short *samples, | |||
| is->av_sync_type == AV_SYNC_EXTERNAL_CLOCK)) { | |||
| double diff, avg_diff; | |||
| int wanted_size, min_size, max_size, nb_samples; | |||
| ref_clock = get_master_clock(is); | |||
| diff = get_audio_clock(is) - ref_clock; | |||
| if (diff < AV_NOSYNC_THRESHOLD) { | |||
| is->audio_diff_cum = diff + is->audio_diff_avg_coef * is->audio_diff_cum; | |||
| if (is->audio_diff_avg_count < AUDIO_DIFF_AVG_NB) { | |||
| @@ -1426,14 +1426,14 @@ static int synchronize_audio(VideoState *is, short *samples, | |||
| if (fabs(avg_diff) >= is->audio_diff_threshold) { | |||
| wanted_size = samples_size + ((int)(diff * is->audio_st->codec->sample_rate) * n); | |||
| nb_samples = samples_size / n; | |||
| min_size = ((nb_samples * (100 - SAMPLE_CORRECTION_PERCENT_MAX)) / 100) * n; | |||
| max_size = ((nb_samples * (100 + SAMPLE_CORRECTION_PERCENT_MAX)) / 100) * n; | |||
| if (wanted_size < min_size) | |||
| wanted_size = min_size; | |||
| else if (wanted_size > max_size) | |||
| wanted_size = max_size; | |||
| /* add or remove samples to correction the synchro */ | |||
| if (wanted_size < samples_size) { | |||
| /* remove samples */ | |||
| @@ -1441,7 +1441,7 @@ static int synchronize_audio(VideoState *is, short *samples, | |||
| } else if (wanted_size > samples_size) { | |||
| uint8_t *samples_end, *q; | |||
| int nb; | |||
| /* add samples */ | |||
| nb = (samples_size - wanted_size); | |||
| samples_end = (uint8_t *)samples + samples_size - n; | |||
| @@ -1455,8 +1455,8 @@ static int synchronize_audio(VideoState *is, short *samples, | |||
| } | |||
| } | |||
| #if 0 | |||
| printf("diff=%f adiff=%f sample_diff=%d apts=%0.3f vpts=%0.3f %f\n", | |||
| diff, avg_diff, samples_size - samples_size1, | |||
| printf("diff=%f adiff=%f sample_diff=%d apts=%0.3f vpts=%0.3f %f\n", | |||
| diff, avg_diff, samples_size - samples_size1, | |||
| is->audio_clock, is->video_clock, is->audio_diff_threshold); | |||
| #endif | |||
| } | |||
| @@ -1482,8 +1482,8 @@ static int audio_decode_frame(VideoState *is, uint8_t *audio_buf, double *pts_pt | |||
| /* NOTE: the audio packet can contain several frames */ | |||
| while (is->audio_pkt_size > 0) { | |||
| SDL_LockMutex(is->audio_decoder_mutex); | |||
| len1 = avcodec_decode_audio(is->audio_st->codec, | |||
| (int16_t *)audio_buf, &data_size, | |||
| len1 = avcodec_decode_audio(is->audio_st->codec, | |||
| (int16_t *)audio_buf, &data_size, | |||
| is->audio_pkt_data, is->audio_pkt_size); | |||
| SDL_UnlockMutex(is->audio_decoder_mutex); | |||
| if (len1 < 0) { | |||
| @@ -1491,7 +1491,7 @@ static int audio_decode_frame(VideoState *is, uint8_t *audio_buf, double *pts_pt | |||
| is->audio_pkt_size = 0; | |||
| break; | |||
| } | |||
| is->audio_pkt_data += len1; | |||
| is->audio_pkt_size -= len1; | |||
| if (data_size <= 0) | |||
| @@ -1500,7 +1500,7 @@ static int audio_decode_frame(VideoState *is, uint8_t *audio_buf, double *pts_pt | |||
| pts = is->audio_clock; | |||
| *pts_ptr = pts; | |||
| n = 2 * is->audio_st->codec->channels; | |||
| is->audio_clock += (double)data_size / | |||
| is->audio_clock += (double)data_size / | |||
| (double)(n * is->audio_st->codec->sample_rate); | |||
| #if defined(DEBUG_SYNC) | |||
| { | |||
| @@ -1517,17 +1517,17 @@ static int audio_decode_frame(VideoState *is, uint8_t *audio_buf, double *pts_pt | |||
| /* free the current packet */ | |||
| if (pkt->data) | |||
| av_free_packet(pkt); | |||
| if (is->paused || is->audioq.abort_request) { | |||
| return -1; | |||
| } | |||
| /* read next packet */ | |||
| if (packet_queue_get(&is->audioq, pkt, 1) < 0) | |||
| return -1; | |||
| is->audio_pkt_data = pkt->data; | |||
| is->audio_pkt_size = pkt->size; | |||
| /* if update the audio clock with the pts */ | |||
| if (pkt->pts != AV_NOPTS_VALUE) { | |||
| is->audio_clock = av_q2d(is->audio_st->time_base)*pkt->pts; | |||
| @@ -1551,7 +1551,7 @@ void sdl_audio_callback(void *opaque, Uint8 *stream, int len) | |||
| double pts; | |||
| audio_callback_time = av_gettime(); | |||
| while (len > 0) { | |||
| if (is->audio_buf_index >= is->audio_buf_size) { | |||
| audio_size = audio_decode_frame(is, is->audio_buf, &pts); | |||
| @@ -1562,7 +1562,7 @@ void sdl_audio_callback(void *opaque, Uint8 *stream, int len) | |||
| } else { | |||
| if (is->show_audio) | |||
| update_sample_display(is, (int16_t *)is->audio_buf, audio_size); | |||
| audio_size = synchronize_audio(is, (int16_t *)is->audio_buf, audio_size, | |||
| audio_size = synchronize_audio(is, (int16_t *)is->audio_buf, audio_size, | |||
| pts); | |||
| is->audio_buf_size = audio_size; | |||
| } | |||
| @@ -1590,7 +1590,7 @@ static int stream_component_open(VideoState *is, int stream_index) | |||
| if (stream_index < 0 || stream_index >= ic->nb_streams) | |||
| return -1; | |||
| enc = ic->streams[stream_index]->codec; | |||
| /* prepare audio output */ | |||
| if (enc->codec_type == CODEC_TYPE_AUDIO) { | |||
| wanted_spec.freq = enc->sample_rate; | |||
| @@ -1666,7 +1666,7 @@ static int stream_component_open(VideoState *is, int stream_index) | |||
| is->subtitle_stream = stream_index; | |||
| is->subtitle_st = ic->streams[stream_index]; | |||
| packet_queue_init(&is->subtitleq); | |||
| is->subtitle_tid = SDL_CreateThread(subtitle_thread, is); | |||
| break; | |||
| default: | |||
| @@ -1679,7 +1679,7 @@ static void stream_component_close(VideoState *is, int stream_index) | |||
| { | |||
| AVFormatContext *ic = is->ic; | |||
| AVCodecContext *enc; | |||
| if (stream_index < 0 || stream_index >= ic->nb_streams) | |||
| return; | |||
| enc = ic->streams[stream_index]->codec; | |||
| @@ -1707,12 +1707,12 @@ static void stream_component_close(VideoState *is, int stream_index) | |||
| break; | |||
| case CODEC_TYPE_SUBTITLE: | |||
| packet_queue_abort(&is->subtitleq); | |||
| /* note: we also signal this mutex to make sure we deblock the | |||
| video thread in all cases */ | |||
| SDL_LockMutex(is->subpq_mutex); | |||
| is->subtitle_stream_changed = 1; | |||
| SDL_CondSignal(is->subpq_cond); | |||
| SDL_UnlockMutex(is->subpq_mutex); | |||
| @@ -1790,7 +1790,7 @@ static int decode_thread(void *arg) | |||
| ap->image_format = image_format; | |||
| ap->initial_pause = 1; /* we force a pause when starting an RTSP | |||
| stream */ | |||
| err = av_open_input_file(&ic, is->filename, is->iformat, 0, ap); | |||
| if (err < 0) { | |||
| print_error(is->filename, err); | |||
| @@ -1827,7 +1827,7 @@ static int decode_thread(void *arg) | |||
| timestamp += ic->start_time; | |||
| ret = av_seek_frame(ic, -1, timestamp, AVSEEK_FLAG_BACKWARD); | |||
| if (ret < 0) { | |||
| fprintf(stderr, "%s: could not seek to position %0.3f\n", | |||
| fprintf(stderr, "%s: could not seek to position %0.3f\n", | |||
| is->filename, (double)timestamp / AV_TIME_BASE); | |||
| } | |||
| } | |||
| @@ -1928,8 +1928,8 @@ static int decode_thread(void *arg) | |||
| /* if the queue are full, no need to read more */ | |||
| if (is->audioq.size > MAX_AUDIOQ_SIZE || | |||
| is->videoq.size > MAX_VIDEOQ_SIZE || | |||
| is->subtitleq.size > MAX_SUBTITLEQ_SIZE || | |||
| is->videoq.size > MAX_VIDEOQ_SIZE || | |||
| is->subtitleq.size > MAX_SUBTITLEQ_SIZE || | |||
| url_feof(&ic->pb)) { | |||
| /* wait 10 ms */ | |||
| SDL_Delay(10); | |||
| @@ -1978,7 +1978,7 @@ static int decode_thread(void *arg) | |||
| if (ret != 0) { | |||
| SDL_Event event; | |||
| event.type = FF_QUIT_EVENT; | |||
| event.user.data1 = is; | |||
| SDL_PushEvent(&event); | |||
| @@ -2005,10 +2005,10 @@ static VideoState *stream_open(const char *filename, AVInputFormat *iformat) | |||
| /* start video display */ | |||
| is->pictq_mutex = SDL_CreateMutex(); | |||
| is->pictq_cond = SDL_CreateCond(); | |||
| is->subpq_mutex = SDL_CreateMutex(); | |||
| is->subpq_cond = SDL_CreateCond(); | |||
| is->subtitle_decoder_mutex = SDL_CreateMutex(); | |||
| is->audio_decoder_mutex = SDL_CreateMutex(); | |||
| is->video_decoder_mutex = SDL_CreateMutex(); | |||
| @@ -2187,15 +2187,15 @@ void event_loop(void) | |||
| step_to_next_frame(); | |||
| break; | |||
| case SDLK_a: | |||
| if (cur_stream) | |||
| if (cur_stream) | |||
| stream_cycle_channel(cur_stream, CODEC_TYPE_AUDIO); | |||
| break; | |||
| case SDLK_v: | |||
| if (cur_stream) | |||
| if (cur_stream) | |||
| stream_cycle_channel(cur_stream, CODEC_TYPE_VIDEO); | |||
| break; | |||
| case SDLK_t: | |||
| if (cur_stream) | |||
| if (cur_stream) | |||
| stream_cycle_channel(cur_stream, CODEC_TYPE_SUBTITLE); | |||
| break; | |||
| case SDLK_w: | |||
| @@ -2243,7 +2243,7 @@ void event_loop(void) | |||
| break; | |||
| case SDL_VIDEORESIZE: | |||
| if (cur_stream) { | |||
| screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 0, | |||
| screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 0, | |||
| SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL); | |||
| cur_stream->width = event.resize.w; | |||
| cur_stream->height = event.resize.h; | |||
| @@ -2287,7 +2287,7 @@ static void opt_format(const char *arg) | |||
| static void opt_image_format(const char *arg) | |||
| { | |||
| AVImageFormat *f; | |||
| for(f = first_image_format; f != NULL; f = f->next) { | |||
| if (!strcmp(arg, f->name)) | |||
| break; | |||
| @@ -2328,7 +2328,7 @@ static void opt_debug(const char *arg) | |||
| { | |||
| debug = atoi(arg); | |||
| } | |||
| static void opt_vismv(const char *arg) | |||
| { | |||
| debug_mv = atoi(arg); | |||
| @@ -2341,9 +2341,9 @@ static void opt_thread_count(const char *arg) | |||
| fprintf(stderr, "Warning: not compiled with thread support, using thread emulation\n"); | |||
| #endif | |||
| } | |||
| const OptionDef options[] = { | |||
| { "h", 0, {(void*)show_help}, "show help" }, | |||
| { "h", 0, {(void*)show_help}, "show help" }, | |||
| { "x", HAS_ARG, {(void*)opt_width}, "force displayed width", "width" }, | |||
| { "y", HAS_ARG, {(void*)opt_height}, "force displayed height", "height" }, | |||
| #if 0 | |||
| @@ -2413,13 +2413,13 @@ void parse_arg_file(const char *filename) | |||
| int main(int argc, char **argv) | |||
| { | |||
| int flags, w, h; | |||
| /* register all codecs, demux and protocols */ | |||
| av_register_all(); | |||
| #ifdef CONFIG_OS2 | |||
| MorphToPM(); // Morph the VIO application to a PM one to be able to use Win* functions | |||
| // Make stdout and stderr unbuffered | |||
| setbuf( stdout, NULL ); | |||
| setbuf( stderr, NULL ); | |||
| @@ -16,12 +16,12 @@ | |||
| * License along with this library; if not, write to the Free Software | |||
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
| */ | |||
| /** | |||
| * @file 4xm.c | |||
| * 4XM codec. | |||
| */ | |||
| #include "avcodec.h" | |||
| #include "dsputil.h" | |||
| #include "mpegvideo.h" | |||
| @@ -141,7 +141,7 @@ static void idct(DCTELEM block[64]){ | |||
| int z5, z10, z11, z12, z13; | |||
| int i; | |||
| int temp[64]; | |||
| for(i=0; i<8; i++){ | |||
| tmp10 = block[8*0 + i] + block[8*4 + i]; | |||
| tmp11 = block[8*0 + i] - block[8*4 + i]; | |||
| @@ -153,7 +153,7 @@ static void idct(DCTELEM block[64]){ | |||
| tmp3 = tmp10 - tmp13; | |||
| tmp1 = tmp11 + tmp12; | |||
| tmp2 = tmp11 - tmp12; | |||
| z13 = block[8*5 + i] + block[8*3 + i]; | |||
| z10 = block[8*5 + i] - block[8*3 + i]; | |||
| z11 = block[8*1 + i] + block[8*7 + i]; | |||
| @@ -179,7 +179,7 @@ static void idct(DCTELEM block[64]){ | |||
| temp[8*4 + i] = tmp3 + tmp4; | |||
| temp[8*3 + i] = tmp3 - tmp4; | |||
| } | |||
| for(i=0; i<8*8; i+=8){ | |||
| tmp10 = temp[0 + i] + temp[4 + i]; | |||
| tmp11 = temp[0 + i] - temp[4 + i]; | |||
| @@ -223,7 +223,7 @@ static void init_vlcs(FourXContext *f){ | |||
| int i; | |||
| for(i=0; i<4; i++){ | |||
| init_vlc(&block_type_vlc[i], BLOCK_TYPE_VLC_BITS, 7, | |||
| init_vlc(&block_type_vlc[i], BLOCK_TYPE_VLC_BITS, 7, | |||
| &block_type_tab[i][0][1], 2, 1, | |||
| &block_type_tab[i][0][0], 2, 1, 1); | |||
| } | |||
| @@ -282,7 +282,7 @@ static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src, int lo | |||
| const int index= size2index[log2h][log2w]; | |||
| const int h= 1<<log2h; | |||
| int code= get_vlc2(&f->gb, block_type_vlc[index].table, BLOCK_TYPE_VLC_BITS, 1); | |||
| assert(code>=0 && code<=6); | |||
| if(code == 0){ | |||
| @@ -326,41 +326,41 @@ static int decode_p_frame(FourXContext *f, uint8_t *buf, int length){ | |||
| const unsigned int bitstream_size= get32(buf+8); | |||
| const unsigned int bytestream_size= get32(buf+16); | |||
| const unsigned int wordstream_size= get32(buf+12); | |||
| if(bitstream_size+ bytestream_size+ wordstream_size + 20 != length | |||
| || bitstream_size > (1<<26) | |||
| || bytestream_size > (1<<26) | |||
| || wordstream_size > (1<<26) | |||
| ){ | |||
| av_log(f->avctx, AV_LOG_ERROR, "lengths %d %d %d %d\n", bitstream_size, bytestream_size, wordstream_size, | |||
| av_log(f->avctx, AV_LOG_ERROR, "lengths %d %d %d %d\n", bitstream_size, bytestream_size, wordstream_size, | |||
| bitstream_size+ bytestream_size+ wordstream_size - length); | |||
| return -1; | |||
| } | |||
| f->bitstream_buffer= av_fast_realloc(f->bitstream_buffer, &f->bitstream_buffer_size, bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE); | |||
| f->dsp.bswap_buf((uint32_t*)f->bitstream_buffer, (uint32_t*)(buf + 20), bitstream_size/4); | |||
| init_get_bits(&f->gb, f->bitstream_buffer, 8*bitstream_size); | |||
| f->wordstream= (uint16_t*)(buf + 20 + bitstream_size); | |||
| f->bytestream= buf + 20 + bitstream_size + wordstream_size; | |||
| init_mv(f); | |||
| for(y=0; y<height; y+=8){ | |||
| for(x=0; x<width; x+=8){ | |||
| decode_p_block(f, dst + x, src + x, 3, 3, stride); | |||
| } | |||
| src += 8*stride; | |||
| dst += 8*stride; | |||
| src += 8*stride; | |||
| dst += 8*stride; | |||
| } | |||
| if(bitstream_size != (get_bits_count(&f->gb)+31)/32*4) | |||
| av_log(f->avctx, AV_LOG_ERROR, " %d %td %td bytes left\n", | |||
| bitstream_size - (get_bits_count(&f->gb)+31)/32*4, | |||
| av_log(f->avctx, AV_LOG_ERROR, " %d %td %td bytes left\n", | |||
| bitstream_size - (get_bits_count(&f->gb)+31)/32*4, | |||
| bytestream_size - (f->bytestream - (buf + 20 + bitstream_size + wordstream_size)), | |||
| wordstream_size - (((uint8_t*)f->wordstream) - (buf + 20 + bitstream_size)) | |||
| ); | |||
| return 0; | |||
| } | |||
| @@ -387,7 +387,7 @@ static int decode_i_block(FourXContext *f, DCTELEM *block){ | |||
| i = 1; | |||
| for(;;) { | |||
| code = get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3); | |||
| /* EOB */ | |||
| if (code == 0) | |||
| break; | |||
| @@ -417,7 +417,7 @@ static inline void idct_put(FourXContext *f, int x, int y){ | |||
| int stride= f->current_picture.linesize[0]>>1; | |||
| int i; | |||
| uint16_t *dst = ((uint16_t*)f->current_picture.data[0]) + y * stride + x; | |||
| for(i=0; i<4; i++){ | |||
| block[i][0] += 0x80*8*8; | |||
| idct(block[i]); | |||
| @@ -431,7 +431,7 @@ static inline void idct_put(FourXContext *f, int x, int y){ | |||
| y= ( 1b + 4g + 2r)/14 | |||
| cb=( 3b - 2g - 1r)/14 | |||
| cr=(-1b - 4g + 5r)/14 | |||
| */ | |||
| */ | |||
| for(y=0; y<8; y++){ | |||
| for(x=0; x<8; x++){ | |||
| DCTELEM *temp= block[(x>>2) + 2*(y>>2)] + 2*(x&3) + 2*8*(y&3); //FIXME optimize | |||
| @@ -439,9 +439,9 @@ cr=(-1b - 4g + 5r)/14 | |||
| int cr= block[5][x + 8*y]; | |||
| int cg= (cb + cr)>>1; | |||
| int y; | |||
| cb+=cb; | |||
| y = temp[0]; | |||
| dst[0 ]= ((y+cb)>>3) + (((y-cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8); | |||
| y = temp[1]; | |||
| @@ -458,14 +458,14 @@ cr=(-1b - 4g + 5r)/14 | |||
| static int decode_i_mb(FourXContext *f){ | |||
| int i; | |||
| f->dsp.clear_blocks(f->block[0]); | |||
| for(i=0; i<6; i++){ | |||
| if(decode_i_block(f, f->block[i]) < 0) | |||
| return -1; | |||
| } | |||
| return 0; | |||
| } | |||
| @@ -478,7 +478,7 @@ static uint8_t *read_huffman_tables(FourXContext *f, uint8_t * const buf){ | |||
| int start, end; | |||
| uint8_t *ptr= buf; | |||
| int j; | |||
| memset(frequency, 0, sizeof(frequency)); | |||
| memset(up, -1, sizeof(up)); | |||
| @@ -486,23 +486,23 @@ static uint8_t *read_huffman_tables(FourXContext *f, uint8_t * const buf){ | |||
| end= *ptr++; | |||
| for(;;){ | |||
| int i; | |||
| for(i=start; i<=end; i++){ | |||
| frequency[i]= *ptr++; | |||
| // printf("%d %d %d\n", start, end, frequency[i]); | |||
| } | |||
| start= *ptr++; | |||
| if(start==0) break; | |||
| end= *ptr++; | |||
| } | |||
| frequency[256]=1; | |||
| while((ptr - buf)&3) ptr++; // 4byte align | |||
| while((ptr - buf)&3) ptr++; // 4byte align | |||
| // for(j=0; j<16; j++) | |||
| // printf("%2X", ptr[j]); | |||
| for(j=257; j<512; j++){ | |||
| int min_freq[2]= {256*256, 256*256}; | |||
| int smallest[2]= {0, 0}; | |||
| @@ -519,11 +519,11 @@ static uint8_t *read_huffman_tables(FourXContext *f, uint8_t * const buf){ | |||
| } | |||
| } | |||
| if(min_freq[1] == 256*256) break; | |||
| frequency[j]= min_freq[0] + min_freq[1]; | |||
| flag[ smallest[0] ]= 0; | |||
| flag[ smallest[1] ]= 1; | |||
| up[ smallest[0] ]= | |||
| up[ smallest[0] ]= | |||
| up[ smallest[1] ]= j; | |||
| frequency[ smallest[0] ]= frequency[ smallest[1] ]= 0; | |||
| } | |||
| @@ -538,15 +538,15 @@ static uint8_t *read_huffman_tables(FourXContext *f, uint8_t * const buf){ | |||
| len++; | |||
| if(len > 31) av_log(f->avctx, AV_LOG_ERROR, "vlc length overflow\n"); //can this happen at all ? | |||
| } | |||
| bits_tab[j]= bits; | |||
| len_tab[j]= len; | |||
| } | |||
| init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257, | |||
| init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257, | |||
| len_tab , 1, 1, | |||
| bits_tab, 4, 4, 0); | |||
| return ptr; | |||
| } | |||
| @@ -560,14 +560,14 @@ static int decode_i_frame(FourXContext *f, uint8_t *buf, int length){ | |||
| const int token_count __attribute__((unused)) = get32(buf + bitstream_size + 8); | |||
| unsigned int prestream_size= 4*get32(buf + bitstream_size + 4); | |||
| uint8_t *prestream= buf + bitstream_size + 12; | |||
| if(prestream_size + bitstream_size + 12 != length | |||
| || bitstream_size > (1<<26) | |||
| || prestream_size > (1<<26)){ | |||
| av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d %d\n", prestream_size, bitstream_size, length); | |||
| return -1; | |||
| } | |||
| prestream= read_huffman_tables(f, prestream); | |||
| init_get_bits(&f->gb, buf + 4, 8*bitstream_size); | |||
| @@ -579,7 +579,7 @@ static int decode_i_frame(FourXContext *f, uint8_t *buf, int length){ | |||
| init_get_bits(&f->pre_gb, f->bitstream_buffer, 8*prestream_size); | |||
| f->last_dc= 0*128*8*8; | |||
| for(y=0; y<height; y+=16){ | |||
| for(x=0; x<width; x+=16){ | |||
| if(decode_i_mb(f) < 0) | |||
| @@ -587,16 +587,16 @@ static int decode_i_frame(FourXContext *f, uint8_t *buf, int length){ | |||
| idct_put(f, x, y); | |||
| } | |||
| dst += 16*stride; | |||
| dst += 16*stride; | |||
| } | |||
| if(get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3) != 256) | |||
| av_log(f->avctx, AV_LOG_ERROR, "end mismatch\n"); | |||
| return 0; | |||
| } | |||
| static int decode_frame(AVCodecContext *avctx, | |||
| static int decode_frame(AVCodecContext *avctx, | |||
| void *data, int *data_size, | |||
| uint8_t *buf, int buf_size) | |||
| { | |||
| @@ -621,7 +621,7 @@ static int decode_frame(AVCodecContext *avctx, | |||
| if(f->cfrm[i].id && f->cfrm[i].id < avctx->frame_number) | |||
| av_log(f->avctx, AV_LOG_ERROR, "lost c frame %d\n", f->cfrm[i].id); | |||
| } | |||
| for(i=0; i<CFRAME_BUFFER_COUNT; i++){ | |||
| if(f->cfrm[i].id == id) break; | |||
| if(f->cfrm[i].size == 0 ) free_index= i; | |||
| @@ -632,20 +632,20 @@ static int decode_frame(AVCodecContext *avctx, | |||
| f->cfrm[i].id= id; | |||
| } | |||
| cfrm= &f->cfrm[i]; | |||
| cfrm->data= av_fast_realloc(cfrm->data, &cfrm->allocated_size, cfrm->size + data_size + FF_INPUT_BUFFER_PADDING_SIZE); | |||
| memcpy(cfrm->data + cfrm->size, buf+20, data_size); | |||
| cfrm->size += data_size; | |||
| if(cfrm->size >= whole_size){ | |||
| buf= cfrm->data; | |||
| frame_size= cfrm->size; | |||
| if(id != avctx->frame_number){ | |||
| av_log(f->avctx, AV_LOG_ERROR, "cframe id mismatch %d %d\n", id, avctx->frame_number); | |||
| } | |||
| cfrm->size= cfrm->id= 0; | |||
| frame_4cc= ff_get_fourcc("pfrm"); | |||
| }else | |||
| @@ -653,7 +653,7 @@ static int decode_frame(AVCodecContext *avctx, | |||
| }else{ | |||
| buf= buf + 12; | |||
| frame_size= buf_size - 12; | |||
| } | |||
| } | |||
| temp= f->current_picture; | |||
| f->current_picture= f->last_picture; | |||
| @@ -699,7 +699,7 @@ for(i=0; i<20; i++){ | |||
| *data_size = sizeof(AVPicture); | |||
| emms_c(); | |||
| return buf_size; | |||
| } | |||
| @@ -714,7 +714,7 @@ static void common_init(AVCodecContext *avctx){ | |||
| static int decode_init(AVCodecContext *avctx){ | |||
| FourXContext * const f = avctx->priv_data; | |||
| common_init(avctx); | |||
| init_vlcs(f); | |||
| @@ -735,7 +735,7 @@ static int decode_end(AVCodecContext *avctx){ | |||
| f->cfrm[i].allocated_size= 0; | |||
| } | |||
| free_vlc(&f->pre_vlc); | |||
| return 0; | |||
| } | |||
| @@ -69,7 +69,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| unsigned int px_inc; | |||
| unsigned int planes = c->planes; | |||
| unsigned char *planemap = c->planemap; | |||
| if(c->pic.data[0]) | |||
| avctx->release_buffer(avctx, &c->pic); | |||
| @@ -380,7 +380,7 @@ endif | |||
| ifeq ($(TARGET_ARCH_SPARC),yes) | |||
| OBJS+=sparc/dsputil_vis.o | |||
| sparc/%.o: sparc/%.c | |||
| $(CC) -mcpu=ultrasparc -mtune=ultrasparc $(CFLAGS) -c -o $@ $< | |||
| $(CC) -mcpu=ultrasparc -mtune=ultrasparc $(CFLAGS) -c -o $@ $< | |||
| endif | |||
| ifeq ($(TARGET_ARCH_SPARC64),yes) | |||
| CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc | |||
| @@ -430,7 +430,7 @@ libpostproc/libpostproc.a: | |||
| $(MAKE) -C libpostproc | |||
| %.o: %.c | |||
| $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $< | |||
| $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $< | |||
| %.o: %.S | |||
| $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $< | |||
| @@ -59,5 +59,5 @@ void ac3_common_init(void); | |||
| void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap, | |||
| int8_t *exp, int start, int end, | |||
| int snroffset, int fgain, int is_lfe, | |||
| int deltbae,int deltnseg, | |||
| int deltbae,int deltnseg, | |||
| uint8_t *deltoffst, uint8_t *deltlen, uint8_t *deltba); | |||
| @@ -78,7 +78,7 @@ static inline void float_to_int (float * _f, int16_t * s16, int nchannels) | |||
| #define HEADER_SIZE 7 | |||
| static int ac3_decode_frame(AVCodecContext *avctx, | |||
| static int ac3_decode_frame(AVCodecContext *avctx, | |||
| void *data, int *data_size, | |||
| uint8_t *buf, int buf_size) | |||
| { | |||
| @@ -46,9 +46,9 @@ typedef struct AC3EncodeContext { | |||
| short last_samples[AC3_MAX_CHANNELS][256]; | |||
| unsigned int chbwcod[AC3_MAX_CHANNELS]; | |||
| int nb_coefs[AC3_MAX_CHANNELS]; | |||
| /* bitrate allocation control */ | |||
| int sgaincod, sdecaycod, fdecaycod, dbkneecod, floorcod; | |||
| int sgaincod, sdecaycod, fdecaycod, dbkneecod, floorcod; | |||
| AC3BitAllocParameters bit_alloc; | |||
| int csnroffst; | |||
| int fgaincod[AC3_MAX_CHANNELS]; | |||
| @@ -74,7 +74,7 @@ static inline int16_t fix15(float a) | |||
| v = (int)(a * (float)(1 << 15)); | |||
| if (v < -32767) | |||
| v = -32767; | |||
| else if (v > 32767) | |||
| else if (v > 32767) | |||
| v = 32767; | |||
| return v; | |||
| } | |||
| @@ -83,7 +83,7 @@ static inline int calc_lowcomp1(int a, int b0, int b1) | |||
| { | |||
| if ((b0 + 256) == b1) { | |||
| a = 384 ; | |||
| } else if (b0 > b1) { | |||
| } else if (b0 > b1) { | |||
| a = a - 64; | |||
| if (a < 0) a=0; | |||
| } | |||
| @@ -95,7 +95,7 @@ static inline int calc_lowcomp(int a, int b0, int b1, int bin) | |||
| if (bin < 7) { | |||
| if ((b0 + 256) == b1) { | |||
| a = 384 ; | |||
| } else if (b0 > b1) { | |||
| } else if (b0 > b1) { | |||
| a = a - 64; | |||
| if (a < 0) a=0; | |||
| } | |||
| @@ -118,7 +118,7 @@ static inline int calc_lowcomp(int a, int b0, int b1, int bin) | |||
| void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap, | |||
| int8_t *exp, int start, int end, | |||
| int snroffset, int fgain, int is_lfe, | |||
| int deltbae,int deltnseg, | |||
| int deltbae,int deltnseg, | |||
| uint8_t *deltoffst, uint8_t *deltlen, uint8_t *deltba) | |||
| { | |||
| int bin,i,j,k,end1,v,v1,bndstrt,bndend,lowcomp,begin; | |||
| @@ -164,7 +164,7 @@ void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap, | |||
| /* excitation function */ | |||
| bndstrt = masktab[start]; | |||
| bndend = masktab[end-1] + 1; | |||
| if (bndstrt == 0) { | |||
| lowcomp = 0; | |||
| lowcomp = calc_lowcomp1(lowcomp, bndpsd[0], bndpsd[1]) ; | |||
| @@ -185,32 +185,32 @@ void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap, | |||
| } | |||
| } | |||
| } | |||
| end1=bndend; | |||
| if (end1 > 22) end1=22; | |||
| for (bin = begin; bin < end1; bin++) { | |||
| if (!(is_lfe && bin == 6)) | |||
| lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin+1], bin) ; | |||
| fastleak -= s->fdecay ; | |||
| v = bndpsd[bin] - fgain; | |||
| if (fastleak < v) fastleak = v; | |||
| slowleak -= s->sdecay ; | |||
| v = bndpsd[bin] - s->sgain; | |||
| if (slowleak < v) slowleak = v; | |||
| v=fastleak - lowcomp; | |||
| if (slowleak > v) v=slowleak; | |||
| excite[bin] = v; | |||
| } | |||
| begin = 22; | |||
| } else { | |||
| /* coupling channel */ | |||
| begin = bndstrt; | |||
| fastleak = (s->cplfleak << 8) + 768; | |||
| slowleak = (s->cplsleak << 8) + 768; | |||
| } | |||
| @@ -261,7 +261,7 @@ void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap, | |||
| } | |||
| /* compute bit allocation */ | |||
| i = start ; | |||
| j = masktab[start] ; | |||
| do { | |||
| @@ -361,7 +361,7 @@ static void fft(IComplex *z, int ln) | |||
| p=&z[0]; | |||
| j=(np >> 1); | |||
| do { | |||
| BF(p[0].re, p[0].im, p[1].re, p[1].im, | |||
| 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); | |||
| @@ -371,9 +371,9 @@ static void fft(IComplex *z, int ln) | |||
| p=&z[0]; | |||
| j=np >> 2; | |||
| do { | |||
| BF(p[0].re, p[0].im, p[2].re, p[2].im, | |||
| 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, | |||
| 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); | |||
| @@ -390,7 +390,7 @@ static void fft(IComplex *z, int ln) | |||
| 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) { | |||
| @@ -412,7 +412,7 @@ static void fft(IComplex *z, int ln) | |||
| static void mdct512(int32_t *out, int16_t *in) | |||
| { | |||
| int i, re, im, re1, im1; | |||
| int16_t rot[N]; | |||
| int16_t rot[N]; | |||
| IComplex x[N/4]; | |||
| /* shift to simplify computations */ | |||
| @@ -420,7 +420,7 @@ static void mdct512(int32_t *out, int16_t *in) | |||
| rot[i] = -in[i + 3*N/4]; | |||
| for(i=N/4;i<N;i++) | |||
| rot[i] = in[i - N/4]; | |||
| /* pre rotation */ | |||
| for(i=0;i<N/4;i++) { | |||
| re = ((int)rot[2*i] - (int)rot[N-1-2*i]) >> 1; | |||
| @@ -429,7 +429,7 @@ static void mdct512(int32_t *out, int16_t *in) | |||
| } | |||
| fft(x, MDCT_NBITS - 2); | |||
| /* post rotation */ | |||
| for(i=0;i<N/4;i++) { | |||
| re = x[i].re; | |||
| @@ -457,13 +457,13 @@ static void compute_exp_strategy(uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNEL | |||
| { | |||
| int i, j; | |||
| int exp_diff; | |||
| /* estimate if the exponent variation & decide if they should be | |||
| reused in the next frame */ | |||
| exp_strategy[0][ch] = EXP_NEW; | |||
| for(i=1;i<NB_BLOCKS;i++) { | |||
| exp_diff = calc_exp_diff(exp[i][ch], exp[i-1][ch], N/2); | |||
| #ifdef DEBUG | |||
| #ifdef DEBUG | |||
| av_log(NULL, AV_LOG_DEBUG, "exp_diff=%d\n", exp_diff); | |||
| #endif | |||
| if (exp_diff > EXP_DIFF_THRESHOLD) | |||
| @@ -507,11 +507,11 @@ static void exponent_min(uint8_t exp[N/2], uint8_t exp1[N/2], int n) | |||
| exp[i] = exp1[i]; | |||
| } | |||
| } | |||
| /* update the exponents so that they are the ones the decoder will | |||
| decode. Return the number of bits used to code the exponents */ | |||
| static int encode_exp(uint8_t encoded_exp[N/2], | |||
| uint8_t exp[N/2], | |||
| static int encode_exp(uint8_t encoded_exp[N/2], | |||
| uint8_t exp[N/2], | |||
| int nb_exps, | |||
| int exp_strategy) | |||
| { | |||
| @@ -566,7 +566,7 @@ static int encode_exp(uint8_t encoded_exp[N/2], | |||
| } | |||
| k += group_size; | |||
| } | |||
| #if defined(DEBUG) | |||
| av_log(NULL, AV_LOG_DEBUG, "exponents: strategy=%d\n", exp_strategy); | |||
| for(i=0;i<=nb_groups * group_size;i++) { | |||
| @@ -592,14 +592,14 @@ static int compute_mantissa_size(AC3EncodeContext *s, uint8_t *m, int nb_coefs) | |||
| break; | |||
| case 1: | |||
| /* 3 mantissa in 5 bits */ | |||
| if (s->mant1_cnt == 0) | |||
| if (s->mant1_cnt == 0) | |||
| bits += 5; | |||
| if (++s->mant1_cnt == 3) | |||
| s->mant1_cnt = 0; | |||
| break; | |||
| case 2: | |||
| /* 3 mantissa in 7 bits */ | |||
| if (s->mant2_cnt == 0) | |||
| if (s->mant2_cnt == 0) | |||
| bits += 7; | |||
| if (++s->mant2_cnt == 3) | |||
| s->mant2_cnt = 0; | |||
| @@ -611,7 +611,7 @@ static int compute_mantissa_size(AC3EncodeContext *s, uint8_t *m, int nb_coefs) | |||
| /* 2 mantissa in 7 bits */ | |||
| if (s->mant4_cnt == 0) | |||
| bits += 7; | |||
| if (++s->mant4_cnt == 2) | |||
| if (++s->mant4_cnt == 2) | |||
| s->mant4_cnt = 0; | |||
| break; | |||
| case 14: | |||
| @@ -643,21 +643,21 @@ static int bit_alloc(AC3EncodeContext *s, | |||
| s->mant2_cnt = 0; | |||
| s->mant4_cnt = 0; | |||
| for(ch=0;ch<s->nb_all_channels;ch++) { | |||
| ac3_parametric_bit_allocation(&s->bit_alloc, | |||
| bap[i][ch], (int8_t *)encoded_exp[i][ch], | |||
| 0, s->nb_coefs[ch], | |||
| (((csnroffst-15) << 4) + | |||
| fsnroffst) << 2, | |||
| ac3_parametric_bit_allocation(&s->bit_alloc, | |||
| bap[i][ch], (int8_t *)encoded_exp[i][ch], | |||
| 0, s->nb_coefs[ch], | |||
| (((csnroffst-15) << 4) + | |||
| fsnroffst) << 2, | |||
| fgaintab[s->fgaincod[ch]], | |||
| ch == s->lfe_channel, | |||
| 2, 0, NULL, NULL, NULL); | |||
| frame_bits += compute_mantissa_size(s, bap[i][ch], | |||
| frame_bits += compute_mantissa_size(s, bap[i][ch], | |||
| s->nb_coefs[ch]); | |||
| } | |||
| } | |||
| #if 0 | |||
| printf("csnr=%d fsnr=%d frame_bits=%d diff=%d\n", | |||
| csnroffst, fsnroffst, frame_bits, | |||
| printf("csnr=%d fsnr=%d frame_bits=%d diff=%d\n", | |||
| csnroffst, fsnroffst, frame_bits, | |||
| 16 * s->frame_size - ((frame_bits + 7) & ~7)); | |||
| #endif | |||
| return 16 * s->frame_size - frame_bits; | |||
| @@ -682,9 +682,9 @@ static int compute_bit_allocation(AC3EncodeContext *s, | |||
| s->sgaincod = 1; | |||
| s->dbkneecod = 2; | |||
| s->floorcod = 4; | |||
| for(ch=0;ch<s->nb_all_channels;ch++) | |||
| for(ch=0;ch<s->nb_all_channels;ch++) | |||
| s->fgaincod[ch] = 4; | |||
| /* compute real values */ | |||
| s->bit_alloc.fscod = s->fscod; | |||
| s->bit_alloc.halfratecod = s->halfratecod; | |||
| @@ -693,7 +693,7 @@ static int compute_bit_allocation(AC3EncodeContext *s, | |||
| s->bit_alloc.sgain = sgaintab[s->sgaincod]; | |||
| s->bit_alloc.dbknee = dbkneetab[s->dbkneecod]; | |||
| s->bit_alloc.floor = floortab[s->floorcod]; | |||
| /* header size */ | |||
| frame_bits += 65; | |||
| // if (s->acmod == 2) | |||
| @@ -735,39 +735,39 @@ static int compute_bit_allocation(AC3EncodeContext *s, | |||
| offset until we can pack everything in the requested frame size */ | |||
| csnroffst = s->csnroffst; | |||
| while (csnroffst >= 0 && | |||
| while (csnroffst >= 0 && | |||
| bit_alloc(s, bap, encoded_exp, exp_strategy, frame_bits, csnroffst, 0) < 0) | |||
| csnroffst -= SNR_INC1; | |||
| if (csnroffst < 0) { | |||
| av_log(NULL, AV_LOG_ERROR, "Yack, Error !!!\n"); | |||
| return -1; | |||
| } | |||
| while ((csnroffst + SNR_INC1) <= 63 && | |||
| bit_alloc(s, bap1, encoded_exp, exp_strategy, frame_bits, | |||
| while ((csnroffst + SNR_INC1) <= 63 && | |||
| bit_alloc(s, bap1, encoded_exp, exp_strategy, frame_bits, | |||
| csnroffst + SNR_INC1, 0) >= 0) { | |||
| csnroffst += SNR_INC1; | |||
| memcpy(bap, bap1, sizeof(bap1)); | |||
| } | |||
| while ((csnroffst + 1) <= 63 && | |||
| while ((csnroffst + 1) <= 63 && | |||
| bit_alloc(s, bap1, encoded_exp, exp_strategy, frame_bits, csnroffst + 1, 0) >= 0) { | |||
| csnroffst++; | |||
| memcpy(bap, bap1, sizeof(bap1)); | |||
| } | |||
| fsnroffst = 0; | |||
| while ((fsnroffst + SNR_INC1) <= 15 && | |||
| bit_alloc(s, bap1, encoded_exp, exp_strategy, frame_bits, | |||
| while ((fsnroffst + SNR_INC1) <= 15 && | |||
| bit_alloc(s, bap1, encoded_exp, exp_strategy, frame_bits, | |||
| csnroffst, fsnroffst + SNR_INC1) >= 0) { | |||
| fsnroffst += SNR_INC1; | |||
| memcpy(bap, bap1, sizeof(bap1)); | |||
| } | |||
| while ((fsnroffst + 1) <= 15 && | |||
| bit_alloc(s, bap1, encoded_exp, exp_strategy, frame_bits, | |||
| while ((fsnroffst + 1) <= 15 && | |||
| bit_alloc(s, bap1, encoded_exp, exp_strategy, frame_bits, | |||
| csnroffst, fsnroffst + 1) >= 0) { | |||
| fsnroffst++; | |||
| memcpy(bap, bap1, sizeof(bap1)); | |||
| } | |||
| s->csnroffst = csnroffst; | |||
| for(ch=0;ch<s->nb_all_channels;ch++) | |||
| s->fsnroffst[ch] = fsnroffst; | |||
| @@ -824,7 +824,7 @@ static int AC3_encode_init(AVCodecContext *avctx) | |||
| }; | |||
| avctx->frame_size = AC3_FRAME_SIZE; | |||
| /* number of channels */ | |||
| if (channels < 1 || channels > 6) | |||
| return -1; | |||
| @@ -836,12 +836,12 @@ static int AC3_encode_init(AVCodecContext *avctx) | |||
| /* frequency */ | |||
| for(i=0;i<3;i++) { | |||
| for(j=0;j<3;j++) | |||
| for(j=0;j<3;j++) | |||
| if ((ac3_freqs[j] >> i) == freq) | |||
| goto found; | |||
| } | |||
| return -1; | |||
| found: | |||
| found: | |||
| s->sample_rate = freq; | |||
| s->halfratecod = i; | |||
| s->fscod = j; | |||
| @@ -861,7 +861,7 @@ static int AC3_encode_init(AVCodecContext *avctx) | |||
| s->frame_size_min = (bitrate * 1000 * AC3_FRAME_SIZE) / (freq * 16); | |||
| /* for now we do not handle fractional sizes */ | |||
| s->frame_size = s->frame_size_min; | |||
| /* bit allocation init */ | |||
| for(ch=0;ch<s->nb_channels;ch++) { | |||
| /* bandwidth for each channel */ | |||
| @@ -887,7 +887,7 @@ static int AC3_encode_init(AVCodecContext *avctx) | |||
| } | |||
| ac3_crc_init(); | |||
| avctx->coded_frame= avcodec_alloc_frame(); | |||
| avctx->coded_frame->key_frame= 1; | |||
| @@ -979,9 +979,9 @@ static void output_audio_block(AC3EncodeContext *s, | |||
| uint16_t *qmant1_ptr, *qmant2_ptr, *qmant4_ptr; | |||
| int delta0, delta1, delta2; | |||
| for(ch=0;ch<s->nb_channels;ch++) | |||
| for(ch=0;ch<s->nb_channels;ch++) | |||
| put_bits(&s->pb, 1, 0); /* 512 point MDCT */ | |||
| for(ch=0;ch<s->nb_channels;ch++) | |||
| for(ch=0;ch<s->nb_channels;ch++) | |||
| put_bits(&s->pb, 1, 1); /* no dither */ | |||
| put_bits(&s->pb, 1, 0); /* no dynamic range */ | |||
| if (block_num == 0) { | |||
| @@ -998,20 +998,20 @@ static void output_audio_block(AC3EncodeContext *s, | |||
| if(block_num==0) | |||
| { | |||
| /* first block must define rematrixing (rematstr) */ | |||
| put_bits(&s->pb, 1, 1); | |||
| put_bits(&s->pb, 1, 1); | |||
| /* dummy rematrixing rematflg(1:4)=0 */ | |||
| for (rbnd=0;rbnd<4;rbnd++) | |||
| put_bits(&s->pb, 1, 0); | |||
| put_bits(&s->pb, 1, 0); | |||
| } | |||
| else | |||
| else | |||
| { | |||
| /* no matrixing (but should be used in the future) */ | |||
| put_bits(&s->pb, 1, 0); | |||
| } | |||
| } | |||
| } | |||
| #if defined(DEBUG) | |||
| #if defined(DEBUG) | |||
| { | |||
| static int count = 0; | |||
| av_log(NULL, AV_LOG_DEBUG, "Block #%d (%d)\n", block_num, count++); | |||
| @@ -1021,7 +1021,7 @@ static void output_audio_block(AC3EncodeContext *s, | |||
| for(ch=0;ch<s->nb_channels;ch++) { | |||
| put_bits(&s->pb, 2, exp_strategy[ch]); | |||
| } | |||
| if (s->lfe) { | |||
| put_bits(&s->pb, 1, exp_strategy[s->lfe_channel]); | |||
| } | |||
| @@ -1030,7 +1030,7 @@ static void output_audio_block(AC3EncodeContext *s, | |||
| if (exp_strategy[ch] != EXP_REUSE) | |||
| put_bits(&s->pb, 6, s->chbwcod[ch]); | |||
| } | |||
| /* exponents */ | |||
| for (ch = 0; ch < s->nb_all_channels; ch++) { | |||
| switch(exp_strategy[ch]) { | |||
| @@ -1099,7 +1099,7 @@ static void output_audio_block(AC3EncodeContext *s, | |||
| put_bits(&s->pb, 3, s->fgaincod[ch]); | |||
| } | |||
| } | |||
| put_bits(&s->pb, 1, 0); /* no delta bit allocation */ | |||
| put_bits(&s->pb, 1, 0); /* no data to skip */ | |||
| @@ -1200,7 +1200,7 @@ static void output_audio_block(AC3EncodeContext *s, | |||
| /* second pass : output the values */ | |||
| for (ch = 0; ch < s->nb_all_channels; ch++) { | |||
| int b, q; | |||
| for(i=0;i<s->nb_coefs[ch];i++) { | |||
| q = qmant[ch][i]; | |||
| b = bap[ch][i]; | |||
| @@ -1208,11 +1208,11 @@ static void output_audio_block(AC3EncodeContext *s, | |||
| case 0: | |||
| break; | |||
| case 1: | |||
| if (q != 128) | |||
| if (q != 128) | |||
| put_bits(&s->pb, 5, q); | |||
| break; | |||
| case 2: | |||
| if (q != 128) | |||
| if (q != 128) | |||
| put_bits(&s->pb, 7, q); | |||
| break; | |||
| case 3: | |||
| @@ -1247,7 +1247,7 @@ static void ac3_crc_init(void) | |||
| for(n=0;n<256;n++) { | |||
| c = n << 8; | |||
| for (k = 0; k < 8; k++) { | |||
| if (c & (1 << 15)) | |||
| if (c & (1 << 15)) | |||
| c = ((c << 1) & 0xffff) ^ (CRC16_POLY & 0xffff); | |||
| else | |||
| c = c << 1; | |||
| @@ -1338,7 +1338,7 @@ static int output_frame_end(AC3EncodeContext *s) | |||
| assert(n >= 0); | |||
| if(n>0) | |||
| memset(pbBufPtr(&s->pb), 0, n); | |||
| /* Now we must compute both crcs : this is not so easy for crc1 | |||
| because it is at the beginning of the data... */ | |||
| frame_size_58 = (frame_size >> 1) + (frame_size >> 3); | |||
| @@ -1348,7 +1348,7 @@ static int output_frame_end(AC3EncodeContext *s) | |||
| crc1 = mul_poly(crc_inv, crc1, CRC16_POLY); | |||
| frame[2] = crc1 >> 8; | |||
| frame[3] = crc1; | |||
| crc2 = ac3_crc(frame + 2 * frame_size_58, (frame_size - frame_size_58) * 2 - 2, 0); | |||
| frame[2*frame_size - 2] = crc2 >> 8; | |||
| frame[2*frame_size - 1] = crc2; | |||
| @@ -1386,18 +1386,18 @@ static int AC3_encode_frame(AVCodecContext *avctx, | |||
| for(j=0;j<N/2;j++) { | |||
| v = *sptr; | |||
| input_samples[j + N/2] = v; | |||
| s->last_samples[ch][j] = v; | |||
| s->last_samples[ch][j] = v; | |||
| sptr += sinc; | |||
| } | |||
| /* apply the MDCT window */ | |||
| for(j=0;j<N/2;j++) { | |||
| input_samples[j] = MUL16(input_samples[j], | |||
| input_samples[j] = MUL16(input_samples[j], | |||
| ac3_window[j]) >> 15; | |||
| input_samples[N-j-1] = MUL16(input_samples[N-j-1], | |||
| input_samples[N-j-1] = MUL16(input_samples[N-j-1], | |||
| ac3_window[j]) >> 15; | |||
| } | |||
| /* Normalize the samples to use the maximum available | |||
| precision */ | |||
| v = 14 - log2_tab(input_samples, N); | |||
| @@ -1408,7 +1408,7 @@ static int AC3_encode_frame(AVCodecContext *avctx, | |||
| /* do the MDCT */ | |||
| mdct512(mdct_coef[i][ch], input_samples); | |||
| /* compute "exponents". We take into account the | |||
| normalization there */ | |||
| for(j=0;j<N/2;j++) { | |||
| @@ -1426,7 +1426,7 @@ static int AC3_encode_frame(AVCodecContext *avctx, | |||
| exp[i][ch][j] = e; | |||
| } | |||
| } | |||
| compute_exp_strategy(exp_strategy, exp, ch, ch == s->lfe_channel); | |||
| /* compute the exponents as the decoder will see them. The | |||
| @@ -1440,11 +1440,11 @@ static int AC3_encode_frame(AVCodecContext *avctx, | |||
| j++; | |||
| } | |||
| frame_bits += encode_exp(encoded_exp[i][ch], | |||
| exp[i][ch], s->nb_coefs[ch], | |||
| exp[i][ch], s->nb_coefs[ch], | |||
| exp_strategy[i][ch]); | |||
| /* copy encoded exponents for reuse case */ | |||
| for(k=i+1;k<j;k++) { | |||
| memcpy(encoded_exp[k][ch], encoded_exp[i][ch], | |||
| memcpy(encoded_exp[k][ch], encoded_exp[i][ch], | |||
| s->nb_coefs[ch] * sizeof(uint8_t)); | |||
| } | |||
| i = j; | |||
| @@ -1454,9 +1454,9 @@ static int AC3_encode_frame(AVCodecContext *avctx, | |||
| compute_bit_allocation(s, bap, encoded_exp, exp_strategy, frame_bits); | |||
| /* everything is known... let's output the frame */ | |||
| output_frame_header(s, frame); | |||
| for(i=0;i<NB_BLOCKS;i++) { | |||
| output_audio_block(s, exp_strategy[i], encoded_exp[i], | |||
| output_audio_block(s, exp_strategy[i], encoded_exp[i], | |||
| bap[i], mdct_coef[i], exp_samples[i], i); | |||
| } | |||
| return output_frame_end(s); | |||
| @@ -1498,8 +1498,8 @@ void fft_test(void) | |||
| sum_re += in1[n].re * cos(a) - in1[n].im * sin(a); | |||
| sum_im += in1[n].re * sin(a) + in1[n].im * cos(a); | |||
| } | |||
| printf("%3d: %6d,%6d %6.0f,%6.0f\n", | |||
| k, in[k].re, in[k].im, sum_re / FN, sum_im / FN); | |||
| printf("%3d: %6d,%6d %6.0f,%6.0f\n", | |||
| k, in[k].re, in[k].im, sum_re / FN, sum_im / FN); | |||
| } | |||
| } | |||
| @@ -1518,7 +1518,7 @@ void mdct_test(void) | |||
| } | |||
| mdct512(output, input); | |||
| /* do it by hand */ | |||
| for(k=0;k<N/2;k++) { | |||
| s = 0; | |||
| @@ -1528,7 +1528,7 @@ void mdct_test(void) | |||
| } | |||
| output1[k] = -2 * s / N; | |||
| } | |||
| err = 0; | |||
| emax = 0; | |||
| for(i=0;i<N/2;i++) { | |||
| @@ -1547,7 +1547,7 @@ void test_ac3(void) | |||
| unsigned char frame[AC3_MAX_CODED_FRAME_SIZE]; | |||
| short samples[AC3_FRAME_SIZE]; | |||
| int ret, i; | |||
| AC3_encode_init(&ctx, 44100, 64000, 1); | |||
| fft_test(); | |||
| @@ -8,8 +8,8 @@ static const uint16_t ac3_freqs[3] = { 48000, 44100, 32000 }; | |||
| /* possible bitrates */ | |||
| static const uint16_t ac3_bitratetab[19] = { | |||
| 32, 40, 48, 56, 64, 80, 96, 112, 128, | |||
| 160, 192, 224, 256, 320, 384, 448, 512, 576, 640 | |||
| 32, 40, 48, 56, 64, 80, 96, 112, 128, | |||
| 160, 192, 224, 256, 320, 384, 448, 512, 576, 640 | |||
| }; | |||
| /* AC3 MDCT window */ | |||
| @@ -47,7 +47,7 @@ static const int16_t ac3_window[256] = { | |||
| 32760,32761,32762,32763,32764,32764,32765,32765, | |||
| 32766,32766,32766,32766,32767,32767,32767,32767, | |||
| 32767,32767,32767,32767,32767,32767,32767,32767, | |||
| 32767,32767,32767,32767,32767,32767,32767,32767, | |||
| 32767,32767,32767,32767,32767,32767,32767,32767, | |||
| }; | |||
| static uint8_t masktab[253]; | |||
| @@ -135,32 +135,32 @@ static const uint16_t hth[50][3]= { | |||
| }; | |||
| static const uint8_t baptab[64]= { | |||
| 0, 1, 1, 1, 1, 1, 2, 2, 3, 3, | |||
| 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, | |||
| 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, | |||
| 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, | |||
| 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, | |||
| 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, | |||
| 0, 1, 1, 1, 1, 1, 2, 2, 3, 3, | |||
| 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, | |||
| 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, | |||
| 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, | |||
| 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, | |||
| 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, | |||
| 15, 15, 15, 15, | |||
| }; | |||
| static const uint8_t sdecaytab[4]={ | |||
| static const uint8_t sdecaytab[4]={ | |||
| 0x0f, 0x11, 0x13, 0x15, | |||
| }; | |||
| static const uint8_t fdecaytab[4]={ | |||
| 0x3f, 0x53, 0x67, 0x7b, | |||
| static const uint8_t fdecaytab[4]={ | |||
| 0x3f, 0x53, 0x67, 0x7b, | |||
| }; | |||
| static const uint16_t sgaintab[4]= { | |||
| static const uint16_t sgaintab[4]= { | |||
| 0x540, 0x4d8, 0x478, 0x410, | |||
| }; | |||
| static const uint16_t dbkneetab[4]= { | |||
| static const uint16_t dbkneetab[4]= { | |||
| 0x000, 0x700, 0x900, 0xb00, | |||
| }; | |||
| static const uint16_t floortab[8]= { | |||
| static const uint16_t floortab[8]= { | |||
| 0x2f0, 0x2b0, 0x270, 0x230, 0x1f0, 0x170, 0x0f0, 0xf800, | |||
| }; | |||
| @@ -169,12 +169,12 @@ static const uint16_t fgaintab[8]= { | |||
| }; | |||
| static const uint8_t bndsz[50]={ | |||
| 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, 3, 3, 3, 3, 3, 3, | |||
| 3, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 24, 24, 24, 24, 24 | |||
| 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, 3, 3, 3, 3, 3, 3, | |||
| 3, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 24, 24, 24, 24, 24 | |||
| }; | |||
| static uint8_t bndtab[51]; | |||
| static uint8_t bndtab[51]; | |||
| /* fft & mdct sin cos tables */ | |||
| static int16_t costab[64]; | |||
| @@ -59,7 +59,7 @@ static const int index_table[16] = { | |||
| -1, -1, -1, -1, 2, 4, 6, 8, | |||
| }; | |||
| /** | |||
| /** | |||
| * This is the step table. Note that many programs use slight deviations from | |||
| * this table, but such deviations are negligible: | |||
| */ | |||
| @@ -205,7 +205,7 @@ static inline unsigned char adpcm_ima_compress_sample(ADPCMChannelStatus *c, sho | |||
| { | |||
| int step_index; | |||
| unsigned char nibble; | |||
| int sign = 0; /* sign bit of the nibble (MSB) */ | |||
| int delta, predicted_delta; | |||
| @@ -241,7 +241,7 @@ static inline unsigned char adpcm_ima_compress_sample(ADPCMChannelStatus *c, sho | |||
| CLAMP_TO_SHORT(c->prev_sample); | |||
| nibble += sign << 3; /* sign * 8 */ | |||
| nibble += sign << 3; /* sign * 8 */ | |||
| /* save back */ | |||
| c->step_index = step_index; | |||
| @@ -254,14 +254,14 @@ static inline unsigned char adpcm_ms_compress_sample(ADPCMChannelStatus *c, shor | |||
| int predictor, nibble, bias; | |||
| predictor = (((c->sample1) * (c->coeff1)) + ((c->sample2) * (c->coeff2))) / 256; | |||
| nibble= sample - predictor; | |||
| if(nibble>=0) bias= c->idelta/2; | |||
| else bias=-c->idelta/2; | |||
| nibble= (nibble + bias) / c->idelta; | |||
| nibble= clip(nibble, -8, 7)&0x0F; | |||
| predictor += (signed)((nibble & 0x08)?(nibble - 0x10):(nibble)) * c->idelta; | |||
| CLAMP_TO_SHORT(predictor); | |||
| @@ -333,7 +333,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, | |||
| *dst++ = 0; | |||
| samples++; | |||
| } | |||
| /* stereo: 4 bytes (8 samples) for left, 4 bytes for right, 4 bytes left, ... */ | |||
| for (; n>0; n--) { | |||
| *dst = adpcm_ima_compress_sample(&c->status[0], samples[0]) & 0x0F; | |||
| @@ -375,9 +375,9 @@ static int adpcm_encode_frame(AVCodecContext *avctx, | |||
| c->status[i].coeff2 = AdaptCoeff2[predictor]; | |||
| } | |||
| for(i=0; i<avctx->channels; i++){ | |||
| if (c->status[i].idelta < 16) | |||
| if (c->status[i].idelta < 16) | |||
| c->status[i].idelta = 16; | |||
| *dst++ = c->status[i].idelta & 0xFF; | |||
| *dst++ = c->status[i].idelta >> 8; | |||
| } | |||
| @@ -528,7 +528,7 @@ static inline short adpcm_yamaha_expand_nibble(ADPCMChannelStatus *c, unsigned c | |||
| return c->predictor; | |||
| } | |||
| static void xa_decode(short *out, const unsigned char *in, | |||
| static void xa_decode(short *out, const unsigned char *in, | |||
| ADPCMChannelStatus *left, ADPCMChannelStatus *right, int inc) | |||
| { | |||
| int i, j; | |||
| @@ -770,7 +770,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, | |||
| c->status[0].coeff2 = AdaptCoeff2[block_predictor[0]]; | |||
| c->status[1].coeff1 = AdaptCoeff1[block_predictor[1]]; | |||
| c->status[1].coeff2 = AdaptCoeff2[block_predictor[1]]; | |||
| c->status[0].sample1 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); | |||
| src+=2; | |||
| if (st) c->status[1].sample1 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); | |||
| @@ -807,16 +807,16 @@ static int adpcm_decode_frame(AVCodecContext *avctx, | |||
| while (src < buf + buf_size) { | |||
| /* take care of the top nibble (always left or mono channel) */ | |||
| *samples++ = adpcm_ima_expand_nibble(&c->status[0], | |||
| *samples++ = adpcm_ima_expand_nibble(&c->status[0], | |||
| (src[0] >> 4) & 0x0F, 3); | |||
| /* take care of the bottom nibble, which is right sample for | |||
| * stereo, or another mono sample */ | |||
| if (st) | |||
| *samples++ = adpcm_ima_expand_nibble(&c->status[1], | |||
| *samples++ = adpcm_ima_expand_nibble(&c->status[1], | |||
| src[0] & 0x0F, 3); | |||
| else | |||
| *samples++ = adpcm_ima_expand_nibble(&c->status[0], | |||
| *samples++ = adpcm_ima_expand_nibble(&c->status[0], | |||
| src[0] & 0x0F, 3); | |||
| src++; | |||
| @@ -869,14 +869,14 @@ static int adpcm_decode_frame(AVCodecContext *avctx, | |||
| while (src < buf + buf_size) { | |||
| if (st) { | |||
| *samples++ = adpcm_ima_expand_nibble(&c->status[0], | |||
| *samples++ = adpcm_ima_expand_nibble(&c->status[0], | |||
| (src[0] >> 4) & 0x0F, 3); | |||
| *samples++ = adpcm_ima_expand_nibble(&c->status[1], | |||
| *samples++ = adpcm_ima_expand_nibble(&c->status[1], | |||
| src[0] & 0x0F, 3); | |||
| } else { | |||
| *samples++ = adpcm_ima_expand_nibble(&c->status[0], | |||
| *samples++ = adpcm_ima_expand_nibble(&c->status[0], | |||
| (src[0] >> 4) & 0x0F, 3); | |||
| *samples++ = adpcm_ima_expand_nibble(&c->status[0], | |||
| *samples++ = adpcm_ima_expand_nibble(&c->status[0], | |||
| src[0] & 0x0F, 3); | |||
| } | |||
| @@ -884,10 +884,10 @@ static int adpcm_decode_frame(AVCodecContext *avctx, | |||
| } | |||
| break; | |||
| case CODEC_ID_ADPCM_XA: | |||
| c->status[0].sample1 = c->status[0].sample2 = | |||
| c->status[0].sample1 = c->status[0].sample2 = | |||
| c->status[1].sample1 = c->status[1].sample2 = 0; | |||
| while (buf_size >= 128) { | |||
| xa_decode(samples, src, &c->status[0], &c->status[1], | |||
| xa_decode(samples, src, &c->status[0], &c->status[1], | |||
| avctx->channels); | |||
| src += 128; | |||
| samples += 28 * 8; | |||
| @@ -926,11 +926,11 @@ static int adpcm_decode_frame(AVCodecContext *avctx, | |||
| next_right_sample = (((*src & 0x0F) << 28) >> shift_right); | |||
| src++; | |||
| next_left_sample = (next_left_sample + | |||
| (current_left_sample * coeff1l) + | |||
| next_left_sample = (next_left_sample + | |||
| (current_left_sample * coeff1l) + | |||
| (previous_left_sample * coeff2l) + 0x80) >> 8; | |||
| next_right_sample = (next_right_sample + | |||
| (current_right_sample * coeff1r) + | |||
| next_right_sample = (next_right_sample + | |||
| (current_right_sample * coeff1r) + | |||
| (previous_right_sample * coeff2r) + 0x80) >> 8; | |||
| CLAMP_TO_SHORT(next_left_sample); | |||
| CLAMP_TO_SHORT(next_right_sample); | |||
| @@ -960,14 +960,14 @@ static int adpcm_decode_frame(AVCodecContext *avctx, | |||
| case CODEC_ID_ADPCM_CT: | |||
| while (src < buf + buf_size) { | |||
| if (st) { | |||
| *samples++ = adpcm_ct_expand_nibble(&c->status[0], | |||
| *samples++ = adpcm_ct_expand_nibble(&c->status[0], | |||
| (src[0] >> 4) & 0x0F); | |||
| *samples++ = adpcm_ct_expand_nibble(&c->status[1], | |||
| *samples++ = adpcm_ct_expand_nibble(&c->status[1], | |||
| src[0] & 0x0F); | |||
| } else { | |||
| *samples++ = adpcm_ct_expand_nibble(&c->status[0], | |||
| *samples++ = adpcm_ct_expand_nibble(&c->status[0], | |||
| (src[0] >> 4) & 0x0F); | |||
| *samples++ = adpcm_ct_expand_nibble(&c->status[0], | |||
| *samples++ = adpcm_ct_expand_nibble(&c->status[0], | |||
| src[0] & 0x0F); | |||
| } | |||
| src++; | |||
| @@ -979,7 +979,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, | |||
| const int *table; | |||
| int k0, signmask; | |||
| int size = buf_size*8; | |||
| init_get_bits(&gb, buf, size); | |||
| // first frame, read bits & inital values | |||
| @@ -988,11 +988,11 @@ static int adpcm_decode_frame(AVCodecContext *avctx, | |||
| c->nb_bits = get_bits(&gb, 2)+2; | |||
| // av_log(NULL,AV_LOG_INFO,"nb_bits: %d\n", c->nb_bits); | |||
| } | |||
| table = swf_index_tables[c->nb_bits-2]; | |||
| k0 = 1 << (c->nb_bits-2); | |||
| signmask = 1 << (c->nb_bits-1); | |||
| while (get_bits_count(&gb) <= size) | |||
| { | |||
| int i; | |||
| @@ -1015,7 +1015,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, | |||
| int step = step_table[c->status[i].step_index]; | |||
| long vpdiff = 0; // vpdiff = (delta+0.5)*step/4 | |||
| int k = k0; | |||
| do { | |||
| if (delta & k) | |||
| vpdiff += step; | |||
| @@ -1023,24 +1023,24 @@ static int adpcm_decode_frame(AVCodecContext *avctx, | |||
| k >>= 1; | |||
| } while(k); | |||
| vpdiff += step; | |||
| if (delta & signmask) | |||
| c->status[i].predictor -= vpdiff; | |||
| else | |||
| c->status[i].predictor += vpdiff; | |||
| c->status[i].step_index += table[delta & (~signmask)]; | |||
| c->status[i].step_index = clip(c->status[i].step_index, 0, 88); | |||
| c->status[i].predictor = clip(c->status[i].predictor, -32768, 32767); | |||
| *samples++ = c->status[i].predictor; | |||
| } | |||
| } | |||
| // src += get_bits_count(&gb)*8; | |||
| src += size; | |||
| break; | |||
| } | |||
| case CODEC_ID_ADPCM_YAMAHA: | |||
| @@ -171,7 +171,7 @@ static int adx_encode_header(AVCodecContext *avctx,unsigned char *buf,size_t buf | |||
| long loop_start_byte; | |||
| long loop_end_sample; | |||
| long loop_end_byte; | |||
| long | |||
| long | |||
| */ | |||
| } adxhdr; /* big endian */ | |||
| /* offset-6 "(c)CRI" */ | |||
| @@ -169,9 +169,9 @@ void bastardized_rice_decompress(ALACContext *alac, | |||
| /* read k, that is bits as is */ | |||
| k = 31 - rice_kmodifier - count_leading_zeros((history >> 9) + 3); | |||
| if (k < 0) | |||
| if (k < 0) | |||
| k += rice_kmodifier; | |||
| else | |||
| else | |||
| k = rice_kmodifier; | |||
| if (k != 1) { | |||
| @@ -444,7 +444,7 @@ static int alac_decode_frame(AVCodecContext *avctx, | |||
| /* initialize from the extradata */ | |||
| if (!alac->context_initialized) { | |||
| if (alac->avctx->extradata_size != ALAC_EXTRADATA_SIZE) { | |||
| av_log(NULL, AV_LOG_ERROR, "alac: expected %d extradata bytes\n", | |||
| av_log(NULL, AV_LOG_ERROR, "alac: expected %d extradata bytes\n", | |||
| ALAC_EXTRADATA_SIZE); | |||
| return input_buffer_size; | |||
| } | |||
| @@ -728,7 +728,7 @@ static int alac_decode_frame(AVCodecContext *avctx, | |||
| } else { | |||
| av_log(NULL, AV_LOG_ERROR, "FIXME: unhandled prediction type: %i\n", prediction_type_b); | |||
| } | |||
| } else { | |||
| } else { | |||
| /* not compressed, easy case */ | |||
| if (alac->setinfo_sample_size <= 16) { | |||
| int i; | |||
| @@ -28,12 +28,12 @@ | |||
| formats you want to support */ | |||
| /** | |||
| * simple call to register all the codecs. | |||
| * simple call to register all the codecs. | |||
| */ | |||
| void avcodec_register_all(void) | |||
| { | |||
| static int inited = 0; | |||
| if (inited != 0) | |||
| return; | |||
| inited = 1; | |||
| @@ -589,7 +589,7 @@ PCM_CODEC(CODEC_ID_ADPCM_YAMAHA, adpcm_yamaha); | |||
| register_avcodec(&dvbsub_encoder); | |||
| #endif | |||
| /* parsers */ | |||
| /* parsers */ | |||
| av_register_codec_parser(&mpegvideo_parser); | |||
| av_register_codec_parser(&mpeg4video_parser); | |||
| #if defined(CONFIG_H261_DECODER) || defined(CONFIG_H261_ENCODER) | |||
| @@ -126,7 +126,7 @@ struct unaligned_long { uint64_t l; } __attribute__((packed)); | |||
| #define minsw4 __builtin_alpha_minsw4 | |||
| #define maxub8 __builtin_alpha_maxub8 | |||
| #define maxsb8 __builtin_alpha_maxsb8 | |||
| #define maxuw4 __builtin_alpha_maxuw4 | |||
| #define maxuw4 __builtin_alpha_maxuw4 | |||
| #define maxsw4 __builtin_alpha_maxsw4 | |||
| #define perr __builtin_alpha_perr | |||
| #define pklb __builtin_alpha_pklb | |||
| @@ -28,11 +28,11 @@ void put_pixels_axp_asm(uint8_t *block, const uint8_t *pixels, | |||
| int line_size, int h); | |||
| void put_pixels_clamped_mvi_asm(const DCTELEM *block, uint8_t *pixels, | |||
| int line_size); | |||
| void add_pixels_clamped_mvi_asm(const DCTELEM *block, uint8_t *pixels, | |||
| void add_pixels_clamped_mvi_asm(const DCTELEM *block, uint8_t *pixels, | |||
| int line_size); | |||
| void (*put_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels, | |||
| int line_size); | |||
| void (*add_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels, | |||
| void (*add_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels, | |||
| int line_size); | |||
| void get_pixels_mvi(DCTELEM *restrict block, | |||
| @@ -48,7 +48,7 @@ int pix_abs16x16_xy2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, i | |||
| #if 0 | |||
| /* These functions were the base for the optimized assembler routines, | |||
| and remain here for documentation purposes. */ | |||
| static void put_pixels_clamped_mvi(const DCTELEM *block, uint8_t *pixels, | |||
| static void put_pixels_clamped_mvi(const DCTELEM *block, uint8_t *pixels, | |||
| int line_size) | |||
| { | |||
| int i = 8; | |||
| @@ -72,7 +72,7 @@ static void put_pixels_clamped_mvi(const DCTELEM *block, uint8_t *pixels, | |||
| } while (--i); | |||
| } | |||
| void add_pixels_clamped_mvi(const DCTELEM *block, uint8_t *pixels, | |||
| void add_pixels_clamped_mvi(const DCTELEM *block, uint8_t *pixels, | |||
| int line_size) | |||
| { | |||
| int h = 8; | |||
| @@ -97,7 +97,7 @@ void add_pixels_clamped_mvi(const DCTELEM *block, uint8_t *pixels, | |||
| shorts0 ^= signs0; | |||
| /* Clamp. */ | |||
| shorts0 = maxsw4(shorts0, 0); | |||
| shorts0 = minsw4(shorts0, clampmask); | |||
| shorts0 = minsw4(shorts0, clampmask); | |||
| /* Next 4. */ | |||
| pix1 = unpkbw(ldl(pixels + 4)); | |||
| @@ -142,7 +142,7 @@ static inline uint64_t avg2_no_rnd(uint64_t a, uint64_t b) | |||
| static inline uint64_t avg2(uint64_t a, uint64_t b) | |||
| { | |||
| return (a | b) - (((a ^ b) & BYTE_VEC(0xfe)) >> 1); | |||
| return (a | b) - (((a ^ b) & BYTE_VEC(0xfe)) >> 1); | |||
| } | |||
| #if 0 | |||
| @@ -353,7 +353,7 @@ void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx) | |||
| put_pixels_clamped_axp_p = c->put_pixels_clamped; | |||
| add_pixels_clamped_axp_p = c->add_pixels_clamped; | |||
| c->idct_put = simple_idct_put_axp; | |||
| c->idct_add = simple_idct_add_axp; | |||
| c->idct = simple_idct_axp; | |||
| @@ -34,7 +34,7 @@ | |||
| #define tf a4 | |||
| #define tg a3 | |||
| #define th v0 | |||
| .set noat | |||
| .set noreorder | |||
| .arch pca56 | |||
| @@ -132,13 +132,13 @@ $aligned: | |||
| stq t2, 0(t5) | |||
| stq t3, 0(t6) | |||
| bne a3, $aligned | |||
| ret | |||
| .end put_pixels_axp_asm | |||
| /************************************************************************ | |||
| * void put_pixels_clamped_mvi_asm(const DCTELEM *block, uint8_t *pixels, | |||
| * void put_pixels_clamped_mvi_asm(const DCTELEM *block, uint8_t *pixels, | |||
| * int line_size) | |||
| */ | |||
| .align 6 | |||
| @@ -172,17 +172,17 @@ put_pixels_clamped_mvi_asm: | |||
| addq a1, a2, ta | |||
| maxsw4 t3, zero, t3 | |||
| minsw4 t0, t8, t0 | |||
| minsw4 t1, t8, t1 | |||
| minsw4 t2, t8, t2 | |||
| minsw4 t3, t8, t3 | |||
| pkwb t0, t0 | |||
| pkwb t1, t1 | |||
| pkwb t2, t2 | |||
| pkwb t3, t3 | |||
| stl t0, 0(a1) | |||
| stl t1, 4(a1) | |||
| addq ta, a2, a1 | |||
| stl t2, 0(ta) | |||
| @@ -193,7 +193,7 @@ put_pixels_clamped_mvi_asm: | |||
| .end put_pixels_clamped_mvi_asm | |||
| /************************************************************************ | |||
| * void add_pixels_clamped_mvi_asm(const DCTELEM *block, uint8_t *pixels, | |||
| * void add_pixels_clamped_mvi_asm(const DCTELEM *block, uint8_t *pixels, | |||
| * int line_size) | |||
| */ | |||
| .align 6 | |||
| @@ -236,18 +236,18 @@ add_pixels_clamped_mvi_asm: | |||
| bic t0, tg, t0 # 0 2 | |||
| unpkbw t7, t7 # 2 0 | |||
| and t3, tg, t5 # 1 1 | |||
| addq t0, t1, t0 # 0 3 | |||
| addq t0, t1, t0 # 0 3 | |||
| xor t0, t2, t0 # 0 4 | |||
| unpkbw ta, ta # 3 0 | |||
| and t6, tg, t8 # 2 1 | |||
| maxsw4 t0, zero, t0 # 0 5 | |||
| bic t3, tg, t3 # 1 2 | |||
| bic t6, tg, t6 # 2 2 | |||
| minsw4 t0, tf, t0 # 0 6 | |||
| addq t3, t4, t3 # 1 3 | |||
| pkwb t0, t0 # 0 7 | |||
| xor t3, t5, t3 # 1 4 | |||
| maxsw4 t3, zero, t3 # 1 5 | |||
| @@ -260,14 +260,14 @@ add_pixels_clamped_mvi_asm: | |||
| maxsw4 t6, zero, t6 # 2 5 | |||
| addq t9, ta, t9 # 3 3 | |||
| stl t0, 0(a1) # 0 8 | |||
| stl t0, 0(a1) # 0 8 | |||
| minsw4 t6, tf, t6 # 2 6 | |||
| xor t9, tb, t9 # 3 4 | |||
| maxsw4 t9, zero, t9 # 3 5 | |||
| lda a0, 32(a0) # block += 16; | |||
| pkwb t3, t3 # 1 7 | |||
| minsw4 t9, tf, t9 # 3 6 | |||
| subq th, 2, th | |||
| pkwb t6, t6 # 2 7 | |||
| @@ -279,5 +279,5 @@ add_pixels_clamped_mvi_asm: | |||
| stl t9, 4(te) # 3 8 | |||
| bne th, 1b | |||
| ret | |||
| ret | |||
| .end add_pixels_clamped_mvi_asm | |||
| @@ -30,7 +30,7 @@ void get_pixels_mvi(DCTELEM *restrict block, | |||
| p = ldq(pixels); | |||
| stq(unpkbw(p), block); | |||
| stq(unpkbw(p >> 32), block + 4); | |||
| stq(unpkbw(p >> 32), block + 4); | |||
| pixels += line_size; | |||
| block += 8; | |||
| @@ -187,7 +187,7 @@ int pix_abs16x16_x2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, in | |||
| /* |.......l|lllllllr|rrrrrrr*| | |||
| This case is special because disalign1 would be 8, which | |||
| gets treated as 0 by extqh. At least it is a bit faster | |||
| that way :) */ | |||
| that way :) */ | |||
| do { | |||
| uint64_t p1_l, p1_r, p2_l, p2_r; | |||
| uint64_t l, m, r; | |||
| @@ -201,7 +201,7 @@ int pix_abs16x16_x2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, in | |||
| p2_r = avg2(extql(m, disalign) | extqh(r, disalign), r); | |||
| pix1 += line_size; | |||
| pix2 += line_size; | |||
| result += perr(p1_l, p2_l) | |||
| + perr(p1_r, p2_r); | |||
| } while (--h); | |||
| @@ -288,7 +288,7 @@ int pix_abs16x16_y2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, in | |||
| int pix_abs16x16_xy2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) | |||
| { | |||
| int result = 0; | |||
| uint64_t p1_l, p1_r; | |||
| uint64_t p2_l, p2_r, p2_x; | |||
| @@ -29,7 +29,7 @@ | |||
| #define tf a4 | |||
| #define tg a3 | |||
| #define th v0 | |||
| .set noat | |||
| .set noreorder | |||
| .arch pca56 | |||
| @@ -91,7 +91,7 @@ $unaligned: | |||
| ldq t4, 8(a0) # ref right | |||
| addq a0, a2, a0 # pix1 | |||
| addq a1, a2, a1 # pix2 | |||
| /* load line 1 */ | |||
| /* load line 1 */ | |||
| ldq_u t5, 0(a1) # left_u | |||
| ldq_u t6, 8(a1) # mid | |||
| ldq_u t7, 16(a1) # right_u | |||
| @@ -32,18 +32,18 @@ static void dct_unquantize_h263_intra_axp(MpegEncContext *s, DCTELEM *block, | |||
| qadd = WORD_VEC((qscale - 1) | 1); | |||
| qmul = qscale << 1; | |||
| /* This mask kills spill from negative subwords to the next subword. */ | |||
| /* This mask kills spill from negative subwords to the next subword. */ | |||
| correction = WORD_VEC((qmul - 1) + 1); /* multiplication / addition */ | |||
| if (!s->h263_aic) { | |||
| if (n < 4) | |||
| if (n < 4) | |||
| block0 = block[0] * s->y_dc_scale; | |||
| else | |||
| block0 = block[0] * s->c_dc_scale; | |||
| } else { | |||
| qadd = 0; | |||
| } | |||
| n_coeffs = 63; // does not always use zigzag table | |||
| n_coeffs = 63; // does not always use zigzag table | |||
| for(i = 0; i <= n_coeffs; block += 4, i += 4) { | |||
| uint64_t levels, negmask, zeros, add; | |||
| @@ -95,7 +95,7 @@ static void dct_unquantize_h263_inter_axp(MpegEncContext *s, DCTELEM *block, | |||
| qadd = WORD_VEC((qscale - 1) | 1); | |||
| qmul = qscale << 1; | |||
| /* This mask kills spill from negative subwords to the next subword. */ | |||
| /* This mask kills spill from negative subwords to the next subword. */ | |||
| correction = WORD_VEC((qmul - 1) + 1); /* multiplication / addition */ | |||
| n_coeffs = s->intra_scantable.raster_end[s->block_last_index[n]]; | |||
| @@ -29,7 +29,7 @@ | |||
| extern void (*put_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels, | |||
| int line_size); | |||
| extern void (*add_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels, | |||
| extern void (*add_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels, | |||
| int line_size); | |||
| // cos(i * M_PI / 16) * sqrt(2) * (1 << 14) | |||
| @@ -55,7 +55,7 @@ static inline int idct_row(DCTELEM *row) | |||
| if (l == 0 && r == 0) | |||
| return 0; | |||
| a0 = W4 * sextw(l) + (1 << (ROW_SHIFT - 1)); | |||
| if (((l & ~0xffffUL) | r) == 0) { | |||
| @@ -63,7 +63,7 @@ static inline int idct_row(DCTELEM *row) | |||
| t2 = (uint16_t) a0; | |||
| t2 |= t2 << 16; | |||
| t2 |= t2 << 32; | |||
| stq(t2, row); | |||
| stq(t2, row + 4); | |||
| return 1; | |||
| @@ -123,7 +123,7 @@ static inline int idct_row(DCTELEM *row) | |||
| b3 -= W5 * t; | |||
| } | |||
| t = extwl(r, 2); /* row[5] */ | |||
| if (t) { | |||
| t = sextw(t); | |||
| @@ -24,13 +24,13 @@ | |||
| atleast on a P4 1.5GHz (0.9s instead of 9.9s on a 30s audio clip at MR102). | |||
| Both float and fixed point is supported for amr-nb, but only float for | |||
| amr-wb. | |||
| --AMR-NB-- | |||
| The fixed-point (TS26.073) can be downloaded from: | |||
| http://www.3gpp.org/ftp/Specs/archive/26_series/26.073/26073-510.zip | |||
| Extract the soure into ffmpeg/libavcodec/amr | |||
| To use the fixed version run "./configure" with "--enable-amr_nb-fixed" | |||
| The float version (default) can be downloaded from: | |||
| http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-510.zip | |||
| Extract the soure into ffmpeg/libavcodec/amr_float | |||
| @@ -38,19 +38,19 @@ | |||
| The specification for amr-nb can be found in TS 26.071 | |||
| (http://www.3gpp.org/ftp/Specs/html-info/26071.htm) and some other | |||
| info at http://www.3gpp.org/ftp/Specs/html-info/26-series.htm | |||
| --AMR-WB-- | |||
| The reference code can be downloaded from: | |||
| http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip | |||
| It should be extracted to "libavcodec/amrwb_float". Enable it with | |||
| "--enable-amr_wb". | |||
| The specification for amr-wb can be downloaded from: | |||
| http://www.3gpp.org/ftp/Specs/archive/26_series/26.171/26171-500.zip | |||
| If someone want to use the fixed point version it can be downloaded | |||
| from: http://www.3gpp.org/ftp/Specs/archive/26_series/26.173/26173-571.zip | |||
| */ | |||
| #include "avcodec.h" | |||
| @@ -77,7 +77,7 @@ typedef struct AMR_bitrates | |||
| int startrate; | |||
| int stoprate; | |||
| enum Mode mode; | |||
| } AMR_bitrates; | |||
| /* Match desired bitrate with closest one*/ | |||
| @@ -93,7 +93,7 @@ static enum Mode getBitrateMode(int bitrate) | |||
| {7950,9999,MR795},//9 | |||
| {10000,11999,MR102},//10 | |||
| {12000,64000,MR122},//12 | |||
| }; | |||
| int i; | |||
| for(i=0;i<8;i++) | |||
| @@ -124,7 +124,7 @@ typedef struct AMRContext { | |||
| Speech_Encode_FrameState *enstate; | |||
| sid_syncState *sidstate; | |||
| enum TXFrameType tx_frametype; | |||
| } AMRContext; | |||
| @@ -137,7 +137,7 @@ static int amr_nb_decode_init(AVCodecContext * avctx) | |||
| s->mode= (enum Mode)0; | |||
| s->reset_flag=0; | |||
| s->reset_flag_old=1; | |||
| if(Speech_Decode_Frame_init(&s->speech_decoder_state, "Decoder")) | |||
| { | |||
| av_log(avctx, AV_LOG_ERROR, "Speech_Decode_Frame_init error\n"); | |||
| @@ -155,7 +155,7 @@ static int amr_nb_encode_init(AVCodecContext * avctx) | |||
| s->mode= (enum Mode)0; | |||
| s->reset_flag=0; | |||
| s->reset_flag_old=1; | |||
| if(avctx->sample_rate!=8000) | |||
| { | |||
| if(avctx->debug) | |||
| @@ -217,7 +217,7 @@ static int amr_nb_decode_frame(AVCodecContext * avctx, | |||
| int offset=0; | |||
| UWord8 toc, q, ft; | |||
| Word16 serial[SERIAL_FRAMESIZE]; /* coded bits */ | |||
| Word16 *synth; | |||
| UWord8 *packed_bits; | |||
| @@ -250,14 +250,14 @@ static int amr_nb_decode_frame(AVCodecContext * avctx, | |||
| //We have a new frame | |||
| s->frameCount++; | |||
| if (s->rx_type == RX_NO_DATA) | |||
| if (s->rx_type == RX_NO_DATA) | |||
| { | |||
| s->mode = s->speech_decoder_state->prev_mode; | |||
| } | |||
| else { | |||
| s->speech_decoder_state->prev_mode = s->mode; | |||
| } | |||
| /* if homed: check if this frame is another homing frame */ | |||
| if (s->reset_flag_old == 1) | |||
| { | |||
| @@ -273,7 +273,7 @@ static int amr_nb_decode_frame(AVCodecContext * avctx, | |||
| } | |||
| } | |||
| else | |||
| { | |||
| { | |||
| /* decode frame */ | |||
| Speech_Decode_Frame(s->speech_decoder_state, s->mode, &serial[1], s->rx_type, synth); | |||
| } | |||
| @@ -281,7 +281,7 @@ static int amr_nb_decode_frame(AVCodecContext * avctx, | |||
| //Each AMR-frame results in 160 16-bit samples | |||
| *data_size+=160*2; | |||
| synth+=160; | |||
| /* if not homed: check whether current frame is a homing frame */ | |||
| if (s->reset_flag_old == 0) | |||
| { | |||
| @@ -294,7 +294,7 @@ static int amr_nb_decode_frame(AVCodecContext * avctx, | |||
| Speech_Decode_Frame_reset(s->speech_decoder_state); | |||
| } | |||
| s->reset_flag_old = s->reset_flag; | |||
| } | |||
| return offset; | |||
| } | |||
| @@ -307,16 +307,16 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, | |||
| AMRContext *s = avctx->priv_data; | |||
| int written; | |||
| s->reset_flag = encoder_homing_frame_test(data); | |||
| Speech_Encode_Frame(s->enstate, s->enc_bitrate, data, &serial_data[1], &s->mode); | |||
| Speech_Encode_Frame(s->enstate, s->enc_bitrate, data, &serial_data[1], &s->mode); | |||
| /* add frame type and mode */ | |||
| sid_sync (s->sidstate, s->mode, &s->tx_frametype); | |||
| written = PackBits(s->mode, s->enc_bitrate, s->tx_frametype, &serial_data[1], frame); | |||
| if (s->reset_flag != 0) | |||
| { | |||
| Speech_Encode_Frame_reset(s->enstate); | |||
| @@ -352,7 +352,7 @@ static int amr_nb_encode_init(AVCodecContext * avctx) | |||
| { | |||
| AMRContext *s = avctx->priv_data; | |||
| s->frameCount=0; | |||
| if(avctx->sample_rate!=8000) | |||
| { | |||
| if(avctx->debug) | |||
| @@ -416,7 +416,7 @@ static int amr_nb_decode_frame(AVCodecContext * avctx, | |||
| int packet_size; | |||
| /* av_log(NULL,AV_LOG_DEBUG,"amr_decode_frame buf=%p buf_size=%d frameCount=%d!!\n",buf,buf_size,s->frameCount); */ | |||
| if(buf_size==0) { | |||
| /* nothing to do */ | |||
| return 0; | |||
| @@ -429,13 +429,13 @@ static int amr_nb_decode_frame(AVCodecContext * avctx, | |||
| av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n", buf_size, packet_size); | |||
| return -1; | |||
| } | |||
| s->frameCount++; | |||
| /* av_log(NULL,AV_LOG_DEBUG,"packet_size=%d amrData= 0x%X %X %X %X\n",packet_size,amrData[0],amrData[1],amrData[2],amrData[3]); */ | |||
| /* call decoder */ | |||
| Decoder_Interface_Decode(s->decState, amrData, data, 0); | |||
| *data_size=160*2; | |||
| return packet_size; | |||
| } | |||
| @@ -445,10 +445,10 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, | |||
| AMRContext *s = (AMRContext*)avctx->priv_data; | |||
| int written; | |||
| written = Encoder_Interface_Encode(s->enstate, | |||
| s->enc_bitrate, | |||
| data, | |||
| frame, | |||
| written = Encoder_Interface_Encode(s->enstate, | |||
| s->enc_bitrate, | |||
| data, | |||
| frame, | |||
| 0); | |||
| /* av_log(NULL,AV_LOG_DEBUG,"amr_nb_encode_frame encoded %u bytes, bitrate %u, first byte was %#02x\n",written, s->enc_bitrate, frame[0] ); */ | |||
| @@ -502,7 +502,7 @@ typedef struct AMRWB_bitrates | |||
| int startrate; | |||
| int stoprate; | |||
| int mode; | |||
| } AMRWB_bitrates; | |||
| static int getWBBitrateMode(int bitrate) | |||
| @@ -518,7 +518,7 @@ static int getWBBitrateMode(int bitrate) | |||
| {18001,22000,6},//19.85 | |||
| {22001,23000,7},//23.05 | |||
| {23001,24000,8},//23.85 | |||
| }; | |||
| int i; | |||
| @@ -545,7 +545,7 @@ static int amr_wb_encode_init(AVCodecContext * avctx) | |||
| { | |||
| AMRWBContext *s = (AMRWBContext*)avctx->priv_data; | |||
| s->frameCount=0; | |||
| if(avctx->sample_rate!=16000) | |||
| { | |||
| if(avctx->debug) | |||
| @@ -623,7 +623,7 @@ static int amr_wb_decode_frame(AVCodecContext * avctx, | |||
| av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n", buf_size, packet_size+1); | |||
| return -1; | |||
| } | |||
| s->frameCount++; | |||
| D_IF_decode( s->state, amrData, data, _good_frame); | |||
| *data_size=320*2; | |||
| @@ -4,7 +4,7 @@ | |||
| * | |||
| * Note that this library only handles codecs (mpeg, mpeg4, etc...), | |||
| * not file formats (avi, vob, etc...). See library 'libavformat' for the | |||
| * format handling | |||
| * format handling | |||
| */ | |||
| #include <stdlib.h> | |||
| @@ -21,7 +21,7 @@ | |||
| #define INBUF_SIZE 4096 | |||
| /* | |||
| * Audio encoding example | |||
| * Audio encoding example | |||
| */ | |||
| void audio_encode_example(const char *filename) | |||
| { | |||
| @@ -43,7 +43,7 @@ void audio_encode_example(const char *filename) | |||
| } | |||
| c= avcodec_alloc_context(); | |||
| /* put sample parameters */ | |||
| c->bit_rate = 64000; | |||
| c->sample_rate = 44100; | |||
| @@ -54,7 +54,7 @@ void audio_encode_example(const char *filename) | |||
| fprintf(stderr, "could not open codec\n"); | |||
| exit(1); | |||
| } | |||
| /* the codec gives us the frame size, in samples */ | |||
| frame_size = c->frame_size; | |||
| samples = malloc(frame_size * 2 * c->channels); | |||
| @@ -66,7 +66,7 @@ void audio_encode_example(const char *filename) | |||
| fprintf(stderr, "could not open %s\n", filename); | |||
| exit(1); | |||
| } | |||
| /* encode a single tone sound */ | |||
| t = 0; | |||
| tincr = 2 * M_PI * 440.0 / c->sample_rate; | |||
| @@ -89,7 +89,7 @@ void audio_encode_example(const char *filename) | |||
| } | |||
| /* | |||
| * Audio decoding. | |||
| * Audio decoding. | |||
| */ | |||
| void audio_decode_example(const char *outfilename, const char *filename) | |||
| { | |||
| @@ -101,7 +101,7 @@ void audio_decode_example(const char *outfilename, const char *filename) | |||
| uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE], *inbuf_ptr; | |||
| printf("Audio decoding\n"); | |||
| /* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */ | |||
| memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE); | |||
| @@ -119,7 +119,7 @@ void audio_decode_example(const char *outfilename, const char *filename) | |||
| fprintf(stderr, "could not open codec\n"); | |||
| exit(1); | |||
| } | |||
| outbuf = malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE); | |||
| f = fopen(filename, "rb"); | |||
| @@ -132,7 +132,7 @@ void audio_decode_example(const char *outfilename, const char *filename) | |||
| av_free(c); | |||
| exit(1); | |||
| } | |||
| /* decode until eof */ | |||
| inbuf_ptr = inbuf; | |||
| for(;;) { | |||
| @@ -142,7 +142,7 @@ void audio_decode_example(const char *outfilename, const char *filename) | |||
| inbuf_ptr = inbuf; | |||
| while (size > 0) { | |||
| len = avcodec_decode_audio(c, (short *)outbuf, &out_size, | |||
| len = avcodec_decode_audio(c, (short *)outbuf, &out_size, | |||
| inbuf_ptr, size); | |||
| if (len < 0) { | |||
| fprintf(stderr, "Error while decoding\n"); | |||
| @@ -166,7 +166,7 @@ void audio_decode_example(const char *outfilename, const char *filename) | |||
| } | |||
| /* | |||
| * Video encoding example | |||
| * Video encoding example | |||
| */ | |||
| void video_encode_example(const char *filename) | |||
| { | |||
| @@ -188,11 +188,11 @@ void video_encode_example(const char *filename) | |||
| c= avcodec_alloc_context(); | |||
| picture= avcodec_alloc_frame(); | |||
| /* put sample parameters */ | |||
| c->bit_rate = 400000; | |||
| /* resolution must be a multiple of two */ | |||
| c->width = 352; | |||
| c->width = 352; | |||
| c->height = 288; | |||
| /* frames per second */ | |||
| c->time_base= (AVRational){1,25}; | |||
| @@ -205,7 +205,7 @@ void video_encode_example(const char *filename) | |||
| fprintf(stderr, "could not open codec\n"); | |||
| exit(1); | |||
| } | |||
| /* the codec gives us the frame size, in samples */ | |||
| f = fopen(filename, "wb"); | |||
| @@ -213,13 +213,13 @@ void video_encode_example(const char *filename) | |||
| fprintf(stderr, "could not open %s\n", filename); | |||
| exit(1); | |||
| } | |||
| /* alloc image and output buffer */ | |||
| outbuf_size = 100000; | |||
| outbuf = malloc(outbuf_size); | |||
| size = c->width * c->height; | |||
| picture_buf = malloc((size * 3) / 2); /* size for YUV 420 */ | |||
| picture->data[0] = picture_buf; | |||
| picture->data[1] = picture->data[0] + size; | |||
| picture->data[2] = picture->data[1] + size / 4; | |||
| @@ -255,7 +255,7 @@ void video_encode_example(const char *filename) | |||
| /* get the delayed frames */ | |||
| for(; out_size; i++) { | |||
| fflush(stdout); | |||
| out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL); | |||
| printf("write frame %3d (size=%5d)\n", i, out_size); | |||
| fwrite(outbuf, 1, out_size, f); | |||
| @@ -278,10 +278,10 @@ void video_encode_example(const char *filename) | |||
| } | |||
| /* | |||
| * Video decoding example | |||
| * Video decoding example | |||
| */ | |||
| void pgm_save(unsigned char *buf,int wrap, int xsize,int ysize,char *filename) | |||
| void pgm_save(unsigned char *buf,int wrap, int xsize,int ysize,char *filename) | |||
| { | |||
| FILE *f; | |||
| int i; | |||
| @@ -330,7 +330,7 @@ void video_decode_example(const char *outfilename, const char *filename) | |||
| fprintf(stderr, "could not open codec\n"); | |||
| exit(1); | |||
| } | |||
| /* the codec gives us the frame size, in samples */ | |||
| f = fopen(filename, "rb"); | |||
| @@ -338,7 +338,7 @@ void video_decode_example(const char *outfilename, const char *filename) | |||
| fprintf(stderr, "could not open %s\n", filename); | |||
| exit(1); | |||
| } | |||
| frame = 0; | |||
| for(;;) { | |||
| size = fread(inbuf, 1, INBUF_SIZE, f); | |||
| @@ -347,7 +347,7 @@ void video_decode_example(const char *outfilename, const char *filename) | |||
| /* NOTE1: some codecs are stream based (mpegvideo, mpegaudio) | |||
| and this is the only method to use them because you cannot | |||
| know the compressed data size before analysing it. | |||
| know the compressed data size before analysing it. | |||
| BUT some other codecs (msmpeg4, mpeg4) are inherently frame | |||
| based, so you must call them with all the data for one | |||
| @@ -362,7 +362,7 @@ void video_decode_example(const char *outfilename, const char *filename) | |||
| feed decoder and see if it could decode a frame */ | |||
| inbuf_ptr = inbuf; | |||
| while (size > 0) { | |||
| len = avcodec_decode_video(c, picture, &got_picture, | |||
| len = avcodec_decode_video(c, picture, &got_picture, | |||
| inbuf_ptr, size); | |||
| if (len < 0) { | |||
| fprintf(stderr, "Error while decoding frame %d\n", frame); | |||
| @@ -375,7 +375,7 @@ void video_decode_example(const char *outfilename, const char *filename) | |||
| /* the picture is allocated by the decoder. no need to | |||
| free it */ | |||
| snprintf(buf, sizeof(buf), outfilename, frame); | |||
| pgm_save(picture->data[0], picture->linesize[0], | |||
| pgm_save(picture->data[0], picture->linesize[0], | |||
| c->width, c->height, buf); | |||
| frame++; | |||
| } | |||
| @@ -387,20 +387,20 @@ void video_decode_example(const char *outfilename, const char *filename) | |||
| /* some codecs, such as MPEG, transmit the I and P frame with a | |||
| latency of one frame. You must do the following to have a | |||
| chance to get the last frame of the video */ | |||
| len = avcodec_decode_video(c, picture, &got_picture, | |||
| len = avcodec_decode_video(c, picture, &got_picture, | |||
| NULL, 0); | |||
| if (got_picture) { | |||
| printf("saving last frame %3d\n", frame); | |||
| fflush(stdout); | |||
| /* the picture is allocated by the decoder. no need to | |||
| free it */ | |||
| snprintf(buf, sizeof(buf), outfilename, frame); | |||
| pgm_save(picture->data[0], picture->linesize[0], | |||
| pgm_save(picture->data[0], picture->linesize[0], | |||
| c->width, c->height, buf); | |||
| frame++; | |||
| } | |||
| fclose(f); | |||
| avcodec_close(c); | |||
| @@ -637,15 +637,15 @@ put_pixels8_xy2_arm: | |||
| .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 | |||
| @@ -674,15 +674,15 @@ put_no_rnd_pixels8_xy2_arm: | |||
| .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 | |||
| @@ -1,4 +1,4 @@ | |||
| /* | |||
| /* | |||
| C-like prototype : | |||
| void j_rev_dct_ARM(DCTBLOCK data) | |||
| @@ -22,7 +22,7 @@ | |||
| COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | |||
| IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | |||
| CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
| */ | |||
| #define FIX_0_298631336 2446 | |||
| #define FIX_0_541196100 4433 | |||
| @@ -36,8 +36,8 @@ | |||
| #define FIX_M_1_847759065 -15137 | |||
| #define FIX_M_1_961570560 -16069 | |||
| #define FIX_M_2_562915447 -20995 | |||
| #define FIX_0xFFFF 0xFFFF | |||
| #define FIX_0xFFFF 0xFFFF | |||
| #define FIX_0_298631336_ID 0 | |||
| #define FIX_0_541196100_ID 4 | |||
| #define FIX_0_765366865_ID 8 | |||
| @@ -53,7 +53,7 @@ | |||
| #define FIX_0xFFFF_ID 48 | |||
| .text | |||
| .align | |||
| .global j_rev_dct_ARM | |||
| j_rev_dct_ARM: | |||
| stmdb sp!, { r4 - r12, lr } @ all callee saved regs | |||
| @@ -63,7 +63,7 @@ j_rev_dct_ARM: | |||
| mov lr, r0 @ lr = pointer to the current row | |||
| mov r12, #8 @ r12 = row-counter | |||
| add r11, pc, #(const_array-.-8) @ r11 = base pointer to the constants array | |||
| add r11, pc, #(const_array-.-8) @ r11 = base pointer to the constants array | |||
| row_loop: | |||
| ldrsh r0, [lr, # 0] @ r0 = 'd0' | |||
| ldrsh r1, [lr, # 8] @ r1 = 'd1' | |||
| @@ -80,11 +80,11 @@ row_loop: | |||
| beq end_of_row_loop @ nothing to be done as ALL of them are '0' | |||
| orrs r2, r3, r1 | |||
| beq empty_row | |||
| ldrsh r2, [lr, # 2] @ r2 = 'd2' | |||
| ldrsh r4, [lr, # 4] @ r4 = 'd4' | |||
| ldrsh r6, [lr, # 6] @ r6 = 'd6' | |||
| ldr r3, [r11, #FIX_0_541196100_ID] | |||
| add r7, r2, r6 | |||
| ldr r5, [r11, #FIX_M_1_847759065_ID] | |||
| @@ -101,7 +101,7 @@ row_loop: | |||
| rsb r3, r6, r3, lsl #13 @ r3 = tmp12 | |||
| stmdb sp!, { r0, r2, r3, r4 } @ save on the stack tmp10, tmp13, tmp12, tmp11 | |||
| ldrsh r3, [lr, #10] @ r3 = 'd3' | |||
| ldrsh r5, [lr, #12] @ r5 = 'd5' | |||
| ldrsh r7, [lr, #14] @ r7 = 'd7' | |||
| @@ -136,49 +136,49 @@ row_loop: | |||
| ldmia sp!, { r0, r2, r4, r6 } @ r0 = tmp10 / r2 = tmp13 / r4 = tmp12 / r6 = tmp11 | |||
| @ r1 = tmp3 / r3 = tmp2 / r5 = tmp1 / r7 = tmp0 | |||
| @ Compute DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS) | |||
| add r8, r0, r1 | |||
| add r8, r8, #(1<<10) | |||
| mov r8, r8, asr #11 | |||
| strh r8, [lr, # 0] | |||
| @ Compute DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS) | |||
| sub r8, r0, r1 | |||
| add r8, r8, #(1<<10) | |||
| mov r8, r8, asr #11 | |||
| strh r8, [lr, #14] | |||
| @ Compute DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS) | |||
| add r8, r6, r3 | |||
| add r8, r8, #(1<<10) | |||
| mov r8, r8, asr #11 | |||
| strh r8, [lr, # 2] | |||
| @ Compute DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS) | |||
| sub r8, r6, r3 | |||
| add r8, r8, #(1<<10) | |||
| mov r8, r8, asr #11 | |||
| strh r8, [lr, #12] | |||
| @ Compute DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS) | |||
| add r8, r4, r5 | |||
| add r8, r8, #(1<<10) | |||
| mov r8, r8, asr #11 | |||
| strh r8, [lr, # 4] | |||
| @ Compute DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS) | |||
| sub r8, r4, r5 | |||
| add r8, r8, #(1<<10) | |||
| mov r8, r8, asr #11 | |||
| strh r8, [lr, #10] | |||
| @ Compute DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS) | |||
| add r8, r2, r7 | |||
| add r8, r8, #(1<<10) | |||
| mov r8, r8, asr #11 | |||
| strh r8, [lr, # 6] | |||
| @ Compute DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS) | |||
| sub r8, r2, r7 | |||
| add r8, r8, #(1<<10) | |||
| @@ -190,7 +190,7 @@ row_loop: | |||
| subs r12, r12, #1 | |||
| bne row_loop | |||
| beq start_column_loop | |||
| empty_row: | |||
| ldr r1, [r11, #FIX_0xFFFF_ID] | |||
| mov r0, r0, lsl #2 | |||
| @@ -244,7 +244,7 @@ column_loop: | |||
| beq empty_odd_column | |||
| stmdb sp!, { r0, r2, r4, r6 } @ save on the stack tmp10, tmp13, tmp12, tmp11 | |||
| add r0, r3, r5 @ r0 = 'z2' | |||
| add r2, r1, r7 @ r2 = 'z1' | |||
| add r4, r3, r7 @ r4 = 'z3' | |||
| @@ -271,53 +271,53 @@ column_loop: | |||
| mla r1, r9, r1, r2 @ r1 = tmp3 + z1 | |||
| add r5, r5, r6 @ r5 = tmp1 | |||
| add r3, r3, r4 @ r3 = tmp2 | |||
| add r1, r1, r6 @ r1 = tmp3 | |||
| add r1, r1, r6 @ r1 = tmp3 | |||
| ldmia sp!, { r0, r2, r4, r6 } @ r0 = tmp10 / r2 = tmp13 / r4 = tmp11 / r6 = tmp12 | |||
| @ r1 = tmp3 / r3 = tmp2 / r5 = tmp1 / r7 = tmp0 | |||
| @ r1 = tmp3 / r3 = tmp2 / r5 = tmp1 / r7 = tmp0 | |||
| @ Compute DESCALE(tmp10 + tmp3, CONST_BITS+PASS1_BITS+3) | |||
| add r8, r0, r1 | |||
| add r8, r8, #(1<<17) | |||
| mov r8, r8, asr #18 | |||
| strh r8, [lr, #( 0*8)] | |||
| @ Compute DESCALE(tmp10 - tmp3, CONST_BITS+PASS1_BITS+3) | |||
| sub r8, r0, r1 | |||
| add r8, r8, #(1<<17) | |||
| mov r8, r8, asr #18 | |||
| strh r8, [lr, #(14*8)] | |||
| @ Compute DESCALE(tmp11 + tmp2, CONST_BITS+PASS1_BITS+3) | |||
| add r8, r4, r3 | |||
| add r8, r8, #(1<<17) | |||
| mov r8, r8, asr #18 | |||
| strh r8, [lr, #( 2*8)] | |||
| @ Compute DESCALE(tmp11 - tmp2, CONST_BITS+PASS1_BITS+3) | |||
| sub r8, r4, r3 | |||
| add r8, r8, #(1<<17) | |||
| mov r8, r8, asr #18 | |||
| strh r8, [lr, #(12*8)] | |||
| @ Compute DESCALE(tmp12 + tmp1, CONST_BITS+PASS1_BITS+3) | |||
| add r8, r6, r5 | |||
| add r8, r8, #(1<<17) | |||
| mov r8, r8, asr #18 | |||
| strh r8, [lr, #( 4*8)] | |||
| @ Compute DESCALE(tmp12 - tmp1, CONST_BITS+PASS1_BITS+3) | |||
| sub r8, r6, r5 | |||
| add r8, r8, #(1<<17) | |||
| mov r8, r8, asr #18 | |||
| strh r8, [lr, #(10*8)] | |||
| @ Compute DESCALE(tmp13 + tmp0, CONST_BITS+PASS1_BITS+3) | |||
| add r8, r2, r7 | |||
| add r8, r8, #(1<<17) | |||
| mov r8, r8, asr #18 | |||
| strh r8, [lr, #( 6*8)] | |||
| @ Compute DESCALE(tmp13 - tmp0, CONST_BITS+PASS1_BITS+3) | |||
| sub r8, r2, r7 | |||
| add r8, r8, #(1<<17) | |||
| @@ -329,7 +329,7 @@ column_loop: | |||
| subs r12, r12, #1 | |||
| bne column_loop | |||
| beq the_end | |||
| empty_odd_column: | |||
| @ Compute DESCALE(tmp10 + tmp3, CONST_BITS+PASS1_BITS+3) | |||
| @ Compute DESCALE(tmp10 - tmp3, CONST_BITS+PASS1_BITS+3) | |||
| @@ -337,21 +337,21 @@ empty_odd_column: | |||
| mov r0, r0, asr #18 | |||
| strh r0, [lr, #( 0*8)] | |||
| strh r0, [lr, #(14*8)] | |||
| @ Compute DESCALE(tmp11 + tmp2, CONST_BITS+PASS1_BITS+3) | |||
| @ Compute DESCALE(tmp11 - tmp2, CONST_BITS+PASS1_BITS+3) | |||
| add r4, r4, #(1<<17) | |||
| mov r4, r4, asr #18 | |||
| strh r4, [lr, #( 2*8)] | |||
| strh r4, [lr, #(12*8)] | |||
| @ Compute DESCALE(tmp12 + tmp1, CONST_BITS+PASS1_BITS+3) | |||
| @ Compute DESCALE(tmp12 - tmp1, CONST_BITS+PASS1_BITS+3) | |||
| add r6, r6, #(1<<17) | |||
| mov r6, r6, asr #18 | |||
| strh r6, [lr, #( 4*8)] | |||
| strh r6, [lr, #(10*8)] | |||
| @ Compute DESCALE(tmp13 + tmp0, CONST_BITS+PASS1_BITS+3) | |||
| @ Compute DESCALE(tmp13 - tmp0, CONST_BITS+PASS1_BITS+3) | |||
| add r2, r2, #(1<<17) | |||
| @@ -363,8 +363,8 @@ empty_odd_column: | |||
| add lr, lr, #2 | |||
| subs r12, r12, #1 | |||
| bne column_loop | |||
| the_end: | |||
| the_end: | |||
| @ The end.... | |||
| add sp, sp, #4 | |||
| ldmia sp!, { r4 - r12, pc } @ restore callee saved regs and return | |||
| @@ -1,4 +1,4 @@ | |||
| /* | |||
| /* | |||
| * simple_idct_arm.S | |||
| * Copyright (C) 2002 Frederic 'dilb' Boulay. | |||
| * All Rights Reserved. | |||
| @@ -20,7 +20,7 @@ | |||
| * | |||
| * | |||
| * The function defined in this file, is derived from the simple_idct function | |||
| * from the libavcodec library part of the ffmpeg project. | |||
| * from the libavcodec library part of the ffmpeg project. | |||
| */ | |||
| /* useful constants for the algorithm, they are save in __constant_ptr__ at */ | |||
| @@ -16,12 +16,12 @@ | |||
| * License along with this library; if not, write to the Free Software | |||
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
| */ | |||
| /** | |||
| * @file asv1.c | |||
| * ASUS V1/V2 codec. | |||
| */ | |||
| #include "avcodec.h" | |||
| #include "dsputil.h" | |||
| #include "mpegvideo.h" | |||
| @@ -31,7 +31,7 @@ | |||
| #define VLC_BITS 6 | |||
| #define ASV2_LEVEL_VLC_BITS 10 | |||
| typedef struct ASV1Context{ | |||
| AVCodecContext *avctx; | |||
| DSPContext dsp; | |||
| @@ -66,7 +66,7 @@ static const uint8_t scantab[64]={ | |||
| static const uint8_t ccp_tab[17][2]={ | |||
| {0x2,2}, {0x7,5}, {0xB,5}, {0x3,5}, | |||
| {0xD,5}, {0x5,5}, {0x9,5}, {0x1,5}, | |||
| {0xE,5}, {0x6,5}, {0xA,5}, {0x2,5}, | |||
| {0xE,5}, {0x6,5}, {0xA,5}, {0x2,5}, | |||
| {0xC,5}, {0x4,5}, {0x8,5}, {0x3,2}, | |||
| {0xF,5}, //EOB | |||
| }; | |||
| @@ -116,19 +116,19 @@ static void init_vlcs(ASV1Context *a){ | |||
| if (!done) { | |||
| done = 1; | |||
| init_vlc(&ccp_vlc, VLC_BITS, 17, | |||
| init_vlc(&ccp_vlc, VLC_BITS, 17, | |||
| &ccp_tab[0][1], 2, 1, | |||
| &ccp_tab[0][0], 2, 1, 1); | |||
| init_vlc(&dc_ccp_vlc, VLC_BITS, 8, | |||
| init_vlc(&dc_ccp_vlc, VLC_BITS, 8, | |||
| &dc_ccp_tab[0][1], 2, 1, | |||
| &dc_ccp_tab[0][0], 2, 1, 1); | |||
| init_vlc(&ac_ccp_vlc, VLC_BITS, 16, | |||
| init_vlc(&ac_ccp_vlc, VLC_BITS, 16, | |||
| &ac_ccp_tab[0][1], 2, 1, | |||
| &ac_ccp_tab[0][0], 2, 1, 1); | |||
| init_vlc(&level_vlc, VLC_BITS, 7, | |||
| init_vlc(&level_vlc, VLC_BITS, 7, | |||
| &level_tab[0][1], 2, 1, | |||
| &level_tab[0][0], 2, 1, 1); | |||
| init_vlc(&asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63, | |||
| init_vlc(&asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63, | |||
| &asv2_level_tab[0][1], 2, 1, | |||
| &asv2_level_tab[0][0], 2, 1, 1); | |||
| } | |||
| @@ -181,7 +181,7 @@ static inline int asv1_decode_block(ASV1Context *a, DCTELEM block[64]){ | |||
| int i; | |||
| block[0]= 8*get_bits(&a->gb, 8); | |||
| for(i=0; i<11; i++){ | |||
| const int ccp= get_vlc2(&a->gb, ccp_vlc.table, VLC_BITS, 1); | |||
| @@ -206,9 +206,9 @@ static inline int asv2_decode_block(ASV1Context *a, DCTELEM block[64]){ | |||
| int i, count, ccp; | |||
| count= asv2_get_bits(&a->gb, 4); | |||
| block[0]= 8*asv2_get_bits(&a->gb, 8); | |||
| ccp= get_vlc2(&a->gb, dc_ccp_vlc.table, VLC_BITS, 1); | |||
| if(ccp){ | |||
| if(ccp&4) block[a->scantable.permutated[1]]= (asv2_get_level(&a->gb) * a->intra_matrix[1])>>4; | |||
| @@ -226,17 +226,17 @@ static inline int asv2_decode_block(ASV1Context *a, DCTELEM block[64]){ | |||
| if(ccp&1) block[a->scantable.permutated[4*i+3]]= (asv2_get_level(&a->gb) * a->intra_matrix[4*i+3])>>4; | |||
| } | |||
| } | |||
| return 0; | |||
| } | |||
| static inline void asv1_encode_block(ASV1Context *a, DCTELEM block[64]){ | |||
| int i; | |||
| int nc_count=0; | |||
| put_bits(&a->pb, 8, (block[0] + 32)>>6); | |||
| block[0]= 0; | |||
| for(i=0; i<10; i++){ | |||
| const int index= scantab[4*i]; | |||
| int ccp=0; | |||
| @@ -247,11 +247,11 @@ static inline void asv1_encode_block(ASV1Context *a, DCTELEM block[64]){ | |||
| if( (block[index + 9] = (block[index + 9]*a->q_intra_matrix[index + 9] + (1<<15))>>16) ) ccp |= 1; | |||
| if(ccp){ | |||
| for(;nc_count; nc_count--) | |||
| for(;nc_count; nc_count--) | |||
| put_bits(&a->pb, ccp_tab[0][1], ccp_tab[0][0]); | |||
| put_bits(&a->pb, ccp_tab[ccp][1], ccp_tab[ccp][0]); | |||
| if(ccp&8) asv1_put_level(&a->pb, block[index + 0]); | |||
| if(ccp&4) asv1_put_level(&a->pb, block[index + 8]); | |||
| if(ccp&2) asv1_put_level(&a->pb, block[index + 1]); | |||
| @@ -266,20 +266,20 @@ static inline void asv1_encode_block(ASV1Context *a, DCTELEM block[64]){ | |||
| static inline void asv2_encode_block(ASV1Context *a, DCTELEM block[64]){ | |||
| int i; | |||
| int count=0; | |||
| for(count=63; count>3; count--){ | |||
| const int index= scantab[count]; | |||
| if( (block[index]*a->q_intra_matrix[index] + (1<<15))>>16 ) | |||
| if( (block[index]*a->q_intra_matrix[index] + (1<<15))>>16 ) | |||
| break; | |||
| } | |||
| count >>= 2; | |||
| asv2_put_bits(&a->pb, 4, count); | |||
| asv2_put_bits(&a->pb, 8, (block[0] + 32)>>6); | |||
| block[0]= 0; | |||
| for(i=0; i<=count; i++){ | |||
| const int index= scantab[4*i]; | |||
| int ccp=0; | |||
| @@ -305,15 +305,15 @@ static inline int decode_mb(ASV1Context *a, DCTELEM block[6][64]){ | |||
| int i; | |||
| a->dsp.clear_blocks(block[0]); | |||
| if(a->avctx->codec_id == CODEC_ID_ASV1){ | |||
| for(i=0; i<6; i++){ | |||
| if( asv1_decode_block(a, block[i]) < 0) | |||
| if( asv1_decode_block(a, block[i]) < 0) | |||
| return -1; | |||
| } | |||
| }else{ | |||
| for(i=0; i<6; i++){ | |||
| if( asv2_decode_block(a, block[i]) < 0) | |||
| if( asv2_decode_block(a, block[i]) < 0) | |||
| return -1; | |||
| } | |||
| } | |||
| @@ -322,7 +322,7 @@ static inline int decode_mb(ASV1Context *a, DCTELEM block[6][64]){ | |||
| static inline int encode_mb(ASV1Context *a, DCTELEM block[6][64]){ | |||
| int i; | |||
| if(a->pb.buf_end - a->pb.buf - (put_bits_count(&a->pb)>>3) < 30*16*16*3/2/8){ | |||
| av_log(a->avctx, AV_LOG_ERROR, "encoded frame too large\n"); | |||
| return -1; | |||
| @@ -341,7 +341,7 @@ static inline int encode_mb(ASV1Context *a, DCTELEM block[6][64]){ | |||
| static inline void idct_put(ASV1Context *a, int mb_x, int mb_y){ | |||
| DCTELEM (*block)[64]= a->block; | |||
| int linesize= a->picture.linesize[0]; | |||
| uint8_t *dest_y = a->picture.data[0] + (mb_y * 16* linesize ) + mb_x * 16; | |||
| uint8_t *dest_cb = a->picture.data[1] + (mb_y * 8 * a->picture.linesize[1]) + mb_x * 8; | |||
| uint8_t *dest_cr = a->picture.data[2] + (mb_y * 8 * a->picture.linesize[2]) + mb_x * 8; | |||
| @@ -361,7 +361,7 @@ static inline void dct_get(ASV1Context *a, int mb_x, int mb_y){ | |||
| DCTELEM (*block)[64]= a->block; | |||
| int linesize= a->picture.linesize[0]; | |||
| int i; | |||
| uint8_t *ptr_y = a->picture.data[0] + (mb_y * 16* linesize ) + mb_x * 16; | |||
| uint8_t *ptr_cb = a->picture.data[1] + (mb_y * 8 * a->picture.linesize[1]) + mb_x * 8; | |||
| uint8_t *ptr_cr = a->picture.data[2] + (mb_y * 8 * a->picture.linesize[2]) + mb_x * 8; | |||
| @@ -372,7 +372,7 @@ static inline void dct_get(ASV1Context *a, int mb_x, int mb_y){ | |||
| a->dsp.get_pixels(block[3], ptr_y + 8*linesize + 8, linesize); | |||
| for(i=0; i<4; i++) | |||
| a->dsp.fdct(block[i]); | |||
| if(!(a->avctx->flags&CODEC_FLAG_GRAY)){ | |||
| a->dsp.get_pixels(block[4], ptr_cb, a->picture.linesize[1]); | |||
| a->dsp.get_pixels(block[5], ptr_cr, a->picture.linesize[2]); | |||
| @@ -381,7 +381,7 @@ static inline void dct_get(ASV1Context *a, int mb_x, int mb_y){ | |||
| } | |||
| } | |||
| static int decode_frame(AVCodecContext *avctx, | |||
| static int decode_frame(AVCodecContext *avctx, | |||
| void *data, int *data_size, | |||
| uint8_t *buf, int buf_size) | |||
| { | |||
| @@ -402,7 +402,7 @@ static int decode_frame(AVCodecContext *avctx, | |||
| p->key_frame= 1; | |||
| a->bitstream_buffer= av_fast_realloc(a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); | |||
| if(avctx->codec_id == CODEC_ID_ASV1) | |||
| a->dsp.bswap_buf((uint32_t*)a->bitstream_buffer, (uint32_t*)buf, buf_size/4); | |||
| else{ | |||
| @@ -417,7 +417,7 @@ static int decode_frame(AVCodecContext *avctx, | |||
| for(mb_x=0; mb_x<a->mb_width2; mb_x++){ | |||
| if( decode_mb(a, a->block) <0) | |||
| return -1; | |||
| idct_put(a, mb_x, mb_y); | |||
| } | |||
| } | |||
| @@ -427,7 +427,7 @@ static int decode_frame(AVCodecContext *avctx, | |||
| for(mb_y=0; mb_y<a->mb_height2; mb_y++){ | |||
| if( decode_mb(a, a->block) <0) | |||
| return -1; | |||
| idct_put(a, mb_x, mb_y); | |||
| } | |||
| } | |||
| @@ -437,11 +437,11 @@ static int decode_frame(AVCodecContext *avctx, | |||
| for(mb_x=0; mb_x<a->mb_width; mb_x++){ | |||
| if( decode_mb(a, a->block) <0) | |||
| return -1; | |||
| idct_put(a, mb_x, mb_y); | |||
| } | |||
| } | |||
| #if 0 | |||
| #if 0 | |||
| int i; | |||
| printf("%d %d\n", 8*buf_size, get_bits_count(&a->gb)); | |||
| for(i=get_bits_count(&a->gb); i<8*buf_size; i++){ | |||
| @@ -457,7 +457,7 @@ for(i=0; i<s->avctx->extradata_size; i++){ | |||
| *data_size = sizeof(AVPicture); | |||
| emms_c(); | |||
| return (get_bits_count(&a->gb)+31)/32*4; | |||
| } | |||
| @@ -469,7 +469,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, | |||
| int mb_x, mb_y; | |||
| init_put_bits(&a->pb, buf, buf_size); | |||
| *p = *pict; | |||
| p->pict_type= I_TYPE; | |||
| p->key_frame= 1; | |||
| @@ -497,13 +497,13 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, | |||
| } | |||
| } | |||
| emms_c(); | |||
| align_put_bits(&a->pb); | |||
| while(put_bits_count(&a->pb)&31) | |||
| put_bits(&a->pb, 8, 0); | |||
| size= put_bits_count(&a->pb)/32; | |||
| if(avctx->codec_id == CODEC_ID_ASV1) | |||
| a->dsp.bswap_buf((uint32_t*)buf, (uint32_t*)buf, size); | |||
| else{ | |||
| @@ -511,7 +511,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, | |||
| for(i=0; i<4*size; i++) | |||
| buf[i]= ff_reverse[ buf[i] ]; | |||
| } | |||
| return size*4; | |||
| } | |||
| @@ -534,7 +534,7 @@ static int decode_init(AVCodecContext *avctx){ | |||
| AVFrame *p= (AVFrame*)&a->picture; | |||
| int i; | |||
| const int scale= avctx->codec_id == CODEC_ID_ASV1 ? 1 : 2; | |||
| common_init(avctx); | |||
| init_vlcs(a); | |||
| ff_init_scantable(a->dsp.idct_permutation, &a->scantable, scantab); | |||
| @@ -569,16 +569,16 @@ static int encode_init(AVCodecContext *avctx){ | |||
| const int scale= avctx->codec_id == CODEC_ID_ASV1 ? 1 : 2; | |||
| common_init(avctx); | |||
| if(avctx->global_quality == 0) avctx->global_quality= 4*FF_QUALITY_SCALE; | |||
| a->inv_qscale= (32*scale*FF_QUALITY_SCALE + avctx->global_quality/2) / avctx->global_quality; | |||
| avctx->extradata= av_mallocz(8); | |||
| avctx->extradata_size=8; | |||
| ((uint32_t*)avctx->extradata)[0]= le2me_32(a->inv_qscale); | |||
| ((uint32_t*)avctx->extradata)[1]= le2me_32(ff_get_fourcc("ASUS")); | |||
| for(i=0; i<64; i++){ | |||
| int q= 32*scale*ff_mpeg1_default_intra_matrix[i]; | |||
| a->q_intra_matrix[i]= ((a->inv_qscale<<16) + q/2) / q; | |||
| @@ -593,7 +593,7 @@ static int decode_end(AVCodecContext *avctx){ | |||
| av_freep(&a->bitstream_buffer); | |||
| av_freep(&a->picture.qscale_table); | |||
| a->bitstream_buffer_size=0; | |||
| return 0; | |||
| } | |||
| @@ -32,7 +32,7 @@ extern "C" { | |||
| #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} | |||
| enum CodecID { | |||
| CODEC_ID_NONE, | |||
| CODEC_ID_NONE, | |||
| CODEC_ID_MPEG1VIDEO, | |||
| CODEC_ID_MPEG2VIDEO, /* prefered ID for MPEG Video 1 or 2 decoding */ | |||
| CODEC_ID_MPEG2VIDEO_XVMC, | |||
| @@ -163,7 +163,7 @@ enum CodecID { | |||
| CODEC_ID_INTERPLAY_DPCM, | |||
| CODEC_ID_XAN_DPCM, | |||
| CODEC_ID_SOL_DPCM, | |||
| CODEC_ID_MP2= 0x15000, | |||
| CODEC_ID_MP3, /* prefered ID for MPEG Audio layer 1, 2 or3 decoding */ | |||
| CODEC_ID_AAC, | |||
| @@ -185,16 +185,16 @@ enum CodecID { | |||
| CODEC_ID_SHORTEN, | |||
| CODEC_ID_ALAC, | |||
| CODEC_ID_WESTWOOD_SND1, | |||
| CODEC_ID_GSM, | |||
| CODEC_ID_GSM, | |||
| CODEC_ID_QDM2, | |||
| CODEC_ID_COOK, | |||
| CODEC_ID_OGGTHEORA= 0x16000, | |||
| CODEC_ID_OGGTHEORA= 0x16000, | |||
| /* subtitle codecs */ | |||
| CODEC_ID_DVD_SUBTITLE= 0x17000, | |||
| CODEC_ID_DVB_SUBTITLE, | |||
| CODEC_ID_DVD_SUBTITLE= 0x17000, | |||
| CODEC_ID_DVB_SUBTITLE, | |||
| CODEC_ID_MPEG2TS= 0x20000, /* _FAKE_ codec to indicate a raw MPEG2 transport | |||
| stream (only used by libavformat) */ | |||
| }; | |||
| @@ -211,7 +211,7 @@ enum CodecType { | |||
| }; | |||
| /** | |||
| * Pixel format. Notes: | |||
| * Pixel format. Notes: | |||
| * | |||
| * PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA | |||
| * color is put together as: | |||
| @@ -231,7 +231,7 @@ enum CodecType { | |||
| 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_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) | |||
| @@ -239,26 +239,26 @@ enum PixelFormat { | |||
| 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_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_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_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_UYVY422, ///< Packed pixel, Cb Y0 Cr Y1 | |||
| PIX_FMT_UYVY411, ///< Packed pixel, Cb Y0 Y1 Cr Y2 Y3 | |||
| PIX_FMT_NB, | |||
| }; | |||
| /* currently unused, may be used if 24/32 bits samples ever supported */ | |||
| enum SampleFormat { | |||
| SAMPLE_FMT_S16 = 0, ///< signed 16 bits | |||
| SAMPLE_FMT_S32, ///< signed 32 bits | |||
| SAMPLE_FMT_S16 = 0, ///< signed 16 bits | |||
| SAMPLE_FMT_S32, ///< signed 32 bits | |||
| SAMPLE_FMT_FLT, ///< float | |||
| SAMPLE_FMT_DBL, ///< double | |||
| }; | |||
| @@ -268,7 +268,7 @@ enum SampleFormat { | |||
| /** | |||
| * Required number of additionally allocated bytes at the end of the input bitstream for decoding. | |||
| * this is mainly needed because some optimized bitstream readers read | |||
| * this is mainly needed because some optimized bitstream readers read | |||
| * 32 or 64 bit at once and could read over the end<br> | |||
| * Note, if the first 23 bits of the additional bytes are not 0 then damaged | |||
| * MPEG bitstreams could cause overread and segfault | |||
| @@ -314,38 +314,38 @@ extern int motion_estimation_method; | |||
| #define FF_MAX_B_FRAMES 8 | |||
| /* encoding support | |||
| these flags can be passed in AVCodecContext.flags before initing | |||
| these flags can be passed in AVCodecContext.flags before initing | |||
| Note: not everything is supported yet. | |||
| */ | |||
| #define CODEC_FLAG_QSCALE 0x0002 ///< use fixed qscale | |||
| #define CODEC_FLAG_QSCALE 0x0002 ///< use fixed qscale | |||
| #define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / Advanced prediction for H263 | |||
| #define CODEC_FLAG_QPEL 0x0010 ///< use qpel MC | |||
| #define CODEC_FLAG_GMC 0x0020 ///< use GMC | |||
| #define CODEC_FLAG_MV0 0x0040 ///< always try a MB with MV=<0,0> | |||
| #define CODEC_FLAG_PART 0x0080 ///< use data partitioning | |||
| /* parent program gurantees that the input for b-frame containing streams is not written to | |||
| #define CODEC_FLAG_QPEL 0x0010 ///< use qpel MC | |||
| #define CODEC_FLAG_GMC 0x0020 ///< use GMC | |||
| #define CODEC_FLAG_MV0 0x0040 ///< always try a MB with MV=<0,0> | |||
| #define CODEC_FLAG_PART 0x0080 ///< use data partitioning | |||
| /* parent program gurantees that the input for b-frame containing streams is not written to | |||
| for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */ | |||
| #define CODEC_FLAG_INPUT_PRESERVED 0x0100 | |||
| #define CODEC_FLAG_PASS1 0x0200 ///< use internal 2pass ratecontrol in first pass mode | |||
| #define CODEC_FLAG_PASS2 0x0400 ///< use internal 2pass ratecontrol in second pass mode | |||
| #define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< use external huffman table (for mjpeg) | |||
| #define CODEC_FLAG_GRAY 0x2000 ///< only decode/encode grayscale | |||
| #define CODEC_FLAG_PASS1 0x0200 ///< use internal 2pass ratecontrol in first pass mode | |||
| #define CODEC_FLAG_PASS2 0x0400 ///< use internal 2pass ratecontrol in second pass mode | |||
| #define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< use external huffman table (for mjpeg) | |||
| #define CODEC_FLAG_GRAY 0x2000 ///< only decode/encode grayscale | |||
| #define CODEC_FLAG_EMU_EDGE 0x4000///< don't draw edges | |||
| #define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding | |||
| #define CODEC_FLAG_TRUNCATED 0x00010000 /** input bitstream might be truncated at a random location instead | |||
| #define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding | |||
| #define CODEC_FLAG_TRUNCATED 0x00010000 /** input bitstream might be truncated at a random location instead | |||
| of only at frame boundaries */ | |||
| #define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< normalize adaptive quantization | |||
| #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< use interlaced dct | |||
| #define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< normalize adaptive quantization | |||
| #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< use interlaced dct | |||
| #define CODEC_FLAG_LOW_DELAY 0x00080000 ///< force low delay | |||
| #define CODEC_FLAG_ALT_SCAN 0x00100000 ///< use alternate scan | |||
| #define CODEC_FLAG_TRELLIS_QUANT 0x00200000 ///< use trellis quantization | |||
| #define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< place global headers in extradata instead of every keyframe | |||
| #define CODEC_FLAG_BITEXACT 0x00800000 ///< use only bitexact stuff (except (i)dct) | |||
| #define CODEC_FLAG_ALT_SCAN 0x00100000 ///< use alternate scan | |||
| #define CODEC_FLAG_TRELLIS_QUANT 0x00200000 ///< use trellis quantization | |||
| #define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< place global headers in extradata instead of every keyframe | |||
| #define CODEC_FLAG_BITEXACT 0x00800000 ///< use only bitexact stuff (except (i)dct) | |||
| /* Fx : Flag for h263+ extra options */ | |||
| #define CODEC_FLAG_H263P_AIC 0x01000000 ///< H263 Advanced intra coding / MPEG4 AC prediction (remove this) | |||
| #define CODEC_FLAG_AC_PRED 0x01000000 ///< H263 Advanced intra coding / MPEG4 AC prediction | |||
| #define CODEC_FLAG_H263P_UMV 0x02000000 ///< Unlimited motion vector | |||
| #define CODEC_FLAG_H263P_UMV 0x02000000 ///< Unlimited motion vector | |||
| #define CODEC_FLAG_CBP_RD 0x04000000 ///< use rate distortion optimization for cbp | |||
| #define CODEC_FLAG_QP_RD 0x08000000 ///< use rate distortion optimization for qp selectioon | |||
| #define CODEC_FLAG_H263P_AIV 0x00000008 ///< H263 Alternative inter vlc | |||
| @@ -367,7 +367,7 @@ extern int motion_estimation_method; | |||
| /* /Fx */ | |||
| /* codec capabilities */ | |||
| #define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< decoder can use draw_horiz_band callback | |||
| #define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< decoder can use draw_horiz_band callback | |||
| /** | |||
| * Codec uses get_buffer() for allocating buffers. | |||
| * direct rendering method 1 | |||
| @@ -379,7 +379,7 @@ extern int motion_estimation_method; | |||
| #define CODEC_CAP_TRUNCATED 0x0008 | |||
| /* codec can export data for HW decoding (XvMC) */ | |||
| #define CODEC_CAP_HWACCEL 0x0010 | |||
| /** | |||
| /** | |||
| * codec has a non zero delay and needs to be feeded with NULL at the end to get the delayed data. | |||
| * if this is not set, the codec is guranteed to never be feeded with NULL data | |||
| */ | |||
| @@ -700,7 +700,7 @@ typedef struct AVCodecContext { | |||
| /** | |||
| * the average bitrate. | |||
| * - encoding: set by user. unused for constant quantizer encoding | |||
| * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream | |||
| * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream | |||
| */ | |||
| int bit_rate; | |||
| @@ -710,7 +710,7 @@ typedef struct AVCodecContext { | |||
| * - encoding: set by user. unused for constant quantizer encoding | |||
| * - decoding: unused | |||
| */ | |||
| int bit_rate_tolerance; | |||
| int bit_rate_tolerance; | |||
| /** | |||
| * CODEC_FLAG_*. | |||
| @@ -721,7 +721,7 @@ typedef struct AVCodecContext { | |||
| /** | |||
| * some codecs needs additionnal format info. It is stored here | |||
| * - encoding: set by user. | |||
| * - encoding: set by user. | |||
| * - decoding: set by lavc. (FIXME is this ok?) | |||
| */ | |||
| int sub_id; | |||
| @@ -746,7 +746,7 @@ typedef struct AVCodecContext { | |||
| */ | |||
| void *extradata; | |||
| int extradata_size; | |||
| /** | |||
| * this is the fundamental unit of time (in seconds) in terms | |||
| * of which frame timestamps are represented. for fixed-fps content, | |||
| @@ -756,17 +756,17 @@ typedef struct AVCodecContext { | |||
| * - decoding: set by lavc. | |||
| */ | |||
| AVRational time_base; | |||
| /* video only */ | |||
| /** | |||
| * picture width / height. | |||
| * - encoding: MUST be set by user. | |||
| * - encoding: MUST be set by user. | |||
| * - decoding: set by lavc. | |||
| * Note, for compatibility its possible to set this instead of | |||
| * Note, for compatibility its possible to set this instead of | |||
| * coded_width/height before decoding | |||
| */ | |||
| int width, height; | |||
| #define FF_ASPECT_EXTENDED 15 | |||
| /** | |||
| @@ -782,15 +782,15 @@ typedef struct AVCodecContext { | |||
| * - decoding: set by lavc. | |||
| */ | |||
| enum PixelFormat pix_fmt; | |||
| /** | |||
| * Frame rate emulation. If not zero lower layer (i.e. format handler) | |||
| * Frame rate emulation. If not zero lower layer (i.e. format handler) | |||
| * has to read frames at native frame rate. | |||
| * - encoding: set by user. | |||
| * - decoding: unused. | |||
| */ | |||
| int rate_emu; | |||
| /** | |||
| * if non NULL, 'draw_horiz_band' is called by the libavcodec | |||
| * decoder to draw an horizontal band. It improve cache usage. Not | |||
| @@ -808,7 +808,7 @@ typedef struct AVCodecContext { | |||
| int y, int type, int height); | |||
| /* audio only */ | |||
| int sample_rate; ///< samples per sec | |||
| int sample_rate; ///< samples per sec | |||
| int channels; | |||
| /** | |||
| @@ -816,28 +816,28 @@ typedef struct AVCodecContext { | |||
| * - encoding: set by user. | |||
| * - decoding: set by lavc. | |||
| */ | |||
| enum SampleFormat sample_fmt; ///< sample format, currenly unused | |||
| enum SampleFormat sample_fmt; ///< sample format, currenly unused | |||
| /* the following data should not be initialized */ | |||
| /** | |||
| * samples per packet. initialized when calling 'init' | |||
| * samples per packet. initialized when calling 'init' | |||
| */ | |||
| int frame_size; | |||
| int frame_number; ///< audio or video frame number | |||
| int real_pict_num; ///< returns the real picture number of previous encoded frame | |||
| int frame_number; ///< audio or video frame number | |||
| int real_pict_num; ///< returns the real picture number of previous encoded frame | |||
| /** | |||
| * number of frames the decoded output will be delayed relative to | |||
| * number of frames the decoded output will be delayed relative to | |||
| * the encoded input. | |||
| * - encoding: set by lavc. | |||
| * - decoding: unused | |||
| */ | |||
| int delay; | |||
| /* - encoding parameters */ | |||
| float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0) | |||
| float qblur; ///< amount of qscale smoothing over time (0.0-1.0) | |||
| float qblur; ///< amount of qscale smoothing over time (0.0-1.0) | |||
| /** | |||
| * minimum quantizer. | |||
| * - encoding: set by user. | |||
| @@ -873,7 +873,7 @@ typedef struct AVCodecContext { | |||
| * - decoding: unused | |||
| */ | |||
| float b_quant_factor; | |||
| /** obsolete FIXME remove */ | |||
| int rc_strategy; | |||
| int b_frame_strategy; | |||
| @@ -885,14 +885,14 @@ typedef struct AVCodecContext { | |||
| * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header | |||
| */ | |||
| int hurry_up; | |||
| struct AVCodec *codec; | |||
| void *priv_data; | |||
| /* unused, FIXME remove*/ | |||
| int rtp_mode; | |||
| int rtp_payload_size; /* The size of the RTP payload: the coder will */ | |||
| /* do it's best to deliver a chunk with size */ | |||
| /* below rtp_payload_size, the chunk will start */ | |||
| @@ -900,14 +900,14 @@ typedef struct AVCodecContext { | |||
| /* This doesn't take account of any particular */ | |||
| /* headers inside the transmited RTP payload */ | |||
| /* The RTP callback: This function is called */ | |||
| /* every time the encoder has a packet to send */ | |||
| /* Depends on the encoder if the data starts */ | |||
| /* with a Start Code (it should) H.263 does. */ | |||
| /* mb_nb contains the number of macroblocks */ | |||
| /* encoded in the RTP payload */ | |||
| void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); | |||
| void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); | |||
| /* statistics, used for 2-pass encoding */ | |||
| int mv_bits; | |||
| @@ -918,7 +918,7 @@ typedef struct AVCodecContext { | |||
| int p_count; | |||
| int skip_count; | |||
| int misc_bits; | |||
| /** | |||
| * number of bits used for the previously encoded frame. | |||
| * - encoding: set by lavc | |||
| @@ -936,7 +936,7 @@ typedef struct AVCodecContext { | |||
| char codec_name[32]; | |||
| enum CodecType codec_type; /* see CODEC_TYPE_xxx */ | |||
| enum CodecID codec_id; /* see CODEC_ID_xxx */ | |||
| /** | |||
| * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). | |||
| * this is used to workaround some encoder bugs | |||
| @@ -944,7 +944,7 @@ typedef struct AVCodecContext { | |||
| * - decoding: set by user, will be converted to upper case by lavc during init | |||
| */ | |||
| unsigned int codec_tag; | |||
| /** | |||
| * workaround bugs in encoders which sometimes cannot be detected automatically. | |||
| * - encoding: set by user | |||
| @@ -967,21 +967,21 @@ typedef struct AVCodecContext { | |||
| #define FF_BUG_DC_CLIP 4096 | |||
| #define FF_BUG_MS 8192 ///< workaround various bugs in microsofts broken decoders | |||
| //#define FF_BUG_FAKE_SCALABILITY 16 //autodetection should work 100% | |||
| /** | |||
| * luma single coeff elimination threshold. | |||
| * - encoding: set by user | |||
| * - decoding: unused | |||
| */ | |||
| int luma_elim_threshold; | |||
| /** | |||
| * chroma single coeff elimination threshold. | |||
| * - encoding: set by user | |||
| * - decoding: unused | |||
| */ | |||
| int chroma_elim_threshold; | |||
| /** | |||
| * strictly follow the std (MPEG4, ...). | |||
| * - encoding: set by user | |||
| @@ -1002,7 +1002,7 @@ typedef struct AVCodecContext { | |||
| * - decoding: unused | |||
| */ | |||
| float b_quant_offset; | |||
| /** | |||
| * error resilience higher values will detect more errors but may missdetect | |||
| * some more or less valid parts as errors. | |||
| @@ -1014,7 +1014,7 @@ typedef struct AVCodecContext { | |||
| #define FF_ER_COMPLIANT 2 | |||
| #define FF_ER_AGGRESSIVE 3 | |||
| #define FF_ER_VERY_AGGRESSIVE 4 | |||
| /** | |||
| * called at the beginning of each frame to get a buffer for it. | |||
| * if pic.reference is set then the frame will be read later by lavc | |||
| @@ -1024,7 +1024,7 @@ typedef struct AVCodecContext { | |||
| * - decoding: set by lavc, user can override | |||
| */ | |||
| int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic); | |||
| /** | |||
| * called to release buffers which where allocated with get_buffer. | |||
| * a released buffer can be reused in get_buffer() | |||
| @@ -1046,25 +1046,25 @@ typedef struct AVCodecContext { | |||
| * used by some WAV based audio codecs | |||
| */ | |||
| int block_align; | |||
| int parse_only; /* - decoding only: if true, only parsing is done | |||
| (function avcodec_parse_frame()). The frame | |||
| data is returned. Only MPEG codecs support this now. */ | |||
| /** | |||
| * 0-> h263 quant 1-> mpeg quant. | |||
| * - encoding: set by user. | |||
| * - decoding: unused | |||
| */ | |||
| int mpeg_quant; | |||
| /** | |||
| * pass1 encoding statistics output buffer. | |||
| * - encoding: set by lavc | |||
| * - decoding: unused | |||
| */ | |||
| char *stats_out; | |||
| /** | |||
| * pass2 encoding statistics input buffer. | |||
| * concatenated stuff from stats_out of pass1 should be placed here | |||
| @@ -1072,7 +1072,7 @@ typedef struct AVCodecContext { | |||
| * - decoding: unused | |||
| */ | |||
| char *stats_in; | |||
| /** | |||
| * ratecontrol qmin qmax limiting method. | |||
| * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax | |||
| @@ -1083,7 +1083,7 @@ typedef struct AVCodecContext { | |||
| float rc_qmod_amp; | |||
| int rc_qmod_freq; | |||
| /** | |||
| * ratecontrol override, see RcOverride. | |||
| * - encoding: allocated/set/freed by user. | |||
| @@ -1091,28 +1091,28 @@ typedef struct AVCodecContext { | |||
| */ | |||
| RcOverride *rc_override; | |||
| int rc_override_count; | |||
| /** | |||
| * rate control equation. | |||
| * - encoding: set by user | |||
| * - decoding: unused | |||
| */ | |||
| char *rc_eq; | |||
| /** | |||
| * maximum bitrate. | |||
| * - encoding: set by user. | |||
| * - decoding: unused | |||
| */ | |||
| int rc_max_rate; | |||
| /** | |||
| * minimum bitrate. | |||
| * - encoding: set by user. | |||
| * - decoding: unused | |||
| */ | |||
| int rc_min_rate; | |||
| /** | |||
| * decoder bitstream buffer size. | |||
| * - encoding: set by user. | |||
| @@ -1129,14 +1129,14 @@ typedef struct AVCodecContext { | |||
| * - decoding: unused | |||
| */ | |||
| float i_quant_factor; | |||
| /** | |||
| * qscale offset between p and i frames. | |||
| * - encoding: set by user. | |||
| * - decoding: unused | |||
| */ | |||
| float i_quant_offset; | |||
| /** | |||
| * initial complexity for pass1 ratecontrol. | |||
| * - encoding: set by user. | |||
| @@ -1157,28 +1157,28 @@ typedef struct AVCodecContext { | |||
| #define FF_DCT_MLIB 4 | |||
| #define FF_DCT_ALTIVEC 5 | |||
| #define FF_DCT_FAAN 6 | |||
| /** | |||
| * luminance masking (0-> disabled). | |||
| * - encoding: set by user | |||
| * - decoding: unused | |||
| */ | |||
| float lumi_masking; | |||
| /** | |||
| * temporary complexity masking (0-> disabled). | |||
| * - encoding: set by user | |||
| * - decoding: unused | |||
| */ | |||
| float temporal_cplx_masking; | |||
| /** | |||
| * spatial complexity masking (0-> disabled). | |||
| * - encoding: set by user | |||
| * - decoding: unused | |||
| */ | |||
| float spatial_cplx_masking; | |||
| /** | |||
| * p block masking (0-> disabled). | |||
| * - encoding: set by user | |||
| @@ -1192,11 +1192,11 @@ typedef struct AVCodecContext { | |||
| * - decoding: unused | |||
| */ | |||
| float dark_masking; | |||
| /* for binary compatibility */ | |||
| int unused; | |||
| /** | |||
| * idct algorithm, see FF_IDCT_* below. | |||
| * - encoding: set by user | |||
| @@ -1270,7 +1270,7 @@ typedef struct AVCodecContext { | |||
| * - decoding: set by user | |||
| */ | |||
| int bits_per_sample; | |||
| /** | |||
| * prediction method (needed for huffyuv). | |||
| * - encoding: set by user | |||
| @@ -1280,7 +1280,7 @@ typedef struct AVCodecContext { | |||
| #define FF_PRED_LEFT 0 | |||
| #define FF_PRED_PLANE 1 | |||
| #define FF_PRED_MEDIAN 2 | |||
| /** | |||
| * sample aspect ratio (0 if unknown). | |||
| * numerator and denominator must be relative prime and smaller then 256 for some video standards | |||
| @@ -1317,7 +1317,7 @@ typedef struct AVCodecContext { | |||
| #define FF_DEBUG_BUGS 0x00001000 | |||
| #define FF_DEBUG_VIS_QP 0x00002000 | |||
| #define FF_DEBUG_VIS_MB_TYPE 0x00004000 | |||
| /** | |||
| * debug. | |||
| * - encoding: set by user. | |||
| @@ -1334,7 +1334,7 @@ typedef struct AVCodecContext { | |||
| * - decoding: unused | |||
| */ | |||
| uint64_t error[4]; | |||
| /** | |||
| * minimum MB quantizer. | |||
| * - encoding: unused | |||
| @@ -1348,7 +1348,7 @@ typedef struct AVCodecContext { | |||
| * - decoding: unused | |||
| */ | |||
| int mb_qmax; | |||
| /** | |||
| * motion estimation compare function. | |||
| * - encoding: set by user. | |||
| @@ -1388,7 +1388,7 @@ typedef struct AVCodecContext { | |||
| #define FF_CMP_W97 12 | |||
| #define FF_CMP_DCTMAX 13 | |||
| #define FF_CMP_CHROMA 256 | |||
| /** | |||
| * ME diamond size & shape. | |||
| * - encoding: set by user. | |||
| @@ -1446,9 +1446,9 @@ typedef struct AVCodecContext { | |||
| * DTG active format information (additionnal aspect ratio | |||
| * information only used in DVB MPEG2 transport streams). 0 if | |||
| * not set. | |||
| * | |||
| * | |||
| * - encoding: unused. | |||
| * - decoding: set by decoder | |||
| * - decoding: set by decoder | |||
| */ | |||
| int dtg_active_format; | |||
| #define FF_DTG_AFD_SAME 8 | |||
| @@ -1462,7 +1462,7 @@ typedef struct AVCodecContext { | |||
| /** | |||
| * Maximum motion estimation search range in subpel units. | |||
| * if 0 then no limit | |||
| * | |||
| * | |||
| * - encoding: set by user. | |||
| * - decoding: unused. | |||
| */ | |||
| @@ -1475,7 +1475,7 @@ typedef struct AVCodecContext { | |||
| */ | |||
| int intra_quant_bias; | |||
| #define FF_DEFAULT_QUANT_BIAS 999999 | |||
| /** | |||
| * inter quantizer bias. | |||
| * - encoding: set by user. | |||
| @@ -1490,15 +1490,15 @@ typedef struct AVCodecContext { | |||
| * table have to be stored somewhere FIXME | |||
| */ | |||
| int color_table_id; | |||
| /** | |||
| * internal_buffer count. | |||
| * internal_buffer count. | |||
| * Don't touch, used by lavc default_get_buffer() | |||
| */ | |||
| int internal_buffer_count; | |||
| /** | |||
| * internal_buffers. | |||
| * internal_buffers. | |||
| * Don't touch, used by lavc default_get_buffer() | |||
| */ | |||
| void *internal_buffer; | |||
| @@ -1516,7 +1516,7 @@ typedef struct AVCodecContext { | |||
| * - decoding: unused | |||
| */ | |||
| int global_quality; | |||
| #define FF_CODER_TYPE_VLC 0 | |||
| #define FF_CODER_TYPE_AC 1 | |||
| /** | |||
| @@ -1532,7 +1532,7 @@ typedef struct AVCodecContext { | |||
| * - decoding: unused | |||
| */ | |||
| int context_model; | |||
| /** | |||
| * slice flags | |||
| * - encoding: unused | |||
| @@ -1549,7 +1549,7 @@ typedef struct AVCodecContext { | |||
| * - decoding: set by decoder | |||
| */ | |||
| int xvmc_acceleration; | |||
| /** | |||
| * macroblock decision mode | |||
| * - encoding: set by user. | |||
| @@ -1573,7 +1573,7 @@ typedef struct AVCodecContext { | |||
| * - decoding: set by lavc | |||
| */ | |||
| uint16_t *inter_matrix; | |||
| /** | |||
| * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). | |||
| * this is used to workaround some encoder bugs | |||
| @@ -1617,7 +1617,7 @@ typedef struct AVCodecContext { | |||
| * - decoding: unused | |||
| */ | |||
| int noise_reduction; | |||
| /** | |||
| * called at the beginning of a frame to get cr buffer for it. | |||
| * buffer type (size, hints) must be the same. lavc won't check it. | |||
| @@ -1656,7 +1656,7 @@ typedef struct AVCodecContext { | |||
| * - decoding: unused. | |||
| */ | |||
| int error_rate; | |||
| /** | |||
| * MP3 antialias algorithm, see FF_AA_* below. | |||
| * - encoding: unused | |||
| @@ -1681,7 +1681,7 @@ typedef struct AVCodecContext { | |||
| * - decoding: set by user | |||
| */ | |||
| int thread_count; | |||
| /** | |||
| * the codec may call this to execute several independant things. it will return only after | |||
| * finishing all tasks, the user may replace this with some multithreaded implementation, the | |||
| @@ -1691,7 +1691,7 @@ typedef struct AVCodecContext { | |||
| * - decoding: set by lavc, user can override | |||
| */ | |||
| int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void **arg2, int *ret, int count); | |||
| /** | |||
| * Thread opaque. | |||
| * can be used by execute() to store some per AVCodecContext stuff. | |||
| @@ -1701,9 +1701,9 @@ typedef struct AVCodecContext { | |||
| void *thread_opaque; | |||
| /** | |||
| * Motion estimation threshold. under which no motion estimation is | |||
| * Motion estimation threshold. under which no motion estimation is | |||
| * performed, but instead the user specified motion vectors are used | |||
| * | |||
| * | |||
| * - encoding: set by user | |||
| * - decoding: unused | |||
| */ | |||
| @@ -1826,28 +1826,28 @@ typedef struct AVCodecContext { | |||
| int mb_lmax; | |||
| /** | |||
| * | |||
| * | |||
| * - encoding: set by user. | |||
| * - decoding: unused | |||
| */ | |||
| int me_penalty_compensation; | |||
| /** | |||
| * | |||
| * | |||
| * - encoding: unused | |||
| * - decoding: set by user. | |||
| */ | |||
| enum AVDiscard skip_loop_filter; | |||
| /** | |||
| * | |||
| * | |||
| * - encoding: unused | |||
| * - decoding: set by user. | |||
| */ | |||
| enum AVDiscard skip_idct; | |||
| /** | |||
| * | |||
| * | |||
| * - encoding: unused | |||
| * - decoding: set by user. | |||
| */ | |||
| @@ -2140,7 +2140,7 @@ struct AVResampleContext; | |||
| typedef struct ReSampleContext ReSampleContext; | |||
| ReSampleContext *audio_resample_init(int output_channels, int input_channels, | |||
| ReSampleContext *audio_resample_init(int output_channels, int input_channels, | |||
| int output_rate, int input_rate); | |||
| int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples); | |||
| void audio_resample_close(ReSampleContext *s); | |||
| @@ -2167,7 +2167,7 @@ ImgReSampleContext *img_resample_full_init(int owidth, int oheight, | |||
| int padleft, int padright); | |||
| void img_resample(ImgReSampleContext *s, | |||
| void img_resample(ImgReSampleContext *s, | |||
| AVPicture *output, const AVPicture *input); | |||
| void img_resample_close(ImgReSampleContext *s); | |||
| @@ -2216,7 +2216,7 @@ int img_get_alpha_info(const AVPicture *src, | |||
| /* convert among pixel formats */ | |||
| int img_convert(AVPicture *dst, int dst_pix_fmt, | |||
| const AVPicture *src, int pix_fmt, | |||
| const AVPicture *src, int pix_fmt, | |||
| int width, int height); | |||
| /* deinterlace a picture */ | |||
| @@ -2264,23 +2264,23 @@ int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, v | |||
| */ | |||
| int avcodec_open(AVCodecContext *avctx, AVCodec *codec); | |||
| int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples, | |||
| int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples, | |||
| int *frame_size_ptr, | |||
| uint8_t *buf, int buf_size); | |||
| int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, | |||
| int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, | |||
| int *got_picture_ptr, | |||
| uint8_t *buf, int buf_size); | |||
| int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, | |||
| int *got_sub_ptr, | |||
| const uint8_t *buf, int buf_size); | |||
| int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata, | |||
| int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata, | |||
| int *data_size_ptr, | |||
| uint8_t *buf, int buf_size); | |||
| int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, | |||
| int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, | |||
| const short *samples); | |||
| int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, | |||
| int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, | |||
| const AVFrame *pict); | |||
| int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, | |||
| int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, | |||
| const AVSubtitle *sub); | |||
| int avcodec_close(AVCodecContext *avctx); | |||
| @@ -2304,7 +2304,7 @@ typedef struct AVCodecParserContext { | |||
| void *priv_data; | |||
| struct AVCodecParser *parser; | |||
| int64_t frame_offset; /* offset of the current frame */ | |||
| int64_t cur_offset; /* current offset | |||
| int64_t cur_offset; /* current offset | |||
| (incremented by each av_parser_parse()) */ | |||
| int64_t last_frame_offset; /* offset of the last frame */ | |||
| /* video info */ | |||
| @@ -2323,7 +2323,7 @@ typedef struct AVCodecParserContext { | |||
| int64_t cur_frame_offset[AV_PARSER_PTS_NB]; | |||
| int64_t cur_frame_pts[AV_PARSER_PTS_NB]; | |||
| int64_t cur_frame_dts[AV_PARSER_PTS_NB]; | |||
| int flags; | |||
| #define PARSER_FLAG_COMPLETE_FRAMES 0x0001 | |||
| } AVCodecParserContext; | |||
| @@ -2332,9 +2332,9 @@ typedef struct AVCodecParser { | |||
| int codec_ids[5]; /* several codec IDs are permitted */ | |||
| int priv_data_size; | |||
| int (*parser_init)(AVCodecParserContext *s); | |||
| int (*parser_parse)(AVCodecParserContext *s, | |||
| int (*parser_parse)(AVCodecParserContext *s, | |||
| AVCodecContext *avctx, | |||
| uint8_t **poutbuf, int *poutbuf_size, | |||
| uint8_t **poutbuf, int *poutbuf_size, | |||
| const uint8_t *buf, int buf_size); | |||
| void (*parser_close)(AVCodecParserContext *s); | |||
| int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); | |||
| @@ -2345,14 +2345,14 @@ extern AVCodecParser *av_first_parser; | |||
| void av_register_codec_parser(AVCodecParser *parser); | |||
| AVCodecParserContext *av_parser_init(int codec_id); | |||
| int av_parser_parse(AVCodecParserContext *s, | |||
| int av_parser_parse(AVCodecParserContext *s, | |||
| AVCodecContext *avctx, | |||
| uint8_t **poutbuf, int *poutbuf_size, | |||
| uint8_t **poutbuf, int *poutbuf_size, | |||
| const uint8_t *buf, int buf_size, | |||
| int64_t pts, int64_t dts); | |||
| int av_parser_change(AVCodecParserContext *s, | |||
| AVCodecContext *avctx, | |||
| uint8_t **poutbuf, int *poutbuf_size, | |||
| uint8_t **poutbuf, int *poutbuf_size, | |||
| const uint8_t *buf, int buf_size, int keyframe); | |||
| void av_parser_close(AVCodecParserContext *s); | |||
| @@ -67,7 +67,7 @@ static int32 ff_thread_func(void *v){ | |||
| //printf("thread_func %X signal complete\n", (int)v); fflush(stdout); | |||
| release_sem(c->done_sem); | |||
| } | |||
| return B_OK; | |||
| } | |||
| @@ -81,7 +81,7 @@ void avcodec_thread_free(AVCodecContext *s){ | |||
| int32 ret; | |||
| for(i=0; i<s->thread_count; i++){ | |||
| c[i].func= NULL; | |||
| release_sem(c[i].work_sem); | |||
| wait_for_thread(c[i].thread, &ret); | |||
| @@ -95,10 +95,10 @@ void avcodec_thread_free(AVCodecContext *s){ | |||
| int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count){ | |||
| ThreadContext *c= s->thread_opaque; | |||
| int i; | |||
| assert(s == c->avctx); | |||
| assert(count <= s->thread_count); | |||
| /* note, we can be certain that this is not called with the same AVCodecContext by different threads at the same time */ | |||
| for(i=0; i<count; i++){ | |||
| @@ -110,7 +110,7 @@ int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, vo | |||
| } | |||
| for(i=0; i<count; i++){ | |||
| acquire_sem(c[i].done_sem); | |||
| c[i].func= NULL; | |||
| if(ret) ret[i]= c[i].ret; | |||
| } | |||
| @@ -126,7 +126,7 @@ int avcodec_thread_init(AVCodecContext *s, int thread_count){ | |||
| assert(!s->thread_opaque); | |||
| c= av_mallocz(sizeof(ThreadContext)*thread_count); | |||
| s->thread_opaque= c; | |||
| for(i=0; i<thread_count; i++){ | |||
| //printf("init semaphors %d\n", i); fflush(stdout); | |||
| c[i].avctx= s; | |||
| @@ -142,7 +142,7 @@ int avcodec_thread_init(AVCodecContext *s, int thread_count){ | |||
| resume_thread(c[i].thread ); | |||
| } | |||
| //printf("init done\n"); fflush(stdout); | |||
| s->execute= avcodec_thread_execute; | |||
| return 0; | |||
| @@ -24,7 +24,7 @@ | |||
| * @file bitstream.c | |||
| * bitstream api. | |||
| */ | |||
| #include "avcodec.h" | |||
| #include "bitstream.h" | |||
| @@ -49,7 +49,7 @@ void ff_put_string(PutBitContext * pbc, char *s, int put_zero) | |||
| /* bit input functions */ | |||
| /** | |||
| /** | |||
| * reads 0-32 bits. | |||
| */ | |||
| unsigned int get_bits_long(GetBitContext *s, int n){ | |||
| @@ -60,7 +60,7 @@ unsigned int get_bits_long(GetBitContext *s, int n){ | |||
| } | |||
| } | |||
| /** | |||
| /** | |||
| * shows 0-32 bits. | |||
| */ | |||
| unsigned int show_bits_long(GetBitContext *s, int n){ | |||
| @@ -235,7 +235,7 @@ static int build_table(VLC *vlc, int table_nb_bits, | |||
| 'nb_bits' set thee decoding table size (2^nb_bits) entries. The | |||
| bigger it is, the faster is the decoding. But it should not be too | |||
| big to save memory and L1 cache. '9' is a good compromise. | |||
| 'nb_codes' : number of vlcs codes | |||
| 'bits' : table which gives the size (in bits) of each vlc code. | |||
| @@ -249,7 +249,7 @@ static int build_table(VLC *vlc, int table_nb_bits, | |||
| or 'codes' tables. | |||
| 'wrap' and 'size' allows to use any memory configuration and types | |||
| (byte/word/long) to store the 'bits' and 'codes' tables. | |||
| (byte/word/long) to store the 'bits' and 'codes' tables. | |||
| 'use_static' should be set to 1 for tables, which should be freed | |||
| with av_free_static(), 0 if free_vlc() will be used. | |||
| @@ -13,7 +13,7 @@ | |||
| //#define LIBMPEG2_BITSTREAM_READER | |||
| //#define A32_BITSTREAM_READER | |||
| #define LIBMPEG2_BITSTREAM_READER_HACK //add BERO | |||
| extern const uint8_t ff_reverse[256]; | |||
| #if defined(ARCH_X86) || defined(ARCH_X86_64) | |||
| @@ -173,7 +173,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) | |||
| #endif | |||
| // printf("put_bits=%d %x\n", n, value); | |||
| assert(n == 32 || value < (1U << n)); | |||
| bit_buf = s->bit_buf; | |||
| bit_left = s->bit_left; | |||
| @@ -231,9 +231,9 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) | |||
| # else | |||
| int index= s->index; | |||
| uint32_t *ptr= ((uint32_t *)s->buf)+(index>>5); | |||
| value<<= 32-n; | |||
| value<<= 32-n; | |||
| ptr[0] |= be2me_32(value>>(index&31)); | |||
| ptr[1] = be2me_32(value<<(32-(index&31))); | |||
| //if(n>24) printf("%d %d\n", n, value); | |||
| @@ -261,7 +261,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) | |||
| # else | |||
| int index= s->index; | |||
| uint32_t *ptr= (uint32_t*)(((uint8_t *)s->buf)+(index>>3)); | |||
| ptr[0] |= be2me_32(value<<(32-n-(index&7) )); | |||
| ptr[1] = 0; | |||
| //if(n>24) printf("%d %d\n", n, value); | |||
| @@ -294,7 +294,7 @@ static inline void skip_put_bytes(PutBitContext *s, int n){ | |||
| #else | |||
| assert(s->bit_left==32); | |||
| s->buf_ptr += n; | |||
| #endif | |||
| #endif | |||
| } | |||
| /** | |||
| @@ -308,7 +308,7 @@ static inline void skip_put_bits(PutBitContext *s, int n){ | |||
| s->bit_left -= n; | |||
| s->buf_ptr-= s->bit_left>>5; | |||
| s->bit_left &= 31; | |||
| #endif | |||
| #endif | |||
| } | |||
| /** | |||
| @@ -569,9 +569,9 @@ static inline int get_bits_count(GetBitContext *s){ | |||
| /** | |||
| * read mpeg1 dc style vlc (sign bit + mantisse with no MSB). | |||
| * if MSB not set it is negative | |||
| * if MSB not set it is negative | |||
| * @param n length in bits | |||
| * @author BERO | |||
| * @author BERO | |||
| */ | |||
| static inline int get_xbits(GetBitContext *s, int n){ | |||
| register int tmp; | |||
| @@ -795,11 +795,11 @@ static inline int get_vlc(GetBitContext *s, VLC *vlc) | |||
| { | |||
| int code; | |||
| VLC_TYPE (*table)[2]= vlc->table; | |||
| OPEN_READER(re, s) | |||
| UPDATE_CACHE(re, s) | |||
| GET_VLC(code, re, s, table, vlc->bits, 3) | |||
| GET_VLC(code, re, s, table, vlc->bits, 3) | |||
| CLOSE_READER(re, s) | |||
| return code; | |||
| @@ -807,17 +807,17 @@ static inline int get_vlc(GetBitContext *s, VLC *vlc) | |||
| /** | |||
| * parses a vlc code, faster then get_vlc() | |||
| * @param bits is the number of bits which will be read at once, must be | |||
| * @param bits is the number of bits which will be read at once, must be | |||
| * identical to nb_bits in init_vlc() | |||
| * @param max_depth is the number of times bits bits must be readed to completly | |||
| * read the longest vlc code | |||
| * read the longest vlc code | |||
| * = (max_vlc_length + bits - 1) / bits | |||
| */ | |||
| static always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], | |||
| int bits, int max_depth) | |||
| { | |||
| int code; | |||
| OPEN_READER(re, s) | |||
| UPDATE_CACHE(re, s) | |||
| @@ -833,7 +833,7 @@ static always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], | |||
| #include "avcodec.h" | |||
| static inline void print_bin(int bits, int n){ | |||
| int i; | |||
| for(i=n-1; i>=0; i--){ | |||
| av_log(NULL, AV_LOG_DEBUG, "%d", (bits>>i)&1); | |||
| } | |||
| @@ -843,7 +843,7 @@ static inline void print_bin(int bits, int n){ | |||
| static inline int get_bits_trace(GetBitContext *s, int n, char *file, const char *func, int line){ | |||
| int r= get_bits(s, n); | |||
| print_bin(r, n); | |||
| av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d bit @%5d in %s %s:%d\n", r, n, r, get_bits_count(s)-n, file, func, line); | |||
| return r; | |||
| @@ -854,16 +854,16 @@ static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2], int bits | |||
| int r= get_vlc2(s, table, bits, max_depth); | |||
| int len= get_bits_count(s) - pos; | |||
| int bits2= show>>(24-len); | |||
| print_bin(bits2, len); | |||
| av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d vlc @%5d in %s %s:%d\n", bits2, len, r, pos, file, func, line); | |||
| return r; | |||
| } | |||
| static inline int get_xbits_trace(GetBitContext *s, int n, char *file, const char *func, int line){ | |||
| int show= show_bits(s, n); | |||
| int r= get_xbits(s, n); | |||
| print_bin(show, n); | |||
| av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d xbt @%5d in %s %s:%d\n", show, n, r, get_bits_count(s)-n, file, func, line); | |||
| return r; | |||
| @@ -42,7 +42,7 @@ static int bmp_decode_init(AVCodecContext *avctx){ | |||
| return 0; | |||
| } | |||
| static int bmp_decode_frame(AVCodecContext *avctx, | |||
| static int bmp_decode_frame(AVCodecContext *avctx, | |||
| void *data, int *data_size, | |||
| uint8_t *buf, int buf_size) | |||
| { | |||
| @@ -79,14 +79,14 @@ const uint8_t ff_h264_norm_shift[256]= { | |||
| 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, | |||
| }; | |||
| /** | |||
| @@ -102,7 +102,7 @@ void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size){ | |||
| #ifdef STRICT_LIMITS | |||
| c->sym_count =0; | |||
| #endif | |||
| c->pb.bit_left++; //avoids firstBitFlag | |||
| } | |||
| @@ -111,7 +111,7 @@ void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size){ | |||
| * @param buf_size size of buf in bits | |||
| */ | |||
| void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size){ | |||
| c->bytestream_start= | |||
| c->bytestream_start= | |||
| c->bytestream= buf; | |||
| c->bytestream_end= buf + buf_size; | |||
| @@ -125,10 +125,10 @@ void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size){ | |||
| c->range= 0x1FE<<(CABAC_BITS + 1); | |||
| } | |||
| void ff_init_cabac_states(CABACContext *c, uint8_t const (*lps_range)[4], | |||
| 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){ | |||
| int i, j; | |||
| for(i=0; i<state_count; i++){ | |||
| for(j=0; j<4; j++){ //FIXME check if this is worth the 1 shift we save | |||
| c->lps_range[2*i+0][j+4]= | |||
| @@ -159,20 +159,20 @@ int main(){ | |||
| uint8_t r[9*SIZE]; | |||
| int i; | |||
| uint8_t state[10]= {0}; | |||
| ff_init_cabac_encoder(&c, b, SIZE); | |||
| ff_init_cabac_states(&c, ff_h264_lps_range, ff_h264_mps_state, ff_h264_lps_state, 64); | |||
| for(i=0; i<SIZE; i++){ | |||
| r[i]= random()%7; | |||
| } | |||
| for(i=0; i<SIZE; i++){ | |||
| START_TIMER | |||
| put_cabac_bypass(&c, r[i]&1); | |||
| STOP_TIMER("put_cabac_bypass") | |||
| } | |||
| for(i=0; i<SIZE; i++){ | |||
| START_TIMER | |||
| put_cabac(&c, state, r[i]&1); | |||
| @@ -183,27 +183,27 @@ STOP_TIMER("put_cabac") | |||
| START_TIMER | |||
| put_cabac_u(&c, state, r[i], 6, 3, i&1); | |||
| STOP_TIMER("put_cabac_u") | |||
| } | |||
| } | |||
| for(i=0; i<SIZE; i++){ | |||
| START_TIMER | |||
| put_cabac_ueg(&c, state, r[i], 3, 0, 1, 2); | |||
| STOP_TIMER("put_cabac_ueg") | |||
| } | |||
| } | |||
| put_cabac_terminate(&c, 1); | |||
| ff_init_cabac_decoder(&c, b, SIZE); | |||
| memset(state, 0, sizeof(state)); | |||
| for(i=0; i<SIZE; i++){ | |||
| START_TIMER | |||
| if( (r[i]&1) != get_cabac_bypass(&c) ) | |||
| av_log(NULL, AV_LOG_ERROR, "CABAC bypass failure at %d\n", i); | |||
| STOP_TIMER("get_cabac_bypass") | |||
| } | |||
| for(i=0; i<SIZE; i++){ | |||
| START_TIMER | |||
| if( (r[i]&1) != get_cabac(&c, state) ) | |||
| @@ -227,7 +227,7 @@ STOP_TIMER("get_cabac_ueg") | |||
| #endif | |||
| if(!get_cabac_terminate(&c)) | |||
| av_log(NULL, AV_LOG_ERROR, "where's the Terminator?\n"); | |||
| return 0; | |||
| } | |||
| @@ -17,7 +17,7 @@ | |||
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
| * | |||
| */ | |||
| /** | |||
| * @file cabac.h | |||
| * Context Adaptive Binary Arithmetic Coder. | |||
| @@ -54,13 +54,13 @@ extern const uint8_t ff_h264_norm_shift[256]; | |||
| void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size); | |||
| void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size); | |||
| void ff_init_cabac_states(CABACContext *c, uint8_t const (*lps_range)[4], | |||
| 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); | |||
| static inline void put_cabac_bit(CABACContext *c, int b){ | |||
| put_bits(&c->pb, 1, b); | |||
| for(;c->outstanding_count; c->outstanding_count--){ | |||
| put_bits(&c->pb, 1, b); | |||
| for(;c->outstanding_count; c->outstanding_count--){ | |||
| put_bits(&c->pb, 1, 1-b); | |||
| } | |||
| } | |||
| @@ -77,7 +77,7 @@ static inline void renorm_cabac_encoder(CABACContext *c){ | |||
| put_cabac_bit(c, 1); | |||
| c->low -= 0x200; | |||
| } | |||
| c->range+= c->range; | |||
| c->low += c->low; | |||
| } | |||
| @@ -85,7 +85,7 @@ static inline void renorm_cabac_encoder(CABACContext *c){ | |||
| static inline void put_cabac(CABACContext *c, uint8_t * const state, int bit){ | |||
| int RangeLPS= c->lps_range[*state][c->range>>6]; | |||
| if(bit == ((*state)&1)){ | |||
| c->range -= RangeLPS; | |||
| *state= c->mps_state[*state]; | |||
| @@ -94,7 +94,7 @@ static inline void put_cabac(CABACContext *c, uint8_t * const state, int bit){ | |||
| c->range = RangeLPS; | |||
| *state= c->lps_state[*state]; | |||
| } | |||
| renorm_cabac_encoder(c); | |||
| #ifdef STRICT_LIMITS | |||
| @@ -138,7 +138,7 @@ static inline void put_cabac_bypass(CABACContext *c, int bit){ | |||
| put_cabac_bit(c, 1); | |||
| c->low -= 0x400; | |||
| } | |||
| #ifdef STRICT_LIMITS | |||
| c->symCount++; | |||
| #endif | |||
| @@ -156,16 +156,16 @@ static inline int put_cabac_terminate(CABACContext *c, int bit){ | |||
| }else{ | |||
| c->low += c->range; | |||
| c->range= 2; | |||
| renorm_cabac_encoder(c); | |||
| assert(c->low <= 0x1FF); | |||
| put_cabac_bit(c, c->low>>9); | |||
| put_bits(&c->pb, 2, ((c->low>>7)&3)|1); | |||
| flush_put_bits(&c->pb); //FIXME FIXME FIXME XXX wrong | |||
| } | |||
| #ifdef STRICT_LIMITS | |||
| c->symCount++; | |||
| #endif | |||
| @@ -178,9 +178,9 @@ static inline int put_cabac_terminate(CABACContext *c, int bit){ | |||
| */ | |||
| static inline void put_cabac_u(CABACContext *c, uint8_t * state, int v, int max, int max_index, int truncated){ | |||
| int i; | |||
| assert(v <= max); | |||
| #if 1 | |||
| for(i=0; i<v; i++){ | |||
| put_cabac(c, state, 1); | |||
| @@ -213,14 +213,14 @@ static inline void put_cabac_u(CABACContext *c, uint8_t * state, int v, int max, | |||
| */ | |||
| static inline 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) | |||
| put_cabac(c, state, 0); | |||
| else{ | |||
| const int sign= v < 0; | |||
| if(is_signed) v= ABS(v); | |||
| if(v<max){ | |||
| for(i=0; i<v; i++){ | |||
| put_cabac(c, state, 1); | |||
| @@ -272,14 +272,14 @@ static void refill2(CABACContext *c){ | |||
| i= 8 - 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 | |||
| x+= c->bytestream[0]<<1; | |||
| #endif | |||
| c->low += x<<i; | |||
| c->bytestream+= CABAC_BITS/8; | |||
| } | |||
| @@ -305,7 +305,7 @@ static inline void renorm_cabac_decoder_once(CABACContext *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); | |||
| int bit, lps_mask attribute_unused; | |||
| c->range -= RangeLPS; | |||
| #if 1 | |||
| if(c->low < c->range){ | |||
| @@ -327,13 +327,13 @@ static inline int get_cabac(CABACContext *c, uint8_t * const state){ | |||
| } | |||
| #else | |||
| lps_mask= (c->range - c->low)>>31; | |||
| c->low -= c->range & lps_mask; | |||
| c->range += (RangeLPS - c->range) & lps_mask; | |||
| bit= ((*state)^lps_mask)&1; | |||
| *state= c->mps_state[(*state) - (128&lps_mask)]; | |||
| lps_mask= ff_h264_norm_shift[c->range>>(CABAC_BITS+2)]; | |||
| c->range<<= lps_mask; | |||
| c->low <<= lps_mask; | |||
| @@ -341,7 +341,7 @@ static inline int get_cabac(CABACContext *c, uint8_t * const state){ | |||
| refill2(c); | |||
| #endif | |||
| return bit; | |||
| return bit; | |||
| } | |||
| static inline int get_cabac_bypass(CABACContext *c){ | |||
| @@ -349,7 +349,7 @@ static inline int get_cabac_bypass(CABACContext *c){ | |||
| if(!(c->low & CABAC_MASK)) | |||
| refill(c); | |||
| if(c->low < c->range){ | |||
| return 0; | |||
| }else{ | |||
| @@ -369,7 +369,7 @@ static inline int get_cabac_terminate(CABACContext *c){ | |||
| return 0; | |||
| }else{ | |||
| return c->bytestream - c->bytestream_start; | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| @@ -377,11 +377,11 @@ static inline int get_cabac_terminate(CABACContext *c){ | |||
| */ | |||
| static inline int get_cabac_u(CABACContext *c, uint8_t * state, int max, int max_index, int truncated){ | |||
| int i; | |||
| for(i=0; i<max; i++){ | |||
| for(i=0; i<max; i++){ | |||
| if(get_cabac(c, state)==0) | |||
| return i; | |||
| if(i< max_index) state++; | |||
| } | |||
| @@ -394,13 +394,13 @@ static inline int get_cabac_u(CABACContext *c, uint8_t * state, int max, int max | |||
| static inline int get_cabac_ueg(CABACContext *c, uint8_t * state, int max, int is_signed, int k, int max_index){ | |||
| int i, v; | |||
| int m= 1<<k; | |||
| if(get_cabac(c, state)==0) | |||
| if(get_cabac(c, state)==0) | |||
| return 0; | |||
| if(0 < max_index) state++; | |||
| for(i=1; i<max; i++){ | |||
| for(i=1; i<max; i++){ | |||
| if(get_cabac(c, state)==0){ | |||
| if(is_signed && get_cabac_bypass(c)){ | |||
| return -i; | |||
| @@ -410,12 +410,12 @@ static inline int get_cabac_ueg(CABACContext *c, uint8_t * state, int max, int i | |||
| if(i < max_index) state++; | |||
| } | |||
| while(get_cabac_bypass(c)){ | |||
| i+= m; | |||
| m+= m; | |||
| } | |||
| v=0; | |||
| while(m>>=1){ | |||
| v+= v + get_cabac_bypass(c); | |||
| @@ -101,7 +101,7 @@ static void cinepak_decode_codebook (cvid_codebook_t *codebook, | |||
| codebook[i].u = 128 + *data++; | |||
| codebook[i].v = 128 + *data++; | |||
| } else { | |||
| /* this codebook type indicates either greyscale or | |||
| /* this codebook type indicates either greyscale or | |||
| * palettized video; if palettized, U & V components will | |||
| * not be used so it is safe to set them to 128 for the | |||
| * benefit of greyscale rendering in YUV420P */ | |||
| @@ -286,7 +286,7 @@ static int cinepak_decode_strip (CinepakContext *s, | |||
| case 0x2100: | |||
| case 0x2400: | |||
| case 0x2500: | |||
| cinepak_decode_codebook (strip->v4_codebook, chunk_id, | |||
| cinepak_decode_codebook (strip->v4_codebook, chunk_id, | |||
| chunk_size, data); | |||
| break; | |||
| @@ -294,14 +294,14 @@ static int cinepak_decode_strip (CinepakContext *s, | |||
| case 0x2300: | |||
| case 0x2600: | |||
| case 0x2700: | |||
| cinepak_decode_codebook (strip->v1_codebook, chunk_id, | |||
| cinepak_decode_codebook (strip->v1_codebook, chunk_id, | |||
| chunk_size, data); | |||
| break; | |||
| case 0x3000: | |||
| case 0x3100: | |||
| case 0x3200: | |||
| return cinepak_decode_vectors (s, strip, chunk_id, | |||
| return cinepak_decode_vectors (s, strip, chunk_id, | |||
| chunk_size, data); | |||
| } | |||
| @@ -17,12 +17,12 @@ | |||
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
| * | |||
| */ | |||
| /** | |||
| * @file cljr.c | |||
| * Cirrus Logic AccuPak codec. | |||
| */ | |||
| #include "avcodec.h" | |||
| #include "mpegvideo.h" | |||
| @@ -34,7 +34,7 @@ typedef struct CLJRContext{ | |||
| GetBitContext gb; | |||
| } CLJRContext; | |||
| static int decode_frame(AVCodecContext *avctx, | |||
| static int decode_frame(AVCodecContext *avctx, | |||
| void *data, int *data_size, | |||
| uint8_t *buf, int buf_size) | |||
| { | |||
| @@ -75,7 +75,7 @@ static int decode_frame(AVCodecContext *avctx, | |||
| *data_size = sizeof(AVPicture); | |||
| emms_c(); | |||
| return buf_size; | |||
| } | |||
| @@ -92,13 +92,13 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, | |||
| p->key_frame= 1; | |||
| emms_c(); | |||
| align_put_bits(&a->pb); | |||
| while(get_bit_count(&a->pb)&31) | |||
| put_bits(&a->pb, 8, 0); | |||
| size= get_bit_count(&a->pb)/32; | |||
| return size*4; | |||
| } | |||
| #endif | |||
| @@ -113,7 +113,7 @@ static void common_init(AVCodecContext *avctx){ | |||
| static int decode_init(AVCodecContext *avctx){ | |||
| common_init(avctx); | |||
| avctx->pix_fmt= PIX_FMT_YUV411P; | |||
| return 0; | |||
| @@ -123,7 +123,7 @@ static int decode_init(AVCodecContext *avctx){ | |||
| static int encode_init(AVCodecContext *avctx){ | |||
| common_init(avctx); | |||
| return 0; | |||
| } | |||
| #endif | |||
| @@ -24,10 +24,10 @@ | |||
| */ | |||
| /** | |||
| * @file cyuv.c | |||
| * @file cyuv.c | |||
| * Creative YUV (CYUV) Video Decoder. | |||
| */ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <string.h> | |||
| @@ -61,7 +61,7 @@ static int cyuv_decode_init(AVCodecContext *avctx) | |||
| return 0; | |||
| } | |||
| static int cyuv_decode_frame(AVCodecContext *avctx, | |||
| static int cyuv_decode_frame(AVCodecContext *avctx, | |||
| void *data, int *data_size, | |||
| uint8_t *buf, int buf_size) | |||
| { | |||
| @@ -114,7 +114,7 @@ static int cyuv_decode_frame(AVCodecContext *avctx, | |||
| /* iterate through each line in the height */ | |||
| for (y_ptr = 0, u_ptr = 0, v_ptr = 0; | |||
| y_ptr < (s->height * s->frame.linesize[0]); | |||
| y_ptr < (s->height * s->frame.linesize[0]); | |||
| y_ptr += s->frame.linesize[0] - s->width, | |||
| u_ptr += s->frame.linesize[1] - s->width / 4, | |||
| v_ptr += s->frame.linesize[2] - s->width / 4) { | |||
| @@ -1,6 +1,6 @@ | |||
| /** | |||
| * @file dct-test.c | |||
| * DCT test. (c) 2001 Fabrice Bellard. | |||
| * DCT test. (c) 2001 Fabrice Bellard. | |||
| * Started from sample code by Juan J. Sierralta P. | |||
| */ | |||
| @@ -65,13 +65,13 @@ int64_t gettime(void) | |||
| static short idct_mmx_perm[64]; | |||
| static short idct_simple_mmx_perm[64]={ | |||
| 0x00, 0x08, 0x04, 0x09, 0x01, 0x0C, 0x05, 0x0D, | |||
| 0x10, 0x18, 0x14, 0x19, 0x11, 0x1C, 0x15, 0x1D, | |||
| 0x20, 0x28, 0x24, 0x29, 0x21, 0x2C, 0x25, 0x2D, | |||
| 0x12, 0x1A, 0x16, 0x1B, 0x13, 0x1E, 0x17, 0x1F, | |||
| 0x02, 0x0A, 0x06, 0x0B, 0x03, 0x0E, 0x07, 0x0F, | |||
| 0x30, 0x38, 0x34, 0x39, 0x31, 0x3C, 0x35, 0x3D, | |||
| 0x22, 0x2A, 0x26, 0x2B, 0x23, 0x2E, 0x27, 0x2F, | |||
| 0x00, 0x08, 0x04, 0x09, 0x01, 0x0C, 0x05, 0x0D, | |||
| 0x10, 0x18, 0x14, 0x19, 0x11, 0x1C, 0x15, 0x1D, | |||
| 0x20, 0x28, 0x24, 0x29, 0x21, 0x2C, 0x25, 0x2D, | |||
| 0x12, 0x1A, 0x16, 0x1B, 0x13, 0x1E, 0x17, 0x1F, | |||
| 0x02, 0x0A, 0x06, 0x0B, 0x03, 0x0E, 0x07, 0x0F, | |||
| 0x30, 0x38, 0x34, 0x39, 0x31, 0x3C, 0x35, 0x3D, | |||
| 0x22, 0x2A, 0x26, 0x2B, 0x23, 0x2E, 0x27, 0x2F, | |||
| 0x32, 0x3A, 0x36, 0x3B, 0x33, 0x3E, 0x37, 0x3F, | |||
| }; | |||
| @@ -110,7 +110,7 @@ void dct_error(const char *name, int is_idct, | |||
| for(i=0;i<64;i++) | |||
| block1[i] = 0; | |||
| switch(test){ | |||
| case 0: | |||
| case 0: | |||
| for(i=0;i<64;i++) | |||
| block1[i] = (random() % 512) -256; | |||
| if (is_idct){ | |||
| @@ -136,7 +136,7 @@ void dct_error(const char *name, int is_idct, | |||
| for(i=0;i<64;i++) | |||
| sum+=block1[i]; | |||
| if((sum&1)==0) block1[63]^=1; | |||
| if((sum&1)==0) block1[63]^=1; | |||
| } | |||
| #endif | |||
| @@ -160,15 +160,15 @@ void dct_error(const char *name, int is_idct, | |||
| for(i=0;i<64;i++) | |||
| sum+=block[i]; | |||
| if((sum&1)==0) block[63]^=1; | |||
| if((sum&1)==0) block[63]^=1; | |||
| } | |||
| #endif | |||
| fdct_func(block); | |||
| emms(); /* for ff_mmx_idct */ | |||
| if (fdct_func == fdct_ifast | |||
| #ifndef FAAN_POSTSCALE | |||
| if (fdct_func == fdct_ifast | |||
| #ifndef FAAN_POSTSCALE | |||
| || fdct_func == ff_faandct | |||
| #endif | |||
| ) { | |||
| @@ -206,7 +206,7 @@ void dct_error(const char *name, int is_idct, | |||
| #endif | |||
| } | |||
| for(i=0; i<64; i++) sysErrMax= MAX(sysErrMax, ABS(sysErr[i])); | |||
| #if 1 // dump systematic errors | |||
| for(i=0; i<64; i++){ | |||
| if(i%8==0) printf("\n"); | |||
| @@ -214,7 +214,7 @@ void dct_error(const char *name, int is_idct, | |||
| } | |||
| printf("\n"); | |||
| #endif | |||
| printf("%s %s: err_inf=%d err2=%0.8f syserr=%0.8f maxout=%d blockSumErr=%d\n", | |||
| is_idct ? "IDCT" : "DCT", | |||
| name, err_inf, (double)err2 / NB_ITS / 64.0, (double)sysErrMax / NB_ITS, maxout, blockSumErrMax); | |||
| @@ -223,7 +223,7 @@ void dct_error(const char *name, int is_idct, | |||
| for(i=0;i<64;i++) | |||
| block1[i] = 0; | |||
| switch(test){ | |||
| case 0: | |||
| case 0: | |||
| for(i=0;i<64;i++) | |||
| block1[i] = (random() % 512) -256; | |||
| if (is_idct){ | |||
| @@ -298,7 +298,7 @@ void idct248_ref(uint8_t *dest, int linesize, int16_t *block) | |||
| sum += c8[i][j] * c8[i][j]; | |||
| } | |||
| } | |||
| for(i=0;i<4;i++) { | |||
| sum = 0; | |||
| for(j=0;j<4;j++) { | |||
| @@ -358,18 +358,18 @@ void idct248_ref(uint8_t *dest, int linesize, int16_t *block) | |||
| } | |||
| } | |||
| void idct248_error(const char *name, | |||
| void idct248_error(const char *name, | |||
| void (*idct248_put)(uint8_t *dest, int line_size, int16_t *block)) | |||
| { | |||
| int it, i, it1, ti, ti1, err_max, v; | |||
| srandom(0); | |||
| /* just one test to see if code is correct (precision is less | |||
| important here) */ | |||
| err_max = 0; | |||
| for(it=0;it<NB_ITS;it++) { | |||
| /* XXX: use forward transform to generate values */ | |||
| for(i=0;i<64;i++) | |||
| block1[i] = (random() % 256) - 128; | |||
| @@ -378,11 +378,11 @@ void idct248_error(const char *name, | |||
| for(i=0; i<64; i++) | |||
| block[i]= block1[i]; | |||
| idct248_ref(img_dest1, 8, block); | |||
| for(i=0; i<64; i++) | |||
| block[i]= block1[i]; | |||
| idct248_put(img_dest, 8, block); | |||
| for(i=0;i<64;i++) { | |||
| v = abs((int)img_dest[i] - (int)img_dest1[i]); | |||
| if (v == 255) | |||
| @@ -399,7 +399,7 @@ void idct248_error(const char *name, | |||
| } | |||
| printf("\n"); | |||
| } | |||
| printf("out=\n"); | |||
| for(i=0;i<8;i++) { | |||
| int j; | |||
| @@ -459,7 +459,7 @@ int main(int argc, char **argv) | |||
| cropTbl[i] = 0; | |||
| cropTbl[i + MAX_NEG_CROP + 256] = 255; | |||
| } | |||
| for(;;) { | |||
| c = getopt(argc, argv, "ih4"); | |||
| if (c == -1) | |||
| @@ -477,9 +477,9 @@ int main(int argc, char **argv) | |||
| break; | |||
| } | |||
| } | |||
| if(optind <argc) test= atoi(argv[optind]); | |||
| printf("ffmpeg DCT/IDCT test\n"); | |||
| if (test_248_dct) { | |||
| @@ -91,7 +91,7 @@ static int sol_table_old[16] = | |||
| static int sol_table_new[16] = | |||
| { 0x0, 0x1, 0x2, 0x3, 0x6, 0xA, 0xF, 0x15, | |||
| 0x0, -0x1, -0x2, -0x3, -0x6, -0xA, -0xF, -0x15}; | |||
| static int sol_table_16[128] = { | |||
| 0x000, 0x008, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, 0x080, | |||
| 0x090, 0x0A0, 0x0B0, 0x0C0, 0x0D0, 0x0E0, 0x0F0, 0x100, 0x110, 0x120, | |||
| @@ -130,7 +130,7 @@ static int dpcm_decode_init(AVCodecContext *avctx) | |||
| } | |||
| break; | |||
| case CODEC_ID_SOL_DPCM: | |||
| switch(avctx->codec_tag){ | |||
| case 1: | |||
| @@ -149,7 +149,7 @@ static int dpcm_decode_init(AVCodecContext *avctx) | |||
| return -1; | |||
| } | |||
| break; | |||
| default: | |||
| break; | |||
| } | |||
| @@ -19,12 +19,12 @@ | |||
| * | |||
| * gmc & q-pel & 32/64 bit based MC by Michael Niedermayer <michaelni@gmx.at> | |||
| */ | |||
| /** | |||
| * @file dsputil.c | |||
| * DSP utils | |||
| */ | |||
| #include "avcodec.h" | |||
| #include "dsputil.h" | |||
| #include "mpegvideo.h" | |||
| @@ -65,72 +65,72 @@ const uint8_t ff_zigzag248_direct[64] = { | |||
| uint16_t __align8 inv_zigzag_direct16[64] = {0, }; | |||
| const uint8_t ff_alternate_horizontal_scan[64] = { | |||
| 0, 1, 2, 3, 8, 9, 16, 17, | |||
| 0, 1, 2, 3, 8, 9, 16, 17, | |||
| 10, 11, 4, 5, 6, 7, 15, 14, | |||
| 13, 12, 19, 18, 24, 25, 32, 33, | |||
| 13, 12, 19, 18, 24, 25, 32, 33, | |||
| 26, 27, 20, 21, 22, 23, 28, 29, | |||
| 30, 31, 34, 35, 40, 41, 48, 49, | |||
| 30, 31, 34, 35, 40, 41, 48, 49, | |||
| 42, 43, 36, 37, 38, 39, 44, 45, | |||
| 46, 47, 50, 51, 56, 57, 58, 59, | |||
| 46, 47, 50, 51, 56, 57, 58, 59, | |||
| 52, 53, 54, 55, 60, 61, 62, 63, | |||
| }; | |||
| const uint8_t ff_alternate_vertical_scan[64] = { | |||
| 0, 8, 16, 24, 1, 9, 2, 10, | |||
| 0, 8, 16, 24, 1, 9, 2, 10, | |||
| 17, 25, 32, 40, 48, 56, 57, 49, | |||
| 41, 33, 26, 18, 3, 11, 4, 12, | |||
| 41, 33, 26, 18, 3, 11, 4, 12, | |||
| 19, 27, 34, 42, 50, 58, 35, 43, | |||
| 51, 59, 20, 28, 5, 13, 6, 14, | |||
| 51, 59, 20, 28, 5, 13, 6, 14, | |||
| 21, 29, 36, 44, 52, 60, 37, 45, | |||
| 53, 61, 22, 30, 7, 15, 23, 31, | |||
| 53, 61, 22, 30, 7, 15, 23, 31, | |||
| 38, 46, 54, 62, 39, 47, 55, 63, | |||
| }; | |||
| /* a*inverse[b]>>32 == a/b for all 0<=a<=65536 && 2<=b<=255 */ | |||
| const uint32_t 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, | |||
| 178956971, 171798692, 165191050, 159072863, 153391690, 148102321, 143165577, 138547333, | |||
| 134217728, 130150525, 126322568, 122713352, 119304648, 116080198, 113025456, 110127367, | |||
| 107374183, 104755300, 102261127, 99882961, 97612894, 95443718, 93368855, 91382283, | |||
| 89478486, 87652394, 85899346, 84215046, 82595525, 81037119, 79536432, 78090315, | |||
| 76695845, 75350304, 74051161, 72796056, 71582789, 70409300, 69273667, 68174085, | |||
| 67108864, 66076420, 65075263, 64103990, 63161284, 62245903, 61356676, 60492498, | |||
| 59652324, 58835169, 58040099, 57266231, 56512728, 55778797, 55063684, 54366675, | |||
| 53687092, 53024288, 52377650, 51746594, 51130564, 50529028, 49941481, 49367441, | |||
| 48806447, 48258060, 47721859, 47197443, 46684428, 46182445, 45691142, 45210183, | |||
| 44739243, 44278014, 43826197, 43383509, 42949673, 42524429, 42107523, 41698712, | |||
| 41297763, 40904451, 40518560, 40139882, 39768216, 39403370, 39045158, 38693400, | |||
| 38347923, 38008561, 37675152, 37347542, 37025581, 36709123, 36398028, 36092163, | |||
| 35791395, 35495598, 35204650, 34918434, 34636834, 34359739, 34087043, 33818641, | |||
| 33554432, 33294321, 33038210, 32786010, 32537632, 32292988, 32051995, 31814573, | |||
| 31580642, 31350127, 31122952, 30899046, 30678338, 30460761, 30246249, 30034737, | |||
| 29826162, 29620465, 29417585, 29217465, 29020050, 28825284, 28633116, 28443493, | |||
| 28256364, 28071682, 27889399, 27709467, 27531842, 27356480, 27183338, 27012373, | |||
| 26843546, 26676816, 26512144, 26349493, 26188825, 26030105, 25873297, 25718368, | |||
| 25565282, 25414008, 25264514, 25116768, 24970741, 24826401, 24683721, 24542671, | |||
| 24403224, 24265352, 24129030, 23994231, 23860930, 23729102, 23598722, 23469767, | |||
| 23342214, 23216040, 23091223, 22967740, 22845571, 22724695, 22605092, 22486740, | |||
| 22369622, 22253717, 22139007, 22025474, 21913099, 21801865, 21691755, 21582751, | |||
| 21474837, 21367997, 21262215, 21157475, 21053762, 20951060, 20849356, 20748635, | |||
| 20648882, 20550083, 20452226, 20355296, 20259280, 20164166, 20069941, 19976593, | |||
| 19884108, 19792477, 19701685, 19611723, 19522579, 19434242, 19346700, 19259944, | |||
| 19173962, 19088744, 19004281, 18920561, 18837576, 18755316, 18673771, 18592933, | |||
| 18512791, 18433337, 18354562, 18276457, 18199014, 18122225, 18046082, 17970575, | |||
| 17895698, 17821442, 17747799, 17674763, 17602325, 17530479, 17459217, 17388532, | |||
| 0, 4294967295U,2147483648U,1431655766, 1073741824, 858993460, 715827883, 613566757, | |||
| 536870912, 477218589, 429496730, 390451573, 357913942, 330382100, 306783379, 286331154, | |||
| 268435456, 252645136, 238609295, 226050911, 214748365, 204522253, 195225787, 186737709, | |||
| 178956971, 171798692, 165191050, 159072863, 153391690, 148102321, 143165577, 138547333, | |||
| 134217728, 130150525, 126322568, 122713352, 119304648, 116080198, 113025456, 110127367, | |||
| 107374183, 104755300, 102261127, 99882961, 97612894, 95443718, 93368855, 91382283, | |||
| 89478486, 87652394, 85899346, 84215046, 82595525, 81037119, 79536432, 78090315, | |||
| 76695845, 75350304, 74051161, 72796056, 71582789, 70409300, 69273667, 68174085, | |||
| 67108864, 66076420, 65075263, 64103990, 63161284, 62245903, 61356676, 60492498, | |||
| 59652324, 58835169, 58040099, 57266231, 56512728, 55778797, 55063684, 54366675, | |||
| 53687092, 53024288, 52377650, 51746594, 51130564, 50529028, 49941481, 49367441, | |||
| 48806447, 48258060, 47721859, 47197443, 46684428, 46182445, 45691142, 45210183, | |||
| 44739243, 44278014, 43826197, 43383509, 42949673, 42524429, 42107523, 41698712, | |||
| 41297763, 40904451, 40518560, 40139882, 39768216, 39403370, 39045158, 38693400, | |||
| 38347923, 38008561, 37675152, 37347542, 37025581, 36709123, 36398028, 36092163, | |||
| 35791395, 35495598, 35204650, 34918434, 34636834, 34359739, 34087043, 33818641, | |||
| 33554432, 33294321, 33038210, 32786010, 32537632, 32292988, 32051995, 31814573, | |||
| 31580642, 31350127, 31122952, 30899046, 30678338, 30460761, 30246249, 30034737, | |||
| 29826162, 29620465, 29417585, 29217465, 29020050, 28825284, 28633116, 28443493, | |||
| 28256364, 28071682, 27889399, 27709467, 27531842, 27356480, 27183338, 27012373, | |||
| 26843546, 26676816, 26512144, 26349493, 26188825, 26030105, 25873297, 25718368, | |||
| 25565282, 25414008, 25264514, 25116768, 24970741, 24826401, 24683721, 24542671, | |||
| 24403224, 24265352, 24129030, 23994231, 23860930, 23729102, 23598722, 23469767, | |||
| 23342214, 23216040, 23091223, 22967740, 22845571, 22724695, 22605092, 22486740, | |||
| 22369622, 22253717, 22139007, 22025474, 21913099, 21801865, 21691755, 21582751, | |||
| 21474837, 21367997, 21262215, 21157475, 21053762, 20951060, 20849356, 20748635, | |||
| 20648882, 20550083, 20452226, 20355296, 20259280, 20164166, 20069941, 19976593, | |||
| 19884108, 19792477, 19701685, 19611723, 19522579, 19434242, 19346700, 19259944, | |||
| 19173962, 19088744, 19004281, 18920561, 18837576, 18755316, 18673771, 18592933, | |||
| 18512791, 18433337, 18354562, 18276457, 18199014, 18122225, 18046082, 17970575, | |||
| 17895698, 17821442, 17747799, 17674763, 17602325, 17530479, 17459217, 17388532, | |||
| 17318417, 17248865, 17179870, 17111424, 17043522, 16976156, 16909321, 16843010, | |||
| }; | |||
| /* Input permutation for the simple_idct_mmx */ | |||
| static const uint8_t simple_mmx_permutation[64]={ | |||
| 0x00, 0x08, 0x04, 0x09, 0x01, 0x0C, 0x05, 0x0D, | |||
| 0x10, 0x18, 0x14, 0x19, 0x11, 0x1C, 0x15, 0x1D, | |||
| 0x20, 0x28, 0x24, 0x29, 0x21, 0x2C, 0x25, 0x2D, | |||
| 0x12, 0x1A, 0x16, 0x1B, 0x13, 0x1E, 0x17, 0x1F, | |||
| 0x02, 0x0A, 0x06, 0x0B, 0x03, 0x0E, 0x07, 0x0F, | |||
| 0x30, 0x38, 0x34, 0x39, 0x31, 0x3C, 0x35, 0x3D, | |||
| 0x22, 0x2A, 0x26, 0x2B, 0x23, 0x2E, 0x27, 0x2F, | |||
| 0x00, 0x08, 0x04, 0x09, 0x01, 0x0C, 0x05, 0x0D, | |||
| 0x10, 0x18, 0x14, 0x19, 0x11, 0x1C, 0x15, 0x1D, | |||
| 0x20, 0x28, 0x24, 0x29, 0x21, 0x2C, 0x25, 0x2D, | |||
| 0x12, 0x1A, 0x16, 0x1B, 0x13, 0x1E, 0x17, 0x1F, | |||
| 0x02, 0x0A, 0x06, 0x0B, 0x03, 0x0E, 0x07, 0x0F, | |||
| 0x30, 0x38, 0x34, 0x39, 0x31, 0x3C, 0x35, 0x3D, | |||
| 0x22, 0x2A, 0x26, 0x2B, 0x23, 0x2E, 0x27, 0x2F, | |||
| 0x32, 0x3A, 0x36, 0x3B, 0x33, 0x3E, 0x37, 0x3F, | |||
| }; | |||
| @@ -206,7 +206,7 @@ static int pix_norm1_c(uint8_t * pix, int line_size) | |||
| static void bswap_buf(uint32_t *dst, uint32_t *src, int w){ | |||
| int i; | |||
| for(i=0; i+8<=w; i+=8){ | |||
| dst[i+0]= bswap_32(src[i+0]); | |||
| dst[i+1]= bswap_32(src[i+1]); | |||
| @@ -298,7 +298,7 @@ static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, in | |||
| int tmp[16*16]; | |||
| #if 0 | |||
| int level, ori; | |||
| static const int scale[2][2][4][4]={ | |||
| static const int scale[2][2][4][4]={ | |||
| { | |||
| { | |||
| //8x8 dec=3 | |||
| @@ -350,7 +350,7 @@ static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, in | |||
| int stride= 16<<(dec_count-level); | |||
| int sy= (ori&2) ? stride>>1 : 0; | |||
| int size= 1<<level; | |||
| for(i=0; i<size; i++){ | |||
| for(j=0; j<size; j++){ | |||
| int v= tmp[sx + sy + i*stride + j] * scale[type][dec_count-3][level][ori]; | |||
| @@ -368,8 +368,8 @@ static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, in | |||
| s+= ABS(tmp[16*i+j+3]); | |||
| } | |||
| } | |||
| assert(s>=0); | |||
| assert(s>=0); | |||
| return s>>2; | |||
| #endif | |||
| } | |||
| @@ -435,7 +435,7 @@ static void put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, | |||
| { | |||
| int i; | |||
| uint8_t *cm = cropTbl + MAX_NEG_CROP; | |||
| /* read the pixels */ | |||
| for(i=0;i<8;i++) { | |||
| pixels[0] = cm[block[0]]; | |||
| @@ -457,7 +457,7 @@ static void put_pixels_clamped4_c(const DCTELEM *block, uint8_t *restrict pixels | |||
| { | |||
| int i; | |||
| uint8_t *cm = cropTbl + MAX_NEG_CROP; | |||
| /* read the pixels */ | |||
| for(i=0;i<4;i++) { | |||
| pixels[0] = cm[block[0]]; | |||
| @@ -475,7 +475,7 @@ static void put_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels | |||
| { | |||
| int i; | |||
| uint8_t *cm = cropTbl + MAX_NEG_CROP; | |||
| /* read the pixels */ | |||
| for(i=0;i<2;i++) { | |||
| pixels[0] = cm[block[0]]; | |||
| @@ -486,7 +486,7 @@ static void put_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels | |||
| } | |||
| } | |||
| static void put_signed_pixels_clamped_c(const DCTELEM *block, | |||
| static void put_signed_pixels_clamped_c(const DCTELEM *block, | |||
| uint8_t *restrict pixels, | |||
| int line_size) | |||
| { | |||
| @@ -512,7 +512,7 @@ static void add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, | |||
| { | |||
| int i; | |||
| uint8_t *cm = cropTbl + MAX_NEG_CROP; | |||
| /* read the pixels */ | |||
| for(i=0;i<8;i++) { | |||
| pixels[0] = cm[pixels[0] + block[0]]; | |||
| @@ -533,7 +533,7 @@ static void add_pixels_clamped4_c(const DCTELEM *block, uint8_t *restrict pixels | |||
| { | |||
| int i; | |||
| uint8_t *cm = cropTbl + MAX_NEG_CROP; | |||
| /* read the pixels */ | |||
| for(i=0;i<4;i++) { | |||
| pixels[0] = cm[pixels[0] + block[0]]; | |||
| @@ -550,7 +550,7 @@ static void add_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels | |||
| { | |||
| int i; | |||
| uint8_t *cm = cropTbl + MAX_NEG_CROP; | |||
| /* read the pixels */ | |||
| for(i=0;i<2;i++) { | |||
| pixels[0] = cm[pixels[0] + block[0]]; | |||
| @@ -1143,12 +1143,12 @@ static void gmc1_c(uint8_t *dst, uint8_t *src, int stride, int h, int x16, int y | |||
| } | |||
| } | |||
| static void gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, | |||
| static void gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, | |||
| int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height) | |||
| { | |||
| int y, vx, vy; | |||
| const int s= 1<<shift; | |||
| width--; | |||
| height--; | |||
| @@ -1166,7 +1166,7 @@ static void gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, | |||
| frac_y= src_y&(s-1); | |||
| src_x>>=shift; | |||
| src_y>>=shift; | |||
| if((unsigned)src_x < width){ | |||
| if((unsigned)src_y < height){ | |||
| index= src_x + src_y*stride; | |||
| @@ -1176,23 +1176,23 @@ static void gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, | |||
| + src[index+stride+1]* frac_x )* frac_y | |||
| + r)>>(shift*2); | |||
| }else{ | |||
| index= src_x + clip(src_y, 0, height)*stride; | |||
| dst[y*stride + x]= ( ( src[index ]*(s-frac_x) | |||
| index= src_x + clip(src_y, 0, height)*stride; | |||
| dst[y*stride + x]= ( ( src[index ]*(s-frac_x) | |||
| + src[index +1]* frac_x )*s | |||
| + r)>>(shift*2); | |||
| } | |||
| }else{ | |||
| if((unsigned)src_y < height){ | |||
| index= clip(src_x, 0, width) + src_y*stride; | |||
| dst[y*stride + x]= ( ( src[index ]*(s-frac_y) | |||
| index= clip(src_x, 0, width) + src_y*stride; | |||
| dst[y*stride + x]= ( ( src[index ]*(s-frac_y) | |||
| + src[index+stride ]* frac_y )*s | |||
| + r)>>(shift*2); | |||
| }else{ | |||
| index= clip(src_x, 0, width) + clip(src_y, 0, height)*stride; | |||
| index= clip(src_x, 0, width) + clip(src_y, 0, height)*stride; | |||
| dst[y*stride + x]= src[index ]; | |||
| } | |||
| } | |||
| vx+= dxx; | |||
| vy+= dyx; | |||
| } | |||
| @@ -1231,7 +1231,7 @@ static inline void put_tpel_pixels_mc20_c(uint8_t *dst, const uint8_t *src, int | |||
| dst += stride; | |||
| } | |||
| } | |||
| static inline void put_tpel_pixels_mc01_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |||
| int i,j; | |||
| for (i=0; i < height; i++) { | |||
| @@ -1242,7 +1242,7 @@ static inline void put_tpel_pixels_mc01_c(uint8_t *dst, const uint8_t *src, int | |||
| dst += stride; | |||
| } | |||
| } | |||
| static inline void put_tpel_pixels_mc11_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |||
| int i,j; | |||
| for (i=0; i < height; i++) { | |||
| @@ -1328,7 +1328,7 @@ static inline void avg_tpel_pixels_mc20_c(uint8_t *dst, const uint8_t *src, int | |||
| dst += stride; | |||
| } | |||
| } | |||
| static inline void avg_tpel_pixels_mc01_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |||
| int i,j; | |||
| for (i=0; i < height; i++) { | |||
| @@ -1339,7 +1339,7 @@ static inline void avg_tpel_pixels_mc01_c(uint8_t *dst, const uint8_t *src, int | |||
| dst += stride; | |||
| } | |||
| } | |||
| static inline void avg_tpel_pixels_mc11_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |||
| int i,j; | |||
| for (i=0; i < height; i++) { | |||
| @@ -2496,7 +2496,7 @@ static void wmv2_mspel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int | |||
| dst[6]= cm[(9*(src[6] + src[7]) - (src[ 5] + src[8]) + 8)>>4]; | |||
| dst[7]= cm[(9*(src[7] + src[8]) - (src[ 6] + src[9]) + 8)>>4]; | |||
| dst+=dstStride; | |||
| src+=srcStride; | |||
| src+=srcStride; | |||
| } | |||
| } | |||
| @@ -2580,7 +2580,7 @@ static void put_mspel8_mc22_c(uint8_t *dst, uint8_t *src, int stride){ | |||
| static void h263_v_loop_filter_c(uint8_t *src, int stride, int qscale){ | |||
| int x; | |||
| const int strength= ff_h263_loop_filter_strength[qscale]; | |||
| for(x=0; x<8; x++){ | |||
| int d1, d2, ad1; | |||
| int p0= src[x-2*stride]; | |||
| @@ -2594,19 +2594,19 @@ static void h263_v_loop_filter_c(uint8_t *src, int stride, int qscale){ | |||
| else if(d< strength) d1= d; | |||
| else if(d< 2*strength) d1= 2*strength - d; | |||
| else d1= 0; | |||
| p1 += d1; | |||
| p2 -= d1; | |||
| if(p1&256) p1= ~(p1>>31); | |||
| if(p2&256) p2= ~(p2>>31); | |||
| src[x-1*stride] = p1; | |||
| src[x+0*stride] = p2; | |||
| ad1= ABS(d1)>>1; | |||
| d2= clip((p0-p3)/4, -ad1, ad1); | |||
| src[x-2*stride] = p0 - d2; | |||
| src[x+ stride] = p3 + d2; | |||
| } | |||
| @@ -2615,7 +2615,7 @@ static void h263_v_loop_filter_c(uint8_t *src, int stride, int qscale){ | |||
| static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale){ | |||
| int y; | |||
| const int strength= ff_h263_loop_filter_strength[qscale]; | |||
| for(y=0; y<8; y++){ | |||
| int d1, d2, ad1; | |||
| int p0= src[y*stride-2]; | |||
| @@ -2629,19 +2629,19 @@ static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale){ | |||
| else if(d< strength) d1= d; | |||
| else if(d< 2*strength) d1= 2*strength - d; | |||
| else d1= 0; | |||
| p1 += d1; | |||
| p2 -= d1; | |||
| if(p1&256) p1= ~(p1>>31); | |||
| if(p2&256) p2= ~(p2>>31); | |||
| src[y*stride-1] = p1; | |||
| src[y*stride+0] = p2; | |||
| ad1= ABS(d1)>>1; | |||
| d2= clip((p0-p3)/4, -ad1, ad1); | |||
| src[y*stride-2] = p0 - d2; | |||
| src[y*stride+1] = p3 + d2; | |||
| } | |||
| @@ -2662,7 +2662,7 @@ static void h261_loop_filter_c(uint8_t *src, int stride){ | |||
| temp[yz] = src[xy - stride] + 2*src[xy] + src[xy + stride]; | |||
| } | |||
| } | |||
| for(y=0; y<8; y++){ | |||
| src[ y*stride] = (temp[ y*8] + 2)>>2; | |||
| src[7+y*stride] = (temp[7+y*8] + 2)>>2; | |||
| @@ -2689,14 +2689,14 @@ static inline void h264_loop_filter_luma_c(uint8_t *pix, int xstride, int ystrid | |||
| const int q0 = pix[0]; | |||
| 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 ) { | |||
| int tc = tc0[i]; | |||
| int i_delta; | |||
| if( ABS( p2 - p0 ) < beta ) { | |||
| pix[-2*xstride] = p1 + clip( (( p2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - p1, -tc0[i], tc0[i] ); | |||
| tc++; | |||
| @@ -2705,7 +2705,7 @@ static inline void h264_loop_filter_luma_c(uint8_t *pix, int xstride, int ystrid | |||
| pix[ xstride] = q1 + clip( (( q2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - q1, -tc0[i], tc0[i] ); | |||
| tc++; | |||
| } | |||
| i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); | |||
| pix[-xstride] = clip_uint8( p0 + i_delta ); /* p0' */ | |||
| pix[0] = clip_uint8( q0 - i_delta ); /* q0' */ | |||
| @@ -3019,7 +3019,7 @@ static int nsse8_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){ | |||
| int score1=0; | |||
| int score2=0; | |||
| int x,y; | |||
| for(y=0; y<h; y++){ | |||
| for(x=0; x<8; x++){ | |||
| score1+= (s1[x ] - s2[x ])*(s1[x ] - s2[x ]); | |||
| @@ -3035,7 +3035,7 @@ static int nsse8_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){ | |||
| s1+= stride; | |||
| s2+= stride; | |||
| } | |||
| if(c) return score1 + ABS(score2)*c->avctx->nsse_weight; | |||
| else return score1 + ABS(score2)*8; | |||
| } | |||
| @@ -3060,7 +3060,7 @@ static void add_8x8basis_c(int16_t rem[64], int16_t basis[64], int scale){ | |||
| for(i=0; i<8*8; i++){ | |||
| rem[i] += (basis[i]*scale + (1<<(BASIS_SHIFT - RECON_SHIFT-1)))>>(BASIS_SHIFT - RECON_SHIFT); | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| @@ -3068,14 +3068,14 @@ static void add_8x8basis_c(int16_t rem[64], int16_t basis[64], int scale){ | |||
| * @param block the block which will be permuted according to the given permutation vector | |||
| * @param permutation the permutation vector | |||
| * @param last the last non zero coefficient in scantable order, used to speed the permutation up | |||
| * @param scantable the used scantable, this is only used to speed the permutation up, the block is not | |||
| * @param scantable the used scantable, this is only used to speed the permutation up, the block is not | |||
| * (inverse) permutated to scantable order! | |||
| */ | |||
| void ff_block_permute(DCTELEM *block, uint8_t *permutation, const uint8_t *scantable, int last) | |||
| { | |||
| int i; | |||
| DCTELEM temp[64]; | |||
| if(last<=0) return; | |||
| //if(permutation[1]==1) return; //FIXME its ok but not clean and might fail for some perms | |||
| @@ -3084,7 +3084,7 @@ void ff_block_permute(DCTELEM *block, uint8_t *permutation, const uint8_t *scant | |||
| temp[j]= block[j]; | |||
| block[j]=0; | |||
| } | |||
| for(i=0; i<=last; i++){ | |||
| const int j= scantable[i]; | |||
| const int perm_j= permutation[j]; | |||
| @@ -3098,9 +3098,9 @@ static int zero_cmp(void *s, uint8_t *a, uint8_t *b, int stride, int h){ | |||
| void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type){ | |||
| int i; | |||
| memset(cmp, 0, sizeof(void*)*5); | |||
| for(i=0; i<5; i++){ | |||
| switch(type&0xFF){ | |||
| case FF_CMP_SAD: | |||
| @@ -3203,7 +3203,7 @@ static void sub_hfyu_median_prediction_c(uint8_t *dst, uint8_t *src1, uint8_t *s | |||
| lt= src1[i]; | |||
| l= src2[i]; | |||
| dst[i]= l - pred; | |||
| } | |||
| } | |||
| *left= l; | |||
| *left_top= lt; | |||
| @@ -3228,7 +3228,7 @@ static int hadamard8_diff8x8_c(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t | |||
| int i; | |||
| int temp[64]; | |||
| int sum=0; | |||
| assert(h==8); | |||
| for(i=0; i<8; i++){ | |||
| @@ -3237,12 +3237,12 @@ static int hadamard8_diff8x8_c(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t | |||
| BUTTERFLY2(temp[8*i+2], temp[8*i+3], src[stride*i+2]-dst[stride*i+2],src[stride*i+3]-dst[stride*i+3]); | |||
| BUTTERFLY2(temp[8*i+4], temp[8*i+5], src[stride*i+4]-dst[stride*i+4],src[stride*i+5]-dst[stride*i+5]); | |||
| BUTTERFLY2(temp[8*i+6], temp[8*i+7], src[stride*i+6]-dst[stride*i+6],src[stride*i+7]-dst[stride*i+7]); | |||
| BUTTERFLY1(temp[8*i+0], temp[8*i+2]); | |||
| BUTTERFLY1(temp[8*i+1], temp[8*i+3]); | |||
| BUTTERFLY1(temp[8*i+4], temp[8*i+6]); | |||
| BUTTERFLY1(temp[8*i+5], temp[8*i+7]); | |||
| BUTTERFLY1(temp[8*i+0], temp[8*i+4]); | |||
| BUTTERFLY1(temp[8*i+1], temp[8*i+5]); | |||
| BUTTERFLY1(temp[8*i+2], temp[8*i+6]); | |||
| @@ -3254,13 +3254,13 @@ static int hadamard8_diff8x8_c(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t | |||
| BUTTERFLY1(temp[8*2+i], temp[8*3+i]); | |||
| BUTTERFLY1(temp[8*4+i], temp[8*5+i]); | |||
| BUTTERFLY1(temp[8*6+i], temp[8*7+i]); | |||
| BUTTERFLY1(temp[8*0+i], temp[8*2+i]); | |||
| BUTTERFLY1(temp[8*1+i], temp[8*3+i]); | |||
| BUTTERFLY1(temp[8*4+i], temp[8*6+i]); | |||
| BUTTERFLY1(temp[8*5+i], temp[8*7+i]); | |||
| sum += | |||
| sum += | |||
| BUTTERFLYA(temp[8*0+i], temp[8*4+i]) | |||
| +BUTTERFLYA(temp[8*1+i], temp[8*5+i]) | |||
| +BUTTERFLYA(temp[8*2+i], temp[8*6+i]) | |||
| @@ -3280,21 +3280,21 @@ static int hadamard8_intra8x8_c(/*MpegEncContext*/ void *s, uint8_t *src, uint8_ | |||
| int i; | |||
| int temp[64]; | |||
| int sum=0; | |||
| assert(h==8); | |||
| for(i=0; i<8; i++){ | |||
| //FIXME try pointer walks | |||
| BUTTERFLY2(temp[8*i+0], temp[8*i+1], src[stride*i+0],src[stride*i+1]); | |||
| BUTTERFLY2(temp[8*i+2], temp[8*i+3], src[stride*i+2],src[stride*i+3]); | |||
| BUTTERFLY2(temp[8*i+4], temp[8*i+5], src[stride*i+4],src[stride*i+5]); | |||
| BUTTERFLY2(temp[8*i+6], temp[8*i+7], src[stride*i+6],src[stride*i+7]); | |||
| BUTTERFLY1(temp[8*i+0], temp[8*i+2]); | |||
| BUTTERFLY1(temp[8*i+1], temp[8*i+3]); | |||
| BUTTERFLY1(temp[8*i+4], temp[8*i+6]); | |||
| BUTTERFLY1(temp[8*i+5], temp[8*i+7]); | |||
| BUTTERFLY1(temp[8*i+0], temp[8*i+4]); | |||
| BUTTERFLY1(temp[8*i+1], temp[8*i+5]); | |||
| BUTTERFLY1(temp[8*i+2], temp[8*i+6]); | |||
| @@ -3306,21 +3306,21 @@ static int hadamard8_intra8x8_c(/*MpegEncContext*/ void *s, uint8_t *src, uint8_ | |||
| BUTTERFLY1(temp[8*2+i], temp[8*3+i]); | |||
| BUTTERFLY1(temp[8*4+i], temp[8*5+i]); | |||
| BUTTERFLY1(temp[8*6+i], temp[8*7+i]); | |||
| BUTTERFLY1(temp[8*0+i], temp[8*2+i]); | |||
| BUTTERFLY1(temp[8*1+i], temp[8*3+i]); | |||
| BUTTERFLY1(temp[8*4+i], temp[8*6+i]); | |||
| BUTTERFLY1(temp[8*5+i], temp[8*7+i]); | |||
| sum += | |||
| sum += | |||
| BUTTERFLYA(temp[8*0+i], temp[8*4+i]) | |||
| +BUTTERFLYA(temp[8*1+i], temp[8*5+i]) | |||
| +BUTTERFLYA(temp[8*2+i], temp[8*6+i]) | |||
| +BUTTERFLYA(temp[8*3+i], temp[8*7+i]); | |||
| } | |||
| sum -= ABS(temp[8*0] + temp[8*4]); // -mean | |||
| return sum; | |||
| } | |||
| @@ -3329,7 +3329,7 @@ static int dct_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2 | |||
| uint64_t __align8 aligned_temp[sizeof(DCTELEM)*64/8]; | |||
| DCTELEM * const temp= (DCTELEM*)aligned_temp; | |||
| int sum=0, i; | |||
| assert(h==8); | |||
| s->dsp.diff_pixels(temp, src1, src2, stride); | |||
| @@ -3337,7 +3337,7 @@ static int dct_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2 | |||
| for(i=0; i<64; i++) | |||
| sum+= ABS(temp[i]); | |||
| return sum; | |||
| } | |||
| @@ -3346,7 +3346,7 @@ static int dct_max8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2 | |||
| uint64_t __align8 aligned_temp[sizeof(DCTELEM)*64/8]; | |||
| DCTELEM * const temp= (DCTELEM*)aligned_temp; | |||
| int sum=0, i; | |||
| assert(h==8); | |||
| s->dsp.diff_pixels(temp, src1, src2, stride); | |||
| @@ -3354,7 +3354,7 @@ static int dct_max8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2 | |||
| for(i=0; i<64; i++) | |||
| sum= FFMAX(sum, ABS(temp[i])); | |||
| return sum; | |||
| } | |||
| @@ -3369,18 +3369,18 @@ static int quant_psnr8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *s | |||
| assert(h==8); | |||
| s->mb_intra=0; | |||
| s->dsp.diff_pixels(temp, src1, src2, stride); | |||
| memcpy(bak, temp, 64*sizeof(DCTELEM)); | |||
| s->block_last_index[0/*FIXME*/]= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i); | |||
| s->dct_unquantize_inter(s, temp, 0, s->qscale); | |||
| simple_idct(temp); //FIXME | |||
| simple_idct(temp); //FIXME | |||
| for(i=0; i<64; i++) | |||
| sum+= (temp[i]-bak[i])*(temp[i]-bak[i]); | |||
| return sum; | |||
| } | |||
| @@ -3395,7 +3395,7 @@ static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int | |||
| const int esc_length= s->ac_esc_length; | |||
| uint8_t * length; | |||
| uint8_t * last_length; | |||
| assert(h==8); | |||
| for(i=0; i<8; i++){ | |||
| @@ -3408,9 +3408,9 @@ static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int | |||
| s->block_last_index[0/*FIXME*/]= last= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i); | |||
| bits=0; | |||
| if (s->mb_intra) { | |||
| start_i = 1; | |||
| start_i = 1; | |||
| length = s->intra_ac_vlc_length; | |||
| last_length= s->intra_ac_vlc_last_length; | |||
| bits+= s->luma_dc_vlc_length[temp[0] + 256]; //FIXME chroma | |||
| @@ -3419,13 +3419,13 @@ static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int | |||
| length = s->inter_ac_vlc_length; | |||
| last_length= s->inter_ac_vlc_last_length; | |||
| } | |||
| if(last>=start_i){ | |||
| run=0; | |||
| for(i=start_i; i<last; i++){ | |||
| int j= scantable[i]; | |||
| level= temp[j]; | |||
| if(level){ | |||
| level+=64; | |||
| if((level&(~127)) == 0){ | |||
| @@ -3437,16 +3437,16 @@ static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int | |||
| run++; | |||
| } | |||
| i= scantable[last]; | |||
| level= temp[i] + 64; | |||
| assert(level - 64); | |||
| if((level&(~127)) == 0){ | |||
| bits+= last_length[UNI_AC_ENC_INDEX(run, level)]; | |||
| }else | |||
| bits+= esc_length; | |||
| } | |||
| if(last>=0){ | |||
| @@ -3455,9 +3455,9 @@ static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int | |||
| else | |||
| s->dct_unquantize_inter(s, temp, 0, s->qscale); | |||
| } | |||
| s->dsp.idct_add(bak, stride, temp); | |||
| distoration= s->dsp.sse[1](NULL, bak, src1, stride, 8); | |||
| return distoration + ((bits*s->qscale*s->qscale*109 + 64)>>7); | |||
| @@ -3474,15 +3474,15 @@ static int bit8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, in | |||
| uint8_t * last_length; | |||
| assert(h==8); | |||
| s->dsp.diff_pixels(temp, src1, src2, stride); | |||
| s->block_last_index[0/*FIXME*/]= last= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i); | |||
| bits=0; | |||
| if (s->mb_intra) { | |||
| start_i = 1; | |||
| start_i = 1; | |||
| length = s->intra_ac_vlc_length; | |||
| last_length= s->intra_ac_vlc_last_length; | |||
| bits+= s->luma_dc_vlc_length[temp[0] + 256]; //FIXME chroma | |||
| @@ -3491,13 +3491,13 @@ static int bit8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, in | |||
| length = s->inter_ac_vlc_length; | |||
| last_length= s->inter_ac_vlc_last_length; | |||
| } | |||
| if(last>=start_i){ | |||
| run=0; | |||
| for(i=start_i; i<last; i++){ | |||
| int j= scantable[i]; | |||
| level= temp[j]; | |||
| if(level){ | |||
| level+=64; | |||
| if((level&(~127)) == 0){ | |||
| @@ -3509,11 +3509,11 @@ static int bit8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, in | |||
| run++; | |||
| } | |||
| i= scantable[last]; | |||
| level= temp[i] + 64; | |||
| assert(level - 64); | |||
| if((level&(~127)) == 0){ | |||
| bits+= last_length[UNI_AC_ENC_INDEX(run, level)]; | |||
| }else | |||
| @@ -3526,22 +3526,22 @@ static int bit8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, in | |||
| static int vsad_intra16_c(/*MpegEncContext*/ void *c, uint8_t *s, uint8_t *dummy, int stride, int h){ | |||
| int score=0; | |||
| int x,y; | |||
| for(y=1; y<h; y++){ | |||
| for(x=0; x<16; x+=4){ | |||
| score+= ABS(s[x ] - s[x +stride]) + ABS(s[x+1] - s[x+1+stride]) | |||
| score+= ABS(s[x ] - s[x +stride]) + ABS(s[x+1] - s[x+1+stride]) | |||
| +ABS(s[x+2] - s[x+2+stride]) + ABS(s[x+3] - s[x+3+stride]); | |||
| } | |||
| s+= stride; | |||
| } | |||
| return score; | |||
| } | |||
| static int vsad16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int stride, int h){ | |||
| int score=0; | |||
| int x,y; | |||
| for(y=1; y<h; y++){ | |||
| for(x=0; x<16; x++){ | |||
| score+= ABS(s1[x ] - s2[x ] - s1[x +stride] + s2[x +stride]); | |||
| @@ -3549,7 +3549,7 @@ static int vsad16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int st | |||
| s1+= stride; | |||
| s2+= stride; | |||
| } | |||
| return score; | |||
| } | |||
| @@ -3557,22 +3557,22 @@ static int vsad16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int st | |||
| static int vsse_intra16_c(/*MpegEncContext*/ void *c, uint8_t *s, uint8_t *dummy, int stride, int h){ | |||
| int score=0; | |||
| int x,y; | |||
| for(y=1; y<h; y++){ | |||
| for(x=0; x<16; x+=4){ | |||
| score+= SQ(s[x ] - s[x +stride]) + SQ(s[x+1] - s[x+1+stride]) | |||
| score+= SQ(s[x ] - s[x +stride]) + SQ(s[x+1] - s[x+1+stride]) | |||
| +SQ(s[x+2] - s[x+2+stride]) + SQ(s[x+3] - s[x+3+stride]); | |||
| } | |||
| s+= stride; | |||
| } | |||
| return score; | |||
| } | |||
| static int vsse16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int stride, int h){ | |||
| int score=0; | |||
| int x,y; | |||
| for(y=1; y<h; y++){ | |||
| for(x=0; x<16; x++){ | |||
| score+= SQ(s1[x ] - s2[x ] - s1[x +stride] + s2[x +stride]); | |||
| @@ -3580,7 +3580,7 @@ static int vsse16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int st | |||
| s1+= stride; | |||
| s2+= stride; | |||
| } | |||
| return score; | |||
| } | |||
| @@ -3650,11 +3650,11 @@ void dsputil_static_init(void) | |||
| cropTbl[i] = 0; | |||
| cropTbl[i + MAX_NEG_CROP + 256] = 255; | |||
| } | |||
| for(i=0;i<512;i++) { | |||
| squareTbl[i] = (i - 256) * (i - 256); | |||
| } | |||
| for(i=0; i<64; i++) inv_zigzag_direct16[ff_zigzag_direct[i]]= i+1; | |||
| } | |||
| @@ -3667,11 +3667,11 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx) | |||
| if(avctx->dct_algo==FF_DCT_FASTINT) { | |||
| c->fdct = fdct_ifast; | |||
| c->fdct248 = fdct_ifast248; | |||
| } | |||
| } | |||
| else if(avctx->dct_algo==FF_DCT_FAAN) { | |||
| c->fdct = ff_faandct; | |||
| c->fdct248 = ff_faandct248; | |||
| } | |||
| c->fdct248 = ff_faandct248; | |||
| } | |||
| else { | |||
| c->fdct = ff_jpeg_fdct_islow; //slow/accurate/default | |||
| c->fdct248 = ff_fdct248_islow; | |||
| @@ -3861,11 +3861,11 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx) | |||
| c->put_mspel_pixels_tab[5]= put_mspel8_mc12_c; | |||
| c->put_mspel_pixels_tab[6]= put_mspel8_mc22_c; | |||
| c->put_mspel_pixels_tab[7]= put_mspel8_mc32_c; | |||
| #define SET_CMP_FUNC(name) \ | |||
| c->name[0]= name ## 16_c;\ | |||
| c->name[1]= name ## 8x8_c; | |||
| SET_CMP_FUNC(hadamard8_diff) | |||
| c->hadamard8_diff[4]= hadamard8_intra16_c; | |||
| SET_CMP_FUNC(dct_sad) | |||
| @@ -3900,12 +3900,12 @@ 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->h263_h_loop_filter= h263_h_loop_filter_c; | |||
| c->h263_v_loop_filter= h263_v_loop_filter_c; | |||
| c->h261_loop_filter= h261_loop_filter_c; | |||
| c->try_8x8basis= try_8x8basis_c; | |||
| c->add_8x8basis= add_8x8basis_c; | |||
| @@ -156,7 +156,7 @@ typedef struct DSPContext { | |||
| int (*pix_sum)(uint8_t * pix, int line_size); | |||
| int (*pix_norm1)(uint8_t * pix, int line_size); | |||
| // 16x16 8x8 4x4 2x2 16x8 8x4 4x2 8x16 4x8 2x4 | |||
| me_cmp_func sad[5]; /* identical to pix_absAxA except additional void * */ | |||
| me_cmp_func sse[5]; | |||
| me_cmp_func hadamard8_diff[5]; | |||
| @@ -180,7 +180,7 @@ typedef struct DSPContext { | |||
| /** | |||
| * Halfpel motion compensation with rounding (a+b+1)>>1. | |||
| * this is an array[4][4] of motion compensation funcions for 4 | |||
| * this is an array[4][4] of motion compensation funcions for 4 | |||
| * horizontal blocksizes (8,16) and the 4 halfpel positions<br> | |||
| * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ] | |||
| * @param block destination where the result is stored | |||
| @@ -192,7 +192,7 @@ typedef struct DSPContext { | |||
| /** | |||
| * Halfpel motion compensation with rounding (a+b+1)>>1. | |||
| * This is an array[4][4] of motion compensation functions for 4 | |||
| * This is an array[4][4] of motion compensation functions for 4 | |||
| * horizontal blocksizes (8,16) and the 4 halfpel positions<br> | |||
| * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ] | |||
| * @param block destination into which the result is averaged (a+b+1)>>1 | |||
| @@ -204,7 +204,7 @@ typedef struct DSPContext { | |||
| /** | |||
| * Halfpel motion compensation with no rounding (a+b)>>1. | |||
| * this is an array[2][4] of motion compensation funcions for 2 | |||
| * this is an array[2][4] of motion compensation funcions for 2 | |||
| * horizontal blocksizes (8,16) and the 4 halfpel positions<br> | |||
| * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ] | |||
| * @param block destination where the result is stored | |||
| @@ -216,7 +216,7 @@ typedef struct DSPContext { | |||
| /** | |||
| * Halfpel motion compensation with no rounding (a+b)>>1. | |||
| * this is an array[2][4] of motion compensation funcions for 2 | |||
| * this is an array[2][4] of motion compensation funcions for 2 | |||
| * horizontal blocksizes (8,16) and the 4 halfpel positions<br> | |||
| * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ] | |||
| * @param block destination into which the result is averaged (a+b)>>1 | |||
| @@ -225,9 +225,9 @@ typedef struct DSPContext { | |||
| * @param h height | |||
| */ | |||
| op_pixels_func avg_no_rnd_pixels_tab[4][4]; | |||
| void (*put_no_rnd_pixels_l2[2])(uint8_t *block/*align width (8 or 16)*/, const uint8_t *a/*align 1*/, const uint8_t *b/*align 1*/, int line_size, int h); | |||
| /** | |||
| * Thirdpel motion compensation with rounding (a+b+1)>>1. | |||
| * this is an array[12] of motion compensation funcions for the 9 thirdpel positions<br> | |||
| @@ -245,7 +245,7 @@ typedef struct DSPContext { | |||
| qpel_mc_func put_no_rnd_qpel_pixels_tab[2][16]; | |||
| qpel_mc_func avg_no_rnd_qpel_pixels_tab[2][16]; | |||
| qpel_mc_func put_mspel_pixels_tab[8]; | |||
| /** | |||
| * h264 Chram MC | |||
| */ | |||
| @@ -254,12 +254,12 @@ typedef struct DSPContext { | |||
| qpel_mc_func put_h264_qpel_pixels_tab[3][16]; | |||
| qpel_mc_func avg_h264_qpel_pixels_tab[3][16]; | |||
| h264_weight_func weight_h264_pixels_tab[10]; | |||
| h264_biweight_func biweight_h264_pixels_tab[10]; | |||
| me_cmp_func pix_abs[2][4]; | |||
| /* huffyuv specific */ | |||
| void (*add_bytes)(uint8_t *dst/*align 16*/, uint8_t *src/*align 16*/, int w); | |||
| void (*diff_bytes)(uint8_t *dst/*align 16*/, uint8_t *src1/*align 16*/, uint8_t *src2/*align 1*/,int w); | |||
| @@ -276,7 +276,7 @@ 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); | |||
| void (*h263_v_loop_filter)(uint8_t *src, int stride, int qscale); | |||
| void (*h263_h_loop_filter)(uint8_t *src, int stride, int qscale); | |||
| @@ -285,23 +285,23 @@ typedef struct DSPContext { | |||
| /* (I)DCT */ | |||
| void (*fdct)(DCTELEM *block/* align 16*/); | |||
| void (*fdct248)(DCTELEM *block/* align 16*/); | |||
| /* IDCT really*/ | |||
| void (*idct)(DCTELEM *block/* align 16*/); | |||
| /** | |||
| * block -> idct -> clip to unsigned 8 bit -> dest. | |||
| * (-1392, 0, 0, ...) -> idct -> (-174, -174, ...) -> put -> (0, 0, ...) | |||
| * @param line_size size in bytes of a horizotal line of dest | |||
| */ | |||
| void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/); | |||
| /** | |||
| * block -> idct -> add dest -> clip to unsigned 8 bit -> dest. | |||
| * @param line_size size in bytes of a horizotal line of dest | |||
| */ | |||
| void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/); | |||
| /** | |||
| * idct input permutation. | |||
| * several optimized IDCTs need a permutated input (relative to the normal order of the reference | |||
| @@ -326,7 +326,7 @@ typedef struct DSPContext { | |||
| void (*add_8x8basis)(int16_t rem[64], int16_t basis[64], int scale); | |||
| #define BASIS_SHIFT 16 | |||
| #define RECON_SHIFT 6 | |||
| void (*h264_idct_add)(uint8_t *dst, DCTELEM *block, int stride); | |||
| void (*h264_idct8_add)(uint8_t *dst, DCTELEM *block, int stride); | |||
| } DSPContext; | |||
| @@ -8,12 +8,12 @@ | |||
| * 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 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 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., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| @@ -309,7 +309,7 @@ dts_decode_end (AVCodecContext *s) | |||
| } | |||
| AVCodec dts_decoder = { | |||
| "dts", | |||
| "dts", | |||
| CODEC_TYPE_AUDIO, | |||
| CODEC_ID_DTS, | |||
| sizeof (dts_state_t *), | |||
| @@ -3,7 +3,7 @@ | |||
| * Copyright (c) 2002 Fabrice Bellard. | |||
| * Copyright (c) 2004 Roman Shaposhnik. | |||
| * | |||
| * DV encoder | |||
| * DV encoder | |||
| * Copyright (c) 2003 Roman Shaposhnik. | |||
| * | |||
| * Many thanks to Dan Dennedy <dan@dennedy.org> for providing wealth | |||
| @@ -42,10 +42,10 @@ typedef struct DVVideoContext { | |||
| AVFrame picture; | |||
| AVCodecContext *avctx; | |||
| uint8_t *buf; | |||
| uint8_t dv_zigzag[2][64]; | |||
| uint8_t dv_idct_shift[2][2][22][64]; | |||
| void (*get_pixels)(DCTELEM *block, const uint8_t *pixels, int line_size); | |||
| void (*fdct[2])(DCTELEM *block); | |||
| void (*idct_put[2])(uint8_t *dest, int line_size, DCTELEM *block); | |||
| @@ -57,7 +57,7 @@ typedef struct DVVideoContext { | |||
| #define DV_VLC_MAP_RUN_SIZE 15 | |||
| #define DV_VLC_MAP_LEV_SIZE 23 | |||
| #else | |||
| #define DV_VLC_MAP_RUN_SIZE 64 | |||
| #define DV_VLC_MAP_RUN_SIZE 64 | |||
| #define DV_VLC_MAP_LEV_SIZE 512 //FIXME sign was removed so this should be /2 but needs check | |||
| #endif | |||
| @@ -86,11 +86,11 @@ static void dv_build_unquantize_tables(DVVideoContext *s, uint8_t* perm) | |||
| dv_quant_shifts[q][dv_88_areas[i]] + 1; | |||
| s->dv_idct_shift[1][0][q][j] = s->dv_idct_shift[0][0][q][j] + 1; | |||
| } | |||
| /* 248DCT */ | |||
| for(i = 1; i < 64; i++) { | |||
| /* 248 table */ | |||
| s->dv_idct_shift[0][1][q][i] = | |||
| s->dv_idct_shift[0][1][q][i] = | |||
| dv_quant_shifts[q][dv_248_areas[i]] + 1; | |||
| s->dv_idct_shift[1][1][q][i] = s->dv_idct_shift[0][1][q][i] + 1; | |||
| } | |||
| @@ -131,7 +131,7 @@ static int dvvideo_init(AVCodecContext *avctx) | |||
| new_dv_vlc_len[j] = dv_vlc_len[i]; | |||
| new_dv_vlc_run[j] = dv_vlc_run[i]; | |||
| new_dv_vlc_level[j] = dv_vlc_level[i]; | |||
| if (dv_vlc_level[i]) { | |||
| new_dv_vlc_bits[j] <<= 1; | |||
| new_dv_vlc_len[j]++; | |||
| @@ -143,10 +143,10 @@ static int dvvideo_init(AVCodecContext *avctx) | |||
| new_dv_vlc_level[j] = -dv_vlc_level[i]; | |||
| } | |||
| } | |||
| /* NOTE: as a trick, we use the fact the no codes are unused | |||
| to accelerate the parsing of partial codes */ | |||
| init_vlc(&dv_vlc, TEX_VLC_BITS, j, | |||
| init_vlc(&dv_vlc, TEX_VLC_BITS, j, | |||
| new_dv_vlc_len, 1, 1, new_dv_vlc_bits, 2, 2, 0); | |||
| dv_rl_vlc = av_malloc(dv_vlc.table_size * sizeof(RL_VLC_ELEM)); | |||
| @@ -158,7 +158,7 @@ static int dvvideo_init(AVCodecContext *avctx) | |||
| int code= dv_vlc.table[i][0]; | |||
| int len = dv_vlc.table[i][1]; | |||
| int level, run; | |||
| if(len<0){ //more bits needed | |||
| run= 0; | |||
| level= code; | |||
| @@ -179,13 +179,13 @@ static int dvvideo_init(AVCodecContext *avctx) | |||
| if (dv_vlc_level[i] >= DV_VLC_MAP_LEV_SIZE) | |||
| continue; | |||
| #endif | |||
| if (dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].size != 0) | |||
| continue; | |||
| dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].vlc = dv_vlc_bits[i] << | |||
| dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].vlc = dv_vlc_bits[i] << | |||
| (!!dv_vlc_level[i]); | |||
| dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].size = dv_vlc_len[i] + | |||
| dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].size = dv_vlc_len[i] + | |||
| (!!dv_vlc_level[i]); | |||
| } | |||
| for (i = 0; i < DV_VLC_MAP_RUN_SIZE; i++) { | |||
| @@ -194,7 +194,7 @@ static int dvvideo_init(AVCodecContext *avctx) | |||
| if (dv_vlc_map[i][j].size == 0) { | |||
| dv_vlc_map[i][j].vlc = dv_vlc_map[0][j].vlc | | |||
| (dv_vlc_map[i-1][0].vlc << (dv_vlc_map[0][j].size)); | |||
| dv_vlc_map[i][j].size = dv_vlc_map[i-1][0].size + | |||
| dv_vlc_map[i][j].size = dv_vlc_map[i-1][0].size + | |||
| dv_vlc_map[0][j].size; | |||
| } | |||
| } | |||
| @@ -203,12 +203,12 @@ static int dvvideo_init(AVCodecContext *avctx) | |||
| if (dv_vlc_map[i][j].size == 0) { | |||
| dv_vlc_map[i][j].vlc = dv_vlc_map[0][j].vlc | | |||
| (dv_vlc_map[i-1][0].vlc << (dv_vlc_map[0][j].size)); | |||
| dv_vlc_map[i][j].size = dv_vlc_map[i-1][0].size + | |||
| dv_vlc_map[i][j].size = dv_vlc_map[i-1][0].size + | |||
| dv_vlc_map[0][j].size; | |||
| } | |||
| dv_vlc_map[i][((uint16_t)(-j))&0x1ff].vlc = | |||
| dv_vlc_map[i][((uint16_t)(-j))&0x1ff].vlc = | |||
| dv_vlc_map[i][j].vlc | 1; | |||
| dv_vlc_map[i][((uint16_t)(-j))&0x1ff].size = | |||
| dv_vlc_map[i][((uint16_t)(-j))&0x1ff].size = | |||
| dv_vlc_map[i][j].size; | |||
| } | |||
| #endif | |||
| @@ -241,10 +241,10 @@ static int dvvideo_init(AVCodecContext *avctx) | |||
| /* FIXME: I really don't think this should be here */ | |||
| if (dv_codec_profile(avctx)) | |||
| avctx->pix_fmt = dv_codec_profile(avctx)->pix_fmt; | |||
| avctx->pix_fmt = dv_codec_profile(avctx)->pix_fmt; | |||
| avctx->coded_frame = &s->picture; | |||
| s->avctx= avctx; | |||
| return 0; | |||
| } | |||
| @@ -268,7 +268,7 @@ static const uint16_t block_sizes[6] = { | |||
| /* bit budget for AC only in 5 MBs */ | |||
| 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 }; | |||
| static const int mb_area_start[5] = { 1, 6, 21, 43, 64 }; | |||
| #ifndef ALT_BITSTREAM_READER | |||
| #warning only works with ALT_BITSTREAM_READER | |||
| @@ -299,10 +299,10 @@ static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block) | |||
| int pos = mb->pos; | |||
| int partial_bit_count = mb->partial_bit_count; | |||
| int level, pos1, run, vlc_len, index; | |||
| OPEN_READER(re, gb); | |||
| UPDATE_CACHE(re, gb); | |||
| /* if we must parse a partial vlc, we do it here */ | |||
| if (partial_bit_count > 0) { | |||
| re_cache = ((unsigned)re_cache >> partial_bit_count) | | |||
| @@ -325,7 +325,7 @@ static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block) | |||
| } | |||
| level = dv_rl_vlc[index].level; | |||
| run = dv_rl_vlc[index].run; | |||
| /* gotta check if we're still within gb boundaries */ | |||
| if (re_index + vlc_len > last_index) { | |||
| /* should be < 16 bits otherwise a codeword could have been parsed */ | |||
| @@ -339,10 +339,10 @@ static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block) | |||
| #ifdef VLC_DEBUG | |||
| printf("run=%d level=%d\n", run, level); | |||
| #endif | |||
| pos += run; | |||
| pos += run; | |||
| if (pos >= 64) | |||
| break; | |||
| assert(level); | |||
| pos1 = scan_table[pos]; | |||
| block[pos1] = level << shift_table[pos1]; | |||
| @@ -366,8 +366,8 @@ static inline void bit_copy(PutBitContext *pb, GetBitContext *gb) | |||
| } | |||
| /* mb_x and mb_y are in units of 8 pixels */ | |||
| static inline void dv_decode_video_segment(DVVideoContext *s, | |||
| uint8_t *buf_ptr1, | |||
| static inline void dv_decode_video_segment(DVVideoContext *s, | |||
| uint8_t *buf_ptr1, | |||
| const uint16_t *mb_pos_ptr) | |||
| { | |||
| int quant, dc, dct_mode, class1, j; | |||
| @@ -384,10 +384,10 @@ static inline void dv_decode_video_segment(DVVideoContext *s, | |||
| uint8_t mb_bit_buffer[80 + 4] __align8; /* allow some slack */ | |||
| uint8_t vs_bit_buffer[5 * 80 + 4] __align8; /* allow some slack */ | |||
| const int log2_blocksize= 3-s->avctx->lowres; | |||
| assert((((int)mb_bit_buffer)&7)==0); | |||
| assert((((int)vs_bit_buffer)&7)==0); | |||
| memset(sblock, 0, sizeof(sblock)); | |||
| /* pass 1 : read DC and AC coefficients in blocks */ | |||
| @@ -405,7 +405,7 @@ static inline void dv_decode_video_segment(DVVideoContext *s, | |||
| for(j = 0;j < 6; j++) { | |||
| last_index = block_sizes[j]; | |||
| init_get_bits(&gb, buf_ptr, last_index); | |||
| /* get the dc */ | |||
| dc = get_sbits(&gb, 9); | |||
| dct_mode = get_bits1(&gb); | |||
| @@ -432,11 +432,11 @@ static inline void dv_decode_video_segment(DVVideoContext *s, | |||
| block is finished */ | |||
| if (mb->pos >= 64) | |||
| bit_copy(&pb, &gb); | |||
| block += 64; | |||
| mb++; | |||
| } | |||
| /* pass 2 : we can do it just after */ | |||
| #ifdef VLC_DEBUG | |||
| printf("***pass 2 size=%d MB#=%d\n", put_bits_count(&pb), mb_index); | |||
| @@ -481,7 +481,7 @@ static inline void dv_decode_video_segment(DVVideoContext *s, | |||
| mb++; | |||
| } | |||
| } | |||
| /* compute idct and place blocks */ | |||
| block = &sblock[0][0]; | |||
| mb = mb_data; | |||
| @@ -526,7 +526,7 @@ static inline void dv_decode_video_segment(DVVideoContext *s, | |||
| } | |||
| } else { | |||
| /* don't ask me why they inverted Cb and Cr ! */ | |||
| idct_put(s->picture.data[6 - j] + c_offset, | |||
| idct_put(s->picture.data[6 - j] + c_offset, | |||
| s->picture.linesize[6 - j], block); | |||
| } | |||
| } | |||
| @@ -545,7 +545,7 @@ static always_inline int dv_rl2vlc(int run, int level, int sign, uint32_t* vlc) | |||
| *vlc = dv_vlc_map[run][level].vlc | sign; | |||
| size = dv_vlc_map[run][level].size; | |||
| } | |||
| else { | |||
| else { | |||
| if (level < DV_VLC_MAP_LEV_SIZE) { | |||
| *vlc = dv_vlc_map[0][level].vlc | sign; | |||
| size = dv_vlc_map[0][level].size; | |||
| @@ -554,23 +554,23 @@ static always_inline int dv_rl2vlc(int run, int level, int sign, uint32_t* vlc) | |||
| size = 16; | |||
| } | |||
| if (run) { | |||
| *vlc |= ((run < 16) ? dv_vlc_map[run-1][0].vlc : | |||
| *vlc |= ((run < 16) ? dv_vlc_map[run-1][0].vlc : | |||
| (0x1f80 | (run - 1))) << size; | |||
| size += (run < 16) ? dv_vlc_map[run-1][0].size : 13; | |||
| } | |||
| } | |||
| return size; | |||
| } | |||
| static always_inline int dv_rl2vlc_size(int run, int level) | |||
| { | |||
| int size; | |||
| if (run < DV_VLC_MAP_RUN_SIZE && level < DV_VLC_MAP_LEV_SIZE) { | |||
| size = dv_vlc_map[run][level].size; | |||
| size = dv_vlc_map[run][level].size; | |||
| } | |||
| else { | |||
| else { | |||
| size = (level < DV_VLC_MAP_LEV_SIZE) ? dv_vlc_map[0][level].size : 16; | |||
| if (run) { | |||
| size += (run < 16) ? dv_vlc_map[run-1][0].size : 13; | |||
| @@ -605,7 +605,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 always_inline PutBitContext* dv_encode_ac(EncBlockInfo* bi, PutBitContext* pb_pool, | |||
| PutBitContext* pb_end) | |||
| { | |||
| int prev; | |||
| @@ -629,13 +629,13 @@ static always_inline PutBitContext* dv_encode_ac(EncBlockInfo* bi, PutBitContext | |||
| return pb; | |||
| } | |||
| } | |||
| /* Store VLC */ | |||
| put_bits(pb, size, vlc); | |||
| if(bi->cur_ac>=64) | |||
| break; | |||
| /* Construct the next VLC */ | |||
| prev= bi->cur_ac; | |||
| bi->cur_ac = bi->next[prev]; | |||
| @@ -648,7 +648,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 always_inline void dv_set_class_number(DCTELEM* blk, EncBlockInfo* bi, | |||
| const uint8_t* zigzag_scan, int bias) | |||
| { | |||
| int i, area; | |||
| @@ -656,14 +656,14 @@ static always_inline void dv_set_class_number(DCTELEM* blk, EncBlockInfo* bi, | |||
| int max=12; | |||
| int prev=0; | |||
| bi->mb[0] = blk[0]; | |||
| bi->mb[0] = blk[0]; | |||
| for (area = 0; area < 4; area++) { | |||
| bi->prev[area] = prev; | |||
| bi->bit_size[area] = 1; // 4 areas 4 bits for EOB :) | |||
| for (i=mb_area_start[area]; i<mb_area_start[area+1]; i++) { | |||
| int level = blk[zigzag_scan[i]]; | |||
| if (level+15 > 30U) { | |||
| bi->sign[i] = (level>>31)&1; | |||
| bi->mb[i] = level= ABS(level)>>4; | |||
| @@ -678,7 +678,7 @@ static always_inline void dv_set_class_number(DCTELEM* blk, EncBlockInfo* bi, | |||
| for(bi->cno = 0; max > classes[bi->cno]; bi->cno++); | |||
| bi->cno += bias; | |||
| if (bi->cno >= 3) { | |||
| bi->cno = 3; | |||
| prev=0; | |||
| @@ -688,7 +688,7 @@ static always_inline void dv_set_class_number(DCTELEM* blk, EncBlockInfo* bi, | |||
| bi->bit_size[area] = 1; // 4 areas 4 bits for EOB :) | |||
| for (; i<mb_area_start[area+1]; i= bi->next[i]) { | |||
| bi->mb[i] >>=1; | |||
| if (bi->mb[i]) { | |||
| bi->bit_size[area] += dv_rl2vlc_size(i - prev - 1, bi->mb[i]); | |||
| bi->next[prev]= i; | |||
| @@ -707,11 +707,11 @@ static always_inline int dv_guess_dct_mode(DCTELEM *blk) { | |||
| int score88 = 0; | |||
| int score248 = 0; | |||
| int i; | |||
| /* Compute 8-8 score (small values give a better chance for 8-8 DCT) */ | |||
| s = blk; | |||
| for(i=0; i<7; i++) { | |||
| score88 += SC(0, 8) + SC(1, 9) + SC(2, 10) + SC(3, 11) + | |||
| score88 += SC(0, 8) + SC(1, 9) + SC(2, 10) + SC(3, 11) + | |||
| SC(4, 12) + SC(5,13) + SC(6, 14) + SC(7, 15); | |||
| s += 8; | |||
| } | |||
| @@ -737,7 +737,7 @@ static inline void dv_guess_qnos(EncBlockInfo* blks, int* qnos) | |||
| for (i=0; i<5; i++) { | |||
| if (!qnos[i]) | |||
| continue; | |||
| qnos[i]--; | |||
| size[i] = 0; | |||
| for (j=0; j<6; j++, b++) { | |||
| @@ -761,21 +761,21 @@ static inline void dv_guess_qnos(EncBlockInfo* blks, int* qnos) | |||
| } | |||
| } | |||
| } | |||
| } while ((vs_total_ac_bits < size[0] + size[1] + size[2] + size[3] + size[4]) && | |||
| } while ((vs_total_ac_bits < size[0] + size[1] + size[2] + size[3] + size[4]) && | |||
| (qnos[0]|qnos[1]|qnos[2]|qnos[3]|qnos[4])); | |||
| } | |||
| /* | |||
| * This is a very rough initial implementaion. The performance is | |||
| * horrible and the weighting is missing. But it's missing from the | |||
| * horrible and the weighting is missing. But it's missing from the | |||
| * decoding step also -- so at least we're on the same page with decoder ;-) | |||
| */ | |||
| static inline void dv_encode_video_segment(DVVideoContext *s, | |||
| uint8_t *dif, | |||
| static inline void dv_encode_video_segment(DVVideoContext *s, | |||
| uint8_t *dif, | |||
| const uint16_t *mb_pos_ptr) | |||
| { | |||
| int mb_index, i, j, v; | |||
| int mb_x, mb_y, c_offset, linesize; | |||
| int mb_x, mb_y, c_offset, linesize; | |||
| uint8_t* y_ptr; | |||
| uint8_t* data; | |||
| uint8_t* ptr; | |||
| @@ -783,13 +783,13 @@ static inline void dv_encode_video_segment(DVVideoContext *s, | |||
| DCTELEM block[64] __align8; | |||
| EncBlockInfo enc_blks[5*6]; | |||
| PutBitContext pbs[5*6]; | |||
| PutBitContext* pb; | |||
| PutBitContext* pb; | |||
| EncBlockInfo* enc_blk; | |||
| int vs_bit_size = 0; | |||
| int qnos[5]; | |||
| assert((((int)block) & 7) == 0); | |||
| enc_blk = &enc_blks[0]; | |||
| pb = &pbs[0]; | |||
| for(mb_index = 0; mb_index < 5; mb_index++) { | |||
| @@ -818,8 +818,8 @@ static inline void dv_encode_video_segment(DVVideoContext *s, | |||
| linesize = s->picture.linesize[6 - j]; | |||
| if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) | |||
| do_edge_wrap = 1; | |||
| } | |||
| } | |||
| /* Everything is set up -- now just copy data -> DCT block */ | |||
| if (do_edge_wrap) { /* Edge wrap copy: 4x16 -> 8x8 */ | |||
| uint8_t* d; | |||
| @@ -834,7 +834,7 @@ static inline void dv_encode_video_segment(DVVideoContext *s, | |||
| } else { /* Simple copy: 8x8 -> 8x8 */ | |||
| s->get_pixels(block, data, linesize); | |||
| } | |||
| if(s->avctx->flags & CODEC_FLAG_INTERLACED_DCT) | |||
| enc_blk->dct_mode = dv_guess_dct_mode(block); | |||
| else | |||
| @@ -843,17 +843,17 @@ static inline void dv_encode_video_segment(DVVideoContext *s, | |||
| enc_blk->partial_bit_count = 0; | |||
| enc_blk->partial_bit_buffer = 0; | |||
| enc_blk->cur_ac = 0; | |||
| s->fdct[enc_blk->dct_mode](block); | |||
| dv_set_class_number(block, enc_blk, | |||
| dv_set_class_number(block, enc_blk, | |||
| enc_blk->dct_mode ? ff_zigzag248_direct : ff_zigzag_direct, j/4); | |||
| init_put_bits(pb, ptr, block_sizes[j]/8); | |||
| put_bits(pb, 9, (uint16_t)(((enc_blk->mb[0] >> 3) - 1024 + 2) >> 2)); | |||
| put_bits(pb, 1, enc_blk->dct_mode); | |||
| put_bits(pb, 2, enc_blk->cno); | |||
| vs_bit_size += enc_blk->bit_size[0] + enc_blk->bit_size[1] + | |||
| enc_blk->bit_size[2] + enc_blk->bit_size[3]; | |||
| ++enc_blk; | |||
| @@ -913,19 +913,19 @@ static int dv_encode_mt(AVCodecContext *avctx, void* sl) | |||
| /* NOTE: exactly one frame must be given (120000 bytes for NTSC, | |||
| 144000 bytes for PAL) */ | |||
| static int dvvideo_decode_frame(AVCodecContext *avctx, | |||
| static int dvvideo_decode_frame(AVCodecContext *avctx, | |||
| void *data, int *data_size, | |||
| uint8_t *buf, int buf_size) | |||
| { | |||
| DVVideoContext *s = avctx->priv_data; | |||
| s->sys = dv_frame_profile(buf); | |||
| if (!s->sys || buf_size < s->sys->frame_size) | |||
| return -1; /* NOTE: we only accept several full frames */ | |||
| if(s->picture.data[0]) | |||
| avctx->release_buffer(avctx, &s->picture); | |||
| s->picture.reference = 0; | |||
| s->picture.key_frame = 1; | |||
| s->picture.pict_type = FF_I_TYPE; | |||
| @@ -939,19 +939,19 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, | |||
| s->picture.top_field_first = 0; | |||
| s->buf = buf; | |||
| avctx->execute(avctx, dv_decode_mt, (void**)&dv_anchor[0], NULL, | |||
| avctx->execute(avctx, dv_decode_mt, (void**)&dv_anchor[0], NULL, | |||
| s->sys->difseg_size * 27); | |||
| emms_c(); | |||
| /* return image */ | |||
| *data_size = sizeof(AVFrame); | |||
| *(AVFrame*)data= s->picture; | |||
| return s->sys->frame_size; | |||
| } | |||
| static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size, | |||
| static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size, | |||
| void *data) | |||
| { | |||
| DVVideoContext *s = c->priv_data; | |||
| @@ -968,7 +968,7 @@ static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size, | |||
| s->picture.pict_type = FF_I_TYPE; | |||
| s->buf = buf; | |||
| c->execute(c, dv_encode_mt, (void**)&dv_anchor[0], NULL, | |||
| c->execute(c, dv_encode_mt, (void**)&dv_anchor[0], NULL, | |||
| s->sys->difseg_size * 27); | |||
| emms_c(); | |||
| @@ -44,12 +44,12 @@ static void dvb_encode_rle2(uint8_t **pq, | |||
| int x, y, len, x1, v, color; | |||
| q = *pq; | |||
| for(y = 0; y < h; y++) { | |||
| *q++ = 0x10; | |||
| bitbuf = 0; | |||
| bitcnt = 6; | |||
| x = 0; | |||
| while (x < w) { | |||
| x1 = x; | |||
| @@ -132,12 +132,12 @@ static void dvb_encode_rle4(uint8_t **pq, | |||
| int x, y, len, x1, v, color; | |||
| q = *pq; | |||
| for(y = 0; y < h; y++) { | |||
| *q++ = 0x11; | |||
| bitbuf = 0; | |||
| bitcnt = 4; | |||
| x = 0; | |||
| while (x < w) { | |||
| x1 = x; | |||
| @@ -215,7 +215,7 @@ static inline void putbe16(uint8_t **pq, uint16_t v) | |||
| *pq = q; | |||
| } | |||
| static int encode_dvb_subtitles(DVBSubtitleContext *s, | |||
| static int encode_dvb_subtitles(DVBSubtitleContext *s, | |||
| uint8_t *outbuf, AVSubtitle *h) | |||
| { | |||
| uint8_t *q, *pseg_len; | |||
| @@ -244,7 +244,7 @@ static int encode_dvb_subtitles(DVBSubtitleContext *s, | |||
| else | |||
| page_state = 2; /* mode change */ | |||
| /* page_version = 0 + page_state */ | |||
| *q++ = s->object_version | (page_state << 2) | 3; | |||
| *q++ = s->object_version | (page_state << 2) | 3; | |||
| for (region_id = 0; region_id < h->num_rects; region_id++) { | |||
| *q++ = region_id; | |||
| @@ -302,7 +302,7 @@ static int encode_dvb_subtitles(DVBSubtitleContext *s, | |||
| for (region_id = 0; region_id < h->num_rects; region_id++) { | |||
| /* region composition segment */ | |||
| if (h->rects[region_id].nb_colors <= 4) { | |||
| /* 2 bpp, some decoders do not support it correctly */ | |||
| bpp_index = 0; | |||
| @@ -339,7 +339,7 @@ static int encode_dvb_subtitles(DVBSubtitleContext *s, | |||
| } | |||
| if (!s->hide_state) { | |||
| for (object_id = 0; object_id < h->num_rects; object_id++) { | |||
| /* Object Data segment */ | |||
| @@ -22,8 +22,8 @@ | |||
| * Constants for DV codec. | |||
| */ | |||
| /* | |||
| * DVprofile is used to express the differences between various | |||
| /* | |||
| * DVprofile is used to express the differences between various | |||
| * DV flavors. For now it's primarily used for differentiating | |||
| * 525/60 and 625/50, but the plans are to use it for various | |||
| * DV specs as well (e.g. SMPTE314M vs. IEC 61834). | |||
| @@ -32,7 +32,7 @@ typedef struct DVprofile { | |||
| int dsf; /* value of the dsf in the DV header */ | |||
| int frame_size; /* total size of one frame in bytes */ | |||
| int difseg_size; /* number of DIF segments */ | |||
| int frame_rate; | |||
| int frame_rate; | |||
| int frame_rate_base; | |||
| int ltc_divisor; /* FPS from the LTS standpoint */ | |||
| int height; /* picture height in pixels */ | |||
| @@ -40,7 +40,7 @@ typedef struct DVprofile { | |||
| AVRational sar[2]; /* sample aspect ratios for 4:3 and 16:9 */ | |||
| const uint16_t *video_place; /* positions of all DV macro blocks */ | |||
| enum PixelFormat pix_fmt; /* picture pixel format */ | |||
| int audio_stride; /* size of audio_shuffle table */ | |||
| int audio_min_samples[3];/* min ammount of audio samples */ | |||
| /* for 48Khz, 44.1Khz and 32Khz */ | |||
| @@ -51,10 +51,10 @@ typedef struct DVprofile { | |||
| #define NB_DV_VLC 409 | |||
| /* | |||
| /* | |||
| * There's a catch about the following three tables: the mapping they establish | |||
| * between (run, level) and vlc is not 1-1. So you have to watch out for that | |||
| * when building misc. tables. E.g. (1, 0) can be either 0x7cf or 0x1f82. | |||
| * when building misc. tables. E.g. (1, 0) can be either 0x7cf or 0x1f82. | |||
| */ | |||
| static const uint16_t dv_vlc_bits[409] = { | |||
| 0x0000, 0x0002, 0x0007, 0x0008, 0x0009, 0x0014, 0x0015, 0x0016, | |||
| @@ -300,27 +300,27 @@ static const uint8_t dv_248_areas[64] = { | |||
| }; | |||
| static const uint8_t dv_quant_shifts[22][4] = { | |||
| { 3,3,4,4 }, | |||
| { 3,3,4,4 }, | |||
| { 2,3,3,4 }, | |||
| { 3,3,4,4 }, | |||
| { 3,3,4,4 }, | |||
| { 2,3,3,4 }, | |||
| { 2,2,3,3 }, | |||
| { 2,2,3,3 }, | |||
| { 1,2,2,3 }, | |||
| { 1,2,2,3 }, | |||
| { 1,1,2,2 }, | |||
| { 1,1,2,2 }, | |||
| { 0,1,1,2 }, | |||
| { 0,1,1,2 }, | |||
| { 0,0,1,1 }, | |||
| { 2,3,3,4 }, | |||
| { 2,2,3,3 }, | |||
| { 2,2,3,3 }, | |||
| { 1,2,2,3 }, | |||
| { 1,2,2,3 }, | |||
| { 1,1,2,2 }, | |||
| { 1,1,2,2 }, | |||
| { 0,1,1,2 }, | |||
| { 0,1,1,2 }, | |||
| { 0,0,1,1 }, | |||
| { 0,0,1,1 }, | |||
| { 0,0,0,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,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 }, | |||
| }; | |||
| @@ -657,329 +657,329 @@ static const uint16_t dv_place_420[1620] = { | |||
| }; | |||
| static const uint16_t dv_place_411P[1620] = { | |||
| 0x0c24, 0x2710, 0x3334, 0x0000, 0x1848, | |||
| 0x0d24, 0x2810, 0x3434, 0x0100, 0x1948, | |||
| 0x0e24, 0x2910, 0x3534, 0x0200, 0x1a48, | |||
| 0x0f24, 0x2914, 0x3538, 0x0300, 0x1b48, | |||
| 0x1024, 0x2814, 0x3438, 0x0400, 0x1c48, | |||
| 0x1124, 0x2714, 0x3338, 0x0500, 0x1d48, | |||
| 0x1128, 0x2614, 0x3238, 0x0504, 0x1d4c, | |||
| 0x1028, 0x2514, 0x3138, 0x0404, 0x1c4c, | |||
| 0x0f28, 0x2414, 0x3038, 0x0304, 0x1b4c, | |||
| 0x0e28, 0x2418, 0x303c, 0x0204, 0x1a4c, | |||
| 0x0d28, 0x2518, 0x313c, 0x0104, 0x194c, | |||
| 0x0c28, 0x2618, 0x323c, 0x0004, 0x184c, | |||
| 0x0c2c, 0x2718, 0x333c, 0x0008, 0x1850, | |||
| 0x0d2c, 0x2818, 0x343c, 0x0108, 0x1950, | |||
| 0x0e2c, 0x2918, 0x353c, 0x0208, 0x1a50, | |||
| 0x0f2c, 0x291c, 0x3540, 0x0308, 0x1b50, | |||
| 0x102c, 0x281c, 0x3440, 0x0408, 0x1c50, | |||
| 0x112c, 0x271c, 0x3340, 0x0508, 0x1d50, | |||
| 0x1130, 0x261c, 0x3240, 0x050c, 0x1d54, | |||
| 0x1030, 0x251c, 0x3140, 0x040c, 0x1c54, | |||
| 0x0f30, 0x241c, 0x3040, 0x030c, 0x1b54, | |||
| 0x0e30, 0x2420, 0x3044, 0x020c, 0x1a54, | |||
| 0x0d30, 0x2520, 0x3144, 0x010c, 0x1954, | |||
| 0x0c30, 0x2620, 0x3244, 0x000c, 0x1854, | |||
| 0x0c34, 0x2720, 0x3344, 0x0010, 0x1858, | |||
| 0x0d34, 0x2820, 0x3444, 0x0110, 0x1a58, | |||
| 0x0e34, 0x2920, 0x3544, 0x0210, 0x1c58, | |||
| 0x1224, 0x2d10, 0x3934, 0x0600, 0x1e48, | |||
| 0x1324, 0x2e10, 0x3a34, 0x0700, 0x1f48, | |||
| 0x1424, 0x2f10, 0x3b34, 0x0800, 0x2048, | |||
| 0x1524, 0x2f14, 0x3b38, 0x0900, 0x2148, | |||
| 0x1624, 0x2e14, 0x3a38, 0x0a00, 0x2248, | |||
| 0x1724, 0x2d14, 0x3938, 0x0b00, 0x2348, | |||
| 0x1728, 0x2c14, 0x3838, 0x0b04, 0x234c, | |||
| 0x1628, 0x2b14, 0x3738, 0x0a04, 0x224c, | |||
| 0x1528, 0x2a14, 0x3638, 0x0904, 0x214c, | |||
| 0x1428, 0x2a18, 0x363c, 0x0804, 0x204c, | |||
| 0x1328, 0x2b18, 0x373c, 0x0704, 0x1f4c, | |||
| 0x1228, 0x2c18, 0x383c, 0x0604, 0x1e4c, | |||
| 0x122c, 0x2d18, 0x393c, 0x0608, 0x1e50, | |||
| 0x132c, 0x2e18, 0x3a3c, 0x0708, 0x1f50, | |||
| 0x142c, 0x2f18, 0x3b3c, 0x0808, 0x2050, | |||
| 0x152c, 0x2f1c, 0x3b40, 0x0908, 0x2150, | |||
| 0x162c, 0x2e1c, 0x3a40, 0x0a08, 0x2250, | |||
| 0x172c, 0x2d1c, 0x3940, 0x0b08, 0x2350, | |||
| 0x1730, 0x2c1c, 0x3840, 0x0b0c, 0x2354, | |||
| 0x1630, 0x2b1c, 0x3740, 0x0a0c, 0x2254, | |||
| 0x1530, 0x2a1c, 0x3640, 0x090c, 0x2154, | |||
| 0x1430, 0x2a20, 0x3644, 0x080c, 0x2054, | |||
| 0x1330, 0x2b20, 0x3744, 0x070c, 0x1f54, | |||
| 0x1230, 0x2c20, 0x3844, 0x060c, 0x1e54, | |||
| 0x1234, 0x2d20, 0x3944, 0x0610, 0x1e58, | |||
| 0x1334, 0x2e20, 0x3a44, 0x0710, 0x2058, | |||
| 0x1434, 0x2f20, 0x3b44, 0x0810, 0x2258, | |||
| 0x1824, 0x3310, 0x3f34, 0x0c00, 0x2448, | |||
| 0x1924, 0x3410, 0x4034, 0x0d00, 0x2548, | |||
| 0x1a24, 0x3510, 0x4134, 0x0e00, 0x2648, | |||
| 0x1b24, 0x3514, 0x4138, 0x0f00, 0x2748, | |||
| 0x1c24, 0x3414, 0x4038, 0x1000, 0x2848, | |||
| 0x1d24, 0x3314, 0x3f38, 0x1100, 0x2948, | |||
| 0x1d28, 0x3214, 0x3e38, 0x1104, 0x294c, | |||
| 0x1c28, 0x3114, 0x3d38, 0x1004, 0x284c, | |||
| 0x1b28, 0x3014, 0x3c38, 0x0f04, 0x274c, | |||
| 0x1a28, 0x3018, 0x3c3c, 0x0e04, 0x264c, | |||
| 0x1928, 0x3118, 0x3d3c, 0x0d04, 0x254c, | |||
| 0x1828, 0x3218, 0x3e3c, 0x0c04, 0x244c, | |||
| 0x182c, 0x3318, 0x3f3c, 0x0c08, 0x2450, | |||
| 0x192c, 0x3418, 0x403c, 0x0d08, 0x2550, | |||
| 0x1a2c, 0x3518, 0x413c, 0x0e08, 0x2650, | |||
| 0x1b2c, 0x351c, 0x4140, 0x0f08, 0x2750, | |||
| 0x1c2c, 0x341c, 0x4040, 0x1008, 0x2850, | |||
| 0x1d2c, 0x331c, 0x3f40, 0x1108, 0x2950, | |||
| 0x1d30, 0x321c, 0x3e40, 0x110c, 0x2954, | |||
| 0x1c30, 0x311c, 0x3d40, 0x100c, 0x2854, | |||
| 0x1b30, 0x301c, 0x3c40, 0x0f0c, 0x2754, | |||
| 0x1a30, 0x3020, 0x3c44, 0x0e0c, 0x2654, | |||
| 0x1930, 0x3120, 0x3d44, 0x0d0c, 0x2554, | |||
| 0x1830, 0x3220, 0x3e44, 0x0c0c, 0x2454, | |||
| 0x1834, 0x3320, 0x3f44, 0x0c10, 0x2458, | |||
| 0x1934, 0x3420, 0x4044, 0x0d10, 0x2658, | |||
| 0x1a34, 0x3520, 0x4144, 0x0e10, 0x2858, | |||
| 0x1e24, 0x3910, 0x4534, 0x1200, 0x2a48, | |||
| 0x1f24, 0x3a10, 0x4634, 0x1300, 0x2b48, | |||
| 0x2024, 0x3b10, 0x4734, 0x1400, 0x2c48, | |||
| 0x2124, 0x3b14, 0x4738, 0x1500, 0x2d48, | |||
| 0x2224, 0x3a14, 0x4638, 0x1600, 0x2e48, | |||
| 0x2324, 0x3914, 0x4538, 0x1700, 0x2f48, | |||
| 0x2328, 0x3814, 0x4438, 0x1704, 0x2f4c, | |||
| 0x2228, 0x3714, 0x4338, 0x1604, 0x2e4c, | |||
| 0x2128, 0x3614, 0x4238, 0x1504, 0x2d4c, | |||
| 0x2028, 0x3618, 0x423c, 0x1404, 0x2c4c, | |||
| 0x1f28, 0x3718, 0x433c, 0x1304, 0x2b4c, | |||
| 0x1e28, 0x3818, 0x443c, 0x1204, 0x2a4c, | |||
| 0x1e2c, 0x3918, 0x453c, 0x1208, 0x2a50, | |||
| 0x1f2c, 0x3a18, 0x463c, 0x1308, 0x2b50, | |||
| 0x202c, 0x3b18, 0x473c, 0x1408, 0x2c50, | |||
| 0x212c, 0x3b1c, 0x4740, 0x1508, 0x2d50, | |||
| 0x222c, 0x3a1c, 0x4640, 0x1608, 0x2e50, | |||
| 0x232c, 0x391c, 0x4540, 0x1708, 0x2f50, | |||
| 0x2330, 0x381c, 0x4440, 0x170c, 0x2f54, | |||
| 0x2230, 0x371c, 0x4340, 0x160c, 0x2e54, | |||
| 0x2130, 0x361c, 0x4240, 0x150c, 0x2d54, | |||
| 0x2030, 0x3620, 0x4244, 0x140c, 0x2c54, | |||
| 0x1f30, 0x3720, 0x4344, 0x130c, 0x2b54, | |||
| 0x1e30, 0x3820, 0x4444, 0x120c, 0x2a54, | |||
| 0x1e34, 0x3920, 0x4544, 0x1210, 0x2a58, | |||
| 0x1f34, 0x3a20, 0x4644, 0x1310, 0x2c58, | |||
| 0x2034, 0x3b20, 0x4744, 0x1410, 0x2e58, | |||
| 0x2424, 0x3f10, 0x0334, 0x1800, 0x3048, | |||
| 0x2524, 0x4010, 0x0434, 0x1900, 0x3148, | |||
| 0x2624, 0x4110, 0x0534, 0x1a00, 0x3248, | |||
| 0x2724, 0x4114, 0x0538, 0x1b00, 0x3348, | |||
| 0x2824, 0x4014, 0x0438, 0x1c00, 0x3448, | |||
| 0x2924, 0x3f14, 0x0338, 0x1d00, 0x3548, | |||
| 0x2928, 0x3e14, 0x0238, 0x1d04, 0x354c, | |||
| 0x2828, 0x3d14, 0x0138, 0x1c04, 0x344c, | |||
| 0x2728, 0x3c14, 0x0038, 0x1b04, 0x334c, | |||
| 0x2628, 0x3c18, 0x003c, 0x1a04, 0x324c, | |||
| 0x2528, 0x3d18, 0x013c, 0x1904, 0x314c, | |||
| 0x2428, 0x3e18, 0x023c, 0x1804, 0x304c, | |||
| 0x242c, 0x3f18, 0x033c, 0x1808, 0x3050, | |||
| 0x252c, 0x4018, 0x043c, 0x1908, 0x3150, | |||
| 0x262c, 0x4118, 0x053c, 0x1a08, 0x3250, | |||
| 0x272c, 0x411c, 0x0540, 0x1b08, 0x3350, | |||
| 0x282c, 0x401c, 0x0440, 0x1c08, 0x3450, | |||
| 0x292c, 0x3f1c, 0x0340, 0x1d08, 0x3550, | |||
| 0x2930, 0x3e1c, 0x0240, 0x1d0c, 0x3554, | |||
| 0x2830, 0x3d1c, 0x0140, 0x1c0c, 0x3454, | |||
| 0x2730, 0x3c1c, 0x0040, 0x1b0c, 0x3354, | |||
| 0x2630, 0x3c20, 0x0044, 0x1a0c, 0x3254, | |||
| 0x2530, 0x3d20, 0x0144, 0x190c, 0x3154, | |||
| 0x2430, 0x3e20, 0x0244, 0x180c, 0x3054, | |||
| 0x2434, 0x3f20, 0x0344, 0x1810, 0x3058, | |||
| 0x2534, 0x4020, 0x0444, 0x1910, 0x3258, | |||
| 0x2634, 0x4120, 0x0544, 0x1a10, 0x3458, | |||
| 0x2a24, 0x4510, 0x0934, 0x1e00, 0x3648, | |||
| 0x2b24, 0x4610, 0x0a34, 0x1f00, 0x3748, | |||
| 0x2c24, 0x4710, 0x0b34, 0x2000, 0x3848, | |||
| 0x2d24, 0x4714, 0x0b38, 0x2100, 0x3948, | |||
| 0x2e24, 0x4614, 0x0a38, 0x2200, 0x3a48, | |||
| 0x2f24, 0x4514, 0x0938, 0x2300, 0x3b48, | |||
| 0x2f28, 0x4414, 0x0838, 0x2304, 0x3b4c, | |||
| 0x2e28, 0x4314, 0x0738, 0x2204, 0x3a4c, | |||
| 0x2d28, 0x4214, 0x0638, 0x2104, 0x394c, | |||
| 0x2c28, 0x4218, 0x063c, 0x2004, 0x384c, | |||
| 0x2b28, 0x4318, 0x073c, 0x1f04, 0x374c, | |||
| 0x2a28, 0x4418, 0x083c, 0x1e04, 0x364c, | |||
| 0x2a2c, 0x4518, 0x093c, 0x1e08, 0x3650, | |||
| 0x2b2c, 0x4618, 0x0a3c, 0x1f08, 0x3750, | |||
| 0x2c2c, 0x4718, 0x0b3c, 0x2008, 0x3850, | |||
| 0x2d2c, 0x471c, 0x0b40, 0x2108, 0x3950, | |||
| 0x2e2c, 0x461c, 0x0a40, 0x2208, 0x3a50, | |||
| 0x2f2c, 0x451c, 0x0940, 0x2308, 0x3b50, | |||
| 0x2f30, 0x441c, 0x0840, 0x230c, 0x3b54, | |||
| 0x2e30, 0x431c, 0x0740, 0x220c, 0x3a54, | |||
| 0x2d30, 0x421c, 0x0640, 0x210c, 0x3954, | |||
| 0x2c30, 0x4220, 0x0644, 0x200c, 0x3854, | |||
| 0x2b30, 0x4320, 0x0744, 0x1f0c, 0x3754, | |||
| 0x2a30, 0x4420, 0x0844, 0x1e0c, 0x3654, | |||
| 0x2a34, 0x4520, 0x0944, 0x1e10, 0x3658, | |||
| 0x2b34, 0x4620, 0x0a44, 0x1f10, 0x3858, | |||
| 0x2c34, 0x4720, 0x0b44, 0x2010, 0x3a58, | |||
| 0x3024, 0x0310, 0x0f34, 0x2400, 0x3c48, | |||
| 0x3124, 0x0410, 0x1034, 0x2500, 0x3d48, | |||
| 0x3224, 0x0510, 0x1134, 0x2600, 0x3e48, | |||
| 0x3324, 0x0514, 0x1138, 0x2700, 0x3f48, | |||
| 0x3424, 0x0414, 0x1038, 0x2800, 0x4048, | |||
| 0x3524, 0x0314, 0x0f38, 0x2900, 0x4148, | |||
| 0x3528, 0x0214, 0x0e38, 0x2904, 0x414c, | |||
| 0x3428, 0x0114, 0x0d38, 0x2804, 0x404c, | |||
| 0x3328, 0x0014, 0x0c38, 0x2704, 0x3f4c, | |||
| 0x3228, 0x0018, 0x0c3c, 0x2604, 0x3e4c, | |||
| 0x3128, 0x0118, 0x0d3c, 0x2504, 0x3d4c, | |||
| 0x3028, 0x0218, 0x0e3c, 0x2404, 0x3c4c, | |||
| 0x302c, 0x0318, 0x0f3c, 0x2408, 0x3c50, | |||
| 0x312c, 0x0418, 0x103c, 0x2508, 0x3d50, | |||
| 0x322c, 0x0518, 0x113c, 0x2608, 0x3e50, | |||
| 0x332c, 0x051c, 0x1140, 0x2708, 0x3f50, | |||
| 0x342c, 0x041c, 0x1040, 0x2808, 0x4050, | |||
| 0x352c, 0x031c, 0x0f40, 0x2908, 0x4150, | |||
| 0x3530, 0x021c, 0x0e40, 0x290c, 0x4154, | |||
| 0x3430, 0x011c, 0x0d40, 0x280c, 0x4054, | |||
| 0x3330, 0x001c, 0x0c40, 0x270c, 0x3f54, | |||
| 0x3230, 0x0020, 0x0c44, 0x260c, 0x3e54, | |||
| 0x3130, 0x0120, 0x0d44, 0x250c, 0x3d54, | |||
| 0x3030, 0x0220, 0x0e44, 0x240c, 0x3c54, | |||
| 0x3034, 0x0320, 0x0f44, 0x2410, 0x3c58, | |||
| 0x3134, 0x0420, 0x1044, 0x2510, 0x3e58, | |||
| 0x3234, 0x0520, 0x1144, 0x2610, 0x4058, | |||
| 0x3624, 0x0910, 0x1534, 0x2a00, 0x4248, | |||
| 0x3724, 0x0a10, 0x1634, 0x2b00, 0x4348, | |||
| 0x3824, 0x0b10, 0x1734, 0x2c00, 0x4448, | |||
| 0x3924, 0x0b14, 0x1738, 0x2d00, 0x4548, | |||
| 0x3a24, 0x0a14, 0x1638, 0x2e00, 0x4648, | |||
| 0x3b24, 0x0914, 0x1538, 0x2f00, 0x4748, | |||
| 0x3b28, 0x0814, 0x1438, 0x2f04, 0x474c, | |||
| 0x3a28, 0x0714, 0x1338, 0x2e04, 0x464c, | |||
| 0x3928, 0x0614, 0x1238, 0x2d04, 0x454c, | |||
| 0x3828, 0x0618, 0x123c, 0x2c04, 0x444c, | |||
| 0x3728, 0x0718, 0x133c, 0x2b04, 0x434c, | |||
| 0x3628, 0x0818, 0x143c, 0x2a04, 0x424c, | |||
| 0x362c, 0x0918, 0x153c, 0x2a08, 0x4250, | |||
| 0x372c, 0x0a18, 0x163c, 0x2b08, 0x4350, | |||
| 0x382c, 0x0b18, 0x173c, 0x2c08, 0x4450, | |||
| 0x392c, 0x0b1c, 0x1740, 0x2d08, 0x4550, | |||
| 0x3a2c, 0x0a1c, 0x1640, 0x2e08, 0x4650, | |||
| 0x3b2c, 0x091c, 0x1540, 0x2f08, 0x4750, | |||
| 0x3b30, 0x081c, 0x1440, 0x2f0c, 0x4754, | |||
| 0x3a30, 0x071c, 0x1340, 0x2e0c, 0x4654, | |||
| 0x3930, 0x061c, 0x1240, 0x2d0c, 0x4554, | |||
| 0x3830, 0x0620, 0x1244, 0x2c0c, 0x4454, | |||
| 0x3730, 0x0720, 0x1344, 0x2b0c, 0x4354, | |||
| 0x3630, 0x0820, 0x1444, 0x2a0c, 0x4254, | |||
| 0x3634, 0x0920, 0x1544, 0x2a10, 0x4258, | |||
| 0x3734, 0x0a20, 0x1644, 0x2b10, 0x4458, | |||
| 0x3834, 0x0b20, 0x1744, 0x2c10, 0x4658, | |||
| 0x3c24, 0x0f10, 0x1b34, 0x3000, 0x0048, | |||
| 0x3d24, 0x1010, 0x1c34, 0x3100, 0x0148, | |||
| 0x3e24, 0x1110, 0x1d34, 0x3200, 0x0248, | |||
| 0x3f24, 0x1114, 0x1d38, 0x3300, 0x0348, | |||
| 0x4024, 0x1014, 0x1c38, 0x3400, 0x0448, | |||
| 0x4124, 0x0f14, 0x1b38, 0x3500, 0x0548, | |||
| 0x4128, 0x0e14, 0x1a38, 0x3504, 0x054c, | |||
| 0x4028, 0x0d14, 0x1938, 0x3404, 0x044c, | |||
| 0x3f28, 0x0c14, 0x1838, 0x3304, 0x034c, | |||
| 0x3e28, 0x0c18, 0x183c, 0x3204, 0x024c, | |||
| 0x3d28, 0x0d18, 0x193c, 0x3104, 0x014c, | |||
| 0x3c28, 0x0e18, 0x1a3c, 0x3004, 0x004c, | |||
| 0x3c2c, 0x0f18, 0x1b3c, 0x3008, 0x0050, | |||
| 0x3d2c, 0x1018, 0x1c3c, 0x3108, 0x0150, | |||
| 0x3e2c, 0x1118, 0x1d3c, 0x3208, 0x0250, | |||
| 0x3f2c, 0x111c, 0x1d40, 0x3308, 0x0350, | |||
| 0x402c, 0x101c, 0x1c40, 0x3408, 0x0450, | |||
| 0x412c, 0x0f1c, 0x1b40, 0x3508, 0x0550, | |||
| 0x4130, 0x0e1c, 0x1a40, 0x350c, 0x0554, | |||
| 0x4030, 0x0d1c, 0x1940, 0x340c, 0x0454, | |||
| 0x3f30, 0x0c1c, 0x1840, 0x330c, 0x0354, | |||
| 0x3e30, 0x0c20, 0x1844, 0x320c, 0x0254, | |||
| 0x3d30, 0x0d20, 0x1944, 0x310c, 0x0154, | |||
| 0x3c30, 0x0e20, 0x1a44, 0x300c, 0x0054, | |||
| 0x3c34, 0x0f20, 0x1b44, 0x3010, 0x0058, | |||
| 0x3d34, 0x1020, 0x1c44, 0x3110, 0x0258, | |||
| 0x3e34, 0x1120, 0x1d44, 0x3210, 0x0458, | |||
| 0x4224, 0x1510, 0x2134, 0x3600, 0x0648, | |||
| 0x4324, 0x1610, 0x2234, 0x3700, 0x0748, | |||
| 0x4424, 0x1710, 0x2334, 0x3800, 0x0848, | |||
| 0x4524, 0x1714, 0x2338, 0x3900, 0x0948, | |||
| 0x4624, 0x1614, 0x2238, 0x3a00, 0x0a48, | |||
| 0x4724, 0x1514, 0x2138, 0x3b00, 0x0b48, | |||
| 0x4728, 0x1414, 0x2038, 0x3b04, 0x0b4c, | |||
| 0x4628, 0x1314, 0x1f38, 0x3a04, 0x0a4c, | |||
| 0x4528, 0x1214, 0x1e38, 0x3904, 0x094c, | |||
| 0x4428, 0x1218, 0x1e3c, 0x3804, 0x084c, | |||
| 0x4328, 0x1318, 0x1f3c, 0x3704, 0x074c, | |||
| 0x4228, 0x1418, 0x203c, 0x3604, 0x064c, | |||
| 0x422c, 0x1518, 0x213c, 0x3608, 0x0650, | |||
| 0x432c, 0x1618, 0x223c, 0x3708, 0x0750, | |||
| 0x442c, 0x1718, 0x233c, 0x3808, 0x0850, | |||
| 0x452c, 0x171c, 0x2340, 0x3908, 0x0950, | |||
| 0x462c, 0x161c, 0x2240, 0x3a08, 0x0a50, | |||
| 0x472c, 0x151c, 0x2140, 0x3b08, 0x0b50, | |||
| 0x4730, 0x141c, 0x2040, 0x3b0c, 0x0b54, | |||
| 0x4630, 0x131c, 0x1f40, 0x3a0c, 0x0a54, | |||
| 0x4530, 0x121c, 0x1e40, 0x390c, 0x0954, | |||
| 0x4430, 0x1220, 0x1e44, 0x380c, 0x0854, | |||
| 0x4330, 0x1320, 0x1f44, 0x370c, 0x0754, | |||
| 0x4230, 0x1420, 0x2044, 0x360c, 0x0654, | |||
| 0x4234, 0x1520, 0x2144, 0x3610, 0x0658, | |||
| 0x4334, 0x1620, 0x2244, 0x3710, 0x0858, | |||
| 0x4434, 0x1720, 0x2344, 0x3810, 0x0a58, | |||
| 0x0024, 0x1b10, 0x2734, 0x3c00, 0x0c48, | |||
| 0x0124, 0x1c10, 0x2834, 0x3d00, 0x0d48, | |||
| 0x0224, 0x1d10, 0x2934, 0x3e00, 0x0e48, | |||
| 0x0324, 0x1d14, 0x2938, 0x3f00, 0x0f48, | |||
| 0x0424, 0x1c14, 0x2838, 0x4000, 0x1048, | |||
| 0x0524, 0x1b14, 0x2738, 0x4100, 0x1148, | |||
| 0x0528, 0x1a14, 0x2638, 0x4104, 0x114c, | |||
| 0x0428, 0x1914, 0x2538, 0x4004, 0x104c, | |||
| 0x0328, 0x1814, 0x2438, 0x3f04, 0x0f4c, | |||
| 0x0228, 0x1818, 0x243c, 0x3e04, 0x0e4c, | |||
| 0x0128, 0x1918, 0x253c, 0x3d04, 0x0d4c, | |||
| 0x0028, 0x1a18, 0x263c, 0x3c04, 0x0c4c, | |||
| 0x002c, 0x1b18, 0x273c, 0x3c08, 0x0c50, | |||
| 0x012c, 0x1c18, 0x283c, 0x3d08, 0x0d50, | |||
| 0x022c, 0x1d18, 0x293c, 0x3e08, 0x0e50, | |||
| 0x032c, 0x1d1c, 0x2940, 0x3f08, 0x0f50, | |||
| 0x042c, 0x1c1c, 0x2840, 0x4008, 0x1050, | |||
| 0x052c, 0x1b1c, 0x2740, 0x4108, 0x1150, | |||
| 0x0530, 0x1a1c, 0x2640, 0x410c, 0x1154, | |||
| 0x0430, 0x191c, 0x2540, 0x400c, 0x1054, | |||
| 0x0330, 0x181c, 0x2440, 0x3f0c, 0x0f54, | |||
| 0x0230, 0x1820, 0x2444, 0x3e0c, 0x0e54, | |||
| 0x0130, 0x1920, 0x2544, 0x3d0c, 0x0d54, | |||
| 0x0030, 0x1a20, 0x2644, 0x3c0c, 0x0c54, | |||
| 0x0034, 0x1b20, 0x2744, 0x3c10, 0x0c58, | |||
| 0x0134, 0x1c20, 0x2844, 0x3d10, 0x0e58, | |||
| 0x0234, 0x1d20, 0x2944, 0x3e10, 0x1058, | |||
| 0x0624, 0x2110, 0x2d34, 0x4200, 0x1248, | |||
| 0x0724, 0x2210, 0x2e34, 0x4300, 0x1348, | |||
| 0x0824, 0x2310, 0x2f34, 0x4400, 0x1448, | |||
| 0x0924, 0x2314, 0x2f38, 0x4500, 0x1548, | |||
| 0x0a24, 0x2214, 0x2e38, 0x4600, 0x1648, | |||
| 0x0b24, 0x2114, 0x2d38, 0x4700, 0x1748, | |||
| 0x0b28, 0x2014, 0x2c38, 0x4704, 0x174c, | |||
| 0x0a28, 0x1f14, 0x2b38, 0x4604, 0x164c, | |||
| 0x0928, 0x1e14, 0x2a38, 0x4504, 0x154c, | |||
| 0x0828, 0x1e18, 0x2a3c, 0x4404, 0x144c, | |||
| 0x0728, 0x1f18, 0x2b3c, 0x4304, 0x134c, | |||
| 0x0628, 0x2018, 0x2c3c, 0x4204, 0x124c, | |||
| 0x062c, 0x2118, 0x2d3c, 0x4208, 0x1250, | |||
| 0x072c, 0x2218, 0x2e3c, 0x4308, 0x1350, | |||
| 0x082c, 0x2318, 0x2f3c, 0x4408, 0x1450, | |||
| 0x092c, 0x231c, 0x2f40, 0x4508, 0x1550, | |||
| 0x0a2c, 0x221c, 0x2e40, 0x4608, 0x1650, | |||
| 0x0b2c, 0x211c, 0x2d40, 0x4708, 0x1750, | |||
| 0x0b30, 0x201c, 0x2c40, 0x470c, 0x1754, | |||
| 0x0a30, 0x1f1c, 0x2b40, 0x460c, 0x1654, | |||
| 0x0930, 0x1e1c, 0x2a40, 0x450c, 0x1554, | |||
| 0x0830, 0x1e20, 0x2a44, 0x440c, 0x1454, | |||
| 0x0730, 0x1f20, 0x2b44, 0x430c, 0x1354, | |||
| 0x0630, 0x2020, 0x2c44, 0x420c, 0x1254, | |||
| 0x0634, 0x2120, 0x2d44, 0x4210, 0x1258, | |||
| 0x0734, 0x2220, 0x2e44, 0x4310, 0x1458, | |||
| 0x0c24, 0x2710, 0x3334, 0x0000, 0x1848, | |||
| 0x0d24, 0x2810, 0x3434, 0x0100, 0x1948, | |||
| 0x0e24, 0x2910, 0x3534, 0x0200, 0x1a48, | |||
| 0x0f24, 0x2914, 0x3538, 0x0300, 0x1b48, | |||
| 0x1024, 0x2814, 0x3438, 0x0400, 0x1c48, | |||
| 0x1124, 0x2714, 0x3338, 0x0500, 0x1d48, | |||
| 0x1128, 0x2614, 0x3238, 0x0504, 0x1d4c, | |||
| 0x1028, 0x2514, 0x3138, 0x0404, 0x1c4c, | |||
| 0x0f28, 0x2414, 0x3038, 0x0304, 0x1b4c, | |||
| 0x0e28, 0x2418, 0x303c, 0x0204, 0x1a4c, | |||
| 0x0d28, 0x2518, 0x313c, 0x0104, 0x194c, | |||
| 0x0c28, 0x2618, 0x323c, 0x0004, 0x184c, | |||
| 0x0c2c, 0x2718, 0x333c, 0x0008, 0x1850, | |||
| 0x0d2c, 0x2818, 0x343c, 0x0108, 0x1950, | |||
| 0x0e2c, 0x2918, 0x353c, 0x0208, 0x1a50, | |||
| 0x0f2c, 0x291c, 0x3540, 0x0308, 0x1b50, | |||
| 0x102c, 0x281c, 0x3440, 0x0408, 0x1c50, | |||
| 0x112c, 0x271c, 0x3340, 0x0508, 0x1d50, | |||
| 0x1130, 0x261c, 0x3240, 0x050c, 0x1d54, | |||
| 0x1030, 0x251c, 0x3140, 0x040c, 0x1c54, | |||
| 0x0f30, 0x241c, 0x3040, 0x030c, 0x1b54, | |||
| 0x0e30, 0x2420, 0x3044, 0x020c, 0x1a54, | |||
| 0x0d30, 0x2520, 0x3144, 0x010c, 0x1954, | |||
| 0x0c30, 0x2620, 0x3244, 0x000c, 0x1854, | |||
| 0x0c34, 0x2720, 0x3344, 0x0010, 0x1858, | |||
| 0x0d34, 0x2820, 0x3444, 0x0110, 0x1a58, | |||
| 0x0e34, 0x2920, 0x3544, 0x0210, 0x1c58, | |||
| 0x1224, 0x2d10, 0x3934, 0x0600, 0x1e48, | |||
| 0x1324, 0x2e10, 0x3a34, 0x0700, 0x1f48, | |||
| 0x1424, 0x2f10, 0x3b34, 0x0800, 0x2048, | |||
| 0x1524, 0x2f14, 0x3b38, 0x0900, 0x2148, | |||
| 0x1624, 0x2e14, 0x3a38, 0x0a00, 0x2248, | |||
| 0x1724, 0x2d14, 0x3938, 0x0b00, 0x2348, | |||
| 0x1728, 0x2c14, 0x3838, 0x0b04, 0x234c, | |||
| 0x1628, 0x2b14, 0x3738, 0x0a04, 0x224c, | |||
| 0x1528, 0x2a14, 0x3638, 0x0904, 0x214c, | |||
| 0x1428, 0x2a18, 0x363c, 0x0804, 0x204c, | |||
| 0x1328, 0x2b18, 0x373c, 0x0704, 0x1f4c, | |||
| 0x1228, 0x2c18, 0x383c, 0x0604, 0x1e4c, | |||
| 0x122c, 0x2d18, 0x393c, 0x0608, 0x1e50, | |||
| 0x132c, 0x2e18, 0x3a3c, 0x0708, 0x1f50, | |||
| 0x142c, 0x2f18, 0x3b3c, 0x0808, 0x2050, | |||
| 0x152c, 0x2f1c, 0x3b40, 0x0908, 0x2150, | |||
| 0x162c, 0x2e1c, 0x3a40, 0x0a08, 0x2250, | |||
| 0x172c, 0x2d1c, 0x3940, 0x0b08, 0x2350, | |||
| 0x1730, 0x2c1c, 0x3840, 0x0b0c, 0x2354, | |||
| 0x1630, 0x2b1c, 0x3740, 0x0a0c, 0x2254, | |||
| 0x1530, 0x2a1c, 0x3640, 0x090c, 0x2154, | |||
| 0x1430, 0x2a20, 0x3644, 0x080c, 0x2054, | |||
| 0x1330, 0x2b20, 0x3744, 0x070c, 0x1f54, | |||
| 0x1230, 0x2c20, 0x3844, 0x060c, 0x1e54, | |||
| 0x1234, 0x2d20, 0x3944, 0x0610, 0x1e58, | |||
| 0x1334, 0x2e20, 0x3a44, 0x0710, 0x2058, | |||
| 0x1434, 0x2f20, 0x3b44, 0x0810, 0x2258, | |||
| 0x1824, 0x3310, 0x3f34, 0x0c00, 0x2448, | |||
| 0x1924, 0x3410, 0x4034, 0x0d00, 0x2548, | |||
| 0x1a24, 0x3510, 0x4134, 0x0e00, 0x2648, | |||
| 0x1b24, 0x3514, 0x4138, 0x0f00, 0x2748, | |||
| 0x1c24, 0x3414, 0x4038, 0x1000, 0x2848, | |||
| 0x1d24, 0x3314, 0x3f38, 0x1100, 0x2948, | |||
| 0x1d28, 0x3214, 0x3e38, 0x1104, 0x294c, | |||
| 0x1c28, 0x3114, 0x3d38, 0x1004, 0x284c, | |||
| 0x1b28, 0x3014, 0x3c38, 0x0f04, 0x274c, | |||
| 0x1a28, 0x3018, 0x3c3c, 0x0e04, 0x264c, | |||
| 0x1928, 0x3118, 0x3d3c, 0x0d04, 0x254c, | |||
| 0x1828, 0x3218, 0x3e3c, 0x0c04, 0x244c, | |||
| 0x182c, 0x3318, 0x3f3c, 0x0c08, 0x2450, | |||
| 0x192c, 0x3418, 0x403c, 0x0d08, 0x2550, | |||
| 0x1a2c, 0x3518, 0x413c, 0x0e08, 0x2650, | |||
| 0x1b2c, 0x351c, 0x4140, 0x0f08, 0x2750, | |||
| 0x1c2c, 0x341c, 0x4040, 0x1008, 0x2850, | |||
| 0x1d2c, 0x331c, 0x3f40, 0x1108, 0x2950, | |||
| 0x1d30, 0x321c, 0x3e40, 0x110c, 0x2954, | |||
| 0x1c30, 0x311c, 0x3d40, 0x100c, 0x2854, | |||
| 0x1b30, 0x301c, 0x3c40, 0x0f0c, 0x2754, | |||
| 0x1a30, 0x3020, 0x3c44, 0x0e0c, 0x2654, | |||
| 0x1930, 0x3120, 0x3d44, 0x0d0c, 0x2554, | |||
| 0x1830, 0x3220, 0x3e44, 0x0c0c, 0x2454, | |||
| 0x1834, 0x3320, 0x3f44, 0x0c10, 0x2458, | |||
| 0x1934, 0x3420, 0x4044, 0x0d10, 0x2658, | |||
| 0x1a34, 0x3520, 0x4144, 0x0e10, 0x2858, | |||
| 0x1e24, 0x3910, 0x4534, 0x1200, 0x2a48, | |||
| 0x1f24, 0x3a10, 0x4634, 0x1300, 0x2b48, | |||
| 0x2024, 0x3b10, 0x4734, 0x1400, 0x2c48, | |||
| 0x2124, 0x3b14, 0x4738, 0x1500, 0x2d48, | |||
| 0x2224, 0x3a14, 0x4638, 0x1600, 0x2e48, | |||
| 0x2324, 0x3914, 0x4538, 0x1700, 0x2f48, | |||
| 0x2328, 0x3814, 0x4438, 0x1704, 0x2f4c, | |||
| 0x2228, 0x3714, 0x4338, 0x1604, 0x2e4c, | |||
| 0x2128, 0x3614, 0x4238, 0x1504, 0x2d4c, | |||
| 0x2028, 0x3618, 0x423c, 0x1404, 0x2c4c, | |||
| 0x1f28, 0x3718, 0x433c, 0x1304, 0x2b4c, | |||
| 0x1e28, 0x3818, 0x443c, 0x1204, 0x2a4c, | |||
| 0x1e2c, 0x3918, 0x453c, 0x1208, 0x2a50, | |||
| 0x1f2c, 0x3a18, 0x463c, 0x1308, 0x2b50, | |||
| 0x202c, 0x3b18, 0x473c, 0x1408, 0x2c50, | |||
| 0x212c, 0x3b1c, 0x4740, 0x1508, 0x2d50, | |||
| 0x222c, 0x3a1c, 0x4640, 0x1608, 0x2e50, | |||
| 0x232c, 0x391c, 0x4540, 0x1708, 0x2f50, | |||
| 0x2330, 0x381c, 0x4440, 0x170c, 0x2f54, | |||
| 0x2230, 0x371c, 0x4340, 0x160c, 0x2e54, | |||
| 0x2130, 0x361c, 0x4240, 0x150c, 0x2d54, | |||
| 0x2030, 0x3620, 0x4244, 0x140c, 0x2c54, | |||
| 0x1f30, 0x3720, 0x4344, 0x130c, 0x2b54, | |||
| 0x1e30, 0x3820, 0x4444, 0x120c, 0x2a54, | |||
| 0x1e34, 0x3920, 0x4544, 0x1210, 0x2a58, | |||
| 0x1f34, 0x3a20, 0x4644, 0x1310, 0x2c58, | |||
| 0x2034, 0x3b20, 0x4744, 0x1410, 0x2e58, | |||
| 0x2424, 0x3f10, 0x0334, 0x1800, 0x3048, | |||
| 0x2524, 0x4010, 0x0434, 0x1900, 0x3148, | |||
| 0x2624, 0x4110, 0x0534, 0x1a00, 0x3248, | |||
| 0x2724, 0x4114, 0x0538, 0x1b00, 0x3348, | |||
| 0x2824, 0x4014, 0x0438, 0x1c00, 0x3448, | |||
| 0x2924, 0x3f14, 0x0338, 0x1d00, 0x3548, | |||
| 0x2928, 0x3e14, 0x0238, 0x1d04, 0x354c, | |||
| 0x2828, 0x3d14, 0x0138, 0x1c04, 0x344c, | |||
| 0x2728, 0x3c14, 0x0038, 0x1b04, 0x334c, | |||
| 0x2628, 0x3c18, 0x003c, 0x1a04, 0x324c, | |||
| 0x2528, 0x3d18, 0x013c, 0x1904, 0x314c, | |||
| 0x2428, 0x3e18, 0x023c, 0x1804, 0x304c, | |||
| 0x242c, 0x3f18, 0x033c, 0x1808, 0x3050, | |||
| 0x252c, 0x4018, 0x043c, 0x1908, 0x3150, | |||
| 0x262c, 0x4118, 0x053c, 0x1a08, 0x3250, | |||
| 0x272c, 0x411c, 0x0540, 0x1b08, 0x3350, | |||
| 0x282c, 0x401c, 0x0440, 0x1c08, 0x3450, | |||
| 0x292c, 0x3f1c, 0x0340, 0x1d08, 0x3550, | |||
| 0x2930, 0x3e1c, 0x0240, 0x1d0c, 0x3554, | |||
| 0x2830, 0x3d1c, 0x0140, 0x1c0c, 0x3454, | |||
| 0x2730, 0x3c1c, 0x0040, 0x1b0c, 0x3354, | |||
| 0x2630, 0x3c20, 0x0044, 0x1a0c, 0x3254, | |||
| 0x2530, 0x3d20, 0x0144, 0x190c, 0x3154, | |||
| 0x2430, 0x3e20, 0x0244, 0x180c, 0x3054, | |||
| 0x2434, 0x3f20, 0x0344, 0x1810, 0x3058, | |||
| 0x2534, 0x4020, 0x0444, 0x1910, 0x3258, | |||
| 0x2634, 0x4120, 0x0544, 0x1a10, 0x3458, | |||
| 0x2a24, 0x4510, 0x0934, 0x1e00, 0x3648, | |||
| 0x2b24, 0x4610, 0x0a34, 0x1f00, 0x3748, | |||
| 0x2c24, 0x4710, 0x0b34, 0x2000, 0x3848, | |||
| 0x2d24, 0x4714, 0x0b38, 0x2100, 0x3948, | |||
| 0x2e24, 0x4614, 0x0a38, 0x2200, 0x3a48, | |||
| 0x2f24, 0x4514, 0x0938, 0x2300, 0x3b48, | |||
| 0x2f28, 0x4414, 0x0838, 0x2304, 0x3b4c, | |||
| 0x2e28, 0x4314, 0x0738, 0x2204, 0x3a4c, | |||
| 0x2d28, 0x4214, 0x0638, 0x2104, 0x394c, | |||
| 0x2c28, 0x4218, 0x063c, 0x2004, 0x384c, | |||
| 0x2b28, 0x4318, 0x073c, 0x1f04, 0x374c, | |||
| 0x2a28, 0x4418, 0x083c, 0x1e04, 0x364c, | |||
| 0x2a2c, 0x4518, 0x093c, 0x1e08, 0x3650, | |||
| 0x2b2c, 0x4618, 0x0a3c, 0x1f08, 0x3750, | |||
| 0x2c2c, 0x4718, 0x0b3c, 0x2008, 0x3850, | |||
| 0x2d2c, 0x471c, 0x0b40, 0x2108, 0x3950, | |||
| 0x2e2c, 0x461c, 0x0a40, 0x2208, 0x3a50, | |||
| 0x2f2c, 0x451c, 0x0940, 0x2308, 0x3b50, | |||
| 0x2f30, 0x441c, 0x0840, 0x230c, 0x3b54, | |||
| 0x2e30, 0x431c, 0x0740, 0x220c, 0x3a54, | |||
| 0x2d30, 0x421c, 0x0640, 0x210c, 0x3954, | |||
| 0x2c30, 0x4220, 0x0644, 0x200c, 0x3854, | |||
| 0x2b30, 0x4320, 0x0744, 0x1f0c, 0x3754, | |||
| 0x2a30, 0x4420, 0x0844, 0x1e0c, 0x3654, | |||
| 0x2a34, 0x4520, 0x0944, 0x1e10, 0x3658, | |||
| 0x2b34, 0x4620, 0x0a44, 0x1f10, 0x3858, | |||
| 0x2c34, 0x4720, 0x0b44, 0x2010, 0x3a58, | |||
| 0x3024, 0x0310, 0x0f34, 0x2400, 0x3c48, | |||
| 0x3124, 0x0410, 0x1034, 0x2500, 0x3d48, | |||
| 0x3224, 0x0510, 0x1134, 0x2600, 0x3e48, | |||
| 0x3324, 0x0514, 0x1138, 0x2700, 0x3f48, | |||
| 0x3424, 0x0414, 0x1038, 0x2800, 0x4048, | |||
| 0x3524, 0x0314, 0x0f38, 0x2900, 0x4148, | |||
| 0x3528, 0x0214, 0x0e38, 0x2904, 0x414c, | |||
| 0x3428, 0x0114, 0x0d38, 0x2804, 0x404c, | |||
| 0x3328, 0x0014, 0x0c38, 0x2704, 0x3f4c, | |||
| 0x3228, 0x0018, 0x0c3c, 0x2604, 0x3e4c, | |||
| 0x3128, 0x0118, 0x0d3c, 0x2504, 0x3d4c, | |||
| 0x3028, 0x0218, 0x0e3c, 0x2404, 0x3c4c, | |||
| 0x302c, 0x0318, 0x0f3c, 0x2408, 0x3c50, | |||
| 0x312c, 0x0418, 0x103c, 0x2508, 0x3d50, | |||
| 0x322c, 0x0518, 0x113c, 0x2608, 0x3e50, | |||
| 0x332c, 0x051c, 0x1140, 0x2708, 0x3f50, | |||
| 0x342c, 0x041c, 0x1040, 0x2808, 0x4050, | |||
| 0x352c, 0x031c, 0x0f40, 0x2908, 0x4150, | |||
| 0x3530, 0x021c, 0x0e40, 0x290c, 0x4154, | |||
| 0x3430, 0x011c, 0x0d40, 0x280c, 0x4054, | |||
| 0x3330, 0x001c, 0x0c40, 0x270c, 0x3f54, | |||
| 0x3230, 0x0020, 0x0c44, 0x260c, 0x3e54, | |||
| 0x3130, 0x0120, 0x0d44, 0x250c, 0x3d54, | |||
| 0x3030, 0x0220, 0x0e44, 0x240c, 0x3c54, | |||
| 0x3034, 0x0320, 0x0f44, 0x2410, 0x3c58, | |||
| 0x3134, 0x0420, 0x1044, 0x2510, 0x3e58, | |||
| 0x3234, 0x0520, 0x1144, 0x2610, 0x4058, | |||
| 0x3624, 0x0910, 0x1534, 0x2a00, 0x4248, | |||
| 0x3724, 0x0a10, 0x1634, 0x2b00, 0x4348, | |||
| 0x3824, 0x0b10, 0x1734, 0x2c00, 0x4448, | |||
| 0x3924, 0x0b14, 0x1738, 0x2d00, 0x4548, | |||
| 0x3a24, 0x0a14, 0x1638, 0x2e00, 0x4648, | |||
| 0x3b24, 0x0914, 0x1538, 0x2f00, 0x4748, | |||
| 0x3b28, 0x0814, 0x1438, 0x2f04, 0x474c, | |||
| 0x3a28, 0x0714, 0x1338, 0x2e04, 0x464c, | |||
| 0x3928, 0x0614, 0x1238, 0x2d04, 0x454c, | |||
| 0x3828, 0x0618, 0x123c, 0x2c04, 0x444c, | |||
| 0x3728, 0x0718, 0x133c, 0x2b04, 0x434c, | |||
| 0x3628, 0x0818, 0x143c, 0x2a04, 0x424c, | |||
| 0x362c, 0x0918, 0x153c, 0x2a08, 0x4250, | |||
| 0x372c, 0x0a18, 0x163c, 0x2b08, 0x4350, | |||
| 0x382c, 0x0b18, 0x173c, 0x2c08, 0x4450, | |||
| 0x392c, 0x0b1c, 0x1740, 0x2d08, 0x4550, | |||
| 0x3a2c, 0x0a1c, 0x1640, 0x2e08, 0x4650, | |||
| 0x3b2c, 0x091c, 0x1540, 0x2f08, 0x4750, | |||
| 0x3b30, 0x081c, 0x1440, 0x2f0c, 0x4754, | |||
| 0x3a30, 0x071c, 0x1340, 0x2e0c, 0x4654, | |||
| 0x3930, 0x061c, 0x1240, 0x2d0c, 0x4554, | |||
| 0x3830, 0x0620, 0x1244, 0x2c0c, 0x4454, | |||
| 0x3730, 0x0720, 0x1344, 0x2b0c, 0x4354, | |||
| 0x3630, 0x0820, 0x1444, 0x2a0c, 0x4254, | |||
| 0x3634, 0x0920, 0x1544, 0x2a10, 0x4258, | |||
| 0x3734, 0x0a20, 0x1644, 0x2b10, 0x4458, | |||
| 0x3834, 0x0b20, 0x1744, 0x2c10, 0x4658, | |||
| 0x3c24, 0x0f10, 0x1b34, 0x3000, 0x0048, | |||
| 0x3d24, 0x1010, 0x1c34, 0x3100, 0x0148, | |||
| 0x3e24, 0x1110, 0x1d34, 0x3200, 0x0248, | |||
| 0x3f24, 0x1114, 0x1d38, 0x3300, 0x0348, | |||
| 0x4024, 0x1014, 0x1c38, 0x3400, 0x0448, | |||
| 0x4124, 0x0f14, 0x1b38, 0x3500, 0x0548, | |||
| 0x4128, 0x0e14, 0x1a38, 0x3504, 0x054c, | |||
| 0x4028, 0x0d14, 0x1938, 0x3404, 0x044c, | |||
| 0x3f28, 0x0c14, 0x1838, 0x3304, 0x034c, | |||
| 0x3e28, 0x0c18, 0x183c, 0x3204, 0x024c, | |||
| 0x3d28, 0x0d18, 0x193c, 0x3104, 0x014c, | |||
| 0x3c28, 0x0e18, 0x1a3c, 0x3004, 0x004c, | |||
| 0x3c2c, 0x0f18, 0x1b3c, 0x3008, 0x0050, | |||
| 0x3d2c, 0x1018, 0x1c3c, 0x3108, 0x0150, | |||
| 0x3e2c, 0x1118, 0x1d3c, 0x3208, 0x0250, | |||
| 0x3f2c, 0x111c, 0x1d40, 0x3308, 0x0350, | |||
| 0x402c, 0x101c, 0x1c40, 0x3408, 0x0450, | |||
| 0x412c, 0x0f1c, 0x1b40, 0x3508, 0x0550, | |||
| 0x4130, 0x0e1c, 0x1a40, 0x350c, 0x0554, | |||
| 0x4030, 0x0d1c, 0x1940, 0x340c, 0x0454, | |||
| 0x3f30, 0x0c1c, 0x1840, 0x330c, 0x0354, | |||
| 0x3e30, 0x0c20, 0x1844, 0x320c, 0x0254, | |||
| 0x3d30, 0x0d20, 0x1944, 0x310c, 0x0154, | |||
| 0x3c30, 0x0e20, 0x1a44, 0x300c, 0x0054, | |||
| 0x3c34, 0x0f20, 0x1b44, 0x3010, 0x0058, | |||
| 0x3d34, 0x1020, 0x1c44, 0x3110, 0x0258, | |||
| 0x3e34, 0x1120, 0x1d44, 0x3210, 0x0458, | |||
| 0x4224, 0x1510, 0x2134, 0x3600, 0x0648, | |||
| 0x4324, 0x1610, 0x2234, 0x3700, 0x0748, | |||
| 0x4424, 0x1710, 0x2334, 0x3800, 0x0848, | |||
| 0x4524, 0x1714, 0x2338, 0x3900, 0x0948, | |||
| 0x4624, 0x1614, 0x2238, 0x3a00, 0x0a48, | |||
| 0x4724, 0x1514, 0x2138, 0x3b00, 0x0b48, | |||
| 0x4728, 0x1414, 0x2038, 0x3b04, 0x0b4c, | |||
| 0x4628, 0x1314, 0x1f38, 0x3a04, 0x0a4c, | |||
| 0x4528, 0x1214, 0x1e38, 0x3904, 0x094c, | |||
| 0x4428, 0x1218, 0x1e3c, 0x3804, 0x084c, | |||
| 0x4328, 0x1318, 0x1f3c, 0x3704, 0x074c, | |||
| 0x4228, 0x1418, 0x203c, 0x3604, 0x064c, | |||
| 0x422c, 0x1518, 0x213c, 0x3608, 0x0650, | |||
| 0x432c, 0x1618, 0x223c, 0x3708, 0x0750, | |||
| 0x442c, 0x1718, 0x233c, 0x3808, 0x0850, | |||
| 0x452c, 0x171c, 0x2340, 0x3908, 0x0950, | |||
| 0x462c, 0x161c, 0x2240, 0x3a08, 0x0a50, | |||
| 0x472c, 0x151c, 0x2140, 0x3b08, 0x0b50, | |||
| 0x4730, 0x141c, 0x2040, 0x3b0c, 0x0b54, | |||
| 0x4630, 0x131c, 0x1f40, 0x3a0c, 0x0a54, | |||
| 0x4530, 0x121c, 0x1e40, 0x390c, 0x0954, | |||
| 0x4430, 0x1220, 0x1e44, 0x380c, 0x0854, | |||
| 0x4330, 0x1320, 0x1f44, 0x370c, 0x0754, | |||
| 0x4230, 0x1420, 0x2044, 0x360c, 0x0654, | |||
| 0x4234, 0x1520, 0x2144, 0x3610, 0x0658, | |||
| 0x4334, 0x1620, 0x2244, 0x3710, 0x0858, | |||
| 0x4434, 0x1720, 0x2344, 0x3810, 0x0a58, | |||
| 0x0024, 0x1b10, 0x2734, 0x3c00, 0x0c48, | |||
| 0x0124, 0x1c10, 0x2834, 0x3d00, 0x0d48, | |||
| 0x0224, 0x1d10, 0x2934, 0x3e00, 0x0e48, | |||
| 0x0324, 0x1d14, 0x2938, 0x3f00, 0x0f48, | |||
| 0x0424, 0x1c14, 0x2838, 0x4000, 0x1048, | |||
| 0x0524, 0x1b14, 0x2738, 0x4100, 0x1148, | |||
| 0x0528, 0x1a14, 0x2638, 0x4104, 0x114c, | |||
| 0x0428, 0x1914, 0x2538, 0x4004, 0x104c, | |||
| 0x0328, 0x1814, 0x2438, 0x3f04, 0x0f4c, | |||
| 0x0228, 0x1818, 0x243c, 0x3e04, 0x0e4c, | |||
| 0x0128, 0x1918, 0x253c, 0x3d04, 0x0d4c, | |||
| 0x0028, 0x1a18, 0x263c, 0x3c04, 0x0c4c, | |||
| 0x002c, 0x1b18, 0x273c, 0x3c08, 0x0c50, | |||
| 0x012c, 0x1c18, 0x283c, 0x3d08, 0x0d50, | |||
| 0x022c, 0x1d18, 0x293c, 0x3e08, 0x0e50, | |||
| 0x032c, 0x1d1c, 0x2940, 0x3f08, 0x0f50, | |||
| 0x042c, 0x1c1c, 0x2840, 0x4008, 0x1050, | |||
| 0x052c, 0x1b1c, 0x2740, 0x4108, 0x1150, | |||
| 0x0530, 0x1a1c, 0x2640, 0x410c, 0x1154, | |||
| 0x0430, 0x191c, 0x2540, 0x400c, 0x1054, | |||
| 0x0330, 0x181c, 0x2440, 0x3f0c, 0x0f54, | |||
| 0x0230, 0x1820, 0x2444, 0x3e0c, 0x0e54, | |||
| 0x0130, 0x1920, 0x2544, 0x3d0c, 0x0d54, | |||
| 0x0030, 0x1a20, 0x2644, 0x3c0c, 0x0c54, | |||
| 0x0034, 0x1b20, 0x2744, 0x3c10, 0x0c58, | |||
| 0x0134, 0x1c20, 0x2844, 0x3d10, 0x0e58, | |||
| 0x0234, 0x1d20, 0x2944, 0x3e10, 0x1058, | |||
| 0x0624, 0x2110, 0x2d34, 0x4200, 0x1248, | |||
| 0x0724, 0x2210, 0x2e34, 0x4300, 0x1348, | |||
| 0x0824, 0x2310, 0x2f34, 0x4400, 0x1448, | |||
| 0x0924, 0x2314, 0x2f38, 0x4500, 0x1548, | |||
| 0x0a24, 0x2214, 0x2e38, 0x4600, 0x1648, | |||
| 0x0b24, 0x2114, 0x2d38, 0x4700, 0x1748, | |||
| 0x0b28, 0x2014, 0x2c38, 0x4704, 0x174c, | |||
| 0x0a28, 0x1f14, 0x2b38, 0x4604, 0x164c, | |||
| 0x0928, 0x1e14, 0x2a38, 0x4504, 0x154c, | |||
| 0x0828, 0x1e18, 0x2a3c, 0x4404, 0x144c, | |||
| 0x0728, 0x1f18, 0x2b3c, 0x4304, 0x134c, | |||
| 0x0628, 0x2018, 0x2c3c, 0x4204, 0x124c, | |||
| 0x062c, 0x2118, 0x2d3c, 0x4208, 0x1250, | |||
| 0x072c, 0x2218, 0x2e3c, 0x4308, 0x1350, | |||
| 0x082c, 0x2318, 0x2f3c, 0x4408, 0x1450, | |||
| 0x092c, 0x231c, 0x2f40, 0x4508, 0x1550, | |||
| 0x0a2c, 0x221c, 0x2e40, 0x4608, 0x1650, | |||
| 0x0b2c, 0x211c, 0x2d40, 0x4708, 0x1750, | |||
| 0x0b30, 0x201c, 0x2c40, 0x470c, 0x1754, | |||
| 0x0a30, 0x1f1c, 0x2b40, 0x460c, 0x1654, | |||
| 0x0930, 0x1e1c, 0x2a40, 0x450c, 0x1554, | |||
| 0x0830, 0x1e20, 0x2a44, 0x440c, 0x1454, | |||
| 0x0730, 0x1f20, 0x2b44, 0x430c, 0x1354, | |||
| 0x0630, 0x2020, 0x2c44, 0x420c, 0x1254, | |||
| 0x0634, 0x2120, 0x2d44, 0x4210, 0x1258, | |||
| 0x0734, 0x2220, 0x2e44, 0x4310, 0x1458, | |||
| 0x0834, 0x2320, 0x2f44, 0x4410, 0x1658, | |||
| }; | |||
| @@ -1262,7 +1262,7 @@ static const uint16_t dv_audio_shuffle525[10][9] = { | |||
| { 12, 42, 72, 2, 32, 62, 22, 52, 82 }, | |||
| { 18, 48, 78, 8, 38, 68, 28, 58, 88 }, | |||
| { 24, 54, 84, 14, 44, 74, 4, 34, 64 }, | |||
| { 1, 31, 61, 21, 51, 81, 11, 41, 71 }, /* 2nd channel */ | |||
| { 7, 37, 67, 27, 57, 87, 17, 47, 77 }, | |||
| { 13, 43, 73, 3, 33, 63, 23, 53, 83 }, | |||
| @@ -1275,21 +1275,21 @@ static const uint16_t dv_audio_shuffle625[12][9] = { | |||
| { 6, 42, 78, 32, 68, 104, 22, 58, 94}, | |||
| { 12, 48, 84, 2, 38, 74, 28, 64, 100}, | |||
| { 18, 54, 90, 8, 44, 80, 34, 70, 106}, | |||
| { 24, 60, 96, 14, 50, 86, 4, 40, 76}, | |||
| { 24, 60, 96, 14, 50, 86, 4, 40, 76}, | |||
| { 30, 66, 102, 20, 56, 92, 10, 46, 82}, | |||
| { 1, 37, 73, 27, 63, 99, 17, 53, 89}, /* 2nd channel */ | |||
| { 7, 43, 79, 33, 69, 105, 23, 59, 95}, | |||
| { 13, 49, 85, 3, 39, 75, 29, 65, 101}, | |||
| { 19, 55, 91, 9, 45, 81, 35, 71, 107}, | |||
| { 25, 61, 97, 15, 51, 87, 5, 41, 77}, | |||
| { 25, 61, 97, 15, 51, 87, 5, 41, 77}, | |||
| { 31, 67, 103, 21, 57, 93, 11, 47, 83}, | |||
| }; | |||
| static const __attribute__((unused)) int dv_audio_frequency[3] = { | |||
| 48000, 44100, 32000, | |||
| }; | |||
| static const DVprofile dv_profiles[] = { | |||
| { .dsf = 0, | |||
| .frame_size = 120000, /* IEC 61834, SMPTE-314M - 525/60 (NTSC) */ | |||
| @@ -1306,7 +1306,7 @@ static const DVprofile dv_profiles[] = { | |||
| .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32Khz */ | |||
| .audio_samples_dist = { 1602, 1601, 1602, 1601, 1602 }, | |||
| .audio_shuffle = dv_audio_shuffle525, | |||
| }, | |||
| }, | |||
| { .dsf = 1, | |||
| .frame_size = 144000, /* IEC 61834 - 625/50 (PAL) */ | |||
| .difseg_size = 12, | |||
| @@ -1349,7 +1349,7 @@ static inline const DVprofile* dv_frame_profile(uint8_t* frame) | |||
| else if ((frame[5] & 0x07) == 0) { /* APT flag */ | |||
| return &dv_profiles[1]; | |||
| } | |||
| else | |||
| else | |||
| return &dv_profiles[2]; | |||
| } | |||
| @@ -1357,10 +1357,10 @@ static inline const DVprofile* dv_codec_profile(AVCodecContext* codec) | |||
| { | |||
| if (codec->width != 720) { | |||
| return NULL; | |||
| } | |||
| } | |||
| else if (codec->height == 480) { | |||
| return &dv_profiles[0]; | |||
| } | |||
| else | |||
| } | |||
| else | |||
| return &dv_profiles[1]; | |||
| } | |||
| @@ -38,7 +38,7 @@ int get_nibble(const uint8_t *buf, int nibble_offset) | |||
| return (buf[nibble_offset >> 1] >> ((1 - (nibble_offset & 1)) << 2)) & 0xf; | |||
| } | |||
| static int decode_rle(uint8_t *bitmap, int linesize, int w, int h, | |||
| static int decode_rle(uint8_t *bitmap, int linesize, int w, int h, | |||
| const uint8_t *buf, int nibble_offset, int buf_size) | |||
| { | |||
| unsigned int v; | |||
| @@ -91,7 +91,7 @@ static void guess_palette(uint32_t *rgba_palette, | |||
| { | |||
| uint8_t color_used[16]; | |||
| int nb_opaque_colors, i, level, j, r, g, b; | |||
| for(i = 0; i < 4; i++) | |||
| rgba_palette[i] = 0; | |||
| @@ -103,10 +103,10 @@ static void guess_palette(uint32_t *rgba_palette, | |||
| nb_opaque_colors++; | |||
| } | |||
| } | |||
| if (nb_opaque_colors == 0) | |||
| return; | |||
| j = nb_opaque_colors; | |||
| memset(color_used, 0, 16); | |||
| for(i = 0; i < 4; i++) { | |||
| @@ -127,7 +127,7 @@ static void guess_palette(uint32_t *rgba_palette, | |||
| } | |||
| } | |||
| static int decode_dvd_subtitles(AVSubtitle *sub_header, | |||
| static int decode_dvd_subtitles(AVSubtitle *sub_header, | |||
| const uint8_t *buf, int buf_size) | |||
| { | |||
| int cmd_pos, pos, cmd, x1, y1, x2, y2, offset1, offset2, next_cmd_pos; | |||
| @@ -135,7 +135,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header, | |||
| int date; | |||
| int i; | |||
| int is_menu = 0; | |||
| if (buf_size < 4) | |||
| return -1; | |||
| sub_header->rects = NULL; | |||
| @@ -148,7 +148,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header, | |||
| date = getbe16(buf + cmd_pos); | |||
| next_cmd_pos = getbe16(buf + cmd_pos + 2); | |||
| #ifdef DEBUG | |||
| av_log(NULL, AV_LOG_INFO, "cmd_pos=0x%04x next=0x%04x date=%d\n", | |||
| av_log(NULL, AV_LOG_INFO, "cmd_pos=0x%04x next=0x%04x date=%d\n", | |||
| cmd_pos, next_cmd_pos, date); | |||
| #endif | |||
| pos = cmd_pos + 4; | |||
| @@ -228,7 +228,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header, | |||
| if (offset1 >= 0) { | |||
| int w, h; | |||
| uint8_t *bitmap; | |||
| /* decode the bitmap */ | |||
| w = x2 - x1 + 1; | |||
| if (w < 0) | |||
| @@ -275,7 +275,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header, | |||
| return -1; | |||
| } | |||
| static int is_transp(const uint8_t *buf, int pitch, int n, | |||
| static int is_transp(const uint8_t *buf, int pitch, int n, | |||
| const uint8_t *transp_color) | |||
| { | |||
| int i; | |||
| @@ -395,7 +395,7 @@ static int dvdsub_decode(AVCodecContext *avctx, | |||
| goto no_subtitle; | |||
| #if defined(DEBUG) | |||
| av_log(NULL, AV_LOG_INFO, "start=%d ms end =%d ms\n", | |||
| av_log(NULL, AV_LOG_INFO, "start=%d ms end =%d ms\n", | |||
| sub->start_display_time, | |||
| sub->end_display_time); | |||
| ppm_save("/tmp/a.ppm", sub->rects[0].bitmap, | |||
| @@ -431,11 +431,11 @@ static int dvdsub_parse_init(AVCodecParserContext *s) | |||
| static int dvdsub_parse(AVCodecParserContext *s, | |||
| AVCodecContext *avctx, | |||
| uint8_t **poutbuf, int *poutbuf_size, | |||
| uint8_t **poutbuf, int *poutbuf_size, | |||
| const uint8_t *buf, int buf_size) | |||
| { | |||
| DVDSubParseContext *pc = s->priv_data; | |||
| if (pc->packet_index == 0) { | |||
| if (buf_size < 2) | |||
| return 0; | |||
| @@ -190,7 +190,7 @@ static int encode_dvd_subtitles(uint8_t *outbuf, int outbuf_size, | |||
| *q++ = h->rects[object_id].y >> 4; | |||
| *q++ = (h->rects[object_id].y << 4) | ((y2 >> 8) & 0xf); | |||
| *q++ = y2; | |||
| *q++ = 0x06; | |||
| // offset1, offset2 | |||
| putbe16(&q, offset1[object_id]); | |||
| @@ -207,7 +207,7 @@ static int encode_dvd_subtitles(uint8_t *outbuf, int outbuf_size, | |||
| qq = outbuf; | |||
| putbe16(&qq, q - outbuf); | |||
| av_log(NULL, AV_LOG_DEBUG, "subtitle_packet size=%td\n", q - outbuf); | |||
| return q - outbuf; | |||
| } | |||
| @@ -17,14 +17,14 @@ | |||
| * License along with this library; if not, write to the Free Software | |||
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
| */ | |||
| /** | |||
| * @file error_resilience.c | |||
| * Error resilience / concealment. | |||
| */ | |||
| #include <limits.h> | |||
| #include "avcodec.h" | |||
| #include "dsputil.h" | |||
| #include "mpegvideo.h" | |||
| @@ -35,7 +35,7 @@ static void decode_mb(MpegEncContext *s){ | |||
| s->dest[1] = s->current_picture.data[1] + (s->mb_y * 8 * s->uvlinesize) + s->mb_x * 8; | |||
| s->dest[2] = s->current_picture.data[2] + (s->mb_y * 8 * s->uvlinesize) + s->mb_x * 8; | |||
| MPV_decode_mb(s, s->block); | |||
| MPV_decode_mb(s, s->block); | |||
| } | |||
| /** | |||
| @@ -79,8 +79,8 @@ static void filter181(int16_t *data, int width, int height, int stride){ | |||
| for(x=1; x<width-1; x++){ | |||
| int dc; | |||
| dc= - prev_dc | |||
| dc= - prev_dc | |||
| + data[x + y*stride]*8 | |||
| - data[x + 1 + y*stride]; | |||
| dc= (dc*10923 + 32768)>>16; | |||
| @@ -88,15 +88,15 @@ static void filter181(int16_t *data, int width, int height, int stride){ | |||
| data[x + y*stride]= dc; | |||
| } | |||
| } | |||
| /* vertical filter */ | |||
| for(x=1; x<width-1; x++){ | |||
| int prev_dc= data[x]; | |||
| for(y=1; y<height-1; y++){ | |||
| int dc; | |||
| dc= - prev_dc | |||
| dc= - prev_dc | |||
| + data[x + y *stride]*8 | |||
| - data[x + (y+1)*stride]; | |||
| dc= (dc*10923 + 32768)>>16; | |||
| @@ -120,14 +120,14 @@ static void guess_dc(MpegEncContext *s, int16_t *dc, int w, int h, int stride, i | |||
| int distance[4]={9999,9999,9999,9999}; | |||
| int mb_index, error, j; | |||
| int64_t guess, weight_sum; | |||
| mb_index= (b_x>>is_luma) + (b_y>>is_luma)*s->mb_stride; | |||
| error= s->error_status_table[mb_index]; | |||
| if(IS_INTER(s->current_picture.mb_type[mb_index])) continue; //inter | |||
| if(!(error&DC_ERROR)) continue; //dc-ok | |||
| /* right block */ | |||
| for(j=b_x+1; j<w; j++){ | |||
| int mb_index_j= (j>>is_luma) + (b_y>>is_luma)*s->mb_stride; | |||
| @@ -139,7 +139,7 @@ static void guess_dc(MpegEncContext *s, int16_t *dc, int w, int h, int stride, i | |||
| break; | |||
| } | |||
| } | |||
| /* left block */ | |||
| for(j=b_x-1; j>=0; j--){ | |||
| int mb_index_j= (j>>is_luma) + (b_y>>is_luma)*s->mb_stride; | |||
| @@ -175,7 +175,7 @@ static void guess_dc(MpegEncContext *s, int16_t *dc, int w, int h, int stride, i | |||
| break; | |||
| } | |||
| } | |||
| weight_sum=0; | |||
| guess=0; | |||
| for(j=0; j<4; j++){ | |||
| @@ -211,28 +211,28 @@ static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st | |||
| int offset= b_x*8 + b_y*stride*8; | |||
| int16_t *left_mv= s->current_picture.motion_val[0][s->b8_stride*(b_y<<(1-is_luma)) + ( b_x <<(1-is_luma))]; | |||
| int16_t *right_mv= s->current_picture.motion_val[0][s->b8_stride*(b_y<<(1-is_luma)) + ((b_x+1)<<(1-is_luma))]; | |||
| if(!(left_damage||right_damage)) continue; // both undamaged | |||
| if( (!left_intra) && (!right_intra) | |||
| if( (!left_intra) && (!right_intra) | |||
| && ABS(left_mv[0]-right_mv[0]) + ABS(left_mv[1]+right_mv[1]) < 2) continue; | |||
| for(y=0; y<8; y++){ | |||
| int a,b,c,d; | |||
| a= dst[offset + 7 + y*stride] - dst[offset + 6 + y*stride]; | |||
| b= dst[offset + 8 + y*stride] - dst[offset + 7 + y*stride]; | |||
| c= dst[offset + 9 + y*stride] - dst[offset + 8 + y*stride]; | |||
| d= ABS(b) - ((ABS(a) + ABS(c) + 1)>>1); | |||
| d= FFMAX(d, 0); | |||
| if(b<0) d= -d; | |||
| if(d==0) continue; | |||
| if(!(left_damage && right_damage)) | |||
| d= d*16/9; | |||
| if(left_damage){ | |||
| dst[offset + 7 + y*stride] = cm[dst[offset + 7 + y*stride] + ((d*7)>>4)]; | |||
| dst[offset + 6 + y*stride] = cm[dst[offset + 6 + y*stride] + ((d*5)>>4)]; | |||
| @@ -271,28 +271,28 @@ static void v_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st | |||
| int offset= b_x*8 + b_y*stride*8; | |||
| int16_t *top_mv= s->current_picture.motion_val[0][s->b8_stride*( b_y <<(1-is_luma)) + (b_x<<(1-is_luma))]; | |||
| int16_t *bottom_mv= s->current_picture.motion_val[0][s->b8_stride*((b_y+1)<<(1-is_luma)) + (b_x<<(1-is_luma))]; | |||
| if(!(top_damage||bottom_damage)) continue; // both undamaged | |||
| if( (!top_intra) && (!bottom_intra) | |||
| if( (!top_intra) && (!bottom_intra) | |||
| && ABS(top_mv[0]-bottom_mv[0]) + ABS(top_mv[1]+bottom_mv[1]) < 2) continue; | |||
| for(x=0; x<8; x++){ | |||
| int a,b,c,d; | |||
| a= dst[offset + x + 7*stride] - dst[offset + x + 6*stride]; | |||
| b= dst[offset + x + 8*stride] - dst[offset + x + 7*stride]; | |||
| c= dst[offset + x + 9*stride] - dst[offset + x + 8*stride]; | |||
| d= ABS(b) - ((ABS(a) + ABS(c)+1)>>1); | |||
| d= FFMAX(d, 0); | |||
| if(b<0) d= -d; | |||
| if(d==0) continue; | |||
| if(!(top_damage && bottom_damage)) | |||
| d= d*16/9; | |||
| if(top_damage){ | |||
| dst[offset + x + 7*stride] = cm[dst[offset + x + 7*stride] + ((d*7)>>4)]; | |||
| dst[offset + x + 6*stride] = cm[dst[offset + x + 6*stride] + ((d*5)>>4)]; | |||
| @@ -320,7 +320,7 @@ static void guess_mv(MpegEncContext *s){ | |||
| const int mb_height= s->mb_height; | |||
| int i, depth, num_avail; | |||
| int mb_x, mb_y; | |||
| num_avail=0; | |||
| for(i=0; i<s->mb_num; i++){ | |||
| const int mb_xy= s->mb_index2xy[ i ]; | |||
| @@ -329,17 +329,17 @@ static void guess_mv(MpegEncContext *s){ | |||
| if(IS_INTRA(s->current_picture.mb_type[mb_xy])) f=MV_FROZEN; //intra //FIXME check | |||
| if(!(error&MV_ERROR)) f=MV_FROZEN; //inter with undamaged MV | |||
| fixed[mb_xy]= f; | |||
| if(f==MV_FROZEN) | |||
| num_avail++; | |||
| } | |||
| if((!(s->avctx->error_concealment&FF_EC_GUESS_MVS)) || num_avail <= mb_width/2){ | |||
| for(mb_y=0; mb_y<s->mb_height; mb_y++){ | |||
| for(mb_x=0; mb_x<s->mb_width; mb_x++){ | |||
| const int mb_xy= mb_x + mb_y*s->mb_stride; | |||
| if(IS_INTRA(s->current_picture.mb_type[mb_xy])) continue; | |||
| if(!(s->error_status_table[mb_xy]&MV_ERROR)) continue; | |||
| @@ -359,7 +359,7 @@ static void guess_mv(MpegEncContext *s){ | |||
| } | |||
| return; | |||
| } | |||
| for(depth=0;; depth++){ | |||
| int changed, pass, none_left; | |||
| @@ -368,7 +368,7 @@ static void guess_mv(MpegEncContext *s){ | |||
| for(pass=0; (changed || pass<2) && pass<10; pass++){ | |||
| int mb_x, mb_y; | |||
| int score_sum=0; | |||
| changed=0; | |||
| for(mb_y=0; mb_y<s->mb_height; mb_y++){ | |||
| for(mb_x=0; mb_x<s->mb_width; mb_x++){ | |||
| @@ -384,11 +384,11 @@ int score_sum=0; | |||
| int prev_y= s->current_picture.motion_val[0][mot_index][1]; | |||
| if((mb_x^mb_y^pass)&1) continue; | |||
| if(fixed[mb_xy]==MV_FROZEN) continue; | |||
| assert(!IS_INTRA(s->current_picture.mb_type[mb_xy])); | |||
| assert(s->last_picture_ptr && s->last_picture_ptr->data[0]); | |||
| j=0; | |||
| if(mb_x>0 && fixed[mb_xy-1 ]==MV_FROZEN) j=1; | |||
| if(mb_x+1<mb_width && fixed[mb_xy+1 ]==MV_FROZEN) j=1; | |||
| @@ -402,9 +402,9 @@ int score_sum=0; | |||
| if(mb_y>0 && fixed[mb_xy-mb_stride]==MV_CHANGED) j=1; | |||
| if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]==MV_CHANGED) j=1; | |||
| if(j==0 && pass>1) continue; | |||
| none_left=0; | |||
| if(mb_x>0 && fixed[mb_xy-1]){ | |||
| mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index - 2][0]; | |||
| mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index - 2][1]; | |||
| @@ -426,7 +426,7 @@ int score_sum=0; | |||
| pred_count++; | |||
| } | |||
| if(pred_count==0) continue; | |||
| if(pred_count>1){ | |||
| int sum_x=0, sum_y=0; | |||
| int max_x, max_y, min_x, min_y; | |||
| @@ -435,11 +435,11 @@ int score_sum=0; | |||
| sum_x+= mv_predictor[j][0]; | |||
| sum_y+= mv_predictor[j][1]; | |||
| } | |||
| /* mean */ | |||
| mv_predictor[pred_count][0] = sum_x/j; | |||
| mv_predictor[pred_count][1] = sum_y/j; | |||
| /* median */ | |||
| if(pred_count>=3){ | |||
| min_y= min_x= 99999; | |||
| @@ -455,22 +455,22 @@ int score_sum=0; | |||
| } | |||
| mv_predictor[pred_count+1][0] = sum_x - max_x - min_x; | |||
| mv_predictor[pred_count+1][1] = sum_y - max_y - min_y; | |||
| if(pred_count==4){ | |||
| mv_predictor[pred_count+1][0] /= 2; | |||
| mv_predictor[pred_count+1][1] /= 2; | |||
| } | |||
| pred_count+=2; | |||
| } | |||
| /* zero MV */ | |||
| pred_count++; | |||
| /* last MV */ | |||
| mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index][0]; | |||
| mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index][1]; | |||
| pred_count++; | |||
| pred_count++; | |||
| s->mv_dir = MV_DIR_FORWARD; | |||
| s->mb_intra=0; | |||
| s->mv_type = MV_TYPE_16X16; | |||
| @@ -489,7 +489,7 @@ int score_sum=0; | |||
| s->current_picture.motion_val[0][mot_index][1]= s->mv[0][0][1]= mv_predictor[j][1]; | |||
| decode_mb(s); | |||
| if(mb_x>0 && fixed[mb_xy-1]){ | |||
| int k; | |||
| for(k=0; k<16; k++) | |||
| @@ -510,7 +510,7 @@ int score_sum=0; | |||
| for(k=0; k<16; k++) | |||
| score += ABS(src[k+s->linesize*15]-src[k+s->linesize*16]); | |||
| } | |||
| if(score <= best_score){ // <= will favor the last MV | |||
| best_score= score; | |||
| best_pred= j; | |||
| @@ -523,7 +523,7 @@ score_sum+= best_score; | |||
| decode_mb(s); | |||
| if(s->mv[0][0][0] != prev_x || s->mv[0][0][1] != prev_y){ | |||
| fixed[mb_xy]=MV_CHANGED; | |||
| changed++; | |||
| @@ -534,10 +534,10 @@ score_sum+= best_score; | |||
| // printf(".%d/%d", changed, score_sum); fflush(stdout); | |||
| } | |||
| if(none_left) | |||
| if(none_left) | |||
| return; | |||
| for(i=0; i<s->mb_num; i++){ | |||
| int mb_xy= s->mb_index2xy[i]; | |||
| if(fixed[mb_xy]) | |||
| @@ -546,10 +546,10 @@ score_sum+= best_score; | |||
| // printf(":"); fflush(stdout); | |||
| } | |||
| } | |||
| static int is_intra_more_likely(MpegEncContext *s){ | |||
| int is_intra_likely, i, j, undamaged_count, skip_amount, mb_x, mb_y; | |||
| if(s->last_picture_ptr==NULL) return 1; //no previous frame available -> use spatial prediction | |||
| undamaged_count=0; | |||
| @@ -559,10 +559,10 @@ static int is_intra_more_likely(MpegEncContext *s){ | |||
| if(!((error&DC_ERROR) && (error&MV_ERROR))) | |||
| undamaged_count++; | |||
| } | |||
| if(undamaged_count < 5) return 0; //allmost all MBs damaged -> use temporal prediction | |||
| skip_amount= FFMAX(undamaged_count/50, 1); //check only upto 50 MBs | |||
| skip_amount= FFMAX(undamaged_count/50, 1); //check only upto 50 MBs | |||
| is_intra_likely=0; | |||
| j=0; | |||
| @@ -574,14 +574,14 @@ static int is_intra_more_likely(MpegEncContext *s){ | |||
| error= s->error_status_table[mb_xy]; | |||
| if((error&DC_ERROR) && (error&MV_ERROR)) | |||
| continue; //skip damaged | |||
| j++; | |||
| j++; | |||
| if((j%skip_amount) != 0) continue; //skip a few to speed things up | |||
| if(s->pict_type==I_TYPE){ | |||
| uint8_t *mb_ptr = s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize; | |||
| uint8_t *last_mb_ptr= s->last_picture.data [0] + mb_x*16 + mb_y*16*s->linesize; | |||
| is_intra_likely += s->dsp.sad[0](NULL, last_mb_ptr, mb_ptr , s->linesize, 16); | |||
| is_intra_likely -= s->dsp.sad[0](NULL, last_mb_ptr, last_mb_ptr+s->linesize*16, s->linesize, 16); | |||
| }else{ | |||
| @@ -593,7 +593,7 @@ static int is_intra_more_likely(MpegEncContext *s){ | |||
| } | |||
| } | |||
| //printf("is_intra_likely: %d type:%d\n", is_intra_likely, s->pict_type); | |||
| return is_intra_likely > 0; | |||
| return is_intra_likely > 0; | |||
| } | |||
| void ff_er_frame_start(MpegEncContext *s){ | |||
| @@ -615,7 +615,7 @@ void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int en | |||
| const int start_xy= s->mb_index2xy[start_i]; | |||
| const int end_xy = s->mb_index2xy[end_i]; | |||
| int mask= -1; | |||
| if(!s->error_resilience) return; | |||
| mask &= ~VP_START; | |||
| @@ -643,18 +643,18 @@ void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int en | |||
| } | |||
| } | |||
| if(end_i == s->mb_num) | |||
| if(end_i == s->mb_num) | |||
| s->error_count= INT_MAX; | |||
| else{ | |||
| s->error_status_table[end_xy] &= mask; | |||
| s->error_status_table[end_xy] |= status; | |||
| } | |||
| s->error_status_table[start_xy] |= VP_START; | |||
| if(start_xy > 0 && s->avctx->thread_count <= 1 && s->avctx->skip_top*s->mb_width < start_i){ | |||
| int prev_status= s->error_status_table[ s->mb_index2xy[start_i - 1] ]; | |||
| prev_status &= ~ VP_START; | |||
| if(prev_status != (MV_END|DC_END|AC_END)) s->error_count= INT_MAX; | |||
| } | |||
| @@ -668,13 +668,13 @@ void ff_er_frame_end(MpegEncContext *s){ | |||
| int is_intra_likely; | |||
| int size = s->b8_stride * 2 * s->mb_height; | |||
| Picture *pic= s->current_picture_ptr; | |||
| if(!s->error_resilience || s->error_count==0 || | |||
| if(!s->error_resilience || s->error_count==0 || | |||
| s->error_count==3*s->mb_width*(s->avctx->skip_top + s->avctx->skip_bottom)) return; | |||
| if(s->current_picture.motion_val[0] == NULL){ | |||
| av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\n"); | |||
| for(i=0; i<2; i++){ | |||
| pic->ref_index[i]= av_mallocz(size * sizeof(uint8_t)); | |||
| pic->motion_val_base[i]= av_mallocz((size+4) * 2 * sizeof(uint16_t)); | |||
| @@ -683,7 +683,7 @@ void ff_er_frame_end(MpegEncContext *s){ | |||
| pic->motion_subsample_log2= 3; | |||
| s->current_picture= *s->current_picture_ptr; | |||
| } | |||
| for(i=0; i<2; i++){ | |||
| if(pic->ref_index[i]) | |||
| memset(pic->ref_index[i], 0, size * sizeof(uint8_t)); | |||
| @@ -693,13 +693,13 @@ void ff_er_frame_end(MpegEncContext *s){ | |||
| for(mb_y=0; mb_y<s->mb_height; mb_y++){ | |||
| for(mb_x=0; mb_x<s->mb_width; mb_x++){ | |||
| int status= s->error_status_table[mb_x + mb_y*s->mb_stride]; | |||
| av_log(s->avctx, AV_LOG_DEBUG, "%2X ", status); | |||
| av_log(s->avctx, AV_LOG_DEBUG, "%2X ", status); | |||
| } | |||
| av_log(s->avctx, AV_LOG_DEBUG, "\n"); | |||
| } | |||
| } | |||
| #if 1 | |||
| /* handle overlapping slices */ | |||
| for(error_type=1; error_type<=3; error_type++){ | |||
| @@ -708,7 +708,7 @@ void ff_er_frame_end(MpegEncContext *s){ | |||
| for(i=s->mb_num-1; i>=0; i--){ | |||
| const int mb_xy= s->mb_index2xy[i]; | |||
| int error= s->error_status_table[mb_xy]; | |||
| if(error&(1<<error_type)) | |||
| end_ok=1; | |||
| if(error&(8<<error_type)) | |||
| @@ -730,7 +730,7 @@ void ff_er_frame_end(MpegEncContext *s){ | |||
| for(i=s->mb_num-1; i>=0; i--){ | |||
| const int mb_xy= s->mb_index2xy[i]; | |||
| int error= s->error_status_table[mb_xy]; | |||
| if(error&AC_END) | |||
| end_ok=0; | |||
| if((error&MV_END) || (error&DC_END) || (error&AC_ERROR)) | |||
| @@ -747,26 +747,26 @@ void ff_er_frame_end(MpegEncContext *s){ | |||
| /* handle missing slices */ | |||
| if(s->error_resilience>=4){ | |||
| int end_ok=1; | |||
| for(i=s->mb_num-2; i>=s->mb_width+100; i--){ //FIXME +100 hack | |||
| const int mb_xy= s->mb_index2xy[i]; | |||
| int error1= s->error_status_table[mb_xy ]; | |||
| int error2= s->error_status_table[s->mb_index2xy[i+1]]; | |||
| if(error1&VP_START) | |||
| end_ok=1; | |||
| if( error2==(VP_START|DC_ERROR|AC_ERROR|MV_ERROR|AC_END|DC_END|MV_END) | |||
| && error1!=(VP_START|DC_ERROR|AC_ERROR|MV_ERROR|AC_END|DC_END|MV_END) | |||
| && error1!=(VP_START|DC_ERROR|AC_ERROR|MV_ERROR|AC_END|DC_END|MV_END) | |||
| && ((error1&AC_END) || (error1&DC_END) || (error1&MV_END))){ //end & uninited | |||
| end_ok=0; | |||
| } | |||
| if(!end_ok) | |||
| s->error_status_table[mb_xy]|= DC_ERROR|AC_ERROR|MV_ERROR; | |||
| } | |||
| } | |||
| #if 1 | |||
| /* backward mark errors */ | |||
| distance=9999999; | |||
| @@ -774,9 +774,9 @@ void ff_er_frame_end(MpegEncContext *s){ | |||
| for(i=s->mb_num-1; i>=0; i--){ | |||
| const int mb_xy= s->mb_index2xy[i]; | |||
| int error= s->error_status_table[mb_xy]; | |||
| if(!s->mbskip_table[mb_xy]) //FIXME partition specific | |||
| distance++; | |||
| distance++; | |||
| if(error&(1<<error_type)) | |||
| distance= 0; | |||
| @@ -799,7 +799,7 @@ void ff_er_frame_end(MpegEncContext *s){ | |||
| for(i=0; i<s->mb_num; i++){ | |||
| const int mb_xy= s->mb_index2xy[i]; | |||
| int old_error= s->error_status_table[mb_xy]; | |||
| if(old_error&VP_START) | |||
| error= old_error& (DC_ERROR|AC_ERROR|MV_ERROR); | |||
| else{ | |||
| @@ -844,7 +844,7 @@ void ff_er_frame_end(MpegEncContext *s){ | |||
| else | |||
| s->current_picture.mb_type[mb_xy]= MB_TYPE_16x16 | MB_TYPE_L0; | |||
| } | |||
| /* handle inter blocks with damaged AC */ | |||
| for(mb_y=0; mb_y<s->mb_height; mb_y++){ | |||
| for(mb_x=0; mb_x<s->mb_width; mb_x++){ | |||
| @@ -855,7 +855,7 @@ void ff_er_frame_end(MpegEncContext *s){ | |||
| if(IS_INTRA(mb_type)) continue; //intra | |||
| if(error&MV_ERROR) continue; //inter with damaged MV | |||
| if(!(error&AC_ERROR)) continue; //undamaged inter | |||
| s->mv_dir = MV_DIR_FORWARD; | |||
| s->mb_intra=0; | |||
| s->mb_skipped=0; | |||
| @@ -872,7 +872,7 @@ void ff_er_frame_end(MpegEncContext *s){ | |||
| s->mv[0][0][0] = s->current_picture.motion_val[0][ mb_x*2 + mb_y*2*s->b8_stride ][0]; | |||
| s->mv[0][0][1] = s->current_picture.motion_val[0][ mb_x*2 + mb_y*2*s->b8_stride ][1]; | |||
| } | |||
| s->dsp.clear_blocks(s->block[0]); | |||
| s->mb_x= mb_x; | |||
| @@ -893,16 +893,16 @@ void ff_er_frame_end(MpegEncContext *s){ | |||
| if(IS_INTRA(mb_type)) continue; | |||
| if(!(error&MV_ERROR)) continue; //inter with undamaged MV | |||
| if(!(error&AC_ERROR)) continue; //undamaged inter | |||
| s->mv_dir = MV_DIR_FORWARD|MV_DIR_BACKWARD; | |||
| s->mb_intra=0; | |||
| s->mv_type = MV_TYPE_16X16; | |||
| s->mb_skipped=0; | |||
| if(s->pp_time){ | |||
| int time_pp= s->pp_time; | |||
| int time_pb= s->pb_time; | |||
| s->mv[0][0][0] = s->next_picture.motion_val[0][xy][0]*time_pb/time_pp; | |||
| s->mv[0][0][1] = s->next_picture.motion_val[0][xy][1]*time_pb/time_pp; | |||
| s->mv[1][0][0] = s->next_picture.motion_val[0][xy][0]*(time_pb - time_pp)/time_pp; | |||
| @@ -935,16 +935,16 @@ void ff_er_frame_end(MpegEncContext *s){ | |||
| uint8_t *dest_y, *dest_cb, *dest_cr; | |||
| const int mb_xy= mb_x + mb_y * s->mb_stride; | |||
| const int mb_type= s->current_picture.mb_type[mb_xy]; | |||
| error= s->error_status_table[mb_xy]; | |||
| if(IS_INTRA(mb_type) && s->partitioned_frame) continue; | |||
| // if(error&MV_ERROR) continue; //inter data damaged FIXME is this good? | |||
| dest_y = s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize; | |||
| dest_cb= s->current_picture.data[1] + mb_x*8 + mb_y*8 *s->uvlinesize; | |||
| dest_cr= s->current_picture.data[2] + mb_x*8 + mb_y*8 *s->uvlinesize; | |||
| dc_ptr= &s->dc_val[0][mb_x*2 + mb_y*2*s->b8_stride]; | |||
| for(n=0; n<4; n++){ | |||
| dc=0; | |||
| @@ -966,7 +966,7 @@ void ff_er_frame_end(MpegEncContext *s){ | |||
| } | |||
| } | |||
| s->dc_val[1][mb_x + mb_y*s->mb_stride]= (dcu+4)>>3; | |||
| s->dc_val[2][mb_x + mb_y*s->mb_stride]= (dcv+4)>>3; | |||
| s->dc_val[2][mb_x + mb_y*s->mb_stride]= (dcv+4)>>3; | |||
| } | |||
| } | |||
| #if 1 | |||
| @@ -974,10 +974,10 @@ void ff_er_frame_end(MpegEncContext *s){ | |||
| guess_dc(s, s->dc_val[0], s->mb_width*2, s->mb_height*2, s->b8_stride, 1); | |||
| guess_dc(s, s->dc_val[1], s->mb_width , s->mb_height , s->mb_stride, 0); | |||
| guess_dc(s, s->dc_val[2], s->mb_width , s->mb_height , s->mb_stride, 0); | |||
| #endif | |||
| #endif | |||
| /* filter luma DC */ | |||
| filter181(s->dc_val[0], s->mb_width*2, s->mb_height*2, s->b8_stride); | |||
| #if 1 | |||
| /* render DC only intra */ | |||
| for(mb_y=0; mb_y<s->mb_height; mb_y++){ | |||
| @@ -990,16 +990,16 @@ void ff_er_frame_end(MpegEncContext *s){ | |||
| if(IS_INTER(mb_type)) continue; | |||
| if(!(error&AC_ERROR)) continue; //undamaged | |||
| dest_y = s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize; | |||
| dest_cb= s->current_picture.data[1] + mb_x*8 + mb_y*8 *s->uvlinesize; | |||
| dest_cr= s->current_picture.data[2] + mb_x*8 + mb_y*8 *s->uvlinesize; | |||
| put_dc(s, dest_y, dest_cb, dest_cr, mb_x, mb_y); | |||
| } | |||
| } | |||
| #endif | |||
| if(s->avctx->error_concealment&FF_EC_DEBLOCK){ | |||
| /* filter horizontal block boundaries */ | |||
| h_block_filter(s, s->current_picture.data[0], s->mb_width*2, s->mb_height*2, s->linesize , 1); | |||
| @@ -1019,10 +1019,10 @@ ec_clean: | |||
| for(i=0; i<s->mb_num; i++){ | |||
| const int mb_xy= s->mb_index2xy[i]; | |||
| int error= s->error_status_table[mb_xy]; | |||
| if(s->pict_type!=B_TYPE && (error&(DC_ERROR|MV_ERROR|AC_ERROR))){ | |||
| s->mbskip_table[mb_xy]=0; | |||
| } | |||
| s->mbintra_table[mb_xy]=1; | |||
| } | |||
| } | |||
| } | |||
| @@ -75,7 +75,7 @@ static double evalPrimary(Parser *p){ | |||
| p->s= next; | |||
| return d; | |||
| } | |||
| /* named constants */ | |||
| for(i=0; p->const_name && p->const_name[i]; i++){ | |||
| if(strmatch(p->s, p->const_name[i])){ | |||
| @@ -83,7 +83,7 @@ static double evalPrimary(Parser *p){ | |||
| return p->const_value[i]; | |||
| } | |||
| } | |||
| p->s= strchr(p->s, '('); | |||
| if(p->s==NULL){ | |||
| av_log(NULL, AV_LOG_ERROR, "Parser: missing ( in \"%s\"\n", next); | |||
| @@ -100,7 +100,7 @@ static double evalPrimary(Parser *p){ | |||
| return NAN; | |||
| } | |||
| 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); | |||
| @@ -140,7 +140,7 @@ static double evalPrimary(Parser *p){ | |||
| } | |||
| return d; | |||
| } | |||
| } | |||
| static double evalPow(Parser *p){ | |||
| int sign= (*p->s == '+') - (*p->s == '-'); | |||
| @@ -187,7 +187,7 @@ double ff_eval(char *s, double *const_value, const char **const_name, | |||
| double (**func2)(void *, double, double), char **func2_name, | |||
| void *opaque){ | |||
| Parser p; | |||
| p.stack_index=100; | |||
| p.s= s; | |||
| p.const_value= const_value; | |||
| @@ -197,12 +197,12 @@ double ff_eval(char *s, double *const_value, const char **const_name, | |||
| p.func2 = func2; | |||
| p.func2_name = func2_name; | |||
| p.opaque = opaque; | |||
| return evalExpression(&p); | |||
| } | |||
| #ifdef TEST | |||
| #undef printf | |||
| #undef printf | |||
| static double const_values[]={ | |||
| M_PI, | |||
| M_E, | |||
| @@ -216,7 +216,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)); | |||
| for(i=0; i<1050; i++){ | |||
| START_TIMER | |||
| 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); | |||
| @@ -16,7 +16,7 @@ | |||
| * License along with this library; if not, write to the Free Software | |||
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
| */ | |||
| /** | |||
| * @file faacaudio.c | |||
| * Interface to libfaac for aac encoding. | |||
| @@ -88,10 +88,10 @@ typedef struct { | |||
| unsigned long buffer_size); | |||
| char* FAADAPI (*faacDecGetErrorMessage)(unsigned char errcode); | |||
| #endif | |||
| void FAADAPI (*faacDecClose)(faacDecHandle hDecoder); | |||
| } FAACContext; | |||
| static const unsigned long faac_srates[] = | |||
| @@ -143,10 +143,10 @@ static int faac_decode_frame(AVCodecContext *avctx, | |||
| if(buf_size == 0) | |||
| return 0; | |||
| #ifndef FAAD2_VERSION | |||
| out = s->faacDecDecode(s->faac_handle, | |||
| (unsigned char*)buf, | |||
| &bytesconsumed, | |||
| data, | |||
| out = s->faacDecDecode(s->faac_handle, | |||
| (unsigned char*)buf, | |||
| &bytesconsumed, | |||
| data, | |||
| &samples); | |||
| samples *= s->sample_size; | |||
| if (data_size) | |||
| @@ -154,7 +154,7 @@ static int faac_decode_frame(AVCodecContext *avctx, | |||
| return (buf_size < (int)bytesconsumed) | |||
| ? buf_size : (int)bytesconsumed; | |||
| #else | |||
| out = s->faacDecDecode(s->faac_handle, &frame_info, (unsigned char*)buf, (unsigned long)buf_size); | |||
| if (frame_info.error > 0) { | |||
| @@ -21,7 +21,7 @@ | |||
| /** | |||
| * @file faandct.c | |||
| * @brief | |||
| * @brief | |||
| * Floating point AAN DCT | |||
| * @author Michael Niedermayer <michaelni@gmx.at> | |||
| */ | |||
| @@ -84,19 +84,19 @@ static always_inline void row_fdct(FLOAT temp[64], DCTELEM * data) | |||
| tmp5= data[2 + i] - data[5 + i]; | |||
| tmp3= data[3 + i] + data[4 + i]; | |||
| tmp4= data[3 + i] - data[4 + i]; | |||
| tmp10= tmp0 + tmp3; | |||
| tmp13= tmp0 - tmp3; | |||
| tmp11= tmp1 + tmp2; | |||
| tmp12= tmp1 - tmp2; | |||
| temp[0 + i]= tmp10 + tmp11; | |||
| temp[4 + i]= tmp10 - tmp11; | |||
| z1= (tmp12 + tmp13)*A1; | |||
| temp[2 + i]= tmp13 + z1; | |||
| temp[6 + i]= tmp13 - z1; | |||
| tmp10= tmp4 + tmp5; | |||
| tmp11= tmp5 + tmp6; | |||
| tmp12= tmp6 + tmp7; | |||
| @@ -113,7 +113,7 @@ static always_inline void row_fdct(FLOAT temp[64], DCTELEM * data) | |||
| temp[3 + i]= z13 - z2; | |||
| temp[1 + i]= z11 + z4; | |||
| temp[7 + i]= z11 - z4; | |||
| } | |||
| } | |||
| } | |||
| void ff_faandct(DCTELEM * data) | |||
| @@ -137,19 +137,19 @@ void ff_faandct(DCTELEM * data) | |||
| tmp5= temp[8*2 + i] - temp[8*5 + i]; | |||
| tmp3= temp[8*3 + i] + temp[8*4 + i]; | |||
| tmp4= temp[8*3 + i] - temp[8*4 + i]; | |||
| tmp10= tmp0 + tmp3; | |||
| tmp13= tmp0 - tmp3; | |||
| tmp11= tmp1 + tmp2; | |||
| tmp12= tmp1 - tmp2; | |||
| data[8*0 + i]= lrintf(SCALE(8*0 + i) * (tmp10 + tmp11)); | |||
| data[8*4 + i]= lrintf(SCALE(8*4 + i) * (tmp10 - tmp11)); | |||
| z1= (tmp12 + tmp13)* A1; | |||
| data[8*2 + i]= lrintf(SCALE(8*2 + i) * (tmp13 + z1)); | |||
| data[8*6 + i]= lrintf(SCALE(8*6 + i) * (tmp13 - z1)); | |||
| tmp10= tmp4 + tmp5; | |||
| tmp11= tmp5 + tmp6; | |||
| tmp12= tmp6 + tmp7; | |||
| @@ -190,19 +190,19 @@ void ff_faandct248(DCTELEM * data) | |||
| tmp5 = temp[8*2 + i] - temp[8*3 + i]; | |||
| tmp6 = temp[8*4 + i] - temp[8*5 + i]; | |||
| tmp7 = temp[8*6 + i] - temp[8*7 + i]; | |||
| tmp10 = tmp0 + tmp3; | |||
| tmp11 = tmp1 + tmp2; | |||
| tmp12 = tmp1 - tmp2; | |||
| tmp13 = tmp0 - tmp3; | |||
| data[8*0 + i] = lrintf(SCALE(8*0 + i) * (tmp10 + tmp11)); | |||
| data[8*4 + i] = lrintf(SCALE(8*4 + i) * (tmp10 - tmp11)); | |||
| z1 = (tmp12 + tmp13)* A1; | |||
| data[8*2 + i] = lrintf(SCALE(8*2 + i) * (tmp13 + z1)); | |||
| data[8*6 + i] = lrintf(SCALE(8*6 + i) * (tmp13 - z1)); | |||
| tmp10 = tmp4 + tmp7; | |||
| tmp11 = tmp5 + tmp6; | |||
| tmp12 = tmp5 - tmp6; | |||
| @@ -20,12 +20,12 @@ | |||
| /** | |||
| * @file faandct.h | |||
| * @brief | |||
| * @brief | |||
| * Floating point AAN DCT | |||
| * @author Michael Niedermayer <michaelni@gmx.at> | |||
| */ | |||
| #define FAAN_POSTSCALE | |||
| void ff_faandct(DCTELEM * data); | |||
| void ff_faandct248(DCTELEM * data); | |||
| @@ -141,7 +141,7 @@ short *block; | |||
| tmp[8*i+j] = partial_product; | |||
| } | |||
| /* Transpose operation is integrated into address mapping by switching | |||
| /* Transpose operation is integrated into address mapping by switching | |||
| loop order of i and j */ | |||
| for (j=0; j<8; j++) | |||
| @@ -122,7 +122,7 @@ void check_diff(float *tab1, float *tab2, int n) | |||
| for(i=0;i<n;i++) { | |||
| if (fabsf(tab1[i] - tab2[i]) >= 1e-3) { | |||
| av_log(NULL, AV_LOG_ERROR, "ERROR %d: %f %f\n", | |||
| av_log(NULL, AV_LOG_ERROR, "ERROR %d: %f %f\n", | |||
| i, tab1[i], tab2[i]); | |||
| } | |||
| } | |||
| @@ -220,7 +220,7 @@ int main(int argc, char **argv) | |||
| check_diff((float *)tab_ref, tab2, fft_size); | |||
| } else { | |||
| mdct_ref((float *)tab_ref, (float *)tab1, fft_size); | |||
| ff_mdct_calc(m, tab2, (float *)tab1, tabtmp); | |||
| check_diff((float *)tab_ref, tab2, fft_size / 2); | |||
| @@ -229,7 +229,7 @@ int main(int argc, char **argv) | |||
| memcpy(tab, tab1, fft_size * sizeof(FFTComplex)); | |||
| ff_fft_permute(s, tab); | |||
| ff_fft_calc(s, tab); | |||
| fft_ref(tab_ref, tab1, fft_nbits); | |||
| check_diff((float *)tab_ref, (float *)tab, fft_size * 2); | |||
| } | |||
| @@ -262,12 +262,12 @@ int main(int argc, char **argv) | |||
| break; | |||
| nb_its *= 2; | |||
| } | |||
| av_log(NULL, AV_LOG_INFO,"time: %0.1f us/transform [total time=%0.2f s its=%d]\n", | |||
| (double)duration / nb_its, | |||
| av_log(NULL, AV_LOG_INFO,"time: %0.1f us/transform [total time=%0.2f s its=%d]\n", | |||
| (double)duration / nb_its, | |||
| (double)duration / 1000000.0, | |||
| nb_its); | |||
| } | |||
| if (do_mdct) { | |||
| ff_mdct_end(m); | |||
| } else { | |||
| @@ -26,13 +26,13 @@ | |||
| /** | |||
| * The size of the FFT is 2^nbits. If inverse is TRUE, inverse FFT is | |||
| * done | |||
| * done | |||
| */ | |||
| int ff_fft_init(FFTContext *s, int nbits, int inverse) | |||
| { | |||
| int i, j, m, n; | |||
| float alpha, c1, s1, s2; | |||
| s->nbits = nbits; | |||
| n = 1 << nbits; | |||
| @@ -45,7 +45,7 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse) | |||
| s->inverse = inverse; | |||
| s2 = inverse ? 1.0 : -1.0; | |||
| for(i=0;i<(n/2);i++) { | |||
| alpha = 2 * M_PI * (float)i / (float)n; | |||
| c1 = cos(alpha); | |||
| @@ -70,7 +70,7 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse) | |||
| if (has_vectors) { | |||
| int np, nblocks, np2, l; | |||
| FFTComplex *q; | |||
| np = 1 << nbits; | |||
| nblocks = np >> 3; | |||
| np2 = np >> 1; | |||
| @@ -144,7 +144,7 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse) | |||
| /** | |||
| * Do a complex FFT with the parameters defined in ff_fft_init(). The | |||
| * input data must be permuted before with s->revtab table. No | |||
| * 1.0/sqrt(n) normalization is done. | |||
| * 1.0/sqrt(n) normalization is done. | |||
| */ | |||
| void ff_fft_calc_c(FFTContext *s, FFTComplex *z) | |||
| { | |||
| @@ -163,29 +163,29 @@ void ff_fft_calc_c(FFTContext *s, FFTComplex *z) | |||
| p=&z[0]; | |||
| j=(np >> 1); | |||
| do { | |||
| BF(p[0].re, p[0].im, p[1].re, p[1].im, | |||
| 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, | |||
| 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, | |||
| 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, | |||
| 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, | |||
| 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); | |||
| @@ -201,7 +201,7 @@ void ff_fft_calc_c(FFTContext *s, FFTComplex *z) | |||
| 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) { | |||
| @@ -228,7 +228,7 @@ void ff_fft_permute(FFTContext *s, FFTComplex *z) | |||
| int j, k, np; | |||
| FFTComplex tmp; | |||
| const uint16_t *revtab = s->revtab; | |||
| /* reverse */ | |||
| np = 1 << s->nbits; | |||
| for(j=0;j<np;j++) { | |||
| @@ -18,7 +18,7 @@ | |||
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
| * | |||
| */ | |||
| /** | |||
| * @file ffv1.c | |||
| * FF Video Codec 1 (an experimental lossless codec) | |||
| @@ -144,8 +144,8 @@ static const int8_t quant13[256]={ | |||
| }; | |||
| static const uint8_t log2_run[32]={ | |||
| 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, | |||
| 4, 4, 5, 5, 6, 6, 7, 7, | |||
| 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, | |||
| 4, 4, 5, 5, 6, 6, 7, 7, | |||
| 8, 9,10,11,12,13,14,15, | |||
| }; | |||
| @@ -180,8 +180,8 @@ typedef struct FFV1Context{ | |||
| int16_t quant_table[5][256]; | |||
| int run_index; | |||
| int colorspace; | |||
| DSPContext dsp; | |||
| DSPContext dsp; | |||
| }FFV1Context; | |||
| static always_inline int fold(int diff, int bits){ | |||
| @@ -226,7 +226,7 @@ static inline void put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signe | |||
| const int a= ABS(v); | |||
| const int e= av_log2(a); | |||
| put_rac(c, state+0, 0); | |||
| assert(e<=9); | |||
| for(i=0; i<e; i++){ | |||
| @@ -283,15 +283,15 @@ static inline void update_vlc_state(VlcState * const state, const int v){ | |||
| if(drift <= -count){ | |||
| if(state->bias > -128) state->bias--; | |||
| drift += count; | |||
| if(drift <= -count) | |||
| drift= -count + 1; | |||
| }else if(drift > 0){ | |||
| if(state->bias < 127) state->bias++; | |||
| drift -= count; | |||
| if(drift > 0) | |||
| if(drift > 0) | |||
| drift= 0; | |||
| } | |||
| @@ -319,7 +319,7 @@ static inline void put_vlc_symbol(PutBitContext *pb, VlcState * const state, int | |||
| #else | |||
| code= v ^ ((2*state->drift + state->count)>>31); | |||
| #endif | |||
| //printf("v:%d/%d bias:%d error:%d drift:%d count:%d k:%d\n", v, code, state->bias, state->error_sum, state->drift, state->count, k); | |||
| set_sr_golomb(pb, code, k, 12, bits); | |||
| @@ -348,7 +348,7 @@ static inline int get_vlc_symbol(GetBitContext *gb, VlcState * const state, int | |||
| #endif | |||
| ret= fold(v + state->bias, bits); | |||
| update_vlc_state(state, v); | |||
| //printf("final: %d\n", ret); | |||
| return ret; | |||
| @@ -376,7 +376,7 @@ static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], in | |||
| for(x=0; x<w; x++){ | |||
| int diff, context; | |||
| context= get_context(s, sample[0]+x, sample[1]+x, sample[2]+x); | |||
| diff= sample[0][x] - predict(sample[0]+x, sample[1]+x); | |||
| @@ -386,12 +386,12 @@ static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], in | |||
| } | |||
| diff= fold(diff, bits); | |||
| if(s->ac){ | |||
| put_symbol(c, p->state[context], diff, 1); | |||
| }else{ | |||
| if(context == 0) run_mode=1; | |||
| if(run_mode){ | |||
| if(diff){ | |||
| @@ -400,7 +400,7 @@ static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], in | |||
| run_index++; | |||
| put_bits(&s->pb, 1, 1); | |||
| } | |||
| put_bits(&s->pb, 1 + log2_run[run_index], run_count); | |||
| if(run_index) run_index--; | |||
| run_count=0; | |||
| @@ -410,7 +410,7 @@ static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], in | |||
| run_count++; | |||
| } | |||
| } | |||
| // printf("count:%d index:%d, mode:%d, x:%d y:%d pos:%d\n", run_count, run_index, run_mode, x, y, (int)put_bits_count(&s->pb)); | |||
| if(run_mode == 0) | |||
| @@ -428,7 +428,7 @@ static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], in | |||
| put_bits(&s->pb, 1, 1); | |||
| } | |||
| s->run_index= run_index; | |||
| return 0; | |||
| } | |||
| @@ -437,13 +437,13 @@ static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, | |||
| const int ring_size= s->avctx->context_model ? 3 : 2; | |||
| int_fast16_t sample_buffer[ring_size][w+6], *sample[ring_size]; | |||
| s->run_index=0; | |||
| memset(sample_buffer, 0, sizeof(sample_buffer)); | |||
| for(y=0; y<h; y++){ | |||
| for(i=0; i<ring_size; i++) | |||
| sample[i]= sample_buffer[(h+i-y)%ring_size]+3; | |||
| sample[0][-1]= sample[1][0 ]; | |||
| sample[1][ w]= sample[1][w-1]; | |||
| //{START_TIMER | |||
| @@ -460,9 +460,9 @@ static void encode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int st | |||
| const int ring_size= s->avctx->context_model ? 3 : 2; | |||
| int_fast16_t sample_buffer[3][ring_size][w+6], *sample[3][ring_size]; | |||
| s->run_index=0; | |||
| memset(sample_buffer, 0, sizeof(sample_buffer)); | |||
| for(y=0; y<h; y++){ | |||
| for(i=0; i<ring_size; i++) | |||
| for(p=0; p<3; p++) | |||
| @@ -473,13 +473,13 @@ static void encode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int st | |||
| int b= v&0xFF; | |||
| int g= (v>>8)&0xFF; | |||
| int r= (v>>16)&0xFF; | |||
| b -= g; | |||
| r -= g; | |||
| g += (b + r)>>2; | |||
| b += 0x100; | |||
| r += 0x100; | |||
| // assert(g>=0 && b>=0 && r>=0); | |||
| // assert(g<256 && b<512 && r<512); | |||
| sample[0][0][x]= g; | |||
| @@ -515,10 +515,10 @@ static void write_header(FFV1Context *f){ | |||
| RangeCoder * const c= &f->c; | |||
| memset(state, 128, sizeof(state)); | |||
| put_symbol(c, state, f->version, 0); | |||
| put_symbol(c, state, f->avctx->coder_type, 0); | |||
| put_symbol(c, state, f->colorspace, 0); //YUV cs type | |||
| put_symbol(c, state, f->colorspace, 0); //YUV cs type | |||
| put_rac(c, state, 1); //chroma planes | |||
| put_symbol(c, state, f->chroma_h_shift, 0); | |||
| put_symbol(c, state, f->chroma_v_shift, 0); | |||
| @@ -534,12 +534,12 @@ static int common_init(AVCodecContext *avctx){ | |||
| s->avctx= avctx; | |||
| s->flags= avctx->flags; | |||
| dsputil_init(&s->dsp, avctx); | |||
| width= s->width= avctx->width; | |||
| height= s->height= avctx->height; | |||
| assert(width && height); | |||
| return 0; | |||
| @@ -555,12 +555,12 @@ static int encode_init(AVCodecContext *avctx) | |||
| "use vstrict=-2 / -strict -2 to use it anyway\n"); | |||
| return -1; | |||
| } | |||
| common_init(avctx); | |||
| s->version=0; | |||
| s->ac= avctx->coder_type; | |||
| s->plane_count=2; | |||
| for(i=0; i<256; i++){ | |||
| s->quant_table[0][i]= quant11[i]; | |||
| @@ -578,10 +578,10 @@ static int encode_init(AVCodecContext *avctx) | |||
| for(i=0; i<s->plane_count; i++){ | |||
| PlaneContext * const p= &s->plane[i]; | |||
| if(avctx->context_model==0){ | |||
| p->context_count= (11*11*11+1)/2; | |||
| }else{ | |||
| }else{ | |||
| p->context_count= (11*11*5*5*5+1)/2; | |||
| } | |||
| @@ -611,7 +611,7 @@ static int encode_init(AVCodecContext *avctx) | |||
| avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_h_shift, &s->chroma_v_shift); | |||
| s->picture_number=0; | |||
| return 0; | |||
| } | |||
| @@ -624,7 +624,7 @@ static void clear_state(FFV1Context *f){ | |||
| p->interlace_bit_state[0]= 128; | |||
| p->interlace_bit_state[1]= 128; | |||
| for(j=0; j<p->context_count; j++){ | |||
| if(f->ac){ | |||
| memset(p->state[j], 128, sizeof(uint8_t)*CONTEXT_SIZE); | |||
| @@ -654,7 +654,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, | |||
| *p = *pict; | |||
| p->pict_type= FF_I_TYPE; | |||
| if(avctx->gop_size==0 || f->picture_number % avctx->gop_size == 0){ | |||
| put_rac(c, &keystate, 1); | |||
| p->key_frame= 1; | |||
| @@ -670,7 +670,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, | |||
| //printf("pos=%d\n", used_count); | |||
| init_put_bits(&f->pb, buf + used_count, buf_size - used_count); | |||
| } | |||
| if(f->colorspace==0){ | |||
| const int chroma_width = -((-width )>>f->chroma_h_shift); | |||
| const int chroma_height= -((-height)>>f->chroma_v_shift); | |||
| @@ -683,7 +683,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, | |||
| encode_rgb_frame(f, (uint32_t*)(p->data[0]), width, height, p->linesize[0]/4); | |||
| } | |||
| emms_c(); | |||
| f->picture_number++; | |||
| if(f->ac){ | |||
| @@ -695,7 +695,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, | |||
| } | |||
| static void common_end(FFV1Context *s){ | |||
| int i; | |||
| int i; | |||
| for(i=0; i<s->plane_count; i++){ | |||
| PlaneContext *p= &s->plane[i]; | |||
| @@ -723,20 +723,20 @@ static inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], i | |||
| for(x=0; x<w; x++){ | |||
| int diff, context, sign; | |||
| context= get_context(s, sample[1] + x, sample[0] + x, sample[1] + x); | |||
| if(context < 0){ | |||
| context= -context; | |||
| sign=1; | |||
| }else | |||
| sign=0; | |||
| if(s->ac){ | |||
| diff= get_symbol(c, p->state[context], 1); | |||
| }else{ | |||
| if(context == 0 && run_mode==0) run_mode=1; | |||
| if(run_mode){ | |||
| if(run_count==0 && run_mode==1){ | |||
| if(get_bits1(&s->gb)){ | |||
| @@ -759,7 +759,7 @@ static inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], i | |||
| diff=0; | |||
| }else | |||
| diff= get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); | |||
| // printf("count:%d index:%d, mode:%d, x:%d y:%d pos:%d\n", run_count, run_index, run_mode, x, y, get_bits_count(&s->gb)); | |||
| } | |||
| @@ -767,7 +767,7 @@ static inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], i | |||
| sample[1][x]= (predict(sample[1] + x, sample[0] + x) + diff) & ((1<<bits)-1); | |||
| } | |||
| s->run_index= run_index; | |||
| s->run_index= run_index; | |||
| } | |||
| static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){ | |||
| @@ -776,9 +776,9 @@ static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, | |||
| int_fast16_t *sample[2]= {sample_buffer[0]+3, sample_buffer[1]+3}; | |||
| s->run_index=0; | |||
| memset(sample_buffer, 0, sizeof(sample_buffer)); | |||
| for(y=0; y<h; y++){ | |||
| int_fast16_t *temp= sample[0]; //FIXME try a normal buffer | |||
| @@ -787,7 +787,7 @@ static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, | |||
| sample[1][-1]= sample[0][0 ]; | |||
| sample[0][ w]= sample[0][w-1]; | |||
| //{START_TIMER | |||
| decode_line(s, w, sample, plane_index, 8); | |||
| for(x=0; x<w; x++){ | |||
| @@ -806,9 +806,9 @@ static void decode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int st | |||
| {sample_buffer[2][0]+3, sample_buffer[2][1]+3}}; | |||
| s->run_index=0; | |||
| memset(sample_buffer, 0, sizeof(sample_buffer)); | |||
| for(y=0; y<h; y++){ | |||
| for(p=0; p<3; p++){ | |||
| int_fast16_t *temp= sample[p][0]; //FIXME try a normal buffer | |||
| @@ -827,13 +827,13 @@ static void decode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int st | |||
| // assert(g>=0 && b>=0 && r>=0); | |||
| // assert(g<256 && b<512 && r<512); | |||
| b -= 0x100; | |||
| r -= 0x100; | |||
| g -= (b + r)>>2; | |||
| b += g; | |||
| r += g; | |||
| src[x + stride*y]= b + (g<<8) + (r<<16); | |||
| } | |||
| } | |||
| @@ -850,7 +850,7 @@ static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale){ | |||
| int len= get_symbol(c, state, 0) + 1; | |||
| if(len + i > 128) return -1; | |||
| while(len--){ | |||
| quant_table[i] = scale*v; | |||
| i++; | |||
| @@ -863,7 +863,7 @@ static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale){ | |||
| quant_table[256-i]= -quant_table[i]; | |||
| } | |||
| quant_table[128]= -quant_table[127]; | |||
| return 2*v - 1; | |||
| } | |||
| @@ -871,7 +871,7 @@ static int read_header(FFV1Context *f){ | |||
| uint8_t state[CONTEXT_SIZE]; | |||
| int i, context_count; | |||
| RangeCoder * const c= &f->c; | |||
| memset(state, 128, sizeof(state)); | |||
| f->version= get_symbol(c, state, 0); | |||
| @@ -916,7 +916,7 @@ static int read_header(FFV1Context *f){ | |||
| } | |||
| } | |||
| context_count= (context_count+1)/2; | |||
| for(i=0; i<f->plane_count; i++){ | |||
| PlaneContext * const p= &f->plane[i]; | |||
| @@ -928,7 +928,7 @@ static int read_header(FFV1Context *f){ | |||
| if(!p->vlc_state) p->vlc_state= av_malloc(p->context_count*sizeof(VlcState)); | |||
| } | |||
| } | |||
| return 0; | |||
| } | |||
| @@ -937,7 +937,7 @@ static int decode_init(AVCodecContext *avctx) | |||
| // FFV1Context *s = avctx->priv_data; | |||
| common_init(avctx); | |||
| return 0; | |||
| } | |||
| @@ -973,7 +973,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| if(avctx->debug&FF_DEBUG_PICT_INFO) | |||
| av_log(avctx, AV_LOG_ERROR, "keyframe:%d coder:%d\n", p->key_frame, f->ac); | |||
| if(!f->ac){ | |||
| bytes_read = c->bytestream - c->bytestream_start - 1; | |||
| if(bytes_read ==0) av_log(avctx, AV_LOG_ERROR, "error at end of AC stream\n"); //FIXME | |||
| @@ -982,28 +982,28 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| } else { | |||
| bytes_read = 0; /* avoid warning */ | |||
| } | |||
| if(f->colorspace==0){ | |||
| const int chroma_width = -((-width )>>f->chroma_h_shift); | |||
| const int chroma_height= -((-height)>>f->chroma_v_shift); | |||
| decode_plane(f, p->data[0], width, height, p->linesize[0], 0); | |||
| decode_plane(f, p->data[1], chroma_width, chroma_height, p->linesize[1], 1); | |||
| decode_plane(f, p->data[2], chroma_width, chroma_height, p->linesize[2], 1); | |||
| }else{ | |||
| decode_rgb_frame(f, (uint32_t*)p->data[0], width, height, p->linesize[0]/4); | |||
| } | |||
| emms_c(); | |||
| f->picture_number++; | |||
| *picture= *p; | |||
| avctx->release_buffer(avctx, p); //FIXME | |||
| *data_size = sizeof(AVFrame); | |||
| if(f->ac){ | |||
| bytes_read= c->bytestream - c->bytestream_start - 1; | |||
| if(bytes_read ==0) av_log(f->avctx, AV_LOG_ERROR, "error at end of frame\n"); | |||
| @@ -30,9 +30,9 @@ | |||
| * 34-byte streaminfo structure through avctx->extradata[_size] followed | |||
| * by data starting with the 0xFFF8 marker. | |||
| */ | |||
| #include <limits.h> | |||
| #include "avcodec.h" | |||
| #include "bitstream.h" | |||
| #include "golomb.h" | |||
| @@ -74,14 +74,14 @@ typedef struct FLACContext { | |||
| static int sample_rate_table[] = | |||
| { 0, 0, 0, 0, | |||
| 8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000, | |||
| 0, 0, 0, 0 }; | |||
| 0, 0, 0, 0 }; | |||
| static int sample_size_table[] = | |||
| static int sample_size_table[] = | |||
| { 0, 8, 12, 0, 16, 20, 24, 0 }; | |||
| static int blocksize_table[] = { | |||
| 0, 192, 576<<0, 576<<1, 576<<2, 576<<3, 0, 0, | |||
| 256<<0, 256<<1, 256<<2, 256<<3, 256<<4, 256<<5, 256<<6, 256<<7 | |||
| 0, 192, 576<<0, 576<<1, 576<<2, 576<<3, 0, 0, | |||
| 256<<0, 256<<1, 256<<2, 256<<3, 256<<4, 256<<5, 256<<6, 256<<7 | |||
| }; | |||
| static const uint8_t table_crc8[256] = { | |||
| @@ -123,18 +123,18 @@ static int64_t get_utf8(GetBitContext *gb) | |||
| { | |||
| uint64_t val; | |||
| int ones=0, bytes; | |||
| while(get_bits1(gb)) | |||
| ones++; | |||
| if (ones==0) bytes=0; | |||
| else if(ones==1) return -1; | |||
| else bytes= ones - 1; | |||
| val= get_bits(gb, 7-ones); | |||
| while(bytes--){ | |||
| const int tmp = get_bits(gb, 8); | |||
| if((tmp>>6) != 2) | |||
| return -1; | |||
| val<<=6; | |||
| @@ -147,18 +147,18 @@ static int64_t get_utf8(GetBitContext *gb) | |||
| static int skip_utf8(GetBitContext *gb) | |||
| { | |||
| int ones=0, bytes; | |||
| while(get_bits1(gb)) | |||
| ones++; | |||
| if (ones==0) bytes=0; | |||
| else if(ones==1) return -1; | |||
| else bytes= ones - 1; | |||
| skip_bits(gb, 7-ones); | |||
| while(bytes--){ | |||
| const int tmp = get_bits(gb, 8); | |||
| if((tmp>>6) != 2) | |||
| return -1; | |||
| } | |||
| @@ -169,7 +169,7 @@ static int skip_utf8(GetBitContext *gb) | |||
| static int get_crc8(const uint8_t *buf, int count){ | |||
| int crc=0; | |||
| int i; | |||
| for(i=0; i<count; i++){ | |||
| crc = table_crc8[crc ^ buf[i]]; | |||
| } | |||
| @@ -229,19 +229,19 @@ static void metadata_streaminfo(FLACContext *s) | |||
| s->min_framesize = get_bits_long(&s->gb, 24); | |||
| s->max_framesize = get_bits_long(&s->gb, 24); | |||
| s->samplerate = get_bits_long(&s->gb, 20); | |||
| s->channels = get_bits(&s->gb, 3) + 1; | |||
| s->bps = get_bits(&s->gb, 5) + 1; | |||
| s->avctx->channels = s->channels; | |||
| s->avctx->sample_rate = s->samplerate; | |||
| skip_bits(&s->gb, 36); /* total num of samples */ | |||
| skip_bits(&s->gb, 64); /* md5 sum */ | |||
| skip_bits(&s->gb, 64); /* md5 sum */ | |||
| allocate_buffers(s); | |||
| } | |||
| @@ -255,12 +255,12 @@ static int decode_residuals(FLACContext *s, int channel, int pred_order) | |||
| av_log(s->avctx, AV_LOG_DEBUG, "illegal residual coding method %d\n", method_type); | |||
| return -1; | |||
| } | |||
| rice_order = get_bits(&s->gb, 4); | |||
| samples= s->blocksize >> rice_order; | |||
| sample= | |||
| sample= | |||
| i= pred_order; | |||
| for (partition = 0; partition < (1 << rice_order); partition++) | |||
| { | |||
| @@ -285,23 +285,23 @@ static int decode_residuals(FLACContext *s, int channel, int pred_order) | |||
| // av_log(s->avctx, AV_LOG_DEBUG, "partitions: %d, samples: %d\n", 1 << rice_order, sample); | |||
| return 0; | |||
| } | |||
| } | |||
| static int decode_subframe_fixed(FLACContext *s, int channel, int pred_order) | |||
| { | |||
| int i; | |||
| // av_log(s->avctx, AV_LOG_DEBUG, " SUBFRAME FIXED\n"); | |||
| /* warm up samples */ | |||
| // av_log(s->avctx, AV_LOG_DEBUG, " warm up samples: %d\n", pred_order); | |||
| for (i = 0; i < pred_order; i++) | |||
| { | |||
| s->decoded[channel][i] = get_sbits(&s->gb, s->curr_bps); | |||
| // av_log(s->avctx, AV_LOG_DEBUG, " %d: %d\n", i, s->decoded[channel][i]); | |||
| } | |||
| if (decode_residuals(s, channel, pred_order) < 0) | |||
| return -1; | |||
| @@ -320,13 +320,13 @@ static int decode_subframe_fixed(FLACContext *s, int channel, int pred_order) | |||
| break; | |||
| case 3: | |||
| for (i = pred_order; i < s->blocksize; i++) | |||
| s->decoded[channel][i] += 3*s->decoded[channel][i-1] | |||
| s->decoded[channel][i] += 3*s->decoded[channel][i-1] | |||
| - 3*s->decoded[channel][i-2] | |||
| + s->decoded[channel][i-3]; | |||
| break; | |||
| case 4: | |||
| for (i = pred_order; i < s->blocksize; i++) | |||
| s->decoded[channel][i] += 4*s->decoded[channel][i-1] | |||
| s->decoded[channel][i] += 4*s->decoded[channel][i-1] | |||
| - 6*s->decoded[channel][i-2] | |||
| + 4*s->decoded[channel][i-3] | |||
| - s->decoded[channel][i-4]; | |||
| @@ -344,18 +344,18 @@ static int decode_subframe_lpc(FLACContext *s, int channel, int pred_order) | |||
| int sum, i, j; | |||
| int coeff_prec, qlevel; | |||
| int coeffs[pred_order]; | |||
| // av_log(s->avctx, AV_LOG_DEBUG, " SUBFRAME LPC\n"); | |||
| /* warm up samples */ | |||
| // av_log(s->avctx, AV_LOG_DEBUG, " warm up samples: %d\n", pred_order); | |||
| for (i = 0; i < pred_order; i++) | |||
| { | |||
| s->decoded[channel][i] = get_sbits(&s->gb, s->curr_bps); | |||
| // av_log(s->avctx, AV_LOG_DEBUG, " %d: %d\n", i, s->decoded[channel][i]); | |||
| } | |||
| coeff_prec = get_bits(&s->gb, 4) + 1; | |||
| if (coeff_prec == 16) | |||
| { | |||
| @@ -375,7 +375,7 @@ static int decode_subframe_lpc(FLACContext *s, int channel, int pred_order) | |||
| coeffs[i] = get_sbits(&s->gb, coeff_prec); | |||
| // av_log(s->avctx, AV_LOG_DEBUG, " %d: %d\n", i, coeffs[i]); | |||
| } | |||
| if (decode_residuals(s, channel, pred_order) < 0) | |||
| return -1; | |||
| @@ -386,7 +386,7 @@ static int decode_subframe_lpc(FLACContext *s, int channel, int pred_order) | |||
| sum += coeffs[j] * s->decoded[channel][i-j-1]; | |||
| s->decoded[channel][i] += sum >> qlevel; | |||
| } | |||
| return 0; | |||
| } | |||
| @@ -394,7 +394,7 @@ static inline int decode_subframe(FLACContext *s, int channel) | |||
| { | |||
| int type, wasted = 0; | |||
| int i, tmp; | |||
| s->curr_bps = s->bps; | |||
| if(channel == 0){ | |||
| if(s->decorrelation == RIGHT_SIDE) | |||
| @@ -411,7 +411,7 @@ static inline int decode_subframe(FLACContext *s, int channel) | |||
| } | |||
| type = get_bits(&s->gb, 6); | |||
| // wasted = get_bits1(&s->gb); | |||
| // if (wasted) | |||
| // { | |||
| // while (!get_bits1(&s->gb)) | |||
| @@ -465,7 +465,7 @@ static inline int decode_subframe(FLACContext *s, int channel) | |||
| av_log(s->avctx, AV_LOG_ERROR, "invalid coding type\n"); | |||
| return -1; | |||
| } | |||
| if (wasted) | |||
| { | |||
| int i; | |||
| @@ -480,11 +480,11 @@ static int decode_frame(FLACContext *s) | |||
| { | |||
| int blocksize_code, sample_rate_code, sample_size_code, assignment, i, crc8; | |||
| int decorrelation, bps, blocksize, samplerate; | |||
| blocksize_code = get_bits(&s->gb, 4); | |||
| sample_rate_code = get_bits(&s->gb, 4); | |||
| assignment = get_bits(&s->gb, 4); /* channel assignment */ | |||
| if (assignment < 8 && s->channels == assignment+1) | |||
| decorrelation = INDEPENDENT; | |||
| @@ -495,13 +495,13 @@ static int decode_frame(FLACContext *s) | |||
| av_log(s->avctx, AV_LOG_ERROR, "unsupported channel assignment %d (channels=%d)\n", assignment, s->channels); | |||
| return -1; | |||
| } | |||
| sample_size_code = get_bits(&s->gb, 3); | |||
| if(sample_size_code == 0) | |||
| bps= s->bps; | |||
| else if((sample_size_code != 3) && (sample_size_code != 7)) | |||
| bps = sample_size_table[sample_size_code]; | |||
| else | |||
| else | |||
| { | |||
| av_log(s->avctx, AV_LOG_ERROR, "invalid sample size code (%d)\n", sample_size_code); | |||
| return -1; | |||
| @@ -512,25 +512,25 @@ static int decode_frame(FLACContext *s) | |||
| av_log(s->avctx, AV_LOG_ERROR, "broken stream, invalid padding\n"); | |||
| return -1; | |||
| } | |||
| if(get_utf8(&s->gb) < 0){ | |||
| av_log(s->avctx, AV_LOG_ERROR, "utf8 fscked\n"); | |||
| return -1; | |||
| } | |||
| #if 0 | |||
| #if 0 | |||
| if (/*((blocksize_code == 6) || (blocksize_code == 7)) &&*/ | |||
| (s->min_blocksize != s->max_blocksize)){ | |||
| }else{ | |||
| } | |||
| #endif | |||
| if (blocksize_code == 0) | |||
| blocksize = s->min_blocksize; | |||
| else if (blocksize_code == 6) | |||
| blocksize = get_bits(&s->gb, 8)+1; | |||
| else if (blocksize_code == 7) | |||
| blocksize = get_bits(&s->gb, 16)+1; | |||
| else | |||
| else | |||
| blocksize = blocksize_table[blocksize_code]; | |||
| if(blocksize > s->max_blocksize){ | |||
| @@ -559,7 +559,7 @@ static int decode_frame(FLACContext *s) | |||
| av_log(s->avctx, AV_LOG_ERROR, "header crc mismatch crc=%2X\n", crc8); | |||
| return -1; | |||
| } | |||
| s->blocksize = blocksize; | |||
| s->samplerate = samplerate; | |||
| s->bps = bps; | |||
| @@ -574,7 +574,7 @@ static int decode_frame(FLACContext *s) | |||
| if (decode_subframe(s, i) < 0) | |||
| return -1; | |||
| } | |||
| align_get_bits(&s->gb); | |||
| /* frame footer */ | |||
| @@ -610,7 +610,7 @@ static int flac_decode_frame(AVCodecContext *avctx, | |||
| buf= &s->bitstream[s->bitstream_index]; | |||
| buf_size += s->bitstream_size; | |||
| s->bitstream_size= buf_size; | |||
| if(buf_size < s->max_framesize){ | |||
| // printf("wanna more data ...\n"); | |||
| return input_buf_size; | |||
| @@ -618,7 +618,7 @@ 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"))) | |||
| { | |||
| @@ -629,7 +629,7 @@ static int flac_decode_frame(AVCodecContext *avctx, | |||
| 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); | |||
| @@ -647,7 +647,7 @@ static int flac_decode_frame(AVCodecContext *avctx, | |||
| init_get_bits(&s->gb, buf, buf_size*8); | |||
| skip_bits(&s->gb, bits_count); | |||
| } | |||
| dump_headers(s); | |||
| break;} | |||
| default: | |||
| @@ -659,7 +659,7 @@ static int flac_decode_frame(AVCodecContext *avctx, | |||
| } | |||
| else | |||
| { | |||
| tmp = show_bits(&s->gb, 16); | |||
| if(tmp != 0xFFF8){ | |||
| av_log(s->avctx, AV_LOG_ERROR, "FRAME HEADER not here\n"); | |||
| @@ -676,7 +676,7 @@ static int flac_decode_frame(AVCodecContext *avctx, | |||
| } | |||
| } | |||
| #if 0 | |||
| /* fix the channel order here */ | |||
| if (s->order == MID_SIDE) | |||
| @@ -757,7 +757,7 @@ static int flac_decode_frame(AVCodecContext *avctx, | |||
| *(samples++) = mid + side; | |||
| *(samples++) = mid; | |||
| #else | |||
| mid <<= 1; | |||
| if (side & 1) | |||
| mid++; | |||
| @@ -786,7 +786,7 @@ end: | |||
| s->bitstream_index += i; | |||
| s->bitstream_size -= i; | |||
| return input_buf_size; | |||
| }else | |||
| }else | |||
| return i; | |||
| } | |||
| @@ -794,13 +794,13 @@ static int flac_decode_close(AVCodecContext *avctx) | |||
| { | |||
| FLACContext *s = avctx->priv_data; | |||
| int i; | |||
| for (i = 0; i < s->channels; i++) | |||
| { | |||
| av_freep(&s->decoded[i]); | |||
| } | |||
| av_freep(&s->bitstream); | |||
| return 0; | |||
| } | |||
| @@ -820,5 +820,5 @@ AVCodec flac_decoder = { | |||
| NULL, | |||
| flac_decode_close, | |||
| flac_decode_frame, | |||
| .flush= flac_flush, | |||
| .flush= flac_flush, | |||
| }; | |||
| @@ -87,7 +87,7 @@ static int flic_decode_init(AVCodecContext *avctx) | |||
| s->fli_type = LE_16(&fli_header[4]); /* Might be overridden if a Magic Carpet FLC */ | |||
| depth = LE_16(&fli_header[12]); | |||
| if (depth == 0) { | |||
| depth = 8; /* Some FLC generators set depth to zero, when they mean 8Bpp. Fix up here */ | |||
| } | |||
| @@ -115,7 +115,7 @@ static int flic_decode_init(AVCodecContext *avctx) | |||
| default : | |||
| av_log(avctx, AV_LOG_ERROR, "Unkown FLC/FLX depth of %d Bpp is unsupported.\n",depth); | |||
| return -1; | |||
| } | |||
| } | |||
| s->frame.data[0] = NULL; | |||
| s->new_palette = 0; | |||
| @@ -159,7 +159,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, | |||
| int pixel_countdown; | |||
| unsigned char *pixels; | |||
| int pixel_limit; | |||
| s->frame.reference = 1; | |||
| s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; | |||
| if (avctx->reget_buffer(avctx, &s->frame) < 0) { | |||
| @@ -190,8 +190,8 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, | |||
| 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 | |||
| /* check special case: If this file is from the Magic Carpet | |||
| * game and uses 6-bit colors even though it reports 256-color | |||
| * chunks in a 0xAF12-type file (fli_type is set to 0xAF13 during | |||
| * initialization) */ | |||
| if ((chunk_type == FLI_256_COLOR) && (s->fli_type != FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE)) | |||
| @@ -543,7 +543,7 @@ int flic_decode_frame_15_16BPP(AVCodecContext *avctx, | |||
| * pixels on a row */ | |||
| stream_ptr++; | |||
| pixel_countdown = (s->avctx->width * 2); | |||
| while (pixel_countdown > 0) { | |||
| byte_run = buf[stream_ptr++]; | |||
| if (byte_run > 0) { | |||
| @@ -572,10 +572,10 @@ int flic_decode_frame_15_16BPP(AVCodecContext *avctx, | |||
| /* Now FLX is strange, in that it is "byte" as opposed to "pixel" run length compressed. | |||
| * This doesnt give us any good oportunity to perform word endian conversion | |||
| * during decompression. So if its requried (ie, this isnt a LE target, we do | |||
| * during decompression. So if its requried (ie, this isnt a LE target, we do | |||
| * a second pass over the line here, swapping the bytes. | |||
| */ | |||
| pixel = 0xFF00; | |||
| pixel = 0xFF00; | |||
| if (0xFF00 != LE_16(&pixel)) /* Check if its not an LE Target */ | |||
| { | |||
| pixel_ptr = y_ptr; | |||
| @@ -584,7 +584,7 @@ int flic_decode_frame_15_16BPP(AVCodecContext *avctx, | |||
| *((signed short*)(&pixels[pixel_ptr])) = LE_16(&buf[pixel_ptr]); | |||
| pixel_ptr += 2; | |||
| } | |||
| } | |||
| } | |||
| y_ptr += s->frame.linesize[0]; | |||
| } | |||
| break; | |||
| @@ -597,7 +597,7 @@ int flic_decode_frame_15_16BPP(AVCodecContext *avctx, | |||
| * pixels on a row */ | |||
| stream_ptr++; | |||
| pixel_countdown = s->avctx->width; /* Width is in pixels, not bytes */ | |||
| while (pixel_countdown > 0) { | |||
| byte_run = buf[stream_ptr++]; | |||
| if (byte_run > 0) { | |||
| @@ -606,7 +606,7 @@ int flic_decode_frame_15_16BPP(AVCodecContext *avctx, | |||
| CHECK_PIXEL_PTR(byte_run); | |||
| for (j = 0; j < byte_run; j++) { | |||
| *((signed short*)(&pixels[pixel_ptr])) = pixel; | |||
| pixel_ptr += 2; | |||
| pixel_ptr += 2; | |||
| pixel_countdown--; | |||
| if (pixel_countdown < 0) | |||
| av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d)\n", | |||
| @@ -639,7 +639,7 @@ int flic_decode_frame_15_16BPP(AVCodecContext *avctx, | |||
| "bigger than image, skipping chunk\n", chunk_size - 6); | |||
| stream_ptr += chunk_size - 6; | |||
| } else { | |||
| for (y_ptr = 0; y_ptr < s->frame.linesize[0] * s->avctx->height; | |||
| y_ptr += s->frame.linesize[0]) { | |||
| @@ -649,7 +649,7 @@ int flic_decode_frame_15_16BPP(AVCodecContext *avctx, | |||
| *((signed short*)(&pixels[y_ptr + pixel_ptr])) = LE_16(&buf[stream_ptr+pixel_ptr]); | |||
| pixel_ptr += 2; | |||
| pixel_countdown--; | |||
| } | |||
| } | |||
| stream_ptr += s->avctx->width*2; | |||
| } | |||
| } | |||
| @@ -702,7 +702,7 @@ static int flic_decode_frame(AVCodecContext *avctx, | |||
| (avctx->pix_fmt == PIX_FMT_RGB565)) { | |||
| return flic_decode_frame_15_16BPP(avctx, data, data_size, | |||
| buf, buf_size); | |||
| } | |||
| } | |||
| else if (avctx->pix_fmt == PIX_FMT_BGR24) { | |||
| return flic_decode_frame_24BPP(avctx, data, data_size, | |||
| buf, buf_size); | |||
| @@ -711,10 +711,10 @@ static int flic_decode_frame(AVCodecContext *avctx, | |||
| /* Shouldnt get here, ever as the pix_fmt is processed */ | |||
| /* in flic_decode_init and the above if should deal with */ | |||
| /* the finite set of possibilites allowable by here. */ | |||
| /* but in case we do, just error out. */ | |||
| /* but in case we do, just error out. */ | |||
| av_log(avctx, AV_LOG_ERROR, "Unknown Format of FLC. My Science cant explain how this happened\n"); | |||
| return -1; | |||
| } | |||
| } | |||
| static int flic_decode_end(AVCodecContext *avctx) | |||
| @@ -17,19 +17,19 @@ | |||
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
| * | |||
| */ | |||
| /** | |||
| * @file fraps.c | |||
| * Lossless Fraps 'FPS1' decoder | |||
| * @author Roine Gustafsson <roine at users sf net> | |||
| * | |||
| * | |||
| * Only decodes version 0 and 1 files. | |||
| * Codec algorithm for version 0 is taken from Transcode <www.transcoding.org> | |||
| * | |||
| * Version 2 files, which are the most commonly found Fraps files, cannot be | |||
| * decoded yet. | |||
| */ | |||
| #include "avcodec.h" | |||
| #define FPS_TAG MKTAG('F', 'P', 'S', 'x') | |||
| @@ -57,7 +57,7 @@ static int decode_init(AVCodecContext *avctx) | |||
| avctx->pix_fmt= PIX_FMT_NONE; /* set in decode_frame */ | |||
| s->avctx = avctx; | |||
| s->frame.data[0] = NULL; | |||
| s->frame.data[0] = NULL; | |||
| return 0; | |||
| } | |||
| @@ -72,7 +72,7 @@ static int decode_init(AVCodecContext *avctx) | |||
| * @param buf_size size of input data frame | |||
| * @return number of consumed bytes on success or negative if decode fails | |||
| */ | |||
| static int decode_frame(AVCodecContext *avctx, | |||
| static int decode_frame(AVCodecContext *avctx, | |||
| void *data, int *data_size, | |||
| uint8_t *buf, int buf_size) | |||
| { | |||
| @@ -91,7 +91,7 @@ static int decode_frame(AVCodecContext *avctx, | |||
| header_size = (header & (1<<30))? 8 : 4; /* bit 30 means pad to 8 bytes */ | |||
| if (version > 1) { | |||
| av_log(avctx, AV_LOG_ERROR, | |||
| 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); | |||
| return -1; | |||
| @@ -100,40 +100,40 @@ static int decode_frame(AVCodecContext *avctx, | |||
| buf+=4; | |||
| if (header_size == 8) | |||
| buf+=4; | |||
| switch(version) { | |||
| case 0: | |||
| default: | |||
| /* Fraps v0 is a reordered YUV420 */ | |||
| avctx->pix_fmt = PIX_FMT_YUV420P; | |||
| if ( (buf_size != avctx->width*avctx->height*3/2+header_size) && | |||
| if ( (buf_size != avctx->width*avctx->height*3/2+header_size) && | |||
| (buf_size != header_size) ) { | |||
| av_log(avctx, AV_LOG_ERROR, | |||
| "Invalid frame length %d (should be %d)\n", | |||
| "Invalid frame length %d (should be %d)\n", | |||
| buf_size, avctx->width*avctx->height*3/2+header_size); | |||
| return -1; | |||
| } | |||
| if (( (avctx->width % 8) != 0) || ( (avctx->height % 2) != 0 )) { | |||
| av_log(avctx, AV_LOG_ERROR, "Invalid frame size %dx%d\n", | |||
| av_log(avctx, AV_LOG_ERROR, "Invalid frame size %dx%d\n", | |||
| avctx->width, avctx->height); | |||
| return -1; | |||
| } | |||
| f->reference = 1; | |||
| f->buffer_hints = FF_BUFFER_HINTS_VALID | | |||
| FF_BUFFER_HINTS_PRESERVE | | |||
| 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; | |||
| } | |||
| } | |||
| /* bit 31 means same as previous pic */ | |||
| f->pict_type = (header & (1<<31))? FF_P_TYPE : FF_I_TYPE; | |||
| f->pict_type = (header & (1<<31))? FF_P_TYPE : FF_I_TYPE; | |||
| f->key_frame = f->pict_type == FF_I_TYPE; | |||
| if (f->pict_type == FF_I_TYPE) { | |||
| if (f->pict_type == FF_I_TYPE) { | |||
| buf32=(uint32_t*)buf; | |||
| for(y=0; y<avctx->height/2; y++){ | |||
| luma1=(uint32_t*)&f->data[0][ y*2*f->linesize[0] ]; | |||
| @@ -156,9 +156,9 @@ static int decode_frame(AVCodecContext *avctx, | |||
| /* Fraps v1 is an upside-down BGR24 */ | |||
| avctx->pix_fmt = PIX_FMT_BGR24; | |||
| if ( (buf_size != avctx->width*avctx->height*3+header_size) && | |||
| if ( (buf_size != avctx->width*avctx->height*3+header_size) && | |||
| (buf_size != header_size) ) { | |||
| av_log(avctx, AV_LOG_ERROR, | |||
| av_log(avctx, AV_LOG_ERROR, | |||
| "Invalid frame length %d (should be %d)\n", | |||
| buf_size, avctx->width*avctx->height*3+header_size); | |||
| return -1; | |||
| @@ -1,9 +1,9 @@ | |||
| /* | |||
| * G.726 ADPCM audio codec | |||
| * G.726 ADPCM audio codec | |||
| * Copyright (c) 2004 Roman Shaposhnik. | |||
| * | |||
| * This is a very straightforward rendition of the G.726 | |||
| * Section 4 "Computational Details". | |||
| * Section 4 "Computational Details". | |||
| * | |||
| * This library is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Lesser General Public | |||
| @@ -26,7 +26,7 @@ | |||
| /** | |||
| * G.726 11bit float. | |||
| * G.726 Standard uses rather odd 11bit floating point arithmentic for | |||
| * G.726 Standard uses rather odd 11bit floating point arithmentic for | |||
| * numerous occasions. It's a mistery to me why they did it this way | |||
| * instead of simply using 32bit integer arithmetic. | |||
| */ | |||
| @@ -42,7 +42,7 @@ static inline Float11* i2f(int16_t i, Float11* f) | |||
| if (f->sign) | |||
| i = -i; | |||
| f->exp = av_log2_16bit(i) + !!i; | |||
| f->mant = i? (i<<6) >> f->exp : | |||
| f->mant = i? (i<<6) >> f->exp : | |||
| 1<<5; | |||
| return f; | |||
| } | |||
| @@ -72,13 +72,13 @@ typedef struct 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 */ | |||
| @@ -92,65 +92,65 @@ typedef struct G726Context { | |||
| } G726Context; | |||
| static int quant_tbl16[] = /**< 16kbit/s 2bits per sample */ | |||
| { 260, INT_MAX }; | |||
| { 260, INT_MAX }; | |||
| static int iquant_tbl16[] = | |||
| { 116, 365, 365, 116 }; | |||
| static int W_tbl16[] = | |||
| static int W_tbl16[] = | |||
| { -22, 439, 439, -22 }; | |||
| static int F_tbl16[] = | |||
| { 0, 7, 7, 0 }; | |||
| 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 }; | |||
| static int W_tbl24[] = | |||
| { -4, 30, 137, 582, 582, 137, 30, -4 }; | |||
| static int W_tbl24[] = | |||
| { -4, 30, 137, 582, 582, 137, 30, -4 }; | |||
| static int F_tbl24[] = | |||
| { 0, 1, 2, 7, 7, 2, 1, 0 }; | |||
| 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, | |||
| { INT_MIN, 4, 135, 213, 273, 323, 373, 425, | |||
| 425, 373, 323, 273, 213, 135, 4, INT_MIN }; | |||
| static int W_tbl32[] = | |||
| static int W_tbl32[] = | |||
| { -12, 18, 41, 64, 112, 198, 355, 1122, | |||
| 1122, 355, 198, 112, 64, 41, 18, -12}; | |||
| static int F_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 */ | |||
| { -122, -16, 67, 138, 197, 249, 297, 338, | |||
| 377, 412, 444, 474, 501, 527, 552, INT_MAX }; | |||
| static int iquant_tbl40[] = | |||
| { INT_MIN, -66, 28, 104, 169, 224, 274, 318, | |||
| { INT_MIN, -66, 28, 104, 169, 224, 274, 318, | |||
| 358, 395, 429, 459, 488, 514, 539, 566, | |||
| 566, 539, 514, 488, 459, 429, 395, 358, | |||
| 318, 274, 224, 169, 104, 28, -66, INT_MIN }; | |||
| static int W_tbl40[] = | |||
| static int W_tbl40[] = | |||
| { 14, 14, 24, 39, 40, 41, 58, 100, | |||
| 141, 179, 219, 280, 358, 440, 529, 696, | |||
| 141, 179, 219, 280, 358, 440, 529, 696, | |||
| 696, 529, 440, 358, 280, 219, 179, 141, | |||
| 100, 58, 41, 40, 39, 24, 14, 14 }; | |||
| static int F_tbl40[] = | |||
| static int F_tbl40[] = | |||
| { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 6, | |||
| 6, 6, 5, 4, 3, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; | |||
| static G726Tables G726Tables_pool[] = | |||
| static G726Tables G726Tables_pool[] = | |||
| {{ 2, quant_tbl16, iquant_tbl16, W_tbl16, F_tbl16 }, | |||
| { 3, quant_tbl24, iquant_tbl24, W_tbl24, F_tbl24 }, | |||
| { 4, quant_tbl32, iquant_tbl32, W_tbl32, F_tbl32 }, | |||
| { 5, quant_tbl40, iquant_tbl40, W_tbl40, F_tbl40 }}; | |||
| /** | |||
| * Para 4.2.2 page 18: Adaptive quantizer. | |||
| * Para 4.2.2 page 18: Adaptive quantizer. | |||
| */ | |||
| static inline uint8_t quant(G726Context* c, int d) | |||
| { | |||
| int sign, exp, i, dln; | |||
| sign = i = 0; | |||
| if (d < 0) { | |||
| sign = 1; | |||
| @@ -158,16 +158,16 @@ static inline uint8_t quant(G726Context* c, int 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) | |||
| ++i; | |||
| 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; | |||
| } | |||
| /** | |||
| @@ -176,18 +176,18 @@ static inline uint8_t quant(G726Context* c, int d) | |||
| static inline int16_t inverse_quant(G726Context* c, int i) | |||
| { | |||
| int dql, dex, dqt; | |||
| dql = c->tbls->iquant[i] + (c->y >> 2); | |||
| dex = (dql>>7) & 0xf; /* 4bit exponent */ | |||
| dqt = (1<<7) + (dql & 0x7f); /* log2 -> linear */ | |||
| return (dql < 0) ? 0 : ((dqt<<7) >> (14-dex)); | |||
| return (dql < 0) ? 0 : ((dqt<<7) >> (14-dex)); | |||
| } | |||
| static inline int16_t g726_iterate(G726Context* c, int16_t I) | |||
| { | |||
| int dq, re_signal, pk0, fa1, i, tr, ylint, ylfrac, thr2, al, dq0; | |||
| Float11 f; | |||
| dq = inverse_quant(c, I); | |||
| if (I >> (c->tbls->bits - 1)) /* get the sign */ | |||
| dq = -dq; | |||
| @@ -201,7 +201,7 @@ static inline int16_t g726_iterate(G726Context* c, int16_t I) | |||
| tr = 1; | |||
| else | |||
| tr = 0; | |||
| /* Update second order predictor coefficient A2 and A1 */ | |||
| pk0 = (c->sez + dq) ? sgn(c->sez + dq) : 0; | |||
| dq0 = dq ? sgn(dq) : 0; | |||
| @@ -213,7 +213,7 @@ static inline int16_t g726_iterate(G726Context* c, int16_t I) | |||
| } 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); | |||
| c->a[1] += 128*pk0*c->pk[1] + fa1 - (c->a[1]>>7); | |||
| c->a[1] = clip(c->a[1], -12288, 12288); | |||
| c->a[0] += 64*3*pk0*c->pk[0] - (c->a[0] >> 8); | |||
| @@ -232,28 +232,28 @@ static inline int16_t g726_iterate(G726Context* c, int16_t I) | |||
| 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 ?!?! */ | |||
| /* Update tone detect [I'm not sure 'tr == 0' is really needed] */ | |||
| c->td = (tr == 0 && c->a[1] < -11776); | |||
| c->td = (tr == 0 && c->a[1] < -11776); | |||
| /* Update Ap */ | |||
| c->dms += ((c->tbls->F[I]<<9) - c->dms) >> 5; | |||
| c->dml += ((c->tbls->F[I]<<11) - c->dml) >> 7; | |||
| if (tr) | |||
| if (tr) | |||
| c->ap = 256; | |||
| else if (c->y > 1535 && !c->td && (abs((c->dms << 2) - c->dml) < (c->dml >> 3))) | |||
| 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); | |||
| c->yl += c->yu + ((-c->yl)>>6); | |||
| /* Next iteration for Y */ | |||
| al = (c->ap >= 256) ? 1<<6 : c->ap >> 2; | |||
| c->y = (c->yl + (c->yu - (c->yl>>6))*al) >> 6; | |||
| /* Next iteration for SE and SEZ */ | |||
| c->se = 0; | |||
| for (i=0; i<6; i++) | |||
| @@ -302,7 +302,7 @@ static int16_t g726_decode(G726Context* c, int16_t i) | |||
| static int16_t g726_encode(G726Context* c, int16_t sig) | |||
| { | |||
| uint8_t i; | |||
| i = quant(c, sig/4 - c->se) & ((1<<c->tbls->bits) - 1); | |||
| g726_iterate(c, i); | |||
| return i; | |||
| @@ -320,7 +320,7 @@ typedef struct AVG726Context { | |||
| static int g726_init(AVCodecContext * avctx) | |||
| { | |||
| AVG726Context* c = (AVG726Context*)avctx->priv_data; | |||
| if (avctx->channels != 1 || | |||
| (avctx->bit_rate != 16000 && avctx->bit_rate != 24000 && | |||
| avctx->bit_rate != 32000 && avctx->bit_rate != 40000)) { | |||
| @@ -364,8 +364,8 @@ static int g726_encode_frame(AVCodecContext *avctx, | |||
| flush_put_bits(&pb); | |||
| return put_bits_count(&pb)>>3; | |||
| } | |||
| return put_bits_count(&pb)>>3; | |||
| } | |||
| static int g726_decode_frame(AVCodecContext *avctx, | |||
| void *data, int *data_size, | |||
| @@ -375,11 +375,11 @@ static int g726_decode_frame(AVCodecContext *avctx, | |||
| short *samples = data; | |||
| uint8_t code; | |||
| uint8_t mask; | |||
| GetBitContext gb; | |||
| GetBitContext gb; | |||
| if (!buf_size) | |||
| goto out; | |||
| mask = (1<<c->code_size) - 1; | |||
| init_get_bits(&gb, buf, buf_size * 8); | |||
| if (c->bits_left) { | |||
| @@ -387,13 +387,13 @@ static int g726_decode_frame(AVCodecContext *avctx, | |||
| code = (c->bit_buffer << s) | get_bits(&gb, s); | |||
| *samples++ = g726_decode(&c->c, code & mask); | |||
| } | |||
| while (get_bits_count(&gb) + c->code_size <= buf_size*8) | |||
| *samples++ = g726_decode(&c->c, get_bits(&gb, c->code_size) & mask); | |||
| c->bits_left = buf_size*8 - get_bits_count(&gb); | |||
| c->bit_buffer = get_bits(&gb, c->bits_left); | |||
| out: | |||
| *data_size = (uint8_t*)samples - (uint8_t*)data; | |||
| return buf_size; | |||
| @@ -17,16 +17,16 @@ | |||
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
| * | |||
| */ | |||
| /** | |||
| * @file golomb.c | |||
| * @brief | |||
| * @brief | |||
| * exp golomb vlc stuff | |||
| * @author Michael Niedermayer <michaelni@gmx.at> | |||
| */ | |||
| #include "common.h" | |||
| const uint8_t ff_golomb_vlc_len[512]={ | |||
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, | |||
| 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, | |||
| @@ -46,7 +46,7 @@ const uint8_t ff_golomb_vlc_len[512]={ | |||
| 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 | |||
| }; | |||
| const uint8_t ff_ue_golomb_vlc_code[512]={ | |||
| const uint8_t ff_ue_golomb_vlc_code[512]={ | |||
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30, | |||
| 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14, | |||
| 3, 3, 3, 3, 3, 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, 4, | |||
| @@ -65,7 +65,7 @@ const uint8_t ff_ue_golomb_vlc_code[512]={ | |||
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 | |||
| }; | |||
| const int8_t ff_se_golomb_vlc_code[512]={ | |||
| const int8_t ff_se_golomb_vlc_code[512]={ | |||
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, -8, 9, -9, 10,-10, 11,-11, 12,-12, 13,-13, 14,-14, 15,-15, | |||
| 4, 4, 4, 4, -4, -4, -4, -4, 5, 5, 5, 5, -5, -5, -5, -5, 6, 6, 6, 6, -6, -6, -6, -6, 7, 7, 7, 7, -7, -7, -7, -7, | |||
| 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, | |||
| @@ -85,7 +85,7 @@ const int8_t ff_se_golomb_vlc_code[512]={ | |||
| }; | |||
| const uint8_t ff_ue_golomb_len[256]={ | |||
| const uint8_t ff_ue_golomb_len[256]={ | |||
| 1, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11, | |||
| 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,13, | |||
| 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, | |||
| @@ -115,12 +115,12 @@ const uint8_t ff_interleaved_golomb_vlc_len[256]={ | |||
| 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |||
| }; | |||
| const uint8_t ff_interleaved_ue_golomb_vlc_code[256]={ | |||
| const uint8_t ff_interleaved_ue_golomb_vlc_code[256]={ | |||
| 15,16,7, 7, 17,18,8, 8, 3, 3, 3, 3, 3, 3, 3, 3, | |||
| 19,20,9, 9, 21,22,10,10,4, 4, 4, 4, 4, 4, 4, 4, | |||
| 19,20,9, 9, 21,22,10,10,4, 4, 4, 4, 4, 4, 4, 4, | |||
| 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, | |||
| 23,24,11,11,25,26,12,12,5, 5, 5, 5, 5, 5, 5, 5, | |||
| 23,24,11,11,25,26,12,12,5, 5, 5, 5, 5, 5, 5, 5, | |||
| 27,28,13,13,29,30,14,14,6, 6, 6, 6, 6, 6, 6, 6, | |||
| 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, | |||
| @@ -134,7 +134,7 @@ const uint8_t ff_interleaved_ue_golomb_vlc_code[256]={ | |||
| 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
| }; | |||
| const int8_t ff_interleaved_se_golomb_vlc_code[256]={ | |||
| const int8_t ff_interleaved_se_golomb_vlc_code[256]={ | |||
| 8, -8, 4, 4, 9, -9, -4, -4, 2, 2, 2, 2, 2, 2, 2, 2, | |||
| 10,-10, 5, 5, 11,-11, -5, -5, -2, -2, -2, -2, -2, -2, -2, -2, | |||
| 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
| @@ -18,10 +18,10 @@ | |||
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
| * | |||
| */ | |||
| /** | |||
| * @file golomb.h | |||
| * @brief | |||
| * @brief | |||
| * exp golomb vlc stuff | |||
| * @author Michael Niedermayer <michaelni@gmx.at> and Alex Beregszaszi | |||
| */ | |||
| @@ -37,23 +37,23 @@ extern const uint8_t ff_interleaved_golomb_vlc_len[256]; | |||
| extern const uint8_t ff_interleaved_ue_golomb_vlc_code[256]; | |||
| extern const int8_t ff_interleaved_se_golomb_vlc_code[256]; | |||
| /** | |||
| * read unsigned exp golomb code. | |||
| */ | |||
| static inline int get_ue_golomb(GetBitContext *gb){ | |||
| unsigned int buf; | |||
| int log; | |||
| OPEN_READER(re, gb); | |||
| UPDATE_CACHE(re, gb); | |||
| buf=GET_CACHE(re, gb); | |||
| if(buf >= (1<<27)){ | |||
| buf >>= 32 - 9; | |||
| LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]); | |||
| CLOSE_READER(re, gb); | |||
| return ff_ue_golomb_vlc_code[buf]; | |||
| }else{ | |||
| log= 2*av_log2(buf) - 31; | |||
| @@ -61,7 +61,7 @@ static inline int get_ue_golomb(GetBitContext *gb){ | |||
| buf--; | |||
| LAST_SKIP_BITS(re, gb, 32 - log); | |||
| CLOSE_READER(re, gb); | |||
| return buf; | |||
| } | |||
| } | |||
| @@ -73,12 +73,12 @@ static inline int svq3_get_ue_golomb(GetBitContext *gb){ | |||
| OPEN_READER(re, gb); | |||
| UPDATE_CACHE(re, gb); | |||
| buf=GET_CACHE(re, gb); | |||
| if(buf&0xAA800000){ | |||
| buf >>= 32 - 8; | |||
| LAST_SKIP_BITS(re, gb, ff_interleaved_golomb_vlc_len[buf]); | |||
| CLOSE_READER(re, gb); | |||
| return ff_interleaved_ue_golomb_vlc_code[buf]; | |||
| }else{ | |||
| LAST_SKIP_BITS(re, gb, 8); | |||
| @@ -104,7 +104,7 @@ static inline int svq3_get_ue_golomb(GetBitContext *gb){ | |||
| */ | |||
| static inline int get_te0_golomb(GetBitContext *gb, int range){ | |||
| assert(range >= 1); | |||
| if(range==1) return 0; | |||
| else if(range==2) return get_bits1(gb)^1; | |||
| else return get_ue_golomb(gb); | |||
| @@ -115,7 +115,7 @@ static inline int get_te0_golomb(GetBitContext *gb, int range){ | |||
| */ | |||
| static inline int get_te_golomb(GetBitContext *gb, int range){ | |||
| assert(range >= 1); | |||
| if(range==2) return get_bits1(gb)^1; | |||
| else return get_ue_golomb(gb); | |||
| } | |||
| @@ -127,24 +127,24 @@ static inline int get_te_golomb(GetBitContext *gb, int range){ | |||
| static inline int get_se_golomb(GetBitContext *gb){ | |||
| unsigned int buf; | |||
| int log; | |||
| OPEN_READER(re, gb); | |||
| UPDATE_CACHE(re, gb); | |||
| buf=GET_CACHE(re, gb); | |||
| if(buf >= (1<<27)){ | |||
| buf >>= 32 - 9; | |||
| LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]); | |||
| CLOSE_READER(re, gb); | |||
| return ff_se_golomb_vlc_code[buf]; | |||
| }else{ | |||
| log= 2*av_log2(buf) - 31; | |||
| buf>>= log; | |||
| LAST_SKIP_BITS(re, gb, 32 - log); | |||
| CLOSE_READER(re, gb); | |||
| if(buf&1) buf= -(buf>>1); | |||
| else buf= (buf>>1); | |||
| @@ -164,7 +164,7 @@ static inline int svq3_get_se_golomb(GetBitContext *gb){ | |||
| buf >>= 32 - 8; | |||
| LAST_SKIP_BITS(re, gb, ff_interleaved_golomb_vlc_len[buf]); | |||
| CLOSE_READER(re, gb); | |||
| return ff_interleaved_se_golomb_vlc_code[buf]; | |||
| }else{ | |||
| LAST_SKIP_BITS(re, gb, 8); | |||
| @@ -191,7 +191,7 @@ static inline int svq3_get_se_golomb(GetBitContext *gb){ | |||
| static inline int get_ur_golomb(GetBitContext *gb, int k, int limit, int esc_len){ | |||
| unsigned int buf; | |||
| int log; | |||
| OPEN_READER(re, gb); | |||
| UPDATE_CACHE(re, gb); | |||
| buf=GET_CACHE(re, gb); | |||
| @@ -203,13 +203,13 @@ static inline int get_ur_golomb(GetBitContext *gb, int k, int limit, int esc_len | |||
| buf += (30-log)<<k; | |||
| LAST_SKIP_BITS(re, gb, 32 + k - log); | |||
| CLOSE_READER(re, gb); | |||
| return buf; | |||
| }else{ | |||
| buf >>= 32 - limit - esc_len; | |||
| LAST_SKIP_BITS(re, gb, esc_len + limit); | |||
| CLOSE_READER(re, gb); | |||
| return buf + limit - 1; | |||
| } | |||
| } | |||
| @@ -220,19 +220,19 @@ static inline int get_ur_golomb(GetBitContext *gb, int k, int limit, int esc_len | |||
| static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit, int esc_len){ | |||
| unsigned int buf; | |||
| int log; | |||
| OPEN_READER(re, gb); | |||
| UPDATE_CACHE(re, gb); | |||
| buf=GET_CACHE(re, gb); | |||
| log= av_log2(buf); | |||
| if(log > 31-11){ | |||
| buf >>= log - k; | |||
| buf += (30-log)<<k; | |||
| LAST_SKIP_BITS(re, gb, 32 + k - log); | |||
| CLOSE_READER(re, gb); | |||
| return buf; | |||
| }else{ | |||
| int i; | |||
| @@ -256,7 +256,7 @@ static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit, int | |||
| buf = SHOW_UBITS(re, gb, esc_len); | |||
| LAST_SKIP_BITS(re, gb, esc_len); | |||
| CLOSE_READER(re, gb); | |||
| return buf + 1; | |||
| }else | |||
| return -1; | |||
| @@ -268,11 +268,11 @@ static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit, int | |||
| */ | |||
| static inline int get_sr_golomb(GetBitContext *gb, int k, int limit, int esc_len){ | |||
| int v= get_ur_golomb(gb, k, limit, esc_len); | |||
| v++; | |||
| if (v&1) return v>>1; | |||
| else return -(v>>1); | |||
| // return (v>>1) ^ -(v&1); | |||
| } | |||
| @@ -313,11 +313,11 @@ static inline int get_ue(GetBitContext *s, char *file, const char *func, int lin | |||
| int i= get_ue_golomb(s); | |||
| int len= get_bits_count(s) - pos; | |||
| int bits= show>>(24-len); | |||
| print_bin(bits, len); | |||
| av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d ue @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line); | |||
| return i; | |||
| } | |||
| @@ -327,11 +327,11 @@ static inline int get_se(GetBitContext *s, char *file, const char *func, int lin | |||
| int i= get_se_golomb(s); | |||
| int len= get_bits_count(s) - pos; | |||
| int bits= show>>(24-len); | |||
| print_bin(bits, len); | |||
| av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d se @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line); | |||
| return i; | |||
| } | |||
| @@ -341,11 +341,11 @@ static inline int get_te(GetBitContext *s, int r, char *file, const char *func, | |||
| int i= get_te0_golomb(s, r); | |||
| int len= get_bits_count(s) - pos; | |||
| int bits= show>>(24-len); | |||
| print_bin(bits, len); | |||
| av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d te @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line); | |||
| return i; | |||
| } | |||
| @@ -361,7 +361,7 @@ static inline int get_te(GetBitContext *s, int r, char *file, const char *func, | |||
| */ | |||
| static inline void set_ue_golomb(PutBitContext *pb, int i){ | |||
| int e; | |||
| assert(i>=0); | |||
| #if 0 | |||
| @@ -374,7 +374,7 @@ static inline void set_ue_golomb(PutBitContext *pb, int i){ | |||
| put_bits(pb, ff_ue_golomb_len[i], i+1); | |||
| else{ | |||
| e= av_log2(i+1); | |||
| put_bits(pb, 2*e+1, i+1); | |||
| } | |||
| } | |||
| @@ -396,7 +396,7 @@ static inline void set_te_golomb(PutBitContext *pb, int i, int range){ | |||
| static inline void set_se_golomb(PutBitContext *pb, int i){ | |||
| // if (i>32767 || i<-32767) | |||
| // av_log(NULL,AV_LOG_ERROR,"value out of range %d\n", i); | |||
| #if 0 | |||
| #if 0 | |||
| if(i<=0) i= -2*i; | |||
| else i= 2*i-1; | |||
| #elif 1 | |||
| @@ -414,9 +414,9 @@ static inline void set_se_golomb(PutBitContext *pb, int i){ | |||
| */ | |||
| static inline void set_ur_golomb(PutBitContext *pb, int i, int k, int limit, int esc_len){ | |||
| int e; | |||
| assert(i>=0); | |||
| e= i>>k; | |||
| if(e<limit){ | |||
| put_bits(pb, e + k + 1, (1<<k) + (i&((1<<k)-1))); | |||
| @@ -430,9 +430,9 @@ static inline void set_ur_golomb(PutBitContext *pb, int i, int k, int limit, int | |||
| */ | |||
| static inline void set_ur_golomb_jpegls(PutBitContext *pb, int i, int k, int limit, int esc_len){ | |||
| int e; | |||
| assert(i>=0); | |||
| e= (i>>k) + 1; | |||
| if(e<limit){ | |||
| put_bits(pb, e, 1); | |||
| @@ -103,22 +103,22 @@ void ff_h261_encode_picture_header(MpegEncContext * s, int picture_number){ | |||
| put_bits(&s->pb, 20, 0x10); /* PSC */ | |||
| temp_ref= s->picture_number * (int64_t)30000 * s->avctx->time_base.num / | |||
| temp_ref= s->picture_number * (int64_t)30000 * s->avctx->time_base.num / | |||
| (1001 * (int64_t)s->avctx->time_base.den); //FIXME maybe this should use a timestamp | |||
| put_bits(&s->pb, 5, temp_ref & 0x1f); /* TemporalReference */ | |||
| put_bits(&s->pb, 1, 0); /* split screen off */ | |||
| put_bits(&s->pb, 1, 0); /* camera off */ | |||
| put_bits(&s->pb, 1, 0); /* freeze picture release off */ | |||
| format = ff_h261_get_picture_format(s->width, s->height); | |||
| put_bits(&s->pb, 1, format); /* 0 == QCIF, 1 == CIF */ | |||
| put_bits(&s->pb, 1, 0); /* still image mode */ | |||
| put_bits(&s->pb, 1, 0); /* reserved */ | |||
| put_bits(&s->pb, 1, 0); /* no PEI */ | |||
| put_bits(&s->pb, 1, 0); /* no PEI */ | |||
| if(format == 0) | |||
| h->gob_number = -1; | |||
| else | |||
| @@ -160,7 +160,7 @@ void ff_h261_reorder_mb_index(MpegEncContext* s){ | |||
| s->mb_y = index % 3 ; index /= 3; | |||
| s->mb_x+= 11*(index % 2); index /= 2; | |||
| s->mb_y+= 3*index; | |||
| ff_init_block_index(s); | |||
| ff_update_block_index(s); | |||
| } | |||
| @@ -172,14 +172,14 @@ static void h261_encode_motion(H261Context * h, int val){ | |||
| if(val==0){ | |||
| code = 0; | |||
| put_bits(&s->pb,h261_mv_tab[code][1],h261_mv_tab[code][0]); | |||
| } | |||
| } | |||
| else{ | |||
| if(val > 15) | |||
| val -=32; | |||
| if(val < -16) | |||
| val+=32; | |||
| sign = val < 0; | |||
| code = sign ? -val : val; | |||
| code = sign ? -val : val; | |||
| put_bits(&s->pb,h261_mv_tab[code][1],h261_mv_tab[code][0]); | |||
| put_bits(&s->pb,1,sign); | |||
| } | |||
| @@ -204,14 +204,14 @@ void ff_h261_encode_mb(MpegEncContext * s, | |||
| int mvd, mv_diff_x, mv_diff_y, i, cbp; | |||
| cbp = 63; // avoid warning | |||
| mvd = 0; | |||
| h->current_mba++; | |||
| h->mtype = 0; | |||
| if (!s->mb_intra){ | |||
| /* compute cbp */ | |||
| cbp= get_cbp(s, block); | |||
| /* mvd indicates if this block is motion compensated */ | |||
| mvd = motion_x | motion_y; | |||
| @@ -226,11 +226,11 @@ void ff_h261_encode_mb(MpegEncContext * s, | |||
| /* MB is not skipped, encode MBA */ | |||
| put_bits(&s->pb, h261_mba_bits[(h->current_mba-h->previous_mba)-1], h261_mba_code[(h->current_mba-h->previous_mba)-1]); | |||
| /* calculate MTYPE */ | |||
| if(!s->mb_intra){ | |||
| h->mtype++; | |||
| if(mvd || s->loop_filter) | |||
| h->mtype+=3; | |||
| if(s->loop_filter) | |||
| @@ -240,18 +240,18 @@ void ff_h261_encode_mb(MpegEncContext * s, | |||
| assert(h->mtype > 1); | |||
| } | |||
| if(s->dquant) | |||
| if(s->dquant) | |||
| h->mtype++; | |||
| put_bits(&s->pb, h261_mtype_bits[h->mtype], h261_mtype_code[h->mtype]); | |||
| h->mtype = h261_mtype_map[h->mtype]; | |||
| if(IS_QUANT(h->mtype)){ | |||
| ff_set_qscale(s,s->qscale+s->dquant); | |||
| put_bits(&s->pb, 5, s->qscale); | |||
| } | |||
| if(IS_16X16(h->mtype)){ | |||
| mv_diff_x = (motion_x >> 1) - h->current_mv_x; | |||
| mv_diff_y = (motion_y >> 1) - h->current_mv_y; | |||
| @@ -260,11 +260,11 @@ void ff_h261_encode_mb(MpegEncContext * s, | |||
| h261_encode_motion(h,mv_diff_x); | |||
| h261_encode_motion(h,mv_diff_y); | |||
| } | |||
| h->previous_mba = h->current_mba; | |||
| if(HAS_CBP(h->mtype)){ | |||
| put_bits(&s->pb,h261_cbp_tab[cbp-1][1],h261_cbp_tab[cbp-1][0]); | |||
| put_bits(&s->pb,h261_cbp_tab[cbp-1][1],h261_cbp_tab[cbp-1][0]); | |||
| } | |||
| for(i=0; i<6; i++) { | |||
| /* encode each block */ | |||
| @@ -279,7 +279,7 @@ void ff_h261_encode_mb(MpegEncContext * s, | |||
| void ff_h261_encode_init(MpegEncContext *s){ | |||
| static int done = 0; | |||
| if (!done) { | |||
| done = 1; | |||
| init_rl(&h261_rl_tcoeff, 1); | |||
| @@ -328,7 +328,7 @@ static void h261_encode_block(H261Context * h, DCTELEM * block, int n){ | |||
| } else { | |||
| i = 0; | |||
| } | |||
| /* AC coefs */ | |||
| last_index = s->block_last_index[n]; | |||
| last_non_zero = i - 1; | |||
| @@ -417,7 +417,7 @@ static int h261_decode_init(AVCodecContext *avctx){ | |||
| h261_decode_init_vlc(h); | |||
| h->gob_start_code_skipped = 0; | |||
| return 0; | |||
| } | |||
| @@ -428,7 +428,7 @@ static int h261_decode_init(AVCodecContext *avctx){ | |||
| static int h261_decode_gob_header(H261Context *h){ | |||
| unsigned int val; | |||
| MpegEncContext * const s = &h->s; | |||
| if ( !h->gob_start_code_skipped ){ | |||
| /* Check for GOB Start Code */ | |||
| val = show_bits(&s->gb, 15); | |||
| @@ -520,7 +520,7 @@ static int h261_decode_mb_skipped(H261Context *h, int mba1, int mba2 ) | |||
| { | |||
| MpegEncContext * const s = &h->s; | |||
| int i; | |||
| s->mb_intra = 0; | |||
| for(i=mba1; i<mba2; i++){ | |||
| @@ -560,7 +560,7 @@ static int decode_mv_component(GetBitContext *gb, int v){ | |||
| if(mv_diff && !get_bits1(gb)) | |||
| mv_diff= -mv_diff; | |||
| v += mv_diff; | |||
| if (v <=-16) v+= 32; | |||
| else if(v >= 16) v-= 32; | |||
| @@ -599,7 +599,7 @@ static int h261_decode_mb(H261Context *h){ | |||
| if ( h->current_mba > MBA_STUFFING ) | |||
| return SLICE_ERROR; | |||
| s->mb_x= ((h->gob_number-1) % 2) * 11 + ((h->current_mba-1) % 11); | |||
| s->mb_y= ((h->gob_number-1) / 2) * 3 + ((h->current_mba-1) / 11); | |||
| xy = s->mb_x + s->mb_y * s->mb_stride; | |||
| @@ -687,7 +687,7 @@ static int h261_decode_block(H261Context * h, DCTELEM * block, | |||
| int code, level, i, j, run; | |||
| RLTable *rl = &h261_rl_tcoeff; | |||
| const uint8_t *scan_table; | |||
| // For the variable length encoding there are two code tables, one being used for | |||
| // the first transmitted LEVEL in INTER, INTER+MC and INTER+MC+FIL blocks, the second | |||
| // for all other LEVELs except the first one in INTRA blocks which is fixed length | |||
| @@ -812,7 +812,7 @@ int h261_decode_picture_header(H261Context *h){ | |||
| skip_bits(&s->gb, 8); | |||
| } | |||
| // h261 has no I-FRAMES, but if we pass I_TYPE for the first frame, the codec crashes if it does | |||
| // h261 has no I-FRAMES, but if we pass I_TYPE for the first frame, the codec crashes if it does | |||
| // not contain all I-blocks (e.g. when a packet is lost) | |||
| s->pict_type = P_TYPE; | |||
| @@ -822,7 +822,7 @@ int h261_decode_picture_header(H261Context *h){ | |||
| static int h261_decode_gob(H261Context *h){ | |||
| MpegEncContext * const s = &h->s; | |||
| ff_set_qscale(s, s->qscale); | |||
| /* decode mb's */ | |||
| @@ -833,16 +833,16 @@ static int h261_decode_gob(H261Context *h){ | |||
| ret= h261_decode_mb(h); | |||
| if(ret<0){ | |||
| if(ret==SLICE_END){ | |||
| h261_decode_mb_skipped(h, h->current_mba, 33); | |||
| h261_decode_mb_skipped(h, h->current_mba, 33); | |||
| return 0; | |||
| } | |||
| av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", s->mb_x + s->mb_y*s->mb_stride); | |||
| return -1; | |||
| } | |||
| h261_decode_mb_skipped(h, h->current_mba-h->mba_diff, h->current_mba-1); | |||
| } | |||
| return -1; | |||
| } | |||
| @@ -852,7 +852,7 @@ static int h261_find_frame_end(ParseContext *pc, AVCodecContext* avctx, const ui | |||
| vop_found= pc->frame_start_found; | |||
| state= pc->state; | |||
| for(i=0; i<buf_size && !vop_found; i++){ | |||
| state= (state<<8) | buf[i]; | |||
| for(j=0; j<8; j++){ | |||
| @@ -883,12 +883,12 @@ static int h261_find_frame_end(ParseContext *pc, AVCodecContext* avctx, const ui | |||
| static int h261_parse(AVCodecParserContext *s, | |||
| AVCodecContext *avctx, | |||
| uint8_t **poutbuf, int *poutbuf_size, | |||
| uint8_t **poutbuf, int *poutbuf_size, | |||
| const uint8_t *buf, int buf_size) | |||
| { | |||
| ParseContext *pc = s->priv_data; | |||
| int next; | |||
| next= h261_find_frame_end(pc,avctx, buf, buf_size); | |||
| if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) { | |||
| *poutbuf = NULL; | |||
| @@ -10,16 +10,16 @@ const uint8_t intra_MCBPC_bits[9] = { 1, 3, 3, 3, 4, 6, 6, 6, 9 }; | |||
| /* inter MCBPC, mb_type = (inter), (intra), (interq), (intraq), (inter4v) */ | |||
| /* Changed the tables for interq and inter4v+q, following the standard ** Juanjo ** */ | |||
| const uint8_t inter_MCBPC_code[28] = { | |||
| 1, 3, 2, 5, | |||
| 3, 4, 3, 3, | |||
| const uint8_t inter_MCBPC_code[28] = { | |||
| 1, 3, 2, 5, | |||
| 3, 4, 3, 3, | |||
| 3, 7, 6, 5, | |||
| 4, 4, 3, 2, | |||
| 2, 5, 4, 5, | |||
| 1, 0, 0, 0, /* Stuffing */ | |||
| 2, 12, 14, 15, | |||
| }; | |||
| const uint8_t inter_MCBPC_bits[28] = { | |||
| const uint8_t inter_MCBPC_bits[28] = { | |||
| 1, 4, 4, 6, /* inter */ | |||
| 5, 8, 8, 7, /* intra */ | |||
| 3, 7, 7, 9, /* interQ */ | |||
| @@ -30,9 +30,9 @@ const uint8_t inter_MCBPC_bits[28] = { | |||
| }; | |||
| static const uint8_t h263_mbtype_b_tab[15][2] = { | |||
| {1, 1}, | |||
| {3, 3}, | |||
| {1, 5}, | |||
| {1, 1}, | |||
| {3, 3}, | |||
| {1, 5}, | |||
| {4, 4}, | |||
| {5, 4}, | |||
| {6, 6}, | |||
| @@ -158,63 +158,63 @@ static RLTable rl_inter = { | |||
| }; | |||
| 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 }, | |||
| { 0x1a, 9 }, { 0x1b, 9 }, { 0x1c, 9 }, { 0x1d, 9 }, | |||
| { 0x1e, 9 }, { 0x1f, 9 }, { 0x23, 11 }, { 0x22, 11 }, | |||
| { 0x57, 12 }, { 0x56, 12 }, { 0x55, 12 }, { 0x54, 12 }, | |||
| { 0x53, 12 }, { 0xf, 4 }, { 0x14, 6 }, { 0x14, 7 }, | |||
| { 0x1e, 8 }, { 0xf, 10 }, { 0x21, 11 }, { 0x50, 12 }, | |||
| { 0xb, 5 }, { 0x15, 7 }, { 0xe, 10 }, { 0x9, 10 }, | |||
| { 0x15, 6 }, { 0x1d, 8 }, { 0xd, 10 }, { 0x51, 12 }, | |||
| { 0x13, 6 }, { 0x23, 9 }, { 0x7, 11 }, { 0x17, 7 }, | |||
| { 0x22, 9 }, { 0x52, 12 }, { 0x1c, 8 }, { 0xc, 10 }, | |||
| { 0x1f, 8 }, { 0xb, 10 }, { 0x25, 9 }, { 0xa, 10 }, | |||
| { 0x24, 9 }, { 0x6, 11 }, { 0x21, 10 }, { 0x20, 10 }, | |||
| { 0x8, 10 }, { 0x20, 11 }, { 0x7, 4 }, { 0xc, 6 }, | |||
| { 0x10, 7 }, { 0x13, 8 }, { 0x11, 9 }, { 0x12, 9 }, | |||
| { 0x4, 10 }, { 0x27, 11 }, { 0x26, 11 }, { 0x5f, 12 }, | |||
| { 0xf, 6 }, { 0x13, 9 }, { 0x5, 10 }, { 0x25, 11 }, | |||
| { 0xe, 6 }, { 0x14, 9 }, { 0x24, 11 }, { 0xd, 6 }, | |||
| { 0x6, 10 }, { 0x5e, 12 }, { 0x11, 7 }, { 0x7, 10 }, | |||
| { 0x13, 7 }, { 0x5d, 12 }, { 0x12, 7 }, { 0x5c, 12 }, | |||
| { 0x14, 8 }, { 0x5b, 12 }, { 0x15, 8 }, { 0x1a, 8 }, | |||
| { 0x19, 8 }, { 0x18, 8 }, { 0x17, 8 }, { 0x16, 8 }, | |||
| { 0x19, 9 }, { 0x15, 9 }, { 0x16, 9 }, { 0x18, 9 }, | |||
| { 0x17, 9 }, { 0x4, 11 }, { 0x5, 11 }, { 0x58, 12 }, | |||
| { 0x2, 2 }, { 0x6, 3 }, { 0xe, 4 }, { 0xc, 5 }, | |||
| { 0xd, 5 }, { 0x10, 6 }, { 0x11, 6 }, { 0x12, 6 }, | |||
| { 0x16, 7 }, { 0x1b, 8 }, { 0x20, 9 }, { 0x21, 9 }, | |||
| { 0x1a, 9 }, { 0x1b, 9 }, { 0x1c, 9 }, { 0x1d, 9 }, | |||
| { 0x1e, 9 }, { 0x1f, 9 }, { 0x23, 11 }, { 0x22, 11 }, | |||
| { 0x57, 12 }, { 0x56, 12 }, { 0x55, 12 }, { 0x54, 12 }, | |||
| { 0x53, 12 }, { 0xf, 4 }, { 0x14, 6 }, { 0x14, 7 }, | |||
| { 0x1e, 8 }, { 0xf, 10 }, { 0x21, 11 }, { 0x50, 12 }, | |||
| { 0xb, 5 }, { 0x15, 7 }, { 0xe, 10 }, { 0x9, 10 }, | |||
| { 0x15, 6 }, { 0x1d, 8 }, { 0xd, 10 }, { 0x51, 12 }, | |||
| { 0x13, 6 }, { 0x23, 9 }, { 0x7, 11 }, { 0x17, 7 }, | |||
| { 0x22, 9 }, { 0x52, 12 }, { 0x1c, 8 }, { 0xc, 10 }, | |||
| { 0x1f, 8 }, { 0xb, 10 }, { 0x25, 9 }, { 0xa, 10 }, | |||
| { 0x24, 9 }, { 0x6, 11 }, { 0x21, 10 }, { 0x20, 10 }, | |||
| { 0x8, 10 }, { 0x20, 11 }, { 0x7, 4 }, { 0xc, 6 }, | |||
| { 0x10, 7 }, { 0x13, 8 }, { 0x11, 9 }, { 0x12, 9 }, | |||
| { 0x4, 10 }, { 0x27, 11 }, { 0x26, 11 }, { 0x5f, 12 }, | |||
| { 0xf, 6 }, { 0x13, 9 }, { 0x5, 10 }, { 0x25, 11 }, | |||
| { 0xe, 6 }, { 0x14, 9 }, { 0x24, 11 }, { 0xd, 6 }, | |||
| { 0x6, 10 }, { 0x5e, 12 }, { 0x11, 7 }, { 0x7, 10 }, | |||
| { 0x13, 7 }, { 0x5d, 12 }, { 0x12, 7 }, { 0x5c, 12 }, | |||
| { 0x14, 8 }, { 0x5b, 12 }, { 0x15, 8 }, { 0x1a, 8 }, | |||
| { 0x19, 8 }, { 0x18, 8 }, { 0x17, 8 }, { 0x16, 8 }, | |||
| { 0x19, 9 }, { 0x15, 9 }, { 0x16, 9 }, { 0x18, 9 }, | |||
| { 0x17, 9 }, { 0x4, 11 }, { 0x5, 11 }, { 0x58, 12 }, | |||
| { 0x59, 12 }, { 0x5a, 12 }, { 0x3, 7 }, | |||
| }; | |||
| 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, | |||
| 0, 1, 1, 1, 1, 1, 1, 1, | |||
| 2, 2, 2, 2, 3, 3, 3, 3, | |||
| 4, 4, 4, 5, 5, 5, 6, 6, | |||
| 7, 7, 8, 8, 9, 9, 10, 11, | |||
| 12, 13, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 1, 1, 1, 1, | |||
| 2, 2, 2, 3, 3, 3, 4, 4, | |||
| 5, 5, 6, 6, 7, 7, 8, 9, | |||
| 10, 11, 12, 13, 14, 15, 16, 17, | |||
| 18, 19, 20, 21, 22, 23, | |||
| 0, 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, 1, 1, 1, | |||
| 2, 2, 2, 2, 3, 3, 3, 3, | |||
| 4, 4, 4, 5, 5, 5, 6, 6, | |||
| 7, 7, 8, 8, 9, 9, 10, 11, | |||
| 12, 13, 0, 0, 0, 0, 0, 0, | |||
| 0, 0, 0, 0, 1, 1, 1, 1, | |||
| 2, 2, 2, 3, 3, 3, 4, 4, | |||
| 5, 5, 6, 6, 7, 7, 8, 9, | |||
| 10, 11, 12, 13, 14, 15, 16, 17, | |||
| 18, 19, 20, 21, 22, 23, | |||
| }; | |||
| 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, | |||
| 25, 1, 2, 3, 4, 5, 6, 7, | |||
| 1, 2, 3, 4, 1, 2, 3, 4, | |||
| 1, 2, 3, 1, 2, 3, 1, 2, | |||
| 1, 2, 1, 2, 1, 2, 1, 1, | |||
| 1, 1, 1, 2, 3, 4, 5, 6, | |||
| 7, 8, 9, 10, 1, 2, 3, 4, | |||
| 1, 2, 3, 1, 2, 3, 1, 2, | |||
| 1, 2, 1, 2, 1, 2, 1, 1, | |||
| 1, 1, 1, 1, 1, 1, 1, 1, | |||
| 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, 1, 2, 3, 4, 5, 6, 7, | |||
| 1, 2, 3, 4, 1, 2, 3, 4, | |||
| 1, 2, 3, 1, 2, 3, 1, 2, | |||
| 1, 2, 1, 2, 1, 2, 1, 1, | |||
| 1, 1, 1, 2, 3, 4, 5, 6, | |||
| 7, 8, 9, 10, 1, 2, 3, 4, | |||
| 1, 2, 3, 1, 2, 3, 1, 2, | |||
| 1, 2, 1, 2, 1, 2, 1, 1, | |||
| 1, 1, 1, 1, 1, 1, 1, 1, | |||
| 1, 1, 1, 1, 1, 1, | |||
| }; | |||
| @@ -227,18 +227,18 @@ static RLTable rl_intra_aic = { | |||
| }; | |||
| static const uint8_t wrong_run[102] = { | |||
| 1, 2, 3, 5, 4, 10, 9, 8, | |||
| 11, 15, 17, 16, 23, 22, 21, 20, | |||
| 19, 18, 25, 24, 27, 26, 11, 7, | |||
| 6, 1, 2, 13, 2, 2, 2, 2, | |||
| 6, 12, 3, 9, 1, 3, 4, 3, | |||
| 7, 4, 1, 1, 5, 5, 14, 6, | |||
| 1, 7, 1, 8, 1, 1, 1, 1, | |||
| 10, 1, 1, 5, 9, 17, 25, 24, | |||
| 29, 33, 32, 41, 2, 23, 28, 31, | |||
| 3, 22, 30, 4, 27, 40, 8, 26, | |||
| 6, 39, 7, 38, 16, 37, 15, 10, | |||
| 11, 12, 13, 14, 1, 21, 20, 18, | |||
| 1, 2, 3, 5, 4, 10, 9, 8, | |||
| 11, 15, 17, 16, 23, 22, 21, 20, | |||
| 19, 18, 25, 24, 27, 26, 11, 7, | |||
| 6, 1, 2, 13, 2, 2, 2, 2, | |||
| 6, 12, 3, 9, 1, 3, 4, 3, | |||
| 7, 4, 1, 1, 5, 5, 14, 6, | |||
| 1, 7, 1, 8, 1, 1, 1, 1, | |||
| 10, 1, 1, 5, 9, 17, 25, 24, | |||
| 29, 33, 32, 41, 2, 23, 28, 31, | |||
| 3, 22, 30, 4, 27, 40, 8, 26, | |||
| 6, 39, 7, 38, 16, 37, 15, 10, | |||
| 11, 12, 13, 14, 1, 21, 20, 18, | |||
| 19, 2, 1, 34, 35, 36 | |||
| }; | |||
| @@ -262,7 +262,7 @@ static const uint8_t modified_quant_tab[2][32]={ | |||
| 0, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9,10,11,12,13,14,15,16,17,18,18,19,20,21,22,23,24,25,26,27,28 | |||
| },{ | |||
| 0, 2, 3, 4, 5, 6, 7, 8, 9,10,11,13,14,15,16,17,18,19,20,21,22,24,25,26,27,28,29,30,31,31,31,26 | |||
| } | |||
| } | |||
| }; | |||
| const uint8_t ff_h263_chroma_qscale_table[32]={ | |||
| @@ -17,12 +17,12 @@ | |||
| * License along with this library; if not, write to the Free Software | |||
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
| */ | |||
| /** | |||
| * @file h263dec.c | |||
| * H.263 decoder. | |||
| */ | |||
| #include "avcodec.h" | |||
| #include "dsputil.h" | |||
| #include "mpegvideo.h" | |||
| @@ -109,7 +109,7 @@ int ff_h263_decode_init(AVCodecContext *avctx) | |||
| ff_msmpeg4_decode_init(s); | |||
| else | |||
| h263_decode_init_vlc(s); | |||
| return 0; | |||
| } | |||
| @@ -126,10 +126,10 @@ int ff_h263_decode_end(AVCodecContext *avctx) | |||
| */ | |||
| static int get_consumed_bytes(MpegEncContext *s, int buf_size){ | |||
| int pos= (get_bits_count(&s->gb)+7)>>3; | |||
| if(s->divx_packed){ | |||
| //we would have to scan through the whole buf to handle the weird reordering ... | |||
| return buf_size; | |||
| return buf_size; | |||
| }else if(s->flags&CODEC_FLAG_TRUNCATED){ | |||
| pos -= s->parse_context.last_index; | |||
| if(pos<0) pos=0; // padding is not really read so this might be -1 | |||
| @@ -147,20 +147,20 @@ static int decode_slice(MpegEncContext *s){ | |||
| const int mb_size= 16>>s->avctx->lowres; | |||
| s->last_resync_gb= s->gb; | |||
| s->first_slice_line= 1; | |||
| s->resync_mb_x= s->mb_x; | |||
| s->resync_mb_y= s->mb_y; | |||
| ff_set_qscale(s, s->qscale); | |||
| if(s->partitioned_frame){ | |||
| const int qscale= s->qscale; | |||
| if(s->codec_id==CODEC_ID_MPEG4){ | |||
| if(ff_mpeg4_decode_partitions(s) < 0) | |||
| return -1; | |||
| return -1; | |||
| } | |||
| /* restore variables which were modified */ | |||
| s->first_slice_line=1; | |||
| s->mb_x= s->resync_mb_x; | |||
| @@ -177,13 +177,13 @@ static int decode_slice(MpegEncContext *s){ | |||
| return 0; | |||
| } | |||
| } | |||
| if(s->msmpeg4_version==1){ | |||
| s->last_dc[0]= | |||
| s->last_dc[1]= | |||
| s->last_dc[2]= 128; | |||
| } | |||
| ff_init_block_index(s); | |||
| for(; s->mb_x < s->mb_width; s->mb_x++) { | |||
| int ret; | |||
| @@ -191,11 +191,11 @@ static int decode_slice(MpegEncContext *s){ | |||
| ff_update_block_index(s); | |||
| if(s->resync_mb_x == s->mb_x && s->resync_mb_y+1 == s->mb_y){ | |||
| s->first_slice_line=0; | |||
| s->first_slice_line=0; | |||
| } | |||
| /* DCT & quantize */ | |||
| s->mv_dir = MV_DIR_FORWARD; | |||
| s->mv_type = MV_TYPE_16X16; | |||
| // s->mb_skipped = 0; | |||
| @@ -216,13 +216,13 @@ static int decode_slice(MpegEncContext *s){ | |||
| ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask); | |||
| s->padding_bug_score--; | |||
| if(++s->mb_x >= s->mb_width){ | |||
| s->mb_x=0; | |||
| ff_draw_horiz_band(s, s->mb_y*mb_size, mb_size); | |||
| s->mb_y++; | |||
| } | |||
| return 0; | |||
| return 0; | |||
| }else if(ret==SLICE_NOEND){ | |||
| av_log(s->avctx, AV_LOG_ERROR, "Slice mismatch at MB: %d\n", xy); | |||
| 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)&part_mask); | |||
| @@ -230,7 +230,7 @@ static int decode_slice(MpegEncContext *s){ | |||
| } | |||
| av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", xy); | |||
| 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; | |||
| } | |||
| @@ -238,25 +238,25 @@ static int decode_slice(MpegEncContext *s){ | |||
| if(s->loop_filter) | |||
| ff_h263_loop_filter(s); | |||
| } | |||
| ff_draw_horiz_band(s, s->mb_y*mb_size, mb_size); | |||
| s->mb_x= 0; | |||
| } | |||
| assert(s->mb_x==0 && s->mb_y==s->mb_height); | |||
| /* try to detect the padding bug */ | |||
| if( s->codec_id==CODEC_ID_MPEG4 | |||
| && (s->workaround_bugs&FF_BUG_AUTODETECT) | |||
| && (s->workaround_bugs&FF_BUG_AUTODETECT) | |||
| && s->gb.size_in_bits - get_bits_count(&s->gb) >=0 | |||
| && s->gb.size_in_bits - get_bits_count(&s->gb) < 48 | |||
| // && !s->resync_marker | |||
| && !s->data_partitioning){ | |||
| const int bits_count= get_bits_count(&s->gb); | |||
| const int bits_left = s->gb.size_in_bits - bits_count; | |||
| if(bits_left==0){ | |||
| s->padding_bug_score+=16; | |||
| } else if(bits_left != 1){ | |||
| @@ -268,10 +268,10 @@ static int decode_slice(MpegEncContext *s){ | |||
| else if(v==0x7F && ((get_bits_count(&s->gb)+8)&8) && bits_left<=16) | |||
| s->padding_bug_score+= 4; | |||
| else | |||
| s->padding_bug_score++; | |||
| } | |||
| s->padding_bug_score++; | |||
| } | |||
| } | |||
| if(s->workaround_bugs&FF_BUG_AUTODETECT){ | |||
| if(s->padding_bug_score > -2 && !s->data_partitioning /*&& (s->divx_version || !s->resync_marker)*/) | |||
| s->workaround_bugs |= FF_BUG_NO_PADDING; | |||
| @@ -283,17 +283,17 @@ static int decode_slice(MpegEncContext *s){ | |||
| if(s->msmpeg4_version || (s->workaround_bugs&FF_BUG_NO_PADDING)){ //FIXME perhaps solve this more cleanly | |||
| int left= s->gb.size_in_bits - get_bits_count(&s->gb); | |||
| int max_extra=7; | |||
| /* no markers in M$ crap */ | |||
| if(s->msmpeg4_version && s->pict_type==I_TYPE) | |||
| max_extra+= 17; | |||
| /* buggy padding but the frame should still end approximately at the bitstream end */ | |||
| if((s->workaround_bugs&FF_BUG_NO_PADDING) && s->error_resilience>=3) | |||
| max_extra+= 48; | |||
| else if((s->workaround_bugs&FF_BUG_NO_PADDING)) | |||
| max_extra+= 256*256*256*64; | |||
| if(left>max_extra){ | |||
| av_log(s->avctx, AV_LOG_ERROR, "discarding %d junk bits at end, next would be %X\n", left, show_bits(&s->gb, 24)); | |||
| } | |||
| @@ -301,14 +301,14 @@ static int decode_slice(MpegEncContext *s){ | |||
| av_log(s->avctx, AV_LOG_ERROR, "overreading %d bits\n", -left); | |||
| }else | |||
| 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); | |||
| return 0; | |||
| } | |||
| av_log(s->avctx, AV_LOG_ERROR, "slice end not reached but screenspace end (%d left %06X, score= %d)\n", | |||
| av_log(s->avctx, AV_LOG_ERROR, "slice end not reached but screenspace end (%d left %06X, score= %d)\n", | |||
| s->gb.size_in_bits - get_bits_count(&s->gb), | |||
| show_bits(&s->gb, 24), s->padding_bug_score); | |||
| ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask); | |||
| return -1; | |||
| @@ -321,10 +321,10 @@ static int decode_slice(MpegEncContext *s){ | |||
| int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){ | |||
| int vop_found, i; | |||
| uint32_t state; | |||
| vop_found= pc->frame_start_found; | |||
| state= pc->state; | |||
| i=0; | |||
| if(!vop_found){ | |||
| for(i=0; i<buf_size; i++){ | |||
| @@ -345,7 +345,7 @@ int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){ | |||
| state= (state<<8) | buf[i]; | |||
| if((state&0xFFFFFF00) == 0x100){ | |||
| pc->frame_start_found=0; | |||
| pc->state=-1; | |||
| pc->state=-1; | |||
| return i-3; | |||
| } | |||
| } | |||
| @@ -358,10 +358,10 @@ int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){ | |||
| static int h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){ | |||
| int vop_found, i; | |||
| uint32_t state; | |||
| vop_found= pc->frame_start_found; | |||
| state= pc->state; | |||
| i=0; | |||
| if(!vop_found){ | |||
| for(i=0; i<buf_size; i++){ | |||
| @@ -374,30 +374,30 @@ static int h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_siz | |||
| } | |||
| } | |||
| if(vop_found){ | |||
| if(vop_found){ | |||
| for(; i<buf_size; i++){ | |||
| state= (state<<8) | buf[i]; | |||
| if(state>>(32-22) == 0x20){ | |||
| pc->frame_start_found=0; | |||
| pc->state=-1; | |||
| pc->state=-1; | |||
| return i-3; | |||
| } | |||
| } | |||
| } | |||
| pc->frame_start_found= vop_found; | |||
| pc->state= state; | |||
| return END_NOT_FOUND; | |||
| } | |||
| static int h263_parse(AVCodecParserContext *s, | |||
| AVCodecContext *avctx, | |||
| uint8_t **poutbuf, int *poutbuf_size, | |||
| uint8_t **poutbuf, int *poutbuf_size, | |||
| const uint8_t *buf, int buf_size) | |||
| { | |||
| ParseContext *pc = s->priv_data; | |||
| int next; | |||
| next= h263_find_frame_end(pc, buf, buf_size); | |||
| if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) { | |||
| @@ -411,14 +411,14 @@ static int h263_parse(AVCodecParserContext *s, | |||
| return next; | |||
| } | |||
| int ff_h263_decode_frame(AVCodecContext *avctx, | |||
| int ff_h263_decode_frame(AVCodecContext *avctx, | |||
| void *data, int *data_size, | |||
| uint8_t *buf, int buf_size) | |||
| { | |||
| MpegEncContext *s = avctx->priv_data; | |||
| int ret; | |||
| AVFrame *pict = data; | |||
| AVFrame *pict = data; | |||
| #ifdef PRINT_FRAME_TIME | |||
| uint64_t time= rdtsc(); | |||
| #endif | |||
| @@ -444,7 +444,7 @@ uint64_t time= rdtsc(); | |||
| if(s->flags&CODEC_FLAG_TRUNCATED){ | |||
| int next; | |||
| if(s->codec_id==CODEC_ID_MPEG4){ | |||
| next= ff_mpeg4_find_frame_end(&s->parse_context, buf, buf_size); | |||
| }else if(s->codec_id==CODEC_ID_H263){ | |||
| @@ -453,14 +453,14 @@ uint64_t time= rdtsc(); | |||
| av_log(s->avctx, AV_LOG_ERROR, "this codec does not support truncated bitstreams\n"); | |||
| return -1; | |||
| } | |||
| if( ff_combine_frame(&s->parse_context, next, &buf, &buf_size) < 0 ) | |||
| return buf_size; | |||
| } | |||
| retry: | |||
| if(s->bitstream_buffer_size && (s->divx_packed || buf_size<20)){ //divx 5.01+/xvid frame reorder | |||
| init_get_bits(&s->gb, s->bitstream_buffer, s->bitstream_buffer_size*8); | |||
| }else | |||
| @@ -471,13 +471,13 @@ retry: | |||
| if (MPV_common_init(s) < 0) //we need the idct permutaton for reading a custom matrix | |||
| return -1; | |||
| } | |||
| //we need to set current_picture_ptr before reading the header, otherwise we cant store anyting im there | |||
| if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){ | |||
| int i= ff_find_unused_picture(s, 0); | |||
| s->current_picture_ptr= &s->picture[i]; | |||
| } | |||
| /* let's go :-) */ | |||
| if (s->msmpeg4_version==5) { | |||
| ret= ff_wmv2_decode_picture_header(s); | |||
| @@ -486,7 +486,7 @@ retry: | |||
| } else if (s->h263_pred) { | |||
| if(s->avctx->extradata_size && s->picture_number==0){ | |||
| GetBitContext gb; | |||
| init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8); | |||
| ret = ff_mpeg4_decode_picture_header(s, &gb); | |||
| } | |||
| @@ -501,7 +501,7 @@ retry: | |||
| } else { | |||
| ret = h263_decode_picture_header(s); | |||
| } | |||
| if(ret==FRAME_SKIPPED) return get_consumed_bytes(s, buf_size); | |||
| /* skip if the header was thrashed */ | |||
| @@ -509,16 +509,16 @@ retry: | |||
| av_log(s->avctx, AV_LOG_ERROR, "header damaged\n"); | |||
| return -1; | |||
| } | |||
| 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") || | |||
| 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->xvid_build= -1; | |||
| #if 0 | |||
| if(s->avctx->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->padding_bug_score > 0 && s->low_delay) // XVID with modified fourcc | |||
| s->xvid_build= -1; | |||
| #endif | |||
| } | |||
| @@ -527,14 +527,14 @@ retry: | |||
| if(s->avctx->codec_tag == ff_get_fourcc("DIVX") && s->vo_type==0 && s->vol_control_parameters==0) | |||
| s->divx_version= 400; //divx 4 | |||
| } | |||
| if(s->xvid_build && s->divx_version){ | |||
| s->divx_version= | |||
| s->divx_build= 0; | |||
| } | |||
| if(s->workaround_bugs&FF_BUG_AUTODETECT){ | |||
| if(s->avctx->codec_tag == ff_get_fourcc("XVIX")) | |||
| if(s->avctx->codec_tag == ff_get_fourcc("XVIX")) | |||
| s->workaround_bugs|= FF_BUG_XVID_ILACE; | |||
| if(s->avctx->codec_tag == ff_get_fourcc("UMP4")){ | |||
| @@ -551,7 +551,7 @@ retry: | |||
| if(s->xvid_build && s->xvid_build<=3) | |||
| s->padding_bug_score= 256*256*256*64; | |||
| if(s->xvid_build && s->xvid_build<=1) | |||
| s->workaround_bugs|= FF_BUG_QPEL_CHROMA; | |||
| @@ -568,14 +568,14 @@ retry: | |||
| if(s->lavc_build && s->lavc_build<4653) | |||
| s->workaround_bugs|= FF_BUG_STD_QPEL; | |||
| if(s->lavc_build && s->lavc_build<4655) | |||
| s->workaround_bugs|= FF_BUG_DIRECT_BLOCKSIZE; | |||
| if(s->lavc_build && s->lavc_build<4670){ | |||
| s->workaround_bugs|= FF_BUG_EDGE; | |||
| } | |||
| if(s->lavc_build && s->lavc_build<=4712) | |||
| s->workaround_bugs|= FF_BUG_DC_CLIP; | |||
| @@ -588,7 +588,7 @@ retry: | |||
| if(s->divx_version && s->divx_version<500){ | |||
| s->workaround_bugs|= FF_BUG_EDGE; | |||
| } | |||
| if(s->divx_version) | |||
| s->workaround_bugs|= FF_BUG_HPEL_CHROMA; | |||
| #if 0 | |||
| @@ -601,12 +601,12 @@ retry: | |||
| if( s->resync_marker==0 && s->data_partitioning==0 && s->divx_version==0 | |||
| && s->codec_id==CODEC_ID_MPEG4 && s->vo_type==0) | |||
| s->workaround_bugs|= FF_BUG_NO_PADDING; | |||
| if(s->lavc_build && s->lavc_build<4609) //FIXME not sure about the version num but a 4609 file seems ok | |||
| s->workaround_bugs|= FF_BUG_NO_PADDING; | |||
| #endif | |||
| } | |||
| if(s->workaround_bugs& FF_BUG_STD_QPEL){ | |||
| SET_QPEL_FUNC(qpel_pixels_tab[0][ 5], qpel16_mc11_old_c) | |||
| SET_QPEL_FUNC(qpel_pixels_tab[0][ 7], qpel16_mc31_old_c) | |||
| @@ -624,10 +624,10 @@ retry: | |||
| } | |||
| if(avctx->debug & FF_DEBUG_BUGS) | |||
| av_log(s->avctx, AV_LOG_DEBUG, "bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s\n", | |||
| av_log(s->avctx, AV_LOG_DEBUG, "bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s\n", | |||
| s->workaround_bugs, s->lavc_build, s->xvid_build, s->divx_version, s->divx_build, | |||
| s->divx_packed ? "p" : ""); | |||
| #if 0 // dump bits per frame / qp / complexity | |||
| { | |||
| static FILE *f=NULL; | |||
| @@ -647,8 +647,8 @@ retry: | |||
| /* and other parameters. So then we could init the picture */ | |||
| /* FIXME: By the way H263 decoder is evolving it should have */ | |||
| /* an H263EncContext */ | |||
| if ( s->width != avctx->coded_width | |||
| if ( s->width != avctx->coded_width | |||
| || s->height != avctx->coded_height) { | |||
| /* H.263 could change picture size any time */ | |||
| ParseContext pc= s->parse_context; //FIXME move these demuxng hack to avformat | |||
| @@ -664,7 +664,7 @@ retry: | |||
| if((s->codec_id==CODEC_ID_H263 || s->codec_id==CODEC_ID_H263P)) | |||
| s->gob_index = ff_h263_get_gob_height(s); | |||
| // for hurry_up==5 | |||
| s->current_picture.pict_type= s->pict_type; | |||
| s->current_picture.key_frame= s->pict_type == I_TYPE; | |||
| @@ -675,11 +675,11 @@ retry: | |||
| if(avctx->hurry_up && s->pict_type==B_TYPE) return get_consumed_bytes(s, 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) | |||
| return get_consumed_bytes(s, buf_size); | |||
| /* skip everything if we are in a hurry>=5 */ | |||
| if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size); | |||
| if(s->next_p_frame_damaged){ | |||
| if(s->pict_type==B_TYPE) | |||
| return get_consumed_bytes(s, buf_size); | |||
| @@ -695,7 +695,7 @@ retry: | |||
| #endif | |||
| ff_er_frame_start(s); | |||
| //the second part of the wmv2 header contains the MB skip bits which are stored in current_picture->mb_type | |||
| //which isnt available before MPV_frame_start() | |||
| if (s->msmpeg4_version==5){ | |||
| @@ -704,9 +704,9 @@ retry: | |||
| } | |||
| /* decode each macroblock */ | |||
| s->mb_x=0; | |||
| s->mb_x=0; | |||
| s->mb_y=0; | |||
| decode_slice(s); | |||
| while(s->mb_y<s->mb_height){ | |||
| if(s->msmpeg4_version){ | |||
| @@ -716,7 +716,7 @@ retry: | |||
| if(ff_h263_resync(s)<0) | |||
| break; | |||
| } | |||
| if(s->msmpeg4_version<4 && s->h263_pred) | |||
| ff_mpeg4_clean_buffers(s); | |||
| @@ -727,12 +727,12 @@ retry: | |||
| if(msmpeg4_decode_ext_header(s, buf_size) < 0){ | |||
| s->error_status_table[s->mb_num-1]= AC_ERROR|DC_ERROR|MV_ERROR; | |||
| } | |||
| /* divx 5.01+ bistream reorder stuff */ | |||
| if(s->codec_id==CODEC_ID_MPEG4 && s->bitstream_buffer_size==0 && s->divx_packed){ | |||
| int current_pos= get_bits_count(&s->gb)>>3; | |||
| int startcode_found=0; | |||
| if(buf_size - current_pos > 5){ | |||
| int i; | |||
| for(i=current_pos; i<buf_size-3; i++){ | |||
| @@ -749,8 +749,8 @@ retry: | |||
| if(startcode_found){ | |||
| s->bitstream_buffer= av_fast_realloc( | |||
| s->bitstream_buffer, | |||
| &s->allocated_bitstream_buffer_size, | |||
| s->bitstream_buffer, | |||
| &s->allocated_bitstream_buffer_size, | |||
| buf_size - current_pos + FF_INPUT_BUFFER_PADDING_SIZE); | |||
| memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos); | |||
| s->bitstream_buffer_size= buf_size - current_pos; | |||
| @@ -20,7 +20,7 @@ | |||
| /** | |||
| * @file h264data.h | |||
| * @brief | |||
| * @brief | |||
| * H264 / AVC / MPEG4 part10 codec data table | |||
| * @author Michael Niedermayer <michaelni@gmx.at> | |||
| */ | |||
| @@ -87,7 +87,7 @@ static const uint8_t golomb_to_intra4x4_cbp[48]={ | |||
| 16, 3, 5, 10, 12, 19, 21, 26, 28, 35, 37, 42, 44, 1, 2, 4, | |||
| 8, 17, 18, 20, 24, 6, 9, 22, 25, 32, 33, 34, 36, 40, 38, 41 | |||
| }; | |||
| static const uint8_t golomb_to_inter_cbp[48]={ | |||
| 0, 16, 1, 2, 4, 8, 32, 3, 5, 10, 12, 15, 47, 7, 11, 13, | |||
| 14, 6, 9, 31, 35, 37, 42, 44, 33, 34, 36, 40, 39, 43, 45, 46, | |||
| @@ -99,7 +99,7 @@ static const uint8_t intra4x4_cbp_to_golomb[48]={ | |||
| 16, 33, 34, 21, 35, 22, 39, 4, 36, 40, 23, 5, 24, 6, 7, 1, | |||
| 41, 42, 43, 25, 44, 26, 46, 12, 45, 47, 27, 13, 28, 14, 15, 0 | |||
| }; | |||
| static const uint8_t inter_cbp_to_golomb[48]={ | |||
| 0, 2, 3, 7, 4, 8, 17, 13, 5, 18, 9, 14, 10, 15, 16, 11, | |||
| 1, 32, 33, 36, 34, 37, 44, 40, 35, 45, 38, 41, 39, 42, 43, 19, | |||
| @@ -185,21 +185,21 @@ static const uint8_t coeff_token_bits[4][4*17]={ | |||
| }; | |||
| static const uint8_t total_zeros_len[16][16]= { | |||
| {1,3,3,4,4,5,5,6,6,7,7,8,8,9,9,9}, | |||
| {3,3,3,3,3,4,4,4,4,5,5,6,6,6,6}, | |||
| {4,3,3,3,4,4,3,3,4,5,5,6,5,6}, | |||
| {5,3,4,4,3,3,3,4,3,4,5,5,5}, | |||
| {4,4,4,3,3,3,3,3,4,5,4,5}, | |||
| {6,5,3,3,3,3,3,3,4,3,6}, | |||
| {6,5,3,3,3,2,3,4,3,6}, | |||
| {6,4,5,3,2,2,3,3,6}, | |||
| {6,6,4,2,2,3,2,5}, | |||
| {5,5,3,2,2,2,4}, | |||
| {4,4,3,3,1,3}, | |||
| {4,4,2,1,3}, | |||
| {3,3,1,2}, | |||
| {2,2,1}, | |||
| {1,1}, | |||
| {1,3,3,4,4,5,5,6,6,7,7,8,8,9,9,9}, | |||
| {3,3,3,3,3,4,4,4,4,5,5,6,6,6,6}, | |||
| {4,3,3,3,4,4,3,3,4,5,5,6,5,6}, | |||
| {5,3,4,4,3,3,3,4,3,4,5,5,5}, | |||
| {4,4,4,3,3,3,3,3,4,5,4,5}, | |||
| {6,5,3,3,3,3,3,3,4,3,6}, | |||
| {6,5,3,3,3,2,3,4,3,6}, | |||
| {6,4,5,3,2,2,3,3,6}, | |||
| {6,6,4,2,2,3,2,5}, | |||
| {5,5,3,2,2,2,4}, | |||
| {4,4,3,3,1,3}, | |||
| {4,4,2,1,3}, | |||
| {3,3,1,2}, | |||
| {2,2,1}, | |||
| {1,1}, | |||
| }; | |||
| static const uint8_t total_zeros_bits[16][16]= { | |||
| @@ -223,7 +223,7 @@ static const uint8_t total_zeros_bits[16][16]= { | |||
| static const uint8_t chroma_dc_total_zeros_len[3][4]= { | |||
| { 1, 2, 3, 3,}, | |||
| { 1, 2, 2, 0,}, | |||
| { 1, 1, 0, 0,}, | |||
| { 1, 1, 0, 0,}, | |||
| }; | |||
| static const uint8_t chroma_dc_total_zeros_bits[3][4]= { | |||
| @@ -274,16 +274,16 @@ static const uint8_t scan8[16 + 2*4]={ | |||
| }; | |||
| static const uint8_t zigzag_scan[16]={ | |||
| 0+0*4, 1+0*4, 0+1*4, 0+2*4, | |||
| 1+1*4, 2+0*4, 3+0*4, 2+1*4, | |||
| 1+2*4, 0+3*4, 1+3*4, 2+2*4, | |||
| 3+1*4, 3+2*4, 2+3*4, 3+3*4, | |||
| 0+0*4, 1+0*4, 0+1*4, 0+2*4, | |||
| 1+1*4, 2+0*4, 3+0*4, 2+1*4, | |||
| 1+2*4, 0+3*4, 1+3*4, 2+2*4, | |||
| 3+1*4, 3+2*4, 2+3*4, 3+3*4, | |||
| }; | |||
| static const uint8_t field_scan[16]={ | |||
| 0+0*4, 0+1*4, 1+0*4, 0+2*4, | |||
| 0+0*4, 0+1*4, 1+0*4, 0+2*4, | |||
| 0+3*4, 1+1*4, 1+2*4, 1+3*4, | |||
| 2+0*4, 2+1*4, 2+2*4, 2+3*4, | |||
| 2+0*4, 2+1*4, 2+2*4, 2+3*4, | |||
| 3+0*4, 3+1*4, 3+2*4, 3+3*4, | |||
| }; | |||
| @@ -295,14 +295,14 @@ static const uint8_t luma_dc_zigzag_scan[16]={ | |||
| }; | |||
| static const uint8_t luma_dc_field_scan[16]={ | |||
| 0*16 + 0*64, 2*16 + 0*64, 1*16 + 0*64, 0*16 + 2*64, | |||
| 2*16 + 2*64, 3*16 + 0*64, 1*16 + 2*64, 3*16 + 2*64, | |||
| 0*16 + 1*64, 2*16 + 1*64, 0*16 + 3*64, 2*16 + 3*64, | |||
| 0*16 + 0*64, 2*16 + 0*64, 1*16 + 0*64, 0*16 + 2*64, | |||
| 2*16 + 2*64, 3*16 + 0*64, 1*16 + 2*64, 3*16 + 2*64, | |||
| 0*16 + 1*64, 2*16 + 1*64, 0*16 + 3*64, 2*16 + 3*64, | |||
| 1*16 + 1*64, 3*16 + 1*64, 1*16 + 3*64, 3*16 + 3*64, | |||
| }; | |||
| static const uint8_t chroma_dc_scan[4]={ | |||
| (0+0*2)*16, (1+0*2)*16, | |||
| (0+0*2)*16, (1+0*2)*16, | |||
| (0+1*2)*16, (1+1*2)*16, //FIXME | |||
| }; | |||
| @@ -450,7 +450,7 @@ static const PMbInfo b_sub_mb_type_info[13]={ | |||
| 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, | |||
| 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]={ | |||
| @@ -17,13 +17,13 @@ | |||
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
| * | |||
| */ | |||
| /** | |||
| * @file h264-idct.c | |||
| * H.264 IDCT. | |||
| * @author Michael Niedermayer <michaelni@gmx.at> | |||
| */ | |||
| #include "dsputil.h" | |||
| static always_inline void idct_internal(uint8_t *dst, DCTELEM *block, int stride, int block_stride, int shift, int add){ | |||
| @@ -18,9 +18,9 @@ | |||
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
| * | |||
| * see http://www.pcisys.net/~melanson/codecs/huffyuv.txt for a description of | |||
| * the algorithm used | |||
| * the algorithm used | |||
| */ | |||
| /** | |||
| * @file huffyuv.c | |||
| * huffyuv codec for libavcodec. | |||
| @@ -48,7 +48,7 @@ typedef enum Predictor{ | |||
| PLANE, | |||
| MEDIAN, | |||
| } Predictor; | |||
| typedef struct HYuvContext{ | |||
| AVCodecContext *avctx; | |||
| Predictor predictor; | |||
| @@ -73,7 +73,7 @@ typedef struct HYuvContext{ | |||
| AVFrame picture; | |||
| uint8_t *bitstream_buffer; | |||
| int bitstream_buffer_size; | |||
| DSPContext dsp; | |||
| DSPContext dsp; | |||
| }HYuvContext; | |||
| static const unsigned char classic_shift_luma[] = { | |||
| @@ -156,7 +156,7 @@ static inline void add_median_prediction(uint8_t *dst, uint8_t *src1, uint8_t *d | |||
| l= mid_pred(l, src1[i], (l + src1[i] - lt)&0xFF) + diff[i]; | |||
| lt= src1[i]; | |||
| dst[i]= l; | |||
| } | |||
| } | |||
| *left= l; | |||
| *left_top= lt; | |||
| @@ -173,7 +173,7 @@ static inline void add_left_prediction_bgr32(uint8_t *dst, uint8_t *src, int w, | |||
| b+= src[4*i+B]; | |||
| g+= src[4*i+G]; | |||
| r+= src[4*i+R]; | |||
| dst[4*i+B]= b; | |||
| dst[4*i+G]= g; | |||
| dst[4*i+R]= r; | |||
| @@ -206,7 +206,7 @@ static inline int sub_left_prediction(HYuvContext *s, uint8_t *dst, uint8_t *src | |||
| static void read_len_table(uint8_t *dst, GetBitContext *gb){ | |||
| int i, val, repeat; | |||
| for(i=0; i<256;){ | |||
| repeat= get_bits(gb, 3); | |||
| val = get_bits(gb, 5); | |||
| @@ -240,19 +240,19 @@ static void generate_len_table(uint8_t *dst, uint64_t *stats, int size){ | |||
| uint64_t counts[2*size]; | |||
| int up[2*size]; | |||
| int offset, i, next; | |||
| for(offset=1; ; offset<<=1){ | |||
| for(i=0; i<size; i++){ | |||
| counts[i]= stats[i] + offset - 1; | |||
| } | |||
| for(next=size; next<size*2; next++){ | |||
| uint64_t min1, min2; | |||
| int min1_i, min2_i; | |||
| min1=min2= INT64_MAX; | |||
| min1_i= min2_i=-1; | |||
| for(i=0; i<next; i++){ | |||
| if(min2 > counts[i]){ | |||
| if(min1 > counts[i]){ | |||
| @@ -266,9 +266,9 @@ static void generate_len_table(uint8_t *dst, uint64_t *stats, int size){ | |||
| } | |||
| } | |||
| } | |||
| if(min2==INT64_MAX) break; | |||
| counts[next]= min1 + min2; | |||
| counts[min1_i]= | |||
| counts[min2_i]= INT64_MAX; | |||
| @@ -276,16 +276,16 @@ static void generate_len_table(uint8_t *dst, uint64_t *stats, int size){ | |||
| up[min2_i]= next; | |||
| up[next]= -1; | |||
| } | |||
| for(i=0; i<size; i++){ | |||
| int len; | |||
| int index=i; | |||
| for(len=0; up[index] != -1; len++) | |||
| index= up[index]; | |||
| if(len >= 32) break; | |||
| dst[i]= len; | |||
| } | |||
| if(i==size) break; | |||
| @@ -295,12 +295,12 @@ static void generate_len_table(uint8_t *dst, uint64_t *stats, int size){ | |||
| static int read_huffman_tables(HYuvContext *s, uint8_t *src, int length){ | |||
| GetBitContext gb; | |||
| int i; | |||
| init_get_bits(&gb, src, length*8); | |||
| for(i=0; i<3; i++){ | |||
| read_len_table(s->len[i], &gb); | |||
| if(generate_bits_table(s->bits[i], s->len[i])<0){ | |||
| return -1; | |||
| } | |||
| @@ -312,7 +312,7 @@ printf("%6X, %2d, %3d\n", s->bits[i][j], s->len[i][j], j); | |||
| free_vlc(&s->vlc[i]); | |||
| init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0); | |||
| } | |||
| return (get_bits_count(&gb)+7)/8; | |||
| } | |||
| @@ -325,7 +325,7 @@ static int read_old_huffman_tables(HYuvContext *s){ | |||
| read_len_table(s->len[0], &gb); | |||
| init_get_bits(&gb, classic_shift_chroma, sizeof(classic_shift_chroma)*8); | |||
| read_len_table(s->len[1], &gb); | |||
| for(i=0; i<256; i++) s->bits[0][i] = classic_add_luma [i]; | |||
| for(i=0; i<256; i++) s->bits[1][i] = classic_add_chroma[i]; | |||
| @@ -335,12 +335,12 @@ static int read_old_huffman_tables(HYuvContext *s){ | |||
| } | |||
| memcpy(s->bits[2], s->bits[1], 256*sizeof(uint32_t)); | |||
| memcpy(s->len[2] , s->len [1], 256*sizeof(uint8_t)); | |||
| for(i=0; i<3; i++){ | |||
| free_vlc(&s->vlc[i]); | |||
| init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0); | |||
| } | |||
| return 0; | |||
| #else | |||
| fprintf(stderr, "v1 huffyuv is not supported \n"); | |||
| @@ -350,7 +350,7 @@ static int read_old_huffman_tables(HYuvContext *s){ | |||
| static void alloc_temp(HYuvContext *s){ | |||
| int i; | |||
| if(s->bitstream_bpp<24){ | |||
| for(i=0; i<3; i++){ | |||
| s->temp[i]= av_malloc(s->width + 16); | |||
| @@ -365,13 +365,13 @@ static int common_init(AVCodecContext *avctx){ | |||
| s->avctx= avctx; | |||
| s->flags= avctx->flags; | |||
| dsputil_init(&s->dsp, avctx); | |||
| s->width= avctx->width; | |||
| s->height= avctx->height; | |||
| assert(s->width>0 && s->height>0); | |||
| return 0; | |||
| } | |||
| @@ -381,7 +381,7 @@ static int decode_init(AVCodecContext *avctx) | |||
| common_init(avctx); | |||
| memset(s->vlc, 0, 3*sizeof(VLC)); | |||
| avctx->coded_frame= &s->picture; | |||
| s->interlaced= s->height > 288; | |||
| @@ -395,7 +395,7 @@ s->bgr32=1; | |||
| s->version=2; | |||
| }else | |||
| s->version=0; | |||
| if(s->version==2){ | |||
| int method, interlace; | |||
| @@ -403,12 +403,12 @@ s->bgr32=1; | |||
| s->decorrelate= method&64 ? 1 : 0; | |||
| s->predictor= method&63; | |||
| s->bitstream_bpp= ((uint8_t*)avctx->extradata)[1]; | |||
| if(s->bitstream_bpp==0) | |||
| if(s->bitstream_bpp==0) | |||
| s->bitstream_bpp= avctx->bits_per_sample&~7; | |||
| interlace= (((uint8_t*)avctx->extradata)[2] & 0x30) >> 4; | |||
| s->interlaced= (interlace==1) ? 1 : (interlace==2) ? 0 : s->interlaced; | |||
| s->context= ((uint8_t*)avctx->extradata)[2] & 0x40 ? 1 : 0; | |||
| if(read_huffman_tables(s, ((uint8_t*)avctx->extradata)+4, avctx->extradata_size) < 0) | |||
| return -1; | |||
| }else{ | |||
| @@ -436,11 +436,11 @@ s->bgr32=1; | |||
| } | |||
| s->bitstream_bpp= avctx->bits_per_sample & ~7; | |||
| s->context= 0; | |||
| if(read_old_huffman_tables(s) < 0) | |||
| return -1; | |||
| } | |||
| switch(s->bitstream_bpp){ | |||
| case 12: | |||
| avctx->pix_fmt = PIX_FMT_YUV420P; | |||
| @@ -463,9 +463,9 @@ s->bgr32=1; | |||
| default: | |||
| assert(0); | |||
| } | |||
| alloc_temp(s); | |||
| // av_log(NULL, AV_LOG_DEBUG, "pred:%d bpp:%d hbpp:%d il:%d\n", s->predictor, s->bitstream_bpp, avctx->bits_per_sample, s->interlaced); | |||
| return 0; | |||
| @@ -478,10 +478,10 @@ static int store_table(HYuvContext *s, uint8_t *len, uint8_t *buf){ | |||
| for(i=0; i<256;){ | |||
| int val= len[i]; | |||
| int repeat=0; | |||
| for(; i<256 && len[i]==val && repeat<255; i++) | |||
| repeat++; | |||
| assert(val < 32 && val >0 && repeat<256 && repeat>0); | |||
| if(repeat>7){ | |||
| buf[index++]= val; | |||
| @@ -490,7 +490,7 @@ static int store_table(HYuvContext *s, uint8_t *len, uint8_t *buf){ | |||
| buf[index++]= val | (repeat<<5); | |||
| } | |||
| } | |||
| return index; | |||
| } | |||
| @@ -500,13 +500,13 @@ static int encode_init(AVCodecContext *avctx) | |||
| int i, j; | |||
| common_init(avctx); | |||
| avctx->extradata= av_mallocz(1024*30); // 256*3+4 == 772 | |||
| avctx->stats_out= av_mallocz(1024*30); // 21*256*3(%llu ) + 3(\n) + 1(0) = 16132 | |||
| s->version=2; | |||
| avctx->coded_frame= &s->picture; | |||
| switch(avctx->pix_fmt){ | |||
| case PIX_FMT_YUV420P: | |||
| s->bitstream_bpp= 12; | |||
| @@ -529,7 +529,7 @@ static int encode_init(AVCodecContext *avctx) | |||
| return -1; | |||
| } | |||
| }else s->context= 0; | |||
| if(avctx->codec->id==CODEC_ID_HUFFYUV){ | |||
| if(avctx->pix_fmt==PIX_FMT_YUV420P){ | |||
| av_log(avctx, AV_LOG_ERROR, "Error: YV12 is not supported by huffyuv; use vcodec=ffvhuff or format=422p\n"); | |||
| @@ -545,7 +545,7 @@ static int encode_init(AVCodecContext *avctx) | |||
| av_log(avctx, AV_LOG_ERROR, "This codec is under development; files encoded with it may not be decodable with future versions!!! Set vstrict=-2 / -strict -2 to use it anyway.\n"); | |||
| return -1; | |||
| } | |||
| ((uint8_t*)avctx->extradata)[0]= s->predictor; | |||
| ((uint8_t*)avctx->extradata)[1]= s->bitstream_bpp; | |||
| ((uint8_t*)avctx->extradata)[2]= s->interlaced ? 0x10 : 0x20; | |||
| @@ -553,10 +553,10 @@ static int encode_init(AVCodecContext *avctx) | |||
| ((uint8_t*)avctx->extradata)[2]|= 0x40; | |||
| ((uint8_t*)avctx->extradata)[3]= 0; | |||
| s->avctx->extradata_size= 4; | |||
| if(avctx->stats_in){ | |||
| char *p= avctx->stats_in; | |||
| for(i=0; i<3; i++) | |||
| for(j=0; j<256; j++) | |||
| s->stats[i][j]= 1; | |||
| @@ -569,7 +569,7 @@ static int encode_init(AVCodecContext *avctx) | |||
| s->stats[i][j]+= strtol(p, &next, 0); | |||
| if(next==p) return -1; | |||
| p=next; | |||
| } | |||
| } | |||
| } | |||
| if(p[0]==0 || p[1]==0 || p[2]==0) break; | |||
| } | |||
| @@ -577,18 +577,18 @@ static int encode_init(AVCodecContext *avctx) | |||
| for(i=0; i<3; i++) | |||
| for(j=0; j<256; j++){ | |||
| int d= FFMIN(j, 256-j); | |||
| s->stats[i][j]= 100000000/(d+1); | |||
| } | |||
| } | |||
| for(i=0; i<3; i++){ | |||
| generate_len_table(s->len[i], s->stats[i], 256); | |||
| if(generate_bits_table(s->bits[i], s->len[i])<0){ | |||
| return -1; | |||
| } | |||
| s->avctx->extradata_size+= | |||
| store_table(s, s->len[i], &((uint8_t*)s->avctx->extradata)[s->avctx->extradata_size]); | |||
| } | |||
| @@ -606,7 +606,7 @@ static int encode_init(AVCodecContext *avctx) | |||
| for(j=0; j<256; j++) | |||
| s->stats[i][j]= 0; | |||
| } | |||
| // printf("pred:%d bpp:%d hbpp:%d il:%d\n", s->predictor, s->bitstream_bpp, avctx->bits_per_sample, s->interlaced); | |||
| alloc_temp(s); | |||
| @@ -620,34 +620,34 @@ static void decode_422_bitstream(HYuvContext *s, int count){ | |||
| int i; | |||
| count/=2; | |||
| for(i=0; i<count; i++){ | |||
| s->temp[0][2*i ]= get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3); | |||
| s->temp[1][ i ]= get_vlc2(&s->gb, s->vlc[1].table, VLC_BITS, 3); | |||
| s->temp[0][2*i+1]= get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3); | |||
| s->temp[2][ i ]= get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3); | |||
| s->temp[0][2*i ]= get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3); | |||
| s->temp[1][ i ]= get_vlc2(&s->gb, s->vlc[1].table, VLC_BITS, 3); | |||
| s->temp[0][2*i+1]= get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3); | |||
| s->temp[2][ i ]= get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3); | |||
| } | |||
| } | |||
| static void decode_gray_bitstream(HYuvContext *s, int count){ | |||
| int i; | |||
| count/=2; | |||
| for(i=0; i<count; i++){ | |||
| s->temp[0][2*i ]= get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3); | |||
| s->temp[0][2*i+1]= get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3); | |||
| s->temp[0][2*i ]= get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3); | |||
| s->temp[0][2*i+1]= get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3); | |||
| } | |||
| } | |||
| static int encode_422_bitstream(HYuvContext *s, int count){ | |||
| int i; | |||
| if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < 2*4*count){ | |||
| av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); | |||
| return -1; | |||
| } | |||
| count/=2; | |||
| if(s->flags&CODEC_FLAG_PASS1){ | |||
| for(i=0; i<count; i++){ | |||
| @@ -683,7 +683,7 @@ static int encode_422_bitstream(HYuvContext *s, int count){ | |||
| static int encode_gray_bitstream(HYuvContext *s, int count){ | |||
| int i; | |||
| if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < 4*count){ | |||
| av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); | |||
| return -1; | |||
| @@ -698,7 +698,7 @@ static int encode_gray_bitstream(HYuvContext *s, int count){ | |||
| } | |||
| if(s->avctx->flags2&CODEC_FLAG2_NO_OUTPUT) | |||
| return 0; | |||
| if(s->context){ | |||
| for(i=0; i<count; i++){ | |||
| s->stats[0][ s->temp[0][2*i ] ]++; | |||
| @@ -721,15 +721,15 @@ static void decode_bgr_bitstream(HYuvContext *s, int count){ | |||
| if(s->decorrelate){ | |||
| if(s->bitstream_bpp==24){ | |||
| for(i=0; i<count; i++){ | |||
| s->temp[0][4*i+G]= get_vlc2(&s->gb, s->vlc[1].table, VLC_BITS, 3); | |||
| s->temp[0][4*i+G]= get_vlc2(&s->gb, s->vlc[1].table, VLC_BITS, 3); | |||
| s->temp[0][4*i+B]= get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3) + s->temp[0][4*i+G]; | |||
| s->temp[0][4*i+R]= get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3) + s->temp[0][4*i+G]; | |||
| } | |||
| }else{ | |||
| for(i=0; i<count; i++){ | |||
| s->temp[0][4*i+G]= get_vlc2(&s->gb, s->vlc[1].table, VLC_BITS, 3); | |||
| s->temp[0][4*i+G]= get_vlc2(&s->gb, s->vlc[1].table, VLC_BITS, 3); | |||
| s->temp[0][4*i+B]= get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3) + s->temp[0][4*i+G]; | |||
| s->temp[0][4*i+R]= get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3) + s->temp[0][4*i+G]; | |||
| s->temp[0][4*i+R]= get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3) + s->temp[0][4*i+G]; | |||
| get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3); //?! | |||
| } | |||
| } | |||
| @@ -737,14 +737,14 @@ static void decode_bgr_bitstream(HYuvContext *s, int count){ | |||
| if(s->bitstream_bpp==24){ | |||
| for(i=0; i<count; i++){ | |||
| s->temp[0][4*i+B]= get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3); | |||
| s->temp[0][4*i+G]= get_vlc2(&s->gb, s->vlc[1].table, VLC_BITS, 3); | |||
| s->temp[0][4*i+R]= get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3); | |||
| s->temp[0][4*i+G]= get_vlc2(&s->gb, s->vlc[1].table, VLC_BITS, 3); | |||
| s->temp[0][4*i+R]= get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3); | |||
| } | |||
| }else{ | |||
| for(i=0; i<count; i++){ | |||
| s->temp[0][4*i+B]= get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3); | |||
| s->temp[0][4*i+G]= get_vlc2(&s->gb, s->vlc[1].table, VLC_BITS, 3); | |||
| s->temp[0][4*i+R]= get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3); | |||
| s->temp[0][4*i+G]= get_vlc2(&s->gb, s->vlc[1].table, VLC_BITS, 3); | |||
| s->temp[0][4*i+R]= get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3); | |||
| get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3); //?! | |||
| } | |||
| } | |||
| @@ -754,13 +754,13 @@ static void decode_bgr_bitstream(HYuvContext *s, int count){ | |||
| static void draw_slice(HYuvContext *s, int y){ | |||
| int h, cy; | |||
| int offset[4]; | |||
| if(s->avctx->draw_horiz_band==NULL) | |||
| if(s->avctx->draw_horiz_band==NULL) | |||
| return; | |||
| h= y - s->last_slice_end; | |||
| y -= h; | |||
| if(s->bitstream_bpp==12){ | |||
| cy= y>>1; | |||
| }else{ | |||
| @@ -774,7 +774,7 @@ static void draw_slice(HYuvContext *s, int y){ | |||
| emms_c(); | |||
| s->avctx->draw_horiz_band(s->avctx, &s->picture, offset, y, 3, h); | |||
| s->last_slice_end= y + h; | |||
| } | |||
| @@ -792,7 +792,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| s->bitstream_buffer= av_fast_realloc(s->bitstream_buffer, &s->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); | |||
| s->dsp.bswap_buf((uint32_t*)s->bitstream_buffer, (uint32_t*)buf, buf_size/4); | |||
| if(p->data[0]) | |||
| avctx->release_buffer(avctx, p); | |||
| @@ -801,7 +801,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); | |||
| return -1; | |||
| } | |||
| if(s->context){ | |||
| table_size = read_huffman_tables(s, s->bitstream_buffer, buf_size); | |||
| if(table_size < 0) | |||
| @@ -813,29 +813,29 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| fake_ystride= s->interlaced ? p->linesize[0]*2 : p->linesize[0]; | |||
| fake_ustride= s->interlaced ? p->linesize[1]*2 : p->linesize[1]; | |||
| fake_vstride= s->interlaced ? p->linesize[2]*2 : p->linesize[2]; | |||
| s->last_slice_end= 0; | |||
| if(s->bitstream_bpp<24){ | |||
| int y, cy; | |||
| int lefty, leftu, leftv; | |||
| int lefttopy, lefttopu, lefttopv; | |||
| if(s->yuy2){ | |||
| p->data[0][3]= get_bits(&s->gb, 8); | |||
| p->data[0][2]= get_bits(&s->gb, 8); | |||
| p->data[0][1]= get_bits(&s->gb, 8); | |||
| p->data[0][0]= get_bits(&s->gb, 8); | |||
| av_log(avctx, AV_LOG_ERROR, "YUY2 output is not implemented yet\n"); | |||
| return -1; | |||
| }else{ | |||
| leftv= p->data[2][0]= get_bits(&s->gb, 8); | |||
| lefty= p->data[0][1]= get_bits(&s->gb, 8); | |||
| leftu= p->data[1][0]= get_bits(&s->gb, 8); | |||
| p->data[0][0]= get_bits(&s->gb, 8); | |||
| switch(s->predictor){ | |||
| case LEFT: | |||
| case PLANE: | |||
| @@ -848,10 +848,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| for(cy=y=1; y<s->height; y++,cy++){ | |||
| uint8_t *ydst, *udst, *vdst; | |||
| if(s->bitstream_bpp==12){ | |||
| decode_gray_bitstream(s, width); | |||
| ydst= p->data[0] + p->linesize[0]*y; | |||
| lefty= add_left_prediction(ydst, s->temp[0], width, lefty); | |||
| @@ -862,13 +862,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| y++; | |||
| if(y>=s->height) break; | |||
| } | |||
| draw_slice(s, y); | |||
| ydst= p->data[0] + p->linesize[0]*y; | |||
| udst= p->data[1] + p->linesize[1]*cy; | |||
| vdst= p->data[2] + p->linesize[2]*cy; | |||
| decode_422_bitstream(s, width); | |||
| lefty= add_left_prediction(ydst, s->temp[0], width, lefty); | |||
| if(!(s->flags&CODEC_FLAG_GRAY)){ | |||
| @@ -886,7 +886,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| } | |||
| } | |||
| draw_slice(s, height); | |||
| break; | |||
| case MEDIAN: | |||
| /* first line except first 2 pixels is left predicted */ | |||
| @@ -896,9 +896,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| leftu= add_left_prediction(p->data[1] + 1, s->temp[1], width2-1, leftu); | |||
| leftv= add_left_prediction(p->data[2] + 1, s->temp[2], width2-1, leftv); | |||
| } | |||
| cy=y=1; | |||
| /* second line is left predicted for interlaced case */ | |||
| if(s->interlaced){ | |||
| decode_422_bitstream(s, width); | |||
| @@ -929,7 +929,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| add_median_prediction(p->data[2] + fake_vstride+2, p->data[2]+2, s->temp[2], width2-2, &leftv, &lefttopv); | |||
| } | |||
| y++; cy++; | |||
| for(; y<height; y++,cy++){ | |||
| uint8_t *ydst, *udst, *vdst; | |||
| @@ -965,7 +965,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| int y; | |||
| int leftr, leftg, leftb; | |||
| const int last_line= (height-1)*p->linesize[0]; | |||
| if(s->bitstream_bpp==32){ | |||
| skip_bits(&s->gb, 8); | |||
| leftr= p->data[0][last_line+R]= get_bits(&s->gb, 8); | |||
| @@ -977,7 +977,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| leftb= p->data[0][last_line+B]= get_bits(&s->gb, 8); | |||
| skip_bits(&s->gb, 8); | |||
| } | |||
| if(s->bgr32){ | |||
| switch(s->predictor){ | |||
| case LEFT: | |||
| @@ -987,11 +987,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| for(y=s->height-2; y>=0; y--){ //yes its stored upside down | |||
| decode_bgr_bitstream(s, width); | |||
| add_left_prediction_bgr32(p->data[0] + p->linesize[0]*y, s->temp[0], width, &leftr, &leftg, &leftb); | |||
| if(s->predictor == PLANE){ | |||
| if((y&s->interlaced)==0 && y<s->height-1-s->interlaced){ | |||
| s->dsp.add_bytes(p->data[0] + p->linesize[0]*y, | |||
| s->dsp.add_bytes(p->data[0] + p->linesize[0]*y, | |||
| p->data[0] + p->linesize[0]*y + fake_ystride, fake_ystride); | |||
| } | |||
| } | |||
| @@ -1008,16 +1008,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8 | |||
| } | |||
| } | |||
| emms_c(); | |||
| *picture= *p; | |||
| *data_size = sizeof(AVFrame); | |||
| return (get_bits_count(&s->gb)+31)/32*4; | |||
| } | |||
| static int common_end(HYuvContext *s){ | |||
| int i; | |||
| for(i=0; i<3; i++){ | |||
| av_freep(&s->temp[i]); | |||
| } | |||
| @@ -1028,10 +1028,10 @@ static int decode_end(AVCodecContext *avctx) | |||
| { | |||
| HYuvContext *s = avctx->priv_data; | |||
| int i; | |||
| common_end(s); | |||
| av_freep(&s->bitstream_buffer); | |||
| for(i=0; i<3; i++){ | |||
| free_vlc(&s->vlc[i]); | |||
| } | |||
| @@ -1054,7 +1054,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, | |||
| *p = *pict; | |||
| p->pict_type= FF_I_TYPE; | |||
| p->key_frame= 1; | |||
| if(s->context){ | |||
| for(i=0; i<3; i++){ | |||
| generate_len_table(s->len[i], s->stats[i], 256); | |||
| @@ -1077,13 +1077,13 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, | |||
| put_bits(&s->pb, 8, lefty= p->data[0][1]); | |||
| put_bits(&s->pb, 8, leftu= p->data[1][0]); | |||
| put_bits(&s->pb, 8, p->data[0][0]); | |||
| lefty= sub_left_prediction(s, s->temp[0], p->data[0]+2, width-2 , lefty); | |||
| leftu= sub_left_prediction(s, s->temp[1], p->data[1]+1, width2-1, leftu); | |||
| leftv= sub_left_prediction(s, s->temp[2], p->data[2]+1, width2-1, leftv); | |||
| encode_422_bitstream(s, width-2); | |||
| if(s->predictor==MEDIAN){ | |||
| int lefttopy, lefttopu, lefttopv; | |||
| cy=y=1; | |||
| @@ -1091,15 +1091,15 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, | |||
| lefty= sub_left_prediction(s, s->temp[0], p->data[0]+p->linesize[0], width , lefty); | |||
| leftu= sub_left_prediction(s, s->temp[1], p->data[1]+p->linesize[1], width2, leftu); | |||
| leftv= sub_left_prediction(s, s->temp[2], p->data[2]+p->linesize[2], width2, leftv); | |||
| encode_422_bitstream(s, width); | |||
| y++; cy++; | |||
| } | |||
| lefty= sub_left_prediction(s, s->temp[0], p->data[0]+fake_ystride, 4, lefty); | |||
| leftu= sub_left_prediction(s, s->temp[1], p->data[1]+fake_ustride, 2, leftu); | |||
| leftv= sub_left_prediction(s, s->temp[2], p->data[2]+fake_vstride, 2, leftv); | |||
| encode_422_bitstream(s, 4); | |||
| lefttopy= p->data[0][3]; | |||
| @@ -1113,7 +1113,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, | |||
| for(; y<height; y++,cy++){ | |||
| uint8_t *ydst, *udst, *vdst; | |||
| if(s->bitstream_bpp==12){ | |||
| while(2*cy > y){ | |||
| ydst= p->data[0] + p->linesize[0]*y; | |||
| @@ -1136,7 +1136,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, | |||
| }else{ | |||
| for(cy=y=1; y<height; y++,cy++){ | |||
| uint8_t *ydst, *udst, *vdst; | |||
| /* encode a luma only line & y++ */ | |||
| if(s->bitstream_bpp==12){ | |||
| ydst= p->data[0] + p->linesize[0]*y; | |||
| @@ -1152,7 +1152,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, | |||
| y++; | |||
| if(y>=height) break; | |||
| } | |||
| ydst= p->data[0] + p->linesize[0]*y; | |||
| udst= p->data[1] + p->linesize[1]*cy; | |||
| vdst= p->data[2] + p->linesize[2]*cy; | |||
| @@ -1173,15 +1173,15 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, | |||
| encode_422_bitstream(s, width); | |||
| } | |||
| } | |||
| } | |||
| }else{ | |||
| av_log(avctx, AV_LOG_ERROR, "Format not supported!\n"); | |||
| } | |||
| emms_c(); | |||
| size+= (put_bits_count(&s->pb)+31)/8; | |||
| size/= 4; | |||
| if((s->flags&CODEC_FLAG_PASS1) && (s->picture_number&31)==0){ | |||
| int j; | |||
| char *p= avctx->stats_out; | |||
| @@ -1201,7 +1201,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, | |||
| s->dsp.bswap_buf((uint32_t*)buf, (uint32_t*)buf, size); | |||
| avctx->stats_out[0] = '\0'; | |||
| } | |||
| s->picture_number++; | |||
| return size*4; | |||
| @@ -1210,12 +1210,12 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, | |||
| static int encode_end(AVCodecContext *avctx) | |||
| { | |||
| HYuvContext *s = avctx->priv_data; | |||
| common_end(s); | |||
| av_freep(&avctx->extradata); | |||
| av_freep(&avctx->stats_out); | |||
| return 0; | |||
| } | |||
| @@ -29,28 +29,28 @@ int mm_support(void) | |||
| int eax, ebx, ecx, edx; | |||
| int max_std_level, max_ext_level, std_caps=0, ext_caps=0; | |||
| long a, c; | |||
| __asm__ __volatile__ ( | |||
| /* See if CPUID instruction is supported ... */ | |||
| /* ... Get copies of EFLAGS into eax and ecx */ | |||
| "pushf\n\t" | |||
| "pop %0\n\t" | |||
| "mov %0, %1\n\t" | |||
| /* ... Toggle the ID bit in one copy and store */ | |||
| /* to the EFLAGS reg */ | |||
| "xor $0x200000, %0\n\t" | |||
| "push %0\n\t" | |||
| "popf\n\t" | |||
| /* ... Get the (hopefully modified) EFLAGS */ | |||
| "pushf\n\t" | |||
| "pop %0\n\t" | |||
| : "=a" (a), "=c" (c) | |||
| : | |||
| : "cc" | |||
| : "cc" | |||
| ); | |||
| if (a == c) | |||
| return 0; /* CPUID not supported */ | |||
| @@ -60,9 +60,9 @@ int mm_support(void) | |||
| cpuid(1, eax, ebx, ecx, std_caps); | |||
| if (std_caps & (1<<23)) | |||
| rval |= MM_MMX; | |||
| if (std_caps & (1<<25)) | |||
| if (std_caps & (1<<25)) | |||
| rval |= MM_MMXEXT | MM_SSE; | |||
| if (std_caps & (1<<26)) | |||
| if (std_caps & (1<<26)) | |||
| rval |= MM_SSE2; | |||
| } | |||
| @@ -103,18 +103,18 @@ int mm_support(void) | |||
| According to the table, the only CPU which supports level | |||
| 2 is also the only one which supports extended CPUID levels. | |||
| */ | |||
| if (eax < 2) | |||
| if (eax < 2) | |||
| return rval; | |||
| if (ext_caps & (1<<24)) | |||
| rval |= MM_MMXEXT; | |||
| } | |||
| #if 0 | |||
| av_log(NULL, AV_LOG_DEBUG, "%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_3DNOW) ? "3DNow ":"", | |||
| av_log(NULL, AV_LOG_DEBUG, "%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_3DNOW) ? "3DNow ":"", | |||
| (rval&MM_3DNOWEXT) ? "3DNowExt ":""); | |||
| #endif | |||
| return rval; | |||
| @@ -602,9 +602,9 @@ static void h263_v_loop_filter_mmx(uint8_t *src, int stride, int qscale){ | |||
| const int strength= ff_h263_loop_filter_strength[qscale]; | |||
| asm volatile( | |||
| H263_LOOP_FILTER | |||
| "movq %%mm3, %1 \n\t" | |||
| "movq %%mm4, %2 \n\t" | |||
| "movq %%mm5, %0 \n\t" | |||
| @@ -634,7 +634,7 @@ static inline void transpose4x4(uint8_t *dst, uint8_t *src, int dst_stride, int | |||
| "movd %%mm1, %2 \n\t" | |||
| "punpckhdq %%mm1, %%mm1 \n\t" | |||
| "movd %%mm1, %3 \n\t" | |||
| : "=m" (*(uint32_t*)(dst + 0*dst_stride)), | |||
| "=m" (*(uint32_t*)(dst + 1*dst_stride)), | |||
| "=m" (*(uint32_t*)(dst + 2*dst_stride)), | |||
| @@ -650,14 +650,14 @@ static void h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale){ | |||
| const int strength= ff_h263_loop_filter_strength[qscale]; | |||
| uint64_t temp[4] __attribute__ ((aligned(8))); | |||
| uint8_t *btemp= (uint8_t*)temp; | |||
| src -= 2; | |||
| transpose4x4(btemp , src , 8, stride); | |||
| transpose4x4(btemp+4, src + 4*stride, 8, stride); | |||
| asm volatile( | |||
| H263_LOOP_FILTER // 5 3 4 6 | |||
| : "+m" (temp[0]), | |||
| "+m" (temp[1]), | |||
| "+m" (temp[2]), | |||
| @@ -796,7 +796,7 @@ static int sse8_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int | |||
| "psrlq $32, %%mm7\n" /* shift hi dword to lo */ | |||
| "paddd %%mm7,%%mm1\n" | |||
| "movd %%mm1,%2\n" | |||
| : "+r" (pix1), "+r" (pix2), "=r"(tmp) | |||
| : "+r" (pix1), "+r" (pix2), "=r"(tmp) | |||
| : "r" ((long)line_size) , "m" (h) | |||
| : "%ecx"); | |||
| return tmp; | |||
| @@ -856,7 +856,7 @@ static int sse16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int | |||
| "psrlq $32, %%mm7\n" /* shift hi dword to lo */ | |||
| "paddd %%mm7,%%mm1\n" | |||
| "movd %%mm1,%2\n" | |||
| : "+r" (pix1), "+r" (pix2), "=r"(tmp) | |||
| : "+r" (pix1), "+r" (pix2), "=r"(tmp) | |||
| : "r" ((long)line_size) , "m" (h) | |||
| : "%ecx"); | |||
| return tmp; | |||
| @@ -919,7 +919,7 @@ static int sse16_sse2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, in | |||
| "psrldq $4, %%xmm7\n" /* shift hi dword to lo */ | |||
| "paddd %%xmm1,%%xmm7\n" | |||
| "movd %%xmm7,%3\n" | |||
| : "+r" (pix1), "+r" (pix2), "+r"(h), "=r"(tmp) | |||
| : "+r" (pix1), "+r" (pix2), "+r"(h), "=r"(tmp) | |||
| : "r" ((long)line_size)); | |||
| return tmp; | |||
| } | |||
| @@ -930,7 +930,7 @@ static int hf_noise8_mmx(uint8_t * pix1, int line_size, int h) { | |||
| "movl %3,%%ecx\n" | |||
| "pxor %%mm7,%%mm7\n" | |||
| "pxor %%mm6,%%mm6\n" | |||
| "movq (%0),%%mm0\n" | |||
| "movq %%mm0, %%mm1\n" | |||
| "psllq $8, %%mm0\n" | |||
| @@ -944,9 +944,9 @@ static int hf_noise8_mmx(uint8_t * pix1, int line_size, int h) { | |||
| "punpckhbw %%mm7,%%mm3\n" | |||
| "psubw %%mm1, %%mm0\n" | |||
| "psubw %%mm3, %%mm2\n" | |||
| "add %2,%0\n" | |||
| "movq (%0),%%mm4\n" | |||
| "movq %%mm4, %%mm1\n" | |||
| "psllq $8, %%mm4\n" | |||
| @@ -968,14 +968,14 @@ static int hf_noise8_mmx(uint8_t * pix1, int line_size, int h) { | |||
| "pcmpgtw %%mm2, %%mm1\n\t" | |||
| "pxor %%mm3, %%mm0\n" | |||
| "pxor %%mm1, %%mm2\n" | |||
| "psubw %%mm3, %%mm0\n" | |||
| "psubw %%mm3, %%mm0\n" | |||
| "psubw %%mm1, %%mm2\n" | |||
| "paddw %%mm0, %%mm2\n" | |||
| "paddw %%mm2, %%mm6\n" | |||
| "add %2,%0\n" | |||
| "1:\n" | |||
| "movq (%0),%%mm0\n" | |||
| "movq %%mm0, %%mm1\n" | |||
| "psllq $8, %%mm0\n" | |||
| @@ -997,13 +997,13 @@ static int hf_noise8_mmx(uint8_t * pix1, int line_size, int h) { | |||
| "pcmpgtw %%mm5, %%mm1\n\t" | |||
| "pxor %%mm3, %%mm4\n" | |||
| "pxor %%mm1, %%mm5\n" | |||
| "psubw %%mm3, %%mm4\n" | |||
| "psubw %%mm3, %%mm4\n" | |||
| "psubw %%mm1, %%mm5\n" | |||
| "paddw %%mm4, %%mm5\n" | |||
| "paddw %%mm5, %%mm6\n" | |||
| "add %2,%0\n" | |||
| "movq (%0),%%mm4\n" | |||
| "movq %%mm4, %%mm1\n" | |||
| "psllq $8, %%mm4\n" | |||
| @@ -1025,7 +1025,7 @@ static int hf_noise8_mmx(uint8_t * pix1, int line_size, int h) { | |||
| "pcmpgtw %%mm2, %%mm1\n\t" | |||
| "pxor %%mm3, %%mm0\n" | |||
| "pxor %%mm1, %%mm2\n" | |||
| "psubw %%mm3, %%mm0\n" | |||
| "psubw %%mm3, %%mm0\n" | |||
| "psubw %%mm1, %%mm2\n" | |||
| "paddw %%mm0, %%mm2\n" | |||
| "paddw %%mm2, %%mm6\n" | |||
| @@ -1038,12 +1038,12 @@ static int hf_noise8_mmx(uint8_t * pix1, int line_size, int h) { | |||
| "punpcklwd %%mm7,%%mm0\n" | |||
| "punpckhwd %%mm7,%%mm6\n" | |||
| "paddd %%mm0, %%mm6\n" | |||
| "movq %%mm6,%%mm0\n" | |||
| "psrlq $32, %%mm6\n" | |||
| "paddd %%mm6,%%mm0\n" | |||
| "movd %%mm0,%1\n" | |||
| : "+r" (pix1), "=r"(tmp) | |||
| : "+r" (pix1), "=r"(tmp) | |||
| : "r" ((long)line_size) , "g" (h-2) | |||
| : "%ecx"); | |||
| return tmp; | |||
| @@ -1056,7 +1056,7 @@ static int hf_noise16_mmx(uint8_t * pix1, int line_size, int h) { | |||
| "movl %3,%%ecx\n" | |||
| "pxor %%mm7,%%mm7\n" | |||
| "pxor %%mm6,%%mm6\n" | |||
| "movq (%0),%%mm0\n" | |||
| "movq 1(%0),%%mm1\n" | |||
| "movq %%mm0, %%mm2\n" | |||
| @@ -1067,9 +1067,9 @@ static int hf_noise16_mmx(uint8_t * pix1, int line_size, int h) { | |||
| "punpckhbw %%mm7,%%mm3\n" | |||
| "psubw %%mm1, %%mm0\n" | |||
| "psubw %%mm3, %%mm2\n" | |||
| "add %2,%0\n" | |||
| "movq (%0),%%mm4\n" | |||
| "movq 1(%0),%%mm1\n" | |||
| "movq %%mm4, %%mm5\n" | |||
| @@ -1088,14 +1088,14 @@ static int hf_noise16_mmx(uint8_t * pix1, int line_size, int h) { | |||
| "pcmpgtw %%mm2, %%mm1\n\t" | |||
| "pxor %%mm3, %%mm0\n" | |||
| "pxor %%mm1, %%mm2\n" | |||
| "psubw %%mm3, %%mm0\n" | |||
| "psubw %%mm3, %%mm0\n" | |||
| "psubw %%mm1, %%mm2\n" | |||
| "paddw %%mm0, %%mm2\n" | |||
| "paddw %%mm2, %%mm6\n" | |||
| "add %2,%0\n" | |||
| "1:\n" | |||
| "movq (%0),%%mm0\n" | |||
| "movq 1(%0),%%mm1\n" | |||
| "movq %%mm0, %%mm2\n" | |||
| @@ -1118,9 +1118,9 @@ static int hf_noise16_mmx(uint8_t * pix1, int line_size, int h) { | |||
| "psubw %%mm1, %%mm5\n" | |||
| "paddw %%mm4, %%mm5\n" | |||
| "paddw %%mm5, %%mm6\n" | |||
| "add %2,%0\n" | |||
| "movq (%0),%%mm4\n" | |||
| "movq 1(%0),%%mm1\n" | |||
| "movq %%mm4, %%mm5\n" | |||
| @@ -1139,7 +1139,7 @@ static int hf_noise16_mmx(uint8_t * pix1, int line_size, int h) { | |||
| "pcmpgtw %%mm2, %%mm1\n\t" | |||
| "pxor %%mm3, %%mm0\n" | |||
| "pxor %%mm1, %%mm2\n" | |||
| "psubw %%mm3, %%mm0\n" | |||
| "psubw %%mm3, %%mm0\n" | |||
| "psubw %%mm1, %%mm2\n" | |||
| "paddw %%mm0, %%mm2\n" | |||
| "paddw %%mm2, %%mm6\n" | |||
| @@ -1152,12 +1152,12 @@ static int hf_noise16_mmx(uint8_t * pix1, int line_size, int h) { | |||
| "punpcklwd %%mm7,%%mm0\n" | |||
| "punpckhwd %%mm7,%%mm6\n" | |||
| "paddd %%mm0, %%mm6\n" | |||
| "movq %%mm6,%%mm0\n" | |||
| "psrlq $32, %%mm6\n" | |||
| "paddd %%mm6,%%mm0\n" | |||
| "movd %%mm0,%1\n" | |||
| : "+r" (pix1), "=r"(tmp) | |||
| : "+r" (pix1), "=r"(tmp) | |||
| : "r" ((long)line_size) , "g" (h-2) | |||
| : "%ecx"); | |||
| return tmp + hf_noise8_mmx(pix+8, line_size, h); | |||
| @@ -1186,10 +1186,10 @@ static int nsse8_mmx(void *p, uint8_t * pix1, uint8_t * pix2, int line_size, int | |||
| static int vsad_intra16_mmx(void *v, uint8_t * pix, uint8_t * dummy, int line_size, int h) { | |||
| int tmp; | |||
| assert( (((int)pix) & 7) == 0); | |||
| assert((line_size &7) ==0); | |||
| #define SUM(in0, in1, out0, out1) \ | |||
| "movq (%0), %%mm2\n"\ | |||
| "movq 8(%0), %%mm3\n"\ | |||
| @@ -1213,7 +1213,7 @@ static int vsad_intra16_mmx(void *v, uint8_t * pix, uint8_t * dummy, int line_si | |||
| "paddw %%mm2, " #in0 "\n"\ | |||
| "paddw " #in0 ", %%mm6\n" | |||
| asm volatile ( | |||
| "movl %3,%%ecx\n" | |||
| "pxor %%mm6,%%mm6\n" | |||
| @@ -1224,11 +1224,11 @@ static int vsad_intra16_mmx(void *v, uint8_t * pix, uint8_t * dummy, int line_si | |||
| "subl $2, %%ecx\n" | |||
| SUM(%%mm0, %%mm1, %%mm4, %%mm5) | |||
| "1:\n" | |||
| SUM(%%mm4, %%mm5, %%mm0, %%mm1) | |||
| SUM(%%mm0, %%mm1, %%mm4, %%mm5) | |||
| "subl $2, %%ecx\n" | |||
| "jnz 1b\n" | |||
| @@ -1239,7 +1239,7 @@ static int vsad_intra16_mmx(void *v, uint8_t * pix, uint8_t * dummy, int line_si | |||
| "psrlq $16, %%mm0\n" | |||
| "paddw %%mm6,%%mm0\n" | |||
| "movd %%mm0,%1\n" | |||
| : "+r" (pix), "=r"(tmp) | |||
| : "+r" (pix), "=r"(tmp) | |||
| : "r" ((long)line_size) , "m" (h) | |||
| : "%ecx"); | |||
| return tmp & 0xFFFF; | |||
| @@ -1248,10 +1248,10 @@ static int vsad_intra16_mmx(void *v, uint8_t * pix, uint8_t * dummy, int line_si | |||
| static int vsad_intra16_mmx2(void *v, uint8_t * pix, uint8_t * dummy, int line_size, int h) { | |||
| int tmp; | |||
| assert( (((int)pix) & 7) == 0); | |||
| assert((line_size &7) ==0); | |||
| #define SUM(in0, in1, out0, out1) \ | |||
| "movq (%0), " #out0 "\n"\ | |||
| "movq 8(%0), " #out1 "\n"\ | |||
| @@ -1271,16 +1271,16 @@ static int vsad_intra16_mmx2(void *v, uint8_t * pix, uint8_t * dummy, int line_s | |||
| "subl $2, %%ecx\n" | |||
| SUM(%%mm0, %%mm1, %%mm4, %%mm5) | |||
| "1:\n" | |||
| SUM(%%mm4, %%mm5, %%mm0, %%mm1) | |||
| SUM(%%mm0, %%mm1, %%mm4, %%mm5) | |||
| "subl $2, %%ecx\n" | |||
| "jnz 1b\n" | |||
| "movd %%mm6,%1\n" | |||
| : "+r" (pix), "=r"(tmp) | |||
| : "+r" (pix), "=r"(tmp) | |||
| : "r" ((long)line_size) , "m" (h) | |||
| : "%ecx"); | |||
| return tmp; | |||
| @@ -1289,11 +1289,11 @@ static int vsad_intra16_mmx2(void *v, uint8_t * pix, uint8_t * dummy, int line_s | |||
| static int vsad16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) { | |||
| int tmp; | |||
| assert( (((int)pix1) & 7) == 0); | |||
| assert( (((int)pix2) & 7) == 0); | |||
| assert((line_size &7) ==0); | |||
| #define SUM(in0, in1, out0, out1) \ | |||
| "movq (%0),%%mm2\n"\ | |||
| "movq (%1)," #out0 "\n"\ | |||
| @@ -1324,7 +1324,7 @@ static int vsad16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, in | |||
| "paddw %%mm2, " #in0 "\n"\ | |||
| "paddw " #in0 ", %%mm6\n" | |||
| asm volatile ( | |||
| "movl %4,%%ecx\n" | |||
| "pxor %%mm6,%%mm6\n" | |||
| @@ -1344,11 +1344,11 @@ static int vsad16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, in | |||
| "pxor %%mm7, %%mm1\n" | |||
| SUM(%%mm0, %%mm1, %%mm4, %%mm5) | |||
| "1:\n" | |||
| SUM(%%mm4, %%mm5, %%mm0, %%mm1) | |||
| SUM(%%mm0, %%mm1, %%mm4, %%mm5) | |||
| "subl $2, %%ecx\n" | |||
| "jnz 1b\n" | |||
| @@ -1359,7 +1359,7 @@ static int vsad16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, in | |||
| "psrlq $16, %%mm0\n" | |||
| "paddw %%mm6,%%mm0\n" | |||
| "movd %%mm0,%2\n" | |||
| : "+r" (pix1), "+r" (pix2), "=r"(tmp) | |||
| : "+r" (pix1), "+r" (pix2), "=r"(tmp) | |||
| : "r" ((long)line_size) , "m" (h) | |||
| : "%ecx"); | |||
| return tmp & 0x7FFF; | |||
| @@ -1368,11 +1368,11 @@ static int vsad16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, in | |||
| static int vsad16_mmx2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) { | |||
| int tmp; | |||
| assert( (((int)pix1) & 7) == 0); | |||
| assert( (((int)pix2) & 7) == 0); | |||
| assert((line_size &7) ==0); | |||
| #define SUM(in0, in1, out0, out1) \ | |||
| "movq (%0)," #out0 "\n"\ | |||
| "movq (%1),%%mm2\n"\ | |||
| @@ -1408,16 +1408,16 @@ static int vsad16_mmx2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, i | |||
| "pxor %%mm7, %%mm1\n" | |||
| SUM(%%mm0, %%mm1, %%mm4, %%mm5) | |||
| "1:\n" | |||
| SUM(%%mm4, %%mm5, %%mm0, %%mm1) | |||
| SUM(%%mm0, %%mm1, %%mm4, %%mm5) | |||
| "subl $2, %%ecx\n" | |||
| "jnz 1b\n" | |||
| "movd %%mm6,%2\n" | |||
| : "+r" (pix1), "+r" (pix2), "=r"(tmp) | |||
| : "+r" (pix1), "+r" (pix2), "=r"(tmp) | |||
| : "r" ((long)line_size) , "m" (h) | |||
| : "%ecx"); | |||
| return tmp; | |||
| @@ -1449,7 +1449,7 @@ static void diff_bytes_mmx(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){ | |||
| static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w, int *left, int *left_top){ | |||
| long i=0; | |||
| uint8_t l, lt; | |||
| asm volatile( | |||
| "1: \n\t" | |||
| "movq -1(%1, %0), %%mm0 \n\t" // LT | |||
| @@ -1462,7 +1462,7 @@ static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, uint8_t *src1, uint8_t | |||
| "movq %%mm4, %%mm5 \n\t" // L | |||
| "pmaxub %%mm1, %%mm4 \n\t" // max(T, L) | |||
| "pminub %%mm5, %%mm1 \n\t" // min(T, L) | |||
| "pminub %%mm2, %%mm4 \n\t" | |||
| "pminub %%mm2, %%mm4 \n\t" | |||
| "pmaxub %%mm1, %%mm4 \n\t" | |||
| "psubb %%mm4, %%mm3 \n\t" // dst - pred | |||
| "movq %%mm3, (%3, %0) \n\t" | |||
| @@ -1475,9 +1475,9 @@ static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, uint8_t *src1, uint8_t | |||
| l= *left; | |||
| lt= *left_top; | |||
| dst[0]= src2[0] - mid_pred(l, src1[0], (l + src1[0] - lt)&0xFF); | |||
| *left_top= src1[w-1]; | |||
| *left = src2[w-1]; | |||
| } | |||
| @@ -1521,7 +1521,7 @@ static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, uint8_t *src1, uint8_t | |||
| "psubw " #a ", " #z " \n\t"\ | |||
| "pmaxsw " #z ", " #a " \n\t"\ | |||
| "paddusw " #a ", " #sum " \n\t" | |||
| #define SBUTTERFLY(a,b,t,n)\ | |||
| "movq " #a ", " #t " \n\t" /* abcd */\ | |||
| "punpckl" #n " " #b ", " #a " \n\t" /* aebf */\ | |||
| @@ -1548,7 +1548,7 @@ static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, uint8_t *src1, uint8_t | |||
| static int hadamard8_diff_mmx(void *s, uint8_t *src1, uint8_t *src2, int stride, int h){ | |||
| uint64_t temp[16] __align8; | |||
| int sum=0; | |||
| assert(h==8); | |||
| diff_pixels_mmx((DCTELEM*)temp, src1, src2, stride); | |||
| @@ -1556,38 +1556,38 @@ static int hadamard8_diff_mmx(void *s, uint8_t *src1, uint8_t *src2, int stride, | |||
| asm volatile( | |||
| LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3) | |||
| LOAD4(64, %%mm4, %%mm5, %%mm6, %%mm7) | |||
| HADAMARD48 | |||
| "movq %%mm7, 112(%1) \n\t" | |||
| TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7) | |||
| STORE4(0 , %%mm0, %%mm3, %%mm7, %%mm2) | |||
| "movq 112(%1), %%mm7 \n\t" | |||
| TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0) | |||
| STORE4(64, %%mm4, %%mm7, %%mm0, %%mm6) | |||
| LOAD4(8 , %%mm0, %%mm1, %%mm2, %%mm3) | |||
| LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7) | |||
| HADAMARD48 | |||
| "movq %%mm7, 120(%1) \n\t" | |||
| TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7) | |||
| STORE4(8 , %%mm0, %%mm3, %%mm7, %%mm2) | |||
| "movq 120(%1), %%mm7 \n\t" | |||
| TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0) | |||
| "movq %%mm7, %%mm5 \n\t"//FIXME remove | |||
| "movq %%mm6, %%mm7 \n\t" | |||
| "movq %%mm0, %%mm6 \n\t" | |||
| // STORE4(72, %%mm4, %%mm7, %%mm0, %%mm6) //FIXME remove | |||
| LOAD4(64, %%mm0, %%mm1, %%mm2, %%mm3) | |||
| // LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7) | |||
| HADAMARD48 | |||
| "movq %%mm7, 64(%1) \n\t" | |||
| MMABS(%%mm0, %%mm7) | |||
| @@ -1600,10 +1600,10 @@ static int hadamard8_diff_mmx(void *s, uint8_t *src1, uint8_t *src2, int stride, | |||
| "movq 64(%1), %%mm1 \n\t" | |||
| MMABS_SUM(%%mm1, %%mm7, %%mm0) | |||
| "movq %%mm0, 64(%1) \n\t" | |||
| LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3) | |||
| LOAD4(8 , %%mm4, %%mm5, %%mm6, %%mm7) | |||
| HADAMARD48 | |||
| "movq %%mm7, (%1) \n\t" | |||
| MMABS(%%mm0, %%mm7) | |||
| @@ -1617,7 +1617,7 @@ static int hadamard8_diff_mmx(void *s, uint8_t *src1, uint8_t *src2, int stride, | |||
| MMABS_SUM(%%mm1, %%mm7, %%mm0) | |||
| "movq 64(%1), %%mm1 \n\t" | |||
| MMABS_SUM(%%mm1, %%mm7, %%mm0) | |||
| "movq %%mm0, %%mm1 \n\t" | |||
| "psrlq $32, %%mm0 \n\t" | |||
| "paddusw %%mm1, %%mm0 \n\t" | |||
| @@ -1625,7 +1625,7 @@ static int hadamard8_diff_mmx(void *s, uint8_t *src1, uint8_t *src2, int stride, | |||
| "psrlq $16, %%mm0 \n\t" | |||
| "paddusw %%mm1, %%mm0 \n\t" | |||
| "movd %%mm0, %0 \n\t" | |||
| : "=r" (sum) | |||
| : "r"(temp) | |||
| ); | |||
| @@ -1635,7 +1635,7 @@ static int hadamard8_diff_mmx(void *s, uint8_t *src1, uint8_t *src2, int stride, | |||
| static int hadamard8_diff_mmx2(void *s, uint8_t *src1, uint8_t *src2, int stride, int h){ | |||
| uint64_t temp[16] __align8; | |||
| int sum=0; | |||
| assert(h==8); | |||
| diff_pixels_mmx((DCTELEM*)temp, src1, src2, stride); | |||
| @@ -1643,38 +1643,38 @@ static int hadamard8_diff_mmx2(void *s, uint8_t *src1, uint8_t *src2, int stride | |||
| asm volatile( | |||
| LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3) | |||
| LOAD4(64, %%mm4, %%mm5, %%mm6, %%mm7) | |||
| HADAMARD48 | |||
| "movq %%mm7, 112(%1) \n\t" | |||
| TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7) | |||
| STORE4(0 , %%mm0, %%mm3, %%mm7, %%mm2) | |||
| "movq 112(%1), %%mm7 \n\t" | |||
| TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0) | |||
| STORE4(64, %%mm4, %%mm7, %%mm0, %%mm6) | |||
| LOAD4(8 , %%mm0, %%mm1, %%mm2, %%mm3) | |||
| LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7) | |||
| HADAMARD48 | |||
| "movq %%mm7, 120(%1) \n\t" | |||
| TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7) | |||
| STORE4(8 , %%mm0, %%mm3, %%mm7, %%mm2) | |||
| "movq 120(%1), %%mm7 \n\t" | |||
| TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0) | |||
| "movq %%mm7, %%mm5 \n\t"//FIXME remove | |||
| "movq %%mm6, %%mm7 \n\t" | |||
| "movq %%mm0, %%mm6 \n\t" | |||
| // STORE4(72, %%mm4, %%mm7, %%mm0, %%mm6) //FIXME remove | |||
| LOAD4(64, %%mm0, %%mm1, %%mm2, %%mm3) | |||
| // LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7) | |||
| HADAMARD48 | |||
| "movq %%mm7, 64(%1) \n\t" | |||
| MMABS_MMX2(%%mm0, %%mm7) | |||
| @@ -1687,10 +1687,10 @@ static int hadamard8_diff_mmx2(void *s, uint8_t *src1, uint8_t *src2, int stride | |||
| "movq 64(%1), %%mm1 \n\t" | |||
| MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0) | |||
| "movq %%mm0, 64(%1) \n\t" | |||
| LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3) | |||
| LOAD4(8 , %%mm4, %%mm5, %%mm6, %%mm7) | |||
| HADAMARD48 | |||
| "movq %%mm7, (%1) \n\t" | |||
| MMABS_MMX2(%%mm0, %%mm7) | |||
| @@ -1704,13 +1704,13 @@ static int hadamard8_diff_mmx2(void *s, uint8_t *src1, uint8_t *src2, int stride | |||
| MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0) | |||
| "movq 64(%1), %%mm1 \n\t" | |||
| MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0) | |||
| "pshufw $0x0E, %%mm0, %%mm1 \n\t" | |||
| "paddusw %%mm1, %%mm0 \n\t" | |||
| "pshufw $0x01, %%mm0, %%mm1 \n\t" | |||
| "paddusw %%mm1, %%mm0 \n\t" | |||
| "movd %%mm0, %0 \n\t" | |||
| : "=r" (sum) | |||
| : "r"(temp) | |||
| ); | |||
| @@ -2405,7 +2405,7 @@ static void just_return() { return; } | |||
| 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); | |||
| scale<<= 16 + 1 - BASIS_SHIFT + RECON_SHIFT; | |||
| @@ -2413,11 +2413,11 @@ static int try_8x8basis_mmx(int16_t rem[64], int16_t weight[64], int16_t basis[6 | |||
| "pcmpeqw %%mm6, %%mm6 \n\t" // -1w | |||
| "psrlw $15, %%mm6 \n\t" // 1w | |||
| "pxor %%mm7, %%mm7 \n\t" | |||
| "movd %4, %%mm5 \n\t" | |||
| "punpcklwd %%mm5, %%mm5 \n\t" | |||
| "punpcklwd %%mm5, %%mm5 \n\t" | |||
| "movd %4, %%mm5 \n\t" | |||
| "punpcklwd %%mm5, %%mm5 \n\t" | |||
| "punpcklwd %%mm5, %%mm5 \n\t" | |||
| "1: \n\t" | |||
| "movq (%1, %0), %%mm0 \n\t" | |||
| "movq (%1, %0), %%mm0 \n\t" | |||
| "movq 8(%1, %0), %%mm1 \n\t" | |||
| "pmulhw %%mm5, %%mm0 \n\t" | |||
| "pmulhw %%mm5, %%mm1 \n\t" | |||
| @@ -2444,7 +2444,7 @@ static int try_8x8basis_mmx(int16_t rem[64], int16_t weight[64], int16_t basis[6 | |||
| "paddd %%mm6, %%mm7 \n\t" | |||
| "psrld $2, %%mm7 \n\t" | |||
| "movd %%mm7, %0 \n\t" | |||
| : "+r" (i) | |||
| : "r"(basis), "r"(rem), "r"(weight), "g"(scale) | |||
| ); | |||
| @@ -2453,21 +2453,21 @@ 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){ | |||
| scale<<= 16 + 1 - BASIS_SHIFT + RECON_SHIFT; | |||
| asm volatile( | |||
| "pcmpeqw %%mm6, %%mm6 \n\t" // -1w | |||
| "psrlw $15, %%mm6 \n\t" // 1w | |||
| "movd %3, %%mm5 \n\t" | |||
| "punpcklwd %%mm5, %%mm5 \n\t" | |||
| "punpcklwd %%mm5, %%mm5 \n\t" | |||
| "movd %3, %%mm5 \n\t" | |||
| "punpcklwd %%mm5, %%mm5 \n\t" | |||
| "punpcklwd %%mm5, %%mm5 \n\t" | |||
| "1: \n\t" | |||
| "movq (%1, %0), %%mm0 \n\t" | |||
| "movq (%1, %0), %%mm0 \n\t" | |||
| "movq 8(%1, %0), %%mm1 \n\t" | |||
| "pmulhw %%mm5, %%mm0 \n\t" | |||
| "pmulhw %%mm5, %%mm1 \n\t" | |||
| "paddw %%mm6, %%mm0 \n\t" | |||
| "paddw %%mm6, %%mm0 \n\t" | |||
| "paddw %%mm6, %%mm1 \n\t" | |||
| "psraw $1, %%mm0 \n\t" | |||
| "psraw $1, %%mm1 \n\t" | |||
| @@ -2478,19 +2478,19 @@ static void add_8x8basis_mmx(int16_t rem[64], int16_t basis[64], int scale){ | |||
| "add $16, %0 \n\t" | |||
| "cmp $128, %0 \n\t" //FIXME optimize & bench | |||
| " jb 1b \n\t" | |||
| : "+r" (i) | |||
| : "r"(basis), "r"(rem), "g"(scale) | |||
| ); | |||
| }else{ | |||
| for(i=0; i<8*8; i++){ | |||
| rem[i] += (basis[i]*scale + (1<<(BASIS_SHIFT - RECON_SHIFT-1)))>>(BASIS_SHIFT - RECON_SHIFT); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| #include "h264dsp_mmx.c" | |||
| /* external functions, from idct_mmx.c */ | |||
| void ff_mmx_idct(DCTELEM *block); | |||
| void ff_mmxext_idct(DCTELEM *block); | |||
| @@ -2563,7 +2563,7 @@ static void ff_idct_xvid_mmx2_add(uint8_t *dest, int line_size, DCTELEM *block) | |||
| add_pixels_clamped_mmx(block, dest, line_size); | |||
| } | |||
| #endif | |||
| void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) | |||
| { | |||
| mm_flags = mm_support(); | |||
| @@ -2701,14 +2701,14 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) | |||
| c->avg_no_rnd_pixels_tab[1][1] = avg_no_rnd_pixels8_x2_mmx; | |||
| c->avg_no_rnd_pixels_tab[1][2] = avg_no_rnd_pixels8_y2_mmx; | |||
| c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels8_xy2_mmx; | |||
| c->add_bytes= add_bytes_mmx; | |||
| #ifdef CONFIG_ENCODERS | |||
| c->diff_bytes= diff_bytes_mmx; | |||
| c->hadamard8_diff[0]= hadamard8_diff16_mmx; | |||
| c->hadamard8_diff[1]= hadamard8_diff_mmx; | |||
| c->pix_norm1 = pix_norm1_mmx; | |||
| c->sse[0] = (mm_flags & MM_SSE2) ? sse16_sse2 : sse16_mmx; | |||
| c->sse[1] = sse8_mmx; | |||
| @@ -2719,19 +2719,19 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) | |||
| if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ | |||
| c->vsad[0] = vsad16_mmx; | |||
| } | |||
| if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ | |||
| c->try_8x8basis= try_8x8basis_mmx; | |||
| } | |||
| c->add_8x8basis= add_8x8basis_mmx; | |||
| #endif //CONFIG_ENCODERS | |||
| c->h263_v_loop_filter= h263_v_loop_filter_mmx; | |||
| c->h263_h_loop_filter= h263_h_loop_filter_mmx; | |||
| c->h263_h_loop_filter= h263_h_loop_filter_mmx; | |||
| c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_mmx; | |||
| c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_mmx; | |||
| if (mm_flags & MM_MMXEXT) { | |||
| c->put_pixels_tab[0][1] = put_pixels16_x2_mmx2; | |||
| c->put_pixels_tab[0][2] = put_pixels16_y2_mmx2; | |||
| @@ -2945,7 +2945,7 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) | |||
| c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_3dnow; | |||
| } | |||
| } | |||
| #ifdef CONFIG_ENCODERS | |||
| dsputil_init_pix_mmx(c, avctx); | |||
| #endif //CONFIG_ENCODERS | |||
| @@ -21,7 +21,7 @@ | |||
| * mostly rewritten by Michael Niedermayer <michaelni@gmx.at> | |||
| * and improved by Zdenek Kabelac <kabi@users.sf.net> | |||
| */ | |||
| /* XXX: we use explicit registers to avoid a gcc 2.95.2 register asm | |||
| clobber bug - now it will work with 2.95.2 and also with -fPIC | |||
| */ | |||
| @@ -100,7 +100,7 @@ static void DEF(put_pixels4_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int | |||
| :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst) | |||
| #endif | |||
| :"S"((long)src1Stride), "D"((long)dstStride) | |||
| :"memory"); | |||
| :"memory"); | |||
| } | |||
| @@ -147,7 +147,7 @@ static void DEF(put_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int | |||
| :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst) | |||
| #endif | |||
| :"S"((long)src1Stride), "D"((long)dstStride) | |||
| :"memory"); | |||
| :"memory"); | |||
| //the following should be used, though better not with gcc ... | |||
| /* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst) | |||
| :"r"(src1Stride), "r"(dstStride) | |||
| @@ -217,7 +217,7 @@ static void DEF(put_no_rnd_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src | |||
| :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst) | |||
| #endif | |||
| :"S"((long)src1Stride), "D"((long)dstStride) | |||
| :"memory"); | |||
| :"memory"); | |||
| //the following should be used, though better not with gcc ... | |||
| /* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst) | |||
| :"r"(src1Stride), "r"(dstStride) | |||
| @@ -272,7 +272,7 @@ static void DEF(avg_pixels4_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int | |||
| :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst) | |||
| #endif | |||
| :"S"((long)src1Stride), "D"((long)dstStride) | |||
| :"memory"); | |||
| :"memory"); | |||
| } | |||
| @@ -324,7 +324,7 @@ static void DEF(avg_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int | |||
| :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst) | |||
| #endif | |||
| :"S"((long)src1Stride), "D"((long)dstStride) | |||
| :"memory"); | |||
| :"memory"); | |||
| //the following should be used, though better not with gcc ... | |||
| /* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst) | |||
| :"r"(src1Stride), "r"(dstStride) | |||
| @@ -412,7 +412,7 @@ static void DEF(put_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int | |||
| :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst) | |||
| #endif | |||
| :"S"((long)src1Stride), "D"((long)dstStride) | |||
| :"memory"); | |||
| :"memory"); | |||
| //the following should be used, though better not with gcc ... | |||
| /* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst) | |||
| :"r"(src1Stride), "r"(dstStride) | |||
| @@ -466,7 +466,7 @@ static void DEF(avg_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int | |||
| :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst) | |||
| #endif | |||
| :"S"((long)src1Stride), "D"((long)dstStride) | |||
| :"memory"); | |||
| :"memory"); | |||
| //the following should be used, though better not with gcc ... | |||
| /* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst) | |||
| :"r"(src1Stride), "r"(dstStride) | |||
| @@ -539,13 +539,13 @@ static void DEF(put_no_rnd_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *sr | |||
| :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst) | |||
| #endif | |||
| :"S"((long)src1Stride), "D"((long)dstStride) | |||
| :"memory"); | |||
| :"memory"); | |||
| //the following should be used, though better not with gcc ... | |||
| /* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst) | |||
| :"r"(src1Stride), "r"(dstStride) | |||
| :"memory");*/ | |||
| } | |||
| /* GL: this function does incorrect rounding if overflow */ | |||
| static void DEF(put_no_rnd_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h) | |||
| { | |||
| @@ -746,7 +746,7 @@ static void DEF(avg_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_ | |||
| :"%"REG_a, "memory"); | |||
| } | |||
| // Note this is not correctly rounded, but this function is only used for b frames so it doesnt matter | |||
| // Note this is not correctly rounded, but this function is only used for b frames so it doesnt matter | |||
| static void DEF(avg_pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h) | |||
| { | |||
| MOVQ_BONE(mm6); | |||
| @@ -197,7 +197,7 @@ static void attribute_unused DEF(put, pixels16_l2)(uint8_t *dst, uint8_t *src1, | |||
| :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst) | |||
| #endif | |||
| :"S"((long)src1Stride), "D"((long)dstStride) | |||
| :"memory"); | |||
| :"memory"); | |||
| } | |||
| static void DEF(put, pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h) | |||
| @@ -5,7 +5,7 @@ | |||
| * SSE2 optimization is Copyright (c) 2004 Denes Balatoni. | |||
| * | |||
| * from fdctam32.c - AP922 MMX(3D-Now) forward-DCT | |||
| * | |||
| * | |||
| * Intel Application Note AP-922 - fast, precise implementation of DCT | |||
| * http://developer.intel.com/vtune/cbts/appnotes.htm | |||
| * | |||
| @@ -51,7 +51,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 | |||
| struct | |||
| { | |||
| const int32_t fdct_r_row_sse2[4] ATTR_ALIGN(16); | |||
| } fdct_r_row_sse2 ATTR_ALIGN(16)= | |||
| @@ -61,90 +61,90 @@ struct | |||
| //static const long fdct_r_row_sse2[4] ATTR_ALIGN(16) = {RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW}; | |||
| static const int16_t tab_frw_01234567[] ATTR_ALIGN(8) = { // forward_dct coeff table | |||
| 16384, 16384, 22725, 19266, | |||
| 16384, 16384, 12873, 4520, | |||
| 21407, 8867, 19266, -4520, | |||
| -8867, -21407, -22725, -12873, | |||
| 16384, -16384, 12873, -22725, | |||
| -16384, 16384, 4520, 19266, | |||
| 8867, -21407, 4520, -12873, | |||
| 21407, -8867, 19266, -22725, | |||
| 22725, 22725, 31521, 26722, | |||
| 22725, 22725, 17855, 6270, | |||
| 29692, 12299, 26722, -6270, | |||
| -12299, -29692, -31521, -17855, | |||
| 22725, -22725, 17855, -31521, | |||
| -22725, 22725, 6270, 26722, | |||
| 12299, -29692, 6270, -17855, | |||
| 29692, -12299, 26722, -31521, | |||
| 21407, 21407, 29692, 25172, | |||
| 21407, 21407, 16819, 5906, | |||
| 27969, 11585, 25172, -5906, | |||
| -11585, -27969, -29692, -16819, | |||
| 21407, -21407, 16819, -29692, | |||
| -21407, 21407, 5906, 25172, | |||
| 11585, -27969, 5906, -16819, | |||
| 27969, -11585, 25172, -29692, | |||
| 19266, 19266, 26722, 22654, | |||
| 19266, 19266, 15137, 5315, | |||
| 25172, 10426, 22654, -5315, | |||
| -10426, -25172, -26722, -15137, | |||
| 19266, -19266, 15137, -26722, | |||
| -19266, 19266, 5315, 22654, | |||
| 10426, -25172, 5315, -15137, | |||
| 25172, -10426, 22654, -26722, | |||
| 16384, 16384, 22725, 19266, | |||
| 16384, 16384, 12873, 4520, | |||
| 21407, 8867, 19266, -4520, | |||
| -8867, -21407, -22725, -12873, | |||
| 16384, -16384, 12873, -22725, | |||
| -16384, 16384, 4520, 19266, | |||
| 8867, -21407, 4520, -12873, | |||
| 21407, -8867, 19266, -22725, | |||
| 19266, 19266, 26722, 22654, | |||
| 19266, 19266, 15137, 5315, | |||
| 25172, 10426, 22654, -5315, | |||
| -10426, -25172, -26722, -15137, | |||
| 19266, -19266, 15137, -26722, | |||
| -19266, 19266, 5315, 22654, | |||
| 10426, -25172, 5315, -15137, | |||
| 25172, -10426, 22654, -26722, | |||
| 21407, 21407, 29692, 25172, | |||
| 21407, 21407, 16819, 5906, | |||
| 27969, 11585, 25172, -5906, | |||
| -11585, -27969, -29692, -16819, | |||
| 21407, -21407, 16819, -29692, | |||
| -21407, 21407, 5906, 25172, | |||
| 11585, -27969, 5906, -16819, | |||
| 27969, -11585, 25172, -29692, | |||
| 22725, 22725, 31521, 26722, | |||
| 22725, 22725, 17855, 6270, | |||
| 29692, 12299, 26722, -6270, | |||
| -12299, -29692, -31521, -17855, | |||
| 22725, -22725, 17855, -31521, | |||
| -22725, 22725, 6270, 26722, | |||
| 12299, -29692, 6270, -17855, | |||
| 29692, -12299, 26722, -31521, | |||
| 16384, 16384, 22725, 19266, | |||
| 16384, 16384, 12873, 4520, | |||
| 21407, 8867, 19266, -4520, | |||
| -8867, -21407, -22725, -12873, | |||
| 16384, -16384, 12873, -22725, | |||
| -16384, 16384, 4520, 19266, | |||
| 8867, -21407, 4520, -12873, | |||
| 21407, -8867, 19266, -22725, | |||
| 22725, 22725, 31521, 26722, | |||
| 22725, 22725, 17855, 6270, | |||
| 29692, 12299, 26722, -6270, | |||
| -12299, -29692, -31521, -17855, | |||
| 22725, -22725, 17855, -31521, | |||
| -22725, 22725, 6270, 26722, | |||
| 12299, -29692, 6270, -17855, | |||
| 29692, -12299, 26722, -31521, | |||
| 21407, 21407, 29692, 25172, | |||
| 21407, 21407, 16819, 5906, | |||
| 27969, 11585, 25172, -5906, | |||
| -11585, -27969, -29692, -16819, | |||
| 21407, -21407, 16819, -29692, | |||
| -21407, 21407, 5906, 25172, | |||
| 11585, -27969, 5906, -16819, | |||
| 27969, -11585, 25172, -29692, | |||
| 19266, 19266, 26722, 22654, | |||
| 19266, 19266, 15137, 5315, | |||
| 25172, 10426, 22654, -5315, | |||
| -10426, -25172, -26722, -15137, | |||
| 19266, -19266, 15137, -26722, | |||
| -19266, 19266, 5315, 22654, | |||
| 10426, -25172, 5315, -15137, | |||
| 25172, -10426, 22654, -26722, | |||
| 16384, 16384, 22725, 19266, | |||
| 16384, 16384, 12873, 4520, | |||
| 21407, 8867, 19266, -4520, | |||
| -8867, -21407, -22725, -12873, | |||
| 16384, -16384, 12873, -22725, | |||
| -16384, 16384, 4520, 19266, | |||
| 8867, -21407, 4520, -12873, | |||
| 21407, -8867, 19266, -22725, | |||
| 19266, 19266, 26722, 22654, | |||
| 19266, 19266, 15137, 5315, | |||
| 25172, 10426, 22654, -5315, | |||
| -10426, -25172, -26722, -15137, | |||
| 19266, -19266, 15137, -26722, | |||
| -19266, 19266, 5315, 22654, | |||
| 10426, -25172, 5315, -15137, | |||
| 25172, -10426, 22654, -26722, | |||
| 21407, 21407, 29692, 25172, | |||
| 21407, 21407, 16819, 5906, | |||
| 27969, 11585, 25172, -5906, | |||
| -11585, -27969, -29692, -16819, | |||
| 21407, -21407, 16819, -29692, | |||
| -21407, 21407, 5906, 25172, | |||
| 11585, -27969, 5906, -16819, | |||
| 27969, -11585, 25172, -29692, | |||
| 22725, 22725, 31521, 26722, | |||
| 22725, 22725, 17855, 6270, | |||
| 29692, 12299, 26722, -6270, | |||
| -12299, -29692, -31521, -17855, | |||
| 22725, -22725, 17855, -31521, | |||
| -22725, 22725, 6270, 26722, | |||
| 12299, -29692, 6270, -17855, | |||
| 29692, -12299, 26722, -31521, | |||
| }; | |||
| struct | |||
| struct | |||
| { | |||
| const int16_t tab_frw_01234567_sse2[256] ATTR_ALIGN(16); | |||
| } tab_frw_01234567_sse2 ATTR_ALIGN(16) = | |||
| {{ | |||
| //static const int16_t tab_frw_01234567_sse2[] ATTR_ALIGN(16) = { // forward_dct coeff table | |||
| //static const int16_t tab_frw_01234567_sse2[] ATTR_ALIGN(16) = { // forward_dct coeff table | |||
| #define TABLE_SSE2 C4, C4, C1, C3, -C6, -C2, -C1, -C5, \ | |||
| C4, C4, C5, C7, C2, C6, C3, -C7, \ | |||
| -C4, C4, C7, C3, C6, -C2, C7, -C5, \ | |||
| C4, -C4, C5, -C1, C2, -C6, C3, -C1, | |||
| // c1..c7 * cos(pi/4) * 2^15 | |||
| C4, -C4, C5, -C1, C2, -C6, C3, -C1, | |||
| // c1..c7 * cos(pi/4) * 2^15 | |||
| #define C1 22725 | |||
| #define C2 21407 | |||
| #define C3 19266 | |||
| @@ -355,17 +355,17 @@ static always_inline void fdct_row_sse2(const int16_t *in, int16_t *out) | |||
| "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+48(%1), %%xmm7 \n\t" | |||
| "movdqa \\t(%1), %%xmm4 \n\t" | |||
| "movdqa \\t+16(%1), %%xmm5 \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" | |||
| "movdqa \\t+48(%1), %%xmm7 \n\t" | |||
| ".endm \n\t" | |||
| ".macro FDCT_ROW_SSE2 i \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" | |||
| @@ -376,7 +376,7 @@ static always_inline void fdct_row_sse2(const int16_t *in, int16_t *out) | |||
| "pmaddwd %%xmm1, %%xmm7 \n\t" | |||
| "pmaddwd %%xmm5, %%xmm2 \n\t" | |||
| "pmaddwd %%xmm4, %%xmm1 \n\t" | |||
| "paddd %%xmm7, %%xmm3 \n\t" | |||
| "paddd %%xmm7, %%xmm3 \n\t" | |||
| "paddd %%xmm2, %%xmm1 \n\t" | |||
| "paddd %%xmm6, %%xmm3 \n\t" | |||
| "paddd %%xmm6, %%xmm1 \n\t" | |||
| @@ -384,8 +384,8 @@ static always_inline void fdct_row_sse2(const int16_t *in, int16_t *out) | |||
| "psrad %3, %%xmm1 \n\t" | |||
| "packssdw %%xmm3, %%xmm1 \n\t" | |||
| "movdqa %%xmm1, \\i(%4) \n\t" | |||
| ".endm \n\t" | |||
| "movdqa (%2), %%xmm6 \n\t" | |||
| ".endm \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" | |||
| @@ -411,7 +411,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) | |||
| { | |||
| { | |||
| pshufw_m2r(*(in + 4), mm5, 0x1B); | |||
| movq_m2r(*(in + 0), mm0); | |||
| movq_r2r(mm0, mm1); | |||
| @@ -454,7 +454,7 @@ static always_inline void fdct_row_mmx2(const int16_t *in, int16_t *out, const i | |||
| } | |||
| static 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); | |||
| punpcklwd_m2r(*(in + 4), mm1); | |||
| @@ -547,7 +547,7 @@ void ff_fdct_mmx2(int16_t *block) | |||
| } | |||
| } | |||
| void ff_fdct_sse2(int16_t *block) | |||
| void ff_fdct_sse2(int16_t *block) | |||
| { | |||
| int64_t align_tmp[16] ATTR_ALIGN(8); | |||
| int16_t * const block_tmp= (int16_t*)align_tmp; | |||
| @@ -23,13 +23,13 @@ | |||
| #include <xmmintrin.h> | |||
| static const float p1p1p1m1[4] __attribute__((aligned(16))) = | |||
| static const float p1p1p1m1[4] __attribute__((aligned(16))) = | |||
| { 1.0, 1.0, 1.0, -1.0 }; | |||
| static const float p1p1m1p1[4] __attribute__((aligned(16))) = | |||
| static const float p1p1m1p1[4] __attribute__((aligned(16))) = | |||
| { 1.0, 1.0, -1.0, 1.0 }; | |||
| static const float p1p1m1m1[4] __attribute__((aligned(16))) = | |||
| static const float p1p1m1m1[4] __attribute__((aligned(16))) = | |||
| { 1.0, 1.0, -1.0, -1.0 }; | |||
| #if 0 | |||
| @@ -107,27 +107,27 @@ void ff_fft_calc_sse(FFTContext *s, FFTComplex *z) | |||
| 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))); | |||
| 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))); | |||
| _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; | |||
| } while (--j); | |||
| @@ -384,7 +384,7 @@ static void h264_h_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int a | |||
| "psraw $5, %%mm6 \n\t"\ | |||
| "packuswb %%mm6, %%mm6 \n\t"\ | |||
| OP(%%mm6, (%1), A, d)\ | |||
| "add %3, %1 \n\t" | |||
| "add %3, %1 \n\t" | |||
| #define QPEL_H264HV(A,B,C,D,E,F,OF)\ | |||
| "movd (%0), "#F" \n\t"\ | |||
| @@ -399,7 +399,7 @@ static void h264_h_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int a | |||
| "paddw "#F", "#A" \n\t"\ | |||
| "paddw "#A", %%mm6 \n\t"\ | |||
| "movq %%mm6, "#OF"(%1) \n\t" | |||
| #define QPEL_H264(OPNAME, OP, MMX)\ | |||
| static void OPNAME ## h264_qpel4_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ | |||
| int h=4;\ | |||
| @@ -72,13 +72,13 @@ | |||
| //----------------------------------------------------------------------------- | |||
| static const int16_t tg_1_16[4*4] attribute_used __attribute__ ((aligned(8))) = { | |||
| static const int16_t tg_1_16[4*4] attribute_used __attribute__ ((aligned(8))) = { | |||
| 13036,13036,13036,13036, // tg * (2<<16) + 0.5 | |||
| 27146,27146,27146,27146, // tg * (2<<16) + 0.5 | |||
| -21746,-21746,-21746,-21746, // tg * (2<<16) + 0.5 | |||
| 23170,23170,23170,23170}; // cos * (2<<15) + 0.5 | |||
| static const int32_t rounder_0[2*8] attribute_used __attribute__ ((aligned(8))) = { | |||
| static const int32_t rounder_0[2*8] attribute_used __attribute__ ((aligned(8))) = { | |||
| 65536,65536, | |||
| 3597,3597, | |||
| 2260,2260, | |||
| @@ -148,7 +148,7 @@ static const int32_t rounder_0[2*8] attribute_used __attribute__ ((aligned(8))) | |||
| //----------------------------------------------------------------------------- | |||
| // Table for rows 0,4 - constants are multiplied by cos_4_16 | |||
| static const int16_t tab_i_04_mmx[32*4] attribute_used __attribute__ ((aligned(8))) = { | |||
| static const int16_t tab_i_04_mmx[32*4] attribute_used __attribute__ ((aligned(8))) = { | |||
| 16384,16384,16384,-16384, // movq-> w06 w04 w02 w00 | |||
| 21407,8867,8867,-21407, // w07 w05 w03 w01 | |||
| 16384,-16384,16384,16384, // w14 w12 w10 w08 | |||
| @@ -190,7 +190,7 @@ static const int16_t tab_i_04_mmx[32*4] attribute_used __attribute__ ((aligned(8 | |||
| //----------------------------------------------------------------------------- | |||
| // %3 for rows 0,4 - constants are multiplied by cos_4_16 | |||
| static const int16_t tab_i_04_xmm[32*4] attribute_used __attribute__ ((aligned(8))) = { | |||
| static const int16_t tab_i_04_xmm[32*4] attribute_used __attribute__ ((aligned(8))) = { | |||
| 16384,21407,16384,8867, // movq-> w05 w04 w01 w00 | |||
| 16384,8867,-16384,-21407, // w07 w06 w03 w02 | |||
| 16384,-8867,16384,-21407, // w13 w12 w09 w08 | |||
| @@ -501,7 +501,7 @@ asm volatile( | |||
| DCT_8_INV_ROW_MMX(5*16(%0), 5*16(%0), 64*3(%2), 8*5(%1)) | |||
| DCT_8_INV_ROW_MMX(6*16(%0), 6*16(%0), 64*2(%2), 8*6(%1)) | |||
| DCT_8_INV_ROW_MMX(7*16(%0), 7*16(%0), 64*1(%2), 8*7(%1)) | |||
| //# Process the columns (4 at a time) | |||
| DCT_8_INV_COL(0(%0), 0(%0)) | |||
| DCT_8_INV_COL(8(%0), 8(%0)) | |||
| @@ -524,7 +524,7 @@ asm volatile( | |||
| DCT_8_INV_ROW_XMM(5*16(%0), 5*16(%0), 64*3(%2), 8*5(%1)) | |||
| DCT_8_INV_ROW_XMM(6*16(%0), 6*16(%0), 64*2(%2), 8*6(%1)) | |||
| DCT_8_INV_ROW_XMM(7*16(%0), 7*16(%0), 64*1(%2), 8*7(%1)) | |||
| //# Process the columns (4 at a time) | |||
| DCT_8_INV_COL(0(%0), 0(%0)) | |||
| DCT_8_INV_COL(8(%0), 8(%0)) | |||