├── dshow ├── authors.txt ├── src │ ├── xvid.ico │ ├── XviD_logo.bmp │ ├── xvid.ax.def │ ├── debug.c │ ├── debug.h │ ├── IXvidDecoder.h │ ├── CAbout.h │ ├── resource.h │ ├── CAbout.cpp │ ├── config.h │ ├── Configure.cpp │ └── xvid.ax.rc ├── sources.inc ├── Makefile ├── dxpatch │ └── dx90sdk-update-gcc.txt └── dshow.dsp ├── vfw ├── src │ ├── driverproc.def │ ├── xvid.ico │ ├── hd720_40.ico │ ├── home_40.ico │ ├── XviD_logo.bmp │ ├── hd1080_40.ico │ ├── mobile_40.ico │ ├── debug.h │ ├── vfwext.h │ ├── status.h │ └── codec.h ├── vfw.dsp └── bin │ ├── sources.inc │ ├── Makefile │ └── xvid.inf ├── AUTHORS ├── ChangeLog ├── ChangeLog-1.0 ├── examples ├── cactus.pgm.bz2 ├── bench_list.pl ├── Makefile └── README ├── src ├── dct │ ├── ppc_asm │ │ └── idct_altivec.c │ ├── fdct.h │ ├── ia64_asm │ │ ├── idct_fini.s │ │ └── idct_init.s │ └── idct.h ├── motion │ ├── ia64_asm │ │ ├── sad_ia64.s │ │ ├── calc_delta_3.s │ │ ├── calc_delta_1.s │ │ └── calc_delta_2.s │ ├── motion_smp.h │ ├── gmc.h │ ├── motion_inlines.h │ ├── motion.h │ └── x86_asm │ │ └── sad_3dn.asm ├── image │ ├── ppc_asm │ │ ├── qpel_altivec.c │ │ └── colorspace_altivec.c │ ├── ia64_asm │ │ ├── interpolate8x8_ia64.s │ │ ├── interpolate8x8_ia64_exact.s │ │ └── README │ ├── font.h │ ├── postprocessing.h │ ├── x86_asm │ │ ├── postprocessing_mmx.asm │ │ ├── deintl_sse.asm │ │ └── postprocessing_sse2.asm │ ├── reduced.h │ └── image.h ├── utils │ ├── ia64_asm │ │ └── mem_transfer_ia64.s │ ├── mem_align.h │ ├── ppc_asm │ │ └── altivec_trigger.c │ ├── emms.c │ ├── emms.h │ ├── mbfunctions.h │ ├── timer.h │ └── mem_align.c ├── bitstream │ ├── cbp.h │ ├── zigzag.h │ ├── vlc_codes.h │ ├── mbcoding.h │ ├── cbp.c │ └── x86_asm │ │ ├── cbp_sse2.asm │ │ └── cbp_mmx.asm ├── plugins │ ├── plugin_ssim.h │ ├── plugin_psnr.c │ └── plugin_dump.c ├── quant │ ├── quant_matrix.h │ ├── quant_matrix.c │ └── quant.h ├── prediction │ └── mbprediction.h ├── decoder.h └── nasm.inc ├── SMP ├── .gitattributes ├── .gitignore ├── readme.txt ├── libxvidcore_with_latest_sdk.bat └── libxvidcore.sln ├── .gitignore ├── doc └── README ├── .github ├── PULL_REQUEST_TEMPLATE.md ├── ISSUE_TEMPLATE.md └── CONTRIBUTING.md ├── README ├── TODO └── README.markdown /dshow/authors.txt: -------------------------------------------------------------------------------- 1 | authors 2 | 3 | 4 | Peter Ross -------------------------------------------------------------------------------- /vfw/src/driverproc.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DriverProc 3 | Configure 4 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/AUTHORS -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/ChangeLog -------------------------------------------------------------------------------- /vfw/vfw.dsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/vfw/vfw.dsp -------------------------------------------------------------------------------- /ChangeLog-1.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/ChangeLog-1.0 -------------------------------------------------------------------------------- /vfw/src/xvid.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/vfw/src/xvid.ico -------------------------------------------------------------------------------- /dshow/src/xvid.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/dshow/src/xvid.ico -------------------------------------------------------------------------------- /vfw/src/hd720_40.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/vfw/src/hd720_40.ico -------------------------------------------------------------------------------- /vfw/src/home_40.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/vfw/src/home_40.ico -------------------------------------------------------------------------------- /vfw/src/XviD_logo.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/vfw/src/XviD_logo.bmp -------------------------------------------------------------------------------- /vfw/src/hd1080_40.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/vfw/src/hd1080_40.ico -------------------------------------------------------------------------------- /vfw/src/mobile_40.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/vfw/src/mobile_40.ico -------------------------------------------------------------------------------- /dshow/src/XviD_logo.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/dshow/src/XviD_logo.bmp -------------------------------------------------------------------------------- /examples/cactus.pgm.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/examples/cactus.pgm.bz2 -------------------------------------------------------------------------------- /src/dct/ppc_asm/idct_altivec.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/src/dct/ppc_asm/idct_altivec.c -------------------------------------------------------------------------------- /src/motion/ia64_asm/sad_ia64.s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/src/motion/ia64_asm/sad_ia64.s -------------------------------------------------------------------------------- /src/image/ppc_asm/qpel_altivec.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/src/image/ppc_asm/qpel_altivec.c -------------------------------------------------------------------------------- /src/image/ia64_asm/interpolate8x8_ia64.s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/src/image/ia64_asm/interpolate8x8_ia64.s -------------------------------------------------------------------------------- /src/image/ppc_asm/colorspace_altivec.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/src/image/ppc_asm/colorspace_altivec.c -------------------------------------------------------------------------------- /src/utils/ia64_asm/mem_transfer_ia64.s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/src/utils/ia64_asm/mem_transfer_ia64.s -------------------------------------------------------------------------------- /src/image/ia64_asm/interpolate8x8_ia64_exact.s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShiftMediaProject/xvid/HEAD/src/image/ia64_asm/interpolate8x8_ia64_exact.s -------------------------------------------------------------------------------- /SMP/.gitattributes: -------------------------------------------------------------------------------- 1 | *.sln text eol=crlf 2 | *.vcxproj text eol=crlf 3 | *.vcxproj.filters text eol=crlf 4 | *.bat text eol=crlf -------------------------------------------------------------------------------- /dshow/src/xvid.ax.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | Configure 3 | DllGetClassObject PRIVATE 4 | DllCanUnloadNow PRIVATE 5 | DllRegisterServer PRIVATE 6 | DllUnregisterServer PRIVATE 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.a 2 | *.o 3 | config.status 4 | platform.inc 5 | *.log 6 | config.guess 7 | config.sub 8 | configure 9 | install-sh 10 | confdefs.h 11 | conftest.* 12 | -------------------------------------------------------------------------------- /vfw/bin/sources.inc: -------------------------------------------------------------------------------- 1 | LIBSO = xvidvfw.dll 2 | 3 | SRC_DIR = ../src 4 | 5 | SRC_C = \ 6 | codec.c \ 7 | config.c \ 8 | driverproc.c \ 9 | status.c 10 | 11 | SRC_RES = \ 12 | resource.rc 13 | -------------------------------------------------------------------------------- /dshow/sources.inc: -------------------------------------------------------------------------------- 1 | LIBSO = xvid.ax 2 | 3 | SRC_DIR = src 4 | 5 | SRC_C = \ 6 | config.c \ 7 | debug.c \ 8 | 9 | SRC_CPP = \ 10 | Configure.cpp \ 11 | CAbout.cpp \ 12 | CXvidDecoder.cpp 13 | 14 | SRC_RES = \ 15 | xvid.ax.rc 16 | -------------------------------------------------------------------------------- /src/image/ia64_asm/README: -------------------------------------------------------------------------------- 1 | The default version (interpolate8x8_ia64.s) of the interpolate functions 2 | suffer from some rounding errors, but are fast. I our oppinion there 3 | is no need to be such exact here. Just in the case we provide another 4 | set of function with exact rounding: interpolate8x8_ia64_exact.s 5 | 6 | -------------------------------------------------------------------------------- /SMP/.gitignore: -------------------------------------------------------------------------------- 1 | *.obj 2 | *.lib 3 | *.log 4 | *.tlog 5 | *.pdb 6 | *.ildb 7 | *.pgd 8 | *.pch 9 | *.manifest 10 | *.suo 11 | *.user 12 | *.sdf 13 | *.opensdf 14 | [Oo]bj/ 15 | *.exe 16 | !*.h 17 | !*.c 18 | !*.asm 19 | !*.def 20 | !*.rc 21 | *.sbr 22 | *.iobj 23 | *.ipdb 24 | .vs/ 25 | *.VC.db 26 | *.opendb 27 | *.ilk 28 | [Bb]in/ -------------------------------------------------------------------------------- /dshow/src/debug.c: -------------------------------------------------------------------------------- 1 | #include "debug.h" 2 | #include 3 | #include 4 | 5 | #include /* vsprintf */ 6 | #define DPRINTF_BUF_SZ 1024 7 | 8 | void OutputDebugStringf(char *fmt, ...) 9 | { 10 | #ifdef _DEBUG 11 | va_list args; 12 | char buf[DPRINTF_BUF_SZ]; 13 | 14 | va_start(args, fmt); 15 | vsprintf(buf, fmt, args); 16 | OutputDebugString(buf); 17 | #endif 18 | } 19 | -------------------------------------------------------------------------------- /dshow/src/debug.h: -------------------------------------------------------------------------------- 1 | #ifndef _DSHOW_DEBUG_ 2 | #define _DSHOW_DEBUG_ 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void OutputDebugStringf(char *fmt, ...); 11 | 12 | #ifdef _DEBUG 13 | #define DPRINTF OutputDebugStringf 14 | #else 15 | static __inline void 16 | DPRINTF(char *fmt, ...) { } 17 | #endif 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif /* _DSHOW_DEBUG */ 24 | -------------------------------------------------------------------------------- /doc/README: -------------------------------------------------------------------------------- 1 | Documentation of Xvid 2 | ===================== 3 | 4 | INSTALL 5 | ------- 6 | 7 | This file describes the steps to build and install Xvid on supported 8 | platforms. 9 | 10 | NOTE FOR MacOS X PLATFORM 11 | ------------------------- 12 | 13 | Many versions of yasm/nasm are known to be buggy for Mach-O output, 14 | whereas nasm seems to be less reliable than yasm. Therefore, yasm 15 | is highly recommended for Mac OS X target. 16 | 17 | * yasm 1.0 or later is required to build xvidcore. * 18 | 19 | http://www.tortall.net/projects/yasm/ 20 | 21 | Last edited: $Date: 2010-12-28 16:34:55 $ 22 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Context 4 | 5 | 6 | ## Current and Suggested Behavior 7 | 8 | 9 | ## Steps to Explain Enhancement 10 | 11 | 1. 12 | 2. 13 | 3. 14 | 4. 15 | 16 | ## Your Test Environment 17 | 18 | * Version Used: 19 | * Operating System and Version(s): 20 | * Compiler and version(s): -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Context 4 | 5 | 6 | ## Expected Behavior 7 | 8 | 9 | ## Actual Behavior 10 | 11 | 12 | ## Steps to Reproduce 13 | 14 | 1. 15 | 2. 16 | 3. 17 | 4. 18 | 19 | ## Your Environment 20 | 21 | * Version Used: 22 | * Operating System and Version: 23 | * Compiler and Version(s): 24 | 25 | ## Possible Fix 26 | 27 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | 1) Introduction 2 | --------------- 3 | 4 | Xvid is a high performance and high quality MPEG-4 video de-/encoding 5 | solution. 6 | 7 | The Xvid package currently consists of four parts: 8 | 9 | - xvidcore: the main MPEG-4 de-/encoding library. 10 | 11 | - examples: xvid_decraw and xvid_encraw de-/encoder example programs. 12 | - dshow: windows direct show decoder filter which links against 13 | xvidcore to allow MPEG-4 playback on Windows based OS. 14 | - vfw: video for windows GUI. 15 | 16 | 17 | 2) Documentation 18 | ---------------- 19 | 20 | - xvidcore/doc/README: some general information. 21 | - xvidcore/doc/INSTALL: building and installing instructions. 22 | 23 | 24 | 3) Licensing: 25 | ------------ 26 | 27 | - Xvid is licensed as a whole under the terms of the Xvid license 28 | described in the file LICENSE. This is true for all files belonging 29 | to Xvid except for those which specifically carry a different 30 | license header. -------------------------------------------------------------------------------- /examples/bench_list.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # 4 | # List of benches to run 5 | # 6 | 7 | ######################################### 8 | # Decoder benches 9 | ######################################### 10 | 11 | # Raw command-line args passed to 'xvid_bench 9' 12 | # format: bitstream_name width height checksum 13 | # followed, possibly, by the CPU option to use. 14 | 15 | @Dec_Benches = ( 16 | 17 | "test1.m4v 640 352 0x9fa4494d -sse2" 18 | , "test1.m4v 640 352 0x9fa4494d -mmxext" 19 | , "test1.m4v 640 352 0x9fa4494d -mmx" 20 | , "test1.m4v 640 352 0x76c9cde2 -c" 21 | 22 | , "qpel.m4v 352 288 0xc07eb687 -sse2" 23 | , "qpel.m4v 352 288 0xc07eb687 -mmxext" 24 | , "qpel.m4v 352 288 0xc07eb687 -mmx" 25 | , "qpel.m4v 352 288 0x54e720e0 -c" 26 | 27 | , "lowdelay.m4v 720 576 0xf2a3229d -sse2" 28 | , "lowdelay.m4v 720 576 0xf2a3229d -mmxext" 29 | , "lowdelay.m4v 720 576 0xf2a3229d -mmx" 30 | , "lowdelay.m4v 720 576 0x5ea8e958 -c" 31 | 32 | , "gmc1.m4v 640 272 0x94f12062 -sse2" 33 | , "gmc1.m4v 640 272 0x94f12062 -mmxext" 34 | , "gmc1.m4v 640 272 0x94f12062 -mmx" 35 | , "gmc1.m4v 640 272 0x3b938c99 -c" 36 | 37 | ); 38 | 39 | ######################################### 40 | -------------------------------------------------------------------------------- /examples/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | # 3 | # XviD examples Makefile 4 | # 5 | # $Id: Makefile,v 1.10 2006-10-11 13:52:06 Skal Exp $ 6 | # 7 | ############################################################################# 8 | 9 | include ../build/generic/platform.inc 10 | 11 | # is make running into windows? 12 | ifdef SYSTEMROOT 13 | EXTRALIBS = -lole32 -lavifil32 -lpthread -lm 14 | else 15 | EXTRALIBS = -lpthread -lc -lm 16 | endif 17 | 18 | HDIR = -I../src 19 | CFLAGS = -g $(ARCHITECTURE) $(BUS) $(ENDIANNESS) $(FEATURES) $(SPECIFIC_CFLAGS) 20 | LDFLAGS = ../build/generic/=build/$(STATIC_LIB) $(EXTRALIBS) 21 | 22 | SOURCES= xvid_encraw.c xvid_decraw.c xvid_bench.c 23 | OBJECTS=$(SOURCES:.c=.o) 24 | TESTS=$(SOURCES:.c=) 25 | 26 | all: $(TESTS) 27 | 28 | xvid_encraw: xvid_encraw.o 29 | $(CC) -o $@ $< $(LDFLAGS) 30 | 31 | xvid_encraw.o: xvid_encraw.c 32 | $(CC) $(CFLAGS) $(HDIR) -c $< 33 | 34 | xvid_decraw: xvid_decraw.o 35 | $(CC) -o $@ $< $(LDFLAGS) 36 | 37 | xvid_decraw.o: xvid_decraw.c 38 | $(CC) $(CFLAGS) $(HDIR) -c $< 39 | 40 | xvid_bench: xvid_bench.o 41 | $(CC) -o $@ $< $(LDFLAGS) 42 | 43 | xvid_bench.o: xvid_bench.c 44 | $(CC) $(CFLAGS) $(HDIR) -c $< 45 | 46 | clean: 47 | rm -f $(OBJECTS) $(TESTS) 48 | -------------------------------------------------------------------------------- /src/image/font.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Font header (contains the font definition) - 5 | * 6 | * Copyright(C) 2002-2003 Peter Ross 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _XVID_FONT_H_ 27 | #define _XVID_FONT_H_ 28 | 29 | #include "image.h" 30 | 31 | void image_printf(IMAGE * img, int edged_width, int height, int x, int y, char *fmt, ...); 32 | 33 | #endif /* _XVID_FONT_H_ */ 34 | -------------------------------------------------------------------------------- /src/utils/mem_align.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Aligned Memory Allocator header - 5 | * 6 | * Copyright(C) 2002-2003 Edouard Gomez 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _MEM_ALIGN_H_ 27 | #define _MEM_ALIGN_H_ 28 | 29 | #include "../portab.h" 30 | 31 | void *xvid_malloc(size_t size, 32 | uint8_t alignment); 33 | void xvid_free(void *mem_ptr); 34 | 35 | #endif /* _MEM_ALIGN_H_ */ 36 | -------------------------------------------------------------------------------- /dshow/src/IXvidDecoder.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - XviD Decoder part of the DShow Filter - 5 | * 6 | * Copyright(C) 2002-2003 Peter Ross 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _IXVID_H_ 27 | #define _IXVID_H_ 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | 34 | DEFINE_GUID(IID_IXvidDecoder, 35 | 0x00000000, 0x4fef, 0x40d3, 0xb3, 0xfa, 0xe0, 0x53, 0x1b, 0x89, 0x7f, 0x98); 36 | 37 | DECLARE_INTERFACE_(IXvidDecoder, IUnknown) 38 | { 39 | }; 40 | 41 | 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif /* _IXVID_H_ */ 48 | -------------------------------------------------------------------------------- /src/utils/ppc_asm/altivec_trigger.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Altivec SIGILL trigger - 5 | * 6 | * Copyright(C) 2004 Edouard Gomez 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifdef HAVE_ALTIVEC_H 27 | #include 28 | #endif 29 | 30 | #include "../../portab.h" 31 | #include "../emms.h" 32 | 33 | void 34 | altivec_trigger(void) 35 | { 36 | #if !defined(__amigaos4__) 37 | vector unsigned int var1 = (vector unsigned int)AVV(0); 38 | vector unsigned int var2 = (vector unsigned int)AVV(1); 39 | var1 = vec_add(var1, var2); 40 | #endif 41 | return; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /vfw/src/debug.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Debug header - 5 | * 6 | * Copyright(C) Peter Ross 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _DEBUG_H_ 27 | #define _DEBUG_H_ 28 | 29 | #if defined(_DEBUG) 30 | #include /* vsprintf */ 31 | #define DPRINTF_BUF_SZ 1024 32 | static __inline void DPRINTF(char *fmt, ...) 33 | { 34 | va_list args; 35 | char buf[DPRINTF_BUF_SZ]; 36 | 37 | va_start(args, fmt); 38 | vsprintf(buf, fmt, args); 39 | OutputDebugString(buf); 40 | } 41 | #else 42 | static __inline void DPRINTF(char *fmt, ...) { } 43 | #endif 44 | 45 | #endif /* _DEBUG_H_ */ 46 | -------------------------------------------------------------------------------- /src/bitstream/cbp.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - CBP related header - 5 | * 6 | * Copyright(C) 2002-2003 Edouard Gomez 7 | * 2003 Christoph Lampert 8 | * 9 | * This program is free software ; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation ; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program ; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | * 23 | * $Id$ 24 | * 25 | ****************************************************************************/ 26 | 27 | #ifndef _ENCODER_CBP_H_ 28 | #define _ENCODER_CBP_H_ 29 | 30 | #include "../portab.h" 31 | 32 | typedef uint32_t(cbpFunc) (const int16_t * codes); 33 | 34 | typedef cbpFunc *cbpFuncPtr; 35 | 36 | extern cbpFuncPtr calc_cbp; 37 | 38 | extern cbpFunc calc_cbp_c; 39 | extern cbpFunc calc_cbp_plain; 40 | 41 | #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) 42 | extern cbpFunc calc_cbp_mmx; 43 | extern cbpFunc calc_cbp_sse2; 44 | #endif 45 | 46 | #endif /* _ENCODER_CBP_H_ */ 47 | -------------------------------------------------------------------------------- /dshow/src/CAbout.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC - DShow Front End 4 | * - About Window header file - 5 | * 6 | * Copyright(C) 2002-2003 Peter Ross 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _CABOUT_H_ 27 | #define _CABOUT_H_ 28 | 29 | #include 30 | 31 | 32 | DEFINE_GUID(CLSID_CABOUT, 33 | 0x00000001, 0x4fef, 0x40d3, 0xb3, 0xfa, 0xe0, 0x53, 0x1b, 0x89, 0x7f, 0x98); 34 | 35 | 36 | class CAbout : public CBasePropertyPage 37 | { 38 | public: 39 | static CUnknown * WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT * phr); 40 | 41 | CAbout(LPUNKNOWN pUnk, HRESULT * phr); 42 | ~CAbout(); 43 | 44 | INT_PTR OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 45 | }; 46 | 47 | #endif /* _CABOUT_H_ */ 48 | -------------------------------------------------------------------------------- /src/dct/fdct.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Forward DCT header - 5 | * 6 | * Copyright(C) 2001-2011 Michael Militzer 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _FDCT_H_ 27 | #define _FDCT_H_ 28 | 29 | #include "../portab.h" 30 | 31 | typedef void (fdctFunc) (short *const block); 32 | typedef fdctFunc *fdctFuncPtr; 33 | 34 | extern fdctFuncPtr fdct; 35 | 36 | fdctFunc fdct_int32; 37 | 38 | #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) 39 | fdctFunc fdct_mmx_ffmpeg; 40 | fdctFunc fdct_xmm_ffmpeg; 41 | fdctFunc fdct_mmx_skal; 42 | fdctFunc fdct_xmm_skal; 43 | fdctFunc fdct_sse2_skal; 44 | #endif 45 | 46 | #ifdef ARCH_IS_IA64 47 | fdctFunc fdct_ia64; 48 | #endif 49 | 50 | #endif /* _FDCT_H_ */ 51 | -------------------------------------------------------------------------------- /vfw/src/vfwext.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - experimental vfw-api-extensions - 5 | * 6 | * Copyright(C) Peter Ross 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _VFWEXT_H_ 27 | #define _VFWEXT_H_ 28 | 29 | /* VFWEXT */ 30 | 31 | #define VFWEXT_FOURCC 0xFFFFFFFF 32 | 33 | typedef struct { 34 | DWORD ciSize; /* structure size */ 35 | LONG ciWidth; /* frame width pixels */ 36 | LONG ciHeight; /* frame height pixels */ 37 | DWORD ciRate; /* frame rate/scale */ 38 | DWORD ciScale; 39 | LONG ciActiveFrame; /* currently selected frame# */ 40 | LONG ciFrameCount; /* total frames */ 41 | } VFWEXT_CONFIGURE_INFO_T; 42 | #define VFWEXT_CONFIGURE_INFO 1 43 | 44 | 45 | #endif /* _VFWEXT_H_ */ 46 | -------------------------------------------------------------------------------- /SMP/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | This is a small list of steps in order to build libxvidcore into a msvc dll and/or lib file. 3 | 4 | The project contains Release and Debug builds for static lib files (Debug/Release) 5 | as well as dynamic shared dll files (DebugDLL/ReleaseDLL). Along with the standard 6 | windows dll/lib configurations mentioned above there are also equivalent variants that 7 | can be used to compile for WinRT/UWP (These configurations have a WinRT suffix). 8 | There are also architecture configurations for either 32bit (x86) or 64bit (x64) compilation. 9 | Choose whichever project configuration meets your requirements. 10 | 11 | The project configurations support being built with various different windows SDK versions. 12 | By default they will use the lowest SDK version that would be available for Visual Studio 13 | version 2013 and up (This is the 8.1 SDK). However a batch file is also included 14 | (libxvidcore_with_latest_sdk.bat) which can be used to auto detect the newest available SDK 15 | installed on the host machine and then open the project using that as the compilation SDK. 16 | 17 | When using the WinRT/UWP project configurations the projects will automatically compile towards 18 | the default application target for the Version of Visual Studio being used: 19 | VS 2013: 8.1 20 | VS 2015: 8.1 21 | VS 2017+: 10.0.10240.0 22 | 23 | 24 | *** Building with YASM *** 25 | 26 | In order to build xvid using msvc you must first download and install YASM. 27 | YASM is required to compile all assembly files. 28 | 29 | 1) Visual Studio YASM integration can be downloaded from https://github.com/ShiftMediaProject/VSYASM/releases/latest 30 | 31 | 2) Once downloaded simply follow the install instructions included in the download. 32 | -------------------------------------------------------------------------------- /src/utils/emms.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - emms C wrapper - 5 | * 6 | * Copyright(C) 2002 Michael Militzer 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #include "emms.h" 27 | #include "../portab.h" 28 | 29 | /***************************************************************************** 30 | * Library data, declared here 31 | ****************************************************************************/ 32 | 33 | emmsFuncPtr emms; 34 | 35 | 36 | /***************************************************************************** 37 | * emms functions 38 | * 39 | * emms functions are used to restored the fpu context after mmx operations 40 | * because mmx and fpu share their registers/context 41 | * 42 | ****************************************************************************/ 43 | 44 | /* The no op wrapper for non MMX platforms */ 45 | void 46 | emms_c(void) 47 | { 48 | } 49 | -------------------------------------------------------------------------------- /dshow/src/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by xvid.ax.rc 4 | // 5 | #define VERSION_RES_MINOR_VER 0 6 | #define VERSION_RES_BUILD 0 7 | #define VER_DEBUG 0 8 | #define IDS_ABOUT 1 9 | #define VERSION_RES_MAJOR_VER 8 10 | #define IDD_ABOUT 102 11 | #define IDB_LOGO 103 12 | #define IDI_ICON 104 13 | #define IDC_BRIGHTNESS 1002 14 | #define IDC_DEBLOCK_UV 1003 15 | #define IDC_DEBLOCK_Y 1004 16 | #define IDC_FLIPVIDEO 1005 17 | #define IDC_COLORSPACE 1006 18 | #define IDC_RESET 1007 19 | #define IDC_FILMEFFECT 1008 20 | #define IDC_DERING 1009 21 | #define IDC_DERINGY 1009 22 | #define IDC_DIVX 1010 23 | #define IDC_COMPAT 1011 24 | #define IDC_MP4V 1012 25 | #define IDC_3IVX 1013 26 | #define IDC_DERINGUV 1014 27 | #define IDC_USE_AR 1015 28 | #define IDC_CORE 1016 29 | #define IDC_TRAYICON 1017 30 | #define VERSION_RES_LANGUAGE 0x409 31 | #define VERSION_RES_CHARSET 1252 32 | #define IDC_STATIC -1 33 | 34 | // Next default values for new objects 35 | // 36 | #ifdef APSTUDIO_INVOKED 37 | #ifndef APSTUDIO_READONLY_SYMBOLS 38 | #define _APS_NEXT_RESOURCE_VALUE 106 39 | #define _APS_NEXT_COMMAND_VALUE 40001 40 | #define _APS_NEXT_CONTROL_VALUE 1018 41 | #define _APS_NEXT_SYMED_VALUE 101 42 | #endif 43 | #endif 44 | -------------------------------------------------------------------------------- /src/motion/motion_smp.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - multithreaded Motion Estimation header - 5 | * 6 | * Copyright(C) 2005 Radoslaw Czyz 7 | * 8 | * significant portions derived from x264 project, 9 | * original authors: Trax, Gianluigi Tiesi, Eric Petit 10 | * 11 | * This program is free software ; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation ; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program ; if not, write to the Free Software 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * $Id$ 26 | * 27 | ****************************************************************************/ 28 | 29 | #ifndef SMP_MOTION_H 30 | #define SMP_MOTION_H 31 | 32 | typedef struct 33 | { 34 | pthread_t handle; /* thread's handle */ 35 | const FRAMEINFO *current; 36 | uint8_t * RefQ; 37 | int y_row; 38 | int y_step; 39 | int start_y; 40 | int stop_y; 41 | int * complete_count_self; 42 | int * complete_count_above; 43 | 44 | int MVmax, mvSum, mvCount; /* out */ 45 | 46 | uint32_t minfcode, minbcode; 47 | 48 | uint8_t *tmp_buffer; 49 | Bitstream *bs; 50 | 51 | Statistics *sStat; 52 | void *pEnc; 53 | } SMPData; 54 | 55 | 56 | void MotionEstimateSMP(SMPData * h); 57 | void SMPMotionEstimationBVOP(SMPData * h); 58 | 59 | #endif /* SMP_MOTION_H */ 60 | -------------------------------------------------------------------------------- /src/plugins/plugin_ssim.h: -------------------------------------------------------------------------------- 1 | 2 | /***************************************************************************** 3 | * 4 | * XVID MPEG-4 VIDEO CODEC 5 | * - SSIM plugin: computes the SSIM metric - 6 | * 7 | * Copyright(C) 2005 Johannes Reinhardt 8 | * 9 | * This program is free software ; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation ; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program ; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | * 23 | * 24 | * 25 | ****************************************************************************/ 26 | 27 | #ifndef SSIM_H 28 | #define SSIM_H 29 | 30 | /*Plugin for calculating and dumping the ssim quality metric according to 31 | 32 | http://www.cns.nyu.edu/~lcv/ssim/ 33 | 34 | there is a accurate (but very slow) implementation, using a 8x8 gaussian 35 | weighting window, that is quite close to the paper, and a faster unweighted 36 | implementation*/ 37 | 38 | typedef struct{ 39 | /*stat output*/ 40 | int b_printstat; 41 | char* stat_path; 42 | 43 | /*visualize*/ 44 | int b_visualize; 45 | 46 | /*accuracy 47 | 0 gaussian weigthed (original, as in paper, very slow) 48 | <=4 unweighted, 1 slow 4 fastest*/ 49 | int acc; 50 | 51 | int cpu_flags; /* XVID_CPU_XXX flags */ 52 | 53 | } plg_ssim_param_t; 54 | 55 | 56 | int plugin_ssim(void * handle, int opt, void * param1, void * param2); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/dct/ia64_asm/idct_fini.s: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // * 3 | // * XVID MPEG-4 VIDEO CODEC 4 | // * - IA64 inverse discrete cosine transform - 5 | // * 6 | // * Copyright(C) 2002 Christian Schwarz, Haiko Gaisser, Sebastian Hack 7 | // * 8 | // * This program is free software; you can redistribute it and/or modify it 9 | // * under the terms of the GNU General Public License as published by 10 | // * the Free Software Foundation; either version 2 of the License, or 11 | // * (at your option) any later version. 12 | // * 13 | // * This program is distributed in the hope that it will be useful, 14 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // * GNU General Public License for more details. 17 | // * 18 | // * You should have received a copy of the GNU General Public License 19 | // * along with this program; if not, write to the Free Software 20 | // * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // * 22 | // * $Id: idct_fini.s,v 1.2 2009-02-19 17:07:29 Isibaar Exp $ 23 | // * 24 | // ***************************************************************************/ 25 | // 26 | // **************************************************************************** 27 | // * 28 | // * idct_fini.s, IA-64 optimized inverse DCT 29 | // * 30 | // * This version was implemented during an IA-64 practical training at 31 | // * the University of Karlsruhe (http://i44w3.info.uni-karlsruhe.de/) 32 | // * 33 | // **************************************************************************** 34 | // 35 | 36 | mov ar.pfs = r16 37 | br.ret.sptk.few b0 38 | -------------------------------------------------------------------------------- /SMP/libxvidcore_with_latest_sdk.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | SET PROJECT=libxvidcore 4 | 5 | @REM Detect the newest available Windows SDK 6 | CALL :GetWindowsSdkVer 7 | 8 | @REM Open the project 9 | %PROJECT%.sln 10 | 11 | EXIT /B 0 12 | 13 | :GetWindowsSdkVer 14 | SET WindowsTargetPlatformVersion= 15 | 16 | IF "%WindowsTargetPlatformVersion%"=="" CALL :GetWin10SdkVer 17 | IF "%WindowsTargetPlatformVersion%"=="" CALL :GetWin81SdkVer 18 | EXIT /B 0 19 | 20 | :GetWin10SdkVer 21 | CALL :GetWin10SdkVerHelper HKLM\SOFTWARE\Wow6432Node > nul 2>&1 22 | IF errorlevel 1 CALL :GetWin10SdkVerHelper HKCU\SOFTWARE\Wow6432Node > nul 2>&1 23 | IF errorlevel 1 CALL :GetWin10SdkVerHelper HKLM\SOFTWARE > nul 2>&1 24 | IF errorlevel 1 CALL :GetWin10SdkVerHelper HKCU\SOFTWARE > nul 2>&1 25 | IF errorlevel 1 EXIT /B 1 26 | EXIT /B 0 27 | 28 | :GetWin10SdkVerHelper 29 | @REM Get Windows 10 SDK installed folder 30 | FOR /F "tokens=1,2*" %%i IN ('reg query "%1\Microsoft\Microsoft SDKs\Windows\v10.0" /v "InstallationFolder"') DO ( 31 | IF "%%i"=="InstallationFolder" ( 32 | SET WindowsSdkDir=%%~k 33 | ) 34 | ) 35 | 36 | @REM get windows 10 sdk version number 37 | SETLOCAL enableDelayedExpansion 38 | IF NOT "%WindowsSdkDir%"=="" FOR /f %%i IN ('dir "%WindowsSdkDir%include\" /b /ad-h /on') DO ( 39 | @REM Skip if Windows.h is not found in %%i\um. This would indicate that only the UCRT MSIs were 40 | @REM installed for this Windows SDK version. 41 | IF EXIST "%WindowsSdkDir%include\%%i\um\Windows.h" ( 42 | SET result=%%i 43 | IF "!result:~0,3!"=="10." ( 44 | SET SDK=!result! 45 | IF "!result!"=="%VSCMD_ARG_WINSDK%" SET findSDK=1 46 | ) 47 | ) 48 | ) 49 | 50 | IF "%findSDK%"=="1" SET SDK=%VSCMD_ARG_WINSDK% 51 | ENDLOCAL & SET WindowsTargetPlatformVersion=%SDK% 52 | IF "%WindowsTargetPlatformVersion%"=="" ( 53 | EXIT /B 1 54 | ) 55 | EXIT /B 0 56 | 57 | :GetWin81SdkVer 58 | SET WindowsTargetPlatformVersion=8.1 59 | EXIT /B 0 60 | -------------------------------------------------------------------------------- /src/quant/quant_matrix.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Quantization matrix management header - 5 | * 6 | * Copyright(C) 2002 Michael Militzer 7 | * 2002 Peter Ross 8 | * 9 | * This program is free software ; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation ; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program ; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | * 23 | * $Id$ 24 | * 25 | ****************************************************************************/ 26 | 27 | #ifndef _QUANT_MATRIX_H_ 28 | #define _QUANT_MATRIX_H_ 29 | 30 | #include "../portab.h" 31 | 32 | #define SCALEBITS 17 33 | 34 | void init_mpeg_matrix(uint16_t * mpeg_quant_matrices); 35 | 36 | int is_custom_intra_matrix(const uint16_t * mpeg_quant_matrices); 37 | int is_custom_inter_matrix(const uint16_t * mpeg_quant_matrices); 38 | 39 | void set_intra_matrix(uint16_t *mpeg_quant_matrices, const uint8_t * matrix); 40 | void set_inter_matrix(uint16_t *mpeg_quant_matrices, const uint8_t * matrix); 41 | 42 | void init_intra_matrix(uint16_t * mpeg_quant_matrices, uint32_t quant); 43 | 44 | const uint16_t *get_intra_matrix(const uint16_t *mpeg_quant_matrices); 45 | const uint16_t *get_inter_matrix(const uint16_t *mpeg_quant_matrices); 46 | 47 | const uint8_t *get_default_intra_matrix(void); 48 | const uint8_t *get_default_inter_matrix(void); 49 | 50 | #endif /* _QUANT_MATRIX_H_ */ 51 | -------------------------------------------------------------------------------- /src/dct/idct.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Inverse DCT header - 5 | * 6 | * Copyright(C) 2001-2011 Michael Militzer 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _IDCT_H_ 27 | #define _IDCT_H_ 28 | 29 | #include "../portab.h" 30 | 31 | void idct_int32_init(); 32 | void idct_ia64_init(); 33 | 34 | typedef void (idctFunc) (short *const block); 35 | typedef idctFunc *idctFuncPtr; 36 | 37 | extern idctFuncPtr idct; 38 | 39 | idctFunc idct_int32; 40 | idctFunc simple_idct_c; /* Michael Niedermayer */ 41 | 42 | #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) 43 | idctFunc idct_mmx; /* AP-992, Peter Gubanov, Michel Lespinasse */ 44 | idctFunc idct_xmm; /* AP-992, Peter Gubanov, Michel Lespinasse */ 45 | idctFunc idct_3dne; /* AP-992, Peter Gubanov, Michel Lespinasse, Jaan Kalda */ 46 | idctFunc idct_sse2_skal; /* Skal's one, IEEE 1180 compliant */ 47 | idctFunc idct_sse2_dmitry; /* Dmitry Rozhdestvensky */ 48 | #endif 49 | 50 | #ifdef ARCH_IS_IA64 51 | idctFunc idct_ia64; 52 | #endif 53 | 54 | #ifdef ARCH_IS_PPC 55 | idctFunc idct_altivec_c; 56 | #endif 57 | 58 | #endif /* _IDCT_H_ */ 59 | -------------------------------------------------------------------------------- /src/plugins/plugin_psnr.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Xvid plugin: outputs PSNR to stdout (should disapear soon) - 5 | * 6 | * Copyright(C) 2003 Peter Ross 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #include 27 | 28 | #include "../xvid.h" 29 | #include "../image/image.h" 30 | 31 | 32 | int xvid_plugin_psnr(void * handle, int opt, void * param1, void * param2) 33 | { 34 | switch(opt) { 35 | case XVID_PLG_INFO: 36 | { 37 | xvid_plg_info_t * info = (xvid_plg_info_t*)param1; 38 | info->flags = XVID_REQPSNR; 39 | return(0); 40 | } 41 | case XVID_PLG_CREATE: 42 | *((void**)param2) = NULL; /* We don't have any private data to bind here */ 43 | case XVID_PLG_DESTROY: 44 | case XVID_PLG_BEFORE: 45 | case XVID_PLG_FRAME: 46 | return(0); 47 | case XVID_PLG_AFTER: 48 | { 49 | xvid_plg_data_t * data = (xvid_plg_data_t*)param1; 50 | 51 | printf("y_psnr=%2.2f u_psnr=%2.2f v_psnr=%2.2f\n", 52 | sse_to_PSNR(data->sse_y, data->width*data->height), 53 | sse_to_PSNR(data->sse_u, data->width*data->height/4), 54 | sse_to_PSNR(data->sse_v, data->width*data->height/4)); 55 | 56 | return(0); 57 | } 58 | } 59 | 60 | return XVID_ERR_FAIL; 61 | } 62 | -------------------------------------------------------------------------------- /vfw/src/status.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Status window header - 5 | * 6 | * Copyright(C) Peter Ross 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _STATUS_H_ 27 | #define _STATUS_H_ 28 | 29 | #include 30 | 31 | /* int64_t */ 32 | #if defined(_MSC_VER) || defined (__WATCOMC__) 33 | # define int64_t __int64 34 | # define uint64_t unsigned __int64 35 | #else 36 | # include 37 | #endif 38 | 39 | typedef struct 40 | { 41 | double fps; 42 | 43 | HWND hDlg; 44 | HWND hGraph; 45 | HDC hDc; 46 | 47 | unsigned int width; 48 | unsigned int width31; 49 | unsigned int height; 50 | unsigned int stride; 51 | unsigned char * buffer; 52 | 53 | TEXTMETRIC tm; 54 | BITMAPINFO * bi; 55 | 56 | int64_t count[4]; 57 | int min_quant[4]; 58 | int max_quant[4]; 59 | int quant[3][31]; 60 | int max_quant_frames; 61 | int min_length[4]; 62 | int max_length[4]; 63 | int64_t tot_length[4]; 64 | } status_t; 65 | 66 | 67 | void status_create(status_t * s, unsigned int fps_inc, unsigned int fps_base); 68 | void status_update(status_t *s, int type, int length, int quant); 69 | void status_destroy(status_t *s); 70 | void status_destroy_always(status_t *s); 71 | 72 | #endif /* _STATUS_H_ */ 73 | -------------------------------------------------------------------------------- /src/motion/ia64_asm/calc_delta_3.s: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // * 3 | // * XVID MPEG-4 VIDEO CODEC 4 | // * - IA64 halfpel refinement - 5 | // * 6 | // * Copyright(C) 2002 Johannes Singler, Daniel Winkler 7 | // * 8 | // * This program is free software; you can redistribute it and/or modify it 9 | // * under the terms of the GNU General Public License as published by 10 | // * the Free Software Foundation; either version 2 of the License, or 11 | // * (at your option) any later version. 12 | // * 13 | // * This program is distributed in the hope that it will be useful, 14 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // * GNU General Public License for more details. 17 | // * 18 | // * You should have received a copy of the GNU General Public License 19 | // * along with this program; if not, write to the Free Software 20 | // * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // * 22 | // * $Id: calc_delta_3.s,v 1.2 2009-02-19 17:07:29 Isibaar Exp $ 23 | // * 24 | // ***************************************************************************/ 25 | // 26 | // **************************************************************************** 27 | // * 28 | // * calc_delta_3.s, IA-64 halfpel refinement 29 | // * 30 | // * This version was implemented during an IA-64 practical training at 31 | // * the University of Karlsruhe (http://i44w3.info.uni-karlsruhe.de/) 32 | // * 33 | // **************************************************************************** 34 | 35 | ;; 36 | (fb) mov iMinSAD = mpr[8] 37 | (fb) mov currX = backupX 38 | (fb) mov currY = backupY 39 | mov ret0 = 2 40 | (non0_0) add sc[0] = iFcode, sc[0] 41 | (non0_1) add sc[1] = iFcode, sc[1] 42 | ;; 43 | (non0_0) add ret0 = ret0, sc[0] 44 | ;; 45 | (non0_1) add ret0 = ret0, sc[1] 46 | ;; 47 | 48 | setf.sig fmv = ret0 49 | ;; 50 | xmpy.l fmv = fmv, fQuant 51 | ;; 52 | -------------------------------------------------------------------------------- /src/bitstream/zigzag.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - ZigZag order matrices - 5 | * 6 | * Copyright(C) 2001-2002 Michael Militzer 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _ZIGZAG_H_ 27 | #define _ZIGZAG_H_ 28 | 29 | static const uint16_t scan_tables[3][64] = { 30 | /* zig_zag_scan */ 31 | { 0, 1, 8, 16, 9, 2, 3, 10, 32 | 17, 24, 32, 25, 18, 11, 4, 5, 33 | 12, 19, 26, 33, 40, 48, 41, 34, 34 | 27, 20, 13, 6, 7, 14, 21, 28, 35 | 35, 42, 49, 56, 57, 50, 43, 36, 36 | 29, 22, 15, 23, 30, 37, 44, 51, 37 | 58, 59, 52, 45, 38, 31, 39, 46, 38 | 53, 60, 61, 54, 47, 55, 62, 63}, 39 | 40 | /* horizontal_scan */ 41 | { 0, 1, 2, 3, 8, 9, 16, 17, 42 | 10, 11, 4, 5, 6, 7, 15, 14, 43 | 13, 12, 19, 18, 24, 25, 32, 33, 44 | 26, 27, 20, 21, 22, 23, 28, 29, 45 | 30, 31, 34, 35, 40, 41, 48, 49, 46 | 42, 43, 36, 37, 38, 39, 44, 45, 47 | 46, 47, 50, 51, 56, 57, 58, 59, 48 | 52, 53, 54, 55, 60, 61, 62, 63}, 49 | 50 | /* vertical_scan */ 51 | { 0, 8, 16, 24, 1, 9, 2, 10, 52 | 17, 25, 32, 40, 48, 56, 57, 49, 53 | 41, 33, 26, 18, 3, 11, 4, 12, 54 | 19, 27, 34, 42, 50, 58, 35, 43, 55 | 51, 59, 20, 28, 5, 13, 6, 14, 56 | 21, 29, 36, 44, 52, 60, 37, 45, 57 | 53, 61, 22, 30, 7, 15, 23, 31, 58 | 38, 46, 54, 62, 39, 47, 55, 63} 59 | }; 60 | 61 | #endif /* _ZIGZAG_H_ */ 62 | -------------------------------------------------------------------------------- /src/utils/emms.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - emms related header - 5 | * 6 | * Copyright(C) 2002 Michael Militzer 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _EMMS_H_ 27 | #define _EMMS_H_ 28 | 29 | /***************************************************************************** 30 | * emms API 31 | ****************************************************************************/ 32 | 33 | typedef void (emmsFunc) (); 34 | 35 | typedef emmsFunc *emmsFuncPtr; 36 | 37 | /* Our global function pointer - defined in emms.c */ 38 | extern emmsFuncPtr emms; 39 | 40 | /* Implemented functions */ 41 | 42 | emmsFunc emms_c; 43 | 44 | #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) 45 | emmsFunc emms_mmx; 46 | emmsFunc emms_3dn; 47 | #endif 48 | 49 | /***************************************************************************** 50 | * Prototypes 51 | ****************************************************************************/ 52 | 53 | #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) 54 | /* cpu_flag detection helper functions */ 55 | extern int check_cpu_features(void); 56 | extern void sse_os_trigger(void); 57 | extern void sse2_os_trigger(void); 58 | #endif 59 | 60 | #if defined(ARCH_IS_X86_64) && defined(WIN32) 61 | extern void prime_xmm(void *); 62 | extern void get_xmm(void *); 63 | #endif 64 | 65 | #ifdef ARCH_IS_PPC 66 | extern void altivec_trigger(void); 67 | #endif 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /src/plugins/plugin_dump.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Xvid plugin: dump pgm files of original and encoded frames - 5 | * 6 | * Copyright(C) 2003 Peter Ross 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #include 27 | 28 | #include "../xvid.h" 29 | #include "../image/image.h" 30 | 31 | 32 | int xvid_plugin_dump(void * handle, int opt, void * param1, void * param2) 33 | { 34 | switch(opt) { 35 | case XVID_PLG_INFO : 36 | { 37 | xvid_plg_info_t * info = (xvid_plg_info_t*)param1; 38 | info->flags = XVID_REQORIGINAL; 39 | return(0); 40 | } 41 | 42 | case XVID_PLG_CREATE : 43 | *((void**)param2) = NULL; /* We don't have any private data to bind here */ 44 | case XVID_PLG_DESTROY : 45 | case XVID_PLG_BEFORE : 46 | case XVID_PLG_FRAME : 47 | return(0); 48 | 49 | case XVID_PLG_AFTER : 50 | { 51 | xvid_plg_data_t * data = (xvid_plg_data_t*)param1; 52 | IMAGE img; 53 | char tmp[100]; 54 | img.y = data->original.plane[0]; 55 | img.u = data->original.plane[1]; 56 | img.v = data->original.plane[2]; 57 | sprintf(tmp, "ori-%03i.pgm", data->frame_num); 58 | image_dump_yuvpgm(&img, data->original.stride[0], data->width, data->height, tmp); 59 | 60 | img.y = data->current.plane[0]; 61 | img.u = data->current.plane[1]; 62 | img.v = data->current.plane[2]; 63 | sprintf(tmp, "enc-%03i.pgm", data->frame_num); 64 | image_dump_yuvpgm(&img, data->current.stride[0], data->width, data->height, tmp); 65 | } 66 | 67 | return(0); 68 | } 69 | 70 | return XVID_ERR_FAIL; 71 | } 72 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | ==== 3 | 4 | This file lists the TODO items 5 | 6 | Outstanding items: 7 | ------------------ 8 | xvidcore 9 | * update/fix CBR plugin 10 | - misses target bitrate, bitrate burst in static motion/high motion 11 | transitions 12 | * parallel slice decoding (pre-parse for resync marker boundaries) 13 | * filter/deblock reference frames before ME ("true motion") 14 | * PSNR-HVS-M adaptive quantization 15 | 16 | examples 17 | * profile/level support within xvid_encraw 18 | 19 | vfw 20 | * integrated Packed<->ISO converter 21 | * vfw-ext api to get/set configuration parameters 22 | * ICM_DECOMPRESSEX_* support 23 | * warn user before overwriting .pass file 24 | * improve ergonomics of user interface 25 | * user settings management 26 | 27 | directshow 28 | * option to display libxvidcore version and bitstream ontop of video 29 | hopefully, using smooth fonts, not image_printf(). 30 | 31 | 32 | 33 | Completed items: 34 | ---------------- 35 | * clusterable two-pass coding 36 | * multi-threaded decoder deblocking 37 | * parallel slice coding 38 | * multi-threaded motion estimation 39 | * manual aspect ratio setting (1:1, 4:3, 16:9, Custom) 40 | * MMX MPEG4 quantization precision. 41 | * sse3/sse4 SIMD optimizations. 42 | * x86_64 optimizations for xvidcore. 43 | * remove divx4 api (ed.gomez) 44 | * remove VOP_TYPE enumerations (peter) 45 | * remove HINTed ME stuff (ed.gomez) 46 | * xvid_image_t/xvid_gbl_convert_t (peter) 47 | * xvid_global structs (peter) 48 | * errors codes (peter) 49 | * xvid_decoder structs (peter) 50 | * apply encoder api changes "HEAPS" (peter) 51 | * rawdec (use xvid_decraw instead) (ed.gomez) 52 | * Support for GMC 3 warp points (christoph) 53 | * New Qpel code (michael) 54 | * ME splitting and ME improvements (syskin) 55 | * New unix build process (ed.gomez) 56 | * Move/clean/enhance 2pass code from vfw to core (ed.gomez) 57 | * New thread/instance safe sse2 code (p.massimino) 58 | * INSTALL guide for Unix and Win32 (ed.gomez) 59 | * dshow static link to libxvidcore.lib (peter) 60 | * update/fix Lumimasking (syskin) 61 | * trellis for mpeg and relaxed optimization for big levels (skal) 62 | * thread safe mpeg quantizing (michael) 63 | * Interlacing for bvop and svop (syskin) 64 | * YV12/I420/USER clarification (christoph) 65 | * vfw and dshow link dynamically to xvidcore.dll (syskin) 66 | * vfw bitrate calculator (peter) 67 | * dshow configure from command line (peter) 68 | * bug hunting (ed.gomez/syskin) 69 | * video buffer verifier (christoph) 70 | 71 | 72 | Last edited: $Date: 2010-12-27 16:39:31 $ 73 | -------------------------------------------------------------------------------- /dshow/src/CAbout.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC - DShow Front End 4 | * - About Property Page - 5 | * 6 | * Copyright(C) 2002-2004 Peter Ross 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | /**************************************************************************** 27 | * 28 | * 2004/02/01 - Move configuration processing code into config.c 29 | * 2003/12/11 - added some additional options, mainly to make the deblocking 30 | * code from xvidcore available. Most of the new code is taken 31 | * from Nic's dshow filter, (C) Nic, http://nic.dnsalias.com 32 | * 33 | ****************************************************************************/ 34 | #include 35 | #include 36 | #include "CAbout.h" 37 | #include "CXvidDecoder.h" 38 | #include "resource.h" 39 | #include "config.h" 40 | 41 | 42 | 43 | CUnknown * WINAPI CAbout::CreateInstance(LPUNKNOWN punk, HRESULT *phr) 44 | { 45 | CAbout * pNewObject = new CAbout(punk, phr); 46 | if (pNewObject == NULL) 47 | { 48 | *phr = E_OUTOFMEMORY; 49 | } 50 | return pNewObject; 51 | } 52 | 53 | 54 | CAbout::CAbout(LPUNKNOWN pUnk, HRESULT * phr) : 55 | CBasePropertyPage(NAME("CAbout"), pUnk, IDD_ABOUT, IDS_ABOUT) 56 | { 57 | ASSERT(phr); 58 | } 59 | 60 | 61 | CAbout::~CAbout() 62 | { 63 | } 64 | 65 | 66 | INT_PTR CAbout::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 67 | { 68 | if (adv_proc(hwnd, uMsg, wParam, lParam) == FALSE) { 69 | return CBasePropertyPage::OnReceiveMessage(hwnd, uMsg, wParam, lParam); 70 | } 71 | return TRUE; 72 | } 73 | 74 | -------------------------------------------------------------------------------- /src/motion/ia64_asm/calc_delta_1.s: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // * 3 | // * XVID MPEG-4 VIDEO CODEC 4 | // * - IA64 halfpel refinement - 5 | // * 6 | // * Copyright(C) 2002 Johannes Singler, Daniel Winkler 7 | // * 8 | // * This program is free software; you can redistribute it and/or modify it 9 | // * under the terms of the GNU General Public License as published by 10 | // * the Free Software Foundation; either version 2 of the License, or 11 | // * (at your option) any later version. 12 | // * 13 | // * This program is distributed in the hope that it will be useful, 14 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // * GNU General Public License for more details. 17 | // * 18 | // * You should have received a copy of the GNU General Public License 19 | // * along with this program; if not, write to the Free Software 20 | // * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // * 22 | // * $Id: calc_delta_1.s,v 1.2 2009-02-19 17:07:29 Isibaar Exp $ 23 | // * 24 | // ***************************************************************************/ 25 | // 26 | // **************************************************************************** 27 | // * 28 | // * calc_delta_1.s, IA-64 halfpel refinement 29 | // * 30 | // * This version was implemented during an IA-64 practical training at 31 | // * the University of Karlsruhe (http://i44w3.info.uni-karlsruhe.de/) 32 | // * 33 | // **************************************************************************** 34 | 35 | ;; 36 | getf.sig ret0 = fmv 37 | add mpr[0] = mpr[0], mpr[1] 38 | add mpr[2] = mpr[2], mpr[3] 39 | add mpr[4] = mpr[4], mpr[5] 40 | add mpr[6] = mpr[6], mpr[7] 41 | ;; 42 | add mpr[0] = mpr[0], mpr[2] 43 | add mpr[4] = mpr[4], mpr[6] 44 | mov component[0] = dx 45 | mov component[1] = dy 46 | 47 | cmp.ne non0_2, p0 = 0, dx 48 | cmp.gt neg_2, p0 = 0, dx 49 | 50 | .pred.rel "mutex", p32, p36 //non0_0, neg_0 51 | 52 | cmp.ne non0_3, p0 = 0, dy 53 | cmp.gt neg_3, p0 = 0, dy 54 | ;; 55 | .pred.rel "mutex", p33, p37 //non0_1, neg_1 56 | 57 | add iSAD = iSAD, ret0 58 | add mpr[8] = mpr[0], mpr[4] 59 | (neg_2) sub component[0] = 0, component[0] //abs 60 | (neg_3) sub component[1] = 0, component[1] //abs 61 | ;; 62 | -------------------------------------------------------------------------------- /src/dct/ia64_asm/idct_init.s: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // * 3 | // * XVID MPEG-4 VIDEO CODEC 4 | // * - IA64 inverse discrete cosine transform - 5 | // * 6 | // * Copyright(C) 2002 Christian Schwarz, Haiko Gaisser, Sebastian Hack 7 | // * 8 | // * This program is free software; you can redistribute it and/or modify it 9 | // * under the terms of the GNU General Public License as published by 10 | // * the Free Software Foundation; either version 2 of the License, or 11 | // * (at your option) any later version. 12 | // * 13 | // * This program is distributed in the hope that it will be useful, 14 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // * GNU General Public License for more details. 17 | // * 18 | // * You should have received a copy of the GNU General Public License 19 | // * along with this program; if not, write to the Free Software 20 | // * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // * 22 | // * $Id: idct_init.s,v 1.2 2009-02-19 17:07:29 Isibaar Exp $ 23 | // * 24 | // ***************************************************************************/ 25 | // 26 | // **************************************************************************** 27 | // * 28 | // * idct_init.s, IA-64 optimized inverse DCT 29 | // * 30 | // * This version was implemented during an IA-64 practical training at 31 | // * the University of Karlsruhe (http://i44w3.info.uni-karlsruhe.de/) 32 | // * 33 | // **************************************************************************** 34 | // 35 | 36 | addreg3 = r20 37 | addreg4 = r21 38 | addreg5 = r22 39 | addreg6 = r23 40 | 41 | one = f30 42 | alloc r16 = ar.pfs, 1, 71, 0, 0 43 | addl addreg1 = @gprel(.data_c0#), gp 44 | addl addreg2 = @gprel(.data_c2#), gp 45 | ;; 46 | add addreg3 = 32, addreg1 47 | add addreg4 = 32, addreg2 48 | add addreg5 = 64, addreg1 49 | add addreg6 = 64, addreg2 50 | ;; 51 | ldfp8 c0, c1 = [addreg1] 52 | ldfp8 c2, c3 = [addreg2] 53 | ;; 54 | ldfp8 c4, c5 = [addreg3], 16 55 | ldfp8 c6, c7 = [addreg4], 16 56 | add addreg1 = 96, addreg1 57 | add addreg2 = 96, addreg2 58 | ;; 59 | ldfp8 c8, c9 = [addreg5], 16 60 | ldfp8 c10, c11 = [addreg6], 16 61 | ;; 62 | ldfp8 c12, c13 = [addreg1] 63 | ldfp8 c14, c15 = [addreg2] 64 | ;; 65 | mov addreg1 = in0 66 | fpack one = f1, f1 67 | add addreg2 = 2, in0 68 | ;; 69 | -------------------------------------------------------------------------------- /src/bitstream/vlc_codes.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Variable Length Code header - 5 | * 6 | * Copyright(C) 2002 Michael Militzer 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | #ifndef _VLC_CODES_H_ 26 | #define _VLC_CODES_H_ 27 | 28 | #include "../portab.h" 29 | 30 | #define VLC_ERROR (-1) 31 | 32 | #define ESCAPE 3 33 | #define ESCAPE1 6 34 | #define ESCAPE2 14 35 | #define ESCAPE3 15 36 | 37 | typedef struct 38 | { 39 | uint32_t code; 40 | uint8_t len; 41 | } 42 | VLC; 43 | 44 | typedef struct 45 | { 46 | uint8_t last; 47 | uint8_t run; 48 | int8_t level; 49 | } 50 | EVENT; 51 | 52 | typedef struct 53 | { 54 | uint8_t len; 55 | EVENT event; 56 | } 57 | REVERSE_EVENT; 58 | 59 | typedef struct 60 | { 61 | VLC vlc; 62 | EVENT event; 63 | } 64 | VLC_TABLE; 65 | 66 | 67 | /****************************************************************** 68 | * common tables between encoder/decoder * 69 | ******************************************************************/ 70 | 71 | extern VLC const dc_lum_tab[]; 72 | extern short const dc_threshold[]; 73 | extern VLC_TABLE const coeff_tab[2][102]; 74 | extern uint8_t const max_level[2][2][64]; 75 | extern uint8_t const max_run[2][2][64]; 76 | extern VLC sprite_trajectory_code[32768]; 77 | extern VLC sprite_trajectory_len[15]; 78 | extern VLC mcbpc_intra_tab[15]; 79 | extern VLC mcbpc_inter_tab[29]; 80 | extern const VLC xvid_cbpy_tab[16]; 81 | extern const VLC dcy_tab[511]; 82 | extern const VLC dcc_tab[511]; 83 | extern const VLC mb_motion_table[65]; 84 | extern VLC const mcbpc_intra_table[64]; 85 | extern VLC const mcbpc_inter_table[257]; 86 | extern VLC const cbpy_table[64]; 87 | extern VLC const TMNMVtab0[]; 88 | extern VLC const TMNMVtab1[]; 89 | extern VLC const TMNMVtab2[]; 90 | 91 | #endif /* _VLC_CODES_H */ 92 | -------------------------------------------------------------------------------- /dshow/src/config.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Configuration processing header file - 5 | * 6 | * Copyright(C) 2002-2012 Peter Ross 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _DSHOW_CONFIG_H_ 27 | #define _DSHOW_CONFIG_H_ 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | /* registry stuff */ 34 | #define XVID_REG_KEY HKEY_CURRENT_USER 35 | #define XVID_REG_SUBKEY "Software\\GNU\\XviD" 36 | #define XVID_REG_CLASS "config" 37 | 38 | #define REG_GET_N(X, Y, Z) size=sizeof(int);if(RegQueryValueEx(hKey, X, 0, 0, (LPBYTE)&Y, &size) != ERROR_SUCCESS) {Y=Z;} 39 | #define REG_GET_S(X, Y, Z) size=MAX_PATH;if(RegQueryValueEx(hKey, X, 0, 0, Y, &size) != ERROR_SUCCESS) {lstrcpy(Y, Z);} 40 | #define REG_SET_N(X, Y) RegSetValueEx(hKey, X, 0, REG_DWORD, (LPBYTE)&Y, sizeof(int)) 41 | #define REG_SET_S(X, Y) RegSetValueEx(hKey, X, 0, REG_SZ, Y, lstrlen(Y)+1) 42 | 43 | 44 | /* config struct */ 45 | #define SUPPORT_3IVX (1<<0) 46 | #define SUPPORT_DIVX (1<<1) 47 | #define SUPPORT_MP4V (1<<2) 48 | 49 | #define FORCE_NONE 0 50 | #define FORCE_YV12 1 51 | #define FORCE_YUY2 2 52 | #define FORCE_RGB24 3 53 | #define FORCE_RGB32 4 54 | 55 | typedef struct 56 | { 57 | int nBrightness; 58 | int nDeblock_Y; 59 | int nDeblock_UV; 60 | int nDering_Y; 61 | int nDering_UV; 62 | int nFilmEffect; 63 | int nFlipVideo; 64 | int nForceColorspace; 65 | unsigned int supported_4cc; 66 | int videoinfo_compat; 67 | int aspect_ratio; 68 | int num_threads; 69 | DWORD cpu; 70 | int bTrayIcon; 71 | } CONFIG; 72 | 73 | 74 | /* global */ 75 | extern CONFIG g_config; 76 | 77 | 78 | /* functions */ 79 | void LoadRegistryInfo(); 80 | void SaveRegistryInfo(int perfCount); 81 | INT_PTR CALLBACK adv_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 82 | 83 | #define XVID_DLL_NAME "xvidcore.dll" 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | 90 | #endif 91 | 92 | -------------------------------------------------------------------------------- /dshow/src/Configure.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Configure from command line - 5 | * 6 | * Copyright(C) 2002-2010 Peter Ross 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | 27 | #include 28 | #include 29 | #include "config.h" 30 | #include "resource.h" 31 | 32 | 33 | HINSTANCE g_xvid_hInst; 34 | 35 | 36 | INT_PTR adv_dialog(HWND hwndOwner) 37 | { 38 | PROPSHEETPAGE psp [1]; 39 | PROPSHEETHEADER psh; 40 | 41 | psp[0].dwSize = sizeof (PROPSHEETPAGE); 42 | psp[0].dwFlags = PSP_USETITLE; 43 | psp[0].hInstance = g_xvid_hInst; 44 | psp[0].pszTemplate = MAKEINTRESOURCE (IDD_ABOUT); 45 | psp[0].pszIcon = NULL; 46 | psp[0].pfnDlgProc = adv_proc; 47 | psp[0].pszTitle = "About"; 48 | psp[0].lParam = 0; 49 | 50 | psh.dwSize = sizeof (PROPSHEETHEADER); 51 | psh.dwFlags = PSH_PROPSHEETPAGE; 52 | psh.hwndParent = hwndOwner; 53 | psh.hInstance = g_xvid_hInst; 54 | psh.pszIcon = NULL; 55 | psh.pszCaption = (LPSTR)"Xvid Configuration"; 56 | psh.nPages = sizeof (psp) / sizeof (PROPSHEETPAGE); 57 | psh.ppsp = psp; 58 | 59 | return PropertySheet (&psh); 60 | } 61 | 62 | 63 | extern "C" void CALLBACK Configure(HWND hWndParent, HINSTANCE hInstParent, LPSTR lpCmdLine, int nCmdShow ); 64 | 65 | void CALLBACK Configure(HWND hWndParent, HINSTANCE hInstParent, LPSTR lpCmdLine, int nCmdShow ) 66 | { 67 | InitCommonControls(); 68 | LoadRegistryInfo(); 69 | adv_dialog( GetDesktopWindow() ); 70 | } 71 | 72 | 73 | /* strmbase.lib\dllentry.obj:DllEntryPoint@12 */ 74 | extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID); 75 | 76 | 77 | extern "C" BOOL WINAPI DllMain(HINSTANCE hInst, DWORD fdwReason, LPVOID lpvReserved); 78 | 79 | BOOL WINAPI DllMain(HINSTANCE hInst, DWORD fdwReason, LPVOID lpvReserved) 80 | { 81 | g_xvid_hInst = hInst; 82 | 83 | /* Call directshow DllEntryPoint@12 */ 84 | return DllEntryPoint(hInst, fdwReason, lpvReserved); 85 | } 86 | 87 | -------------------------------------------------------------------------------- /src/bitstream/mbcoding.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - MB coding header - 5 | * 6 | * Copyright (C) 2002 Michael Militzer 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _MB_CODING_H_ 27 | #define _MB_CODING_H_ 28 | 29 | #include "../portab.h" 30 | #include "../global.h" 31 | #include "vlc_codes.h" 32 | #include "bitstream.h" 33 | 34 | void init_vlc_tables(void); 35 | 36 | int check_resync_marker(Bitstream * bs, int addbits); 37 | 38 | void bs_put_spritetrajectory(Bitstream * bs, const int val); 39 | int bs_get_spritetrajectory(Bitstream * bs); 40 | 41 | int get_mcbpc_intra(Bitstream * bs); 42 | int get_mcbpc_inter(Bitstream * bs); 43 | int get_cbpy(Bitstream * bs, 44 | int intra); 45 | int get_mv(Bitstream * bs, 46 | int fcode); 47 | 48 | int get_dc_dif(Bitstream * bs, 49 | uint32_t dc_size); 50 | int get_dc_size_lum(Bitstream * bs); 51 | int get_dc_size_chrom(Bitstream * bs); 52 | 53 | void get_intra_block(Bitstream * bs, 54 | int16_t * block, 55 | int direction, 56 | int coeff); 57 | void get_inter_block_h263( 58 | Bitstream * bs, 59 | int16_t * block, 60 | int direction, 61 | const int quant, 62 | const uint16_t *matrix); 63 | 64 | void get_inter_block_mpeg( 65 | Bitstream * bs, 66 | int16_t * block, 67 | int direction, 68 | const int quant, 69 | const uint16_t *matrix); 70 | 71 | 72 | void MBCodingBVOP(const FRAMEINFO * const frame, 73 | const MACROBLOCK * mb, 74 | const int16_t qcoeff[6 * 64], 75 | const int32_t fcode, 76 | const int32_t bcode, 77 | Bitstream * bs, 78 | Statistics * pStat); 79 | 80 | 81 | static __inline void 82 | MBSkip(Bitstream * bs) 83 | { 84 | BitstreamPutBit(bs, 1); /* not coded */ 85 | } 86 | 87 | int CodeCoeffIntra_CalcBits(const int16_t qcoeff[64], const uint16_t * zigzag); 88 | int CodeCoeffInter_CalcBits(const int16_t qcoeff[64], const uint16_t * zigzag); 89 | 90 | #endif /* _MB_CODING_H_ */ 91 | -------------------------------------------------------------------------------- /examples/README: -------------------------------------------------------------------------------- 1 | +--------------------------------------------------------------------+ 2 | | xvidcore lib examples | 3 | +--------------------------------------------------------------------+ 4 | 5 | In this directory can find some examples how to use Xvid MPEG4 codec 6 | in your own programs. 7 | 8 | ** cactus.pgm.bz2 9 | ---------------------------------------------------------------------- 10 | 11 | This a test sequence of 3 images with a cactus moving from right to 12 | left. It bzip2-compressed for size reason (half the size of a 13 | ZIP-file). Binaries of bunzip2 are available for all major OSes at 14 | http://sources.redhat.com/bzip2/ The original source of the cactus 15 | image is unknown... 16 | 17 | * xvid_encraw.c 18 | ---------------------------------------------------------------------- 19 | 20 | This is a small example that allows you to encode YUV streams or PGM 21 | files into a MPEG4 stream. It can output single files (on per encoded 22 | frame), or one file for all the enced stream (m4v format or a simple 23 | container format that we called mp4u, its description can be found at 24 | the end of this file). This program also outputs some very basic time 25 | results. 26 | 27 | Type "xvid_encraw -help" to have all options' description. 28 | 29 | Examples : 30 | 31 | 1) bzip2 -dc cactus.pgm.bz2 | ./xvid_encraw -type 1 32 | 33 | This command decompress cactus.pgm.bz2 and pipe the pgm file to 34 | xvid_encraw that will compress it to mpeg4 format. No mp4 stream 35 | output is written to disk. 36 | 37 | 2) ./xvid_encraw -type 1 -i cactus.pgm -save 38 | 39 | Compress cactus.pgm frames into mpeg4 stream, and then writes a 40 | m4v file per encoded frame. 41 | 42 | 3) ./xvid_encraw -type 1 -i cactus.pgm -o my_xvid_example.m4v -stats 43 | 44 | Same thing as above but saves all raw m4v data to a singlefile, 45 | and displays yuv-plane psnr statistics to stdout. 46 | 47 | 48 | ** xvid_decraw.c 49 | ---------------------------------------------------------------------- 50 | 51 | This is a decoder example that is able to decode a m4v or mp4u 52 | stream. You can use it to decode what xvid_encraw encoded. 53 | 54 | Type "xvid_decraw -help" to have all options' description. 55 | 56 | Examples : 57 | 58 | 1) ./xvid_decraw -i stream.m4v -d 59 | 60 | This command decodes a m4v file from stream.m4v and saves all 61 | decoder output frames to individual PGM files (framexxxxx.pgm). 62 | 63 | 2) cat stream.m4v | ./xvid_decraw 64 | 65 | This examples decodes a m4v stream from standard input, but does 66 | save any decoded frames. 67 | 68 | 69 | ** xvid_bench.c 70 | ---------------------------------------------------------------------- 71 | 72 | This is a tool to conduct unit testing and profiling of the signal 73 | processing functions used internally within libxvidcore. 74 | 75 | -------------------------------------------------------------------------------- /src/prediction/mbprediction.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Prediction header - 5 | * 6 | * Copyright(C) 2002-2010 Michael Militzer 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | 27 | #ifndef _MBPREDICTION_H_ 28 | #define _MBPREDICTION_H_ 29 | 30 | #include "../portab.h" 31 | #include "../decoder.h" 32 | #include "../global.h" 33 | 34 | #define MIN(X, Y) ((X)<(Y)?(X):(Y)) 35 | #define MAX(X, Y) ((X)>(Y)?(X):(Y)) 36 | 37 | /* very large value */ 38 | #define MV_MAX_ERROR (4096 * 256) 39 | 40 | #define MVequal(A,B) ( ((A).x)==((B).x) && ((A).y)==((B).y) ) 41 | 42 | void MBPrediction(FRAMEINFO * frame, /* <-- The parameter for ACDC and MV prediction */ 43 | uint32_t x_pos, /* <-- The x position of the MB to be searched */ 44 | uint32_t y_pos, /* <-- The y position of the MB to be searched */ 45 | uint32_t x_dim, /* <-- Number of macroblocks in a row */ 46 | int16_t * qcoeff, /* <-> The quantized DCT coefficients */ 47 | const int bound); 48 | 49 | void add_acdc(MACROBLOCK * pMB, 50 | uint32_t block, 51 | int16_t dct_codes[64], 52 | uint32_t iDcScaler, 53 | int16_t predictors[8], 54 | const int bsversion); 55 | 56 | void predict_acdc(MACROBLOCK * pMBs, 57 | uint32_t x, 58 | uint32_t y, 59 | uint32_t mb_width, 60 | uint32_t block, 61 | int16_t qcoeff[64], 62 | uint32_t current_quant, 63 | int32_t iDcScaler, 64 | int16_t predictors[8], 65 | const int bound); 66 | 67 | VECTOR 68 | get_pmv2(const MACROBLOCK * const mbs, 69 | const int mb_width, 70 | const int bound, 71 | const int x, 72 | const int y, 73 | const int block); 74 | 75 | VECTOR 76 | get_pmv2_interlaced(const MACROBLOCK * const mbs, 77 | const int mb_width, 78 | const int bound, 79 | const int x, 80 | const int y, 81 | const int block); 82 | 83 | VECTOR 84 | get_qpmv2(const MACROBLOCK * const mbs, 85 | const int mb_width, 86 | const int bound, 87 | const int x, 88 | const int y, 89 | const int block); 90 | 91 | #endif /* _MBPREDICTION_H_ */ 92 | -------------------------------------------------------------------------------- /src/motion/gmc.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - GMC interpolation module header - 5 | * 6 | * Copyright(C) 2002-2003 Pascal Massimino 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #include "../portab.h" 27 | #include "../global.h" 28 | 29 | /* ************************************************************* 30 | * will initialize internal pointers 31 | */ 32 | 33 | void init_GMC(const unsigned int cpu_flags); 34 | 35 | /* ************************************************************* 36 | * Warning! It's Accuracy being passed, not 'resolution'! 37 | */ 38 | 39 | void generate_GMCparameters(int nb_pts, const int accuracy, 40 | const WARPPOINTS *const pts, 41 | const int width, const int height, 42 | NEW_GMC_DATA *const gmc); 43 | 44 | /* ******************************************************************* 45 | */ 46 | 47 | void 48 | generate_GMCimage( const NEW_GMC_DATA *const gmc_data, /* [input] precalculated data */ 49 | const IMAGE *const pRef, /* [input] */ 50 | const int mb_width, 51 | const int mb_height, 52 | const int stride, 53 | const int stride2, 54 | const int fcode, /* [input] some parameters... */ 55 | const int32_t quarterpel, /* [input] for rounding avgMV */ 56 | const int reduced_resolution, /* [input] ignored */ 57 | const int32_t rounding, /* [input] for rounding image data */ 58 | MACROBLOCK *const pMBs, /* [output] average motion vectors */ 59 | IMAGE *const pGMC); /* [output] full warped image */ 60 | 61 | /* ************************************************************* 62 | * utils 63 | */ 64 | 65 | /* This is borrowed from decoder.c */ 66 | static __inline int 67 | gmc_sanitize(int value, int quarterpel, int fcode) 68 | { 69 | int length = 1 << (fcode+4); 70 | 71 | #if 0 72 | if (quarterpel) value *= 2; 73 | #endif 74 | 75 | if (value < -length) 76 | return -length; 77 | else if (value >= length) 78 | return length-1; 79 | else return value; 80 | } 81 | 82 | /* *************************************************************/ 83 | -------------------------------------------------------------------------------- /src/image/postprocessing.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Postprocessing header - 5 | * 6 | * Copyright(C) 2003-2010 Michael Militzer 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _POSTPROCESSING_H_ 27 | #define _POSTPROCESSING_H_ 28 | 29 | #include 30 | #include "../portab.h" 31 | 32 | /* Filtering thresholds */ 33 | 34 | #define THR1 2 35 | #define THR2 6 36 | 37 | #define MAX_NOISE 4096 38 | #define MAX_SHIFT 1024 39 | #define MAX_RES (MAX_NOISE - MAX_SHIFT) 40 | 41 | #define DERING_STRENGTH 2 42 | 43 | typedef struct { 44 | int8_t xvid_thresh_tbl[511]; 45 | uint8_t xvid_abs_tbl[511]; 46 | int8_t xvid_noise1[MAX_NOISE * sizeof(int8_t)]; 47 | int8_t xvid_noise2[MAX_NOISE * sizeof(int8_t)]; 48 | int8_t *xvid_prev_shift[MAX_RES][6]; 49 | int prev_quant; 50 | } XVID_POSTPROC; 51 | 52 | typedef struct 53 | { 54 | pthread_t handle; /* thread's handle */ 55 | 56 | XVID_POSTPROC *tbls; 57 | IMAGE * img; 58 | const MACROBLOCK * mbs; 59 | 60 | int stride; 61 | int start_x; 62 | int stop_x; 63 | int start_y; 64 | int stop_y; 65 | int mb_stride; 66 | int flags; 67 | } SMPDeblock; 68 | 69 | void 70 | image_postproc(XVID_POSTPROC *tbls, IMAGE * img, int edged_width, 71 | const MACROBLOCK * mbs, int mb_width, int mb_height, int mb_stride, 72 | int flags, int brightness, int frame_num, int bvop, int threads); 73 | 74 | void deblock8x8_h(XVID_POSTPROC *tbls, uint8_t *img, int stride, int quant, int dering); 75 | void deblock8x8_v(XVID_POSTPROC *tbls, uint8_t *img, int stride, int quant, int dering); 76 | 77 | void init_postproc(XVID_POSTPROC *tbls); 78 | void init_noise(XVID_POSTPROC *tbls); 79 | void init_deblock(XVID_POSTPROC *tbls); 80 | 81 | void add_noise(XVID_POSTPROC * tbls, uint8_t *dst, uint8_t *src, int stride, int width, int height, int shiftptr, int quant); 82 | 83 | 84 | typedef void (IMAGEBRIGHTNESS) (uint8_t * dst, 85 | int stride, 86 | int width, 87 | int height, 88 | int offset); 89 | typedef IMAGEBRIGHTNESS *IMAGEBRIGHTNESS_PTR; 90 | 91 | extern IMAGEBRIGHTNESS_PTR image_brightness; 92 | 93 | IMAGEBRIGHTNESS image_brightness_c; 94 | IMAGEBRIGHTNESS image_brightness_mmx; 95 | IMAGEBRIGHTNESS image_brightness_sse2; 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /src/utils/mbfunctions.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - MB related header - 5 | * 6 | * Copyright(C) 2001 Michael Militzer 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _ENCORE_BLOCK_H 27 | #define _ENCORE_BLOCK_H 28 | 29 | #include "../encoder.h" 30 | #include "../bitstream/bitstream.h" 31 | 32 | 33 | /** MBTransQuant.c **/ 34 | 35 | 36 | void MBTransQuantIntra(const MBParam * const pParam, 37 | const FRAMEINFO * const frame, 38 | MACROBLOCK * const pMB, 39 | const uint32_t x_pos, /* <-- The x position of the MB to be searched */ 40 | const uint32_t y_pos, /* <-- The y position of the MB to be searched */ 41 | int16_t data[6 * 64], /* <-> the data of the MB to be coded */ 42 | int16_t qcoeff[6 * 64]); /* <-> the quantized DCT coefficients */ 43 | 44 | uint8_t MBTransQuantInter(const MBParam * const pParam, 45 | const FRAMEINFO * const frame, 46 | MACROBLOCK * const pMB, 47 | const uint32_t x_pos, 48 | const uint32_t y_pos, 49 | int16_t data[6 * 64], 50 | int16_t qcoeff[6 * 64]); 51 | 52 | uint8_t MBTransQuantInterBVOP(const MBParam * pParam, 53 | FRAMEINFO * frame, 54 | MACROBLOCK * pMB, 55 | const uint32_t x_pos, 56 | const uint32_t y_pos, 57 | int16_t data[6 * 64], 58 | int16_t qcoeff[6 * 64]); 59 | 60 | 61 | typedef uint32_t (MBFIELDTEST) (int16_t data[6 * 64]); /* function pointer for field test */ 62 | typedef MBFIELDTEST *MBFIELDTEST_PTR; 63 | 64 | /* global field test pointer for xvid.c */ 65 | extern MBFIELDTEST_PTR MBFieldTest; 66 | 67 | /* field test implementations */ 68 | MBFIELDTEST MBFieldTest_c; 69 | 70 | #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) 71 | MBFIELDTEST MBFieldTest_mmx; 72 | #endif 73 | 74 | void MBFrameToField(int16_t data[6 * 64]); /* de-interlace vertical Y blocks */ 75 | 76 | 77 | /** MBCoding.c **/ 78 | 79 | void MBCoding(const FRAMEINFO * const frame, /* <-- the parameter for coding of the bitstream */ 80 | MACROBLOCK * pMB, /* <-- Info of the MB to be coded */ 81 | int16_t qcoeff[6 * 64], /* <-- the quantized DCT coefficients */ 82 | Bitstream * bs, /* <-> the bitstream */ 83 | Statistics * pStat); /* <-> statistical data collected for current frame */ 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /vfw/bin/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Makefile for XviD VFW driver 4 | # 5 | # Author : Milan Cutka 6 | # Modified by : Edouard Gomez 7 | # Peter Ross 8 | # 9 | # Requires GNU Make because of shell expansion performed at a bad time with 10 | # other make programs (even using := variable assignments) 11 | # 12 | # $Id: Makefile,v 1.7 2008-12-15 10:22:07 Isibaar Exp $ 13 | ############################################################################## 14 | 15 | include sources.inc 16 | 17 | MAKEFILE_PWD:=$(shell pwd) 18 | LOCAL_XVID_SRCTREE:=$(MAKEFILE_PWD)/../../src 19 | LOCAL_XVID_BUILDTREE:=$(MAKEFILE_PWD)/../../build/generic/=build 20 | 21 | RM = rm -rf 22 | WINDRES=windres 23 | 24 | # Constants which should not be modified 25 | # The `mingw-runtime` package is required when building with -mno-cygwin 26 | CFLAGS += -I$(SRC_DIR)/w32api -I$(LOCAL_XVID_SRCTREE) 27 | CFLAGS += -mno-cygwin 28 | CFLAGS += -D_WIN32_IE=0x0501 29 | 30 | ############################################################################## 31 | # Optional Compiler options 32 | ############################################################################## 33 | 34 | CFLAGS += -Wall 35 | CFLAGS += -O2 36 | CFLAGS += -fstrength-reduce 37 | CFLAGS += -finline-functions 38 | CFLAGS += -fgcse 39 | CFLAGS += -ffast-math 40 | 41 | ############################################################################## 42 | # Compiler flags for linking stage 43 | ############################################################################## 44 | 45 | # LDFLAGS += 46 | 47 | ############################################################################## 48 | # Rules 49 | ############################################################################## 50 | 51 | OBJECTS = $(SRC_C:.c=.obj) 52 | OBJECTS+= $(SRC_RES:.rc=.obj) 53 | 54 | .SUFFIXES: .obj .rc .c 55 | 56 | BUILD_DIR = =build 57 | VPATH = $(SRC_DIR):$(BUILD_DIR) 58 | 59 | all: $(LIBSO) 60 | 61 | $(BUILD_DIR): 62 | @echo " D: $(BUILD_DIR)" 63 | @mkdir -p $(BUILD_DIR) 64 | 65 | .rc.obj: 66 | @echo " W: $(@D)/$( 7 | * 2003 Christoph Lampert 8 | * 9 | * This program is free software ; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation ; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program ; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | * 23 | * $Id$ 24 | * 25 | ****************************************************************************/ 26 | 27 | #include "../portab.h" 28 | #include "cbp.h" 29 | 30 | cbpFuncPtr calc_cbp; 31 | 32 | /* 33 | * Returns a field of bits that indicates non zero ac blocks 34 | * for this macro block 35 | */ 36 | 37 | /* naive C */ 38 | uint32_t 39 | calc_cbp_plain(const int16_t codes[6 * 64]) 40 | { 41 | int i, j; 42 | uint32_t cbp = 0; 43 | 44 | for (i = 0; i < 6; i++) { 45 | for (j=1; j<64;j++) { 46 | if (codes[64*i+j]) { 47 | cbp |= 1 << (5-i); 48 | break; 49 | } 50 | } 51 | } 52 | return cbp; 53 | } 54 | 55 | /* optimized C */ 56 | uint32_t 57 | calc_cbp_c(const int16_t codes[6 * 64]) 58 | { 59 | unsigned int i=6; 60 | uint32_t cbp = 0; 61 | 62 | /* uses fixed relation: 4*codes = 1*codes64 */ 63 | /* if prototype is changed (e.g. from int16_t to something like int32) this routine 64 | has to be changed! */ 65 | 66 | do { 67 | uint64_t *codes64 = (uint64_t*)codes; /* the compiler doesn't really make this */ 68 | uint32_t *codes32 = (uint32_t*)codes; /* variables, just "addressing modes" */ 69 | 70 | cbp += cbp; 71 | if (codes[1] || codes32[1]) { 72 | cbp++; 73 | } 74 | else if (codes64[1] | codes64[2] | codes64[3]) { 75 | cbp++; 76 | } 77 | else if (codes64[4] | codes64[5] | codes64[6] | codes64[7]) { 78 | cbp++; 79 | } 80 | else if (codes64[8] | codes64[9] | codes64[10] | codes64[11]) { 81 | cbp++; 82 | } 83 | else if (codes64[12] | codes64[13] | codes64[14] | codes64[15]) { 84 | cbp++; 85 | } 86 | codes += 64; 87 | i--; 88 | } while (i != 0); 89 | 90 | return cbp; 91 | } 92 | 93 | 94 | 95 | 96 | /* older code maybe better on some plattforms? */ 97 | #if 0 98 | for (i = 5; i >= 0; i--) { 99 | if (codes[1] | codes[2] | codes[3]) 100 | cbp |= 1 << i; 101 | else { 102 | for (j = 4; j <= 56; j+=4) /* [60],[61],[62],[63] are last */ 103 | if (codes[j] | codes[j+1] | codes[j+2] | codes[j+3]) { 104 | cbp |= 1 << i; 105 | break; 106 | } 107 | } 108 | codes += 64; 109 | } 110 | 111 | return cbp; 112 | #endif 113 | -------------------------------------------------------------------------------- /vfw/bin/xvid.inf: -------------------------------------------------------------------------------- 1 | ; Xvid MPEG-4 Video Codec install 2 | 3 | [Version] 4 | Signature = "$CHICAGO$" 5 | Class = MEDIA 6 | 7 | [SourceDisksNames] 8 | 1="Xvid MPEG-4 Video Codec Install Disk",, 0001 9 | 10 | [SourceDisksFiles] 11 | xvidvfw.dll=1 12 | xvid.inf=1 13 | xvidcore.dll=1 14 | 15 | [Installable.Drivers] 16 | XVID = 1:xvidvfw.dll, "vidc.XVID", "Xvid MPEG-4 Video Codec" , , , 17 | 18 | [DefaultInstall] 19 | CopyFiles=MPEG4.Copy.Inf,MPEG4.Copy 20 | Updateinis = MPEG4.Updateini 21 | DelReg = MPEG4.DelConfig 22 | addreg = MPEG4.AddReg,MPEG4.AddReg9x,MPEG4.DoReg 23 | MediaType = SOFTWARE 24 | 25 | [DefaultInstall.ntx86] 26 | CopyFiles=MPEG4.Copy.Inf,MPEG4.Copy 27 | DelReg = MPEG4.DelConfig 28 | addreg = MPEG4.AddReg,MPEG4.AddRegNT,MPEG4.DoReg 29 | MediaType = SOFTWARE 30 | 31 | [Remove_XviD] 32 | AddReg = MPEG4.Unregister 33 | DelReg = MPEG4.DelReg 34 | DelFiles = MPEG4.Copy,MPEG4.Copy.Inf 35 | UpdateInis = MPEG4.DelIni 36 | 37 | [MPEG4.Copy] 38 | xvidvfw.dll 39 | xvidcore.dll 40 | 41 | [MPEG4.Copy.Inf] 42 | xvid.inf 43 | 44 | [MPEG4.UpdateIni] 45 | system.ini, drivers32,,"vidc.XVID=xvidvfw.dll" 46 | 47 | [MPEG4.DelIni] 48 | system.ini, drivers32,"vidc.XVID=xvidvfw.dll", 49 | 50 | [MPEG4.AddReg] 51 | 52 | [MPEG4.AddReg9x] 53 | HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.XVID,Description,,%XviD% 54 | HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.XVID,Driver,,xvidvfw.dll 55 | HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.XVID,FriendlyName,,"XVID" 56 | 57 | HKLM,%UnInstallPath%,DisplayName,,%XviD% 58 | HKLM,%UnInstallPath%,UninstallString,,"%10%\rundll.exe setupx.dll,InstallHinfSection Remove_XviD 132 %17%\%InfFile%" 59 | 60 | [MPEG4.AddRegNT] 61 | HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc,xvidvfw.dll,,%XviD% 62 | HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers32,vidc.XVID,,xvidvfw.dll 63 | 64 | HKLM,%UnInstallPath%,DisplayName,,%XviD% 65 | HKLM,%UnInstallPath%,DisplayIcon,,"%11%\xvidvfw.dll,0" 66 | HKLM,%UnInstallPath%,Publisher,,%mfgname% 67 | HKLM,%UnInstallPath%,HelpLink,,%Website% 68 | HKLM,%UnInstallPath%,NoModify,%REG_DWORD%,1 69 | HKLM,%UnInstallPath%,NoRepair,%REG_DWORD%,1 70 | HKLM,%UnInstallPath%,UninstallString,,"%11%\rundll32.exe setupapi,InstallHinfSection Remove_XviD 132 %17%\%InfFile%" 71 | 72 | [MPEG4.DoReg] 73 | ;HKLM,Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup,"Registering Xvid Direct Show ;Decoder...",,"%11%\regsvr32.exe /s %11%\xvid.ax" 74 | 75 | [MPEG4.DelReg] 76 | HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.XVID 77 | 78 | HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc,xvidvfw.dll,,"" 79 | HKLM,%UnInstallPath% 80 | 81 | [MPEG4.Unregister] 82 | ;HKLM,Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup,"Unregistering Xvid Direct Show ;Decoder...",,"%11%\regsvr32.exe /s /u %11%\xvid.ax" 83 | 84 | [MPEG4.DelConfig] 85 | HKCU,Software\GNU\XviD 86 | 87 | [DestinationDirs] 88 | DefaultDestDir = 11 ; LDID_SYS 89 | MPEG4.Copy = 11 90 | MPEG4.Copy.Inf = 17 91 | 92 | [Strings] 93 | XviD="Xvid MPEG-4 Video Codec" 94 | InfFile="xvid.inf" 95 | UnInstallPath="Software\Microsoft\Windows\CurrentVersion\Uninstall\xvid" 96 | MediaClassName="Media Devices" 97 | mfgname="Xvid Development Team" 98 | Website="http://www.xvid.org/" 99 | REG_DWORD=0x00010001 100 | -------------------------------------------------------------------------------- /src/utils/timer.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Timer related header (used for internal debugging) - 5 | * 6 | * Copyright(C) 2002 Michael Militzer 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _ENCORE_TIMER_H 27 | #define _ENCORE_TIMER_H 28 | 29 | #if defined(_PROFILING_) 30 | 31 | #include "../portab.h" 32 | 33 | uint64_t count_frames; 34 | 35 | extern void start_timer(void); 36 | extern void start_global_timer(void); 37 | extern void stop_dct_timer(void); 38 | extern void stop_idct_timer(void); 39 | extern void stop_motion_timer(void); 40 | extern void stop_comp_timer(void); 41 | extern void stop_edges_timer(void); 42 | extern void stop_inter_timer(void); 43 | extern void stop_quant_timer(void); 44 | extern void stop_iquant_timer(void); 45 | extern void stop_conv_timer(void); 46 | extern void stop_transfer_timer(void); 47 | extern void stop_coding_timer(void); 48 | extern void stop_prediction_timer(void); 49 | extern void stop_interlacing_timer(void); 50 | extern void stop_global_timer(void); 51 | extern void init_timer(void); 52 | extern void write_timer(void); 53 | 54 | #else 55 | 56 | static __inline void 57 | start_timer(void) 58 | { 59 | } 60 | static __inline void 61 | start_global_timer(void) 62 | { 63 | } 64 | static __inline void 65 | stop_dct_timer(void) 66 | { 67 | } 68 | static __inline void 69 | stop_idct_timer(void) 70 | { 71 | } 72 | static __inline void 73 | stop_motion_timer(void) 74 | { 75 | } 76 | static __inline void 77 | stop_comp_timer(void) 78 | { 79 | } 80 | static __inline void 81 | stop_edges_timer(void) 82 | { 83 | } 84 | static __inline void 85 | stop_inter_timer(void) 86 | { 87 | } 88 | static __inline void 89 | stop_quant_timer(void) 90 | { 91 | } 92 | static __inline void 93 | stop_iquant_timer(void) 94 | { 95 | } 96 | static __inline void 97 | stop_conv_timer(void) 98 | { 99 | } 100 | static __inline void 101 | stop_transfer_timer(void) 102 | { 103 | } 104 | static __inline void 105 | init_timer(void) 106 | { 107 | } 108 | static __inline void 109 | write_timer(void) 110 | { 111 | } 112 | static __inline void 113 | stop_coding_timer(void) 114 | { 115 | } 116 | static __inline void 117 | stop_interlacing_timer(void) 118 | { 119 | } 120 | static __inline void 121 | stop_prediction_timer(void) 122 | { 123 | } 124 | static __inline void 125 | stop_global_timer(void) 126 | { 127 | } 128 | 129 | #endif 130 | 131 | #endif /* _TIMER_H_ */ 132 | -------------------------------------------------------------------------------- /src/image/x86_asm/postprocessing_mmx.asm: -------------------------------------------------------------------------------- 1 | ;/***************************************************************************** 2 | ; * 3 | ; * XVID MPEG-4 VIDEO CODEC 4 | ; * - mmx post processing - 5 | ; * 6 | ; * Copyright(C) 2004 Peter Ross 7 | ; * 8 | ; * Xvid is free software; you can redistribute it and/or modify it 9 | ; * under the terms of the GNU General Public License as published by 10 | ; * the Free Software Foundation; either version 2 of the License, or 11 | ; * (at your option) any later version. 12 | ; * 13 | ; * This program is distributed in the hope that it will be useful, 14 | ; * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ; * GNU General Public License for more details. 17 | ; * 18 | ; * You should have received a copy of the GNU General Public License 19 | ; * along with this program; if not, write to the Free Software 20 | ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | ; * 22 | ; * $Id: postprocessing_mmx.asm,v 1.14 2010-03-09 10:00:14 Isibaar Exp $ 23 | ; * 24 | ; *************************************************************************/ 25 | 26 | %include "nasm.inc" 27 | 28 | ;=========================================================================== 29 | ; read only data 30 | ;=========================================================================== 31 | 32 | DATA 33 | 34 | mmx_0x80: 35 | times 8 db 0x80 36 | 37 | mmx_offset: 38 | %assign i -128 39 | %rep 256 40 | times 8 db i 41 | %assign i i+1 42 | %endrep 43 | 44 | 45 | ;============================================================================= 46 | ; Code 47 | ;============================================================================= 48 | 49 | TEXT 50 | 51 | cglobal image_brightness_mmx 52 | 53 | 54 | ;////////////////////////////////////////////////////////////////////// 55 | ;// image_brightness_mmx 56 | ;////////////////////////////////////////////////////////////////////// 57 | 58 | align SECTION_ALIGN 59 | image_brightness_mmx: 60 | 61 | movq mm6, [mmx_0x80] 62 | 63 | %ifdef ARCH_IS_X86_64 64 | XVID_MOVSXD _EAX, prm5d 65 | lea TMP0, [mmx_offset] 66 | movq mm7, [TMP0 + (_EAX + 128)*8] ; being lazy 67 | %else 68 | mov eax, prm5d ; offset 69 | movq mm7, [mmx_offset + (_EAX + 128)*8] ; being lazy 70 | %endif 71 | 72 | mov TMP1, prm1 ; Dst 73 | mov TMP0, prm2 ; stride 74 | 75 | push _ESI 76 | push _EDI 77 | %ifdef ARCH_IS_X86_64 78 | mov _ESI, prm3 79 | mov _EDI, prm4 80 | %else 81 | mov _ESI, [_ESP+8+12] ; width 82 | mov _EDI, [_ESP+8+16] ; height 83 | %endif 84 | 85 | .yloop: 86 | xor _EAX, _EAX 87 | 88 | .xloop: 89 | movq mm0, [TMP1 + _EAX] 90 | movq mm1, [TMP1 + _EAX + 8] ; mm0 = [dst] 91 | 92 | paddb mm0, mm6 ; unsigned -> signed domain 93 | paddb mm1, mm6 94 | paddsb mm0, mm7 95 | paddsb mm1, mm7 ; mm0 += offset 96 | psubb mm0, mm6 97 | psubb mm1, mm6 ; signed -> unsigned domain 98 | 99 | movq [TMP1 + _EAX], mm0 100 | movq [TMP1 + _EAX + 8], mm1 ; [dst] = mm0 101 | 102 | add _EAX,16 103 | cmp _EAX,_ESI 104 | jl .xloop 105 | 106 | add TMP1, TMP0 ; dst += stride 107 | dec _EDI 108 | jg .yloop 109 | 110 | pop _EDI 111 | pop _ESI 112 | 113 | ret 114 | ENDFUNC 115 | ;////////////////////////////////////////////////////////////////////// 116 | 117 | NON_EXEC_STACK 118 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | ShiftMediaProject Xvid 2 | ============= 3 | [![Build status](https://ci.appveyor.com/api/projects/status/raeoo5n9yocwmark?svg=true)](https://ci.appveyor.com/project/Sibras/xvid) 4 | [![Github All Releases](https://img.shields.io/github/downloads/ShiftMediaProject/xvid/total.svg)](https://github.com/ShiftMediaProject/xvid/releases) 5 | [![GitHub release](https://img.shields.io/github/release/ShiftMediaProject/xvid.svg)](https://github.com/ShiftMediaProject/xvid/releases/latest) 6 | [![GitHub issues](https://img.shields.io/github/issues/ShiftMediaProject/xvid.svg)](https://github.com/ShiftMediaProject/xvid/issues) 7 | [![license](https://img.shields.io/github/license/ShiftMediaProject/xvid.svg)](https://github.com/ShiftMediaProject/xvid) 8 | [![donate](https://img.shields.io/badge/donate-link-brightgreen.svg)](https://shiftmediaproject.github.io/8-donate/) 9 | ## ShiftMediaProject 10 | 11 | Shift Media Project aims to provide native Windows development libraries for xvid and associated dependencies to support simpler creation and debugging of rich media content directly within Visual Studio. [https://shiftmediaproject.github.io/](https://shiftmediaproject.github.io/) 12 | 13 | ## Xvid 14 | 15 | A high performance and high quality MPEG-4 video de-/encoding solution. [https://labs.xvid.com/](https://labs.xvid.com/) 16 | 17 | ## Downloads 18 | 19 | Development libraries are available from the [releases](https://github.com/ShiftMediaProject/xvid/releases) page. These libraries are available for each supported Visual Studio version with a different download for each version. Each download contains both static and dynamic libraries to choose from in both 32bit and 64bit versions. 20 | 21 | ## Code 22 | 23 | This repository contains code from the corresponding upstream project with additional modifications to allow it to be compiled with Visual Studio. New custom Visual Studio projects are provided within the 'SMP' sub-directory. Refer to the 'readme' contained within the 'SMP' directory for further details. 24 | 25 | ## Issues 26 | 27 | Any issues related to the ShiftMediaProject specific changes should be sent to the [issues](https://github.com/ShiftMediaProject/xvid/issues) page for the repository. Any issues related to the upstream project should be sent upstream directly (see the issues information of the upstream repository for more details). 28 | 29 | ## License 30 | 31 | ShiftMediaProject original code is released under [LGPLv2.1](https://www.gnu.org/licenses/lgpl-2.1.html). All code from the upstream repository remains under its original license (see the license information of the upstream repository for more details). 32 | 33 | ## Copyright 34 | 35 | As this repository includes code from upstream project(s) it includes many copyright owners. ShiftMediaProject makes NO claim of copyright on any upstream code. However, all original ShiftMediaProject authored code is copyright ShiftMediaProject. For a complete copyright list please checkout the source code to examine license headers. Unless expressly stated otherwise all code submitted to the ShiftMediaProject project (in any form) is licensed under [LGPLv2.1](https://www.gnu.org/licenses/lgpl-2.1.html) and copyright is donated to ShiftMediaProject. If you submit code that is not your own work it is your responsibility to place a header stating the copyright. 36 | 37 | ## Contributing 38 | 39 | Patches related to the ShiftMediaProject specific changes should be sent as pull requests to the main repository. Any changes related to the upstream project should be sent upstream directly (see the contributing information of the upstream repository for more details). -------------------------------------------------------------------------------- /src/image/reduced.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Reduced VOP header - 5 | * 6 | * Copyright(C) 2002 Pascal Massimino 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _REDUCED_H_ 27 | #define _REDUCED_H_ 28 | 29 | #include "../portab.h" 30 | 31 | /* decoding */ 32 | typedef void (COPY_UPSAMPLED_8X8_16TO8) (uint8_t *Dst, const int16_t *Src, const int BpS); 33 | typedef void (ADD_UPSAMPLED_8X8_16TO8) (uint8_t *Dst, const int16_t *Src, const int BpS); 34 | 35 | /* deblocking: Note: "Nb"_Blks is the number of 8-pixels blocks to process */ 36 | typedef void HFILTER_31(uint8_t *Src1, uint8_t *Src2, int Nb_Blks); 37 | typedef void VFILTER_31(uint8_t *Src1, uint8_t *Src2, const int BpS, int Nb_Blks); 38 | 39 | /* encoding: WARNING! These read 1 pixel outside of the input 16x16 block! */ 40 | typedef void FILTER_18X18_TO_8X8(int16_t *Dst, const uint8_t *Src, const int BpS); 41 | typedef void FILTER_DIFF_18X18_TO_8X8(int16_t *Dst, const uint8_t *Src, const int BpS); 42 | 43 | 44 | extern COPY_UPSAMPLED_8X8_16TO8 * copy_upsampled_8x8_16to8; 45 | extern COPY_UPSAMPLED_8X8_16TO8 xvid_Copy_Upsampled_8x8_16To8_C; 46 | #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) 47 | extern COPY_UPSAMPLED_8X8_16TO8 xvid_Copy_Upsampled_8x8_16To8_mmx; 48 | extern COPY_UPSAMPLED_8X8_16TO8 xvid_Copy_Upsampled_8x8_16To8_xmm; 49 | #endif 50 | 51 | extern ADD_UPSAMPLED_8X8_16TO8 * add_upsampled_8x8_16to8; 52 | extern ADD_UPSAMPLED_8X8_16TO8 xvid_Add_Upsampled_8x8_16To8_C; 53 | #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) 54 | extern ADD_UPSAMPLED_8X8_16TO8 xvid_Add_Upsampled_8x8_16To8_mmx; 55 | extern ADD_UPSAMPLED_8X8_16TO8 xvid_Add_Upsampled_8x8_16To8_xmm; 56 | #endif 57 | 58 | extern VFILTER_31 * vfilter_31; 59 | extern VFILTER_31 xvid_VFilter_31_C; 60 | #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) 61 | extern VFILTER_31 xvid_VFilter_31_x86; 62 | #endif 63 | 64 | extern HFILTER_31 * hfilter_31; 65 | extern HFILTER_31 xvid_HFilter_31_C; 66 | #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) 67 | extern HFILTER_31 xvid_HFilter_31_x86; 68 | extern HFILTER_31 xvid_HFilter_31_mmx; 69 | #endif 70 | 71 | extern FILTER_18X18_TO_8X8 * filter_18x18_to_8x8; 72 | extern FILTER_18X18_TO_8X8 xvid_Filter_18x18_To_8x8_C; 73 | #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) 74 | extern FILTER_18X18_TO_8X8 xvid_Filter_18x18_To_8x8_mmx; 75 | #endif 76 | 77 | extern FILTER_DIFF_18X18_TO_8X8 * filter_diff_18x18_to_8x8; 78 | extern FILTER_DIFF_18X18_TO_8X8 xvid_Filter_Diff_18x18_To_8x8_C; 79 | #if defined(ARCH_IS_IA32) || defined(XVID_IS_X86_64) 80 | extern FILTER_DIFF_18X18_TO_8X8 xvid_Filter_Diff_18x18_To_8x8_mmx; 81 | #endif 82 | 83 | 84 | /* rrv motion vector scale-up */ 85 | #define RRV_MV_SCALEUP(a) ( (a)>0 ? 2*(a)-1 : (a)<0 ? 2*(a)+1 : (a) ) 86 | 87 | #endif /* _REDUCED_H_ */ 88 | -------------------------------------------------------------------------------- /src/bitstream/x86_asm/cbp_sse2.asm: -------------------------------------------------------------------------------- 1 | ;/**************************************************************************** 2 | ; * 3 | ; * XVID MPEG-4 VIDEO CODEC 4 | ; * - SSE2 CBP computation - 5 | ; * 6 | ; * Copyright (C) 2002 Daniel Smith 7 | ; * 2002 Pascal Massimino 8 | ; * 9 | ; * This program is free software ; you can redistribute it and/or modify 10 | ; * it under the terms of the GNU General Public License as published by 11 | ; * the Free Software Foundation ; either version 2 of the License, or 12 | ; * (at your option) any later version. 13 | ; * 14 | ; * This program is distributed in the hope that it will be useful, 15 | ; * but WITHOUT ANY WARRANTY ; without even the implied warranty of 16 | ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ; * GNU General Public License for more details. 18 | ; * 19 | ; * You should have received a copy of the GNU General Public License 20 | ; * along with this program ; if not, write to the Free Software 21 | ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | ; * 23 | ; * $Id: cbp_sse2.asm,v 1.14 2009-09-16 17:07:58 Isibaar Exp $ 24 | ; * 25 | ; ***************************************************************************/ 26 | 27 | ;============================================================================= 28 | ; Macros 29 | ;============================================================================= 30 | 31 | %include "nasm.inc" 32 | 33 | %macro LOOP_SSE2 2 34 | movdqa xmm0, [%2+(%1)*128] 35 | pand xmm0, xmm3 36 | movdqa xmm1, [%2+(%1)*128+16] 37 | 38 | por xmm0, [%2+(%1)*128+32] 39 | por xmm1, [%2+(%1)*128+48] 40 | por xmm0, [%2+(%1)*128+64] 41 | por xmm1, [%2+(%1)*128+80] 42 | por xmm0, [%2+(%1)*128+96] 43 | por xmm1, [%2+(%1)*128+112] 44 | 45 | por xmm0, xmm1 ; xmm0 = xmm1 = 128 bits worth of info 46 | psadbw xmm0, xmm2 ; contains 2 dwords with sums 47 | movhlps xmm1, xmm0 ; move high dword from xmm0 to low xmm1 48 | por xmm0, xmm1 ; combine 49 | movd ecx, xmm0 ; if ecx set, values were found 50 | test _ECX, _ECX 51 | %endmacro 52 | 53 | ;============================================================================= 54 | ; Data (Read Only) 55 | ;============================================================================= 56 | 57 | DATA 58 | 59 | ALIGN SECTION_ALIGN 60 | ignore_dc: 61 | dw 0, -1, -1, -1, -1, -1, -1, -1 62 | 63 | ;============================================================================= 64 | ; Code 65 | ;============================================================================= 66 | 67 | TEXT 68 | 69 | ;----------------------------------------------------------------------------- 70 | ; uint32_t calc_cbp_sse2(const int16_t coeff[6*64]); 71 | ;----------------------------------------------------------------------------- 72 | 73 | ALIGN SECTION_ALIGN 74 | cglobal calc_cbp_sse2 75 | calc_cbp_sse2: 76 | mov _EDX, prm1 ; coeff[] 77 | xor _EAX, _EAX ; cbp = 0 78 | 79 | movdqu xmm3, [ignore_dc] ; mask to ignore dc value 80 | pxor xmm2, xmm2 ; zero 81 | 82 | LOOP_SSE2 0, _EDX 83 | jz .blk2 84 | or _EAX, (1<<5) 85 | 86 | .blk2: 87 | LOOP_SSE2 1, _EDX 88 | jz .blk3 89 | or _EAX, (1<<4) 90 | 91 | .blk3: 92 | LOOP_SSE2 2, _EDX 93 | jz .blk4 94 | or _EAX, (1<<3) 95 | 96 | .blk4: 97 | LOOP_SSE2 3, _EDX 98 | jz .blk5 99 | or _EAX, (1<<2) 100 | 101 | .blk5: 102 | LOOP_SSE2 4, _EDX 103 | jz .blk6 104 | or _EAX, (1<<1) 105 | 106 | .blk6: 107 | LOOP_SSE2 5, _EDX 108 | jz .finished 109 | or _EAX, (1<<0) 110 | 111 | .finished: 112 | 113 | ret 114 | ENDFUNC 115 | 116 | NON_EXEC_STACK 117 | -------------------------------------------------------------------------------- /src/image/x86_asm/deintl_sse.asm: -------------------------------------------------------------------------------- 1 | ;/***************************************************************************** 2 | ; * 3 | ; * XVID MPEG-4 VIDEO CODEC 4 | ; * - simple de-interlacer 5 | ; * Copyright(C) 2006 Pascal Massimino 6 | ; * 7 | ; * This file is part of Xvid, a free MPEG-4 video encoder/decoder 8 | ; * 9 | ; * Xvid is free software; you can redistribute it and/or modify it 10 | ; * under the terms of the GNU General Public License as published by 11 | ; * the Free Software Foundation; either version 2 of the License, or 12 | ; * (at your option) any later version. 13 | ; * 14 | ; * This program is distributed in the hope that it will be useful, 15 | ; * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ; * GNU General Public License for more details. 18 | ; * 19 | ; * You should have received a copy of the GNU General Public License 20 | ; * along with this program; if not, write to the Free Software 21 | ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | ; * 23 | ; * $Id: deintl_sse.asm,v 1.7 2010-03-09 10:00:14 Isibaar Exp $ 24 | ; * 25 | ; *************************************************************************/ 26 | 27 | ;/************************************************************************** 28 | ; * 29 | ; * History: 30 | ; * 31 | ; * Oct 13 2006: initial version 32 | ; * 33 | ; *************************************************************************/ 34 | 35 | %include "nasm.inc" 36 | 37 | ;////////////////////////////////////////////////////////////////////// 38 | 39 | cglobal xvid_deinterlace_sse 40 | 41 | ;////////////////////////////////////////////////////////////////////// 42 | 43 | DATA 44 | 45 | align SECTION_ALIGN 46 | Mask_6b times 16 db 0x3f 47 | Rnd_3b: times 16 db 3 48 | 49 | TEXT 50 | 51 | ;////////////////////////////////////////////////////////////////////// 52 | ;// sse version 53 | 54 | align SECTION_ALIGN 55 | xvid_deinterlace_sse: 56 | 57 | mov _EAX, prm1 ; Pix 58 | mov TMP0, prm3 ; Height 59 | mov TMP1, prm4 ; BpS 60 | 61 | push _EBX 62 | %ifdef ARCH_IS_X86_64 63 | mov _EBX, prm2 ; Width 64 | %else 65 | mov _EBX, [esp+4+ 8] ; Width 66 | %endif 67 | 68 | add _EBX, 7 69 | shr TMP0, 1 70 | shr _EBX, 3 ; Width /= 8 71 | dec TMP0 72 | 73 | movq mm6, [Mask_6b] 74 | 75 | .Loop_x: 76 | push _EAX 77 | movq mm1, [_EAX ] 78 | movq mm2, [_EAX+ TMP1] 79 | lea _EAX, [_EAX+ TMP1] 80 | movq mm0, mm2 81 | 82 | push TMP0 83 | 84 | .Loop: 85 | movq mm3, [_EAX+ TMP1] 86 | movq mm4, [_EAX+2*TMP1] 87 | movq mm5, mm2 88 | pavgb mm0, mm4 89 | pavgb mm1, mm3 90 | movq mm7, mm2 91 | psubusb mm2, mm0 92 | psubusb mm0, mm7 93 | paddusb mm0, [Rnd_3b] 94 | psrlw mm2, 2 95 | psrlw mm0, 2 96 | pand mm2, mm6 97 | pand mm0, mm6 98 | paddusb mm1, mm2 99 | psubusb mm1, mm0 100 | movq [_EAX], mm1 101 | lea _EAX, [_EAX+2*TMP1] 102 | movq mm0, mm5 103 | movq mm1, mm3 104 | movq mm2, mm4 105 | dec TMP0 106 | jg .Loop 107 | 108 | pavgb mm0, mm2 ; p0 += p2 109 | pavgb mm1, mm1 ; p1 += p1 110 | movq mm7, mm2 111 | psubusb mm2, mm0 112 | psubusb mm0, mm7 113 | paddusb mm0, [Rnd_3b] 114 | psrlw mm2, 2 115 | psrlw mm0, 2 116 | pand mm2, mm6 117 | pand mm0, mm6 118 | paddusb mm1, mm2 119 | psubusb mm1, mm0 120 | movq [_EAX], mm1 121 | 122 | pop TMP0 123 | pop _EAX 124 | add _EAX, 8 125 | 126 | dec _EBX 127 | jg .Loop_x 128 | 129 | pop _EBX 130 | ret 131 | ENDFUNC 132 | 133 | ;////////////////////////////////////////////////////////////////////// 134 | NON_EXEC_STACK 135 | -------------------------------------------------------------------------------- /vfw/src/codec.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - VFW codec header - 5 | * 6 | * Copyright(C) Peter Ross 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | #ifndef _CODEC_H_ 26 | #define _CODEC_H_ 27 | 28 | #include 29 | #include "config.h" 30 | #include "status.h" 31 | 32 | #define XVID_NAME_L L"XVID" 33 | #define XVID_DESC_L L"Xvid MPEG-4 Codec" 34 | 35 | #define FOURCC_XVID mmioFOURCC('X','V','I','D') 36 | #define FOURCC_DIVX mmioFOURCC('D','I','V','X') 37 | #define FOURCC_DX50 mmioFOURCC('D','X','5','0') 38 | #define FOURCC_MP4V mmioFOURCC('M','P','4','V') 39 | #define FOURCC_xvid mmioFOURCC('x','v','i','d') 40 | #define FOURCC_divx mmioFOURCC('d','i','v','x') 41 | #define FOURCC_dx50 mmioFOURCC('d','x','5','0') 42 | #define FOURCC_mp4v mmioFOURCC('m','p','4','v') 43 | 44 | /* yuyu 4:2:2 16bit, y-u-y-v, packed*/ 45 | #define FOURCC_YUYV mmioFOURCC('Y','U','Y','V') 46 | #define FOURCC_YUY2 mmioFOURCC('Y','U','Y','2') 47 | /* yvyu 4:2:2 16bit, y-v-y-u, packed*/ 48 | #define FOURCC_YVYU mmioFOURCC('Y','V','Y','U') 49 | /* uyvy 4:2:2 16bit, u-y-v-y, packed */ 50 | #define FOURCC_UYVY mmioFOURCC('U','Y','V','Y') 51 | /* i420 y-u-v, planar */ 52 | #define FOURCC_I420 mmioFOURCC('I','4','2','0') 53 | #define FOURCC_IYUV mmioFOURCC('I','Y','U','V') 54 | /* yv12 y-v-u, planar */ 55 | #define FOURCC_YV12 mmioFOURCC('Y','V','1','2') 56 | 57 | 58 | typedef struct 59 | { 60 | CONFIG config; 61 | 62 | // decoder 63 | void * dhandle; 64 | 65 | // encoder 66 | void * ehandle; 67 | unsigned int fincr; 68 | unsigned int fbase; 69 | status_t status; 70 | 71 | /* encoder min keyframe internal */ 72 | int framenum; 73 | int keyspacing; 74 | 75 | HINSTANCE m_hdll; 76 | int (*xvid_global_func)(void *handle, int opt, void *param1, void *param2); 77 | int (*xvid_encore_func)(void *handle, int opt, void *param1, void *param2); 78 | int (*xvid_decore_func)(void *handle, int opt, void *param1, void *param2); 79 | 80 | xvid_plugin_func *xvid_plugin_single_func; 81 | xvid_plugin_func *xvid_plugin_2pass1_func; 82 | xvid_plugin_func *xvid_plugin_2pass2_func; 83 | xvid_plugin_func *xvid_plugin_lumimasking_func; 84 | xvid_plugin_func *xvid_plugin_psnr_func; 85 | 86 | } CODEC; 87 | 88 | 89 | 90 | LRESULT compress_query(CODEC *, BITMAPINFO *, BITMAPINFO *); 91 | LRESULT compress_get_format(CODEC *, BITMAPINFO *, BITMAPINFO *); 92 | LRESULT compress_get_size(CODEC *, BITMAPINFO *, BITMAPINFO *); 93 | LRESULT compress_frames_info(CODEC *, ICCOMPRESSFRAMES *); 94 | LRESULT compress_begin(CODEC *, BITMAPINFO *, BITMAPINFO *); 95 | LRESULT compress_end(CODEC *); 96 | LRESULT compress(CODEC *, ICCOMPRESS *); 97 | 98 | LRESULT decompress_query(CODEC *, BITMAPINFO *, BITMAPINFO *); 99 | LRESULT decompress_get_format(CODEC *, BITMAPINFO *, BITMAPINFO *); 100 | LRESULT decompress_begin(CODEC *, BITMAPINFO *, BITMAPINFO *); 101 | LRESULT decompress_end(CODEC *); 102 | LRESULT decompress(CODEC *, ICDECOMPRESS *); 103 | 104 | extern int pp_brightness, pp_dy, pp_duv, pp_fe, pp_dry, pp_druv; /* decoder options */ 105 | 106 | #endif /* _CODEC_H_ */ 107 | -------------------------------------------------------------------------------- /dshow/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Makefile for XviD DirectShow driver 4 | # 5 | # Adapted from XviD VFW driver makefile. 6 | # Modified by : Peter Ross 7 | # 8 | # Requires GNU Make because of shell expansion performed at a bad time with 9 | # other make programs (even using := variable assignments) 10 | # 11 | # $Id: Makefile,v 1.7 2008-11-27 11:57:51 Isibaar Exp $ 12 | ############################################################################## 13 | 14 | include sources.inc 15 | 16 | ############################################################################## 17 | # DXTREE must point to the directx sdk root directory. 18 | # 19 | # if a release prior to "directx v9.0 sdk update (summer 2003)" is installed, 20 | # uncomment the DXBASECLASSES=$(DXTREE)/Samples/MultiMedia/DirectShow/BaseClasses 21 | ############################################################################## 22 | DXTREE=/c/DX90SDK 23 | # DXTREE=/c/DXVCSDK 24 | DXBASECLASSES=$(DXTREE)/Samples/C++/DirectShow/BaseClasses 25 | # DXBASECLASSES=$(DXTREE)/Samples/MultiMedia/DirectShow/BaseClasses 26 | 27 | MAKEFILE_PWD:=$(shell pwd) 28 | LOCAL_XVID_SRCTREE:=$(MAKEFILE_PWD)/../src 29 | LOCAL_XVID_BUILDTREE:=$(MAKEFILE_PWD)/../build/generic/=build 30 | 31 | RM = rm -rf 32 | WINDRES=windres 33 | 34 | # Constants which should not be modified 35 | # The `mingw-runtime` package is required when building with -mno-cygwin 36 | CFLAGS += -mthreads 37 | CFLAGS += -I$(SRC_DIR)/w32api -I$(LOCAL_XVID_SRCTREE) 38 | CFLAGS += -mno-cygwin 39 | 40 | CXXFLAGS +=-mthreads 41 | CXXFLAGS += -DRELEASE \ 42 | -I$(LOCAL_XVID_SRCTREE) \ 43 | -I$(DXTREE)/Include \ 44 | -I$(DXBASECLASSES) \ 45 | -include $(DXTREE)/mingw_dshow_port.h 46 | CXXFLAGS += -mno-cygwin 47 | 48 | ############################################################################## 49 | # Optional Compiler options 50 | ############################################################################## 51 | 52 | CFLAGS += -Wall 53 | CFLAGS += -O2 54 | CFLAGS += -fstrength-reduce 55 | CFLAGS += -finline-functions 56 | CFLAGS += -fgcse 57 | CFLAGS += -ffast-math 58 | 59 | CXXFLAGS += -O2 60 | 61 | ############################################################################## 62 | # Compiler flags for linking stage 63 | ############################################################################## 64 | 65 | #LDFLAGS += 66 | 67 | ############################################################################## 68 | # Rules 69 | ############################################################################## 70 | 71 | OBJECTS = $(SRC_C:.c=.obj) 72 | OBJECTS+= $(SRC_CPP:.cpp=.obj) 73 | OBJECTS+= $(SRC_RES:.rc=.obj) 74 | 75 | .SUFFIXES: .obj .rc .c 76 | 77 | BUILD_DIR = =build 78 | VPATH = $(SRC_DIR):$(BUILD_DIR) 79 | 80 | all: $(LIBSO) 81 | 82 | $(BUILD_DIR): 83 | @echo " D: $(BUILD_DIR)" 84 | @mkdir -p $(BUILD_DIR) 85 | 86 | .rc.obj: 87 | @echo " W: $(@D)/$( 7 | ; * 2001-2003 Peter Ross 8 | ; * 2002-2003 Pascal Massimino 9 | ; * 10 | ; * This program is free software ; you can redistribute it and/or modify 11 | ; * it under the terms of the GNU General Public License as published by 12 | ; * the Free Software Foundation ; either version 2 of the License, or 13 | ; * (at your option) any later version. 14 | ; * 15 | ; * This program is distributed in the hope that it will be useful, 16 | ; * but WITHOUT ANY WARRANTY ; without even the implied warranty of 17 | ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | ; * GNU General Public License for more details. 19 | ; * 20 | ; * You should have received a copy of the GNU General Public License 21 | ; * along with this program ; if not, write to the Free Software 22 | ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | ; * 24 | ; * $Id: cbp_mmx.asm,v 1.19 2009-09-16 17:07:58 Isibaar Exp $ 25 | ; * 26 | ; ***************************************************************************/ 27 | 28 | ;============================================================================= 29 | ; Macros 30 | ;============================================================================= 31 | 32 | %include "nasm.inc" 33 | 34 | ;============================================================================= 35 | ; Local data 36 | ;============================================================================= 37 | 38 | DATA 39 | 40 | ALIGN SECTION_ALIGN 41 | 42 | mult_mask: 43 | db 0x10,0x20,0x04,0x08,0x01,0x02,0x00,0x00 44 | ignore_dc: 45 | dw 0, -1, -1, -1 46 | 47 | ;============================================================================= 48 | ; Code 49 | ;============================================================================= 50 | 51 | TEXT 52 | 53 | cglobal calc_cbp_mmx 54 | 55 | ;----------------------------------------------------------------------------- 56 | ; uint32_t calc_cbp_mmx(const int16_t coeff[6][64]); 57 | ;----------------------------------------------------------------------------- 58 | 59 | %macro MAKE_LOAD 2 60 | por mm0, [%2-128*1+%1*8] 61 | por mm1, [%2+128*0+%1*8] 62 | por mm2, [%2+128*1+%1*8] 63 | por mm3, [%2+128*2+%1*8] 64 | por mm4, [%2+128*3+%1*8] 65 | por mm5, [%2+128*4+%1*8] 66 | %endmacro 67 | 68 | ALIGN SECTION_ALIGN 69 | calc_cbp_mmx: 70 | mov _EAX, prm1 ; coeff 71 | 72 | movq mm7, [ignore_dc] 73 | pxor mm6, mm6 ; used only for comparing 74 | movq mm0, [_EAX+128*0] 75 | movq mm1, [_EAX+128*1] 76 | movq mm2, [_EAX+128*2] 77 | movq mm3, [_EAX+128*3] 78 | movq mm4, [_EAX+128*4] 79 | movq mm5, [_EAX+128*5] 80 | add _EAX, 8+128 81 | pand mm0, mm7 82 | pand mm1, mm7 83 | pand mm2, mm7 84 | pand mm3, mm7 85 | pand mm4, mm7 86 | pand mm5, mm7 87 | 88 | MAKE_LOAD 0, _EAX 89 | MAKE_LOAD 1, _EAX 90 | MAKE_LOAD 2, _EAX 91 | MAKE_LOAD 3, _EAX 92 | MAKE_LOAD 4, _EAX 93 | MAKE_LOAD 5, _EAX 94 | MAKE_LOAD 6, _EAX 95 | MAKE_LOAD 7, _EAX 96 | MAKE_LOAD 8, _EAX 97 | MAKE_LOAD 9, _EAX 98 | MAKE_LOAD 10, _EAX 99 | MAKE_LOAD 11, _EAX 100 | MAKE_LOAD 12, _EAX 101 | MAKE_LOAD 13, _EAX 102 | MAKE_LOAD 14, _EAX 103 | 104 | movq mm7, [mult_mask] 105 | packssdw mm0, mm1 106 | packssdw mm2, mm3 107 | packssdw mm4, mm5 108 | packssdw mm0, mm2 109 | packssdw mm4, mm6 110 | pcmpeqw mm0, mm6 111 | pcmpeqw mm4, mm6 112 | pcmpeqw mm0, mm6 113 | pcmpeqw mm4, mm6 114 | psrlw mm0, 15 115 | psrlw mm4, 15 116 | packuswb mm0, mm4 117 | pmaddwd mm0, mm7 118 | 119 | movq mm1, mm0 120 | psrlq mm1, 32 121 | paddusb mm0, mm1 122 | 123 | movd eax, mm0 124 | shr _EAX, 8 125 | and _EAX, 0x3F 126 | ret 127 | ENDFUNC 128 | 129 | NON_EXEC_STACK 130 | -------------------------------------------------------------------------------- /src/image/x86_asm/postprocessing_sse2.asm: -------------------------------------------------------------------------------- 1 | ;/***************************************************************************** 2 | ; * 3 | ; * XVID MPEG-4 VIDEO CODEC 4 | ; * - sse2 post processing - 5 | ; * 6 | ; * Copyright(C) 2004 Peter Ross 7 | ; * 2004 Dcoder 8 | ; * 9 | ; * Xvid is free software; you can redistribute it and/or modify it 10 | ; * under the terms of the GNU General Public License as published by 11 | ; * the Free Software Foundation; either version 2 of the License, or 12 | ; * (at your option) any later version. 13 | ; * 14 | ; * This program is distributed in the hope that it will be useful, 15 | ; * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ; * GNU General Public License for more details. 18 | ; * 19 | ; * You should have received a copy of the GNU General Public License 20 | ; * along with this program; if not, write to the Free Software 21 | ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | ; * 23 | ; *************************************************************************/ 24 | 25 | %include "nasm.inc" 26 | 27 | ;=========================================================================== 28 | ; read only data 29 | ;=========================================================================== 30 | 31 | DATA 32 | 33 | xmm_0x80: 34 | times 16 db 0x80 35 | 36 | ;============================================================================= 37 | ; Code 38 | ;============================================================================= 39 | 40 | TEXT 41 | 42 | cglobal image_brightness_sse2 43 | 44 | ;////////////////////////////////////////////////////////////////////// 45 | ;// image_brightness_sse2 46 | ;////////////////////////////////////////////////////////////////////// 47 | 48 | %macro CREATE_OFFSET_VECTOR 2 49 | mov [%1 + 0], %2 50 | mov [%1 + 1], %2 51 | mov [%1 + 2], %2 52 | mov [%1 + 3], %2 53 | mov [%1 + 4], %2 54 | mov [%1 + 5], %2 55 | mov [%1 + 6], %2 56 | mov [%1 + 7], %2 57 | mov [%1 + 8], %2 58 | mov [%1 + 9], %2 59 | mov [%1 + 10], %2 60 | mov [%1 + 11], %2 61 | mov [%1 + 12], %2 62 | mov [%1 + 13], %2 63 | mov [%1 + 14], %2 64 | mov [%1 + 15], %2 65 | %endmacro 66 | 67 | ALIGN SECTION_ALIGN 68 | image_brightness_sse2: 69 | %ifdef ARCH_IS_X86_64 70 | XVID_MOVSXD _EAX, prm5d 71 | %else 72 | mov eax, prm5 ; brightness offset value 73 | %endif 74 | mov TMP1, prm1 ; Dst 75 | mov TMP0, prm2 ; stride 76 | 77 | push _ESI 78 | push _EDI ; 8 bytes offset for push 79 | sub _ESP, 32 ; 32 bytes for local data (16bytes will be used, 16bytes more to align correctly mod 16) 80 | 81 | movdqa xmm2, [xmm_0x80] 82 | 83 | ; Create a offset...offset vector 84 | mov _ESI, _ESP ; TMP1 will be esp aligned mod 16 85 | add _ESI, 15 ; TMP1 = esp + 15 86 | and _ESI, ~15 ; TMP1 = (esp + 15)&(~15) 87 | CREATE_OFFSET_VECTOR _ESI, al 88 | movdqa xmm3, [_ESI] 89 | 90 | %ifdef ARCH_IS_X86_64 91 | mov _ESI, prm3 92 | mov _EDI, prm4 93 | %else 94 | mov _ESI, [_ESP+8+32+12] ; width 95 | mov _EDI, [_ESP+8+32+16] ; height 96 | %endif 97 | 98 | .yloop: 99 | xor _EAX, _EAX 100 | 101 | .xloop: 102 | movdqa xmm0, [TMP1 + _EAX] 103 | movdqa xmm1, [TMP1 + _EAX + 16] ; xmm0 = [dst] 104 | 105 | paddb xmm0, xmm2 ; unsigned -> signed domain 106 | paddb xmm1, xmm2 107 | paddsb xmm0, xmm3 108 | paddsb xmm1, xmm3 ; xmm0 += offset 109 | psubb xmm0, xmm2 110 | psubb xmm1, xmm2 ; signed -> unsigned domain 111 | 112 | movdqa [TMP1 + _EAX], xmm0 113 | movdqa [TMP1 + _EAX + 16], xmm1 ; [dst] = xmm0 114 | 115 | add _EAX,32 116 | cmp _EAX,_ESI 117 | jl .xloop 118 | 119 | add TMP1, TMP0 ; dst += stride 120 | dec _EDI 121 | jg .yloop 122 | 123 | add _ESP, 32 124 | pop _EDI 125 | pop _ESI 126 | 127 | ret 128 | ENDFUNC 129 | ;////////////////////////////////////////////////////////////////////// 130 | 131 | NON_EXEC_STACK 132 | -------------------------------------------------------------------------------- /src/utils/mem_align.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Aligned Memory Allocator - 5 | * 6 | * Copyright(C) 2002-2003 Edouard Gomez 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #include 27 | #include 28 | #include "mem_align.h" 29 | 30 | /***************************************************************************** 31 | * xvid_malloc 32 | * 33 | * This function allocates 'size' bytes (usable by the user) on the heap and 34 | * takes care of the requested 'alignment'. 35 | * In order to align the allocated memory block, the xvid_malloc allocates 36 | * 'size' bytes + 'alignment' bytes. So try to keep alignment very small 37 | * when allocating small pieces of memory. 38 | * 39 | * NB : a block allocated by xvid_malloc _must_ be freed with xvid_free 40 | * (the libc free will return an error) 41 | * 42 | * Returned value : - NULL on error 43 | * - Pointer to the allocated aligned block 44 | * 45 | ****************************************************************************/ 46 | 47 | void * 48 | xvid_malloc(size_t size, 49 | uint8_t alignment) 50 | { 51 | uint8_t *mem_ptr; 52 | 53 | if (!alignment) { 54 | 55 | /* We have not to satisfy any alignment */ 56 | if ((mem_ptr = (uint8_t *) malloc(size + 1)) != NULL) { 57 | 58 | /* Store (mem_ptr - "real allocated memory") in *(mem_ptr-1) */ 59 | *mem_ptr = (uint8_t)1; 60 | 61 | /* Return the mem_ptr pointer */ 62 | return ((void *)(mem_ptr+1)); 63 | } 64 | } else { 65 | uint8_t *tmp; 66 | 67 | /* Allocate the required size memory + alignment so we 68 | * can realign the data if necessary */ 69 | if ((tmp = (uint8_t *) malloc(size + alignment)) != NULL) { 70 | 71 | /* Align the tmp pointer */ 72 | mem_ptr = 73 | (uint8_t *) ((ptr_t) (tmp + alignment - 1) & 74 | (~(ptr_t) (alignment - 1))); 75 | 76 | /* Special case where malloc have already satisfied the alignment 77 | * We must add alignment to mem_ptr because we must store 78 | * (mem_ptr - tmp) in *(mem_ptr-1) 79 | * If we do not add alignment to mem_ptr then *(mem_ptr-1) points 80 | * to a forbidden memory space */ 81 | if (mem_ptr == tmp) 82 | mem_ptr += alignment; 83 | 84 | /* (mem_ptr - tmp) is stored in *(mem_ptr-1) so we are able to retrieve 85 | * the real malloc block allocated and free it in xvid_free */ 86 | *(mem_ptr - 1) = (uint8_t) (mem_ptr - tmp); 87 | 88 | /* Return the aligned pointer */ 89 | return ((void *)mem_ptr); 90 | } 91 | } 92 | 93 | return(NULL); 94 | } 95 | 96 | /***************************************************************************** 97 | * xvid_free 98 | * 99 | * Free a previously 'xvid_malloc' allocated block. Does not free NULL 100 | * references. 101 | * 102 | * Returned value : None. 103 | * 104 | ****************************************************************************/ 105 | 106 | void 107 | xvid_free(void *mem_ptr) 108 | { 109 | 110 | uint8_t *ptr; 111 | 112 | if (mem_ptr == NULL) 113 | return; 114 | 115 | /* Aligned pointer */ 116 | ptr = mem_ptr; 117 | 118 | /* *(ptr - 1) holds the offset to the real allocated block 119 | * we sub that offset os we free the real pointer */ 120 | ptr -= *(ptr - 1); 121 | 122 | /* Free the memory */ 123 | free(ptr); 124 | } 125 | -------------------------------------------------------------------------------- /dshow/dxpatch/dx90sdk-update-gcc.txt: -------------------------------------------------------------------------------- 1 | directx 9.0 software development kit update (summer 2003) 2 | gnu c compiler compatibility patch 3 | =============================================== 4 | 5 | this patch has been tested with: 6 | gcc v3.2.3 7 | gcc v3.3.3 8 | gcc v3.4.1 (linux->win32 cross compiler) 9 | msc v6.0 + sp5 + pp 10 | 11 | I) Applying the patch 12 | ------------------ 13 | 14 | 1. Install the directx sdk update to /c/DX90SDK (to match default 15 | Makefile variable values) or to any other dir. From now on, the 16 | sdk install directory will be called ${SDKDIR}. 17 | 18 | dx90updatesdk.exe 19 | size: 190,991,976 bytes 20 | md5: ed328da4033e18124801265ee91f690e 21 | 22 | 2. cd ${SDKDIR} 23 | 3. patch -p0 --dry-run < /path/to/dx90sdk-update-gcc.patch 24 | (if all goes well, no rejects... else read the special notes) 25 | patch -p0 < /path/to/dx90sdk-update-gcc.patch 26 | 27 | 28 | -- 29 | Special notes for cross compilation on GNU/Linux systems (or any 30 | supported platform for wine): 31 | - You can install the DX SDK using the wine win32 API emulation 32 | layer. The unzipping stage of the install will succeed, it's 33 | all that is required to continue. So don't panic if the install 34 | program breaks/crashes after the self unzip did succeed. 35 | - Then depending on your cvs program, you may require to unix'ify 36 | the endlines of all sources in the SDK before applying the patch. 37 | That can be required CVS uses to expand/replace endlines according 38 | to the host platform type, so it's very likely that if you do 39 | extract the xvidcore sources from a windows box, this step isn't 40 | mandatory, but if you're using a unix box (even cygwin), you may 41 | be obliged to proceed with: 42 | find ${SDKDIR} -name "*.cpp" -exec dos2unix {} \; 43 | find ${SDKDIR} -name "*.h" -exec dos2unix {} \; 44 | 45 | II) building strmbase.lib 46 | ------------------------- 47 | 48 | 1. cd ${SDKDIR}/Samples/C++/Directshow/BaseClasses 49 | 2. make 50 | (this should output strmbase.lib) 51 | 52 | -- 53 | Special notes for people cross compiling, or people who installed 54 | the SDK elsewhere than /c/DX90SDK: 55 | - you can overide Makefile defaults in the make command line, 56 | just use something like this command line (adapt according to 57 | your build environment): 58 | make \ 59 | CXX=/opt/mingw32-cross/bin/i386-mingw32-g++ \ 60 | RANLIB=/opt/mingw32-cross/bin/i386-mingw32-ranlib \ 61 | DXTREE=${SDKDIR} 62 | 63 | 64 | III) Building your own apps 65 | --------------------------- 66 | 67 | These variables should be defined in your Makefiles: 68 | 69 | DXTREE=${SDKTREE} 70 | DXBASECLASSES=$(DXTREE)/Samples/C++/DirectShow/BaseClasses 71 | CXXFLAGS += -DRELEASE \ 72 | -I$(DXTREE)/Include \ 73 | -I$(DXBASECLASSES) \ 74 | -include $(DXTREE)/mingw_dshow_port.h 75 | LDFLAGS += -L$(DXTREE)/Lib -lstrmiids \ 76 | $(DXBASECLASSES)/strmbase.lib \ 77 | -lole32 -loleaut32 -lstdc++ 78 | 79 | So it's now time to build the XviD Dshow filter (the xvidcore 80 | source dir is supposed to be ${xvidcore}): 81 | 82 | 1. cd ${xvidcore}/dshow 83 | 2. make 84 | (should output a xvid.ax file in a =build dir by default) 85 | 86 | -- 87 | Notes for people using a cross compiler, or people who did install 88 | the SDK elsewhere than /c/DX90SDK: 89 | - you can overide Makefile variables from the make command line, 90 | a fairly complete command could look like this, adapt to your 91 | build environment: 92 | make \ 93 | CC=/opt/mingw32-cross/bin/i386-mingw32-gcc \ 94 | CXX=/opt/mingw32-cross/bin/i386-mingw32-g++ \ 95 | WINDRES=/opt/mingw32-cross/bin/i386-mingw32-windres \ 96 | DXTREE=/mnt/data/windows/dx9sdk 97 | 98 | NB: with some win32-api headers from mingw.org, you may suffer 99 | multiple QACONTAINERFLAGS definitions. In that case you need 100 | to manually edit ${mingw_install}/include/ocidl.h; Search for 101 | QACONTAINERFLAGS. It should look like this: 102 | 103 | enum tagQACONTAINERFLAGS 104 | { 105 | ... 106 | } QACONTAINERFLAGS; 107 | 108 | Then change this to that: 109 | 110 | typedef enum tagQACONTAINERFLAGS 111 | { 112 | ... 113 | } QACONTAINERFLAGS; 114 | 115 | Noticed the additional typedef ? that's the point ! 116 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | This project provides additional functionality beyond what is provided by the project that it is based off. 4 | Ensure that any issues/pull requests submitted to this project are only for functionality that was provided by 5 | this project. Any issues/pull requests that are based off of the upstream project should be directed directly to them. 6 | 7 | When contributing a pull-request to this repository, please first discuss the change you wish to make via issue 8 | with the owners of this repository before making a change. Ensure that the change is only related to functionality 9 | provided by this project only. 10 | 11 | Please note we have a code of conduct, please follow it in all your interactions with the project. 12 | 13 | ## Submitting Changes 14 | 15 | Changes are excepted by submitting a pull request directly to the projects Github page. 16 | When creating the pull request the provided template should be used to ensure all required information is provided. 17 | 18 | ## Code of Conduct 19 | 20 | ### Our Pledge 21 | 22 | In the interest of fostering an open and welcoming environment, we as 23 | contributors and maintainers pledge to making participation in our project and 24 | our community a harassment-free experience for everyone, regardless of age, body 25 | size, disability, ethnicity, gender identity and expression, level of experience, 26 | nationality, personal appearance, race, religion, or sexual identity and 27 | orientation. 28 | 29 | ### Our Standards 30 | 31 | Examples of behavior that contributes to creating a positive environment 32 | include: 33 | 34 | * Using welcoming and inclusive language 35 | * Being respectful of differing viewpoints and experiences 36 | * Gracefully accepting constructive criticism 37 | * Focusing on what is best for the community 38 | * Showing empathy towards other community members 39 | 40 | Examples of unacceptable behavior by participants include: 41 | 42 | * The use of sexualized language or imagery and unwelcome sexual attention or 43 | advances 44 | * Trolling, insulting/derogatory comments, and personal or political attacks 45 | * Public or private harassment 46 | * Publishing others' private information, such as a physical or electronic 47 | address, without explicit permission 48 | * Other conduct which could reasonably be considered inappropriate in a 49 | professional setting 50 | 51 | ### Our Responsibilities 52 | 53 | Project maintainers are responsible for clarifying the standards of acceptable 54 | behavior and are expected to take appropriate and fair corrective action in 55 | response to any instances of unacceptable behavior. 56 | 57 | Project maintainers have the right and responsibility to remove, edit, or 58 | reject comments, commits, code, wiki edits, issues, and other contributions 59 | that are not aligned to this Code of Conduct, or to ban temporarily or 60 | permanently any contributor for other behaviors that they deem inappropriate, 61 | threatening, offensive, or harmful. 62 | 63 | ### Scope 64 | 65 | This Code of Conduct applies both within project spaces and in public spaces 66 | when an individual is representing the project or its community. Examples of 67 | representing a project or community include using an official project e-mail 68 | address, posting via an official social media account, or acting as an appointed 69 | representative at an online or offline event. Representation of a project may be 70 | further defined and clarified by project maintainers. 71 | 72 | ### Enforcement 73 | 74 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 75 | reported by contacting the project team. All 76 | complaints will be reviewed and investigated and will result in a response that 77 | is deemed necessary and appropriate to the circumstances. The project team is 78 | obligated to maintain confidentiality with regard to the reporter of an incident. 79 | Further details of specific enforcement policies may be posted separately. 80 | 81 | Project maintainers who do not follow or enforce the Code of Conduct in good 82 | faith may face temporary or permanent repercussions as determined by other 83 | members of the project's leadership. 84 | 85 | ### Attribution 86 | 87 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 88 | available at [http://contributor-covenant.org/version/1/4][version] 89 | 90 | [homepage]: http://contributor-covenant.org 91 | [version]: http://contributor-covenant.org/version/1/4/ -------------------------------------------------------------------------------- /src/image/image.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Image related header - 5 | * 6 | * Copyright(C) 2001-2010 Peter Ross 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _IMAGE_H_ 27 | #define _IMAGE_H_ 28 | 29 | #include 30 | 31 | #include "../portab.h" 32 | #include "../global.h" 33 | #include "colorspace.h" 34 | #include "../xvid.h" 35 | 36 | #define EDGE_SIZE 64 37 | 38 | void init_image(uint32_t cpu_flags); 39 | 40 | 41 | static void __inline 42 | image_null(IMAGE * image) 43 | { 44 | image->y = image->u = image->v = NULL; 45 | } 46 | 47 | int32_t image_create(IMAGE * image, 48 | uint32_t edged_width, 49 | uint32_t edged_height); 50 | void image_destroy(IMAGE * image, 51 | uint32_t edged_width, 52 | uint32_t edged_height); 53 | 54 | void image_swap(IMAGE * image1, 55 | IMAGE * image2); 56 | 57 | void image_copy(IMAGE * image1, 58 | IMAGE * image2, 59 | uint32_t edged_width, 60 | uint32_t height); 61 | 62 | void image_setedges(IMAGE * image, 63 | uint32_t edged_width, 64 | uint32_t edged_height, 65 | uint32_t width, 66 | uint32_t height, 67 | int bs_version); 68 | 69 | void image_interpolate(const uint8_t * refn, 70 | uint8_t * refh, 71 | uint8_t * refv, 72 | uint8_t * refhv, 73 | uint32_t edged_width, 74 | uint32_t edged_height, 75 | uint32_t quarterpel, 76 | uint32_t rounding); 77 | 78 | float image_psnr(IMAGE * orig_image, 79 | IMAGE * recon_image, 80 | uint16_t stride, 81 | uint16_t width, 82 | uint16_t height); 83 | 84 | 85 | float sse_to_PSNR(long sse, int pixels); 86 | 87 | long plane_sse(uint8_t * orig, 88 | uint8_t * recon, 89 | uint16_t stride, 90 | uint16_t width, 91 | uint16_t height); 92 | 93 | void 94 | image_chroma_optimize(IMAGE * img, int width, int height, int edged_width); 95 | 96 | 97 | int image_input(IMAGE * image, 98 | uint32_t width, 99 | int height, 100 | uint32_t edged_width, 101 | uint8_t * src[4], 102 | int src_stride[4], 103 | int csp, 104 | int interlaced); 105 | 106 | int image_output(IMAGE * image, 107 | uint32_t width, 108 | int height, 109 | uint32_t edged_width, 110 | uint8_t * dst[4], 111 | int dst_stride[4], 112 | int csp, 113 | int interlaced); 114 | 115 | 116 | 117 | int image_dump_yuvpgm(const IMAGE * image, 118 | const uint32_t edged_width, 119 | const uint32_t width, 120 | const uint32_t height, 121 | char *filename); 122 | 123 | float image_mad(const IMAGE * img1, 124 | const IMAGE * img2, 125 | uint32_t stride, 126 | uint32_t width, 127 | uint32_t height); 128 | 129 | void 130 | output_slice(IMAGE * cur, int stride, int width, xvid_image_t* out_frm, int mbx, int mby,int mbl); 131 | 132 | 133 | void 134 | image_clear(IMAGE * img, int width, int height, int edged_width, 135 | int y, int u, int v); 136 | 137 | 138 | void image_block_variance(IMAGE * orig_image, uint16_t stride, MACROBLOCK *mbs, 139 | uint16_t mb_width, uint16_t mb_height); 140 | 141 | void 142 | image_deblock_rrv(IMAGE * img, int edged_width, 143 | const MACROBLOCK * mbs, int mb_width, int mb_height, int mb_stride, 144 | int block, int flags); 145 | 146 | 147 | /* helper function: deinterlace image. 148 | Only for YUV 4:2:0 planar format. Use bottom_first!=0 if main 149 | field is the bottom one. 150 | returns 1 if everything went ok, 0 otherwise. */ 151 | extern int xvid_image_deinterlace(xvid_image_t* img, int width, int height, int bottom_first); 152 | 153 | #endif /* _IMAGE_H_ */ 154 | -------------------------------------------------------------------------------- /src/motion/ia64_asm/calc_delta_2.s: -------------------------------------------------------------------------------- 1 | // **************************************************************************** 2 | // * 3 | // * XVID MPEG-4 VIDEO CODEC 4 | // * - IA64 halfpel refinement - 5 | // * 6 | // * Copyright(C) 2002 Johannes Singler, Daniel Winkler 7 | // * 8 | // * This program is free software; you can redistribute it and/or modify it 9 | // * under the terms of the GNU General Public License as published by 10 | // * the Free Software Foundation; either version 2 of the License, or 11 | // * (at your option) any later version. 12 | // * 13 | // * This program is distributed in the hope that it will be useful, 14 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // * GNU General Public License for more details. 17 | // * 18 | // * You should have received a copy of the GNU General Public License 19 | // * along with this program; if not, write to the Free Software 20 | // * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | // * 22 | // * $Id: calc_delta_2.s,v 1.2 2009-02-19 17:07:29 Isibaar Exp $ 23 | // * 24 | // ***************************************************************************/ 25 | // 26 | // **************************************************************************** 27 | // * 28 | // * calc_delta_2.s, IA-64 halfpel refinement 29 | // * 30 | // * This version was implemented during an IA-64 practical training at 31 | // * the University of Karlsruhe (http://i44w3.info.uni-karlsruhe.de/) 32 | // * 33 | // **************************************************************************** 34 | 35 | (non0_2) mov sc[0] = 1 36 | (non0_3) mov sc[1] = 1 37 | ;; 38 | add mpr[0] = mpr[0], mpr[1] 39 | (non0_2) shl sc[0] = sc[0], iFcode 40 | add mpr[2] = mpr[2], mpr[3] 41 | (non0_3) shl sc[1] = sc[1], iFcode 42 | add mpr[4] = mpr[4], mpr[5] 43 | add mpr[6] = mpr[6], mpr[7] 44 | ;; 45 | (non0_2) add sc[0] = -1, sc[0] 46 | (non0_3) add sc[1] = -1, sc[1] 47 | mov ret0 = 2 48 | ;; 49 | (non0_2) add component[0] = component[0], sc[0] 50 | (non0_3) add component[1] = component[1], sc[1] 51 | ;; 52 | (non0_2) shr component[0] = component[0], iFcode 53 | (non0_3) shr component[1] = component[1], iFcode 54 | add mpr[0] = mpr[0], mpr[2] 55 | add mpr[4] = mpr[4], mpr[6] 56 | ;; 57 | (non0_2) cmp.lt cg32_0, p0 = 32, component[0] 58 | (non0_3) cmp.lt cg32_1, p0 = 32, component[1] 59 | ;; 60 | (cg32_0) mov component[0] = 32 61 | (cg32_1) mov component[1] = 32 62 | ;; 63 | (non0_2) addl tabaddress[0] = @gprel(mvtab#), gp 64 | (non0_3) addl tabaddress[1] = @gprel(mvtab#), gp 65 | ;; 66 | (non0_2) shladd tabaddress[0] = component[0], 2, tabaddress[0] 67 | (non0_3) shladd tabaddress[1] = component[1], 2, tabaddress[1] 68 | ;; 69 | (non0_2) ld4 sc[0] = [tabaddress[0]] 70 | (non0_3) ld4 sc[1] = [tabaddress[1]] 71 | mov component[0] = dx 72 | mov component[1] = dy 73 | cmp.ne non0_0, p0 = 0, dx 74 | cmp.gt neg_0, p0 = 0, dx 75 | .pred.rel "mutex", p30, p34 //non0_0, neg_0 76 | 77 | cmp.ne non0_1, p0 = 0, dy 78 | cmp.gt neg_1, p0 = 0, dy 79 | ;; 80 | .pred.rel "mutex", p31, p35 //non0_1, neg_1 81 | 82 | (non0_2) add sc[0] = iFcode, sc[0] 83 | (non0_3) add sc[1] = iFcode, sc[1] 84 | ;; 85 | (non0_2) add ret0 = ret0, sc[0] 86 | (neg_0) sub component[0] = 0, component[0] //abs 87 | (neg_1) sub component[1] = 0, component[1] //abs 88 | ;; 89 | (non0_3) add ret0 = ret0, sc[1] 90 | add iSAD = mpr[0], mpr[4] 91 | ;; 92 | 93 | .explicit 94 | {.mii 95 | setf.sig fmv = ret0 96 | (non0_0) mov sc[0] = 1 97 | (non0_1) mov sc[1] = 1 98 | ;; 99 | } 100 | {.mfb 101 | xmpy.l fmv = fmv, fQuant 102 | } 103 | {.mii 104 | (non0_0) shl sc[0] = sc[0], iFcode 105 | (non0_1) shl sc[1] = sc[1], iFcode 106 | ;; 107 | } 108 | 109 | .default 110 | 111 | (non0_0) add sc[0] = -1, sc[0] 112 | (non0_1) add sc[1] = -1, sc[1] 113 | ;; 114 | (non0_0) add component[0] = component[0], sc[0] 115 | (non0_1) add component[1] = component[1], sc[1] 116 | ;; 117 | (non0_0) shr component[0] = component[0], iFcode 118 | (non0_1) shr component[1] = component[1], iFcode 119 | ;; 120 | (non0_0) cmp.lt cg32_0, p0 = 32, component[0] 121 | (non0_1) cmp.lt cg32_1, p0 = 32, component[1] 122 | ;; 123 | (cg32_0) mov component[0] = 32 124 | (cg32_1) mov component[1] = 32 125 | ;; 126 | (non0_0) addl tabaddress[0] = @gprel(mvtab#), gp 127 | (non0_1) addl tabaddress[1] = @gprel(mvtab#), gp 128 | ;; 129 | (non0_0) shladd tabaddress[0] = component[0], 2, tabaddress[0] 130 | (non0_1) shladd tabaddress[1] = component[1], 2, tabaddress[1] 131 | getf.sig ret0 = fmv 132 | ;; 133 | (non0_0) ld4 sc[0] = [tabaddress[0]] 134 | (non0_1) ld4 sc[1] = [tabaddress[1]] 135 | add mpr[8] = mpr[8], ret0 136 | ;; 137 | -------------------------------------------------------------------------------- /src/quant/quant_matrix.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Quantization matrix management code - 5 | * 6 | * Copyright(C) 2002 Michael Militzer 7 | * 2002 Peter Ross 8 | * 9 | * This program is free software ; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation ; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program ; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | * 23 | * $Id$ 24 | * 25 | ****************************************************************************/ 26 | 27 | #include "../global.h" 28 | #include "quant_matrix.h" 29 | 30 | #define FIX(X) (((X)==1) ? 0xFFFF : ((1UL << 16) / (X) + 1)) 31 | #define FIXL(X) ((1UL << 16) / (X) - 1) 32 | 33 | /***************************************************************************** 34 | * Default matrices 35 | ****************************************************************************/ 36 | 37 | static const uint8_t default_intra_matrix[64] = { 38 | 8, 17, 18, 19, 21, 23, 25, 27, 39 | 17, 18, 19, 21, 23, 25, 27, 28, 40 | 20, 21, 22, 23, 24, 26, 28, 30, 41 | 21, 22, 23, 24, 26, 28, 30, 32, 42 | 22, 23, 24, 26, 28, 30, 32, 35, 43 | 23, 24, 26, 28, 30, 32, 35, 38, 44 | 25, 26, 28, 30, 32, 35, 38, 41, 45 | 27, 28, 30, 32, 35, 38, 41, 45 46 | }; 47 | 48 | static const uint8_t default_inter_matrix[64] = { 49 | 16, 17, 18, 19, 20, 21, 22, 23, 50 | 17, 18, 19, 20, 21, 22, 23, 24, 51 | 18, 19, 20, 21, 22, 23, 24, 25, 52 | 19, 20, 21, 22, 23, 24, 26, 27, 53 | 20, 21, 22, 23, 25, 26, 27, 28, 54 | 21, 22, 23, 24, 26, 27, 28, 30, 55 | 22, 23, 24, 26, 27, 28, 30, 31, 56 | 23, 24, 25, 27, 28, 30, 31, 33 57 | }; 58 | 59 | const uint16_t * 60 | get_intra_matrix(const uint16_t * mpeg_quant_matrices) 61 | { 62 | return(mpeg_quant_matrices + 0*64); 63 | } 64 | 65 | const uint16_t * 66 | get_inter_matrix(const uint16_t * mpeg_quant_matrices) 67 | { 68 | return(mpeg_quant_matrices + 4*64); 69 | } 70 | 71 | const uint8_t * 72 | get_default_intra_matrix(void) 73 | { 74 | return default_intra_matrix; 75 | } 76 | 77 | const uint8_t * 78 | get_default_inter_matrix(void) 79 | { 80 | return default_inter_matrix; 81 | } 82 | 83 | int 84 | is_custom_intra_matrix(const uint16_t * mpeg_quant_matrices) 85 | { 86 | int i; 87 | const uint16_t *intra_matrix = get_intra_matrix(mpeg_quant_matrices); 88 | const uint8_t *def_intra_matrix = get_default_intra_matrix(); 89 | 90 | for (i = 0; i < 64; i++) { 91 | if(intra_matrix[i] != def_intra_matrix[i]) 92 | return 1; 93 | } 94 | return 0; 95 | } 96 | 97 | int 98 | is_custom_inter_matrix(const uint16_t * mpeg_quant_matrices) 99 | { 100 | int i; 101 | const uint16_t *inter_matrix = get_inter_matrix(mpeg_quant_matrices); 102 | const uint8_t *def_inter_matrix = get_default_inter_matrix(); 103 | 104 | for (i = 0; i < 64; i++) { 105 | if(inter_matrix[i] != (uint16_t)def_inter_matrix[i]) 106 | return 1; 107 | } 108 | return 0; 109 | } 110 | 111 | void 112 | set_intra_matrix(uint16_t * mpeg_quant_matrices, const uint8_t * matrix) 113 | { 114 | int i; 115 | uint16_t *intra_matrix = mpeg_quant_matrices + 0*64; 116 | 117 | for (i = 0; i < 64; i++) { 118 | intra_matrix[i] = (!i) ? (uint16_t)8: (uint16_t)MAX(1, matrix[i]); 119 | } 120 | } 121 | 122 | void 123 | init_intra_matrix(uint16_t * mpeg_quant_matrices, uint32_t quant) 124 | { 125 | int i; 126 | uint16_t *intra_matrix = mpeg_quant_matrices + 0*64; 127 | uint16_t *intra_matrix_rec = mpeg_quant_matrices + 1*64; 128 | 129 | for (i = 0; i < 64; i++) { 130 | uint32_t div = intra_matrix[i]*quant; 131 | intra_matrix_rec[i] = ((uint32_t)((1<>1)))/div; 132 | } 133 | } 134 | 135 | void 136 | set_inter_matrix(uint16_t * mpeg_quant_matrices, const uint8_t * matrix) 137 | { 138 | int i; 139 | uint16_t *inter_matrix = mpeg_quant_matrices + 4*64; 140 | uint16_t *inter_matrix1 = mpeg_quant_matrices + 5*64; 141 | uint16_t *inter_matrix_fix = mpeg_quant_matrices + 6*64; 142 | uint16_t *inter_matrix_fixl = mpeg_quant_matrices + 7*64; 143 | 144 | for (i = 0; i < 64; i++) { 145 | inter_matrix1[i] = ((inter_matrix[i] = (int16_t)MAX(1, matrix[i])) >> 1); 146 | inter_matrix1[i] += ((inter_matrix[i] == 1) ? 1: 0); 147 | inter_matrix_fix[i] = (uint16_t) FIX(inter_matrix[i]); 148 | inter_matrix_fixl[i] = (uint16_t) FIXL(inter_matrix[i]); 149 | } 150 | } 151 | 152 | void 153 | init_mpeg_matrix(uint16_t * mpeg_quant_matrices) { 154 | 155 | set_intra_matrix(mpeg_quant_matrices, default_intra_matrix); 156 | set_inter_matrix(mpeg_quant_matrices, default_inter_matrix); 157 | } 158 | -------------------------------------------------------------------------------- /src/decoder.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Decoder related header - 5 | * 6 | * Copyright(C) 2002-2010 Peter Ross 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _DECODER_H_ 27 | #define _DECODER_H_ 28 | 29 | #include "xvid.h" 30 | #include "portab.h" 31 | #include "global.h" 32 | #include "image/image.h" 33 | #include "image/postprocessing.h" 34 | 35 | /***************************************************************************** 36 | * Structures 37 | ****************************************************************************/ 38 | 39 | /* complexity estimation toggles */ 40 | typedef struct 41 | { 42 | int method; 43 | 44 | int opaque; 45 | int transparent; 46 | int intra_cae; 47 | int inter_cae; 48 | int no_update; 49 | int upsampling; 50 | 51 | int intra_blocks; 52 | int inter_blocks; 53 | int inter4v_blocks; 54 | int gmc_blocks; 55 | int not_coded_blocks; 56 | 57 | int dct_coefs; 58 | int dct_lines; 59 | int vlc_symbols; 60 | int vlc_bits; 61 | 62 | int apm; 63 | int npm; 64 | int interpolate_mc_q; 65 | int forw_back_mc_q; 66 | int halfpel2; 67 | int halfpel4; 68 | 69 | int sadct; 70 | int quarterpel; 71 | } ESTIMATION; 72 | 73 | 74 | typedef struct 75 | { 76 | /* vol bitstream */ 77 | 78 | int time_inc_resolution; 79 | int fixed_time_inc; 80 | uint32_t time_inc_bits; 81 | 82 | uint32_t shape; 83 | int ver_id; 84 | uint32_t quant_bits; 85 | uint32_t quant_type; 86 | uint16_t *mpeg_quant_matrices; 87 | int32_t quarterpel; 88 | int32_t cartoon_mode; 89 | int complexity_estimation_disable; 90 | ESTIMATION estimation; 91 | 92 | int interlacing; 93 | uint32_t top_field_first; 94 | uint32_t alternate_vertical_scan; 95 | 96 | int aspect_ratio; 97 | int par_width; 98 | int par_height; 99 | 100 | int sprite_enable; 101 | int sprite_warping_points; 102 | int sprite_warping_accuracy; 103 | int sprite_brightness_change; 104 | 105 | int newpred_enable; 106 | int reduced_resolution_enable; 107 | 108 | /* The bitstream version if it's a Xvid stream */ 109 | int bs_version; 110 | 111 | /* image */ 112 | 113 | int fixed_dimensions; 114 | uint32_t width; 115 | uint32_t height; 116 | uint32_t edged_width; 117 | uint32_t edged_height; 118 | 119 | IMAGE cur; 120 | IMAGE refn[2]; /* 0 -- last I or P VOP */ 121 | /* 1 -- first I or P */ 122 | IMAGE tmp; /* bframe interpolation, and post processing tmp buffer */ 123 | IMAGE qtmp; /* quarter pel tmp buffer */ 124 | 125 | /* postprocessing */ 126 | XVID_POSTPROC postproc; 127 | 128 | /* macroblock */ 129 | 130 | uint32_t mb_width; 131 | uint32_t mb_height; 132 | MACROBLOCK *mbs; 133 | 134 | /* 135 | * for B-frame & low_delay==0 136 | * XXX: should move frame based stuff into a DECODER_FRAMEINFO struct 137 | */ 138 | MACROBLOCK *last_mbs; /* last MB */ 139 | int last_coding_type; /* last coding type value */ 140 | int last_reduced_resolution; /* last reduced_resolution value */ 141 | int32_t frames; /* total frame number */ 142 | int32_t packed_mode; /* bframes packed bitstream? (1 = yes) */ 143 | int8_t scalability; 144 | VECTOR p_fmv, p_bmv; /* pred forward & backward motion vector */ 145 | int64_t time; /* for record time */ 146 | int64_t time_base; 147 | int64_t last_time_base; 148 | int64_t last_non_b_time; 149 | int32_t time_pp; 150 | int32_t time_bp; 151 | uint32_t low_delay; /* low_delay flage (1 means no B_VOP) */ 152 | uint32_t low_delay_default; /* default value for low_delay flag */ 153 | 154 | /* for GMC: central place for all parameters */ 155 | 156 | IMAGE gmc; /* gmc tmp buffer, remove for blockbased compensation */ 157 | GMC_DATA gmc_data; 158 | NEW_GMC_DATA new_gmc_data; 159 | 160 | xvid_image_t* out_frm; /* This is used for slice rendering */ 161 | 162 | int * qscale; /* quantization table for decoder's stats */ 163 | 164 | /* Tells if the reference image is edged or not */ 165 | int is_edged[2]; 166 | 167 | int num_threads; 168 | } 169 | DECODER; 170 | 171 | /***************************************************************************** 172 | * Decoder prototypes 173 | ****************************************************************************/ 174 | 175 | void init_decoder(uint32_t cpu_flags); 176 | 177 | int decoder_create(xvid_dec_create_t * param); 178 | int decoder_destroy(DECODER * dec); 179 | int decoder_decode(DECODER * dec, 180 | xvid_dec_frame_t * frame, xvid_dec_stats_t * stats); 181 | 182 | 183 | #endif 184 | -------------------------------------------------------------------------------- /src/motion/motion_inlines.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Motion Estimation shared functions - 5 | * 6 | * Copyright(C) 2002 Christoph Lampert 7 | * 2002 Michael Militzer 8 | * 2002-2003 Radoslaw Czyz 9 | * 10 | * This program is free software ; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation ; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program ; if not, write to the Free Software 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | * 24 | * $Id$ 25 | * 26 | ****************************************************************************/ 27 | 28 | #ifndef _MOTION_INLINES_ 29 | #define _MOTION_INLINES_ 30 | 31 | #include 32 | 33 | /* 34 | * Calculate the min/max range 35 | * relative to the _MACROBLOCK_ position 36 | */ 37 | static void __inline 38 | get_range(int32_t * const min_dx, 39 | int32_t * const max_dx, 40 | int32_t * const min_dy, 41 | int32_t * const max_dy, 42 | const uint32_t x, 43 | const uint32_t y, 44 | uint32_t block_sz, /* block dimension, 3(8) or 4(16) */ 45 | const uint32_t width, 46 | const uint32_t height, 47 | const int fcode, 48 | const int precision) /* 2 for qpel, 1 for halfpel */ 49 | { 50 | int k; 51 | const int search_range = 1 << (4+fcode); 52 | int high = search_range - 1; 53 | int low = -search_range; 54 | 55 | k = (int)(width - (x<>= (iFcode - 1); 90 | bits += r_mvtab[x+64]; 91 | 92 | y -= pred.y; 93 | bits += (y != 0 ? iFcode:0); 94 | y = -abs(y); 95 | y >>= (iFcode - 1); 96 | bits += r_mvtab[y+64]; 97 | 98 | return bits; 99 | } 100 | 101 | static __inline const uint8_t * 102 | GetReference(const int x, const int y, const SearchData * const data) 103 | { 104 | const int picture = ((x&1)<<1) | (y&1); 105 | const int offset = (x>>1) + (y>>1)*data->iEdgedWidth; 106 | return data->RefP[picture] + offset; 107 | } 108 | 109 | static __inline const uint8_t * 110 | GetReferenceB(const int x, const int y, const uint32_t dir, const SearchData * const data) 111 | { 112 | /* dir : 0 = forward, 1 = backward */ 113 | const uint8_t *const *const direction = ( dir == 0 ? data->RefP : data->b_RefP ); 114 | const int picture = ((x&1)<<1) | (y&1); 115 | const int offset = (x>>1) + (y>>1)*data->iEdgedWidth; 116 | return direction[picture] + offset; 117 | } 118 | 119 | static __inline void 120 | ZeroMacroblockP(MACROBLOCK *pMB, const int32_t sad) 121 | { 122 | pMB->mode = MODE_INTER; 123 | pMB->mvs[0] = pMB->mvs[1] = pMB->mvs[2] = pMB->mvs[3] = zeroMV; 124 | pMB->qmvs[0] = pMB->qmvs[1] = pMB->qmvs[2] = pMB->qmvs[3] = zeroMV; 125 | pMB->sad16 = pMB->sad8[0] = pMB->sad8[1] = pMB->sad8[2] = pMB->sad8[3] = sad; 126 | pMB->mcsel = 0; 127 | pMB->cbp = 0; 128 | } 129 | 130 | /* check if given vector is equal to any vector checked before */ 131 | static __inline int 132 | vector_repeats(const VECTOR * const pmv, const unsigned int i) 133 | { 134 | unsigned int j; 135 | for (j = 0; j < i; j++) 136 | if (MVequal(pmv[i], pmv[j])) return 1; /* same vector has been checked already */ 137 | return 0; 138 | } 139 | 140 | /* make a binary mask that prevents diamonds/squares 141 | from checking a vector which has been checked as a prediction */ 142 | static __inline int 143 | make_mask(const VECTOR * const pmv, const unsigned int i, const unsigned int current) 144 | { 145 | unsigned int mask = 255, j; 146 | for (j = 0; j < i; j++) { 147 | if (pmv[current].x == pmv[j].x) { 148 | if (pmv[current].y == pmv[j].y + iDiamondSize) mask &= ~4; 149 | else if (pmv[current].y == pmv[j].y - iDiamondSize) mask &= ~8; 150 | } else 151 | if (pmv[current].y == pmv[j].y) { 152 | if (pmv[current].x == pmv[j].x + iDiamondSize) mask &= ~1; 153 | else if (pmv[current].x == pmv[j].x - iDiamondSize) mask &= ~2; 154 | } 155 | } 156 | return mask; 157 | } 158 | 159 | #endif /* _MOTION_INLINES_ */ 160 | -------------------------------------------------------------------------------- /src/nasm.inc: -------------------------------------------------------------------------------- 1 | ;/**************************************************************************** 2 | ; * 3 | ; * XVID MPEG-4 VIDEO CODEC 4 | ; * - NASM common header - 5 | ; * 6 | ; * Copyright (C) 2008 Michael Militzer 7 | ; * 8 | ; * This program is free software ; you can redistribute it and/or modify 9 | ; * it under the terms of the GNU General Public License as published by 10 | ; * the Free Software Foundation ; either version 2 of the License, or 11 | ; * (at your option) any later version. 12 | ; * 13 | ; * This program is distributed in the hope that it will be useful, 14 | ; * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ; * GNU General Public License for more details. 17 | ; * 18 | ; * You should have received a copy of the GNU General Public License 19 | ; * along with this program ; if not, write to the Free Software 20 | ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | ; * 22 | ; * $Id: nasm.inc,v 1.7.2.2 2011-02-25 12:40:25 Isibaar Exp $ 23 | ; * 24 | ; ***************************************************************************/ 25 | 26 | %ifdef ARCH_IS_X86_64 27 | 28 | BITS 64 29 | DEFAULT REL 30 | 31 | %define SECTION_ALIGN 32 32 | 33 | %ifdef WINDOWS 34 | 35 | %define prm1 rcx 36 | %define prm2 rdx 37 | %define prm3 r8 38 | %define prm4 r9 39 | %define prm5 [rsp+40] 40 | %define prm6 [rsp+48] 41 | %define prm7 [rsp+56] 42 | %define prm8 [rsp+64] 43 | 44 | %define prm1d ecx 45 | %define prm2d edx 46 | %define prm3d r8d 47 | %define prm4d r9d 48 | %define prm5d dword prm5 49 | %define prm6d dword prm6 50 | %define prm7d dword prm7 51 | %define prm8d dword prm8 52 | 53 | %macro PUSH_XMM6_XMM7 0 54 | movdqa [_ESP+PTR_SIZE], xmm6 55 | movdqa [_ESP+PTR_SIZE+16], xmm7 56 | %endmacro 57 | 58 | %macro POP_XMM6_XMM7 0 59 | movdqa xmm6, [_ESP+PTR_SIZE] 60 | movdqa xmm7, [_ESP+PTR_SIZE+16] 61 | %endmacro 62 | 63 | %else ; Linux 64 | 65 | %define prm1 rdi 66 | %define prm2 rsi 67 | %define prm3 rdx 68 | %define prm4 rcx 69 | %define prm5 r8 70 | %define prm6 r9 71 | %define prm7 [rsp+8] 72 | %define prm8 [rsp+16] 73 | 74 | %define prm1d edi 75 | %define prm2d esi 76 | %define prm3d edx 77 | %define prm4d ecx 78 | %define prm5d r8d 79 | %define prm6d r9d 80 | %define prm7d dword prm7 81 | %define prm8d dword prm8 82 | 83 | %define PUSH_XMM6_XMM7 84 | %define POP_XMM6_XMM7 85 | 86 | %endif 87 | 88 | %define _EAX rax 89 | %define _EBX rbx 90 | %define _ECX rcx 91 | %define _EDX rdx 92 | %define _ESI rsi 93 | %define _EDI rdi 94 | %define _EBP rbp 95 | %define _ESP rsp 96 | 97 | %define TMP0 r10 98 | %define TMP1 r11 99 | 100 | %define TMP0d r10d 101 | %define TMP1d r11d 102 | 103 | %define PTR_SIZE 8 104 | %define PTR_TYPE qword 105 | 106 | %ifdef __YASM_VERSION_ID__ 107 | %define XVID_MOVSXD movsxd 108 | %else 109 | %define XVID_MOVSXD movsx 110 | %endif 111 | 112 | %else 113 | 114 | %define SECTION_ALIGN 16 115 | 116 | BITS 32 117 | 118 | %define prm1 [esp + 4] 119 | %define prm2 [esp + 8] 120 | %define prm3 [esp + 12] 121 | %define prm4 [esp + 16] 122 | %define prm5 [esp + 20] 123 | %define prm6 [esp + 24] 124 | %define prm7 [esp + 28] 125 | %define prm8 [esp + 32] 126 | 127 | %define prm1d dword prm1 128 | %define prm2d dword prm2 129 | %define prm3d dword prm3 130 | %define prm4d dword prm4 131 | %define prm5d dword prm5 132 | %define prm6d dword prm6 133 | %define prm7d dword prm7 134 | %define prm8d dword prm8 135 | 136 | %define _EAX eax 137 | %define _EBX ebx 138 | %define _ECX ecx 139 | %define _EDX edx 140 | %define _ESI esi 141 | %define _EDI edi 142 | %define _EBP ebp 143 | %define _ESP esp 144 | 145 | %define TMP0 ecx 146 | %define TMP1 edx 147 | 148 | %define TMP0d ecx 149 | %define TMP1d edx 150 | 151 | %define PTR_SIZE 4 152 | %define PTR_TYPE dword 153 | 154 | %define PUSH_XMM6_XMM7 155 | %define POP_XMM6_XMM7 156 | 157 | %define XVID_MOVSXD movsx 158 | %endif 159 | 160 | 161 | %ifdef WINDOWS 162 | %define PREFIX 163 | %endif 164 | 165 | %ifdef NO_PREFIX 166 | %undef PREFIX 167 | %endif 168 | 169 | %macro DATA 0 170 | %ifdef FORMAT_COFF 171 | SECTION .rodata 172 | %else 173 | SECTION .rodata align=SECTION_ALIGN 174 | %endif 175 | %endmacro 176 | 177 | %macro TEXT 0 178 | SECTION .text align=SECTION_ALIGN 179 | %endmacro 180 | 181 | %macro cglobal 1 182 | %ifdef PREFIX 183 | %ifdef MARK_FUNCS 184 | global _%1:function %1.endfunc-%1 185 | %define %1 _%1:function %1.endfunc-%1 186 | %define ENDFUNC .endfunc: 187 | %else 188 | global _%1 189 | %define %1 _%1 190 | %define ENDFUNC 191 | %endif 192 | %else 193 | %ifdef MARK_FUNCS 194 | global %1:function %1.endfunc-%1 195 | %define ENDFUNC .endfunc: 196 | %else 197 | global %1 198 | %define ENDFUNC 199 | %endif 200 | %endif 201 | %endmacro 202 | 203 | %macro NON_EXEC_STACK 0 204 | %ifidn __OUTPUT_FORMAT__,elf 205 | section .note.GNU-stack noalloc noexec nowrite progbits 206 | %endif 207 | %ifidn __OUTPUT_FORMAT__,elf32 208 | section .note.GNU-stack noalloc noexec nowrite progbits 209 | %endif 210 | %ifidn __OUTPUT_FORMAT__,elf64 211 | section .note.GNU-stack noalloc noexec nowrite progbits 212 | %endif 213 | %endmacro 214 | -------------------------------------------------------------------------------- /dshow/src/xvid.ax.rc: -------------------------------------------------------------------------------- 1 | //Microsoft Developer Studio generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include 11 | #ifndef IDC_STATIC 12 | #define IDC_STATIC (-1) 13 | #endif 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | #undef APSTUDIO_READONLY_SYMBOLS 17 | 18 | ///////////////////////////////////////////////////////////////////////////// 19 | // Neutral resources 20 | 21 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) 22 | #ifdef _WIN32 23 | LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL 24 | #pragma code_page(1252) 25 | #endif //_WIN32 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | // 29 | // Dialog 30 | // 31 | 32 | IDD_ABOUT DIALOG DISCARDABLE 0, 0, 216, 296 33 | STYLE WS_CHILD 34 | FONT 8, "MS Shell Dlg" 35 | BEGIN 36 | CONTROL IDB_LOGO,IDC_STATIC,"Static",SS_BITMAP,36,6,142,29 37 | CTEXT "Xvid MPEG-4 Video Codec",IDC_CORE,36,33,142,16, 38 | SS_CENTERIMAGE | SS_SUNKEN 39 | GROUPBOX "Brightness",IDC_STATIC,7,54,202,39 40 | CONTROL "Slider1",IDC_BRIGHTNESS,"msctls_trackbar32", 41 | TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,17,64,181,24 42 | GROUPBOX "Postprocessing",IDC_STATIC,7,96,202,42 43 | CONTROL "Deblocking (Y)",IDC_DEBLOCK_Y,"Button",BS_AUTOCHECKBOX | 44 | WS_TABSTOP,23,109,63,10 45 | CONTROL "Deblocking (UV)",IDC_DEBLOCK_UV,"Button", 46 | BS_AUTOCHECKBOX | WS_TABSTOP,23,123,68,10 47 | CONTROL "Dering (Y)",IDC_DERINGY,"Button",BS_AUTOCHECKBOX | 48 | WS_TABSTOP,98,109,47,10 49 | CONTROL "Film Effect",IDC_FILMEFFECT,"Button",BS_AUTOCHECKBOX | 50 | WS_TABSTOP,158,109,47,10 51 | GROUPBOX "Output",IDC_STATIC,7,141,202,43 52 | CONTROL "Flip Video",IDC_FLIPVIDEO,"Button",BS_AUTOCHECKBOX | 53 | WS_TABSTOP,23,154,46,10 54 | CONTROL "Compatibility Renderer",IDC_COMPAT,"Button", 55 | BS_AUTOCHECKBOX | WS_TABSTOP,23,167,88,12 56 | COMBOBOX IDC_COLORSPACE,134,164,69,67,CBS_DROPDOWNLIST | 57 | WS_VSCROLL | WS_TABSTOP 58 | CONTROL "DIVX",IDC_DIVX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,21, 59 | 198,47,13 60 | CONTROL "3IVX",IDC_3IVX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92, 61 | 198,43,13 62 | GROUPBOX "Other MPEG-4 video support",IDC_STATIC,7,187,202,29 63 | CONTROL "Other",IDC_MP4V,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, 64 | 160,198,38,13 65 | PUSHBUTTON "Reset",IDC_RESET,79,282,50,12 66 | LTEXT "Output Colourspace",IDC_STATIC,136,151,67,9 67 | CONTROL "Dering (UV)",IDC_DERINGUV,"Button",BS_AUTOCHECKBOX | 68 | WS_TABSTOP,98,123,53,10 69 | GROUPBOX "Aspect Ratio",IDC_STATIC,7,221,202,25 70 | LTEXT "After restarting player, use this AR:",IDC_STATIC,14, 71 | 233,109,8 72 | COMBOBOX IDC_USE_AR,135,230,68,95,CBS_DROPDOWNLIST | WS_VSCROLL | 73 | WS_TABSTOP 74 | CONTROL "Display Tray-Icon when playing back Xvid video",IDC_TRAYICON, 75 | "Button",BS_AUTOCHECKBOX | WS_TABSTOP,21,260,182,13 76 | GROUPBOX "GUI Options",IDC_STATIC,7,250,202,29 77 | END 78 | 79 | 80 | ///////////////////////////////////////////////////////////////////////////// 81 | // 82 | // Bitmap 83 | // 84 | 85 | IDB_LOGO BITMAP DISCARDABLE "XviD_logo.bmp" 86 | 87 | ///////////////////////////////////////////////////////////////////////////// 88 | // 89 | // Icon 90 | // 91 | 92 | // Icon with lowest ID value placed first to ensure application icon 93 | // remains consistent on all systems. 94 | IDI_ICON ICON DISCARDABLE "xvid.ico" 95 | 96 | #ifdef APSTUDIO_INVOKED 97 | ///////////////////////////////////////////////////////////////////////////// 98 | // 99 | // TEXTINCLUDE 100 | // 101 | 102 | 1 TEXTINCLUDE DISCARDABLE 103 | BEGIN 104 | "resource.h\0" 105 | END 106 | 107 | 2 TEXTINCLUDE DISCARDABLE 108 | BEGIN 109 | "#include \r\n" 110 | "#ifndef IDC_STATIC\r\n" 111 | "#define IDC_STATIC (-1)\r\n" 112 | "#endif\r\n" 113 | "\0" 114 | END 115 | 116 | 3 TEXTINCLUDE DISCARDABLE 117 | BEGIN 118 | "\r\n" 119 | "\0" 120 | END 121 | 122 | #endif // APSTUDIO_INVOKED 123 | 124 | 125 | ///////////////////////////////////////////////////////////////////////////// 126 | // 127 | // String Table 128 | // 129 | 130 | STRINGTABLE DISCARDABLE 131 | BEGIN 132 | IDS_ABOUT "About" 133 | END 134 | 135 | #endif // Neutral resources 136 | ///////////////////////////////////////////////////////////////////////////// 137 | 138 | 139 | 140 | #ifndef APSTUDIO_INVOKED 141 | ///////////////////////////////////////////////////////////////////////////// 142 | // 143 | // Generated from the TEXTINCLUDE 3 resource. 144 | // 145 | 146 | 147 | ///////////////////////////////////////////////////////////////////////////// 148 | #endif // not APSTUDIO_INVOKED 149 | 150 | -------------------------------------------------------------------------------- /dshow/dshow.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="dshow" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 6 | 7 | CFG=dshow - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "dshow.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "dshow.mak" CFG="dshow - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "dshow - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") 21 | !MESSAGE "dshow - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | MTL=midl.exe 30 | RSC=rc.exe 31 | 32 | !IF "$(CFG)" == "dshow - Win32 Release" 33 | 34 | # PROP BASE Use_MFC 0 35 | # PROP BASE Use_Debug_Libraries 0 36 | # PROP BASE Output_Dir "Release" 37 | # PROP BASE Intermediate_Dir "Release" 38 | # PROP BASE Target_Dir "" 39 | # PROP Use_MFC 0 40 | # PROP Use_Debug_Libraries 0 41 | # PROP Output_Dir "Release" 42 | # PROP Intermediate_Dir "Release" 43 | # PROP Ignore_Export_Lib 0 44 | # PROP Target_Dir "" 45 | # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c 46 | # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\src" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c 47 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 48 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 49 | # ADD BASE RSC /l 0xc09 /d "NDEBUG" 50 | # ADD RSC /l 0xc09 /d "NDEBUG" 51 | BSC32=bscmake.exe 52 | # ADD BASE BSC32 /nologo 53 | # ADD BSC32 /nologo 54 | LINK32=link.exe 55 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 56 | # ADD LINK32 kernel32.lib user32.lib msvcrt.lib advapi32.lib winmm.lib ole32.lib uuid.lib strmbase.lib oleaut32.lib comctl32.lib /nologo /entry:"DllMain" /dll /machine:I386 /nodefaultlib /out:"bin\xvid.ax" 57 | # SUBTRACT LINK32 /pdb:none 58 | 59 | !ELSEIF "$(CFG)" == "dshow - Win32 Debug" 60 | 61 | # PROP BASE Use_MFC 0 62 | # PROP BASE Use_Debug_Libraries 1 63 | # PROP BASE Output_Dir "Debug" 64 | # PROP BASE Intermediate_Dir "Debug" 65 | # PROP BASE Target_Dir "" 66 | # PROP Use_MFC 0 67 | # PROP Use_Debug_Libraries 1 68 | # PROP Output_Dir "Debug" 69 | # PROP Intermediate_Dir "Debug" 70 | # PROP Ignore_Export_Lib 0 71 | # PROP Target_Dir "" 72 | # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c 73 | # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\src" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c 74 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 75 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 76 | # ADD BASE RSC /l 0xc09 /d "_DEBUG" 77 | # ADD RSC /l 0xc09 /d "_DEBUG" 78 | BSC32=bscmake.exe 79 | # ADD BASE BSC32 /nologo 80 | # ADD BSC32 /nologo 81 | LINK32=link.exe 82 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept 83 | # ADD LINK32 kernel32.lib user32.lib msvcrt.lib advapi32.lib winmm.lib ole32.lib uuid.lib strmbasd.lib oleaut32.lib comctl32.lib /nologo /entry:"DllMain" /dll /debug /machine:I386 /nodefaultlib /out:"bin\xvid.ax" /pdbtype:sept 84 | # SUBTRACT LINK32 /pdb:none 85 | 86 | !ENDIF 87 | 88 | # Begin Target 89 | 90 | # Name "dshow - Win32 Release" 91 | # Name "dshow - Win32 Debug" 92 | # Begin Group "Source Files" 93 | 94 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 95 | # Begin Source File 96 | 97 | SOURCE=.\src\CAbout.cpp 98 | # End Source File 99 | # Begin Source File 100 | 101 | SOURCE=.\src\config.c 102 | # End Source File 103 | # Begin Source File 104 | 105 | SOURCE=.\src\Configure.cpp 106 | # End Source File 107 | # Begin Source File 108 | 109 | SOURCE=.\src\CXvidDecoder.cpp 110 | # End Source File 111 | # Begin Source File 112 | 113 | SOURCE=.\src\debug.c 114 | # End Source File 115 | # End Group 116 | # Begin Group "Header Files" 117 | 118 | # PROP Default_Filter "h;hpp;hxx;hm;inl" 119 | # Begin Source File 120 | 121 | SOURCE=.\src\CAbout.h 122 | # End Source File 123 | # Begin Source File 124 | 125 | SOURCE=.\src\config.h 126 | # End Source File 127 | # Begin Source File 128 | 129 | SOURCE=.\src\CXvidDecoder.h 130 | # End Source File 131 | # Begin Source File 132 | 133 | SOURCE=.\src\debug.h 134 | # End Source File 135 | # Begin Source File 136 | 137 | SOURCE=.\src\IXvidDecoder.h 138 | # End Source File 139 | # Begin Source File 140 | 141 | SOURCE=.\src\resource.h 142 | # End Source File 143 | # End Group 144 | # Begin Group "Resource Files" 145 | 146 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" 147 | # Begin Source File 148 | 149 | SOURCE=.\src\xvid.ax.rc 150 | # End Source File 151 | # Begin Source File 152 | 153 | SOURCE=.\src\XviD_logo.bmp 154 | # End Source File 155 | # End Group 156 | # Begin Group "Linker Defs" 157 | 158 | # PROP Default_Filter "def" 159 | # Begin Source File 160 | 161 | SOURCE=.\src\xvid.ax.def 162 | # End Source File 163 | # End Group 164 | # End Target 165 | # End Project 166 | -------------------------------------------------------------------------------- /src/quant/quant.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - (de)Quantization related header - 5 | * 6 | * Copyright(C) 2003 Edouard Gomez 7 | * 8 | * This program is free software ; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation ; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program ; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * $Id$ 23 | * 24 | ****************************************************************************/ 25 | 26 | #ifndef _QUANT_H_ 27 | #define _QUANT_H_ 28 | 29 | #include "../portab.h" 30 | 31 | /***************************************************************************** 32 | * Common API for Intra (de)Quant functions 33 | ****************************************************************************/ 34 | 35 | typedef uint32_t (quant_intraFunc) (int16_t * coeff, 36 | const int16_t * data, 37 | const uint32_t quant, 38 | const uint32_t dcscalar, 39 | const uint16_t * mpeg_quant_matrices); 40 | 41 | typedef quant_intraFunc *quant_intraFuncPtr; 42 | 43 | /* Global function pointers */ 44 | extern quant_intraFuncPtr quant_h263_intra; 45 | extern quant_intraFuncPtr quant_mpeg_intra; 46 | extern quant_intraFuncPtr dequant_h263_intra; 47 | extern quant_intraFuncPtr dequant_mpeg_intra; 48 | 49 | /***************************************************************************** 50 | * Known implementation of Intra (de)Quant functions 51 | ****************************************************************************/ 52 | 53 | /* Quant functions */ 54 | quant_intraFunc quant_h263_intra_c; 55 | quant_intraFunc quant_mpeg_intra_c; 56 | 57 | #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) 58 | quant_intraFunc quant_h263_intra_mmx; 59 | quant_intraFunc quant_h263_intra_3dne; 60 | quant_intraFunc quant_h263_intra_sse2; 61 | 62 | quant_intraFunc quant_mpeg_intra_mmx; 63 | #endif 64 | 65 | #ifdef ARCH_IS_IA64 66 | quant_intraFunc quant_h263_intra_ia64; 67 | #endif 68 | 69 | #ifdef ARCH_IS_PPC 70 | quant_intraFunc quant_h263_intra_altivec_c; 71 | #endif 72 | 73 | /* DeQuant functions */ 74 | quant_intraFunc dequant_h263_intra_c; 75 | quant_intraFunc dequant_mpeg_intra_c; 76 | 77 | #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) 78 | quant_intraFunc dequant_h263_intra_mmx; 79 | quant_intraFunc dequant_h263_intra_xmm; 80 | quant_intraFunc dequant_h263_intra_3dne; 81 | quant_intraFunc dequant_h263_intra_sse2; 82 | 83 | quant_intraFunc dequant_mpeg_intra_mmx; 84 | quant_intraFunc dequant_mpeg_intra_3dne; 85 | #endif 86 | 87 | #ifdef ARCH_IS_IA64 88 | quant_intraFunc dequant_h263_intra_ia64; 89 | #endif 90 | 91 | #ifdef ARCH_IS_PPC 92 | quant_intraFunc dequant_h263_intra_altivec_c; 93 | quant_intraFunc dequant_mpeg_intra_altivec_c; 94 | #endif 95 | 96 | /***************************************************************************** 97 | * Common API for Inter (de)Quant functions 98 | ****************************************************************************/ 99 | 100 | typedef uint32_t (quant_interFunc) (int16_t * coeff, 101 | const int16_t * data, 102 | const uint32_t quant, 103 | const uint16_t * mpeg_quant_matrices); 104 | 105 | typedef quant_interFunc *quant_interFuncPtr; 106 | 107 | /* Global function pointers */ 108 | extern quant_interFuncPtr quant_h263_inter; 109 | extern quant_interFuncPtr quant_mpeg_inter; 110 | extern quant_interFuncPtr dequant_h263_inter; 111 | extern quant_interFuncPtr dequant_mpeg_inter; 112 | 113 | /***************************************************************************** 114 | * Known implementation of Inter (de)Quant functions 115 | ****************************************************************************/ 116 | 117 | quant_interFunc quant_h263_inter_c; 118 | quant_interFunc quant_mpeg_inter_c; 119 | 120 | #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) 121 | quant_interFunc quant_h263_inter_mmx; 122 | quant_interFunc quant_h263_inter_3dne; 123 | quant_interFunc quant_h263_inter_sse2; 124 | 125 | quant_interFunc quant_mpeg_inter_mmx; 126 | quant_interFunc quant_mpeg_inter_xmm; 127 | #endif 128 | 129 | #ifdef ARCH_IS_IA64 130 | quant_interFunc quant_h263_inter_ia64; 131 | #endif 132 | 133 | #ifdef ARCH_IS_PPC 134 | quant_interFunc quant_h263_inter_altivec_c; 135 | #endif 136 | 137 | quant_interFunc dequant_h263_inter_c; 138 | quant_interFunc dequant_mpeg_inter_c; 139 | 140 | #if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) 141 | quant_interFunc dequant_h263_inter_mmx; 142 | quant_interFunc dequant_h263_inter_xmm; 143 | quant_interFunc dequant_h263_inter_3dne; 144 | quant_interFunc dequant_h263_inter_sse2; 145 | 146 | quant_interFunc dequant_mpeg_inter_mmx; 147 | quant_interFunc dequant_mpeg_inter_3dne; 148 | #endif 149 | 150 | #ifdef ARCH_IS_IA64 151 | quant_interFunc dequant_h263_inter_ia64; 152 | #endif 153 | 154 | #ifdef ARCH_IS_PPC 155 | quant_interFunc dequant_h263_inter_altivec_c; 156 | quant_interFunc dequant_mpeg_inter_altivec_c; 157 | #endif 158 | 159 | #endif /* _QUANT_H_ */ 160 | -------------------------------------------------------------------------------- /SMP/libxvidcore.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | VisualStudioVersion = 12.0.30501.0 4 | MinimumVisualStudioVersion = 12.0.30501.0 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxvidcore", "libxvidcore.vcxproj", "{E0889360-2F17-4D9C-A185-A5C51EA8073B}" 6 | EndProject 7 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxvidcore_winrt", "libxvidcore_winrt.vcxproj", "{A0889360-2F17-4D9C-A185-A5C51EA8073B}" 8 | EndProject 9 | Global 10 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | DebugDLL|x64 = DebugDLL|x64 14 | DebugDLL|x86 = DebugDLL|x86 15 | DebugDLLWinRT|x64 = DebugDLLWinRT|x64 16 | DebugDLLWinRT|x86 = DebugDLLWinRT|x86 17 | DebugWinRT|x64 = DebugWinRT|x64 18 | DebugWinRT|x86 = DebugWinRT|x86 19 | Release|x64 = Release|x64 20 | Release|x86 = Release|x86 21 | ReleaseDLL|x64 = ReleaseDLL|x64 22 | ReleaseDLL|x86 = ReleaseDLL|x86 23 | ReleaseDLLWinRT|x64 = ReleaseDLLWinRT|x64 24 | ReleaseDLLWinRT|x86 = ReleaseDLLWinRT|x86 25 | ReleaseWinRT|x64 = ReleaseWinRT|x64 26 | ReleaseWinRT|x86 = ReleaseWinRT|x86 27 | EndGlobalSection 28 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 29 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.Debug|x64.ActiveCfg = Debug|x64 30 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.Debug|x64.Build.0 = Debug|x64 31 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.Debug|x86.ActiveCfg = Debug|Win32 32 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.Debug|x86.Build.0 = Debug|Win32 33 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.DebugDLL|x64.ActiveCfg = DebugDLL|x64 34 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.DebugDLL|x64.Build.0 = DebugDLL|x64 35 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.DebugDLL|x86.ActiveCfg = DebugDLL|Win32 36 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.DebugDLL|x86.Build.0 = DebugDLL|Win32 37 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.DebugDLLWinRT|x64.ActiveCfg = DebugDLL|x64 38 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.DebugDLLWinRT|x86.ActiveCfg = DebugDLL|Win32 39 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.DebugWinRT|x64.ActiveCfg = Debug|x64 40 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.DebugWinRT|x86.ActiveCfg = Debug|Win32 41 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.Release|x64.ActiveCfg = Release|x64 42 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.Release|x64.Build.0 = Release|x64 43 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.Release|x86.ActiveCfg = Release|Win32 44 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.Release|x86.Build.0 = Release|Win32 45 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.ReleaseDLL|x64.ActiveCfg = ReleaseDLL|x64 46 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.ReleaseDLL|x64.Build.0 = ReleaseDLL|x64 47 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.ReleaseDLL|x86.ActiveCfg = ReleaseDLL|Win32 48 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.ReleaseDLL|x86.Build.0 = ReleaseDLL|Win32 49 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.ReleaseDLLWinRT|x64.ActiveCfg = ReleaseDLL|x64 50 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.ReleaseDLLWinRT|x86.ActiveCfg = ReleaseDLL|Win32 51 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.ReleaseWinRT|x64.ActiveCfg = Release|x64 52 | {E0889360-2F17-4D9C-A185-A5C51EA8073B}.ReleaseWinRT|x86.ActiveCfg = Release|Win32 53 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.Debug|x64.ActiveCfg = DebugWinRT|x64 54 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.Debug|x86.ActiveCfg = DebugWinRT|Win32 55 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.DebugDLL|x64.ActiveCfg = DebugDLLWinRT|x64 56 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.DebugDLL|x86.ActiveCfg = DebugDLLWinRT|Win32 57 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.DebugDLLWinRT|x64.ActiveCfg = DebugDLLWinRT|x64 58 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.DebugDLLWinRT|x64.Build.0 = DebugDLLWinRT|x64 59 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.DebugDLLWinRT|x86.ActiveCfg = DebugDLLWinRT|Win32 60 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.DebugDLLWinRT|x86.Build.0 = DebugDLLWinRT|Win32 61 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.DebugWinRT|x64.ActiveCfg = DebugWinRT|x64 62 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.DebugWinRT|x64.Build.0 = DebugWinRT|x64 63 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.DebugWinRT|x86.ActiveCfg = DebugWinRT|Win32 64 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.DebugWinRT|x86.Build.0 = DebugWinRT|Win32 65 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.Release|x64.ActiveCfg = ReleaseWinRT|x64 66 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.Release|x86.ActiveCfg = ReleaseWinRT|Win32 67 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.ReleaseDLL|x64.ActiveCfg = ReleaseDLLWinRT|x64 68 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.ReleaseDLL|x86.ActiveCfg = ReleaseDLLWinRT|Win32 69 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.ReleaseDLLWinRT|x64.ActiveCfg = ReleaseDLLWinRT|x64 70 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.ReleaseDLLWinRT|x64.Build.0 = ReleaseDLLWinRT|x64 71 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.ReleaseDLLWinRT|x86.ActiveCfg = ReleaseDLLWinRT|Win32 72 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.ReleaseDLLWinRT|x86.Build.0 = ReleaseDLLWinRT|Win32 73 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.ReleaseWinRT|x64.ActiveCfg = ReleaseWinRT|x64 74 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.ReleaseWinRT|x64.Build.0 = ReleaseWinRT|x64 75 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.ReleaseWinRT|x86.ActiveCfg = ReleaseWinRT|Win32 76 | {A0889360-2F17-4D9C-A185-A5C51EA8073B}.ReleaseWinRT|x86.Build.0 = ReleaseWinRT|Win32 77 | EndGlobalSection 78 | GlobalSection(SolutionProperties) = preSolution 79 | HideSolutionNode = FALSE 80 | EndGlobalSection 81 | GlobalSection(ExtensibilityGlobals) = postSolution 82 | SolutionGuid = {3917B4C8-7E97-4DA6-A25B-6D31C0B31C9D} 83 | EndGlobalSection 84 | EndGlobal 85 | -------------------------------------------------------------------------------- /src/motion/motion.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * XVID MPEG-4 VIDEO CODEC 4 | * - Motion module header - 5 | * 6 | * Copyright(C) 2002-2003 Radoslaw Czyz 7 | * 2002 Michael Militzer 8 | * 9 | * 10 | * This program is free software ; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation ; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program ; if not, write to the Free Software 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | * 24 | * $Id$ 25 | * 26 | ***************************************************************************/ 27 | 28 | #ifndef _MOTION_H_ 29 | #define _MOTION_H_ 30 | 31 | #include "../portab.h" 32 | #include "../global.h" 33 | 34 | /***************************************************************************** 35 | * Modified rounding tables -- defined in estimation_common.c 36 | * Original tables see ISO spec tables 7-6 -> 7-9 37 | ****************************************************************************/ 38 | 39 | extern const uint32_t roundtab[16]; 40 | /* K = 4 */ 41 | extern const uint32_t roundtab_76[16]; 42 | /* K = 2 */ 43 | extern const uint32_t roundtab_78[8]; 44 | /* K = 1 */ 45 | extern const uint32_t roundtab_79[4]; 46 | 47 | 48 | /** MotionEstimation **/ 49 | 50 | void MotionEstimation(MBParam * const pParam, 51 | FRAMEINFO * const current, 52 | FRAMEINFO * const reference, 53 | const IMAGE * const pRefH, 54 | const IMAGE * const pRefV, 55 | const IMAGE * const pRefHV, 56 | const IMAGE * const pGMC, 57 | const uint32_t iLimit, 58 | const int num_slices); 59 | 60 | void 61 | MotionEstimationBVOP(MBParam * const pParam, 62 | FRAMEINFO * const frame, 63 | const int32_t time_bp, 64 | const int32_t time_pp, 65 | const MACROBLOCK * const f_mbs, 66 | const IMAGE * const f_ref, 67 | const IMAGE * const f_refH, 68 | const IMAGE * const f_refV, 69 | const IMAGE * const f_refHV, 70 | const FRAMEINFO * const b_reference, 71 | const IMAGE * const b_ref, 72 | const IMAGE * const b_refH, 73 | const IMAGE * const b_refV, 74 | const IMAGE * const b_refHV, 75 | const int num_slices); 76 | 77 | void 78 | GMEanalysis(const MBParam * const pParam, 79 | const FRAMEINFO * const current, 80 | const FRAMEINFO * const reference, 81 | const IMAGE * const pRefH, 82 | const IMAGE * const pRefV, 83 | const IMAGE * const pRefHV, 84 | const int num_slices); 85 | 86 | WARPPOINTS 87 | GlobalMotionEst(MACROBLOCK * const pMBs, 88 | const MBParam * const pParam, 89 | const FRAMEINFO * const current, 90 | const FRAMEINFO * const reference, 91 | const IMAGE * const pRefH, 92 | const IMAGE * const pRefV, 93 | const IMAGE * const pRefHV, 94 | const int num_slices); 95 | 96 | int 97 | GlobalMotionEstRefine( 98 | WARPPOINTS *const startwp, 99 | MACROBLOCK * const pMBs, 100 | const MBParam * const pParam, 101 | const FRAMEINFO * const current, 102 | const FRAMEINFO * const reference, 103 | const IMAGE * const pCurr, 104 | const IMAGE * const pRef, 105 | const IMAGE * const pRefH, 106 | const IMAGE * const pRefV, 107 | const IMAGE * const pRefHV); 108 | 109 | int 110 | globalSAD(const WARPPOINTS *const wp, 111 | const MBParam * const pParam, 112 | const MACROBLOCK * const pMBs, 113 | const FRAMEINFO * const current, 114 | const IMAGE * const pRef, 115 | const IMAGE * const pCurr, 116 | uint8_t *const GMCblock); 117 | 118 | 119 | int 120 | MEanalysis( const IMAGE * const pRef, 121 | const FRAMEINFO * const Current, 122 | const MBParam * const pParam, 123 | const int maxIntra, 124 | const int intraCount, 125 | const int bCount, 126 | const int b_thresh, 127 | const MACROBLOCK * const prev_mbs); 128 | 129 | /** MotionCompensation **/ 130 | 131 | void 132 | MBMotionCompensation(MACROBLOCK * const mb, 133 | const uint32_t i, 134 | const uint32_t j, 135 | const IMAGE * const ref, 136 | const IMAGE * const refh, 137 | const IMAGE * const refv, 138 | const IMAGE * const refhv, 139 | const IMAGE * const refGMC, 140 | IMAGE * const cur, 141 | int16_t * dct_codes, 142 | const uint32_t width, 143 | const uint32_t height, 144 | const uint32_t edged_width, 145 | const int32_t quarterpel, 146 | const int32_t rounding, 147 | uint8_t * const tmp); 148 | 149 | void 150 | MBMotionCompensationBVOP(MBParam * pParam, 151 | MACROBLOCK * const mb, 152 | const uint32_t i, 153 | const uint32_t j, 154 | IMAGE * const cur, 155 | const IMAGE * const f_ref, 156 | const IMAGE * const f_refh, 157 | const IMAGE * const f_refv, 158 | const IMAGE * const f_refhv, 159 | const IMAGE * const b_ref, 160 | const IMAGE * const b_refh, 161 | const IMAGE * const b_refv, 162 | const IMAGE * const b_refhv, 163 | int16_t * dct_codes, 164 | uint8_t * const tmp); 165 | 166 | #endif /* _MOTION_H_ */ 167 | -------------------------------------------------------------------------------- /src/motion/x86_asm/sad_3dn.asm: -------------------------------------------------------------------------------- 1 | ;/**************************************************************************** 2 | ; * 3 | ; * XVID MPEG-4 VIDEO CODEC 4 | ; * - 3DNow sad operators w/o XMM instructions - 5 | ; * 6 | ; * Copyright(C) 2002 Peter ross 7 | ; * 8 | ; * This program is free software; you can redistribute it and/or modify it 9 | ; * under the terms of the GNU General Public License as published by 10 | ; * the Free Software Foundation; either version 2 of the License, or 11 | ; * (at your option) any later version. 12 | ; * 13 | ; * This program is distributed in the hope that it will be useful, 14 | ; * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ; * GNU General Public License for more details. 17 | ; * 18 | ; * You should have received a copy of the GNU General Public License 19 | ; * along with this program; if not, write to the Free Software 20 | ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | ; * 22 | ; * $Id: sad_3dn.asm,v 1.14 2009-09-16 17:07:58 Isibaar Exp $ 23 | ; * 24 | ; ***************************************************************************/ 25 | 26 | %include "nasm.inc" 27 | 28 | ;============================================================================= 29 | ; Read only data 30 | ;============================================================================= 31 | 32 | DATA 33 | 34 | ALIGN SECTION_ALIGN 35 | mmx_one: 36 | times 4 dw 1 37 | 38 | ;============================================================================= 39 | ; Helper macros 40 | ;============================================================================= 41 | %macro SADBI_16x16_3DN 0 42 | movq mm0, [_EAX] ; src 43 | movq mm2, [_EAX+8] 44 | 45 | movq mm1, [TMP1] ; ref1 46 | movq mm3, [TMP1+8] 47 | pavgusb mm1, [_EBX] ; ref2 48 | lea TMP1, [TMP1+TMP0] 49 | pavgusb mm3, [_EBX+8] 50 | lea _EBX, [_EBX+TMP0] 51 | 52 | movq mm4, mm0 53 | lea _EAX, [_EAX+TMP0] 54 | psubusb mm0, mm1 55 | movq mm5, mm2 56 | psubusb mm2, mm3 57 | 58 | psubusb mm1, mm4 59 | por mm0, mm1 60 | psubusb mm3, mm5 61 | por mm2, mm3 62 | 63 | movq mm1, mm0 64 | movq mm3, mm2 65 | 66 | punpcklbw mm0,mm7 67 | punpckhbw mm1,mm7 68 | punpcklbw mm2,mm7 69 | punpckhbw mm3,mm7 70 | 71 | paddusw mm0,mm1 72 | paddusw mm2,mm3 73 | paddusw mm6,mm0 74 | paddusw mm6,mm2 75 | %endmacro 76 | 77 | %macro SADBI_8x8_3DN 0 78 | movq mm0, [_EAX] ; src 79 | movq mm2, [_EAX+TMP0] 80 | 81 | movq mm1, [TMP1] ; ref1 82 | movq mm3, [TMP1+TMP0] 83 | pavgusb mm1, [_EBX] ; ref2 84 | lea TMP1, [TMP1+2*TMP0] 85 | pavgusb mm3, [_EBX+TMP0] 86 | lea _EBX, [_EBX+2*TMP0] 87 | 88 | movq mm4, mm0 89 | lea _EAX, [_EAX+2*TMP0] 90 | psubusb mm0, mm1 91 | movq mm5, mm2 92 | psubusb mm2, mm3 93 | 94 | psubusb mm1, mm4 95 | por mm0, mm1 96 | psubusb mm3, mm5 97 | por mm2, mm3 98 | 99 | movq mm1, mm0 100 | movq mm3, mm2 101 | 102 | punpcklbw mm0,mm7 103 | punpckhbw mm1,mm7 104 | punpcklbw mm2,mm7 105 | punpckhbw mm3,mm7 106 | 107 | paddusw mm0,mm1 108 | paddusw mm2,mm3 109 | paddusw mm6,mm0 110 | paddusw mm6,mm2 111 | %endmacro 112 | 113 | ;============================================================================= 114 | ; Code 115 | ;============================================================================= 116 | 117 | TEXT 118 | 119 | cglobal sad16bi_3dn 120 | cglobal sad8bi_3dn 121 | 122 | ;----------------------------------------------------------------------------- 123 | ; 124 | ; uint32_t sad16bi_3dn(const uint8_t * const cur, 125 | ; const uint8_t * const ref1, 126 | ; const uint8_t * const ref2, 127 | ; const uint32_t stride); 128 | ; 129 | ;----------------------------------------------------------------------------- 130 | 131 | ALIGN SECTION_ALIGN 132 | sad16bi_3dn: 133 | mov _EAX, prm1 ; Src 134 | mov TMP1, prm2 ; Ref1 135 | mov TMP0, prm4 ; Stride 136 | 137 | push _EBX 138 | %ifdef ARCH_IS_X86_64 139 | mov _EBX, prm3 140 | %else 141 | mov _EBX, [_ESP+4+12] ; Ref2 142 | %endif 143 | 144 | pxor mm6, mm6 ; accum2 145 | pxor mm7, mm7 146 | .Loop: 147 | SADBI_16x16_3DN 148 | SADBI_16x16_3DN 149 | SADBI_16x16_3DN 150 | SADBI_16x16_3DN 151 | SADBI_16x16_3DN 152 | SADBI_16x16_3DN 153 | SADBI_16x16_3DN 154 | SADBI_16x16_3DN 155 | 156 | SADBI_16x16_3DN 157 | SADBI_16x16_3DN 158 | SADBI_16x16_3DN 159 | SADBI_16x16_3DN 160 | SADBI_16x16_3DN 161 | SADBI_16x16_3DN 162 | SADBI_16x16_3DN 163 | SADBI_16x16_3DN 164 | 165 | pmaddwd mm6, [mmx_one] ; collapse 166 | movq mm7, mm6 167 | psrlq mm7, 32 168 | paddd mm6, mm7 169 | 170 | movd eax, mm6 171 | 172 | pop _EBX 173 | 174 | ret 175 | ENDFUNC 176 | 177 | ;----------------------------------------------------------------------------- 178 | ; 179 | ; uint32_t sad8bi_3dn(const uint8_t * const cur, 180 | ; const uint8_t * const ref1, 181 | ; const uint8_t * const ref2, 182 | ; const uint32_t stride); 183 | ; 184 | ;----------------------------------------------------------------------------- 185 | 186 | ALIGN SECTION_ALIGN 187 | sad8bi_3dn: 188 | mov _EAX, prm1 ; Src 189 | mov TMP1, prm2 ; Ref1 190 | mov TMP0, prm4 ; Stride 191 | 192 | push _EBX 193 | %ifdef ARCH_IS_X86_64 194 | mov _EBX, prm3 195 | %else 196 | mov _EBX, [_ESP+4+12] ; Ref2 197 | %endif 198 | 199 | pxor mm6, mm6 ; accum2 200 | pxor mm7, mm7 201 | .Loop: 202 | SADBI_8x8_3DN 203 | SADBI_8x8_3DN 204 | SADBI_8x8_3DN 205 | SADBI_8x8_3DN 206 | 207 | pmaddwd mm6, [mmx_one] ; collapse 208 | movq mm7, mm6 209 | psrlq mm7, 32 210 | paddd mm6, mm7 211 | 212 | movd eax, mm6 213 | 214 | pop _EBX 215 | 216 | ret 217 | ENDFUNC 218 | 219 | NON_EXEC_STACK 220 | --------------------------------------------------------------------------------