x264-0.163.3060+git5db6aa6/0000775000175000017500000000000014203542064013121 5ustar ricoricox264-0.163.3060+git5db6aa6/x264cli.h0000664000175000017500000000615614203542064014475 0ustar ricorico/***************************************************************************** * x264cli.h: x264cli common ***************************************************************************** * Copyright (C) 2003-2021 x264 project * * Authors: Laurent Aimar * Loren Merritt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. * * This program is also available under a commercial proprietary license. * For more information, contact us at licensing@x264.com. *****************************************************************************/ #ifndef X264_CLI_H #define X264_CLI_H #include "common/base.h" /* In microseconds */ #define UPDATE_INTERVAL 250000 #define MAX_RESOLUTION 16384 typedef void *hnd_t; extern const char * const x264_avcintra_class_names[]; extern const char * const x264_cqm_names[]; extern const char * const x264_log_level_names[]; extern const char * const x264_partition_names[]; extern const char * const x264_pulldown_names[]; extern const char * const x264_range_names[]; extern const char * const x264_output_csp_names[]; extern const char * const x264_valid_profile_names[]; extern const char * const x264_demuxer_names[]; extern const char * const x264_muxer_names[]; static inline uint64_t gcd( uint64_t a, uint64_t b ) { while( 1 ) { int64_t c = a % b; if( !c ) return b; a = b; b = c; } } static inline uint64_t lcm( uint64_t a, uint64_t b ) { return ( a / gcd( a, b ) ) * b; } static inline char *get_filename_extension( char *filename ) { char *ext = filename + strlen( filename ); while( *ext != '.' && ext > filename ) ext--; ext += *ext == '.'; return ext; } void x264_cli_log( const char *name, int i_level, const char *fmt, ... ); void x264_cli_printf( int i_level, const char *fmt, ... ); int x264_cli_autocomplete( const char *prev, const char *cur ); #ifdef _WIN32 void x264_cli_set_console_title( const char *title ); int x264_ansi_filename( const char *filename, char *ansi_filename, int size, int create_file ); #else #define x264_cli_set_console_title( title ) #endif #define RETURN_IF_ERR( cond, name, ret, ... )\ do\ {\ if( cond )\ {\ x264_cli_log( name, X264_LOG_ERROR, __VA_ARGS__ );\ return ret;\ }\ } while( 0 ) #define FAIL_IF_ERR( cond, name, ... ) RETURN_IF_ERR( cond, name, -1, __VA_ARGS__ ) typedef enum { RANGE_AUTO = -1, RANGE_TV, RANGE_PC } range_enum; #endif x264-0.163.3060+git5db6aa6/COPYING0000664000175000017500000004311014203542064014153 0ustar ricorico GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. x264-0.163.3060+git5db6aa6/.gitlab-ci.yml0000664000175000017500000002066714203542064015570 0ustar ricoricostages: - build - test - release .variables-debian-amd64: &variables-debian-amd64 _TRIPLET: "" _PLATFORMSUFFIX: "" _WRAPPER: "" .variables-debian-aarch64: &variables-debian-aarch64 _TRIPLET: "" _PLATFORMSUFFIX: "" _WRAPPER: "" .variables-win32: &variables-win32 _TRIPLET: "i686-w64-mingw32" _PLATFORMSUFFIX: ".exe" _WRAPPER: "wine" _CONTRIB_URL: "https://artifacts.videolan.org/vlc/win32/" .variables-win64: &variables-win64 _TRIPLET: "x86_64-w64-mingw32" _PLATFORMSUFFIX: ".exe" _WRAPPER: "wine64" _CONTRIB_URL: "https://artifacts.videolan.org/vlc/win64/" .variables-win-armv7: &variables-win-armv7 _TRIPLET: "armv7-w64-mingw32" _PLATFORMSUFFIX: ".exe" _WRAPPER: "" .variables-win-aarch64: &variables-win-aarch64 _TRIPLET: "aarch64-w64-mingw32" _PLATFORMSUFFIX: ".exe" _WRAPPER: "" .variables-macos-x86_64: &variables-macos-x86_64 _TRIPLET: "x86_64-apple-darwin19" _PLATFORMSUFFIX: "" _WRAPPER: "" _CONTRIB_URL: "https://artifacts.videolan.org/vlc/macos-x86_64/" _XCFLAGS: "-arch x86_64" _XLDFLAGS: "-arch x86_64" .variables-macos-arm64: &variables-macos-arm64 _TRIPLET: "aarch64-apple-darwin19" _PLATFORMSUFFIX: "" _WRAPPER: "" _CONTRIB_URL: "https://artifacts.videolan.org/vlc/macos-arm64/" _XCFLAGS: "-arch arm64" _XLDFLAGS: "-arch arm64" .build: stage: build script: | set -x LOCAL_INSTALL_DIR=`pwd`/local_install export PKG_CONFIG_LIBDIR=${LOCAL_INSTALL_DIR}/lib/pkgconfig git clone --depth 1 --branch master https://git.ffmpeg.org/ffmpeg.git ffmpeg cd ffmpeg ./configure --prefix="${LOCAL_INSTALL_DIR}" --enable-pic --disable-debug --extra-ldflags="-static" --disable-programs --disable-doc --disable-avdevice --disable-postproc --disable-avfilter --disable-network --disable-encoders --disable-muxers make -j$(getconf _NPROCESSORS_ONLN) make -j$(getconf _NPROCESSORS_ONLN) install cd .. git clone --depth 1 --branch master https://github.com/l-smash/l-smash.git lsmash cd lsmash ./configure --prefix="${LOCAL_INSTALL_DIR}" --extra-ldflags="-static" make -j$(getconf _NPROCESSORS_ONLN) make -j$(getconf _NPROCESSORS_ONLN) install cd .. ./configure --enable-pic --enable-strip --extra-ldflags="-static" make -j$(getconf _NPROCESSORS_ONLN) x264 checkasm artifacts: name: "$CI_PROJECT_PATH_SLUG-$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA" paths: - x264${_PLATFORMSUFFIX} - checkasm8${_PLATFORMSUFFIX} - checkasm10${_PLATFORMSUFFIX} expire_in: 1 week build-debian-amd64: extends: .build image: registry.videolan.org/x264-debian-unstable:20190404162201 tags: - docker - amd64 variables: *variables-debian-amd64 build-debian-aarch64: extends: .build image: registry.videolan.org/x264-debian-unstable-aarch64:20190716192245 tags: - docker - aarch64 variables: *variables-debian-aarch64 .build-win: extends: build-debian-amd64 script: | set -x LOCAL_INSTALL_DIR=`pwd`/${_TRIPLET} export PKG_CONFIG_LIBDIR=${LOCAL_INSTALL_DIR}/lib/pkgconfig curl -f -o vlc-contrib.txt ${_CONTRIB_URL} CONTRIB_NAME=$(sed -n -e "s@.*href=\"\(vlc-contrib-${_TRIPLET}-[^\"]*\.tar\.bz2\)\".*@\1@p" vlc-contrib.txt | sed -n -e '1p') curl -f -o vlc-contrib-${_TRIPLET}-latest.tar.bz2 ${_CONTRIB_URL}${CONTRIB_NAME} bunzip2 vlc-contrib-${_TRIPLET}-latest.tar.bz2 tar xvf vlc-contrib-${_TRIPLET}-latest.tar sed -i.bak -e "s#@@CONTRIB_PREFIX@@#${LOCAL_INSTALL_DIR}#g" ${PKG_CONFIG_LIBDIR}/*.pc git clone --depth 1 --branch master https://github.com/l-smash/l-smash.git lsmash cd lsmash ./configure --prefix="${LOCAL_INSTALL_DIR}" --target-os="${_TRIPLET}" --cross-prefix="${_TRIPLET}-" make -j$(getconf _NPROCESSORS_ONLN) make -j$(getconf _NPROCESSORS_ONLN) install cd .. ./configure --host="${_TRIPLET}" --cross-prefix="${_TRIPLET}-" --enable-pic --enable-strip make -j$(getconf _NPROCESSORS_ONLN) x264 checkasm build-win32: extends: .build-win variables: *variables-win32 build-win64: extends: .build-win variables: *variables-win64 .build-llvm-mingw: extends: .build image: registry.videolan.org/vlc-debian-llvm-mingw:20200703084018 tags: - docker - amd64 script: | set -x PKGCONFIG=pkg-config ./configure --host="${_TRIPLET}" --cross-prefix="${_TRIPLET}-" --enable-pic --enable-strip make -j$(getconf _NPROCESSORS_ONLN) x264 checkasm build-llvm-mingw-armv7: extends: .build-llvm-mingw variables: *variables-win-armv7 build-llvm-mingw-aarch64: extends: .build-llvm-mingw variables: *variables-win-aarch64 .build-macos: extends: .build script: | set -x LOCAL_INSTALL_DIR=`pwd`/${_TRIPLET} export PKG_CONFIG_LIBDIR=${LOCAL_INSTALL_DIR}/lib/pkgconfig curl -f -o vlc-contrib.txt ${_CONTRIB_URL} CONTRIB_NAME=$(sed -n -e "s@.*href=\"\(vlc-contrib-${_TRIPLET}-[^\"]*\.tar\.bz2\)\".*@\1@p" vlc-contrib.txt | sed -n -e '1p') curl -f -o vlc-contrib-${_TRIPLET}-latest.tar.bz2 ${_CONTRIB_URL}${CONTRIB_NAME} bunzip2 vlc-contrib-${_TRIPLET}-latest.tar.bz2 tar xvf vlc-contrib-${_TRIPLET}-latest.tar sed -i.bak -e "s#@@CONTRIB_PREFIX@@#${LOCAL_INSTALL_DIR}#g" ${PKG_CONFIG_LIBDIR}/*.pc git clone --depth 1 --branch master https://github.com/l-smash/l-smash.git lsmash cd lsmash ./configure --prefix="${LOCAL_INSTALL_DIR}" --target-os="${_TRIPLET}" --extra-cflags="${_XCFLAGS}" --extra-ldflags="${_XLDFLAGS}" make -j$(getconf _NPROCESSORS_ONLN) make -j$(getconf _NPROCESSORS_ONLN) install cd .. ./configure --host="${_TRIPLET}" --enable-pic --enable-strip make -j$(getconf _NPROCESSORS_ONLN) x264 checkasm build-macos-x86_64: extends: .build-macos tags: - amd64 - catalina variables: *variables-macos-x86_64 build-macos-arm64: extends: .build-macos tags: - amd64 - catalina variables: *variables-macos-arm64 .test: &test stage: test script: | set -x ${_WRAPPER} ./checkasm8${_PLATFORMSUFFIX} ${_WRAPPER} ./checkasm10${_PLATFORMSUFFIX} artifacts: expire_in: 10 minutes test-debian-amd64: <<: *test extends: build-debian-amd64 dependencies: - build-debian-amd64 variables: *variables-debian-amd64 test-debian-aarch64: <<: *test extends: build-debian-aarch64 dependencies: - build-debian-aarch64 variables: *variables-debian-aarch64 test-win32: <<: *test extends: build-win32 dependencies: - build-win32 variables: *variables-win32 test-win64: <<: *test extends: build-win64 dependencies: - build-win64 variables: *variables-win64 test-macos-x86_64: <<: *test extends: build-macos-x86_64 dependencies: - build-macos-x86_64 variables: *variables-macos-x86_64 .release: &release stage: release script: | set -x _VERSION=$(./version.sh | grep _VERSION -| cut -d\ -f4-| sed 's, ,-,g' | sed 's,",,') mv x264${_PLATFORMSUFFIX} x264-${_VERSION}${_PLATFORMSUFFIX} when: manual only: - master@videolan/x264 - stable@videolan/x264 artifacts: name: "$CI_PROJECT_PATH_SLUG-$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA" paths: - x264-*${_PLATFORMSUFFIX} expire_in: '10 minutes' release-debian-amd64: <<: *release extends: build-debian-amd64 dependencies: - build-debian-amd64 variables: *variables-debian-amd64 release-debian-aarch64: <<: *release extends: build-debian-aarch64 dependencies: - build-debian-aarch64 variables: *variables-debian-aarch64 release-win32: <<: *release extends: build-win32 dependencies: - build-win32 variables: *variables-win32 release-win64: <<: *release extends: build-win64 dependencies: - build-win64 variables: *variables-win64 release-macos-x86_64: <<: *release extends: build-macos-x86_64 dependencies: - build-macos-x86_64 variables: *variables-macos-x86_64 release-macos-arm64: <<: *release extends: build-macos-arm64 dependencies: - build-macos-arm64 variables: *variables-macos-arm64 x264-0.163.3060+git5db6aa6/autocomplete.c0000664000175000017500000002457714203542064016005 0ustar ricorico/***************************************************************************** * autocomplete: x264cli shell autocomplete ***************************************************************************** * Copyright (C) 2018-2021 x264 project * * Authors: Henrik Gramner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. * * This program is also available under a commercial proprietary license. * For more information, contact us at licensing@x264.com. *****************************************************************************/ #include "x264cli.h" #include "input/input.h" #if HAVE_LAVF #undef DECLARE_ALIGNED #include #include #endif static const char * const level_names[] = { "1", "1.1", "1.2", "1.3", "1b", "2", "2.1", "2.2", "3", "3.1", "3.2", "4", "4.1", "4.2", "5", "5.1", "5.2", "6", "6.1", "6.2", NULL }; /* Options requiring a value for which we provide suggestions. */ static const char * const opts_suggest[] = { "--alternative-transfer", "--aq-mode", "--asm", "--avcintra-class", "--avcintra-flavor", "--b-adapt", "--b-pyramid", "--colormatrix", "--colorprim", "--cqm", "--demuxer", "--direct", "--frame-packing", "--input-csp", "--input-fmt", "--input-range", "--level", "--log-level", "--me", "--muxer", "--nal-hrd", "--output-csp", "--overscan", "--pass", "-p", "--preset", "--profile", "--pulldown", "--range", "--subme", "-m", "--transfer", "--trellis", "-t", "--tune", "--videoformat", "--weightp", NULL }; /* Options requiring a value for which we don't provide suggestions. */ static const char * const opts_nosuggest[] = { "--b-bias", "--bframes", "-b", "--deblock", "-f", "--bitrate", "-B", "--chroma-qp-offset", "--chromaloc", "--cplxblur", "--cqm4", "--cqm4i", "--cqm4ic", "--cqm4iy", "--cqm4p", "--cqm4pc", "--cqm4py", "--cqm8", "--cqm8i", "--cqm8p", "--crf", "--crf-max", "--crop-rect", "--deadzone-inter", "--deadzone-intra", "--fps", "--frames", "--input-depth", "--input-res", "--ipratio", "--keyint", "-I", "--lookahead-threads", "--mastering-display", "--cll", "--merange", "--min-keyint", "-i", "--mvrange", "--mvrange-thread", "--nr", "--opencl-device", "--output-depth", "--partitions", "-A", "--pbratio", "--psy-rd", "--qblur", "--qcomp", "--qp", "-q", "--qpmax", "--qpmin", "--qpstep", "--ratetol", "--ref", "-r", "--rc-lookahead", "--sar", "--scenecut", "--seek", "--slices", "--slices-max", "--slice-max-size", "--slice-max-mbs", "--slice-min-mbs", "--sps-id", "--sync-lookahead", "--threads", "--timebase", "--vbv-bufsize", "--vbv-init", "--vbv-maxrate", "--video-filter", "--vf", "--zones", NULL }; /* Options requiring a filename. */ static const char * const opts_filename[] = { "--cqmfile", "--dump-yuv", "--index", "--opencl-clbin", "--output", "-o", "--qpfile", "--stats", "--tcfile-in", "--tcfile-out", NULL }; /* Options without an associated value. */ static const char * const opts_standalone[] = { "--8x8dct", "--aud", "--bff", "--bluray-compat", "--cabac", "--constrained-intra", "--cpu-independent", "--dts-compress", "--fake-interlaced", "--fast-pskip", "--filler", "--force-cfr", "--mbtree", "--mixed-refs", "--no-8x8dct", "--no-asm", "--no-cabac", "--no-chroma-me", "--no-dct-decimate", "--no-deblock", "--no-fast-pskip", "--no-mbtree", "--no-mixed-refs", "--no-progress", "--no-psy", "--no-scenecut", "--no-weightb", "--non-deterministic", "--open-gop", "--opencl", "--pic-struct", "--psnr", "--quiet", "--sliced-threads", "--slow-firstpass", "--ssim", "--stitchable", "--tff", "--thread-input", "--verbose", "-v", "--weightb", NULL }; /* Options which shouldn't be suggested in combination with other options. */ static const char * const opts_special[] = { "--fullhelp", "--help", "-h", "--longhelp", "--version", NULL }; static int list_contains( const char * const *list, const char *s ) { if( *s ) for( ; *list; list++ ) if( !strcmp( *list, s ) ) return 1; return 0; } static void suggest( const char *s, const char *cur, int cur_len ) { if( s && *s && !strncmp( s, cur, cur_len ) ) printf( "%s\n", s ); } static void suggest_lower( const char *s, const char *cur, int cur_len ) { if( s && *s && !strncasecmp( s, cur, cur_len ) ) { for( ; *s; s++ ) putchar( *s < 'A' || *s > 'Z' ? *s : *s | 0x20 ); putchar( '\n' ); } } static void suggest_num_range( int start, int end, const char *cur, int cur_len ) { char buf[16]; for( int i = start; i <= end; i++ ) { snprintf( buf, sizeof( buf ), "%d", i ); suggest( buf, cur, cur_len ); } } #if HAVE_LAVF /* Suggest each token in a string separated by delimiters. */ static void suggest_token( const char *s, int delim, const char *cur, int cur_len ) { if( s && *s ) { for( const char *tok_end; (tok_end = strchr( s, delim )); s = tok_end + 1 ) { int tok_len = tok_end - s; if( tok_len && tok_len >= cur_len && !strncmp( s, cur, cur_len ) ) printf( "%.*s\n", tok_len, s ); } suggest( s, cur, cur_len ); } } #endif #define OPT( opt ) else if( !strcmp( prev, opt ) ) #define OPT2( opt1, opt2 ) else if( !strcmp( prev, opt1 ) || !strcmp( prev, opt2 ) ) #define OPT_TYPE( type ) list_contains( opts_##type, prev ) #define suggest( s ) suggest( s, cur, cur_len ) #define suggest_lower( s ) suggest_lower( s, cur, cur_len ) #define suggest_list( list ) for( const char * const *s = list; *s; s++ ) suggest( *s ) #define suggest_num_range( start, end ) suggest_num_range( start, end, cur, cur_len ) #define suggest_token( s, delim ) suggest_token( s, delim, cur, cur_len ) int x264_cli_autocomplete( const char *prev, const char *cur ) { int cur_len = strlen( cur ); if( 0 ); OPT( "--alternative-transfer" ) suggest_list( x264_transfer_names ); OPT( "--aq-mode" ) suggest_num_range( 0, 3 ); OPT( "--asm" ) for( const x264_cpu_name_t *cpu = x264_cpu_names; cpu->flags; cpu++ ) suggest_lower( cpu->name ); OPT( "--avcintra-class" ) suggest_list( x264_avcintra_class_names ); OPT( "--avcintra-flavor" ) suggest_list( x264_avcintra_flavor_names ); OPT( "--b-adapt" ) suggest_num_range( 0, 2 ); OPT( "--b-pyramid" ) suggest_list( x264_b_pyramid_names ); OPT( "--colormatrix" ) suggest_list( x264_colmatrix_names ); OPT( "--colorprim" ) suggest_list( x264_colorprim_names ); OPT( "--cqm" ) suggest_list( x264_cqm_names ); OPT( "--demuxer" ) suggest_list( x264_demuxer_names ); OPT( "--direct" ) suggest_list( x264_direct_pred_names ); OPT( "--frame-packing" ) suggest_num_range( 0, 7 ); OPT( "--input-csp" ) { for( int i = X264_CSP_NONE+1; i < X264_CSP_CLI_MAX; i++ ) suggest( x264_cli_csps[i].name ); #if HAVE_LAVF for( const AVPixFmtDescriptor *d = NULL; (d = av_pix_fmt_desc_next( d )); ) suggest( d->name ); #endif } OPT( "--input-fmt" ) { #if HAVE_LAVF void *i = NULL; for( const AVInputFormat *f; (f = av_demuxer_iterate( &i )); ) suggest_token( f->name, ',' ); #endif } OPT( "--input-range" ) suggest_list( x264_range_names ); OPT( "--level" ) suggest_list( level_names ); OPT( "--log-level" ) suggest_list( x264_log_level_names ); OPT( "--me" ) suggest_list( x264_motion_est_names ); OPT( "--muxer" ) suggest_list( x264_muxer_names ); OPT( "--nal-hrd" ) suggest_list( x264_nal_hrd_names ); OPT( "--output-csp" ) suggest_list( x264_output_csp_names ); OPT( "--output-depth" ) { #if HAVE_BITDEPTH8 suggest( "8" ); #endif #if HAVE_BITDEPTH10 suggest( "10" ); #endif } OPT( "--overscan" ) suggest_list( x264_overscan_names ); OPT2( "--partitions", "-A" ) suggest_list( x264_partition_names ); OPT2( "--pass", "-p" ) suggest_num_range( 1, 3 ); OPT( "--preset" ) suggest_list( x264_preset_names ); OPT( "--profile" ) suggest_list( x264_valid_profile_names ); OPT( "--pulldown" ) suggest_list( x264_pulldown_names ); OPT( "--range" ) suggest_list( x264_range_names ); OPT2( "--subme", "-m" ) suggest_num_range( 0, 11 ); OPT( "--transfer" ) suggest_list( x264_transfer_names ); OPT2( "--trellis", "-t" ) suggest_num_range( 0, 2 ); OPT( "--tune" ) suggest_list( x264_tune_names ); OPT( "--videoformat" ) suggest_list( x264_vidformat_names ); OPT( "--weightp" ) suggest_num_range( 0, 2 ); else if( !OPT_TYPE( nosuggest ) && !OPT_TYPE( special ) ) { if( OPT_TYPE( filename ) || strncmp( cur, "--", 2 ) ) return 1; /* Fall back to default shell filename autocomplete. */ /* Suggest options. */ suggest_list( opts_suggest ); suggest_list( opts_nosuggest ); suggest_list( opts_filename ); suggest_list( opts_standalone ); /* Only suggest special options if no other options have been specified. */ if( !*prev ) suggest_list( opts_special ); } return 0; } x264-0.163.3060+git5db6aa6/x264res.manifest0000664000175000017500000000107414203542064016070 0ustar ricorico true UTF-8 x264-0.163.3060+git5db6aa6/Makefile0000664000175000017500000003221514203542064014564 0ustar ricorico# Makefile include config.mak vpath %.c $(SRCPATH) vpath %.h $(SRCPATH) vpath %.S $(SRCPATH) vpath %.asm $(SRCPATH) vpath %.rc $(SRCPATH) vpath %.manifest $(SRCPATH) CFLAGS += $(CFLAGSPROF) LDFLAGS += $(LDFLAGSPROF) GENERATED = all: default default: SRCS = common/osdep.c common/base.c common/cpu.c common/tables.c \ encoder/api.c SRCS_X = common/mc.c common/predict.c common/pixel.c common/macroblock.c \ common/frame.c common/dct.c common/cabac.c \ common/common.c common/rectangle.c \ common/set.c common/quant.c common/deblock.c common/vlc.c \ common/mvpred.c common/bitstream.c \ encoder/analyse.c encoder/me.c encoder/ratecontrol.c \ encoder/set.c encoder/macroblock.c encoder/cabac.c \ encoder/cavlc.c encoder/encoder.c encoder/lookahead.c SRCS_8 = SRCCLI = x264.c autocomplete.c input/input.c input/timecode.c input/raw.c \ input/y4m.c output/raw.c output/matroska.c output/matroska_ebml.c \ output/flv.c output/flv_bytestream.c filters/filters.c \ filters/video/video.c filters/video/source.c filters/video/internal.c \ filters/video/resize.c filters/video/fix_vfr_pts.c \ filters/video/select_every.c filters/video/crop.c SRCCLI_X = filters/video/cache.c filters/video/depth.c SRCSO = SRCCHK_X = tools/checkasm.c SRCEXAMPLE = example.c OBJS = OBJASM = OBJSO = OBJCLI = OBJCHK = OBJCHK_8 = OBJCHK_10 = OBJEXAMPLE = CONFIG := $(shell cat config.h) # Optional module sources ifneq ($(findstring HAVE_AVS 1, $(CONFIG)),) SRCCLI += input/avs.c endif ifneq ($(findstring HAVE_THREAD 1, $(CONFIG)),) SRCS_X += common/threadpool.c SRCCLI_X += input/thread.c endif ifneq ($(findstring HAVE_WIN32THREAD 1, $(CONFIG)),) SRCS += common/win32thread.c endif ifneq ($(findstring HAVE_LAVF 1, $(CONFIG)),) SRCCLI += input/lavf.c endif ifneq ($(findstring HAVE_FFMS 1, $(CONFIG)),) SRCCLI += input/ffms.c endif ifneq ($(findstring HAVE_GPAC 1, $(CONFIG)),) SRCCLI += output/mp4.c endif ifneq ($(findstring HAVE_LSMASH 1, $(CONFIG)),) SRCCLI += output/mp4_lsmash.c endif ifneq ($(AS),) # MMX/SSE optims SRCASM_X = ifeq ($(SYS_ARCH),X86) ARCH_X86 = yes SRCASM_X += common/x86/dct-32.asm \ common/x86/pixel-32.asm endif ifeq ($(SYS_ARCH),X86_64) ARCH_X86 = yes SRCASM_X += common/x86/dct-64.asm \ common/x86/trellis-64.asm endif ifdef ARCH_X86 SRCASM_X += common/x86/bitstream-a.asm \ common/x86/const-a.asm \ common/x86/cabac-a.asm \ common/x86/dct-a.asm \ common/x86/deblock-a.asm \ common/x86/mc-a.asm \ common/x86/mc-a2.asm \ common/x86/pixel-a.asm \ common/x86/predict-a.asm \ common/x86/quant-a.asm SRCS_X += common/x86/mc-c.c \ common/x86/predict-c.c OBJASM += common/x86/cpu-a.o ifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),) OBJASM += $(SRCASM_X:%.asm=%-8.o) common/x86/sad-a-8.o endif ifneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),) OBJASM += $(SRCASM_X:%.asm=%-10.o) common/x86/sad16-a-10.o endif OBJCHK += tools/checkasm-a.o endif # AltiVec optims ifeq ($(SYS_ARCH),PPC) SRCS_X += common/ppc/dct.c \ common/ppc/deblock.c \ common/ppc/mc.c \ common/ppc/pixel.c \ common/ppc/predict.c \ common/ppc/quant.c endif # NEON optims ifeq ($(SYS_ARCH),ARM) SRCASM_X = common/arm/bitstream-a.S \ common/arm/dct-a.S \ common/arm/deblock-a.S \ common/arm/mc-a.S \ common/arm/pixel-a.S \ common/arm/predict-a.S \ common/arm/quant-a.S SRCS_X += common/arm/mc-c.c \ common/arm/predict-c.c OBJASM += common/arm/cpu-a.o ifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),) OBJASM += $(SRCASM_X:%.S=%-8.o) endif ifneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),) OBJASM += $(SRCASM_X:%.S=%-10.o) endif OBJCHK += tools/checkasm-arm.o endif # AArch64 NEON optims ifeq ($(SYS_ARCH),AARCH64) SRCASM_X = common/aarch64/bitstream-a.S \ common/aarch64/cabac-a.S \ common/aarch64/dct-a.S \ common/aarch64/deblock-a.S \ common/aarch64/mc-a.S \ common/aarch64/pixel-a.S \ common/aarch64/predict-a.S \ common/aarch64/quant-a.S SRCS_X += common/aarch64/asm-offsets.c \ common/aarch64/mc-c.c \ common/aarch64/predict-c.c OBJASM += ifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),) OBJASM += $(SRCASM_X:%.S=%-8.o) endif ifneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),) OBJASM += $(SRCASM_X:%.S=%-10.o) endif OBJCHK += tools/checkasm-aarch64.o endif # MSA optims ifeq ($(SYS_ARCH),MIPS) ifneq ($(findstring HAVE_MSA 1, $(CONFIG)),) SRCS_X += common/mips/dct-c.c \ common/mips/deblock-c.c \ common/mips/mc-c.c \ common/mips/pixel-c.c \ common/mips/predict-c.c \ common/mips/quant-c.c endif endif endif ifneq ($(HAVE_GETOPT_LONG),1) SRCCLI += extras/getopt.c endif ifeq ($(SYS),WINDOWS) OBJCLI += $(if $(RC), x264res.o) ifneq ($(SONAME),) SRCSO += x264dll.c OBJSO += $(if $(RC), x264res.dll.o) endif endif ifeq ($(HAVE_OPENCL),yes) common/oclobj.h: common/opencl/x264-cl.h $(wildcard $(SRCPATH)/common/opencl/*.cl) cat $^ | $(SRCPATH)/tools/cltostr.sh $@ GENERATED += common/oclobj.h SRCS_8 += common/opencl.c encoder/slicetype-cl.c endif OBJS += $(SRCS:%.c=%.o) OBJCLI += $(SRCCLI:%.c=%.o) OBJSO += $(SRCSO:%.c=%.o) OBJEXAMPLE += $(SRCEXAMPLE:%.c=%.o) ifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),) OBJS += $(SRCS_X:%.c=%-8.o) $(SRCS_8:%.c=%-8.o) OBJCLI += $(SRCCLI_X:%.c=%-8.o) OBJCHK_8 += $(SRCCHK_X:%.c=%-8.o) checkasm: checkasm8$(EXE) endif ifneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),) OBJS += $(SRCS_X:%.c=%-10.o) OBJCLI += $(SRCCLI_X:%.c=%-10.o) OBJCHK_10 += $(SRCCHK_X:%.c=%-10.o) checkasm: checkasm10$(EXE) endif .PHONY: all default fprofiled clean distclean install install-* uninstall cli lib-* checkasm etags cli: x264$(EXE) lib-static: $(LIBX264) lib-shared: $(SONAME) $(LIBX264): $(GENERATED) .depend $(OBJS) $(OBJASM) rm -f $(LIBX264) $(AR)$@ $(OBJS) $(OBJASM) $(if $(RANLIB), $(RANLIB) $@) $(SONAME): $(GENERATED) .depend $(OBJS) $(OBJASM) $(OBJSO) $(LD)$@ $(OBJS) $(OBJASM) $(OBJSO) $(SOFLAGS) $(LDFLAGS) $(IMPLIBNAME): $(SONAME) ifneq ($(EXE),) .PHONY: x264 checkasm8 checkasm10 example x264: x264$(EXE) checkasm8: checkasm8$(EXE) checkasm10: checkasm10$(EXE) example: example$(EXE) endif x264$(EXE): $(GENERATED) .depend $(OBJCLI) $(CLI_LIBX264) $(LD)$@ $(OBJCLI) $(CLI_LIBX264) $(LDFLAGSCLI) $(LDFLAGS) checkasm8$(EXE): $(GENERATED) .depend $(OBJCHK) $(OBJCHK_8) $(LIBX264) $(LD)$@ $(OBJCHK) $(OBJCHK_8) $(LIBX264) $(LDFLAGS) checkasm10$(EXE): $(GENERATED) .depend $(OBJCHK) $(OBJCHK_10) $(LIBX264) $(LD)$@ $(OBJCHK) $(OBJCHK_10) $(LIBX264) $(LDFLAGS) example$(EXE): $(GENERATED) .depend $(OBJEXAMPLE) $(LIBX264) $(LD)$@ $(OBJEXAMPLE) $(LIBX264) $(LDFLAGS) $(OBJS) $(OBJSO): CFLAGS += $(CFLAGSSO) $(OBJCLI): CFLAGS += $(CFLAGSCLI) $(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK) $(OBJCHK_8) $(OBJCHK_10) $(OBJEXAMPLE): .depend %.o: %.c $(CC) $(CFLAGS) -c $< $(CC_O) %-8.o: %.c $(CC) $(CFLAGS) -c $< $(CC_O) -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 %-10.o: %.c $(CC) $(CFLAGS) -c $< $(CC_O) -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=10 %.o: %.asm common/x86/x86inc.asm common/x86/x86util.asm $(AS) $(ASFLAGS) -o $@ $< -@ $(if $(STRIP), $(STRIP) -x $@) # delete local/anonymous symbols, so they don't show up in oprofile %-8.o: %.asm common/x86/x86inc.asm common/x86/x86util.asm $(AS) $(ASFLAGS) -o $@ $< -DBIT_DEPTH=8 -Dprivate_prefix=x264_8 -@ $(if $(STRIP), $(STRIP) -x $@) %-10.o: %.asm common/x86/x86inc.asm common/x86/x86util.asm $(AS) $(ASFLAGS) -o $@ $< -DBIT_DEPTH=10 -Dprivate_prefix=x264_10 -@ $(if $(STRIP), $(STRIP) -x $@) %.o: %.S $(AS) $(ASFLAGS) -o $@ $< -@ $(if $(STRIP), $(STRIP) -x $@) # delete local/anonymous symbols, so they don't show up in oprofile %-8.o: %.S $(AS) $(ASFLAGS) -o $@ $< -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -@ $(if $(STRIP), $(STRIP) -x $@) %-10.o: %.S $(AS) $(ASFLAGS) -o $@ $< -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=10 -@ $(if $(STRIP), $(STRIP) -x $@) %.dll.o: %.rc x264.h $(RC) $(RCFLAGS)$@ -DDLL $< %.o: %.rc x264.h x264res.manifest $(RC) $(RCFLAGS)$@ $< .depend: config.mak @rm -f .depend @echo 'dependency file generation...' ifeq ($(COMPILER),CL) @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS) $(SRCCLI) $(SRCSO) $(SRCEXAMPLE)), $(SRCPATH)/tools/msvsdepend.sh "$(CC)" "$(CFLAGS)" "$(SRC)" "$(SRC:$(SRCPATH)/%.c=%.o)" 1>> .depend;) ifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),) @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS_X) $(SRCS_8) $(SRCCLI_X) $(SRCCHK_X)), $(SRCPATH)/tools/msvsdepend.sh "$(CC)" "$(CFLAGS)" "$(SRC)" "$(SRC:$(SRCPATH)/%.c=%-8.o)" 1>> .depend;) endif ifneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),) @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS_X) $(SRCCLI_X) $(SRCCHK_X)), $(SRCPATH)/tools/msvsdepend.sh "$(CC)" "$(CFLAGS)" "$(SRC)" "$(SRC:$(SRCPATH)/%.c=%-10.o)" 1>> .depend;) endif else @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS) $(SRCCLI) $(SRCSO) $(SRCEXAMPLE)), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:$(SRCPATH)/%.c=%.o) $(DEPMM) 1>> .depend;) ifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),) @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS_X) $(SRCS_8) $(SRCCLI_X) $(SRCCHK_X)), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:$(SRCPATH)/%.c=%-8.o) $(DEPMM) 1>> .depend;) endif ifneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),) @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS_X) $(SRCCLI_X) $(SRCCHK_X)), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:$(SRCPATH)/%.c=%-10.o) $(DEPMM) 1>> .depend;) endif endif config.mak: ./configure depend: .depend ifneq ($(wildcard .depend),) include .depend endif OBJPROF = $(OBJS) $(OBJSO) $(OBJCLI) # These should cover most of the important codepaths OPT0 = --crf 30 -b1 -m1 -r1 --me dia --no-cabac --direct temporal --ssim --no-weightb OPT1 = --crf 16 -b2 -m3 -r3 --me hex --no-8x8dct --direct spatial --no-dct-decimate -t0 --slice-max-mbs 50 OPT2 = --crf 26 -b4 -m5 -r2 --me hex --cqm jvt --nr 100 --psnr --no-mixed-refs --b-adapt 2 --slice-max-size 1500 OPT3 = --crf 18 -b3 -m9 -r5 --me umh -t1 -A all --b-pyramid normal --direct auto --no-fast-pskip --no-mbtree OPT4 = --crf 22 -b3 -m7 -r4 --me esa -t2 -A all --psy-rd 1.0:1.0 --slices 4 OPT5 = --frames 50 --crf 24 -b3 -m10 -r3 --me tesa -t2 OPT6 = --frames 50 -q0 -m9 -r2 --me hex -Aall OPT7 = --frames 50 -q0 -m2 -r1 --me hex --no-cabac ifeq (,$(VIDS)) fprofiled: @echo 'usage: make fprofiled VIDS="infile1 infile2 ..."' @echo 'where infiles are anything that x264 understands,' @echo 'i.e. YUV with resolution in the filename, y4m, or avisynth.' else fprofiled: clean $(MAKE) x264$(EXE) CFLAGSPROF="$(PROF_GEN_CC)" LDFLAGSPROF="$(PROF_GEN_LD)" $(foreach V, $(VIDS), $(foreach I, 0 1 2 3 4 5 6 7, ./x264$(EXE) $(OPT$I) --threads 1 $(V) -o $(DEVNULL) ;)) ifeq ($(COMPILER),CL) # Because Visual Studio timestamps the object files within the PGD, it fails to build if they change - only the executable should be deleted rm -f x264$(EXE) else rm -f $(OBJPROF) endif $(MAKE) CFLAGSPROF="$(PROF_USE_CC)" LDFLAGSPROF="$(PROF_USE_LD)" rm -f $(OBJPROF:%.o=%.gcda) $(OBJPROF:%.o=%.gcno) *.dyn pgopti.dpi pgopti.dpi.lock *.pgd *.pgc endif clean: rm -f $(OBJS) $(OBJASM) $(OBJCLI) $(OBJSO) $(GENERATED) .depend TAGS rm -f $(SONAME) *.a *.lib *.exp *.pdb x264$(EXE) x264_lookahead.clbin rm -f checkasm8$(EXE) checkasm10$(EXE) $(OBJCHK) $(OBJCHK_8) $(OBJCHK_10) rm -f example$(EXE) $(OBJEXAMPLE) rm -f $(OBJPROF:%.o=%.gcda) $(OBJPROF:%.o=%.gcno) *.dyn pgopti.dpi pgopti.dpi.lock *.pgd *.pgc distclean: clean rm -f config.mak x264_config.h config.h config.log x264.pc x264.def rm -rf conftest* install-cli: cli $(INSTALL) -d $(DESTDIR)$(bindir) $(INSTALL) x264$(EXE) $(DESTDIR)$(bindir) install-lib-dev: $(INSTALL) -d $(DESTDIR)$(includedir) $(DESTDIR)$(libdir)/pkgconfig $(INSTALL) -m 644 $(SRCPATH)/x264.h x264_config.h $(DESTDIR)$(includedir) $(INSTALL) -m 644 x264.pc $(DESTDIR)$(libdir)/pkgconfig install-lib-static: lib-static install-lib-dev $(INSTALL) -d $(DESTDIR)$(libdir) $(INSTALL) -m 644 $(LIBX264) $(DESTDIR)$(libdir) $(if $(RANLIB), $(RANLIB) $(DESTDIR)$(libdir)/$(LIBX264)) install-lib-shared: lib-shared install-lib-dev $(INSTALL) -d $(DESTDIR)$(libdir) ifneq ($(IMPLIBNAME),) $(INSTALL) -d $(DESTDIR)$(bindir) $(INSTALL) -m 755 $(SONAME) $(DESTDIR)$(bindir) $(INSTALL) -m 644 $(IMPLIBNAME) $(DESTDIR)$(libdir) else ifneq ($(SONAME),) ln -f -s $(SONAME) $(DESTDIR)$(libdir)/libx264.$(SOSUFFIX) $(INSTALL) -m 755 $(SONAME) $(DESTDIR)$(libdir) endif install-bashcompletion: ifneq ($(BASHCOMPLETIONSDIR),) $(INSTALL) -d $(DESTDIR)$(BASHCOMPLETIONSDIR) $(INSTALL) -m 644 $(SRCPATH)/tools/bash-autocomplete.sh $(DESTDIR)$(BASHCOMPLETIONSDIR)/x264 endif uninstall: rm -f $(DESTDIR)$(includedir)/x264.h $(DESTDIR)$(includedir)/x264_config.h $(DESTDIR)$(libdir)/libx264.a rm -f $(DESTDIR)$(bindir)/x264$(EXE) $(DESTDIR)$(libdir)/pkgconfig/x264.pc ifneq ($(IMPLIBNAME),) rm -f $(DESTDIR)$(bindir)/$(SONAME) $(DESTDIR)$(libdir)/$(IMPLIBNAME) else ifneq ($(SONAME),) rm -f $(DESTDIR)$(libdir)/$(SONAME) $(DESTDIR)$(libdir)/libx264.$(SOSUFFIX) endif ifneq ($(BASHCOMPLETIONSDIR),) rm -f $(DESTDIR)$(BASHCOMPLETIONSDIR)/x264 endif etags TAGS: etags $(SRCS) $(SRCS_X) $(SRCS_8) x264-0.163.3060+git5db6aa6/doc/0000775000175000017500000000000014203542064013666 5ustar ricoricox264-0.163.3060+git5db6aa6/doc/threads.txt0000664000175000017500000001241214203542064016061 0ustar ricoricoHistorical notes: Slice-based threads was the original threading model of x264. It was replaced with frame-based threads in r607. This document was originally written at that time. Slice-based threading was brought back (as an optional mode) in r1364 for low-latency encoding. Furthermore, frame-based threading was modified significantly in r1246, with the addition of threaded lookahead. Old threading method: slice-based application calls x264 x264 runs B-adapt and ratecontrol (serial) split frame into several slices, and spawn a thread for each slice wait until all threads are done deblock and hpel filter (serial) return to application In x264cli, there is one additional thread to decode the input. New threading method: frame-based application calls x264 x264 requests a frame from lookahead, which runs B-adapt and ratecontrol parallel to the current thread, separated by a buffer of size sync-lookahead spawn a thread for this frame thread runs encode, deblock, hpel filter meanwhile x264 waits for the oldest thread to finish return to application, but the rest of the threads continue running in the background No additional threads are needed to decode the input, unless decoding is slower than slice+deblock+hpel, in which case an additional input thread would allow decoding in parallel. Penalties for slice-based threading: Each slice adds some bitrate (or equivalently reduces quality), for a variety of reasons: the slice header costs some bits, cabac contexts are reset, mvs and intra samples can't be predicted across the slice boundary. In CBR mode, multiple slices encode simultaneously, thus increasing the maximum misprediction possible with VBV. Some parts of the encoder are serial, so it doesn't scale well with lots of cpus. Some numbers on penalties for slicing: Tested at 720p with 45 slices (one per mb row) to maximize the total cost for easy measurement. Averaged over 4 movies at crf20 and crf30. Total cost: +30% bitrate at constant psnr. I enabled the various components of slicing one at a time, and measured the portion of that cost they contribute: * 34% intra prediction * 25% redundant slice headers, nal headers, and rounding to whole bytes * 16% mv prediction * 16% reset cabac contexts * 6% deblocking between slices (you don't strictly have to turn this off just for standard compliance, but you do if you want to use slices for decoder multithreading) * 2% cabac neighbors (cbp, skip, etc) The proportional cost of redundant headers should certainly depend on bitrate (since the header size is constant and everything else depends on bitrate). Deblocking should too (due to varing deblock strength). But none of the proportions should depend strongly on the number of slices: some are triggered per slice while some are triggered per macroblock-that's-on-the-edge-of-a-slice, but as long as there's no more than 1 slice per row, the relative frequency of those two conditions is determined solely by the image width. Penalties for frame-base threading: To allow encoding of multiple frames in parallel, we have to ensure that any given macroblock uses motion vectors only from pieces of the reference frames that have been encoded already. This is usually not noticeable, but can matter for very fast upward motion. We have to commit to one frame type before starting on the frame. Thus scenecut detection must run during the lowres pre-motion-estimation along with B-adapt, which makes it faster but less accurate than re-encoding the whole frame. Ratecontrol gets delayed feedback, since it has to plan frame N before frame N-1 finishes. Benchmarks: cpu: 8core Nehalem (2x E5520) 2.27GHz, hyperthreading disabled kernel: linux 2.6.34.7, 64-bit x264: r1732 b20059aa input: http://media.xiph.org/video/derf/y4m/1080p/park_joy_1080p.y4m NOTE: the "thread count" listed below does not count the lookahead thread, only encoding threads. This is why for "veryfast", the speedup for 2 and 3 threads exceeds the logical limit. threads speedup psnr slice frame slice frame x264 --preset veryfast --tune psnr --crf 30 1: 1.00x 1.00x +0.000 +0.000 2: 1.41x 2.29x -0.005 -0.002 3: 1.70x 3.65x -0.035 +0.000 4: 1.96x 3.97x -0.029 -0.001 5: 2.10x 3.98x -0.047 -0.002 6: 2.29x 3.97x -0.060 +0.001 7: 2.36x 3.98x -0.057 -0.001 8: 2.43x 3.98x -0.067 -0.001 9: 3.96x +0.000 10: 3.99x +0.000 11: 4.00x +0.001 12: 4.00x +0.001 x264 --preset medium --tune psnr --crf 30 1: 1.00x 1.00x +0.000 +0.000 2: 1.54x 1.59x -0.002 -0.003 3: 2.01x 2.81x -0.005 +0.000 4: 2.51x 3.11x -0.009 +0.000 5: 2.89x 4.20x -0.012 -0.000 6: 3.27x 4.50x -0.016 -0.000 7: 3.58x 5.45x -0.019 -0.002 8: 3.79x 5.76x -0.015 -0.002 9: 6.49x -0.000 10: 6.64x -0.000 11: 6.94x +0.000 12: 6.96x +0.000 x264 --preset slower --tune psnr --crf 30 1: 1.00x 1.00x +0.000 +0.000 2: 1.54x 1.83x +0.000 +0.002 3: 1.98x 2.21x -0.006 +0.002 4: 2.50x 2.61x -0.011 +0.002 5: 2.93x 3.94x -0.018 +0.003 6: 3.45x 4.19x -0.024 +0.001 7: 3.84x 4.52x -0.028 -0.001 8: 4.13x 5.04x -0.026 -0.001 9: 6.15x +0.001 10: 6.24x +0.001 11: 6.55x -0.001 12: 6.89x -0.001 x264-0.163.3060+git5db6aa6/doc/regression_test.txt0000664000175000017500000000114014203542064017642 0ustar ricoricoHere is one test method which checks that the encoder's view of decoded pictures in the same as the decoder's view. This ensures that there is no distortion besides what is inherently caused by compression. # Install and compile x264 : git clone git://git.videolan.org/x264.git x264 cd x264 ./configure make cd .. # Install and compile JM reference decoder : wget http://iphome.hhi.de/suehring/tml/download/jm17.2.zip unzip jm17.2.zip cd JM sh unixprep.sh cd ldecod make cd ../.. ./x264/x264 input.yuv --dump-yuv fdec.yuv -o output.h264 ./JM/bin/ldecod.exe -i output.h264 -o ref.yuv diff ref.yuv fdec.yuv x264-0.163.3060+git5db6aa6/doc/vui.txt0000664000175000017500000002073214203542064015236 0ustar ricoricoVideo Usability Information (VUI) Guide by Christian Heine ( sennindemokrit at gmx dot net ) 1. Sample Aspect Ratio ----------------------- * What is it? The Sample Aspect Ratio (SAR) (sometimes called Pixel Aspect Ratio or just Pel Aspect Ratio) is defined as the ratio of the width of the sample to the height of the sample. While pixels on a computer monitor generally are "square" meaning that their SAR is 1:1, digitized video usually has rather odd SARs. Playback of material with a particular SAR on a system with a different SAR will result in a stretched/squashed image. A correction is necessary that relies on the knowledge of both SARs. * How do I use it? You can derive the SAR of an image from the width, height and the display aspect ratio (DAR) of the image as follows: SAR_x DAR_x * height ----- = -------------- SAR_y DAR_y * width for example: width x height = 704x576, DAR = 4:3 ==> SAR = 2304:2112 or 12:11 Please note that if your material is a digitized analog signal, you should not use this equation to calculate the SAR. Refer to the manual of your digitizing equipment or this link instead. A Quick Guide to Digital Video Resolution and Aspect Ratio Conversions http://www.iki.fi/znark/video/conversion/ * Should I use this option? In one word: yes. Most decoders/ media players nowadays support automatic correction of aspect ratios, and there are just few exceptions. You should even use it, if the SAR of your material is 1:1, as the default of x264 is "SAR not defined". 2. Overscan ------------ * What is it? The term overscan generally refers to all regions of an image that do not contain information but are added to achieve a certain resolution or aspect ratio. A "letterboxed" image therefore has overscan at the top and the bottom. This is not the overscan this option refers to. Neither refers it to the overscan that is added as part of the process of digitizing an analog signal. Instead it refers to the "overscan" process on a display that shows only a part of the image. What that part is depends on the display. * How do I use this option? As I'm not sure about what part of the image is shown when the display uses an overscan process, I can't provide you with rules or examples. The safe assumption would be "overscan=show" as this always shows the whole image. Use "overscan=crop" only if you are sure about the consequences. You may also use the default value ("undefined"). * Should I use this option? Only if you know exactly what you are doing. Don't use it on video streams that have general overscan. Instead try to to crop the borders before encoding and benefit from the higher bitrate/ image quality. Furthermore the H264 specification says that the setting "overscan=show" must be respected, but "overscan=crop" may be ignored. In fact most playback equipment ignores this setting and shows the whole image. 3. Video Format ---------------- * What is it? A purely informative setting, that explains what the type of your analog video was, before you digitized it. * How do I use this option? Just set it to the desired value. ( e.g. NTSC, PAL ) If you transcode from MPEG2, you may find the value for this option in the m2v bitstream. (see ITU-T Rec. H262 / ISO/IEC 13818-2 for details) * Should I use this option? That is entirely up to you. I have no idea how this information would ever be relevant. I consider it to be informative only. 4. Full Range -------------- * What is it? Another relic from digitizing analog video. When digitizing analog video the digital representation of the luma and chroma levels is limited to lie within 16..235 and 16..240 respectively. Playback equipment usually assumes all digitized samples to be within this range. However most DVDs use the full range of 0..255 for luma and chroma samples, possibly resulting in an oversaturation when played back on that equipment. To avoid this a range correction is needed. * How do I use this option? If your source material is a digitized analog video/TV broadcast it is quite possible that it is range limited. If you can make sure that it is range limited you can safely set full range to off. If you are not sure or want to make sure that your material is played back without oversaturation, set if to on. Please note that the default for this option in x264 is off, which is not a safe assumption. * Should I use this option? Yes, but there are few decoders/ media players that distinguish between the two options. 5. Color Primaries, Transfer Characteristics, Matrix Coefficients ------------------------------------------------------------------- * What is it? A videophile setting. The average users won't ever need it. Not all monitor models show all colors the same way. When comparing the same image on two different monitor models you might find that one of them "looks more blue", while the other "looks more green". Bottom line is, each monitor model has a different color profile, which can be used to correct colors in a way, that images look almost the same on all monitors. The same goes for printers and film/ video digitizing equipment. If the color profile of the digitizing equipment is known, it is possible to correct the colors and gamma of the decoded h264 stream in a way that the video stream looks the same, regardless of the digitizing equipment used. * How do I use these options? If you are able to find out which characteristics your digitizing equipment uses, (see the equipment documentation or make reference measurements) then find the most suitable characteristics in the list of available characteristics (see H264 Annex E) and pass it to x264. Otherwise leave it to the default (unspecified). If you transcode from MPEG2, you may find the values for these options in the m2v bitstream. (see ITU-T Rec. H262 / ISO/IEC 13818-2 for details) * Should I use these options? Only if you know exactly what you are doing. The default setting is better than a wrong one. Use of this option is not a bad idea though. Unfortunately I don't know any decoder/ media player that ever even attempted color/gamma/color matrix correction. 6. Chroma Sample Location -------------------------- * What is it? A videophile setting. The average user won't ever notice a difference. Due to a weakness of the eye, it is often economic to reduce the number of chroma samples in a process called subsampling. In particular x264 uses only one chroma sample of each chroma channel every block of 2x2 luma samples. There are a number of possibilities on how this subsampling is done, each resulting in another relative location of the chroma sample towards the luma samples. The Chroma Sample Location matters when the subsampling process is reversed, e.g. the number of chroma samples is increased. This is most likely to happen at color space conversions. If it is not done correctly the chroma values may appear shifted compared to the luma samples by at most 1 pixel, or strangely blurred. * How do I use this option? Because x264 does no subsampling, since it only accepts already subsampled input frames, you have to determine the method yourself. If you transcode from MPEG1 with proper subsampled 4:2:0, and don't do any color space conversion, you should set this option to 1. If you transcode from MPEG2 with proper subsampled 4:2:0, and don't do any color space conversion, you should set this option to 0. If you transcode from MPEG4 with proper subsampled 4:2:0, and don't do any color space conversion, you should set this option to 0. If you do the color space conversion yourself this isn't that easy. If the filter kernel of the subsampling is ( 0.5, 0.5 ) in one direction then the chroma sample location in that direction is between the two luma samples. If your filter kernel is ( 0.25, 0.5, 0.25 ) in one direction then the chroma sample location in that direction is equal to one of the luma samples. H264 Annex E contains images that tell you how to "transform" your Chroma Sample Location into a value of 0 to 5 that you can pass to x264. * Should I use this option? Unless you are a perfectionist, don't bother. Media players ignore this setting, and favor their own (fixed) assumed Chroma Sample Location. x264-0.163.3060+git5db6aa6/doc/standards.txt0000664000175000017500000000134014203542064016410 0ustar ricoricox264 is written in C. The particular variant of C is: intersection of C99 and gcc>=3.4. checkasm is written in gcc, with no attempt at compatibility with anything else. We make the following additional assumptions which are true of real systems but not guaranteed by C99: * Two's complement. * Signed right-shifts are sign-extended. * int is 32-bit or larger. x86-specific assumptions: * The stack is 16-byte aligned. We align it on entry to libx264 and on entry to any thread, but the compiler must preserve alignment after that. * We call emms before any float operation and before returning from libx264, not after each mmx operation. So bad things could happen if the compiler inserts float operations where they aren't expected. x264-0.163.3060+git5db6aa6/doc/ratecontrol.txt0000664000175000017500000001203614203542064016765 0ustar ricoricoA qualitative overview of x264's ratecontrol methods By Loren Merritt Historical note: This document is outdated, but a significant part of it is still accurate. Here are some important ways ratecontrol has changed since the authoring of this document: - By default, MB-tree is used instead of qcomp for weighting frame quality based on complexity. MB-tree is effectively a generalization of qcomp to the macroblock level. MB-tree also replaces the constant offsets for B-frame quantizers. The legacy algorithm is still available for low-latency applications. - Adaptive quantization is now used to distribute quality among each frame; frames are no longer constant quantizer, even if MB-tree is off. - VBV runs per-row rather than per-frame to improve accuracy. x264's ratecontrol is based on libavcodec's, and is mostly empirical. But I can retroactively propose the following theoretical points which underlie most of the algorithms: - You want the movie to be somewhere approaching constant quality. However, constant quality does not mean constant PSNR nor constant QP. Details are less noticeable in high-complexity or high-motion scenes, so you can get away with somewhat higher QP for the same perceived quality. - On the other hand, you get more quality per bit if you spend those bits in scenes where motion compensation works well: A given artifact may stick around several seconds in a low-motion scene, and you only have to fix it in one frame to improve the quality of the whole scene. - Both of the above are correlated with the number of bits it takes to encode a frame at a given QP. - Given one encoding of a frame, we can predict the number of bits needed to encode it at a different QP. This prediction gets less accurate if the QPs are far apart. - The importance of a frame depends on the number of other frames that are predicted from it. Hence I-frames get reduced QP depending on the number and complexity of following inter-frames, disposable B-frames get higher QP than P-frames, and referenced B-frames are between P-frames and disposable B-frames. The modes: 2pass: Given some data about each frame of a 1st pass (e.g. generated by 1pass ABR, below), we try to choose QPs to maximize quality while matching a specified total size. This is separated into 3 parts: (1) Before starting the 2nd pass, select the relative number of bits to allocate between frames. This pays no attention to the total size of the encode. The default formula, empirically selected to balance between the 1st 2 theoretical points, is "complexity ** 0.6", where complexity is defined to be the bit size of the frame at a constant QP (estimated from the 1st pass). (2) Scale the results of (1) to fill the requested total size. Optional: Impose VBV limitations. Due to nonlinearities in the frame size predictor and in VBV, this is an iterative process. (3) Now start encoding. After each frame, update future QPs to compensate for mispredictions in size. If the 2nd pass is consistently off from the predicted size (usually because we use slower compression options than the 1st pass), then we multiply all future frames' qscales by the reciprocal of the error. Additionally, there is a short-term compensation to prevent us from deviating too far from the desired size near the beginning (when we don't have much data for the global compensation) and near the end (when global doesn't have time to react). 1pass, average bitrate: The goal is the same as in 2pass, but here we don't have the benefit of a previous encode, so all ratecontrol must be done during the encode. (1) This is the same as in 2pass, except that instead of estimating complexity from a previous encode, we run a fast motion estimation algo over a half-resolution version of the frame, and use the SATD residuals (these are also used in the decision between P- and B-frames). Also, we don't know the size or complexity of the following GOP, so I-frame bonus is based on the past. (2) We don't know the complexities of future frames, so we can only scale based on the past. The scaling factor is chosen to be the one that would have resulted in the desired bitrate if it had been applied to all frames so far. (3) Overflow compensation is the same as in 2pass. By tuning the strength of compensation, you can get anywhere from near the quality of 2pass (but unpredictable size, like +- 10%) to reasonably strict filesize but lower quality. 1pass, constant bitrate (VBV compliant): (1) Same as ABR. (2) Scaling factor is based on a local average (dependent on VBV buffer size) instead of all past frames. (3) Overflow compensation is stricter, and has an additional term to hard limit the QPs if the VBV is near empty. Note that no hard limit is done for a full VBV, so CBR may use somewhat less than the requested bitrate. Note also that if a frame violates VBV constraints despite the best efforts of prediction, it is not re-encoded. 1pass, constant ratefactor: (1) Same as ABR. (2) The scaling factor is a constant based on the --crf argument. (3) No overflow compensation is done. constant quantizer: QPs are simply based on frame type. x264-0.163.3060+git5db6aa6/x264.c0000664000175000017500000026471314203542064014005 0ustar ricorico/***************************************************************************** * x264: top-level x264cli functions ***************************************************************************** * Copyright (C) 2003-2021 x264 project * * Authors: Loren Merritt * Laurent Aimar * Steven Walters * Fiona Glaser * Kieran Kunhya * Henrik Gramner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. * * This program is also available under a commercial proprietary license. * For more information, contact us at licensing@x264.com. *****************************************************************************/ #ifdef _WIN32 /* The following two defines must be located before the inclusion of any system header files. */ #define WINVER 0x0500 #define _WIN32_WINNT 0x0500 #include #include /* _setmode() */ #include /* _O_BINARY */ #endif #include #include #include "x264cli.h" #include "input/input.h" #include "output/output.h" #include "filters/filters.h" #define QP_MAX_SPEC (51+6*2) #define QP_MAX (QP_MAX_SPEC+18) #define FAIL_IF_ERROR( cond, ... ) FAIL_IF_ERR( cond, "x264", __VA_ARGS__ ) #if HAVE_LAVF #undef DECLARE_ALIGNED #include #include #include #endif #if HAVE_SWSCALE #undef DECLARE_ALIGNED #include #endif #if HAVE_FFMS #include #endif #if HAVE_GPAC #include #endif #if HAVE_LSMASH #include #endif #ifdef _WIN32 #define CONSOLE_TITLE_SIZE 200 static wchar_t org_console_title[CONSOLE_TITLE_SIZE] = L""; void x264_cli_set_console_title( const char *title ) { wchar_t title_utf16[CONSOLE_TITLE_SIZE]; if( MultiByteToWideChar( CP_UTF8, MB_ERR_INVALID_CHARS, title, -1, title_utf16, CONSOLE_TITLE_SIZE ) ) SetConsoleTitleW( title_utf16 ); } /* Retrieve command line arguments as UTF-8. */ static int get_argv_utf8( int *argc_ptr, char ***argv_ptr ) { int ret = 0; wchar_t **argv_utf16 = CommandLineToArgvW( GetCommandLineW(), argc_ptr ); if( argv_utf16 ) { int argc = *argc_ptr; int offset = (argc+1) * sizeof(char*); int size = offset; for( int i = 0; i < argc; i++ ) size += WideCharToMultiByte( CP_UTF8, 0, argv_utf16[i], -1, NULL, 0, NULL, NULL ); char **argv = *argv_ptr = malloc( size ); if( argv ) { for( int i = 0; i < argc; i++ ) { argv[i] = (char*)argv + offset; offset += WideCharToMultiByte( CP_UTF8, 0, argv_utf16[i], -1, argv[i], size-offset, NULL, NULL ); } argv[argc] = NULL; ret = 1; } LocalFree( argv_utf16 ); } return ret; } #endif /* Ctrl-C handler */ static volatile int b_ctrl_c = 0; static void sigint_handler( int a ) { b_ctrl_c = 1; } typedef struct { int b_progress; int i_seek; hnd_t hin; hnd_t hout; FILE *qpfile; FILE *tcfile_out; double timebase_convert_multiplier; int i_pulldown; } cli_opt_t; /* file i/o operation structs */ cli_input_t cli_input; static cli_output_t cli_output; /* video filter operation struct */ static cli_vid_filter_t filter; const char * const x264_avcintra_class_names[] = { "50", "100", "200", 0 }; const char * const x264_cqm_names[] = { "flat", "jvt", 0 }; const char * const x264_log_level_names[] = { "none", "error", "warning", "info", "debug", 0 }; const char * const x264_partition_names[] = { "p8x8", "p4x4", "b8x8", "i8x8", "i4x4", "none", "all", 0 }; const char * const x264_pulldown_names[] = { "none", "22", "32", "64", "double", "triple", "euro", 0 }; const char * const x264_range_names[] = { "auto", "tv", "pc", 0 }; const char * const x264_output_csp_names[] = { #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT == X264_CSP_I400 "i400", #endif #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT == X264_CSP_I420 "i420", #endif #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT == X264_CSP_I422 "i422", #endif #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT == X264_CSP_I444 "i444", "rgb", #endif 0 }; const char * const x264_valid_profile_names[] = { #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT <= X264_CSP_I420 #if HAVE_BITDEPTH8 #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT == X264_CSP_I420 "baseline", "main", #endif "high", #endif #if HAVE_BITDEPTH10 "high10", #endif #endif #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT == X264_CSP_I422 "high422", #endif "high444", 0 }; const char * const x264_demuxer_names[] = { "auto", "raw", "y4m", #if HAVE_AVS "avs", #endif #if HAVE_LAVF "lavf", #endif #if HAVE_FFMS "ffms", #endif 0 }; const char * const x264_muxer_names[] = { "auto", "raw", "mkv", "flv", #if HAVE_GPAC || HAVE_LSMASH "mp4", #endif 0 }; static const char * const chroma_format_names[] = { [0] = "all", [X264_CSP_I400] = "i400", [X264_CSP_I420] = "i420", [X264_CSP_I422] = "i422", [X264_CSP_I444] = "i444" }; typedef struct { int mod; uint8_t pattern[24]; float fps_factor; } cli_pulldown_t; enum pulldown_type_e { X264_PULLDOWN_22 = 1, X264_PULLDOWN_32, X264_PULLDOWN_64, X264_PULLDOWN_DOUBLE, X264_PULLDOWN_TRIPLE, X264_PULLDOWN_EURO }; #define TB PIC_STRUCT_TOP_BOTTOM #define BT PIC_STRUCT_BOTTOM_TOP #define TBT PIC_STRUCT_TOP_BOTTOM_TOP #define BTB PIC_STRUCT_BOTTOM_TOP_BOTTOM static const cli_pulldown_t pulldown_values[] = { [X264_PULLDOWN_22] = {1, {TB}, 1.0}, [X264_PULLDOWN_32] = {4, {TBT, BT, BTB, TB}, 1.25}, [X264_PULLDOWN_64] = {2, {PIC_STRUCT_DOUBLE, PIC_STRUCT_TRIPLE}, 1.0}, [X264_PULLDOWN_DOUBLE] = {1, {PIC_STRUCT_DOUBLE}, 2.0}, [X264_PULLDOWN_TRIPLE] = {1, {PIC_STRUCT_TRIPLE}, 3.0}, [X264_PULLDOWN_EURO] = {24, {TBT, BT, BT, BT, BT, BT, BT, BT, BT, BT, BT, BT, BTB, TB, TB, TB, TB, TB, TB, TB, TB, TB, TB, TB}, 25.0/24.0} }; #undef TB #undef BT #undef TBT #undef BTB // indexed by pic_struct enum static const float pulldown_frame_duration[10] = { 0.0, 1, 0.5, 0.5, 1, 1, 1.5, 1.5, 2, 3 }; static void help( x264_param_t *defaults, int longhelp ); static int parse( int argc, char **argv, x264_param_t *param, cli_opt_t *opt ); static int encode( x264_param_t *param, cli_opt_t *opt ); /* logging and printing for within the cli system */ static int cli_log_level = X264_LOG_INFO; void x264_cli_log( const char *name, int i_level, const char *fmt, ... ) { if( i_level > cli_log_level ) return; char *s_level; switch( i_level ) { case X264_LOG_ERROR: s_level = "error"; break; case X264_LOG_WARNING: s_level = "warning"; break; case X264_LOG_INFO: s_level = "info"; break; case X264_LOG_DEBUG: s_level = "debug"; break; default: s_level = "unknown"; break; } fprintf( stderr, "%s [%s]: ", name, s_level ); va_list arg; va_start( arg, fmt ); x264_vfprintf( stderr, fmt, arg ); va_end( arg ); } void x264_cli_printf( int i_level, const char *fmt, ... ) { if( i_level > cli_log_level ) return; va_list arg; va_start( arg, fmt ); x264_vfprintf( stderr, fmt, arg ); va_end( arg ); } static void print_version_info( void ) { #ifdef X264_POINTVER printf( "x264 "X264_POINTVER"\n" ); #else printf( "x264 0.%d.X\n", X264_BUILD ); #endif #if HAVE_SWSCALE printf( "(libswscale %d.%d.%d)\n", LIBSWSCALE_VERSION_MAJOR, LIBSWSCALE_VERSION_MINOR, LIBSWSCALE_VERSION_MICRO ); #endif #if HAVE_LAVF printf( "(libavformat %d.%d.%d)\n", LIBAVFORMAT_VERSION_MAJOR, LIBAVFORMAT_VERSION_MINOR, LIBAVFORMAT_VERSION_MICRO ); #endif #if HAVE_FFMS printf( "(ffmpegsource %d.%d.%d.%d)\n", FFMS_VERSION >> 24, (FFMS_VERSION & 0xff0000) >> 16, (FFMS_VERSION & 0xff00) >> 8, FFMS_VERSION & 0xff ); #endif #if HAVE_GPAC printf( "(gpac " GPAC_VERSION ")\n" ); #endif #if HAVE_LSMASH printf( "(lsmash %d.%d.%d)\n", LSMASH_VERSION_MAJOR, LSMASH_VERSION_MINOR, LSMASH_VERSION_MICRO ); #endif printf( "built on " __DATE__ ", " ); #ifdef __INTEL_COMPILER printf( "intel: %.2f (%d)\n", __INTEL_COMPILER / 100.f, __INTEL_COMPILER_BUILD_DATE ); #elif defined(__clang__) printf( "clang: " __clang_version__ "\n" ); #elif defined(__GNUC__) printf( "gcc: " __VERSION__ "\n" ); #elif defined(_MSC_FULL_VER) printf( "msvc: %.2f (%u)\n", _MSC_VER / 100.f, _MSC_FULL_VER ); #else printf( "using an unknown compiler\n" ); #endif printf( "x264 configuration: --chroma-format=%s\n", chroma_format_names[X264_CHROMA_FORMAT] ); printf( "libx264 configuration: --chroma-format=%s\n", chroma_format_names[x264_chroma_format] ); printf( "x264 license: " ); #if HAVE_GPL printf( "GPL version 2 or later\n" ); #else printf( "Non-GPL commercial\n" ); #endif #if HAVE_SWSCALE const char *license = swscale_license(); printf( "libswscale%s%s license: %s\n", HAVE_LAVF ? "/libavformat" : "", HAVE_FFMS ? "/ffmpegsource" : "" , license ); if( !strcmp( license, "nonfree and unredistributable" ) || (!HAVE_GPL && (!strcmp( license, "GPL version 2 or later" ) || !strcmp( license, "GPL version 3 or later" )))) printf( "WARNING: This binary is unredistributable!\n" ); #endif } REALIGN_STACK int main( int argc, char **argv ) { if( argc == 4 && !strcmp( argv[1], "--autocomplete" ) ) return x264_cli_autocomplete( argv[2], argv[3] ); x264_param_t param; cli_opt_t opt = {0}; int ret = 0; FAIL_IF_ERROR( x264_threading_init(), "unable to initialize threading\n" ); #ifdef _WIN32 FAIL_IF_ERROR( !get_argv_utf8( &argc, &argv ), "unable to convert command line to UTF-8\n" ); GetConsoleTitleW( org_console_title, CONSOLE_TITLE_SIZE ); _setmode( _fileno( stdin ), _O_BINARY ); _setmode( _fileno( stdout ), _O_BINARY ); _setmode( _fileno( stderr ), _O_BINARY ); #endif x264_param_default( ¶m ); /* Parse command line */ if( parse( argc, argv, ¶m, &opt ) < 0 ) ret = -1; #ifdef _WIN32 /* Restore title; it can be changed by input modules */ SetConsoleTitleW( org_console_title ); #endif /* Control-C handler */ signal( SIGINT, sigint_handler ); if( !ret ) ret = encode( ¶m, &opt ); /* clean up handles */ if( filter.free ) filter.free( opt.hin ); else if( opt.hin ) cli_input.close_file( opt.hin ); if( opt.hout ) cli_output.close_file( opt.hout, 0, 0 ); if( opt.tcfile_out ) fclose( opt.tcfile_out ); if( opt.qpfile ) fclose( opt.qpfile ); x264_param_cleanup( ¶m ); #ifdef _WIN32 SetConsoleTitleW( org_console_title ); free( argv ); #endif return ret; } static char const *strtable_lookup( const char * const table[], int idx ) { int i = 0; while( table[i] ) i++; return ( idx >= 0 && idx < i && *table[idx] ) ? table[idx] : "???"; } static char *stringify_names( char *buf, const char * const names[] ) { int i = 0; char *p = buf; for( p[0] = 0; names[i]; i++ ) if( *names[i] ) { if( p != buf ) p += sprintf( p, ", " ); p += sprintf( p, "%s", names[i] ); } return buf; } #define INDENT " " #define INDENT_LEN 32 // strlen( INDENT ) #define SEPARATOR ", " #define SEPARATOR_LEN 2 // strlen( SEPARATOR ) static void print_csp_name_internal( const char *name, size_t *line_len, int last ) { if( name ) { size_t name_len = strlen( name ); if( *line_len + name_len > (80 - SEPARATOR_LEN) ) { printf( "\n" INDENT ); *line_len = INDENT_LEN; } printf( "%s", name ); *line_len += name_len; if( !last ) { printf( SEPARATOR ); *line_len += SEPARATOR_LEN; } } } static void print_csp_names( int longhelp ) { if( longhelp < 2 ) return; printf( " - valid csps for `raw' demuxer:\n" ); printf( INDENT ); size_t line_len = INDENT_LEN; for( int i = X264_CSP_NONE+1; i < X264_CSP_CLI_MAX; i++ ) print_csp_name_internal( x264_cli_csps[i].name, &line_len, i == X264_CSP_CLI_MAX-1 ); #if HAVE_LAVF printf( "\n" ); printf( " - valid csps for `lavf' demuxer:\n" ); printf( INDENT ); line_len = INDENT_LEN; for( enum AVPixelFormat i = AV_PIX_FMT_NONE+1; i < AV_PIX_FMT_NB; i++ ) print_csp_name_internal( av_get_pix_fmt_name( i ), &line_len, i == AV_PIX_FMT_NB-1 ); #endif printf( "\n" ); } static void help( x264_param_t *defaults, int longhelp ) { char buf[200]; #define H0 printf #define H1 if( longhelp >= 1 ) printf #define H2 if( longhelp == 2 ) printf H0( "x264 core:%d%s\n" "Syntax: x264 [options] -o outfile infile\n" "\n" "Infile can be raw (in which case resolution is required),\n" " or YUV4MPEG (*.y4m),\n" " or Avisynth if compiled with support (%s).\n" " or libav* formats if compiled with lavf support (%s) or ffms support (%s).\n" "Outfile type is selected by filename:\n" " .264 -> Raw bytestream\n" " .mkv -> Matroska\n" " .flv -> Flash Video\n" " .mp4 -> MP4 if compiled with GPAC or L-SMASH support (%s)\n" "Output bit depth: %s\n." "\n" "Options:\n" "\n" " -h, --help List basic options\n" " --longhelp List more options\n" " --fullhelp List all options\n" "\n", X264_BUILD, X264_VERSION, #if HAVE_AVS "yes", #else "no", #endif #if HAVE_LAVF "yes", #else "no", #endif #if HAVE_FFMS "yes", #else "no", #endif #if HAVE_GPAC "gpac", #elif HAVE_LSMASH "lsmash", #else "no", #endif #if HAVE_BITDEPTH8 && HAVE_BITDEPTH10 "8/10" #elif HAVE_BITDEPTH8 "8" #elif HAVE_BITDEPTH10 "10" #else "none" #endif ); H0( "Example usage:\n" ); H0( "\n" ); H0( " Constant quality mode:\n" ); H0( " x264 --crf 24 -o \n" ); H0( "\n" ); H0( " Two-pass with a bitrate of 1000kbps:\n" ); H0( " x264 --pass 1 --bitrate 1000 -o \n" ); H0( " x264 --pass 2 --bitrate 1000 -o \n" ); H0( "\n" ); H0( " Lossless:\n" ); H0( " x264 --qp 0 -o \n" ); H0( "\n" ); H0( " Maximum PSNR at the cost of speed and visual quality:\n" ); H0( " x264 --preset placebo --tune psnr -o \n" ); H0( "\n" ); H0( " Constant bitrate at 1000kbps with a 2 second-buffer:\n"); H0( " x264 --vbv-bufsize 2000 --bitrate 1000 -o \n" ); H0( "\n" ); H0( "Presets:\n" ); H0( "\n" ); H0( " --profile Force the limits of an H.264 profile\n" " Overrides all settings.\n" ); H2( #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT <= X264_CSP_I420 #if HAVE_BITDEPTH8 #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT == X264_CSP_I420 " - baseline:\n" " --no-8x8dct --bframes 0 --no-cabac\n" " --cqm flat --weightp 0\n" " No interlaced.\n" " No lossless.\n" " - main:\n" " --no-8x8dct --cqm flat\n" " No lossless.\n" #endif " - high:\n" " No lossless.\n" #endif #if HAVE_BITDEPTH10 " - high10:\n" " No lossless.\n" " Support for bit depth 8-10.\n" #endif #endif #if !X264_CHROMA_FORMAT || X264_CHROMA_FORMAT == X264_CSP_I422 " - high422:\n" " No lossless.\n" " Support for bit depth 8-10.\n" " Support for 4:2:0/4:2:2 chroma subsampling.\n" #endif " - high444:\n" " Support for bit depth 8-10.\n" " Support for 4:2:0/4:2:2/4:4:4 chroma subsampling.\n" ); else H0( " - %s\n", stringify_names( buf, x264_valid_profile_names ) ); H0( " --preset Use a preset to select encoding settings [medium]\n" " Overridden by user settings.\n" ); H2( " - ultrafast:\n" " --no-8x8dct --aq-mode 0 --b-adapt 0\n" " --bframes 0 --no-cabac --no-deblock\n" " --no-mbtree --me dia --no-mixed-refs\n" " --partitions none --rc-lookahead 0 --ref 1\n" " --scenecut 0 --subme 0 --trellis 0\n" " --no-weightb --weightp 0\n" " - superfast:\n" " --no-mbtree --me dia --no-mixed-refs\n" " --partitions i8x8,i4x4 --rc-lookahead 0\n" " --ref 1 --subme 1 --trellis 0 --weightp 1\n" " - veryfast:\n" " --no-mixed-refs --rc-lookahead 10\n" " --ref 1 --subme 2 --trellis 0 --weightp 1\n" " - faster:\n" " --no-mixed-refs --rc-lookahead 20\n" " --ref 2 --subme 4 --weightp 1\n" " - fast:\n" " --rc-lookahead 30 --ref 2 --subme 6\n" " --weightp 1\n" " - medium:\n" " Default settings apply.\n" " - slow:\n" " --direct auto --rc-lookahead 50 --ref 5\n" " --subme 8 --trellis 2\n" " - slower:\n" " --b-adapt 2 --direct auto --me umh\n" " --partitions all --rc-lookahead 60\n" " --ref 8 --subme 9 --trellis 2\n" " - veryslow:\n" " --b-adapt 2 --bframes 8 --direct auto\n" " --me umh --merange 24 --partitions all\n" " --ref 16 --subme 10 --trellis 2\n" " --rc-lookahead 60\n" " - placebo:\n" " --bframes 16 --b-adapt 2 --direct auto\n" " --slow-firstpass --no-fast-pskip\n" " --me tesa --merange 24 --partitions all\n" " --rc-lookahead 60 --ref 16 --subme 11\n" " --trellis 2\n" ); else H0( " - ultrafast,superfast,veryfast,faster,fast\n" " - medium,slow,slower,veryslow,placebo\n" ); H0( " --tune Tune the settings for a particular type of source\n" " or situation\n" " Overridden by user settings.\n" " Multiple tunings are separated by commas.\n" " Only one psy tuning can be used at a time.\n" ); H2( " - film (psy tuning):\n" " --deblock -1:-1 --psy-rd :0.15\n" " - animation (psy tuning):\n" " --bframes {+2} --deblock 1:1\n" " --psy-rd 0.4: --aq-strength 0.6\n" " --ref {Double if >1 else 1}\n" " - grain (psy tuning):\n" " --aq-strength 0.5 --no-dct-decimate\n" " --deadzone-inter 6 --deadzone-intra 6\n" " --deblock -2:-2 --ipratio 1.1\n" " --pbratio 1.1 --psy-rd :0.25\n" " --qcomp 0.8\n" " - stillimage (psy tuning):\n" " --aq-strength 1.2 --deblock -3:-3\n" " --psy-rd 2.0:0.7\n" " - psnr (psy tuning):\n" " --aq-mode 0 --no-psy\n" " - ssim (psy tuning):\n" " --aq-mode 2 --no-psy\n" " - fastdecode:\n" " --no-cabac --no-deblock --no-weightb\n" " --weightp 0\n" " - zerolatency:\n" " --bframes 0 --force-cfr --no-mbtree\n" " --sync-lookahead 0 --sliced-threads\n" " --rc-lookahead 0\n" ); else H0( " - psy tunings: film,animation,grain,\n" " stillimage,psnr,ssim\n" " - other tunings: fastdecode,zerolatency\n" ); H2( " --slow-firstpass Don't force these faster settings with --pass 1:\n" " --no-8x8dct --me dia --partitions none\n" " --ref 1 --subme {2 if >2 else unchanged}\n" " --trellis 0 --fast-pskip\n" ); else H1( " --slow-firstpass Don't force faster settings with --pass 1\n" ); H0( "\n" ); H0( "Frame-type options:\n" ); H0( "\n" ); H0( " -I, --keyint Maximum GOP size [%d]\n", defaults->i_keyint_max ); H2( " -i, --min-keyint Minimum GOP size [auto]\n" ); H2( " --no-scenecut Disable adaptive I-frame decision\n" ); H2( " --scenecut How aggressively to insert extra I-frames [%d]\n", defaults->i_scenecut_threshold ); H2( " --intra-refresh Use Periodic Intra Refresh instead of IDR frames\n" ); H1( " -b, --bframes Number of B-frames between I and P [%d]\n", defaults->i_bframe ); H1( " --b-adapt Adaptive B-frame decision method [%d]\n" " Higher values may lower threading efficiency.\n" " - 0: Disabled\n" " - 1: Fast\n" " - 2: Optimal (slow with high --bframes)\n", defaults->i_bframe_adaptive ); H2( " --b-bias Influences how often B-frames are used [%d]\n", defaults->i_bframe_bias ); H1( " --b-pyramid Keep some B-frames as references [%s]\n" " - none: Disabled\n" " - strict: Strictly hierarchical pyramid\n" " - normal: Non-strict (not Blu-ray compatible)\n", strtable_lookup( x264_b_pyramid_names, defaults->i_bframe_pyramid ) ); H1( " --open-gop Use recovery points to close GOPs\n" " Only available with b-frames\n" ); H1( " --no-cabac Disable CABAC\n" ); H1( " -r, --ref Number of reference frames [%d]\n", defaults->i_frame_reference ); H1( " --no-deblock Disable loop filter\n" ); H1( " -f, --deblock Loop filter parameters [%d:%d]\n", defaults->i_deblocking_filter_alphac0, defaults->i_deblocking_filter_beta ); H2( " --slices Number of slices per frame; forces rectangular\n" " slices and is overridden by other slicing options\n" ); else H1( " --slices Number of slices per frame\n" ); H2( " --slices-max Absolute maximum slices per frame; overrides\n" " slice-max-size/slice-max-mbs when necessary\n" ); H2( " --slice-max-size Limit the size of each slice in bytes\n"); H2( " --slice-max-mbs Limit the size of each slice in macroblocks (max)\n"); H2( " --slice-min-mbs Limit the size of each slice in macroblocks (min)\n"); H0( " --tff Enable interlaced mode (top field first)\n" ); H0( " --bff Enable interlaced mode (bottom field first)\n" ); H2( " --constrained-intra Enable constrained intra prediction.\n" ); H0( " --pulldown Use soft pulldown to change frame rate\n" " - %s (requires cfr input)\n", stringify_names( buf, x264_pulldown_names ) ); H2( " --fake-interlaced Flag stream as interlaced but encode progressive.\n" " Makes it possible to encode 25p and 30p Blu-Ray\n" " streams. Ignored in interlaced mode.\n" ); H2( " --frame-packing For stereoscopic videos define frame arrangement\n" " - 0: checkerboard - pixels are alternatively from L and R\n" " - 1: column alternation - L and R are interlaced by column\n" " - 2: row alternation - L and R are interlaced by row\n" " - 3: side by side - L is on the left, R on the right\n" " - 4: top bottom - L is on top, R on bottom\n" " - 5: frame alternation - one view per frame\n" " - 6: mono - 2D frame without any frame packing\n" " - 7: tile format - L is on top-left, R split across\n" ); H0( "\n" ); H0( "Ratecontrol:\n" ); H0( "\n" ); H1( " -q, --qp Force constant QP (0-%d, 0=lossless)\n", QP_MAX ); H0( " -B, --bitrate Set bitrate (kbit/s)\n" ); H0( " --crf Quality-based VBR (%d-51) [%.1f]\n", 51 - QP_MAX_SPEC, defaults->rc.f_rf_constant ); H1( " --rc-lookahead Number of frames for frametype lookahead [%d]\n", defaults->rc.i_lookahead ); H0( " --vbv-maxrate Max local bitrate (kbit/s) [%d]\n", defaults->rc.i_vbv_max_bitrate ); H0( " --vbv-bufsize Set size of the VBV buffer (kbit) [%d]\n", defaults->rc.i_vbv_buffer_size ); H2( " --vbv-init Initial VBV buffer occupancy [%.1f]\n", defaults->rc.f_vbv_buffer_init ); H2( " --crf-max With CRF+VBV, limit RF to this value\n" " May cause VBV underflows!\n" ); H2( " --qpmin Set min QP [%d]\n", defaults->rc.i_qp_min ); H2( " --qpmax Set max QP [%d]\n", X264_MIN( defaults->rc.i_qp_max, QP_MAX ) ); H2( " --qpstep Set max QP step [%d]\n", defaults->rc.i_qp_step ); H2( " --ratetol Tolerance of ABR ratecontrol and VBV [%.1f]\n", defaults->rc.f_rate_tolerance ); H2( " --ipratio QP factor between I and P [%.2f]\n", defaults->rc.f_ip_factor ); H2( " --pbratio QP factor between P and B [%.2f]\n", defaults->rc.f_pb_factor ); H2( " --chroma-qp-offset QP difference between chroma and luma [%d]\n", defaults->analyse.i_chroma_qp_offset ); H2( " --aq-mode AQ method [%d]\n" " - 0: Disabled\n" " - 1: Variance AQ (complexity mask)\n" " - 2: Auto-variance AQ\n" " - 3: Auto-variance AQ with bias to dark scenes\n", defaults->rc.i_aq_mode ); H1( " --aq-strength Reduces blocking and blurring in flat and\n" " textured areas. [%.1f]\n", defaults->rc.f_aq_strength ); H1( "\n" ); H0( " -p, --pass Enable multipass ratecontrol\n" " - 1: First pass, creates stats file\n" " - 2: Last pass, does not overwrite stats file\n" ); H2( " - 3: Nth pass, overwrites stats file\n" ); H1( " --stats Filename for 2 pass stats [\"%s\"]\n", defaults->rc.psz_stat_out ); H2( " --no-mbtree Disable mb-tree ratecontrol.\n"); H2( " --qcomp QP curve compression [%.2f]\n", defaults->rc.f_qcompress ); H2( " --cplxblur Reduce fluctuations in QP (before curve compression) [%.1f]\n", defaults->rc.f_complexity_blur ); H2( " --qblur Reduce fluctuations in QP (after curve compression) [%.1f]\n", defaults->rc.f_qblur ); H2( " --zones //... Tweak the bitrate of regions of the video\n" ); H2( " Each zone is of the form\n" " ,,